DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nicolas Chautru <nicolas.chautru@intel.com>
To: dev@dpdk.org, maxime.coquelin@redhat.com
Cc: trix@redhat.com, hemant.agrawal@nxp.com,
	david.marchand@redhat.com, hernan.vargas@intel.com,
	Nicolas Chautru <nicolas.chautru@intel.com>
Subject: [PATCH v1 4/4] bbdev: improving error handling for queue configuration
Date: Thu, 25 May 2023 23:23:31 +0000	[thread overview]
Message-ID: <20230525232331.34645-5-nicolas.chautru@intel.com> (raw)
In-Reply-To: <20230525232331.34645-1-nicolas.chautru@intel.com>

Refactor of the error handling based on available priority
queue to be more generic.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
 lib/bbdev/rte_bbdev.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index 26fc077bdc..589b796ea3 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -441,6 +441,7 @@ rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
 	const struct rte_bbdev_op_cap *p;
 	struct rte_bbdev_queue_conf *stored_conf;
 	const char *op_type_str;
+	unsigned int max_priority;
 	VALID_DEV_OR_RET_ERR(dev, dev_id);
 
 	VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
@@ -494,20 +495,16 @@ rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
 					conf->queue_size, queue_id, dev_id);
 			return -EINVAL;
 		}
-		if (conf->op_type == RTE_BBDEV_OP_TURBO_DEC &&
-			conf->priority > dev_info.max_ul_queue_priority) {
+		if ((uint8_t)conf->op_type >= RTE_BBDEV_OP_TYPE_SIZE_MAX) {
 			rte_bbdev_log(ERR,
-					"Priority (%u) of queue %u of bbdev %u must be <= %u",
-					conf->priority, queue_id, dev_id,
-					dev_info.max_ul_queue_priority);
+					"Invalid operation type (%u) ", conf->op_type);
 			return -EINVAL;
 		}
-		if (conf->op_type == RTE_BBDEV_OP_TURBO_ENC &&
-			conf->priority > dev_info.max_dl_queue_priority) {
+		max_priority = dev_info.queue_priority[conf->op_type];
+		if (conf->priority > max_priority) {
 			rte_bbdev_log(ERR,
 					"Priority (%u) of queue %u of bbdev %u must be <= %u",
-					conf->priority, queue_id, dev_id,
-					dev_info.max_dl_queue_priority);
+					conf->priority, queue_id, dev_id, max_priority);
 			return -EINVAL;
 		}
 	}
-- 
2.34.1


      parent reply	other threads:[~2023-05-25 23:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 23:23 [PATCH v1 0/4] bbdev: API extension for 23.11 Nicolas Chautru
2023-05-25 23:23 ` [PATCH v1 1/4] bbdev: add operation type for MLDTS procession Nicolas Chautru
2023-05-25 23:23 ` [PATCH v1 2/4] bbdev: add new capabilities for FFT processing Nicolas Chautru
2023-05-25 23:23 ` [PATCH v1 3/4] bbdev: add new capability for FEC 5G UL processing Nicolas Chautru
2023-05-25 23:23 ` Nicolas Chautru [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230525232331.34645-5-nicolas.chautru@intel.com \
    --to=nicolas.chautru@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=hernan.vargas@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).