Skip to content
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

Is there a simple_switch_grpc switch port for P4Runtime PacketIn/PacketOut ? #831

Closed
jafingerhut opened this issue Dec 4, 2019 · 4 comments · Fixed by #833
Closed

Is there a simple_switch_grpc switch port for P4Runtime PacketIn/PacketOut ? #831

jafingerhut opened this issue Dec 4, 2019 · 4 comments · Fixed by #833
Assignees

Comments

@jafingerhut
Copy link
Contributor

Is there some either hard-coded or configurable port number that one can send packets to in a P4 program, e.g. using the P4_16 v1model architecture, such that packets sent to that port become PacketIn messages to a P4Runtime client that is connected to simple_switch_grpc (when it is acting as a P4Runtime server) ?

Similarly for PacketOut messages, which I presume would be the same port number according to the P4 code.

@antoninbas
Copy link
Member

Yes, it can be set with --cpu-port, which is a target-specific argument. Target-specific arguments are separated from standard bmv2 arguments by --.

simple_switch_grpc <normal args: interfaces, --skip-p4, ...> -- --cpu-port <xyz>

It defaults to 0xffffffff, as per the P4Runtime spec.

@jafingerhut
Copy link
Contributor Author

Thanks, Antonin. Good to know.

With that default value, I guess the current v1model.p4 included with p4c has an egress_spec value that is only 9 bits wide, and thus cannot use the default cpu port value?

No big worries there, since we can explicitly assign it a value when starting simple_switch_grpc.

@antoninbas
Copy link
Member

This is true, and when you write 0xffffffff to a 9-bit value you get 511, which simple_switch uses as the drop port, so it's a bit confusing.

For some resources:

@antoninbas
Copy link
Member

Actually I misread the code: https://github.com/p4lang/behavioral-model/blob/master/targets/simple_switch_grpc/main.cpp#L78. If the option is not provided, cpu_port defaults to 0, which is not a valid CPU port number. Basically, if you do not provide the --cpu-port flag explicitly, no packets will ever be sent to the controller through the P4Runtime stream channel. I guess it is an acceptable behavior, although it would benefit from being documented somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants