From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0082FA04F2; Sun, 7 Jun 2020 12:28:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 609881BFA9; Sun, 7 Jun 2020 12:28:17 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 5CD3C1BF58 for ; Sun, 7 Jun 2020 12:28:15 +0200 (CEST) IronPort-SDR: EQ+bboW1slIytLWNBvaPW0HN5jP4Tm6bYjymk4p/BFlvT2eXTgxRnHr1r587vnuJCESknCPlXi 9B/vPQbro8xQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2020 03:28:13 -0700 IronPort-SDR: Nf2Ccv9FOunaURwdQidjGLfAQhgfAPy0WGFtkMmzFJzyrjAxNUUa3OlMkkp6h8IVBERu/Wqf5+ QRskEV8+o+Eg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,483,1583222400"; d="scan'208";a="259576424" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.116.183]) by fmsmga008.fm.intel.com with ESMTP; 07 Jun 2020 03:28:11 -0700 Date: Sun, 7 Jun 2020 18:19:59 +0800 From: Ye Xiaolong To: Ting Xu Cc: dev@dpdk.org, qi.z.zhang@intel.com, qiming.yang@intel.com, john.mcnamara@intel.com, marko.kovacevic@intel.com Message-ID: <20200607101958.GA15772@intel.com> References: <20200605201737.33766-1-ting.xu@intel.com> <20200605201737.33766-11-ting.xu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200605201737.33766-11-ting.xu@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v1 10/12] net/ice: enable stats for DCF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 06/05, Ting Xu wrote: >From: Qi Zhang > >Add support to get and reset Rx/Tx stats in DCF. Query stats >from PF. > >Signed-off-by: Qi Zhang >--- > drivers/net/ice/ice_dcf.c | 27 ++++++++ > drivers/net/ice/ice_dcf.h | 4 ++ > drivers/net/ice/ice_dcf_ethdev.c | 102 +++++++++++++++++++++++++++---- > 3 files changed, 120 insertions(+), 13 deletions(-) > >diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c [snip] >+static int >+ice_dcf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) >+{ >+ struct ice_dcf_adapter *ad = dev->data->dev_private; >+ struct ice_dcf_hw *hw = &ad->real_hw; >+ struct virtchnl_eth_stats pstats; >+ int ret; >+ >+ ret = ice_dcf_query_stats(hw, &pstats); >+ if (ret == 0) { >+ ice_dcf_update_stats(&hw->eth_stats_offset, &pstats); >+ stats->ipackets = pstats.rx_unicast + pstats.rx_multicast + >+ pstats.rx_broadcast - pstats.rx_discards; >+ stats->opackets = pstats.tx_broadcast + pstats.tx_multicast + >+ pstats.tx_unicast; >+ stats->imissed = pstats.rx_discards; >+ stats->oerrors = pstats.tx_errors + pstats.tx_discards; >+ stats->ibytes = pstats.rx_bytes; >+ stats->ibytes -= stats->ipackets * RTE_ETHER_CRC_LEN; >+ stats->obytes = pstats.tx_bytes; >+ } else { >+ PMD_DRV_LOG(ERR, "Get statistics failed"); >+ } >+ return -EIO; Return -EIO even on success seems not correct. >+} >+ >+static int >+ice_dcf_stats_reset(struct rte_eth_dev *dev) >+{ >+ struct ice_dcf_adapter *ad = dev->data->dev_private; >+ struct ice_dcf_hw *hw = &ad->real_hw; >+ struct virtchnl_eth_stats pstats; >+ int ret; >+ >+ /* read stat values to clear hardware registers */ >+ ret = ice_dcf_query_stats(hw, &pstats); >+ if (ret != 0) >+ return ret; >+ >+ /* set stats offset base on current values */ >+ hw->eth_stats_offset = pstats; >+ >+ return 0; >+} >+ > static void > ice_dcf_dev_close(struct rte_eth_dev *dev) > { >-- >2.17.1 >