patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Rasesh Mody <rasesh.mody@cavium.com>
To: stable@dpdk.org
Cc: Shahed Shaikh <shahed.shaikh@cavium.com>,
	yskoh@mellanox.com, Dept-EngDPDKDev@cavium.com
Subject: [dpdk-stable] [PATCH 17.11 4/5] net/qede: fix incorrect link status update
Date: Thu,  2 Aug 2018 18:00:31 -0700	[thread overview]
Message-ID: <1533258032-11551-4-git-send-email-rasesh.mody@cavium.com> (raw)
In-Reply-To: <1533258032-11551-1-git-send-email-rasesh.mody@cavium.com>

From: Shahed Shaikh <shahed.shaikh@cavium.com>

[ upstream commit c6034a20d9e221dc6125db57e4378520af3a515d ]

qede_link_update() always returns -1 i.e. link not changed,
because it compares the variables which always hold same value.

Fix this function by caching old link state and comparing it with
new one.

Fixes: 2ea6f76aff40 ("qede: add core driver")

Signed-off-by: Shahed Shaikh <shahed.shaikh@cavium.com>
---
 drivers/net/qede/qede_ethdev.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 687104f..73947fc 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1478,7 +1478,7 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
 {
 	struct qede_dev *qdev = eth_dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
-	uint16_t link_duplex;
+	uint16_t link_duplex, old_link_status;
 	struct qed_link_output link;
 	struct rte_eth_link *curr = &eth_dev->data->dev_link;
 
@@ -1503,6 +1503,7 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
 	curr->link_duplex = link_duplex;
 
 	/* Link Status */
+	old_link_status = curr->link_status;
 	curr->link_status = (link.link_up) ? ETH_LINK_UP : ETH_LINK_DOWN;
 
 	/* AN */
@@ -1514,7 +1515,7 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
 		curr->link_autoneg, curr->link_status);
 
 	/* return 0 means link status changed, -1 means not changed */
-	return ((curr->link_status == link.link_up) ? -1 : 0);
+	return ((curr->link_status == old_link_status) ? -1 : 0);
 }
 
 static void qede_promiscuous_enable(struct rte_eth_dev *eth_dev)
-- 
1.7.10.3

  parent reply	other threads:[~2018-08-03  1:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03  1:00 [dpdk-stable] [PATCH 17.11 1/5] net/qede: fix for devargs Rasesh Mody
2018-08-03  1:00 ` [dpdk-stable] [PATCH 17.11 2/5] net/qede: fix default extended VLAN offload config Rasesh Mody
2018-08-03  1:00 ` [dpdk-stable] [PATCH 17.11 3/5] doc: update qede management firmware guide Rasesh Mody
2018-08-03  1:00 ` Rasesh Mody [this message]
2018-08-03  1:00 ` [dpdk-stable] [PATCH 17.11 5/5] net/qede: fix unicast MAC address handling in VF Rasesh Mody
2018-08-03 17:33 ` [dpdk-stable] [PATCH 17.11 1/5] net/qede: fix for devargs Yongseok Koh

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=1533258032-11551-4-git-send-email-rasesh.mody@cavium.com \
    --to=rasesh.mody@cavium.com \
    --cc=Dept-EngDPDKDev@cavium.com \
    --cc=shahed.shaikh@cavium.com \
    --cc=stable@dpdk.org \
    --cc=yskoh@mellanox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).