]> git.droids-corp.org - dpdk.git/commitdiff
event/dlb2: fix CQ depth override credit deadlock
authorTimothy McDaniel <timothy.mcdaniel@intel.com>
Sat, 2 Jul 2022 16:22:38 +0000 (11:22 -0500)
committerJerin Jacob <jerinj@marvell.com>
Mon, 4 Jul 2022 16:04:52 +0000 (18:04 +0200)
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>
drivers/event/dlb2/dlb2.c
drivers/event/dlb2/dlb2_priv.h
drivers/event/dlb2/pf/dlb2_pf.c

index b50cd8e5ce92b9e92649afa560bae16e18e01168..8a68c25c93c12e4f399deff58f0d08277090ceda 100644 (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,
index 8744efa79d5369e8db36dec109426b644c535210..1edea83a5b6b8ffc3b5e011b546317546e75d17d 100644 (file)
 #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;
index 0627f06a6e145168e5437ccf7b5638e8d74216c4..086d4a1cc7f4f062fa7f0c9960bf0a5b4139ff2c 100644 (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;