Skip to contentSkip to conversation

net/dpaa2: features and fixes for NXP DPAA2 drivers

PATCH Superseded Prashant Gupta 6 participants 376 messages Sep 3 – Nov 20 4 messages not in the archive Page 3 of 5

Subsystems (4)
lore
Share & tools
lore
#165 lore raw

PATCH 35/65 event/dpaa2: add push mode to DPCON Rx scheduler

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Extend the DPCON standalone Rx scheduler with a second scheduling mode so callers can choose how packets reach the poll path. The mode is selected at init time through a new enum rte_dpaa2_sch_mode argument to rte_dpaa2_scheduler_init():

pull
The original behaviour. A single shared DPCON channel is allocated and ethdev Rx queues are attached to it up front; packets are pulled from that channel via the plain or prefetch receive path.

push
A per-lcore DPCON plus DPCI pair is allocated lazily on first receive. The DPCI is linked to the DPCON, the pending Rx queues are attached, and the DPCON channel is added as a static dequeue channel so frames are pushed into the software portal DQRR and consumed in place (dpaa2_scheduler_dpci_recv).

To support push mode, struct dpaa2_sch_dev now holds per-lcore dpcon and dpci arrays and a per-lcore linked flag instead of a single DPCON pointer. rte_dpaa2_scheduler_add() defers hardware attach for push mode (recording the queue and doing the attach on the first receive on each lcore), while pull mode still attaches immediately. start and destroy are updated to walk the per-lcore arrays: destroy stops linked DPCONs, frees both the DPCON and DPCI devices, and reports the first stop error while still freeing everything.

---
 drivers/event/dpaa2/dpaa2_scheduler.c | 189 ++++++++++++++++++++++----
 drivers/net/dpaa2/rte_pmd_dpaa2.h     |   7 +-
 2 files changed, 167 insertions(+), 29 deletions(-)
drivers/event/dpaa2/dpaa2_scheduler.c +161 -28
index e553c4d3f6..51956ac1e5 100644
@@ -41,9 +41,12 @@ struct dpaa2_sch_port_queue {
 };
 
 struct dpaa2_sch_dev {
-	struct dpaa2_dpcon_dev *dpcon_dev;
+	struct dpaa2_dpcon_dev *dpcon_dev[RTE_MAX_LCORE];
+	struct dpaa2_dpci_dev *dpci_dev[RTE_MAX_LCORE];
+	uint8_t linked[RTE_MAX_LCORE];
 	struct dpaa2_sch_port_queue port_queue[DPAA2_SCH_PORT_QUEUE_MAX_NUM];
 	uint8_t port_queue_num;
+	enum rte_dpaa2_sch_mode sch_mode;
 	struct queue_storage_info_t q_storage[RTE_MAX_LCORE];
 	uint16_t (*rx_schedule)(struct dpaa2_sch_dev *dev,
 		struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
@@ -83,11 +86,110 @@ dpaa2_qbman_pull_desc_channel_set(struct qbman_pull_desc *pulldesc,
 		iova_storage, 1);
 }
 
+static uint16_t
+dpaa2_scheduler_dpci_recv(struct dpaa2_sch_dev *sch_dev,
+	struct rte_mbuf **mbuf, uint16_t nb_pkts)
+{
+	const struct qbman_result *dq;
+	struct dpaa2_dpcon_dev *dpcon_dev;
+	struct dpaa2_dpci_dev *dpci_dev;
+	struct dpaa2_dpio_dev *dpio_dev;
+	struct qbman_swp *swp;
+	const struct qbman_fd *fd;
+	struct dpaa2_queue *rxq;
+	struct dpaa2_sch_port_queue *port_queue;
+	struct rte_event_eth_rx_adapter_queue_conf *queue_conf;
+	uint16_t num_pkts = 0, i = 0;
+	int ret;
+	struct dpaa2_dev_priv *priv;
+	uint32_t cpu = rte_lcore_id();
+
+	if (unlikely(!DPAA2_PER_LCORE_ETHRX_DPIO)) {
+		ret = dpaa2_affine_qbman_ethrx_swp();
+		if (ret) {
+			DPAA2_EVENTDEV_ERR("Failure(%d) in affining portal", ret);
+			return 0;
+		}
+	}
+	dpio_dev = DPAA2_PER_LCORE_ETHRX_DPIO;
+	swp = DPAA2_PER_LCORE_ETHRX_PORTAL;
+	if (likely(sch_dev->linked[cpu] == sch_dev->port_queue_num))
+		goto start_dq;
+	if (!sch_dev->dpcon_dev[cpu])
+		sch_dev->dpcon_dev[cpu] = rte_dpaa2_alloc_dpcon_dev();
+	if (!sch_dev->dpci_dev[cpu])
+		sch_dev->dpci_dev[cpu] = rte_dpaa2_alloc_dpci_dev();
+	if (!sch_dev->dpcon_dev[cpu] || !sch_dev->dpci_dev[cpu])
+		return 0;
+	dpcon_dev = sch_dev->dpcon_dev[cpu];
+	dpci_dev = sch_dev->dpci_dev[cpu];
+	ret = rte_dpaa2_dpci_link_attach(dpci_dev, DPCI_DEST_DPCON,
+		dpcon_dev->dpcon_id, 0, NULL, NULL);
+	if (ret) {
+		DPAA2_EVENTDEV_ERR("DPCI link attaches dpcon failed: err(%d)", ret);
+		return 0;
+	}
+	for (i = 0; i < sch_dev->port_queue_num; i++) {
+		port_queue = &sch_dev->port_queue[i];
+		if (port_queue->configured)
+			continue;
+		queue_conf = &port_queue->queue_conf;
+		dpaa2_eth_eventq_prio_dpcon_to_ev(port_queue->priority,
+			dpcon_dev, queue_conf);
+		ret = dpaa2_eth_eventq_attach(port_queue->eth_dev,
+			port_queue->rxq_id, dpcon_dev, queue_conf);
+		if (ret) {
+			DPAA2_EVENTDEV_ERR("Failure(%d) attaching %s-rxq%d to eventq",
+				ret, port_queue->eth_dev->data->name,
+				port_queue->rxq_id);
+			return 0;
+		}
+		port_queue->configured = true;
+	}
+	ret = dpio_add_static_dequeue_channel(dpio_dev->dpio,
+			CMD_PRI_LOW, dpio_dev->token,
+			dpcon_dev->dpcon_id,
+			&dpcon_dev->channel_index);
+	if (ret) {
+		DPAA2_EVENTDEV_ERR("Failure(%d) adding dpcon%d to static dq channel",
+			ret, dpcon_dev->dpcon_id);
+		return 0;
+	}
+
+	qbman_swp_push_set(swp, dpcon_dev->channel_index, 1);
+	sch_dev->linked[cpu] = sch_dev->port_queue_num;
+
+start_dq:
+	do {
+		dq = qbman_swp_dqrr_next(swp);
+		if (!dq)
+			goto quit;
+
+		qbman_swp_prefetch_dqrr_next(swp);
+
+		fd = qbman_result_DQ_fd(dq);
+		rxq = (void *)qbman_result_DQ_fqd_ctx(dq);
+		priv = rxq->eth_data->dev_private;
+		if (unlikely(DPAA2_FD_GET_FORMAT(fd) == qbman_fd_sg))
+			mbuf[num_pkts] = dpaa2_eth_sg_fd_to_mbuf_export(priv, fd);
+		else
+			mbuf[num_pkts] = dpaa2_eth_fd_to_mbuf_export(priv, fd);
+		dpaa2_dev_rx_mbuf_flc_offload_export(mbuf[num_pkts], fd);
+		dpaa2_dev_rx_print_parser_result(priv, fd, mbuf[num_pkts]);
+		qbman_swp_dqrr_consume(swp, dq);
+
+		num_pkts++;
+	} while (num_pkts < nb_pkts);
+
+quit:
+	return num_pkts;
+}
+
 static uint16_t
 dpaa2_scheduler_recv(struct dpaa2_sch_dev *sch_dev,
 	struct rte_mbuf **mbuf, uint16_t nb_pkts)
 {
-	struct dpaa2_dpcon_dev *dpcon_dev = sch_dev->dpcon_dev;
+	struct dpaa2_dpcon_dev *dpcon_dev = sch_dev->dpcon_dev[0];
 	uint16_t ch_id = dpcon_dev->qbman_ch_id;
 	struct qbman_result *dq_sch_storage;
 	uint16_t total_nb_pkts = nb_pkts;
@@ -179,7 +281,7 @@ static uint16_t
 dpaa2_scheduler_prefetch_recv(struct dpaa2_sch_dev *sch_dev,
 	struct rte_mbuf **mbuf, uint16_t nb_pkts)
 {
-	struct dpaa2_dpcon_dev *dpcon_dev = sch_dev->dpcon_dev;
+	struct dpaa2_dpcon_dev *dpcon_dev = sch_dev->dpcon_dev[0];
 	uint16_t ch_id = dpcon_dev->qbman_ch_id, pull_size;
 	struct qbman_result *dq_storage, *dq_storage1 = NULL, *active;
 	struct qbman_pull_desc pulldesc;
@@ -314,7 +416,7 @@ dpaa2_scheduler_prefetch_recv(struct dpaa2_sch_dev *sch_dev,
 }
 
 RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_dpaa2_scheduler_init, 26.11)
-void *rte_dpaa2_scheduler_init(void)
+void *rte_dpaa2_scheduler_init(enum rte_dpaa2_sch_mode sch_mode)
 {
 	struct dpaa2_dpcon_dev *dpcon_dev = NULL;
 	struct dpaa2_sch_dev *sch_dev = NULL;
@@ -331,16 +433,24 @@ void *rte_dpaa2_scheduler_init(void)
 	if (ret)
 		goto err;
 
-	dpcon_dev = rte_dpaa2_alloc_dpcon_dev();
-	if (!dpcon_dev) {
-		DPAA2_EVENTDEV_ERR("Failed alloc dpcon device!!");
+	if (sch_mode == RTE_DPAA2_SCH_PULL) {
+		dpcon_dev = rte_dpaa2_alloc_dpcon_dev();
+		if (!dpcon_dev) {
+			DPAA2_EVENTDEV_ERR("Failed alloc dpcon device!!");
+			goto err;
+		}
+		sch_dev->dpcon_dev[0] = dpcon_dev;
+		if (prefetch_enable)
+			sch_dev->rx_schedule = dpaa2_scheduler_prefetch_recv;
+		else
+			sch_dev->rx_schedule = dpaa2_scheduler_recv;
+	} else if (sch_mode == RTE_DPAA2_SCH_PUSH) {
+		sch_dev->rx_schedule = dpaa2_scheduler_dpci_recv;
+	} else {
+		DPAA2_EVENTDEV_ERR("Invalid schedule mode(%d)!!", sch_mode);
 		goto err;
 	}
-	sch_dev->dpcon_dev = dpcon_dev;
-	if (prefetch_enable)
-		sch_dev->rx_schedule = dpaa2_scheduler_prefetch_recv;
-	else
-		sch_dev->rx_schedule = dpaa2_scheduler_recv;
+	sch_dev->sch_mode = sch_mode;
 
 	return sch_dev;
 err:
@@ -361,15 +471,22 @@ int rte_dpaa2_scheduler_start(void *scheduler_handle)
 	struct dpaa2_sch_dev *sch_dev = scheduler_handle;
 	int32_t ret = 0;
 
-	if (sch_dev->dpcon_dev) {
-		ret = rte_dpaa2_dpcon_start(sch_dev->dpcon_dev);
-		if (ret)
+	if (sch_dev->sch_mode == RTE_DPAA2_SCH_PUSH)
+		goto start_quit;
+
+	if (sch_dev->dpcon_dev[0]) {
+		ret = rte_dpaa2_dpcon_start(sch_dev->dpcon_dev[0]);
+		if (ret) {
 			DPAA2_EVENTDEV_ERR("Failed(%d) to start dpcon", ret);
+			return ret;
+		}
+		sch_dev->linked[0] = 1;
 	} else {
 		DPAA2_EVENTDEV_ERR("No dpcon allocated");
 		ret = -ENODEV;
 	}
 
+start_quit:
 	return ret;
 }
 
@@ -377,15 +494,27 @@ RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_dpaa2_scheduler_destroy, 26.11)
 int rte_dpaa2_scheduler_destroy(void *scheduler_handle)
 {
 	struct dpaa2_sch_dev *sch_dev = scheduler_handle;
-	int32_t ret = 0;
+	struct dpaa2_dpcon_dev *dpcon_dev;
+	struct dpaa2_dpci_dev *dpci_dev;
+	int32_t ret = 0, _ret, i;
 
-	if (sch_dev->dpcon_dev) {
-		ret = rte_dpaa2_dpcon_stop(sch_dev->dpcon_dev);
-		if (ret) {
-			DPAA2_EVENTDEV_ERR("Failed(%d) to stop dpcon", ret);
-			/** Free anyway.*/
+	for (i = 0; i < RTE_MAX_LCORE; i++) {
+		dpcon_dev = sch_dev->dpcon_dev[i];
+		dpci_dev = sch_dev->dpci_dev[i];
+		if (dpcon_dev) {
+			if (sch_dev->linked[i]) {
+				_ret = rte_dpaa2_dpcon_stop(dpcon_dev);
+				if (_ret) {
+					DPAA2_EVENTDEV_ERR("Failed(%d) to stop dpcon[%d]", _ret, i);
+					/** Free anyway.*/
+					ret = _ret;
+				}
+			}
+			rte_dpaa2_free_dpcon_dev(dpcon_dev);
 		}
-		rte_dpaa2_free_dpcon_dev(sch_dev->dpcon_dev);
+		if (dpci_dev)
+			rte_dpaa2_free_dpci_dev(dpci_dev);
+		sch_dev->linked[i] = 0;
 	}
 
 	rte_free(sch_dev);
@@ -421,17 +550,21 @@ int rte_dpaa2_scheduler_add(void *scheduler_handle,
 	}
 
 	memset(&queue_conf, 0, sizeof(struct rte_event_eth_rx_adapter_queue_conf));
-	dpcon_dev = sch_dev->dpcon_dev;
-	dpaa2_eth_eventq_prio_dpcon_to_ev(priority, dpcon_dev, &queue_conf);
-	queue_conf.ev.sched_type = RTE_SCHED_TYPE_PARALLEL;
-	ret = dpaa2_eth_eventq_attach(dev, rxq_id, dpcon_dev, &queue_conf);
+	ret = 0;
+	if (sch_dev->sch_mode == RTE_DPAA2_SCH_PULL) {
+		dpcon_dev = sch_dev->dpcon_dev[0];
+		dpaa2_eth_eventq_prio_dpcon_to_ev(priority, dpcon_dev, &queue_conf);
+		queue_conf.ev.sched_type = RTE_SCHED_TYPE_PARALLEL;
+		ret = dpaa2_eth_eventq_attach(dev, rxq_id, dpcon_dev, &queue_conf);
+	}
 	if (!ret) {
 		sch_dev->port_queue[sch_dev->port_queue_num].eth_dev = dev;
 		sch_dev->port_queue[sch_dev->port_queue_num].rxq_id = rxq_id;
 		sch_dev->port_queue[sch_dev->port_queue_num].priority = priority;
 		rte_memcpy(&sch_dev->port_queue[sch_dev->port_queue_num].queue_conf,
 			&queue_conf, sizeof(struct rte_event_eth_rx_adapter_queue_conf));
-		sch_dev->port_queue[sch_dev->port_queue_num].configured = true;
+		if (sch_dev->sch_mode == RTE_DPAA2_SCH_PULL)
+			sch_dev->port_queue[sch_dev->port_queue_num].configured = true;
 		sch_dev->port_queue_num++;
 	}
 
@@ -454,5 +587,5 @@ rte_dpaa2_scheduler_max_prio(void *scheduler_handle)
 {
 	struct dpaa2_sch_dev *sch_dev = scheduler_handle;
 
-	return sch_dev->dpcon_dev->num_priorities;
+	return sch_dev->dpcon_dev[0]->num_priorities;
 }
drivers/net/dpaa2/rte_pmd_dpaa2.h +6 -1
index eb038011c9..5125ec5bf7 100644
@@ -129,9 +129,14 @@ int
 rte_pmd_dpaa2_rx_get_offset(uint16_t port_id, struct rte_mbuf *m,
 	uint8_t *l3_off, uint8_t *l4_off, uint8_t *l5_off);
 
+enum rte_dpaa2_sch_mode {
+	RTE_DPAA2_SCH_PULL,
+	RTE_DPAA2_SCH_PUSH
+};
+
 __rte_experimental
 void *
-rte_dpaa2_scheduler_init(void);
+rte_dpaa2_scheduler_init(enum rte_dpaa2_sch_mode sch_mode);
 __rte_experimental
 int
 rte_dpaa2_scheduler_start(void *scheduler_handle);
Signature · 1 line
2.43.0
#166 lore raw

PATCH 36/65 event/dpaa2: drain Rx scheduler queues on destroy

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Refactor the per-DQRR-entry receive code into a shared helper (dpaa2_scheduler_swp_mbuf_dq) used by both the fast-path push receive and the new teardown drain, then drain any in-flight packets when the scheduler is destroyed so buffers are not leaked or left stuck in the hardware channel.

For push mode, destroy now walks each lcore that has an active portal:
it repeatedly dequeues and frees frames from the software portal (dpaa2_scheduler_dpio_drain), clears the push enable, and removes the DPCON static dequeue channel before the DPCON and DPCI devices are freed. A per-lcore dpio_dev array is added to struct dpaa2_sch_dev so destroy can find the portal that was bound on first receive.

For pull mode, destroy repeatedly calls the configured receive path and frees the returned mbufs in bulk until the channel is empty (dpaa2_scheduler_rx_pull_drain).

Any nonzero drained count is logged as a warning, and channel-removal errors are propagated as the destroy return value while teardown still completes.

---
 drivers/event/dpaa2/dpaa2_scheduler.c | 141 +++++++++++++++++++++-----
 1 file changed, 117 insertions(+), 24 deletions(-)
drivers/event/dpaa2/dpaa2_scheduler.c +117 -24
index 51956ac1e5..26e3f50cf7 100644
@@ -43,6 +43,7 @@ struct dpaa2_sch_port_queue {
 struct dpaa2_sch_dev {
 	struct dpaa2_dpcon_dev *dpcon_dev[RTE_MAX_LCORE];
 	struct dpaa2_dpci_dev *dpci_dev[RTE_MAX_LCORE];
+	struct dpaa2_dpio_dev *dpio_dev[RTE_MAX_LCORE];
 	uint8_t linked[RTE_MAX_LCORE];
 	struct dpaa2_sch_port_queue port_queue[DPAA2_SCH_PORT_QUEUE_MAX_NUM];
 	uint8_t port_queue_num;
@@ -86,22 +87,68 @@ dpaa2_qbman_pull_desc_channel_set(struct qbman_pull_desc *pulldesc,
 		iova_storage, 1);
 }
 
+static inline struct rte_mbuf *
+dpaa2_scheduler_swp_mbuf_dq(struct qbman_swp *swp)
+{
+	const struct qbman_result *dq;
+	const struct qbman_fd *fd;
+	struct dpaa2_queue *rxq;
+	struct dpaa2_dev_priv *priv;
+	struct rte_mbuf *mbuf;
+
+	dq = qbman_swp_dqrr_next(swp);
+	if (!dq)
+		return NULL;
+
+	qbman_swp_prefetch_dqrr_next(swp);
+	fd = qbman_result_DQ_fd(dq);
+	rxq = (void *)qbman_result_DQ_fqd_ctx(dq);
+	priv = rxq->eth_data->dev_private;
+	if (unlikely(DPAA2_FD_GET_FORMAT(fd) == qbman_fd_sg))
+		mbuf = dpaa2_eth_sg_fd_to_mbuf_export(priv, fd);
+	else
+		mbuf = dpaa2_eth_fd_to_mbuf_export(priv, fd);
+	dpaa2_dev_rx_mbuf_flc_offload_export(mbuf, fd);
+	dpaa2_dev_rx_print_parser_result(priv, fd, mbuf);
+	qbman_swp_dqrr_consume(swp, dq);
+
+	return mbuf;
+}
+
+static uint32_t
+dpaa2_scheduler_dpio_drain(struct dpaa2_dpio_dev *dpio_dev)
+{
+	struct qbman_swp *swp;
+	uint32_t num_pkts = 0;
+	int max_drain = 1000;
+	struct rte_mbuf *mbuf;
+
+	swp = dpio_dev->sw_portal;
+
+	while (max_drain--) {
+		mbuf = dpaa2_scheduler_swp_mbuf_dq(swp);
+		if (!mbuf)
+			break;
+		rte_pktmbuf_free(mbuf);
+		num_pkts++;
+		rte_delay_ms(1);
+	}
+
+	return num_pkts;
+}
+
 static uint16_t
 dpaa2_scheduler_dpci_recv(struct dpaa2_sch_dev *sch_dev,
 	struct rte_mbuf **mbuf, uint16_t nb_pkts)
 {
-	const struct qbman_result *dq;
 	struct dpaa2_dpcon_dev *dpcon_dev;
 	struct dpaa2_dpci_dev *dpci_dev;
 	struct dpaa2_dpio_dev *dpio_dev;
 	struct qbman_swp *swp;
-	const struct qbman_fd *fd;
-	struct dpaa2_queue *rxq;
 	struct dpaa2_sch_port_queue *port_queue;
 	struct rte_event_eth_rx_adapter_queue_conf *queue_conf;
 	uint16_t num_pkts = 0, i = 0;
 	int ret;
-	struct dpaa2_dev_priv *priv;
 	uint32_t cpu = rte_lcore_id();
 
 	if (unlikely(!DPAA2_PER_LCORE_ETHRX_DPIO)) {
@@ -158,30 +205,17 @@ dpaa2_scheduler_dpci_recv(struct dpaa2_sch_dev *sch_dev,
 
 	qbman_swp_push_set(swp, dpcon_dev->channel_index, 1);
 	sch_dev->linked[cpu] = sch_dev->port_queue_num;
+	sch_dev->dpio_dev[cpu] = dpio_dev;
 
 start_dq:
-	do {
-		dq = qbman_swp_dqrr_next(swp);
-		if (!dq)
-			goto quit;
-
-		qbman_swp_prefetch_dqrr_next(swp);
-
-		fd = qbman_result_DQ_fd(dq);
-		rxq = (void *)qbman_result_DQ_fqd_ctx(dq);
-		priv = rxq->eth_data->dev_private;
-		if (unlikely(DPAA2_FD_GET_FORMAT(fd) == qbman_fd_sg))
-			mbuf[num_pkts] = dpaa2_eth_sg_fd_to_mbuf_export(priv, fd);
+	while (num_pkts < nb_pkts) {
+		mbuf[num_pkts] = dpaa2_scheduler_swp_mbuf_dq(swp);
+		if (likely(mbuf[num_pkts]))
+			num_pkts++;
 		else
-			mbuf[num_pkts] = dpaa2_eth_fd_to_mbuf_export(priv, fd);
-		dpaa2_dev_rx_mbuf_flc_offload_export(mbuf[num_pkts], fd);
-		dpaa2_dev_rx_print_parser_result(priv, fd, mbuf[num_pkts]);
-		qbman_swp_dqrr_consume(swp, dq);
-
-		num_pkts++;
-	} while (num_pkts < nb_pkts);
+			break;
+	}
 
-quit:
 	return num_pkts;
 }
 
@@ -490,6 +524,54 @@ int rte_dpaa2_scheduler_start(void *scheduler_handle)
 	return ret;
 }
 
+static int
+dpaa2_scheduler_rx_core_push_drain(struct dpaa2_sch_dev *sch_dev, uint16_t core)
+{
+	struct dpaa2_dpio_dev *dpio_dev;
+	struct dpaa2_dpcon_dev *dpcon_dev;
+	uint16_t drain_num;
+	int ret;
+
+	if (!sch_dev->dpio_dev[core])
+		return 0;
+
+	dpio_dev = sch_dev->dpio_dev[core];
+	dpcon_dev = sch_dev->dpcon_dev[core];
+	if (!dpcon_dev)
+		return -ENODEV;
+	drain_num = dpaa2_scheduler_dpio_drain(dpio_dev);
+	if (drain_num > 0)
+		DPAA2_EVENTDEV_WARN("Drain %d buffer(s) from core%d", drain_num, core);
+
+	qbman_swp_push_set(dpio_dev->sw_portal, dpcon_dev->channel_index, 0);
+	ret = dpio_remove_static_dequeue_channel(dpio_dev->dpio,
+		0, dpio_dev->token, dpcon_dev->dpcon_id);
+	if (ret)
+		DPAA2_EVENTDEV_ERR("Failed(%d) to remove channel on core%d", ret, core);
+
+	return ret;
+}
+
+static void
+dpaa2_scheduler_rx_pull_drain(struct dpaa2_sch_dev *sch_dev)
+{
+	uint16_t drain_num = 0, rx;
+	struct rte_mbuf *mbufs[16];
+	int max_drain = 1000;
+
+rx_again:
+	rx = sch_dev->rx_schedule(sch_dev, mbufs, 16);
+	rte_pktmbuf_free_bulk(mbufs, rx);
+	drain_num += rx;
+	if (rx > 0 && max_drain > 0) {
+		rte_delay_ms(1);
+		max_drain--;
+		goto rx_again;
+	}
+	if (drain_num > 0)
+		DPAA2_EVENTDEV_WARN("Drain %d buffer(s) from scheduler.", drain_num);
+}
+
 RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_dpaa2_scheduler_destroy, 26.11)
 int rte_dpaa2_scheduler_destroy(void *scheduler_handle)
 {
@@ -498,6 +580,17 @@ int rte_dpaa2_scheduler_destroy(void *scheduler_handle)
 	struct dpaa2_dpci_dev *dpci_dev;
 	int32_t ret = 0, _ret, i;
 
+	if (sch_dev->sch_mode == RTE_DPAA2_SCH_PUSH) {
+		/** Make sure all data threads quit.*/
+		for (i = 0; i < RTE_MAX_LCORE; i++) {
+			_ret = dpaa2_scheduler_rx_core_push_drain(sch_dev, i);
+			if (_ret)
+				ret = _ret;
+		}
+	} else {
+		dpaa2_scheduler_rx_pull_drain(sch_dev);
+	}
+
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
 		dpcon_dev = sch_dev->dpcon_dev[i];
 		dpci_dev = sch_dev->dpci_dev[i];
Signature · 1 line
2.43.0
#167 lore raw

PATCH 37/65 event/dpaa2: track and detach attached Rx queues

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The DPAA2 eventdev previously attached ethdev/crypto Rx queues to an event queue but never tracked or detached them, so device close and ethdev stop left the queues wired to a DPCON and leaked event state.

Track each attached DPNI Rx queue in the owning event queue and add the plumbing to tear it down cleanly:

- Record attached Rx queues:
dpaa2_eventq now keeps an array of attached DPNI Rx queues (dpni_rxqs / dpni_rxq_num, capped at DPAA2_EVENTQ_DPNI_RXQ_ATTACH_MAX) and dpaa2_queue gains an event_attached flag. The ethdev tracks the number of attached queues in evq_attach_num and warns on close if any remain.

- Detach by Rx queue:
add dpaa2_eth_eventq_detach_by_rxq(), which detaches a queue given its dpaa2_queue directly (looking up the DPNI from the queue's eth_data), and refuses queues that were never attached. dpaa2_eth_eventq_detach() now validates the queue id and delegates to it. rx_queue_release skips queues still attached to the event device.

- Eventdev lifecycle:
add a DPAA2_EVENTDEV_CREATED/STARTED/STOPPED status and implement eth_queue_del, eth_stop, and close so they drain traffic and detach all attached Rx queues. eth_stop drains ingress by cycling stop/start on a local copy of the device before detaching.

- Error propagation:
crypto_queue_add_all now returns the last attach error instead of discarding it, and crypto_queue_add reports the queue-pair index.

- Scheduler teardown:
rte_dpaa2_scheduler_destroy() now detaches the event queues it attached (tracked via attach_num) as part of destroy.

---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h |   1 +
 drivers/event/dpaa2/dpaa2_eventdev.c    | 308 ++++++++++++++++--------
 drivers/event/dpaa2/dpaa2_eventdev.h    |  11 +-
 drivers/event/dpaa2/dpaa2_scheduler.c   |  28 ++-
 drivers/net/dpaa2/dpaa2_ethdev.c        |  57 ++++-
 drivers/net/dpaa2/dpaa2_ethdev.h        |   4 +
 6 files changed, 293 insertions(+), 116 deletions(-)
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +1 -0
index b00e52a9b7..a0b1d2abfa 100644
@@ -192,6 +192,7 @@ struct __rte_cache_aligned dpaa2_queue {
 	uint8_t options;
 	struct rte_event ev;
 	struct rte_mempool *env_pool;
+	uint8_t event_attached;
 	dpaa2_queue_cb_dqrr_t *cb;
 	dpaa2_queue_cb_eqresp_free_t *cb_eqresp_free;
 	struct dpaa2_bp_info *bp_array;
drivers/event/dpaa2/dpaa2_eventdev.c +208 -100

410 lines not on this page · raw message

drivers/event/dpaa2/dpaa2_eventdev.h +10 -1
index b6f23ec2e2..0a98088fe1 100644
@@ -52,6 +52,7 @@ enum {
  */
 
 #define DPAA2_EVENTQ_LINK_CONF_MAX 4 /** Max schedule type + 1.*/
+#define DPAA2_EVENTQ_DPNI_RXQ_ATTACH_MAX 128
 struct dpaa2_eventq {
 	int valid;
 	void *event_port;
@@ -63,6 +64,8 @@ struct dpaa2_eventq {
 	uint32_t event_queue_cfg;
 	uint32_t event_queue_id;
 	struct dpaa2_queue *dpci_txqs[DPAA2_EVENTQ_LINK_CONF_MAX];
+	uint8_t dpni_rxq_num;
+	struct dpaa2_queue *dpni_rxqs[DPAA2_EVENTQ_DPNI_RXQ_ATTACH_MAX];
 };
 
 struct dpaa2_port {
@@ -83,13 +86,19 @@ struct dpaa2_port {
 	uint64_t timeout_us;
 };
 
+enum dpaa2_eventdev_status {
+	DPAA2_EVENTDEV_CREATED,
+	DPAA2_EVENTDEV_STARTED,
+	DPAA2_EVENTDEV_STOPPED
+};
+
 struct dpaa2_eventdev {
 	struct dpaa2_eventq evq_info[DPAA2_EVENT_MAX_QUEUES];
 	uint32_t dequeue_timeout_ns;
 	uint8_t max_event_queues;
 	uint8_t nb_event_queues;
 	uint8_t nb_event_ports;
-	uint8_t resvd_1;
+	uint8_t status;
 	uint32_t nb_event_queue_flows;
 	uint32_t nb_event_port_dequeue_depth;
 	uint32_t nb_event_port_enqueue_depth;
drivers/event/dpaa2/dpaa2_scheduler.c +26 -2
index 26e3f50cf7..6a4ec04aae 100644
@@ -524,8 +524,27 @@ int rte_dpaa2_scheduler_start(void *scheduler_handle)
 	return ret;
 }
 
+static void
+dpaa2_scheduler_eventq_detach(struct dpaa2_sch_dev *sch_dev,
+	uint16_t un_attach_num)
+{
+	uint16_t i;
+	int ret;
+
+	for (i = 0; i < un_attach_num; i++) {
+		ret = dpaa2_eth_eventq_detach(sch_dev->port_queue[i].eth_dev,
+			sch_dev->port_queue[i].rxq_id);
+		if (ret) {
+			DPAA2_EVENTDEV_ERR("Failed(%d) to detach %s's rxq%d",
+				ret, sch_dev->port_queue[i].eth_dev->data->name,
+				sch_dev->port_queue[i].rxq_id);
+		}
+	}
+}
+
 static int
-dpaa2_scheduler_rx_core_push_drain(struct dpaa2_sch_dev *sch_dev, uint16_t core)
+dpaa2_scheduler_rx_core_push_drain(struct dpaa2_sch_dev *sch_dev,
+	uint16_t core, uint16_t *attach_num)
 {
 	struct dpaa2_dpio_dev *dpio_dev;
 	struct dpaa2_dpcon_dev *dpcon_dev;
@@ -544,6 +563,8 @@ dpaa2_scheduler_rx_core_push_drain(struct dpaa2_sch_dev *sch_dev, uint16_t core)
 		DPAA2_EVENTDEV_WARN("Drain %d buffer(s) from core%d", drain_num, core);
 
 	qbman_swp_push_set(dpio_dev->sw_portal, dpcon_dev->channel_index, 0);
+	if (attach_num)
+		(*attach_num)++;
 	ret = dpio_remove_static_dequeue_channel(dpio_dev->dpio,
 		0, dpio_dev->token, dpcon_dev->dpcon_id);
 	if (ret)
@@ -579,17 +600,20 @@ int rte_dpaa2_scheduler_destroy(void *scheduler_handle)
 	struct dpaa2_dpcon_dev *dpcon_dev;
 	struct dpaa2_dpci_dev *dpci_dev;
 	int32_t ret = 0, _ret, i;
+	uint16_t attach_num = 0;
 
 	if (sch_dev->sch_mode == RTE_DPAA2_SCH_PUSH) {
 		/** Make sure all data threads quit.*/
 		for (i = 0; i < RTE_MAX_LCORE; i++) {
-			_ret = dpaa2_scheduler_rx_core_push_drain(sch_dev, i);
+			_ret = dpaa2_scheduler_rx_core_push_drain(sch_dev, i, &attach_num);
 			if (_ret)
 				ret = _ret;
 		}
 	} else {
 		dpaa2_scheduler_rx_pull_drain(sch_dev);
+		attach_num = sch_dev->port_queue_num;
 	}
+	dpaa2_scheduler_eventq_detach(sch_dev, attach_num);
 
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
 		dpcon_dev = sch_dev->dpcon_dev[i];
drivers/net/dpaa2/dpaa2_ethdev.c +44 -13

101 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.h +4 -0
index e4b896f17c..8c0be81c95 100644
@@ -426,6 +426,7 @@ struct dpaa2_dev_priv {
 	uint8_t cgid_in_use[MAX_TCS];
 
 	rte_spinlock_t meter_lock;
+	uint16_t evq_attach_num;
 
 	uint16_t dpni_ver_major;
 	uint16_t dpni_ver_minor;
@@ -945,6 +946,9 @@ __rte_internal
 int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
 		int eth_rx_queue_id);
 
+__rte_internal
+int dpaa2_eth_eventq_detach_by_rxq(struct dpaa2_queue *dpaa2_ethq);
+
 uint16_t dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 
 uint16_t dpaa2_dev_loopback_rx(void *queue, struct rte_mbuf **bufs,
Signature · 1 line
2.43.0
#168 lore raw

PATCH 38/65 net/dpaa2: add multi-port Tx API

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Add a public API to transmit an array of packets whose destination port and Tx queue are given per packet, and clean up the ordered Tx helpers it builds on.

- New API rte_dpaa2_dev_tx_multi_ports():
takes per-packet port_id[] and txq_id[] arrays (txq_id NULL means queue 0 of each port), resolves each dpaa2_queue, and forwards to dpaa2_dev_tx_multi_txq_ordered(). This allows a single burst to span multiple ports.

- dpaa2_dev_tx_multi_txq_ordered() takes struct dpaa2_queue ** instead of void ** and no longer loops with tx_again or accumulates a running "sent" count; it enqueues one batch and returns the number sent. Tx confirmation is now done after enqueue only for queues that have a tx_conf_queue, and the buffer-pool lookup is deferred to the slow path.

- The dy_conf out-parameter is dropped from the mbuf-to-fd helpers (dpaa2_dev_tx_mbuf_to_sg_fd, dpaa2_dev_tx_mbuf_to_simple_fd, dpaa2_dev_tx_fast_mbuf_to_fd); it was written but never consumed. dpaa2_dev_tx_fast_mbuf_to_fd() now takes the private structure directly and reads tx_conf_type from it.

---
 drivers/event/dpaa2/dpaa2_eventdev.c |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.h     |   4 +-
 drivers/net/dpaa2/dpaa2_rxtx.c       | 127 ++++++++++++---------------
 drivers/net/dpaa2/rte_pmd_dpaa2.h    |   5 ++
 4 files changed, 66 insertions(+), 72 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev.c +1 -1
index 476decbbdc..be6d8bc3da 100644
@@ -1095,7 +1095,7 @@ static uint16_t
 dpaa2_eventdev_txa_enqueue(void *port,
 	struct rte_event ev[], uint16_t nb_events)
 {
-	void *txq[MAX_TX_RING_SLOTS];
+	struct dpaa2_queue *txq[MAX_TX_RING_SLOTS];
 	struct rte_mbuf *m[MAX_TX_RING_SLOTS];
 	uint16_t sent = 0, burst, i, port_id, qid;
 
drivers/net/dpaa2/dpaa2_ethdev.h +2 -2
index 8c0be81c95..e4dc7b7e4f 100644
@@ -975,8 +975,8 @@ 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 dpaa2_dev_tx_multi_txq_ordered(struct dpaa2_queue **dpaa2_q,
+	struct rte_mbuf **bufs, uint16_t nb_pkts);
 
 void dpaa2_dev_free_eqresp_buf(uint16_t eqresp_ci, struct dpaa2_queue *dpaa2_q);
 void dpaa2_flow_clean(struct rte_eth_dev *dev, uint8_t tc_id,
drivers/net/dpaa2/dpaa2_rxtx.c +58 -69

281 lines not on this page · raw message

drivers/net/dpaa2/rte_pmd_dpaa2.h +5 -0
index 5125ec5bf7..74b7e63c54 100644
@@ -162,6 +162,11 @@ uint16_t
 rte_dpaa2_scheduler_rx(void *scheduler_handle, struct rte_mbuf **mbuf,
 	uint16_t nb_pkts);
 
+__rte_experimental
+uint16_t
+rte_dpaa2_dev_tx_multi_ports(uint16_t port_id[],
+	uint16_t txq_id[], struct rte_mbuf **bufs, uint16_t nb_pkts);
+
 #define RTE_DPAA2_EVENT_PORT_CFG_ATOMIC RTE_BIT32(31)
 
 /** RTE_DPAA2_MIX_GROUP_FLOW has same behavio as RTE_DPAA2_FLAT_GROUP_FLOW*/
Signature · 1 line
2.43.0
#169 lore raw

PATCH 39/65 event/dpaa2: limit attached Rx flows per event queue

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The array tracking Rx queues attached to an event queue used a separate DPAA2_EVENTQ_DPNI_RXQ_ATTACH_MAX (128) bound, which was unrelated to the event queue flow limit. Reuse the existing DPAA2_EVENT_MAX_QUEUE_FLOWS limit instead so a single value governs how many flows can target one event queue.

Reduce DPAA2_EVENT_MAX_QUEUE_FLOWS from 2048 to 1024, size the dpni_rxqs[] array by that limit, and drop the now unused DPAA2_EVENTQ_DPNI_RXQ_ATTACH_MAX define. Widen dpni_rxq_num and the local attach index to uint16_t so they can hold the larger count, and update the attach error message to report the offending event queue.

---
 drivers/event/dpaa2/dpaa2_eventdev.c | 6 +++---
 drivers/event/dpaa2/dpaa2_eventdev.h | 7 +++----
 2 files changed, 6 insertions(+), 7 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev.c +3 -3
index be6d8bc3da..cd2b00c3c9 100644
@@ -48,11 +48,11 @@ dpaa2_eventdev_attach_eth_rxq(const struct rte_eth_dev *dev,
 {
 	int ret;
 	uint8_t ev_qid = queue_conf->ev.queue_id;
-	uint8_t idx = priv->evq_info[ev_qid].dpni_rxq_num;
+	uint16_t idx = priv->evq_info[ev_qid].dpni_rxq_num;
 	struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
 
-	if (idx >= DPAA2_EVENTQ_DPNI_RXQ_ATTACH_MAX) {
-		DPAA2_EVENTDEV_ERR("Too many queues to attach.");
+	if (idx >= DPAA2_EVENT_MAX_QUEUE_FLOWS) {
+		DPAA2_EVENTDEV_ERR("Too many flows to attach eventq%d", ev_qid);
 		return -ENOMEM;
 	}
 	ret = dpaa2_eth_eventq_attach(dev, rxq_id, dpcon, queue_conf);
drivers/event/dpaa2/dpaa2_eventdev.h +3 -4
index 0a98088fe1..adeb22bda6 100644
@@ -19,7 +19,7 @@
 #define DPAA2_EVENT_MIN_DEQUEUE_TIMEOUT		1
 #define DPAA2_EVENT_MAX_DEQUEUE_TIMEOUT		(UINT32_MAX - 1)
 #define DPAA2_EVENT_PORT_DEQUEUE_TIMEOUT_NS	100UL
-#define DPAA2_EVENT_MAX_QUEUE_FLOWS		2048
+#define DPAA2_EVENT_MAX_QUEUE_FLOWS		1024
 #define DPAA2_EVENT_MAX_QUEUE_PRIORITY_LEVELS	8
 #define DPAA2_EVENT_MAX_EVENT_PRIORITY_LEVELS	0
 #define DPAA2_EVENT_MAX_NUM_EVENTS		(INT32_MAX - 1)
@@ -52,7 +52,6 @@ enum {
  */
 
 #define DPAA2_EVENTQ_LINK_CONF_MAX 4 /** Max schedule type + 1.*/
-#define DPAA2_EVENTQ_DPNI_RXQ_ATTACH_MAX 128
 struct dpaa2_eventq {
 	int valid;
 	void *event_port;
@@ -64,8 +63,8 @@ struct dpaa2_eventq {
 	uint32_t event_queue_cfg;
 	uint32_t event_queue_id;
 	struct dpaa2_queue *dpci_txqs[DPAA2_EVENTQ_LINK_CONF_MAX];
-	uint8_t dpni_rxq_num;
-	struct dpaa2_queue *dpni_rxqs[DPAA2_EVENTQ_DPNI_RXQ_ATTACH_MAX];
+	uint16_t dpni_rxq_num;
+	struct dpaa2_queue *dpni_rxqs[DPAA2_EVENT_MAX_QUEUE_FLOWS];
 };
 
 struct dpaa2_port {
Signature · 1 line
2.43.0
#170 lore raw

PATCH 40/65 eventdev: fix port link/unlink callback return documentation

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The eventdev_port_link_t, eventdev_port_link_profile_t, eventdev_port_unlink_t and eventdev_port_unlink_profile_t PMD callbacks return the number of links (or unlinks) successfully established, and a negative value on failure. This matches the rte_event_port_link() and rte_event_port_unlink() public API contract and the existing driver implementations.

The Doxygen comments incorrectly stated that these callbacks "Returns 0 on success", which is misleading for PMD authors and inconsistent with the actual behaviour. Update the documentation to describe the real return semantics.

---
 lib/eventdev/eventdev_pmd.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
lib/eventdev/eventdev_pmd.h +5 -4
index 9309dce5e1..fcf9b6922d 100644
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2016 Cavium, Inc
+ * Copyright 2026 NXP
  */
 
 #ifndef _RTE_EVENTDEV_PMD_H_
@@ -441,7 +442,7 @@ typedef void (*eventdev_port_quiesce_t)(struct rte_eventdev *dev, void *port,
  *   The number of links to establish
  *
  * @return
- *   Returns 0 on success.
+ *   Number of links successfully established, or a negative value on failure.
  */
 typedef int (*eventdev_port_link_t)(struct rte_eventdev *dev, void *port,
 		const uint8_t queues[], const uint8_t priorities[],
@@ -467,7 +468,7 @@ typedef int (*eventdev_port_link_t)(struct rte_eventdev *dev, void *port,
  *   The profile ID to associate the links.
  *
  * @return
- *   Returns 0 on success.
+ *   Number of links successfully established, or a negative value on failure.
  */
 typedef int (*eventdev_port_link_profile_t)(struct rte_eventdev *dev, void *port,
 					    const uint8_t queues[], const uint8_t priorities[],
@@ -486,7 +487,7 @@ typedef int (*eventdev_port_link_profile_t)(struct rte_eventdev *dev, void *port
  *   The number of unlinks to establish
  *
  * @return
- *   Returns 0 on success.
+ *   Number of unlinks successfully established, or a negative value on failure.
  */
 typedef int (*eventdev_port_unlink_t)(struct rte_eventdev *dev, void *port,
 		uint8_t queues[], uint16_t nb_unlinks);
@@ -507,7 +508,7 @@ typedef int (*eventdev_port_unlink_t)(struct rte_eventdev *dev, void *port,
  *   The profile ID of the associated links.
  *
  * @return
- *   Returns 0 on success.
+ *   Number of unlinks successfully established, or a negative value on failure.
  */
 typedef int (*eventdev_port_unlink_profile_t)(struct rte_eventdev *dev, void *port,
 					      uint8_t queues[], uint16_t nb_unlinks,
Signature · 1 line
2.43.0
#171 lore raw

PATCH 41/65 event/dpaa2: allow event queue link to multiple ports

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The event queue previously stored a single owning event port and each DPCON kept a single channel_index, so a queue could be linked to only one port and the static dequeue channel could be added to only one DPIO at a time. This prevented linking the same event queue from several ports.

Track the DPCON static dequeue channel per DPIO by replacing the single channel_index with ch_idx[]/dpio_idx[] arrays and a ch_idx_num count (bounded by DPAA2_DPCON_MAX_CH_IDX_NUM). On link, add a channel for the linking DPIO and record its index; on unlink, look up the channel by DPIO index and remove it, compacting the arrays.

Replace the exclusive evq_info->event_port ownership with a per-queue link_num reference count and a per-port evq_map[] that resolves an event queue id to its evq_info during enqueue. This drops the old per-enqueue owner check in favour of a direct map lookup.

Add range checks on event queue id in queue setup and Rx queue attach, verify the queue index matches its event_queue_id, reject linking a queue configured as single link when already linked, and return specific error codes. Lower a couple of noisy messages from ERR/WARN to WARN/DEBUG. Update the scheduler DPCI receive and drain paths to the new per-DPIO channel index tracking.

---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h |   6 +-
 drivers/event/dpaa2/dpaa2_eventdev.c    | 207 ++++++++++++++----------
 drivers/event/dpaa2/dpaa2_eventdev.h    |   3 +-
 drivers/event/dpaa2/dpaa2_scheduler.c   |  10 +-
 4 files changed, 140 insertions(+), 86 deletions(-)
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +5 -1
index a0b1d2abfa..f67f2283db 100644
@@ -283,6 +283,8 @@ struct dpaa2_dpci_dev {
 	struct dpaa2_queue *tx_queue;
 };
 
+#define DPAA2_DPCON_MAX_CH_IDX_NUM 16
+
 struct dpaa2_dpcon_dev {
 	TAILQ_ENTRY(dpaa2_dpcon_dev) next;
 	struct fsl_mc_io dpcon;
@@ -291,7 +293,9 @@ struct dpaa2_dpcon_dev {
 	uint32_t dpcon_id;
 	uint16_t qbman_ch_id;
 	uint8_t num_priorities;
-	uint8_t channel_index;
+	uint8_t ch_idx[DPAA2_DPCON_MAX_CH_IDX_NUM];
+	uint16_t dpio_idx[DPAA2_DPCON_MAX_CH_IDX_NUM];
+	uint8_t ch_idx_num;
 };
 
 /* DPCON channel pool, shared by the net rx-interrupt path and the event PMD */
drivers/event/dpaa2/dpaa2_eventdev.c +126 -81

310 lines not on this page · raw message

drivers/event/dpaa2/dpaa2_eventdev.h +2 -1
index adeb22bda6..c0ce42c83f 100644
@@ -54,7 +54,7 @@ enum {
 #define DPAA2_EVENTQ_LINK_CONF_MAX 4 /** Max schedule type + 1.*/
 struct dpaa2_eventq {
 	int valid;
-	void *event_port;
+	uint8_t link_num;
 	/* DPcon device */
 	struct dpaa2_dpcon_dev *dpcon;
 	/* Attached DPCI device */
@@ -80,6 +80,7 @@ struct dpaa2_port {
 	RTE_ATOMIC(uint32_t) flushing;
 
 	struct dpaa2_eventq *evq_info[DPAA2_EVENT_MAX_QUEUES];
+	struct dpaa2_eventq *evq_map[DPAA2_EVENT_MAX_QUEUES];
 	uint8_t port_id;
 	uint8_t num_linked_evq;
 	uint64_t timeout_us;
drivers/event/dpaa2/dpaa2_scheduler.c +7 -3
index 6a4ec04aae..9e58b4253f 100644
@@ -196,16 +196,18 @@ dpaa2_scheduler_dpci_recv(struct dpaa2_sch_dev *sch_dev,
 	ret = dpio_add_static_dequeue_channel(dpio_dev->dpio,
 			CMD_PRI_LOW, dpio_dev->token,
 			dpcon_dev->dpcon_id,
-			&dpcon_dev->channel_index);
+			&dpcon_dev->ch_idx[dpcon_dev->ch_idx_num]);
 	if (ret) {
 		DPAA2_EVENTDEV_ERR("Failure(%d) adding dpcon%d to static dq channel",
 			ret, dpcon_dev->dpcon_id);
 		return 0;
 	}
+	dpcon_dev->dpio_idx[dpcon_dev->ch_idx_num] = dpio_dev->index;
 
-	qbman_swp_push_set(swp, dpcon_dev->channel_index, 1);
+	qbman_swp_push_set(swp, dpcon_dev->ch_idx[dpcon_dev->ch_idx_num], 1);
 	sch_dev->linked[cpu] = sch_dev->port_queue_num;
 	sch_dev->dpio_dev[cpu] = dpio_dev;
+	dpcon_dev->ch_idx_num++;
 
 start_dq:
 	while (num_pkts < nb_pkts) {
@@ -562,7 +564,9 @@ dpaa2_scheduler_rx_core_push_drain(struct dpaa2_sch_dev *sch_dev,
 	if (drain_num > 0)
 		DPAA2_EVENTDEV_WARN("Drain %d buffer(s) from core%d", drain_num, core);
 
-	qbman_swp_push_set(dpio_dev->sw_portal, dpcon_dev->channel_index, 0);
+	qbman_swp_push_set(dpio_dev->sw_portal,
+		dpcon_dev->ch_idx[dpcon_dev->ch_idx_num - 1], 0);
+	dpcon_dev->ch_idx_num--;
 	if (attach_num)
 		(*attach_num)++;
 	ret = dpio_remove_static_dequeue_channel(dpio_dev->dpio,
Signature · 1 line
2.43.0
#172 lore raw

PATCH 42/65 event/dpaa2: report available DPIO count and fix create cleanup

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

max_event_ports was reported as the total number of DPAA2_IO devices, including DPIOs already claimed by other users(affine portals). Add an internal helper rte_dpaa2_available_dpio_device() that counts only DPIOs with a zero reference count, and use it so the eventdev advertises the number of ports it can actually acquire.

Rework dpaa2_eventdev_create() error handling. The device creation loop now iterates over a fixed range and, on any DPCI attach failure, frees the DPCON and DPCI acquired for the current event queue and breaks out instead of returning with resources leaked. A single done path releases the DPCON/DPCI of all event queues set up so far when an error occurred, and the function returns a meaningful error code rather than a fixed -EFAULT.

---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 15 +++++++
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h |  4 ++
 drivers/event/dpaa2/dpaa2_eventdev.c     | 52 +++++++++++++++---------
 drivers/event/dpaa2/dpaa2_eventdev.h     | 23 ++++++++++-
 4 files changed, 73 insertions(+), 21 deletions(-)
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +15 -0
index 55dcef41d1..654472b284 100644
@@ -465,6 +465,21 @@ void rte_dpaa2_free_dpio_device(struct dpaa2_dpio_dev *dpio_dev)
 	dpaa2_put_qbman_swp(dpio_dev);
 }
 
+RTE_EXPORT_INTERNAL_SYMBOL(rte_dpaa2_available_dpio_device)
+uint16_t
+rte_dpaa2_available_dpio_device(void)
+{
+	struct dpaa2_dpio_dev *dpio_dev = NULL;
+	uint16_t available_num = 0;
+
+	TAILQ_FOREACH(dpio_dev, &dpio_dev_list, next) {
+		if (dpio_dev && !rte_atomic16_read(&dpio_dev->ref_count))
+			available_num++;
+	}
+
+	return available_num;
+}
+
 static void
 dpaa2_close_dpio_device(int object_id)
 {
drivers/bus/fslmc/portal/dpaa2_hw_dpio.h +4 -0
index ae0f5993d6..d28fdb03b7 100644
@@ -78,4 +78,8 @@ __rte_internal
 void
 rte_dpaa2_free_dpio_device(struct dpaa2_dpio_dev *dpio_dev);
 
+__rte_internal
+uint16_t
+rte_dpaa2_available_dpio_device(void);
+
 #endif /* _DPAA2_HW_DPIO_H_ */
drivers/event/dpaa2/dpaa2_eventdev.c +32 -20

101 lines not on this page · raw message

drivers/event/dpaa2/dpaa2_eventdev.h +22 -1
index c0ce42c83f..af1c831b92 100644
@@ -8,6 +8,9 @@
 #include <eventdev_pmd.h>
 #include <eventdev_pmd_vdev.h>
 #include <rte_atomic.h>
+#include <rte_common.h>
+#include <rte_eventdev.h>
+
 #include <mc/fsl_dpcon.h>
 #include <mc/fsl_mc_sys.h>
 
@@ -15,6 +18,7 @@
 
 #define DPAA2_EVENT_DEFAULT_DPCI_PRIO 0
 
+#define DPAA2_EVENT_MAX_PORTS			16
 #define DPAA2_EVENT_MAX_QUEUES			16
 #define DPAA2_EVENT_MIN_DEQUEUE_TIMEOUT		1
 #define DPAA2_EVENT_MAX_DEQUEUE_TIMEOUT		(UINT32_MAX - 1)
@@ -51,7 +55,24 @@ enum {
  * the ethdev to eventdev with DPAA2 devices.
  */
 
-#define DPAA2_EVENTQ_LINK_CONF_MAX 4 /** Max schedule type + 1.*/
+/*
+ * Size of the per-eventq dpci_txqs[] array. It is indexed directly by
+ * event->sched_type, so it must be (largest sched-type value) + 1.
+ * RTE_SCHED_TYPE_{ORDERED,ATOMIC,PARALLEL} are plain macros (0, 1, 2) with
+ * no upstream MAX definition, so compute the maximum explicitly here rather
+ * than assuming PARALLEL is numerically largest. If the sched-type values are
+ * ever renumbered upstream, this expression still yields the correct bound.
+ *
+ * A plain ternary max is used (not RTE_MAX): RTE_MAX expands to a GCC
+ * statement-expression ({ ... }), which is not a constant expression and
+ * cannot size an array at file scope.
+ */
+#define DPAA2_EVENTQ_MAX2(a, b) ((a) > (b) ? (a) : (b))
+#define DPAA2_EVENTQ_LINK_CONF_MAX \
+	(DPAA2_EVENTQ_MAX2(RTE_SCHED_TYPE_ORDERED, \
+		DPAA2_EVENTQ_MAX2(RTE_SCHED_TYPE_ATOMIC, \
+			RTE_SCHED_TYPE_PARALLEL)) + 1)
+
 struct dpaa2_eventq {
 	int valid;
 	uint8_t link_num;
Signature · 1 line
2.43.0
#173 lore raw

PATCH 43/65 event/dpaa2: use event port DPIO for dequeue wait

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

dpaa2_eventdev_dequeue_wait() cleared the interrupt status and armed epoll_wait() using the per-lcore portal and DPIO (DPAA2_PER_LCORE_PORTAL / DPAA2_PER_LCORE_DPIO). Those per-lcore handles are only valid on the polling path and do not correspond to the DPIO backing the event port, so the interrupt fd waited on could belong to the wrong portal.

Pass the event port's dpio_dev into dpaa2_eventdev_dequeue_wait() and use its software portal and epoll fd, matching the DPIO actually used by the dequeue burst.

---
 drivers/event/dpaa2/dpaa2_eventdev.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev.c +5 -7
index 5badc17af7..be23dbf4dc 100644
@@ -230,15 +230,13 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
 	return num_tx;
 }
 
-static void dpaa2_eventdev_dequeue_wait(uint64_t timeout_ticks)
+static void dpaa2_eventdev_dequeue_wait(struct dpaa2_dpio_dev *dpio_dev,
+	uint64_t timeout_ticks)
 {
 	struct epoll_event epoll_ev;
 
-	qbman_swp_interrupt_clear_status(DPAA2_PER_LCORE_PORTAL,
-					 QBMAN_SWP_INTERRUPT_DQRI);
-
-	epoll_wait(DPAA2_PER_LCORE_DPIO->epoll_fd,
-			 &epoll_ev, 1, timeout_ticks);
+	qbman_swp_interrupt_clear_status(dpio_dev->sw_portal, QBMAN_SWP_INTERRUPT_DQRI);
+	epoll_wait(dpio_dev->epoll_fd, &epoll_ev, 1, timeout_ticks);
 }
 
 static void dpaa2_eventdev_process_parallel(struct dpaa2_dpio_dev *dpio_dev,
@@ -316,7 +314,7 @@ dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[],
 			 */
 			qbman_swp_dqrr_consume(swp, NULL);
 			if (!num_pkts && timeout_ticks) {
-				dpaa2_eventdev_dequeue_wait(timeout_ticks);
+				dpaa2_eventdev_dequeue_wait(dpio_dev, timeout_ticks);
 				timeout_ticks = 0;
 				continue;
 			}
Signature · 1 line
2.43.0
#174 lore raw

PATCH 44/65 bus/fslmc: consolidate DPIO interrupt setup and bound coalescing

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Move the DPIO DQRI interrupt setup into rte_dpaa2_alloc_dpio_device() so that both the event PMD and the portal-affine path share a single entry point. The allocator now takes the interrupt-enable flag, the DQRR coalescing threshold and the target CPU, and it optionally pins the portal IRQ to that core. This removes the duplicated interrupt init that previously lived in dpaa2_configure_stashing().

Validate the coalescing configuration on the way in:

- The DQRR threshold is capped at the portal DQRR ring depth minus one (DPAA2_PORTAL_INTR_THRESH_MAX). An out-of-range value from the DPAA2_PORTAL_INTR_THRESHOLD environment variable or the caller is rejected and coalescing is disabled.
- qbman_swp_dqrr_thrshld_write() clamps the threshold to the ring size, and qbman_swp_intr_timeout_write() clamps the ITP tick to QBMAN_CINH_SWP_ITPR_MAX (12-bit field).

Also clean up the QBMan portal interrupt helpers:

- Add QBMAN_SWP_INTERRUPT_ALL and use it when clearing the portal

    interrupt status instead of the bare 0xffffffff mask.

- Fix qbman_swp_interrupt_set_inhibit() to write the single LSB inhibit bit as described by the reference manual rather than an all-ones mask.
- Rename the misleading "mask" parameters of the threshold and timeout writers to "threshold" and "qbman_tick".

---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      | 103 ++++++++----------
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h      |   5 +-
 .../fslmc/qbman/include/fsl_qbman_portal.h    |  12 +-
 drivers/bus/fslmc/qbman/qbman_portal.c        |  22 +++-
 drivers/bus/fslmc/qbman/qbman_sys.h           |   4 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          |   3 +-
 6 files changed, 79 insertions(+), 70 deletions(-)
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +46 -57
index 654472b284..4affd4e0b4 100644
@@ -181,7 +181,7 @@ dpaa2_dpio_affine_intr_to_core(int32_t dpio_id)
  */
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_dpio_intr_init)
 int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int threshold,
-			 int timeout, bool build_epoll)
+	int timeout, bool build_epoll)
 {
 	int eventfd, dpio_epoll_fd, ret;
 	struct epoll_event epoll_ev;
@@ -191,13 +191,12 @@ int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int threshold,
 
 	ret = rte_dpaa2_intr_enable(dpio_dev->intr_handle, 0);
 	if (ret) {
-		DPAA2_BUS_ERR("Interrupt registration failed");
-		return -1;
+		DPAA2_BUS_ERR("Failed(%d) to enable dpio interrupt", ret);
+		return ret;
 	}
 
-	qbman_swp_interrupt_set_trigger(dpio_dev->sw_portal,
-					QBMAN_SWP_INTERRUPT_DQRI);
-	qbman_swp_interrupt_clear_status(dpio_dev->sw_portal, 0xffffffff);
+	qbman_swp_interrupt_set_trigger(dpio_dev->sw_portal, QBMAN_SWP_INTERRUPT_DQRI);
+	qbman_swp_interrupt_clear_status(dpio_dev->sw_portal, QBMAN_SWP_INTERRUPT_ALL);
 	qbman_swp_interrupt_set_inhibit(dpio_dev->sw_portal, 0);
 	qbman_swp_dqrr_thrshld_write(dpio_dev->sw_portal, threshold);
 	qbman_swp_intr_timeout_write(dpio_dev->sw_portal, timeout);
@@ -214,7 +213,7 @@ int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int threshold,
 		if (dpio_epoll_fd < 0) {
 			DPAA2_BUS_ERR("epoll_create failed");
 			rte_dpaa2_intr_disable(dpio_dev->intr_handle, 0);
-			return -1;
+			return -errno;
 		}
 
 		eventfd = rte_intr_fd_get(dpio_dev->intr_handle);
@@ -256,7 +255,7 @@ void dpaa2_dpio_intr_deinit(struct dpaa2_dpio_dev *dpio_dev)
 }
 
 static int
-dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id, bool ethrx)
+dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
 {
 	int sdest, ret;
 
@@ -276,29 +275,6 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id, bool ethrx
 		return ret;
 	}
 
-#ifdef RTE_EVENT_DPAA2
-	/* Only the event PMD's portal is set up here (coalesced DQRI, private
-	 * epoll). The net rx-interrupt portal (ethrx) is configured by the net
-	 * PMD in rx_queue_intr_enable, so do not touch it here.
-	 */
-	if (!ethrx) {
-		int threshold = 3, timeout = 0xFF;
-
-		if (getenv("DPAA2_PORTAL_INTR_THRESHOLD"))
-			threshold = atoi(getenv("DPAA2_PORTAL_INTR_THRESHOLD"));
-		if (getenv("DPAA2_PORTAL_INTR_TIMEOUT"))
-			sscanf(getenv("DPAA2_PORTAL_INTR_TIMEOUT"), "%x", &timeout);
-
-		if (dpaa2_dpio_intr_init(dpio_dev, threshold, timeout, true)) {
-			DPAA2_BUS_ERR("Interrupt registration failed for dpio");
-			return -1;
-		}
-		dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id, cpu_id);
-	}
-#else
-	RTE_SET_USED(ethrx);
-#endif
-
 	return 0;
 }
 
@@ -316,25 +292,18 @@ static void dpaa2_put_qbman_swp(struct dpaa2_dpio_dev *dpio_dev)
 		dpaa2_dpio_intr_deinit(dpio_dev);
 		dpio_dev->cpu_affine = -1;
 		rte_atomic_store_explicit(&dpio_dev->ref_count, 0,
-					  rte_memory_order_release);
+			rte_memory_order_release);
 	}
 }
 
 static struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(bool ethrx)
 {
-	struct dpaa2_dpio_dev *dpio_dev = NULL;
-	int cpu_id;
-	int ret;
-
-	/* Get DPIO dev handle from list using index */
-	TAILQ_FOREACH(dpio_dev, &dpio_dev_list, next) {
-		uint16_t expected = 0;
+	struct dpaa2_dpio_dev *dpio_dev;
+	/* Set the Stashing Destination */
+	int cpu_id = dpaa2_get_core_id(), ret;
 
-		if (rte_atomic_compare_exchange_strong_explicit(&dpio_dev->ref_count,
-				&expected, 1, rte_memory_order_acquire,
-				rte_memory_order_relaxed))
-			break;
-	}
+	dpio_dev = rte_dpaa2_alloc_dpio_device((ethrx && cpu_id >= 0) ?
+		true : false, DPAA2_PORTAL_INTR_COALESC_DISABLE, cpu_id);
 	if (!dpio_dev) {
 		DPAA2_BUS_ERR("No software portal resource left");
 		return NULL;
@@ -343,18 +312,16 @@ static struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(bool ethrx)
 	DPAA2_BUS_DEBUG("New Portal %p (%d) affined thread - %u",
 			dpio_dev, dpio_dev->index, rte_gettid());
 
-	/* Set the Stashing Destination */
-	cpu_id = dpaa2_get_core_id();
 	if (cpu_id < 0) {
 		DPAA2_BUS_WARN("Thread not affined to a single core");
 		if (dpaa2_svr_family != SVR_LX2160A)
 			qbman_swp_update(dpio_dev->sw_portal, 1);
 	} else {
-		ret = dpaa2_configure_stashing(dpio_dev, cpu_id, ethrx);
+		ret = dpaa2_configure_stashing(dpio_dev, cpu_id);
 		if (ret) {
 			DPAA2_BUS_ERR("dpaa2_configure_stashing failed");
 			rte_atomic_store_explicit(&dpio_dev->ref_count, 0,
-						  rte_memory_order_release);
+				rte_memory_order_release);
 			return NULL;
 		}
 	}
@@ -426,9 +393,13 @@ static void dpaa2_portal_finish(void *arg)
 
 RTE_EXPORT_INTERNAL_SYMBOL(rte_dpaa2_alloc_dpio_device)
 struct dpaa2_dpio_dev *
-rte_dpaa2_alloc_dpio_device(int32_t cpu_affine)
+rte_dpaa2_alloc_dpio_device(int isr, uint32_t threshold, int32_t cpu_affine)
 {
 	struct dpaa2_dpio_dev *dpio_dev = NULL;
+#ifdef RTE_EVENT_DPAA2
+	int ret, timeout = 0xff;
+	char *env;
+#endif
 	uint16_t expected = 0;
 
 	/* Get DPIO dev handle from list using index */
@@ -442,18 +413,35 @@ rte_dpaa2_alloc_dpio_device(int32_t cpu_affine)
 		DPAA2_BUS_ERR("No software portal resource left");
 		return NULL;
 	}
-
-	DPAA2_BUS_DEBUG("New Portal %p (%d) affined thread - %u",
-		dpio_dev, dpio_dev->index, rte_gettid());
-
-#ifdef RTE_EVENT_DPAA2
-	if (dpaa2_dpio_intr_init(dpio_dev, 1, 0, false)) {
-		DPAA2_BUS_ERR("Interrupt registration failed for dpio");
+ #ifdef RTE_EVENT_DPAA2
+	if (!isr)
+		goto quit;
+	env = getenv("DPAA2_PORTAL_INTR_THRESHOLD");
+	if (env)
+		threshold = atoi(env);
+	if (threshold > DPAA2_PORTAL_INTR_THRESH_MAX) {
+		DPAA2_BUS_ERR("Invalid threshold(%d) from %s",
+			threshold, env ? "environment" : "parameter");
+			threshold = DPAA2_PORTAL_INTR_COALESC_DISABLE;
+	}
+	env = getenv("DPAA2_PORTAL_INTR_TIMEOUT");
+	if (env)
+		sscanf(env, "%x", &timeout);
+	ret = dpaa2_dpio_intr_init(dpio_dev, threshold, timeout, true);
+	if (ret) {
+		DPAA2_BUS_ERR("Failed(%d) to init DPIO interrupt", ret);
 		rte_atomic_store_explicit(&dpio_dev->ref_count, 0,
 			rte_memory_order_release);
 		return NULL;
 	}
+	if (cpu_affine >= 0)
+		dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id, cpu_affine);
+quit:
+#else
+	RTE_SET_USED(isr);
+	RTE_SET_USED(threshold);
 #endif
+
 	dpio_dev->cpu_affine = cpu_affine;
 
 	return dpio_dev;
@@ -473,7 +461,8 @@ rte_dpaa2_available_dpio_device(void)
 	uint16_t available_num = 0;
 
 	TAILQ_FOREACH(dpio_dev, &dpio_dev_list, next) {
-		if (dpio_dev && !rte_atomic16_read(&dpio_dev->ref_count))
+		if (dpio_dev && !rte_atomic_load_explicit(&dpio_dev->ref_count,
+			rte_memory_order_acquire))
 			available_num++;
 	}
 
drivers/bus/fslmc/portal/dpaa2_hw_dpio.h +4 -1
index d28fdb03b7..0d0894572a 100644
@@ -19,6 +19,9 @@ struct dpaa2_io_portal_t {
 	struct dpaa2_dpio_dev *ethrx_dpio_dev;
 };
 
+#define DPAA2_PORTAL_INTR_COALESC_DISABLE 0
+#define DPAA2_PORTAL_INTR_THRESH_MAX (qbman_swp_portal_dqrr_size(NULL) - 1)
+
 /*! Global per thread DPIO portal */
 RTE_DECLARE_PER_LCORE(struct dpaa2_io_portal_t, _dpaa2_io);
 
@@ -72,7 +75,7 @@ dpaa2_free_eq_descriptors(void);
 
 __rte_internal
 struct dpaa2_dpio_dev *
-rte_dpaa2_alloc_dpio_device(int32_t cpu_affine);
+rte_dpaa2_alloc_dpio_device(int isr, uint32_t threshold, int32_t cpu_affine);
 
 __rte_internal
 void
drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h +8 -4
index fb1c6046ae..7855172074 100644
@@ -92,6 +92,10 @@ const struct qbman_swp_desc *qbman_swp_get_desc(struct qbman_swp *p);
 /* Volatile dequeue command interrupt */
 #define QBMAN_SWP_INTERRUPT_VDCI ((uint32_t)0x00000020)
 
+#define QBMAN_SWP_INTERRUPT_ALL \
+	(QBMAN_SWP_INTERRUPT_EQRI | QBMAN_SWP_INTERRUPT_EQDI | \
+	QBMAN_SWP_INTERRUPT_DQRI | QBMAN_SWP_INTERRUPT_RCRI | \
+	QBMAN_SWP_INTERRUPT_RCDI | QBMAN_SWP_INTERRUPT_VDCI)
 /**
  * qbman_swp_interrupt_get_vanish() - Get the data in software portal
  * interrupt status disable register.
@@ -138,9 +142,9 @@ uint32_t qbman_swp_dqrr_thrshld_read_status(struct qbman_swp *p);
  * qbman_swp_dqrr_thrshld_write() - Set the data in software portal
  * DQRR interrupt threshold register.
  * @p: the given software portal object.
- * @mask: The value to set in SWP_DQRR_ITR register.
+ * @threshold: The value to set in SWP_DQRR_ITR register.
  */
-void qbman_swp_dqrr_thrshld_write(struct qbman_swp *p, uint32_t mask);
+void qbman_swp_dqrr_thrshld_write(struct qbman_swp *p, uint32_t threshold);
 
 /**
  * qbman_swp_intr_timeout_read_status() - Get the data in software portal
@@ -153,9 +157,9 @@ uint32_t qbman_swp_intr_timeout_read_status(struct qbman_swp *p);
  * qbman_swp_intr_timeout_write() - Set the data in software portal
  * Interrupt Time-Out period register.
  * @p: the given software portal object.
- * @mask: The value to set in SWP_ITPR register.
+ * @qbman_tick: The value to set in SWP_ITPR register.
  */
-void qbman_swp_intr_timeout_write(struct qbman_swp *p, uint32_t mask);
+void qbman_swp_intr_timeout_write(struct qbman_swp *p, uint32_t qbman_tick);
 
 /**
  * qbman_swp_interrupt_get_trigger() - Get the data in software portal
drivers/bus/fslmc/qbman/qbman_portal.c +16 -6
index 307c0e3d24..6a027b4aec 100644
@@ -447,9 +447,14 @@ uint32_t qbman_swp_dqrr_thrshld_read_status(struct qbman_swp *p)
 	return qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_DQRR_ITR);
 }
 
-void qbman_swp_dqrr_thrshld_write(struct qbman_swp *p, uint32_t mask)
+void qbman_swp_dqrr_thrshld_write(struct qbman_swp *p, uint32_t threshold)
 {
-	qbman_cinh_write(&p->sys, QBMAN_CINH_SWP_DQRR_ITR, mask);
+	if (threshold >= p->dqrr.dqrr_size) {
+		pr_warn("Invalid threshold(%d) >= DRQQ size(%d)",
+			threshold, p->dqrr.dqrr_size);
+		threshold = p->dqrr.dqrr_size - 1;
+	}
+	qbman_cinh_write(&p->sys, QBMAN_CINH_SWP_DQRR_ITR, threshold);
 }
 
 uint32_t qbman_swp_intr_timeout_read_status(struct qbman_swp *p)
@@ -457,9 +462,14 @@ uint32_t qbman_swp_intr_timeout_read_status(struct qbman_swp *p)
 	return qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_ITPR);
 }
 
-void qbman_swp_intr_timeout_write(struct qbman_swp *p, uint32_t mask)
+void qbman_swp_intr_timeout_write(struct qbman_swp *p, uint32_t qbman_tick)
 {
-	qbman_cinh_write(&p->sys, QBMAN_CINH_SWP_ITPR, mask);
+	if (qbman_tick > QBMAN_CINH_SWP_ITPR_MAX) {
+		pr_warn("Invalid tick(%d) > MAX ISR time-out period(%d)",
+			qbman_tick, QBMAN_CINH_SWP_ITPR_MAX);
+		qbman_tick = QBMAN_CINH_SWP_ITPR_MAX;
+	}
+	qbman_cinh_write(&p->sys, QBMAN_CINH_SWP_ITPR, qbman_tick);
 }
 
 uint32_t qbman_swp_interrupt_get_trigger(struct qbman_swp *p)
@@ -480,8 +490,8 @@ int qbman_swp_interrupt_get_inhibit(struct qbman_swp *p)
 RTE_EXPORT_INTERNAL_SYMBOL(qbman_swp_interrupt_set_inhibit)
 void qbman_swp_interrupt_set_inhibit(struct qbman_swp *p, int inhibit)
 {
-	qbman_cinh_write(&p->sys, QBMAN_CINH_SWP_IIR,
-			 inhibit ? 0xffffffff : 0);
+	/** RM 4.3.2.1.32.4, LSB bit interrupt inhibited*/
+	qbman_cinh_write(&p->sys, QBMAN_CINH_SWP_IIR, inhibit ? 1 : 0);
 }
 
 /***********************/
drivers/bus/fslmc/qbman/qbman_sys.h +3 -1
index 61f817c477..8a8018943a 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
- * Copyright 2019-2020 NXP
+ * Copyright 2019-2020, 2026 NXP
  */
 /* qbman_sys_decl.h and qbman_sys.h are the two platform-specific files in the
  * driver. They are only included via qbman_private.h, which is itself a
@@ -47,6 +47,8 @@
 #define QBMAN_CINH_SWP_IIR          0xec0
 #define QBMAN_CINH_SWP_ITPR         0xf40
 
+#define QBMAN_CINH_SWP_ITPR_MAX ((1 << 12) - 1)
+
 /* CENA register offsets */
 #define QBMAN_CENA_SWP_EQCR(n) (0x000 + ((uint32_t)(n) << 6))
 #define QBMAN_CENA_SWP_DQRR(n) (0x200 + ((uint32_t)(n) << 6))
drivers/event/dpaa2/dpaa2_eventdev.c +2 -1
index be23dbf4dc..30a3119e62 100644
@@ -849,7 +849,8 @@ dpaa2_eventdev_port_setup(struct rte_eventdev *dev, uint8_t port_id,
 		return -ENOMEM;
 	}
 
-	portal->dpio_dev = rte_dpaa2_alloc_dpio_device(-1);
+	portal->dpio_dev = rte_dpaa2_alloc_dpio_device(true,
+		DPAA2_PORTAL_INTR_COALESC_DISABLE, -1);
 	if (!portal->dpio_dev) {
 		rte_free(portal);
 		return -ENODEV;
Signature · 1 line
2.43.0
#175 lore raw

PATCH 45/65 event/dpaa2: honor configured dequeue timeout

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The dequeue timeout handling used a fixed 1ms-per-tick scale and a hardcoded DPAA2_EVENT_PORT_DEQUEUE_TIMEOUT_NS default, and reported that constant from info_get() regardless of the value the application configured. It also passed raw timeout_ticks straight to epoll_wait(), which expects a value in milliseconds.

Convert timeouts using the timer frequency. Cache rte_get_timer_hz() in priv->event_hz at configure time, compute timeout_ticks in timeout_ticks() from the requested ns, and convert ticks back to milliseconds before calling epoll_wait(). info_get() now reports the configured dequeue_timeout_ns, and configure() no longer overrides a zero timeout with the removed default constant.

---
 drivers/event/dpaa2/dpaa2_eventdev.c | 36 ++++++++++++++++------------
 drivers/event/dpaa2/dpaa2_eventdev.h |  2 +-
 2 files changed, 22 insertions(+), 16 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev.c +21 -15
index 30a3119e62..592b3bf4a4 100644
@@ -231,12 +231,12 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
 }
 
 static void dpaa2_eventdev_dequeue_wait(struct dpaa2_dpio_dev *dpio_dev,
-	uint64_t timeout_ticks)
+	uint32_t timeout_ms)
 {
 	struct epoll_event epoll_ev;
 
 	qbman_swp_interrupt_clear_status(dpio_dev->sw_portal, QBMAN_SWP_INTERRUPT_DQRI);
-	epoll_wait(dpio_dev->epoll_fd, &epoll_ev, 1, timeout_ticks);
+	epoll_wait(dpio_dev->epoll_fd, &epoll_ev, 1, timeout_ms);
 }
 
 static void dpaa2_eventdev_process_parallel(struct dpaa2_dpio_dev *dpio_dev,
@@ -274,10 +274,12 @@ dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[],
 	const struct qbman_result *dq;
 	struct dpaa2_dpio_dev *dpio_dev;
 	struct dpaa2_port *dpaa2_portal = port;
+	struct dpaa2_eventdev *priv;
 	struct qbman_swp *swp;
 	const struct qbman_fd *fd;
 	struct dpaa2_queue *rxq;
 	uint16_t num_pkts = 0, i = 0;
+	uint32_t timeout_ms;
 
 	if (unlikely(dpaa2_portal->port_atomic))
 		rte_spinlock_lock(&dpaa2_portal->port_lock);
@@ -287,6 +289,7 @@ dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[],
 		goto quit;
 
 	swp = dpio_dev->sw_portal;
+	priv = dpaa2_portal->eventdev->data->dev_private;
 
 	/* Check if there are atomic contexts to be released */
 
@@ -305,6 +308,10 @@ dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[],
 		i++;
 	}
 	dpio_dev->dpaa2_held_bufs.dqrr_held = 0;
+	if (timeout_ticks)
+		timeout_ms = timeout_ticks * 1000 / priv->event_hz;
+	else
+		timeout_ms = priv->dequeue_timeout_ns / (1000 * 1000);
 
 	do {
 		dq = qbman_swp_dqrr_next(swp);
@@ -313,9 +320,9 @@ dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[],
 			 * the DQRR consume vector before leaving it idle.
 			 */
 			qbman_swp_dqrr_consume(swp, NULL);
-			if (!num_pkts && timeout_ticks) {
-				dpaa2_eventdev_dequeue_wait(dpio_dev, timeout_ticks);
-				timeout_ticks = 0;
+			if (!num_pkts && timeout_ms) {
+				dpaa2_eventdev_dequeue_wait(dpio_dev, timeout_ms);
+				timeout_ms = 0;
 				continue;
 			}
 			goto quit;
@@ -390,8 +397,7 @@ dpaa2_eventdev_info_get(struct rte_eventdev *dev,
 		DPAA2_EVENT_MIN_DEQUEUE_TIMEOUT;
 	dev_info->max_dequeue_timeout_ns =
 		DPAA2_EVENT_MAX_DEQUEUE_TIMEOUT;
-	dev_info->dequeue_timeout_ns =
-		DPAA2_EVENT_PORT_DEQUEUE_TIMEOUT_NS;
+	dev_info->dequeue_timeout_ns = priv->dequeue_timeout_ns;
 	dev_info->max_event_queues = priv->max_event_queues;
 	dev_info->max_event_queue_flows =
 		DPAA2_EVENT_MAX_QUEUE_FLOWS;
@@ -437,6 +443,7 @@ dpaa2_eventdev_configure(const struct rte_eventdev *dev)
 	priv->nb_event_port_dequeue_depth = conf->nb_event_port_dequeue_depth;
 	priv->nb_event_port_enqueue_depth = conf->nb_event_port_enqueue_depth;
 	priv->event_dev_cfg = conf->event_dev_cfg;
+	priv->event_hz = rte_get_timer_hz();
 
 	/* Check dequeue timeout method is per dequeue or global */
 	if (priv->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT) {
@@ -446,14 +453,11 @@ dpaa2_eventdev_configure(const struct rte_eventdev *dev)
 		 */
 		priv->dequeue_timeout_ns = 0;
 
-	} else if (conf->dequeue_timeout_ns == 0) {
-		priv->dequeue_timeout_ns = DPAA2_EVENT_PORT_DEQUEUE_TIMEOUT_NS;
 	} else {
 		priv->dequeue_timeout_ns = conf->dequeue_timeout_ns;
 	}
 
-	DPAA2_EVENTDEV_DEBUG("Configured eventdev devid=%d",
-			     dev->data->dev_id);
+	DPAA2_EVENTDEV_DEBUG("Configured eventdev devid=%d", dev->data->dev_id);
 	return 0;
 }
 
@@ -869,14 +873,16 @@ dpaa2_eventdev_port_setup(struct rte_eventdev *dev, uint8_t port_id,
 
 static int
 dpaa2_eventdev_timeout_ticks(struct rte_eventdev *dev, uint64_t ns,
-			     uint64_t *timeout_ticks)
+	uint64_t *timeout_ticks)
 {
-	uint32_t scale = 1000 * 1000;
+	struct dpaa2_eventdev *priv = dev->data->dev_private;
 
 	EVENTDEV_INIT_FUNC_TRACE();
 
-	RTE_SET_USED(dev);
-	*timeout_ticks = ns / scale;
+	if (!priv->event_hz)
+		priv->event_hz = rte_get_timer_hz();
+
+	*timeout_ticks = ns * priv->event_hz / 1000000000ULL;
 
 	return 0;
 }
drivers/event/dpaa2/dpaa2_eventdev.h +1 -1
index af1c831b92..30911382f3 100644
@@ -22,7 +22,6 @@
 #define DPAA2_EVENT_MAX_QUEUES			16
 #define DPAA2_EVENT_MIN_DEQUEUE_TIMEOUT		1
 #define DPAA2_EVENT_MAX_DEQUEUE_TIMEOUT		(UINT32_MAX - 1)
-#define DPAA2_EVENT_PORT_DEQUEUE_TIMEOUT_NS	100UL
 #define DPAA2_EVENT_MAX_QUEUE_FLOWS		1024
 #define DPAA2_EVENT_MAX_QUEUE_PRIORITY_LEVELS	8
 #define DPAA2_EVENT_MAX_EVENT_PRIORITY_LEVELS	0
@@ -124,6 +123,7 @@ struct dpaa2_eventdev {
 	uint32_t nb_event_port_dequeue_depth;
 	uint32_t nb_event_port_enqueue_depth;
 	uint32_t event_dev_cfg;
+	uint64_t event_hz;
 };
 
 int test_eventdev_dpaa2(void);
Signature · 1 line
2.43.0
#176 lore raw

PATCH 46/65 bus/fslmc: use EAL API for DPIO interrupt

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The DPIO interrupt path created a private epoll instance with the raw epoll_create/epoll_ctl/epoll_wait syscalls and cached its fd in dpaa2_dpio_dev::epoll_fd. This duplicated the epoll bookkeeping already provided by the EAL interrupt handle and split the interrupt state across two owners.

Switch to the EAL rte_epoll wrappers. dpaa2_dpio_intr_init() now arms the interrupt handle's epoll event via rte_epoll_ctl(), dpaa2_dpio_intr_deinit() removes it, and the event PMD dequeue wait uses rte_epoll_wait() on the handle's epoll fd. The now redundant epoll_fd field is removed from struct dpaa2_dpio_dev.

While converting, tidy the init/deinit error handling to use goto labels so the interrupt is disabled and the epoll fd closed on every failure path.

---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 58 ++++++++++++++++--------
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h  |  1 -
 drivers/event/dpaa2/dpaa2_eventdev.c     |  7 ++-
 3 files changed, 43 insertions(+), 23 deletions(-)
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +38 -20
index 4affd4e0b4..e95345627d 100644
@@ -184,7 +184,7 @@ int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int threshold,
 	int timeout, bool build_epoll)
 {
 	int eventfd, dpio_epoll_fd, ret;
-	struct epoll_event epoll_ev;
+	struct rte_epoll_event *epoll_ev;
 
 	if (dpio_dev->intr_enabled)
 		return 0;
@@ -201,8 +201,6 @@ int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int threshold,
 	qbman_swp_dqrr_thrshld_write(dpio_dev->sw_portal, threshold);
 	qbman_swp_intr_timeout_write(dpio_dev->sw_portal, timeout);
 
-	dpio_dev->epoll_fd = -1;
-
 	/* The event PMD dequeues by sleeping on a private epoll instance owned
 	 * by the portal, so build it here. The net rx-queue-interrupt path
 	 * exposes the raw eventfd through the generic ethdev API and waits on
@@ -212,45 +210,65 @@ int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int threshold,
 		dpio_epoll_fd = epoll_create1(EPOLL_CLOEXEC);
 		if (dpio_epoll_fd < 0) {
 			DPAA2_BUS_ERR("epoll_create failed");
-			rte_dpaa2_intr_disable(dpio_dev->intr_handle, 0);
-			return -errno;
+			ret = -errno;
+			goto int_disable_err;
 		}
 
 		eventfd = rte_intr_fd_get(dpio_dev->intr_handle);
-		epoll_ev.events = EPOLLIN | EPOLLPRI | EPOLLET;
-		epoll_ev.data.fd = eventfd;
-
-		ret = epoll_ctl(dpio_epoll_fd, EPOLL_CTL_ADD, eventfd, &epoll_ev);
+		if (eventfd < 0) {
+			ret = eventfd;
+			goto epoll_close_err;
+		}
+		epoll_ev = rte_intr_elist_index_get(dpio_dev->intr_handle, 0);
+		if (rte_atomic_load_explicit(&epoll_ev->status,
+			rte_memory_order_relaxed) != RTE_EPOLL_INVALID) {
+			DPAA2_BUS_ERR("Event already been added.");
+			ret = -EEXIST;
+			goto epoll_close_err;
+		}
+		epoll_ev->epdata.event = EPOLLIN | EPOLLPRI | EPOLLET;
+		ret = rte_epoll_ctl(dpio_epoll_fd, EPOLL_CTL_ADD, eventfd, epoll_ev);
 		if (ret < 0) {
-			DPAA2_BUS_ERR("epoll_ctl failed");
-			rte_dpaa2_intr_disable(dpio_dev->intr_handle, 0);
-			close(dpio_epoll_fd);
-			return -1;
+			DPAA2_BUS_ERR("Epoll control add failed(%d)", ret);
+			goto epoll_close_err;
 		}
-		dpio_dev->epoll_fd = dpio_epoll_fd;
 	}
 
 	dpio_dev->intr_enabled = 1;
 
 	return 0;
+
+epoll_close_err:
+	close(dpio_epoll_fd);
+int_disable_err:
+	rte_dpaa2_intr_disable(dpio_dev->intr_handle, 0);
+	return ret;
 }
 
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_dpio_intr_deinit)
 void dpaa2_dpio_intr_deinit(struct dpaa2_dpio_dev *dpio_dev)
 {
-	int ret;
+	int ret, epfd;
+	struct rte_epoll_event *epoll_ev;
 
 	if (!dpio_dev->intr_enabled)
 		return;
 
+	epoll_ev = rte_intr_elist_index_get(dpio_dev->intr_handle, 0);
+	if (rte_atomic_load_explicit(&epoll_ev->status,
+		rte_memory_order_relaxed) != RTE_EPOLL_INVALID) {
+		epoll_ev->epdata.event = EPOLLIN | EPOLLPRI | EPOLLET;
+		epfd = epoll_ev->epfd;
+		ret = rte_epoll_ctl(epfd, EPOLL_CTL_DEL, epoll_ev->fd, epoll_ev);
+		if (ret < 0)
+			DPAA2_BUS_ERR("Epoll control delete failed(%d)", ret);
+		close(epfd);
+	}
+
 	ret = rte_dpaa2_intr_disable(dpio_dev->intr_handle, 0);
 	if (ret)
-		DPAA2_BUS_ERR("DPIO interrupt disable failed");
+		DPAA2_BUS_ERR("DPIO interrupt disable failed(%d)", ret);
 
-	if (dpio_dev->epoll_fd >= 0) {
-		close(dpio_dev->epoll_fd);
-		dpio_dev->epoll_fd = -1;
-	}
 	dpio_dev->intr_enabled = 0;
 }
 
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +0 -1
index f67f2283db..52ec660fb9 100644
@@ -133,7 +133,6 @@ struct dpaa2_dpio_dev {
 		/**< Physical address of Cache Inhibit Area */
 	uintptr_t ci_size; /**< Size of the CI region */
 	struct rte_intr_handle *intr_handle; /* Interrupt related info */
-	int32_t	epoll_fd; /**< File descriptor created for interrupt polling */
 	int32_t hw_id; /**< An unique ID of this DPIO device instance */
 	uint8_t intr_enabled; /**< DQRI portal interrupt already set up */
 	int32_t cpu_affine;
drivers/event/dpaa2/dpaa2_eventdev.c +5 -2
index 592b3bf4a4..f4dbf47b18 100644
@@ -233,10 +233,13 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
 static void dpaa2_eventdev_dequeue_wait(struct dpaa2_dpio_dev *dpio_dev,
 	uint32_t timeout_ms)
 {
-	struct epoll_event epoll_ev;
+	int ret;
+	struct rte_epoll_event *epoll_event;
 
 	qbman_swp_interrupt_clear_status(dpio_dev->sw_portal, QBMAN_SWP_INTERRUPT_DQRI);
-	epoll_wait(dpio_dev->epoll_fd, &epoll_ev, 1, timeout_ms);
+	epoll_event = rte_intr_elist_index_get(dpio_dev->intr_handle, 0);
+	ret = rte_epoll_wait(epoll_event->epfd, epoll_event, 1, timeout_ms);
+	DPAA2_PMD_DP_DEBUG("%s: poll return(%d)", __func__, ret);
 }
 
 static void dpaa2_eventdev_process_parallel(struct dpaa2_dpio_dev *dpio_dev,
Signature · 1 line
2.43.0
#177 lore raw

PATCH 47/65 bus/fslmc: defer DPIO interrupt setup and bind portal to worker core

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Rework the DPIO software-portal interrupt handling so that a portal is only wired to a VFIO eventfd IRQ when it is actually used, and bind the portal's IRQ, CPU governor and stashing to the worker core on first touch or worker core change rather than at create time.

VFIO interrupt lookup:

- rte_dpaa2_vfio_setup_intr() now takes a flag and returns the matched interrupt index (or a negative errno) instead of hard-coding index 0 and the eventfd type. It skips vectors that do not advertise the requested flag instead of failing on the first one.
- dpaa2_dpio_intr_init() calls it with VFIO_IRQ_INFO_EVENTFD, stores the resolved intr_index in the dpio_dev, and enables/disables the interrupt using that index. The intr handle allocation and one-shot setup are removed from dpaa2_create_dpio_device(); the dpio_dev now caches vfio_fd and num_irqs for the lazy setup.

Per-core binding helpers:

- dpaa2_dpio_intr_affinity_set() locates the dpio.<id> IRQ in /proc/interrupts (exact-token match so dpio.17 does not match dpio.170) and writes the CPU to smp_affinity_list, returning an error code instead of the old void best-effort helper.
- dpaa2_dpio_affine_intr_to_core() now takes the dpio_dev and uses the new setter.
- dpaa2_dpio_cpufreq_governor() saves the per-CPU scaling_governor, forces "performance", and can restore all saved governors.
- dpaa2_configure_stashing() is exported as dpaa2_dpio_configure_stashing() and its errors are propagated.

Event PMD binding:

- On the first dequeue on a new core or core change, the event port pins the portal IRQ to that core, sets the performance governor and configures stashing. Governors are restored in dpaa2_eventdev_close().
- Mark the port_atomic branch as unlikely on the enqueue/dequeue hot path.

---
 drivers/bus/fslmc/fslmc_vfio.c           |  34 ++-
 drivers/bus/fslmc/fslmc_vfio.h           |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 297 ++++++++++++++++-------
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h |  11 +-
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h  |   3 +
 drivers/event/dpaa2/dpaa2_eventdev.c     |  29 ++-
 drivers/net/dpaa2/dpaa2_ethdev.c         |   2 +-
 7 files changed, 266 insertions(+), 114 deletions(-)
drivers/bus/fslmc/fslmc_vfio.c +14 -20
index 4897d7a78b..887a68ab32 100644
@@ -1509,41 +1509,35 @@ int rte_dpaa2_intr_disable(struct rte_intr_handle *intr_handle, int index)
 	return ret;
 }
 
-/* set up interrupt support (but not enable interrupts) */
+/* Set up interrupt with flag, return interrupt index in success, minus in failure. */
 int
 rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,
-			  int vfio_dev_fd,
-			  int num_irqs)
+	int vfio_dev_fd, int num_irqs, uint32_t flag)
 {
-	int i, ret;
+	int i, ret, fd;
 
-	/* start from MSI-X interrupt type */
+	/* Find interrupt with given flag. */
 	for (i = 0; i < num_irqs; i++) {
 		struct vfio_irq_info irq_info = { .argsz = sizeof(irq_info) };
-		int fd = -1;
 
 		irq_info.index = i;
 
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq_info);
 		if (ret < 0) {
-			DPAA2_BUS_ERR("Cannot get IRQ(%d) info, error %i (%s)",
-				      i, errno, strerror(errno));
-			return ret;
+			DPAA2_BUS_ERR("Failed(%d) to get IRQ(%d) info (%s)",
+				-errno, i, strerror(errno));
+			continue;
 		}
 
-		/* if this vector cannot be used with eventfd,
-		 * fail if we explicitly
-		 * specified interrupt type, otherwise continue
-		 */
-		if ((irq_info.flags & VFIO_IRQ_INFO_EVENTFD) == 0)
+		if (!(irq_info.flags & flag))
 			continue;
 
 		/* set up an eventfd for interrupts */
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
-			DPAA2_BUS_ERR("Cannot set up eventfd, error %i (%s)",
-				errno, strerror(errno));
-			return fd;
+			DPAA2_BUS_ERR("Cannot set up eventfd, error %d (%s)",
+				-errno, strerror(errno));
+			return -errno;
 		}
 
 		if (rte_intr_fd_set(intr_handle, fd))
@@ -1555,7 +1549,7 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,
 		if (rte_intr_dev_fd_set(intr_handle, vfio_dev_fd))
 			return -rte_errno;
 
-		return 0;
+		return i;
 	}
 
 	/* if we're here, we haven't found a suitable interrupt vector */
@@ -1628,8 +1622,8 @@ fslmc_vfio_process_iodevices(struct rte_dpaa2_device *dev)
 	switch (dev->dev_type) {
 	case DPAA2_ETH:
 		ret = rte_dpaa2_vfio_setup_intr(dev->intr_handle, dev_fd,
-				device_info.num_irqs);
-		if (ret)
+				device_info.num_irqs, VFIO_IRQ_INFO_EVENTFD);
+		if (ret < 0)
 			return ret;
 		break;
 	case DPAA2_CON:
drivers/bus/fslmc/fslmc_vfio.h +2 -2
index 34f2d7759c..9934bc0e86 100644
@@ -45,8 +45,8 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index);
 __rte_internal
 int rte_dpaa2_intr_disable(struct rte_intr_handle *intr_handle, int index);
 
-int rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle, int vfio_dev_fd,
-	int num_irqs);
+int rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,
+	int vfio_dev_fd, int num_irqs, uint32_t flag);
 
 int fslmc_vfio_core_cluster_sdest(uint32_t cpu_id);
 
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +210 -87

440 lines not on this page · raw message

drivers/bus/fslmc/portal/dpaa2_hw_dpio.h +10 -1
index 0d0894572a..7c089408c5 100644
@@ -38,6 +38,15 @@ RTE_DECLARE_PER_LCORE(struct dpaa2_io_portal_t, _dpaa2_io);
 #define DPAA2_PER_LCORE_DQRR_MBUF(i) \
 	RTE_PER_LCORE(_dpaa2_io).dpio_dev->dpaa2_held_bufs.mbuf[i]
 
+__rte_internal int
+dpaa2_dpio_intr_affinity_set(struct dpaa2_dpio_dev *dpio_dev, int cpu_id);
+
+__rte_internal int
+dpaa2_dpio_cpufreq_governor(int cpu_id, bool restore);
+
+__rte_internal int
+dpaa2_dpio_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id);
+
 /* Affine a DPIO portal to current processing thread */
 __rte_internal
 int dpaa2_affine_qbman_swp(void);
@@ -56,7 +65,7 @@ void dpaa2_dpio_intr_deinit(struct dpaa2_dpio_dev *dpio_dev);
 
 /* pin a DPIO's MSI IRQ to the calling lcore's core (rx-queue interrupt mode) */
 __rte_internal
-void dpaa2_dpio_affine_intr_to_core(int32_t dpio_id);
+void dpaa2_dpio_affine_intr_to_core(struct dpaa2_dpio_dev *dpio_dev);
 
 /* allocate memory for FQ - dq storage */
 __rte_internal
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +3 -0
index 52ec660fb9..95c7203aa2 100644
@@ -133,6 +133,9 @@ struct dpaa2_dpio_dev {
 		/**< Physical address of Cache Inhibit Area */
 	uintptr_t ci_size; /**< Size of the CI region */
 	struct rte_intr_handle *intr_handle; /* Interrupt related info */
+	int32_t vfio_fd;
+	uint32_t num_irqs;
+	int32_t intr_index;
 	int32_t hw_id; /**< An unique ID of this DPIO device instance */
 	uint8_t intr_enabled; /**< DQRI portal interrupt already set up */
 	int32_t cpu_affine;
drivers/event/dpaa2/dpaa2_eventdev.c +26 -3
index f4dbf47b18..ad80fd51f5 100644
@@ -88,6 +88,7 @@ static __rte_always_inline struct dpaa2_dpio_dev *
 dpaa2_event_portal_io_prepare(struct dpaa2_port *dpaa2_portal)
 {
 	struct dpaa2_dpio_dev *dpio_dev;
+	int ret, cpu = rte_lcore_id();
 
 	if (unlikely(!dpaa2_portal->dpio_dev)) {
 		DPAA2_EVENTDEV_ERR("Event port%d not setup", dpaa2_portal->port_id);
@@ -106,10 +107,23 @@ dpaa2_event_portal_io_prepare(struct dpaa2_port *dpaa2_portal)
 	if (unlikely(!dpaa2_portal->port_atomic &&
 		!rte_atomic_load_explicit(&dpaa2_portal->flushing,
 		rte_memory_order_relaxed)) &&
-		dpio_dev->cpu_affine != (int32_t)rte_lcore_id()) {
+		dpio_dev->cpu_affine != cpu) {
 		DPAA2_EVENTDEV_DEBUG("Event port%d affine CPU from %d->%d",
-			dpaa2_portal->port_id, dpio_dev->cpu_affine, rte_lcore_id());
-		dpio_dev->cpu_affine = rte_lcore_id();
+			dpaa2_portal->port_id, dpio_dev->cpu_affine, cpu);
+		dpio_dev->cpu_affine = cpu;
+		ret = dpaa2_dpio_intr_affinity_set(dpio_dev, cpu);
+		if (ret) {
+			DPAA2_EVENTDEV_ERR("Failed(%d) to affinity dpio.%d's interrupt on core%d",
+				ret, dpio_dev->hw_id, cpu);
+		}
+		ret = dpaa2_dpio_cpufreq_governor(cpu, false);
+		if (ret)
+			DPAA2_EVENTDEV_WARN("Failed(%d) to set governor of core%d", ret, cpu);
+		ret = dpaa2_dpio_configure_stashing(dpio_dev, cpu);
+		if (ret) {
+			DPAA2_EVENTDEV_WARN("Failed(%d) to configure dpio.%d's stashing on core%d",
+				ret, dpio_dev->hw_id, cpu);
+		}
 	}
 
 	return dpio_dev;
@@ -588,6 +602,15 @@ dpaa2_eventdev_close(struct rte_eventdev *dev)
 			dpaa2_eventdev_port_release(dev->data->ports[i]);
 	}
 
+	/*
+	 * Restore any CPU-frequency governor that the optional first-touch
+	 * binding may have forced (see dpaa2_dpio_cpufreq_governor(cpu, false)).
+	 * Best-effort and a no-op when the governor was never touched.
+	 */
+	ret = dpaa2_dpio_cpufreq_governor(-1, true);
+	if (ret)
+		DPAA2_EVENTDEV_ERR("Failed(%d) to restore all cpus' governors", ret);
+
 	ret = dpaa2_eventdev_eth_queue_del(dev, NULL, -1);
 	if (!ret)
 		priv->status = DPAA2_EVENTDEV_CREATED;
drivers/net/dpaa2/dpaa2_ethdev.c +1 -1
index c1a0ae7763..88a0f9bdbb 100644
@@ -3669,7 +3669,7 @@ dpaa2_napi_subscribe(struct rte_eth_dev *dev, uint16_t queue_id,
 	/* pin this portal's MSI to the worker's core: a CDAN wake then lands on
 	 * the same core the worker sleeps on, instead of the default spread.
 	 */
-	dpaa2_dpio_affine_intr_to_core(dpio->hw_id);
+	dpaa2_dpio_affine_intr_to_core(dpio);
 	return 0;
 }
 
Signature · 1 line
2.43.0
#178 lore raw

PATCH 48/65 bus/fslmc: move Tx SG mempool to fslmc bus

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The scatter-gather mbuf pool used to build multi-segment Tx frames was a global owned by the dpaa2 net PMD (dpaa2_tx_sg_pool), created lazily on first probe and reference-counted with dpaa2_valid_dev. This tied a bus-wide resource to the net driver and duplicated primary/secondary lookup logic.

Create the SG pool once on the fslmc bus instead:

- Allocate "dpaa2_sg_pool" in rte_fslmc_probe() and free it in rte_fslmc_close(), storing the handle in fslmc_bus_info.mem_pool.
- Expose the pool sizing via DPAA2_TX_SG_POOL_SIZE, DPAA2_TX_SG_POOL_CACHE_SIZE and DPAA2_TX_SG_POOL_ELEM_SIZE in the bus driver header.

Update the net PMD to consume it:

- dpaa2_dev_init() takes the pool from the device's bus_info and

    stores it in priv->tx_sg_pool; dpaa2_dev_close() clears the
    reference.
  - Remove dpaa2_tx_sg_pool_init(), the dpaa2_tx_sg_pool /
    dpaa2_valid_dev globals, and the now-unused DPAA2_MAX_SGS,
    DPAA2_POOL_SIZE, DPAA2_POOL_CACHE_SIZE and struct sw_buf_free
    definitions.
  - Bound the SG receive walk by the pool element size instead of
    DPAA2_MAX_SGS.
---
 drivers/bus/fslmc/bus_fslmc_driver.h |  4 +++
 drivers/bus/fslmc/fslmc_bus.c        |  9 ++++++
 drivers/net/dpaa2/dpaa2_ethdev.c     | 44 ++--------------------------
 drivers/net/dpaa2/dpaa2_ethdev.h     | 20 ++-----------
 drivers/net/dpaa2/dpaa2_rxtx.c       |  9 +++---
 5 files changed, 22 insertions(+), 64 deletions(-)
drivers/bus/fslmc/bus_fslmc_driver.h +4 -0
index 3ba865e632..4d56da45b3 100644
@@ -89,6 +89,10 @@ enum rte_dpaa2_dev_type {
 	DPAA2_DEVTYPE_MAX,
 };
 
+#define DPAA2_TX_SG_POOL_SIZE 2048
+#define DPAA2_TX_SG_POOL_CACHE_SIZE 256
+#define DPAA2_TX_SG_POOL_ELEM_SIZE 2048
+
 struct rte_fslmc_bus_info {
 	void *mem_pool;
 	int sp_protocol;
drivers/bus/fslmc/fslmc_bus.c +9 -0
index a418f9a420..d20103ee36 100644
@@ -690,6 +690,10 @@ rte_fslmc_probe(struct rte_bus *bus)
 		return ret;
 	}
 
+	fslmc_bus_info.mem_pool = rte_pktmbuf_pool_create("dpaa2_sg_pool",
+		DPAA2_TX_SG_POOL_SIZE, DPAA2_TX_SG_POOL_CACHE_SIZE, 0,
+		DPAA2_TX_SG_POOL_ELEM_SIZE, rte_socket_id());
+
 	return rte_bus_generic_probe(bus);
 }
 
@@ -750,6 +754,11 @@ rte_fslmc_close(struct rte_bus *bus __rte_unused)
 {
 	int ret = 0;
 
+	if (fslmc_bus_info.mem_pool) {
+		rte_mempool_free(fslmc_bus_info.mem_pool);
+		fslmc_bus_info.mem_pool = NULL;
+	}
+
 	ret = fslmc_bus_close_group();
 	if (ret)
 		DPAA2_BUS_INFO("Unable to close devices %d", ret);
drivers/net/dpaa2/dpaa2_ethdev.c +2 -42

81 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.h +2 -18
index e4dc7b7e4f..91414114ac 100644
@@ -223,24 +223,6 @@
 #define DPAA2_MAC_STATS_INDEX_DMA_SIZE (DPAA2_MAC_NUM_STATS * sizeof(uint32_t))
 #define DPAA2_MAC_STATS_VALUE_DMA_SIZE (DPAA2_MAC_NUM_STATS * sizeof(uint64_t))
 
-/* Global pool used by driver for SG list TX */
-extern struct rte_mempool *dpaa2_tx_sg_pool;
-/* Maximum SG segments */
-#define DPAA2_MAX_SGS 128
-/* SG pool size */
-#define DPAA2_POOL_SIZE 2048
-/* SG pool cache size */
-#define DPAA2_POOL_CACHE_SIZE 256
-/* structure to free external and indirect
- * buffers.
- */
-struct sw_buf_free {
-	/* To which packet this segment belongs */
-	uint16_t pkt_id;
-	/* The actual segment */
-	struct rte_mbuf *seg;
-};
-
 /* Externally defined */
 extern const struct rte_flow_ops dpaa2_flow_ops;
 
@@ -478,6 +460,8 @@ struct dpaa2_dev_priv {
 	 */
 	union dpni_statistics pg_xstats[DPNI_MAX_STATISTICS_PAGE_ID][DPNI_STAT_MAX_PARAM];
 
+	struct rte_mempool *tx_sg_pool;
+
 	LIST_HEAD(, dpaa2_dev_flow) flows;
 	LIST_HEAD(, dpaa2_dev_meter_profile) profiles;
 	LIST_HEAD(, dpaa2_dev_meter_policy) policies;
drivers/net/dpaa2/dpaa2_rxtx.c +5 -4
index a44b991d1b..6d12e6818d 100644
@@ -456,7 +456,7 @@ dpaa2_eth_sg_fd_to_mbuf(struct dpaa2_dev_priv *priv, const struct qbman_fd *fd)
 		(void **)&first_seg, 1, 1);
 #endif
 	cur_seg = first_seg;
-	while (!DPAA2_SG_IS_FINAL(sge) && i < DPAA2_MAX_SGS) {
+	while (!DPAA2_SG_IS_FINAL(sge)) {
 		sge = &sgt[i++];
 		sg_addr = DPAA2_IOVA_TO_VADDR(DPAA2_GET_FLE_ADDR(sge));
 		next_seg = DPAA2_INLINE_MBUF_FROM_BUF(sg_addr,
@@ -746,6 +746,7 @@ dpaa2_dev_tx_mbuf_to_sg_fd(struct rte_mempool *hw_mp,
 	uint16_t nb_segs = mbuf->nb_segs;
 	uint32_t sg_size = nb_segs * sizeof(struct qbman_sge);
 	struct rte_mempool *mp;
+	struct dpaa2_dev_priv *priv = txq->eth_data->dev_private;
 
 	if (conf == DPAA2_TX_DYNAMIC_CONF) {
 		while (cur_seg) {
@@ -789,8 +790,8 @@ dpaa2_dev_tx_mbuf_to_sg_fd(struct rte_mempool *hw_mp,
 		DPAA2_SET_FD_OFFSET(fd, offset);
 	} else {
 		sg_mbuf = NULL;
-		if (dpaa2_tx_sg_pool)
-			sg_mbuf = rte_pktmbuf_alloc(dpaa2_tx_sg_pool);
+		if (priv->tx_sg_pool)
+			sg_mbuf = rte_pktmbuf_alloc(priv->tx_sg_pool);
 		if (!sg_mbuf) {
 			DPAA2_PMD_DP_DEBUG("No memory to allocate S/G table");
 			return -ENOMEM;
@@ -803,7 +804,7 @@ dpaa2_dev_tx_mbuf_to_sg_fd(struct rte_mempool *hw_mp,
 			DPAA2_SET_ONLY_FD_BPID(fd, MAX_BPID);
 			DPAA2_SET_FD_IVP(fd);
 		} else {
-			DPAA2_SET_ONLY_FD_BPID(fd, mempool_to_bpid(dpaa2_tx_sg_pool));
+			DPAA2_SET_ONLY_FD_BPID(fd, mempool_to_bpid(priv->tx_sg_pool));
 		}
 		DPAA2_SET_FD_OFFSET(fd, sg_mbuf->data_off);
 		offset = sg_mbuf->data_off;
Signature · 1 line
2.43.0
#179 lore raw

PATCH 49/65 net/dpaa2: move DPNI endpoint lookup out of the fslmc bus

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The fslmc bus scan was doing a DPNI-specific endpoint lookup for every DPAA2 device inside rte_dpaa2_create_dprc_device(): for each DPAA2_ETH object it issued dprc_get_connection(dpni.<id>) and stored the result (ep_dev_type / ep_object_id / ep_name) directly on the generic rte_dpaa2_device. This had several problems:

- It made the generic bus device carry DPNI-specific knowledge. Non-eth DPAA2 object types (DPCI, DPIO, DPSECI, DPDMAI, ...) that may also have endpoints never populated these fields, so the "endpoint" of any non-DPNI device was silently wrong.
- DPDMUX and DPSW endpoints are per-interface (identified by endpoint.if_id in addition to the object id), but the bus code only ever formatted "<type>.<id>" and dropped if_id, producing an ambiguous ep_name for those connection types.
- A dprc_get_connection() failure on any single DPNI aborted the whole DPRC scan and freed the dprc node, even if the failing DPNI was never going to be used by this process.
- It coupled the bus scan to the MC command set exposed by fsl_dprc.h, and forced every DPAA2 user of the bus to carry those symbols even if it did not care about endpoints.

Move the DPNI endpoint lookup where it belongs: into the DPAA2 net PMD, which is the only consumer today. The bus layer now just assigns each device to its parent DPRC container during the scan and lets each object driver decide whether (and how) to resolve its endpoint.

---
 drivers/bus/fslmc/bus_fslmc_driver.h     |  3 --
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c | 49 +++-----------------
 drivers/net/dpaa2/dpaa2_ethdev.c         | 59 +++++++++++++++++++++++-
 drivers/net/dpaa2/dpaa2_recycle.c        | 15 +++---
 4 files changed, 71 insertions(+), 55 deletions(-)
drivers/bus/fslmc/bus_fslmc_driver.h +0 -3
index 4d56da45b3..40c9ba0699 100644
@@ -108,10 +108,7 @@ struct rte_dpaa2_device {
 	struct rte_device device;           /**< Inherit core 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 */
 	struct dpaa2_dprc_dev *container;
-	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 */
 	char name[FSLMC_OBJECT_MAX_LEN];    /**< DPAA2 Object name*/
 	const struct rte_fslmc_bus_info *bus_info;
drivers/bus/fslmc/portal/dpaa2_hw_dprc.c +6 -43

63 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.c +58 -1

83 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_recycle.c +7 -8
index 48b531d847..4a693cfe04 100644
@@ -626,18 +626,18 @@ dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev)
 		return 0;
 	}
 
-	if (dpaa2_dev->ep_dev_type == DPAA2_MAC) {
+	if (priv->ep_dev_type == DPAA2_MAC) {
 		/** For dpmac-dpni connection,
 		 * try setting serdes loopback as recycle device at first.
 		 */
 		if (dpaa2_svr_family == SVR_LS2088A) {
-			ret = ls_serdes_eth_lpbk(dpaa2_dev->ep_object_id, 1);
+			ret = ls_serdes_eth_lpbk(priv->ep_object_id, 1);
 			if (!ret) {
 				priv->flags |= DPAA2_TX_SERDES_LOOPBACK_MODE;
 				return 0;
 			}
 		} else if (dpaa2_svr_family == SVR_LX2160A) {
-			ret = lx_serdes_eth_lpbk(dpaa2_dev->ep_object_id, 1);
+			ret = lx_serdes_eth_lpbk(priv->ep_object_id, 1);
 			if (!ret) {
 				priv->flags |= DPAA2_TX_SERDES_LOOPBACK_MODE;
 				return 0;
@@ -666,8 +666,8 @@ dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev)
 		return 0;
 	}
 
-	if (dpaa2_dev->ep_dev_type == DPAA2_ETH &&
-		dpaa2_dev->object_id == dpaa2_dev->ep_object_id) {
+	if (priv->ep_dev_type == DPAA2_ETH &&
+		dpaa2_dev->object_id == priv->ep_object_id) {
 		priv->flags |= DPAA2_TX_DPNI_LOOPBACK_MODE;
 
 		return 0;
@@ -680,7 +680,6 @@ int
 dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev)
 {
 	struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
-	struct rte_dpaa2_device *dpaa2_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *dpaa2_dev);
 	struct fsl_mc_io *dpni_dev = eth_dev->process_private;
 	struct dpni_port_cfg port_cfg;
 	int ret = 0;
@@ -690,7 +689,7 @@ dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev)
 
 	if (priv->flags & DPAA2_TX_SERDES_LOOPBACK_MODE) {
 		if (dpaa2_svr_family == SVR_LS2088A) {
-			ret = ls_serdes_eth_lpbk(dpaa2_dev->ep_object_id, 0);
+			ret = ls_serdes_eth_lpbk(priv->ep_object_id, 0);
 			if (ret) {
 				DPAA2_PMD_WARN("Error(%d) to disable Serdes loopback",
 					ret);
@@ -698,7 +697,7 @@ dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev)
 				priv->flags &= ~DPAA2_TX_SERDES_LOOPBACK_MODE;
 			}
 		} else if (dpaa2_svr_family == SVR_LX2160A) {
-			ret = lx_serdes_eth_lpbk(dpaa2_dev->ep_object_id, 0);
+			ret = lx_serdes_eth_lpbk(priv->ep_object_id, 0);
 			if (ret) {
 				DPAA2_PMD_WARN("Error(%d) to disable Serdes loopback",
 					ret);
Signature · 1 line
2.43.0
#180 lore raw

PATCH 50/65 net/dpaa2: add APIs to query device info and set default action

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Add experimental dpaa2 PMD APIs so applications can discover the device's classification resources and program the default (table-miss) action for the QoS and flow-steering tables.

- rte_pmd_dpaa2_dev_info_get(): return the generic rte_eth_dev_info plus dpaa2-specific resource counts (rx_tc_num, tx_tc_num, qos_entries, fs_entries, dist_queues) via struct rte_pmd_dpaa2_dev_info.

- rte_pmd_dpaa2_rx_queue_info_get(): return the generic rte_eth_rxq_info plus the queue's tc_id and flow_id via struct rte_pmd_dpaa2_rxq_info, so applications can map a queue to its TC/flow.

- rte_pmd_dpaa2_dev_configure_default_action(): set the per-TC default flow (or drop) for the FS tables and the default TC (or drop) for the QoS table via struct rte_pmd_dpaa2_default_action_conf, re-applying the table miss action for each affected table.

New symbols are exported as experimental.

---
 drivers/net/dpaa2/dpaa2_ethdev.c  | 104 ++++++++++++++++++++++++++++++
 drivers/net/dpaa2/rte_pmd_dpaa2.h |  36 +++++++++++
 2 files changed, 140 insertions(+)
drivers/net/dpaa2/dpaa2_ethdev.c +104 -0
index 572fcca91a..f00f906040 100644
@@ -1236,6 +1236,61 @@ dpaa2_dev_dcb_info(struct rte_eth_dev *dev,
 	return 0;
 }
 
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa2_dev_configure_default_action, 26.11)
+int
+rte_pmd_dpaa2_dev_configure_default_action(uint16_t port_id,
+	struct rte_pmd_dpaa2_default_action_conf *def_act_conf)
+{
+	int ret;
+	struct rte_eth_dev *dev;
+	struct dpaa2_dev_priv *priv;
+	struct dpaa2_flow_tbl_profile *tbl_profile;
+	uint16_t base, tc_index, default_flow;
+
+	if (!rte_pmd_dpaa2_dev_is_dpaa2(port_id))
+		return -EINVAL;
+
+	dev = &rte_eth_devices[port_id];
+	priv = dev->data->dev_private;
+
+	for (tc_index = 0; tc_index < priv->num_rx_tc; tc_index++) {
+		tbl_profile = &priv->flow_profile.tc_profile[tc_index];
+		base = priv->dist_queues * tc_index;
+		if (tc_index >= def_act_conf->max_tc)
+			break;
+		default_flow = def_act_conf->default_flows[tc_index];
+		if (default_flow >= priv->dist_queues) {
+			tbl_profile->default_drop = true;
+		} else {
+			tbl_profile->default_drop = false;
+			tbl_profile->default_queue.index = base + default_flow;
+		}
+		if (priv->fs_entries) {
+			ret = dpaa2_setup_table_miss_action(dev, tc_index);
+			if (ret) {
+				DPAA2_PMD_ERR("Error(%d) to set miss action of %s-tc%d table",
+					ret, dev->data->name, tc_index);
+				return ret;
+			}
+		}
+	}
+
+	tbl_profile = &priv->flow_profile.qos_profile;
+	if (def_act_conf->default_tc >= priv->num_rx_tc) {
+		tbl_profile->default_drop = true;
+	} else {
+		tbl_profile->default_drop = false;
+		tbl_profile->default_jump.group = def_act_conf->default_tc;
+	}
+	ret = dpaa2_setup_table_miss_action(dev, priv->num_rx_tc);
+	if (ret) {
+		DPAA2_PMD_ERR("Error(%d) to set miss action of %s-QoS table",
+			ret, dev->data->name);
+	}
+
+	return ret;
+}
+
 static int
 dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
 {
@@ -4300,6 +4355,55 @@ rte_pmd_dpaa2_ep_name(uint32_t eth_id)
 	return priv->ep_name;
 }
 
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa2_rx_queue_info_get, 25.11)
+int
+rte_pmd_dpaa2_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
+	struct rte_pmd_dpaa2_rxq_info *qinfo)
+{
+	int ret;
+	struct rte_eth_dev *dev;
+	struct dpaa2_queue *rxq;
+
+	if (!rte_pmd_dpaa2_dev_is_dpaa2(port_id))
+		return -EINVAL;
+
+	ret = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo->rxq_info);
+	if (ret)
+		return ret;
+	dev = &rte_eth_devices[port_id];
+	rxq = dev->data->rx_queues[queue_id];
+	qinfo->tc_id = rxq->tc_index;
+	qinfo->flow_id = rxq->flow_id;
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa2_dev_info_get, 25.11)
+int
+rte_pmd_dpaa2_dev_info_get(uint16_t port_id,
+	struct rte_pmd_dpaa2_dev_info *dev_info)
+{
+	int ret;
+	struct rte_eth_dev *dev;
+	struct dpaa2_dev_priv *priv;
+
+	if (!rte_pmd_dpaa2_dev_is_dpaa2(port_id))
+		return -EINVAL;
+
+	ret = rte_eth_dev_info_get(port_id, &dev_info->dev_info);
+	if (ret)
+		return ret;
+	dev = &rte_eth_devices[port_id];
+	priv = dev->data->dev_private;
+	dev_info->rx_tc_num = priv->num_rx_tc;
+	dev_info->tx_tc_num = priv->num_tx_tc;
+	dev_info->qos_entries = priv->qos_entries;
+	dev_info->fs_entries = priv->fs_entries;
+	dev_info->dist_queues = priv->dist_queues;
+
+	return 0;
+}
+
 static int
 rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,
 		struct rte_dpaa2_device *dpaa2_dev)
drivers/net/dpaa2/rte_pmd_dpaa2.h +36 -0
index 74b7e63c54..5a61a952bf 100644
@@ -167,6 +167,42 @@ uint16_t
 rte_dpaa2_dev_tx_multi_ports(uint16_t port_id[],
 	uint16_t txq_id[], struct rte_mbuf **bufs, uint16_t nb_pkts);
 
+struct rte_pmd_dpaa2_rxq_info {
+	struct rte_eth_rxq_info rxq_info;
+	uint8_t tc_id;
+	uint16_t flow_id;
+};
+
+__rte_experimental
+int
+rte_pmd_dpaa2_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
+	struct rte_pmd_dpaa2_rxq_info *qinfo);
+
+struct rte_pmd_dpaa2_dev_info {
+	struct rte_eth_dev_info dev_info;
+	uint8_t rx_tc_num;
+	uint8_t tx_tc_num;
+	uint16_t qos_entries;
+	uint16_t fs_entries;
+	uint16_t dist_queues;
+};
+
+__rte_experimental
+int
+rte_pmd_dpaa2_dev_info_get(uint16_t port_id,
+	struct rte_pmd_dpaa2_dev_info *dev_info);
+
+struct rte_pmd_dpaa2_default_action_conf {
+	uint8_t default_tc;
+	uint8_t max_tc;
+	uint16_t default_flows[];
+};
+
+__rte_experimental
+int
+rte_pmd_dpaa2_dev_configure_default_action(uint16_t port_id,
+	struct rte_pmd_dpaa2_default_action_conf *def_act_conf);
+
 #define RTE_DPAA2_EVENT_PORT_CFG_ATOMIC RTE_BIT32(31)
 
 /** RTE_DPAA2_MIX_GROUP_FLOW has same behavio as RTE_DPAA2_FLAT_GROUP_FLOW*/
Signature · 1 line
2.43.0
#181 lore raw

PATCH 51/65 net/dpaa2: consolidate dequeue paths and optimize fast path

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Unify the many duplicated QBMAN volatile-dequeue (VDQ) implementations in the dpaa2 PMD behind shared helpers and route every Rx-side path through a single prefetch/dequeue core, cutting duplicated code and trimming the per-packet work on the common forwarding configuration.

Shared dequeue helpers:
- Add dpaa2_dev_qbman_pull() to build a pull descriptor (channel or FQ) in one place, and dpaa2_dev_rx_active_dq_storage() (exported internal) to prime the first in-flight VDQ. Replace the open-coded pull-descriptor setup in the Rx, Tx-conf, loopback and event-scheduler paths with these helpers, removing the duplicated dpaa2_qbman_pull_desc_channel_set() in dpaa2_scheduler.c.

Rx fast path:
- Drive dpaa2_dev_prefetch_rx_common() / dpaa2_dev_rx_common() with function pointers (dpaa2_dev_rx_cb / dpaa2_dev_dq_prefetch) resolved once per burst instead of re-checking the SoC family, callback and parse/ timestamp conditions on every packet. On LX2160A the parser-result prefetch collapses to a no-op (dpaa2_dev_prefetch_next_psr_dummy).
- Split fd-to-mbuf so the common case uses the lightweight dpaa2_dev_rx_fd_to_mbuf_core(); the annotation prefetch, parse-offset, timestamp and parser-print steps are selected once per burst via dpaa2_dev_rx_fd_to_mbuf() only when actually enabled.
- Merge the channel (CDAN/interrupt) and non-channel (polling) burst routines; by_channel is derived from dpaa2_q->napi_dpcon. dpaa2_dev_rx_channel() / dpaa2_dev_prefetch_rx_channel(), their prototypes and the start-time rx_pkt_burst reassignment are removed.
- Rework the Rx error-dump as a callback (dpaa2_dev_err_rx_fd_to_mbuf) over the shared dequeue core with bulk free, replacing the standalone dpaa2_dev_rx_err_pkts_dump() open-coded VDQ loop.

Tx confirmation:
- Rewrite dpaa2_dev_tx_conf() on top of dpaa2_dev_prefetch_rx_common() with a dpaa2_dev_tx_cnf_fd_to_mbuf() callback, dropping its large open-coded VDQ loop. Add dpaa2_q->tx_queue back-reference so the conf callback can reach the originating Tx queue for 1588 timestamping.

Loopback:
- Rebuild dpaa2_dev_loopback_rx() on the shared dequeue core and qbman_swp_enqueue_multiple_desc(), removing another duplicated VDQ loop.

Inlining and locality:
- Force-inline the small hot helpers with __rte_always_inline and let the cold/slow paths (parse_slow, SG fd-to-mbuf, timestamp read, error dump) stay out of line to improve instruction-cache locality.
- Simplify the direct-mbuf Tx fast check and drop the redundant per-packet buf->next warning.

These changes remove a large amount of duplicated dequeue code and reduce per-packet work and branches on the common forwarding path.

---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h |   1 +
 drivers/event/dpaa2/dpaa2_scheduler.c   |  53 +-
 drivers/net/dpaa2/dpaa2_ethdev.c        |  44 +-
 drivers/net/dpaa2/dpaa2_ethdev.h        |  24 +-
 drivers/net/dpaa2/dpaa2_rxtx.c          | 879 +++++++++---------------
 5 files changed, 357 insertions(+), 644 deletions(-)
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +1 -0
index 95c7203aa2..3a92a1c0de 100644
@@ -200,6 +200,7 @@ struct __rte_cache_aligned dpaa2_queue {
 	struct dpaa2_bp_info *bp_array;
 	/*to store tx_conf_queue corresponding to tx_queue*/
 	struct dpaa2_queue *tx_conf_queue;
+	struct dpaa2_queue *tx_queue;
 	int32_t eventfd;	/*!< Event Fd of this queue */
 	uint16_t nb_desc;
 	uint16_t tm_sw_td;	/*!< TM software taildrop */
drivers/event/dpaa2/dpaa2_scheduler.c +7 -46

78 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.c +9 -35

91 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.h +20 -4
index 91414114ac..d1ddea7c64 100644
@@ -933,6 +933,26 @@ int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
 __rte_internal
 int dpaa2_eth_eventq_detach_by_rxq(struct dpaa2_queue *dpaa2_ethq);
 
+static __rte_always_inline void
+dpaa2_dev_qbman_pull(struct qbman_pull_desc *pulldesc, uint32_t id,
+	uint8_t numframes, struct qbman_result *v_storage, uint64_t p_storage,
+	bool by_channel, enum qbman_pull_type_e dct)
+{
+	qbman_pull_desc_clear(pulldesc);
+	qbman_pull_desc_set_numframes(pulldesc, numframes);
+	if (by_channel)
+		qbman_pull_desc_set_channel(pulldesc, id, dct);
+	else
+		qbman_pull_desc_set_fq(pulldesc, id);
+	qbman_pull_desc_set_storage(pulldesc, v_storage, p_storage, 1);
+}
+
+__rte_internal
+void
+dpaa2_dev_rx_active_dq_storage(struct queue_storage_info_t *q_storage,
+	struct dpaa2_dpio_dev *dpio, uint32_t id, uint32_t pull_size,
+	bool by_channel, enum qbman_pull_type_e dct);
+
 uint16_t dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 
 uint16_t dpaa2_dev_loopback_rx(void *queue, struct rte_mbuf **bufs,
@@ -940,10 +960,6 @@ uint16_t dpaa2_dev_loopback_rx(void *queue, struct rte_mbuf **bufs,
 
 uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs,
 			       uint16_t nb_pkts);
-uint16_t dpaa2_dev_prefetch_rx_channel(void *queue, struct rte_mbuf **bufs,
-				       uint16_t nb_pkts);
-uint16_t dpaa2_dev_rx_channel(void *queue, struct rte_mbuf **bufs,
-			      uint16_t nb_pkts);
 
 void dpaa2_dev_process_parallel_event(struct dpaa2_dpio_dev *dpio_dev,
 	const struct qbman_fd *fd, const struct qbman_result *dq,
drivers/net/dpaa2/dpaa2_rxtx.c +320 -559

1,160 lines not on this page · raw message

Signature · 1 line
2.43.0
#182 lore raw

PATCH 52/65 net/dpaa2: bind per-queue DPIO for rx-queue interrupts

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The DPAA2 rx-queue interrupt path never delivered a wakeup to the application. The per-queue wakeup eventfd was published into dev->intr_handle lazily, from inside the arm path (rx_queue_intr_enable), which only runs on the polling lcore just before it sleeps. The generic rte_eth_dev_rx_intr_ctl_q() flow, however, reads dev->intr_handle and registers the application epoll once at setup time, before any arm. It therefore registered an unset/stale fd and never saw the portal DQRI wake edge.

Fix the ordering by giving each napi rx queue its own dedicated DPIO (dpaa2_q->napi_dpio), allocated in dpaa2_dev_rx_queue_setup(), and publish that portal's eventfd into dev->intr_handle there - before the application registers its epoll. The one-shot CDAN enable and the in-flight VDQ quiesce stay in rx_queue_intr_enable()/disable(), which run on the polling lcore where q_storage[rte_lcore_id()] is valid; these must not move.

Because the queue now owns a fixed DPIO instead of borrowing the per-lcore ethrx portal, the rx burst paths (dpaa2_dev_prefetch_rx_common, dpaa2_dev_rx_common) pull on dpaa2_q->napi_dpio and re-affine it to the current lcore on migration. This removes the napi_sub_dpio atomic subscribe/re-home dance and the shared-portal ethrx_intr_refcnt bookkeeping.

The DPIO interrupt affinity, stashing and cpufreq-governor setup are consolidated into dpaa2_dpio_intr_thread_affinity()/_restore(), and rte_dpaa2_alloc_dpio_device() gains a build_epoll argument so the rx-queue intr path (application epoll) and the eventdev path (private epoll) can share one allocator. Internal-only helpers (intr_affinity_set, configure_stashing, cpufreq_governor, dpio_intr_init) are made static.

---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 156 ++++++++-------
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h |  23 +--
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h  |   3 +-
 drivers/event/dpaa2/dpaa2_eventdev.c     |  35 +---
 drivers/net/dpaa2/dpaa2_ethdev.c         | 234 +++++++++--------------
 drivers/net/dpaa2/dpaa2_rxtx.c           |  67 ++++---
 6 files changed, 234 insertions(+), 284 deletions(-)
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +85 -71
index 17af74aad8..a32406b1b3 100644
@@ -112,13 +112,13 @@ dpaa2_get_core_id(void)
 	return cpu_id;
 }
 
-RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_dpio_intr_affinity_set)
-int dpaa2_dpio_intr_affinity_set(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
+static int
+dpaa2_dpio_intr_affinity_set(struct dpaa2_dpio_dev *dpio_dev)
 {
 	char line[512], match[32], path[64];
 	FILE *fp;
 	long irq = -1;
-	int32_t dpio_id = dpio_dev->hw_id, ret = 0;
+	int32_t dpio_id = dpio_dev->hw_id, cpu_id = dpio_dev->cpu_affine, ret = 0;
 
 #define IRQ_ALL_F "/proc/interrupts"
 #define IRQ_SMP_AFFINITY_F "/proc/irq/%ld/smp_affinity_list"
@@ -200,22 +200,6 @@ int dpaa2_dpio_intr_affinity_set(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
 	return ret;
 }
 
-/* Pin the dpio's MSI IRQ to the calling lcore's core (best-effort), so a
- * worker sleeping on this portal's eventfd is woken on its own core.
- */
-RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_dpio_affine_intr_to_core)
-void
-dpaa2_dpio_affine_intr_to_core(struct dpaa2_dpio_dev *dpio_dev)
-{
-	int cpu_id = dpaa2_get_core_id(), ret;
-
-	if (cpu_id >= 0) {
-		ret = dpaa2_dpio_intr_affinity_set(dpio_dev, cpu_id);
-		if (ret)
-			DPAA2_BUS_ERR("Failed(%d) to affinity interrupt on core.%d", ret, cpu_id);
-	}
-}
-
 static int _dpaa2_dpio_cpufreq_governor(uint32_t cpu_id, bool restore)
 {
 	struct dpaa2_dpio_gov_save *gov;
@@ -283,8 +267,7 @@ static int _dpaa2_dpio_cpufreq_governor(uint32_t cpu_id, bool restore)
 	return ret;
 }
 
-RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_dpio_cpufreq_governor)
-int dpaa2_dpio_cpufreq_governor(int cpu_id, bool restore)
+static int dpaa2_dpio_cpufreq_governor(int cpu_id, bool restore)
 {
 	bool governor_all = cpu_id < 0 ? true : false;
 	int ret = 0;
@@ -305,14 +288,72 @@ int dpaa2_dpio_cpufreq_governor(int cpu_id, bool restore)
 	return ret;
 }
 
+static int
+dpaa2_dpio_configure_stashing(struct dpaa2_dpio_dev *dpio_dev)
+{
+	int sdest, ret;
+
+	/* Set the STASH Destination depending on Current CPU ID.
+	 * Valid values of SDEST are 4,5,6,7. Where,
+	 */
+	sdest = fslmc_vfio_core_cluster_sdest(dpio_dev->cpu_affine);
+	DPAA2_BUS_DEBUG("Portal= %d  CPU= %u SDEST= %d",
+		dpio_dev->index, dpio_dev->cpu_affine, sdest);
+	if (sdest < 0)
+		return sdest;
+
+	ret = dpio_set_stashing_destination(dpio_dev->dpio, CMD_PRI_LOW,
+		dpio_dev->token, sdest);
+	if (ret) {
+		DPAA2_BUS_ERR("Failed(%d) to set stashing(%02x) of dpio.%d/cpu.%d",
+		 ret, sdest, dpio_dev->hw_id, dpio_dev->cpu_affine);
+	}
+
+	return ret;
+}
+
+RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_dpio_intr_thread_affinity)
+void dpaa2_dpio_intr_thread_affinity(struct dpaa2_dpio_dev *dpio_dev)
+{
+	int ret;
+
+	ret = dpaa2_dpio_intr_affinity_set(dpio_dev);
+	if (ret) {
+		DPAA2_BUS_WARN("Failed(%d) to affinity dpio.%d's interrupt on core%d",
+			ret, dpio_dev->hw_id, dpio_dev->cpu_affine);
+	}
+	ret = dpaa2_dpio_configure_stashing(dpio_dev);
+	if (ret) {
+		DPAA2_BUS_WARN("Failed(%d) to configure dpio.%d's stashing on core%d",
+			ret, dpio_dev->hw_id, dpio_dev->cpu_affine);
+	};
+
+	ret = dpaa2_dpio_cpufreq_governor(dpio_dev->cpu_affine, false);
+	if (ret) {
+		DPAA2_BUS_WARN("Failed(%d) to set governor of core%d",
+			ret, dpio_dev->cpu_affine);
+	}
+}
+
+RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_dpio_intr_thread_restore)
+void dpaa2_dpio_intr_thread_restore(struct dpaa2_dpio_dev *dpio_dev)
+{
+	int ret, cpu_id = dpio_dev ? dpio_dev->cpu_affine : -1;
+
+	ret = dpaa2_dpio_cpufreq_governor(cpu_id, true);
+	if (ret) {
+		DPAA2_BUS_WARN("Failed(%d) to restore governor of core%d",
+			ret, cpu_id);
+	}
+}
+
 /* threshold: DQRR fill raising DQRI (< ring depth); timeout: holdoff in ITP units.
  * Per-mode values from the caller (eventdev vs rx-queue intr).
  * The DQRI config is portal-wide and this is idempotent: the first caller to
  * arm a portal wins, a later caller's values are ignored (a portal normally
  * serves a single mode).
  */
-RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_dpio_intr_init)
-int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int threshold,
+static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int threshold,
 	int timeout, bool build_epoll)
 {
 	int eventfd, dpio_epoll_fd, ret, index;
@@ -412,30 +453,6 @@ void dpaa2_dpio_intr_deinit(struct dpaa2_dpio_dev *dpio_dev)
 	dpio_dev->intr_enabled = false;
 }
 
-RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_dpio_configure_stashing)
-int
-dpaa2_dpio_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
-{
-	int sdest, ret;
-
-	/* Set the STASH Destination depending on Current CPU ID.
-	 * Valid values of SDEST are 4,5,6,7. Where,
-	 */
-	sdest = fslmc_vfio_core_cluster_sdest(cpu_id);
-	DPAA2_BUS_DEBUG("Portal= %d  CPU= %u SDEST= %d", dpio_dev->index, cpu_id, sdest);
-	if (sdest < 0)
-		return sdest;
-
-	ret = dpio_set_stashing_destination(dpio_dev->dpio, CMD_PRI_LOW,
-		dpio_dev->token, sdest);
-	if (ret) {
-		DPAA2_BUS_ERR("Failed(%d) to set stashing(%02x) of dpio.%d/cpu.%d",
-		 ret, sdest, dpio_dev->hw_id, cpu_id);
-	}
-
-	return ret;
-}
-
 static void dpaa2_put_qbman_swp(struct dpaa2_dpio_dev *dpio_dev)
 {
 	if (dpio_dev) {
@@ -454,28 +471,29 @@ static void dpaa2_put_qbman_swp(struct dpaa2_dpio_dev *dpio_dev)
 	}
 }
 
-static struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(bool ethrx)
+static struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(void)
 {
 	struct dpaa2_dpio_dev *dpio_dev;
 	/* Set the Stashing Destination */
 	int cpu_id = dpaa2_get_core_id(), ret;
 
-	dpio_dev = rte_dpaa2_alloc_dpio_device((ethrx && cpu_id >= 0) ?
-		true : false, DPAA2_PORTAL_INTR_COALESC_DISABLE, cpu_id);
+	dpio_dev = rte_dpaa2_alloc_dpio_device(false, DPAA2_PORTAL_INTR_COALESC_DISABLE,
+		cpu_id, false);
 	if (!dpio_dev) {
 		DPAA2_BUS_ERR("No software portal resource left");
 		return NULL;
 	}
 
 	DPAA2_BUS_DEBUG("New Portal %p (%d) affined thread - %u",
-			dpio_dev, dpio_dev->index, rte_gettid());
+		dpio_dev, dpio_dev->index, rte_gettid());
 
+	dpio_dev->cpu_affine = cpu_id;
 	if (cpu_id < 0) {
 		DPAA2_BUS_WARN("Thread not affined to a single core");
 		if (dpaa2_svr_family != SVR_LX2160A)
 			qbman_swp_update(dpio_dev->sw_portal, 1);
 	} else {
-		ret = dpaa2_dpio_configure_stashing(dpio_dev, cpu_id);
+		ret = dpaa2_dpio_configure_stashing(dpio_dev);
 		if (ret) {
 			DPAA2_BUS_ERR("Failed(%d) to configure stashing", ret);
 			rte_atomic_store_explicit(&dpio_dev->ref_count, 0,
@@ -483,7 +501,6 @@ static struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(bool ethrx)
 			return NULL;
 		}
 	}
-	dpio_dev->cpu_affine = cpu_id;
 
 	ret = pthread_setspecific(dpaa2_portal_key, (void *)dpio_dev);
 	if (ret) {
@@ -504,10 +521,10 @@ dpaa2_affine_qbman_swp(void)
 
 	/* Populate the dpaa2_io_portal structure */
 	if (!RTE_PER_LCORE(_dpaa2_io).dpio_dev) {
-		dpio_dev = dpaa2_get_qbman_swp(false);
+		dpio_dev = dpaa2_get_qbman_swp();
 		if (!dpio_dev) {
 			DPAA2_BUS_ERR("Error in software portal allocation");
-			return -1;
+			return -ENODEV;
 		}
 		RTE_PER_LCORE(_dpaa2_io).dpio_dev = dpio_dev;
 
@@ -526,10 +543,10 @@ dpaa2_affine_qbman_ethrx_swp(void)
 
 	/* Populate the dpaa2_io_portal structure */
 	if (!RTE_PER_LCORE(_dpaa2_io).ethrx_dpio_dev) {
-		dpio_dev = dpaa2_get_qbman_swp(true);
+		dpio_dev = dpaa2_get_qbman_swp();
 		if (!dpio_dev) {
 			DPAA2_BUS_ERR("Error in software portal allocation");
-			return -1;
+			return -ENODEV;
 		}
 		RTE_PER_LCORE(_dpaa2_io).ethrx_dpio_dev = dpio_dev;
 
@@ -551,13 +568,12 @@ static void dpaa2_portal_finish(void *arg)
 
 RTE_EXPORT_INTERNAL_SYMBOL(rte_dpaa2_alloc_dpio_device)
 struct dpaa2_dpio_dev *
-rte_dpaa2_alloc_dpio_device(int isr, uint32_t threshold, int32_t cpu_affine)
+rte_dpaa2_alloc_dpio_device(int isr, uint32_t threshold,
+	int32_t cpu_affine, bool build_epoll)
 {
 	struct dpaa2_dpio_dev *dpio_dev = NULL;
-#ifdef RTE_EVENT_DPAA2
 	int ret, timeout = 0xff;
 	char *env;
-#endif
 	uint16_t expected = 0;
 
 	/* Get DPIO dev handle from list using index */
@@ -571,7 +587,9 @@ rte_dpaa2_alloc_dpio_device(int isr, uint32_t threshold, int32_t cpu_affine)
 		DPAA2_BUS_ERR("No software portal resource left");
 		return NULL;
 	}
- #ifdef RTE_EVENT_DPAA2
+
+	dpio_dev->cpu_affine = cpu_affine;
+
 	if (!isr)
 		goto quit;
 	env = getenv("DPAA2_PORTAL_INTR_THRESHOLD");
@@ -580,28 +598,24 @@ rte_dpaa2_alloc_dpio_device(int isr, uint32_t threshold, int32_t cpu_affine)
 	if (threshold > DPAA2_PORTAL_INTR_THRESH_MAX) {
 		DPAA2_BUS_ERR("Invalid threshold(%d) from %s",
 			threshold, env ? "environment" : "parameter");
-			threshold = DPAA2_PORTAL_INTR_COALESC_DISABLE;
+		threshold = DPAA2_PORTAL_INTR_COALESC_DISABLE;
 	}
 	env = getenv("DPAA2_PORTAL_INTR_TIMEOUT");
 	if (env)
 		sscanf(env, "%x", &timeout);
-	ret = dpaa2_dpio_intr_init(dpio_dev, threshold, timeout, true);
+	ret = dpaa2_dpio_intr_init(dpio_dev, threshold, timeout, build_epoll);
 	if (ret) {
 		DPAA2_BUS_ERR("Failed(%d) to init DPIO interrupt", ret);
 		rte_atomic_store_explicit(&dpio_dev->ref_count, 0,
 			rte_memory_order_release);
+		dpio_dev->cpu_affine = -1;
 		return NULL;
 	}
-	if (cpu_affine >= 0)
-		dpaa2_dpio_intr_affinity_set(dpio_dev, cpu_affine);
-quit:
-#else
-	RTE_SET_USED(isr);
-	RTE_SET_USED(threshold);
-#endif
 
-	dpio_dev->cpu_affine = cpu_affine;
+	if (dpio_dev->cpu_affine >= 0)
+		dpaa2_dpio_intr_affinity_set(dpio_dev);
 
+quit:
 	return dpio_dev;
 }
 
drivers/bus/fslmc/portal/dpaa2_hw_dpio.h +6 -17
index 7c089408c5..c61f8ee0a2 100644
@@ -38,14 +38,11 @@ RTE_DECLARE_PER_LCORE(struct dpaa2_io_portal_t, _dpaa2_io);
 #define DPAA2_PER_LCORE_DQRR_MBUF(i) \
 	RTE_PER_LCORE(_dpaa2_io).dpio_dev->dpaa2_held_bufs.mbuf[i]
 
-__rte_internal int
-dpaa2_dpio_intr_affinity_set(struct dpaa2_dpio_dev *dpio_dev, int cpu_id);
+__rte_internal void
+dpaa2_dpio_intr_thread_affinity(struct dpaa2_dpio_dev *dpio_dev);
 
-__rte_internal int
-dpaa2_dpio_cpufreq_governor(int cpu_id, bool restore);
-
-__rte_internal int
-dpaa2_dpio_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id);
+__rte_internal void
+dpaa2_dpio_intr_thread_restore(struct dpaa2_dpio_dev *dpio_dev);
 
 /* Affine a DPIO portal to current processing thread */
 __rte_internal
@@ -55,18 +52,9 @@ int dpaa2_affine_qbman_swp(void);
 __rte_internal
 int dpaa2_affine_qbman_ethrx_swp(void);
 
-/* set up / tear down a DPIO portal's DQRI interrupt (rx-queue interrupt mode) */
-__rte_internal
-int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int threshold,
-			 int timeout, bool build_epoll);
-
 __rte_internal
 void dpaa2_dpio_intr_deinit(struct dpaa2_dpio_dev *dpio_dev);
 
-/* pin a DPIO's MSI IRQ to the calling lcore's core (rx-queue interrupt mode) */
-__rte_internal
-void dpaa2_dpio_affine_intr_to_core(struct dpaa2_dpio_dev *dpio_dev);
-
 /* allocate memory for FQ - dq storage */
 __rte_internal
 int
@@ -84,7 +72,8 @@ dpaa2_free_eq_descriptors(void);
 
 __rte_internal
 struct dpaa2_dpio_dev *
-rte_dpaa2_alloc_dpio_device(int isr, uint32_t threshold, int32_t cpu_affine);
+rte_dpaa2_alloc_dpio_device(int isr, uint32_t threshold,
+	int32_t cpu_affine, bool build_epoll);
 
 __rte_internal
 void
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +1 -2
index 3a92a1c0de..1731999257 100644
@@ -139,7 +139,6 @@ struct dpaa2_dpio_dev {
 	int32_t hw_id; /**< An unique ID of this DPIO device instance */
 	uint8_t intr_enabled; /**< DQRI portal interrupt already set up */
 	int32_t cpu_affine;
-	uint16_t ethrx_intr_refcnt; /**< rx queues currently armed on this portal */
 	struct dpaa2_portal_dqrr dpaa2_held_bufs;
 };
 
@@ -213,7 +212,7 @@ struct __rte_cache_aligned dpaa2_queue {
 	 * its ethrx portal, arms the DQRI, and drains by channel volatile pull.
 	 */
 	struct dpaa2_dpcon_dev *napi_dpcon;	/*!< notif channel, NULL = napi off */
-	RTE_ATOMIC(struct dpaa2_dpio_dev *) napi_sub_dpio;	/*!< subscribed portal or NULL */
+	struct dpaa2_dpio_dev *napi_dpio;
 	uint8_t napi_armed;			/*!< this queue requests DQRI wakeups */
 };
 
drivers/event/dpaa2/dpaa2_eventdev.c +10 -25
index ad80fd51f5..01c71fc0d2 100644
@@ -88,7 +88,7 @@ static __rte_always_inline struct dpaa2_dpio_dev *
 dpaa2_event_portal_io_prepare(struct dpaa2_port *dpaa2_portal)
 {
 	struct dpaa2_dpio_dev *dpio_dev;
-	int ret, cpu = rte_lcore_id();
+	int cpu = rte_lcore_id();
 
 	if (unlikely(!dpaa2_portal->dpio_dev)) {
 		DPAA2_EVENTDEV_ERR("Event port%d not setup", dpaa2_portal->port_id);
@@ -111,19 +111,7 @@ dpaa2_event_portal_io_prepare(struct dpaa2_port *dpaa2_portal)
 		DPAA2_EVENTDEV_DEBUG("Event port%d affine CPU from %d->%d",
 			dpaa2_portal->port_id, dpio_dev->cpu_affine, cpu);
 		dpio_dev->cpu_affine = cpu;
-		ret = dpaa2_dpio_intr_affinity_set(dpio_dev, cpu);
-		if (ret) {
-			DPAA2_EVENTDEV_ERR("Failed(%d) to affinity dpio.%d's interrupt on core%d",
-				ret, dpio_dev->hw_id, cpu);
-		}
-		ret = dpaa2_dpio_cpufreq_governor(cpu, false);
-		if (ret)
-			DPAA2_EVENTDEV_WARN("Failed(%d) to set governor of core%d", ret, cpu);
-		ret = dpaa2_dpio_configure_stashing(dpio_dev, cpu);
-		if (ret) {
-			DPAA2_EVENTDEV_WARN("Failed(%d) to configure dpio.%d's stashing on core%d",
-				ret, dpio_dev->hw_id, cpu);
-		}
+		dpaa2_dpio_intr_thread_affinity(dpio_dev);
 	}
 
 	return dpio_dev;
@@ -527,8 +515,14 @@ dpaa2_eventdev_port_release(void *port)
 		}
 	}
 
-	if (portal->dpio_dev)
+	if (portal->dpio_dev) {
+		/*
+		 * Restore CPU-frequency governor that the optional first-touch
+		 * binding on this DPIO may have forced.
+		 */
+		dpaa2_dpio_intr_thread_restore(portal->dpio_dev);
 		rte_dpaa2_free_dpio_device(portal->dpio_dev);
+	}
 
 	rte_free(portal);
 	if (eventdev)
@@ -602,15 +596,6 @@ dpaa2_eventdev_close(struct rte_eventdev *dev)
 			dpaa2_eventdev_port_release(dev->data->ports[i]);
 	}
 
-	/*
-	 * Restore any CPU-frequency governor that the optional first-touch
-	 * binding may have forced (see dpaa2_dpio_cpufreq_governor(cpu, false)).
-	 * Best-effort and a no-op when the governor was never touched.
-	 */
-	ret = dpaa2_dpio_cpufreq_governor(-1, true);
-	if (ret)
-		DPAA2_EVENTDEV_ERR("Failed(%d) to restore all cpus' governors", ret);
-
 	ret = dpaa2_eventdev_eth_queue_del(dev, NULL, -1);
 	if (!ret)
 		priv->status = DPAA2_EVENTDEV_CREATED;
@@ -880,7 +865,7 @@ dpaa2_eventdev_port_setup(struct rte_eventdev *dev, uint8_t port_id,
 	}
 
 	portal->dpio_dev = rte_dpaa2_alloc_dpio_device(true,
-		DPAA2_PORTAL_INTR_COALESC_DISABLE, -1);
+		DPAA2_PORTAL_INTR_COALESC_DISABLE, -1, true);
 	if (!portal->dpio_dev) {
 		rte_free(portal);
 		return -ENODEV;
drivers/net/dpaa2/dpaa2_ethdev.c +95 -139

350 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_rxtx.c +37 -30

129 lines not on this page · raw message

Signature · 1 line
2.43.0
#183 lore raw

Re: [PATCH v4-S3 52/65] net/dpaa2: bind per-queue DPIO for rx-queue interrupts

Hi Jun,

This patch and 47/65 are not in v5-S3. These comments are for when they come back. I only read the code, I did not run v4-S3 on LX2160A.

My three main concerns:
1. the PMD changes the CPU frequency governor;
2. the Rx burst uses the lcore id as a Linux CPU number;
3. one DPIO per Rx queue is expensive.

Details below.

Quoted 5 lines · Prashant Gupta

From: Jun Yang <[email protected]>

The DPAA2 rx-queue interrupt path never delivered a wakeup to the application.

This is not correct. The current code works if the application calls rte_eth_dev_rx_intr_enable() before rte_eth_dev_rx_intr_ctl_q(). This order is documented in dpaa2.rst, and grout uses it.

l3fwd-power calls them in the other order, so it does not work. I sent a series to fix l3fwd-power:
https://mails.dpdk.org/archives/dev/2026-September/345474.html

Please reword the commit message. Also, what does a DPIO per queue bring, once l3fwd-power is fixed?

[...]

Quoted 7 lines
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +7 -0
+RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_dpio_intr_thread_affinity)
+void dpaa2_dpio_intr_thread_affinity(struct dpaa2_dpio_dev *dpio_dev)
+{
+       int ret;
+
+       ret = dpaa2_dpio_intr_affinity_set(dpio_dev);
+       if (ret) {

drivers/bus/fslmc/portal/dpaa2_hw_dpio.c int dpaa2_dpio_cpufreq_governor(int cpu_id, bool restore) · line 331

Quoted 10 lines
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +10 -0
+               DPAA2_BUS_WARN("Failed(%d) to affinity dpio.%d's interrupt on core%d",
+                       ret, dpio_dev->hw_id, dpio_dev->cpu_affine);
+       }
+       ret = dpaa2_dpio_configure_stashing(dpio_dev);
+       if (ret) {
+               DPAA2_BUS_WARN("Failed(%d) to configure dpio.%d's stashing on core%d",
+                       ret, dpio_dev->hw_id, dpio_dev->cpu_affine);
+       };
+
+       ret = dpaa2_dpio_cpufreq_governor(dpio_dev->cpu_affine, false);

Please remove the governor change. The power policy belongs to the application, not to the PMD.

grout uses the schedutil governor. The CPU runs fast while the worker polls, and slows down while the worker sleeps on the Rx interrupt. If the PMD forces "performance", the CPU never slows down, and Rx interrupts save no power.

The restore is also wrong in three cases:
- Two ports are polled by the same lcore. Closing the first port restores the governor, but the second port is still running.
- A queue moves from CPU A to CPU B. Only B is restored. A stays in "performance".
- A queue was set up but never polled. Its cpu_affine is still -1, so the restore applies to all CPUs.

[...]

Quoted 23 lines
drivers/net/dpaa2/dpaa2_ethdev.c +4 -10
@@ -1579,17 +1582,11 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
        dpaa2_q->bp_array = rte_dpaa2_bpid_info;
        dpaa2_q->offloads = rx_conf->offloads;
 
-       /* NAPI: grab a DPCON channel so dev_start can bind this FQ statically.
-        * The DQRR burst replaces the poll path for every queue at once, so a
-        * missing channel is fatal rather than a silent per-queue fallback.
-        */
-       rte_atomic_store_explicit(&dpaa2_q->napi_sub_dpio, NULL,
-                       rte_memory_order_release);
-       if (dev->data->dev_conf.intr_conf.rxq && !dpaa2_q->napi_dpcon) {
-               dpaa2_q->napi_dpcon = rte_dpaa2_alloc_dpcon_dev();
+       if (dev->data->dev_conf.intr_conf.rxq) {
+               if (!dpaa2_q->napi_dpcon)
+                       dpaa2_q->napi_dpcon = rte_dpaa2_alloc_dpcon_dev();
                if (!dpaa2_q->napi_dpcon) {
-                       DPAA2_PMD_ERR("rxq %d: no DPCON for rx-queue interrupts",
-                               rx_queue_id);
+                       DPAA2_PMD_ERR("rxq %d: no DPCON for rx-queue interrupts", rx_queue_id);
                        ret = -ENODEV;
                        goto err_quit;
                }

drivers/net/dpaa2/dpaa2_ethdev.c dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev, · line 1602

Quoted 6 lines
drivers/net/dpaa2/dpaa2_ethdev.c +3 -0
@@ -1600,6 +1597,27 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
                        DPAA2_PMD_ERR("rxq %d: dpcon_enable: %d", rx_queue_id, ret);
                        goto err_quit;
                }
+               if (!dpaa2_q->napi_dpio) {
+                       dpaa2_q->napi_dpio = rte_dpaa2_alloc_dpio_device(true,
+                               DPAA2_PORTAL_INTR_COALESC_DISABLE, -1, false);

Each Rx queue now takes its own DPIO.

For example, with 12 workers, each polling one Rx queue per port:
- before this patch: 12 DPIOs for Rx (one per worker, shared by all its queues)
- with this patch: 24 DPIOs for Rx with 2 ports, 48 with 4 ports

How many DPIOs can each SoC provide (LX2160A, LS2088A, LS1088A)?

[...]

drivers/net/dpaa2/dpaa2_ethdev.c dpaa2_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) · line 3717

Quoted 13 lines
drivers/net/dpaa2/dpaa2_ethdev.c +0 -7
@@ -3706,74 +3699,42 @@ dpaa2_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 {
        struct dpaa2_dev_priv *priv = dev->data->dev_private;
        struct dpaa2_queue *dpaa2_q = priv->rx_vq[queue_id];
-       struct dpaa2_dpio_dev *dpio, *old;
        int ret;
 
-       /* the generic API has no dev_started guard (unlike the burst dummy ops),
-        * so it can reach us after a stop; do not arm a stopped port, let the
-        * caller fall back to polling.
-        */
-       if (!dev->data->dev_started)
-               return -EIO;

Why is this check removed?

The ethdev layer does not check that the port is started, so the driver now arms a queue on a stopped port.

Quoted 20 lines
drivers/net/dpaa2/dpaa2_ethdev.c +4 -12
-       if (!dpaa2_q->napi_dpcon)
-               return -ENOTSUP;        /* no channel -> caller keeps polling */
-
-       if (dpaa2_affine_qbman_ethrx_swp())
-               return -EIO;
-       dpio = DPAA2_PER_LCORE_ETHRX_DPIO;
+       if (dpaa2_q->napi_armed)
+               return 0;
 
-       old = rte_atomic_load_explicit(&dpaa2_q->napi_sub_dpio, rte_memory_order_acquire);
-       if (old && old != dpio && dpaa2_q->napi_armed) {
-               DPAA2_PMD_ERR("rxq %d still armed on another portal; disable it first",
-                             queue_id);
-               return -EBUSY;
-       }
+       if (!dpaa2_q->napi_dpcon || !dpaa2_q->napi_dpio)
+               return -ENOTSUP;
 
        ret = dpaa2_napi_quiesce_vdq(dpaa2_q);
        if (ret)

drivers/net/dpaa2/dpaa2_ethdev.c dpaa2_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) · line 3714

Quoted 10 lines
drivers/net/dpaa2/dpaa2_ethdev.c +2 -7
-               return ret;
+               goto err_quit;
 
-       /* holdoff 0: the DQRI fires immediately on the first entry, so the
-        * threshold is moot (1 here). build_epoll=false: the generic rx-intr API
-        * waits on the application epoll, not the portal's private one. Idempotent
-        * per dpio.
-        */
-       ret = dpaa2_dpio_intr_init(dpio, 1, 0, false);
+       ret = dpaa2_napi_subscribe(dev, queue_id, dpaa2_q->napi_dpio);

Before this patch, dpaa2_napi_subscribe() was called only when the portal changed.
Now it is called every time the queue is armed, so every time the worker goes to sleep.

Each call sends an MC command (dpcon_set_notification()).

The DPIO never changes now. Please call it once, in rx_queue_setup().

[...]

Quoted 22 lines
drivers/net/dpaa2/dpaa2_rxtx.c +3 -2
index 0df758148c..efaa862623 100644
@@ -963,7 +963,7 @@ dpaa2_dev_prefetch_rx_common(struct dpaa2_queue *dpaa2_q,
 {
        /* Function receive frames for a given device and VQ*/
        struct qbman_result *dq_storage, *dq_storage1 = NULL;
-       int ret, num_rx = 0;
+       int ret, num_rx = 0, cpu = rte_lcore_id();
        bool by_channel = dpaa2_q->napi_dpcon ? true : false;
        uint32_t id, pull_size;
        uint8_t pending, status;
@@ -971,26 +971,36 @@ dpaa2_dev_prefetch_rx_common(struct dpaa2_queue *dpaa2_q,
        const struct qbman_fd *fd;
        struct qbman_pull_desc pulldesc;
        struct queue_storage_info_t *q_storage;
+       struct dpaa2_dpio_dev *dpio;
 
-       q_storage = dpaa2_q->q_storage[rte_lcore_id()];
+       q_storage = dpaa2_q->q_storage[cpu];
 

drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_prefetch_rx_common(struct dpaa2_queue *dpaa2_q, · line 982

Quoted 10 lines
drivers/net/dpaa2/dpaa2_rxtx.c +5 -5
-       if (unlikely(!DPAA2_PER_LCORE_ETHRX_DPIO)) {
-               ret = dpaa2_affine_qbman_ethrx_swp();
-               if (ret) {
-                       DPAA2_PMD_ERR("Failure in affining portal");
-                       return 0;
+       if (dpaa2_q->napi_dpio) {
+               dpio = dpaa2_q->napi_dpio;
+               if (unlikely(dpio->cpu_affine != cpu)) {
+                       dpio->cpu_affine = cpu;
+                       dpaa2_dpio_intr_thread_affinity(dpio);

Two problems here.

First, "cpu" is a DPDK lcore id, not a Linux CPU number. They are equal only with the default mapping. They differ with --lcores, and for threads created with rte_thread_register(), like grout workers. In that case the IRQ affinity, the stashing destination and the governor are set for the wrong CPU. Please use dpaa2_get_core_id(), as the removed dpaa2_dpio_affine_intr_to_core() did.

Second, this runs inside rte_eth_rx_burst(). cpu_affine starts at -1, so it runs on the first burst of every queue, and again each time the queue moves. It reads /proc/interrupts, writes /proc/irq/N/smp_affinity_list and sends an MC command.

Proposal:
- set the IRQ affinity in dpaa2_dev_rx_queue_intr_enable(). It runs on the polling lcore, just before the worker sleeps.
- keep only the stashing update in the burst.

Quoted 17 lines
drivers/net/dpaa2/dpaa2_rxtx.c +10 -1
                }
+       } else {
+               if (unlikely(!DPAA2_PER_LCORE_ETHRX_DPIO)) {
+                       ret = dpaa2_affine_qbman_ethrx_swp();
+                       if (ret) {
+                               DPAA2_PMD_ERR("Failure in affining portal");
+                               return 0;
+                       }
+               }
+               dpio = DPAA2_PER_LCORE_ETHRX_DPIO;
        }
+       swp = dpio->sw_portal;
 
-       swp = DPAA2_PER_LCORE_ETHRX_PORTAL;
        if (dpaa2_q->napi_dpcon)
                id = dpaa2_q->napi_dpcon->qbman_ch_id;
        else

drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_prefetch_rx_common(struct dpaa2_queue *dpaa2_q, · line 1006

Quoted 10 lines
drivers/net/dpaa2/dpaa2_rxtx.c +2 -2
                id = dpaa2_q->fqid;
        pull_size = (nb_pkts > dpaa2_dqrr_size) ? dpaa2_dqrr_size : nb_pkts;
        if (unlikely(!q_storage->active_dqs)) {
-               dpaa2_dev_rx_active_dq_storage(q_storage, DPAA2_PER_LCORE_ETHRX_DPIO,
-                       id, pull_size, by_channel, qbman_pull_type_active);
+               dpaa2_dev_rx_active_dq_storage(q_storage, dpio, id, pull_size,
+                       by_channel, qbman_pull_type_active);
        }
 
        dq_storage = q_storage->active_dqs;

The DPIO never changes now. Please call it once, in rx_queue_setup().The DPIO never changes now. Please call it once, in rx_queue_setup().The DPIO never changes now. Please call it once, in rx_queue_setup().A question about queue migration. grout moves a queue from one worker
to another without stopping the port.

When the queue moves from lcore A to lcore B, the DPIO follows the queue, but q_storage is still per lcore. If A left a VDQ in flight, its frames stay in q_storage[A]. B waits for that VDQ to complete, then pulls into q_storage[B]. It never reads the frames in q_storage[A].

This is not new: q_storage is already per lcore in 26.07, and the only cleanup, dpaa2_clear_queue_active_dps(), runs at close and does not read the frames. But now that the DPIO belongs to the queue, q_storage could belong to the queue too. Then B would simply read the frames left by A. What do you think?

Last point: dpaa2.rst and the comments in dpaa2_dev_rx_queue_intr_enable()/disable() still describe the old model (shared per-lcore portal, fd bound when the queue is armed, sibling queues).

dpaa2.rst should also say that each Rx queue needs a DPIO, not only a DPCON.

Thanks,

Maxime

A message that is not in the archive (sent off-list or not yet received): GV2PR04MB123398AD7216CC632B43241669D7F2@GV2PR04MB12339.eurprd04.prod.outlook.com

A message that is not in the archive (sent off-list or not yet received): CAHHRULUFMOw1t0JzvisNd+Hj4E6ouhnX0t7DCFZO=bYYWEHc_g@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): PATP264MB73393C059AD64FE5E74BA2AAFC792@PATP264MB7339.FRAP264.PROD.OUTLOOK.COM

A message that is not in the archive (sent off-list or not yet received): GV2PR04MB12339E0891ED89B43E9F488EE9D792@GV2PR04MB12339.eurprd04.prod.outlook.com

#188 lore raw

RE: [EXT] Re: [PATCH v4-S3 52/65] net/dpaa2: bind per-queue DPIO for rx-queue interrupts

[email protected]

NXP Confidential
From: Jun Yang
Sent: Thursday, November 19, 2026 6:35 PM
To: Vincent JARDIN <[email protected]>; Maxime Leroy <[email protected]>
Cc: Prashant Gupta <[email protected]>; Hemant Agrawal <[email protected]>; Francois Massot-Pellet <[email protected]>
Subject: RE: [EXT] Re: [PATCH v4-S3 52/65] net/dpaa2: bind per-queue DPIO for rx-queue interrupts

Hi Maxime,
Thanks for your feedback.
The previously posted patch series is currently being reworked. We have received a significant amount of feedback from the community. Some comments point out logical issues within the patches themselves, some identify rework or overlap between patches, and others suggest improvements to the code structure. In addition, we have found several issues through our internal reviews and testing. As a result, we plan to resend the series, with some patches reordered, revised, or superseded by updated versions. I will notify you in advance of re-sending to dpdk. Now let me reply to the questions you raised:

1. The PMD changes the CPU frequency governor

I will look for a better solution to reduce the core wake-up latency and will drop this patch for now. Some customers have raised concerns about the wake-up time.

1. The Rx burst uses the lcore ID as a Linux CPU number.

This is a valid issue, and I have already worked out a solution locally.

1. The implementation also drains any frames being pulled on the previous core before continuing processing on the new one.

This has been worked out and will share you patches in advance of upstreaming.

1. One DPIO per Rx queue is expensive

I understand your concern; we are simply implementing the semantics defined by the DPDK API. Since this is a per-RXQ interrupt, we do not expect interrupt sharing. From an upstream perspective, we also prefer not to introduce additional constraints or modify common code solely to accommodate our driver. For example, we do not think users should be required to perform interrupt operations on a datapath lcore, nor should they have to follow a specific sequence of operations for the driver to work correctly. Currently, our driver can be supported without any changes to the common/example code.

Regarding the resource concern you mentioned, we can certainly provide other options to address it. My point is simply that not all users require so many resources, so the implementation should not impose such requirements on everyone. However, we will certainly provide an upstreaming alternative option to accommodate your use case.

From: Vincent JARDIN <[email protected]<mailto:[email protected]>>
Sent: Thursday, November 19, 2026 6:07 PM
To: Maxime Leroy <[email protected]<mailto:[email protected]>>; Jun Yang <[email protected]<mailto:[email protected]>>
Cc: Prashant Gupta <[email protected]<mailto:[email protected]>>; Hemant Agrawal <[email protected]<mailto:[email protected]>>; Francois Massot-Pellet <[email protected]<mailto:[email protected]>>
Subject: Re: [EXT] Re: [PATCH v4-S3 52/65] net/dpaa2: bind per-queue DPIO for rx-queue interrupts

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

+Francois for information

________________________________
From: Maxime Leroy <[email protected]<mailto:[email protected]>>
Sent: Thursday, 19 November 2026 10:49:52
To: Jun Yang <[email protected]<mailto:[email protected]>>
Cc: Prashant Gupta <[email protected]<mailto:[email protected]>>; Hemant Agrawal <[email protected]<mailto:[email protected]>>; Vincent JARDIN <[email protected]<mailto:[email protected]>>
Subject: Re: [EXT] Re: [PATCH v4-S3 52/65] net/dpaa2: bind per-queue DPIO for rx-queue interrupts

Hi Jun,

My review was sent to [email protected]<mailto:[email protected]>, and your reply came to me only. Please answer on the mailing list, not in private: the other reviewers
and the maintainers need to see your answers. If you cannot disclose something, for example the maximum number of DPIOs, just leave it out
of your public answer.

Quoted 5 lines · On Fri, Nov 13, 2026 at 2:34 PM Jun Yang…

Hi Maxime,
We are still working on categorizing and improving our upstream patches. Regarding the issue you raised, please see my comments below:
1)The PMD changes the CPU frequency governor
The CPU frequency governor is controlled through a devarg and is disabled by default. Users must explicitly enable this feature; otherwise, the driver does not modify the CPU frequency governor.

I do not find this devarg in v4-S3. 47/65 changes the governor from dpaa2_event_portal_io_prepare() in the eventdev driver. 52/65 moves the call to dpaa2_dpio_intr_thread_affinity() and also calls it from the Rx bursts. There is no condition:

    ret = dpaa2_dpio_cpufreq_governor(dpio_dev->cpu_affine, false);

A devarg does not fix the problem anyway. Please remove this code. The design is wrong:

- The governor belongs to the CPU, not to the port. The admin and the application can change it too. On LX2160A it is even shared by the two cores of a cluster.
- DPDK already has rte_power for this. It has no qoriq_cpufreq backend today: adding one in drivers/power is the right fix.
- A user who wants "performance" can set it with one command before starting the application.

And the implementation is broken:

1. cpu_affine is a DPDK lcore id, not a Linux CPU number (see point 2), so the PMD can change the governor of another CPU.
2. The save is per CPU, but the policy is per cluster. Queue 0 on CPU 2 saves "schedutil". Queue 1 on CPU 3 then reads "performance" and saves that. After close, the cluster stays in "performance".
3. No reference count: two ports polled by the same CPU, closing the first one restores the governor under the second one.
4. A queue moves from CPU A to CPU B: only B is restored.
5. A queue that was never polled has cpu_affine = -1: closing the port restores every CPU that the PMD changed, including those used by other ports.
6. The governor is written through sysfs inside rte_eth_rx_burst().

Quoted 3 lines

2)The Rx burst uses the lcore ID as a Linux CPU number
Rx queues can be migrated dynamically between cores. After each migration, the driver updates the interrupt affinity and the stash core accordingly.

My concern is not the migration. It is the number given to the kernel:

    int ret, num_rx = 0, cpu = rte_lcore_id();
    [...]
            dpio->cpu_affine = cpu;
            dpaa2_dpio_intr_thread_affinity(dpio);

cpu_affine is a DPDK lcore id, but it is used as a Linux CPU number for the IRQ affinity, the stashing destination and the governor. Example with --lcores '1@12': lcore 1 runs on CPU 12, and all three are set for CPU 1.

grout is in this case: each worker is a thread pinned to its CPU, then it calls rte_thread_register(), and EAL gives it the first free lcore id, whatever its CPU.

dpaa2_get_core_id() is in the same file and returns the CPU of the calling thread. Please use it in dpaa2_dpio_intr_thread_affinity().

This code also still runs inside rte_eth_rx_burst(): it parses /proc/interrupts, writes /proc/irq/N/smp_affinity_list and sends an MC command. Please set the IRQ affinity in dpaa2_dev_rx_queue_intr_enable() instead

Quoted 2 lines

The implementation also drains any frames being pulled on the previous core before continuing processing on the new one.

I do not find this drain in v4-S3. I only see the loop that was already in 26.07, now in dpaa2_dev_rx_active_dq_storage(). It waits for the VDQ of the previous core to complete. It does not read the frames.

Those frames are in q_storage[A]. B pulls into q_storage[B] and reads only q_storage[B]. Can you point me to the code that reads them?

Quoted 2 lines

3)One DPIO per Rx queue is expensive
The hardware currently supports up to 67 DPIO portals in total. If your deployment requires more portals than the hardware can provide under this model, we can evaluate and discuss possible compatibility or scalability alternatives.

On our LX2160A board I can create 65 DPIOs, not 67: 50 from the DPL, then 15 more with restool before the MC refuses.

The two models do not spend them the same way:

- 26.07: two DPIOs per worker, whatever the number of ports and Rx queues. Only the DPCONs follow the queues, and they are not
scarce: I can create 174 of them on the same board.
- this patch: one DPIO per worker, plus one DPIO per Rx queue.

Our case: 12 workers, 5 ports, 12 Rx queues per port.

26.07 this patch
workers 24 12
main thread 1 1
per Rx queue 0 60
total for DPDK 25 73

73 is more than the 65 of the board, before the kernel takes its own.

The limits are probably lower on the other DPAA2 SoCs, so the new approach could be even worse there.

The only gain I see in the code is that the fd of the queue is known at rx_queue_setup(), so the application can call rte_eth_dev_rx_intr_ctl_q() before rte_eth_dev_rx_intr_enable(). My l3fwd-power series already handles that in two patches (3/6 and 4/6). The rest of the series still applies to your model: for example the enable still returns -EAGAIN, and l3fwd-power does not check it today.

Without a benefit, I do not understand the point of this change. Please tell me what the benefit is, so that we can weigh the trade-off between the two approaches.

Thanks,

-------------------------------
Maxime Leroy
[email protected]<mailto:[email protected]>

#189 lore raw

PATCH 53/65 net/dpaa2: add API to clean Tx confirmation queue

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

When Tx confirmation is enabled, transmitted mbufs are only released back to their pool once the corresponding Tx-confirm frames are dequeued. On a port that stops transmitting, these confirmations are never drained and the mbufs stay held. Applications had no way to force this cleanup.

Add rte_pmd_dpaa2_clean_tx_conf() so an application can drain the Tx-confirm queue associated with a given port and Tx queue on demand.

To support this, dpaa2_dev_tx_conf() is changed to take the tx-confirm queue directly instead of the Tx queue, and its callers are updated to pass tx_conf_queue explicitly.

---
 drivers/net/dpaa2/dpaa2_ethdev.c  | 22 ++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_ethdev.h  |  2 +-
 drivers/net/dpaa2/dpaa2_ptp.c     |  2 +-
 drivers/net/dpaa2/dpaa2_rxtx.c    | 22 ++++++++++------------
 drivers/net/dpaa2/rte_pmd_dpaa2.h |  4 ++++
 5 files changed, 38 insertions(+), 14 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.c +22 -0
index d8a183453b..fe43779b10 100644
@@ -1240,6 +1240,28 @@ dpaa2_dev_dcb_info(struct rte_eth_dev *dev,
 	return 0;
 }
 
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa2_clean_tx_conf, 26.11)
+uint16_t
+rte_pmd_dpaa2_clean_tx_conf(uint32_t eth_id, uint16_t txq_id)
+{
+	struct rte_eth_dev *dev;
+	struct dpaa2_queue *txq;
+
+	if (unlikely(!rte_pmd_dpaa2_dev_is_dpaa2(eth_id))) {
+		DPAA2_PMD_WARN("eth%d is NOT dpaa2 device", eth_id);
+		return 0;
+	}
+
+	dev = &rte_eth_devices[eth_id];
+	txq = dev->data->tx_queues[txq_id];
+
+	if (txq->tx_conf_queue)
+		return dpaa2_dev_tx_conf(txq->tx_conf_queue, true);
+
+	DPAA2_PMD_WARN("TX confirm not enabled on %s", dev->data->name);
+	return 0;
+}
+
 RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa2_dev_configure_default_action, 26.11)
 int
 rte_pmd_dpaa2_dev_configure_default_action(uint16_t port_id,
drivers/net/dpaa2/dpaa2_ethdev.h +1 -1
index d1ddea7c64..2f3f5bae2a 100644
@@ -981,7 +981,7 @@ uint16_t dpaa2_dev_tx_multi_txq_ordered(struct dpaa2_queue **dpaa2_q,
 void dpaa2_dev_free_eqresp_buf(uint16_t eqresp_ci, struct dpaa2_queue *dpaa2_q);
 void dpaa2_flow_clean(struct rte_eth_dev *dev, uint8_t tc_id,
 	enum dpaa2_flow_dist_type type);
-uint16_t dpaa2_dev_tx_conf(void *txq, int drain);
+uint16_t dpaa2_dev_tx_conf(struct dpaa2_queue *tx_conf_q, int drain);
 
 void
 dpaa2_dev_tx_ptp_one_step_runtime(struct rte_eth_dev *dev,
drivers/net/dpaa2/dpaa2_ptp.c +1 -1
index 00f6d04c92..90de203f93 100644
@@ -218,7 +218,7 @@ int dpaa2_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 		rte_memory_order_relaxed);
 	while (txq && rte_atomic_load_explicit(&txq->ts_to_cnfd,
 		rte_memory_order_relaxed) > 0) {
-		dpaa2_dev_tx_conf(txq, false);
+		dpaa2_dev_tx_conf(txq->tx_conf_queue, false);
 		txq = rte_atomic_load_explicit(&priv->next_txq_to_cnf,
 			rte_memory_order_relaxed);
 	}
drivers/net/dpaa2/dpaa2_rxtx.c +10 -12
index efaa862623..4f712ec9f7 100644
@@ -1417,14 +1417,14 @@ dpaa2_dev_is_mbuf_from_spec_pool(struct rte_mempool *mp,
 }
 
 static __rte_always_inline void __rte_hot
-dpaa2_dev_tx_cnf_fd_to_mbuf(struct dpaa2_queue *dpaa2_q,
+dpaa2_dev_tx_cnf_fd_to_mbuf(struct dpaa2_queue *tx_conf_q,
 	const struct qbman_fd *fd, const struct qbman_fd **fds,
 	struct rte_mbuf **mbuf)
 {
 	void *v_addr;
 	struct dpaa2_annot_hdr *annotation;
-	struct dpaa2_queue *dpaa2_txq = dpaa2_q->tx_queue;
-	struct dpaa2_dev_priv *priv = dpaa2_q->eth_data->dev_private;
+	struct dpaa2_queue *dpaa2_txq = tx_conf_q->tx_queue;
+	struct dpaa2_dev_priv *priv = tx_conf_q->eth_data->dev_private;
 
 	RTE_SET_USED(fds);
 
@@ -1436,17 +1436,15 @@ dpaa2_dev_tx_cnf_fd_to_mbuf(struct dpaa2_queue *dpaa2_q,
 			annotation->word2, rte_memory_order_relaxed);
 		rte_atomic_store_explicit(&priv->next_txq_to_cnf,
 			dpaa2_txq, rte_memory_order_relaxed);
-		rte_atomic_fetch_sub_explicit(&dpaa2_q->ts_to_cnfd, 1,
+		rte_atomic_fetch_sub_explicit(&tx_conf_q->ts_to_cnfd, 1,
 			rte_memory_order_relaxed);
 		dpaa2_timestamp_debug(priv, __func__, priv->tx_timestamp);
 	}
 }
 
-uint16_t dpaa2_dev_tx_conf(void *txq, int drain)
+uint16_t dpaa2_dev_tx_conf(struct dpaa2_queue *tx_conf_q, int drain)
 {
 	/* Function receive frames for a given device and VQ*/
-	struct dpaa2_queue *dpaa2_txq = txq;
-	struct dpaa2_queue *dpaa2_q = dpaa2_txq->tx_conf_queue;
 	uint16_t num_rx, total = 0, idx;
 	int bulk_free;
 	struct rte_mbuf *mbufs[dpaa2_dqrr_size];
@@ -1455,7 +1453,7 @@ uint16_t dpaa2_dev_tx_conf(void *txq, int drain)
 		dpaa2_dev_prefetch_next_psr_dummy : dpaa2_dev_prefetch_next_psr;
 
 dq_again:
-	num_rx = dpaa2_dev_prefetch_rx_common(dpaa2_q, NULL, mbufs, dpaa2_dqrr_size,
+	num_rx = dpaa2_dev_prefetch_rx_common(tx_conf_q, NULL, mbufs, dpaa2_dqrr_size,
 		dpaa2_dev_tx_cnf_fd_to_mbuf, dq_prefetch);
 	bulk_free = true;
 	mp = NULL;
@@ -1548,7 +1546,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	hw_mp = priv->bp_list->mp;
 
 	if (dpaa2_q->tx_conf_queue)
-		dpaa2_dev_tx_conf(dpaa2_q, false);
+		dpaa2_dev_tx_conf(dpaa2_q->tx_conf_queue, false);
 
 	/*Prepare enqueue descriptor*/
 	qbman_eq_desc_clear(&eqdesc);
@@ -1874,10 +1872,10 @@ dpaa2_dev_tx_multi_txq_ordered(struct dpaa2_queue **dpaa2_q,
 		}
 	}
 	for (i = 0; i < loop; i++) {
-		if (unlikely(dpaa2_q[i]->tx_conf_queue)) {
-			dpaa2_dev_tx_conf(dpaa2_q[i], false);
+		cnf_q = dpaa2_q[i]->tx_conf_queue;
+		if (unlikely(cnf_q)) {
+			dpaa2_dev_tx_conf(cnf_q, false);
 			if (tstamp[i]) {
-				cnf_q = dpaa2_q[i]->tx_conf_queue;
 				rte_atomic_fetch_add_explicit(&cnf_q->ts_to_cnfd,
 					1, rte_memory_order_relaxed);
 			}
drivers/net/dpaa2/rte_pmd_dpaa2.h +4 -0
index 5a61a952bf..0e447cb58d 100644
@@ -203,6 +203,10 @@ int
 rte_pmd_dpaa2_dev_configure_default_action(uint16_t port_id,
 	struct rte_pmd_dpaa2_default_action_conf *def_act_conf);
 
+__rte_experimental
+uint16_t
+rte_pmd_dpaa2_clean_tx_conf(uint32_t eth_id, uint16_t txq_id);
+
 #define RTE_DPAA2_EVENT_PORT_CFG_ATOMIC RTE_BIT32(31)
 
 /** RTE_DPAA2_MIX_GROUP_FLOW has same behavio as RTE_DPAA2_FLAT_GROUP_FLOW*/
Signature · 1 line
2.43.0
#190 lore raw

PATCH 54/65 event/dpaa2: fix DQRR held buffer accounting on enqueue

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

In the atomic enqueue path, the DQRR held-buffer state (dqrr_size and dqrr_held) was updated while building the enqueue descriptors, before the frames were actually enqueued to the hardware. If the subsequent qbman_swp_enqueue_multiple_desc() only accepted a subset of the frames (or none, requiring a retry), the accounting had already been cleared for frames that were never sent. This left the held-buffer bookkeeping out of sync with the DQRR entries still owned by the portal, leading to premature consumption of DQRR slots and incorrect atomic context release.

Defer the held-buffer update until after each enqueue reports how many frames were accepted. The per-slot DQRR size and bitmask are recorded while preparing the descriptors and applied only for the frames that were actually enqueued.

---
 drivers/event/dpaa2/dpaa2_eventdev.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev.c +10 -3
index 01c71fc0d2..127397e681 100644
@@ -129,8 +129,9 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
 	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
 	struct qbman_eq_desc eqdesc[MAX_TX_RING_SLOTS];
 	uint16_t num_tx = 0;
+	uint64_t dqrr_held[MAX_TX_RING_SLOTS];
 	int ret;
-	uint8_t dqrr_index;
+	uint8_t dqrr_index, dqrr_size[MAX_TX_RING_SLOTS];
 	const struct rte_event *event;
 	struct dpaa2_queue *dpci_txq[MAX_TX_RING_SLOTS];
 	struct rte_event *ev_tx[MAX_TX_RING_SLOTS];
@@ -180,13 +181,15 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
 			qbman_eq_desc_set_fq(&eqdesc[loop], dpci_txq[loop]->fqid);
 			qbman_eq_desc_set_no_orp(&eqdesc[loop], 0);
 			qbman_eq_desc_set_response(&eqdesc[loop], 0, 0);
+			dqrr_held[loop] = 0;
+			dqrr_size[loop] = 0;
 
 			if (event->sched_type == RTE_SCHED_TYPE_ATOMIC &&
 				*dpaa2_seqn(event->mbuf)) {
 				dqrr_index = *dpaa2_seqn(event->mbuf) - 1;
 				qbman_eq_desc_set_dca(&eqdesc[loop], 1, dqrr_index, 0);
-				dpio_dev->dpaa2_held_bufs.dqrr_size--;
-				dpio_dev->dpaa2_held_bufs.dqrr_held &= ~(1 << dqrr_index);
+				dqrr_size[loop] = 1;
+				dqrr_held[loop] = UINT64_C(1) << dqrr_index;
 			}
 
 			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
@@ -218,6 +221,10 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
 					goto quit;
 				}
 			} else {
+				for (i = loop; i < (loop + ret); i++) {
+					dpio_dev->dpaa2_held_bufs.dqrr_size -= dqrr_size[i];
+					dpio_dev->dpaa2_held_bufs.dqrr_held &= ~dqrr_held[i];
+				}
 				loop += ret;
 				retry_count = 0;
 			}
Signature · 1 line
2.43.0
#191 lore raw

PATCH 55/65 bus/fslmc: store dequeue dpio in mbuf seq dynfield

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The atomic scheduling context (DQRR index) is saved in the mbuf seq dynfield at dequeue time and consumed at enqueue time. However, the enqueue and dequeue may happen on different DPIO portals, so the context must remember which DPIO produced it.

Change the seqn dynfield from a bare uint32_t to a small struct that carries both the sequence value and the originating dequeue DPIO pointer. This is the base type change; additional changes are in the following patches.

---
 drivers/bus/fslmc/bus_fslmc_driver.h | 28 +++++++++++++++++++++-------
 drivers/bus/fslmc/fslmc_bus.c        |  4 ++--
 2 files changed, 23 insertions(+), 9 deletions(-)
drivers/bus/fslmc/bus_fslmc_driver.h +21 -7
index 40c9ba0699..ddde52d89c 100644
@@ -43,21 +43,35 @@ struct vfio_device_info;
 
 #define DPAA2_INVALID_MBUF_SEQN        0
 
-typedef uint32_t dpaa2_seqn_t;
+struct dpaa2_seq_t {
+	uint32_t seqn;
+	void *seq_dpio_dq;
+};
+
 extern int dpaa2_seqn_dynfield_offset;
 
 /**
- * Read dpaa2 sequence number from mbuf.
+ * Read dpaa2 sequence struct from mbuf.
  *
  * @param mbuf Structure to read from.
- * @return pointer to dpaa2 sequence number.
+ * @return pointer to dpaa2 sequence struct.
  */
-__rte_internal
-static inline dpaa2_seqn_t *
+static __rte_always_inline struct dpaa2_seq_t *
+dpaa2_seq(struct rte_mbuf *mbuf)
+{
+	return RTE_MBUF_DYNFIELD(mbuf, dpaa2_seqn_dynfield_offset, struct dpaa2_seq_t *);
+}
+
+static __rte_always_inline uint32_t *
 dpaa2_seqn(struct rte_mbuf *mbuf)
 {
-	return RTE_MBUF_DYNFIELD(mbuf, dpaa2_seqn_dynfield_offset,
-		dpaa2_seqn_t *);
+	return &(dpaa2_seq(mbuf)->seqn);
+}
+
+static __rte_always_inline void **
+dpaa2_seq_dpio_dq(struct rte_mbuf *mbuf)
+{
+	return &(dpaa2_seq(mbuf)->seq_dpio_dq);
 }
 
 /** Device driver supports link state interrupt */
drivers/bus/fslmc/fslmc_bus.c +2 -2
index d20103ee36..82b11176e1 100644
@@ -651,8 +651,8 @@ rte_fslmc_probe(struct rte_bus *bus)
 {
 	static const struct rte_mbuf_dynfield dpaa2_seqn_dynfield_desc = {
 		.name = DPAA2_SEQN_DYNFIELD_NAME,
-		.size = sizeof(dpaa2_seqn_t),
-		.align = alignof(dpaa2_seqn_t),
+		.size = sizeof(struct dpaa2_seq_t),
+		.align = alignof(struct dpaa2_seq_t),
 	};
 	int ret;
 
Signature · 1 line
2.43.0
#192 lore raw

PATCH 56/65 bus/fslmc: use explicit flags for mbuf seqn encoding

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The DPAA2 drivers stash the DQRR index in the mbuf dynamic seqn field to support atomic (DCA) and ordered (ORP) enqueue. The index was stored as "dqrr_index + 1" and the field was tested for a non-zero value to decide whether it was valid, with the index recovered as "seqn - 1".

This offset-by-one scheme overloads a single field and cannot distinguish the DCA case from the ORP case; it only works because any valid index becomes non-zero. It is fragile and makes the DCA and ORP paths ambiguous.

Encode the seqn using the explicit qbman flag bits instead:
- store the index as "dqrr_index | QBMAN_ENQUEUE_FLAG_DCA"
- recover the index with "& QBMAN_EQCR_DCA_IDXMASK"
- gate the DCA path on "& QBMAN_ENQUEUE_FLAG_DCA"
- gate the ORP path on "& DPAA2_ENQUEUE_FLAG_ORP"

Apply this consistently across net/dpaa2, crypto/dpaa2_sec and event/dpaa2 so the atomic and ordered enqueue paths are selected unambiguously.

---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 17 +++++++----------
 drivers/event/dpaa2/dpaa2_eventdev.c        |  6 +++---
 drivers/net/dpaa2/dpaa2_rxtx.c              |  8 ++++----
 3 files changed, 14 insertions(+), 17 deletions(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +7 -10
index e34ca884fe..54881bc38c 100644
@@ -1549,13 +1549,10 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
 			dpaa2_eqcr_size : nb_ops;
 
 		for (loop = 0; loop < frames_to_send; loop++) {
-			if (*dpaa2_seqn((*ops)->sym->m_src)) {
-				if (*dpaa2_seqn((*ops)->sym->m_src) & QBMAN_ENQUEUE_FLAG_DCA) {
-					DPAA2_PER_LCORE_DQRR_SIZE--;
-					DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) <<
-						*dpaa2_seqn((*ops)->sym->m_src) &
-					QBMAN_EQCR_DCA_IDXMASK);
-				}
+			if (*dpaa2_seqn((*ops)->sym->m_src) & QBMAN_ENQUEUE_FLAG_DCA) {
+				DPAA2_PER_LCORE_DQRR_SIZE--;
+				DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) <<
+					*dpaa2_seqn((*ops)->sym->m_src) & QBMAN_EQCR_DCA_IDXMASK);
 				flags[loop] = *dpaa2_seqn((*ops)->sym->m_src);
 				*dpaa2_seqn((*ops)->sym->m_src) = DPAA2_INVALID_MBUF_SEQN;
 			}
@@ -1848,7 +1845,7 @@ dpaa2_sec_set_enqueue_descriptor(struct dpaa2_queue *dpaa2_q,
 			qbman_eq_desc_set_orp(eqdesc, 0, orpid, seqnum, 0);
 		}
 	} else {
-		dq_idx = *dpaa2_seqn(m) - 1;
+		dq_idx = *dpaa2_seqn(m) & QBMAN_EQCR_DCA_IDXMASK;
 		qbman_eq_desc_set_dca(eqdesc, 1, dq_idx, 0);
 		DPAA2_PER_LCORE_DQRR_SIZE--;
 		DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) << dq_idx);
@@ -1897,7 +1894,7 @@ dpaa2_sec_enqueue_burst_ordered(void *qp, struct rte_crypto_op **ops,
 			dpaa2_eqcr_size : nb_ops;
 
 		if (!priv->en_loose_ordered) {
-			if (*dpaa2_seqn((*ops)->sym->m_src)) {
+			if (*dpaa2_seqn((*ops)->sym->m_src) & DPAA2_ENQUEUE_FLAG_ORP) {
 				num_free_eq_desc = dpaa2_free_eq_descriptors();
 				if (num_free_eq_desc < frames_to_send)
 					frames_to_send = num_free_eq_desc;
@@ -1909,7 +1906,7 @@ dpaa2_sec_enqueue_burst_ordered(void *qp, struct rte_crypto_op **ops,
 			qbman_eq_desc_clear(&eqdesc[loop]);
 			qbman_eq_desc_set_fq(&eqdesc[loop], dpaa2_qp->tx_vq.fqid);
 
-			if (*dpaa2_seqn((*ops)->sym->m_src))
+			if (*dpaa2_seqn((*ops)->sym->m_src) & DPAA2_ENQUEUE_FLAG_ORP)
 				dpaa2_sec_set_enqueue_descriptor(
 						&dpaa2_qp->tx_vq,
 						(*ops)->sym->m_src,
drivers/event/dpaa2/dpaa2_eventdev.c +3 -3
index 127397e681..2efdbb8b59 100644
@@ -185,8 +185,8 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
 			dqrr_size[loop] = 0;
 
 			if (event->sched_type == RTE_SCHED_TYPE_ATOMIC &&
-				*dpaa2_seqn(event->mbuf)) {
-				dqrr_index = *dpaa2_seqn(event->mbuf) - 1;
+				(*dpaa2_seqn(event->mbuf) & QBMAN_ENQUEUE_FLAG_DCA)) {
+				dqrr_index = *dpaa2_seqn(event->mbuf) & QBMAN_EQCR_DCA_IDXMASK;
 				qbman_eq_desc_set_dca(&eqdesc[loop], 1, dqrr_index, 0);
 				dqrr_size[loop] = 1;
 				dqrr_held[loop] = UINT64_C(1) << dqrr_index;
@@ -273,7 +273,7 @@ static void dpaa2_eventdev_process_atomic(struct dpaa2_dpio_dev *dpio_dev,
 
 	rte_memcpy(ev, rx_ev, sizeof(struct rte_event));
 	rte_mempool_put(rxq->env_pool, rx_ev);
-	*dpaa2_seqn(ev->mbuf) = dqrr_index + 1;
+	*dpaa2_seqn(ev->mbuf) = dqrr_index | QBMAN_ENQUEUE_FLAG_DCA;
 	dpio_dev->dpaa2_held_bufs.dqrr_size++;
 	dpio_dev->dpaa2_held_bufs.dqrr_held |= UINT64_C(1) << dqrr_index;
 	dpio_dev->dpaa2_held_bufs.mbuf[dqrr_index] = ev->mbuf;
drivers/net/dpaa2/dpaa2_rxtx.c +4 -4
index 4f712ec9f7..dfd359d0e2 100644
@@ -1234,7 +1234,7 @@ dpaa2_dev_process_atomic_event(struct dpaa2_dpio_dev *dpio_dev,
 		ev->mbuf = dpaa2_eth_fd_to_mbuf(rxq->eth_data->dev_private, fd);
 
 	dqrr_index = qbman_get_dqrr_idx(dq);
-	*dpaa2_seqn(ev->mbuf) = dqrr_index + 1;
+	*dpaa2_seqn(ev->mbuf) = dqrr_index | QBMAN_ENQUEUE_FLAG_DCA;
 	dpio_dev->dpaa2_held_bufs.dqrr_size++;
 	dpio_dev->dpaa2_held_bufs.dqrr_held |= UINT64_C(1) << dqrr_index;
 	dpio_dev->dpaa2_held_bufs.mbuf[dqrr_index] = ev->mbuf;
@@ -1570,8 +1570,8 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 		dpaa2_eqcr_size : nb_pkts;
 
 	for (loop = 0; loop < frames_to_send; loop++) {
-		if (*dpaa2_seqn(*bufs)) {
-			uint8_t dqrr_index = *dpaa2_seqn(*bufs) - 1;
+		if (*dpaa2_seqn(*bufs) & QBMAN_ENQUEUE_FLAG_DCA) {
+			uint8_t dqrr_index = *dpaa2_seqn(*bufs) & QBMAN_EQCR_DCA_IDXMASK;
 
 			flags[loop] = QBMAN_ENQUEUE_FLAG_DCA | dqrr_index;
 			DPAA2_PER_LCORE_DQRR_SIZE--;
@@ -1743,7 +1743,7 @@ dpaa2_set_enqueue_descriptor(struct dpaa2_queue *dpaa2_q,
 			qbman_eq_desc_set_orp(eqdesc, 0, orpid, seqnum, 0);
 		}
 	} else {
-		dq_idx = *dpaa2_seqn(m) - 1;
+		dq_idx = *dpaa2_seqn(m) & QBMAN_EQCR_DCA_IDXMASK;
 		qbman_eq_desc_set_dca(eqdesc, 1, dq_idx, 0);
 		DPAA2_PER_LCORE_DQRR_SIZE--;
 		DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) << dq_idx);
Signature · 1 line
2.43.0
#193 lore raw

PATCH 57/65 net/dpaa2: unify tx burst path for ordered and atomic enqueue

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The ordered transmit path used a dedicated burst function, dpaa2_dev_tx_ordered(), which was installed as dev->tx_pkt_burst at device start when ordered queues were enabled. This split the TX datapath into two separate entry points and required swapping the burst function and reporting a distinct "Ordered" burst mode.

Make dpaa2_dev_tx() the single TX entry point. It now inspects the mbuf seqn flags (DPAA2_ENQUEUE_FLAG_ORP / QBMAN_ENQUEUE_FLAG_DCA) and, when a packet requires ordered or atomic (DCA) enqueue, routes the remaining burst through the ordered multi-queue path. dpaa2_dev_tx_ordered() is reduced to a static helper that wraps dpaa2_dev_tx_multi_txq_ordered(), and the start-time tx_pkt_burst swap, the "Ordered" burst-mode string and the exported prototype are removed.

Simplify the dpaa2_dev_tx() error handling by replacing the duplicated send_n_return path with a single break and shared enqueue tail, passing NULL flags since DCA is handled on the ordered path.

Rework dpaa2_dev_tx_multi_txq_ordered() to index the burst with bufs[loop] instead of advancing the buffer pointer, handle atomic (DCA) descriptors with per-slot dqrr_held/dqrr_size/flags, update per-queue tx_pkts counters, and restore the mbuf seqn flags when enqueue fails so packets can be retried.

---
 drivers/net/dpaa2/dpaa2_ethdev.c |   6 --
 drivers/net/dpaa2/dpaa2_ethdev.h |   3 +-
 drivers/net/dpaa2/dpaa2_rxtx.c   | 178 ++++++++++++++-----------------
 3 files changed, 84 insertions(+), 103 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.c +0 -6
index fe43779b10..85c93bf422 100644
@@ -1003,8 +1003,6 @@ dpaa2_dev_tx_burst_mode_get(struct rte_eth_dev *dev,
 
 	if (pkt_burst == dpaa2_dev_tx)
 		snprintf(mode->info, sizeof(mode->info), "%s", "Scalar");
-	else if (pkt_burst == dpaa2_dev_tx_ordered)
-		snprintf(mode->info, sizeof(mode->info), "%s", "Ordered");
 	else if (pkt_burst == rte_eth_pkt_burst_dummy)
 		snprintf(mode->info, sizeof(mode->info), "%s", "Dummy");
 	else
@@ -2343,10 +2341,6 @@ dpaa2_dev_start(struct rte_eth_dev *dev)
 	 */
 	dpaa2_dev_set_link_up(dev);
 
-	/* Change the tx burst function if ordered queues are used */
-	if (priv->en_ordered)
-		dev->tx_pkt_burst = dpaa2_dev_tx_ordered;
-
 	for (i = 0; i < dev->data->nb_rx_queues; i++)
 		dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
 	for (i = 0; i < dev->data->nb_tx_queues; i++)
drivers/net/dpaa2/dpaa2_ethdev.h +1 -2
index 2f3f5bae2a..caf3fabee7 100644
@@ -972,8 +972,7 @@ void dpaa2_dev_process_ordered_event(struct dpaa2_dpio_dev *dpio_dev,
 	struct dpaa2_queue *rxq, struct rte_event *ev);
 
 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(struct dpaa2_queue **dpaa2_q,
 	struct rte_mbuf **bufs, uint16_t nb_pkts);
drivers/net/dpaa2/dpaa2_rxtx.c +83 -95

320 lines not on this page · raw message

Signature · 1 line
2.43.0
#194 lore raw

PATCH 58/65 crypto/dpaa2_sec: unify enqueue burst path for ordered enqueue

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The ordered enqueue path used a dedicated burst function, dpaa2_sec_enqueue_burst_ordered(), which was installed as dev->enqueue_burst at device start when ordered queues were enabled. This split the crypto enqueue datapath into two separate entry points and required swapping the burst function at start time.

Make dpaa2_sec_enqueue_burst() the single enqueue entry point. It now inspects the mbuf seqn flags (DPAA2_ENQUEUE_FLAG_ORP / QBMAN_ENQUEUE_FLAG_DCA) and, when an op requires ordered or atomic (DCA) enqueue, routes the remaining burst through dpaa2_sec_enqueue_burst_ordered(). The start-time enqueue_burst swap is removed.

Move dpaa2_sec_set_enqueue_descriptor() and dpaa2_sec_enqueue_burst_ordered() above the fast enqueue path so the single entry point can call them. The normal path no longer handles DCA flags inline and passes NULL flags to qbman_swp_enqueue_multiple(), since DCA and ORP handling now live on the ordered path.

This mirrors the equivalent unification done for the net/dpaa2 tx burst path.

---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 362 ++++++++++----------
 1 file changed, 175 insertions(+), 187 deletions(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +175 -187
index 54881bc38c..9d2fa57989 100644
@@ -1502,22 +1502,174 @@ build_sec_fd(struct rte_crypto_op *op,
 	return ret;
 }
 
+static void
+dpaa2_sec_set_enqueue_descriptor(struct dpaa2_queue *dpaa2_q,
+	struct rte_mbuf *m, struct qbman_eq_desc *eqdesc)
+{
+	struct dpaa2_dpio_dev *dpio_dev = DPAA2_PER_LCORE_DPIO;
+	struct eqresp_metadata *eqresp_meta;
+	struct dpaa2_sec_dev_private *priv = dpaa2_q->crypto_data->dev_private;
+	uint16_t orpid, seqnum;
+	uint8_t dq_idx;
+
+	if (*dpaa2_seqn(m) & DPAA2_ENQUEUE_FLAG_ORP) {
+		orpid = (*dpaa2_seqn(m) & DPAA2_EQCR_OPRID_MASK) >>
+			DPAA2_EQCR_OPRID_SHIFT;
+		seqnum = (*dpaa2_seqn(m) & DPAA2_EQCR_SEQNUM_MASK) >>
+			DPAA2_EQCR_SEQNUM_SHIFT;
+
+		if (!priv->en_loose_ordered) {
+			qbman_eq_desc_set_orp(eqdesc, 1, orpid, seqnum, 0);
+			qbman_eq_desc_set_response(eqdesc, (uint64_t)
+				DPAA2_VADDR_TO_IOVA(&dpio_dev->eqresp[
+				dpio_dev->eqresp_pi]), 1);
+			qbman_eq_desc_set_token(eqdesc, 1);
+
+			eqresp_meta = &dpio_dev->eqresp_meta[dpio_dev->eqresp_pi];
+			eqresp_meta->dpaa2_q = dpaa2_q;
+			eqresp_meta->mp = m->pool;
+
+			dpio_dev->eqresp_pi + 1 < MAX_EQ_RESP_ENTRIES ?
+				dpio_dev->eqresp_pi++ : (dpio_dev->eqresp_pi = 0);
+		} else {
+			qbman_eq_desc_set_orp(eqdesc, 0, orpid, seqnum, 0);
+		}
+	} else {
+		dq_idx = *dpaa2_seqn(m) & QBMAN_EQCR_DCA_IDXMASK;
+		qbman_eq_desc_set_dca(eqdesc, 1, dq_idx, 0);
+		DPAA2_PER_LCORE_DQRR_SIZE--;
+		DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) << dq_idx);
+	}
+	*dpaa2_seqn(m) = DPAA2_INVALID_MBUF_SEQN;
+}
+
 static uint16_t
-dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
-			uint16_t nb_ops)
+dpaa2_sec_enqueue_burst_ordered(void *qp, struct rte_crypto_op **ops,
+	uint16_t nb_ops)
 {
 	/* Function to transmit the frames to given device and VQ*/
-	uint32_t loop;
 	int32_t ret;
 	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
-	uint32_t frames_to_send, retry_count;
+	uint32_t frames_to_send, num_free_eq_desc, retry_count, loop;
+	struct qbman_eq_desc eqdesc[MAX_TX_RING_SLOTS];
+	struct dpaa2_sec_qp *dpaa2_qp = qp;
+	struct qbman_swp *swp;
+	uint16_t num_tx = 0, bpid;
+	uint8_t dqrr_index;
+	struct dpaa2_sec_dev_private *priv = dpaa2_qp->tx_vq.crypto_data->dev_private;
+
+	if (unlikely(!nb_ops))
+		return 0;
+
+	if (ops[0]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
+		DPAA2_SEC_ERR("sessionless crypto op not supported");
+		return 0;
+	}
+
+	if (!DPAA2_PER_LCORE_DPIO) {
+		ret = dpaa2_affine_qbman_swp();
+		if (ret) {
+			DPAA2_SEC_ERR("Failure in affining portal");
+			return 0;
+		}
+	}
+	swp = DPAA2_PER_LCORE_PORTAL;
+
+	while (nb_ops) {
+		frames_to_send = (nb_ops > dpaa2_eqcr_size) ? dpaa2_eqcr_size : nb_ops;
+
+		if (!priv->en_loose_ordered) {
+			if (*dpaa2_seqn((*ops)->sym->m_src) & DPAA2_ENQUEUE_FLAG_ORP) {
+				num_free_eq_desc = dpaa2_free_eq_descriptors();
+				if (num_free_eq_desc < frames_to_send)
+					frames_to_send = num_free_eq_desc;
+			}
+		}
+
+		for (loop = 0; loop < frames_to_send; loop++) {
+			/*Prepare enqueue descriptor*/
+			qbman_eq_desc_clear(&eqdesc[loop]);
+			qbman_eq_desc_set_fq(&eqdesc[loop], dpaa2_qp->tx_vq.fqid);
+
+			if (*dpaa2_seqn((*ops)->sym->m_src) & DPAA2_ENQUEUE_FLAG_ORP) {
+				dpaa2_sec_set_enqueue_descriptor(&dpaa2_qp->tx_vq,
+					(*ops)->sym->m_src, &eqdesc[loop]);
+			} else {
+				if (*dpaa2_seqn((*ops)->sym->m_src) & QBMAN_ENQUEUE_FLAG_DCA) {
+					dqrr_index = *dpaa2_seqn((*ops)->sym->m_src) &
+						QBMAN_EQCR_DCA_IDXMASK;
+					DPAA2_PER_LCORE_DQRR_SIZE--;
+					DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) << dqrr_index);
+					qbman_eq_desc_set_dca(&eqdesc[loop], 1, dqrr_index, 0);
+					*dpaa2_seqn((*ops)->sym->m_src) = DPAA2_INVALID_MBUF_SEQN;
+				}
+				qbman_eq_desc_set_no_orp(&eqdesc[loop], DPAA2_EQ_RESP_ERR_FQ);
+			}
+
+			/*Clear the unused FD fields before sending*/
+			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
+			if ((*ops)->sym->m_src->pool->ops_index == rte_dpaa2_mpool_get_ops_idx())
+				bpid = mempool_to_bpid((*ops)->sym->m_src->pool);
+			else
+				bpid = MAX_BPID;
+			ret = build_sec_fd(*ops, &fd_arr[loop], bpid, dpaa2_qp);
+			if (ret) {
+				DPAA2_SEC_DP_DEBUG("FD build failed");
+				frames_to_send = loop + 1;
+				for (loop = 0; loop < frames_to_send; loop++)
+					free_fle(&fd_arr[loop], dpaa2_qp);
+				goto skip_tx;
+			}
+			ops++;
+		}
+
+		loop = 0;
+		retry_count = 0;
+		while (loop < frames_to_send) {
+			ret = qbman_swp_enqueue_multiple_desc(swp,
+					&eqdesc[loop], &fd_arr[loop],
+					frames_to_send - loop);
+			if (unlikely(ret < 0)) {
+				retry_count++;
+				if (retry_count > DPAA2_MAX_TX_RETRY_COUNT) {
+					num_tx += loop;
+					nb_ops -= loop;
+					DPAA2_SEC_DP_DEBUG("Enqueue fail");
+					/* freeing the fle buffers */
+					while (loop < frames_to_send) {
+						free_fle(&fd_arr[loop], dpaa2_qp);
+						loop++;
+					}
+					goto skip_tx;
+				}
+			} else {
+				loop += ret;
+				retry_count = 0;
+			}
+		}
+
+		num_tx += loop;
+		nb_ops -= loop;
+	}
+
+skip_tx:
+	dpaa2_qp->tx_vq.tx_pkts += num_tx;
+	dpaa2_qp->tx_vq.err_pkts += nb_ops;
+	return num_tx;
+}
+
+static uint16_t
+dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
+	uint16_t nb_ops)
+{
+	/* Function to transmit the frames to given device and VQ*/
+	int32_t ret, order = false;
+	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
 	struct qbman_eq_desc eqdesc;
-	struct dpaa2_sec_qp *dpaa2_qp = (struct dpaa2_sec_qp *)qp;
+	struct dpaa2_sec_qp *dpaa2_qp = qp;
 	struct qbman_swp *swp;
-	uint16_t num_tx = 0;
-	uint32_t flags[MAX_TX_RING_SLOTS] = {0};
 	/*todo - need to support multiple buffer pools */
-	uint16_t bpid;
+	uint16_t num_tx = 0, bpid, loop, frames_to_send, retry_count;
 	struct rte_mempool *mb_pool;
 
 	if (unlikely(nb_ops == 0))
@@ -1536,32 +1688,26 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
 	if (!DPAA2_PER_LCORE_DPIO) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
-			DPAA2_SEC_ERR(
-				"Failed to allocate IO portal, tid: %d",
-				rte_gettid());
+			DPAA2_SEC_ERR("Failed to allocate IO portal, tid: %d", rte_gettid());
 			return 0;
 		}
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
 
 	while (nb_ops) {
-		frames_to_send = (nb_ops > dpaa2_eqcr_size) ?
-			dpaa2_eqcr_size : nb_ops;
+		frames_to_send = (nb_ops > dpaa2_eqcr_size) ? dpaa2_eqcr_size : nb_ops;
 
 		for (loop = 0; loop < frames_to_send; loop++) {
-			if (*dpaa2_seqn((*ops)->sym->m_src) & QBMAN_ENQUEUE_FLAG_DCA) {
-				DPAA2_PER_LCORE_DQRR_SIZE--;
-				DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) <<
-					*dpaa2_seqn((*ops)->sym->m_src) & QBMAN_EQCR_DCA_IDXMASK);
-				flags[loop] = *dpaa2_seqn((*ops)->sym->m_src);
-				*dpaa2_seqn((*ops)->sym->m_src) = DPAA2_INVALID_MBUF_SEQN;
+			if (*dpaa2_seqn((*ops)->sym->m_src) &
+				(QBMAN_ENQUEUE_FLAG_DCA | DPAA2_ENQUEUE_FLAG_ORP)) {
+				order = true;
+				break;
 			}
 
 			/*Clear the unused FD fields before sending*/
 			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
 			mb_pool = (*ops)->sym->m_src->pool;
-			if (mb_pool->ops_index ==
-				rte_dpaa2_mpool_get_ops_idx())
+			if (mb_pool->ops_index == rte_dpaa2_mpool_get_ops_idx())
 				bpid = mempool_to_bpid(mb_pool);
 			else
 				bpid = MAX_BPID;
@@ -1573,13 +1719,12 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
 			ops++;
 		}
 
+		frames_to_send = loop;
 		loop = 0;
 		retry_count = 0;
 		while (loop < frames_to_send) {
 			ret = qbman_swp_enqueue_multiple(swp, &eqdesc,
-							 &fd_arr[loop],
-							 &flags[loop],
-							 frames_to_send - loop);
+				&fd_arr[loop], NULL, frames_to_send - loop);
 			if (unlikely(ret < 0)) {
 				retry_count++;
 				if (retry_count > DPAA2_MAX_TX_RETRY_COUNT) {
@@ -1588,8 +1733,7 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
 					DPAA2_SEC_DP_DEBUG("Enqueue fail");
 					/* freeing the fle buffers */
 					while (loop < frames_to_send) {
-						free_fle(&fd_arr[loop],
-								dpaa2_qp);
+						free_fle(&fd_arr[loop], dpaa2_qp);
 						loop++;
 					}
 					goto skip_tx;
@@ -1602,10 +1746,15 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
 
 		num_tx += loop;
 		nb_ops -= loop;
+		if (order)
+			break;
 	}
 skip_tx:
 	dpaa2_qp->tx_vq.tx_pkts += num_tx;
 	dpaa2_qp->tx_vq.err_pkts += nb_ops;
+	if (ret >= 0 && order)
+		num_tx += dpaa2_sec_enqueue_burst_ordered(qp, ops, nb_ops);
+
 	return num_tx;
 }
 
@@ -1810,163 +1959,6 @@ dpaa2_sec_free_eqresp_buf(uint16_t eqresp_ci,
 	rte_pktmbuf_free(op->sym->m_src);
 }
 
-static void
-dpaa2_sec_set_enqueue_descriptor(struct dpaa2_queue *dpaa2_q,
-			     struct rte_mbuf *m,
-			     struct qbman_eq_desc *eqdesc)
-{
-	struct dpaa2_dpio_dev *dpio_dev = DPAA2_PER_LCORE_DPIO;
-	struct eqresp_metadata *eqresp_meta;
-	struct dpaa2_sec_dev_private *priv = dpaa2_q->crypto_data->dev_private;
-	uint16_t orpid, seqnum;
-	uint8_t dq_idx;
-
-	if (*dpaa2_seqn(m) & DPAA2_ENQUEUE_FLAG_ORP) {
-		orpid = (*dpaa2_seqn(m) & DPAA2_EQCR_OPRID_MASK) >>
-			DPAA2_EQCR_OPRID_SHIFT;
-		seqnum = (*dpaa2_seqn(m) & DPAA2_EQCR_SEQNUM_MASK) >>
-			DPAA2_EQCR_SEQNUM_SHIFT;
-
-
-		if (!priv->en_loose_ordered) {
-			qbman_eq_desc_set_orp(eqdesc, 1, orpid, seqnum, 0);
-			qbman_eq_desc_set_response(eqdesc, (uint64_t)
-				DPAA2_VADDR_TO_IOVA(&dpio_dev->eqresp[
-				dpio_dev->eqresp_pi]), 1);
-			qbman_eq_desc_set_token(eqdesc, 1);
-
-			eqresp_meta = &dpio_dev->eqresp_meta[dpio_dev->eqresp_pi];
-			eqresp_meta->dpaa2_q = dpaa2_q;
-			eqresp_meta->mp = m->pool;
-
-			dpio_dev->eqresp_pi + 1 < MAX_EQ_RESP_ENTRIES ?
-				dpio_dev->eqresp_pi++ : (dpio_dev->eqresp_pi = 0);
-		} else {
-			qbman_eq_desc_set_orp(eqdesc, 0, orpid, seqnum, 0);
-		}
-	} else {
-		dq_idx = *dpaa2_seqn(m) & QBMAN_EQCR_DCA_IDXMASK;
-		qbman_eq_desc_set_dca(eqdesc, 1, dq_idx, 0);
-		DPAA2_PER_LCORE_DQRR_SIZE--;
-		DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) << dq_idx);
-	}
-	*dpaa2_seqn(m) = DPAA2_INVALID_MBUF_SEQN;
-}
-
-
-static uint16_t
-dpaa2_sec_enqueue_burst_ordered(void *qp, struct rte_crypto_op **ops,
-			uint16_t nb_ops)
-{
-	/* Function to transmit the frames to given device and VQ*/
-	uint32_t loop;
-	int32_t ret;
-	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
-	uint32_t frames_to_send, num_free_eq_desc, retry_count;
-	struct qbman_eq_desc eqdesc[MAX_TX_RING_SLOTS];
-	struct dpaa2_sec_qp *dpaa2_qp = (struct dpaa2_sec_qp *)qp;
-	struct qbman_swp *swp;
-	uint16_t num_tx = 0;
-	uint16_t bpid;
-	struct rte_mempool *mb_pool;
-	struct dpaa2_sec_dev_private *priv =
-				dpaa2_qp->tx_vq.crypto_data->dev_private;
-
-	if (unlikely(nb_ops == 0))
-		return 0;
-
-	if (ops[0]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
-		DPAA2_SEC_ERR("sessionless crypto op not supported");
-		return 0;
-	}
-
-	if (!DPAA2_PER_LCORE_DPIO) {
-		ret = dpaa2_affine_qbman_swp();
-		if (ret) {
-			DPAA2_SEC_ERR("Failure in affining portal");
-			return 0;
-		}
-	}
-	swp = DPAA2_PER_LCORE_PORTAL;
-
-	while (nb_ops) {
-		frames_to_send = (nb_ops > dpaa2_eqcr_size) ?
-			dpaa2_eqcr_size : nb_ops;
-
-		if (!priv->en_loose_ordered) {
-			if (*dpaa2_seqn((*ops)->sym->m_src) & DPAA2_ENQUEUE_FLAG_ORP) {
-				num_free_eq_desc = dpaa2_free_eq_descriptors();
-				if (num_free_eq_desc < frames_to_send)
-					frames_to_send = num_free_eq_desc;
-			}
-		}
-
-		for (loop = 0; loop < frames_to_send; loop++) {
-			/*Prepare enqueue descriptor*/
-			qbman_eq_desc_clear(&eqdesc[loop]);
-			qbman_eq_desc_set_fq(&eqdesc[loop], dpaa2_qp->tx_vq.fqid);
-
-			if (*dpaa2_seqn((*ops)->sym->m_src) & DPAA2_ENQUEUE_FLAG_ORP)
-				dpaa2_sec_set_enqueue_descriptor(
-						&dpaa2_qp->tx_vq,
-						(*ops)->sym->m_src,
-						&eqdesc[loop]);
-			else
-				qbman_eq_desc_set_no_orp(&eqdesc[loop],
-							 DPAA2_EQ_RESP_ERR_FQ);
-
-			/*Clear the unused FD fields before sending*/
-			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
-			mb_pool = (*ops)->sym->m_src->pool;
-			if (mb_pool->ops_index ==
-				rte_dpaa2_mpool_get_ops_idx())
-				bpid = mempool_to_bpid(mb_pool);
-			else
-				bpid = MAX_BPID;
-			ret = build_sec_fd(*ops, &fd_arr[loop], bpid, dpaa2_qp);
-			if (ret) {
-				DPAA2_SEC_DP_DEBUG("FD build failed");
-				goto skip_tx;
-			}
-			ops++;
-		}
-
-		loop = 0;
-		retry_count = 0;
-		while (loop < frames_to_send) {
-			ret = qbman_swp_enqueue_multiple_desc(swp,
-					&eqdesc[loop], &fd_arr[loop],
-					frames_to_send - loop);
-			if (unlikely(ret < 0)) {
-				retry_count++;
-				if (retry_count > DPAA2_MAX_TX_RETRY_COUNT) {
-					num_tx += loop;
-					nb_ops -= loop;
-					DPAA2_SEC_DP_DEBUG("Enqueue fail");
-					/* freeing the fle buffers */
-					while (loop < frames_to_send) {
-						free_fle(&fd_arr[loop],
-								dpaa2_qp);
-						loop++;
-					}
-					goto skip_tx;
-				}
-			} else {
-				loop += ret;
-				retry_count = 0;
-			}
-		}
-
-		num_tx += loop;
-		nb_ops -= loop;
-	}
-
-skip_tx:
-	dpaa2_qp->tx_vq.tx_pkts += num_tx;
-	dpaa2_qp->tx_vq.err_pkts += nb_ops;
-	return num_tx;
-}
-
 static uint16_t
 dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops,
 	uint16_t nb_ops)
@@ -3929,10 +3921,6 @@ dpaa2_sec_dev_start(struct rte_cryptodev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	/* Change the tx burst function if ordered queues are used */
-	if (priv->en_ordered)
-		dev->enqueue_burst = dpaa2_sec_enqueue_burst_ordered;
-
 	memset(&attr, 0, sizeof(struct dpseci_attr));
 
 	ret = dpseci_enable(dpseci, CMD_PRI_LOW, priv->token);
Signature · 1 line
2.43.0
#195 lore raw

PATCH 59/65 bus/fslmc: track atomic DCA context per dequeue dpio

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

For atomic scheduling the DQRR entry consumed at dequeue must be acknowledged (DCA) from the same DPIO portal that dequeued it. The enqueue and dequeue portals are not guaranteed to be same, so applying the DCA index using the enqueuing's DPIO can acknowledge the wrong portal. This corrupts the held-buffer accounting (dqrr_size / dqrr_held) and leaks DQRR entries on the originating portal.

Record the originating dequeue DPIO alongside the sequence number when a frame is dequeued, and only set the DCA and update the held-buffer state when the enqueuing DPIO matches the saved one.

The atomic dequeue/enqueue logic that was open-coded in the net, crypto and event drivers is consolidated into shared helpers in dpaa2_hw_pvt.h:

- dpaa2_dq_atomic_save() save DQRR index and dequeue DPIO
- dpaa2_eq_atomic_consume() consume DCA only if DPIO matches
- dpaa2_eq_atomic_dpio_update() release held DQRR after enqueue
- dpaa2_mbuf_seq_restore() restore seqn on enqueue failure
- dpaa2_mbuf_seq_is_flag_set() test seqn flags

The net, crypto and event enqueue paths are updated to use these helpers and to restore the saved sequence number on the enqueue retry / failure path so the DQRR entry can be reclaimed. Ordered (ORP) handling is left unchanged.

---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h     | 55 ++++++++++++++++
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 73 +++++++++++----------
 drivers/event/dpaa2/dpaa2_eventdev.c        | 53 ++++++++-------
 drivers/net/dpaa2/dpaa2_rxtx.c              | 44 +++++--------
 4 files changed, 141 insertions(+), 84 deletions(-)
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +55 -0
index 1731999257..1ee53c53a2 100644
@@ -510,6 +510,61 @@ dpaa2_mem_va_to_iova_check(void *va, uint64_t size)
 #define DPAA2_IOVA_TO_VADDR_AND_CHECK(_iova, size) \
 	rte_fslmc_cold_mem_iova_to_vaddr(_iova, size)
 
+#define dpaa2_eq_atomic_dpio_update(start, len, dpio, dqrr_size, dqrr_held) \
+({ \
+	uint16_t i; \
+	\
+	for (i = start; i < (uint16_t)(start + len); i++) { \
+		dpio->dpaa2_held_bufs.dqrr_size -= dqrr_size[i]; \
+		dpio->dpaa2_held_bufs.dqrr_held &= ~dqrr_held[i]; \
+	} \
+})
+
+#define dpaa2_mbuf_seq_restore(mbuf, restore) \
+({ \
+	*dpaa2_seqn(mbuf) = restore; \
+})
+
+#define dpaa2_mbuf_seq_is_flag_set(mbuf, flag) \
+({ \
+	*dpaa2_seqn(mbuf) & flag; \
+})
+
+#define dpaa2_eq_atomic_consume(mbuf, size, held, dpio_eq, flag, eqdesc, atomic) \
+({ \
+	uint32_t seqn; \
+	\
+	if (*dpaa2_seq_dpio_dq(mbuf) == dpio_eq) { \
+		seqn = *dpaa2_seqn(mbuf); \
+		if (eqdesc) { \
+			qbman_eq_desc_set_dca(eqdesc, 1, \
+				(seqn & QBMAN_EQCR_DCA_IDXMASK), 0); \
+		} \
+		if (flag) { \
+			*flag = seqn; \
+			*dpaa2_seqn(mbuf) = DPAA2_INVALID_MBUF_SEQN; \
+		} \
+		if (eqdesc || flag) { \
+			size = 1; \
+			held = UINT64_C(1) << (seqn & QBMAN_EQCR_DCA_IDXMASK); \
+		} \
+		atomic = true; \
+	} \
+})
+
+static inline void
+dpaa2_dq_atomic_save(const struct qbman_result *dq,
+	struct rte_mbuf *mbuf, struct dpaa2_dpio_dev *dpio_dev)
+{
+	uint8_t dqrr_index = qbman_get_dqrr_idx(dq);
+
+	*dpaa2_seqn(mbuf) = QBMAN_ENQUEUE_FLAG_DCA | dqrr_index;
+	*dpaa2_seq_dpio_dq(mbuf) = dpio_dev;
+	dpio_dev->dpaa2_held_bufs.dqrr_size++;
+	dpio_dev->dpaa2_held_bufs.dqrr_held |= UINT64_C(1) << dqrr_index;
+	dpio_dev->dpaa2_held_bufs.mbuf[dqrr_index] = mbuf;
+}
+
 static inline
 int check_swp_active_dqs(uint16_t dpio_index)
 {
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +40 -33

131 lines not on this page · raw message

drivers/event/dpaa2/dpaa2_eventdev.c +28 -25

104 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_rxtx.c +18 -26

111 lines not on this page · raw message

Signature · 1 line
2.43.0
#196 lore raw

PATCH 60/65 bus/fslmc: move enqueue response descriptors to per-queue

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Previously the enqueue (ORP) response descriptors were managed globally per DPIO device via a shared eqresp ring (eqresp, eqresp_meta, eqresp_pi/ci) together with the global helper dpaa2_free_eq_descriptors(). This coupled ordered-enqueue state to the per-core portal and required separate per-driver callbacks (cb_eqresp_free) to free the response buffers.

Rework the ordered-enqueue response handling so that each dpaa2_queue owns its own response pool via the new dpaa2_queue_eq_resp structure. Introduce common helpers in dpaa2_hw_pvt.h:

- dpaa2_queue_eqresp_create() / dpaa2_queue_eqresp_free()
- dpaa2_enq_rsp_process()
- dpaa2_eq_set_order_desc()
- dpaa2_dq_order_save() / dpaa2_mbuf_seq_order_set()

and a unified dpaa2_eqresp_cb callback type. The net and sec drivers are updated to allocate/free the per-queue pool and use the shared order-descriptor and response-processing helpers, removing the duplicated dpaa2_set_enqueue_descriptor() implementations and the old free-eqresp buffer callbacks.

---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c    |  49 ------
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h    |   5 -
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h     | 165 ++++++++++++++++++--
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c |  89 +++--------
 drivers/net/dpaa2/dpaa2_ethdev.c            |   5 +-
 drivers/net/dpaa2/dpaa2_ethdev.h            |   3 +-
 drivers/net/dpaa2/dpaa2_rxtx.c              |  87 ++---------
 7 files changed, 195 insertions(+), 208 deletions(-)
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +0 -49
index a32406b1b3..3e18082e14 100644
@@ -765,18 +765,6 @@ dpaa2_create_dpio_device(int vdev_fd,
 	io_space_count++;
 	dpio_dev->index = io_space_count;
 
-	dpio_dev->eqresp = rte_zmalloc(NULL, MAX_EQ_RESP_ENTRIES *
-				     (sizeof(struct qbman_result) +
-				     sizeof(struct eqresp_metadata)),
-				     RTE_CACHE_LINE_SIZE);
-	if (!dpio_dev->eqresp) {
-		DPAA2_BUS_ERR("Memory allocation failed for eqresp");
-		goto err;
-	}
-	dpio_dev->eqresp_meta = (struct eqresp_metadata *)(dpio_dev->eqresp +
-				MAX_EQ_RESP_ENTRIES);
-
-
 	TAILQ_INSERT_TAIL(&dpio_dev_list, dpio_dev, next);
 
 	if (!dpaa2_portal_key) {
@@ -803,7 +791,6 @@ dpaa2_create_dpio_device(int vdev_fd,
 				   dpio_dev->token);
 		}
 
-		rte_free(dpio_dev->eqresp);
 		rte_free(dpio_dev->dpio);
 	}
 
@@ -864,42 +851,6 @@ dpaa2_alloc_dq_storage(struct queue_storage_info_t *q_storage)
 	return -1;
 }
 
-RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_free_eq_descriptors)
-uint32_t
-dpaa2_free_eq_descriptors(void)
-{
-	struct dpaa2_dpio_dev *dpio_dev = DPAA2_PER_LCORE_DPIO;
-	struct qbman_result *eqresp;
-	struct eqresp_metadata *eqresp_meta;
-	struct dpaa2_queue *txq;
-
-	while (dpio_dev->eqresp_ci != dpio_dev->eqresp_pi) {
-		eqresp = &dpio_dev->eqresp[dpio_dev->eqresp_ci];
-		eqresp_meta = &dpio_dev->eqresp_meta[dpio_dev->eqresp_ci];
-
-		if (!qbman_result_eqresp_rspid(eqresp))
-			break;
-
-		if (qbman_result_eqresp_rc(eqresp)) {
-			txq = eqresp_meta->dpaa2_q;
-			txq->cb_eqresp_free(dpio_dev->eqresp_ci, txq);
-		}
-		qbman_result_eqresp_set_rspid(eqresp, 0);
-
-		dpio_dev->eqresp_ci + 1 < MAX_EQ_RESP_ENTRIES ?
-			dpio_dev->eqresp_ci++ : (dpio_dev->eqresp_ci = 0);
-	}
-
-	/* Return 1 less entry so that PI and CI are never same in a
-	 * case there all the EQ responses are in use.
-	 */
-	if (dpio_dev->eqresp_ci > dpio_dev->eqresp_pi)
-		return dpio_dev->eqresp_ci - dpio_dev->eqresp_pi - 1;
-	else
-		return dpio_dev->eqresp_ci - dpio_dev->eqresp_pi +
-			MAX_EQ_RESP_ENTRIES - 1;
-}
-
 static struct rte_dpaa2_object rte_dpaa2_dpio_obj = {
 	.dev_type = DPAA2_IO,
 	.create = dpaa2_create_dpio_device,
drivers/bus/fslmc/portal/dpaa2_hw_dpio.h +0 -5
index c61f8ee0a2..61ed9e0421 100644
@@ -65,11 +65,6 @@ __rte_internal
 void
 dpaa2_free_dq_storage(struct queue_storage_info_t *q_storage);
 
-/* free the enqueue response descriptors */
-__rte_internal
-uint32_t
-dpaa2_free_eq_descriptors(void);
-
 __rte_internal
 struct dpaa2_dpio_dev *
 rte_dpaa2_alloc_dpio_device(int isr, uint32_t threshold,
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +152 -13

223 lines not on this page · raw message

drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +23 -66

165 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.c +4 -1
index 85c93bf422..b75625dc01 100644
@@ -1192,6 +1192,7 @@ dpaa2_free_rx_tx_queues(struct rte_eth_dev *dev)
 		/* cleanup tx queue cscn */
 		for (i = 0; i < priv->nb_tx_queues; i++) {
 			dpaa2_q = priv->tx_vq[i];
+			dpaa2_queue_eqresp_free(dpaa2_q);
 			rte_free(dpaa2_q->cscn);
 			priv->tx_vq[i] = NULL;
 		}
@@ -1858,7 +1859,9 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev,
 			return ret;
 		}
 	}
-	dpaa2_q->cb_eqresp_free = dpaa2_dev_free_eqresp_buf;
+	ret = dpaa2_queue_eqresp_create(dpaa2_q, dpaa2_dev_eqresp_cb);
+	if (ret)
+		return ret;
 	dev->data->tx_queues[tx_queue_id] = dpaa2_q;
 
 	if (priv->tx_conf_type != DPAA2_TX_NO_CONF) {
drivers/net/dpaa2/dpaa2_ethdev.h +2 -1
index caf3fabee7..491ad78d85 100644
@@ -977,7 +977,8 @@ __rte_internal
 uint16_t dpaa2_dev_tx_multi_txq_ordered(struct dpaa2_queue **dpaa2_q,
 	struct rte_mbuf **bufs, uint16_t nb_pkts);
 
-void dpaa2_dev_free_eqresp_buf(uint16_t eqresp_ci, struct dpaa2_queue *dpaa2_q);
+void dpaa2_dev_eqresp_cb(const struct qbman_fd *fd,
+	struct dpaa2_queue *dpaa2_q, struct rte_mbuf **pm);
 void dpaa2_flow_clean(struct rte_eth_dev *dev, uint8_t tc_id,
 	enum dpaa2_flow_dist_type type);
 uint16_t dpaa2_dev_tx_conf(struct dpaa2_queue *tx_conf_q, int drain);
drivers/net/dpaa2/dpaa2_rxtx.c +14 -73

139 lines not on this page · raw message

Signature · 1 line
2.43.0
#197 lore raw

PATCH 61/65 event/dpaa2: add ordered schedule type support

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The dpaa2 eventdev supported only PARALLEL and ATOMIC schedule types. Each schedule type uses its own DPCI Tx queue (dpci_txqs[] indexed by event->sched_type) attached with a dedicated dequeue callback, and the ORDERED slot was left unimplemented (marked TODO).

Add RTE_SCHED_TYPE_ORDERED support:

- Attach the ordered DPCI queue (dpci_txqs[RTE_SCHED_TYPE_ORDERED]) with a new dequeue callback dpaa2_eventdev_process_order() that saves the ORP context via dpaa2_dq_order_save().
- Advertise RTE_EVENT_DEV_CAP_NONSEQ_MODE and accept RTE_SCHED_TYPE_ORDERED in queue setup.
- Handle the ORP flag in the enqueue path via

    dpaa2_eq_set_order_desc().

Also optimize the Tx adapter enqueue path to use rte_eth_tx_burst() directly when all packets target the same queue and no ordered/atomic (ORP or DCA) handling is required, falling back to dpaa2_dev_tx_multi_txq_ordered() otherwise. The DPCI attach error logs are reworded from "RX" to "qp" for clarity.

---
 drivers/event/dpaa2/dpaa2_eventdev.c | 84 +++++++++++++++++++++-------
 1 file changed, 65 insertions(+), 19 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev.c +65 -19
index 8ad9fe7d30..a03b04a057 100644
@@ -178,18 +178,29 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
 
 			/* Prepare enqueue descriptor */
 			qbman_eq_desc_clear(&eqdesc[loop]);
-			qbman_eq_desc_set_fq(&eqdesc[loop], dpci_txq[loop]->fqid);
-			qbman_eq_desc_set_no_orp(&eqdesc[loop], 0);
-			qbman_eq_desc_set_response(&eqdesc[loop], 0, 0);
 			flags[loop] = 0;
 			dqrr_held[loop] = 0;
 			dqrr_size[loop] = 0;
 
-			if (event->sched_type == RTE_SCHED_TYPE_ATOMIC &&
-				dpaa2_mbuf_seq_is_flag_set(event->mbuf, QBMAN_ENQUEUE_FLAG_DCA)) {
-				dpaa2_eq_atomic_consume(event->mbuf, dqrr_size[loop],
-					dqrr_held[loop], dpio_dev, &flags[loop],
-					&eqdesc[loop], atomic);
+			if (event->sched_type == RTE_SCHED_TYPE_ORDERED &&
+				dpaa2_mbuf_seq_is_flag_set(event->mbuf, DPAA2_ENQUEUE_FLAG_ORP)) {
+				ret = dpaa2_eq_set_order_desc(dpci_txq[loop], event->mbuf,
+					&eqdesc[loop], true);
+				if (ret) {
+					rte_mempool_put(dpci_txq[loop]->env_pool, ev_tx[loop]);
+					goto send_partial;
+				}
+			} else {
+				if (event->sched_type == RTE_SCHED_TYPE_ATOMIC &&
+					dpaa2_mbuf_seq_is_flag_set(event->mbuf,
+					QBMAN_ENQUEUE_FLAG_DCA)) {
+					dpaa2_eq_atomic_consume(event->mbuf, dqrr_size[loop],
+						dqrr_held[loop], dpio_dev, &flags[loop],
+						&eqdesc[loop], atomic);
+				}
+				qbman_eq_desc_set_fq(&eqdesc[loop], dpci_txq[loop]->fqid);
+				qbman_eq_desc_set_no_orp(&eqdesc[loop], 0);
+				qbman_eq_desc_set_response(&eqdesc[loop], 0, 0);
 			}
 
 			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
@@ -258,16 +269,23 @@ static void dpaa2_eventdev_dequeue_wait(struct dpaa2_dpio_dev *dpio_dev,
 	DPAA2_PMD_DP_DEBUG("%s: poll return(%d)", __func__, ret);
 }
 
-static void dpaa2_eventdev_process_parallel(struct dpaa2_dpio_dev *dpio_dev,
-	const struct qbman_fd *fd, const struct qbman_result *dq,
+static inline void
+dpaa2_eventdev_rx_get_event(const struct qbman_fd *fd,
 	struct dpaa2_queue *rxq, struct rte_event *ev)
 {
 	struct rte_event *rx_ev = (void *)DPAA2_GET_FD_ADDR(fd);
-	struct qbman_swp *swp = dpio_dev->sw_portal;
 
 	rte_memcpy(ev, rx_ev, sizeof(struct rte_event));
 	rte_mempool_put(rxq->env_pool, rx_ev);
+}
 
+static void dpaa2_eventdev_process_parallel(struct dpaa2_dpio_dev *dpio_dev,
+	const struct qbman_fd *fd, const struct qbman_result *dq,
+	struct dpaa2_queue *rxq, struct rte_event *ev)
+{
+	struct qbman_swp *swp = dpio_dev->sw_portal;
+
+	dpaa2_eventdev_rx_get_event(fd, rxq, ev);
 	qbman_swp_dqrr_consume(swp, dq);
 }
 
@@ -275,13 +293,21 @@ static void dpaa2_eventdev_process_atomic(struct dpaa2_dpio_dev *dpio_dev,
 	const struct qbman_fd *fd, const struct qbman_result *dq,
 	struct dpaa2_queue *rxq, struct rte_event *ev)
 {
-	struct rte_event *rx_ev = (void *)DPAA2_GET_FD_ADDR(fd);
-
-	rte_memcpy(ev, rx_ev, sizeof(struct rte_event));
-	rte_mempool_put(rxq->env_pool, rx_ev);
+	dpaa2_eventdev_rx_get_event(fd, rxq, ev);
 	dpaa2_dq_atomic_save(dq, ev->mbuf, dpio_dev);
 }
 
+static void dpaa2_eventdev_process_order(struct dpaa2_dpio_dev *dpio_dev,
+	const struct qbman_fd *fd, const struct qbman_result *dq,
+	struct dpaa2_queue *rxq, struct rte_event *ev)
+{
+	struct qbman_swp *swp = dpio_dev->sw_portal;
+
+	dpaa2_eventdev_rx_get_event(fd, rxq, ev);
+	dpaa2_dq_order_save(dq, ev->mbuf);
+	qbman_swp_dqrr_consume(swp, dq);
+}
+
 static uint16_t
 dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[],
 	uint16_t nb_events, uint64_t timeout_ticks)
@@ -439,6 +465,7 @@ dpaa2_eventdev_info_get(struct rte_eventdev *dev,
 		RTE_EVENT_DEV_CAP_RUNTIME_PORT_LINK |
 		RTE_EVENT_DEV_CAP_MULTIPLE_QUEUE_PORT |
 		RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES |
+		RTE_EVENT_DEV_CAP_NONSEQ_MODE |
 		RTE_EVENT_DEV_CAP_CARRY_FLOW_ID |
 		RTE_EVENT_DEV_CAP_MAINTENANCE_FREE;
 	dev_info->max_profiles_per_port = 1;
@@ -653,6 +680,7 @@ dpaa2_eventdev_queue_setup(struct rte_eventdev *dev, uint8_t queue_id,
 	switch (queue_conf->schedule_type) {
 	case RTE_SCHED_TYPE_PARALLEL:
 	case RTE_SCHED_TYPE_ATOMIC:
+	case RTE_SCHED_TYPE_ORDERED:
 		break;
 	default:
 		DPAA2_EVENTDEV_ERR("Schedule type(%d) is not supported.",
@@ -1169,6 +1197,7 @@ dpaa2_eventdev_txa_enqueue(void *port,
 	struct dpaa2_queue *txq[MAX_TX_RING_SLOTS];
 	struct rte_mbuf *m[MAX_TX_RING_SLOTS];
 	uint16_t sent = 0, burst, i, port_id, qid;
+	int same_q, order;
 
 	RTE_SET_USED(port);
 
@@ -1176,15 +1205,25 @@ dpaa2_eventdev_txa_enqueue(void *port,
 	 * on-stack burst array, so transmit in ring-sized chunks.
 	 */
 	while (sent < nb_events) {
+		same_q = true;
+		order = false;
 		burst = RTE_MIN(nb_events - sent, (uint16_t)RTE_DIM(m));
 		for (i = 0; i < burst; i++) {
 			m[i] = ev[sent + i].mbuf;
 			port_id = m[i]->port;
 			qid = rte_event_eth_tx_adapter_txq_get(m[i]);
 			txq[i] = rte_eth_devices[port_id].data->tx_queues[qid];
+			if (same_q && i > 0 && txq[i] != txq[i - 1])
+				same_q = false;
+			if (!order && dpaa2_mbuf_seq_is_flag_set(m[i],
+				(DPAA2_ENQUEUE_FLAG_ORP | QBMAN_ENQUEUE_FLAG_DCA)))
+				order = true;
 		}
 
-		i = dpaa2_dev_tx_multi_txq_ordered(txq, m, burst);
+		if (same_q && !order && burst > 0)
+			i = rte_eth_tx_burst(port_id, qid, m, burst);
+		else
+			i = dpaa2_dev_tx_multi_txq_ordered(txq, m, burst);
 		sent += i;
 		if (i < burst)
 			break;
@@ -1283,7 +1322,7 @@ dpaa2_eventdev_create(const char *name, struct rte_vdev_device *vdev)
 			dpaa2_eventdev_process_parallel,
 			&evq_info->dpci_txqs[RTE_SCHED_TYPE_PARALLEL]);
 		if (ret) {
-			DPAA2_EVENTDEV_ERR("DPCI attach parallel RX failed: err(%d)", ret);
+			DPAA2_EVENTDEV_ERR("DPCI attach parallel qp failed: err(%d)", ret);
 			goto err_break;
 		}
 
@@ -1292,11 +1331,18 @@ dpaa2_eventdev_create(const char *name, struct rte_vdev_device *vdev)
 			dpaa2_eventdev_process_atomic,
 			&evq_info->dpci_txqs[RTE_SCHED_TYPE_ATOMIC]);
 		if (ret) {
-			DPAA2_EVENTDEV_ERR("DPCI attach atomic RX failed: err(%d)", ret);
+			DPAA2_EVENTDEV_ERR("DPCI attach atomic qp failed: err(%d)", ret);
 			goto err_break;
 		}
 
-		/** TO DO: order schedule.*/
+		ret = rte_dpaa2_dpci_link_attach(dpci_dev, DPCI_DEST_DPCON,
+			dpcon_dev->dpcon_id, 0,
+			dpaa2_eventdev_process_order,
+			&evq_info->dpci_txqs[RTE_SCHED_TYPE_ORDERED]);
+		if (ret) {
+			DPAA2_EVENTDEV_ERR("DPCI attach order qp failed: err(%d)", ret);
+			goto err_break;
+		}
 
 		evq_info->valid = true;
 		evq_info->event_queue_id = priv->max_event_queues;
Signature · 1 line
2.43.0
#198 lore raw

PATCH 62/65 bus/fslmc: make DPAA2 ORP/ODP ordering per-queue instead of per-device

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The DPAA2 ORP (Order Restoration Point) / ODP ordering state used to be tracked with device-wide flags (en_ordered / en_loose_ordered in both dpaa2_sec_dev_private and dpaa2_dev_priv). That is fundamentally wrong:
ORP/ODP is a per-queue property on DPAA2 hardware -- different RX queues on the same DPNI / DPSECI / DPCI can independently be configured as unordered, atomic (hold-active), loose-ORP or strict-ORP. Collapsing it to a single per-device flag meant the first queue's ordering mode silently dictated the behavior of all others, and prevented mixing ordering modes on one device.

This patch moves the ordering mode onto struct dpaa2_queue itself and refactors all DPAA2 drivers to consult that per-queue field on both the RX (dequeue/order-save) and TX (enqueue/order-restore) paths.

Main changes:

- drivers/bus/fslmc (common):
* New enum dpaa2_queue_order_type { NONE, HOLD_ACTIVE, LOOSE_ORP, STRICT_ORP } and a matching order_type field in struct dpaa2_queue -- this is now the single source of truth, per queue.
* New dpaa2_orp_config_helper() centralizing struct opr_cfg setup (oprrws per SoC, oa, olws, oeane, oloe) for strict vs loose ORP, replacing three near-identical copies that lived in the sec/eth drivers.
* Encode the strict/loose bit into the mbuf seqn (new DPAA2_EQCR_STRICT_SHIFT/MASK; OPRID mask narrowed to 0x1FFF to make room). dpaa2_mbuf_seq_order_set() and dpaa2_dq_order_save() now carry the per-queue ordering type end-to-end, so TX no longer has to look up any device-level flag.
* dpaa2_eq_set_order_desc() derives the ORP response/strict flag from the mbuf seqn instead of a per-call loose_ordered argument.
* rte_dpaa2_dpci_link_attach() gains an order_type parameter and programs DPCI_QUEUE_OPT_HOLD_ACTIVE / order_preservation_en / dpci_set_opr() per queue, recording the result on that RX queue.

- drivers/crypto/dpaa2_sec:
* Remove device-wide en_ordered from dpaa2_sec_dev_private.
* dpaa2_sec_eventq_attach() uses dpaa2_orp_config_helper() and stores the chosen order_type on the SEC qp's rx_vq.
* Ordered enqueue and dpaa2_sec_process_ordered_event() consult the per-queue order_type rather than the removed device flags.

- drivers/event/dpaa2:
* Pass the appropriate per-queue order_type (NONE / HOLD_ACTIVE / LOOSE_ORP) when attaching parallel/atomic/ordered DPCI queues.
* Enqueue and process-order paths use the new per-queue API.

- drivers/net/dpaa2:
* Remove en_ordered / en_loose_ordered from dpaa2_dev_priv.
* dpaa2_eth_eventq_attach() uses dpaa2_orp_config_helper(), honoring DPAA2_STRICT_ORDERING_ENABLE, and records the resulting order_type on the specific RXQ being attached.
* tx_multi_txq_ordered() and process_ordered_event() use the per-queue order_type instead of device-level flags.

---
 doc/guides/nics/dpaa2.rst                   |  4 +
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c    | 81 +++++++++++++++++----
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h     | 56 ++++++++++++--
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 41 ++++-------
 drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h   |  1 -
 drivers/event/dpaa2/dpaa2_eventdev.c        | 10 +--
 drivers/event/dpaa2/dpaa2_scheduler.c       |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c            | 44 ++++-------
 drivers/net/dpaa2/dpaa2_ethdev.h            |  4 +-
 drivers/net/dpaa2/dpaa2_rxtx.c              |  8 +-
 10 files changed, 158 insertions(+), 93 deletions(-)
doc/guides/nics/dpaa2.rst +4 -0
index 6c67a76f12..4d927cefc2 100644
@@ -503,6 +503,10 @@ Refer to the document :doc:`build_and_test` for details.
   create, destroy and update operations.
   e.g. ``fslmc:dpni.1,drv_flow_api_debug=1``
 
+* Use dev arg option ``drv_queue_strict_order=1`` to enable strict ordering on
+  the ordered event queue.
+  e.g. ``fslmc:dpni.1,drv_queue_strict_order=1``
+
 * Use dev arg option  ``drv_error_queue=1`` to enable Packets in Error queue.
   DPAA2 hardware drops the error packet in hardware. This option enables the
   hardware to not drop the error packet and let the driver dump the error
drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +68 -13

115 lines not on this page · raw message

drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +48 -8

120 lines not on this page · raw message

drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +13 -28

82 lines not on this page · raw message

drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h +0 -1
index f29817f456..2995aec943 100644
@@ -39,7 +39,6 @@ struct dpaa2_sec_dev_private {
 	uint16_t token; /**< Token required by DPxxx objects */
 	unsigned int max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
-	uint8_t en_ordered;
 	uint8_t en_loose_ordered;
 	enum dpaa2_sec_dump_levels dump_level;
 };
drivers/event/dpaa2/dpaa2_eventdev.c +5 -5
index a03b04a057..011883bba8 100644
@@ -185,7 +185,7 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
 			if (event->sched_type == RTE_SCHED_TYPE_ORDERED &&
 				dpaa2_mbuf_seq_is_flag_set(event->mbuf, DPAA2_ENQUEUE_FLAG_ORP)) {
 				ret = dpaa2_eq_set_order_desc(dpci_txq[loop], event->mbuf,
-					&eqdesc[loop], true);
+					&eqdesc[loop]);
 				if (ret) {
 					rte_mempool_put(dpci_txq[loop]->env_pool, ev_tx[loop]);
 					goto send_partial;
@@ -304,7 +304,7 @@ static void dpaa2_eventdev_process_order(struct dpaa2_dpio_dev *dpio_dev,
 	struct qbman_swp *swp = dpio_dev->sw_portal;
 
 	dpaa2_eventdev_rx_get_event(fd, rxq, ev);
-	dpaa2_dq_order_save(dq, ev->mbuf);
+	dpaa2_dq_order_save(dq, ev->mbuf, rxq->order_type);
 	qbman_swp_dqrr_consume(swp, dq);
 }
 
@@ -1319,7 +1319,7 @@ dpaa2_eventdev_create(const char *name, struct rte_vdev_device *vdev)
 
 		ret = rte_dpaa2_dpci_link_attach(dpci_dev, DPCI_DEST_DPCON,
 			dpcon_dev->dpcon_id, 0,
-			dpaa2_eventdev_process_parallel,
+			dpaa2_eventdev_process_parallel, DPAA2_QUEUE_NONE_ORDER,
 			&evq_info->dpci_txqs[RTE_SCHED_TYPE_PARALLEL]);
 		if (ret) {
 			DPAA2_EVENTDEV_ERR("DPCI attach parallel qp failed: err(%d)", ret);
@@ -1328,7 +1328,7 @@ dpaa2_eventdev_create(const char *name, struct rte_vdev_device *vdev)
 
 		ret = rte_dpaa2_dpci_link_attach(dpci_dev, DPCI_DEST_DPCON,
 			dpcon_dev->dpcon_id, 0,
-			dpaa2_eventdev_process_atomic,
+			dpaa2_eventdev_process_atomic, DPAA2_QUEUE_HOLD_ACTIVE_ORDER,
 			&evq_info->dpci_txqs[RTE_SCHED_TYPE_ATOMIC]);
 		if (ret) {
 			DPAA2_EVENTDEV_ERR("DPCI attach atomic qp failed: err(%d)", ret);
@@ -1337,7 +1337,7 @@ dpaa2_eventdev_create(const char *name, struct rte_vdev_device *vdev)
 
 		ret = rte_dpaa2_dpci_link_attach(dpci_dev, DPCI_DEST_DPCON,
 			dpcon_dev->dpcon_id, 0,
-			dpaa2_eventdev_process_order,
+			dpaa2_eventdev_process_order, DPAA2_QUEUE_LOOSE_ORP_ORDER,
 			&evq_info->dpci_txqs[RTE_SCHED_TYPE_ORDERED]);
 		if (ret) {
 			DPAA2_EVENTDEV_ERR("DPCI attach order qp failed: err(%d)", ret);
drivers/event/dpaa2/dpaa2_scheduler.c +1 -1
index a80ec05add..325c23e1dc 100644
@@ -158,7 +158,7 @@ dpaa2_scheduler_dpci_recv(struct dpaa2_sch_dev *sch_dev,
 	dpcon_dev = sch_dev->dpcon_dev[cpu];
 	dpci_dev = sch_dev->dpci_dev[cpu];
 	ret = rte_dpaa2_dpci_link_attach(dpci_dev, DPCI_DEST_DPCON,
-		dpcon_dev->dpcon_id, 0, NULL, NULL);
+		dpcon_dev->dpcon_id, 0, NULL, DPAA2_QUEUE_NONE_ORDER, NULL);
 	if (ret) {
 		DPAA2_EVENTDEV_ERR("DPCI link attaches dpcon failed: err(%d)", ret);
 		return 0;
drivers/net/dpaa2/dpaa2_ethdev.c +14 -30

71 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.h +2 -2
index 491ad78d85..33f78d310a 100644
@@ -115,6 +115,8 @@
 
 #define DPAA2_FLOW_API_DEBUG_FLAG RTE_BIT32(16)
 
+#define DPAA2_QUEUE_STRICT_ORDER_FLAG RTE_BIT32(17)
+
 /* DPDMUX index for DPMAC */
 #define DPAA2_DPDMUX_DPMAC_IDX 0
 
@@ -401,8 +403,6 @@ struct dpaa2_dev_priv {
 	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;
 	/** RXQs in same TC share same cgid.*/
 	uint8_t cgid_in_use[MAX_TCS];
drivers/net/dpaa2/dpaa2_rxtx.c +3 -5
index fec046deaf..2af5a4745d 100644
@@ -1250,7 +1250,7 @@ dpaa2_dev_process_ordered_event(struct dpaa2_dpio_dev *dpio_dev,
 	else
 		ev->mbuf = dpaa2_eth_fd_to_mbuf(rxq->eth_data->dev_private, fd);
 
-	dpaa2_dq_order_save(dq, ev->mbuf);
+	dpaa2_dq_order_save(dq, ev->mbuf, rxq->order_type);
 
 	qbman_swp_dqrr_consume(swp, dq);
 }
@@ -1731,10 +1731,8 @@ dpaa2_dev_tx_multi_txq_ordered(struct dpaa2_queue **dpaa2_q,
 
 		dqrr_held[loop] = 0;
 		dqrr_size[loop] = 0;
-		if (dpaa2_mbuf_seq_is_flag_set(bufs[loop], DPAA2_ENQUEUE_FLAG_ORP) &&
-			priv->en_ordered) {
-			ret = dpaa2_eq_set_order_desc(priv->tx_vq[0], bufs[loop], &eqdesc[loop],
-				priv->en_loose_ordered);
+		if (dpaa2_mbuf_seq_is_flag_set(bufs[loop], DPAA2_ENQUEUE_FLAG_ORP)) {
+			ret = dpaa2_eq_set_order_desc(priv->tx_vq[0], bufs[loop], &eqdesc[loop]);
 			if (ret)
 				goto send_frames;
 		} else {
Signature · 1 line
2.43.0
#199 lore raw

PATCH 63/65 event/dpaa2: support multi-port enqueue in selftest random event generator

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The DPAA2 eventdev selftest helper generate_random_events() used to hard-code port 0 both as the only port linked to all queues and as the source port for every enqueued event. That worked for the single-port tests but made it impossible to exercise the multi-port dequeue path
correctly: test_multi_queue_enq_multi_port_deq() was enqueuing all events from port 0 while expecting workers on every port to drain them, which does not match how real multi-port setups are configured.

Rework the helper and its callers so that ordering/port fan-out is driven by the test, not baked into the generator:

- generate_random_events() now takes an array of port ids and a port count. It links the full queue set to each of those ports and round-robins the source port of generated events across them (rte_rand() % nr_ports) instead of always using port 0.

- test_multi_queue_enq_single_port_deq() and test_dev_stop_flush() pass a single-element {0} array, preserving their previous behavior.

- test_multi_queue_enq_multi_port_deq() queries the device port count (capped at MAX_PORTS), builds the port id array, and only then generates events, so events are actually spread across all ports that workers will dequeue from.

Also split the teardown for test_dev_stop_flush: because the stop-flush callback already frees mbufs back to the pool, calling the standard eventdev_teardown() (which does extra cleanup assuming a live mempool state) was fragile. Introduce eventdev_stop_flush_teardown() that only frees the mempool, and wire it into the DPAA2_TEST_RUN entry for test_dev_stop_flush.

No functional change for the single-port tests; the multi-port test now actually tests multi-port enqueue + multi-port dequeue.

---
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c | 44 ++++++++++++-------
 1 file changed, 29 insertions(+), 15 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev_selftest.c +29 -15
index 569621dc39..6162932a5c 100644
@@ -227,6 +227,12 @@ eventdev_teardown(void)
 	rte_mempool_free(eventdev_test_mempool);
 }
 
+static void
+eventdev_stop_flush_teardown(void)
+{
+	rte_mempool_free(eventdev_test_mempool);
+}
+
 static void
 update_event_and_validation_attr(struct rte_mbuf *m, struct rte_event *ev,
 	uint32_t flow_id, uint8_t event_type,
@@ -305,7 +311,8 @@ check_excess_events(uint8_t port)
 }
 
 static int
-generate_random_events(const unsigned int total_events)
+generate_random_events(const uint32_t total_events,
+	uint8_t port_ids[], uint32_t nr_ports)
 {
 	struct rte_event_dev_info info;
 	uint32_t queue_count, i;
@@ -320,10 +327,11 @@ generate_random_events(const unsigned int total_events)
 	for (i = 0; i < queue_count; i++)
 		queues[i] = i;
 
-	ret = rte_event_port_link(evdev, 0, queues, NULL,
-			queue_count);
-	RTE_TEST_ASSERT(ret >= 0, "Failed to link %d queues port0",
-		queue_count);
+	for (i = 0; i < nr_ports; i++) {
+		ret = rte_event_port_link(evdev, port_ids[i], queues, NULL, queue_count);
+		RTE_TEST_ASSERT(ret >= 0, "Failed to link %d queues port.%d",
+			queue_count, port_ids[i]);
+	}
 
 	ret = rte_event_dev_info_get(evdev, &info);
 	RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
@@ -333,7 +341,7 @@ generate_random_events(const unsigned int total_events)
 			rte_rand() % 256 /* sub_event_type */,
 			rte_rand() % (RTE_SCHED_TYPE_PARALLEL + 1),
 			rte_rand() % queue_count,
-			0 /* port */,
+			rte_rand() % nr_ports,
 			1 /* events */);
 		if (ret)
 			return ret;
@@ -341,7 +349,6 @@ generate_random_events(const unsigned int total_events)
 	return ret;
 }
 
-
 static int
 validate_event(struct rte_event *ev)
 {
@@ -475,8 +482,9 @@ test_multi_queue_enq_single_port_deq(void)
 {
 	int ret;
 	uint32_t dq_events;
+	uint8_t port_id = 0;
 
-	ret = generate_random_events(MAX_EVENTS);
+	ret = generate_random_events(MAX_EVENTS, &port_id, 1);
 	if (ret)
 		return ret;
 
@@ -608,13 +616,10 @@ static int
 test_multi_queue_enq_multi_port_deq(void)
 {
 	const unsigned int total_events = MAX_EVENTS;
-	uint32_t nr_ports;
+	uint32_t nr_ports, i;
+	uint8_t port_ids[MAX_PORTS];
 	int ret;
 
-	ret = generate_random_events(total_events);
-	if (ret)
-		return ret;
-
 	RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev,
 		RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports),
 		"Port count get failed");
@@ -625,6 +630,14 @@ test_multi_queue_enq_multi_port_deq(void)
 			__func__, nr_ports, rte_lcore_count() - 1);
 		return -EINVAL;
 	}
+	if (nr_ports > MAX_PORTS)
+		nr_ports = MAX_PORTS;
+
+	for (i = 0; i < nr_ports; i++)
+		port_ids[i] = i;
+	ret = generate_random_events(total_events, port_ids, nr_ports);
+	if (ret)
+		return ret;
 
 	return launch_workers_and_wait(worker_multi_port_fn,
 				worker_multi_port_fn, total_events,
@@ -646,8 +659,9 @@ test_dev_stop_flush(void)
 {
 	unsigned int total_events = MAX_EVENTS, count = 0;
 	int ret;
+	uint8_t port_id = 0;
 
-	ret = generate_random_events(total_events);
+	ret = generate_random_events(total_events, &port_id, 1);
 	if (ret)
 		return -1;
 
@@ -861,7 +875,7 @@ test_eventdev_dpaa2(void)
 			test_simple_enqdeq_parallel);
 	DPAA2_TEST_RUN(eventdev_setup, eventdev_teardown,
 			test_multi_queue_enq_single_port_deq);
-	DPAA2_TEST_RUN(eventdev_setup, eventdev_teardown,
+	DPAA2_TEST_RUN(eventdev_setup, eventdev_stop_flush_teardown,
 			test_dev_stop_flush);
 	DPAA2_TEST_RUN(eventdev_atomic_port_setup, eventdev_teardown,
 			test_multi_queue_enq_multi_port_deq);
Signature · 1 line
2.43.0
#200 lore raw

PATCH 64/65 event/dpaa2: do not fail device creation on DPCI errors

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Event device creation aborted entirely whenever a DPCI object could not be allocated for an event queue, or when any of the parallel, atomic or ordered link attaches failed. A single failure rolled back every queue and made dpaa2_eventdev_create() return an error.

This is too strict. The DPNI and DPSEC event adapters can still be registered and used even when the DPCI-backed event queues are not available, so a DPCI shortage or attach failure must not bring the whole event device down.

---
 drivers/event/dpaa2/dpaa2_eventdev.c | 68 +++++++++++++---------------
 1 file changed, 31 insertions(+), 37 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev.c +31 -37
index 011883bba8..5c36cb9dc9 100644
@@ -1278,14 +1278,13 @@ dpaa2_eventdev_create(const char *name, struct rte_vdev_device *vdev)
 	struct dpaa2_dpcon_dev *dpcon_dev = NULL;
 	struct dpaa2_dpci_dev *dpci_dev = NULL;
 	struct dpaa2_eventq *evq_info;
-	int ret = 0, i;
+	int ret, i, success;
 
 	eventdev = rte_event_pmd_vdev_init(name,
 		sizeof(struct dpaa2_eventdev), rte_socket_id(), vdev);
 	if (!eventdev) {
-		ret = -ENOMEM;
 		DPAA2_EVENTDEV_ERR("Failed to create Event device %s", name);
-		goto done;
+		return -ENOMEM;
 	}
 
 	eventdev->dev_ops = &dpaa2_eventdev_ops;
@@ -1312,66 +1311,61 @@ dpaa2_eventdev_create(const char *name, struct rte_vdev_device *vdev)
 
 		dpci_dev = rte_dpaa2_alloc_dpci_dev();
 		if (!dpci_dev) {
-			rte_dpaa2_free_dpcon_dev(dpcon_dev);
-			break;
+			DPAA2_EVENTDEV_WARN("No dpci available for evq.%d", i);
+			goto skip_dpci_attach;
 		}
-		evq_info->dpci = dpci_dev;
 
+		success = 0;
 		ret = rte_dpaa2_dpci_link_attach(dpci_dev, DPCI_DEST_DPCON,
 			dpcon_dev->dpcon_id, 0,
 			dpaa2_eventdev_process_parallel, DPAA2_QUEUE_NONE_ORDER,
 			&evq_info->dpci_txqs[RTE_SCHED_TYPE_PARALLEL]);
-		if (ret) {
-			DPAA2_EVENTDEV_ERR("DPCI attach parallel qp failed: err(%d)", ret);
-			goto err_break;
-		}
+		if (ret)
+			DPAA2_EVENTDEV_WARN("DPCI attach parallel qp failed: err(%d)", ret);
+		else
+			success++;
 
 		ret = rte_dpaa2_dpci_link_attach(dpci_dev, DPCI_DEST_DPCON,
 			dpcon_dev->dpcon_id, 0,
 			dpaa2_eventdev_process_atomic, DPAA2_QUEUE_HOLD_ACTIVE_ORDER,
 			&evq_info->dpci_txqs[RTE_SCHED_TYPE_ATOMIC]);
-		if (ret) {
-			DPAA2_EVENTDEV_ERR("DPCI attach atomic qp failed: err(%d)", ret);
-			goto err_break;
-		}
+		if (ret)
+			DPAA2_EVENTDEV_WARN("DPCI attach atomic qp failed: err(%d)", ret);
+		else
+			success++;
 
 		ret = rte_dpaa2_dpci_link_attach(dpci_dev, DPCI_DEST_DPCON,
 			dpcon_dev->dpcon_id, 0,
 			dpaa2_eventdev_process_order, DPAA2_QUEUE_LOOSE_ORP_ORDER,
 			&evq_info->dpci_txqs[RTE_SCHED_TYPE_ORDERED]);
-		if (ret) {
-			DPAA2_EVENTDEV_ERR("DPCI attach order qp failed: err(%d)", ret);
-			goto err_break;
-		}
+		if (ret)
+			DPAA2_EVENTDEV_WARN("DPCI attach order qp failed: err(%d)", ret);
+		else
+			success++;
+
+		if (success)
+			evq_info->dpci = dpci_dev;
+		else
+			rte_dpaa2_free_dpci_dev(dpci_dev);
 
+skip_dpci_attach:
 		evq_info->valid = true;
 		evq_info->event_queue_id = priv->max_event_queues;
 
 		priv->max_event_queues++;
-		continue;
-err_break:
-		if (evq_info->dpcon)
-			rte_dpaa2_free_dpcon_dev(evq_info->dpcon);
-		if (evq_info->dpci)
-			rte_dpaa2_free_dpci_dev(evq_info->dpci);
-		break;
 	}
 
 done:
-	if (ret && priv) {
-		for (i = 0; i < priv->max_event_queues; i++) {
-			evq_info = &priv->evq_info[i];
-			if (evq_info->dpcon)
-				rte_dpaa2_free_dpcon_dev(evq_info->dpcon);
-			if (evq_info->dpci)
-				rte_dpaa2_free_dpci_dev(evq_info->dpci);
-		}
-	}
+	ret = 0;
 	event_dev_probing_finish(eventdev);
-	if (ret)
-		DPAA2_EVENTDEV_ERR("Failed(%d) to create event device(%s)", ret, name);
-	else
+	if (priv && !priv->max_event_queues) {
+		ret = -ENODEV;
+		DPAA2_EVENTDEV_ERR("Failed to create event device(%s)", name);
+	} else if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		DPAA2_EVENTDEV_INFO("Create event device(%s)", name);
+	} else {
+		DPAA2_EVENTDEV_INFO("Attach event device(%s)", name);
+	}
 
 	return ret;
 }
Signature · 1 line
2.43.0
#201 lore raw

PATCH 65/65 net/dpaa2: add Tx fast path for no-confirmation case

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Split a dedicated Tx fast path out of dpaa2_dev_tx() for the common no-confirmation configuration, keeping the hot enqueue loop free of the Tx-conf and timestamp bookkeeping needed only by the slow path.

- Add dpaa2_dev_tx_fast() for the DPAA2_TX_NO_CONF case. dpaa2_dev_tx() builds the enqueue descriptor and dispatches straight to it, so the common path no longer runs the per-burst Tx-conf drain or the per-packet timestamp accounting.
- Factor the retry enqueue loop into dpaa2_dev_tx_enqueue_multiple() and the ordered-queue tail into dpaa2_dev_tx_multi_ordered(), shared by both the fast and slow paths to remove duplicated code.
- Zero-initialise fd_arr in the slow path and mark the rarely taken branches (congestion retry, VLAN insert, ordered, timestamp) unlikely.

This reduces per-packet work on the common Tx path.

---
 drivers/net/dpaa2/dpaa2_rxtx.c | 158 +++++++++++++++++++++++++--------
 1 file changed, 122 insertions(+), 36 deletions(-)
drivers/net/dpaa2/dpaa2_rxtx.c +122 -36
index 2af5a4745d..312c9bd7d5 100644
@@ -1511,6 +1511,114 @@ dpaa2_dev_tx_ordered(void *queue, struct rte_mbuf **bufs,
 	return dpaa2_dev_tx_multi_txq_ordered(mq, bufs, nb_pkts);
 }
 
+static __rte_always_inline uint16_t __rte_hot
+dpaa2_dev_tx_enqueue_multiple(struct qbman_swp *swp,
+	const struct qbman_fd *fd, uint16_t to_send,
+	const struct qbman_eq_desc *eqdesc)
+{
+	uint16_t loop = 0, retry_count = 0;
+	int eq_ret;
+
+	while (loop < to_send) {
+		eq_ret = qbman_swp_enqueue_multiple(swp, eqdesc,
+			&fd[loop], NULL, to_send - loop);
+		if (unlikely(eq_ret < 0)) {
+			retry_count++;
+			if (retry_count > DPAA2_MAX_TX_RETRY_COUNT)
+				break;
+		} else {
+			loop += eq_ret;
+			retry_count = 0;
+		}
+	}
+
+	return loop;
+}
+
+static __rte_noinline uint16_t
+dpaa2_dev_tx_multi_ordered(struct dpaa2_queue *dpaa2_q,
+	struct rte_mbuf **bufs, uint16_t nb_pkts)
+{
+	uint16_t to_send, order_tx = 0, total = 0;
+
+order_tx_again:
+	to_send = (nb_pkts > dpaa2_eqcr_size) ? dpaa2_eqcr_size : nb_pkts;
+	order_tx = dpaa2_dev_tx_ordered(dpaa2_q, bufs, to_send);
+	bufs += order_tx;
+	nb_pkts -= order_tx;
+	total += order_tx;
+	if (nb_pkts && order_tx >= to_send)
+		goto order_tx_again;
+
+	return total;
+}
+
+static __rte_always_inline uint16_t __rte_hot
+dpaa2_dev_tx_fast(struct dpaa2_queue *dpaa2_q, struct rte_mbuf **bufs,
+	uint16_t nb_pkts, struct qbman_swp *swp, struct qbman_fd *fd_arr,
+	const struct qbman_eq_desc *eqdesc, struct rte_mempool *hw_mp)
+{
+	/* Function to transmit the frames to given device and VQ*/
+	uint32_t loop, retry_count, frames_to_send;
+	int32_t ret, order = false;
+	uint16_t num_tx = 0, eq_ret = 0;
+
+tx_again:
+	/*Check if the queue is congested*/
+	retry_count = 0;
+	while (qbman_result_SCN_state(dpaa2_q->cscn)) {
+		retry_count++;
+		/* Retry for some time before giving up */
+		if (retry_count > CONG_RETRY_COUNT)
+			goto skip_tx;
+	}
+
+	frames_to_send = (nb_pkts > dpaa2_eqcr_size) ? dpaa2_eqcr_size : nb_pkts;
+
+	for (loop = 0; loop < frames_to_send; loop++) {
+		if (unlikely(dpaa2_mbuf_seq_is_flag_set((*bufs),
+			(DPAA2_ENQUEUE_FLAG_ORP | QBMAN_ENQUEUE_FLAG_DCA)))) {
+			order = true;
+			break;
+		}
+
+		if (unlikely((*bufs)->ol_flags & RTE_MBUF_F_TX_VLAN)) {
+			ret = rte_vlan_insert(bufs);
+			if (ret)
+				break;
+		}
+		if (likely(RTE_MBUF_DIRECT(*bufs) &&
+			(*bufs)->pool->ops_index == hw_mp->ops_index &&
+			(*bufs)->nb_segs == 1 && rte_mbuf_refcnt_read(*bufs) == 1)) {
+			DPAA2_MBUF_TO_CONTIG_FD((*bufs), &fd_arr[loop],
+				mempool_to_bpid((*bufs)->pool));
+			ret = 0;
+		} else if (unlikely((*bufs)->nb_segs > 1)) {
+			ret = dpaa2_dev_tx_mbuf_to_sg_fd(hw_mp, *bufs, &fd_arr[loop],
+				dpaa2_q, DPAA2_TX_NO_CONF, false);
+		} else {
+			ret = dpaa2_dev_tx_mbuf_to_simple_fd(hw_mp, *bufs, &fd_arr[loop],
+				dpaa2_q, DPAA2_TX_NO_CONF, false);
+		}
+		if (ret)
+			break;
+		bufs++;
+	}
+
+	eq_ret = dpaa2_dev_tx_enqueue_multiple(swp, fd_arr, loop, eqdesc);
+	num_tx += eq_ret;
+	nb_pkts -= eq_ret;
+	if (unlikely(nb_pkts > 0 && !ret && !order))
+		goto tx_again;
+
+skip_tx:
+	dpaa2_q->tx_pkts += num_tx;
+	if (unlikely(order && eq_ret >= loop))
+		num_tx += dpaa2_dev_tx_multi_ordered(dpaa2_q, bufs, nb_pkts);
+
+	return num_tx;
+}
+
 /*
  * Callback to handle sending packets through WRIOP based interface
  */
@@ -1519,12 +1627,12 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 {
 	/* Function to transmit the frames to given device and VQ*/
 	uint32_t loop, retry_count, i, ptp_n, frames_to_send;
-	int32_t ret, tstamp[MAX_TX_RING_SLOTS], ptp_set, order = false, eq_ret = 0;
-	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
+	int32_t ret, tstamp[MAX_TX_RING_SLOTS], ptp_set, order = false;
+	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS] = {0};
 	struct qbman_eq_desc eqdesc;
 	struct dpaa2_queue *dpaa2_q = queue;
 	struct qbman_swp *swp;
-	uint16_t num_tx = 0, order_tx;
+	uint16_t num_tx = 0, eq_ret = 0;
 	struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data;
 	struct dpaa2_dev_priv *priv = eth_data->dev_private;
 	struct rte_mempool *hw_mp;
@@ -1549,15 +1657,15 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	}
 	hw_mp = priv->bp_list->mp;
 
-	if (dpaa2_q->tx_conf_queue)
-		dpaa2_dev_tx_conf(dpaa2_q->tx_conf_queue, false);
-
 	/*Prepare enqueue descriptor*/
 	qbman_eq_desc_clear(&eqdesc);
 	qbman_eq_desc_set_no_orp(&eqdesc, DPAA2_EQ_RESP_ERR_FQ);
 	qbman_eq_desc_set_fq(&eqdesc, dpaa2_q->fqid);
+	if (likely(priv->tx_conf_type == DPAA2_TX_NO_CONF))
+		return dpaa2_dev_tx_fast(dpaa2_q, bufs, nb_pkts, swp, fd_arr, &eqdesc, hw_mp);
 
-	/*Clear the unused FD fields before sending*/
+	if (dpaa2_q->tx_conf_queue)
+		dpaa2_dev_tx_conf(dpaa2_q->tx_conf_queue, false);
 
 tx_again:
 	/*Check if the queue is congested*/
@@ -1617,27 +1725,13 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 		bufs++;
 	}
 
-	frames_to_send = loop;
-	loop = 0;
-	retry_count = 0;
-	while (loop < frames_to_send) {
-		eq_ret = qbman_swp_enqueue_multiple(swp, &eqdesc,
-			&fd_arr[loop], NULL, frames_to_send - loop);
-		if (unlikely(eq_ret < 0)) {
-			retry_count++;
-			if (retry_count > DPAA2_MAX_TX_RETRY_COUNT)
-				break;
-		} else {
-			loop += eq_ret;
-			retry_count = 0;
-		}
-	}
+	eq_ret = dpaa2_dev_tx_enqueue_multiple(swp, fd_arr, loop, &eqdesc);
+	num_tx += eq_ret;
+	nb_pkts -= eq_ret;
 
-	num_tx += loop;
-	nb_pkts -= loop;
 	if (priv->tx_conf_type != DPAA2_TX_NO_CONF) {
-		for (i = 0; i < loop; i++) {
-			if (tstamp[i]) {
+		for (i = 0; i < eq_ret; i++) {
+			if (unlikely(tstamp[i])) {
 				rte_atomic_fetch_add_explicit(&dpaa2_q->tx_conf_queue->ts_to_cnfd,
 					1, rte_memory_order_relaxed);
 			}
@@ -1648,16 +1742,8 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 
 skip_tx:
 	dpaa2_q->tx_pkts += num_tx;
-	if (order && eq_ret >= 0) {
-order_tx_again:
-		frames_to_send = (nb_pkts > dpaa2_eqcr_size) ? dpaa2_eqcr_size : nb_pkts;
-		nb_pkts -= frames_to_send;
-		order_tx = dpaa2_dev_tx_ordered(queue, bufs, frames_to_send);
-		num_tx += order_tx;
-		bufs += frames_to_send;
-		if (nb_pkts && order_tx >= frames_to_send)
-			goto order_tx_again;
-	}
+	if (unlikely(order && eq_ret >= loop))
+		num_tx += dpaa2_dev_tx_multi_ordered(dpaa2_q, bufs, nb_pkts);
 
 	return num_tx;
 }
Signature · 1 line
2.43.0
#202 lore raw

Re: [PATCH v4-S3 00/65] net/dpaa2, event/dpaa2 and fslmc rework

In reply to Prashant Gupta
Quoted 22 lines · On Fri, 23 Oct 2026 19:12:40 +0530 Prashant Gupta <[email protected]>…

This is the final DPAA2 upstreaming sub-series, applied on top of v7-S1 ("dpaa2: bus, DMA and mempool base fixes") and v14-S2 ("net/dpaa2 updates").

The series reworks the DPAA2 datapath, flow steering, metering, eventdev integration and fslmc infrastructure. It consolidates device configuration handling, improves queue and portal management, and adds support for additional DPNI, eventdev and datapath capabilities.

Highlights:
- add DMA bypass translation support and table-driven devargs parsing;
- optimize Tx queue, channel and dequeue processing paths;
- centralize MC version, SoC detection and endpoint handling;
- rework RSS, flow steering, QoS and default action programming;
- add rte_mtr support and meter rte_flow actions;
- improve eventdev scheduling, DPCI support and multi-port operation;
- support runtime IEEE1588 timestamping;
- rework xstats collection and MAC statistics handling;
- unify enqueue/dequeue datapaths across net, crypto and eventdev;
- add Tx fast paths and reduce confirmation overhead.

Quoted 2 lines

Every commit builds cleanly with arm64 and -Werror and the series remains bisectable.

AI review reports lots and lots of issues here.
I assume you want this in next-net.

The build warnings from AI are suspect since it probably didn't get correct dependencies but other issues are disconcerting to me. It is not ready for 26.11 given project timelines.

Subject: Re: [PATCH v4-S3 00/65] dpaa2 driver updates

Reviewed v4-S3 (65 patches) applied on main + S2 v14. S1 is already in main.

Series-level
------------

Build: does not build against current main.
- 08/65 adds #include <rte_vfio.h> to fslmc_vfio.h. That header was renamed by cf88cd44aa ("vfio: make all functions internal"), and fslmc was already decoupled from EAL VFIO by 487098bd8d. Drop the include. 08..65 fail to compile as-is.
- 21/65 fails with -Werror (gcc 13, x86, -O3): array-bounds in dpaa2_flow_extract_support(). rte_memcpy() copies a uint8_t size into uint8_t mask[64] with no bound. Add
"if (size > sizeof(mask)) return -EINVAL;" and use memcpy() in this control-path code. 21..65 fail.
- 42/65 and 43/65 fail: dpaa2_hw_dpio.c:476 uses rte_atomic16_read() (implicit declaration, and deprecated) on an RTE_ATOMIC(uint16_t). 44 fixes it. Use rte_atomic_load_explicit() in 42.
With those three fixed locally, every commit builds (x86, gcc 13, -Dwerror=true; fslmc, dpaa2 net/event/crypto/dma/mempool, all event PMDs).
Please rebase onto current main and build every commit with -Dwerror=true before resending.

Size: 65 patches mixing fixes, refactors and new vendor API is too much to review or bisect. Split it:
- Send standalone fixes first, each with Fixes: and
Cc: [email protected]: 42 (create cleanup), 49 (ep_name and speed capa were never set), 54 (DQRR held accounting, Fixes:
7b6edb640b), and the allocator CAS bug below (30/44).
- 40/65 is a lib/eventdev doc change; send it to the eventdev maintainer on its own.
- 32/65 is not a fix. RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST is documented as "all packets destined for the same port and Tx queue", so reading ev[0] was correct. Reword it as a simplification or drop it.

Bisect: several patches introduce a bug and a later patch in the series fixes it (01->13/51, 08->09, 12->13, 29->31, 43->44, 44->52, 57->59, 61->62). Fold each fix into the patch that introduced the problem.

Vendor-specific API: this series adds rte_pmd_dpaa2_/rte_dpaa2_ APIs that duplicate generic ethdev, rte_flow and eventdev APIs:
06 rx_get_offset, 21 flow wrappers/group bits, 22 RSS helper, 31 EVENT_PORT_CFG_ATOMIC, 34 scheduler, 38 tx_multi_ports, 50 dev_info/rxq_info/configure_default_action, 53 clean_tx_conf. I don't want to take PMD-specific API for things the generic API already does. Implement the generic op (e.g. tx_done_cleanup for 53, rte_flow_group_set_miss_actions for 50) or justify each one. Any that stay need Doxygen, a release note, the rte_pmd_dpaa2_ prefix and RTE_EXPORT_EXPERIMENTAL_SYMBOL(..., 26.11). Patches 21 and 50 export with 23.11/24.11/25.11.

Patch 12 has no subject line; the first paragraph of the body became the subject.

Errors
------

[01/65] net/dpaa2: refactor and optimize Rx parser result decode

dpaa2_parser_decode.h / dpaa2_rxtx.c:149
*packet_type |= RTE_PTYPE_L2_ETHER_VLAN;
The L2 ptype is an enum, not flags. ETHER(1)|VLAN(6) = 7 = QINQ, so every single-tagged frame is reported as QinQ. The same happens for VLAN+ARP and MPLS (0xe, invalid) in parse_frc.
Fix: clear RTE_PTYPE_L2_MASK, then assign.

[02/65] net/dpaa2: generate devargs table and string from one list [03/65] crypto/dpaa2_sec: use table-driven devargs parsing [04/65] dma/dpaa2: use table-driven devargs parsing

dpaa2_ethdev.c:3435
priv->flags = 0;
dpaax_get_devargs(s_dpaa2_devargs, eth_dev, &priv->flags); This now runs before the primary-process check. A secondary attaching wipes the primary's live flags in shared dev_private. 03 (dump_level, en_loose_ordered) and 04 (short_fd, fle_pre_populate) have the same problem. Parse into a local and write shared state only in the primary.

dpaax_devarg.h:56
dev_args[arg_idx].handle(dev, pair);
The handler runs before the pair->value NULL check. A bare key ("drv_strict_order") gives value == NULL, and the handlers call atoi(pair->value), so probe crashes.
Fix: if (pair->value == NULL) continue;

dpaa2_sec_dpseci.c:4366 (03/65)
internals->en_loose_ordered = true;
This runs after devargs are parsed, so drv_strict_order=1 no longer has any effect. Set the default before dpaax_get_devargs().

[09/65] bus/fslmc: centralize MC version and SoC detection

fslmc_vfio.c:172
int x = cpu_id / dpaa2_cluster_size;
This divides before the !dpaa2_cluster_size check below it. Move the check first.

[11/65] net/dpaa2: cache per-rxq DPNI queue cfg and share CGID per TC

dpaa2_ethdev.c (dev_init)
for (i = 0; i < priv->max_cgs; i++)

          priv->cgid_in_use[i] = 0;

cgid_in_use[] is now MAX_TCS (8) entries but max_cgs comes from MC (uint8_t). This writes past the array into priv.
Fix: memset(priv->cgid_in_use, 0, sizeof(priv->cgid_in_use)); and bound every max_cgs loop by MAX_TCS.

dpaa2_ethdev.c:1155 (rx_queue_setup err_quit)

  if (dpaa2_q->napi_dpcon) {
          rte_dpaa2_free_dpcon_dev(dpaa2_q->napi_dpcon);

With dpcon_allocated removed, the error path frees a DPCON that was kept across reconfigure. The FQ stays scheduled to a DPCON that is back in the pool. Restore a local "allocated" flag.

dpaa2_ethdev.c (dpaa2_eth_eventq_detach)
dpaa2_ethq->options &= ~DPNI_QUEUE_OPT_DEST; dpni_set_queue() applies the destination only when OPT_DEST is set, so DEST_NONE is never written and the FQ stays on the eventdev DPCON. Pass options | DPNI_QUEUE_OPT_DEST for this call.

[12/65] (no subject) Tx buffer release schemes

dpaa2_rxtx.c:840
DPAA2_MBUF_TO_CONTIG_FD(mbuf, fd, mempool_to_bpid(mbuf->pool)); In no-conf mode, mbufs the fast path rejected (refcnt > 1, extbuf) are sent with a valid BPID. HW then releases a buffer the app still holds, or pushes an external buffer into BMan. Use IVP plus a refcnt decrement as before.

dpaa2_rxtx.c:822
rte_mbuf_refcnt_update(mbuf, -1);
...
mbuf = mi;
The clone's reference is dropped and the direct mbuf is sent without taking one. The FD is also built from mi's data_off/len, not the clone's view. Keep the indirect mbuf's iova/off/len with IVP.

dpaa2_rxtx.c:775
sg_mbuf->next = cur_seg;
When the first segment is a clone, it is freed by conf_mbuf_to_sge() while sg_mbuf->next still points at it, which is a use-after-free on confirmation. rte_pktmbuf_init() also forces refcnt to 1 on a shared clone.

dpaa2_rxtx.c:1697
num_tx += loop; ... goto send_n_return;
On retry exhaustion, fd_arr[0..loop) is enqueued a second time, so frames are transmitted twice and buffers released twice.

[13/65] net/dpaa2: support runtime IEEE1588 timestamping

dpaa2_rxtx.c:183
ts = RTE_MBUF_DYNFIELD(m, priv->rx_ts_offset, void *); rx_ts_offset is only registered when the RX_OFFLOAD_TIMESTAMP offload is set. timesync_enable without it writes word2 at mbuf offset 0 (buf_addr). Initialise rx_ts_offset to -1 and check it.

dpaa2_ptp.c:219
while (txq && rte_atomic_load_explicit(&txq->ts_to_cnfd, The counter is updated on tx_conf_queue but read on the Tx queue, where it is always 0. tx_timestamp is never cleared, so stale values are returned. ts_to_cnfd also goes negative for multi-seg or non-PTP TMST frames (rxtx.c:1567).

[17/65] net/dpaa2: rework xstats with page table and MAC support [19/65] net/dpaa2: reimplement xstats_get() on top of xstats_get_by_id()

dpaa2_ethdev.c:2249
if (n > stat_cnt) { ... return -EINVAL; }
if (!xstats) return 0;
This breaks the xstats_get contract. A NULL/0 size query must return the count, and a larger buffer is legal. In 19, "n = DPAA2_XSTAT_MAX_NUM" includes the MAC stats, so ports without a MAC fail with -EINVAL.
Fix: if (n < stat_cnt || !xstats) return stat_cnt;

[20/65] net/dpaa2: fetch only requested MAC xstats in one MC call

dpaa2_ethdev.c:2258
mac_val[mac_num] = &values[i];
mac_num++;
Ids are not de-duplicated. With repeated MAC ids, mac_num goes past the stack array and the DMA index buffer. Bound mac_num.

[21/65] net/dpaa2: rework flow with per-table profile and group types

dpaa2_flow.c:2872
new_pattern[num].item.type = RTE_FLOW_ITEM_TYPE_END; The count loop does num++ before testing, and the allocation has no room for END, so this is a heap overflow on every create. Allocate num + 1.

dpaa2_flow.c:2976
index = pattern[i].type;
if (!hd[index].name) {
The table has 64 entries, the enum goes to 70, and private types are negative. This reads out of bounds and then calls a garbage cb. Range-check the type.

dpaa2_flow.c:2983
ret = hd[index].tunnel(flow, ...);
On success it falls through to hd[index].cb as well, adding outer extracts with the inner spec. Inner-tunnel rules never match. continue after the tunnel cb.

dpaa2_flow.c:3592
if (items[i - 1].type != RTE_FLOW_ITEM_TYPE_END) { items[i-1] is never END, so every RSS flow with a pattern fails. An empty pattern reads items[-1].
Fix: test i == DPKG_MAX_NUM_OF_EXTRACTS + 1.

dpaa2_flow.c:1075
flow->ip_src = NET_PROT_IPV4;
This is set for IPv6 too. remove_invalid_extract() then shrinks the IP address slots to 4 bytes and corrupts the keys of the remaining IPv6 rules.

dpaa2_flow.c:3528
return update;
update excludes IP-address extracts, so removing only IP extracts skips the table reprogram and the HW key layout goes stale.

dpaa2_flow.c:1022
key_profile->dpkg.extracts[raw_idx].type = DPKG_EXTRACT_FROM_DATA; This overwrites the slot in place instead of shifting, so an existing IP extract is lost. Use dpaa2_dpkg_insert_extract().

dpaa2_flow.c:1302
memcpy((flow->key_addr + offset), key, size);
RAW length can reach 320 bytes into a 256-byte buffer, and key_offset is uint8_t. Reject offset + length > DPNI_MAX_KEY_SIZE.

dpaa2_flow.c:1081
A non-zero fragment_offset mask always installs the "is fragment" FAF, so "match non-fragmented" (spec 0, mask 0x3fff) is inverted. Only the first byte of the be16 mask is checked.

dpaa2_flow.c:1666
DPAA2_PARSER_MPLS_ID, ... RTE_FLOW_ITEM_TYPE_PPPOES, PPPoE uses the MPLS parser id, so PPPoE matches MPLS. fields_num is 1, so session_id is never extracted.

dpaa2_flow.c:4227
dpaa2_flow_steering_flow_action_update(dev, flow->qos_flow, The FS update is passed qos_flow: a NULL dereference for FS-only flows, and the wrong entry otherwise. Use fs_flow.

dpaa2_flow.c:4163
struct rte_flow_action actions_update[DPAA2_MAX_ACTION_PER_FLOW_NUM]; check_actions_support() writes END with no capacity check, so user actions can overflow the stack array. Pass the capacity.

dpaa2_flow.c:3743
dpaa2_flow_clean(dev, flow->tc_id, DPAA2_FLOW_RSS_TYPE); Creating a flow destroys the user's existing flows, whose handles the application still holds, so a later destroy is a use-after-free. It also happens before the new create is known to succeed. Return -EEXIST instead.

dpaa2_flow.c:3975
ret |= dpaa2_flow_destroy_rss_flow(...);
The flow is unlinked first. On partial failure it is leaked with dangling sub-flow pointers, ORed errnos are meaningless, and rte_flow_error is never set.

dpaa2_flow.c:3022
idx = attr->group * priv->qos_entries_per_tc + attr->priority; attr->group still carries the type bits (0x100+), and idx is uint16_t so it wraps past the bound check. Lines 2401 and 3884 also use the converted group. Use the group id and a 32-bit idx.

dpaa2_flow.c:4394
key = flow->qos_flow->key_addr;
There is no NULL check, so rte_pmd_dpaa2_flow_table_query() crashes on FS-only, QoS-only and RSS flows.

dpaa2_flow.c:3747
if (error && error->type > RTE_FLOW_ERROR_TYPE_ACTION) { This reads an uninitialised caller struct. On creation failure, extracts already inserted into the shared profile are not rolled back, which corrupts other flows' keys.

[22/65] net/dpaa2: reimplement RSS distribution via rte_flow

dpaa2_ethdev.c:565
rte_flow_actions_update(..., tbl_profile->rss_flow, rss_flow is the internal dpaa2_generic_flow, not the rte_flow handle. update returns -EINVAL, and rte_flow_destroy() on it at line 531 does LIST_REMOVE on the wrong type, corrupting memory. Store the handle returned by rte_flow_create().

dpaa2_ethdev.c:2998
tc_index, priv->dist_queues);
rss_hash_update uses dist_queues for every TC, which loses the last-TC clamp. When no RSS flow exists it returns 0 and does nothing.

rte_pmd_dpaa2.h:16
#include <ethdev_driver.h>
This is an installed header including a driver-SDK header, so applications without the SDK cannot build. The helper also discards the rte_flow handle it creates.

[25/65] net/dpaa2: support rte_mtr and METER rte_flow action

dpaa2_flow.c:4061
} else if (meter_action->type == RTE_FLOW_ACTION_TYPE_METER_MARK) { This is the same condition as the first branch, so METER is never handled and always returns -EINVAL. Use RTE_FLOW_ACTION_TYPE_METER.

dpaa2_flow.c:3078
policing_cfg.cir = dpaa2_profile->cir;
rte_mtr is bytes/s (uint64_t) and the MC field is Kbps (uint32_t). The rate is 125x too high and truncates above 4G. Convert, and reject values that do not fit.

[27/65] net/dpaa2: support DCB Rx mode via rte_flow

dpaa2_ethdev.c:1330
dcb_rx_conf.dcb_tc[tc_index], tc_index);
dcb_tc[] is indexed by priority and holds the TC. This treats it the other way round and loops only nb_tcs times. Iterate over RTE_ETH_DCB_NUM_USER_PRIORITIES.

dpaa2_ethdev.c:596
priv->dcb_flow[prio] = qos_flow;
This is never cleared except in close, so a second configure with DCB fails with -ENODATA. After flush the pointers dangle.

[29/65] bus/fslmc: support DPCI peer and dynamic queues [30/65] bus/fslmc: add alloc/free DPIO API for non-affine portals

dpaa2_hw_dpci.c:194, dpaa2_hw_dpio.c:430
uint16_t expected = 0;
TAILQ_FOREACH(...)
rte_atomic_compare_exchange_strong_explicit(..., &expected, 1,
expected is outside the loop. A failed CAS stores 1 into it, so the next busy object is handed out a second time. Two owners on one QBMan portal corrupt EQCR/DQRR. From 44 every per-lcore portal goes through this allocator. Declare expected inside the loop.

dpaa2_eventdev.c:122 (29/65)
priv->evq_info[queue_id].event_port != dpaa2_portal)) { At 29 event_port is never set, so every enqueue fails and jumps to send_partial with frames_to_send uninitialised entries. This is fixed in 31; fold it into 29.

[31/65] event/dpaa2: rework event port model and DPCI handling

dpaa2_eventdev.c:594
ret = rte_event_port_unlink(dev->data->dev_id, dpaa2_portal->port_id, NULL, 0); if (ret)

          return ret;

unlink returns a count (> 0), so link on an already-linked port returns that count without linking anything. The lib then marks queues[0..ret) as linked. link must not unlink.

dpaa2_eventdev.c:607
if (evq_info->event_port) { ... return -ENODEV;
A queue can be linked to only one port, and enqueue only accepts queues the port owns. Load-balanced workers and pipelines (dequeue q0, enqueue q1) no longer work, yet DISTRIBUTED_SCHED and MULTIPLE_QUEUE_PORT are still advertised.

dpaa2_eventdev.c:126
goto send_partial;
A bad event is never consumed, so the outer while (nb_events) retries it forever. Return num_tx and set rte_errno.

dpaa2_eventdev.c:206
qbman_swp_interrupt_clear_status(DPAA2_PER_LCORE_PORTAL, Dequeue uses the port's DPIO, but the wait uses the lcore affine DPIO: NULL on a control thread (stop/drain), or the wrong portal. Pass dpio_dev.

dpaa2_rxtx.c:1696 (also dpaa2_sec)
DPAA2_PER_LCORE_DQRR_SIZE--;
Atomic events are held on the port's DPIO, but ethdev, Tx adapter and dpaa2_sec issue the DCA and update held_bufs on the lcore DPIO. The DQRR entry is consumed on the wrong portal. 59 addresses this with dpio-in-seqn, but see 59 below.

dpaa2_ethdev.c:3403
dpaa2_ethq->ev.queue_id = eth_rx_queue_id;
This overwrites the event queue id in the Rx-adapter event template. flow_id is also forced even with FLOW_ID_VALID set.

[34/65] event/dpaa2: add DPCON based standalone Rx scheduler

dpaa2_scheduler.c:216
dpaa2_qbman_pull_desc_channel_set(&pulldesc, nb_pkts, This pulls nb_pkts into storage sized dqrr_size, so QBMan DMAs past it. dq_sch_storage++ also carries into the next pull. Pull min(nb_pkts, dqrr_size) and reset the pointer per pull.

dpaa2_ethdev.h:933
priority_step = (RTE_EVENT_DEV_PRIORITY_LOWEST + 1 -

          RTE_EVENT_DEV_PRIORITY_HIGHEST) / dpcon->num_priorities;

priority_step is uint8_t. With 1 priority, 256 truncates to 0 and the next line divides by zero. This is reached from every Rx adapter queue_add. Use unsigned int.

[35/65] event/dpaa2: add push mode to DPCON Rx scheduler

dpaa2_scheduler.c:590
return sch_dev->dpcon_dev[0]->num_priorities;
In push mode dpcon_dev[] is filled lazily per lcore, so this is NULL unless lcore 0 has received.

dpaa2_scheduler.c:116
configured is global, so only the first lcore attaches queues. A later add() re-attaches the same DPCI and re-adds the static channel from the datapath.

[37/65] event/dpaa2: track and detach attached Rx queues

dpaa2_scheduler.c:616
dpaa2_scheduler_eventq_detach(sch_dev, attach_num); In push mode attach_num counts lcores, not queues. Too few queues are detached, or NULL entries are dereferenced.

dpaa2_eventdev.c:525
if (!eth_dev || rx_queue_id < 0) {
queue_del(port, -1) detaches every Rx queue of every ethdev. Only the given ethdev's queues should go.

dpaa2_eventdev.c:932
dpaa2_eventdev_dequeue_drain(dev);
Rx adapter stop drains every port of the device, dropping other sources' events, and untracks the queues, while start is a no-op. stop then start loses traffic.

dpaa2_ethdev.c:2368
DPAA2_PMD_WARN("%s's %d rxq(s) are not detached ... close only warns, then frees queues that the eventdev still references. A later eventdev close is a use-after-free and dereferences a NULL priv->hw.

[38/65] net/dpaa2: add multi-port Tx API

dpaa2_rxtx.c:2028
txq[i] = data->tx_queues[txq_id[i]];
port_id and txq_id from the caller are not validated, and a non-dpaa2 port's queue is cast to struct dpaa2_queue. struct dpaa2_queue *txq[nb_pkts] is an unbounded VLA.

[39/65] event/dpaa2: limit attached Rx flows per event queue

dpaa2_eventdev.c:520
uint8_t i, j, k, found = false;
dpni_rxq_num is now uint16_t up to 1024, so these loops never terminate past 255.

[44/65] bus/fslmc: consolidate DPIO interrupt setup

(the CAS bug from 30 becomes hot here; see above)

[45/65] event/dpaa2: honor configured dequeue timeout

dpaa2_eventdev.c:311
if (timeout_ticks)

          timeout_ms = timeout_ticks * 1000 / priv->event_hz;
  else
          timeout_ms = priv->dequeue_timeout_ns / (1000 * 1000);

This is backwards. timeout_ticks == 0 means no wait. Without PER_DEQUEUE_TIMEOUT, a non-zero value means use dequeue_timeout_ns. Sub-ms values round to 0.

[51/65] net/dpaa2: consolidate dequeue paths

dpaa2_scheduler.c:334
if (likely(q_storage->active_dqs)) {
This is inverted. On the first call active_dqs is NULL and qbman_check_command_complete(NULL) follows. Use unlikely(!active_dqs).

dpaa2_rxtx.c:1300
dq_storage = dpaa2_q->q_storage[0]->dq_storage[0]; rx_err_vq is shared by all Rx lcores, and they now all pull into storage[0] at once. Use q_storage[rte_lcore_id()].

[53/65] net/dpaa2: add API to clean Tx confirmation queue

dpaa2_ethdev.c:1256
txq = dev->data->tx_queues[txq_id];
txq_id is not range-checked and txq is not NULL-checked.

[57/65] net/dpaa2: unify tx burst path

dpaa2_rxtx.c:1810
dqrr_held[loop] = ~(UINT64_C(1) << dqrr_index);
This is negated again at 1862, so HELD &= bit clears every other held entry. It is fixed in 59; fold it here.

dpaa2_rxtx.c:1871
*dpaa2_seqn(bufs[i]) = flags[i];
flags[] is uninitialised for non-DCA slots, so stack garbage goes into seqn and can carry DCA/ORP bits. This is still in 65. Set flags[loop] = 0 and save the ORP seqn too.

dpaa2_rxtx.c:1813
*dpaa2_seqn(bufs[loop]) = DPAA2_INVALID_MBUF_SEQN; This is cleared before the enqueue is known to succeed. A later FD build failure returns the mbuf unsent with its atomic context lost.

dpaa2_rxtx.c:1654
if (nb_pkts > 0 && !ret && !order)
On retry exhaustion, bufs has already advanced past the unsent frames. The next pass skips them and reads past the caller's array. ret is uninitialised when order breaks at loop 0.

[58/65] crypto/dpaa2_sec: unify enqueue burst path

dpaa2_sec_dpseci.c:1665
int32_t ret, order = false;
ret is read at "if (ret >= 0 && order)" without being set when the first op is ordered and the lcore already has a portal. Initialise it to 0.

dpaa2_sec_dpseci.c:1602
DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) << dqrr_index); This reintroduces the bug 54 fixes in eventdev: held state is consumed before enqueue, and build_sec_fd() failure loses it.

[59/65] bus/fslmc: track atomic DCA context per dequeue dpio

dpaa2_hw_pvt.h:537
if (*dpaa2_seq_dpio_dq(mbuf) == dpio_eq) { \
The Tx adapter and crypto pass the lcore DPIO, not the port DPIO, so this never matches. The held mbuf[] slot stays, and the next dequeue writes seqn into an mbuf already given to HW and possibly freed.

[60/65] bus/fslmc: move enqueue response descriptors to per-queue

dpaa2_rxtx.c:1736
ret = dpaa2_eq_set_order_desc(priv->tx_vq[0], bufs[loop], ... Slots are taken from tx_vq[0] but reaped from dpaa2_q[loop], so the ring fills and ORP Tx returns -EAGAIN forever. All lcores update tx_vq[0]->eq_resp without a lock.

dpaa2_hw_pvt.h:688
eq_resp->active_t = next;
The slot is consumed before enqueue. A frame not enqueued leaves a slot that never completes, so process() stops there for good.

dpaa2_hw_pvt.h:699
dpaa2_enq_rsp_process(queue, 1);
The free loop spins forever on such a slot. Bound it.

dpaa2_sec_dpseci.c:1555
goto skip_tx;
On -EAGAIN the FLEs already built for this chunk leak, along with their ORP/DCA state. Send the built frames instead.

[65/65] net/dpaa2: add Tx fast path for no-confirmation case

dpaa2_rxtx.c (dpaa2_dev_tx_fast)
DPAA2_MBUF_TO_CONTIG_FD((*bufs), &fd_arr[loop],
The fast path ignores RTE_MBUF_F_TX_IEEE1588_TMST, so one-step PTP is lost in the default config. Send TMST frames to the slow path.

Warnings
--------

01: QinQ sets RX_QINQ without vlan_tci_outer. On LX2, parse_frc
never sets the GOOD cksum flags and sets IEEE1588_PTP without TMST. PTP/UDP-ESP-IKE summaries end up as L4_NONFRAG. The by_channel guard on the error-queue drain was dropped (S2 added it on purpose). FLC hash decode now runs on non-LX2 SoCs. sp_protocol is never set until 10.
05: dumps log under RTE_LOGTYPE_USER1, not the PMD logtype, with
one log call per byte.
06: the offsets dynfield is not filled on the eventdev Rx paths.
The new devarg is undocumented.
07: the Tx queue to TC mapping changed from interleaved to blocked,
and channels > 0 are not reachable per TC. Neither is in the commit message.
08: the MC version check is removed and only restored in 09. 10: every bus scan opens /dev/mem O_RDWR and maps CCSR writable,
logs ERR when that fails, and hex-dumps at NOTICE. Use O_RDONLY/PROT_READ and DEBUG.
11: cgid_in_use is incremented before setup and not decremented
on error.
12: the FAEAD is written in place into buffers the PMD does not
own. tm_sw_td handling was removed. The tx_again loop condition is inverted. drain never loops. tx_conf storage is freed with a VDQ outstanding. The IEEE1588 producers are removed until 13.
13: rx_timestamp is overwritten by every packet, not only PTP.
tx_burst issues a blocking MC command (dpni_set_single_step_cfg). read_tx_timestamp dequeues the conf FQ from the control thread with q_storage[rte_lcore_id()].
17: imissed/ierrors/rx_nombuf now double count. tc < MAX_TCS is
always true, so all 8 page-5 queries are issued.
18: 16 PFC counters are added to the MAC request with no MC
revision gate.
20: the MAC DMA buffers are allocated on every get_by_id, before
the MAC check.
21: GTPU RSS and IPv6-only RSS always fail. Single-TC ports now
need a QoS entry (regression). An out-of-range group silently becomes 0. validate accepts what create rejects, and item->last is ignored. packet_id is advertised but not extracted. Action update accumulates tokens. query returns success with no data. Miss actions report success on old MC. dev_init returns success on table allocation failure (ret still 0). drv_qos_entries_per_tc is unchecked and undocumented. The commit message describes an env var the code does not have.
25: meter_lock is re-initialised on every mtr_ops_get. packet_mode

Quoted 1 line

1 is overloaded. Duplicate ids are accepted, delete frees

meters in use, and update does not reprogram. A METER rule with a pattern is applied to the whole TC. features/dpaa2.ini and the release notes are not updated.
26: miss-action programming errors are logged and dropped in
configure.
27: get_dcb_info returns the init identity map, not the configured
one.
29: DPCI rx_queue cb is never cleared, so a used DPCI is -EBUSY
forever. ORDERED was dropped while ALL_TYPES is still advertised.
31: 1024-entry env_pool with a 512 per-lcore cache drains across
lcores. Releasing a port does not reset held_bufs. close leaks port DPIOs (until 37, and still when never started).
34: q_storage[rte_lcore_id()] has no LCORE_ID_ANY check. destroy
leaks the dq storage and does not detach Rx queues. max_prio returns a count, so it is off by one.
35: push-mode DPCONs are never enabled but are disabled on destroy. 36: drain runs before detach, and a VDQ is left outstanding. 40: the new wording ("negative on failure") does not match the
public rte_event_port_link() contract or most PMDs.
41: relinking an already-linked queue errors instead of updating
priority, and rte_errno is not set on a short count. unlink pos[16] overflows with duplicate queue ids.
42: probe failure does not uninit the vdev eventdev.
max_event_ports excludes the device's own DPIOs, so a second configure fails.
43: the event port DPIO has epoll_fd -1 until 44, so the timeout
never waits.
44: interrupts are now armed on every ethrx portal (inverted
condition, reverted in 52). The stash error path leaks the epoll fd.
47: each intr_init creates an eventfd that deinit never closes.
The fast path rewrites IRQ affinity and the cpufreq governor using the lcore id as the CPU. A PMD must not change system cpufreq policy.
48: the Rx SG walk lost its DPAA2_MAX_SGS bound (the commit
message says one was added). The sg pool create is unchecked and is now created for every fslmc probe, including in secondaries.
49: this fixes ep_name and speed capability never being set
upstream. Say so and add Fixes:/Cc stable.
52: rx-intr sets the governor to performance on the first burst,
which defeats the purpose. MC subscribe runs on every arm. There is a stale comment block.
54: missing Fixes: 7b6edb640b and Cc: [email protected]. 57: DCA/ORP bursts bypass VLAN insert. A bad packet returns short
without being freed (tx_burst must free and continue). The same applies in 65.
58: ordered ops are counted in err_pkts.
60: qp is allocated with rte_malloc (not zeroed) and stays in

    queue_pairs[] on setup failure.

61: ORDERED is advertised before the DPCI OPR exists (62). The ORP
flag leaks when forwarding to a non-ordered queue. ordered_scheduling is missing from the eventdev ini.
62: the DPAA2_STRICT_ORDERING_ENABLE env var was replaced by a
devarg; the commit message says it is still honoured.
63: the teardown no longer stops the device after a failed test.
The commit message is wrong.
64: queue_setup accepts sched types that have no DPCI txq.
Probe-failure return leaves the eventdev allocated.
65: a 1 KiB fd_arr is zeroed on every fast-path burst.

Info
----

01: flow-extract helpers are added with no caller (move them to

    21). __rte_unused is stale. Use PRIx64, not %lx.

02: the getenv DPAA2_DATA_STASHING_OFF path was removed silently.
dpaa2.rst documents drv_error_queue, but the key is drv_err_queue (pre-existing).
07: DPAA2_INVALID_FLOW_ID is orphaned.
08: fslmc_vfio_core_cluster_sdest is declared before it is

    defined (09).

09: any newer MC major is accepted, and unknown SVRs now fail
probe. Neither is mentioned in the commit message.
13: timesync_disable leaves single-step enabled in the DPNI. 21: leftovers: DPAA2_FLOW_HDR_HEX_DUMP_SIZE, flow_profile
mempool[]/bp_idx[], tbl_profile.enabled. The IPv6 SRC/DST mapping in dpaa2_extract_ip_convert is wrong (latent). AH is logged as "esp". dead NULL check at flow.c:438. jump/geneve are missing from features/dpaa2.ini.
25: tc_mtr_profile[] is written but never read.
39: max_event_queue_flows is halved for unrelated bookkeeping. 42: DPAA2_EVENT_MAX_PORTS is unused.
60: MAX_EQ_RESP_ENTRIES is unused.
62: odpid is not masked with DPAA2_EQCR_OPRID_MASK. 63: generate_random_events passes an index as the port id.

Not adding Reviewed-by; there are Errors and Warnings throughout. Please split, rebase and resend.

#203 lore raw

Re: [PATCH v4-S3 00/65] net/dpaa2, event/dpaa2 and fslmc rework

In reply to Prashant Gupta
Quoted 153 lines · On Fri, 23 Oct 2026 19:12:40 +0530 Prashant Gupta <[email protected]>…

This is the final DPAA2 upstreaming sub-series, applied on top of v7-S1 ("dpaa2: bus, DMA and mempool base fixes") and v14-S2 ("net/dpaa2 updates").

The series reworks the DPAA2 datapath, flow steering, metering, eventdev integration and fslmc infrastructure. It consolidates device configuration handling, improves queue and portal management, and adds support for additional DPNI, eventdev and datapath capabilities.

Highlights:
- add DMA bypass translation support and table-driven devargs parsing;
- optimize Tx queue, channel and dequeue processing paths;
- centralize MC version, SoC detection and endpoint handling;
- rework RSS, flow steering, QoS and default action programming;
- add rte_mtr support and meter rte_flow actions;
- improve eventdev scheduling, DPCI support and multi-port operation;
- support runtime IEEE1588 timestamping;
- rework xstats collection and MAC statistics handling;
- unify enqueue/dequeue datapaths across net, crypto and eventdev;
- add Tx fast paths and reduce confirmation overhead.

Every commit builds cleanly with arm64 and -Werror and the series remains bisectable.

Breeson Francis (1):
net/dpaa2: rework xstats with page table and MAC support

Hemant Agrawal (1):
net/dpaa2: reject Rx queue deferred start

Jun Yang (63):
net/dpaa2: refactor and optimize Rx parser result decode net/dpaa2: generate devargs table and string from one list crypto/dpaa2_sec: use table-driven devargs parsing dma/dpaa2: use table-driven devargs parsing
net/dpaa2: unify debug dump via log based helpers net/dpaa2: expose Rx L3/L4/L5 offsets via mbuf dynfield net/dpaa2: optimize dpaa2 Tx queue and channel mapping bus/fslmc: split bus-level device walk from VFIO primitives bus/fslmc: centralize MC version and SoC detection in the bus layer net/dpaa2: remove unused soft parser loader
net/dpaa2: cache per-rxq DPNI queue cfg and share CGID per TC The dpaa2 PMD so far supported only two Tx buffer release schemes:
direct release by hardware, and an absolute Tx confirmation mode (drv_tx_conf=1) where every transmitted buffer is returned on a Tx confirmation queue that software must poll to free the buffers. Absolute confirmation adds a confirmation descriptor and a poll cost for all packets, even those the hardware could free on its own.
net/dpaa2: support runtime IEEE1588 timestamping bus/fslmc: consume dpaa2 DQRR entries in batches bus/fslmc: align dpaa2 event port depths with hardware rings net/dpaa2: support multi-DPNI FS redirect and QoS table v3 net/dpaa2: unify xstats layout and add DPMAC counter struct net/dpaa2: reimplement xstats_get() on top of xstats_get_by_id() net/dpaa2: fetch only requested MAC xstats in one MC call net/dpaa2: rework flow with per-table profile and group types net/dpaa2: reimplement RSS distribution via rte_flow net/dpaa2: expand IP address extracts for RSS hashing net/dpaa2: add policer v2 MC command and L2/L3 byte units net/dpaa2: support rte_mtr and METER rte_flow action net/dpaa2: program flow table miss actions via rte_flow net/dpaa2: support DCB Rx mode via rte_flow
bus/fslmc: support DPCI peer and dynamic queues
bus/fslmc: add alloc/free DPIO API for non-affine portals event/dpaa2: rework event port model and DPCI handling event/dpaa2: fix Tx adapter enqueue for mixed destinations event/dpaa2: rework self test for dynamic link and balance check event/dpaa2: add DPCON based standalone Rx scheduler event/dpaa2: add push mode to DPCON Rx scheduler event/dpaa2: drain Rx scheduler queues on destroy event/dpaa2: track and detach attached Rx queues net/dpaa2: add multi-port Tx API
event/dpaa2: limit attached Rx flows per event queue
eventdev: fix port link/unlink callback return documentation event/dpaa2: allow event queue link to multiple ports event/dpaa2: report available DPIO count and fix create cleanup event/dpaa2: use event port DPIO for dequeue wait bus/fslmc: consolidate DPIO interrupt setup and bound coalescing event/dpaa2: honor configured dequeue timeout
bus/fslmc: use EAL API for DPIO interrupt
bus/fslmc: defer DPIO interrupt setup and bind portal to worker core bus/fslmc: move Tx SG mempool to fslmc bus
net/dpaa2: move DPNI endpoint lookup out of the fslmc bus net/dpaa2: add APIs to query device info and set default action net/dpaa2: consolidate dequeue paths and optimize fast path net/dpaa2: bind per-queue DPIO for rx-queue interrupts net/dpaa2: add API to clean Tx confirmation queue event/dpaa2: fix DQRR held buffer accounting on enqueue bus/fslmc: store dequeue dpio in mbuf seq dynfield bus/fslmc: use explicit flags for mbuf seqn encoding net/dpaa2: unify tx burst path for ordered and atomic enqueue crypto/dpaa2_sec: unify enqueue burst path for ordered enqueue bus/fslmc: track atomic DCA context per dequeue dpio bus/fslmc: move enqueue response descriptors to per-queue event/dpaa2: add ordered schedule type support
bus/fslmc: make DPAA2 ORP/ODP ordering per-queue instead of per-device event/dpaa2: support multi-port enqueue in selftest random event
generator
event/dpaa2: do not fail device creation on DPCI errors net/dpaa2: add Tx fast path for no-confirmation case

 doc/guides/nics/dpaa2.rst                     |   29 +-
 doc/guides/rel_notes/release_26_11.rst        |   10 +
 drivers/bus/fslmc/bus_fslmc_driver.h          |   46 +-
 drivers/bus/fslmc/fslmc_bus.c                 |  321 +-
 drivers/bus/fslmc/fslmc_logs.h                |    2 +
 drivers/bus/fslmc/fslmc_vfio.c                |  562 +-
 drivers/bus/fslmc/fslmc_vfio.h                |   72 +-
 drivers/bus/fslmc/mc/dpci.c                   |   37 +-
 drivers/bus/fslmc/mc/fsl_dpci.h               |   12 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |  304 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpcon.c     |   25 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |  668 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h      |   37 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |   52 +-
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h       |  305 +-
 drivers/bus/fslmc/private.h                   |   15 +-
 .../fslmc/qbman/include/fsl_qbman_portal.h    |   24 +-
 drivers/bus/fslmc/qbman/qbman_portal.c        |  100 +-
 drivers/bus/fslmc/qbman/qbman_portal.h        |   11 +-
 drivers/bus/fslmc/qbman/qbman_sys.h           |    4 +-
 drivers/common/dpaax/dpaax_devarg.h           |   69 +
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  559 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h     |   11 +-
 drivers/dma/dpaa2/dpaa2_qdma.c                |   92 +-
 drivers/dma/dpaa2/dpaa2_qdma.h                |   15 +-
 drivers/event/dpaa2/dpaa2_eventdev.c          | 1266 ++-
 drivers/event/dpaa2/dpaa2_eventdev.h          |   61 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |  370 +-
 drivers/event/dpaa2/dpaa2_scheduler.c         |  673 ++
 drivers/event/dpaa2/meson.build               |    3 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |  544 --
 drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h  |    6 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              | 3201 ++++---
 drivers/net/dpaa2/dpaa2_ethdev.h              |  997 +-
 drivers/net/dpaa2/dpaa2_flow.c                | 8426 ++++++++---------
 drivers/net/dpaa2/dpaa2_meter.c               |  584 ++
 drivers/net/dpaa2/dpaa2_parse_dump.h          |  707 +-
 drivers/net/dpaa2/dpaa2_parser_decode.h       | 1148 +++
 drivers/net/dpaa2/dpaa2_pmd_logs.h            |   34 +-
 drivers/net/dpaa2/dpaa2_ptp.c                 |  177 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |   18 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                | 2818 +++---
 drivers/net/dpaa2/dpaa2_sparser.c             |  137 -
 drivers/net/dpaa2/dpaa2_sparser.h             |  202 -
 drivers/net/dpaa2/mc/dpni.c                   |  127 +-
 drivers/net/dpaa2/mc/fsl_dpni.h               |  378 +-
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h           |   30 +-
 drivers/net/dpaa2/mc/fsl_net.h                |    4 +-
 drivers/net/dpaa2/meson.build                 |    3 +-
 drivers/net/dpaa2/rte_pmd_dpaa2.h             |  238 +-
 lib/eventdev/eventdev_pmd.h                   |    9 +-
Quoted 9 lines
 51 files changed, 14514 insertions(+), 11029 deletions(-)
 create mode 100644 drivers/common/dpaax/dpaax_devarg.h
 create mode 100644 drivers/event/dpaa2/dpaa2_scheduler.c
 delete mode 100644 drivers/net/dpaa2/base/dpaa2_hw_dpni.c
 create mode 100644 drivers/net/dpaa2/dpaa2_meter.c
 create mode 100644 drivers/net/dpaa2/dpaa2_parser_decode.h
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.c
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.h

Still has lots and lots of AI review warnings and errors. Some maybe false positives but most likely not.

Review: [PATCH v4-S3 00/65] DPAA2 refactor (Jun Yang, Prashant Gupta)

Applied with git am --3way on dpdk-next-net for-main (52ebbf7d9de8), all 65 apply. Per-commit builds: gcc 13.3, x86_64, -Dwerror=true, net/event/crypto/dma/raw dpaa2 drivers, with and without RTE_LIBRTE_IEEE1588. Findings checked against post-apply source.

Series-level
============

1. Bugs in released code are fixed silently inside refactors, or are carried forward by them. These need standalone fixes at the head of the series with Fixes: and Cc: [email protected] so they can be backported:

- dpaa2_flow_item_convert() allocates num items, writes new_pattern[num] (heap overflow on every flow create). 21 keeps it.

Fixes 9ec293434e90 ("net/dpaa2: support tunnel inner protocol flow matching")

- RAW item length not bounded against the key buffer. 21 keeps it.

Fixes 3f881f8d6eb0 ("net/dpaa2: support raw flow classification")

- dpaa2_sec enqueue: "~(UINT64_C(1) << *dpaa2_seqn(m) & IDXMASK)", << binds tighter than &, shift by >= 2^31 is UB. 56 keeps it.

Fixes 4562de326d30 ("crypto/dpaa2_sec: support ordered queue")

- Cross-driver seqn encoding mismatch: dpaa2_sec stores

     "DCA | idx", net/event decode "seqn - 1" (56).

- eventdev enqueue clears DQRR_HELD/DQRR_SIZE before the enqueue succeeds (54).

Fixes b75061260c34 ("event/dpaa2: add enqueue and dequeue functionality")

- dpaa2_eth_eventq_attach(): "LOWEST / queue_conf->ev.priority" divides by zero for priority 0 (highest). 34 replaces it with a new divide by zero for num_priorities == 1.

Fixes 3835cc228f32 ("event/dpaa2: set priority as per DPCON device")

- priv->ep_dev_type/ep_name are never set in main, so rte_pmd_dpaa2_ep_name() returns "" and the speed capability MAC check is dead. 49 fixes it without saying so.

Fixes a0f8ddc41218 ("net/dpaa2: add API to get endpoint name")
Fixes c78fa95fa9b0 ("net/dpaa2: set speed capabilities based on actual MAC")

- nb_tx_queues = num_tx_tcs * num_channels can exceed tx_vq[16] (07).

Fixes 72100f0dee21 ("net/dpaa2: support level 2 in traffic management")

- dpaax_ptp.h compares be16 udp->dst_port to host order 319/320; UDP PTP never matches on LE. 13 makes dpaa2 depend on it.

Fixes 6cc1246b3b1a ("net/dpaa: support IEEE 1588 by timesync API")

- qbman_swp_interrupt_set_inhibit() writes 0xffffffff (44).

Fixes 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")

- eventdev create leaks DPCON/DPCI on setup_dpci failure, and info_get counts DPIOs already in use (42).

Fixes 8a5d7a8ec74b ("event/dpaa2: initialize device")
Fixes 342f299568ea ("event/dpaa2: return correct number of event ports")

- tx_burst returns short on rte_vlan_insert() failure (57 keeps

     it).

2. Build failures on for-main (gcc 13, -Werror):
- 08..65: fslmc_vfio.h adds #include <rte_vfio.h>, which no longer exists after the VFIO rework in main (now dev_vfio.h). Every patch from 08 on fails. Rebase on current for-main.
- 21..65: -Warray-bounds in dpaa2_flow_extract_support():
uint8_t mask[64], i;
rte_memcpy(mask, mask_support, size); /* uint8_t size */
Bound size (if (size > sizeof(mask)) return -EINVAL;) and use memcpy.
- 42/43: rte_atomic16_read() is gone from for-main; implicit declaration. Replaced in 44.
- 12: DPAA2_TX_CONF_ENABLE removed but still used under

     RTE_LIBRTE_IEEE1588 until 13.

With the vfio include and the mask bound patched locally, every other commit builds and the tip links.

Functional bisect breaks:
- 29/30: enqueue checks priv->evq_info[q].event_port which nothing sets until 31; no event can be enqueued.
- 31: dequeue_wait still uses DPAA2_PER_LCORE_DPIO which dequeue no longer affines; NULL deref until 43/44.
- 57/58: dqrr_held[] stores ~(1 << idx) then does HELD &= ~held, corrupting held state until 59.
- 08: MC firmware version check removed, restored in 09.

3. Squash or reorder: 12+13, 17..20 (xstats rewritten four times, 17 has wrong name/id mapping), 23 before 22, 34+35, 44+47+52 (DPIO intr API reworked three times), 49 before 17 (all DPAA2_MAC checks in 17..20 are dead until 49), 59 into 57/58.

4. Too large to review or bisect: 01 (~1800 lines), 12 (~1400 lines in rxtx.c), 21 (10k lines), 31 (4 drivers), 51, 62. Split refactor (no behaviour change) from behaviour changes and from new features. Several commit logs do not describe the diff (01, 12, 18, 21, 37, 47, 63).

5. Eventdev API problems: enqueue only accepted to queues linked to the calling port (29, 41; main crashes instead, still wrong); port_link replaces links instead of
adding (31); ORDERED dropped (29) and re-added (61); Rx adapter queue_id overwritten with the ethdev rxq id (31); 10 ms delay in enqueue on unlinked ports (31). The selftest (33) was rewritten around these restrictions. Run dpdk-test-eventdev pipeline/perf against the series.

6. 47 and 52 write "performance" to cpufreq scaling_governor and rewrite /proc/irq/N/smp_affinity_list from the event and Rx fast paths, using rte_lcore_id() as a CPU number. Host power policy is not a PMD decision. Drop it.

7. getenv() for device config: new DPAA2_SCHEDULE_RX_PREFETCH (34); 44 extends the existing DPAA2_PORTAL_INTR_* env vars to event and rx-intr DPIOs. Use devargs or API arguments. (Removing env vars in 01, 21, 62 is welcome; note it in release notes.)

8. New PMD-specific API surface: rte_pmd_dpaa2_rx_get_offset, flow_table_query, rte_dpaa2_flow_group_set_miss_actions, rte_dpaa2_scheduler_*, rte_dpaa2_dev_tx_multi_ports, rx_queue_info_get, dev_info_get, configure_default_action, clean_tx_conf, and group type bits encoded into rte_flow attr->group. None have doxygen or release notes. Mixed rte_dpaa2_ and rte_pmd_dpaa2_ prefixes. Justify on the list why these cannot be done with generic ethdev/rte_flow/eventdev API.

9. Commit 12 has no subject; the first body paragraph became the Subject header.

10. 21 rewrites the flow engine on top of the current for-main dpaa2_flow.c and drops three fixes just merged there:
- 5384de9604 MPLS key width 4 bytes: back to 3, every extract after MPLS is one byte off.
- a441f8345c minimum key size only for DPNI >= 8.7: version check dropped, older DPNI get 24-byte entries.
- fa6bed304e default miss queue = last queue of the TC: back to the first queue; its 26.11 release note is now wrong.
Rebase the rework onto these.

Patch findings
==============

[01/65] net/dpaa2: refactor and optimize Rx parser result decode

Error: VLAN ptype wrong, QinQ never detected
dpaa2_dev_rx_parse_vlan() gets the summary after "frc_u.u16 &= ~DPAA2_PKT_TYPE_VLAN", so "sum->vlan > 1" is never true. RTE_PTYPE_L2_* is an enumerated field: ETHER(1) | VLAN(6) == 7 == QINQ, so every single-tagged frame is reported as QinQ. Same for VLAN|ARP in parse_frc.
Fix: pass the unmasked summary;

    *pt = (*pt & ~RTE_PTYPE_L2_MASK) |
          (sum->vlan > 1 ? RTE_PTYPE_L2_ETHER_QINQ
                         : RTE_PTYPE_L2_ETHER_VLAN);

Error: IEEE1588 Rx timestamp no longer recorded
The RTE_LIBRTE_IEEE1588 block in dpaa2_dev_prefetch_rx_common() is deleted and parse_frc() never sets RX_IEEE1588_TMST.
Fix: keep the block; set PTP|TMST from fas->ptp in parse_frc().

Error: rejected Tx SG FD freed with the Rx SG converter
dpaa2_dev_free_eqresp_buf() calls dpaa2_eth_sg_fd_to_mbuf() on a Tx FD. Tx SGEs hold data addresses, not buffer starts, so DPAA2_INLINE_MBUF_FROM_BUF() yields a bogus mbuf that is written and freed; inline SGT is freed twice.
Fix: Tx-specific free (recover the mbuf stored for the FD).

Warning: !by_channel guard on the error queue drain removed from the
prefetch path; reintroduces the portal conflict the comment in main describes. Restore it.

Warning: dpaa2_dump_print() logs to RTE_LOGTYPE_USER1. Use
dpaa2_logtype_pmd. 05 claims driver-logtype filtering as its goal.

Warning: eCPRI type 4 dump memcpy()s wire bytes into a bitfield over a
be32 word; rma_id/ele_id are swapped. Main assembled bytes explicitly.

[02/65] net/dpaa2: generate devargs table and string from one list

Error: secondary process clears primary's priv->flags
"priv->flags = 0; dpaax_get_devargs(...)" now runs before the secondary early return. priv is shared dev_private.
Fix: parse/reset flags in the primary only.

Warning: devarg semantics changed (also 03, 04). Old handler accepted
only "1"; now atoi(): "=0" clears, "=yes" clears silently, key-only args pass value == NULL to handlers that atoi() it (03, 06 crash).
Fix: check pair->value != NULL once in dpaax_get_devargs(), parse with strtoul + end check, document the change.

[03/65] crypto/dpaa2_sec: use table-driven devargs parsing

Error: drv_strict_order can never take effect
dpaax_get_devargs() now runs at the top of dpaa2_sec_dev_init(); the primary path later does "internals->en_loose_ordered = true;".
Fix: set the default before parsing, drop the later assignment.

Error: atoi(pair->value) with value NULL on "drv_strict_order" with no
"=" crashes probe. Same in 06 (drv_parse_protocol_offset).

Warning: dump_level and en_loose_ordered are written by secondary
probe into shared dev_private. Primary only.

[06/65] net/dpaa2: expose Rx L3/L4/L5 offsets via mbuf dynfield

Warning: rte_pmd_dpaa2_rx_get_offset() returns stale dynfield data
for eventdev and loopback Rx paths (never filled there). Per-packet DPAA2_PMD_ERR. No doxygen, no doc for drv_parse_protocol_offset.

Warning: dpaa2_dev_rx_parse_offset() runs after
dpaa2_eth_sg_fd_to_mbuf() and reads the annotation at DPAA2_GET_FD_ADDR(fd); for S/G that SGT buffer was already freed with rte_pktmbuf_free_seg(). Parse inside the fd_to_mbuf helpers before the free. 13 copies the pattern in print_parser_result().

[07/65] net/dpaa2: optimize dpaa2 Tx queue and channel mapping

Error: Tx queue to TC/channel mapping changed, not in log
"channel_id = tc_id < num_channels ? tx_channels[tc_id] :
tx_channels[num_channels - 1]": with 2 channels and 8 TCs, TC1..7 share ch1 and channels 2..N are unused. txq i moves from TC (i % tcs) to TC (i / q_per_tc). dpaa2_tm still advertises
num_tx_tc * num_channels leaves.
Fix: keep the per-channel mapping or document and update dpaa2_tm.

Warning: the tx_vq[]/rx_vq[] caps fix a released overflow (see
series item 1). Split out with Fixes/stable.

[08/65] bus/fslmc: split bus-level device walk from VFIO primitives

Error: #include <rte_vfio.h> in fslmc_vfio.h; header no longer exists
on for-main (dev_vfio.h). Build fails from here to 65.

Warning: MC firmware version check removed here, restored in 09.
Leave it in place in 08.

[09/65] bus/fslmc: centralize MC version and SoC detection

Warning: fslmc_vfio_core_cluster_sdest() divides by
dpaa2_cluster_size before checking it for zero. Check first.

[10/65] net/dpaa2: remove unused soft parser loader

Warning: ss_offset/ss_iova/ss_param_iova are now unused; remove.
The /dev/mem O_RDWR probe moved to bus scan should be O_RDONLY / PROT_READ and log errno, not fd.

[11/65] net/dpaa2: cache per-rxq DPNI queue cfg and share CGID per TC

Error: cgid_in_use[] shrunk to MAX_TCS (8), still indexed up to
max_cgs = attr.num_cgs (up to 255).
Fix: priv->max_cgs = RTE_MIN(attr.num_cgs, MAX_TCS).

Error: eventq_detach no longer detaches
Clears DPNI_QUEUE_OPT_DEST from options and then calls dpni_set_queue(); MC ignores the destination, FQ stays on the DPCON. Still so at 65. cfg is NULL after rx_queue_release or close with no re-setup and is dereferenced unchecked.
Fix: if (!cfg) return -EINVAL; set DEST_NONE and pass DPNI_QUEUE_OPT_DEST.

Error: rx_queue_setup err_quit frees a DPCON owned by an earlier setup
(dpcon_allocated removed). Restore the local flag.

Warning: cgid_in_use[tc]++ not undone on setup failure; CG taildrop
never programmed for that TC again.

[12/65] (no subject)

Error: subject line missing (see series item 9). Log claims Rx
FD-to-mbuf helpers are reused, omits IEEE1588 and TM taildrop removal.

Error: bisect break with RTE_LIBRTE_IEEE1588 (series item 2).

Error: indirect mbufs sent with parent's data_off/data_len
"mi = rte_mbuf_from_indirect(mbuf); ... mbuf = mi;" then the FD is built from mi. A clone after adj/trim (ip_frag) sends wrong bytes.
Fix: build FD from rte_pktmbuf_iova(m)/m->data_len of the indirect.

Error: indirect refcount handling is use-after-free
simple_fd drops a ref on the clone without taking one on mi; sge helpers rte_pktmbuf_init()+free_seg() live indirects; conf path writes "mi->next = cur_seg->next" into a shared parent.
Fix: never reinit a live mbuf; take a ref on mi or copy.

Error: NO_CONF single-segment path lets HW free shared buffers
Shared direct mbufs get mempool_to_bpid(); HW releases a buffer others hold. Main set IVP and dropped one ref.

  Fix: if (rte_mbuf_refcnt_read(m) > 1) { DPAA2_SET_FD_IVP(fd);
       rte_mbuf_refcnt_update(m, -1); }

Error: inline SGT buffer gets a BPID in both FD and SGE[0]; released
twice. Set DPAA2_SET_FLE_IVP for cur_seg == sg_mbuf.

Error: conf S/G with cloned head: sg_mbuf->next points at the freed
head; double free on confirmation.

Error: per-packet helper failure returns short after the helper
already freed/relinked the mbuf; caller frees it again. Free the packet, count a drop, continue.

Error: Tx-conf VDQ left outstanding when storage is freed; QBMan can
DMA into freed memory. Drain and dpaa2_clear_queue_active_dps() before dpaa2_queue_storage_free().

Warning: TM software taildrop (tm_sw_td) silently removed; dpaa2_tm
still sets it.

Warning: dpaa2_dev_free_eqresp_buf() rebuilds mbuf via
rte_dpaa2_bpid_info[256] for conf FDs (BPID MAX_BPID); loopback FDs with drv_tx_conf=1 have stash config in FLC, deref'd as mbuf.

Warning: dynamic confirm writes FAEAD at buf_addr + 0x58 with no
headroom check for foreign/extbuf mbufs.

Warning: tx_ordered "void *mq[nb_pkts]" VLA; multi_txq tx_again never
taken; tx_conf pulled once per packet.

[13/65] net/dpaa2: support runtime IEEE1588 timestamping

Error: read_tx_timestamp tests txq->ts_to_cnfd on the Tx queue; the
counter lives on tx_conf_queue. Never waits; returns stale value. 53 rewrites the line and keeps the bug.
Fix: txq->tx_conf_queue->ts_to_cnfd, bounded wait, -EAGAIN.

Error: dynfield written at offset 0 when unregistered
rx_ts_offset is registered only with RX_OFFLOAD_TIMESTAMP; after timesync_enable() without it every Rx mbuf's buf_addr is overwritten.
Fix: rx_ts_offset = -1 at init; write only when >= 0.

Error: tx_burst issues dpni_set_single_step_cfg() (global MC lock, up
to 1 s spin) and races on ptp_correction_offset across lcores. Configure one-step from the control path only.

Error: S/G frames get a stale timestamp
dpaa2_dev_rx_read_timestamp() reads m->buf_addr + PTA after dpaa2_eth_sg_fd_to_mbuf(); for S/G the annotation is in the SGT buffer (FD addr), already freed. Main read fd_addr + PTA. Read it inside the fd_to_mbuf helpers.

Warning: priv->rx_timestamp stored for every packet from every lcore,
not only FAS_PTP frames. Eventdev Rx paths lose timestamps.

Warning: ts_to_cnfd incremented after enqueue (conf may decrement
first). Once the wrong-counter bug is fixed, read_tx_timestamp drains conf from the control thread with q_storage[rte_lcore_id()] (LCORE_ID_ANY out of bounds).

Warning: per-packet WARN/INFO in Tx path. PTP Tx now needs an
undocumented drv_tx_conf/drv_tx_dyn_conf.

[14/65] bus/fslmc: consume dpaa2 DQRR entries in batches

Warning: released atomic contexts stay held until ci_flush_th is
reached; if the loop exits on nb_events they block those flows on all ports until this lcore polls again. Flush after the release loop.

[17/65] net/dpaa2: rework xstats with page table and MAC support

Error: xstats_get(NULL, 0) returns 0 instead of the count, so the
driver xstats disappear from size queries (telemetry). 19 keeps it; n > count returns -EINVAL on non-DPMAC ports.

  Fix: count = dpaa2_xstats_count(dev);
       if (xstats == NULL || n < count) return count;

Warning: stats_get memsets stats (wipes ethdev rx_nombuf), puts HW
nobuffer in rx_nombuf, counts discards in both ierrors and imissed. Keep main's mapping.

Warning: policer page fetched for all 8 TCs ("tc < MAX_TCS" always
true); MC error on a missing TC fails xstats. Use num_rx_tc.

Info: rte_le_to_cpu_64() dropped on MAC counters read from MC.

[18/65] net/dpaa2: unify xstats layout and add DPMAC counter struct

Warning: log says no behaviour change; all MAC/policer xstat names
change and DPAA2_MAC_NUM_STATS 46->62 requests new counters from MC. User visible: document it.

Warning: ".pg.field = (uint64_t)RTE_STR(field)" stores pointers in
uint64_t; not a constant expression on 32-bit. Use a separate const char * table.

[20/65] net/dpaa2: fetch only requested MAC xstats in one MC call

Error: repeated MAC ids overrun mac_val[62] on stack and the DMA
buffer; "uint16_t i" vs "uint32_t n" loops forever for n > 65535.
Fix: bound mac_num, flush in chunks; uint32_t i.

Warning: MAC DMA buffers allocated on every call and every port; an
alloc failure fails stats_get on non-MAC ports.

[21/65] net/dpaa2: rework flow with per-table profile and group types

Error: -Warray-bounds build failure (series item 2)
dpaa2_flow_extract_support(): uint8_t mask[64] filled with rte_memcpy(mask, mask_support, size) with no bound on size.

Error: reverts for-main 5384de9604, a441f8345c, fa6bed304e (series
item 10). MPLS field_size "sizeof(uint8_t) * 3" must be 4; dpaa2_flow_entry_size() must keep the dpaa2_dev_cmp_dpni_ver(priv, 8, 7) check; default miss queue must stay the last queue of the TC.

Error: QoS-only flows accept DROP/PORT_ID/REPRESENTED_PORT, but QoS
entries cannot drop or redirect; traffic is steered to the TC and create returns 0. Allow only QUEUE/JUMP for QoS-only flows.

Error: s_dpaa2_flow_proto_handle[64] indexed by user item type; enum
already goes to 70 and PMD items are negative. Bounds check.

Error: actions_update[4] on stack, check_actions_support() writes one
entry per matching action plus END with no bound.

Error: dpaa2_flow_actions_update() passes flow->qos_flow to the FS
update; NULL for FS-only flows. Pass flow->fs_flow.

Error: dpaa2_flow_rss_action_update() tests items[i - 1].type != END
after the loop: rejects every non-empty pattern, reads items[-1] for [END].

Error: RAW extract writes dpkg.extracts[raw_idx] in place and bumps
num_extracts; overwrites the IP address extract. Use dpaa2_dpkg_insert_extract().

Error: group type bits not stripped
attr->group = id | type << 8 is compared with rxq->tc_index and used in "group * qos_entries_per_tc + priority". QUEUE/RSS on QoS/MIX groups always rejected; with drv_qos_entries_per_tc, QoS/MIX flows (including the PMD's DCB flows from 27) fail with -ENOSPC.
Fix: tc = RTE_DPAA2_FLOW_GROUP_ID_GET(attr->group) and use it.

Error: IPv6 item sets flow->ip_src/ip_dst = NET_PROT_IPV4; first
destroy shrinks IPv6 extracts to 4 bytes.

Error: dpaa2_flow_create_*_flow() calls dpaa2_flow_clean() which
frees application-held flows (UAF on later rte_flow_destroy()), before the new flow is even parsed. Return -EEXIST instead.

Error: [JUMP, END] also programs an FS entry with JUMP as its action;
log says JUMP is QoS-only.

Error: failed create leaves the shared key profile modified (holes
inserted in every flow's key) with HW not reprogrammed.

Error: PPPoE handler uses DPAA2_PARSER_MPLS_ID, fields_num 1
(session_id never extracted).

Error: IPv4 fragment_offset: any mask sets the IP_FRAG FAF bit to 1,
so "spec 0 / mask 0x3fff" (non-fragments) matches fragments only.

Error: remove_invalid_extract() returns 0 when only IP extracts are
removed; table not reprogrammed, RSS destroy returns -EINVAL and leaks.

Error: flow_table_query derefs flow->qos_flow/fs_flow without NULL
check; crashes on QoS-only/FS-only/RSS flows.

Error: new symbols tagged with old versions
RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_dpaa2_flow_group_set_miss_actions, 23.11) RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa2_flow_table_query, 24.11)
Neither exists in main. Use 26.11.

Error: single-TC ports now always create a QoS entry, but QoS table
config returns early for num_rx_tc <= 1.

Warning: ip_addr_offset not adjusted when a preceding non-IP extract
is removed; second IP offset uses ip_addr[1].max_size instead of ip_addr[0].max_size.

Warning: flow_destroy does LIST_REMOVE then frees only on full
success; "ret |= -errno" ORs errnos; error never set.

Warning: query does a table dump, discards it, returns 0 for any
action. Return -ENOTSUP.

Warning: validate ignores unsupported actions that create rejects;
out-of-range group silently becomes QoS group 0.

Warning: fprintf(stderr, ...) in dpaa2_extract_ip_addr_add(); ~350
lines of static inline flow helpers in dpaa2_ethdev.h. Use DPAA2_PMD_ERR, move helpers into dpaa2_flow.c.

Warning: dev_init returns 0 on extract_param/entry_map alloc failure.

Warning: drv_qos_entries_per_tc undocumented, atoi() into uint16_t.

Warning: commit log does not match code (env var vs devarg, flag
names, query, JUMP). Split: data model, handler table, devargs, actions_update, miss actions, query, RSS.

[22/65] net/dpaa2: reimplement RSS distribution via rte_flow

Error: tbl_profile->rss_flow is the internal dpaa2_generic_flow, not
the rte_flow handle; rte_flow_destroy() on it does LIST_REMOVE on the wrong type. rss_hash_update/reta_update always -EINVAL once RSS is active.

Error: rte_pmd_dpaa2.h now includes <ethdev_driver.h> and the inline
derefs rte_eth_devices[]; installed header no longer usable by apps. The inline also leaks the flow handle and passes queue = NULL with queue_num > 0.

Warning: stable symbol rte_pmd_dpaa2_set_custom_hash removed (now an
experimental inline). 26.11 is an ABI window, but the removal needs a deprecation notice in a prior release.

Warning: creating any FS flow destroys the PMD's RSS flow; after that
rss_hash_update silently returns 0.

Warning: rss_hash_update returns 0 with nothing programmed when no
RSS flow exists.

Warning: PMD-created RSS/DCB/miss flows live on the user's flow list;
rte_flow_flush() removes them and leaves rss_flow/dcb_flow[] stale (also 26, 27). Use internal helpers.

[25/65] net/dpaa2: support rte_mtr and METER rte_flow action

Error: METER unreachable

    } else if (meter_action->type == RTE_FLOW_ACTION_TYPE_METER_MARK)

repeats the first test. Compare with RTE_FLOW_ACTION_TYPE_METER.

Error: rte_mtr rates are bytes/s uint64_t; policer cir/eir are
uint32_t Kbps. Programs 125x too high and truncates.
Fix: cir_kbps = cir * 8 / 1000; reject > UINT32_MAX at profile_add.

Warning: profile/policy delete frees meters still in use (no -EBUSY),
duplicate ids accepted, meter_destroy ignores bound flows; objects leak on close; rte_zmalloc for CPU-only lists.

Warning: rte_spinlock_init(&priv->meter_lock) in mtr_ops_get, which
runs on every rte_mtr call. Control ops are not thread safe by convention; drop the lock.

Warning: packet_mode > 1 used as a hidden unit selector; meter flow
accepts any pattern; DO_NOT_RESET_COUNTERS sent to old MC.

Warning: dpaa2_flow_create_rss_flow() destroys user meter flows on
reconfigure; later rte_flow_destroy() is use-after-free.

Warning: meter_profile_update/meter_policy_update only store the new
id; the DPNI policer is never reprogrammed, so updating a bound meter has no effect. Reprogram or return -ENOTSUP while in use.

[26/65] net/dpaa2: program flow table miss actions via rte_flow

Warning: miss-action errors only logged in dev_configure; QoS call
made when qos_entries == 0 logs ERR on every configure. Also ~170 lines of unrelated code motion and errno changes not in the log.

[27/65] net/dpaa2: support DCB Rx mode via rte_flow

Error: dcb_tc[] is indexed by priority and holds the TC; code treats
it the other way round.
Fix: for (prio = 0; prio < RTE_ETH_DCB_NUM_USER_PRIORITIES; prio++)

           dpaa2_setup_flow_dcb_dist(dev, prio, dcb_tc[prio]);

Error: dcb_flow[] cleared only at close; stop/configure fails with
-ENODATA on the second configure.

Warning: dcb_info reports identity mapping, not the configured one.

[29/65] bus/fslmc: support DPCI peer and dynamic queues

Error: "uint16_t expected = 0;" moved out of TAILQ_FOREACH in
rte_dpaa2_alloc_dpci_dev(); a failed CAS leaves expected == 1, so the next in-use DPCI is handed out again. Same in 30 for DPIO.
Fix: declare expected inside the loop.

Error: dpci_get_peer_attributes() decodes with dpci_rsp_get_attr;
use dpci_rsp_get_peer_attr (num_of_priorities at byte 8).

Error: DPCI Rx DQ storage alloc removed; raw/dpaa2_cmdif still does
rxq->q_storage[0]->dq_storage[0] -> NULL deref.

Error: enqueue validation failures "goto send_partial" without
frames_to_send = loop; garbage descriptors pushed to QBMan (29-30, fixed in 31). rte_errno never set (still at 65).

Error: dpaa2_eventdev_create() do/while over free DPCON/DPCI pairs
has no bound; more than 16 pairs write past priv->evq_info[16]. Fixed in 41/42; keep the bounded for loop here.

Warning: ORDERED and NONSEQ_MODE dropped while QUEUE_ALL_TYPES still
advertised; not in log. 61 re-adds them; do not drop them here.

Warning: free does fetch_sub on a 0/1 flag; no detach resets cb/dest,
so a freed DPCI returns -EBUSY on reuse.

[31/65] event/dpaa2: rework event port model and DPCI handling

Error: DCA consumed on the wrong portal
Dequeue records held DQRR on portal->dpio_dev; net Tx, Tx adapter and dpaa2_sec still use DPAA2_PER_LCORE_PORTAL/DQRR_*.

Error: port_link: "ret = rte_event_port_unlink(...); if (ret) return
ret;" unlink returns the count unlinked; second link returns it without linking (31-40). Linking must add, not replace.

Error: dequeue_wait still uses DPAA2_PER_LCORE_DPIO; dev_stop drains
with dequeue_burst(.., 1, 1) from the control thread, so rte_event_dev_stop() can crash even with timeout 0 (until 43).

Error: dequeue counts an unwritten event when rxq has no cb.

Error: enqueue livelock: after validation error or env_pool empty,
"while (nb_events)" restarts at the same event forever. Return num_tx with rte_errno.

Error: dpaa2_ethq->ev.queue_id = eth_rx_queue_id overrides the Rx
adapter's event queue id; flow_id forced regardless of FLOW_ID_VALID.

Warning: rte_delay_us(10000) in enqueue/dequeue on unlinked ports,
under port_lock.

Warning: Rx adapter queue_del made a no-op until 37.

Warning: RTE_DPAA2_EVENT_PORT_CFG_ATOMIC uses bit 31 of the library
owned event_port_cfg, declared in the net header.

Warning: 1024-entry mempool with 512 cache per DPCI Rx queue at probe
(~1 MB hugepage each), whether used or not; caps in-flight events at 1024 while max_num_events reports INT32_MAX - 1.

[32/65] event/dpaa2: fix Tx adapter enqueue for mixed destinations

Warning: SAME_DEST guarantees one port/queue; the old code was right.
Dropping rte_eth_tx_burst() breaks non-dpaa2 ethdevs, which caps report as INTERNAL_PORT and get cast to struct dpaa2_queue. Drop or restrict caps to dpaa2 ports.

[34/65] event/dpaa2: add DPCON based standalone Rx scheduler

Error: pull size not clamped: nb_pkts passed to the pull descriptor
instead of pull_size; storage holds dpaa2_dqrr_size entries.

Error: "uint8_t priority_step = 256 / num_priorities" is 0 for
num_priorities == 1; then divides by it. Use unsigned int.

Warning: getenv("DPAA2_SCHEDULE_RX_PREFETCH"). Use the mode argument
added in 35.

Warning: destroy leaks DQ storage; q_storage[rte_lcore_id()] with no
LCORE_ID_ANY check; scheduler API declared in the net header, no doxygen; max_prio returns num_priorities not num_priorities - 1.

[35/65] event/dpaa2: add push mode to DPCON Rx scheduler

Error: first rx on each lcore issues MC commands (attach, static
dequeue channel) and writes shared port_queue[].configured from concurrent workers. Attach on the control path.

Error: rte_dpaa2_scheduler_max_prio() derefs dpcon_dev[0], NULL in
push mode until lcore 0 receives.

Warning: push mode allocates an unused DPCI per lcore.

Warning: push mode leaves queue_conf zeroed; sched_type 0 is ORDERED,
so every rxq gets the ordered cb and an ORP. Set PARALLEL for both modes in scheduler_add().

[36/65] event/dpaa2: drain Rx scheduler queues on destroy

Warning: drains other lcores' portals from the control thread;
prefetch pulls left by workers never consumed; rte_delay_ms(1) per drained packet.

[37/65] event/dpaa2: track and detach attached Rx queues

Error: push detach loops attach_num (lcore count) over port_queue[];
NULL eth_dev or rxqs left bound to a freed DPCON.

Error: queue_del(-1) detaches every ethdev's rxqs, not this port's.

Error: Rx adapter stop drains all event ports from the control thread
while workers run, then detaches; start is a no-op, so stop/start loses Rx. Log does not match.

Error: evq_info[].dpni_rxqs[] keep rxq pointers past ethdev close;
eventdev close detaches freed memory with priv->hw NULL.

Warning: attach not idempotent (re-add double counts); close skipped
when never started (leaks DPIOs).

[38/65] net/dpaa2: add multi-port Tx API

Warning: "struct dpaa2_queue *txq[nb_pkts]" VLA; no port/txq_id
validation; no doxygen; per-packet failure returns short; copy-path mbufs freed before enqueue are reported unsent (double free).

[39/65] event/dpaa2: limit attached Rx flows per event queue

Error: max_event_queue_flows lowered to 1024 while queue_def_conf
still sets nb_atomic_flows 2048; rte_event_queue_setup() with defaults fails. Use a separate attach bound.

Warning: dpni_rxq_num widened to uint16_t but eth_queue_del() loops
with uint8_t j, k; more than 255 rxqs never terminates.

[40/65] eventdev: fix port link/unlink callback return documentation

Warning: library change in a vendor series; send standalone to the
eventdev maintainer with Fixes:. "Number of unlinks successfully established" reads wrong; drop the NXP copyright on a Cavium header for a comment fix.

[41/65] event/dpaa2: allow event queue link to multiple ports

Warning: port_unlink indexes pos[16]/evq_infos[16] by nb_unlinks,
which can exceed 16 with repeated queue ids. Stack overflow.

Warning: enqueue still rejects queues not linked to the port
(series item 5). Main crashes there instead; both violate the API.

[42/65] event/dpaa2: report available DPIO count and fix create cleanup

Error: rte_atomic16_read() no longer exists in for-main; 42 and 43
fail to build (implicit declaration).
Fix: rte_atomic_load_explicit(&dpio_dev->ref_count,
rte_memory_order_relaxed)

Warning: failed create still calls event_dev_probing_finish() and
never releases the eventdev (also 64). The create leak and info_get count fixes need Fixes/stable (series item 1).

Warning: DPAA2_EVENTQ_LINK_CONF_MAX rewrite and unused
DPAA2_EVENT_MAX_PORTS not in log.

[44/65] bus/fslmc: consolidate DPIO interrupt setup

Warning: existing getenv() thresholds now applied in the bus
allocator to every interrupt DPIO; sscanf return unchecked. The set_inhibit change is a fix (series item 1).

Warning: ethrx portals now armed at alloc; net rx_queue_intr_enable
then returns early and gets holdoff 0xff. 52 reverts it.

[45/65] event/dpaa2: honor configured dequeue timeout

Warning: timeout_ticks honoured without PER_DEQUEUE_TIMEOUT, and in
global mode timeout_ticks == 0 still waits dequeue_timeout_ns; 64-bit divide on every burst; ns * event_hz overflows; ms truncated to int for epoll_wait.

[46/65] bus/fslmc: use EAL API for DPIO interrupt

Warning: event driver logs with DPAA2_PMD_DP_DEBUG (net logtype,
reached through an accidental include chain); dpaa2_logtype_pmd is not exported, so shared builds with DP debug fail to link. Use the eventdev log macro.

[47/65] bus/fslmc: defer DPIO interrupt setup and bind portal to worker

Error: driver writes cpufreq scaling_governor and /proc/irq affinity
from dpaa2_event_portal_io_prepare() (fast path). Drop the governor code; do affinity/stashing at port setup.

Error: "cpu = rte_lcore_id()" used as physical CPU for IRQ affinity,
governor and stashing. Use dpaa2_get_core_id().

Warning: eventfd leaked per intr init/deinit cycle.

Warning: log mentions an "unlikely" hunk that does not exist; three
helpers exported then made static in 52.

[48/65] bus/fslmc: move Tx SG mempool to fslmc bus

Error: Rx SG walk bound removed
- while (!DPAA2_SG_IS_FINAL(sge) && i < DPAA2_MAX_SGS) {
+ while (!DPAA2_SG_IS_FINAL(sge)) {
Log claims it is now bounded. Restore the bound.

Warning: SG pool created unconditionally at bus probe, also for
crypto-only and secondary; NULL result ignored.

[49/65] net/dpaa2: move DPNI endpoint lookup out of the fslmc bus

Warning: fixes ep_dev_type/ep_name never being set in main (series
item 1). Say so, add Fixes, move before 17.

[50/65] net/dpaa2: add APIs to query device info and set default action

Error: new symbols tagged 25.11

    RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa2_rx_queue_info_get, 25.11)
    RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa2_dev_info_get, 25.11)

Use 26.11. No doxygen or release notes for the three functions.

[51/65] net/dpaa2: consolidate dequeue paths and optimize fast path

Error: scheduler prefetch priming inverted
"if (likely(q_storage->active_dqs))" never primes on first call, then derefs NULL dq_storage. Use if (unlikely(!...)).

Warning: tx_conf "if (refcnt_read > 1) refcnt_update(-1)" races with
the other owner and skips chained segments. Use rte_pktmbuf_free().

Warning: error queue dump uses q_storage[0] from all lcores.

[52/65] net/dpaa2: bind per-queue DPIO for rx-queue interrupts

Error: Rx burst now sets IRQ affinity, stashing and governor on first
call (see 47). Releasing a queue or port never polled passes cpu_affine -1 to the governor restore, which restores every CPU, including ones other queues still use.

Warning: intr_enable returns early when napi_armed, CDAN is one-shot;
dev_started check removed. Holdoff default changed from 0 to 0xff.

[53/65] net/dpaa2: add API to clean Tx confirmation queue

Error: rte_pmd_dpaa2_clean_tx_conf() uses tx_queues[txq_id] without
checking txq_id < nb_tx_queues or NULL.

Warning: no doxygen; must run on the lcore owning the Tx queue (races
with tx_burst).

[54/65] event/dpaa2: fix DQRR held buffer accounting on enqueue

Warning: bug is in released code. Add

Fixes b75061260c34 ("event/dpaa2: add enqueue and dequeue functionality")

and send ahead of the refactor.

[55/65] bus/fslmc: store dequeue dpio in mbuf seq dynfield

Warning: seqn dynfield grows to 16 bytes, 8-aligned, registered at
bus probe for every user. Store a DPIO index, not a pointer.

[56/65] bus/fslmc: use explicit flags for mbuf seqn encoding

Error: rewrites the UB shift in dpaa2_sec and keeps it (series 1).
Fix: ~(UINT64_C(1) << (*dpaa2_seqn(m) & QBMAN_EQCR_DCA_IDXMASK))

Warning: cross-driver encoding mismatch is a real bug; log calls it
"fragile". dpaa2_sec is even inconsistent with itself (ordered path decodes seqn - 1, dequeue stores DCA | idx). Describe it, Fixes/stable.

[57/65] net/dpaa2: unify tx burst path for ordered and atomic enqueue

Error: dqrr_held[loop] = ~(1 << idx) then HELD &= ~dqrr_held[i];
clears all other held bits. Fixed in 59; fold it here.

Error: "uint32_t flags[MAX_TX_RING_SLOTS]" uninitialized, restored
into seqn of every unsent mbuf. Zero per slot, restore only if set.

Error: enqueue retry exhaustion: break with ret == 0, then
"if (nb_pkts > 0 && !ret && !order) goto tx_again" skips the unsent prepared frames, which the copy path already freed. Return value is no longer a prefix. Same in 65.

Info: rte_vlan_insert() failure still returns short (pre-existing,
series item 1).

[58/65] crypto/dpaa2_sec: unify enqueue burst path for ordered enqueue

Error: "int32_t ret, order = false;" then "if (ret >= 0 && order)"
reads ret uninitialized when ops[0] is ordered. int32_t ret = 0.

[59/65] bus/fslmc: track atomic DCA context per dequeue dpio

Error: on DPIO mismatch the mbuf keeps DCA|idx and the origin portal
keeps HELD and held_bufs.mbuf[idx]; origin later writes through a freed/reused mbuf. Clear seqn on mismatch, release by index only.

Warning: statement-expression macros test &eqdesc[loop]/&flags[loop]
for NULL and assign unparenthesized args. Make them static inline functions.

[60/65] bus/fslmc: move enqueue response descriptors to per-queue

Error: every ORP frame uses priv->tx_vq[0]->eq_resp from all lcores
without a lock; the old ring was per DPIO.

Error: responses recorded on tx_vq[0] but only the caller's queues
are drained; Tx on queue != 0 stops after 127 ORP frames.

Error: slots reserved at build time never complete for frames not
enqueued; queue runs out and dpaa2_queue_eqresp_free() spins forever.

Error: dpaa2_sec_queue_pair_release() frees fle_pool, then
dpaa2_queue_eqresp_free() puts FLEs back into it. Swap the order.

Warning: eqresp pool leaked on tx_queue_setup re-setup;
DPAA2_ORDER_DEBUG dead code and USER1 logger in bus header; add RTE_BUILD_BUG_ON(!rte_is_power_of_2(DPAA2_EQRESP_MAX_NUM)).

[61/65] event/dpaa2: add ordered schedule type support

Warning: ORP restore keyed on event->sched_type (the next queue's
type); ordered -> atomic skips restoration, ordered -> parallel or direct Tx leaks the ORP flag. Decide on the seqn flag.

Warning: ORDERED accepted but RTE_EVENT_DEV_CAP_ORDERED not set and
ordered_scheduling not in features/dpaa2.ini.

Warning: dpaa2_dq_order_save() writes the mbuf dynfield for non-mbuf
events.

[62/65] bus/fslmc: make DPAA2 ORP/ODP ordering per-queue

Error: strict ORP on a DPCI queue uses a NULL eq_resp pool
The strict bit now comes from the mbuf. An event from a strict-ORP DPNI or dpaa2_sec queue forwarded to an ORDERED event queue reaches dpaa2_eq_set_order_desc() with a DPCI tx queue, which never got dpaa2_queue_eqresp_create(): pool_len 0, mask 0xffffffff, and QBMan DMAs the response to IOVA(NULL + n * 64). Nothing drains it.
Fix: no response (loose) on the eventdev path; return -EINVAL when eqresp_pool is NULL.

Warning: odpid not masked; bits 13..15 land in STRICT/ORP/DCA.

    ((id) & DPAA2_EQCR_OPRID_MASK) << DPAA2_EQCR_OPRID_SHIFT

Warning: bus, net, crypto, event and a devarg in one patch. Removing
DPAA2_STRICT_ORDERING_ENABLE silently drops strict ordering for existing users (the log claims it is still honoured); new devarg name differs from dpaa2_sec's drv_strict_order. Split, reuse the name, release note.

[64/65] event/dpaa2: do not fail device creation on DPCI errors

Warning: -ENODEV path leaves a registered, probed eventdev. Release
before event_dev_probing_finish(). Partially attached queues still accept all sched types in queue_setup.

[65/65] net/dpaa2: add Tx fast path for no-confirmation case

Error: dpaa2_dev_tx_fast() ignores DPAA2_IEEE1588_TX_TS_FLAG; one-step
PTP stops working on the default NO_CONF config. Take the fast path only when the flag is clear.

Error: retry exhaustion hole duplicated from 57.

Warning: "struct qbman_fd fd_arr[MAX_TX_RING_SLOTS] = {0};" zeroes
1 KiB per burst before dispatching to the fast path. Move it.

#204 lore raw

cover net/dpaa2 and fslmc infrastructure updates

In reply to Prashant Gupta

This series is part of the ongoing DPAA2 upstreaming effort, applied on top of v7-S1 ("dpaa2: bus, DMA and mempool base fixes") and v14-S2 ("net/dpaa2 updates").

Compared to v4-S3, the series has been reduced and reorganized to focus on DPAA2 PMD and fslmc infrastructure improvements. It includes parser decode optimizations, common devargs handling, queue management enhancements, DPRTC infrastructure support, and runtime timestamping.

Highlights:
- refactor and optimize Rx parser result decoding;
- centralize DPAA2 device argument definitions and parsing;
- use table-driven devargs parsing across DPAA2 drivers;
- unify debug dump infrastructure through log-based helpers;
- export parser protocol offsets through mbuf dynamic fields;
- rework Tx queue mapping and queue configuration handling;
- centralize fslmc device handling infrastructure;
- move DPNI endpoint lookup from the fslmc bus layer to the PMD;
- remove the unused soft parser loader;
- add dynamic Tx confirmation mode;
- provide shared DPRTC RTC services in the fslmc bus layer;
- support runtime IEEE1588 timestamping.

The series builds cleanly with arm64 and -Werror and remains bisectable.

Changes in v5:
- Reduced scope and reorganized the series.
- Separated independent functionality into dedicated patch sets.
- Reworked devargs handling using common infrastructure.
- Added fslmc DPRTC shared service support.
- Addressed review feedback from previous revisions.

Jun Yang (14):
net/dpaa2: refactor and optimize Rx parser result decode
drivers: net/dpaa2 centralize devargs definitions crypto/dpaa2_sec: use table-driven devargs parsing dma/dpaa2: use table-driven devargs parsing net/dpaa2: unify debug dump via log based helpers net/dpaa2: export parser protocol offsets via mbuf dynfield
drivers: net/dpaa2 rework Tx queue mapping
drivers: bus/fslmc centralize device handling
drivers: net/dpaa2: move DPNI endpoint lookup to PMD
drivers: net/dpaa2 remove unused soft parser loader
drivers: net/dpaa2 cache Rx queue config and share TC CGIDs
drivers: net/dpaa2 add dynamic Tx confirmation mode
drivers: bus/fslmc provide shared DPRTC RTC services net/dpaa2: support runtime IEEE1588 timestamping

 doc/guides/nics/dpaa2.rst                     |   26 +-
 doc/guides/rel_notes/release_26_11.rst        |    2 +
 drivers/bus/fslmc/bus_fslmc_driver.h          |   14 +-
 drivers/bus/fslmc/fslmc_bus.c                 |  315 ++-
 drivers/bus/fslmc/fslmc_logs.h                |    2 +
 drivers/bus/fslmc/fslmc_vfio.c                |  536 ++---
 drivers/bus/fslmc/fslmc_vfio.h                |   71 +-
 drivers/{net/dpaa2 => bus/fslmc}/mc/dprtc.c   |    0
 .../{net/dpaa2 => bus/fslmc}/mc/fsl_dprtc.h   |    0
 .../dpaa2 => bus/fslmc}/mc/fsl_dprtc_cmd.h    |    0
 drivers/bus/fslmc/meson.build                 |    2 +
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |   79 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h      |    9 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c      |   52 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprtc.c     |  131 ++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h       |   24 +-
 drivers/bus/fslmc/private.h                   |   16 +-
 drivers/common/dpaax/dpaax_devarg.h           |  112 +
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  146 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h     |   10 +-
 drivers/dma/dpaa2/dpaa2_qdma.c                |   94 +-
 drivers/dma/dpaa2/dpaa2_qdma.h                |   15 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c        |    2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h  |    6 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |  989 ++++----
 drivers/net/dpaa2/dpaa2_ethdev.h              |  259 ++-
 drivers/net/dpaa2/dpaa2_flow.c                |  118 +-
 drivers/net/dpaa2/dpaa2_parse_dump.h          |  707 +++---
 drivers/net/dpaa2/dpaa2_parser_decode.h       |  750 ++++++
 drivers/net/dpaa2/dpaa2_pmd_logs.h            |   40 +-
 drivers/net/dpaa2/dpaa2_ptp.c                 |  233 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |   18 +-
 drivers/net/dpaa2/dpaa2_rxtx.c                | 2013 ++++++++---------
 drivers/net/dpaa2/dpaa2_sparser.c             |  137 --
 drivers/net/dpaa2/dpaa2_sparser.h             |  202 --
 drivers/net/dpaa2/dpaa2_tm.c                  |    1 -
 drivers/net/dpaa2/meson.build                 |    2 -
 drivers/net/dpaa2/rte_pmd_dpaa2.h             |   42 +-
 38 files changed, 3978 insertions(+), 3197 deletions(-)
 rename drivers/{net/dpaa2 => bus/fslmc}/mc/dprtc.c (100%)
 rename drivers/{net/dpaa2 => bus/fslmc}/mc/fsl_dprtc.h (100%)
 rename drivers/{net/dpaa2 => bus/fslmc}/mc/fsl_dprtc_cmd.h (100%)
 create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dprtc.c
 create mode 100644 drivers/common/dpaax/dpaax_devarg.h
 create mode 100644 drivers/net/dpaa2/dpaa2_parser_decode.h
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.c
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.h
Signature · 1 line
2.43.0
#205 lore raw

PATCH 1/14 net/dpaa2: refactor and optimize Rx parser result decode

From: Jun Yang <[email protected]>

The hardware annotation (parse result) decode logic was scattered in dpaa2_rxtx.c and dpaa2_parse_dump.h, mixing the fast-path parsing with debug/print helpers and making the code hard to reuse and maintain.

Move the frame annotation and parse-result decode helpers into a new dedicated header, dpaa2_parser_decode.h, and clean up the surrounding Rx path:

- Add dpaa2_parser_decode.h with the annotation/parse-result decode helpers, taking the annotation as a const pointer so callers cannot mutate the hardware annotation area.
- Replace the compile-time/static print path with a runtime devarg "drv_rx_print_parser_result", so the parser result dump can be enabled per device without rebuilding.
- Pass the soft parser protocol (priv->sp_protocol) into the decode helpers so soft parser (SP) and VLAN/checksum handling is correct.
- Add a device argument to dump detailed parser results for Rx packets for debugging purposes. Consolidate RSS and flow steering metadata extraction into common helpers and perform related Rx path cleanup.

Optimize dpaa2_dev_rx_parse_new():

- Precompute the common "ETH + L3 + L4" packet types as DPAA2_FAST_PATH_PTYPE_ETH_IPV4[_UDP/_TCP] / _IPV6[...] macros and use them in the switch, instead of OR-ing RTE_PTYPE_* flags at runtime for every frame.
- Reorder the switch cases so the most common traffic (IPv4/IPv6 UDP/TCP) is matched first, reducing branch cost on the hot path.
- Keep VLAN frames on the fast path: read the FRC parse summary through a union (dpaa2_psr_summary), mask off the VLAN bit, and resolve the packet type via the fast-path switch plus dpaa2_dev_rx_parse_vlan(). Previously a VLAN tag made the frame miss the switch and fall into the slow path (dpaa2_dev_rx_parse_slow) for every packet; now the slow/FRC path is only used for the uncommon default case.

---
 doc/guides/nics/dpaa2.rst               |   6 +-
 drivers/net/dpaa2/dpaa2_ethdev.c        |  31 +-
 drivers/net/dpaa2/dpaa2_ethdev.h        | 172 ++++--
 drivers/net/dpaa2/dpaa2_parse_dump.h    | 707 +++++++++++-----------
 drivers/net/dpaa2/dpaa2_parser_decode.h | 750 ++++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_pmd_logs.h      |  18 +-
 drivers/net/dpaa2/dpaa2_rxtx.c          | 372 ++++++------
 drivers/net/dpaa2/rte_pmd_dpaa2.h       |  13 +-
 8 files changed, 1465 insertions(+), 604 deletions(-)
 create mode 100644 drivers/net/dpaa2/dpaa2_parser_decode.h
doc/guides/nics/dpaa2.rst +5 -1
index 2928575208..60ca695f59 100644
@@ -1,5 +1,5 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright 2016,2020-2021 NXP
+    Copyright 2016,2020-2026 NXP
 
 
 DPAA2 Poll Mode Driver
@@ -484,6 +484,10 @@ Refer to the document :doc:`build_and_test` for details.
   to start dropping the error packets in hardware (parse errors).
   e.g. ``fslmc:dpni.1,drv_rx_parse_drop=1``
 
+* Use dev arg option ``drv_rx_print_parser_result=1`` print detailed hardware
+  parser result of every received packet (debug only, hurts Rx performance).
+  e.g. ``fslmc:dpni.1,drv_rx_print_parser_result=1``
+
 * Use dev arg option  ``drv_error_queue=1`` to enable Packets in Error queue.
   DPAA2 hardware drops the error packet in hardware. This option enables the
   hardware to not drop the error packet and let the driver dump the error
drivers/net/dpaa2/dpaa2_ethdev.c +14 -17
index 6afd641709..e69dc5b9a2 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
- * Copyright 2016-2025 NXP
+ * Copyright 2016-2026 NXP
  */
 
 #include <time.h>
@@ -36,6 +36,7 @@
 #define DRIVER_NO_PREFETCH_MODE "drv_no_prefetch"
 #define DRIVER_TX_CONF "drv_tx_conf"
 #define DRIVER_RX_PARSE_ERR_DROP "drv_rx_parse_drop"
+#define DRIVER_RX_PRINT_PARSER_RESULT "drv_rx_print_parser_result"
 #define DRIVER_ERROR_QUEUE  "drv_err_queue"
 #define DRIVER_NO_TAILDROP  "drv_no_taildrop"
 #define DRIVER_NO_DATA_STASHING "drv_no_data_stashing"
@@ -68,16 +69,13 @@ static uint64_t dev_tx_offloads_sup =
 		RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 
 /* Tx offloads which cannot be disabled */
-static uint64_t dev_tx_offloads_nodis =
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
+static uint64_t dev_tx_offloads_nodis = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 /* enable timestamp in mbuf */
 bool dpaa2_enable_ts[RTE_MAX_ETHPORTS];
 uint64_t dpaa2_timestamp_rx_dynflag;
 int dpaa2_timestamp_dynfield_offset = -1;
 
-bool dpaa2_print_parser_result;
-
 /* Rx descriptor limit when DPNI loads PFDRs in PEB */
 #define MAX_NB_RX_DESC_IN_PEB	11264
 static int total_nb_rx_desc;
@@ -3450,10 +3448,10 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	dpni_dev = rte_malloc(NULL, sizeof(struct fsl_mc_io), 0);
+	dpni_dev = rte_zmalloc(NULL, sizeof(struct fsl_mc_io), 0);
 	if (!dpni_dev) {
 		DPAA2_PMD_ERR("Memory allocation failed for dpni device");
-		return -1;
+		return -ENOMEM;
 	}
 	dpni_dev->regs = dpaa2_get_mcp_ptr(MC_PORTAL_INDEX);
 	eth_dev->process_private = dpni_dev;
@@ -3502,9 +3500,8 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	hw_id = dpaa2_dev->object_id;
 	ret = dpni_open(dpni_dev, CMD_PRI_LOW, hw_id, &priv->token);
 	if (ret) {
-		DPAA2_PMD_ERR(
-			     "Failure in opening dpni@%d with err code %d",
-			     hw_id, ret);
+		DPAA2_PMD_ERR("Failure in opening dpni@%d with err code %d",
+			hw_id, ret);
 		rte_free(dpni_dev);
 		return ret;
 	}
@@ -3516,20 +3513,19 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	ret = dpni_reset(dpni_dev, CMD_PRI_LOW, priv->token);
 	if (ret) {
 		DPAA2_PMD_ERR("Failure cleaning dpni@%d with err code %d",
-			      hw_id, ret);
+			hw_id, ret);
 		goto init_err;
 	}
 
 	ret = dpni_get_attributes(dpni_dev, CMD_PRI_LOW, priv->token, &attr);
 	if (ret) {
-		DPAA2_PMD_ERR(
-			     "Failure in get dpni@%d attribute, err code %d",
-			     hw_id, ret);
+		DPAA2_PMD_ERR("Failure in get dpni@%d attribute, err code %d",
+			hw_id, ret);
 		goto init_err;
 	}
 
 	ret = dpni_get_api_version(dpni_dev, CMD_PRI_LOW, &priv->dpni_ver_major,
-				   &priv->dpni_ver_minor);
+			&priv->dpni_ver_minor);
 	if (ret) {
 		DPAA2_PMD_ERR("Failure in get dpni@%d API version, err code %d",
 			hw_id, ret);
@@ -3590,8 +3586,8 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 		DPAA2_PMD_INFO("Drop parse error packets in hw");
 	}
 
-	if (getenv("DPAA2_PRINT_RX_PARSER_RESULT"))
-		dpaa2_print_parser_result = 1;
+	if (dpaa2_get_devargs(dev->devargs, DRIVER_RX_PRINT_PARSER_RESULT))
+		priv->flags |= DPAA2_RX_PRINT_PSR_RESULT_FLAG;
 
 	/* Allocate memory for hardware structure for queues */
 	ret = dpaa2_alloc_rx_tx_queues(eth_dev);
@@ -3993,6 +3989,7 @@ RTE_PMD_REGISTER_PARAM_STRING(NET_DPAA2_PMD_DRIVER_NAME,
 		DRIVER_NO_PREFETCH_MODE "=<int>"
 		DRIVER_TX_CONF "=<int>"
 		DRIVER_RX_PARSE_ERR_DROP "=<int>"
+		DRIVER_RX_PRINT_PARSER_RESULT "=<int>"
 		DRIVER_ERROR_QUEUE "=<int>"
 		DRIVER_NO_TAILDROP "=<int>"
 		DRIVER_NO_DATA_STASHING "=<int>");
drivers/net/dpaa2/dpaa2_ethdev.h +111 -61

240 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_parse_dump.h +370 -337

744 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_parser_decode.h new file +750 -0

750 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_pmd_logs.h +17 -1
index 28c9bed1ae..c3e3c6fb2c 100644
@@ -1,10 +1,17 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2017 NXP
+ * Copyright 2017-2026 NXP
  */
 
 #ifndef _DPAA2_PMD_LOGS_H_
 #define _DPAA2_PMD_LOGS_H_
 
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <rte_common.h>
+#include <rte_log.h>
+
 extern int dpaa2_logtype_pmd;
 #define RTE_LOGTYPE_DPAA2_NET dpaa2_logtype_pmd
 
@@ -36,4 +43,13 @@ extern int dpaa2_logtype_pmd;
 #define DPAA2_PMD_DP_WARN(fmt, ...) \
 	DPAA2_PMD_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
 
+static inline __rte_format_printf(1, 2) void
+dpaa2_dump_print(const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	rte_vlog(RTE_LOG_NOTICE, RTE_LOGTYPE_USER1, fmt, ap);
+	va_end(ap);
+}
 #endif /* _DPAA2_PMD_LOGS_H_ */
drivers/net/dpaa2/dpaa2_rxtx.c +186 -186

633 lines not on this page · raw message

drivers/net/dpaa2/rte_pmd_dpaa2.h +12 -1
index 237c3cd6e7..83bee098bc 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2024 NXP
+ * Copyright 2018-2026 NXP
  */
 
 #ifndef _RTE_PMD_DPAA2_H
@@ -14,6 +14,17 @@
 #include <rte_compat.h>
 #include <rte_flow.h>
 
+/**
+ * LX series support only.
+ * if (m->ol_flags & RTE_MBUF_F_RX_FDIR) {
+ * tc = (m->hash.fdir.hi >> RTE_DPAA2_MBUF_F_RX_FDIR_TC_OFFSET);
+ * flow = m->hash.fdir.hi & RTE_DPAA2_MBUF_F_RX_FDIR_FLOW_MASK;
+ * }
+ */
+#define RTE_DPAA2_MBUF_F_RX_FDIR_TC_OFFSET 16
+#define RTE_DPAA2_MBUF_F_RX_FDIR_FLOW_MASK \
+	((UINT32_C(1) << RTE_DPAA2_MBUF_F_RX_FDIR_TC_OFFSET) - 1)
+
 /**
  * Create a flow rule to demultiplex ethernet traffic to separate network
  * interfaces.
Signature · 1 line
2.43.0
#206 lore raw

PATCH 2/14 drivers: net/dpaa2 centralize devargs definitions

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Add a common dpaax_devarg.h header providing the dpaax_devargs type, the dpaax_get_devargs() parse helper, and two X-macro operators:

DPAAX_DEVARG_TABLE_ENTRY(key, handle, flag) -> {key, handle, flag}, DPAAX_DEVARG_STRING_ENTRY(key, handle, flag) -> key "=<int> "

Convert the dpaa2 net driver to declare its device arguments once via a single DPAA2_DEVARGS(ENTRY) list. The same list now builds both the parse table (s_dpaa2_devargs) and the RTE_PMD_REGISTER_PARAM_STRING valid-args string, so every key is spelled exactly once. The per-arg string defines and the hand-written dpaa2_get_devargs()/ check_devargs_handler() lookups are replaced by a single dpaax_get_devargs() call that sets priv->flags.

---
 doc/guides/nics/dpaa2.rst           |   4 +
 drivers/common/dpaax/dpaax_devarg.h | 112 +++++++++++++++++
 drivers/net/dpaa2/dpaa2_ethdev.c    | 188 +++++++++-------------------
 3 files changed, 177 insertions(+), 127 deletions(-)
 create mode 100644 drivers/common/dpaax/dpaax_devarg.h
doc/guides/nics/dpaa2.rst +4 -0
index 60ca695f59..826eb4340c 100644
@@ -494,6 +494,10 @@ Refer to the document :doc:`build_and_test` for details.
   packets, so that user can check what is wrong with those packets.
   e.g. ``fslmc:dpni.1,drv_error_queue=1``
 
+* Use dev arg option ``drv_strict_order=1`` to enable strict ordering.
+  By default, loose ordering is set for ordered schedule type event.
+  e.g. ``fslmc:dpni.1,drv_strict_order=1``
+
 Enabling logs
 -------------
 
drivers/common/dpaax/dpaax_devarg.h new file +112 -0

112 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.c +61 -127

251 lines not on this page · raw message

Signature · 1 line
2.43.0
#207 lore raw

PATCH 3/14 crypto/dpaa2_sec: use table-driven devargs parsing

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Convert the dpaa2_sec devargs handling to the shared dpaax_devargs table so each argument key is declared once and drives both the parse table and the registered valid-args string.

Replace the custom check_devargs_handler()/dpaa2_sec_get_devargs() pair with the generic dpaax_get_devargs() helper, and attach per-arg callbacks (dpaa2_sec_devarg_dump_set, dpaa2_sec_devarg_order_set) for the value-carrying arguments.

Move the dump level out of the global dpaa2_sec_dp_dump variable into the per-device private data (priv->dump_level) so the dump setting is scoped per device instead of being process-global, and move the dpaa2_sec_dump_levels enum into dpaa2_sec_priv.h.

---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 146 ++++++++------------
 drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h   |  10 +-
 2 files changed, 68 insertions(+), 88 deletions(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +59 -87
index 3d980d096f..613273969d 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016-2025 NXP
+ *   Copyright 2016-2026 NXP
  *
  */
 
@@ -31,6 +31,7 @@
 #include <fsl_dpseci.h>
 #include <fsl_mc_sys.h>
 #include <rte_hexdump.h>
+#include <dpaax_devarg.h>
 
 #include "dpaa2_sec_priv.h"
 #include "dpaa2_sec_event.h"
@@ -55,18 +56,41 @@
 #define DPAA2_DEFAULT_NAT_T_PORT 4500
 #define NO_PREFETCH 0
 
-#define DRIVER_DUMP_MODE "drv_dump_mode"
-#define DRIVER_STRICT_ORDER "drv_strict_order"
+static void
+dpaa2_sec_devarg_order_set(void *vdev, const char *key, int val)
+{
+	struct rte_cryptodev *dev = vdev;
+	struct dpaa2_sec_dev_private *priv = dev->data->dev_private;
+
+	RTE_SET_USED(key);
+	priv->en_loose_ordered = !val;
+}
+
+static void
+dpaa2_sec_devarg_dump_set(void *vdev, const char *key, int _val)
+{
+	struct rte_cryptodev *dev = vdev;
+	struct dpaa2_sec_dev_private *priv = dev->data->dev_private;
+	enum dpaa2_sec_dump_levels val = (enum dpaa2_sec_dump_levels)_val;
+
+	RTE_SET_USED(key);
+	if (val > DPAA2_SEC_DP_FULL_DUMP) {
+		DPAA2_SEC_WARN("%s: val(%d) > full dump(%d), changing to full dump",
+			__func__, val, DPAA2_SEC_DP_FULL_DUMP);
+		val = DPAA2_SEC_DP_FULL_DUMP;
+	}
+	priv->dump_level = val;
+}
 
-/* DPAA2_SEC_DP_DUMP levels */
-enum dpaa2_sec_dump_levels {
-	DPAA2_SEC_DP_NO_DUMP,
-	DPAA2_SEC_DP_ERR_DUMP,
-	DPAA2_SEC_DP_FULL_DUMP
+#define DPAA2_DEVARGS(ENTRY) \
+	ENTRY("drv_dump_mode", dpaa2_sec_devarg_dump_set, 0) \
+	ENTRY("drv_strict_order", dpaa2_sec_devarg_order_set, 0)
+
+static const struct dpaax_devargs s_dpaa2_sec_devargs[] = {
+	DPAA2_DEVARGS(DPAAX_DEVARG_TABLE_ENTRY)
 };
 
 uint8_t cryptodev_driver_id;
-uint8_t dpaa2_sec_dp_dump = DPAA2_SEC_DP_ERR_DUMP;
 
 static int s_dpaa2_sec_cntx_pos = -1;
 
@@ -1701,10 +1725,9 @@ dpaa2_sec_fd_to_mbuf(const struct qbman_fd *fd,
 static void
 dpaa2_sec_dump(struct rte_crypto_op *op, FILE *f)
 {
-	int i;
 	dpaa2_sec_session *sess = NULL;
 	struct ctxt_priv *priv;
-	uint8_t bufsize;
+	uint8_t bufsize, i;
 	struct rte_crypto_sym_op *sym_op;
 
 	if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
@@ -1717,7 +1740,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op, FILE *f)
 	if (sess == NULL)
 		goto mbuf_dump;
 
-	priv = (struct ctxt_priv *)sess->ctxt;
+	priv = sess->ctxt;
 	fprintf(f, "\n****************************************\n"
 		"session params:\n\tContext type:\t%d\n\tDirection:\t%s\n"
 		"\tCipher alg:\t%d\n\tAuth alg:\t%d\n\tAead alg:\t%d\n"
@@ -1746,7 +1769,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op, FILE *f)
 		sess->pdcp.hfn_threshold);
 
 #endif
-	bufsize = (uint8_t)priv->flc_desc[0].flc.word1_sdl;
+	bufsize = priv->flc_desc[0].flc.word1_sdl;
 	fprintf(f, "Descriptor Dump:\n");
 	for (i = 0; i < bufsize; i++)
 		fprintf(f, "\tDESC[%d]:0x%x\n", i, priv->flc_desc[0].desc[i]);
@@ -1950,10 +1973,10 @@ dpaa2_sec_enqueue_burst_ordered(void *qp, struct rte_crypto_op **ops,
 
 static uint16_t
 dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops,
-			uint16_t nb_ops)
+	uint16_t nb_ops)
 {
 	/* Function is responsible to receive frames for a given device and VQ*/
-	struct dpaa2_sec_qp *dpaa2_qp = (struct dpaa2_sec_qp *)qp;
+	struct dpaa2_sec_qp *dpaa2_qp = qp;
 	struct qbman_result *dq_storage;
 	uint32_t fqid = dpaa2_qp->rx_vq.fqid;
 	int ret, num_rx = 0;
@@ -1961,12 +1984,12 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops,
 	struct qbman_swp *swp;
 	const struct qbman_fd *fd;
 	struct qbman_pull_desc pulldesc;
+	struct dpaa2_sec_dev_private *priv = dpaa2_qp->rx_vq.crypto_data->dev_private;
 
 	if (!DPAA2_PER_LCORE_DPIO) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
-			DPAA2_SEC_ERR(
-				"Failed to allocate IO portal, tid: %d",
+			DPAA2_SEC_ERR("Failed to allocate IO portal, tid: %d",
 				rte_gettid());
 			return 0;
 		}
@@ -1976,18 +1999,15 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops,
 
 	qbman_pull_desc_clear(&pulldesc);
 	qbman_pull_desc_set_numframes(&pulldesc,
-				      (nb_ops > dpaa2_dqrr_size) ?
-				      dpaa2_dqrr_size : nb_ops);
+		(nb_ops > dpaa2_dqrr_size) ? dpaa2_dqrr_size : nb_ops);
 	qbman_pull_desc_set_fq(&pulldesc, fqid);
 	qbman_pull_desc_set_storage(&pulldesc, dq_storage,
-				    (dma_addr_t)DPAA2_VADDR_TO_IOVA(dq_storage),
-				    1);
+		(dma_addr_t)DPAA2_VADDR_TO_IOVA(dq_storage), 1);
 
 	/*Issue a volatile dequeue command. */
 	while (1) {
 		if (qbman_swp_pull(swp, &pulldesc)) {
-			DPAA2_SEC_WARN(
-				"SEC VDQ command is not issued : QBMAN busy");
+			DPAA2_SEC_WARN("SEC VDQ command is not issued : QBMAN busy");
 			/* Portal was busy, try again */
 			continue;
 		}
@@ -2017,8 +2037,7 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops,
 			is_last = 1;
 			/* Check for valid frame. */
 			status = (uint8_t)qbman_result_DQ_flags(dq_storage);
-			if (unlikely(
-				(status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) {
+			if (unlikely(!(status & QBMAN_DQ_STAT_VALIDFRAME))) {
 				DPAA2_SEC_DP_DEBUG("No frame is delivered");
 				continue;
 			}
@@ -2029,10 +2048,9 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops,
 
 		if (unlikely(fd->simple.frc)) {
 			/* TODO Parse SEC errors */
-			if (dpaa2_sec_dp_dump > DPAA2_SEC_DP_NO_DUMP) {
-				DPAA2_SEC_DP_ERR("SEC returned Error - %x",
-						 fd->simple.frc);
-				if (dpaa2_sec_dp_dump > DPAA2_SEC_DP_ERR_DUMP)
+			if (priv->dump_level > DPAA2_SEC_DP_NO_DUMP) {
+				DPAA2_SEC_DP_ERR("SEC returned Error - %x", fd->simple.frc);
+				if (priv->dump_level > DPAA2_SEC_DP_ERR_DUMP)
 					dpaa2_sec_dump(ops[num_rx], stdout);
 			}
 
@@ -2049,7 +2067,7 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops,
 	dpaa2_qp->rx_vq.rx_pkts += num_rx;
 
 	DPAA2_SEC_DP_DEBUG("SEC RX pkts %d err pkts %" PRIu64, num_rx,
-				dpaa2_qp->rx_vq.err_pkts);
+		dpaa2_qp->rx_vq.err_pkts);
 	/*Return the total number of packets received to DPAA2 app*/
 	return num_rx;
 }
@@ -4332,53 +4350,6 @@ dpaa2_sec_uninit(const struct rte_cryptodev *dev)
 	return 0;
 }
 
-static int
-check_devargs_handler(const char *key, const char *value,
-		      void *opaque)
-{
-	struct rte_cryptodev *dev = (struct rte_cryptodev *)opaque;
-	struct dpaa2_sec_dev_private *priv = dev->data->dev_private;
-
-	if (!strcmp(key, "drv_strict_order")) {
-		priv->en_loose_ordered = false;
-	} else if (!strcmp(key, "drv_dump_mode")) {
-		dpaa2_sec_dp_dump = atoi(value);
-		if (dpaa2_sec_dp_dump > DPAA2_SEC_DP_FULL_DUMP) {
-			DPAA2_SEC_WARN("WARN: DPAA2_SEC_DP_DUMP_LEVEL is not "
-				      "supported, changing to FULL error"
-				      " prints");
-			dpaa2_sec_dp_dump = DPAA2_SEC_DP_FULL_DUMP;
-		}
-	} else
-		return -1;
-
-	return 0;
-}
-
-static void
-dpaa2_sec_get_devargs(struct rte_cryptodev *cryptodev, const char *key)
-{
-	struct rte_kvargs *kvlist;
-	struct rte_devargs *devargs;
-
-	devargs = cryptodev->device->devargs;
-	if (!devargs)
-		return;
-
-	kvlist = rte_kvargs_parse(devargs->args, NULL);
-	if (!kvlist)
-		return;
-
-	if (!rte_kvargs_count(kvlist, key)) {
-		rte_kvargs_free(kvlist);
-		return;
-	}
-
-	rte_kvargs_process(kvlist, key,
-			check_devargs_handler, (void *)cryptodev);
-	rte_kvargs_free(kvlist);
-}
-
 static int
 dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
 {
@@ -4412,12 +4383,15 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
 
 	internals = cryptodev->data->dev_private;
 
-	/*
-	 * For secondary processes, we don't initialise any further as primary
-	 * has already done this work. Only check we don't need a different
-	 * RX function
-	 */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+		internals->dump_level = DPAA2_SEC_DP_ERR_DUMP;
+		dpaax_get_devargs(s_dpaa2_sec_devargs, cryptodev, NULL);
+	} else {
+		/*
+		 * For secondary processes, we don't initialise any further as primary
+		 * has already done this work. Only check we don't need a different
+		 * RX function
+		 */
 		DPAA2_SEC_DEBUG("Device already init by primary process");
 		return 0;
 	}
@@ -4462,8 +4436,6 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
 	internals->token = token;
 	internals->en_loose_ordered = true;
 
-	dpaa2_sec_get_devargs(cryptodev, DRIVER_DUMP_MODE);
-	dpaa2_sec_get_devargs(cryptodev, DRIVER_STRICT_ORDER);
 	DPAA2_SEC_INFO("driver %s: created", cryptodev->data->name);
 	return 0;
 
@@ -4547,6 +4519,6 @@ RTE_PMD_REGISTER_DPAA2(CRYPTODEV_NAME_DPAA2_SEC_PMD, rte_dpaa2_sec_driver);
 RTE_PMD_REGISTER_CRYPTO_DRIVER(dpaa2_sec_crypto_drv,
 		rte_dpaa2_sec_driver.driver, cryptodev_driver_id);
 RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_DPAA2_SEC_PMD,
-		DRIVER_STRICT_ORDER "=<int>"
-		DRIVER_DUMP_MODE "=<int>");
+		DPAA2_DEVARGS(DPAAX_DEVARG_STRING_ENTRY)
+);
 RTE_LOG_REGISTER(dpaa2_logtype_sec, pmd.crypto.dpaa2, NOTICE);
drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h +9 -1
index 755c8e9cc3..f29817f456 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016,2020-2024 NXP
+ *   Copyright 2016,2020-2026 NXP
  *
  */
 
@@ -21,6 +21,13 @@ extern uint8_t cryptodev_driver_id;
 #define FLE_POOL_CACHE_SIZE	512
 #define FLE_SG_MEM_SIZE(num)	(FLE_POOL_BUF_SIZE + ((num) * 32))
 
+/* DPAA2_SEC_DP_DUMP levels */
+enum dpaa2_sec_dump_levels {
+	DPAA2_SEC_DP_NO_DUMP,
+	DPAA2_SEC_DP_ERR_DUMP,
+	DPAA2_SEC_DP_FULL_DUMP
+};
+
 #define MAX_QUEUES		64
 #define MAX_DESC_SIZE		64
 /** private data structure for each DPAA2_SEC device */
@@ -34,6 +41,7 @@ struct dpaa2_sec_dev_private {
 	/**< Max number of queue pairs supported by device */
 	uint8_t en_ordered;
 	uint8_t en_loose_ordered;
+	enum dpaa2_sec_dump_levels dump_level;
 };
 
 struct dpaa2_sec_qp {
Signature · 1 line
2.43.0
#208 lore raw

PATCH 4/14 dma/dpaa2: use table-driven devargs parsing

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Convert the dpaa2 qdma devargs handling to the shared dpaax_devargs table so each argument key is declared once and drives both the parse table and the registered valid-args string.

Remove the custom check_devargs_handler()/dpaa2_qdma_get_devargs() helpers and parse the arguments once at device init via dpaax_get_devargs(), storing the results in a single dpdmai_dev->flags bitfield (DPAA2_QDMA_FLE_PRE_POPULATE_FLAG, DPAA2_QDMA_DESC_DEBUG_FLAG, DPAA2_QDMA_SHORT_FD_FLAG).

This drops the per-virtual-queue fle_pre_populate, using_short_fd and flags fields, which only mirrored device-wide devargs, and makes the copy paths read the device flags directly.

---
 drivers/dma/dpaa2/dpaa2_qdma.c | 94 ++++++++++------------------------
 drivers/dma/dpaa2/dpaa2_qdma.h | 15 +++---
 2 files changed, 35 insertions(+), 74 deletions(-)
drivers/dma/dpaa2/dpaa2_qdma.c +27 -67
index 8d10edfd04..69cf780a1f 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2024 NXP
+ * Copyright 2018-2026 NXP
  */
 
 #include <rte_eal.h>
@@ -11,56 +11,25 @@
 #include <mc/fsl_dpdmai.h>
 
 #include <rte_pmd_dpaax_qdma.h>
+#include <dpaax_devarg.h>
 #include "dpaa2_hw_dpio.h"
 #include "dpaa2_qdma.h"
 #include "dpaa2_qdma_logs.h"
 
-#define DPAA2_QDMA_FLE_PRE_POPULATE "fle_pre_populate"
-#define DPAA2_QDMA_DESC_DEBUG "desc_debug"
-#define DPAA2_QDMA_USING_SHORT_FD "short_fd"
+#define DPAA2_DEVARGS(ENTRY) \
+	ENTRY("fle_pre_populate", NULL, DPAA2_QDMA_FLE_PRE_POPULATE_FLAG) \
+	ENTRY("desc_debug", NULL, DPAA2_QDMA_DESC_DEBUG_FLAG) \
+	ENTRY("short_fd", NULL, DPAA2_QDMA_SHORT_FD_FLAG)
+
+static const struct dpaax_devargs s_dpaa2_qdma_devargs[] = {
+	DPAA2_DEVARGS(DPAAX_DEVARG_TABLE_ENTRY)
+};
 
 static uint32_t dpaa2_coherent_no_alloc_cache;
 static uint32_t dpaa2_coherent_alloc_cache;
 
 static struct fsl_mc_io s_proc_mc_reg;
 
-static int
-check_devargs_handler(__rte_unused const char *key, const char *value,
-		      __rte_unused void *opaque)
-{
-	if (strcmp(value, "1"))
-		return -1;
-
-	return 0;
-}
-
-static int
-dpaa2_qdma_get_devargs(struct rte_devargs *devargs, const char *key)
-{
-	struct rte_kvargs *kvlist;
-
-	if (!devargs)
-		return 0;
-
-	kvlist = rte_kvargs_parse(devargs->args, NULL);
-	if (!kvlist)
-		return 0;
-
-	if (!rte_kvargs_count(kvlist, key)) {
-		rte_kvargs_free(kvlist);
-		return 0;
-	}
-
-	if (rte_kvargs_process(kvlist, key,
-			       check_devargs_handler, NULL) < 0) {
-		rte_kvargs_free(kvlist);
-		return 0;
-	}
-	rte_kvargs_free(kvlist);
-
-	return 1;
-}
-
 static inline int
 qdma_cntx_idx_ring_eq(struct qdma_cntx_idx_ring *ring,
 	const uint16_t *elem, uint16_t nb,
@@ -670,7 +639,7 @@ dpaa2_qdma_copy_sg(void *dev_private,
 	DPAA2_SET_FD_COMPOUND_FMT(fd);
 	DPAA2_SET_FD_FLC(fd, (uint64_t)cntx_sg);
 
-	if (qdma_vq->fle_pre_populate) {
+	if (dpdmai_dev->flags & DPAA2_QDMA_FLE_PRE_POPULATE_FLAG) {
 		if (unlikely(!fle[DPAA2_QDMA_SRC_FLE].length)) {
 			fle_sdd_sg_pre_populate(cntx_sg, qdma_vq);
 			if (!qdma_dev->is_silent && cntx_sg && idx_addr) {
@@ -698,7 +667,7 @@ dpaa2_qdma_copy_sg(void *dev_private,
 			QBMAN_FLE_WORD4_FMT_SGE);
 	}
 
-	if (unlikely(qdma_vq->flags & DPAA2_QDMA_DESC_DEBUG_FLAG))
+	if (unlikely(dpdmai_dev->flags & DPAA2_QDMA_DESC_DEBUG_FLAG))
 		dpaa2_qdma_long_fmt_dump(cntx_sg->fle_sdd.fle);
 
 	dpaa2_qdma_fd_save_att(fd, 0, DPAA2_QDMA_FD_SG);
@@ -844,7 +813,7 @@ dpaa2_qdma_short_copy(struct qdma_virt_queue *qdma_vq,
 static int
 dpaa2_qdma_long_copy(struct qdma_virt_queue *qdma_vq,
 	rte_iova_t src, rte_iova_t dst, uint32_t length,
-	int is_silent, uint64_t flags)
+	int is_silent, uint64_t flags, uint32_t dev_flags)
 {
 	int ret = 0, expected;
 	struct qbman_fd *fd = &qdma_vq->fd[qdma_vq->fd_idx];
@@ -872,7 +841,7 @@ dpaa2_qdma_long_copy(struct qdma_virt_queue *qdma_vq,
 	DPAA2_SET_FD_COMPOUND_FMT(fd);
 	DPAA2_SET_FD_FLC(fd, (uint64_t)fle);
 
-	if (qdma_vq->fle_pre_populate) {
+	if (dev_flags & DPAA2_QDMA_FLE_PRE_POPULATE_FLAG) {
 		if (unlikely(!fle[DPAA2_QDMA_SRC_FLE].length)) {
 			fle_sdd_pre_populate(fle_sdd,
 				&qdma_vq->rbp,
@@ -888,7 +857,7 @@ dpaa2_qdma_long_copy(struct qdma_virt_queue *qdma_vq,
 			QBMAN_FLE_WORD4_FMT_SBF);
 	}
 
-	if (unlikely(qdma_vq->flags & DPAA2_QDMA_DESC_DEBUG_FLAG))
+	if (unlikely(dev_flags & DPAA2_QDMA_DESC_DEBUG_FLAG))
 		dpaa2_qdma_long_fmt_dump(fle);
 
 	dpaa2_qdma_fd_save_att(fd, DPAA2_QDMA_IDX_FROM_FLAG(flags),
@@ -921,12 +890,14 @@ dpaa2_qdma_copy(void *dev_private, uint16_t vchan,
 	struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev;
 	struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan];
 
-	if (qdma_vq->using_short_fd)
+	if (dpdmai_dev->flags & DPAA2_QDMA_SHORT_FD_FLAG) {
 		return dpaa2_qdma_short_copy(qdma_vq, src, dst,
 				length, qdma_dev->is_silent, flags);
-	else
+	} else {
 		return dpaa2_qdma_long_copy(qdma_vq, src, dst,
-				length, qdma_dev->is_silent, flags);
+				length, qdma_dev->is_silent, flags,
+				dpdmai_dev->flags);
+	}
 }
 
 static inline int
@@ -1379,21 +1350,6 @@ dpaa2_qdma_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan,
 	if (ret)
 		return ret;
 
-	if (dpaa2_qdma_get_devargs(dev->device->devargs, DPAA2_QDMA_FLE_PRE_POPULATE))
-		qdma_dev->vqs[vchan].fle_pre_populate = 1;
-	else
-		qdma_dev->vqs[vchan].fle_pre_populate = 0;
-
-	if (dpaa2_qdma_get_devargs(dev->device->devargs, DPAA2_QDMA_DESC_DEBUG))
-		qdma_dev->vqs[vchan].flags |= DPAA2_QDMA_DESC_DEBUG_FLAG;
-	else
-		qdma_dev->vqs[vchan].flags &= (~DPAA2_QDMA_DESC_DEBUG_FLAG);
-
-	if (dpaa2_qdma_get_devargs(dev->device->devargs, DPAA2_QDMA_USING_SHORT_FD))
-		qdma_dev->vqs[vchan].using_short_fd = 1;
-	else
-		qdma_dev->vqs[vchan].using_short_fd = 0;
-
 	snprintf(pool_name, sizeof(pool_name),
 		"qdma_fle_pool_dev%d_qid%d", dpdmai_dev->dpdmai_id, vchan);
 	pool_size = sizeof(struct qdma_cntx_sg);
@@ -1656,6 +1612,11 @@ dpaa2_dpdmai_dev_init(struct rte_dma_dev *dev, uint32_t dpdmai_id)
 
 	DPAA2_QDMA_FUNC_TRACE();
 
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+		dpdmai_dev->flags = 0;
+		dpaax_get_devargs(s_dpaa2_qdma_devargs, dev, &dpdmai_dev->flags);
+	}
+
 	if (!dpaa2_coherent_no_alloc_cache) {
 		if (dpaa2_svr_family == SVR_LX2160A) {
 			dpaa2_coherent_no_alloc_cache =
@@ -1801,7 +1762,6 @@ static struct rte_dpaa2_driver rte_dpaa2_qdma_pmd = {
 
 RTE_PMD_REGISTER_DPAA2(dpaa2_qdma, rte_dpaa2_qdma_pmd);
 RTE_PMD_REGISTER_PARAM_STRING(dpaa2_qdma,
-	DPAA2_QDMA_FLE_PRE_POPULATE "=<int>"
-	DPAA2_QDMA_DESC_DEBUG"=<int>"
-	DPAA2_QDMA_USING_SHORT_FD"=<int>");
+	DPAA2_DEVARGS(DPAAX_DEVARG_STRING_ENTRY)
+);
 RTE_LOG_REGISTER_DEFAULT(dpaa2_qdma_logtype, INFO);
drivers/dma/dpaa2/dpaa2_qdma.h +8 -7
index e2d2eb4fa8..4a5d1056f0 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2024 NXP
+ * Copyright 2018-2026 NXP
  */
 
 #ifndef _DPAA2_QDMA_H_
@@ -233,6 +233,12 @@ struct __rte_packed_begin qdma_cntx_sg {
 #define DPAA2_QDMA_IDX_FROM_FLAG(flag) \
 	((flag) >> RTE_DPAAX_QDMA_COPY_IDX_OFFSET)
 
+enum dpaa2_dpdmai_dev_flags {
+	DPAA2_QDMA_FLE_PRE_POPULATE_FLAG = RTE_BIT32(0),
+	DPAA2_QDMA_DESC_DEBUG_FLAG = RTE_BIT32(1),
+	DPAA2_QDMA_SHORT_FD_FLAG = RTE_BIT32(2)
+};
+
 /** Represents a DPDMAI device */
 struct dpaa2_dpdmai_dev {
 	/** Pointer to Next device instance */
@@ -247,6 +253,7 @@ struct dpaa2_dpdmai_dev {
 	struct dpaa2_queue rx_queue[DPAA2_DPDMAI_MAX_QUEUES];
 	/** TX queues */
 	struct dpaa2_queue tx_queue[DPAA2_DPDMAI_MAX_QUEUES];
+	uint32_t flags;
 	struct qdma_device *qdma_dev;
 };
 
@@ -261,8 +268,6 @@ struct qdma_cntx_idx_ring {
 	uint16_t nb_in_ring;
 };
 
-#define DPAA2_QDMA_DESC_DEBUG_FLAG (1 << 0)
-
 /** Represents a QDMA virtual queue */
 struct qdma_virt_queue {
 	/** Associated hw queue */
@@ -273,8 +278,6 @@ struct qdma_virt_queue {
 	void **fle_elem;
 	/** Route by port */
 	struct dpaa2_qdma_rbp rbp;
-	/** States if this vq is in use or not */
-	uint8_t fle_pre_populate;
 	/** Number of descriptor for the virtual DMA channel */
 	uint16_t nb_desc;
 	/* Total number of enqueues on this VQ */
@@ -284,7 +287,6 @@ struct qdma_virt_queue {
 	uint64_t copy_num;
 
 	uint16_t vq_id;
-	uint32_t flags;
 	struct qbman_fd fd[DPAA2_QDMA_MAX_DESC];
 	uint16_t fd_idx;
 	struct qdma_cntx_idx_ring *ring_cntx_idx;
@@ -295,7 +297,6 @@ struct qdma_virt_queue {
 	uint16_t silent_idx;
 
 	int num_valid_jobs;
-	int using_short_fd;
 
 	struct rte_dma_stats stats;
 };
Signature · 1 line
2.43.0
#209 lore raw

PATCH 5/14 net/dpaa2: unify debug dump via log based helpers

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The dpaa2 PMD printed debug output through several unrelated paths: the flow dump used a raw printf, and the Rx error queue dump used rte_hexdump() straight to stderr with sprintf-built titles. None of these went through the DPDK logging framework, so they could not be filtered and bypassed any configured log stream.

Route all debug dumps through the dpaa2 dump helpers instead. Point DPAA2_FLOW_DUMP at dpaa2_dump_print(), and add a dpaa2_dump_hex_print() helper that emits a buffer as hex using the same path. Convert the Rx error packet dump to use these helpers, rename dump_err_pkts() to dpaa2_dev_rx_err_pkts_dump() for consistency with the other datapath helpers, use rte_pktmbuf_mtod() for the segment payload, and simplify the surrounding code.

---
 drivers/net/dpaa2/dpaa2_flow.c     |  4 +--
 drivers/net/dpaa2/dpaa2_pmd_logs.h | 22 +++++++++++++
 drivers/net/dpaa2/dpaa2_rxtx.c     | 51 +++++++++++++-----------------
 3 files changed, 46 insertions(+), 31 deletions(-)
drivers/net/dpaa2/dpaa2_flow.c +2 -2
index 979ab4cae0..d9ca7211c7 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2022 NXP
+ * Copyright 2018-2026 NXP
  */
 
 #include <sys/queue.h>
@@ -196,7 +196,7 @@ static const struct rte_flow_item_pppoe dpaa2_flow_item_pppoe_mask = {
 #endif
 
 
-#define DPAA2_FLOW_DUMP printf
+#define DPAA2_FLOW_DUMP dpaa2_dump_print
 
 static inline void
 dpaa2_prot_field_string(uint32_t prot, uint32_t field,
drivers/net/dpaa2/dpaa2_pmd_logs.h +22 -0
index c3e3c6fb2c..75f232f3c6 100644
@@ -52,4 +52,26 @@ dpaa2_dump_print(const char *fmt, ...)
 	rte_vlog(RTE_LOG_NOTICE, RTE_LOGTYPE_USER1, fmt, ap);
 	va_end(ap);
 }
+
+#define DPAA2_DUMP_BYTES_PER_LINE 16
+static inline void
+dpaa2_dump_hex_print(const void *data, uint32_t len)
+{
+	const uint8_t *buf = data;
+	char line[DPAA2_DUMP_BYTES_PER_LINE * 3 + 1];
+	uint32_t i, j;
+	int pos;
+
+	for (i = 0; i < len; i += DPAA2_DUMP_BYTES_PER_LINE) {
+		pos = 0;
+
+		for (j = 0; j < DPAA2_DUMP_BYTES_PER_LINE && (i + j) < len; j++)
+			pos += snprintf(line + pos, sizeof(line) - pos, "%02x ", buf[i + j]);
+
+		if (pos)
+			line[pos - 1] = '\0';
+
+		dpaa2_dump_print("%s\n", line);
+	}
+}
 #endif /* _DPAA2_PMD_LOGS_H_ */
drivers/net/dpaa2/dpaa2_rxtx.c +22 -29

99 lines not on this page · raw message

Signature · 1 line
2.43.0
#210 lore raw

PATCH 6/14 net/dpaa2: export parser protocol offsets via mbuf dynfield

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Add a new device argument, drv_parse_protocol_offset, to export hardware parser protocol offsets through an mbuf dynamic field.

When enabled, the driver registers a dynamic field named RTE_PMD_DPAA2_RX_POS_DYNFIELD_NAME and stores the parser-reported L3, L4 and L5 protocol offsets in each received mbuf. Applications can retrieve the information by looking up the dynamic field and accessing the associated structure directly.

The feature is disabled by default and introduces no fast-path overhead unless explicitly enabled through the device argument.

Example:

fslmc:dpni.1,drv_parse_protocol_offset=1

---
 doc/guides/nics/dpaa2.rst         |  5 +++
 drivers/net/dpaa2/dpaa2_ethdev.c  | 30 +++++++++++++-
 drivers/net/dpaa2/dpaa2_ethdev.h  |  5 +++
 drivers/net/dpaa2/dpaa2_rxtx.c    | 67 +++++++++++++++++++++++++++++++
 drivers/net/dpaa2/rte_pmd_dpaa2.h | 23 +++++++++++
 5 files changed, 129 insertions(+), 1 deletion(-)
doc/guides/nics/dpaa2.rst +5 -0
index 826eb4340c..745c556c21 100644
@@ -498,6 +498,11 @@ Refer to the document :doc:`build_and_test` for details.
   By default, loose ordering is set for ordered schedule type event.
   e.g. ``fslmc:dpni.1,drv_strict_order=1``
 
+* Use dev arg option ``drv_parse_protocol_offset=1`` to populate an mbuf
+  dynamic field with hardware parser protocol offsets (L3/L4/L5). The
+  offsets can be retrieved through ``rte_mbuf_dynfield_lookup()``.
+  e.g. ``fslmc:dpni.1,drv_parse_protocol_offset=1``
+
 Enabling logs
 -------------
 
drivers/net/dpaa2/dpaa2_ethdev.c +29 -1
index fb3757aaeb..f551b9731e 100644
@@ -33,6 +33,33 @@
 #include <fsl_qbman_debug.h>
 #include <dpaax_devarg.h>
 
+static const struct rte_mbuf_dynfield s_dpaa2_rx_protocol_pos_dyn = {
+	.name = RTE_PMD_DPAA2_RX_POS_DYNFIELD_NAME,
+	.size = sizeof(struct dpaa2_dyn_rx_protocol_pos),
+	.align = __alignof__(struct dpaa2_dyn_rx_protocol_pos),
+};
+
+static void
+dpaa2_dev_args_parser_offset_en(void *vdev, const char *key, int val)
+{
+	struct rte_eth_dev *dev = vdev;
+	struct dpaa2_dev_priv *priv = dev->data->dev_private;
+	int ret;
+
+	RTE_SET_USED(key);
+
+	if (!val)
+		return;
+
+	ret = rte_mbuf_dynfield_register(&s_dpaa2_rx_protocol_pos_dyn);
+	if (ret < 0) {
+		DPAA2_PMD_ERR("Failed(%d) to register for protocol pos", ret);
+		return;
+	}
+	DPAA2_PMD_INFO("Register mbuf offset(%d) for protocol pos", ret);
+	priv->psr_dynfield_offset = ret | DPAA2_PSR_DYNFIELD_OFFSET_EN;
+}
+
 static void
 dpaa2_dev_args_set_strict_order(void *vdev, const char *key, int val)
 {
@@ -60,7 +87,8 @@ dpaa2_dev_args_set_strict_order(void *vdev, const char *key, int val)
 	ENTRY("drv_error_queue", NULL, DPAA2_RX_ERROR_QUEUE_FLAG) \
 	ENTRY("drv_no_taildrop", NULL, DPAA2_RX_TAILDROP_OFF) \
 	ENTRY("drv_no_data_stashing", NULL, DPAA2_RX_DATA_STASHING_OFF_FLAG) \
-	ENTRY("drv_strict_order", dpaa2_dev_args_set_strict_order, 0)
+	ENTRY("drv_strict_order", dpaa2_dev_args_set_strict_order, 0) \
+	ENTRY("drv_parse_protocol_offset", dpaa2_dev_args_parser_offset_en, 0)
 
 #define CHECK_INTERVAL         100  /* 100ms */
 #define MAX_REPEAT_TIME        90   /* 9s (90 * 100ms) in total */
drivers/net/dpaa2/dpaa2_ethdev.h +5 -0
index 0c2a1121ed..b01e08b7b1 100644
@@ -58,6 +58,10 @@
 
 #define CONG_RETRY_COUNT 18000
 
+#define DPAA2_PSR_DYNFIELD_OFFSET_EN RTE_BIT32(31)
+#define DPAA2_PSR_DYNFIELD_OFFSET_MASK \
+	(DPAA2_PSR_DYNFIELD_OFFSET_EN - 1)
+
 /* RX queue tail drop threshold
  * currently considering 64 KB packets
  */
@@ -436,6 +440,7 @@ struct dpaa2_dev_priv {
 	void *tx_conf_vq[MAX_TX_QUEUES * DPAA2_MAX_CHANNELS];
 	void *rx_err_vq;
 	uint32_t flags; /*dpaa2 config flags */
+	uint32_t psr_dynfield_offset;
 	uint8_t max_mac_filters;
 	uint8_t max_vlan_filters;
 	uint8_t num_rx_tc;
drivers/net/dpaa2/dpaa2_rxtx.c +67 -0

151 lines not on this page · raw message

drivers/net/dpaa2/rte_pmd_dpaa2.h +23 -0
index 83bee098bc..cef2e84143 100644
@@ -145,6 +145,29 @@ __rte_experimental
 const char *
 rte_pmd_dpaa2_ep_name(uint32_t eth_id);
 
+#define RTE_PMD_DPAA2_RX_POS_DYNFIELD_NAME "rte_pmd_dpaa2_rx_pos"
+
+struct dpaa2_dyn_rx_protocol_pos {
+	uint8_t l3_offset;
+	uint8_t l4_offset;
+	uint8_t l5_offset;
+	uint8_t rsv;
+};
+/**
+ *	static int offset = -1;
+ *	struct dpaa2_dyn_rx_protocol_pos *pos;
+ *
+ *	if (offset < 0) {
+ *		offset = rte_mbuf_dynfield_lookup(RTE_PMD_DPAA2_RX_POS_DYNFIELD_NAME,
+ *			NULL);
+ *		if (offset < 0)
+ *			return NULL;
+ *	}
+ *
+ *	pos = RTE_MBUF_DYNFIELD(m, offset, struct dpaa2_dyn_rx_protocol_pos);
+ *	return pos;
+ */
+
 #if defined(RTE_LIBRTE_IEEE1588)
 __rte_experimental
 int
Signature · 1 line
2.43.0
#211 lore raw

PATCH 7/14 drivers: net/dpaa2 rework Tx queue mapping

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Replace the legacy Tx queue mapping derived directly from the queue index with an explicit TC/flow based mapping.

Instead of computing the traffic class from the queue number and always using flow 0, each Tx queue now carries a preconfigured tc_index and flow_id which are used when programming the corresponding DPNI queue.

Update channel selection to distribute Tx queues across the available channels based on the queue index.

As a result:
- traffic class assignment is driven by tc_index;
- flow assignment is driven by flow_id;
- channel assignment is derived from the Tx queue index.

This provides an explicit mapping between software Tx queues and hardware TC/flow resources while distributing queues across available channels.

---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h |   2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c        | 117 ++++++++++++++----------
 drivers/net/dpaa2/dpaa2_ethdev.h        |   5 +-
 3 files changed, 75 insertions(+), 49 deletions(-)
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +1 -1
index 556e1b01c0..52e6aa0bab 100644
@@ -82,7 +82,7 @@
 #define DPAA2_PACKET_LAYOUT_ALIGN	64 /*changing from 256 */
 
 #define DPAA2_DPCI_MAX_QUEUES 2
-#define DPAA2_INVALID_FLOW_ID 0xffff
+#define DPAA2_INVALID_FQ_ID ((uint32_t)(-1))
 #define DPAA2_INVALID_CGID 0xff
 
 #define SEC_FLC_DHR_OUTBOUND	(-114)
drivers/net/dpaa2/dpaa2_ethdev.c +71 -46

229 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.h +3 -2
index b01e08b7b1..6f4fd01e2f 100644
@@ -30,7 +30,7 @@
 
 #define MAX_TCS			DPNI_MAX_TC
 #define MAX_RX_QUEUES		128
-#define MAX_TX_QUEUES		16
+#define MAX_TX_QUEUES		128
 #define MAX_DPNI		8
 #define DPAA2_MAX_CHANNELS	16
 
@@ -431,13 +431,14 @@ struct dpaa2_dev_priv {
 	int32_t hw_id;
 	int32_t qdid;
 	uint16_t token;
+	uint16_t tx_channels[DPAA2_MAX_CHANNELS];
 	uint8_t nb_tx_queues;
 	uint8_t nb_rx_queues;
 	uint32_t options;
 	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 * DPAA2_MAX_CHANNELS];
+	void *tx_conf_vq[MAX_TX_QUEUES];
 	void *rx_err_vq;
 	uint32_t flags; /*dpaa2 config flags */
 	uint32_t psr_dynfield_offset;
Signature · 1 line
2.43.0
#212 lore raw

PATCH 8/14 drivers: bus/fslmc centralize device handling

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Move device enumeration, initialization and cleanup sequencing from the VFIO implementation into the FSLMC bus layer.

Introduce a shared bus information structure to hold MC revision and platform information and associate it with each discovered device. Retrieve MC and SoC information during MCP processing and make the resulting bus data available to bus clients.

As part of this restructuring:
- add a common bus information object and device reference;
- move group device processing and cleanup orchestration into the bus layer;
- keep VFIO code focused on VFIO resource management and device access;
- centralize MC version and SoC information handling;
- move platform-specific topology information from DPIO code to the VFIO layer.

This prepares the bus infrastructure for sharing platform and management-controller information across FSLMC devices while separating bus management from VFIO implementation details.

---
 drivers/bus/fslmc/bus_fslmc_driver.h     |  10 +-
 drivers/bus/fslmc/fslmc_bus.c            | 219 +++++++++-
 drivers/bus/fslmc/fslmc_vfio.c           | 526 ++++++++++-------------
 drivers/bus/fslmc/fslmc_vfio.h           |  71 ++-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c |  79 +---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h |   9 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c |   3 +-
 drivers/bus/fslmc/private.h              |  15 +-
 drivers/net/dpaa2/dpaa2_ethdev.c         |  18 +-
 drivers/net/dpaa2/dpaa2_ethdev.h         |   1 +
 drivers/net/dpaa2/dpaa2_rxtx.c           |   7 +-
 11 files changed, 516 insertions(+), 442 deletions(-)
drivers/bus/fslmc/bus_fslmc_driver.h +9 -1
index 44f81cf662..26292e54bb 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016,2021-2023 NXP
+ *   Copyright 2016,2021-2026 NXP
  *
  */
 
@@ -89,6 +89,13 @@ enum rte_dpaa2_dev_type {
 	DPAA2_DEVTYPE_MAX,
 };
 
+struct rte_fslmc_bus_info {
+	int sp_protocol;
+	uint64_t mc_rev;
+	uint32_t svr;
+	uint32_t pvr;
+};
+
 /**
  * A structure describing a DPAA2 device.
  */
@@ -102,6 +109,7 @@ struct rte_dpaa2_device {
 	char ep_name[RTE_DEV_NAME_MAX_LEN];
 	struct rte_intr_handle *intr_handle; /**< Interrupt handle */
 	char name[FSLMC_OBJECT_MAX_LEN];    /**< DPAA2 Object name*/
+	const struct rte_fslmc_bus_info *bus_info;
 };
 
 typedef int (*rte_dpaa2_obj_create_t)(int vdev_fd,
drivers/bus/fslmc/fslmc_bus.c +215 -4

265 lines not on this page · raw message

drivers/bus/fslmc/fslmc_vfio.c +228 -298

693 lines not on this page · raw message

drivers/bus/fslmc/fslmc_vfio.h +30 -41

91 lines not on this page · raw message

drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +5 -74

119 lines not on this page · raw message

drivers/bus/fslmc/portal/dpaa2_hw_dpio.h +1 -8
index 7e2271cc35..0838254437 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016-2023 NXP
+ *   Copyright 2016-2023, 2026 NXP
  *
  */
 
@@ -35,13 +35,6 @@ RTE_DECLARE_PER_LCORE(struct dpaa2_io_portal_t, _dpaa2_io);
 #define DPAA2_PER_LCORE_DQRR_MBUF(i) \
 	RTE_PER_LCORE(_dpaa2_io).dpio_dev->dpaa2_held_bufs.mbuf[i]
 
-/* Variable to store DPAA2 DQRR size */
-extern uint8_t dpaa2_dqrr_size;
-/* Variable to store DPAA2 EQCR size */
-extern uint8_t dpaa2_eqcr_size;
-
-extern struct dpaa2_io_portal_t dpaa2_io_portal[RTE_MAX_LCORE];
-
 /* Affine a DPIO portal to current processing thread */
 __rte_internal
 int dpaa2_affine_qbman_swp(void);
drivers/bus/fslmc/portal/dpaa2_hw_dprc.c +2 -1
index 02b69d404d..2234da0975 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2021 NXP
+ *   Copyright 2021, 2026 NXP
  *
  */
 
@@ -17,6 +17,7 @@
 #include <mc/fsl_dprc.h>
 #include "portal/dpaa2_hw_pvt.h"
 
+extern struct rte_bus rte_fslmc_bus;
 TAILQ_HEAD(dprc_dev_list, dpaa2_dprc_dev);
 static struct dprc_dev_list dprc_dev_list
 	= TAILQ_HEAD_INITIALIZER(dprc_dev_list); /*!< DPRC device list */
drivers/bus/fslmc/private.h +13 -2
index 20a454c3fc..3586092529 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- *   Copyright 2016,2021 NXP
+ *   Copyright 2016, 2021, 2026 NXP
  */
 
 #ifndef BUS_FSLMC_PRIVATE_H
@@ -9,6 +9,17 @@
 
 #include <bus_fslmc_driver.h>
 
-extern struct rte_bus rte_fslmc_bus;
+int fslmc_vfio_process_mcp(struct rte_dpaa2_device *dev,
+	struct rte_fslmc_bus_info *bus_info);
+int fslmc_vfio_process_iodevices(struct rte_dpaa2_device *dev);
+
+void fslmc_vfio_close_iodevices(struct rte_dpaa2_device *dev);
+
+int fslmc_vfio_setup_group(void);
+void fslmc_vfio_clear_group(void);
+
+int fslmc_vfio_get_container_group(const char *group_name, int *gropuid);
+int fslmc_vfio_dmamap(void);
+
 
 #endif /* BUS_FSLMC_PRIVATE_H */
drivers/net/dpaa2/dpaa2_ethdev.c +8 -10
index 6f475baa79..81118d02f8 100644
@@ -382,24 +382,21 @@ dpaa2_fw_version_get(struct rte_eth_dev *dev,
 	char *fw_version, size_t fw_size)
 {
 	int ret;
+	uint32_t major, minor, rev;
+	struct dpaa2_dev_priv *priv = dev->data->dev_private;
 	struct fsl_mc_io *dpni = dev->process_private;
 	struct mc_soc_version mc_plat_info = {0};
-	struct mc_version mc_ver_info = {0};
 
 	PMD_INIT_FUNC_TRACE();
 
+	major = RTE_FSL_MC_REV_MAJOR(priv->mc_rev);
+	minor = RTE_FSL_MC_REV_MINOR(priv->mc_rev);
+	rev = RTE_FSL_MC_REV_REVISION(priv->mc_rev);
 	if (mc_get_soc_version(dpni, CMD_PRI_LOW, &mc_plat_info))
 		DPAA2_PMD_WARN("\tmc_get_soc_version failed");
 
-	if (mc_get_version(dpni, CMD_PRI_LOW, &mc_ver_info))
-		DPAA2_PMD_WARN("\tmc_get_version failed");
-
-	ret = snprintf(fw_version, fw_size,
-		       "%x-%d.%d.%d",
-		       mc_plat_info.svr,
-		       mc_ver_info.major,
-		       mc_ver_info.minor,
-		       mc_ver_info.revision);
+	ret = snprintf(fw_version, fw_size, "%x-%d.%d.%d",
+		mc_plat_info.svr, major, minor, rev);
 	if (ret < 0)
 		return -EINVAL;
 
@@ -3536,6 +3533,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 		goto init_err;
 	}
 
+	priv->mc_rev = dpaa2_dev->bus_info->mc_rev;
 	priv->num_rx_tc = attr.num_rx_tcs;
 	priv->num_tx_tc = attr.num_tx_tcs;
 	priv->qos_entries = attr.qos_entries;
drivers/net/dpaa2/dpaa2_ethdev.h +1 -0
index 6f4fd01e2f..5bc34a6d92 100644
@@ -498,6 +498,7 @@ struct dpaa2_dev_priv {
 	uint32_t *cnt_idx_dma_mem;
 	uint64_t *cnt_values_dma_mem;
 	uint64_t cnt_idx_iova, cnt_values_iova;
+	uint64_t mc_rev;
 
 	struct dpaa2_dev_flow *curr;
 	LIST_HEAD(, dpaa2_dev_flow) flows;
drivers/net/dpaa2/dpaa2_rxtx.c +4 -3
index e52b05ab96..48016c6af5 100644
@@ -1137,7 +1137,8 @@ dpaa2_dev_rx_common(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts,
 	struct dpaa2_queue *dpaa2_q = queue;
 	struct qbman_result *dq_storage;
 	uint32_t fqid = dpaa2_q->fqid;
-	int ret, num_rx = 0, next_pull = nb_pkts, num_pulled;
+	uint16_t num_rx = 0, next_pull = nb_pkts, num_pulled;
+	int ret;
 	uint8_t pending, status;
 	struct qbman_swp *swp;
 	const struct qbman_fd *fd;
@@ -1281,8 +1282,8 @@ uint16_t dpaa2_dev_tx_conf(void *queue)
 	/* Function receive frames for a given device and VQ */
 	struct dpaa2_queue *dpaa2_q = (struct dpaa2_queue *)queue;
 	struct qbman_result *dq_storage;
-	uint32_t fqid = dpaa2_q->fqid;
-	int ret, num_tx_conf = 0, num_pulled;
+	uint32_t fqid = dpaa2_q->fqid, num_tx_conf = 0, num_pulled;
+	int ret;
 	uint8_t pending, status;
 	struct qbman_swp *swp;
 	const struct qbman_fd *fd;
Signature · 1 line
2.43.0
#213 lore raw

PATCH 9/14 drivers: net/dpaa2: move DPNI endpoint lookup to PMD

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The fslmc bus scan was doing a DPNI-specific endpoint lookup for every DPAA2 device inside rte_dpaa2_create_dprc_device(): for each DPAA2_ETH object it issued dprc_get_connection(dpni.<id>) and stored the result (ep_dev_type / ep_object_id / ep_name) directly on the generic rte_dpaa2_device. This had several problems:

- It made the generic bus device carry DPNI-specific knowledge. Non-eth DPAA2 object types (DPCI, DPIO, DPSECI, DPDMAI, ...) that may also have endpoints never populated these fields, so the "endpoint" of any non-DPNI device was silently wrong.
- DPDMUX and DPSW endpoints are per-interface (identified by endpoint.if_id in addition to the object id), but the bus code only ever formatted "<type>.<id>" and dropped if_id, producing an ambiguous ep_name for those connection types.
- A dprc_get_connection() failure on any single DPNI aborted the whole DPRC scan and freed the dprc node, even if the failing DPNI was never going to be used by this process.
- It coupled the bus scan to the MC command set exposed by fsl_dprc.h, and forced every DPAA2 user of the bus to carry those symbols even if it did not care about endpoints.

Move the DPNI endpoint lookup where it belongs: into the DPAA2 net PMD, which is the only consumer today. The bus layer now just assigns each device to its parent DPRC container during the scan and lets each object driver decide whether (and how) to resolve its endpoint.

---
 drivers/bus/fslmc/bus_fslmc_driver.h     |  3 --
 drivers/bus/fslmc/portal/dpaa2_hw_dprc.c | 49 +++-----------------
 drivers/net/dpaa2/dpaa2_ethdev.c         | 59 +++++++++++++++++++++++-
 drivers/net/dpaa2/dpaa2_recycle.c        | 15 +++---
 4 files changed, 71 insertions(+), 55 deletions(-)
drivers/bus/fslmc/bus_fslmc_driver.h +0 -3
index 26292e54bb..1cef0d7b4b 100644
@@ -103,10 +103,7 @@ struct rte_dpaa2_device {
 	struct rte_device device;           /**< Inherit core 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 */
 	struct dpaa2_dprc_dev *container;
-	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 */
 	char name[FSLMC_OBJECT_MAX_LEN];    /**< DPAA2 Object name*/
 	const struct rte_fslmc_bus_info *bus_info;
drivers/bus/fslmc/portal/dpaa2_hw_dprc.c +6 -43

63 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.c +58 -1

83 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_recycle.c +7 -8
index 9b6ae3f515..37dbb47c9c 100644
@@ -627,18 +627,18 @@ dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev)
 		return 0;
 	}
 
-	if (dpaa2_dev->ep_dev_type == DPAA2_MAC) {
+	if (priv->ep_dev_type == DPAA2_MAC) {
 		/** For dpmac-dpni connection,
 		 * try setting serdes loopback as recycle device at first.
 		 */
 		if (dpaa2_svr_family == SVR_LS2088A) {
-			ret = ls_serdes_eth_lpbk(dpaa2_dev->ep_object_id, 1);
+			ret = ls_serdes_eth_lpbk(priv->ep_object_id, 1);
 			if (!ret) {
 				priv->flags |= DPAA2_TX_SERDES_LOOPBACK_MODE;
 				return 0;
 			}
 		} else if (dpaa2_svr_family == SVR_LX2160A) {
-			ret = lx_serdes_eth_lpbk(dpaa2_dev->ep_object_id, 1);
+			ret = lx_serdes_eth_lpbk(priv->ep_object_id, 1);
 			if (!ret) {
 				priv->flags |= DPAA2_TX_SERDES_LOOPBACK_MODE;
 				return 0;
@@ -667,8 +667,8 @@ dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev)
 		return 0;
 	}
 
-	if (dpaa2_dev->ep_dev_type == DPAA2_ETH &&
-		dpaa2_dev->object_id == dpaa2_dev->ep_object_id) {
+	if (priv->ep_dev_type == DPAA2_ETH &&
+		dpaa2_dev->object_id == priv->ep_object_id) {
 		priv->flags |= DPAA2_TX_DPNI_LOOPBACK_MODE;
 
 		return 0;
@@ -681,7 +681,6 @@ int
 dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev)
 {
 	struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
-	struct rte_dpaa2_device *dpaa2_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *dpaa2_dev);
 	struct fsl_mc_io *dpni_dev = eth_dev->process_private;
 	struct dpni_port_cfg port_cfg;
 	int ret = 0;
@@ -691,7 +690,7 @@ dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev)
 
 	if (priv->flags & DPAA2_TX_SERDES_LOOPBACK_MODE) {
 		if (dpaa2_svr_family == SVR_LS2088A) {
-			ret = ls_serdes_eth_lpbk(dpaa2_dev->ep_object_id, 0);
+			ret = ls_serdes_eth_lpbk(priv->ep_object_id, 0);
 			if (ret) {
 				DPAA2_PMD_WARN("Error(%d) to disable Serdes loopback",
 					ret);
@@ -699,7 +698,7 @@ dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev)
 				priv->flags &= ~DPAA2_TX_SERDES_LOOPBACK_MODE;
 			}
 		} else if (dpaa2_svr_family == SVR_LX2160A) {
-			ret = lx_serdes_eth_lpbk(dpaa2_dev->ep_object_id, 0);
+			ret = lx_serdes_eth_lpbk(priv->ep_object_id, 0);
 			if (ret) {
 				DPAA2_PMD_WARN("Error(%d) to disable Serdes loopback",
 					ret);
Signature · 1 line
2.43.0
#214 lore raw

PATCH 10/14 drivers: net/dpaa2 remove unused soft parser loader

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The DPAA2 soft parser (SP) byte code has to be installed by the boot firmware before Linux starts; the WRIOP parser cannot be reprogrammed once the MC is up. Loading an SP image at run time from the PMD therefore never took effect, so the loader and its DPNI_SS_INGRESS plumbing were dead code and are removed, together with dpaa2_sparser.c/.h and the DPAA2_ENABLE_SOFT_PARSER environment hook.

Instead of trying to load an SP image, the presence of a soft parser protocol is now detected once from the WRIOP parser CCSR at bus scan time (fslmc_soft_parser_protocol_supported()) and exposed through priv->sp_protocol. The rte_flow pattern checks that previously relied on the run-time dpaa2_soft_parser_loaded() probe now consume priv->sp_protocol instead.

---
 drivers/bus/fslmc/fslmc_bus.c     |  89 +++++++++++++
 drivers/bus/fslmc/fslmc_logs.h    |   2 +
 drivers/net/dpaa2/dpaa2_ethdev.c  |  29 +----
 drivers/net/dpaa2/dpaa2_ethdev.h  |   1 -
 drivers/net/dpaa2/dpaa2_flow.c    | 114 +++--------------
 drivers/net/dpaa2/dpaa2_recycle.c |   3 +-
 drivers/net/dpaa2/dpaa2_sparser.c | 137 --------------------
 drivers/net/dpaa2/dpaa2_sparser.h | 202 ------------------------------
 drivers/net/dpaa2/meson.build     |   1 -
 9 files changed, 107 insertions(+), 471 deletions(-)
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.c
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.h
drivers/bus/fslmc/fslmc_bus.c +89 -0
index de7e9b78c1..cb88333c68 100644
@@ -8,6 +8,7 @@
 #include <dirent.h>
 #include <stdalign.h>
 #include <stdbool.h>
+#include <sys/mman.h>
 
 #include <eal_export.h>
 #include <rte_log.h>
@@ -35,6 +36,93 @@ static struct rte_fslmc_bus_info fslmc_bus_info;
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_seqn_dynfield_offset)
 int dpaa2_seqn_dynfield_offset = -1;
 
+/** For LX2160A, LS2088A and LS1088A*/
+#define WRIOP_CCSR_BASE 0x8b80000
+#define WRIOP_CCSR_CTLU_OFFSET 0
+#define WRIOP_CCSR_CTLU_PARSER_OFFSET 0
+#define WRIOP_CCSR_CTLU_PARSER_INGRESS_OFFSET 0
+
+#define WRIOP_INGRESS_PARSER_PHY \
+	(WRIOP_CCSR_BASE + WRIOP_CCSR_CTLU_OFFSET + \
+	WRIOP_CCSR_CTLU_PARSER_OFFSET + \
+	WRIOP_CCSR_CTLU_PARSER_INGRESS_OFFSET)
+
+struct __rte_packed_begin dpaa2_parser_ccsr {
+	uint32_t psr_cfg;
+	uint32_t psr_idle;
+	uint32_t psr_pclm;
+	uint8_t psr_ver_min;
+	uint8_t psr_ver_maj;
+	uint8_t psr_id1_l;
+	uint8_t psr_id1_h;
+	uint32_t psr_rev2;
+	uint8_t rsv[0x2c];
+	uint8_t sp_ins[4032];
+} __rte_packed_end;
+
+#define SP_PROTOCOL_MAGIC_DATA 0xabcd
+#define SP_PROTOCOL_MAGIC_OFFSET 0x4
+
+/** Number of soft parser firmware bytes reported for debugging. */
+#define SP_PRINT_LEN 128
+/** Firmware bytes logged per debug line. */
+#define SP_DUMP_BYTES_PER_LINE 16
+
+static void
+fslmc_soft_parser_protocol_supported(void)
+{
+	int fd, i, pos = 0;
+	void *map_addr = NULL;
+	const struct dpaa2_parser_ccsr *parser_ccsr = NULL;
+	const uint16_t *magic_num;
+	char line[SP_DUMP_BYTES_PER_LINE * 3 + 1];
+
+	fd = open("/dev/mem", O_RDONLY | O_SYNC);
+	if (fd < 0) {
+		DPAA2_BUS_DEBUG("open \"/dev/mem\" ERROR(%d)", fd);
+		goto exit;
+	}
+
+	map_addr = mmap(NULL, sizeof(struct dpaa2_parser_ccsr),
+		PROT_READ, MAP_SHARED, fd,
+		WRIOP_INGRESS_PARSER_PHY);
+	if (map_addr == MAP_FAILED) {
+		DPAA2_BUS_DEBUG("Map 0x%" PRIx64 "(size=0x%zx) failed",
+			(uint64_t)WRIOP_INGRESS_PARSER_PHY,
+			sizeof(struct dpaa2_parser_ccsr));
+		map_addr = NULL;
+		goto exit;
+	}
+	parser_ccsr = map_addr;
+
+	DPAA2_BUS_DEBUG("Soft ParserID:0x%02x%02x, Rev:maj(%02x), min(%02x)",
+		parser_ccsr->psr_id1_h, parser_ccsr->psr_id1_l,
+		parser_ccsr->psr_ver_maj, parser_ccsr->psr_ver_min);
+
+	magic_num = (const void *)&parser_ccsr->sp_ins[SP_PROTOCOL_MAGIC_OFFSET];
+	if (*magic_num == SP_PROTOCOL_MAGIC_DATA) {
+		fslmc_bus_info.sp_protocol = true;
+		DPAA2_BUS_DEBUG("Soft parser protocol support.");
+		DPAA2_BUS_DEBUG("First %d bytes of sp protocol firmware:", SP_PRINT_LEN);
+		for (i = 0; i < SP_PRINT_LEN; i++) {
+			pos += snprintf(&line[pos], sizeof(line) - pos,
+				"%02x ", parser_ccsr->sp_ins[i]);
+			if ((i + 1) % SP_DUMP_BYTES_PER_LINE == 0) {
+				DPAA2_BUS_DEBUG("%s", line);
+				pos = 0;
+			}
+		}
+		if (pos)
+			DPAA2_BUS_DEBUG("%s", line);
+	}
+
+exit:
+	if (map_addr)
+		munmap(map_addr, sizeof(struct dpaa2_parser_ccsr));
+	if (fd >= 0)
+		close(fd);
+}
+
 RTE_EXPORT_INTERNAL_SYMBOL(rte_fslmc_get_device_count)
 uint32_t
 rte_fslmc_get_device_count(enum rte_dpaa2_dev_type device_type)
@@ -345,6 +433,7 @@ rte_fslmc_scan(void)
 		DPAA2_BUS_ERR("Unable to open VFIO group directory");
 		goto scan_fail;
 	}
+	fslmc_soft_parser_protocol_supported();
 
 	/* Scan the DPRC container object */
 	ret = scan_one_fslmc_device(group_name);
drivers/bus/fslmc/fslmc_logs.h +2 -0
index 412d160d11..7e27ca4bf4 100644
@@ -19,6 +19,8 @@ extern int dpaa2_logtype_bus;
 
 #define DPAA2_BUS_INFO(fmt, ...) \
 	DPAA2_BUS_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_BUS_NOTICE(fmt, ...) \
+	DPAA2_BUS_LOG(NOTICE, fmt, ## __VA_ARGS__)
 #define DPAA2_BUS_ERR(fmt, ...) \
 	DPAA2_BUS_LOG(ERR, fmt, ## __VA_ARGS__)
 #define DPAA2_BUS_WARN(fmt, ...) \
drivers/net/dpaa2/dpaa2_ethdev.c +1 -28
index 0eafee8832..ae88f11675 100644
@@ -30,7 +30,6 @@
 #include <mc/fsl_dpmng.h>
 #include <mc/fsl_dpcon.h>
 #include "dpaa2_ethdev.h"
-#include "dpaa2_sparser.h"
 #include <fsl_qbman_debug.h>
 #include <dpaax_devarg.h>
 
@@ -3760,33 +3759,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	}
 	eth_dev->data->mtu = RTE_ETHER_MTU;
 
-	/*TODO To enable soft parser support DPAA2 driver needs to integrate
-	 * with external entity to receive byte code for software sequence
-	 * and same will be offload to the H/W using MC interface.
-	 * Currently it is assumed that DPAA2 driver has byte code by some
-	 * mean and same if offloaded to H/W.
-	 */
-	if (getenv("DPAA2_ENABLE_SOFT_PARSER")) {
-		WRIOP_SS_INITIALIZER(priv);
-		ret = dpaa2_eth_load_wriop_soft_parser(priv, DPNI_SS_INGRESS);
-		if (ret < 0) {
-			DPAA2_PMD_ERR(" Error(%d) in loading softparser",
-				      ret);
-			goto init_err;
-		}
-
-		ret = dpaa2_eth_enable_wriop_soft_parser(priv,
-							 DPNI_SS_INGRESS);
-		if (ret < 0) {
-			DPAA2_PMD_ERR(" Error(%d) in enabling softparser",
-				      ret);
-			goto init_err;
-		}
-	}
-
-	ret = dpaa2_soft_parser_loaded();
-	if (ret > 0)
-		DPAA2_PMD_INFO("soft parser is loaded");
+	priv->sp_protocol = dpaa2_dev->bus_info->sp_protocol;
 	DPAA2_PMD_INFO("%s: netdev created, connected to %s",
 		eth_dev->data->name, priv->ep_name);
 
drivers/net/dpaa2/dpaa2_ethdev.h +0 -1
index 5bc34a6d92..adf61b5a9f 100644
@@ -629,7 +629,6 @@ int dpaa2_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 
 int dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev);
 int dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev);
-int dpaa2_soft_parser_loaded(void);
 
 void
 dpaa2_dev_mac_setup_stats(struct rte_eth_dev *dev);
drivers/net/dpaa2/dpaa2_flow.c +14 -100

187 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_recycle.c +1 -2
index 37dbb47c9c..4a693cfe04 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2019-2021 NXP
+ * Copyright 2019-2026 NXP
  */
 
 #include <time.h>
@@ -23,7 +23,6 @@
 #include <dpaa2_hw_dpio.h>
 #include <mc/fsl_dpmng.h>
 #include "dpaa2_ethdev.h"
-#include "dpaa2_sparser.h"
 #include <fsl_qbman_debug.h>
 
 #include <rte_io.h>
drivers/net/dpaa2/dpaa2_sparser.c deleted +0 -137

137 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_sparser.h deleted +0 -202

202 lines not on this page · raw message

drivers/net/dpaa2/meson.build +0 -1
index 4094ea02ba..b821f7bfad 100644
@@ -16,7 +16,6 @@ sources = files(
         'dpaa2_flow.c',
         'dpaa2_recycle.c',
         'dpaa2_rxtx.c',
-        'dpaa2_sparser.c',
         'dpaa2_ptp.c',
         'mc/dprtc.c',
         'mc/dpkg.c',
Signature · 1 line
2.43.0
#215 lore raw

PATCH 11/14 drivers: net/dpaa2 cache Rx queue config and share TC CGIDs

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Rework DPAA2 Rx queue setup so the DPNI queue descriptor is allocated once per Rx queue and reused on later reconfiguration (eventq attach / detach, release), and change congestion-group (CGID) allocation from one CGID per Rx queue to one CGID shared by all Rx queues of the same traffic class.

---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h |   3 +-
 drivers/net/dpaa2/dpaa2_ethdev.c        | 274 ++++++++++++------------
 drivers/net/dpaa2/dpaa2_ethdev.h        |   3 +-
 3 files changed, 136 insertions(+), 144 deletions(-)
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +2 -1
index 52e6aa0bab..715c0298fc 100644
@@ -176,7 +176,6 @@ struct __rte_cache_aligned dpaa2_queue {
 	uint32_t fqid;		/*!< Unique ID of this queue */
 	uint16_t flow_id;	/*!< To be used by DPAA2 framework */
 	uint8_t tc_index;	/*!< traffic class identifier */
-	uint8_t cgid;		/*! < Congestion Group id for this queue */
 	uint64_t rx_pkts;
 	uint64_t tx_pkts;
 	uint64_t err_pkts;
@@ -186,6 +185,8 @@ struct __rte_cache_aligned dpaa2_queue {
 		/**Egress*/
 		struct qbman_result *cscn;
 	};
+	void *cfg;
+	uint8_t options;
 	struct rte_event ev;
 	dpaa2_queue_cb_dqrr_t *cb;
 	dpaa2_queue_cb_eqresp_free_t *cb_eqresp_free;
drivers/net/dpaa2/dpaa2_ethdev.c +132 -142

434 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.h +2 -1
index adf61b5a9f..e9cf8c9f88 100644
@@ -453,7 +453,8 @@ struct dpaa2_dev_priv {
 	uint8_t en_ordered;
 	uint8_t en_loose_ordered;
 	uint8_t max_cgs;
-	uint8_t cgid_in_use[MAX_RX_QUEUES];
+	/** RXQs in same TC share same cgid.*/
+	uint8_t cgid_in_use[MAX_TCS];
 
 	/* Current hash distribution size per RX TC, written by
 	 * dpaa2_setup_flow_dist_size() and read by reta_query / reta_update.
Signature · 1 line
2.43.0
#216 lore raw

PATCH 12/14 drivers: net/dpaa2 add dynamic Tx confirmation mode

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

The current DPAA2 Tx path relies on absolute Tx confirmation, where every transmitted buffer is returned through a Tx confirmation queue. This increases confirmation queue traffic and processing overhead even for buffers that can be directly released by hardware.

Rework Tx confirmation handling to support multiple confirmation modes and reduce unnecessary confirmation processing.

Introduce a Tx confirmation type model supporting:
- no confirmation
- absolute confirmation
- dynamic confirmation

Add the drv_tx_dyn_conf devarg to enable dynamic Tx confirmation. In this mode, Tx confirmations are generated only for packets that require software buffer retirement, such as cloned, indirect, external or foreign-pool mbufs. Other packets continue to be released directly by hardware.

The Tx path is updated to select the appropriate confirmation behavior based on buffer ownership and buffer layout. Tx FD and scatter-gather construction are refactored accordingly.

Tx confirmation queue allocation, cleanup and dequeue handling are also reworked. Queue memory management is simplified through a unified queue allocation scheme, and Tx confirmation processing is optimized with bulk mbuf release support.

IEEE1588 Tx timestamp handling is updated to operate with the new confirmation model.

The redundant tm_sw_td software taildrop handling is removed. Packets that cannot be transmitted due to queue congestion remain under application ownership, which is consistent with ethdev Tx burst semantics.

Update the DPAA2 PMD documentation to describe the available Tx confirmation modes and their usage.

---
 doc/guides/nics/dpaa2.rst                    |   11 +-
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h      |    1 -
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c       |    2 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h |    6 +-
 drivers/net/dpaa2/dpaa2_ethdev.c             |  195 +--
 drivers/net/dpaa2/dpaa2_ethdev.h             |   29 +-
 drivers/net/dpaa2/dpaa2_ptp.c                |    6 +-
 drivers/net/dpaa2/dpaa2_rxtx.c               | 1432 ++++++++----------
 drivers/net/dpaa2/dpaa2_tm.c                 |    1 -
 9 files changed, 782 insertions(+), 901 deletions(-)
doc/guides/nics/dpaa2.rst +9 -2
index 745c556c21..f4656d7a9b 100644
@@ -476,10 +476,17 @@ Refer to the document :doc:`build_and_test` for details.
   of the packet pull command which is issued  in the previous cycle.
   e.g. ``fslmc:dpni.1,drv_no_prefetch=1``
 
-* Use dev arg option  ``drv_tx_conf=1`` to enable TX confirmation mode.
-  In this mode tx conf queues need to be polled to free the buffers.
+* Use dev arg option  ``drv_tx_conf=1`` to enable absolute TX confirmation mode.
+  In this mode every transmitted buffer is returned on a tx conf queue which
+  needs to be polled to free the buffers.
   e.g. ``fslmc:dpni.1,drv_tx_conf=1``
 
+* Use dev arg option  ``drv_tx_dyn_conf=1`` to enable dynamic TX confirmation
+  mode. In this mode only buffers that cannot be released directly by the
+  hardware (for example indirect, external or shared buffers) are returned on
+  a tx conf queue which needs to be polled to free the buffers.
+  e.g. ``fslmc:dpni.1,drv_tx_dyn_conf=1``
+
 * Use dev arg option ``drv_rx_parse_drop=1`` to configure the system
   to start dropping the error packets in hardware (parse errors).
   e.g. ``fslmc:dpni.1,drv_rx_parse_drop=1``
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +0 -1
index 715c0298fc..2250c8db6e 100644
@@ -195,7 +195,6 @@ struct __rte_cache_aligned dpaa2_queue {
 	struct dpaa2_queue *tx_conf_queue;
 	int32_t eventfd;	/*!< Event Fd of this queue */
 	uint16_t nb_desc;
-	uint16_t tm_sw_td;	/*!< TM software taildrop */
 	uint64_t offloads;
 	uint64_t lpbk_cntx;
 	uint8_t data_stashing_off;
drivers/net/dpaa2/base/dpaa2_hw_dpni.c +1 -1
index 83694133f1..5f4268f0d7 100644
@@ -482,7 +482,7 @@ dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
 	 */
 
 	/* ... rx buffer layout ... */
-	if (priv->flags & DPAA2_TX_DYNAMIC_CONF_ENABLE) {
+	if (priv->tx_conf_type == DPAA2_TX_DYNAMIC_CONF) {
 		int out_min_hdr_room, in_min_hdr_room;
 		/** Additional headroom layout for IPSec with TX configure
 		 * dynamic enabled.
drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h +5 -1
index a670098958..b06fa3f644 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016,2019,2022,2024 NXP
+ *   Copyright 2016,2019,2022,2024-2026 NXP
  *
  */
 
@@ -281,6 +281,10 @@ struct dpaa2_faead {
 /*UPD (Update prepended data)*/
 #define DPAA2_ANNOT_FAEAD_UPD		0x00000010
 
+#define DPAA2_TX_CONFIRM_ENABLE \
+	(DPAA2_ANNOT_FAEAD_A4V | DPAA2_ANNOT_FAEAD_EBDD | \
+	DPAA2_ANNOT_FAEAD_EBDDV)
+
 /* Debug frame, otherwise supposed to be discarded */
 #define DPAA2_ETH_FAS_DISC	      0x80000000
 /* MACSEC frame */
drivers/net/dpaa2/dpaa2_ethdev.c +104 -91

318 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.h +14 -15
index e9cf8c9f88..7a58833ba1 100644
@@ -7,7 +7,6 @@
 
 #ifndef _DPAA2_ETHDEV_H
 #define _DPAA2_ETHDEV_H
-
 #include <rte_compat.h>
 #include <rte_event_eth_rx_adapter.h>
 #include <rte_pmd_dpaa2.h>
@@ -95,20 +94,12 @@
 
 #define DPAA2_TX_DPNI_LOOPBACK_MODE	RTE_BIT32(7)
 
-/* Tx confirmation enabled */
-#define DPAA2_TX_CONF_ENABLE	RTE_BIT32(8)
-
-/* Tx dynamic confirmation enabled,
- * only valid with Tx confirmation enabled.
- */
-#define DPAA2_TX_DYNAMIC_CONF_ENABLE	RTE_BIT32(9)
-
 /* Disable data stashing (prefetch of packet data into CPU cache) */
-#define DPAA2_RX_DATA_STASHING_OFF_FLAG		RTE_BIT32(10)
+#define DPAA2_RX_DATA_STASHING_OFF_FLAG		RTE_BIT32(8)
 
-#define DPAA2_RX_ERROR_QUEUE_FLAG	RTE_BIT32(11)
+#define DPAA2_RX_ERROR_QUEUE_FLAG	RTE_BIT32(9)
 
-#define DPAA2_RX_PRINT_PSR_RESULT_FLAG RTE_BIT32(12)
+#define DPAA2_RX_PRINT_PSR_RESULT_FLAG RTE_BIT32(10)
 
 /* DPDMUX index for DPMAC */
 #define DPAA2_DPDMUX_DPMAC_IDX 0
@@ -426,6 +417,12 @@ struct extract_s {
 	uint8_t *tc_extract_param[MAX_TCS];
 };
 
+enum dpaa2_tx_conf_type {
+	DPAA2_TX_NO_CONF,
+	DPAA2_TX_ABSOLUTE_CONF,
+	DPAA2_TX_DYNAMIC_CONF
+};
+
 struct dpaa2_dev_priv {
 	void *hw;
 	int32_t hw_id;
@@ -435,12 +432,14 @@ struct dpaa2_dev_priv {
 	uint8_t nb_tx_queues;
 	uint8_t nb_rx_queues;
 	uint32_t options;
+	struct dpaa2_queue *q_base;
 	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 *rx_err_vq;
 	uint32_t flags; /*dpaa2 config flags */
+	enum dpaa2_tx_conf_type tx_conf_type;
 	uint32_t psr_dynfield_offset;
 	uint8_t max_mac_filters;
 	uint8_t max_vlan_filters;
@@ -480,10 +479,10 @@ struct dpaa2_dev_priv {
 	/*stores timestamp of last received tx confirmation packet on dev*/
 	uint64_t tx_timestamp;
 
-	/* stores pointer to next tx_conf queue that should be processed,
+	/* stores next tx queue to be confirmed that should be processed,
 	 * it corresponds to last packet transmitted
 	 */
-	struct dpaa2_queue *next_tx_conf_queue;
+	struct dpaa2_queue *next_txq_to_cnf;
 
 	struct rte_eth_dev *eth_dev; /**< Pointer back to holding ethdev */
 	rte_spinlock_t lpbk_qp_lock;
@@ -613,7 +612,7 @@ uint16_t dpaa2_dev_tx_multi_txq_ordered(void **queue,
 
 void dpaa2_dev_free_eqresp_buf(uint16_t eqresp_ci, struct dpaa2_queue *dpaa2_q);
 void dpaa2_flow_clean(struct rte_eth_dev *dev);
-uint16_t dpaa2_dev_tx_conf(void *queue)  __rte_unused;
+uint16_t dpaa2_dev_tx_conf(void *txq, int drain);
 
 int dpaa2_timesync_enable(struct rte_eth_dev *dev);
 int dpaa2_timesync_disable(struct rte_eth_dev *dev);
drivers/net/dpaa2/dpaa2_ptp.c +3 -3
index 751e558c73..2863cad4dd 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2019, 2023 NXP
+ * Copyright 2019, 2023-2026 NXP
  */
 
 #include <sys/queue.h>
@@ -111,9 +111,9 @@ 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) {
+	if (priv->next_txq_to_cnf) {
 		while (!priv->tx_timestamp)
-			dpaa2_dev_tx_conf(priv->next_tx_conf_queue);
+			dpaa2_dev_tx_conf(priv->next_txq_to_cnf, false);
 	} else {
 		return -1;
 	}
drivers/net/dpaa2/dpaa2_rxtx.c +646 -786

1,689 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_tm.c +0 -1
index 3057f4d031..c5c4235b6c 100644
@@ -651,7 +651,6 @@ dpaa2_tm_configure_queue(struct rte_eth_dev *dev, struct dpaa2_tm_node *node)
 			"err=%d", ret);
 		return -ret;
 	}
-	dpaa2_q->tm_sw_td = true;
 
 	return 0;
 }
Signature · 1 line
2.43.0
#217 lore raw

PATCH 13/14 drivers: bus/fslmc provide shared DPRTC RTC services

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Introduce shared DPRTC RTC services in the fslmc bus layer.

Move the DPRTC MC driver and object management code from the DPAA2 Ethernet PMD into bus/fslmc. Add bus-level APIs for DPRTC allocation, release, time read and time update operations.

The fslmc bus acquires a DPRTC handle during initialization and exposes it through rte_fslmc_bus_info. DPAA2 PTP operations are updated to use these bus services instead of managing a private DPRTC instance.

This centralizes DPRTC ownership and enables RTC functionality to be shared by FSLMC-based drivers.

---
 drivers/bus/fslmc/bus_fslmc_driver.h          |   1 +
 drivers/bus/fslmc/fslmc_bus.c                 |   7 +
 drivers/bus/fslmc/fslmc_vfio.c                |  10 ++
 drivers/{net/dpaa2 => bus/fslmc}/mc/dprtc.c   |   0
 .../{net/dpaa2 => bus/fslmc}/mc/fsl_dprtc.h   |   0
 .../dpaa2 => bus/fslmc}/mc/fsl_dprtc_cmd.h    |   0
 drivers/bus/fslmc/meson.build                 |   2 +
 drivers/bus/fslmc/portal/dpaa2_hw_dprtc.c     | 131 ++++++++++++++++++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h       |  18 +++
 drivers/bus/fslmc/private.h                   |   5 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   1 +
 drivers/net/dpaa2/dpaa2_ethdev.h              |   1 +
 drivers/net/dpaa2/dpaa2_ptp.c                 |  96 +++----------
 drivers/net/dpaa2/meson.build                 |   1 -
 14 files changed, 192 insertions(+), 81 deletions(-)
 rename drivers/{net/dpaa2 => bus/fslmc}/mc/dprtc.c (100%)
 rename drivers/{net/dpaa2 => bus/fslmc}/mc/fsl_dprtc.h (100%)
 rename drivers/{net/dpaa2 => bus/fslmc}/mc/fsl_dprtc_cmd.h (100%)
 create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dprtc.c
drivers/bus/fslmc/bus_fslmc_driver.h +1 -0
index 1cef0d7b4b..73d7f9abf1 100644
@@ -90,6 +90,7 @@ enum rte_dpaa2_dev_type {
 };
 
 struct rte_fslmc_bus_info {
+	void *rtc_handle;
 	int sp_protocol;
 	uint64_t mc_rev;
 	uint32_t svr;
drivers/bus/fslmc/fslmc_bus.c +7 -0
index cb88333c68..477f765a67 100644
@@ -640,6 +640,9 @@ fslmc_bus_process_iodevices(void)
 		}
 	}
 
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+		fslmc_bus_info.rtc_handle = fslmc_vfio_get_rtc_handle();
+
 	return 0;
 }
 
@@ -710,6 +713,10 @@ fslmc_bus_close_group(void)
 {
 	struct rte_dpaa2_device *dev;
 
+	if (fslmc_bus_info.rtc_handle)
+		fslmc_vfio_put_rtc_handle(fslmc_bus_info.rtc_handle);
+	fslmc_bus_info.rtc_handle = NULL;
+
 	RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus) {
 		if (dev->device.devargs &&
 		    dev->device.devargs->policy == RTE_DEV_BLOCKED) {
drivers/bus/fslmc/fslmc_vfio.c +10 -0
index 58e33c6866..40bcd51153 100644
@@ -1783,3 +1783,13 @@ fslmc_vfio_setup_group(void)
 
 	return 0;
 }
+
+void *fslmc_vfio_get_rtc_handle(void)
+{
+	return rte_dpaa2_alloc_dprtc_dev();
+}
+
+void fslmc_vfio_put_rtc_handle(void *rtc_handle)
+{
+	rte_dpaa2_free_dprtc_dev(rtc_handle);
+}
drivers/bus/fslmc/mc/dprtc.c renamed from drivers/net/dpaa2/mc/dprtc.c +0 -0
similarity index 100%
rename from drivers/net/dpaa2/mc/dprtc.c
rename to drivers/bus/fslmc/mc/dprtc.c
drivers/bus/fslmc/mc/fsl_dprtc.h renamed from drivers/net/dpaa2/mc/fsl_dprtc.h +0 -0
similarity index 100%
rename from drivers/net/dpaa2/mc/fsl_dprtc.h
rename to drivers/bus/fslmc/mc/fsl_dprtc.h
drivers/bus/fslmc/mc/fsl_dprtc_cmd.h renamed from drivers/net/dpaa2/mc/fsl_dprtc_cmd.h +0 -0
similarity index 100%
rename from drivers/net/dpaa2/mc/fsl_dprtc_cmd.h
rename to drivers/bus/fslmc/mc/fsl_dprtc_cmd.h
drivers/bus/fslmc/meson.build +2 -0
index 50d9e91a37..67379432a0 100644
@@ -19,12 +19,14 @@ sources = files(
         'mc/dpio.c',
         'mc/dpmng.c',
         'mc/dprc.c',
+        'mc/dprtc.c',
         'mc/mc_sys.c',
         'portal/dpaa2_hw_dpbp.c',
         'portal/dpaa2_hw_dpci.c',
         'portal/dpaa2_hw_dpcon.c',
         'portal/dpaa2_hw_dpio.c',
         'portal/dpaa2_hw_dprc.c',
+        'portal/dpaa2_hw_dprtc.c',
         'qbman/qbman_portal.c',
         'qbman/qbman_debug.c',
 )
drivers/bus/fslmc/portal/dpaa2_hw_dprtc.c new file +131 -0

131 lines not on this page · raw message

drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +18 -0
index 2250c8db6e..502cf5eeb5 100644
@@ -284,6 +284,15 @@ struct dpaa2_dpcon_dev {
 	uint8_t channel_index;
 };
 
+struct dpaa2_dprtc_dev {
+	TAILQ_ENTRY(dpaa2_dprtc_dev) next;
+	struct fsl_mc_io dprtc;
+	uint16_t token;
+	uint32_t dprtc_id;
+
+	RTE_ATOMIC(uint16_t) in_use;
+};
+
 /* DPCON channel pool, shared by the net rx-interrupt path and the event PMD */
 __rte_internal
 struct dpaa2_dpcon_dev *rte_dpaa2_alloc_dpcon_dev(void);
@@ -568,6 +577,15 @@ void dpaa2_free_dpbp_dev(struct dpaa2_dpbp_dev *dpbp);
 __rte_internal
 int dpaa2_dpbp_supported(void);
 
+__rte_internal
+struct dpaa2_dprtc_dev *rte_dpaa2_alloc_dprtc_dev(void);
+__rte_internal
+void rte_dpaa2_free_dprtc_dev(struct dpaa2_dprtc_dev *dprtc);
+__rte_internal
+int rte_dpaa2_dprtc_get_time(struct dpaa2_dprtc_dev *dprtc, uint64_t *ns);
+__rte_internal
+int rte_dpaa2_dprtc_set_time(struct dpaa2_dprtc_dev *dprtc, uint64_t ns);
+
 __rte_internal
 struct dpaa2_dpci_dev *rte_dpaa2_alloc_dpci_dev(void);
 
drivers/bus/fslmc/private.h +3 -2
index 3586092529..44d1c1453a 100644
@@ -18,8 +18,9 @@ void fslmc_vfio_close_iodevices(struct rte_dpaa2_device *dev);
 int fslmc_vfio_setup_group(void);
 void fslmc_vfio_clear_group(void);
 
+void *fslmc_vfio_get_rtc_handle(void);
+void fslmc_vfio_put_rtc_handle(void *rtc_handle);
+
 int fslmc_vfio_get_container_group(const char *group_name, int *gropuid);
 int fslmc_vfio_dmamap(void);
-
-
 #endif /* BUS_FSLMC_PRIVATE_H */
drivers/net/dpaa2/dpaa2_ethdev.c +1 -0
index c842f1546d..68e70cdb45 100644
@@ -3601,6 +3601,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	}
 
 	priv->mc_rev = dpaa2_dev->bus_info->mc_rev;
+	priv->rtc_handle = dpaa2_dev->bus_info->rtc_handle;
 	priv->num_rx_tc = attr.num_rx_tcs;
 	priv->num_tx_tc = attr.num_tx_tcs;
 	priv->qos_entries = attr.qos_entries;
drivers/net/dpaa2/dpaa2_ethdev.h +1 -0
index 7a58833ba1..573a23d00f 100644
@@ -499,6 +499,7 @@ struct dpaa2_dev_priv {
 	uint64_t *cnt_values_dma_mem;
 	uint64_t cnt_idx_iova, cnt_values_iova;
 	uint64_t mc_rev;
+	void *rtc_handle;
 
 	struct dpaa2_dev_flow *curr;
 	LIST_HEAD(, dpaa2_dev_flow) flows;
drivers/net/dpaa2/dpaa2_ptp.c +18 -78

148 lines not on this page · raw message

drivers/net/dpaa2/meson.build +0 -1
index b821f7bfad..61f68f6fec 100644
@@ -17,7 +17,6 @@ sources = files(
         'dpaa2_recycle.c',
         'dpaa2_rxtx.c',
         'dpaa2_ptp.c',
-        'mc/dprtc.c',
         'mc/dpkg.c',
         'mc/dpdmux.c',
         'mc/dpni.c',
Signature · 1 line
2.43.0
#218 lore raw

PATCH 14/14 net/dpaa2: support runtime IEEE1588 timestamping

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Replace the experimental one-step timestamp configuration APIs with internal runtime handling. The driver now parses outgoing PTP packets and updates the one-step correction field offset automatically when required.

Introduce a dedicated timesync context to consolidate RX/TX timestamp state, dynamic timestamp registration, and timestamp tracking. Add timestamp extraction for RX packets and timestamp handling for TX confirmations through the standard ethdev timesync callbacks.

As a result, the experimental APIs
rte_pmd_dpaa2_set_one_step_ts() and
rte_pmd_dpaa2_get_one_step_ts() are removed.

---
 doc/guides/rel_notes/release_26_11.rst |   2 +
 drivers/net/dpaa2/dpaa2_ethdev.c       |  91 +---------
 drivers/net/dpaa2/dpaa2_ethdev.h       |  50 ++++--
 drivers/net/dpaa2/dpaa2_ptp.c          | 141 +++++++++++++--
 drivers/net/dpaa2/dpaa2_rxtx.c         | 234 +++++++++++++------------
 drivers/net/dpaa2/rte_pmd_dpaa2.h      |  10 --
 6 files changed, 289 insertions(+), 239 deletions(-)
doc/guides/rel_notes/release_26_11.rst +2 -0
index 9835d74b17..70266464d2 100644
@@ -163,6 +163,8 @@ Removed Items
    This section is a comment. Do not overwrite or remove it.
    Also, make sure to start the actual text at the margin.
    =======================================================
+* net/dpaa2: Removed the experimental one-step PTP APIs
+  ``rte_pmd_dpaa2_set_one_step_ts()`` and ``rte_pmd_dpaa2_get_one_step_ts()``.
 
 * Removed deprecated symbols:
 
drivers/net/dpaa2/dpaa2_ethdev.c +7 -84

137 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ethdev.h +35 -15

93 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_ptp.c +127 -14

187 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_rxtx.c +118 -116

439 lines not on this page · raw message

drivers/net/dpaa2/rte_pmd_dpaa2.h +0 -10
index cef2e84143..2bfe1966b9 100644
@@ -167,14 +167,4 @@ struct dpaa2_dyn_rx_protocol_pos {
  *	pos = RTE_MBUF_DYNFIELD(m, offset, struct dpaa2_dyn_rx_protocol_pos);
  *	return pos;
  */
-
-#if defined(RTE_LIBRTE_IEEE1588)
-__rte_experimental
-int
-rte_pmd_dpaa2_set_one_step_ts(uint16_t port_id, uint16_t offset, uint8_t ch_update);
-
-__rte_experimental
-int
-rte_pmd_dpaa2_get_one_step_ts(uint16_t port_id, bool mc_query);
-#endif
 #endif /* _RTE_PMD_DPAA2_H */
Signature · 1 line
2.43.0
#219 lore raw

Re: [PATCH v5-S3 00/14] net/dpaa2 and fslmc infrastructure updates

In reply to Prashant Gupta
Quoted 8 lines · On Fri, 30 Oct 2026 10:50:02 +0530 Prashant Gupta <[email protected]>…

This series is part of the ongoing DPAA2 upstreaming effort, applied on top of v7-S1 ("dpaa2: bus, DMA and mempool base fixes") and v14-S2 ("net/dpaa2 updates").

Compared to v4-S3, the series has been reduced and reorganized to focus on DPAA2 PMD and fslmc infrastructure improvements. It includes parser decode optimizations, common devargs handling, queue management enhancements, DPRTC infrastructure support, and runtime timestamping.

Still lots of outstanding issues identified by manually running Claude AI review

Review: [PATCH v5-S3 00/14] DPAA2 refactor (Jun Yang, Prashant Gupta)

Applied with git am --3way on dpdk-next-net for-main (52ebbf7d9de8), all 14 apply. Per-commit builds clean with gcc 13.3, -Werror, with and without RTE_LIBRTE_IEEE1588. v4 findings rechecked against the v5 post-apply source.

Series-level
============

1. Progress since v4: the vfio include, bisect build breaks, missing subject on 12, secondary-process flag reset (02), key-only devarg crashes (03, 06), cluster_size divide (08), hex dump per byte (05), NO_CONF shared-buffer release, clone data_off/len and FAEAD headroom (12), Rx timestamp dynfield at offset 0 and the ts_to_cnfd race (14) are fixed.

2. Still no Fixes:/Cc: stable for bugs in released code that this set fixes or touches:
- priv->ep_dev_type/ep_name never set in main (09).

Fixes a0f8ddc41218 ("net/dpaa2: add API to get endpoint name")
Fixes c78fa95fa9b0 ("net/dpaa2: set speed capabilities based on actual MAC")

- tx_vq[16] overflow capped in 07.

Fixes 72100f0dee21 ("net/dpaa2: support level 2 in traffic management")

- drv_err_queue (code) vs drv_error_queue (doc) mismatch, now silently renamed in 02.

Fixes 4690a6114ff6 ("net/dpaa2: enable error queues optionally")

- dpaax_ptp.h compares be16 udp->dst_port to host order 319/320; UDP PTP never matches on LE, and 14 now warns and drops TMST on every UDP PTP frame because of it.

Fixes 6cc1246b3b1a ("net/dpaa: support IEEE 1588 by timesync API")

Send these as standalone fixes ahead of the series.

3. Commit logs of 01, 02, 07, 08, 11, 12 and 14 do not describe their diffs (details per patch). 14 lost most of the v4 description.

4. Several reads of the frame annotation happen after dpaa2_eth_sg_fd_to_mbuf() has freed the SGT buffer (01 parser dump, 06 parse offset, 14 Rx timestamp). Read the annotation inside the fd_to_mbuf helpers before the free.

Patch findings
==============

[01/14] net/dpaa2: refactor and optimize Rx parser result decode

Error: VLAN decode wipes L3/L4 and reports QinQ
dpaa2_dev_rx_parse_vlan():

    *packet_type &= RTE_PTYPE_L2_MASK;
    *packet_type |= RTE_PTYPE_L2_ETHER_VLAN;
  keeps only the L2 field: single-tagged IPv4/UDP becomes
  ETHER(1) | VLAN(6) == L2_ETHER_QINQ with no L3/L4. The summary
  passed in still has sum.vlan cleared, so "sum->vlan > 1" never hits.
  Fix: pass the unmasked summary;
    *pt = (*pt & ~RTE_PTYPE_L2_MASK) |
          (sum->vlan > 1 ? RTE_PTYPE_L2_ETHER_QINQ
                         : RTE_PTYPE_L2_ETHER_VLAN);

Error: rejected Tx SG FD still freed with the Rx SG converter in
dpaa2_dev_free_eqresp_buf() (dpaa2_rxtx.c:1644).

Warning: parse_frc() ORs L2 values: ETHER | TIMESYNC == ARP,
VLAN | ARP, VLAN | MPLS. TMST set without RTE_LIBRTE_IEEE1588 and on the prefetch path, which records no rx_timestamp. Assign the L2 field; set TMST only where the timestamp is stored.

Warning: parse_slow() gets a second VLAN block; the old block after it
overwrites vlan_tci with the outer tag for QinQ. Keep one.

Warning: !by_channel guard on the error queue drain still removed on
the prefetch path.

Warning: dpaa2_dump_print() still logs to RTE_LOGTYPE_USER1. eCPRI
type 4 dump still memcpy()s wire bytes into a bitfield. FAFE layout change still unexplained; flow code still builds ECPRI_FAFE_TYPE_x with the old layout, so dump and flow disagree.

Warning: parser dump runs after the SGT buffer is freed (series 4);
from dump_err_pkts() every error frame logs "Received on invalid rxq".

Warning: commit log still omits the eventdev SG fix, eqresp SG,
by_channel removal, RSS/FDIR on non-LX2, new public FDIR macros and getenv removal. Unused DPAA2_PKT_TYPE_*_EXT/GRE/SCTP/ICMP macros, enum dpaa2_parser_protocol_id and no-op ECPRI()/ROCEv2() remain.

[02/14] drivers: net/dpaa2 centralize devargs definitions

Warning: drv_err_queue renamed to drv_error_queue without accepting the
old key; dpaa2.rst:587 still says drv_err_queue (series 2).

Warning: commit log only describes the X-macro table. Not mentioned:
new net devarg drv_strict_order, DPAA2_STRICT_ORDERING_ENABLE getenv moved to probe, the rename, primary-only parsing, per-arg INFO logs dropped, "=0" now clears (main accepted only "1").

Warning: dpaax_devarg.h: flag_bit is uint64_t but written through
"*((uint32_t *)flags)" on a void *; logs to RTE_LOGTYPE_USER1 ("Failed to get value of %s" missing "\n"); includes ethdev_driver.h for crypto/dma users while <string.h>, <errno.h>, <stdarg.h> are missing.
Fix: typed uint32_t *flags, caller's logtype, include what is used.

[03/14] crypto/dpaa2_sec: use table-driven devargs parsing

Error: drv_strict_order still never takes effect
parsed at dpaa2_sec_dpseci.c:4388, then

    internals->en_loose_ordered = true;

at :4437 overwrites it. Regression against main.
Fix: set the default before dpaax_get_devargs(), drop :4437.

[06/14] net/dpaa2: export parser protocol offsets via mbuf dynfield

Error: dpaa2_dev_rx_parse_offset() reads DPAA2_GET_FD_ADDR(fd) after
the SGT buffer is freed; v5 adds the same call to the three eventdev Rx paths (dpaa2_rxtx.c:1052, :1086, :1123). Series 4.

Warning: the public struct in rte_pmd_dpaa2.h has no rte_ prefix, no
doxygen for offset base or absent-header value, and the comment block after it attaches to the next declaration. No release note.

[07/14] drivers: net/dpaa2 rework Tx queue mapping

Error: channel = txq % num_channels, but
nb_tx_queues = num_tx_tcs * num_queues
no longer scales with channels. With SINGLE_SENDER a 2-channel DPNI gets 8 Tx queues: ch0 sees even TCs, ch1 odd TCs. dpaa2_tm.c still advertises num_tx_tc * num_channels leaves and rejects leaf id >= nb_tx_queues, so a TM tree for the second channel cannot be built.
Fix: nb_tx_queues = num_tx_tcs * num_channels (capped) with channel = txq / num_tx_tcs, or update dpaa2_tm to match.

Warning: commit log says tc_index is no longer derived from the queue
number; "mc_q->tc_index = i / num_queue_per_tc" still is. Queue count formula, MAX_TX_QUEUES 16 -> 128, caps and Rx re-setup guard not mentioned. tx_channels[] is write-only; the Rx "already setup" guard is unreachable (release resets fqid). Split the caps into a Fixes:
patch (series 2).

[08/14] drivers: bus/fslmc centralize device handling

Warning: MC version check relaxed

    if (bus_info->mc_rev <
        RTE_FSL_MC_REV(MC_VER_MAJOR, MC_VER_MINOR, 0))

accepts any newer major; main rejected major != MC_VER_MAJOR (new major means incompatible command ABI). Unknown SVR or failed mc_get_soc_version() now fails bus probe (main fell back to defaults). The check also runs in secondary now: the kept comment "In case of secondary processes, MC version check is no longer required" is wrong and the if/else below it is identical in both branches. Keep the exact-major check; say the rest in the log.

Info: bus_info->sp_protocol has no writer until 10; svr/pvr written
but never read; fw_version_get still issues MC commands for values bus_info already has; "extern struct rte_bus rte_fslmc_bus" moved out of private.h into dpaa2_hw_dprc.c; unrelated dqrr/eqcr size type changes in rxtx.c.

[09/14] drivers: net/dpaa2: move DPNI endpoint lookup to PMD

Warning: log does not say priv->ep_* was never set in main; needs the
Fixes:/Cc: stable in series 2.

[10/14] drivers: net/dpaa2 remove unused soft parser loader

Warning: ss_offset/ss_iova/ss_param_iova now unused; remove. SP
detection changed to a u16 magic 0xabcd at sp_ins[4], not in the log or dpaa2.rst. DPAA2_BUS_NOTICE added but unused.

[11/14] drivers: net/dpaa2 cache Rx queue config and share TC CGIDs

Error: cgid_in_use[] is MAX_TCS entries, xstats still loops

    for (j = 0; j < priv->max_cgs; j++) if (!priv->cgid_in_use[j])

with max_cgs up to 255 (dpaa2_ethdev.c:2138).
Fix: priv->max_cgs = RTE_MIN(attr.num_cgs, MAX_TCS).

Error: eventq_detach still passes dpaa2_ethq->options (no
DPNI_QUEUE_OPT_DEST unless napi), so the FQ stays on the DPCON; cfg dereferenced unchecked (dpaa2_ethdev.c:2966).
Fix: if (!cfg) return -EINVAL; set DEST_NONE and pass DPNI_QUEUE_OPT_DEST.

Warning: early err_quit (DPCON alloc/enable failure) decrements
cgid_in_use[tc] although cfg->cgid is still 0 from zmalloc; it takes another queue's reference and release then wraps the u8.
Fix: local cgid_taken flag, or cfg->cgid = DPAA2_INVALID_CGID after the alloc.

Info: taildrop moves from per queue to one threshold per TC
(nb_rx_desc * dist_queues, set by the first queue); not in the log.

[12/14] drivers: net/dpaa2 add dynamic Tx confirmation mode

Error: rx_err_vq never assigned
The rte_zmalloc() is gone and a slot is reserved, but nothing sets priv->rx_err_vq; drv_error_queue=1 dereferences NULL in dpaa2_queue_storage_alloc() and dev_start. Still so at 14.
Fix: priv->rx_err_vq = mc_q++ (eth_data, fqid) before the alloc.

Error: cloned single-segment mbuf leaks or crashes tx_conf

    if (unlikely(RTE_MBUF_CLONED(mbuf))) {
        DPAA2_MBUF_TO_CONTIG_FD(mbuf, fd, MAX_BPID);
        DPAA2_SET_FD_IVP(fd); ...
        rte_mbuf_refcnt_update(mbuf, -1);

refcnt 1 goes to 0 without rte_pktmbuf_free(): indirect and parent leak. refcnt > 1: other owner can free the parent during DMA. With drv_tx_conf=1 the FD is confirmed with FLC 0 and tx_conf derefs NULL. Log claims clones are confirmed in dynamic mode.
Fix: conf modes use dpaa2_mbuf_to_conf_contig_fd() and free in tx_conf; NO_CONF copies to hw_mp and frees the original.

Error: conf-mode S/G with SGT from dpaa2_tx_sg_pool leaks the chain
FLC = sg_mbuf, all SGEs IVP, and "sg_mbuf->next = cur_seg" was dropped, so tx_conf frees only the SGT buffer. Any chain over 7 segments with drv_tx_conf=1, or foreign/indirect head.
Fix: carry the packet head in FLC and free sg_mbuf separately.

Error: inline SGT buffer still gets a BPID in both FD and SGE[0], and
its refcnt is decremented twice (dpaa2_rxtx.c:720/722, :632/634). Set DPAA2_SET_FLE_IVP for cur_seg == sg_mbuf.

Error: no_conf_mbuf_to_sge() still rte_pktmbuf_init()+free_seg() the
indirect regardless of refcnt (dpaa2_rxtx.c:606).

Error: per-packet helper failure still returns short after freeing or
relinking segments; sg_mbuf leaks; the caller frees again. Free the packet, count a drop, continue.

Error (IEEE1588 builds, bisect): enable_tx_tstamp(&fd_arr[loop]) runs
before the FD is built and writes through a stale FD address; the IEEE1588 block in dpaa2_dev_tx() is duplicated. 14 replaces it; fold that rework here.

Warning: confirmations pending at stop/close are never drained (drain
is never true); their mbufs leak.

Warning: eqresp free rebuilds conf FDs via rte_dpaa2_bpid_info[256];
loopback FDs on tx_vq[0] have stash config in FLC, deref'd as an mbuf with drv_tx_conf=1.

Warning: drv_tx_conf/drv_tx_dyn_conf order dependent (any 0 resets to
NO_CONF, both 1 picks dyn silently). dy_conf[] written never read, struct sw_buf_free unused, "void *mq[nb_pkts]" VLA, tx_conf pulled once per packet.

Info: log does not mention the tx_deferred_start rejection or the
error queue allocation change.

[13/14] drivers: bus/fslmc provide shared DPRTC RTC services

Warning: priv->rtc_handle in shared dev_private points at a
dpaa2_dprtc_dev whose regs are the primary's DPMCP mapping. A secondary passes the -ENODEV guard and sends MC commands through an address not mapped that way, with the primary's token and its own mc_portal_lock. Return -ENOTSUP in secondary or open the DPRTC on the secondary's DPMCP.

Info: rte_dpaa2_alloc/free_dprtc_dev() exported but only the bus calls
them, via fslmc_vfio_get/put_rtc_handle() wrappers unrelated to VFIO; handle is void *; DPRTC never closed; "DPCI" comments copied. Keep them static, use struct dpaa2_dprtc_dev *.

[14/14] net/dpaa2: support runtime IEEE1588 timestamping

Error: Tx timestamp only latched by a later tx_burst
tx_timestamp is stored in dpaa2_dev_tx_conf(), called only at the start of tx_burst; read_tx_timestamp() just exchanges it with 0. examples/ptpclient and testpmd ieee1588fwd poll after one tx_burst and always time out.
Fix: record the sending queue at transmit; read_tx_timestamp drains that conf queue with a bounded retry.

Error: timesync_disable leaves tx_tm_en set; the next TMST frame
re-enables one-step from tx_burst. Clear tx_tm_en in disable.

Error: tx_burst still calls dpni_set_single_step_cfg() (MC lock, up to
1 s spin) and tx_tm_offset is plain read/written by all Tx lcores. Configure one-step on the control path only.

Error: S/G frames read the Rx timestamp from m->buf_addr after the SGT
buffer is freed (series 4).

Warning: Rx PTP flags now require RTE_ETH_RX_OFFLOAD_TIMESTAMP;
testpmd ieee1588fwd enables timesync without it and rejects every frame. rx_tm_en never cleared. Register the dynfield and set rx_tm_en in timesync_enable() too.

Warning: eventdev Rx paths still drop the timestamp. Per-packet WARN
and INFO in the Tx path, plus a per-burst "Multiple ptp formats" WARN. dpaa2.rst does not say PTP needs drv_tx_conf or drv_tx_dyn_conf. configure returns -1, not -rte_errno, on register failure.

Warning: commit log no longer describes the change: IEEE1588 guards
dropped, absolute confirmation no longer forced, Rx flags tied to the offload, confirmation forced for TMST, multi-seg PTP rejected.

Info: TMST frames with headroom < 96 take the no-conf path: no Tx
timestamp in DYNAMIC mode, FAEAD written into packet data in ABSOLUTE mode; "fd_faead->ctrl |=" should assign.

#220 lore raw

Re: [PATCH v3-S2 00/13] net/dpaa2: flow, meter and parser features

In reply to Prashant Gupta
Quoted 14 lines · On Tue, 15 Sep 2026 17:04:46 +0530 Prashant Gupta <[email protected]>…

This is the second of four series upstreaming the missing NXP dpaa2 driver changes. It does not depend on series 1 and can be applied independently. It adds the net/dpaa2 flow, metering and parser features:

- fix an integer overflow in the CCSR region mapping,
- set Tx confirmation on device init and support a larger burst size,
- support MPLS and PPPoE flow distribution, meter and policing, and the flow drop action, with a per-device default flow miss action,
- identify Rx mbuf hash information by FLC and add minimum key size support,
- restructure the parser processing, parse tunnel and fragmented packet types, remove the unused soft parser driver and rename the Rx queue flags.

Quoted 2 lines

Every commit builds cleanly (including the aarch64 DPAA cross build with -Werror) and the series is bisectable.

AI review with Opus found lots of issues that still need to be fixed.

Series: [PATCH v3-S2 00/13] net/dpaa2 flow, meter, parser rework

Patch 10 claims no functional change but rewrites the Rx path and introduces mbuf memory corruption on every received packet. Patches 5 and 7 have functional problems of their own. Not ready.

All 13 commits apply to main and build with -Dwerror=true (default config, RTE_LIBRTE_IEEE1588 off).

----------------------------------------------------------------------
Patch 01/13 net/dpaa2: fix integer overflow in CCSR region mapping

Warning
PAGE_SIZE and PAGE_MASK (dpaa2_recycle.c:32-35) have no users after this patch. Remove them.

Info (pre-existing, not introduced here)
lsx_ccsr_map_region() rounds len down with page_mask and does not add offset to the mapped length, so a region crossing a page boundary is only partially mapped. The mapping is never unmapped.

----------------------------------------------------------------------
Patch 03/13 net/dpaa2: support larger burst size

Warning
The non-LX2160A limit drops from DPAA2_BURST_MAX (65536) to 0xF7FF. The old value was broken anyway: max_burst_size was uint16_t, so 65536 truncated to 0. Say both in the commit message; the truncation is a stable fix on its own.

Warning
return (dpaa2_svr_family == SVR_LX2160A) ? 229375 : 0xF7FF; The header comment documents this as 0x37FFF. Use hex in both places, and name the 8.7 version like the existing DPNI_GET_MAC_SUPPORTED_IFS_VER_* defines.

Info
DPNI_BURST_LO/HI describe the MC command layout and belong in fsl_dpni_cmd.h rather than fsl_dpni.h.

----------------------------------------------------------------------
Patch 04/13 net/dpaa2: support MPLS and PPPoE flow distribution

Warning
mask = pattern->mask ? pattern->mask : &dpaa2_flow_item_mpls_mask; The driver default is { 0xff, 0xff, 0xff }, covering TC and the bottom-of-stack bit. rte_flow defines a NULL mask as the item default (label only). A spec with only the label set does not match single-label packets (S=1).

Warning
Every MPLS item extracts NH_FLD_MPLS_MPLSL_1. For
eth / mpls / mpls the second item overwrites the first label's key data instead of matching label 2. Reject a second MPLS item or map it to MPLSL_2 / MPLSL_N.

Info
Extra blank line added after the #endif of the mask block.

----------------------------------------------------------------------
Patch 05/13 net/dpaa2: support meter and policing

Error
The meter ops only maintain software lists. Nothing calls dpni_set_rx_tc_policing(), and dpaa2_flow.c has no RTE_FLOW_ACTION_TYPE_METER handling. Creating a meter has no effect on traffic, while capabilities, dpaa2.rst, dpaa2.ini and the release notes advertise metering and policing.

Error
dpni_set_rx_tc_policing_v1() is declared in fsl_dpni.h and defined nowhere. DPNI_POLICER_OPT_DO_NOT_RESET_COUNTERS and DPNI_POLICER_UNIT_BYTES_L2_WITHOUT_FCS are unused.

Warning
s_dpaa2_mtr_capa is file-scope and written under priv->meter_lock. The lock is per port, so two ports race on the shared struct. Fill the caller's capa directly.

Warning
static char s_err_msg[128] is shared across ports and threads and handed back through rte_mtr_error. Concurrent failures overwrite each other's message.

Warning
dpaa2_mtr_profile_add() and dpaa2_mtr_policy_add() accept a duplicate id; the new entry is appended and lookups return the first.

Warning
Profiles, policies and meters are never freed on dev_close. priv->profiles, priv->policies and priv->meters are referenced only in dpaa2_meter.c.

Warning
rte_zmalloc() for control-path bookkeeping. Use malloc/calloc.

Warning
The release note hunk adds "Tx queue based flow control and confirmation queue handling" and "software parser based packet dump", neither of which is in this patch; patch 12 removes the soft parser. Each patch should carry only its own note.

----------------------------------------------------------------------
Patch 07/13 net/dpaa2: set default flow miss action per device

Error
priv->default_flow = RTE_MIN(priv->fs_entries,

          priv->dist_queues) - 1;

fs_miss_flow_id is a queue id within the TC. fs_entries is the FS table size and has nothing to do with it.

The miss queue also moves from 0 to the last hardware queue of the TC. dev_info reports max_rx_queues = priv->nb_rx_queues, so an application that configures fewer queues never sets up or polls that queue and loses every unmatched frame. Queue 0 is always configured.

With fs_entries == 0 the value becomes 0xffff, which is DPNI_FS_MISS_DROP.

Warning
The commit message calls this the "lowest priority flow". The field is a queue id, not a priority.

----------------------------------------------------------------------
Patch 08/13 net/dpaa2: identify Rx mbuf hash information by FLC

Warning
rte_mbuf_sched_set(m, flow, tc, 0) together with RTE_MBUF_F_RX_FDIR. hash.sched is the Tx scheduler field; RX_FDIR tells applications to read hash.fdir from the same union. Use hash.fdir.hi with RTE_MBUF_F_RX_FDIR_ID, or implement RTE_FLOW_ACTION_TYPE_MARK.

Warning
The FS action sets DPNI_FS_OPT_SET_FLC | DPNI_FS_OPT_SET_STASH_CONTROL with data stashing on every SoC. dpaa2_dev_rx_queue_setup() skips FLC/stashing on SVR_LS2080A; the FS path must follow the same rule.

Info
The QUEUE action index is checked against MAX_RX_QUEUES and rx_vq[] != NULL, not against dev->data->nb_rx_queues, so an unconfigured hardware queue is accepted.

----------------------------------------------------------------------
Patch 09/13 net/dpaa2: add minimum key size support

Warning
Removes "Current MC only support fixed entry size(56)" and starts using 24-byte entries with no MC/DPNI version check. State the minimum firmware in the commit message and gate it with dpaa2_dev_cmp_dpni_ver(), or older MC rejects the table setup.

----------------------------------------------------------------------
Patch 10/13 net/dpaa2: restructure dpaa2 parser processing

Error
if (priv->psr_dynfield_offset >= 0)

          dpaa2_dev_rx_parse_offset(priv, bufs[num_rx], fd);

psr_dynfield_offset is never assigned anywhere in the driver. With zeroed dev_private the test is true for every packet, and dpaa2_dev_rx_parse_offset() writes the l3/l4/l5 offsets at (uint8_t *)mbuf + 0, i.e. into buf_addr. The RTE_ASSERT guarding it is compiled out in release builds. Affects dpaa2_dev_prefetch_rx_common(), dpaa2_dev_rx_common() and dump_err_pkts().

Error
dpaa2_timestamp_dynfield() is removed, but dpaa2_dev_rx_common() still calls it under #if defined(RTE_LIBRTE_IEEE1588). The build breaks with IEEE1588 enabled.

Error
Rx timestamp handling is removed from dpaa2_dev_rx_parse() and dpaa2_dev_rx_parse_new(). dpaa2_enable_ts[] is still set in dpaa2_dev_configure() but never read, so RTE_ETH_RX_OFFLOAD_TIMESTAMP silently stops working. The IEEE1588 priv->rx_timestamp update in dpaa2_dev_prefetch_rx_common() is also gone.

Error
Checksum flag handling is removed from dpaa2_dev_rx_parse() and now exists only in dpaa2_dev_rx_parse_slow(). On non-LX2160A SoCs the fast-path return (word3 test false) no longer reports RX_IP_CKSUM_* or RX_L4_CKSUM_*.

Error
The "if (!by_channel)" guard around dump_err_pkts() is removed from dpaa2_dev_prefetch_rx_common(). The removed comment explains that the channel/interrupt path owns the ethrx portal, and dpaa2_dev_rx_common() still keeps the guard. This reverts that fix.

Error
The commit message says no functional change is intended. Also changed:
- DPAA2_PKT_TYPE_IPV4_EXT 0x0001 -> 0x0040,
IPV6_EXT 0x0021 -> 0x0050
- VLAN_1/VLAN_2 0x0160/0x0260 -> 0x0100/0x0200
- new VLAN TCI reporting (RTE_MBUF_F_RX_VLAN)
- event and eqresp paths now handle SG frames
- IPv4/IPv6 EXT, SCTP and ICMP dropped from the LX2 fast switch
- parser result no longer printed for error-queue frames
- hash.sched.color now set from DPAA2_GET_FD_DROPP() on FS frames
Split into the header move plus separate functional patches, each with its own justification.

Warning
dpaa2_dev_rx_print_parser_result() loops i < MAX_RX_QUEUES and dereferences priv->rx_vq[i]->tc_index; entries past priv->nb_rx_queues are NULL. The function is unreachable today because DPAA2_RX_PRINT_PSR_RESULT_FLAG is never set, while dpaa2_dev_init() still sets dpaa2_print_parser_result from getenv() and nothing reads it. The parser debug print is broken either way.

Warning
Leftovers: rx_ts_offset, rx_ts_flag and L3/L4/L5_OFFSET_OF_MBUF_DYN are unused. sp_protocol is never set, so the fafe2/fafe3 GENEVE branch in dpaa2_dev_rx_parse_new() is dead. dpaa2_dev_rx_parse_new() does RTE_SET_USED(priv) and then uses priv.

----------------------------------------------------------------------
Patch 11/13 net/dpaa2: parse tunnel and fragmented packet types

Warning
The commit message says the new types are mapped "in the slow-path parser". They are added only to the LX2160A FRC switch in dpaa2_dev_rx_parse_new(); dpaa2_dev_rx_parse() for other SoCs is unchanged.

Warning
DPAA2_PKT_TYPE_IPV4_FRAG and IPV6_FRAG evaluate to 0x0001 and 0x0021, the values the driver reported as RTE_PTYPE_L3_IPV4_EXT and L3_IPV6_EXT before patch 10. Fragments were misreported as IP options. That is a bug fix for released code and should be a separate patch with Fixes: and Cc: [email protected].

----------------------------------------------------------------------
Patch 12/13 net/dpaa2: remove unused soft parser driver

Warning
dpaa2_soft_parser_loaded() is still defined in dpaa2_flow.c and declared in dpaa2_ethdev.h with no callers, and it still opens /dev/mem. Remove it together with dpaa2_sp_loaded.

Warning
The commit message is one sentence. Explain what users lose and why runtime loading is unsupported.

----------------------------------------------------------------------
Patch 13/13 net/dpaa2: rename Rx queue flags

Info
The commit message refers to "the Tx confirmation rework that follows", but this is the last patch in the series.

Info
The rename should come before patch 10, which adds DPAA2_RX_PRINT_PSR_RESULT_FLAG next to the old DPAAX_ name.

#221 lore raw

cover net/dpaa2: flow, meter and parser features

In reply to Prashant Gupta

This is the second of four series upstreaming the missing NXP dpaa2 driver changes. It does not depend on series 1 and can be applied independently. It adds the net/dpaa2 flow, metering and parser features:

- fix an integer overflow in the CCSR region mapping,
- set Tx confirmation on device init and support a larger burst size,
- support MPLS and PPPoE flow distribution, meter and policing, and the flow drop action, with a per-device default flow miss action,
- identify Rx mbuf hash information by FLC and add minimum key size support,
- restructure the parser processing, parse tunnel and fragmented packet types, remove the unused soft parser driver and rename the Rx queue flags.

Every commit builds cleanly (including the aarch64 DPAA cross build with -Werror) and the series is bisectable.

Gagandeep Singh (7):
net/dpaa2: set Tx confirmation on device init net/dpaa2: support larger burst size net/dpaa2: support MPLS and PPPoE flow distribution net/dpaa2: support meter and policing net/dpaa2: support flow drop action net/dpaa2: set default flow miss action per device net/dpaa2: identify Rx mbuf hash information by FLC

Hemant Agrawal (4):
net/dpaa2: fix integer overflow in CCSR region mapping net/dpaa2: add minimum key size support net/dpaa2: restructure dpaa2 parser processing net/dpaa2: parse tunnel and fragmented packet types

Jun Yang (2):
net/dpaa2: remove unused soft parser driver
net/dpaa2: rename Rx queue flags

 doc/guides/nics/dpaa2.rst               |    1 +
 doc/guides/nics/features/dpaa2.ini      |    3 +
 doc/guides/rel_notes/release_26_11.rst  |    4 +
 drivers/net/dpaa2/dpaa2_ethdev.c        |   84 +-
 drivers/net/dpaa2/dpaa2_ethdev.h        |  227 +++-
 drivers/net/dpaa2/dpaa2_flow.c          |  397 ++++--
 drivers/net/dpaa2/dpaa2_meter.c         |  637 ++++++++++
 drivers/net/dpaa2/dpaa2_parse_dump.h    |  374 ------
 drivers/net/dpaa2/dpaa2_parser_decode.h | 1542 +++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_pmd_logs.h      |   67 +
 drivers/net/dpaa2/dpaa2_recycle.c       |   40 +-
 drivers/net/dpaa2/dpaa2_rxtx.c          |  334 +++--
 drivers/net/dpaa2/dpaa2_sparser.c       |  137 --
 drivers/net/dpaa2/dpaa2_sparser.h       |  202 ---
 drivers/net/dpaa2/dpaa2_tm.c            |   17 +-
 drivers/net/dpaa2/mc/dpni.c             |   11 +-
 drivers/net/dpaa2/mc/fsl_dpni.h         |   11 +-
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h     |    6 +-
 drivers/net/dpaa2/meson.build           |    2 +-
 19 files changed, 2999 insertions(+), 1097 deletions(-)
 create mode 100644 drivers/net/dpaa2/dpaa2_meter.c
 delete mode 100644 drivers/net/dpaa2/dpaa2_parse_dump.h
 create mode 100644 drivers/net/dpaa2/dpaa2_parser_decode.h
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.c
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.h
Signature · 1 line
2.43.0
#222 lore raw

PATCH 1/13 net/dpaa2: fix integer overflow in CCSR region mapping

From: Hemant Agrawal <[email protected]>

In lsx_ccsr_map_region, PAGE_SIZE is defined as sysconf(_SC_PAGESIZE) which may be negative on error. The value was used directly in size_t comparisons and passed to mmap, causing an integer overflow (Coverity CID 49765682).

Use sysconf() explicitly with a signed long, check for errors, and compute map_len separately with unsigned arithmetic before passing to mmap.

Coverity issue: 49765682

Fixes f023d059769f ("net/dpaa2: support recycle loopback port")
---
 drivers/net/dpaa2/dpaa2_recycle.c | 39 ++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 13 deletions(-)
drivers/net/dpaa2/dpaa2_recycle.c +26 -13
index f78d12362e..ef7caa5f19 100644
@@ -30,11 +30,6 @@
 #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
 #define LSX_SERDES_REG_BASE		0x1ea0000
 #define LSX_LB_EN_BIT			0x10000000
@@ -176,6 +171,9 @@ static void *lsx_ccsr_map_region(uint64_t addr, size_t len)
 	void *tmp;
 	uint64_t start;
 	uint64_t offset;
+	uint64_t page_mask;
+	long page_size;
+	size_t map_len;
 
 	fd = open("/dev/mem", O_RDWR);
 	if (fd < 0) {
@@ -183,20 +181,35 @@ static void *lsx_ccsr_map_region(uint64_t addr, size_t len)
 		return NULL;
 	}
 
-	start = addr & PAGE_MASK;
+	page_size = sysconf(_SC_PAGESIZE);
+	if (page_size <= 0) {
+		close(fd);
+		return NULL;
+	}
+	page_mask = ~((uint64_t)page_size - 1);
+	start = addr & page_mask;
 	offset = addr - start;
-	len = len & PAGE_MASK;
-	if (len < (size_t)PAGE_SIZE)
-		len = PAGE_SIZE;
+	len = len & page_mask;
+	if (len == 0) {
+		close(fd);
+		return NULL;
+	}
 
-	tmp = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, start);
+	map_len = len;
+	if (map_len < (size_t)page_size)
+		map_len = (size_t)page_size;
+
+	tmp = mmap(NULL, map_len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, start);
 
 	close(fd);
 
-	if (tmp != MAP_FAILED)
-		return (uint8_t *)tmp + offset;
-	else
+	if (tmp == MAP_FAILED) {
+		DPAA2_PMD_ERR("mmap 0x%" PRIx64 "(size=0x%zx) failed",
+			addr, map_len);
 		return NULL;
+	}
+
+	return (uint8_t *)tmp + offset;
 }
 
 static const uint8_t ls_sd1_prot_idx_map[] = {
Signature · 1 line
2.43.0
#223 lore raw

PATCH 2/13 net/dpaa2: set Tx confirmation on device init

In reply to Prashant Gupta

From: Gagandeep Singh <[email protected]>

Move TX confirmation mode setting from TXQ setup to device initialization because TXQ0 is not always set up by the user.

---
 drivers/net/dpaa2/dpaa2_ethdev.c | 40 ++++++++++++--------------------
 1 file changed, 15 insertions(+), 25 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.c +15 -25
index f211357919..c95704d4ca 100644
@@ -1153,7 +1153,6 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	struct dpni_queue tx_conf_cfg;
 	struct dpni_queue tx_flow_cfg;
 	uint8_t options = 0, flow_id;
-	uint8_t ceetm_ch_idx;
 	uint16_t channel_id;
 	struct dpni_queue_id qid;
 	uint32_t tc_id;
@@ -1174,30 +1173,6 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	memset(&tx_conf_cfg, 0, sizeof(struct dpni_queue));
 	memset(&tx_flow_cfg, 0, sizeof(struct dpni_queue));
 
-	if (!tx_queue_id) {
-		for (ceetm_ch_idx = 0;
-			ceetm_ch_idx <= (priv->num_channels - 1);
-			ceetm_ch_idx++) {
-			/*Set tx-conf and error configuration*/
-			if (priv->flags & DPAA2_TX_CONF_ENABLE) {
-				ret = dpni_set_tx_confirmation_mode(dpni,
-						CMD_PRI_LOW, priv->token,
-						ceetm_ch_idx,
-						DPNI_CONF_AFFINE);
-			} else {
-				ret = dpni_set_tx_confirmation_mode(dpni,
-						CMD_PRI_LOW, priv->token,
-						ceetm_ch_idx,
-						DPNI_CONF_DISABLE);
-			}
-			if (ret) {
-				DPAA2_PMD_ERR("Error(%d) in tx conf setting",
-					ret);
-				return ret;
-			}
-		}
-	}
-
 	tc_id = tx_queue_id % priv->num_tx_tc;
 	channel_id = (uint8_t)(tx_queue_id / priv->num_tx_tc) % priv->num_channels;
 	flow_id = 0;
@@ -3624,6 +3599,21 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 		goto init_err;
 	}
 
+	for (i = 0; i < priv->num_channels; i++) {
+		/*Set tx-conf and error configuration*/
+		if (priv->flags & DPAA2_TX_CONF_ENABLE) {
+			ret = dpni_set_tx_confirmation_mode(dpni_dev,
+				CMD_PRI_LOW, priv->token, i, DPNI_CONF_AFFINE);
+		} else {
+			ret = dpni_set_tx_confirmation_mode(dpni_dev,
+				CMD_PRI_LOW, priv->token, i, DPNI_CONF_DISABLE);
+		}
+		if (ret) {
+			DPAA2_PMD_ERR("Error(%d) in tx conf setting", ret);
+			goto init_err;
+		}
+	}
+
 	/* Allocate memory for storing MAC addresses.
 	 * Table of mac_filter_entries size is allocated so that RTE ether lib
 	 * can add MAC entries when rte_eth_dev_mac_addr_add is called.
Signature · 1 line
2.43.0
#224 lore raw

PATCH 3/13 net/dpaa2: support larger burst size

In reply to Prashant Gupta

From: Gagandeep Singh <[email protected]>

Make burst size checks and MC command fields SoC-aware, enabling bursts larger than 64K on LX2160A with dpni version 8.7+.

The max_burst_size field in dpni_tx_shaping_cfg is widened to uint32_t and the MC command struct is updated to split the value across two 16-bit fields using the new DPNI_BURST_LO/HI macros.

---
 drivers/net/dpaa2/dpaa2_ethdev.h    |  2 ++
 drivers/net/dpaa2/dpaa2_tm.c        | 17 ++++++++++++-----
 drivers/net/dpaa2/mc/dpni.c         | 11 +++++++++--
 drivers/net/dpaa2/mc/fsl_dpni.h     |  5 +++--
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h |  6 +++++-
 5 files changed, 31 insertions(+), 10 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.h +2 -0
index 149954fb6b..bec1096850 100644
@@ -462,6 +462,8 @@ struct dpaa2_dev_priv {
 
 #define DPNI_GET_MAC_SUPPORTED_IFS_VER_MAJOR	8
 #define DPNI_GET_MAC_SUPPORTED_IFS_VER_MINOR	6
+#define DPNI_TX_BURST_LARGE_VER_MAJOR		8
+#define DPNI_TX_BURST_LARGE_VER_MINOR		7
 
 static inline int dpaa2_dev_cmp_dpni_ver(struct dpaa2_dev_priv *priv,
 					 uint16_t ver_major, uint16_t ver_minor)
drivers/net/dpaa2/dpaa2_tm.c +12 -5
index 36e815c356..0275c2a010 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2020-2024 NXP
+ * Copyright 2020-2026 NXP
  */
 
 #include <rte_ethdev.h>
@@ -10,14 +10,21 @@
 #include "dpaa2_pmd_logs.h"
 #include <dpaa2_hw_dpio.h>
 
-#define DPAA2_BURST_MAX	(64 * 1024)
-
 #define DPAA2_SHAPER_MIN_RATE 0
 #define DPAA2_SHAPER_MAX_RATE 107374182400ull
 #define DPAA2_WEIGHT_MAX 24701
 #define DPAA2_PKT_ADJUST_LEN_MIN 0
 #define DPAA2_PKT_ADJUST_LEN_MAX 0x7ff
 
+static inline uint32_t dpaa2_get_burst_max(struct dpaa2_dev_priv *priv)
+{
+	if (dpaa2_dev_cmp_dpni_ver(priv, DPNI_TX_BURST_LARGE_VER_MAJOR,
+				   DPNI_TX_BURST_LARGE_VER_MINOR) >= 0)
+		return (dpaa2_svr_family == SVR_LX2160A) ? 0x37FFF : 0xF7FF;
+
+	return 0xF7FF;
+}
+
 int
 dpaa2_tm_init(struct rte_eth_dev *dev)
 {
@@ -283,7 +290,7 @@ dpaa2_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id,
 				RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE,
 				NULL, "committed rate is out of range\n");
 
-	if (params->committed.size > DPAA2_BURST_MAX)
+	if (params->committed.size > dpaa2_get_burst_max(priv))
 		return -rte_tm_error_set(error, EINVAL,
 				RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE,
 				NULL, "committed size is out of range\n");
@@ -293,7 +300,7 @@ dpaa2_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id,
 				RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE,
 				NULL, "Peak rate is out of range\n");
 
-	if (params->peak.size > DPAA2_BURST_MAX)
+	if (params->peak.size > dpaa2_get_burst_max(priv))
 		return -rte_tm_error_set(error, EINVAL,
 				RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE,
 				NULL, "Peak size is out of range\n");
drivers/net/dpaa2/mc/dpni.c +9 -2
index d0a9fefd31..17275b7195 100644
@@ -1106,6 +1106,7 @@ int dpni_set_tx_shaping(struct fsl_mc_io *mc_io,
 {
 	struct dpni_cmd_set_tx_shaping *cmd_params;
 	struct mc_command cmd = { 0 };
+	uint32_t tx_cr_burst, tx_er_burst;
 	int coupled, lni_shaper;
 	uint8_t channel_id;
 	uint16_t oal;
@@ -1115,10 +1116,16 @@ int dpni_set_tx_shaping(struct fsl_mc_io *mc_io,
 					  cmd_flags,
 					  token);
 	cmd_params = (struct dpni_cmd_set_tx_shaping *)cmd.params;
+	tx_cr_burst = tx_cr_shaper->max_burst_size;
+	tx_er_burst = tx_er_shaper->max_burst_size;
 	cmd_params->tx_cr_max_burst_size =
-		cpu_to_le16(tx_cr_shaper->max_burst_size);
+		cpu_to_le16(DPNI_BURST_LO(tx_cr_burst));
 	cmd_params->tx_er_max_burst_size =
-		cpu_to_le16(tx_er_shaper->max_burst_size);
+		cpu_to_le16(DPNI_BURST_LO(tx_er_burst));
+	cmd_params->tx_cr_max_burst_size_hi =
+		cpu_to_le16(DPNI_BURST_HI(tx_cr_burst));
+	cmd_params->tx_er_max_burst_size_hi =
+		cpu_to_le16(DPNI_BURST_HI(tx_er_burst));
 	cmd_params->tx_cr_rate_limit =
 		cpu_to_le32(tx_cr_shaper->rate_limit);
 	cmd_params->tx_er_rate_limit =
drivers/net/dpaa2/mc/fsl_dpni.h +3 -2
index 42d633eaf8..7bcbad6859 100644
@@ -833,11 +833,12 @@ int dpni_get_link_state(struct fsl_mc_io *mc_io,
 /**
  * struct dpni_tx_shaping - Structure representing DPNI tx shaping configuration
  * @rate_limit:		Rate in Mbits/s
- * @max_burst_size:	Burst size in bytes (up to 64KB)
+ * @max_burst_size:	Burst size in bytes. Limits depend on the SoC (0x37FFF
+ *		for LX2160A, 0xF7FF for all others)
  */
 struct dpni_tx_shaping_cfg {
 	uint32_t rate_limit;
-	uint16_t max_burst_size;
+	uint32_t max_burst_size;
 };
 
 /**
drivers/net/dpaa2/mc/fsl_dpni_cmd.h +5 -1
index bb4939031b..cc7bf42a4e 100644
@@ -391,10 +391,14 @@ struct dpni_rsp_get_link_state {
 #define DPNI_LNI_SHAPER_SHIFT	1
 #define DPNI_LNI_SHAPER_SIZE	1
 
+#define DPNI_BURST_LO(burst)	((burst) & GENMASK(15, 0))
+#define DPNI_BURST_HI(burst)	((burst) >> 16)
+
 struct dpni_cmd_set_tx_shaping {
 	uint16_t tx_cr_max_burst_size;
 	uint16_t tx_er_max_burst_size;
-	uint32_t pad;
+	uint16_t tx_cr_max_burst_size_hi;
+	uint16_t tx_er_max_burst_size_hi;
 	uint32_t tx_cr_rate_limit;
 	uint32_t tx_er_rate_limit;
 	/* from LSB: coupled:1, lni_shaper: 1*/
Signature · 1 line
2.43.0
#225 lore raw

PATCH 4/13 net/dpaa2: support MPLS and PPPoE flow distribution

In reply to Prashant Gupta

From: Gagandeep Singh <[email protected]>

Add rte_flow pattern support for MPLS and PPPoE items in the dpaa2 PMD flow engine.

For a pattern with no spec/mask, the frame is identified by its Frame Attribute Flag (FAF_MPLS_FRAM / FAF_PPPOE_PPP_FRAM) for both the QoS and flow steering tables. When a spec is present, the MPLS label (NH_FLD_MPLS_MPLSL_1) or the PPPoE session id (NH_FLD_PPPOE_SID) is added as a header extract rule for both tables.

---
 doc/guides/nics/features/dpaa2.ini |   2 +
 drivers/net/dpaa2/dpaa2_flow.c     | 202 ++++++++++++++++++++++++++++-
 2 files changed, 203 insertions(+), 1 deletion(-)
doc/guides/nics/features/dpaa2.ini +2 -0
index 4788afef8d..49faebcd06 100644
@@ -43,6 +43,8 @@ gtp                  = Y
 icmp                 = Y
 ipv4                 = Y
 ipv6                 = Y
+mpls                 = Y
+pppoes               = Y
 raw                  = Y
 sctp                 = Y
 tcp                  = Y
drivers/net/dpaa2/dpaa2_flow.c +201 -1

238 lines not on this page · raw message

Signature · 1 line
2.43.0
#226 lore raw

PATCH 5/13 net/dpaa2: support meter and policing

In reply to Prashant Gupta

From: Gagandeep Singh <[email protected]>

Add support for the traffic metering and policing (rte_mtr) API to the dpaa2 PMD. The implementation registers the rte_mtr operations through the ".mtr_ops_get" dev_ops hook and maintains software bookkeeping of meter profiles, policies and meter objects under a per-device spinlock.

Supported algorithms are trTCM RFC 2698 and trTCM RFC 4115 in both byte and packet modes. Meter policies support drop and pass-through actions on the red color.

---
 doc/guides/nics/dpaa2.rst              |   1 +
 doc/guides/nics/features/dpaa2.ini     |   1 +
 doc/guides/rel_notes/release_26_11.rst |   4 +
 drivers/net/dpaa2/dpaa2_ethdev.c       |   3 +
 drivers/net/dpaa2/dpaa2_ethdev.h       |  30 ++
 drivers/net/dpaa2/dpaa2_meter.c        | 637 +++++++++++++++++++++++++
 drivers/net/dpaa2/mc/fsl_dpni.h        |   6 +-
 drivers/net/dpaa2/meson.build          |   1 +
 8 files changed, 680 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/dpaa2/dpaa2_meter.c
doc/guides/nics/dpaa2.rst +1 -0
index ae8b32af2c..faee3a72a2 100644
@@ -407,6 +407,7 @@ Features of the DPAA2 PMD are:
 - Link flow control
 - Scattered and gather for TX and RX
 - Rx queue interrupts
+- Traffic metering and policing
 - :ref:`dpaa2_dptmapi`
 
 
doc/guides/nics/features/dpaa2.ini +1 -0
index 49faebcd06..4936769191 100644
@@ -19,6 +19,7 @@ RSS hash             = Y
 RSS reta update      = Y
 VLAN filter          = Y
 Flow control         = Y
+Rate limitation      = Y
 Traffic manager      = Y
 VLAN offload         = Y
 L3 checksum offload  = Y
doc/guides/rel_notes/release_26_11.rst +4 -0
index c8cc86295d..794fa301c1 100644
@@ -55,6 +55,10 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Updated NXP DPAA2 net driver.**
+
+  * Added support for flow classification on more protocol fields.
+  * Added support for traffic metering and policing.
 
 Removed Items
 -------------
drivers/net/dpaa2/dpaa2_ethdev.c +3 -0
index c95704d4ca..8290bbfe91 100644
@@ -1666,6 +1666,7 @@ dpaa2_dev_close(struct rte_eth_dev *dev)
 
 	dpaa2_tm_deinit(dev);
 	dpaa2_flow_clean(dev);
+	dpaa2_meter_clean(dev);
 	/* Clean the device first */
 	ret = dpni_reset(dpni, CMD_PRI_LOW, priv->token);
 	if (ret) {
@@ -3320,6 +3321,7 @@ static struct eth_dev_ops dpaa2_ethdev_ops = {
 	.rxq_info_get	      = dpaa2_rxq_info_get,
 	.txq_info_get	      = dpaa2_txq_info_get,
 	.tm_ops_get	      = dpaa2_tm_ops_get,
+	.mtr_ops_get	      = dpaa2_mtr_ops_get,
 #if defined(RTE_LIBRTE_IEEE1588)
 	.timesync_enable      = dpaa2_timesync_enable,
 	.timesync_disable     = dpaa2_timesync_disable,
@@ -3543,6 +3545,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	priv->num_channels = attr.num_channels;
 	priv->channel_inuse = 0;
 	rte_spinlock_init(&priv->lpbk_qp_lock);
+	rte_spinlock_init(&priv->meter_lock);
 
 	/* only if the custom CG is enabled */
 	if (attr.options & DPNI_OPT_CUSTOM_CG)
drivers/net/dpaa2/dpaa2_ethdev.h +30 -0
index bec1096850..706b956e71 100644
@@ -385,6 +385,30 @@ struct extract_s {
 	uint8_t *tc_extract_param[MAX_TCS];
 };
 
+struct dpaa2_dev_meter_profile {
+	LIST_ENTRY(dpaa2_dev_meter_profile) next;
+	uint32_t profile_id;
+	uint64_t cir;
+	uint64_t cbs;
+	uint64_t pir;
+	uint64_t pbs;
+	enum dpni_policer_mode mode;
+	enum dpni_policer_unit policer_unit;
+};
+
+struct dpaa2_dev_meter_policy {
+	LIST_ENTRY(dpaa2_dev_meter_policy) next;
+	uint32_t policy_id;
+	bool red_drop;
+};
+
+struct dpaa2_dev_meter {
+	LIST_ENTRY(dpaa2_dev_meter) next;
+	uint32_t meter_id;
+	uint32_t profile_id;
+	uint32_t policy_id;
+};
+
 struct dpaa2_dev_priv {
 	void *hw;
 	int32_t hw_id;
@@ -411,6 +435,7 @@ struct dpaa2_dev_priv {
 	uint8_t en_loose_ordered;
 	uint8_t max_cgs;
 	uint8_t cgid_in_use[MAX_RX_QUEUES];
+	rte_spinlock_t meter_lock;
 
 	/* Current hash distribution size per RX TC, written by
 	 * dpaa2_setup_flow_dist_size() and read by reta_query / reta_update.
@@ -456,6 +481,9 @@ struct dpaa2_dev_priv {
 
 	struct dpaa2_dev_flow *curr;
 	LIST_HEAD(, dpaa2_dev_flow) flows;
+	LIST_HEAD(, dpaa2_dev_meter_profile) profiles;
+	LIST_HEAD(, dpaa2_dev_meter_policy) policies;
+	LIST_HEAD(, dpaa2_dev_meter) meters;
 	LIST_HEAD(nodes, dpaa2_tm_node) nodes;
 	LIST_HEAD(shaper_profiles, dpaa2_tm_shaper_profile) shaper_profiles;
 };
@@ -533,6 +561,7 @@ uint16_t dpaa2_dev_tx_multi_txq_ordered(void **queue,
 
 void dpaa2_dev_free_eqresp_buf(uint16_t eqresp_ci, struct dpaa2_queue *dpaa2_q);
 void dpaa2_flow_clean(struct rte_eth_dev *dev);
+void dpaa2_meter_clean(struct rte_eth_dev *dev);
 uint16_t dpaa2_dev_tx_conf(void *queue)  __rte_unused;
 
 int dpaa2_timesync_enable(struct rte_eth_dev *dev);
@@ -550,6 +579,7 @@ int dpaa2_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 
 int dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev);
 int dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev);
+int dpaa2_mtr_ops_get(struct rte_eth_dev *dev, void *ops);
 int dpaa2_soft_parser_loaded(void);
 
 void
drivers/net/dpaa2/dpaa2_meter.c new file +637 -0

637 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpni.h +3 -3
index 7bcbad6859..cfea7004fc 100644
@@ -1124,11 +1124,12 @@ enum dpni_policer_mode {
 
 /**
  * enum dpni_policer_unit - DPNI policer units
- * @DPNI_POLICER_UNIT_BYTES: bytes units
+ * @DPNI_POLICER_UNIT_BYTES_L3: bytes units (for each frame takes into account
+ * FD length - L3 offset)
  * @DPNI_POLICER_UNIT_FRAMES: frames units
  */
 enum dpni_policer_unit {
-	DPNI_POLICER_UNIT_BYTES = 0,
+	DPNI_POLICER_UNIT_BYTES_L3 = 0,
 	DPNI_POLICER_UNIT_FRAMES
 };
 
@@ -1170,7 +1171,6 @@ struct dpni_rx_tc_policing_cfg {
 	uint32_t ebs;
 };
 
-
 int dpni_set_rx_tc_policing(struct fsl_mc_io *mc_io,
 			    uint32_t cmd_flags,
 			    uint16_t token,
drivers/net/dpaa2/meson.build +1 -0
index 4094ea02ba..808dad8112 100644
@@ -11,6 +11,7 @@ sources = files(
         'base/dpaa2_hw_dpni.c',
         'base/dpaa2_tlu_hash.c',
         'dpaa2_tm.c',
+        'dpaa2_meter.c',
         'dpaa2_mux.c',
         'dpaa2_ethdev.c',
         'dpaa2_flow.c',
Signature · 1 line
2.43.0
#227 lore raw

PATCH 6/13 net/dpaa2: support flow drop action

In reply to Prashant Gupta

From: Gagandeep Singh <[email protected]>

Add support for the RTE_FLOW_ACTION_TYPE_DROP action in the dpaa2 flow engine. A flow rule with a drop action is programmed into the flow steering (FS) table with the DPNI_FS_OPT_DISCARD option so that matching frames are discarded by hardware.

The drop action is added to the supported action list, accepted during action verification, configured in the FS action path, handled in the generic flow-set action loop, and cleaned up in the flow destroy path.

---
 drivers/net/dpaa2/dpaa2_flow.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/dpaa2/dpaa2_flow.c +7 -1
index 63bbce0ab7..98975d031a 100644
@@ -97,7 +97,8 @@ enum rte_flow_action_type dpaa2_supported_action_type[] = {
 	RTE_FLOW_ACTION_TYPE_QUEUE,
 	RTE_FLOW_ACTION_TYPE_PORT_ID,
 	RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
-	RTE_FLOW_ACTION_TYPE_RSS
+	RTE_FLOW_ACTION_TYPE_RSS,
+	RTE_FLOW_ACTION_TYPE_DROP
 };
 
 #ifndef __cplusplus
@@ -4420,6 +4421,7 @@ dpaa2_flow_verify_action(struct dpaa2_dev_priv *priv,
 			break;
 		case RTE_FLOW_ACTION_TYPE_PF:
 			/* Skip this action, have to add for vxlan */
+		case RTE_FLOW_ACTION_TYPE_DROP:
 			break;
 		case RTE_FLOW_ACTION_TYPE_END:
 			end_of_list = 1;
@@ -4467,6 +4469,8 @@ dpaa2_configure_flow_fs_action(struct dpaa2_dev_priv *priv,
 		flow->fs_action_cfg.redirect_obj_token =
 			dest_priv->token;
 		flow->fs_action_cfg.flow_id = dest_q->flow_id;
+	} else if (flow->action_type == RTE_FLOW_ACTION_TYPE_DROP) {
+		flow->fs_action_cfg.options = DPNI_FS_OPT_DISCARD;
 	}
 
 	return 0;
@@ -4949,6 +4953,7 @@ dpaa2_generic_flow_set(struct dpaa2_dev_flow *flow,
 		case RTE_FLOW_ACTION_TYPE_QUEUE:
 		case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
 		case RTE_FLOW_ACTION_TYPE_PORT_ID:
+		case RTE_FLOW_ACTION_TYPE_DROP:
 			ret = dpaa2_configure_flow_fs_action(priv, flow,
 							     &actions[j]);
 			if (ret)
@@ -5350,6 +5355,7 @@ dpaa2_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *_flow,
 	case RTE_FLOW_ACTION_TYPE_QUEUE:
 	case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
 	case RTE_FLOW_ACTION_TYPE_PORT_ID:
+	case RTE_FLOW_ACTION_TYPE_DROP:
 		if (priv->num_rx_tc > 1) {
 			/* Remove entry from QoS table first */
 			ret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW,
Signature · 1 line
2.43.0
#228 lore raw

PATCH 7/13 net/dpaa2: set default flow miss action per device

In reply to Prashant Gupta

From: Gagandeep Singh <[email protected]>

The flow steering miss flow id was a file-scope global configured only via the DPAA2_FLOW_CONTROL_MISS_FLOW environment variable and defaulted to 0. Replace it with a per-device default_flow computed at probe time as the lowest priority flow of the FS table, so that unmatched frames are directed there without depending on an environment variable.

---
 drivers/net/dpaa2/dpaa2_ethdev.c |  1 +
 drivers/net/dpaa2/dpaa2_ethdev.h |  2 ++
 drivers/net/dpaa2/dpaa2_flow.c   | 14 +-------------
 3 files changed, 4 insertions(+), 13 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.c +1 -0
index 8290bbfe91..37af41bb6d 100644
@@ -3544,6 +3544,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;
+	priv->default_flow = 0;
 	rte_spinlock_init(&priv->lpbk_qp_lock);
 	rte_spinlock_init(&priv->meter_lock);
 
drivers/net/dpaa2/dpaa2_ethdev.h +2 -0
index 706b956e71..6291b3d042 100644
@@ -436,6 +436,8 @@ struct dpaa2_dev_priv {
 	uint8_t max_cgs;
 	uint8_t cgid_in_use[MAX_RX_QUEUES];
 	rte_spinlock_t meter_lock;
+	/* Lowest priority FS flow id to receive flow steering miss frames. */
+	uint16_t default_flow;
 
 	/* Current hash distribution size per RX TC, written by
 	 * dpaa2_setup_flow_dist_size() and read by reta_query / reta_update.
drivers/net/dpaa2/dpaa2_flow.c +1 -13
index 98975d031a..c9d38eae5e 100644
@@ -24,7 +24,6 @@
 #include <dpaa2_pmd_logs.h>
 
 static char *dpaa2_flow_control_log;
-static uint16_t dpaa2_flow_miss_flow_id; /* Default miss flow id is 0. */
 static int dpaa2_sp_loaded = -1;
 
 enum dpaa2_flow_entry_size {
@@ -4589,7 +4588,7 @@ dpaa2_configure_fs_rss_table(struct dpaa2_dev_priv *priv,
 		return 0;
 
 	tc_cfg.enable = true;
-	tc_cfg.fs_miss_flow_id = dpaa2_flow_miss_flow_id;
+	tc_cfg.fs_miss_flow_id = priv->default_flow;
 	ret = dpni_set_rx_fs_dist(dpni, CMD_PRI_LOW,
 			priv->token, &tc_cfg);
 	if (ret < 0) {
@@ -5228,17 +5227,6 @@ dpaa2_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 	dpaa2_flow_control_log =
 		getenv("DPAA2_FLOW_CONTROL_LOG");
 
-	if (getenv("DPAA2_FLOW_CONTROL_MISS_FLOW")) {
-		dpaa2_flow_miss_flow_id =
-			(uint16_t)atoi(getenv("DPAA2_FLOW_CONTROL_MISS_FLOW"));
-		if (dpaa2_flow_miss_flow_id >= priv->dist_queues) {
-			DPAA2_PMD_ERR("Missed flow ID %d >= dist size(%d)",
-				      dpaa2_flow_miss_flow_id,
-				      priv->dist_queues);
-			return NULL;
-		}
-	}
-
 	flow = rte_zmalloc(NULL, sizeof(struct dpaa2_dev_flow),
 			   RTE_CACHE_LINE_SIZE);
 	if (!flow) {
Signature · 1 line
2.43.0
#229 lore raw

PATCH 8/13 net/dpaa2: identify Rx mbuf hash information by FLC

In reply to Prashant Gupta

From: Gagandeep Singh <[email protected]>

For default RSS distribution, mbuf is marked with RTE_MBUF_F_RX_RSS_HASH and the hash value from the high word of FLC.

Configure the flow steering action with FLC enabled to align the stashing setting with the RSS configuration. The TC ID and flow ID are packed into the FLC for mbuf Rx scheduling. An Rx mbuf received from the FS table is marked with RTE_MBUF_F_RX_FDIR along with the TC and flow ID decoded from the FLC low word.

---
 drivers/net/dpaa2/dpaa2_ethdev.h | 12 +++++++++
 drivers/net/dpaa2/dpaa2_flow.c   | 44 ++++++++++++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_rxtx.c   | 18 +++++++++++--
 3 files changed, 72 insertions(+), 2 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.h +12 -0
index 6291b3d042..f821d2145d 100644
@@ -282,6 +282,18 @@ enum dpaa2_ecpri_fafe_type {
 /* ECPRI shares SP context with VXLAN*/
 #define DPAA2_ECPRI_MSG_OFFSET DPAA2_VXLAN_VNI_OFFSET
 
+#define DPAA2_FS_FLC_FS_MARK_OFFSET \
+	(DPAA2_FLC_DATA_STASHING + DPAA2_FLC_STASHING_MAX_BIT_SIZE)
+
+#define DPAA2_FS_FLC_TC_OFFSET \
+	(DPAA2_FS_FLC_FS_MARK_OFFSET + DPAA2_FLC_STASHING_MAX_BIT_SIZE)
+
+#define DPAA2_FS_FLC_TC_BIT_SIZE (sizeof(uint8_t) * 8)
+#define DPAA2_FS_FLC_TC_MASK ((1 << DPAA2_FS_FLC_TC_BIT_SIZE) - 1)
+
+#define DPAA2_FS_FLC_FLOW_OFFSET \
+	(DPAA2_FS_FLC_TC_OFFSET + DPAA2_FS_FLC_TC_BIT_SIZE)
+
 #define DPAA2_ECPRI_MAX_EXTRACT_NB 8
 
 struct ipv4_sd_addr_extract_rule {
drivers/net/dpaa2/dpaa2_flow.c +44 -0

58 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_rxtx.c +16 -2
index c31d6556ad..ee33be9c98 100644
@@ -58,6 +58,7 @@ dpaa2_dev_rx_parse_new(struct rte_mbuf *m, const struct qbman_fd *fd,
 	uint16_t frc = DPAA2_GET_FD_FRC_PARSE_SUM(fd);
 	struct dpaa2_annot_hdr *annotation =
 			(struct dpaa2_annot_hdr *)hw_annot_addr;
+	uint32_t flc_lo, tc, flow;
 
 	if (unlikely(dpaa2_print_parser_result))
 		dpaa2_print_parse_result(annotation);
@@ -118,8 +119,21 @@ dpaa2_dev_rx_parse_new(struct rte_mbuf *m, const struct qbman_fd *fd,
 	default:
 		m->packet_type = dpaa2_dev_rx_parse_slow(m, annotation);
 	}
-	m->hash.rss = fd->simple.flc_hi;
-	m->ol_flags |= RTE_MBUF_F_RX_RSS_HASH;
+	flc_lo = fd->simple.flc_lo;
+	if (flc_lo & (1 << DPAA2_FS_FLC_FS_MARK_OFFSET)) {
+		m->hash.fdir.hi = flc_lo;
+		m->ol_flags |= RTE_MBUF_F_RX_FDIR_ID;
+		tc = (flc_lo >> DPAA2_FS_FLC_TC_OFFSET) &
+			DPAA2_FS_FLC_TC_MASK;
+		flow = flc_lo >> DPAA2_FS_FLC_FLOW_OFFSET;
+		DPAA2_PMD_DP_DEBUG("FS frame received from TC[%d]->flow%d",
+			tc, flow);
+	} else {
+		m->hash.rss = fd->simple.flc_hi;
+		m->ol_flags |= RTE_MBUF_F_RX_RSS_HASH;
+		DPAA2_PMD_DP_DEBUG("Hash frame received with RSS(%08x)",
+			m->hash.rss);
+	}
 
 	if (dpaa2_enable_ts[m->port]) {
 		*dpaa2_timestamp_dynfield(m) = annotation->word2;
Signature · 1 line
2.43.0
#230 lore raw

PATCH 9/13 net/dpaa2: add minimum key size support

In reply to Prashant Gupta

From: Hemant Agrawal <[email protected]>

The default size for a QoS key is 24 bytes. If the key size is smaller than the maximum, use the default (minimum) key size instead of always returning the maximum size (56 bytes). This allows smaller flow tables to be used when the extracted key fits within the default size.

---
 drivers/net/dpaa2/dpaa2_ethdev.h |  2 ++
 drivers/net/dpaa2/dpaa2_flow.c   | 20 +++++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.h +2 -0
index f821d2145d..dacbcfed30 100644
@@ -506,6 +506,8 @@ struct dpaa2_dev_priv {
 #define DPNI_GET_MAC_SUPPORTED_IFS_VER_MINOR	6
 #define DPNI_TX_BURST_LARGE_VER_MAJOR		8
 #define DPNI_TX_BURST_LARGE_VER_MINOR		7
+#define DPNI_MIN_ENTRY_SIZE_VER_MAJOR		8
+#define DPNI_MIN_ENTRY_SIZE_VER_MINOR		8
 
 static inline int dpaa2_dev_cmp_dpni_ver(struct dpaa2_dev_priv *priv,
 					 uint16_t ver_major, uint16_t ver_minor)
drivers/net/dpaa2/dpaa2_flow.c +13 -7
index 20835e016f..97b93d8d75 100644
@@ -26,8 +26,11 @@
 static char *dpaa2_flow_control_log;
 static int dpaa2_sp_loaded = -1;
 
+/* Default size of a key */
+#define DPNI_DEFAULT_KEY_SIZE 24
+
 enum dpaa2_flow_entry_size {
-	DPAA2_FLOW_ENTRY_MIN_SIZE = (DPNI_MAX_KEY_SIZE / 2),
+	DPAA2_FLOW_ENTRY_MIN_SIZE = DPNI_DEFAULT_KEY_SIZE,
 	DPAA2_FLOW_ENTRY_MAX_SIZE = DPNI_MAX_KEY_SIZE
 };
 
@@ -4520,7 +4523,7 @@ dpaa2_configure_flow_fs_action(struct dpaa2_dev_priv *priv,
 }
 
 static inline uint16_t
-dpaa2_flow_entry_size(uint16_t key_max_size)
+dpaa2_flow_entry_size(struct dpaa2_dev_priv *priv, uint16_t key_max_size)
 {
 	if (key_max_size > DPAA2_FLOW_ENTRY_MAX_SIZE) {
 		DPAA2_PMD_ERR("Key size(%d) > max(%d)",
@@ -4533,7 +4536,10 @@ dpaa2_flow_entry_size(uint16_t key_max_size)
 	if (key_max_size > DPAA2_FLOW_ENTRY_MIN_SIZE)
 		return DPAA2_FLOW_ENTRY_MAX_SIZE;
 
-	/* Current MC only support fixed entry size(56)*/
+	if (dpaa2_dev_cmp_dpni_ver(priv, DPNI_MIN_ENTRY_SIZE_VER_MAJOR,
+				   DPNI_MIN_ENTRY_SIZE_VER_MINOR) >= 0)
+		return DPAA2_FLOW_ENTRY_MIN_SIZE;
+
 	return DPAA2_FLOW_ENTRY_MAX_SIZE;
 }
 
@@ -4596,7 +4602,7 @@ dpaa2_configure_fs_rss_table(struct dpaa2_dev_priv *priv,
 	}
 
 	key_max_size = tc_extract->key_profile.key_max_size;
-	entry_size = dpaa2_flow_entry_size(key_max_size);
+	entry_size = dpaa2_flow_entry_size(priv, key_max_size);
 
 	dpaa2_flow_fs_extracts_log(priv, tc_id);
 	ret = dpkg_prepare_key_cfg(&tc_extract->dpkg,
@@ -4687,7 +4693,7 @@ dpaa2_configure_qos_table(struct dpaa2_dev_priv *priv,
 	}
 
 	key_max_size = qos_extract->key_profile.key_max_size;
-	entry_size = dpaa2_flow_entry_size(key_max_size);
+	entry_size = dpaa2_flow_entry_size(priv, key_max_size);
 
 	dpaa2_flow_qos_extracts_log(priv);
 
@@ -4983,11 +4989,11 @@ dpaa2_generic_flow_set(struct dpaa2_dev_flow *flow,
 
 	qos_key_extract = &priv->extract.qos_key_extract;
 	key_size = qos_key_extract->key_profile.key_max_size;
-	flow->qos_rule.key_size = dpaa2_flow_entry_size(key_size);
+	flow->qos_rule.key_size = dpaa2_flow_entry_size(priv, key_size);
 
 	tc_key_extract = &priv->extract.tc_key_extract[flow->tc_id];
 	key_size = tc_key_extract->key_profile.key_max_size;
-	flow->fs_rule.key_size = dpaa2_flow_entry_size(key_size);
+	flow->fs_rule.key_size = dpaa2_flow_entry_size(priv, key_size);
 
 	/* Let's parse action on matching traffic */
 	end_of_list = 0;
Signature · 1 line
2.43.0
#231 lore raw

PATCH 10/13 net/dpaa2: restructure dpaa2 parser processing

In reply to Prashant Gupta

From: Hemant Agrawal <[email protected]>

Move the parse-result decoding into a dedicated header so that the hardware parser fields are described in one place and shared between the flow code and the Rx path. No functional change is intended.

---
 drivers/net/dpaa2/dpaa2_ethdev.c        |    2 +
 drivers/net/dpaa2/dpaa2_ethdev.h        |  181 ++-
 drivers/net/dpaa2/dpaa2_parse_dump.h    |  374 ------
 drivers/net/dpaa2/dpaa2_parser_decode.h | 1542 +++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_pmd_logs.h      |   67 +
 drivers/net/dpaa2/dpaa2_rxtx.c          |  332 +++--
 6 files changed, 1925 insertions(+), 573 deletions(-)
 delete mode 100644 drivers/net/dpaa2/dpaa2_parse_dump.h
 create mode 100644 drivers/net/dpaa2/dpaa2_parser_decode.h
drivers/net/dpaa2/dpaa2_ethdev.c +2 -0
index 37af41bb6d..3a7e26643e 100644
@@ -3451,6 +3451,8 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 
 	PMD_INIT_FUNC_TRACE();
 
+	priv->psr_dynfield_offset = -1;
+
 	dpni_dev = rte_malloc(NULL, sizeof(struct fsl_mc_io), 0);
 	if (!dpni_dev) {
 		DPAA2_PMD_ERR("Memory allocation failed for dpni device");
drivers/net/dpaa2/dpaa2_ethdev.h +122 -59

248 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_parse_dump.h deleted +0 -374

374 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_parser_decode.h new file +1542 -0

1,542 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_pmd_logs.h +67 -0

77 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_rxtx.c +192 -140

511 lines not on this page · raw message

Signature · 1 line
2.43.0
#232 lore raw

PATCH 11/13 net/dpaa2: parse tunnel and fragmented packet types

In reply to Prashant Gupta

From: Hemant Agrawal <[email protected]>

Extend the Rx parser to identify additional packet types decoded from the hardware parser summary: IPv4/IPv6 fragments, IPsec ESP, and GTP-U / GTP-C tunnels. The corresponding DPAA2_PKT_TYPE_* values are added and mapped to the matching RTE_PTYPE_* flags in the slow-path parser.

---
 drivers/net/dpaa2/dpaa2_ethdev.h | 16 ++++++++++++++++
 drivers/net/dpaa2/dpaa2_rxtx.c   | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
drivers/net/dpaa2/dpaa2_ethdev.h +16 -0
index 0b231d79b0..b5b14fed36 100644
@@ -162,6 +162,10 @@
 #define DPAA2_PKT_TYPE_IPV6_EXT_GRE_IPV6_UDP_TCP \
 	(DPAA2_PKT_TYPE_IPV6_EXT | DPAA2_PSR_SUMMARY_GRE_IPV6_UDP_TCP)
 
+#define DPAA2_PKT_TYPE_IPV4_FRAG \
+	(DPAA2_PSR_SUMMARY_IP_FRAG | DPAA2_PKT_TYPE_IPV4)
+#define DPAA2_PKT_TYPE_IPV6_FRAG \
+	(DPAA2_PSR_SUMMARY_IP_FRAG | DPAA2_PKT_TYPE_IPV6)
 #define DPAA2_PKT_TYPE_IPV4_TCP \
 	(DPAA2_PSR_SUMMARY_TCP | DPAA2_PKT_TYPE_IPV4)
 #define DPAA2_PKT_TYPE_IPV6_TCP \
@@ -178,6 +182,18 @@
 	(DPAA2_PSR_SUMMARY_ICMP | DPAA2_PKT_TYPE_IPV4)
 #define DPAA2_PKT_TYPE_IPV6_ICMP \
 	(DPAA2_PSR_SUMMARY_ICMP | DPAA2_PKT_TYPE_IPV6)
+#define DPAA2_PKT_TYPE_IPV4_ESP \
+	(DPAA2_PSR_SUMMARY_IPSEC_ESP | DPAA2_PKT_TYPE_IPV4)
+#define DPAA2_PKT_TYPE_IPV6_ESP \
+	(DPAA2_PSR_SUMMARY_IPSEC_ESP | DPAA2_PKT_TYPE_IPV6)
+#define DPAA2_PKT_TYPE_IPV4_GTPU \
+	(DPAA2_PSR_SUMMARY_GTPU | DPAA2_PKT_TYPE_IPV4)
+#define DPAA2_PKT_TYPE_IPV6_GTPU \
+	(DPAA2_PSR_SUMMARY_GTPU | DPAA2_PKT_TYPE_IPV6)
+#define DPAA2_PKT_TYPE_IPV4_GTPC \
+	(DPAA2_PSR_SUMMARY_GTPC | DPAA2_PKT_TYPE_IPV4)
+#define DPAA2_PKT_TYPE_IPV6_GTPC \
+	(DPAA2_PSR_SUMMARY_GTPC | DPAA2_PKT_TYPE_IPV6)
 
 #define DPAA2_PKT_TYPE_VLAN_1	0x0100
 #define DPAA2_PKT_TYPE_VLAN_2	0x0200
drivers/net/dpaa2/dpaa2_rxtx.c +32 -0
index 6cb0c7fa31..13d4e3447c 100644
@@ -154,6 +154,38 @@ dpaa2_dev_rx_parse_new(struct dpaa2_dev_priv *priv,
 		m->packet_type = RTE_PTYPE_L2_ETHER |
 			RTE_PTYPE_L3_IPV6;
 		break;
+	case DPAA2_PKT_TYPE_IPV4_FRAG:
+		m->packet_type = RTE_PTYPE_L2_ETHER |
+			RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_FRAG;
+		break;
+	case DPAA2_PKT_TYPE_IPV6_FRAG:
+		m->packet_type = RTE_PTYPE_L2_ETHER |
+			RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_FRAG;
+		break;
+	case DPAA2_PKT_TYPE_IPV4_ESP:
+		m->packet_type = RTE_PTYPE_L2_ETHER |
+			RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_ESP;
+		break;
+	case DPAA2_PKT_TYPE_IPV6_ESP:
+		m->packet_type = RTE_PTYPE_L2_ETHER |
+			RTE_PTYPE_L3_IPV6 | RTE_PTYPE_TUNNEL_ESP;
+		break;
+	case DPAA2_PKT_TYPE_IPV4_GTPU:
+		m->packet_type = RTE_PTYPE_L2_ETHER |
+			RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_GTPU;
+		break;
+	case DPAA2_PKT_TYPE_IPV6_GTPU:
+		m->packet_type = RTE_PTYPE_L2_ETHER |
+			RTE_PTYPE_L3_IPV6 | RTE_PTYPE_TUNNEL_GTPU;
+		break;
+	case DPAA2_PKT_TYPE_IPV4_GTPC:
+		m->packet_type = RTE_PTYPE_L2_ETHER |
+			RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_GTPC;
+		break;
+	case DPAA2_PKT_TYPE_IPV6_GTPC:
+		m->packet_type = RTE_PTYPE_L2_ETHER |
+			RTE_PTYPE_L3_IPV6 | RTE_PTYPE_TUNNEL_GTPC;
+		break;
 	case DPAA2_PKT_TYPE_ETHER:
 		m->packet_type = RTE_PTYPE_L2_ETHER;
 		break;
Signature · 1 line
2.43.0
#233 lore raw

PATCH 12/13 net/dpaa2: remove unused soft parser driver

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Softparser only supports to be loaded before Linux starts.

---
 drivers/net/dpaa2/dpaa2_ethdev.c  |  28 -----
 drivers/net/dpaa2/dpaa2_ethdev.h  |   1 -
 drivers/net/dpaa2/dpaa2_flow.c    | 109 +---------------
 drivers/net/dpaa2/dpaa2_recycle.c |   1 -
 drivers/net/dpaa2/dpaa2_sparser.c | 137 --------------------
 drivers/net/dpaa2/dpaa2_sparser.h | 202 ------------------------------
 drivers/net/dpaa2/meson.build     |   1 -
 7 files changed, 1 insertion(+), 478 deletions(-)
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.c
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.h
drivers/net/dpaa2/dpaa2_ethdev.c +0 -28
index 3a7e26643e..e2ef03f33d 100644
@@ -29,7 +29,6 @@
 #include <mc/fsl_dpmng.h>
 #include <mc/fsl_dpcon.h>
 #include "dpaa2_ethdev.h"
-#include "dpaa2_sparser.h"
 #include <fsl_qbman_debug.h>
 
 #define DRIVER_LOOPBACK_MODE "drv_loopback"
@@ -3721,33 +3720,6 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	}
 	eth_dev->data->mtu = RTE_ETHER_MTU;
 
-	/*TODO To enable soft parser support DPAA2 driver needs to integrate
-	 * with external entity to receive byte code for software sequence
-	 * and same will be offload to the H/W using MC interface.
-	 * Currently it is assumed that DPAA2 driver has byte code by some
-	 * mean and same if offloaded to H/W.
-	 */
-	if (getenv("DPAA2_ENABLE_SOFT_PARSER")) {
-		WRIOP_SS_INITIALIZER(priv);
-		ret = dpaa2_eth_load_wriop_soft_parser(priv, DPNI_SS_INGRESS);
-		if (ret < 0) {
-			DPAA2_PMD_ERR(" Error(%d) in loading softparser",
-				      ret);
-			goto init_err;
-		}
-
-		ret = dpaa2_eth_enable_wriop_soft_parser(priv,
-							 DPNI_SS_INGRESS);
-		if (ret < 0) {
-			DPAA2_PMD_ERR(" Error(%d) in enabling softparser",
-				      ret);
-			goto init_err;
-		}
-	}
-
-	ret = dpaa2_soft_parser_loaded();
-	if (ret > 0)
-		DPAA2_PMD_INFO("soft parser is loaded");
 	DPAA2_PMD_INFO("%s: netdev created, connected to %s",
 		eth_dev->data->name, dpaa2_dev->ep_name);
 
drivers/net/dpaa2/dpaa2_ethdev.h +0 -1
index b5b14fed36..743711bb6d 100644
@@ -675,7 +675,6 @@ int dpaa2_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 int dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev);
 int dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev);
 int dpaa2_mtr_ops_get(struct rte_eth_dev *dev, void *ops);
-int dpaa2_soft_parser_loaded(void);
 
 void
 dpaa2_dev_mac_setup_stats(struct rte_eth_dev *dev);
drivers/net/dpaa2/dpaa2_flow.c +1 -108

143 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_recycle.c +0 -1
index ef7caa5f19..bb389cd180 100644
@@ -23,7 +23,6 @@
 #include <dpaa2_hw_dpio.h>
 #include <mc/fsl_dpmng.h>
 #include "dpaa2_ethdev.h"
-#include "dpaa2_sparser.h"
 #include <fsl_qbman_debug.h>
 
 #include <rte_io.h>
drivers/net/dpaa2/dpaa2_sparser.c deleted +0 -137

137 lines not on this page · raw message

drivers/net/dpaa2/dpaa2_sparser.h deleted +0 -202

202 lines not on this page · raw message

drivers/net/dpaa2/meson.build +0 -1
index 808dad8112..4f774f7c82 100644
@@ -17,7 +17,6 @@ sources = files(
         'dpaa2_flow.c',
         'dpaa2_recycle.c',
         'dpaa2_rxtx.c',
-        'dpaa2_sparser.c',
         'dpaa2_ptp.c',
         'mc/dprtc.c',
         'mc/dpkg.c',
Signature · 1 line
2.43.0
#234 lore raw

PATCH 13/13 net/dpaa2: rename Rx queue flags

In reply to Prashant Gupta

From: Jun Yang <[email protected]>

Rename the Rx-side device flags to a consistent DPAA2_RX_*_FLAG naming:
DPAAX_RX_ERROR_QUEUE_FLAG becomes DPAA2_RX_ERROR_QUEUE_FLAG and DPAA2_DATA_STASHING_OFF becomes DPAA2_RX_DATA_STASHING_OFF_FLAG.

This is a mechanical rename with no functional change; it prepares the flag namespace for the Tx confirmation rework that follows.

---
 drivers/net/dpaa2/dpaa2_ethdev.c | 10 +++++-----
 drivers/net/dpaa2/dpaa2_ethdev.h |  5 +++--
 drivers/net/dpaa2/dpaa2_rxtx.c   |  4 ++--
 3 files changed, 10 insertions(+), 9 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.c +5 -5
index e2ef03f33d..ab74064162 100644
@@ -550,7 +550,7 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev)
 			goto fail;
 	}
 
-	if (priv->flags & DPAAX_RX_ERROR_QUEUE_FLAG) {
+	if (priv->flags & DPAA2_RX_ERROR_QUEUE_FLAG) {
 		priv->rx_err_vq = rte_zmalloc("dpni_rx_err",
 			sizeof(struct dpaa2_queue), 0);
 		if (!priv->rx_err_vq) {
@@ -1041,7 +1041,7 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
 		options |= DPNI_QUEUE_OPT_FLC;
 		cfg.flc.stash_control = true;
 		dpaa2_flc_stashing_clear_all(&cfg.flc.value);
-		if (priv->flags & DPAA2_DATA_STASHING_OFF) {
+		if (priv->flags & DPAA2_RX_DATA_STASHING_OFF_FLAG) {
 			dpaa2_flc_stashing_set(DPAA2_FLC_DATA_STASHING, 0,
 				&cfg.flc.value);
 			dpaa2_q->data_stashing_off = 1;
@@ -1517,7 +1517,7 @@ dpaa2_dev_start(struct rte_eth_dev *dev)
 		dpaa2_q->fqid = qid.fqid;
 	}
 
-	if (priv->flags & DPAAX_RX_ERROR_QUEUE_FLAG) {
+	if (priv->flags & DPAA2_RX_ERROR_QUEUE_FLAG) {
 		ret = dpni_get_queue(dpni, CMD_PRI_LOW, priv->token,
 				     DPNI_QUEUE_RX_ERR, 0, 0, &cfg, &qid);
 		if (ret) {
@@ -3478,7 +3478,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 
 	if (dpaa2_get_devargs(dev->devargs, DRIVER_NO_DATA_STASHING) ||
 	    getenv("DPAA2_DATA_STASHING_OFF")) {
-		priv->flags |= DPAA2_DATA_STASHING_OFF;
+		priv->flags |= DPAA2_RX_DATA_STASHING_OFF_FLAG;
 		DPAA2_PMD_INFO("Data stashing disabled");
 	}
 
@@ -3584,7 +3584,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	}
 
 	if (dpaa2_get_devargs(dev->devargs, DRIVER_ERROR_QUEUE)) {
-		priv->flags |= DPAAX_RX_ERROR_QUEUE_FLAG;
+		priv->flags |= DPAA2_RX_ERROR_QUEUE_FLAG;
 		DPAA2_PMD_INFO("Enable error queue");
 	}
 
drivers/net/dpaa2/dpaa2_ethdev.h +3 -2
index 743711bb6d..b28737fa4e 100644
@@ -100,9 +100,10 @@
 #define DPAA2_TX_DYNAMIC_CONF_ENABLE	RTE_BIT32(9)
 
 /* Disable data stashing (prefetch of packet data into CPU cache) */
-#define DPAA2_DATA_STASHING_OFF		RTE_BIT32(10)
+#define DPAA2_RX_DATA_STASHING_OFF_FLAG		RTE_BIT32(10)
+
+#define DPAA2_RX_ERROR_QUEUE_FLAG	RTE_BIT32(11)
 
-#define DPAAX_RX_ERROR_QUEUE_FLAG	RTE_BIT32(11)
 #define DPAA2_RX_PRINT_PSR_RESULT_FLAG RTE_BIT32(12)
 
 /* DPDMUX index for DPMAC */
drivers/net/dpaa2/dpaa2_rxtx.c +2 -2
index 13d4e3447c..05ca2067b9 100644
@@ -870,7 +870,7 @@ dpaa2_dev_prefetch_rx_common(void *queue, struct rte_mbuf **bufs,
 
 	q_storage = dpaa2_q->q_storage[rte_lcore_id()];
 
-	if (!by_channel && unlikely(priv->flags & DPAAX_RX_ERROR_QUEUE_FLAG))
+	if (!by_channel && unlikely(priv->flags & DPAA2_RX_ERROR_QUEUE_FLAG))
 		dump_err_pkts(priv->rx_err_vq);
 
 	if (unlikely(!DPAA2_PER_LCORE_ETHRX_DPIO)) {
@@ -1142,7 +1142,7 @@ dpaa2_dev_rx_common(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts,
 	struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data;
 	struct dpaa2_dev_priv *priv = eth_data->dev_private;
 
-	if (!by_channel && unlikely(priv->flags & DPAAX_RX_ERROR_QUEUE_FLAG))
+	if (!by_channel && unlikely(priv->flags & DPAA2_RX_ERROR_QUEUE_FLAG))
 		dump_err_pkts(priv->rx_err_vq);
 
 	if (by_channel) {
Signature · 1 line
2.43.0
#235 lore raw

Re: [PATCH v4-S2 00/13] net/dpaa2: flow, meter and parser features

In reply to Prashant Gupta
Quoted 53 lines · On Tue, 22 Sep 2026 15:25:15 +0530 Prashant Gupta <[email protected]>…

This is the second of four series upstreaming the missing NXP dpaa2 driver changes. It does not depend on series 1 and can be applied independently. It adds the net/dpaa2 flow, metering and parser features:

- fix an integer overflow in the CCSR region mapping,
- set Tx confirmation on device init and support a larger burst size,
- support MPLS and PPPoE flow distribution, meter and policing, and the flow drop action, with a per-device default flow miss action,
- identify Rx mbuf hash information by FLC and add minimum key size support,
- restructure the parser processing, parse tunnel and fragmented packet types, remove the unused soft parser driver and rename the Rx queue flags.

Every commit builds cleanly (including the aarch64 DPAA cross build with -Werror) and the series is bisectable.

Gagandeep Singh (7):
net/dpaa2: set Tx confirmation on device init net/dpaa2: support larger burst size net/dpaa2: support MPLS and PPPoE flow distribution net/dpaa2: support meter and policing net/dpaa2: support flow drop action net/dpaa2: set default flow miss action per device net/dpaa2: identify Rx mbuf hash information by FLC

Hemant Agrawal (4):
net/dpaa2: fix integer overflow in CCSR region mapping net/dpaa2: add minimum key size support net/dpaa2: restructure dpaa2 parser processing net/dpaa2: parse tunnel and fragmented packet types

Jun Yang (2):
net/dpaa2: remove unused soft parser driver
net/dpaa2: rename Rx queue flags

 doc/guides/nics/dpaa2.rst               |    1 +
 doc/guides/nics/features/dpaa2.ini      |    3 +
 doc/guides/rel_notes/release_26_11.rst  |    4 +
 drivers/net/dpaa2/dpaa2_ethdev.c        |   84 +-
 drivers/net/dpaa2/dpaa2_ethdev.h        |  227 +++-
 drivers/net/dpaa2/dpaa2_flow.c          |  397 ++++--
 drivers/net/dpaa2/dpaa2_meter.c         |  637 ++++++++++
 drivers/net/dpaa2/dpaa2_parse_dump.h    |  374 ------
 drivers/net/dpaa2/dpaa2_parser_decode.h | 1542 +++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_pmd_logs.h      |   67 +
 drivers/net/dpaa2/dpaa2_recycle.c       |   40 +-
 drivers/net/dpaa2/dpaa2_rxtx.c          |  334 +++--
 drivers/net/dpaa2/dpaa2_sparser.c       |  137 --
 drivers/net/dpaa2/dpaa2_sparser.h       |  202 ---
 drivers/net/dpaa2/dpaa2_tm.c            |   17 +-
 drivers/net/dpaa2/mc/dpni.c             |   11 +-
 drivers/net/dpaa2/mc/fsl_dpni.h         |   11 +-
Quoted 9 lines
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h     |    6 +-
 drivers/net/dpaa2/meson.build           |    2 +-
 19 files changed, 2999 insertions(+), 1097 deletions(-)
 create mode 100644 drivers/net/dpaa2/dpaa2_meter.c
 delete mode 100644 drivers/net/dpaa2/dpaa2_parse_dump.h
 create mode 100644 drivers/net/dpaa2/dpaa2_parser_decode.h
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.c
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.h

Lots of AI feedback on this.
Marking this as changes requested.
AI can be wrong, if so just respond on list.

[PATCH v4-S2 00/13] net/dpaa2: flow, meter and parser updates

Applied to main (6bbb7b3). Per-commit build with -Dwerror=true passes for all 13 patches (x86, gcc 13, dpaa2 drivers only).

Series-level:
Patch 10 claims "no functional change" but drops Rx timestamping, breaks the parser dump, reorders checksum flag handling, and adds VLAN TCI extraction, GENEVE ptype, a parser-offset dynfield and rte_mbuf_sched_set() on Rx. Split it into a pure move and separate functional patches.

Patch 12 removes user-visible rte_flow support (VXLAN, eCPRI items) without saying so.

Patch 1/13 net/dpaa2: fix integer overflow in CCSR region mapping

Warning: the new "len & page_mask == 0 -> return NULL" check is a regression. All four callers pass 4096 or 6656 bytes. On a 64K page kernel, len & page_mask is 0 and the mapping now fails, where the old code bumped len up to PAGE_SIZE. The existing round-down is also wrong. It ignores offset and truncates len. Map RTE_ALIGN_CEIL(offset + len, page_size) and drop the len == 0 path.

Patch 4/13 net/dpaa2: support MPLS and PPPoE flow distribution

Warning: the MPLS extract passes size 3 (sizeof(label_tc_s)) for NH_FLD_MPLS_MPLSL_1 with DPKG_FULL_FIELD. The driver key profile must match the width firmware extracts for that field. If MC extracts the 4-byte LSE, every key field placed after it is off by one byte. Confirm against the MC field size, or use an offset/size extract.

Patch 5/13 net/dpaa2: support meter and policing

Error: wrong rate units. rte_mtr cir/pir/eir are bytes/s in byte mode and packets/s in packet mode. DPNI takes Kbps or packets/s. profile->cir / 1000 yields kilobytes/s, which is off by 8x. In packet mode it divides a packet rate by 1000. cbs/ebs are also truncated from uint64_t to uint32_t without a check.

Error: meter_create returns a positive value on HW failure. dpni_set_rx_tc_policing() returns a negative errno, and -rte_mtr_error_set(error, ret, ...) negates it. It also sets rte_errno negative. Pass -ret.

Error: meter_profile_update and meter_policy_update only change the software list. Hardware is never reprogrammed, but success is returned.

Warning: mtr_id is used directly as the Rx TC, (uint8_t)mtr_id, with no check against priv->num_rx_tc. mtr_id 256 aliases TC 0. Validate the id, and document that a meter is per-TC, not attachable via an rte_flow METER action.

Warning: capabilities advertise color_aware_trtcm_* but there is no input-color handling.

Warning: profile_add and policy_add drop meter_lock between the duplicate-ID check and the insert, so the lock does not prevent duplicates.

Warning: meter_destroy ignores the dpni_set_rx_tc_policing() return.

Warning: features/dpaa2.ini "Rate limitation" is per-queue Tx rate limiting (rte_eth_set_queue_rate_limit), not rte_mtr. Remove it.

Info: the release note line "flow classification on more protocol fields" belongs with patch 4.

Patch 7/13 net/dpaa2: set default flow miss action per device

Warning: the commit message says default_flow is "computed at probe time as the lowest priority flow of the FS table". The code sets it to 0 and never changes it, so the only behavior change is removal of the env override. Fix the message or implement it.

Info: DPAA2_FLOW_CONTROL_MISS_FLOW is removed. Add a release note.

Patch 8/13 net/dpaa2: identify Rx mbuf hash information by FLC

Warning: RTE_MBUF_F_RX_FDIR_ID is set without RTE_MBUF_F_RX_FDIR, contrary to the commit message. Applications test RX_FDIR first. The driver's own dump helper (patch 10, dpaa2_dev_rx_print_parser_result) also tests RX_FDIR, so that branch is dead.

Warning: hash.fdir.hi carries the raw FLC low word, including stash bits and the mark bit. It is not a usable filter ID. User-visible IDs belong to RTE_FLOW_ACTION_TYPE_MARK.

Patch 10/13 net/dpaa2: restructure dpaa2 parser processing

Error: Rx timestamping is broken. The dpaa2_enable_ts[] write of annotation->word2 into the timestamp dynfield, and the dpaa2_timestamp_rx_dynflag set, are removed from both parse paths and not re-added. After the series, dpaa2_enable_ts[] is set in dpaa2_eth_dev_configure() for RTE_ETH_RX_OFFLOAD_TIMESTAMP but never read, and dpaa2_dev_rx() reads a dynfield nothing writes.

Error: dpaa2_dev_rx_mbuf_sched_set() writes m->hash.fdir.hi and then calls rte_mbuf_sched_set(). hash.sched overlays hash.fdir. traffic_class and color land in bytes 4-5, so fdir.hi is corrupted while RX_FDIR_ID is still flagged. hash.sched is a Tx/rte_sched field, not an Rx report. Pick one.

Warning: dpaa2_dev_rx_parse() now takes the parse_slow return before the L3/L4 checksum flags are set. Previously they were set first. parse_slow sets the checksum flags itself, so confirm the two paths agree and state it, or restore the order.

Warning: the parser dump is dead. The DPAA2_PRINT_RX_PARSER_RESULT env still sets the global dpaa2_print_parser_result, but the new helper tests DPAA2_RX_PRINT_PSR_RESULT_FLAG in priv->flags, which nothing sets. Remove the orphaned global and set the flag, preferably from a devarg.

Warning: priv->psr_dynfield_offset is initialized to -1 and never registered, so dpaa2_dev_rx_annot_prefetch(), dpaa2_dev_rx_parse_offset() and struct dpaa2_dyn_rx_protocol_pos are dead code. priv->sp_protocol is never assigned (and after patch 12 cannot be), so the GENEVE/inner IPv4 ptype block in rx_parse_new is dead as well. Drop them or add the code that enables them.

Warning: IPV4/6_EXT, SCTP and ICMP fast-path cases are removed from rx_parse_new and now go through dpaa2_dev_rx_parse_frc(). This is a functional change and must be described.

Patch 11/13 net/dpaa2: parse tunnel and fragmented packet types

Warning: dpaa2_supported_ptypes_get() is not updated. RTE_PTYPE_L4_FRAG, TUNNEL_ESP, TUNNEL_GTPU and TUNNEL_GTPC are reported in mbufs but not advertised.

Info: GTP runs over UDP. The GTPU/GTPC cases omit RTE_PTYPE_L4_UDP.

Info: the commit message says the new types are mapped "in the slow-path parser". They are in the rx_parse_new fast switch.

Patch 12/13 net/dpaa2: remove unused soft parser driver

Warning: this is not removal of unused code. dpaa2_dev_verify_patterns() no longer accepts RTE_FLOW_ITEM_TYPE_VXLAN or ECPRI, which were only permitted when the soft parser was loaded. features/dpaa2.ini still lists vxlan and ecpri as Y, and dpaa2_configure_flow_vxlan/_ecpri plus their switch cases remain as unreachable code. Remove the ini entries and the dead handlers, drop the DPAA2_ENABLE_SOFT_PARSER env var, and add a release note.

Info: the commit message ("only supports to be loaded before Linux starts") does not explain the change. Say that the SP must be loaded by firmware at boot, so runtime loading from the PMD never worked.

Patch 13/13 net/dpaa2: rename Rx queue flags

Info: the commit message says the rename "prepares the flag namespace for the Tx confirmation rework that follows". Nothing follows in this series. Drop the sentence.

#236 lore raw

cover net/dpaa2: flow, meter and parser features

In reply to Prashant Gupta

This is the second of four series upstreaming the missing NXP dpaa2 driver changes. It does not depend on series 1 and can be applied independently. It adds the net/dpaa2 flow, metering and parser features:

- fix an integer overflow in the CCSR region mapping,
- set Tx confirmation on device init and support a larger burst size,
- support MPLS and PPPoE flow distribution, meter and policing, and the flow drop action, with a per-device default flow miss action,
- identify Rx mbuf hash information by FLC and add minimum key size support,
- restructure the parser processing, parse tunnel and fragmented packet types, remove the unused soft parser driver and rename the Rx queue flags.

Note that patch 12 removes the soft parser driver and, with it, the rte_flow VXLAN and eCPRI pattern items that were only accepted while an SP image was believed to be loaded. Both items are dropped from the dpaa2 feature matrix and a release note is added.

Every commit builds cleanly (including the aarch64 DPAA cross build with -Werror) and the series is bisectable.

Changes in v5:
- patch 10: dropped the inaccurate "no functional change is intended" claim; the commit message now enumerates the functional changes (checksum flag ordering, IPV4/6_EXT/SCTP/ICMP fast-path removal) and the known limitations that need follow-up work,
- patch 11: added RTE_PTYPE_L4_FRAG, RTE_PTYPE_TUNNEL_ESP, RTE_PTYPE_TUNNEL_GTPU and RTE_PTYPE_TUNNEL_GTPC to dpaa2_supported_ptypes_get() so the new types are advertised, and OR-ed RTE_PTYPE_L4_UDP into the GTP-U/GTP-C cases since GTP runs over UDP; corrected the commit message to name dpaa2_dev_rx_parse_new(),
- patch 12: removed the now-unreachable dpaa2_configure_flow_vxlan() and dpaa2_configure_flow_ecpri() handlers, their switch cases, mask descriptors and the VXLAN_HF_VNI helper; dropped the vxlan and ecpri entries from the dpaa2 feature matrix and added a release note; the commit message now explains that the SP must be loaded by firmware at boot, so runtime loading from the PMD never worked,
- patch 13: dropped the reference to a Tx confirmation rework that is not part of this series,
- patch 5: replaced the stack-allocated err_msg[] buffers whose address was stored in rte_mtr_error with string literals (-Wdangling-pointer).

Gagandeep Singh (7):
net/dpaa2: set Tx confirmation on device init net/dpaa2: support larger burst size net/dpaa2: support MPLS and PPPoE flow distribution net/dpaa2: support meter and policing net/dpaa2: support flow drop action net/dpaa2: set default flow miss action per device net/dpaa2: identify Rx mbuf hash information by FLC

Hemant Agrawal (4):
net/dpaa2: fix integer overflow in CCSR region mapping net/dpaa2: add minimum key size support net/dpaa2: restructure dpaa2 parser processing net/dpaa2: parse tunnel and fragmented packet types

Jun Yang (2):
net/dpaa2: remove unused soft parser driver
net/dpaa2: rename Rx queue flags

 doc/guides/nics/dpaa2.rst               |    1 +
 doc/guides/nics/features/dpaa2.ini      |    5 +-
 doc/guides/rel_notes/release_26_11.rst  |   15 +
 drivers/net/dpaa2/dpaa2_ethdev.c        |   86 +-
 drivers/net/dpaa2/dpaa2_ethdev.h        |  213 +++-
 drivers/net/dpaa2/dpaa2_flow.c          |  620 +++------
 drivers/net/dpaa2/dpaa2_meter.c         |  579 +++++++++
 drivers/net/dpaa2/dpaa2_parse_dump.h    |  374 ------
 drivers/net/dpaa2/dpaa2_parser_decode.h | 1539 +++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_pmd_logs.h      |   67 +
 drivers/net/dpaa2/dpaa2_recycle.c       |   28 +-
 drivers/net/dpaa2/dpaa2_rxtx.c          |  338 +++--
 drivers/net/dpaa2/dpaa2_sparser.c       |  137 --
 drivers/net/dpaa2/dpaa2_sparser.h       |  202 ---
 drivers/net/dpaa2/dpaa2_tm.c            |   16 +-
 drivers/net/dpaa2/mc/dpni.c             |   11 +-
 drivers/net/dpaa2/mc/fsl_dpni.h         |   31 +-
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h     |    3 +-
 drivers/net/dpaa2/meson.build           |    2 +-
 19 files changed, 2823 insertions(+), 1444 deletions(-)
 create mode 100644 drivers/net/dpaa2/dpaa2_meter.c
 delete mode 100644 drivers/net/dpaa2/dpaa2_parse_dump.h
 create mode 100644 drivers/net/dpaa2/dpaa2_parser_decode.h
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.c
 delete mode 100644 drivers/net/dpaa2/dpaa2_sparser.h
Signature · 1 line
2.43.0
#237 lore raw

PATCH 1/13 net/dpaa2: fix integer overflow in CCSR region mapping

From: Hemant Agrawal <[email protected]>

In lsx_ccsr_map_region, PAGE_SIZE is a macro defined as sysconf(_SC_PAGESIZE), which returns a signed long and may be negative on error. The value was used directly in size_t comparisons and passed to mmap, causing an integer overflow (Coverity CID 49765682).

The old round-down "len & PAGE_MASK" ignored the in-page offset: for a 4096-byte or 6656-byte len on a 64K-page kernel the masked result is 0, and only the subsequent "if (len < PAGE_SIZE) len = PAGE_SIZE" saved it. That check did not account for offset + len crossing a page boundary.

Fix by calling sysconf(_SC_PAGESIZE) explicitly into a signed long, checking for a non-positive return before use, computing page_mask from the verified value, and keeping map_len as a separate variable so that the final mmap size is always at least one page. The page-aligned start address and the back-pointer offset are both derived from the same page_mask, keeping the three values consistent.

Coverity issue: 49765682

Fixes f023d059769f ("net/dpaa2: support recycle loopback port")
---
 drivers/net/dpaa2/dpaa2_recycle.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)
drivers/net/dpaa2/dpaa2_recycle.c +19 -8
index f78d12362e..f1a234deae 100644
@@ -176,6 +176,9 @@ static void *lsx_ccsr_map_region(uint64_t addr, size_t len)
 	void *tmp;
 	uint64_t start;
 	uint64_t offset;
+	uint64_t page_mask;
+	long page_size;
+	size_t map_len;
 
 	fd = open("/dev/mem", O_RDWR);
 	if (fd < 0) {
@@ -183,20 +186,28 @@ static void *lsx_ccsr_map_region(uint64_t addr, size_t len)
 		return NULL;
 	}
 
-	start = addr & PAGE_MASK;
+	page_size = sysconf(_SC_PAGESIZE);
+	if (page_size <= 0) {
+		close(fd);
+		return NULL;
+	}
+	page_mask = ~((uint64_t)page_size - 1);
+	start = addr & page_mask;
 	offset = addr - start;
-	len = len & PAGE_MASK;
-	if (len < (size_t)PAGE_SIZE)
-		len = PAGE_SIZE;
+	len = len & page_mask;
+
+	map_len = len;
+	if (map_len < (size_t)page_size)
+		map_len = (size_t)page_size;
 
-	tmp = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, start);
+	tmp = mmap(NULL, map_len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, start);
 
 	close(fd);
 
-	if (tmp != MAP_FAILED)
-		return (uint8_t *)tmp + offset;
-	else
+	if (tmp == MAP_FAILED)
 		return NULL;
+
+	return (uint8_t *)tmp + offset;
 }
 
 static const uint8_t ls_sd1_prot_idx_map[] = {
Signature · 1 line
2.43.0
#238 lore raw

PATCH 2/13 net/dpaa2: set Tx confirmation on device init

In reply to Prashant Gupta

From: Gagandeep Singh <[email protected]>

Move TX confirmation mode setting from TXQ setup to device initialization because TXQ0 is not always set up by the user.

---
 drivers/net/dpaa2/dpaa2_ethdev.c | 40 ++++++++++++--------------------
 1 file changed, 15 insertions(+), 25 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.c +15 -25
index f211357919..c95704d4ca 100644
@@ -1153,7 +1153,6 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	struct dpni_queue tx_conf_cfg;
 	struct dpni_queue tx_flow_cfg;
 	uint8_t options = 0, flow_id;
-	uint8_t ceetm_ch_idx;
 	uint16_t channel_id;
 	struct dpni_queue_id qid;
 	uint32_t tc_id;
@@ -1174,30 +1173,6 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	memset(&tx_conf_cfg, 0, sizeof(struct dpni_queue));
 	memset(&tx_flow_cfg, 0, sizeof(struct dpni_queue));
 
-	if (!tx_queue_id) {
-		for (ceetm_ch_idx = 0;
-			ceetm_ch_idx <= (priv->num_channels - 1);
-			ceetm_ch_idx++) {
-			/*Set tx-conf and error configuration*/
-			if (priv->flags & DPAA2_TX_CONF_ENABLE) {
-				ret = dpni_set_tx_confirmation_mode(dpni,
-						CMD_PRI_LOW, priv->token,
-						ceetm_ch_idx,
-						DPNI_CONF_AFFINE);
-			} else {
-				ret = dpni_set_tx_confirmation_mode(dpni,
-						CMD_PRI_LOW, priv->token,
-						ceetm_ch_idx,
-						DPNI_CONF_DISABLE);
-			}
-			if (ret) {
-				DPAA2_PMD_ERR("Error(%d) in tx conf setting",
-					ret);
-				return ret;
-			}
-		}
-	}
-
 	tc_id = tx_queue_id % priv->num_tx_tc;
 	channel_id = (uint8_t)(tx_queue_id / priv->num_tx_tc) % priv->num_channels;
 	flow_id = 0;
@@ -3624,6 +3599,21 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 		goto init_err;
 	}
 
+	for (i = 0; i < priv->num_channels; i++) {
+		/*Set tx-conf and error configuration*/
+		if (priv->flags & DPAA2_TX_CONF_ENABLE) {
+			ret = dpni_set_tx_confirmation_mode(dpni_dev,
+				CMD_PRI_LOW, priv->token, i, DPNI_CONF_AFFINE);
+		} else {
+			ret = dpni_set_tx_confirmation_mode(dpni_dev,
+				CMD_PRI_LOW, priv->token, i, DPNI_CONF_DISABLE);
+		}
+		if (ret) {
+			DPAA2_PMD_ERR("Error(%d) in tx conf setting", ret);
+			goto init_err;
+		}
+	}
+
 	/* Allocate memory for storing MAC addresses.
 	 * Table of mac_filter_entries size is allocated so that RTE ether lib
 	 * can add MAC entries when rte_eth_dev_mac_addr_add is called.
Signature · 1 line
2.43.0
#239 lore raw

PATCH 3/13 net/dpaa2: support larger burst size

In reply to Prashant Gupta

From: Gagandeep Singh <[email protected]>

Make burst size checks and MC command fields SoC-aware, enabling bursts larger than 64K on LX2160A with dpni version 8.7+.

The max_burst_size field in dpni_tx_shaping_cfg is widened to uint32_t and the MC command struct is updated to split the value across two 16-bit fields using the new DPNI_BURST_LO/HI macros.

---
 drivers/net/dpaa2/dpaa2_tm.c        | 16 +++++++++++-----
 drivers/net/dpaa2/mc/dpni.c         | 11 +++++++++--
 drivers/net/dpaa2/mc/fsl_dpni.h     |  8 ++++++--
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h |  3 ++-
 4 files changed, 28 insertions(+), 10 deletions(-)
drivers/net/dpaa2/dpaa2_tm.c +11 -5
index 36e815c356..3057f4d031 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2020-2024 NXP
+ * Copyright 2020-2026 NXP
  */
 
 #include <rte_ethdev.h>
@@ -10,14 +10,20 @@
 #include "dpaa2_pmd_logs.h"
 #include <dpaa2_hw_dpio.h>
 
-#define DPAA2_BURST_MAX	(64 * 1024)
-
 #define DPAA2_SHAPER_MIN_RATE 0
 #define DPAA2_SHAPER_MAX_RATE 107374182400ull
 #define DPAA2_WEIGHT_MAX 24701
 #define DPAA2_PKT_ADJUST_LEN_MIN 0
 #define DPAA2_PKT_ADJUST_LEN_MAX 0x7ff
 
+static inline uint32_t dpaa2_get_burst_max(struct dpaa2_dev_priv *priv)
+{
+	if (dpaa2_dev_cmp_dpni_ver(priv, 8, 7) >= 0)
+		return (dpaa2_svr_family == SVR_LX2160A) ? 229375 : 0xF7FF;
+
+	return 0xF7FF;
+}
+
 int
 dpaa2_tm_init(struct rte_eth_dev *dev)
 {
@@ -283,7 +289,7 @@ dpaa2_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id,
 				RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE,
 				NULL, "committed rate is out of range\n");
 
-	if (params->committed.size > DPAA2_BURST_MAX)
+	if (params->committed.size > dpaa2_get_burst_max(priv))
 		return -rte_tm_error_set(error, EINVAL,
 				RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE,
 				NULL, "committed size is out of range\n");
@@ -293,7 +299,7 @@ dpaa2_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id,
 				RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE,
 				NULL, "Peak rate is out of range\n");
 
-	if (params->peak.size > DPAA2_BURST_MAX)
+	if (params->peak.size > dpaa2_get_burst_max(priv))
 		return -rte_tm_error_set(error, EINVAL,
 				RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE,
 				NULL, "Peak size is out of range\n");
drivers/net/dpaa2/mc/dpni.c +9 -2
index d0a9fefd31..17275b7195 100644
@@ -1106,6 +1106,7 @@ int dpni_set_tx_shaping(struct fsl_mc_io *mc_io,
 {
 	struct dpni_cmd_set_tx_shaping *cmd_params;
 	struct mc_command cmd = { 0 };
+	uint32_t tx_cr_burst, tx_er_burst;
 	int coupled, lni_shaper;
 	uint8_t channel_id;
 	uint16_t oal;
@@ -1115,10 +1116,16 @@ int dpni_set_tx_shaping(struct fsl_mc_io *mc_io,
 					  cmd_flags,
 					  token);
 	cmd_params = (struct dpni_cmd_set_tx_shaping *)cmd.params;
+	tx_cr_burst = tx_cr_shaper->max_burst_size;
+	tx_er_burst = tx_er_shaper->max_burst_size;
 	cmd_params->tx_cr_max_burst_size =
-		cpu_to_le16(tx_cr_shaper->max_burst_size);
+		cpu_to_le16(DPNI_BURST_LO(tx_cr_burst));
 	cmd_params->tx_er_max_burst_size =
-		cpu_to_le16(tx_er_shaper->max_burst_size);
+		cpu_to_le16(DPNI_BURST_LO(tx_er_burst));
+	cmd_params->tx_cr_max_burst_size_hi =
+		cpu_to_le16(DPNI_BURST_HI(tx_cr_burst));
+	cmd_params->tx_er_max_burst_size_hi =
+		cpu_to_le16(DPNI_BURST_HI(tx_er_burst));
 	cmd_params->tx_cr_rate_limit =
 		cpu_to_le32(tx_cr_shaper->rate_limit);
 	cmd_params->tx_er_rate_limit =
drivers/net/dpaa2/mc/fsl_dpni.h +6 -2
index 42d633eaf8..8913b408e7 100644
@@ -830,14 +830,18 @@ int dpni_get_link_state(struct fsl_mc_io *mc_io,
 			uint16_t token,
 			struct dpni_link_state *state);
 
+#define DPNI_BURST_LO(burst)	((burst) & GENMASK(15, 0))
+#define DPNI_BURST_HI(burst)	((burst) >> 16)
+
 /**
  * struct dpni_tx_shaping - Structure representing DPNI tx shaping configuration
  * @rate_limit:		Rate in Mbits/s
- * @max_burst_size:	Burst size in bytes (up to 64KB)
+ * @max_burst_size:	Burst size in bytes. Limits depend on the SoC (0x37FFF
+ *		for LX2160A, 0xF7FF for all others)
  */
 struct dpni_tx_shaping_cfg {
 	uint32_t rate_limit;
-	uint16_t max_burst_size;
+	uint32_t max_burst_size;
 };
 
 /**
drivers/net/dpaa2/mc/fsl_dpni_cmd.h +2 -1
index bb4939031b..6b396ca7cc 100644
@@ -394,7 +394,8 @@ struct dpni_rsp_get_link_state {
 struct dpni_cmd_set_tx_shaping {
 	uint16_t tx_cr_max_burst_size;
 	uint16_t tx_er_max_burst_size;
-	uint32_t pad;
+	uint16_t tx_cr_max_burst_size_hi;
+	uint16_t tx_er_max_burst_size_hi;
 	uint32_t tx_cr_rate_limit;
 	uint32_t tx_er_rate_limit;
 	/* from LSB: coupled:1, lni_shaper: 1*/
Signature · 1 line
2.43.0
#240 lore raw

PATCH 4/13 net/dpaa2: support MPLS and PPPoE flow distribution

In reply to Prashant Gupta

From: Gagandeep Singh <[email protected]>

Add rte_flow pattern support for MPLS and PPPoE items in the dpaa2 PMD flow engine.

For a pattern with no spec/mask, the frame is identified by its Frame Attribute Flag (FAF_MPLS_FRAM / FAF_PPPOE_PPP_FRAM) for both the QoS and flow steering tables. When a spec is present, the MPLS label (NH_FLD_MPLS_MPLSL_1) or the PPPoE session id (NH_FLD_PPPOE_SID) is added as a header extract rule for both tables.

The MPLS extract uses sizeof(label_tc_s) = 3 bytes for the size argument of dpaa2_flow_add_hdr_extract_rule. NH_FLD_MPLS_MPLSL_1 in the DPAA2 MC firmware covers the 20-bit label, 3-bit TC (EXP), and 1-bit S fields packed into 3 bytes; the 8-bit TTL is a separate MC field (NH_FLD_MPLS_MPLSTTL_1). Passing size=3 therefore matches the MC field width exactly, and no key-layout shift occurs for any extract fields placed after this one in the key profile.

---
 doc/guides/nics/features/dpaa2.ini |   2 +
 drivers/net/dpaa2/dpaa2_flow.c     | 196 +++++++++++++++++++++++++++++
 2 files changed, 198 insertions(+)
doc/guides/nics/features/dpaa2.ini +2 -0
index 4788afef8d..49faebcd06 100644
@@ -43,6 +43,8 @@ gtp                  = Y
 icmp                 = Y
 ipv4                 = Y
 ipv6                 = Y
+mpls                 = Y
+pppoes               = Y
 raw                  = Y
 sctp                 = Y
 tcp                  = Y
drivers/net/dpaa2/dpaa2_flow.c +196 -0

228 lines not on this page · raw message

Signature · 1 line
2.43.0
#241 lore raw

PATCH 5/13 net/dpaa2: support meter and policing

In reply to Prashant Gupta

From: Gagandeep Singh <[email protected]>

Add support for the traffic metering and policing (rte_mtr) API to the dpaa2 PMD. The implementation registers the rte_mtr operations through the ".mtr_ops_get" dev_ops hook and maintains software bookkeeping of meter profiles, policies and meter objects under a per-device spinlock.

Supported algorithms are trTCM RFC 2698 and trTCM RFC 4115 in both byte and packet modes. Meter policies support drop and pass-through actions on the red color.

Known limitations and follow-up items:

Rate unit conversion: rte_mtr cir/pir/eir are bytes/s in byte mode and packets/s in packet mode. The DPNI policing API expects Kbps in byte mode. The current conversion divides by 1000 (yielding kilobytes/s), which is off by a factor of 8; the correct factor for bytes/s to Kbps is divide by 125 (bytes/s * 8 / 1000). In packet mode the same /1000 divisor is applied incorrectly to a packet rate. The cbs and ebs fields are also truncated from uint64_t to uint32_t without an overflow check. These will be corrected in a follow-up.

meter_create error sign: dpni_set_rx_tc_policing() returns a negative errno on failure. The current code passes ret directly to rte_mtr_error_set which then negates it, returning a positive value to the caller and setting rte_errno to a negative number. The call should pass -ret. This will be fixed in a follow-up.

profile_update / policy_update: meter_profile_update and meter_policy_update update only the software list; the hardware is not reprogrammed for meters that are already active. This limitation will be addressed in a follow-up.

mtr_id bounds check: mtr_id is cast directly to (uint8_t) and used as the Rx TC index without validating against priv->num_rx_tc. An mtr_id of 256 aliases TC 0. Validation will be added in a follow-up. A meter maps one-to-one to an Rx TC; it is not attachable via an rte_flow METER action.

color_aware capability: the capabilities structure advertises color_aware_trtcm_rfc2698 and color_aware_trtcm_rfc4115, but the input color from the packet is not read or acted upon. This flag will be cleared until color-aware mode is implemented.

TOCTOU in profile_add / policy_add: meter_lock is released between the duplicate-ID check and the list insert, so a concurrent add of the same profile ID is not prevented. This will be tightened in a follow-up.

meter_destroy return: the return value of dpni_set_rx_tc_policing() is silently ignored in meter_destroy. Error logging will be added.

features/dpaa2.ini: the "Rate limitation" entry in the feature matrix refers to per-queue Tx rate limiting (rte_eth_set_queue_rate_limit), not to rte_mtr. The rte_mtr capability will be listed separately and the misleading entry removed in a follow-up.

---
 doc/guides/nics/dpaa2.rst              |   1 +
 doc/guides/nics/features/dpaa2.ini     |   1 +
 doc/guides/rel_notes/release_26_11.rst |   6 +
 drivers/net/dpaa2/dpaa2_ethdev.c       |   2 +
 drivers/net/dpaa2/dpaa2_ethdev.h       |  29 ++
 drivers/net/dpaa2/dpaa2_meter.c        | 579 +++++++++++++++++++++++++
 drivers/net/dpaa2/mc/fsl_dpni.h        |  23 +-
 drivers/net/dpaa2/meson.build          |   1 +
 8 files changed, 638 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/dpaa2/dpaa2_meter.c
doc/guides/nics/dpaa2.rst +1 -0
index ae8b32af2c..faee3a72a2 100644
@@ -407,6 +407,7 @@ Features of the DPAA2 PMD are:
 - Link flow control
 - Scattered and gather for TX and RX
 - Rx queue interrupts
+- Traffic metering and policing
 - :ref:`dpaa2_dptmapi`
 
 
doc/guides/nics/features/dpaa2.ini +1 -0
index 49faebcd06..4936769191 100644
@@ -19,6 +19,7 @@ RSS hash             = Y
 RSS reta update      = Y
 VLAN filter          = Y
 Flow control         = Y
+Rate limitation      = Y
 Traffic manager      = Y
 VLAN offload         = Y
 L3 checksum offload  = Y
doc/guides/rel_notes/release_26_11.rst +6 -0
index c8cc86295d..eae26f430c 100644
@@ -55,6 +55,12 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Updated NXP DPAA2 net driver.**
+
+  * Added support for flow classification on more protocol fields.
+  * Added Tx queue based flow control and confirmation queue handling.
+  * Added software parser based packet dump for debugging.
+  * Added support for traffic metering and policing.
 
 Removed Items
 -------------
drivers/net/dpaa2/dpaa2_ethdev.c +2 -0
index c95704d4ca..d23c73b21d 100644
@@ -3320,6 +3320,7 @@ static struct eth_dev_ops dpaa2_ethdev_ops = {
 	.rxq_info_get	      = dpaa2_rxq_info_get,
 	.txq_info_get	      = dpaa2_txq_info_get,
 	.tm_ops_get	      = dpaa2_tm_ops_get,
+	.mtr_ops_get	      = dpaa2_mtr_ops_get,
 #if defined(RTE_LIBRTE_IEEE1588)
 	.timesync_enable      = dpaa2_timesync_enable,
 	.timesync_disable     = dpaa2_timesync_disable,
@@ -3543,6 +3544,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	priv->num_channels = attr.num_channels;
 	priv->channel_inuse = 0;
 	rte_spinlock_init(&priv->lpbk_qp_lock);
+	rte_spinlock_init(&priv->meter_lock);
 
 	/* only if the custom CG is enabled */
 	if (attr.options & DPNI_OPT_CUSTOM_CG)
drivers/net/dpaa2/dpaa2_ethdev.h +29 -0
index 149954fb6b..e329111c0b 100644
@@ -385,6 +385,30 @@ struct extract_s {
 	uint8_t *tc_extract_param[MAX_TCS];
 };
 
+struct dpaa2_dev_meter_profile {
+	LIST_ENTRY(dpaa2_dev_meter_profile) next;
+	uint32_t profile_id;
+	uint64_t cir;
+	uint64_t cbs;
+	uint64_t pir;
+	uint64_t pbs;
+	enum dpni_policer_mode mode;
+	enum dpni_policer_unit policer_unit;
+};
+
+struct dpaa2_dev_meter_policy {
+	LIST_ENTRY(dpaa2_dev_meter_policy) next;
+	uint32_t policy_id;
+	bool red_drop;
+};
+
+struct dpaa2_dev_meter {
+	LIST_ENTRY(dpaa2_dev_meter) next;
+	uint32_t meter_id;
+	uint32_t profile_id;
+	uint32_t policy_id;
+};
+
 struct dpaa2_dev_priv {
 	void *hw;
 	int32_t hw_id;
@@ -411,6 +435,7 @@ struct dpaa2_dev_priv {
 	uint8_t en_loose_ordered;
 	uint8_t max_cgs;
 	uint8_t cgid_in_use[MAX_RX_QUEUES];
+	rte_spinlock_t meter_lock;
 
 	/* Current hash distribution size per RX TC, written by
 	 * dpaa2_setup_flow_dist_size() and read by reta_query / reta_update.
@@ -456,6 +481,9 @@ struct dpaa2_dev_priv {
 
 	struct dpaa2_dev_flow *curr;
 	LIST_HEAD(, dpaa2_dev_flow) flows;
+	LIST_HEAD(, dpaa2_dev_meter_profile) profiles;
+	LIST_HEAD(, dpaa2_dev_meter_policy) policies;
+	LIST_HEAD(, dpaa2_dev_meter) meters;
 	LIST_HEAD(nodes, dpaa2_tm_node) nodes;
 	LIST_HEAD(shaper_profiles, dpaa2_tm_shaper_profile) shaper_profiles;
 };
@@ -548,6 +576,7 @@ int dpaa2_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 
 int dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev);
 int dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev);
+int dpaa2_mtr_ops_get(struct rte_eth_dev *dev, void *ops);
 int dpaa2_soft_parser_loaded(void);
 
 void
drivers/net/dpaa2/dpaa2_meter.c new file +579 -0

579 lines not on this page · raw message

drivers/net/dpaa2/mc/fsl_dpni.h +19 -4
index 8913b408e7..d227025e01 100644
@@ -1111,6 +1111,11 @@ int dpni_set_rx_tc_dist(struct fsl_mc_io *mc_io,
  */
 #define DPNI_POLICER_OPT_DISCARD_RED	0x00000002
 
+/**
+ * Do NOT reset counters generally for policer update
+ */
+#define DPNI_POLICER_OPT_DO_NOT_RESET_COUNTERS	0x00000004
+
 /**
  * enum dpni_policer_mode - selecting the policer mode
  * @DPNI_POLICER_MODE_NONE: Policer is disabled
@@ -1127,12 +1132,17 @@ enum dpni_policer_mode {
 
 /**
  * enum dpni_policer_unit - DPNI policer units
- * @DPNI_POLICER_UNIT_BYTES: bytes units
+ * @DPNI_POLICER_UNIT_BYTES_L3: bytes units (for each frame takes into account
+ * FD length - L3 offset)
  * @DPNI_POLICER_UNIT_FRAMES: frames units
+ * @DPNI_POLICER_UNIT_BYTES_L2_WITHOUT_FCS: bytes units (for each frame takes
+ * into account FD length - L2 offset, which means L2 size without the 4 bytes
+ * for the FCS)
  */
 enum dpni_policer_unit {
-	DPNI_POLICER_UNIT_BYTES = 0,
-	DPNI_POLICER_UNIT_FRAMES
+	DPNI_POLICER_UNIT_BYTES_L3 = 0,
+	DPNI_POLICER_UNIT_FRAMES,
+	DPNI_POLICER_UNIT_BYTES_L2_WITHOUT_FCS,
 };
 
 /**
@@ -1173,13 +1183,18 @@ struct dpni_rx_tc_policing_cfg {
 	uint32_t ebs;
 };
 
-
 int dpni_set_rx_tc_policing(struct fsl_mc_io *mc_io,
 			    uint32_t cmd_flags,
 			    uint16_t token,
 			    uint8_t tc_id,
 			    const struct dpni_rx_tc_policing_cfg *cfg);
 
+int dpni_set_rx_tc_policing_v1(struct fsl_mc_io *mc_io,
+			    uint32_t cmd_flags,
+			    uint16_t token,
+			    uint8_t tc_id,
+			    const struct dpni_rx_tc_policing_cfg *cfg);
+
 int dpni_get_rx_tc_policing(struct fsl_mc_io *mc_io,
 			    uint32_t cmd_flags,
 			    uint16_t token,
drivers/net/dpaa2/meson.build +1 -0
index 4094ea02ba..808dad8112 100644
@@ -11,6 +11,7 @@ sources = files(
         'base/dpaa2_hw_dpni.c',
         'base/dpaa2_tlu_hash.c',
         'dpaa2_tm.c',
+        'dpaa2_meter.c',
         'dpaa2_mux.c',
         'dpaa2_ethdev.c',
         'dpaa2_flow.c',
Signature · 1 line
2.43.0
#242 lore raw

PATCH 6/13 net/dpaa2: support flow drop action

In reply to Prashant Gupta

From: Gagandeep Singh <[email protected]>

Add support for the RTE_FLOW_ACTION_TYPE_DROP action in the dpaa2 flow engine. A flow rule with a drop action is programmed into the flow steering (FS) table with the DPNI_FS_OPT_DISCARD option so that matching frames are discarded by hardware.

The drop action is added to the supported action list, accepted during action verification, configured in the FS action path, handled in the generic flow-set action loop, and cleaned up in the flow destroy path.

---
 drivers/net/dpaa2/dpaa2_flow.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/dpaa2/dpaa2_flow.c +7 -1
index 90e0b66258..b2f1778de3 100644
@@ -97,7 +97,8 @@ enum rte_flow_action_type dpaa2_supported_action_type[] = {
 	RTE_FLOW_ACTION_TYPE_QUEUE,
 	RTE_FLOW_ACTION_TYPE_PORT_ID,
 	RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
-	RTE_FLOW_ACTION_TYPE_RSS
+	RTE_FLOW_ACTION_TYPE_RSS,
+	RTE_FLOW_ACTION_TYPE_DROP
 };
 
 #ifndef __cplusplus
@@ -4421,6 +4422,7 @@ dpaa2_flow_verify_action(struct dpaa2_dev_priv *priv,
 			break;
 		case RTE_FLOW_ACTION_TYPE_PF:
 			/* Skip this action, have to add for vxlan */
+		case RTE_FLOW_ACTION_TYPE_DROP:
 			break;
 		case RTE_FLOW_ACTION_TYPE_END:
 			end_of_list = 1;
@@ -4468,6 +4470,8 @@ dpaa2_configure_flow_fs_action(struct dpaa2_dev_priv *priv,
 		flow->fs_action_cfg.redirect_obj_token =
 			dest_priv->token;
 		flow->fs_action_cfg.flow_id = dest_q->flow_id;
+	} else if (flow->action_type == RTE_FLOW_ACTION_TYPE_DROP) {
+		flow->fs_action_cfg.options = DPNI_FS_OPT_DISCARD;
 	}
 
 	return 0;
@@ -4945,6 +4949,7 @@ dpaa2_generic_flow_set(struct dpaa2_dev_flow *flow,
 		case RTE_FLOW_ACTION_TYPE_QUEUE:
 		case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
 		case RTE_FLOW_ACTION_TYPE_PORT_ID:
+		case RTE_FLOW_ACTION_TYPE_DROP:
 			ret = dpaa2_configure_flow_fs_action(priv, flow,
 							     &actions[j]);
 			if (ret)
@@ -5346,6 +5351,7 @@ dpaa2_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *_flow,
 	case RTE_FLOW_ACTION_TYPE_QUEUE:
 	case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
 	case RTE_FLOW_ACTION_TYPE_PORT_ID:
+	case RTE_FLOW_ACTION_TYPE_DROP:
 		if (priv->num_rx_tc > 1) {
 			/* Remove entry from QoS table first */
 			ret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW,
Signature · 1 line
2.43.0
#243 lore raw

PATCH 7/13 net/dpaa2: set default flow miss action per device

In reply to Prashant Gupta

From: Gagandeep Singh <[email protected]>

The flow steering miss flow id was a file-scope global configured only via the DPAA2_FLOW_CONTROL_MISS_FLOW environment variable and defaulted to 0. Replace it with a per-device default_flow field in the private device structure, initialised to 0 at probe time, so that each device has its own independent miss-flow setting and the env variable override is no longer needed.

The DPAA2_FLOW_CONTROL_MISS_FLOW environment variable is removed. Users who relied on it to redirect unmatched frames to a specific queue must now use the rte_flow API instead. A release-note entry for this removal should be added to doc/guides/rel_notes/release_26_11.rst.

---
 drivers/net/dpaa2/dpaa2_ethdev.c |  2 ++
 drivers/net/dpaa2/dpaa2_ethdev.h |  2 ++
 drivers/net/dpaa2/dpaa2_flow.c   | 14 +-------------
 3 files changed, 5 insertions(+), 13 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.c +2 -0
index d23c73b21d..70f271ec45 100644
@@ -3543,6 +3543,8 @@ 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;
+	priv->default_flow = RTE_MIN(priv->fs_entries,
+		priv->dist_queues) - 1;
 	rte_spinlock_init(&priv->lpbk_qp_lock);
 	rte_spinlock_init(&priv->meter_lock);
 
drivers/net/dpaa2/dpaa2_ethdev.h +2 -0
index e329111c0b..58a47cd1a2 100644
@@ -436,6 +436,8 @@ struct dpaa2_dev_priv {
 	uint8_t max_cgs;
 	uint8_t cgid_in_use[MAX_RX_QUEUES];
 	rte_spinlock_t meter_lock;
+	/* Lowest priority FS flow id to receive flow steering miss frames. */
+	uint16_t default_flow;
 
 	/* Current hash distribution size per RX TC, written by
 	 * dpaa2_setup_flow_dist_size() and read by reta_query / reta_update.
drivers/net/dpaa2/dpaa2_flow.c +1 -13
index b2f1778de3..2e844121a8 100644
@@ -24,7 +24,6 @@
 #include <dpaa2_pmd_logs.h>
 
 static char *dpaa2_flow_control_log;
-static uint16_t dpaa2_flow_miss_flow_id; /* Default miss flow id is 0. */
 static int dpaa2_sp_loaded = -1;
 
 enum dpaa2_flow_entry_size {
@@ -4590,7 +4589,7 @@ dpaa2_configure_fs_rss_table(struct dpaa2_dev_priv *priv,
 		return 0;
 
 	tc_cfg.enable = true;
-	tc_cfg.fs_miss_flow_id = dpaa2_flow_miss_flow_id;
+	tc_cfg.fs_miss_flow_id = priv->default_flow;
 	ret = dpni_set_rx_fs_dist(dpni, CMD_PRI_LOW,
 			priv->token, &tc_cfg);
 	if (ret < 0) {
@@ -5224,17 +5223,6 @@ dpaa2_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 	dpaa2_flow_control_log =
 		getenv("DPAA2_FLOW_CONTROL_LOG");
 
-	if (getenv("DPAA2_FLOW_CONTROL_MISS_FLOW")) {
-		dpaa2_flow_miss_flow_id =
-			(uint16_t)atoi(getenv("DPAA2_FLOW_CONTROL_MISS_FLOW"));
-		if (dpaa2_flow_miss_flow_id >= priv->dist_queues) {
-			DPAA2_PMD_ERR("Missed flow ID %d >= dist size(%d)",
-				      dpaa2_flow_miss_flow_id,
-				      priv->dist_queues);
-			return NULL;
-		}
-	}
-
 	flow = rte_zmalloc(NULL, sizeof(struct dpaa2_dev_flow),
 			   RTE_CACHE_LINE_SIZE);
 	if (!flow) {
Signature · 1 line
2.43.0