From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965708AbdADDPE (ORCPT ); Tue, 3 Jan 2017 22:15:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48472 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761231AbdADDOm (ORCPT ); Tue, 3 Jan 2017 22:14:42 -0500 Subject: Re: [PATCH net 9/9] virtio-net: XDP support for small buffers To: John Fastabend , mst@redhat.com, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <1482503852-12438-1-git-send-email-jasowang@redhat.com> <1482503852-12438-10-git-send-email-jasowang@redhat.com> <586AD79B.2070203@gmail.com> <8c896c40-fd25-4b92-fe80-5be18c13dd48@redhat.com> <586BD408.9030009@gmail.com> Cc: john.r.fastabend@intel.com From: Jason Wang Message-ID: <52a3a959-ff39-8d97-4d68-937dbcb2e5a7@redhat.com> Date: Wed, 4 Jan 2017 11:05:48 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <586BD408.9030009@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 04 Jan 2017 03:05:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017年01月04日 00:40, John Fastabend wrote: > On 17-01-02 10:16 PM, Jason Wang wrote: >> >> On 2017年01月03日 06:43, John Fastabend wrote: >>> 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 >>>> Signed-off-by: Jason Wang >>>> --- >>>> 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 >> We probably need a better name for this function. >> >> Acked-by: Jason Wang >> > How about is_xdp_raw_buffer_queue()? > > I'll submit a proper patch today. Sounds good, thanks.