From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id A133D25E5 for ; Mon, 11 Dec 2017 09:49:58 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2017 00:49:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,391,1508828400"; d="scan'208";a="157653888" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga004.jf.intel.com with ESMTP; 11 Dec 2017 00:49:57 -0800 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 11 Dec 2017 00:49:56 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 11 Dec 2017 00:49:56 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.159]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Mon, 11 Dec 2017 16:49:54 +0800 From: "Xing, Beilei" To: "Zhang, Qi Z" CC: "dev@dpdk.org" Thread-Topic: [PATCH] net/i40e: exclude LLDP packet count Thread-Index: AQHTbaSCIAYeMLwxRUiA4g0XYTTQ3KM93OtA Date: Mon, 11 Dec 2017 08:49:54 +0000 Message-ID: <94479800C636CB44BD422CB454846E013207E1D4@SHSMSX101.ccr.corp.intel.com> References: <1512437375-17322-1-git-send-email-qi.z.zhang@intel.com> In-Reply-To: <1512437375-17322-1-git-send-email-qi.z.zhang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/i40e: exclude LLDP packet count 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: , X-List-Received-Date: Mon, 11 Dec 2017 08:49:59 -0000 > -----Original Message----- > From: Zhang, Qi Z > Sent: Tuesday, December 5, 2017 9:30 AM > To: Xing, Beilei > Cc: dev@dpdk.org; Zhang, Qi Z > Subject: [PATCH] net/i40e: exclude LLDP packet count >=20 > When use port stats register to calcuate the packet count, LLDP packets = are Patch looks OK for me except some typos. calcuate -> calculate > counted in statistics which is not expected, the patch exclude this numbe= r > from total number. >=20 > Fixes: 763de290cbd1 ("net/i40e: fix packet count for PF") Cc stable@dpdk.= org >=20 > Signed-off-by: Qi Zhang > --- > drivers/net/i40e/i40e_ethdev.c | 58 > +++++++++++++++++++++++++++++++++++++++--- > 1 file changed, 55 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethde= v.c > index 811cc9f..4cbb259 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -2531,6 +2531,22 @@ i40e_read_stats_registers(struct i40e_pf *pf, > struct i40e_hw *hw) > pf->offset_loaded, > &pf->internal_stats_offset.rx_broadcast, > &pf->internal_stats.rx_broadcast); > + /* Get total internal tx packet count */ > + i40e_stat_update_48(hw, I40E_GLV_UPTCH(hw->port), > + I40E_GLV_UPTCL(hw->port), > + pf->offset_loaded, > + &pf->internal_stats_offset.tx_unicast, > + &pf->internal_stats.tx_unicast); > + i40e_stat_update_48(hw, I40E_GLV_MPTCH(hw->port), > + I40E_GLV_MPTCL(hw->port), > + pf->offset_loaded, > + &pf->internal_stats_offset.tx_multicast, > + &pf->internal_stats.tx_multicast); > + i40e_stat_update_48(hw, I40E_GLV_BPTCH(hw->port), > + I40E_GLV_BPTCL(hw->port), > + pf->offset_loaded, > + &pf->internal_stats_offset.tx_broadcast, > + &pf->internal_stats.tx_broadcast); >=20 > /* exclude CRC size */ > pf->internal_stats.rx_bytes -=3D (pf->internal_stats.rx_unicast + @@ - > 2560,16 +2576,32 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct > i40e_hw *hw) > ns->eth.rx_bytes -=3D (ns->eth.rx_unicast + ns->eth.rx_multicast + > ns->eth.rx_broadcast) * ETHER_CRC_LEN; >=20 > - /* Workaround: it is possible I40E_GLV_GORCH[H/L] is updated > before > + /* exlude internal rx bytes exclude > + * Workaround: it is possible I40E_GLV_GORCH[H/L] is updated > before > * I40E_GLPRT_GORCH[H/L], so there is a small window that cause > negtive negative > * value. > + * same to I40E_GLV_UPRC[H/L], I40E_GLV_MPRC[H/L], > I40E_GLV_BPRC[H/L]. > */ > if (ns->eth.rx_bytes < pf->internal_stats.rx_bytes) > ns->eth.rx_bytes =3D 0; > - /* exlude internal rx bytes */ > else > ns->eth.rx_bytes -=3D pf->internal_stats.rx_bytes; >=20 > + if (ns->eth.rx_unicast < pf->internal_stats.rx_unicast) > + ns->eth.rx_unicast =3D 0; > + else > + ns->eth.rx_unicast -=3D pf->internal_stats.rx_unicast; > + > + if (ns->eth.rx_multicast < pf->internal_stats.rx_multicast) > + ns->eth.rx_multicast =3D 0; > + else > + ns->eth.rx_multicast -=3D pf->internal_stats.rx_multicast; > + > + if (ns->eth.rx_broadcast < pf->internal_stats.rx_broadcast) > + ns->eth.rx_broadcast =3D 0; > + else > + ns->eth.rx_broadcast -=3D pf->internal_stats.rx_broadcast; > + > i40e_stat_update_32(hw, I40E_GLPRT_RDPC(hw->port), > pf->offset_loaded, &os->eth.rx_discards, > &ns->eth.rx_discards); > @@ -2598,12 +2630,32 @@ i40e_read_stats_registers(struct i40e_pf *pf, > struct i40e_hw *hw) > ns->eth.tx_bytes -=3D (ns->eth.tx_unicast + ns->eth.tx_multicast + > ns->eth.tx_broadcast) * ETHER_CRC_LEN; >=20 > - /* exclude internal tx bytes */ > + /* exlude internal tx bytes exclude > + * Workaround: it is possible I40E_GLV_GOTCH[H/L] is updated > before > + * I40E_GLPRT_GOTCH[H/L], so there is a small window that cause > negtive negative. > + * value. > + * same to I40E_GLV_UPTC[H/L], I40E_GLV_MPTC[H/L], > I40E_GLV_BPTC[H/L]. > + */ > if (ns->eth.tx_bytes < pf->internal_stats.tx_bytes) > ns->eth.tx_bytes =3D 0; > else > ns->eth.tx_bytes -=3D pf->internal_stats.tx_bytes; >=20 > + if (ns->eth.tx_unicast < pf->internal_stats.tx_unicast) > + ns->eth.tx_unicast =3D 0; > + else > + ns->eth.tx_unicast -=3D pf->internal_stats.tx_unicast; > + > + if (ns->eth.tx_multicast < pf->internal_stats.tx_multicast) > + ns->eth.tx_multicast =3D 0; > + else > + ns->eth.tx_multicast -=3D pf->internal_stats.tx_multicast; > + > + if (ns->eth.tx_broadcast < pf->internal_stats.tx_broadcast) > + ns->eth.tx_broadcast =3D 0; > + else > + ns->eth.tx_broadcast -=3D pf->internal_stats.tx_broadcast; > + > /* GLPRT_TEPC not supported */ >=20 > /* additional port specific stats */ > -- > 2.7.4