This patch fix loopback fail after share code change

This reverts commit 7b7711bea5f4b5c47010c42a690fb4f4c1b57858.

Signed-off-by: Yanglong Wu <yanglong...@intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 21 ++-------------------
 drivers/net/i40e/base/i40e_common.c     | 12 ++++--------
 drivers/net/i40e/base/i40e_diag.c       | 17 ++---------------
 drivers/net/i40e/base/i40e_prototype.h  |  5 ++---
 drivers/net/i40e/i40e_ethdev.c          |  4 +---
 5 files changed, 11 insertions(+), 48 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index bbf094add..801c0ff1b 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2130,28 +2130,11 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_an_advt_reg);
 
 /* Set Loopback mode (0x0618) */
 struct i40e_aqc_set_lb_mode {
-       u8      lb_level;
-#define I40E_AQ_LB_NONE        0
-#define I40E_AQ_LB_MAC 1
-#define I40E_AQ_LB_SERDES      2
-#define I40E_AQ_LB_PHY_INT     3
-#define I40E_AQ_LB_PHY_EXT     4
-#define I40E_AQ_LB_CPVL_PCS    5
-#define I40E_AQ_LB_CPVL_EXT    6
+       __le16  lb_mode;
 #define I40E_AQ_LB_PHY_LOCAL   0x01
 #define I40E_AQ_LB_PHY_REMOTE  0x02
 #define I40E_AQ_LB_MAC_LOCAL   0x04
-       u8      lb_type;
-#define I40E_AQ_LB_LOCAL       0
-#define I40E_AQ_LB_FAR 0x01
-       u8      speed;
-#define I40E_AQ_LB_SPEED_NONE  0
-#define I40E_AQ_LB_SPEED_1G    1
-#define I40E_AQ_LB_SPEED_10G   2
-#define I40E_AQ_LB_SPEED_40G   3
-#define I40E_AQ_LB_SPEED_20G   4
-       u8      force_speed;
-       u8      reserved[12];
+       u8      reserved[14];
 };
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_set_lb_mode);
diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index 6c65a3236..e0a5be14c 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2172,9 +2172,9 @@ enum i40e_status_code i40e_aq_get_partner_advt(struct 
i40e_hw *hw,
  *
  * Sets loopback modes.
  **/
-enum i40e_status_code
-i40e_aq_set_lb_modes(struct i40e_hw *hw, u8 lb_level, u8 lb_type, u8 speed,
-                    struct i40e_asq_cmd_details *cmd_details)
+enum i40e_status_code i40e_aq_set_lb_modes(struct i40e_hw *hw,
+                               u16 lb_modes,
+                               struct i40e_asq_cmd_details *cmd_details)
 {
        struct i40e_aq_desc desc;
        struct i40e_aqc_set_lb_mode *cmd =
@@ -2184,11 +2184,7 @@ i40e_aq_set_lb_modes(struct i40e_hw *hw, u8 lb_level, u8 
lb_type, u8 speed,
        i40e_fill_default_direct_cmd_desc(&desc,
                                          i40e_aqc_opc_set_lb_modes);
 
-       cmd->lb_level = lb_level;
-       cmd->lb_type = lb_type;
-       cmd->speed = speed;
-       if (speed)
-               cmd->force_speed = 1;
+       cmd->lb_mode = CPU_TO_LE16(lb_modes);
 
        status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
diff --git a/drivers/net/i40e/base/i40e_diag.c 
b/drivers/net/i40e/base/i40e_diag.c
index 0efa59de3..c3c76a0c8 100644
--- a/drivers/net/i40e/base/i40e_diag.c
+++ b/drivers/net/i40e/base/i40e_diag.c
@@ -45,21 +45,8 @@ enum i40e_status_code i40e_diag_set_loopback(struct i40e_hw 
*hw,
                                             enum i40e_lb_mode mode)
 {
        enum i40e_status_code ret_code = I40E_SUCCESS;
-       u8 speed = I40E_AQ_LB_SPEED_10G;
-       u8 level = 0;
-       u8 type = 0;
-
-       if (mode == I40E_LB_MODE_PHY_LOCAL) {
-               level = I40E_AQ_LB_PHY_INT;
-               type = I40E_AQ_LB_LOCAL;
-       } else if (mode == I40E_LB_MODE_PHY_REMOTE) {
-               level = I40E_AQ_LB_PHY_INT;
-               type = I40E_AQ_LB_FAR;
-       } else if (mode == I40E_LB_MODE_MAC_LOCAL) {
-               level = I40E_AQ_LB_MAC;
-               type = I40E_AQ_LB_LOCAL;
-       }
-       if (i40e_aq_set_lb_modes(hw, level, type, speed, NULL))
+
+       if (i40e_aq_set_lb_modes(hw, mode, NULL))
                ret_code = I40E_ERR_DIAG_TEST_FAILED;
 
        return ret_code;
diff --git a/drivers/net/i40e/base/i40e_prototype.h 
b/drivers/net/i40e/base/i40e_prototype.h
index 1edfb2d18..c6ec2d769 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -142,9 +142,8 @@ enum i40e_status_code i40e_aq_get_local_advt_reg(struct 
i40e_hw *hw,
 enum i40e_status_code i40e_aq_get_partner_advt(struct i40e_hw *hw,
                                u64 *advt_reg,
                                struct i40e_asq_cmd_details *cmd_details);
-enum i40e_status_code
-i40e_aq_set_lb_modes(struct i40e_hw *hw, u8 lb_level, u8 lb_type, u8 speed,
-                    struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code i40e_aq_set_lb_modes(struct i40e_hw *hw, u16 lb_modes,
+                               struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_clear_pxe_mode(struct i40e_hw *hw,
                        struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_link_restart_an(struct i40e_hw *hw,
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 06b0f03a1..65a4b7ad7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -33,7 +33,6 @@
 #include "base/i40e_type.h"
 #include "base/i40e_register.h"
 #include "base/i40e_dcb.h"
-#include "base/i40e_diag.h"
 #include "i40e_ethdev.h"
 #include "i40e_rxtx.h"
 #include "i40e_pf.h"
@@ -2097,7 +2096,6 @@ i40e_dev_start(struct rte_eth_dev *dev)
 
        /* Enable all queues which have been configured */
        ret = i40e_dev_switch_queues(pf, TRUE);
-
        if (ret != I40E_SUCCESS) {
                PMD_DRV_LOG(ERR, "Failed to enable VSI");
                goto err_up;
@@ -2127,7 +2125,7 @@ i40e_dev_start(struct rte_eth_dev *dev)
        /* 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_diag_set_loopback(hw, dev->data->dev_conf.lpbk_mode);
+               ret = i40e_aq_set_lb_modes(hw, dev->data->dev_conf.lpbk_mode, 
NULL);
                if (ret != I40E_SUCCESS) {
                        PMD_DRV_LOG(ERR, "fail to set loopback link");
                        goto err_up;
-- 
2.11.0

Reply via email to