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 236C4A0528; Thu, 9 Jul 2020 17:21:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BCC241E89B; Thu, 9 Jul 2020 17:21:20 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 031C11E89B for ; Thu, 9 Jul 2020 17:21:18 +0200 (CEST) IronPort-SDR: 2dzuQ9C1C0kCqMqmSge8xfAZUjaX0wJFhQhN4xPV17E+ZlXUcm535w+kzWvwzdywUJR63AuMnf tuYg7TBVdJuA== X-IronPort-AV: E=McAfee;i="6000,8403,9677"; a="209546688" X-IronPort-AV: E=Sophos;i="5.75,331,1589266800"; d="scan'208";a="209546688" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jul 2020 08:21:18 -0700 IronPort-SDR: Ewp9q2WflKZa3vHtUATQMVWBIXKCthdmYPJjCorANSG2clFoelRBwUJbiXELlJur7YsRgiDl5L qwh40lw+ev7w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,331,1589266800"; d="scan'208";a="483835620" Received: from silpixa00399126.ir.intel.com ([10.237.222.36]) by fmsmga006.fm.intel.com with ESMTP; 09 Jul 2020 08:21:16 -0700 From: Bruce Richardson To: Nipun Gupta , Hemant Agrawal Cc: dev@dpdk.org, Rosen Xu , Tianfei zhang , Xiaoyun Li , Jingjing Wu , Satha Rao , Mahipal Challa , Jerin Jacob , Bruce Richardson Date: Thu, 9 Jul 2020 16:20:47 +0100 Message-Id: <20200709152047.167730-6-bruce.richardson@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709152047.167730-1-bruce.richardson@intel.com> References: <20200709152047.167730-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 20.11 5/5] 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 7c15e204c..72489c521 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 f109e4d2c..9c4082b9a 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; @@ -231,7 +231,7 @@ static void skeleton_rawdev_queue_def_conf(struct rte_rawdev *dev, SKELETON_PMD_FUNC_TRACE(); 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]; @@ -239,6 +239,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 8965f2ce3..69872d450 100644 --- a/lib/librte_rawdev/rte_rawdev.c +++ b/lib/librte_rawdev/rte_rawdev.c @@ -146,8 +146,7 @@ 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, queue_conf_size); - return 0; + return (*dev->dev_ops->queue_def_conf)(dev, queue_id, queue_conf, queue_conf_size); } int diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h b/lib/librte_rawdev/rte_rawdev_pmd.h index 34eb667f6..34dd7181b 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