-
Notifications
You must be signed in to change notification settings - Fork 80
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 Update clone operations to use clone_session_id #515
Merged
jafingerhut
merged 1 commit into
p4lang:master
from
jafingerhut:psa-clone-uses-clone-sessions
Dec 14, 2017
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -481,18 +481,26 @@ assist P4 developers in debugging their code. | |
packets, which are not required to support truncation. | ||
} | ||
if (ostd.clone) { | ||
if (ostd.clone_class_of_service value is not supported) { | ||
ostd.clone_class_of_service = 0; | ||
// Recommmended to log error about unsupported | ||
// ostd.clone_class_of_service value. | ||
} | ||
if (platform_port_valid(ostd.clone_port)) { | ||
create a clone of the packet and send it to the packet | ||
buffer with class of service ostd.clone_class_of_service, | ||
after which it will start egress processing. | ||
if (ostd.clone_session_id value is supported) { | ||
cos = class_of_service configured for ostd.clone_session_id in PRE | ||
ep = egress_port configured for ostd.clone_session_id in PRE | ||
if (cos value is not supported) { | ||
cos = 0; | ||
// Recommmended to log error about unsupported cos | ||
// value. | ||
} | ||
if (platform_port_valid(ep)) { | ||
create a clone of the packet and send it to the packet | ||
buffer with the egress_port ep and | ||
class_of_service cos, after which it will start | ||
egress processing. | ||
} else { | ||
// Do not create a clone. Recommended to log error | ||
// about unsupported ep value. | ||
} | ||
} else { | ||
// Do not create a clone. Recommended to log error about | ||
// unsupported ostd.clone_port value. | ||
// Do not create a clone. Recommmended to log error about | ||
// unsupported ostd.clone_session_id value. | ||
} | ||
} | ||
// Continue below, regardless of whether a clone was created. | ||
|
@@ -685,18 +693,18 @@ packet contents and metadata when a packet begins egress processing. | |
+--------------+-------------+---------------+--------------+-----+ | ||
| EgressParser `istd` fields (type `psa_egress_parser_input_metadata_t`) ||||| | ||
+--------------+-------------+---------------+--------------+-----+ | ||
| `egress_port` | `ostd.egress_port` | from PRE | `ostd.clone_port` | `ostd.clone_port` | | ||
| | of ingress packet | configuration | of cloned | of cloned | | ||
| | | | ingress packet | egress packet | | ||
| `egress_port` | `ostd.egress_port` | from PRE | from PRE configuration || | ||
| | of ingress packet | configuration | of clone session || | ||
| | | of multicast group | || | ||
+--------------+-------------+---------------+--------------+-----+ | ||
| `packet_path` | NORMAL_ | NORMAL_ | CLONE_I2E | CLONE_E2E | | ||
| | UNICAST | MULTICAST | | | | ||
+--------------+-------------+---------------+--------------+-----+ | ||
+--------------+-------------+---------------+--------------+-----+ | ||
| Egress `istd` fields (type `psa_egress_input_metadata_t`) ||||| | ||
+--------------+-------------+---------------+--------------+-----+ | ||
| `class_of_service` | `ostd.class_of_service` || `ostd.clone_class_of_service` of || | ||
| | of ingress packet || packet that caused this clone || | ||
| `class_of_service` | `ostd.class_of_service` || from PRE configuration || | ||
| | of ingress packet || of clone session || | ||
+--------------+-------------+---------------+--------------+-----+ | ||
| `egress_port` | Same value as received by EgressParser above. |||| | ||
+--------------+-------------+---------------+--------------+-----+ | ||
|
@@ -816,19 +824,26 @@ the contents of several metadata fields in the struct | |
packets, which are not required to support truncation. | ||
} | ||
if (ostd.clone) { | ||
if (ostd.clone_class_of_service value is not supported) { | ||
ostd.clone_class_of_service = 0; | ||
// Recommmended to log error about unsupported | ||
// ostd.clone_class_of_service value. | ||
} | ||
if (platform_port_valid(ostd.clone_port)) { | ||
create a copy of the packet and send it to the packet | ||
buffer with class of service specified by | ||
ostd.clone_class_of_service, after which it will start | ||
egress processing. | ||
if (ostd.clone_session_id value is supported) { | ||
cos = class_of_service configured for ostd.clone_session_id in PRE | ||
ep = egress_port configured for ostd.clone_session_id in PRE | ||
if (cos value is not supported) { | ||
cos = 0; | ||
// Recommmended to log error about unsupported cos | ||
// value. | ||
} | ||
if (platform_port_valid(ep)) { | ||
create a clone of the packet and send it to the packet | ||
buffer with the egress_port ep and | ||
class_of_service cos, after which it will start | ||
egress processing. | ||
} else { | ||
// Do not create a clone. Recommended to log error | ||
// about unsupported ep value. | ||
} | ||
} else { | ||
// Do not create a clone. Recommended to log error about | ||
// unsupported ostd.clone_port value. | ||
// Do not create a clone. Recommmended to log error about | ||
// unsupported ostd.clone_session_id value. | ||
} | ||
} | ||
// Continue below, regardless of whether a clone was created. | ||
|
@@ -931,17 +946,28 @@ are those whose names begin with `clone` in types | |
`psa_ingress_output_metadata_t` and `psa_egress_output_metadata_t`. | ||
|
||
``` | ||
bool clone; | ||
PortId_t clone_port; | ||
ClassOfService_t clone_class_of_service; | ||
bool clone; | ||
CloneSessionId_t clone_session_id; | ||
``` | ||
|
||
The `clone` flag specifies whether a packet should be cloned. If | ||
true, then a cloned packet should be generated at the end of the | ||
pipeline. The `clone_port` specifies which port to send the cloned | ||
packet to, after egress processing. The `clone_port` could be any | ||
addressable port in the pipeline. For instance, it can be a port to | ||
the control CPU or a port to the next hop router. | ||
pipeline. The `clone_session_id` specifies one of several possible | ||
clone sessions that the control plane may configure in the PRE. For | ||
each clone session, the control plane may configure the `egress_port` | ||
and `class_of_service` values that should be associated with packets | ||
cloned using that session. | ||
|
||
The `egress_port` may be any port that can be used for normal unicast | ||
packets, i.e. any normal port, `PORT_CPU`, or `PORT_RECIRCULATE`. For | ||
the latter two values, the cloned packet will be sent to the CPU, or | ||
recirculated at the end of egress processing, as a normal unicast | ||
packet would at the end of egress processing. | ||
|
||
Since it is an expected common case to clone packets to the CPU, every | ||
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. Thanks @jafingerhut |
||
PSA implementation begins with a clone session | ||
`PSA_CLONE_SESSION_TO_CPU` initialized with `egress_port = PORT_CPU` | ||
and `class_of_service = 0`. | ||
|
||
|
||
### Clone Examples {#sec-clone-examples} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Thanks @jafingerhut
Are we mandating that these are the only two configurations that a PSA PRE will support? What about truncation?
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 am open to adding a truncation configuration value per clone session, if folks want it. @hanw @vgurevich thoughts on that?
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.
In general, I think of PSA as saying "at least this much, but an implementation is free to do more". Of course, taking advantage of more reduces portability, I know. If you know of other configuration options besides the ones listed that you want to discuss, this is a good place to ask about them.
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.
OK, but we will have packet length in the P4Runtime API regardless, with the assumption that either switch SW or ASIC will support it.
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.
We can have it in P4 Runtime if there is interest, but that kind of line-rate packet operation (I'm talking about truncation) has to be supported in the hardware.
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 saw this for the truncate operation:
For all copies of the packet made at the end of ingress processing,
truncate the payload to be at most the specified number of bytes.
Specifying 0 is legal, and causes only packet headers to be sent, with
no payload.
I suppose this applies to clones and multicast replicas.
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
Section 6.3.4
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.
We may want a single place that summarizes how to truncate operations are supposed to work. For example, here is a little note stuck in Section 6.2 right now "Note: Truncation is not currently supported for cloned packets. The functionality of a truncated cloned packet can be replaced with sending a digest." There are also notes about truncation not needing to be supported for resubmit and recirculate packets.
I suspect it may be a good idea to add truncate options/parameters in the clone session configuration state. I will make an issue to discuss at next PSA WG meeting, so people have a chance to comment.
If there are no known issues with this PR other than whether truncate options should be included in the per-clone-session configuration state, I suggest we merge this in, and add that with a later PR after discussion.
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.
@samar-abdi Looks like the current PSA draft contradicts itself in different sections on whether truncation must be supported for cloned packets, or not. I have created this issue that will hopefully be discussed at next PSA WG, and resolved soon: #519
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 I am ok with merging this PR and dealing with truncation separately. Thanks!