Skip to contentSkip to conversation

net/i40e: fix DCB init issue

PATCH Superseded Shougang Wang 3 participants 4 messages Mar 5, 2020 – Mar 6, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/i40e: fix DCB init issue

Stopping lldp is necessary for DPDK, but it will cause DCB init failed. For kernel shared code, the prerequisite for successful initialization of DCB is that LLDP is enabled. This patch starts lldp before DCB init and stops it when finish init.

Fixes a8e84b22bd55 ("net/i40e/base: support persistent LLDP")
---
 drivers/net/i40e/i40e_ethdev.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/i40e/i40e_ethdev.c +9 -5
index 9fbda1c34..9f37662f8 100644
@@ -11669,11 +11669,9 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 	 * LLDP MIB change event.
 	 */
 	if (sw_dcb == TRUE) {
-		if (i40e_need_stop_lldp(dev)) {
-			ret = i40e_aq_stop_lldp(hw, TRUE, TRUE, NULL);
-			if (ret != I40E_SUCCESS)
-				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
-		}
+		ret = i40e_aq_start_lldp(hw, true, NULL);
+		if (ret != I40E_SUCCESS)
+			PMD_INIT_LOG(DEBUG, "Failed to start lldp");
 
 		ret = i40e_init_dcb(hw, true);
 		/* If lldp agent is stopped, the return value from
@@ -11718,6 +11716,12 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 				ret, hw->aq.asq_last_status);
 			return -ENOTSUP;
 		}
+
+		if (i40e_need_stop_lldp(dev)) {
+			ret = i40e_aq_stop_lldp(hw, true, true, NULL);
+			if (ret != I40E_SUCCESS)
+				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
+		}
 	} else {
 		ret = i40e_aq_start_lldp(hw, true, NULL);
 		if (ret != I40E_SUCCESS)
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 29 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Shougang Wang
Sent: Thursday, March 5, 2020 4:41 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] net/i40e: fix DCB init issue

Stopping lldp is necessary for DPDK, but it will cause DCB init failed. For kernel shared code, the prerequisite for successful initialization of DCB is that LLDP is enabled. This patch starts lldp before DCB init and stops it when finish init.

Fixes a8e84b22bd55 ("net/i40e/base: support persistent LLDP")
---
 drivers/net/i40e/i40e_ethdev.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/i40e/i40e_ethdev.c +0 -0
index 9fbda1c34..9f37662f8 100644

drivers/net/i40e/i40e_ethdev.c i40e_dcb_init_configure(struct rte_eth_dev *dev, · line 11677

Quoted 9 lines
drivers/net/i40e/i40e_ethdev.c +0 -5
@@ -11669,11 +11669,9 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev,
 bool sw_dcb)
 	 * LLDP MIB change event.
 	 */
 	if (sw_dcb == TRUE) {
-		if (i40e_need_stop_lldp(dev)) {
-			ret = i40e_aq_stop_lldp(hw, TRUE, TRUE, NULL);
-			if (ret != I40E_SUCCESS)
-				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
-		}

It's better to add some comment here, so easy for other people to understand the purpose. Otherwise

Quoted 22 lines
drivers/net/i40e/i40e_ethdev.c +3 -0
+		ret = i40e_aq_start_lldp(hw, true, NULL);
+		if (ret != I40E_SUCCESS)
+			PMD_INIT_LOG(DEBUG, "Failed to start lldp");
 
 
drivers/net/i40e/i40e_ethdev.c +7 -1
 		ret = i40e_init_dcb(hw, true);
 		/* If lldp agent is stopped, the return value from @@ -11718,6
+11716,12 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 				ret, hw->aq.asq_last_status);
 			return -ENOTSUP;
 		}
+
+		if (i40e_need_stop_lldp(dev)) {
+			ret = i40e_aq_stop_lldp(hw, true, true, NULL);
+			if (ret != I40E_SUCCESS)
+				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
+		}
 	} else {
 		ret = i40e_aq_start_lldp(hw, true, NULL);
 		if (ret != I40E_SUCCESS)
--

2.17.1

#2 lore raw

PATCH v2 1/1 net/i40e: fix DCB init issue

In reply to Shougang Wang

Stopping lldp is necessary for DPDK, but it will cause DCB init failed. For kernel shared code, the prerequisite for successful initialization of DCB is that LLDP is enabled. This patch starts lldp before DCB init and stops it when finish init.

Fixes a8e84b22bd55 ("net/i40e/base: support persistent LLDP")
---
 drivers/net/i40e/i40e_ethdev.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/net/i40e/i40e_ethdev.c +15 -5
index 9fbda1c34..9459b520c 100644
@@ -11669,11 +11669,15 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 	 * LLDP MIB change event.
 	 */
 	if (sw_dcb == TRUE) {
-		if (i40e_need_stop_lldp(dev)) {
-			ret = i40e_aq_stop_lldp(hw, TRUE, TRUE, NULL);
-			if (ret != I40E_SUCCESS)
-				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
-		}
+		/* Stopping lldp is necessary for DPDK, but it will cause
+		 * DCB init failed. For i40e_init_dcb(), the prerequisite
+		 * for successful initialization of DCB is that LLDP is
+		 * enabled. So it is needed to start lldp before DCB init
+		 * and stop it after initialization.
+		 */
+		ret = i40e_aq_start_lldp(hw, true, NULL);
+		if (ret != I40E_SUCCESS)
+			PMD_INIT_LOG(DEBUG, "Failed to start lldp");
 
 		ret = i40e_init_dcb(hw, true);
 		/* If lldp agent is stopped, the return value from
@@ -11718,6 +11722,12 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 				ret, hw->aq.asq_last_status);
 			return -ENOTSUP;
 		}
+
+		if (i40e_need_stop_lldp(dev)) {
+			ret = i40e_aq_stop_lldp(hw, true, true, NULL);
+			if (ret != I40E_SUCCESS)
+				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
+		}
 	} else {
 		ret = i40e_aq_start_lldp(hw, true, NULL);
 		if (ret != I40E_SUCCESS)
Signature · 1 line
2.17.1
Acked-by on v2 1/1 Applied
#3 lore raw
Quoted 55 lines · Shougang Wang

Stopping lldp is necessary for DPDK, but it will cause DCB init failed. For kernel shared code, the prerequisite for successful initialization of DCB is that LLDP is enabled. This patch starts lldp before DCB init and stops it when finish init.

Fixes a8e84b22bd55 ("net/i40e/base: support persistent LLDP")

---
drivers/net/i40e/i40e_ethdev.c | 20 +++++++++++++++-----

1 file changed, 15 insertions(+), 5 deletions(-)
drivers/net/i40e/i40e_ethdev.c +15 -5
index 9fbda1c34..9459b520c 100644
@@ -11669,11 +11669,15 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 	 * LLDP MIB change event.
 	 */
 	if (sw_dcb == TRUE) {
-		if (i40e_need_stop_lldp(dev)) {
-			ret = i40e_aq_stop_lldp(hw, TRUE, TRUE, NULL);
-			if (ret != I40E_SUCCESS)
-				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
-		}
+		/* Stopping lldp is necessary for DPDK, but it will cause
+		 * DCB init failed. For i40e_init_dcb(), the prerequisite
+		 * for successful initialization of DCB is that LLDP is
+		 * enabled. So it is needed to start lldp before DCB init
+		 * and stop it after initialization.
+		 */
+		ret = i40e_aq_start_lldp(hw, true, NULL);
+		if (ret != I40E_SUCCESS)
+			PMD_INIT_LOG(DEBUG, "Failed to start lldp");
 
 		ret = i40e_init_dcb(hw, true);
 		/* If lldp agent is stopped, the return value from
@@ -11718,6 +11722,12 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 				ret, hw->aq.asq_last_status);
 			return -ENOTSUP;
 		}
+
+		if (i40e_need_stop_lldp(dev)) {
+			ret = i40e_aq_stop_lldp(hw, true, true, NULL);
+			if (ret != I40E_SUCCESS)
+				PMD_INIT_LOG(DEBUG, "Failed to stop lldp");
+		}
 	} else {
 		ret = i40e_aq_start_lldp(hw, true, NULL);
 		if (ret != I40E_SUCCESS)
Signature · 1 line
2.17.1

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