From: Tomasz Duszynski Date: Tue, 5 Dec 2017 09:39:17 +0000 (+0100) Subject: net/mrvl: query link status using library API X-Git-Tag: spdx-start~605 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=c21051624d009429ddffacec73fbe517c501c3c9;p=dpdk.git net/mrvl: query link status using library API 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 Acked-by: Jianbo Liu --- diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c index a1ae2c13f4..47f12b8a77 100644 --- a/drivers/net/mrvl/mrvl_ethdev.c +++ b/drivers/net/mrvl/mrvl_ethdev.c @@ -361,8 +361,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; } @@ -379,15 +377,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); } /** @@ -628,9 +619,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; @@ -670,6 +662,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; }