From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DA8E1A0524; Tue, 13 Apr 2021 07:18:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B655A160B23; Tue, 13 Apr 2021 07:18:40 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130049.outbound.protection.outlook.com [40.107.13.49]) by mails.dpdk.org (Postfix) with ESMTP id 4C9BA160B16 for ; Tue, 13 Apr 2021 07:18:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QvErgRBCHjlXIRNKaxeji2nGWKSLPs2che5zhq0DIu0ARpUqqC4UfS6qA0ZwvP7vte+0DW2G3dqPtFMh3lMXUDtpYOAwEoyACGoySaBSfEEIQdLy6+mMvSmDaWB68M6hPHqlMw4qXZZiD7NmeBca8n4byf+lOvtsOng/6UffSsX896QgSV3wGpNYQBK/VrMPsDLSJm65Mz9yArgp2WOMMY5z+ehYtNY4n1bpmeN+7Zu7K3vOTEnO/GudJZZXYIbmLZJTYa2sLsgXBraK+zv8ReQ9SLie+Ip2VUZ7Lh+7u3VxTjziXl9G50UI9M7+jWi6KkUA1063ABDC1LrEq4YQlA== 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:X-MS-Exchange-SenderADCheck; bh=dbYw14cQRWFEsfZVHRX52rVIxpjSmZTBgkXd0VDFQY8=; b=HentZR3kOfG/WOLVIaoTmATDqRFDR+6nv1HDXRzIf1a22jTBkYgjfo8qbT3kTa4BtklMfn8fUnXcpW1WlfSlwNwUYkhmTavtVmNMJBTBK7vCm/RaEVCL5qoM2SDk20QgK5Bm3gMe8uNQ3NCH/JRBEYeWI2jbw7tUsG8mJk/LjNYRiyFcmgGM5FQfzQogiknFyBOPuhbQ8y8duCfK2KuEnY4Umo678PfoA4lOaKsu1q5flCzc35FZGBQ1yrWkYN/6sc9QyiqrynI81ysnc33lgrXUthkbkxnsyfUFSZzEve7+kL1/LqzJKVXNWdKnmQ4v35cCUUPKm0iyHT6DXN1rGQ== 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=dbYw14cQRWFEsfZVHRX52rVIxpjSmZTBgkXd0VDFQY8=; b=ri+7PsPKw/mgu33Dc6oIqBDQaVkAlxXzUwCof+mVnxAemmaDvjdVnCwGQFWFnskcQ1ebkDCmOhrzoCIEls+scdy95golOs6+Txvu5IiaWc0PqCSGIU3UOeswAi6nKG7V4ub4ihPSeCaij16nYF9wmzmnasf1oVUA1ugVgcqbfkE= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4456.eurprd04.prod.outlook.com (2603:10a6:20b:22::25) by AM5PR04MB3250.eurprd04.prod.outlook.com (2603:10a6:206:b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Tue, 13 Apr 2021 05:18:38 +0000 Received: from AM6PR04MB4456.eurprd04.prod.outlook.com ([fe80::ad9e:a38e:e84e:bf55]) by AM6PR04MB4456.eurprd04.prod.outlook.com ([fe80::ad9e:a38e:e84e:bf55%7]) with mapi id 15.20.4020.022; Tue, 13 Apr 2021 05:18:38 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com, nicolas.chautru@intel.com Cc: david.marchand@redhat.com, Hemant Agrawal Date: Tue, 13 Apr 2021 10:47:10 +0530 Message-Id: <20210413051715.26430-4-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210413051715.26430-1-hemant.agrawal@nxp.com> References: <20210410170252.4587-1-hemant.agrawal@nxp.com> <20210413051715.26430-1-hemant.agrawal@nxp.com> Content-Type: text/plain X-Originating-IP: [92.120.0.67] X-ClientProxiedBy: HK2PR03CA0059.apcprd03.prod.outlook.com (2603:1096:202:17::29) To AM6PR04MB4456.eurprd04.prod.outlook.com (2603:10a6:20b:22::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by HK2PR03CA0059.apcprd03.prod.outlook.com (2603:1096:202:17::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.6 via Frontend Transport; Tue, 13 Apr 2021 05:18:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 95c5d548-9099-410d-e1df-08d8fe3b9813 X-MS-TrafficTypeDiagnostic: AM5PR04MB3250: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QRHYuJ/XbABx1TkJPZIIjBNOJ+yfgxnYczeeysyubhnP1qvWL1kZef5Kns6VnRmxqE2x1FacM9bPkVbIaes5cx9P0M/RwMgZCvp1qxvp+zTuf7yk7MpOgThO9a+DItTjFr/r9ehtJZACcVG0M3IE+u3XwGkMenog8ZOrqNugR/k5QLqTuPwJ/1CuXX+k+RLd6Wj5MAZFyOH+nR40hO9OqMnaagRFy45qgPNjLgR/Am6aXRE/Ko2N01MH6LH8nADZ2Slcu4OhxSQpIa1CRSGsG9XNJguArv7xy+/IOXDM1d5aKxeZiMeag2LkU5Qndfzjb1/CuJz8h8ERqrXxoes8VyUJThloB08J/2GhZPjePj+18eW5ciGKoZ0x98ubOtQ0jHK7y6Sc4GycZY53ujl7sSu9Hu+BphpLUZef6+qvPpVVkFq8qg3wAKwwRodAyefbspaDvn/7/XrAorQ7VhucMx8H1SUZW3gUM5fxc13FsfoyqebfupwQaSRZFCsUY/zn9A2w7egfiEMSgpwJc9FkY9z4wqx+iantYMnQ4tw+CUTOChtcxKBRMFhXdwX4Mek1QJWwsRtg8QSsz3tMb/bdOpvydObwIIgxRED9FOolyFOEfG5fZ0yyqrB/XaeOc2Mz+2ZKnTVYO6DUI4AYhMLuHy8uEs1n/1vI7gzWRyIjXGk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4456.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(396003)(39860400002)(366004)(136003)(376002)(83380400001)(16526019)(186003)(26005)(38350700002)(38100700002)(316002)(66556008)(66946007)(66476007)(6512007)(2616005)(956004)(478600001)(4326008)(44832011)(36756003)(6486002)(6506007)(5660300002)(2906002)(52116002)(1076003)(86362001)(8936002)(6666004)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?rfTaKG9dlAzh54hnUnavcrqwedy0+Pwr03uvbpGywQLoRRKkXx6d1g71H1a0?= =?us-ascii?Q?aHDN/+mSYqkxn1hgPOndPAo97uvcjXI63jwQr5gj16VOzhHWoZWwTrusiW4u?= =?us-ascii?Q?nPmoYQ7cg4P+yAy9lEpc2FoCwBULTQPdPXpmjB3SKGsWUsH+UxygkjXl4i0N?= =?us-ascii?Q?PGPmWujmpCiP9Hl4+iNExAXhFbFMyYfzT/cq/EvjXzfOEaK1A3rJhsFBV2WS?= =?us-ascii?Q?DwM2fMIYp4dUEDGKizEwoXlWTbBJPwHBErDOzCa5hDfzrfmwxYJfcCZjGL8/?= =?us-ascii?Q?Y1HzUtfMY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4W6O5pVHBRjcTeg76z?= =?us-ascii?Q?w+5k437kQ3cVb0+QaX2XEpNkobY+2NXYX2M4rsJzkNttBXmj7YctwGky3Ade?= =?us-ascii?Q?pNt/cenBJ1Pj6uCFM6ubTCvAGoEZvKiV6zPnC+bb32EXPcFa44flMrCCG0Qt?= =?us-ascii?Q?7NxKrAzK55S9hSCn+1Ls4QUK?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95c5d548-9099-410d-e1df-08d8fe3b9813 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4456.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 05:18:38.3079 (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: cM2p+bxbfkJQd1RlfFJo/ZkRsuOtAOsQQrlzlRfMZpiAnKqsCLkOxjDoBmLnjjXa3PylskA+86cPEc5AS0cAZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR04MB3250 Subject: [dpdk-dev] [PATCH v3 3/8] 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" 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 | 60 ++++++++++++++++++++-- drivers/baseband/la12xx/bbdev_la12xx.h | 56 ++++++++++++++++++++ drivers/baseband/la12xx/bbdev_la12xx_ipc.h | 20 ++++++++ 3 files changed, 131 insertions(+), 5 deletions(-) create mode 100644 drivers/baseband/la12xx/bbdev_la12xx.h create mode 100644 drivers/baseband/la12xx/bbdev_la12xx_ipc.h diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c index 8d3041ce28..7e9be74bb4 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 BBDEV_LA12XX_MAX_NB_QUEUES_ARG "max_nb_queues" +#define BBDEV_LA12XX_VDEV_MODEM_ID_ARG "modem" +#define LA12XX_MAX_MODEM 4 static const char * const bbdev_la12xx_valid_params[] = { BBDEV_LA12XX_MAX_NB_QUEUES_ARG, + BBDEV_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) { + BBDEV_LA12XX_PMD_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) { + BBDEV_LA12XX_PMD_ERR("Invalid modem id, must be < %u", + LA12XX_MAX_MODEM); + goto exit; + } } exit: @@ -88,6 +122,7 @@ la12xx_bbdev_create(struct rte_vdev_device *vdev, { 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; + + BBDEV_LA12XX_PMD_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; @@ -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, - BBDEV_LA12XX_MAX_NB_QUEUES_ARG"="); + BBDEV_LA12XX_MAX_NB_QUEUES_ARG"=" + BBDEV_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 -- 2.17.1