I am using ibverbs to receive raw Ethernet frames from ConnectX-5 and ConnectX-6 NICs. I have a flow of packets that I would like to process in a particular way. The packets are part of a single UDP/IPv4 flow, but there are two kinds of packets in the stream: most of them are large data payload packets, with occasional (much smaller) metadata packets mixed in. They all have the same source/destination IP/MAC/port information, so if I create an IBV flow using that, it matches all of the packets in my flow (the large ones and the small ones).
If possible, I would like to create separate flow matching rules for these two streams of packets so I can direct them to be written to different memory regions. In order to do this, I obviously would have to use some part of the packet to discriminate the two. The two kinds of packets that I want to separate, unfortunately, are identical from layers 2 through 4 (the UDP header). From what I can tell, the ibverbs API only provides matching functionality up through layer 4, so I get all of the packets in one flow.
I can think of two criteria that I would try to use to differentiate the packets:
- Their size; one kind is much larger than the other
- The first byte of layer 5 (just after the UDP header) contains a packet type field that differentiates the two; this would be the ideal field to match on if it were possible
Is there any functionality, perhaps at the mlx5dv layer, that would allow me to create matching rules that can go past the UDP header? I have dug through the rdma-core source code a bit and found some references to “flex rules”, “misc4 matchers”, and some other items that seem like they might be applicable to my situation, but the documentation there is pretty sparse, so it wasn’t clear.