From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 65D2DA04B0; Thu, 13 Aug 2020 13:29:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 868941C0DA; Thu, 13 Aug 2020 13:28:30 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 803041C0D6 for ; Thu, 13 Aug 2020 13:28:28 +0200 (CEST) IronPort-SDR: upt/O9GBE4MMyGUOa4uNkToigiPaXUexNpbR1OShvatPVvNuj/qYZ+dmnLl4zJkifgqikO5mjj YYaJPRrbZOmA== X-IronPort-AV: E=McAfee;i="6000,8403,9711"; a="141827909" X-IronPort-AV: E=Sophos;i="5.76,308,1592895600"; d="scan'208";a="141827909" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2020 04:28:28 -0700 IronPort-SDR: GUV0ceqAhQpeNhfb4TYKPLC7pSvWB8pXWTc0Q5EOtpJKI3ExUKa6AFuJUBT+n8pzfaO9HmlLIk nF2gG1w3nQCg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,308,1592895600"; d="scan'208";a="495832621" Received: from silpixa00399126.ir.intel.com ([10.237.222.56]) by fmsmga005.fm.intel.com with ESMTP; 13 Aug 2020 04:28:26 -0700 From: Bruce Richardson To: Nipun Gupta , Hemant Agrawal Cc: dev@dpdk.org, Bruce Richardson , Xiaoyun Li , Jingjing Wu Date: Thu, 13 Aug 2020 12:28:03 +0100 Message-Id: <20200813112806.164578-6-bruce.richardson@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200813112806.164578-1-bruce.richardson@intel.com> References: <20200709152047.167730-1-bruce.richardson@intel.com> <20200813112806.164578-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 5/7] rawdev: allow queue default config query to return error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The driver APIs for returning the queue default config can fail if the parameters are invalid, or other reasons, so allow them to return error codes to the rawdev layer and from hence to the app. Signed-off-by: Bruce Richardson --- drivers/raw/ntb/ntb.c | 6 ++++-- drivers/raw/skeleton/skeleton_rawdev.c | 12 +++++++----- lib/librte_rawdev/rte_rawdev.c | 3 +-- lib/librte_rawdev/rte_rawdev_pmd.h | 4 +++- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c index ad10857991..bddb1f5916 100644 --- a/drivers/raw/ntb/ntb.c +++ b/drivers/raw/ntb/ntb.c @@ -246,7 +246,7 @@ ntb_dev_intr_handler(void *param) } } -static void +static int ntb_queue_conf_get(struct rte_rawdev *dev, uint16_t queue_id, rte_rawdev_obj_t queue_conf, @@ -256,11 +256,13 @@ ntb_queue_conf_get(struct rte_rawdev *dev, struct ntb_hw *hw = dev->dev_private; if (conf_size != sizeof(*q_conf)) - return; + return -EINVAL; q_conf->tx_free_thresh = hw->tx_queues[queue_id]->tx_free_thresh; q_conf->nb_desc = hw->rx_queues[queue_id]->nb_rx_desc; q_conf->rx_mp = hw->rx_queues[queue_id]->mpool; + + return 0; } static void diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c index 801c707fb9..f8b47a391a 100644 --- a/drivers/raw/skeleton/skeleton_rawdev.c +++ b/drivers/raw/skeleton/skeleton_rawdev.c @@ -220,10 +220,10 @@ static int skeleton_rawdev_reset(struct rte_rawdev *dev) return 0; } -static void skeleton_rawdev_queue_def_conf(struct rte_rawdev *dev, - uint16_t queue_id, - rte_rawdev_obj_t queue_conf, - size_t conf_size) +static int skeleton_rawdev_queue_def_conf(struct rte_rawdev *dev, + uint16_t queue_id, + rte_rawdev_obj_t queue_conf, + size_t conf_size) { struct skeleton_rawdev *skeldev; struct skeleton_rawdev_queue *skelq; @@ -232,7 +232,7 @@ static void skeleton_rawdev_queue_def_conf(struct rte_rawdev *dev, if (!dev || !queue_conf || conf_size != sizeof(struct skeleton_rawdev_queue)) - return; + return -EINVAL; skeldev = skeleton_rawdev_get_priv(dev); skelq = &skeldev->queues[queue_id]; @@ -240,6 +240,8 @@ static void skeleton_rawdev_queue_def_conf(struct rte_rawdev *dev, if (queue_id < SKELETON_MAX_QUEUES) rte_memcpy(queue_conf, skelq, sizeof(struct skeleton_rawdev_queue)); + + return 0; } static void diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawdev.c index f48d8cf10b..fd123bb848 100644 --- a/lib/librte_rawdev/rte_rawdev.c +++ b/lib/librte_rawdev/rte_rawdev.c @@ -146,9 +146,8 @@ rte_rawdev_queue_conf_get(uint16_t dev_id, dev = &rte_rawdevs[dev_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_def_conf, -ENOTSUP); - (*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf, + return (*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf, queue_conf_size); - return 0; } int diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h b/lib/librte_rawdev/rte_rawdev_pmd.h index 34eb667f62..34dd7181b4 100644 --- a/lib/librte_rawdev/rte_rawdev_pmd.h +++ b/lib/librte_rawdev/rte_rawdev_pmd.h @@ -215,8 +215,10 @@ typedef int (*rawdev_reset_t)(struct rte_rawdev *dev); * @param[out] queue_conf * Raw device queue configuration structure * + * @return + * Returns 0 on success, negative errno on failure */ -typedef void (*rawdev_queue_conf_get_t)(struct rte_rawdev *dev, +typedef int (*rawdev_queue_conf_get_t)(struct rte_rawdev *dev, uint16_t queue_id, rte_rawdev_obj_t queue_conf, size_t queue_conf_size); -- 2.25.1