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>
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,
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",
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,
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,
#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"
#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"
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 {
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;
.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;