From 6dc90c7eb306d216bb5e985e6cdb701420e29b5e Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Sat, 17 Jul 2021 10:02:54 +0800 Subject: [PATCH] net/hns3: move speed auto-negotiation warning 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 Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_ethdev.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index f994c288a1..4a302d2072 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); } -- 2.20.1