From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6055642CC8; Thu, 15 Jun 2023 18:55:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 896F142D16; Thu, 15 Jun 2023 18:54:57 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id A725740A8B for ; Thu, 15 Jun 2023 18:54:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686848092; x=1718384092; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b2iVj2oYnCNJF/PaqupOplAg+78d3FUeV/voSpxZXvc=; b=FdZnLQJmBRvBPH2fMIHicw3IGgJexOg9qvNhF0A69vtkGoJ70Z5mwfR3 JswEOGWQvb0smIeG0Jz4TVLoQVe5JPpyyElxdIpxhemnR0O7kFAuOvvN6 AYHw787K6/cDcf6+spRhQxngoihAi50+uoR45Y4TF211o0DAuFq8ml4VA XQV2cpFFKlvcaas8VyL4dBWAptaxaIXDV6kqhb0spUR+iIIcVFiK6Th4O l7z3ShaZHbJxLDaV4vcwFzy2asIDtGUZXcImKYi7PqxOpPa27s5a871TT TsuZkCdwn6wz0VIh0Xh39iaHd4D9I+3LOV55/Y+glq0PAHAqXDRsKYJKt Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="356469822" X-IronPort-AV: E=Sophos;i="6.00,245,1681196400"; d="scan'208";a="356469822" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2023 09:54:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="712518725" X-IronPort-AV: E=Sophos;i="6.00,245,1681196400"; d="scan'208";a="712518725" Received: from spr-npg-bds1-eec2.sn.intel.com (HELO spr-npg-bds1-eec2..) ([10.233.181.123]) by orsmga002.jf.intel.com with ESMTP; 15 Jun 2023 09:54:29 -0700 From: Nicolas Chautru 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 Subject: [PATCH v2 4/5] bbdev: improving error handling for queue configuration Date: Thu, 15 Jun 2023 16:49:00 +0000 Message-Id: <20230615164901.40845-5-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230615164901.40845-1-nicolas.chautru@intel.com> References: <20230615164901.40845-1-nicolas.chautru@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Refactor of the error handling based on available priority queue to be more generic. Signed-off-by: Nicolas Chautru --- 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