Registers size for flow tracking

Hello, I have a question about the register size. I want to write a P4 program that saves each flow’s information in registers. However, as the number of registers that can be defined is limited, and it is probable that the number of flows becomes more than the number of available registers in the P4 program, I am wondering how this problem can be handled?



I want to write a P4 program that saves each flow’s information in registers

What kind of information do you want to save?


The information is the IP source and destination addresses and destination TCP port of the flow and ingress and egress port of the switch.

Hi Sarah,

In this case, it probably makes sense to send a digest to the control plane. I am not sure that you can store that much information in registers. :thinking:

These slides probably explain the same as what you want to achieve (see slide 5).

You also have one example here from the p4-guide.

Maybe others can give a better solution.


Hello Sarah,

I think that the specific answer depends on a variety of additional circumstances that I could not glean from your post so far.

  1. We need to recognize, that the answers to many (if not most) questions will be quite different, depending on the P4 target and its P4 architecture. Therefore it is really important to mention which one you are asking about, otherwise you probably will get no more than a general, non-specific answer.

  2. It is very important to explain the details of the desired use case. For example, I’d wonder about the following: do you want to record these values for each and every packet? Are you OK having duplicates? How do you plan to use those values further?

Without this information it is really difficult to provide meaningful suggestions.

Happy hacking,

1 Like