event/dlb2: dlb2 hw resource management
cover event/dlb2: dlb2 hw resource management
This patchset introduces various fixes related to dlb2 hw resource management. The dlb2 hw has limited resources, which are configurable using command line options. This patch allows managing History list, scheduling bandwidth and credits using command line options. It also fixes some issues with resources management.
Pravin Pathak (6):
event/dlb2: addresses deq failure when CQ depth <= 16 event/dlb2: changes to correctly validate COS ID arguments event/dlb2: return 96 single link ports for DLB2.5 event/dlb2: support managing history list resource event/dlb2: avoid credit release race condition event/dlb2: update qid depth xstat in vector path
Tirthendu Sarkar (1):
event/dlb2: fix default credits in dlb2_eventdev_info_get()
drivers/event/dlb2/dlb2.c | 274 +++++++++++++++++---- drivers/event/dlb2/dlb2_iface.c | 5 +- drivers/event/dlb2/dlb2_iface.h | 4 +- drivers/event/dlb2/dlb2_priv.h | 20 +- drivers/event/dlb2/dlb2_user.h | 24 ++ drivers/event/dlb2/pf/base/dlb2_regs.h | 9 + drivers/event/dlb2/pf/base/dlb2_resource.c | 74 ++++++ drivers/event/dlb2/pf/base/dlb2_resource.h | 18 ++ drivers/event/dlb2/pf/dlb2_pf.c | 33 ++- drivers/event/dlb2/rte_pmd_dlb2.c | 23 ++ drivers/event/dlb2/rte_pmd_dlb2.h | 40 +++ drivers/event/dlb2/version.map | 1 + 12 files changed, 463 insertions(+), 62 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/7 event/dlb2: addresses deq failure when CQ depth <= 16
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.
--- drivers/event/dlb2/dlb2.c | 4 ++-- drivers/event/dlb2/pf/dlb2_pf.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/event/dlb2/dlb2.c +2 -2
@@ -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 */
drivers/event/dlb2/pf/dlb2_pf.c +1 -1
@@ -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,
Signature · 1 line
2.25.1
PATCH 2/7 event/dlb2: changes to correctly validate COS ID arguments
In reply to Pravin PathakWhile 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.
--- drivers/event/dlb2/dlb2.c | 32 +++++++++++++++++++++++--------- drivers/event/dlb2/dlb2_priv.h | 1 - 2 files changed, 23 insertions(+), 10 deletions(-)
drivers/event/dlb2/dlb2.c +23 -9
@@ -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; }
drivers/event/dlb2/dlb2_priv.h +0 -1
@@ -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; };
Signature · 1 line
2.25.1
PATCH 3/7 event/dlb2: return 96 single link ports for DLB2.5
In reply to Pravin PathakDLB 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
--- drivers/event/dlb2/dlb2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/event/dlb2/dlb2.c +4 -4
@@ -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;
Signature · 1 line
2.25.1
PATCH 4/7 event/dlb2: support managing history list resource
In reply to Pravin PathakAdd support for setting application specified port history Set HL equal to CQ depth when inflight control is enabled Added command line parameters 'use_default_hl' (default: 1)
and 'alloc_hl_entries'
- When 'use_default_hl = 1'
* Per port HL is set to DLB2_FIXED_CQ_HL_SIZE (32)
* Recommended CQ depth by dlb2_eventdev_port_default_conf_get()
is DLB2_FIXED_CQ_HL_SIZE/2
* command line parameter alloc_hl_entries is ignored
- When 'use_default_hl = 0'
* Per LDB port HL = 2 * CQ depth
* Recommended CQ depth by dlb2_eventdev_port_default_conf_get() is DLB2_FIXED_CQ_HL_SIZE
* User should calculate needed HL entries based on CQ depths the application will use and specify it as command line parameter 'alloc_hl_entries'. This will be used to allocate HL entries. alloc_hl_entries = (Sum of all LDB ports CQ depths * 2)
* If alloc_hl_entries is not specified, then
Total HL entries for the eventdev = num_ldb_ports * 64
--- drivers/event/dlb2/dlb2.c | 220 +++++++++++++++++---- drivers/event/dlb2/dlb2_iface.c | 5 +- drivers/event/dlb2/dlb2_iface.h | 4 +- drivers/event/dlb2/dlb2_priv.h | 19 +- drivers/event/dlb2/dlb2_user.h | 24 +++ drivers/event/dlb2/pf/base/dlb2_regs.h | 9 + drivers/event/dlb2/pf/base/dlb2_resource.c | 74 +++++++ drivers/event/dlb2/pf/base/dlb2_resource.h | 18 ++ drivers/event/dlb2/pf/dlb2_pf.c | 29 ++- drivers/event/dlb2/rte_pmd_dlb2.c | 23 +++ drivers/event/dlb2/rte_pmd_dlb2.h | 40 ++++ drivers/event/dlb2/version.map | 1 + 12 files changed, 422 insertions(+), 44 deletions(-)
drivers/event/dlb2/dlb2.c +182 -38
@@ -727,6 +727,50 @@ set_enable_cq_weight(const char *key __rte_unused,return 0 ; } +static int set_hl_override(const char *key __rte_unused, const char *value, +void *opaque) +{ +bool *default_hl = opaque; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer" ); +return -EINVAL ; + } + +if ((*value =='n' ) || (*value =='N' ) || (*value =='0' )) + *default_hl = false; +else + *default_hl = true; + +return 0 ; +} + +static int set_hl_entries(const char *key __rte_unused, const char *value, +void *opaque) +{ +int hl_entries =0 ; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (&hl_entries, value); +if (ret <0 ) +return ret; + +if (!hl_entries || (uint32_t )hl_entries >DLB2_MAX_HL_ENTRIES ) { +DLB2_LOG_ERR ( +"alloc_hl_entries %u out of range, must be in [1 - %d]" , + hl_entries,DLB2_MAX_HL_ENTRIES ); +return -EINVAL ; + } + *(uint32_t *)opaque = hl_entries; + +return 0 ; +} + static int set_qid_depth_thresh(const char *key __rte_unused, const char *value,
@@ -932,8 +976,16 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2,DLB2_NUM_ATOMIC_INFLIGHTS_PER_QUEUE * cfg->num_ldb_queues; - cfg->num_hist_list_entries = resources_asked->num_ldb_ports * - evdev_dlb2_default_info.max_event_port_dequeue_depth; +/* If hl_entries is non-zero then user specified command line option. +* Else compute using default_port_hl that has been set earlier based +* on use_default_hl option +*/ +if (dlb2->hl_entries) { + cfg->num_hist_list_entries = dlb2->hl_entries; + }else { + cfg->num_hist_list_entries = + resources_asked->num_ldb_ports * dlb2->default_port_hl; + }if (device_version ==DLB2_HW_V2_5 ) { DLB2_LOG_LINE_DBG("sched domain create - ldb_qs=%d, ldb_ports=%d, dir_ports=%d, atomic_inflights=%d, hist_list_entries=%d, credits=%d",
@@ -1154,8 +1206,8 @@ dlb2_eventdev_port_default_conf_get(struct rte_eventdev *dev,struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); port_conf->new_event_threshold = dlb2->new_event_limit; - port_conf->dequeue_depth =32 ; - port_conf->enqueue_depth =DLB2_MAX_ENQUEUE_DEPTH ; + port_conf->dequeue_depth = dlb2->default_port_hl /2 ; + port_conf->enqueue_depth = evdev_dlb2_default_info.max_event_port_enqueue_depth; port_conf->event_port_cfg =0 ; }
@@ -1647,16 +1699,14 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, {struct dlb2_hw_dev *handle = &dlb2->qm_instance;struct dlb2_create_ldb_port_args cfg = { {0 } }; -int ret; -struct dlb2_port *qm_port =NULL ; +struct dlb2_port *qm_port = &ev_port->qm_port;char mz_name[RTE_MEMZONE_NAMESIZE ];uint32_t qm_port_id; -uint16_t ldb_credit_high_watermark =0 ; -uint16_t dir_credit_high_watermark =0 ; -uint16_t credit_high_watermark =0 ; +int ret;if (handle ==NULL )return -EINVAL ; + (void ) enqueue_depth;if (dequeue_depth <DLB2_MIN_CQ_DEPTH ) { DLB2_LOG_ERR("dlb2: invalid cq depth, must be at least %d",
@@ -1670,27 +1720,23 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, cfg.cq_depth =rte_align32pow2 (dequeue_depth); cfg.cq_depth_threshold =1 ; - cfg.cq_history_list_size = cfg.cq_depth; +if (dlb2->version ==DLB2_HW_V2_5 && qm_port->enable_inflight_ctrl) { + cfg.enable_inflight_ctrl =1 ; + cfg.inflight_threshold = qm_port->inflight_threshold; + } + +if (qm_port->hist_list) + cfg.cq_history_list_size = qm_port->hist_list; +else if (cfg.enable_inflight_ctrl) + cfg.cq_history_list_size =RTE_MIN (cfg.cq_depth, dlb2->default_port_hl); +else if (dlb2->default_port_hl ==DLB2_FIXED_CQ_HL_SIZE ) + cfg.cq_history_list_size =DLB2_FIXED_CQ_HL_SIZE ; +else + cfg.cq_history_list_size = cfg.cq_depth *2 ; cfg.cos_id = ev_port->cos_id; cfg.cos_strict =0 ;/* best effots */ -/* User controls the LDB high watermark via enqueue depth. The DIR high -* watermark is equal, unless the directed credit pool is too small. -*/ -if (dlb2->version ==DLB2_HW_V2 ) { - ldb_credit_high_watermark = enqueue_depth; -/* If there are no directed ports, the kernel driver will -* ignore this port's directed credit settings. Don't use -* enqueue_depth if it would require more directed credits -* than are available. -*/ - dir_credit_high_watermark = -RTE_MIN (enqueue_depth, - handle->cfg.num_dir_credits / dlb2->num_ports); - }else - credit_high_watermark = enqueue_depth; -/* Per QM values */ ret =dlb2_iface_ldb_port_create (handle, &cfg, dlb2->poll_mode);
@@ -1793,24 +1839,18 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, qm_port->config_state =DLB2_CONFIGURED ;if (dlb2->version ==DLB2_HW_V2 ) { - qm_port->dir_credits = dir_credit_high_watermark; - qm_port->ldb_credits = ldb_credit_high_watermark; qm_port->credit_pool[DLB2_DIR_QUEUE ] = &dlb2->dir_credit_pool; qm_port->credit_pool[DLB2_LDB_QUEUE ] = &dlb2->ldb_credit_pool; -DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d, ldb credits=%d, dir credits=%d" , +DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d" , qm_port_id, - dequeue_depth, - qm_port->ldb_credits, - qm_port->dir_credits); + dequeue_depth); }else { - qm_port->credits = credit_high_watermark; qm_port->credit_pool[DLB2_COMBINED_POOL ] = &dlb2->credit_pool; -DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d, credits=%d" , +DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d" , qm_port_id, - dequeue_depth, - qm_port->credits); + dequeue_depth); } qm_port->use_scalar = false;
@@ -1830,8 +1870,7 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, error_exit: -if (qm_port) -dlb2_free_qe_mem (qm_port); +dlb2_free_qe_mem (qm_port);rte_spinlock_unlock (&handle->resource_lock);
@@ -4648,6 +4687,67 @@ dlb2_get_queue_depth(struct dlb2_eventdev *dlb2,return dlb2_get_ldb_queue_depth (dlb2, queue); } +#define PARAM_ERR (param, ret, err_str)\ + do { \ + if (!ret) \ + ret = -EINVAL; \ + DLB2_LOG_ERR("dlb2: dlb2_set_port_param error, param=%lx ret=%d %s",\ + param, ret, err_str); \ + } while (0) + +int +dlb2_set_port_param (struct dlb2_eventdev *dlb2, +int port_id, +uint64_t param_flags, +void *param_val) +{ +struct dlb2_port_param *port_param = (struct dlb2_port_param *)param_val; +struct dlb2_port *port = &dlb2->ev_ports[port_id].qm_port; +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +int ret =0 , bit =0 ; + +while (param_flags) { +uint64_t param =rte_bit_relaxed_test_and_clear64 (bit++, ¶m_flags); + +if (!param) +continue ; +switch (param) { +case DLB2_FLOW_MIGRATION_THRESHOLD : +if (dlb2->version ==DLB2_HW_V2_5 ) { +struct dlb2_cq_inflight_ctrl_args args = {0 }; + + args.enable = true; + args.port_id = port->id; + args.threshold = port_param->inflight_threshold; +if (dlb2->ev_ports[port_id].setup_done) + ret =dlb2_iface_set_cq_inflight_ctrl (handle, &args); +if (ret) { +PARAM_ERR (param, ret,"Failed to set inflight threshold" ); +return ret; + } + port->enable_inflight_ctrl = true; + port->inflight_threshold = args.threshold; + }else { +PARAM_ERR (param, ret,"FLOW_MIGRATION_THRESHOLD is only supported for 2.5 HW" ); +return ret; + } +break ; +case DLB2_SET_PORT_HL : +if (dlb2->ev_ports[port_id].setup_done) { +PARAM_ERR (param, ret,"DLB2_SET_PORT_HL must be called before setting up port" ); +return ret; + } + port->hist_list = port_param->port_hl; +break ; +default : +PARAM_ERR (param, ret,"Unsupported flag" ); +return ret; + } + } + +return ret; +} +static bool dlb2_queue_is_empty (struct dlb2_eventdev *dlb2,struct dlb2_eventdev_queue *queue)
@@ -4953,6 +5053,28 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev,return err; } +if (dlb2_args->use_default_hl) { + dlb2->default_port_hl =DLB2_FIXED_CQ_HL_SIZE ; +if (dlb2_args->alloc_hl_entries) +DLB2_LOG_ERR (": Ignoring 'alloc_hl_entries' and using " +"default history list sizes for eventdev:" +" %s" , dev->data->name); + dlb2->hl_entries =0 ; + }else { + dlb2->default_port_hl =2 *DLB2_FIXED_CQ_HL_SIZE ; + +if (dlb2_args->alloc_hl_entries > + dlb2->hw_rsrc_query_results.num_hist_list_entries) { +DLB2_LOG_ERR (": Insufficient HL entries asked=%d " +"available=%d for eventdev: %s" , + dlb2->hl_entries, + dlb2->hw_rsrc_query_results.num_hist_list_entries, + dev->data->name); +return -EINVAL ; + } + dlb2->hl_entries = dlb2_args->alloc_hl_entries; + } +dlb2_iface_hardware_init (&dlb2->qm_instance);/* configure class of service */
@@ -5060,6 +5182,8 @@ dlb2_parse_params(const char *params,DLB2_PRODUCER_COREMASK ,DLB2_DEFAULT_LDB_PORT_ALLOCATION_ARG ,DLB2_ENABLE_CQ_WEIGHT_ARG , +DLB2_USE_DEFAULT_HL , +DLB2_ALLOC_HL_ENTRIES , NULL };if (params !=NULL && params[0 ] !='\0' ) {
@@ -5274,6 +5398,26 @@ dlb2_parse_params(const char *params,if (version ==DLB2_HW_V2 && dlb2_args->enable_cq_weight)DLB2_LOG_INFO ("Ignoring 'enable_cq_weight=y'. Only supported for 2.5 HW onwards" ); + ret =rte_kvargs_process (kvlist,DLB2_USE_DEFAULT_HL , + set_hl_override, + &dlb2_args->use_default_hl); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing hl_override arg" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist,DLB2_ALLOC_HL_ENTRIES , + set_hl_entries, + &dlb2_args->alloc_hl_entries); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing hl_override arg" , + name); +rte_kvargs_free (kvlist); +return ret; + } +rte_kvargs_free (kvlist); } }
drivers/event/dlb2/dlb2_iface.c +4 -1
@@ -73,9 +73,12 @@ int (*dlb2_iface_get_ldb_queue_depth)(struct dlb2_hw_dev *handle,int (*dlb2_iface_get_dir_queue_depth)(struct dlb2_hw_dev *handle,struct dlb2_get_dir_queue_depth_args *args); -int (*dlb2_iface_enable_cq_weight)(struct dlb2_hw_dev *handle,struct dlb2_enable_cq_weight_args *args); +int (*dlb2_iface_set_cq_inflight_ctrl)(struct dlb2_hw_dev *handle, +struct dlb2_cq_inflight_ctrl_args *args); +int (*dlb2_iface_set_cos_bw)(struct dlb2_hw_dev *handle,struct dlb2_set_cos_bw_args *args); +
drivers/event/dlb2/dlb2_iface.h +3 -1
@@ -72,10 +72,12 @@ extern int (*dlb2_iface_get_ldb_queue_depth)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_get_dir_queue_depth)(struct dlb2_hw_dev *handle,struct dlb2_get_dir_queue_depth_args *args); -extern int (*dlb2_iface_enable_cq_weight)(struct dlb2_hw_dev *handle,struct dlb2_enable_cq_weight_args *args); +extern int (*dlb2_iface_set_cq_inflight_ctrl)(struct dlb2_hw_dev *handle, +struct dlb2_cq_inflight_ctrl_args *args); +extern int (*dlb2_iface_set_cos_bw)(struct dlb2_hw_dev *handle,struct dlb2_set_cos_bw_args *args);
drivers/event/dlb2/dlb2_priv.h +16 -3
@@ -53,6 +53,8 @@#define DLB2_PRODUCER_COREMASK "producer_coremask"#define DLB2_DEFAULT_LDB_PORT_ALLOCATION_ARG "default_port_allocation"#define DLB2_ENABLE_CQ_WEIGHT_ARG "enable_cq_weight" +#define DLB2_USE_DEFAULT_HL "use_default_hl" +#define DLB2_ALLOC_HL_ENTRIES "alloc_hl_entries"/* Begin HW related defines and structs */
@@ -101,7 +103,8 @@*/ #define DLB2_MAX_HL_ENTRIES 2048#define DLB2_MIN_CQ_DEPTH 1 -#define DLB2_DEFAULT_CQ_DEPTH 32 +#define DLB2_DEFAULT_CQ_DEPTH 128/* Override using max_cq_depth parameter */ +#define DLB2_FIXED_CQ_HL_SIZE 32/* Used when ENABLE_FIXED_HL_SIZE is true */ #define DLB2_MIN_HARDWARE_CQ_DEPTH 8#define DLB2_NUM_HIST_LIST_ENTRIES_PER_LDB_PORT \ DLB2_DEFAULT_CQ_DEPTH
@@ -123,7 +126,7 @@#define DLB2_NUM_QES_PER_CACHE_LINE 4 -#define DLB2_MAX_ENQUEUE_DEPTH 32 +#define DLB2_MAX_ENQUEUE_DEPTH 128#define DLB2_MIN_ENQUEUE_DEPTH 4#define DLB2_NAME_SIZE 64
@@ -385,10 +388,13 @@ struct dlb2_port {struct dlb2_eventdev *dlb2;/* back ptr */ struct dlb2_eventdev_port *ev_port;/* back ptr */ bool use_scalar;/* force usage of scalar code */ +uint8_t reorder_id;/* id used for reordering events coming back into the scheduler */ uint16_t hw_credit_quanta;bool use_avx512; +bool enable_inflight_ctrl;/*DLB2.5 enable HW inflight control */ bool is_producer;/* True if port is of type producer */ -uint8_t reorder_id;/* id used for reordering events coming back into the scheduler */ +uint16_t inflight_threshold;/* DLB2.5 HW inflight threshold */ +uint16_t hist_list;/* Port history list */ bool reorder_en;struct dlb2_reorder *order;/* For ordering enqueues */ };
@@ -650,6 +656,8 @@ 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 */ bool enable_cq_weight; +uint16_t hl_entries;/* Num HL entries to allocate for the domain */ +int default_port_hl;/* Fixed or dynamic (2*CQ Depth) HL assignment */ };/* used for collecting and passing around the dev args */
@@ -683,6 +691,8 @@ struct dlb2_devargs {const char *producer_coremask;bool default_ldb_port_allocation;bool enable_cq_weight; +bool use_default_hl; +uint32_t alloc_hl_entries; };/* End Eventdev related defines and structs */
@@ -725,6 +735,9 @@ int dlb2_secondary_eventdev_probe(struct rte_eventdev *dev,uint32_t dlb2_get_queue_depth (struct dlb2_eventdev *dlb2,struct dlb2_eventdev_queue *queue); +int dlb2_set_port_param (struct dlb2_eventdev *dlb2,int port_id, +uint64_t flags,void *val); + int dlb2_parse_params(const char *params, const char *name, struct dlb2_devargs *dlb2_args,
drivers/event/dlb2/dlb2_user.h +24 -0
@@ -472,6 +472,8 @@ struct dlb2_create_ldb_port_args {__u16 cq_history_list_size;__u8 cos_id;__u8 cos_strict; +__u8 enable_inflight_ctrl; +__u16 inflight_threshold; };/*
@@ -717,6 +719,28 @@ struct dlb2_enable_cq_weight_args {__u32 limit; }; +/* +* DLB2_DOMAIN_CMD_SET_CQ_INFLIGHT_CTRL: Set Per-CQ inflight control for +* {ATM,UNO,ORD} QEs. +* +* Input parameters: +* - port_id: Load-balanced port ID. +* - enable: True if inflight control is enabled. False otherwise +* - threshold: Per CQ inflight threshold. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_cq_inflight_ctrl_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u16 enable; +__u16 threshold; +}; +/* * Mapping sizes for memory mapping the consumer queue (CQ) memory space, and * producer port (PP) MMIO space.
drivers/event/dlb2/pf/base/dlb2_regs.h +9 -0
@@ -3238,6 +3238,15 @@#define DLB2_LSP_CQ_LDB_INFL_LIM_LIMIT_LOC 0#define DLB2_LSP_CQ_LDB_INFL_LIM_RSVD0_LOC 12 +#define DLB2_LSP_CQ_LDB_INFL_THRESH (x) \ + (0x90580000 + (x) * 0x1000) +#define DLB2_LSP_CQ_LDB_INFL_THRESH_RST 0x0 + +#define DLB2_LSP_CQ_LDB_INFL_THRESH_THRESH 0x00000FFF +#define DLB2_LSP_CQ_LDB_INFL_THRESH_RSVD0 0xFFFFF000 +#define DLB2_LSP_CQ_LDB_INFL_THRESH_THRESH_LOC 0 +#define DLB2_LSP_CQ_LDB_INFL_THRESH_RSVD0_LOC 12 +#define DLB2_V2LSP_CQ_LDB_TKN_CNT (x) \ (0xa0580000 + (x) * 0x1000)#define DLB2_V2_5LSP_CQ_LDB_TKN_CNT (x) \
drivers/event/dlb2/pf/base/dlb2_resource.c +74 -0
86 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_resource.h +18 -0
@@ -1956,4 +1956,22 @@ int dlb2_hw_enable_cq_weight(struct dlb2_hw *hw,bool vdev_request, unsigned int vdev_id); +/** +* This function configures the inflight control threshold for a cq. +* +* This must be called after creating the port. +* +* Return: +* Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is +* assigned a detailed error code from enum dlb2_error. If successful, resp->id +* contains the queue ID. +* +* Errors: +* EINVAL - The domain or port is not configured. +*/ +int dlb2_hw_set_cq_inflight_ctrl (struct dlb2_hw *hw,u32 domain_id, +struct dlb2_cq_inflight_ctrl_args *args, +struct dlb2_cmd_response *resp, +bool vdev_request,unsigned int vdev_id); +#endif /* __DLB2_RESOURCE_H */
drivers/event/dlb2/pf/dlb2_pf.c +28 -1
@@ -347,6 +347,7 @@ dlb2_pf_ldb_port_create(struct dlb2_hw_dev *handle, cfg, cq_base, &response); + cfg->response = response;if (ret) goto create_port_err;
@@ -422,6 +423,9 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle, cfg, cq_base, &response); + + cfg->response = response; +if (ret) goto create_port_err;
@@ -646,6 +650,26 @@ dlb2_pf_enable_cq_weight(struct dlb2_hw_dev *handle,return ret; } +static int +dlb2_pf_set_cq_inflight_ctrl (struct dlb2_hw_dev *handle, +struct dlb2_cq_inflight_ctrl_args *args) +{ +struct dlb2_dev *dlb2_dev = (struct dlb2_dev *)handle->pf_dev; +struct dlb2_cmd_response response = {0 }; +int ret =0 ; + +DLB2_INFO (dev->dlb2_device,"Entering %s()\n" , __func__); + + ret =dlb2_hw_set_cq_inflight_ctrl (&dlb2_dev->hw, handle->domain_id, + args, &response, false,0 ); + args->response = response; + +DLB2_INFO (dev->dlb2_device,"Exiting %s() with ret=%d" , + __func__, ret); + +return ret; +} +static int dlb2_pf_set_cos_bandwidth (struct dlb2_hw_dev *handle,struct dlb2_set_cos_bw_args *args)
@@ -691,6 +715,7 @@ dlb2_pf_iface_fn_ptrs_init(void) dlb2_iface_get_sn_occupancy = dlb2_pf_get_sn_occupancy; dlb2_iface_enable_cq_weight = dlb2_pf_enable_cq_weight; dlb2_iface_set_cos_bw = dlb2_pf_set_cos_bandwidth; + dlb2_iface_set_cq_inflight_ctrl = dlb2_pf_set_cq_inflight_ctrl; }/* PCI DEV HOOKS */
@@ -710,7 +735,9 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev) .hw_credit_quanta = DLB2_SW_CREDIT_BATCH_SZ, .default_depth_thresh = DLB2_DEPTH_THRESH_DEFAULT, .max_cq_depth = DLB2_DEFAULT_CQ_DEPTH, - .max_enq_depth = DLB2_MAX_ENQUEUE_DEPTH + .max_enq_depth = DLB2_MAX_ENQUEUE_DEPTH, + .use_default_hl = true, + .alloc_hl_entries = 0 };struct dlb2_eventdev *dlb2;int q;
drivers/event/dlb2/rte_pmd_dlb2.c +23 -0
@@ -37,3 +37,26 @@ rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id,return 0 ; } + +int +rte_pmd_dlb2_set_port_param (uint8_t dev_id, +uint8_t port_id, +uint64_t flags, +void *val) +{ +struct dlb2_eventdev *dlb2; +struct rte_eventdev *dev; + +if (val ==NULL ) +return -EINVAL ; + +RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET (dev_id, -EINVAL ); + dev = &rte_eventdevs[dev_id]; + + dlb2 =dlb2_pmd_priv (dev); + +if (port_id >= dlb2->num_ports) +return -EINVAL ; + +return dlb2_set_port_param (dlb2, port_id, flags, val); +}
drivers/event/dlb2/rte_pmd_dlb2.h +40 -0
@@ -91,6 +91,46 @@ rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id,uint8_t port_id, enum dlb2_token_pop_mode mode); +/** Set inflight threshold for flow migration */ +#define DLB2_FLOW_MIGRATION_THRESHOLD RTE_BIT64(0) + +/** Set port history list */ +#define DLB2_SET_PORT_HL RTE_BIT64(1) + +struct dlb2_port_param { +uint16_t inflight_threshold :12 ; +uint16_t port_hl; +}; + +/*! +* @warning +* @b EXPERIMENTAL: this API may change, or be removed, without prior notice +* +* Configure various port parameters. +* AUTO_POP. This function must be called before calling rte_event_port_setup() +* for the port, but after calling rte_event_dev_configure(). +* +* @param dev_id +* The identifier of the event device. +* @param port_id +* The identifier of the event port. +* @param flags +* Bitmask of the parameters being set. +* @param val +* Structure coantaining the values of parameters being set. +* +* @return +* - 0: Success +* - EINVAL: Invalid dev_id, port_id, or mode +* - EINVAL: The DLB2 is not configured, is already running, or the port is +* already setup +*/ +__rte_experimental +int +rte_pmd_dlb2_set_port_param (uint8_t dev_id, +uint8_t port_id, +uint64_t flags, +void *val); #ifdef __cplusplus }#endif
drivers/event/dlb2/version.map +1 -0
@@ -7,4 +7,5 @@ EXPERIMENTAL { # added in 20.11 rte_pmd_dlb2_set_token_pop_mode; + rte_pmd_dlb2_set_port_param; };
Signature · 1 line
2.25.1
RE: [EXTERNAL] [PATCH v1 4/7] event/dlb2: support managing history list resource
Quoted 1 line
-----Original Message----- > From: Pravin Pathak <pravin. pathak@ intel. com> > Sent: Friday, May 9, 2025 9: 54 AM > To: dev@ dpdk. org > Cc: Jerin Jacob <jerinj@ marvell. com>; mike. ximing. chen@ intel. com; > bruce. richardson@ intel. com; ZjQcmQRYFpfptBannerStart Prioritize security for external emails: Confirm sender and content safety before clicking links or opening attachments Report Suspicious ZjQcmQRYFpfptBannerEnd > -----Original Message----- > From: Pravin Pathak <[email protected]> > Sent: Friday, May 9, 2025 9:54 AM > To: [email protected] > Cc: Jerin Jacob <[email protected]>; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; [email protected]; > [email protected]; Pravin Pathak <[email protected]> > Subject: [EXTERNAL] [PATCH v1 4/7] event/dlb2: support managing history list > resource > > Add support for setting application specified port history Set HL equal to CQ > depth when inflight control is enabled Added command line parameters > '
use_default_hl' (default: 1) and 'alloc_hl_entries' - When 'use_default_hl= 1' * > Per port HL ZjQcmQRYFpfptBannerStart Prioritize security for external emails: > Confirm sender and content safety before clicking links or opening attachments > <https://us-phishalarm- > ewt.proofpoint.com/EWT/v1/CRVmXkqW!tm3Z1f8UAnV69S- > 8OZ3abn2jU1Fw7JxGFGecPxaCk1uQu97fQz1QdXWof_KxtumPzB31X_fWX1Ns4 > HIeAFdHnOYAiGPs37vC1U0$> > Report Suspicious > > ZjQcmQRYFpfptBannerEnd > Add support for setting application specified port history Set HL equal to CQ > depth when inflight control is enabled Added command line parameters > 'use_default_hl' (default: 1) > and 'alloc_hl_entries' > - When 'use_default_hl= 1' > * Per port HL is set toDLB2_FIXED_CQ_HL_SIZE(32) > * Recommended CQ depth bydlb2_eventdev_port_default_conf_get()> is DLB2_FIXED_CQ_HL_SIZE/2 > * command line parameteralloc_hl_entriesis ignored > - When 'use_default_hl= 0' > * Per LDB port HL = 2 * CQ depth > * Recommended CQ depth bydlb2_eventdev_port_default_conf_get()> isDLB2_FIXED_CQ_HL_SIZE> * User should calculate needed HL entries based on CQ depths the > application will use and specify it as command line parameter > 'alloc_hl_entries'. This will be used to allocate HL entries. >alloc_hl_entries= (Sum of all LDB ports CQ depths * 2) > * Ifalloc_hl_entriesis not specified, then > Total HL entries for the eventdev =num_ldb_ports* 64 > > Signed-off-by: Pravin Pathak <[email protected]> > Signed-off-by: Tirthendu Sarkar <[email protected]> > --- >drivers/event/dlb2/dlb2.c| 220 +++++++++++++++++---- >drivers/event/dlb2/dlb2_iface.c| 5 +- >drivers/event/dlb2/dlb2_iface.h| 4 +- >drivers/event/dlb2/dlb2_priv.h| 19 +- >drivers/event/dlb2/dlb2_user.h| 24 +++ >drivers/event/dlb2/pf/base/dlb2_regs.h| 9 + >drivers/event/dlb2/pf/base/dlb2_resource.c| 74 +++++++ >drivers/event/dlb2/pf/base/dlb2_resource.h| 18 ++ >drivers/event/dlb2/pf/dlb2_pf.c| 29 ++- >drivers/event/dlb2/rte_pmd_dlb2.c| 23 +++ >drivers/event/dlb2/rte_pmd_dlb2.h| 40 ++++ >drivers/event/dlb2/version.map| 1 + > 12 files changed, 422 insertions(+), 44 deletions(-) > > diff --gita/drivers/event/dlb2/dlb2.cb/drivers/event/dlb2/dlb2.cindex >24c56a7968..cd843bb9d0100644 > ---a/drivers/event/dlb2/dlb2.c> +++b/drivers/event/dlb2/dlb2.c> @@ -727,6 +727,50 @@ set_enable_cq_weight(const char *key__rte_unused, > return 0; > } > > +static intset_hl_override(const char *key __rte_unused, const char *value, > + void *opaque)> +{ > + bool*default_hl= opaque; > + > + if (value == NULL || opaque == NULL) { > +DLB2_LOG_ERR("NULL pointer"); > + return-EINVAL; > + } > + > + if ((*value == 'n') || (*value == 'N') || (*value == '0')) > +*default_hl= false; > + else > +*default_hl= true; > + > + return 0; > +} > + > +static int set_hl_entries(const char *key__rte_unused, const char *value, > + void * > + > + returndlb2_set_port_param(dlb2, port_id, flags, val); } > diff --gita/drivers/event/dlb2/rte_pmd_dlb2.h>b/drivers/event/dlb2/rte_pmd_dlb2.h> index207ce6a3fd..3f529860ba100644 > ---a/drivers/event/dlb2/rte_pmd_dlb2.h> +++b/drivers/event/dlb2/rte_pmd_dlb2.h> @@ -91,6 +91,46 @@rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id, > uint8_t port_id, > enum dlb2_token_pop_mode mode); > > +/** Set inflight threshold for flow migration */ #define > +DLB2_FLOW_MIGRATION_THRESHOLDRTE_BIT64(0)> + > +/** Set port history list */ > +#defineDLB2_SET_PORT_HLRTE_BIT64(1)> + > +structdlb2_port_param{ > +uint16_tinflight_threshold: 12; > +uint16_tport_hl; > +}; > + > +/*! > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior > +notice > + * > + * Configure various port parameters. > + *AUTO_POP. This function must be called before calling > +rte_event_port_setup() > + * for the port, but after callingrte_event_dev_configure(). > + * > + * @paramdev_id> + * The identifier of the event device. > + * @paramport_id> + * The identifier of the event port. > + * @param flags > + * Bitmask of the parameters being set. > + * @param val > + * Structure coantaining the values of parameters being set. > + * > + * @return > + * - 0: Success > + * - EINVAL: Invaliddev_id,port_id, or mode > + * - EINVAL: The DLB2 is not configured, is already running, or the port is > + * already setup > + */ > +__rte_experimental > +int > +rte_pmd_dlb2_set_port_param(uint8_tdev_id, > +uint8_tport_id, > +uint64_tflags, > + void *val); > #ifdef__cplusplus> } > #endif > diff --git a/drivers/event/dlb2/version.map b/drivers/event/dlb2/version.map > indexc37d2302cd..be5a8f6f2b100644 > --- a/drivers/event/dlb2/version.map > +++ b/drivers/event/dlb2/version.map > @@ -7,4 +7,5 @@ EXPERIMENTAL { > > # added in 20.11 >rte_pmd_dlb2_set_token_pop_mode; > +rte_pmd_dlb2_set_port_param; > }; > -- > 2.25.1
A message that is not in the archive (sent off-list or not yet received): BY3PR18MB4785C4D398C95857C86D67F2C864A@BY3PR18MB4785.namprd18.prod.outlook.com
Re: [EXTERNAL] [PATCH v1 4/7] event/dlb2: support managing history list resource
27/05/2025 07:57, Jerin Jacob:
Quoted 9 lines
From: Pravin Pathak <[email protected]>
drivers/event/dlb2/version.map EXPERIMENTAL { · line 9
Quoted 6 lines
drivers/event/dlb2/version.map +0
-0@@ -7,4 +7,5 @@ EXPERIMENTAL { # added in 20.11 rte_pmd_dlb2_set_token_pop_mode;Add added in 25.07
There is no .map file anymore.
PATCH 5/7 event/dlb2: avoid credit release race condition
In reply to Pravin PathakWhile unlinking ports, all associated credits should be released. This commit avoids race condition when main thread is unlinking while workers are running.
--- drivers/event/dlb2/dlb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/event/dlb2/dlb2.c +1 -1
@@ -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;
Signature · 1 line
2.25.1
PATCH 6/7 event/dlb2: update qid depth xstat in vector path
In reply to Pravin Pathakupdate QID depth xstats counter in vector dequeue path
--- drivers/event/dlb2/dlb2.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/event/dlb2/dlb2.c +8 -0
@@ -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; }
Signature · 1 line
2.25.1
PATCH 7/7 event/dlb2: fix default credits in dlb2_eventdev_info_get()
In reply to Pravin PathakFrom: Tirthendu Sarkar <[email protected]>
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.
--- drivers/event/dlb2/pf/dlb2_pf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/event/dlb2/pf/dlb2_pf.c +2 -0
@@ -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) {
Signature · 1 line
2.25.1
v2 cover event/dlb2: dlb2 hw resource management
In reply to Pravin Pathakv2:
[PATCH v1 3/7] Addressed issue with Fixes tag [PATCH v1 4/7] Renamed structure and Macros to avoid
name space conflicts.
[PATCH v1 4/7] Addressed Doxygen format feedback
Pravin Pathak (6):
event/dlb2: addresses deq failure when CQ depth <= 16 event/dlb2: changes to correctly validate COS ID arguments event/dlb2: return 96 single link ports for DLB2.5 event/dlb2: support managing history list resource event/dlb2: avoid credit release race condition event/dlb2: update qid depth xstat in vector path
Tirthendu Sarkar (1):
event/dlb2: return default credits based on HW version
drivers/event/dlb2/dlb2.c | 274 +++++++++++++++++---- drivers/event/dlb2/dlb2_iface.c | 5 +- drivers/event/dlb2/dlb2_iface.h | 4 +- drivers/event/dlb2/dlb2_priv.h | 20 +- drivers/event/dlb2/dlb2_user.h | 24 ++ drivers/event/dlb2/pf/base/dlb2_regs.h | 9 + drivers/event/dlb2/pf/base/dlb2_resource.c | 74 ++++++ drivers/event/dlb2/pf/base/dlb2_resource.h | 18 ++ drivers/event/dlb2/pf/dlb2_pf.c | 33 ++- drivers/event/dlb2/rte_pmd_dlb2.c | 24 ++ drivers/event/dlb2/rte_pmd_dlb2.h | 48 +++- 11 files changed, 470 insertions(+), 63 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/7 event/dlb2: addresses deq failure when CQ depth <= 16
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.
--- drivers/event/dlb2/dlb2.c | 4 ++-- drivers/event/dlb2/pf/dlb2_pf.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/event/dlb2/dlb2.c +2 -2
@@ -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 */
drivers/event/dlb2/pf/dlb2_pf.c +1 -1
@@ -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,
Signature · 1 line
2.25.1
Re: [PATCH v2 1/7] event/dlb2: addresses deq failure when CQ depth <= 16
Quoted 10 lines · Pravin Pathak
When application configures a DIR port with CQ depth less than 8, DLB PMD sets port's
cq_depthas 8 and token reservation is used to make the effectivecq_depthsmaller. However, while setting port'scq_depth_maskapplication configured CQ depth was used resulting in reading incorrect cachelines while dequeuing. Use PMD calculated CQ depth forcq_depth_maskcalculation.Signed-off-by Pravin Pathak <[email protected]>Signed-off-by Tirthendu Sarkar <[email protected]>
it looks like except 4/7 remaining patches are fixes. please change relevant patches subject to event/dlb2: fix ...
and add Fixes tag,
PATCH v2 2/7 event/dlb2: changes to correctly validate COS ID arguments
In reply to Pravin PathakWhile 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.
--- drivers/event/dlb2/dlb2.c | 32 +++++++++++++++++++++++--------- drivers/event/dlb2/dlb2_priv.h | 1 - 2 files changed, 23 insertions(+), 10 deletions(-)
drivers/event/dlb2/dlb2.c +23 -9
@@ -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; }
drivers/event/dlb2/dlb2_priv.h +0 -1
@@ -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; };
Signature · 1 line
2.25.1
PATCH v2 3/7 event/dlb2: return 96 single link ports for DLB2.5
In reply to Pravin PathakDLB 2.0 device has 64 single linked or directed ports. DLB 2.5 device has 96 single linked ports.
API rte_event_dev_info_get() will return 64 directed ports for DLB 2.0 and 96 single linked ports for DLB2.5
--- drivers/event/dlb2/dlb2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/event/dlb2/dlb2.c +4 -4
@@ -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;
Signature · 1 line
2.25.1
PATCH v2 4/7 event/dlb2: support managing history list resource
In reply to Pravin PathakAdd support for setting application specified port history Set HL equal to CQ depth when inflight control is enabled Added command line parameters 'use_default_hl' (default: 1)
and 'alloc_hl_entries'
- When 'use_default_hl = 1'
* Per port HL is set to DLB2_FIXED_CQ_HL_SIZE (32)
* Recommended CQ depth by dlb2_eventdev_port_default_conf_get()
is DLB2_FIXED_CQ_HL_SIZE/2
* command line parameter alloc_hl_entries is ignored
- When 'use_default_hl = 0'
* Per LDB port HL = 2 * CQ depth
* Recommended CQ depth by dlb2_eventdev_port_default_conf_get() is DLB2_FIXED_CQ_HL_SIZE
* User should calculate needed HL entries based on CQ depths the application will use and specify it as command line parameter 'alloc_hl_entries'. This will be used to allocate HL entries. alloc_hl_entries = (Sum of all LDB ports CQ depths * 2)
* If alloc_hl_entries is not specified, then
Total HL entries for the eventdev = num_ldb_ports * 64
--- drivers/event/dlb2/dlb2.c | 220 +++++++++++++++++---- drivers/event/dlb2/dlb2_iface.c | 5 +- drivers/event/dlb2/dlb2_iface.h | 4 +- drivers/event/dlb2/dlb2_priv.h | 19 +- drivers/event/dlb2/dlb2_user.h | 24 +++ drivers/event/dlb2/pf/base/dlb2_regs.h | 9 + drivers/event/dlb2/pf/base/dlb2_resource.c | 74 +++++++ drivers/event/dlb2/pf/base/dlb2_resource.h | 18 ++ drivers/event/dlb2/pf/dlb2_pf.c | 29 ++- drivers/event/dlb2/rte_pmd_dlb2.c | 24 +++ drivers/event/dlb2/rte_pmd_dlb2.h | 48 ++++- 11 files changed, 429 insertions(+), 45 deletions(-)
drivers/event/dlb2/dlb2.c +182 -38
@@ -727,6 +727,50 @@ set_enable_cq_weight(const char *key __rte_unused,return 0 ; } +static int set_hl_override(const char *key __rte_unused, const char *value, +void *opaque) +{ +bool *default_hl = opaque; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer" ); +return -EINVAL ; + } + +if ((*value =='n' ) || (*value =='N' ) || (*value =='0' )) + *default_hl = false; +else + *default_hl = true; + +return 0 ; +} + +static int set_hl_entries(const char *key __rte_unused, const char *value, +void *opaque) +{ +int hl_entries =0 ; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (&hl_entries, value); +if (ret <0 ) +return ret; + +if (!hl_entries || (uint32_t )hl_entries >DLB2_MAX_HL_ENTRIES ) { +DLB2_LOG_ERR ( +"alloc_hl_entries %u out of range, must be in [1 - %d]" , + hl_entries,DLB2_MAX_HL_ENTRIES ); +return -EINVAL ; + } + *(uint32_t *)opaque = hl_entries; + +return 0 ; +} + static int set_qid_depth_thresh(const char *key __rte_unused, const char *value,
@@ -932,8 +976,16 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2,DLB2_NUM_ATOMIC_INFLIGHTS_PER_QUEUE * cfg->num_ldb_queues; - cfg->num_hist_list_entries = resources_asked->num_ldb_ports * - evdev_dlb2_default_info.max_event_port_dequeue_depth; +/* If hl_entries is non-zero then user specified command line option. +* Else compute using default_port_hl that has been set earlier based +* on use_default_hl option +*/ +if (dlb2->hl_entries) { + cfg->num_hist_list_entries = dlb2->hl_entries; + }else { + cfg->num_hist_list_entries = + resources_asked->num_ldb_ports * dlb2->default_port_hl; + }if (device_version ==DLB2_HW_V2_5 ) { DLB2_LOG_LINE_DBG("sched domain create - ldb_qs=%d, ldb_ports=%d, dir_ports=%d, atomic_inflights=%d, hist_list_entries=%d, credits=%d",
@@ -1154,8 +1206,8 @@ dlb2_eventdev_port_default_conf_get(struct rte_eventdev *dev,struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); port_conf->new_event_threshold = dlb2->new_event_limit; - port_conf->dequeue_depth =32 ; - port_conf->enqueue_depth =DLB2_MAX_ENQUEUE_DEPTH ; + port_conf->dequeue_depth = dlb2->default_port_hl /2 ; + port_conf->enqueue_depth = evdev_dlb2_default_info.max_event_port_enqueue_depth; port_conf->event_port_cfg =0 ; }
@@ -1647,16 +1699,14 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, {struct dlb2_hw_dev *handle = &dlb2->qm_instance;struct dlb2_create_ldb_port_args cfg = { {0 } }; -int ret; -struct dlb2_port *qm_port =NULL ; +struct dlb2_port *qm_port = &ev_port->qm_port;char mz_name[RTE_MEMZONE_NAMESIZE ];uint32_t qm_port_id; -uint16_t ldb_credit_high_watermark =0 ; -uint16_t dir_credit_high_watermark =0 ; -uint16_t credit_high_watermark =0 ; +int ret;if (handle ==NULL )return -EINVAL ; + (void ) enqueue_depth;if (dequeue_depth <DLB2_MIN_CQ_DEPTH ) { DLB2_LOG_ERR("dlb2: invalid cq depth, must be at least %d",
@@ -1670,27 +1720,23 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, cfg.cq_depth =rte_align32pow2 (dequeue_depth); cfg.cq_depth_threshold =1 ; - cfg.cq_history_list_size = cfg.cq_depth; +if (dlb2->version ==DLB2_HW_V2_5 && qm_port->enable_inflight_ctrl) { + cfg.enable_inflight_ctrl =1 ; + cfg.inflight_threshold = qm_port->inflight_threshold; + } + +if (qm_port->hist_list) + cfg.cq_history_list_size = qm_port->hist_list; +else if (cfg.enable_inflight_ctrl) + cfg.cq_history_list_size =RTE_MIN (cfg.cq_depth, dlb2->default_port_hl); +else if (dlb2->default_port_hl ==DLB2_FIXED_CQ_HL_SIZE ) + cfg.cq_history_list_size =DLB2_FIXED_CQ_HL_SIZE ; +else + cfg.cq_history_list_size = cfg.cq_depth *2 ; cfg.cos_id = ev_port->cos_id; cfg.cos_strict =0 ;/* best effots */ -/* User controls the LDB high watermark via enqueue depth. The DIR high -* watermark is equal, unless the directed credit pool is too small. -*/ -if (dlb2->version ==DLB2_HW_V2 ) { - ldb_credit_high_watermark = enqueue_depth; -/* If there are no directed ports, the kernel driver will -* ignore this port's directed credit settings. Don't use -* enqueue_depth if it would require more directed credits -* than are available. -*/ - dir_credit_high_watermark = -RTE_MIN (enqueue_depth, - handle->cfg.num_dir_credits / dlb2->num_ports); - }else - credit_high_watermark = enqueue_depth; -/* Per QM values */ ret =dlb2_iface_ldb_port_create (handle, &cfg, dlb2->poll_mode);
@@ -1793,24 +1839,18 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, qm_port->config_state =DLB2_CONFIGURED ;if (dlb2->version ==DLB2_HW_V2 ) { - qm_port->dir_credits = dir_credit_high_watermark; - qm_port->ldb_credits = ldb_credit_high_watermark; qm_port->credit_pool[DLB2_DIR_QUEUE ] = &dlb2->dir_credit_pool; qm_port->credit_pool[DLB2_LDB_QUEUE ] = &dlb2->ldb_credit_pool; -DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d, ldb credits=%d, dir credits=%d" , +DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d" , qm_port_id, - dequeue_depth, - qm_port->ldb_credits, - qm_port->dir_credits); + dequeue_depth); }else { - qm_port->credits = credit_high_watermark; qm_port->credit_pool[DLB2_COMBINED_POOL ] = &dlb2->credit_pool; -DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d, credits=%d" , +DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d" , qm_port_id, - dequeue_depth, - qm_port->credits); + dequeue_depth); } qm_port->use_scalar = false;
@@ -1830,8 +1870,7 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, error_exit: -if (qm_port) -dlb2_free_qe_mem (qm_port); +dlb2_free_qe_mem (qm_port);rte_spinlock_unlock (&handle->resource_lock);
@@ -4648,6 +4687,67 @@ dlb2_get_queue_depth(struct dlb2_eventdev *dlb2,return dlb2_get_ldb_queue_depth (dlb2, queue); } +#define PARAM_ERR (param, ret, err_str)\ + do { \ + if (!ret) \ + ret = -EINVAL; \ + DLB2_LOG_ERR("dlb2: dlb2_set_port_param error, param=%lx ret=%d %s",\ + param, ret, err_str); \ + } while (0) + +int +dlb2_set_port_param (struct dlb2_eventdev *dlb2, +int port_id, +uint64_t param_flags, +void *param_val) +{ +struct rte_pmd_dlb2_port_param *port_param = (struct rte_pmd_dlb2_port_param *)param_val; +struct dlb2_port *port = &dlb2->ev_ports[port_id].qm_port; +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +int ret =0 , bit =0 ; + +while (param_flags) { +uint64_t param =rte_bit_relaxed_test_and_clear64 (bit++, ¶m_flags); + +if (!param) +continue ; +switch (param) { +case DLB2_SET_PORT_FLOW_MIGRATION_THRESHOLD : +if (dlb2->version ==DLB2_HW_V2_5 ) { +struct dlb2_cq_inflight_ctrl_args args = {0 }; + + args.enable = true; + args.port_id = port->id; + args.threshold = port_param->inflight_threshold; +if (dlb2->ev_ports[port_id].setup_done) + ret =dlb2_iface_set_cq_inflight_ctrl (handle, &args); +if (ret) { +PARAM_ERR (param, ret,"Failed to set inflight threshold" ); +return ret; + } + port->enable_inflight_ctrl = true; + port->inflight_threshold = args.threshold; + }else { +PARAM_ERR (param, ret,"FLOW_MIGRATION_THRESHOLD is only supported for 2.5 HW" ); +return ret; + } +break ; +case DLB2_SET_PORT_HL : +if (dlb2->ev_ports[port_id].setup_done) { +PARAM_ERR (param, ret,"DLB2_SET_PORT_HL must be called before setting up port" ); +return ret; + } + port->hist_list = port_param->port_hl; +break ; +default : +PARAM_ERR (param, ret,"Unsupported flag" ); +return ret; + } + } + +return ret; +} +static bool dlb2_queue_is_empty (struct dlb2_eventdev *dlb2,struct dlb2_eventdev_queue *queue)
@@ -4953,6 +5053,28 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev,return err; } +if (dlb2_args->use_default_hl) { + dlb2->default_port_hl =DLB2_FIXED_CQ_HL_SIZE ; +if (dlb2_args->alloc_hl_entries) +DLB2_LOG_ERR (": Ignoring 'alloc_hl_entries' and using " +"default history list sizes for eventdev:" +" %s" , dev->data->name); + dlb2->hl_entries =0 ; + }else { + dlb2->default_port_hl =2 *DLB2_FIXED_CQ_HL_SIZE ; + +if (dlb2_args->alloc_hl_entries > + dlb2->hw_rsrc_query_results.num_hist_list_entries) { +DLB2_LOG_ERR (": Insufficient HL entries asked=%d " +"available=%d for eventdev: %s" , + dlb2->hl_entries, + dlb2->hw_rsrc_query_results.num_hist_list_entries, + dev->data->name); +return -EINVAL ; + } + dlb2->hl_entries = dlb2_args->alloc_hl_entries; + } +dlb2_iface_hardware_init (&dlb2->qm_instance);/* configure class of service */
@@ -5060,6 +5182,8 @@ dlb2_parse_params(const char *params,DLB2_PRODUCER_COREMASK ,DLB2_DEFAULT_LDB_PORT_ALLOCATION_ARG ,DLB2_ENABLE_CQ_WEIGHT_ARG , +DLB2_USE_DEFAULT_HL , +DLB2_ALLOC_HL_ENTRIES , NULL };if (params !=NULL && params[0 ] !='\0' ) {
@@ -5274,6 +5398,26 @@ dlb2_parse_params(const char *params,if (version ==DLB2_HW_V2 && dlb2_args->enable_cq_weight)DLB2_LOG_INFO ("Ignoring 'enable_cq_weight=y'. Only supported for 2.5 HW onwards" ); + ret =rte_kvargs_process (kvlist,DLB2_USE_DEFAULT_HL , + set_hl_override, + &dlb2_args->use_default_hl); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing hl_override arg" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist,DLB2_ALLOC_HL_ENTRIES , + set_hl_entries, + &dlb2_args->alloc_hl_entries); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing hl_override arg" , + name); +rte_kvargs_free (kvlist); +return ret; + } +rte_kvargs_free (kvlist); } }
drivers/event/dlb2/dlb2_iface.c +4 -1
@@ -73,9 +73,12 @@ int (*dlb2_iface_get_ldb_queue_depth)(struct dlb2_hw_dev *handle,int (*dlb2_iface_get_dir_queue_depth)(struct dlb2_hw_dev *handle,struct dlb2_get_dir_queue_depth_args *args); -int (*dlb2_iface_enable_cq_weight)(struct dlb2_hw_dev *handle,struct dlb2_enable_cq_weight_args *args); +int (*dlb2_iface_set_cq_inflight_ctrl)(struct dlb2_hw_dev *handle, +struct dlb2_cq_inflight_ctrl_args *args); +int (*dlb2_iface_set_cos_bw)(struct dlb2_hw_dev *handle,struct dlb2_set_cos_bw_args *args); +
drivers/event/dlb2/dlb2_iface.h +3 -1
@@ -72,10 +72,12 @@ extern int (*dlb2_iface_get_ldb_queue_depth)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_get_dir_queue_depth)(struct dlb2_hw_dev *handle,struct dlb2_get_dir_queue_depth_args *args); -extern int (*dlb2_iface_enable_cq_weight)(struct dlb2_hw_dev *handle,struct dlb2_enable_cq_weight_args *args); +extern int (*dlb2_iface_set_cq_inflight_ctrl)(struct dlb2_hw_dev *handle, +struct dlb2_cq_inflight_ctrl_args *args); +extern int (*dlb2_iface_set_cos_bw)(struct dlb2_hw_dev *handle,struct dlb2_set_cos_bw_args *args);
drivers/event/dlb2/dlb2_priv.h +16 -3
@@ -53,6 +53,8 @@#define DLB2_PRODUCER_COREMASK "producer_coremask"#define DLB2_DEFAULT_LDB_PORT_ALLOCATION_ARG "default_port_allocation"#define DLB2_ENABLE_CQ_WEIGHT_ARG "enable_cq_weight" +#define DLB2_USE_DEFAULT_HL "use_default_hl" +#define DLB2_ALLOC_HL_ENTRIES "alloc_hl_entries"/* Begin HW related defines and structs */
@@ -101,7 +103,8 @@*/ #define DLB2_MAX_HL_ENTRIES 2048#define DLB2_MIN_CQ_DEPTH 1 -#define DLB2_DEFAULT_CQ_DEPTH 32 +#define DLB2_DEFAULT_CQ_DEPTH 128/* Override using max_cq_depth parameter */ +#define DLB2_FIXED_CQ_HL_SIZE 32/* Used when ENABLE_FIXED_HL_SIZE is true */ #define DLB2_MIN_HARDWARE_CQ_DEPTH 8#define DLB2_NUM_HIST_LIST_ENTRIES_PER_LDB_PORT \ DLB2_DEFAULT_CQ_DEPTH
@@ -123,7 +126,7 @@#define DLB2_NUM_QES_PER_CACHE_LINE 4 -#define DLB2_MAX_ENQUEUE_DEPTH 32 +#define DLB2_MAX_ENQUEUE_DEPTH 128#define DLB2_MIN_ENQUEUE_DEPTH 4#define DLB2_NAME_SIZE 64
@@ -385,10 +388,13 @@ struct dlb2_port {struct dlb2_eventdev *dlb2;/* back ptr */ struct dlb2_eventdev_port *ev_port;/* back ptr */ bool use_scalar;/* force usage of scalar code */ +uint8_t reorder_id;/* id used for reordering events coming back into the scheduler */ uint16_t hw_credit_quanta;bool use_avx512; +bool enable_inflight_ctrl;/*DLB2.5 enable HW inflight control */ bool is_producer;/* True if port is of type producer */ -uint8_t reorder_id;/* id used for reordering events coming back into the scheduler */ +uint16_t inflight_threshold;/* DLB2.5 HW inflight threshold */ +uint16_t hist_list;/* Port history list */ bool reorder_en;struct dlb2_reorder *order;/* For ordering enqueues */ };
@@ -650,6 +656,8 @@ 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 */ bool enable_cq_weight; +uint16_t hl_entries;/* Num HL entries to allocate for the domain */ +int default_port_hl;/* Fixed or dynamic (2*CQ Depth) HL assignment */ };/* used for collecting and passing around the dev args */
@@ -683,6 +691,8 @@ struct dlb2_devargs {const char *producer_coremask;bool default_ldb_port_allocation;bool enable_cq_weight; +bool use_default_hl; +uint32_t alloc_hl_entries; };/* End Eventdev related defines and structs */
@@ -725,6 +735,9 @@ int dlb2_secondary_eventdev_probe(struct rte_eventdev *dev,uint32_t dlb2_get_queue_depth (struct dlb2_eventdev *dlb2,struct dlb2_eventdev_queue *queue); +int dlb2_set_port_param (struct dlb2_eventdev *dlb2,int port_id, +uint64_t flags,void *val); + int dlb2_parse_params(const char *params, const char *name, struct dlb2_devargs *dlb2_args,
drivers/event/dlb2/dlb2_user.h +24 -0
@@ -472,6 +472,8 @@ struct dlb2_create_ldb_port_args {__u16 cq_history_list_size;__u8 cos_id;__u8 cos_strict; +__u8 enable_inflight_ctrl; +__u16 inflight_threshold; };/*
@@ -717,6 +719,28 @@ struct dlb2_enable_cq_weight_args {__u32 limit; }; +/* +* DLB2_DOMAIN_CMD_SET_CQ_INFLIGHT_CTRL: Set Per-CQ inflight control for +* {ATM,UNO,ORD} QEs. +* +* Input parameters: +* - port_id: Load-balanced port ID. +* - enable: True if inflight control is enabled. False otherwise +* - threshold: Per CQ inflight threshold. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_cq_inflight_ctrl_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u16 enable; +__u16 threshold; +}; +/* * Mapping sizes for memory mapping the consumer queue (CQ) memory space, and * producer port (PP) MMIO space.
drivers/event/dlb2/pf/base/dlb2_regs.h +9 -0
@@ -3238,6 +3238,15 @@#define DLB2_LSP_CQ_LDB_INFL_LIM_LIMIT_LOC 0#define DLB2_LSP_CQ_LDB_INFL_LIM_RSVD0_LOC 12 +#define DLB2_LSP_CQ_LDB_INFL_THRESH (x) \ + (0x90580000 + (x) * 0x1000) +#define DLB2_LSP_CQ_LDB_INFL_THRESH_RST 0x0 + +#define DLB2_LSP_CQ_LDB_INFL_THRESH_THRESH 0x00000FFF +#define DLB2_LSP_CQ_LDB_INFL_THRESH_RSVD0 0xFFFFF000 +#define DLB2_LSP_CQ_LDB_INFL_THRESH_THRESH_LOC 0 +#define DLB2_LSP_CQ_LDB_INFL_THRESH_RSVD0_LOC 12 +#define DLB2_V2LSP_CQ_LDB_TKN_CNT (x) \ (0xa0580000 + (x) * 0x1000)#define DLB2_V2_5LSP_CQ_LDB_TKN_CNT (x) \
drivers/event/dlb2/pf/base/dlb2_resource.c +74 -0
86 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_resource.h +18 -0
@@ -1956,4 +1956,22 @@ int dlb2_hw_enable_cq_weight(struct dlb2_hw *hw,bool vdev_request, unsigned int vdev_id); +/** +* This function configures the inflight control threshold for a cq. +* +* This must be called after creating the port. +* +* Return: +* Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is +* assigned a detailed error code from enum dlb2_error. If successful, resp->id +* contains the queue ID. +* +* Errors: +* EINVAL - The domain or port is not configured. +*/ +int dlb2_hw_set_cq_inflight_ctrl (struct dlb2_hw *hw,u32 domain_id, +struct dlb2_cq_inflight_ctrl_args *args, +struct dlb2_cmd_response *resp, +bool vdev_request,unsigned int vdev_id); +#endif /* __DLB2_RESOURCE_H */
drivers/event/dlb2/pf/dlb2_pf.c +28 -1
@@ -347,6 +347,7 @@ dlb2_pf_ldb_port_create(struct dlb2_hw_dev *handle, cfg, cq_base, &response); + cfg->response = response;if (ret) goto create_port_err;
@@ -422,6 +423,9 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle, cfg, cq_base, &response); + + cfg->response = response; +if (ret) goto create_port_err;
@@ -646,6 +650,26 @@ dlb2_pf_enable_cq_weight(struct dlb2_hw_dev *handle,return ret; } +static int +dlb2_pf_set_cq_inflight_ctrl (struct dlb2_hw_dev *handle, +struct dlb2_cq_inflight_ctrl_args *args) +{ +struct dlb2_dev *dlb2_dev = (struct dlb2_dev *)handle->pf_dev; +struct dlb2_cmd_response response = {0 }; +int ret =0 ; + +DLB2_INFO (dev->dlb2_device,"Entering %s()\n" , __func__); + + ret =dlb2_hw_set_cq_inflight_ctrl (&dlb2_dev->hw, handle->domain_id, + args, &response, false,0 ); + args->response = response; + +DLB2_INFO (dev->dlb2_device,"Exiting %s() with ret=%d" , + __func__, ret); + +return ret; +} +static int dlb2_pf_set_cos_bandwidth (struct dlb2_hw_dev *handle,struct dlb2_set_cos_bw_args *args)
@@ -691,6 +715,7 @@ dlb2_pf_iface_fn_ptrs_init(void) dlb2_iface_get_sn_occupancy = dlb2_pf_get_sn_occupancy; dlb2_iface_enable_cq_weight = dlb2_pf_enable_cq_weight; dlb2_iface_set_cos_bw = dlb2_pf_set_cos_bandwidth; + dlb2_iface_set_cq_inflight_ctrl = dlb2_pf_set_cq_inflight_ctrl; }/* PCI DEV HOOKS */
@@ -710,7 +735,9 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev) .hw_credit_quanta = DLB2_SW_CREDIT_BATCH_SZ, .default_depth_thresh = DLB2_DEPTH_THRESH_DEFAULT, .max_cq_depth = DLB2_DEFAULT_CQ_DEPTH, - .max_enq_depth = DLB2_MAX_ENQUEUE_DEPTH + .max_enq_depth = DLB2_MAX_ENQUEUE_DEPTH, + .use_default_hl = true, + .alloc_hl_entries = 0 };struct dlb2_eventdev *dlb2;int q;
drivers/event/dlb2/rte_pmd_dlb2.c +24 -0
@@ -39,3 +39,27 @@ rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id,return 0 ; } + +RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dlb2_set_port_param, 25.07) +int +rte_pmd_dlb2_set_port_param (uint8_t dev_id, +uint8_t port_id, +uint64_t flags, +void *val) +{ +struct dlb2_eventdev *dlb2; +struct rte_eventdev *dev; + +if (val ==NULL ) +return -EINVAL ; + +RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET (dev_id, -EINVAL ); + dev = &rte_eventdevs[dev_id]; + + dlb2 =dlb2_pmd_priv (dev); + +if (port_id >= dlb2->num_ports) +return -EINVAL ; + +return dlb2_set_port_param (dlb2, port_id, flags, val); +}
drivers/event/dlb2/rte_pmd_dlb2.h +47 -1
60 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 5/7 event/dlb2: avoid credit release race condition
In reply to Pravin PathakWhile unlinking ports, all associated credits should be released. This commit avoids race condition when main thread is unlinking while workers are running.
--- drivers/event/dlb2/dlb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/event/dlb2/dlb2.c +1 -1
@@ -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;
Signature · 1 line
2.25.1
PATCH v2 6/7 event/dlb2: update qid depth xstat in vector path
In reply to Pravin Pathakupdate QID depth xstats counter in vector dequeue path
--- drivers/event/dlb2/dlb2.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/event/dlb2/dlb2.c +8 -0
@@ -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; }
Signature · 1 line
2.25.1
PATCH v2 7/7 event/dlb2: return default credits based on HW version
In reply to Pravin PathakFrom: Tirthendu Sarkar <[email protected]>
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.
--- drivers/event/dlb2/pf/dlb2_pf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/event/dlb2/pf/dlb2_pf.c +2 -0
@@ -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) {
Signature · 1 line
2.25.1
v3 cover event/dlb2: dlb2 hw resource management
In reply to Pravin PathakThis patchset introduces various fixes related to dlb2 hw resource management. The dlb2 hw has limited resources, which are configurable using command line options. This patch allows managing History list, scheduling bandwidth and credits using command line options. It also fixes some issues with resources management.
v2:
[PATCH v1 3/7] Addressed issue with Fixes tag [PATCH v1 4/7] Renamed structure and Macros to avoid
name space conflicts.
[PATCH v1 4/7] Addressed Doxygen format feedback
v3:
[PATCH v1 1/7] Added Fixes tag
[PATCH v1 2/7] Added Fixes tag
[PATCH v1 3/7] Added Fixes tag
[PATCH v1 5/7] Added Fixes tag
[PATCH v1 6/7] Added Fixes tag
[PATCH v1 7/7] Added Fixes tag
Pravin Pathak (6):
event/dlb2: fix addresses deq failure when CQ depth <= 16 event/dlb2: fix validaton of LDB port COS ID arguments event/dlb2: fix num single link ports for DLB2.5 event/dlb2: support managing history list resource event/dlb2: fix to avoid credit release race condition event/dlb2: fix qid depth xstat in vector path
Tirthendu Sarkar (1):
event/dlb2: fix default credits based on HW version
drivers/event/dlb2/dlb2.c | 274 +++++++++++++++++---- drivers/event/dlb2/dlb2_iface.c | 5 +- drivers/event/dlb2/dlb2_iface.h | 4 +- drivers/event/dlb2/dlb2_priv.h | 20 +- drivers/event/dlb2/dlb2_user.h | 24 ++ drivers/event/dlb2/pf/base/dlb2_regs.h | 9 + drivers/event/dlb2/pf/base/dlb2_resource.c | 74 ++++++ drivers/event/dlb2/pf/base/dlb2_resource.h | 18 ++ drivers/event/dlb2/pf/dlb2_pf.c | 33 ++- drivers/event/dlb2/rte_pmd_dlb2.c | 24 ++ drivers/event/dlb2/rte_pmd_dlb2.h | 48 +++- 11 files changed, 470 insertions(+), 63 deletions(-)
Signature · 1 line
2.39.1
PATCH v3 1/7 event/dlb2: fix addresses deq failure when CQ depth <= 16
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.
--- drivers/event/dlb2/dlb2.c | 4 ++-- drivers/event/dlb2/pf/dlb2_pf.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/event/dlb2/dlb2.c +2 -2
@@ -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 */
drivers/event/dlb2/pf/dlb2_pf.c +1 -1
@@ -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,
Signature · 1 line
2.39.1
PATCH v3 2/7 event/dlb2: fix validaton of LDB port COS ID arguments
In reply to Pravin PathakWhile 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.
--- drivers/event/dlb2/dlb2.c | 32 +++++++++++++++++++++++--------- drivers/event/dlb2/dlb2_priv.h | 1 - 2 files changed, 23 insertions(+), 10 deletions(-)
drivers/event/dlb2/dlb2.c +23 -9
@@ -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; }
drivers/event/dlb2/dlb2_priv.h +0 -1
@@ -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; };
Signature · 1 line
2.39.1
PATCH v3 3/7 event/dlb2: fix num single link ports for DLB2.5
In reply to Pravin PathakDLB 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
--- drivers/event/dlb2/dlb2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/event/dlb2/dlb2.c +4 -4
@@ -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;
Signature · 1 line
2.39.1
PATCH v3 4/7 event/dlb2: support managing history list resource
In reply to Pravin PathakAdd support for setting application specified port history Set HL equal to CQ depth when inflight control is enabled Added command line parameters 'use_default_hl' (default: 1)
and 'alloc_hl_entries'
- When 'use_default_hl = 1'
* Per port HL is set to DLB2_FIXED_CQ_HL_SIZE (32)
* Recommended CQ depth by dlb2_eventdev_port_default_conf_get()
is DLB2_FIXED_CQ_HL_SIZE/2
* command line parameter alloc_hl_entries is ignored
- When 'use_default_hl = 0'
* Per LDB port HL = 2 * CQ depth
* Recommended CQ depth by dlb2_eventdev_port_default_conf_get() is DLB2_FIXED_CQ_HL_SIZE
* User should calculate needed HL entries based on CQ depths the application will use and specify it as command line parameter 'alloc_hl_entries'. This will be used to allocate HL entries. alloc_hl_entries = (Sum of all LDB ports CQ depths * 2)
* If alloc_hl_entries is not specified, then
Total HL entries for the eventdev = num_ldb_ports * 64
--- drivers/event/dlb2/dlb2.c | 220 +++++++++++++++++---- drivers/event/dlb2/dlb2_iface.c | 5 +- drivers/event/dlb2/dlb2_iface.h | 4 +- drivers/event/dlb2/dlb2_priv.h | 19 +- drivers/event/dlb2/dlb2_user.h | 24 +++ drivers/event/dlb2/pf/base/dlb2_regs.h | 9 + drivers/event/dlb2/pf/base/dlb2_resource.c | 74 +++++++ drivers/event/dlb2/pf/base/dlb2_resource.h | 18 ++ drivers/event/dlb2/pf/dlb2_pf.c | 29 ++- drivers/event/dlb2/rte_pmd_dlb2.c | 24 +++ drivers/event/dlb2/rte_pmd_dlb2.h | 48 ++++- 11 files changed, 429 insertions(+), 45 deletions(-)
drivers/event/dlb2/dlb2.c +182 -38
@@ -727,6 +727,50 @@ set_enable_cq_weight(const char *key __rte_unused,return 0 ; } +static int set_hl_override(const char *key __rte_unused, const char *value, +void *opaque) +{ +bool *default_hl = opaque; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer" ); +return -EINVAL ; + } + +if ((*value =='n' ) || (*value =='N' ) || (*value =='0' )) + *default_hl = false; +else + *default_hl = true; + +return 0 ; +} + +static int set_hl_entries(const char *key __rte_unused, const char *value, +void *opaque) +{ +int hl_entries =0 ; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (&hl_entries, value); +if (ret <0 ) +return ret; + +if (!hl_entries || (uint32_t )hl_entries >DLB2_MAX_HL_ENTRIES ) { +DLB2_LOG_ERR ( +"alloc_hl_entries %u out of range, must be in [1 - %d]" , + hl_entries,DLB2_MAX_HL_ENTRIES ); +return -EINVAL ; + } + *(uint32_t *)opaque = hl_entries; + +return 0 ; +} + static int set_qid_depth_thresh(const char *key __rte_unused, const char *value,
@@ -932,8 +976,16 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2,DLB2_NUM_ATOMIC_INFLIGHTS_PER_QUEUE * cfg->num_ldb_queues; - cfg->num_hist_list_entries = resources_asked->num_ldb_ports * - evdev_dlb2_default_info.max_event_port_dequeue_depth; +/* If hl_entries is non-zero then user specified command line option. +* Else compute using default_port_hl that has been set earlier based +* on use_default_hl option +*/ +if (dlb2->hl_entries) { + cfg->num_hist_list_entries = dlb2->hl_entries; + }else { + cfg->num_hist_list_entries = + resources_asked->num_ldb_ports * dlb2->default_port_hl; + }if (device_version ==DLB2_HW_V2_5 ) { DLB2_LOG_LINE_DBG("sched domain create - ldb_qs=%d, ldb_ports=%d, dir_ports=%d, atomic_inflights=%d, hist_list_entries=%d, credits=%d",
@@ -1154,8 +1206,8 @@ dlb2_eventdev_port_default_conf_get(struct rte_eventdev *dev,struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); port_conf->new_event_threshold = dlb2->new_event_limit; - port_conf->dequeue_depth =32 ; - port_conf->enqueue_depth =DLB2_MAX_ENQUEUE_DEPTH ; + port_conf->dequeue_depth = dlb2->default_port_hl /2 ; + port_conf->enqueue_depth = evdev_dlb2_default_info.max_event_port_enqueue_depth; port_conf->event_port_cfg =0 ; }
@@ -1647,16 +1699,14 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, {struct dlb2_hw_dev *handle = &dlb2->qm_instance;struct dlb2_create_ldb_port_args cfg = { {0 } }; -int ret; -struct dlb2_port *qm_port =NULL ; +struct dlb2_port *qm_port = &ev_port->qm_port;char mz_name[RTE_MEMZONE_NAMESIZE ];uint32_t qm_port_id; -uint16_t ldb_credit_high_watermark =0 ; -uint16_t dir_credit_high_watermark =0 ; -uint16_t credit_high_watermark =0 ; +int ret;if (handle ==NULL )return -EINVAL ; + (void ) enqueue_depth;if (dequeue_depth <DLB2_MIN_CQ_DEPTH ) { DLB2_LOG_ERR("dlb2: invalid cq depth, must be at least %d",
@@ -1670,27 +1720,23 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, cfg.cq_depth =rte_align32pow2 (dequeue_depth); cfg.cq_depth_threshold =1 ; - cfg.cq_history_list_size = cfg.cq_depth; +if (dlb2->version ==DLB2_HW_V2_5 && qm_port->enable_inflight_ctrl) { + cfg.enable_inflight_ctrl =1 ; + cfg.inflight_threshold = qm_port->inflight_threshold; + } + +if (qm_port->hist_list) + cfg.cq_history_list_size = qm_port->hist_list; +else if (cfg.enable_inflight_ctrl) + cfg.cq_history_list_size =RTE_MIN (cfg.cq_depth, dlb2->default_port_hl); +else if (dlb2->default_port_hl ==DLB2_FIXED_CQ_HL_SIZE ) + cfg.cq_history_list_size =DLB2_FIXED_CQ_HL_SIZE ; +else + cfg.cq_history_list_size = cfg.cq_depth *2 ; cfg.cos_id = ev_port->cos_id; cfg.cos_strict =0 ;/* best effots */ -/* User controls the LDB high watermark via enqueue depth. The DIR high -* watermark is equal, unless the directed credit pool is too small. -*/ -if (dlb2->version ==DLB2_HW_V2 ) { - ldb_credit_high_watermark = enqueue_depth; -/* If there are no directed ports, the kernel driver will -* ignore this port's directed credit settings. Don't use -* enqueue_depth if it would require more directed credits -* than are available. -*/ - dir_credit_high_watermark = -RTE_MIN (enqueue_depth, - handle->cfg.num_dir_credits / dlb2->num_ports); - }else - credit_high_watermark = enqueue_depth; -/* Per QM values */ ret =dlb2_iface_ldb_port_create (handle, &cfg, dlb2->poll_mode);
@@ -1793,24 +1839,18 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, qm_port->config_state =DLB2_CONFIGURED ;if (dlb2->version ==DLB2_HW_V2 ) { - qm_port->dir_credits = dir_credit_high_watermark; - qm_port->ldb_credits = ldb_credit_high_watermark; qm_port->credit_pool[DLB2_DIR_QUEUE ] = &dlb2->dir_credit_pool; qm_port->credit_pool[DLB2_LDB_QUEUE ] = &dlb2->ldb_credit_pool; -DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d, ldb credits=%d, dir credits=%d" , +DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d" , qm_port_id, - dequeue_depth, - qm_port->ldb_credits, - qm_port->dir_credits); + dequeue_depth); }else { - qm_port->credits = credit_high_watermark; qm_port->credit_pool[DLB2_COMBINED_POOL ] = &dlb2->credit_pool; -DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d, credits=%d" , +DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d" , qm_port_id, - dequeue_depth, - qm_port->credits); + dequeue_depth); } qm_port->use_scalar = false;
@@ -1830,8 +1870,7 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, error_exit: -if (qm_port) -dlb2_free_qe_mem (qm_port); +dlb2_free_qe_mem (qm_port);rte_spinlock_unlock (&handle->resource_lock);
@@ -4648,6 +4687,67 @@ dlb2_get_queue_depth(struct dlb2_eventdev *dlb2,return dlb2_get_ldb_queue_depth (dlb2, queue); } +#define PARAM_ERR (param, ret, err_str)\ + do { \ + if (!ret) \ + ret = -EINVAL; \ + DLB2_LOG_ERR("dlb2: dlb2_set_port_param error, param=%lx ret=%d %s",\ + param, ret, err_str); \ + } while (0) + +int +dlb2_set_port_param (struct dlb2_eventdev *dlb2, +int port_id, +uint64_t param_flags, +void *param_val) +{ +struct rte_pmd_dlb2_port_param *port_param = (struct rte_pmd_dlb2_port_param *)param_val; +struct dlb2_port *port = &dlb2->ev_ports[port_id].qm_port; +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +int ret =0 , bit =0 ; + +while (param_flags) { +uint64_t param =rte_bit_relaxed_test_and_clear64 (bit++, ¶m_flags); + +if (!param) +continue ; +switch (param) { +case DLB2_SET_PORT_FLOW_MIGRATION_THRESHOLD : +if (dlb2->version ==DLB2_HW_V2_5 ) { +struct dlb2_cq_inflight_ctrl_args args = {0 }; + + args.enable = true; + args.port_id = port->id; + args.threshold = port_param->inflight_threshold; +if (dlb2->ev_ports[port_id].setup_done) + ret =dlb2_iface_set_cq_inflight_ctrl (handle, &args); +if (ret) { +PARAM_ERR (param, ret,"Failed to set inflight threshold" ); +return ret; + } + port->enable_inflight_ctrl = true; + port->inflight_threshold = args.threshold; + }else { +PARAM_ERR (param, ret,"FLOW_MIGRATION_THRESHOLD is only supported for 2.5 HW" ); +return ret; + } +break ; +case DLB2_SET_PORT_HL : +if (dlb2->ev_ports[port_id].setup_done) { +PARAM_ERR (param, ret,"DLB2_SET_PORT_HL must be called before setting up port" ); +return ret; + } + port->hist_list = port_param->port_hl; +break ; +default : +PARAM_ERR (param, ret,"Unsupported flag" ); +return ret; + } + } + +return ret; +} +static bool dlb2_queue_is_empty (struct dlb2_eventdev *dlb2,struct dlb2_eventdev_queue *queue)
@@ -4953,6 +5053,28 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev,return err; } +if (dlb2_args->use_default_hl) { + dlb2->default_port_hl =DLB2_FIXED_CQ_HL_SIZE ; +if (dlb2_args->alloc_hl_entries) +DLB2_LOG_ERR (": Ignoring 'alloc_hl_entries' and using " +"default history list sizes for eventdev:" +" %s" , dev->data->name); + dlb2->hl_entries =0 ; + }else { + dlb2->default_port_hl =2 *DLB2_FIXED_CQ_HL_SIZE ; + +if (dlb2_args->alloc_hl_entries > + dlb2->hw_rsrc_query_results.num_hist_list_entries) { +DLB2_LOG_ERR (": Insufficient HL entries asked=%d " +"available=%d for eventdev: %s" , + dlb2->hl_entries, + dlb2->hw_rsrc_query_results.num_hist_list_entries, + dev->data->name); +return -EINVAL ; + } + dlb2->hl_entries = dlb2_args->alloc_hl_entries; + } +dlb2_iface_hardware_init (&dlb2->qm_instance);/* configure class of service */
@@ -5060,6 +5182,8 @@ dlb2_parse_params(const char *params,DLB2_PRODUCER_COREMASK ,DLB2_DEFAULT_LDB_PORT_ALLOCATION_ARG ,DLB2_ENABLE_CQ_WEIGHT_ARG , +DLB2_USE_DEFAULT_HL , +DLB2_ALLOC_HL_ENTRIES , NULL };if (params !=NULL && params[0 ] !='\0' ) {
@@ -5274,6 +5398,26 @@ dlb2_parse_params(const char *params,if (version ==DLB2_HW_V2 && dlb2_args->enable_cq_weight)DLB2_LOG_INFO ("Ignoring 'enable_cq_weight=y'. Only supported for 2.5 HW onwards" ); + ret =rte_kvargs_process (kvlist,DLB2_USE_DEFAULT_HL , + set_hl_override, + &dlb2_args->use_default_hl); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing hl_override arg" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist,DLB2_ALLOC_HL_ENTRIES , + set_hl_entries, + &dlb2_args->alloc_hl_entries); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing hl_override arg" , + name); +rte_kvargs_free (kvlist); +return ret; + } +rte_kvargs_free (kvlist); } }
drivers/event/dlb2/dlb2_iface.c +4 -1
@@ -73,9 +73,12 @@ int (*dlb2_iface_get_ldb_queue_depth)(struct dlb2_hw_dev *handle,int (*dlb2_iface_get_dir_queue_depth)(struct dlb2_hw_dev *handle,struct dlb2_get_dir_queue_depth_args *args); -int (*dlb2_iface_enable_cq_weight)(struct dlb2_hw_dev *handle,struct dlb2_enable_cq_weight_args *args); +int (*dlb2_iface_set_cq_inflight_ctrl)(struct dlb2_hw_dev *handle, +struct dlb2_cq_inflight_ctrl_args *args); +int (*dlb2_iface_set_cos_bw)(struct dlb2_hw_dev *handle,struct dlb2_set_cos_bw_args *args); +
drivers/event/dlb2/dlb2_iface.h +3 -1
@@ -72,10 +72,12 @@ extern int (*dlb2_iface_get_ldb_queue_depth)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_get_dir_queue_depth)(struct dlb2_hw_dev *handle,struct dlb2_get_dir_queue_depth_args *args); -extern int (*dlb2_iface_enable_cq_weight)(struct dlb2_hw_dev *handle,struct dlb2_enable_cq_weight_args *args); +extern int (*dlb2_iface_set_cq_inflight_ctrl)(struct dlb2_hw_dev *handle, +struct dlb2_cq_inflight_ctrl_args *args); +extern int (*dlb2_iface_set_cos_bw)(struct dlb2_hw_dev *handle,struct dlb2_set_cos_bw_args *args);
drivers/event/dlb2/dlb2_priv.h +16 -3
@@ -53,6 +53,8 @@#define DLB2_PRODUCER_COREMASK "producer_coremask"#define DLB2_DEFAULT_LDB_PORT_ALLOCATION_ARG "default_port_allocation"#define DLB2_ENABLE_CQ_WEIGHT_ARG "enable_cq_weight" +#define DLB2_USE_DEFAULT_HL "use_default_hl" +#define DLB2_ALLOC_HL_ENTRIES "alloc_hl_entries"/* Begin HW related defines and structs */
@@ -101,7 +103,8 @@*/ #define DLB2_MAX_HL_ENTRIES 2048#define DLB2_MIN_CQ_DEPTH 1 -#define DLB2_DEFAULT_CQ_DEPTH 32 +#define DLB2_DEFAULT_CQ_DEPTH 128/* Override using max_cq_depth parameter */ +#define DLB2_FIXED_CQ_HL_SIZE 32/* Used when ENABLE_FIXED_HL_SIZE is true */ #define DLB2_MIN_HARDWARE_CQ_DEPTH 8#define DLB2_NUM_HIST_LIST_ENTRIES_PER_LDB_PORT \ DLB2_DEFAULT_CQ_DEPTH
@@ -123,7 +126,7 @@#define DLB2_NUM_QES_PER_CACHE_LINE 4 -#define DLB2_MAX_ENQUEUE_DEPTH 32 +#define DLB2_MAX_ENQUEUE_DEPTH 128#define DLB2_MIN_ENQUEUE_DEPTH 4#define DLB2_NAME_SIZE 64
@@ -385,10 +388,13 @@ struct dlb2_port {struct dlb2_eventdev *dlb2;/* back ptr */ struct dlb2_eventdev_port *ev_port;/* back ptr */ bool use_scalar;/* force usage of scalar code */ +uint8_t reorder_id;/* id used for reordering events coming back into the scheduler */ uint16_t hw_credit_quanta;bool use_avx512; +bool enable_inflight_ctrl;/*DLB2.5 enable HW inflight control */ bool is_producer;/* True if port is of type producer */ -uint8_t reorder_id;/* id used for reordering events coming back into the scheduler */ +uint16_t inflight_threshold;/* DLB2.5 HW inflight threshold */ +uint16_t hist_list;/* Port history list */ bool reorder_en;struct dlb2_reorder *order;/* For ordering enqueues */ };
@@ -650,6 +656,8 @@ 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 */ bool enable_cq_weight; +uint16_t hl_entries;/* Num HL entries to allocate for the domain */ +int default_port_hl;/* Fixed or dynamic (2*CQ Depth) HL assignment */ };/* used for collecting and passing around the dev args */
@@ -683,6 +691,8 @@ struct dlb2_devargs {const char *producer_coremask;bool default_ldb_port_allocation;bool enable_cq_weight; +bool use_default_hl; +uint32_t alloc_hl_entries; };/* End Eventdev related defines and structs */
@@ -725,6 +735,9 @@ int dlb2_secondary_eventdev_probe(struct rte_eventdev *dev,uint32_t dlb2_get_queue_depth (struct dlb2_eventdev *dlb2,struct dlb2_eventdev_queue *queue); +int dlb2_set_port_param (struct dlb2_eventdev *dlb2,int port_id, +uint64_t flags,void *val); + int dlb2_parse_params(const char *params, const char *name, struct dlb2_devargs *dlb2_args,
drivers/event/dlb2/dlb2_user.h +24 -0
@@ -472,6 +472,8 @@ struct dlb2_create_ldb_port_args {__u16 cq_history_list_size;__u8 cos_id;__u8 cos_strict; +__u8 enable_inflight_ctrl; +__u16 inflight_threshold; };/*
@@ -717,6 +719,28 @@ struct dlb2_enable_cq_weight_args {__u32 limit; }; +/* +* DLB2_DOMAIN_CMD_SET_CQ_INFLIGHT_CTRL: Set Per-CQ inflight control for +* {ATM,UNO,ORD} QEs. +* +* Input parameters: +* - port_id: Load-balanced port ID. +* - enable: True if inflight control is enabled. False otherwise +* - threshold: Per CQ inflight threshold. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_cq_inflight_ctrl_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u16 enable; +__u16 threshold; +}; +/* * Mapping sizes for memory mapping the consumer queue (CQ) memory space, and * producer port (PP) MMIO space.
drivers/event/dlb2/pf/base/dlb2_regs.h +9 -0
@@ -3238,6 +3238,15 @@#define DLB2_LSP_CQ_LDB_INFL_LIM_LIMIT_LOC 0#define DLB2_LSP_CQ_LDB_INFL_LIM_RSVD0_LOC 12 +#define DLB2_LSP_CQ_LDB_INFL_THRESH (x) \ + (0x90580000 + (x) * 0x1000) +#define DLB2_LSP_CQ_LDB_INFL_THRESH_RST 0x0 + +#define DLB2_LSP_CQ_LDB_INFL_THRESH_THRESH 0x00000FFF +#define DLB2_LSP_CQ_LDB_INFL_THRESH_RSVD0 0xFFFFF000 +#define DLB2_LSP_CQ_LDB_INFL_THRESH_THRESH_LOC 0 +#define DLB2_LSP_CQ_LDB_INFL_THRESH_RSVD0_LOC 12 +#define DLB2_V2LSP_CQ_LDB_TKN_CNT (x) \ (0xa0580000 + (x) * 0x1000)#define DLB2_V2_5LSP_CQ_LDB_TKN_CNT (x) \
drivers/event/dlb2/pf/base/dlb2_resource.c +74 -0
86 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_resource.h +18 -0
@@ -1956,4 +1956,22 @@ int dlb2_hw_enable_cq_weight(struct dlb2_hw *hw,bool vdev_request, unsigned int vdev_id); +/** +* This function configures the inflight control threshold for a cq. +* +* This must be called after creating the port. +* +* Return: +* Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is +* assigned a detailed error code from enum dlb2_error. If successful, resp->id +* contains the queue ID. +* +* Errors: +* EINVAL - The domain or port is not configured. +*/ +int dlb2_hw_set_cq_inflight_ctrl (struct dlb2_hw *hw,u32 domain_id, +struct dlb2_cq_inflight_ctrl_args *args, +struct dlb2_cmd_response *resp, +bool vdev_request,unsigned int vdev_id); +#endif /* __DLB2_RESOURCE_H */
drivers/event/dlb2/pf/dlb2_pf.c +28 -1
@@ -347,6 +347,7 @@ dlb2_pf_ldb_port_create(struct dlb2_hw_dev *handle, cfg, cq_base, &response); + cfg->response = response;if (ret) goto create_port_err;
@@ -422,6 +423,9 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle, cfg, cq_base, &response); + + cfg->response = response; +if (ret) goto create_port_err;
@@ -646,6 +650,26 @@ dlb2_pf_enable_cq_weight(struct dlb2_hw_dev *handle,return ret; } +static int +dlb2_pf_set_cq_inflight_ctrl (struct dlb2_hw_dev *handle, +struct dlb2_cq_inflight_ctrl_args *args) +{ +struct dlb2_dev *dlb2_dev = (struct dlb2_dev *)handle->pf_dev; +struct dlb2_cmd_response response = {0 }; +int ret =0 ; + +DLB2_INFO (dev->dlb2_device,"Entering %s()\n" , __func__); + + ret =dlb2_hw_set_cq_inflight_ctrl (&dlb2_dev->hw, handle->domain_id, + args, &response, false,0 ); + args->response = response; + +DLB2_INFO (dev->dlb2_device,"Exiting %s() with ret=%d" , + __func__, ret); + +return ret; +} +static int dlb2_pf_set_cos_bandwidth (struct dlb2_hw_dev *handle,struct dlb2_set_cos_bw_args *args)
@@ -691,6 +715,7 @@ dlb2_pf_iface_fn_ptrs_init(void) dlb2_iface_get_sn_occupancy = dlb2_pf_get_sn_occupancy; dlb2_iface_enable_cq_weight = dlb2_pf_enable_cq_weight; dlb2_iface_set_cos_bw = dlb2_pf_set_cos_bandwidth; + dlb2_iface_set_cq_inflight_ctrl = dlb2_pf_set_cq_inflight_ctrl; }/* PCI DEV HOOKS */
@@ -710,7 +735,9 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev) .hw_credit_quanta = DLB2_SW_CREDIT_BATCH_SZ, .default_depth_thresh = DLB2_DEPTH_THRESH_DEFAULT, .max_cq_depth = DLB2_DEFAULT_CQ_DEPTH, - .max_enq_depth = DLB2_MAX_ENQUEUE_DEPTH + .max_enq_depth = DLB2_MAX_ENQUEUE_DEPTH, + .use_default_hl = true, + .alloc_hl_entries = 0 };struct dlb2_eventdev *dlb2;int q;
drivers/event/dlb2/rte_pmd_dlb2.c +24 -0
@@ -39,3 +39,27 @@ rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id,return 0 ; } + +RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dlb2_set_port_param, 25.07) +int +rte_pmd_dlb2_set_port_param (uint8_t dev_id, +uint8_t port_id, +uint64_t flags, +void *val) +{ +struct dlb2_eventdev *dlb2; +struct rte_eventdev *dev; + +if (val ==NULL ) +return -EINVAL ; + +RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET (dev_id, -EINVAL ); + dev = &rte_eventdevs[dev_id]; + + dlb2 =dlb2_pmd_priv (dev); + +if (port_id >= dlb2->num_ports) +return -EINVAL ; + +return dlb2_set_port_param (dlb2, port_id, flags, val); +}
drivers/event/dlb2/rte_pmd_dlb2.h +47 -1
60 lines not on this page · raw message
Signature · 1 line
2.39.1
Re: [PATCH v3 4/7] event/dlb2: support managing history list resource
Quoted 33 lines · Pravin Pathak
Add support for setting application specified port history Set HL equal to CQ depth when inflight control is enabled Added command line parameters '
use_default_hl' (default: 1)
and 'alloc_hl_entries'
- When 'use_default_hl= 1'
* Per port HL is set toDLB2_FIXED_CQ_HL_SIZE(32)
* Recommended CQ depth bydlb2_eventdev_port_default_conf_get()is DLB2_FIXED_CQ_HL_SIZE/2* command line parameter
alloc_hl_entriesis ignored
- When 'use_default_hl= 0'
* Per LDB port HL = 2 * CQ depth
* Recommended CQ depth bydlb2_eventdev_port_default_conf_get()isDLB2_FIXED_CQ_HL_SIZE
* User should calculate needed HL entries based on CQ depths the application will use and specify it as command line parameter 'alloc_hl_entries'. This will be used to allocate HL entries.alloc_hl_entries= (Sum of all LDB ports CQ depths * 2)
* Ifalloc_hl_entriesis not specified, then
Total HL entries for the eventdev =num_ldb_ports* 64Signed-off-by Pravin Pathak <[email protected]>Signed-off-by Tirthendu Sarkar <[email protected]>---
drivers/event/dlb2/rte_pmd_dlb2.h +1
-1-/*! +/** * @warning * @b EXPERIMENTAL: this API may change, or be removed, without prior notice * @@ -91,6 +91,52 @@ rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id,uint8_t port_id, enum dlb2_token_pop_mode mode);
drivers/event/dlb2/rte_pmd_dlb2.h rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id, · line 102
Quoted 10 lines
drivers/event/dlb2/rte_pmd_dlb2.h +9
-0+/** Set inflight threshold for flow migration */ +#define DLB2_SET_PORT_FLOW_MIGRATION_THRESHOLD RTE_BIT64(0) + +/** Set port history list */ +#define DLB2_SET_PORT_HL RTE_BIT64(1) + +/** +* @warning +* @b EXPERIMENTAL: this API may change, or be removed, without prior notice
This is NOT API
drivers/event/dlb2/rte_pmd_dlb2.h rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id, · line 108
Quoted 6 lines
drivers/event/dlb2/rte_pmd_dlb2.h +6
-0+* +* Sets TDT threshold and HL size for a DLB2 port. +*/ +struct rte_pmd_dlb2_port_param { +uint16_t inflight_threshold :12 ; +uint16_t port_hl;
Doxygen comments for each field is missing.
Quoted 8 lines
drivers/event/dlb2/rte_pmd_dlb2.h +8
-0+}; + +/** +* @warning +* @b EXPERIMENTAL: this API may change, or be removed, without prior notice +* +* Configure various port parameters. +* This function must be called before calling rte_event_port_setup()
drivers/event/dlb2/rte_pmd_dlb2.h rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id, · line 126
Quoted 10 lines
drivers/event/dlb2/rte_pmd_dlb2.h +10
-0+* for the port, and after calling rte_event_dev_configure(). +* +* @param dev_id +* The identifier of the event device. +* @param port_id +* The identifier of the event port. +* @param flags +* Bitmask of the parameters being set. +* @param val +* Structure coantaining the values of parameters being set.
coantaining - Typo
drivers/event/dlb2/rte_pmd_dlb2.h rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id, · line 139
Quoted 13 lines
drivers/event/dlb2/rte_pmd_dlb2.h +13
-0+* +* @return +* - 0: Success +* - EINVAL: Invalid dev_id, port_id, or mode +* - EINVAL: The DLB2 is not configured, is already running, or the port is +* already setup +*/ +__rte_experimental +int +rte_pmd_dlb2_set_port_param (uint8_t dev_id, +uint8_t port_id, +uint64_t flags, +void *val);
Why void * - Is it rte_pmd_dlb2_port_param * pointer. Right?
Also fix following issues
1)[for-main]dell[dpdk-next-eventdev] $ git diff HEAD~7..HEAD | grep \(void\)
+ (void) enqueue_depth;
use RTE_SET_USED
2)
### [PATCH] event/dlb2: support managing history list resource
Warning in drivers/event/dlb2/dlb2.c:
Using %l format, prefer %PRI*64 if type is [u]int64_t
### [PATCH] event/dlb2: fix qid depth xstat in vector path
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations #21: FILE: drivers/event/dlb2/dlb2.c:4148:
+ DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid3].\
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations #30: FILE: drivers/event/dlb2/dlb2.c:4157:
+ DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid2].\
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations #39: FILE: drivers/event/dlb2/dlb2.c:4167:
+ DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid1].\
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations #48: FILE: drivers/event/dlb2/dlb2.c:4176:
+ DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid0].\
total: 0 errors, 4 warnings, 32 lines checked
Quoted 6 lines
drivers/event/dlb2/rte_pmd_dlb2.h +0
-1#ifdef __cplusplus }#endif --2.39.1
RE: [PATCH v3 4/7] event/dlb2: support managing history list resource
Quoted 52 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Wednesday, June 18, 2025 5:26 AM
To: Pathak, Pravin <[email protected]>
Cc: [email protected]; [email protected]; Chen, Mike Ximing <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Marchand, David <[email protected]>; [email protected]; [email protected]; Sarkar, Tirthendu <[email protected]>
Subject: Re: [PATCH v3 4/7] event/dlb2: support managing history list resourceQuoted 25 lines · Pravin Pathak
Add support for setting application specified port history Set HL equal to CQ depth when inflight control is enabled Added command line parameters '
use_default_hl' (default: 1)
and 'alloc_hl_entries'
- When 'use_default_hl= 1'
* Per port HL is set toDLB2_FIXED_CQ_HL_SIZE(32)
* Recommended CQ depth bydlb2_eventdev_port_default_conf_get()is DLB2_FIXED_CQ_HL_SIZE/2* command line parameter
alloc_hl_entriesis ignored
- When 'use_default_hl= 0'
* Per LDB port HL = 2 * CQ depth
* Recommended CQ depth bydlb2_eventdev_port_default_conf_get()isDLB2_FIXED_CQ_HL_SIZE
* User should calculate needed HL entries based on CQ depths the application will use and specify it as command line parameter 'alloc_hl_entries'. This will be used to allocate HL entries.alloc_hl_entries= (Sum of all LDB ports CQ depths * 2)
* Ifalloc_hl_entriesis not specified, then
Total HL entries for the eventdev =num_ldb_ports* 64Signed-off-by Pravin Pathak <[email protected]>Signed-off-by Tirthendu Sarkar <[email protected]>---
drivers/event/dlb2/rte_pmd_dlb2.h enum dlb2_token_pop_mode {
Quoted 4 lines
drivers/event/dlb2/rte_pmd_dlb2.h +1
-1-/*! +/** * @warning * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
Review rte_pmd_dlb2_set_token_pop_mode(uint8_t
Quoted 2 lines
*
(quoted diff) +0
-0@@ -91,6 +91,52 @@ rte_pmd_dlb2_set_token_pop_mode(uint8_t
dev_id,Quoted 3 lines
drivers/event/dlb2/rte_pmd_dlb2.h +0
-0uint8_t port_id, enum dlb2_token_pop_mode mode);
Quoted 12 lines
drivers/event/dlb2/rte_pmd_dlb2.h rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id,
Quoted 10 lines
drivers/event/dlb2/rte_pmd_dlb2.h +10
-0+/** Set inflight threshold for flow migration */ #define +DLB2_SET_PORT_FLOW_MIGRATION_THRESHOLD RTE_BIT64(0) + +/** Set port history list */ +#define DLB2_SET_PORT_HL RTE_BIT64(1) + +/** +* @warning +* @b EXPERIMENTAL: this API may change, or be removed, without prior +notice This is NOT API
Changed it.
Quoted 9 lines
drivers/event/dlb2/rte_pmd_dlb2.h rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id, · line 108
Quoted 7 lines
drivers/event/dlb2/rte_pmd_dlb2.h +6
-0+* +* Sets TDT threshold and HL size for a DLB2 port. +*/ +struct rte_pmd_dlb2_port_param { +uint16_t inflight_threshold :12 ; +uint16_t port_hl;Doxygen comments for each field is missing.
Added Doxygen comments
Quoted 15 lines
Quoted 15 lines
drivers/event/dlb2/rte_pmd_dlb2.h +13
-0+}; + +/** +* @warning +* @b EXPERIMENTAL: this API may change, or be removed, without prior +notice +* +* Configure various port parameters. +* This function must be called before calling rte_event_port_setup() +* for the port, and after calling rte_event_dev_configure(). +* +* @param dev_id +* The identifier of the event device.
Quoted 8 lines
drivers/event/dlb2/rte_pmd_dlb2.h rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id, · line 126
Quoted 6 lines
drivers/event/dlb2/rte_pmd_dlb2.h +6
-0+* @param port_id +* The identifier of the event port. +* @param flags +* Bitmask of the parameters being set. +* @param val +* Structure coantaining the values of parameters being set. coantaining - Typo
Fixed
Quoted 18 lines
Quoted 5 lines
drivers/event/dlb2/rte_pmd_dlb2.h +3
-0+* +* @return +* - 0: Success drivers/event/dlb2/rte_pmd_dlb2.h rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id, · line 139
Quoted 10 lines
drivers/event/dlb2/rte_pmd_dlb2.h +10
-0+* - EINVAL: Invalid dev_id, port_id, or mode +* - EINVAL: The DLB2 is not configured, is already running, or the port is +* already setup +*/ +__rte_experimental +int +rte_pmd_dlb2_set_port_param (uint8_t dev_id, +uint8_t port_id, +uint64_t flags, +void *val);Why void * - Is it
rte_pmd_dlb2_port_param* pointer. Right?
Quoted 6 lines
Also fix following issues
1)[for-main]dell[dpdk-next-eventdev] $ git diff HEAD~7..HEAD | grep \(void\)
+ (void)enqueue_depth;use
RTE_SET_USED
Added
Quoted 2 lines
2)
For the following, if I try to avoid line continuation, I get the following warning.
WARNING:MULTILINE_DEREFERENCE: Avoid multiple line dereference - prefer 'qm_port->ev_port->stats.queue[ev_qid0].qid_depth[RTE_PMD_DLB2_GET_QID_DEPTH(&events[0]'
Quoted 35 lines
### [PATCH] event/dlb2: support managing history list resource
Warning in
drivers/event/dlb2/dlb2.c:
Using %l format, prefer %PRI*64 if type is [u]int64_t### [PATCH] event/dlb2: fix qid depth xstat in vector path
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations #21: FILE:
drivers/event/dlb2/dlb2.c:4148:
+ DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid3].\WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations #30: FILE:
drivers/event/dlb2/dlb2.c:4157:
+ DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid2].\WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations #39: FILE:
drivers/event/dlb2/dlb2.c:4167:
+ DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid1].\WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations #48: FILE:
drivers/event/dlb2/dlb2.c:4176:
+ DLB2_INC_STAT(qm_port->ev_port->stats.queue[ev_qid0].\total: 0 errors, 4 warnings, 32 lines checked
Quoted 6 lines
drivers/event/dlb2/rte_pmd_dlb2.h +0
-1#ifdef __cplusplus }#endif --2.39.1
PATCH v3 5/7 event/dlb2: fix to avoid credit release race condition
In reply to Pravin PathakWhile unlinking ports, all associated credits should be released. This commit avoids race condition when main thread is unlinking while workers are running.
--- drivers/event/dlb2/dlb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/event/dlb2/dlb2.c +1 -1
@@ -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;
Signature · 1 line
2.39.1
PATCH v3 6/7 event/dlb2: fix qid depth xstat in vector path
In reply to Pravin Pathakupdate QID depth xstats counter in vector dequeue path
--- drivers/event/dlb2/dlb2.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/event/dlb2/dlb2.c +8 -0
@@ -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; }
Signature · 1 line
2.39.1
PATCH v3 7/7 event/dlb2: fix default credits based on HW version
In reply to Pravin PathakFrom: Tirthendu Sarkar <[email protected]>
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.
--- drivers/event/dlb2/pf/dlb2_pf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/event/dlb2/pf/dlb2_pf.c +2 -0
@@ -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) {
Signature · 1 line
2.39.1
v4 cover event/dlb2: dlb2 hw resource management
In reply to Pravin PathakThis patchset introduces various fixes related to dlb2 hw resource management. The dlb2 hw has limited resources, which are configurable using command line options. This patch allows managing History list, scheduling bandwidth and credits using command line options. It also fixes some issues with resources management.
v2:
[PATCH v1 3/7] Addressed issue with Fixes tag [PATCH v1 4/7] Renamed structure and Macros to avoid
name space conflicts.
[PATCH v1 4/7] Addressed Doxygen format feedback
v3:
[PATCH v2 1/7] Added Fixes tag
[PATCH v2 2/7] Added Fixes tag
[PATCH v2 3/7] Added Fixes tag
[PATCH v2 5/7] Added Fixes tag
[PATCH v2 6/7] Added Fixes tag
[PATCH v2 7/7] Added Fixes tag
v4:
[PATCH v3 4/7] Fixed Doxygen format and parameter type
to rte_pmd_dlb2_set_port_param()
Fixed other documentation feedback
Pravin Pathak (6):
event/dlb2: fix addresses deq failure when CQ depth <= 16 event/dlb2: fix validaton of LDB port COS ID arguments event/dlb2: fix num single link ports for DLB2.5 event/dlb2: support managing history list resource event/dlb2: fix to avoid credit release race condition event/dlb2: fix qid depth xstat in vector path
Tirthendu Sarkar (1):
event/dlb2: fix default credits based on HW version
drivers/event/dlb2/dlb2.c | 274 +++++++++++++++++---- drivers/event/dlb2/dlb2_iface.c | 5 +- drivers/event/dlb2/dlb2_iface.h | 4 +- drivers/event/dlb2/dlb2_priv.h | 20 +- drivers/event/dlb2/dlb2_user.h | 24 ++ drivers/event/dlb2/pf/base/dlb2_regs.h | 9 + drivers/event/dlb2/pf/base/dlb2_resource.c | 74 ++++++ drivers/event/dlb2/pf/base/dlb2_resource.h | 18 ++ drivers/event/dlb2/pf/dlb2_pf.c | 33 ++- drivers/event/dlb2/rte_pmd_dlb2.c | 24 ++ drivers/event/dlb2/rte_pmd_dlb2.h | 55 ++++- 11 files changed, 476 insertions(+), 64 deletions(-)
Signature · 1 line
2.39.1
PATCH v4 1/7 event/dlb2: fix addresses deq failure when CQ depth <= 16
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.
--- drivers/event/dlb2/dlb2.c | 4 ++-- drivers/event/dlb2/pf/dlb2_pf.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/event/dlb2/dlb2.c +2 -2
@@ -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 */
drivers/event/dlb2/pf/dlb2_pf.c +1 -1
@@ -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,
Signature · 1 line
2.39.1
PATCH v4 2/7 event/dlb2: fix validaton of LDB port COS ID arguments
In reply to Pravin PathakWhile 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.
--- drivers/event/dlb2/dlb2.c | 32 +++++++++++++++++++++++--------- drivers/event/dlb2/dlb2_priv.h | 1 - 2 files changed, 23 insertions(+), 10 deletions(-)
drivers/event/dlb2/dlb2.c +23 -9
@@ -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; }
drivers/event/dlb2/dlb2_priv.h +0 -1
@@ -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; };
Signature · 1 line
2.39.1
PATCH v4 3/7 event/dlb2: fix num single link ports for DLB2.5
In reply to Pravin PathakDLB 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
--- drivers/event/dlb2/dlb2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/event/dlb2/dlb2.c +4 -4
@@ -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;
Signature · 1 line
2.39.1
PATCH v4 4/7 event/dlb2: support managing history list resource
In reply to Pravin PathakAdd support for setting application specified port history Set HL equal to CQ depth when inflight control is enabled Added command line parameters 'use_default_hl' (default: 1)
and 'alloc_hl_entries'
- When 'use_default_hl = 1'
* Per port HL is set to DLB2_FIXED_CQ_HL_SIZE (32)
* Recommended CQ depth by dlb2_eventdev_port_default_conf_get()
is DLB2_FIXED_CQ_HL_SIZE/2
* command line parameter alloc_hl_entries is ignored
- When 'use_default_hl = 0'
* Per LDB port HL = 2 * CQ depth
* Recommended CQ depth by dlb2_eventdev_port_default_conf_get() is DLB2_FIXED_CQ_HL_SIZE
* User should calculate needed HL entries based on CQ depths the application will use and specify it as command line parameter 'alloc_hl_entries'. This will be used to allocate HL entries. alloc_hl_entries = (Sum of all LDB ports CQ depths * 2)
* If alloc_hl_entries is not specified, then
Total HL entries for the eventdev = num_ldb_ports * 64
--- drivers/event/dlb2/dlb2.c | 220 +++++++++++++++++---- drivers/event/dlb2/dlb2_iface.c | 5 +- drivers/event/dlb2/dlb2_iface.h | 4 +- drivers/event/dlb2/dlb2_priv.h | 19 +- drivers/event/dlb2/dlb2_user.h | 24 +++ drivers/event/dlb2/pf/base/dlb2_regs.h | 9 + drivers/event/dlb2/pf/base/dlb2_resource.c | 74 +++++++ drivers/event/dlb2/pf/base/dlb2_resource.h | 18 ++ drivers/event/dlb2/pf/dlb2_pf.c | 29 ++- drivers/event/dlb2/rte_pmd_dlb2.c | 24 +++ drivers/event/dlb2/rte_pmd_dlb2.h | 55 +++++- 11 files changed, 435 insertions(+), 46 deletions(-)
drivers/event/dlb2/dlb2.c +182 -38
@@ -727,6 +727,50 @@ set_enable_cq_weight(const char *key __rte_unused,return 0 ; } +static int set_hl_override(const char *key __rte_unused, const char *value, +void *opaque) +{ +bool *default_hl = opaque; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer" ); +return -EINVAL ; + } + +if ((*value =='n' ) || (*value =='N' ) || (*value =='0' )) + *default_hl = false; +else + *default_hl = true; + +return 0 ; +} + +static int set_hl_entries(const char *key __rte_unused, const char *value, +void *opaque) +{ +int hl_entries =0 ; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (&hl_entries, value); +if (ret <0 ) +return ret; + +if (!hl_entries || (uint32_t )hl_entries >DLB2_MAX_HL_ENTRIES ) { +DLB2_LOG_ERR ( +"alloc_hl_entries %u out of range, must be in [1 - %d]" , + hl_entries,DLB2_MAX_HL_ENTRIES ); +return -EINVAL ; + } + *(uint32_t *)opaque = hl_entries; + +return 0 ; +} + static int set_qid_depth_thresh(const char *key __rte_unused, const char *value,
@@ -932,8 +976,16 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2,DLB2_NUM_ATOMIC_INFLIGHTS_PER_QUEUE * cfg->num_ldb_queues; - cfg->num_hist_list_entries = resources_asked->num_ldb_ports * - evdev_dlb2_default_info.max_event_port_dequeue_depth; +/* If hl_entries is non-zero then user specified command line option. +* Else compute using default_port_hl that has been set earlier based +* on use_default_hl option +*/ +if (dlb2->hl_entries) { + cfg->num_hist_list_entries = dlb2->hl_entries; + }else { + cfg->num_hist_list_entries = + resources_asked->num_ldb_ports * dlb2->default_port_hl; + }if (device_version ==DLB2_HW_V2_5 ) { DLB2_LOG_LINE_DBG("sched domain create - ldb_qs=%d, ldb_ports=%d, dir_ports=%d, atomic_inflights=%d, hist_list_entries=%d, credits=%d",
@@ -1154,8 +1206,8 @@ dlb2_eventdev_port_default_conf_get(struct rte_eventdev *dev,struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); port_conf->new_event_threshold = dlb2->new_event_limit; - port_conf->dequeue_depth =32 ; - port_conf->enqueue_depth =DLB2_MAX_ENQUEUE_DEPTH ; + port_conf->dequeue_depth = dlb2->default_port_hl /2 ; + port_conf->enqueue_depth = evdev_dlb2_default_info.max_event_port_enqueue_depth; port_conf->event_port_cfg =0 ; }
@@ -1647,13 +1699,11 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, {struct dlb2_hw_dev *handle = &dlb2->qm_instance;struct dlb2_create_ldb_port_args cfg = { {0 } }; -int ret; -struct dlb2_port *qm_port =NULL ; +struct dlb2_port *qm_port = &ev_port->qm_port;char mz_name[RTE_MEMZONE_NAMESIZE ];uint32_t qm_port_id; -uint16_t ldb_credit_high_watermark =0 ; -uint16_t dir_credit_high_watermark =0 ; -uint16_t credit_high_watermark =0 ; +int ret; +RTE_SET_USED (enqueue_depth);if (handle ==NULL )return -EINVAL ;
@@ -1670,27 +1720,23 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, cfg.cq_depth =rte_align32pow2 (dequeue_depth); cfg.cq_depth_threshold =1 ; - cfg.cq_history_list_size = cfg.cq_depth; +if (dlb2->version ==DLB2_HW_V2_5 && qm_port->enable_inflight_ctrl) { + cfg.enable_inflight_ctrl =1 ; + cfg.inflight_threshold = qm_port->inflight_threshold; + } + +if (qm_port->hist_list) + cfg.cq_history_list_size = qm_port->hist_list; +else if (cfg.enable_inflight_ctrl) + cfg.cq_history_list_size =RTE_MIN (cfg.cq_depth, dlb2->default_port_hl); +else if (dlb2->default_port_hl ==DLB2_FIXED_CQ_HL_SIZE ) + cfg.cq_history_list_size =DLB2_FIXED_CQ_HL_SIZE ; +else + cfg.cq_history_list_size = cfg.cq_depth *2 ; cfg.cos_id = ev_port->cos_id; cfg.cos_strict =0 ;/* best effots */ -/* User controls the LDB high watermark via enqueue depth. The DIR high -* watermark is equal, unless the directed credit pool is too small. -*/ -if (dlb2->version ==DLB2_HW_V2 ) { - ldb_credit_high_watermark = enqueue_depth; -/* If there are no directed ports, the kernel driver will -* ignore this port's directed credit settings. Don't use -* enqueue_depth if it would require more directed credits -* than are available. -*/ - dir_credit_high_watermark = -RTE_MIN (enqueue_depth, - handle->cfg.num_dir_credits / dlb2->num_ports); - }else - credit_high_watermark = enqueue_depth; -/* Per QM values */ ret =dlb2_iface_ldb_port_create (handle, &cfg, dlb2->poll_mode);
@@ -1793,24 +1839,18 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, qm_port->config_state =DLB2_CONFIGURED ;if (dlb2->version ==DLB2_HW_V2 ) { - qm_port->dir_credits = dir_credit_high_watermark; - qm_port->ldb_credits = ldb_credit_high_watermark; qm_port->credit_pool[DLB2_DIR_QUEUE ] = &dlb2->dir_credit_pool; qm_port->credit_pool[DLB2_LDB_QUEUE ] = &dlb2->ldb_credit_pool; -DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d, ldb credits=%d, dir credits=%d" , +DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d" , qm_port_id, - dequeue_depth, - qm_port->ldb_credits, - qm_port->dir_credits); + dequeue_depth); }else { - qm_port->credits = credit_high_watermark; qm_port->credit_pool[DLB2_COMBINED_POOL ] = &dlb2->credit_pool; -DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d, credits=%d" , +DLB2_LOG_LINE_DBG ("dlb2: created ldb port %d, depth = %d" , qm_port_id, - dequeue_depth, - qm_port->credits); + dequeue_depth); } qm_port->use_scalar = false;
@@ -1830,8 +1870,7 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, error_exit: -if (qm_port) -dlb2_free_qe_mem (qm_port); +dlb2_free_qe_mem (qm_port);rte_spinlock_unlock (&handle->resource_lock);
@@ -4667,6 +4706,67 @@ dlb2_get_queue_depth(struct dlb2_eventdev *dlb2,return dlb2_get_ldb_queue_depth (dlb2, queue); } +#define PARAM_ERR (param, ret, err_str)\ + do { \ + if (!ret) \ + ret = -EINVAL; \ + DLB2_LOG_ERR("dlb2: dlb2_set_port_param error, param=%" PRIu64 " ret=%d %s",\ + param, ret, err_str); \ + } while (0) + +int +dlb2_set_port_param (struct dlb2_eventdev *dlb2, +int port_id, +uint64_t param_flags, +struct rte_pmd_dlb2_port_param *param_val) +{ +struct rte_pmd_dlb2_port_param *port_param = param_val; +struct dlb2_port *port = &dlb2->ev_ports[port_id].qm_port; +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +int ret =0 , bit =0 ; + +while (param_flags) { +uint64_t param =rte_bit_relaxed_test_and_clear64 (bit++, ¶m_flags); + +if (!param) +continue ; +switch (param) { +case DLB2_SET_PORT_FLOW_MIGRATION_THRESHOLD : +if (dlb2->version ==DLB2_HW_V2_5 ) { +struct dlb2_cq_inflight_ctrl_args args = {0 }; + + args.enable = true; + args.port_id = port->id; + args.threshold = port_param->inflight_threshold; +if (dlb2->ev_ports[port_id].setup_done) + ret =dlb2_iface_set_cq_inflight_ctrl (handle, &args); +if (ret) { +PARAM_ERR (param, ret,"Failed to set inflight threshold" ); +return ret; + } + port->enable_inflight_ctrl = true; + port->inflight_threshold = args.threshold; + }else { +PARAM_ERR (param, ret,"FLOW_MIGRATION_THRESHOLD is only supported for 2.5 HW" ); +return ret; + } +break ; +case DLB2_SET_PORT_HL : +if (dlb2->ev_ports[port_id].setup_done) { +PARAM_ERR (param, ret,"DLB2_SET_PORT_HL must be called before setting up port" ); +return ret; + } + port->hist_list = port_param->port_hl; +break ; +default : +PARAM_ERR (param, ret,"Unsupported flag" ); +return ret; + } + } + +return ret; +} +static bool dlb2_queue_is_empty (struct dlb2_eventdev *dlb2,struct dlb2_eventdev_queue *queue)
@@ -4972,6 +5072,28 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev,return err; } +if (dlb2_args->use_default_hl) { + dlb2->default_port_hl =DLB2_FIXED_CQ_HL_SIZE ; +if (dlb2_args->alloc_hl_entries) +DLB2_LOG_ERR (": Ignoring 'alloc_hl_entries' and using " +"default history list sizes for eventdev:" +" %s" , dev->data->name); + dlb2->hl_entries =0 ; + }else { + dlb2->default_port_hl =2 *DLB2_FIXED_CQ_HL_SIZE ; + +if (dlb2_args->alloc_hl_entries > + dlb2->hw_rsrc_query_results.num_hist_list_entries) { +DLB2_LOG_ERR (": Insufficient HL entries asked=%d " +"available=%d for eventdev: %s" , + dlb2->hl_entries, + dlb2->hw_rsrc_query_results.num_hist_list_entries, + dev->data->name); +return -EINVAL ; + } + dlb2->hl_entries = dlb2_args->alloc_hl_entries; + } +dlb2_iface_hardware_init (&dlb2->qm_instance);/* configure class of service */
@@ -5079,6 +5201,8 @@ dlb2_parse_params(const char *params,DLB2_PRODUCER_COREMASK ,DLB2_DEFAULT_LDB_PORT_ALLOCATION_ARG ,DLB2_ENABLE_CQ_WEIGHT_ARG , +DLB2_USE_DEFAULT_HL , +DLB2_ALLOC_HL_ENTRIES , NULL };if (params !=NULL && params[0 ] !='\0' ) {
@@ -5293,6 +5417,26 @@ dlb2_parse_params(const char *params,if (version ==DLB2_HW_V2 && dlb2_args->enable_cq_weight)DLB2_LOG_INFO ("Ignoring 'enable_cq_weight=y'. Only supported for 2.5 HW onwards" ); + ret =rte_kvargs_process (kvlist,DLB2_USE_DEFAULT_HL , + set_hl_override, + &dlb2_args->use_default_hl); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing hl_override arg" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist,DLB2_ALLOC_HL_ENTRIES , + set_hl_entries, + &dlb2_args->alloc_hl_entries); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing hl_override arg" , + name); +rte_kvargs_free (kvlist); +return ret; + } +rte_kvargs_free (kvlist); } }
drivers/event/dlb2/dlb2_iface.c +4 -1
@@ -73,9 +73,12 @@ int (*dlb2_iface_get_ldb_queue_depth)(struct dlb2_hw_dev *handle,int (*dlb2_iface_get_dir_queue_depth)(struct dlb2_hw_dev *handle,struct dlb2_get_dir_queue_depth_args *args); -int (*dlb2_iface_enable_cq_weight)(struct dlb2_hw_dev *handle,struct dlb2_enable_cq_weight_args *args); +int (*dlb2_iface_set_cq_inflight_ctrl)(struct dlb2_hw_dev *handle, +struct dlb2_cq_inflight_ctrl_args *args); +int (*dlb2_iface_set_cos_bw)(struct dlb2_hw_dev *handle,struct dlb2_set_cos_bw_args *args); +
drivers/event/dlb2/dlb2_iface.h +3 -1
@@ -72,10 +72,12 @@ extern int (*dlb2_iface_get_ldb_queue_depth)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_get_dir_queue_depth)(struct dlb2_hw_dev *handle,struct dlb2_get_dir_queue_depth_args *args); -extern int (*dlb2_iface_enable_cq_weight)(struct dlb2_hw_dev *handle,struct dlb2_enable_cq_weight_args *args); +extern int (*dlb2_iface_set_cq_inflight_ctrl)(struct dlb2_hw_dev *handle, +struct dlb2_cq_inflight_ctrl_args *args); +extern int (*dlb2_iface_set_cos_bw)(struct dlb2_hw_dev *handle,struct dlb2_set_cos_bw_args *args);
drivers/event/dlb2/dlb2_priv.h +16 -3
@@ -53,6 +53,8 @@#define DLB2_PRODUCER_COREMASK "producer_coremask"#define DLB2_DEFAULT_LDB_PORT_ALLOCATION_ARG "default_port_allocation"#define DLB2_ENABLE_CQ_WEIGHT_ARG "enable_cq_weight" +#define DLB2_USE_DEFAULT_HL "use_default_hl" +#define DLB2_ALLOC_HL_ENTRIES "alloc_hl_entries"/* Begin HW related defines and structs */
@@ -101,7 +103,8 @@*/ #define DLB2_MAX_HL_ENTRIES 2048#define DLB2_MIN_CQ_DEPTH 1 -#define DLB2_DEFAULT_CQ_DEPTH 32 +#define DLB2_DEFAULT_CQ_DEPTH 128/* Override using max_cq_depth parameter */ +#define DLB2_FIXED_CQ_HL_SIZE 32/* Used when ENABLE_FIXED_HL_SIZE is true */ #define DLB2_MIN_HARDWARE_CQ_DEPTH 8#define DLB2_NUM_HIST_LIST_ENTRIES_PER_LDB_PORT \ DLB2_DEFAULT_CQ_DEPTH
@@ -123,7 +126,7 @@#define DLB2_NUM_QES_PER_CACHE_LINE 4 -#define DLB2_MAX_ENQUEUE_DEPTH 32 +#define DLB2_MAX_ENQUEUE_DEPTH 128#define DLB2_MIN_ENQUEUE_DEPTH 4#define DLB2_NAME_SIZE 64
@@ -385,10 +388,13 @@ struct dlb2_port {struct dlb2_eventdev *dlb2;/* back ptr */ struct dlb2_eventdev_port *ev_port;/* back ptr */ bool use_scalar;/* force usage of scalar code */ +uint8_t reorder_id;/* id used for reordering events coming back into the scheduler */ uint16_t hw_credit_quanta;bool use_avx512; +bool enable_inflight_ctrl;/*DLB2.5 enable HW inflight control */ bool is_producer;/* True if port is of type producer */ -uint8_t reorder_id;/* id used for reordering events coming back into the scheduler */ +uint16_t inflight_threshold;/* DLB2.5 HW inflight threshold */ +uint16_t hist_list;/* Port history list */ bool reorder_en;struct dlb2_reorder *order;/* For ordering enqueues */ };
@@ -650,6 +656,8 @@ 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 */ bool enable_cq_weight; +uint16_t hl_entries;/* Num HL entries to allocate for the domain */ +int default_port_hl;/* Fixed or dynamic (2*CQ Depth) HL assignment */ };/* used for collecting and passing around the dev args */
@@ -683,6 +691,8 @@ struct dlb2_devargs {const char *producer_coremask;bool default_ldb_port_allocation;bool enable_cq_weight; +bool use_default_hl; +uint32_t alloc_hl_entries; };/* End Eventdev related defines and structs */
@@ -725,6 +735,9 @@ int dlb2_secondary_eventdev_probe(struct rte_eventdev *dev,uint32_t dlb2_get_queue_depth (struct dlb2_eventdev *dlb2,struct dlb2_eventdev_queue *queue); +int dlb2_set_port_param (struct dlb2_eventdev *dlb2,int port_id, +uint64_t flags,struct rte_pmd_dlb2_port_param *val); + int dlb2_parse_params(const char *params, const char *name, struct dlb2_devargs *dlb2_args,
drivers/event/dlb2/dlb2_user.h +24 -0
@@ -472,6 +472,8 @@ struct dlb2_create_ldb_port_args {__u16 cq_history_list_size;__u8 cos_id;__u8 cos_strict; +__u8 enable_inflight_ctrl; +__u16 inflight_threshold; };/*
@@ -717,6 +719,28 @@ struct dlb2_enable_cq_weight_args {__u32 limit; }; +/* +* DLB2_DOMAIN_CMD_SET_CQ_INFLIGHT_CTRL: Set Per-CQ inflight control for +* {ATM,UNO,ORD} QEs. +* +* Input parameters: +* - port_id: Load-balanced port ID. +* - enable: True if inflight control is enabled. False otherwise +* - threshold: Per CQ inflight threshold. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_cq_inflight_ctrl_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u16 enable; +__u16 threshold; +}; +/* * Mapping sizes for memory mapping the consumer queue (CQ) memory space, and * producer port (PP) MMIO space.
drivers/event/dlb2/pf/base/dlb2_regs.h +9 -0
@@ -3238,6 +3238,15 @@#define DLB2_LSP_CQ_LDB_INFL_LIM_LIMIT_LOC 0#define DLB2_LSP_CQ_LDB_INFL_LIM_RSVD0_LOC 12 +#define DLB2_LSP_CQ_LDB_INFL_THRESH (x) \ + (0x90580000 + (x) * 0x1000) +#define DLB2_LSP_CQ_LDB_INFL_THRESH_RST 0x0 + +#define DLB2_LSP_CQ_LDB_INFL_THRESH_THRESH 0x00000FFF +#define DLB2_LSP_CQ_LDB_INFL_THRESH_RSVD0 0xFFFFF000 +#define DLB2_LSP_CQ_LDB_INFL_THRESH_THRESH_LOC 0 +#define DLB2_LSP_CQ_LDB_INFL_THRESH_RSVD0_LOC 12 +#define DLB2_V2LSP_CQ_LDB_TKN_CNT (x) \ (0xa0580000 + (x) * 0x1000)#define DLB2_V2_5LSP_CQ_LDB_TKN_CNT (x) \
drivers/event/dlb2/pf/base/dlb2_resource.c +74 -0
86 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_resource.h +18 -0
@@ -1956,4 +1956,22 @@ int dlb2_hw_enable_cq_weight(struct dlb2_hw *hw,bool vdev_request, unsigned int vdev_id); +/** +* This function configures the inflight control threshold for a cq. +* +* This must be called after creating the port. +* +* Return: +* Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is +* assigned a detailed error code from enum dlb2_error. If successful, resp->id +* contains the queue ID. +* +* Errors: +* EINVAL - The domain or port is not configured. +*/ +int dlb2_hw_set_cq_inflight_ctrl (struct dlb2_hw *hw,u32 domain_id, +struct dlb2_cq_inflight_ctrl_args *args, +struct dlb2_cmd_response *resp, +bool vdev_request,unsigned int vdev_id); +#endif /* __DLB2_RESOURCE_H */
drivers/event/dlb2/pf/dlb2_pf.c +28 -1
@@ -367,6 +367,7 @@ dlb2_pf_ldb_port_create(struct dlb2_hw_dev *handle, cfg, cq_base, &response); + cfg->response = response;if (ret) goto create_port_err;
@@ -449,6 +450,9 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle, cfg, cq_base, &response); + + cfg->response = response; +if (ret) goto create_port_err;
@@ -679,6 +683,26 @@ dlb2_pf_enable_cq_weight(struct dlb2_hw_dev *handle,return ret; } +static int +dlb2_pf_set_cq_inflight_ctrl (struct dlb2_hw_dev *handle, +struct dlb2_cq_inflight_ctrl_args *args) +{ +struct dlb2_dev *dlb2_dev = (struct dlb2_dev *)handle->pf_dev; +struct dlb2_cmd_response response = {0 }; +int ret =0 ; + +DLB2_INFO (dev->dlb2_device,"Entering %s()\n" , __func__); + + ret =dlb2_hw_set_cq_inflight_ctrl (&dlb2_dev->hw, handle->domain_id, + args, &response, false,0 ); + args->response = response; + +DLB2_INFO (dev->dlb2_device,"Exiting %s() with ret=%d" , + __func__, ret); + +return ret; +} +static int dlb2_pf_set_cos_bandwidth (struct dlb2_hw_dev *handle,struct dlb2_set_cos_bw_args *args)
@@ -724,6 +748,7 @@ dlb2_pf_iface_fn_ptrs_init(void) dlb2_iface_get_sn_occupancy = dlb2_pf_get_sn_occupancy; dlb2_iface_enable_cq_weight = dlb2_pf_enable_cq_weight; dlb2_iface_set_cos_bw = dlb2_pf_set_cos_bandwidth; + dlb2_iface_set_cq_inflight_ctrl = dlb2_pf_set_cq_inflight_ctrl; }/* PCI DEV HOOKS */
@@ -743,7 +768,9 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev) .hw_credit_quanta = DLB2_SW_CREDIT_BATCH_SZ, .default_depth_thresh = DLB2_DEPTH_THRESH_DEFAULT, .max_cq_depth = DLB2_DEFAULT_CQ_DEPTH, - .max_enq_depth = DLB2_MAX_ENQUEUE_DEPTH + .max_enq_depth = DLB2_MAX_ENQUEUE_DEPTH, + .use_default_hl = true, + .alloc_hl_entries = 0 };struct dlb2_eventdev *dlb2;int q;
drivers/event/dlb2/rte_pmd_dlb2.c +24 -0
@@ -39,3 +39,27 @@ rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id,return 0 ; } + +RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dlb2_set_port_param, 25.07) +int +rte_pmd_dlb2_set_port_param (uint8_t dev_id, +uint8_t port_id, +uint64_t flags, +struct rte_pmd_dlb2_port_param *val) +{ +struct dlb2_eventdev *dlb2; +struct rte_eventdev *dev; + +if (val ==NULL ) +return -EINVAL ; + +RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET (dev_id, -EINVAL ); + dev = &rte_eventdevs[dev_id]; + + dlb2 =dlb2_pmd_priv (dev); + +if (port_id >= dlb2->num_ports) +return -EINVAL ; + +return dlb2_set_port_param (dlb2, port_id, flags, val); +}
drivers/event/dlb2/rte_pmd_dlb2.h +53 -2
73 lines not on this page · raw message
Signature · 1 line
2.39.1
PATCH v4 5/7 event/dlb2: fix to avoid credit release race condition
In reply to Pravin PathakWhile unlinking ports, all associated credits should be released. This commit avoids race condition when main thread is unlinking while workers are running.
--- drivers/event/dlb2/dlb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/event/dlb2/dlb2.c +1 -1
@@ -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;
Signature · 1 line
2.39.1
PATCH v4 6/7 event/dlb2: fix qid depth xstat in vector path
In reply to Pravin Pathakupdate QID depth xstats counter in vector dequeue path
--- drivers/event/dlb2/dlb2.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/event/dlb2/dlb2.c +8 -0
@@ -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; }
Signature · 1 line
2.39.1
PATCH v4 7/7 event/dlb2: fix default credits based on HW version
In reply to Pravin PathakFrom: Tirthendu Sarkar <[email protected]>
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.
--- drivers/event/dlb2/pf/dlb2_pf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/event/dlb2/pf/dlb2_pf.c +2 -0
@@ -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) {
Signature · 1 line
2.39.1
Re: [PATCH v4 7/7] event/dlb2: fix default credits based on HW version
Quoted 6 lines · Pravin Pathak
From: Tirthendu Sarkar <[email protected]>
dlb2_eventdev_info_get()that implementsrte_event_dev_info_get()should return the maximum available credits as supported by HW.
Quoted 6 lines
Set maximum credits before device probing by checking HW version.
Fixes b66a418d2ad3 ("event/dlb2: add v2.5 probe")Signed-off-by Tirthendu Sarkar <[email protected]>
Series applied to dpdk-next-net-eventdev/for-main. Thanks