From patchwork Thu Mar 18 06:34:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 403952 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp217412jai; Wed, 17 Mar 2021 23:35:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZ3Fr49TXF8SY5pbOsg5GjKDFvLYmBFOrr2oMERMb4Ir0tG3nPOzZ0WGooXadCyHh6KESE X-Received: by 2002:a17:906:4c56:: with SMTP id d22mr40618635ejw.426.1616049325981; Wed, 17 Mar 2021 23:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616049325; cv=none; d=google.com; s=arc-20160816; b=ExDngM7WIyHyERMmOrxa9ZezNVw4Z+6eVZr8rN6JjyKfV+JxVzqTrqThvnwjqzHjmp IcQ4Tu9bQ0o3Ht0WchMj1ordm7/6e4Z4kZTKksdiBHKKOLkFL/mZDFfLzfo2mI5EB5d2 bz00PZD3bLWFs+zTp4m58JaR3Thog8x0NVv1KXBI3olepjTx8qbsiNt1IUBm3WFi3NM6 UYWBLEjwVMm/K61Yp53oPBM82kZ05JpZS28Sixs15AggW8q6n3rKjU9Oi7QR6sGg0U3Z 531yvgpq2JGiPpZHBfzPp0zffr5uw+ahxxuvmWYoAlTFmKHlrggQd2RawjXu1uOeEgGM 5j+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=SM+pNa2S4hFPvt1I/lnPVEuvHYzMU+h0pN6S94WbV2I=; b=HE55nW/2CzhacAuZpVnL9g1gd60w6LkSzwhfx9QiOSXPcQstmQhiWoczo0HbhS41Kp 1oDxV2jcz/Jr6pHFkELY4Cu5QdMT0aAm6Jcg2Kysth3LHRksGvEWVohQyxPKC1UUVfvl 2ahRGacRKsbGmAQxsGD2qm2ZMmSFhK4zKHtDcITaV3nn3v25grdM6GyLKtHDcBFncm+2 zTdJAUvUzyVL1+sSehqymURwD55YgTrTGH+5i1wTpSq00URs2BWG6tzhUq/WN72Hklph 1/65QsXNZQAa1B+l7QdU8PNfiDegxHNHs+JHCp67t0f/+SUZ0FWLve0Iht2Mu97yYJta 6HaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id e1si898384ejx.431.2021.03.17.23.35.25; Wed, 17 Mar 2021 23:35:25 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A1064140EA3; Thu, 18 Mar 2021 07:35:15 +0100 (CET) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id A63CD40698 for ; Thu, 18 Mar 2021 07:35:12 +0100 (CET) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 890ED201C92; Thu, 18 Mar 2021 07:35:12 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 72E262001F7; Thu, 18 Mar 2021 07:35:10 +0100 (CET) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 5FC2D402B3; Thu, 18 Mar 2021 07:35:07 +0100 (CET) From: Hemant Agrawal To: dev@dpdk.org Cc: Nipun Gupta , Hemant Agrawal Date: Thu, 18 Mar 2021 12:04:17 +0530 Message-Id: <20210318063421.14895-2-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210318063421.14895-1-hemant.agrawal@nxp.com> References: <20210318063421.14895-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 2/6] baseband/la12xx: add devargs for max queues 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 Sender: "dev" This patch adds dev args to take max queues as input Signed-off-by: Nipun Gupta Signed-off-by: Hemant Agrawal --- drivers/baseband/la12xx/bbdev_la12xx.c | 72 +++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c index b4c3000e9..b5a8f26ed 100644 --- a/drivers/baseband/la12xx/bbdev_la12xx.c +++ b/drivers/baseband/la12xx/bbdev_la12xx.c @@ -19,13 +19,72 @@ RTE_LOG_REGISTER(bbdev_la12xx_logtype, pmd.bb.la12xx, NOTICE); +/* Initialisation params structure that can be used by LA12xx BBDEV driver */ +struct bbdev_la12xx_params { + uint8_t queues_num; /*< LA12xx BBDEV queues number */ +}; + +#define BBDEV_LA12XX_MAX_NB_QUEUES_ARG "max_nb_queues" + +static const char * const bbdev_la12xx_valid_params[] = { + BBDEV_LA12XX_MAX_NB_QUEUES_ARG, +}; + /* private data structure */ struct bbdev_la12xx_private { unsigned int max_nb_queues; /**< Max number of queues */ }; +static inline int +parse_u16_arg(const char *key, const char *value, void *extra_args) +{ + uint16_t *u16 = extra_args; + + unsigned int long result; + if ((value == NULL) || (extra_args == NULL)) + return -EINVAL; + errno = 0; + result = strtoul(value, NULL, 0); + if ((result >= (1 << 16)) || (errno != 0)) { + BBDEV_LA12XX_PMD_ERR("Invalid value %lu for %s", result, key); + return -ERANGE; + } + *u16 = (uint16_t)result; + return 0; +} + +/* Parse parameters used to create device */ +static int +parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params, + const char *input_args) +{ + struct rte_kvargs *kvlist = NULL; + int ret = 0; + + if (params == NULL) + return -EINVAL; + if (input_args) { + kvlist = rte_kvargs_parse(input_args, + bbdev_la12xx_valid_params); + if (kvlist == NULL) + return -EFAULT; + + ret = rte_kvargs_process(kvlist, bbdev_la12xx_valid_params[0], + &parse_u16_arg, ¶ms->queues_num); + if (ret < 0) + goto exit; + + } + +exit: + if (kvlist) + rte_kvargs_free(kvlist); + return ret; +} + /* Create device */ static int -la12xx_bbdev_create(struct rte_vdev_device *vdev) +la12xx_bbdev_create(struct rte_vdev_device *vdev, + struct bbdev_la12xx_params *init_params) { struct rte_bbdev *bbdev; const char *name = rte_vdev_device_name(vdev); @@ -62,7 +121,11 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev) static int la12xx_bbdev_probe(struct rte_vdev_device *vdev) { + struct bbdev_la12xx_params init_params = { + RTE_BBDEV_DEFAULT_MAX_NB_QUEUES + }; const char *name; + const char *input_args; PMD_INIT_FUNC_TRACE(); @@ -73,7 +136,10 @@ la12xx_bbdev_probe(struct rte_vdev_device *vdev) if (name == NULL) return -EINVAL; - return la12xx_bbdev_create(vdev); + input_args = rte_vdev_device_args(vdev); + parse_bbdev_la12xx_params(&init_params, input_args); + + return la12xx_bbdev_create(vdev, &init_params); } /* Uninitialise device */ @@ -107,4 +173,6 @@ static struct rte_vdev_driver bbdev_la12xx_pmd_drv = { }; RTE_PMD_REGISTER_VDEV(DRIVER_NAME, bbdev_la12xx_pmd_drv); +RTE_PMD_REGISTER_PARAM_STRING(DRIVER_NAME, + BBDEV_LA12XX_MAX_NB_QUEUES_ARG"="); RTE_PMD_REGISTER_ALIAS(DRIVER_NAME, bbdev_la12xx);