From: Xiao Wang Date: Tue, 24 Oct 2017 13:45:49 +0000 (-0700) Subject: net/fm10k: redefine link status semantics X-Git-Tag: spdx-start~1117 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6f22f2f67268254305f24d9bdc8629793b112eb7;p=dpdk.git net/fm10k: redefine link status semantics As fm10k host interface is not directly connected to PHY, marking the link status as UP doesn't mean a lot to the application. So, this patch basically redefines the link status as the state of switch manager: when switch manager is running, it's LINK_UP; when switch manager goes down by calling the fmTerminate function, status turns to LINK_DOWN. Signed-off-by: Xiao Wang Reviewed-by: Ferruh Yigit --- diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h index 060982b108..594dca4f96 100644 --- a/drivers/net/fm10k/fm10k.h +++ b/drivers/net/fm10k/fm10k.h @@ -155,6 +155,7 @@ struct fm10k_dev_info { struct fm10k_macvlan_filter_info macvlan; /* Flag to indicate if RX vector conditions satisfied */ bool rx_vec_allowed; + bool sm_down; }; /* diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 586f482952..2587696b57 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1256,14 +1256,17 @@ static int fm10k_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete) { + struct fm10k_dev_info *dev_info = + FM10K_DEV_PRIVATE_TO_INFO(dev->data->dev_private); PMD_INIT_FUNC_TRACE(); - /* The host-interface link is always up. The speed is ~50Gbps per Gen3 - * x8 PCIe interface. For now, we leave the speed undefined since there - * is no 50Gbps Ethernet. */ + /* The speed is ~50Gbps per Gen3 x8 PCIe interface. For now, we + * leave the speed undefined since there is no 50Gbps Ethernet. + */ dev->data->dev_link.link_speed = 0; dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX; - dev->data->dev_link.link_status = ETH_LINK_UP; + dev->data->dev_link.link_status = + dev_info->sm_down ? ETH_LINK_DOWN : ETH_LINK_UP; return 0; }