* [net PATCH] virtio_net: use dev_kfree_skb for small buffer XDP receive
@ 2017-01-26 2:22 John Fastabend
2017-01-26 3:49 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: John Fastabend @ 2017-01-26 2:22 UTC (permalink / raw)
To: jasowang, mst; +Cc: john.r.fastabend, netdev, john.fastabend
In the small buffer case during driver unload we currently use
put_page instead of dev_kfree_skb. Resolve this by adding a check
for virtnet mode when checking XDP queue type. Also name the
function so that the code reads correctly to match the additional
check.
Fixes: bb91accf2733 ("virtio-net: XDP support for small buffers")
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/net/virtio_net.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 3d1519e..4c6e9b4 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1898,8 +1898,12 @@ static void free_receive_page_frags(struct virtnet_info *vi)
put_page(vi->rq[i].alloc_frag.page);
}
-static bool is_xdp_queue(struct virtnet_info *vi, int q)
+static bool is_xdp_raw_buffer_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)
@@ -1916,7 +1920,7 @@ static void free_unused_bufs(struct virtnet_info *vi)
for (i = 0; i < vi->max_queue_pairs; i++) {
struct virtqueue *vq = vi->sq[i].vq;
while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) {
- if (!is_xdp_queue(vi, i))
+ if (!is_xdp_raw_buffer_queue(vi, i))
dev_kfree_skb(buf);
else
put_page(virt_to_head_page(buf));
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [net PATCH] virtio_net: use dev_kfree_skb for small buffer XDP receive
2017-01-26 2:22 [net PATCH] virtio_net: use dev_kfree_skb for small buffer XDP receive John Fastabend
@ 2017-01-26 3:49 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-01-26 3:49 UTC (permalink / raw)
To: john.fastabend; +Cc: jasowang, mst, john.r.fastabend, netdev
From: John Fastabend <john.fastabend@gmail.com>
Date: Wed, 25 Jan 2017 18:22:48 -0800
> In the small buffer case during driver unload we currently use
> put_page instead of dev_kfree_skb. Resolve this by adding a check
> for virtnet mode when checking XDP queue type. Also name the
> function so that the code reads correctly to match the additional
> check.
>
> Fixes: bb91accf2733 ("virtio-net: XDP support for small buffers")
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
> Acked-by: Jason Wang <jasowang@redhat.com>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-26 3:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-26 2:22 [net PATCH] virtio_net: use dev_kfree_skb for small buffer XDP receive John Fastabend
2017-01-26 3:49 ` David Miller
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.