From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Sophia Yoo <sy6@princeton.edu>, xdp-newbies@vger.kernel.org
Subject: Re: XDP_REDIRECT not working in XDP_DRV_MODE with Intel xgbe driver
Date: Mon, 14 Feb 2022 19:28:31 +0100 [thread overview]
Message-ID: <877d9x7168.fsf@toke.dk> (raw)
In-Reply-To: <CANLN0e4cm__UeAP+TgxHH+Pg0f0aU6jN9-CCPf=O4crsonuynA@mail.gmail.com>
Sophia Yoo <sy6@princeton.edu> writes:
> 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”.
The difference between XDP generic and driver mode is that the generic
mode is hooked into the core networking stack whereas driver mode runs
in the driver as the very first thing after packets are physically
received from the network.
This also explains why what you're trying to do doesn't work: the TC
hook runs in the core networking stack, and when it does a redirect, the
packet does not actually pass through the network driver, it appears
further up in the stack, where only the generic XDP hook will see it.
So this has nothing to do with the support in the driver; XDP is simply
not suitable for what you're trying to do. Why are you trying to do this
in the first place? I.e., what's the higher-level use case here?
-Toke
next prev parent reply other threads:[~2022-02-14 18:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-14 18:10 XDP_REDIRECT not working in XDP_DRV_MODE with Intel xgbe driver Sophia Yoo
2022-02-14 18:28 ` Toke Høiland-Jørgensen [this message]
2022-02-14 19:38 ` Sophia Yoo
2022-02-14 22:28 ` Toke Høiland-Jørgensen
2022-02-15 14:59 ` Sophia Yoo
2022-02-15 15:13 ` Toke Høiland-Jørgensen
2022-02-15 16:15 ` Sophia Yoo
2022-02-15 18:53 ` Toke Høiland-Jørgensen
2022-02-15 10:04 ` Jesper Dangaard Brouer
2022-02-15 16:27 ` Sophia Yoo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877d9x7168.fsf@toke.dk \
--to=toke@redhat.com \
--cc=sy6@princeton.edu \
--cc=xdp-newbies@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox