Skip to content

Commit

Permalink
net/i40e: fix MAC loopback on X722
Browse files Browse the repository at this point in the history
[ upstream commit 6355ff768b0b5871cc82a69194b376db39ee6e9c ]

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: 3a838ab ("net/i40e: support MAC loopback")
Fixes: 5712e64 ("net/i40e: revert enhancing loopback AQ command")

Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
Tested-by: Dukai Yuan <dukaix.yuan@intel.com>
  • Loading branch information
Qiao-Intel authored and bluca committed Mar 21, 2023
1 parent 3ab75a1 commit 3c83b92
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
17 changes: 14 additions & 3 deletions drivers/net/i40e/i40e_ethdev.c
Expand Up @@ -2520,10 +2520,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;
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/i40e/i40e_ethdev.h
Expand Up @@ -47,6 +47,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.
Expand Down

0 comments on commit 3c83b92

Please sign in to comment.