* [PATCH v3 1/7] event/dlb2: fix addresses deq failure when CQ depth <= 16 [not found] ` <20250617182631.257612-1-pravin.pathak@intel.com> @ 2025-06-17 18:26 ` Pravin Pathak 2025-06-17 18:26 ` [PATCH v3 2/7] event/dlb2: fix validaton of LDB port COS ID arguments Pravin Pathak ` (4 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Pravin Pathak @ 2025-06-17 18:26 UTC (permalink / raw) To: dev Cc: jerinj, mike.ximing.chen, bruce.richardson, thomas, david.marchand, nipun.gupta, chenbox, tirthendu.sarkar, Pravin Pathak, stable When application configures a DIR port with CQ depth less than 8, DLB PMD sets port's cq_depth as 8 and token reservation is used to make the effective cq_depth smaller. However, while setting port's cq_depth_mask application configured CQ depth was used resulting in reading incorrect cachelines while dequeuing. Use PMD calculated CQ depth for cq_depth_mask calculation. Fixes: 3a6d0c04e7fb3e ("event/dlb2: add port setup") Cc: stable@dpdk.org Signed-off-by: Pravin Pathak <pravin.pathak@intel.com> Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com> --- drivers/event/dlb2/dlb2.c | 4 ++-- drivers/event/dlb2/pf/dlb2_pf.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 286241ea41..a0e673b96b 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -1951,9 +1951,9 @@ dlb2_hw_create_dir_port(struct dlb2_eventdev *dlb2, qm_port->cq_idx_unmasked = 0; if (dlb2->poll_mode == DLB2_CQ_POLL_MODE_SPARSE) - qm_port->cq_depth_mask = (cfg.cq_depth * 4) - 1; + qm_port->cq_depth_mask = (qm_port->cq_depth * 4) - 1; else - qm_port->cq_depth_mask = cfg.cq_depth - 1; + qm_port->cq_depth_mask = qm_port->cq_depth - 1; qm_port->gen_bit_shift = rte_popcount32(qm_port->cq_depth_mask); /* starting value of gen bit - it toggles at wrap time */ diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c index ed4e6e424c..31b5487d85 100644 --- a/drivers/event/dlb2/pf/dlb2_pf.c +++ b/drivers/event/dlb2/pf/dlb2_pf.c @@ -400,7 +400,7 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle, /* Calculate the port memory required, and round up to the nearest * cache line. */ - alloc_sz = cfg->cq_depth * qe_sz; + alloc_sz = RTE_MAX(cfg->cq_depth, DLB2_MIN_HARDWARE_CQ_DEPTH) * qe_sz; alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz); port_base = dlb2_alloc_coherent_aligned(&mz, &cq_base, alloc_sz, -- 2.39.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 2/7] event/dlb2: fix validaton of LDB port COS ID arguments [not found] ` <20250617182631.257612-1-pravin.pathak@intel.com> 2025-06-17 18:26 ` [PATCH v3 1/7] event/dlb2: fix addresses deq failure when CQ depth <= 16 Pravin Pathak @ 2025-06-17 18:26 ` Pravin Pathak 2025-06-17 18:26 ` [PATCH v3 3/7] event/dlb2: fix num single link ports for DLB2.5 Pravin Pathak ` (3 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Pravin Pathak @ 2025-06-17 18:26 UTC (permalink / raw) To: dev Cc: jerinj, mike.ximing.chen, bruce.richardson, thomas, david.marchand, nipun.gupta, chenbox, tirthendu.sarkar, Pravin Pathak, stable While providing port_cos as vdev/pf CLI argument, the port numbers should take into account all ports (LDB and DIR) that are created by the application and the same order should be provided for port_cos parameter. This fix add checks to ensure that above is validated correctly. Fixes: bec8901bfe9f ("event/dlb2: support ldb port specific COS") Cc: stable@dpdk.org Signed-off-by: Pravin Pathak <pravin.pathak@intel.com> --- drivers/event/dlb2/dlb2.c | 32 +++++++++++++++++++++++--------- drivers/event/dlb2/dlb2_priv.h | 1 - 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index a0e673b96b..58eb27f495 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -194,10 +194,8 @@ dlb2_init_port_cos(struct dlb2_eventdev *dlb2, int *port_cos) for (q = 0; q < DLB2_MAX_NUM_PORTS_ALL; q++) { dlb2->ev_ports[q].cos_id = port_cos[q]; if (port_cos[q] != DLB2_COS_DEFAULT && - dlb2->cos_ports[port_cos[q]] < DLB2_MAX_NUM_LDB_PORTS_PER_COS) { + dlb2->cos_ports[port_cos[q]] < DLB2_MAX_NUM_LDB_PORTS_PER_COS) dlb2->cos_ports[port_cos[q]]++; - dlb2->max_cos_port = q; - } } } @@ -531,8 +529,8 @@ set_port_cos(const char *key __rte_unused, const char *value, void *opaque) { + int first, last, cos_id, i, ports_per_cos[DLB2_COS_NUM_VALS] = {0}; struct dlb2_port_cos *port_cos = opaque; - int first, last, cos_id, i; if (value == NULL || opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); @@ -566,6 +564,14 @@ set_port_cos(const char *key __rte_unused, for (i = first; i <= last; i++) port_cos->cos_id[i] = cos_id; /* indexed by port */ + for (i = 0; i < DLB2_MAX_NUM_PORTS_ALL; i++) + if (port_cos->cos_id[i] != DLB2_COS_DEFAULT && + ++ports_per_cos[port_cos->cos_id[i]] > DLB2_MAX_NUM_LDB_PORTS_PER_COS) { + DLB2_LOG_ERR("Error parsing ldb port cos_id devarg: More than 16 ports for " + "cos_id %d.", port_cos->cos_id[i]); + return -EINVAL; + } + return 0; } @@ -866,9 +872,10 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2, const struct dlb2_hw_rsrcs *resources_asked, uint8_t device_version) { - int ret = 0; - uint32_t cos_ports = 0; + uint32_t total_asked_ports; struct dlb2_create_sched_domain_args *cfg; + uint32_t cos_ports = 0, max_cos_port = 0; + int ret = 0; if (resources_asked == NULL) { DLB2_LOG_ERR("dlb2: dlb2_create NULL parameter"); @@ -876,6 +883,8 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2, goto error_exit; } + total_asked_ports = resources_asked->num_ldb_ports + resources_asked->num_dir_ports; + /* Map generic qm resources to dlb2 resources */ cfg = &handle->cfg.resources; @@ -897,9 +906,14 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2, cos_ports = dlb2->cos_ports[0] + dlb2->cos_ports[1] + dlb2->cos_ports[2] + dlb2->cos_ports[3]; - if (cos_ports > resources_asked->num_ldb_ports || - (cos_ports && dlb2->max_cos_port >= resources_asked->num_ldb_ports)) { - DLB2_LOG_ERR("dlb2: num_ldb_ports < cos_ports"); + for (int i = 0; i < DLB2_MAX_NUM_PORTS_ALL; i++) { + if (dlb2->ev_ports[i].cos_id != DLB2_COS_DEFAULT) + max_cos_port = i; + } + + if (cos_ports > resources_asked->num_ldb_ports || max_cos_port >= total_asked_ports) { + DLB2_LOG_ERR("dlb2: Insufficient num_ldb_ports=%d: cos_ports=%d max_cos_port=%d", + resources_asked->num_ldb_ports, cos_ports, max_cos_port); ret = EINVAL; goto error_exit; } diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h index 4dd7532519..285d427397 100644 --- a/drivers/event/dlb2/dlb2_priv.h +++ b/drivers/event/dlb2/dlb2_priv.h @@ -649,7 +649,6 @@ struct dlb2_eventdev { }; uint32_t cos_ports[DLB2_COS_NUM_VALS]; /* total ldb ports in each class */ uint32_t cos_bw[DLB2_COS_NUM_VALS]; /* bandwidth per cos domain */ - uint8_t max_cos_port; /* Max LDB port from any cos */ bool enable_cq_weight; }; -- 2.39.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 3/7] event/dlb2: fix num single link ports for DLB2.5 [not found] ` <20250617182631.257612-1-pravin.pathak@intel.com> 2025-06-17 18:26 ` [PATCH v3 1/7] event/dlb2: fix addresses deq failure when CQ depth <= 16 Pravin Pathak 2025-06-17 18:26 ` [PATCH v3 2/7] event/dlb2: fix validaton of LDB port COS ID arguments Pravin Pathak @ 2025-06-17 18:26 ` Pravin Pathak 2025-06-17 18:26 ` [PATCH v3 5/7] event/dlb2: fix to avoid credit release race condition Pravin Pathak ` (2 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Pravin Pathak @ 2025-06-17 18:26 UTC (permalink / raw) To: dev Cc: jerinj, mike.ximing.chen, bruce.richardson, thomas, david.marchand, nipun.gupta, chenbox, tirthendu.sarkar, Pravin Pathak, stable DLB 2.0 device has 64 single linked or directed ports. DLB 2.5 device has 96 single linked ports. This commit fixes issue of rte_event_dev_info_get returning 64 instead of 96 single link ports for DLB2.5 Fixes: 4ce7bf9ec1c7 ("event/dlb2: add v2.5 get resources") Cc: stable@dpdk.org Signed-off-by: Pravin Pathak <pravin.pathak@intel.com> --- drivers/event/dlb2/dlb2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 58eb27f495..24c56a7968 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -241,16 +241,16 @@ dlb2_hw_query_resources(struct dlb2_eventdev *dlb2) * The capabilities (CAPs) were set at compile time. */ - if (dlb2->max_cq_depth != DLB2_DEFAULT_CQ_DEPTH) - num_ldb_ports = DLB2_MAX_HL_ENTRIES / dlb2->max_cq_depth; - else - num_ldb_ports = dlb2->hw_rsrc_query_results.num_ldb_ports; + num_ldb_ports = dlb2->hw_rsrc_query_results.num_ldb_ports; evdev_dlb2_default_info.max_event_queues = dlb2->hw_rsrc_query_results.num_ldb_queues; evdev_dlb2_default_info.max_event_ports = num_ldb_ports; + evdev_dlb2_default_info.max_single_link_event_port_queue_pairs = + dlb2->hw_rsrc_query_results.num_dir_ports; + if (dlb2->version == DLB2_HW_V2_5) { evdev_dlb2_default_info.max_num_events = dlb2->hw_rsrc_query_results.num_credits; -- 2.39.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 5/7] event/dlb2: fix to avoid credit release race condition [not found] ` <20250617182631.257612-1-pravin.pathak@intel.com> ` (2 preceding siblings ...) 2025-06-17 18:26 ` [PATCH v3 3/7] event/dlb2: fix num single link ports for DLB2.5 Pravin Pathak @ 2025-06-17 18:26 ` Pravin Pathak 2025-06-17 18:26 ` [PATCH v3 6/7] event/dlb2: fix qid depth xstat in vector path Pravin Pathak 2025-06-17 18:26 ` [PATCH v3 7/7] event/dlb2: fix default credits based on HW version Pravin Pathak 5 siblings, 0 replies; 13+ messages in thread From: Pravin Pathak @ 2025-06-17 18:26 UTC (permalink / raw) To: dev Cc: jerinj, mike.ximing.chen, bruce.richardson, thomas, david.marchand, nipun.gupta, chenbox, tirthendu.sarkar, Pravin Pathak, stable While unlinking ports, all associated credits should be released. This commit avoids race condition when main thread is unlinking while workers are running. Fixes: a29248b57b31 ("event/dlb2: add port unlink and unlinks in progress") Cc: stable@dpdk.org Signed-off-by: Pravin Pathak <pravin.pathak@intel.com> --- drivers/event/dlb2/dlb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 28c9054f63..6734e93eac 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -2664,7 +2664,7 @@ dlb2_eventdev_port_unlink(struct rte_eventdev *dev, void *event_port, DLB2_LOG_LINE_DBG("dlb2: ignore unlink from dir port %d", ev_port->id); rte_errno = 0; - return nb_unlinks; /* as if success */ + goto ret_credits; } dlb2 = ev_port->dlb2; -- 2.39.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 6/7] event/dlb2: fix qid depth xstat in vector path [not found] ` <20250617182631.257612-1-pravin.pathak@intel.com> ` (3 preceding siblings ...) 2025-06-17 18:26 ` [PATCH v3 5/7] event/dlb2: fix to avoid credit release race condition Pravin Pathak @ 2025-06-17 18:26 ` Pravin Pathak 2025-06-17 18:26 ` [PATCH v3 7/7] event/dlb2: fix default credits based on HW version Pravin Pathak 5 siblings, 0 replies; 13+ messages in thread From: Pravin Pathak @ 2025-06-17 18:26 UTC (permalink / raw) To: dev Cc: jerinj, mike.ximing.chen, bruce.richardson, thomas, david.marchand, nipun.gupta, chenbox, tirthendu.sarkar, Pravin Pathak, stable update QID depth xstats counter in vector dequeue path Fixes: 000a7b8e7582 ("event/dlb2: optimize dequeue operation") Cc: stable@dpdk.org Signed-off-by: Pravin Pathak <pravin.pathak@intel.com> --- drivers/event/dlb2/dlb2.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 6734e93eac..6dfb345de8 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -4138,6 +4138,8 @@ _process_deq_qes_vec_impl(struct dlb2_port *qm_port, _mm_storeu_si128((__m128i *)&events[3], v_ev_3); DLB2_INC_STAT(qm_port->ev_port->stats.rx_sched_cnt[hw_sched3], 1); + DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid3].\ + qid_depth[RTE_PMD_DLB2_GET_QID_DEPTH(&events[3])], 1); /* fallthrough */ case 3: v_ev_2 = _mm_unpacklo_epi64(v_unpk_ev_23, v_qe_2); @@ -4145,6 +4147,8 @@ _process_deq_qes_vec_impl(struct dlb2_port *qm_port, _mm_storeu_si128((__m128i *)&events[2], v_ev_2); DLB2_INC_STAT(qm_port->ev_port->stats.rx_sched_cnt[hw_sched2], 1); + DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid2].\ + qid_depth[RTE_PMD_DLB2_GET_QID_DEPTH(&events[2])], 1); /* fallthrough */ case 2: v_ev_1 = _mm_blend_epi16(v_unpk_ev_01, v_qe_1, 0x0F); @@ -4153,6 +4157,8 @@ _process_deq_qes_vec_impl(struct dlb2_port *qm_port, _mm_storeu_si128((__m128i *)&events[1], v_ev_1); DLB2_INC_STAT(qm_port->ev_port->stats.rx_sched_cnt[hw_sched1], 1); + DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid1].\ + qid_depth[RTE_PMD_DLB2_GET_QID_DEPTH(&events[1])], 1); /* fallthrough */ case 1: v_ev_0 = _mm_unpacklo_epi64(v_unpk_ev_01, v_qe_0); @@ -4160,6 +4166,8 @@ _process_deq_qes_vec_impl(struct dlb2_port *qm_port, _mm_storeu_si128((__m128i *)&events[0], v_ev_0); DLB2_INC_STAT(qm_port->ev_port->stats.rx_sched_cnt[hw_sched0], 1); + DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid0].\ + qid_depth[RTE_PMD_DLB2_GET_QID_DEPTH(&events[0])], 1); } qm_port->reorder_id += valid_events; } -- 2.39.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 7/7] event/dlb2: fix default credits based on HW version [not found] ` <20250617182631.257612-1-pravin.pathak@intel.com> ` (4 preceding siblings ...) 2025-06-17 18:26 ` [PATCH v3 6/7] event/dlb2: fix qid depth xstat in vector path Pravin Pathak @ 2025-06-17 18:26 ` Pravin Pathak 5 siblings, 0 replies; 13+ messages in thread From: Pravin Pathak @ 2025-06-17 18:26 UTC (permalink / raw) To: dev Cc: jerinj, mike.ximing.chen, bruce.richardson, thomas, david.marchand, nipun.gupta, chenbox, tirthendu.sarkar, stable From: Tirthendu Sarkar <tirthendu.sarkar@intel.com> dlb2_eventdev_info_get() that implements rte_event_dev_info_get() should return the maximum available credits as supported by HW. Set maximum credits before device probing by checking HW version. Fixes: b66a418d2ad3 ("event/dlb2: add v2.5 probe") Cc: stable@dpdk.org Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com> --- drivers/event/dlb2/pf/dlb2_pf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c index a3f3e7f803..6c273742c9 100644 --- a/drivers/event/dlb2/pf/dlb2_pf.c +++ b/drivers/event/dlb2/pf/dlb2_pf.c @@ -756,6 +756,8 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev) if (rte_eal_process_type() == RTE_PROC_PRIMARY) { dlb2 = dlb2_pmd_priv(eventdev); /* rte_zmalloc_socket mem */ dlb2->version = DLB2_HW_DEVICE_FROM_PCI_ID(pci_dev); + if (dlb2->version == DLB2_HW_V2_5) + dlb2_args.max_num_events = DLB2_MAX_NUM_CREDITS(DLB2_HW_V2_5); /* Were we invoked with runtime parameters? */ if (pci_dev->device.devargs) { -- 2.39.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <20250619040316.317733-1-pravin.pathak@intel.com>]
* [PATCH v4 1/7] event/dlb2: fix addresses deq failure when CQ depth <= 16 [not found] ` <20250619040316.317733-1-pravin.pathak@intel.com> @ 2025-06-19 4:03 ` Pravin Pathak 2025-06-19 4:03 ` [PATCH v4 2/7] event/dlb2: fix validaton of LDB port COS ID arguments Pravin Pathak ` (4 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Pravin Pathak @ 2025-06-19 4:03 UTC (permalink / raw) To: dev Cc: jerinj, mike.ximing.chen, bruce.richardson, thomas, david.marchand, nipun.gupta, chenbox, tirthendu.sarkar, Pravin Pathak, stable When application configures a DIR port with CQ depth less than 8, DLB PMD sets port's cq_depth as 8 and token reservation is used to make the effective cq_depth smaller. However, while setting port's cq_depth_mask application configured CQ depth was used resulting in reading incorrect cachelines while dequeuing. Use PMD calculated CQ depth for cq_depth_mask calculation. Fixes: 3a6d0c04e7fb3e ("event/dlb2: add port setup") Cc: stable@dpdk.org Signed-off-by: Pravin Pathak <pravin.pathak@intel.com> Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com> --- drivers/event/dlb2/dlb2.c | 4 ++-- drivers/event/dlb2/pf/dlb2_pf.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 08291b10b8..bec1e88074 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -1951,9 +1951,9 @@ dlb2_hw_create_dir_port(struct dlb2_eventdev *dlb2, qm_port->cq_idx_unmasked = 0; if (dlb2->poll_mode == DLB2_CQ_POLL_MODE_SPARSE) - qm_port->cq_depth_mask = (cfg.cq_depth * 4) - 1; + qm_port->cq_depth_mask = (qm_port->cq_depth * 4) - 1; else - qm_port->cq_depth_mask = cfg.cq_depth - 1; + qm_port->cq_depth_mask = qm_port->cq_depth - 1; qm_port->gen_bit_shift = rte_popcount32(qm_port->cq_depth_mask); /* starting value of gen bit - it toggles at wrap time */ diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c index ac432b81ad..cd2788c035 100644 --- a/drivers/event/dlb2/pf/dlb2_pf.c +++ b/drivers/event/dlb2/pf/dlb2_pf.c @@ -427,7 +427,7 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle, /* Calculate the port memory required, and round up to the nearest * cache line. */ - alloc_sz = cfg->cq_depth * qe_sz; + alloc_sz = RTE_MAX(cfg->cq_depth, DLB2_MIN_HARDWARE_CQ_DEPTH) * qe_sz; alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz); port_base = dlb2_alloc_coherent_aligned(&mz, &cq_base, alloc_sz, -- 2.39.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 2/7] event/dlb2: fix validaton of LDB port COS ID arguments [not found] ` <20250619040316.317733-1-pravin.pathak@intel.com> 2025-06-19 4:03 ` [PATCH v4 1/7] event/dlb2: fix addresses deq failure when CQ depth <= 16 Pravin Pathak @ 2025-06-19 4:03 ` Pravin Pathak 2025-06-19 4:03 ` [PATCH v4 3/7] event/dlb2: fix num single link ports for DLB2.5 Pravin Pathak ` (3 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Pravin Pathak @ 2025-06-19 4:03 UTC (permalink / raw) To: dev Cc: jerinj, mike.ximing.chen, bruce.richardson, thomas, david.marchand, nipun.gupta, chenbox, tirthendu.sarkar, Pravin Pathak, stable While providing port_cos as vdev/pf CLI argument, the port numbers should take into account all ports (LDB and DIR) that are created by the application and the same order should be provided for port_cos parameter. This fix add checks to ensure that above is validated correctly. Fixes: bec8901bfe9f ("event/dlb2: support ldb port specific COS") Cc: stable@dpdk.org Signed-off-by: Pravin Pathak <pravin.pathak@intel.com> --- drivers/event/dlb2/dlb2.c | 32 +++++++++++++++++++++++--------- drivers/event/dlb2/dlb2_priv.h | 1 - 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index bec1e88074..8722e62948 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -194,10 +194,8 @@ dlb2_init_port_cos(struct dlb2_eventdev *dlb2, int *port_cos) for (q = 0; q < DLB2_MAX_NUM_PORTS_ALL; q++) { dlb2->ev_ports[q].cos_id = port_cos[q]; if (port_cos[q] != DLB2_COS_DEFAULT && - dlb2->cos_ports[port_cos[q]] < DLB2_MAX_NUM_LDB_PORTS_PER_COS) { + dlb2->cos_ports[port_cos[q]] < DLB2_MAX_NUM_LDB_PORTS_PER_COS) dlb2->cos_ports[port_cos[q]]++; - dlb2->max_cos_port = q; - } } } @@ -531,8 +529,8 @@ set_port_cos(const char *key __rte_unused, const char *value, void *opaque) { + int first, last, cos_id, i, ports_per_cos[DLB2_COS_NUM_VALS] = {0}; struct dlb2_port_cos *port_cos = opaque; - int first, last, cos_id, i; if (value == NULL || opaque == NULL) { DLB2_LOG_ERR("NULL pointer"); @@ -566,6 +564,14 @@ set_port_cos(const char *key __rte_unused, for (i = first; i <= last; i++) port_cos->cos_id[i] = cos_id; /* indexed by port */ + for (i = 0; i < DLB2_MAX_NUM_PORTS_ALL; i++) + if (port_cos->cos_id[i] != DLB2_COS_DEFAULT && + ++ports_per_cos[port_cos->cos_id[i]] > DLB2_MAX_NUM_LDB_PORTS_PER_COS) { + DLB2_LOG_ERR("Error parsing ldb port cos_id devarg: More than 16 ports for " + "cos_id %d.", port_cos->cos_id[i]); + return -EINVAL; + } + return 0; } @@ -866,9 +872,10 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2, const struct dlb2_hw_rsrcs *resources_asked, uint8_t device_version) { - int ret = 0; - uint32_t cos_ports = 0; + uint32_t total_asked_ports; struct dlb2_create_sched_domain_args *cfg; + uint32_t cos_ports = 0, max_cos_port = 0; + int ret = 0; if (resources_asked == NULL) { DLB2_LOG_ERR("dlb2: dlb2_create NULL parameter"); @@ -876,6 +883,8 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2, goto error_exit; } + total_asked_ports = resources_asked->num_ldb_ports + resources_asked->num_dir_ports; + /* Map generic qm resources to dlb2 resources */ cfg = &handle->cfg.resources; @@ -897,9 +906,14 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2, cos_ports = dlb2->cos_ports[0] + dlb2->cos_ports[1] + dlb2->cos_ports[2] + dlb2->cos_ports[3]; - if (cos_ports > resources_asked->num_ldb_ports || - (cos_ports && dlb2->max_cos_port >= resources_asked->num_ldb_ports)) { - DLB2_LOG_ERR("dlb2: num_ldb_ports < cos_ports"); + for (int i = 0; i < DLB2_MAX_NUM_PORTS_ALL; i++) { + if (dlb2->ev_ports[i].cos_id != DLB2_COS_DEFAULT) + max_cos_port = i; + } + + if (cos_ports > resources_asked->num_ldb_ports || max_cos_port >= total_asked_ports) { + DLB2_LOG_ERR("dlb2: Insufficient num_ldb_ports=%d: cos_ports=%d max_cos_port=%d", + resources_asked->num_ldb_ports, cos_ports, max_cos_port); ret = EINVAL; goto error_exit; } diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h index 4dd7532519..285d427397 100644 --- a/drivers/event/dlb2/dlb2_priv.h +++ b/drivers/event/dlb2/dlb2_priv.h @@ -649,7 +649,6 @@ struct dlb2_eventdev { }; uint32_t cos_ports[DLB2_COS_NUM_VALS]; /* total ldb ports in each class */ uint32_t cos_bw[DLB2_COS_NUM_VALS]; /* bandwidth per cos domain */ - uint8_t max_cos_port; /* Max LDB port from any cos */ bool enable_cq_weight; }; -- 2.39.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 3/7] event/dlb2: fix num single link ports for DLB2.5 [not found] ` <20250619040316.317733-1-pravin.pathak@intel.com> 2025-06-19 4:03 ` [PATCH v4 1/7] event/dlb2: fix addresses deq failure when CQ depth <= 16 Pravin Pathak 2025-06-19 4:03 ` [PATCH v4 2/7] event/dlb2: fix validaton of LDB port COS ID arguments Pravin Pathak @ 2025-06-19 4:03 ` Pravin Pathak 2025-06-19 4:03 ` [PATCH v4 5/7] event/dlb2: fix to avoid credit release race condition Pravin Pathak ` (2 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Pravin Pathak @ 2025-06-19 4:03 UTC (permalink / raw) To: dev Cc: jerinj, mike.ximing.chen, bruce.richardson, thomas, david.marchand, nipun.gupta, chenbox, tirthendu.sarkar, Pravin Pathak, stable DLB 2.0 device has 64 single linked or directed ports. DLB 2.5 device has 96 single linked ports. This commit fixes issue of rte_event_dev_info_get returning 64 instead of 96 single link ports for DLB2.5 Fixes: 4ce7bf9ec1c7 ("event/dlb2: add v2.5 get resources") Cc: stable@dpdk.org Signed-off-by: Pravin Pathak <pravin.pathak@intel.com> --- drivers/event/dlb2/dlb2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 8722e62948..69dc3cf7c9 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -241,16 +241,16 @@ dlb2_hw_query_resources(struct dlb2_eventdev *dlb2) * The capabilities (CAPs) were set at compile time. */ - if (dlb2->max_cq_depth != DLB2_DEFAULT_CQ_DEPTH) - num_ldb_ports = DLB2_MAX_HL_ENTRIES / dlb2->max_cq_depth; - else - num_ldb_ports = dlb2->hw_rsrc_query_results.num_ldb_ports; + num_ldb_ports = dlb2->hw_rsrc_query_results.num_ldb_ports; evdev_dlb2_default_info.max_event_queues = dlb2->hw_rsrc_query_results.num_ldb_queues; evdev_dlb2_default_info.max_event_ports = num_ldb_ports; + evdev_dlb2_default_info.max_single_link_event_port_queue_pairs = + dlb2->hw_rsrc_query_results.num_dir_ports; + if (dlb2->version == DLB2_HW_V2_5) { evdev_dlb2_default_info.max_num_events = dlb2->hw_rsrc_query_results.num_credits; -- 2.39.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 5/7] event/dlb2: fix to avoid credit release race condition [not found] ` <20250619040316.317733-1-pravin.pathak@intel.com> ` (2 preceding siblings ...) 2025-06-19 4:03 ` [PATCH v4 3/7] event/dlb2: fix num single link ports for DLB2.5 Pravin Pathak @ 2025-06-19 4:03 ` Pravin Pathak 2025-06-19 4:03 ` [PATCH v4 6/7] event/dlb2: fix qid depth xstat in vector path Pravin Pathak 2025-06-19 4:03 ` [PATCH v4 7/7] event/dlb2: fix default credits based on HW version Pravin Pathak 5 siblings, 0 replies; 13+ messages in thread From: Pravin Pathak @ 2025-06-19 4:03 UTC (permalink / raw) To: dev Cc: jerinj, mike.ximing.chen, bruce.richardson, thomas, david.marchand, nipun.gupta, chenbox, tirthendu.sarkar, Pravin Pathak, stable While unlinking ports, all associated credits should be released. This commit avoids race condition when main thread is unlinking while workers are running. Fixes: a29248b57b31 ("event/dlb2: add port unlink and unlinks in progress") Cc: stable@dpdk.org Signed-off-by: Pravin Pathak <pravin.pathak@intel.com> --- drivers/event/dlb2/dlb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 52edb75fa0..f9bdfb3503 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -2664,7 +2664,7 @@ dlb2_eventdev_port_unlink(struct rte_eventdev *dev, void *event_port, DLB2_LOG_LINE_DBG("dlb2: ignore unlink from dir port %d", ev_port->id); rte_errno = 0; - return nb_unlinks; /* as if success */ + goto ret_credits; } dlb2 = ev_port->dlb2; -- 2.39.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 6/7] event/dlb2: fix qid depth xstat in vector path [not found] ` <20250619040316.317733-1-pravin.pathak@intel.com> ` (3 preceding siblings ...) 2025-06-19 4:03 ` [PATCH v4 5/7] event/dlb2: fix to avoid credit release race condition Pravin Pathak @ 2025-06-19 4:03 ` Pravin Pathak 2025-06-19 4:03 ` [PATCH v4 7/7] event/dlb2: fix default credits based on HW version Pravin Pathak 5 siblings, 0 replies; 13+ messages in thread From: Pravin Pathak @ 2025-06-19 4:03 UTC (permalink / raw) To: dev Cc: jerinj, mike.ximing.chen, bruce.richardson, thomas, david.marchand, nipun.gupta, chenbox, tirthendu.sarkar, Pravin Pathak, stable update QID depth xstats counter in vector dequeue path Fixes: 000a7b8e7582 ("event/dlb2: optimize dequeue operation") Cc: stable@dpdk.org Signed-off-by: Pravin Pathak <pravin.pathak@intel.com> --- drivers/event/dlb2/dlb2.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index f9bdfb3503..fd8cc70f3c 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -4145,6 +4145,8 @@ _process_deq_qes_vec_impl(struct dlb2_port *qm_port, _mm_storeu_si128((__m128i *)&events[3], v_ev_3); DLB2_INC_STAT(qm_port->ev_port->stats.rx_sched_cnt[hw_sched3], 1); + DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid3].\ + qid_depth[RTE_PMD_DLB2_GET_QID_DEPTH(&events[3])], 1); /* fallthrough */ case 3: v_ev_2 = _mm_unpacklo_epi64(v_unpk_ev_23, v_qe_2); @@ -4152,6 +4154,8 @@ _process_deq_qes_vec_impl(struct dlb2_port *qm_port, _mm_storeu_si128((__m128i *)&events[2], v_ev_2); DLB2_INC_STAT(qm_port->ev_port->stats.rx_sched_cnt[hw_sched2], 1); + DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid2].\ + qid_depth[RTE_PMD_DLB2_GET_QID_DEPTH(&events[2])], 1); /* fallthrough */ case 2: v_ev_1 = _mm_blend_epi16(v_unpk_ev_01, v_qe_1, 0x0F); @@ -4160,6 +4164,8 @@ _process_deq_qes_vec_impl(struct dlb2_port *qm_port, _mm_storeu_si128((__m128i *)&events[1], v_ev_1); DLB2_INC_STAT(qm_port->ev_port->stats.rx_sched_cnt[hw_sched1], 1); + DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid1].\ + qid_depth[RTE_PMD_DLB2_GET_QID_DEPTH(&events[1])], 1); /* fallthrough */ case 1: v_ev_0 = _mm_unpacklo_epi64(v_unpk_ev_01, v_qe_0); @@ -4167,6 +4173,8 @@ _process_deq_qes_vec_impl(struct dlb2_port *qm_port, _mm_storeu_si128((__m128i *)&events[0], v_ev_0); DLB2_INC_STAT(qm_port->ev_port->stats.rx_sched_cnt[hw_sched0], 1); + DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid0].\ + qid_depth[RTE_PMD_DLB2_GET_QID_DEPTH(&events[0])], 1); } qm_port->reorder_id += valid_events; } -- 2.39.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 7/7] event/dlb2: fix default credits based on HW version [not found] ` <20250619040316.317733-1-pravin.pathak@intel.com> ` (4 preceding siblings ...) 2025-06-19 4:03 ` [PATCH v4 6/7] event/dlb2: fix qid depth xstat in vector path Pravin Pathak @ 2025-06-19 4:03 ` Pravin Pathak 2025-06-19 8:37 ` Jerin Jacob 5 siblings, 1 reply; 13+ messages in thread From: Pravin Pathak @ 2025-06-19 4:03 UTC (permalink / raw) To: dev Cc: jerinj, mike.ximing.chen, bruce.richardson, thomas, david.marchand, nipun.gupta, chenbox, tirthendu.sarkar, stable From: Tirthendu Sarkar <tirthendu.sarkar@intel.com> dlb2_eventdev_info_get() that implements rte_event_dev_info_get() should return the maximum available credits as supported by HW. Set maximum credits before device probing by checking HW version. Fixes: b66a418d2ad3 ("event/dlb2: add v2.5 probe") Cc: stable@dpdk.org Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com> --- drivers/event/dlb2/pf/dlb2_pf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c index 15a06bee4f..edcdfb319f 100644 --- a/drivers/event/dlb2/pf/dlb2_pf.c +++ b/drivers/event/dlb2/pf/dlb2_pf.c @@ -789,6 +789,8 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev) if (rte_eal_process_type() == RTE_PROC_PRIMARY) { dlb2 = dlb2_pmd_priv(eventdev); /* rte_zmalloc_socket mem */ dlb2->version = DLB2_HW_DEVICE_FROM_PCI_ID(pci_dev); + if (dlb2->version == DLB2_HW_V2_5) + dlb2_args.max_num_events = DLB2_MAX_NUM_CREDITS(DLB2_HW_V2_5); /* Were we invoked with runtime parameters? */ if (pci_dev->device.devargs) { -- 2.39.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v4 7/7] event/dlb2: fix default credits based on HW version 2025-06-19 4:03 ` [PATCH v4 7/7] event/dlb2: fix default credits based on HW version Pravin Pathak @ 2025-06-19 8:37 ` Jerin Jacob 0 siblings, 0 replies; 13+ messages in thread From: Jerin Jacob @ 2025-06-19 8:37 UTC (permalink / raw) To: Pravin Pathak Cc: dev, jerinj, mike.ximing.chen, bruce.richardson, thomas, david.marchand, nipun.gupta, chenbox, tirthendu.sarkar, stable On Thu, Jun 19, 2025 at 9:34 AM Pravin Pathak <pravin.pathak@intel.com> wrote: > > From: Tirthendu Sarkar <tirthendu.sarkar@intel.com> > > dlb2_eventdev_info_get() that implements rte_event_dev_info_get() should > return the maximum available credits as supported by HW. > > Set maximum credits before device probing by checking HW version. > > Fixes: b66a418d2ad3 ("event/dlb2: add v2.5 probe") > Cc: stable@dpdk.org > > Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com> Series applied to dpdk-next-net-eventdev/for-main. Thanks ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2025-06-19 8:38 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20250509042401.2634765-1-pravin.pathak@intel.com> [not found] ` <20250617182631.257612-1-pravin.pathak@intel.com> 2025-06-17 18:26 ` [PATCH v3 1/7] event/dlb2: fix addresses deq failure when CQ depth <= 16 Pravin Pathak 2025-06-17 18:26 ` [PATCH v3 2/7] event/dlb2: fix validaton of LDB port COS ID arguments Pravin Pathak 2025-06-17 18:26 ` [PATCH v3 3/7] event/dlb2: fix num single link ports for DLB2.5 Pravin Pathak 2025-06-17 18:26 ` [PATCH v3 5/7] event/dlb2: fix to avoid credit release race condition Pravin Pathak 2025-06-17 18:26 ` [PATCH v3 6/7] event/dlb2: fix qid depth xstat in vector path Pravin Pathak 2025-06-17 18:26 ` [PATCH v3 7/7] event/dlb2: fix default credits based on HW version Pravin Pathak [not found] ` <20250619040316.317733-1-pravin.pathak@intel.com> 2025-06-19 4:03 ` [PATCH v4 1/7] event/dlb2: fix addresses deq failure when CQ depth <= 16 Pravin Pathak 2025-06-19 4:03 ` [PATCH v4 2/7] event/dlb2: fix validaton of LDB port COS ID arguments Pravin Pathak 2025-06-19 4:03 ` [PATCH v4 3/7] event/dlb2: fix num single link ports for DLB2.5 Pravin Pathak 2025-06-19 4:03 ` [PATCH v4 5/7] event/dlb2: fix to avoid credit release race condition Pravin Pathak 2025-06-19 4:03 ` [PATCH v4 6/7] event/dlb2: fix qid depth xstat in vector path Pravin Pathak 2025-06-19 4:03 ` [PATCH v4 7/7] event/dlb2: fix default credits based on HW version Pravin Pathak 2025-06-19 8:37 ` Jerin Jacob
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).