From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 8844D3238 for ; Wed, 9 Nov 2016 06:23:22 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP; 08 Nov 2016 21:23:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,612,1473145200"; d="scan'208";a="189302265" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by fmsmga004.fm.intel.com with ESMTP; 08 Nov 2016 21:23:20 -0800 Date: Wed, 9 Nov 2016 13:24:10 +0800 From: Yuanhan Liu To: Olivier Matz Cc: dev@dpdk.org Message-ID: <20161109052410.GK12283@yliu-dev.sh.intel.com> References: <1478251718-7464-1-git-send-email-yuanhan.liu@linux.intel.com> <1478269793-11082-1-git-send-email-yuanhan.liu@linux.intel.com> <06d3ff0d-d145-597b-09af-c86c93d5cbfd@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <06d3ff0d-d145-597b-09af-c86c93d5cbfd@6wind.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v2] net/virtio: cache Rx/Tx offload ability check 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: Wed, 09 Nov 2016 05:23:23 -0000 On Tue, Nov 08, 2016 at 09:43:14AM +0100, Olivier Matz wrote: > Hi Yuanhan, > > On 11/04/2016 03:29 PM, Yuanhan Liu wrote: > > It's not a good idea to do the check of whether Rx/Tx offload is > > enabled at the data path. Instead, we could do the check at init > > stage and store the result, so that we could avoid the check again > > and again at the critical datapath. > > > > Cc: Olivier Matz > > Signed-off-by: Yuanhan Liu > > --- > > v2: - rebase on top of the bug fix patches > > - define rx/tx_offload as uint8_t instead of int > > > > drivers/net/virtio/virtio_ethdev.c | 19 +++++++++++++++++++ > > drivers/net/virtio/virtio_pci.h | 2 ++ > > drivers/net/virtio/virtio_rxtx.c | 31 +++++-------------------------- > > 3 files changed, 26 insertions(+), 26 deletions(-) > > > > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > > index 1505f67..2adae58 100644 > > --- a/drivers/net/virtio/virtio_ethdev.c > > +++ b/drivers/net/virtio/virtio_ethdev.c > > @@ -1188,6 +1188,22 @@ rx_func_get(struct rte_eth_dev *eth_dev) > > eth_dev->rx_pkt_burst = &virtio_recv_pkts; > > } > > > > +static inline int > > +rx_offload_enabled(struct virtio_hw *hw) > > +{ > > + return vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM) || > > + vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4) || > > + vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO6); > > +} > > + > > +static inline int > > +tx_offload_enabled(struct virtio_hw *hw) > > +{ > > + return vtpci_with_feature(hw, VIRTIO_NET_F_CSUM) || > > + vtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO4) || > > + vtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO6); > > +} > > Do we need these functions to be inlined? Nope, it was done simply by copy & paste. I could remove them in future version. > It looks better to do like this, but out of curiosity, do you see a > performance improvement? I didn't bother to have a try: I'd assume it brings no (at least no obvious) improvements. --yliu