From patchwork Sun Sep 12 12:15:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipun Gupta X-Patchwork-Id: 509487 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp2955141jai; Sun, 12 Sep 2021 05:16:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxB5dXDcLiQhq5uVWn8/+AiqHHyModXDmUONEmCQb46a98MS261wejZ+dsoVJgtT8ZBUvI/ X-Received: by 2002:a17:906:7802:: with SMTP id u2mr7245658ejm.325.1631448969418; Sun, 12 Sep 2021 05:16:09 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id kq12si4631689ejb.759.2021.09.12.05.16.09; Sun, 12 Sep 2021 05:16:09 -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; dkim=fail header.i=@nxp.com header.s=selector2 header.b=Hp3IQCPQ; arc=fail (signature failed); 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 1D1B64111B; Sun, 12 Sep 2021 14:15:48 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60047.outbound.protection.outlook.com [40.107.6.47]) by mails.dpdk.org (Postfix) with ESMTP id 25844410FA for ; Sun, 12 Sep 2021 14:15:45 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KqhNbF9bQrsyUCXYRVCSvPniJY1sM7Tje8nGtOrVz0bUsDMq2HXJTNqcr5v9fdNKamSEat/f6k5HLKHqVfNxLvZYuYgCWq0PlWjaWKrq3JpRs9oOae1PU3xxApDT/ZZ3cWZtQUREFGz/v835+GAaNVsFFqNheDkEKpZiJ3X6EweZFp4yTnazuf7pF/E082F8crCeMMSMEKKP2ZKrndyunlioqYiA028P7tU45t/XhPkgKqFtb8rFLIrEeV4nGWlJ0yXpxCjrt4bJDWiXYTCOcbR9Px1EHFPQ4pdwK7H1XjcmPHs9ciRgCFGzfw5/Af6HpaEprJ3cNXQNq82339iKAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=WnfLokvV8enMVrZHgFFy/6/lSHJ2KfmNGDeNSy2Iz00=; b=J/HslgkldA6Pxril7uDCh31EK6ME1Dn0l0NY/6EzR3VnagtFwL8Uv7QCWvx9EOpYCQiyZ+Po+KS2djwmw81NS/7uTmzpHmbB3PAt36Hz5HfGosgOPuJAUM9iHxv7O7eB30mlitdCWbuUmfcN3JKiWjjiIc+NGfdvjbYAJWGwvneogLF5Vs/SBlTZTa7D+PVRmlir2CnnRg1rZjJXnDEQdJvAR6kHpAn4BxFazs5DJ0wKY6n6eEEnLDEjQ1Z5wSjER23b1rKuSWR9XJNXknd8KAvfpBwnLy6g9kcYJ9PLyH6Y73RfqnLxBiLSY2J2ZGjydDWSzYouZ/d+XLMkdZ1DIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WnfLokvV8enMVrZHgFFy/6/lSHJ2KfmNGDeNSy2Iz00=; b=Hp3IQCPQzEG+/Yk0v7e/XpEoFCt8f1EQH0j+A0jNZikn+g29a3q5F5vB6pPLSfnj5YKtDLav2Pe8MDXZv2q8V8GHY5dO3GrGSsFBdZA2ytvPaTP9B3rQkuXqYMmv4pDumPPcfth63CRMHiY5KizdMCkRHdvzvQSEv878DqP7/GU= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:24e::23) by DB7PR04MB4778.eurprd04.prod.outlook.com (2603:10a6:10:18::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.18; Sun, 12 Sep 2021 12:15:44 +0000 Received: from DB9PR04MB8429.eurprd04.prod.outlook.com ([fe80::dcda:93c2:47e7:19b4]) by DB9PR04MB8429.eurprd04.prod.outlook.com ([fe80::dcda:93c2:47e7:19b4%9]) with mapi id 15.20.4500.018; Sun, 12 Sep 2021 12:15:44 +0000 From: Nipun Gupta To: dev@dpdk.org, gakhil@marvell.com, nicolas.chautru@intel.com Cc: david.marchand@redhat.com, hemant.agrawal@nxp.com Date: Sun, 12 Sep 2021 17:45:05 +0530 Message-Id: <20210912121510.22699-5-nipun.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210912121510.22699-1-nipun.gupta@nxp.com> References: <20210318063421.14895-1-hemant.agrawal@nxp.com> <20210912121510.22699-1-nipun.gupta@nxp.com> X-ClientProxiedBy: SG2PR0601CA0003.apcprd06.prod.outlook.com (2603:1096:3::13) To DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:24e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03274.swis.in-blr01.nxp.com (14.142.151.118) by SG2PR0601CA0003.apcprd06.prod.outlook.com (2603:1096:3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Sun, 12 Sep 2021 12:15:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8fc9bd18-6a35-42a0-3313-08d975e70b95 X-MS-TrafficTypeDiagnostic: DB7PR04MB4778: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rOS+ryjwH97eKbOxnyLenpwyi1/6HOkm1LZtvEXpLKb/VSLqehvot9URd7qQT++2kuh00tQWtCk1fptHW/1ZKo43gigomRLma5HPAO31z5MG5wfiHIanoUQTlSgf8FBkNI9OjdVvQTO0429EMdstJqhk9wSap5EJgDOR0nNnC4zvQb6BuSZ/CyxF36FvhiGts5fcWODHJyNjRq/BKyRCmh4tud5NS2iWBTmRwzs1+s04CUufqZC47WXgWDEMDqiXXj6Wg2aX+Ub/oFcA+bh8rM1QvnCPN4fZ5Lez1h7IYoJ3I8Am8Xhr+AlB2ANoga4a2diBQUmi0hJ+UUks4l2Qz18WY1FzZ369i5h37dPddPfEhokkS/saSiS0QD/H6ZpK3Qxnn86XYFr3KORTk8uvipb6krx2rYNsPZAHsASftyjxl9OW74+TGDk07SB3XlmopDAQBmzSNGucpiCfN1/Dbs8iXb2xukPvOiJ0AEOHLeWq1/bUjz+GTvuhDXLHOb5F4ELpZ7dV4gquV+1ftrA76G8kTb0jqo1/B008NauZhJ9epTEnHHYSp7Iy/u5A6Hi93zgxovN2+XfxUoxxWOH/lxvK7hMUzCXd5gWwWZP7nH1nPoykI96JaZecsfla9vZkmw+y7g5lW0KhxbovBXaTx8pNJUtL24JgtdnULhDQco6y4YQQpMUifvcidiYQV1/KE8BRkspiYHN+M0I8rhkO1d6JX7eHX/CufyHuicfE7Bc= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR04MB8429.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(396003)(366004)(136003)(39860400002)(376002)(66946007)(36756003)(1076003)(66556008)(38350700002)(38100700002)(8676002)(8936002)(186003)(4326008)(956004)(2616005)(52116002)(6486002)(316002)(55236004)(86362001)(5660300002)(44832011)(478600001)(1006002)(6666004)(83380400001)(7696005)(2906002)(26005)(66476007)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zXNp5f467yO6u7/mLU6IyyNmMwDuatQFQPd4Jr6nrDEvVinhgOkY73mS+6UKvakhtIWfs/bEEUcINJMalVYDViTeByD2AAGI4wp03KuGiJjvDev1pKAvUh3pCFTGktxpsI46W9SLN8bB1JU4k7b3u8yyH1X5m84/9LVNKeXWB3WTQNPj5OLlSX6yUCPlB01r7JMW3m8VV+jNiV5FPxQpOeRcnrn9P79jj1HMOXbLAYlk4t8ldHRy4tSyXxFHEwXHtA9NenQA+Cy3rPbAIB+G8Bu9wB+EnGHx+Kl7Mr/NGHoMJBFQIK5uK5lUaUgzXbCHLn4c+Rw7wAha1A6bmPSAP86+6z61b9fZPIkNS1xXGmwYRW40Eec1RM09OoNRMp1pfcpcxUMt3ssahT37rCd3x8DkvR97LQh3FENc8dlQU6ZOuq02pqSN+ZWlcEwYr83lX8WtWBWF+IFXAN2SkN19grUKKzhtP47BDr+kqZDH5FlYT8VckX0BHOvPIVNfM4sMl0a5jtcYVIcE8VmK4tR/4ted91sZYkZQFPvWoAswplt+M0BLb2eb52VB0q2xIaZIOnABRS/jEfDDqYJQpzWYo5JLdgYh9YPBB9XW6fq/tTt5q40O/T5iBIjmEfQOfVtXKjYOCRam8amLQj2ngSujSd9KEOs9n2JRYppSTVdAhGOByBvzIEguKTfH266o7EFBkZIPAhKfMRFsx4d1fF4uYGLbwtzpTOUXoAdCLkoGDPMn+A6FjSwFiAtWZY0z5vSsqSi7FG5uKqdpQoKFt39hHMztdUfvPQq8badg3d+MFRe35cS7CYM7PlK91kJQYTxnzMsglFfQODF4DZEY60sICh7RDgz+AKkePZNfjkfR1rYOjIGZyv81dNYMPnTDGdWnBaLdWkBa+LFUYfCZBYlrrH6QYONxkyrBKVYVmZMKY006KbrHG2KqMnt5Sf24NmGYBRnhcO19dnABfNAST1YeyCi6A5TkrsxyeRvCXe+RA97nJ7TJIXQ7ExgCznFeSuzpT+3DOX3yxMuN9IxuQ2YrxuATNKzPI2/AeZ9ICBoseRzzWAbm41W0X6RVR4Bv6VtxG34942Tvng0VkNYfPYgMmgc7C49WuwNApA8Q/SYJ0wYXVRo0piazY1XCA5WbLwbMev3AR9mqEwHmcEAZ2TMKbZ99JkxcdWptahdBWf+/kBpGGLS/hOQFdVwPce5v1bh0cqKrTCfFnRyyBs7K6Ipp8w5/hMCncN20yUx1PrXfqSQLogW2IEtijnuSERPEkZw8d1d/fCmgt6A5vjqsW04uqgcyCRmjQQIkLDvkG+Rr83uLPNuTD1Ray7yzF/ss+fEL X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8fc9bd18-6a35-42a0-3313-08d975e70b95 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8429.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2021 12:15:44.3127 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wcRObpoA/MlCaHp7gsOpbPXxHMGcz/0ppUEN5o9tIEIgic5vDI/ds6UqgtHBcIfr137BhRPdjJ/yvNjjIwOTig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4778 Subject: [dpdk-dev] [PATCH v5 4/9] baseband/la12xx: add support for multiple modems 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" From: Hemant Agrawal This patch add support for multiple modems by assigning a modem id as dev args in vdev creation. Signed-off-by: Hemant Agrawal --- drivers/baseband/la12xx/bbdev_la12xx.c | 64 +++++++++++++++++++--- drivers/baseband/la12xx/bbdev_la12xx.h | 56 +++++++++++++++++++ drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 +++++++ 3 files changed, 133 insertions(+), 7 deletions(-) create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h -- 2.17.1 diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c index 8886b35429..f26f3f2a08 100644 --- a/drivers/baseband/la12xx/bbdev_la12xx.c +++ b/drivers/baseband/la12xx/bbdev_la12xx.c @@ -14,6 +14,8 @@ #include #include +#include +#include #define DRIVER_NAME baseband_la12xx @@ -22,18 +24,18 @@ 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 */ + int8_t modem_id; /*< LA12xx modem instance id */ }; #define LA12XX_MAX_NB_QUEUES_ARG "max_nb_queues" +#define LA12XX_VDEV_MODEM_ID_ARG "modem" +#define LA12XX_MAX_MODEM 4 static const char * const bbdev_la12xx_valid_params[] = { LA12XX_MAX_NB_QUEUES_ARG, + LA12XX_VDEV_MODEM_ID_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) { @@ -52,6 +54,28 @@ parse_u16_arg(const char *key, const char *value, void *extra_args) return 0; } +/* Parse integer from integer argument */ +static int +parse_integer_arg(const char *key __rte_unused, + const char *value, void *extra_args) +{ + int i; + char *end; + + errno = 0; + + i = strtol(value, &end, 10); + if (*end != 0 || errno != 0 || i < 0 || i > LA12XX_MAX_MODEM) { + rte_bbdev_log(ERR, "Supported Port IDS are 0 to %d", + LA12XX_MAX_MODEM - 1); + return -EINVAL; + } + + *((uint32_t *)extra_args) = i; + + return 0; +} + /* Parse parameters used to create device */ static int parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params, @@ -73,6 +97,16 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params, if (ret < 0) goto exit; + ret = rte_kvargs_process(kvlist, + bbdev_la12xx_valid_params[1], + &parse_integer_arg, + ¶ms->modem_id); + + if (params->modem_id >= LA12XX_MAX_MODEM) { + rte_bbdev_log(ERR, "Invalid modem id, must be < %u", + LA12XX_MAX_MODEM); + goto exit; + } } exit: @@ -84,10 +118,11 @@ parse_bbdev_la12xx_params(struct bbdev_la12xx_params *params, /* Create device */ static int la12xx_bbdev_create(struct rte_vdev_device *vdev, - struct bbdev_la12xx_params *init_params __rte_unused) + struct bbdev_la12xx_params *init_params) { struct rte_bbdev *bbdev; const char *name = rte_vdev_device_name(vdev); + struct bbdev_la12xx_private *priv; PMD_INIT_FUNC_TRACE(); @@ -103,6 +138,20 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev, return -ENOMEM; } + priv = bbdev->data->dev_private; + priv->modem_id = init_params->modem_id; + /* if modem id is not configured */ + if (priv->modem_id == -1) + priv->modem_id = bbdev->data->dev_id; + + /* Reset Global variables */ + priv->num_ldpc_enc_queues = 0; + priv->num_ldpc_dec_queues = 0; + priv->num_valid_queues = 0; + priv->max_nb_queues = init_params->queues_num; + + rte_bbdev_log(INFO, "Setting Up %s: DevId=%d, ModemId=%d", + name, bbdev->data->dev_id, priv->modem_id); bbdev->dev_ops = NULL; bbdev->device = &vdev->device; bbdev->data->socket_id = 0; @@ -122,7 +171,7 @@ static int la12xx_bbdev_probe(struct rte_vdev_device *vdev) { struct bbdev_la12xx_params init_params = { - 8 + 8, -1, }; const char *name; const char *input_args; @@ -174,4 +223,5 @@ 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, - LA12XX_MAX_NB_QUEUES_ARG"="); + LA12XX_MAX_NB_QUEUES_ARG"=" + LA12XX_VDEV_MODEM_ID_ARG "= "); diff --git a/drivers/baseband/la12xx/bbdev_la12xx.h b/drivers/baseband/la12xx/bbdev_la12xx.h new file mode 100644 index 0000000000..5228502331 --- /dev/null +++ b/drivers/baseband/la12xx/bbdev_la12xx.h @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020-2021 NXP + */ + +#ifndef __BBDEV_LA12XX_H__ +#define __BBDEV_LA12XX_H__ + +#define BBDEV_IPC_ENC_OP_TYPE 1 +#define BBDEV_IPC_DEC_OP_TYPE 2 + +#define MAX_LDPC_ENC_FECA_QUEUES 4 +#define MAX_LDPC_DEC_FECA_QUEUES 4 + +#define MAX_CHANNEL_DEPTH 16 +/* private data structure */ +struct bbdev_la12xx_private { + void *ipc_priv; + uint8_t num_valid_queues; + uint8_t max_nb_queues; + uint8_t num_ldpc_enc_queues; + uint8_t num_ldpc_dec_queues; + int8_t modem_id; + struct bbdev_la12xx_q_priv *queues_priv[32]; +}; + +struct hugepage_info { + void *vaddr; + phys_addr_t paddr; + size_t len; +}; + +struct bbdev_la12xx_q_priv { + struct bbdev_la12xx_private *bbdev_priv; + uint32_t q_id; /**< Channel ID */ + uint32_t feca_blk_id; /** FECA block ID for processing */ + uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */ + uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */ + uint16_t queue_size; /**< Queue depth */ + int32_t eventfd; /**< Event FD value */ + enum rte_bbdev_op_type op_type; /**< Operation type */ + uint32_t la12xx_core_id; + /* LA12xx core ID on which this will be scheduled */ + struct rte_mempool *mp; /**< Pool from where buffers would be cut */ + void *bbdev_op[MAX_CHANNEL_DEPTH]; + /**< Stores bbdev op for each index */ + void *msg_ch_vaddr[MAX_CHANNEL_DEPTH]; + /**< Stores msg channel addr for modem->host */ + uint32_t host_pi; /**< Producer_Index for HOST->MODEM */ + uint32_t host_ci; /**< Consumer Index for MODEM->HOST */ + host_ipc_params_t *host_params; /**< Host parameters */ +}; + +#define lower_32_bits(x) ((uint32_t)((uint64_t)x)) +#define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16)) + +#endif diff --git a/drivers/baseband/la12xx/bbdev_la12xx_ipc.h b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h new file mode 100644 index 0000000000..9aa5562981 --- /dev/null +++ b/drivers/baseband/la12xx/bbdev_la12xx_ipc.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020-2021 NXP + */ +#ifndef __BBDEV_LA12XX_IPC_H__ +#define __BBDEV_LA12XX_IPC_H__ + +/** No. of max channel per instance */ +#define IPC_MAX_DEPTH (16) + +/* This shared memory would be on the host side which have copy of some + * of the parameters which are also part of Shared BD ring. Read access + * of these parameters from the host side would not be over PCI. + */ +typedef struct host_ipc_params { + volatile uint32_t pi; + volatile uint32_t ci; + volatile uint32_t modem_ptr[IPC_MAX_DEPTH]; +} __rte_packed host_ipc_params_t; + +#endif