patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/2] net/qede: fix incorrect link status update
@ 2018-06-07 16:30 Rasesh Mody
  2018-06-07 16:30 ` [dpdk-stable] [PATCH 2/2] net/qede: fix link change event notification Rasesh Mody
  2018-06-08 18:42 ` [dpdk-stable] [PATCH 1/2] net/qede: fix incorrect link status update Ferruh Yigit
  0 siblings, 2 replies; 3+ messages in thread
From: Rasesh Mody @ 2018-06-07 16:30 UTC (permalink / raw)
  To: dev; +Cc: Shahed Shaikh, ferruh.yigit, Dept-EngDPDKDev, stable

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

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

Fix this function by using rte_eth_linkstatus_set().

Fixes: 2ea6f76aff40 ("qede: add core driver")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index cd9ec10..7a63d05 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1590,18 +1590,20 @@ 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;
+	struct qed_link_output q_link;
+	struct rte_eth_link link;
 	uint16_t link_duplex;
-	struct qed_link_output link;
-	struct rte_eth_link *curr = &eth_dev->data->dev_link;
 
-	memset(&link, 0, sizeof(struct qed_link_output));
-	qdev->ops->common->get_link(edev, &link);
+	memset(&q_link, 0, sizeof(q_link));
+	memset(&link, 0, sizeof(link));
+
+	qdev->ops->common->get_link(edev, &q_link);
 
 	/* Link Speed */
-	curr->link_speed = link.speed;
+	link.link_speed = q_link.speed;
 
 	/* Link Mode */
-	switch (link.duplex) {
+	switch (q_link.duplex) {
 	case QEDE_DUPLEX_HALF:
 		link_duplex = ETH_LINK_HALF_DUPLEX;
 		break;
@@ -1612,21 +1614,20 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
 	default:
 		link_duplex = -1;
 	}
-	curr->link_duplex = link_duplex;
+	link.link_duplex = link_duplex;
 
 	/* Link Status */
-	curr->link_status = (link.link_up) ? ETH_LINK_UP : ETH_LINK_DOWN;
+	link.link_status = q_link.link_up ? ETH_LINK_UP : ETH_LINK_DOWN;
 
 	/* AN */
-	curr->link_autoneg = (link.supported_caps & QEDE_SUPPORTED_AUTONEG) ?
+	link.link_autoneg = (q_link.supported_caps & QEDE_SUPPORTED_AUTONEG) ?
 			     ETH_LINK_AUTONEG : ETH_LINK_FIXED;
 
 	DP_INFO(edev, "Link - Speed %u Mode %u AN %u Status %u\n",
-		curr->link_speed, curr->link_duplex,
-		curr->link_autoneg, curr->link_status);
+		link.link_speed, link.link_duplex,
+		link.link_autoneg, link.link_status);
 
-	/* return 0 means link status changed, -1 means not changed */
-	return ((curr->link_status == link.link_up) ? -1 : 0);
+	return rte_eth_linkstatus_set(eth_dev, &link);
 }
 
 static void qede_promiscuous_enable(struct rte_eth_dev *eth_dev)
-- 
1.7.10.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-stable] [PATCH 2/2] net/qede: fix link change event notification
  2018-06-07 16:30 [dpdk-stable] [PATCH 1/2] net/qede: fix incorrect link status update Rasesh Mody
@ 2018-06-07 16:30 ` Rasesh Mody
  2018-06-08 18:42 ` [dpdk-stable] [PATCH 1/2] net/qede: fix incorrect link status update Ferruh Yigit
  1 sibling, 0 replies; 3+ messages in thread
From: Rasesh Mody @ 2018-06-07 16:30 UTC (permalink / raw)
  To: dev; +Cc: Shahed Shaikh, ferruh.yigit, Dept-EngDPDKDev, stable

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

As per existing behavior, when firmware sends a link change
notification, PMD only updates the link structure but does
not notify applications about it.
This results in application sending packets even when link
status is down.

Fix this issue by issuing RTE_ETH_EVENT_INTR_LSC.

Fixes: ec94dbc57362 ("qede: add base driver")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index c3407fe..de5a7ca 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -634,8 +634,11 @@ void qed_link_update(struct ecore_hwfn *hwfn)
 {
 	struct ecore_dev *edev = hwfn->p_dev;
 	struct qede_dev *qdev = (struct qede_dev *)edev;
+	struct rte_eth_dev *dev = (struct rte_eth_dev *)qdev->ethdev;
 
-	qede_link_update((struct rte_eth_dev *)qdev->ethdev, 0);
+	if (!qede_link_update(dev, 0))
+		_rte_eth_dev_callback_process(dev,
+					      RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int qed_drain(struct ecore_dev *edev)
-- 
1.7.10.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH 1/2] net/qede: fix incorrect link status update
  2018-06-07 16:30 [dpdk-stable] [PATCH 1/2] net/qede: fix incorrect link status update Rasesh Mody
  2018-06-07 16:30 ` [dpdk-stable] [PATCH 2/2] net/qede: fix link change event notification Rasesh Mody
@ 2018-06-08 18:42 ` Ferruh Yigit
  1 sibling, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2018-06-08 18:42 UTC (permalink / raw)
  To: Rasesh Mody, dev; +Cc: Shahed Shaikh, Dept-EngDPDKDev, stable

On 6/7/2018 5:30 PM, Rasesh Mody wrote:
> From: Shahed Shaikh <shahed.shaikh@cavium.com>
> 
> qede_link_update() always returns -1 i.e. link not changed,
> becasue it compares the variables which always hold same value.
> 
> Fix this function by using rte_eth_linkstatus_set().
> 
> Fixes: 2ea6f76aff40 ("qede: add core driver")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Shahed Shaikh <shahed.shaikh@cavium.com>

Series applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-08 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-07 16:30 [dpdk-stable] [PATCH 1/2] net/qede: fix incorrect link status update Rasesh Mody
2018-06-07 16:30 ` [dpdk-stable] [PATCH 2/2] net/qede: fix link change event notification Rasesh Mody
2018-06-08 18:42 ` [dpdk-stable] [PATCH 1/2] net/qede: fix incorrect link status update Ferruh Yigit

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