event/dlb2: fix CQ depth override credit deadlock

This commit fixes a bug, where we could encounter a credit
deadlock due to changing the CQ depth. To remedy this situation,
the commit reduces the maximum CQ depth from 1024 to 128,
and also allows configuring the maximum enqueue depth. Maximum
enqueue depth must be tuned to the CQ depth, if the CQ depth
is increased.

Fixes: 86fe66d45667 ("event/dlb2: allow CQ depths up to 1024")
Cc: stable@dpdk.org

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
This commit is contained in:
Timothy McDaniel 2022-07-02 11:22:38 -05:00 committed by Jerin Jacob
parent c73697024e
commit 0fc71ad881
3 changed files with 60 additions and 2 deletions

View File

@ -326,6 +326,36 @@ set_max_cq_depth(const char *key __rte_unused,
return 0;
}
static int
set_max_enq_depth(const char *key __rte_unused,
const char *value,
void *opaque)
{
int *max_enq_depth = opaque;
int ret;
if (value == NULL || opaque == NULL) {
DLB2_LOG_ERR("NULL pointer\n");
return -EINVAL;
}
ret = dlb2_string_to_int(max_enq_depth, value);
if (ret < 0)
return ret;
if (*max_enq_depth < DLB2_MIN_ENQ_DEPTH_OVERRIDE ||
*max_enq_depth > DLB2_MAX_ENQ_DEPTH_OVERRIDE ||
!rte_is_power_of_2(*max_enq_depth)) {
DLB2_LOG_ERR("dlb2: max_enq_depth %d and %d and a power of 2\n",
DLB2_MIN_ENQ_DEPTH_OVERRIDE,
DLB2_MAX_ENQ_DEPTH_OVERRIDE);
return -EINVAL;
}
return 0;
}
static int
set_max_num_events(const char *key __rte_unused,
const char *value,
@ -4514,6 +4544,15 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev,
evdev_dlb2_default_info.max_event_port_dequeue_depth = dlb2->max_cq_depth;
if (dlb2_args->max_enq_depth != 0)
dlb2->max_enq_depth = dlb2_args->max_enq_depth;
else
dlb2->max_enq_depth = DLB2_DEFAULT_CQ_DEPTH;
evdev_dlb2_default_info.max_event_port_enqueue_depth =
dlb2->max_enq_depth;
err = dlb2_iface_open(&dlb2->qm_instance, name);
if (err < 0) {
DLB2_LOG_ERR("could not open event hardware device, err=%d\n",
@ -4650,6 +4689,7 @@ dlb2_parse_params(const char *params,
DLB2_DEPTH_THRESH_ARG,
DLB2_VECTOR_OPTS_ENAB_ARG,
DLB2_MAX_CQ_DEPTH,
DLB2_MAX_ENQ_DEPTH,
DLB2_CQ_WEIGHT,
DLB2_PORT_COS,
DLB2_COS_BW,
@ -4789,6 +4829,17 @@ dlb2_parse_params(const char *params,
return ret;
}
ret = rte_kvargs_process(kvlist,
DLB2_MAX_ENQ_DEPTH,
set_max_enq_depth,
&dlb2_args->max_enq_depth);
if (ret != 0) {
DLB2_LOG_ERR("%s: Error parsing vector opts enabled",
name);
rte_kvargs_free(kvlist);
return ret;
}
ret = rte_kvargs_process(kvlist,
DLB2_CQ_WEIGHT,
set_cq_weight,

View File

@ -29,7 +29,10 @@
#define DLB2_SW_CREDIT_C_QUANTA_DEFAULT 256 /* Consumer */
#define DLB2_DEPTH_THRESH_DEFAULT 256
#define DLB2_MIN_CQ_DEPTH_OVERRIDE 32
#define DLB2_MAX_CQ_DEPTH_OVERRIDE 1024
#define DLB2_MAX_CQ_DEPTH_OVERRIDE 128
#define DLB2_MIN_ENQ_DEPTH_OVERRIDE 32
#define DLB2_MAX_ENQ_DEPTH_OVERRIDE 1024
/* command line arg strings */
#define NUMA_NODE_ARG "numa_node"
@ -44,6 +47,7 @@
#define DLB2_DEPTH_THRESH_ARG "default_depth_thresh"
#define DLB2_VECTOR_OPTS_ENAB_ARG "vector_opts_enable"
#define DLB2_MAX_CQ_DEPTH "max_cq_depth"
#define DLB2_MAX_ENQ_DEPTH "max_enqueue_depth"
#define DLB2_CQ_WEIGHT "cq_weight"
#define DLB2_PORT_COS "port_cos"
#define DLB2_COS_BW "cos_bw"
@ -585,6 +589,7 @@ struct dlb2_eventdev {
int num_dir_credits_override;
bool vector_opts_enabled;
int max_cq_depth;
int max_enq_depth;
volatile enum dlb2_run_state run_state;
uint16_t num_dir_queues; /* total num of evdev dir queues requested */
union {
@ -660,6 +665,7 @@ struct dlb2_devargs {
int default_depth_thresh;
bool vector_opts_enabled;
int max_cq_depth;
int max_enq_depth;
struct dlb2_cq_weight cq_weight;
struct dlb2_port_cos port_cos;
struct dlb2_cos_bw cos_bw;

View File

@ -708,7 +708,8 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev)
.sw_credit_quanta = DLB2_SW_CREDIT_QUANTA_DEFAULT,
.hw_credit_quanta = DLB2_SW_CREDIT_BATCH_SZ,
.default_depth_thresh = DLB2_DEPTH_THRESH_DEFAULT,
.max_cq_depth = DLB2_DEFAULT_CQ_DEPTH
.max_cq_depth = DLB2_DEFAULT_CQ_DEPTH,
.max_enq_depth = DLB2_MAX_ENQUEUE_DEPTH
};
struct dlb2_eventdev *dlb2;