Up to now link status was updated unconditionally during link_up()/link_down() calls thus one was never sure about it's true status.
Using dedicated library api makes sure the true link status is set. Signed-off-by: Tomasz Duszynski <t...@semihalf.com> --- drivers/net/mrvl/mrvl_ethdev.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c index 4fac797..e7703f7 100644 --- a/drivers/net/mrvl/mrvl_ethdev.c +++ b/drivers/net/mrvl/mrvl_ethdev.c @@ -366,8 +366,6 @@ mrvl_dev_set_link_up(struct rte_eth_dev *dev) if (ret) pp2_ppio_disable(priv->ppio); - dev->data->dev_link.link_status = ETH_LINK_UP; - return ret; } @@ -384,15 +382,8 @@ static int mrvl_dev_set_link_down(struct rte_eth_dev *dev) { struct mrvl_priv *priv = dev->data->dev_private; - int ret; - - ret = pp2_ppio_disable(priv->ppio); - if (ret) - return ret; - - dev->data->dev_link.link_status = ETH_LINK_DOWN; - return ret; + return pp2_ppio_disable(priv->ppio); } /** @@ -633,9 +624,10 @@ mrvl_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) * TODO * once MUSDK provides necessary API use it here */ + struct mrvl_priv *priv = dev->data->dev_private; struct ethtool_cmd edata; struct ifreq req; - int ret, fd; + int ret, fd, link_up; edata.cmd = ETHTOOL_GSET; @@ -675,6 +667,8 @@ mrvl_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) ETH_LINK_HALF_DUPLEX; dev->data->dev_link.link_autoneg = edata.autoneg ? ETH_LINK_AUTONEG : ETH_LINK_FIXED; + pp2_ppio_get_link_state(priv->ppio, &link_up); + dev->data->dev_link.link_status = link_up ? ETH_LINK_UP : ETH_LINK_DOWN; return 0; } -- 2.7.4