-
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
Bring up transmission timestamp of packets to P4 #1281
Comments
There is a C++ method named If you look in that same file for where it is called, it is used to fill in the values of metadata fields Thus if you change only the definition of method |
Thanks @jafingerhut , I saw These values miss some delays when measuring the time a packet is taken when it goes through from an ingress port to an egress port of a BMv2 switch. For example, |
You are correct that ingress/egress_global_timestamp are read shortly before the current packet begins its ingress/egress processing. It sounds like during egress processing, you want a packet to be able to read the time that the previous packet going to the same output port was transmitted? And I guess you want to maintain this value independently for each port of the switch? If you want it globally for the whole device, that may be slightly easier to implement in BMv2, but it sounds like something that I have no idea what you would use it for, if it were the last time a packet was transmitted on any port. I have not added such a feature to BMv2 before, but one way would be to add a new object that looks like a P4 register array, with one element per port, indexed by the port number, where the value was the last time a packet was transmitted on that port. If you restrict yourself in the P4 program to never writing it, and only reading the entry that corresponds to the packet's destination port in standard_metadata.egress_port, that might behave the way you hope? Note that for a very high speed P4-programmable device, there might be multiple packets being processed in a pipeline simultaneously, all going to the same output port. Trying to implement something like this in such a device would either (a) prevent that pipelining, or (b) read the time that a packet 2 or 3 packets before went to the port, not the previous one. |
Thanks @jafingerhut for detailed suggestion! I will looking into the way the register being implemented. Otherwise, to improve the performance I'm thinking about something like |
I'm trying to bring transmission timestamp of a packet up to P4 program.
I see that I can override
bmi_interface_send
to get the tx timestamp. It is not a big deal as I can access to its raw socket descriptor, then by settingSO_TIMESTAMPING
option to the socket I can get tx timestamp.I was wondering whether there exists a simple way to bring this tx timestamp up to the P4 program (this timestamp will be used by the next iteration, e.g., when the P4 program processes the next packet).
Thanks in advance for any suggestion!
The text was updated successfully, but these errors were encountered: