From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
bjorn@kernel.org, Jakub Kicinski <kuba@kernel.org>,
bpf@vger.kernel.org, Daniel Borkmann <borkmann@iogearbox.net>,
"David S. Miller" <davem@davemloft.net>,
magnus.karlsson@intel.com
Subject: Re: [Intel-wired-lan] [PATCH net-next 1/2] igc: AF_XDP zero-copy metadata adjust breaks SKBs on XDP_PASS
Date: Fri, 26 Nov 2021 16:25:04 +0100 [thread overview]
Message-ID: <YaD8UHOxHasBkqEW@boxer> (raw)
In-Reply-To: <163700858579.565980.15265721798644582439.stgit@firesoul>
On Mon, Nov 15, 2021 at 09:36:25PM +0100, Jesper Dangaard Brouer wrote:
> Driver already implicitly supports XDP metadata access in AF_XDP
> zero-copy mode, as xsk_buff_pool's xp_alloc() naturally set xdp_buff
> data_meta equal data.
>
> This works fine for XDP and AF_XDP, but if a BPF-prog adjust via
> bpf_xdp_adjust_meta() and choose to call XDP_PASS, then igc function
> igc_construct_skb_zc() will construct an invalid SKB packet. The
> function correctly include the xdp->data_meta area in the memcpy, but
> forgot to pull header to take metasize into account.
>
> Fixes: fc9df2a0b520 ("igc: Enable RX via AF_XDP zero-copy")
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Great catch. Will take a look at other ZC enabled Intel drivers if they
are affected as well.
Thanks!
> ---
> drivers/net/ethernet/intel/igc/igc_main.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
> index 8e448288ee26..76b0a7311369 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -2448,8 +2448,10 @@ static struct sk_buff *igc_construct_skb_zc(struct igc_ring *ring,
>
> skb_reserve(skb, xdp->data_meta - xdp->data_hard_start);
> memcpy(__skb_put(skb, totalsize), xdp->data_meta, totalsize);
> - if (metasize)
> + if (metasize) {
> skb_metadata_set(skb, metasize);
> + __skb_pull(skb, metasize);
> + }
>
> return skb;
> }
>
>
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan@osuosl.org
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
next prev parent reply other threads:[~2021-11-26 15:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 20:36 [PATCH net-next 0/2] igc: driver change to support XDP metadata Jesper Dangaard Brouer
2021-11-15 20:36 ` [PATCH net-next 1/2] igc: AF_XDP zero-copy metadata adjust breaks SKBs on XDP_PASS Jesper Dangaard Brouer
2021-11-21 10:32 ` [Intel-wired-lan] " Kraus, NechamaX
2021-11-26 15:25 ` Maciej Fijalkowski [this message]
2021-11-26 15:32 ` Jesper Dangaard Brouer
2021-11-26 15:54 ` Alexander Lobakin
2021-11-15 20:36 ` [PATCH net-next 2/2] igc: enable XDP metadata in driver Jesper Dangaard Brouer
2021-11-21 10:33 ` [Intel-wired-lan] " Kraus, NechamaX
2021-11-26 16:16 ` Alexander Lobakin
2021-11-29 14:39 ` Jesper Dangaard Brouer
2021-11-29 14:53 ` Alexander Lobakin
2021-11-29 18:13 ` Alexander Lobakin
2021-11-29 19:03 ` Nguyen, Anthony L
2021-11-30 11:25 ` Jesper Dangaard Brouer
2021-11-29 14:10 ` [PATCH net-next 0/2] igc: driver change to support XDP metadata Alexander Lobakin
2021-11-29 14:29 ` Jesper Dangaard Brouer
2021-11-29 14:41 ` Alexander Lobakin
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=YaD8UHOxHasBkqEW@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=bjorn@kernel.org \
--cc=borkmann@iogearbox.net \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=magnus.karlsson@intel.com \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).