All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Duszynski <tdu@semihalf.com>
To: dev@dpdk.org
Cc: mw@semihalf.com, jck@semihalf.com, dima@marvell.com,
	nsamsono@marvell.com, jianbo.liu@arm.com,
	Tomasz Duszynski <tdu@semihalf.com>
Subject: [PATCH 2/7] net/mrvl: query link status using library API
Date: Thu, 30 Nov 2017 14:32:18 +0100	[thread overview]
Message-ID: <1512048743-23749-3-git-send-email-tdu@semihalf.com> (raw)
In-Reply-To: <1512048743-23749-1-git-send-email-tdu@semihalf.com>

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>
---
 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

  parent reply	other threads:[~2017-11-30 13:32 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30 13:32 [PATCH 0/7] Sync with MUSDK-17.10 Tomasz Duszynski
2017-11-30 13:32 ` [PATCH 1/7] net/mrvl: sync compilation with musdk-17.10 Tomasz Duszynski
2017-12-01  3:29   ` Jianbo Liu
2017-12-01  9:03     ` Tomasz Duszynski
2017-11-30 13:32 ` Tomasz Duszynski [this message]
2017-11-30 13:32 ` [PATCH 3/7] net/mrvl: do not enable port after setting MAC address Tomasz Duszynski
2017-11-30 13:32 ` [PATCH 4/7] net/mrvl: check if ppio is initialized Tomasz Duszynski
2017-11-30 13:32 ` [PATCH 5/7] net/mrvl: add extra error logs Tomasz Duszynski
2017-12-01  3:32   ` Jianbo Liu
2017-12-01  8:26     ` Tomasz Duszynski
2017-11-30 13:32 ` [PATCH 6/7] devtools/test-build: add MRVL NET PMD to test-build Tomasz Duszynski
2017-11-30 13:32 ` [PATCH 7/7] net/mrvl: update MRVL NET PMD documentation Tomasz Duszynski
2017-12-01 15:19 ` [PATCH 0/7] Sync with MUSDK-17.10 Tomasz Duszynski
2017-12-01 15:19   ` [PATCH 1/7] net/mrvl: sync compilation with musdk-17.10 Tomasz Duszynski
2017-12-01 15:19   ` [PATCH 2/7] net/mrvl: query link status using library API Tomasz Duszynski
2017-12-01 15:19   ` [PATCH 3/7] net/mrvl: do not enable port after setting MAC address Tomasz Duszynski
2017-12-01 15:19   ` [PATCH 4/7] net/mrvl: check if ppio is initialized Tomasz Duszynski
2017-12-01 15:19   ` [PATCH 5/7] net/mrvl: add extra error logs Tomasz Duszynski
2017-12-01 15:19   ` [PATCH 6/7] devtools/test-build: add MRVL NET PMD to test-build Tomasz Duszynski
2017-12-05  0:48     ` Ferruh Yigit
2017-12-05  8:38       ` Tomasz Duszynski
2017-12-01 15:19   ` [PATCH 7/7] net/mrvl: update MRVL NET PMD documentation Tomasz Duszynski
2017-12-04  2:25   ` [PATCH 0/7] Sync with MUSDK-17.10 Jianbo Liu
2017-12-05  9:39   ` [PATCH v3 " Tomasz Duszynski
2017-12-05  9:39     ` [PATCH v3 1/7] net/mrvl: sync compilation with musdk-17.10 Tomasz Duszynski
2017-12-05  9:39     ` [PATCH v3 2/7] net/mrvl: query link status using library API Tomasz Duszynski
2017-12-05  9:39     ` [PATCH v3 3/7] net/mrvl: do not enable port after setting MAC address Tomasz Duszynski
2017-12-05  9:39     ` [PATCH v3 4/7] net/mrvl: check if ppio is initialized Tomasz Duszynski
2017-12-05  9:39     ` [PATCH v3 5/7] net/mrvl: add extra error logs Tomasz Duszynski
2017-12-05  9:39     ` [PATCH v3 6/7] devtools/test-build: add MRVL NET PMD to test-build Tomasz Duszynski
2017-12-05  9:39     ` [PATCH v3 7/7] net/mrvl: update MRVL NET PMD documentation Tomasz Duszynski
2017-12-07  1:13     ` [PATCH v3 0/7] Sync with MUSDK-17.10 Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1512048743-23749-3-git-send-email-tdu@semihalf.com \
    --to=tdu@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=dima@marvell.com \
    --cc=jck@semihalf.com \
    --cc=jianbo.liu@arm.com \
    --cc=mw@semihalf.com \
    --cc=nsamsono@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.