Skip to contentSkip to conversation

features and fixes on NXP eth devices

PATCH Superseded [email protected] 6 participants 68 messages Dec 6, 2021 – Feb 1, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover features and fixes on NXP eth devices

From: Nipun Gupta <[email protected]>

This series adds few features and important fixes on DPAA, PFE and ENETC devices.

Features added:
- level 2 support for shaping on DPAA2
- loopback configuration for DPNI devices on DPAA2
- Multiple TXQ's enqueue for ordered queues for performance
- VFs support on ENETC

Fixes:
- fix unregistering interrupt handler on DPAA2
- fix timestamping for IEEE1588 on DPAA1
- fix 32 bit and PPC compilation for PFE

Apeksha Gupta (1):
net/pfe: remove setting unused value

Gagandeep Singh (4):
net/dpaa2: add support for level 2 in traffic management net/enetc: add support for VFs
net/pfe: disable HW CRC stripping
net/pfe: reduce driver initialization time

Jun Yang (4):
net/dpaa2: support multiple txqs en-queue for ordered net/dpaa2: secondary process handling for dpni bus/fslmc: add and scan dprc devices net/dpaa2: support recycle loopback port

Nipun Gupta (4):
bus/fslmc: update MC to 10.29
bus/fslmc: use dmb oshst for synchronization before I/O net/dpaa: check status before configuring shared MAC net/dpaa: enable checksum for shared MAC interface

Rohit Raj (1):
net/dpaa2: warn user in case of high nb desc

Sachin Saxena (1):
net/pfe: fix for 32 bit and PPC compilation

Vanshika Shukla (2):
net/dpaa2: fix unregistering interrupt handler
net/dpaa2: fix timestamping for IEEE1588

 doc/guides/nics/dpaa2.rst                 |   2 +-
 drivers/bus/dpaa/base/fman/fman_hw.c      |  11 +
 drivers/bus/dpaa/include/fsl_fman.h       |   2 +
 drivers/bus/dpaa/version.map              |   1 +
 drivers/bus/fslmc/fslmc_bus.c             |  15 +-
 drivers/bus/fslmc/fslmc_vfio.c            |  18 +-
 drivers/bus/fslmc/mc/dprc.c               | 129 ++++
 drivers/bus/fslmc/mc/fsl_dpmng.h          |   2 +-
 drivers/bus/fslmc/mc/fsl_dprc.h           |  46 ++
 drivers/bus/fslmc/mc/fsl_dprc_cmd.h       |  48 ++
 drivers/bus/fslmc/meson.build             |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c  | 100 +++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   |  15 +-
 drivers/bus/fslmc/qbman/include/compat.h  |   4 +-
 drivers/bus/fslmc/rte_fslmc.h             |  10 +-
 drivers/event/dpaa2/dpaa2_eventdev.c      |  12 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  |  23 +
 drivers/mempool/dpaa2/rte_dpaa2_mempool.h |  15 +
 drivers/mempool/dpaa2/version.map         |   1 +
 drivers/net/dpaa/dpaa_ethdev.c            |  17 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c    |   5 +-
 drivers/net/dpaa2/dpaa2_ethdev.c          | 117 +++-
 drivers/net/dpaa2/dpaa2_ethdev.h          |  38 +-
 drivers/net/dpaa2/dpaa2_ptp.c             |   8 +-
 drivers/net/dpaa2/dpaa2_recycle.c         | 780 ++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_rxtx.c            | 181 ++++-
 drivers/net/dpaa2/dpaa2_tm.c              | 563 +++++++++++++---
 drivers/net/dpaa2/dpaa2_tm.h              |  17 +-
 drivers/net/dpaa2/mc/dpdmux.c             |   8 +
 drivers/net/dpaa2/mc/dpkg.c               |   7 +-
 drivers/net/dpaa2/mc/dpni.c               | 417 ++++++++----
 drivers/net/dpaa2/mc/fsl_dpdmux.h         |   3 +
 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h     |   5 +-
 drivers/net/dpaa2/mc/fsl_dpni.h           | 173 +++--
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h       | 137 ++--
 drivers/net/dpaa2/meson.build             |   1 +
 drivers/net/dpaa2/version.map             |   1 +
 drivers/net/enetc/enetc_ethdev.c          |  25 +-
 drivers/net/pfe/pfe_ethdev.c              |  10 +-
 drivers/net/pfe/pfe_hal.c                 |   4 +-
 drivers/net/pfe/pfe_hif.c                 |   9 +-
 drivers/net/pfe/pfe_hif_lib.c             |   3 +-
 42 files changed, 2532 insertions(+), 455 deletions(-)
 create mode 100644 drivers/bus/fslmc/mc/dprc.c
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc.h
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc_cmd.h
 create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
 create mode 100644 drivers/net/dpaa2/dpaa2_recycle.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/17 bus/fslmc: update MC to 10.29

From: Nipun Gupta <[email protected]>

update MC firmware library version to 10.29

---
 drivers/bus/fslmc/mc/fsl_dpmng.h      |   2 +-
 drivers/net/dpaa2/mc/dpdmux.c         |   8 ++
 drivers/net/dpaa2/mc/dpkg.c           |   7 +-
 drivers/net/dpaa2/mc/dpni.c           | 111 ++++++++++++++++++++------
 drivers/net/dpaa2/mc/fsl_dpdmux.h     |   3 +
 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h |   5 +-
 drivers/net/dpaa2/mc/fsl_dpni.h       |  54 ++++++++++---
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h   |  57 +++++++------
 8 files changed, 181 insertions(+), 66 deletions(-)
drivers/bus/fslmc/mc/fsl_dpmng.h +1 -1
index 7e9bd96429..073d47efbf 100644
@@ -20,7 +20,7 @@ struct fsl_mc_io;
  * Management Complex firmware version information
  */
 #define MC_VER_MAJOR 10
-#define MC_VER_MINOR 28
+#define MC_VER_MINOR 29
 
 /**
  * struct mc_version
drivers/net/dpaa2/mc/dpdmux.c +8 -0
index edbb01b45b..1bb153cad7 100644
@@ -398,6 +398,9 @@ int dpdmux_get_attributes(struct fsl_mc_io *mc_io,
 	attr->num_ifs = le16_to_cpu(rsp_params->num_ifs);
 	attr->mem_size = le16_to_cpu(rsp_params->mem_size);
 	attr->default_if = le16_to_cpu(rsp_params->default_if);
+	attr->max_dmat_entries = le16_to_cpu(rsp_params->max_dmat_entries);
+	attr->max_mc_groups = le16_to_cpu(rsp_params->max_mc_groups);
+	attr->max_vlan_ids = le16_to_cpu(rsp_params->max_vlan_ids);
 
 	return 0;
 }
@@ -470,6 +473,11 @@ int dpdmux_if_disable(struct fsl_mc_io *mc_io,
  * will be updated with the minimum value of the mfls of the connected
  * dpnis and the actual value of dmux mfl.
  *
+ * If dpdmux object is created using DPDMUX_OPT_AUTO_MAX_FRAME_LEN and maximum
+ * frame length is changed for a dpni connected to dpdmux interface the change
+ * is propagated through dpdmux interfaces and will overwrite the value set using
+ * this API.
+ *
  * Return:	'0' on Success; Error code otherwise.
  */
 int dpdmux_set_max_frame_length(struct fsl_mc_io *mc_io,
drivers/net/dpaa2/mc/dpkg.c +2 -5
index 1e171eedc7..4789976b7d 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  *
- * Copyright 2017 NXP
+ * Copyright 2017-2021 NXP
  *
  */
 #include <fsl_mc_sys.h>
@@ -63,10 +63,7 @@ dpkg_prepare_key_cfg(const struct dpkg_profile_cfg *cfg, uint8_t *key_cfg_buf)
 		dpkg_set_field(extr->extract_type, EXTRACT_TYPE,
 			       cfg->extracts[i].type);
 
-		if (extr->num_of_byte_masks > DPKG_NUM_OF_MASKS)
-			return -EINVAL;
-
-		for (j = 0; j < extr->num_of_byte_masks; j++) {
+		for (j = 0; j < DPKG_NUM_OF_MASKS; j++) {
 			extr->masks[j].mask = cfg->extracts[i].masks[j].mask;
 			extr->masks[j].offset =
 				cfg->extracts[i].masks[j].offset;
drivers/net/dpaa2/mc/dpni.c +85 -26

277 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpdmux.h +3 -0
index b01a98eb59..4600ea94d4 100644
@@ -184,6 +184,9 @@ struct dpdmux_attr {
 	uint16_t num_ifs;
 	uint16_t mem_size;
 	uint16_t default_if;
+	uint16_t max_dmat_entries;
+	uint16_t max_mc_groups;
+	uint16_t max_vlan_ids;
 };
 
 int dpdmux_get_attributes(struct fsl_mc_io *mc_io,
drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h +4 -1
index f8a1b5b1ae..bf6b8a20d1 100644
@@ -35,7 +35,7 @@
 
 #define DPDMUX_CMDID_ENABLE			DPDMUX_CMD(0x002)
 #define DPDMUX_CMDID_DISABLE			DPDMUX_CMD(0x003)
-#define DPDMUX_CMDID_GET_ATTR			DPDMUX_CMD_V2(0x004)
+#define DPDMUX_CMDID_GET_ATTR			DPDMUX_CMD_V3(0x004)
 #define DPDMUX_CMDID_RESET			DPDMUX_CMD(0x005)
 #define DPDMUX_CMDID_IS_ENABLED			DPDMUX_CMD(0x006)
 #define DPDMUX_CMDID_SET_MAX_FRAME_LENGTH	DPDMUX_CMD(0x0a1)
@@ -119,6 +119,9 @@ struct dpdmux_rsp_get_attr {
 	uint32_t pad2;
 
 	uint64_t options;
+	uint16_t max_dmat_entries;
+	uint16_t max_mc_groups;
+	uint16_t max_vlan_ids;
 };
 
 struct dpdmux_cmd_set_max_frame_length {
drivers/net/dpaa2/mc/fsl_dpni.h +44 -10

148 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpni_cmd.h +34 -23

172 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/17 bus/fslmc: use dmb oshst for synchronization before I/O

In reply to [email protected]

From: Nipun Gupta <[email protected]>

Outer Shareable Store (oshst) is sufficient for Data Memory Barrier (dmb) when doing IO on the interface via QBMAN.

This will sync L3/DDR with the L1/L2 cached data.

---
 drivers/bus/fslmc/qbman/include/compat.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/fslmc/qbman/include/compat.h +2 -2
index a4471a80af..ece5da5906 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  * Copyright (c) 2008-2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017,2021 NXP
  *
  */
 
@@ -81,7 +81,7 @@ do { \
 #define __raw_readl(p)	(*(const volatile unsigned int *)(p))
 #define __raw_writel(v, p) {*(volatile unsigned int *)(p) = (v); }
 
-#define dma_wmb()		rte_smp_mb()
+#define dma_wmb()		rte_io_wmb()
 
 #define atomic_t                rte_atomic32_t
 #define atomic_read(v)          rte_atomic32_read(v)
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/17 net/dpaa2: warn user in case of high nb desc

In reply to [email protected]

From: Rohit Raj <[email protected]>

Added warning message if application is configuring nb_desc more than supported by PEB memory suggesting user to configure HW descriptors in normal memory rather than in faster PEB memory.

---
 drivers/net/dpaa2/dpaa2_ethdev.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/net/dpaa2/dpaa2_ethdev.c +13 -0
index a3706439d5..f5cac8f9d9 100644
@@ -74,6 +74,9 @@ int dpaa2_timestamp_dynfield_offset = -1;
 /* Enable error queue */
 bool dpaa2_enable_err_queue;
 
+#define MAX_NB_RX_DESC		11264
+int total_nb_rx_desc;
+
 struct rte_dpaa2_xstats_name_off {
 	char name[RTE_ETH_XSTATS_NAME_SIZE];
 	uint8_t page_id; /* dpni statistics page id */
@@ -694,6 +697,13 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	DPAA2_PMD_DEBUG("dev =%p, queue =%d, pool = %p, conf =%p",
 			dev, rx_queue_id, mb_pool, rx_conf);
 
+	total_nb_rx_desc += nb_rx_desc;
+	if (total_nb_rx_desc > MAX_NB_RX_DESC) {
+		DPAA2_PMD_WARN("\nTotal nb_rx_desc exceeds %d limit. Please use Normal buffers",
+			       MAX_NB_RX_DESC);
+		DPAA2_PMD_WARN("To use Normal buffers, run 'export DPNI_NORMAL_BUF=1' before running dynamic_dpl.sh script");
+	}
+
 	/* Rx deferred start is not supported */
 	if (rx_conf->rx_deferred_start) {
 		DPAA2_PMD_ERR("%p:Rx deferred start not supported",
@@ -984,6 +994,9 @@ dpaa2_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 
 	memset(&cfg, 0, sizeof(struct dpni_queue));
 	PMD_INIT_FUNC_TRACE();
+
+	total_nb_rx_desc -= dpaa2_q->nb_desc;
+
 	if (dpaa2_q->cgid != 0xff) {
 		options = DPNI_QUEUE_OPT_CLEAR_CGID;
 		cfg.cgid = dpaa2_q->cgid;
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/17 net/dpaa2: fix unregistering interrupt handler

In reply to [email protected]

From: Vanshika Shukla <[email protected]>

This patch fixes code that handles unregistering LSC interrupt handler in dpaa2_dev_stop API.

Fixes c5acbb5ea20e ("net/dpaa2: support link status event")
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/dpaa2/dpaa2_ethdev.c +6 -1
index f5cac8f9d9..18ff07249f 100644
@@ -1265,7 +1265,12 @@ dpaa2_dev_stop(struct rte_eth_dev *dev)
 	struct fsl_mc_io *dpni = (struct fsl_mc_io *)dev->process_private;
 	int ret;
 	struct rte_eth_link link;
-	struct rte_intr_handle *intr_handle = dev->intr_handle;
+	struct rte_device *rdev = dev->device;
+	struct rte_intr_handle *intr_handle;
+	struct rte_dpaa2_device *dpaa2_dev;
+
+	dpaa2_dev = container_of(rdev, struct rte_dpaa2_device, device);
+	intr_handle = dpaa2_dev->intr_handle;
 
 	PMD_INIT_FUNC_TRACE();
 
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/17 net/dpaa2: fix timestamping for IEEE1588

In reply to [email protected]

From: Vanshika Shukla <[email protected]>

The current implementation of DPAA2 driver code is such that it records Rx and Tx timestamp for PTP without checking if they are PTP packets or not. Packets for which RTE_MBUF_F_RX_IEEE1588_TMST and RTE_MBUF_F_TX_IEEE1588_TMST is not set, Rx and Tx timestamp should not be recorded.

This patch fixes this issue by checking if the required flags are set in the mbuf before recording timestamps.

Also this change defines separate values for
DPAA2_TX_CONF_ENABLE and DPAA2_NO_PREFETCH_RX

Fixes e806bf878c17 ("net/dpaa2: support timestamp")
---
 drivers/net/dpaa2/dpaa2_ethdev.h |  2 +-
 drivers/net/dpaa2/dpaa2_ptp.c    |  8 ++++---
 drivers/net/dpaa2/dpaa2_rxtx.c   | 39 +++++++++++++++++++++++++-------
 3 files changed, 37 insertions(+), 12 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.h +1 -1
index c5e9267bf0..c21571e63d 100644
@@ -62,7 +62,7 @@
 /* Disable RX tail drop, default is enable */
 #define DPAA2_RX_TAILDROP_OFF	0x04
 /* Tx confirmation enabled */
-#define DPAA2_TX_CONF_ENABLE	0x08
+#define DPAA2_TX_CONF_ENABLE	0x06
 
 #define DPAA2_RSS_OFFLOAD_ALL ( \
 	RTE_ETH_RSS_L2_PAYLOAD | \
drivers/net/dpaa2/dpaa2_ptp.c +5 -3
index 8d79e39244..3a4536dd69 100644
@@ -111,10 +111,12 @@ int dpaa2_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 {
 	struct dpaa2_dev_priv *priv = dev->data->dev_private;
 
-	if (priv->next_tx_conf_queue)
-		dpaa2_dev_tx_conf(priv->next_tx_conf_queue);
-	else
+	if (priv->next_tx_conf_queue) {
+		while (!priv->tx_timestamp)
+			dpaa2_dev_tx_conf(priv->next_tx_conf_queue);
+	} else {
 		return -1;
+	}
 	*timestamp = rte_ns_to_timespec(priv->tx_timestamp);
 
 	return 0;
drivers/net/dpaa2/dpaa2_rxtx.c +31 -8
index c65589a5f3..ee3ed1b152 100644
@@ -140,8 +140,10 @@ dpaa2_dev_rx_parse_slow(struct rte_mbuf *mbuf,
 			annotation->word3, annotation->word4);
 
 #if defined(RTE_LIBRTE_IEEE1588)
-	if (BIT_ISSET_AT_POS(annotation->word1, DPAA2_ETH_FAS_PTP))
+	if (BIT_ISSET_AT_POS(annotation->word1, DPAA2_ETH_FAS_PTP)) {
 		mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_PTP;
+		mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_TMST;
+	}
 #endif
 
 	if (BIT_ISSET_AT_POS(annotation->word3, L2_VLAN_1_PRESENT)) {
@@ -769,7 +771,10 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 		else
 			bufs[num_rx] = eth_fd_to_mbuf(fd, eth_data->port_id);
 #if defined(RTE_LIBRTE_IEEE1588)
-		priv->rx_timestamp = *dpaa2_timestamp_dynfield(bufs[num_rx]);
+		if (bufs[num_rx]->ol_flags & PKT_RX_IEEE1588_TMST) {
+			priv->rx_timestamp =
+				*dpaa2_timestamp_dynfield(bufs[num_rx]);
+		}
 #endif
 
 		if (eth_data->dev_conf.rxmode.offloads &
@@ -986,6 +991,13 @@ dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 				bufs[num_rx] = eth_fd_to_mbuf(fd,
 							eth_data->port_id);
 
+#if defined(RTE_LIBRTE_IEEE1588)
+		if (bufs[num_rx]->ol_flags & PKT_RX_IEEE1588_TMST) {
+			priv->rx_timestamp =
+				*dpaa2_timestamp_dynfield(bufs[num_rx]);
+		}
+#endif
+
 		if (eth_data->dev_conf.rxmode.offloads &
 				RTE_ETH_RX_OFFLOAD_VLAN_STRIP) {
 			rte_vlan_strip(bufs[num_rx]);
@@ -1021,6 +1033,8 @@ uint16_t dpaa2_dev_tx_conf(void *queue)
 	struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data;
 	struct dpaa2_dev_priv *priv = eth_data->dev_private;
 	struct dpaa2_annot_hdr *annotation;
+	void *v_addr;
+	struct rte_mbuf *mbuf;
 #endif
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
@@ -1105,10 +1119,16 @@ uint16_t dpaa2_dev_tx_conf(void *queue)
 			num_tx_conf++;
 			num_pulled++;
 #if defined(RTE_LIBRTE_IEEE1588)
-			annotation = (struct dpaa2_annot_hdr *)((size_t)
-				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)) +
-				DPAA2_FD_PTA_SIZE);
-			priv->tx_timestamp = annotation->word2;
+			v_addr = DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+			mbuf = DPAA2_INLINE_MBUF_FROM_BUF(v_addr,
+				rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size);
+
+			if (mbuf->ol_flags & PKT_TX_IEEE1588_TMST) {
+				annotation = (struct dpaa2_annot_hdr *)((size_t)
+					DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)) +
+					DPAA2_FD_PTA_SIZE);
+				priv->tx_timestamp = annotation->word2;
+			}
 #endif
 		} while (pending);
 
@@ -1184,8 +1204,11 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	 * corresponding to last packet transmitted for reading
 	 * the timestamp
 	 */
-	priv->next_tx_conf_queue = dpaa2_q->tx_conf_queue;
-	dpaa2_dev_tx_conf(dpaa2_q->tx_conf_queue);
+	if ((*bufs)->ol_flags & PKT_TX_IEEE1588_TMST) {
+		priv->next_tx_conf_queue = dpaa2_q->tx_conf_queue;
+		dpaa2_dev_tx_conf(dpaa2_q->tx_conf_queue);
+		priv->tx_timestamp = 0;
+	}
 #endif
 
 	/*Prepare enqueue descriptor*/
Signature · 1 line
2.17.1
#6 lore raw

PATCH 6/17 net/dpaa2: support multiple txqs en-queue for ordered

In reply to [email protected]

From: Jun Yang <[email protected]>

Support the tx enqueue in order queue mode, where queue id for each event may be different.

---
 drivers/event/dpaa2/dpaa2_eventdev.c |  12 ++-
 drivers/net/dpaa2/dpaa2_ethdev.h     |   4 +
 drivers/net/dpaa2/dpaa2_rxtx.c       | 142 +++++++++++++++++++++++++++
 drivers/net/dpaa2/version.map        |   1 +
 4 files changed, 155 insertions(+), 4 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev.c +8 -4
index 4d94c315d2..f3d8a7e4f1 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2017,2019 NXP
+ * Copyright 2017,2019-2021 NXP
  */
 
 #include <assert.h>
@@ -1003,16 +1003,20 @@ dpaa2_eventdev_txa_enqueue(void *port,
 			   struct rte_event ev[],
 			   uint16_t nb_events)
 {
-	struct rte_mbuf *m = (struct rte_mbuf *)ev[0].mbuf;
+	void *txq[32];
+	struct rte_mbuf *m[32];
 	uint8_t qid, i;
 
 	RTE_SET_USED(port);
 
 	for (i = 0; i < nb_events; i++) {
-		qid = rte_event_eth_tx_adapter_txq_get(m);
-		rte_eth_tx_burst(m->port, qid, &m, 1);
+		m[i] = (struct rte_mbuf *)ev[i].mbuf;
+		qid = rte_event_eth_tx_adapter_txq_get(m[i]);
+		txq[i] = rte_eth_devices[m[i]->port].data->tx_queues[qid];
 	}
 
+	dpaa2_dev_tx_multi_txq_ordered(txq, m, nb_events);
+
 	return nb_events;
 }
 
drivers/net/dpaa2/dpaa2_ethdev.h +4 -0
index c21571e63d..e001a7e49d 100644
@@ -241,6 +241,10 @@ void dpaa2_dev_process_ordered_event(struct qbman_swp *swp,
 uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 uint16_t dpaa2_dev_tx_ordered(void *queue, struct rte_mbuf **bufs,
 			      uint16_t nb_pkts);
+__rte_internal
+uint16_t dpaa2_dev_tx_multi_txq_ordered(void **queue,
+		struct rte_mbuf **bufs, uint16_t nb_pkts);
+
 uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 void dpaa2_dev_free_eqresp_buf(uint16_t eqresp_ci);
 void dpaa2_flow_clean(struct rte_eth_dev *dev);
drivers/net/dpaa2/dpaa2_rxtx.c +142 -0

148 lines not on this page · raw message

drivers/net/dpaa2/version.map +1 -0
index 2fe61f3442..cc82b8579d 100644
@@ -21,6 +21,7 @@ EXPERIMENTAL {
 INTERNAL {
 	global:
 
+	dpaa2_dev_tx_multi_txq_ordered;
 	dpaa2_eth_eventq_attach;
 	dpaa2_eth_eventq_detach;
 
Signature · 1 line
2.17.1
#7 lore raw

PATCH 7/17 net/dpaa2: add support for level 2 in traffic management

In reply to [email protected]

From: Gagandeep Singh <[email protected]>

This patch adds support for level 2 for QoS shaping.

---
 doc/guides/nics/dpaa2.rst           |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c    |  55 ++-
 drivers/net/dpaa2/dpaa2_ethdev.h    |   6 +-
 drivers/net/dpaa2/dpaa2_tm.c        | 563 ++++++++++++++++++++++------
 drivers/net/dpaa2/dpaa2_tm.h        |  17 +-
 drivers/net/dpaa2/mc/dpni.c         | 302 +++++++++------
 drivers/net/dpaa2/mc/fsl_dpni.h     | 119 +++---
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h |  79 ++--
 8 files changed, 791 insertions(+), 352 deletions(-)
doc/guides/nics/dpaa2.rst +1 -1
index 831bc56488..2d113f53df 100644
@@ -588,7 +588,7 @@ Supported Features
 
 The following capabilities are supported:
 
-- Level0 (root node) and Level1 are supported.
+- Level0 (root node), Level1 and Level2 are supported.
 - 1 private shaper at root node (port level) is supported.
 - 8 TX queues per port supported (1 channel per port)
 - Both SP and WFQ scheduling mechanisms are supported on all 8 queues.
drivers/net/dpaa2/dpaa2_ethdev.c +25 -30

127 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.h +5 -1
index e001a7e49d..1fc2fc367e 100644
@@ -25,6 +25,7 @@
 #define MAX_RX_QUEUES		128
 #define MAX_TX_QUEUES		16
 #define MAX_DPNI		8
+#define DPAA2_MAX_CHANNELS	16
 
 #define DPAA2_RX_DEFAULT_NBDESC 512
 
@@ -160,15 +161,17 @@ struct dpaa2_dev_priv {
 	void *rx_vq[MAX_RX_QUEUES];
 	void *tx_vq[MAX_TX_QUEUES];
 	struct dpaa2_bp_list *bp_list; /**<Attached buffer pool list */
-	void *tx_conf_vq[MAX_TX_QUEUES];
+	void *tx_conf_vq[MAX_TX_QUEUES * DPAA2_MAX_CHANNELS];
 	void *rx_err_vq;
 	uint8_t flags; /*dpaa2 config flags */
 	uint8_t max_mac_filters;
 	uint8_t max_vlan_filters;
 	uint8_t num_rx_tc;
+	uint8_t num_tx_tc;
 	uint16_t qos_entries;
 	uint16_t fs_entries;
 	uint8_t dist_queues;
+	uint8_t num_channels;
 	uint8_t en_ordered;
 	uint8_t en_loose_ordered;
 	uint8_t max_cgs;
@@ -190,6 +193,7 @@ struct dpaa2_dev_priv {
 
 	struct rte_eth_dev *eth_dev; /**< Pointer back to holding ethdev */
 
+	uint8_t channel_inuse;
 	LIST_HEAD(, rte_flow) flows; /**< Configured flow rule handles. */
 	LIST_HEAD(nodes, dpaa2_tm_node) nodes;
 	LIST_HEAD(shaper_profiles, dpaa2_tm_shaper_profile) shaper_profiles;
drivers/net/dpaa2/dpaa2_tm.c +457 -106

778 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_tm.h +16 -1
index 6632fab687..cfbb437322 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2020 NXP
+ * Copyright 2020-2021 NXP
  */
 
 #ifndef _DPAA2_TM_H_
@@ -7,6 +7,18 @@
 
 #include <rte_tm.h>
 
+enum node_type {
+	NON_LEAF_NODE = 0,
+	LEAF_NODE
+};
+
+enum level_type {
+	LNI_LEVEL = 0,
+	CHANNEL_LEVEL,
+	QUEUE_LEVEL,
+	MAX_LEVEL
+};
+
 struct dpaa2_tm_shaper_profile {
 	LIST_ENTRY(dpaa2_tm_shaper_profile) next;
 	uint32_t id;
@@ -18,6 +30,9 @@ struct dpaa2_tm_node {
 	LIST_ENTRY(dpaa2_tm_node) next;
 	uint32_t id;
 	uint32_t type;
+	uint32_t level_id;
+	uint16_t channel_id; /* Only for level 1 nodes */
+	uint16_t tc_id; /* Only for level 1 nodes */
 	int refcnt;
 	struct dpaa2_tm_node *parent;
 	struct dpaa2_tm_shaper_profile *profile;
drivers/net/dpaa2/mc/dpni.c +186 -116

323 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpni.h +62 -57

135 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpni_cmd.h +39 -40

110 lines not on this page · raw message

Signature · 1 line
2.17.1
#8 lore raw

PATCH 8/17 net/dpaa2: secondary process handling for dpni

In reply to [email protected]

From: Jun Yang <[email protected]>

This change uses 'dev->process_private' instead of 'priv->hw' to get dpmcp per process while setting flow distribution, as priv->hw is only valid for primary process.
It also initialize rte_dpaa2_bpid_info in secondary process.

---
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  | 23 +++++++++++++++++++++++
 drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 15 +++++++++++++++
 drivers/mempool/dpaa2/version.map         |  1 +
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c    |  5 ++---
 drivers/net/dpaa2/dpaa2_ethdev.c          | 10 ++++++++--
 drivers/net/dpaa2/dpaa2_ethdev.h          |  3 ++-
 6 files changed, 51 insertions(+), 6 deletions(-)
drivers/mempool/dpaa2/dpaa2_hw_mempool.c +23 -0
index 39c6252a63..56c629c681 100644
@@ -263,6 +263,29 @@ rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused,
 	}
 }
 
+int rte_dpaa2_bpid_info_init(struct rte_mempool *mp)
+{
+	struct dpaa2_bp_info *bp_info = mempool_to_bpinfo(mp);
+	uint32_t bpid = bp_info->bpid;
+
+	if (!rte_dpaa2_bpid_info) {
+		rte_dpaa2_bpid_info = (struct dpaa2_bp_info *)rte_malloc(NULL,
+				      sizeof(struct dpaa2_bp_info) * MAX_BPID,
+				      RTE_CACHE_LINE_SIZE);
+		if (rte_dpaa2_bpid_info == NULL)
+			return -ENOMEM;
+		memset(rte_dpaa2_bpid_info, 0,
+		       sizeof(struct dpaa2_bp_info) * MAX_BPID);
+	}
+
+	rte_dpaa2_bpid_info[bpid].meta_data_size = sizeof(struct rte_mbuf)
+				+ rte_pktmbuf_priv_size(mp);
+	rte_dpaa2_bpid_info[bpid].bp_list = bp_info->bp_list;
+	rte_dpaa2_bpid_info[bpid].bpid = bpid;
+
+	return 0;
+}
+
 uint16_t
 rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp)
 {
drivers/mempool/dpaa2/rte_dpaa2_mempool.h +15 -0
index 4a22b7c42e..28dea74326 100644
@@ -46,6 +46,21 @@ rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp);
 struct rte_mbuf *
 rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr);
 
+/**
+ * Initialize the rte_dpaa2_bpid_info
+ * In generial, it is called in the secondary process and
+ * mp has been created in the primary process.
+ *
+ * @param mp
+ *   memory pool
+ *
+ * @return
+ *  - 0 on success.
+ *  - (<0) on failure.
+ */
+__rte_internal
+int rte_dpaa2_bpid_info_init(struct rte_mempool *mp);
+
 #ifdef __cplusplus
 }
 #endif
drivers/mempool/dpaa2/version.map +1 -0
index 49c460ec54..cfd4ae617a 100644
@@ -11,5 +11,6 @@ INTERNAL {
 	global:
 
 	rte_dpaa2_bpid_info;
+	rte_dpaa2_bpid_info_init;
 	rte_dpaa2_mbuf_alloc_bulk;
 };
drivers/net/dpaa2/base/dpaa2_hw_dpni.c +2 -3
index 3170694841..9509f6e8a3 100644
@@ -95,7 +95,7 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
 	uint64_t req_dist_set, int tc_index)
 {
 	struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
-	struct fsl_mc_io *dpni = priv->hw;
+	struct fsl_mc_io *dpni = eth_dev->process_private;
 	struct dpni_rx_dist_cfg tc_cfg;
 	struct dpkg_profile_cfg kg_cfg;
 	void *p_params;
@@ -457,13 +457,12 @@ dpaa2_distset_to_dpkg_profile_cfg(
 
 int
 dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
-		     void *blist)
+	struct fsl_mc_io *dpni, void *blist)
 {
 	/* Function to attach a DPNI with a buffer pool list. Buffer pool list
 	 * handle is passed in blist.
 	 */
 	int32_t retcode;
-	struct fsl_mc_io *dpni = priv->hw;
 	struct dpni_pools_cfg bpool_cfg;
 	struct dpaa2_bp_list *bp_list = (struct dpaa2_bp_list *)blist;
 	struct dpni_buffer_layout layout;
drivers/net/dpaa2/dpaa2_ethdev.c +8 -2
index b91e773605..a45beed75f 100644
@@ -18,6 +18,7 @@
 #include <rte_dev.h>
 #include <rte_fslmc.h>
 #include <rte_flow_driver.h>
+#include "rte_dpaa2_mempool.h"
 
 #include "dpaa2_pmd_logs.h"
 #include <fslmc_vfio.h>
@@ -712,9 +713,14 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	if (!priv->bp_list || priv->bp_list->mp != mb_pool) {
+		if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+			ret = rte_dpaa2_bpid_info_init(mb_pool);
+			if (ret)
+				return ret;
+		}
 		bpid = mempool_to_bpid(mb_pool);
-		ret = dpaa2_attach_bp_list(priv,
-					   rte_dpaa2_bpid_info[bpid].bp_list);
+		ret = dpaa2_attach_bp_list(priv, dpni,
+				rte_dpaa2_bpid_info[bpid].bp_list);
 		if (ret)
 			return ret;
 	}
drivers/net/dpaa2/dpaa2_ethdev.h +2 -1
index 1fc2fc367e..bd33a22a8e 100644
@@ -208,7 +208,8 @@ int dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
 int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
 			   uint8_t tc_index);
 
-int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
+int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
+	struct fsl_mc_io *dpni, void *blist);
 
 __rte_internal
 int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
Signature · 1 line
2.17.1
#9 lore raw

PATCH 9/17 bus/fslmc: add and scan dprc devices

In reply to [email protected]

From: Jun Yang <[email protected]>

In order to get connection endpoint of each objects, scan the dprc object.

---
 drivers/bus/fslmc/fslmc_bus.c            |  15 ++-
 drivers/bus/fslmc/fslmc_vfio.c           |  18 +++-
 drivers/bus/fslmc/mc/dprc.c              | 129 +++++++++++++++++++++++
 drivers/bus/fslmc/mc/fsl_dprc.h          |  46 ++++++++
 drivers/bus/fslmc/mc/fsl_dprc_cmd.h      |  48 +++++++++
 drivers/bus/fslmc/meson.build            |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c | 100 ++++++++++++++++++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h  |  12 +++
 drivers/bus/fslmc/rte_fslmc.h            |  10 +-
 9 files changed, 374 insertions(+), 8 deletions(-)
 create mode 100644 drivers/bus/fslmc/mc/dprc.c
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc.h
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc_cmd.h
 create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
drivers/bus/fslmc/fslmc_bus.c +10 -5
index a0ef24cdc8..a3c0d838c4 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016,2018-2019 NXP
+ *   Copyright 2016,2018-2021 NXP
  *
  */
 
@@ -136,10 +136,6 @@ scan_one_fslmc_device(char *dev_name)
 	if (!dev_name)
 		return ret;
 
-	/* Ignore the Container name itself */
-	if (!strncmp("dprc", dev_name, 4))
-		return 0;
-
 	/* Creating a temporary copy to perform cut-parse over string */
 	dup_dev_name = strdup(dev_name);
 	if (!dup_dev_name) {
@@ -197,6 +193,8 @@ scan_one_fslmc_device(char *dev_name)
 		dev->dev_type = DPAA2_MUX;
 	else if (!strncmp("dprtc", t_ptr, 5))
 		dev->dev_type = DPAA2_DPRTC;
+	else if (!strncmp("dprc", t_ptr, 4))
+		dev->dev_type = DPAA2_DPRC;
 	else
 		dev->dev_type = DPAA2_UNKNOWN;
 
@@ -339,6 +337,13 @@ rte_fslmc_scan(void)
 		goto scan_fail;
 	}
 
+	/* Scan the DPRC container object */
+	ret = scan_one_fslmc_device(fslmc_container);
+	if (ret != 0) {
+		/* Error in parsing directory - exit gracefully */
+		goto scan_fail_cleanup;
+	}
+
 	while ((entry = readdir(dir)) != NULL) {
 		if (entry->d_name[0] == '.' || entry->d_type != DT_DIR)
 			continue;
drivers/bus/fslmc/fslmc_vfio.c +17 -1
index b4704eeae4..1b89a56bbc 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016-2019 NXP
+ *   Copyright 2016-2021 NXP
  *
  */
 
@@ -728,6 +728,7 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev)
 	case DPAA2_BPOOL:
 	case DPAA2_DPRTC:
 	case DPAA2_MUX:
+	case DPAA2_DPRC:
 		TAILQ_FOREACH(object, &dpaa2_obj_list, next) {
 			if (dev->dev_type == object->dev_type)
 				object->create(dev_fd, &device_info,
@@ -881,6 +882,21 @@ fslmc_vfio_process_group(void)
 		return -1;
 	}
 
+	/* Search for DPRC device next as it updates endpoint of
+	 * other devices.
+	 */
+	current_device = 0;
+	RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
+		if (dev->dev_type == DPAA2_DPRC) {
+			ret = fslmc_process_iodevices(dev);
+			if (ret) {
+				DPAA2_BUS_ERR("Unable to process dprc");
+				return -1;
+			}
+			TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next);
+		}
+	}
+
 	current_device = 0;
 	RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next,
 		dev_temp) {
drivers/bus/fslmc/mc/dprc.c new file +129 -0

129 lines not on this page · raw message

drivers/bus/fslmc/mc/fsl_dprc.h new file +46 -0

46 lines not on this page · raw message

drivers/bus/fslmc/mc/fsl_dprc_cmd.h new file +48 -0

48 lines not on this page · raw message

drivers/bus/fslmc/meson.build +3 -1
index 54be76f516..162ca286fe 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright 2018 NXP
+# Copyright 2018,2021 NXP
 
 if not is_linux
     build = false
@@ -16,10 +16,12 @@ sources = files(
         'mc/dpdmai.c',
         'mc/dpio.c',
         'mc/dpmng.c',
+        'mc/dprc.c',
         'mc/mc_sys.c',
         'portal/dpaa2_hw_dpbp.c',
         'portal/dpaa2_hw_dpci.c',
         'portal/dpaa2_hw_dpio.c',
+        'portal/dpaa2_hw_dprc.c',
         'qbman/qbman_portal.c',
         'qbman/qbman_debug.c',
 )
drivers/bus/fslmc/portal/dpaa2_hw_dprc.c new file +100 -0

100 lines not on this page · raw message

drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +12 -0
index b1bba1ac36..8cb4d404aa 100644
@@ -187,6 +187,18 @@ struct swp_active_dqs {
 
 extern struct swp_active_dqs rte_global_active_dqs_list[NUM_MAX_SWP];
 
+/**
+ * A structure describing a DPAA2 container.
+ */
+struct dpaa2_dprc_dev {
+	TAILQ_ENTRY(dpaa2_dprc_dev) next;
+		/**< Pointer to Next device instance */
+	const char *name;
+	struct fsl_mc_io dprc;  /** handle to DPRC portal object */
+	uint16_t token;
+	uint32_t dprc_id; /*HW ID for DPRC object */
+};
+
 struct dpaa2_dpci_dev {
 	TAILQ_ENTRY(dpaa2_dpci_dev) next;
 		/**< Pointer to Next device instance */
drivers/bus/fslmc/rte_fslmc.h +9 -1
index 729f360646..12b586b13b 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016,2019 NXP
+ *   Copyright 2016,2021 NXP
  *
  */
 
@@ -37,6 +37,9 @@ extern "C" {
 
 #include <fslmc_vfio.h>
 
+#include "portal/dpaa2_hw_pvt.h"
+#include "portal/dpaa2_hw_dpio.h"
+
 #define FSLMC_OBJECT_MAX_LEN 32   /**< Length of each device on bus */
 
 #define DPAA2_INVALID_MBUF_SEQN        0
@@ -88,6 +91,8 @@ enum rte_dpaa2_dev_type {
 	DPAA2_QDMA,     /**< DPDMAI type device */
 	DPAA2_MUX,	/**< DPDMUX type device */
 	DPAA2_DPRTC,	/**< DPRTC type device */
+	DPAA2_DPRC,	/**< DPRC type device */
+	DPAA2_MAC,	/**< DPMAC type device */
 	/* Unknown device placeholder */
 	DPAA2_UNKNOWN,
 	DPAA2_DEVTYPE_MAX,
@@ -122,6 +127,9 @@ struct rte_dpaa2_device {
 	};
 	enum rte_dpaa2_dev_type dev_type;   /**< Device Type */
 	uint16_t object_id;                 /**< DPAA2 Object ID */
+	enum rte_dpaa2_dev_type ep_dev_type;   /**< Endpoint Device Type */
+	uint16_t ep_object_id;                 /**< Endpoint DPAA2 Object ID */
+	char ep_name[RTE_DEV_NAME_MAX_LEN];
 	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
 	struct rte_dpaa2_driver *driver;    /**< Associated driver */
 	char name[FSLMC_OBJECT_MAX_LEN];    /**< DPAA2 Object name*/
Signature · 1 line
2.17.1
#10 lore raw

PATCH 10/17 net/dpaa2: support recycle loopback port

In reply to [email protected]

From: Jun Yang <[email protected]>

DPAA2 recycle port is used for configuring the device in the loopback mode. Loopback configuraiton can be at dpni level or at serdes level.

---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h |   3 +-
 drivers/net/dpaa2/dpaa2_ethdev.c        |  32 +-
 drivers/net/dpaa2/dpaa2_ethdev.h        |  23 +
 drivers/net/dpaa2/dpaa2_recycle.c       | 780 ++++++++++++++++++++++++
 drivers/net/dpaa2/mc/dpni.c             |  32 +
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h     |   1 +
 drivers/net/dpaa2/meson.build           |   1 +
 7 files changed, 870 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/dpaa2/dpaa2_recycle.c
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +2 -1
index 8cb4d404aa..4d0f7e4b5d 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016-2020 NXP
+ *   Copyright 2016-2021 NXP
  *
  */
 
@@ -176,6 +176,7 @@ struct dpaa2_queue {
 	uint16_t nb_desc;
 	uint16_t resv;
 	uint64_t offloads;
+	uint64_t lpbk_cntx;
 } __rte_cache_aligned;
 
 struct swp_active_dqs {
drivers/net/dpaa2/dpaa2_ethdev.c +31 -1
index a45beed75f..d81f8cb07a 100644
@@ -668,6 +668,30 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
 	if (rx_offloads & RTE_ETH_RX_OFFLOAD_VLAN_FILTER)
 		dpaa2_vlan_offload_set(dev, RTE_ETH_VLAN_FILTER_MASK);
 
+	if (eth_conf->lpbk_mode) {
+		ret = dpaa2_dev_recycle_config(dev);
+		if (ret) {
+			DPAA2_PMD_ERR("Error to configure %s to recycle port.",
+				dev->data->name);
+
+			return ret;
+		}
+	} else {
+		/** User may disable loopback mode by calling
+		 * "dev_configure" with lpbk_mode cleared.
+		 * No matter the port was configured recycle or not,
+		 * recycle de-configure is called here.
+		 * If port is not recycled, the de-configure will return directly.
+		 */
+		ret = dpaa2_dev_recycle_deconfig(dev);
+		if (ret) {
+			DPAA2_PMD_ERR("Error to de-configure recycle port %s.",
+				dev->data->name);
+
+			return ret;
+		}
+	}
+
 	dpaa2_tm_init(dev);
 
 	return 0;
@@ -2601,6 +2625,9 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 		return -1;
 	}
 
+	if (eth_dev->data->dev_conf.lpbk_mode)
+		dpaa2_dev_recycle_deconfig(eth_dev);
+
 	/* Clean the device first */
 	ret = dpni_reset(dpni_dev, CMD_PRI_LOW, priv->token);
 	if (ret) {
@@ -2624,6 +2651,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	priv->dist_queues = attr.num_queues;
 	priv->num_channels = attr.num_channels;
 	priv->channel_inuse = 0;
+	rte_spinlock_init(&priv->lpbk_qp_lock);
 
 	/* only if the custom CG is enabled */
 	if (attr.options & DPNI_OPT_CUSTOM_CG)
@@ -2808,7 +2836,9 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 			return ret;
 		}
 	}
-	RTE_LOG(INFO, PMD, "%s: netdev created\n", eth_dev->data->name);
+	RTE_LOG(INFO, PMD, "%s: netdev created, connected to %s\n",
+		eth_dev->data->name, dpaa2_dev->ep_name);
+
 	return 0;
 init_err:
 	dpaa2_dev_close(eth_dev);
drivers/net/dpaa2/dpaa2_ethdev.h +23 -0
index bd33a22a8e..b032da9eff 100644
@@ -11,6 +11,7 @@
 #include <rte_event_eth_rx_adapter.h>
 #include <rte_pmd_dpaa2.h>
 
+#include <rte_fslmc.h>
 #include <dpaa2_hw_pvt.h>
 #include "dpaa2_tm.h"
 
@@ -65,6 +66,18 @@
 /* Tx confirmation enabled */
 #define DPAA2_TX_CONF_ENABLE	0x06
 
+/* HW loopback the egress traffic to self ingress*/
+#define DPAA2_TX_MAC_LOOPBACK_MODE 0x20
+
+#define DPAA2_TX_SERDES_LOOPBACK_MODE 0x40
+
+#define DPAA2_TX_DPNI_LOOPBACK_MODE 0x80
+
+#define DPAA2_TX_LOOPBACK_MODE \
+	(DPAA2_TX_MAC_LOOPBACK_MODE | \
+	DPAA2_TX_SERDES_LOOPBACK_MODE | \
+	DPAA2_TX_DPNI_LOOPBACK_MODE)
+
 #define DPAA2_RSS_OFFLOAD_ALL ( \
 	RTE_ETH_RSS_L2_PAYLOAD | \
 	RTE_ETH_RSS_IP | \
@@ -192,6 +205,7 @@ struct dpaa2_dev_priv {
 	struct dpaa2_queue *next_tx_conf_queue;
 
 	struct rte_eth_dev *eth_dev; /**< Pointer back to holding ethdev */
+	rte_spinlock_t lpbk_qp_lock;
 
 	uint8_t channel_inuse;
 	LIST_HEAD(, rte_flow) flows; /**< Configured flow rule handles. */
@@ -268,4 +282,13 @@ int dpaa2_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
 						uint32_t flags __rte_unused);
 int dpaa2_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 					  struct timespec *timestamp);
+
+int dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev);
+int dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev);
+int dpaa2_dev_recycle_qp_setup(struct rte_dpaa2_device *dpaa2_dev,
+	uint16_t qidx, uint64_t cntx,
+	eth_rx_burst_t tx_lpbk, eth_tx_burst_t rx_lpbk,
+	struct dpaa2_queue **txq,
+	struct dpaa2_queue **rxq);
+
 #endif /* _DPAA2_ETHDEV_H */
drivers/net/dpaa2/dpaa2_recycle.c new file +780 -0

780 lines not on this page · raw message

drivers/net/dpaa2/mc/dpni.c +32 -0
index b7a65cb637..7a2bc15eb4 100644
@@ -3087,3 +3087,35 @@ int dpni_get_custom_tpid(struct fsl_mc_io *mc_io, uint32_t cmd_flags,
 	return err;
 }
 
+/**
+ * dpni_set_port_cfg() - performs configurations at physical port connected on
+ *		this dpni. The command have effect only if dpni is connected to
+ *		another dpni object
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPNI object
+ * @flags:	Valid fields from port_cfg structure
+ * @port_cfg: Configuration data; one or more of DPNI_PORT_CFG_
+ * The command can be called only when dpni is connected to a dpmac object. If
+ * the dpni is unconnected or the endpoint is not a dpni it will return error.
+ * If dpmac endpoint is disconnected the settings will be lost
+ */
+int dpni_set_port_cfg(struct fsl_mc_io *mc_io, uint32_t cmd_flags,
+		uint16_t token, uint32_t flags, struct dpni_port_cfg *port_cfg)
+{
+	struct dpni_cmd_set_port_cfg *cmd_params;
+	struct mc_command cmd = { 0 };
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_PORT_CFG,
+			cmd_flags, token);
+
+	cmd_params = (struct dpni_cmd_set_port_cfg *)cmd.params;
+	cmd_params->flags = cpu_to_le32(flags);
+	dpni_set_field(cmd_params->bit_params,	PORT_LOOPBACK_EN,
+			!!port_cfg->loopback_en);
+
+	/* send command to MC */
+	return mc_send_command(mc_io, &cmd);
+}
+
drivers/net/dpaa2/mc/fsl_dpni_cmd.h +1 -0
index ed0bd7615a..b7bd7556af 100644
@@ -119,6 +119,7 @@
 #define DPNI_CMDID_REMOVE_CUSTOM_TPID		DPNI_CMD(0x276)
 #define DPNI_CMDID_GET_CUSTOM_TPID		DPNI_CMD(0x277)
 #define DPNI_CMDID_GET_LINK_CFG			DPNI_CMD(0x278)
+#define DPNI_CMDID_SET_PORT_CFG			DPNI_CMD(0x27B)
 
 /* Macros for accessing command fields smaller than 1byte */
 #define DPNI_MASK(field)	\
drivers/net/dpaa2/meson.build +1 -0
index 21b827a259..51598c048c 100644
@@ -14,6 +14,7 @@ sources = files(
         'dpaa2_mux.c',
         'dpaa2_ethdev.c',
         'dpaa2_flow.c',
+        'dpaa2_recycle.c',
         'dpaa2_rxtx.c',
         'dpaa2_sparser.c',
         'dpaa2_ptp.c',
Signature · 1 line
2.17.1
#11 lore raw

PATCH 11/17 net/dpaa: check status before configuring shared MAC

In reply to [email protected]

From: Nipun Gupta <[email protected]>

For shared MAC interface, it is a prerequisite to enable the interface in the kernel, before using it in user-space. This patch makes sure that device is not getting configured in case shared MAC interface is not enabled in the kernel.

---
 drivers/bus/dpaa/base/fman/fman_hw.c | 11 +++++++++++
 drivers/bus/dpaa/include/fsl_fman.h  |  2 ++
 drivers/bus/dpaa/version.map         |  1 +
 drivers/net/dpaa/dpaa_ethdev.c       | 13 ++++++++++++-
 4 files changed, 26 insertions(+), 1 deletion(-)
drivers/bus/dpaa/base/fman/fman_hw.c +11 -0
index af9bac76c2..24a99f7235 100644
@@ -314,6 +314,17 @@ fman_if_disable_rx(struct fman_if *p)
 	out_be32(__if->ccsr_map + 8, in_be32(__if->ccsr_map + 8) & ~(u32)2);
 }
 
+int
+fman_if_get_rx_status(struct fman_if *p)
+{
+	struct __fman_if *__if = container_of(p, struct __fman_if, __if);
+
+	assert(fman_ccsr_map_fd != -1);
+
+	/* return true if RX bit is set */
+	return !!(in_be32(__if->ccsr_map + 8) & (u32)2);
+}
+
 void
 fman_if_loopback_enable(struct fman_if *p)
 {
drivers/bus/dpaa/include/fsl_fman.h +2 -0
index f3a5d05970..acb344584f 100644
@@ -81,6 +81,8 @@ __rte_internal
 void fman_if_enable_rx(struct fman_if *p);
 __rte_internal
 void fman_if_disable_rx(struct fman_if *p);
+__rte_internal
+int fman_if_get_rx_status(struct fman_if *p);
 
 /* Enable/disable loopback on specific interfaces */
 __rte_internal
drivers/bus/dpaa/version.map +1 -0
index 900635b210..1a840fd1a5 100644
@@ -33,6 +33,7 @@ INTERNAL {
 	fman_if_get_fdoff;
 	fman_if_get_maxfrm;
 	fman_if_get_sg_enable;
+	fman_if_get_rx_status;
 	fman_if_loopback_disable;
 	fman_if_loopback_enable;
 	fman_if_promiscuous_disable;
drivers/net/dpaa/dpaa_ethdev.c +12 -1
index e49f765434..3972ecaed8 100644
@@ -195,6 +195,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	struct rte_eth_conf *eth_conf = &dev->data->dev_conf;
 	uint64_t rx_offloads = eth_conf->rxmode.offloads;
 	uint64_t tx_offloads = eth_conf->txmode.offloads;
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 	struct rte_device *rdev = dev->device;
 	struct rte_eth_link *link = &dev->data->dev_link;
 	struct rte_dpaa_device *dpaa_dev;
@@ -203,7 +204,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	struct rte_intr_handle *intr_handle;
 	uint32_t max_rx_pktlen;
 	int speed, duplex;
-	int ret;
+	int ret, rx_status;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -211,6 +212,16 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	intr_handle = dpaa_dev->intr_handle;
 	__fif = container_of(fif, struct __fman_if, __if);
 
+	/* Check if interface is enabled in case of shared MAC */
+	if (fif->is_shared_mac) {
+		rx_status = fman_if_get_rx_status(fif);
+		if (!rx_status) {
+			DPAA_PMD_ERR("%s Interface not enabled in kernel!",
+				     dpaa_intf->name);
+			return -EHOSTDOWN;
+		}
+	}
+
 	/* Rx offloads which are enabled by default */
 	if (dev_rx_offloads_nodis & ~rx_offloads) {
 		DPAA_PMD_INFO(
Signature · 1 line
2.17.1
#12 lore raw

PATCH 12/17 net/dpaa: enable checksum for shared MAC interface

In reply to [email protected]

From: Nipun Gupta <[email protected]>

In case of shared MAC B0V bit in contextA is required to be set to set so that ASPID is 0.

---
 drivers/net/dpaa/dpaa_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/dpaa/dpaa_ethdev.c +4 -0
index 3972ecaed8..7135a5998d 100644
@@ -1755,6 +1755,10 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 	/* no tx-confirmation */
 	opts.fqd.context_a.hi = 0x80000000 | fman_dealloc_bufs_mask_hi;
 	opts.fqd.context_a.lo = 0 | fman_dealloc_bufs_mask_lo;
+	if (fman_ip_rev >= FMAN_V3) {
+		/* Set B0V bit in contextA to set ASPID to 0 */
+		opts.fqd.context_a.hi |= 0x04000000;
+	}
 	DPAA_PMD_DEBUG("init tx fq %p, fqid 0x%x", fq, fq->fqid);
 
 	if (cgr_tx) {
Signature · 1 line
2.17.1
#13 lore raw

PATCH 13/17 net/enetc: add support for VFs

In reply to [email protected]

From: Gagandeep Singh <[email protected]>

Add virtual function support for enetc devices

---
 drivers/net/enetc/enetc_ethdev.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)
drivers/net/enetc/enetc_ethdev.c +20 -5
index 7cdb8ce463..1b4337bc48 100644
@@ -19,6 +19,9 @@ enetc_dev_start(struct rte_eth_dev *dev)
 	uint32_t val;
 
 	PMD_INIT_FUNC_TRACE();
+	if (hw->device_id == ENETC_DEV_ID_VF)
+		return 0;
+
 	val = enetc_port_rd(enetc_hw, ENETC_PM0_CMD_CFG);
 	enetc_port_wr(enetc_hw, ENETC_PM0_CMD_CFG,
 		      val | ENETC_PM0_TX_EN | ENETC_PM0_RX_EN);
@@ -55,6 +58,9 @@ enetc_dev_stop(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 	dev->data->dev_started = 0;
+	if (hw->device_id == ENETC_DEV_ID_VF)
+		return 0;
+
 	/* Disable port */
 	val = enetc_port_rd(enetc_hw, ENETC_PMR);
 	enetc_port_wr(enetc_hw, ENETC_PMR, val & (~ENETC_PMR_EN));
@@ -160,11 +166,20 @@ enetc_hardware_init(struct enetc_eth_hw *hw)
 	/* Enabling Station Interface */
 	enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN);
 
-	*mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
-	high_mac = (uint32_t)*mac;
-	mac++;
-	*mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
-	low_mac = (uint16_t)*mac;
+
+	if (hw->device_id == ENETC_DEV_ID_VF) {
+		*mac = (uint32_t)enetc_rd(enetc_hw, ENETC_SIPMAR0);
+		high_mac = (uint32_t)*mac;
+		mac++;
+		*mac = (uint32_t)enetc_rd(enetc_hw, ENETC_SIPMAR1);
+		low_mac = (uint16_t)*mac;
+	} else {
+		*mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
+		high_mac = (uint32_t)*mac;
+		mac++;
+		*mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
+		low_mac = (uint16_t)*mac;
+	}
 
 	if ((high_mac | low_mac) == 0) {
 		char *first_byte;
Signature · 1 line
2.17.1
#14 lore raw

PATCH 14/17 net/pfe: disable HW CRC stripping

In reply to [email protected]

From: Gagandeep Singh <[email protected]>

LS1012A MAC PCS block has an erratum that is seen with specific PHY AR803x. The issue is triggered by the (spec-compliant) operation of the AR803x PHY on the LS1012A-FRWY board.

Due to this, good FCS packet is reported as error packet by MAC, so for these error packets FCS should be validated and discard only real error packets in PFE engine Rx packet path. Now onwards CRC validation will be handled in pfe.ko and DPDK driver can not use CRC Forwarding option.

---
 drivers/net/pfe/pfe_ethdev.c | 7 +++++--
 drivers/net/pfe/pfe_hal.c    | 4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/pfe/pfe_ethdev.c +5 -2
index 047010e15e..bfcaf51dd9 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2019 NXP
+ * Copyright 2018-2020 NXP
  */
 
 #include <sys/ioctl.h>
@@ -422,8 +422,11 @@ pfe_eth_close(struct rte_eth_dev *dev)
 }
 
 static int
-pfe_eth_configure(struct rte_eth_dev *dev __rte_unused)
+pfe_eth_configure(struct rte_eth_dev *dev)
 {
+	if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC)
+		PFE_PMD_ERR("PMD does not support KEEP_CRC offload");
+
 	return 0;
 }
 
drivers/net/pfe/pfe_hal.c +2 -2
index 41d783dbff..f49d1728b2 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2019 NXP
+ * Copyright 2018-2020 NXP
  */
 
 #include <arpa/inet.h>
@@ -191,7 +191,7 @@ gemac_set_mode(void *base, __rte_unused int mode)
 	val &= ~EMAC_RCNTRL_LOOP;
 
 	/*Enable flow control and MII mode*/
-	val |= (EMAC_RCNTRL_FCE | EMAC_RCNTRL_MII_MODE | EMAC_RCNTRL_CRC_FWD);
+	val |= (EMAC_RCNTRL_FCE | EMAC_RCNTRL_MII_MODE);
 
 	writel(val, base + EMAC_RCNTRL_REG);
 }
Signature · 1 line
2.17.1
#15 lore raw

PATCH 15/17 net/pfe: reduce driver initialization time

In reply to [email protected]

From: Gagandeep Singh <[email protected]>

This patch reduces the delay in the device init.

---
 drivers/net/pfe/pfe_hif.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/pfe/pfe_hif.c +4 -2
index c4a7154ba7..eade726b2e 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2019 NXP
+ * Copyright 2018-2020 NXP
  */
 
 #include "pfe_logs.h"
@@ -9,6 +9,8 @@
 #include <sys/eventfd.h>
 #include <arpa/inet.h>
 
+#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+#define msleep(x) rte_delay_us(1000 * (x))
 static int
 pfe_hif_alloc_descr(struct pfe_hif *hif)
 {
@@ -766,7 +768,7 @@ pfe_hif_rx_idle(struct pfe_hif *hif)
 		if (rx_status & BDP_CSR_RX_DMA_ACTV)
 			send_dummy_pkt_to_hif();
 
-		sleep(1);
+		msleep(DIV_ROUND_UP(100, 1000));
 	} while (--hif_stop_loop);
 
 	if (readl(HIF_RX_STATUS) & BDP_CSR_RX_DMA_ACTV)
Signature · 1 line
2.17.1
#16 lore raw

PATCH 16/17 net/pfe: remove setting unused value

In reply to [email protected]

From: Apeksha Gupta <[email protected]>

remove setting link status where it is not being used

---
 drivers/net/pfe/pfe_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/pfe/pfe_ethdev.c +1 -2
index bfcaf51dd9..5a3008cbb5 100644
@@ -590,8 +590,7 @@ pfe_eth_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
 		ret = ioctl(priv->link_fd, ioctl_cmd, &lstatus);
 		if (ret != 0) {
 			PFE_PMD_ERR("Unable to fetch link status (ioctl)\n");
-			/* use dummy link value */
-			link.link_status = 1;
+			return -1;
 		}
 		PFE_PMD_DEBUG("Fetched link state (%d) for dev %d.\n",
 			      lstatus, priv->id);
Signature · 1 line
2.17.1
#17 lore raw

PATCH 17/17 net/pfe: fix for 32 bit and PPC compilation

In reply to [email protected]

From: Sachin Saxena <[email protected]>

This patch fixes compilation for 32 bit and power PC compiler.

Fixes 36220514de01 ("net/pfe: add Rx/Tx")
---
 drivers/net/pfe/pfe_hif.c     | 3 ++-
 drivers/net/pfe/pfe_hif_lib.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/pfe/pfe_hif.c +2 -1
index eade726b2e..67efb8b3a7 100644
@@ -309,7 +309,8 @@ client_put_rxpacket(struct hif_rx_queue *queue,
 
 
 	if (readl(&desc->ctrl) & CL_DESC_OWN) {
-		mbuf = rte_cpu_to_le_64(rte_pktmbuf_alloc(pool));
+		mbuf = (struct rte_mbuf *)
+			rte_cpu_to_le_64((uintptr_t)rte_pktmbuf_alloc(pool));
 		if (unlikely(!mbuf)) {
 			PFE_PMD_WARN("Buffer allocation failure\n");
 			return NULL;
drivers/net/pfe/pfe_hif_lib.c +2 -1
index 799050dce3..2487273a7c 100644
@@ -50,7 +50,8 @@ pfe_hif_shm_init(struct hif_shm *hif_shm, struct rte_mempool *mb_pool)
 	hif_shm->rx_buf_pool_cnt = HIF_RX_DESC_NT;
 
 	for (i = 0; i < hif_shm->rx_buf_pool_cnt; i++) {
-		mbuf = rte_cpu_to_le_64(rte_pktmbuf_alloc(mb_pool));
+		mbuf = (struct rte_mbuf *)
+			rte_cpu_to_le_64((uintptr_t)rte_pktmbuf_alloc(mb_pool));
 		if (mbuf)
 			hif_shm->rx_buf_pool[i] = mbuf;
 		else
Signature · 1 line
2.17.1
#18 lore raw

v2 cover features and fixes on NXP eth devices

In reply to [email protected]

From: Nipun Gupta <[email protected]>

This series adds few features and important fixes on DPAA, PFE and ENETC devices.

Features added:
- level 2 support for shaping on DPAA2
- loopback configuration for DPNI devices on DPAA2
- Multiple TXQ's enqueue for ordered queues for performance
- VFs support on ENETC

Fixes:
- fix unregistering interrupt handler on DPAA2
- fix timestamping for IEEE1588 on DPAA1

Changes in v2:
- fix checkpatch errors

Apeksha Gupta (1):
net/pfe: remove setting unused value

Gagandeep Singh (4):
net/dpaa2: add support for level 2 in traffic management net/enetc: add support for VFs
net/pfe: disable HW CRC stripping
net/pfe: reduce driver initialization time

Jun Yang (4):
net/dpaa2: support multiple txqs en-queue for ordered net/dpaa2: secondary process handling for dpni bus/fslmc: add and scan dprc devices net/dpaa2: support recycle loopback port

Nipun Gupta (4):
bus/fslmc: update MC to 10.29
bus/fslmc: use dmb oshst for synchronization before I/O net/dpaa: check status before configuring shared MAC net/dpaa: enable checksum for shared MAC interface

Rohit Raj (1):
net/dpaa2: warn user in case of high nb desc

Vanshika Shukla (2):
net/dpaa2: fix unregistering interrupt handler
net/dpaa2: fix timestamping for IEEE1588

 doc/guides/nics/dpaa2.rst                 |   2 +-
 drivers/bus/dpaa/base/fman/fman_hw.c      |  11 +
 drivers/bus/dpaa/include/fsl_fman.h       |   2 +
 drivers/bus/dpaa/version.map              |   1 +
 drivers/bus/fslmc/fslmc_bus.c             |  15 +-
 drivers/bus/fslmc/fslmc_vfio.c            |  18 +-
 drivers/bus/fslmc/mc/dprc.c               | 129 ++++
 drivers/bus/fslmc/mc/fsl_dpmng.h          |   2 +-
 drivers/bus/fslmc/mc/fsl_dprc.h           |  46 ++
 drivers/bus/fslmc/mc/fsl_dprc_cmd.h       |  48 ++
 drivers/bus/fslmc/meson.build             |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c  | 100 +++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   |  15 +-
 drivers/bus/fslmc/qbman/include/compat.h  |   4 +-
 drivers/bus/fslmc/rte_fslmc.h             |  10 +-
 drivers/event/dpaa2/dpaa2_eventdev.c      |  12 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  |  23 +
 drivers/mempool/dpaa2/rte_dpaa2_mempool.h |  15 +
 drivers/mempool/dpaa2/version.map         |   1 +
 drivers/net/dpaa/dpaa_ethdev.c            |  17 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c    |   5 +-
 drivers/net/dpaa2/dpaa2_ethdev.c          | 117 +++-
 drivers/net/dpaa2/dpaa2_ethdev.h          |  38 +-
 drivers/net/dpaa2/dpaa2_ptp.c             |   8 +-
 drivers/net/dpaa2/dpaa2_recycle.c         | 780 ++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_rxtx.c            | 181 ++++-
 drivers/net/dpaa2/dpaa2_tm.c              | 563 +++++++++++++---
 drivers/net/dpaa2/dpaa2_tm.h              |  17 +-
 drivers/net/dpaa2/mc/dpdmux.c             |   8 +
 drivers/net/dpaa2/mc/dpkg.c               |   7 +-
 drivers/net/dpaa2/mc/dpni.c               | 417 ++++++++----
 drivers/net/dpaa2/mc/fsl_dpdmux.h         |   3 +
 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h     |   5 +-
 drivers/net/dpaa2/mc/fsl_dpni.h           | 173 +++--
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h       | 137 ++--
 drivers/net/dpaa2/meson.build             |   1 +
 drivers/net/dpaa2/version.map             |   1 +
 drivers/net/enetc/enetc_ethdev.c          |  25 +-
 drivers/net/pfe/pfe_ethdev.c              |  10 +-
 drivers/net/pfe/pfe_hal.c                 |   4 +-
 drivers/net/pfe/pfe_hif.c                 |   6 +-
 41 files changed, 2528 insertions(+), 453 deletions(-)
 create mode 100644 drivers/bus/fslmc/mc/dprc.c
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc.h
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc_cmd.h
 create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
 create mode 100644 drivers/net/dpaa2/dpaa2_recycle.c
Signature · 1 line
2.17.1
#19 lore raw

PATCH v2 1/16 bus/fslmc: update MC to 10.29

From: Nipun Gupta <[email protected]>

update MC firmware library version to 10.29

---
 drivers/bus/fslmc/mc/fsl_dpmng.h      |   2 +-
 drivers/net/dpaa2/mc/dpdmux.c         |   8 ++
 drivers/net/dpaa2/mc/dpkg.c           |   7 +-
 drivers/net/dpaa2/mc/dpni.c           | 111 ++++++++++++++++++++------
 drivers/net/dpaa2/mc/fsl_dpdmux.h     |   3 +
 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h |   5 +-
 drivers/net/dpaa2/mc/fsl_dpni.h       |  54 ++++++++++---
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h   |  57 +++++++------
 8 files changed, 181 insertions(+), 66 deletions(-)
drivers/bus/fslmc/mc/fsl_dpmng.h +1 -1
index 7e9bd96429..073d47efbf 100644
@@ -20,7 +20,7 @@ struct fsl_mc_io;
  * Management Complex firmware version information
  */
 #define MC_VER_MAJOR 10
-#define MC_VER_MINOR 28
+#define MC_VER_MINOR 29
 
 /**
  * struct mc_version
drivers/net/dpaa2/mc/dpdmux.c +8 -0
index edbb01b45b..1bb153cad7 100644
@@ -398,6 +398,9 @@ int dpdmux_get_attributes(struct fsl_mc_io *mc_io,
 	attr->num_ifs = le16_to_cpu(rsp_params->num_ifs);
 	attr->mem_size = le16_to_cpu(rsp_params->mem_size);
 	attr->default_if = le16_to_cpu(rsp_params->default_if);
+	attr->max_dmat_entries = le16_to_cpu(rsp_params->max_dmat_entries);
+	attr->max_mc_groups = le16_to_cpu(rsp_params->max_mc_groups);
+	attr->max_vlan_ids = le16_to_cpu(rsp_params->max_vlan_ids);
 
 	return 0;
 }
@@ -470,6 +473,11 @@ int dpdmux_if_disable(struct fsl_mc_io *mc_io,
  * will be updated with the minimum value of the mfls of the connected
  * dpnis and the actual value of dmux mfl.
  *
+ * If dpdmux object is created using DPDMUX_OPT_AUTO_MAX_FRAME_LEN and maximum
+ * frame length is changed for a dpni connected to dpdmux interface the change
+ * is propagated through dpdmux interfaces and will overwrite the value set using
+ * this API.
+ *
  * Return:	'0' on Success; Error code otherwise.
  */
 int dpdmux_set_max_frame_length(struct fsl_mc_io *mc_io,
drivers/net/dpaa2/mc/dpkg.c +2 -5
index 1e171eedc7..4789976b7d 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  *
- * Copyright 2017 NXP
+ * Copyright 2017-2021 NXP
  *
  */
 #include <fsl_mc_sys.h>
@@ -63,10 +63,7 @@ dpkg_prepare_key_cfg(const struct dpkg_profile_cfg *cfg, uint8_t *key_cfg_buf)
 		dpkg_set_field(extr->extract_type, EXTRACT_TYPE,
 			       cfg->extracts[i].type);
 
-		if (extr->num_of_byte_masks > DPKG_NUM_OF_MASKS)
-			return -EINVAL;
-
-		for (j = 0; j < extr->num_of_byte_masks; j++) {
+		for (j = 0; j < DPKG_NUM_OF_MASKS; j++) {
 			extr->masks[j].mask = cfg->extracts[i].masks[j].mask;
 			extr->masks[j].offset =
 				cfg->extracts[i].masks[j].offset;
drivers/net/dpaa2/mc/dpni.c +85 -26

277 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpdmux.h +3 -0
index b01a98eb59..4600ea94d4 100644
@@ -184,6 +184,9 @@ struct dpdmux_attr {
 	uint16_t num_ifs;
 	uint16_t mem_size;
 	uint16_t default_if;
+	uint16_t max_dmat_entries;
+	uint16_t max_mc_groups;
+	uint16_t max_vlan_ids;
 };
 
 int dpdmux_get_attributes(struct fsl_mc_io *mc_io,
drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h +4 -1
index f8a1b5b1ae..bf6b8a20d1 100644
@@ -35,7 +35,7 @@
 
 #define DPDMUX_CMDID_ENABLE			DPDMUX_CMD(0x002)
 #define DPDMUX_CMDID_DISABLE			DPDMUX_CMD(0x003)
-#define DPDMUX_CMDID_GET_ATTR			DPDMUX_CMD_V2(0x004)
+#define DPDMUX_CMDID_GET_ATTR			DPDMUX_CMD_V3(0x004)
 #define DPDMUX_CMDID_RESET			DPDMUX_CMD(0x005)
 #define DPDMUX_CMDID_IS_ENABLED			DPDMUX_CMD(0x006)
 #define DPDMUX_CMDID_SET_MAX_FRAME_LENGTH	DPDMUX_CMD(0x0a1)
@@ -119,6 +119,9 @@ struct dpdmux_rsp_get_attr {
 	uint32_t pad2;
 
 	uint64_t options;
+	uint16_t max_dmat_entries;
+	uint16_t max_mc_groups;
+	uint16_t max_vlan_ids;
 };
 
 struct dpdmux_cmd_set_max_frame_length {
drivers/net/dpaa2/mc/fsl_dpni.h +44 -10

148 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpni_cmd.h +34 -23

172 lines not on this page · raw message

Signature · 1 line
2.17.1
#20 lore raw

PATCH v2 2/16 bus/fslmc: use dmb oshst for synchronization before I/O

In reply to [email protected]

From: Nipun Gupta <[email protected]>

Outer Shareable Store (oshst) is sufficient for Data Memory Barrier (dmb) when doing IO on the interface via QBMAN.

This will sync L3/DDR with the L1/L2 cached data.

---
 drivers/bus/fslmc/qbman/include/compat.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/fslmc/qbman/include/compat.h +2 -2
index a4471a80af..ece5da5906 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  * Copyright (c) 2008-2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017,2021 NXP
  *
  */
 
@@ -81,7 +81,7 @@ do { \
 #define __raw_readl(p)	(*(const volatile unsigned int *)(p))
 #define __raw_writel(v, p) {*(volatile unsigned int *)(p) = (v); }
 
-#define dma_wmb()		rte_smp_mb()
+#define dma_wmb()		rte_io_wmb()
 
 #define atomic_t                rte_atomic32_t
 #define atomic_read(v)          rte_atomic32_read(v)
Signature · 1 line
2.17.1
#21 lore raw

PATCH v2 3/16 net/dpaa2: warn user in case of high nb desc

In reply to [email protected]

From: Rohit Raj <[email protected]>

Added warning message if application is configuring nb_desc more than supported by PEB memory suggesting user to configure HW descriptors in normal memory rather than in faster PEB memory.

---
 drivers/net/dpaa2/dpaa2_ethdev.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/net/dpaa2/dpaa2_ethdev.c +13 -0
index a3706439d5..f5cac8f9d9 100644
@@ -74,6 +74,9 @@ int dpaa2_timestamp_dynfield_offset = -1;
 /* Enable error queue */
 bool dpaa2_enable_err_queue;
 
+#define MAX_NB_RX_DESC		11264
+int total_nb_rx_desc;
+
 struct rte_dpaa2_xstats_name_off {
 	char name[RTE_ETH_XSTATS_NAME_SIZE];
 	uint8_t page_id; /* dpni statistics page id */
@@ -694,6 +697,13 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	DPAA2_PMD_DEBUG("dev =%p, queue =%d, pool = %p, conf =%p",
 			dev, rx_queue_id, mb_pool, rx_conf);
 
+	total_nb_rx_desc += nb_rx_desc;
+	if (total_nb_rx_desc > MAX_NB_RX_DESC) {
+		DPAA2_PMD_WARN("\nTotal nb_rx_desc exceeds %d limit. Please use Normal buffers",
+			       MAX_NB_RX_DESC);
+		DPAA2_PMD_WARN("To use Normal buffers, run 'export DPNI_NORMAL_BUF=1' before running dynamic_dpl.sh script");
+	}
+
 	/* Rx deferred start is not supported */
 	if (rx_conf->rx_deferred_start) {
 		DPAA2_PMD_ERR("%p:Rx deferred start not supported",
@@ -984,6 +994,9 @@ dpaa2_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 
 	memset(&cfg, 0, sizeof(struct dpni_queue));
 	PMD_INIT_FUNC_TRACE();
+
+	total_nb_rx_desc -= dpaa2_q->nb_desc;
+
 	if (dpaa2_q->cgid != 0xff) {
 		options = DPNI_QUEUE_OPT_CLEAR_CGID;
 		cfg.cgid = dpaa2_q->cgid;
Signature · 1 line
2.17.1
#22 lore raw

PATCH v2 4/16 net/dpaa2: fix unregistering interrupt handler

In reply to [email protected]

From: Vanshika Shukla <[email protected]>

This patch fixes code that handles unregistering LSC interrupt handler in dpaa2_dev_stop API.

Fixes c5acbb5ea20e ("net/dpaa2: support link status event")
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/dpaa2/dpaa2_ethdev.c +6 -1
index f5cac8f9d9..18ff07249f 100644
@@ -1265,7 +1265,12 @@ dpaa2_dev_stop(struct rte_eth_dev *dev)
 	struct fsl_mc_io *dpni = (struct fsl_mc_io *)dev->process_private;
 	int ret;
 	struct rte_eth_link link;
-	struct rte_intr_handle *intr_handle = dev->intr_handle;
+	struct rte_device *rdev = dev->device;
+	struct rte_intr_handle *intr_handle;
+	struct rte_dpaa2_device *dpaa2_dev;
+
+	dpaa2_dev = container_of(rdev, struct rte_dpaa2_device, device);
+	intr_handle = dpaa2_dev->intr_handle;
 
 	PMD_INIT_FUNC_TRACE();
 
Signature · 1 line
2.17.1
#23 lore raw

PATCH v2 5/16 net/dpaa2: fix timestamping for IEEE1588

In reply to [email protected]

From: Vanshika Shukla <[email protected]>

The current implementation of DPAA2 driver code is such that it records Rx and Tx timestamp for PTP without checking if they are PTP packets or not. Packets for which RTE_MBUF_F_RX_IEEE1588_TMST and RTE_MBUF_F_TX_IEEE1588_TMST is not set, Rx and Tx timestamp should not be recorded.

This patch fixes this issue by checking if the required flags are set in the mbuf before recording timestamps.

Also this change defines separate values for
DPAA2_TX_CONF_ENABLE and DPAA2_NO_PREFETCH_RX

Fixes e806bf878c17 ("net/dpaa2: support timestamp")
---
 drivers/net/dpaa2/dpaa2_ethdev.h |  2 +-
 drivers/net/dpaa2/dpaa2_ptp.c    |  8 ++++---
 drivers/net/dpaa2/dpaa2_rxtx.c   | 39 +++++++++++++++++++++++++-------
 3 files changed, 37 insertions(+), 12 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.h +1 -1
index c5e9267bf0..c21571e63d 100644
@@ -62,7 +62,7 @@
 /* Disable RX tail drop, default is enable */
 #define DPAA2_RX_TAILDROP_OFF	0x04
 /* Tx confirmation enabled */
-#define DPAA2_TX_CONF_ENABLE	0x08
+#define DPAA2_TX_CONF_ENABLE	0x06
 
 #define DPAA2_RSS_OFFLOAD_ALL ( \
 	RTE_ETH_RSS_L2_PAYLOAD | \
drivers/net/dpaa2/dpaa2_ptp.c +5 -3
index 8d79e39244..3a4536dd69 100644
@@ -111,10 +111,12 @@ int dpaa2_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 {
 	struct dpaa2_dev_priv *priv = dev->data->dev_private;
 
-	if (priv->next_tx_conf_queue)
-		dpaa2_dev_tx_conf(priv->next_tx_conf_queue);
-	else
+	if (priv->next_tx_conf_queue) {
+		while (!priv->tx_timestamp)
+			dpaa2_dev_tx_conf(priv->next_tx_conf_queue);
+	} else {
 		return -1;
+	}
 	*timestamp = rte_ns_to_timespec(priv->tx_timestamp);
 
 	return 0;
drivers/net/dpaa2/dpaa2_rxtx.c +31 -8
index c65589a5f3..ee3ed1b152 100644
@@ -140,8 +140,10 @@ dpaa2_dev_rx_parse_slow(struct rte_mbuf *mbuf,
 			annotation->word3, annotation->word4);
 
 #if defined(RTE_LIBRTE_IEEE1588)
-	if (BIT_ISSET_AT_POS(annotation->word1, DPAA2_ETH_FAS_PTP))
+	if (BIT_ISSET_AT_POS(annotation->word1, DPAA2_ETH_FAS_PTP)) {
 		mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_PTP;
+		mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_TMST;
+	}
 #endif
 
 	if (BIT_ISSET_AT_POS(annotation->word3, L2_VLAN_1_PRESENT)) {
@@ -769,7 +771,10 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 		else
 			bufs[num_rx] = eth_fd_to_mbuf(fd, eth_data->port_id);
 #if defined(RTE_LIBRTE_IEEE1588)
-		priv->rx_timestamp = *dpaa2_timestamp_dynfield(bufs[num_rx]);
+		if (bufs[num_rx]->ol_flags & PKT_RX_IEEE1588_TMST) {
+			priv->rx_timestamp =
+				*dpaa2_timestamp_dynfield(bufs[num_rx]);
+		}
 #endif
 
 		if (eth_data->dev_conf.rxmode.offloads &
@@ -986,6 +991,13 @@ dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 				bufs[num_rx] = eth_fd_to_mbuf(fd,
 							eth_data->port_id);
 
+#if defined(RTE_LIBRTE_IEEE1588)
+		if (bufs[num_rx]->ol_flags & PKT_RX_IEEE1588_TMST) {
+			priv->rx_timestamp =
+				*dpaa2_timestamp_dynfield(bufs[num_rx]);
+		}
+#endif
+
 		if (eth_data->dev_conf.rxmode.offloads &
 				RTE_ETH_RX_OFFLOAD_VLAN_STRIP) {
 			rte_vlan_strip(bufs[num_rx]);
@@ -1021,6 +1033,8 @@ uint16_t dpaa2_dev_tx_conf(void *queue)
 	struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data;
 	struct dpaa2_dev_priv *priv = eth_data->dev_private;
 	struct dpaa2_annot_hdr *annotation;
+	void *v_addr;
+	struct rte_mbuf *mbuf;
 #endif
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
@@ -1105,10 +1119,16 @@ uint16_t dpaa2_dev_tx_conf(void *queue)
 			num_tx_conf++;
 			num_pulled++;
 #if defined(RTE_LIBRTE_IEEE1588)
-			annotation = (struct dpaa2_annot_hdr *)((size_t)
-				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)) +
-				DPAA2_FD_PTA_SIZE);
-			priv->tx_timestamp = annotation->word2;
+			v_addr = DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+			mbuf = DPAA2_INLINE_MBUF_FROM_BUF(v_addr,
+				rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size);
+
+			if (mbuf->ol_flags & PKT_TX_IEEE1588_TMST) {
+				annotation = (struct dpaa2_annot_hdr *)((size_t)
+					DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)) +
+					DPAA2_FD_PTA_SIZE);
+				priv->tx_timestamp = annotation->word2;
+			}
 #endif
 		} while (pending);
 
@@ -1184,8 +1204,11 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	 * corresponding to last packet transmitted for reading
 	 * the timestamp
 	 */
-	priv->next_tx_conf_queue = dpaa2_q->tx_conf_queue;
-	dpaa2_dev_tx_conf(dpaa2_q->tx_conf_queue);
+	if ((*bufs)->ol_flags & PKT_TX_IEEE1588_TMST) {
+		priv->next_tx_conf_queue = dpaa2_q->tx_conf_queue;
+		dpaa2_dev_tx_conf(dpaa2_q->tx_conf_queue);
+		priv->tx_timestamp = 0;
+	}
 #endif
 
 	/*Prepare enqueue descriptor*/
Signature · 1 line
2.17.1
#24 lore raw

PATCH v2 6/16 net/dpaa2: support multiple txqs en-queue for ordered

In reply to [email protected]

From: Jun Yang <[email protected]>

Support the tx enqueue in order queue mode, where queue id for each event may be different.

---
 drivers/event/dpaa2/dpaa2_eventdev.c |  12 ++-
 drivers/net/dpaa2/dpaa2_ethdev.h     |   4 +
 drivers/net/dpaa2/dpaa2_rxtx.c       | 142 +++++++++++++++++++++++++++
 drivers/net/dpaa2/version.map        |   1 +
 4 files changed, 155 insertions(+), 4 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev.c +8 -4
index 4d94c315d2..f3d8a7e4f1 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2017,2019 NXP
+ * Copyright 2017,2019-2021 NXP
  */
 
 #include <assert.h>
@@ -1003,16 +1003,20 @@ dpaa2_eventdev_txa_enqueue(void *port,
 			   struct rte_event ev[],
 			   uint16_t nb_events)
 {
-	struct rte_mbuf *m = (struct rte_mbuf *)ev[0].mbuf;
+	void *txq[32];
+	struct rte_mbuf *m[32];
 	uint8_t qid, i;
 
 	RTE_SET_USED(port);
 
 	for (i = 0; i < nb_events; i++) {
-		qid = rte_event_eth_tx_adapter_txq_get(m);
-		rte_eth_tx_burst(m->port, qid, &m, 1);
+		m[i] = (struct rte_mbuf *)ev[i].mbuf;
+		qid = rte_event_eth_tx_adapter_txq_get(m[i]);
+		txq[i] = rte_eth_devices[m[i]->port].data->tx_queues[qid];
 	}
 
+	dpaa2_dev_tx_multi_txq_ordered(txq, m, nb_events);
+
 	return nb_events;
 }
 
drivers/net/dpaa2/dpaa2_ethdev.h +4 -0
index c21571e63d..e001a7e49d 100644
@@ -241,6 +241,10 @@ void dpaa2_dev_process_ordered_event(struct qbman_swp *swp,
 uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 uint16_t dpaa2_dev_tx_ordered(void *queue, struct rte_mbuf **bufs,
 			      uint16_t nb_pkts);
+__rte_internal
+uint16_t dpaa2_dev_tx_multi_txq_ordered(void **queue,
+		struct rte_mbuf **bufs, uint16_t nb_pkts);
+
 uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 void dpaa2_dev_free_eqresp_buf(uint16_t eqresp_ci);
 void dpaa2_flow_clean(struct rte_eth_dev *dev);
drivers/net/dpaa2/dpaa2_rxtx.c +142 -0

148 lines not on this page · raw message

drivers/net/dpaa2/version.map +1 -0
index 2fe61f3442..cc82b8579d 100644
@@ -21,6 +21,7 @@ EXPERIMENTAL {
 INTERNAL {
 	global:
 
+	dpaa2_dev_tx_multi_txq_ordered;
 	dpaa2_eth_eventq_attach;
 	dpaa2_eth_eventq_detach;
 
Signature · 1 line
2.17.1
#25 lore raw

Re: [PATCH v2 06/16] net/dpaa2: support multiple txqs en-queue for ordered

drivers/event/dpaa2/dpaa2_eventdev.c dpaa2_eventdev_txa_enqueue(void *port, · line 1007

Quoted 7 lines · On Mon, 27 Dec 2021 21:46:35 +0530 [email protected] wrote:
drivers/event/dpaa2/dpaa2_eventdev.c +2 -1
@@ -1003,16 +1003,20 @@ dpaa2_eventdev_txa_enqueue(void *port,
 			   struct rte_event ev[],
 			   uint16_t nb_events)
 {
-	struct rte_mbuf *m = (struct rte_mbuf *)ev[0].mbuf;
+	void *txq[32];
+	struct rte_mbuf *m[32];

You are assuming nb_events <= 32.
Why not size the array based on nb_events.

drivers/event/dpaa2/dpaa2_eventdev.c dpaa2_eventdev_txa_enqueue(void *port, · line 1013

Quoted 8 lines
drivers/event/dpaa2/dpaa2_eventdev.c +1 -2
 	uint8_t qid, i;
 
 	RTE_SET_USED(port);
 
 	for (i = 0; i < nb_events; i++) {
-		qid = rte_event_eth_tx_adapter_txq_get(m);
-		rte_eth_tx_burst(m->port, qid, &m, 1);
+		m[i] = (struct rte_mbuf *)ev[i].mbuf;

Why the cast? it is already the right type.

Quoted 2 lines
drivers/event/dpaa2/dpaa2_eventdev.c +2 -0
+		qid = rte_event_eth_tx_adapter_txq_get(m[i]);
+		txq[i] = rte_eth_devices[m[i]->port].data->tx_queues[qid];
#26 lore raw

RE: [PATCH v2 06/16] net/dpaa2: support multiple txqs en-queue for ordered

Quoted 14 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: 27 December 2021 23:32
To: Nipun Gupta <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Jun Yang <[email protected]>
Subject: Re: [PATCH v2 06/16] net/dpaa2: support multiple txqs en-queue for ordered

On Mon, 27 Dec 2021 21:46:35 +0530
[email protected] wrote:

Quoted 10 lines

drivers/event/dpaa2/dpaa2_eventdev.c dpaa2_eventdev_txa_enqueue(void *port, · line 1007

Quoted 7 lines
drivers/event/dpaa2/dpaa2_eventdev.c +2 -1
@@ -1003,16 +1003,20 @@ dpaa2_eventdev_txa_enqueue(void *port,
 			   struct rte_event ev[],
 			   uint16_t nb_events)
 {
-	struct rte_mbuf *m = (struct rte_mbuf *)ev[0].mbuf;
+	void *txq[32];
+	struct rte_mbuf *m[32];

You are assuming nb_events <= 32.
Why not size the array based on nb_events.

Agree. Actually I will use DPAA2_EVENT_MAX_PORT_ENQUEUE_DEPTH here.

Quoted 11 lines

drivers/event/dpaa2/dpaa2_eventdev.c dpaa2_eventdev_txa_enqueue(void *port, · line 1013

Quoted 9 lines
drivers/event/dpaa2/dpaa2_eventdev.c +1 -2
 	uint8_t qid, i;
 
 	RTE_SET_USED(port);
 
 	for (i = 0; i < nb_events; i++) {
-		qid = rte_event_eth_tx_adapter_txq_get(m);
-		rte_eth_tx_burst(m->port, qid, &m, 1);
+		m[i] = (struct rte_mbuf *)ev[i].mbuf;

Why the cast? it is already the right type.

Will remove the cast.

Thanks,
Nipun

Quoted 3 lines
Quoted 3 lines
drivers/event/dpaa2/dpaa2_eventdev.c +2 -0
+		qid = rte_event_eth_tx_adapter_txq_get(m[i]);
+		txq[i] = rte_eth_devices[m[i]->port].data->tx_queues[qid];
#27 lore raw

RE: [PATCH v2 06/16] net/dpaa2: support multiple txqs en-queue for ordered

Quoted 43 lines

-----Original Message-----
From: Nipun Gupta
Sent: 03 January 2022 11:17
To: Stephen Hemminger <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Jun Yang <[email protected]>
Subject: RE: [PATCH v2 06/16] net/dpaa2: support multiple txqs en-queue for ordered

Quoted 12 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: 27 December 2021 23:32
To: Nipun Gupta <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Jun Yang <[email protected]>
Subject: Re: [PATCH v2 06/16] net/dpaa2: support multiple txqs en-queue for ordered

On Mon, 27 Dec 2021 21:46:35 +0530
[email protected] wrote:

Quoted 10 lines

drivers/event/dpaa2/dpaa2_eventdev.c dpaa2_eventdev_txa_enqueue(void *port, · line 1007

Quoted 7 lines
drivers/event/dpaa2/dpaa2_eventdev.c +2 -1
@@ -1003,16 +1003,20 @@ dpaa2_eventdev_txa_enqueue(void *port,
 			   struct rte_event ev[],
 			   uint16_t nb_events)
 {
-	struct rte_mbuf *m = (struct rte_mbuf *)ev[0].mbuf;
+	void *txq[32];
+	struct rte_mbuf *m[32];

You are assuming nb_events <= 32.
Why not size the array based on nb_events.

Agree. Actually I will use DPAA2_EVENT_MAX_PORT_ENQUEUE_DEPTH here.

Quoted 5 lines
Quoted 5 lines
drivers/event/dpaa2/dpaa2_eventdev.c +0 -0
 	uint8_t qid, i;
 
 	RTE_SET_USED(port);
 
Quoted 8 lines
Quoted 6 lines

drivers/event/dpaa2/dpaa2_eventdev.c dpaa2_eventdev_txa_enqueue(void *port, · line 1013

Quoted 4 lines
drivers/event/dpaa2/dpaa2_eventdev.c +1 -2
 	for (i = 0; i < nb_events; i++) {
-		qid = rte_event_eth_tx_adapter_txq_get(m);
-		rte_eth_tx_burst(m->port, qid, &m, 1);
+		m[i] = (struct rte_mbuf *)ev[i].mbuf;

Why the cast? it is already the right type.

Will remove the cast.

mbuf is void *type in event structure, so it seems better to cast here.

Quoted 7 lines

Thanks,
Nipun

Quoted 3 lines
Quoted 3 lines
drivers/event/dpaa2/dpaa2_eventdev.c +2 -0
+		qid = rte_event_eth_tx_adapter_txq_get(m[i]);
+		txq[i] = rte_eth_devices[m[i]->port].data->tx_queues[qid];
#28 lore raw

PATCH v2 7/16 net/dpaa2: add support for level 2 in traffic management

In reply to [email protected]

From: Gagandeep Singh <[email protected]>

This patch adds support for level 2 for QoS shaping.

---
 doc/guides/nics/dpaa2.rst           |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c    |  55 ++-
 drivers/net/dpaa2/dpaa2_ethdev.h    |   6 +-
 drivers/net/dpaa2/dpaa2_tm.c        | 563 ++++++++++++++++++++++------
 drivers/net/dpaa2/dpaa2_tm.h        |  17 +-
 drivers/net/dpaa2/mc/dpni.c         | 302 +++++++++------
 drivers/net/dpaa2/mc/fsl_dpni.h     | 119 +++---
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h |  79 ++--
 8 files changed, 791 insertions(+), 352 deletions(-)
doc/guides/nics/dpaa2.rst +1 -1
index 831bc56488..2d113f53df 100644
@@ -588,7 +588,7 @@ Supported Features
 
 The following capabilities are supported:
 
-- Level0 (root node) and Level1 are supported.
+- Level0 (root node), Level1 and Level2 are supported.
 - 1 private shaper at root node (port level) is supported.
 - 8 TX queues per port supported (1 channel per port)
 - Both SP and WFQ scheduling mechanisms are supported on all 8 queues.
drivers/net/dpaa2/dpaa2_ethdev.c +25 -30

127 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.h +5 -1
index e001a7e49d..1fc2fc367e 100644
@@ -25,6 +25,7 @@
 #define MAX_RX_QUEUES		128
 #define MAX_TX_QUEUES		16
 #define MAX_DPNI		8
+#define DPAA2_MAX_CHANNELS	16
 
 #define DPAA2_RX_DEFAULT_NBDESC 512
 
@@ -160,15 +161,17 @@ struct dpaa2_dev_priv {
 	void *rx_vq[MAX_RX_QUEUES];
 	void *tx_vq[MAX_TX_QUEUES];
 	struct dpaa2_bp_list *bp_list; /**<Attached buffer pool list */
-	void *tx_conf_vq[MAX_TX_QUEUES];
+	void *tx_conf_vq[MAX_TX_QUEUES * DPAA2_MAX_CHANNELS];
 	void *rx_err_vq;
 	uint8_t flags; /*dpaa2 config flags */
 	uint8_t max_mac_filters;
 	uint8_t max_vlan_filters;
 	uint8_t num_rx_tc;
+	uint8_t num_tx_tc;
 	uint16_t qos_entries;
 	uint16_t fs_entries;
 	uint8_t dist_queues;
+	uint8_t num_channels;
 	uint8_t en_ordered;
 	uint8_t en_loose_ordered;
 	uint8_t max_cgs;
@@ -190,6 +193,7 @@ struct dpaa2_dev_priv {
 
 	struct rte_eth_dev *eth_dev; /**< Pointer back to holding ethdev */
 
+	uint8_t channel_inuse;
 	LIST_HEAD(, rte_flow) flows; /**< Configured flow rule handles. */
 	LIST_HEAD(nodes, dpaa2_tm_node) nodes;
 	LIST_HEAD(shaper_profiles, dpaa2_tm_shaper_profile) shaper_profiles;
drivers/net/dpaa2/dpaa2_tm.c +457 -106

778 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_tm.h +16 -1
index 6632fab687..cfbb437322 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2020 NXP
+ * Copyright 2020-2021 NXP
  */
 
 #ifndef _DPAA2_TM_H_
@@ -7,6 +7,18 @@
 
 #include <rte_tm.h>
 
+enum node_type {
+	NON_LEAF_NODE = 0,
+	LEAF_NODE
+};
+
+enum level_type {
+	LNI_LEVEL = 0,
+	CHANNEL_LEVEL,
+	QUEUE_LEVEL,
+	MAX_LEVEL
+};
+
 struct dpaa2_tm_shaper_profile {
 	LIST_ENTRY(dpaa2_tm_shaper_profile) next;
 	uint32_t id;
@@ -18,6 +30,9 @@ struct dpaa2_tm_node {
 	LIST_ENTRY(dpaa2_tm_node) next;
 	uint32_t id;
 	uint32_t type;
+	uint32_t level_id;
+	uint16_t channel_id; /* Only for level 1 nodes */
+	uint16_t tc_id; /* Only for level 1 nodes */
 	int refcnt;
 	struct dpaa2_tm_node *parent;
 	struct dpaa2_tm_shaper_profile *profile;
drivers/net/dpaa2/mc/dpni.c +186 -116

323 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpni.h +62 -57

135 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpni_cmd.h +39 -40

110 lines not on this page · raw message

Signature · 1 line
2.17.1
#29 lore raw

PATCH v2 8/16 net/dpaa2: secondary process handling for dpni

In reply to [email protected]

From: Jun Yang <[email protected]>

This change uses 'dev->process_private' instead of 'priv->hw' to get dpmcp per process while setting flow distribution, as priv->hw is only valid for primary process.
It also initialize rte_dpaa2_bpid_info in secondary process.

---
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  | 23 +++++++++++++++++++++++
 drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 15 +++++++++++++++
 drivers/mempool/dpaa2/version.map         |  1 +
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c    |  5 ++---
 drivers/net/dpaa2/dpaa2_ethdev.c          | 10 ++++++++--
 drivers/net/dpaa2/dpaa2_ethdev.h          |  3 ++-
 6 files changed, 51 insertions(+), 6 deletions(-)
drivers/mempool/dpaa2/dpaa2_hw_mempool.c +23 -0
index 39c6252a63..56c629c681 100644
@@ -263,6 +263,29 @@ rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused,
 	}
 }
 
+int rte_dpaa2_bpid_info_init(struct rte_mempool *mp)
+{
+	struct dpaa2_bp_info *bp_info = mempool_to_bpinfo(mp);
+	uint32_t bpid = bp_info->bpid;
+
+	if (!rte_dpaa2_bpid_info) {
+		rte_dpaa2_bpid_info = (struct dpaa2_bp_info *)rte_malloc(NULL,
+				      sizeof(struct dpaa2_bp_info) * MAX_BPID,
+				      RTE_CACHE_LINE_SIZE);
+		if (rte_dpaa2_bpid_info == NULL)
+			return -ENOMEM;
+		memset(rte_dpaa2_bpid_info, 0,
+		       sizeof(struct dpaa2_bp_info) * MAX_BPID);
+	}
+
+	rte_dpaa2_bpid_info[bpid].meta_data_size = sizeof(struct rte_mbuf)
+				+ rte_pktmbuf_priv_size(mp);
+	rte_dpaa2_bpid_info[bpid].bp_list = bp_info->bp_list;
+	rte_dpaa2_bpid_info[bpid].bpid = bpid;
+
+	return 0;
+}
+
 uint16_t
 rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp)
 {
drivers/mempool/dpaa2/rte_dpaa2_mempool.h +15 -0
index 4a22b7c42e..28dea74326 100644
@@ -46,6 +46,21 @@ rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp);
 struct rte_mbuf *
 rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr);
 
+/**
+ * Initialize the rte_dpaa2_bpid_info
+ * In generial, it is called in the secondary process and
+ * mp has been created in the primary process.
+ *
+ * @param mp
+ *   memory pool
+ *
+ * @return
+ *  - 0 on success.
+ *  - (<0) on failure.
+ */
+__rte_internal
+int rte_dpaa2_bpid_info_init(struct rte_mempool *mp);
+
 #ifdef __cplusplus
 }
 #endif
drivers/mempool/dpaa2/version.map +1 -0
index 49c460ec54..cfd4ae617a 100644
@@ -11,5 +11,6 @@ INTERNAL {
 	global:
 
 	rte_dpaa2_bpid_info;
+	rte_dpaa2_bpid_info_init;
 	rte_dpaa2_mbuf_alloc_bulk;
 };
drivers/net/dpaa2/base/dpaa2_hw_dpni.c +2 -3
index 3170694841..9509f6e8a3 100644
@@ -95,7 +95,7 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
 	uint64_t req_dist_set, int tc_index)
 {
 	struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
-	struct fsl_mc_io *dpni = priv->hw;
+	struct fsl_mc_io *dpni = eth_dev->process_private;
 	struct dpni_rx_dist_cfg tc_cfg;
 	struct dpkg_profile_cfg kg_cfg;
 	void *p_params;
@@ -457,13 +457,12 @@ dpaa2_distset_to_dpkg_profile_cfg(
 
 int
 dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
-		     void *blist)
+	struct fsl_mc_io *dpni, void *blist)
 {
 	/* Function to attach a DPNI with a buffer pool list. Buffer pool list
 	 * handle is passed in blist.
 	 */
 	int32_t retcode;
-	struct fsl_mc_io *dpni = priv->hw;
 	struct dpni_pools_cfg bpool_cfg;
 	struct dpaa2_bp_list *bp_list = (struct dpaa2_bp_list *)blist;
 	struct dpni_buffer_layout layout;
drivers/net/dpaa2/dpaa2_ethdev.c +8 -2
index b91e773605..a45beed75f 100644
@@ -18,6 +18,7 @@
 #include <rte_dev.h>
 #include <rte_fslmc.h>
 #include <rte_flow_driver.h>
+#include "rte_dpaa2_mempool.h"
 
 #include "dpaa2_pmd_logs.h"
 #include <fslmc_vfio.h>
@@ -712,9 +713,14 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	if (!priv->bp_list || priv->bp_list->mp != mb_pool) {
+		if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+			ret = rte_dpaa2_bpid_info_init(mb_pool);
+			if (ret)
+				return ret;
+		}
 		bpid = mempool_to_bpid(mb_pool);
-		ret = dpaa2_attach_bp_list(priv,
-					   rte_dpaa2_bpid_info[bpid].bp_list);
+		ret = dpaa2_attach_bp_list(priv, dpni,
+				rte_dpaa2_bpid_info[bpid].bp_list);
 		if (ret)
 			return ret;
 	}
drivers/net/dpaa2/dpaa2_ethdev.h +2 -1
index 1fc2fc367e..bd33a22a8e 100644
@@ -208,7 +208,8 @@ int dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
 int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
 			   uint8_t tc_index);
 
-int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
+int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
+	struct fsl_mc_io *dpni, void *blist);
 
 __rte_internal
 int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
Signature · 1 line
2.17.1
#30 lore raw

PATCH v2 9/16 bus/fslmc: add and scan dprc devices

In reply to [email protected]

From: Jun Yang <[email protected]>

In order to get connection endpoint of each objects, scan the dprc object.

---
 drivers/bus/fslmc/fslmc_bus.c            |  15 ++-
 drivers/bus/fslmc/fslmc_vfio.c           |  18 +++-
 drivers/bus/fslmc/mc/dprc.c              | 129 +++++++++++++++++++++++
 drivers/bus/fslmc/mc/fsl_dprc.h          |  46 ++++++++
 drivers/bus/fslmc/mc/fsl_dprc_cmd.h      |  48 +++++++++
 drivers/bus/fslmc/meson.build            |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c | 100 ++++++++++++++++++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h  |  12 +++
 drivers/bus/fslmc/rte_fslmc.h            |  10 +-
 9 files changed, 374 insertions(+), 8 deletions(-)
 create mode 100644 drivers/bus/fslmc/mc/dprc.c
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc.h
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc_cmd.h
 create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
drivers/bus/fslmc/fslmc_bus.c +10 -5
index a0ef24cdc8..a3c0d838c4 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016,2018-2019 NXP
+ *   Copyright 2016,2018-2021 NXP
  *
  */
 
@@ -136,10 +136,6 @@ scan_one_fslmc_device(char *dev_name)
 	if (!dev_name)
 		return ret;
 
-	/* Ignore the Container name itself */
-	if (!strncmp("dprc", dev_name, 4))
-		return 0;
-
 	/* Creating a temporary copy to perform cut-parse over string */
 	dup_dev_name = strdup(dev_name);
 	if (!dup_dev_name) {
@@ -197,6 +193,8 @@ scan_one_fslmc_device(char *dev_name)
 		dev->dev_type = DPAA2_MUX;
 	else if (!strncmp("dprtc", t_ptr, 5))
 		dev->dev_type = DPAA2_DPRTC;
+	else if (!strncmp("dprc", t_ptr, 4))
+		dev->dev_type = DPAA2_DPRC;
 	else
 		dev->dev_type = DPAA2_UNKNOWN;
 
@@ -339,6 +337,13 @@ rte_fslmc_scan(void)
 		goto scan_fail;
 	}
 
+	/* Scan the DPRC container object */
+	ret = scan_one_fslmc_device(fslmc_container);
+	if (ret != 0) {
+		/* Error in parsing directory - exit gracefully */
+		goto scan_fail_cleanup;
+	}
+
 	while ((entry = readdir(dir)) != NULL) {
 		if (entry->d_name[0] == '.' || entry->d_type != DT_DIR)
 			continue;
drivers/bus/fslmc/fslmc_vfio.c +17 -1
index b4704eeae4..1b89a56bbc 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016-2019 NXP
+ *   Copyright 2016-2021 NXP
  *
  */
 
@@ -728,6 +728,7 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev)
 	case DPAA2_BPOOL:
 	case DPAA2_DPRTC:
 	case DPAA2_MUX:
+	case DPAA2_DPRC:
 		TAILQ_FOREACH(object, &dpaa2_obj_list, next) {
 			if (dev->dev_type == object->dev_type)
 				object->create(dev_fd, &device_info,
@@ -881,6 +882,21 @@ fslmc_vfio_process_group(void)
 		return -1;
 	}
 
+	/* Search for DPRC device next as it updates endpoint of
+	 * other devices.
+	 */
+	current_device = 0;
+	RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
+		if (dev->dev_type == DPAA2_DPRC) {
+			ret = fslmc_process_iodevices(dev);
+			if (ret) {
+				DPAA2_BUS_ERR("Unable to process dprc");
+				return -1;
+			}
+			TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next);
+		}
+	}
+
 	current_device = 0;
 	RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next,
 		dev_temp) {
drivers/bus/fslmc/mc/dprc.c new file +129 -0

129 lines not on this page · raw message

drivers/bus/fslmc/mc/fsl_dprc.h new file +46 -0

46 lines not on this page · raw message

drivers/bus/fslmc/mc/fsl_dprc_cmd.h new file +48 -0

48 lines not on this page · raw message

drivers/bus/fslmc/meson.build +3 -1
index 54be76f516..162ca286fe 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright 2018 NXP
+# Copyright 2018,2021 NXP
 
 if not is_linux
     build = false
@@ -16,10 +16,12 @@ sources = files(
         'mc/dpdmai.c',
         'mc/dpio.c',
         'mc/dpmng.c',
+        'mc/dprc.c',
         'mc/mc_sys.c',
         'portal/dpaa2_hw_dpbp.c',
         'portal/dpaa2_hw_dpci.c',
         'portal/dpaa2_hw_dpio.c',
+        'portal/dpaa2_hw_dprc.c',
         'qbman/qbman_portal.c',
         'qbman/qbman_debug.c',
 )
drivers/bus/fslmc/portal/dpaa2_hw_dprc.c new file +100 -0

100 lines not on this page · raw message

drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +12 -0
index b1bba1ac36..8cb4d404aa 100644
@@ -187,6 +187,18 @@ struct swp_active_dqs {
 
 extern struct swp_active_dqs rte_global_active_dqs_list[NUM_MAX_SWP];
 
+/**
+ * A structure describing a DPAA2 container.
+ */
+struct dpaa2_dprc_dev {
+	TAILQ_ENTRY(dpaa2_dprc_dev) next;
+		/**< Pointer to Next device instance */
+	const char *name;
+	struct fsl_mc_io dprc;  /** handle to DPRC portal object */
+	uint16_t token;
+	uint32_t dprc_id; /*HW ID for DPRC object */
+};
+
 struct dpaa2_dpci_dev {
 	TAILQ_ENTRY(dpaa2_dpci_dev) next;
 		/**< Pointer to Next device instance */
drivers/bus/fslmc/rte_fslmc.h +9 -1
index 729f360646..12b586b13b 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016,2019 NXP
+ *   Copyright 2016,2021 NXP
  *
  */
 
@@ -37,6 +37,9 @@ extern "C" {
 
 #include <fslmc_vfio.h>
 
+#include "portal/dpaa2_hw_pvt.h"
+#include "portal/dpaa2_hw_dpio.h"
+
 #define FSLMC_OBJECT_MAX_LEN 32   /**< Length of each device on bus */
 
 #define DPAA2_INVALID_MBUF_SEQN        0
@@ -88,6 +91,8 @@ enum rte_dpaa2_dev_type {
 	DPAA2_QDMA,     /**< DPDMAI type device */
 	DPAA2_MUX,	/**< DPDMUX type device */
 	DPAA2_DPRTC,	/**< DPRTC type device */
+	DPAA2_DPRC,	/**< DPRC type device */
+	DPAA2_MAC,	/**< DPMAC type device */
 	/* Unknown device placeholder */
 	DPAA2_UNKNOWN,
 	DPAA2_DEVTYPE_MAX,
@@ -122,6 +127,9 @@ struct rte_dpaa2_device {
 	};
 	enum rte_dpaa2_dev_type dev_type;   /**< Device Type */
 	uint16_t object_id;                 /**< DPAA2 Object ID */
+	enum rte_dpaa2_dev_type ep_dev_type;   /**< Endpoint Device Type */
+	uint16_t ep_object_id;                 /**< Endpoint DPAA2 Object ID */
+	char ep_name[RTE_DEV_NAME_MAX_LEN];
 	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
 	struct rte_dpaa2_driver *driver;    /**< Associated driver */
 	char name[FSLMC_OBJECT_MAX_LEN];    /**< DPAA2 Object name*/
Signature · 1 line
2.17.1
#31 lore raw

PATCH v2 10/16 net/dpaa2: support recycle loopback port

In reply to [email protected]

From: Jun Yang <[email protected]>

DPAA2 recycle port is used for configuring the device in the loopback mode. Loopback configuration can be at dpni level or at serdes level.

---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h |   3 +-
 drivers/net/dpaa2/dpaa2_ethdev.c        |  32 +-
 drivers/net/dpaa2/dpaa2_ethdev.h        |  23 +
 drivers/net/dpaa2/dpaa2_recycle.c       | 780 ++++++++++++++++++++++++
 drivers/net/dpaa2/mc/dpni.c             |  32 +
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h     |   1 +
 drivers/net/dpaa2/meson.build           |   1 +
 7 files changed, 870 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/dpaa2/dpaa2_recycle.c
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +2 -1
index 8cb4d404aa..4d0f7e4b5d 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016-2020 NXP
+ *   Copyright 2016-2021 NXP
  *
  */
 
@@ -176,6 +176,7 @@ struct dpaa2_queue {
 	uint16_t nb_desc;
 	uint16_t resv;
 	uint64_t offloads;
+	uint64_t lpbk_cntx;
 } __rte_cache_aligned;
 
 struct swp_active_dqs {
drivers/net/dpaa2/dpaa2_ethdev.c +31 -1
index a45beed75f..d81f8cb07a 100644
@@ -668,6 +668,30 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
 	if (rx_offloads & RTE_ETH_RX_OFFLOAD_VLAN_FILTER)
 		dpaa2_vlan_offload_set(dev, RTE_ETH_VLAN_FILTER_MASK);
 
+	if (eth_conf->lpbk_mode) {
+		ret = dpaa2_dev_recycle_config(dev);
+		if (ret) {
+			DPAA2_PMD_ERR("Error to configure %s to recycle port.",
+				dev->data->name);
+
+			return ret;
+		}
+	} else {
+		/** User may disable loopback mode by calling
+		 * "dev_configure" with lpbk_mode cleared.
+		 * No matter the port was configured recycle or not,
+		 * recycle de-configure is called here.
+		 * If port is not recycled, the de-configure will return directly.
+		 */
+		ret = dpaa2_dev_recycle_deconfig(dev);
+		if (ret) {
+			DPAA2_PMD_ERR("Error to de-configure recycle port %s.",
+				dev->data->name);
+
+			return ret;
+		}
+	}
+
 	dpaa2_tm_init(dev);
 
 	return 0;
@@ -2601,6 +2625,9 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 		return -1;
 	}
 
+	if (eth_dev->data->dev_conf.lpbk_mode)
+		dpaa2_dev_recycle_deconfig(eth_dev);
+
 	/* Clean the device first */
 	ret = dpni_reset(dpni_dev, CMD_PRI_LOW, priv->token);
 	if (ret) {
@@ -2624,6 +2651,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	priv->dist_queues = attr.num_queues;
 	priv->num_channels = attr.num_channels;
 	priv->channel_inuse = 0;
+	rte_spinlock_init(&priv->lpbk_qp_lock);
 
 	/* only if the custom CG is enabled */
 	if (attr.options & DPNI_OPT_CUSTOM_CG)
@@ -2808,7 +2836,9 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 			return ret;
 		}
 	}
-	RTE_LOG(INFO, PMD, "%s: netdev created\n", eth_dev->data->name);
+	RTE_LOG(INFO, PMD, "%s: netdev created, connected to %s\n",
+		eth_dev->data->name, dpaa2_dev->ep_name);
+
 	return 0;
 init_err:
 	dpaa2_dev_close(eth_dev);
drivers/net/dpaa2/dpaa2_ethdev.h +23 -0
index bd33a22a8e..b032da9eff 100644
@@ -11,6 +11,7 @@
 #include <rte_event_eth_rx_adapter.h>
 #include <rte_pmd_dpaa2.h>
 
+#include <rte_fslmc.h>
 #include <dpaa2_hw_pvt.h>
 #include "dpaa2_tm.h"
 
@@ -65,6 +66,18 @@
 /* Tx confirmation enabled */
 #define DPAA2_TX_CONF_ENABLE	0x06
 
+/* HW loopback the egress traffic to self ingress*/
+#define DPAA2_TX_MAC_LOOPBACK_MODE 0x20
+
+#define DPAA2_TX_SERDES_LOOPBACK_MODE 0x40
+
+#define DPAA2_TX_DPNI_LOOPBACK_MODE 0x80
+
+#define DPAA2_TX_LOOPBACK_MODE \
+	(DPAA2_TX_MAC_LOOPBACK_MODE | \
+	DPAA2_TX_SERDES_LOOPBACK_MODE | \
+	DPAA2_TX_DPNI_LOOPBACK_MODE)
+
 #define DPAA2_RSS_OFFLOAD_ALL ( \
 	RTE_ETH_RSS_L2_PAYLOAD | \
 	RTE_ETH_RSS_IP | \
@@ -192,6 +205,7 @@ struct dpaa2_dev_priv {
 	struct dpaa2_queue *next_tx_conf_queue;
 
 	struct rte_eth_dev *eth_dev; /**< Pointer back to holding ethdev */
+	rte_spinlock_t lpbk_qp_lock;
 
 	uint8_t channel_inuse;
 	LIST_HEAD(, rte_flow) flows; /**< Configured flow rule handles. */
@@ -268,4 +282,13 @@ int dpaa2_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
 						uint32_t flags __rte_unused);
 int dpaa2_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 					  struct timespec *timestamp);
+
+int dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev);
+int dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev);
+int dpaa2_dev_recycle_qp_setup(struct rte_dpaa2_device *dpaa2_dev,
+	uint16_t qidx, uint64_t cntx,
+	eth_rx_burst_t tx_lpbk, eth_tx_burst_t rx_lpbk,
+	struct dpaa2_queue **txq,
+	struct dpaa2_queue **rxq);
+
 #endif /* _DPAA2_ETHDEV_H */
drivers/net/dpaa2/dpaa2_recycle.c new file +780 -0

780 lines not on this page · raw message

drivers/net/dpaa2/mc/dpni.c +32 -0
index b7a65cb637..7a2bc15eb4 100644
@@ -3087,3 +3087,35 @@ int dpni_get_custom_tpid(struct fsl_mc_io *mc_io, uint32_t cmd_flags,
 	return err;
 }
 
+/**
+ * dpni_set_port_cfg() - performs configurations at physical port connected on
+ *		this dpni. The command have effect only if dpni is connected to
+ *		another dpni object
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPNI object
+ * @flags:	Valid fields from port_cfg structure
+ * @port_cfg: Configuration data; one or more of DPNI_PORT_CFG_
+ * The command can be called only when dpni is connected to a dpmac object. If
+ * the dpni is unconnected or the endpoint is not a dpni it will return error.
+ * If dpmac endpoint is disconnected the settings will be lost
+ */
+int dpni_set_port_cfg(struct fsl_mc_io *mc_io, uint32_t cmd_flags,
+		uint16_t token, uint32_t flags, struct dpni_port_cfg *port_cfg)
+{
+	struct dpni_cmd_set_port_cfg *cmd_params;
+	struct mc_command cmd = { 0 };
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_PORT_CFG,
+			cmd_flags, token);
+
+	cmd_params = (struct dpni_cmd_set_port_cfg *)cmd.params;
+	cmd_params->flags = cpu_to_le32(flags);
+	dpni_set_field(cmd_params->bit_params,	PORT_LOOPBACK_EN,
+			!!port_cfg->loopback_en);
+
+	/* send command to MC */
+	return mc_send_command(mc_io, &cmd);
+}
+
drivers/net/dpaa2/mc/fsl_dpni_cmd.h +1 -0
index ed0bd7615a..b7bd7556af 100644
@@ -119,6 +119,7 @@
 #define DPNI_CMDID_REMOVE_CUSTOM_TPID		DPNI_CMD(0x276)
 #define DPNI_CMDID_GET_CUSTOM_TPID		DPNI_CMD(0x277)
 #define DPNI_CMDID_GET_LINK_CFG			DPNI_CMD(0x278)
+#define DPNI_CMDID_SET_PORT_CFG			DPNI_CMD(0x27B)
 
 /* Macros for accessing command fields smaller than 1byte */
 #define DPNI_MASK(field)	\
drivers/net/dpaa2/meson.build +1 -0
index 21b827a259..51598c048c 100644
@@ -14,6 +14,7 @@ sources = files(
         'dpaa2_mux.c',
         'dpaa2_ethdev.c',
         'dpaa2_flow.c',
+        'dpaa2_recycle.c',
         'dpaa2_rxtx.c',
         'dpaa2_sparser.c',
         'dpaa2_ptp.c',
Signature · 1 line
2.17.1
#32 lore raw

PATCH v2 11/16 net/dpaa: check status before configuring shared MAC

In reply to [email protected]

From: Nipun Gupta <[email protected]>

For shared MAC interface, it is a prerequisite to enable the interface in the kernel, before using it in user-space. This patch makes sure that device is not getting configured in case shared MAC interface is not enabled in the kernel.

---
 drivers/bus/dpaa/base/fman/fman_hw.c | 11 +++++++++++
 drivers/bus/dpaa/include/fsl_fman.h  |  2 ++
 drivers/bus/dpaa/version.map         |  1 +
 drivers/net/dpaa/dpaa_ethdev.c       | 13 ++++++++++++-
 4 files changed, 26 insertions(+), 1 deletion(-)
drivers/bus/dpaa/base/fman/fman_hw.c +11 -0
index af9bac76c2..24a99f7235 100644
@@ -314,6 +314,17 @@ fman_if_disable_rx(struct fman_if *p)
 	out_be32(__if->ccsr_map + 8, in_be32(__if->ccsr_map + 8) & ~(u32)2);
 }
 
+int
+fman_if_get_rx_status(struct fman_if *p)
+{
+	struct __fman_if *__if = container_of(p, struct __fman_if, __if);
+
+	assert(fman_ccsr_map_fd != -1);
+
+	/* return true if RX bit is set */
+	return !!(in_be32(__if->ccsr_map + 8) & (u32)2);
+}
+
 void
 fman_if_loopback_enable(struct fman_if *p)
 {
drivers/bus/dpaa/include/fsl_fman.h +2 -0
index f3a5d05970..acb344584f 100644
@@ -81,6 +81,8 @@ __rte_internal
 void fman_if_enable_rx(struct fman_if *p);
 __rte_internal
 void fman_if_disable_rx(struct fman_if *p);
+__rte_internal
+int fman_if_get_rx_status(struct fman_if *p);
 
 /* Enable/disable loopback on specific interfaces */
 __rte_internal
drivers/bus/dpaa/version.map +1 -0
index 900635b210..1a840fd1a5 100644
@@ -33,6 +33,7 @@ INTERNAL {
 	fman_if_get_fdoff;
 	fman_if_get_maxfrm;
 	fman_if_get_sg_enable;
+	fman_if_get_rx_status;
 	fman_if_loopback_disable;
 	fman_if_loopback_enable;
 	fman_if_promiscuous_disable;
drivers/net/dpaa/dpaa_ethdev.c +12 -1
index e49f765434..3972ecaed8 100644
@@ -195,6 +195,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	struct rte_eth_conf *eth_conf = &dev->data->dev_conf;
 	uint64_t rx_offloads = eth_conf->rxmode.offloads;
 	uint64_t tx_offloads = eth_conf->txmode.offloads;
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 	struct rte_device *rdev = dev->device;
 	struct rte_eth_link *link = &dev->data->dev_link;
 	struct rte_dpaa_device *dpaa_dev;
@@ -203,7 +204,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	struct rte_intr_handle *intr_handle;
 	uint32_t max_rx_pktlen;
 	int speed, duplex;
-	int ret;
+	int ret, rx_status;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -211,6 +212,16 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	intr_handle = dpaa_dev->intr_handle;
 	__fif = container_of(fif, struct __fman_if, __if);
 
+	/* Check if interface is enabled in case of shared MAC */
+	if (fif->is_shared_mac) {
+		rx_status = fman_if_get_rx_status(fif);
+		if (!rx_status) {
+			DPAA_PMD_ERR("%s Interface not enabled in kernel!",
+				     dpaa_intf->name);
+			return -EHOSTDOWN;
+		}
+	}
+
 	/* Rx offloads which are enabled by default */
 	if (dev_rx_offloads_nodis & ~rx_offloads) {
 		DPAA_PMD_INFO(
Signature · 1 line
2.17.1
#33 lore raw

PATCH v2 12/16 net/dpaa: enable checksum for shared MAC interface

In reply to [email protected]

From: Nipun Gupta <[email protected]>

In case of shared MAC B0V bit in contextA is required to be set to set so that ASPID is 0.

---
 drivers/net/dpaa/dpaa_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/dpaa/dpaa_ethdev.c +4 -0
index 3972ecaed8..7135a5998d 100644
@@ -1755,6 +1755,10 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 	/* no tx-confirmation */
 	opts.fqd.context_a.hi = 0x80000000 | fman_dealloc_bufs_mask_hi;
 	opts.fqd.context_a.lo = 0 | fman_dealloc_bufs_mask_lo;
+	if (fman_ip_rev >= FMAN_V3) {
+		/* Set B0V bit in contextA to set ASPID to 0 */
+		opts.fqd.context_a.hi |= 0x04000000;
+	}
 	DPAA_PMD_DEBUG("init tx fq %p, fqid 0x%x", fq, fq->fqid);
 
 	if (cgr_tx) {
Signature · 1 line
2.17.1
#34 lore raw

PATCH v2 13/16 net/enetc: add support for VFs

In reply to [email protected]

From: Gagandeep Singh <[email protected]>

Add virtual function support for enetc devices

---
 drivers/net/enetc/enetc_ethdev.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)
drivers/net/enetc/enetc_ethdev.c +20 -5
index 7cdb8ce463..1b4337bc48 100644
@@ -19,6 +19,9 @@ enetc_dev_start(struct rte_eth_dev *dev)
 	uint32_t val;
 
 	PMD_INIT_FUNC_TRACE();
+	if (hw->device_id == ENETC_DEV_ID_VF)
+		return 0;
+
 	val = enetc_port_rd(enetc_hw, ENETC_PM0_CMD_CFG);
 	enetc_port_wr(enetc_hw, ENETC_PM0_CMD_CFG,
 		      val | ENETC_PM0_TX_EN | ENETC_PM0_RX_EN);
@@ -55,6 +58,9 @@ enetc_dev_stop(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 	dev->data->dev_started = 0;
+	if (hw->device_id == ENETC_DEV_ID_VF)
+		return 0;
+
 	/* Disable port */
 	val = enetc_port_rd(enetc_hw, ENETC_PMR);
 	enetc_port_wr(enetc_hw, ENETC_PMR, val & (~ENETC_PMR_EN));
@@ -160,11 +166,20 @@ enetc_hardware_init(struct enetc_eth_hw *hw)
 	/* Enabling Station Interface */
 	enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN);
 
-	*mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
-	high_mac = (uint32_t)*mac;
-	mac++;
-	*mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
-	low_mac = (uint16_t)*mac;
+
+	if (hw->device_id == ENETC_DEV_ID_VF) {
+		*mac = (uint32_t)enetc_rd(enetc_hw, ENETC_SIPMAR0);
+		high_mac = (uint32_t)*mac;
+		mac++;
+		*mac = (uint32_t)enetc_rd(enetc_hw, ENETC_SIPMAR1);
+		low_mac = (uint16_t)*mac;
+	} else {
+		*mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
+		high_mac = (uint32_t)*mac;
+		mac++;
+		*mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
+		low_mac = (uint16_t)*mac;
+	}
 
 	if ((high_mac | low_mac) == 0) {
 		char *first_byte;
Signature · 1 line
2.17.1
#35 lore raw

PATCH v2 14/16 net/pfe: disable HW CRC stripping

In reply to [email protected]

From: Gagandeep Singh <[email protected]>

LS1012A MAC PCS block has an erratum that is seen with specific PHY AR803x. The issue is triggered by the (spec-compliant) operation of the AR803x PHY on the LS1012A-FRWY board.

Due to this, good FCS packet is reported as error packet by MAC, so for these error packets FCS should be validated and discard only real error packets in PFE engine Rx packet path. Now onwards CRC validation will be handled in pfe.ko and DPDK driver can not use CRC Forwarding option.

---
 drivers/net/pfe/pfe_ethdev.c | 7 +++++--
 drivers/net/pfe/pfe_hal.c    | 4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/pfe/pfe_ethdev.c +5 -2
index 047010e15e..bfcaf51dd9 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2019 NXP
+ * Copyright 2018-2020 NXP
  */
 
 #include <sys/ioctl.h>
@@ -422,8 +422,11 @@ pfe_eth_close(struct rte_eth_dev *dev)
 }
 
 static int
-pfe_eth_configure(struct rte_eth_dev *dev __rte_unused)
+pfe_eth_configure(struct rte_eth_dev *dev)
 {
+	if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC)
+		PFE_PMD_ERR("PMD does not support KEEP_CRC offload");
+
 	return 0;
 }
 
drivers/net/pfe/pfe_hal.c +2 -2
index 41d783dbff..f49d1728b2 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2019 NXP
+ * Copyright 2018-2020 NXP
  */
 
 #include <arpa/inet.h>
@@ -191,7 +191,7 @@ gemac_set_mode(void *base, __rte_unused int mode)
 	val &= ~EMAC_RCNTRL_LOOP;
 
 	/*Enable flow control and MII mode*/
-	val |= (EMAC_RCNTRL_FCE | EMAC_RCNTRL_MII_MODE | EMAC_RCNTRL_CRC_FWD);
+	val |= (EMAC_RCNTRL_FCE | EMAC_RCNTRL_MII_MODE);
 
 	writel(val, base + EMAC_RCNTRL_REG);
 }
Signature · 1 line
2.17.1
#36 lore raw

Re: [PATCH v2 14/16] net/pfe: disable HW CRC stripping

drivers/net/pfe/pfe_ethdev.c pfe_eth_close(struct rte_eth_dev *dev) · line 432

Quoted 13 lines · On Mon, 27 Dec 2021 21:46:43 +0530 [email protected] wrote:
drivers/net/pfe/pfe_ethdev.c +4 -1
@@ -422,8 +422,11 @@ pfe_eth_close(struct rte_eth_dev *dev)
 }
 
 static int
-pfe_eth_configure(struct rte_eth_dev *dev __rte_unused)
+pfe_eth_configure(struct rte_eth_dev *dev)
 {
+	if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC)
+		PFE_PMD_ERR("PMD does not support KEEP_CRC offload");
+
 	return 0;
 }
 

Why is this necessary? There is already a check for offload capabilities in rte_eth_dev_configure(). The device should report correct supported offloads instead.

#37 lore raw

RE: [PATCH v2 14/16] net/pfe: disable HW CRC stripping

Quoted 22 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: 27 December 2021 23:19
To: Nipun Gupta <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Gagandeep Singh <[email protected]>
Subject: Re: [PATCH v2 14/16] net/pfe: disable HW CRC stripping

drivers/net/pfe/pfe_ethdev.c pfe_eth_close(struct rte_eth_dev *dev) · line 427

Quoted 8 lines · On Mon, 27 Dec 2021 21:46:43 +0530 [email protected] wrote:
drivers/net/pfe/pfe_ethdev.c +2 -1
@@ -422,8 +422,11 @@ pfe_eth_close(struct rte_eth_dev *dev)
 }
 
 static int
-pfe_eth_configure(struct rte_eth_dev *dev __rte_unused)
+pfe_eth_configure(struct rte_eth_dev *dev)
 {
+	if (dev->data->dev_conf.rxmode.offloads &

DEV_RX_OFFLOAD_KEEP_CRC)

Quoted 9 lines

drivers/net/pfe/pfe_ethdev.c pfe_eth_close(struct rte_eth_dev *dev) · line 432

Quoted 5 lines
drivers/net/pfe/pfe_ethdev.c +2 -0
+		PFE_PMD_ERR("PMD does not support KEEP_CRC offload");
+
 	return 0;
 }
 

Why is this necessary? There is already a check for offload capabilities in rte_eth_dev_configure(). The device should report correct supported offloads instead.

Agree. Will remove this patch.

#38 lore raw

PATCH v2 15/16 net/pfe: reduce driver initialization time

In reply to [email protected]

From: Gagandeep Singh <[email protected]>

This patch reduces the delay in the device init.

---
 drivers/net/pfe/pfe_hif.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/pfe/pfe_hif.c +4 -2
index c4a7154ba7..eade726b2e 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2019 NXP
+ * Copyright 2018-2020 NXP
  */
 
 #include "pfe_logs.h"
@@ -9,6 +9,8 @@
 #include <sys/eventfd.h>
 #include <arpa/inet.h>
 
+#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+#define msleep(x) rte_delay_us(1000 * (x))
 static int
 pfe_hif_alloc_descr(struct pfe_hif *hif)
 {
@@ -766,7 +768,7 @@ pfe_hif_rx_idle(struct pfe_hif *hif)
 		if (rx_status & BDP_CSR_RX_DMA_ACTV)
 			send_dummy_pkt_to_hif();
 
-		sleep(1);
+		msleep(DIV_ROUND_UP(100, 1000));
 	} while (--hif_stop_loop);
 
 	if (readl(HIF_RX_STATUS) & BDP_CSR_RX_DMA_ACTV)
Signature · 1 line
2.17.1
#39 lore raw

Re: [PATCH v2 15/16] net/pfe: reduce driver initialization time

Quoted 30 lines · On Mon, 27 Dec 2021 21:46:44 +0530 [email protected] wrote:

From: Gagandeep Singh <[email protected]>

This patch reduces the delay in the device init.

---
 drivers/net/pfe/pfe_hif.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/pfe/pfe_hif.c +3 -1
index c4a7154ba7..eade726b2e 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2019 NXP
+ * Copyright 2018-2020 NXP
  */
 
 #include "pfe_logs.h"
@@ -9,6 +9,8 @@
 #include <sys/eventfd.h>
 #include <arpa/inet.h>
 
+#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+#define msleep(x) rte_delay_us(1000 * (x))
 static int
 pfe_hif_alloc_descr(struct pfe_hif *hif)
 {

drivers/net/pfe/pfe_hif.c pfe_hif_rx_idle(struct pfe_hif *hif) · line 771

Quoted 5 lines
drivers/net/pfe/pfe_hif.c +1 -1
@@ -766,7 +768,7 @@ pfe_hif_rx_idle(struct pfe_hif *hif)
 		if (rx_status & BDP_CSR_RX_DMA_ACTV)
 			send_dummy_pkt_to_hif();
 
-		sleep(1);
+		msleep(DIV_ROUND_UP(100, 1000));

Why not just

	rte_delay_ms(1);
#40 lore raw

RE: [PATCH v2 15/16] net/pfe: reduce driver initialization time

Quoted 46 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: 27 December 2021 23:28
To: Nipun Gupta <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Gagandeep Singh <[email protected]>
Subject: Re: [PATCH v2 15/16] net/pfe: reduce driver initialization time

Quoted 33 lines · On Mon, 27 Dec 2021 21:46:44 +0530 [email protected] wrote:

From: Gagandeep Singh <[email protected]>

This patch reduces the delay in the device init.

---
 drivers/net/pfe/pfe_hif.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/pfe/pfe_hif.c +3 -1
index c4a7154ba7..eade726b2e 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2019 NXP
+ * Copyright 2018-2020 NXP
  */
 
 #include "pfe_logs.h"
@@ -9,6 +9,8 @@
 #include <sys/eventfd.h>
 #include <arpa/inet.h>
 
+#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+#define msleep(x) rte_delay_us(1000 * (x))
 static int
 pfe_hif_alloc_descr(struct pfe_hif *hif)
 {
@@ -766,7 +768,7 @@ pfe_hif_rx_idle(struct pfe_hif *hif)
 		if (rx_status & BDP_CSR_RX_DMA_ACTV)
 			send_dummy_pkt_to_hif();
 
Quoted 5 lines

drivers/net/pfe/pfe_hif.c pfe_hif_rx_idle(struct pfe_hif *hif) · line 771

Quoted 2 lines
drivers/net/pfe/pfe_hif.c +1 -1
-		sleep(1);
+		msleep(DIV_ROUND_UP(100, 1000));

Why not just

	rte_delay_ms(1);

Will update.

#41 lore raw

PATCH v2 16/16 net/pfe: remove setting unused value

In reply to [email protected]

From: Apeksha Gupta <[email protected]>

remove setting link status where it is not being used

---
 drivers/net/pfe/pfe_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/pfe/pfe_ethdev.c +1 -2
index bfcaf51dd9..5a3008cbb5 100644
@@ -590,8 +590,7 @@ pfe_eth_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
 		ret = ioctl(priv->link_fd, ioctl_cmd, &lstatus);
 		if (ret != 0) {
 			PFE_PMD_ERR("Unable to fetch link status (ioctl)\n");
-			/* use dummy link value */
-			link.link_status = 1;
+			return -1;
 		}
 		PFE_PMD_DEBUG("Fetched link state (%d) for dev %d.\n",
 			      lstatus, priv->id);
Signature · 1 line
2.17.1
#42 lore raw
In reply to [email protected]
Quoted 85 lines · On Mon, 27 Dec 2021 21:46:29 +0530 [email protected] wrote:

From: Nipun Gupta <[email protected]>

This series adds few features and important fixes on DPAA, PFE and ENETC devices.

Features added:
- level 2 support for shaping on DPAA2
- loopback configuration for DPNI devices on DPAA2
- Multiple TXQ's enqueue for ordered queues for performance
- VFs support on ENETC

Fixes:
- fix unregistering interrupt handler on DPAA2
- fix timestamping for IEEE1588 on DPAA1

Changes in v2:
- fix checkpatch errors

Apeksha Gupta (1):
net/pfe: remove setting unused value

Gagandeep Singh (4):
net/dpaa2: add support for level 2 in traffic management net/enetc: add support for VFs
net/pfe: disable HW CRC stripping
net/pfe: reduce driver initialization time

Jun Yang (4):
net/dpaa2: support multiple txqs en-queue for ordered net/dpaa2: secondary process handling for dpni bus/fslmc: add and scan dprc devices net/dpaa2: support recycle loopback port

Nipun Gupta (4):
bus/fslmc: update MC to 10.29
bus/fslmc: use dmb oshst for synchronization before I/O net/dpaa: check status before configuring shared MAC net/dpaa: enable checksum for shared MAC interface

Rohit Raj (1):
net/dpaa2: warn user in case of high nb desc

Vanshika Shukla (2):
net/dpaa2: fix unregistering interrupt handler
net/dpaa2: fix timestamping for IEEE1588

 doc/guides/nics/dpaa2.rst                 |   2 +-
 drivers/bus/dpaa/base/fman/fman_hw.c      |  11 +
 drivers/bus/dpaa/include/fsl_fman.h       |   2 +
 drivers/bus/dpaa/version.map              |   1 +
 drivers/bus/fslmc/fslmc_bus.c             |  15 +-
 drivers/bus/fslmc/fslmc_vfio.c            |  18 +-
 drivers/bus/fslmc/mc/dprc.c               | 129 ++++
 drivers/bus/fslmc/mc/fsl_dpmng.h          |   2 +-
 drivers/bus/fslmc/mc/fsl_dprc.h           |  46 ++
 drivers/bus/fslmc/mc/fsl_dprc_cmd.h       |  48 ++
 drivers/bus/fslmc/meson.build             |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c  | 100 +++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   |  15 +-
 drivers/bus/fslmc/qbman/include/compat.h  |   4 +-
 drivers/bus/fslmc/rte_fslmc.h             |  10 +-
 drivers/event/dpaa2/dpaa2_eventdev.c      |  12 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  |  23 +
 drivers/mempool/dpaa2/rte_dpaa2_mempool.h |  15 +
 drivers/mempool/dpaa2/version.map         |   1 +
 drivers/net/dpaa/dpaa_ethdev.c            |  17 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c    |   5 +-
 drivers/net/dpaa2/dpaa2_ethdev.c          | 117 +++-
 drivers/net/dpaa2/dpaa2_ethdev.h          |  38 +-
 drivers/net/dpaa2/dpaa2_ptp.c             |   8 +-
 drivers/net/dpaa2/dpaa2_recycle.c         | 780 ++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_rxtx.c            | 181 ++++-
 drivers/net/dpaa2/dpaa2_tm.c              | 563 +++++++++++++---
 drivers/net/dpaa2/dpaa2_tm.h              |  17 +-
 drivers/net/dpaa2/mc/dpdmux.c             |   8 +
 drivers/net/dpaa2/mc/dpkg.c               |   7 +-
 drivers/net/dpaa2/mc/dpni.c               | 417 ++++++++----
 drivers/net/dpaa2/mc/fsl_dpdmux.h         |   3 +
 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h     |   5 +-
 drivers/net/dpaa2/mc/fsl_dpni.h           | 173 +++--
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h       | 137 ++--
 drivers/net/dpaa2/meson.build             |   1 +
 drivers/net/dpaa2/version.map             |   1 +
 drivers/net/enetc/enetc_ethdev.c          |  25 +-
 drivers/net/pfe/pfe_ethdev.c              |  10 +-
Quoted 9 lines
 drivers/net/pfe/pfe_hal.c                 |   4 +-
 drivers/net/pfe/pfe_hif.c                 |   6 +-
 41 files changed, 2528 insertions(+), 453 deletions(-)
 create mode 100644 drivers/bus/fslmc/mc/dprc.c
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc.h
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc_cmd.h
 create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
 create mode 100644 drivers/net/dpaa2/dpaa2_recycle.c

In general best to split the patch series by device not by vendor. That way it is easier to review and changes to one device can go in if there are still issues with other devices

#43 lore raw
Quoted 108 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: 27 December 2021 23:21
To: Nipun Gupta <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [PATCH v2 00/16] features and fixes on NXP eth devices

Quoted 85 lines · On Mon, 27 Dec 2021 21:46:29 +0530 [email protected] wrote:

From: Nipun Gupta <[email protected]>

This series adds few features and important fixes on DPAA, PFE and ENETC devices.

Features added:
- level 2 support for shaping on DPAA2
- loopback configuration for DPNI devices on DPAA2
- Multiple TXQ's enqueue for ordered queues for performance
- VFs support on ENETC

Fixes:
- fix unregistering interrupt handler on DPAA2
- fix timestamping for IEEE1588 on DPAA1

Changes in v2:
- fix checkpatch errors

Apeksha Gupta (1):
net/pfe: remove setting unused value

Gagandeep Singh (4):
net/dpaa2: add support for level 2 in traffic management net/enetc: add support for VFs
net/pfe: disable HW CRC stripping
net/pfe: reduce driver initialization time

Jun Yang (4):
net/dpaa2: support multiple txqs en-queue for ordered net/dpaa2: secondary process handling for dpni bus/fslmc: add and scan dprc devices net/dpaa2: support recycle loopback port

Nipun Gupta (4):
bus/fslmc: update MC to 10.29
bus/fslmc: use dmb oshst for synchronization before I/O net/dpaa: check status before configuring shared MAC net/dpaa: enable checksum for shared MAC interface

Rohit Raj (1):
net/dpaa2: warn user in case of high nb desc

Vanshika Shukla (2):
net/dpaa2: fix unregistering interrupt handler
net/dpaa2: fix timestamping for IEEE1588

 doc/guides/nics/dpaa2.rst                 |   2 +-
 drivers/bus/dpaa/base/fman/fman_hw.c      |  11 +
 drivers/bus/dpaa/include/fsl_fman.h       |   2 +
 drivers/bus/dpaa/version.map              |   1 +
 drivers/bus/fslmc/fslmc_bus.c             |  15 +-
 drivers/bus/fslmc/fslmc_vfio.c            |  18 +-
 drivers/bus/fslmc/mc/dprc.c               | 129 ++++
 drivers/bus/fslmc/mc/fsl_dpmng.h          |   2 +-
 drivers/bus/fslmc/mc/fsl_dprc.h           |  46 ++
 drivers/bus/fslmc/mc/fsl_dprc_cmd.h       |  48 ++
 drivers/bus/fslmc/meson.build             |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c  | 100 +++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   |  15 +-
 drivers/bus/fslmc/qbman/include/compat.h  |   4 +-
 drivers/bus/fslmc/rte_fslmc.h             |  10 +-
 drivers/event/dpaa2/dpaa2_eventdev.c      |  12 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  |  23 +
 drivers/mempool/dpaa2/rte_dpaa2_mempool.h |  15 +
 drivers/mempool/dpaa2/version.map         |   1 +
 drivers/net/dpaa/dpaa_ethdev.c            |  17 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c    |   5 +-
 drivers/net/dpaa2/dpaa2_ethdev.c          | 117 +++-
 drivers/net/dpaa2/dpaa2_ethdev.h          |  38 +-
 drivers/net/dpaa2/dpaa2_ptp.c             |   8 +-
 drivers/net/dpaa2/dpaa2_recycle.c         | 780 ++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_rxtx.c            | 181 ++++-
 drivers/net/dpaa2/dpaa2_tm.c              | 563 +++++++++++++---
 drivers/net/dpaa2/dpaa2_tm.h              |  17 +-
 drivers/net/dpaa2/mc/dpdmux.c             |   8 +
 drivers/net/dpaa2/mc/dpkg.c               |   7 +-
 drivers/net/dpaa2/mc/dpni.c               | 417 ++++++++----
 drivers/net/dpaa2/mc/fsl_dpdmux.h         |   3 +
 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h     |   5 +-
 drivers/net/dpaa2/mc/fsl_dpni.h           | 173 +++--
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h       | 137 ++--
 drivers/net/dpaa2/meson.build             |   1 +
 drivers/net/dpaa2/version.map             |   1 +
 drivers/net/enetc/enetc_ethdev.c          |  25 +-
 drivers/net/pfe/pfe_ethdev.c              |  10 +-
Quoted 9 lines
 drivers/net/pfe/pfe_hal.c                 |   4 +-
 drivers/net/pfe/pfe_hif.c                 |   6 +-
 41 files changed, 2528 insertions(+), 453 deletions(-)
 create mode 100644 drivers/bus/fslmc/mc/dprc.c
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc.h
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc_cmd.h
 create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
 create mode 100644 drivers/net/dpaa2/dpaa2_recycle.c
Quoted 3 lines

In general best to split the patch series by device not by vendor. That way it is easier to review and changes to one device can go in if there are still issues with other devices

Agree !! Will send it separately from next time. This time though I would send like to them in this only as otherwise it would break the versioning.

Thanks,
Nipun

#44 lore raw

v3 cover features and fixes on NXP eth devices

In reply to [email protected]

From: Nipun Gupta <[email protected]>

This series adds few features and important fixes on DPAA, PFE and ENETC devices.

Features added:
- level 2 support for shaping on DPAA2
- loopback configuration for DPNI devices on DPAA2
- Multiple TXQ's enqueue for ordered queues for performance
- VFs support on ENETC

Fixes:
- fix unregistering interrupt handler on DPAA2
- fix timestamping for IEEE1588 on DPAA1

Changes in v2:
- fix checkpatch errors

Changes in v3:
- remove unrequired PFE HW checksum patch
- use predefined API for adding delay
- use macro value for allocating mbuf in event

Apeksha Gupta (1):
net/pfe: remove setting unused value

Gagandeep Singh (3):
net/dpaa2: add support for level 2 in traffic management net/enetc: add support for VFs
net/pfe: reduce driver initialization time

Jun Yang (4):
net/dpaa2: support multiple txqs en-queue for ordered net/dpaa2: secondary process handling for dpni bus/fslmc: add and scan dprc devices net/dpaa2: support recycle loopback port

Nipun Gupta (4):
bus/fslmc: update MC to 10.29
bus/fslmc: use dmb oshst for synchronization before I/O net/dpaa: check status before configuring shared MAC net/dpaa: enable checksum for shared MAC interface

Rohit Raj (1):
net/dpaa2: warn user in case of high nb desc

Vanshika Shukla (2):
net/dpaa2: fix unregistering interrupt handler
net/dpaa2: fix timestamping for IEEE1588

 doc/guides/nics/dpaa2.rst                 |   2 +-
 drivers/bus/dpaa/base/fman/fman_hw.c      |  11 +
 drivers/bus/dpaa/include/fsl_fman.h       |   2 +
 drivers/bus/dpaa/version.map              |   1 +
 drivers/bus/fslmc/fslmc_bus.c             |  15 +-
 drivers/bus/fslmc/fslmc_vfio.c            |  18 +-
 drivers/bus/fslmc/mc/dprc.c               | 129 ++++
 drivers/bus/fslmc/mc/fsl_dpmng.h          |   2 +-
 drivers/bus/fslmc/mc/fsl_dprc.h           |  46 ++
 drivers/bus/fslmc/mc/fsl_dprc_cmd.h       |  48 ++
 drivers/bus/fslmc/meson.build             |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c  | 100 +++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   |  15 +-
 drivers/bus/fslmc/qbman/include/compat.h  |   4 +-
 drivers/bus/fslmc/rte_fslmc.h             |  10 +-
 drivers/event/dpaa2/dpaa2_eventdev.c      |  12 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  |  23 +
 drivers/mempool/dpaa2/rte_dpaa2_mempool.h |  15 +
 drivers/mempool/dpaa2/version.map         |   1 +
 drivers/net/dpaa/dpaa_ethdev.c            |  17 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c    |   5 +-
 drivers/net/dpaa2/dpaa2_ethdev.c          | 117 +++-
 drivers/net/dpaa2/dpaa2_ethdev.h          |  38 +-
 drivers/net/dpaa2/dpaa2_ptp.c             |   8 +-
 drivers/net/dpaa2/dpaa2_recycle.c         | 780 ++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_rxtx.c            | 181 ++++-
 drivers/net/dpaa2/dpaa2_tm.c              | 563 +++++++++++++---
 drivers/net/dpaa2/dpaa2_tm.h              |  17 +-
 drivers/net/dpaa2/mc/dpdmux.c             |   8 +
 drivers/net/dpaa2/mc/dpkg.c               |   7 +-
 drivers/net/dpaa2/mc/dpni.c               | 417 ++++++++----
 drivers/net/dpaa2/mc/fsl_dpdmux.h         |   3 +
 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h     |   5 +-
 drivers/net/dpaa2/mc/fsl_dpni.h           | 173 +++--
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h       | 137 ++--
 drivers/net/dpaa2/meson.build             |   1 +
 drivers/net/dpaa2/version.map             |   1 +
 drivers/net/enetc/enetc_ethdev.c          |  25 +-
 drivers/net/pfe/pfe_ethdev.c              |   3 +-
 drivers/net/pfe/pfe_hif.c                 |   4 +-
 40 files changed, 2519 insertions(+), 449 deletions(-)
 create mode 100644 drivers/bus/fslmc/mc/dprc.c
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc.h
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc_cmd.h
 create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
 create mode 100644 drivers/net/dpaa2/dpaa2_recycle.c
Signature · 1 line
2.17.1
#45 lore raw

PATCH v3 1/15 bus/fslmc: update MC to 10.29

From: Nipun Gupta <[email protected]>

update MC firmware library version to 10.29

---
 drivers/bus/fslmc/mc/fsl_dpmng.h      |   2 +-
 drivers/net/dpaa2/mc/dpdmux.c         |   8 ++
 drivers/net/dpaa2/mc/dpkg.c           |   7 +-
 drivers/net/dpaa2/mc/dpni.c           | 111 ++++++++++++++++++++------
 drivers/net/dpaa2/mc/fsl_dpdmux.h     |   3 +
 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h |   5 +-
 drivers/net/dpaa2/mc/fsl_dpni.h       |  54 ++++++++++---
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h   |  57 +++++++------
 8 files changed, 181 insertions(+), 66 deletions(-)
drivers/bus/fslmc/mc/fsl_dpmng.h +1 -1
index 7e9bd96429..073d47efbf 100644
@@ -20,7 +20,7 @@ struct fsl_mc_io;
  * Management Complex firmware version information
  */
 #define MC_VER_MAJOR 10
-#define MC_VER_MINOR 28
+#define MC_VER_MINOR 29
 
 /**
  * struct mc_version
drivers/net/dpaa2/mc/dpdmux.c +8 -0
index edbb01b45b..1bb153cad7 100644
@@ -398,6 +398,9 @@ int dpdmux_get_attributes(struct fsl_mc_io *mc_io,
 	attr->num_ifs = le16_to_cpu(rsp_params->num_ifs);
 	attr->mem_size = le16_to_cpu(rsp_params->mem_size);
 	attr->default_if = le16_to_cpu(rsp_params->default_if);
+	attr->max_dmat_entries = le16_to_cpu(rsp_params->max_dmat_entries);
+	attr->max_mc_groups = le16_to_cpu(rsp_params->max_mc_groups);
+	attr->max_vlan_ids = le16_to_cpu(rsp_params->max_vlan_ids);
 
 	return 0;
 }
@@ -470,6 +473,11 @@ int dpdmux_if_disable(struct fsl_mc_io *mc_io,
  * will be updated with the minimum value of the mfls of the connected
  * dpnis and the actual value of dmux mfl.
  *
+ * If dpdmux object is created using DPDMUX_OPT_AUTO_MAX_FRAME_LEN and maximum
+ * frame length is changed for a dpni connected to dpdmux interface the change
+ * is propagated through dpdmux interfaces and will overwrite the value set using
+ * this API.
+ *
  * Return:	'0' on Success; Error code otherwise.
  */
 int dpdmux_set_max_frame_length(struct fsl_mc_io *mc_io,
drivers/net/dpaa2/mc/dpkg.c +2 -5
index 1e171eedc7..4789976b7d 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  *
- * Copyright 2017 NXP
+ * Copyright 2017-2021 NXP
  *
  */
 #include <fsl_mc_sys.h>
@@ -63,10 +63,7 @@ dpkg_prepare_key_cfg(const struct dpkg_profile_cfg *cfg, uint8_t *key_cfg_buf)
 		dpkg_set_field(extr->extract_type, EXTRACT_TYPE,
 			       cfg->extracts[i].type);
 
-		if (extr->num_of_byte_masks > DPKG_NUM_OF_MASKS)
-			return -EINVAL;
-
-		for (j = 0; j < extr->num_of_byte_masks; j++) {
+		for (j = 0; j < DPKG_NUM_OF_MASKS; j++) {
 			extr->masks[j].mask = cfg->extracts[i].masks[j].mask;
 			extr->masks[j].offset =
 				cfg->extracts[i].masks[j].offset;
drivers/net/dpaa2/mc/dpni.c +85 -26

277 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpdmux.h +3 -0
index b01a98eb59..4600ea94d4 100644
@@ -184,6 +184,9 @@ struct dpdmux_attr {
 	uint16_t num_ifs;
 	uint16_t mem_size;
 	uint16_t default_if;
+	uint16_t max_dmat_entries;
+	uint16_t max_mc_groups;
+	uint16_t max_vlan_ids;
 };
 
 int dpdmux_get_attributes(struct fsl_mc_io *mc_io,
drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h +4 -1
index f8a1b5b1ae..bf6b8a20d1 100644
@@ -35,7 +35,7 @@
 
 #define DPDMUX_CMDID_ENABLE			DPDMUX_CMD(0x002)
 #define DPDMUX_CMDID_DISABLE			DPDMUX_CMD(0x003)
-#define DPDMUX_CMDID_GET_ATTR			DPDMUX_CMD_V2(0x004)
+#define DPDMUX_CMDID_GET_ATTR			DPDMUX_CMD_V3(0x004)
 #define DPDMUX_CMDID_RESET			DPDMUX_CMD(0x005)
 #define DPDMUX_CMDID_IS_ENABLED			DPDMUX_CMD(0x006)
 #define DPDMUX_CMDID_SET_MAX_FRAME_LENGTH	DPDMUX_CMD(0x0a1)
@@ -119,6 +119,9 @@ struct dpdmux_rsp_get_attr {
 	uint32_t pad2;
 
 	uint64_t options;
+	uint16_t max_dmat_entries;
+	uint16_t max_mc_groups;
+	uint16_t max_vlan_ids;
 };
 
 struct dpdmux_cmd_set_max_frame_length {
drivers/net/dpaa2/mc/fsl_dpni.h +44 -10

148 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpni_cmd.h +34 -23

172 lines not on this page · raw message

Signature · 1 line
2.17.1
#46 lore raw

PATCH v3 2/15 bus/fslmc: use dmb oshst for synchronization before I/O

In reply to [email protected]

From: Nipun Gupta <[email protected]>

Outer Shareable Store (oshst) is sufficient for Data Memory Barrier (dmb) when doing IO on the interface via QBMAN.

This will sync L3/DDR with the L1/L2 cached data.

---
 drivers/bus/fslmc/qbman/include/compat.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/fslmc/qbman/include/compat.h +2 -2
index a4471a80af..ece5da5906 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  * Copyright (c) 2008-2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017,2021 NXP
  *
  */
 
@@ -81,7 +81,7 @@ do { \
 #define __raw_readl(p)	(*(const volatile unsigned int *)(p))
 #define __raw_writel(v, p) {*(volatile unsigned int *)(p) = (v); }
 
-#define dma_wmb()		rte_smp_mb()
+#define dma_wmb()		rte_io_wmb()
 
 #define atomic_t                rte_atomic32_t
 #define atomic_read(v)          rte_atomic32_read(v)
Signature · 1 line
2.17.1
#47 lore raw

PATCH v3 3/15 net/dpaa2: warn user in case of high nb desc

In reply to [email protected]

From: Rohit Raj <[email protected]>

Added warning message if application is configuring nb_desc more than supported by PEB memory suggesting user to configure HW descriptors in normal memory rather than in faster PEB memory.

---
 drivers/net/dpaa2/dpaa2_ethdev.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/net/dpaa2/dpaa2_ethdev.c +13 -0
index a3706439d5..f5cac8f9d9 100644
@@ -74,6 +74,9 @@ int dpaa2_timestamp_dynfield_offset = -1;
 /* Enable error queue */
 bool dpaa2_enable_err_queue;
 
+#define MAX_NB_RX_DESC		11264
+int total_nb_rx_desc;
+
 struct rte_dpaa2_xstats_name_off {
 	char name[RTE_ETH_XSTATS_NAME_SIZE];
 	uint8_t page_id; /* dpni statistics page id */
@@ -694,6 +697,13 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	DPAA2_PMD_DEBUG("dev =%p, queue =%d, pool = %p, conf =%p",
 			dev, rx_queue_id, mb_pool, rx_conf);
 
+	total_nb_rx_desc += nb_rx_desc;
+	if (total_nb_rx_desc > MAX_NB_RX_DESC) {
+		DPAA2_PMD_WARN("\nTotal nb_rx_desc exceeds %d limit. Please use Normal buffers",
+			       MAX_NB_RX_DESC);
+		DPAA2_PMD_WARN("To use Normal buffers, run 'export DPNI_NORMAL_BUF=1' before running dynamic_dpl.sh script");
+	}
+
 	/* Rx deferred start is not supported */
 	if (rx_conf->rx_deferred_start) {
 		DPAA2_PMD_ERR("%p:Rx deferred start not supported",
@@ -984,6 +994,9 @@ dpaa2_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 
 	memset(&cfg, 0, sizeof(struct dpni_queue));
 	PMD_INIT_FUNC_TRACE();
+
+	total_nb_rx_desc -= dpaa2_q->nb_desc;
+
 	if (dpaa2_q->cgid != 0xff) {
 		options = DPNI_QUEUE_OPT_CLEAR_CGID;
 		cfg.cgid = dpaa2_q->cgid;
Signature · 1 line
2.17.1
#48 lore raw

PATCH v3 4/15 net/dpaa2: fix unregistering interrupt handler

In reply to [email protected]

From: Vanshika Shukla <[email protected]>

This patch fixes code that handles unregistering LSC interrupt handler in dpaa2_dev_stop API.

Fixes c5acbb5ea20e ("net/dpaa2: support link status event")
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/dpaa2/dpaa2_ethdev.c +6 -1
index f5cac8f9d9..18ff07249f 100644
@@ -1265,7 +1265,12 @@ dpaa2_dev_stop(struct rte_eth_dev *dev)
 	struct fsl_mc_io *dpni = (struct fsl_mc_io *)dev->process_private;
 	int ret;
 	struct rte_eth_link link;
-	struct rte_intr_handle *intr_handle = dev->intr_handle;
+	struct rte_device *rdev = dev->device;
+	struct rte_intr_handle *intr_handle;
+	struct rte_dpaa2_device *dpaa2_dev;
+
+	dpaa2_dev = container_of(rdev, struct rte_dpaa2_device, device);
+	intr_handle = dpaa2_dev->intr_handle;
 
 	PMD_INIT_FUNC_TRACE();
 
Signature · 1 line
2.17.1
#49 lore raw

PATCH v3 5/15 net/dpaa2: fix timestamping for IEEE1588

In reply to [email protected]

From: Vanshika Shukla <[email protected]>

The current implementation of DPAA2 driver code is such that it records Rx and Tx timestamp for PTP without checking if they are PTP packets or not. Packets for which RTE_MBUF_F_RX_IEEE1588_TMST and RTE_MBUF_F_TX_IEEE1588_TMST is not set, Rx and Tx timestamp should not be recorded.

This patch fixes this issue by checking if the required flags are set in the mbuf before recording timestamps.

Also this change defines separate values for
DPAA2_TX_CONF_ENABLE and DPAA2_NO_PREFETCH_RX

Fixes e806bf878c17 ("net/dpaa2: support timestamp")
---
 drivers/net/dpaa2/dpaa2_ethdev.h |  2 +-
 drivers/net/dpaa2/dpaa2_ptp.c    |  8 ++++---
 drivers/net/dpaa2/dpaa2_rxtx.c   | 39 +++++++++++++++++++++++++-------
 3 files changed, 37 insertions(+), 12 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.h +1 -1
index c5e9267bf0..c21571e63d 100644
@@ -62,7 +62,7 @@
 /* Disable RX tail drop, default is enable */
 #define DPAA2_RX_TAILDROP_OFF	0x04
 /* Tx confirmation enabled */
-#define DPAA2_TX_CONF_ENABLE	0x08
+#define DPAA2_TX_CONF_ENABLE	0x06
 
 #define DPAA2_RSS_OFFLOAD_ALL ( \
 	RTE_ETH_RSS_L2_PAYLOAD | \
drivers/net/dpaa2/dpaa2_ptp.c +5 -3
index 8d79e39244..3a4536dd69 100644
@@ -111,10 +111,12 @@ int dpaa2_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 {
 	struct dpaa2_dev_priv *priv = dev->data->dev_private;
 
-	if (priv->next_tx_conf_queue)
-		dpaa2_dev_tx_conf(priv->next_tx_conf_queue);
-	else
+	if (priv->next_tx_conf_queue) {
+		while (!priv->tx_timestamp)
+			dpaa2_dev_tx_conf(priv->next_tx_conf_queue);
+	} else {
 		return -1;
+	}
 	*timestamp = rte_ns_to_timespec(priv->tx_timestamp);
 
 	return 0;
drivers/net/dpaa2/dpaa2_rxtx.c +31 -8
index c65589a5f3..ee3ed1b152 100644
@@ -140,8 +140,10 @@ dpaa2_dev_rx_parse_slow(struct rte_mbuf *mbuf,
 			annotation->word3, annotation->word4);
 
 #if defined(RTE_LIBRTE_IEEE1588)
-	if (BIT_ISSET_AT_POS(annotation->word1, DPAA2_ETH_FAS_PTP))
+	if (BIT_ISSET_AT_POS(annotation->word1, DPAA2_ETH_FAS_PTP)) {
 		mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_PTP;
+		mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_TMST;
+	}
 #endif
 
 	if (BIT_ISSET_AT_POS(annotation->word3, L2_VLAN_1_PRESENT)) {
@@ -769,7 +771,10 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 		else
 			bufs[num_rx] = eth_fd_to_mbuf(fd, eth_data->port_id);
 #if defined(RTE_LIBRTE_IEEE1588)
-		priv->rx_timestamp = *dpaa2_timestamp_dynfield(bufs[num_rx]);
+		if (bufs[num_rx]->ol_flags & PKT_RX_IEEE1588_TMST) {
+			priv->rx_timestamp =
+				*dpaa2_timestamp_dynfield(bufs[num_rx]);
+		}
 #endif
 
 		if (eth_data->dev_conf.rxmode.offloads &
@@ -986,6 +991,13 @@ dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 				bufs[num_rx] = eth_fd_to_mbuf(fd,
 							eth_data->port_id);
 
+#if defined(RTE_LIBRTE_IEEE1588)
+		if (bufs[num_rx]->ol_flags & PKT_RX_IEEE1588_TMST) {
+			priv->rx_timestamp =
+				*dpaa2_timestamp_dynfield(bufs[num_rx]);
+		}
+#endif
+
 		if (eth_data->dev_conf.rxmode.offloads &
 				RTE_ETH_RX_OFFLOAD_VLAN_STRIP) {
 			rte_vlan_strip(bufs[num_rx]);
@@ -1021,6 +1033,8 @@ uint16_t dpaa2_dev_tx_conf(void *queue)
 	struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data;
 	struct dpaa2_dev_priv *priv = eth_data->dev_private;
 	struct dpaa2_annot_hdr *annotation;
+	void *v_addr;
+	struct rte_mbuf *mbuf;
 #endif
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
@@ -1105,10 +1119,16 @@ uint16_t dpaa2_dev_tx_conf(void *queue)
 			num_tx_conf++;
 			num_pulled++;
 #if defined(RTE_LIBRTE_IEEE1588)
-			annotation = (struct dpaa2_annot_hdr *)((size_t)
-				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)) +
-				DPAA2_FD_PTA_SIZE);
-			priv->tx_timestamp = annotation->word2;
+			v_addr = DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+			mbuf = DPAA2_INLINE_MBUF_FROM_BUF(v_addr,
+				rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size);
+
+			if (mbuf->ol_flags & PKT_TX_IEEE1588_TMST) {
+				annotation = (struct dpaa2_annot_hdr *)((size_t)
+					DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)) +
+					DPAA2_FD_PTA_SIZE);
+				priv->tx_timestamp = annotation->word2;
+			}
 #endif
 		} while (pending);
 
@@ -1184,8 +1204,11 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	 * corresponding to last packet transmitted for reading
 	 * the timestamp
 	 */
-	priv->next_tx_conf_queue = dpaa2_q->tx_conf_queue;
-	dpaa2_dev_tx_conf(dpaa2_q->tx_conf_queue);
+	if ((*bufs)->ol_flags & PKT_TX_IEEE1588_TMST) {
+		priv->next_tx_conf_queue = dpaa2_q->tx_conf_queue;
+		dpaa2_dev_tx_conf(dpaa2_q->tx_conf_queue);
+		priv->tx_timestamp = 0;
+	}
 #endif
 
 	/*Prepare enqueue descriptor*/
Signature · 1 line
2.17.1
#50 lore raw

PATCH v3 6/15 net/dpaa2: support multiple txqs en-queue for ordered

In reply to [email protected]

From: Jun Yang <[email protected]>

Support the tx enqueue in order queue mode, where queue id for each event may be different.

---
 drivers/event/dpaa2/dpaa2_eventdev.c |  12 ++-
 drivers/net/dpaa2/dpaa2_ethdev.h     |   4 +
 drivers/net/dpaa2/dpaa2_rxtx.c       | 142 +++++++++++++++++++++++++++
 drivers/net/dpaa2/version.map        |   1 +
 4 files changed, 155 insertions(+), 4 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev.c +8 -4
index 4d94c315d2..ffc7b8b073 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2017,2019 NXP
+ * Copyright 2017,2019-2021 NXP
  */
 
 #include <assert.h>
@@ -1003,16 +1003,20 @@ dpaa2_eventdev_txa_enqueue(void *port,
 			   struct rte_event ev[],
 			   uint16_t nb_events)
 {
-	struct rte_mbuf *m = (struct rte_mbuf *)ev[0].mbuf;
+	void *txq[DPAA2_EVENT_MAX_PORT_ENQUEUE_DEPTH];
+	struct rte_mbuf *m[DPAA2_EVENT_MAX_PORT_ENQUEUE_DEPTH];
 	uint8_t qid, i;
 
 	RTE_SET_USED(port);
 
 	for (i = 0; i < nb_events; i++) {
-		qid = rte_event_eth_tx_adapter_txq_get(m);
-		rte_eth_tx_burst(m->port, qid, &m, 1);
+		m[i] = (struct rte_mbuf *)ev[i].mbuf;
+		qid = rte_event_eth_tx_adapter_txq_get(m[i]);
+		txq[i] = rte_eth_devices[m[i]->port].data->tx_queues[qid];
 	}
 
+	dpaa2_dev_tx_multi_txq_ordered(txq, m, nb_events);
+
 	return nb_events;
 }
 
drivers/net/dpaa2/dpaa2_ethdev.h +4 -0
index c21571e63d..e001a7e49d 100644
@@ -241,6 +241,10 @@ void dpaa2_dev_process_ordered_event(struct qbman_swp *swp,
 uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 uint16_t dpaa2_dev_tx_ordered(void *queue, struct rte_mbuf **bufs,
 			      uint16_t nb_pkts);
+__rte_internal
+uint16_t dpaa2_dev_tx_multi_txq_ordered(void **queue,
+		struct rte_mbuf **bufs, uint16_t nb_pkts);
+
 uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 void dpaa2_dev_free_eqresp_buf(uint16_t eqresp_ci);
 void dpaa2_flow_clean(struct rte_eth_dev *dev);
drivers/net/dpaa2/dpaa2_rxtx.c +142 -0

148 lines not on this page · raw message

drivers/net/dpaa2/version.map +1 -0
index 2fe61f3442..cc82b8579d 100644
@@ -21,6 +21,7 @@ EXPERIMENTAL {
 INTERNAL {
 	global:
 
+	dpaa2_dev_tx_multi_txq_ordered;
 	dpaa2_eth_eventq_attach;
 	dpaa2_eth_eventq_detach;
 
Signature · 1 line
2.17.1
#51 lore raw

PATCH v3 7/15 net/dpaa2: add support for level 2 in traffic management

In reply to [email protected]

From: Gagandeep Singh <[email protected]>

This patch adds support for level 2 for QoS shaping.

---
 doc/guides/nics/dpaa2.rst           |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c    |  55 ++-
 drivers/net/dpaa2/dpaa2_ethdev.h    |   6 +-
 drivers/net/dpaa2/dpaa2_tm.c        | 563 ++++++++++++++++++++++------
 drivers/net/dpaa2/dpaa2_tm.h        |  17 +-
 drivers/net/dpaa2/mc/dpni.c         | 302 +++++++++------
 drivers/net/dpaa2/mc/fsl_dpni.h     | 119 +++---
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h |  79 ++--
 8 files changed, 791 insertions(+), 352 deletions(-)
doc/guides/nics/dpaa2.rst +1 -1
index 831bc56488..2d113f53df 100644
@@ -588,7 +588,7 @@ Supported Features
 
 The following capabilities are supported:
 
-- Level0 (root node) and Level1 are supported.
+- Level0 (root node), Level1 and Level2 are supported.
 - 1 private shaper at root node (port level) is supported.
 - 8 TX queues per port supported (1 channel per port)
 - Both SP and WFQ scheduling mechanisms are supported on all 8 queues.
drivers/net/dpaa2/dpaa2_ethdev.c +25 -30

127 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.h +5 -1
index e001a7e49d..1fc2fc367e 100644
@@ -25,6 +25,7 @@
 #define MAX_RX_QUEUES		128
 #define MAX_TX_QUEUES		16
 #define MAX_DPNI		8
+#define DPAA2_MAX_CHANNELS	16
 
 #define DPAA2_RX_DEFAULT_NBDESC 512
 
@@ -160,15 +161,17 @@ struct dpaa2_dev_priv {
 	void *rx_vq[MAX_RX_QUEUES];
 	void *tx_vq[MAX_TX_QUEUES];
 	struct dpaa2_bp_list *bp_list; /**<Attached buffer pool list */
-	void *tx_conf_vq[MAX_TX_QUEUES];
+	void *tx_conf_vq[MAX_TX_QUEUES * DPAA2_MAX_CHANNELS];
 	void *rx_err_vq;
 	uint8_t flags; /*dpaa2 config flags */
 	uint8_t max_mac_filters;
 	uint8_t max_vlan_filters;
 	uint8_t num_rx_tc;
+	uint8_t num_tx_tc;
 	uint16_t qos_entries;
 	uint16_t fs_entries;
 	uint8_t dist_queues;
+	uint8_t num_channels;
 	uint8_t en_ordered;
 	uint8_t en_loose_ordered;
 	uint8_t max_cgs;
@@ -190,6 +193,7 @@ struct dpaa2_dev_priv {
 
 	struct rte_eth_dev *eth_dev; /**< Pointer back to holding ethdev */
 
+	uint8_t channel_inuse;
 	LIST_HEAD(, rte_flow) flows; /**< Configured flow rule handles. */
 	LIST_HEAD(nodes, dpaa2_tm_node) nodes;
 	LIST_HEAD(shaper_profiles, dpaa2_tm_shaper_profile) shaper_profiles;
drivers/net/dpaa2/dpaa2_tm.c +457 -106

778 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_tm.h +16 -1
index 6632fab687..cfbb437322 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2020 NXP
+ * Copyright 2020-2021 NXP
  */
 
 #ifndef _DPAA2_TM_H_
@@ -7,6 +7,18 @@
 
 #include <rte_tm.h>
 
+enum node_type {
+	NON_LEAF_NODE = 0,
+	LEAF_NODE
+};
+
+enum level_type {
+	LNI_LEVEL = 0,
+	CHANNEL_LEVEL,
+	QUEUE_LEVEL,
+	MAX_LEVEL
+};
+
 struct dpaa2_tm_shaper_profile {
 	LIST_ENTRY(dpaa2_tm_shaper_profile) next;
 	uint32_t id;
@@ -18,6 +30,9 @@ struct dpaa2_tm_node {
 	LIST_ENTRY(dpaa2_tm_node) next;
 	uint32_t id;
 	uint32_t type;
+	uint32_t level_id;
+	uint16_t channel_id; /* Only for level 1 nodes */
+	uint16_t tc_id; /* Only for level 1 nodes */
 	int refcnt;
 	struct dpaa2_tm_node *parent;
 	struct dpaa2_tm_shaper_profile *profile;
drivers/net/dpaa2/mc/dpni.c +186 -116

323 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpni.h +62 -57

135 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpni_cmd.h +39 -40

110 lines not on this page · raw message

Signature · 1 line
2.17.1
#52 lore raw

PATCH v3 8/15 net/dpaa2: secondary process handling for dpni

In reply to [email protected]

From: Jun Yang <[email protected]>

This change uses 'dev->process_private' instead of 'priv->hw' to get dpmcp per process while setting flow distribution, as priv->hw is only valid for primary process.
It also initialize rte_dpaa2_bpid_info in secondary process.

---
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  | 23 +++++++++++++++++++++++
 drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 15 +++++++++++++++
 drivers/mempool/dpaa2/version.map         |  1 +
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c    |  5 ++---
 drivers/net/dpaa2/dpaa2_ethdev.c          | 10 ++++++++--
 drivers/net/dpaa2/dpaa2_ethdev.h          |  3 ++-
 6 files changed, 51 insertions(+), 6 deletions(-)
drivers/mempool/dpaa2/dpaa2_hw_mempool.c +23 -0
index 39c6252a63..56c629c681 100644
@@ -263,6 +263,29 @@ rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused,
 	}
 }
 
+int rte_dpaa2_bpid_info_init(struct rte_mempool *mp)
+{
+	struct dpaa2_bp_info *bp_info = mempool_to_bpinfo(mp);
+	uint32_t bpid = bp_info->bpid;
+
+	if (!rte_dpaa2_bpid_info) {
+		rte_dpaa2_bpid_info = (struct dpaa2_bp_info *)rte_malloc(NULL,
+				      sizeof(struct dpaa2_bp_info) * MAX_BPID,
+				      RTE_CACHE_LINE_SIZE);
+		if (rte_dpaa2_bpid_info == NULL)
+			return -ENOMEM;
+		memset(rte_dpaa2_bpid_info, 0,
+		       sizeof(struct dpaa2_bp_info) * MAX_BPID);
+	}
+
+	rte_dpaa2_bpid_info[bpid].meta_data_size = sizeof(struct rte_mbuf)
+				+ rte_pktmbuf_priv_size(mp);
+	rte_dpaa2_bpid_info[bpid].bp_list = bp_info->bp_list;
+	rte_dpaa2_bpid_info[bpid].bpid = bpid;
+
+	return 0;
+}
+
 uint16_t
 rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp)
 {
drivers/mempool/dpaa2/rte_dpaa2_mempool.h +15 -0
index 4a22b7c42e..28dea74326 100644
@@ -46,6 +46,21 @@ rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp);
 struct rte_mbuf *
 rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr);
 
+/**
+ * Initialize the rte_dpaa2_bpid_info
+ * In generial, it is called in the secondary process and
+ * mp has been created in the primary process.
+ *
+ * @param mp
+ *   memory pool
+ *
+ * @return
+ *  - 0 on success.
+ *  - (<0) on failure.
+ */
+__rte_internal
+int rte_dpaa2_bpid_info_init(struct rte_mempool *mp);
+
 #ifdef __cplusplus
 }
 #endif
drivers/mempool/dpaa2/version.map +1 -0
index 49c460ec54..cfd4ae617a 100644
@@ -11,5 +11,6 @@ INTERNAL {
 	global:
 
 	rte_dpaa2_bpid_info;
+	rte_dpaa2_bpid_info_init;
 	rte_dpaa2_mbuf_alloc_bulk;
 };
drivers/net/dpaa2/base/dpaa2_hw_dpni.c +2 -3
index 3170694841..9509f6e8a3 100644
@@ -95,7 +95,7 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
 	uint64_t req_dist_set, int tc_index)
 {
 	struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
-	struct fsl_mc_io *dpni = priv->hw;
+	struct fsl_mc_io *dpni = eth_dev->process_private;
 	struct dpni_rx_dist_cfg tc_cfg;
 	struct dpkg_profile_cfg kg_cfg;
 	void *p_params;
@@ -457,13 +457,12 @@ dpaa2_distset_to_dpkg_profile_cfg(
 
 int
 dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
-		     void *blist)
+	struct fsl_mc_io *dpni, void *blist)
 {
 	/* Function to attach a DPNI with a buffer pool list. Buffer pool list
 	 * handle is passed in blist.
 	 */
 	int32_t retcode;
-	struct fsl_mc_io *dpni = priv->hw;
 	struct dpni_pools_cfg bpool_cfg;
 	struct dpaa2_bp_list *bp_list = (struct dpaa2_bp_list *)blist;
 	struct dpni_buffer_layout layout;
drivers/net/dpaa2/dpaa2_ethdev.c +8 -2
index b91e773605..a45beed75f 100644
@@ -18,6 +18,7 @@
 #include <rte_dev.h>
 #include <rte_fslmc.h>
 #include <rte_flow_driver.h>
+#include "rte_dpaa2_mempool.h"
 
 #include "dpaa2_pmd_logs.h"
 #include <fslmc_vfio.h>
@@ -712,9 +713,14 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	if (!priv->bp_list || priv->bp_list->mp != mb_pool) {
+		if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+			ret = rte_dpaa2_bpid_info_init(mb_pool);
+			if (ret)
+				return ret;
+		}
 		bpid = mempool_to_bpid(mb_pool);
-		ret = dpaa2_attach_bp_list(priv,
-					   rte_dpaa2_bpid_info[bpid].bp_list);
+		ret = dpaa2_attach_bp_list(priv, dpni,
+				rte_dpaa2_bpid_info[bpid].bp_list);
 		if (ret)
 			return ret;
 	}
drivers/net/dpaa2/dpaa2_ethdev.h +2 -1
index 1fc2fc367e..bd33a22a8e 100644
@@ -208,7 +208,8 @@ int dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
 int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
 			   uint8_t tc_index);
 
-int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
+int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
+	struct fsl_mc_io *dpni, void *blist);
 
 __rte_internal
 int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
Signature · 1 line
2.17.1
#53 lore raw

PATCH v3 9/15 bus/fslmc: add and scan dprc devices

In reply to [email protected]

From: Jun Yang <[email protected]>

In order to get connection endpoint of each objects, scan the dprc object.

---
 drivers/bus/fslmc/fslmc_bus.c            |  15 ++-
 drivers/bus/fslmc/fslmc_vfio.c           |  18 +++-
 drivers/bus/fslmc/mc/dprc.c              | 129 +++++++++++++++++++++++
 drivers/bus/fslmc/mc/fsl_dprc.h          |  46 ++++++++
 drivers/bus/fslmc/mc/fsl_dprc_cmd.h      |  48 +++++++++
 drivers/bus/fslmc/meson.build            |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c | 100 ++++++++++++++++++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h  |  12 +++
 drivers/bus/fslmc/rte_fslmc.h            |  10 +-
 9 files changed, 374 insertions(+), 8 deletions(-)
 create mode 100644 drivers/bus/fslmc/mc/dprc.c
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc.h
 create mode 100644 drivers/bus/fslmc/mc/fsl_dprc_cmd.h
 create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
drivers/bus/fslmc/fslmc_bus.c +10 -5
index a0ef24cdc8..a3c0d838c4 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016,2018-2019 NXP
+ *   Copyright 2016,2018-2021 NXP
  *
  */
 
@@ -136,10 +136,6 @@ scan_one_fslmc_device(char *dev_name)
 	if (!dev_name)
 		return ret;
 
-	/* Ignore the Container name itself */
-	if (!strncmp("dprc", dev_name, 4))
-		return 0;
-
 	/* Creating a temporary copy to perform cut-parse over string */
 	dup_dev_name = strdup(dev_name);
 	if (!dup_dev_name) {
@@ -197,6 +193,8 @@ scan_one_fslmc_device(char *dev_name)
 		dev->dev_type = DPAA2_MUX;
 	else if (!strncmp("dprtc", t_ptr, 5))
 		dev->dev_type = DPAA2_DPRTC;
+	else if (!strncmp("dprc", t_ptr, 4))
+		dev->dev_type = DPAA2_DPRC;
 	else
 		dev->dev_type = DPAA2_UNKNOWN;
 
@@ -339,6 +337,13 @@ rte_fslmc_scan(void)
 		goto scan_fail;
 	}
 
+	/* Scan the DPRC container object */
+	ret = scan_one_fslmc_device(fslmc_container);
+	if (ret != 0) {
+		/* Error in parsing directory - exit gracefully */
+		goto scan_fail_cleanup;
+	}
+
 	while ((entry = readdir(dir)) != NULL) {
 		if (entry->d_name[0] == '.' || entry->d_type != DT_DIR)
 			continue;
drivers/bus/fslmc/fslmc_vfio.c +17 -1
index b4704eeae4..1b89a56bbc 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016-2019 NXP
+ *   Copyright 2016-2021 NXP
  *
  */
 
@@ -728,6 +728,7 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev)
 	case DPAA2_BPOOL:
 	case DPAA2_DPRTC:
 	case DPAA2_MUX:
+	case DPAA2_DPRC:
 		TAILQ_FOREACH(object, &dpaa2_obj_list, next) {
 			if (dev->dev_type == object->dev_type)
 				object->create(dev_fd, &device_info,
@@ -881,6 +882,21 @@ fslmc_vfio_process_group(void)
 		return -1;
 	}
 
+	/* Search for DPRC device next as it updates endpoint of
+	 * other devices.
+	 */
+	current_device = 0;
+	RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
+		if (dev->dev_type == DPAA2_DPRC) {
+			ret = fslmc_process_iodevices(dev);
+			if (ret) {
+				DPAA2_BUS_ERR("Unable to process dprc");
+				return -1;
+			}
+			TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next);
+		}
+	}
+
 	current_device = 0;
 	RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next,
 		dev_temp) {
drivers/bus/fslmc/mc/dprc.c new file +129 -0

129 lines not on this page · raw message

drivers/bus/fslmc/mc/fsl_dprc.h new file +46 -0

46 lines not on this page · raw message

drivers/bus/fslmc/mc/fsl_dprc_cmd.h new file +48 -0

48 lines not on this page · raw message

drivers/bus/fslmc/meson.build +3 -1
index 54be76f516..162ca286fe 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright 2018 NXP
+# Copyright 2018,2021 NXP
 
 if not is_linux
     build = false
@@ -16,10 +16,12 @@ sources = files(
         'mc/dpdmai.c',
         'mc/dpio.c',
         'mc/dpmng.c',
+        'mc/dprc.c',
         'mc/mc_sys.c',
         'portal/dpaa2_hw_dpbp.c',
         'portal/dpaa2_hw_dpci.c',
         'portal/dpaa2_hw_dpio.c',
+        'portal/dpaa2_hw_dprc.c',
         'qbman/qbman_portal.c',
         'qbman/qbman_debug.c',
 )
drivers/bus/fslmc/portal/dpaa2_hw_dprc.c new file +100 -0

100 lines not on this page · raw message

drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +12 -0
index b1bba1ac36..8cb4d404aa 100644
@@ -187,6 +187,18 @@ struct swp_active_dqs {
 
 extern struct swp_active_dqs rte_global_active_dqs_list[NUM_MAX_SWP];
 
+/**
+ * A structure describing a DPAA2 container.
+ */
+struct dpaa2_dprc_dev {
+	TAILQ_ENTRY(dpaa2_dprc_dev) next;
+		/**< Pointer to Next device instance */
+	const char *name;
+	struct fsl_mc_io dprc;  /** handle to DPRC portal object */
+	uint16_t token;
+	uint32_t dprc_id; /*HW ID for DPRC object */
+};
+
 struct dpaa2_dpci_dev {
 	TAILQ_ENTRY(dpaa2_dpci_dev) next;
 		/**< Pointer to Next device instance */
drivers/bus/fslmc/rte_fslmc.h +9 -1
index 729f360646..12b586b13b 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016,2019 NXP
+ *   Copyright 2016,2021 NXP
  *
  */
 
@@ -37,6 +37,9 @@ extern "C" {
 
 #include <fslmc_vfio.h>
 
+#include "portal/dpaa2_hw_pvt.h"
+#include "portal/dpaa2_hw_dpio.h"
+
 #define FSLMC_OBJECT_MAX_LEN 32   /**< Length of each device on bus */
 
 #define DPAA2_INVALID_MBUF_SEQN        0
@@ -88,6 +91,8 @@ enum rte_dpaa2_dev_type {
 	DPAA2_QDMA,     /**< DPDMAI type device */
 	DPAA2_MUX,	/**< DPDMUX type device */
 	DPAA2_DPRTC,	/**< DPRTC type device */
+	DPAA2_DPRC,	/**< DPRC type device */
+	DPAA2_MAC,	/**< DPMAC type device */
 	/* Unknown device placeholder */
 	DPAA2_UNKNOWN,
 	DPAA2_DEVTYPE_MAX,
@@ -122,6 +127,9 @@ struct rte_dpaa2_device {
 	};
 	enum rte_dpaa2_dev_type dev_type;   /**< Device Type */
 	uint16_t object_id;                 /**< DPAA2 Object ID */
+	enum rte_dpaa2_dev_type ep_dev_type;   /**< Endpoint Device Type */
+	uint16_t ep_object_id;                 /**< Endpoint DPAA2 Object ID */
+	char ep_name[RTE_DEV_NAME_MAX_LEN];
 	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
 	struct rte_dpaa2_driver *driver;    /**< Associated driver */
 	char name[FSLMC_OBJECT_MAX_LEN];    /**< DPAA2 Object name*/
Signature · 1 line
2.17.1
#54 lore raw

PATCH v3 10/15 net/dpaa2: support recycle loopback port

In reply to [email protected]

From: Jun Yang <[email protected]>

DPAA2 recycle port is used for configuring the device in the loopback mode. Loopback configuration can be at dpni level or at serdes level.

---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h |   3 +-
 drivers/net/dpaa2/dpaa2_ethdev.c        |  32 +-
 drivers/net/dpaa2/dpaa2_ethdev.h        |  23 +
 drivers/net/dpaa2/dpaa2_recycle.c       | 780 ++++++++++++++++++++++++
 drivers/net/dpaa2/mc/dpni.c             |  32 +
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h     |   1 +
 drivers/net/dpaa2/meson.build           |   1 +
 7 files changed, 870 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/dpaa2/dpaa2_recycle.c
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +2 -1
index 8cb4d404aa..4d0f7e4b5d 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016-2020 NXP
+ *   Copyright 2016-2021 NXP
  *
  */
 
@@ -176,6 +176,7 @@ struct dpaa2_queue {
 	uint16_t nb_desc;
 	uint16_t resv;
 	uint64_t offloads;
+	uint64_t lpbk_cntx;
 } __rte_cache_aligned;
 
 struct swp_active_dqs {
drivers/net/dpaa2/dpaa2_ethdev.c +31 -1
index a45beed75f..d81f8cb07a 100644
@@ -668,6 +668,30 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
 	if (rx_offloads & RTE_ETH_RX_OFFLOAD_VLAN_FILTER)
 		dpaa2_vlan_offload_set(dev, RTE_ETH_VLAN_FILTER_MASK);
 
+	if (eth_conf->lpbk_mode) {
+		ret = dpaa2_dev_recycle_config(dev);
+		if (ret) {
+			DPAA2_PMD_ERR("Error to configure %s to recycle port.",
+				dev->data->name);
+
+			return ret;
+		}
+	} else {
+		/** User may disable loopback mode by calling
+		 * "dev_configure" with lpbk_mode cleared.
+		 * No matter the port was configured recycle or not,
+		 * recycle de-configure is called here.
+		 * If port is not recycled, the de-configure will return directly.
+		 */
+		ret = dpaa2_dev_recycle_deconfig(dev);
+		if (ret) {
+			DPAA2_PMD_ERR("Error to de-configure recycle port %s.",
+				dev->data->name);
+
+			return ret;
+		}
+	}
+
 	dpaa2_tm_init(dev);
 
 	return 0;
@@ -2601,6 +2625,9 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 		return -1;
 	}
 
+	if (eth_dev->data->dev_conf.lpbk_mode)
+		dpaa2_dev_recycle_deconfig(eth_dev);
+
 	/* Clean the device first */
 	ret = dpni_reset(dpni_dev, CMD_PRI_LOW, priv->token);
 	if (ret) {
@@ -2624,6 +2651,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	priv->dist_queues = attr.num_queues;
 	priv->num_channels = attr.num_channels;
 	priv->channel_inuse = 0;
+	rte_spinlock_init(&priv->lpbk_qp_lock);
 
 	/* only if the custom CG is enabled */
 	if (attr.options & DPNI_OPT_CUSTOM_CG)
@@ -2808,7 +2836,9 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 			return ret;
 		}
 	}
-	RTE_LOG(INFO, PMD, "%s: netdev created\n", eth_dev->data->name);
+	RTE_LOG(INFO, PMD, "%s: netdev created, connected to %s\n",
+		eth_dev->data->name, dpaa2_dev->ep_name);
+
 	return 0;
 init_err:
 	dpaa2_dev_close(eth_dev);
drivers/net/dpaa2/dpaa2_ethdev.h +23 -0
index bd33a22a8e..b032da9eff 100644
@@ -11,6 +11,7 @@
 #include <rte_event_eth_rx_adapter.h>
 #include <rte_pmd_dpaa2.h>
 
+#include <rte_fslmc.h>
 #include <dpaa2_hw_pvt.h>
 #include "dpaa2_tm.h"
 
@@ -65,6 +66,18 @@
 /* Tx confirmation enabled */
 #define DPAA2_TX_CONF_ENABLE	0x06
 
+/* HW loopback the egress traffic to self ingress*/
+#define DPAA2_TX_MAC_LOOPBACK_MODE 0x20
+
+#define DPAA2_TX_SERDES_LOOPBACK_MODE 0x40
+
+#define DPAA2_TX_DPNI_LOOPBACK_MODE 0x80
+
+#define DPAA2_TX_LOOPBACK_MODE \
+	(DPAA2_TX_MAC_LOOPBACK_MODE | \
+	DPAA2_TX_SERDES_LOOPBACK_MODE | \
+	DPAA2_TX_DPNI_LOOPBACK_MODE)
+
 #define DPAA2_RSS_OFFLOAD_ALL ( \
 	RTE_ETH_RSS_L2_PAYLOAD | \
 	RTE_ETH_RSS_IP | \
@@ -192,6 +205,7 @@ struct dpaa2_dev_priv {
 	struct dpaa2_queue *next_tx_conf_queue;
 
 	struct rte_eth_dev *eth_dev; /**< Pointer back to holding ethdev */
+	rte_spinlock_t lpbk_qp_lock;
 
 	uint8_t channel_inuse;
 	LIST_HEAD(, rte_flow) flows; /**< Configured flow rule handles. */
@@ -268,4 +282,13 @@ int dpaa2_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
 						uint32_t flags __rte_unused);
 int dpaa2_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 					  struct timespec *timestamp);
+
+int dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev);
+int dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev);
+int dpaa2_dev_recycle_qp_setup(struct rte_dpaa2_device *dpaa2_dev,
+	uint16_t qidx, uint64_t cntx,
+	eth_rx_burst_t tx_lpbk, eth_tx_burst_t rx_lpbk,
+	struct dpaa2_queue **txq,
+	struct dpaa2_queue **rxq);
+
 #endif /* _DPAA2_ETHDEV_H */
drivers/net/dpaa2/dpaa2_recycle.c new file +780 -0

780 lines not on this page · raw message

drivers/net/dpaa2/mc/dpni.c +32 -0
index b7a65cb637..7a2bc15eb4 100644
@@ -3087,3 +3087,35 @@ int dpni_get_custom_tpid(struct fsl_mc_io *mc_io, uint32_t cmd_flags,
 	return err;
 }
 
+/**
+ * dpni_set_port_cfg() - performs configurations at physical port connected on
+ *		this dpni. The command have effect only if dpni is connected to
+ *		another dpni object
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPNI object
+ * @flags:	Valid fields from port_cfg structure
+ * @port_cfg: Configuration data; one or more of DPNI_PORT_CFG_
+ * The command can be called only when dpni is connected to a dpmac object. If
+ * the dpni is unconnected or the endpoint is not a dpni it will return error.
+ * If dpmac endpoint is disconnected the settings will be lost
+ */
+int dpni_set_port_cfg(struct fsl_mc_io *mc_io, uint32_t cmd_flags,
+		uint16_t token, uint32_t flags, struct dpni_port_cfg *port_cfg)
+{
+	struct dpni_cmd_set_port_cfg *cmd_params;
+	struct mc_command cmd = { 0 };
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_PORT_CFG,
+			cmd_flags, token);
+
+	cmd_params = (struct dpni_cmd_set_port_cfg *)cmd.params;
+	cmd_params->flags = cpu_to_le32(flags);
+	dpni_set_field(cmd_params->bit_params,	PORT_LOOPBACK_EN,
+			!!port_cfg->loopback_en);
+
+	/* send command to MC */
+	return mc_send_command(mc_io, &cmd);
+}
+
drivers/net/dpaa2/mc/fsl_dpni_cmd.h +1 -0
index ed0bd7615a..b7bd7556af 100644
@@ -119,6 +119,7 @@
 #define DPNI_CMDID_REMOVE_CUSTOM_TPID		DPNI_CMD(0x276)
 #define DPNI_CMDID_GET_CUSTOM_TPID		DPNI_CMD(0x277)
 #define DPNI_CMDID_GET_LINK_CFG			DPNI_CMD(0x278)
+#define DPNI_CMDID_SET_PORT_CFG			DPNI_CMD(0x27B)
 
 /* Macros for accessing command fields smaller than 1byte */
 #define DPNI_MASK(field)	\
drivers/net/dpaa2/meson.build +1 -0
index 21b827a259..51598c048c 100644
@@ -14,6 +14,7 @@ sources = files(
         'dpaa2_mux.c',
         'dpaa2_ethdev.c',
         'dpaa2_flow.c',
+        'dpaa2_recycle.c',
         'dpaa2_rxtx.c',
         'dpaa2_sparser.c',
         'dpaa2_ptp.c',
Signature · 1 line
2.17.1
#55 lore raw

Re: [PATCH v3 10/15] net/dpaa2: support recycle loopback port

Hello guys,

Quoted 32 lines · On Mon, Jan 3, 2022 at 11:02 AM <[email protected]> wrote:
drivers/net/dpaa2/dpaa2_recycle.c new file +26 -0
new file mode 100644
index 0000000000..e274d24ead
@@ -0,0 +1,780 @@
+/* * SPDX-License-Identifier: BSD-3-Clause
+ *
+ *   Copyright 2019-2021 NXP
+ *
+ */
+
+#include <time.h>
+#include <net/if.h>
+
+#include <rte_mbuf.h>
+#include <ethdev_driver.h>
+#include <rte_malloc.h>
+#include <rte_memcpy.h>
+#include <rte_string_fns.h>
+#include <rte_cycles.h>
+#include <rte_kvargs.h>
+#include <rte_dev.h>
+#include <rte_fslmc.h>
+#include <rte_flow_driver.h>
+
+#include "dpaa2_pmd_logs.h"
+#include <fslmc_vfio.h>
+#include <dpaa2_hw_pvt.h>
+#include <dpaa2_hw_mempool.h>
+#include <dpaa2_hw_dpio.h>
+#include <mc/fsl_dpmng.h>

drivers/net/dpaa2/dpaa2_recycle.c line 36

Quoted 10 lines
drivers/net/dpaa2/dpaa2_recycle.c new file +10 -0
+#include "dpaa2_ethdev.h"
+#include "dpaa2_sparser.h"
+#include <fsl_qbman_debug.h>
+
+#include <rte_io.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#define PAGE_SIZE                      (sysconf(_SC_PAGESIZE))
+#define PAGE_MASK                      (~(PAGE_SIZE - 1))

This patch breaks compilation in Alpine Linux in next-net and main repositories. Can you provide a fix?
Thanks.

This was initially reported by UNH:
http://mails.dpdk.org/archives/test-report/2022-January/250111.html

FAILED: drivers/a715181@@tmp_rte_net_dpaa2@sta/net_dpaa2_dpaa2_recycle.c.o ccache cc -Idrivers/a715181@@tmp_rte_net_dpaa2@sta -Idrivers -I../drivers -Idrivers/net/dpaa2 -I../drivers/net/dpaa2 -I../drivers/net/dpaa2/base -I../drivers/net/dpaa2/mc -Ilib/ethdev -I../lib/ethdev -I. -I../ -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include -Ilib/eal/x86/include -I../lib/eal/x86/include -Ilib/eal/common -I../lib/eal/common -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -Ilib/telemetry/../metrics -I../lib/telemetry/../metrics -Ilib/telemetry -I../lib/telemetry -Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/pci -I../lib/pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Idrivers/mempool/dpaa2 -I../drivers/mempool/dpaa2 -Idrivers/bus/fslmc -I../drivers/bus/fslmc -I../drivers/bus/fslmc/mc -I../drivers/bus/fslmc/qbman/include -I../drivers/bus/fslmc/portal -Idrivers/common/dpaax -I../drivers/common/dpaax -I../drivers/common/dpaax/caamflib -Ilib/eventdev -I../lib/eventdev -Ilib/hash -I../lib/hash -Ilib/rcu -I../lib/rcu -Ilib/timer -I../lib/timer -Ilib/cryptodev -I../lib/cryptodev -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O3 -include rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-address-of-packed-member -Wno-packed-not-aligned -Wno-missing-field-initializers -Wno-zero-length-bounds -D_GNU_SOURCE -fPIC -march=native -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation -DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.dpaa2 -MD -MQ 'drivers/a715181@@tmp_rte_net_dpaa2@sta/net_dpaa2_dpaa2_recycle.c.o' -MF 'drivers/a715181@@tmp_rte_net_dpaa2@sta/net_dpaa2_dpaa2_recycle.c.o.d' -o 'drivers/a715181@@tmp_rte_net_dpaa2@sta/net_dpaa2_dpaa2_recycle.c.o' -c ../drivers/net/dpaa2/dpaa2_recycle.c ../drivers/net/dpaa2/dpaa2_recycle.c:35: error: "PAGE_SIZE" redefined [-Werror]
35 | #define PAGE_SIZE (sysconf(_SC_PAGESIZE))

      |
In file included from /usr/include/fortify/stdlib.h:29,
                 from ../lib/eal/include/rte_common.h:20,
                 from ../lib/mbuf/rte_mbuf.h:36,
                 from ../drivers/net/dpaa2/dpaa2_recycle.c:10:
/usr/include/limits.h:97: note: this is the location of the previous definition
   97 | #define PAGE_SIZE PAGESIZE
      |

cc1: all warnings being treated as errors

Signature · 1 line
David Marchand
#56 lore raw

RE: [PATCH v3 10/15] net/dpaa2: support recycle loopback port

Hi David,
Sure, we will send a patch asap.

Regards,
Nipun

Quoted 126 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: 01 February 2022 14:58
To: Nipun Gupta <[email protected]>; Jun Yang <[email protected]>
Cc: dev <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Hemant Agrawal <[email protected]>; Stephen Hemminger <[email protected]>
Subject: Re: [PATCH v3 10/15] net/dpaa2: support recycle loopback port

Hello guys,

Review

Quoted 1 line · On Mon, Jan 3, 2022 at 11:02 AM <[email protected]> wrote:
(quoted diff) +0 -0

b/drivers/net/dpaa2/dpaa2_recycle.c

Quoted 31 lines

new file mode 100644
index 0000000000..e274d24ead

drivers/net/dpaa2/dpaa2_recycle.c new file +26 -0
@@ -0,0 +1,780 @@
+/* * SPDX-License-Identifier: BSD-3-Clause
+ *
+ *   Copyright 2019-2021 NXP
+ *
+ */
+
+#include <time.h>
+#include <net/if.h>
+
+#include <rte_mbuf.h>
+#include <ethdev_driver.h>
+#include <rte_malloc.h>
+#include <rte_memcpy.h>
+#include <rte_string_fns.h>
+#include <rte_cycles.h>
+#include <rte_kvargs.h>
+#include <rte_dev.h>
+#include <rte_fslmc.h>
+#include <rte_flow_driver.h>
+
+#include "dpaa2_pmd_logs.h"
+#include <fslmc_vfio.h>
+#include <dpaa2_hw_pvt.h>
+#include <dpaa2_hw_mempool.h>
+#include <dpaa2_hw_dpio.h>
+#include <mc/fsl_dpmng.h>

drivers/net/dpaa2/dpaa2_recycle.c line 36

Quoted 10 lines
drivers/net/dpaa2/dpaa2_recycle.c new file +10 -0
+#include "dpaa2_ethdev.h"
+#include "dpaa2_sparser.h"
+#include <fsl_qbman_debug.h>
+
+#include <rte_io.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#define PAGE_SIZE                      (sysconf(_SC_PAGESIZE))
+#define PAGE_MASK                      (~(PAGE_SIZE - 1))

This patch breaks compilation in Alpine Linux in next-net and main repositories. Can you provide a fix?
Thanks.

This was initially reported by UNH:
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmails.dpd
k.org%2Farchives%2Ftest-report%2F2022- January%2F250111.html&amp;data=04%7C01%7Cnipun.gupta%40nxp.com%7C a8213a91a0014639650d08d9e5652600%7C686ea1d3bc2b4c6fa92cd99c5c3016 35%7C0%7C0%7C637793044866714334%7CUnknown%7CTWFpbGZsb3d8eyJWI joiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C300 0&amp;sdata=b%2BT8BinlyFWaYSLaaOLtNTN9TA0epJAxN0Si9jbom7I%3D&amp ;reserved=0

FAILED:
drivers/a715181@@tmp_rte_net_dpaa2@sta/net_dpaa2_dpaa2_recycle.c.o ccache cc -Idrivers/a715181@@tmp_rte_net_dpaa2@sta -Idrivers

(quoted diff) +0 -21
-I../drivers -Idrivers/net/dpaa2 -I../drivers/net/dpaa2
-I../drivers/net/dpaa2/base -I../drivers/net/dpaa2/mc -Ilib/ethdev
-I../lib/ethdev -I. -I../ -Iconfig -I../config -Ilib/eal/include
-I../lib/eal/include -Ilib/eal/linux/include
-I../lib/eal/linux/include -Ilib/eal/x86/include
-I../lib/eal/x86/include -Ilib/eal/common -I../lib/eal/common
-Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs
-Ilib/telemetry/../metrics -I../lib/telemetry/../metrics
-Ilib/telemetry -I../lib/telemetry -Ilib/net -I../lib/net -Ilib/mbuf
-I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring
-Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci
-I../drivers/bus/pci/linux -Ilib/pci -I../lib/pci -Idrivers/bus/vdev
-I../drivers/bus/vdev -Idrivers/mempool/dpaa2
-I../drivers/mempool/dpaa2 -Idrivers/bus/fslmc -I../drivers/bus/fslmc
-I../drivers/bus/fslmc/mc -I../drivers/bus/fslmc/qbman/include
-I../drivers/bus/fslmc/portal -Idrivers/common/dpaax
-I../drivers/common/dpaax -I../drivers/common/dpaax/caamflib
-Ilib/eventdev -I../lib/eventdev -Ilib/hash -I../lib/hash -Ilib/rcu
-I../lib/rcu -Ilib/timer -I../lib/timer -Ilib/cryptodev
-I../lib/cryptodev -fdiagnostics-color=always -pipe
-D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O3 -include

rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat

(quoted diff) +0 -8
-Wformat-nonliteral -Wformat-security -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs -Wold-style-definition
-Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef
-Wwrite-strings -Wno-address-of-packed-member -Wno-packed-not-aligned
-Wno-missing-field-initializers -Wno-zero-length-bounds -D_GNU_SOURCE
-fPIC -march=native -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API
-Wno-format-truncation -DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.dpaa2  -MD
-MQ

'drivers/a715181@@tmp_rte_net_dpaa2@sta/net_dpaa2_dpaa2_recycle.c.o' -MF 'drivers/a715181@@tmp_rte_net_dpaa2@sta/net_dpaa2_dpaa2_recycle.c.o.d' -o 'drivers/a715181@@tmp_rte_net_dpaa2@sta/net_dpaa2_dpaa2_recycle.c.o' -c ../drivers/net/dpaa2/dpaa2_recycle.c ../drivers/net/dpaa2/dpaa2_recycle.c:35: error: "PAGE_SIZE" redefined [-Werror]
35 | #define PAGE_SIZE (sysconf(_SC_PAGESIZE))

      |
In file included from /usr/include/fortify/stdlib.h:29,
                 from ../lib/eal/include/rte_common.h:20,
                 from ../lib/mbuf/rte_mbuf.h:36,
                 from ../drivers/net/dpaa2/dpaa2_recycle.c:10:
/usr/include/limits.h:97: note: this is the location of the previous definition
   97 | #define PAGE_SIZE PAGESIZE
      |

cc1: all warnings being treated as errors

--
David Marchand

#57 lore raw

Re: [PATCH v3 10/15] net/dpaa2: support recycle loopback port

01/02/2022 10:34, Nipun Gupta:

Quoted 3 lines

Hi David,
Sure, we will send a patch asap.

Just need this:
#ifndef PAGE_SIZE
#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
#endif

Quoted 8 lines

From: David Marchand <[email protected]>

Quoted 7 lines

Hello guys,

drivers/net/dpaa2/dpaa2_recycle.c line 36

Quoted 2 lines
drivers/net/dpaa2/dpaa2_recycle.c new file +2 -0
+#define PAGE_SIZE                      (sysconf(_SC_PAGESIZE))
+#define PAGE_MASK                      (~(PAGE_SIZE - 1))

This patch breaks compilation in Alpine Linux in next-net and main repositories.

That's a pity I missed it when pulling.
Please be more cautious with errors reported by the CI, thanks.

#58 lore raw

PATCH 1/1 net/dpaa2: fix build with musl

PAGE_SIZE is already defined in musl libc:

drivers/net/dpaa2/dpaa2_recycle.c:35: error: "PAGE_SIZE" redefined /usr/include/limits.h:97: note:
this is the location of the previous definition
97 | #define PAGE_SIZE PAGESIZE

Fixes f023d059769f ("net/dpaa2: support recycle loopback port")
---
 drivers/net/dpaa2/dpaa2_recycle.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/dpaa2/dpaa2_recycle.c +2 -0
index c5e9e9721d..336506dc0d 100644
@@ -32,7 +32,9 @@
 #include <unistd.h>
 #include <sys/mman.h>
 
+#ifndef PAGE_SIZE
 #define PAGE_SIZE			(sysconf(_SC_PAGESIZE))
+#endif
 #define PAGE_MASK			(~(PAGE_SIZE - 1))
 
 #define LSX_SERDES_LAN_NB		8
Signature · 1 line
2.34.1
author Acked-by on v1 1/1
#59 lore raw

RE: [PATCH] net/dpaa2: fix build with musl

Quoted 42 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: 01 February 2022 15:24
To: [email protected]
Cc: Jun Yang <[email protected]>; Nipun Gupta <[email protected]>; Hemant Agrawal <[email protected]>; David Marchand <[email protected]>; Sachin Saxena (OSS) <[email protected]>
Subject: [PATCH] net/dpaa2: fix build with musl

PAGE_SIZE is already defined in musl libc:

drivers/net/dpaa2/dpaa2_recycle.c:35: error: "PAGE_SIZE" redefined /usr/include/limits.h:97: note:
this is the location of the previous definition
97 | #define PAGE_SIZE PAGESIZE

Fixes f023d059769f ("net/dpaa2: support recycle loopback port")
---
 drivers/net/dpaa2/dpaa2_recycle.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/dpaa2/dpaa2_recycle.c +2 -1
index c5e9e9721d..336506dc0d 100644
@@ -32,7 +32,9 @@
 #include <unistd.h>
 #include <sys/mman.h>
 
+#ifndef PAGE_SIZE
 #define PAGE_SIZE			(sysconf(_SC_PAGESIZE))
+#endif
 #define PAGE_MASK			(~(PAGE_SIZE - 1))
 
 #define LSX_SERDES_LAN_NB		8
--

2.34.1

#60 lore raw

Re: [PATCH] net/dpaa2: fix build with musl

Quoted 7 lines
Quoted 7 lines

PAGE_SIZE is already defined in musl libc:

drivers/net/dpaa2/dpaa2_recycle.c:35: error: "PAGE_SIZE" redefined /usr/include/limits.h:97: note:
this is the location of the previous definition
97 | #define PAGE_SIZE PAGESIZE

Quoted 5 lines
Quoted 4 lines
Fixes f023d059769f ("net/dpaa2: support recycle loopback port")

Applied

#61 lore raw

PATCH v3 11/15 net/dpaa: check status before configuring shared MAC

In reply to [email protected]

From: Nipun Gupta <[email protected]>

For shared MAC interface, it is a prerequisite to enable the interface in the kernel, before using it in user-space. This patch makes sure that device is not getting configured in case shared MAC interface is not enabled in the kernel.

---
 drivers/bus/dpaa/base/fman/fman_hw.c | 11 +++++++++++
 drivers/bus/dpaa/include/fsl_fman.h  |  2 ++
 drivers/bus/dpaa/version.map         |  1 +
 drivers/net/dpaa/dpaa_ethdev.c       | 13 ++++++++++++-
 4 files changed, 26 insertions(+), 1 deletion(-)
drivers/bus/dpaa/base/fman/fman_hw.c +11 -0
index af9bac76c2..24a99f7235 100644
@@ -314,6 +314,17 @@ fman_if_disable_rx(struct fman_if *p)
 	out_be32(__if->ccsr_map + 8, in_be32(__if->ccsr_map + 8) & ~(u32)2);
 }
 
+int
+fman_if_get_rx_status(struct fman_if *p)
+{
+	struct __fman_if *__if = container_of(p, struct __fman_if, __if);
+
+	assert(fman_ccsr_map_fd != -1);
+
+	/* return true if RX bit is set */
+	return !!(in_be32(__if->ccsr_map + 8) & (u32)2);
+}
+
 void
 fman_if_loopback_enable(struct fman_if *p)
 {
drivers/bus/dpaa/include/fsl_fman.h +2 -0
index f3a5d05970..acb344584f 100644
@@ -81,6 +81,8 @@ __rte_internal
 void fman_if_enable_rx(struct fman_if *p);
 __rte_internal
 void fman_if_disable_rx(struct fman_if *p);
+__rte_internal
+int fman_if_get_rx_status(struct fman_if *p);
 
 /* Enable/disable loopback on specific interfaces */
 __rte_internal
drivers/bus/dpaa/version.map +1 -0
index 900635b210..1a840fd1a5 100644
@@ -33,6 +33,7 @@ INTERNAL {
 	fman_if_get_fdoff;
 	fman_if_get_maxfrm;
 	fman_if_get_sg_enable;
+	fman_if_get_rx_status;
 	fman_if_loopback_disable;
 	fman_if_loopback_enable;
 	fman_if_promiscuous_disable;
drivers/net/dpaa/dpaa_ethdev.c +12 -1
index e49f765434..3972ecaed8 100644
@@ -195,6 +195,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	struct rte_eth_conf *eth_conf = &dev->data->dev_conf;
 	uint64_t rx_offloads = eth_conf->rxmode.offloads;
 	uint64_t tx_offloads = eth_conf->txmode.offloads;
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 	struct rte_device *rdev = dev->device;
 	struct rte_eth_link *link = &dev->data->dev_link;
 	struct rte_dpaa_device *dpaa_dev;
@@ -203,7 +204,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	struct rte_intr_handle *intr_handle;
 	uint32_t max_rx_pktlen;
 	int speed, duplex;
-	int ret;
+	int ret, rx_status;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -211,6 +212,16 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	intr_handle = dpaa_dev->intr_handle;
 	__fif = container_of(fif, struct __fman_if, __if);
 
+	/* Check if interface is enabled in case of shared MAC */
+	if (fif->is_shared_mac) {
+		rx_status = fman_if_get_rx_status(fif);
+		if (!rx_status) {
+			DPAA_PMD_ERR("%s Interface not enabled in kernel!",
+				     dpaa_intf->name);
+			return -EHOSTDOWN;
+		}
+	}
+
 	/* Rx offloads which are enabled by default */
 	if (dev_rx_offloads_nodis & ~rx_offloads) {
 		DPAA_PMD_INFO(
Signature · 1 line
2.17.1
#62 lore raw

PATCH v3 12/15 net/dpaa: enable checksum for shared MAC interface

In reply to [email protected]

From: Nipun Gupta <[email protected]>

In case of shared MAC B0V bit in contextA is required to be set to set so that ASPID is 0.

---
 drivers/net/dpaa/dpaa_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/dpaa/dpaa_ethdev.c +4 -0
index 3972ecaed8..7135a5998d 100644
@@ -1755,6 +1755,10 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 	/* no tx-confirmation */
 	opts.fqd.context_a.hi = 0x80000000 | fman_dealloc_bufs_mask_hi;
 	opts.fqd.context_a.lo = 0 | fman_dealloc_bufs_mask_lo;
+	if (fman_ip_rev >= FMAN_V3) {
+		/* Set B0V bit in contextA to set ASPID to 0 */
+		opts.fqd.context_a.hi |= 0x04000000;
+	}
 	DPAA_PMD_DEBUG("init tx fq %p, fqid 0x%x", fq, fq->fqid);
 
 	if (cgr_tx) {
Signature · 1 line
2.17.1
#63 lore raw

PATCH v3 13/15 net/enetc: add support for VFs

In reply to [email protected]

From: Gagandeep Singh <[email protected]>

Add virtual function support for enetc devices

---
 drivers/net/enetc/enetc_ethdev.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)
drivers/net/enetc/enetc_ethdev.c +20 -5
index 7cdb8ce463..1b4337bc48 100644
@@ -19,6 +19,9 @@ enetc_dev_start(struct rte_eth_dev *dev)
 	uint32_t val;
 
 	PMD_INIT_FUNC_TRACE();
+	if (hw->device_id == ENETC_DEV_ID_VF)
+		return 0;
+
 	val = enetc_port_rd(enetc_hw, ENETC_PM0_CMD_CFG);
 	enetc_port_wr(enetc_hw, ENETC_PM0_CMD_CFG,
 		      val | ENETC_PM0_TX_EN | ENETC_PM0_RX_EN);
@@ -55,6 +58,9 @@ enetc_dev_stop(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 	dev->data->dev_started = 0;
+	if (hw->device_id == ENETC_DEV_ID_VF)
+		return 0;
+
 	/* Disable port */
 	val = enetc_port_rd(enetc_hw, ENETC_PMR);
 	enetc_port_wr(enetc_hw, ENETC_PMR, val & (~ENETC_PMR_EN));
@@ -160,11 +166,20 @@ enetc_hardware_init(struct enetc_eth_hw *hw)
 	/* Enabling Station Interface */
 	enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN);
 
-	*mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
-	high_mac = (uint32_t)*mac;
-	mac++;
-	*mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
-	low_mac = (uint16_t)*mac;
+
+	if (hw->device_id == ENETC_DEV_ID_VF) {
+		*mac = (uint32_t)enetc_rd(enetc_hw, ENETC_SIPMAR0);
+		high_mac = (uint32_t)*mac;
+		mac++;
+		*mac = (uint32_t)enetc_rd(enetc_hw, ENETC_SIPMAR1);
+		low_mac = (uint16_t)*mac;
+	} else {
+		*mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
+		high_mac = (uint32_t)*mac;
+		mac++;
+		*mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
+		low_mac = (uint16_t)*mac;
+	}
 
 	if ((high_mac | low_mac) == 0) {
 		char *first_byte;
Signature · 1 line
2.17.1
#64 lore raw

PATCH v3 14/15 net/pfe: reduce driver initialization time

In reply to [email protected]

From: Gagandeep Singh <[email protected]>

This patch reduces the delay in the device init.

---
 drivers/net/pfe/pfe_hif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/pfe/pfe_hif.c +2 -2
index c4a7154ba7..8a10f10f56 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2019 NXP
+ * Copyright 2018-2021 NXP
  */
 
 #include "pfe_logs.h"
@@ -766,7 +766,7 @@ pfe_hif_rx_idle(struct pfe_hif *hif)
 		if (rx_status & BDP_CSR_RX_DMA_ACTV)
 			send_dummy_pkt_to_hif();
 
-		sleep(1);
+		rte_delay_ms(1);
 	} while (--hif_stop_loop);
 
 	if (readl(HIF_RX_STATUS) & BDP_CSR_RX_DMA_ACTV)
Signature · 1 line
2.17.1
#65 lore raw

PATCH v3 15/15 net/pfe: remove setting unused value

In reply to [email protected]

From: Apeksha Gupta <[email protected]>

remove setting link status where it is not being used

---
 drivers/net/pfe/pfe_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/pfe/pfe_ethdev.c +1 -2
index 047010e15e..e5aaf5dcfd 100644
@@ -587,8 +587,7 @@ pfe_eth_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
 		ret = ioctl(priv->link_fd, ioctl_cmd, &lstatus);
 		if (ret != 0) {
 			PFE_PMD_ERR("Unable to fetch link status (ioctl)\n");
-			/* use dummy link value */
-			link.link_status = 1;
+			return -1;
 		}
 		PFE_PMD_DEBUG("Fetched link state (%d) for dev %d.\n",
 			      lstatus, priv->id);
Signature · 1 line
2.17.1
Acked-by on the v3 series
#66 lore raw
In reply to [email protected]

Series-

Quoted 97 lines · On 1/3/2022 3:31 PM, [email protected] wrote:

From: Nipun Gupta <[email protected]>

This series adds few features and important fixes on DPAA, PFE and ENETC devices.

Features added:
- level 2 support for shaping on DPAA2
- loopback configuration for DPNI devices on DPAA2
- Multiple TXQ's enqueue for ordered queues for performance
- VFs support on ENETC

Fixes:
- fix unregistering interrupt handler on DPAA2
- fix timestamping for IEEE1588 on DPAA1

Changes in v2:
- fix checkpatch errors

Changes in v3:
- remove unrequired PFE HW checksum patch
- use predefined API for adding delay
- use macro value for allocating mbuf in event

Apeksha Gupta (1):
net/pfe: remove setting unused value

Gagandeep Singh (3):
net/dpaa2: add support for level 2 in traffic management net/enetc: add support for VFs
net/pfe: reduce driver initialization time

Jun Yang (4):
net/dpaa2: support multiple txqs en-queue for ordered net/dpaa2: secondary process handling for dpni bus/fslmc: add and scan dprc devices net/dpaa2: support recycle loopback port

Nipun Gupta (4):
bus/fslmc: update MC to 10.29
bus/fslmc: use dmb oshst for synchronization before I/O net/dpaa: check status before configuring shared MAC net/dpaa: enable checksum for shared MAC interface

Rohit Raj (1):
net/dpaa2: warn user in case of high nb desc

Vanshika Shukla (2):
net/dpaa2: fix unregistering interrupt handler
net/dpaa2: fix timestamping for IEEE1588

  doc/guides/nics/dpaa2.rst                 |   2 +-
  drivers/bus/dpaa/base/fman/fman_hw.c      |  11 +
  drivers/bus/dpaa/include/fsl_fman.h       |   2 +
  drivers/bus/dpaa/version.map              |   1 +
  drivers/bus/fslmc/fslmc_bus.c             |  15 +-
  drivers/bus/fslmc/fslmc_vfio.c            |  18 +-
  drivers/bus/fslmc/mc/dprc.c               | 129 ++++
  drivers/bus/fslmc/mc/fsl_dpmng.h          |   2 +-
  drivers/bus/fslmc/mc/fsl_dprc.h           |  46 ++
  drivers/bus/fslmc/mc/fsl_dprc_cmd.h       |  48 ++
  drivers/bus/fslmc/meson.build             |   4 +-
  drivers/bus/fslmc/portal/dpaa2_hw_dprc.c  | 100 +++
  drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   |  15 +-
  drivers/bus/fslmc/qbman/include/compat.h  |   4 +-
  drivers/bus/fslmc/rte_fslmc.h             |  10 +-
  drivers/event/dpaa2/dpaa2_eventdev.c      |  12 +-
  drivers/mempool/dpaa2/dpaa2_hw_mempool.c  |  23 +
  drivers/mempool/dpaa2/rte_dpaa2_mempool.h |  15 +
  drivers/mempool/dpaa2/version.map         |   1 +
  drivers/net/dpaa/dpaa_ethdev.c            |  17 +-
  drivers/net/dpaa2/base/dpaa2_hw_dpni.c    |   5 +-
  drivers/net/dpaa2/dpaa2_ethdev.c          | 117 +++-
  drivers/net/dpaa2/dpaa2_ethdev.h          |  38 +-
  drivers/net/dpaa2/dpaa2_ptp.c             |   8 +-
  drivers/net/dpaa2/dpaa2_recycle.c         | 780 ++++++++++++++++++++++
  drivers/net/dpaa2/dpaa2_rxtx.c            | 181 ++++-
  drivers/net/dpaa2/dpaa2_tm.c              | 563 +++++++++++++---
  drivers/net/dpaa2/dpaa2_tm.h              |  17 +-
  drivers/net/dpaa2/mc/dpdmux.c             |   8 +
  drivers/net/dpaa2/mc/dpkg.c               |   7 +-
  drivers/net/dpaa2/mc/dpni.c               | 417 ++++++++----
  drivers/net/dpaa2/mc/fsl_dpdmux.h         |   3 +
  drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h     |   5 +-
  drivers/net/dpaa2/mc/fsl_dpni.h           | 173 +++--
  drivers/net/dpaa2/mc/fsl_dpni_cmd.h       | 137 ++--
  drivers/net/dpaa2/meson.build             |   1 +
  drivers/net/dpaa2/version.map             |   1 +
  drivers/net/enetc/enetc_ethdev.c          |  25 +-
  drivers/net/pfe/pfe_ethdev.c              |   3 +-
  drivers/net/pfe/pfe_hif.c                 |   4 +-
  40 files changed, 2519 insertions(+), 449 deletions(-)

create mode 100644 drivers/bus/fslmc/mc/dprc.c create mode 100644 drivers/bus/fslmc/mc/fsl_dprc.h create mode 100644 drivers/bus/fslmc/mc/fsl_dprc_cmd.h create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c create mode 100644 drivers/net/dpaa2/dpaa2_recycle.c

#67 lore raw
Quoted 48 lines · Hemant Agrawal
Quoted 46 lines · On 1/3/2022 3:31 PM, [email protected] wrote:

From: Nipun Gupta <[email protected]>

This series adds few features and important fixes on DPAA, PFE and ENETC devices.

Features added:
- level 2 support for shaping on DPAA2
- loopback configuration for DPNI devices on DPAA2
- Multiple TXQ's enqueue for ordered queues for performance
- VFs support on ENETC

Fixes:
- fix unregistering interrupt handler on DPAA2
- fix timestamping for IEEE1588 on DPAA1

Changes in v2:
- fix checkpatch errors

Changes in v3:
- remove unrequired PFE HW checksum patch
- use predefined API for adding delay
- use macro value for allocating mbuf in event

Apeksha Gupta (1):
   net/pfe: remove setting unused value

Gagandeep Singh (3):
   net/dpaa2: add support for level 2 in traffic management net/enetc: add support for VFs
   net/pfe: reduce driver initialization time

Jun Yang (4):
   net/dpaa2: support multiple txqs en-queue for ordered net/dpaa2: secondary process handling for dpni bus/fslmc: add and scan dprc devices net/dpaa2: support recycle loopback port

Nipun Gupta (4):
   bus/fslmc: update MC to 10.29
   bus/fslmc: use dmb oshst for synchronization before I/O net/dpaa: check status before configuring shared MAC net/dpaa: enable checksum for shared MAC interface

Rohit Raj (1):
   net/dpaa2: warn user in case of high nb desc

Quoted 9 lines
Quoted 4 lines

Vanshika Shukla (2):
   net/dpaa2: fix unregistering interrupt handler
   net/dpaa2: fix timestamping for IEEE1588

Series-

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