-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementing new switch architecture on BMV2 #808
Comments
Implementing a new architecture with bmv2 is pretty straightforward. Although there is no step-by-step documentation, there are a couple examples under the targets/ directory (https://github.com/p4lang/behavioral-model/tree/master/targets). The simple_switch target implements the v1model P4 architecture (the names are different mostly for historical reasons), while the psa_switch target implements the PSA P4 architecture. The major difficulty when you want to support a new architecture with bmv2 is to add compiler support. The p4lang/p4c backend currently supports both v1model (simple_switch) and PSA (psa_switch), although PSA support is still a work in progress: https://github.com/p4lang/p4c/tree/master/backends/bmv2. The backend is required to produce a JSON file (https://github.com/p4lang/behavioral-model/blob/master/docs/JSON_format.md) from the input P4 code. The JSON file will be "interpreted" by your bmv2 binary (simple_switch, psa_switch or your own if you implement support for a new architecture in bmv2) and the file must match your architecture definition. For example, if your architecture expects 2 controls ("ingress" and "egress"), the JSON file must define these 2 controls. It can be pretty daunting to add support for your own architecture to the p4lang/p4c compiler backend for bmv2. If you only want to make some small changes to v1model / simple_switch, such as add your new extern type, then things are not as bad. Adding your own extern type to simple_switch can be done with as little as 20 lines of code, and very few changes (if any) to the compiler. |
|
|
hi antoninbas, |
Hello, |
@ArifulIslamPreence bmv2 switches are software, executed as user space processes running on Linux or macOS (or any other operating system on which you can get it to compile and run, but those two operating systems are best supported), on general purposes CPUs such as x86 family CPUs made by Intel and AMD. When running there, the P4 tables are stored in system DRAM, with a little bit of it cached in on-chip SRAM which constitutes the L1, L2, and/or L3 caches of the general purpose CPU, just as any other data structures stored in the memory of a user space process do. Such systems typically have no TCAM at all. |
I am trying to implement new hardware architecture on bmv2. Though in some places the documentation says, bmv2 is redesigned to support new architectures I have not found any documentation on how to implement that.
Can anyone please give some concrete idea on what are the steps to implement a new architecture on bmv2. Is there any documentation?
The text was updated successfully, but these errors were encountered: