net/hns3: move speed auto-negotiation warning
authorHuisong Li <lihuisong@huawei.com>
Sat, 17 Jul 2021 02:02:54 +0000 (10:02 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 23 Jul 2021 12:41:47 +0000 (14:41 +0200)
PF driver prints a warning on device that does not support auto-negotiation
when user does not configure "link_speeds" (default 0), which means
auto-negotiation. Currently, this warning information is printed in
dev_configure stage and a success is returned. Perhaps the user may call
dev_configure multiple times before dev_start for some reason or purpose.
In this case, this message may be printed multiple times. So this patch
moves it to dev_start stage.

Fixes: cfc9fe48c4d4 ("net/hns3: move link speeds check to configure")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
drivers/net/hns3/hns3_ethdev.c

index f994c28..4a302d2 100644 (file)
@@ -2437,14 +2437,11 @@ hns3_check_link_speed(struct hns3_hw *hw, uint32_t link_speeds)
        /*
         * Some hardware doesn't support auto-negotiation, but users may not
         * configure link_speeds (default 0), which means auto-negotiation.
-        * In this case, a warning message need to be printed, instead of
-        * an error.
+        * In this case, it should return success.
         */
        if (link_speeds == ETH_LINK_SPEED_AUTONEG &&
-           hw->mac.support_autoneg == 0) {
-               hns3_warn(hw, "auto-negotiation is not supported, use default fixed speed!");
+           hw->mac.support_autoneg == 0)
                return 0;
-       }
 
        if (link_speeds != ETH_LINK_SPEED_AUTONEG) {
                ret = hns3_check_port_speed(hw, link_speeds);
@@ -5515,10 +5512,13 @@ hns3_set_fiber_port_link_speed(struct hns3_hw *hw,
        /*
         * Some hardware doesn't support auto-negotiation, but users may not
         * configure link_speeds (default 0), which means auto-negotiation.
-        * In this case, it should return success.
+        * In this case, a warning message need to be printed, instead of
+        * an error.
         */
-       if (cfg->autoneg)
+       if (cfg->autoneg) {
+               hns3_warn(hw, "auto-negotiation is not supported, use default fixed speed!");
                return 0;
+       }
 
        return hns3_cfg_mac_speed_dup(hw, cfg->speed, cfg->duplex);
 }