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 <xiao.w.w...@intel.com> --- drivers/net/fm10k/fm10k.h | 1 + drivers/net/fm10k/fm10k_ethdev.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h index 060982b..594dca4 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 586f482..2587696 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1256,14 +1256,17 @@ static inline int fm10k_glort_valid(struct fm10k_hw *hw) 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; } -- 1.8.3.1