From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id B6A086AE0 for ; Thu, 6 Oct 2016 19:06:16 +0200 (CEST) Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0DEDBC0528C2; Thu, 6 Oct 2016 17:06:16 +0000 (UTC) Received: from [10.36.6.251] (vpn1-6-251.ams2.redhat.com [10.36.6.251]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u96H6COB019247 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 6 Oct 2016 13:06:14 -0400 To: yuanhan.liu@linux.intel.com, dev@dpdk.org References: <1475773241-5714-1-git-send-email-maxime.coquelin@redhat.com> Cc: mst@redhat.com, jianfeng.tan@intel.com, olivier.matz@6wind.com, stephen@networkplumber.org From: Maxime Coquelin Message-ID: <302508c8-ce7d-aa55-ca03-62d3ddcb6420@redhat.com> Date: Thu, 6 Oct 2016 19:06:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1475773241-5714-1-git-send-email-maxime.coquelin@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 06 Oct 2016 17:06:16 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH] vhost: Only access header if offloading is supported in dequeue path X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2016 17:06:17 -0000 On 10/06/2016 07:00 PM, Maxime Coquelin wrote: > If offloading features are not negotiated, parsing the virtio header > is not needed. > > Micro-benchmark with testpmd shows that the gain is +4% with indirect > descriptors, +1% when using direct descriptors. > > Signed-off-by: Maxime Coquelin > --- > lib/librte_vhost/virtio_net.c | 47 ++++++++++++++++++++++++++++++++----------- > 1 file changed, 35 insertions(+), 12 deletions(-) > > diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c > index a59c39b..5d51693 100644 > --- a/lib/librte_vhost/virtio_net.c > +++ b/lib/librte_vhost/virtio_net.c > @@ -548,6 +548,18 @@ rte_vhost_enqueue_burst(int vid, uint16_t queue_id, > return virtio_dev_rx(dev, queue_id, pkts, count); > } > > +static inline bool > +virtio_net_with_host_offload(struct virtio_net *dev) > +{ > + if (dev->features & > + (VIRTIO_NET_F_CSUM | VIRTIO_NET_F_HOST_ECN | > + VIRTIO_NET_F_HOST_TSO4 | VIRTIO_NET_F_HOST_TSO6 | > + VIRTIO_NET_F_HOST_UFO)) > + return true; > + > + return false; > +} > + > static void > parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) > { > @@ -600,6 +612,9 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) > void *l4_hdr = NULL; > struct tcp_hdr *tcp_hdr = NULL; > > + if (hdr->flags == 0 || hdr->gso_type == VIRTIO_NET_HDR_GSO_NONE) > + return; > + Oops, just noticed I forgot to amend a fix I did. Of course, the above test should be: if (hdr->flags == 0 && hdr->gso_type == VIRTIO_NET_HDR_GSO_NONE) It will be fixed in the v2. Regards, Maxime