Inquiry Regarding Digests vs Packet_In Messages

Hello!

I had a couple of general inquires regarding the functionality of Packet_I messages vs Digest messages.

I’m wanting to use p4 to quickly send information about a packet to a runtime api – the idea is that packets with a certain flag on them will have details in the data frame relayed to the local api running on the switch for further processing.

I’ve read a bit about Digests and Packet_In messages, but I’m still somewhat lost on what scenarios you should use one over the other. I know that digests typically allow you to take “bits and pieces” of packets to send to the controller, and that the the digest protocol typically pools together digest messages before sending them. However, I’m curious if I’m missing any large differences between the two. Is one faster than the other? Are the certain scenarios where you should most definitely NOT use a digest message?

Nothing in the definition of a digest message mentions a limit on how large they can be. However, any given implementation will have a finite limit on the maximum size of a digest message. I would guesstimate that high-speed ASIC implementations might limit their size to something like 64 to 256 bits. For such an implementation, clearly you should not use a digest message if you want more bits than that sent from the data plane to the control plane. (Yes, some implementations might let you create more than one digest message generated for a single packet, and then perhaps you could multiply that limit by the number of digest messages you could send per packet in that implementation.)

A general property of the fairly small number of P4 implementations that exist in high-speed ASICs today is that they have lots of differences in their details. If you do not have access to the detailed documentation of a particular implementation, you are much safer making the following assumption:

(a) There are likely things I do not know about implementation X, that I cannot learn any other way than asking someone that knows implementation X well, or reading documentation about implementation X.

than you are making the following assumption:

(b) Whatever P4 code I can get to execute on the BMv2 or P4-DPDK software switch, must also work on implementation X without changes.

1 Like