Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941021AbcLWQCg (ORCPT ); Fri, 23 Dec 2016 11:02:36 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:33480 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758428AbcLWQCd (ORCPT ); Fri, 23 Dec 2016 11:02:33 -0500 Subject: Re: [PATCH net 6/9] virtio-net: make rx buf size estimation works for XDP To: Jason Wang , 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-7-git-send-email-jasowang@redhat.com> Cc: john.r.fastabend@intel.com From: John Fastabend Message-ID: <585D4A7E.6040507@gmail.com> Date: Fri, 23 Dec 2016 08:02:06 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1482503852-12438-7-git-send-email-jasowang@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1653 Lines: 47 On 16-12-23 06:37 AM, Jason Wang wrote: > We don't update ewma rx buf size in the case of XDP. This will lead > underestimation of rx buf size which causes host to produce more than > one buffers. This will greatly increase the possibility of XDP page > linearization. > > Cc: John Fastabend > Signed-off-by: Jason Wang > --- > drivers/net/virtio_net.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 0778dc8..77ae358 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -584,10 +584,12 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, > put_page(page); > head_skb = page_to_skb(vi, rq, xdp_page, > 0, len, PAGE_SIZE); > + ewma_pkt_len_add(&rq->mrg_avg_pkt_len, len); > return head_skb; > } > break; > case XDP_TX: > + ewma_pkt_len_add(&rq->mrg_avg_pkt_len, len); > if (unlikely(xdp_page != page)) > goto err_xdp; > rcu_read_unlock(); > @@ -596,6 +598,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, > default: > if (unlikely(xdp_page != page)) > __free_pages(xdp_page, 0); > + ewma_pkt_len_add(&rq->mrg_avg_pkt_len, len); > goto err_xdp; > } > } > Looks needed although I guess it will only be the case with MTU > ETH_DATA_LEN because of the clamp in get_mergeable_buf_len(). Although XDP setup allows MTU up to page_size - hdr so certainly will happen with ~MTU > 1500. I need to add some various MTU tests to my setup. Acked-by: John Fastabend