AF_XDP RX processing with NO rx-ring

Srivats P <[email protected]> Thu, 5 Oct 2023 18:27:03 +0530
Newsgroups org.kernel.vger.xdp-newbies
Message-ID <CANzUK5_amwfvNb-MRGaGezzpnsvToze22XcHQ_LeTbOBAWkE6Q@mail.gmail.com>
Hi,

I want to clarify my AF_XDP understanding for a particular scenario.

Consider a single UMEM with 1 Fill Ring and 1 Completion Ring and
single XDP socket  bound to queue 0 with 1 Tx Ring but NO Rx Ring.
Assume the NIC has only a single queue (to keep things simple for
explaining this scenario).

There is a XDP program attached to Queue 0 which does either a
XDP_DROP or XDP_PASS for all Rx packets.

We are running in Driver mode.

What happens to RX packets received on Queue 0?

Here's my understanding -

 * Even though there is no AF_XDP Rx Ring, there will be a NIC Rx Ring
for queue 0
 * The NIC Rx Ring for queue 0 is populated by the driver with UMEM
buffers taken from the Fill ring
 * A Rx packet will be received in the NIC Rx Ring for Queue 0 first
 * The driver will run the XDP program on the Rx packet buffer (a UMEM buffer)
 * If the program results in XDP_DROP, the driver will "free" the Umem
buffer by putting it on the Completion Ring
 * If the program results in XDP_PASS, the driver will allocate a
standard Linux kernel SKB, copy the packet buffer contents into the
SKB and queue it up for standard netdev processing; It will then
"free" the RX Umem buffer by putting it on the Completion Ring (since
we have already copied packet into the skb)

Is this understanding correct or am I mistaken anywhere?

Thanks in advance,
Srivats