linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: mst@redhat.com, virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: john.r.fastabend@intel.com, Jason Wang <jasowang@redhat.com>
Subject: [PATCH net 8/9] virtio-net: remove big packet XDP codes
Date: Fri, 23 Dec 2016 22:37:31 +0800	[thread overview]
Message-ID: <1482503852-12438-9-git-send-email-jasowang@redhat.com> (raw)
In-Reply-To: <1482503852-12438-1-git-send-email-jasowang@redhat.com>

Now we in fact don't allow XDP for big packets, remove its codes.

Cc: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/net/virtio_net.c | 44 +++-----------------------------------------
 1 file changed, 3 insertions(+), 41 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index c1f66d8..e53365a8 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -344,11 +344,7 @@ static void virtnet_xdp_xmit(struct virtnet_info *vi,
 	/* Free up any pending old buffers before queueing new ones. */
 	while ((xdp_sent = virtqueue_get_buf(sq->vq, &len)) != NULL) {
 		struct page *sent_page = virt_to_head_page(xdp_sent);
-
-		if (vi->mergeable_rx_bufs)
-			put_page(sent_page);
-		else
-			give_pages(rq, sent_page);
+		put_page(sent_page);
 	}
 
 	/* Zero header and leave csum up to XDP layers */
@@ -360,15 +356,8 @@ static void virtnet_xdp_xmit(struct virtnet_info *vi,
 	err = virtqueue_add_outbuf(sq->vq, sq->sg, num_sg,
 				   xdp->data, GFP_ATOMIC);
 	if (unlikely(err)) {
-		if (vi->mergeable_rx_bufs)
-			put_page(page);
-		else
-			give_pages(rq, page);
+		put_page(page);
 		return; // On error abort to avoid unnecessary kick
-	} else if (!vi->mergeable_rx_bufs) {
-		/* If not mergeable bufs must be big packets so cleanup pages */
-		give_pages(rq, (struct page *)page->private);
-		page->private = 0;
 	}
 
 	virtqueue_kick(sq->vq);
@@ -430,44 +419,17 @@ static struct sk_buff *receive_big(struct net_device *dev,
 				   void *buf,
 				   unsigned int len)
 {
-	struct bpf_prog *xdp_prog;
 	struct page *page = buf;
-	struct sk_buff *skb;
-
-	rcu_read_lock();
-	xdp_prog = rcu_dereference(rq->xdp_prog);
-	if (xdp_prog) {
-		struct virtio_net_hdr_mrg_rxbuf *hdr = buf;
-		u32 act;
-
-		if (unlikely(hdr->hdr.gso_type))
-			goto err_xdp;
-		act = do_xdp_prog(vi, rq, xdp_prog, page, 0, len);
-		switch (act) {
-		case XDP_PASS:
-			break;
-		case XDP_TX:
-			rcu_read_unlock();
-			goto xdp_xmit;
-		case XDP_DROP:
-		default:
-			goto err_xdp;
-		}
-	}
-	rcu_read_unlock();
+	struct sk_buff *skb = page_to_skb(vi, rq, page, 0, len, PAGE_SIZE);
 
-	skb = page_to_skb(vi, rq, page, 0, len, PAGE_SIZE);
 	if (unlikely(!skb))
 		goto err;
 
 	return skb;
 
-err_xdp:
-	rcu_read_unlock();
 err:
 	dev->stats.rx_dropped++;
 	give_pages(rq, page);
-xdp_xmit:
 	return NULL;
 }
 
-- 
2.7.4

  parent reply	other threads:[~2016-12-23 14:39 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-23 14:37 [PATCH net 0/9] several fixups for virtio-net XDP Jason Wang
2016-12-23 14:37 ` [PATCH net 1/9] virtio-net: remove the warning before XDP linearizing Jason Wang
2016-12-23 19:31   ` Daniel Borkmann
2016-12-27  3:08     ` Jason Wang
2016-12-23 14:37 ` [PATCH net 2/9] virtio-net: correctly xmit linearized page on XDP_TX Jason Wang
2016-12-23 15:47   ` John Fastabend
2016-12-23 14:37 ` [PATCH net 3/9] virtio-net: fix page miscount during XDP linearizing Jason Wang
2016-12-23 15:54   ` John Fastabend
2016-12-26  2:30     ` Jason Wang
2016-12-23 14:37 ` [PATCH net 4/9] virtio-net: correctly handle XDP_PASS for linearized packets Jason Wang
2016-12-23 15:57   ` John Fastabend
2016-12-26  2:34     ` Jason Wang
2016-12-23 14:37 ` [PATCH net 5/9] virtio-net: unbreak csumed packets for XDP_PASS Jason Wang
2016-12-23 15:58   ` John Fastabend
2016-12-23 14:37 ` [PATCH net 6/9] virtio-net: make rx buf size estimation works for XDP Jason Wang
2016-12-23 16:02   ` John Fastabend
2016-12-23 14:37 ` [PATCH net 7/9] virtio-net: forbid XDP when VIRTIO_NET_F_GUEST_UFO is support Jason Wang
2016-12-23 16:02   ` John Fastabend
2016-12-23 16:10     ` John Fastabend
2016-12-26  2:38       ` Jason Wang
2016-12-23 14:37 ` Jason Wang [this message]
2016-12-23 14:37 ` [PATCH net 9/9] virtio-net: XDP support for small buffers Jason Wang
2016-12-23 16:51   ` John Fastabend
2017-01-02 22:43   ` John Fastabend
2017-01-03  6:16     ` Jason Wang
2017-01-03 16:40       ` John Fastabend
2017-01-04  3:05         ` Jason Wang
2016-12-23 17:10 ` [PATCH net 0/9] several fixups for virtio-net XDP John Fastabend
2016-12-26  2:39   ` Jason Wang
2016-12-23 18:49 ` David Miller

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=1482503852-12438-9-git-send-email-jasowang@redhat.com \
    --to=jasowang@redhat.com \
    --cc=john.r.fastabend@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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).