If the link auto-negotiation of the NIC is disabled,
or the flow control auto-negotiation is not supported,
it's unnecessary to wait for link establishment.

Fixes: 1f411e31a826 ("net/hns3: support flow control autoneg for copper port")
Cc: sta...@dpdk.org

Signed-off-by: Dengdui Huang <huangdeng...@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 9f7119b734..20ad249b8b 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -5308,12 +5308,6 @@ hns3_get_current_fc_mode(struct rte_eth_dev *dev)
        struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);
        struct hns3_mac *mac = &hw->mac;
 
-       /*
-        * When the flow control mode is obtained, the device may not complete
-        * auto-negotiation. It is necessary to wait for link establishment.
-        */
-       (void)hns3_dev_link_update(dev, 1);
-
        /*
         * If the link auto-negotiation of the nic is disabled, or the flow
         * control auto-negotiation is not supported, the forced flow control
@@ -5322,6 +5316,12 @@ hns3_get_current_fc_mode(struct rte_eth_dev *dev)
        if (mac->link_autoneg == 0 || !pf->support_fc_autoneg)
                return hw->requested_fc_mode;
 
+       /*
+        * When the flow control mode is obtained, the device may not complete
+        * auto-negotiation. It is necessary to wait for link establishment.
+        */
+       (void)hns3_dev_link_update(dev, 1);
+
        return hns3_get_autoneg_fc_mode(hw);
 }
 
-- 
2.33.0

Reply via email to