From: Yuya Kusakabe <yuya.kusakabe@gmail.com>
To: jasowang@redhat.com
Cc: andriin@fb.com, ast@kernel.org, bpf@vger.kernel.org,
daniel@iogearbox.net, davem@davemloft.net, hawk@kernel.org,
john.fastabend@gmail.com, kafai@fb.com, kuba@kernel.org,
linux-kernel@vger.kernel.org, mst@redhat.com,
netdev@vger.kernel.org, songliubraving@fb.com, yhs@fb.com,
yuya.kusakabe@gmail.com
Subject: [PATCH bpf-next v6 1/2] virtio_net: keep vnet header zeroed if XDP is loaded for small buffer
Date: Tue, 25 Feb 2020 12:32:11 +0900 [thread overview]
Message-ID: <20200225033212.437563-1-yuya.kusakabe@gmail.com> (raw)
In-Reply-To: <20200225033103.437305-1-yuya.kusakabe@gmail.com>
We do not want to care about the vnet header in receive_small() if XDP
is loaded, since we can not know whether or not the packet is modified
by XDP.
Fixes: f6b10209b90d ("virtio-net: switch to use build_skb() for small buffer")
Signed-off-by: Yuya Kusakabe <yuya.kusakabe@gmail.com>
---
drivers/net/virtio_net.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 2fe7a3188282..f39d0218bdaa 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -735,10 +735,10 @@ static struct sk_buff *receive_small(struct net_device *dev,
}
skb_reserve(skb, headroom - delta);
skb_put(skb, len);
- if (!delta) {
+ if (!xdp_prog) {
buf += header_offset;
memcpy(skb_vnet_hdr(skb), buf, vi->hdr_len);
- } /* keep zeroed vnet hdr since packet was changed by bpf */
+ } /* keep zeroed vnet hdr since XDP is loaded */
err:
return skb;
--
2.24.1
next prev parent reply other threads:[~2020-02-25 3:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 3:31 [PATCH bpf-next v6 0/2] virtio_net: add XDP meta data support Yuya Kusakabe
2020-02-25 3:32 ` Yuya Kusakabe [this message]
2020-02-25 3:32 ` [PATCH bpf-next v6 2/2] " Yuya Kusakabe
2020-02-25 5:45 ` Jason Wang
2020-02-25 11:19 ` Michael S. Tsirkin
2020-02-25 5:44 ` [PATCH bpf-next v6 1/2] virtio_net: keep vnet header zeroed if XDP is loaded for small buffer Jason Wang
2020-02-25 11:18 ` Michael S. Tsirkin
2020-02-25 21:59 ` [PATCH bpf-next v6 0/2] virtio_net: add XDP meta data support Daniel Borkmann
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=20200225033212.437563-1-yuya.kusakabe@gmail.com \
--to=yuya.kusakabe@gmail.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=jasowang@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/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
all inboxes | Powered by JetHome®