DPAA compilation fix ppc64le and riscv
Subsystems (2)
v2 cover DPAA compilation fix ppc64le and riscv
V2-changes:
- updated the Author name.
Stephen Hemminger (1):
bus/dpaa: fix maybe-uninitialized in bman_release_fast
drivers/bus/dpaa/base/qbman/bman.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.25.1
PATCH v2 1/1 bus/dpaa: fix maybe-uninitialized in bman_release_fast
From: Stephen Hemminger <[email protected]>
The conversion loop is bounded only by num, which is not checked unless RTE_LIBRTE_DPAA_HWDEBUG is set. GCC on ppc64le and riscv therefore warns that bm_bufs[0] may be read uninitialized when copying the first entry into the RCR.
Convert entry 0 unconditionally, as bman_release() does.
--- drivers/bus/dpaa/base/qbman/bman.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bus/dpaa/base/qbman/bman.c +2 -1
@@ -279,7 +279,8 @@ bman_release_fast(struct bman_pool *pool, const uint64_t *bufs,if (unlikely (!r))return -EBUSY ; -for (i =0 ; i < num; i++) +bm_buffer_set64_to_be (&bm_bufs[0 ], bufs[0 ]); +for (i =1 ; i < num; i++)bm_buffer_set64_to_be (&bm_bufs[i], bufs[i]);/* bufs[0] overlaps the verb, which bm_rcr_pvb_commit() writes last
Signature · 1 line
2.25.1
PATCH 1/3 drivers: add offline (O/H) port device support
In reply to Gagandeep SinghAdd 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.
--- 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
doc/api/doxy-api-index.md +1 -0
@@ -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),
doc/guides/nics/dpaa.rst +27 -0
@@ -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 -----------
drivers/bus/dpaa/base/fman/fman.c +19 -0
@@ -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);
drivers/bus/dpaa/bus_dpaa_driver.h +3 -1
@@ -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 */ };
drivers/bus/dpaa/dpaa_bus.c +92 -8
168 lines not on this page · raw message
drivers/bus/dpaa/dpaa_bus_base_symbols.c +1 -0
@@ -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)
drivers/bus/dpaa/include/fman.h +5 -1
@@ -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)
drivers/bus/dpaa/include/fsl_qman.h +1 -0
@@ -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) {
drivers/net/dpaa/dpaa_ethdev.h +3 -0
@@ -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 {
drivers/net/dpaa/dpaa_flow.c +6 -1
@@ -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 {
drivers/net/dpaa/dpaa_oldev.c new file +875 -0
875 lines not on this page · raw message
drivers/net/dpaa/meson.build +6 -5
@@ -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')
drivers/net/dpaa/rte_pmd_dpaa_oldev.h new file +158 -0
158 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 2/3 net/dpaa: support non fmX-macY type of shared Ethernet name
In reply to Gagandeep SinghFrom: Hemant Agrawal <[email protected]>
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.
--- doc/guides/nics/dpaa.rst | 5 +++ drivers/net/dpaa/dpaa_ethdev.c | 59 +++++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-)
doc/guides/nics/dpaa.rst +5 -0
@@ -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 -----------
drivers/net/dpaa/dpaa_ethdev.c +58 -1
83 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 3/3 drivers: add DPAA cgrid cleanup support
In reply to Gagandeep SinghFrom: Jun Yang <[email protected]>
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.
--- 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(-)
drivers/bus/dpaa/base/qbman/qman.c +61 -0
@@ -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 ; +}
drivers/bus/dpaa/dpaa_bus_base_symbols.c +1 -0
@@ -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)
drivers/bus/dpaa/include/fsl_qman.h +27 -0
@@ -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
drivers/net/dpaa/dpaa_ethdev.c +105 -12
236 lines not on this page · raw message
Signature · 1 line
2.25.1