XDP_REDIRECT not working in XDP_DRV_MODE with Intel xgbe driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am relatively new to BPF/XDP, and I’m currently trying to use a TC
egress program to redirect a packet back to ingress, where I have an
XDP program attached. When the XDP program is attached in generic mode
(XDP_SKB_MODE), the redirect occurs properly and the packet is seen on
the ingress of the interface, but when the program is attached in
native mode (XDP_DRV_MODE), the packet never redirects and is just
seen exiting the interface, even though the return code of the
redirect function is “success”.

I've read previous threads that seemed related to this issue, but
could not find the answer to my question. I’m trying to understand the
difference in behavior between generic versus driver mode, and how to
properly redirect the packet in driver mode (if this is possible). I
would really appreciate any insight. Here are more details on my
setup. When my TC program sees an outgoing packet, it should grab it,
make a clone, and redirect the clone to the ingress direction XDP
program using bpf_clone_redirect(skb, IFINDEX, BPF_F_INGRESS); When
the XDP program is attached in generic mode the packets get redirected
successfully and can be seen on the XDP ingress interface (and on
tcpdump etc.). However, when the XDP program is attached in xdp native
mode (with the NIC provided driver), the packet does not get
redirected and simply exits (in this case since I am using the
bpf_clone_redirect() helper, two packets are seen exiting). I
understand that XDP native mode occurs sooner in the packet processing
pipeline than XDP generic mode, and that in native mode there is no
skb, but I’m having some trouble understanding exactly what is
happening under the hood and how to “fix” it, if possible. My NIC
driver is Intel xgbe. I am using bcc to attach and load my xdp and tc
programs.

I read in this thread
https://marc.info/?l=xdp-newbies&m=162344478620095&w=2 that Netronome
NICs do not support XDP_REDIRECT, but it seems from this Feb’21 thread
https://marc.info/?l=xdp-newbies&m=161362777730255&w=2 that Intel xgbe
drivers should support it, although there is additional discussion
about potential buggy behavior in a May’21 thread
https://marc.info/?l=xdp-newbies&m=162024487722215&w=2.

These threads regarding XDP_REDIRECT support in relation to xdp frags
also seemed relevant, but since I am new to this area I had some
trouble understanding the significance for solving the issue I’m
working on. https://marc.info/?l=linux-netdev&m=164275984217304&w=2

https://lore.kernel.org/bpf/YgeUFb4LIP7VfeL9@lore-desk/T/

I would appreciate any insight or advice on understanding

the difference between what is happening in xdp generic versus xdp
driver modes during a packet redirect from TC egress to XDP ingress

whether it is possible to perform a redirect in xdp driver mode with
an Intel xgbe driver

if yes to 2, how to successfully redirect a packet from TC egress
program to XDP ingress program attached in xdp driver mode

Thank you very much for your time.

Best,

Sophia Yoo




[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux