diff mbox series

[6/8] net/hns3: fix a print position about auto-negotiation

Message ID 1626487376-30038-7-git-send-email-humin29@huawei.com (mailing list archive)
State Accepted, archived
Headers show
Series bugfix for hns3 PMD | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

humin (Q) July 17, 2021, 2:02 a.m. UTC
From: Huisong Li <lihuisong@huawei.com>

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 | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index f994c28..4a302d2 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -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);
 }