behavioral-model icon indicating copy to clipboard operation
behavioral-model copied to clipboard

simple_switch_grpc time synchronization

Open yhx-coder opened this issue 2 years ago • 4 comments

hi, I use simple_switch_grpc to build a bmv2 switch topology. I have read the BMv2 timestamp implementation notes and I want to ask if I want to call a method like gettimeofday, how should I implement it? Is it in the simple_switch.cpp ,the same as simple_switch?

yhx-coder avatar Nov 11 '22 10:11 yhx-coder

You would need to look for occurrences of the metadata field names ingress_global_timestamp and egress_global_timestamp, and update the code there. It appears there are only a few such places, as far as I know (I have not tried to make this change before):

ingress_global_timestamp: https://github.com/p4lang/behavioral-model/blob/main/targets/simple_switch/simple_switch.cpp#L265

egress_global_timestamp: https://github.com/p4lang/behavioral-model/blob/main/targets/simple_switch/simple_switch.cpp#L654

jafingerhut avatar Nov 11 '22 12:11 jafingerhut

You would need to look for occurrences of the metadata field names ingress_global_timestamp and egress_global_timestamp, and update the code there. It appears there are only a few such places, as far as I know (I have not tried to make this change before):

ingress_global_timestamp: https://github.com/p4lang/behavioral-model/blob/main/targets/simple_switch/simple_switch.cpp#L265

egress_global_timestamp: https://github.com/p4lang/behavioral-model/blob/main/targets/simple_switch/simple_switch.cpp#L654

Thanks for your reply. So may I understand that there are no related files in the targets/simple_switch_grpc folder ? And I just need to find it in the simple_switch.cpp? In other words, metadata fields telemetry related are defined in the simple_switch? Best wishes.

yhx-coder avatar Nov 11 '22 13:11 yhx-coder

As far as I know, the simple_switch_grpc process is compiled from nearly the same source code as the simple_switch process, except it also has some additional source files for a gRPC server for P4Runtime API.

That said, try it out and see what happens. Add some debug print statements to your changes, and see whether they appear in the output or not when you run simple_switch_grpc. Then you will know for sure, no matter what I write here :-)

jfingerh avatar Nov 11 '22 14:11 jfingerh

Thanks. I'll try it.

yhx-coder avatar Nov 13 '22 06:11 yhx-coder

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment, or this will be closed in 180 days

github-actions[bot] avatar May 13 '23 00:05 github-actions[bot]