You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many P4 targets impose the limitation that headers must be a multiple of 8 bits long.
PSA defines several data plane types such as PortId_t that are bit<W>, where the value of W is fixed for a single target, but can vary from one target to another. It need not be a multiple of 8 bits long.
Today there is no way to write P4 source code that includes such a field in a header definition and is portable across multiple targets with different bit widths for these fields, while satisfying the multiple-of-8-bits restriction that I suspect a large fraction of targets require.
PSA's current approach is to define additional types with similar, but different, names, where each is guaranteed to have a size that is a multiple of 8 bits by itself.
It may be useful to consider some kind of explicit padding constructs in the definition of P4 header types, where the size of the padding might vary from target to target, but no one need modify the P4 source code to adjust the size of the padding manually for each target.
The text was updated successfully, but these errors were encountered:
If the padding is target specific it would be better to have a compiler option that specifies the padding and the size for the target. Or the size can simply be part of the backend for the target, in which case the option just signals to pad all headers (I can't imagine that we'll have a case in which some headers need to be aligned (padded) and some won't).
Many P4 targets impose the limitation that headers must be a multiple of 8 bits long.
PSA defines several data plane types such as
PortId_t
that arebit<W>
, where the value ofW
is fixed for a single target, but can vary from one target to another. It need not be a multiple of 8 bits long.Today there is no way to write P4 source code that includes such a field in a header definition and is portable across multiple targets with different bit widths for these fields, while satisfying the multiple-of-8-bits restriction that I suspect a large fraction of targets require.
PSA's current approach is to define additional types with similar, but different, names, where each is guaranteed to have a size that is a multiple of 8 bits by itself.
It may be useful to consider some kind of explicit padding constructs in the definition of P4 header types, where the size of the padding might vary from target to target, but no one need modify the P4 source code to adjust the size of the padding manually for each target.
The text was updated successfully, but these errors were encountered: