All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/3] DPAA driver changes
@ 2026-10-28  8:55 Gagandeep Singh
  2026-10-28  8:55 ` [PATCH v1 1/3] drivers: add offline (O/H) port device support Gagandeep Singh
                   ` (4 more replies)
  0 siblings, 5 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-10-28  8:55 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal

 - Adding OH port support.
 - Updates in shared ethernet code.
 - Congestion related code cleanup.

Gagandeep Singh (1):
  drivers: add offline (O/H) port device support

Hemant Agrawal (1):
  net/dpaa: support non fmX-macY type of shared Ethernet name

Jun Yang (1):
  drivers: add DPAA cgrid cleanup support

 doc/api/doxy-api-index.md                |   1 +
 doc/guides/nics/dpaa.rst                 |  32 +
 drivers/bus/dpaa/base/fman/fman.c        |  19 +
 drivers/bus/dpaa/base/qbman/qman.c       |  61 ++
 drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
 drivers/bus/dpaa/dpaa_bus.c              | 100 ++-
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   2 +
 drivers/bus/dpaa/include/fman.h          |   6 +-
 drivers/bus/dpaa/include/fsl_qman.h      |  28 +
 drivers/net/dpaa/dpaa_ethdev.c           | 176 ++++-
 drivers/net/dpaa/dpaa_ethdev.h           |   3 +
 drivers/net/dpaa/dpaa_flow.c             |   7 +-
 drivers/net/dpaa/dpaa_oldev.c            | 875 +++++++++++++++++++++++
 drivers/net/dpaa/meson.build             |  11 +-
 drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 158 ++++
 15 files changed, 1454 insertions(+), 29 deletions(-)
 create mode 100644 drivers/net/dpaa/dpaa_oldev.c
 create mode 100644 drivers/net/dpaa/rte_pmd_dpaa_oldev.h

-- 
2.25.1


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

* [PATCH v1 1/3] drivers: add offline (O/H) port device support
  2026-10-28  8:55 [PATCH v1 0/3] DPAA driver changes Gagandeep Singh
@ 2026-10-28  8:55 ` Gagandeep Singh
  2026-10-28  8:55 ` [PATCH v1 2/3] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-10-28  8:55 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, Gagandeep Singh

Add support for the DPAA Offline/Host-command (O/H) port, allowing a
single OL port to be used by a DPDK application. The feature is
selected through the 'drv_oldev' bus device argument, and the
associated back-half port is named through the 'drv_bh_port' device
argument.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/api/doxy-api-index.md                |   1 +
 doc/guides/nics/dpaa.rst                 |  27 +
 drivers/bus/dpaa/base/fman/fman.c        |  19 +
 drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
 drivers/bus/dpaa/dpaa_bus.c              | 100 ++-
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   1 +
 drivers/bus/dpaa/include/fman.h          |   6 +-
 drivers/bus/dpaa/include/fsl_qman.h      |   1 +
 drivers/net/dpaa/dpaa_ethdev.h           |   3 +
 drivers/net/dpaa/dpaa_flow.c             |   7 +-
 drivers/net/dpaa/dpaa_oldev.c            | 875 +++++++++++++++++++++++
 drivers/net/dpaa/meson.build             |  11 +-
 drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 158 ++++
 13 files changed, 1197 insertions(+), 16 deletions(-)
 create mode 100644 drivers/net/dpaa/dpaa_oldev.c
 create mode 100644 drivers/net/dpaa/rte_pmd_dpaa_oldev.h

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 62390f7be3..0bd8e1bbf0 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -53,6 +53,7 @@ The public API headers are grouped by topics:
   [cnxk_eventdev](@ref rte_pmd_cnxk_eventdev.h),
   [cnxk_mempool](@ref rte_pmd_cnxk_mempool.h),
   [dpaa](@ref rte_pmd_dpaa.h),
+  [dpaa_oldev](@ref rte_pmd_dpaa_oldev.h),
   [dpaa2](@ref rte_pmd_dpaa2.h),
   [mlx5](@ref rte_pmd_mlx5.h),
   [dpaa2_mempool](@ref rte_dpaa2_mempool.h),
diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst
index c6aab46828..667b8c113d 100644
--- a/doc/guides/nics/dpaa.rst
+++ b/doc/guides/nics/dpaa.rst
@@ -276,6 +276,33 @@ Refer to the document :doc:`build_and_test` for details.
   and thus disabling hardware based packet handling at driver level,
   e.g. ``dpaa:fm1-mac3,recv_err_pkts=1``.
 
+``drv_bh_port``
+   Name of the back-half port associated with an offline (O/H) port device.
+   It is passed on the offline port device itself, which is named
+   ``oldev1``, e.g. ``-a dpaa_bus:oldev1,drv_bh_port=fm1-mac5``.
+
+The following bus-level device argument configures the DPAA bus itself and
+is passed through the EAL bus arguments. The bus name is ``dpaa_bus``:
+
+``drv_oldev`` (default disabled)
+   Enable the DPAA offline (O/H) port device,
+   e.g. ``-a bus=dpaa_bus,drv_oldev=1``.
+
+   Passing any ``-a`` argument for the DPAA bus switches the bus to
+   allowlist scan mode, so from that point on only the devices named with
+   ``-a`` are probed. Enabling the offline port therefore requires listing
+   the offline port itself and every Ethernet port the application needs,
+   for example::
+
+      -a bus=dpaa_bus,drv_oldev=1 \
+      -a dpaa_bus:oldev1,drv_bh_port=fm1-mac5 \
+      -a dpaa_bus:fm1-mac5 -a dpaa_bus:fm1-mac6
+
+   Omitting ``-a dpaa_bus:oldev1`` leaves the offline port unprobed even
+   though ``drv_oldev=1`` was given, and omitting an ``fmX-macY`` port
+   silently drops that port.
+
+
 FMAN Config
 -----------
 
diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index 67f77265ca..223cd6958d 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -205,6 +205,9 @@ static void fman_if_vsp_init(struct __fman_if *__if)
 	size_t lenp;
 	const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1};
 
+	static_assert(RTE_DIM(mac_idx) == FMAN_MAX_MAC_IDX_NUM,
+		      "mac_idx[] out of sync with FMAN_MAX_MAC_IDX_NUM");
+
 	if (__if->__if.mac_idx <= 8) {
 		for_each_compatible_node(dev, NULL,
 			"fsl,fman-port-1g-rx-extended-args") {
@@ -544,6 +547,14 @@ fman_if_init(const struct device_node *dpa_node, int fd)
 		cell_idx_host = of_read_number(cell_idx,
 					       lenp / sizeof(phandle));
 
+		if (cell_idx_host >= FMAN_MAX_MAC_IDX_NUM) {
+			FMAN_ERR(-EINVAL,
+				 "%s: cell-index(%" PRIu64 ") >= max(%d)",
+				 oh_node->full_name, cell_idx_host,
+				 FMAN_MAX_MAC_IDX_NUM);
+			goto err;
+		}
+
 		__if->__if.mac_idx = cell_idx_host;
 	}
 
@@ -957,6 +968,14 @@ static int fman_if_init_onic(const struct device_node *dpa_node)
 	assert(lenp == sizeof(*cell_idx));
 
 	cell_idx_host = of_read_number(cell_idx, lenp / sizeof(phandle));
+
+	if (cell_idx_host >= FMAN_MAX_MAC_IDX_NUM) {
+		FMAN_ERR(-EINVAL, "%s: cell-index(%" PRIu64 ") >= max(%d)",
+			 tx_oh_node->full_name, cell_idx_host,
+			 FMAN_MAX_MAC_IDX_NUM);
+		goto err;
+	}
+
 	__if->__if.mac_idx = cell_idx_host;
 
 	fman_node = of_get_parent(fman_tx_oh_node);
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index 4aed83f84d..323a6a7659 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -69,11 +69,13 @@ struct rte_dpaa_driver;
 enum rte_dpaa_type {
 	FSL_DPAA_ETH = 1,
 	FSL_DPAA_CRYPTO,
-	FSL_DPAA_QDMA
+	FSL_DPAA_QDMA,
+	FSL_DPAA_OL
 };
 
 struct dpaa_device_id {
 	uint8_t fman_id; /**< Fman interface ID, for ETH type device */
+	uint8_t ol_id;	/**< OH interface ID, for OH type device */
 	uint8_t mac_id; /**< Fman MAC interface ID, for ETH type device */
 	uint16_t dev_id; /**< Device Identifier from DPDK */
 };
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 6599958925..7df2b3a97c 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -34,6 +34,8 @@
 #include <bus_driver.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
+#include <rte_kvargs.h>
+#include <rte_devargs.h>
 
 #include <dpaa_of.h>
 #include <bus_dpaa_driver.h>
@@ -66,8 +68,12 @@ struct rte_dpaa_bus_private {
 	uint32_t svr_ver;
 	uint16_t max_push_rxq_num;
 	RTE_ATOMIC(uint16_t) push_rxq_num;
+	int oldev_enabled;	/**< "drv_oldev" bus devarg */
 };
 
+/* Bus level device argument keys */
+#define DPAA_BUS_ARG_OLDEV	"drv_oldev"
+
 static struct rte_bus rte_dpaa_bus;
 static struct rte_dpaa_bus_private dpaa_bus;
 static struct netcfg_info *dpaa_netcfg;
@@ -78,6 +84,44 @@ static pthread_key_t dpaa_portal_key;
 struct dpaa_portal *dpaa_portals[RTE_MAX_LCORE] = {NULL};
 static int dpaa_bus_global_init;
 
+/*
+ * Parse the bus-level device arguments (specified through the EAL bus
+ * arguments, e.g. "-a bus=dpaa_bus,drv_oldev=1") and cache the resulting
+ * flags in the bus private structure. Replaces the previous
+ * environment-variable based configuration.
+ *
+ * bus_str holds the whole bus layer including the "bus=" pair, so the
+ * kvargs list is parsed with a key list that accepts it alongside the
+ * DPAA specific keys.
+ */
+static int
+dpaa_bus_parse_bus_args(void)
+{
+	static const char * const bus_arg_keys[] = {
+		RTE_DEVARGS_KEY_BUS,
+		DPAA_BUS_ARG_OLDEV,
+		NULL,
+	};
+	struct rte_devargs *devargs;
+	struct rte_kvargs *kvlist;
+
+	RTE_EAL_DEVARGS_FOREACH(rte_dpaa_bus.name, devargs) {
+		if (devargs->bus_str == NULL)
+			continue;
+
+		kvlist = rte_kvargs_parse(devargs->bus_str, bus_arg_keys);
+		if (kvlist == NULL)
+			continue;
+
+		if (rte_kvargs_count(kvlist, DPAA_BUS_ARG_OLDEV))
+			dpaa_bus.oldev_enabled = 1;
+
+		rte_kvargs_free(kvlist);
+	}
+
+	return 0;
+}
+
 RTE_EXPORT_INTERNAL_SYMBOL(per_lcore_dpaa_io)
 RTE_DEFINE_PER_LCORE(struct dpaa_portal *, dpaa_io);
 
@@ -201,7 +245,7 @@ static void dpaa_clean_device_list(void);
 static int
 dpaa_create_device_list(void)
 {
-	int i;
+	int i = 0;
 	int ret;
 	struct rte_dpaa_device *dev;
 	struct fm_eth_port_cfg *cfg;
@@ -209,6 +253,34 @@ dpaa_create_device_list(void)
 
 	dpaa_bus.device_count = 0;
 
+	if (!dpaa_netcfg && !dpaa_bus.oldev_enabled)
+		return 0;
+
+	/* Creating OL Device */
+	if (dpaa_bus.oldev_enabled) {
+		dev = calloc(1, sizeof(struct rte_dpaa_device));
+		if (!dev) {
+			DPAA_BUS_ERR("Failed to allocate OL devices");
+			return -ENOMEM;
+		}
+
+		dev->device_type = FSL_DPAA_OL;
+		dev->id.ol_id = 0;
+		dev->id.dev_id = dpaa_bus.device_count;
+
+		/* Create device name */
+		memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN);
+		sprintf(dev->name, "oldev%d", (dev->id.ol_id + 1));
+		DPAA_BUS_INFO("%s oldev added", dev->name);
+		dev->device.name = dev->name;
+		dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus, dev->name);
+		if (dev->device.devargs != NULL)
+			DPAA_BUS_INFO("**Devargs matched %s", dev->name);
+
+		dpaa_add_to_device_list(dev);
+		dpaa_bus.device_count++;
+	}
+
 	/* Creating Ethernet Devices */
 	for (i = 0; dpaa_netcfg && (i < dpaa_netcfg->num_ethports); i++) {
 		dev = calloc(1, sizeof(struct rte_dpaa_device));
@@ -513,7 +585,7 @@ rte_dpaa_bus_parse(const char *name, void *out)
 	}
 
 	/* dev_delta points to the dev name (mac/oh/onic). Not valid for
-	 * dpaa_sec.
+	 * dpaa_sec and oldev.
 	 */
 	dev_delta = delta + sizeof("fm.-") - 1;
 
@@ -527,6 +599,10 @@ rte_dpaa_bus_parse(const char *name, void *out)
 				i < 1 || i > RTE_DPAA_QDMA_DEVICES)
 			return -EINVAL;
 		max_name_len = sizeof("dpaa_qdma-.") - 1;
+	} else if (strncmp("oldev", &name[delta], 5) == 0) {
+		if (sscanf(&name[delta], "oldev%u", &i) != 1 || i != 1)
+			return -EINVAL;
+		max_name_len = sizeof("oldev.") - 1;
 	} else if (strncmp("oh", &name[dev_delta], 2) == 0) {
 		if (sscanf(&name[delta], "fm%u-oh%u", &i, &j) != 2 ||
 				i >= 2 || j >= 16)
@@ -624,7 +700,7 @@ rte_dpaa_bus_dev_build(void)
 
 	/* Get the interface configurations from device-tree */
 	dpaa_netcfg = netcfg_acquire();
-	if (!dpaa_netcfg) {
+	if (!dpaa_netcfg && !dpaa_bus.oldev_enabled) {
 		DPAA_BUS_ERR("netcfg failed: /dev/fsl_usdpaa device not available");
 		DPAA_BUS_WARN("Check if you are using USDPAA based device tree");
 		return -EINVAL;
@@ -632,17 +708,20 @@ rte_dpaa_bus_dev_build(void)
 
 	DPAA_BUS_NOTICE("DPAA Bus Detected");
 
-	if (!dpaa_netcfg->num_ethports) {
-		DPAA_BUS_INFO("NO DPDK mapped net interfaces available");
-		/* This is not an error */
+	if (!dpaa_bus.oldev_enabled) {
+		if (!dpaa_netcfg->num_ethports) {
+			DPAA_BUS_INFO("NO DPDK mapped net interfaces available");
+			/* This is not an error */
+		}
 	}
 
 #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
 	dump_netcfg(dpaa_netcfg, stdout);
 #endif
-
-	DPAA_BUS_DEBUG("Number of ethernet devices = %d",
+	if (!dpaa_bus.oldev_enabled) {
+		DPAA_BUS_DEBUG("Number of ethernet devices = %d",
 			     dpaa_netcfg->num_ethports);
+	}
 	ret = dpaa_create_device_list();
 	if (ret) {
 		DPAA_BUS_ERR("Unable to create device list. (%d)", ret);
@@ -695,6 +774,11 @@ rte_dpaa_bus_scan(void)
 
 	dpaa_bus.detected = 1;
 
+	/* Parse bus-level device arguments (drv_oldev) before building the
+	 * device list.
+	 */
+	dpaa_bus_parse_bus_args();
+
 	/* create the key, supplying a function that'll be invoked
 	 * when a portal affined thread will be deleted.
 	 */
diff --git a/drivers/bus/dpaa/dpaa_bus_base_symbols.c b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
index 0927e5fe2c..aaa9f9bec2 100644
--- a/drivers/bus/dpaa/dpaa_bus_base_symbols.c
+++ b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
@@ -52,6 +52,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(bman_acquire)
 RTE_EXPORT_INTERNAL_SYMBOL(bman_query_free_buffers)
 RTE_EXPORT_INTERNAL_SYMBOL(bman_thread_irq)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_fqid_range)
+RTE_EXPORT_INTERNAL_SYMBOL(qman_release_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_reserve_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_pool_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_cgrid_range)
diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h
index f642faf3b3..030c85c284 100644
--- a/drivers/bus/dpaa/include/fman.h
+++ b/drivers/bus/dpaa/include/fman.h
@@ -68,6 +68,11 @@
 #define FMAN_RTC_MAX_NUM_OF_PERIODIC_PULSES	4
 #define FMAN_RTC_MAX_NUM_OF_EXT_TRIGGERS	3
 
+/*
+ * Maximum number of MAC/offline port indexes.
+ */
+#define FMAN_MAX_MAC_IDX_NUM	11
+
 /* Represents the different flavour of network interface */
 enum fman_mac_type {
 	fman_offline_internal = 0,
@@ -475,7 +480,6 @@ struct __fman_if {
 	void *qmi_map;
 };
 
-#define MEMMAC_REG_OFFSET(reg) offsetof(struct memac_regs, reg)
 #define BMI_RX_REG_OFFSET(reg) offsetof(struct rx_bmi_regs, reg)
 #define BMI_TX_REG_OFFSET(reg) offsetof(struct tx_bmi_regs, reg)
 
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index 59b41e17f0..b2674ce5d0 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1895,6 +1895,7 @@ static inline int qman_alloc_fqid(u32 *result)
  * This function can also be used to seed the allocator with ranges of FQIDs
  * that it can subsequently allocate from.
  */
+__rte_internal
 void qman_release_fqid_range(u32 fqid, unsigned int count);
 static inline void qman_release_fqid(u32 fqid)
 {
diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h
index 47c8e2b086..7e70bf2ad2 100644
--- a/drivers/net/dpaa/dpaa_ethdev.h
+++ b/drivers/net/dpaa/dpaa_ethdev.h
@@ -114,6 +114,9 @@ enum {
 
 #define DPAA_DEFAULT_RXQ_VSP_ID		1
 
+/* Device argument to name the offline (O/H) port back-half port */
+#define DRIVER_OL_BH_PORT		"drv_bh_port"
+
 #define FMC_FILE "/tmp/fmc.bin"
 
 struct dpaa_if_vsp {
diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c
index f77f9f333b..6c519ec975 100644
--- a/drivers/net/dpaa/dpaa_flow.c
+++ b/drivers/net/dpaa/dpaa_flow.c
@@ -32,9 +32,14 @@ return &scheme_params->param.key_ext_and_hash.extract_array[hdr_idx];
 	SCH_EXT_HDR(scheme_params, hdr_idx).extract_by_hdr_type.full_field
 
 /* FMAN mac indexes mappings (0 is unused, first 8 are for 1G, next for 10G
- * ports).
+ * ports). Indexed by fman_if.mac_idx, which the bus validates against
+ * FMAN_MAX_MAC_IDX_NUM when deriving it from the device tree.
  */
 static const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1};
+static_assert(RTE_DIM(mac_idx) == FMAN_MAX_MAC_IDX_NUM,
+	"mac_idx[] out of sync with FMAN_MAX_MAC_IDX_NUM");
+
+
 
 /* FM global info */
 struct dpaa_fm_info {
diff --git a/drivers/net/dpaa/dpaa_oldev.c b/drivers/net/dpaa/dpaa_oldev.c
new file mode 100644
index 0000000000..750f963543
--- /dev/null
+++ b/drivers/net/dpaa/dpaa_oldev.c
@@ -0,0 +1,875 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2026 NXP
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+
+#include <rte_dpaa_logs.h>
+#include <rte_kvargs.h>
+#include <rte_stdatomic.h>
+
+#include <rte_string_fns.h>
+#include <bus_dpaa_driver.h>
+#include <dpaa_ethdev.h>
+#include <dpaa_rxtx.h>
+#include <dpaa_mempool.h>
+
+#include <eal_export.h>
+#include <fsl_fman.h>
+
+#include "rte_pmd_dpaa_oldev.h"
+
+/* The ol device is a tx are queue pair, which is provided to the kernel through
+ * ioctl calls. It is exposed as a virtual port to the application.
+ * This ASK Device provides IOCTL calls to driver for communicating fqid's,
+ * buffer pool id's and channel id's with kernel.
+ */
+#define ASK_PATH		"/dev/cdx_ctrl"
+#define CDX_IOC_MAGIC		0xbe
+
+#define MAX_BH_PORT_NAME_LEN	12
+
+/* Private area reserved by driver.
+ * Aligned with "struct annotations_t". Parse results will be written from
+ * the 17th byte by the HW.
+ */
+#define DPAA_OL_PARSERSLT_START_OFFSET 16
+#define DPAA_OL_DATA_ALIGNMENT 64
+/* Change this value to increase the data offset.
+ * final value will be aligned by DPAA_OL_DATA_ALIGNMENT
+ */
+#define DPAA_OL_MAX_EXTRA_SIZE 0
+#define DPAA_OL_PARSE_RESULT_REQUIRED true
+#define DPAA_OL_TIME_STAMP_REQUIRED false
+#define DPAA_OL_HASH_RESULT_REQUIRED false
+#define DPAA_OL_PCD_INFO_REQUIRED false
+
+/* Work queue ID used for the offline port ingress sequence classifier. */
+#define DPA_ISC_WQ_ID 2
+
+/* Control device descriptor, opened on demand. The fast path reads it
+ * without holding fd_init_lock, so all accesses are atomic.
+ */
+static RTE_ATOMIC(int)ask_fd = -1;
+static pthread_mutex_t fd_init_lock = PTHREAD_MUTEX_INITIALIZER;
+
+struct ask_ctrl_offline_channel {
+	uint32_t channel_id;
+	uint32_t ctx_a_hi_val;	/* Setting required flags(B0,A2) while creating
+				 * frame queue.
+				 */
+	uint32_t ctx_a_lo_val;	/* EBD and VSP enable bits */
+	uint32_t ctx_b_val;	/* VSP ID */
+};
+
+struct ask_ctrl_dpdk_fq_info_s {
+	uint32_t tx_fq_id;		/* DPDK transmits GTP packets using FQ
+					 * ID
+					 */
+	uint32_t rx_fq_id;		/* DPDK receives packets from FMAN */
+	uint16_t buff_size;		/* Size of each buffer in DPDPK buffer
+					 * pool
+					 */
+	uint8_t bp_id;			/* DPDK buffer pool id */
+	/* BH port interface name , for testing purpose */
+	uint8_t bh_port_name[MAX_BH_PORT_NAME_LEN];
+	/* below fields are taken from structure t_FmBufferPrefixContent, These
+	 * fields are required for VSP creation on DPDK buffer pool ID. These
+	 * fields should be set based on expected parameters from FMAN
+	 */
+	uint16_t privDataSize;		/* Number of bytes to be left at the
+					 * beginning of the external buffer;
+					 * Note that the private-area will start
+					 * from the base of the buffer address.
+					 */
+	bool passPrsResult;		/* TRUE to pass the parse result to/from
+					 * the FM; User may use
+					 * FM_PORT_GetBufferPrsResult() in order
+					 * to get the parser-result from a
+					 * buffer.
+					 */
+	bool passTimeStamp;		/* < TRUE to pass the timeStamp to/from
+					 * the FM User may use
+					 * FM_PORT_GetBufferTimeStamp() in order
+					 * to get the parser-result from a
+					 * buffer.
+					 */
+	bool passHashResult;		/* TRUE to pass the KG hash result
+					 * to/from the FM User may use
+					 * FM_PORT_GetBufferHashResult() in
+					 * order to get the parser-result from a
+					 * buffer.
+					 */
+	bool passAllOtherPCDInfo;	/* Add all other Internal-Context
+					 * information: AD, hash-result, key,
+					 * etc.
+					 */
+	uint16_t dataAlign;		/* 0 to use driver's default alignment
+					 * [DEFAULT_FM_SP_bufferPrefixContent_dataAlign],
+					 * other value for selecting a data
+					 * alignment (must be a power of 2); if
+					 * write optimization is used, must be
+					 * >= 16.
+					 */
+	uint8_t manipExtraSpace;	/* Maximum extra size needed (insertion-
+					 * size minus removal-size); Note that
+					 * this field impacts the size of the
+					 * buffer-prefix (i.e. it pushes the
+					 * data offset); This field is
+					 * irrelevant if DPAA_VERSION==10
+					 */
+};
+
+#define ASK_CTRL_GET_OFFLINE_CHANNEL_INFO \
+	_IOWR(CDX_IOC_MAGIC, 8, struct ask_ctrl_offline_channel)
+#define ASK_CTRL_SET_DPDK_INFO \
+	_IOWR(CDX_IOC_MAGIC, 9, struct ask_ctrl_dpdk_fq_info_s)
+#define ASK_CTRL_SET_CLASSIF_INFO \
+	_IOWR(CDX_IOC_MAGIC, 10, struct rte_pmd_dpaa_uplink_cls_info_s)
+#define ASK_CTRL_RESET_CLASSIF_INFO \
+	_IOWR(CDX_IOC_MAGIC, 11, struct rte_pmd_dpaa_uplink_cls_info_s)
+#define ASK_CTRL_SET_LGW_INFO \
+	_IOWR(CDX_IOC_MAGIC, 12, struct rte_pmd_dpaa_lgw_info_s)
+#define ASK_CTRL_RESET_LGW_INFO \
+	_IOWR(CDX_IOC_MAGIC, 13, struct rte_pmd_dpaa_lgw_info_s)
+
+
+/* Return the control device descriptor, opening it on first use. */
+static int check_fd(void)
+{
+	int cur_fd, ret;
+
+	cur_fd = rte_atomic_load_explicit(&ask_fd, rte_memory_order_acquire);
+	if (cur_fd >= 0)
+		return cur_fd;
+
+	ret = pthread_mutex_lock(&fd_init_lock);
+	assert(!ret);
+	/* check again with the lock held */
+	cur_fd = rte_atomic_load_explicit(&ask_fd, rte_memory_order_relaxed);
+	if (cur_fd < 0) {
+		cur_fd = open(ASK_PATH, O_RDWR);
+		if (cur_fd >= 0)
+			rte_atomic_store_explicit(&ask_fd, cur_fd,
+						  rte_memory_order_release);
+	}
+	ret = pthread_mutex_unlock(&fd_init_lock);
+	assert(!ret);
+
+	return (cur_fd >= 0) ? cur_fd : -ENODEV;
+}
+
+static int ask_get_channel_info(struct ask_ctrl_offline_channel *ch_info)
+{
+	int ret, fd = check_fd();
+
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_GET_OFFLINE_CHANNEL_INFO, ch_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Get channel info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Get channel info successful");
+	DPAA_PMD_DEBUG("Channel id: %x", ch_info->channel_id);
+	DPAA_PMD_DEBUG("ctx_a_hi_val: %x", ch_info->ctx_a_hi_val);
+	DPAA_PMD_DEBUG("ctx_a_lo_val: %x", ch_info->ctx_a_lo_val);
+	DPAA_PMD_DEBUG("ctx_b_val: %x", ch_info->ctx_b_val);
+
+	return 0;
+}
+
+static int ask_set_fq_info(struct ask_ctrl_dpdk_fq_info_s *fq_info)
+{
+	int ret, fd = check_fd();
+
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_DPDK_INFO, fq_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set FQ info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set fq info successful");
+	DPAA_PMD_DEBUG("Tx fqid: %x", fq_info->tx_fq_id);
+	DPAA_PMD_DEBUG("Rx fqid: %x", fq_info->rx_fq_id);
+	DPAA_PMD_DEBUG("buff_size: %d", fq_info->buff_size);
+	DPAA_PMD_DEBUG("bp_id: %d", fq_info->bp_id);
+	DPAA_PMD_DEBUG("Backhaul port name: %s", fq_info->bh_port_name);
+
+	return 0;
+}
+
+static int
+dpaa_ol_dev_configure(__rte_unused struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+static int dpaa_ol_dev_info(struct rte_eth_dev *dev,
+			    struct rte_eth_dev_info *dev_info)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->max_rx_queues = dpaa_intf->nb_rx_queues;
+	dev_info->max_tx_queues = dpaa_intf->nb_tx_queues;
+	dev_info->max_rx_pktlen = DPAA_MAX_RX_PKT_LEN;
+	dev_info->max_mac_addrs = DPAA_MAX_MAC_FILTER;
+	dev_info->max_hash_mac_addrs = 0;
+	dev_info->max_vfs = 0;
+
+	dev_info->speed_capa = RTE_ETH_LINK_SPEED_10M_HD |
+			       RTE_ETH_LINK_SPEED_10M |
+			       RTE_ETH_LINK_SPEED_100M_HD |
+			       RTE_ETH_LINK_SPEED_100M |
+			       RTE_ETH_LINK_SPEED_1G |
+			       RTE_ETH_LINK_SPEED_2_5G |
+			       RTE_ETH_LINK_SPEED_10G;
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_set_classif_info, 26.11)
+int rte_pmd_dpaa_ol_set_classif_info(struct rte_pmd_dpaa_uplink_cls_info_s *classif_info)
+{
+	int i, ret, fd;
+
+	if (classif_info == NULL) {
+		DPAA_PMD_ERR("No classification data available");
+		return -EINVAL;
+	}
+
+	fd = check_fd();
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_CLASSIF_INFO, classif_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set classification info ioctl failed with errno: %s",
+			     strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set classification info successful");
+	for (i = 0; i < classif_info->num_ports; i++) {
+		DPAA_PMD_DEBUG("UDP dest port: %d",
+			       classif_info->gtp_udp_port[i]);
+	}
+	DPAA_PMD_DEBUG("Protocol ID: %d", classif_info->gtp_proto_id);
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_reset_classif_info, 26.11)
+int rte_pmd_dpaa_ol_reset_classif_info(void)
+{
+	struct rte_pmd_dpaa_uplink_cls_info_s classif_info;
+	int ret, fd;
+
+	fd = check_fd();
+	if (fd < 0)
+		return fd;
+
+	memset(&classif_info, 0, sizeof(classif_info));
+
+	ret = ioctl(fd, ASK_CTRL_RESET_CLASSIF_INFO, &classif_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Reset classification info ioctl failed with errno: %s",
+			     strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Reset classification info successful");
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_set_lgw_info, 26.11)
+int rte_pmd_dpaa_ol_set_lgw_info(struct rte_pmd_dpaa_lgw_info_s *lgw_info)
+{
+	int ret, fd;
+
+	if (lgw_info == NULL) {
+		DPAA_PMD_ERR("No LGW data available");
+		return -EINVAL;
+	}
+
+	fd = check_fd();
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_LGW_INFO, lgw_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set LGW info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set LGW info successful");
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_reset_lgw_info, 26.11)
+int rte_pmd_dpaa_ol_reset_lgw_info(void)
+{
+	struct rte_pmd_dpaa_lgw_info_s lgw_info;
+	int ret, fd;
+
+	PMD_INIT_FUNC_TRACE();
+
+	fd = check_fd();
+	if (fd < 0)
+		return fd;
+
+	memset(&lgw_info, 0, sizeof(lgw_info));
+
+	ret = ioctl(fd, ASK_CTRL_RESET_LGW_INFO, &lgw_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Reset LGW info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Reset LGW info successful");
+
+	return 0;
+}
+
+static int dpaa_ol_set_fq_info(struct rte_eth_dev *dev);
+
+static int dpaa_ol_dev_start(struct rte_eth_dev *dev)
+{
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Hand the Rx/Tx FQIDs and buffer pool to the kernel here rather than
+	 * from tx_queue_setup(): ethdev does not order Rx and Tx queue setup,
+	 * and testpmd sets Tx up first, so at tx_queue_setup() time the Rx
+	 * side may not be configured yet. By dev_start() both are known.
+	 */
+	ret = dpaa_ol_set_fq_info(dev);
+	if (ret)
+		return ret;
+
+	dev->tx_pkt_burst = dpaa_eth_queue_tx;
+
+	return 0;
+}
+
+static int dpaa_ol_dev_stop(struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
+
+	return 0;
+}
+
+static void dpaa_oldev_queues_release(struct dpaa_if *dpaa_intf);
+
+static int dpaa_ol_dev_close(struct rte_eth_dev *dev)
+{
+	struct dpaa_if *dpaa_intf;
+	int cur_fd;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	/* Release the driver private rx/tx_queues here so that an application
+	 * that only calls rte_eth_dev_close() (without removing the device)
+	 * still shuts down the FQs and frees the queue memory.
+	 */
+	dpaa_intf = dev->data->dev_private;
+	if (dpaa_intf)
+		dpaa_oldev_queues_release(dpaa_intf);
+
+	cur_fd = rte_atomic_exchange_explicit(&ask_fd, -1,
+					      rte_memory_order_acq_rel);
+	if (cur_fd >= 0)
+		close(cur_fd);
+
+	return 0;
+}
+
+static inline void
+dpaa_poll_queue_default_config(struct qm_mcc_initfq *opts)
+{
+	memset(opts, 0, sizeof(struct qm_mcc_initfq));
+	opts->we_mask = QM_INITFQ_WE_CONTEXTA;
+	opts->fqd.fq_ctrl = QM_FQCTRL_AVOIDBLOCK | QM_FQCTRL_CTXASTASHING |
+			    QM_FQCTRL_PREFERINCACHE;
+	opts->fqd.context_a.stashing.exclusive = 0;
+	if (dpaa_soc_ver() != SVR_LS1046A_FAMILY)
+		opts->fqd.context_a.stashing.annotation_cl =
+				DPAA_IF_RX_ANNOTATION_STASH;
+	opts->fqd.context_a.stashing.data_cl = DPAA_IF_RX_DATA_STASH;
+	opts->fqd.context_a.stashing.context_cl = DPAA_IF_RX_CONTEXT_STASH;
+}
+
+static
+int dpaa_ol_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
+			    __rte_unused uint16_t nb_desc,
+			    unsigned int socket_id __rte_unused,
+			    __rte_unused const struct rte_eth_rxconf *rx_conf,
+			    struct rte_mempool *mp)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct qman_fq *rxq = &dpaa_intf->rx_queues[queue_idx];
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (queue_idx >= dev->data->nb_rx_queues) {
+		rte_errno = EOVERFLOW;
+		DPAA_PMD_ERR("%p: queue index out of range (%u >= %u)",
+			     (void *)dev, queue_idx, dev->data->nb_rx_queues);
+		return -rte_errno;
+	}
+
+	dpaa_intf->bp_info = DPAA_MEMPOOL_TO_POOL_INFO(mp);
+	dpaa_intf->valid = 1;
+
+	if (!rte_dpaa_bpid_info) {
+		DPAA_PMD_ERR("BPID info array not initialized");
+		return -ENOMEM;
+	}
+	rxq->bp_array = rte_dpaa_bpid_info;
+	dev->data->rx_queues[queue_idx] = rxq;
+
+	return 0;
+}
+
+/* This API has dependency on RX queue setup */
+static int
+dpaa_ol_get_bh_port_name(struct rte_devargs *devargs, char *val, size_t size)
+{
+	struct rte_kvargs *kvlist;
+	const char *str;
+	int ret;
+
+	if (!devargs)
+		return 0;
+
+	kvlist = rte_kvargs_parse(devargs->args, NULL);
+	if (!kvlist)
+		return 0;
+
+	if (!rte_kvargs_count(kvlist, DRIVER_OL_BH_PORT)) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	str = rte_kvargs_get(kvlist, DRIVER_OL_BH_PORT);
+	if (str == NULL) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	ret = rte_strscpy(val, str, size);
+	rte_kvargs_free(kvlist);
+	if (ret < 0)
+		return ret;
+
+	return 1;
+}
+
+static
+int dpaa_ol_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
+			   uint16_t nb_desc __rte_unused,
+			   unsigned int socket_id __rte_unused,
+			   const struct rte_eth_txconf *tx_conf __rte_unused)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct qman_fq *txq = &dpaa_intf->tx_queues[queue_idx];
+
+	PMD_INIT_FUNC_TRACE();
+
+	dev->data->tx_queues[queue_idx] = txq;
+
+	return 0;
+}
+
+/* Program the Rx/Tx FQIDs and the buffer pool into the kernel. Called from
+ * dev_start(), by which point both the Rx and the Tx queue are set up.
+ */
+static int dpaa_ol_set_fq_info(struct rte_eth_dev *dev)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct ask_ctrl_dpdk_fq_info_s fq_info;
+	struct qman_fq *txq, *rxq;
+	struct rte_pktmbuf_pool_private *mbp_priv;
+	int ret;
+
+	if (dpaa_intf->rx_queues == NULL || dpaa_intf->tx_queues == NULL) {
+		DPAA_PMD_ERR("Rx/Tx queues not allocated");
+		return -EINVAL;
+	}
+
+	if (dpaa_intf->bp_info == NULL) {
+		DPAA_PMD_ERR("Rx queue must be set up before starting the port");
+		return -EINVAL;
+	}
+
+	txq = &dpaa_intf->tx_queues[0];
+	rxq = &dpaa_intf->rx_queues[0];
+	memset(&fq_info, 0, sizeof(fq_info));
+	mbp_priv = (struct rte_pktmbuf_pool_private *)rte_mempool_get_priv(dpaa_intf->bp_info->mp);
+	fq_info.tx_fq_id = txq->fqid;
+	fq_info.rx_fq_id = rxq->fqid;
+	fq_info.buff_size = mbp_priv->mbuf_data_room_size;
+	fq_info.bp_id = dpaa_intf->bp_info->bpid;
+
+	fq_info.privDataSize = DPAA_OL_PARSERSLT_START_OFFSET;
+	fq_info.passPrsResult = DPAA_OL_PARSE_RESULT_REQUIRED;
+	fq_info.passTimeStamp = DPAA_OL_TIME_STAMP_REQUIRED;
+	fq_info.passHashResult = DPAA_OL_HASH_RESULT_REQUIRED;
+	fq_info.passAllOtherPCDInfo = DPAA_OL_PCD_INFO_REQUIRED;
+	fq_info.dataAlign = DPAA_OL_DATA_ALIGNMENT;
+	fq_info.manipExtraSpace = DPAA_OL_MAX_EXTRA_SIZE;
+
+	ret = dpaa_ol_get_bh_port_name(dev->device->devargs,
+				       (char *)fq_info.bh_port_name,
+				       MAX_BH_PORT_NAME_LEN);
+	if (ret <= 0) {
+		DPAA_PMD_ERR("Offline port \"%s\" devarg not defined or invalid (ret=%d)",
+			     DRIVER_OL_BH_PORT, ret);
+		return -EINVAL;
+	}
+
+	ret = ask_set_fq_info(&fq_info);
+	if (ret) {
+		DPAA_PMD_ERR("Set FQ info failed with ret: %d", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int dpaa_ol_link_update(struct rte_eth_dev *dev,
+			       __rte_unused int wait_to_complete)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct rte_eth_link *link = &dev->data->dev_link;
+
+	PMD_INIT_FUNC_TRACE();
+
+	link->link_status = dpaa_intf->valid;
+	link->link_speed = RTE_ETH_SPEED_NUM_NONE;
+	link->link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+	link->link_autoneg = RTE_ETH_LINK_AUTONEG;
+
+	return 0;
+}
+
+static int dpaa_ol_promiscuous_enable(__rte_unused struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+static int dpaa_ol_rx_queue_init(struct qman_fq *fq, uint32_t fqid)
+{
+	int ret;
+	struct qm_mcc_initfq opts = {0};
+	u32 flags = QMAN_FQ_FLAG_DYNAMIC_FQID | QMAN_FQ_FLAG_NO_ENQUEUE;
+
+	if (unlikely(!DPAA_PER_LCORE_PORTAL)) {
+		ret = rte_dpaa_portal_init(NULL);
+		if (ret < 0) {
+			DPAA_PMD_ERR("portal initialization failure");
+			return ret;
+		}
+	}
+
+	ret = qman_create_fq(fqid, flags, fq);
+	if (ret) {
+		DPAA_PMD_ERR("create rx fqid 0x%x failed with ret: %d", fqid,
+			     ret);
+		return ret;
+	}
+	fq->is_static = false;
+
+	dpaa_poll_queue_default_config(&opts);
+
+	ret = qman_init_fq(fq, 0, &opts);
+	if (ret)
+		DPAA_PMD_ERR("init rx fqid 0x%x failed with ret:%d", fqid, ret);
+	return ret;
+}
+
+static int dpaa_ol_tx_queue_init(struct qman_fq *fq, uint32_t fqid)
+{
+	int ret;
+	struct qm_mcc_initfq opts = {0};
+	u32 flags = QMAN_FQ_FLAG_DYNAMIC_FQID | QMAN_FQ_FLAG_TO_DCPORTAL;
+	struct ask_ctrl_offline_channel ch_info;
+
+	memset(&ch_info, 0, sizeof(ch_info));
+
+	ret = ask_get_channel_info(&ch_info);
+	if (ret) {
+		DPAA_PMD_ERR("Get channel info failed with ret: %d", ret);
+		return ret;
+	}
+	ret = qman_create_fq(fqid, flags, fq);
+	if (ret) {
+		DPAA_PMD_ERR("Create tx fq failed with ret: %d", ret);
+		return ret;
+	}
+
+	opts.we_mask = QM_INITFQ_WE_DESTWQ |
+		       QM_INITFQ_WE_CONTEXTB | QM_INITFQ_WE_CONTEXTA;
+
+	opts.fqd.dest.channel = ch_info.channel_id;
+	opts.fqd.dest.wq = DPA_ISC_WQ_ID;
+	opts.fqd.fq_ctrl = QM_FQCTRL_PREFERINCACHE;
+	opts.fqd.context_b = ch_info.ctx_b_val;
+	opts.fqd.context_a.hi = ch_info.ctx_a_hi_val;
+	opts.fqd.context_a.lo = ch_info.ctx_a_lo_val;
+
+	opts.fqid = fq->fqid;
+	fq->ch_id = ch_info.channel_id;
+	opts.count = 1;
+
+	ret = qman_init_fq(fq, QMAN_INITFQ_FLAG_SCHED, &opts);
+	if (ret)
+		DPAA_PMD_ERR("init tx fqid 0x%x failed %d", fq->fqid, ret);
+	return ret;
+}
+
+static const struct eth_dev_ops dpaa_ol_devops = {
+		.dev_configure            = dpaa_ol_dev_configure,
+		.dev_start                = dpaa_ol_dev_start,
+		.dev_stop                 = dpaa_ol_dev_stop,
+		.dev_close                = dpaa_ol_dev_close,
+		.dev_infos_get            = dpaa_ol_dev_info,
+
+		.rx_queue_setup           = dpaa_ol_rx_queue_setup,
+		.tx_queue_setup           = dpaa_ol_tx_queue_setup,
+
+		.link_update              = dpaa_ol_link_update,
+		.promiscuous_enable       = dpaa_ol_promiscuous_enable,
+};
+
+static void dpaa_oldev_queues_release(struct dpaa_if *dpaa_intf)
+{
+	uint16_t i;
+	int ret;
+
+	if (dpaa_intf->tx_queues) {
+		for (i = 0; i < dpaa_intf->nb_tx_queues; i++) {
+			if (!dpaa_intf->tx_queues[i].fqid)
+				continue;
+			ret = qman_shutdown_fq(&dpaa_intf->tx_queues[i]);
+			if (ret) {
+				/* The FQ is still live in QMan, so the FQID
+				 * cannot be handed back: qman_alloc_fqid()
+				 * could give it to another user while the
+				 * hardware still references it. Leaking it
+				 * is the safe choice.
+				 */
+				DPAA_PMD_WARN("Failed(%d) to shutdown txq%d(0x%x), fqid not released",
+					      ret, i, dpaa_intf->tx_queues[i].fqid);
+				continue;
+			}
+			/* The FQ was created with QMAN_FQ_FLAG_DYNAMIC_FQID,
+			 * so qman_create_fq() allocated the FQID. Give it
+			 * back, otherwise every probe/close cycle leaks one.
+			 */
+			qman_release_fqid(dpaa_intf->tx_queues[i].fqid);
+		}
+		rte_free(dpaa_intf->tx_queues);
+		dpaa_intf->tx_queues = NULL;
+		dpaa_intf->nb_tx_queues = 0;
+	}
+
+	if (dpaa_intf->rx_queues) {
+		for (i = 0; i < dpaa_intf->nb_rx_queues; i++) {
+			if (!dpaa_intf->rx_queues[i].fqid)
+				continue;
+			ret = qman_shutdown_fq(&dpaa_intf->rx_queues[i]);
+			if (ret) {
+				/* Same as above: keep the FQID reserved. */
+				DPAA_PMD_WARN("Failed(%d) to shutdown rxq%d(0x%x), fqid not released",
+					      ret, i, dpaa_intf->rx_queues[i].fqid);
+				continue;
+			}
+			/* Same as above for the Rx FQs. */
+			qman_release_fqid(dpaa_intf->rx_queues[i].fqid);
+		}
+		rte_free(dpaa_intf->rx_queues);
+		dpaa_intf->rx_queues = NULL;
+		dpaa_intf->nb_rx_queues = 0;
+	}
+}
+
+static int dpaa_oldev_init(struct rte_eth_dev *eth_dev)
+{
+	int num_fqs, ret;
+	struct dpaa_if *dpaa_intf;
+
+	PMD_INIT_FUNC_TRACE();
+
+	num_fqs = DPAA_DEFAULT_NUM_PCD_QUEUES;
+	dpaa_intf = eth_dev->data->dev_private;
+
+	dpaa_intf->rx_queues = rte_zmalloc(NULL,
+					   sizeof(struct qman_fq) * num_fqs,
+					   MAX_CACHELINE);
+	if (!dpaa_intf->rx_queues) {
+		DPAA_PMD_ERR("Failed to alloc mem for RX queues");
+		return -ENOMEM;
+	}
+	/* Set the count as soon as the array exists so that the release
+	 * helper always walks the whole allocation on the error paths.
+	 */
+	dpaa_intf->nb_rx_queues = num_fqs;
+
+	ret = dpaa_ol_rx_queue_init(&dpaa_intf->rx_queues[0], 0);
+	if (ret)
+		goto free_rx;
+	dpaa_intf->rx_queues[0].dpaa_intf = dpaa_intf;
+
+	dpaa_intf->tx_queues = rte_zmalloc(NULL,
+					   sizeof(struct qman_fq) * num_fqs,
+					   MAX_CACHELINE);
+	if (!dpaa_intf->tx_queues) {
+		DPAA_PMD_ERR("Failed to alloc mem for TX queues");
+		ret = -ENOMEM;
+		goto free_rx;
+	}
+	dpaa_intf->nb_tx_queues = num_fqs;
+
+	ret = dpaa_ol_tx_queue_init(&dpaa_intf->tx_queues[0], 0);
+	if (ret)
+		goto free_rx;
+
+	eth_dev->dev_ops = &dpaa_ol_devops;
+	eth_dev->rx_pkt_burst = dpaa_eth_queue_rx;
+	eth_dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
+
+	/* Allocate memory for storing MAC addresses */
+	eth_dev->data->mac_addrs = rte_zmalloc("mac_addr",
+			RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER, 0);
+	if (eth_dev->data->mac_addrs == NULL) {
+		DPAA_PMD_ERR("Failed to allocate %d bytes needed to "
+			     "store MAC addresses",
+			     RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER);
+		ret = -ENOMEM;
+		goto free_rx;
+	}
+
+	return 0;
+
+free_rx:
+	dpaa_oldev_queues_release(dpaa_intf);
+	return ret;
+}
+
+static int dpaa_ol_probe(__rte_unused struct rte_dpaa_driver *dpaa_drv,
+			 struct rte_dpaa_device *dpaa_dev)
+{
+	int ret;
+	struct rte_eth_dev *eth_dev;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* The offline port's frame queues are created with dynamic FQIDs and
+	 * programmed into the kernel through the control device, all of which
+	 * is owned by the primary. A secondary has no way to attach to that
+	 * state, so do not advertise the port here rather than run
+	 * dpaa_oldev_init() against resources it does not own.
+	 */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		DPAA_PMD_WARN("%s: not supported in secondary process",
+			      dpaa_dev->device.name);
+		return -ENOTSUP;
+	}
+
+	eth_dev = rte_eth_dev_allocate(dpaa_dev->name);
+	if (!eth_dev)
+		return -ENOMEM;
+	eth_dev->data->dev_private = rte_zmalloc("ethdev private structure",
+						 sizeof(struct dpaa_if),
+						 RTE_CACHE_LINE_SIZE);
+	if (!eth_dev->data->dev_private) {
+		DPAA_PMD_ERR("Cannot allocate memzone for port data");
+		rte_eth_dev_release_port(eth_dev);
+		return -ENOMEM;
+	}
+
+	eth_dev->device = &dpaa_dev->device;
+
+	ret = dpaa_oldev_init(eth_dev);
+	if (ret == 0) {
+		rte_eth_dev_probing_finish(eth_dev);
+		return 0;
+	}
+
+	/* dpaa_oldev_init() has already released its own allocations. */
+	rte_eth_dev_release_port(eth_dev);
+	return ret;
+}
+
+static int dpaa_ol_remove(struct rte_dpaa_device *dpaa_dev)
+{
+	struct rte_eth_dev *eth_dev;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* A secondary never probed this device, see dpaa_ol_probe(). */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	eth_dev = rte_eth_dev_allocated(dpaa_dev->device.name);
+	if (eth_dev == NULL)
+		return 0;
+
+	/* Shut down the FQs and free the driver private rx/tx_queues. This is
+	 * idempotent, so it is safe even if the application already called
+	 * rte_eth_dev_close() (which runs the same callback).
+	 */
+	dpaa_ol_dev_close(eth_dev);
+
+	return rte_eth_dev_release_port(eth_dev);
+}
+
+static struct rte_dpaa_driver rte_dpaa_ol_pmd = {
+		.drv_type = FSL_DPAA_OL,
+		.probe = dpaa_ol_probe,
+		.remove = dpaa_ol_remove,
+};
+
+RTE_PMD_REGISTER_DPAA(ol_dpaa, rte_dpaa_ol_pmd);
+RTE_PMD_REGISTER_PARAM_STRING(ol_dpaa,
+		DRIVER_OL_BH_PORT "=<string>");
diff --git a/drivers/net/dpaa/meson.build b/drivers/net/dpaa/meson.build
index 8d4f69c596..3ec1091197 100644
--- a/drivers/net/dpaa/meson.build
+++ b/drivers/net/dpaa/meson.build
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright 2018-2020 NXP
+# Copyright 2018-2020,2026 NXP
 
 if not is_linux
     build = false
@@ -9,12 +9,13 @@ deps += ['mempool_dpaa']
 
 sources = files(
         'dpaa_ethdev.c',
-        'fmlib/fm_lib.c',
-        'fmlib/fm_vsp.c',
         'dpaa_flow.c',
-        'dpaa_rxtx.c',
         'dpaa_fmc.c',
         'dpaa_ptp.c',
+        'dpaa_oldev.c',
+        'dpaa_rxtx.c',
+        'fmlib/fm_lib.c',
+        'fmlib/fm_vsp.c',
 )
 
 cflags += no_wvla_cflag
@@ -24,4 +25,4 @@ if cc.has_argument('-Wno-pointer-arith')
     cflags += '-Wno-pointer-arith'
 endif
 
-headers = files('rte_pmd_dpaa.h')
+headers = files('rte_pmd_dpaa.h', 'rte_pmd_dpaa_oldev.h')
diff --git a/drivers/net/dpaa/rte_pmd_dpaa_oldev.h b/drivers/net/dpaa/rte_pmd_dpaa_oldev.h
new file mode 100644
index 0000000000..5ca25efcf2
--- /dev/null
+++ b/drivers/net/dpaa/rte_pmd_dpaa_oldev.h
@@ -0,0 +1,158 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2026 NXP
+ */
+
+#ifndef _RTE_PMD_DPAA_OLDEV_H
+#define _RTE_PMD_DPAA_OLDEV_H
+
+/**
+ * @file rte_pmd_dpaa_oldev.h
+ *
+ * NXP DPAA offline (O/H) port PMD-specific API.
+ *
+ * @warning
+ * @b EXPERIMENTAL:
+ * All functions in this file may be changed or removed without prior notice.
+ *
+ * These APIs configure the classification, local gateway (LGW) and related
+ * uplink information for the DPAA offline port through the kernel control
+ * device.
+ */
+
+#include <stdint.h>
+#include <rte_common.h>
+#include <rte_compat.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define DPA_ISC_IPV4_ADDR_TYPE  0x04
+#define DPA_ISC_IPV6_ADDR_TYPE  0x06
+
+#define DPDK_OLDEV_MAX_NUM_PORTS 2
+
+#define DPA_ISC_IPV4_SUBNET_TYPE  0x04
+#define DPA_ISC_IPV6_SUBNET_TYPE  0x06
+#define DPDK_OLDEV_MAX_NUM_SUBNETS 4
+
+/* following macros used for flags field */
+/* this macro should be set when addr pair consisting valid
+ * inner IP address
+ */
+#define DPDK_CLASSIF_INNER_IP 0x1
+
+/* this macro should be set when addr pair consisting static
+ * IP address
+ */
+#define DPDK_CLASSIF_STATIC_IP 0x2
+
+/* macro to indicate telecom application is listening on only
+ * static IP address
+ */
+#define DPDK_TELECOM_LISTEN_ON_ONLY_STATICIP 0x4
+
+/* macro to indicate that telecom application is listening on
+ * both static and inner IP addresses
+ */
+#define DPDK_TELECOM_LISTEN_ON_BOTH_STATIC_INNER_IP 0x8
+
+/* macro to indicate that telecom application is listening on
+ * only inner IP address
+ */
+#define DPDK_TELECOM_LISTEN_ON_ONLY_INNERIP 0x10
+
+/* Holds an IPv4 or IPv6 address; ip_addr[0] is used for IPv4, all four
+ * words for IPv6. The addr_type field in dpa_ip_pair_s selects the version.
+ */
+struct dpa_ip_addr_s {
+	uint32_t	ip_addr[4];
+};
+
+struct __rte_packed_begin dpa_ip_pair_s {
+	struct dpa_ip_addr_s static_ip, inner_ip;
+	uint8_t flags;
+	uint8_t addr_type;
+	uint8_t pad[2];
+} __rte_packed_end;
+
+struct __rte_packed_begin dpa_lgw_subnet_s {
+	uint32_t subnet[4];
+	uint8_t mask;
+	uint8_t subnet_type;
+	uint8_t pad[2];
+} __rte_packed_end;
+
+struct rte_pmd_dpaa_uplink_cls_info_s {
+	struct dpa_ip_pair_s	addr_pair;
+	/* DPDK app listens on these GTP ports */
+	uint16_t	gtp_udp_port[DPDK_OLDEV_MAX_NUM_PORTS];
+	uint8_t		gtp_proto_id; /* DPDK app listens on UDP protocol */
+	uint8_t		num_ports;
+	uint8_t		sec_enabled;
+	uint8_t		pad;
+};
+
+struct __rte_packed_begin rte_pmd_dpaa_lgw_info_s {
+	struct dpa_lgw_subnet_s subnets[DPDK_OLDEV_MAX_NUM_SUBNETS];
+	uint8_t		num_subnets;
+	uint8_t		pad[3];
+} __rte_packed_end;
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Program the uplink classification information for the DPAA offline port.
+ *
+ * @param cls_info
+ *   Pointer to the classification information to program. Must not be NULL.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_set_classif_info(struct rte_pmd_dpaa_uplink_cls_info_s *cls_info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Reset the uplink classification information for the DPAA offline port.
+ *
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_reset_classif_info(void);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Program the local gateway (LGW) information for the DPAA offline port.
+ *
+ * @param lgw_info
+ *   Pointer to the LGW information to program. Must not be NULL.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_set_lgw_info(struct rte_pmd_dpaa_lgw_info_s *lgw_info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Reset the local gateway (LGW) information for the DPAA offline port.
+ *
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_reset_lgw_info(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PMD_DPAA_OLDEV_H */
-- 
2.25.1


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

* [PATCH v1 2/3] net/dpaa: support non fmX-macY type of shared Ethernet name
  2026-10-28  8:55 [PATCH v1 0/3] DPAA driver changes Gagandeep Singh
  2026-10-28  8:55 ` [PATCH v1 1/3] drivers: add offline (O/H) port device support Gagandeep Singh
@ 2026-10-28  8:55 ` Gagandeep Singh
  2026-10-28  8:55 ` [PATCH v1 3/3] drivers: add DPAA cgrid cleanup support Gagandeep Singh
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-10-28  8:55 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

A shared MAC interface needs the kernel netdev name to read the MTU,
and that name is only the DPDK port name for fmX-macY style netdevs.

Look it up in sysfs under the platform device of the dpa-ethernet node
the port was created from, and fall back to the port name.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/nics/dpaa.rst       |  5 +++
 drivers/net/dpaa/dpaa_ethdev.c | 59 +++++++++++++++++++++++++++++++++-
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst
index 667b8c113d..14a14feb3c 100644
--- a/doc/guides/nics/dpaa.rst
+++ b/doc/guides/nics/dpaa.rst
@@ -303,6 +303,11 @@ is passed through the EAL bus arguments. The bus name is ``dpaa_bus``:
    silently drops that port.
 
 
+* For a shared MAC interface the kernel network interface name is looked up
+  in sysfs from the device tree node the port was created from,
+  so a kernel interface that does not follow
+  the ``fmX-macY`` naming style is handled without extra configuration.
+
 FMAN Config
 -----------
 
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index fe49c7b961..456e3df995 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -15,6 +15,7 @@
 #include <sys/types.h>
 #include <sys/syscall.h>
 #include <sys/ioctl.h>
+#include <dirent.h>
 
 #include <eal_export.h>
 #include <rte_string_fns.h>
@@ -57,6 +58,53 @@
 #define DRIVER_RECV_ERR_PKTS      "recv_err_pkts"
 #define RTE_PRIORITY_103 103
 
+/*
+ * Get the name of the kernel netdev bound to the same device tree node as
+ * this port. Returns 1 on success, 0 if none was found, negative on error.
+ */
+static int
+dpaa_get_kernel_ifname(const char *node_path, char *name, size_t size)
+{
+	char path[PATH_MAX];
+	const char *node;
+	struct dirent *entry;
+	DIR *dir;
+	int ret;
+
+	if (!node_path || node_path[0] == '\0')
+		return 0;
+
+	/* Platform device name is the last node of the DTS path. */
+	node = strrchr(node_path, '/');
+	node = node ? node + 1 : node_path;
+	if (node[0] == '\0')
+		return 0;
+
+	ret = snprintf(path, sizeof(path),
+		       "/sys/bus/platform/devices/%s/net", node);
+	if (ret < 0 || (size_t)ret >= sizeof(path))
+		return -ENAMETOOLONG;
+
+	dir = opendir(path);
+	if (!dir)
+		return 0;
+
+	ret = 0;
+	while ((entry = readdir(dir)) != NULL) {
+		if (entry->d_name[0] == '.')
+			continue;
+		if (rte_strscpy(name, entry->d_name, size) < 0) {
+			ret = -ENAMETOOLONG;
+			break;
+		}
+		ret = 1;
+		break;
+	}
+
+	closedir(dir);
+	return ret;
+}
+
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		RTE_ETH_RX_OFFLOAD_SCATTER;
@@ -251,6 +299,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	int speed, duplex;
 	int ret, rx_status, socket_fd;
 	struct ifreq ifr;
+	char sh_if_name[IFNAMSIZ];
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -272,7 +321,15 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 			DPAA_PMD_ERR("Cannot open IF socket");
 			return -errno;
 		}
-		strlcpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
+
+		/* The DPDK port name matches the netdev only for fmX-macY. */
+		sh_if_name[0] = '\0';
+		ret = dpaa_get_kernel_ifname(__fif->node_path, sh_if_name,
+					     sizeof(sh_if_name));
+		if (ret <= 0 || sh_if_name[0] == '\0')
+			strlcpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
+		else
+			strlcpy(ifr.ifr_name, sh_if_name, IFNAMSIZ);
 
 		if (ioctl(socket_fd, SIOCGIFMTU, &ifr) < 0) {
 			DPAA_PMD_ERR("Cannot get interface mtu");
-- 
2.25.1


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

* [PATCH v1 3/3] drivers: add DPAA cgrid cleanup support
  2026-10-28  8:55 [PATCH v1 0/3] DPAA driver changes Gagandeep Singh
  2026-10-28  8:55 ` [PATCH v1 1/3] drivers: add offline (O/H) port device support Gagandeep Singh
  2026-10-28  8:55 ` [PATCH v1 2/3] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
@ 2026-10-28  8:55 ` Gagandeep Singh
  2026-10-28 14:41 ` [PATCH v1 0/3] DPAA driver changes Stephen Hemminger
  2026-10-30  4:43 ` [PATCH v2 0/4] " Gagandeep Singh
  4 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-10-28  8:55 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, Jun Yang

From: Jun Yang <jun.yang@nxp.com>

A congestion group must have no member frame queues left when it is
deleted, and its CGRID must be returned to the allocator once the group
is gone. Neither was handled on the net/dpaa close and probe-failure
paths.

This also changes probe behaviour: a qman_create_cgr() failure in
dpaa_rx_queue_init() or dpaa_tx_queue_init() now fails the probe
instead of continuing without tail drop on that queue. The probe error
path deletes one CGR per initialised queue, and a CGR whose creation
failed was never linked into the portal list.

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/dpaa/base/qbman/qman.c       |  61 ++++++++++++
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   1 +
 drivers/bus/dpaa/include/fsl_qman.h      |  27 ++++++
 drivers/net/dpaa/dpaa_ethdev.c           | 117 ++++++++++++++++++++---
 4 files changed, 194 insertions(+), 12 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 3c056e4547..fa3387c6bd 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -2993,3 +2993,64 @@ qman_shutdown_fq(struct qman_fq *fq)
 out:
 	return ret;
 }
+
+int qman_pending_fq_by_cgrid_range(u32 cgrid_start, u32 cgrid_num,
+	u32 start_fqid, u32 *fqid, u32 *cgrid)
+{
+	struct qman_fq fq = {
+		.fqid = start_fqid ? start_fqid : 1
+	};
+	struct qm_mcr_queryfq_np np;
+	struct qm_fqd fqd;
+	int err;
+
+	/*
+	 * Do not use the CGR byte count to decide whether to scan. An FQ is a
+	 * member of the group whenever it is scheduled with CGE set and a
+	 * matching cgid, whether or not it currently holds any frames, and the
+	 * group cannot be deleted while such a member exists. Skipping the
+	 * scan for an empty CGR would let an idle stale FQ survive and its
+	 * CGRID be released while still referenced. This runs from the device
+	 * close path only, so the scan cost is acceptable.
+	 *
+	 * The whole CGRID range of a port is matched in a single pass, so a
+	 * port with many congestion groups does not need one full FQID space
+	 * scan per group.
+	 */
+	DPAA_BUS_DEBUG("Scanning FQs for cgrid(0x%x..0x%x)",
+		cgrid_start, cgrid_start + cgrid_num - 1);
+
+	/* FQID space is 24 bits wide; stop before wrapping. */
+	for (; fq.fqid <= QMAN_MAX_FQID; fq.fqid++) {
+		err = qman_query_fq_np(&fq, &np);
+		if (err == -ERANGE) {
+			/*
+			 * FQID is not implemented on this device, so there is
+			 * nothing beyond it either.
+			 */
+			break;
+		} else if (err) {
+			DPAA_BUS_WARN("Failed(%d) to Query np FQ(fqid=0x%x)",
+				err, fq.fqid);
+			return err;
+		}
+		if ((np.state & QM_MCR_NP_STATE_MASK) != QM_MCR_NP_STATE_OOS) {
+			err = qman_query_fq(&fq, &fqd);
+			if (err) {
+				DPAA_BUS_WARN("Failed(%d) to Query FQ(fqid=0x%x)",
+					err, fq.fqid);
+			} else if ((fqd.fq_ctrl & QM_FQCTRL_CGE) &&
+				fqd.cgid >= cgrid_start &&
+				fqd.cgid < cgrid_start + cgrid_num) {
+				if (fqid)
+					*fqid = fq.fqid;
+				if (cgrid)
+					*cgrid = fqd.cgid;
+				return 0;
+			}
+		}
+	}
+	DPAA_BUS_DEBUG("No FQ left in cgrid(0x%x..0x%x)",
+		cgrid_start, cgrid_start + cgrid_num - 1);
+	return -ERANGE;
+}
diff --git a/drivers/bus/dpaa/dpaa_bus_base_symbols.c b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
index aaa9f9bec2..4da43f293d 100644
--- a/drivers/bus/dpaa/dpaa_bus_base_symbols.c
+++ b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
@@ -57,6 +57,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(qman_reserve_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_pool_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_cgrid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_release_cgrid_range)
+RTE_EXPORT_INTERNAL_SYMBOL(qman_pending_fq_by_cgrid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_intr_enable)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_intr_disable)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_get_ioctl_version_number)
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index b2674ce5d0..6d76722275 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1284,6 +1284,9 @@ struct qman_cgr {
  */
 #define QMAN_FQRN_WAIT_MAX		10000000u
 
+/* Maximum FQID value: frame queue IDs are 24 bits wide. */
+#define QMAN_MAX_FQID			0x00FFFFFFu
+
 /* Flags to qman_create_fq() */
 #define QMAN_FQ_FLAG_NO_ENQUEUE      0x00000001 /* can't enqueue */
 #define QMAN_FQ_FLAG_NO_MODIFY       0x00000002 /* can only enqueue */
@@ -1916,6 +1919,30 @@ static inline int qman_shutdown_fq_by_fqid(u32 fqid)
 	return qman_shutdown_fq(&fq);
 }
 
+/**
+ * qman_pending_fq_by_cgrid_range - Find an FQ still attached to a CGR range.
+ *
+ * @cgrid_start: first congestion group id of the range to search for.
+ * @cgrid_num: number of consecutive congestion group ids in the range.
+ * @start_fqid: FQID to begin the scan from (0 or 1 means scan from the
+ *   start). A caller shutting down several stale FQs can pass the previously
+ *   returned FQID + 1 to resume the scan instead of restarting from the
+ *   beginning each time.
+ * @fqid: on success, holds the FQID that is still attached to the range.
+ * @cgrid: on success, holds the congestion group id that FQ belongs to.
+ *   May be NULL.
+ *
+ * Matching a whole range in one pass lets a caller with many congestion
+ * groups, such as a port releasing all of its Rx or Tx CGRs, avoid one full
+ * FQID space scan per group.
+ *
+ * Return 0 and set *fqid when a matching FQ is found, -ERANGE when none is
+ * left, or a negative error code on query failure.
+ */
+__rte_internal
+int qman_pending_fq_by_cgrid_range(u32 cgrid_start, u32 cgrid_num,
+		u32 start_fqid, u32 *fqid, u32 *cgrid);
+
 /**
  * qman_reserve_fqid_range - Reserve the specified range of frame queue IDs
  * @fqid: the base FQID of the range to deallocate
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 456e3df995..3aa4206476 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -105,6 +105,9 @@ dpaa_get_kernel_ifname(const char *node_path, char *name, size_t size)
 	return ret;
 }
 
+/* Maximum number of stale frame queues cleaned up per congestion group. */
+#define DPAA_CGR_STALE_FQ_MAX     64
+
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		RTE_ETH_RX_OFFLOAD_SCATTER;
@@ -576,6 +579,44 @@ static int dpaa_eth_dev_stop(struct rte_eth_dev *dev)
 	return 0;
 }
 
+/* Shut down any frame queue still linked to this CGR.
+ *
+ * A CGR must have no members left when it is deleted. FQs left behind by a
+ * previous run of the application are not owned by this process, so they can
+ * only be found by asking QMan. There may be more than one, hence the loop.
+ */
+static void
+dpaa_cgr_stale_fq_cleanup(struct rte_eth_dev *dev, uint32_t cgrid_start,
+			  uint32_t cgrid_num, const char *dir)
+{
+	uint32_t start_fqid = 1;
+	uint32_t fqid, cgrid;
+	uint32_t loop, max_loop;
+	int ret;
+
+	max_loop = cgrid_num * DPAA_CGR_STALE_FQ_MAX;
+	for (loop = 0; loop < max_loop; loop++) {
+		if (qman_pending_fq_by_cgrid_range(cgrid_start, cgrid_num,
+						   start_fqid, &fqid, &cgrid))
+			break;
+		/* Should be FQ not cleaned in previous program. */
+		DPAA_PMD_DEBUG("FQ(fqid=0x%x) with %s cgid=%d is still alive?",
+			fqid, dir, cgrid);
+		ret = qman_shutdown_fq_by_fqid(fqid);
+		if (ret) {
+			DPAA_PMD_WARN("%s: Failed(%d) to shutdown %s cgid=%d's fq(fqid=0x%x)",
+				dev->data->name, ret, dir, cgrid, fqid);
+			/* Do not spin on an FQ that refuses to shut down. */
+			break;
+		}
+		/* Resume the scan past the FQ just handled instead of
+		 * restarting from the beginning, which would be O(N^2) for
+		 * N stale FQs.
+		 */
+		start_fqid = fqid + 1;
+	}
+}
+
 static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 {
 	struct fman_if *fif = dev->process_private;
@@ -585,7 +626,7 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 	struct rte_eth_link *link = &dev->data->dev_link;
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 	struct qman_fq *fq;
-	int loop;
+	uint32_t loop;
 	int ret;
 
 	PMD_INIT_FUNC_TRACE();
@@ -660,6 +701,11 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 	/* Release congestion Groups after releasing FQIDs */
 	/* Release RX congestion Groups */
 	if (dpaa_intf->cgr_rx) {
+		/* The CGRIDs are a contiguous range, so one scan of the FQID
+		 * space covers all of them.
+		 */
+		dpaa_cgr_stale_fq_cleanup(dev, dpaa_intf->cgr_rx[0].cgrid,
+					  dpaa_intf->nb_rx_queues, "rx");
 		for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) {
 			ret = qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
 			if (ret) {
@@ -667,12 +713,15 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 					dev->data->name, loop, ret);
 			}
 		}
+		qman_release_cgrid_range(dpaa_intf->cgr_rx[0].cgrid, dpaa_intf->nb_rx_queues);
 		rte_free(dpaa_intf->cgr_rx);
 		dpaa_intf->cgr_rx = NULL;
 	}
 
 	/* Release TX congestion Groups */
 	if (dpaa_intf->cgr_tx) {
+		dpaa_cgr_stale_fq_cleanup(dev, dpaa_intf->cgr_tx[0].cgrid,
+					  MAX_DPAA_CORES, "tx");
 		for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
 			ret = qman_delete_cgr(&dpaa_intf->cgr_tx[loop]);
 			if (ret) {
@@ -680,6 +729,8 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 					dev->data->name, loop, ret);
 			}
 		}
+		qman_release_cgrid_range(dpaa_intf->cgr_tx[0].cgrid,
+					 MAX_DPAA_CORES);
 		rte_free(dpaa_intf->cgr_tx);
 		dpaa_intf->cgr_tx = NULL;
 	}
@@ -2030,19 +2081,32 @@ static int dpaa_rx_queue_init(struct qman_fq *fq, struct qman_cgr *cgr_rx,
 		ret = qman_create_cgr(cgr_rx, QMAN_CGR_FLAG_USE_INIT,
 				      &cgr_opts);
 		if (ret) {
-			DPAA_PMD_WARN(
-				"rx taildrop init fail on rx fqid 0x%x(ret=%d)",
+			/* Do not fall back to running without the CGR. The
+			 * caller counts one CGR per queue it initialised and
+			 * deletes cgr_rx[0..n) on its error path, so a queue
+			 * without a CGR would make it delete an object that
+			 * was never added to the portal list, whose node is
+			 * still zeroed from rte_zmalloc().
+			 */
+			DPAA_PMD_ERR("rx taildrop init fail on rx fqid 0x%x(ret=%d)",
 				fq->fqid, ret);
-			goto without_cgr;
+			return ret;
 		}
 		opts.we_mask |= QM_INITFQ_WE_CGID;
 		opts.fqd.cgid = cgr_rx->cgrid;
 		opts.fqd.fq_ctrl |= QM_FQCTRL_CGE;
 	}
-without_cgr:
+
 	ret = qman_init_fq(fq, 0, &opts);
-	if (ret)
+	if (ret) {
 		DPAA_PMD_ERR("init rx fqid 0x%x failed with ret:%d", fqid, ret);
+		/* The caller only counts this CGR once this function returns
+		 * success, so its error path will not delete it. Unlink it here
+		 * or the portal keeps a pointer into memory the caller frees.
+		 */
+		if (cgr_rx)
+			qman_delete_cgr(cgr_rx);
+	}
 	return ret;
 }
 
@@ -2121,10 +2185,12 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 		ret = qman_create_cgr(cgr_tx, QMAN_CGR_FLAG_USE_INIT,
 				      &cgr_opts);
 		if (ret) {
-			DPAA_PMD_WARN(
-				"rx taildrop init fail on rx fqid 0x%x(ret=%d)",
+			/* See the equivalent comment in
+			 * dpaa_rx_queue_init().
+			 */
+			DPAA_PMD_ERR("tx taildrop init fail on tx fqid 0x%x(ret=%d)",
 				fq->fqid, ret);
-			goto without_cgr;
+			return ret;
 		}
 		opts.we_mask |= QM_INITFQ_WE_CGID;
 		opts.fqd.cgid = cgr_tx->cgrid;
@@ -2132,10 +2198,14 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 		DPAA_PMD_DEBUG("Tx FQ tail drop enabled, threshold = %d",
 				td_tx_threshold);
 	}
-without_cgr:
+
 	ret = qman_init_fq(fq, QMAN_INITFQ_FLAG_SCHED, &opts);
-	if (ret)
+	if (ret) {
 		DPAA_PMD_ERR("init tx fqid 0x%x failed %d", fq->fqid, ret);
+		/* See the equivalent comment in dpaa_rx_queue_init(). */
+		if (cgr_tx)
+			qman_delete_cgr(cgr_tx);
+	}
 	return ret;
 }
 
@@ -2307,6 +2377,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	int num_rx_fqs, fqid;
 	int loop, ret = 0;
 	int dev_id;
+	int nb_rx_cgr = 0, nb_tx_cgr = 0;
+	bool rx_cgrid_allocated = false, tx_cgrid_allocated = false;
 	struct rte_dpaa_device *dpaa_device;
 	struct dpaa_if *dpaa_intf;
 	struct fm_eth_port_cfg *cfg;
@@ -2428,6 +2500,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			ret = -EINVAL;
 			goto free_rx;
 		}
+		rx_cgrid_allocated = true;
 	} else {
 		dpaa_intf->cgr_rx = NULL;
 	}
@@ -2462,6 +2535,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			fqid);
 		if (ret)
 			goto free_rx;
+		if (dpaa_intf->cgr_rx)
+			nb_rx_cgr++;
 		dpaa_intf->rx_queues[loop].vsp_id = vsp_id;
 		dpaa_intf->rx_queues[loop].dpaa_intf = dpaa_intf;
 	}
@@ -2502,11 +2577,11 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			ret = -EINVAL;
 			goto free_tx;
 		}
+		tx_cgrid_allocated = true;
 	} else {
 		dpaa_intf->cgr_tx = NULL;
 	}
 
-
 	for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
 		if (dpaa_intf->cgr_tx)
 			dpaa_intf->cgr_tx[loop].cgrid = cgrid_tx[loop];
@@ -2517,6 +2592,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			dpaa_intf->cgr_tx ? &dpaa_intf->cgr_tx[loop] : NULL);
 		if (ret)
 			goto free_tx;
+		if (dpaa_intf->cgr_tx)
+			nb_tx_cgr++;
 
 		if (dpaa_intf->ts_enable) {
 			ret = dpaa_tx_conf_queue_init(&dpaa_intf->tx_conf_queues[loop]);
@@ -2596,6 +2673,15 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	return 0;
 
 free_tx:
+	/* Every created Tx CGR was linked into the QMan portal's cgr_cbs
+	 * list by qman_create_cgr(). Delete them before freeing cgr_tx so
+	 * the portal does not retain dangling pointers into freed memory,
+	 * then release the reserved CGRID range.
+	 */
+	for (loop = 0; loop < nb_tx_cgr; loop++)
+		qman_delete_cgr(&dpaa_intf->cgr_tx[loop]);
+	if (tx_cgrid_allocated)
+		qman_release_cgrid_range(cgrid_tx[0], MAX_DPAA_CORES);
 	rte_free(dpaa_intf->tx_conf_queues);
 	dpaa_intf->tx_conf_queues = NULL;
 	rte_free(dpaa_intf->tx_queues);
@@ -2603,8 +2689,15 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	dpaa_intf->nb_tx_queues = 0;
 
 free_rx:
+	/* Same as above for the Rx CGRs. */
+	for (loop = 0; loop < nb_rx_cgr; loop++)
+		qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
+	if (rx_cgrid_allocated)
+		qman_release_cgrid_range(cgrid[0], num_rx_fqs);
 	rte_free(dpaa_intf->cgr_rx);
+	dpaa_intf->cgr_rx = NULL;
 	rte_free(dpaa_intf->cgr_tx);
+	dpaa_intf->cgr_tx = NULL;
 	rte_free(dpaa_intf->rx_queues);
 	dpaa_intf->rx_queues = NULL;
 	dpaa_intf->nb_rx_queues = 0;
-- 
2.25.1


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

* Re: [PATCH v1 0/3] DPAA driver changes
  2026-10-28  8:55 [PATCH v1 0/3] DPAA driver changes Gagandeep Singh
                   ` (2 preceding siblings ...)
  2026-10-28  8:55 ` [PATCH v1 3/3] drivers: add DPAA cgrid cleanup support Gagandeep Singh
@ 2026-10-28 14:41 ` Stephen Hemminger
  2026-10-30  4:43   ` Gagandeep Singh
  2026-10-30  4:43 ` [PATCH v2 0/4] " Gagandeep Singh
  4 siblings, 1 reply; 33+ messages in thread
From: Stephen Hemminger @ 2026-10-28 14:41 UTC (permalink / raw)
  To: Gagandeep Singh; +Cc: dev, hemant.agrawal

On Wed, 28 Oct 2026 14:25:14 +0530
Gagandeep Singh <g.singh@nxp.com> wrote:

>  - Adding OH port support.
>  - Updates in shared ethernet code.
>  - Congestion related code cleanup.
> 
> Gagandeep Singh (1):
>   drivers: add offline (O/H) port device support
> 
> Hemant Agrawal (1):
>   net/dpaa: support non fmX-macY type of shared Ethernet name
> 
> Jun Yang (1):
>   drivers: add DPAA cgrid cleanup support
> 
>  doc/api/doxy-api-index.md                |   1 +
>  doc/guides/nics/dpaa.rst                 |  32 +
>  drivers/bus/dpaa/base/fman/fman.c        |  19 +
>  drivers/bus/dpaa/base/qbman/qman.c       |  61 ++
>  drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
>  drivers/bus/dpaa/dpaa_bus.c              | 100 ++-
>  drivers/bus/dpaa/dpaa_bus_base_symbols.c |   2 +
>  drivers/bus/dpaa/include/fman.h          |   6 +-
>  drivers/bus/dpaa/include/fsl_qman.h      |  28 +
>  drivers/net/dpaa/dpaa_ethdev.c           | 176 ++++-
>  drivers/net/dpaa/dpaa_ethdev.h           |   3 +
>  drivers/net/dpaa/dpaa_flow.c             |   7 +-
>  drivers/net/dpaa/dpaa_oldev.c            | 875 +++++++++++++++++++++++
>  drivers/net/dpaa/meson.build             |  11 +-
>  drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 158 ++++
>  15 files changed, 1454 insertions(+), 29 deletions(-)
>  create mode 100644 drivers/net/dpaa/dpaa_oldev.c
>  create

AI review found issues. The biggest one is carrying vendor private
ioctl data structures in DPDK.

Review of [PATCH v1 0/3] DPAA offline port, shared MAC, cgrid cleanup

Series
------

The rte_pmd_dpaa_ol_* functions do not operate on a DPDK port. They
take no port_id and only forward a caller-filled struct to an
out-of-tree kernel driver through ioctl() on /dev/cdx_ctrl. That puts
a vendor kernel ioctl ABI (GTP classification, "telecom application"
flags) into an installed DPDK header under DPDK API/ABI rules. An
application can issue these ioctls itself; this belongs in the vendor
userspace library for that kernel module, not in DPDK. Please drop
rte_pmd_dpaa_oldev.h and the four exported functions.

The drv_oldev bus argument is redundant. The offline port is only
probed if "-a dpaa_bus:oldev1" is given anyway, so create the oldev1
device when its devargs exist and drop drv_oldev, the bus_str parsing,
and the allowlist caveats in dpaa.rst:

	if (rte_bus_find_devargs(&rte_dpaa_bus, "oldev1") != NULL) {
		/* create oldev1 */
	}

No release notes for the new port type. dpaa.rst does not say the
offline port needs the /dev/cdx_ctrl kernel driver or where to get it.


Patch 1/3 drivers: add offline (O/H) port device support
--------------------------------------------------------

Error

dpaa_oldev_init() never sets tx_queues[0].dpaa_intf, and the queue
array comes from rte_zmalloc(), so it is NULL. dpaa_eth_queue_tx()
starts with:

	struct dpaa_if *dpaa_intf = fq->dpaa_intf;
	...
	if (unlikely(dpaa_intf->ts_enable)) {

so the first Tx burst after dev_start dereferences NULL. Set it after
the Tx FQ is initialised:

	ret = dpaa_ol_tx_queue_init(&dpaa_intf->tx_queues[0], 0);
	if (ret)
		goto free_rx;
	dpaa_intf->tx_queues[0].dpaa_intf = dpaa_intf;

Warning

rte_kvargs_count() only tests for presence, so "drv_oldev=0" enables
the offline port. Moot if drv_oldev is removed as above; otherwise
parse the value with rte_kvargs_process().

dev_close() shuts down the Rx/Tx FQs and returns their FQIDs to the
allocator, but the kernel was given those FQIDs and the bpid through
ASK_CTRL_SET_DPDK_INFO and is never told they are gone. The next
qman_alloc_fqid() user can receive frames the kernel enqueues to a
reused FQID. The kernel side needs a reset ioctl issued before the
FQIDs are released.

The cell-index range checks in fman_if_init() and fman_if_init_onic()
fix an out-of-bounds read of mac_idx[] and have nothing to do with the
offline port. The commit message does not mention them, nor the
MEMMAC_REG_OFFSET removal. Split the bounds checks into their own patch
with:

	Fixes: a0edbb8a8e52 ("bus/dpaa: add OH port mode")
	Fixes: 7e5f49ae767d ("bus/dpaa: add ONIC port mode")
	Cc: stable@dpdk.org

drv_bh_port is required, but it is parsed on every dev_start() with a
NULL key list, so a misspelled key is accepted at probe and the port
only fails at start. Parse it once in dpaa_ol_probe() with a valid key
list, store it in the private data, and fail probe if it is missing.

If rte_pmd_dpaa_oldev.h stays, the installed header defines DPA_ISC_*,
DPDK_OLDEV_*, DPDK_CLASSIF_*, DPDK_TELECOM_* and struct dpa_* without
an RTE_/rte_ prefix, and none of the structs or fields have Doxygen.

Info

dpaa_ol_rx_queue_setup() checks queue_idx against nb_rx_queues; ethdev
already does that before calling the PMD.

open(ASK_PATH, O_RDWR) should use O_RDWR | O_CLOEXEC.

In dpaa_create_device_list(), use snprintf() rather than sprintf(), and
drop the memset() after calloc() and the "int i = 0" initialiser.

rte_dpaa_bus_dev_build() gates the num_ethports messages on
oldev_enabled; the condition that matters is dpaa_netcfg != NULL.

The dpaa_bus_parse_bus_args() comment refers to a previous
environment-variable configuration that never existed upstream. The
bh_port_name field comment says "for testing purpose" but the field is
mandatory.


Patch 2/3 net/dpaa: support non fmX-macY type of shared Ethernet name
---------------------------------------------------------------------

Warning

Platform devices created from device-tree nodes without a reg property
are named after the whole parent chain, which is why dpaa_bus.c uses
"/sys/devices/platform/soc/soc:fsl,dpaa". A dpa-ethernet child of that
node is not "ethernet@N" under /sys/bus/platform/devices, so

	node = strrchr(node_path, '/');
	...
	"/sys/bus/platform/devices/%s/net", node

misses and silently falls back to the port name, which is the case the
patch is meant to fix. Match on the netdev's of_node instead:

	/* for each /sys/class/net/<if> */
	snprintf(path, sizeof(path), "/sys/class/net/%s/device/of_node",
		 ifname);
	if (realpath(path, resolved) != NULL &&
	    strcmp(resolved + strlen("/sys/firmware/devicetree/base"),
		   node_path) == 0)
		/* found */

Info

The new dpaa.rst bullet lands at the end of the bus devargs block; it
belongs with the shared MAC description.


Patch 3/3 drivers: add DPAA cgrid cleanup support
-------------------------------------------------

Warning

This fixes a CGRID leak on close and a stale portal list entry on probe
failure, but has no Fixes: tag or stable Cc:

	Fixes: 62f53995caaf ("net/dpaa: add frame count based tail drop with CGR")
	Fixes: 9124e65dd3eb ("net/dpaa: enable Tx queue taildrop")
	Cc: stable@dpdk.org

On the probe error path the initialised Rx FQs (and Tx FQs on free_tx)
were scheduled with QM_FQCTRL_CGE and their cgid, and are never shut
down before

	for (loop = 0; loop < nb_rx_cgr; loop++)
		qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
	if (rx_cgrid_allocated)
		qman_release_cgrid_range(cgrid[0], num_rx_fqs);

That deletes CGRs that still have members, which the commit message
says must not happen, and hands the CGRIDs to the next probe while live
FQs reference them. Shut down the FQs initialised so far before
deleting the CGRs.

dev_close() releases the CGRID range unconditionally, even when
dpaa_cgr_stale_fq_cleanup() hit an FQ that would not shut down or
qman_delete_cgr() failed. 1/3 deliberately leaks FQIDs in that case;
do the same here and skip qman_release_cgrid_range() if any delete or
shutdown failed.

dpaa_eth_dev_stop() and dpaa_eth_dev_close() never shut down the
port's own Rx/Tx FQs, so the FQs dpaa_cgr_stale_fq_cleanup() finds at
close are this port's live queues, not ones "not cleaned in previous
program". The driver already holds their FQIDs. Shut them down directly
before deleting the CGRs, drop the FQID space scan, and with it the new
qman_pending_fq_by_cgrid_range() export:

	for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++)
		qman_shutdown_fq(&dpaa_intf->rx_queues[loop]);
	for (loop = 0; loop < MAX_DPAA_CORES; loop++)
		qman_shutdown_fq(&dpaa_intf->tx_queues[loop]);

The existing "Release congestion Groups after releasing FQIDs" comment
is then true.

Info

cgrid is u32; use %u, not %d, in the DPAA_PMD_DEBUG/WARN calls.

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

* [PATCH v2 0/4] DPAA driver changes
  2026-10-28  8:55 [PATCH v1 0/3] DPAA driver changes Gagandeep Singh
                   ` (3 preceding siblings ...)
  2026-10-28 14:41 ` [PATCH v1 0/3] DPAA driver changes Stephen Hemminger
@ 2026-10-30  4:43 ` Gagandeep Singh
  2026-10-30  4:43   ` [PATCH v2 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
                     ` (6 more replies)
  4 siblings, 7 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-10-30  4:43 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal

V2-changes:
 - Fixed most of the AI comments.
 - added new patch:
   fix out-of-bounds read of mac_idx
 - removed drv_oldev, updated comments and notes.
 - fixes FQ shutdown
 - removed unwanted checks, updated open, updated snprintf.
 - updated commit messages.

V1:
 - Adding OH port support.
 - Updates in shared ethernet code.
 - Congestion related code cleanup.

Gagandeep Singh (2):
  bus/dpaa: fix out-of-bounds read of mac_idx array
  drivers: add offline (O/H) port device support

Hemant Agrawal (1):
  net/dpaa: support non fmX-macY type of shared Ethernet name

Jun Yang (1):
  drivers: add DPAA cgrid cleanup support

 doc/api/doxy-api-index.md                |   1 +
 doc/guides/nics/dpaa.rst                 |  35 +
 drivers/bus/dpaa/base/fman/fman.c        |  19 +
 drivers/bus/dpaa/base/qbman/qman.c       |  61 ++
 drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
 drivers/bus/dpaa/dpaa_bus.c              |  66 +-
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   2 +
 drivers/bus/dpaa/include/fman.h          |   6 +-
 drivers/bus/dpaa/include/fsl_qman.h      |  28 +
 drivers/net/dpaa/dpaa_ethdev.c           | 241 ++++++-
 drivers/net/dpaa/dpaa_ethdev.h           |   3 +
 drivers/net/dpaa/dpaa_flow.c             |   7 +-
 drivers/net/dpaa/dpaa_oldev.c            | 875 +++++++++++++++++++++++
 drivers/net/dpaa/meson.build             |  11 +-
 drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 188 +++++
 15 files changed, 1517 insertions(+), 30 deletions(-)
 create mode 100644 drivers/net/dpaa/dpaa_oldev.c
 create mode 100644 drivers/net/dpaa/rte_pmd_dpaa_oldev.h

-- 
2.25.1


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

* [PATCH v2 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array
  2026-10-30  4:43 ` [PATCH v2 0/4] " Gagandeep Singh
@ 2026-10-30  4:43   ` Gagandeep Singh
  2026-10-30  4:43   ` [PATCH v2 2/4] drivers: add offline (O/H) port device support Gagandeep Singh
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-10-30  4:43 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, stable, Gagandeep Singh

fman_if_init() and fman_if_init_onic() read the devicetree
'cell-index' property and store it unchecked into
__if->__if.mac_idx. This value is later used as an index into the
fixed-size mac_idx[] lookup table in fman_if_vsp_init(), so a
cell-index value greater than or equal to the number of entries in
that table results in an out-of-bounds read.

Add an explicit upper-bound check (FMAN_MAX_MAC_IDX_NUM) in both
fman_if_init() and fman_if_init_onic() before the mac_idx assignment,
and a static_assert in fman_if_vsp_init() to keep mac_idx[] in sync
with FMAN_MAX_MAC_IDX_NUM if it is ever resized.

Fixes: a0edbb8a8e52 ("bus/dpaa: add OH port mode")
Fixes: 7e5f49ae767d ("bus/dpaa: add ONIC port mode")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/bus/dpaa/base/fman/fman.c | 19 +++++++++++++++++++
 drivers/bus/dpaa/include/fman.h   |  5 +++++
 2 files changed, 24 insertions(+)

diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index 67f77265ca..223cd6958d 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -205,6 +205,9 @@ static void fman_if_vsp_init(struct __fman_if *__if)
 	size_t lenp;
 	const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1};
 
+	static_assert(RTE_DIM(mac_idx) == FMAN_MAX_MAC_IDX_NUM,
+		      "mac_idx[] out of sync with FMAN_MAX_MAC_IDX_NUM");
+
 	if (__if->__if.mac_idx <= 8) {
 		for_each_compatible_node(dev, NULL,
 			"fsl,fman-port-1g-rx-extended-args") {
@@ -544,6 +547,14 @@ fman_if_init(const struct device_node *dpa_node, int fd)
 		cell_idx_host = of_read_number(cell_idx,
 					       lenp / sizeof(phandle));
 
+		if (cell_idx_host >= FMAN_MAX_MAC_IDX_NUM) {
+			FMAN_ERR(-EINVAL,
+				 "%s: cell-index(%" PRIu64 ") >= max(%d)",
+				 oh_node->full_name, cell_idx_host,
+				 FMAN_MAX_MAC_IDX_NUM);
+			goto err;
+		}
+
 		__if->__if.mac_idx = cell_idx_host;
 	}
 
@@ -957,6 +968,14 @@ static int fman_if_init_onic(const struct device_node *dpa_node)
 	assert(lenp == sizeof(*cell_idx));
 
 	cell_idx_host = of_read_number(cell_idx, lenp / sizeof(phandle));
+
+	if (cell_idx_host >= FMAN_MAX_MAC_IDX_NUM) {
+		FMAN_ERR(-EINVAL, "%s: cell-index(%" PRIu64 ") >= max(%d)",
+			 tx_oh_node->full_name, cell_idx_host,
+			 FMAN_MAX_MAC_IDX_NUM);
+		goto err;
+	}
+
 	__if->__if.mac_idx = cell_idx_host;
 
 	fman_node = of_get_parent(fman_tx_oh_node);
diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h
index f642faf3b3..f499f9ebbf 100644
--- a/drivers/bus/dpaa/include/fman.h
+++ b/drivers/bus/dpaa/include/fman.h
@@ -68,6 +68,11 @@
 #define FMAN_RTC_MAX_NUM_OF_PERIODIC_PULSES	4
 #define FMAN_RTC_MAX_NUM_OF_EXT_TRIGGERS	3
 
+/*
+ * Maximum number of MAC/offline port indexes.
+ */
+#define FMAN_MAX_MAC_IDX_NUM	11
+
 /* Represents the different flavour of network interface */
 enum fman_mac_type {
 	fman_offline_internal = 0,
-- 
2.25.1


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

* [PATCH v2 2/4] drivers: add offline (O/H) port device support
  2026-10-30  4:43 ` [PATCH v2 0/4] " Gagandeep Singh
  2026-10-30  4:43   ` [PATCH v2 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
@ 2026-10-30  4:43   ` Gagandeep Singh
  2026-10-30  4:43   ` [PATCH v2 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-10-30  4:43 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, Gagandeep Singh

Add support for the DPAA Offline/Host-command (O/H) port, allowing a
single OL port to be used by a DPDK application. The feature is
selected through the 'drv_oldev' bus device argument, and the
associated back-half port is named through the 'drv_bh_port' device
argument.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/api/doxy-api-index.md                |   1 +
 doc/guides/nics/dpaa.rst                 |  31 +
 drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
 drivers/bus/dpaa/dpaa_bus.c              |  66 +-
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   1 +
 drivers/bus/dpaa/include/fman.h          |   1 -
 drivers/bus/dpaa/include/fsl_qman.h      |   1 +
 drivers/net/dpaa/dpaa_ethdev.h           |   3 +
 drivers/net/dpaa/dpaa_flow.c             |   7 +-
 drivers/net/dpaa/dpaa_oldev.c            | 875 +++++++++++++++++++++++
 drivers/net/dpaa/meson.build             |  11 +-
 drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 188 +++++
 12 files changed, 1172 insertions(+), 17 deletions(-)
 create mode 100644 drivers/net/dpaa/dpaa_oldev.c
 create mode 100644 drivers/net/dpaa/rte_pmd_dpaa_oldev.h

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 62390f7be3..0bd8e1bbf0 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -53,6 +53,7 @@ The public API headers are grouped by topics:
   [cnxk_eventdev](@ref rte_pmd_cnxk_eventdev.h),
   [cnxk_mempool](@ref rte_pmd_cnxk_mempool.h),
   [dpaa](@ref rte_pmd_dpaa.h),
+  [dpaa_oldev](@ref rte_pmd_dpaa_oldev.h),
   [dpaa2](@ref rte_pmd_dpaa2.h),
   [mlx5](@ref rte_pmd_mlx5.h),
   [dpaa2_mempool](@ref rte_dpaa2_mempool.h),
diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst
index c6aab46828..21f54bcd36 100644
--- a/doc/guides/nics/dpaa.rst
+++ b/doc/guides/nics/dpaa.rst
@@ -276,6 +276,37 @@ Refer to the document :doc:`build_and_test` for details.
   and thus disabling hardware based packet handling at driver level,
   e.g. ``dpaa:fm1-mac3,recv_err_pkts=1``.
 
+``drv_bh_port``
+   Name of the back-half port associated with an offline (O/H) port device.
+   It is passed on the offline port device itself, which is named
+   ``oldev1``, e.g. ``-a dpaa_bus:oldev1,drv_bh_port=fm1-mac5``.
+
+The DPAA offline (O/H) port device is only created, and therefore only
+probed, when it is explicitly named on the EAL ``-a`` command line, e.g.::
+
+   -a dpaa_bus:oldev1,drv_bh_port=fm1-mac5
+
+Passing any ``-a`` argument for the DPAA bus switches the bus to allowlist
+scan mode, so from that point on only the devices named with ``-a`` are
+probed. Using the offline port therefore requires listing the offline port
+itself and every Ethernet port the application needs, for example::
+
+   -a dpaa_bus:oldev1,drv_bh_port=fm1-mac5 \
+   -a dpaa_bus:fm1-mac5 -a dpaa_bus:fm1-mac6
+
+Omitting an ``fmX-macY`` port in that case silently drops that port.
+
+The offline port requires the ``/dev/cdx_ctrl`` kernel control device to be
+present; it is provided by the NXP vendor ``cdx`` kernel driver, which is
+not part of this DPDK driver and must be obtained and loaded separately
+(see the NXP LSDK release matching the DPAA SoC family). The uplink
+classification and local-gateway (LGW) configuration exposed through that
+control device can be programmed by the application via the experimental
+``rte_pmd_dpaa_ol_set_classif_info()``, ``rte_pmd_dpaa_ol_reset_classif_info()``,
+``rte_pmd_dpaa_ol_set_lgw_info()`` and ``rte_pmd_dpaa_ol_reset_lgw_info()``
+APIs declared in ``rte_pmd_dpaa_oldev.h``.
+
+
 FMAN Config
 -----------
 
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index 4aed83f84d..323a6a7659 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -69,11 +69,13 @@ struct rte_dpaa_driver;
 enum rte_dpaa_type {
 	FSL_DPAA_ETH = 1,
 	FSL_DPAA_CRYPTO,
-	FSL_DPAA_QDMA
+	FSL_DPAA_QDMA,
+	FSL_DPAA_OL
 };
 
 struct dpaa_device_id {
 	uint8_t fman_id; /**< Fman interface ID, for ETH type device */
+	uint8_t ol_id;	/**< OH interface ID, for OH type device */
 	uint8_t mac_id; /**< Fman MAC interface ID, for ETH type device */
 	uint16_t dev_id; /**< Device Identifier from DPDK */
 };
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 6599958925..80d5507a04 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -34,6 +34,8 @@
 #include <bus_driver.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
+#include <rte_kvargs.h>
+#include <rte_devargs.h>
 
 #include <dpaa_of.h>
 #include <bus_dpaa_driver.h>
@@ -68,6 +70,12 @@ struct rte_dpaa_bus_private {
 	RTE_ATOMIC(uint16_t) push_rxq_num;
 };
 
+/* Name of the single offline (O/H) port device. The device is only
+ * created, and thus only probed, if the application explicitly lists it
+ * with "-a dpaa_bus:oldev1" (or an equivalent devargs form).
+ */
+#define DPAA_OLDEV_NAME	"oldev1"
+
 static struct rte_bus rte_dpaa_bus;
 static struct rte_dpaa_bus_private dpaa_bus;
 static struct netcfg_info *dpaa_netcfg;
@@ -207,8 +215,44 @@ dpaa_create_device_list(void)
 	struct fm_eth_port_cfg *cfg;
 	struct fman_if *fman_intf;
 
+	struct rte_devargs *oldev_devargs;
+
 	dpaa_bus.device_count = 0;
 
+	/* The offline port is only created if the application explicitly
+	 * asked for it with "-a dpaa_bus:oldev1" (plus any devargs), e.g.
+	 * when the device is created without a backing devargs entry it
+	 * would never be probed, so avoid creating it at all.
+	 */
+	oldev_devargs = rte_bus_find_devargs(&rte_dpaa_bus, DPAA_OLDEV_NAME);
+
+	if (!dpaa_netcfg && !oldev_devargs)
+		return 0;
+
+	/* Creating OL Device */
+	if (oldev_devargs) {
+		dev = calloc(1, sizeof(struct rte_dpaa_device));
+		if (!dev) {
+			DPAA_BUS_ERR("Failed to allocate OL devices");
+			return -ENOMEM;
+		}
+
+		dev->device_type = FSL_DPAA_OL;
+		dev->id.ol_id = 0;
+		dev->id.dev_id = dpaa_bus.device_count;
+
+		/* Create device name */
+		snprintf(dev->name, RTE_ETH_NAME_MAX_LEN, "oldev%d",
+			 (dev->id.ol_id + 1));
+		DPAA_BUS_INFO("%s oldev added", dev->name);
+		dev->device.name = dev->name;
+		dev->device.devargs = oldev_devargs;
+		DPAA_BUS_INFO("**Devargs matched %s", dev->name);
+
+		dpaa_add_to_device_list(dev);
+		dpaa_bus.device_count++;
+	}
+
 	/* Creating Ethernet Devices */
 	for (i = 0; dpaa_netcfg && (i < dpaa_netcfg->num_ethports); i++) {
 		dev = calloc(1, sizeof(struct rte_dpaa_device));
@@ -298,8 +342,7 @@ dpaa_create_device_list(void)
 		 * crypto PMD, using RTE_ETH_NAME_MAX_LEN as that is the size
 		 * allocated for dev->name/
 		 */
-		memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN);
-		sprintf(dev->name, "dpaa_sec-%d", i+1);
+		snprintf(dev->name, RTE_ETH_NAME_MAX_LEN, "dpaa_sec-%d", i + 1);
 		DPAA_BUS_INFO("%s cryptodev added", dev->name);
 		dev->device.name = dev->name;
 		dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus, dev->name);
@@ -324,8 +367,7 @@ dpaa_create_device_list(void)
 		dev->device_type = FSL_DPAA_QDMA;
 		dev->id.dev_id = dpaa_bus.device_count + i;
 
-		memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN);
-		sprintf(dev->name, "dpaa_qdma-%d", i+1);
+		snprintf(dev->name, RTE_ETH_NAME_MAX_LEN, "dpaa_qdma-%d", i + 1);
 		DPAA_BUS_INFO("%s qdma device added", dev->name);
 		dev->device.name = dev->name;
 		dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus, dev->name);
@@ -513,7 +555,7 @@ rte_dpaa_bus_parse(const char *name, void *out)
 	}
 
 	/* dev_delta points to the dev name (mac/oh/onic). Not valid for
-	 * dpaa_sec.
+	 * dpaa_sec and oldev.
 	 */
 	dev_delta = delta + sizeof("fm.-") - 1;
 
@@ -527,6 +569,10 @@ rte_dpaa_bus_parse(const char *name, void *out)
 				i < 1 || i > RTE_DPAA_QDMA_DEVICES)
 			return -EINVAL;
 		max_name_len = sizeof("dpaa_qdma-.") - 1;
+	} else if (strncmp("oldev", &name[delta], 5) == 0) {
+		if (sscanf(&name[delta], "oldev%u", &i) != 1 || i != 1)
+			return -EINVAL;
+		max_name_len = sizeof("oldev.") - 1;
 	} else if (strncmp("oh", &name[dev_delta], 2) == 0) {
 		if (sscanf(&name[delta], "fm%u-oh%u", &i, &j) != 2 ||
 				i >= 2 || j >= 16)
@@ -624,7 +670,8 @@ rte_dpaa_bus_dev_build(void)
 
 	/* Get the interface configurations from device-tree */
 	dpaa_netcfg = netcfg_acquire();
-	if (!dpaa_netcfg) {
+	if (!dpaa_netcfg &&
+	    !rte_bus_find_devargs(&rte_dpaa_bus, DPAA_OLDEV_NAME)) {
 		DPAA_BUS_ERR("netcfg failed: /dev/fsl_usdpaa device not available");
 		DPAA_BUS_WARN("Check if you are using USDPAA based device tree");
 		return -EINVAL;
@@ -632,7 +679,7 @@ rte_dpaa_bus_dev_build(void)
 
 	DPAA_BUS_NOTICE("DPAA Bus Detected");
 
-	if (!dpaa_netcfg->num_ethports) {
+	if (dpaa_netcfg && !dpaa_netcfg->num_ethports) {
 		DPAA_BUS_INFO("NO DPDK mapped net interfaces available");
 		/* This is not an error */
 	}
@@ -640,9 +687,10 @@ rte_dpaa_bus_dev_build(void)
 #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
 	dump_netcfg(dpaa_netcfg, stdout);
 #endif
-
-	DPAA_BUS_DEBUG("Number of ethernet devices = %d",
+	if (dpaa_netcfg) {
+		DPAA_BUS_DEBUG("Number of ethernet devices = %d",
 			     dpaa_netcfg->num_ethports);
+	}
 	ret = dpaa_create_device_list();
 	if (ret) {
 		DPAA_BUS_ERR("Unable to create device list. (%d)", ret);
diff --git a/drivers/bus/dpaa/dpaa_bus_base_symbols.c b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
index 0927e5fe2c..aaa9f9bec2 100644
--- a/drivers/bus/dpaa/dpaa_bus_base_symbols.c
+++ b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
@@ -52,6 +52,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(bman_acquire)
 RTE_EXPORT_INTERNAL_SYMBOL(bman_query_free_buffers)
 RTE_EXPORT_INTERNAL_SYMBOL(bman_thread_irq)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_fqid_range)
+RTE_EXPORT_INTERNAL_SYMBOL(qman_release_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_reserve_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_pool_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_cgrid_range)
diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h
index f499f9ebbf..030c85c284 100644
--- a/drivers/bus/dpaa/include/fman.h
+++ b/drivers/bus/dpaa/include/fman.h
@@ -480,7 +480,6 @@ struct __fman_if {
 	void *qmi_map;
 };
 
-#define MEMMAC_REG_OFFSET(reg) offsetof(struct memac_regs, reg)
 #define BMI_RX_REG_OFFSET(reg) offsetof(struct rx_bmi_regs, reg)
 #define BMI_TX_REG_OFFSET(reg) offsetof(struct tx_bmi_regs, reg)
 
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index 59b41e17f0..b2674ce5d0 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1895,6 +1895,7 @@ static inline int qman_alloc_fqid(u32 *result)
  * This function can also be used to seed the allocator with ranges of FQIDs
  * that it can subsequently allocate from.
  */
+__rte_internal
 void qman_release_fqid_range(u32 fqid, unsigned int count);
 static inline void qman_release_fqid(u32 fqid)
 {
diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h
index 47c8e2b086..7e70bf2ad2 100644
--- a/drivers/net/dpaa/dpaa_ethdev.h
+++ b/drivers/net/dpaa/dpaa_ethdev.h
@@ -114,6 +114,9 @@ enum {
 
 #define DPAA_DEFAULT_RXQ_VSP_ID		1
 
+/* Device argument to name the offline (O/H) port back-half port */
+#define DRIVER_OL_BH_PORT		"drv_bh_port"
+
 #define FMC_FILE "/tmp/fmc.bin"
 
 struct dpaa_if_vsp {
diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c
index f77f9f333b..6c519ec975 100644
--- a/drivers/net/dpaa/dpaa_flow.c
+++ b/drivers/net/dpaa/dpaa_flow.c
@@ -32,9 +32,14 @@ return &scheme_params->param.key_ext_and_hash.extract_array[hdr_idx];
 	SCH_EXT_HDR(scheme_params, hdr_idx).extract_by_hdr_type.full_field
 
 /* FMAN mac indexes mappings (0 is unused, first 8 are for 1G, next for 10G
- * ports).
+ * ports). Indexed by fman_if.mac_idx, which the bus validates against
+ * FMAN_MAX_MAC_IDX_NUM when deriving it from the device tree.
  */
 static const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1};
+static_assert(RTE_DIM(mac_idx) == FMAN_MAX_MAC_IDX_NUM,
+	"mac_idx[] out of sync with FMAN_MAX_MAC_IDX_NUM");
+
+
 
 /* FM global info */
 struct dpaa_fm_info {
diff --git a/drivers/net/dpaa/dpaa_oldev.c b/drivers/net/dpaa/dpaa_oldev.c
new file mode 100644
index 0000000000..ceec48daf3
--- /dev/null
+++ b/drivers/net/dpaa/dpaa_oldev.c
@@ -0,0 +1,875 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2026 NXP
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+
+#include <rte_dpaa_logs.h>
+#include <rte_kvargs.h>
+#include <rte_stdatomic.h>
+
+#include <rte_string_fns.h>
+#include <bus_dpaa_driver.h>
+#include <dpaa_ethdev.h>
+#include <dpaa_rxtx.h>
+#include <dpaa_mempool.h>
+
+#include <eal_export.h>
+#include <fsl_fman.h>
+
+#include "rte_pmd_dpaa_oldev.h"
+
+/* The ol device is a tx are queue pair, which is provided to the kernel through
+ * ioctl calls. It is exposed as a virtual port to the application.
+ * This ASK Device provides IOCTL calls to driver for communicating fqid's,
+ * buffer pool id's and channel id's with kernel.
+ */
+#define ASK_PATH		"/dev/cdx_ctrl"
+#define CDX_IOC_MAGIC		0xbe
+
+#define MAX_BH_PORT_NAME_LEN	12
+
+/* Private area reserved by driver.
+ * Aligned with "struct annotations_t". Parse results will be written from
+ * the 17th byte by the HW.
+ */
+#define DPAA_OL_PARSERSLT_START_OFFSET 16
+#define DPAA_OL_DATA_ALIGNMENT 64
+/* Change this value to increase the data offset.
+ * final value will be aligned by DPAA_OL_DATA_ALIGNMENT
+ */
+#define DPAA_OL_MAX_EXTRA_SIZE 0
+#define DPAA_OL_PARSE_RESULT_REQUIRED true
+#define DPAA_OL_TIME_STAMP_REQUIRED false
+#define DPAA_OL_HASH_RESULT_REQUIRED false
+#define DPAA_OL_PCD_INFO_REQUIRED false
+
+/* Work queue ID used for the offline port ingress sequence classifier. */
+#define DPA_ISC_WQ_ID 2
+
+/* Control device descriptor, opened on demand. The fast path reads it
+ * without holding fd_init_lock, so all accesses are atomic.
+ */
+static RTE_ATOMIC(int)ask_fd = -1;
+static pthread_mutex_t fd_init_lock = PTHREAD_MUTEX_INITIALIZER;
+
+struct ask_ctrl_offline_channel {
+	uint32_t channel_id;
+	uint32_t ctx_a_hi_val;	/* Setting required flags(B0,A2) while creating
+				 * frame queue.
+				 */
+	uint32_t ctx_a_lo_val;	/* EBD and VSP enable bits */
+	uint32_t ctx_b_val;	/* VSP ID */
+};
+
+struct ask_ctrl_dpdk_fq_info_s {
+	uint32_t tx_fq_id;		/* DPDK transmits GTP packets using FQ
+					 * ID
+					 */
+	uint32_t rx_fq_id;		/* DPDK receives packets from FMAN */
+	uint16_t buff_size;		/* Size of each buffer in DPDPK buffer
+					 * pool
+					 */
+	uint8_t bp_id;			/* DPDK buffer pool id */
+	/* BH port interface name; set from the mandatory drv_bh_port
+	 * devarg (see DRIVER_OL_BH_PORT).
+	 */
+	uint8_t bh_port_name[MAX_BH_PORT_NAME_LEN];
+	/* below fields are taken from structure t_FmBufferPrefixContent, These
+	 * fields are required for VSP creation on DPDK buffer pool ID. These
+	 * fields should be set based on expected parameters from FMAN
+	 */
+	uint16_t privDataSize;		/* Number of bytes to be left at the
+					 * beginning of the external buffer;
+					 * Note that the private-area will start
+					 * from the base of the buffer address.
+					 */
+	bool passPrsResult;		/* TRUE to pass the parse result to/from
+					 * the FM; User may use
+					 * FM_PORT_GetBufferPrsResult() in order
+					 * to get the parser-result from a
+					 * buffer.
+					 */
+	bool passTimeStamp;		/* < TRUE to pass the timeStamp to/from
+					 * the FM User may use
+					 * FM_PORT_GetBufferTimeStamp() in order
+					 * to get the parser-result from a
+					 * buffer.
+					 */
+	bool passHashResult;		/* TRUE to pass the KG hash result
+					 * to/from the FM User may use
+					 * FM_PORT_GetBufferHashResult() in
+					 * order to get the parser-result from a
+					 * buffer.
+					 */
+	bool passAllOtherPCDInfo;	/* Add all other Internal-Context
+					 * information: AD, hash-result, key,
+					 * etc.
+					 */
+	uint16_t dataAlign;		/* 0 to use driver's default alignment
+					 * [DEFAULT_FM_SP_bufferPrefixContent_dataAlign],
+					 * other value for selecting a data
+					 * alignment (must be a power of 2); if
+					 * write optimization is used, must be
+					 * >= 16.
+					 */
+	uint8_t manipExtraSpace;	/* Maximum extra size needed (insertion-
+					 * size minus removal-size); Note that
+					 * this field impacts the size of the
+					 * buffer-prefix (i.e. it pushes the
+					 * data offset); This field is
+					 * irrelevant if DPAA_VERSION==10
+					 */
+};
+
+#define ASK_CTRL_GET_OFFLINE_CHANNEL_INFO \
+	_IOWR(CDX_IOC_MAGIC, 8, struct ask_ctrl_offline_channel)
+#define ASK_CTRL_SET_DPDK_INFO \
+	_IOWR(CDX_IOC_MAGIC, 9, struct ask_ctrl_dpdk_fq_info_s)
+#define ASK_CTRL_SET_CLASSIF_INFO \
+	_IOWR(CDX_IOC_MAGIC, 10, struct rte_pmd_dpaa_uplink_cls_info_s)
+#define ASK_CTRL_RESET_CLASSIF_INFO \
+	_IOWR(CDX_IOC_MAGIC, 11, struct rte_pmd_dpaa_uplink_cls_info_s)
+#define ASK_CTRL_SET_LGW_INFO \
+	_IOWR(CDX_IOC_MAGIC, 12, struct rte_pmd_dpaa_lgw_info_s)
+#define ASK_CTRL_RESET_LGW_INFO \
+	_IOWR(CDX_IOC_MAGIC, 13, struct rte_pmd_dpaa_lgw_info_s)
+
+
+/* Return the control device descriptor, opening it on first use. */
+static int check_fd(void)
+{
+	int cur_fd, ret;
+
+	cur_fd = rte_atomic_load_explicit(&ask_fd, rte_memory_order_acquire);
+	if (cur_fd >= 0)
+		return cur_fd;
+
+	ret = pthread_mutex_lock(&fd_init_lock);
+	assert(!ret);
+	/* check again with the lock held */
+	cur_fd = rte_atomic_load_explicit(&ask_fd, rte_memory_order_relaxed);
+	if (cur_fd < 0) {
+		cur_fd = open(ASK_PATH, O_RDWR | O_CLOEXEC);
+		if (cur_fd >= 0)
+			rte_atomic_store_explicit(&ask_fd, cur_fd,
+						  rte_memory_order_release);
+	}
+	ret = pthread_mutex_unlock(&fd_init_lock);
+	assert(!ret);
+
+	return (cur_fd >= 0) ? cur_fd : -ENODEV;
+}
+
+static int ask_get_channel_info(struct ask_ctrl_offline_channel *ch_info)
+{
+	int ret, fd = check_fd();
+
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_GET_OFFLINE_CHANNEL_INFO, ch_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Get channel info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Get channel info successful");
+	DPAA_PMD_DEBUG("Channel id: %x", ch_info->channel_id);
+	DPAA_PMD_DEBUG("ctx_a_hi_val: %x", ch_info->ctx_a_hi_val);
+	DPAA_PMD_DEBUG("ctx_a_lo_val: %x", ch_info->ctx_a_lo_val);
+	DPAA_PMD_DEBUG("ctx_b_val: %x", ch_info->ctx_b_val);
+
+	return 0;
+}
+
+static int ask_set_fq_info(struct ask_ctrl_dpdk_fq_info_s *fq_info)
+{
+	int ret, fd = check_fd();
+
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_DPDK_INFO, fq_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set FQ info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set fq info successful");
+	DPAA_PMD_DEBUG("Tx fqid: %x", fq_info->tx_fq_id);
+	DPAA_PMD_DEBUG("Rx fqid: %x", fq_info->rx_fq_id);
+	DPAA_PMD_DEBUG("buff_size: %d", fq_info->buff_size);
+	DPAA_PMD_DEBUG("bp_id: %d", fq_info->bp_id);
+	DPAA_PMD_DEBUG("Backhaul port name: %s", fq_info->bh_port_name);
+
+	return 0;
+}
+
+static int
+dpaa_ol_dev_configure(__rte_unused struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+static int dpaa_ol_dev_info(struct rte_eth_dev *dev,
+			    struct rte_eth_dev_info *dev_info)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->max_rx_queues = dpaa_intf->nb_rx_queues;
+	dev_info->max_tx_queues = dpaa_intf->nb_tx_queues;
+	dev_info->max_rx_pktlen = DPAA_MAX_RX_PKT_LEN;
+	dev_info->max_mac_addrs = DPAA_MAX_MAC_FILTER;
+	dev_info->max_hash_mac_addrs = 0;
+	dev_info->max_vfs = 0;
+
+	dev_info->speed_capa = RTE_ETH_LINK_SPEED_10M_HD |
+			       RTE_ETH_LINK_SPEED_10M |
+			       RTE_ETH_LINK_SPEED_100M_HD |
+			       RTE_ETH_LINK_SPEED_100M |
+			       RTE_ETH_LINK_SPEED_1G |
+			       RTE_ETH_LINK_SPEED_2_5G |
+			       RTE_ETH_LINK_SPEED_10G;
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_set_classif_info, 26.11)
+int rte_pmd_dpaa_ol_set_classif_info(struct rte_pmd_dpaa_uplink_cls_info_s *classif_info)
+{
+	int i, ret, fd;
+
+	if (classif_info == NULL) {
+		DPAA_PMD_ERR("No classification data available");
+		return -EINVAL;
+	}
+
+	fd = check_fd();
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_CLASSIF_INFO, classif_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set classification info ioctl failed with errno: %s",
+			     strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set classification info successful");
+	for (i = 0; i < classif_info->num_ports; i++) {
+		DPAA_PMD_DEBUG("UDP dest port: %d",
+			       classif_info->gtp_udp_port[i]);
+	}
+	DPAA_PMD_DEBUG("Protocol ID: %d", classif_info->gtp_proto_id);
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_reset_classif_info, 26.11)
+int rte_pmd_dpaa_ol_reset_classif_info(void)
+{
+	struct rte_pmd_dpaa_uplink_cls_info_s classif_info;
+	int ret, fd;
+
+	fd = check_fd();
+	if (fd < 0)
+		return fd;
+
+	memset(&classif_info, 0, sizeof(classif_info));
+
+	ret = ioctl(fd, ASK_CTRL_RESET_CLASSIF_INFO, &classif_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Reset classification info ioctl failed with errno: %s",
+			     strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Reset classification info successful");
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_set_lgw_info, 26.11)
+int rte_pmd_dpaa_ol_set_lgw_info(struct rte_pmd_dpaa_lgw_info_s *lgw_info)
+{
+	int ret, fd;
+
+	if (lgw_info == NULL) {
+		DPAA_PMD_ERR("No LGW data available");
+		return -EINVAL;
+	}
+
+	fd = check_fd();
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_LGW_INFO, lgw_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set LGW info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set LGW info successful");
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_reset_lgw_info, 26.11)
+int rte_pmd_dpaa_ol_reset_lgw_info(void)
+{
+	struct rte_pmd_dpaa_lgw_info_s lgw_info;
+	int ret, fd;
+
+	PMD_INIT_FUNC_TRACE();
+
+	fd = check_fd();
+	if (fd < 0)
+		return fd;
+
+	memset(&lgw_info, 0, sizeof(lgw_info));
+
+	ret = ioctl(fd, ASK_CTRL_RESET_LGW_INFO, &lgw_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Reset LGW info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Reset LGW info successful");
+
+	return 0;
+}
+
+static int dpaa_ol_set_fq_info(struct rte_eth_dev *dev);
+
+static int dpaa_ol_dev_start(struct rte_eth_dev *dev)
+{
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Hand the Rx/Tx FQIDs and buffer pool to the kernel here rather than
+	 * from tx_queue_setup(): ethdev does not order Rx and Tx queue setup,
+	 * and testpmd sets Tx up first, so at tx_queue_setup() time the Rx
+	 * side may not be configured yet. By dev_start() both are known.
+	 */
+	ret = dpaa_ol_set_fq_info(dev);
+	if (ret)
+		return ret;
+
+	dev->tx_pkt_burst = dpaa_eth_queue_tx;
+
+	return 0;
+}
+
+static int dpaa_ol_dev_stop(struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
+
+	return 0;
+}
+
+static void dpaa_oldev_queues_release(struct dpaa_if *dpaa_intf);
+
+static int dpaa_ol_dev_close(struct rte_eth_dev *dev)
+{
+	struct dpaa_if *dpaa_intf;
+	int cur_fd;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	/* Release the driver private rx/tx_queues here so that an application
+	 * that only calls rte_eth_dev_close() (without removing the device)
+	 * still shuts down the FQs and frees the queue memory.
+	 */
+	dpaa_intf = dev->data->dev_private;
+	if (dpaa_intf)
+		dpaa_oldev_queues_release(dpaa_intf);
+
+	cur_fd = rte_atomic_exchange_explicit(&ask_fd, -1,
+					      rte_memory_order_acq_rel);
+	if (cur_fd >= 0)
+		close(cur_fd);
+
+	return 0;
+}
+
+static inline void
+dpaa_poll_queue_default_config(struct qm_mcc_initfq *opts)
+{
+	memset(opts, 0, sizeof(struct qm_mcc_initfq));
+	opts->we_mask = QM_INITFQ_WE_CONTEXTA;
+	opts->fqd.fq_ctrl = QM_FQCTRL_AVOIDBLOCK | QM_FQCTRL_CTXASTASHING |
+			    QM_FQCTRL_PREFERINCACHE;
+	opts->fqd.context_a.stashing.exclusive = 0;
+	if (dpaa_soc_ver() != SVR_LS1046A_FAMILY)
+		opts->fqd.context_a.stashing.annotation_cl =
+				DPAA_IF_RX_ANNOTATION_STASH;
+	opts->fqd.context_a.stashing.data_cl = DPAA_IF_RX_DATA_STASH;
+	opts->fqd.context_a.stashing.context_cl = DPAA_IF_RX_CONTEXT_STASH;
+}
+
+static
+int dpaa_ol_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
+			    __rte_unused uint16_t nb_desc,
+			    unsigned int socket_id __rte_unused,
+			    __rte_unused const struct rte_eth_rxconf *rx_conf,
+			    struct rte_mempool *mp)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct qman_fq *rxq = &dpaa_intf->rx_queues[queue_idx];
+
+	PMD_INIT_FUNC_TRACE();
+
+	dpaa_intf->bp_info = DPAA_MEMPOOL_TO_POOL_INFO(mp);
+	dpaa_intf->valid = 1;
+
+	if (!rte_dpaa_bpid_info) {
+		DPAA_PMD_ERR("BPID info array not initialized");
+		return -ENOMEM;
+	}
+	rxq->bp_array = rte_dpaa_bpid_info;
+	dev->data->rx_queues[queue_idx] = rxq;
+
+	return 0;
+}
+
+/* Parse devargs, validating keys against the driver's parameter list. */
+static int
+dpaa_ol_get_bh_port_name(struct rte_devargs *devargs, char *val, size_t size)
+{
+	static const char * const valid_keys[] = { DRIVER_OL_BH_PORT, NULL };
+	struct rte_kvargs *kvlist;
+	const char *str;
+	int ret;
+
+	if (!devargs || !devargs->args)
+		return 0;
+
+	kvlist = rte_kvargs_parse(devargs->args, valid_keys);
+	if (!kvlist) {
+		DPAA_PMD_ERR("Invalid devargs for offline port \"%s\"",
+			     devargs->args);
+		return -EINVAL;
+	}
+
+	if (!rte_kvargs_count(kvlist, DRIVER_OL_BH_PORT)) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	str = rte_kvargs_get(kvlist, DRIVER_OL_BH_PORT);
+	if (str == NULL) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	ret = rte_strscpy(val, str, size);
+	rte_kvargs_free(kvlist);
+	if (ret < 0)
+		return ret;
+
+	return 1;
+}
+
+static
+int dpaa_ol_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
+			   uint16_t nb_desc __rte_unused,
+			   unsigned int socket_id __rte_unused,
+			   const struct rte_eth_txconf *tx_conf __rte_unused)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct qman_fq *txq = &dpaa_intf->tx_queues[queue_idx];
+
+	PMD_INIT_FUNC_TRACE();
+
+	dev->data->tx_queues[queue_idx] = txq;
+
+	return 0;
+}
+
+/* Program the Rx/Tx FQIDs and the buffer pool into the kernel. Called from
+ * dev_start(), by which point both the Rx and the Tx queue are set up.
+ */
+static int dpaa_ol_set_fq_info(struct rte_eth_dev *dev)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct ask_ctrl_dpdk_fq_info_s fq_info;
+	struct qman_fq *txq, *rxq;
+	struct rte_pktmbuf_pool_private *mbp_priv;
+	int ret;
+
+	if (dpaa_intf->rx_queues == NULL || dpaa_intf->tx_queues == NULL) {
+		DPAA_PMD_ERR("Rx/Tx queues not allocated");
+		return -EINVAL;
+	}
+
+	if (dpaa_intf->bp_info == NULL) {
+		DPAA_PMD_ERR("Rx queue must be set up before starting the port");
+		return -EINVAL;
+	}
+
+	txq = &dpaa_intf->tx_queues[0];
+	rxq = &dpaa_intf->rx_queues[0];
+	memset(&fq_info, 0, sizeof(fq_info));
+	mbp_priv = (struct rte_pktmbuf_pool_private *)rte_mempool_get_priv(dpaa_intf->bp_info->mp);
+	fq_info.tx_fq_id = txq->fqid;
+	fq_info.rx_fq_id = rxq->fqid;
+	fq_info.buff_size = mbp_priv->mbuf_data_room_size;
+	fq_info.bp_id = dpaa_intf->bp_info->bpid;
+
+	fq_info.privDataSize = DPAA_OL_PARSERSLT_START_OFFSET;
+	fq_info.passPrsResult = DPAA_OL_PARSE_RESULT_REQUIRED;
+	fq_info.passTimeStamp = DPAA_OL_TIME_STAMP_REQUIRED;
+	fq_info.passHashResult = DPAA_OL_HASH_RESULT_REQUIRED;
+	fq_info.passAllOtherPCDInfo = DPAA_OL_PCD_INFO_REQUIRED;
+	fq_info.dataAlign = DPAA_OL_DATA_ALIGNMENT;
+	fq_info.manipExtraSpace = DPAA_OL_MAX_EXTRA_SIZE;
+
+	ret = dpaa_ol_get_bh_port_name(dev->device->devargs,
+				       (char *)fq_info.bh_port_name,
+				       MAX_BH_PORT_NAME_LEN);
+	if (ret <= 0) {
+		DPAA_PMD_ERR("Offline port \"%s\" devarg not defined or invalid (ret=%d)",
+			     DRIVER_OL_BH_PORT, ret);
+		return -EINVAL;
+	}
+
+	ret = ask_set_fq_info(&fq_info);
+	if (ret) {
+		DPAA_PMD_ERR("Set FQ info failed with ret: %d", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int dpaa_ol_link_update(struct rte_eth_dev *dev,
+			       __rte_unused int wait_to_complete)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct rte_eth_link *link = &dev->data->dev_link;
+
+	PMD_INIT_FUNC_TRACE();
+
+	link->link_status = dpaa_intf->valid;
+	link->link_speed = RTE_ETH_SPEED_NUM_NONE;
+	link->link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+	link->link_autoneg = RTE_ETH_LINK_AUTONEG;
+
+	return 0;
+}
+
+static int dpaa_ol_promiscuous_enable(__rte_unused struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+static int dpaa_ol_rx_queue_init(struct qman_fq *fq, uint32_t fqid)
+{
+	int ret;
+	struct qm_mcc_initfq opts = {0};
+	u32 flags = QMAN_FQ_FLAG_DYNAMIC_FQID | QMAN_FQ_FLAG_NO_ENQUEUE;
+
+	if (unlikely(!DPAA_PER_LCORE_PORTAL)) {
+		ret = rte_dpaa_portal_init(NULL);
+		if (ret < 0) {
+			DPAA_PMD_ERR("portal initialization failure");
+			return ret;
+		}
+	}
+
+	ret = qman_create_fq(fqid, flags, fq);
+	if (ret) {
+		DPAA_PMD_ERR("create rx fqid 0x%x failed with ret: %d", fqid,
+			     ret);
+		return ret;
+	}
+	fq->is_static = false;
+
+	dpaa_poll_queue_default_config(&opts);
+
+	ret = qman_init_fq(fq, 0, &opts);
+	if (ret)
+		DPAA_PMD_ERR("init rx fqid 0x%x failed with ret:%d", fqid, ret);
+	return ret;
+}
+
+static int dpaa_ol_tx_queue_init(struct qman_fq *fq, uint32_t fqid)
+{
+	int ret;
+	struct qm_mcc_initfq opts = {0};
+	u32 flags = QMAN_FQ_FLAG_DYNAMIC_FQID | QMAN_FQ_FLAG_TO_DCPORTAL;
+	struct ask_ctrl_offline_channel ch_info;
+
+	memset(&ch_info, 0, sizeof(ch_info));
+
+	ret = ask_get_channel_info(&ch_info);
+	if (ret) {
+		DPAA_PMD_ERR("Get channel info failed with ret: %d", ret);
+		return ret;
+	}
+	ret = qman_create_fq(fqid, flags, fq);
+	if (ret) {
+		DPAA_PMD_ERR("Create tx fq failed with ret: %d", ret);
+		return ret;
+	}
+
+	opts.we_mask = QM_INITFQ_WE_DESTWQ |
+		       QM_INITFQ_WE_CONTEXTB | QM_INITFQ_WE_CONTEXTA;
+
+	opts.fqd.dest.channel = ch_info.channel_id;
+	opts.fqd.dest.wq = DPA_ISC_WQ_ID;
+	opts.fqd.fq_ctrl = QM_FQCTRL_PREFERINCACHE;
+	opts.fqd.context_b = ch_info.ctx_b_val;
+	opts.fqd.context_a.hi = ch_info.ctx_a_hi_val;
+	opts.fqd.context_a.lo = ch_info.ctx_a_lo_val;
+
+	opts.fqid = fq->fqid;
+	fq->ch_id = ch_info.channel_id;
+	opts.count = 1;
+
+	ret = qman_init_fq(fq, QMAN_INITFQ_FLAG_SCHED, &opts);
+	if (ret)
+		DPAA_PMD_ERR("init tx fqid 0x%x failed %d", fq->fqid, ret);
+	return ret;
+}
+
+static const struct eth_dev_ops dpaa_ol_devops = {
+		.dev_configure            = dpaa_ol_dev_configure,
+		.dev_start                = dpaa_ol_dev_start,
+		.dev_stop                 = dpaa_ol_dev_stop,
+		.dev_close                = dpaa_ol_dev_close,
+		.dev_infos_get            = dpaa_ol_dev_info,
+
+		.rx_queue_setup           = dpaa_ol_rx_queue_setup,
+		.tx_queue_setup           = dpaa_ol_tx_queue_setup,
+
+		.link_update              = dpaa_ol_link_update,
+		.promiscuous_enable       = dpaa_ol_promiscuous_enable,
+};
+
+static void dpaa_oldev_queues_release(struct dpaa_if *dpaa_intf)
+{
+	uint16_t i;
+	int ret;
+
+	if (dpaa_intf->tx_queues) {
+		for (i = 0; i < dpaa_intf->nb_tx_queues; i++) {
+			if (!dpaa_intf->tx_queues[i].fqid)
+				continue;
+			ret = qman_shutdown_fq(&dpaa_intf->tx_queues[i]);
+			if (ret) {
+				/* The FQ is still live in QMan, so the FQID
+				 * cannot be handed back: qman_alloc_fqid()
+				 * could give it to another user while the
+				 * hardware still references it. Leaking it
+				 * is the safe choice.
+				 */
+				DPAA_PMD_WARN("Failed(%d) to shutdown txq%d(0x%x), fqid not released",
+					      ret, i, dpaa_intf->tx_queues[i].fqid);
+				continue;
+			}
+			/* The FQ was created with QMAN_FQ_FLAG_DYNAMIC_FQID,
+			 * so qman_create_fq() allocated the FQID. Give it
+			 * back, otherwise every probe/close cycle leaks one.
+			 */
+			qman_release_fqid(dpaa_intf->tx_queues[i].fqid);
+		}
+		rte_free(dpaa_intf->tx_queues);
+		dpaa_intf->tx_queues = NULL;
+		dpaa_intf->nb_tx_queues = 0;
+	}
+
+	if (dpaa_intf->rx_queues) {
+		for (i = 0; i < dpaa_intf->nb_rx_queues; i++) {
+			if (!dpaa_intf->rx_queues[i].fqid)
+				continue;
+			ret = qman_shutdown_fq(&dpaa_intf->rx_queues[i]);
+			if (ret) {
+				/* Same as above: keep the FQID reserved. */
+				DPAA_PMD_WARN("Failed(%d) to shutdown rxq%d(0x%x), fqid not released",
+					      ret, i, dpaa_intf->rx_queues[i].fqid);
+				continue;
+			}
+			/* Same as above for the Rx FQs. */
+			qman_release_fqid(dpaa_intf->rx_queues[i].fqid);
+		}
+		rte_free(dpaa_intf->rx_queues);
+		dpaa_intf->rx_queues = NULL;
+		dpaa_intf->nb_rx_queues = 0;
+	}
+}
+
+static int dpaa_oldev_init(struct rte_eth_dev *eth_dev)
+{
+	int num_fqs, ret;
+	struct dpaa_if *dpaa_intf;
+
+	PMD_INIT_FUNC_TRACE();
+
+	num_fqs = DPAA_DEFAULT_NUM_PCD_QUEUES;
+	dpaa_intf = eth_dev->data->dev_private;
+
+	dpaa_intf->rx_queues = rte_zmalloc(NULL,
+					   sizeof(struct qman_fq) * num_fqs,
+					   MAX_CACHELINE);
+	if (!dpaa_intf->rx_queues) {
+		DPAA_PMD_ERR("Failed to alloc mem for RX queues");
+		return -ENOMEM;
+	}
+	/* Set the count as soon as the array exists so that the release
+	 * helper always walks the whole allocation on the error paths.
+	 */
+	dpaa_intf->nb_rx_queues = num_fqs;
+
+	ret = dpaa_ol_rx_queue_init(&dpaa_intf->rx_queues[0], 0);
+	if (ret)
+		goto free_rx;
+	dpaa_intf->rx_queues[0].dpaa_intf = dpaa_intf;
+
+	dpaa_intf->tx_queues = rte_zmalloc(NULL,
+					   sizeof(struct qman_fq) * num_fqs,
+					   MAX_CACHELINE);
+	if (!dpaa_intf->tx_queues) {
+		DPAA_PMD_ERR("Failed to alloc mem for TX queues");
+		ret = -ENOMEM;
+		goto free_rx;
+	}
+	dpaa_intf->nb_tx_queues = num_fqs;
+
+	ret = dpaa_ol_tx_queue_init(&dpaa_intf->tx_queues[0], 0);
+	if (ret)
+		goto free_rx;
+	dpaa_intf->tx_queues[0].dpaa_intf = dpaa_intf;
+
+	eth_dev->dev_ops = &dpaa_ol_devops;
+	eth_dev->rx_pkt_burst = dpaa_eth_queue_rx;
+	eth_dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
+
+	/* Allocate memory for storing MAC addresses */
+	eth_dev->data->mac_addrs = rte_zmalloc("mac_addr",
+			RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER, 0);
+	if (eth_dev->data->mac_addrs == NULL) {
+		DPAA_PMD_ERR("Failed to allocate %d bytes needed to "
+			     "store MAC addresses",
+			     RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER);
+		ret = -ENOMEM;
+		goto free_rx;
+	}
+
+	return 0;
+
+free_rx:
+	dpaa_oldev_queues_release(dpaa_intf);
+	return ret;
+}
+
+static int dpaa_ol_probe(__rte_unused struct rte_dpaa_driver *dpaa_drv,
+			 struct rte_dpaa_device *dpaa_dev)
+{
+	int ret;
+	struct rte_eth_dev *eth_dev;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* The offline port's frame queues are created with dynamic FQIDs and
+	 * programmed into the kernel through the control device, all of which
+	 * is owned by the primary. A secondary has no way to attach to that
+	 * state, so do not advertise the port here rather than run
+	 * dpaa_oldev_init() against resources it does not own.
+	 */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		DPAA_PMD_WARN("%s: not supported in secondary process",
+			      dpaa_dev->device.name);
+		return -ENOTSUP;
+	}
+
+	eth_dev = rte_eth_dev_allocate(dpaa_dev->name);
+	if (!eth_dev)
+		return -ENOMEM;
+	eth_dev->data->dev_private = rte_zmalloc("ethdev private structure",
+						 sizeof(struct dpaa_if),
+						 RTE_CACHE_LINE_SIZE);
+	if (!eth_dev->data->dev_private) {
+		DPAA_PMD_ERR("Cannot allocate memzone for port data");
+		rte_eth_dev_release_port(eth_dev);
+		return -ENOMEM;
+	}
+
+	eth_dev->device = &dpaa_dev->device;
+
+	ret = dpaa_oldev_init(eth_dev);
+	if (ret == 0) {
+		rte_eth_dev_probing_finish(eth_dev);
+		return 0;
+	}
+
+	/* dpaa_oldev_init() has already released its own allocations. */
+	rte_eth_dev_release_port(eth_dev);
+	return ret;
+}
+
+static int dpaa_ol_remove(struct rte_dpaa_device *dpaa_dev)
+{
+	struct rte_eth_dev *eth_dev;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* A secondary never probed this device, see dpaa_ol_probe(). */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	eth_dev = rte_eth_dev_allocated(dpaa_dev->device.name);
+	if (eth_dev == NULL)
+		return 0;
+
+	/* Shut down the FQs and free the driver private rx/tx_queues. This is
+	 * idempotent, so it is safe even if the application already called
+	 * rte_eth_dev_close() (which runs the same callback).
+	 */
+	dpaa_ol_dev_close(eth_dev);
+
+	return rte_eth_dev_release_port(eth_dev);
+}
+
+static struct rte_dpaa_driver rte_dpaa_ol_pmd = {
+		.drv_type = FSL_DPAA_OL,
+		.probe = dpaa_ol_probe,
+		.remove = dpaa_ol_remove,
+};
+
+RTE_PMD_REGISTER_DPAA(ol_dpaa, rte_dpaa_ol_pmd);
+RTE_PMD_REGISTER_PARAM_STRING(ol_dpaa,
+		DRIVER_OL_BH_PORT "=<string>");
diff --git a/drivers/net/dpaa/meson.build b/drivers/net/dpaa/meson.build
index 8d4f69c596..3ec1091197 100644
--- a/drivers/net/dpaa/meson.build
+++ b/drivers/net/dpaa/meson.build
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright 2018-2020 NXP
+# Copyright 2018-2020,2026 NXP
 
 if not is_linux
     build = false
@@ -9,12 +9,13 @@ deps += ['mempool_dpaa']
 
 sources = files(
         'dpaa_ethdev.c',
-        'fmlib/fm_lib.c',
-        'fmlib/fm_vsp.c',
         'dpaa_flow.c',
-        'dpaa_rxtx.c',
         'dpaa_fmc.c',
         'dpaa_ptp.c',
+        'dpaa_oldev.c',
+        'dpaa_rxtx.c',
+        'fmlib/fm_lib.c',
+        'fmlib/fm_vsp.c',
 )
 
 cflags += no_wvla_cflag
@@ -24,4 +25,4 @@ if cc.has_argument('-Wno-pointer-arith')
     cflags += '-Wno-pointer-arith'
 endif
 
-headers = files('rte_pmd_dpaa.h')
+headers = files('rte_pmd_dpaa.h', 'rte_pmd_dpaa_oldev.h')
diff --git a/drivers/net/dpaa/rte_pmd_dpaa_oldev.h b/drivers/net/dpaa/rte_pmd_dpaa_oldev.h
new file mode 100644
index 0000000000..df0fdbc885
--- /dev/null
+++ b/drivers/net/dpaa/rte_pmd_dpaa_oldev.h
@@ -0,0 +1,188 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2026 NXP
+ */
+
+#ifndef _RTE_PMD_DPAA_OLDEV_H
+#define _RTE_PMD_DPAA_OLDEV_H
+
+/**
+ * @file rte_pmd_dpaa_oldev.h
+ *
+ * NXP DPAA offline (O/H) port PMD-specific API.
+ *
+ * @warning
+ * @b EXPERIMENTAL:
+ * All functions in this file may be changed or removed without prior notice.
+ *
+ * These APIs configure the classification, local gateway (LGW) and related
+ * uplink information for the DPAA offline port through the kernel control
+ * device.
+ */
+
+#include <stdint.h>
+#include <rte_common.h>
+#include <rte_compat.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** IPv4 address type for the inner/static address pair used in uplink
+ * classification.
+ */
+#define RTE_PMD_DPAA_OLDEV_IPV4_ADDR_TYPE  0x04
+/** IPv6 address type for the inner/static address pair used in uplink
+ * classification.
+ */
+#define RTE_PMD_DPAA_OLDEV_IPV6_ADDR_TYPE  0x06
+
+/** Maximum number of GTP UDP ports an application can listen on. */
+#define RTE_PMD_DPAA_OLDEV_MAX_NUM_PORTS 2
+
+/** IPv4 subnet type for an LGW subnet entry. */
+#define RTE_PMD_DPAA_OLDEV_IPV4_SUBNET_TYPE  0x04
+/** IPv6 subnet type for an LGW subnet entry. */
+#define RTE_PMD_DPAA_OLDEV_IPV6_SUBNET_TYPE  0x06
+/** Maximum number of LGW subnets that can be programmed. */
+#define RTE_PMD_DPAA_OLDEV_MAX_NUM_SUBNETS 4
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags when the address pair carries
+ * a valid inner IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_CLASSIF_INNER_IP 0x1
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags when the address pair carries
+ * a static IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_CLASSIF_STATIC_IP 0x2
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags to indicate the telecom
+ * application is listening only on the static IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_TELECOM_LISTEN_ON_ONLY_STATICIP 0x4
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags to indicate the telecom
+ * application is listening on both the static and the inner IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_TELECOM_LISTEN_ON_BOTH_STATIC_INNER_IP 0x8
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags to indicate the telecom
+ * application is listening only on the inner IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_TELECOM_LISTEN_ON_ONLY_INNERIP 0x10
+
+/**
+ * Holds an IPv4 or IPv6 address.
+ *
+ * For an IPv4 address only ip_addr[0] is used; for an IPv6 address all
+ * four words are used. Which representation applies is determined by
+ * the addr_type field of the enclosing struct rte_pmd_dpaa_ip_pair.
+ */
+struct rte_pmd_dpaa_ip_addr {
+	uint32_t ip_addr[4]; /**< Address words, network byte order. */
+};
+
+/** Static/inner IP address pair used for uplink classification. */
+struct __rte_packed_begin rte_pmd_dpaa_ip_pair {
+	struct rte_pmd_dpaa_ip_addr static_ip; /**< Static IP address. */
+	struct rte_pmd_dpaa_ip_addr inner_ip;  /**< Inner IP address. */
+	uint8_t flags;		/**< Combination of
+				  *  RTE_PMD_DPAA_OLDEV_CLASSIF_* and
+				  *  RTE_PMD_DPAA_OLDEV_TELECOM_* flags.
+				  */
+	uint8_t addr_type;	/**< RTE_PMD_DPAA_OLDEV_IPV4_ADDR_TYPE or
+				  *  RTE_PMD_DPAA_OLDEV_IPV6_ADDR_TYPE.
+				  */
+	uint8_t pad[2];		/**< Reserved, must be zero. */
+} __rte_packed_end;
+
+/** A single local gateway (LGW) subnet entry. */
+struct __rte_packed_begin rte_pmd_dpaa_lgw_subnet {
+	uint32_t subnet[4];	/**< Subnet address, network byte order. */
+	uint8_t mask;		/**< Subnet mask length in bits. */
+	uint8_t subnet_type;	/**< RTE_PMD_DPAA_OLDEV_IPV4_SUBNET_TYPE or
+				  *   RTE_PMD_DPAA_OLDEV_IPV6_SUBNET_TYPE.
+				  */
+	uint8_t pad[2];		/**< Reserved, must be zero. */
+} __rte_packed_end;
+
+/** Uplink classification information for the DPAA offline port. */
+struct rte_pmd_dpaa_uplink_cls_info_s {
+	struct rte_pmd_dpaa_ip_pair addr_pair;	/**< Static/inner IP pair. */
+	/** GTP UDP ports the application listens on. */
+	uint16_t gtp_udp_port[RTE_PMD_DPAA_OLDEV_MAX_NUM_PORTS];
+	uint8_t gtp_proto_id;	/**< UDP protocol ID the application listens
+				  *   on.
+				  */
+	uint8_t num_ports;	/**< Number of valid entries in
+				  *   gtp_udp_port.
+				  */
+	uint8_t sec_enabled;	/**< Non-zero if IPsec is enabled. */
+	uint8_t pad;		/**< Reserved, must be zero. */
+};
+
+/** Local gateway (LGW) information for the DPAA offline port. */
+struct __rte_packed_begin rte_pmd_dpaa_lgw_info_s {
+	/** LGW subnet table. */
+	struct rte_pmd_dpaa_lgw_subnet subnets[RTE_PMD_DPAA_OLDEV_MAX_NUM_SUBNETS];
+	uint8_t num_subnets;	/**< Number of valid entries in subnets. */
+	uint8_t pad[3];		/**< Reserved, must be zero. */
+} __rte_packed_end;
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Program the uplink classification information for the DPAA offline port.
+ *
+ * @param cls_info
+ *   Pointer to the classification information to program. Must not be NULL.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_set_classif_info(struct rte_pmd_dpaa_uplink_cls_info_s *cls_info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Reset the uplink classification information for the DPAA offline port.
+ *
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_reset_classif_info(void);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Program the local gateway (LGW) information for the DPAA offline port.
+ *
+ * @param lgw_info
+ *   Pointer to the LGW information to program. Must not be NULL.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_set_lgw_info(struct rte_pmd_dpaa_lgw_info_s *lgw_info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Reset the local gateway (LGW) information for the DPAA offline port.
+ *
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_reset_lgw_info(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PMD_DPAA_OLDEV_H */
-- 
2.25.1


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

* [PATCH v2 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name
  2026-10-30  4:43 ` [PATCH v2 0/4] " Gagandeep Singh
  2026-10-30  4:43   ` [PATCH v2 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
  2026-10-30  4:43   ` [PATCH v2 2/4] drivers: add offline (O/H) port device support Gagandeep Singh
@ 2026-10-30  4:43   ` Gagandeep Singh
  2026-10-30  4:43   ` [PATCH v2 4/4] drivers: add DPAA cgrid cleanup support Gagandeep Singh
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-10-30  4:43 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

A shared MAC interface needs the kernel netdev name to read the MTU,
and that name is only the DPDK port name for fmX-macY style netdevs.

Look it up in sysfs under the platform device of the dpa-ethernet node
the port was created from, and fall back to the port name.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/nics/dpaa.rst       |  6 ++-
 drivers/net/dpaa/dpaa_ethdev.c | 68 +++++++++++++++++++++++++++++++++-
 2 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst
index 21f54bcd36..2094abf417 100644
--- a/doc/guides/nics/dpaa.rst
+++ b/doc/guides/nics/dpaa.rst
@@ -276,6 +276,11 @@ Refer to the document :doc:`build_and_test` for details.
   and thus disabling hardware based packet handling at driver level,
   e.g. ``dpaa:fm1-mac3,recv_err_pkts=1``.
 
+* For a shared MAC interface the kernel network interface name is looked up
+  in sysfs from the device tree node the port was created from,
+  so a kernel interface that does not follow
+  the ``fmX-macY`` naming style is handled without extra configuration.
+
 ``drv_bh_port``
    Name of the back-half port associated with an offline (O/H) port device.
    It is passed on the offline port device itself, which is named
@@ -306,7 +311,6 @@ control device can be programmed by the application via the experimental
 ``rte_pmd_dpaa_ol_set_lgw_info()`` and ``rte_pmd_dpaa_ol_reset_lgw_info()``
 APIs declared in ``rte_pmd_dpaa_oldev.h``.
 
-
 FMAN Config
 -----------
 
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index fe49c7b961..a821e68807 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -9,12 +9,14 @@
 #include <inttypes.h>
 #include <unistd.h>
 #include <limits.h>
+#include <stdlib.h>
 #include <sched.h>
 #include <signal.h>
 #include <pthread.h>
 #include <sys/types.h>
 #include <sys/syscall.h>
 #include <sys/ioctl.h>
+#include <dirent.h>
 
 #include <eal_export.h>
 #include <rte_string_fns.h>
@@ -57,6 +59,61 @@
 #define DRIVER_RECV_ERR_PKTS      "recv_err_pkts"
 #define RTE_PRIORITY_103 103
 
+#define DPAA_OF_BASE_PATH "/sys/firmware/devicetree/base"
+
+/*
+ * Get the kernel netdev name bound to the same device tree node as this
+ * port, by matching each /sys/class/net/<ifname>/device/of_node against
+ * node_path. Returns 1 on success, 0 if none was found, negative on error.
+ */
+static int
+dpaa_get_kernel_ifname(const char *node_path, char *name, size_t size)
+{
+	char path[PATH_MAX], resolved[PATH_MAX];
+	struct dirent *entry;
+	DIR *dir;
+	int ret;
+
+	if (!node_path || node_path[0] == '\0')
+		return 0;
+
+	dir = opendir("/sys/class/net");
+	if (!dir)
+		return 0;
+
+	ret = 0;
+	while ((entry = readdir(dir)) != NULL) {
+		if (entry->d_name[0] == '.')
+			continue;
+
+		if (snprintf(path, sizeof(path),
+			     "/sys/class/net/%s/device/of_node",
+			     entry->d_name) >= (int)sizeof(path))
+			continue;
+
+		if (realpath(path, resolved) == NULL)
+			continue;
+
+		if (strncmp(resolved, DPAA_OF_BASE_PATH,
+			    strlen(DPAA_OF_BASE_PATH)) != 0)
+			continue;
+
+		if (strcmp(resolved + strlen(DPAA_OF_BASE_PATH),
+			   node_path) != 0)
+			continue;
+
+		if (rte_strscpy(name, entry->d_name, size) < 0) {
+			ret = -ENAMETOOLONG;
+			break;
+		}
+		ret = 1;
+		break;
+	}
+
+	closedir(dir);
+	return ret;
+}
+
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		RTE_ETH_RX_OFFLOAD_SCATTER;
@@ -251,6 +308,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	int speed, duplex;
 	int ret, rx_status, socket_fd;
 	struct ifreq ifr;
+	char sh_if_name[IFNAMSIZ];
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -272,7 +330,15 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 			DPAA_PMD_ERR("Cannot open IF socket");
 			return -errno;
 		}
-		strlcpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
+
+		/* The DPDK port name matches the netdev only for fmX-macY. */
+		sh_if_name[0] = '\0';
+		ret = dpaa_get_kernel_ifname(__fif->node_path, sh_if_name,
+					     sizeof(sh_if_name));
+		if (ret <= 0 || sh_if_name[0] == '\0')
+			strlcpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
+		else
+			strlcpy(ifr.ifr_name, sh_if_name, IFNAMSIZ);
 
 		if (ioctl(socket_fd, SIOCGIFMTU, &ifr) < 0) {
 			DPAA_PMD_ERR("Cannot get interface mtu");
-- 
2.25.1


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

* [PATCH v2 4/4] drivers: add DPAA cgrid cleanup support
  2026-10-30  4:43 ` [PATCH v2 0/4] " Gagandeep Singh
                     ` (2 preceding siblings ...)
  2026-10-30  4:43   ` [PATCH v2 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
@ 2026-10-30  4:43   ` Gagandeep Singh
  2026-11-02  8:09   ` [PATCH v2 0/4] DPAA driver changes Stephen Hemminger
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-10-30  4:43 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, stable, Jun Yang

From: Jun Yang <jun.yang@nxp.com>

A congestion group must have no member frame queues left when it is
deleted, and its CGRID must be returned to the allocator once the group
is gone. Neither was handled on the net/dpaa close and probe-failure
paths.

This also changes probe behaviour: a qman_create_cgr() failure in
dpaa_rx_queue_init() or dpaa_tx_queue_init() now fails the probe
instead of continuing without tail drop on that queue. The probe error
path deletes one CGR per initialised queue, and a CGR whose creation
failed was never linked into the portal list.

Fixes: 62f53995caaf ("net/dpaa: add frame count based tail drop with CGR")
Fixes: 9124e65dd3eb ("net/dpaa: enable Tx queue taildrop")
Cc: stable@dpdk.org

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/dpaa/base/qbman/qman.c       |  61 ++++++++
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   1 +
 drivers/bus/dpaa/include/fsl_qman.h      |  27 ++++
 drivers/net/dpaa/dpaa_ethdev.c           | 173 +++++++++++++++++++++--
 4 files changed, 250 insertions(+), 12 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 3c056e4547..fa3387c6bd 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -2993,3 +2993,64 @@ qman_shutdown_fq(struct qman_fq *fq)
 out:
 	return ret;
 }
+
+int qman_pending_fq_by_cgrid_range(u32 cgrid_start, u32 cgrid_num,
+	u32 start_fqid, u32 *fqid, u32 *cgrid)
+{
+	struct qman_fq fq = {
+		.fqid = start_fqid ? start_fqid : 1
+	};
+	struct qm_mcr_queryfq_np np;
+	struct qm_fqd fqd;
+	int err;
+
+	/*
+	 * Do not use the CGR byte count to decide whether to scan. An FQ is a
+	 * member of the group whenever it is scheduled with CGE set and a
+	 * matching cgid, whether or not it currently holds any frames, and the
+	 * group cannot be deleted while such a member exists. Skipping the
+	 * scan for an empty CGR would let an idle stale FQ survive and its
+	 * CGRID be released while still referenced. This runs from the device
+	 * close path only, so the scan cost is acceptable.
+	 *
+	 * The whole CGRID range of a port is matched in a single pass, so a
+	 * port with many congestion groups does not need one full FQID space
+	 * scan per group.
+	 */
+	DPAA_BUS_DEBUG("Scanning FQs for cgrid(0x%x..0x%x)",
+		cgrid_start, cgrid_start + cgrid_num - 1);
+
+	/* FQID space is 24 bits wide; stop before wrapping. */
+	for (; fq.fqid <= QMAN_MAX_FQID; fq.fqid++) {
+		err = qman_query_fq_np(&fq, &np);
+		if (err == -ERANGE) {
+			/*
+			 * FQID is not implemented on this device, so there is
+			 * nothing beyond it either.
+			 */
+			break;
+		} else if (err) {
+			DPAA_BUS_WARN("Failed(%d) to Query np FQ(fqid=0x%x)",
+				err, fq.fqid);
+			return err;
+		}
+		if ((np.state & QM_MCR_NP_STATE_MASK) != QM_MCR_NP_STATE_OOS) {
+			err = qman_query_fq(&fq, &fqd);
+			if (err) {
+				DPAA_BUS_WARN("Failed(%d) to Query FQ(fqid=0x%x)",
+					err, fq.fqid);
+			} else if ((fqd.fq_ctrl & QM_FQCTRL_CGE) &&
+				fqd.cgid >= cgrid_start &&
+				fqd.cgid < cgrid_start + cgrid_num) {
+				if (fqid)
+					*fqid = fq.fqid;
+				if (cgrid)
+					*cgrid = fqd.cgid;
+				return 0;
+			}
+		}
+	}
+	DPAA_BUS_DEBUG("No FQ left in cgrid(0x%x..0x%x)",
+		cgrid_start, cgrid_start + cgrid_num - 1);
+	return -ERANGE;
+}
diff --git a/drivers/bus/dpaa/dpaa_bus_base_symbols.c b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
index aaa9f9bec2..4da43f293d 100644
--- a/drivers/bus/dpaa/dpaa_bus_base_symbols.c
+++ b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
@@ -57,6 +57,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(qman_reserve_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_pool_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_cgrid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_release_cgrid_range)
+RTE_EXPORT_INTERNAL_SYMBOL(qman_pending_fq_by_cgrid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_intr_enable)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_intr_disable)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_get_ioctl_version_number)
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index b2674ce5d0..6d76722275 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1284,6 +1284,9 @@ struct qman_cgr {
  */
 #define QMAN_FQRN_WAIT_MAX		10000000u
 
+/* Maximum FQID value: frame queue IDs are 24 bits wide. */
+#define QMAN_MAX_FQID			0x00FFFFFFu
+
 /* Flags to qman_create_fq() */
 #define QMAN_FQ_FLAG_NO_ENQUEUE      0x00000001 /* can't enqueue */
 #define QMAN_FQ_FLAG_NO_MODIFY       0x00000002 /* can only enqueue */
@@ -1916,6 +1919,30 @@ static inline int qman_shutdown_fq_by_fqid(u32 fqid)
 	return qman_shutdown_fq(&fq);
 }
 
+/**
+ * qman_pending_fq_by_cgrid_range - Find an FQ still attached to a CGR range.
+ *
+ * @cgrid_start: first congestion group id of the range to search for.
+ * @cgrid_num: number of consecutive congestion group ids in the range.
+ * @start_fqid: FQID to begin the scan from (0 or 1 means scan from the
+ *   start). A caller shutting down several stale FQs can pass the previously
+ *   returned FQID + 1 to resume the scan instead of restarting from the
+ *   beginning each time.
+ * @fqid: on success, holds the FQID that is still attached to the range.
+ * @cgrid: on success, holds the congestion group id that FQ belongs to.
+ *   May be NULL.
+ *
+ * Matching a whole range in one pass lets a caller with many congestion
+ * groups, such as a port releasing all of its Rx or Tx CGRs, avoid one full
+ * FQID space scan per group.
+ *
+ * Return 0 and set *fqid when a matching FQ is found, -ERANGE when none is
+ * left, or a negative error code on query failure.
+ */
+__rte_internal
+int qman_pending_fq_by_cgrid_range(u32 cgrid_start, u32 cgrid_num,
+		u32 start_fqid, u32 *fqid, u32 *cgrid);
+
 /**
  * qman_reserve_fqid_range - Reserve the specified range of frame queue IDs
  * @fqid: the base FQID of the range to deallocate
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index a821e68807..1f5e03a8ac 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -114,6 +114,9 @@ dpaa_get_kernel_ifname(const char *node_path, char *name, size_t size)
 	return ret;
 }
 
+/* Maximum number of stale frame queues cleaned up per congestion group. */
+#define DPAA_CGR_STALE_FQ_MAX     64
+
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		RTE_ETH_RX_OFFLOAD_SCATTER;
@@ -585,6 +588,49 @@ static int dpaa_eth_dev_stop(struct rte_eth_dev *dev)
 	return 0;
 }
 
+/* Shut down any frame queue still linked to this CGR.
+ *
+ * A CGR must have no members left when it is deleted. FQs left behind by a
+ * previous run of the application are not owned by this process, so they can
+ * only be found by asking QMan. There may be more than one, hence the loop.
+ *
+ * Returns true if the FQID range was fully scanned (i.e. no stale FQ was
+ * left behind), false if an FQ refused to shut down and the scan had to
+ * stop early.
+ */
+static bool
+dpaa_cgr_stale_fq_cleanup(struct rte_eth_dev *dev, uint32_t cgrid_start,
+			  uint32_t cgrid_num, const char *dir)
+{
+	uint32_t start_fqid = 1;
+	uint32_t fqid, cgrid;
+	uint32_t loop, max_loop;
+	int ret;
+
+	max_loop = cgrid_num * DPAA_CGR_STALE_FQ_MAX;
+	for (loop = 0; loop < max_loop; loop++) {
+		if (qman_pending_fq_by_cgrid_range(cgrid_start, cgrid_num,
+						   start_fqid, &fqid, &cgrid))
+			return true;
+		/* Should be FQ not cleaned in previous program. */
+		DPAA_PMD_DEBUG("FQ(fqid=0x%x) with %s cgid=%u is still alive?",
+			fqid, dir, cgrid);
+		ret = qman_shutdown_fq_by_fqid(fqid);
+		if (ret) {
+			DPAA_PMD_WARN("%s: Failed(%d) to shutdown %s cgid=%u's fq(fqid=0x%x)",
+				dev->data->name, ret, dir, cgrid, fqid);
+			/* Do not spin on an FQ that refuses to shut down. */
+			return false;
+		}
+		/* Resume the scan past the FQ just handled instead of
+		 * restarting from the beginning, which would be O(N^2) for
+		 * N stale FQs.
+		 */
+		start_fqid = fqid + 1;
+	}
+	return true;
+}
+
 static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 {
 	struct fman_if *fif = dev->process_private;
@@ -594,7 +640,7 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 	struct rte_eth_link *link = &dev->data->dev_link;
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 	struct qman_fq *fq;
-	int loop;
+	uint32_t loop;
 	int ret;
 
 	PMD_INIT_FUNC_TRACE();
@@ -669,26 +715,81 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 	/* Release congestion Groups after releasing FQIDs */
 	/* Release RX congestion Groups */
 	if (dpaa_intf->cgr_rx) {
+		bool cgrid_ok;
+
+		/* The CGRIDs are a contiguous range, so one scan of the FQID
+		 * space covers all of them. This catches any FQ left behind
+		 * by a previous, non-gracefully-terminated run of this
+		 * process that is still linked to one of these CGRs.
+		 */
+		cgrid_ok = dpaa_cgr_stale_fq_cleanup(dev, dpaa_intf->cgr_rx[0].cgrid,
+					  dpaa_intf->nb_rx_queues, "rx");
+
+		/* These are this port's own Rx FQs from the current run, so
+		 * their FQIDs are already known. Shut each one down so it is
+		 * no longer a member of its CGR, since a CGR must have no
+		 * members left when it is deleted.
+		 */
+		for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) {
+			ret = qman_shutdown_fq(&dpaa_intf->rx_queues[loop]);
+			if (ret) {
+				DPAA_PMD_WARN("%s: shutdown rxq%d err(%d)",
+					dev->data->name, loop, ret);
+				cgrid_ok = false;
+			}
+		}
 		for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) {
 			ret = qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
 			if (ret) {
 				DPAA_PMD_WARN("%s: delete rxq%d's cgr err(%d)",
 					dev->data->name, loop, ret);
+				cgrid_ok = false;
 			}
 		}
+		/* Only hand the CGRIDs back to the allocator if every member
+		 * FQ was confirmed shut down and every CGR deleted; otherwise
+		 * deliberately leak them rather than reuse a CGRID that may
+		 * still be referenced by a live FQ.
+		 */
+		if (cgrid_ok)
+			qman_release_cgrid_range(dpaa_intf->cgr_rx[0].cgrid,
+					dpaa_intf->nb_rx_queues);
 		rte_free(dpaa_intf->cgr_rx);
 		dpaa_intf->cgr_rx = NULL;
 	}
 
 	/* Release TX congestion Groups */
 	if (dpaa_intf->cgr_tx) {
+		bool cgrid_ok;
+
+		/* See the equivalent comment for the Rx CGRs above about
+		 * cleaning up stale FQs left behind by a previous run.
+		 */
+		cgrid_ok = dpaa_cgr_stale_fq_cleanup(dev, dpaa_intf->cgr_tx[0].cgrid,
+					  MAX_DPAA_CORES, "tx");
+
+		/* See the equivalent comment for the Rx CGRs above about
+		 * shutting down this port's own FQs.
+		 */
+		for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
+			ret = qman_shutdown_fq(&dpaa_intf->tx_queues[loop]);
+			if (ret) {
+				DPAA_PMD_WARN("%s: shutdown txq%d err(%d)",
+					dev->data->name, loop, ret);
+				cgrid_ok = false;
+			}
+		}
 		for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
 			ret = qman_delete_cgr(&dpaa_intf->cgr_tx[loop]);
 			if (ret) {
 				DPAA_PMD_WARN("%s: delete txq%d's cgr err(%d)",
 					dev->data->name, loop, ret);
+				cgrid_ok = false;
 			}
 		}
+		if (cgrid_ok)
+			qman_release_cgrid_range(dpaa_intf->cgr_tx[0].cgrid,
+						 MAX_DPAA_CORES);
 		rte_free(dpaa_intf->cgr_tx);
 		dpaa_intf->cgr_tx = NULL;
 	}
@@ -2039,19 +2140,32 @@ static int dpaa_rx_queue_init(struct qman_fq *fq, struct qman_cgr *cgr_rx,
 		ret = qman_create_cgr(cgr_rx, QMAN_CGR_FLAG_USE_INIT,
 				      &cgr_opts);
 		if (ret) {
-			DPAA_PMD_WARN(
-				"rx taildrop init fail on rx fqid 0x%x(ret=%d)",
+			/* Do not fall back to running without the CGR. The
+			 * caller counts one CGR per queue it initialised and
+			 * deletes cgr_rx[0..n) on its error path, so a queue
+			 * without a CGR would make it delete an object that
+			 * was never added to the portal list, whose node is
+			 * still zeroed from rte_zmalloc().
+			 */
+			DPAA_PMD_ERR("rx taildrop init fail on rx fqid 0x%x(ret=%d)",
 				fq->fqid, ret);
-			goto without_cgr;
+			return ret;
 		}
 		opts.we_mask |= QM_INITFQ_WE_CGID;
 		opts.fqd.cgid = cgr_rx->cgrid;
 		opts.fqd.fq_ctrl |= QM_FQCTRL_CGE;
 	}
-without_cgr:
+
 	ret = qman_init_fq(fq, 0, &opts);
-	if (ret)
+	if (ret) {
 		DPAA_PMD_ERR("init rx fqid 0x%x failed with ret:%d", fqid, ret);
+		/* The caller only counts this CGR once this function returns
+		 * success, so its error path will not delete it. Unlink it here
+		 * or the portal keeps a pointer into memory the caller frees.
+		 */
+		if (cgr_rx)
+			qman_delete_cgr(cgr_rx);
+	}
 	return ret;
 }
 
@@ -2130,10 +2244,12 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 		ret = qman_create_cgr(cgr_tx, QMAN_CGR_FLAG_USE_INIT,
 				      &cgr_opts);
 		if (ret) {
-			DPAA_PMD_WARN(
-				"rx taildrop init fail on rx fqid 0x%x(ret=%d)",
+			/* See the equivalent comment in
+			 * dpaa_rx_queue_init().
+			 */
+			DPAA_PMD_ERR("tx taildrop init fail on tx fqid 0x%x(ret=%d)",
 				fq->fqid, ret);
-			goto without_cgr;
+			return ret;
 		}
 		opts.we_mask |= QM_INITFQ_WE_CGID;
 		opts.fqd.cgid = cgr_tx->cgrid;
@@ -2141,10 +2257,14 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 		DPAA_PMD_DEBUG("Tx FQ tail drop enabled, threshold = %d",
 				td_tx_threshold);
 	}
-without_cgr:
+
 	ret = qman_init_fq(fq, QMAN_INITFQ_FLAG_SCHED, &opts);
-	if (ret)
+	if (ret) {
 		DPAA_PMD_ERR("init tx fqid 0x%x failed %d", fq->fqid, ret);
+		/* See the equivalent comment in dpaa_rx_queue_init(). */
+		if (cgr_tx)
+			qman_delete_cgr(cgr_tx);
+	}
 	return ret;
 }
 
@@ -2316,6 +2436,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	int num_rx_fqs, fqid;
 	int loop, ret = 0;
 	int dev_id;
+	int nb_rx_cgr = 0, nb_tx_cgr = 0;
+	bool rx_cgrid_allocated = false, tx_cgrid_allocated = false;
 	struct rte_dpaa_device *dpaa_device;
 	struct dpaa_if *dpaa_intf;
 	struct fm_eth_port_cfg *cfg;
@@ -2437,6 +2559,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			ret = -EINVAL;
 			goto free_rx;
 		}
+		rx_cgrid_allocated = true;
 	} else {
 		dpaa_intf->cgr_rx = NULL;
 	}
@@ -2471,6 +2594,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			fqid);
 		if (ret)
 			goto free_rx;
+		if (dpaa_intf->cgr_rx)
+			nb_rx_cgr++;
 		dpaa_intf->rx_queues[loop].vsp_id = vsp_id;
 		dpaa_intf->rx_queues[loop].dpaa_intf = dpaa_intf;
 	}
@@ -2511,11 +2636,11 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			ret = -EINVAL;
 			goto free_tx;
 		}
+		tx_cgrid_allocated = true;
 	} else {
 		dpaa_intf->cgr_tx = NULL;
 	}
 
-
 	for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
 		if (dpaa_intf->cgr_tx)
 			dpaa_intf->cgr_tx[loop].cgrid = cgrid_tx[loop];
@@ -2526,6 +2651,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			dpaa_intf->cgr_tx ? &dpaa_intf->cgr_tx[loop] : NULL);
 		if (ret)
 			goto free_tx;
+		if (dpaa_intf->cgr_tx)
+			nb_tx_cgr++;
 
 		if (dpaa_intf->ts_enable) {
 			ret = dpaa_tx_conf_queue_init(&dpaa_intf->tx_conf_queues[loop]);
@@ -2605,6 +2732,17 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	return 0;
 
 free_tx:
+	/* A CGR must have no members when deleted, so shut down the FQs
+	 * already linked to it first. Each CGR was also linked into the
+	 * QMan portal's cgr_cbs list by qman_create_cgr(), so deleting it
+	 * here avoids leaving the portal with dangling pointers.
+	 */
+	for (loop = 0; loop < nb_tx_cgr; loop++)
+		qman_shutdown_fq(&dpaa_intf->tx_queues[loop]);
+	for (loop = 0; loop < nb_tx_cgr; loop++)
+		qman_delete_cgr(&dpaa_intf->cgr_tx[loop]);
+	if (tx_cgrid_allocated)
+		qman_release_cgrid_range(cgrid_tx[0], MAX_DPAA_CORES);
 	rte_free(dpaa_intf->tx_conf_queues);
 	dpaa_intf->tx_conf_queues = NULL;
 	rte_free(dpaa_intf->tx_queues);
@@ -2612,8 +2750,19 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	dpaa_intf->nb_tx_queues = 0;
 
 free_rx:
+	/* Same as above for the Rx CGRs: shut down the FQs still linked to
+	 * their CGR before deleting it.
+	 */
+	for (loop = 0; loop < nb_rx_cgr; loop++)
+		qman_shutdown_fq(&dpaa_intf->rx_queues[loop]);
+	for (loop = 0; loop < nb_rx_cgr; loop++)
+		qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
+	if (rx_cgrid_allocated)
+		qman_release_cgrid_range(cgrid[0], num_rx_fqs);
 	rte_free(dpaa_intf->cgr_rx);
+	dpaa_intf->cgr_rx = NULL;
 	rte_free(dpaa_intf->cgr_tx);
+	dpaa_intf->cgr_tx = NULL;
 	rte_free(dpaa_intf->rx_queues);
 	dpaa_intf->rx_queues = NULL;
 	dpaa_intf->nb_rx_queues = 0;
-- 
2.25.1


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

* RE: [PATCH v1 0/3] DPAA driver changes
  2026-10-28 14:41 ` [PATCH v1 0/3] DPAA driver changes Stephen Hemminger
@ 2026-10-30  4:43   ` Gagandeep Singh
  0 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-10-30  4:43 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev@dpdk.org, Hemant Agrawal

Hi,


NXP Confidential
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Wednesday, October 28, 2026 8:11 PM
> To: Gagandeep Singh <G.Singh@nxp.com>
> Cc: dev@dpdk.org; Hemant Agrawal <hemant.agrawal@nxp.com>
> Subject: Re: [PATCH v1 0/3] DPAA driver changes
>
> On Wed, 28 Oct 2026 14:25:14 +0530
> Gagandeep Singh <g.singh@nxp.com> wrote:
>
> >  - Adding OH port support.
> >  - Updates in shared ethernet code.
> >  - Congestion related code cleanup.
> >
> > Gagandeep Singh (1):
> >   drivers: add offline (O/H) port device support
> >
> > Hemant Agrawal (1):
> >   net/dpaa: support non fmX-macY type of shared Ethernet name
> >
> > Jun Yang (1):
> >   drivers: add DPAA cgrid cleanup support
> >
> >  doc/api/doxy-api-index.md                |   1 +
> >  doc/guides/nics/dpaa.rst                 |  32 +
> >  drivers/bus/dpaa/base/fman/fman.c        |  19 +
> >  drivers/bus/dpaa/base/qbman/qman.c       |  61 ++
> >  drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
> >  drivers/bus/dpaa/dpaa_bus.c              | 100 ++-
> >  drivers/bus/dpaa/dpaa_bus_base_symbols.c |   2 +
> >  drivers/bus/dpaa/include/fman.h          |   6 +-
> >  drivers/bus/dpaa/include/fsl_qman.h      |  28 +
> >  drivers/net/dpaa/dpaa_ethdev.c           | 176 ++++-
> >  drivers/net/dpaa/dpaa_ethdev.h           |   3 +
> >  drivers/net/dpaa/dpaa_flow.c             |   7 +-
> >  drivers/net/dpaa/dpaa_oldev.c            | 875 +++++++++++++++++++++++
> >  drivers/net/dpaa/meson.build             |  11 +-
> >  drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 158 ++++
> >  15 files changed, 1454 insertions(+), 29 deletions(-)  create mode
> > 100644 drivers/net/dpaa/dpaa_oldev.c  create
>
> AI review found issues. The biggest one is carrying vendor private ioctl data
> structures in DPDK.
>
> Review of [PATCH v1 0/3] DPAA offline port, shared MAC, cgrid cleanup
>
> Series
> ------
>
> The rte_pmd_dpaa_ol_* functions do not operate on a DPDK port. They take no
> port_id and only forward a caller-filled struct to an out-of-tree kernel driver
> through ioctl() on /dev/cdx_ctrl. That puts a vendor kernel ioctl ABI (GTP
> classification, "telecom application"
> flags) into an installed DPDK header under DPDK API/ABI rules. An application can
> issue these ioctls itself; this belongs in the vendor userspace library for that kernel
> module, not in DPDK. Please drop rte_pmd_dpaa_oldev.h and the four exported
> functions.
To clarify the design intent: the DPAA offline (OL) port is one half of a split-driver model. The other half is the ASK/CDX kernel module, which is part of the NXP SDK and is released together with this PMD. The OL port's Rx/Tx path runs entirely in DPDK via QMan FQs, but the classification policy deciding which GTP/IP traffic is steered to the DPDK fast path versus handled by the kernel module is configured through ASK/CDX, since that module owns the control-plane side of this split.

`rte_pmd_dpaa_ol_set_classif_info()`, `_reset_classif_info()`, `_set_lgw_info()`, and `_reset_lgw_info()` are the configuration contract for this specific, co-developed kernel module — not a generic ioctl-wrapping convenience API. The structs mirror the ASK/CDX kernel ABI by necessity, since that is the data being configured for this shared interface. So We'd like to keep these APIs in-tree as they are required for the OL port feature.

>
> The drv_oldev bus argument is redundant. The offline port is only probed if "-a
> dpaa_bus:oldev1" is given anyway, so create the oldev1 device when its devargs
> exist and drop drv_oldev, the bus_str parsing, and the allowlist caveats in
> dpaa.rst:
>
>       if (rte_bus_find_devargs(&rte_dpaa_bus, "oldev1") != NULL) {
>               /* create oldev1 */
>       }
>
> No release notes for the new port type. dpaa.rst does not say the offline port
> needs the /dev/cdx_ctrl kernel driver or where to get it.
>
>
> Patch 1/3 drivers: add offline (O/H) port device support
> --------------------------------------------------------
>
> Error
>
> dpaa_oldev_init() never sets tx_queues[0].dpaa_intf, and the queue array comes
> from rte_zmalloc(), so it is NULL. dpaa_eth_queue_tx() starts with:
>
>       struct dpaa_if *dpaa_intf = fq->dpaa_intf;
>       ...
>       if (unlikely(dpaa_intf->ts_enable)) {
>
> so the first Tx burst after dev_start dereferences NULL. Set it after the Tx FQ is
> initialised:
>
>       ret = dpaa_ol_tx_queue_init(&dpaa_intf->tx_queues[0], 0);
>       if (ret)
>               goto free_rx;
>       dpaa_intf->tx_queues[0].dpaa_intf = dpaa_intf;
>
> Warning
>
> rte_kvargs_count() only tests for presence, so "drv_oldev=0" enables the offline
> port. Moot if drv_oldev is removed as above; otherwise parse the value with
> rte_kvargs_process().
>
> dev_close() shuts down the Rx/Tx FQs and returns their FQIDs to the allocator, but
> the kernel was given those FQIDs and the bpid through
> ASK_CTRL_SET_DPDK_INFO and is never told they are gone. The next
> qman_alloc_fqid() user can receive frames the kernel enqueues to a reused FQID.
> The kernel side needs a reset ioctl issued before the FQIDs are released.
>
> The cell-index range checks in fman_if_init() and fman_if_init_onic() fix an out-of-
> bounds read of mac_idx[] and have nothing to do with the offline port. The
> commit message does not mention them, nor the MEMMAC_REG_OFFSET
> removal. Split the bounds checks into their own patch
> with:
>
>       Fixes: a0edbb8a8e52 ("bus/dpaa: add OH port mode")
>       Fixes: 7e5f49ae767d ("bus/dpaa: add ONIC port mode")
>       Cc: stable@dpdk.org
>
> drv_bh_port is required, but it is parsed on every dev_start() with a NULL key list,
> so a misspelled key is accepted at probe and the port only fails at start. Parse it
> once in dpaa_ol_probe() with a valid key list, store it in the private data, and fail
> probe if it is missing.
>
> If rte_pmd_dpaa_oldev.h stays, the installed header defines DPA_ISC_*,
> DPDK_OLDEV_*, DPDK_CLASSIF_*, DPDK_TELECOM_* and struct dpa_* without
> an RTE_/rte_ prefix, and none of the structs or fields have Doxygen.
>
> Info
>
> dpaa_ol_rx_queue_setup() checks queue_idx against nb_rx_queues; ethdev
> already does that before calling the PMD.
>
> open(ASK_PATH, O_RDWR) should use O_RDWR | O_CLOEXEC.
>
> In dpaa_create_device_list(), use snprintf() rather than sprintf(), and drop the
> memset() after calloc() and the "int i = 0" initialiser.
>
> rte_dpaa_bus_dev_build() gates the num_ethports messages on oldev_enabled;
> the condition that matters is dpaa_netcfg != NULL.
>
> The dpaa_bus_parse_bus_args() comment refers to a previous environment-
> variable configuration that never existed upstream. The bh_port_name field
> comment says "for testing purpose" but the field is mandatory.
>
>
> Patch 2/3 net/dpaa: support non fmX-macY type of shared Ethernet name
> ---------------------------------------------------------------------
>
> Warning
>
> Platform devices created from device-tree nodes without a reg property are
> named after the whole parent chain, which is why dpaa_bus.c uses
> "/sys/devices/platform/soc/soc:fsl,dpaa". A dpa-ethernet child of that node is not
> "ethernet@N" under /sys/bus/platform/devices, so
>
>       node = strrchr(node_path, '/');
>       ...
>       "/sys/bus/platform/devices/%s/net", node
>
> misses and silently falls back to the port name, which is the case the patch is
> meant to fix. Match on the netdev's of_node instead:
>
>       /* for each /sys/class/net/<if> */
>       snprintf(path, sizeof(path), "/sys/class/net/%s/device/of_node",
>                ifname);
>       if (realpath(path, resolved) != NULL &&
>           strcmp(resolved + strlen("/sys/firmware/devicetree/base"),
>                  node_path) == 0)
>               /* found */
>
> Info
>
> The new dpaa.rst bullet lands at the end of the bus devargs block; it belongs with
> the shared MAC description.
>
>
> Patch 3/3 drivers: add DPAA cgrid cleanup support
> -------------------------------------------------
>
> Warning
>
> This fixes a CGRID leak on close and a stale portal list entry on probe failure, but
> has no Fixes: tag or stable Cc:
>
>       Fixes: 62f53995caaf ("net/dpaa: add frame count based tail drop with
> CGR")
>       Fixes: 9124e65dd3eb ("net/dpaa: enable Tx queue taildrop")
>       Cc: stable@dpdk.org
>
> On the probe error path the initialised Rx FQs (and Tx FQs on free_tx) were
> scheduled with QM_FQCTRL_CGE and their cgid, and are never shut down before
>
>       for (loop = 0; loop < nb_rx_cgr; loop++)
>               qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
>       if (rx_cgrid_allocated)
>               qman_release_cgrid_range(cgrid[0], num_rx_fqs);
>
> That deletes CGRs that still have members, which the commit message says must
> not happen, and hands the CGRIDs to the next probe while live FQs reference
> them. Shut down the FQs initialised so far before deleting the CGRs.
>
> dev_close() releases the CGRID range unconditionally, even when
> dpaa_cgr_stale_fq_cleanup() hit an FQ that would not shut down or
> qman_delete_cgr() failed. 1/3 deliberately leaks FQIDs in that case; do the same
> here and skip qman_release_cgrid_range() if any delete or shutdown failed.
>
> dpaa_eth_dev_stop() and dpaa_eth_dev_close() never shut down the port's own
> Rx/Tx FQs, so the FQs dpaa_cgr_stale_fq_cleanup() finds at close are this port's
> live queues, not ones "not cleaned in previous program". The driver already holds
> their FQIDs. Shut them down directly before deleting the CGRs, drop the FQID
> space scan, and with it the new
> qman_pending_fq_by_cgrid_range() export:
>
>       for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++)
>               qman_shutdown_fq(&dpaa_intf->rx_queues[loop]);
>       for (loop = 0; loop < MAX_DPAA_CORES; loop++)
>               qman_shutdown_fq(&dpaa_intf->tx_queues[loop]);
>
> The existing "Release congestion Groups after releasing FQIDs" comment is then
> true.
>
> Info
>
> cgrid is u32; use %u, not %d, in the DPAA_PMD_DEBUG/WARN calls.
All AI comments are handled in V2.

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

* Re: [PATCH v2 0/4] DPAA driver changes
  2026-10-30  4:43 ` [PATCH v2 0/4] " Gagandeep Singh
                     ` (3 preceding siblings ...)
  2026-10-30  4:43   ` [PATCH v2 4/4] drivers: add DPAA cgrid cleanup support Gagandeep Singh
@ 2026-11-02  8:09   ` Stephen Hemminger
  2026-11-02 13:23   ` Stephen Hemminger
  2026-11-03  9:35   ` [PATCH v3 " Gagandeep Singh
  6 siblings, 0 replies; 33+ messages in thread
From: Stephen Hemminger @ 2026-11-02  8:09 UTC (permalink / raw)
  To: Gagandeep Singh; +Cc: dev, hemant.agrawal

On Fri, 30 Oct 2026 10:13:14 +0530
Gagandeep Singh <g.singh@nxp.com> wrote:

> V2-changes:
>  - Fixed most of the AI comments.
>  - added new patch:
>    fix out-of-bounds read of mac_idx
>  - removed drv_oldev, updated comments and notes.
>  - fixes FQ shutdown
>  - removed unwanted checks, updated open, updated snprintf.
>  - updated commit messages.
> 
> V1:
>  - Adding OH port support.
>  - Updates in shared ethernet code.
>  - Congestion related code cleanup.
> 
> Gagandeep Singh (2):
>   bus/dpaa: fix out-of-bounds read of mac_idx array
>   drivers: add offline (O/H) port device support
> 
> Hemant Agrawal (1):
>   net/dpaa: support non fmX-macY type of shared Ethernet name
> 
> Jun Yang (1):
>   drivers: add DPAA cgrid cleanup support
> 
>  doc/api/doxy-api-index.md                |   1 +
>  doc/guides/nics/dpaa.rst                 |  35 +
>  drivers/bus/dpaa/base/fman/fman.c        |  19 +
>  drivers/bus/dpaa/base/qbman/qman.c       |  61 ++
>  drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
>  drivers/bus/dpaa/dpaa_bus.c              |  66 +-
>  drivers/bus/dpaa/dpaa_bus_base_symbols.c |   2 +
>  drivers/bus/dpaa/include/fman.h          |   6 +-
>  drivers/bus/dpaa/include/fsl_qman.h      |  28 +
>  drivers/net/dpaa/dpaa_ethdev.c           | 241 ++++++-
>  drivers/net/dpaa/dpaa_ethdev.h           |   3 +
>  drivers/net/dpaa/dpaa_flow.c             |   7 +-
>  drivers/net/dpaa/dpaa_oldev.c            | 875 +++++++++++++++++++++++
>  drivers/net/dpaa/meson.build             |  11 +-
>  drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 188 +++++
>  15 files changed, 1517 insertions(+), 30 deletions(-)
>  create mode 100644 drivers/net/dpaa/dpaa_oldev.c
>  create mode 100644 drivers/net/dpaa/rte_pmd_dpaa_oldev.h
> 

Manually run AI review still sees issues that need addessing

Review of [PATCH v2 0/4] DPAA offline port, shared MAC, cgrid cleanup

Applied to next-net for-main (3b51e2e2f0). Each commit builds with
-Dwerror=true.

Series
------

The rte_pmd_dpaa_ol_* API is unchanged from v1 apart from renames and
Doxygen. The four functions still take no port_id and only pass a
caller-filled struct to ioctl() on the out-of-tree /dev/cdx_ctrl
driver. The dpaa.rst text added in v2 confirms the API is configuration
for that kernel module, not for the DPDK port. It belongs in the vendor
userspace library for cdx. Please drop rte_pmd_dpaa_oldev.h and the
exports.

There are still no release notes for the offline port.


Patch 2/4 drivers: add offline (O/H) port device support
--------------------------------------------------------

Warning

The commit message still says the port is "selected through the
'drv_oldev' bus device argument". v2 removed drv_oldev; the port is
created when "-a dpaa_bus:oldev1" is given.

With only oldev1 present, dpaa_netcfg is NULL. v2 handles that in the
two log statements but not in the debug dump:

	#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
		dump_netcfg(dpaa_netcfg, stdout);
	#endif

dump_netcfg() dereferences cfg_ptr->num_ethports unconditionally. Fold
it into the existing check:

	if (dpaa_netcfg) {
	#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
		dump_netcfg(dpaa_netcfg, stdout);
	#endif
		DPAA_BUS_DEBUG("Number of ethernet devices = %d",
			     dpaa_netcfg->num_ethports);
	}

Not addressed from v1: dpaa_oldev_queues_release() returns both FQIDs
to the allocator with qman_release_fqid(), but the kernel received them
through ASK_CTRL_SET_DPDK_INFO and is never told they are gone. There
is no reset ioctl for that. Until cdx provides one, do not release the
two FQIDs on close.

Info

drv_bh_port is now checked against a key list, but it is still parsed
in dev_start(). A missing drv_bh_port is only reported at start. Parse
it once in dpaa_ol_probe() and fail probe if it is absent.

The static_assert and comment added to dpaa_flow.c, and the
MEMMAC_REG_OFFSET removal in fman.h, are not part of the offline port.
Move the dpaa_flow.c change to 1/4, and mention the fman.h removal in
the commit message.


Patch 4/4 drivers: add DPAA cgrid cleanup support
-------------------------------------------------

Info

dev_close() runs dpaa_cgr_stale_fq_cleanup() before shutting down the
port's own FQs. The scan therefore finds this port's live queues, logs
each one as "still alive?", and shuts it down by FQID. The
qman_shutdown_fq() loop that follows then only sees FQs that are
already OOS. Shut down rx_queues[]/tx_queues[] first, then scan, so the
scan only reports FQs left by a previous run.

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

* Re: [PATCH v2 0/4] DPAA driver changes
  2026-10-30  4:43 ` [PATCH v2 0/4] " Gagandeep Singh
                     ` (4 preceding siblings ...)
  2026-11-02  8:09   ` [PATCH v2 0/4] DPAA driver changes Stephen Hemminger
@ 2026-11-02 13:23   ` Stephen Hemminger
  2026-11-03  9:38     ` Gagandeep Singh
  2026-11-03  9:35   ` [PATCH v3 " Gagandeep Singh
  6 siblings, 1 reply; 33+ messages in thread
From: Stephen Hemminger @ 2026-11-02 13:23 UTC (permalink / raw)
  To: Gagandeep Singh; +Cc: dev, hemant.agrawal

On Fri, 30 Oct 2026 10:13:14 +0530
Gagandeep Singh <g.singh@nxp.com> wrote:

> V2-changes:
>  - Fixed most of the AI comments.
>  - added new patch:
>    fix out-of-bounds read of mac_idx
>  - removed drv_oldev, updated comments and notes.
>  - fixes FQ shutdown
>  - removed unwanted checks, updated open, updated snprintf.
>  - updated commit messages.
> 
> V1:
>  - Adding OH port support.
>  - Updates in shared ethernet code.
>  - Congestion related code cleanup.
> 
> Gagandeep Singh (2):
>   bus/dpaa: fix out-of-bounds read of mac_idx array
>   drivers: add offline (O/H) port device support
> 
> Hemant Agrawal (1):
>   net/dpaa: support non fmX-macY type of shared Ethernet name
> 
> Jun Yang (1):
>   drivers: add DPAA cgrid cleanup support
> 
>  doc/api/doxy-api-index.md                |   1 +
>  doc/guides/nics/dpaa.rst                 |  35 +
>  drivers/bus/dpaa/base/fman/fman.c        |  19 +
>  drivers/bus/dpaa/base/qbman/qman.c       |  61 ++
>  drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
>  drivers/bus/dpaa/dpaa_bus.c              |  66 +-
>  drivers/bus/dpaa/dpaa_bus_base_symbols.c |   2 +
>  drivers/bus/dpaa/include/fman.h          |   6 +-
>  drivers/bus/dpaa/include/fsl_qman.h      |  28 +
>  drivers/net/dpaa/dpaa_ethdev.c           | 241 ++++++-
>  drivers/net/dpaa/dpaa_ethdev.h           |   3 +
>  drivers/net/dpaa/dpaa_flow.c             |   7 +-
>  drivers/net/dpaa/dpaa_oldev.c            | 875 +++++++++++++++++++++++
>  drivers/net/dpaa/meson.build             |  11 +-
>  drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 188 +++++
>  15 files changed, 1517 insertions(+), 30 deletions(-)
>  create mode 100644 drivers/net/dpaa/dpaa_oldev.c
>  create mode 100644 drivers/net/dpaa/rte_pmd_dpaa_oldev.h
>

Review of [PATCH v2 0/4] DPAA offline port, shared MAC, cgrid cleanup

Applied to next-net for-main (3b51e2e2f0). Each commit builds with
-Dwerror=true.

Series
------

The rte_pmd_dpaa_ol_* API is unchanged from v1 apart from renames and
Doxygen. The four functions still take no port_id and only pass a
caller-filled struct to ioctl() on the out-of-tree /dev/cdx_ctrl
driver. The dpaa.rst text added in v2 confirms the API is configuration
for that kernel module, not for the DPDK port. It belongs in the vendor
userspace library for cdx. Please drop rte_pmd_dpaa_oldev.h and the
exports.

There are still no release notes for the offline port.


Patch 2/4 drivers: add offline (O/H) port device support
--------------------------------------------------------

Warning

The commit message still says the port is "selected through the
'drv_oldev' bus device argument". v2 removed drv_oldev; the port is
created when "-a dpaa_bus:oldev1" is given.

With only oldev1 present, dpaa_netcfg is NULL. v2 handles that in the
two log statements but not in the debug dump:

	#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
		dump_netcfg(dpaa_netcfg, stdout);
	#endif

dump_netcfg() dereferences cfg_ptr->num_ethports unconditionally. Fold
it into the existing check:

	if (dpaa_netcfg) {
	#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
		dump_netcfg(dpaa_netcfg, stdout);
	#endif
		DPAA_BUS_DEBUG("Number of ethernet devices = %d",
			     dpaa_netcfg->num_ethports);
	}

Not addressed from v1: dpaa_oldev_queues_release() returns both FQIDs
to the allocator with qman_release_fqid(), but the kernel received them
through ASK_CTRL_SET_DPDK_INFO and is never told they are gone. There
is no reset ioctl for that. Until cdx provides one, do not release the
two FQIDs on close.

Info

drv_bh_port is now checked against a key list, but it is still parsed
in dev_start(). A missing drv_bh_port is only reported at start. Parse
it once in dpaa_ol_probe() and fail probe if it is absent.

The static_assert and comment added to dpaa_flow.c, and the
MEMMAC_REG_OFFSET removal in fman.h, are not part of the offline port.
Move the dpaa_flow.c change to 1/4, and mention the fman.h removal in
the commit message.


Patch 4/4 drivers: add DPAA cgrid cleanup support
-------------------------------------------------

Info

dev_close() runs dpaa_cgr_stale_fq_cleanup() before shutting down the
port's own FQs. The scan therefore finds this port's live queues, logs
each one as "still alive?", and shuts it down by FQID. The
qman_shutdown_fq() loop that follows then only sees FQs that are
already OOS. Shut down rx_queues[]/tx_queues[] first, then scan, so the
scan only reports FQs left by a previous run.



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

* [PATCH v3 0/4] DPAA driver changes
  2026-10-30  4:43 ` [PATCH v2 0/4] " Gagandeep Singh
                     ` (5 preceding siblings ...)
  2026-11-02 13:23   ` Stephen Hemminger
@ 2026-11-03  9:35   ` Gagandeep Singh
  2026-11-03  9:35     ` [PATCH v3 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
                       ` (5 more replies)
  6 siblings, 6 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-03  9:35 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal

V3-Changes:
 - Updated rte_pmd_dpaa_oldev.h APIs as per DPDK compliance.
 - Added missing release not for OH port support.
 - Fixed dump_netcfg issue.
 - Added an API to release FQID.
 - moved the fman.h changes to first patch.
 
V2-changes:
 - Fixed most of the AI comments.
 - added new patch:
   fix out-of-bounds read of mac_idx
 - removed drv_oldev, updated comments and notes.
 - fixes FQ shutdown
 - removed unwanted checks, updated open, updated snprintf.
 - updated commit messages.

V1:
 - Adding OH port support.
 - Updates in shared ethernet code.
 - Congestion related code cleanup.

Gagandeep Singh (2):
  bus/dpaa: fix out-of-bounds read of mac_idx array
  drivers: add offline (O/H) port device support

Hemant Agrawal (1):
  net/dpaa: support non fmX-macY type of shared Ethernet name

Jun Yang (1):
  drivers: add DPAA cgrid cleanup support

 doc/api/doxy-api-index.md                |   1 +
 doc/guides/nics/dpaa.rst                 |  36 +
 doc/guides/rel_notes/release_26_11.rst   |  10 +
 drivers/bus/dpaa/base/fman/fman.c        |  19 +
 drivers/bus/dpaa/base/qbman/qman.c       |  61 ++
 drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
 drivers/bus/dpaa/dpaa_bus.c              |  68 +-
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   2 +
 drivers/bus/dpaa/include/fman.h          |   6 +-
 drivers/bus/dpaa/include/fsl_qman.h      |  28 +
 drivers/net/dpaa/dpaa_ethdev.c           | 235 +++++-
 drivers/net/dpaa/dpaa_ethdev.h           |  12 +
 drivers/net/dpaa/dpaa_flow.c             |   5 +-
 drivers/net/dpaa/dpaa_oldev.c            | 938 +++++++++++++++++++++++
 drivers/net/dpaa/meson.build             |  11 +-
 drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 198 +++++
 16 files changed, 1603 insertions(+), 31 deletions(-)
 create mode 100644 drivers/net/dpaa/dpaa_oldev.c
 create mode 100644 drivers/net/dpaa/rte_pmd_dpaa_oldev.h

-- 
2.25.1


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

* [PATCH v3 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array
  2026-11-03  9:35   ` [PATCH v3 " Gagandeep Singh
@ 2026-11-03  9:35     ` Gagandeep Singh
  2026-11-03  9:35     ` [PATCH v3 2/4] drivers: add offline (O/H) port device support Gagandeep Singh
                       ` (4 subsequent siblings)
  5 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-03  9:35 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, stable, Gagandeep Singh

fman_if_init() and fman_if_init_onic() read the devicetree
'cell-index' property and store it unchecked into
__if->__if.mac_idx. This value is later used as an index into the
fixed-size mac_idx[] lookup table in fman_if_vsp_init(), so a
cell-index value greater than or equal to the number of entries in
that table results in an out-of-bounds read.

Add an explicit upper-bound check (FMAN_MAX_MAC_IDX_NUM) in both
fman_if_init() and fman_if_init_onic() before the mac_idx assignment,
and a static_assert in fman_if_vsp_init() to keep mac_idx[] in sync
with FMAN_MAX_MAC_IDX_NUM if it is ever resized.

Also remove the unused MEMMAC_REG_OFFSET() macro from fman.h, which
had no remaining callers.

Fixes: a0edbb8a8e52 ("bus/dpaa: add OH port mode")
Fixes: 7e5f49ae767d ("bus/dpaa: add ONIC port mode")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/bus/dpaa/base/fman/fman.c | 19 +++++++++++++++++++
 drivers/bus/dpaa/include/fman.h   |  6 +++++-
 drivers/net/dpaa/dpaa_flow.c      |  5 ++++-
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index 67f77265ca..223cd6958d 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -205,6 +205,9 @@ static void fman_if_vsp_init(struct __fman_if *__if)
 	size_t lenp;
 	const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1};
 
+	static_assert(RTE_DIM(mac_idx) == FMAN_MAX_MAC_IDX_NUM,
+		      "mac_idx[] out of sync with FMAN_MAX_MAC_IDX_NUM");
+
 	if (__if->__if.mac_idx <= 8) {
 		for_each_compatible_node(dev, NULL,
 			"fsl,fman-port-1g-rx-extended-args") {
@@ -544,6 +547,14 @@ fman_if_init(const struct device_node *dpa_node, int fd)
 		cell_idx_host = of_read_number(cell_idx,
 					       lenp / sizeof(phandle));
 
+		if (cell_idx_host >= FMAN_MAX_MAC_IDX_NUM) {
+			FMAN_ERR(-EINVAL,
+				 "%s: cell-index(%" PRIu64 ") >= max(%d)",
+				 oh_node->full_name, cell_idx_host,
+				 FMAN_MAX_MAC_IDX_NUM);
+			goto err;
+		}
+
 		__if->__if.mac_idx = cell_idx_host;
 	}
 
@@ -957,6 +968,14 @@ static int fman_if_init_onic(const struct device_node *dpa_node)
 	assert(lenp == sizeof(*cell_idx));
 
 	cell_idx_host = of_read_number(cell_idx, lenp / sizeof(phandle));
+
+	if (cell_idx_host >= FMAN_MAX_MAC_IDX_NUM) {
+		FMAN_ERR(-EINVAL, "%s: cell-index(%" PRIu64 ") >= max(%d)",
+			 tx_oh_node->full_name, cell_idx_host,
+			 FMAN_MAX_MAC_IDX_NUM);
+		goto err;
+	}
+
 	__if->__if.mac_idx = cell_idx_host;
 
 	fman_node = of_get_parent(fman_tx_oh_node);
diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h
index f642faf3b3..030c85c284 100644
--- a/drivers/bus/dpaa/include/fman.h
+++ b/drivers/bus/dpaa/include/fman.h
@@ -68,6 +68,11 @@
 #define FMAN_RTC_MAX_NUM_OF_PERIODIC_PULSES	4
 #define FMAN_RTC_MAX_NUM_OF_EXT_TRIGGERS	3
 
+/*
+ * Maximum number of MAC/offline port indexes.
+ */
+#define FMAN_MAX_MAC_IDX_NUM	11
+
 /* Represents the different flavour of network interface */
 enum fman_mac_type {
 	fman_offline_internal = 0,
@@ -475,7 +480,6 @@ struct __fman_if {
 	void *qmi_map;
 };
 
-#define MEMMAC_REG_OFFSET(reg) offsetof(struct memac_regs, reg)
 #define BMI_RX_REG_OFFSET(reg) offsetof(struct rx_bmi_regs, reg)
 #define BMI_TX_REG_OFFSET(reg) offsetof(struct tx_bmi_regs, reg)
 
diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c
index f77f9f333b..403e97ed2d 100644
--- a/drivers/net/dpaa/dpaa_flow.c
+++ b/drivers/net/dpaa/dpaa_flow.c
@@ -32,9 +32,12 @@ return &scheme_params->param.key_ext_and_hash.extract_array[hdr_idx];
 	SCH_EXT_HDR(scheme_params, hdr_idx).extract_by_hdr_type.full_field
 
 /* FMAN mac indexes mappings (0 is unused, first 8 are for 1G, next for 10G
- * ports).
+ * ports). Indexed by fman_if.mac_idx, which the bus validates against
+ * FMAN_MAX_MAC_IDX_NUM when deriving it from the device tree.
  */
 static const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1};
+static_assert(RTE_DIM(mac_idx) == FMAN_MAX_MAC_IDX_NUM,
+	"mac_idx[] out of sync with FMAN_MAX_MAC_IDX_NUM");
 
 /* FM global info */
 struct dpaa_fm_info {
-- 
2.25.1


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

* [PATCH v3 2/4] drivers: add offline (O/H) port device support
  2026-11-03  9:35   ` [PATCH v3 " Gagandeep Singh
  2026-11-03  9:35     ` [PATCH v3 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
@ 2026-11-03  9:35     ` Gagandeep Singh
  2026-11-03  9:36     ` [PATCH v3 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
                       ` (3 subsequent siblings)
  5 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-03  9:35 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, Gagandeep Singh

Add support for the DPAA Offline/Host-command (O/H) port, allowing a
single OL port to be used by a DPDK application. The port is created
by passing "-a dpaa_bus:oldev1" (plus any devargs) on the EAL command
line, and the associated back-half port is named through the
'drv_bh_port' device argument.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/api/doxy-api-index.md                |   1 +
 doc/guides/nics/dpaa.rst                 |  32 +
 doc/guides/rel_notes/release_26_11.rst   |  10 +
 drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
 drivers/bus/dpaa/dpaa_bus.c              |  68 +-
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   1 +
 drivers/bus/dpaa/include/fsl_qman.h      |   1 +
 drivers/net/dpaa/dpaa_ethdev.h           |  12 +
 drivers/net/dpaa/dpaa_oldev.c            | 938 +++++++++++++++++++++++
 drivers/net/dpaa/meson.build             |  11 +-
 drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 198 +++++
 11 files changed, 1260 insertions(+), 16 deletions(-)
 create mode 100644 drivers/net/dpaa/dpaa_oldev.c
 create mode 100644 drivers/net/dpaa/rte_pmd_dpaa_oldev.h

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 62390f7be3..0bd8e1bbf0 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -53,6 +53,7 @@ The public API headers are grouped by topics:
   [cnxk_eventdev](@ref rte_pmd_cnxk_eventdev.h),
   [cnxk_mempool](@ref rte_pmd_cnxk_mempool.h),
   [dpaa](@ref rte_pmd_dpaa.h),
+  [dpaa_oldev](@ref rte_pmd_dpaa_oldev.h),
   [dpaa2](@ref rte_pmd_dpaa2.h),
   [mlx5](@ref rte_pmd_mlx5.h),
   [dpaa2_mempool](@ref rte_dpaa2_mempool.h),
diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst
index c6aab46828..7658e6d454 100644
--- a/doc/guides/nics/dpaa.rst
+++ b/doc/guides/nics/dpaa.rst
@@ -276,6 +276,38 @@ Refer to the document :doc:`build_and_test` for details.
   and thus disabling hardware based packet handling at driver level,
   e.g. ``dpaa:fm1-mac3,recv_err_pkts=1``.
 
+``drv_bh_port``
+   Name of the back-half port associated with an offline (O/H) port device.
+   It is passed on the offline port device itself, which is named
+   ``oldev1``, e.g. ``-a dpaa_bus:oldev1,drv_bh_port=fm1-mac5``.
+
+The DPAA offline (O/H) port device is only created, and therefore only
+probed, when it is explicitly named on the EAL ``-a`` command line, e.g.::
+
+   -a dpaa_bus:oldev1,drv_bh_port=fm1-mac5
+
+Passing any ``-a`` argument for the DPAA bus switches the bus to allowlist
+scan mode, so from that point on only the devices named with ``-a`` are
+probed. Using the offline port therefore requires listing the offline port
+itself and every Ethernet port the application needs, for example::
+
+   -a dpaa_bus:oldev1,drv_bh_port=fm1-mac5 \
+   -a dpaa_bus:fm1-mac5 -a dpaa_bus:fm1-mac6
+
+Omitting an ``fmX-macY`` port in that case silently drops that port.
+
+The offline port requires the ``/dev/cdx_ctrl`` kernel control device to be
+present; it is provided by the NXP vendor ``cdx`` kernel driver, which is
+not part of this DPDK driver and must be obtained and loaded separately
+(see the NXP LSDK release matching the DPAA SoC family). The uplink
+classification and local-gateway (LGW) configuration exposed through that
+control device can be programmed by the application, for the offline
+port identified by its ``port_id``, via the experimental
+``rte_pmd_dpaa_ol_set_classif_info()``, ``rte_pmd_dpaa_ol_reset_classif_info()``,
+``rte_pmd_dpaa_ol_set_lgw_info()`` and ``rte_pmd_dpaa_ol_reset_lgw_info()``
+APIs declared in ``rte_pmd_dpaa_oldev.h``.
+
+
 FMAN Config
 -----------
 
diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
index 078f71a815..5a71c3c048 100644
--- a/doc/guides/rel_notes/release_26_11.rst
+++ b/doc/guides/rel_notes/release_26_11.rst
@@ -207,6 +207,16 @@ New Features
   * Added Tx pause support for the ENETC4 VF via Rx congestion mode.
   * Added WRR Tx scheduler devarg (``enetc4_txq_wrr``) for ENETC4 VF ring weights.
 
+* **Added NXP DPAA offline (O/H) port support.**
+
+  Added a DPAA offline (O/H) port type that loops Rx/Tx frame queues through
+  the FMAN and exposes them as a DPDK port, with uplink classification and
+  LGW subnet configuration forwarded to the ASK/CDX kernel module via the
+  experimental ``rte_pmd_dpaa_ol_set_classif_info()``,
+  ``rte_pmd_dpaa_ol_reset_classif_info()``, ``rte_pmd_dpaa_ol_set_lgw_info()``
+  and ``rte_pmd_dpaa_ol_reset_lgw_info()`` APIs declared in
+  ``rte_pmd_dpaa_oldev.h``.
+
 * **Updated NXP DPAA drivers.**
 
   * Changed the default number of Rx queues in FMCLESS mode to the maximum
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index 4aed83f84d..323a6a7659 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -69,11 +69,13 @@ struct rte_dpaa_driver;
 enum rte_dpaa_type {
 	FSL_DPAA_ETH = 1,
 	FSL_DPAA_CRYPTO,
-	FSL_DPAA_QDMA
+	FSL_DPAA_QDMA,
+	FSL_DPAA_OL
 };
 
 struct dpaa_device_id {
 	uint8_t fman_id; /**< Fman interface ID, for ETH type device */
+	uint8_t ol_id;	/**< OH interface ID, for OH type device */
 	uint8_t mac_id; /**< Fman MAC interface ID, for ETH type device */
 	uint16_t dev_id; /**< Device Identifier from DPDK */
 };
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 6599958925..069f913a48 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -34,6 +34,8 @@
 #include <bus_driver.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
+#include <rte_kvargs.h>
+#include <rte_devargs.h>
 
 #include <dpaa_of.h>
 #include <bus_dpaa_driver.h>
@@ -68,6 +70,12 @@ struct rte_dpaa_bus_private {
 	RTE_ATOMIC(uint16_t) push_rxq_num;
 };
 
+/* Name of the single offline (O/H) port device. The device is only
+ * created, and thus only probed, if the application explicitly lists it
+ * with "-a dpaa_bus:oldev1" (or an equivalent devargs form).
+ */
+#define DPAA_OLDEV_NAME	"oldev1"
+
 static struct rte_bus rte_dpaa_bus;
 static struct rte_dpaa_bus_private dpaa_bus;
 static struct netcfg_info *dpaa_netcfg;
@@ -207,8 +215,44 @@ dpaa_create_device_list(void)
 	struct fm_eth_port_cfg *cfg;
 	struct fman_if *fman_intf;
 
+	struct rte_devargs *oldev_devargs;
+
 	dpaa_bus.device_count = 0;
 
+	/* The offline port is only created if the application explicitly
+	 * asked for it with "-a dpaa_bus:oldev1" (plus any devargs), e.g.
+	 * when the device is created without a backing devargs entry it
+	 * would never be probed, so avoid creating it at all.
+	 */
+	oldev_devargs = rte_bus_find_devargs(&rte_dpaa_bus, DPAA_OLDEV_NAME);
+
+	if (!dpaa_netcfg && !oldev_devargs)
+		return 0;
+
+	/* Creating OL Device */
+	if (oldev_devargs) {
+		dev = calloc(1, sizeof(struct rte_dpaa_device));
+		if (!dev) {
+			DPAA_BUS_ERR("Failed to allocate OL devices");
+			return -ENOMEM;
+		}
+
+		dev->device_type = FSL_DPAA_OL;
+		dev->id.ol_id = 0;
+		dev->id.dev_id = dpaa_bus.device_count;
+
+		/* Create device name */
+		snprintf(dev->name, RTE_ETH_NAME_MAX_LEN, "oldev%d",
+			 (dev->id.ol_id + 1));
+		DPAA_BUS_INFO("%s oldev added", dev->name);
+		dev->device.name = dev->name;
+		dev->device.devargs = oldev_devargs;
+		DPAA_BUS_INFO("**Devargs matched %s", dev->name);
+
+		dpaa_add_to_device_list(dev);
+		dpaa_bus.device_count++;
+	}
+
 	/* Creating Ethernet Devices */
 	for (i = 0; dpaa_netcfg && (i < dpaa_netcfg->num_ethports); i++) {
 		dev = calloc(1, sizeof(struct rte_dpaa_device));
@@ -298,8 +342,7 @@ dpaa_create_device_list(void)
 		 * crypto PMD, using RTE_ETH_NAME_MAX_LEN as that is the size
 		 * allocated for dev->name/
 		 */
-		memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN);
-		sprintf(dev->name, "dpaa_sec-%d", i+1);
+		snprintf(dev->name, RTE_ETH_NAME_MAX_LEN, "dpaa_sec-%d", i + 1);
 		DPAA_BUS_INFO("%s cryptodev added", dev->name);
 		dev->device.name = dev->name;
 		dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus, dev->name);
@@ -324,8 +367,7 @@ dpaa_create_device_list(void)
 		dev->device_type = FSL_DPAA_QDMA;
 		dev->id.dev_id = dpaa_bus.device_count + i;
 
-		memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN);
-		sprintf(dev->name, "dpaa_qdma-%d", i+1);
+		snprintf(dev->name, RTE_ETH_NAME_MAX_LEN, "dpaa_qdma-%d", i + 1);
 		DPAA_BUS_INFO("%s qdma device added", dev->name);
 		dev->device.name = dev->name;
 		dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus, dev->name);
@@ -513,7 +555,7 @@ rte_dpaa_bus_parse(const char *name, void *out)
 	}
 
 	/* dev_delta points to the dev name (mac/oh/onic). Not valid for
-	 * dpaa_sec.
+	 * dpaa_sec and oldev.
 	 */
 	dev_delta = delta + sizeof("fm.-") - 1;
 
@@ -527,6 +569,10 @@ rte_dpaa_bus_parse(const char *name, void *out)
 				i < 1 || i > RTE_DPAA_QDMA_DEVICES)
 			return -EINVAL;
 		max_name_len = sizeof("dpaa_qdma-.") - 1;
+	} else if (strncmp("oldev", &name[delta], 5) == 0) {
+		if (sscanf(&name[delta], "oldev%u", &i) != 1 || i != 1)
+			return -EINVAL;
+		max_name_len = sizeof("oldev.") - 1;
 	} else if (strncmp("oh", &name[dev_delta], 2) == 0) {
 		if (sscanf(&name[delta], "fm%u-oh%u", &i, &j) != 2 ||
 				i >= 2 || j >= 16)
@@ -624,7 +670,8 @@ rte_dpaa_bus_dev_build(void)
 
 	/* Get the interface configurations from device-tree */
 	dpaa_netcfg = netcfg_acquire();
-	if (!dpaa_netcfg) {
+	if (!dpaa_netcfg &&
+	    !rte_bus_find_devargs(&rte_dpaa_bus, DPAA_OLDEV_NAME)) {
 		DPAA_BUS_ERR("netcfg failed: /dev/fsl_usdpaa device not available");
 		DPAA_BUS_WARN("Check if you are using USDPAA based device tree");
 		return -EINVAL;
@@ -632,17 +679,18 @@ rte_dpaa_bus_dev_build(void)
 
 	DPAA_BUS_NOTICE("DPAA Bus Detected");
 
-	if (!dpaa_netcfg->num_ethports) {
+	if (dpaa_netcfg && !dpaa_netcfg->num_ethports) {
 		DPAA_BUS_INFO("NO DPDK mapped net interfaces available");
 		/* This is not an error */
 	}
 
+	if (dpaa_netcfg) {
 #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
-	dump_netcfg(dpaa_netcfg, stdout);
+		dump_netcfg(dpaa_netcfg, stdout);
 #endif
-
-	DPAA_BUS_DEBUG("Number of ethernet devices = %d",
+		DPAA_BUS_DEBUG("Number of ethernet devices = %d",
 			     dpaa_netcfg->num_ethports);
+	}
 	ret = dpaa_create_device_list();
 	if (ret) {
 		DPAA_BUS_ERR("Unable to create device list. (%d)", ret);
diff --git a/drivers/bus/dpaa/dpaa_bus_base_symbols.c b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
index 0927e5fe2c..aaa9f9bec2 100644
--- a/drivers/bus/dpaa/dpaa_bus_base_symbols.c
+++ b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
@@ -52,6 +52,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(bman_acquire)
 RTE_EXPORT_INTERNAL_SYMBOL(bman_query_free_buffers)
 RTE_EXPORT_INTERNAL_SYMBOL(bman_thread_irq)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_fqid_range)
+RTE_EXPORT_INTERNAL_SYMBOL(qman_release_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_reserve_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_pool_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_cgrid_range)
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index 59b41e17f0..b2674ce5d0 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1895,6 +1895,7 @@ static inline int qman_alloc_fqid(u32 *result)
  * This function can also be used to seed the allocator with ranges of FQIDs
  * that it can subsequently allocate from.
  */
+__rte_internal
 void qman_release_fqid_range(u32 fqid, unsigned int count);
 static inline void qman_release_fqid(u32 fqid)
 {
diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h
index 47c8e2b086..c3afc9d2ed 100644
--- a/drivers/net/dpaa/dpaa_ethdev.h
+++ b/drivers/net/dpaa/dpaa_ethdev.h
@@ -114,6 +114,10 @@ enum {
 
 #define DPAA_DEFAULT_RXQ_VSP_ID		1
 
+/* Device argument to name the offline (O/H) port back-half port */
+#define DRIVER_OL_BH_PORT		"drv_bh_port"
+#define DPAA_OL_MAX_BH_PORT_NAME_LEN	12
+
 #define FMC_FILE "/tmp/fmc.bin"
 
 struct dpaa_if_vsp {
@@ -173,10 +177,18 @@ struct dpaa_if {
 	struct qman_fq *next_tx_conf_queue;
 
 	struct dpaa_if_vsp vsp[DPAA_VSP_PROFILE_MAX_NUM];
+
+	/* Control device fd, used by the offline port PMD only. */
+	int ol_fd;
+	/* Backhaul port name from the drv_bh_port devarg, used by the
+	 * offline port PMD only.
+	 */
+	char ol_bh_port_name[DPAA_OL_MAX_BH_PORT_NAME_LEN];
 };
 
 struct dpaa_if_stats {
 	/* Rx Statistics Counter */
+
 	uint64_t reoct;		/**<Rx Eth Octets Counter */
 	uint64_t roct;		/**<Rx Octet Counters */
 	uint64_t raln;		/**<Rx Alignment Error Counter */
diff --git a/drivers/net/dpaa/dpaa_oldev.c b/drivers/net/dpaa/dpaa_oldev.c
new file mode 100644
index 0000000000..db9c4cc643
--- /dev/null
+++ b/drivers/net/dpaa/dpaa_oldev.c
@@ -0,0 +1,938 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2026 NXP
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+
+#include <rte_dpaa_logs.h>
+#include <rte_kvargs.h>
+
+#include <rte_string_fns.h>
+#include <bus_dpaa_driver.h>
+#include <dpaa_ethdev.h>
+#include <dpaa_rxtx.h>
+#include <dpaa_mempool.h>
+
+#include <eal_export.h>
+#include <fsl_fman.h>
+
+#include "rte_pmd_dpaa_oldev.h"
+
+/* The ol device is a tx are queue pair, which is provided to the kernel through
+ * ioctl calls. It is exposed as a virtual port to the application.
+ * This ASK Device provides IOCTL calls to driver for communicating fqid's,
+ * buffer pool id's and channel id's with kernel.
+ */
+#define ASK_PATH		"/dev/cdx_ctrl"
+#define CDX_IOC_MAGIC		0xbe
+
+/* Private area reserved by driver.
+ * Aligned with "struct annotations_t". Parse results will be written from
+ * the 17th byte by the HW.
+ */
+#define DPAA_OL_PARSERSLT_START_OFFSET 16
+#define DPAA_OL_DATA_ALIGNMENT 64
+/* Change this value to increase the data offset.
+ * final value will be aligned by DPAA_OL_DATA_ALIGNMENT
+ */
+#define DPAA_OL_MAX_EXTRA_SIZE 0
+#define DPAA_OL_PARSE_RESULT_REQUIRED true
+#define DPAA_OL_TIME_STAMP_REQUIRED false
+#define DPAA_OL_HASH_RESULT_REQUIRED false
+#define DPAA_OL_PCD_INFO_REQUIRED false
+
+/* Work queue ID used for the offline port ingress sequence classifier. */
+#define DPA_ISC_WQ_ID 2
+
+static const struct eth_dev_ops dpaa_ol_devops;
+
+static pthread_mutex_t fd_init_lock = PTHREAD_MUTEX_INITIALIZER;
+
+struct ask_ctrl_offline_channel {
+	uint32_t channel_id;
+	uint32_t ctx_a_hi_val;	/* Setting required flags(B0,A2) while creating
+				 * frame queue.
+				 */
+	uint32_t ctx_a_lo_val;	/* EBD and VSP enable bits */
+	uint32_t ctx_b_val;	/* VSP ID */
+};
+
+struct ask_ctrl_dpdk_fq_info_s {
+	uint32_t tx_fq_id;		/* DPDK transmits GTP packets using FQ
+					 * ID
+					 */
+	uint32_t rx_fq_id;		/* DPDK receives packets from FMAN */
+	uint16_t buff_size;		/* Size of each buffer in DPDPK buffer
+					 * pool
+					 */
+	uint8_t bp_id;			/* DPDK buffer pool id */
+	/* BH port interface name; set from the mandatory drv_bh_port
+	 * devarg (see DRIVER_OL_BH_PORT).
+	 */
+	uint8_t bh_port_name[DPAA_OL_MAX_BH_PORT_NAME_LEN];
+	/* below fields are taken from structure t_FmBufferPrefixContent, These
+	 * fields are required for VSP creation on DPDK buffer pool ID. These
+	 * fields should be set based on expected parameters from FMAN
+	 */
+	uint16_t privDataSize;		/* Number of bytes to be left at the
+					 * beginning of the external buffer;
+					 * Note that the private-area will start
+					 * from the base of the buffer address.
+					 */
+	bool passPrsResult;		/* TRUE to pass the parse result to/from
+					 * the FM; User may use
+					 * FM_PORT_GetBufferPrsResult() in order
+					 * to get the parser-result from a
+					 * buffer.
+					 */
+	bool passTimeStamp;		/* < TRUE to pass the timeStamp to/from
+					 * the FM User may use
+					 * FM_PORT_GetBufferTimeStamp() in order
+					 * to get the parser-result from a
+					 * buffer.
+					 */
+	bool passHashResult;		/* TRUE to pass the KG hash result
+					 * to/from the FM User may use
+					 * FM_PORT_GetBufferHashResult() in
+					 * order to get the parser-result from a
+					 * buffer.
+					 */
+	bool passAllOtherPCDInfo;	/* Add all other Internal-Context
+					 * information: AD, hash-result, key,
+					 * etc.
+					 */
+	uint16_t dataAlign;		/* 0 to use driver's default alignment
+					 * [DEFAULT_FM_SP_bufferPrefixContent_dataAlign],
+					 * other value for selecting a data
+					 * alignment (must be a power of 2); if
+					 * write optimization is used, must be
+					 * >= 16.
+					 */
+	uint8_t manipExtraSpace;	/* Maximum extra size needed (insertion-
+					 * size minus removal-size); Note that
+					 * this field impacts the size of the
+					 * buffer-prefix (i.e. it pushes the
+					 * data offset); This field is
+					 * irrelevant if DPAA_VERSION==10
+					 */
+};
+
+#define ASK_CTRL_GET_OFFLINE_CHANNEL_INFO \
+	_IOWR(CDX_IOC_MAGIC, 8, struct ask_ctrl_offline_channel)
+#define ASK_CTRL_SET_DPDK_INFO \
+	_IOWR(CDX_IOC_MAGIC, 9, struct ask_ctrl_dpdk_fq_info_s)
+#define ASK_CTRL_SET_CLASSIF_INFO \
+	_IOWR(CDX_IOC_MAGIC, 10, struct rte_pmd_dpaa_uplink_cls_info_s)
+#define ASK_CTRL_RESET_CLASSIF_INFO \
+	_IOWR(CDX_IOC_MAGIC, 11, struct rte_pmd_dpaa_uplink_cls_info_s)
+#define ASK_CTRL_SET_LGW_INFO \
+	_IOWR(CDX_IOC_MAGIC, 12, struct rte_pmd_dpaa_lgw_info_s)
+#define ASK_CTRL_RESET_LGW_INFO \
+	_IOWR(CDX_IOC_MAGIC, 13, struct rte_pmd_dpaa_lgw_info_s)
+/* Tells the kernel the Tx/Rx FQIDs set via ASK_CTRL_SET_DPDK_INFO are
+ * being torn down.
+ */
+#define ASK_CTRL_RESET_DPDK_INFO \
+	_IOWR(CDX_IOC_MAGIC, 14, struct ask_ctrl_dpdk_fq_info_s)
+
+/* Validate port_id and return the rte_eth_dev if it belongs to this driver. */
+static struct rte_eth_dev *
+dpaa_ol_get_port(uint16_t port_id)
+{
+	struct rte_eth_dev *dev;
+
+	if (!rte_eth_dev_is_valid_port(port_id)) {
+		DPAA_PMD_ERR("Port %u is not a valid port", port_id);
+		return NULL;
+	}
+
+	dev = &rte_eth_devices[port_id];
+	if (dev->dev_ops != &dpaa_ol_devops) {
+		DPAA_PMD_ERR("Port %u is not a DPAA offline (O/H) port", port_id);
+		return NULL;
+	}
+
+	return dev;
+}
+
+/* Open the control device on first use. */
+static int check_fd(struct dpaa_if *dpaa_intf)
+{
+	int ret;
+
+	if (dpaa_intf->ol_fd >= 0)
+		return dpaa_intf->ol_fd;
+
+	ret = pthread_mutex_lock(&fd_init_lock);
+	assert(!ret);
+	/* check again with the lock held */
+	if (dpaa_intf->ol_fd < 0)
+		dpaa_intf->ol_fd = open(ASK_PATH, O_RDWR | O_CLOEXEC);
+
+	ret = pthread_mutex_unlock(&fd_init_lock);
+	assert(!ret);
+
+	return (dpaa_intf->ol_fd >= 0) ? dpaa_intf->ol_fd : -ENODEV;
+}
+
+static int ask_get_channel_info(struct dpaa_if *dpaa_intf,
+				 struct ask_ctrl_offline_channel *ch_info)
+{
+	int ret, fd = check_fd(dpaa_intf);
+
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_GET_OFFLINE_CHANNEL_INFO, ch_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Get channel info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Get channel info successful");
+	DPAA_PMD_DEBUG("Channel id: %x", ch_info->channel_id);
+	DPAA_PMD_DEBUG("ctx_a_hi_val: %x", ch_info->ctx_a_hi_val);
+	DPAA_PMD_DEBUG("ctx_a_lo_val: %x", ch_info->ctx_a_lo_val);
+	DPAA_PMD_DEBUG("ctx_b_val: %x", ch_info->ctx_b_val);
+
+	return 0;
+}
+
+static int ask_set_fq_info(struct dpaa_if *dpaa_intf,
+			    struct ask_ctrl_dpdk_fq_info_s *fq_info)
+{
+	int ret, fd = check_fd(dpaa_intf);
+
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_DPDK_INFO, fq_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set FQ info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set fq info successful");
+	DPAA_PMD_DEBUG("Tx fqid: %x", fq_info->tx_fq_id);
+	DPAA_PMD_DEBUG("Rx fqid: %x", fq_info->rx_fq_id);
+	DPAA_PMD_DEBUG("buff_size: %d", fq_info->buff_size);
+	DPAA_PMD_DEBUG("bp_id: %d", fq_info->bp_id);
+	DPAA_PMD_DEBUG("Backhaul port name: %s", fq_info->bh_port_name);
+
+	return 0;
+}
+
+static int ask_reset_fq_info(struct dpaa_if *dpaa_intf,
+			      struct ask_ctrl_dpdk_fq_info_s *fq_info)
+{
+	int ret, fd = check_fd(dpaa_intf);
+
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_RESET_DPDK_INFO, fq_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Reset FQ info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Reset fq info successful");
+
+	return 0;
+}
+
+static int
+dpaa_ol_dev_configure(__rte_unused struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+static int dpaa_ol_dev_info(struct rte_eth_dev *dev,
+			    struct rte_eth_dev_info *dev_info)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->max_rx_queues = dpaa_intf->nb_rx_queues;
+	dev_info->max_tx_queues = dpaa_intf->nb_tx_queues;
+	dev_info->max_rx_pktlen = DPAA_MAX_RX_PKT_LEN;
+	dev_info->max_mac_addrs = DPAA_MAX_MAC_FILTER;
+	dev_info->max_hash_mac_addrs = 0;
+	dev_info->max_vfs = 0;
+
+	dev_info->speed_capa = RTE_ETH_LINK_SPEED_10M_HD |
+			       RTE_ETH_LINK_SPEED_10M |
+			       RTE_ETH_LINK_SPEED_100M_HD |
+			       RTE_ETH_LINK_SPEED_100M |
+			       RTE_ETH_LINK_SPEED_1G |
+			       RTE_ETH_LINK_SPEED_2_5G |
+			       RTE_ETH_LINK_SPEED_10G;
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_set_classif_info, 26.11)
+int rte_pmd_dpaa_ol_set_classif_info(uint16_t port_id,
+		struct rte_pmd_dpaa_uplink_cls_info_s *classif_info)
+{
+	struct rte_eth_dev *dev;
+	struct dpaa_if *dpaa_intf;
+	int i, ret, fd;
+
+	if (classif_info == NULL) {
+		DPAA_PMD_ERR("No classification data available");
+		return -EINVAL;
+	}
+
+	dev = dpaa_ol_get_port(port_id);
+	if (dev == NULL)
+		return -ENODEV;
+	dpaa_intf = dev->data->dev_private;
+
+	fd = check_fd(dpaa_intf);
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_CLASSIF_INFO, classif_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set classification info ioctl failed with errno: %s",
+			     strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set classification info successful");
+	for (i = 0; i < classif_info->num_ports; i++) {
+		DPAA_PMD_DEBUG("UDP dest port: %d",
+			       classif_info->gtp_udp_port[i]);
+	}
+	DPAA_PMD_DEBUG("Protocol ID: %d", classif_info->gtp_proto_id);
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_reset_classif_info, 26.11)
+int rte_pmd_dpaa_ol_reset_classif_info(uint16_t port_id)
+{
+	struct rte_pmd_dpaa_uplink_cls_info_s classif_info;
+	struct rte_eth_dev *dev;
+	struct dpaa_if *dpaa_intf;
+	int ret, fd;
+
+	dev = dpaa_ol_get_port(port_id);
+	if (dev == NULL)
+		return -ENODEV;
+	dpaa_intf = dev->data->dev_private;
+
+	fd = check_fd(dpaa_intf);
+	if (fd < 0)
+		return fd;
+
+	memset(&classif_info, 0, sizeof(classif_info));
+
+	ret = ioctl(fd, ASK_CTRL_RESET_CLASSIF_INFO, &classif_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Reset classification info ioctl failed with errno: %s",
+			     strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Reset classification info successful");
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_set_lgw_info, 26.11)
+int rte_pmd_dpaa_ol_set_lgw_info(uint16_t port_id,
+		struct rte_pmd_dpaa_lgw_info_s *lgw_info)
+{
+	struct rte_eth_dev *dev;
+	struct dpaa_if *dpaa_intf;
+	int ret, fd;
+
+	if (lgw_info == NULL) {
+		DPAA_PMD_ERR("No LGW data available");
+		return -EINVAL;
+	}
+
+	dev = dpaa_ol_get_port(port_id);
+	if (dev == NULL)
+		return -ENODEV;
+	dpaa_intf = dev->data->dev_private;
+
+	fd = check_fd(dpaa_intf);
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_LGW_INFO, lgw_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set LGW info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set LGW info successful");
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_reset_lgw_info, 26.11)
+int rte_pmd_dpaa_ol_reset_lgw_info(uint16_t port_id)
+{
+	struct rte_pmd_dpaa_lgw_info_s lgw_info;
+	struct rte_eth_dev *dev;
+	struct dpaa_if *dpaa_intf;
+	int ret, fd;
+
+	PMD_INIT_FUNC_TRACE();
+
+	dev = dpaa_ol_get_port(port_id);
+	if (dev == NULL)
+		return -ENODEV;
+	dpaa_intf = dev->data->dev_private;
+
+	fd = check_fd(dpaa_intf);
+	if (fd < 0)
+		return fd;
+
+	memset(&lgw_info, 0, sizeof(lgw_info));
+
+	ret = ioctl(fd, ASK_CTRL_RESET_LGW_INFO, &lgw_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Reset LGW info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Reset LGW info successful");
+
+	return 0;
+}
+
+static int
+dpaa_ol_get_bh_port_name(struct rte_devargs *devargs, char *val, size_t size);
+
+static int dpaa_ol_set_fq_info(struct rte_eth_dev *dev);
+
+static int dpaa_ol_dev_start(struct rte_eth_dev *dev)
+{
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Done in dev_start() since Rx/Tx queue setup order is not guaranteed. */
+	ret = dpaa_ol_set_fq_info(dev);
+	if (ret)
+		return ret;
+
+	dev->tx_pkt_burst = dpaa_eth_queue_tx;
+
+	return 0;
+}
+
+static int dpaa_ol_dev_stop(struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
+
+	return 0;
+}
+
+static void dpaa_oldev_queues_release(struct dpaa_if *dpaa_intf);
+
+static int dpaa_ol_dev_close(struct rte_eth_dev *dev)
+{
+	struct dpaa_if *dpaa_intf;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	dpaa_intf = dev->data->dev_private;
+	if (!dpaa_intf)
+		return 0;
+
+	/* Shut down FQs and free queue memory. */
+	dpaa_oldev_queues_release(dpaa_intf);
+
+	if (dpaa_intf->ol_fd >= 0) {
+		close(dpaa_intf->ol_fd);
+		dpaa_intf->ol_fd = -1;
+	}
+
+	return 0;
+}
+
+static inline void
+dpaa_poll_queue_default_config(struct qm_mcc_initfq *opts)
+{
+	memset(opts, 0, sizeof(struct qm_mcc_initfq));
+	opts->we_mask = QM_INITFQ_WE_CONTEXTA;
+	opts->fqd.fq_ctrl = QM_FQCTRL_AVOIDBLOCK | QM_FQCTRL_CTXASTASHING |
+			    QM_FQCTRL_PREFERINCACHE;
+	opts->fqd.context_a.stashing.exclusive = 0;
+	if (dpaa_soc_ver() != SVR_LS1046A_FAMILY)
+		opts->fqd.context_a.stashing.annotation_cl =
+				DPAA_IF_RX_ANNOTATION_STASH;
+	opts->fqd.context_a.stashing.data_cl = DPAA_IF_RX_DATA_STASH;
+	opts->fqd.context_a.stashing.context_cl = DPAA_IF_RX_CONTEXT_STASH;
+}
+
+static
+int dpaa_ol_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
+			    __rte_unused uint16_t nb_desc,
+			    unsigned int socket_id __rte_unused,
+			    __rte_unused const struct rte_eth_rxconf *rx_conf,
+			    struct rte_mempool *mp)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct qman_fq *rxq = &dpaa_intf->rx_queues[queue_idx];
+
+	PMD_INIT_FUNC_TRACE();
+
+	dpaa_intf->bp_info = DPAA_MEMPOOL_TO_POOL_INFO(mp);
+	dpaa_intf->valid = 1;
+
+	if (!rte_dpaa_bpid_info) {
+		DPAA_PMD_ERR("BPID info array not initialized");
+		return -ENOMEM;
+	}
+	rxq->bp_array = rte_dpaa_bpid_info;
+	dev->data->rx_queues[queue_idx] = rxq;
+
+	return 0;
+}
+
+static int
+dpaa_ol_get_bh_port_name(struct rte_devargs *devargs, char *val, size_t size)
+{
+	static const char * const valid_keys[] = { DRIVER_OL_BH_PORT, NULL };
+	struct rte_kvargs *kvlist;
+	const char *str;
+	int ret;
+
+	if (!devargs || !devargs->args)
+		return 0;
+
+	kvlist = rte_kvargs_parse(devargs->args, valid_keys);
+	if (!kvlist) {
+		DPAA_PMD_ERR("Invalid devargs for offline port \"%s\"",
+			     devargs->args);
+		return -EINVAL;
+	}
+
+	if (!rte_kvargs_count(kvlist, DRIVER_OL_BH_PORT)) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	str = rte_kvargs_get(kvlist, DRIVER_OL_BH_PORT);
+	if (str == NULL) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	ret = rte_strscpy(val, str, size);
+	rte_kvargs_free(kvlist);
+	if (ret < 0)
+		return ret;
+
+	return 1;
+}
+
+static
+int dpaa_ol_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
+			   uint16_t nb_desc __rte_unused,
+			   unsigned int socket_id __rte_unused,
+			   const struct rte_eth_txconf *tx_conf __rte_unused)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct qman_fq *txq = &dpaa_intf->tx_queues[queue_idx];
+
+	PMD_INIT_FUNC_TRACE();
+
+	dev->data->tx_queues[queue_idx] = txq;
+
+	return 0;
+}
+
+static int dpaa_ol_set_fq_info(struct rte_eth_dev *dev)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct ask_ctrl_dpdk_fq_info_s fq_info;
+	struct qman_fq *txq, *rxq;
+	struct rte_pktmbuf_pool_private *mbp_priv;
+	int ret;
+
+	if (dpaa_intf->rx_queues == NULL || dpaa_intf->tx_queues == NULL) {
+		DPAA_PMD_ERR("Rx/Tx queues not allocated");
+		return -EINVAL;
+	}
+
+	if (dpaa_intf->bp_info == NULL) {
+		DPAA_PMD_ERR("Rx queue must be set up before starting the port");
+		return -EINVAL;
+	}
+
+	txq = &dpaa_intf->tx_queues[0];
+	rxq = &dpaa_intf->rx_queues[0];
+	memset(&fq_info, 0, sizeof(fq_info));
+	mbp_priv = (struct rte_pktmbuf_pool_private *)rte_mempool_get_priv(dpaa_intf->bp_info->mp);
+	fq_info.tx_fq_id = txq->fqid;
+	fq_info.rx_fq_id = rxq->fqid;
+	fq_info.buff_size = mbp_priv->mbuf_data_room_size;
+	fq_info.bp_id = dpaa_intf->bp_info->bpid;
+
+	fq_info.privDataSize = DPAA_OL_PARSERSLT_START_OFFSET;
+	fq_info.passPrsResult = DPAA_OL_PARSE_RESULT_REQUIRED;
+	fq_info.passTimeStamp = DPAA_OL_TIME_STAMP_REQUIRED;
+	fq_info.passHashResult = DPAA_OL_HASH_RESULT_REQUIRED;
+	fq_info.passAllOtherPCDInfo = DPAA_OL_PCD_INFO_REQUIRED;
+	fq_info.dataAlign = DPAA_OL_DATA_ALIGNMENT;
+	fq_info.manipExtraSpace = DPAA_OL_MAX_EXTRA_SIZE;
+
+	rte_memcpy(fq_info.bh_port_name, dpaa_intf->ol_bh_port_name,
+		   sizeof(fq_info.bh_port_name));
+
+	ret = ask_set_fq_info(dpaa_intf, &fq_info);
+	if (ret) {
+		DPAA_PMD_ERR("Set FQ info failed with ret: %d", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int dpaa_ol_link_update(struct rte_eth_dev *dev,
+			       __rte_unused int wait_to_complete)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct rte_eth_link *link = &dev->data->dev_link;
+
+	PMD_INIT_FUNC_TRACE();
+
+	link->link_status = dpaa_intf->valid;
+	link->link_speed = RTE_ETH_SPEED_NUM_NONE;
+	link->link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+	link->link_autoneg = RTE_ETH_LINK_AUTONEG;
+
+	return 0;
+}
+
+static int dpaa_ol_promiscuous_enable(__rte_unused struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+static int dpaa_ol_rx_queue_init(struct qman_fq *fq, uint32_t fqid)
+{
+	int ret;
+	struct qm_mcc_initfq opts = {0};
+	u32 flags = QMAN_FQ_FLAG_DYNAMIC_FQID | QMAN_FQ_FLAG_NO_ENQUEUE;
+
+	if (unlikely(!DPAA_PER_LCORE_PORTAL)) {
+		ret = rte_dpaa_portal_init(NULL);
+		if (ret < 0) {
+			DPAA_PMD_ERR("portal initialization failure");
+			return ret;
+		}
+	}
+
+	ret = qman_create_fq(fqid, flags, fq);
+	if (ret) {
+		DPAA_PMD_ERR("create rx fqid 0x%x failed with ret: %d", fqid,
+			     ret);
+		return ret;
+	}
+	fq->is_static = false;
+
+	dpaa_poll_queue_default_config(&opts);
+
+	ret = qman_init_fq(fq, 0, &opts);
+	if (ret)
+		DPAA_PMD_ERR("init rx fqid 0x%x failed with ret:%d", fqid, ret);
+	return ret;
+}
+
+static int dpaa_ol_tx_queue_init(struct dpaa_if *dpaa_intf, struct qman_fq *fq,
+				  uint32_t fqid)
+{
+	int ret;
+	struct qm_mcc_initfq opts = {0};
+	u32 flags = QMAN_FQ_FLAG_DYNAMIC_FQID | QMAN_FQ_FLAG_TO_DCPORTAL;
+	struct ask_ctrl_offline_channel ch_info;
+
+	memset(&ch_info, 0, sizeof(ch_info));
+
+	ret = ask_get_channel_info(dpaa_intf, &ch_info);
+	if (ret) {
+		DPAA_PMD_ERR("Get channel info failed with ret: %d", ret);
+		return ret;
+	}
+	ret = qman_create_fq(fqid, flags, fq);
+	if (ret) {
+		DPAA_PMD_ERR("Create tx fq failed with ret: %d", ret);
+		return ret;
+	}
+
+	opts.we_mask = QM_INITFQ_WE_DESTWQ |
+		       QM_INITFQ_WE_CONTEXTB | QM_INITFQ_WE_CONTEXTA;
+
+	opts.fqd.dest.channel = ch_info.channel_id;
+	opts.fqd.dest.wq = DPA_ISC_WQ_ID;
+	opts.fqd.fq_ctrl = QM_FQCTRL_PREFERINCACHE;
+	opts.fqd.context_b = ch_info.ctx_b_val;
+	opts.fqd.context_a.hi = ch_info.ctx_a_hi_val;
+	opts.fqd.context_a.lo = ch_info.ctx_a_lo_val;
+
+	opts.fqid = fq->fqid;
+	fq->ch_id = ch_info.channel_id;
+	opts.count = 1;
+
+	ret = qman_init_fq(fq, QMAN_INITFQ_FLAG_SCHED, &opts);
+	if (ret)
+		DPAA_PMD_ERR("init tx fqid 0x%x failed %d", fq->fqid, ret);
+	return ret;
+}
+
+static const struct eth_dev_ops dpaa_ol_devops = {
+		.dev_configure            = dpaa_ol_dev_configure,
+		.dev_start                = dpaa_ol_dev_start,
+		.dev_stop                 = dpaa_ol_dev_stop,
+		.dev_close                = dpaa_ol_dev_close,
+		.dev_infos_get            = dpaa_ol_dev_info,
+
+		.rx_queue_setup           = dpaa_ol_rx_queue_setup,
+		.tx_queue_setup           = dpaa_ol_tx_queue_setup,
+
+		.link_update              = dpaa_ol_link_update,
+		.promiscuous_enable       = dpaa_ol_promiscuous_enable,
+};
+
+static void dpaa_oldev_queues_release(struct dpaa_if *dpaa_intf)
+{
+	uint16_t i;
+	int ret, reset_ret;
+	bool release_fqids;
+	struct ask_ctrl_dpdk_fq_info_s fq_info;
+
+	/* Release FQIDs only if the kernel confirms it dropped them. */
+	memset(&fq_info, 0, sizeof(fq_info));
+	if (dpaa_intf->tx_queues && dpaa_intf->nb_tx_queues)
+		fq_info.tx_fq_id = dpaa_intf->tx_queues[0].fqid;
+	if (dpaa_intf->rx_queues && dpaa_intf->nb_rx_queues)
+		fq_info.rx_fq_id = dpaa_intf->rx_queues[0].fqid;
+
+	reset_ret = ask_reset_fq_info(dpaa_intf, &fq_info);
+	if (reset_ret) {
+		DPAA_PMD_WARN("Reset FQ info failed with ret: %d, not releasing fqids",
+			      reset_ret);
+	}
+	release_fqids = (reset_ret == 0);
+
+	if (dpaa_intf->tx_queues) {
+		for (i = 0; i < dpaa_intf->nb_tx_queues; i++) {
+			if (!dpaa_intf->tx_queues[i].fqid)
+				continue;
+			ret = qman_shutdown_fq(&dpaa_intf->tx_queues[i]);
+			if (ret) {
+				DPAA_PMD_WARN("Failed(%d) to shutdown txq%d(0x%x), fqid not released",
+					      ret, i, dpaa_intf->tx_queues[i].fqid);
+				continue;
+			}
+			if (release_fqids)
+				qman_release_fqid(dpaa_intf->tx_queues[i].fqid);
+		}
+		rte_free(dpaa_intf->tx_queues);
+		dpaa_intf->tx_queues = NULL;
+		dpaa_intf->nb_tx_queues = 0;
+	}
+
+	if (dpaa_intf->rx_queues) {
+		for (i = 0; i < dpaa_intf->nb_rx_queues; i++) {
+			if (!dpaa_intf->rx_queues[i].fqid)
+				continue;
+			ret = qman_shutdown_fq(&dpaa_intf->rx_queues[i]);
+			if (ret) {
+				DPAA_PMD_WARN("Failed(%d) to shutdown rxq%d(0x%x), fqid not released",
+					      ret, i, dpaa_intf->rx_queues[i].fqid);
+				continue;
+			}
+			if (release_fqids)
+				qman_release_fqid(dpaa_intf->rx_queues[i].fqid);
+		}
+		rte_free(dpaa_intf->rx_queues);
+		dpaa_intf->rx_queues = NULL;
+		dpaa_intf->nb_rx_queues = 0;
+	}
+}
+
+static int dpaa_oldev_init(struct rte_eth_dev *eth_dev)
+{
+	int num_fqs, ret;
+	struct dpaa_if *dpaa_intf;
+
+	PMD_INIT_FUNC_TRACE();
+
+	num_fqs = DPAA_DEFAULT_NUM_PCD_QUEUES;
+	dpaa_intf = eth_dev->data->dev_private;
+	dpaa_intf->ol_fd = -1;
+
+	dpaa_intf->rx_queues = rte_zmalloc(NULL,
+					   sizeof(struct qman_fq) * num_fqs,
+					   MAX_CACHELINE);
+	if (!dpaa_intf->rx_queues) {
+		DPAA_PMD_ERR("Failed to alloc mem for RX queues");
+		return -ENOMEM;
+	}
+	dpaa_intf->nb_rx_queues = num_fqs;
+
+	ret = dpaa_ol_rx_queue_init(&dpaa_intf->rx_queues[0], 0);
+	if (ret)
+		goto free_rx;
+	dpaa_intf->rx_queues[0].dpaa_intf = dpaa_intf;
+
+	dpaa_intf->tx_queues = rte_zmalloc(NULL,
+					   sizeof(struct qman_fq) * num_fqs,
+					   MAX_CACHELINE);
+	if (!dpaa_intf->tx_queues) {
+		DPAA_PMD_ERR("Failed to alloc mem for TX queues");
+		ret = -ENOMEM;
+		goto free_rx;
+	}
+	dpaa_intf->nb_tx_queues = num_fqs;
+
+	ret = dpaa_ol_tx_queue_init(dpaa_intf, &dpaa_intf->tx_queues[0], 0);
+	if (ret)
+		goto free_rx;
+	dpaa_intf->tx_queues[0].dpaa_intf = dpaa_intf;
+
+	eth_dev->dev_ops = &dpaa_ol_devops;
+	eth_dev->rx_pkt_burst = dpaa_eth_queue_rx;
+	eth_dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
+
+	/* Allocate memory for storing MAC addresses */
+	eth_dev->data->mac_addrs = rte_zmalloc("mac_addr",
+			RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER, 0);
+	if (eth_dev->data->mac_addrs == NULL) {
+		DPAA_PMD_ERR("Failed to allocate %d bytes needed to "
+			     "store MAC addresses",
+			     RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER);
+		ret = -ENOMEM;
+		goto free_rx;
+	}
+
+	return 0;
+
+free_rx:
+	dpaa_oldev_queues_release(dpaa_intf);
+	return ret;
+}
+
+static int dpaa_ol_probe(__rte_unused struct rte_dpaa_driver *dpaa_drv,
+			 struct rte_dpaa_device *dpaa_dev)
+{
+	int ret;
+	struct rte_eth_dev *eth_dev;
+	struct dpaa_if *dpaa_intf;
+	char bh_port_name[DPAA_OL_MAX_BH_PORT_NAME_LEN];
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Offline port state is owned by the primary process only. */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		DPAA_PMD_WARN("%s: not supported in secondary process",
+			      dpaa_dev->device.name);
+		return -ENOTSUP;
+	}
+
+	ret = dpaa_ol_get_bh_port_name(dpaa_dev->device.devargs,
+				       bh_port_name, sizeof(bh_port_name));
+	if (ret <= 0) {
+		DPAA_PMD_ERR("Offline port \"%s\" devarg not defined or invalid (ret=%d)",
+			     DRIVER_OL_BH_PORT, ret);
+		return ret < 0 ? ret : -EINVAL;
+	}
+
+	eth_dev = rte_eth_dev_allocate(dpaa_dev->name);
+	if (!eth_dev)
+		return -ENOMEM;
+	eth_dev->data->dev_private = rte_zmalloc("ethdev private structure",
+						 sizeof(struct dpaa_if),
+						 RTE_CACHE_LINE_SIZE);
+	if (!eth_dev->data->dev_private) {
+		DPAA_PMD_ERR("Cannot allocate memzone for port data");
+		rte_eth_dev_release_port(eth_dev);
+		return -ENOMEM;
+	}
+
+	eth_dev->device = &dpaa_dev->device;
+
+	dpaa_intf = eth_dev->data->dev_private;
+	rte_strscpy(dpaa_intf->ol_bh_port_name, bh_port_name,
+		    sizeof(dpaa_intf->ol_bh_port_name));
+
+	ret = dpaa_oldev_init(eth_dev);
+	if (ret == 0) {
+		rte_eth_dev_probing_finish(eth_dev);
+		return 0;
+	}
+
+	rte_eth_dev_release_port(eth_dev);
+	return ret;
+}
+
+static int dpaa_ol_remove(struct rte_dpaa_device *dpaa_dev)
+{
+	struct rte_eth_dev *eth_dev;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	eth_dev = rte_eth_dev_allocated(dpaa_dev->device.name);
+	if (eth_dev == NULL)
+		return 0;
+
+	dpaa_ol_dev_close(eth_dev);
+
+	return rte_eth_dev_release_port(eth_dev);
+}
+
+static struct rte_dpaa_driver rte_dpaa_ol_pmd = {
+		.drv_type = FSL_DPAA_OL,
+		.probe = dpaa_ol_probe,
+		.remove = dpaa_ol_remove,
+};
+
+RTE_PMD_REGISTER_DPAA(ol_dpaa, rte_dpaa_ol_pmd);
+RTE_PMD_REGISTER_PARAM_STRING(ol_dpaa,
+		DRIVER_OL_BH_PORT "=<string>");
diff --git a/drivers/net/dpaa/meson.build b/drivers/net/dpaa/meson.build
index 8d4f69c596..3ec1091197 100644
--- a/drivers/net/dpaa/meson.build
+++ b/drivers/net/dpaa/meson.build
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright 2018-2020 NXP
+# Copyright 2018-2020,2026 NXP
 
 if not is_linux
     build = false
@@ -9,12 +9,13 @@ deps += ['mempool_dpaa']
 
 sources = files(
         'dpaa_ethdev.c',
-        'fmlib/fm_lib.c',
-        'fmlib/fm_vsp.c',
         'dpaa_flow.c',
-        'dpaa_rxtx.c',
         'dpaa_fmc.c',
         'dpaa_ptp.c',
+        'dpaa_oldev.c',
+        'dpaa_rxtx.c',
+        'fmlib/fm_lib.c',
+        'fmlib/fm_vsp.c',
 )
 
 cflags += no_wvla_cflag
@@ -24,4 +25,4 @@ if cc.has_argument('-Wno-pointer-arith')
     cflags += '-Wno-pointer-arith'
 endif
 
-headers = files('rte_pmd_dpaa.h')
+headers = files('rte_pmd_dpaa.h', 'rte_pmd_dpaa_oldev.h')
diff --git a/drivers/net/dpaa/rte_pmd_dpaa_oldev.h b/drivers/net/dpaa/rte_pmd_dpaa_oldev.h
new file mode 100644
index 0000000000..9b695686f0
--- /dev/null
+++ b/drivers/net/dpaa/rte_pmd_dpaa_oldev.h
@@ -0,0 +1,198 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2026 NXP
+ */
+
+#ifndef _RTE_PMD_DPAA_OLDEV_H
+#define _RTE_PMD_DPAA_OLDEV_H
+
+/**
+ * @file rte_pmd_dpaa_oldev.h
+ *
+ * NXP DPAA offline (O/H) port PMD-specific API.
+ *
+ * @warning
+ * @b EXPERIMENTAL:
+ * All functions in this file may be changed or removed without prior notice.
+ *
+ * These APIs configure the classification, local gateway (LGW) and related
+ * uplink information for the DPAA offline port through the kernel control
+ * device.
+ */
+
+#include <stdint.h>
+#include <rte_common.h>
+#include <rte_compat.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** IPv4 address type for the inner/static address pair used in uplink
+ * classification.
+ */
+#define RTE_PMD_DPAA_OLDEV_IPV4_ADDR_TYPE  0x04
+/** IPv6 address type for the inner/static address pair used in uplink
+ * classification.
+ */
+#define RTE_PMD_DPAA_OLDEV_IPV6_ADDR_TYPE  0x06
+
+/** Maximum number of GTP UDP ports an application can listen on. */
+#define RTE_PMD_DPAA_OLDEV_MAX_NUM_PORTS 2
+
+/** IPv4 subnet type for an LGW subnet entry. */
+#define RTE_PMD_DPAA_OLDEV_IPV4_SUBNET_TYPE  0x04
+/** IPv6 subnet type for an LGW subnet entry. */
+#define RTE_PMD_DPAA_OLDEV_IPV6_SUBNET_TYPE  0x06
+/** Maximum number of LGW subnets that can be programmed. */
+#define RTE_PMD_DPAA_OLDEV_MAX_NUM_SUBNETS 4
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags when the address pair carries
+ * a valid inner IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_CLASSIF_INNER_IP 0x1
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags when the address pair carries
+ * a static IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_CLASSIF_STATIC_IP 0x2
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags to indicate the telecom
+ * application is listening only on the static IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_TELECOM_LISTEN_ON_ONLY_STATICIP 0x4
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags to indicate the telecom
+ * application is listening on both the static and the inner IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_TELECOM_LISTEN_ON_BOTH_STATIC_INNER_IP 0x8
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags to indicate the telecom
+ * application is listening only on the inner IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_TELECOM_LISTEN_ON_ONLY_INNERIP 0x10
+
+/**
+ * Holds an IPv4 or IPv6 address.
+ *
+ * For an IPv4 address only ip_addr[0] is used; for an IPv6 address all
+ * four words are used. Which representation applies is determined by
+ * the addr_type field of the enclosing struct rte_pmd_dpaa_ip_pair.
+ */
+struct rte_pmd_dpaa_ip_addr {
+	uint32_t ip_addr[4]; /**< Address words, network byte order. */
+};
+
+/** Static/inner IP address pair used for uplink classification. */
+struct __rte_packed_begin rte_pmd_dpaa_ip_pair {
+	struct rte_pmd_dpaa_ip_addr static_ip; /**< Static IP address. */
+	struct rte_pmd_dpaa_ip_addr inner_ip;  /**< Inner IP address. */
+	uint8_t flags;		/**< Combination of
+				  *  RTE_PMD_DPAA_OLDEV_CLASSIF_* and
+				  *  RTE_PMD_DPAA_OLDEV_TELECOM_* flags.
+				  */
+	uint8_t addr_type;	/**< RTE_PMD_DPAA_OLDEV_IPV4_ADDR_TYPE or
+				  *  RTE_PMD_DPAA_OLDEV_IPV6_ADDR_TYPE.
+				  */
+	uint8_t pad[2];		/**< Reserved, must be zero. */
+} __rte_packed_end;
+
+/** A single local gateway (LGW) subnet entry. */
+struct __rte_packed_begin rte_pmd_dpaa_lgw_subnet {
+	uint32_t subnet[4];	/**< Subnet address, network byte order. */
+	uint8_t mask;		/**< Subnet mask length in bits. */
+	uint8_t subnet_type;	/**< RTE_PMD_DPAA_OLDEV_IPV4_SUBNET_TYPE or
+				  *   RTE_PMD_DPAA_OLDEV_IPV6_SUBNET_TYPE.
+				  */
+	uint8_t pad[2];		/**< Reserved, must be zero. */
+} __rte_packed_end;
+
+/** Uplink classification information for the DPAA offline port. */
+struct rte_pmd_dpaa_uplink_cls_info_s {
+	struct rte_pmd_dpaa_ip_pair addr_pair;	/**< Static/inner IP pair. */
+	/** GTP UDP ports the application listens on. */
+	uint16_t gtp_udp_port[RTE_PMD_DPAA_OLDEV_MAX_NUM_PORTS];
+	uint8_t gtp_proto_id;	/**< UDP protocol ID the application listens
+				  *   on.
+				  */
+	uint8_t num_ports;	/**< Number of valid entries in
+				  *   gtp_udp_port.
+				  */
+	uint8_t sec_enabled;	/**< Non-zero if IPsec is enabled. */
+	uint8_t pad;		/**< Reserved, must be zero. */
+};
+
+/** Local gateway (LGW) information for the DPAA offline port. */
+struct __rte_packed_begin rte_pmd_dpaa_lgw_info_s {
+	/** LGW subnet table. */
+	struct rte_pmd_dpaa_lgw_subnet subnets[RTE_PMD_DPAA_OLDEV_MAX_NUM_SUBNETS];
+	uint8_t num_subnets;	/**< Number of valid entries in subnets. */
+	uint8_t pad[3];		/**< Reserved, must be zero. */
+} __rte_packed_end;
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Program the uplink classification information for the DPAA offline port.
+ *
+ * @param port_id
+ *   The port identifier of the DPAA offline (O/H) port.
+ * @param cls_info
+ *   Pointer to the classification information to program. Must not be NULL.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_set_classif_info(uint16_t port_id,
+		struct rte_pmd_dpaa_uplink_cls_info_s *cls_info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Reset the uplink classification information for the DPAA offline port.
+ *
+ * @param port_id
+ *   The port identifier of the DPAA offline (O/H) port.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_reset_classif_info(uint16_t port_id);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Program the local gateway (LGW) information for the DPAA offline port.
+ *
+ * @param port_id
+ *   The port identifier of the DPAA offline (O/H) port.
+ * @param lgw_info
+ *   Pointer to the LGW information to program. Must not be NULL.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_set_lgw_info(uint16_t port_id,
+		struct rte_pmd_dpaa_lgw_info_s *lgw_info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Reset the local gateway (LGW) information for the DPAA offline port.
+ *
+ * @param port_id
+ *   The port identifier of the DPAA offline (O/H) port.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_reset_lgw_info(uint16_t port_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PMD_DPAA_OLDEV_H */
-- 
2.25.1


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

* [PATCH v3 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name
  2026-11-03  9:35   ` [PATCH v3 " Gagandeep Singh
  2026-11-03  9:35     ` [PATCH v3 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
  2026-11-03  9:35     ` [PATCH v3 2/4] drivers: add offline (O/H) port device support Gagandeep Singh
@ 2026-11-03  9:36     ` Gagandeep Singh
  2026-11-03  9:36     ` [PATCH v3 4/4] drivers: add DPAA cgrid cleanup support Gagandeep Singh
                       ` (2 subsequent siblings)
  5 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-03  9:36 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

A shared MAC interface needs the kernel netdev name to read the MTU,
and that name is only the DPDK port name for fmX-macY style netdevs.

Look it up in sysfs under the platform device of the dpa-ethernet node
the port was created from, and fall back to the port name.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/nics/dpaa.rst       |  6 ++-
 drivers/net/dpaa/dpaa_ethdev.c | 68 +++++++++++++++++++++++++++++++++-
 2 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst
index 7658e6d454..d391c0607f 100644
--- a/doc/guides/nics/dpaa.rst
+++ b/doc/guides/nics/dpaa.rst
@@ -276,6 +276,11 @@ Refer to the document :doc:`build_and_test` for details.
   and thus disabling hardware based packet handling at driver level,
   e.g. ``dpaa:fm1-mac3,recv_err_pkts=1``.
 
+* For a shared MAC interface the kernel network interface name is looked up
+  in sysfs from the device tree node the port was created from,
+  so a kernel interface that does not follow
+  the ``fmX-macY`` naming style is handled without extra configuration.
+
 ``drv_bh_port``
    Name of the back-half port associated with an offline (O/H) port device.
    It is passed on the offline port device itself, which is named
@@ -307,7 +312,6 @@ port identified by its ``port_id``, via the experimental
 ``rte_pmd_dpaa_ol_set_lgw_info()`` and ``rte_pmd_dpaa_ol_reset_lgw_info()``
 APIs declared in ``rte_pmd_dpaa_oldev.h``.
 
-
 FMAN Config
 -----------
 
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index fe49c7b961..a821e68807 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -9,12 +9,14 @@
 #include <inttypes.h>
 #include <unistd.h>
 #include <limits.h>
+#include <stdlib.h>
 #include <sched.h>
 #include <signal.h>
 #include <pthread.h>
 #include <sys/types.h>
 #include <sys/syscall.h>
 #include <sys/ioctl.h>
+#include <dirent.h>
 
 #include <eal_export.h>
 #include <rte_string_fns.h>
@@ -57,6 +59,61 @@
 #define DRIVER_RECV_ERR_PKTS      "recv_err_pkts"
 #define RTE_PRIORITY_103 103
 
+#define DPAA_OF_BASE_PATH "/sys/firmware/devicetree/base"
+
+/*
+ * Get the kernel netdev name bound to the same device tree node as this
+ * port, by matching each /sys/class/net/<ifname>/device/of_node against
+ * node_path. Returns 1 on success, 0 if none was found, negative on error.
+ */
+static int
+dpaa_get_kernel_ifname(const char *node_path, char *name, size_t size)
+{
+	char path[PATH_MAX], resolved[PATH_MAX];
+	struct dirent *entry;
+	DIR *dir;
+	int ret;
+
+	if (!node_path || node_path[0] == '\0')
+		return 0;
+
+	dir = opendir("/sys/class/net");
+	if (!dir)
+		return 0;
+
+	ret = 0;
+	while ((entry = readdir(dir)) != NULL) {
+		if (entry->d_name[0] == '.')
+			continue;
+
+		if (snprintf(path, sizeof(path),
+			     "/sys/class/net/%s/device/of_node",
+			     entry->d_name) >= (int)sizeof(path))
+			continue;
+
+		if (realpath(path, resolved) == NULL)
+			continue;
+
+		if (strncmp(resolved, DPAA_OF_BASE_PATH,
+			    strlen(DPAA_OF_BASE_PATH)) != 0)
+			continue;
+
+		if (strcmp(resolved + strlen(DPAA_OF_BASE_PATH),
+			   node_path) != 0)
+			continue;
+
+		if (rte_strscpy(name, entry->d_name, size) < 0) {
+			ret = -ENAMETOOLONG;
+			break;
+		}
+		ret = 1;
+		break;
+	}
+
+	closedir(dir);
+	return ret;
+}
+
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		RTE_ETH_RX_OFFLOAD_SCATTER;
@@ -251,6 +308,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	int speed, duplex;
 	int ret, rx_status, socket_fd;
 	struct ifreq ifr;
+	char sh_if_name[IFNAMSIZ];
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -272,7 +330,15 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 			DPAA_PMD_ERR("Cannot open IF socket");
 			return -errno;
 		}
-		strlcpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
+
+		/* The DPDK port name matches the netdev only for fmX-macY. */
+		sh_if_name[0] = '\0';
+		ret = dpaa_get_kernel_ifname(__fif->node_path, sh_if_name,
+					     sizeof(sh_if_name));
+		if (ret <= 0 || sh_if_name[0] == '\0')
+			strlcpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
+		else
+			strlcpy(ifr.ifr_name, sh_if_name, IFNAMSIZ);
 
 		if (ioctl(socket_fd, SIOCGIFMTU, &ifr) < 0) {
 			DPAA_PMD_ERR("Cannot get interface mtu");
-- 
2.25.1


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

* [PATCH v3 4/4] drivers: add DPAA cgrid cleanup support
  2026-11-03  9:35   ` [PATCH v3 " Gagandeep Singh
                       ` (2 preceding siblings ...)
  2026-11-03  9:36     ` [PATCH v3 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
@ 2026-11-03  9:36     ` Gagandeep Singh
  2026-11-04 11:29     ` [PATCH v3 0/4] DPAA driver changes Stephen Hemminger
  2026-11-16  6:25     ` [PATCH v4 " Gagandeep Singh
  5 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-03  9:36 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, stable, Jun Yang

From: Jun Yang <jun.yang@nxp.com>

A congestion group must have no member frame queues left when it is
deleted, and its CGRID must be returned to the allocator once the group
is gone. Neither was handled on the net/dpaa close and probe-failure
paths.

This also changes probe behaviour: a qman_create_cgr() failure in
dpaa_rx_queue_init() or dpaa_tx_queue_init() now fails the probe
instead of continuing without tail drop on that queue. The probe error
path deletes one CGR per initialised queue, and a CGR whose creation
failed was never linked into the portal list.

Fixes: 62f53995caaf ("net/dpaa: add frame count based tail drop with CGR")
Fixes: 9124e65dd3eb ("net/dpaa: enable Tx queue taildrop")
Cc: stable@dpdk.org

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/dpaa/base/qbman/qman.c       |  61 +++++++++
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   1 +
 drivers/bus/dpaa/include/fsl_qman.h      |  27 ++++
 drivers/net/dpaa/dpaa_ethdev.c           | 167 +++++++++++++++++++++--
 4 files changed, 244 insertions(+), 12 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 3c056e4547..fa3387c6bd 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -2993,3 +2993,64 @@ qman_shutdown_fq(struct qman_fq *fq)
 out:
 	return ret;
 }
+
+int qman_pending_fq_by_cgrid_range(u32 cgrid_start, u32 cgrid_num,
+	u32 start_fqid, u32 *fqid, u32 *cgrid)
+{
+	struct qman_fq fq = {
+		.fqid = start_fqid ? start_fqid : 1
+	};
+	struct qm_mcr_queryfq_np np;
+	struct qm_fqd fqd;
+	int err;
+
+	/*
+	 * Do not use the CGR byte count to decide whether to scan. An FQ is a
+	 * member of the group whenever it is scheduled with CGE set and a
+	 * matching cgid, whether or not it currently holds any frames, and the
+	 * group cannot be deleted while such a member exists. Skipping the
+	 * scan for an empty CGR would let an idle stale FQ survive and its
+	 * CGRID be released while still referenced. This runs from the device
+	 * close path only, so the scan cost is acceptable.
+	 *
+	 * The whole CGRID range of a port is matched in a single pass, so a
+	 * port with many congestion groups does not need one full FQID space
+	 * scan per group.
+	 */
+	DPAA_BUS_DEBUG("Scanning FQs for cgrid(0x%x..0x%x)",
+		cgrid_start, cgrid_start + cgrid_num - 1);
+
+	/* FQID space is 24 bits wide; stop before wrapping. */
+	for (; fq.fqid <= QMAN_MAX_FQID; fq.fqid++) {
+		err = qman_query_fq_np(&fq, &np);
+		if (err == -ERANGE) {
+			/*
+			 * FQID is not implemented on this device, so there is
+			 * nothing beyond it either.
+			 */
+			break;
+		} else if (err) {
+			DPAA_BUS_WARN("Failed(%d) to Query np FQ(fqid=0x%x)",
+				err, fq.fqid);
+			return err;
+		}
+		if ((np.state & QM_MCR_NP_STATE_MASK) != QM_MCR_NP_STATE_OOS) {
+			err = qman_query_fq(&fq, &fqd);
+			if (err) {
+				DPAA_BUS_WARN("Failed(%d) to Query FQ(fqid=0x%x)",
+					err, fq.fqid);
+			} else if ((fqd.fq_ctrl & QM_FQCTRL_CGE) &&
+				fqd.cgid >= cgrid_start &&
+				fqd.cgid < cgrid_start + cgrid_num) {
+				if (fqid)
+					*fqid = fq.fqid;
+				if (cgrid)
+					*cgrid = fqd.cgid;
+				return 0;
+			}
+		}
+	}
+	DPAA_BUS_DEBUG("No FQ left in cgrid(0x%x..0x%x)",
+		cgrid_start, cgrid_start + cgrid_num - 1);
+	return -ERANGE;
+}
diff --git a/drivers/bus/dpaa/dpaa_bus_base_symbols.c b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
index aaa9f9bec2..4da43f293d 100644
--- a/drivers/bus/dpaa/dpaa_bus_base_symbols.c
+++ b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
@@ -57,6 +57,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(qman_reserve_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_pool_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_cgrid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_release_cgrid_range)
+RTE_EXPORT_INTERNAL_SYMBOL(qman_pending_fq_by_cgrid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_intr_enable)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_intr_disable)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_get_ioctl_version_number)
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index b2674ce5d0..6d76722275 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1284,6 +1284,9 @@ struct qman_cgr {
  */
 #define QMAN_FQRN_WAIT_MAX		10000000u
 
+/* Maximum FQID value: frame queue IDs are 24 bits wide. */
+#define QMAN_MAX_FQID			0x00FFFFFFu
+
 /* Flags to qman_create_fq() */
 #define QMAN_FQ_FLAG_NO_ENQUEUE      0x00000001 /* can't enqueue */
 #define QMAN_FQ_FLAG_NO_MODIFY       0x00000002 /* can only enqueue */
@@ -1916,6 +1919,30 @@ static inline int qman_shutdown_fq_by_fqid(u32 fqid)
 	return qman_shutdown_fq(&fq);
 }
 
+/**
+ * qman_pending_fq_by_cgrid_range - Find an FQ still attached to a CGR range.
+ *
+ * @cgrid_start: first congestion group id of the range to search for.
+ * @cgrid_num: number of consecutive congestion group ids in the range.
+ * @start_fqid: FQID to begin the scan from (0 or 1 means scan from the
+ *   start). A caller shutting down several stale FQs can pass the previously
+ *   returned FQID + 1 to resume the scan instead of restarting from the
+ *   beginning each time.
+ * @fqid: on success, holds the FQID that is still attached to the range.
+ * @cgrid: on success, holds the congestion group id that FQ belongs to.
+ *   May be NULL.
+ *
+ * Matching a whole range in one pass lets a caller with many congestion
+ * groups, such as a port releasing all of its Rx or Tx CGRs, avoid one full
+ * FQID space scan per group.
+ *
+ * Return 0 and set *fqid when a matching FQ is found, -ERANGE when none is
+ * left, or a negative error code on query failure.
+ */
+__rte_internal
+int qman_pending_fq_by_cgrid_range(u32 cgrid_start, u32 cgrid_num,
+		u32 start_fqid, u32 *fqid, u32 *cgrid);
+
 /**
  * qman_reserve_fqid_range - Reserve the specified range of frame queue IDs
  * @fqid: the base FQID of the range to deallocate
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index a821e68807..47dafc5f11 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -114,6 +114,9 @@ dpaa_get_kernel_ifname(const char *node_path, char *name, size_t size)
 	return ret;
 }
 
+/* Maximum number of stale frame queues cleaned up per congestion group. */
+#define DPAA_CGR_STALE_FQ_MAX     64
+
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		RTE_ETH_RX_OFFLOAD_SCATTER;
@@ -585,6 +588,49 @@ static int dpaa_eth_dev_stop(struct rte_eth_dev *dev)
 	return 0;
 }
 
+/* Shut down any frame queue still linked to this CGR.
+ *
+ * A CGR must have no members left when it is deleted. FQs left behind by a
+ * previous run of the application are not owned by this process, so they can
+ * only be found by asking QMan. There may be more than one, hence the loop.
+ *
+ * Returns true if the FQID range was fully scanned (i.e. no stale FQ was
+ * left behind), false if an FQ refused to shut down and the scan had to
+ * stop early.
+ */
+static bool
+dpaa_cgr_stale_fq_cleanup(struct rte_eth_dev *dev, uint32_t cgrid_start,
+			  uint32_t cgrid_num, const char *dir)
+{
+	uint32_t start_fqid = 1;
+	uint32_t fqid, cgrid;
+	uint32_t loop, max_loop;
+	int ret;
+
+	max_loop = cgrid_num * DPAA_CGR_STALE_FQ_MAX;
+	for (loop = 0; loop < max_loop; loop++) {
+		if (qman_pending_fq_by_cgrid_range(cgrid_start, cgrid_num,
+						   start_fqid, &fqid, &cgrid))
+			return true;
+		/* Should be FQ not cleaned in previous program. */
+		DPAA_PMD_DEBUG("FQ(fqid=0x%x) with %s cgid=%u is still alive?",
+			fqid, dir, cgrid);
+		ret = qman_shutdown_fq_by_fqid(fqid);
+		if (ret) {
+			DPAA_PMD_WARN("%s: Failed(%d) to shutdown %s cgid=%u's fq(fqid=0x%x)",
+				dev->data->name, ret, dir, cgrid, fqid);
+			/* Do not spin on an FQ that refuses to shut down. */
+			return false;
+		}
+		/* Resume the scan past the FQ just handled instead of
+		 * restarting from the beginning, which would be O(N^2) for
+		 * N stale FQs.
+		 */
+		start_fqid = fqid + 1;
+	}
+	return true;
+}
+
 static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 {
 	struct fman_if *fif = dev->process_private;
@@ -594,7 +640,7 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 	struct rte_eth_link *link = &dev->data->dev_link;
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 	struct qman_fq *fq;
-	int loop;
+	uint32_t loop;
 	int ret;
 
 	PMD_INIT_FUNC_TRACE();
@@ -669,26 +715,75 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 	/* Release congestion Groups after releasing FQIDs */
 	/* Release RX congestion Groups */
 	if (dpaa_intf->cgr_rx) {
+		bool cgrid_ok = true;
+
+		/* Shut down this port's own Rx FQs first, so the stale-FQ
+		 * scan below does not pick them up.
+		 */
+		for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) {
+			ret = qman_shutdown_fq(&dpaa_intf->rx_queues[loop]);
+			if (ret) {
+				DPAA_PMD_WARN("%s: shutdown rxq%d err(%d)",
+					dev->data->name, loop, ret);
+				cgrid_ok = false;
+			}
+		}
+
+		/* Scan for stale FQs left by a previous run. */
+		if (!dpaa_cgr_stale_fq_cleanup(dev, dpaa_intf->cgr_rx[0].cgrid,
+					  dpaa_intf->nb_rx_queues, "rx"))
+			cgrid_ok = false;
+
 		for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) {
 			ret = qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
 			if (ret) {
 				DPAA_PMD_WARN("%s: delete rxq%d's cgr err(%d)",
 					dev->data->name, loop, ret);
+				cgrid_ok = false;
 			}
 		}
+		/* Only hand the CGRIDs back to the allocator if every member
+		 * FQ was confirmed shut down and every CGR deleted; otherwise
+		 * deliberately leak them rather than reuse a CGRID that may
+		 * still be referenced by a live FQ.
+		 */
+		if (cgrid_ok)
+			qman_release_cgrid_range(dpaa_intf->cgr_rx[0].cgrid,
+					dpaa_intf->nb_rx_queues);
 		rte_free(dpaa_intf->cgr_rx);
 		dpaa_intf->cgr_rx = NULL;
 	}
 
 	/* Release TX congestion Groups */
 	if (dpaa_intf->cgr_tx) {
+		bool cgrid_ok = true;
+
+		/* Shut down this port's own Tx FQs before the scan below. */
+		for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
+			ret = qman_shutdown_fq(&dpaa_intf->tx_queues[loop]);
+			if (ret) {
+				DPAA_PMD_WARN("%s: shutdown txq%d err(%d)",
+					dev->data->name, loop, ret);
+				cgrid_ok = false;
+			}
+		}
+
+		/* Scan for stale FQs left by a previous run. */
+		if (!dpaa_cgr_stale_fq_cleanup(dev, dpaa_intf->cgr_tx[0].cgrid,
+					  MAX_DPAA_CORES, "tx"))
+			cgrid_ok = false;
+
 		for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
 			ret = qman_delete_cgr(&dpaa_intf->cgr_tx[loop]);
 			if (ret) {
 				DPAA_PMD_WARN("%s: delete txq%d's cgr err(%d)",
 					dev->data->name, loop, ret);
+				cgrid_ok = false;
 			}
 		}
+		if (cgrid_ok)
+			qman_release_cgrid_range(dpaa_intf->cgr_tx[0].cgrid,
+						 MAX_DPAA_CORES);
 		rte_free(dpaa_intf->cgr_tx);
 		dpaa_intf->cgr_tx = NULL;
 	}
@@ -2039,19 +2134,32 @@ static int dpaa_rx_queue_init(struct qman_fq *fq, struct qman_cgr *cgr_rx,
 		ret = qman_create_cgr(cgr_rx, QMAN_CGR_FLAG_USE_INIT,
 				      &cgr_opts);
 		if (ret) {
-			DPAA_PMD_WARN(
-				"rx taildrop init fail on rx fqid 0x%x(ret=%d)",
+			/* Do not fall back to running without the CGR. The
+			 * caller counts one CGR per queue it initialised and
+			 * deletes cgr_rx[0..n) on its error path, so a queue
+			 * without a CGR would make it delete an object that
+			 * was never added to the portal list, whose node is
+			 * still zeroed from rte_zmalloc().
+			 */
+			DPAA_PMD_ERR("rx taildrop init fail on rx fqid 0x%x(ret=%d)",
 				fq->fqid, ret);
-			goto without_cgr;
+			return ret;
 		}
 		opts.we_mask |= QM_INITFQ_WE_CGID;
 		opts.fqd.cgid = cgr_rx->cgrid;
 		opts.fqd.fq_ctrl |= QM_FQCTRL_CGE;
 	}
-without_cgr:
+
 	ret = qman_init_fq(fq, 0, &opts);
-	if (ret)
+	if (ret) {
 		DPAA_PMD_ERR("init rx fqid 0x%x failed with ret:%d", fqid, ret);
+		/* The caller only counts this CGR once this function returns
+		 * success, so its error path will not delete it. Unlink it here
+		 * or the portal keeps a pointer into memory the caller frees.
+		 */
+		if (cgr_rx)
+			qman_delete_cgr(cgr_rx);
+	}
 	return ret;
 }
 
@@ -2130,10 +2238,12 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 		ret = qman_create_cgr(cgr_tx, QMAN_CGR_FLAG_USE_INIT,
 				      &cgr_opts);
 		if (ret) {
-			DPAA_PMD_WARN(
-				"rx taildrop init fail on rx fqid 0x%x(ret=%d)",
+			/* See the equivalent comment in
+			 * dpaa_rx_queue_init().
+			 */
+			DPAA_PMD_ERR("tx taildrop init fail on tx fqid 0x%x(ret=%d)",
 				fq->fqid, ret);
-			goto without_cgr;
+			return ret;
 		}
 		opts.we_mask |= QM_INITFQ_WE_CGID;
 		opts.fqd.cgid = cgr_tx->cgrid;
@@ -2141,10 +2251,14 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 		DPAA_PMD_DEBUG("Tx FQ tail drop enabled, threshold = %d",
 				td_tx_threshold);
 	}
-without_cgr:
+
 	ret = qman_init_fq(fq, QMAN_INITFQ_FLAG_SCHED, &opts);
-	if (ret)
+	if (ret) {
 		DPAA_PMD_ERR("init tx fqid 0x%x failed %d", fq->fqid, ret);
+		/* See the equivalent comment in dpaa_rx_queue_init(). */
+		if (cgr_tx)
+			qman_delete_cgr(cgr_tx);
+	}
 	return ret;
 }
 
@@ -2316,6 +2430,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	int num_rx_fqs, fqid;
 	int loop, ret = 0;
 	int dev_id;
+	int nb_rx_cgr = 0, nb_tx_cgr = 0;
+	bool rx_cgrid_allocated = false, tx_cgrid_allocated = false;
 	struct rte_dpaa_device *dpaa_device;
 	struct dpaa_if *dpaa_intf;
 	struct fm_eth_port_cfg *cfg;
@@ -2437,6 +2553,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			ret = -EINVAL;
 			goto free_rx;
 		}
+		rx_cgrid_allocated = true;
 	} else {
 		dpaa_intf->cgr_rx = NULL;
 	}
@@ -2471,6 +2588,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			fqid);
 		if (ret)
 			goto free_rx;
+		if (dpaa_intf->cgr_rx)
+			nb_rx_cgr++;
 		dpaa_intf->rx_queues[loop].vsp_id = vsp_id;
 		dpaa_intf->rx_queues[loop].dpaa_intf = dpaa_intf;
 	}
@@ -2511,11 +2630,11 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			ret = -EINVAL;
 			goto free_tx;
 		}
+		tx_cgrid_allocated = true;
 	} else {
 		dpaa_intf->cgr_tx = NULL;
 	}
 
-
 	for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
 		if (dpaa_intf->cgr_tx)
 			dpaa_intf->cgr_tx[loop].cgrid = cgrid_tx[loop];
@@ -2526,6 +2645,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			dpaa_intf->cgr_tx ? &dpaa_intf->cgr_tx[loop] : NULL);
 		if (ret)
 			goto free_tx;
+		if (dpaa_intf->cgr_tx)
+			nb_tx_cgr++;
 
 		if (dpaa_intf->ts_enable) {
 			ret = dpaa_tx_conf_queue_init(&dpaa_intf->tx_conf_queues[loop]);
@@ -2605,6 +2726,17 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	return 0;
 
 free_tx:
+	/* A CGR must have no members when deleted, so shut down the FQs
+	 * already linked to it first. Each CGR was also linked into the
+	 * QMan portal's cgr_cbs list by qman_create_cgr(), so deleting it
+	 * here avoids leaving the portal with dangling pointers.
+	 */
+	for (loop = 0; loop < nb_tx_cgr; loop++)
+		qman_shutdown_fq(&dpaa_intf->tx_queues[loop]);
+	for (loop = 0; loop < nb_tx_cgr; loop++)
+		qman_delete_cgr(&dpaa_intf->cgr_tx[loop]);
+	if (tx_cgrid_allocated)
+		qman_release_cgrid_range(cgrid_tx[0], MAX_DPAA_CORES);
 	rte_free(dpaa_intf->tx_conf_queues);
 	dpaa_intf->tx_conf_queues = NULL;
 	rte_free(dpaa_intf->tx_queues);
@@ -2612,8 +2744,19 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	dpaa_intf->nb_tx_queues = 0;
 
 free_rx:
+	/* Same as above for the Rx CGRs: shut down the FQs still linked to
+	 * their CGR before deleting it.
+	 */
+	for (loop = 0; loop < nb_rx_cgr; loop++)
+		qman_shutdown_fq(&dpaa_intf->rx_queues[loop]);
+	for (loop = 0; loop < nb_rx_cgr; loop++)
+		qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
+	if (rx_cgrid_allocated)
+		qman_release_cgrid_range(cgrid[0], num_rx_fqs);
 	rte_free(dpaa_intf->cgr_rx);
+	dpaa_intf->cgr_rx = NULL;
 	rte_free(dpaa_intf->cgr_tx);
+	dpaa_intf->cgr_tx = NULL;
 	rte_free(dpaa_intf->rx_queues);
 	dpaa_intf->rx_queues = NULL;
 	dpaa_intf->nb_rx_queues = 0;
-- 
2.25.1


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

* RE: [PATCH v2 0/4] DPAA driver changes
  2026-11-02 13:23   ` Stephen Hemminger
@ 2026-11-03  9:38     ` Gagandeep Singh
  0 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-03  9:38 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev@dpdk.org, Hemant Agrawal

Hi


NXP Confidential
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Monday, November 2, 2026 6:53 PM
> To: Gagandeep Singh <G.Singh@nxp.com>
> Cc: dev@dpdk.org; Hemant Agrawal <hemant.agrawal@nxp.com>
> Subject: Re: [PATCH v2 0/4] DPAA driver changes
>
> On Fri, 30 Oct 2026 10:13:14 +0530
> Gagandeep Singh <g.singh@nxp.com> wrote:
>
> > V2-changes:
> >  - Fixed most of the AI comments.
> >  - added new patch:
> >    fix out-of-bounds read of mac_idx
> >  - removed drv_oldev, updated comments and notes.
> >  - fixes FQ shutdown
> >  - removed unwanted checks, updated open, updated snprintf.
> >  - updated commit messages.
> >
> > V1:
> >  - Adding OH port support.
> >  - Updates in shared ethernet code.
> >  - Congestion related code cleanup.
> >
> > Gagandeep Singh (2):
> >   bus/dpaa: fix out-of-bounds read of mac_idx array
> >   drivers: add offline (O/H) port device support
> >
> > Hemant Agrawal (1):
> >   net/dpaa: support non fmX-macY type of shared Ethernet name
> >
> > Jun Yang (1):
> >   drivers: add DPAA cgrid cleanup support
> >
> >  doc/api/doxy-api-index.md                |   1 +
> >  doc/guides/nics/dpaa.rst                 |  35 +
> >  drivers/bus/dpaa/base/fman/fman.c        |  19 +
> >  drivers/bus/dpaa/base/qbman/qman.c       |  61 ++
> >  drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
> >  drivers/bus/dpaa/dpaa_bus.c              |  66 +-
> >  drivers/bus/dpaa/dpaa_bus_base_symbols.c |   2 +
> >  drivers/bus/dpaa/include/fman.h          |   6 +-
> >  drivers/bus/dpaa/include/fsl_qman.h      |  28 +
> >  drivers/net/dpaa/dpaa_ethdev.c           | 241 ++++++-
> >  drivers/net/dpaa/dpaa_ethdev.h           |   3 +
> >  drivers/net/dpaa/dpaa_flow.c             |   7 +-
> >  drivers/net/dpaa/dpaa_oldev.c            | 875 +++++++++++++++++++++++
> >  drivers/net/dpaa/meson.build             |  11 +-
> >  drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 188 +++++
> >  15 files changed, 1517 insertions(+), 30 deletions(-)  create mode
> > 100644 drivers/net/dpaa/dpaa_oldev.c  create mode 100644
> > drivers/net/dpaa/rte_pmd_dpaa_oldev.h
> >
>
> Review of [PATCH v2 0/4] DPAA offline port, shared MAC, cgrid cleanup
>
> Applied to next-net for-main (3b51e2e2f0). Each commit builds with -
> Dwerror=true.
>
> Series
> ------
>
> The rte_pmd_dpaa_ol_* API is unchanged from v1 apart from renames and
> Doxygen. The four functions still take no port_id and only pass a caller-filled
> struct to ioctl() on the out-of-tree /dev/cdx_ctrl driver. The dpaa.rst text added in
> v2 confirms the API is configuration for that kernel module, not for the DPDK port.
> It belongs in the vendor userspace library for cdx. Please drop
> rte_pmd_dpaa_oldev.h and the exports.
>
> There are still no release notes for the offline port.
>
In V3, we've updated the rte_pmd_dpaa_ol_* APIs to be port-based by requiring a port_id argument. Each call now resolves the corresponding rte_eth_dev and verifies it is a valid DPAA offline port before proceeding, preventing use on invalid or unrelated ports.

We also moved the control device handle (/dev/cdx_ctrl) from a process-wide global into the offline port's private data (dpaa_if::ol_fd). It is opened on first use and closed during dev_close(), ensuring its lifetime is tied to the port.

Also added the release notes in V3.
>
> Patch 2/4 drivers: add offline (O/H) port device support
> --------------------------------------------------------
>
> Warning
>
> The commit message still says the port is "selected through the 'drv_oldev' bus
> device argument". v2 removed drv_oldev; the port is created when "-a
> dpaa_bus:oldev1" is given.
>
> With only oldev1 present, dpaa_netcfg is NULL. v2 handles that in the two log
> statements but not in the debug dump:
>
>       #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
>               dump_netcfg(dpaa_netcfg, stdout);
>       #endif
>
> dump_netcfg() dereferences cfg_ptr->num_ethports unconditionally. Fold it into
> the existing check:
>
>       if (dpaa_netcfg) {
>       #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
>               dump_netcfg(dpaa_netcfg, stdout);
>       #endif
>               DPAA_BUS_DEBUG("Number of ethernet devices = %d",
>                            dpaa_netcfg->num_ethports);
>       }
>
> Not addressed from v1: dpaa_oldev_queues_release() returns both FQIDs to the
> allocator with qman_release_fqid(), but the kernel received them through
> ASK_CTRL_SET_DPDK_INFO and is never told they are gone. There is no reset
> ioctl for that. Until cdx provides one, do not release the two FQIDs on close.
>
> Info
>
> drv_bh_port is now checked against a key list, but it is still parsed in dev_start(). A
> missing drv_bh_port is only reported at start. Parse it once in dpaa_ol_probe()
> and fail probe if it is absent.
>
> The static_assert and comment added to dpaa_flow.c, and the
> MEMMAC_REG_OFFSET removal in fman.h, are not part of the offline port.
> Move the dpaa_flow.c change to 1/4, and mention the fman.h removal in the
> commit message.
>
>
> Patch 4/4 drivers: add DPAA cgrid cleanup support
> -------------------------------------------------
>
> Info
>
> dev_close() runs dpaa_cgr_stale_fq_cleanup() before shutting down the port's
> own FQs. The scan therefore finds this port's live queues, logs each one as "still
> alive?", and shuts it down by FQID. The
> qman_shutdown_fq() loop that follows then only sees FQs that are already OOS.
> Shut down rx_queues[]/tx_queues[] first, then scan, so the scan only reports FQs
> left by a previous run.
>


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

* Re: [PATCH v3 0/4] DPAA driver changes
  2026-11-03  9:35   ` [PATCH v3 " Gagandeep Singh
                       ` (3 preceding siblings ...)
  2026-11-03  9:36     ` [PATCH v3 4/4] drivers: add DPAA cgrid cleanup support Gagandeep Singh
@ 2026-11-04 11:29     ` Stephen Hemminger
  2026-11-05  5:53       ` Gagandeep Singh
  2026-11-16  6:25     ` [PATCH v4 " Gagandeep Singh
  5 siblings, 1 reply; 33+ messages in thread
From: Stephen Hemminger @ 2026-11-04 11:29 UTC (permalink / raw)
  To: Gagandeep Singh; +Cc: dev, hemant.agrawal

On Tue,  3 Nov 2026 15:05:57 +0530
Gagandeep Singh <g.singh@nxp.com> wrote:

> V3-Changes:
>  - Updated rte_pmd_dpaa_oldev.h APIs as per DPDK compliance.
>  - Added missing release not for OH port support.
>  - Fixed dump_netcfg issue.
>  - Added an API to release FQID.
>  - moved the fman.h changes to first patch.
>  
> V2-changes:
>  - Fixed most of the AI comments.
>  - added new patch:
>    fix out-of-bounds read of mac_idx
>  - removed drv_oldev, updated comments and notes.
>  - fixes FQ shutdown
>  - removed unwanted checks, updated open, updated snprintf.
>  - updated commit messages.
> 
> V1:
>  - Adding OH port support.
>  - Updates in shared ethernet code.
>  - Congestion related code cleanup.
> 
> Gagandeep Singh (2):
>   bus/dpaa: fix out-of-bounds read of mac_idx array
>   drivers: add offline (O/H) port device support
> 
> Hemant Agrawal (1):
>   net/dpaa: support non fmX-macY type of shared Ethernet name
> 
> Jun Yang (1):
>   drivers: add DPAA cgrid cleanup support
> 
>  doc/api/doxy-api-index.md                |   1 +
>  doc/guides/nics/dpaa.rst                 |  36 +
>  doc/guides/rel_notes/release_26_11.rst   |  10 +
>  drivers/bus/dpaa/base/fman/fman.c        |  19 +
>  drivers/bus/dpaa/base/qbman/qman.c       |  61 ++
>  drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
>  drivers/bus/dpaa/dpaa_bus.c              |  68 +-
>  drivers/bus/dpaa/dpaa_bus_base_symbols.c |   2 +
>  drivers/bus/dpaa/include/fman.h          |   6 +-
>  drivers/bus/dpaa/include/fsl_qman.h      |  28 +
>  drivers/net/dpaa/dpaa_ethdev.c           | 235 +++++-
>  drivers/net/dpaa/dpaa_ethdev.h           |  12 +
>  drivers/net/dpaa/dpaa_flow.c             |   5 +-
>  drivers/net/dpaa/dpaa_oldev.c            | 938 +++++++++++++++++++++++
>  drivers/net/dpaa/meson.build             |  11 +-
>  drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 198 +++++
>  16 files changed, 1603 insertions(+), 31 deletions(-)
>  create mode 100644 drivers/net/dpaa/dpaa_oldev.c
>  create mode 100644 drivers/net/dpaa/rte_pmd_dpaa_oldev.h
> 

Still see AI reported errors

Review of [PATCH v3 0/4] DPAA offline port, shared MAC, cgrid cleanup

Applied to next-net for-main (3b51e2e2f0). Each commit builds with
-Dwerror=true.

Series
------

The rte_pmd_dpaa_ol_* functions now take a port_id, but it is only
used to look up which fd the ioctl goes to. The classification and LGW
payloads carry nothing from the port, and the kernel module consumes
them. My earlier objection stands: this is configuration API for the
out-of-tree cdx driver and does not belong in DPDK.


Patch 2/4 drivers: add offline (O/H) port device support
--------------------------------------------------------

Error

dpaa_oldev_init() opens /dev/cdx_ctrl through check_fd() in
dpaa_ol_tx_queue_init(). If a later step fails, for example the
mac_addrs allocation, the free_rx path does not close the fd:

	free_rx:
		dpaa_oldev_queues_release(dpaa_intf);
		return ret;

dpaa_ol_probe() then calls rte_eth_dev_release_port(), which frees
dev_private and ol_fd with it. Close it on the error path:

	free_rx:
		dpaa_oldev_queues_release(dpaa_intf);
		if (dpaa_intf->ol_fd >= 0) {
			close(dpaa_intf->ol_fd);
			dpaa_intf->ol_fd = -1;
		}
		return ret;

Warning

dpaa_oldev_queues_release() sends ASK_CTRL_RESET_DPDK_INFO and releases
the FQIDs only if that succeeds. It does this even when
ASK_CTRL_SET_DPDK_INFO was never issued: on the probe error path, and
on close of a port that was never started. In those cases the kernel
never had the FQIDs, so there is nothing to reset. If /dev/cdx_ctrl is
missing, probe fails in dpaa_ol_tx_queue_init(), the reset fails with
-ENODEV, and the Rx FQID allocated with QMAN_FQ_FLAG_DYNAMIC_FQID
leaks on every attempt. Track whether the kernel holds the FQIDs:

	/* dpaa_ol_set_fq_info(), after ask_set_fq_info() succeeds */
	dpaa_intf->ol_fq_info_set = true;

	/* dpaa_oldev_queues_release() */
	release_fqids = true;
	if (dpaa_intf->ol_fq_info_set) {
		if (ask_reset_fq_info(dpaa_intf, &fq_info) != 0)
			release_fqids = false;
		else
			dpaa_intf->ol_fq_info_set = false;
	}

Info

v3 replaced the atomic ask_fd with a plain dpaa_intf->ol_fd, but kept
the double-checked lock in check_fd(). The unlocked read of ol_fd now
races with the locked write if control calls can be concurrent. If they
cannot, the mutex is not needed. The fd is always opened during probe
by dpaa_ol_tx_queue_init(), so open it once in dpaa_oldev_init() and
drop fd_init_lock and the lazy open.

dpaa_ol_set_fq_info() copies bh_port_name with rte_memcpy(); this is
control path, use memcpy().

The blank line added after "/* Rx Statistics Counter */" in struct
dpaa_if_stats is unrelated.

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

* RE: [PATCH v3 0/4] DPAA driver changes
  2026-11-04 11:29     ` [PATCH v3 0/4] DPAA driver changes Stephen Hemminger
@ 2026-11-05  5:53       ` Gagandeep Singh
  0 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-05  5:53 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev@dpdk.org, Hemant Agrawal

Hi


NXP Confidential
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Wednesday, November 4, 2026 4:59 PM
> To: Gagandeep Singh <G.Singh@nxp.com>
> Cc: dev@dpdk.org; Hemant Agrawal <hemant.agrawal@nxp.com>
> Subject: Re: [PATCH v3 0/4] DPAA driver changes
>
> On Tue,  3 Nov 2026 15:05:57 +0530
> Gagandeep Singh <g.singh@nxp.com> wrote:
>
> > V3-Changes:
> >  - Updated rte_pmd_dpaa_oldev.h APIs as per DPDK compliance.
> >  - Added missing release not for OH port support.
> >  - Fixed dump_netcfg issue.
> >  - Added an API to release FQID.
> >  - moved the fman.h changes to first patch.
> >
> > V2-changes:
> >  - Fixed most of the AI comments.
> >  - added new patch:
> >    fix out-of-bounds read of mac_idx
> >  - removed drv_oldev, updated comments and notes.
> >  - fixes FQ shutdown
> >  - removed unwanted checks, updated open, updated snprintf.
> >  - updated commit messages.
> >
> > V1:
> >  - Adding OH port support.
> >  - Updates in shared ethernet code.
> >  - Congestion related code cleanup.
> >
> > Gagandeep Singh (2):
> >   bus/dpaa: fix out-of-bounds read of mac_idx array
> >   drivers: add offline (O/H) port device support
> >
> > Hemant Agrawal (1):
> >   net/dpaa: support non fmX-macY type of shared Ethernet name
> >
> > Jun Yang (1):
> >   drivers: add DPAA cgrid cleanup support
> >
> >  doc/api/doxy-api-index.md                |   1 +
> >  doc/guides/nics/dpaa.rst                 |  36 +
> >  doc/guides/rel_notes/release_26_11.rst   |  10 +
> >  drivers/bus/dpaa/base/fman/fman.c        |  19 +
> >  drivers/bus/dpaa/base/qbman/qman.c       |  61 ++
> >  drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
> >  drivers/bus/dpaa/dpaa_bus.c              |  68 +-
> >  drivers/bus/dpaa/dpaa_bus_base_symbols.c |   2 +
> >  drivers/bus/dpaa/include/fman.h          |   6 +-
> >  drivers/bus/dpaa/include/fsl_qman.h      |  28 +
> >  drivers/net/dpaa/dpaa_ethdev.c           | 235 +++++-
> >  drivers/net/dpaa/dpaa_ethdev.h           |  12 +
> >  drivers/net/dpaa/dpaa_flow.c             |   5 +-
> >  drivers/net/dpaa/dpaa_oldev.c            | 938 +++++++++++++++++++++++
> >  drivers/net/dpaa/meson.build             |  11 +-
> >  drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 198 +++++
> >  16 files changed, 1603 insertions(+), 31 deletions(-)  create mode
> > 100644 drivers/net/dpaa/dpaa_oldev.c  create mode 100644
> > drivers/net/dpaa/rte_pmd_dpaa_oldev.h
> >
>
> Still see AI reported errors
>
> Review of [PATCH v3 0/4] DPAA offline port, shared MAC, cgrid cleanup
>
> Applied to next-net for-main (3b51e2e2f0). Each commit builds with -
> Dwerror=true.
>
> Series
> ------
>
> The rte_pmd_dpaa_ol_* functions now take a port_id, but it is only used to look
> up which fd the ioctl goes to. The classification and LGW payloads carry nothing
> from the port, and the kernel module consumes them. My earlier objection
> stands: this is configuration API for the out-of-tree cdx driver and does not belong
> in DPDK.
>
you're right that the new APIs don't interpret or act on their payloads in DPDK —
the structs are serialized and handed to the ASK/CDX kernel driver via ioctl,
and all the real logic (uplink classification, LGW subnet programming) lives in that out-of-tree module.
No argument there.

The reason we think this still belongs with the offline-port driver rather than being left
 entirely to the application is the "fd" and lifetime binding, not the payload semantics:

- The ioctl must go out on `dpaa_if::ol_fd`, which is private port state opened on first use and
closed in `dev_close()`. There is no public DPDK handle to that fd today, and we don't want to add one —
that would mean exposing a raw file descriptor as public API, which is worse than what we have.
- If this configuration path is pushed out of DPDK, the application needs its own separate way to
resolve "which `/dev/cdx_ctrl` instance backhaul port corresponds to this `oldev1` port", duplicating
the resolution `dpaa_ol_get_bh_port_name()` already does at probe time. That logic only exists on the DPDK side.

>
> Patch 2/4 drivers: add offline (O/H) port device support
> --------------------------------------------------------
>
> Error
>
> dpaa_oldev_init() opens /dev/cdx_ctrl through check_fd() in
> dpaa_ol_tx_queue_init(). If a later step fails, for example the mac_addrs
> allocation, the free_rx path does not close the fd:
>
>       free_rx:
>               dpaa_oldev_queues_release(dpaa_intf);
>               return ret;
>
> dpaa_ol_probe() then calls rte_eth_dev_release_port(), which frees dev_private
> and ol_fd with it. Close it on the error path:
>
>       free_rx:
>               dpaa_oldev_queues_release(dpaa_intf);
>               if (dpaa_intf->ol_fd >= 0) {
>                       close(dpaa_intf->ol_fd);
>                       dpaa_intf->ol_fd = -1;
>               }
>               return ret;
>
> Warning
>
> dpaa_oldev_queues_release() sends ASK_CTRL_RESET_DPDK_INFO and releases
> the FQIDs only if that succeeds. It does this even when
> ASK_CTRL_SET_DPDK_INFO was never issued: on the probe error path, and on
> close of a port that was never started. In those cases the kernel never had the
> FQIDs, so there is nothing to reset. If /dev/cdx_ctrl is missing, probe fails in
> dpaa_ol_tx_queue_init(), the reset fails with -ENODEV, and the Rx FQID allocated
> with QMAN_FQ_FLAG_DYNAMIC_FQID leaks on every attempt. Track whether
> the kernel holds the FQIDs:
>
>       /* dpaa_ol_set_fq_info(), after ask_set_fq_info() succeeds */
>       dpaa_intf->ol_fq_info_set = true;
>
>       /* dpaa_oldev_queues_release() */
>       release_fqids = true;
>       if (dpaa_intf->ol_fq_info_set) {
>               if (ask_reset_fq_info(dpaa_intf, &fq_info) != 0)
>                       release_fqids = false;
>               else
>                       dpaa_intf->ol_fq_info_set = false;
>       }
>
> Info
>
> v3 replaced the atomic ask_fd with a plain dpaa_intf->ol_fd, but kept the double-
> checked lock in check_fd(). The unlocked read of ol_fd now races with the locked
> write if control calls can be concurrent. If they cannot, the mutex is not needed.
> The fd is always opened during probe by dpaa_ol_tx_queue_init(), so open it once
> in dpaa_oldev_init() and drop fd_init_lock and the lazy open.
>
> dpaa_ol_set_fq_info() copies bh_port_name with rte_memcpy(); this is control
> path, use memcpy().
>
> The blank line added after "/* Rx Statistics Counter */" in struct dpaa_if_stats is
> unrelated.

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

* [PATCH v4 0/4] DPAA driver changes
  2026-11-03  9:35   ` [PATCH v3 " Gagandeep Singh
                       ` (4 preceding siblings ...)
  2026-11-04 11:29     ` [PATCH v3 0/4] DPAA driver changes Stephen Hemminger
@ 2026-11-16  6:25     ` Gagandeep Singh
  2026-11-16  6:25       ` [PATCH v4 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
                         ` (5 more replies)
  5 siblings, 6 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-16  6:25 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal

V4-Changes:
 - Fixed ol_fd leak issue.
 - Fixed the FQID hold be kernel issue.
 - removed the not required locks.
 - fixed unwanted line and memcpy issue.
 - We want to have rte_pmd_dpaa_ol_* functions, the reason we sent over
   the email.

V3-Changes:
 - Updated rte_pmd_dpaa_oldev.h APIs as per DPDK compliance.
 - Added missing release not for OH port support.
 - Fixed dump_netcfg issue.
 - Added an API to release FQID.
 - moved the fman.h changes to first patch.

V2-changes:
 - Fixed most of the AI comments.
 - added new patch:
   fix out-of-bounds read of mac_idx
 - removed drv_oldev, updated comments and notes.
 - fixes FQ shutdown
 - removed unwanted checks, updated open, updated snprintf.
 - updated commit messages.

V1:
 - Adding OH port support.
 - Updates in shared ethernet code.
 - Congestion related code cleanup.

Gagandeep Singh (2):
  bus/dpaa: fix out-of-bounds read of mac_idx array
  drivers: add offline (O/H) port device support

Hemant Agrawal (1):
  net/dpaa: support non fmX-macY type of shared Ethernet name

Jun Yang (1):
  drivers: add DPAA cgrid cleanup support

 doc/api/doxy-api-index.md                |   1 +
 doc/guides/nics/dpaa.rst                 |  36 +
 doc/guides/rel_notes/release_26_11.rst   |  10 +
 drivers/bus/dpaa/base/fman/fman.c        |  19 +
 drivers/bus/dpaa/base/qbman/qman.c       |  61 ++
 drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
 drivers/bus/dpaa/dpaa_bus.c              |  68 +-
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   2 +
 drivers/bus/dpaa/include/fman.h          |   6 +-
 drivers/bus/dpaa/include/fsl_qman.h      |  28 +
 drivers/net/dpaa/dpaa_ethdev.c           | 235 +++++-
 drivers/net/dpaa/dpaa_ethdev.h           |  12 +
 drivers/net/dpaa/dpaa_flow.c             |   5 +-
 drivers/net/dpaa/dpaa_oldev.c            | 936 +++++++++++++++++++++++
 drivers/net/dpaa/meson.build             |  11 +-
 drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 198 +++++
 16 files changed, 1601 insertions(+), 31 deletions(-)
 create mode 100644 drivers/net/dpaa/dpaa_oldev.c
 create mode 100644 drivers/net/dpaa/rte_pmd_dpaa_oldev.h

-- 
2.25.1


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

* [PATCH v4 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array
  2026-11-16  6:25     ` [PATCH v4 " Gagandeep Singh
@ 2026-11-16  6:25       ` Gagandeep Singh
  2026-11-16  6:25       ` [PATCH v4 2/4] drivers: add offline (O/H) port device support Gagandeep Singh
                         ` (4 subsequent siblings)
  5 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-16  6:25 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, stable, Gagandeep Singh

fman_if_init() and fman_if_init_onic() read the devicetree
'cell-index' property and store it unchecked into
__if->__if.mac_idx. This value is later used as an index into the
fixed-size mac_idx[] lookup table in fman_if_vsp_init(), so a
cell-index value greater than or equal to the number of entries in
that table results in an out-of-bounds read.

Add an explicit upper-bound check (FMAN_MAX_MAC_IDX_NUM) in both
fman_if_init() and fman_if_init_onic() before the mac_idx assignment,
and a static_assert in fman_if_vsp_init() to keep mac_idx[] in sync
with FMAN_MAX_MAC_IDX_NUM if it is ever resized.

Also remove the unused MEMMAC_REG_OFFSET() macro from fman.h, which
had no remaining callers.

Fixes: a0edbb8a8e52 ("bus/dpaa: add OH port mode")
Fixes: 7e5f49ae767d ("bus/dpaa: add ONIC port mode")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/bus/dpaa/base/fman/fman.c | 19 +++++++++++++++++++
 drivers/bus/dpaa/include/fman.h   |  6 +++++-
 drivers/net/dpaa/dpaa_flow.c      |  5 ++++-
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index 67f77265ca..223cd6958d 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -205,6 +205,9 @@ static void fman_if_vsp_init(struct __fman_if *__if)
 	size_t lenp;
 	const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1};
 
+	static_assert(RTE_DIM(mac_idx) == FMAN_MAX_MAC_IDX_NUM,
+		      "mac_idx[] out of sync with FMAN_MAX_MAC_IDX_NUM");
+
 	if (__if->__if.mac_idx <= 8) {
 		for_each_compatible_node(dev, NULL,
 			"fsl,fman-port-1g-rx-extended-args") {
@@ -544,6 +547,14 @@ fman_if_init(const struct device_node *dpa_node, int fd)
 		cell_idx_host = of_read_number(cell_idx,
 					       lenp / sizeof(phandle));
 
+		if (cell_idx_host >= FMAN_MAX_MAC_IDX_NUM) {
+			FMAN_ERR(-EINVAL,
+				 "%s: cell-index(%" PRIu64 ") >= max(%d)",
+				 oh_node->full_name, cell_idx_host,
+				 FMAN_MAX_MAC_IDX_NUM);
+			goto err;
+		}
+
 		__if->__if.mac_idx = cell_idx_host;
 	}
 
@@ -957,6 +968,14 @@ static int fman_if_init_onic(const struct device_node *dpa_node)
 	assert(lenp == sizeof(*cell_idx));
 
 	cell_idx_host = of_read_number(cell_idx, lenp / sizeof(phandle));
+
+	if (cell_idx_host >= FMAN_MAX_MAC_IDX_NUM) {
+		FMAN_ERR(-EINVAL, "%s: cell-index(%" PRIu64 ") >= max(%d)",
+			 tx_oh_node->full_name, cell_idx_host,
+			 FMAN_MAX_MAC_IDX_NUM);
+		goto err;
+	}
+
 	__if->__if.mac_idx = cell_idx_host;
 
 	fman_node = of_get_parent(fman_tx_oh_node);
diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h
index f642faf3b3..030c85c284 100644
--- a/drivers/bus/dpaa/include/fman.h
+++ b/drivers/bus/dpaa/include/fman.h
@@ -68,6 +68,11 @@
 #define FMAN_RTC_MAX_NUM_OF_PERIODIC_PULSES	4
 #define FMAN_RTC_MAX_NUM_OF_EXT_TRIGGERS	3
 
+/*
+ * Maximum number of MAC/offline port indexes.
+ */
+#define FMAN_MAX_MAC_IDX_NUM	11
+
 /* Represents the different flavour of network interface */
 enum fman_mac_type {
 	fman_offline_internal = 0,
@@ -475,7 +480,6 @@ struct __fman_if {
 	void *qmi_map;
 };
 
-#define MEMMAC_REG_OFFSET(reg) offsetof(struct memac_regs, reg)
 #define BMI_RX_REG_OFFSET(reg) offsetof(struct rx_bmi_regs, reg)
 #define BMI_TX_REG_OFFSET(reg) offsetof(struct tx_bmi_regs, reg)
 
diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c
index f77f9f333b..403e97ed2d 100644
--- a/drivers/net/dpaa/dpaa_flow.c
+++ b/drivers/net/dpaa/dpaa_flow.c
@@ -32,9 +32,12 @@ return &scheme_params->param.key_ext_and_hash.extract_array[hdr_idx];
 	SCH_EXT_HDR(scheme_params, hdr_idx).extract_by_hdr_type.full_field
 
 /* FMAN mac indexes mappings (0 is unused, first 8 are for 1G, next for 10G
- * ports).
+ * ports). Indexed by fman_if.mac_idx, which the bus validates against
+ * FMAN_MAX_MAC_IDX_NUM when deriving it from the device tree.
  */
 static const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1};
+static_assert(RTE_DIM(mac_idx) == FMAN_MAX_MAC_IDX_NUM,
+	"mac_idx[] out of sync with FMAN_MAX_MAC_IDX_NUM");
 
 /* FM global info */
 struct dpaa_fm_info {
-- 
2.25.1


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

* [PATCH v4 2/4] drivers: add offline (O/H) port device support
  2026-11-16  6:25     ` [PATCH v4 " Gagandeep Singh
  2026-11-16  6:25       ` [PATCH v4 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
@ 2026-11-16  6:25       ` Gagandeep Singh
  2026-11-16  6:25       ` [PATCH v4 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
                         ` (3 subsequent siblings)
  5 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-16  6:25 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, Gagandeep Singh

Add support for the DPAA Offline/Host-command (O/H) port, allowing a
single OL port to be used by a DPDK application. The port is created
by passing "-a dpaa_bus:oldev1" (plus any devargs) on the EAL command
line, and the associated back-half port is named through the
'drv_bh_port' device argument.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/api/doxy-api-index.md                |   1 +
 doc/guides/nics/dpaa.rst                 |  32 +
 doc/guides/rel_notes/release_26_11.rst   |  10 +
 drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
 drivers/bus/dpaa/dpaa_bus.c              |  68 +-
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   1 +
 drivers/bus/dpaa/include/fsl_qman.h      |   1 +
 drivers/net/dpaa/dpaa_ethdev.h           |  12 +
 drivers/net/dpaa/dpaa_oldev.c            | 936 +++++++++++++++++++++++
 drivers/net/dpaa/meson.build             |  11 +-
 drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 198 +++++
 11 files changed, 1258 insertions(+), 16 deletions(-)
 create mode 100644 drivers/net/dpaa/dpaa_oldev.c
 create mode 100644 drivers/net/dpaa/rte_pmd_dpaa_oldev.h

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 62390f7be3..0bd8e1bbf0 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -53,6 +53,7 @@ The public API headers are grouped by topics:
   [cnxk_eventdev](@ref rte_pmd_cnxk_eventdev.h),
   [cnxk_mempool](@ref rte_pmd_cnxk_mempool.h),
   [dpaa](@ref rte_pmd_dpaa.h),
+  [dpaa_oldev](@ref rte_pmd_dpaa_oldev.h),
   [dpaa2](@ref rte_pmd_dpaa2.h),
   [mlx5](@ref rte_pmd_mlx5.h),
   [dpaa2_mempool](@ref rte_dpaa2_mempool.h),
diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst
index c6aab46828..7658e6d454 100644
--- a/doc/guides/nics/dpaa.rst
+++ b/doc/guides/nics/dpaa.rst
@@ -276,6 +276,38 @@ Refer to the document :doc:`build_and_test` for details.
   and thus disabling hardware based packet handling at driver level,
   e.g. ``dpaa:fm1-mac3,recv_err_pkts=1``.
 
+``drv_bh_port``
+   Name of the back-half port associated with an offline (O/H) port device.
+   It is passed on the offline port device itself, which is named
+   ``oldev1``, e.g. ``-a dpaa_bus:oldev1,drv_bh_port=fm1-mac5``.
+
+The DPAA offline (O/H) port device is only created, and therefore only
+probed, when it is explicitly named on the EAL ``-a`` command line, e.g.::
+
+   -a dpaa_bus:oldev1,drv_bh_port=fm1-mac5
+
+Passing any ``-a`` argument for the DPAA bus switches the bus to allowlist
+scan mode, so from that point on only the devices named with ``-a`` are
+probed. Using the offline port therefore requires listing the offline port
+itself and every Ethernet port the application needs, for example::
+
+   -a dpaa_bus:oldev1,drv_bh_port=fm1-mac5 \
+   -a dpaa_bus:fm1-mac5 -a dpaa_bus:fm1-mac6
+
+Omitting an ``fmX-macY`` port in that case silently drops that port.
+
+The offline port requires the ``/dev/cdx_ctrl`` kernel control device to be
+present; it is provided by the NXP vendor ``cdx`` kernel driver, which is
+not part of this DPDK driver and must be obtained and loaded separately
+(see the NXP LSDK release matching the DPAA SoC family). The uplink
+classification and local-gateway (LGW) configuration exposed through that
+control device can be programmed by the application, for the offline
+port identified by its ``port_id``, via the experimental
+``rte_pmd_dpaa_ol_set_classif_info()``, ``rte_pmd_dpaa_ol_reset_classif_info()``,
+``rte_pmd_dpaa_ol_set_lgw_info()`` and ``rte_pmd_dpaa_ol_reset_lgw_info()``
+APIs declared in ``rte_pmd_dpaa_oldev.h``.
+
+
 FMAN Config
 -----------
 
diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
index e2b524ac0e..6c8ce83ce1 100644
--- a/doc/guides/rel_notes/release_26_11.rst
+++ b/doc/guides/rel_notes/release_26_11.rst
@@ -210,6 +210,16 @@ New Features
   * Increased the maximum number of secondary unicast MAC addresses from 128 to up to 4096
     (depending on devlink configuration on the associated kernel netdevice).
 
+* **Added NXP DPAA offline (O/H) port support.**
+
+  Added a DPAA offline (O/H) port type that loops Rx/Tx frame queues through
+  the FMAN and exposes them as a DPDK port, with uplink classification and
+  LGW subnet configuration forwarded to the ASK/CDX kernel module via the
+  experimental ``rte_pmd_dpaa_ol_set_classif_info()``,
+  ``rte_pmd_dpaa_ol_reset_classif_info()``, ``rte_pmd_dpaa_ol_set_lgw_info()``
+  and ``rte_pmd_dpaa_ol_reset_lgw_info()`` APIs declared in
+  ``rte_pmd_dpaa_oldev.h``.
+
 * **Updated NXP DPAA drivers.**
 
   * Changed the default number of Rx queues in FMCLESS mode
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index 4aed83f84d..323a6a7659 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -69,11 +69,13 @@ struct rte_dpaa_driver;
 enum rte_dpaa_type {
 	FSL_DPAA_ETH = 1,
 	FSL_DPAA_CRYPTO,
-	FSL_DPAA_QDMA
+	FSL_DPAA_QDMA,
+	FSL_DPAA_OL
 };
 
 struct dpaa_device_id {
 	uint8_t fman_id; /**< Fman interface ID, for ETH type device */
+	uint8_t ol_id;	/**< OH interface ID, for OH type device */
 	uint8_t mac_id; /**< Fman MAC interface ID, for ETH type device */
 	uint16_t dev_id; /**< Device Identifier from DPDK */
 };
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index cbbeb927fe..5c42d80d7f 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -34,6 +34,8 @@
 #include <bus_driver.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
+#include <rte_kvargs.h>
+#include <rte_devargs.h>
 
 #include <dpaa_of.h>
 #include <bus_dpaa_driver.h>
@@ -68,6 +70,12 @@ struct rte_dpaa_bus_private {
 	RTE_ATOMIC(uint16_t) push_rxq_num;
 };
 
+/* Name of the single offline (O/H) port device. The device is only
+ * created, and thus only probed, if the application explicitly lists it
+ * with "-a dpaa_bus:oldev1" (or an equivalent devargs form).
+ */
+#define DPAA_OLDEV_NAME	"oldev1"
+
 static struct rte_bus rte_dpaa_bus;
 static struct rte_dpaa_bus_private dpaa_bus;
 static struct netcfg_info *dpaa_netcfg;
@@ -205,8 +213,44 @@ dpaa_create_device_list(void)
 	struct fm_eth_port_cfg *cfg;
 	struct fman_if *fman_intf;
 
+	struct rte_devargs *oldev_devargs;
+
 	dpaa_bus.device_count = 0;
 
+	/* The offline port is only created if the application explicitly
+	 * asked for it with "-a dpaa_bus:oldev1" (plus any devargs), e.g.
+	 * when the device is created without a backing devargs entry it
+	 * would never be probed, so avoid creating it at all.
+	 */
+	oldev_devargs = rte_bus_find_devargs(&rte_dpaa_bus, DPAA_OLDEV_NAME);
+
+	if (!dpaa_netcfg && !oldev_devargs)
+		return 0;
+
+	/* Creating OL Device */
+	if (oldev_devargs) {
+		dev = calloc(1, sizeof(struct rte_dpaa_device));
+		if (!dev) {
+			DPAA_BUS_ERR("Failed to allocate OL devices");
+			return -ENOMEM;
+		}
+
+		dev->device_type = FSL_DPAA_OL;
+		dev->id.ol_id = 0;
+		dev->id.dev_id = dpaa_bus.device_count;
+
+		/* Create device name */
+		snprintf(dev->name, RTE_ETH_NAME_MAX_LEN, "oldev%d",
+			 (dev->id.ol_id + 1));
+		DPAA_BUS_INFO("%s oldev added", dev->name);
+		dev->device.name = dev->name;
+		dev->device.devargs = oldev_devargs;
+		DPAA_BUS_INFO("**Devargs matched %s", dev->name);
+
+		dpaa_add_to_device_list(dev);
+		dpaa_bus.device_count++;
+	}
+
 	/* Creating Ethernet Devices */
 	for (i = 0; dpaa_netcfg && (i < dpaa_netcfg->num_ethports); i++) {
 		dev = calloc(1, sizeof(struct rte_dpaa_device));
@@ -276,8 +320,7 @@ dpaa_create_device_list(void)
 		 * crypto PMD, using RTE_ETH_NAME_MAX_LEN as that is the size
 		 * allocated for dev->name/
 		 */
-		memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN);
-		sprintf(dev->name, "dpaa_sec-%d", i+1);
+		snprintf(dev->name, RTE_ETH_NAME_MAX_LEN, "dpaa_sec-%d", i + 1);
 		DPAA_BUS_INFO("%s cryptodev added", dev->name);
 		dev->device.name = dev->name;
 		dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus, dev->name);
@@ -302,8 +345,7 @@ dpaa_create_device_list(void)
 		dev->device_type = FSL_DPAA_QDMA;
 		dev->id.dev_id = dpaa_bus.device_count + i;
 
-		memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN);
-		sprintf(dev->name, "dpaa_qdma-%d", i+1);
+		snprintf(dev->name, RTE_ETH_NAME_MAX_LEN, "dpaa_qdma-%d", i + 1);
 		DPAA_BUS_INFO("%s qdma device added", dev->name);
 		dev->device.name = dev->name;
 		dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus, dev->name);
@@ -482,7 +524,7 @@ rte_dpaa_bus_parse(const char *name, void *out)
 	}
 
 	/* dev_delta points to the dev name (mac/oh/onic). Not valid for
-	 * dpaa_sec.
+	 * dpaa_sec and oldev.
 	 */
 	dev_delta = delta + sizeof("fm.-") - 1;
 
@@ -496,6 +538,10 @@ rte_dpaa_bus_parse(const char *name, void *out)
 				i < 1 || i > RTE_DPAA_QDMA_DEVICES)
 			return -EINVAL;
 		max_name_len = sizeof("dpaa_qdma-.") - 1;
+	} else if (strncmp("oldev", &name[delta], 5) == 0) {
+		if (sscanf(&name[delta], "oldev%u", &i) != 1 || i != 1)
+			return -EINVAL;
+		max_name_len = sizeof("oldev.") - 1;
 	} else if (strncmp("oh", &name[dev_delta], 2) == 0) {
 		if (sscanf(&name[delta], "fm%u-oh%u", &i, &j) != 2 ||
 				i >= 2 || j >= 16)
@@ -593,7 +639,8 @@ rte_dpaa_bus_dev_build(void)
 
 	/* Get the interface configurations from device-tree */
 	dpaa_netcfg = netcfg_acquire();
-	if (!dpaa_netcfg) {
+	if (!dpaa_netcfg &&
+	    !rte_bus_find_devargs(&rte_dpaa_bus, DPAA_OLDEV_NAME)) {
 		DPAA_BUS_ERR("netcfg failed: /dev/fsl_usdpaa device not available");
 		DPAA_BUS_WARN("Check if you are using USDPAA based device tree");
 		return -EINVAL;
@@ -601,17 +648,18 @@ rte_dpaa_bus_dev_build(void)
 
 	DPAA_BUS_NOTICE("DPAA Bus Detected");
 
-	if (!dpaa_netcfg->num_ethports) {
+	if (dpaa_netcfg && !dpaa_netcfg->num_ethports) {
 		DPAA_BUS_INFO("NO DPDK mapped net interfaces available");
 		/* This is not an error */
 	}
 
+	if (dpaa_netcfg) {
 #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
-	dump_netcfg(dpaa_netcfg, stdout);
+		dump_netcfg(dpaa_netcfg, stdout);
 #endif
-
-	DPAA_BUS_DEBUG("Number of ethernet devices = %d",
+		DPAA_BUS_DEBUG("Number of ethernet devices = %d",
 			     dpaa_netcfg->num_ethports);
+	}
 	ret = dpaa_create_device_list();
 	if (ret) {
 		DPAA_BUS_ERR("Unable to create device list. (%d)", ret);
diff --git a/drivers/bus/dpaa/dpaa_bus_base_symbols.c b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
index 0927e5fe2c..aaa9f9bec2 100644
--- a/drivers/bus/dpaa/dpaa_bus_base_symbols.c
+++ b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
@@ -52,6 +52,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(bman_acquire)
 RTE_EXPORT_INTERNAL_SYMBOL(bman_query_free_buffers)
 RTE_EXPORT_INTERNAL_SYMBOL(bman_thread_irq)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_fqid_range)
+RTE_EXPORT_INTERNAL_SYMBOL(qman_release_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_reserve_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_pool_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_cgrid_range)
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index 59b41e17f0..b2674ce5d0 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1895,6 +1895,7 @@ static inline int qman_alloc_fqid(u32 *result)
  * This function can also be used to seed the allocator with ranges of FQIDs
  * that it can subsequently allocate from.
  */
+__rte_internal
 void qman_release_fqid_range(u32 fqid, unsigned int count);
 static inline void qman_release_fqid(u32 fqid)
 {
diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h
index 47c8e2b086..c7f9184810 100644
--- a/drivers/net/dpaa/dpaa_ethdev.h
+++ b/drivers/net/dpaa/dpaa_ethdev.h
@@ -114,6 +114,10 @@ enum {
 
 #define DPAA_DEFAULT_RXQ_VSP_ID		1
 
+/* Device argument to name the offline (O/H) port back-half port */
+#define DRIVER_OL_BH_PORT		"drv_bh_port"
+#define DPAA_OL_MAX_BH_PORT_NAME_LEN	12
+
 #define FMC_FILE "/tmp/fmc.bin"
 
 struct dpaa_if_vsp {
@@ -173,6 +177,14 @@ struct dpaa_if {
 	struct qman_fq *next_tx_conf_queue;
 
 	struct dpaa_if_vsp vsp[DPAA_VSP_PROFILE_MAX_NUM];
+
+	/* Control device fd, used by the offline port PMD only. */
+	int ol_fd;
+	/* Backhaul port name from the drv_bh_port devarg, used by the
+	 * offline port PMD only.
+	 */
+	char ol_bh_port_name[DPAA_OL_MAX_BH_PORT_NAME_LEN];
+	bool ol_fq_info_set;
 };
 
 struct dpaa_if_stats {
diff --git a/drivers/net/dpaa/dpaa_oldev.c b/drivers/net/dpaa/dpaa_oldev.c
new file mode 100644
index 0000000000..354d040e75
--- /dev/null
+++ b/drivers/net/dpaa/dpaa_oldev.c
@@ -0,0 +1,936 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2026 NXP
+ */
+
+#include <stdio.h>
+#include <sys/ioctl.h>
+
+#include <rte_dpaa_logs.h>
+#include <rte_kvargs.h>
+
+#include <rte_string_fns.h>
+#include <bus_dpaa_driver.h>
+#include <dpaa_ethdev.h>
+#include <dpaa_rxtx.h>
+#include <dpaa_mempool.h>
+
+#include <eal_export.h>
+#include <fsl_fman.h>
+
+#include "rte_pmd_dpaa_oldev.h"
+
+/* The ol device is a tx are queue pair, which is provided to the kernel through
+ * ioctl calls. It is exposed as a virtual port to the application.
+ * This ASK Device provides IOCTL calls to driver for communicating fqid's,
+ * buffer pool id's and channel id's with kernel.
+ */
+#define ASK_PATH		"/dev/cdx_ctrl"
+#define CDX_IOC_MAGIC		0xbe
+
+/* Private area reserved by driver.
+ * Aligned with "struct annotations_t". Parse results will be written from
+ * the 17th byte by the HW.
+ */
+#define DPAA_OL_PARSERSLT_START_OFFSET 16
+#define DPAA_OL_DATA_ALIGNMENT 64
+/* Change this value to increase the data offset.
+ * final value will be aligned by DPAA_OL_DATA_ALIGNMENT
+ */
+#define DPAA_OL_MAX_EXTRA_SIZE 0
+#define DPAA_OL_PARSE_RESULT_REQUIRED true
+#define DPAA_OL_TIME_STAMP_REQUIRED false
+#define DPAA_OL_HASH_RESULT_REQUIRED false
+#define DPAA_OL_PCD_INFO_REQUIRED false
+
+/* Work queue ID used for the offline port ingress sequence classifier. */
+#define DPA_ISC_WQ_ID 2
+
+static const struct eth_dev_ops dpaa_ol_devops;
+
+struct ask_ctrl_offline_channel {
+	uint32_t channel_id;
+	uint32_t ctx_a_hi_val;	/* Setting required flags(B0,A2) while creating
+				 * frame queue.
+				 */
+	uint32_t ctx_a_lo_val;	/* EBD and VSP enable bits */
+	uint32_t ctx_b_val;	/* VSP ID */
+};
+
+struct ask_ctrl_dpdk_fq_info_s {
+	uint32_t tx_fq_id;		/* DPDK transmits GTP packets using FQ
+					 * ID
+					 */
+	uint32_t rx_fq_id;		/* DPDK receives packets from FMAN */
+	uint16_t buff_size;		/* Size of each buffer in DPDPK buffer
+					 * pool
+					 */
+	uint8_t bp_id;			/* DPDK buffer pool id */
+	/* BH port interface name; set from the mandatory drv_bh_port
+	 * devarg (see DRIVER_OL_BH_PORT).
+	 */
+	uint8_t bh_port_name[DPAA_OL_MAX_BH_PORT_NAME_LEN];
+	/* below fields are taken from structure t_FmBufferPrefixContent, These
+	 * fields are required for VSP creation on DPDK buffer pool ID. These
+	 * fields should be set based on expected parameters from FMAN
+	 */
+	uint16_t privDataSize;		/* Number of bytes to be left at the
+					 * beginning of the external buffer;
+					 * Note that the private-area will start
+					 * from the base of the buffer address.
+					 */
+	bool passPrsResult;		/* TRUE to pass the parse result to/from
+					 * the FM; User may use
+					 * FM_PORT_GetBufferPrsResult() in order
+					 * to get the parser-result from a
+					 * buffer.
+					 */
+	bool passTimeStamp;		/* < TRUE to pass the timeStamp to/from
+					 * the FM User may use
+					 * FM_PORT_GetBufferTimeStamp() in order
+					 * to get the parser-result from a
+					 * buffer.
+					 */
+	bool passHashResult;		/* TRUE to pass the KG hash result
+					 * to/from the FM User may use
+					 * FM_PORT_GetBufferHashResult() in
+					 * order to get the parser-result from a
+					 * buffer.
+					 */
+	bool passAllOtherPCDInfo;	/* Add all other Internal-Context
+					 * information: AD, hash-result, key,
+					 * etc.
+					 */
+	uint16_t dataAlign;		/* 0 to use driver's default alignment
+					 * [DEFAULT_FM_SP_bufferPrefixContent_dataAlign],
+					 * other value for selecting a data
+					 * alignment (must be a power of 2); if
+					 * write optimization is used, must be
+					 * >= 16.
+					 */
+	uint8_t manipExtraSpace;	/* Maximum extra size needed (insertion-
+					 * size minus removal-size); Note that
+					 * this field impacts the size of the
+					 * buffer-prefix (i.e. it pushes the
+					 * data offset); This field is
+					 * irrelevant if DPAA_VERSION==10
+					 */
+};
+
+#define ASK_CTRL_GET_OFFLINE_CHANNEL_INFO \
+	_IOWR(CDX_IOC_MAGIC, 8, struct ask_ctrl_offline_channel)
+#define ASK_CTRL_SET_DPDK_INFO \
+	_IOWR(CDX_IOC_MAGIC, 9, struct ask_ctrl_dpdk_fq_info_s)
+#define ASK_CTRL_SET_CLASSIF_INFO \
+	_IOWR(CDX_IOC_MAGIC, 10, struct rte_pmd_dpaa_uplink_cls_info_s)
+#define ASK_CTRL_RESET_CLASSIF_INFO \
+	_IOWR(CDX_IOC_MAGIC, 11, struct rte_pmd_dpaa_uplink_cls_info_s)
+#define ASK_CTRL_SET_LGW_INFO \
+	_IOWR(CDX_IOC_MAGIC, 12, struct rte_pmd_dpaa_lgw_info_s)
+#define ASK_CTRL_RESET_LGW_INFO \
+	_IOWR(CDX_IOC_MAGIC, 13, struct rte_pmd_dpaa_lgw_info_s)
+/* Tells the kernel the Tx/Rx FQIDs set via ASK_CTRL_SET_DPDK_INFO are
+ * being torn down.
+ */
+#define ASK_CTRL_RESET_DPDK_INFO \
+	_IOWR(CDX_IOC_MAGIC, 14, struct ask_ctrl_dpdk_fq_info_s)
+
+/* Validate port_id and return the rte_eth_dev if it belongs to this driver. */
+static struct rte_eth_dev *
+dpaa_ol_get_port(uint16_t port_id)
+{
+	struct rte_eth_dev *dev;
+
+	if (!rte_eth_dev_is_valid_port(port_id)) {
+		DPAA_PMD_ERR("Port %u is not a valid port", port_id);
+		return NULL;
+	}
+
+	dev = &rte_eth_devices[port_id];
+	if (dev->dev_ops != &dpaa_ol_devops) {
+		DPAA_PMD_ERR("Port %u is not a DPAA offline (O/H) port", port_id);
+		return NULL;
+	}
+
+	return dev;
+}
+
+static int check_fd(struct dpaa_if *dpaa_intf)
+{
+	return (dpaa_intf->ol_fd >= 0) ? dpaa_intf->ol_fd : -ENODEV;
+}
+
+static int ask_get_channel_info(struct dpaa_if *dpaa_intf,
+				 struct ask_ctrl_offline_channel *ch_info)
+{
+	int ret, fd = check_fd(dpaa_intf);
+
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_GET_OFFLINE_CHANNEL_INFO, ch_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Get channel info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Get channel info successful");
+	DPAA_PMD_DEBUG("Channel id: %x", ch_info->channel_id);
+	DPAA_PMD_DEBUG("ctx_a_hi_val: %x", ch_info->ctx_a_hi_val);
+	DPAA_PMD_DEBUG("ctx_a_lo_val: %x", ch_info->ctx_a_lo_val);
+	DPAA_PMD_DEBUG("ctx_b_val: %x", ch_info->ctx_b_val);
+
+	return 0;
+}
+
+static int ask_set_fq_info(struct dpaa_if *dpaa_intf,
+			    struct ask_ctrl_dpdk_fq_info_s *fq_info)
+{
+	int ret, fd = check_fd(dpaa_intf);
+
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_DPDK_INFO, fq_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set FQ info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set fq info successful");
+	DPAA_PMD_DEBUG("Tx fqid: %x", fq_info->tx_fq_id);
+	DPAA_PMD_DEBUG("Rx fqid: %x", fq_info->rx_fq_id);
+	DPAA_PMD_DEBUG("buff_size: %d", fq_info->buff_size);
+	DPAA_PMD_DEBUG("bp_id: %d", fq_info->bp_id);
+	DPAA_PMD_DEBUG("Backhaul port name: %s", fq_info->bh_port_name);
+
+	return 0;
+}
+
+static int ask_reset_fq_info(struct dpaa_if *dpaa_intf,
+			      struct ask_ctrl_dpdk_fq_info_s *fq_info)
+{
+	int ret, fd = check_fd(dpaa_intf);
+
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_RESET_DPDK_INFO, fq_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Reset FQ info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Reset fq info successful");
+
+	return 0;
+}
+
+static int
+dpaa_ol_dev_configure(__rte_unused struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+static int dpaa_ol_dev_info(struct rte_eth_dev *dev,
+			    struct rte_eth_dev_info *dev_info)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->max_rx_queues = dpaa_intf->nb_rx_queues;
+	dev_info->max_tx_queues = dpaa_intf->nb_tx_queues;
+	dev_info->max_rx_pktlen = DPAA_MAX_RX_PKT_LEN;
+	dev_info->max_mac_addrs = DPAA_MAX_MAC_FILTER;
+	dev_info->max_hash_mac_addrs = 0;
+	dev_info->max_vfs = 0;
+
+	dev_info->speed_capa = RTE_ETH_LINK_SPEED_10M_HD |
+			       RTE_ETH_LINK_SPEED_10M |
+			       RTE_ETH_LINK_SPEED_100M_HD |
+			       RTE_ETH_LINK_SPEED_100M |
+			       RTE_ETH_LINK_SPEED_1G |
+			       RTE_ETH_LINK_SPEED_2_5G |
+			       RTE_ETH_LINK_SPEED_10G;
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_set_classif_info, 26.11)
+int rte_pmd_dpaa_ol_set_classif_info(uint16_t port_id,
+		struct rte_pmd_dpaa_uplink_cls_info_s *classif_info)
+{
+	struct rte_eth_dev *dev;
+	struct dpaa_if *dpaa_intf;
+	int i, ret, fd;
+
+	if (classif_info == NULL) {
+		DPAA_PMD_ERR("No classification data available");
+		return -EINVAL;
+	}
+
+	dev = dpaa_ol_get_port(port_id);
+	if (dev == NULL)
+		return -ENODEV;
+	dpaa_intf = dev->data->dev_private;
+
+	fd = check_fd(dpaa_intf);
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_CLASSIF_INFO, classif_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set classification info ioctl failed with errno: %s",
+			     strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set classification info successful");
+	for (i = 0; i < classif_info->num_ports; i++) {
+		DPAA_PMD_DEBUG("UDP dest port: %d",
+			       classif_info->gtp_udp_port[i]);
+	}
+	DPAA_PMD_DEBUG("Protocol ID: %d", classif_info->gtp_proto_id);
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_reset_classif_info, 26.11)
+int rte_pmd_dpaa_ol_reset_classif_info(uint16_t port_id)
+{
+	struct rte_pmd_dpaa_uplink_cls_info_s classif_info;
+	struct rte_eth_dev *dev;
+	struct dpaa_if *dpaa_intf;
+	int ret, fd;
+
+	dev = dpaa_ol_get_port(port_id);
+	if (dev == NULL)
+		return -ENODEV;
+	dpaa_intf = dev->data->dev_private;
+
+	fd = check_fd(dpaa_intf);
+	if (fd < 0)
+		return fd;
+
+	memset(&classif_info, 0, sizeof(classif_info));
+
+	ret = ioctl(fd, ASK_CTRL_RESET_CLASSIF_INFO, &classif_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Reset classification info ioctl failed with errno: %s",
+			     strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Reset classification info successful");
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_set_lgw_info, 26.11)
+int rte_pmd_dpaa_ol_set_lgw_info(uint16_t port_id,
+		struct rte_pmd_dpaa_lgw_info_s *lgw_info)
+{
+	struct rte_eth_dev *dev;
+	struct dpaa_if *dpaa_intf;
+	int ret, fd;
+
+	if (lgw_info == NULL) {
+		DPAA_PMD_ERR("No LGW data available");
+		return -EINVAL;
+	}
+
+	dev = dpaa_ol_get_port(port_id);
+	if (dev == NULL)
+		return -ENODEV;
+	dpaa_intf = dev->data->dev_private;
+
+	fd = check_fd(dpaa_intf);
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_LGW_INFO, lgw_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set LGW info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set LGW info successful");
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_reset_lgw_info, 26.11)
+int rte_pmd_dpaa_ol_reset_lgw_info(uint16_t port_id)
+{
+	struct rte_pmd_dpaa_lgw_info_s lgw_info;
+	struct rte_eth_dev *dev;
+	struct dpaa_if *dpaa_intf;
+	int ret, fd;
+
+	PMD_INIT_FUNC_TRACE();
+
+	dev = dpaa_ol_get_port(port_id);
+	if (dev == NULL)
+		return -ENODEV;
+	dpaa_intf = dev->data->dev_private;
+
+	fd = check_fd(dpaa_intf);
+	if (fd < 0)
+		return fd;
+
+	memset(&lgw_info, 0, sizeof(lgw_info));
+
+	ret = ioctl(fd, ASK_CTRL_RESET_LGW_INFO, &lgw_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Reset LGW info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Reset LGW info successful");
+
+	return 0;
+}
+
+static int
+dpaa_ol_get_bh_port_name(struct rte_devargs *devargs, char *val, size_t size);
+
+static int dpaa_ol_set_fq_info(struct rte_eth_dev *dev);
+
+static int dpaa_ol_dev_start(struct rte_eth_dev *dev)
+{
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Done in dev_start() since Rx/Tx queue setup order is not guaranteed. */
+	ret = dpaa_ol_set_fq_info(dev);
+	if (ret)
+		return ret;
+
+	dev->tx_pkt_burst = dpaa_eth_queue_tx;
+
+	return 0;
+}
+
+static int dpaa_ol_dev_stop(struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
+
+	return 0;
+}
+
+static void dpaa_oldev_queues_release(struct dpaa_if *dpaa_intf);
+
+static int dpaa_ol_dev_close(struct rte_eth_dev *dev)
+{
+	struct dpaa_if *dpaa_intf;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	dpaa_intf = dev->data->dev_private;
+	if (!dpaa_intf)
+		return 0;
+
+	/* Shut down FQs and free queue memory. */
+	dpaa_oldev_queues_release(dpaa_intf);
+
+	if (dpaa_intf->ol_fd >= 0) {
+		close(dpaa_intf->ol_fd);
+		dpaa_intf->ol_fd = -1;
+	}
+
+	return 0;
+}
+
+static inline void
+dpaa_poll_queue_default_config(struct qm_mcc_initfq *opts)
+{
+	memset(opts, 0, sizeof(struct qm_mcc_initfq));
+	opts->we_mask = QM_INITFQ_WE_CONTEXTA;
+	opts->fqd.fq_ctrl = QM_FQCTRL_AVOIDBLOCK | QM_FQCTRL_CTXASTASHING |
+			    QM_FQCTRL_PREFERINCACHE;
+	opts->fqd.context_a.stashing.exclusive = 0;
+	if (dpaa_soc_ver() != SVR_LS1046A_FAMILY)
+		opts->fqd.context_a.stashing.annotation_cl =
+				DPAA_IF_RX_ANNOTATION_STASH;
+	opts->fqd.context_a.stashing.data_cl = DPAA_IF_RX_DATA_STASH;
+	opts->fqd.context_a.stashing.context_cl = DPAA_IF_RX_CONTEXT_STASH;
+}
+
+static
+int dpaa_ol_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
+			    __rte_unused uint16_t nb_desc,
+			    unsigned int socket_id __rte_unused,
+			    __rte_unused const struct rte_eth_rxconf *rx_conf,
+			    struct rte_mempool *mp)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct qman_fq *rxq = &dpaa_intf->rx_queues[queue_idx];
+
+	PMD_INIT_FUNC_TRACE();
+
+	dpaa_intf->bp_info = DPAA_MEMPOOL_TO_POOL_INFO(mp);
+	dpaa_intf->valid = 1;
+
+	if (!rte_dpaa_bpid_info) {
+		DPAA_PMD_ERR("BPID info array not initialized");
+		return -ENOMEM;
+	}
+	rxq->bp_array = rte_dpaa_bpid_info;
+	dev->data->rx_queues[queue_idx] = rxq;
+
+	return 0;
+}
+
+static int
+dpaa_ol_get_bh_port_name(struct rte_devargs *devargs, char *val, size_t size)
+{
+	static const char * const valid_keys[] = { DRIVER_OL_BH_PORT, NULL };
+	struct rte_kvargs *kvlist;
+	const char *str;
+	int ret;
+
+	if (!devargs || !devargs->args)
+		return 0;
+
+	kvlist = rte_kvargs_parse(devargs->args, valid_keys);
+	if (!kvlist) {
+		DPAA_PMD_ERR("Invalid devargs for offline port \"%s\"",
+			     devargs->args);
+		return -EINVAL;
+	}
+
+	if (!rte_kvargs_count(kvlist, DRIVER_OL_BH_PORT)) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	str = rte_kvargs_get(kvlist, DRIVER_OL_BH_PORT);
+	if (str == NULL) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	ret = rte_strscpy(val, str, size);
+	rte_kvargs_free(kvlist);
+	if (ret < 0)
+		return ret;
+
+	return 1;
+}
+
+static
+int dpaa_ol_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
+			   uint16_t nb_desc __rte_unused,
+			   unsigned int socket_id __rte_unused,
+			   const struct rte_eth_txconf *tx_conf __rte_unused)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct qman_fq *txq = &dpaa_intf->tx_queues[queue_idx];
+
+	PMD_INIT_FUNC_TRACE();
+
+	dev->data->tx_queues[queue_idx] = txq;
+
+	return 0;
+}
+
+static int dpaa_ol_set_fq_info(struct rte_eth_dev *dev)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct ask_ctrl_dpdk_fq_info_s fq_info;
+	struct qman_fq *txq, *rxq;
+	struct rte_pktmbuf_pool_private *mbp_priv;
+	int ret;
+
+	if (dpaa_intf->rx_queues == NULL || dpaa_intf->tx_queues == NULL) {
+		DPAA_PMD_ERR("Rx/Tx queues not allocated");
+		return -EINVAL;
+	}
+
+	if (dpaa_intf->bp_info == NULL) {
+		DPAA_PMD_ERR("Rx queue must be set up before starting the port");
+		return -EINVAL;
+	}
+
+	txq = &dpaa_intf->tx_queues[0];
+	rxq = &dpaa_intf->rx_queues[0];
+	memset(&fq_info, 0, sizeof(fq_info));
+	mbp_priv = (struct rte_pktmbuf_pool_private *)rte_mempool_get_priv(dpaa_intf->bp_info->mp);
+	fq_info.tx_fq_id = txq->fqid;
+	fq_info.rx_fq_id = rxq->fqid;
+	fq_info.buff_size = mbp_priv->mbuf_data_room_size;
+	fq_info.bp_id = dpaa_intf->bp_info->bpid;
+
+	fq_info.privDataSize = DPAA_OL_PARSERSLT_START_OFFSET;
+	fq_info.passPrsResult = DPAA_OL_PARSE_RESULT_REQUIRED;
+	fq_info.passTimeStamp = DPAA_OL_TIME_STAMP_REQUIRED;
+	fq_info.passHashResult = DPAA_OL_HASH_RESULT_REQUIRED;
+	fq_info.passAllOtherPCDInfo = DPAA_OL_PCD_INFO_REQUIRED;
+	fq_info.dataAlign = DPAA_OL_DATA_ALIGNMENT;
+	fq_info.manipExtraSpace = DPAA_OL_MAX_EXTRA_SIZE;
+
+	memcpy(fq_info.bh_port_name, dpaa_intf->ol_bh_port_name,
+	       sizeof(fq_info.bh_port_name));
+
+	ret = ask_set_fq_info(dpaa_intf, &fq_info);
+	if (ret) {
+		DPAA_PMD_ERR("Set FQ info failed with ret: %d", ret);
+		return ret;
+	}
+	dpaa_intf->ol_fq_info_set = true;
+
+	return 0;
+}
+
+static int dpaa_ol_link_update(struct rte_eth_dev *dev,
+			       __rte_unused int wait_to_complete)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct rte_eth_link *link = &dev->data->dev_link;
+
+	PMD_INIT_FUNC_TRACE();
+
+	link->link_status = dpaa_intf->valid;
+	link->link_speed = RTE_ETH_SPEED_NUM_NONE;
+	link->link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+	link->link_autoneg = RTE_ETH_LINK_AUTONEG;
+
+	return 0;
+}
+
+static int dpaa_ol_promiscuous_enable(__rte_unused struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+static int dpaa_ol_rx_queue_init(struct qman_fq *fq, uint32_t fqid)
+{
+	int ret;
+	struct qm_mcc_initfq opts = {0};
+	u32 flags = QMAN_FQ_FLAG_DYNAMIC_FQID | QMAN_FQ_FLAG_NO_ENQUEUE;
+
+	if (unlikely(!DPAA_PER_LCORE_PORTAL)) {
+		ret = rte_dpaa_portal_init(NULL);
+		if (ret < 0) {
+			DPAA_PMD_ERR("portal initialization failure");
+			return ret;
+		}
+	}
+
+	ret = qman_create_fq(fqid, flags, fq);
+	if (ret) {
+		DPAA_PMD_ERR("create rx fqid 0x%x failed with ret: %d", fqid,
+			     ret);
+		return ret;
+	}
+	fq->is_static = false;
+
+	dpaa_poll_queue_default_config(&opts);
+
+	ret = qman_init_fq(fq, 0, &opts);
+	if (ret)
+		DPAA_PMD_ERR("init rx fqid 0x%x failed with ret:%d", fqid, ret);
+	return ret;
+}
+
+static int dpaa_ol_tx_queue_init(struct dpaa_if *dpaa_intf, struct qman_fq *fq,
+				  uint32_t fqid)
+{
+	int ret;
+	struct qm_mcc_initfq opts = {0};
+	u32 flags = QMAN_FQ_FLAG_DYNAMIC_FQID | QMAN_FQ_FLAG_TO_DCPORTAL;
+	struct ask_ctrl_offline_channel ch_info;
+
+	memset(&ch_info, 0, sizeof(ch_info));
+
+	ret = ask_get_channel_info(dpaa_intf, &ch_info);
+	if (ret) {
+		DPAA_PMD_ERR("Get channel info failed with ret: %d", ret);
+		return ret;
+	}
+	ret = qman_create_fq(fqid, flags, fq);
+	if (ret) {
+		DPAA_PMD_ERR("Create tx fq failed with ret: %d", ret);
+		return ret;
+	}
+
+	opts.we_mask = QM_INITFQ_WE_DESTWQ |
+		       QM_INITFQ_WE_CONTEXTB | QM_INITFQ_WE_CONTEXTA;
+
+	opts.fqd.dest.channel = ch_info.channel_id;
+	opts.fqd.dest.wq = DPA_ISC_WQ_ID;
+	opts.fqd.fq_ctrl = QM_FQCTRL_PREFERINCACHE;
+	opts.fqd.context_b = ch_info.ctx_b_val;
+	opts.fqd.context_a.hi = ch_info.ctx_a_hi_val;
+	opts.fqd.context_a.lo = ch_info.ctx_a_lo_val;
+
+	opts.fqid = fq->fqid;
+	fq->ch_id = ch_info.channel_id;
+	opts.count = 1;
+
+	ret = qman_init_fq(fq, QMAN_INITFQ_FLAG_SCHED, &opts);
+	if (ret)
+		DPAA_PMD_ERR("init tx fqid 0x%x failed %d", fq->fqid, ret);
+	return ret;
+}
+
+static const struct eth_dev_ops dpaa_ol_devops = {
+		.dev_configure            = dpaa_ol_dev_configure,
+		.dev_start                = dpaa_ol_dev_start,
+		.dev_stop                 = dpaa_ol_dev_stop,
+		.dev_close                = dpaa_ol_dev_close,
+		.dev_infos_get            = dpaa_ol_dev_info,
+
+		.rx_queue_setup           = dpaa_ol_rx_queue_setup,
+		.tx_queue_setup           = dpaa_ol_tx_queue_setup,
+
+		.link_update              = dpaa_ol_link_update,
+		.promiscuous_enable       = dpaa_ol_promiscuous_enable,
+};
+
+static void dpaa_oldev_queues_release(struct dpaa_if *dpaa_intf)
+{
+	uint16_t i;
+	int ret, reset_ret;
+	bool release_fqids;
+	struct ask_ctrl_dpdk_fq_info_s fq_info;
+
+	/* Release FQIDs only if the kernel confirms it dropped them. */
+	release_fqids = true;
+	if (dpaa_intf->ol_fq_info_set) {
+		memset(&fq_info, 0, sizeof(fq_info));
+		if (dpaa_intf->tx_queues && dpaa_intf->nb_tx_queues)
+			fq_info.tx_fq_id = dpaa_intf->tx_queues[0].fqid;
+		if (dpaa_intf->rx_queues && dpaa_intf->nb_rx_queues)
+			fq_info.rx_fq_id = dpaa_intf->rx_queues[0].fqid;
+
+		reset_ret = ask_reset_fq_info(dpaa_intf, &fq_info);
+		if (reset_ret) {
+			DPAA_PMD_WARN("Reset FQ info failed with ret: %d, not releasing fqids",
+				      reset_ret);
+			release_fqids = false;
+		} else {
+			dpaa_intf->ol_fq_info_set = false;
+		}
+	}
+
+	if (dpaa_intf->tx_queues) {
+		for (i = 0; i < dpaa_intf->nb_tx_queues; i++) {
+			if (!dpaa_intf->tx_queues[i].fqid)
+				continue;
+			ret = qman_shutdown_fq(&dpaa_intf->tx_queues[i]);
+			if (ret) {
+				DPAA_PMD_WARN("Failed(%d) to shutdown txq%d(0x%x), fqid not released",
+					      ret, i, dpaa_intf->tx_queues[i].fqid);
+				continue;
+			}
+			if (release_fqids)
+				qman_release_fqid(dpaa_intf->tx_queues[i].fqid);
+		}
+		rte_free(dpaa_intf->tx_queues);
+		dpaa_intf->tx_queues = NULL;
+		dpaa_intf->nb_tx_queues = 0;
+	}
+
+	if (dpaa_intf->rx_queues) {
+		for (i = 0; i < dpaa_intf->nb_rx_queues; i++) {
+			if (!dpaa_intf->rx_queues[i].fqid)
+				continue;
+			ret = qman_shutdown_fq(&dpaa_intf->rx_queues[i]);
+			if (ret) {
+				DPAA_PMD_WARN("Failed(%d) to shutdown rxq%d(0x%x), fqid not released",
+					      ret, i, dpaa_intf->rx_queues[i].fqid);
+				continue;
+			}
+			if (release_fqids)
+				qman_release_fqid(dpaa_intf->rx_queues[i].fqid);
+		}
+		rte_free(dpaa_intf->rx_queues);
+		dpaa_intf->rx_queues = NULL;
+		dpaa_intf->nb_rx_queues = 0;
+	}
+}
+
+static int dpaa_oldev_init(struct rte_eth_dev *eth_dev)
+{
+	int num_fqs, ret;
+	struct dpaa_if *dpaa_intf;
+
+	PMD_INIT_FUNC_TRACE();
+
+	num_fqs = DPAA_DEFAULT_NUM_PCD_QUEUES;
+	dpaa_intf = eth_dev->data->dev_private;
+	dpaa_intf->ol_fd = open(ASK_PATH, O_RDWR | O_CLOEXEC);
+	if (dpaa_intf->ol_fd < 0) {
+		ret = -errno;
+		DPAA_PMD_ERR("Failed to open %s: %s", ASK_PATH, strerror(-ret));
+		return ret;
+	}
+
+	dpaa_intf->rx_queues = rte_zmalloc(NULL,
+					   sizeof(struct qman_fq) * num_fqs,
+					   MAX_CACHELINE);
+	if (!dpaa_intf->rx_queues) {
+		DPAA_PMD_ERR("Failed to alloc mem for RX queues");
+		ret = -ENOMEM;
+		goto free_rx;
+	}
+	dpaa_intf->nb_rx_queues = num_fqs;
+
+	ret = dpaa_ol_rx_queue_init(&dpaa_intf->rx_queues[0], 0);
+	if (ret)
+		goto free_rx;
+	dpaa_intf->rx_queues[0].dpaa_intf = dpaa_intf;
+
+	dpaa_intf->tx_queues = rte_zmalloc(NULL,
+					   sizeof(struct qman_fq) * num_fqs,
+					   MAX_CACHELINE);
+	if (!dpaa_intf->tx_queues) {
+		DPAA_PMD_ERR("Failed to alloc mem for TX queues");
+		ret = -ENOMEM;
+		goto free_rx;
+	}
+	dpaa_intf->nb_tx_queues = num_fqs;
+
+	ret = dpaa_ol_tx_queue_init(dpaa_intf, &dpaa_intf->tx_queues[0], 0);
+	if (ret)
+		goto free_rx;
+	dpaa_intf->tx_queues[0].dpaa_intf = dpaa_intf;
+
+	eth_dev->dev_ops = &dpaa_ol_devops;
+	eth_dev->rx_pkt_burst = dpaa_eth_queue_rx;
+	eth_dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
+
+	/* Allocate memory for storing MAC addresses */
+	eth_dev->data->mac_addrs = rte_zmalloc("mac_addr",
+			RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER, 0);
+	if (eth_dev->data->mac_addrs == NULL) {
+		DPAA_PMD_ERR("Failed to allocate %d bytes needed to "
+			     "store MAC addresses",
+			     RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER);
+		ret = -ENOMEM;
+		goto free_rx;
+	}
+
+	return 0;
+
+free_rx:
+	dpaa_oldev_queues_release(dpaa_intf);
+	if (dpaa_intf->ol_fd >= 0) {
+		close(dpaa_intf->ol_fd);
+		dpaa_intf->ol_fd = -1;
+	}
+	return ret;
+}
+
+static int dpaa_ol_probe(__rte_unused struct rte_dpaa_driver *dpaa_drv,
+			 struct rte_dpaa_device *dpaa_dev)
+{
+	int ret;
+	struct rte_eth_dev *eth_dev;
+	struct dpaa_if *dpaa_intf;
+	char bh_port_name[DPAA_OL_MAX_BH_PORT_NAME_LEN];
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Offline port state is owned by the primary process only. */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		DPAA_PMD_WARN("%s: not supported in secondary process",
+			      dpaa_dev->device.name);
+		return -ENOTSUP;
+	}
+
+	ret = dpaa_ol_get_bh_port_name(dpaa_dev->device.devargs,
+				       bh_port_name, sizeof(bh_port_name));
+	if (ret <= 0) {
+		DPAA_PMD_ERR("Offline port \"%s\" devarg not defined or invalid (ret=%d)",
+			     DRIVER_OL_BH_PORT, ret);
+		return ret < 0 ? ret : -EINVAL;
+	}
+
+	eth_dev = rte_eth_dev_allocate(dpaa_dev->name);
+	if (!eth_dev)
+		return -ENOMEM;
+	eth_dev->data->dev_private = rte_zmalloc("ethdev private structure",
+						 sizeof(struct dpaa_if),
+						 RTE_CACHE_LINE_SIZE);
+	if (!eth_dev->data->dev_private) {
+		DPAA_PMD_ERR("Cannot allocate memzone for port data");
+		rte_eth_dev_release_port(eth_dev);
+		return -ENOMEM;
+	}
+
+	eth_dev->device = &dpaa_dev->device;
+
+	dpaa_intf = eth_dev->data->dev_private;
+	rte_strscpy(dpaa_intf->ol_bh_port_name, bh_port_name,
+		    sizeof(dpaa_intf->ol_bh_port_name));
+
+	ret = dpaa_oldev_init(eth_dev);
+	if (ret == 0) {
+		rte_eth_dev_probing_finish(eth_dev);
+		return 0;
+	}
+
+	rte_eth_dev_release_port(eth_dev);
+	return ret;
+}
+
+static int dpaa_ol_remove(struct rte_dpaa_device *dpaa_dev)
+{
+	struct rte_eth_dev *eth_dev;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	eth_dev = rte_eth_dev_allocated(dpaa_dev->device.name);
+	if (eth_dev == NULL)
+		return 0;
+
+	dpaa_ol_dev_close(eth_dev);
+
+	return rte_eth_dev_release_port(eth_dev);
+}
+
+static struct rte_dpaa_driver rte_dpaa_ol_pmd = {
+		.drv_type = FSL_DPAA_OL,
+		.probe = dpaa_ol_probe,
+		.remove = dpaa_ol_remove,
+};
+
+RTE_PMD_REGISTER_DPAA(ol_dpaa, rte_dpaa_ol_pmd);
+RTE_PMD_REGISTER_PARAM_STRING(ol_dpaa,
+		DRIVER_OL_BH_PORT "=<string>");
diff --git a/drivers/net/dpaa/meson.build b/drivers/net/dpaa/meson.build
index 8d4f69c596..3ec1091197 100644
--- a/drivers/net/dpaa/meson.build
+++ b/drivers/net/dpaa/meson.build
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright 2018-2020 NXP
+# Copyright 2018-2020,2026 NXP
 
 if not is_linux
     build = false
@@ -9,12 +9,13 @@ deps += ['mempool_dpaa']
 
 sources = files(
         'dpaa_ethdev.c',
-        'fmlib/fm_lib.c',
-        'fmlib/fm_vsp.c',
         'dpaa_flow.c',
-        'dpaa_rxtx.c',
         'dpaa_fmc.c',
         'dpaa_ptp.c',
+        'dpaa_oldev.c',
+        'dpaa_rxtx.c',
+        'fmlib/fm_lib.c',
+        'fmlib/fm_vsp.c',
 )
 
 cflags += no_wvla_cflag
@@ -24,4 +25,4 @@ if cc.has_argument('-Wno-pointer-arith')
     cflags += '-Wno-pointer-arith'
 endif
 
-headers = files('rte_pmd_dpaa.h')
+headers = files('rte_pmd_dpaa.h', 'rte_pmd_dpaa_oldev.h')
diff --git a/drivers/net/dpaa/rte_pmd_dpaa_oldev.h b/drivers/net/dpaa/rte_pmd_dpaa_oldev.h
new file mode 100644
index 0000000000..9b695686f0
--- /dev/null
+++ b/drivers/net/dpaa/rte_pmd_dpaa_oldev.h
@@ -0,0 +1,198 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2026 NXP
+ */
+
+#ifndef _RTE_PMD_DPAA_OLDEV_H
+#define _RTE_PMD_DPAA_OLDEV_H
+
+/**
+ * @file rte_pmd_dpaa_oldev.h
+ *
+ * NXP DPAA offline (O/H) port PMD-specific API.
+ *
+ * @warning
+ * @b EXPERIMENTAL:
+ * All functions in this file may be changed or removed without prior notice.
+ *
+ * These APIs configure the classification, local gateway (LGW) and related
+ * uplink information for the DPAA offline port through the kernel control
+ * device.
+ */
+
+#include <stdint.h>
+#include <rte_common.h>
+#include <rte_compat.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** IPv4 address type for the inner/static address pair used in uplink
+ * classification.
+ */
+#define RTE_PMD_DPAA_OLDEV_IPV4_ADDR_TYPE  0x04
+/** IPv6 address type for the inner/static address pair used in uplink
+ * classification.
+ */
+#define RTE_PMD_DPAA_OLDEV_IPV6_ADDR_TYPE  0x06
+
+/** Maximum number of GTP UDP ports an application can listen on. */
+#define RTE_PMD_DPAA_OLDEV_MAX_NUM_PORTS 2
+
+/** IPv4 subnet type for an LGW subnet entry. */
+#define RTE_PMD_DPAA_OLDEV_IPV4_SUBNET_TYPE  0x04
+/** IPv6 subnet type for an LGW subnet entry. */
+#define RTE_PMD_DPAA_OLDEV_IPV6_SUBNET_TYPE  0x06
+/** Maximum number of LGW subnets that can be programmed. */
+#define RTE_PMD_DPAA_OLDEV_MAX_NUM_SUBNETS 4
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags when the address pair carries
+ * a valid inner IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_CLASSIF_INNER_IP 0x1
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags when the address pair carries
+ * a static IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_CLASSIF_STATIC_IP 0x2
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags to indicate the telecom
+ * application is listening only on the static IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_TELECOM_LISTEN_ON_ONLY_STATICIP 0x4
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags to indicate the telecom
+ * application is listening on both the static and the inner IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_TELECOM_LISTEN_ON_BOTH_STATIC_INNER_IP 0x8
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags to indicate the telecom
+ * application is listening only on the inner IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_TELECOM_LISTEN_ON_ONLY_INNERIP 0x10
+
+/**
+ * Holds an IPv4 or IPv6 address.
+ *
+ * For an IPv4 address only ip_addr[0] is used; for an IPv6 address all
+ * four words are used. Which representation applies is determined by
+ * the addr_type field of the enclosing struct rte_pmd_dpaa_ip_pair.
+ */
+struct rte_pmd_dpaa_ip_addr {
+	uint32_t ip_addr[4]; /**< Address words, network byte order. */
+};
+
+/** Static/inner IP address pair used for uplink classification. */
+struct __rte_packed_begin rte_pmd_dpaa_ip_pair {
+	struct rte_pmd_dpaa_ip_addr static_ip; /**< Static IP address. */
+	struct rte_pmd_dpaa_ip_addr inner_ip;  /**< Inner IP address. */
+	uint8_t flags;		/**< Combination of
+				  *  RTE_PMD_DPAA_OLDEV_CLASSIF_* and
+				  *  RTE_PMD_DPAA_OLDEV_TELECOM_* flags.
+				  */
+	uint8_t addr_type;	/**< RTE_PMD_DPAA_OLDEV_IPV4_ADDR_TYPE or
+				  *  RTE_PMD_DPAA_OLDEV_IPV6_ADDR_TYPE.
+				  */
+	uint8_t pad[2];		/**< Reserved, must be zero. */
+} __rte_packed_end;
+
+/** A single local gateway (LGW) subnet entry. */
+struct __rte_packed_begin rte_pmd_dpaa_lgw_subnet {
+	uint32_t subnet[4];	/**< Subnet address, network byte order. */
+	uint8_t mask;		/**< Subnet mask length in bits. */
+	uint8_t subnet_type;	/**< RTE_PMD_DPAA_OLDEV_IPV4_SUBNET_TYPE or
+				  *   RTE_PMD_DPAA_OLDEV_IPV6_SUBNET_TYPE.
+				  */
+	uint8_t pad[2];		/**< Reserved, must be zero. */
+} __rte_packed_end;
+
+/** Uplink classification information for the DPAA offline port. */
+struct rte_pmd_dpaa_uplink_cls_info_s {
+	struct rte_pmd_dpaa_ip_pair addr_pair;	/**< Static/inner IP pair. */
+	/** GTP UDP ports the application listens on. */
+	uint16_t gtp_udp_port[RTE_PMD_DPAA_OLDEV_MAX_NUM_PORTS];
+	uint8_t gtp_proto_id;	/**< UDP protocol ID the application listens
+				  *   on.
+				  */
+	uint8_t num_ports;	/**< Number of valid entries in
+				  *   gtp_udp_port.
+				  */
+	uint8_t sec_enabled;	/**< Non-zero if IPsec is enabled. */
+	uint8_t pad;		/**< Reserved, must be zero. */
+};
+
+/** Local gateway (LGW) information for the DPAA offline port. */
+struct __rte_packed_begin rte_pmd_dpaa_lgw_info_s {
+	/** LGW subnet table. */
+	struct rte_pmd_dpaa_lgw_subnet subnets[RTE_PMD_DPAA_OLDEV_MAX_NUM_SUBNETS];
+	uint8_t num_subnets;	/**< Number of valid entries in subnets. */
+	uint8_t pad[3];		/**< Reserved, must be zero. */
+} __rte_packed_end;
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Program the uplink classification information for the DPAA offline port.
+ *
+ * @param port_id
+ *   The port identifier of the DPAA offline (O/H) port.
+ * @param cls_info
+ *   Pointer to the classification information to program. Must not be NULL.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_set_classif_info(uint16_t port_id,
+		struct rte_pmd_dpaa_uplink_cls_info_s *cls_info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Reset the uplink classification information for the DPAA offline port.
+ *
+ * @param port_id
+ *   The port identifier of the DPAA offline (O/H) port.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_reset_classif_info(uint16_t port_id);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Program the local gateway (LGW) information for the DPAA offline port.
+ *
+ * @param port_id
+ *   The port identifier of the DPAA offline (O/H) port.
+ * @param lgw_info
+ *   Pointer to the LGW information to program. Must not be NULL.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_set_lgw_info(uint16_t port_id,
+		struct rte_pmd_dpaa_lgw_info_s *lgw_info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Reset the local gateway (LGW) information for the DPAA offline port.
+ *
+ * @param port_id
+ *   The port identifier of the DPAA offline (O/H) port.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_reset_lgw_info(uint16_t port_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PMD_DPAA_OLDEV_H */
-- 
2.25.1


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

* [PATCH v4 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name
  2026-11-16  6:25     ` [PATCH v4 " Gagandeep Singh
  2026-11-16  6:25       ` [PATCH v4 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
  2026-11-16  6:25       ` [PATCH v4 2/4] drivers: add offline (O/H) port device support Gagandeep Singh
@ 2026-11-16  6:25       ` Gagandeep Singh
  2026-11-16  6:25       ` [PATCH v4 4/4] drivers: add DPAA cgrid cleanup support Gagandeep Singh
                         ` (2 subsequent siblings)
  5 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-16  6:25 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

A shared MAC interface needs the kernel netdev name to read the MTU,
and that name is only the DPDK port name for fmX-macY style netdevs.

Look it up in sysfs under the platform device of the dpa-ethernet node
the port was created from, and fall back to the port name.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/nics/dpaa.rst       |  6 ++-
 drivers/net/dpaa/dpaa_ethdev.c | 68 +++++++++++++++++++++++++++++++++-
 2 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst
index 7658e6d454..d391c0607f 100644
--- a/doc/guides/nics/dpaa.rst
+++ b/doc/guides/nics/dpaa.rst
@@ -276,6 +276,11 @@ Refer to the document :doc:`build_and_test` for details.
   and thus disabling hardware based packet handling at driver level,
   e.g. ``dpaa:fm1-mac3,recv_err_pkts=1``.
 
+* For a shared MAC interface the kernel network interface name is looked up
+  in sysfs from the device tree node the port was created from,
+  so a kernel interface that does not follow
+  the ``fmX-macY`` naming style is handled without extra configuration.
+
 ``drv_bh_port``
    Name of the back-half port associated with an offline (O/H) port device.
    It is passed on the offline port device itself, which is named
@@ -307,7 +312,6 @@ port identified by its ``port_id``, via the experimental
 ``rte_pmd_dpaa_ol_set_lgw_info()`` and ``rte_pmd_dpaa_ol_reset_lgw_info()``
 APIs declared in ``rte_pmd_dpaa_oldev.h``.
 
-
 FMAN Config
 -----------
 
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index fe49c7b961..a821e68807 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -9,12 +9,14 @@
 #include <inttypes.h>
 #include <unistd.h>
 #include <limits.h>
+#include <stdlib.h>
 #include <sched.h>
 #include <signal.h>
 #include <pthread.h>
 #include <sys/types.h>
 #include <sys/syscall.h>
 #include <sys/ioctl.h>
+#include <dirent.h>
 
 #include <eal_export.h>
 #include <rte_string_fns.h>
@@ -57,6 +59,61 @@
 #define DRIVER_RECV_ERR_PKTS      "recv_err_pkts"
 #define RTE_PRIORITY_103 103
 
+#define DPAA_OF_BASE_PATH "/sys/firmware/devicetree/base"
+
+/*
+ * Get the kernel netdev name bound to the same device tree node as this
+ * port, by matching each /sys/class/net/<ifname>/device/of_node against
+ * node_path. Returns 1 on success, 0 if none was found, negative on error.
+ */
+static int
+dpaa_get_kernel_ifname(const char *node_path, char *name, size_t size)
+{
+	char path[PATH_MAX], resolved[PATH_MAX];
+	struct dirent *entry;
+	DIR *dir;
+	int ret;
+
+	if (!node_path || node_path[0] == '\0')
+		return 0;
+
+	dir = opendir("/sys/class/net");
+	if (!dir)
+		return 0;
+
+	ret = 0;
+	while ((entry = readdir(dir)) != NULL) {
+		if (entry->d_name[0] == '.')
+			continue;
+
+		if (snprintf(path, sizeof(path),
+			     "/sys/class/net/%s/device/of_node",
+			     entry->d_name) >= (int)sizeof(path))
+			continue;
+
+		if (realpath(path, resolved) == NULL)
+			continue;
+
+		if (strncmp(resolved, DPAA_OF_BASE_PATH,
+			    strlen(DPAA_OF_BASE_PATH)) != 0)
+			continue;
+
+		if (strcmp(resolved + strlen(DPAA_OF_BASE_PATH),
+			   node_path) != 0)
+			continue;
+
+		if (rte_strscpy(name, entry->d_name, size) < 0) {
+			ret = -ENAMETOOLONG;
+			break;
+		}
+		ret = 1;
+		break;
+	}
+
+	closedir(dir);
+	return ret;
+}
+
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		RTE_ETH_RX_OFFLOAD_SCATTER;
@@ -251,6 +308,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	int speed, duplex;
 	int ret, rx_status, socket_fd;
 	struct ifreq ifr;
+	char sh_if_name[IFNAMSIZ];
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -272,7 +330,15 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 			DPAA_PMD_ERR("Cannot open IF socket");
 			return -errno;
 		}
-		strlcpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
+
+		/* The DPDK port name matches the netdev only for fmX-macY. */
+		sh_if_name[0] = '\0';
+		ret = dpaa_get_kernel_ifname(__fif->node_path, sh_if_name,
+					     sizeof(sh_if_name));
+		if (ret <= 0 || sh_if_name[0] == '\0')
+			strlcpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
+		else
+			strlcpy(ifr.ifr_name, sh_if_name, IFNAMSIZ);
 
 		if (ioctl(socket_fd, SIOCGIFMTU, &ifr) < 0) {
 			DPAA_PMD_ERR("Cannot get interface mtu");
-- 
2.25.1


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

* [PATCH v4 4/4] drivers: add DPAA cgrid cleanup support
  2026-11-16  6:25     ` [PATCH v4 " Gagandeep Singh
                         ` (2 preceding siblings ...)
  2026-11-16  6:25       ` [PATCH v4 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
@ 2026-11-16  6:25       ` Gagandeep Singh
  2026-11-16 22:48       ` [PATCH v4 0/4] DPAA driver changes Stephen Hemminger
  2026-11-17  5:45       ` [PATCH v5 " Gagandeep Singh
  5 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-16  6:25 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, stable, Jun Yang

From: Jun Yang <jun.yang@nxp.com>

A congestion group must have no member frame queues left when it is
deleted, and its CGRID must be returned to the allocator once the group
is gone. Neither was handled on the net/dpaa close and probe-failure
paths.

This also changes probe behaviour: a qman_create_cgr() failure in
dpaa_rx_queue_init() or dpaa_tx_queue_init() now fails the probe
instead of continuing without tail drop on that queue. The probe error
path deletes one CGR per initialised queue, and a CGR whose creation
failed was never linked into the portal list.

Fixes: 62f53995caaf ("net/dpaa: add frame count based tail drop with CGR")
Fixes: 9124e65dd3eb ("net/dpaa: enable Tx queue taildrop")
Cc: stable@dpdk.org

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/dpaa/base/qbman/qman.c       |  61 +++++++++
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   1 +
 drivers/bus/dpaa/include/fsl_qman.h      |  27 ++++
 drivers/net/dpaa/dpaa_ethdev.c           | 167 +++++++++++++++++++++--
 4 files changed, 244 insertions(+), 12 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 3c056e4547..fa3387c6bd 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -2993,3 +2993,64 @@ qman_shutdown_fq(struct qman_fq *fq)
 out:
 	return ret;
 }
+
+int qman_pending_fq_by_cgrid_range(u32 cgrid_start, u32 cgrid_num,
+	u32 start_fqid, u32 *fqid, u32 *cgrid)
+{
+	struct qman_fq fq = {
+		.fqid = start_fqid ? start_fqid : 1
+	};
+	struct qm_mcr_queryfq_np np;
+	struct qm_fqd fqd;
+	int err;
+
+	/*
+	 * Do not use the CGR byte count to decide whether to scan. An FQ is a
+	 * member of the group whenever it is scheduled with CGE set and a
+	 * matching cgid, whether or not it currently holds any frames, and the
+	 * group cannot be deleted while such a member exists. Skipping the
+	 * scan for an empty CGR would let an idle stale FQ survive and its
+	 * CGRID be released while still referenced. This runs from the device
+	 * close path only, so the scan cost is acceptable.
+	 *
+	 * The whole CGRID range of a port is matched in a single pass, so a
+	 * port with many congestion groups does not need one full FQID space
+	 * scan per group.
+	 */
+	DPAA_BUS_DEBUG("Scanning FQs for cgrid(0x%x..0x%x)",
+		cgrid_start, cgrid_start + cgrid_num - 1);
+
+	/* FQID space is 24 bits wide; stop before wrapping. */
+	for (; fq.fqid <= QMAN_MAX_FQID; fq.fqid++) {
+		err = qman_query_fq_np(&fq, &np);
+		if (err == -ERANGE) {
+			/*
+			 * FQID is not implemented on this device, so there is
+			 * nothing beyond it either.
+			 */
+			break;
+		} else if (err) {
+			DPAA_BUS_WARN("Failed(%d) to Query np FQ(fqid=0x%x)",
+				err, fq.fqid);
+			return err;
+		}
+		if ((np.state & QM_MCR_NP_STATE_MASK) != QM_MCR_NP_STATE_OOS) {
+			err = qman_query_fq(&fq, &fqd);
+			if (err) {
+				DPAA_BUS_WARN("Failed(%d) to Query FQ(fqid=0x%x)",
+					err, fq.fqid);
+			} else if ((fqd.fq_ctrl & QM_FQCTRL_CGE) &&
+				fqd.cgid >= cgrid_start &&
+				fqd.cgid < cgrid_start + cgrid_num) {
+				if (fqid)
+					*fqid = fq.fqid;
+				if (cgrid)
+					*cgrid = fqd.cgid;
+				return 0;
+			}
+		}
+	}
+	DPAA_BUS_DEBUG("No FQ left in cgrid(0x%x..0x%x)",
+		cgrid_start, cgrid_start + cgrid_num - 1);
+	return -ERANGE;
+}
diff --git a/drivers/bus/dpaa/dpaa_bus_base_symbols.c b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
index aaa9f9bec2..4da43f293d 100644
--- a/drivers/bus/dpaa/dpaa_bus_base_symbols.c
+++ b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
@@ -57,6 +57,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(qman_reserve_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_pool_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_cgrid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_release_cgrid_range)
+RTE_EXPORT_INTERNAL_SYMBOL(qman_pending_fq_by_cgrid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_intr_enable)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_intr_disable)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_get_ioctl_version_number)
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index b2674ce5d0..6d76722275 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1284,6 +1284,9 @@ struct qman_cgr {
  */
 #define QMAN_FQRN_WAIT_MAX		10000000u
 
+/* Maximum FQID value: frame queue IDs are 24 bits wide. */
+#define QMAN_MAX_FQID			0x00FFFFFFu
+
 /* Flags to qman_create_fq() */
 #define QMAN_FQ_FLAG_NO_ENQUEUE      0x00000001 /* can't enqueue */
 #define QMAN_FQ_FLAG_NO_MODIFY       0x00000002 /* can only enqueue */
@@ -1916,6 +1919,30 @@ static inline int qman_shutdown_fq_by_fqid(u32 fqid)
 	return qman_shutdown_fq(&fq);
 }
 
+/**
+ * qman_pending_fq_by_cgrid_range - Find an FQ still attached to a CGR range.
+ *
+ * @cgrid_start: first congestion group id of the range to search for.
+ * @cgrid_num: number of consecutive congestion group ids in the range.
+ * @start_fqid: FQID to begin the scan from (0 or 1 means scan from the
+ *   start). A caller shutting down several stale FQs can pass the previously
+ *   returned FQID + 1 to resume the scan instead of restarting from the
+ *   beginning each time.
+ * @fqid: on success, holds the FQID that is still attached to the range.
+ * @cgrid: on success, holds the congestion group id that FQ belongs to.
+ *   May be NULL.
+ *
+ * Matching a whole range in one pass lets a caller with many congestion
+ * groups, such as a port releasing all of its Rx or Tx CGRs, avoid one full
+ * FQID space scan per group.
+ *
+ * Return 0 and set *fqid when a matching FQ is found, -ERANGE when none is
+ * left, or a negative error code on query failure.
+ */
+__rte_internal
+int qman_pending_fq_by_cgrid_range(u32 cgrid_start, u32 cgrid_num,
+		u32 start_fqid, u32 *fqid, u32 *cgrid);
+
 /**
  * qman_reserve_fqid_range - Reserve the specified range of frame queue IDs
  * @fqid: the base FQID of the range to deallocate
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index a821e68807..47dafc5f11 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -114,6 +114,9 @@ dpaa_get_kernel_ifname(const char *node_path, char *name, size_t size)
 	return ret;
 }
 
+/* Maximum number of stale frame queues cleaned up per congestion group. */
+#define DPAA_CGR_STALE_FQ_MAX     64
+
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		RTE_ETH_RX_OFFLOAD_SCATTER;
@@ -585,6 +588,49 @@ static int dpaa_eth_dev_stop(struct rte_eth_dev *dev)
 	return 0;
 }
 
+/* Shut down any frame queue still linked to this CGR.
+ *
+ * A CGR must have no members left when it is deleted. FQs left behind by a
+ * previous run of the application are not owned by this process, so they can
+ * only be found by asking QMan. There may be more than one, hence the loop.
+ *
+ * Returns true if the FQID range was fully scanned (i.e. no stale FQ was
+ * left behind), false if an FQ refused to shut down and the scan had to
+ * stop early.
+ */
+static bool
+dpaa_cgr_stale_fq_cleanup(struct rte_eth_dev *dev, uint32_t cgrid_start,
+			  uint32_t cgrid_num, const char *dir)
+{
+	uint32_t start_fqid = 1;
+	uint32_t fqid, cgrid;
+	uint32_t loop, max_loop;
+	int ret;
+
+	max_loop = cgrid_num * DPAA_CGR_STALE_FQ_MAX;
+	for (loop = 0; loop < max_loop; loop++) {
+		if (qman_pending_fq_by_cgrid_range(cgrid_start, cgrid_num,
+						   start_fqid, &fqid, &cgrid))
+			return true;
+		/* Should be FQ not cleaned in previous program. */
+		DPAA_PMD_DEBUG("FQ(fqid=0x%x) with %s cgid=%u is still alive?",
+			fqid, dir, cgrid);
+		ret = qman_shutdown_fq_by_fqid(fqid);
+		if (ret) {
+			DPAA_PMD_WARN("%s: Failed(%d) to shutdown %s cgid=%u's fq(fqid=0x%x)",
+				dev->data->name, ret, dir, cgrid, fqid);
+			/* Do not spin on an FQ that refuses to shut down. */
+			return false;
+		}
+		/* Resume the scan past the FQ just handled instead of
+		 * restarting from the beginning, which would be O(N^2) for
+		 * N stale FQs.
+		 */
+		start_fqid = fqid + 1;
+	}
+	return true;
+}
+
 static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 {
 	struct fman_if *fif = dev->process_private;
@@ -594,7 +640,7 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 	struct rte_eth_link *link = &dev->data->dev_link;
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 	struct qman_fq *fq;
-	int loop;
+	uint32_t loop;
 	int ret;
 
 	PMD_INIT_FUNC_TRACE();
@@ -669,26 +715,75 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 	/* Release congestion Groups after releasing FQIDs */
 	/* Release RX congestion Groups */
 	if (dpaa_intf->cgr_rx) {
+		bool cgrid_ok = true;
+
+		/* Shut down this port's own Rx FQs first, so the stale-FQ
+		 * scan below does not pick them up.
+		 */
+		for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) {
+			ret = qman_shutdown_fq(&dpaa_intf->rx_queues[loop]);
+			if (ret) {
+				DPAA_PMD_WARN("%s: shutdown rxq%d err(%d)",
+					dev->data->name, loop, ret);
+				cgrid_ok = false;
+			}
+		}
+
+		/* Scan for stale FQs left by a previous run. */
+		if (!dpaa_cgr_stale_fq_cleanup(dev, dpaa_intf->cgr_rx[0].cgrid,
+					  dpaa_intf->nb_rx_queues, "rx"))
+			cgrid_ok = false;
+
 		for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) {
 			ret = qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
 			if (ret) {
 				DPAA_PMD_WARN("%s: delete rxq%d's cgr err(%d)",
 					dev->data->name, loop, ret);
+				cgrid_ok = false;
 			}
 		}
+		/* Only hand the CGRIDs back to the allocator if every member
+		 * FQ was confirmed shut down and every CGR deleted; otherwise
+		 * deliberately leak them rather than reuse a CGRID that may
+		 * still be referenced by a live FQ.
+		 */
+		if (cgrid_ok)
+			qman_release_cgrid_range(dpaa_intf->cgr_rx[0].cgrid,
+					dpaa_intf->nb_rx_queues);
 		rte_free(dpaa_intf->cgr_rx);
 		dpaa_intf->cgr_rx = NULL;
 	}
 
 	/* Release TX congestion Groups */
 	if (dpaa_intf->cgr_tx) {
+		bool cgrid_ok = true;
+
+		/* Shut down this port's own Tx FQs before the scan below. */
+		for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
+			ret = qman_shutdown_fq(&dpaa_intf->tx_queues[loop]);
+			if (ret) {
+				DPAA_PMD_WARN("%s: shutdown txq%d err(%d)",
+					dev->data->name, loop, ret);
+				cgrid_ok = false;
+			}
+		}
+
+		/* Scan for stale FQs left by a previous run. */
+		if (!dpaa_cgr_stale_fq_cleanup(dev, dpaa_intf->cgr_tx[0].cgrid,
+					  MAX_DPAA_CORES, "tx"))
+			cgrid_ok = false;
+
 		for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
 			ret = qman_delete_cgr(&dpaa_intf->cgr_tx[loop]);
 			if (ret) {
 				DPAA_PMD_WARN("%s: delete txq%d's cgr err(%d)",
 					dev->data->name, loop, ret);
+				cgrid_ok = false;
 			}
 		}
+		if (cgrid_ok)
+			qman_release_cgrid_range(dpaa_intf->cgr_tx[0].cgrid,
+						 MAX_DPAA_CORES);
 		rte_free(dpaa_intf->cgr_tx);
 		dpaa_intf->cgr_tx = NULL;
 	}
@@ -2039,19 +2134,32 @@ static int dpaa_rx_queue_init(struct qman_fq *fq, struct qman_cgr *cgr_rx,
 		ret = qman_create_cgr(cgr_rx, QMAN_CGR_FLAG_USE_INIT,
 				      &cgr_opts);
 		if (ret) {
-			DPAA_PMD_WARN(
-				"rx taildrop init fail on rx fqid 0x%x(ret=%d)",
+			/* Do not fall back to running without the CGR. The
+			 * caller counts one CGR per queue it initialised and
+			 * deletes cgr_rx[0..n) on its error path, so a queue
+			 * without a CGR would make it delete an object that
+			 * was never added to the portal list, whose node is
+			 * still zeroed from rte_zmalloc().
+			 */
+			DPAA_PMD_ERR("rx taildrop init fail on rx fqid 0x%x(ret=%d)",
 				fq->fqid, ret);
-			goto without_cgr;
+			return ret;
 		}
 		opts.we_mask |= QM_INITFQ_WE_CGID;
 		opts.fqd.cgid = cgr_rx->cgrid;
 		opts.fqd.fq_ctrl |= QM_FQCTRL_CGE;
 	}
-without_cgr:
+
 	ret = qman_init_fq(fq, 0, &opts);
-	if (ret)
+	if (ret) {
 		DPAA_PMD_ERR("init rx fqid 0x%x failed with ret:%d", fqid, ret);
+		/* The caller only counts this CGR once this function returns
+		 * success, so its error path will not delete it. Unlink it here
+		 * or the portal keeps a pointer into memory the caller frees.
+		 */
+		if (cgr_rx)
+			qman_delete_cgr(cgr_rx);
+	}
 	return ret;
 }
 
@@ -2130,10 +2238,12 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 		ret = qman_create_cgr(cgr_tx, QMAN_CGR_FLAG_USE_INIT,
 				      &cgr_opts);
 		if (ret) {
-			DPAA_PMD_WARN(
-				"rx taildrop init fail on rx fqid 0x%x(ret=%d)",
+			/* See the equivalent comment in
+			 * dpaa_rx_queue_init().
+			 */
+			DPAA_PMD_ERR("tx taildrop init fail on tx fqid 0x%x(ret=%d)",
 				fq->fqid, ret);
-			goto without_cgr;
+			return ret;
 		}
 		opts.we_mask |= QM_INITFQ_WE_CGID;
 		opts.fqd.cgid = cgr_tx->cgrid;
@@ -2141,10 +2251,14 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 		DPAA_PMD_DEBUG("Tx FQ tail drop enabled, threshold = %d",
 				td_tx_threshold);
 	}
-without_cgr:
+
 	ret = qman_init_fq(fq, QMAN_INITFQ_FLAG_SCHED, &opts);
-	if (ret)
+	if (ret) {
 		DPAA_PMD_ERR("init tx fqid 0x%x failed %d", fq->fqid, ret);
+		/* See the equivalent comment in dpaa_rx_queue_init(). */
+		if (cgr_tx)
+			qman_delete_cgr(cgr_tx);
+	}
 	return ret;
 }
 
@@ -2316,6 +2430,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	int num_rx_fqs, fqid;
 	int loop, ret = 0;
 	int dev_id;
+	int nb_rx_cgr = 0, nb_tx_cgr = 0;
+	bool rx_cgrid_allocated = false, tx_cgrid_allocated = false;
 	struct rte_dpaa_device *dpaa_device;
 	struct dpaa_if *dpaa_intf;
 	struct fm_eth_port_cfg *cfg;
@@ -2437,6 +2553,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			ret = -EINVAL;
 			goto free_rx;
 		}
+		rx_cgrid_allocated = true;
 	} else {
 		dpaa_intf->cgr_rx = NULL;
 	}
@@ -2471,6 +2588,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			fqid);
 		if (ret)
 			goto free_rx;
+		if (dpaa_intf->cgr_rx)
+			nb_rx_cgr++;
 		dpaa_intf->rx_queues[loop].vsp_id = vsp_id;
 		dpaa_intf->rx_queues[loop].dpaa_intf = dpaa_intf;
 	}
@@ -2511,11 +2630,11 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			ret = -EINVAL;
 			goto free_tx;
 		}
+		tx_cgrid_allocated = true;
 	} else {
 		dpaa_intf->cgr_tx = NULL;
 	}
 
-
 	for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
 		if (dpaa_intf->cgr_tx)
 			dpaa_intf->cgr_tx[loop].cgrid = cgrid_tx[loop];
@@ -2526,6 +2645,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			dpaa_intf->cgr_tx ? &dpaa_intf->cgr_tx[loop] : NULL);
 		if (ret)
 			goto free_tx;
+		if (dpaa_intf->cgr_tx)
+			nb_tx_cgr++;
 
 		if (dpaa_intf->ts_enable) {
 			ret = dpaa_tx_conf_queue_init(&dpaa_intf->tx_conf_queues[loop]);
@@ -2605,6 +2726,17 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	return 0;
 
 free_tx:
+	/* A CGR must have no members when deleted, so shut down the FQs
+	 * already linked to it first. Each CGR was also linked into the
+	 * QMan portal's cgr_cbs list by qman_create_cgr(), so deleting it
+	 * here avoids leaving the portal with dangling pointers.
+	 */
+	for (loop = 0; loop < nb_tx_cgr; loop++)
+		qman_shutdown_fq(&dpaa_intf->tx_queues[loop]);
+	for (loop = 0; loop < nb_tx_cgr; loop++)
+		qman_delete_cgr(&dpaa_intf->cgr_tx[loop]);
+	if (tx_cgrid_allocated)
+		qman_release_cgrid_range(cgrid_tx[0], MAX_DPAA_CORES);
 	rte_free(dpaa_intf->tx_conf_queues);
 	dpaa_intf->tx_conf_queues = NULL;
 	rte_free(dpaa_intf->tx_queues);
@@ -2612,8 +2744,19 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	dpaa_intf->nb_tx_queues = 0;
 
 free_rx:
+	/* Same as above for the Rx CGRs: shut down the FQs still linked to
+	 * their CGR before deleting it.
+	 */
+	for (loop = 0; loop < nb_rx_cgr; loop++)
+		qman_shutdown_fq(&dpaa_intf->rx_queues[loop]);
+	for (loop = 0; loop < nb_rx_cgr; loop++)
+		qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
+	if (rx_cgrid_allocated)
+		qman_release_cgrid_range(cgrid[0], num_rx_fqs);
 	rte_free(dpaa_intf->cgr_rx);
+	dpaa_intf->cgr_rx = NULL;
 	rte_free(dpaa_intf->cgr_tx);
+	dpaa_intf->cgr_tx = NULL;
 	rte_free(dpaa_intf->rx_queues);
 	dpaa_intf->rx_queues = NULL;
 	dpaa_intf->nb_rx_queues = 0;
-- 
2.25.1


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

* Re: [PATCH v4 0/4] DPAA driver changes
  2026-11-16  6:25     ` [PATCH v4 " Gagandeep Singh
                         ` (3 preceding siblings ...)
  2026-11-16  6:25       ` [PATCH v4 4/4] drivers: add DPAA cgrid cleanup support Gagandeep Singh
@ 2026-11-16 22:48       ` Stephen Hemminger
  2026-11-17  5:45       ` [PATCH v5 " Gagandeep Singh
  5 siblings, 0 replies; 33+ messages in thread
From: Stephen Hemminger @ 2026-11-16 22:48 UTC (permalink / raw)
  To: Gagandeep Singh; +Cc: dev, hemant.agrawal

On Mon, 16 Nov 2026 11:55:08 +0530
Gagandeep Singh <g.singh@nxp.com> wrote:

> V4-Changes:
>  - Fixed ol_fd leak issue.
>  - Fixed the FQID hold be kernel issue.
>  - removed the not required locks.
>  - fixed unwanted line and memcpy issue.
>  - We want to have rte_pmd_dpaa_ol_* functions, the reason we sent over
>    the email.


Still some findings from AI review

Subject: Re: [PATCH v4 0/4] DPAA offline port, shared MAC name, cgrid cleanup

Series applies to main and builds at every commit (bus/dpaa,
mempool/dpaa, net/dpaa, -Dwerror=true). Patches 1 and 3 have no
findings.


Patch 2/4 drivers: add offline (O/H) port device support
---------------------------------------------------------

Warning: FQ info set in dev_start but only reset in dev_close.

dpaa_ol_dev_start() sends ASK_CTRL_SET_DPDK_INFO on every start;
dpaa_ol_dev_stop() only swaps the Tx burst. After stop the kernel
keeps steering frames into the Rx FQ using buffers from the DPDK
pool, and a stop/start cycle issues a second SET with no RESET in
between. Pair them: reset in stop, set in start.

  static int dpaa_ol_reset_fq_info(struct dpaa_if *dpaa_intf)
  {
          struct ask_ctrl_dpdk_fq_info_s fq_info = { 0 };
          int ret;

          if (!dpaa_intf->ol_fq_info_set)
                  return 0;
          fq_info.tx_fq_id = dpaa_intf->tx_queues[0].fqid;
          fq_info.rx_fq_id = dpaa_intf->rx_queues[0].fqid;
          ret = ask_reset_fq_info(dpaa_intf, &fq_info);
          if (ret == 0)
                  dpaa_intf->ol_fq_info_set = false;
          return ret;
  }

  static int dpaa_ol_dev_stop(struct rte_eth_dev *dev)
  {
          dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
          return dpaa_ol_reset_fq_info(dev->data->dev_private);
  }

dpaa_oldev_queues_release() can then call the same helper.

Warning: received mbufs carry the wrong port id.

dpaa_eth_fd_to_mbuf() sets mbuf->port = dpaa_intf->ifid. ifid is
never set for the offline port, so it stays 0 from rte_zmalloc().
The oldev sorts after all ETH devices on the bus, so port 0 is
always some other port. Set it in dpaa_oldev_init():

  dpaa_intf->ifid = eth_dev->data->port_id;

Info: struct ask_ctrl_dpdk_fq_info_s is an ioctl ABI shared with an
out-of-tree module, but it uses bool members, implicit padding and
no version check. The public rte_pmd_dpaa_*_s structs are passed
straight to the same ioctls, so their layout is now frozen by the
CDX module rather than by DPDK. Consider fixed-width types and a
version query at probe so a mismatched cdx module fails cleanly.


Patch 4/4 drivers: add DPAA cgrid cleanup support
-------------------------------------------------

Warning: stale FQ scan runs at close, after the CGRs have been in
use for the whole run.

If a stale FQ from a previous run still references a CGRID handed
out at probe, it is a member of this port's CGR from the moment
qman_create_cgr() runs; its frames count against the tail-drop
thresholds for the life of the port. Removing it at close is too
late. Do the scan in dpaa_dev_init() right after
qman_alloc_cgrid_range(), before any CGR is created:

  ret = qman_alloc_cgrid_range(&cgrid[0], num_rx_fqs, 1, 0);
  ...
  if (!dpaa_cgr_stale_fq_cleanup(eth_dev, cgrid[0],
                                 num_rx_fqs, "rx")) {
          ret = -EBUSY;
          goto free_rx;
  }

and the same for cgrid_tx. Close then only needs to shut down the
port's own FQs.

Warning: dpaa_cgr_stale_fq_cleanup() returns true when max_loop is
exhausted.

The comment says true means the range was fully scanned. If the
loop runs out after cgrid_num * DPAA_CGR_STALE_FQ_MAX shutdowns,
more stale FQs may remain, yet cgrid_ok stays true and the CGRIDs
are released while still referenced. Fall out of the loop with
false:

          start_fqid = fqid + 1;
  }
  DPAA_PMD_WARN("%s: stale %s FQ limit reached",
                dev->data->name, dir);
  return false;

Info: qman_pending_fq_by_cgrid_range() walks every implemented
FQID with up to two management commands each, and close runs it
twice per port (Rx and Tx). With several ports this is a
noticeable stall on shutdown. If the scan moves to probe as
suggested, one combined pass over all of the port's CGRIDs (Rx
and Tx are both known by then) would halve it.

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

* [PATCH v5 0/4] DPAA driver changes
  2026-11-16  6:25     ` [PATCH v4 " Gagandeep Singh
                         ` (4 preceding siblings ...)
  2026-11-16 22:48       ` [PATCH v4 0/4] DPAA driver changes Stephen Hemminger
@ 2026-11-17  5:45       ` Gagandeep Singh
  2026-11-17  5:45         ` [PATCH v5 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
                           ` (4 more replies)
  5 siblings, 5 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-17  5:45 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal

V5-Changes:
 - Added a reset FQ helper as per the AI suggestion
 - Fixed the portid issue.
 - Added explicit padding, uint8_t, size checks. The version ioctl is
   not avilable in CDX module as of now, so mismatch module will fails
   at probe only through existing ioctl errors.
 - Fixed stale FQs run at close issue.
 - Added a AI suggested warning.
 - The scan moved to probe, close no longer scans. A single combined pass
   would need the Tx CGRIDs before the Rx CGRs are created and a scan that
   takes two ranges, which is too big for this series and saves
   only one scan per port at startup.

V4-Changes:
 - Fixed ol_fd leak issue.
 - Fixed the FQID hold be kernel issue.
 - removed the not required locks.
 - fixed unwanted line and memcpy issue.
 - We want to have rte_pmd_dpaa_ol_* functions, the reason we sent over
   the email.

V3-Changes:
 - Updated rte_pmd_dpaa_oldev.h APIs as per DPDK compliance.
 - Added missing release not for OH port support.
 - Fixed dump_netcfg issue.
 - Added an API to release FQID.
 - moved the fman.h changes to first patch.

V2-changes:
 - Fixed most of the AI comments.
 - added new patch:
   fix out-of-bounds read of mac_idx
 - removed drv_oldev, updated comments and notes.
 - fixes FQ shutdown
 - removed unwanted checks, updated open, updated snprintf.
 - updated commit messages.

V1:
 - Adding OH port support.
 - Updates in shared ethernet code.
 - Congestion related code cleanup.

Gagandeep Singh (2):
  bus/dpaa: fix out-of-bounds read of mac_idx array
  drivers: add offline (O/H) port device support

Hemant Agrawal (1):
  net/dpaa: support non fmX-macY type of shared Ethernet name

Jun Yang (1):
  drivers: add DPAA cgrid cleanup support

 doc/api/doxy-api-index.md                |   1 +
 doc/guides/nics/dpaa.rst                 |  36 +
 doc/guides/rel_notes/release_26_11.rst   |  10 +
 drivers/bus/dpaa/base/fman/fman.c        |  19 +
 drivers/bus/dpaa/base/qbman/qman.c       |  61 ++
 drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
 drivers/bus/dpaa/dpaa_bus.c              |  68 +-
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   2 +
 drivers/bus/dpaa/include/fman.h          |   6 +-
 drivers/bus/dpaa/include/fsl_qman.h      |  28 +
 drivers/net/dpaa/dpaa_ethdev.c           | 234 +++++-
 drivers/net/dpaa/dpaa_ethdev.h           |  12 +
 drivers/net/dpaa/dpaa_flow.c             |   5 +-
 drivers/net/dpaa/dpaa_oldev.c            | 959 +++++++++++++++++++++++
 drivers/net/dpaa/meson.build             |  11 +-
 drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 198 +++++
 16 files changed, 1623 insertions(+), 31 deletions(-)
 create mode 100644 drivers/net/dpaa/dpaa_oldev.c
 create mode 100644 drivers/net/dpaa/rte_pmd_dpaa_oldev.h

-- 
2.25.1


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

* [PATCH v5 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array
  2026-11-17  5:45       ` [PATCH v5 " Gagandeep Singh
@ 2026-11-17  5:45         ` Gagandeep Singh
  2026-11-17  5:45         ` [PATCH v5 2/4] drivers: add offline (O/H) port device support Gagandeep Singh
                           ` (3 subsequent siblings)
  4 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-17  5:45 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, stable, Gagandeep Singh

fman_if_init() and fman_if_init_onic() read the devicetree
'cell-index' property and store it unchecked into
__if->__if.mac_idx. This value is later used as an index into the
fixed-size mac_idx[] lookup table in fman_if_vsp_init(), so a
cell-index value greater than or equal to the number of entries in
that table results in an out-of-bounds read.

Add an explicit upper-bound check (FMAN_MAX_MAC_IDX_NUM) in both
fman_if_init() and fman_if_init_onic() before the mac_idx assignment,
and a static_assert in fman_if_vsp_init() to keep mac_idx[] in sync
with FMAN_MAX_MAC_IDX_NUM if it is ever resized.

Also remove the unused MEMMAC_REG_OFFSET() macro from fman.h, which
had no remaining callers.

Fixes: a0edbb8a8e52 ("bus/dpaa: add OH port mode")
Fixes: 7e5f49ae767d ("bus/dpaa: add ONIC port mode")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/bus/dpaa/base/fman/fman.c | 19 +++++++++++++++++++
 drivers/bus/dpaa/include/fman.h   |  6 +++++-
 drivers/net/dpaa/dpaa_flow.c      |  5 ++++-
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index 67f77265ca..223cd6958d 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -205,6 +205,9 @@ static void fman_if_vsp_init(struct __fman_if *__if)
 	size_t lenp;
 	const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1};
 
+	static_assert(RTE_DIM(mac_idx) == FMAN_MAX_MAC_IDX_NUM,
+		      "mac_idx[] out of sync with FMAN_MAX_MAC_IDX_NUM");
+
 	if (__if->__if.mac_idx <= 8) {
 		for_each_compatible_node(dev, NULL,
 			"fsl,fman-port-1g-rx-extended-args") {
@@ -544,6 +547,14 @@ fman_if_init(const struct device_node *dpa_node, int fd)
 		cell_idx_host = of_read_number(cell_idx,
 					       lenp / sizeof(phandle));
 
+		if (cell_idx_host >= FMAN_MAX_MAC_IDX_NUM) {
+			FMAN_ERR(-EINVAL,
+				 "%s: cell-index(%" PRIu64 ") >= max(%d)",
+				 oh_node->full_name, cell_idx_host,
+				 FMAN_MAX_MAC_IDX_NUM);
+			goto err;
+		}
+
 		__if->__if.mac_idx = cell_idx_host;
 	}
 
@@ -957,6 +968,14 @@ static int fman_if_init_onic(const struct device_node *dpa_node)
 	assert(lenp == sizeof(*cell_idx));
 
 	cell_idx_host = of_read_number(cell_idx, lenp / sizeof(phandle));
+
+	if (cell_idx_host >= FMAN_MAX_MAC_IDX_NUM) {
+		FMAN_ERR(-EINVAL, "%s: cell-index(%" PRIu64 ") >= max(%d)",
+			 tx_oh_node->full_name, cell_idx_host,
+			 FMAN_MAX_MAC_IDX_NUM);
+		goto err;
+	}
+
 	__if->__if.mac_idx = cell_idx_host;
 
 	fman_node = of_get_parent(fman_tx_oh_node);
diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h
index f642faf3b3..030c85c284 100644
--- a/drivers/bus/dpaa/include/fman.h
+++ b/drivers/bus/dpaa/include/fman.h
@@ -68,6 +68,11 @@
 #define FMAN_RTC_MAX_NUM_OF_PERIODIC_PULSES	4
 #define FMAN_RTC_MAX_NUM_OF_EXT_TRIGGERS	3
 
+/*
+ * Maximum number of MAC/offline port indexes.
+ */
+#define FMAN_MAX_MAC_IDX_NUM	11
+
 /* Represents the different flavour of network interface */
 enum fman_mac_type {
 	fman_offline_internal = 0,
@@ -475,7 +480,6 @@ struct __fman_if {
 	void *qmi_map;
 };
 
-#define MEMMAC_REG_OFFSET(reg) offsetof(struct memac_regs, reg)
 #define BMI_RX_REG_OFFSET(reg) offsetof(struct rx_bmi_regs, reg)
 #define BMI_TX_REG_OFFSET(reg) offsetof(struct tx_bmi_regs, reg)
 
diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c
index f77f9f333b..403e97ed2d 100644
--- a/drivers/net/dpaa/dpaa_flow.c
+++ b/drivers/net/dpaa/dpaa_flow.c
@@ -32,9 +32,12 @@ return &scheme_params->param.key_ext_and_hash.extract_array[hdr_idx];
 	SCH_EXT_HDR(scheme_params, hdr_idx).extract_by_hdr_type.full_field
 
 /* FMAN mac indexes mappings (0 is unused, first 8 are for 1G, next for 10G
- * ports).
+ * ports). Indexed by fman_if.mac_idx, which the bus validates against
+ * FMAN_MAX_MAC_IDX_NUM when deriving it from the device tree.
  */
 static const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1};
+static_assert(RTE_DIM(mac_idx) == FMAN_MAX_MAC_IDX_NUM,
+	"mac_idx[] out of sync with FMAN_MAX_MAC_IDX_NUM");
 
 /* FM global info */
 struct dpaa_fm_info {
-- 
2.25.1


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

* [PATCH v5 2/4] drivers: add offline (O/H) port device support
  2026-11-17  5:45       ` [PATCH v5 " Gagandeep Singh
  2026-11-17  5:45         ` [PATCH v5 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
@ 2026-11-17  5:45         ` Gagandeep Singh
  2026-11-17  5:45         ` [PATCH v5 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
                           ` (2 subsequent siblings)
  4 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-17  5:45 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, Gagandeep Singh

Add support for the DPAA Offline/Host-command (O/H) port, allowing a
single OL port to be used by a DPDK application. The port is created
by passing "-a dpaa_bus:oldev1" (plus any devargs) on the EAL command
line, and the associated back-half port is named through the
'drv_bh_port' device argument.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/api/doxy-api-index.md                |   1 +
 doc/guides/nics/dpaa.rst                 |  32 +
 doc/guides/rel_notes/release_26_11.rst   |  10 +
 drivers/bus/dpaa/bus_dpaa_driver.h       |   4 +-
 drivers/bus/dpaa/dpaa_bus.c              |  68 +-
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   1 +
 drivers/bus/dpaa/include/fsl_qman.h      |   1 +
 drivers/net/dpaa/dpaa_ethdev.h           |  12 +
 drivers/net/dpaa/dpaa_oldev.c            | 959 +++++++++++++++++++++++
 drivers/net/dpaa/meson.build             |  11 +-
 drivers/net/dpaa/rte_pmd_dpaa_oldev.h    | 198 +++++
 11 files changed, 1281 insertions(+), 16 deletions(-)
 create mode 100644 drivers/net/dpaa/dpaa_oldev.c
 create mode 100644 drivers/net/dpaa/rte_pmd_dpaa_oldev.h

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 62390f7be3..0bd8e1bbf0 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -53,6 +53,7 @@ The public API headers are grouped by topics:
   [cnxk_eventdev](@ref rte_pmd_cnxk_eventdev.h),
   [cnxk_mempool](@ref rte_pmd_cnxk_mempool.h),
   [dpaa](@ref rte_pmd_dpaa.h),
+  [dpaa_oldev](@ref rte_pmd_dpaa_oldev.h),
   [dpaa2](@ref rte_pmd_dpaa2.h),
   [mlx5](@ref rte_pmd_mlx5.h),
   [dpaa2_mempool](@ref rte_dpaa2_mempool.h),
diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst
index c6aab46828..7658e6d454 100644
--- a/doc/guides/nics/dpaa.rst
+++ b/doc/guides/nics/dpaa.rst
@@ -276,6 +276,38 @@ Refer to the document :doc:`build_and_test` for details.
   and thus disabling hardware based packet handling at driver level,
   e.g. ``dpaa:fm1-mac3,recv_err_pkts=1``.
 
+``drv_bh_port``
+   Name of the back-half port associated with an offline (O/H) port device.
+   It is passed on the offline port device itself, which is named
+   ``oldev1``, e.g. ``-a dpaa_bus:oldev1,drv_bh_port=fm1-mac5``.
+
+The DPAA offline (O/H) port device is only created, and therefore only
+probed, when it is explicitly named on the EAL ``-a`` command line, e.g.::
+
+   -a dpaa_bus:oldev1,drv_bh_port=fm1-mac5
+
+Passing any ``-a`` argument for the DPAA bus switches the bus to allowlist
+scan mode, so from that point on only the devices named with ``-a`` are
+probed. Using the offline port therefore requires listing the offline port
+itself and every Ethernet port the application needs, for example::
+
+   -a dpaa_bus:oldev1,drv_bh_port=fm1-mac5 \
+   -a dpaa_bus:fm1-mac5 -a dpaa_bus:fm1-mac6
+
+Omitting an ``fmX-macY`` port in that case silently drops that port.
+
+The offline port requires the ``/dev/cdx_ctrl`` kernel control device to be
+present; it is provided by the NXP vendor ``cdx`` kernel driver, which is
+not part of this DPDK driver and must be obtained and loaded separately
+(see the NXP LSDK release matching the DPAA SoC family). The uplink
+classification and local-gateway (LGW) configuration exposed through that
+control device can be programmed by the application, for the offline
+port identified by its ``port_id``, via the experimental
+``rte_pmd_dpaa_ol_set_classif_info()``, ``rte_pmd_dpaa_ol_reset_classif_info()``,
+``rte_pmd_dpaa_ol_set_lgw_info()`` and ``rte_pmd_dpaa_ol_reset_lgw_info()``
+APIs declared in ``rte_pmd_dpaa_oldev.h``.
+
+
 FMAN Config
 -----------
 
diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
index e2b524ac0e..6c8ce83ce1 100644
--- a/doc/guides/rel_notes/release_26_11.rst
+++ b/doc/guides/rel_notes/release_26_11.rst
@@ -210,6 +210,16 @@ New Features
   * Increased the maximum number of secondary unicast MAC addresses from 128 to up to 4096
     (depending on devlink configuration on the associated kernel netdevice).
 
+* **Added NXP DPAA offline (O/H) port support.**
+
+  Added a DPAA offline (O/H) port type that loops Rx/Tx frame queues through
+  the FMAN and exposes them as a DPDK port, with uplink classification and
+  LGW subnet configuration forwarded to the ASK/CDX kernel module via the
+  experimental ``rte_pmd_dpaa_ol_set_classif_info()``,
+  ``rte_pmd_dpaa_ol_reset_classif_info()``, ``rte_pmd_dpaa_ol_set_lgw_info()``
+  and ``rte_pmd_dpaa_ol_reset_lgw_info()`` APIs declared in
+  ``rte_pmd_dpaa_oldev.h``.
+
 * **Updated NXP DPAA drivers.**
 
   * Changed the default number of Rx queues in FMCLESS mode
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index 4aed83f84d..323a6a7659 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -69,11 +69,13 @@ struct rte_dpaa_driver;
 enum rte_dpaa_type {
 	FSL_DPAA_ETH = 1,
 	FSL_DPAA_CRYPTO,
-	FSL_DPAA_QDMA
+	FSL_DPAA_QDMA,
+	FSL_DPAA_OL
 };
 
 struct dpaa_device_id {
 	uint8_t fman_id; /**< Fman interface ID, for ETH type device */
+	uint8_t ol_id;	/**< OH interface ID, for OH type device */
 	uint8_t mac_id; /**< Fman MAC interface ID, for ETH type device */
 	uint16_t dev_id; /**< Device Identifier from DPDK */
 };
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index cbbeb927fe..5c42d80d7f 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -34,6 +34,8 @@
 #include <bus_driver.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_mbuf_dyn.h>
+#include <rte_kvargs.h>
+#include <rte_devargs.h>
 
 #include <dpaa_of.h>
 #include <bus_dpaa_driver.h>
@@ -68,6 +70,12 @@ struct rte_dpaa_bus_private {
 	RTE_ATOMIC(uint16_t) push_rxq_num;
 };
 
+/* Name of the single offline (O/H) port device. The device is only
+ * created, and thus only probed, if the application explicitly lists it
+ * with "-a dpaa_bus:oldev1" (or an equivalent devargs form).
+ */
+#define DPAA_OLDEV_NAME	"oldev1"
+
 static struct rte_bus rte_dpaa_bus;
 static struct rte_dpaa_bus_private dpaa_bus;
 static struct netcfg_info *dpaa_netcfg;
@@ -205,8 +213,44 @@ dpaa_create_device_list(void)
 	struct fm_eth_port_cfg *cfg;
 	struct fman_if *fman_intf;
 
+	struct rte_devargs *oldev_devargs;
+
 	dpaa_bus.device_count = 0;
 
+	/* The offline port is only created if the application explicitly
+	 * asked for it with "-a dpaa_bus:oldev1" (plus any devargs), e.g.
+	 * when the device is created without a backing devargs entry it
+	 * would never be probed, so avoid creating it at all.
+	 */
+	oldev_devargs = rte_bus_find_devargs(&rte_dpaa_bus, DPAA_OLDEV_NAME);
+
+	if (!dpaa_netcfg && !oldev_devargs)
+		return 0;
+
+	/* Creating OL Device */
+	if (oldev_devargs) {
+		dev = calloc(1, sizeof(struct rte_dpaa_device));
+		if (!dev) {
+			DPAA_BUS_ERR("Failed to allocate OL devices");
+			return -ENOMEM;
+		}
+
+		dev->device_type = FSL_DPAA_OL;
+		dev->id.ol_id = 0;
+		dev->id.dev_id = dpaa_bus.device_count;
+
+		/* Create device name */
+		snprintf(dev->name, RTE_ETH_NAME_MAX_LEN, "oldev%d",
+			 (dev->id.ol_id + 1));
+		DPAA_BUS_INFO("%s oldev added", dev->name);
+		dev->device.name = dev->name;
+		dev->device.devargs = oldev_devargs;
+		DPAA_BUS_INFO("**Devargs matched %s", dev->name);
+
+		dpaa_add_to_device_list(dev);
+		dpaa_bus.device_count++;
+	}
+
 	/* Creating Ethernet Devices */
 	for (i = 0; dpaa_netcfg && (i < dpaa_netcfg->num_ethports); i++) {
 		dev = calloc(1, sizeof(struct rte_dpaa_device));
@@ -276,8 +320,7 @@ dpaa_create_device_list(void)
 		 * crypto PMD, using RTE_ETH_NAME_MAX_LEN as that is the size
 		 * allocated for dev->name/
 		 */
-		memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN);
-		sprintf(dev->name, "dpaa_sec-%d", i+1);
+		snprintf(dev->name, RTE_ETH_NAME_MAX_LEN, "dpaa_sec-%d", i + 1);
 		DPAA_BUS_INFO("%s cryptodev added", dev->name);
 		dev->device.name = dev->name;
 		dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus, dev->name);
@@ -302,8 +345,7 @@ dpaa_create_device_list(void)
 		dev->device_type = FSL_DPAA_QDMA;
 		dev->id.dev_id = dpaa_bus.device_count + i;
 
-		memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN);
-		sprintf(dev->name, "dpaa_qdma-%d", i+1);
+		snprintf(dev->name, RTE_ETH_NAME_MAX_LEN, "dpaa_qdma-%d", i + 1);
 		DPAA_BUS_INFO("%s qdma device added", dev->name);
 		dev->device.name = dev->name;
 		dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus, dev->name);
@@ -482,7 +524,7 @@ rte_dpaa_bus_parse(const char *name, void *out)
 	}
 
 	/* dev_delta points to the dev name (mac/oh/onic). Not valid for
-	 * dpaa_sec.
+	 * dpaa_sec and oldev.
 	 */
 	dev_delta = delta + sizeof("fm.-") - 1;
 
@@ -496,6 +538,10 @@ rte_dpaa_bus_parse(const char *name, void *out)
 				i < 1 || i > RTE_DPAA_QDMA_DEVICES)
 			return -EINVAL;
 		max_name_len = sizeof("dpaa_qdma-.") - 1;
+	} else if (strncmp("oldev", &name[delta], 5) == 0) {
+		if (sscanf(&name[delta], "oldev%u", &i) != 1 || i != 1)
+			return -EINVAL;
+		max_name_len = sizeof("oldev.") - 1;
 	} else if (strncmp("oh", &name[dev_delta], 2) == 0) {
 		if (sscanf(&name[delta], "fm%u-oh%u", &i, &j) != 2 ||
 				i >= 2 || j >= 16)
@@ -593,7 +639,8 @@ rte_dpaa_bus_dev_build(void)
 
 	/* Get the interface configurations from device-tree */
 	dpaa_netcfg = netcfg_acquire();
-	if (!dpaa_netcfg) {
+	if (!dpaa_netcfg &&
+	    !rte_bus_find_devargs(&rte_dpaa_bus, DPAA_OLDEV_NAME)) {
 		DPAA_BUS_ERR("netcfg failed: /dev/fsl_usdpaa device not available");
 		DPAA_BUS_WARN("Check if you are using USDPAA based device tree");
 		return -EINVAL;
@@ -601,17 +648,18 @@ rte_dpaa_bus_dev_build(void)
 
 	DPAA_BUS_NOTICE("DPAA Bus Detected");
 
-	if (!dpaa_netcfg->num_ethports) {
+	if (dpaa_netcfg && !dpaa_netcfg->num_ethports) {
 		DPAA_BUS_INFO("NO DPDK mapped net interfaces available");
 		/* This is not an error */
 	}
 
+	if (dpaa_netcfg) {
 #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
-	dump_netcfg(dpaa_netcfg, stdout);
+		dump_netcfg(dpaa_netcfg, stdout);
 #endif
-
-	DPAA_BUS_DEBUG("Number of ethernet devices = %d",
+		DPAA_BUS_DEBUG("Number of ethernet devices = %d",
 			     dpaa_netcfg->num_ethports);
+	}
 	ret = dpaa_create_device_list();
 	if (ret) {
 		DPAA_BUS_ERR("Unable to create device list. (%d)", ret);
diff --git a/drivers/bus/dpaa/dpaa_bus_base_symbols.c b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
index 0927e5fe2c..aaa9f9bec2 100644
--- a/drivers/bus/dpaa/dpaa_bus_base_symbols.c
+++ b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
@@ -52,6 +52,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(bman_acquire)
 RTE_EXPORT_INTERNAL_SYMBOL(bman_query_free_buffers)
 RTE_EXPORT_INTERNAL_SYMBOL(bman_thread_irq)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_fqid_range)
+RTE_EXPORT_INTERNAL_SYMBOL(qman_release_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_reserve_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_pool_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_cgrid_range)
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index 59b41e17f0..b2674ce5d0 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1895,6 +1895,7 @@ static inline int qman_alloc_fqid(u32 *result)
  * This function can also be used to seed the allocator with ranges of FQIDs
  * that it can subsequently allocate from.
  */
+__rte_internal
 void qman_release_fqid_range(u32 fqid, unsigned int count);
 static inline void qman_release_fqid(u32 fqid)
 {
diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h
index 47c8e2b086..c7f9184810 100644
--- a/drivers/net/dpaa/dpaa_ethdev.h
+++ b/drivers/net/dpaa/dpaa_ethdev.h
@@ -114,6 +114,10 @@ enum {
 
 #define DPAA_DEFAULT_RXQ_VSP_ID		1
 
+/* Device argument to name the offline (O/H) port back-half port */
+#define DRIVER_OL_BH_PORT		"drv_bh_port"
+#define DPAA_OL_MAX_BH_PORT_NAME_LEN	12
+
 #define FMC_FILE "/tmp/fmc.bin"
 
 struct dpaa_if_vsp {
@@ -173,6 +177,14 @@ struct dpaa_if {
 	struct qman_fq *next_tx_conf_queue;
 
 	struct dpaa_if_vsp vsp[DPAA_VSP_PROFILE_MAX_NUM];
+
+	/* Control device fd, used by the offline port PMD only. */
+	int ol_fd;
+	/* Backhaul port name from the drv_bh_port devarg, used by the
+	 * offline port PMD only.
+	 */
+	char ol_bh_port_name[DPAA_OL_MAX_BH_PORT_NAME_LEN];
+	bool ol_fq_info_set;
 };
 
 struct dpaa_if_stats {
diff --git a/drivers/net/dpaa/dpaa_oldev.c b/drivers/net/dpaa/dpaa_oldev.c
new file mode 100644
index 0000000000..c2539ed36a
--- /dev/null
+++ b/drivers/net/dpaa/dpaa_oldev.c
@@ -0,0 +1,959 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2026 NXP
+ */
+
+#include <stdio.h>
+#include <sys/ioctl.h>
+
+#include <rte_dpaa_logs.h>
+#include <rte_kvargs.h>
+
+#include <rte_string_fns.h>
+#include <bus_dpaa_driver.h>
+#include <dpaa_ethdev.h>
+#include <dpaa_rxtx.h>
+#include <dpaa_mempool.h>
+
+#include <eal_export.h>
+#include <fsl_fman.h>
+
+#include "rte_pmd_dpaa_oldev.h"
+
+/* The ol device is a tx are queue pair, which is provided to the kernel through
+ * ioctl calls. It is exposed as a virtual port to the application.
+ * This ASK Device provides IOCTL calls to driver for communicating fqid's,
+ * buffer pool id's and channel id's with kernel.
+ */
+#define ASK_PATH		"/dev/cdx_ctrl"
+#define CDX_IOC_MAGIC		0xbe
+
+/* Private area reserved by driver.
+ * Aligned with "struct annotations_t". Parse results will be written from
+ * the 17th byte by the HW.
+ */
+#define DPAA_OL_PARSERSLT_START_OFFSET 16
+#define DPAA_OL_DATA_ALIGNMENT 64
+/* Change this value to increase the data offset.
+ * final value will be aligned by DPAA_OL_DATA_ALIGNMENT
+ */
+#define DPAA_OL_MAX_EXTRA_SIZE 0
+#define DPAA_OL_PARSE_RESULT_REQUIRED true
+#define DPAA_OL_TIME_STAMP_REQUIRED false
+#define DPAA_OL_HASH_RESULT_REQUIRED false
+#define DPAA_OL_PCD_INFO_REQUIRED false
+
+/* Work queue ID used for the offline port ingress sequence classifier. */
+#define DPA_ISC_WQ_ID 2
+
+static const struct eth_dev_ops dpaa_ol_devops;
+
+struct ask_ctrl_offline_channel {
+	uint32_t channel_id;
+	uint32_t ctx_a_hi_val;	/* Setting required flags(B0,A2) while creating
+				 * frame queue.
+				 */
+	uint32_t ctx_a_lo_val;	/* EBD and VSP enable bits */
+	uint32_t ctx_b_val;	/* VSP ID */
+};
+
+struct ask_ctrl_dpdk_fq_info_s {
+	uint32_t tx_fq_id;		/* DPDK transmits GTP packets using FQ
+					 * ID
+					 */
+	uint32_t rx_fq_id;		/* DPDK receives packets from FMAN */
+	uint16_t buff_size;		/* Size of each buffer in DPDPK buffer
+					 * pool
+					 */
+	uint8_t bp_id;			/* DPDK buffer pool id */
+	/* BH port interface name; set from the mandatory drv_bh_port
+	 * devarg (see DRIVER_OL_BH_PORT).
+	 */
+	uint8_t bh_port_name[DPAA_OL_MAX_BH_PORT_NAME_LEN];
+	uint8_t pad0;
+	/* below fields are taken from structure t_FmBufferPrefixContent, These
+	 * fields are required for VSP creation on DPDK buffer pool ID. These
+	 * fields should be set based on expected parameters from FMAN
+	 */
+	uint16_t privDataSize;		/* Number of bytes to be left at the
+					 * beginning of the external buffer;
+					 * Note that the private-area will start
+					 * from the base of the buffer address.
+					 */
+	uint8_t passPrsResult;		/* TRUE to pass the parse result to/from
+					 * the FM; User may use
+					 * FM_PORT_GetBufferPrsResult() in order
+					 * to get the parser-result from a
+					 * buffer.
+					 */
+	uint8_t passTimeStamp;		/* < TRUE to pass the timeStamp to/from
+					 * the FM User may use
+					 * FM_PORT_GetBufferTimeStamp() in order
+					 * to get the parser-result from a
+					 * buffer.
+					 */
+	uint8_t passHashResult;		/* TRUE to pass the KG hash result
+					 * to/from the FM User may use
+					 * FM_PORT_GetBufferHashResult() in
+					 * order to get the parser-result from a
+					 * buffer.
+					 */
+	uint8_t passAllOtherPCDInfo;	/* Add all other Internal-Context
+					 * information: AD, hash-result, key,
+					 * etc.
+					 */
+	uint16_t dataAlign;		/* 0 to use driver's default alignment
+					 * [DEFAULT_FM_SP_bufferPrefixContent_dataAlign],
+					 * other value for selecting a data
+					 * alignment (must be a power of 2); if
+					 * write optimization is used, must be
+					 * >= 16.
+					 */
+	uint8_t manipExtraSpace;	/* Maximum extra size needed (insertion-
+					 * size minus removal-size); Note that
+					 * this field impacts the size of the
+					 * buffer-prefix (i.e. it pushes the
+					 * data offset); This field is
+					 * irrelevant if DPAA_VERSION==10
+					 */
+	uint8_t pad1[3];
+};
+
+/* Layout is shared with the CDX kernel module. */
+static_assert(sizeof(struct ask_ctrl_offline_channel) == 16,
+	      "ask_ctrl_offline_channel ABI changed");
+static_assert(sizeof(struct ask_ctrl_dpdk_fq_info_s) == 36,
+	      "ask_ctrl_dpdk_fq_info_s ABI changed");
+static_assert(sizeof(struct rte_pmd_dpaa_uplink_cls_info_s) == 44,
+	      "rte_pmd_dpaa_uplink_cls_info_s ABI changed");
+static_assert(sizeof(struct rte_pmd_dpaa_lgw_info_s) == 84,
+	      "rte_pmd_dpaa_lgw_info_s ABI changed");
+
+#define ASK_CTRL_GET_OFFLINE_CHANNEL_INFO \
+	_IOWR(CDX_IOC_MAGIC, 8, struct ask_ctrl_offline_channel)
+#define ASK_CTRL_SET_DPDK_INFO \
+	_IOWR(CDX_IOC_MAGIC, 9, struct ask_ctrl_dpdk_fq_info_s)
+#define ASK_CTRL_SET_CLASSIF_INFO \
+	_IOWR(CDX_IOC_MAGIC, 10, struct rte_pmd_dpaa_uplink_cls_info_s)
+#define ASK_CTRL_RESET_CLASSIF_INFO \
+	_IOWR(CDX_IOC_MAGIC, 11, struct rte_pmd_dpaa_uplink_cls_info_s)
+#define ASK_CTRL_SET_LGW_INFO \
+	_IOWR(CDX_IOC_MAGIC, 12, struct rte_pmd_dpaa_lgw_info_s)
+#define ASK_CTRL_RESET_LGW_INFO \
+	_IOWR(CDX_IOC_MAGIC, 13, struct rte_pmd_dpaa_lgw_info_s)
+/* Tells the kernel the Tx/Rx FQIDs set via ASK_CTRL_SET_DPDK_INFO are
+ * being torn down.
+ */
+#define ASK_CTRL_RESET_DPDK_INFO \
+	_IOWR(CDX_IOC_MAGIC, 14, struct ask_ctrl_dpdk_fq_info_s)
+
+/* Validate port_id and return the rte_eth_dev if it belongs to this driver. */
+static struct rte_eth_dev *
+dpaa_ol_get_port(uint16_t port_id)
+{
+	struct rte_eth_dev *dev;
+
+	if (!rte_eth_dev_is_valid_port(port_id)) {
+		DPAA_PMD_ERR("Port %u is not a valid port", port_id);
+		return NULL;
+	}
+
+	dev = &rte_eth_devices[port_id];
+	if (dev->dev_ops != &dpaa_ol_devops) {
+		DPAA_PMD_ERR("Port %u is not a DPAA offline (O/H) port", port_id);
+		return NULL;
+	}
+
+	return dev;
+}
+
+static int check_fd(struct dpaa_if *dpaa_intf)
+{
+	return (dpaa_intf->ol_fd >= 0) ? dpaa_intf->ol_fd : -ENODEV;
+}
+
+static int ask_get_channel_info(struct dpaa_if *dpaa_intf,
+				 struct ask_ctrl_offline_channel *ch_info)
+{
+	int ret, fd = check_fd(dpaa_intf);
+
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_GET_OFFLINE_CHANNEL_INFO, ch_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Get channel info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Get channel info successful");
+	DPAA_PMD_DEBUG("Channel id: %x", ch_info->channel_id);
+	DPAA_PMD_DEBUG("ctx_a_hi_val: %x", ch_info->ctx_a_hi_val);
+	DPAA_PMD_DEBUG("ctx_a_lo_val: %x", ch_info->ctx_a_lo_val);
+	DPAA_PMD_DEBUG("ctx_b_val: %x", ch_info->ctx_b_val);
+
+	return 0;
+}
+
+static int ask_set_fq_info(struct dpaa_if *dpaa_intf,
+			    struct ask_ctrl_dpdk_fq_info_s *fq_info)
+{
+	int ret, fd = check_fd(dpaa_intf);
+
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_DPDK_INFO, fq_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set FQ info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set fq info successful");
+	DPAA_PMD_DEBUG("Tx fqid: %x", fq_info->tx_fq_id);
+	DPAA_PMD_DEBUG("Rx fqid: %x", fq_info->rx_fq_id);
+	DPAA_PMD_DEBUG("buff_size: %d", fq_info->buff_size);
+	DPAA_PMD_DEBUG("bp_id: %d", fq_info->bp_id);
+	DPAA_PMD_DEBUG("Backhaul port name: %s", fq_info->bh_port_name);
+
+	return 0;
+}
+
+static int ask_reset_fq_info(struct dpaa_if *dpaa_intf,
+			      struct ask_ctrl_dpdk_fq_info_s *fq_info)
+{
+	int ret, fd = check_fd(dpaa_intf);
+
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_RESET_DPDK_INFO, fq_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Reset FQ info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Reset fq info successful");
+
+	return 0;
+}
+
+static int
+dpaa_ol_dev_configure(__rte_unused struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+static int dpaa_ol_dev_info(struct rte_eth_dev *dev,
+			    struct rte_eth_dev_info *dev_info)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+
+	PMD_INIT_FUNC_TRACE();
+
+	dev_info->max_rx_queues = dpaa_intf->nb_rx_queues;
+	dev_info->max_tx_queues = dpaa_intf->nb_tx_queues;
+	dev_info->max_rx_pktlen = DPAA_MAX_RX_PKT_LEN;
+	dev_info->max_mac_addrs = DPAA_MAX_MAC_FILTER;
+	dev_info->max_hash_mac_addrs = 0;
+	dev_info->max_vfs = 0;
+
+	dev_info->speed_capa = RTE_ETH_LINK_SPEED_10M_HD |
+			       RTE_ETH_LINK_SPEED_10M |
+			       RTE_ETH_LINK_SPEED_100M_HD |
+			       RTE_ETH_LINK_SPEED_100M |
+			       RTE_ETH_LINK_SPEED_1G |
+			       RTE_ETH_LINK_SPEED_2_5G |
+			       RTE_ETH_LINK_SPEED_10G;
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_set_classif_info, 26.11)
+int rte_pmd_dpaa_ol_set_classif_info(uint16_t port_id,
+		struct rte_pmd_dpaa_uplink_cls_info_s *classif_info)
+{
+	struct rte_eth_dev *dev;
+	struct dpaa_if *dpaa_intf;
+	int i, ret, fd;
+
+	if (classif_info == NULL) {
+		DPAA_PMD_ERR("No classification data available");
+		return -EINVAL;
+	}
+
+	dev = dpaa_ol_get_port(port_id);
+	if (dev == NULL)
+		return -ENODEV;
+	dpaa_intf = dev->data->dev_private;
+
+	fd = check_fd(dpaa_intf);
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_CLASSIF_INFO, classif_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set classification info ioctl failed with errno: %s",
+			     strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set classification info successful");
+	for (i = 0; i < classif_info->num_ports; i++) {
+		DPAA_PMD_DEBUG("UDP dest port: %d",
+			       classif_info->gtp_udp_port[i]);
+	}
+	DPAA_PMD_DEBUG("Protocol ID: %d", classif_info->gtp_proto_id);
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_reset_classif_info, 26.11)
+int rte_pmd_dpaa_ol_reset_classif_info(uint16_t port_id)
+{
+	struct rte_pmd_dpaa_uplink_cls_info_s classif_info;
+	struct rte_eth_dev *dev;
+	struct dpaa_if *dpaa_intf;
+	int ret, fd;
+
+	dev = dpaa_ol_get_port(port_id);
+	if (dev == NULL)
+		return -ENODEV;
+	dpaa_intf = dev->data->dev_private;
+
+	fd = check_fd(dpaa_intf);
+	if (fd < 0)
+		return fd;
+
+	memset(&classif_info, 0, sizeof(classif_info));
+
+	ret = ioctl(fd, ASK_CTRL_RESET_CLASSIF_INFO, &classif_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Reset classification info ioctl failed with errno: %s",
+			     strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Reset classification info successful");
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_set_lgw_info, 26.11)
+int rte_pmd_dpaa_ol_set_lgw_info(uint16_t port_id,
+		struct rte_pmd_dpaa_lgw_info_s *lgw_info)
+{
+	struct rte_eth_dev *dev;
+	struct dpaa_if *dpaa_intf;
+	int ret, fd;
+
+	if (lgw_info == NULL) {
+		DPAA_PMD_ERR("No LGW data available");
+		return -EINVAL;
+	}
+
+	dev = dpaa_ol_get_port(port_id);
+	if (dev == NULL)
+		return -ENODEV;
+	dpaa_intf = dev->data->dev_private;
+
+	fd = check_fd(dpaa_intf);
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASK_CTRL_SET_LGW_INFO, lgw_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Set LGW info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Set LGW info successful");
+
+	return 0;
+}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dpaa_ol_reset_lgw_info, 26.11)
+int rte_pmd_dpaa_ol_reset_lgw_info(uint16_t port_id)
+{
+	struct rte_pmd_dpaa_lgw_info_s lgw_info;
+	struct rte_eth_dev *dev;
+	struct dpaa_if *dpaa_intf;
+	int ret, fd;
+
+	PMD_INIT_FUNC_TRACE();
+
+	dev = dpaa_ol_get_port(port_id);
+	if (dev == NULL)
+		return -ENODEV;
+	dpaa_intf = dev->data->dev_private;
+
+	fd = check_fd(dpaa_intf);
+	if (fd < 0)
+		return fd;
+
+	memset(&lgw_info, 0, sizeof(lgw_info));
+
+	ret = ioctl(fd, ASK_CTRL_RESET_LGW_INFO, &lgw_info);
+	if (ret) {
+		int err = errno;
+
+		/* Save errno first: the log call may overwrite it. */
+		DPAA_PMD_ERR("Reset LGW info ioctl failed with errno: %s", strerror(err));
+		return -err;
+	}
+
+	DPAA_PMD_DEBUG("Reset LGW info successful");
+
+	return 0;
+}
+
+static int
+dpaa_ol_get_bh_port_name(struct rte_devargs *devargs, char *val, size_t size);
+
+static int dpaa_ol_set_fq_info(struct rte_eth_dev *dev);
+
+static int dpaa_ol_dev_start(struct rte_eth_dev *dev)
+{
+	int ret;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Done in dev_start() since Rx/Tx queue setup order is not guaranteed. */
+	ret = dpaa_ol_set_fq_info(dev);
+	if (ret)
+		return ret;
+
+	dev->tx_pkt_burst = dpaa_eth_queue_tx;
+
+	return 0;
+}
+
+static int dpaa_ol_reset_fq_info(struct dpaa_if *dpaa_intf)
+{
+	struct ask_ctrl_dpdk_fq_info_s fq_info;
+	int ret;
+
+	if (!dpaa_intf->ol_fq_info_set)
+		return 0;
+
+	memset(&fq_info, 0, sizeof(fq_info));
+	if (dpaa_intf->tx_queues && dpaa_intf->nb_tx_queues)
+		fq_info.tx_fq_id = dpaa_intf->tx_queues[0].fqid;
+	if (dpaa_intf->rx_queues && dpaa_intf->nb_rx_queues)
+		fq_info.rx_fq_id = dpaa_intf->rx_queues[0].fqid;
+
+	ret = ask_reset_fq_info(dpaa_intf, &fq_info);
+	if (ret == 0)
+		dpaa_intf->ol_fq_info_set = false;
+
+	return ret;
+}
+
+static int dpaa_ol_dev_stop(struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
+
+	return dpaa_ol_reset_fq_info(dev->data->dev_private);
+}
+
+static void dpaa_oldev_queues_release(struct dpaa_if *dpaa_intf);
+
+static int dpaa_ol_dev_close(struct rte_eth_dev *dev)
+{
+	struct dpaa_if *dpaa_intf;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	dpaa_intf = dev->data->dev_private;
+	if (!dpaa_intf)
+		return 0;
+
+	/* Shut down FQs and free queue memory. */
+	dpaa_oldev_queues_release(dpaa_intf);
+
+	if (dpaa_intf->ol_fd >= 0) {
+		close(dpaa_intf->ol_fd);
+		dpaa_intf->ol_fd = -1;
+	}
+
+	return 0;
+}
+
+static inline void
+dpaa_poll_queue_default_config(struct qm_mcc_initfq *opts)
+{
+	memset(opts, 0, sizeof(struct qm_mcc_initfq));
+	opts->we_mask = QM_INITFQ_WE_CONTEXTA;
+	opts->fqd.fq_ctrl = QM_FQCTRL_AVOIDBLOCK | QM_FQCTRL_CTXASTASHING |
+			    QM_FQCTRL_PREFERINCACHE;
+	opts->fqd.context_a.stashing.exclusive = 0;
+	if (dpaa_soc_ver() != SVR_LS1046A_FAMILY)
+		opts->fqd.context_a.stashing.annotation_cl =
+				DPAA_IF_RX_ANNOTATION_STASH;
+	opts->fqd.context_a.stashing.data_cl = DPAA_IF_RX_DATA_STASH;
+	opts->fqd.context_a.stashing.context_cl = DPAA_IF_RX_CONTEXT_STASH;
+}
+
+static
+int dpaa_ol_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
+			    __rte_unused uint16_t nb_desc,
+			    unsigned int socket_id __rte_unused,
+			    __rte_unused const struct rte_eth_rxconf *rx_conf,
+			    struct rte_mempool *mp)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct qman_fq *rxq = &dpaa_intf->rx_queues[queue_idx];
+
+	PMD_INIT_FUNC_TRACE();
+
+	dpaa_intf->bp_info = DPAA_MEMPOOL_TO_POOL_INFO(mp);
+	dpaa_intf->valid = 1;
+
+	if (!rte_dpaa_bpid_info) {
+		DPAA_PMD_ERR("BPID info array not initialized");
+		return -ENOMEM;
+	}
+	rxq->bp_array = rte_dpaa_bpid_info;
+	dev->data->rx_queues[queue_idx] = rxq;
+
+	return 0;
+}
+
+static int
+dpaa_ol_get_bh_port_name(struct rte_devargs *devargs, char *val, size_t size)
+{
+	static const char * const valid_keys[] = { DRIVER_OL_BH_PORT, NULL };
+	struct rte_kvargs *kvlist;
+	const char *str;
+	int ret;
+
+	if (!devargs || !devargs->args)
+		return 0;
+
+	kvlist = rte_kvargs_parse(devargs->args, valid_keys);
+	if (!kvlist) {
+		DPAA_PMD_ERR("Invalid devargs for offline port \"%s\"",
+			     devargs->args);
+		return -EINVAL;
+	}
+
+	if (!rte_kvargs_count(kvlist, DRIVER_OL_BH_PORT)) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	str = rte_kvargs_get(kvlist, DRIVER_OL_BH_PORT);
+	if (str == NULL) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	ret = rte_strscpy(val, str, size);
+	rte_kvargs_free(kvlist);
+	if (ret < 0)
+		return ret;
+
+	return 1;
+}
+
+static
+int dpaa_ol_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
+			   uint16_t nb_desc __rte_unused,
+			   unsigned int socket_id __rte_unused,
+			   const struct rte_eth_txconf *tx_conf __rte_unused)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct qman_fq *txq = &dpaa_intf->tx_queues[queue_idx];
+
+	PMD_INIT_FUNC_TRACE();
+
+	dev->data->tx_queues[queue_idx] = txq;
+
+	return 0;
+}
+
+static int dpaa_ol_set_fq_info(struct rte_eth_dev *dev)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct ask_ctrl_dpdk_fq_info_s fq_info;
+	struct qman_fq *txq, *rxq;
+	struct rte_pktmbuf_pool_private *mbp_priv;
+	int ret;
+
+	if (dpaa_intf->rx_queues == NULL || dpaa_intf->tx_queues == NULL) {
+		DPAA_PMD_ERR("Rx/Tx queues not allocated");
+		return -EINVAL;
+	}
+
+	if (dpaa_intf->bp_info == NULL) {
+		DPAA_PMD_ERR("Rx queue must be set up before starting the port");
+		return -EINVAL;
+	}
+
+	txq = &dpaa_intf->tx_queues[0];
+	rxq = &dpaa_intf->rx_queues[0];
+	memset(&fq_info, 0, sizeof(fq_info));
+	mbp_priv = (struct rte_pktmbuf_pool_private *)rte_mempool_get_priv(dpaa_intf->bp_info->mp);
+	fq_info.tx_fq_id = txq->fqid;
+	fq_info.rx_fq_id = rxq->fqid;
+	fq_info.buff_size = mbp_priv->mbuf_data_room_size;
+	fq_info.bp_id = dpaa_intf->bp_info->bpid;
+
+	fq_info.privDataSize = DPAA_OL_PARSERSLT_START_OFFSET;
+	fq_info.passPrsResult = DPAA_OL_PARSE_RESULT_REQUIRED;
+	fq_info.passTimeStamp = DPAA_OL_TIME_STAMP_REQUIRED;
+	fq_info.passHashResult = DPAA_OL_HASH_RESULT_REQUIRED;
+	fq_info.passAllOtherPCDInfo = DPAA_OL_PCD_INFO_REQUIRED;
+	fq_info.dataAlign = DPAA_OL_DATA_ALIGNMENT;
+	fq_info.manipExtraSpace = DPAA_OL_MAX_EXTRA_SIZE;
+
+	memcpy(fq_info.bh_port_name, dpaa_intf->ol_bh_port_name,
+	       sizeof(fq_info.bh_port_name));
+
+	ret = ask_set_fq_info(dpaa_intf, &fq_info);
+	if (ret) {
+		DPAA_PMD_ERR("Set FQ info failed with ret: %d", ret);
+		return ret;
+	}
+	dpaa_intf->ol_fq_info_set = true;
+
+	return 0;
+}
+
+static int dpaa_ol_link_update(struct rte_eth_dev *dev,
+			       __rte_unused int wait_to_complete)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	struct rte_eth_link *link = &dev->data->dev_link;
+
+	PMD_INIT_FUNC_TRACE();
+
+	link->link_status = dpaa_intf->valid;
+	link->link_speed = RTE_ETH_SPEED_NUM_NONE;
+	link->link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+	link->link_autoneg = RTE_ETH_LINK_AUTONEG;
+
+	return 0;
+}
+
+static int dpaa_ol_promiscuous_enable(__rte_unused struct rte_eth_dev *dev)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	return 0;
+}
+
+static int dpaa_ol_rx_queue_init(struct qman_fq *fq, uint32_t fqid)
+{
+	int ret;
+	struct qm_mcc_initfq opts = {0};
+	u32 flags = QMAN_FQ_FLAG_DYNAMIC_FQID | QMAN_FQ_FLAG_NO_ENQUEUE;
+
+	if (unlikely(!DPAA_PER_LCORE_PORTAL)) {
+		ret = rte_dpaa_portal_init(NULL);
+		if (ret < 0) {
+			DPAA_PMD_ERR("portal initialization failure");
+			return ret;
+		}
+	}
+
+	ret = qman_create_fq(fqid, flags, fq);
+	if (ret) {
+		DPAA_PMD_ERR("create rx fqid 0x%x failed with ret: %d", fqid,
+			     ret);
+		return ret;
+	}
+	fq->is_static = false;
+
+	dpaa_poll_queue_default_config(&opts);
+
+	ret = qman_init_fq(fq, 0, &opts);
+	if (ret)
+		DPAA_PMD_ERR("init rx fqid 0x%x failed with ret:%d", fqid, ret);
+	return ret;
+}
+
+static int dpaa_ol_tx_queue_init(struct dpaa_if *dpaa_intf, struct qman_fq *fq,
+				  uint32_t fqid)
+{
+	int ret;
+	struct qm_mcc_initfq opts = {0};
+	u32 flags = QMAN_FQ_FLAG_DYNAMIC_FQID | QMAN_FQ_FLAG_TO_DCPORTAL;
+	struct ask_ctrl_offline_channel ch_info;
+
+	memset(&ch_info, 0, sizeof(ch_info));
+
+	ret = ask_get_channel_info(dpaa_intf, &ch_info);
+	if (ret) {
+		DPAA_PMD_ERR("Get channel info failed with ret: %d", ret);
+		return ret;
+	}
+	ret = qman_create_fq(fqid, flags, fq);
+	if (ret) {
+		DPAA_PMD_ERR("Create tx fq failed with ret: %d", ret);
+		return ret;
+	}
+
+	opts.we_mask = QM_INITFQ_WE_DESTWQ |
+		       QM_INITFQ_WE_CONTEXTB | QM_INITFQ_WE_CONTEXTA;
+
+	opts.fqd.dest.channel = ch_info.channel_id;
+	opts.fqd.dest.wq = DPA_ISC_WQ_ID;
+	opts.fqd.fq_ctrl = QM_FQCTRL_PREFERINCACHE;
+	opts.fqd.context_b = ch_info.ctx_b_val;
+	opts.fqd.context_a.hi = ch_info.ctx_a_hi_val;
+	opts.fqd.context_a.lo = ch_info.ctx_a_lo_val;
+
+	opts.fqid = fq->fqid;
+	fq->ch_id = ch_info.channel_id;
+	opts.count = 1;
+
+	ret = qman_init_fq(fq, QMAN_INITFQ_FLAG_SCHED, &opts);
+	if (ret)
+		DPAA_PMD_ERR("init tx fqid 0x%x failed %d", fq->fqid, ret);
+	return ret;
+}
+
+static const struct eth_dev_ops dpaa_ol_devops = {
+		.dev_configure            = dpaa_ol_dev_configure,
+		.dev_start                = dpaa_ol_dev_start,
+		.dev_stop                 = dpaa_ol_dev_stop,
+		.dev_close                = dpaa_ol_dev_close,
+		.dev_infos_get            = dpaa_ol_dev_info,
+
+		.rx_queue_setup           = dpaa_ol_rx_queue_setup,
+		.tx_queue_setup           = dpaa_ol_tx_queue_setup,
+
+		.link_update              = dpaa_ol_link_update,
+		.promiscuous_enable       = dpaa_ol_promiscuous_enable,
+};
+
+static void dpaa_oldev_queues_release(struct dpaa_if *dpaa_intf)
+{
+	uint16_t i;
+	int ret, reset_ret;
+	bool release_fqids;
+
+	/* Release FQIDs only if the kernel confirms it dropped them. */
+	release_fqids = true;
+	reset_ret = dpaa_ol_reset_fq_info(dpaa_intf);
+	if (reset_ret) {
+		DPAA_PMD_WARN("Reset FQ info failed with ret: %d, not releasing fqids",
+			      reset_ret);
+		release_fqids = false;
+	}
+
+	if (dpaa_intf->tx_queues) {
+		for (i = 0; i < dpaa_intf->nb_tx_queues; i++) {
+			if (!dpaa_intf->tx_queues[i].fqid)
+				continue;
+			ret = qman_shutdown_fq(&dpaa_intf->tx_queues[i]);
+			if (ret) {
+				DPAA_PMD_WARN("Failed(%d) to shutdown txq%d(0x%x), fqid not released",
+					      ret, i, dpaa_intf->tx_queues[i].fqid);
+				continue;
+			}
+			if (release_fqids)
+				qman_release_fqid(dpaa_intf->tx_queues[i].fqid);
+		}
+		rte_free(dpaa_intf->tx_queues);
+		dpaa_intf->tx_queues = NULL;
+		dpaa_intf->nb_tx_queues = 0;
+	}
+
+	if (dpaa_intf->rx_queues) {
+		for (i = 0; i < dpaa_intf->nb_rx_queues; i++) {
+			if (!dpaa_intf->rx_queues[i].fqid)
+				continue;
+			ret = qman_shutdown_fq(&dpaa_intf->rx_queues[i]);
+			if (ret) {
+				DPAA_PMD_WARN("Failed(%d) to shutdown rxq%d(0x%x), fqid not released",
+					      ret, i, dpaa_intf->rx_queues[i].fqid);
+				continue;
+			}
+			if (release_fqids)
+				qman_release_fqid(dpaa_intf->rx_queues[i].fqid);
+		}
+		rte_free(dpaa_intf->rx_queues);
+		dpaa_intf->rx_queues = NULL;
+		dpaa_intf->nb_rx_queues = 0;
+	}
+}
+
+static int dpaa_oldev_init(struct rte_eth_dev *eth_dev)
+{
+	int num_fqs, ret;
+	struct dpaa_if *dpaa_intf;
+
+	PMD_INIT_FUNC_TRACE();
+
+	num_fqs = DPAA_DEFAULT_NUM_PCD_QUEUES;
+	dpaa_intf = eth_dev->data->dev_private;
+	dpaa_intf->ifid = eth_dev->data->port_id;
+	dpaa_intf->ol_fd = open(ASK_PATH, O_RDWR | O_CLOEXEC);
+	if (dpaa_intf->ol_fd < 0) {
+		ret = -errno;
+		DPAA_PMD_ERR("Failed to open %s: %s", ASK_PATH, strerror(-ret));
+		return ret;
+	}
+
+	dpaa_intf->rx_queues = rte_zmalloc(NULL,
+					   sizeof(struct qman_fq) * num_fqs,
+					   MAX_CACHELINE);
+	if (!dpaa_intf->rx_queues) {
+		DPAA_PMD_ERR("Failed to alloc mem for RX queues");
+		ret = -ENOMEM;
+		goto free_rx;
+	}
+	dpaa_intf->nb_rx_queues = num_fqs;
+
+	ret = dpaa_ol_rx_queue_init(&dpaa_intf->rx_queues[0], 0);
+	if (ret)
+		goto free_rx;
+	dpaa_intf->rx_queues[0].dpaa_intf = dpaa_intf;
+
+	dpaa_intf->tx_queues = rte_zmalloc(NULL,
+					   sizeof(struct qman_fq) * num_fqs,
+					   MAX_CACHELINE);
+	if (!dpaa_intf->tx_queues) {
+		DPAA_PMD_ERR("Failed to alloc mem for TX queues");
+		ret = -ENOMEM;
+		goto free_rx;
+	}
+	dpaa_intf->nb_tx_queues = num_fqs;
+
+	ret = dpaa_ol_tx_queue_init(dpaa_intf, &dpaa_intf->tx_queues[0], 0);
+	if (ret)
+		goto free_rx;
+	dpaa_intf->tx_queues[0].dpaa_intf = dpaa_intf;
+
+	eth_dev->dev_ops = &dpaa_ol_devops;
+	eth_dev->rx_pkt_burst = dpaa_eth_queue_rx;
+	eth_dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
+
+	/* Allocate memory for storing MAC addresses */
+	eth_dev->data->mac_addrs = rte_zmalloc("mac_addr",
+			RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER, 0);
+	if (eth_dev->data->mac_addrs == NULL) {
+		DPAA_PMD_ERR("Failed to allocate %d bytes needed to "
+			     "store MAC addresses",
+			     RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER);
+		ret = -ENOMEM;
+		goto free_rx;
+	}
+
+	return 0;
+
+free_rx:
+	dpaa_oldev_queues_release(dpaa_intf);
+	if (dpaa_intf->ol_fd >= 0) {
+		close(dpaa_intf->ol_fd);
+		dpaa_intf->ol_fd = -1;
+	}
+	return ret;
+}
+
+static int dpaa_ol_probe(__rte_unused struct rte_dpaa_driver *dpaa_drv,
+			 struct rte_dpaa_device *dpaa_dev)
+{
+	int ret;
+	struct rte_eth_dev *eth_dev;
+	struct dpaa_if *dpaa_intf;
+	char bh_port_name[DPAA_OL_MAX_BH_PORT_NAME_LEN];
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* Offline port state is owned by the primary process only. */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		DPAA_PMD_WARN("%s: not supported in secondary process",
+			      dpaa_dev->device.name);
+		return -ENOTSUP;
+	}
+
+	ret = dpaa_ol_get_bh_port_name(dpaa_dev->device.devargs,
+				       bh_port_name, sizeof(bh_port_name));
+	if (ret <= 0) {
+		DPAA_PMD_ERR("Offline port \"%s\" devarg not defined or invalid (ret=%d)",
+			     DRIVER_OL_BH_PORT, ret);
+		return ret < 0 ? ret : -EINVAL;
+	}
+
+	eth_dev = rte_eth_dev_allocate(dpaa_dev->name);
+	if (!eth_dev)
+		return -ENOMEM;
+	eth_dev->data->dev_private = rte_zmalloc("ethdev private structure",
+						 sizeof(struct dpaa_if),
+						 RTE_CACHE_LINE_SIZE);
+	if (!eth_dev->data->dev_private) {
+		DPAA_PMD_ERR("Cannot allocate memzone for port data");
+		rte_eth_dev_release_port(eth_dev);
+		return -ENOMEM;
+	}
+
+	eth_dev->device = &dpaa_dev->device;
+
+	dpaa_intf = eth_dev->data->dev_private;
+	rte_strscpy(dpaa_intf->ol_bh_port_name, bh_port_name,
+		    sizeof(dpaa_intf->ol_bh_port_name));
+
+	ret = dpaa_oldev_init(eth_dev);
+	if (ret == 0) {
+		rte_eth_dev_probing_finish(eth_dev);
+		return 0;
+	}
+
+	rte_eth_dev_release_port(eth_dev);
+	return ret;
+}
+
+static int dpaa_ol_remove(struct rte_dpaa_device *dpaa_dev)
+{
+	struct rte_eth_dev *eth_dev;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	eth_dev = rte_eth_dev_allocated(dpaa_dev->device.name);
+	if (eth_dev == NULL)
+		return 0;
+
+	dpaa_ol_dev_close(eth_dev);
+
+	return rte_eth_dev_release_port(eth_dev);
+}
+
+static struct rte_dpaa_driver rte_dpaa_ol_pmd = {
+		.drv_type = FSL_DPAA_OL,
+		.probe = dpaa_ol_probe,
+		.remove = dpaa_ol_remove,
+};
+
+RTE_PMD_REGISTER_DPAA(ol_dpaa, rte_dpaa_ol_pmd);
+RTE_PMD_REGISTER_PARAM_STRING(ol_dpaa,
+		DRIVER_OL_BH_PORT "=<string>");
diff --git a/drivers/net/dpaa/meson.build b/drivers/net/dpaa/meson.build
index 8d4f69c596..3ec1091197 100644
--- a/drivers/net/dpaa/meson.build
+++ b/drivers/net/dpaa/meson.build
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright 2018-2020 NXP
+# Copyright 2018-2020,2026 NXP
 
 if not is_linux
     build = false
@@ -9,12 +9,13 @@ deps += ['mempool_dpaa']
 
 sources = files(
         'dpaa_ethdev.c',
-        'fmlib/fm_lib.c',
-        'fmlib/fm_vsp.c',
         'dpaa_flow.c',
-        'dpaa_rxtx.c',
         'dpaa_fmc.c',
         'dpaa_ptp.c',
+        'dpaa_oldev.c',
+        'dpaa_rxtx.c',
+        'fmlib/fm_lib.c',
+        'fmlib/fm_vsp.c',
 )
 
 cflags += no_wvla_cflag
@@ -24,4 +25,4 @@ if cc.has_argument('-Wno-pointer-arith')
     cflags += '-Wno-pointer-arith'
 endif
 
-headers = files('rte_pmd_dpaa.h')
+headers = files('rte_pmd_dpaa.h', 'rte_pmd_dpaa_oldev.h')
diff --git a/drivers/net/dpaa/rte_pmd_dpaa_oldev.h b/drivers/net/dpaa/rte_pmd_dpaa_oldev.h
new file mode 100644
index 0000000000..9b695686f0
--- /dev/null
+++ b/drivers/net/dpaa/rte_pmd_dpaa_oldev.h
@@ -0,0 +1,198 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020-2026 NXP
+ */
+
+#ifndef _RTE_PMD_DPAA_OLDEV_H
+#define _RTE_PMD_DPAA_OLDEV_H
+
+/**
+ * @file rte_pmd_dpaa_oldev.h
+ *
+ * NXP DPAA offline (O/H) port PMD-specific API.
+ *
+ * @warning
+ * @b EXPERIMENTAL:
+ * All functions in this file may be changed or removed without prior notice.
+ *
+ * These APIs configure the classification, local gateway (LGW) and related
+ * uplink information for the DPAA offline port through the kernel control
+ * device.
+ */
+
+#include <stdint.h>
+#include <rte_common.h>
+#include <rte_compat.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** IPv4 address type for the inner/static address pair used in uplink
+ * classification.
+ */
+#define RTE_PMD_DPAA_OLDEV_IPV4_ADDR_TYPE  0x04
+/** IPv6 address type for the inner/static address pair used in uplink
+ * classification.
+ */
+#define RTE_PMD_DPAA_OLDEV_IPV6_ADDR_TYPE  0x06
+
+/** Maximum number of GTP UDP ports an application can listen on. */
+#define RTE_PMD_DPAA_OLDEV_MAX_NUM_PORTS 2
+
+/** IPv4 subnet type for an LGW subnet entry. */
+#define RTE_PMD_DPAA_OLDEV_IPV4_SUBNET_TYPE  0x04
+/** IPv6 subnet type for an LGW subnet entry. */
+#define RTE_PMD_DPAA_OLDEV_IPV6_SUBNET_TYPE  0x06
+/** Maximum number of LGW subnets that can be programmed. */
+#define RTE_PMD_DPAA_OLDEV_MAX_NUM_SUBNETS 4
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags when the address pair carries
+ * a valid inner IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_CLASSIF_INNER_IP 0x1
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags when the address pair carries
+ * a static IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_CLASSIF_STATIC_IP 0x2
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags to indicate the telecom
+ * application is listening only on the static IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_TELECOM_LISTEN_ON_ONLY_STATICIP 0x4
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags to indicate the telecom
+ * application is listening on both the static and the inner IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_TELECOM_LISTEN_ON_BOTH_STATIC_INNER_IP 0x8
+
+/** Set in struct rte_pmd_dpaa_ip_pair::flags to indicate the telecom
+ * application is listening only on the inner IP address.
+ */
+#define RTE_PMD_DPAA_OLDEV_TELECOM_LISTEN_ON_ONLY_INNERIP 0x10
+
+/**
+ * Holds an IPv4 or IPv6 address.
+ *
+ * For an IPv4 address only ip_addr[0] is used; for an IPv6 address all
+ * four words are used. Which representation applies is determined by
+ * the addr_type field of the enclosing struct rte_pmd_dpaa_ip_pair.
+ */
+struct rte_pmd_dpaa_ip_addr {
+	uint32_t ip_addr[4]; /**< Address words, network byte order. */
+};
+
+/** Static/inner IP address pair used for uplink classification. */
+struct __rte_packed_begin rte_pmd_dpaa_ip_pair {
+	struct rte_pmd_dpaa_ip_addr static_ip; /**< Static IP address. */
+	struct rte_pmd_dpaa_ip_addr inner_ip;  /**< Inner IP address. */
+	uint8_t flags;		/**< Combination of
+				  *  RTE_PMD_DPAA_OLDEV_CLASSIF_* and
+				  *  RTE_PMD_DPAA_OLDEV_TELECOM_* flags.
+				  */
+	uint8_t addr_type;	/**< RTE_PMD_DPAA_OLDEV_IPV4_ADDR_TYPE or
+				  *  RTE_PMD_DPAA_OLDEV_IPV6_ADDR_TYPE.
+				  */
+	uint8_t pad[2];		/**< Reserved, must be zero. */
+} __rte_packed_end;
+
+/** A single local gateway (LGW) subnet entry. */
+struct __rte_packed_begin rte_pmd_dpaa_lgw_subnet {
+	uint32_t subnet[4];	/**< Subnet address, network byte order. */
+	uint8_t mask;		/**< Subnet mask length in bits. */
+	uint8_t subnet_type;	/**< RTE_PMD_DPAA_OLDEV_IPV4_SUBNET_TYPE or
+				  *   RTE_PMD_DPAA_OLDEV_IPV6_SUBNET_TYPE.
+				  */
+	uint8_t pad[2];		/**< Reserved, must be zero. */
+} __rte_packed_end;
+
+/** Uplink classification information for the DPAA offline port. */
+struct rte_pmd_dpaa_uplink_cls_info_s {
+	struct rte_pmd_dpaa_ip_pair addr_pair;	/**< Static/inner IP pair. */
+	/** GTP UDP ports the application listens on. */
+	uint16_t gtp_udp_port[RTE_PMD_DPAA_OLDEV_MAX_NUM_PORTS];
+	uint8_t gtp_proto_id;	/**< UDP protocol ID the application listens
+				  *   on.
+				  */
+	uint8_t num_ports;	/**< Number of valid entries in
+				  *   gtp_udp_port.
+				  */
+	uint8_t sec_enabled;	/**< Non-zero if IPsec is enabled. */
+	uint8_t pad;		/**< Reserved, must be zero. */
+};
+
+/** Local gateway (LGW) information for the DPAA offline port. */
+struct __rte_packed_begin rte_pmd_dpaa_lgw_info_s {
+	/** LGW subnet table. */
+	struct rte_pmd_dpaa_lgw_subnet subnets[RTE_PMD_DPAA_OLDEV_MAX_NUM_SUBNETS];
+	uint8_t num_subnets;	/**< Number of valid entries in subnets. */
+	uint8_t pad[3];		/**< Reserved, must be zero. */
+} __rte_packed_end;
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Program the uplink classification information for the DPAA offline port.
+ *
+ * @param port_id
+ *   The port identifier of the DPAA offline (O/H) port.
+ * @param cls_info
+ *   Pointer to the classification information to program. Must not be NULL.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_set_classif_info(uint16_t port_id,
+		struct rte_pmd_dpaa_uplink_cls_info_s *cls_info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Reset the uplink classification information for the DPAA offline port.
+ *
+ * @param port_id
+ *   The port identifier of the DPAA offline (O/H) port.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_reset_classif_info(uint16_t port_id);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Program the local gateway (LGW) information for the DPAA offline port.
+ *
+ * @param port_id
+ *   The port identifier of the DPAA offline (O/H) port.
+ * @param lgw_info
+ *   Pointer to the LGW information to program. Must not be NULL.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_set_lgw_info(uint16_t port_id,
+		struct rte_pmd_dpaa_lgw_info_s *lgw_info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Reset the local gateway (LGW) information for the DPAA offline port.
+ *
+ * @param port_id
+ *   The port identifier of the DPAA offline (O/H) port.
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+__rte_experimental
+int rte_pmd_dpaa_ol_reset_lgw_info(uint16_t port_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PMD_DPAA_OLDEV_H */
-- 
2.25.1


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

* [PATCH v5 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name
  2026-11-17  5:45       ` [PATCH v5 " Gagandeep Singh
  2026-11-17  5:45         ` [PATCH v5 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
  2026-11-17  5:45         ` [PATCH v5 2/4] drivers: add offline (O/H) port device support Gagandeep Singh
@ 2026-11-17  5:45         ` Gagandeep Singh
  2026-11-17  5:45         ` [PATCH v5 4/4] drivers: add DPAA cgrid cleanup support Gagandeep Singh
  2026-11-17 17:25         ` [PATCH v5 0/4] DPAA driver changes Stephen Hemminger
  4 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-17  5:45 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal

From: Hemant Agrawal <hemant.agrawal@nxp.com>

A shared MAC interface needs the kernel netdev name to read the MTU,
and that name is only the DPDK port name for fmX-macY style netdevs.

Look it up in sysfs under the platform device of the dpa-ethernet node
the port was created from, and fall back to the port name.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/nics/dpaa.rst       |  6 ++-
 drivers/net/dpaa/dpaa_ethdev.c | 68 +++++++++++++++++++++++++++++++++-
 2 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst
index 7658e6d454..d391c0607f 100644
--- a/doc/guides/nics/dpaa.rst
+++ b/doc/guides/nics/dpaa.rst
@@ -276,6 +276,11 @@ Refer to the document :doc:`build_and_test` for details.
   and thus disabling hardware based packet handling at driver level,
   e.g. ``dpaa:fm1-mac3,recv_err_pkts=1``.
 
+* For a shared MAC interface the kernel network interface name is looked up
+  in sysfs from the device tree node the port was created from,
+  so a kernel interface that does not follow
+  the ``fmX-macY`` naming style is handled without extra configuration.
+
 ``drv_bh_port``
    Name of the back-half port associated with an offline (O/H) port device.
    It is passed on the offline port device itself, which is named
@@ -307,7 +312,6 @@ port identified by its ``port_id``, via the experimental
 ``rte_pmd_dpaa_ol_set_lgw_info()`` and ``rte_pmd_dpaa_ol_reset_lgw_info()``
 APIs declared in ``rte_pmd_dpaa_oldev.h``.
 
-
 FMAN Config
 -----------
 
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index fe49c7b961..a821e68807 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -9,12 +9,14 @@
 #include <inttypes.h>
 #include <unistd.h>
 #include <limits.h>
+#include <stdlib.h>
 #include <sched.h>
 #include <signal.h>
 #include <pthread.h>
 #include <sys/types.h>
 #include <sys/syscall.h>
 #include <sys/ioctl.h>
+#include <dirent.h>
 
 #include <eal_export.h>
 #include <rte_string_fns.h>
@@ -57,6 +59,61 @@
 #define DRIVER_RECV_ERR_PKTS      "recv_err_pkts"
 #define RTE_PRIORITY_103 103
 
+#define DPAA_OF_BASE_PATH "/sys/firmware/devicetree/base"
+
+/*
+ * Get the kernel netdev name bound to the same device tree node as this
+ * port, by matching each /sys/class/net/<ifname>/device/of_node against
+ * node_path. Returns 1 on success, 0 if none was found, negative on error.
+ */
+static int
+dpaa_get_kernel_ifname(const char *node_path, char *name, size_t size)
+{
+	char path[PATH_MAX], resolved[PATH_MAX];
+	struct dirent *entry;
+	DIR *dir;
+	int ret;
+
+	if (!node_path || node_path[0] == '\0')
+		return 0;
+
+	dir = opendir("/sys/class/net");
+	if (!dir)
+		return 0;
+
+	ret = 0;
+	while ((entry = readdir(dir)) != NULL) {
+		if (entry->d_name[0] == '.')
+			continue;
+
+		if (snprintf(path, sizeof(path),
+			     "/sys/class/net/%s/device/of_node",
+			     entry->d_name) >= (int)sizeof(path))
+			continue;
+
+		if (realpath(path, resolved) == NULL)
+			continue;
+
+		if (strncmp(resolved, DPAA_OF_BASE_PATH,
+			    strlen(DPAA_OF_BASE_PATH)) != 0)
+			continue;
+
+		if (strcmp(resolved + strlen(DPAA_OF_BASE_PATH),
+			   node_path) != 0)
+			continue;
+
+		if (rte_strscpy(name, entry->d_name, size) < 0) {
+			ret = -ENAMETOOLONG;
+			break;
+		}
+		ret = 1;
+		break;
+	}
+
+	closedir(dir);
+	return ret;
+}
+
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		RTE_ETH_RX_OFFLOAD_SCATTER;
@@ -251,6 +308,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	int speed, duplex;
 	int ret, rx_status, socket_fd;
 	struct ifreq ifr;
+	char sh_if_name[IFNAMSIZ];
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -272,7 +330,15 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 			DPAA_PMD_ERR("Cannot open IF socket");
 			return -errno;
 		}
-		strlcpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
+
+		/* The DPDK port name matches the netdev only for fmX-macY. */
+		sh_if_name[0] = '\0';
+		ret = dpaa_get_kernel_ifname(__fif->node_path, sh_if_name,
+					     sizeof(sh_if_name));
+		if (ret <= 0 || sh_if_name[0] == '\0')
+			strlcpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
+		else
+			strlcpy(ifr.ifr_name, sh_if_name, IFNAMSIZ);
 
 		if (ioctl(socket_fd, SIOCGIFMTU, &ifr) < 0) {
 			DPAA_PMD_ERR("Cannot get interface mtu");
-- 
2.25.1


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

* [PATCH v5 4/4] drivers: add DPAA cgrid cleanup support
  2026-11-17  5:45       ` [PATCH v5 " Gagandeep Singh
                           ` (2 preceding siblings ...)
  2026-11-17  5:45         ` [PATCH v5 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
@ 2026-11-17  5:45         ` Gagandeep Singh
  2026-11-17 17:25         ` [PATCH v5 0/4] DPAA driver changes Stephen Hemminger
  4 siblings, 0 replies; 33+ messages in thread
From: Gagandeep Singh @ 2026-11-17  5:45 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, stable, Jun Yang

From: Jun Yang <jun.yang@nxp.com>

A congestion group must have no member frame queues left when it is
deleted, and its CGRID must be returned to the allocator once the group
is gone. Neither was handled on the net/dpaa close and probe-failure
paths.

This also changes probe behaviour: a qman_create_cgr() failure in
dpaa_rx_queue_init() or dpaa_tx_queue_init() now fails the probe
instead of continuing without tail drop on that queue. The probe error
path deletes one CGR per initialised queue, and a CGR whose creation
failed was never linked into the portal list.

Fixes: 62f53995caaf ("net/dpaa: add frame count based tail drop with CGR")
Fixes: 9124e65dd3eb ("net/dpaa: enable Tx queue taildrop")
Cc: stable@dpdk.org

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/dpaa/base/qbman/qman.c       |  61 +++++++++
 drivers/bus/dpaa/dpaa_bus_base_symbols.c |   1 +
 drivers/bus/dpaa/include/fsl_qman.h      |  27 ++++
 drivers/net/dpaa/dpaa_ethdev.c           | 166 +++++++++++++++++++++--
 4 files changed, 243 insertions(+), 12 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 3c056e4547..7cb9ec8a7c 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -2993,3 +2993,64 @@ qman_shutdown_fq(struct qman_fq *fq)
 out:
 	return ret;
 }
+
+int qman_pending_fq_by_cgrid_range(u32 cgrid_start, u32 cgrid_num,
+	u32 start_fqid, u32 *fqid, u32 *cgrid)
+{
+	struct qman_fq fq = {
+		.fqid = start_fqid ? start_fqid : 1
+	};
+	struct qm_mcr_queryfq_np np;
+	struct qm_fqd fqd;
+	int err;
+
+	/*
+	 * Do not use the CGR byte count to decide whether to scan. An FQ is a
+	 * member of the group whenever it is scheduled with CGE set and a
+	 * matching cgid, whether or not it currently holds any frames, and the
+	 * group cannot be deleted while such a member exists. Skipping the
+	 * scan for an empty CGR would let an idle stale FQ survive and its
+	 * CGRID be released while still referenced. This runs once per CGRID
+	 * range at device probe, so the scan cost is acceptable.
+	 *
+	 * The whole CGRID range of a port is matched in a single pass, so a
+	 * port with many congestion groups does not need one full FQID space
+	 * scan per group.
+	 */
+	DPAA_BUS_DEBUG("Scanning FQs for cgrid(0x%x..0x%x)",
+		cgrid_start, cgrid_start + cgrid_num - 1);
+
+	/* FQID space is 24 bits wide; stop before wrapping. */
+	for (; fq.fqid <= QMAN_MAX_FQID; fq.fqid++) {
+		err = qman_query_fq_np(&fq, &np);
+		if (err == -ERANGE) {
+			/*
+			 * FQID is not implemented on this device, so there is
+			 * nothing beyond it either.
+			 */
+			break;
+		} else if (err) {
+			DPAA_BUS_WARN("Failed(%d) to Query np FQ(fqid=0x%x)",
+				err, fq.fqid);
+			return err;
+		}
+		if ((np.state & QM_MCR_NP_STATE_MASK) != QM_MCR_NP_STATE_OOS) {
+			err = qman_query_fq(&fq, &fqd);
+			if (err) {
+				DPAA_BUS_WARN("Failed(%d) to Query FQ(fqid=0x%x)",
+					err, fq.fqid);
+			} else if ((fqd.fq_ctrl & QM_FQCTRL_CGE) &&
+				fqd.cgid >= cgrid_start &&
+				fqd.cgid < cgrid_start + cgrid_num) {
+				if (fqid)
+					*fqid = fq.fqid;
+				if (cgrid)
+					*cgrid = fqd.cgid;
+				return 0;
+			}
+		}
+	}
+	DPAA_BUS_DEBUG("No FQ left in cgrid(0x%x..0x%x)",
+		cgrid_start, cgrid_start + cgrid_num - 1);
+	return -ERANGE;
+}
diff --git a/drivers/bus/dpaa/dpaa_bus_base_symbols.c b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
index aaa9f9bec2..4da43f293d 100644
--- a/drivers/bus/dpaa/dpaa_bus_base_symbols.c
+++ b/drivers/bus/dpaa/dpaa_bus_base_symbols.c
@@ -57,6 +57,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(qman_reserve_fqid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_pool_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_alloc_cgrid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(qman_release_cgrid_range)
+RTE_EXPORT_INTERNAL_SYMBOL(qman_pending_fq_by_cgrid_range)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_intr_enable)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_intr_disable)
 RTE_EXPORT_INTERNAL_SYMBOL(dpaa_get_ioctl_version_number)
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index b2674ce5d0..73172391cd 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1284,6 +1284,9 @@ struct qman_cgr {
  */
 #define QMAN_FQRN_WAIT_MAX		10000000u
 
+/* Maximum FQID value: frame queue IDs are 24 bits wide. */
+#define QMAN_MAX_FQID			0x00FFFFFFu
+
 /* Flags to qman_create_fq() */
 #define QMAN_FQ_FLAG_NO_ENQUEUE      0x00000001 /* can't enqueue */
 #define QMAN_FQ_FLAG_NO_MODIFY       0x00000002 /* can only enqueue */
@@ -1916,6 +1919,30 @@ static inline int qman_shutdown_fq_by_fqid(u32 fqid)
 	return qman_shutdown_fq(&fq);
 }
 
+/**
+ * qman_pending_fq_by_cgrid_range - Find an FQ still attached to a CGR range.
+ *
+ * @cgrid_start: first congestion group id of the range to search for.
+ * @cgrid_num: number of consecutive congestion group ids in the range.
+ * @start_fqid: FQID to begin the scan from (0 or 1 means scan from the
+ *   start). A caller shutting down several stale FQs can pass the previously
+ *   returned FQID + 1 to resume the scan instead of restarting from the
+ *   beginning each time.
+ * @fqid: on success, holds the FQID that is still attached to the range.
+ * @cgrid: on success, holds the congestion group id that FQ belongs to.
+ *   May be NULL.
+ *
+ * Matching a whole range in one pass lets a caller with many congestion
+ * groups, such as a port checking all of its Rx or Tx CGRIDs, avoid one full
+ * FQID space scan per group.
+ *
+ * Return 0 and set *fqid when a matching FQ is found, -ERANGE when none is
+ * left, or a negative error code on query failure.
+ */
+__rte_internal
+int qman_pending_fq_by_cgrid_range(u32 cgrid_start, u32 cgrid_num,
+		u32 start_fqid, u32 *fqid, u32 *cgrid);
+
 /**
  * qman_reserve_fqid_range - Reserve the specified range of frame queue IDs
  * @fqid: the base FQID of the range to deallocate
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index a821e68807..a4e9eb1e66 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -114,6 +114,9 @@ dpaa_get_kernel_ifname(const char *node_path, char *name, size_t size)
 	return ret;
 }
 
+/* Maximum number of stale frame queues cleaned up per congestion group. */
+#define DPAA_CGR_STALE_FQ_MAX     64
+
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		RTE_ETH_RX_OFFLOAD_SCATTER;
@@ -585,6 +588,51 @@ static int dpaa_eth_dev_stop(struct rte_eth_dev *dev)
 	return 0;
 }
 
+/* Shut down any frame queue still linked to this CGRID range.
+ *
+ * FQs left behind by a previous run of the application may still reference
+ * a newly allocated CGRID. They are not owned by this process, so they can
+ * only be found by asking QMan. There may be more than one, hence the loop.
+ *
+ * Returns true if the FQID range was fully scanned (i.e. no stale FQ was
+ * left behind), false if an FQ refused to shut down or the per-range
+ * limit was reached before the scan completed.
+ */
+static bool
+dpaa_cgr_stale_fq_cleanup(struct rte_eth_dev *dev, uint32_t cgrid_start,
+			  uint32_t cgrid_num, const char *dir)
+{
+	uint32_t start_fqid = 1;
+	uint32_t fqid, cgrid;
+	uint32_t loop, max_loop;
+	int ret;
+
+	max_loop = cgrid_num * DPAA_CGR_STALE_FQ_MAX;
+	for (loop = 0; loop < max_loop; loop++) {
+		if (qman_pending_fq_by_cgrid_range(cgrid_start, cgrid_num,
+						   start_fqid, &fqid, &cgrid))
+			return true;
+		/* Should be FQ not cleaned in previous program. */
+		DPAA_PMD_DEBUG("FQ(fqid=0x%x) with %s cgid=%u is still alive?",
+			fqid, dir, cgrid);
+		ret = qman_shutdown_fq_by_fqid(fqid);
+		if (ret) {
+			DPAA_PMD_WARN("%s: Failed(%d) to shutdown %s cgid=%u's fq(fqid=0x%x)",
+				dev->data->name, ret, dir, cgrid, fqid);
+			/* Do not spin on an FQ that refuses to shut down. */
+			return false;
+		}
+		/* Resume the scan past the FQ just handled instead of
+		 * restarting from the beginning, which would be O(N^2) for
+		 * N stale FQs.
+		 */
+		start_fqid = fqid + 1;
+	}
+	DPAA_PMD_WARN("%s: stale %s FQ limit reached",
+		      dev->data->name, dir);
+	return false;
+}
+
 static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 {
 	struct fman_if *fif = dev->process_private;
@@ -594,7 +642,7 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 	struct rte_eth_link *link = &dev->data->dev_link;
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 	struct qman_fq *fq;
-	int loop;
+	uint32_t loop;
 	int ret;
 
 	PMD_INIT_FUNC_TRACE();
@@ -669,26 +717,61 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 	/* Release congestion Groups after releasing FQIDs */
 	/* Release RX congestion Groups */
 	if (dpaa_intf->cgr_rx) {
+		bool cgrid_ok = true;
+
+		for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) {
+			ret = qman_shutdown_fq(&dpaa_intf->rx_queues[loop]);
+			if (ret) {
+				DPAA_PMD_WARN("%s: shutdown rxq%d err(%d)",
+					dev->data->name, loop, ret);
+				cgrid_ok = false;
+			}
+		}
+
 		for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) {
 			ret = qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
 			if (ret) {
 				DPAA_PMD_WARN("%s: delete rxq%d's cgr err(%d)",
 					dev->data->name, loop, ret);
+				cgrid_ok = false;
 			}
 		}
+		/* Only hand the CGRIDs back to the allocator if every member
+		 * FQ was confirmed shut down and every CGR deleted; otherwise
+		 * deliberately leak them rather than reuse a CGRID that may
+		 * still be referenced by a live FQ.
+		 */
+		if (cgrid_ok)
+			qman_release_cgrid_range(dpaa_intf->cgr_rx[0].cgrid,
+					dpaa_intf->nb_rx_queues);
 		rte_free(dpaa_intf->cgr_rx);
 		dpaa_intf->cgr_rx = NULL;
 	}
 
 	/* Release TX congestion Groups */
 	if (dpaa_intf->cgr_tx) {
+		bool cgrid_ok = true;
+
+		for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
+			ret = qman_shutdown_fq(&dpaa_intf->tx_queues[loop]);
+			if (ret) {
+				DPAA_PMD_WARN("%s: shutdown txq%d err(%d)",
+					dev->data->name, loop, ret);
+				cgrid_ok = false;
+			}
+		}
+
 		for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
 			ret = qman_delete_cgr(&dpaa_intf->cgr_tx[loop]);
 			if (ret) {
 				DPAA_PMD_WARN("%s: delete txq%d's cgr err(%d)",
 					dev->data->name, loop, ret);
+				cgrid_ok = false;
 			}
 		}
+		if (cgrid_ok)
+			qman_release_cgrid_range(dpaa_intf->cgr_tx[0].cgrid,
+						 MAX_DPAA_CORES);
 		rte_free(dpaa_intf->cgr_tx);
 		dpaa_intf->cgr_tx = NULL;
 	}
@@ -2039,19 +2122,32 @@ static int dpaa_rx_queue_init(struct qman_fq *fq, struct qman_cgr *cgr_rx,
 		ret = qman_create_cgr(cgr_rx, QMAN_CGR_FLAG_USE_INIT,
 				      &cgr_opts);
 		if (ret) {
-			DPAA_PMD_WARN(
-				"rx taildrop init fail on rx fqid 0x%x(ret=%d)",
+			/* Do not fall back to running without the CGR. The
+			 * caller counts one CGR per queue it initialised and
+			 * deletes cgr_rx[0..n) on its error path, so a queue
+			 * without a CGR would make it delete an object that
+			 * was never added to the portal list, whose node is
+			 * still zeroed from rte_zmalloc().
+			 */
+			DPAA_PMD_ERR("rx taildrop init fail on rx fqid 0x%x(ret=%d)",
 				fq->fqid, ret);
-			goto without_cgr;
+			return ret;
 		}
 		opts.we_mask |= QM_INITFQ_WE_CGID;
 		opts.fqd.cgid = cgr_rx->cgrid;
 		opts.fqd.fq_ctrl |= QM_FQCTRL_CGE;
 	}
-without_cgr:
+
 	ret = qman_init_fq(fq, 0, &opts);
-	if (ret)
+	if (ret) {
 		DPAA_PMD_ERR("init rx fqid 0x%x failed with ret:%d", fqid, ret);
+		/* The caller only counts this CGR once this function returns
+		 * success, so its error path will not delete it. Unlink it here
+		 * or the portal keeps a pointer into memory the caller frees.
+		 */
+		if (cgr_rx)
+			qman_delete_cgr(cgr_rx);
+	}
 	return ret;
 }
 
@@ -2130,10 +2226,12 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 		ret = qman_create_cgr(cgr_tx, QMAN_CGR_FLAG_USE_INIT,
 				      &cgr_opts);
 		if (ret) {
-			DPAA_PMD_WARN(
-				"rx taildrop init fail on rx fqid 0x%x(ret=%d)",
+			/* See the equivalent comment in
+			 * dpaa_rx_queue_init().
+			 */
+			DPAA_PMD_ERR("tx taildrop init fail on tx fqid 0x%x(ret=%d)",
 				fq->fqid, ret);
-			goto without_cgr;
+			return ret;
 		}
 		opts.we_mask |= QM_INITFQ_WE_CGID;
 		opts.fqd.cgid = cgr_tx->cgrid;
@@ -2141,10 +2239,14 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 		DPAA_PMD_DEBUG("Tx FQ tail drop enabled, threshold = %d",
 				td_tx_threshold);
 	}
-without_cgr:
+
 	ret = qman_init_fq(fq, QMAN_INITFQ_FLAG_SCHED, &opts);
-	if (ret)
+	if (ret) {
 		DPAA_PMD_ERR("init tx fqid 0x%x failed %d", fq->fqid, ret);
+		/* See the equivalent comment in dpaa_rx_queue_init(). */
+		if (cgr_tx)
+			qman_delete_cgr(cgr_tx);
+	}
 	return ret;
 }
 
@@ -2316,6 +2418,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	int num_rx_fqs, fqid;
 	int loop, ret = 0;
 	int dev_id;
+	int nb_rx_cgr = 0, nb_tx_cgr = 0;
+	bool rx_cgrid_allocated = false, tx_cgrid_allocated = false;
 	struct rte_dpaa_device *dpaa_device;
 	struct dpaa_if *dpaa_intf;
 	struct fm_eth_port_cfg *cfg;
@@ -2437,6 +2541,13 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			ret = -EINVAL;
 			goto free_rx;
 		}
+		/* On failure the CGRIDs are leaked, not released for reuse. */
+		if (!dpaa_cgr_stale_fq_cleanup(eth_dev, cgrid[0],
+					       num_rx_fqs, "rx")) {
+			ret = -EBUSY;
+			goto free_rx;
+		}
+		rx_cgrid_allocated = true;
 	} else {
 		dpaa_intf->cgr_rx = NULL;
 	}
@@ -2471,6 +2582,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			fqid);
 		if (ret)
 			goto free_rx;
+		if (dpaa_intf->cgr_rx)
+			nb_rx_cgr++;
 		dpaa_intf->rx_queues[loop].vsp_id = vsp_id;
 		dpaa_intf->rx_queues[loop].dpaa_intf = dpaa_intf;
 	}
@@ -2511,11 +2624,16 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			ret = -EINVAL;
 			goto free_tx;
 		}
+		if (!dpaa_cgr_stale_fq_cleanup(eth_dev, cgrid_tx[0],
+					       MAX_DPAA_CORES, "tx")) {
+			ret = -EBUSY;
+			goto free_tx;
+		}
+		tx_cgrid_allocated = true;
 	} else {
 		dpaa_intf->cgr_tx = NULL;
 	}
 
-
 	for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
 		if (dpaa_intf->cgr_tx)
 			dpaa_intf->cgr_tx[loop].cgrid = cgrid_tx[loop];
@@ -2526,6 +2644,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 			dpaa_intf->cgr_tx ? &dpaa_intf->cgr_tx[loop] : NULL);
 		if (ret)
 			goto free_tx;
+		if (dpaa_intf->cgr_tx)
+			nb_tx_cgr++;
 
 		if (dpaa_intf->ts_enable) {
 			ret = dpaa_tx_conf_queue_init(&dpaa_intf->tx_conf_queues[loop]);
@@ -2605,6 +2725,17 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	return 0;
 
 free_tx:
+	/* A CGR must have no members when deleted, so shut down the FQs
+	 * already linked to it first. Each CGR was also linked into the
+	 * QMan portal's cgr_cbs list by qman_create_cgr(), so deleting it
+	 * here avoids leaving the portal with dangling pointers.
+	 */
+	for (loop = 0; loop < nb_tx_cgr; loop++)
+		qman_shutdown_fq(&dpaa_intf->tx_queues[loop]);
+	for (loop = 0; loop < nb_tx_cgr; loop++)
+		qman_delete_cgr(&dpaa_intf->cgr_tx[loop]);
+	if (tx_cgrid_allocated)
+		qman_release_cgrid_range(cgrid_tx[0], MAX_DPAA_CORES);
 	rte_free(dpaa_intf->tx_conf_queues);
 	dpaa_intf->tx_conf_queues = NULL;
 	rte_free(dpaa_intf->tx_queues);
@@ -2612,8 +2743,19 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	dpaa_intf->nb_tx_queues = 0;
 
 free_rx:
+	/* Same as above for the Rx CGRs: shut down the FQs still linked to
+	 * their CGR before deleting it.
+	 */
+	for (loop = 0; loop < nb_rx_cgr; loop++)
+		qman_shutdown_fq(&dpaa_intf->rx_queues[loop]);
+	for (loop = 0; loop < nb_rx_cgr; loop++)
+		qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
+	if (rx_cgrid_allocated)
+		qman_release_cgrid_range(cgrid[0], num_rx_fqs);
 	rte_free(dpaa_intf->cgr_rx);
+	dpaa_intf->cgr_rx = NULL;
 	rte_free(dpaa_intf->cgr_tx);
+	dpaa_intf->cgr_tx = NULL;
 	rte_free(dpaa_intf->rx_queues);
 	dpaa_intf->rx_queues = NULL;
 	dpaa_intf->nb_rx_queues = 0;
-- 
2.25.1


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

* Re: [PATCH v5 0/4] DPAA driver changes
  2026-11-17  5:45       ` [PATCH v5 " Gagandeep Singh
                           ` (3 preceding siblings ...)
  2026-11-17  5:45         ` [PATCH v5 4/4] drivers: add DPAA cgrid cleanup support Gagandeep Singh
@ 2026-11-17 17:25         ` Stephen Hemminger
  4 siblings, 0 replies; 33+ messages in thread
From: Stephen Hemminger @ 2026-11-17 17:25 UTC (permalink / raw)
  To: Gagandeep Singh; +Cc: dev, hemant.agrawal

On Tue, 17 Nov 2026 11:15:54 +0530
Gagandeep Singh <g.singh@nxp.com> wrote:

> V5-Changes:
>  - Added a reset FQ helper as per the AI suggestion
>  - Fixed the portid issue.
>  - Added explicit padding, uint8_t, size checks. The version ioctl is
>    not avilable in CDX module as of now, so mismatch module will fails
>    at probe only through existing ioctl errors.
>  - Fixed stale FQs run at close issue.
>  - Added a AI suggested warning.
>  - The scan moved to probe, close no longer scans. A single combined pass
>    would need the Tx CGRIDs before the Rx CGRs are created and a scan that
>    takes two ranges, which is too big for this series and saves
>    only one scan per port at startup.

Applied to next-net for 27.03

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

end of thread, other threads:[~2026-11-17 17:25 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28  8:55 [PATCH v1 0/3] DPAA driver changes Gagandeep Singh
2026-10-28  8:55 ` [PATCH v1 1/3] drivers: add offline (O/H) port device support Gagandeep Singh
2026-10-28  8:55 ` [PATCH v1 2/3] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
2026-10-28  8:55 ` [PATCH v1 3/3] drivers: add DPAA cgrid cleanup support Gagandeep Singh
2026-10-28 14:41 ` [PATCH v1 0/3] DPAA driver changes Stephen Hemminger
2026-10-30  4:43   ` Gagandeep Singh
2026-10-30  4:43 ` [PATCH v2 0/4] " Gagandeep Singh
2026-10-30  4:43   ` [PATCH v2 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
2026-10-30  4:43   ` [PATCH v2 2/4] drivers: add offline (O/H) port device support Gagandeep Singh
2026-10-30  4:43   ` [PATCH v2 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
2026-10-30  4:43   ` [PATCH v2 4/4] drivers: add DPAA cgrid cleanup support Gagandeep Singh
2026-11-02  8:09   ` [PATCH v2 0/4] DPAA driver changes Stephen Hemminger
2026-11-02 13:23   ` Stephen Hemminger
2026-11-03  9:38     ` Gagandeep Singh
2026-11-03  9:35   ` [PATCH v3 " Gagandeep Singh
2026-11-03  9:35     ` [PATCH v3 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
2026-11-03  9:35     ` [PATCH v3 2/4] drivers: add offline (O/H) port device support Gagandeep Singh
2026-11-03  9:36     ` [PATCH v3 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
2026-11-03  9:36     ` [PATCH v3 4/4] drivers: add DPAA cgrid cleanup support Gagandeep Singh
2026-11-04 11:29     ` [PATCH v3 0/4] DPAA driver changes Stephen Hemminger
2026-11-05  5:53       ` Gagandeep Singh
2026-11-16  6:25     ` [PATCH v4 " Gagandeep Singh
2026-11-16  6:25       ` [PATCH v4 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
2026-11-16  6:25       ` [PATCH v4 2/4] drivers: add offline (O/H) port device support Gagandeep Singh
2026-11-16  6:25       ` [PATCH v4 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
2026-11-16  6:25       ` [PATCH v4 4/4] drivers: add DPAA cgrid cleanup support Gagandeep Singh
2026-11-16 22:48       ` [PATCH v4 0/4] DPAA driver changes Stephen Hemminger
2026-11-17  5:45       ` [PATCH v5 " Gagandeep Singh
2026-11-17  5:45         ` [PATCH v5 1/4] bus/dpaa: fix out-of-bounds read of mac_idx array Gagandeep Singh
2026-11-17  5:45         ` [PATCH v5 2/4] drivers: add offline (O/H) port device support Gagandeep Singh
2026-11-17  5:45         ` [PATCH v5 3/4] net/dpaa: support non fmX-macY type of shared Ethernet name Gagandeep Singh
2026-11-17  5:45         ` [PATCH v5 4/4] drivers: add DPAA cgrid cleanup support Gagandeep Singh
2026-11-17 17:25         ` [PATCH v5 0/4] DPAA driver changes Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.