-
Notifications
You must be signed in to change notification settings - Fork 82
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
PSA Proposed description of PortId_t translation in PSA #562
Changes from all commits
8c56f18
202f711
f82dc41
7e84eef
2e2a8a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,28 @@ const CloneSessionId_t PSA_CLONE_SESSION_TO_CPU = unspecified; | |
|
||
#endif | ||
|
||
// BEGIN:Type_defns2 | ||
|
||
/* Note: All of the widths for types with `InHeader` in their name are | ||
* intended only to carry values of the corresponding types in packet | ||
* headers between a controller and a PSA device. The widths are | ||
* intended to be large enough for all PSA devices, so that a | ||
* controller can fill in headers with these fields in a common way | ||
* for all PSA devices. | ||
* | ||
* All widths must be a multiple of 8, so that any subset of these | ||
* fields may be used in a single P4 header definition, even on P4 | ||
* implementations that restrict headers to contain fields with a | ||
* total length that is a multiple of 8 bits. */ | ||
typedef bit<16> PortIdInHeader_t; | ||
typedef bit<32> MulticastGroupInHeader_t; | ||
typedef bit<16> CloneSessionIdInHeader_t; | ||
typedef bit<8> ClassOfServiceInHeader_t; | ||
typedef bit<16> PacketLengthInHeader_t; | ||
typedef bit<16> EgressInstanceInHeader_t; | ||
typedef bit<64> TimestampInHeader_t; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we explicitly state that we do not need translation annotations for these other types? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vgurevich @antoninbas @samar-abdi Any thoughts on whether any of these other types would need conversion of values? Can the control plane API just use whatever multicast group numbers and egress instance numbers it wants? I assume different implementations will have different numbers of these things that they support, and some might have more restricted numerical ranges than others. Does a P4Runtime API controller have a way to discover such restrictions on these values for different PSA devices in a heterogenous network? Do we expect ClassOfService_t values to be numerically consecutive in a range [0, N] for all PSA devices, and should say that in PSA? Same question for CloneSessionId values. I think we are safe from such issues for PacketLength_t and Timestamp_t values, i.e. some implementations might have different maximum PacketLength_t values they actually support, but all of them will be [my_min, my_max] for packet length support for some my_min, my_max integers, and timestamps should be all X-bit-wide values for the value of X supported by the implementation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very likely class of service will need translation. It has the same issue as ports. Different controllers may have different notions of classes of service and their own numbering scheme for them. The switch config handler on the target will map the controller's class of service to the ASIC's. Other metadata values are either programmed by the controller (mcast_group/egress instance) or have universally agreed values (packet_length/timestamp) IMO. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we should explicitly document that type ClassOfService_t fields will be translated between controller and P4 data plane programs, as PortId_t fields will be, but no others will ? Do we expect, and should we perhaps document, that for all of the following types, the data plane and the control plane will both support all numerical values in the range [0, N] for whatever maximum value of N is supported by the PSA device (which can vary from one PSA implementation to another)?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes for documenting translation of ClassOfService_t field values. The P4Runtime annotation will be As for your second point, I suggest : "The values of multicast_group, clone_session and egress_instance are completely in the purview of the controller, and are limited only by the bitwidth of the respective types on the PSA device(s) being controlled by the controller." I believe it is implicit that if a psa.p4 has bit<7> multicast_group_id, it will allow all values from 0 to 127. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know it is common for things in computers to have sizes that are powers of 2, but it sometimes happens that people implement SRAMs with a number of entries that aren't powers of 2 (or a collection of them whose total number of entries is not a power of 2, more likely, but have a common address space spanning all of them). I would hate for a controller to have an easily avoided bug if this turns out to be the case, because it made such power-of-2 size assumption. |
||
// END:Type_defns2 | ||
|
||
// BEGIN:Metadata_types | ||
enum PSA_PacketPath_t { | ||
NORMAL, /// Packet received by ingress that is none of the cases below. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe P4Runtime disallows such behavior: all wildcards or LPM with prefix of 0. @antoninbas can confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cc10512 I am pretty sure P4Runtime allows one to create table entries that completely wildcard ternary fields, or do length 0 prefix of lpm fields -- it is just that they represent it in a way where the field isn't even mentioned in the P4Runtime API message.
My reference for this is this recent PR, including my clarifying question and Antonin's answer: p4lang/PI#293
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jafingerhut is correct; we do allow wildcards for ternary & LPM but require a certain formatting for the messages.