Skip to contentSkip to conversation

net/ixgbe: fix flow ctrl mode setting

PATCH Superseded Sun GuinanX 4 participants 14 messages Dec 19, 2019 – May 9, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ixgbe: fix flow ctrl mode setting

When the port starts, the hw register is reset first,
and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the problem.

Fixes af75078fece3 ("first public release")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 20 ++++++++++++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
 2 files changed, 21 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +20 -0
index 2c6fd0f13..e602df02b 100644
@@ -2539,6 +2539,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw =
 		IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 	struct ixgbe_vf_info *vfinfo =
 		*IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
@@ -2555,6 +2556,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 		IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private);
 	struct ixgbe_macsec_setting *macsec_setting =
 		IXGBE_DEV_PRIVATE_TO_MACSEC_SETTING(dev->data->dev_private);
+	uint32_t mflcn;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -2665,6 +2667,20 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 	}
 
 	ixgbe_restore_statistics_mapping(dev);
+	err = ixgbe_fc_enable(hw);
+	if ((err == IXGBE_SUCCESS) || (err == IXGBE_ERR_FC_NOT_NEGOTIATED)) {
+
+		mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN);
+
+		/* set or clear MFLCN.PMCF bit depending on configuration */
+		if (adapter->mac_ctrl_frame_fwd != 0)
+			mflcn |= IXGBE_MFLCN_PMCF;
+		else
+			mflcn &= ~IXGBE_MFLCN_PMCF;
+
+		IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn);
+		IXGBE_WRITE_FLUSH(hw);
+	}
 
 	err = ixgbe_dev_rxtx_start(dev);
 	if (err < 0) {
@@ -2893,6 +2909,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 
 	adapter->rss_reta_updated = 0;
 
+	adapter->mac_ctrl_frame_fwd = 0;
+
 	hw->adapter_stopped = true;
 }
 
@@ -4646,6 +4664,7 @@ static int
 ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
 	struct ixgbe_hw *hw;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 	int err;
 	uint32_t rx_buf_size;
 	uint32_t max_high_water;
@@ -4682,6 +4701,7 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 	hw->fc.low_water[0]   = fc_conf->low_water;
 	hw->fc.send_xon       = fc_conf->send_xon;
 	hw->fc.disable_fc_autoneg = !fc_conf->autoneg;
+	adapter->mac_ctrl_frame_fwd = fc_conf->mac_ctrl_frame_fwd;
 
 	err = ixgbe_fc_enable(hw);
 
drivers/net/ixgbe/ixgbe_ethdev.h +1 -0
index 76a1b9d18..5af584f9e 100644
@@ -510,6 +510,7 @@ struct ixgbe_adapter {
 	 * mailbox status) link status.
 	 */
 	uint8_t pflink_fullchk;
+	uint8_t mac_ctrl_frame_fwd;
 };
 
 struct ixgbe_vf_representor {
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v2 1/1 net/ixgbe: fix flow ctrl mode setting

When the port starts, the hw register is reset first,
and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the problem.

Fixes af75078fece3 ("first public release")

---
v2: changes
* Modify the initial value of requested_mode and current_mode

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 24 ++++++++++++++++++++++--
 drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
 2 files changed, 23 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +22 -2
index 2c6fd0f13..573117e3a 100644
@@ -1170,8 +1170,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
 	memset(dcb_config, 0, sizeof(struct ixgbe_dcb_config));
 	ixgbe_dcb_init(hw, dcb_config);
 	/* Get Hardware Flow Control setting */
-	hw->fc.requested_mode = ixgbe_fc_full;
-	hw->fc.current_mode = ixgbe_fc_full;
+	hw->fc.requested_mode = ixgbe_fc_none;
+	hw->fc.current_mode = ixgbe_fc_none;
 	hw->fc.pause_time = IXGBE_FC_PAUSE;
 	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
 		hw->fc.low_water[i] = IXGBE_FC_LO;
@@ -2539,6 +2539,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw =
 		IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 	struct ixgbe_vf_info *vfinfo =
 		*IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
@@ -2555,6 +2556,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 		IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private);
 	struct ixgbe_macsec_setting *macsec_setting =
 		IXGBE_DEV_PRIVATE_TO_MACSEC_SETTING(dev->data->dev_private);
+	uint32_t mflcn;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -2665,6 +2667,20 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 	}
 
 	ixgbe_restore_statistics_mapping(dev);
+	err = ixgbe_fc_enable(hw);
+	if ((err == IXGBE_SUCCESS) || (err == IXGBE_ERR_FC_NOT_NEGOTIATED)) {
+
+		mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN);
+
+		/* set or clear MFLCN.PMCF bit depending on configuration */
+		if (adapter->mac_ctrl_frame_fwd != 0)
+			mflcn |= IXGBE_MFLCN_PMCF;
+		else
+			mflcn &= ~IXGBE_MFLCN_PMCF;
+
+		IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn);
+		IXGBE_WRITE_FLUSH(hw);
+	}
 
 	err = ixgbe_dev_rxtx_start(dev);
 	if (err < 0) {
@@ -2893,6 +2909,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 
 	adapter->rss_reta_updated = 0;
 
+	adapter->mac_ctrl_frame_fwd = 0;
+
 	hw->adapter_stopped = true;
 }
 
@@ -4646,6 +4664,7 @@ static int
 ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
 	struct ixgbe_hw *hw;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 	int err;
 	uint32_t rx_buf_size;
 	uint32_t max_high_water;
@@ -4682,6 +4701,7 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 	hw->fc.low_water[0]   = fc_conf->low_water;
 	hw->fc.send_xon       = fc_conf->send_xon;
 	hw->fc.disable_fc_autoneg = !fc_conf->autoneg;
+	adapter->mac_ctrl_frame_fwd = fc_conf->mac_ctrl_frame_fwd;
 
 	err = ixgbe_fc_enable(hw);
 
drivers/net/ixgbe/ixgbe_ethdev.h +1 -0
index 76a1b9d18..5af584f9e 100644
@@ -510,6 +510,7 @@ struct ixgbe_adapter {
 	 * mailbox status) link status.
 	 */
 	uint8_t pflink_fullchk;
+	uint8_t mac_ctrl_frame_fwd;
 };
 
 struct ixgbe_vf_representor {
Signature · 1 line
2.17.1
#2 lore raw

Hi, Guinan

Quoted 56 lines · Guinan Sun

When the port starts, the hw register is reset first,
and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the problem.

Fixes af75078fece3 ("first public release")

---
v2: changes
* Modify the initial value of requested_mode and current_mode
---
drivers/net/ixgbe/ixgbe_ethdev.c | 24 ++++++++++++++++++++++-- drivers/net/ixgbe/ixgbe_ethdev.h | 1 +

2 files changed, 23 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +8 -2
index 2c6fd0f13..573117e3a 100644
@@ -1170,8 +1170,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
 	memset(dcb_config, 0, sizeof(struct ixgbe_dcb_config));
 	ixgbe_dcb_init(hw, dcb_config);
 	/* Get Hardware Flow Control setting */
-	hw->fc.requested_mode = ixgbe_fc_full;
-	hw->fc.current_mode = ixgbe_fc_full;
+	hw->fc.requested_mode = ixgbe_fc_none;
+	hw->fc.current_mode = ixgbe_fc_none;
 	hw->fc.pause_time = IXGBE_FC_PAUSE;
 	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
 		hw->fc.low_water[i] = IXGBE_FC_LO;
@@ -2539,6 +2539,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw =
 		IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 	struct ixgbe_vf_info *vfinfo =
 		*IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
@@ -2555,6 +2556,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 		IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private);
 	struct ixgbe_macsec_setting *macsec_setting =
 		IXGBE_DEV_PRIVATE_TO_MACSEC_SETTING(dev->data->dev_private);
+	uint32_t mflcn;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -2665,6 +2667,20 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 	}
 
 	ixgbe_restore_statistics_mapping(dev);
+	err = ixgbe_fc_enable(hw);
+	if ((err == IXGBE_SUCCESS) || (err == IXGBE_ERR_FC_NOT_NEGOTIATED)) {
+
+		mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN);

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_dev_start(struct rte_eth_dev *dev) · line 2683

Quoted 10 lines
drivers/net/ixgbe/ixgbe_ethdev.c +10 -0
+
+		/* set or clear MFLCN.PMCF bit depending on configuration */
+		if (adapter->mac_ctrl_frame_fwd != 0)
+			mflcn |= IXGBE_MFLCN_PMCF;
+		else
+			mflcn &= ~IXGBE_MFLCN_PMCF;
+
+		IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn);
+		IXGBE_WRITE_FLUSH(hw);
+	}

It'd be better to wrap above lines of code into a function to avoid duplication.

Thanks,
Xiaolong

Quoted 43 lines
drivers/net/ixgbe/ixgbe_ethdev.c +4 -0
 	err = ixgbe_dev_rxtx_start(dev);
 	if (err < 0) {
@@ -2893,6 +2909,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 
 	adapter->rss_reta_updated = 0;
 
+	adapter->mac_ctrl_frame_fwd = 0;
+
 	hw->adapter_stopped = true;
 }
 
@@ -4646,6 +4664,7 @@ static int
 ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
 	struct ixgbe_hw *hw;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 	int err;
 	uint32_t rx_buf_size;
 	uint32_t max_high_water;
@@ -4682,6 +4701,7 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 	hw->fc.low_water[0]   = fc_conf->low_water;
 	hw->fc.send_xon       = fc_conf->send_xon;
 	hw->fc.disable_fc_autoneg = !fc_conf->autoneg;
+	adapter->mac_ctrl_frame_fwd = fc_conf->mac_ctrl_frame_fwd;
 
 	err = ixgbe_fc_enable(hw);
 
drivers/net/ixgbe/ixgbe_ethdev.h +1 -0
index 76a1b9d18..5af584f9e 100644
@@ -510,6 +510,7 @@ struct ixgbe_adapter {
 	 * mailbox status) link status.
 	 */
 	uint8_t pflink_fullchk;
+	uint8_t mac_ctrl_frame_fwd;
 };
 
 struct ixgbe_vf_representor {
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH v3 1/1 net/ixgbe: fix flow ctrl mode setting

In reply to Sun GuinanX

When the port starts, the hw register is reset first,
and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the problem.

Fixes af75078fece3 ("first public release")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 76 +++++++++++++++++++++-----------
 drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
 2 files changed, 51 insertions(+), 26 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +50 -26
index 2a248a3f2..b3d6e9494 100644
@@ -1173,8 +1173,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
 	memset(dcb_config, 0, sizeof(struct ixgbe_dcb_config));
 	ixgbe_dcb_init(hw, dcb_config);
 	/* Get Hardware Flow Control setting */
-	hw->fc.requested_mode = ixgbe_fc_full;
-	hw->fc.current_mode = ixgbe_fc_full;
+	hw->fc.requested_mode = ixgbe_fc_none;
+	hw->fc.current_mode = ixgbe_fc_none;
 	hw->fc.pause_time = IXGBE_FC_PAUSE;
 	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
 		hw->fc.low_water[i] = IXGBE_FC_LO;
@@ -2533,6 +2533,39 @@ ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
 	return 0;
 }
 
+static int
+ixgbe_flow_ctrl_enable(struct rte_eth_dev *dev, struct ixgbe_hw *hw)
+{
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
+	int err;
+	uint32_t mflcn;
+
+	err = ixgbe_fc_enable(hw);
+
+	/* Not negotiated is not an error case */
+	if (err == IXGBE_SUCCESS || err == IXGBE_ERR_FC_NOT_NEGOTIATED) {
+		/*
+		 *check if we want to forward MAC frames - driver doesn't
+		 *have native capability to do that,
+		 *so we'll write the registers ourselves
+		 */
+
+		mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN);
+
+		/* set or clear MFLCN.PMCF bit depending on configuration */
+		if (adapter->mac_ctrl_frame_fwd != 0)
+			mflcn |= IXGBE_MFLCN_PMCF;
+		else
+			mflcn &= ~IXGBE_MFLCN_PMCF;
+
+		IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn);
+		IXGBE_WRITE_FLUSH(hw);
+
+		return 0;
+	}
+	return err;
+}
+
 /*
  * Configure device link speed and setup link.
  * It returns 0 on success.
@@ -2659,6 +2692,12 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 
 	ixgbe_restore_statistics_mapping(dev);
 
+	err = ixgbe_flow_ctrl_enable(dev, hw);
+	if (err < 0) {
+		PMD_INIT_LOG(ERR, "enable flow ctrl err");
+		goto error;
+	}
+
 	err = ixgbe_dev_rxtx_start(dev);
 	if (err < 0) {
 		PMD_INIT_LOG(ERR, "Unable to start rxtx queues");
@@ -2895,6 +2934,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 
 	adapter->rss_reta_updated = 0;
 
+	adapter->mac_ctrl_frame_fwd = 0;
+
 	hw->adapter_stopped = true;
 }
 
@@ -4684,10 +4725,10 @@ static int
 ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
 	struct ixgbe_hw *hw;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 	int err;
 	uint32_t rx_buf_size;
 	uint32_t max_high_water;
-	uint32_t mflcn;
 	enum ixgbe_fc_mode rte_fcmode_2_ixgbe_fcmode[] = {
 		ixgbe_fc_none,
 		ixgbe_fc_rx_pause,
@@ -4720,31 +4761,14 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 	hw->fc.low_water[0]   = fc_conf->low_water;
 	hw->fc.send_xon       = fc_conf->send_xon;
 	hw->fc.disable_fc_autoneg = !fc_conf->autoneg;
+	adapter->mac_ctrl_frame_fwd = fc_conf->mac_ctrl_frame_fwd;
 
-	err = ixgbe_fc_enable(hw);
-
-	/* Not negotiated is not an error case */
-	if ((err == IXGBE_SUCCESS) || (err == IXGBE_ERR_FC_NOT_NEGOTIATED)) {
-
-		/* check if we want to forward MAC frames - driver doesn't have native
-		 * capability to do that, so we'll write the registers ourselves */
-
-		mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN);
-
-		/* set or clear MFLCN.PMCF bit depending on configuration */
-		if (fc_conf->mac_ctrl_frame_fwd != 0)
-			mflcn |= IXGBE_MFLCN_PMCF;
-		else
-			mflcn &= ~IXGBE_MFLCN_PMCF;
-
-		IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn);
-		IXGBE_WRITE_FLUSH(hw);
-
-		return 0;
+	err = ixgbe_flow_ctrl_enable(dev, hw);
+	if (err < 0) {
+		PMD_INIT_LOG(ERR, "ixgbe_flow_ctrl_enable = 0x%x", err);
+		return -EIO;
 	}
-
-	PMD_INIT_LOG(ERR, "ixgbe_fc_enable = 0x%x", err);
-	return -EIO;
+	return err;
 }
 
 /**
drivers/net/ixgbe/ixgbe_ethdev.h +1 -0
index e1cd8fd16..d309813da 100644
@@ -511,6 +511,7 @@ struct ixgbe_adapter {
 	 * mailbox status) link status.
 	 */
 	uint8_t pflink_fullchk;
+	uint8_t mac_ctrl_frame_fwd;
 };
 
 struct ixgbe_vf_representor {
Signature · 1 line
2.17.1
author
#4 lore raw

PATCH v4 1/1 net/ixgbe: fix flow ctrl mode setting

In reply to Sun GuinanX

When the port starts, the hw register is reset first,
and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the problem.

Fixes af75078fece3 ("first public release")

---
v4: changes
* rebase to dpdk-next-net-intel

v3: changes
* wrap duplication code into a function
* Modify checkpatch warnings

v2: changes
* Modify the initial value of requested_mode and current_mode

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 76 +++++++++++++++++++++-----------
 drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
 2 files changed, 51 insertions(+), 26 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +50 -26
index 3aab24e82..08b4cc689 100644
@@ -1176,8 +1176,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
 	memset(dcb_config, 0, sizeof(struct ixgbe_dcb_config));
 	ixgbe_dcb_init(hw, dcb_config);
 	/* Get Hardware Flow Control setting */
-	hw->fc.requested_mode = ixgbe_fc_full;
-	hw->fc.current_mode = ixgbe_fc_full;
+	hw->fc.requested_mode = ixgbe_fc_none;
+	hw->fc.current_mode = ixgbe_fc_none;
 	hw->fc.pause_time = IXGBE_FC_PAUSE;
 	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
 		hw->fc.low_water[i] = IXGBE_FC_LO;
@@ -2538,6 +2538,39 @@ ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
 	return 0;
 }
 
+static int
+ixgbe_flow_ctrl_enable(struct rte_eth_dev *dev, struct ixgbe_hw *hw)
+{
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
+	int err;
+	uint32_t mflcn;
+
+	err = ixgbe_fc_enable(hw);
+
+	/* Not negotiated is not an error case */
+	if (err == IXGBE_SUCCESS || err == IXGBE_ERR_FC_NOT_NEGOTIATED) {
+		/*
+		 *check if we want to forward MAC frames - driver doesn't
+		 *have native capability to do that,
+		 *so we'll write the registers ourselves
+		 */
+
+		mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN);
+
+		/* set or clear MFLCN.PMCF bit depending on configuration */
+		if (adapter->mac_ctrl_frame_fwd != 0)
+			mflcn |= IXGBE_MFLCN_PMCF;
+		else
+			mflcn &= ~IXGBE_MFLCN_PMCF;
+
+		IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn);
+		IXGBE_WRITE_FLUSH(hw);
+
+		return 0;
+	}
+	return err;
+}
+
 /*
  * Configure device link speed and setup link.
  * It returns 0 on success.
@@ -2664,6 +2697,12 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 
 	ixgbe_restore_statistics_mapping(dev);
 
+	err = ixgbe_flow_ctrl_enable(dev, hw);
+	if (err < 0) {
+		PMD_INIT_LOG(ERR, "enable flow ctrl err");
+		goto error;
+	}
+
 	err = ixgbe_dev_rxtx_start(dev);
 	if (err < 0) {
 		PMD_INIT_LOG(ERR, "Unable to start rxtx queues");
@@ -2900,6 +2939,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 
 	adapter->rss_reta_updated = 0;
 
+	adapter->mac_ctrl_frame_fwd = 0;
+
 	hw->adapter_stopped = true;
 }
 
@@ -4718,10 +4759,10 @@ static int
 ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
 	struct ixgbe_hw *hw;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 	int err;
 	uint32_t rx_buf_size;
 	uint32_t max_high_water;
-	uint32_t mflcn;
 	enum ixgbe_fc_mode rte_fcmode_2_ixgbe_fcmode[] = {
 		ixgbe_fc_none,
 		ixgbe_fc_rx_pause,
@@ -4754,31 +4795,14 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 	hw->fc.low_water[0]   = fc_conf->low_water;
 	hw->fc.send_xon       = fc_conf->send_xon;
 	hw->fc.disable_fc_autoneg = !fc_conf->autoneg;
+	adapter->mac_ctrl_frame_fwd = fc_conf->mac_ctrl_frame_fwd;
 
-	err = ixgbe_fc_enable(hw);
-
-	/* Not negotiated is not an error case */
-	if ((err == IXGBE_SUCCESS) || (err == IXGBE_ERR_FC_NOT_NEGOTIATED)) {
-
-		/* check if we want to forward MAC frames - driver doesn't have native
-		 * capability to do that, so we'll write the registers ourselves */
-
-		mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN);
-
-		/* set or clear MFLCN.PMCF bit depending on configuration */
-		if (fc_conf->mac_ctrl_frame_fwd != 0)
-			mflcn |= IXGBE_MFLCN_PMCF;
-		else
-			mflcn &= ~IXGBE_MFLCN_PMCF;
-
-		IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn);
-		IXGBE_WRITE_FLUSH(hw);
-
-		return 0;
+	err = ixgbe_flow_ctrl_enable(dev, hw);
+	if (err < 0) {
+		PMD_INIT_LOG(ERR, "ixgbe_flow_ctrl_enable = 0x%x", err);
+		return -EIO;
 	}
-
-	PMD_INIT_LOG(ERR, "ixgbe_fc_enable = 0x%x", err);
-	return -EIO;
+	return err;
 }
 
 /**
drivers/net/ixgbe/ixgbe_ethdev.h +1 -0
index 5089347a7..b8df75657 100644
@@ -511,6 +511,7 @@ struct ixgbe_adapter {
 	 * mailbox status) link status.
 	 */
 	uint8_t pflink_fullchk;
+	uint8_t mac_ctrl_frame_fwd;
 	rte_atomic32_t link_thread_running;
 	pthread_t link_thread_tid;
 };
Signature · 1 line
2.17.1
Tested-by on v4 1/1
#5 lore raw

Patch fixes reported issue.

Regards
Tomasz Konieczny
---------------------------------------------------------------------
Intel Corporation (UK) Ltd.
Co. Reg. #1134945
Pipers Way, Swindon SN3 1RJ

Quoted 177 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Guinan Sun
Sent: 18 February 2020 04:40
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Sun, GuinanX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

When the port starts, the hw register is reset first, and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the problem.

Fixes af75078fece3 ("first public release")

---
v4: changes
* rebase to dpdk-next-net-intel

v3: changes
* wrap duplication code into a function
* Modify checkpatch warnings

v2: changes
* Modify the initial value of requested_mode and current_mode
---
drivers/net/ixgbe/ixgbe_ethdev.c | 76 +++++++++++++++++++++----------- drivers/net/ixgbe/ixgbe_ethdev.h | 1 +

2 files changed, 51 insertions(+), 26 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index 3aab24e82..08b4cc689 100644
@@ -1176,8 +1176,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void
 *init_params __rte_unused)
 	memset(dcb_config, 0, sizeof(struct ixgbe_dcb_config));
 	ixgbe_dcb_init(hw, dcb_config);
 	/* Get Hardware Flow Control setting */
-	hw->fc.requested_mode = ixgbe_fc_full;
-	hw->fc.current_mode = ixgbe_fc_full;
+	hw->fc.requested_mode = ixgbe_fc_none;
+	hw->fc.current_mode = ixgbe_fc_none;
 	hw->fc.pause_time = IXGBE_FC_PAUSE;
 	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
		hw->fc.low_water[i] = IXGBE_FC_LO;
drivers/net/ixgbe/ixgbe_ethdev.c +39 -0
@@ -2538,6 +2538,39 @@ ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev,
 uint16_t vf,
 	return 0;
 }
 
+static int
+ixgbe_flow_ctrl_enable(struct rte_eth_dev *dev, struct ixgbe_hw *hw) {
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
+	int err;
+	uint32_t mflcn;
+
+	err = ixgbe_fc_enable(hw);
+
+	/* Not negotiated is not an error case */
+	if (err == IXGBE_SUCCESS || err == IXGBE_ERR_FC_NOT_NEGOTIATED) {
+		/*
+		 *check if we want to forward MAC frames - driver doesn't
+		 *have native capability to do that,
+		 *so we'll write the registers ourselves
+		 */
+
+		mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN);
+
+		/* set or clear MFLCN.PMCF bit depending on configuration */
+		if (adapter->mac_ctrl_frame_fwd != 0)
+			mflcn |= IXGBE_MFLCN_PMCF;
+		else
+			mflcn &= ~IXGBE_MFLCN_PMCF;
+
+		IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn);
+		IXGBE_WRITE_FLUSH(hw);
+
+		return 0;
+	}
+	return err;
+}
+
 /*
 * Configure device link speed and setup link.
 * It returns 0 on success.
@@ -2664,6 +2697,12 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 
 	ixgbe_restore_statistics_mapping(dev);
 
+	err = ixgbe_flow_ctrl_enable(dev, hw);
+	if (err < 0) {
+		PMD_INIT_LOG(ERR, "enable flow ctrl err");
+		goto error;
+	}
+
 	err = ixgbe_dev_rxtx_start(dev);
 	if (err < 0) {
 		PMD_INIT_LOG(ERR, "Unable to start rxtx queues"); @@ -2900,6
+2939,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
	adapter->rss_reta_updated = 0;
drivers/net/ixgbe/ixgbe_ethdev.c +2 -0
+	adapter->mac_ctrl_frame_fwd = 0;
+
	hw->adapter_stopped = true;
}
drivers/net/ixgbe/ixgbe_ethdev.c +2 -7
@@ -4718,10 +4759,10 @@ static int
 ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)  {
 	struct ixgbe_hw *hw;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 	int err;
 	uint32_t rx_buf_size;
 	uint32_t max_high_water;
-	uint32_t mflcn;
 	enum ixgbe_fc_mode rte_fcmode_2_ixgbe_fcmode[] = {
 		ixgbe_fc_none,
 		ixgbe_fc_rx_pause,
@@ -4754,31 +4795,14 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct
 rte_eth_fc_conf *fc_conf)
 	hw->fc.low_water[0]   = fc_conf->low_water;
 	hw->fc.send_xon       = fc_conf->send_xon;
 	hw->fc.disable_fc_autoneg = !fc_conf->autoneg;
+	adapter->mac_ctrl_frame_fwd = fc_conf->mac_ctrl_frame_fwd;
 
-	err = ixgbe_fc_enable(hw);
-
-	/* Not negotiated is not an error case */
-	if ((err == IXGBE_SUCCESS) || (err ==
 IXGBE_ERR_FC_NOT_NEGOTIATED)) {
-
-		/* check if we want to forward MAC frames - driver doesn't have

native

drivers/net/ixgbe/ixgbe_ethdev.c +4 -14
-		 * capability to do that, so we'll write the registers ourselves */
-
-		mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN);
-
-		/* set or clear MFLCN.PMCF bit depending on configuration */
-		if (fc_conf->mac_ctrl_frame_fwd != 0)
-			mflcn |= IXGBE_MFLCN_PMCF;
-		else
-			mflcn &= ~IXGBE_MFLCN_PMCF;
-
-		IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn);
-		IXGBE_WRITE_FLUSH(hw);
-
-		return 0;
+	err = ixgbe_flow_ctrl_enable(dev, hw);
+	if (err < 0) {
+		PMD_INIT_LOG(ERR, "ixgbe_flow_ctrl_enable = 0x%x", err);
+		return -EIO;
	}
drivers/net/ixgbe/ixgbe_ethdev.c +1 -3
-
-	PMD_INIT_LOG(ERR, "ixgbe_fc_enable = 0x%x", err);
-	return -EIO;
+	return err;

}

/**

drivers/net/ixgbe/ixgbe_ethdev.h +1 -1
index 5089347a7..b8df75657 100644
@@ -511,6 +511,7 @@ struct ixgbe_adapter {
 	 * mailbox status) link status.
 	 */
 	uint8_t pflink_fullchk;
+	uint8_t mac_ctrl_frame_fwd;
 	rte_atomic32_t link_thread_running;
 	pthread_t link_thread_tid;
 };
--

2.17.1

Reviewed-by on v4 1/1 Applied
#6 lore raw
In reply to Guinan Sun
Quoted 166 lines · Guinan Sun

When the port starts, the hw register is reset first,
and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the problem.

Fixes af75078fece3 ("first public release")

---
v4: changes
* rebase to dpdk-next-net-intel

v3: changes
* wrap duplication code into a function
* Modify checkpatch warnings

v2: changes
* Modify the initial value of requested_mode and current_mode
---
drivers/net/ixgbe/ixgbe_ethdev.c | 76 +++++++++++++++++++++----------- drivers/net/ixgbe/ixgbe_ethdev.h | 1 +

2 files changed, 51 insertions(+), 26 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +50 -26
index 3aab24e82..08b4cc689 100644
@@ -1176,8 +1176,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
 	memset(dcb_config, 0, sizeof(struct ixgbe_dcb_config));
 	ixgbe_dcb_init(hw, dcb_config);
 	/* Get Hardware Flow Control setting */
-	hw->fc.requested_mode = ixgbe_fc_full;
-	hw->fc.current_mode = ixgbe_fc_full;
+	hw->fc.requested_mode = ixgbe_fc_none;
+	hw->fc.current_mode = ixgbe_fc_none;
 	hw->fc.pause_time = IXGBE_FC_PAUSE;
 	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
 		hw->fc.low_water[i] = IXGBE_FC_LO;
@@ -2538,6 +2538,39 @@ ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
 	return 0;
 }
 
+static int
+ixgbe_flow_ctrl_enable(struct rte_eth_dev *dev, struct ixgbe_hw *hw)
+{
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
+	int err;
+	uint32_t mflcn;
+
+	err = ixgbe_fc_enable(hw);
+
+	/* Not negotiated is not an error case */
+	if (err == IXGBE_SUCCESS || err == IXGBE_ERR_FC_NOT_NEGOTIATED) {
+		/*
+		 *check if we want to forward MAC frames - driver doesn't
+		 *have native capability to do that,
+		 *so we'll write the registers ourselves
+		 */
+
+		mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN);
+
+		/* set or clear MFLCN.PMCF bit depending on configuration */
+		if (adapter->mac_ctrl_frame_fwd != 0)
+			mflcn |= IXGBE_MFLCN_PMCF;
+		else
+			mflcn &= ~IXGBE_MFLCN_PMCF;
+
+		IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn);
+		IXGBE_WRITE_FLUSH(hw);
+
+		return 0;
+	}
+	return err;
+}
+
 /*
 * Configure device link speed and setup link.
 * It returns 0 on success.
@@ -2664,6 +2697,12 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 
 	ixgbe_restore_statistics_mapping(dev);
 
+	err = ixgbe_flow_ctrl_enable(dev, hw);
+	if (err < 0) {
+		PMD_INIT_LOG(ERR, "enable flow ctrl err");
+		goto error;
+	}
+
 	err = ixgbe_dev_rxtx_start(dev);
 	if (err < 0) {
 		PMD_INIT_LOG(ERR, "Unable to start rxtx queues");
@@ -2900,6 +2939,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 
 	adapter->rss_reta_updated = 0;
 
+	adapter->mac_ctrl_frame_fwd = 0;
+
 	hw->adapter_stopped = true;
 }
 
@@ -4718,10 +4759,10 @@ static int
 ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
 	struct ixgbe_hw *hw;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 	int err;
 	uint32_t rx_buf_size;
 	uint32_t max_high_water;
-	uint32_t mflcn;
 	enum ixgbe_fc_mode rte_fcmode_2_ixgbe_fcmode[] = {
 		ixgbe_fc_none,
 		ixgbe_fc_rx_pause,
@@ -4754,31 +4795,14 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 	hw->fc.low_water[0]   = fc_conf->low_water;
 	hw->fc.send_xon       = fc_conf->send_xon;
 	hw->fc.disable_fc_autoneg = !fc_conf->autoneg;
+	adapter->mac_ctrl_frame_fwd = fc_conf->mac_ctrl_frame_fwd;
 
-	err = ixgbe_fc_enable(hw);
-
-	/* Not negotiated is not an error case */
-	if ((err == IXGBE_SUCCESS) || (err == IXGBE_ERR_FC_NOT_NEGOTIATED)) {
-
-		/* check if we want to forward MAC frames - driver doesn't have native
-		 * capability to do that, so we'll write the registers ourselves */
-
-		mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN);
-
-		/* set or clear MFLCN.PMCF bit depending on configuration */
-		if (fc_conf->mac_ctrl_frame_fwd != 0)
-			mflcn |= IXGBE_MFLCN_PMCF;
-		else
-			mflcn &= ~IXGBE_MFLCN_PMCF;
-
-		IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn);
-		IXGBE_WRITE_FLUSH(hw);
-
-		return 0;
+	err = ixgbe_flow_ctrl_enable(dev, hw);
+	if (err < 0) {
+		PMD_INIT_LOG(ERR, "ixgbe_flow_ctrl_enable = 0x%x", err);
+		return -EIO;
 	}
-
-	PMD_INIT_LOG(ERR, "ixgbe_fc_enable = 0x%x", err);
-	return -EIO;
+	return err;
 }
 
 /**
drivers/net/ixgbe/ixgbe_ethdev.h +1 -0
index 5089347a7..b8df75657 100644
@@ -511,6 +511,7 @@ struct ixgbe_adapter {
 	 * mailbox status) link status.
 	 */
 	uint8_t pflink_fullchk;
+	uint8_t mac_ctrl_frame_fwd;
 	rte_atomic32_t link_thread_running;
 	pthread_t link_thread_tid;
 };
Signature · 1 line
2.17.1

Applied to dpdk-next-net-intel, Thanks.

#7 lore raw
Quoted 17 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Ye Xiaolong
Sent: 19 February 2020 08:06
To: Sun, GuinanX <[email protected]>
Cc: [email protected]; Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

Quoted 8 lines · Guinan Sun

When the port starts, the hw register is reset first, and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the problem.

Fixes af75078fece3 ("first public release")
Quoted 6 lines
Quoted 2 lines

Applied to dpdk-next-net-intel, Thanks.

This should be backported to 19.11 and 18.11

Regards
Tomasz Konieczny
---------------------------------------------------------------------
Intel Corporation (UK) Ltd.
Co. Reg. #1134945
Pipers Way, Swindon SN3 1RJ

#8 lore raw
Quoted 17 lines · TomaszX
Quoted 17 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Ye Xiaolong
Sent: 19 February 2020 08:06
To: Sun, GuinanX <[email protected]>
Cc: [email protected]; Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

Quoted 8 lines · Guinan Sun

When the port starts, the hw register is reset first, and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the problem.

Fixes af75078fece3 ("first public release")
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Applied to dpdk-next-net-intel, Thanks.

This should be backported to 19.11 and 18.11

Sure, this patch has added "Cc: [email protected]", so the LTS maintainer would backport them to 19.11 and 18.11.

Thanks,
Xiaolong

Quoted 8 lines

Regards
Tomasz Konieczny
---------------------------------------------------------------------
Intel Corporation (UK) Ltd.
Co. Reg. #1134945
Pipers Way, Swindon SN3 1RJ

#9 lore raw
In reply to Guinan Sun

Hi, guinan

In this patch, you have add a new parameter of mac_ctrl_frame_fwd, it should not be clear in ixgbe_dev_stop(),
Or it will be over write when do port reset, and also you should add mac_ctrl_frame_fwd in ixgbe_flow_ctrl_get() for FC info get. Although this patch has been merged, please commit fix patch for it, thanks!

Quoted 38 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Guinan Sun
Sent: Tuesday, February 18, 2020 11:40 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Sun, GuinanX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

When the port starts, the hw register is reset first, and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the problem.

Fixes af75078fece3 ("first public release")

---
v4: changes
* rebase to dpdk-next-net-intel

v3: changes
* wrap duplication code into a function
* Modify checkpatch warnings

v2: changes
* Modify the initial value of requested_mode and current_mode

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 76 +++++++++++++++++++++-----------
drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
 2 files changed, 51 insertions(+), 26 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
index 3aab24e82..08b4cc689 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+	}

drivers/net/ixgbe/ixgbe_ethdev.c

Quoted 10 lines
drivers/net/ixgbe/ixgbe_ethdev.c +4 -0
+
 	err = ixgbe_dev_rxtx_start(dev);
 	if (err < 0) {
 		PMD_INIT_LOG(ERR, "Unable to start rxtx queues"); @@ -2900,6
+2939,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 
 	adapter->rss_reta_updated = 0;
 
+	adapter->mac_ctrl_frame_fwd = 0;
+

Delete it please.

#10 lore raw

Hi ,zhaowei

Quoted 9 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Saturday, May 9, 2020 3:35 PM
To: Sun, GuinanX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Sun, GuinanX <[email protected]>; [email protected]; Guo, Jia <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

Quoted 8 lines

Hi, guinan

In this patch, you have add a new parameter of mac_ctrl_frame_fwd, it should
not be clear in ixgbe_dev_stop(), Or it will be over write when do port reset, and also you should add mac_ctrl_frame_fwd in ixgbe_flow_ctrl_get() for FC info get.
Although this patch has been merged, please commit fix patch for it, thanks!

For this question, I need to confirm the requirements with Konieczny TomaszX before I can decide whether to make changes.

Quoted 58 lines
Quoted 41 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Guinan Sun
Sent: Tuesday, February 18, 2020 11:40 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Sun, GuinanX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

When the port starts, the hw register is reset first, and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the problem.

Fixes af75078fece3 ("first public release")

---
v4: changes
* rebase to dpdk-next-net-intel

v3: changes
* wrap duplication code into a function
* Modify checkpatch warnings

v2: changes
* Modify the initial value of requested_mode and current_mode

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 76

+++++++++++++++++++++----------- drivers/net/ixgbe/ixgbe_ethdev.h | 1

(quoted diff) +1 -0
+
 2 files changed, 51 insertions(+), 26 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
index 3aab24e82..08b4cc689 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+}

drivers/net/ixgbe/ixgbe_ethdev.c

Quoted 10 lines
drivers/net/ixgbe/ixgbe_ethdev.c +4 -0
+
 err = ixgbe_dev_rxtx_start(dev);
 if (err < 0) {
 PMD_INIT_LOG(ERR, "Unable to start rxtx queues"); @@ -2900,6
+2939,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 
 adapter->rss_reta_updated = 0;
 
+adapter->mac_ctrl_frame_fwd = 0;
+

Delete it please.

#11 lore raw

Hi,guinan

More info for this problem:
If some user set mac_ctrl_frame_fwd to 1 from fc ops, then he do a port reset process of "
1. testpmd> start
2. testpmd> set flow_ctrl mac_ctrl_frame_fwd on 0
3. testpmd> stop
4. testpmd> port stop 0
5. testpmd> port start 0
6. testpmd> start
"
Then after this process, the mac_ctrl_frame_fwd has been change to "off", so we should delete " adapter->mac_ctrl_frame_fwd = 0;" from dev-stop.

Another problem is "add mac_ctrl_frame_fwd in ixgbe_flow_ctrl_get() for FC info get", it is Independent on the above one.

Quoted 95 lines

-----Original Message-----
From: Sun, GuinanX <[email protected]>
Sent: Saturday, May 9, 2020 4:55 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]; Guo, Jia <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

Hi ,zhaowei

Quoted 11 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Saturday, May 9, 2020 3:35 PM
To: Sun, GuinanX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Sun, GuinanX <[email protected]>; [email protected]; Guo, Jia <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

Quoted 8 lines

Hi, guinan

In this patch, you have add a new parameter of mac_ctrl_frame_fwd, it
should not be clear in ixgbe_dev_stop(), Or it will be over write when do port reset, and also you should add mac_ctrl_frame_fwd in ixgbe_flow_ctrl_get() for FC info get.
Although this patch has been merged, please commit fix patch for it, thanks!

For this question, I need to confirm the requirements with Konieczny TomaszX before I can decide whether to make changes.

Quoted 11 lines
Quoted 11 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Guinan Sun
Sent: Tuesday, February 18, 2020 11:40 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Sun, GuinanX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

Quoted 4 lines
Quoted 4 lines

When the port starts, the hw register is reset first, and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the

problem.

Quoted 44 lines
Quoted 27 lines
Fixes af75078fece3 ("first public release")

---
v4: changes
* rebase to dpdk-next-net-intel

v3: changes
* wrap duplication code into a function
* Modify checkpatch warnings

v2: changes
* Modify the initial value of requested_mode and current_mode

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 76

+++++++++++++++++++++----------- drivers/net/ixgbe/ixgbe_ethdev.h | +++++++++++++++++++++1

(quoted diff) +1 -0
+
 2 files changed, 51 insertions(+), 26 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
index 3aab24e82..08b4cc689 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+}

drivers/net/ixgbe/ixgbe_ethdev.c

Quoted 10 lines
drivers/net/ixgbe/ixgbe_ethdev.c +4 -0
+
 err = ixgbe_dev_rxtx_start(dev);
 if (err < 0) {
 PMD_INIT_LOG(ERR, "Unable to start rxtx queues"); @@ -2900,6
+2939,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 
 adapter->rss_reta_updated = 0;
 
+adapter->mac_ctrl_frame_fwd = 0;
+

Delete it please.

#12 lore raw

Hi, zhaowei

Quoted 11 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Saturday, May 9, 2020 5:30 PM
To: Sun, GuinanX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]; Guo, Jia <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

Hi,guinan

Quoted 9 lines

More info for this problem:
If some user set mac_ctrl_frame_fwd to 1 from fc ops, then he do a port reset process of "
1. testpmd> start
2. testpmd> set flow_ctrl mac_ctrl_frame_fwd on 0 3. testpmd> stop 4. testpmd> port stop 0 5. testpmd> port start 0 6. testpmd> start "
Then after this process, the mac_ctrl_frame_fwd has been change to "off", so we should delete " adapter->mac_ctrl_frame_fwd = 0;" from dev-stop.

Thank you very much , I get it.

Quoted 104 lines

Another problem is "add mac_ctrl_frame_fwd in ixgbe_flow_ctrl_get() for FC info get", it is Independent on the above one.

Quoted 99 lines

-----Original Message-----
From: Sun, GuinanX <[email protected]>
Sent: Saturday, May 9, 2020 4:55 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]; Guo, Jia <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

Hi ,zhaowei

Quoted 11 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Saturday, May 9, 2020 3:35 PM
To: Sun, GuinanX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Sun, GuinanX <[email protected]>; [email protected]; Guo, Jia <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

Quoted 8 lines

Hi, guinan

In this patch, you have add a new parameter of mac_ctrl_frame_fwd,
it should not be clear in ixgbe_dev_stop(), Or it will be over write when do port reset, and also you should add mac_ctrl_frame_fwd in ixgbe_flow_ctrl_get() for FC info get.
Although this patch has been merged, please commit fix patch for it, thanks!

For this question, I need to confirm the requirements with Konieczny TomaszX before I can decide whether to make changes.

Quoted 12 lines
Quoted 12 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Guinan Sun
Sent: Tuesday, February 18, 2020 11:40 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Sun, GuinanX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

Quoted 5 lines
Quoted 5 lines

When the port starts, the hw register is reset first, and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the

problem.

Quoted 45 lines
Quoted 28 lines
Fixes af75078fece3 ("first public release")

---
v4: changes
* rebase to dpdk-next-net-intel

v3: changes
* wrap duplication code into a function
* Modify checkpatch warnings

v2: changes
* Modify the initial value of requested_mode and current_mode

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 76

+++++++++++++++++++++----------- drivers/net/ixgbe/ixgbe_ethdev.h +++++++++++++++++++++|
+++++++++++++++++++++1

(quoted diff) +1 -0
+
 2 files changed, 51 insertions(+), 26 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
index 3aab24e82..08b4cc689 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+}

drivers/net/ixgbe/ixgbe_ethdev.c

Quoted 10 lines
drivers/net/ixgbe/ixgbe_ethdev.c +4 -0
+
 err = ixgbe_dev_rxtx_start(dev);
 if (err < 0) {
 PMD_INIT_LOG(ERR, "Unable to start rxtx queues"); @@ -2900,6
+2939,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 
 adapter->rss_reta_updated = 0;
 
+adapter->mac_ctrl_frame_fwd = 0;
+

Delete it please.

#13 lore raw
In reply to Sun, GuinanX

Hi,guinan

More info for this problem:
If some user set mac_ctrl_frame_fwd to 1 from fc ops, then he do a port reset process of

"
1. testpmd> start
2. testpmd> set flow_ctrl mac_ctrl_frame_fwd on 0
3. testpmd> stop
4. testpmd> port stop 0
5. testpmd> port start 0
6. testpmd> start
"

Then after this process, the mac_ctrl_frame_fwd has been change to "off", so we should delete " adapter->mac_ctrl_frame_fwd = 0;" from dev-stop. Another problem is "add mac_ctrl_frame_fwd in ixgbe_flow_ctrl_get() for FC info get", it is Independent on the above one.

Quoted 95 lines

-----Original Message-----
From: Sun, GuinanX <[email protected]>
Sent: Saturday, May 9, 2020 4:55 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]; Guo, Jia <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

Hi ,zhaowei

Quoted 11 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Saturday, May 9, 2020 3:35 PM
To: Sun, GuinanX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Sun, GuinanX <[email protected]>; [email protected]; Guo, Jia <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

Quoted 8 lines

Hi, guinan

In this patch, you have add a new parameter of mac_ctrl_frame_fwd, it
should not be clear in ixgbe_dev_stop(), Or it will be over write when do port reset, and also you should add mac_ctrl_frame_fwd in ixgbe_flow_ctrl_get() for FC info get.
Although this patch has been merged, please commit fix patch for it, thanks!

For this question, I need to confirm the requirements with Konieczny TomaszX before I can decide whether to make changes.

Quoted 11 lines
Quoted 11 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Guinan Sun
Sent: Tuesday, February 18, 2020 11:40 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Sun, GuinanX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4] net/ixgbe: fix flow ctrl mode setting

Quoted 4 lines
Quoted 4 lines

When the port starts, the hw register is reset first, and then the required parameters are set again.
If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the

problem.

Quoted 44 lines
Quoted 27 lines
Fixes af75078fece3 ("first public release")

---
v4: changes
* rebase to dpdk-next-net-intel

v3: changes
* wrap duplication code into a function
* Modify checkpatch warnings

v2: changes
* Modify the initial value of requested_mode and current_mode

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 76

+++++++++++++++++++++----------- drivers/net/ixgbe/ixgbe_ethdev.h | +++++++++++++++++++++1

(quoted diff) +1 -0
+
 2 files changed, 51 insertions(+), 26 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
index 3aab24e82..08b4cc689 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+}

drivers/net/ixgbe/ixgbe_ethdev.c

Quoted 10 lines
drivers/net/ixgbe/ixgbe_ethdev.c +4 -0
+
 err = ixgbe_dev_rxtx_start(dev);
 if (err < 0) {
 PMD_INIT_LOG(ERR, "Unable to start rxtx queues"); @@ -2900,6
+2939,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 
 adapter->rss_reta_updated = 0;
 
+adapter->mac_ctrl_frame_fwd = 0;
+

Delete it please.