Skip to content

Commit

Permalink
net/hns3: fix link speed when port is down
Browse files Browse the repository at this point in the history
[ upstream commit 230d494 ]

When the port is link down state, it is meaningless to display the
port link speed. It should be an undefined state.

Fixes: 59fad0f ("net/hns3: support link update operation")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
  • Loading branch information
LiHuiSong1 authored and steevenlee committed Jun 8, 2021
1 parent 3502d41 commit 180a37c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/hns3/hns3_ethdev.c
Expand Up @@ -2684,16 +2684,18 @@ hns3_setup_linkstatus(struct rte_eth_dev *eth_dev,
case ETH_SPEED_NUM_50G:
case ETH_SPEED_NUM_100G:
case ETH_SPEED_NUM_200G:
new_link->link_speed = mac->link_speed;
if (mac->link_status)
new_link->link_speed = mac->link_speed;
break;
default:
if (mac->link_status)
new_link->link_speed = ETH_SPEED_NUM_UNKNOWN;
else
new_link->link_speed = ETH_SPEED_NUM_NONE;
break;
}

if (!mac->link_status)
new_link->link_speed = ETH_SPEED_NUM_NONE;

new_link->link_duplex = mac->link_duplex;
new_link->link_status = mac->link_status ? ETH_LINK_UP : ETH_LINK_DOWN;
new_link->link_autoneg =
Expand Down

0 comments on commit 180a37c

Please sign in to comment.