From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: Re: [PATCH v2] net/virtio: cache Rx/Tx offload ability check Date: Tue, 8 Nov 2016 09:43:14 +0100 Message-ID: <06d3ff0d-d145-597b-09af-c86c93d5cbfd@6wind.com> References: <1478251718-7464-1-git-send-email-yuanhan.liu@linux.intel.com> <1478269793-11082-1-git-send-email-yuanhan.liu@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit To: Yuanhan Liu , dev@dpdk.org Return-path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id C2412E07 for ; Tue, 8 Nov 2016 09:43:26 +0100 (CET) In-Reply-To: <1478269793-11082-1-git-send-email-yuanhan.liu@linux.intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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? It looks better to do like this, but out of curiosity, do you see a performance improvement? Regards, Olivier