From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Jesper Dangaard Brouer <brouer@redhat.com>, netdev@vger.kernel.org
Cc: bpf@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Daniel Borkmann <borkmann@iogearbox.net>,
anthony.l.nguyen@intel.com, jesse.brandeburg@intel.com,
intel-wired-lan@lists.osuosl.org, magnus.karlsson@intel.com,
bjorn@kernel.org
Subject: [PATCH net-next 1/2] igc: AF_XDP zero-copy metadata adjust breaks SKBs on XDP_PASS
Date: Mon, 15 Nov 2021 21:36:25 +0100 [thread overview]
Message-ID: <163700858579.565980.15265721798644582439.stgit@firesoul> (raw)
In-Reply-To: <163700856423.565980.10162564921347693758.stgit@firesoul>
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>
---
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;
}
next prev parent reply other threads:[~2021-11-16 0:18 UTC|newest]
Thread overview: 18+ 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 ` Jesper Dangaard Brouer [this message]
2021-11-21 10:32 ` [Intel-wired-lan] [PATCH net-next 1/2] igc: AF_XDP zero-copy metadata adjust breaks SKBs on XDP_PASS Kraus, NechamaX
2021-11-26 15:25 ` Maciej Fijalkowski
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
-- strict thread matches above, loose matches on Subject: below --
2021-11-30 17:59 [PATCH net-next 0/2][pull request] 1GbE Intel Wired LAN Driver Updates 2021-11-30 Tony Nguyen
2021-11-30 17:59 ` [PATCH net-next 1/2] igc: AF_XDP zero-copy metadata adjust breaks SKBs on XDP_PASS Tony Nguyen
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=163700858579.565980.15265721798644582439.stgit@firesoul \
--to=brouer@redhat.com \
--cc=anthony.l.nguyen@intel.com \
--cc=bjorn@kernel.org \
--cc=borkmann@iogearbox.net \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--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