diff mbox

[dpdk-dev,v3,2/7] net/mrvl: query link status using library API

Message ID 1512466762-1982-3-git-send-email-tdu@semihalf.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Tomasz Duszynski Dec. 5, 2017, 9:39 a.m. UTC
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 <tdu@semihalf.com>
Acked-by: Jianbo Liu <jianbo.liu@arm.com>
---
 drivers/net/mrvl/mrvl_ethdev.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

--
2.7.4
diff mbox

Patch

diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index a1ae2c1..47f12b8 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;
 }