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 405FFA04B5; Thu, 10 Sep 2020 16:37:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C02CC1C114; Thu, 10 Sep 2020 16:37:16 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 498751BF8D for ; Thu, 10 Sep 2020 16:37:14 +0200 (CEST) IronPort-SDR: OkiKhXtpOMJ+5fLdsbP1tF1IqgYfwGRrbvfT3THHk3CDb/FEB7U1V82govjd3TKVeIGe/BW1lH xWeJlPgiHFGw== X-IronPort-AV: E=McAfee;i="6000,8403,9739"; a="138058421" X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="138058421" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2020 07:37:13 -0700 IronPort-SDR: zqpAS+BX5AYCrCYvlYrem9n5Ppbc3VoIP2gyRnYQmEJX4+CQtyPP5krtRvxNLgxK6Z3mJGGgup UAKmzbtVK8aw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="304900397" Received: from silpixa00399126.ir.intel.com ([10.237.222.27]) by orsmga006.jf.intel.com with ESMTP; 10 Sep 2020 07:37:11 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, Bruce Richardson , Nipun Gupta , John McNamara , Marko Kovacevic , Xiaoyun Li , Jingjing Wu , Hemant Agrawal Date: Thu, 10 Sep 2020 15:36:07 +0100 Message-Id: <20200910143609.986696-6-bruce.richardson@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200910143609.986696-1-bruce.richardson@intel.com> References: <20200709152047.167730-1-bruce.richardson@intel.com> <20200910143609.986696-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 5/7] rawdev: allow queue 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 Acked-by: Nipun Gupta --- v3: add release note update --- doc/guides/rel_notes/release_20_11.rst | 1 + 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 +++- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst index e79b88641b..667e3d54ad 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -90,6 +90,7 @@ API Changes allowing limited driver type-checking and ABI compatibility. * rawdev: Changed the return type of the function ``rte_dev_info_get()`` + and the function ``rte_rawdev_queue_conf_get()`` from ``void`` to ``int`` allowing the return of error codes from drivers. 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