nsg-ethz/p4-learning

Questions about examples/digest_messages

butuizd opened this issue · 3 comments

I have 3 questions.

  1. What's the exact struct about message received by the controller through digest? Where can I get the information?

I read the controller script get_digest.py, and find that there are many other fields besides the user-defined metadata in p4 code from here , such as topic, device_id, ctx_id, list_id, buffer_id, num from here.

  1. Will simple_switch add several messages to a digest message? If it will, how can I make the switch send one message at a time instead several messages?

I read the controller script get_digest.py, and find that the controller will use a loop to unpack the received messages from here.

  1. what does the function bm_learning_ack_buffer() do? And where can I get the information about it?

The function is also in the script get_digest.py from here.

Hi @butuizd

  1. There is no official documentation about digest. The only way to know how to use it, is by the little information you can find in mailing lists, issues, or here. Now I can not find more info, but basically:

device_id is the switch id, ctx_id, list_id and buffer_id somehow identify the digested packet. And it needs to be used to acknowledge it to the switch https://github.com/nsg-ethz/p4-learning/blob/master/examples/digest_messages/get_digest.py#L29

num is the number of aggregated digests.

  1. Digests are somehow buffered, if you call digest very fast it will in theory batch several packets together, I guess the time it buffers can be found in the simple_switch code. Also, if you digest the same thing multiple times it will only appear one time in the "buffer".

If you want a different behaviour, use copy to cpu.

  1. Again, there is no more info than the code itself (unless there is new documentation). The, function is used to acknowledge one digest message, something needed to continue digesting new packets.

Thanks a lot @edgar-costa . If I use the p4runtime API, whether I can process the digest message in controller more easily ,which means I don't have to care the fields such as topic, device_id, ctx_id, list_id, buffer_id, num .

Well, then, all good!

Our new version of p4-utils, will have a P4runtime based controller.