Skip to contentSkip to conversation

net/i40e: fix statistics

PATCH Applied [email protected] 2 participants 3 messages Jan 23, 2019 – Jan 25, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/i40e: fix statistics

From: Chenmin Sun <[email protected]>

1. Fix the lldp stop condition check - for firmware
versions 6.01(for X710)/3.33(for X722) or later we need stop the lldp
2. Doucment known issue for tx bytes decreasing due to link status chage

Fixes 044846f071cc ("net/i40e: stop LLDP before setting local LLDP MIB")
---
 doc/guides/nics/i40e.rst       |  7 +++++++
 drivers/net/i40e/i40e_ethdev.c | 38 +++++++++++++++++++++++++++-------
 2 files changed, 37 insertions(+), 8 deletions(-)
doc/guides/nics/i40e.rst +7 -0
index 6aceb53ea..d9ec07e12 100644
@@ -698,3 +698,10 @@ See :numref:`figure_intel_perf_test_setup` for the performance test setup.
    * Start creating a stream on packet generator.
 
    * Set the Ethernet II type to 0x0800.
+
+Tx bytes affected by the link status change
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+For firmware versions prior to 6.01 for X710 series and 3.33 for X722 series, the tx_bytes statsistics data is affected by
+the link down event. Each time the link status changes to down, the tx_bytes decreases 110 bytes.
+
drivers/net/i40e/i40e_ethdev.c +30 -8
index a6b97e164..181efbac0 100644
@@ -1493,9 +1493,6 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 		goto err_setup_pf_switch;
 	}
 
-	/* reset all stats of the device, including pf and main vsi */
-	i40e_dev_stats_reset(dev);
-
 	vsi = pf->main_vsi;
 
 	/* Disable double vlan by default */
@@ -1590,6 +1587,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 	memset(&pf->rss_info, 0,
 		sizeof(struct i40e_rte_flow_rss_conf));
 
+	/* reset all stats of the device, including pf and main vsi */
+	i40e_dev_stats_reset(dev);
+
 	return 0;
 
 err_init_fdir_filter_list:
@@ -3454,12 +3454,38 @@ i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
 		 ver, build, patch);
 
 	ret += 1; /* add the size of '\0' */
+
 	if (fw_size < (u32)ret)
 		return ret;
 	else
 		return 0;
 }
 
+/*
+ * When using NVM 6.01(for X710 XL710 XXV710)/3.33(for X722) or later,
+ * the Rx data path does not hang if the FW LLDP is stopped.
+ * return true if lldp need to stop
+ * return false if we cannot disable the LLDP to avoid Rx data path blocking.
+ */
+static bool
+i40e_need_stop_lldp(struct rte_eth_dev *dev)
+{
+	double nvm_ver;
+	char ver_str[64] = {0};
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	i40e_fw_version_get(dev, ver_str, 64);
+	nvm_ver = atof(ver_str);
+	if ((hw->mac.type == I40E_MAC_X722 ||
+	     hw->mac.type == I40E_MAC_X722_VF) &&
+	     ((uint32_t)(nvm_ver * 1000) >= (uint32_t)(3.33 * 1000)))
+		return true;
+	else if ((uint32_t)(nvm_ver * 1000) >= (uint32_t)(6.01 * 1000))
+		return true;
+
+	return false;
+}
+
 static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
@@ -11425,11 +11451,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 	 * LLDP MIB change event.
 	 */
 	if (sw_dcb == TRUE) {
-		/* When using NVM 6.01 or later, the RX data path does
-		 * not hang if the FW LLDP is stopped.
-		 */
-		if (((hw->nvm.version >> 12) & 0xf) >= 6 &&
-		    ((hw->nvm.version >> 4) & 0xff) >= 1) {
+		if (i40e_need_stop_lldp(dev)) {
 			ret = i40e_aq_stop_lldp(hw, TRUE, NULL);
 			if (ret != I40E_SUCCESS)
 				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
Signature · 1 line
2.17.1
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: Sun, Chenmin
Sent: Wednesday, January 23, 2019 9:30 PM
To: [email protected]
Cc: [email protected]; Sun, Chenmin <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [PATCH] net/i40e: fix statistics

Quoted 5 lines

From: Chenmin Sun <[email protected]>

1. Fix the lldp stop condition check - for firmware versions 6.01(for X710)/3.33(for X722) or later we need stop the lldp 2. Doucment known issue for tx bytes decreasing due to link status chage

s/Doucment/Document
s/chage/change

Also add
3. deferred stats reset in dev_init to avoid some noise be counted.

Quoted 6 lines
Fixes 044846f071cc ("net/i40e: stop LLDP before setting local LLDP MIB")

Applied into dpdk-next-net-intel with above commit log change and below minor fix.

Thanks
Qi

Quoted 14 lines
---
 doc/guides/nics/i40e.rst       |  7 +++++++
 drivers/net/i40e/i40e_ethdev.c | 38 +++++++++++++++++++++++++++-------
 2 files changed, 37 insertions(+), 8 deletions(-)
doc/guides/nics/i40e.rst index renamed from doc/guides/nics/i40e.rst +0 -0

6aceb53ea..d9ec07e12 100644

doc/guides/nics/i40e.rst +0 -0
@@ -698,3 +698,10 @@ See :numref:`figure_intel_perf_test_setup` for the

performance test setup.
* Start creating a stream on packet generator.

* Set the Ethernet II type to 0x0800.

doc/guides/nics/i40e.rst See :numref:`figure_intel_perf_test_setup` for the performance test setup.

Quoted 6 lines
doc/guides/nics/i40e.rst +6 -0
+
+Tx bytes affected by the link status change
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+For firmware versions prior to 6.01 for X710 series and 3.33 for X722
+series, the tx_bytes statsistics data is affected by the link down event. Each

s/statsistics/statistics

Quoted 2 lines

time the link status changes to down, the tx_bytes decreases 110 bytes. +

Empty line at end of file

Quoted 27 lines
drivers/net/i40e/i40e_ethdev.c +0 -3
index a6b97e164..181efbac0 100644
@@ -1493,9 +1493,6 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void
 *init_params __rte_unused)
 		goto err_setup_pf_switch;
 	}
 
-	/* reset all stats of the device, including pf and main vsi */
-	i40e_dev_stats_reset(dev);
-
 	vsi = pf->main_vsi;
 
drivers/net/i40e/i40e_ethdev.c +3 -0
 	/* Disable double vlan by default */
@@ -1590,6 +1587,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void
 *init_params __rte_unused)
 	memset(&pf->rss_info, 0,
 		sizeof(struct i40e_rte_flow_rss_conf));
 
+	/* reset all stats of the device, including pf and main vsi */
+	i40e_dev_stats_reset(dev);
+
 	return 0;
 

err_init_fdir_filter_list:

drivers/net/i40e/i40e_ethdev.c i40e_fw_version_get(struct rte_eth_dev *dev, char · line 3458

Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -3454,12 +3454,38 @@ i40e_fw_version_get(struct rte_eth_dev *dev, char
 *fw_version, size_t fw_size)
 		 ver, build, patch);
 
 	ret += 1; /* add the size of '\0' */
+

Unnecessary change.

Quoted 49 lines
drivers/net/i40e/i40e_ethdev.c +24 -0
 	if (fw_size < (u32)ret)
 		return ret;
 	else
 		return 0;
 }
 
+/*
+ * When using NVM 6.01(for X710 XL710 XXV710)/3.33(for X722) or later,
+ * the Rx data path does not hang if the FW LLDP is stopped.
+ * return true if lldp need to stop
+ * return false if we cannot disable the LLDP to avoid Rx data path blocking.
+ */
+static bool
+i40e_need_stop_lldp(struct rte_eth_dev *dev) {
+	double nvm_ver;
+	char ver_str[64] = {0};
+	struct i40e_hw *hw =
 I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	i40e_fw_version_get(dev, ver_str, 64);
+	nvm_ver = atof(ver_str);
+	if ((hw->mac.type == I40E_MAC_X722 ||
+	     hw->mac.type == I40E_MAC_X722_VF) &&
+	     ((uint32_t)(nvm_ver * 1000) >= (uint32_t)(3.33 * 1000)))
+		return true;
+	else if ((uint32_t)(nvm_ver * 1000) >= (uint32_t)(6.01 * 1000))
+		return true;
+
+	return false;
+}
+
 static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info

*dev_info) { @@ -11425,11 +11451,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)

drivers/net/i40e/i40e_ethdev.c +1 -6
 	 * LLDP MIB change event.
 	 */
 	if (sw_dcb == TRUE) {
-		/* When using NVM 6.01 or later, the RX data path does
-		 * not hang if the FW LLDP is stopped.
-		 */
-		if (((hw->nvm.version >> 12) & 0xf) >= 6 &&
-		    ((hw->nvm.version >> 4) & 0xff) >= 1) {
+		if (i40e_need_stop_lldp(dev)) {
 			ret = i40e_aq_stop_lldp(hw, TRUE, NULL);
 			if (ret != I40E_SUCCESS)
 				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
--

2.17.1

#2 lore raw

PATCH v2 1/1 net/i40e: fix statistics

In reply to [email protected]

From: Chenmin Sun <[email protected]>

1. Fix the lldp stop condition check - for firmware
versions 6.01(for X710)/3.33(for X722) or later we need stop the lldp
2. Doucment known issue for tx bytes decreasing due to link status chage
3. Deferred stats reset in dev_init to avoid some noise be counted.

Fixes 044846f071cc ("net/i40e: stop LLDP before setting local LLDP MIB")
---
 doc/guides/nics/i40e.rst       |  7 +++++++
 drivers/net/i40e/i40e_ethdev.c | 38 +++++++++++++++++++++++++++-------
 2 files changed, 37 insertions(+), 8 deletions(-)
doc/guides/nics/i40e.rst +7 -0
index 6aceb53ea..d9ec07e12 100644
@@ -698,3 +698,10 @@ See :numref:`figure_intel_perf_test_setup` for the performance test setup.
    * Start creating a stream on packet generator.
 
    * Set the Ethernet II type to 0x0800.
+
+Tx bytes affected by the link status change
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+For firmware versions prior to 6.01 for X710 series and 3.33 for X722 series, the tx_bytes statsistics data is affected by
+the link down event. Each time the link status changes to down, the tx_bytes decreases 110 bytes.
+
drivers/net/i40e/i40e_ethdev.c +30 -8
index a6b97e164..181efbac0 100644
@@ -1493,9 +1493,6 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 		goto err_setup_pf_switch;
 	}
 
-	/* reset all stats of the device, including pf and main vsi */
-	i40e_dev_stats_reset(dev);
-
 	vsi = pf->main_vsi;
 
 	/* Disable double vlan by default */
@@ -1590,6 +1587,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 	memset(&pf->rss_info, 0,
 		sizeof(struct i40e_rte_flow_rss_conf));
 
+	/* reset all stats of the device, including pf and main vsi */
+	i40e_dev_stats_reset(dev);
+
 	return 0;
 
 err_init_fdir_filter_list:
@@ -3454,12 +3454,38 @@ i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
 		 ver, build, patch);
 
 	ret += 1; /* add the size of '\0' */
+
 	if (fw_size < (u32)ret)
 		return ret;
 	else
 		return 0;
 }
 
+/*
+ * When using NVM 6.01(for X710 XL710 XXV710)/3.33(for X722) or later,
+ * the Rx data path does not hang if the FW LLDP is stopped.
+ * return true if lldp need to stop
+ * return false if we cannot disable the LLDP to avoid Rx data path blocking.
+ */
+static bool
+i40e_need_stop_lldp(struct rte_eth_dev *dev)
+{
+	double nvm_ver;
+	char ver_str[64] = {0};
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	i40e_fw_version_get(dev, ver_str, 64);
+	nvm_ver = atof(ver_str);
+	if ((hw->mac.type == I40E_MAC_X722 ||
+	     hw->mac.type == I40E_MAC_X722_VF) &&
+	     ((uint32_t)(nvm_ver * 1000) >= (uint32_t)(3.33 * 1000)))
+		return true;
+	else if ((uint32_t)(nvm_ver * 1000) >= (uint32_t)(6.01 * 1000))
+		return true;
+
+	return false;
+}
+
 static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
@@ -11425,11 +11451,7 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 	 * LLDP MIB change event.
 	 */
 	if (sw_dcb == TRUE) {
-		/* When using NVM 6.01 or later, the RX data path does
-		 * not hang if the FW LLDP is stopped.
-		 */
-		if (((hw->nvm.version >> 12) & 0xf) >= 6 &&
-		    ((hw->nvm.version >> 4) & 0xff) >= 1) {
+		if (i40e_need_stop_lldp(dev)) {
 			ret = i40e_aq_stop_lldp(hw, TRUE, NULL);
 			if (ret != I40E_SUCCESS)
 				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
Signature · 1 line
2.17.1