DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/i4oe: fix MAC loopback on X722
@ 2023-03-14  3:05 Wenjing Qiao
  2023-03-14  3:16 ` [PATCH v2] net/i40e: " Wenjing Qiao
  0 siblings, 1 reply; 4+ messages in thread
From: Wenjing Qiao @ 2023-03-14  3:05 UTC (permalink / raw)
  To: Yuying.Zhang, beilei.xing; +Cc: dukaix.yuan, dev, Wenjing Qiao

If enabling MAC loopback mode on X722 NIC, transmitted packets are not
seen in the receive queue. The root cause is using wrong loopback mode
bits. Correct it according to the X722 datasheet.

Fixes: 3a838ab649df ("net/i40e: support MAC loopback")
Fixes: 5712e6407089 ("net/i40e: revert enhancing loopback AQ command")

Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 17 ++++++++++++++---
 drivers/net/i40e/i40e_ethdev.h |  3 +++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a982e42264..d742fd0d2b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2415,10 +2415,21 @@ i40e_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
+	/* Disable mac loopback mode */
+	if (dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_MODE_NONE) {
+		ret = i40e_aq_set_lb_modes(hw, I40E_AQ_LB_MODE_NONE, NULL);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(ERR, "fail to set loopback link");
+			goto tx_err;
+		}
+	}
+
 	/* Enable mac loopback mode */
-	if (dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_MODE_NONE ||
-	    dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_PHY_LOCAL) {
-		ret = i40e_aq_set_lb_modes(hw, dev->data->dev_conf.lpbk_mode, NULL);
+	if (dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_MODE_EN) {
+		if (hw->mac.type == I40E_MAC_X722)
+			ret = i40e_aq_set_lb_modes(hw, I40E_AQ_LB_MAC_LOCAL_X722, NULL);
+		else
+			ret = i40e_aq_set_lb_modes(hw, I40E_AQ_LB_MAC, NULL);
 		if (ret != I40E_SUCCESS) {
 			PMD_DRV_LOG(ERR, "fail to set loopback link");
 			goto tx_err;
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 7c4cc44a27..9b806d130e 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -48,6 +48,9 @@
 #define I40E_MAX_VF               128
 /*flag of no loopback*/
 #define I40E_AQ_LB_MODE_NONE	  0x0
+#define I40E_AQ_LB_MODE_EN	  0x01
+#define I40E_AQ_LB_MAC		  0x01
+#define I40E_AQ_LB_MAC_LOCAL_X722 0x04
 /*
  * vlan_id is a 12 bit number.
  * The VFTA array is actually a 4096 bit array, 128 of 32bit elements.
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] net/i40e: fix MAC loopback on X722
  2023-03-14  3:05 [PATCH] net/i4oe: fix MAC loopback on X722 Wenjing Qiao
@ 2023-03-14  3:16 ` Wenjing Qiao
  2023-03-16  2:05   ` Yuan, DukaiX
  0 siblings, 1 reply; 4+ messages in thread
From: Wenjing Qiao @ 2023-03-14  3:16 UTC (permalink / raw)
  To: Yuying.Zhang, beilei.xing; +Cc: dukaix.yuan, dev, Wenjing Qiao

If enabling MAC loopback mode on X722 NIC, transmitted packets are not
seen in the receive queue. The root cause is using wrong loopback mode
bits. Correct it according to the X722 datasheet.

Fixes: 3a838ab649df ("net/i40e: support MAC loopback")
Fixes: 5712e6407089 ("net/i40e: revert enhancing loopback AQ command")

Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 17 ++++++++++++++---
 drivers/net/i40e/i40e_ethdev.h |  3 +++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a982e42264..d742fd0d2b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2415,10 +2415,21 @@ i40e_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
+	/* Disable mac loopback mode */
+	if (dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_MODE_NONE) {
+		ret = i40e_aq_set_lb_modes(hw, I40E_AQ_LB_MODE_NONE, NULL);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(ERR, "fail to set loopback link");
+			goto tx_err;
+		}
+	}
+
 	/* Enable mac loopback mode */
-	if (dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_MODE_NONE ||
-	    dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_PHY_LOCAL) {
-		ret = i40e_aq_set_lb_modes(hw, dev->data->dev_conf.lpbk_mode, NULL);
+	if (dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_MODE_EN) {
+		if (hw->mac.type == I40E_MAC_X722)
+			ret = i40e_aq_set_lb_modes(hw, I40E_AQ_LB_MAC_LOCAL_X722, NULL);
+		else
+			ret = i40e_aq_set_lb_modes(hw, I40E_AQ_LB_MAC, NULL);
 		if (ret != I40E_SUCCESS) {
 			PMD_DRV_LOG(ERR, "fail to set loopback link");
 			goto tx_err;
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 7c4cc44a27..9b806d130e 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -48,6 +48,9 @@
 #define I40E_MAX_VF               128
 /*flag of no loopback*/
 #define I40E_AQ_LB_MODE_NONE	  0x0
+#define I40E_AQ_LB_MODE_EN	  0x01
+#define I40E_AQ_LB_MAC		  0x01
+#define I40E_AQ_LB_MAC_LOCAL_X722 0x04
 /*
  * vlan_id is a 12 bit number.
  * The VFTA array is actually a 4096 bit array, 128 of 32bit elements.
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v2] net/i40e: fix MAC loopback on X722
  2023-03-14  3:16 ` [PATCH v2] net/i40e: " Wenjing Qiao
@ 2023-03-16  2:05   ` Yuan, DukaiX
  2023-03-16  2:21     ` Zhang, Qi Z
  0 siblings, 1 reply; 4+ messages in thread
From: Yuan, DukaiX @ 2023-03-16  2:05 UTC (permalink / raw)
  To: Qiao, Wenjing, Zhang, Yuying, Xing, Beilei; +Cc: dev

> -----Original Message-----
> From: Qiao, Wenjing <wenjing.qiao@intel.com>
> Sent: 2023年3月14日 11:16
> To: Zhang, Yuying <yuying.zhang@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>
> Cc: Yuan, DukaiX <dukaix.yuan@intel.com>; dev@dpdk.org; Qiao, Wenjing
> <wenjing.qiao@intel.com>
> Subject: [PATCH v2] net/i40e: fix MAC loopback on X722
> 
> If enabling MAC loopback mode on X722 NIC, transmitted packets are not
> seen in the receive queue. The root cause is using wrong loopback mode bits.
> Correct it according to the X722 datasheet.
> 
> Fixes: 3a838ab649df ("net/i40e: support MAC loopback")
> Fixes: 5712e6407089 ("net/i40e: revert enhancing loopback AQ command")
> 
> Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
> ---
Tested-by: Dukai Yuan<dukaix.yuan@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v2] net/i40e: fix MAC loopback on X722
  2023-03-16  2:05   ` Yuan, DukaiX
@ 2023-03-16  2:21     ` Zhang, Qi Z
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Qi Z @ 2023-03-16  2:21 UTC (permalink / raw)
  To: Yuan, DukaiX, Qiao, Wenjing, Zhang, Yuying, Xing, Beilei; +Cc: dev



> -----Original Message-----
> From: Yuan, DukaiX <dukaix.yuan@intel.com>
> Sent: Thursday, March 16, 2023 10:05 AM
> To: Qiao, Wenjing <wenjing.qiao@intel.com>; Zhang, Yuying
> <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH v2] net/i40e: fix MAC loopback on X722
> 
> > -----Original Message-----
> > From: Qiao, Wenjing <wenjing.qiao@intel.com>
> > Sent: 2023年3月14日 11:16
> > To: Zhang, Yuying <yuying.zhang@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>
> > Cc: Yuan, DukaiX <dukaix.yuan@intel.com>; dev@dpdk.org; Qiao, Wenjing
> > <wenjing.qiao@intel.com>
> > Subject: [PATCH v2] net/i40e: fix MAC loopback on X722
> >
> > If enabling MAC loopback mode on X722 NIC, transmitted packets are not
> > seen in the receive queue. The root cause is using wrong loopback mode
> bits.
> > Correct it according to the X722 datasheet.
> >
> > Fixes: 3a838ab649df ("net/i40e: support MAC loopback")
> > Fixes: 5712e6407089 ("net/i40e: revert enhancing loopback AQ command")
> >
> > Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
> > ---
> Tested-by: Dukai Yuan<dukaix.yuan@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-16  2:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14  3:05 [PATCH] net/i4oe: fix MAC loopback on X722 Wenjing Qiao
2023-03-14  3:16 ` [PATCH v2] net/i40e: " Wenjing Qiao
2023-03-16  2:05   ` Yuan, DukaiX
2023-03-16  2:21     ` Zhang, Qi Z

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).