[v3,3/5] event/dlb2: fix cq depth override

Message ID 20220702162239.1646548-4-timothy.mcdaniel@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series DLB2 Bug Fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Timothy McDaniel July 2, 2022, 4:22 p.m. UTC
  This commit fixes a bug, where we could assign a cq depth
of zero, leading to a subsequent divide-by-zero fault.
It also fixes an issue where the original default cq depth
was returned on a query, insgtead of the overridden value.

Fixes: 86fe66d45667 ("event/dlb2: allow CQ depths up to 1024")
Cc: timothy.mcdaniel@intel.com

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
---
 drivers/event/dlb2/dlb2.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index a6182a1ac7..b50cd8e5ce 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -4505,7 +4505,14 @@  dlb2_primary_eventdev_probe(struct rte_eventdev *dev,
 	dlb2->hw_credit_quanta = dlb2_args->hw_credit_quanta;
 	dlb2->default_depth_thresh = dlb2_args->default_depth_thresh;
 	dlb2->vector_opts_enabled = dlb2_args->vector_opts_enabled;
-	dlb2->max_cq_depth = dlb2_args->max_cq_depth;
+
+
+	if (dlb2_args->max_cq_depth != 0)
+		dlb2->max_cq_depth = dlb2_args->max_cq_depth;
+	else
+		dlb2->max_cq_depth = DLB2_DEFAULT_CQ_DEPTH;
+
+	evdev_dlb2_default_info.max_event_port_dequeue_depth = dlb2->max_cq_depth;
 
 	err = dlb2_iface_open(&dlb2->qm_instance, name);
 	if (err < 0) {