patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v3 01/23] bus/fslmc: fix to use ci value for qbman 5.0
       [not found] ` <20210224124311.29799-1-hemant.agrawal@nxp.com>
@ 2021-02-24 12:42   ` Hemant Agrawal
  2021-02-24 12:42   ` [dpdk-stable] [PATCH v3 02/23] bus/dpaa: fix statistics reading Hemant Agrawal
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: Hemant Agrawal @ 2021-02-24 12:42 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stable, Youri Querry

From: Youri Querry <youri.querry_1@nxp.com>

Random portal hangs observed on device with QBMAN 5.0

This fixes few random packet hang issues in event mode.
Few things fixed it.
1. Generally, pi == ci, no need for extra checks.
2. The proper initializations in init with ci

Fixes: 1b49352f41be ("bus/fslmc: rename portal pi index to consumer index")
Cc: stable@dpdk.org

Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/fslmc/qbman/qbman_portal.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c
index 77c9d508c4..aedcad9258 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -339,17 +339,9 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d)
 	eqcr_pi = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI);
 	p->eqcr.pi = eqcr_pi & p->eqcr.pi_ci_mask;
 	p->eqcr.pi_vb = eqcr_pi & QB_VALID_BIT;
-	if ((p->desc.qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
-			&& (d->cena_access_mode == qman_cena_fastest_access))
-		p->eqcr.ci = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI)
-					     & p->eqcr.pi_ci_mask;
-	else
-		p->eqcr.ci = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_CI)
-					     & p->eqcr.pi_ci_mask;
-	p->eqcr.available = p->eqcr.pi_ring_size -
-				qm_cyc_diff(p->eqcr.pi_ring_size,
-				p->eqcr.ci & (p->eqcr.pi_ci_mask<<1),
-				p->eqcr.pi & (p->eqcr.pi_ci_mask<<1));
+	p->eqcr.ci = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_CI)
+			& p->eqcr.pi_ci_mask;
+	p->eqcr.available = p->eqcr.pi_ring_size;
 
 	portal_idx_map[p->desc.idx] = p;
 	return p;
-- 
2.17.1


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

* [dpdk-stable] [PATCH v3 02/23] bus/dpaa: fix statistics reading
       [not found] ` <20210224124311.29799-1-hemant.agrawal@nxp.com>
  2021-02-24 12:42   ` [dpdk-stable] [PATCH v3 01/23] bus/fslmc: fix to use ci value for qbman 5.0 Hemant Agrawal
@ 2021-02-24 12:42   ` Hemant Agrawal
  2021-02-24 12:42   ` [dpdk-stable] [PATCH v3 03/23] net/dpaa2: fix link get API implementation Hemant Agrawal
  2021-02-24 12:42   ` [dpdk-stable] [PATCH v3 04/23] net/dpaa: " Hemant Agrawal
  3 siblings, 0 replies; 4+ messages in thread
From: Hemant Agrawal @ 2021-02-24 12:42 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stable, Nipun Gupta

From: Nipun Gupta <nipun.gupta@nxp.com>

Reading of word un-aligned values after reading word aligned
values lead to corrution of memory, such that older value.
This patch make changes such that word alignedaccess is made,
before making an un-aligned access

Fixes: 6d6b4f49a155 ("bus/dpaa: add FMAN hardware operations")
Cc: stable@dpdk.org

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/dpaa/base/fman/fman_hw.c | 33 ++++++++++++++--------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c
index 4ab49f7853..af9bac76c2 100644
--- a/drivers/bus/dpaa/base/fman/fman_hw.c
+++ b/drivers/bus/dpaa/base/fman/fman_hw.c
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- * Copyright 2017 NXP
+ * Copyright 2017,2020 NXP
  *
  */
 
@@ -219,20 +219,20 @@ fman_if_stats_get(struct fman_if *p, struct rte_eth_stats *stats)
 	struct memac_regs *regs = m->ccsr_map;
 
 	/* read recved packet count */
-	stats->ipackets = ((u64)in_be32(&regs->rfrm_u)) << 32 |
-			in_be32(&regs->rfrm_l);
-	stats->ibytes = ((u64)in_be32(&regs->roct_u)) << 32 |
-			in_be32(&regs->roct_l);
-	stats->ierrors = ((u64)in_be32(&regs->rerr_u)) << 32 |
-			in_be32(&regs->rerr_l);
+	stats->ipackets = (u64)in_be32(&regs->rfrm_l) |
+			((u64)in_be32(&regs->rfrm_u)) << 32;
+	stats->ibytes = (u64)in_be32(&regs->roct_l) |
+			((u64)in_be32(&regs->roct_u)) << 32;
+	stats->ierrors = (u64)in_be32(&regs->rerr_l) |
+			((u64)in_be32(&regs->rerr_u)) << 32;
 
 	/* read xmited packet count */
-	stats->opackets = ((u64)in_be32(&regs->tfrm_u)) << 32 |
-			in_be32(&regs->tfrm_l);
-	stats->obytes = ((u64)in_be32(&regs->toct_u)) << 32 |
-			in_be32(&regs->toct_l);
-	stats->oerrors = ((u64)in_be32(&regs->terr_u)) << 32 |
-			in_be32(&regs->terr_l);
+	stats->opackets = (u64)in_be32(&regs->tfrm_l) |
+			((u64)in_be32(&regs->tfrm_u)) << 32;
+	stats->obytes = (u64)in_be32(&regs->toct_l) |
+			((u64)in_be32(&regs->toct_u)) << 32;
+	stats->oerrors = (u64)in_be32(&regs->terr_l) |
+			((u64)in_be32(&regs->terr_u)) << 32;
 }
 
 void
@@ -244,10 +244,9 @@ fman_if_stats_get_all(struct fman_if *p, uint64_t *value, int n)
 	uint64_t base_offset = offsetof(struct memac_regs, reoct_l);
 
 	for (i = 0; i < n; i++)
-		value[i] = ((u64)in_be32((char *)regs
-				+ base_offset + 8 * i + 4)) << 32 |
-				((u64)in_be32((char *)regs
-				+ base_offset + 8 * i));
+		value[i] = (((u64)in_be32((char *)regs + base_offset + 8 * i) |
+				(u64)in_be32((char *)regs + base_offset +
+				8 * i + 4)) << 32);
 }
 
 void
-- 
2.17.1


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

* [dpdk-stable] [PATCH v3 03/23] net/dpaa2: fix link get API implementation
       [not found] ` <20210224124311.29799-1-hemant.agrawal@nxp.com>
  2021-02-24 12:42   ` [dpdk-stable] [PATCH v3 01/23] bus/fslmc: fix to use ci value for qbman 5.0 Hemant Agrawal
  2021-02-24 12:42   ` [dpdk-stable] [PATCH v3 02/23] bus/dpaa: fix statistics reading Hemant Agrawal
@ 2021-02-24 12:42   ` Hemant Agrawal
  2021-02-24 12:42   ` [dpdk-stable] [PATCH v3 04/23] net/dpaa: " Hemant Agrawal
  3 siblings, 0 replies; 4+ messages in thread
From: Hemant Agrawal @ 2021-02-24 12:42 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stable, Rohit Raj

From: Rohit Raj <rohit.raj@nxp.com>

According to DPDK Documentation, rte_eth_link_get API can wait up to 9
seconds for auto-negotiation to finish and then returns link status.

In current implementation of rte_eth_link_get API in DPAA2 drivers, it
was not waiting for auto negotiation to finish and was returning link
status DOWN
It can cause issues with DPDK applications which relies on
rte_eth_link_get API for link status and does not support link status
interrupt.
Similar kind of issue was seen in TRex Application.

This patch fixes this bug by adding wait for up to 9 seconds for auto
negotiation to finish.

Fixes: c56c86ff87c1 ("net/dpaa2: update link status")
Cc: stable@dpdk.org

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 38774e255b..a81c73438e 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -31,6 +31,8 @@
 
 #define DRIVER_LOOPBACK_MODE "drv_loopback"
 #define DRIVER_NO_PREFETCH_MODE "drv_no_prefetch"
+#define CHECK_INTERVAL         100  /* 100ms */
+#define MAX_REPEAT_TIME        90   /* 9s (90 * 100ms) in total */
 
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
@@ -1805,23 +1807,32 @@ dpaa2_dev_stats_reset(struct rte_eth_dev *dev)
 /* return 0 means link status changed, -1 means not changed */
 static int
 dpaa2_dev_link_update(struct rte_eth_dev *dev,
-			int wait_to_complete __rte_unused)
+		      int wait_to_complete)
 {
 	int ret;
 	struct dpaa2_dev_priv *priv = dev->data->dev_private;
 	struct fsl_mc_io *dpni = (struct fsl_mc_io *)dev->process_private;
 	struct rte_eth_link link;
 	struct dpni_link_state state = {0};
+	uint8_t count;
 
 	if (dpni == NULL) {
 		DPAA2_PMD_ERR("dpni is NULL");
 		return 0;
 	}
 
-	ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state);
-	if (ret < 0) {
-		DPAA2_PMD_DEBUG("error: dpni_get_link_state %d", ret);
-		return -1;
+	for (count = 0; count <= MAX_REPEAT_TIME; count++) {
+		ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token,
+					  &state);
+		if (ret < 0) {
+			DPAA2_PMD_DEBUG("error: dpni_get_link_state %d", ret);
+			return -1;
+		}
+		if (state.up == ETH_LINK_DOWN &&
+		    wait_to_complete)
+			rte_delay_ms(CHECK_INTERVAL);
+		else
+			break;
 	}
 
 	memset(&link, 0, sizeof(struct rte_eth_link));
-- 
2.17.1


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

* [dpdk-stable] [PATCH v3 04/23] net/dpaa: fix link get API implementation
       [not found] ` <20210224124311.29799-1-hemant.agrawal@nxp.com>
                     ` (2 preceding siblings ...)
  2021-02-24 12:42   ` [dpdk-stable] [PATCH v3 03/23] net/dpaa2: fix link get API implementation Hemant Agrawal
@ 2021-02-24 12:42   ` Hemant Agrawal
  3 siblings, 0 replies; 4+ messages in thread
From: Hemant Agrawal @ 2021-02-24 12:42 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stable, Rohit Raj

From: Rohit Raj <rohit.raj@nxp.com>

According to DPDK Documentation, rte_eth_link_get API can wait up to 9
seconds for auto-negotiation to finish and then returns link status.

In current implementation of rte_eth_link_get API in DPAA drivers, it
was not waiting for auto negotiation to finish and was returning link
status DOWN
It can cause issues with DPDK applications which relies
on rte_eth_link_get API for link statusand does not support link status
interrupt.

This patch fixes this bug by adding wait for up to 9 seconds for auto
negotiation to finish.

Fixes: 2aa10990a8dd ("bus/dpaa: enable link state interrupt")
Cc: stable@dpdk.org

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/net/dpaa/dpaa_ethdev.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index d643514de6..c59873dd8a 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -49,6 +49,9 @@
 #include <process.h>
 #include <fmlib/fm_ext.h>
 
+#define CHECK_INTERVAL         100  /* 100ms */
+#define MAX_REPEAT_TIME        90   /* 9s (90 * 100ms) in total */
+
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		DEV_RX_OFFLOAD_JUMBO_FRAME |
@@ -669,23 +672,30 @@ dpaa_dev_tx_burst_mode_get(struct rte_eth_dev *dev,
 }
 
 static int dpaa_eth_link_update(struct rte_eth_dev *dev,
-				int wait_to_complete __rte_unused)
+				int wait_to_complete)
 {
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 	struct rte_eth_link *link = &dev->data->dev_link;
 	struct fman_if *fif = dev->process_private;
 	struct __fman_if *__fif = container_of(fif, struct __fman_if, __if);
 	int ret, ioctl_version;
+	uint8_t count;
 
 	PMD_INIT_FUNC_TRACE();
 
 	ioctl_version = dpaa_get_ioctl_version_number();
 
-
 	if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
-		ret = dpaa_get_link_status(__fif->node_name, link);
-		if (ret)
-			return ret;
+		for (count = 0; count <= MAX_REPEAT_TIME; count++) {
+			ret = dpaa_get_link_status(__fif->node_name, link);
+			if (ret)
+				return ret;
+			if (link->link_status == ETH_LINK_DOWN &&
+			    wait_to_complete)
+				rte_delay_ms(CHECK_INTERVAL);
+			else
+				break;
+		}
 	} else {
 		link->link_status = dpaa_intf->valid;
 	}
-- 
2.17.1


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

end of thread, other threads:[~2021-02-24 12:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210211141620.12482-1-hemant.agrawal@nxp.com>
     [not found] ` <20210224124311.29799-1-hemant.agrawal@nxp.com>
2021-02-24 12:42   ` [dpdk-stable] [PATCH v3 01/23] bus/fslmc: fix to use ci value for qbman 5.0 Hemant Agrawal
2021-02-24 12:42   ` [dpdk-stable] [PATCH v3 02/23] bus/dpaa: fix statistics reading Hemant Agrawal
2021-02-24 12:42   ` [dpdk-stable] [PATCH v3 03/23] net/dpaa2: fix link get API implementation Hemant Agrawal
2021-02-24 12:42   ` [dpdk-stable] [PATCH v3 04/23] net/dpaa: " Hemant Agrawal

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