All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Jason Wang <jasowang@redhat.com>,
	mst@redhat.com, virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: john.r.fastabend@intel.com
Subject: Re: [PATCH net 9/9] virtio-net: XDP support for small buffers
Date: Mon, 2 Jan 2017 14:43:39 -0800	[thread overview]
Message-ID: <586AD79B.2070203@gmail.com> (raw)
In-Reply-To: <1482503852-12438-10-git-send-email-jasowang@redhat.com>

On 16-12-23 06:37 AM, Jason Wang wrote:
> Commit f600b6905015 ("virtio_net: Add XDP support") leaves the case of
> small receive buffer untouched. This will confuse the user who want to
> set XDP but use small buffers. Other than forbid XDP in small buffer
> mode, let's make it work. XDP then can only work at skb->data since
> virtio-net create skbs during refill, this is sub optimal which could
> be optimized in the future.
> 
> Cc: John Fastabend <john.r.fastabend@intel.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>  drivers/net/virtio_net.c | 112 ++++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 87 insertions(+), 25 deletions(-)
> 

Hi Jason,

I was doing some more testing on this what do you think about doing this
so that free_unused_bufs() handles the buffer free with dev_kfree_skb()
instead of put_page in small receive mode. Seems more correct to me.


diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 783e842..27ff76c 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1898,6 +1898,10 @@ static void free_receive_page_frags(struct virtnet_info *vi)

 static bool is_xdp_queue(struct virtnet_info *vi, int q)
 {
+       /* For small receive mode always use kfree_skb variants */
+       if (!vi->mergeable_rx_bufs)
+               return false;
+
        if (q < (vi->curr_queue_pairs - vi->xdp_queue_pairs))
                return false;
        else if (q < vi->curr_queue_pairs)


patch is untested just spotted doing code review.

Thanks,
John

  parent reply	other threads:[~2017-01-02 22:43 UTC|newest]

Thread overview: 50+ 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 ` Jason Wang
2016-12-23 14:37 ` [PATCH net 1/9] virtio-net: remove the warning before XDP linearizing Jason Wang
2016-12-23 14:37   ` Jason Wang
2016-12-23 19:31   ` Daniel Borkmann
2016-12-23 19:31   ` Daniel Borkmann
2016-12-27  3:08     ` Jason Wang
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 14:37   ` 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 14:37   ` Jason Wang
2016-12-23 15:54   ` John Fastabend
2016-12-26  2:30     ` Jason Wang
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 14:37   ` Jason Wang
2016-12-23 15:57   ` John Fastabend
2016-12-26  2:34     ` Jason Wang
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 14:37   ` 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 14:37   ` 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 14:37   ` 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-26  2:38         ` Jason Wang
2016-12-23 14:37 ` [PATCH net 8/9] virtio-net: remove big packet XDP codes Jason Wang
2016-12-23 14:37   ` Jason Wang
2016-12-23 14:37 ` [PATCH net 9/9] virtio-net: XDP support for small buffers Jason Wang
2016-12-23 14:37   ` Jason Wang
2016-12-23 16:51   ` John Fastabend
2017-01-02 22:43   ` John Fastabend [this message]
2017-01-03  6:16     ` Jason Wang
2017-01-03  6:16       ` Jason Wang
2017-01-03 16:40       ` John Fastabend
2017-01-03 16:40         ` John Fastabend
2017-01-04  3:05         ` Jason Wang
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-26  2:39   ` Jason Wang
2016-12-23 18:49 ` David Miller
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=586AD79B.2070203@gmail.com \
    --to=john.fastabend@gmail.com \
    --cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.