p4lang / tutorials

P4 language tutorials
Apache License 2.0
1.33k stars 881 forks source link

MRI example,how does the P4 get theinformationof the switch when it is running? #514

Closed heaij closed 9 months ago

heaij commented 1 year ago

I'm a beginner of p4. I'm,a little confuse ,in the mri example, how does the P4 get the id of the switch and qdepth when it is running?in the code only have parameter call(hdr.swtraces[0].swid = swid;hdr.swtraces[0].qdepth = (qdepth_t)standard_metadata.deq_qdepth;)How exactly does P4 get swid and queue information?

jafingerhut commented 1 year ago

It is true that your question is relevant to code in this repository, but I would encourage you to ask your question on this web forum instead, where more people are likely to be reading and willing to answer than here, and the discussion/answers will be more easily searchable in the future (I hope): https://forum.p4.org/