On Tue, 19 Dec 2023 at 11:46, Prashant Batra <prbatra.mail@xxxxxxxxx> wrote: > > Hi, > > I am new to XDP and exploring it's working with different interface > types supported in linux. One of my use cases is to be able to receive > packets from the bond interface. > I used xdpsock sample program specifying the bond interface as the > input interface. However the packets received on the bond interface > are not handed over to the socket by the kernel if the socket is bound > in native mode. The packets are neither being passed to the kernel. > Note that the socket creation does succeed. > In skb mode this works and I am able to receive packets in the > userspace. But in skb mode as expected the performance is not that > great. > > Is AF_XDP sockets on bond not supported in native mode? Or since the > packet has be to be handed over to the bond driver post reception on > the phy port, a skb allocation and copy to it is indeed a must? I have never tried a bonding interface with AF_XDP, so it might not work. Can you trace the packet to see where it is being dropped in native mode? There are no modifications needed to an XDP_REDIRECT enabled driver to support AF_XDP in XDP_DRV / copy mode. What NICs are you using? > Another thing I notice is that other XDP programs attached to bond > interface with targets like DROP, REDIRECT to other interface works > and perform better than AF_XDP (skb) based. Does this mean that these > are not allocating skb? I am not surprised that AF_XDP in copy is slower than XDP_REDIRECT. The packet has to be copied out to user-space then copied into the kernel again, something that is not needed in the XDP_REDIRECT case. If you were using zero-copy, on the other hand, it would be faster with AF_XDP. But the bonding interface does not support zero-copy, so not an option. > Kindly share your thoughts and advice. > > Thanks, > Prashant >