Skip to contentSkip to conversation

i40e: workaround for X710 performance issues

PATCH Superseded Helin Zhang 4 participants 15 messages Dec 15, 2014 – Jan 12, 2015 7 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i40e: workaround for X710 performance issues

As the fixes of below performance issues on X710 may not be integrated in latest version of firmware, a workaround in software PMD is needed. It is to re-configure 3 specific registers after being initialized.
- Cannot achieve line rate on X710.
- Performance reduction when promiscuous mode is disabled. Note that this workaround can be removed if the fixes are integrated in the firmware in future.

---
 lib/librte_pmd_i40e/i40e_ethdev.c | 87 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)
lib/librte_pmd_i40e/i40e_ethdev.c +87 -0
index 008d62c..adaab93 100644
@@ -198,6 +198,7 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
 				enum rte_filter_type filter_type,
 				enum rte_filter_op filter_op,
 				void *arg);
+static void i40e_configure_registers(struct i40e_hw *hw);
 
 /* Default hash key buffer for RSS */
 static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1];
@@ -443,6 +444,15 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
 	/* Clear PXE mode */
 	i40e_clear_pxe_mode(hw);
 
+	/*
+	 * On X710, as old version of firmwares may have performance issues,
+	 * 3 registers need to be re-configured with new values. And the latest
+	 * version of firmware may not contain the fixes, workaround in SW
+	 * driver is needed. This workaround can be removed when the fixes are
+	 * integrated in firmware in future.
+	 */
+	i40e_configure_registers(hw);
+
 	/* Get hw capabilities */
 	ret = i40e_get_cap(hw);
 	if (ret != I40E_SUCCESS) {
@@ -5294,3 +5304,80 @@ i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype)
 
 	return flowtype_table[pctype];
 }
+
+static int
+i40e_debug_read_register(struct i40e_hw *hw, uint32_t addr, uint64_t *val)
+{
+	struct i40e_aq_desc desc;
+	struct i40e_aqc_debug_reg_read_write *cmd =
+		(struct i40e_aqc_debug_reg_read_write *)&desc.params.raw;
+	enum i40e_status_code status;
+
+	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_debug_read_reg);
+	cmd->address = rte_cpu_to_le_32(addr);
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, NULL);
+	if (status < 0)
+		return status;
+
+	*val = ((uint64_t)(rte_le_to_cpu_32(cmd->value_high)) << (CHAR_BIT *
+			sizeof(uint32_t))) + rte_le_to_cpu_32(cmd->value_low);
+
+	return status;
+}
+
+/*
+ * On X710, as old version of firmwares may have performance issues,
+ * 3 registers need to be re-configured with new values. And the latest version
+ * of firmware may not contain the fixes, workaround in SW driver is needed.
+ * This workaround can be removed when the fixes are integrated in firmware in
+ * future.
+ */
+static void
+i40e_configure_registers(struct i40e_hw *hw)
+{
+#define I40E_GL_SWR_PRI_JOIN_MAP_0       0x26CE00
+#define I40E_GL_SWR_PRI_JOIN_MAP_2       0x26CE08
+#define I40E_GL_SWR_PM_UP_THR            0x269FBC
+#define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x10000200
+#define I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
+#define I40E_GL_SWR_PM_UP_THR_VALUE      0x03030303
+
+	static const struct {
+		uint32_t addr;
+		uint64_t val;
+	} reg_table[] = {
+		{I40E_GL_SWR_PRI_JOIN_MAP_0, I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE},
+		{I40E_GL_SWR_PRI_JOIN_MAP_2, I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE},
+		{I40E_GL_SWR_PM_UP_THR, I40E_GL_SWR_PM_UP_THR_VALUE},
+	};
+	uint64_t reg;
+	uint32_t i;
+	int ret;
+
+	/* Below fix is for X710 only */
+	if (i40e_is_40G_device(hw->device_id))
+		return;
+
+	for (i = 0; i < RTE_DIM(reg_table); i++) {
+		ret = i40e_debug_read_register(hw, reg_table[i].addr, &reg);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to read from 0x%x\n",
+						reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Read from 0x%x: 0x%lx", reg_table[i].addr,
+									reg);
+		if (reg == reg_table[i].val)
+			continue;
+
+		ret = i40e_aq_debug_write_register(hw, reg_table[i].addr,
+						reg_table[i].val, NULL);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to write 0x%x to 0x%x\n",
+				reg_table[i].val, reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Write to 0x%x: 0x%lx", reg_table[i].addr,
+							reg_table[i].val);
+	}
+}
Signature · 1 line
1.8.1.4
#2 lore raw

PATCH v2 1/1 i40e: workaround for X710 performance issues

In reply to a message not in the archive

As the fixes of below performance issues on X710 may not be integrated in latest version of firmware, a workaround in software PMD is needed. It is to re-configure 3 specific registers after being initialized.
- Cannot achieve line rate on X710.
- Performance reduction when promiscuous mode is disabled. Note that this workaround can be removed if the fixes are integrated in the firmware in future.

---
 lib/librte_pmd_i40e/i40e_ethdev.c | 87 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

v2 changes:
* Added a compile error fix.

lib/librte_pmd_i40e/i40e_ethdev.c +87 -0
index 008d62c..82c072b 100644
@@ -198,6 +198,7 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
 				enum rte_filter_type filter_type,
 				enum rte_filter_op filter_op,
 				void *arg);
+static void i40e_configure_registers(struct i40e_hw *hw);
 
 /* Default hash key buffer for RSS */
 static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1];
@@ -443,6 +444,15 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
 	/* Clear PXE mode */
 	i40e_clear_pxe_mode(hw);
 
+	/*
+	 * On X710, as old version of firmwares may have performance issues,
+	 * 3 registers need to be re-configured with new values. And the latest
+	 * version of firmware may not contain the fixes, workaround in SW
+	 * driver is needed. This workaround can be removed when the fixes are
+	 * integrated in firmware in future.
+	 */
+	i40e_configure_registers(hw);
+
 	/* Get hw capabilities */
 	ret = i40e_get_cap(hw);
 	if (ret != I40E_SUCCESS) {
@@ -5294,3 +5304,80 @@ i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype)
 
 	return flowtype_table[pctype];
 }
+
+static int
+i40e_debug_read_register(struct i40e_hw *hw, uint32_t addr, uint64_t *val)
+{
+	struct i40e_aq_desc desc;
+	struct i40e_aqc_debug_reg_read_write *cmd =
+		(struct i40e_aqc_debug_reg_read_write *)&desc.params.raw;
+	enum i40e_status_code status;
+
+	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_debug_read_reg);
+	cmd->address = rte_cpu_to_le_32(addr);
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, NULL);
+	if (status < 0)
+		return status;
+
+	*val = ((uint64_t)(rte_le_to_cpu_32(cmd->value_high)) << (CHAR_BIT *
+			sizeof(uint32_t))) + rte_le_to_cpu_32(cmd->value_low);
+
+	return status;
+}
+
+/*
+ * On X710, as old version of firmwares may have performance issues,
+ * 3 registers need to be re-configured with new values. And the latest version
+ * of firmware may not contain the fixes, workaround in SW driver is needed.
+ * This workaround can be removed when the fixes are integrated in firmware in
+ * future.
+ */
+static void
+i40e_configure_registers(struct i40e_hw *hw)
+{
+#define I40E_GL_SWR_PRI_JOIN_MAP_0       0x26CE00
+#define I40E_GL_SWR_PRI_JOIN_MAP_2       0x26CE08
+#define I40E_GL_SWR_PM_UP_THR            0x269FBC
+#define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x10000200
+#define I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
+#define I40E_GL_SWR_PM_UP_THR_VALUE      0x03030303
+
+	static const struct {
+		uint32_t addr;
+		uint64_t val;
+	} reg_table[] = {
+		{I40E_GL_SWR_PRI_JOIN_MAP_0, I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE},
+		{I40E_GL_SWR_PRI_JOIN_MAP_2, I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE},
+		{I40E_GL_SWR_PM_UP_THR, I40E_GL_SWR_PM_UP_THR_VALUE},
+	};
+	uint64_t reg;
+	uint32_t i;
+	int ret;
+
+	/* Below fix is for X710 only */
+	if (i40e_is_40G_device(hw->device_id))
+		return;
+
+	for (i = 0; i < RTE_DIM(reg_table); i++) {
+		ret = i40e_debug_read_register(hw, reg_table[i].addr, &reg);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to read from 0x%x\n",
+						reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Read from 0x%x: 0x%lx", reg_table[i].addr,
+									reg);
+		if (reg == reg_table[i].val)
+			continue;
+
+		ret = i40e_aq_debug_write_register(hw, reg_table[i].addr,
+						reg_table[i].val, NULL);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to write 0x%lx to 0x%x\n",
+				reg_table[i].val, reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Write to 0x%x: 0x%lx", reg_table[i].addr,
+							reg_table[i].val);
+	}
+}
Signature · 1 line
1.8.1.4
#4 lore raw
In reply to a message not in the archive

Hi Helin,

Quoted 8 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Helin Zhang
Sent: Monday, December 15, 2014 3:56 PM
To: [email protected]
Cc: Rowden, Aaron F
Subject: [dpdk-dev] [PATCH v2] i40e: workaround for X710 performance issues

Quoted 4 lines

As the fixes of below performance issues on X710 may not be integrated in latest version of firmware, a workaround in software PMD is needed. It is to re-configure 3 specific registers after being initialized.
- Cannot achieve line rate on X710.

packet size?

Quoted 1 line

- Performance reduction when promiscuous mode is disabled.

You'd better add above descriptions in line with the code.

Quoted 3 lines

Note that this workaround can be removed if the fixes are integrated in the firmware in future.

I saw below code applied register setting in case it's 40G device. Can you give more description on what device this patch would boost performance? Will 10G fiber interface benefit from the change?

Quoted 120 lines
---
 lib/librte_pmd_i40e/i40e_ethdev.c | 87
+++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

v2 changes:
* Added a compile error fix.

lib/librte_pmd_i40e/i40e_ethdev.c +4 -0
index 008d62c..82c072b 100644
@@ -198,6 +198,7 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
 				enum rte_filter_type filter_type,
 				enum rte_filter_op filter_op,
 				void *arg);
+static void i40e_configure_registers(struct i40e_hw *hw);
 
 /* Default hash key buffer for RSS */
 static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1];
@@ -443,6 +444,15 @@ eth_i40e_dev_init(__rte_unused struct eth_driver
 *eth_drv,
 	/* Clear PXE mode */
 	i40e_clear_pxe_mode(hw);
 
+	/*
+	 * On X710, as old version of firmwares may have performance issues,
+	 * 3 registers need to be re-configured with new values. And the

latest

lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
+	 * version of firmware may not contain the fixes, workaround in SW
+	 * driver is needed. This workaround can be removed when the fixes

are

lib/librte_pmd_i40e/i40e_ethdev.c +7 -0
+	 * integrated in firmware in future.
+	 */
+	i40e_configure_registers(hw);
+
 	/* Get hw capabilities */
 	ret = i40e_get_cap(hw);
 	if (ret != I40E_SUCCESS) {
@@ -5294,3 +5304,80 @@ i40e_pctype_to_flowtype(enum
 i40e_filter_pctype pctype)
 
 	return flowtype_table[pctype];
 }
+
+static int
+i40e_debug_read_register(struct i40e_hw *hw, uint32_t addr, uint64_t

*val)

lib/librte_pmd_i40e/i40e_ethdev.c +4 -0
+{
+	struct i40e_aq_desc desc;
+	struct i40e_aqc_debug_reg_read_write *cmd =
+		(struct i40e_aqc_debug_reg_read_write

*)&desc.params.raw;

lib/librte_pmd_i40e/i40e_ethdev.c +3 -0
+	enum i40e_status_code status;
+
+	i40e_fill_default_direct_cmd_desc(&desc,

i40e_aqc_opc_debug_read_reg);

lib/librte_pmd_i40e/i40e_ethdev.c +6 -0
+	cmd->address = rte_cpu_to_le_32(addr);
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, NULL);
+	if (status < 0)
+		return status;
+
+	*val = ((uint64_t)(rte_le_to_cpu_32(cmd->value_high)) <<

(CHAR_BIT *

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+			sizeof(uint32_t))) + rte_le_to_cpu_32(cmd-
Quoted 1 line

value_low);

lib/librte_pmd_i40e/i40e_ethdev.c +7 -0
+
+	return status;
+}
+
+/*
+ * On X710, as old version of firmwares may have performance issues,
+ * 3 registers need to be re-configured with new values. And the latest

version
+ * of firmware may not contain the fixes, workaround in SW driver is needed.
+ * This workaround can be removed when the fixes are integrated in firmware in
+ * future.
+ */

lib/librte_pmd_i40e/i40e_ethdev.c +15 -0
+static void
+i40e_configure_registers(struct i40e_hw *hw)
+{
+#define I40E_GL_SWR_PRI_JOIN_MAP_0       0x26CE00
+#define I40E_GL_SWR_PRI_JOIN_MAP_2       0x26CE08
+#define I40E_GL_SWR_PM_UP_THR            0x269FBC
+#define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x10000200
+#define I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
+#define I40E_GL_SWR_PM_UP_THR_VALUE      0x03030303
+
+	static const struct {
+		uint32_t addr;
+		uint64_t val;
+	} reg_table[] = {
+		{I40E_GL_SWR_PRI_JOIN_MAP_0,

I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+		{I40E_GL_SWR_PRI_JOIN_MAP_2,

I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+		{I40E_GL_SWR_PM_UP_THR,

I40E_GL_SWR_PM_UP_THR_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +17 -0
+	};
+	uint64_t reg;
+	uint32_t i;
+	int ret;
+
+	/* Below fix is for X710 only */
+	if (i40e_is_40G_device(hw->device_id))
+		return;
+
+	for (i = 0; i < RTE_DIM(reg_table); i++) {
+		ret = i40e_debug_read_register(hw, reg_table[i].addr, &reg);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to read from 0x%x\n",
+						reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Read from 0x%x: 0x%lx",

reg_table[i].addr,

lib/librte_pmd_i40e/i40e_ethdev.c i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype) · line 5369

Quoted 1 line
lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+									reg);

PRIu64?

lib/librte_pmd_i40e/i40e_ethdev.c i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype) · line 5377

Quoted 9 lines
lib/librte_pmd_i40e/i40e_ethdev.c +7 -0
+		if (reg == reg_table[i].val)
+			continue;
+
+		ret = i40e_aq_debug_write_register(hw, reg_table[i].addr,
+						reg_table[i].val, NULL);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to write 0x%lx to

0x%x\n",

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+				reg_table[i].val, reg_table[i].addr);

PRIu64?

lib/librte_pmd_i40e/i40e_ethdev.c i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype) · line 5381

Quoted 5 lines
lib/librte_pmd_i40e/i40e_ethdev.c +3 -0
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Write to 0x%x: 0x%lx",

reg_table[i].addr,

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+							reg_table[i].val);

PRIu64?

lib/librte_pmd_i40e/i40e_ethdev.c

Quoted 2 lines
lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
+	}
+}

I saw some wrong code alignment above, but not sure how it looks like on terminal, please double check.

Quoted 2 lines

--
1.8.1.4

#6 lore raw
In reply to a message not in the archive
Quoted 20 lines

-----Original Message-----
From: Chen, Jing D
Sent: Tuesday, December 16, 2014 10:29 AM
To: Zhang, Helin; [email protected]
Cc: Rowden, Aaron F
Subject: RE: [dpdk-dev] [PATCH v2] i40e: workaround for X710 performance issues

Hi Helin,

Quoted 8 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Helin Zhang
Sent: Monday, December 15, 2014 3:56 PM
To: [email protected]
Cc: Rowden, Aaron F
Subject: [dpdk-dev] [PATCH v2] i40e: workaround for X710 performance issues

Quoted 6 lines
Quoted 4 lines

As the fixes of below performance issues on X710 may not be integrated in latest version of firmware, a workaround in software PMD is needed. It is to re-configure 3 specific registers after being initialized.
- Cannot achieve line rate on X710.

packet size?

For 10G, it is expected to achieve line rate for all packet sizes.

Quoted 4 lines
Quoted 2 lines

- Performance reduction when promiscuous mode is disabled.

You'd better add above descriptions in line with the code.

It is to re-configure 3 specific registers which is not open in datasheet. So no need to describe the name and the functionality of those registers in detail.

Quoted 8 lines
Quoted 4 lines

Note that this workaround can be removed if the fixes are integrated in the firmware in future.

I saw below code applied register setting in case it's 40G device. Can you give more description on what device this patch would boost performance? Will 10G fiber interface benefit from the change?

It is for X710 only. For XL710, debugging is still in process.

Quoted 118 lines

lib/librte_pmd_i40e/i40e_ethdev.c static int i40e_dev_filter_ctrl(struct rte_eth_dev

Quoted 16 lines
---
 lib/librte_pmd_i40e/i40e_ethdev.c | 87
+++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

v2 changes:
* Added a compile error fix.

lib/librte_pmd_i40e/i40e_ethdev.c +0 -0
index 008d62c..82c072b 100644
@@ -198,6 +198,7 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev

*dev,

Quoted 7 lines
lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
 				enum rte_filter_type filter_type,
 				enum rte_filter_op filter_op,
 				void *arg);
+static void i40e_configure_registers(struct i40e_hw *hw);
 
 /* Default hash key buffer for RSS */  static uint32_t

rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1]; @@ -443,6 +444,15

@@

lib/librte_pmd_i40e/i40e_ethdev.c i40e_pctype_to_flowtype(enum

Quoted 19 lines

eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,

lib/librte_pmd_i40e/i40e_ethdev.c +3 -0
 	/* Clear PXE mode */
 	i40e_clear_pxe_mode(hw);
 
+	/*
+	 * On X710, as old version of firmwares may have performance issues,
+	 * 3 registers need to be re-configured with new values. And the

latest

lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
+	 * version of firmware may not contain the fixes, workaround in SW
+	 * driver is needed. This workaround can be removed when the fixes

are

lib/librte_pmd_i40e/i40e_ethdev.c +4 -0
+	 * integrated in firmware in future.
+	 */
+	i40e_configure_registers(hw);
+
 	/* Get hw capabilities */
 	ret = i40e_get_cap(hw);
 	if (ret != I40E_SUCCESS) {
@@ -5294,3 +5304,80 @@ i40e_pctype_to_flowtype(enum

i40e_filter_pctype

Quoted 73 lines
lib/librte_pmd_i40e/i40e_ethdev.c +3 -0
 pctype)
 
 	return flowtype_table[pctype];
 }
+
+static int
+i40e_debug_read_register(struct i40e_hw *hw, uint32_t addr, uint64_t

*val)

lib/librte_pmd_i40e/i40e_ethdev.c +4 -0
+{
+	struct i40e_aq_desc desc;
+	struct i40e_aqc_debug_reg_read_write *cmd =
+		(struct i40e_aqc_debug_reg_read_write

*)&desc.params.raw;

lib/librte_pmd_i40e/i40e_ethdev.c +3 -0
+	enum i40e_status_code status;
+
+	i40e_fill_default_direct_cmd_desc(&desc,

i40e_aqc_opc_debug_read_reg);

lib/librte_pmd_i40e/i40e_ethdev.c +6 -0
+	cmd->address = rte_cpu_to_le_32(addr);
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, NULL);
+	if (status < 0)
+		return status;
+
+	*val = ((uint64_t)(rte_le_to_cpu_32(cmd->value_high)) <<

(CHAR_BIT *

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+			sizeof(uint32_t))) + rte_le_to_cpu_32(cmd-
Quoted 1 line

value_low);

lib/librte_pmd_i40e/i40e_ethdev.c +8 -0
+
+	return status;
+}
+
+/*
+ * On X710, as old version of firmwares may have performance issues,
+ * 3 registers need to be re-configured with new values. And the
+latest

version
+ * of firmware may not contain the fixes, workaround in SW driver is needed.
+ * This workaround can be removed when the fixes are integrated in firmware in
+ * future.
+ */

lib/librte_pmd_i40e/i40e_ethdev.c +14 -0
+static void
+i40e_configure_registers(struct i40e_hw *hw) {
+#define I40E_GL_SWR_PRI_JOIN_MAP_0       0x26CE00
+#define I40E_GL_SWR_PRI_JOIN_MAP_2       0x26CE08
+#define I40E_GL_SWR_PM_UP_THR            0x269FBC
+#define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x10000200 #define
+I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
+#define I40E_GL_SWR_PM_UP_THR_VALUE      0x03030303
+
+	static const struct {
+		uint32_t addr;
+		uint64_t val;
+	} reg_table[] = {
+		{I40E_GL_SWR_PRI_JOIN_MAP_0,

I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+		{I40E_GL_SWR_PRI_JOIN_MAP_2,

I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+		{I40E_GL_SWR_PM_UP_THR,

I40E_GL_SWR_PM_UP_THR_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +13 -0
+	};
+	uint64_t reg;
+	uint32_t i;
+	int ret;
+
+	/* Below fix is for X710 only */
+	if (i40e_is_40G_device(hw->device_id))
+		return;
+
+	for (i = 0; i < RTE_DIM(reg_table); i++) {
+		ret = i40e_debug_read_register(hw, reg_table[i].addr, &reg);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to read from 0x%x\n",
Quoted 8 lines

lib/librte_pmd_i40e/i40e_ethdev.c i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype) · line 5369

Quoted 6 lines
lib/librte_pmd_i40e/i40e_ethdev.c +4 -0
+						reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Read from 0x%x: 0x%lx",

reg_table[i].addr,

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+									reg);

PRIu64?

Yes, it would be better to use PRIu64.

Quoted 21 lines

lib/librte_pmd_i40e/i40e_ethdev.c i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype) · line 5377

Quoted 10 lines
lib/librte_pmd_i40e/i40e_ethdev.c +7 -0
+		if (reg == reg_table[i].val)
+			continue;
+
+		ret = i40e_aq_debug_write_register(hw, reg_table[i].addr,
+						reg_table[i].val, NULL);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to write 0x%lx to

0x%x\n",

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+				reg_table[i].val, reg_table[i].addr);

PRIu64?

lib/librte_pmd_i40e/i40e_ethdev.c i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype) · line 5381

Quoted 5 lines
lib/librte_pmd_i40e/i40e_ethdev.c +3 -0
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Write to 0x%x: 0x%lx",

reg_table[i].addr,

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+							reg_table[i].val);

PRIu64?

Quoted 5 lines

lib/librte_pmd_i40e/i40e_ethdev.c

Quoted 2 lines
lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
+	}
+}

I saw some wrong code alignment above, but not sure how it looks like on terminal, please double check.

All passed checks by checkpatch.pl. Email always shows different format than patch itself.

Quoted 3 lines
Quoted 3 lines

--
1.8.1.4

#7 lore raw

PATCH v3 1/1 i40e: workaround for X710 performance issues

In reply to a message not in the archive

On X710, performance number is far from the expectation on recent firmware versions. The fix for this issue may not be integrated in the following firmware version. So the workaround in software driver is needed. It needs to modify the initial values of 3 internal only registers. Note that the workaround can be removed when it is fixed in firmware in the future.

---
 lib/librte_pmd_i40e/i40e_ethdev.c | 89 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)

v2 changes:
* Added a compile error fix.

v3 changes:
* Used PRIx32 and PRIx64 instead for printing uint32_t and uint64_t variables.
* Re-worded annotations, and commit logs.

lib/librte_pmd_i40e/i40e_ethdev.c +89 -0
index 008d62c..624f0ce 100644
@@ -198,6 +198,7 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
 				enum rte_filter_type filter_type,
 				enum rte_filter_op filter_op,
 				void *arg);
+static void i40e_configure_registers(struct i40e_hw *hw);
 
 /* Default hash key buffer for RSS */
 static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1];
@@ -443,6 +444,16 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
 	/* Clear PXE mode */
 	i40e_clear_pxe_mode(hw);
 
+	/*
+	 * On X710, performance number is far from the expectation on recent
+	 * firmware versions. The fix for this issue may not be integrated in
+	 * the following firmware version. So the workaround in software driver
+	 * is needed. It needs to modify the initial values of 3 internal only
+	 * registers. Note that the workaround can be removed when it is fixed
+	 * in firmware in the future.
+	 */
+	i40e_configure_registers(hw);
+
 	/* Get hw capabilities */
 	ret = i40e_get_cap(hw);
 	if (ret != I40E_SUCCESS) {
@@ -5294,3 +5305,81 @@ i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype)
 
 	return flowtype_table[pctype];
 }
+
+static int
+i40e_debug_read_register(struct i40e_hw *hw, uint32_t addr, uint64_t *val)
+{
+	struct i40e_aq_desc desc;
+	struct i40e_aqc_debug_reg_read_write *cmd =
+		(struct i40e_aqc_debug_reg_read_write *)&desc.params.raw;
+	enum i40e_status_code status;
+
+	i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_debug_read_reg);
+	cmd->address = rte_cpu_to_le_32(addr);
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, NULL);
+	if (status < 0)
+		return status;
+
+	*val = ((uint64_t)(rte_le_to_cpu_32(cmd->value_high)) << (CHAR_BIT *
+			sizeof(uint32_t))) + rte_le_to_cpu_32(cmd->value_low);
+
+	return status;
+}
+
+/*
+ * On X710, performance number is far from the expectation on recent firmware
+ * versions. The fix for this issue may not be integrated in the following
+ * firmware version. So the workaround in software driver is needed. It needs
+ * to modify the initial values of 3 internal only registers. Note that the
+ * workaround can be removed when it is fixed in firmware in the future.
+ */
+static void
+i40e_configure_registers(struct i40e_hw *hw)
+{
+#define I40E_GL_SWR_PRI_JOIN_MAP_0       0x26CE00
+#define I40E_GL_SWR_PRI_JOIN_MAP_2       0x26CE08
+#define I40E_GL_SWR_PM_UP_THR            0x269FBC
+#define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x10000200
+#define I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
+#define I40E_GL_SWR_PM_UP_THR_VALUE      0x03030303
+
+	static const struct {
+		uint32_t addr;
+		uint64_t val;
+	} reg_table[] = {
+		{I40E_GL_SWR_PRI_JOIN_MAP_0, I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE},
+		{I40E_GL_SWR_PRI_JOIN_MAP_2, I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE},
+		{I40E_GL_SWR_PM_UP_THR, I40E_GL_SWR_PM_UP_THR_VALUE},
+	};
+	uint64_t reg;
+	uint32_t i;
+	int ret;
+
+	/* Below fix is for X710 only */
+	if (i40e_is_40G_device(hw->device_id))
+		return;
+
+	for (i = 0; i < RTE_DIM(reg_table); i++) {
+		ret = i40e_debug_read_register(hw, reg_table[i].addr, &reg);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to read from 0x%"PRIx32,
+							reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Read from 0x%"PRIx32": 0x%"PRIx64,
+						reg_table[i].addr, reg);
+		if (reg == reg_table[i].val)
+			continue;
+
+		ret = i40e_aq_debug_write_register(hw, reg_table[i].addr,
+						reg_table[i].val, NULL);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to write 0x%"PRIx64" to the "
+				"address of 0x%"PRIx32, reg_table[i].val,
+							reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Write 0x%"PRIx64" to the address of "
+			"0x%"PRIx32, reg_table[i].val, reg_table[i].addr);
+	}
+}
Signature · 1 line
1.8.1.4
#9 lore raw
In reply to a message not in the archive

Hi Helin,

First, thank you and Jing for the excellent review process.

2014-12-16 16:23, Helin Zhang:

Quoted 6 lines

On X710, performance number is far from the expectation on recent firmware versions. The fix for this issue may not be integrated in the following firmware version. So the workaround in software driver is needed. It needs to modify the initial values of 3 internal only registers. Note that the workaround can be removed when it is fixed in firmware in the future.

I want to understand something here. You say the workaround can be removed when firmware will be fixed. But I suppose that some NICs won't be updated so the workaround will be needed forever?

Signature · 1 line
Thomas
Acked-by
#11 lore raw
In reply to a message not in the archive
Quoted 163 lines

-----Original Message-----
From: Zhang, Helin
Sent: Tuesday, December 16, 2014 4:23 PM
To: [email protected]
Cc: Chen, Jing D; Wu, Jingjing; Liu, Jijiang; Cao, Waterman; Lu, Patrick; Rowden, Aaron F; Zhang, Helin
Subject: [PATCH v3] i40e: workaround for X710 performance issues

On X710, performance number is far from the expectation on recent firmware versions. The fix for this issue may not be integrated in the following firmware version. So the workaround in software driver is needed. It needs to modify the initial values of 3 internal only registers. Note that the workaround can be removed when it is fixed in firmware in the future.

---
 lib/librte_pmd_i40e/i40e_ethdev.c | 89
+++++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)

v2 changes:
* Added a compile error fix.

v3 changes:
* Used PRIx32 and PRIx64 instead for printing uint32_t and uint64_t variables.
* Re-worded annotations, and commit logs.

lib/librte_pmd_i40e/i40e_ethdev.c +3 -0
index 008d62c..624f0ce 100644
@@ -198,6 +198,7 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
 				enum rte_filter_type filter_type,
 				enum rte_filter_op filter_op,
 				void *arg);
+static void i40e_configure_registers(struct i40e_hw *hw);
 
 /* Default hash key buffer for RSS */
 static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1];
@@ -443,6 +444,16 @@ eth_i40e_dev_init(__rte_unused struct eth_driver
 *eth_drv,
 	/* Clear PXE mode */
 	i40e_clear_pxe_mode(hw);
 
+	/*
+	 * On X710, performance number is far from the expectation on

recent

lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
+	 * firmware versions. The fix for this issue may not be integrated in
+	 * the following firmware version. So the workaround in software

driver

lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
+	 * is needed. It needs to modify the initial values of 3 internal only
+	 * registers. Note that the workaround can be removed when it is

fixed

lib/librte_pmd_i40e/i40e_ethdev.c +7 -0
+	 * in firmware in the future.
+	 */
+	i40e_configure_registers(hw);
+
 	/* Get hw capabilities */
 	ret = i40e_get_cap(hw);
 	if (ret != I40E_SUCCESS) {
@@ -5294,3 +5305,81 @@ i40e_pctype_to_flowtype(enum
 i40e_filter_pctype pctype)
 
 	return flowtype_table[pctype];
 }
+
+static int
+i40e_debug_read_register(struct i40e_hw *hw, uint32_t addr, uint64_t

*val)

lib/librte_pmd_i40e/i40e_ethdev.c +4 -0
+{
+	struct i40e_aq_desc desc;
+	struct i40e_aqc_debug_reg_read_write *cmd =
+		(struct i40e_aqc_debug_reg_read_write

*)&desc.params.raw;

lib/librte_pmd_i40e/i40e_ethdev.c +3 -0
+	enum i40e_status_code status;
+
+	i40e_fill_default_direct_cmd_desc(&desc,

i40e_aqc_opc_debug_read_reg);

lib/librte_pmd_i40e/i40e_ethdev.c +6 -0
+	cmd->address = rte_cpu_to_le_32(addr);
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, NULL);
+	if (status < 0)
+		return status;
+
+	*val = ((uint64_t)(rte_le_to_cpu_32(cmd->value_high)) <<

(CHAR_BIT *

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+			sizeof(uint32_t))) + rte_le_to_cpu_32(cmd-
Quoted 1 line

value_low);

lib/librte_pmd_i40e/i40e_ethdev.c +6 -0
+
+	return status;
+}
+
+/*
+ * On X710, performance number is far from the expectation on recent

firmware
+ * versions. The fix for this issue may not be integrated in the following
+ * firmware version. So the workaround in software driver is needed. It needs
+ * to modify the initial values of 3 internal only registers. Note that the
+ * workaround can be removed when it is fixed in firmware in the future.
+ */

lib/librte_pmd_i40e/i40e_ethdev.c +15 -0
+static void
+i40e_configure_registers(struct i40e_hw *hw)
+{
+#define I40E_GL_SWR_PRI_JOIN_MAP_0       0x26CE00
+#define I40E_GL_SWR_PRI_JOIN_MAP_2       0x26CE08
+#define I40E_GL_SWR_PM_UP_THR            0x269FBC
+#define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x10000200
+#define I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
+#define I40E_GL_SWR_PM_UP_THR_VALUE      0x03030303
+
+	static const struct {
+		uint32_t addr;
+		uint64_t val;
+	} reg_table[] = {
+		{I40E_GL_SWR_PRI_JOIN_MAP_0,

I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+		{I40E_GL_SWR_PRI_JOIN_MAP_2,

I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+		{I40E_GL_SWR_PM_UP_THR,

I40E_GL_SWR_PM_UP_THR_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +13 -0
+	};
+	uint64_t reg;
+	uint32_t i;
+	int ret;
+
+	/* Below fix is for X710 only */
+	if (i40e_is_40G_device(hw->device_id))
+		return;
+
+	for (i = 0; i < RTE_DIM(reg_table); i++) {
+		ret = i40e_debug_read_register(hw, reg_table[i].addr, &reg);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to read from

0x%"PRIx32,

lib/librte_pmd_i40e/i40e_ethdev.c +4 -0
+							reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Read from 0x%"PRIx32":

0x%"PRIx64,

lib/librte_pmd_i40e/i40e_ethdev.c +8 -0
+						reg_table[i].addr, reg);
+		if (reg == reg_table[i].val)
+			continue;
+
+		ret = i40e_aq_debug_write_register(hw, reg_table[i].addr,
+						reg_table[i].val, NULL);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to write 0x%"PRIx64" to

the "

lib/librte_pmd_i40e/i40e_ethdev.c +5 -0
+				"address of 0x%"PRIx32, reg_table[i].val,
+							reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Write 0x%"PRIx64" to the address

of "

lib/librte_pmd_i40e/i40e_ethdev.c +3 -1
+			"0x%"PRIx32, reg_table[i].val, reg_table[i].addr);
+	}
+}
--
Quoted 1 line

1.8.1.4

#10 lore raw
In reply to Thomas Monjalon
Quoted 22 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, December 16, 2014 4:37 PM
To: Zhang, Helin
Cc: [email protected]; Rowden, Aaron F; Chen, Jing D
Subject: Re: [dpdk-dev] [PATCH v3] i40e: workaround for X710 performance issues

Hi Helin,

First, thank you and Jing for the excellent review process.

2014-12-16 16:23, Helin Zhang:

Quoted 6 lines

On X710, performance number is far from the expectation on recent firmware versions. The fix for this issue may not be integrated in the following firmware version. So the workaround in software driver is needed. It needs to modify the initial values of 3 internal only registers. Note that the workaround can be removed when it is fixed in firmware in the future.

Quoted 3 lines

I want to understand something here. You say the workaround can be removed when firmware will be fixed. But I suppose that some NICs won't be updated so the workaround will be needed forever?

Yes, it is possible. Let me check with our NIC marketing guys of their firmware update strategy before removing it. Now it is quite useful for high performance. Thank you very much for pointing out this!

Regards,
Helin

Quoted 3 lines

--
Thomas

#13 lore raw
In reply to a message not in the archive
Quoted 10 lines
Quoted 8 lines

On X710, performance number is far from the expectation on recent firmware versions. The fix for this issue may not be integrated in the following firmware version. So the workaround in software driver is needed. It needs to modify the initial values of 3 internal only registers. Note that the workaround can be removed when it is fixed in firmware in the future.

Applied

Thanks

Signature · 1 line
Thomas
#14 lore raw
In reply to a message not in the archive
Quoted 90 lines

-----Original Message-----
From: Zhang, Helin
Sent: Tuesday, December 16, 2014 4:23 PM
To: [email protected]
Cc: Chen, Jing D; Wu, Jingjing; Liu, Jijiang; Cao, Waterman; Lu, Patrick; Rowden, Aaron F; Zhang, Helin
Subject: [PATCH v3] i40e: workaround for X710 performance issues

On X710, performance number is far from the expectation on recent firmware versions. The fix for this issue may not be integrated in the following firmware version. So the workaround in software driver is needed. It needs to modify the initial values of 3 internal only registers. Note that the workaround can be removed when it is fixed in firmware in the future.

---
 lib/librte_pmd_i40e/i40e_ethdev.c | 89
+++++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)

v2 changes:
* Added a compile error fix.

v3 changes:
* Used PRIx32 and PRIx64 instead for printing uint32_t and uint64_t variables.
* Re-worded annotations, and commit logs.

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
index 008d62c..624f0ce 100644
@@ -198,6 +198,7 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
 				enum rte_filter_type filter_type,
 				enum rte_filter_op filter_op,
 				void *arg);
+static void i40e_configure_registers(struct i40e_hw *hw);
 
 /* Default hash key buffer for RSS */
 static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1]; @@ -

443,6 +444,16 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,

lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
 	/* Clear PXE mode */
 	i40e_clear_pxe_mode(hw);
 
+	/*
+	 * On X710, performance number is far from the expectation on

recent

lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
+	 * firmware versions. The fix for this issue may not be integrated in
+	 * the following firmware version. So the workaround in software

driver

lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
+	 * is needed. It needs to modify the initial values of 3 internal only
+	 * registers. Note that the workaround can be removed when it is

fixed

lib/librte_pmd_i40e/i40e_ethdev.c +11 -0
+	 * in firmware in the future.
+	 */
+	i40e_configure_registers(hw);
+
 	/* Get hw capabilities */
 	ret = i40e_get_cap(hw);
 	if (ret != I40E_SUCCESS) {
@@ -5294,3 +5305,81 @@ i40e_pctype_to_flowtype(enum
 i40e_filter_pctype pctype)
 
 	return flowtype_table[pctype];
 }
+
+static int
+i40e_debug_read_register(struct i40e_hw *hw, uint32_t addr, uint64_t
+*val) {
+	struct i40e_aq_desc desc;
+	struct i40e_aqc_debug_reg_read_write *cmd =
+		(struct i40e_aqc_debug_reg_read_write

*)&desc.params.raw;

lib/librte_pmd_i40e/i40e_ethdev.c +3 -0
+	enum i40e_status_code status;
+
+	i40e_fill_default_direct_cmd_desc(&desc,

i40e_aqc_opc_debug_read_reg);

lib/librte_pmd_i40e/i40e_ethdev.c +6 -0
+	cmd->address = rte_cpu_to_le_32(addr);
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, NULL);
+	if (status < 0)
+		return status;
+
+	*val = ((uint64_t)(rte_le_to_cpu_32(cmd->value_high)) <<

(CHAR_BIT *

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+			sizeof(uint32_t))) + rte_le_to_cpu_32(cmd-
Quoted 1 line

value_low);

Quoted 1 line

+

Do we need to add rte_le_to_cpu_64 here?

Quoted 72 lines
lib/librte_pmd_i40e/i40e_ethdev.c +28 -0
+	return status;
+}
+
+/*
+ * On X710, performance number is far from the expectation on recent
+firmware
+ * versions. The fix for this issue may not be integrated in the
+following
+ * firmware version. So the workaround in software driver is needed. It
+needs
+ * to modify the initial values of 3 internal only registers. Note that
+the
+ * workaround can be removed when it is fixed in firmware in the future.
+ */
+static void
+i40e_configure_registers(struct i40e_hw *hw) {
+#define I40E_GL_SWR_PRI_JOIN_MAP_0       0x26CE00
+#define I40E_GL_SWR_PRI_JOIN_MAP_2       0x26CE08
+#define I40E_GL_SWR_PM_UP_THR            0x269FBC
+#define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x10000200 #define
+I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
+#define I40E_GL_SWR_PM_UP_THR_VALUE      0x03030303
+
+	static const struct {
+		uint32_t addr;
+		uint64_t val;
+	} reg_table[] = {
+		{I40E_GL_SWR_PRI_JOIN_MAP_0,

I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+		{I40E_GL_SWR_PRI_JOIN_MAP_2,

I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+		{I40E_GL_SWR_PM_UP_THR,

I40E_GL_SWR_PM_UP_THR_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +13 -0
+	};
+	uint64_t reg;
+	uint32_t i;
+	int ret;
+
+	/* Below fix is for X710 only */
+	if (i40e_is_40G_device(hw->device_id))
+		return;
+
+	for (i = 0; i < RTE_DIM(reg_table); i++) {
+		ret = i40e_debug_read_register(hw, reg_table[i].addr, &reg);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to read from

0x%"PRIx32,

lib/librte_pmd_i40e/i40e_ethdev.c +4 -0
+							reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Read from 0x%"PRIx32":

0x%"PRIx64,

lib/librte_pmd_i40e/i40e_ethdev.c +8 -0
+						reg_table[i].addr, reg);
+		if (reg == reg_table[i].val)
+			continue;
+
+		ret = i40e_aq_debug_write_register(hw, reg_table[i].addr,
+						reg_table[i].val, NULL);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to write 0x%"PRIx64" to

the "

lib/librte_pmd_i40e/i40e_ethdev.c +5 -0
+				"address of 0x%"PRIx32, reg_table[i].val,
+							reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Write 0x%"PRIx64" to the address

of "

lib/librte_pmd_i40e/i40e_ethdev.c +3 -1
+			"0x%"PRIx32, reg_table[i].val, reg_table[i].addr);
+	}
+}
--

1.8.1.4

#16 lore raw
In reply to a message not in the archive
Quoted 101 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Thursday, January 8, 2015 10:44 AM
To: Zhang, Helin; [email protected]
Cc: Chen, Jing D; Liu, Jijiang; Cao, Waterman; Lu, Patrick; Rowden, Aaron F
Subject: RE: [PATCH v3] i40e: workaround for X710 performance issues

Quoted 8 lines

-----Original Message-----
From: Zhang, Helin
Sent: Tuesday, December 16, 2014 4:23 PM
To: [email protected]
Cc: Chen, Jing D; Wu, Jingjing; Liu, Jijiang; Cao, Waterman; Lu, Patrick; Rowden, Aaron F; Zhang, Helin
Subject: [PATCH v3] i40e: workaround for X710 performance issues

Quoted 5 lines

On X710, performance number is far from the expectation on recent firmware versions. The fix for this issue may not be integrated in the following firmware version. So the workaround in software driver is needed. It needs to modify the initial values of 3 internal only registers. Note that the workaround can be removed when it is fixed in firmware in the

future.

lib/librte_pmd_i40e/i40e_ethdev.c static int i40e_dev_filter_ctrl(struct rte_eth_dev

Quoted 21 lines
---
 lib/librte_pmd_i40e/i40e_ethdev.c | 89
+++++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)

v2 changes:
* Added a compile error fix.

v3 changes:
* Used PRIx32 and PRIx64 instead for printing uint32_t and uint64_t variables.
* Re-worded annotations, and commit logs.

lib/librte_pmd_i40e/i40e_ethdev.c +0 -0
index 008d62c..624f0ce 100644
@@ -198,6 +198,7 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev

*dev,

lib/librte_pmd_i40e/i40e_ethdev.c i40e_pctype_to_flowtype(enum

Quoted 29 lines
lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
 				enum rte_filter_type filter_type,
 				enum rte_filter_op filter_op,
 				void *arg);
+static void i40e_configure_registers(struct i40e_hw *hw);
 
 /* Default hash key buffer for RSS */  static uint32_t

rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1]; @@ - 443,6 +444,16 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,

lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
 	/* Clear PXE mode */
 	i40e_clear_pxe_mode(hw);
 
+	/*
+	 * On X710, performance number is far from the expectation on

recent

lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
+	 * firmware versions. The fix for this issue may not be integrated in
+	 * the following firmware version. So the workaround in software

driver

lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
+	 * is needed. It needs to modify the initial values of 3 internal only
+	 * registers. Note that the workaround can be removed when it is

fixed

lib/librte_pmd_i40e/i40e_ethdev.c +4 -0
+	 * in firmware in the future.
+	 */
+	i40e_configure_registers(hw);
+
 	/* Get hw capabilities */
 	ret = i40e_get_cap(hw);
 	if (ret != I40E_SUCCESS) {
@@ -5294,3 +5305,81 @@ i40e_pctype_to_flowtype(enum

i40e_filter_pctype

Quoted 24 lines
lib/librte_pmd_i40e/i40e_ethdev.c +7 -0
 pctype)
 
 	return flowtype_table[pctype];
 }
+
+static int
+i40e_debug_read_register(struct i40e_hw *hw, uint32_t addr, uint64_t
+*val) {
+	struct i40e_aq_desc desc;
+	struct i40e_aqc_debug_reg_read_write *cmd =
+		(struct i40e_aqc_debug_reg_read_write

*)&desc.params.raw;

lib/librte_pmd_i40e/i40e_ethdev.c +3 -0
+	enum i40e_status_code status;
+
+	i40e_fill_default_direct_cmd_desc(&desc,

i40e_aqc_opc_debug_read_reg);

lib/librte_pmd_i40e/i40e_ethdev.c +6 -0
+	cmd->address = rte_cpu_to_le_32(addr);
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, NULL);
+	if (status < 0)
+		return status;
+
+	*val = ((uint64_t)(rte_le_to_cpu_32(cmd->value_high)) <<

(CHAR_BIT *

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+			sizeof(uint32_t))) + rte_le_to_cpu_32(cmd-
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

value_low);

+

Do we need to add rte_le_to_cpu_64 here?

No, we don't need one more conversion, as 32 bits value are already 'cpu' byte order.

Thanks,
Helin

Quoted 73 lines
Quoted 73 lines
lib/librte_pmd_i40e/i40e_ethdev.c +28 -0
+	return status;
+}
+
+/*
+ * On X710, performance number is far from the expectation on recent
+firmware
+ * versions. The fix for this issue may not be integrated in the
+following
+ * firmware version. So the workaround in software driver is needed.
+It needs
+ * to modify the initial values of 3 internal only registers. Note
+that the
+ * workaround can be removed when it is fixed in firmware in the future.
+ */
+static void
+i40e_configure_registers(struct i40e_hw *hw) {
+#define I40E_GL_SWR_PRI_JOIN_MAP_0       0x26CE00
+#define I40E_GL_SWR_PRI_JOIN_MAP_2       0x26CE08
+#define I40E_GL_SWR_PM_UP_THR            0x269FBC
+#define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x10000200 #define
+I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
+#define I40E_GL_SWR_PM_UP_THR_VALUE      0x03030303
+
+	static const struct {
+		uint32_t addr;
+		uint64_t val;
+	} reg_table[] = {
+		{I40E_GL_SWR_PRI_JOIN_MAP_0,

I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+		{I40E_GL_SWR_PRI_JOIN_MAP_2,

I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+		{I40E_GL_SWR_PM_UP_THR,

I40E_GL_SWR_PM_UP_THR_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +13 -0
+	};
+	uint64_t reg;
+	uint32_t i;
+	int ret;
+
+	/* Below fix is for X710 only */
+	if (i40e_is_40G_device(hw->device_id))
+		return;
+
+	for (i = 0; i < RTE_DIM(reg_table); i++) {
+		ret = i40e_debug_read_register(hw, reg_table[i].addr, &reg);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to read from

0x%"PRIx32,

lib/librte_pmd_i40e/i40e_ethdev.c +4 -0
+							reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Read from 0x%"PRIx32":

0x%"PRIx64,

lib/librte_pmd_i40e/i40e_ethdev.c +8 -0
+						reg_table[i].addr, reg);
+		if (reg == reg_table[i].val)
+			continue;
+
+		ret = i40e_aq_debug_write_register(hw, reg_table[i].addr,
+						reg_table[i].val, NULL);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to write 0x%"PRIx64" to

the "

lib/librte_pmd_i40e/i40e_ethdev.c +5 -0
+				"address of 0x%"PRIx32, reg_table[i].val,
+							reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Write 0x%"PRIx64" to the address

of "

lib/librte_pmd_i40e/i40e_ethdev.c +3 -1
+			"0x%"PRIx32, reg_table[i].val, reg_table[i].addr);
+	}
+}
--

1.8.1.4

Acked-by
#17 lore raw
In reply to a message not in the archive
Quoted 162 lines

-----Original Message-----
From: Zhang, Helin
Sent: Tuesday, December 16, 2014 4:23 PM
To: [email protected]
Cc: Chen, Jing D; Wu, Jingjing; Liu, Jijiang; Cao, Waterman; Lu, Patrick; Rowden, Aaron F; Zhang, Helin
Subject: [PATCH v3] i40e: workaround for X710 performance issues

On X710, performance number is far from the expectation on recent firmware versions. The fix for this issue may not be integrated in the following firmware version. So the workaround in software driver is needed. It needs to modify the initial values of 3 internal only registers. Note that the workaround can be removed when it is fixed in firmware in the future.

---
 lib/librte_pmd_i40e/i40e_ethdev.c | 89
+++++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)

v2 changes:
* Added a compile error fix.

v3 changes:
* Used PRIx32 and PRIx64 instead for printing uint32_t and uint64_t variables.
* Re-worded annotations, and commit logs.

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
index 008d62c..624f0ce 100644
@@ -198,6 +198,7 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
 				enum rte_filter_type filter_type,
 				enum rte_filter_op filter_op,
 				void *arg);
+static void i40e_configure_registers(struct i40e_hw *hw);
 
 /* Default hash key buffer for RSS */
 static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1]; @@ -

443,6 +444,16 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,

lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
 	/* Clear PXE mode */
 	i40e_clear_pxe_mode(hw);
 
+	/*
+	 * On X710, performance number is far from the expectation on

recent

lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
+	 * firmware versions. The fix for this issue may not be integrated in
+	 * the following firmware version. So the workaround in software

driver

lib/librte_pmd_i40e/i40e_ethdev.c +2 -0
+	 * is needed. It needs to modify the initial values of 3 internal only
+	 * registers. Note that the workaround can be removed when it is

fixed

lib/librte_pmd_i40e/i40e_ethdev.c +11 -0
+	 * in firmware in the future.
+	 */
+	i40e_configure_registers(hw);
+
 	/* Get hw capabilities */
 	ret = i40e_get_cap(hw);
 	if (ret != I40E_SUCCESS) {
@@ -5294,3 +5305,81 @@ i40e_pctype_to_flowtype(enum
 i40e_filter_pctype pctype)
 
 	return flowtype_table[pctype];
 }
+
+static int
+i40e_debug_read_register(struct i40e_hw *hw, uint32_t addr, uint64_t
+*val) {
+	struct i40e_aq_desc desc;
+	struct i40e_aqc_debug_reg_read_write *cmd =
+		(struct i40e_aqc_debug_reg_read_write

*)&desc.params.raw;

lib/librte_pmd_i40e/i40e_ethdev.c +3 -0
+	enum i40e_status_code status;
+
+	i40e_fill_default_direct_cmd_desc(&desc,

i40e_aqc_opc_debug_read_reg);

lib/librte_pmd_i40e/i40e_ethdev.c +6 -0
+	cmd->address = rte_cpu_to_le_32(addr);
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, NULL);
+	if (status < 0)
+		return status;
+
+	*val = ((uint64_t)(rte_le_to_cpu_32(cmd->value_high)) <<

(CHAR_BIT *

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+			sizeof(uint32_t))) + rte_le_to_cpu_32(cmd-
Quoted 1 line

value_low);

lib/librte_pmd_i40e/i40e_ethdev.c +29 -0
+
+	return status;
+}
+
+/*
+ * On X710, performance number is far from the expectation on recent
+firmware
+ * versions. The fix for this issue may not be integrated in the
+following
+ * firmware version. So the workaround in software driver is needed. It
+needs
+ * to modify the initial values of 3 internal only registers. Note that
+the
+ * workaround can be removed when it is fixed in firmware in the future.
+ */
+static void
+i40e_configure_registers(struct i40e_hw *hw) {
+#define I40E_GL_SWR_PRI_JOIN_MAP_0       0x26CE00
+#define I40E_GL_SWR_PRI_JOIN_MAP_2       0x26CE08
+#define I40E_GL_SWR_PM_UP_THR            0x269FBC
+#define I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x10000200 #define
+I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200
+#define I40E_GL_SWR_PM_UP_THR_VALUE      0x03030303
+
+	static const struct {
+		uint32_t addr;
+		uint64_t val;
+	} reg_table[] = {
+		{I40E_GL_SWR_PRI_JOIN_MAP_0,

I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+		{I40E_GL_SWR_PRI_JOIN_MAP_2,

I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +1 -0
+		{I40E_GL_SWR_PM_UP_THR,

I40E_GL_SWR_PM_UP_THR_VALUE},

lib/librte_pmd_i40e/i40e_ethdev.c +13 -0
+	};
+	uint64_t reg;
+	uint32_t i;
+	int ret;
+
+	/* Below fix is for X710 only */
+	if (i40e_is_40G_device(hw->device_id))
+		return;
+
+	for (i = 0; i < RTE_DIM(reg_table); i++) {
+		ret = i40e_debug_read_register(hw, reg_table[i].addr, &reg);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to read from

0x%"PRIx32,

lib/librte_pmd_i40e/i40e_ethdev.c +4 -0
+							reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Read from 0x%"PRIx32":

0x%"PRIx64,

lib/librte_pmd_i40e/i40e_ethdev.c +8 -0
+						reg_table[i].addr, reg);
+		if (reg == reg_table[i].val)
+			continue;
+
+		ret = i40e_aq_debug_write_register(hw, reg_table[i].addr,
+						reg_table[i].val, NULL);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to write 0x%"PRIx64" to

the "

lib/librte_pmd_i40e/i40e_ethdev.c +5 -0
+				"address of 0x%"PRIx32, reg_table[i].val,
+							reg_table[i].addr);
+			break;
+		}
+		PMD_DRV_LOG(DEBUG, "Write 0x%"PRIx64" to the address

of "

lib/librte_pmd_i40e/i40e_ethdev.c +3 -1
+			"0x%"PRIx32, reg_table[i].val, reg_table[i].addr);
+	}
+}
--
Quoted 1 line

1.8.1.4

#20 lore raw

Hi Thomas, Jingjing

I guess Jingjing intended to ack another patch, which is for XL710 performance enhancement. Thanks for the good catch!

Regards,
Helin

Quoted 16 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Friday, January 9, 2015 11:48 PM
To: Wu, Jingjing
Cc: [email protected]; Zhang, Helin; Rowden, Aaron F
Subject: Re: [dpdk-dev] [PATCH v3] i40e: workaround for X710 performance issues

2015-01-09 05:29, Wu, Jingjing:

Quoted 1 line

Jingjing, this patch is already applied in version 1.8.0:

	http://dpdk.org/ml/archives/dev/2014-December/010164.html

--
Thomas

#21 lore raw
In reply to Thomas Monjalon

Thanks, Thomas.

I supposed to review another patch for XL710 performance. Due to the similar patch subject, I reviewed this applied patch.

Quoted 16 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Friday, January 09, 2015 11:48 PM
To: Wu, Jingjing
Cc: [email protected]; Zhang, Helin; Rowden, Aaron F
Subject: Re: [dpdk-dev] [PATCH v3] i40e: workaround for X710 performance issues

2015-01-09 05:29, Wu, Jingjing:

Quoted 1 line

Jingjing, this patch is already applied in version 1.8.0:

	http://dpdk.org/ml/archives/dev/2014-December/010164.html

--
Thomas