From patchwork Mon Jul 22 11:58:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142610 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DD9C745681; Mon, 22 Jul 2024 14:03:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E04E40DDD; Mon, 22 Jul 2024 14:00:34 +0200 (CEST) Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011066.outbound.protection.outlook.com [52.101.70.66]) by mails.dpdk.org (Postfix) with ESMTP id 9A84F402B7 for ; Mon, 22 Jul 2024 14:00:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S0CzEmZXi0tnDY6df0fmMLuGo3NmHUIAO5vmIZe6J5uBYwzYbFsTGO9hJNris8WZZDumJeK7Uz9KGbKdNutnZHVq3n7AgMzgQF+BRbrMyfUXTvtTm+um55dDzjI8diuPuSZyzyfGT1I/nnZf7uJGfEUOiIF2/vHMn6vw3nKmeUzaOE5Z2H3WkLds3rVcv6PvBPNZJ2X0MILW2N08+YziP9RijKR+6RZ7IsmHHlj8hHmFAIA1ZdCfGNdTuwVzBxm9OnkEZfXOi2HJwCAmrG1GAd1n2INZ6YKwHWgfx0euJX7CPMlYJ4tS2wr4DLfVCPZck2unQozkryl5xTXDJw4MzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hXnZiJaBAEiCBH8yHQp25Q6z6Y4zzznlqx/1ThPyJ60=; b=YwIXtS2ySwmF5iLaOtMFuZrmBPRWn0aDnjrtlJkC/W84GY3HFiqUxXNQvVEyW3a42TCf2MBJ3RJu2/GJEWVP4t5jIhRirBVhSt0YTqeXpXiDx27lzjVmP8Rr7MT3FulPkRnEutcj2ZwxrIpDc02yBGlELaaTb9yYniGVuWtahVY1yF7Gyhvp56YMyk0ArTZqi00PIi47FwfCeHfkiV9iHeiDme9c7JIPt1jNyoeFr8C9I8X12TYeBNHa/KlY4KoyrBIeA+Y71ccqgLiy70wa45bIGPxI1RUhhaMRnVTmU1If0CHHEAIFepRpGwNOYPzewXU8mEiM9jYWfsso3s+TBQ== 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=hXnZiJaBAEiCBH8yHQp25Q6z6Y4zzznlqx/1ThPyJ60=; b=pb7r/+iMAKHMWGPLMePeKsGcI1ku3WyZPQE737qK8d/HwrLo+P2a16grnuV+4JtM2LOT2/dVJpdNcM3SkM0I+4pjfIflKpniPBNYDIqoKbyumwgY4t/uu8j4fGxVTVo4KVgB+017u3w2vi11pf3wVjpcFOeIJeJTCM0vJeeDeHU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by DUZPR04MB9919.eurprd04.prod.outlook.com (2603:10a6:10:4d9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.14; Mon, 22 Jul 2024 11:59:01 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:00 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Jun Yang Subject: [v2 01/30] dma/dpaa2: configure route by port by PCIe port param Date: Mon, 22 Jul 2024 17:28:14 +0530 Message-Id: <20240722115843.1830105-2-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9919:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f8839f5-0716-41a0-628f-08dcaa45ac94 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: NQiu4uXjpTOlAg7ccQmBwyJE8DEK0ts2oue6kEGIXo2WpLsePluHFm+7jsNxdCJUOeQ7Vmn44Hple+I/zmpzw1IPsLkAteHmPNEpsIer3+0ChxK2v7tt4nOg4sA4HjJd0TtaN+/ddvnaFW1nEmQ49RVXXfFfrmN2HbKeL6EgG+N9nU9b0mgA+bZs2ylnzH7KSB2hhx0o4XY5yfFbyEU4oMoTG+eMzPsQ6UGaC6L+lzUdFSjII1spjwEONJyUZOY7DlIsiz7k0Bjs3L/j0TMI83x8RXk7fhOXOM+zy9BIGryol2aoScPhcDz9l7STVTePBZw6jk2yk/LbSA4+QjUTwkId6QlbbUftA7S06LdFLRxGOwVhmIwTZU0FrysCFWm+/GfJXnjzXlaXo7FoLxULyjDKmazt1otA4ziBm8JefFJyBh4/1VGhe25Y3Nrekf4uNa7S+MiwpBnTqFj1/E7oRcXq//+ZERAooqWM0sLBjaeSFjch0hdkb1xt22NtUoyEhz8UN+twGpTHJUvzaCBBr1D8QvsQzECPGdGqqkYwmOz5xChwjvLC7WWf+fuwfINzyVJ24FD3lnGGv1s7ocL3pA8spxKvBAnnXvan4jg03+9xliviqfttYQGvVURNXn7Lik5up6iP7vY8e6ygWdvpKjVWxD4+tV9tJ/0Er/64g0fIJSk+511+hvr/P8N/KTcGc/79nYC5P7wQTxtglHJyW5iDNKqgi2mbVmV1Z2VCarm3a54taU8UBGF2/Ss+9a+7R9sJx3tI4CWh7gXMSOX2O5v6/cQoT+gv7hmnE9o4+mGGV5kPZLKvjCOViVnee6qflqNKlXQQKrtqAtQLi4QNQnA2sJeBmbDA6MQ9wc23fUYGZH8+kEvLFC5XD2gAWCkFRi9WL03TCObIpkk1EpOfVlyIso1lqIxdTuHKuOy6gMVifeWd78HvKW158JB7HD0n9fqnmPCM4OKDEhULOGXIGpC7K1mciAIZ5S3WSpAvbM8gxvm65IDjHrKje+mD44lSrKSS9K6ECPtEHc8I34hiiZnwFQJj22qCLEzTJb70Nfy5jv7l3UimI3CZ7hoetyWlPb7xORu64qz/akRSfsOrVUB8bDq3sxGZb/Anon8iQMDYt6wEMKkD3fVrQF626SKuOR20Igj43ARLd8NsuhvZbYzaYW8UJEPYOIVf73XO3srXvABhzNoyNn6Q+pBEWeXpFf18iqAlvNFGhtiO7XTrUMcF8DRRYX6iO/35iwChwjSjUKoAK7bZK/lgs/UGEbGTVSUVQ9Q5PBUCIUaCE/NgROD6K5e/ToEkNabXHf0pgcB/pbsoH/bpyCLaph/Ajxmw1UQc5jp1l5CDXODzFr5Yxhb15svDwI6oOgF2YOJVEjVRUmezAq0yjjtkiGZ0hwlNYZkcXcZrnE2AEuLLeiCUKQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5dk+wXpug9m7tYxeZ9jpokiKAPc6yLZC/BVVlI2Yrw+KBXOCtW+tfTJkYIBx2hA7rTbd1dg9luFVZFoMVCWpASpcPPEN8qlPO6rvpYaVf1voV3YuLJwMnWiXKJvY6+YrZ8hNrw+IijyNVMrVy+1itSj7/jGrWKfXojYJV8vz9C5HIDOoEsq6H3UUHk5zzuhO3khjBklUF0vVKBwqqiwdRzx4OcFp/Yggltnwcpim8NTBQ/MWaUDJHkk5PR/4yLw6dR9AFVEFRbGidT8ifmnSu5Zrj+MgxqP4Dl4VdOW2EgfQByTonaznRsOk3DCayfKkP1qMOUWzHQ8l1dEfHC68ACNNHyo/TJGVXSnaxfuI4wPnhfPj8SsqgmSMrzji7WwapFEe4yBHi6iUFcruW6YURAn6AeXxZTeuARPZtQGL7VjRPH0aIhGhAFR9obxY/hU4lUtZkVXcvczn8IvgjyzRsfPwrbrKxwHUeOCL92jC7/oEVt4n0rmMSWcSWmTI7XG++hKCgffe9MQDKQoGrR0u7ok7N+iQIviEIwCDmAN5oAa+jnE6wdO4DMfX2yfbQxuoStYaH0fwXMIjaTLQjzOCujz0WGyOS55OkpNGNKvGLVnRs7U4bZ+yWkWIj3zVGgBwzsbbDdwf7DSqSiOszJgiy7sMCdb3UC3geGcqP0gcJShmZtefVKKWaogC98nfVjKmib2gD58LeUBsujmCETXc42gE9LPF4nKElk/g+p805pRAxduwpFvWe2TQbN2VlqWVDOnAZmv8iVs7+Svzh0XaZnHGA9I2d+whR4W7nO9yzoo0QQMIooNCR+hRk3BI/LFVySJ7TixUgsgJf9rz+S1+AsLKKjASz9PIselEs+0pJyipKZ+2T/PzKKuDg2etNst+ccOj15twJIqPbJxRGLqUmbqw5SnQWyJtbIxsx8RPNAoGXJrIR+LPXkYeO2MIkA+ZwnEIJKIVsL7mYe9yzBE7u5HJt08JLCJOgZIzkRt07wf0cXdn59FKj3ioZTxo72DSNKFA5S7SUzzWAjf9D1biAhe56CrDx2Fsge+RDWO6k5IS3dLJNAxlC1s2jkfrk9L4WzlR6mdkuKDr9yQkYrsI2zSZBxqELJiiQlqBb3IqE2/ld13rn+71P1AaAWmH05tfCAOLf1RmYxhSU2dkxMyXCnk80mjSFAwAF0BR46WkWSM6BEuI5mdEYD58/Xag7GemoLjKbeRI4M3GLQdV0sP31JhpJBBa0zjFt99DCvewimWk0hjBg1l0LQiPA2Fjyj41K8GEfJsSoG0MfOA400BfPTHG5LtX9QloOSe76AX1JCZnrZRyrnZfcgV+3+KOIbDBuz6UY/BGv++erp8UPiZV/GJ152e2n9XA8ZzorcHLdoKwTKgAb2bb0cAT39Be8+1M09fIVgRTRq8IdGQGo215rmgyJyHyx9cqtHoHnACuPEvVjxg1EKCNz+FXfDGEFDXg70OEag9RP/hAkr17Tod21oSDnltXB3BlRChJ7tKY6rP80fzaeTt0prFCEJwvERUqPGNMu7WaeKAIoF0p0/WIw+xGni4KFWboVS6Ke8Qdd/c= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f8839f5-0716-41a0-628f-08dcaa45ac94 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:00.9338 (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: 0PD1/mZnr8oIFGxs916AZNhm2MeB4jlzftDK0NywM2hoPPCCCUW2sYmpvdkYRPRS X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9919 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 From: Jun Yang struct { uint64_t coreid : 4; /**--rbp.sportid / rbp.dportid*/ uint64_t pfid : 8; /**--rbp.spfid / rbp.dpfid*/ uint64_t vfen : 1; /**--rbp.svfa / rbp.dvfa*/ uint64_t vfid : 16; /**--rbp.svfid / rbp.dvfid*/ ..... } pcie; Signed-off-by: Jun Yang --- .../bus/fslmc/qbman/include/fsl_qbman_base.h | 29 ++++++--- drivers/dma/dpaa2/dpaa2_qdma.c | 59 +++++++++++++------ drivers/dma/dpaa2/dpaa2_qdma.h | 38 +++++++++++- drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h | 55 +---------------- drivers/dma/dpaa2/version.map | 1 - 5 files changed, 100 insertions(+), 82 deletions(-) diff --git a/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h b/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h index 48ffb1b46e..7528b610e1 100644 --- a/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h +++ b/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (C) 2014 Freescale Semiconductor, Inc. - * Copyright 2017-2019 NXP + * Copyright 2017-2024 NXP * */ #ifndef _FSL_QBMAN_BASE_H @@ -141,12 +141,23 @@ struct qbman_fd { uint32_t saddr_hi; uint32_t len_sl:18; - uint32_t rsv1:14; - + uint32_t rsv13:2; + uint32_t svfid:6; + uint32_t rsv12:2; + uint32_t spfid:2; + uint32_t rsv1:2; uint32_t sportid:4; - uint32_t rsv2:22; + uint32_t rsv2:1; + uint32_t sca:1; + uint32_t sat:2; + uint32_t sattr:3; + uint32_t svfa:1; + uint32_t stc:3; uint32_t bmt:1; - uint32_t rsv3:1; + uint32_t dvfid:6; + uint32_t rsv3:2; + uint32_t dpfid:2; + uint32_t rsv31:2; uint32_t fmt:2; uint32_t sl:1; uint32_t rsv4:1; @@ -154,12 +165,14 @@ struct qbman_fd { uint32_t acc_err:4; uint32_t rsv5:4; uint32_t ser:1; - uint32_t rsv6:3; + uint32_t rsv6:2; + uint32_t wns:1; uint32_t wrttype:4; uint32_t dqos:3; uint32_t drbp:1; uint32_t dlwc:2; - uint32_t rsv7:2; + uint32_t rsv7:1; + uint32_t rns:1; uint32_t rdttype:4; uint32_t sqos:3; uint32_t srbp:1; @@ -182,7 +195,7 @@ struct qbman_fd { uint32_t saddr_lo; uint32_t saddr_hi:17; - uint32_t rsv1:15; + uint32_t rsv1_att:15; uint32_t len; diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c index 2c91ceec13..5954b552b5 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.c +++ b/drivers/dma/dpaa2/dpaa2_qdma.c @@ -22,7 +22,7 @@ uint32_t dpaa2_coherent_alloc_cache; static inline int qdma_populate_fd_pci(phys_addr_t src, phys_addr_t dest, uint32_t len, struct qbman_fd *fd, - struct rte_dpaa2_qdma_rbp *rbp, int ser) + struct dpaa2_qdma_rbp *rbp, int ser) { fd->simple_pci.saddr_lo = lower_32_bits((uint64_t) (src)); fd->simple_pci.saddr_hi = upper_32_bits((uint64_t) (src)); @@ -93,7 +93,7 @@ qdma_populate_fd_ddr(phys_addr_t src, phys_addr_t dest, static void dpaa2_qdma_populate_fle(struct qbman_fle *fle, uint64_t fle_iova, - struct rte_dpaa2_qdma_rbp *rbp, + struct dpaa2_qdma_rbp *rbp, uint64_t src, uint64_t dest, size_t len, uint32_t flags, uint32_t fmt) { @@ -114,7 +114,6 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle, /* source */ sdd->read_cmd.portid = rbp->sportid; sdd->rbpcmd_simple.pfid = rbp->spfid; - sdd->rbpcmd_simple.vfa = rbp->vfa; sdd->rbpcmd_simple.vfid = rbp->svfid; if (rbp->srbp) { @@ -127,7 +126,6 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle, /* destination */ sdd->write_cmd.portid = rbp->dportid; sdd->rbpcmd_simple.pfid = rbp->dpfid; - sdd->rbpcmd_simple.vfa = rbp->vfa; sdd->rbpcmd_simple.vfid = rbp->dvfid; if (rbp->drbp) { @@ -178,7 +176,7 @@ dpdmai_dev_set_fd_us(struct qdma_virt_queue *qdma_vq, struct rte_dpaa2_qdma_job **job, uint16_t nb_jobs) { - struct rte_dpaa2_qdma_rbp *rbp = &qdma_vq->rbp; + struct dpaa2_qdma_rbp *rbp = &qdma_vq->rbp; struct rte_dpaa2_qdma_job **ppjob; size_t iova; int ret = 0, loop; @@ -276,7 +274,7 @@ dpdmai_dev_set_multi_fd_lf_no_rsp(struct qdma_virt_queue *qdma_vq, struct rte_dpaa2_qdma_job **job, uint16_t nb_jobs) { - struct rte_dpaa2_qdma_rbp *rbp = &qdma_vq->rbp; + struct dpaa2_qdma_rbp *rbp = &qdma_vq->rbp; struct rte_dpaa2_qdma_job **ppjob; uint16_t i; void *elem; @@ -322,7 +320,7 @@ dpdmai_dev_set_multi_fd_lf(struct qdma_virt_queue *qdma_vq, struct rte_dpaa2_qdma_job **job, uint16_t nb_jobs) { - struct rte_dpaa2_qdma_rbp *rbp = &qdma_vq->rbp; + struct dpaa2_qdma_rbp *rbp = &qdma_vq->rbp; struct rte_dpaa2_qdma_job **ppjob; uint16_t i; int ret; @@ -375,7 +373,7 @@ dpdmai_dev_set_sg_fd_lf(struct qdma_virt_queue *qdma_vq, struct rte_dpaa2_qdma_job **job, uint16_t nb_jobs) { - struct rte_dpaa2_qdma_rbp *rbp = &qdma_vq->rbp; + struct dpaa2_qdma_rbp *rbp = &qdma_vq->rbp; struct rte_dpaa2_qdma_job **ppjob; void *elem; struct qbman_fle *fle; @@ -1223,17 +1221,38 @@ rte_dpaa2_qdma_vchan_internal_sg_enable(int16_t dev_id, uint16_t vchan) qdma_dev->vqs[vchan].flags |= DPAA2_QDMA_VQ_FD_SG_FORMAT; } -/* Enable RBP */ -void -rte_dpaa2_qdma_vchan_rbp_enable(int16_t dev_id, uint16_t vchan, - struct rte_dpaa2_qdma_rbp *rbp_config) +static int +dpaa2_qdma_vchan_rbp_set(struct qdma_virt_queue *vq, + const struct rte_dma_vchan_conf *conf) { - struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id]; - struct dpaa2_dpdmai_dev *dpdmai_dev = obj->dev_private; - struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; + if (conf->direction == RTE_DMA_DIR_MEM_TO_DEV || + conf->direction == RTE_DMA_DIR_DEV_TO_DEV) { + if (conf->dst_port.port_type != RTE_DMA_PORT_PCIE) + return -EINVAL; + vq->rbp.enable = 1; + vq->rbp.dportid = conf->dst_port.pcie.coreid; + vq->rbp.dpfid = conf->dst_port.pcie.pfid; + if (conf->dst_port.pcie.vfen) { + vq->rbp.dvfa = 1; + vq->rbp.dvfid = conf->dst_port.pcie.vfid; + } + vq->rbp.drbp = 1; + } + if (conf->direction == RTE_DMA_DIR_DEV_TO_MEM || + conf->direction == RTE_DMA_DIR_DEV_TO_DEV) { + if (conf->src_port.port_type != RTE_DMA_PORT_PCIE) + return -EINVAL; + vq->rbp.enable = 1; + vq->rbp.sportid = conf->src_port.pcie.coreid; + vq->rbp.spfid = conf->src_port.pcie.pfid; + if (conf->src_port.pcie.vfen) { + vq->rbp.svfa = 1; + vq->rbp.dvfid = conf->src_port.pcie.vfid; + } + vq->rbp.srbp = 1; + } - memcpy(&qdma_dev->vqs[vchan].rbp, rbp_config, - sizeof(struct rte_dpaa2_qdma_rbp)); + return 0; } static int @@ -1247,12 +1266,16 @@ dpaa2_qdma_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan, char ring_name[32]; char pool_name[64]; int fd_long_format = 1; - int sg_enable = 0; + int sg_enable = 0, ret; DPAA2_QDMA_FUNC_TRACE(); RTE_SET_USED(conf_sz); + ret = dpaa2_qdma_vchan_rbp_set(&qdma_dev->vqs[vchan], conf); + if (ret) + return ret; + if (qdma_dev->vqs[vchan].flags & DPAA2_QDMA_VQ_FD_SG_FORMAT) sg_enable = 1; diff --git a/drivers/dma/dpaa2/dpaa2_qdma.h b/drivers/dma/dpaa2/dpaa2_qdma.h index 5941b5a5d3..811906fcbc 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.h +++ b/drivers/dma/dpaa2/dpaa2_qdma.h @@ -166,6 +166,42 @@ struct qdma_sg_entry { }; } __rte_packed; +struct dpaa2_qdma_rbp { + uint32_t use_ultrashort:1; + uint32_t enable:1; + /** + * dportid: + * 0000 PCI-Express 1 + * 0001 PCI-Express 2 + * 0010 PCI-Express 3 + * 0011 PCI-Express 4 + * 0100 PCI-Express 5 + * 0101 PCI-Express 6 + */ + uint32_t dportid:4; + uint32_t dpfid:2; + uint32_t dvfid:6; + uint32_t dvfa:1; + /*using route by port for destination */ + uint32_t drbp:1; + /** + * sportid: + * 0000 PCI-Express 1 + * 0001 PCI-Express 2 + * 0010 PCI-Express 3 + * 0011 PCI-Express 4 + * 0100 PCI-Express 5 + * 0101 PCI-Express 6 + */ + uint32_t sportid:4; + uint32_t spfid:2; + uint32_t svfid:6; + uint32_t svfa:1; + /* using route by port for source */ + uint32_t srbp:1; + uint32_t rsv:2; +}; + /** Represents a DPDMAI device */ struct dpaa2_dpdmai_dev { /** Pointer to Next device instance */ @@ -216,7 +252,7 @@ struct qdma_virt_queue { /** FLE pool for the queue */ struct rte_mempool *fle_pool; /** Route by port */ - struct rte_dpaa2_qdma_rbp rbp; + struct dpaa2_qdma_rbp rbp; /** States if this vq is in use or not */ uint8_t in_use; /** States if this vq has exclusively associated hw queue */ diff --git a/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h b/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h index 5a8da46d12..b0bf9d8bcc 100644 --- a/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h +++ b/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h @@ -13,42 +13,6 @@ /** States if the destination addresses is physical. */ #define RTE_DPAA2_QDMA_JOB_DEST_PHY (1ULL << 31) -struct rte_dpaa2_qdma_rbp { - uint32_t use_ultrashort:1; - uint32_t enable:1; - /** - * dportid: - * 0000 PCI-Express 1 - * 0001 PCI-Express 2 - * 0010 PCI-Express 3 - * 0011 PCI-Express 4 - * 0100 PCI-Express 5 - * 0101 PCI-Express 6 - */ - uint32_t dportid:4; - uint32_t dpfid:2; - uint32_t dvfid:6; - /*using route by port for destination */ - uint32_t drbp:1; - /** - * sportid: - * 0000 PCI-Express 1 - * 0001 PCI-Express 2 - * 0010 PCI-Express 3 - * 0011 PCI-Express 4 - * 0100 PCI-Express 5 - * 0101 PCI-Express 6 - */ - uint32_t sportid:4; - uint32_t spfid:2; - uint32_t svfid:6; - /* using route by port for source */ - uint32_t srbp:1; - /* Virtual Function Active */ - uint32_t vfa:1; - uint32_t rsv:3; -}; - /** Determines a QDMA job */ struct rte_dpaa2_qdma_job { /** Source Address from where DMA is (to be) performed */ @@ -67,6 +31,7 @@ struct rte_dpaa2_qdma_job { */ uint16_t status; uint16_t vq_id; + uint64_t cnxt; /** * FLE pool element maintained by user, in case no qDMA response. * Note: the address must be allocated from DPDK memory pool. @@ -104,24 +69,6 @@ void rte_dpaa2_qdma_vchan_fd_us_enable(int16_t dev_id, uint16_t vchan); __rte_experimental void rte_dpaa2_qdma_vchan_internal_sg_enable(int16_t dev_id, uint16_t vchan); -/** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice. - * - * Enable Route-by-port on a channel. This API should be - * called before calling 'rte_dma_vchan_setup()' API. - * - * @param dev_id - * The identifier of the device. - * @param vchan - * The identifier of virtual DMA channel. - * @param rbp_config - * Configuration for route-by-port - */ -__rte_experimental -void rte_dpaa2_qdma_vchan_rbp_enable(int16_t dev_id, uint16_t vchan, - struct rte_dpaa2_qdma_rbp *rbp_config); - /** * @warning * @b EXPERIMENTAL: this API may change without prior notice. diff --git a/drivers/dma/dpaa2/version.map b/drivers/dma/dpaa2/version.map index 713ed41f0c..eb012cfbfc 100644 --- a/drivers/dma/dpaa2/version.map +++ b/drivers/dma/dpaa2/version.map @@ -10,5 +10,4 @@ EXPERIMENTAL { rte_dpaa2_qdma_copy_multi; rte_dpaa2_qdma_vchan_fd_us_enable; rte_dpaa2_qdma_vchan_internal_sg_enable; - rte_dpaa2_qdma_vchan_rbp_enable; }; From patchwork Mon Jul 22 11:58:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142605 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4FC1345681; Mon, 22 Jul 2024 14:02:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 779EB40650; Mon, 22 Jul 2024 14:00:25 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013057.outbound.protection.outlook.com [52.101.67.57]) by mails.dpdk.org (Postfix) with ESMTP id E51384029F for ; Mon, 22 Jul 2024 14:00:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uNfbydGb++6TmjK5DN4I27NYMg4kIO1nscO36opPXW8H195sP5gkLYUexCOCeRPt+tYqYC6UnAE1HP0FeiKiPaIS1G+JZJCfviY5N6+sNHjPHa/nzN53ayXkU/89FtuRiTdncEIUumSmwnfvFTHeOU2wtLrmlTCESEO2Tf1MXUqrv3qb7NbZarxu0D5QDd+Na9wo9xIaadVqnYJVU3IIIqRT3YeGghceLq6LqBSmiHB13Of/eNSOExqTkDUe50EnFDGbz3BBhuyNCu12B4vbWCZ6W0AYDteTK/u3ydgOdto3xv+RG+42FPfYvn6TDdfKiMmjVB7TjQcyG9xF0h23gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4/HxFqyRZ0b3q1XoIOZ+mktAUQUc4l0FXD3rTmgn6pg=; b=k39x8zEHFjhyy1l8YhclFeRmuuSFdxYbh9J3RxRbgLQtg+dw+5JA+i3erFzaprXjAtl+ssF6wmfmwC9go82FlB6Au1QiYYtR5G8HqDfPWQYSqSmfQGHcFRkwqtgytYe4VGu1GxV38lI1J+3+zX6pCOdFb7b0b4MmrqVI5OeZ9fHFjQIDw+e0zGgETQSZaXawY3Tx61fO7RQgbCKw0LkWh8AK+9pM24smJh2LoGK384fRjp6Aw6HOSiav4OsnuncVbxnU5hm2slFXU4yXTBQ8ApO680oaPIQnXDKSORuBw0qP6Yd5Nq9ou07e6NmzoRVS3aPfAjayOCndtMfDjHRYEA== 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=4/HxFqyRZ0b3q1XoIOZ+mktAUQUc4l0FXD3rTmgn6pg=; b=QXY1AL0UUonXUumCkiEzA2AMtTK0XgvurrQpPJZSOV+I8ujqwksU4KCvgYy3jkzSOjOaK+ncSF+BObJE7IcAPomTU5MtDapipucJLdG7LetU2nLL4K+kSw7Wj70NQA6gKehOq2uhGGiDX9K/2WlC3/9jIA3dtLVqVD6UM+e0V+w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by DUZPR04MB9919.eurprd04.prod.outlook.com (2603:10a6:10:4d9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.14; Mon, 22 Jul 2024 11:59:04 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:03 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [v2 02/30] dma/dpaa2: support multiple HW queues Date: Mon, 22 Jul 2024 17:28:15 +0530 Message-Id: <20240722115843.1830105-3-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9919:EE_ X-MS-Office365-Filtering-Correlation-Id: 3fbfcc03-68e1-4b9c-8111-08dcaa45ade0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: jm662oel9+5s049yeFcZygy+W2KJW6XMhbeCWzCkvmlejB1hNGCQKc+QhvOdfEQ88fSKUg2YAiCx+NMieqT+JvDq8nu6UKPLFX7jW66m7X67wHti0qHJswHbumoXnIMPszSIFDnRjcOJv3xoPYSuPLyKASQ70KbPxKabc8J0aYa6n7G89+yg/AZFq3JMx71ct9WGDAs+NDb/z3XSiNN9iJBNO6ilvy9XOkG1e3T8pKcCstIiKCdn3to6Q/Ivk3Nj50iC9uy0SaIKd3tJ4Rtq2+eX88u6tZfOpcPh3atN2/zwrRcfK3DoLM03YcAhBeLVuJvdaSqPEAdNO9Wlo3KOri8L2xD+ztn515aR8rApAgND0KLhek6eUk8n4SxibZp1OXf+JF02zJ32bmROJZWLHflLAX68tyW2zU2RdoLIrQfFLZlQVYVzLn1/9XamnE7HR7Ik6j0OERx6HgtN8wWRfK77/ym7RlS/9rqKw5vl9flKql/KvbTg8w8R8Z8nTmQRXmr/f5aHmd79NiCVpY3+1WM+9cGTJutLk5rfiD/7635EW/YA+PtzheW26NTFbpVYbzBb4IwQTx9OEp5ziX6UoVjWqamfZncZFZhDFXfQ3uydd6oV9MNKTRzwdEb93fQFssKH0Mmq/WHdamWyyV9ZCtkHHho06cGkCJR/2NqslAomV4fS/0DrBpwtervB6G+WvzkJpe/O3njdZ0O/fVl72uzHjrOQChLvizsXSEmXInW7n60NJdOAEIrrIFwk2C4Q2fd1aQr5FSVfki5EvZy6Vfp3q5u/qSxVvB6T4T1xsWnyH+WDHSl6vT+CHnW8icVYK56L6YGcKj4M3IEDp/ClU+8wmMLcI40PNeChcKsPUJUXMu4GMlwqizTKGZTDR2PWWriFriih0IxoYyISNQlFXIUPwk/36rd6RcQ3SelgieAsXi3D4KM4j8qeLAsfexwndMTzgD5PI3yNyD/Nai+RdVZ+6xV87brSOp8sP3mUc6w7q+gLZ0FTtc2BkUcYXLa0Tj9vejT/AOHcJGd6HzeyaHDPk/9u8EzTiiUti1caMPZhyav7CLwSZ/AV0yk0BcbWS7rRapQdQsTLJKsPs6neYtNzxW73hwWZEG69dE3zWqbZs/kcw8fpZVwYD4fh26PBoPlfw4pIZzGywWUFEaoDY0NO4Zey3wMS6A8FP/HnEqlEvIeR204SUSqDPq36kjgcH0H/fdYnVA3p76K0i+bUyRRonA53JHquhqS0XHYyENmOe09ZEWtetwoSLe2szIUlInfdiq+gjz0dX+r+4TYtBxibvn7qm3xXCGhIvOyAmO3Nd9V1f1OlP0MfhZjDfy61zIdYYppaRU4DuJ/Hc1pXhQDuDc7naZRtrR4DCSiWvmPgHemkJquvOM3FE0wjRac8XyXDy6UZtw5WhWZNOB2gjg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: juW56HRpJ/UFiVkPokhiXh5kS+kztQ8Xrc63xaHXf3I45+ldlquUjGFvjNzUGyBduOP7oGNGxe8L0HpoEe3olcdkxNmauPUpN3vaBUzzsdYvdnoXX4CwDeg9PbkAimw4hVXtGtdFLd8O0SN0aQVm2YpLgFtdyUwrZIoATOk6skcUe6go2JFsOKy4SWFj4oSxxP2l58m2i+PPQqV+BDgNaj9KSqe7pdwk5LzCEwVvmTeOYP1muPiTilK+CXAkOG3m0eCFRam781oHp4jC+zlPpTvvqqvJGmODxkiWhKjGd0cVvZQKnaTI442jPPiSFVxUmnsMA67ThLYgzkJiowxuOHooxo439ySnWgzC6/8UDZy5GjA7nSPrQ/nVfgS71FGFliakEmt0cA502MQO8XiOQw7xUMFBOs+cptzixm0bmRMOwbdDUoCFm0APvq1PdVvGXHPY39iOj63aDlwIsPKGrcs7Xaw+cs8dF01c7BAouiWE5CSod153oQT4PkjM82oylb2KemaulPjztjcmsAv3ae8yaINUTHCQ4DSpH4db8ZJ76aOWUttWH8JkACrkL4nJYQGdB+Ein83L7ICfFrOTGJ8qR1IMpOJo5SU70Yis7ovRjC6NA6WzdBUzEOkP1IOGe5GPwsp7UG78mFCfcRE0LDSOIFfOUlSmISlTrtT4n3e6HhdaD8rqgkUJsbPn8OstObWuzQvicONSfTC15k5TBlhQx+godcrj4chsaa/7y7YEdu+RcZ1CIkzQxjzBH89bZJQbpyrSiZDhc6z+Gr3vnsx3VNdTuHO4Fe2lye0Np78u5R2P3c1ZPYyhn+yNBa4TnKRkHp0HS/O6+g/yYpY+r4DKnbVuzVMx0CXZT61ZbFw+F/MQDQF2u82kZOp4WNQ1JgOSIYn1I3vKlNbP+1Jtl/zihZJdqu3tnjXntq85vW9wXa7iAjNGxy9mk3ywpW5GQi//cttReLL9ZiuhnzHo7FGX5qOP0ydVBQghSChyqVxjRW+//DyQWJEOdhuY2vQ6MmEXyxPfaX4oOioelgHhGSJRYHYV5/Ih0BgVhwJ8PYVu8Uh5tcJkQdS8qT8G3LrzoPz/pAWyQ13OOTKrApSYv8u4WOsexMoTOdAiPJeKyO8pzlga/QguOOgn53OYIxW9RxR0RHxbauuAIWztZyntlF7HcSIWfbU3XY+/DFR9GuVrDdqRMSpF/9ZBYfsalUkABJjfnV4wOZ3VzZYkeAkfCWZfSZf8k3d5D4AXb89Exu5XIVCzPJsH8X3yFXrO3E5U86Mnx05YTHS6XxSKvdPx/G6NnqerTldn1yR/KKC3qELTE1xPTRZEdwz1c3nPuvHBZUP+/5JOkhBOKjgZQa3XrlVyVTflqyKzCaG+0LVaw5dKwCqbis4YV9v/aoAPjMbUCzZ73wzIZID0/w77X6xOPkfKQqzm5J6lUcEZ03M3y2OMLP+I4ppmXk5qi9Unh4OL6luy3ry1+6ry0X2qv7zmKNYT/5obELYhF5STzckVvPBkN0KwnlNNx28YLPWepmheFNsTmUo1rLr1iSRyPsR8KACIA54m669On7fp+2q8nPY= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3fbfcc03-68e1-4b9c-8111-08dcaa45ade0 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:03.1616 (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: VFOso+VrmYtbFAA9MJ8Z+DAnvG5rVYOnpRXuw6HK3pLpJ3D/wb/hEC+b+9VlHabK X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9919 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 From: Jun Yang Initialize and Configure queues of dma device according to hw queues supported from mc bus. Because multiple queues per device are supported, virt queues implementation are dropped. Signed-off-by: Jun Yang --- drivers/dma/dpaa2/dpaa2_qdma.c | 312 +++++++++++++++------------------ drivers/dma/dpaa2/dpaa2_qdma.h | 6 +- 2 files changed, 140 insertions(+), 178 deletions(-) diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c index 5954b552b5..945ba71e4a 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.c +++ b/drivers/dma/dpaa2/dpaa2_qdma.c @@ -478,9 +478,9 @@ dpdmai_dev_get_job_us(struct qdma_virt_queue *qdma_vq __rte_unused, static inline uint16_t dpdmai_dev_get_single_job_lf(struct qdma_virt_queue *qdma_vq, - const struct qbman_fd *fd, - struct rte_dpaa2_qdma_job **job, - uint16_t *nb_jobs) + const struct qbman_fd *fd, + struct rte_dpaa2_qdma_job **job, + uint16_t *nb_jobs) { struct qbman_fle *fle; struct rte_dpaa2_qdma_job **ppjob = NULL; @@ -512,9 +512,9 @@ dpdmai_dev_get_single_job_lf(struct qdma_virt_queue *qdma_vq, static inline uint16_t dpdmai_dev_get_sg_job_lf(struct qdma_virt_queue *qdma_vq, - const struct qbman_fd *fd, - struct rte_dpaa2_qdma_job **job, - uint16_t *nb_jobs) + const struct qbman_fd *fd, + struct rte_dpaa2_qdma_job **job, + uint16_t *nb_jobs) { struct qbman_fle *fle; struct rte_dpaa2_qdma_job **ppjob = NULL; @@ -548,12 +548,12 @@ dpdmai_dev_get_sg_job_lf(struct qdma_virt_queue *qdma_vq, /* Function to receive a QDMA job for a given device and queue*/ static int dpdmai_dev_dequeue_multijob_prefetch(struct qdma_virt_queue *qdma_vq, - uint16_t *vq_id, - struct rte_dpaa2_qdma_job **job, - uint16_t nb_jobs) + uint16_t *vq_id, + struct rte_dpaa2_qdma_job **job, + uint16_t nb_jobs) { struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_vq->dpdmai_dev; - struct dpaa2_queue *rxq = &(dpdmai_dev->rx_queue[0]); + struct dpaa2_queue *rxq; struct qbman_result *dq_storage, *dq_storage1 = NULL; struct qbman_pull_desc pulldesc; struct qbman_swp *swp; @@ -562,7 +562,7 @@ dpdmai_dev_dequeue_multijob_prefetch(struct qdma_virt_queue *qdma_vq, uint8_t num_rx = 0; const struct qbman_fd *fd; uint16_t vqid, num_rx_ret; - uint16_t rx_fqid = rxq->fqid; + uint16_t rx_fqid; int ret, pull_size; if (qdma_vq->flags & DPAA2_QDMA_VQ_FD_SG_FORMAT) { @@ -575,15 +575,17 @@ dpdmai_dev_dequeue_multijob_prefetch(struct qdma_virt_queue *qdma_vq, if (unlikely(!DPAA2_PER_LCORE_DPIO)) { ret = dpaa2_affine_qbman_swp(); if (ret) { - DPAA2_QDMA_ERR( - "Failed to allocate IO portal, tid: %d\n", + DPAA2_QDMA_ERR("Failed to allocate IO portal, tid(%d)", rte_gettid()); return 0; } } swp = DPAA2_PER_LCORE_PORTAL; + rxq = &dpdmai_dev->rx_queue[qdma_vq->vq_id]; + rx_fqid = rxq->fqid; - pull_size = (nb_jobs > dpaa2_dqrr_size) ? dpaa2_dqrr_size : nb_jobs; + pull_size = (nb_jobs > dpaa2_dqrr_size) ? + dpaa2_dqrr_size : nb_jobs; q_storage = rxq->q_storage; if (unlikely(!q_storage->active_dqs)) { @@ -697,12 +699,12 @@ dpdmai_dev_dequeue_multijob_prefetch(struct qdma_virt_queue *qdma_vq, static int dpdmai_dev_dequeue_multijob_no_prefetch(struct qdma_virt_queue *qdma_vq, - uint16_t *vq_id, - struct rte_dpaa2_qdma_job **job, - uint16_t nb_jobs) + uint16_t *vq_id, + struct rte_dpaa2_qdma_job **job, + uint16_t nb_jobs) { struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_vq->dpdmai_dev; - struct dpaa2_queue *rxq = &(dpdmai_dev->rx_queue[0]); + struct dpaa2_queue *rxq; struct qbman_result *dq_storage; struct qbman_pull_desc pulldesc; struct qbman_swp *swp; @@ -710,7 +712,7 @@ dpdmai_dev_dequeue_multijob_no_prefetch(struct qdma_virt_queue *qdma_vq, uint8_t num_rx = 0; const struct qbman_fd *fd; uint16_t vqid, num_rx_ret; - uint16_t rx_fqid = rxq->fqid; + uint16_t rx_fqid; int ret, next_pull, num_pulled = 0; if (qdma_vq->flags & DPAA2_QDMA_VQ_FD_SG_FORMAT) { @@ -725,15 +727,15 @@ dpdmai_dev_dequeue_multijob_no_prefetch(struct qdma_virt_queue *qdma_vq, if (unlikely(!DPAA2_PER_LCORE_DPIO)) { ret = dpaa2_affine_qbman_swp(); if (ret) { - DPAA2_QDMA_ERR( - "Failed to allocate IO portal, tid: %d\n", + DPAA2_QDMA_ERR("Failed to allocate IO portal, tid(%d)", rte_gettid()); return 0; } } swp = DPAA2_PER_LCORE_PORTAL; - rxq = &(dpdmai_dev->rx_queue[0]); + rxq = &dpdmai_dev->rx_queue[qdma_vq->vq_id]; + rx_fqid = rxq->fqid; do { dq_storage = rxq->q_storage->dq_storage[0]; @@ -810,7 +812,7 @@ dpdmai_dev_submit_multi(struct qdma_virt_queue *qdma_vq, uint16_t nb_jobs) { struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_vq->dpdmai_dev; - uint16_t txq_id = dpdmai_dev->tx_queue[0].fqid; + uint16_t txq_id = dpdmai_dev->tx_queue[qdma_vq->vq_id].fqid; struct qbman_fd fd[DPAA2_QDMA_MAX_DESC]; struct qbman_eq_desc eqdesc; struct qbman_swp *swp; @@ -931,8 +933,8 @@ dpaa2_qdma_submit(void *dev_private, uint16_t vchan) static int dpaa2_qdma_enqueue(void *dev_private, uint16_t vchan, - rte_iova_t src, rte_iova_t dst, - uint32_t length, uint64_t flags) + rte_iova_t src, rte_iova_t dst, + uint32_t length, uint64_t flags) { struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; @@ -966,8 +968,8 @@ dpaa2_qdma_enqueue(void *dev_private, uint16_t vchan, int rte_dpaa2_qdma_copy_multi(int16_t dev_id, uint16_t vchan, - struct rte_dpaa2_qdma_job **jobs, - uint16_t nb_cpls) + struct rte_dpaa2_qdma_job **jobs, + uint16_t nb_cpls) { struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id]; struct dpaa2_dpdmai_dev *dpdmai_dev = obj->dev_private; @@ -978,14 +980,11 @@ rte_dpaa2_qdma_copy_multi(int16_t dev_id, uint16_t vchan, } static uint16_t -dpaa2_qdma_dequeue_multi(struct qdma_device *qdma_dev, - struct qdma_virt_queue *qdma_vq, - struct rte_dpaa2_qdma_job **jobs, - uint16_t nb_jobs) +dpaa2_qdma_dequeue_multi(struct qdma_virt_queue *qdma_vq, + struct rte_dpaa2_qdma_job **jobs, + uint16_t nb_jobs) { - struct qdma_virt_queue *temp_qdma_vq; - int ring_count; - int ret = 0, i; + int ret; if (qdma_vq->flags & DPAA2_QDMA_VQ_FD_SG_FORMAT) { /** Make sure there are enough space to get jobs.*/ @@ -1002,42 +1001,12 @@ dpaa2_qdma_dequeue_multi(struct qdma_device *qdma_dev, nb_jobs = RTE_MIN((qdma_vq->num_enqueues - qdma_vq->num_dequeues), nb_jobs); - if (qdma_vq->exclusive_hw_queue) { - /* In case of exclusive queue directly fetch from HW queue */ - ret = qdma_vq->dequeue_job(qdma_vq, NULL, jobs, nb_jobs); - if (ret < 0) { - DPAA2_QDMA_ERR( - "Dequeue from DPDMAI device failed: %d", ret); - return ret; - } - } else { - uint16_t temp_vq_id[DPAA2_QDMA_MAX_DESC]; - - /* Get the QDMA completed jobs from the software ring. - * In case they are not available on the ring poke the HW - * to fetch completed jobs from corresponding HW queues - */ - ring_count = rte_ring_count(qdma_vq->status_ring); - if (ring_count < nb_jobs) { - ret = qdma_vq->dequeue_job(qdma_vq, - temp_vq_id, jobs, nb_jobs); - for (i = 0; i < ret; i++) { - temp_qdma_vq = &qdma_dev->vqs[temp_vq_id[i]]; - rte_ring_enqueue(temp_qdma_vq->status_ring, - (void *)(jobs[i])); - } - ring_count = rte_ring_count( - qdma_vq->status_ring); - } - - if (ring_count) { - /* Dequeue job from the software ring - * to provide to the user - */ - ret = rte_ring_dequeue_bulk(qdma_vq->status_ring, - (void **)jobs, - ring_count, NULL); - } + ret = qdma_vq->dequeue_job(qdma_vq, NULL, jobs, nb_jobs); + if (ret < 0) { + DPAA2_QDMA_ERR("Dequeue from DMA%d-q%d failed(%d)", + qdma_vq->dpdmai_dev->dpdmai_id, + qdma_vq->vq_id, ret); + return ret; } qdma_vq->num_dequeues += ret; @@ -1046,9 +1015,9 @@ dpaa2_qdma_dequeue_multi(struct qdma_device *qdma_dev, static uint16_t dpaa2_qdma_dequeue_status(void *dev_private, uint16_t vchan, - const uint16_t nb_cpls, - uint16_t *last_idx, - enum rte_dma_status_code *st) + const uint16_t nb_cpls, + uint16_t *last_idx, + enum rte_dma_status_code *st) { struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; @@ -1056,7 +1025,7 @@ dpaa2_qdma_dequeue_status(void *dev_private, uint16_t vchan, struct rte_dpaa2_qdma_job *jobs[DPAA2_QDMA_MAX_DESC]; int ret, i; - ret = dpaa2_qdma_dequeue_multi(qdma_dev, qdma_vq, jobs, nb_cpls); + ret = dpaa2_qdma_dequeue_multi(qdma_vq, jobs, nb_cpls); for (i = 0; i < ret; i++) st[i] = jobs[i]->status; @@ -1071,8 +1040,8 @@ dpaa2_qdma_dequeue_status(void *dev_private, uint16_t vchan, static uint16_t dpaa2_qdma_dequeue(void *dev_private, - uint16_t vchan, const uint16_t nb_cpls, - uint16_t *last_idx, bool *has_error) + uint16_t vchan, const uint16_t nb_cpls, + uint16_t *last_idx, bool *has_error) { struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; @@ -1082,7 +1051,7 @@ dpaa2_qdma_dequeue(void *dev_private, RTE_SET_USED(has_error); - ret = dpaa2_qdma_dequeue_multi(qdma_dev, qdma_vq, + ret = dpaa2_qdma_dequeue_multi(qdma_vq, jobs, nb_cpls); rte_mempool_put_bulk(qdma_vq->job_pool, (void **)jobs, ret); @@ -1103,16 +1072,15 @@ rte_dpaa2_qdma_completed_multi(int16_t dev_id, uint16_t vchan, struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; - return dpaa2_qdma_dequeue_multi(qdma_dev, qdma_vq, jobs, nb_cpls); + return dpaa2_qdma_dequeue_multi(qdma_vq, jobs, nb_cpls); } static int dpaa2_qdma_info_get(const struct rte_dma_dev *dev, - struct rte_dma_info *dev_info, - uint32_t info_sz) + struct rte_dma_info *dev_info, + uint32_t info_sz __rte_unused) { - RTE_SET_USED(dev); - RTE_SET_USED(info_sz); + struct dpaa2_dpdmai_dev *dpdmai_dev = dev->data->dev_private; dev_info->dev_capa = RTE_DMA_CAPA_MEM_TO_MEM | RTE_DMA_CAPA_MEM_TO_DEV | @@ -1120,7 +1088,7 @@ dpaa2_qdma_info_get(const struct rte_dma_dev *dev, RTE_DMA_CAPA_DEV_TO_MEM | RTE_DMA_CAPA_SILENT | RTE_DMA_CAPA_OPS_COPY; - dev_info->max_vchans = DPAA2_QDMA_MAX_VHANS; + dev_info->max_vchans = dpdmai_dev->num_queues; dev_info->max_desc = DPAA2_QDMA_MAX_DESC; dev_info->min_desc = DPAA2_QDMA_MIN_DESC; @@ -1129,12 +1097,13 @@ dpaa2_qdma_info_get(const struct rte_dma_dev *dev, static int dpaa2_qdma_configure(struct rte_dma_dev *dev, - const struct rte_dma_conf *dev_conf, - uint32_t conf_sz) + const struct rte_dma_conf *dev_conf, + uint32_t conf_sz) { char name[32]; /* RTE_MEMZONE_NAMESIZE = 32 */ struct dpaa2_dpdmai_dev *dpdmai_dev = dev->data->dev_private; struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; + uint16_t i; DPAA2_QDMA_FUNC_TRACE(); @@ -1142,9 +1111,9 @@ dpaa2_qdma_configure(struct rte_dma_dev *dev, /* In case QDMA device is not in stopped state, return -EBUSY */ if (qdma_dev->state == 1) { - DPAA2_QDMA_ERR( - "Device is in running state. Stop before config."); - return -1; + DPAA2_QDMA_ERR("%s Not stopped, configure failed.", + dev->data->dev_name); + return -EBUSY; } /* Allocate Virtual Queues */ @@ -1156,6 +1125,9 @@ dpaa2_qdma_configure(struct rte_dma_dev *dev, DPAA2_QDMA_ERR("qdma_virtual_queues allocation failed"); return -ENOMEM; } + for (i = 0; i < dev_conf->nb_vchans; i++) + qdma_dev->vqs[i].vq_id = i; + qdma_dev->num_vqs = dev_conf->nb_vchans; return 0; @@ -1257,13 +1229,12 @@ dpaa2_qdma_vchan_rbp_set(struct qdma_virt_queue *vq, static int dpaa2_qdma_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan, - const struct rte_dma_vchan_conf *conf, - uint32_t conf_sz) + const struct rte_dma_vchan_conf *conf, + uint32_t conf_sz) { struct dpaa2_dpdmai_dev *dpdmai_dev = dev->data->dev_private; struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; uint32_t pool_size; - char ring_name[32]; char pool_name[64]; int fd_long_format = 1; int sg_enable = 0, ret; @@ -1301,20 +1272,6 @@ dpaa2_qdma_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan, pool_size = QDMA_FLE_SINGLE_POOL_SIZE; } - if (qdma_dev->num_vqs == 1) - qdma_dev->vqs[vchan].exclusive_hw_queue = 1; - else { - /* Allocate a Ring for Virtual Queue in VQ mode */ - snprintf(ring_name, sizeof(ring_name), "status ring %d %d", - dev->data->dev_id, vchan); - qdma_dev->vqs[vchan].status_ring = rte_ring_create(ring_name, - conf->nb_desc, rte_socket_id(), 0); - if (!qdma_dev->vqs[vchan].status_ring) { - DPAA2_QDMA_ERR("Status ring creation failed for vq"); - return rte_errno; - } - } - snprintf(pool_name, sizeof(pool_name), "qdma_fle_pool_dev%d_qid%d", dpdmai_dev->dpdmai_id, vchan); qdma_dev->vqs[vchan].fle_pool = rte_mempool_create(pool_name, @@ -1410,8 +1367,8 @@ dpaa2_qdma_reset(struct rte_dma_dev *dev) /* In case QDMA device is not in stopped state, return -EBUSY */ if (qdma_dev->state == 1) { - DPAA2_QDMA_ERR( - "Device is in running state. Stop before reset."); + DPAA2_QDMA_ERR("%s Not stopped, reset failed.", + dev->data->dev_name); return -EBUSY; } @@ -1424,10 +1381,6 @@ dpaa2_qdma_reset(struct rte_dma_dev *dev) } } - /* Reset and free virtual queues */ - for (i = 0; i < qdma_dev->num_vqs; i++) { - rte_ring_free(qdma_dev->vqs[i].status_ring); - } rte_free(qdma_dev->vqs); qdma_dev->vqs = NULL; @@ -1504,29 +1457,35 @@ static int dpaa2_dpdmai_dev_uninit(struct rte_dma_dev *dev) { struct dpaa2_dpdmai_dev *dpdmai_dev = dev->data->dev_private; - int ret; + struct dpaa2_queue *rxq; + int ret, i; DPAA2_QDMA_FUNC_TRACE(); ret = dpdmai_disable(&dpdmai_dev->dpdmai, CMD_PRI_LOW, - dpdmai_dev->token); - if (ret) - DPAA2_QDMA_ERR("dmdmai disable failed"); + dpdmai_dev->token); + if (ret) { + DPAA2_QDMA_ERR("dpdmai(%d) disable failed", + dpdmai_dev->dpdmai_id); + } /* Set up the DQRR storage for Rx */ - struct dpaa2_queue *rxq = &(dpdmai_dev->rx_queue[0]); - - if (rxq->q_storage) { - dpaa2_free_dq_storage(rxq->q_storage); - rte_free(rxq->q_storage); + for (i = 0; i < dpdmai_dev->num_queues; i++) { + rxq = &dpdmai_dev->rx_queue[i]; + if (rxq->q_storage) { + dpaa2_free_dq_storage(rxq->q_storage); + rte_free(rxq->q_storage); + } } /* Close the device at underlying layer*/ ret = dpdmai_close(&dpdmai_dev->dpdmai, CMD_PRI_LOW, dpdmai_dev->token); - if (ret) - DPAA2_QDMA_ERR("Failure closing dpdmai device"); + if (ret) { + DPAA2_QDMA_ERR("dpdmai(%d) close failed", + dpdmai_dev->dpdmai_id); + } - return 0; + return ret; } static int @@ -1538,80 +1497,87 @@ dpaa2_dpdmai_dev_init(struct rte_dma_dev *dev, int dpdmai_id) struct dpdmai_rx_queue_attr rx_attr; struct dpdmai_tx_queue_attr tx_attr; struct dpaa2_queue *rxq; - int ret; + int ret, i; DPAA2_QDMA_FUNC_TRACE(); /* Open DPDMAI device */ dpdmai_dev->dpdmai_id = dpdmai_id; dpdmai_dev->dpdmai.regs = dpaa2_get_mcp_ptr(MC_PORTAL_INDEX); - dpdmai_dev->qdma_dev = rte_malloc(NULL, sizeof(struct qdma_device), - RTE_CACHE_LINE_SIZE); + dpdmai_dev->qdma_dev = rte_malloc(NULL, + sizeof(struct qdma_device), RTE_CACHE_LINE_SIZE); ret = dpdmai_open(&dpdmai_dev->dpdmai, CMD_PRI_LOW, - dpdmai_dev->dpdmai_id, &dpdmai_dev->token); + dpdmai_dev->dpdmai_id, &dpdmai_dev->token); if (ret) { - DPAA2_QDMA_ERR("dpdmai_open() failed with err: %d", ret); + DPAA2_QDMA_ERR("%s: dma(%d) open failed(%d)", + __func__, dpdmai_dev->dpdmai_id, ret); return ret; } /* Get DPDMAI attributes */ ret = dpdmai_get_attributes(&dpdmai_dev->dpdmai, CMD_PRI_LOW, - dpdmai_dev->token, &attr); + dpdmai_dev->token, &attr); if (ret) { - DPAA2_QDMA_ERR("dpdmai get attributes failed with err: %d", - ret); + DPAA2_QDMA_ERR("%s: dma(%d) get attributes failed(%d)", + __func__, dpdmai_dev->dpdmai_id, ret); goto init_err; } dpdmai_dev->num_queues = attr.num_of_queues; - /* Set up Rx Queue */ - memset(&rx_queue_cfg, 0, sizeof(struct dpdmai_rx_queue_cfg)); - ret = dpdmai_set_rx_queue(&dpdmai_dev->dpdmai, - CMD_PRI_LOW, - dpdmai_dev->token, - 0, 0, &rx_queue_cfg); - if (ret) { - DPAA2_QDMA_ERR("Setting Rx queue failed with err: %d", - ret); - goto init_err; - } + /* Set up Rx Queues */ + for (i = 0; i < dpdmai_dev->num_queues; i++) { + memset(&rx_queue_cfg, 0, sizeof(struct dpdmai_rx_queue_cfg)); + ret = dpdmai_set_rx_queue(&dpdmai_dev->dpdmai, + CMD_PRI_LOW, + dpdmai_dev->token, + i, 0, &rx_queue_cfg); + if (ret) { + DPAA2_QDMA_ERR("%s Q%d set failed(%d)", + dev->data->dev_name, i, ret); + goto init_err; + } - /* Allocate DQ storage for the DPDMAI Rx queues */ - rxq = &(dpdmai_dev->rx_queue[0]); - rxq->q_storage = rte_malloc("dq_storage", - sizeof(struct queue_storage_info_t), - RTE_CACHE_LINE_SIZE); - if (!rxq->q_storage) { - DPAA2_QDMA_ERR("q_storage allocation failed"); - ret = -ENOMEM; - goto init_err; - } + /* Allocate DQ storage for the DPDMAI Rx queues */ + rxq = &dpdmai_dev->rx_queue[i]; + rxq->q_storage = rte_malloc("dq_storage", + sizeof(struct queue_storage_info_t), + RTE_CACHE_LINE_SIZE); + if (!rxq->q_storage) { + DPAA2_QDMA_ERR("%s DQ info(Q%d) alloc failed", + dev->data->dev_name, i); + ret = -ENOMEM; + goto init_err; + } - memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t)); - ret = dpaa2_alloc_dq_storage(rxq->q_storage); - if (ret) { - DPAA2_QDMA_ERR("dpaa2_alloc_dq_storage failed"); - goto init_err; + memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t)); + ret = dpaa2_alloc_dq_storage(rxq->q_storage); + if (ret) { + DPAA2_QDMA_ERR("%s DQ storage(Q%d) alloc failed(%d)", + dev->data->dev_name, i, ret); + goto init_err; + } } - /* Get Rx and Tx queues FQID */ - ret = dpdmai_get_rx_queue(&dpdmai_dev->dpdmai, CMD_PRI_LOW, - dpdmai_dev->token, 0, 0, &rx_attr); - if (ret) { - DPAA2_QDMA_ERR("Reading device failed with err: %d", - ret); - goto init_err; - } - dpdmai_dev->rx_queue[0].fqid = rx_attr.fqid; + /* Get Rx and Tx queues FQID's */ + for (i = 0; i < dpdmai_dev->num_queues; i++) { + ret = dpdmai_get_rx_queue(&dpdmai_dev->dpdmai, CMD_PRI_LOW, + dpdmai_dev->token, i, 0, &rx_attr); + if (ret) { + DPAA2_QDMA_ERR("Get DPDMAI%d-RXQ%d failed(%d)", + dpdmai_dev->dpdmai_id, i, ret); + goto init_err; + } + dpdmai_dev->rx_queue[i].fqid = rx_attr.fqid; - ret = dpdmai_get_tx_queue(&dpdmai_dev->dpdmai, CMD_PRI_LOW, - dpdmai_dev->token, 0, 0, &tx_attr); - if (ret) { - DPAA2_QDMA_ERR("Reading device failed with err: %d", - ret); - goto init_err; + ret = dpdmai_get_tx_queue(&dpdmai_dev->dpdmai, CMD_PRI_LOW, + dpdmai_dev->token, i, 0, &tx_attr); + if (ret) { + DPAA2_QDMA_ERR("Get DPDMAI%d-TXQ%d failed(%d)", + dpdmai_dev->dpdmai_id, i, ret); + goto init_err; + } + dpdmai_dev->tx_queue[i].fqid = tx_attr.fqid; } - dpdmai_dev->tx_queue[0].fqid = tx_attr.fqid; /* Enable the device */ ret = dpdmai_enable(&dpdmai_dev->dpdmai, CMD_PRI_LOW, diff --git a/drivers/dma/dpaa2/dpaa2_qdma.h b/drivers/dma/dpaa2/dpaa2_qdma.h index 811906fcbc..786dcb9308 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.h +++ b/drivers/dma/dpaa2/dpaa2_qdma.h @@ -18,7 +18,7 @@ #define DPAA2_QDMA_MAX_SG_NB 64 -#define DPAA2_DPDMAI_MAX_QUEUES 1 +#define DPAA2_DPDMAI_MAX_QUEUES 16 /** FLE single job pool size: job pointer(uint64_t) + * 3 Frame list + 2 source/destination descriptor. @@ -245,8 +245,6 @@ typedef int (qdma_enqueue_multijob_t)( /** Represents a QDMA virtual queue */ struct qdma_virt_queue { - /** Status ring of the virtual queue */ - struct rte_ring *status_ring; /** Associated hw queue */ struct dpaa2_dpdmai_dev *dpdmai_dev; /** FLE pool for the queue */ @@ -255,8 +253,6 @@ struct qdma_virt_queue { struct dpaa2_qdma_rbp rbp; /** States if this vq is in use or not */ uint8_t in_use; - /** States if this vq has exclusively associated hw queue */ - uint8_t exclusive_hw_queue; /** Number of descriptor for the virtual DMA channel */ uint16_t nb_desc; /* Total number of enqueues on this VQ */ From patchwork Mon Jul 22 11:58:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142584 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 113BC4567F; Mon, 22 Jul 2024 13:59:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1602D40285; Mon, 22 Jul 2024 13:59:15 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012015.outbound.protection.outlook.com [52.101.66.15]) by mails.dpdk.org (Postfix) with ESMTP id 7680F40041 for ; Mon, 22 Jul 2024 13:59:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ndaTNAkidouPQrGzV34u9O0mq0ipl+NS5vB/yfuNZ9HwocuXDItkmxWG145f4l15I1nc3jMYFADAoxC+xxCzLZ8/fD6eB9VgaKwPCUYkr7WP72mlOg/oA+Vw4HAvN9c1obgiT+eh5hz0Zir1v6mlOYs9IncHPXTGbR3Z6xfgVg7eYecEfLv1sbFoa43cbDJZis32V7oa6YrCNb0lbqnfERVzRxe1JvaKS9j/MfKeaNeE6iL7v0+vfHziNcvMuNWP5Ckmyf7OOXdjG+jgtDgjW6sHvAqgwlLSxEbcaPXZF6O0vuVz3NbPBVB4k468hGMv56lwlr8C9L1i0UI29vBgGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4r76bRwZSMQ4c5g6jf3ihBDqvD1wTDY1kHW7tBOFYH0=; b=s+QX2wAtrItSGNjwTf/WZwsQ4oWCfiQC+/vcBx0OlI8dewt9MMsyhZ8+npjgiNhkuH+968+mjglMyElUDzZgpdS5SGgzP03zwXnTplHMjNqdFalqF6NT87eXyXt/s6bofNoTsK4+EvOTYknqxycZsMpj/v3dbX7KulBkJwcp05cCHmPifLOgF5J8zioOxIzx/X9lsKcqeUbPAW23XfOcfCuBCaJg0WeCp9kckrMYmTbKj1hhOL5qUt88x6og39EeC6g3AO2/zQDT6xniVIASuHUKzreU9d7ZO+va5yA8kzqHZgeMnh3w2PqSuQNQ2mEX52LCGXjeB0N4Ixu4BjgYvw== 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=4r76bRwZSMQ4c5g6jf3ihBDqvD1wTDY1kHW7tBOFYH0=; b=KFhHQz5+F4WFeeDnlHEb5eEzhWP8fp0cVLLmYZYtLVkmxXRcBDdnxtjxgF7taIBSMl2l4B6l0a586tZEopNTO9W7z3cMy0H78sDf02/9NDLHvkMAgku2au/LNLKCib17hLboTa16KFXCXfiz0h/f4R4/N6lrgYkmpX3/Ee0SWqk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:05 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:05 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [v2 03/30] dma/dpaa2: adapt DMA driver API Date: Mon, 22 Jul 2024 17:28:16 +0530 Message-Id: <20240722115843.1830105-4-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a8699ca-0199-4196-49db-08dcaa45af25 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: 7DFEV8+DoM3Kc6BOchtwGxMnV2pXszXwDvLPbeEBcPwLgBvf85NOPzU4vIeZaqUSiKnGubp1KU6q2OfV1rlXH1uOUBvCB4cGUQPNJqDxBkNEiCYtnSPHdfFhCZq2dRq6ItQYcpvcM0KhZ/RkoEBR+ASXbMrOyHEhcTrSJhlEBbI6wspQGh6391/B/TSTIDummnUv7rXcUopqMTh+GlBKI7K8QORmO8QScy8kxiWyjiVVblTUMiYG7VK7Oxt0sTjtzxDZC6CQ7RaObPadSHS9jkfEVR1NXa3S5DhMrvS6AGW89Vp4HxPP25vecfUQgplkcrEhEsiO0MzDMJ8NXwwelr5Deel01PAGjYodLPyL7Di+ZK3GZQXwAvsMdwKJybGkTlMk1fhXoI3Zer+lRm49/JG/9OYlRdJFs2EY3cZF00lzge4RGt64eFK8VtLxmmDu2HOVGN+2oXxSSxD5QkzYBf0wu5+E8BMgpsywybDyDmlz+1aqKPyXjPhPsmphvJneficQXFsOQIQ3tlwPmfb8F0/peR8Fa1mHMMiuKlWMWS32fQ/IapMLhwwbhAcfw+8Rj+rGAyePDE1wYNaJWLp9xQXbLsd2wOqhqGqeI0cy1yF8zughOgXD7ZGcqVKN5N7o1kZ+ooRw6PULnnAwq8Q7vYBD9YfcMx7Nl8MXbQcNV6dY/ljfNsZYbLhqLiKeK64whOKm3y/Qx5rd7+2Qo/GrxOjFj6YoWqP9WD0U/SltEGePKYu16KqDQ0SUT/wnhzVGOYDUw6f2hbfhGaZFjRQa7PIPgnzg3ayaXoAOF+dui6WxtoSJmIg4+aDD9m2DCbhCdKsGn9wtvqIt5p+IXxO9pAVotNHmO1/sIPhOXyy0/n3xuGgm1k7c02NOVNIGhvMr2meWyLEWtvtXo6YA/ipOOLetUvABkdpDGJcLhNv1qX80WVVCBxkevtElpHOLhCVfXtBERS3WJZk6G1GBJErrEpqBZoj0EUvhif4tE9c09ywe+7XpzUL0Nn7xj9D4aXOtQjPZ9lVYjqcTCAhZUAG7YfsY/6khgKGrEnV8VI9vkccy3p8RIiOTvPFYUl7c+7hr1p3V4TQvt2iBp1hfcWksb6mhYHIg9QAOIqBExmPGNeBOwNzOW5D4dmoosbPnQoWUGoaqfWMtyODR3Dvk+n+Nzlsxaq+gy8SSe+9Rida+mrmUcKjYNaKaM0f1OUW79/N7ZRUvykyM73Sdj+k/Hyl5SBCw20xrWSiL8Lk98ZwMD6Wg9VK81w3g59axYbJhVm49UhQW8Xb1GyaXscUOcW7If9/wI3QxJ+2/LaRqupkYyZtkMmd+ZEIwHMK/Qm9a1axJbNgkhIRxjY9lbvmuoFGnQfK5O8Z7bxfD9n1BvZ6AOm/WVng2WtHMrpvaHlFTLw7gTrZaiZDzN4mbzuQFCqOxsg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FkZYcRqE4GUWu8ARoONqO385ORrAbTlu5Z1ZiH8IpLjRKuZkqiYL8NNRBdFKvACXMkSHnFmHvz7HZ4VEL0vlcuqD+mNfrWGGm1HgtJsXNJsHZEayBe7+MAyZe/4lgZ4/1B1Nuuytb4oKk/RmmASgNJct6tGgzpk7/PSDWhWzcMUscKOY37MBDL9qpQ+wbHi1q22uoc+cypx1CCANNAfitSzZPCgfc6PDTJH8HY30PP4BlbOQyAihpeIz2VrgzryaGMEctH/KcLRR/TqViAx/mIsF2gyXXyVz9WpVLsb3xJxR/LV4O87FfvZatOtMsrKC6kZRkT/90WcD+H95JovDiy0eyNXj7eZ1itfxM93FCsIJxkC6BaUI1dgsKMC0liyU9FN9NyAW0MdvAjrBx+LbnJQ9ZZMnWqFkTqL6WLDnk68Z/cRIr3Ckh/uHeLrUHoS3OteNn8pW4MS18kiH87pYK1QdYu0w/89XrUHzJEmogixxsLLbuJDfqQDKoZFzpc3CgDzD4qgCc7EgDrZMs/wbgPVWxpXeNg/0u7ScmmWEQTFy7ccAmZ7Bd7DRatiSElK52JEurcC0nUB2agK0B37E8I3bVXva1V5L8kUG8qfhwFN514NOn8LJlZve0PWgwjttCaQzPbS4Wpk10zm6is5QsXaoFwau6xfv6L0dIfoGh5Ymtt4uijImU0XUob6Y7LSBIMGRG5v0fMSdJlTJN6cvch14WwfLtSFku7otjzBUSytBi+OJY1tB8/VqjyXF8MwO/lcEY16YiWCPTd5cKNVnVSk30k3NfiPp1Epg/mWxdck8f6D5vQXsujil+NvnS2wym5OaNOq/HIJlhYIpuNfHNd5tHRy5wNWRFLHemJyMZyzs3zGDI8pYDil6Z+d1Kwctc+uxVz/1HPF92s5Vvwtj0fTPFKqMS+Q2qCFphfK/2Ofm8Cy/zlgdHnbrHrCDouShMa9IHJvkzEbW0/4Aj3ZmbdwJHkOwzw1McdapUg4Iu8yZWZlhtDaSAQ3cp6P/9TDhYAgh4mrW/v3CaSJpmRzziOhBx/9xos/xu+wX1jJXZmLKXJ2jz8EzCByquhl25KSEy/emj6WGcUKLHRToxBXLXf1Tv5rcP11/b+WBJaJb+HfrVqEThM9YBw3qY4jmqxGwLd0ePXf2crhZ+Xh/jJiuR9DhMpwMgKYZ3eag0Y2f7YntoJCPmg9X4vowhxJC7+9PIbeRUQrHKJHfVslXrj0g/0xkawSJCkqbu/aMFGeop0VapiDtjo30Bqgru8kO4AVEjngxxwjMKpP5r419BWFs5G8z82owO0UUHvia+8Z7okWl6EL5VYmcM/vJ9xcGOaqfBijbehwXq5qFwaIq2EQ3CQ0fIK3FkTTeVE9ydbBlhyA9JSPYIOZokXOwzUrKkX8xgkH/+ggG9mbYP/+3DHQ/if6G96dIMZEO8YkKnS1YXUnTwkm13DUXa6StSo0Faw4vpVPx07Ul8ulf+FOJKKssQMeIZs/lC2jyDAAHTATTLXmYWZKNT+mrEBlv+7VeqeJenNLwWG5izuojDhcHq0M9gc4YUT4tlqOo7FITqXDRi7I= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a8699ca-0199-4196-49db-08dcaa45af25 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:05.3273 (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: sIhY4g5mpiNoNIIMGFStTalkznELYigGcHEh3TJTWq+AFOMJ5QGvX+soCc/DUs7d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 From: Jun Yang 1) Support DMA single copy and SG copy. 2) Silent mode support. Add index combined with length field. For Silent mode, this index is used to notify DMA driver which inner descriptor should be used. For none silent mode, this index is used to notify user which descriptor is completed. In addition, because dpaa2 qdma is not able to preserve order, "rte_dma_completed_t" returns multiple indexes instead of last index. Signed-off-by: Jun Yang --- drivers/dma/dpaa2/dpaa2_qdma.c | 1667 +++++++++++------------- drivers/dma/dpaa2/dpaa2_qdma.h | 126 +- drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h | 119 +- drivers/dma/dpaa2/version.map | 13 - 4 files changed, 799 insertions(+), 1126 deletions(-) delete mode 100644 drivers/dma/dpaa2/version.map diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c index 945ba71e4a..15d3776603 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.c +++ b/drivers/dma/dpaa2/dpaa2_qdma.c @@ -16,218 +16,345 @@ #define DPAA2_QDMA_PREFETCH "prefetch" -uint32_t dpaa2_coherent_no_alloc_cache; -uint32_t dpaa2_coherent_alloc_cache; +static uint32_t dpaa2_coherent_no_alloc_cache; +static uint32_t dpaa2_coherent_alloc_cache; static inline int -qdma_populate_fd_pci(phys_addr_t src, phys_addr_t dest, - uint32_t len, struct qbman_fd *fd, - struct dpaa2_qdma_rbp *rbp, int ser) +qdma_cntx_idx_ring_eq(struct qdma_cntx_idx_ring *ring, + const uint16_t *elem, uint16_t nb, + uint16_t *free_space) { - fd->simple_pci.saddr_lo = lower_32_bits((uint64_t) (src)); - fd->simple_pci.saddr_hi = upper_32_bits((uint64_t) (src)); + if (unlikely(nb > ring->free_space)) + return 0; - fd->simple_pci.len_sl = len; + if ((ring->tail + nb) < DPAA2_QDMA_MAX_DESC) { + rte_memcpy(&ring->cntx_idx_ring[ring->tail], + elem, nb * sizeof(uint16_t)); + ring->tail += nb; + } else { + rte_memcpy(&ring->cntx_idx_ring[ring->tail], + elem, + (DPAA2_QDMA_MAX_DESC - ring->tail) * + sizeof(uint16_t)); + rte_memcpy(&ring->cntx_idx_ring[0], + &elem[DPAA2_QDMA_MAX_DESC - ring->tail], + (nb - DPAA2_QDMA_MAX_DESC + ring->tail) * + sizeof(uint16_t)); + ring->tail = (ring->tail + nb) & (DPAA2_QDMA_MAX_DESC - 1); + } + ring->free_space -= nb; + ring->nb_in_ring += nb; - fd->simple_pci.bmt = 1; - fd->simple_pci.fmt = 3; - fd->simple_pci.sl = 1; - fd->simple_pci.ser = ser; + if (free_space) + *free_space = ring->free_space; - fd->simple_pci.sportid = rbp->sportid; /*pcie 3 */ - fd->simple_pci.srbp = rbp->srbp; - if (rbp->srbp) - fd->simple_pci.rdttype = 0; - else - fd->simple_pci.rdttype = dpaa2_coherent_alloc_cache; + return nb; +} - /*dest is pcie memory */ - fd->simple_pci.dportid = rbp->dportid; /*pcie 3 */ - fd->simple_pci.drbp = rbp->drbp; - if (rbp->drbp) - fd->simple_pci.wrttype = 0; - else - fd->simple_pci.wrttype = dpaa2_coherent_no_alloc_cache; +static inline int +qdma_cntx_idx_ring_dq(struct qdma_cntx_idx_ring *ring, + uint16_t *elem, uint16_t max) +{ + int ret = ring->nb_in_ring > max ? max : ring->nb_in_ring; - fd->simple_pci.daddr_lo = lower_32_bits((uint64_t) (dest)); - fd->simple_pci.daddr_hi = upper_32_bits((uint64_t) (dest)); + if (!ret) + return 0; - return 0; + if ((ring->start + ret) < DPAA2_QDMA_MAX_DESC) { + rte_memcpy(elem, + &ring->cntx_idx_ring[ring->start], + ret * sizeof(uint16_t)); + ring->start += ret; + } else { + rte_memcpy(elem, + &ring->cntx_idx_ring[ring->start], + (DPAA2_QDMA_MAX_DESC - ring->start) * + sizeof(uint16_t)); + rte_memcpy(&elem[DPAA2_QDMA_MAX_DESC - ring->start], + &ring->cntx_idx_ring[0], + (ret - DPAA2_QDMA_MAX_DESC + ring->start) * + sizeof(uint16_t)); + ring->start = (ring->start + ret) & (DPAA2_QDMA_MAX_DESC - 1); + } + ring->free_space += ret; + ring->nb_in_ring -= ret; + + return ret; } -static inline int -qdma_populate_fd_ddr(phys_addr_t src, phys_addr_t dest, - uint32_t len, struct qbman_fd *fd, int ser) +static int +dpaa2_qdma_multi_eq(struct qdma_virt_queue *qdma_vq) { - fd->simple_ddr.saddr_lo = lower_32_bits((uint64_t) (src)); - fd->simple_ddr.saddr_hi = upper_32_bits((uint64_t) (src)); - - fd->simple_ddr.len = len; - - fd->simple_ddr.bmt = 1; - fd->simple_ddr.fmt = 3; - fd->simple_ddr.sl = 1; - fd->simple_ddr.ser = ser; - /** - * src If RBP=0 {NS,RDTTYPE[3:0]}: 0_1011 - * Coherent copy of cacheable memory, - * lookup in downstream cache, no allocate - * on miss - */ - fd->simple_ddr.rns = 0; - fd->simple_ddr.rdttype = dpaa2_coherent_alloc_cache; - /** - * dest If RBP=0 {NS,WRTTYPE[3:0]}: 0_0111 - * Coherent write of cacheable memory, - * lookup in downstream cache, no allocate on miss - */ - fd->simple_ddr.wns = 0; - fd->simple_ddr.wrttype = dpaa2_coherent_no_alloc_cache; + struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_vq->dpdmai_dev; + uint16_t txq_id = dpdmai_dev->tx_queue[qdma_vq->vq_id].fqid; + struct qbman_eq_desc eqdesc; + struct qbman_swp *swp; + uint32_t num_to_send = 0; + uint16_t num_tx = 0; + uint32_t enqueue_loop, loop; + int ret; + struct qbman_fd *fd = qdma_vq->fd; + uint16_t nb_fds = qdma_vq->fd_idx, idx, dst_idx; - fd->simple_ddr.daddr_lo = lower_32_bits((uint64_t) (dest)); - fd->simple_ddr.daddr_hi = upper_32_bits((uint64_t) (dest)); + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_QDMA_ERR("Failed to allocate IO portal, tid: %d", + rte_gettid()); + return -EIO; + } + } + swp = DPAA2_PER_LCORE_PORTAL; - return 0; + /* Prepare enqueue descriptor */ + qbman_eq_desc_clear(&eqdesc); + qbman_eq_desc_set_fq(&eqdesc, txq_id); + qbman_eq_desc_set_no_orp(&eqdesc, 0); + qbman_eq_desc_set_response(&eqdesc, 0, 0); + + while (nb_fds > 0) { + num_to_send = (nb_fds > dpaa2_eqcr_size) ? + dpaa2_eqcr_size : nb_fds; + + /* Enqueue the packet to the QBMAN */ + enqueue_loop = 0; + loop = num_to_send; + + while (enqueue_loop < loop) { + ret = qbman_swp_enqueue_multiple(swp, + &eqdesc, + &fd[num_tx + enqueue_loop], + NULL, + loop - enqueue_loop); + if (likely(ret >= 0)) + enqueue_loop += ret; + } + num_tx += num_to_send; + nb_fds -= loop; + } + + qdma_vq->num_enqueues += num_tx; + if (unlikely(num_tx != qdma_vq->fd_idx)) { + dst_idx = 0; + for (idx = num_tx; idx < qdma_vq->fd_idx; idx++) { + rte_memcpy(&qdma_vq->fd[dst_idx], + &qdma_vq->fd[idx], + sizeof(struct qbman_fd)); + dst_idx++; + } + } + qdma_vq->fd_idx -= num_tx; + + return num_tx; } static void -dpaa2_qdma_populate_fle(struct qbman_fle *fle, - uint64_t fle_iova, - struct dpaa2_qdma_rbp *rbp, - uint64_t src, uint64_t dest, - size_t len, uint32_t flags, uint32_t fmt) +fle_sdd_pre_populate(struct qdma_cntx_fle_sdd *fle_sdd, + struct dpaa2_qdma_rbp *rbp, uint64_t src, uint64_t dest, + uint32_t fmt) { - struct qdma_sdd *sdd; - uint64_t sdd_iova; - - sdd = (struct qdma_sdd *) - ((uintptr_t)(uint64_t)fle - QDMA_FLE_FLE_OFFSET + - QDMA_FLE_SDD_OFFSET); - sdd_iova = fle_iova - QDMA_FLE_FLE_OFFSET + QDMA_FLE_SDD_OFFSET; + struct qbman_fle *fle = fle_sdd->fle; + struct qdma_sdd *sdd = fle_sdd->sdd; + uint64_t sdd_iova = DPAA2_VADDR_TO_IOVA(sdd); /* first frame list to source descriptor */ - DPAA2_SET_FLE_ADDR(fle, sdd_iova); - DPAA2_SET_FLE_LEN(fle, (2 * (sizeof(struct qdma_sdd)))); + DPAA2_SET_FLE_ADDR(&fle[DPAA2_QDMA_SDD_FLE], sdd_iova); + DPAA2_SET_FLE_LEN(&fle[DPAA2_QDMA_SDD_FLE], + DPAA2_QDMA_MAX_SDD * (sizeof(struct qdma_sdd))); /* source and destination descriptor */ if (rbp && rbp->enable) { /* source */ - sdd->read_cmd.portid = rbp->sportid; - sdd->rbpcmd_simple.pfid = rbp->spfid; - sdd->rbpcmd_simple.vfid = rbp->svfid; + sdd[DPAA2_QDMA_SRC_SDD].read_cmd.portid = + rbp->sportid; + sdd[DPAA2_QDMA_SRC_SDD].rbpcmd_simple.pfid = + rbp->spfid; + sdd[DPAA2_QDMA_SRC_SDD].rbpcmd_simple.vfid = + rbp->svfid; + sdd[DPAA2_QDMA_SRC_SDD].rbpcmd_simple.vfa = + rbp->svfa; if (rbp->srbp) { - sdd->read_cmd.rbp = rbp->srbp; - sdd->read_cmd.rdtype = DPAA2_RBP_MEM_RW; + sdd[DPAA2_QDMA_SRC_SDD].read_cmd.rbp = + rbp->srbp; + sdd[DPAA2_QDMA_SRC_SDD].read_cmd.rdtype = + DPAA2_RBP_MEM_RW; } else { - sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache; + sdd[DPAA2_QDMA_SRC_SDD].read_cmd.rdtype = + dpaa2_coherent_no_alloc_cache; } - sdd++; /* destination */ - sdd->write_cmd.portid = rbp->dportid; - sdd->rbpcmd_simple.pfid = rbp->dpfid; - sdd->rbpcmd_simple.vfid = rbp->dvfid; + sdd[DPAA2_QDMA_DST_SDD].write_cmd.portid = + rbp->dportid; + sdd[DPAA2_QDMA_DST_SDD].rbpcmd_simple.pfid = + rbp->dpfid; + sdd[DPAA2_QDMA_DST_SDD].rbpcmd_simple.vfid = + rbp->dvfid; + sdd[DPAA2_QDMA_DST_SDD].rbpcmd_simple.vfa = + rbp->dvfa; if (rbp->drbp) { - sdd->write_cmd.rbp = rbp->drbp; - sdd->write_cmd.wrttype = DPAA2_RBP_MEM_RW; + sdd[DPAA2_QDMA_DST_SDD].write_cmd.rbp = + rbp->drbp; + sdd[DPAA2_QDMA_DST_SDD].write_cmd.wrttype = + DPAA2_RBP_MEM_RW; } else { - sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache; + sdd[DPAA2_QDMA_DST_SDD].write_cmd.wrttype = + dpaa2_coherent_alloc_cache; } - } else { - sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache; - sdd++; - sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache; + sdd[DPAA2_QDMA_SRC_SDD].read_cmd.rdtype = + dpaa2_coherent_no_alloc_cache; + sdd[DPAA2_QDMA_DST_SDD].write_cmd.wrttype = + dpaa2_coherent_alloc_cache; } - fle++; /* source frame list to source buffer */ - if (flags & RTE_DPAA2_QDMA_JOB_SRC_PHY) { - DPAA2_SET_FLE_ADDR(fle, src); + DPAA2_SET_FLE_ADDR(&fle[DPAA2_QDMA_SRC_FLE], src); #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - DPAA2_SET_FLE_BMT(fle); + DPAA2_SET_FLE_BMT(&fle[DPAA2_QDMA_SRC_FLE]); #endif - } else { - DPAA2_SET_FLE_ADDR(fle, DPAA2_VADDR_TO_IOVA(src)); - } - fle->word4.fmt = fmt; - DPAA2_SET_FLE_LEN(fle, len); + fle[DPAA2_QDMA_SRC_FLE].word4.fmt = fmt; - fle++; /* destination frame list to destination buffer */ - if (flags & RTE_DPAA2_QDMA_JOB_DEST_PHY) { + DPAA2_SET_FLE_ADDR(&fle[DPAA2_QDMA_DST_FLE], dest); #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - DPAA2_SET_FLE_BMT(fle); + DPAA2_SET_FLE_BMT(&fle[DPAA2_QDMA_DST_FLE]); #endif - DPAA2_SET_FLE_ADDR(fle, dest); - } else { - DPAA2_SET_FLE_ADDR(fle, DPAA2_VADDR_TO_IOVA(dest)); - } - fle->word4.fmt = fmt; - DPAA2_SET_FLE_LEN(fle, len); + fle[DPAA2_QDMA_DST_FLE].word4.fmt = fmt; /* Final bit: 1, for last frame list */ - DPAA2_SET_FLE_FIN(fle); + DPAA2_SET_FLE_FIN(&fle[DPAA2_QDMA_DST_FLE]); } -static inline int -dpdmai_dev_set_fd_us(struct qdma_virt_queue *qdma_vq, - struct qbman_fd *fd, - struct rte_dpaa2_qdma_job **job, - uint16_t nb_jobs) +static void +sg_entry_pre_populate(struct qdma_cntx_sg *sg_cntx) { + uint16_t i; + struct qdma_sg_entry *src_sge = sg_cntx->sg_src_entry; + struct qdma_sg_entry *dst_sge = sg_cntx->sg_dst_entry; + + for (i = 0; i < RTE_DPAA2_QDMA_JOB_SUBMIT_MAX; i++) { + /* source SG */ + src_sge[i].ctrl.sl = QDMA_SG_SL_LONG; + src_sge[i].ctrl.fmt = QDMA_SG_FMT_SDB; +#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA + src_sge[i].ctrl.bmt = QDMA_SG_BMT_ENABLE; +#else + src_sge[i].ctrl.bmt = QDMA_SG_BMT_DISABLE; +#endif + /* destination SG */ + dst_sge[i].ctrl.sl = QDMA_SG_SL_LONG; + dst_sge[i].ctrl.fmt = QDMA_SG_FMT_SDB; +#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA + dst_sge[i].ctrl.bmt = QDMA_SG_BMT_ENABLE; +#else + dst_sge[i].ctrl.bmt = QDMA_SG_BMT_DISABLE; +#endif + } +} + +static void +fle_sdd_sg_pre_populate(struct qdma_cntx_sg *sg_cntx, + struct qdma_virt_queue *qdma_vq) +{ + struct qdma_sg_entry *src_sge = sg_cntx->sg_src_entry; + struct qdma_sg_entry *dst_sge = sg_cntx->sg_dst_entry; + rte_iova_t src_sge_iova, dst_sge_iova; struct dpaa2_qdma_rbp *rbp = &qdma_vq->rbp; - struct rte_dpaa2_qdma_job **ppjob; - size_t iova; - int ret = 0, loop; - int ser = (qdma_vq->flags & DPAA2_QDMA_VQ_NO_RESPONSE) ? - 0 : 1; - - for (loop = 0; loop < nb_jobs; loop++) { - if (job[loop]->src & QDMA_RBP_UPPER_ADDRESS_MASK) - iova = (size_t)job[loop]->dest; - else - iova = (size_t)job[loop]->src; - - /* Set the metadata */ - job[loop]->vq_id = qdma_vq->vq_id; - ppjob = (struct rte_dpaa2_qdma_job **)DPAA2_IOVA_TO_VADDR(iova) - 1; - *ppjob = job[loop]; - - if ((rbp->drbp == 1) || (rbp->srbp == 1)) - ret = qdma_populate_fd_pci((phys_addr_t)job[loop]->src, - (phys_addr_t)job[loop]->dest, - job[loop]->len, &fd[loop], rbp, ser); - else - ret = qdma_populate_fd_ddr((phys_addr_t)job[loop]->src, - (phys_addr_t)job[loop]->dest, - job[loop]->len, &fd[loop], ser); + + memset(sg_cntx, 0, sizeof(struct qdma_cntx_sg)); + + src_sge_iova = DPAA2_VADDR_TO_IOVA(src_sge); + dst_sge_iova = DPAA2_VADDR_TO_IOVA(dst_sge); + + sg_entry_pre_populate(sg_cntx); + fle_sdd_pre_populate(&sg_cntx->fle_sdd, + rbp, src_sge_iova, dst_sge_iova, + QBMAN_FLE_WORD4_FMT_SGE); +} + +static inline uint32_t +sg_entry_post_populate(const struct rte_dma_sge *src, + const struct rte_dma_sge *dst, struct qdma_cntx_sg *sg_cntx, + uint16_t nb_sge) +{ + uint16_t i = 0, idx; + uint32_t total_len = 0, len; + struct qdma_sg_entry *src_sge = sg_cntx->sg_src_entry; + struct qdma_sg_entry *dst_sge = sg_cntx->sg_dst_entry; + + for (i = 0; i < (nb_sge - 1); i++) { + if (unlikely(src[i].length != dst[i].length)) + return -ENOTSUP; + len = RTE_DPAA2_QDMA_LEN_FROM_LENGTH(src[i].length); + idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(src[i].length); + src_sge->addr_lo = (uint32_t)src[i].addr; + src_sge->addr_hi = (src[i].addr >> 32); + src_sge->data_len.data_len_sl0 = len; + + dst_sge->addr_lo = (uint32_t)dst[i].addr; + dst_sge->addr_hi = (dst[i].addr >> 32); + dst_sge->data_len.data_len_sl0 = len; + total_len += len; + sg_cntx->cntx_idx[i] = idx; + + src_sge->ctrl.f = 0; + dst_sge->ctrl.f = 0; + src_sge++; + dst_sge++; } - return ret; + if (unlikely(src[i].length != dst[i].length)) + return -ENOTSUP; + + len = RTE_DPAA2_QDMA_LEN_FROM_LENGTH(src[i].length); + idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(src[i].length); + + src_sge->addr_lo = (uint32_t)src[i].addr; + src_sge->addr_hi = (src[i].addr >> 32); + src_sge->data_len.data_len_sl0 = len; + + dst_sge->addr_lo = (uint32_t)dst[i].addr; + dst_sge->addr_hi = (dst[i].addr >> 32); + dst_sge->data_len.data_len_sl0 = len; + + total_len += len; + sg_cntx->cntx_idx[i] = idx; + sg_cntx->job_nb = nb_sge; + + src_sge->ctrl.f = QDMA_SG_F; + dst_sge->ctrl.f = QDMA_SG_F; + + return total_len; } -static uint32_t -qdma_populate_sg_entry(struct rte_dpaa2_qdma_job **jobs, - struct qdma_sg_entry *src_sge, - struct qdma_sg_entry *dst_sge, - uint16_t nb_jobs) +static inline void +sg_fle_post_populate(struct qbman_fle fle[], + size_t len) { - uint16_t i; - uint32_t total_len = 0; - uint64_t iova; + DPAA2_SET_FLE_LEN(&fle[DPAA2_QDMA_SRC_FLE], len); + DPAA2_SET_FLE_LEN(&fle[DPAA2_QDMA_DST_FLE], len); +} - for (i = 0; i < nb_jobs; i++) { - /* source SG */ - if (likely(jobs[i]->flags & RTE_DPAA2_QDMA_JOB_SRC_PHY)) { - src_sge->addr_lo = (uint32_t)jobs[i]->src; - src_sge->addr_hi = (jobs[i]->src >> 32); - } else { - iova = DPAA2_VADDR_TO_IOVA(jobs[i]->src); - src_sge->addr_lo = (uint32_t)iova; - src_sge->addr_hi = iova >> 32; - } - src_sge->data_len.data_len_sl0 = jobs[i]->len; +static inline uint32_t +sg_entry_populate(const struct rte_dma_sge *src, + const struct rte_dma_sge *dst, struct qdma_cntx_sg *sg_cntx, + uint16_t nb_sge) +{ + uint16_t i, idx; + uint32_t total_len = 0, len; + struct qdma_sg_entry *src_sge = sg_cntx->sg_src_entry; + struct qdma_sg_entry *dst_sge = sg_cntx->sg_dst_entry; + + for (i = 0; i < nb_sge; i++) { + if (unlikely(src[i].length != dst[i].length)) + return -ENOTSUP; + len = RTE_DPAA2_QDMA_LEN_FROM_LENGTH(src[i].length); + idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(src[i].length); + + src_sge->addr_lo = (uint32_t)src[i].addr; + src_sge->addr_hi = (src[i].addr >> 32); + src_sge->data_len.data_len_sl0 = len; src_sge->ctrl.sl = QDMA_SG_SL_LONG; src_sge->ctrl.fmt = QDMA_SG_FMT_SDB; #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA @@ -235,16 +362,9 @@ qdma_populate_sg_entry(struct rte_dpaa2_qdma_job **jobs, #else src_sge->ctrl.bmt = QDMA_SG_BMT_DISABLE; #endif - /* destination SG */ - if (likely(jobs[i]->flags & RTE_DPAA2_QDMA_JOB_DEST_PHY)) { - dst_sge->addr_lo = (uint32_t)jobs[i]->dest; - dst_sge->addr_hi = (jobs[i]->dest >> 32); - } else { - iova = DPAA2_VADDR_TO_IOVA(jobs[i]->dest); - dst_sge->addr_lo = (uint32_t)iova; - dst_sge->addr_hi = iova >> 32; - } - dst_sge->data_len.data_len_sl0 = jobs[i]->len; + dst_sge->addr_lo = (uint32_t)dst[i].addr; + dst_sge->addr_hi = (dst[i].addr >> 32); + dst_sge->data_len.data_len_sl0 = len; dst_sge->ctrl.sl = QDMA_SG_SL_LONG; dst_sge->ctrl.fmt = QDMA_SG_FMT_SDB; #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA @@ -252,9 +372,10 @@ qdma_populate_sg_entry(struct rte_dpaa2_qdma_job **jobs, #else dst_sge->ctrl.bmt = QDMA_SG_BMT_DISABLE; #endif - total_len += jobs[i]->len; + total_len += len; + sg_cntx->cntx_idx[i] = idx; - if (i == (nb_jobs - 1)) { + if (i == (nb_sge - 1)) { src_sge->ctrl.f = QDMA_SG_F; dst_sge->ctrl.f = QDMA_SG_F; } else { @@ -265,327 +386,432 @@ qdma_populate_sg_entry(struct rte_dpaa2_qdma_job **jobs, dst_sge++; } + sg_cntx->job_nb = nb_sge; + return total_len; } -static inline int -dpdmai_dev_set_multi_fd_lf_no_rsp(struct qdma_virt_queue *qdma_vq, - struct qbman_fd *fd, - struct rte_dpaa2_qdma_job **job, - uint16_t nb_jobs) +static inline void +fle_populate(struct qbman_fle fle[], + struct qdma_sdd sdd[], uint64_t sdd_iova, + struct dpaa2_qdma_rbp *rbp, + uint64_t src_iova, uint64_t dst_iova, size_t len, + uint32_t fmt) { - struct dpaa2_qdma_rbp *rbp = &qdma_vq->rbp; - struct rte_dpaa2_qdma_job **ppjob; - uint16_t i; - void *elem; - struct qbman_fle *fle; - uint64_t elem_iova, fle_iova; + /* first frame list to source descriptor */ + DPAA2_SET_FLE_ADDR(&fle[DPAA2_QDMA_SDD_FLE], sdd_iova); + DPAA2_SET_FLE_LEN(&fle[DPAA2_QDMA_SDD_FLE], + (DPAA2_QDMA_MAX_SDD * (sizeof(struct qdma_sdd)))); - for (i = 0; i < nb_jobs; i++) { - elem = job[i]->usr_elem; -#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - elem_iova = rte_mempool_virt2iova(elem); -#else - elem_iova = DPAA2_VADDR_TO_IOVA(elem); -#endif + /* source and destination descriptor */ + if (rbp && rbp->enable) { + /* source */ + sdd[DPAA2_QDMA_SRC_SDD].read_cmd.portid = + rbp->sportid; + sdd[DPAA2_QDMA_SRC_SDD].rbpcmd_simple.pfid = + rbp->spfid; + sdd[DPAA2_QDMA_SRC_SDD].rbpcmd_simple.vfid = + rbp->svfid; + sdd[DPAA2_QDMA_SRC_SDD].rbpcmd_simple.vfa = + rbp->svfa; - ppjob = (struct rte_dpaa2_qdma_job **) - ((uintptr_t)(uint64_t)elem + - QDMA_FLE_SINGLE_JOB_OFFSET); - *ppjob = job[i]; + if (rbp->srbp) { + sdd[DPAA2_QDMA_SRC_SDD].read_cmd.rbp = + rbp->srbp; + sdd[DPAA2_QDMA_SRC_SDD].read_cmd.rdtype = + DPAA2_RBP_MEM_RW; + } else { + sdd[DPAA2_QDMA_SRC_SDD].read_cmd.rdtype = + dpaa2_coherent_no_alloc_cache; + } + /* destination */ + sdd[DPAA2_QDMA_DST_SDD].write_cmd.portid = + rbp->dportid; + sdd[DPAA2_QDMA_DST_SDD].rbpcmd_simple.pfid = + rbp->dpfid; + sdd[DPAA2_QDMA_DST_SDD].rbpcmd_simple.vfid = + rbp->dvfid; + sdd[DPAA2_QDMA_DST_SDD].rbpcmd_simple.vfa = + rbp->dvfa; - job[i]->vq_id = qdma_vq->vq_id; + if (rbp->drbp) { + sdd[DPAA2_QDMA_DST_SDD].write_cmd.rbp = + rbp->drbp; + sdd[DPAA2_QDMA_DST_SDD].write_cmd.wrttype = + DPAA2_RBP_MEM_RW; + } else { + sdd[DPAA2_QDMA_DST_SDD].write_cmd.wrttype = + dpaa2_coherent_alloc_cache; + } - fle = (struct qbman_fle *) - ((uintptr_t)(uint64_t)elem + QDMA_FLE_FLE_OFFSET); - fle_iova = elem_iova + QDMA_FLE_FLE_OFFSET; + } else { + sdd[DPAA2_QDMA_SRC_SDD].read_cmd.rdtype = + dpaa2_coherent_no_alloc_cache; + sdd[DPAA2_QDMA_DST_SDD].write_cmd.wrttype = + dpaa2_coherent_alloc_cache; + } + /* source frame list to source buffer */ + DPAA2_SET_FLE_ADDR(&fle[DPAA2_QDMA_SRC_FLE], src_iova); +#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA + DPAA2_SET_FLE_BMT(&fle[DPAA2_QDMA_SRC_FLE]); +#endif + fle[DPAA2_QDMA_SRC_FLE].word4.fmt = fmt; + DPAA2_SET_FLE_LEN(&fle[DPAA2_QDMA_SRC_FLE], len); - DPAA2_SET_FD_ADDR(&fd[i], fle_iova); - DPAA2_SET_FD_COMPOUND_FMT(&fd[i]); + /* destination frame list to destination buffer */ + DPAA2_SET_FLE_ADDR(&fle[DPAA2_QDMA_DST_FLE], dst_iova); +#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA + DPAA2_SET_FLE_BMT(&fle[DPAA2_QDMA_DST_FLE]); +#endif + fle[DPAA2_QDMA_DST_FLE].word4.fmt = fmt; + DPAA2_SET_FLE_LEN(&fle[DPAA2_QDMA_DST_FLE], len); - memset(fle, 0, DPAA2_QDMA_MAX_FLE * sizeof(struct qbman_fle) + - DPAA2_QDMA_MAX_SDD * sizeof(struct qdma_sdd)); + /* Final bit: 1, for last frame list */ + DPAA2_SET_FLE_FIN(&fle[DPAA2_QDMA_DST_FLE]); +} - dpaa2_qdma_populate_fle(fle, fle_iova, rbp, - job[i]->src, job[i]->dest, job[i]->len, - job[i]->flags, QBMAN_FLE_WORD4_FMT_SBF); - } +static inline void +fle_post_populate(struct qbman_fle fle[], + uint64_t src, uint64_t dest, size_t len) +{ + DPAA2_SET_FLE_ADDR(&fle[DPAA2_QDMA_SRC_FLE], src); + DPAA2_SET_FLE_LEN(&fle[DPAA2_QDMA_SRC_FLE], len); - return 0; + DPAA2_SET_FLE_ADDR(&fle[DPAA2_QDMA_DST_FLE], dest); + DPAA2_SET_FLE_LEN(&fle[DPAA2_QDMA_DST_FLE], len); } static inline int -dpdmai_dev_set_multi_fd_lf(struct qdma_virt_queue *qdma_vq, - struct qbman_fd *fd, - struct rte_dpaa2_qdma_job **job, - uint16_t nb_jobs) +dpaa2_qdma_submit(void *dev_private, uint16_t vchan) { - struct dpaa2_qdma_rbp *rbp = &qdma_vq->rbp; - struct rte_dpaa2_qdma_job **ppjob; - uint16_t i; + struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; + struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; + struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; + uint16_t expected = qdma_vq->fd_idx; int ret; - void *elem[DPAA2_QDMA_MAX_DESC]; - struct qbman_fle *fle; - uint64_t elem_iova, fle_iova; - ret = rte_mempool_get_bulk(qdma_vq->fle_pool, elem, nb_jobs); - if (ret) { - DPAA2_QDMA_DP_DEBUG("Memory alloc failed for FLE"); - return ret; - } + ret = dpaa2_qdma_multi_eq(qdma_vq); + if (likely(ret == expected)) + return 0; - for (i = 0; i < nb_jobs; i++) { -#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - elem_iova = rte_mempool_virt2iova(elem[i]); -#else - elem_iova = DPAA2_VADDR_TO_IOVA(elem[i]); -#endif + return -EBUSY; +} - ppjob = (struct rte_dpaa2_qdma_job **) - ((uintptr_t)(uint64_t)elem[i] + - QDMA_FLE_SINGLE_JOB_OFFSET); - *ppjob = job[i]; +static inline void +dpaa2_qdma_fle_dump(const struct qbman_fle *fle) +{ + DPAA2_QDMA_INFO("addr:0x%08x-0x%08x, len:%d, frc:0x%08x, bpid:%d", + fle->addr_hi, fle->addr_lo, fle->length, fle->frc, + fle->word4.bpid); + DPAA2_QDMA_INFO("ivp:%d, bmt:%d, off:%d, fmt:%d, sl:%d, f:%d", + fle->word4.ivp, fle->word4.bmt, fle->word4.offset, + fle->word4.fmt, fle->word4.sl, fle->word4.f); +} - job[i]->vq_id = qdma_vq->vq_id; +static inline void +dpaa2_qdma_sdd_dump(const struct qdma_sdd *sdd) +{ + DPAA2_QDMA_INFO("stride:%d, rbpcmd:0x%08x, cmd:0x%08x", + sdd->stride, sdd->rbpcmd, sdd->cmd); +} - fle = (struct qbman_fle *) - ((uintptr_t)(uint64_t)elem[i] + QDMA_FLE_FLE_OFFSET); - fle_iova = elem_iova + QDMA_FLE_FLE_OFFSET; +static inline void +dpaa2_qdma_sge_dump(const struct qdma_sg_entry *sge) +{ + DPAA2_QDMA_INFO("addr 0x%08x-0x%08x, len:0x%08x, ctl:0x%08x", + sge->addr_hi, sge->addr_lo, sge->data_len.data_len_sl0, + sge->ctrl_fields); +} - DPAA2_SET_FD_ADDR(&fd[i], fle_iova); - DPAA2_SET_FD_COMPOUND_FMT(&fd[i]); - DPAA2_SET_FD_FRC(&fd[i], QDMA_SER_CTX); +static void +dpaa2_qdma_long_fmt_dump(const struct qbman_fle *fle) +{ + int i; + const struct qdma_cntx_fle_sdd *fle_sdd; + const struct qdma_sdd *sdd; + const struct qdma_cntx_sg *cntx_sg = NULL; + const struct qdma_cntx_long *cntx_long = NULL; - memset(fle, 0, DPAA2_QDMA_MAX_FLE * sizeof(struct qbman_fle) + - DPAA2_QDMA_MAX_SDD * sizeof(struct qdma_sdd)); + fle_sdd = container_of(fle, const struct qdma_cntx_fle_sdd, fle[0]); + sdd = fle_sdd->sdd; - dpaa2_qdma_populate_fle(fle, fle_iova, rbp, - job[i]->src, job[i]->dest, job[i]->len, - job[i]->flags, QBMAN_FLE_WORD4_FMT_SBF); + for (i = 0; i < DPAA2_QDMA_MAX_FLE; i++) { + DPAA2_QDMA_INFO("fle[%d] info:", i); + dpaa2_qdma_fle_dump(&fle[i]); } - return 0; + if (fle[DPAA2_QDMA_SRC_FLE].word4.fmt != + fle[DPAA2_QDMA_DST_FLE].word4.fmt) { + DPAA2_QDMA_ERR("fle[%d].fmt(%d) != fle[%d].fmt(%d)", + DPAA2_QDMA_SRC_FLE, + fle[DPAA2_QDMA_SRC_FLE].word4.fmt, + DPAA2_QDMA_DST_FLE, + fle[DPAA2_QDMA_DST_FLE].word4.fmt); + + return; + } else if (fle[DPAA2_QDMA_SRC_FLE].word4.fmt == + QBMAN_FLE_WORD4_FMT_SGE) { + cntx_sg = container_of(fle_sdd, const struct qdma_cntx_sg, + fle_sdd); + } else if (fle[DPAA2_QDMA_SRC_FLE].word4.fmt == + QBMAN_FLE_WORD4_FMT_SBF) { + cntx_long = container_of(fle_sdd, const struct qdma_cntx_long, + fle_sdd); + } else { + DPAA2_QDMA_ERR("Unsupported fle format:%d", + fle[DPAA2_QDMA_SRC_FLE].word4.fmt); + return; + } + + for (i = 0; i < DPAA2_QDMA_MAX_SDD; i++) { + DPAA2_QDMA_INFO("sdd[%d] info:", i); + dpaa2_qdma_sdd_dump(&sdd[i]); + } + + if (cntx_long) { + DPAA2_QDMA_INFO("long format/Single buffer cntx idx:%d", + cntx_long->cntx_idx); + } + + if (cntx_sg) { + DPAA2_QDMA_INFO("long format/SG format, job number:%d", + cntx_sg->job_nb); + if (!cntx_sg->job_nb || + cntx_sg->job_nb > RTE_DPAA2_QDMA_JOB_SUBMIT_MAX) { + DPAA2_QDMA_ERR("Invalid SG job number:%d", + cntx_sg->job_nb); + return; + } + for (i = 0; i < cntx_sg->job_nb; i++) { + DPAA2_QDMA_INFO("sg[%d] src info:", i); + dpaa2_qdma_sge_dump(&cntx_sg->sg_src_entry[i]); + DPAA2_QDMA_INFO("sg[%d] dst info:", i); + dpaa2_qdma_sge_dump(&cntx_sg->sg_dst_entry[i]); + DPAA2_QDMA_INFO("cntx_idx[%d]:%d", i, + cntx_sg->cntx_idx[i]); + } + } } -static inline int -dpdmai_dev_set_sg_fd_lf(struct qdma_virt_queue *qdma_vq, - struct qbman_fd *fd, - struct rte_dpaa2_qdma_job **job, - uint16_t nb_jobs) +static int +dpaa2_qdma_copy_sg(void *dev_private, + uint16_t vchan, + const struct rte_dma_sge *src, + const struct rte_dma_sge *dst, + uint16_t nb_src, uint16_t nb_dst, + uint64_t flags) { - struct dpaa2_qdma_rbp *rbp = &qdma_vq->rbp; - struct rte_dpaa2_qdma_job **ppjob; - void *elem; + struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; + struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; + struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; + int ret = 0, expected; + uint32_t cntx_idx, len; + struct qbman_fd *fd = &qdma_vq->fd[qdma_vq->fd_idx]; + struct qdma_cntx_sg *cntx_sg; + rte_iova_t cntx_iova, fle_iova, sdd_iova; + rte_iova_t src_sge_iova, dst_sge_iova; struct qbman_fle *fle; - uint64_t elem_iova, fle_iova, src, dst; - int ret = 0, i; - struct qdma_sg_entry *src_sge, *dst_sge; - uint32_t len, fmt, flags; - - /* - * Get an FLE/SDD from FLE pool. - * Note: IO metadata is before the FLE and SDD memory. - */ - if (qdma_vq->flags & DPAA2_QDMA_VQ_NO_RESPONSE) { - elem = job[0]->usr_elem; + struct qdma_sdd *sdd; + + if (unlikely(nb_src != nb_dst)) + return -ENOTSUP; + + memset(fd, 0, sizeof(struct qbman_fd)); + + if (qdma_dev->is_silent) { + cntx_idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(src[0].length); + cntx_sg = qdma_vq->cntx_sg[cntx_idx]; } else { - ret = rte_mempool_get(qdma_vq->fle_pool, &elem); - if (ret) { - DPAA2_QDMA_DP_DEBUG("Memory alloc failed for FLE"); + ret = rte_mempool_get(qdma_vq->fle_pool, + (void **)&cntx_sg); + if (ret) return ret; - } + DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX); } #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - elem_iova = rte_mempool_virt2iova(elem); + cntx_iova = rte_mempool_virt2iova(cntx_sg); #else - elem_iova = DPAA2_VADDR_TO_IOVA(elem); + cntx_iova = DPAA2_VADDR_TO_IOVA(cntx_sg); #endif - /* Set the metadata */ - /* Save job context. */ - *((uint16_t *) - ((uintptr_t)(uint64_t)elem + QDMA_FLE_JOB_NB_OFFSET)) = nb_jobs; - ppjob = (struct rte_dpaa2_qdma_job **) - ((uintptr_t)(uint64_t)elem + QDMA_FLE_SG_JOBS_OFFSET); - for (i = 0; i < nb_jobs; i++) - ppjob[i] = job[i]; - - ppjob[0]->vq_id = qdma_vq->vq_id; - - fle = (struct qbman_fle *) - ((uintptr_t)(uint64_t)elem + QDMA_FLE_FLE_OFFSET); - fle_iova = elem_iova + QDMA_FLE_FLE_OFFSET; + fle = cntx_sg->fle_sdd.fle; + fle_iova = cntx_iova + + offsetof(struct qdma_cntx_sg, fle_sdd) + + offsetof(struct qdma_cntx_fle_sdd, fle); DPAA2_SET_FD_ADDR(fd, fle_iova); DPAA2_SET_FD_COMPOUND_FMT(fd); - if (!(qdma_vq->flags & DPAA2_QDMA_VQ_NO_RESPONSE)) - DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX); + DPAA2_SET_FD_FLC(fd, (uint64_t)cntx_sg); + + if (qdma_vq->fle_pre_populate) { + if (unlikely(!fle[DPAA2_QDMA_SRC_FLE].length)) + fle_sdd_sg_pre_populate(cntx_sg, qdma_vq); - /* Populate FLE */ - if (likely(nb_jobs > 1)) { - src_sge = (struct qdma_sg_entry *) - ((uintptr_t)(uint64_t)elem + QDMA_FLE_SG_ENTRY_OFFSET); - dst_sge = src_sge + DPAA2_QDMA_MAX_SG_NB; - src = elem_iova + QDMA_FLE_SG_ENTRY_OFFSET; - dst = src + - DPAA2_QDMA_MAX_SG_NB * sizeof(struct qdma_sg_entry); - len = qdma_populate_sg_entry(job, src_sge, dst_sge, nb_jobs); - fmt = QBMAN_FLE_WORD4_FMT_SGE; - flags = RTE_DPAA2_QDMA_JOB_SRC_PHY | RTE_DPAA2_QDMA_JOB_DEST_PHY; + len = sg_entry_post_populate(src, dst, + cntx_sg, nb_src); + sg_fle_post_populate(fle, len); } else { - src = job[0]->src; - dst = job[0]->dest; - len = job[0]->len; - fmt = QBMAN_FLE_WORD4_FMT_SBF; - flags = job[0]->flags; + sdd = cntx_sg->fle_sdd.sdd; + sdd_iova = cntx_iova + + offsetof(struct qdma_cntx_sg, fle_sdd) + + offsetof(struct qdma_cntx_fle_sdd, sdd); + src_sge_iova = cntx_iova + + offsetof(struct qdma_cntx_sg, sg_src_entry); + dst_sge_iova = cntx_iova + + offsetof(struct qdma_cntx_sg, sg_dst_entry); + len = sg_entry_populate(src, dst, + cntx_sg, nb_src); + + fle_populate(fle, sdd, sdd_iova, + &qdma_vq->rbp, src_sge_iova, dst_sge_iova, len, + QBMAN_FLE_WORD4_FMT_SGE); } - memset(fle, 0, DPAA2_QDMA_MAX_FLE * sizeof(struct qbman_fle) + - DPAA2_QDMA_MAX_SDD * sizeof(struct qdma_sdd)); - - dpaa2_qdma_populate_fle(fle, fle_iova, rbp, - src, dst, len, flags, fmt); - - return 0; -} - -static inline uint16_t -dpdmai_dev_get_job_us(struct qdma_virt_queue *qdma_vq __rte_unused, - const struct qbman_fd *fd, - struct rte_dpaa2_qdma_job **job, uint16_t *nb_jobs) -{ - uint16_t vqid; - size_t iova; - struct rte_dpaa2_qdma_job **ppjob; + if (unlikely(qdma_vq->flags & DPAA2_QDMA_DESC_DEBUG_FLAG)) + dpaa2_qdma_long_fmt_dump(cntx_sg->fle_sdd.fle); - if (fd->simple_pci.saddr_hi & (QDMA_RBP_UPPER_ADDRESS_MASK >> 32)) - iova = (size_t)(((uint64_t)fd->simple_pci.daddr_hi) << 32 - | (uint64_t)fd->simple_pci.daddr_lo); - else - iova = (size_t)(((uint64_t)fd->simple_pci.saddr_hi) << 32 - | (uint64_t)fd->simple_pci.saddr_lo); + qdma_vq->fd_idx++; - ppjob = (struct rte_dpaa2_qdma_job **)DPAA2_IOVA_TO_VADDR(iova) - 1; - *job = (struct rte_dpaa2_qdma_job *)*ppjob; - (*job)->status = (fd->simple_pci.acc_err << 8) | - (fd->simple_pci.error); - vqid = (*job)->vq_id; - *nb_jobs = 1; + if (flags & RTE_DMA_OP_FLAG_SUBMIT) { + expected = qdma_vq->fd_idx; + ret = dpaa2_qdma_multi_eq(qdma_vq); + if (likely(ret == expected)) + return 0; + } else { + return 0; + } - return vqid; + return ret; } -static inline uint16_t -dpdmai_dev_get_single_job_lf(struct qdma_virt_queue *qdma_vq, - const struct qbman_fd *fd, - struct rte_dpaa2_qdma_job **job, - uint16_t *nb_jobs) +static int +dpaa2_qdma_copy(void *dev_private, uint16_t vchan, + rte_iova_t src, rte_iova_t dst, + uint32_t length, uint64_t flags) { + struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; + struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; + struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; + int ret = 0, expected; + uint16_t cntx_idx; + uint32_t len; + struct qbman_fd *fd = &qdma_vq->fd[qdma_vq->fd_idx]; + struct qdma_cntx_long *cntx_long; + rte_iova_t cntx_iova, fle_iova, sdd_iova; struct qbman_fle *fle; - struct rte_dpaa2_qdma_job **ppjob = NULL; - uint16_t status; + struct qdma_sdd *sdd; - /* - * Fetch metadata from FLE. job and vq_id were set - * in metadata in the enqueue operation. - */ - fle = (struct qbman_fle *) - DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)); + memset(fd, 0, sizeof(struct qbman_fd)); - *nb_jobs = 1; - ppjob = (struct rte_dpaa2_qdma_job **)((uintptr_t)(uint64_t)fle - - QDMA_FLE_FLE_OFFSET + QDMA_FLE_SINGLE_JOB_OFFSET); + cntx_idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(length); + len = RTE_DPAA2_QDMA_LEN_FROM_LENGTH(length); - status = (DPAA2_GET_FD_ERR(fd) << 8) | (DPAA2_GET_FD_FRC(fd) & 0xFF); + if (qdma_dev->is_silent) { + cntx_long = qdma_vq->cntx_long[cntx_idx]; + } else { + ret = rte_mempool_get(qdma_vq->fle_pool, + (void **)&cntx_long); + if (ret) + return ret; + DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX); + cntx_long->cntx_idx = cntx_idx; + } - *job = *ppjob; - (*job)->status = status; +#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA + cntx_iova = rte_mempool_virt2iova(cntx_long); +#else + cntx_iova = DPAA2_VADDR_TO_IOVA(cntx_long); +#endif - /* Free FLE to the pool */ - rte_mempool_put(qdma_vq->fle_pool, - (void *) - ((uintptr_t)(uint64_t)fle - QDMA_FLE_FLE_OFFSET)); + fle = cntx_long->fle_sdd.fle; + fle_iova = cntx_iova + + offsetof(struct qdma_cntx_long, fle_sdd) + + offsetof(struct qdma_cntx_fle_sdd, fle); - return (*job)->vq_id; -} + DPAA2_SET_FD_ADDR(fd, fle_iova); + DPAA2_SET_FD_COMPOUND_FMT(fd); + DPAA2_SET_FD_FLC(fd, (uint64_t)cntx_long); -static inline uint16_t -dpdmai_dev_get_sg_job_lf(struct qdma_virt_queue *qdma_vq, - const struct qbman_fd *fd, - struct rte_dpaa2_qdma_job **job, - uint16_t *nb_jobs) -{ - struct qbman_fle *fle; - struct rte_dpaa2_qdma_job **ppjob = NULL; - uint16_t i, status; + if (qdma_vq->fle_pre_populate) { + if (unlikely(!fle[DPAA2_QDMA_SRC_FLE].length)) { + fle_sdd_pre_populate(&cntx_long->fle_sdd, + &qdma_vq->rbp, + 0, 0, QBMAN_FLE_WORD4_FMT_SBF); + } - /* - * Fetch metadata from FLE. job and vq_id were set - * in metadata in the enqueue operation. - */ - fle = (struct qbman_fle *) - DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)); - *nb_jobs = *((uint16_t *)((uintptr_t)(uint64_t)fle - - QDMA_FLE_FLE_OFFSET + QDMA_FLE_JOB_NB_OFFSET)); - ppjob = (struct rte_dpaa2_qdma_job **)((uintptr_t)(uint64_t)fle - - QDMA_FLE_FLE_OFFSET + QDMA_FLE_SG_JOBS_OFFSET); - status = (DPAA2_GET_FD_ERR(fd) << 8) | (DPAA2_GET_FD_FRC(fd) & 0xFF); - - for (i = 0; i < (*nb_jobs); i++) { - job[i] = ppjob[i]; - job[i]->status = status; + fle_post_populate(fle, src, dst, len); + } else { + sdd = cntx_long->fle_sdd.sdd; + sdd_iova = cntx_iova + + offsetof(struct qdma_cntx_long, fle_sdd) + + offsetof(struct qdma_cntx_fle_sdd, sdd); + fle_populate(fle, sdd, sdd_iova, &qdma_vq->rbp, + src, dst, len, + QBMAN_FLE_WORD4_FMT_SBF); } - /* Free FLE to the pool */ - rte_mempool_put(qdma_vq->fle_pool, - (void *) - ((uintptr_t)(uint64_t)fle - QDMA_FLE_FLE_OFFSET)); + if (unlikely(qdma_vq->flags & DPAA2_QDMA_DESC_DEBUG_FLAG)) + dpaa2_qdma_long_fmt_dump(cntx_long->fle_sdd.fle); - return job[0]->vq_id; + qdma_vq->fd_idx++; + + if (flags & RTE_DMA_OP_FLAG_SUBMIT) { + expected = qdma_vq->fd_idx; + ret = dpaa2_qdma_multi_eq(qdma_vq); + if (likely(ret == expected)) + return 0; + } else { + return 0; + } + + return ret; } -/* Function to receive a QDMA job for a given device and queue*/ -static int -dpdmai_dev_dequeue_multijob_prefetch(struct qdma_virt_queue *qdma_vq, - uint16_t *vq_id, - struct rte_dpaa2_qdma_job **job, - uint16_t nb_jobs) +static uint16_t +dpaa2_qdma_dequeue(void *dev_private, + uint16_t vchan, const uint16_t nb_cpls, + uint16_t *cntx_idx, bool *has_error) { - struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_vq->dpdmai_dev; + struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; + struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; + struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; + struct dpaa2_queue *rxq; struct qbman_result *dq_storage, *dq_storage1 = NULL; struct qbman_pull_desc pulldesc; struct qbman_swp *swp; struct queue_storage_info_t *q_storage; + uint32_t fqid; uint8_t status, pending; uint8_t num_rx = 0; const struct qbman_fd *fd; - uint16_t vqid, num_rx_ret; - uint16_t rx_fqid; int ret, pull_size; + struct qbman_fle *fle; + struct qdma_cntx_fle_sdd *fle_sdd; + struct qdma_cntx_sg *cntx_sg; + struct qdma_cntx_long *cntx_long; + uint16_t free_space = 0, fle_elem_nb = 0; - if (qdma_vq->flags & DPAA2_QDMA_VQ_FD_SG_FORMAT) { - /** Make sure there are enough space to get jobs.*/ - if (unlikely(nb_jobs < DPAA2_QDMA_MAX_SG_NB)) - return -EINVAL; - nb_jobs = 1; - } + if (unlikely(qdma_dev->is_silent)) + return 0; if (unlikely(!DPAA2_PER_LCORE_DPIO)) { ret = dpaa2_affine_qbman_swp(); if (ret) { - DPAA2_QDMA_ERR("Failed to allocate IO portal, tid(%d)", + DPAA2_QDMA_ERR("Allocate portal err, tid(%d)", rte_gettid()); + if (has_error) + *has_error = true; return 0; } } swp = DPAA2_PER_LCORE_PORTAL; - rxq = &dpdmai_dev->rx_queue[qdma_vq->vq_id]; - rx_fqid = rxq->fqid; - pull_size = (nb_jobs > dpaa2_dqrr_size) ? - dpaa2_dqrr_size : nb_jobs; + pull_size = (nb_cpls > dpaa2_dqrr_size) ? + dpaa2_dqrr_size : nb_cpls; + rxq = &(dpdmai_dev->rx_queue[qdma_vq->vq_id]); + fqid = rxq->fqid; q_storage = rxq->q_storage; if (unlikely(!q_storage->active_dqs)) { @@ -594,21 +820,20 @@ dpdmai_dev_dequeue_multijob_prefetch(struct qdma_virt_queue *qdma_vq, q_storage->last_num_pkts = pull_size; qbman_pull_desc_clear(&pulldesc); qbman_pull_desc_set_numframes(&pulldesc, - q_storage->last_num_pkts); - qbman_pull_desc_set_fq(&pulldesc, rx_fqid); + q_storage->last_num_pkts); + qbman_pull_desc_set_fq(&pulldesc, fqid); qbman_pull_desc_set_storage(&pulldesc, dq_storage, - (size_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); + (size_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) { while (!qbman_check_command_complete( - get_swp_active_dqs( - DPAA2_PER_LCORE_DPIO->index))) + get_swp_active_dqs( + DPAA2_PER_LCORE_DPIO->index))) ; clear_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index); } while (1) { if (qbman_swp_pull(swp, &pulldesc)) { - DPAA2_QDMA_DP_WARN( - "VDQ command not issued.QBMAN busy\n"); + DPAA2_QDMA_DP_WARN("QBMAN busy"); /* Portal was busy, try again */ continue; } @@ -617,7 +842,7 @@ dpdmai_dev_dequeue_multijob_prefetch(struct qdma_virt_queue *qdma_vq, q_storage->active_dqs = dq_storage; q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index; set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index, - dq_storage); + dq_storage); } dq_storage = q_storage->active_dqs; @@ -631,7 +856,7 @@ dpdmai_dev_dequeue_multijob_prefetch(struct qdma_virt_queue *qdma_vq, dq_storage1 = q_storage->dq_storage[q_storage->toggle]; qbman_pull_desc_clear(&pulldesc); qbman_pull_desc_set_numframes(&pulldesc, pull_size); - qbman_pull_desc_set_fq(&pulldesc, rx_fqid); + qbman_pull_desc_set_fq(&pulldesc, fqid); qbman_pull_desc_set_storage(&pulldesc, dq_storage1, (size_t)(DPAA2_VADDR_TO_IOVA(dq_storage1)), 1); @@ -664,27 +889,40 @@ dpdmai_dev_dequeue_multijob_prefetch(struct qdma_virt_queue *qdma_vq, continue; } fd = qbman_result_DQ_fd(dq_storage); - - vqid = qdma_vq->get_job(qdma_vq, fd, &job[num_rx], - &num_rx_ret); - if (vq_id) - vq_id[num_rx] = vqid; + fle_sdd = (void *)(uintptr_t)DPAA2_GET_FD_FLC(fd); + fle = fle_sdd->fle; + qdma_vq->fle_elem[fle_elem_nb] = fle_sdd; + fle_elem_nb++; + if (fle[DPAA2_QDMA_SRC_FLE].word4.fmt == + QBMAN_FLE_WORD4_FMT_SGE) { + cntx_sg = container_of(fle_sdd, + struct qdma_cntx_sg, fle_sdd); + ret = qdma_cntx_idx_ring_eq(qdma_vq->ring_cntx_idx, + cntx_sg->cntx_idx, + cntx_sg->job_nb, &free_space); + } else { + cntx_long = container_of(fle_sdd, + struct qdma_cntx_long, fle_sdd); + ret = qdma_cntx_idx_ring_eq(qdma_vq->ring_cntx_idx, + &cntx_long->cntx_idx, + 1, &free_space); + } + if (!ret || free_space < RTE_DPAA2_QDMA_JOB_SUBMIT_MAX) + pending = 0; dq_storage++; - num_rx += num_rx_ret; } while (pending); if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) { while (!qbman_check_command_complete( - get_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index))) + get_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index))) ; clear_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index); } /* issue a volatile dequeue command for next pull */ while (1) { if (qbman_swp_pull(swp, &pulldesc)) { - DPAA2_QDMA_DP_WARN( - "VDQ command is not issued. QBMAN is busy (2)\n"); + DPAA2_QDMA_DP_WARN("QBMAN is busy (2)"); continue; } break; @@ -694,387 +932,18 @@ dpdmai_dev_dequeue_multijob_prefetch(struct qdma_virt_queue *qdma_vq, q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index; set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index, dq_storage1); - return num_rx; -} - -static int -dpdmai_dev_dequeue_multijob_no_prefetch(struct qdma_virt_queue *qdma_vq, - uint16_t *vq_id, - struct rte_dpaa2_qdma_job **job, - uint16_t nb_jobs) -{ - struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_vq->dpdmai_dev; - struct dpaa2_queue *rxq; - struct qbman_result *dq_storage; - struct qbman_pull_desc pulldesc; - struct qbman_swp *swp; - uint8_t status, pending; - uint8_t num_rx = 0; - const struct qbman_fd *fd; - uint16_t vqid, num_rx_ret; - uint16_t rx_fqid; - int ret, next_pull, num_pulled = 0; - - if (qdma_vq->flags & DPAA2_QDMA_VQ_FD_SG_FORMAT) { - /** Make sure there are enough space to get jobs.*/ - if (unlikely(nb_jobs < DPAA2_QDMA_MAX_SG_NB)) - return -EINVAL; - nb_jobs = 1; - } - - next_pull = nb_jobs; - - if (unlikely(!DPAA2_PER_LCORE_DPIO)) { - ret = dpaa2_affine_qbman_swp(); - if (ret) { - DPAA2_QDMA_ERR("Failed to allocate IO portal, tid(%d)", - rte_gettid()); - return 0; - } - } - swp = DPAA2_PER_LCORE_PORTAL; - - rxq = &dpdmai_dev->rx_queue[qdma_vq->vq_id]; - rx_fqid = rxq->fqid; + rte_mempool_put_bulk(qdma_vq->fle_pool, + qdma_vq->fle_elem, fle_elem_nb); - do { - dq_storage = rxq->q_storage->dq_storage[0]; - /* Prepare dequeue descriptor */ - qbman_pull_desc_clear(&pulldesc); - qbman_pull_desc_set_fq(&pulldesc, rx_fqid); - qbman_pull_desc_set_storage(&pulldesc, dq_storage, - (uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); + num_rx = qdma_cntx_idx_ring_dq(qdma_vq->ring_cntx_idx, + cntx_idx, nb_cpls); - if (next_pull > dpaa2_dqrr_size) { - qbman_pull_desc_set_numframes(&pulldesc, - dpaa2_dqrr_size); - next_pull -= dpaa2_dqrr_size; - } else { - qbman_pull_desc_set_numframes(&pulldesc, next_pull); - next_pull = 0; - } - - while (1) { - if (qbman_swp_pull(swp, &pulldesc)) { - DPAA2_QDMA_DP_WARN( - "VDQ command not issued. QBMAN busy"); - /* Portal was busy, try again */ - continue; - } - break; - } - - rte_prefetch0((void *)((size_t)(dq_storage + 1))); - /* Check if the previous issued command is completed. */ - while (!qbman_check_command_complete(dq_storage)) - ; - - num_pulled = 0; - pending = 1; - - do { - /* Loop until dq_storage is updated - * with new token by QBMAN - */ - while (!qbman_check_new_result(dq_storage)) - ; - rte_prefetch0((void *)((size_t)(dq_storage + 2))); - - if (qbman_result_DQ_is_pull_complete(dq_storage)) { - pending = 0; - /* Check for valid frame. */ - status = qbman_result_DQ_flags(dq_storage); - if (unlikely((status & - QBMAN_DQ_STAT_VALIDFRAME) == 0)) - continue; - } - fd = qbman_result_DQ_fd(dq_storage); - - vqid = qdma_vq->get_job(qdma_vq, fd, - &job[num_rx], &num_rx_ret); - if (vq_id) - vq_id[num_rx] = vqid; - - dq_storage++; - num_rx += num_rx_ret; - num_pulled++; - - } while (pending); - /* Last VDQ provided all packets and more packets are requested */ - } while (next_pull && num_pulled == dpaa2_dqrr_size); + if (has_error) + *has_error = false; return num_rx; } -static int -dpdmai_dev_submit_multi(struct qdma_virt_queue *qdma_vq, - struct rte_dpaa2_qdma_job **job, - uint16_t nb_jobs) -{ - struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_vq->dpdmai_dev; - uint16_t txq_id = dpdmai_dev->tx_queue[qdma_vq->vq_id].fqid; - struct qbman_fd fd[DPAA2_QDMA_MAX_DESC]; - struct qbman_eq_desc eqdesc; - struct qbman_swp *swp; - uint32_t num_to_send = 0; - uint16_t num_tx = 0; - uint32_t enqueue_loop, loop; - int ret; - - if (unlikely(!DPAA2_PER_LCORE_DPIO)) { - ret = dpaa2_affine_qbman_swp(); - if (ret) { - DPAA2_QDMA_ERR( - "Failed to allocate IO portal, tid: %d\n", - rte_gettid()); - return 0; - } - } - swp = DPAA2_PER_LCORE_PORTAL; - - /* Prepare enqueue descriptor */ - qbman_eq_desc_clear(&eqdesc); - qbman_eq_desc_set_fq(&eqdesc, txq_id); - qbman_eq_desc_set_no_orp(&eqdesc, 0); - qbman_eq_desc_set_response(&eqdesc, 0, 0); - - if (qdma_vq->flags & DPAA2_QDMA_VQ_FD_SG_FORMAT) { - uint16_t fd_nb; - uint16_t sg_entry_nb = nb_jobs > DPAA2_QDMA_MAX_SG_NB ? - DPAA2_QDMA_MAX_SG_NB : nb_jobs; - uint16_t job_idx = 0; - uint16_t fd_sg_nb[8]; - uint16_t nb_jobs_ret = 0; - - if (nb_jobs % DPAA2_QDMA_MAX_SG_NB) - fd_nb = nb_jobs / DPAA2_QDMA_MAX_SG_NB + 1; - else - fd_nb = nb_jobs / DPAA2_QDMA_MAX_SG_NB; - - memset(&fd[0], 0, sizeof(struct qbman_fd) * fd_nb); - - for (loop = 0; loop < fd_nb; loop++) { - ret = qdma_vq->set_fd(qdma_vq, &fd[loop], &job[job_idx], - sg_entry_nb); - if (unlikely(ret < 0)) - return 0; - fd_sg_nb[loop] = sg_entry_nb; - nb_jobs -= sg_entry_nb; - job_idx += sg_entry_nb; - sg_entry_nb = nb_jobs > DPAA2_QDMA_MAX_SG_NB ? - DPAA2_QDMA_MAX_SG_NB : nb_jobs; - } - - /* Enqueue the packet to the QBMAN */ - enqueue_loop = 0; - - while (enqueue_loop < fd_nb) { - ret = qbman_swp_enqueue_multiple(swp, - &eqdesc, &fd[enqueue_loop], - NULL, fd_nb - enqueue_loop); - if (likely(ret >= 0)) { - for (loop = 0; loop < (uint32_t)ret; loop++) - nb_jobs_ret += - fd_sg_nb[enqueue_loop + loop]; - enqueue_loop += ret; - } - } - - return nb_jobs_ret; - } - - memset(fd, 0, nb_jobs * sizeof(struct qbman_fd)); - - while (nb_jobs > 0) { - num_to_send = (nb_jobs > dpaa2_eqcr_size) ? - dpaa2_eqcr_size : nb_jobs; - - ret = qdma_vq->set_fd(qdma_vq, &fd[num_tx], - &job[num_tx], num_to_send); - if (unlikely(ret < 0)) - break; - - /* Enqueue the packet to the QBMAN */ - enqueue_loop = 0; - loop = num_to_send; - - while (enqueue_loop < loop) { - ret = qbman_swp_enqueue_multiple(swp, - &eqdesc, - &fd[num_tx + enqueue_loop], - NULL, - loop - enqueue_loop); - if (likely(ret >= 0)) - enqueue_loop += ret; - } - num_tx += num_to_send; - nb_jobs -= loop; - } - - qdma_vq->num_enqueues += num_tx; - - return num_tx; -} - -static inline int -dpaa2_qdma_submit(void *dev_private, uint16_t vchan) -{ - struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; - struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; - struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; - - dpdmai_dev_submit_multi(qdma_vq, qdma_vq->job_list, - qdma_vq->num_valid_jobs); - - qdma_vq->num_valid_jobs = 0; - - return 0; -} - -static int -dpaa2_qdma_enqueue(void *dev_private, uint16_t vchan, - rte_iova_t src, rte_iova_t dst, - uint32_t length, uint64_t flags) -{ - struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; - struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; - struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; - struct rte_dpaa2_qdma_job *job; - int idx, ret; - - idx = (uint16_t)(qdma_vq->num_enqueues + qdma_vq->num_valid_jobs); - - ret = rte_mempool_get(qdma_vq->job_pool, (void **)&job); - if (ret) { - DPAA2_QDMA_DP_DEBUG("Memory alloc failed for FLE"); - return -ENOSPC; - } - - job->src = src; - job->dest = dst; - job->len = length; - job->flags = flags; - job->status = 0; - job->vq_id = vchan; - - qdma_vq->job_list[qdma_vq->num_valid_jobs] = job; - qdma_vq->num_valid_jobs++; - - if (flags & RTE_DMA_OP_FLAG_SUBMIT) - dpaa2_qdma_submit(dev_private, vchan); - - return idx; -} - -int -rte_dpaa2_qdma_copy_multi(int16_t dev_id, uint16_t vchan, - struct rte_dpaa2_qdma_job **jobs, - uint16_t nb_cpls) -{ - struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id]; - struct dpaa2_dpdmai_dev *dpdmai_dev = obj->dev_private; - struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; - struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; - - return dpdmai_dev_submit_multi(qdma_vq, jobs, nb_cpls); -} - -static uint16_t -dpaa2_qdma_dequeue_multi(struct qdma_virt_queue *qdma_vq, - struct rte_dpaa2_qdma_job **jobs, - uint16_t nb_jobs) -{ - int ret; - - if (qdma_vq->flags & DPAA2_QDMA_VQ_FD_SG_FORMAT) { - /** Make sure there are enough space to get jobs.*/ - if (unlikely(nb_jobs < DPAA2_QDMA_MAX_SG_NB)) - return -EINVAL; - } - - /* Only dequeue when there are pending jobs on VQ */ - if (qdma_vq->num_enqueues == qdma_vq->num_dequeues) - return 0; - - if (!(qdma_vq->flags & DPAA2_QDMA_VQ_FD_SG_FORMAT) && - qdma_vq->num_enqueues < (qdma_vq->num_dequeues + nb_jobs)) - nb_jobs = RTE_MIN((qdma_vq->num_enqueues - - qdma_vq->num_dequeues), nb_jobs); - - ret = qdma_vq->dequeue_job(qdma_vq, NULL, jobs, nb_jobs); - if (ret < 0) { - DPAA2_QDMA_ERR("Dequeue from DMA%d-q%d failed(%d)", - qdma_vq->dpdmai_dev->dpdmai_id, - qdma_vq->vq_id, ret); - return ret; - } - - qdma_vq->num_dequeues += ret; - return ret; -} - -static uint16_t -dpaa2_qdma_dequeue_status(void *dev_private, uint16_t vchan, - const uint16_t nb_cpls, - uint16_t *last_idx, - enum rte_dma_status_code *st) -{ - struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; - struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; - struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; - struct rte_dpaa2_qdma_job *jobs[DPAA2_QDMA_MAX_DESC]; - int ret, i; - - ret = dpaa2_qdma_dequeue_multi(qdma_vq, jobs, nb_cpls); - - for (i = 0; i < ret; i++) - st[i] = jobs[i]->status; - - rte_mempool_put_bulk(qdma_vq->job_pool, (void **)jobs, ret); - - if (last_idx != NULL) - *last_idx = (uint16_t)(qdma_vq->num_dequeues - 1); - - return ret; -} - -static uint16_t -dpaa2_qdma_dequeue(void *dev_private, - uint16_t vchan, const uint16_t nb_cpls, - uint16_t *last_idx, bool *has_error) -{ - struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; - struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; - struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; - struct rte_dpaa2_qdma_job *jobs[DPAA2_QDMA_MAX_DESC]; - int ret; - - RTE_SET_USED(has_error); - - ret = dpaa2_qdma_dequeue_multi(qdma_vq, - jobs, nb_cpls); - - rte_mempool_put_bulk(qdma_vq->job_pool, (void **)jobs, ret); - - if (last_idx != NULL) - *last_idx = (uint16_t)(qdma_vq->num_dequeues - 1); - - return ret; -} - -uint16_t -rte_dpaa2_qdma_completed_multi(int16_t dev_id, uint16_t vchan, - struct rte_dpaa2_qdma_job **jobs, - uint16_t nb_cpls) -{ - struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id]; - struct dpaa2_dpdmai_dev *dpdmai_dev = obj->dev_private; - struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; - struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; - - return dpaa2_qdma_dequeue_multi(qdma_vq, jobs, nb_cpls); -} - static int dpaa2_qdma_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_info, @@ -1119,80 +988,22 @@ dpaa2_qdma_configure(struct rte_dma_dev *dev, /* Allocate Virtual Queues */ sprintf(name, "qdma_%d_vq", dev->data->dev_id); qdma_dev->vqs = rte_malloc(name, - (sizeof(struct qdma_virt_queue) * dev_conf->nb_vchans), - RTE_CACHE_LINE_SIZE); + (sizeof(struct qdma_virt_queue) * dev_conf->nb_vchans), + RTE_CACHE_LINE_SIZE); if (!qdma_dev->vqs) { - DPAA2_QDMA_ERR("qdma_virtual_queues allocation failed"); + DPAA2_QDMA_ERR("%s: VQs(%d) alloc failed.", + dev->data->dev_name, dev_conf->nb_vchans); return -ENOMEM; } for (i = 0; i < dev_conf->nb_vchans; i++) qdma_dev->vqs[i].vq_id = i; qdma_dev->num_vqs = dev_conf->nb_vchans; + qdma_dev->is_silent = dev_conf->enable_silent; return 0; } -static int -check_devargs_handler(__rte_unused const char *key, - const char *value, - __rte_unused void *opaque) -{ - if (strcmp(value, "1")) - return -1; - - return 0; -} - -static int -dpaa2_qdma_get_devargs(struct rte_devargs *devargs, const char *key) -{ - struct rte_kvargs *kvlist; - - if (!devargs) - return 0; - - kvlist = rte_kvargs_parse(devargs->args, NULL); - if (!kvlist) - return 0; - - if (!rte_kvargs_count(kvlist, key)) { - rte_kvargs_free(kvlist); - return 0; - } - - if (rte_kvargs_process(kvlist, key, - check_devargs_handler, NULL) < 0) { - rte_kvargs_free(kvlist); - return 0; - } - rte_kvargs_free(kvlist); - - return 1; -} - -/* Enable FD in Ultra Short format */ -void -rte_dpaa2_qdma_vchan_fd_us_enable(int16_t dev_id, uint16_t vchan) -{ - struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id]; - struct dpaa2_dpdmai_dev *dpdmai_dev = obj->dev_private; - struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; - - qdma_dev->vqs[vchan].flags |= DPAA2_QDMA_VQ_FD_SHORT_FORMAT; -} - -/* Enable internal SG processing */ -void -rte_dpaa2_qdma_vchan_internal_sg_enable(int16_t dev_id, uint16_t vchan) -{ - struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id]; - struct dpaa2_dpdmai_dev *dpdmai_dev = obj->dev_private; - struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; - - qdma_dev->vqs[vchan].flags |= DPAA2_QDMA_VQ_FD_SG_FORMAT; -} - static int dpaa2_qdma_vchan_rbp_set(struct qdma_virt_queue *vq, const struct rte_dma_vchan_conf *conf) @@ -1236,8 +1047,8 @@ dpaa2_qdma_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan, struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; uint32_t pool_size; char pool_name[64]; - int fd_long_format = 1; - int sg_enable = 0, ret; + int ret; + char *env = NULL; DPAA2_QDMA_FUNC_TRACE(); @@ -1247,85 +1058,70 @@ dpaa2_qdma_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan, if (ret) return ret; - if (qdma_dev->vqs[vchan].flags & DPAA2_QDMA_VQ_FD_SG_FORMAT) - sg_enable = 1; - - if (qdma_dev->vqs[vchan].flags & DPAA2_QDMA_VQ_FD_SHORT_FORMAT) - fd_long_format = 0; - - if (dev->data->dev_conf.enable_silent) - qdma_dev->vqs[vchan].flags |= DPAA2_QDMA_VQ_NO_RESPONSE; + /**Default enable FLE PRE POPULATE*/ + env = getenv("DPAA2_QDMA_FLE_PRE_POPULATE"); + if (env) + qdma_dev->vqs[vchan].fle_pre_populate = atoi(env); + else + qdma_dev->vqs[vchan].fle_pre_populate = 1; - if (sg_enable) { - if (qdma_dev->num_vqs != 1) { - DPAA2_QDMA_ERR( - "qDMA SG format only supports physical queue!"); - return -ENODEV; - } - if (!fd_long_format) { - DPAA2_QDMA_ERR( - "qDMA SG format only supports long FD format!"); - return -ENODEV; - } - pool_size = QDMA_FLE_SG_POOL_SIZE; - } else { - pool_size = QDMA_FLE_SINGLE_POOL_SIZE; - } + env = getenv("DPAA2_QDMA_DESC_DEBUG"); + if (env && atoi(env)) + qdma_dev->vqs[vchan].flags |= DPAA2_QDMA_DESC_DEBUG_FLAG; + else + qdma_dev->vqs[vchan].flags &= (~DPAA2_QDMA_DESC_DEBUG_FLAG); snprintf(pool_name, sizeof(pool_name), "qdma_fle_pool_dev%d_qid%d", dpdmai_dev->dpdmai_id, vchan); + pool_size = RTE_MAX(sizeof(struct qdma_cntx_sg), + sizeof(struct qdma_cntx_long)); + qdma_dev->vqs[vchan].fle_pool = rte_mempool_create(pool_name, - conf->nb_desc, pool_size, - QDMA_FLE_CACHE_SIZE(conf->nb_desc), 0, - NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0); + DPAA2_QDMA_MAX_DESC * 2, pool_size, + 512, 0, NULL, NULL, NULL, NULL, + SOCKET_ID_ANY, 0); if (!qdma_dev->vqs[vchan].fle_pool) { - DPAA2_QDMA_ERR("qdma_fle_pool create failed"); - return -ENOMEM; - } - - snprintf(pool_name, sizeof(pool_name), - "qdma_job_pool_dev%d_qid%d", dpdmai_dev->dpdmai_id, vchan); - qdma_dev->vqs[vchan].job_pool = rte_mempool_create(pool_name, - conf->nb_desc, pool_size, - QDMA_FLE_CACHE_SIZE(conf->nb_desc), 0, - NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0); - if (!qdma_dev->vqs[vchan].job_pool) { - DPAA2_QDMA_ERR("qdma_job_pool create failed"); + DPAA2_QDMA_ERR("%s create failed", pool_name); return -ENOMEM; } - if (fd_long_format) { - if (sg_enable) { - qdma_dev->vqs[vchan].set_fd = dpdmai_dev_set_sg_fd_lf; - qdma_dev->vqs[vchan].get_job = dpdmai_dev_get_sg_job_lf; - } else { - if (dev->data->dev_conf.enable_silent) - qdma_dev->vqs[vchan].set_fd = - dpdmai_dev_set_multi_fd_lf_no_rsp; - else - qdma_dev->vqs[vchan].set_fd = - dpdmai_dev_set_multi_fd_lf; - qdma_dev->vqs[vchan].get_job = dpdmai_dev_get_single_job_lf; + if (qdma_dev->is_silent) { + ret = rte_mempool_get_bulk(qdma_dev->vqs[vchan].fle_pool, + (void **)qdma_dev->vqs[vchan].cntx_sg, + DPAA2_QDMA_MAX_DESC); + if (ret) { + DPAA2_QDMA_ERR("sg cntx get from %s for silent mode", + pool_name); + return ret; + } + ret = rte_mempool_get_bulk(qdma_dev->vqs[vchan].fle_pool, + (void **)qdma_dev->vqs[vchan].cntx_long, + DPAA2_QDMA_MAX_DESC); + if (ret) { + DPAA2_QDMA_ERR("long cntx get from %s for silent mode", + pool_name); + return ret; } } else { - qdma_dev->vqs[vchan].set_fd = dpdmai_dev_set_fd_us; - qdma_dev->vqs[vchan].get_job = dpdmai_dev_get_job_us; - } - - if (dpaa2_qdma_get_devargs(dev->device->devargs, - DPAA2_QDMA_PREFETCH)) { - /* If no prefetch is configured. */ - qdma_dev->vqs[vchan].dequeue_job = - dpdmai_dev_dequeue_multijob_prefetch; - DPAA2_QDMA_INFO("Prefetch RX Mode enabled"); - } else { - qdma_dev->vqs[vchan].dequeue_job = - dpdmai_dev_dequeue_multijob_no_prefetch; + qdma_dev->vqs[vchan].ring_cntx_idx = rte_malloc(NULL, + sizeof(struct qdma_cntx_idx_ring), + RTE_CACHE_LINE_SIZE); + if (!qdma_dev->vqs[vchan].ring_cntx_idx) { + DPAA2_QDMA_ERR("DQ response ring alloc failed."); + return -ENOMEM; + } + qdma_dev->vqs[vchan].ring_cntx_idx->start = 0; + qdma_dev->vqs[vchan].ring_cntx_idx->tail = 0; + qdma_dev->vqs[vchan].ring_cntx_idx->free_space = + QDMA_CNTX_IDX_RING_MAX_FREE; + qdma_dev->vqs[vchan].ring_cntx_idx->nb_in_ring = 0; + qdma_dev->vqs[vchan].fle_elem = rte_malloc(NULL, + sizeof(void *) * DPAA2_QDMA_MAX_DESC, + RTE_CACHE_LINE_SIZE); } qdma_dev->vqs[vchan].dpdmai_dev = dpdmai_dev; qdma_dev->vqs[vchan].nb_desc = conf->nb_desc; - qdma_dev->vqs[vchan].enqueue_job = dpdmai_dev_submit_multi; return 0; } @@ -1374,9 +1170,12 @@ dpaa2_qdma_reset(struct rte_dma_dev *dev) /* In case there are pending jobs on any VQ, return -EBUSY */ for (i = 0; i < qdma_dev->num_vqs; i++) { - if (qdma_dev->vqs[i].in_use && (qdma_dev->vqs[i].num_enqueues != - qdma_dev->vqs[i].num_dequeues)) { - DPAA2_QDMA_ERR("Jobs are still pending on VQ: %d", i); + if ((qdma_dev->vqs[i].num_enqueues != + qdma_dev->vqs[i].num_dequeues) && + !qdma_dev->is_silent) { + DPAA2_QDMA_ERR("VQ(%d) pending: eq(%"PRIu64") != dq(%"PRId64")", + i, qdma_dev->vqs[i].num_enqueues, + qdma_dev->vqs[i].num_dequeues); return -EBUSY; } } @@ -1618,7 +1417,7 @@ dpaa2_dpdmai_dev_init(struct rte_dma_dev *dev, int dpdmai_id) static int dpaa2_qdma_probe(struct rte_dpaa2_driver *dpaa2_drv, - struct rte_dpaa2_device *dpaa2_dev) + struct rte_dpaa2_device *dpaa2_dev) { struct rte_dma_dev *dmadev; int ret; @@ -1628,8 +1427,8 @@ dpaa2_qdma_probe(struct rte_dpaa2_driver *dpaa2_drv, RTE_SET_USED(dpaa2_drv); dmadev = rte_dma_pmd_allocate(dpaa2_dev->device.name, - rte_socket_id(), - sizeof(struct dpaa2_dpdmai_dev)); + rte_socket_id(), + sizeof(struct dpaa2_dpdmai_dev)); if (!dmadev) { DPAA2_QDMA_ERR("Unable to allocate dmadevice"); return -EINVAL; @@ -1639,10 +1438,10 @@ dpaa2_qdma_probe(struct rte_dpaa2_driver *dpaa2_drv, dmadev->dev_ops = &dpaa2_qdma_ops; dmadev->device = &dpaa2_dev->device; dmadev->fp_obj->dev_private = dmadev->data->dev_private; - dmadev->fp_obj->copy = dpaa2_qdma_enqueue; + dmadev->fp_obj->copy = dpaa2_qdma_copy; + dmadev->fp_obj->copy_sg = dpaa2_qdma_copy_sg; dmadev->fp_obj->submit = dpaa2_qdma_submit; dmadev->fp_obj->completed = dpaa2_qdma_dequeue; - dmadev->fp_obj->completed_status = dpaa2_qdma_dequeue_status; dmadev->fp_obj->burst_capacity = dpaa2_qdma_burst_capacity; /* Invoke PMD device initialization function */ diff --git a/drivers/dma/dpaa2/dpaa2_qdma.h b/drivers/dma/dpaa2/dpaa2_qdma.h index 786dcb9308..ee34532408 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.h +++ b/drivers/dma/dpaa2/dpaa2_qdma.h @@ -5,7 +5,7 @@ #ifndef _DPAA2_QDMA_H_ #define _DPAA2_QDMA_H_ -#define DPAA2_QDMA_MAX_DESC 1024 +#define DPAA2_QDMA_MAX_DESC 4096 #define DPAA2_QDMA_MIN_DESC 1 #define DPAA2_QDMA_MAX_VHANS 64 @@ -13,48 +13,9 @@ #define DPAA2_QDMA_VQ_FD_SG_FORMAT (1ULL << 1) #define DPAA2_QDMA_VQ_NO_RESPONSE (1ULL << 2) -#define DPAA2_QDMA_MAX_FLE 3 -#define DPAA2_QDMA_MAX_SDD 2 - -#define DPAA2_QDMA_MAX_SG_NB 64 - #define DPAA2_DPDMAI_MAX_QUEUES 16 -/** FLE single job pool size: job pointer(uint64_t) + - * 3 Frame list + 2 source/destination descriptor. - */ -#define QDMA_FLE_SINGLE_POOL_SIZE (sizeof(uint64_t) + \ - sizeof(struct qbman_fle) * DPAA2_QDMA_MAX_FLE + \ - sizeof(struct qdma_sdd) * DPAA2_QDMA_MAX_SDD) - -/** FLE sg jobs pool size: job number(uint64_t) + - * 3 Frame list + 2 source/destination descriptor + - * 64 (src + dst) sg entries + 64 jobs pointers. - */ -#define QDMA_FLE_SG_POOL_SIZE (sizeof(uint64_t) + \ - sizeof(struct qbman_fle) * DPAA2_QDMA_MAX_FLE + \ - sizeof(struct qdma_sdd) * DPAA2_QDMA_MAX_SDD + \ - sizeof(struct qdma_sg_entry) * (DPAA2_QDMA_MAX_SG_NB * 2) + \ - sizeof(struct rte_qdma_job *) * DPAA2_QDMA_MAX_SG_NB) - -#define QDMA_FLE_JOB_NB_OFFSET 0 - -#define QDMA_FLE_SINGLE_JOB_OFFSET 0 - -#define QDMA_FLE_FLE_OFFSET \ - (QDMA_FLE_JOB_NB_OFFSET + sizeof(uint64_t)) - -#define QDMA_FLE_SDD_OFFSET \ - (QDMA_FLE_FLE_OFFSET + \ - sizeof(struct qbman_fle) * DPAA2_QDMA_MAX_FLE) - -#define QDMA_FLE_SG_ENTRY_OFFSET \ - (QDMA_FLE_SDD_OFFSET + \ - sizeof(struct qdma_sdd) * DPAA2_QDMA_MAX_SDD) - -#define QDMA_FLE_SG_JOBS_OFFSET \ - (QDMA_FLE_SG_ENTRY_OFFSET + \ - sizeof(struct qdma_sg_entry) * DPAA2_QDMA_MAX_SG_NB * 2) +#define QDMA_JOB_HW_CNTX_IDX (RTE_DPAA2_QDMA_JOB_USR_CNTX_IDX + 1) /** FLE pool cache size */ #define QDMA_FLE_CACHE_SIZE(_num) (_num/(RTE_MAX_LCORE * 2)) @@ -202,6 +163,39 @@ struct dpaa2_qdma_rbp { uint32_t rsv:2; }; +enum { + DPAA2_QDMA_SDD_FLE, + DPAA2_QDMA_SRC_FLE, + DPAA2_QDMA_DST_FLE, + DPAA2_QDMA_MAX_FLE +}; + +enum { + DPAA2_QDMA_SRC_SDD, + DPAA2_QDMA_DST_SDD, + DPAA2_QDMA_MAX_SDD +}; + +struct qdma_cntx_fle_sdd { + struct qbman_fle fle[DPAA2_QDMA_MAX_FLE]; + struct qdma_sdd sdd[DPAA2_QDMA_MAX_SDD]; +} __rte_packed; + +struct qdma_cntx_sg { + struct qdma_cntx_fle_sdd fle_sdd; + struct qdma_sg_entry sg_src_entry[RTE_DPAA2_QDMA_JOB_SUBMIT_MAX]; + struct qdma_sg_entry sg_dst_entry[RTE_DPAA2_QDMA_JOB_SUBMIT_MAX]; + uint16_t cntx_idx[RTE_DPAA2_QDMA_JOB_SUBMIT_MAX]; + uint16_t job_nb; + uint16_t rsv[3]; +} __rte_packed; + +struct qdma_cntx_long { + struct qdma_cntx_fle_sdd fle_sdd; + uint16_t cntx_idx; + uint16_t rsv[3]; +} __rte_packed; + /** Represents a DPDMAI device */ struct dpaa2_dpdmai_dev { /** Pointer to Next device instance */ @@ -221,27 +215,18 @@ struct dpaa2_dpdmai_dev { struct qdma_device *qdma_dev; }; -struct qdma_virt_queue; - -typedef uint16_t (qdma_get_job_t)(struct qdma_virt_queue *qdma_vq, - const struct qbman_fd *fd, - struct rte_dpaa2_qdma_job **job, - uint16_t *nb_jobs); -typedef int (qdma_set_fd_t)(struct qdma_virt_queue *qdma_vq, - struct qbman_fd *fd, - struct rte_dpaa2_qdma_job **job, - uint16_t nb_jobs); - -typedef int (qdma_dequeue_multijob_t)( - struct qdma_virt_queue *qdma_vq, - uint16_t *vq_id, - struct rte_dpaa2_qdma_job **job, - uint16_t nb_jobs); +#define QDMA_CNTX_IDX_RING_EXTRA_SPACE 64 +#define QDMA_CNTX_IDX_RING_MAX_FREE \ + (DPAA2_QDMA_MAX_DESC - QDMA_CNTX_IDX_RING_EXTRA_SPACE) +struct qdma_cntx_idx_ring { + uint16_t cntx_idx_ring[DPAA2_QDMA_MAX_DESC]; + uint16_t start; + uint16_t tail; + uint16_t free_space; + uint16_t nb_in_ring; +}; -typedef int (qdma_enqueue_multijob_t)( - struct qdma_virt_queue *qdma_vq, - struct rte_dpaa2_qdma_job **job, - uint16_t nb_jobs); +#define DPAA2_QDMA_DESC_DEBUG_FLAG (1 << 0) /** Represents a QDMA virtual queue */ struct qdma_virt_queue { @@ -249,10 +234,11 @@ struct qdma_virt_queue { struct dpaa2_dpdmai_dev *dpdmai_dev; /** FLE pool for the queue */ struct rte_mempool *fle_pool; + void **fle_elem; /** Route by port */ struct dpaa2_qdma_rbp rbp; /** States if this vq is in use or not */ - uint8_t in_use; + uint8_t fle_pre_populate; /** Number of descriptor for the virtual DMA channel */ uint16_t nb_desc; /* Total number of enqueues on this VQ */ @@ -262,18 +248,17 @@ struct qdma_virt_queue { uint16_t vq_id; uint32_t flags; + struct qbman_fd fd[DPAA2_QDMA_MAX_DESC]; + uint16_t fd_idx; + struct qdma_cntx_idx_ring *ring_cntx_idx; + + /**Used for silent enabled*/ + struct qdma_cntx_sg *cntx_sg[DPAA2_QDMA_MAX_DESC]; + struct qdma_cntx_long *cntx_long[DPAA2_QDMA_MAX_DESC]; - struct rte_dpaa2_qdma_job *job_list[DPAA2_QDMA_MAX_DESC]; - struct rte_mempool *job_pool; int num_valid_jobs; struct rte_dma_stats stats; - - qdma_set_fd_t *set_fd; - qdma_get_job_t *get_job; - - qdma_dequeue_multijob_t *dequeue_job; - qdma_enqueue_multijob_t *enqueue_job; }; /** Represents a QDMA device. */ @@ -284,6 +269,7 @@ struct qdma_device { uint16_t num_vqs; /** Device state - started or stopped */ uint8_t state; + uint8_t is_silent; }; #endif /* _DPAA2_QDMA_H_ */ diff --git a/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h b/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h index b0bf9d8bcc..729bff42bb 100644 --- a/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h +++ b/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h @@ -7,118 +7,19 @@ #include -/** States if the source addresses is physical. */ -#define RTE_DPAA2_QDMA_JOB_SRC_PHY (1ULL << 30) +#define RTE_DPAA2_QDMA_IDX_SHIFT_POS 20 +#define RTE_DPAA2_QDMA_LEN_MASK \ + (~((~0u) << RTE_DPAA2_QDMA_IDX_SHIFT_POS)) -/** States if the destination addresses is physical. */ -#define RTE_DPAA2_QDMA_JOB_DEST_PHY (1ULL << 31) +#define RTE_DPAA2_QDMA_IDX_LEN(idx, len) \ + ((uint32_t)((idx << RTE_DPAA2_QDMA_IDX_SHIFT_POS) | (len & RTE_DPAA2_QDMA_LEN_MASK))) -/** Determines a QDMA job */ -struct rte_dpaa2_qdma_job { - /** Source Address from where DMA is (to be) performed */ - uint64_t src; - /** Destination Address where DMA is (to be) done */ - uint64_t dest; - /** Length of the DMA operation in bytes. */ - uint32_t len; - /** See RTE_QDMA_JOB_ flags */ - uint32_t flags; - /** - * Status of the transaction. - * This is filled in the dequeue operation by the driver. - * upper 8bits acc_err for route by port. - * lower 8bits fd error - */ - uint16_t status; - uint16_t vq_id; - uint64_t cnxt; - /** - * FLE pool element maintained by user, in case no qDMA response. - * Note: the address must be allocated from DPDK memory pool. - */ - void *usr_elem; -}; +#define RTE_DPAA2_QDMA_IDX_FROM_LENGTH(length) \ + ((uint16_t)((length) >> RTE_DPAA2_QDMA_IDX_SHIFT_POS)) -/** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice. - * - * Enable FD in Ultra Short format on a channel. This API should be - * called before calling 'rte_dma_vchan_setup()' API. - * - * @param dev_id - * The identifier of the device. - * @param vchan - * The identifier of virtual DMA channel. - */ -__rte_experimental -void rte_dpaa2_qdma_vchan_fd_us_enable(int16_t dev_id, uint16_t vchan); - -/** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice. - * - * Enable internal SG processing on a channel. This API should be - * called before calling 'rte_dma_vchan_setup()' API. - * - * @param dev_id - * The identifier of the device. - * @param vchan - * The identifier of virtual DMA channel. - */ -__rte_experimental -void rte_dpaa2_qdma_vchan_internal_sg_enable(int16_t dev_id, uint16_t vchan); +#define RTE_DPAA2_QDMA_LEN_FROM_LENGTH(length) \ + ((length) & RTE_DPAA2_QDMA_LEN_MASK) -/** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice. - * - * Enqueue a copy operation onto the virtual DMA channel for silent mode, - * when dequeue is not required. - * - * This queues up a copy operation to be performed by hardware, if the 'flags' - * parameter contains RTE_DMA_OP_FLAG_SUBMIT then trigger doorbell to begin - * this operation, otherwise do not trigger doorbell. - * - * @param dev_id - * The identifier of the device. - * @param vchan - * The identifier of virtual DMA channel. - * @param jobs - * Jobs to be submitted to QDMA. - * @param nb_cpls - * Number of DMA jobs. - * - * @return - * - >= 0..Number of enqueued job. - * - -ENOSPC: if no space left to enqueue. - * - other values < 0 on failure. - */ -__rte_experimental -int rte_dpaa2_qdma_copy_multi(int16_t dev_id, uint16_t vchan, - struct rte_dpaa2_qdma_job **jobs, uint16_t nb_cpls); - -/** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice. - * - * Return the number of operations that have been successfully completed. - * - * @param dev_id - * The identifier of the device. - * @param vchan - * The identifier of virtual DMA channel. - * @param jobs - * Jobs completed by QDMA. - * @param nb_cpls - * Number of completed DMA jobs. - * - * @return - * The number of operations that successfully completed. This return value - * must be less than or equal to the value of nb_cpls. - */ -__rte_experimental -uint16_t rte_dpaa2_qdma_completed_multi(int16_t dev_id, uint16_t vchan, - struct rte_dpaa2_qdma_job **jobs, uint16_t nb_cpls); +#define RTE_DPAA2_QDMA_JOB_SUBMIT_MAX (32 + 8) #endif /* _RTE_PMD_DPAA2_QDMA_H_ */ diff --git a/drivers/dma/dpaa2/version.map b/drivers/dma/dpaa2/version.map deleted file mode 100644 index eb012cfbfc..0000000000 --- a/drivers/dma/dpaa2/version.map +++ /dev/null @@ -1,13 +0,0 @@ -DPDK_24 { - local: *; -}; - -EXPERIMENTAL { - global: - - # added in 22.07 - rte_dpaa2_qdma_completed_multi; - rte_dpaa2_qdma_copy_multi; - rte_dpaa2_qdma_vchan_fd_us_enable; - rte_dpaa2_qdma_vchan_internal_sg_enable; -}; From patchwork Mon Jul 22 11:58:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142583 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D96B44567F; Mon, 22 Jul 2024 13:59:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA46B40041; Mon, 22 Jul 2024 13:59:13 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012015.outbound.protection.outlook.com [52.101.66.15]) by mails.dpdk.org (Postfix) with ESMTP id 4864B4003C for ; Mon, 22 Jul 2024 13:59:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iX1Ky/GvjHgjxQjkDd0c3HSd/Hk8HasDXvbVUoRska8KvdK+snXTLko6XHnXrH8yMvTUbFfnu8yawd6Z33HM9o4DN/cZafPDSnXM4EHziUDsShvyBbCuPDbMIXMUQajxhsq0Q2KZKNZvhpEfz+3yUHld11X89EjHZfxvUzAcxvztbCuqNK4oIb6SBdR7G3Pr3Fo360jJSrbYdOPBz8DaROyl4kL4TE6FgnaTAwjGFpL8vbUJ/FiOAzKxCRkpeanxOGRtEhOU+EDExh1jZs+0uAp1hdFtdW3Vayo95gD4el27olQVwp0Wgf6Vznq/bwRrUoZbgRaTdnf5AuJ+r+Oo/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=l3Xd4OjWpAFo+pBPiyFTnEN14vPPwuB9mSI5bxrn+Vk=; b=iYobk7KzrO92SL/z1lN3+aaOZTpoEhWqvWVne+NKN4sGq41bKkH/l9ft8bEoOdg18xZ6uuq/dX/NeAmmSHzE94TwE30tbwQLw6oszCmXM5OIIsyGyBFnnddwb0umjiCuEFJq0w3YSYQwDwqV/l5PRzf3K0SvhxxKnWfj0d+yfwVONR5mgT1RRH24CGQ/kTU86C7kzn8DfoEp8r5L77CIHOKufaAwidkjW3Ks0G/ad2rXFcxvpNuy5frtWTHkB3gYY67OAXbidG1LjsT9vjB2Hn/qb0cnvPLXESoCsi4PhSS1xyz6UskZckcwPUU6fXXV+xwOW0LZEgUkVdeatWlbfQ== 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=l3Xd4OjWpAFo+pBPiyFTnEN14vPPwuB9mSI5bxrn+Vk=; b=AsMy3l5jLIhV+liDHrcf8efCbRLul/Jbt0N+gFjVmWaniQkDP6Av6hIh0oOVFWPlRPhEWkKJo+cIw97YoXQInF9GZrPfcEnKVBenz3Zuveo9RJFi99UdZrBYN7p3392zfsPZIe/wxRTIXjMMscclceVU4/U1jh7uxytvIwtCE0g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:07 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:07 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal , Anatoly Burakov Cc: Jun Yang Subject: [v2 04/30] dma/dpaa2: multiple process support Date: Mon, 22 Jul 2024 17:28:17 +0530 Message-Id: <20240722115843.1830105-5-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: 9de70687-62ae-45b8-fb89-08dcaa45b093 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: pyM6VUdZLtXo33JC0fDOwekEUVvMgpN+CRXXgl9mBlUKvmsDgMrkqkb6MIlp4ul3gBtH/hhZF6RTD05maYr9Mf51Qvps1/TqI7Aerf4rDnk4JrkItLaPVuTN6Qs1/CrvZmtrVOc2s+WdjCKSZhA48WLTocMPge3XPlQXKRYF3NMpIBNKztwSIlatyUcntRmmM84Xv1CucHDG+/ZMWztXZcXVerT9bP8Sp2YAhvxu6NA8QtBlMkE7kjmyl4qY9LgRGV5Yv7fUkboa09FhW9qsirxDGsPm2Z+cdrj6VkErnRowj6Jqy3W6uS1D/3uyQ7lZZH7DNugsZdmG6Ormpg90yQkedxKDhpLiTDCa1wVPUT6UnVcfyVXJEk+qkqr9pzRkSMI/A1+lYDruEeUKrNUGlFCyQQfnMwkNr12LfJRK+YBMZOs6B3mE/0dDEezVqukElL1ay4cynW+vFuqXu1lZ6B3xQ9UCAzfnZVyLK7uSoMlvyRFNFn+edQvjEu4fRR4tqh69WD7yyRX2geaJ35EegVuMdwkALTKMU+lYIY/f+7n8X3zXD9htfcxBdA7GWyMEC5OPICrbc/ydXHF/ALL8CZvp7R/OTfI1DH98uj1qaFMFuUY1g+IDZrvsiNyiQMw1I+sErfV9uewupoSjbqm1BtpMU5XknJlhGzebmfqnBZs7Cnl0wVivA15iTyueDMS9F3l5yau5siIScrdosMbh1nR19NjbhrFMURFCswVcG4Z7K354joSHOUpEBLq/zf/P/yuSeDrjzHqdIiDzhnaExNv/qx/0qHTeujOgzxMz5gzbHZSVhzxr+MSV5TD/q9NvD6OJyqUQ0KMkIIhZif5s+9jBgfkyMQBOmteeP86wYJQMQCNoD5pNLriu5h5f9WcTC0jx3h3flNejAKbepANUcLMqjViijI33yn8GX6ywqDQjf8kqueYwWr0XrDuoBx+XkjPx3gCGGewCVz7Mp+dMX8YYpzzYVOWrMK8dTS499hzMU1XXlavazq315VwqT4diHhWAxulTRe7015n/bV9Y0+bSv4KTj7m9TmJbnfqrMXtdHo9esAbSZCcrpB5UQ7zb/ha9tRml4Po4l7dd4YPV+A/Jl0CLGqxH8jiySHx3MuDB5qqCxVxIMVJhiIayd7x3+oWojkxUB3ITO8LqR5SuSQTV2EKFCfGGUWXLztz/QPQOAb9EsEXSmLd/Q27haXTckjGjs4ocegSl2RaO2W/6pbm9gyZIY8wK9dxkN2cSUMcdFAsAFtaHRKJnk5U/TLgbrsvvmpdsd9OdZnKKxFijrh1vxX0bEbnEWCDQtseS0OhkCPVOWsIvTpUa13zuYVaT2IaEbSlwC3llr+cA8qrmjyFAnEMgI30M/68+Xi2yiIOB1E5zWIKrITTlGS437QCe4iPMVm+F4Mo6p+5OX1nYxA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FpeqxcDCw31ptYq+B3AcoDLswQJL6xKyK0RI/QiXc424tMH0amkLpTEneAgDC0tMOzFmepaJr/kdzbx8EWncwHrBl0ZyJdieiCtReVQBu8VMdYHHmqjbrMlyucGLv7zLwYtHNjU4FYp/igMTYaBR0P3rKOknxqBoYLPHluBHxCZ7kmSN9Kn5XjfbCMCmaXrIltLZBTN1zkp+mT/oHadf/rBYd7QCbnirblcoQrjCCETdcMpLLTUFN4AshmcIQ4Ubaj6PAYAg6DAzcJ/eXGgoPzbbRExROavMItw7iqvhh5umf6cuIA++7/ylSWMq85x1+7v3oSUDX+74wkW5UYmyzwbLn4Fcj0FRde0A8fteh0ydGsDz7NAlyScPllbRtdzuZwrVk1vCzrhOhgMeQzzj4s5RfPjEhEowlqklsXC3ZGmCJ3iYy62Q/aW8BSVHUrCLiU7ZxND148Ql+O9mzQjKew5oPZZMfHVU5wC7q6SecbAxy89D5gi5dtumrVMAXBH0WKgIJpTFjMPXEIT6dmrOLqd7BzZF6bqyxPBMoBDr4Lm5EOhHp370RpGliIjCGZFjRZfD9w890nEbPeM5Wxq7wUD7jkla9cgl9gsiyagjyBDAv1qVT2T6TK4pJNIbXX9giX7Tm4P3UE85nEKKd83fCG5dTEmIFOpG664z72eMGJGGSuMfhywoB7jfL+RMtKDzDFCuSwQvDlsMhdCSU0r6V2rzGBUFyXFo0K24dMiRKLQm8vSmSvI85S3HHmyGP9dXcah1aMK1WtPw1nr8v4CB5BB+zexZ+cY9nZf8hwVrIaICC1dOxWnQYGy4PJfvk81CN40nd+vhnZ2DT81wz6iJ+k8y3Oj3JURUOz4EMNPGhyjHCD0heyjBEtafPvg5Hbt9AaKZnrgOz+T/Y3fYYPOQ1REqY+eXvS6ilYKSyz76/LGU0VvcZntTAZY83y5YrgOcrX+6XroZVC9mnPyZ9IcSDhv0JD0qcNydjcS1e7NMH5OTaSm7AOBKsOYqfDHYgbGwfAQShjvBBQloRwYbHosuJw84lnYpWAeuYTZq3Qt0+b83KH0UvIigPQCrq+V+XOkrwMv9MIxEdE3JJdFj7Y05mbFR4LfTVnLChTztBQqZhIpYoEGBcf33A3uTjx2DS8tWRsQWfYne4iA7HKA90Al1trakliidB+ELUAJUl4CegowTeto+cJz/UPolXlx+EzzxFBuzDTtozqyPr3pKgvQPPChZLYwIRjLfY1KBD9UvDMtT6+GZmgFwXIMySgbyNZ43KITtQNU+YYmoWg1fHNs0gYAolBuCCqJcLdqnbOa7Jtpfym1H+3YeyxKwF7TedNBKIdcMzF2kCYb+iyWmDSs2JcRRN/W41wbzLBEYc36z4/pnfBA2488+F4M9qnqgzW0HKYeSjcEHN+feQPbbWi8OTizzJT7c8zsUiYNFEvE19c/yvTpcU1+X/8m7KUObxlejzAevJNRV1oa3FUBhr9MJrRj6BTb7J0iKMsd/mjCcT461o4Otjihr8rM4z67d0m6zlOqDjyL5n/Ro/Eo+tt7A2nLv3WetfgDDHbuKiorG90f3sjfZ32zrc+fjHhnWmdzV X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9de70687-62ae-45b8-fb89-08dcaa45b093 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:07.5835 (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: tH906xHJPDtKW3pSszRTXoeIv5v6R4w9ABaqTCbejvse8KB+gWdyiwdviTd/Y2P5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 From: Jun Yang Support multiple processes for dpaa2 dma. 1) Move queue configuration procedure from init function to device configuration function which is called by user. 2) Instances of dpaa2_dpdmai_dev and qdma_device are allocated from primary process and shared between multiple processes. 3) MC reg is per process mapped. 4) User is responsible to check vq number configured before using dma device to identify if this device is occupied by other process. Signed-off-by: Jun Yang --- drivers/dma/dpaa2/dpaa2_qdma.c | 405 ++++++++++++++++++++------------- drivers/dma/dpaa2/dpaa2_qdma.h | 6 +- 2 files changed, 254 insertions(+), 157 deletions(-) diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c index 15d3776603..44b82c139e 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.c +++ b/drivers/dma/dpaa2/dpaa2_qdma.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018-2022 NXP + * Copyright 2018-2023 NXP */ #include @@ -19,6 +19,8 @@ static uint32_t dpaa2_coherent_no_alloc_cache; static uint32_t dpaa2_coherent_alloc_cache; +static struct fsl_mc_io s_proc_mc_reg; + static inline int qdma_cntx_idx_ring_eq(struct qdma_cntx_idx_ring *ring, const uint16_t *elem, uint16_t nb, @@ -960,6 +962,9 @@ dpaa2_qdma_info_get(const struct rte_dma_dev *dev, dev_info->max_vchans = dpdmai_dev->num_queues; dev_info->max_desc = DPAA2_QDMA_MAX_DESC; dev_info->min_desc = DPAA2_QDMA_MIN_DESC; + dev_info->dev_name = dev->device->name; + if (dpdmai_dev->qdma_dev) + dev_info->nb_vchans = dpdmai_dev->qdma_dev->num_vqs; return 0; } @@ -969,25 +974,102 @@ dpaa2_qdma_configure(struct rte_dma_dev *dev, const struct rte_dma_conf *dev_conf, uint32_t conf_sz) { - char name[32]; /* RTE_MEMZONE_NAMESIZE = 32 */ struct dpaa2_dpdmai_dev *dpdmai_dev = dev->data->dev_private; struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; uint16_t i; + struct dpdmai_rx_queue_cfg rx_queue_cfg; + struct dpdmai_rx_queue_attr rx_attr; + struct dpdmai_tx_queue_attr tx_attr; + struct dpaa2_queue *rxq; + int ret = 0; DPAA2_QDMA_FUNC_TRACE(); RTE_SET_USED(conf_sz); - /* In case QDMA device is not in stopped state, return -EBUSY */ - if (qdma_dev->state == 1) { - DPAA2_QDMA_ERR("%s Not stopped, configure failed.", - dev->data->dev_name); - return -EBUSY; + if (dev_conf->nb_vchans > dpdmai_dev->num_queues) { + DPAA2_QDMA_ERR("%s config queues(%d) > hw queues(%d)", + dev->data->dev_name, dev_conf->nb_vchans, + dpdmai_dev->num_queues); + + return -ENOTSUP; + } + + if (qdma_dev->vqs) { + DPAA2_QDMA_DEBUG("%s: queues de-config(%d)/re-config(%d)", + dev->data->dev_name, + qdma_dev->num_vqs, dev_conf->nb_vchans); + for (i = 0; i < qdma_dev->num_vqs; i++) { + if ((qdma_dev->vqs[i].num_enqueues != + qdma_dev->vqs[i].num_dequeues) && + !qdma_dev->is_silent) { + DPAA2_QDMA_ERR("VQ(%d) %"PRIu64" jobs in dma.", + i, qdma_dev->vqs[i].num_enqueues - + qdma_dev->vqs[i].num_dequeues); + return -EBUSY; + } + } + for (i = 0; i < qdma_dev->num_vqs; i++) { + if (qdma_dev->vqs[i].fle_pool) { + rte_mempool_free(qdma_dev->vqs[i].fle_pool); + qdma_dev->vqs[i].fle_pool = NULL; + } + if (qdma_dev->vqs[i].ring_cntx_idx) { + rte_free(qdma_dev->vqs[i].ring_cntx_idx); + qdma_dev->vqs[i].ring_cntx_idx = NULL; + } + rxq = &dpdmai_dev->rx_queue[i]; + if (rxq->q_storage) { + DPAA2_QDMA_DEBUG("%s rxq[%d] re-configure", + dev->data->dev_name, i); + dpaa2_free_dq_storage(rxq->q_storage); + rte_free(rxq->q_storage); + rxq->q_storage = NULL; + } + } + rte_free(qdma_dev->vqs); + qdma_dev->vqs = NULL; + qdma_dev->num_vqs = 0; + } + + /* Set up Rx Queues */ + for (i = 0; i < dev_conf->nb_vchans; i++) { + memset(&rx_queue_cfg, 0, sizeof(struct dpdmai_rx_queue_cfg)); + rxq = &dpdmai_dev->rx_queue[i]; + ret = dpdmai_set_rx_queue(&s_proc_mc_reg, + CMD_PRI_LOW, + dpdmai_dev->token, + i, 0, &rx_queue_cfg); + if (ret) { + DPAA2_QDMA_ERR("%s RXQ%d set failed(%d)", + dev->data->dev_name, i, ret); + return ret; + } + } + + /* Get Rx and Tx queues FQID's */ + for (i = 0; i < dev_conf->nb_vchans; i++) { + ret = dpdmai_get_rx_queue(&s_proc_mc_reg, CMD_PRI_LOW, + dpdmai_dev->token, i, 0, &rx_attr); + if (ret) { + DPAA2_QDMA_ERR("Get DPDMAI%d-RXQ%d failed(%d)", + dpdmai_dev->dpdmai_id, i, ret); + return ret; + } + dpdmai_dev->rx_queue[i].fqid = rx_attr.fqid; + + ret = dpdmai_get_tx_queue(&s_proc_mc_reg, CMD_PRI_LOW, + dpdmai_dev->token, i, 0, &tx_attr); + if (ret) { + DPAA2_QDMA_ERR("Get DPDMAI%d-TXQ%d failed(%d)", + dpdmai_dev->dpdmai_id, i, ret); + return ret; + } + dpdmai_dev->tx_queue[i].fqid = tx_attr.fqid; } /* Allocate Virtual Queues */ - sprintf(name, "qdma_%d_vq", dev->data->dev_id); - qdma_dev->vqs = rte_malloc(name, + qdma_dev->vqs = rte_zmalloc(NULL, (sizeof(struct qdma_virt_queue) * dev_conf->nb_vchans), RTE_CACHE_LINE_SIZE); if (!qdma_dev->vqs) { @@ -995,13 +1077,50 @@ dpaa2_qdma_configure(struct rte_dma_dev *dev, dev->data->dev_name, dev_conf->nb_vchans); return -ENOMEM; } - for (i = 0; i < dev_conf->nb_vchans; i++) + for (i = 0; i < dev_conf->nb_vchans; i++) { qdma_dev->vqs[i].vq_id = i; + rxq = &dpdmai_dev->rx_queue[i]; + /* Allocate DQ storage for the DPDMAI Rx queues */ + rxq->q_storage = rte_zmalloc(NULL, + sizeof(struct queue_storage_info_t), + RTE_CACHE_LINE_SIZE); + if (!rxq->q_storage) { + DPAA2_QDMA_ERR("%s Q[%d] storage alloc failed", + dev->data->dev_name, i); + ret = -ENOMEM; + goto alloc_failed; + } + + memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t)); + ret = dpaa2_alloc_dq_storage(rxq->q_storage); + if (ret) { + DPAA2_QDMA_ERR("%s Q[%d] dq storage alloc failed", + dev->data->dev_name, i); + ret = -ENOMEM; + goto alloc_failed; + } + } qdma_dev->num_vqs = dev_conf->nb_vchans; qdma_dev->is_silent = dev_conf->enable_silent; return 0; + +alloc_failed: + for (i = 0; i < dev_conf->nb_vchans; i++) { + rxq = &dpdmai_dev->rx_queue[i]; + if (rxq->q_storage) { + dpaa2_free_dq_storage(rxq->q_storage); + rte_free(rxq->q_storage); + rxq->q_storage = NULL; + } + } + + rte_free(qdma_dev->vqs); + qdma_dev->vqs = NULL; + qdma_dev->num_vqs = 0; + + return ret; } static int @@ -1130,11 +1249,17 @@ static int dpaa2_qdma_start(struct rte_dma_dev *dev) { struct dpaa2_dpdmai_dev *dpdmai_dev = dev->data->dev_private; - struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; + int ret; DPAA2_QDMA_FUNC_TRACE(); - qdma_dev->state = 1; + /* Enable the device */ + ret = dpdmai_enable(&s_proc_mc_reg, CMD_PRI_LOW, + dpdmai_dev->token); + if (ret) { + DPAA2_QDMA_ERR("Enabling device failed with err: %d", ret); + return ret; + } return 0; } @@ -1143,30 +1268,33 @@ static int dpaa2_qdma_stop(struct rte_dma_dev *dev) { struct dpaa2_dpdmai_dev *dpdmai_dev = dev->data->dev_private; - struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; + int ret; DPAA2_QDMA_FUNC_TRACE(); - qdma_dev->state = 0; + /* Disable the device */ + ret = dpdmai_disable(&s_proc_mc_reg, CMD_PRI_LOW, + dpdmai_dev->token); + if (ret) { + DPAA2_QDMA_ERR("Disable device failed with err: %d", ret); + return ret; + } return 0; } static int -dpaa2_qdma_reset(struct rte_dma_dev *dev) +dpaa2_qdma_close(struct rte_dma_dev *dev) { struct dpaa2_dpdmai_dev *dpdmai_dev = dev->data->dev_private; struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; + struct dpaa2_queue *rxq; int i; DPAA2_QDMA_FUNC_TRACE(); - /* In case QDMA device is not in stopped state, return -EBUSY */ - if (qdma_dev->state == 1) { - DPAA2_QDMA_ERR("%s Not stopped, reset failed.", - dev->data->dev_name); - return -EBUSY; - } + if (!qdma_dev) + return 0; /* In case there are pending jobs on any VQ, return -EBUSY */ for (i = 0; i < qdma_dev->num_vqs; i++) { @@ -1180,8 +1308,31 @@ dpaa2_qdma_reset(struct rte_dma_dev *dev) } } - rte_free(qdma_dev->vqs); - qdma_dev->vqs = NULL; + /* Free RXQ storages */ + for (i = 0; i < qdma_dev->num_vqs; i++) { + rxq = &dpdmai_dev->rx_queue[i]; + if (rxq->q_storage) { + dpaa2_free_dq_storage(rxq->q_storage); + rte_free(rxq->q_storage); + rxq->q_storage = NULL; + } + } + + if (qdma_dev->vqs) { + /* Free RXQ fle pool */ + for (i = 0; i < qdma_dev->num_vqs; i++) { + if (qdma_dev->vqs[i].fle_pool) { + rte_mempool_free(qdma_dev->vqs[i].fle_pool); + qdma_dev->vqs[i].fle_pool = NULL; + } + if (qdma_dev->vqs[i].ring_cntx_idx) { + rte_free(qdma_dev->vqs[i].ring_cntx_idx); + qdma_dev->vqs[i].ring_cntx_idx = NULL; + } + } + rte_free(qdma_dev->vqs); + qdma_dev->vqs = NULL; + } /* Reset QDMA device structure */ qdma_dev->num_vqs = 0; @@ -1190,18 +1341,8 @@ dpaa2_qdma_reset(struct rte_dma_dev *dev) } static int -dpaa2_qdma_close(__rte_unused struct rte_dma_dev *dev) -{ - DPAA2_QDMA_FUNC_TRACE(); - - dpaa2_qdma_reset(dev); - - return 0; -} - -static int -dpaa2_qdma_stats_get(const struct rte_dma_dev *dmadev, uint16_t vchan, - struct rte_dma_stats *rte_stats, uint32_t size) +dpaa2_qdma_stats_get(const struct rte_dma_dev *dmadev, + uint16_t vchan, struct rte_dma_stats *rte_stats, uint32_t size) { struct dpaa2_dpdmai_dev *dpdmai_dev = dmadev->data->dev_private; struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; @@ -1256,56 +1397,97 @@ static int dpaa2_dpdmai_dev_uninit(struct rte_dma_dev *dev) { struct dpaa2_dpdmai_dev *dpdmai_dev = dev->data->dev_private; - struct dpaa2_queue *rxq; - int ret, i; + struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; + int ret; DPAA2_QDMA_FUNC_TRACE(); - ret = dpdmai_disable(&dpdmai_dev->dpdmai, CMD_PRI_LOW, - dpdmai_dev->token); - if (ret) { - DPAA2_QDMA_ERR("dpdmai(%d) disable failed", + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { + DPAA2_QDMA_DEBUG("Un-attach DMA(%d) in the 2nd proess.", dpdmai_dev->dpdmai_id); - } - - /* Set up the DQRR storage for Rx */ - for (i = 0; i < dpdmai_dev->num_queues; i++) { - rxq = &dpdmai_dev->rx_queue[i]; - if (rxq->q_storage) { - dpaa2_free_dq_storage(rxq->q_storage); - rte_free(rxq->q_storage); - } + return 0; } /* Close the device at underlying layer*/ - ret = dpdmai_close(&dpdmai_dev->dpdmai, CMD_PRI_LOW, dpdmai_dev->token); + ret = dpdmai_close(&s_proc_mc_reg, CMD_PRI_LOW, + dpdmai_dev->token); if (ret) { - DPAA2_QDMA_ERR("dpdmai(%d) close failed", - dpdmai_dev->dpdmai_id); + DPAA2_QDMA_ERR("dpdmai(%d) close failed(%d)", + dpdmai_dev->dpdmai_id, ret); + + return ret; + } + + if (qdma_dev) { + rte_free(qdma_dev); + dpdmai_dev->qdma_dev = NULL; } return ret; } static int -dpaa2_dpdmai_dev_init(struct rte_dma_dev *dev, int dpdmai_id) +dpaa2_dpdmai_dev_init(struct rte_dma_dev *dev, uint32_t dpdmai_id) { struct dpaa2_dpdmai_dev *dpdmai_dev = dev->data->dev_private; - struct dpdmai_rx_queue_cfg rx_queue_cfg; struct dpdmai_attr attr; - struct dpdmai_rx_queue_attr rx_attr; - struct dpdmai_tx_queue_attr tx_attr; - struct dpaa2_queue *rxq; - int ret, i; + int ret, err; DPAA2_QDMA_FUNC_TRACE(); + if (!dpaa2_coherent_no_alloc_cache) { + if (dpaa2_svr_family == SVR_LX2160A) { + dpaa2_coherent_no_alloc_cache = + DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE; + dpaa2_coherent_alloc_cache = + DPAA2_LX2_COHERENT_ALLOCATE_CACHE; + } else { + dpaa2_coherent_no_alloc_cache = + DPAA2_COHERENT_NO_ALLOCATE_CACHE; + dpaa2_coherent_alloc_cache = + DPAA2_COHERENT_ALLOCATE_CACHE; + } + } + + if (!s_proc_mc_reg.regs) + s_proc_mc_reg.regs = dpaa2_get_mcp_ptr(MC_PORTAL_INDEX); + + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { + DPAA2_QDMA_DEBUG("Attach DMA(%d) in the 2nd proess.", + dpdmai_id); + if (dpdmai_id != dpdmai_dev->dpdmai_id) { + DPAA2_QDMA_ERR("Fatal: Attach DMA(%d) to DMA(%d)", + dpdmai_id, dpdmai_dev->dpdmai_id); + return -EINVAL; + } + if (!dpdmai_dev->qdma_dev) { + DPAA2_QDMA_ERR("Fatal: DMA(%d) qdma_dev NOT allocated", + dpdmai_id); + return -ENOMEM; + } + if (dpdmai_dev->qdma_dev->num_vqs) { + DPAA2_QDMA_WARN("DMA(%d) %d vqs were configured", + dpdmai_id, dpdmai_dev->qdma_dev->num_vqs); + } + + return 0; + } + /* Open DPDMAI device */ dpdmai_dev->dpdmai_id = dpdmai_id; - dpdmai_dev->dpdmai.regs = dpaa2_get_mcp_ptr(MC_PORTAL_INDEX); - dpdmai_dev->qdma_dev = rte_malloc(NULL, + + if (dpdmai_dev->qdma_dev) { + rte_free(dpdmai_dev->qdma_dev); + dpdmai_dev->qdma_dev = NULL; + } + dpdmai_dev->qdma_dev = rte_zmalloc(NULL, sizeof(struct qdma_device), RTE_CACHE_LINE_SIZE); - ret = dpdmai_open(&dpdmai_dev->dpdmai, CMD_PRI_LOW, + if (!dpdmai_dev->qdma_dev) { + DPAA2_QDMA_ERR("DMA(%d) alloc memory failed", + dpdmai_id); + return -ENOMEM; + } + ret = dpdmai_open(&s_proc_mc_reg, CMD_PRI_LOW, dpdmai_dev->dpdmai_id, &dpdmai_dev->token); if (ret) { DPAA2_QDMA_ERR("%s: dma(%d) open failed(%d)", @@ -1314,105 +1496,24 @@ dpaa2_dpdmai_dev_init(struct rte_dma_dev *dev, int dpdmai_id) } /* Get DPDMAI attributes */ - ret = dpdmai_get_attributes(&dpdmai_dev->dpdmai, CMD_PRI_LOW, + ret = dpdmai_get_attributes(&s_proc_mc_reg, CMD_PRI_LOW, dpdmai_dev->token, &attr); if (ret) { DPAA2_QDMA_ERR("%s: dma(%d) get attributes failed(%d)", __func__, dpdmai_dev->dpdmai_id, ret); - goto init_err; - } - dpdmai_dev->num_queues = attr.num_of_queues; - - /* Set up Rx Queues */ - for (i = 0; i < dpdmai_dev->num_queues; i++) { - memset(&rx_queue_cfg, 0, sizeof(struct dpdmai_rx_queue_cfg)); - ret = dpdmai_set_rx_queue(&dpdmai_dev->dpdmai, - CMD_PRI_LOW, - dpdmai_dev->token, - i, 0, &rx_queue_cfg); - if (ret) { - DPAA2_QDMA_ERR("%s Q%d set failed(%d)", - dev->data->dev_name, i, ret); - goto init_err; - } - - /* Allocate DQ storage for the DPDMAI Rx queues */ - rxq = &dpdmai_dev->rx_queue[i]; - rxq->q_storage = rte_malloc("dq_storage", - sizeof(struct queue_storage_info_t), - RTE_CACHE_LINE_SIZE); - if (!rxq->q_storage) { - DPAA2_QDMA_ERR("%s DQ info(Q%d) alloc failed", - dev->data->dev_name, i); - ret = -ENOMEM; - goto init_err; - } - - memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t)); - ret = dpaa2_alloc_dq_storage(rxq->q_storage); - if (ret) { - DPAA2_QDMA_ERR("%s DQ storage(Q%d) alloc failed(%d)", - dev->data->dev_name, i, ret); - goto init_err; - } - } - - /* Get Rx and Tx queues FQID's */ - for (i = 0; i < dpdmai_dev->num_queues; i++) { - ret = dpdmai_get_rx_queue(&dpdmai_dev->dpdmai, CMD_PRI_LOW, - dpdmai_dev->token, i, 0, &rx_attr); - if (ret) { - DPAA2_QDMA_ERR("Get DPDMAI%d-RXQ%d failed(%d)", - dpdmai_dev->dpdmai_id, i, ret); - goto init_err; - } - dpdmai_dev->rx_queue[i].fqid = rx_attr.fqid; - - ret = dpdmai_get_tx_queue(&dpdmai_dev->dpdmai, CMD_PRI_LOW, - dpdmai_dev->token, i, 0, &tx_attr); - if (ret) { - DPAA2_QDMA_ERR("Get DPDMAI%d-TXQ%d failed(%d)", - dpdmai_dev->dpdmai_id, i, ret); - goto init_err; - } - dpdmai_dev->tx_queue[i].fqid = tx_attr.fqid; - } - - /* Enable the device */ - ret = dpdmai_enable(&dpdmai_dev->dpdmai, CMD_PRI_LOW, - dpdmai_dev->token); - if (ret) { - DPAA2_QDMA_ERR("Enabling device failed with err: %d", ret); - goto init_err; - } - - if (!dpaa2_coherent_no_alloc_cache) { - if (dpaa2_svr_family == SVR_LX2160A) { - dpaa2_coherent_no_alloc_cache = - DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE; - dpaa2_coherent_alloc_cache = - DPAA2_LX2_COHERENT_ALLOCATE_CACHE; - } else { - dpaa2_coherent_no_alloc_cache = - DPAA2_COHERENT_NO_ALLOCATE_CACHE; - dpaa2_coherent_alloc_cache = - DPAA2_COHERENT_ALLOCATE_CACHE; + err = dpdmai_close(&s_proc_mc_reg, CMD_PRI_LOW, + dpdmai_dev->token); + if (err) { + DPAA2_QDMA_ERR("dpdmai(%d) close failed(%d)", + dpdmai_dev->dpdmai_id, err); } + return ret; } + dpdmai_dev->num_queues = attr.num_of_queues; - DPAA2_QDMA_DEBUG("Initialized dpdmai object successfully"); - - /* Reset the QDMA device */ - ret = dpaa2_qdma_reset(dev); - if (ret) { - DPAA2_QDMA_ERR("Resetting QDMA failed"); - goto init_err; - } + DPAA2_QDMA_DEBUG("DMA(%d) is initialized.", dpdmai_id); return 0; -init_err: - dpaa2_dpdmai_dev_uninit(dev); - return ret; } static int diff --git a/drivers/dma/dpaa2/dpaa2_qdma.h b/drivers/dma/dpaa2/dpaa2_qdma.h index ee34532408..743a43fa14 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.h +++ b/drivers/dma/dpaa2/dpaa2_qdma.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018-2022 NXP + * Copyright 2018-2023 NXP */ #ifndef _DPAA2_QDMA_H_ @@ -200,8 +200,6 @@ struct qdma_cntx_long { struct dpaa2_dpdmai_dev { /** Pointer to Next device instance */ TAILQ_ENTRY(dpaa2_qdma_device) next; - /** handle to DPDMAI object */ - struct fsl_mc_io dpdmai; /** HW ID for DPDMAI object */ uint32_t dpdmai_id; /** Tocken of this device */ @@ -267,8 +265,6 @@ struct qdma_device { struct qdma_virt_queue *vqs; /** Total number of VQ's */ uint16_t num_vqs; - /** Device state - started or stopped */ - uint8_t state; uint8_t is_silent; }; From patchwork Mon Jul 22 11:58:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142585 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CD5C04567F; Mon, 22 Jul 2024 13:59:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 63F304029F; Mon, 22 Jul 2024 13:59:16 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012015.outbound.protection.outlook.com [52.101.66.15]) by mails.dpdk.org (Postfix) with ESMTP id 0BD7C4003C for ; Mon, 22 Jul 2024 13:59:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=n89Zv8Z3By9oAwcUQyWThab5dHKt41iN+kxxi4P4k116zaaObEvELwlni2eIZ9TE+fdaunGM8UCCkfaz4odP12GUS3z1n1Id0HP+l3WrI0fJD/VHZtEjbqWNLsqImbQaAyuTj6o3QZFCSaRmPAkqJeh70/xns9EOB5sVcVbbx20gyKWAvrj+PW+YGlMrL9M2ndo2wlTZq3woYij5ccAYk+LNGSxCjYLloNvP7BBiTxl0vWh4QDhYtL1/yUcZhwOeFTqGbmuywKPcI7m1veSnjLBRpsdg/kv/EhU0Hws2NXeTrmujcyScUD/5L6XIeeaHQmuiuzyK1ru8OSR0GkWSsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R3I2CbozqdX/wxPkntlHtXmEeXPH9HZ97SnNOw5UesQ=; b=Gu5hl+LC4JIIZ9JDrsDJVqZDFeW0MnlGhovN7kB6OdiG5/FosyxZmVjcJeQ6IeqcXTFjT19WVKaPoGqJ/+Ghp7DlJxWG12f2L+XHt6HUODNt8P9fi3gO9Q85CQW1egLAM7HQlP6UqMgIe8WUL7POPsEi1rVPwj8R0SN3uSpH+x5TlTnbfoSSzwzgNrEHYto5Bjqv2Rlao6sW89M5sOczmvuDPe60QpqO1JJ+bbcMceM4vOlttHhUsX0PQntdMQQpCwMPtHLrqOMP9sa7xKUL3iJ7Klc5T2fUOT7dJ8vFNp6VhjlRO3qlnNJdGEHNMPS6n/lH7FlmiZzoZBkcTA0wSw== 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=R3I2CbozqdX/wxPkntlHtXmEeXPH9HZ97SnNOw5UesQ=; b=Qf8DKxvr+eY/neGrkJd/iwgbbFMBXceAqgWnexULsqGC6qOJ4yzf6gGOyPQ0UYf3WuMC8Ofa/v1YdHxDd2xttVWaa5sOvgovfhEnba89cYs+0cT5+3kk3XdDl94eXCS2yemhfMQLF2q3xnizXw/cesah+7DEDYPVONjAyFtwim8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:09 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:09 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [v2 05/30] dma/dpaa2: add sanity check for SG entry Date: Mon, 22 Jul 2024 17:28:18 +0530 Message-Id: <20240722115843.1830105-6-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: 16843711-f975-45ee-a706-08dcaa45b1d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: 3m+BR3PGcQaV1Ma4+3ao/usSjZMOrDc5TA/AnvlrPoBHseJOJavm2bFeVPpn4GJjgx6cFY9UElgyrTUEerOe/eSokrIBoyD8VMF7YilvOK0Tl63TPvaa0wqQTPf5Lv1V6Rd8bDfd9w4thPKEioDMJSqpB/raeeB0StUH2aty0H6XNN4ciUFswjrypR0udyQpu3Cmwxrxdy9/BTTSQG9as4FYhx7M5CpwDz+DvRsQDACLcSBXKFf2A4egfyS74HJjapMwzhbcnWt0cBlurhAXAdG7a2w5RphrjeO9oLrRWL7tIJE1tg4SuQ2HgamKsCZX9hC9i/B4FwGg4ACmto0eX20hVk/5TX7ctb/HulG+wrnrsJolT85++wa94snjFDGL6bRf0Cp1ICjaE1OmKWaaVwSQL+Tkh8VYxV67x8gkFg1d1J8i8CJpTndHOQl9SrHi4b+TPmHRtMbUO1uNOoJpLVGKNkzQgcEpt4kKbt3eHJAWeXAoIuiJvq3Wc8aWNkOk/bthUiWLMosXfifKPcCSZ+6jIj17jKGyfrIRhCkLFuM6Mo192CwTPr8iZ/Wy36yxG/RoekmLkqOt5flSpzxll6yWTSnGXL8HSOWaxU6fBQlUaAYTx0YHTs+bH/l2y4GFyTnQ84xUsr3C+Z0AbzYFzEOSU3ICqqIPnXHQC+bXy0zphLsweJfeLb2XlsTo4u2UK1MzuIrJ42dB34AV9fjIeGONxDnHdlg+ji4O8CT13FgSAuSxn11JtJyUD/nTykdV9znf+7gDdJoQlWHNKAEaSOF5q56vQC/dpqriQ0ihIhx8B510XoKEgsy7gAQaKFME0oZrAiGFetW5bkrqb3uB/H86U61q6LwXUOQ9WrKz3TTUp4QMCgjZy3rUHZbFeRWKZ4kLnt76S6fxMm2JQIZs4CpCJEP+NGoqYbqu8lR8jKXzhJDql/2qbnwpxEWOgmKZjieBCZTYm2CVnklHuAZLlLHmTl+y8xgFoYLIOFo8bP12QJDKktgktSQ0/OetNbvqmMX0gBDQKtg8qRqG5wSHwBEZTrXU8iaIiHsKAOjz/DnWofxAMWra1tz4LO8Oc4IuJQJdC13ZqV80LSn4ijBxF/i6EGDzMHSf9yMcLIi6FP0pfGqBhlT/t2ERVsZbFdmQSWkqIBJQsukcg3AWJOytotu9yYRK+TW5aL6i5liC2PEFtykOpGSBLdGyXVhirKZ/62l/aRjejRKm81ry0Cr2UGMDG4GzvrzHRiRdC5qrAKCO2ilTOQIrrnCfDx8v4KEbX6DVZQkYkNG6d3o8TvXwUSFTx6HXWphjxVnoGaKpho79dU5vRC5XYuMMwu4pPYveNiYZe3uPBdSxQpubNL7ZiNkA5rBeLUobsuiehRGS+/pUY5PO3J0t3R54EcfNYWxhtiTtCkKJIrpFbTrEojZNBA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WZExKutP7E4qB2JTtJYoaXo+UCsl9LBdqIUYgUJPfok3OfH1pI7TGRM15BKhsiV2fCPwkyeNCYeFUKg09OQxVsUQtJ05FbsEu23ooen2FuqjH04l0mQMqrfkpnLiU6kpxwejbtZGv3HsfCvUQYnpbqWiCHIixbVJVAwXUX1TXUSwMWVIC41WEYiaUJKJvXkUrZ4gw4TF27wl5Ve3ktNYhkTGdqeKkIL9Lv+tGQsXg5yTEvz2ZqXc09nKKd/ueecPsAHYTVswih1ORw3uIFHveQWJokMrz/9kOSS1XxEKOs5Wy6RREyNzY5ES9WBK61G9CJGpZ7Fd2C1ISlC0f+9FC9EH02R3oraq/n/D8e0nYu5QtXrEdaViIcd8F8/gs+kLSmfSaqJiwteVflIfHkTAAcRJdhUpiLvQdjl2Sb/D8WUMz7jy86lBzOCJevHaZMOfSMI2HjiyUqu6DFGnNB+Xk6rgjAjACnZTG2sD8qO7jetVCUU//5naepquCMm/vvUE0Hg2AKDJs9pSpiTfb56GpHjuypkBxGn1oeJfqWwLgUG4JOUGSgdNajxTcFNARyS4kYGqgQmOpKTP+JrSmgFBDEjqUJ/OGPszsBdpeqEeQ2VhoZXkEP6cPH08q/jHKhfd5aTw4UCJltUG0LlzI4xH/2YhvKzd/+cQSGIm2BL9XXkKFEYuEfOUDevkyei9JDZImunuu5jxip4g01PnEQAobeTw/nMc56CxhJ7xeeCtGpBNVjYFDt8PVkkHVlL8rqEiCtEFPDHiwzUTbkrVPaGRccCj+PYA7TrlaS4oOVE3tElBHorzNptz74hyOEuQ05E1ZkhAESzXSVv/J1UKd4A0Sb/5DtN1UYaEU97JEBooqw6GowJWspXEzU3smyjfY9/rUAwMm3yeleAx9lBg3mIef6lzRrGVI7gX7sRQZCluQvxLGgq7j7Z9o2ZQ+84JeFI/e6pE1wmOXOo1XcPHo0NlwPiPpQqANeP2mMRqOpNRn3hnHoZWtN3oBzg2p635w/SKnSsJrouGirFxfATD2VR02/Rhea6+aFKoxlsaWVQD19Eu9ko7P30UM670MGQhHQXrfenGXzCYKh2kX3uztlRNn8AqSetgaYkc35iEtEkvM5TttE4xuEBBLruHzl49CrUzXz+kwIu3gGA75eaLCpje83smNN4iZz4EbTc9JwT4YGxHGXSzjiPVqZerp9r5pjyKgiVNgd6n6hZsg3mbbxmbGPwMSWhMo0FwKqonkd8RSGLiW8s7UestrwgPsk9QpCN2F7EoIKJbWowkJXBX2Y+kelwSEwF+YJznbYq7qZfAVxu0WReCJyctufcAirh2gXF/Pl+ZdWYctZvupbp9FPZ3BcHrhD81ABqZOX29pOmFvtCw0XE9evsqi7aBsiO6SaB/Lg/zbzFOSkV0wxSvfulEdZRX6y5YETyzQaF21ghXBZsGSmp0puoLArNV2gUgxPvPX8tK4Bjo/abkC/UpYIOBKlskgeDDCdKiJ5q33M1zhRiwb5LgoMku03az0KTbNyZhHCqagpYp51jW472pFRPoxtwDo8wFf9nL42yhUYF8c1Wm8fTJTbe0xDmsSW0IHiln X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16843711-f975-45ee-a706-08dcaa45b1d1 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:09.6969 (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: 5ZfKwMVNJerBCDzVOXJMpbJhrqPmr7XT/D8HZ4nVc+dkpypVDtrCF3DiQlOpv4yR X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 From: Jun Yang Make sure the SG entry number doesn't overflow. Signed-off-by: Jun Yang --- drivers/dma/dpaa2/dpaa2_qdma.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c index 44b82c139e..7f6ebcb46b 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.c +++ b/drivers/dma/dpaa2/dpaa2_qdma.c @@ -615,8 +615,17 @@ dpaa2_qdma_copy_sg(void *dev_private, struct qbman_fle *fle; struct qdma_sdd *sdd; - if (unlikely(nb_src != nb_dst)) + if (unlikely(nb_src != nb_dst)) { + DPAA2_QDMA_ERR("SG entry src num(%d) != dst num(%d)", + nb_src, nb_dst); return -ENOTSUP; + } + + if (unlikely(nb_src > RTE_DPAA2_QDMA_JOB_SUBMIT_MAX)) { + DPAA2_QDMA_ERR("SG entry number(%d) > MAX(%d)", + nb_src, RTE_DPAA2_QDMA_JOB_SUBMIT_MAX); + return -EINVAL; + } memset(fd, 0, sizeof(struct qbman_fd)); From patchwork Mon Jul 22 11:58:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142606 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CD7D845681; Mon, 22 Jul 2024 14:03:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2CAB40677; Mon, 22 Jul 2024 14:00:26 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013057.outbound.protection.outlook.com [52.101.67.57]) by mails.dpdk.org (Postfix) with ESMTP id 101C8402B8 for ; Mon, 22 Jul 2024 14:00:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=k8gkAzMW8w9zN6Ax8kRT/dgiiXFIqCbZejQ94hIyyZL48jE6X1mHkQAc2GbaQkvqJ3lYaI7iTIIErb0RCVig6FsOZXVISXczOifAgmCUPeMxS1wgMtNI8mUyMETYSZg79szBpPh1ug/cY/Gm92NwU/tkCxLyEi91BlfS9GZ6eSBi8P0b3wSc3L7UH5NZwBJNBbs+p8JOAvV8DQpUJnI1LJK2b5S5iWthHTAdUzdAAxa+49ABTHKq+5wtuNfi/zvyPYNy7Pyw0K4FL8WTGKnZnHglFtfKaoB3trW9NRmqy1fCraZ66bO0RM7pwkxzZcPPxZivaoZcYxOZsmnfUxz9Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YIkv9+rTnvx4RIU+v7OFAHRft+D3qeSkg8GRYYYr6fw=; b=M7/WnYMM/Eun1qXQosL7TnN6AqA9uLy4wwBQqXVPBOoKJAvitYYqfUa6g7qO+/NwdAXTVaeuVUJfcF1b9og/KqwWzWkODhAHTp5AqDQmZfvGOUpzn9OnfjNHTy86mORoxpkCUbihXsQVbeAR0h6Rlkupo00Wvl4sj0RKf9CQJ+xwuQwIXFZ9mugZZzEAgB3nP3p/yn6zEqEs4cS0bvBnQUG2iQdq1TsGOsBCifC6BvgR7Se2ScRBs8BvI4m9F3BjLD4z/bcbKpuo5vlPJhcNhQ/Y1hHBwCsrrR9e6Yk/q+6BdaP64XnN9hNSZ5tEvA73uH6ITRVs9Bgi2K/DTbb0+w== 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=YIkv9+rTnvx4RIU+v7OFAHRft+D3qeSkg8GRYYYr6fw=; b=qtAWR19nzcgmxzScs4N3yvm8diiQE0QnfUCSVxbVnjfMsP0jSy98cLP26kqQ3rqzx+8Z+A5/eChf+zYCOOEat13sE3nEh8L0ohtIUibrkThvGOlX+LZNPI2fwc/B0d8cNZUZn1k1P+Ib3zGQImenej05QYBAbNJSqZCvpcESrqc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by DUZPR04MB9919.eurprd04.prod.outlook.com (2603:10a6:10:4d9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.14; Mon, 22 Jul 2024 11:59:11 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:11 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [v2 06/30] dma/dpaa2: include DPAA2 specific header files Date: Mon, 22 Jul 2024 17:28:19 +0530 Message-Id: <20240722115843.1830105-7-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9919:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ecce55c-ae51-4f9f-fa1c-08dcaa45b313 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: o7grvBKQumKio64Y/xzN03POVcDNK40orEGTWe4TDMQ2hvzrzxlCgI97ZqNy0AOxkPUYPMyh0TUW327mlG2c1LUx6AVdYP2fOdyTmKFYBwRQ06IB1xJN/NKbc2BRSnQPR/SoYOfyGT/43nek9eGyaCHn3bTstxwyRPuc/hCYpEtdjcjXEvacrA1wEk163Y1XZalD3XyzyI3wpknrII1K6IAwmccNtrtogHs2zXlUCXarzORQJUN1VcvhWoAdsQxRXy5OJhmTjh/MrUkCGIlPzDHsILvOwWD8Sn1OC7RBnO2A2uQV1kw7Xr9cI0PjOcxCZM8H30P6eqmzlN0r2+69bOg0hMaUllu1o81IBsBDV7Rxe6Y86mfTCZSSqs0iVALiiOcGr7huTp5lBWYYVUawaBFBQ1fBTm6/DV1WWxIJ7lsqXP3vgDUSQt0va71Lc8JiQn6nQoiJC4LHVGS1tvq95TjlVNZZ/lsKtegq61J6Az7IPqsCu0EzBcJVdiJ3SwsKW4FrilJWfF4g3Ek3RxLBvzcmxDcT4QRG+GOwxY7QM8VHbedMYTR3yd1KViMOhyguVBPZf+cQRKAL/k5xLGezeuMzN1JCn49g0488tiszqO4Q25bgQYIABIJa01/7QNTtzN0ealb9UhdT47EJ/UBW8ef8CRWMAn2s3WFEA7O6tzZ2wRwERmF7wnNWzdpysBvQvtAQagDIDs17WEhuunBVw+0sLpd7i4AvvuaLv/eksxr7voxGB5rzd0iI2f+faNF1JHCFmWPI26S/4nrvb3SerumXgDYvwdB45gedOvIHGBb3QR88a0ZMKZh54bKCdvpmgLF7/bQT/B7MnTsYlpX5+cmpnTH/YZTolL/uMr1LjdCm/Q2cHOkV03DG7kZU2+kMCK40WLWEaq4CR7FPy72kCRAdDc6x3b6W0lFnfcVV8FIyiNhGUj4TkKB03BFJhb2PpxXqVC3NFnvdwt0YybElcMgQ4zRO9THQDrG0qnQ6agTDcanQFMbwSez+/K9S40/r4JXip8stEOPx56vnnC7iYqBfogA2YNHvr18LAdoUxRz+rYGVaNzoQloJL0WmPmTwSprtw/bHOGm6LLExss/z+zMltVSkGszNv4Zqi/eULulnKwS9Ne1WlX/GwwVo1OUtCWbY/bQ+B23zXQ/0yi70Hk4rBW3SJiXlj2bzammmGwbg0h/UKAQK1T2sKx0fn2gAuRGjzgmGOPzDV91ZhybDWjPhQcELrlu1aHjq95GUUiV5/6pLqeWJNgi/A+n1sWho/kzmzhthKJWfwkFkD5wDrPpuOBCPDeZI0z0QOY7PT4pBcnpOrZ3v81V0Y4cKrttA30vbFljfra5w5+GqzdNqspgAfw2tiaRcHqWSmZ2JK/M4KPbmFTwjMmlr4yRevGJAGS5kLX4cbvbunOOZZb5fwA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ODr+gBTFYzupZSWfgwVBCczoxxE4hOGruJWyeHfntXlT5ULvnrY2qOq/ErVHaQGowv0DDzeaYXscZY4eIevCk8pkadMM5+61bdPeX1G88GgIGg0YYn88odfbFJwfpoYBBgVSGW5qRWeDTBXPU0fdYz+g9ulkmJbzmA1CSPyKC96lCbzAir4UYmaLFpzqBCgE5wOogvdtpuo8CL+AcG3hISvbiRStrFDjW6a63fq8olhyd0AMCcY8TzWES2zoDOZToHdwsn4RHZqCuB1ZvhM4AX6kew8SNhxiZ0x4Mn1lvxo67Wymyxw+Q9NM35rsxdCz/nABAzfGweM5ipOJe74dlyiz/c3YlMpIM9JQXAw+gPzSaHZd2iuFp6QUw82uZKS3Vkgm6JPodbDsuJIlucv2Zs+tou6Iu0fydpVUcg3EDWUK08e4uaFfQMsF/mtd+ZGLaYedAhizKa370HO9hD6PHvcoaxgtbgJ1faFMk3b3WjAAc0S22VenaqMblR+Y5ZdWqNpEnCbCkOq1WfL4JF9OmtbfZ5kbw15aMXloTCZX2BNYzz9VaCUafkRpEP3T9mwXuiz/JcCUgSilVFWGrSV5QqRJtev0fCwbdgNSZiO6KwarVIvULjDvaWf/u+A2GEkHKl3zd8vlA5ARGCvkNJ0hSd1dgY6jJbwgR0dUtZn8kQxNOTWPr8mx2+dHFe8tkYHpYuBF0/S1NsGIxWPrDyw/bA1KQwndGel74IDsDv5oYtpYhmipngSBaEWIP5syKGw6GGZ/qPd9xMQLF4amKFvJLmmS7BU0s+kTDAd0NmQHQNUOeBjbP6U4UZwMnOBWefEYO5g/31gqWdMmhSxPN5ge2HEoMxdxJ9Ppdb92xOITKBmttRBvmrvq8hzjtrHY1GklVY6jAakN0jN7wYuvsFZo65P8U1ZSnnPCmXQ/XOCnuzuYFJAqoKRhuDdmiiWlsAKj8oq9AR7AYkORwp4XdSG0NOjecPVo02pvvkT1WbA/9HBkmXVRLBoeWa2wM+JrmrQqT7m+Vtf43mvMWfg3Fj5Q7K7wNjWNT2xPkmWMcG70qZcwiKNNpfck2pb69FNXUQHrObf1LqE4URhoigcmsW3XZC/U+JVtvyUemS+0Rw+vBt8C3/jABlTMr+5l7ZlrKgC09GjZyWKHMdWauKOhhRyKbspTXrW/U5WUPH+xmCyfNqan4lJtkjSeWg7aeG5IxTtYbcROaCtKbLaFN0wyo0RD+kySpZz3H7D+HX8E1/yiLi0iVNlm9tS0jwd7TeF0oVPB6iRd7wMhyDxfCqGt9ZbNceAFKC1Ga5YcZE6312enqFxefBvPsDezWZV/+R5/uVwOxC6vxWCXSl8grG0dT56OEaW3QscgLVKPk+yMMZLdkQKs75enqlNb9kalyYcgB2yAH696UEqQyP5dm3mraRVgRAPI3RHlqH/VaUHht91d3+fPpo5FfXeJuQi9e6Bs56VQlJ7lEcwY9NuTKyb7eTffo9hM6e9JPKLC/4vErzt9licXfBVa6MVvJEdA3GClcIyosnhYhfQSFtkiysQa5nV5u7gwfApRgGGVsv/wp2+AFjAJ1ElTBlE84wWO4Lf3xTua X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ecce55c-ae51-4f9f-fa1c-08dcaa45b313 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:11.6863 (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: 2SxBlxK5DVDlfe59lqVtP+0R1HKSAZu2AA7bO81Hw4P6bX95KtHlhzWaeR0/XMJO X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9919 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 From: Jun Yang Include dpaa2_hw_pvt.h and dpaa2_hw_dpio.h files Signed-off-by: Jun Yang --- drivers/dma/dpaa2/dpaa2_qdma.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/dma/dpaa2/dpaa2_qdma.h b/drivers/dma/dpaa2/dpaa2_qdma.h index 743a43fa14..eb02bff08f 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.h +++ b/drivers/dma/dpaa2/dpaa2_qdma.h @@ -5,6 +5,9 @@ #ifndef _DPAA2_QDMA_H_ #define _DPAA2_QDMA_H_ +#include "portal/dpaa2_hw_pvt.h" +#include "portal/dpaa2_hw_dpio.h" + #define DPAA2_QDMA_MAX_DESC 4096 #define DPAA2_QDMA_MIN_DESC 1 #define DPAA2_QDMA_MAX_VHANS 64 From patchwork Mon Jul 22 11:58:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142607 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E67C645681; Mon, 22 Jul 2024 14:03:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E533B40A6D; Mon, 22 Jul 2024 14:00:27 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013057.outbound.protection.outlook.com [52.101.67.57]) by mails.dpdk.org (Postfix) with ESMTP id 1D9814060A for ; Mon, 22 Jul 2024 14:00:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=upbdbPMcZIoGsGpr50LfAJhFSChaE2atXWazgNz8yAD+WQgdfImSE7oa4aPGlO0JMRU6uyu8aTuH1oaVR/B28Btl8IiECiGTd45LC2WJu9KohTsvykdNZ6LjiqAaDmzyh+AQAukvTa0Wq2zAnxYLKQjZU8C1dZ0RVVYT9MCcB3tqQdW3XFQ3jIBSIFbzBi6w/aE0kYjgxblCJtmaR689/AZvR/lXNcTfmoaNUrRQayPo0dqsGJqo9WfifaGqzLLRaTy+NA7faRj2cBtLQ0I90YQJuTlzvpJJdgVnoN6Behi39bP6ThmWBblFSRdi6VlOYa4Df50wqszja+fC961GwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Nd4k4D4gKzdDG7grH8cG9DZORPVz18JX/fj3xysIugo=; b=aKU5iEFwWIR8xtgLZiShj9dv9zCyNZTRHa98i05xKYMOqGl+9/dKlPz4pbxHj22+cuogEI8phSkMy1j9dhXrSZ8vMw+gOnPD9ywWpExrbyuom9UPDnvAnFmDV5mwGKAMsEQc21i4HV8wDs++SKYWrshub3r/i44eFyBAkeTQJMWh108g/l8hyPS8RuITmsU4uMWa9RtB7inRPlcTUIT7+VWpu+IlyYyBoXHFgRM8RdEoMUKK/QciSkU+P2PnNytiH+AT0VzpleNDFxuSQdhcVNdKuQpllUqaFdinXyQCPcw9YOkv+01fTobIUO8tx36tD2+gv1tHzRZx4MtLQxNJyg== 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=Nd4k4D4gKzdDG7grH8cG9DZORPVz18JX/fj3xysIugo=; b=fr0D3l5UJiVRGjjjlyGiNGd9LgCfY1Vo9ZD5l6XuI65X1b4HRcx2I/dyZFhlclRxUO6/H+9ROo9iH988Dv1Z9SJm8yKi+QOIElBDMe9Qahp6g38uI/lNdp8knfr10JZ+7uByzNqYaJTN8+2PBviWpqyJkW7c1dFeT4EE89BEKms= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by DUZPR04MB9919.eurprd04.prod.outlook.com (2603:10a6:10:4d9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.14; Mon, 22 Jul 2024 11:59:13 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:13 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [v2 07/30] dma/dpaa2: borrow flags of DMA operation to pass job context Date: Mon, 22 Jul 2024 17:28:20 +0530 Message-Id: <20240722115843.1830105-8-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9919:EE_ X-MS-Office365-Filtering-Correlation-Id: 67967368-0bb7-4124-a205-08dcaa45b435 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: +zWWZAMRStOSefyT5GajsAICbuZrfygj6wMY0V2EP5GX4d7dJEoPVsR6XAw47D27NoFghQtzrx29XyNMTxBNZlQRG+NpSM1f+fnEXQxrrSxAmjnISUgWgYqVeEQeI2bPjvlpPAfSlYiY22eRzwIuBVnStRbBNCBQY51DDIqsuB9iFQot+BRxHLDcj38h+vyPu+jndr158UWH2J0mzx6EGrCrVbEl+N1sQfydKD3P3qriMlYMOOJktwAP5jQ7y3nRlt/HkR1QMhP8MYsBhSvQtZMYfMKI9RDhgH7FilO2K0PI4BK3z85Uyn5u7ar835+EfaYX1ZX1YZgmMGdAGrDfU9f6ysd0eGJSUmHYF0q4Dw4z4sSXssSxLm4+uJczY0XlKVfcIO9s54MnU5kTuDoIl1vfGkXtpdMfDq28P3TWffNSV8RTWQP/GQiSKdhUoKPrK6Yw0vh4DLfh3Lq5cESwBWcwTpAF9nSKcTpiZ4kO5zTNWUCNBe1FSdHGXWlNZsiAWXTvlxf/UCrEiPCgr2U9VfRFMbuah/JuNpDoJ3Cg6S5UJW/F3Q6socQi119knRO9XXlFDkxDXJnSo+NR7zLXaugQR+To1OmqzvfopEE1UZiqH9wCLrcnwAor3LDzsNMbMcSVk6qf5oY6oa1FSQ0GZfu/aW/nmwUF4fo66JHa6ssg9wOk4a2U4Bju692VQgURZka1WFzLs+w2boEx17LPw/mHkyzKbkcV6dsWVqLR7kgNjsKuRV6SmAcv8uV6+cPxcT01+vQR3Qi+eoz5A9b/Ju229/XNwLtsNoC9ITqRYSTBsjFNfhSGRovQr2y4mbzdzW/Am2hVjGAtlRiR2mZHePWzShtYhvO6U4Ib72tCSW3EYZ6QKsLDxMm6x9fXbeH4OujOUvSCnEShUOzNjsdLsGLIL6M68hDqy9LKVoIW+o1W6V5yNqhRW1syWm56UAcDz50uREuImhrALCAMfI/166gzJW7T8wSOk8sJKXzJj3ui0+fW7u6PiwziMyWM3XACz9wSnChMObpq2wgMKIc5qmwZ9ccSu5gzKtn2QD7CJQPz7C+hjuqr86tYf3PPI+nPiaYjk8YkL3tK4MnsARbNbXFiL7pj+x3nMnqu1V4XLYABeYv6yC4eFX0UOKpuHSBRnFpR2lvQp13J7gIVQjzuhqeqEapcuse2D75hpxWkxmodOFkCxe0p8ML9R1wfnM41lAR3PwAyQF0tBu/53BJmxlwYjWi4w0gbLvZLUTeNMlzuzs2QUO8HuYyfyenQT7cz275MhHaSK+cR6OVgIFGOBHbcoyc/B+Kzk10RuXDN2qJ4f8WXkzursPwjVf3oXZF75VP3iJOrswjrO1fox6nnkjKTTUXMm0fIVmZMDC4FF9bQd7jr5J9U686hznWQSOtwcsbA2SPQck0jqwVLflQdag== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VSkN1e86Po6zu6nCPyPAMmvx2P9PgDJDbYaAeLHgGleadQBgleYaxmWhPWP7PvnmNA/cUV7qbH1NHU5Kdpor7ypQTE8viE6Idqp5dQGABCIy5/ZihOAuS3YsscQVbMwI3rDUL4l+5U6RETqUVrrKuZB0S5sN0bj3PypPMPsRq6gEFPDQx75EWjw5TYEy/iV+CgWV16g7dgdMRo+CCWnzXSP0bibrwz88jKRVUdxpuTCoZ9qgOb8uD/XVkvx1CZu8+kH7AM/WM26wYpDoDMW3x5pFLDu8aw8IlUMb7+pN4lnXW54vOMJdUBUALLjsPm5eAhhbiBVa0A84zj4cbHNroi2fKIF3ZLG2w2+AC0S8qUwV1ZPVWf17yao2AK4vOjtw/nUdQonDjNDq1BJ4XYdA/KOMKWTDOTA/Zyc21cI1riI8I2AJiUB3MsAR85ajsGxNbe/P9QPszMBmEsB2VPv2hw7yIY1QnrLw3v33VYTD99FPKfB9vM/AUoMOUX7boRR3LP63Yg//v9nXm+o6BFwkD1Dfw/zq4tarp1vTEl4yAgQTjldGy35WK3rflA12+GbX4w+MpkGUqB9SnC+DNUZ4vV/u8JZUs2JFf5RQGuhc1V7wSGwRJodw73NVnmn73IKd/IIU5/3lzpD1rAbVGOXCic8bObl12uqMjJ8X6uwXgdyeeluueeKfGUTGSlNZw/mqvAQIBV3m2FXtsXMwEON1TxUGnppppMFXNrrqdXrJMVIoD/wuwZp0CpSP3HTzQJvV7M4rsmR/d86Tt2yEjTg52DqpZi/pUda90QRLvvqhDcMOVPcW711Rf9tjVTpvTgLAG8P5cHNx/IJrdM3Wu8OhMTKh2FHu6GxwJ0dPAqYh8orxbvEKR821TBvmEayEp7B+x4tOJeu1vXpt5QRSHJqWcypjzPLhQOnIUZLqvroHHlW4Ok1cOaNbY8i1uRQfWEK3BvilKCyc6NBhxGC6RKQQjUDX0pfs7VdJXAwDtx1FgeY4oE5jBDtRK8iSvffmgbr6/n+Z8mlFNVzcFkCpj+tddM+5ePXdKIr4L0ttewav59yFGTp0jMa47ZacsOiG2dJjXOUNpxJQWfZupJZTC1R+gCt6+YPa69qHVwDAGwelW8HDr5MAYeIeWwjmiX7j6jDluLbVhVO54LwStk01oafD8PLakY3Q+4Xs1xZDNlup7oDQOjeM+vkgzMM/xREqjqd6GWl6w6GNgFnnH0ujFatUjJ230JyCo44XMgn0XR9PDHhn3YAlVIzCqlZsMIUX/k7/r5QLfqCICY6AMOcXRKSlWg6oemOonvRy1QqQO++GkKp7SADfDKSbRBM6HP88Xa1VHyaZK745XeQiReux/nPDLySPbC1iZmDpcBGIfOQlPaXgu5oYi4xTgVsTeMMbz3lHVq9FWk+Lu99UjQZ5vpuCC/HrUNJk6oGUOXouXVDbPPaIQz5sCVaKn0qQ1tCchhYWCk3Kxgj6Dq4I8IbcmjGAfSZuN8bb+sefATvUnxKMZnudcv+dprYNhHExTv3zMx6zoPsOZWYCpQ6IgpR7gGeR2GbqUAlz2e8Df0r1qDGiMIUS5vMHUpJdV+0MzwZtppS6 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67967368-0bb7-4124-a205-08dcaa45b435 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:13.5952 (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: tN/bPuVAaNs82YuZyLYS7JJ57v88hxbjCUhAUb/gD3NEhfgk405Ob9HiDzaU1+HF X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9919 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 From: Jun Yang For copy_sg: pass job index lists. For copy: pass job index. Signed-off-by: Jun Yang --- drivers/dma/dpaa2/dpaa2_qdma.c | 92 ++++++++++++++------------ drivers/dma/dpaa2/dpaa2_qdma.h | 7 ++ drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h | 15 ++++- 3 files changed, 68 insertions(+), 46 deletions(-) diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c index 7f6ebcb46b..7de4894b35 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.c +++ b/drivers/dma/dpaa2/dpaa2_qdma.c @@ -280,25 +280,22 @@ sg_entry_post_populate(const struct rte_dma_sge *src, const struct rte_dma_sge *dst, struct qdma_cntx_sg *sg_cntx, uint16_t nb_sge) { - uint16_t i = 0, idx; - uint32_t total_len = 0, len; + uint16_t i; + uint32_t total_len = 0; struct qdma_sg_entry *src_sge = sg_cntx->sg_src_entry; struct qdma_sg_entry *dst_sge = sg_cntx->sg_dst_entry; for (i = 0; i < (nb_sge - 1); i++) { if (unlikely(src[i].length != dst[i].length)) return -ENOTSUP; - len = RTE_DPAA2_QDMA_LEN_FROM_LENGTH(src[i].length); - idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(src[i].length); src_sge->addr_lo = (uint32_t)src[i].addr; src_sge->addr_hi = (src[i].addr >> 32); - src_sge->data_len.data_len_sl0 = len; + src_sge->data_len.data_len_sl0 = src[i].length; dst_sge->addr_lo = (uint32_t)dst[i].addr; dst_sge->addr_hi = (dst[i].addr >> 32); - dst_sge->data_len.data_len_sl0 = len; - total_len += len; - sg_cntx->cntx_idx[i] = idx; + dst_sge->data_len.data_len_sl0 = dst[i].length; + total_len += dst[i].length; src_sge->ctrl.f = 0; dst_sge->ctrl.f = 0; @@ -309,19 +306,15 @@ sg_entry_post_populate(const struct rte_dma_sge *src, if (unlikely(src[i].length != dst[i].length)) return -ENOTSUP; - len = RTE_DPAA2_QDMA_LEN_FROM_LENGTH(src[i].length); - idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(src[i].length); - src_sge->addr_lo = (uint32_t)src[i].addr; src_sge->addr_hi = (src[i].addr >> 32); - src_sge->data_len.data_len_sl0 = len; + src_sge->data_len.data_len_sl0 = src[i].length; dst_sge->addr_lo = (uint32_t)dst[i].addr; dst_sge->addr_hi = (dst[i].addr >> 32); - dst_sge->data_len.data_len_sl0 = len; + dst_sge->data_len.data_len_sl0 = dst[i].length; - total_len += len; - sg_cntx->cntx_idx[i] = idx; + total_len += dst[i].length; sg_cntx->job_nb = nb_sge; src_sge->ctrl.f = QDMA_SG_F; @@ -343,20 +336,18 @@ sg_entry_populate(const struct rte_dma_sge *src, const struct rte_dma_sge *dst, struct qdma_cntx_sg *sg_cntx, uint16_t nb_sge) { - uint16_t i, idx; - uint32_t total_len = 0, len; + uint16_t i; + uint32_t total_len = 0; struct qdma_sg_entry *src_sge = sg_cntx->sg_src_entry; struct qdma_sg_entry *dst_sge = sg_cntx->sg_dst_entry; for (i = 0; i < nb_sge; i++) { if (unlikely(src[i].length != dst[i].length)) return -ENOTSUP; - len = RTE_DPAA2_QDMA_LEN_FROM_LENGTH(src[i].length); - idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(src[i].length); src_sge->addr_lo = (uint32_t)src[i].addr; src_sge->addr_hi = (src[i].addr >> 32); - src_sge->data_len.data_len_sl0 = len; + src_sge->data_len.data_len_sl0 = src[i].length; src_sge->ctrl.sl = QDMA_SG_SL_LONG; src_sge->ctrl.fmt = QDMA_SG_FMT_SDB; #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA @@ -366,7 +357,7 @@ sg_entry_populate(const struct rte_dma_sge *src, #endif dst_sge->addr_lo = (uint32_t)dst[i].addr; dst_sge->addr_hi = (dst[i].addr >> 32); - dst_sge->data_len.data_len_sl0 = len; + dst_sge->data_len.data_len_sl0 = dst[i].length; dst_sge->ctrl.sl = QDMA_SG_SL_LONG; dst_sge->ctrl.fmt = QDMA_SG_FMT_SDB; #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA @@ -374,8 +365,7 @@ sg_entry_populate(const struct rte_dma_sge *src, #else dst_sge->ctrl.bmt = QDMA_SG_BMT_DISABLE; #endif - total_len += len; - sg_cntx->cntx_idx[i] = idx; + total_len += src[i].length; if (i == (nb_sge - 1)) { src_sge->ctrl.f = QDMA_SG_F; @@ -606,14 +596,15 @@ dpaa2_qdma_copy_sg(void *dev_private, struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; - int ret = 0, expected; - uint32_t cntx_idx, len; + int ret = 0, expected, i; + uint32_t len; struct qbman_fd *fd = &qdma_vq->fd[qdma_vq->fd_idx]; - struct qdma_cntx_sg *cntx_sg; + struct qdma_cntx_sg *cntx_sg = NULL; rte_iova_t cntx_iova, fle_iova, sdd_iova; rte_iova_t src_sge_iova, dst_sge_iova; struct qbman_fle *fle; struct qdma_sdd *sdd; + const uint16_t *idx_addr = NULL; if (unlikely(nb_src != nb_dst)) { DPAA2_QDMA_ERR("SG entry src num(%d) != dst num(%d)", @@ -630,14 +621,16 @@ dpaa2_qdma_copy_sg(void *dev_private, memset(fd, 0, sizeof(struct qbman_fd)); if (qdma_dev->is_silent) { - cntx_idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(src[0].length); - cntx_sg = qdma_vq->cntx_sg[cntx_idx]; + cntx_sg = qdma_vq->cntx_sg[qdma_vq->silent_idx]; } else { ret = rte_mempool_get(qdma_vq->fle_pool, (void **)&cntx_sg); if (ret) return ret; DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX); + idx_addr = DPAA2_QDMA_IDXADDR_FROM_SG_FLAG(flags); + for (i = 0; i < nb_src; i++) + cntx_sg->cntx_idx[i] = idx_addr[i]; } #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA @@ -656,8 +649,13 @@ dpaa2_qdma_copy_sg(void *dev_private, DPAA2_SET_FD_FLC(fd, (uint64_t)cntx_sg); if (qdma_vq->fle_pre_populate) { - if (unlikely(!fle[DPAA2_QDMA_SRC_FLE].length)) + if (unlikely(!fle[DPAA2_QDMA_SRC_FLE].length)) { fle_sdd_sg_pre_populate(cntx_sg, qdma_vq); + if (!qdma_dev->is_silent && cntx_sg && idx_addr) { + for (i = 0; i < nb_src; i++) + cntx_sg->cntx_idx[i] = idx_addr[i]; + } + } len = sg_entry_post_populate(src, dst, cntx_sg, nb_src); @@ -683,6 +681,8 @@ dpaa2_qdma_copy_sg(void *dev_private, dpaa2_qdma_long_fmt_dump(cntx_sg->fle_sdd.fle); qdma_vq->fd_idx++; + qdma_vq->silent_idx = + (qdma_vq->silent_idx + 1) & (DPAA2_QDMA_MAX_DESC - 1); if (flags & RTE_DMA_OP_FLAG_SUBMIT) { expected = qdma_vq->fd_idx; @@ -705,28 +705,23 @@ dpaa2_qdma_copy(void *dev_private, uint16_t vchan, struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; int ret = 0, expected; - uint16_t cntx_idx; - uint32_t len; struct qbman_fd *fd = &qdma_vq->fd[qdma_vq->fd_idx]; - struct qdma_cntx_long *cntx_long; + struct qdma_cntx_long *cntx_long = NULL; rte_iova_t cntx_iova, fle_iova, sdd_iova; struct qbman_fle *fle; struct qdma_sdd *sdd; memset(fd, 0, sizeof(struct qbman_fd)); - cntx_idx = RTE_DPAA2_QDMA_IDX_FROM_LENGTH(length); - len = RTE_DPAA2_QDMA_LEN_FROM_LENGTH(length); - if (qdma_dev->is_silent) { - cntx_long = qdma_vq->cntx_long[cntx_idx]; + cntx_long = qdma_vq->cntx_long[qdma_vq->silent_idx]; } else { ret = rte_mempool_get(qdma_vq->fle_pool, (void **)&cntx_long); if (ret) return ret; DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX); - cntx_long->cntx_idx = cntx_idx; + cntx_long->cntx_idx = DPAA2_QDMA_IDX_FROM_FLAG(flags); } #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA @@ -749,16 +744,20 @@ dpaa2_qdma_copy(void *dev_private, uint16_t vchan, fle_sdd_pre_populate(&cntx_long->fle_sdd, &qdma_vq->rbp, 0, 0, QBMAN_FLE_WORD4_FMT_SBF); + if (!qdma_dev->is_silent && cntx_long) { + cntx_long->cntx_idx = + DPAA2_QDMA_IDX_FROM_FLAG(flags); + } } - fle_post_populate(fle, src, dst, len); + fle_post_populate(fle, src, dst, length); } else { sdd = cntx_long->fle_sdd.sdd; sdd_iova = cntx_iova + offsetof(struct qdma_cntx_long, fle_sdd) + offsetof(struct qdma_cntx_fle_sdd, sdd); fle_populate(fle, sdd, sdd_iova, &qdma_vq->rbp, - src, dst, len, + src, dst, length, QBMAN_FLE_WORD4_FMT_SBF); } @@ -766,6 +765,8 @@ dpaa2_qdma_copy(void *dev_private, uint16_t vchan, dpaa2_qdma_long_fmt_dump(cntx_long->fle_sdd.fle); qdma_vq->fd_idx++; + qdma_vq->silent_idx = + (qdma_vq->silent_idx + 1) & (DPAA2_QDMA_MAX_DESC - 1); if (flags & RTE_DMA_OP_FLAG_SUBMIT) { expected = qdma_vq->fd_idx; @@ -963,14 +964,17 @@ dpaa2_qdma_info_get(const struct rte_dma_dev *dev, struct dpaa2_dpdmai_dev *dpdmai_dev = dev->data->dev_private; dev_info->dev_capa = RTE_DMA_CAPA_MEM_TO_MEM | - RTE_DMA_CAPA_MEM_TO_DEV | - RTE_DMA_CAPA_DEV_TO_DEV | - RTE_DMA_CAPA_DEV_TO_MEM | - RTE_DMA_CAPA_SILENT | - RTE_DMA_CAPA_OPS_COPY; + RTE_DMA_CAPA_MEM_TO_DEV | + RTE_DMA_CAPA_DEV_TO_DEV | + RTE_DMA_CAPA_DEV_TO_MEM | + RTE_DMA_CAPA_SILENT | + RTE_DMA_CAPA_OPS_COPY | + RTE_DMA_CAPA_OPS_COPY_SG; + dev_info->dev_capa |= RTE_DMA_CAPA_DPAA2_QDMA_FLAGS_INDEX; dev_info->max_vchans = dpdmai_dev->num_queues; dev_info->max_desc = DPAA2_QDMA_MAX_DESC; dev_info->min_desc = DPAA2_QDMA_MIN_DESC; + dev_info->max_sges = RTE_DPAA2_QDMA_JOB_SUBMIT_MAX; dev_info->dev_name = dev->device->name; if (dpdmai_dev->qdma_dev) dev_info->nb_vchans = dpdmai_dev->qdma_dev->num_vqs; diff --git a/drivers/dma/dpaa2/dpaa2_qdma.h b/drivers/dma/dpaa2/dpaa2_qdma.h index eb02bff08f..371393cb85 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.h +++ b/drivers/dma/dpaa2/dpaa2_qdma.h @@ -199,6 +199,12 @@ struct qdma_cntx_long { uint16_t rsv[3]; } __rte_packed; +#define DPAA2_QDMA_IDXADDR_FROM_SG_FLAG(flag) \ + ((void *)(uintptr_t)((flag) - ((flag) & RTE_DPAA2_QDMA_SG_IDX_ADDR_MASK))) + +#define DPAA2_QDMA_IDX_FROM_FLAG(flag) \ + ((flag) >> RTE_DPAA2_QDMA_COPY_IDX_OFFSET) + /** Represents a DPDMAI device */ struct dpaa2_dpdmai_dev { /** Pointer to Next device instance */ @@ -256,6 +262,7 @@ struct qdma_virt_queue { /**Used for silent enabled*/ struct qdma_cntx_sg *cntx_sg[DPAA2_QDMA_MAX_DESC]; struct qdma_cntx_long *cntx_long[DPAA2_QDMA_MAX_DESC]; + uint16_t silent_idx; int num_valid_jobs; diff --git a/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h b/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h index 729bff42bb..e49604c8fc 100644 --- a/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h +++ b/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2021-2022 NXP + * Copyright 2021-2023 NXP */ #ifndef _RTE_PMD_DPAA2_QDMA_H_ @@ -20,6 +20,17 @@ #define RTE_DPAA2_QDMA_LEN_FROM_LENGTH(length) \ ((length) & RTE_DPAA2_QDMA_LEN_MASK) -#define RTE_DPAA2_QDMA_JOB_SUBMIT_MAX (32 + 8) +#define RTE_DPAA2_QDMA_COPY_IDX_OFFSET 8 +#define RTE_DPAA2_QDMA_SG_IDX_ADDR_ALIGN \ + RTE_BIT64(RTE_DPAA2_QDMA_COPY_IDX_OFFSET) +#define RTE_DPAA2_QDMA_SG_IDX_ADDR_MASK \ + (RTE_DPAA2_QDMA_SG_IDX_ADDR_ALIGN - 1) +#define RTE_DPAA2_QDMA_SG_SUBMIT(idx_addr, flag) \ + (((uint64_t)idx_addr) | (flag)) + +#define RTE_DPAA2_QDMA_COPY_SUBMIT(idx, flag) \ + ((idx << RTE_DPAA2_QDMA_COPY_IDX_OFFSET) | (flag)) +#define RTE_DPAA2_QDMA_JOB_SUBMIT_MAX (32 + 8) +#define RTE_DMA_CAPA_DPAA2_QDMA_FLAGS_INDEX RTE_BIT64(63) #endif /* _RTE_PMD_DPAA2_QDMA_H_ */ From patchwork Mon Jul 22 11:58:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142586 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8E9B34567F; Mon, 22 Jul 2024 13:59:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D7403402AE; Mon, 22 Jul 2024 13:59:20 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013012.outbound.protection.outlook.com [52.101.67.12]) by mails.dpdk.org (Postfix) with ESMTP id E4A77402D1 for ; Mon, 22 Jul 2024 13:59:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zC1e3qsRWVH1W6UjidpBO0ixriPno4pALdqKQCdRADRIm9RjphVqKguXncvExpPUhsdsY1z4EMnFEH5T/RuHkV91Jn1X+Rv5FbhR0OmFHPitH6CJ7c5HTGwQPCw2/O3doaUfSYUEz7aTY10BfQOzbXxbqrun3AXLjvw+5Z8Ftj8sSVE77uJ81XCdrMn/lIrGTuRsqFC6XYS/QwOdwfdXhVx0LzawTiFhSjeHjy2NTFqadTdTO1J51npSipqJKxANBq7P6mOC/JaK+M42HZoHZ9jtDuFLNubyHFyxP6GUmtNxu0Eq6zEdQQnQHNhG/RgX0ApDcFI7d5doUmVM71XipQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wrC9d/vCWiKusJC1WvvgXdLXfKL+EzvDi15qvtekvWg=; b=uKWsOIn+okW044TLQyo71v7estLltBXxoHdhgCwKh9yapH+cbVAKA1hzI/4h70ItEDt/b010XGFTIYtmQXz+W3B/DvpgmVjCYSc7jwWHLDlrcJIsni1cOr21+eKcnV5FryM5UqS1y/3X+Vvf6C1/d7B2A/qVT3X50H30HLNCHMeWkZqbHRAi0CcPJK3J5JRpUiorOXkxlkfA6zeBtgktdWD0uQBXFAz/7H/qxEqYb+QY5g3AWiclM5w6My7XzLlXE5+H9P55NGxMVNkvOeKE/jHItQMCagfYFoN9zZhTrrT+Z6btz7MRb2fFg0wtFxwySED3YRiV+e5jfqaqtB3X6Q== 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=wrC9d/vCWiKusJC1WvvgXdLXfKL+EzvDi15qvtekvWg=; b=OYwGahmYjoSlGc2EPhQO0+/+9ZE1EvvnPn2QuBJVWuK4PVtJLDrnQ9KWGCi5BmhrVyV7vPC5GKX93C1+/Wlug80AwODoa5C8o5v1ZNylQWYn8djCOxFq5UjraUZTIL7xyYcNSPl1eVJaur1v+ClZOGgFQNSj8/6MTGp6SNH4x5Q= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:16 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:16 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Jun Yang Subject: [v2 08/30] bus/fslmc: enhance the qbman dq storage logic Date: Mon, 22 Jul 2024 17:28:21 +0530 Message-Id: <20240722115843.1830105-9-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: b32a0686-a8c2-4a53-76b0-08dcaa45b5b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: niTqpS1cdE+b4ZUxnCEkP+4kP4k7hNuS4QLmmsDtoTDBjJNPXOBSJlF7IkTQu8eA//dQrlnlDUi4YYADdLlL8zbAajKgKPms2EW5uo7h8YG1tvlr/9D8n1xp5maSFggjNma8nC9LGcW+4IJvE/Ybdgn7fLPL6MfwczfnctqhkXsdwgcj2oB7PMFJ1f2izrZ53uZbl9nskdYwaKVJjt+L0yhdkr4O1a1ith9DCCYeIGTa+9arp/UEW+Fj+nh8yQEHbRxilXYZZxZahPfmBGiuzGzQoqFcv0+oNrVxAF9ZE2umHz8vRMYuK/IblkUCLUtAZcxaYIOVJD9gWI3Je6mYP+FLDHY++PUtZRsswJmJvnoaUAV/Ts3zcbma/JPstHvj5ie6FaOVY4Fzr5ciAPuCOFwRpuHZyO8/L1y1Tq7kLI0F3NlrGlwYCbIpqbCR9OlHZgInEyLRcnBBlRhrf8MVRVz8iJsnCwJkqmAg+dN0YZvxdutGYS/WE5bX5voTT7VhWNWdJBOXxmsxvQ0cZQbqxvK6GAyXDWp+SkMGxktOWOTVWzeAVeFUmerzlYShJZzwz3JLpScXReSlenUr3pSK25Aqp2y5ITfdPHK7Bl4GzHfVAUIMieqqUdLTHFeJBNJesIdLXRopbV7KRMhRzHRmTpWcJcyUV6UFCwc2BjO1ch5Aex0HQ/cYOGCEUqKo3PpZU4nnIZ4a2tQI3NHIGoHvg8nX53clf0pk9T+l6cLWhCHX+3GSuXjWNEdA/biRKk5NUXQBwe6cR06EcN4CdpBQh7Cf1pzBJvMos3TbQeUcHuMk1Yw96CwuucEzxiUfsvw4EVB4F7BAEzw5694thMCvPwknu7tLay3AgSNgsVtgiFu8Rrd1RccphlX9uBDlF5+LxM/A9vUtM5J9e6aj9Bvvq+5xfB6mwV1cpV97WnLZ/7OQclNixiU0ozFlV224kCrXnbvsLIcEQiaO0odkbrJubGgQjrHuUYMpAF2202iL/XcOsplRekrKnPxevQHZi2/yQUnVSxfUu/x7QhvvsZQMFdD1idg1M3tzaYiKhC89O3vXqc+58rePqpfL5p2L1d37Em1IwOPGZVCtK8iUC4C9w3l0UtpBlfVLrsqQ7EAxS99ARxTLaOYP6EX5cxRFuzj6ma28zuscu21X0htlptLOHeeTjPrGhzWbWKdLTaItSiOvVSJVIofoSEJfJn5m6t0ToPf5SBxgP4JSPwHeX0+UF2G3LC4Q0uoF8R+KskVd3h5dItsYRaljCOqzI+8j6S1UkzdAbRflU1NTzyu4Kcd4vQwUmG14AsM2FY6oyJdjFfn43DQ/mO7HSdElBUJ1wBWLpwuqLOVbqu/t3D0L5cHqrWf/Bm19s9tdIZp+7Cs9oXw9G8PuPVIIVZmodPAfZKHYqNRWAd6dC/A1Ts0isYZBpQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nKggeV3WJm86Zw37IdXrf3XzXcd3sbTbje1kfK1L0cjpW6M1frA2LGnIT2BSRo0pFUVCgmbnGsbO7CsSVHzFN43bPwDKgY9AqQ97maBvEPtmDbasHUY/eZ4gtm6w5GdIf0n8bdRIJSeivIvEDu2M2mP3Dl2ToehoJfQU7KJF/SqOaYaaKCCpGr+U2Zs5ROFziDvZd9F+U8O+XBK09aWC5Tt9sr2D/rtzSwhrikZDE8IC1Wi3pH2Ikk2bYWhaZ4ZLYSLv6IHTLbWRsgFYxWSv7xBLc8kgmq8nhe2q4JSbOIJWUYAFrgh+qohSl133p3g/Ng7mUrXwGFLeNsaPa7SZA2Q4aaZJrmM/tApR5Bt6GHKU8kweUPkXfMsBvnyKiEItyAd+nXB+ItiGEdRxfktfRu/ZarrMGoi4mhB8e6qcVxDxu1+wXWTJKtLYcByTSbHBd7ezbZ69MUTUTa8VgP0SelFLUm124slQwhTMFiXrOeCOcf5PaysZaLvf7GjrOw7ckBv8U9PIuyCJv5p1A/XVvdcdeOZ5gncoqE9nPYsAaTyZQq+ZMMgJ0bsLsc+mqND9esRikxqWX2Qd7S431pM0SXy0rgVxgxaM3fuNK2ld6t3n9Bfm63IslrtsV6YLaJ41G3s15JHdEcD5bVzG9r/V4mBeerHmlCSaRpIyh8q2/cYX2ANaO3j73aXx9grNl0kYmqwZeWidmsLXRpiq2y/kQsbf7CV6MRbL7yteEXf1siSfiqOiVwN/W/yxyd3eyShmwWZ3wdGqYj9Wl1ROpoGlGFFA0vvN3L/eAsqACIDMFPXW9K6pxhO5CgWN9trmlOMmEtCIGW+FHfwas24t3tWBqErONyfMWbV0aA/DZieGcY7TtwiVygz4UxZMa/70Ru/PhOMxKzc7ytne24nuLzbGxe2bA3vHuB3NGBvKa8K1NHZYU532T66d1yhZmVLWrtFK16wT0Kd/yrCimdaEtz/OkmyqN+VL9TOIOoLgciGWeoAnt2S/qiaY1Jef3saybpfnwTPZY91Vw2qef4uqtS8fwsE4XU2RTJxdk7XskYROJ/GeNkgJf6mRMr6u+kh9WixVphy/v8/b+cDEErWafLQYEC2uSclOPgLpSFPlqmlRnxl3qw3a3NR4lTlckNUDspQ6v6jD+S4eh++lSD0ougdtg2WX28OmTa8eU+7Jd7RxBU8Nhw0Xedf9zGRg29oDdkBEB7+lWpiTHy7Un4tlYP1QP9TjGGBLP7Zm52DDA7pzrqwcLH3wCKB9aLnP6LKvb1Oi5TyK0CC/4UEsTBughQP/DYtPthRTh3l3XGDYCBVJ3Hq7b6fIl2zxLe4ie6ulYesbcm0rWQwkmz3Gd0InU9jPlX/1kEP/jpCiZhpKu4smuBOnqszc0VxpV6QHewqooEfNxuNSVJyyva7siHTwTL9MHVWU7QxosrULoKG+SVkZu8hCBffd6tXYkdxdgVBKIuiv/6SGLzFFcFYAOGrzQAB/6lZtr9VSZBi25C/MccxEIoOxOD1C6VggDMr2m2xGn9K4BK6oIF11ViyhfWT8We/IF8Tmno818OvyISfSHSEmjRRBOxhxew5NdeNBRBik5NAV X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b32a0686-a8c2-4a53-76b0-08dcaa45b5b8 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:16.0075 (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: ezABHDty/rL0guuTSRlLvoXk6X32xHuaK0GcWdtEHVVP0qoeQz79HwKCHX9N+OuU X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 From: Jun Yang Multiple DQ storages are used among multiple cores, the single dq storage of first union is leak if multiple storages are allocated. It does not make sense to keep the single dq storage of union, remove it and reuse the first dq storage of multiple storages for this case. Signed-off-by: Jun Yang --- drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 25 ++----- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 7 +- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 38 +++++++++- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 23 ++---- drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 4 +- drivers/dma/dpaa2/dpaa2_qdma.c | 43 ++--------- drivers/net/dpaa2/dpaa2_ethdev.c | 81 ++++++++------------- drivers/net/dpaa2/dpaa2_rxtx.c | 19 +++-- drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 4 +- 9 files changed, 103 insertions(+), 141 deletions(-) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c index 07256ed7ec..160126f6d6 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c @@ -81,22 +81,10 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused, } /* Allocate DQ storage for the DPCI Rx queues */ - rxq = &(dpci_node->rx_queue[i]); - rxq->q_storage = rte_malloc("dq_storage", - sizeof(struct queue_storage_info_t), - RTE_CACHE_LINE_SIZE); - if (!rxq->q_storage) { - DPAA2_BUS_ERR("q_storage allocation failed\n"); - ret = -ENOMEM; + rxq = &dpci_node->rx_queue[i]; + ret = dpaa2_queue_storage_alloc(rxq, 1); + if (ret) goto err; - } - - memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t)); - ret = dpaa2_alloc_dq_storage(rxq->q_storage); - if (ret) { - DPAA2_BUS_ERR("dpaa2_alloc_dq_storage failed\n"); - goto err; - } } /* Enable the device */ @@ -141,12 +129,9 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused, err: for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { - struct dpaa2_queue *rxq = &(dpci_node->rx_queue[i]); + struct dpaa2_queue *rxq = &dpci_node->rx_queue[i]; - if (rxq->q_storage) { - dpaa2_free_dq_storage(rxq->q_storage); - rte_free(rxq->q_storage); - } + dpaa2_queue_storage_free(rxq, 1); } rte_free(dpci_node); diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c index 4aec7b2cd8..a8afc772fd 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -574,6 +574,7 @@ dpaa2_free_dq_storage(struct queue_storage_info_t *q_storage) for (i = 0; i < NUM_DQS_PER_QUEUE; i++) { rte_free(q_storage->dq_storage[i]); + q_storage->dq_storage[i] = NULL; } } @@ -583,7 +584,7 @@ dpaa2_alloc_dq_storage(struct queue_storage_info_t *q_storage) int i = 0; for (i = 0; i < NUM_DQS_PER_QUEUE; i++) { - q_storage->dq_storage[i] = rte_malloc(NULL, + q_storage->dq_storage[i] = rte_zmalloc(NULL, dpaa2_dqrr_size * sizeof(struct qbman_result), RTE_CACHE_LINE_SIZE); if (!q_storage->dq_storage[i]) @@ -591,8 +592,10 @@ dpaa2_alloc_dq_storage(struct queue_storage_info_t *q_storage) } return 0; fail: - while (--i >= 0) + while (--i >= 0) { rte_free(q_storage->dq_storage[i]); + q_storage->dq_storage[i] = NULL; + } return -1; } diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index 169c7917ea..1ce481c88d 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2016-2021 NXP + * Copyright 2016-2024 NXP * */ @@ -165,7 +165,9 @@ struct __rte_cache_aligned dpaa2_queue { uint64_t tx_pkts; uint64_t err_pkts; union { - struct queue_storage_info_t *q_storage; + /**Ingress*/ + struct queue_storage_info_t *q_storage[RTE_MAX_LCORE]; + /**Egress*/ struct qbman_result *cscn; }; struct rte_event ev; @@ -186,6 +188,38 @@ struct swp_active_dqs { uint64_t reserved[7]; }; +#define dpaa2_queue_storage_alloc(q, num) \ +({ \ + int ret = 0, i; \ + \ + for (i = 0; i < (num); i++) { \ + (q)->q_storage[i] = rte_zmalloc(NULL, \ + sizeof(struct queue_storage_info_t), \ + RTE_CACHE_LINE_SIZE); \ + if (!(q)->q_storage[i]) { \ + ret = -ENOBUFS; \ + break; \ + } \ + ret = dpaa2_alloc_dq_storage((q)->q_storage[i]); \ + if (ret) \ + break; \ + } \ + ret; \ +}) + +#define dpaa2_queue_storage_free(q, num) \ +({ \ + int i; \ + \ + for (i = 0; i < (num); i++) { \ + if ((q)->q_storage[i]) { \ + dpaa2_free_dq_storage((q)->q_storage[i]); \ + rte_free((q)->q_storage[i]); \ + (q)->q_storage[i] = NULL; \ + } \ + } \ +}) + #define NUM_MAX_SWP 64 extern struct swp_active_dqs rte_global_active_dqs_list[NUM_MAX_SWP]; diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index c1f7181d55..7df208d004 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -1891,7 +1891,7 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops, } } swp = DPAA2_PER_LCORE_PORTAL; - dq_storage = dpaa2_qp->rx_vq.q_storage->dq_storage[0]; + dq_storage = dpaa2_qp->rx_vq.q_storage[0]->dq_storage[0]; qbman_pull_desc_clear(&pulldesc); qbman_pull_desc_set_numframes(&pulldesc, @@ -1982,10 +1982,7 @@ dpaa2_sec_queue_pair_release(struct rte_cryptodev *dev, uint16_t queue_pair_id) PMD_INIT_FUNC_TRACE(); - if (qp->rx_vq.q_storage) { - dpaa2_free_dq_storage(qp->rx_vq.q_storage); - rte_free(qp->rx_vq.q_storage); - } + dpaa2_queue_storage_free(&qp->rx_vq, 1); rte_mempool_free(qp->fle_pool); rte_free(qp); @@ -2036,18 +2033,10 @@ dpaa2_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id, qp->rx_vq.crypto_data = dev->data; qp->tx_vq.crypto_data = dev->data; - qp->rx_vq.q_storage = rte_malloc("sec dq storage", - sizeof(struct queue_storage_info_t), - RTE_CACHE_LINE_SIZE); - if (!qp->rx_vq.q_storage) { - DPAA2_SEC_ERR("malloc failed for q_storage"); - return -ENOMEM; - } - memset(qp->rx_vq.q_storage, 0, sizeof(struct queue_storage_info_t)); - - if (dpaa2_alloc_dq_storage(qp->rx_vq.q_storage)) { - DPAA2_SEC_ERR("Unable to allocate dequeue storage"); - return -ENOMEM; + retcode = dpaa2_queue_storage_alloc((&qp->rx_vq), 1); + if (retcode) { + dpaa2_queue_storage_free((&qp->rx_vq), 1); + return retcode; } dev->data->queue_pairs[qp_id] = qp; diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c index 4754b9d6f8..c51e68f748 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2021-2022 NXP + * Copyright 2021-2022, 2024 NXP */ #include @@ -853,7 +853,7 @@ dpaa2_sec_raw_dequeue_burst(void *qp_data, uint8_t *drv_ctx, } } swp = DPAA2_PER_LCORE_PORTAL; - dq_storage = dpaa2_qp->rx_vq.q_storage->dq_storage[0]; + dq_storage = dpaa2_qp->rx_vq.q_storage[0]->dq_storage[0]; qbman_pull_desc_clear(&pulldesc); qbman_pull_desc_set_numframes(&pulldesc, diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c index 7de4894b35..53caccecd7 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.c +++ b/drivers/dma/dpaa2/dpaa2_qdma.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018-2023 NXP + * Copyright 2018-2024 NXP */ #include @@ -824,7 +824,7 @@ dpaa2_qdma_dequeue(void *dev_private, dpaa2_dqrr_size : nb_cpls; rxq = &(dpdmai_dev->rx_queue[qdma_vq->vq_id]); fqid = rxq->fqid; - q_storage = rxq->q_storage; + q_storage = rxq->q_storage[0]; if (unlikely(!q_storage->active_dqs)) { q_storage->toggle = 0; @@ -1032,13 +1032,7 @@ dpaa2_qdma_configure(struct rte_dma_dev *dev, qdma_dev->vqs[i].ring_cntx_idx = NULL; } rxq = &dpdmai_dev->rx_queue[i]; - if (rxq->q_storage) { - DPAA2_QDMA_DEBUG("%s rxq[%d] re-configure", - dev->data->dev_name, i); - dpaa2_free_dq_storage(rxq->q_storage); - rte_free(rxq->q_storage); - rxq->q_storage = NULL; - } + dpaa2_queue_storage_free(rxq, 1); } rte_free(qdma_dev->vqs); qdma_dev->vqs = NULL; @@ -1094,24 +1088,9 @@ dpaa2_qdma_configure(struct rte_dma_dev *dev, qdma_dev->vqs[i].vq_id = i; rxq = &dpdmai_dev->rx_queue[i]; /* Allocate DQ storage for the DPDMAI Rx queues */ - rxq->q_storage = rte_zmalloc(NULL, - sizeof(struct queue_storage_info_t), - RTE_CACHE_LINE_SIZE); - if (!rxq->q_storage) { - DPAA2_QDMA_ERR("%s Q[%d] storage alloc failed", - dev->data->dev_name, i); - ret = -ENOMEM; - goto alloc_failed; - } - - memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t)); - ret = dpaa2_alloc_dq_storage(rxq->q_storage); - if (ret) { - DPAA2_QDMA_ERR("%s Q[%d] dq storage alloc failed", - dev->data->dev_name, i); - ret = -ENOMEM; + ret = dpaa2_queue_storage_alloc(rxq, 1); + if (ret) goto alloc_failed; - } } qdma_dev->num_vqs = dev_conf->nb_vchans; @@ -1122,11 +1101,7 @@ dpaa2_qdma_configure(struct rte_dma_dev *dev, alloc_failed: for (i = 0; i < dev_conf->nb_vchans; i++) { rxq = &dpdmai_dev->rx_queue[i]; - if (rxq->q_storage) { - dpaa2_free_dq_storage(rxq->q_storage); - rte_free(rxq->q_storage); - rxq->q_storage = NULL; - } + dpaa2_queue_storage_free(rxq, 1); } rte_free(qdma_dev->vqs); @@ -1324,11 +1299,7 @@ dpaa2_qdma_close(struct rte_dma_dev *dev) /* Free RXQ storages */ for (i = 0; i < qdma_dev->num_vqs; i++) { rxq = &dpdmai_dev->rx_queue[i]; - if (rxq->q_storage) { - dpaa2_free_dq_storage(rxq->q_storage); - rte_free(rxq->q_storage); - rxq->q_storage = NULL; - } + dpaa2_queue_storage_free(rxq, 1); } if (qdma_dev->vqs) { diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 449bbda7ca..ac524d2964 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2016-2021 NXP + * Copyright 2016-2024 NXP * */ @@ -366,7 +366,7 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) uint8_t num_rxqueue_per_tc; struct dpaa2_queue *mc_q, *mcq; uint32_t tot_queues; - int i; + int i, ret = 0; struct dpaa2_queue *dpaa2_q; PMD_INIT_FUNC_TRACE(); @@ -386,16 +386,10 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) for (i = 0; i < priv->nb_rx_queues; i++) { mc_q->eth_data = dev->data; priv->rx_vq[i] = mc_q++; - dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[i]; - dpaa2_q->q_storage = rte_malloc("dq_storage", - sizeof(struct queue_storage_info_t), - RTE_CACHE_LINE_SIZE); - if (!dpaa2_q->q_storage) - goto fail; - - memset(dpaa2_q->q_storage, 0, - sizeof(struct queue_storage_info_t)); - if (dpaa2_alloc_dq_storage(dpaa2_q->q_storage)) + dpaa2_q = priv->rx_vq[i]; + ret = dpaa2_queue_storage_alloc(dpaa2_q, + RTE_MAX_LCORE); + if (ret) goto fail; } @@ -405,19 +399,11 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) if (!priv->rx_err_vq) goto fail; - dpaa2_q = (struct dpaa2_queue *)priv->rx_err_vq; - dpaa2_q->q_storage = rte_malloc("err_dq_storage", - sizeof(struct queue_storage_info_t) * - RTE_MAX_LCORE, - RTE_CACHE_LINE_SIZE); - if (!dpaa2_q->q_storage) + dpaa2_q = priv->rx_err_vq; + ret = dpaa2_queue_storage_alloc(dpaa2_q, + RTE_MAX_LCORE); + if (ret) goto fail; - - memset(dpaa2_q->q_storage, 0, - sizeof(struct queue_storage_info_t)); - for (i = 0; i < RTE_MAX_LCORE; i++) - if (dpaa2_alloc_dq_storage(&dpaa2_q->q_storage[i])) - goto fail; } for (i = 0; i < priv->nb_tx_queues; i++) { @@ -438,24 +424,17 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) mc_q->tc_index = i; mc_q->flow_id = 0; priv->tx_conf_vq[i] = mc_q++; - dpaa2_q = (struct dpaa2_queue *)priv->tx_conf_vq[i]; - dpaa2_q->q_storage = - rte_malloc("dq_storage", - sizeof(struct queue_storage_info_t), - RTE_CACHE_LINE_SIZE); - if (!dpaa2_q->q_storage) - goto fail_tx_conf; - - memset(dpaa2_q->q_storage, 0, - sizeof(struct queue_storage_info_t)); - if (dpaa2_alloc_dq_storage(dpaa2_q->q_storage)) + dpaa2_q = priv->tx_conf_vq[i]; + ret = dpaa2_queue_storage_alloc(dpaa2_q, + RTE_MAX_LCORE); + if (ret) goto fail_tx_conf; } } vq_id = 0; for (dist_idx = 0; dist_idx < priv->nb_rx_queues; dist_idx++) { - mcq = (struct dpaa2_queue *)priv->rx_vq[vq_id]; + mcq = priv->rx_vq[vq_id]; mcq->tc_index = dist_idx / num_rxqueue_per_tc; mcq->flow_id = dist_idx % num_rxqueue_per_tc; vq_id++; @@ -465,15 +444,15 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) fail_tx_conf: i -= 1; while (i >= 0) { - dpaa2_q = (struct dpaa2_queue *)priv->tx_conf_vq[i]; - rte_free(dpaa2_q->q_storage); + dpaa2_q = priv->tx_conf_vq[i]; + dpaa2_queue_storage_free(dpaa2_q, RTE_MAX_LCORE); priv->tx_conf_vq[i--] = NULL; } i = priv->nb_tx_queues; fail_tx: i -= 1; while (i >= 0) { - dpaa2_q = (struct dpaa2_queue *)priv->tx_vq[i]; + dpaa2_q = priv->tx_vq[i]; rte_free(dpaa2_q->cscn); priv->tx_vq[i--] = NULL; } @@ -482,17 +461,14 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) i -= 1; mc_q = priv->rx_vq[0]; while (i >= 0) { - dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[i]; - dpaa2_free_dq_storage(dpaa2_q->q_storage); - rte_free(dpaa2_q->q_storage); + dpaa2_q = priv->rx_vq[i]; + dpaa2_queue_storage_free(dpaa2_q, RTE_MAX_LCORE); priv->rx_vq[i--] = NULL; } if (dpaa2_enable_err_queue) { - dpaa2_q = (struct dpaa2_queue *)priv->rx_err_vq; - if (dpaa2_q->q_storage) - dpaa2_free_dq_storage(dpaa2_q->q_storage); - rte_free(dpaa2_q->q_storage); + dpaa2_q = priv->rx_err_vq; + dpaa2_queue_storage_free(dpaa2_q, RTE_MAX_LCORE); } rte_free(mc_q); @@ -512,20 +488,21 @@ dpaa2_free_rx_tx_queues(struct rte_eth_dev *dev) if (priv->rx_vq[0]) { /* cleaning up queue storage */ for (i = 0; i < priv->nb_rx_queues; i++) { - dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[i]; - rte_free(dpaa2_q->q_storage); + dpaa2_q = priv->rx_vq[i]; + dpaa2_queue_storage_free(dpaa2_q, + RTE_MAX_LCORE); } /* cleanup tx queue cscn */ for (i = 0; i < priv->nb_tx_queues; i++) { - dpaa2_q = (struct dpaa2_queue *)priv->tx_vq[i]; + dpaa2_q = priv->tx_vq[i]; rte_free(dpaa2_q->cscn); } if (priv->flags & DPAA2_TX_CONF_ENABLE) { /* cleanup tx conf queue storage */ for (i = 0; i < priv->nb_tx_queues; i++) { - dpaa2_q = (struct dpaa2_queue *) - priv->tx_conf_vq[i]; - rte_free(dpaa2_q->q_storage); + dpaa2_q = priv->tx_conf_vq[i]; + dpaa2_queue_storage_free(dpaa2_q, + RTE_MAX_LCORE); } } /*free memory for all queues (RX+TX) */ diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 23f7c4132d..a0c057d183 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2016-2021 NXP + * Copyright 2016-2024 NXP * */ @@ -647,7 +647,7 @@ dump_err_pkts(struct dpaa2_queue *dpaa2_q) } swp = DPAA2_PER_LCORE_PORTAL; - dq_storage = dpaa2_q->q_storage[lcore_id].dq_storage[0]; + dq_storage = dpaa2_q->q_storage[lcore_id]->dq_storage[0]; qbman_pull_desc_clear(&pulldesc); qbman_pull_desc_set_fq(&pulldesc, fqid); qbman_pull_desc_set_storage(&pulldesc, dq_storage, @@ -716,7 +716,7 @@ uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) { /* Function receive frames for a given device and VQ*/ - struct dpaa2_queue *dpaa2_q = (struct dpaa2_queue *)queue; + struct dpaa2_queue *dpaa2_q = queue; struct qbman_result *dq_storage, *dq_storage1 = NULL; uint32_t fqid = dpaa2_q->fqid; int ret, num_rx = 0, pull_size; @@ -724,10 +724,12 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) struct qbman_swp *swp; const struct qbman_fd *fd; struct qbman_pull_desc pulldesc; - struct queue_storage_info_t *q_storage = dpaa2_q->q_storage; + struct queue_storage_info_t *q_storage; struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data; struct dpaa2_dev_priv *priv = eth_data->dev_private; + q_storage = dpaa2_q->q_storage[rte_lcore_id()]; + if (unlikely(dpaa2_enable_err_queue)) dump_err_pkts(priv->rx_err_vq); @@ -958,7 +960,7 @@ uint16_t dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) { /* Function receive frames for a given device and VQ */ - struct dpaa2_queue *dpaa2_q = (struct dpaa2_queue *)queue; + struct dpaa2_queue *dpaa2_q = queue; struct qbman_result *dq_storage; uint32_t fqid = dpaa2_q->fqid; int ret, num_rx = 0, next_pull = nb_pkts, num_pulled; @@ -984,7 +986,7 @@ dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) swp = DPAA2_PER_LCORE_PORTAL; do { - dq_storage = dpaa2_q->q_storage->dq_storage[0]; + dq_storage = dpaa2_q->q_storage[0]->dq_storage[0]; qbman_pull_desc_clear(&pulldesc); qbman_pull_desc_set_fq(&pulldesc, fqid); qbman_pull_desc_set_storage(&pulldesc, dq_storage, @@ -1115,7 +1117,7 @@ uint16_t dpaa2_dev_tx_conf(void *queue) swp = DPAA2_PER_LCORE_PORTAL; do { - dq_storage = dpaa2_q->q_storage->dq_storage[0]; + dq_storage = dpaa2_q->q_storage[0]->dq_storage[0]; qbman_pull_desc_clear(&pulldesc); qbman_pull_desc_set_fq(&pulldesc, fqid); qbman_pull_desc_set_storage(&pulldesc, dq_storage, @@ -1954,12 +1956,13 @@ dpaa2_dev_loopback_rx(void *queue, struct qbman_fd *fd[DPAA2_LX2_DQRR_RING_SIZE]; struct qbman_pull_desc pulldesc; struct qbman_eq_desc eqdesc; - struct queue_storage_info_t *q_storage = dpaa2_q->q_storage; + struct queue_storage_info_t *q_storage; struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data; struct dpaa2_dev_priv *priv = eth_data->dev_private; struct dpaa2_queue *tx_q = priv->tx_vq[0]; /* todo - currently we are using 1st TX queue only for loopback*/ + q_storage = dpaa2_q->q_storage[rte_lcore_id()]; if (unlikely(!DPAA2_PER_LCORE_ETHRX_DPIO)) { ret = dpaa2_affine_qbman_ethrx_swp(); if (ret) { diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c index aeee4ac289..5f4d0c68a4 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018-2019 NXP + * Copyright 2018-2019, 2024 NXP */ #include @@ -142,7 +142,7 @@ dpaa2_cmdif_dequeue_bufs(struct rte_rawdev *dev, cmdif_rcv_cnxt = (struct rte_dpaa2_cmdif_context *)(context); rxq = &(cidev->rx_queue[cmdif_rcv_cnxt->priority]); - dq_storage = rxq->q_storage->dq_storage[0]; + dq_storage = rxq->q_storage[0]->dq_storage[0]; qbman_pull_desc_clear(&pulldesc); qbman_pull_desc_set_fq(&pulldesc, rxq->fqid); From patchwork Mon Jul 22 11:58:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142587 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 320DA4567F; Mon, 22 Jul 2024 13:59:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12E91402B9; Mon, 22 Jul 2024 13:59:22 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013032.outbound.protection.outlook.com [52.101.67.32]) by mails.dpdk.org (Postfix) with ESMTP id A7315402B4 for ; Mon, 22 Jul 2024 13:59:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZvYQ1SGImZaEbfuZW9ZSWh6C1b1leS3AgJVzRSu0rZfQW5wL1eny2HAFNYJBVYtt9dAVBluvqixP9IAMxzPj1b5pDxmTchKV2N6C8OkhZcp0pTHAnECOEMFWFOx+g926KkoULk6fA4j9pGO5+NRGqnWBAZJ6fHs/py83Zsi7Ga6Avn6gANuYaf35bPXwY/ocsisnL0B4tFGY2bcDFvtXMGGlAZL4GOd5ydmveOtSiJB0Gkcd2ictH4WDUez+a+WJDUygcJ81lTEn0RVG/Th1+IkCR5OLvC/kaj+mFQ22PrHfXXVJB1pE7pYOho9HQ6Z3s+X1zZFQ6t4U2KGyjCJnbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LU9FT4mFj1QQZtQFAKBe2mKYbfNtZlunXwAQEAtHGHc=; b=Fd315bckewRjWIA30jdUAe6BMBwUwXBD3egTcECFdm3DK6xLitX/bztWequZSiAH6YS/eccDBp+Nbk3SNSBU4aHPGDIkVzPgJgA2aTd1ap1RYmRTRp59O/PMSC8w7AkXnx0WSTiu0+GtglOH8IQ1yqNB+TCp1vhT3tgQBsrLe/v+n7WuQQbjJAftO8tWg5yykfcWISLnB1+KON8rPick3AxkxozOspctXlnIeVfs5XjXtMmFMuMzWvoD5QX9kXAY1bHl/SjdnZqC/Zf7aWBiIMRh3sLzd9X0B+LCmF4PWVcYGc4L+S+FK0zYPfG6SxtR5VYmYLjsvGlvOxWHdgo3uw== 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=LU9FT4mFj1QQZtQFAKBe2mKYbfNtZlunXwAQEAtHGHc=; b=WJ25joTaQqMtVgX4Bg03vQeQUh/3ivX2PfpaHPyEnSdQOn47EPnTPedr9ETDXh3jpsoOn9RXzMb0zmmgnuoMlkK1eQJiTLbQlZRaklkIDQCGtS4Qed+FVd+naD0h1uyOf32vtyA+EZinvFAxqgPKz5oz3EaRSKrGq4kR6SF0cDk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:18 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:18 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [v2 09/30] dma/dpaa2: add short FD support Date: Mon, 22 Jul 2024 17:28:22 +0530 Message-Id: <20240722115843.1830105-10-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: 7dfa1262-0baf-4a4d-accc-08dcaa45b6d2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: t2qLLxNF9jyCK57rXMarxxcjAhjwvFIHju9ADijHi/xli80infN9B7GSnmwwZe5jUQKnat2BuZCrfnhbLG1phb2do9465wX6gXcYB1zO24pkWOW1YiqJI+rPcF8I1kteBx6Sq+kvbZ3Du8v5jwp6NJiMdeYH5R3IX4NygpE1LMrdsBDPfMYdTspSaC5o62erlZ4V1DvmMknb66dfeRT70gRYYhdD549cn1k5IIWaUVaoiCmw7giwRPlUf22/2dk+Gtj1VcOmtRwR5iUv2B1OOFE+Nh1kX0Bpbw360eCCCB6Qk3KnKG7U7sODt0NMVuaC7HgdwEBAwkvCnkQEA0b6RLidx4o8arG4S/GUwcYHBdQIK7HGjEiT0T/RbkSox4xNMGV3voM3ItA//7htXM5RPmF0yVTqrYKnVxRPHeVOizKOEk8yqvH1G4/TE9yqqOIczcUq4lHZH8cTHAm1Jo4JKpCW1svygUBuoMaTI9A04MDdfnbuITEWoIvwxqaBO0c8QZ6v1dE2iglWGR49zuFXyxBuvt9OHVnHGeF5U6u9o/FzpghdJPIz6JlGUxXrnTEklCyTyQ0eM8uCeFcDkkath00fIvW8/0ZwLE1QJ/70MBB7eDweAa7Q0B7qkznK19d942VY2UefgpwDYdtXvtIxmuwjuRVcaz4zcvM57K9uKU472GGWSoiBITC5Qloo1jRRrygt1ZEDWutkUD0CYYSeA/wIn7dAxmi4T1HhCMwNy5ggWJJpjUQrc2LpMDoOBM/0HsdbZs7H53UDI2rtcM102mzawL1HbzagIVCmFOFQ+VTeg6eOqPIz8MvImbt8FikC+DKEFJ+PPTtBmQJ9Oz112ScNeqIQXej2/NENDigplkDK9xUQARo4NpFsdY9oeD/1MOYuATY1ip2ptwl8aAEIxEBxzP5zYFR7mG7oxLLuwCvqtlh0p2tvZr/0PZ7bGdkjAjXbFpH+bAhB0Clorelf/gdu5Pk2nUzYDH723HZ1SM6iLpsrj5A4goxH9Bmww9PIq7oZSVESw5N7Yl2G9e5QdrWx2/Z+rEZWxf9BoBWu0Kk3DQ6pYNT1PKKVuIVJyTsn9NzBVoBSfwJB5VrLG325/xCMthpemeoCCSvAgUmezDQXW9EvPTHeZbfMiOYBW7NwcDFFmFXbsggONvW7LkJj0ER91vN+LkjdB29boGBrK+Tr6yyFKeBq25MRHm9VzBDrx7azPrb455XE0AZQY+dyntKQ2tJTSmOppN5DqbETEb+CeVFbTuAcEqPS6rvEVep/2P9Y4hnJwgbJBnm/Oh3YcGznRVxEd+4ttZeK6XsXJ06+sibka/eIQ0Pc/0hcBAoc0JcBw+/DRI1lMRZ0R/p8mLOe+7NdDbudckknrWgmUdbEoxa0pwXDUPlO2SJ2H3D2EWkXijUXjJuBek0tg3DqzA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AgQuTuVNr0UniPCLcsMAHo2D8A92KUi1pS/N9B39pcsTSf6t9qwVDM7gpWNb9S4uqh1EMeKSA85clYnG/UVEhoyMxl81Goe8YIYzzRUVosX60VF0c8D0g/e8WfQz6a7/WIClnxjh0gaTXba5hVoeXqGzauEHAiDZlkFt8LnCjdBOVX/60n1c7cjwYKhTDGgEGxih3zwUrLZsPgxQ5glT9tt6fe6YIdfwjfhcZ/MfhMIcYX7zTcMerAurpr62MlcqNbGrABPg73hyletCGkp+0QLjuZi3r94EmpEFHACmaDQIMtQ1laImw4Nj+UOCqLJuPeDW5SeWjGzelWossrHJoMGY8jDCXPh74K9pbzJ44egPFF4NhgBdlYBImbnRGT0tTDteLbviTqFOHkTAMukyiiAalrXmDTXxJaQkHmrmFj4FiOK5j4x0KYlTGfisrMWCJ6mXLONO0OofvQPBlMVfcITyghRHef5eHK8mCCjXZ2MH+LPvvCQO5ZEndPPe31xOUpjeGC4bAToqbgEcFtAnR6J1Y6DzGDm2BCbukw5s6iZ0L1g2p1FZqjk8yKq+PnQW5G7lSaL/I9vwIXpaln4dUnnP8OlevWYuhrzyJbGwooo1uO5IB81IsWMaIXPRHyKgYEtN8bYQlEOgdUBI5PCXrclyAQ267EBV3tBztjOBXzBiTgj1nTZW+2cpze2j19hWlaiyXqU07FQWdJTg8p9gJZtwt7iVspAADmeUZtPqykBbYOYF8sBHUCxmU25utEd2zE2qDQrtC8qYMkdy36kzIl+ZB2Ro2XOqPPDvxLD7WOY+nv5K3mg1ujix7+spo0lmRDScDL2OUsMXKjTjm4dD9R6QqHAcAiVwapHBuqT32SPJyU5rNFXNzGhpLD2x5uMDdSTF7ps6IMsk8xrw+Ne4cstz8zg2hBv5fIPaaSTOPOab2zMi7uMfNQ0rKD4EwTmL0rV9Tn9zxmXn3M4tG3jvuopI3XMrMZahGlKNoOgA73FF702u7Suze5A9MTUHU8Hj4FTctO5yG1UG233zpZXLtAcRSwPk3Kshtd1dzdOr1XcTHtsbk8b1eRQsbqYlsv1U94tsznLi1HfYp72PGN0D2PW+WaUdTHAXqC2A8XWAyUmEzSE48XJmgpw3Lf3YHa4BgMpsmWB5DTPetbE0aRliXVmn6Uc7EZCbSuohQS4vaHYpvSCyXRoxj6Ij6z8QS1HgejU1STVAqCbIcdrZMJgx2UIdHTYcWP+QefNKbwxReX+1bzbKDxhBkZfSfc5Of1qvD1c5cd47fbwTgczLDEM7a5mXwzI4iALnELv+oWFlt0O99B6u6TRMox7qOUKR39Q9oU0SGSJTJHTfxW4OklbzniQgqvn3yOI+lCrDpB7uhWzCPlrG0r648vBWL/99bKJ+s6BP/BLRDq/u19CuDHon3jnbbuQMVPm48E41vNUQ0is2P33oZlwcS6Q2oD2344U3W+J4RMP7I44n+XCxHurl1ZJYJOZRfWBvnv96FnoteZ6RDNcOY8q327EPwXwGkr4g8jYRPTcsH5OmizYzKPNfMrgwbQCSodzM/PqLk93/QOtpd1WtP/ZegmyT51RQGcXZ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7dfa1262-0baf-4a4d-accc-08dcaa45b6d2 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:17.9987 (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: sWD6SYzFPPKSvlWU2GKmm1LwWgjP3j8DUbQHPd+G+pbGxrh1fd2C/5G87WXaRfui X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 From: Jun Yang Short FD can be used for single transfer scenario which shows higher performance than FLE. 1) Save index context in FD att field for short and FLE(NonSG). 2) Identify FD type by att of FD. 3) Force 48 bits address for source address and fle according to spec. Signed-off-by: Jun Yang --- drivers/dma/dpaa2/dpaa2_qdma.c | 314 +++++++++++++++++++------ drivers/dma/dpaa2/dpaa2_qdma.h | 69 ++++-- drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h | 13 - 3 files changed, 285 insertions(+), 111 deletions(-) diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c index 53caccecd7..d1358b686c 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.c +++ b/drivers/dma/dpaa2/dpaa2_qdma.c @@ -522,7 +522,6 @@ dpaa2_qdma_long_fmt_dump(const struct qbman_fle *fle) const struct qdma_cntx_fle_sdd *fle_sdd; const struct qdma_sdd *sdd; const struct qdma_cntx_sg *cntx_sg = NULL; - const struct qdma_cntx_long *cntx_long = NULL; fle_sdd = container_of(fle, const struct qdma_cntx_fle_sdd, fle[0]); sdd = fle_sdd->sdd; @@ -545,11 +544,8 @@ dpaa2_qdma_long_fmt_dump(const struct qbman_fle *fle) QBMAN_FLE_WORD4_FMT_SGE) { cntx_sg = container_of(fle_sdd, const struct qdma_cntx_sg, fle_sdd); - } else if (fle[DPAA2_QDMA_SRC_FLE].word4.fmt == + } else if (fle[DPAA2_QDMA_SRC_FLE].word4.fmt != QBMAN_FLE_WORD4_FMT_SBF) { - cntx_long = container_of(fle_sdd, const struct qdma_cntx_long, - fle_sdd); - } else { DPAA2_QDMA_ERR("Unsupported fle format:%d", fle[DPAA2_QDMA_SRC_FLE].word4.fmt); return; @@ -560,11 +556,6 @@ dpaa2_qdma_long_fmt_dump(const struct qbman_fle *fle) dpaa2_qdma_sdd_dump(&sdd[i]); } - if (cntx_long) { - DPAA2_QDMA_INFO("long format/Single buffer cntx idx:%d", - cntx_long->cntx_idx); - } - if (cntx_sg) { DPAA2_QDMA_INFO("long format/SG format, job number:%d", cntx_sg->job_nb); @@ -582,6 +573,8 @@ dpaa2_qdma_long_fmt_dump(const struct qbman_fle *fle) DPAA2_QDMA_INFO("cntx_idx[%d]:%d", i, cntx_sg->cntx_idx[i]); } + } else { + DPAA2_QDMA_INFO("long format/Single buffer cntx"); } } @@ -644,7 +637,7 @@ dpaa2_qdma_copy_sg(void *dev_private, offsetof(struct qdma_cntx_sg, fle_sdd) + offsetof(struct qdma_cntx_fle_sdd, fle); - DPAA2_SET_FD_ADDR(fd, fle_iova); + dpaa2_qdma_fd_set_addr(fd, fle_iova); DPAA2_SET_FD_COMPOUND_FMT(fd); DPAA2_SET_FD_FLC(fd, (uint64_t)cntx_sg); @@ -680,6 +673,7 @@ dpaa2_qdma_copy_sg(void *dev_private, if (unlikely(qdma_vq->flags & DPAA2_QDMA_DESC_DEBUG_FLAG)) dpaa2_qdma_long_fmt_dump(cntx_sg->fle_sdd.fle); + dpaa2_qdma_fd_save_att(fd, 0, DPAA2_QDMA_FD_SG); qdma_vq->fd_idx++; qdma_vq->silent_idx = (qdma_vq->silent_idx + 1) & (DPAA2_QDMA_MAX_DESC - 1); @@ -696,74 +690,178 @@ dpaa2_qdma_copy_sg(void *dev_private, return ret; } +static inline void +qdma_populate_fd_pci(uint64_t src, uint64_t dest, + uint32_t len, struct qbman_fd *fd, + struct dpaa2_qdma_rbp *rbp, int ser) +{ + fd->simple_pci.saddr_lo = lower_32_bits(src); + fd->simple_pci.saddr_hi = upper_32_bits(src); + + fd->simple_pci.len_sl = len; + + fd->simple_pci.bmt = DPAA2_QDMA_BMT_DISABLE; + fd->simple_pci.fmt = DPAA2_QDMA_FD_SHORT_FORMAT; + fd->simple_pci.sl = 1; + fd->simple_pci.ser = ser; + if (ser) + fd->simple.frc |= QDMA_SER_CTX; + + fd->simple_pci.sportid = rbp->sportid; + + fd->simple_pci.svfid = rbp->svfid; + fd->simple_pci.spfid = rbp->spfid; + fd->simple_pci.svfa = rbp->svfa; + fd->simple_pci.dvfid = rbp->dvfid; + fd->simple_pci.dpfid = rbp->dpfid; + fd->simple_pci.dvfa = rbp->dvfa; + + fd->simple_pci.srbp = rbp->srbp; + if (rbp->srbp) + fd->simple_pci.rdttype = 0; + else + fd->simple_pci.rdttype = dpaa2_coherent_alloc_cache; + + /*dest is pcie memory */ + fd->simple_pci.dportid = rbp->dportid; + fd->simple_pci.drbp = rbp->drbp; + if (rbp->drbp) + fd->simple_pci.wrttype = 0; + else + fd->simple_pci.wrttype = dpaa2_coherent_no_alloc_cache; + + fd->simple_pci.daddr_lo = lower_32_bits(dest); + fd->simple_pci.daddr_hi = upper_32_bits(dest); +} + +static inline void +qdma_populate_fd_ddr(uint64_t src, uint64_t dest, + uint32_t len, struct qbman_fd *fd, int ser) +{ + fd->simple_ddr.saddr_lo = lower_32_bits(src); + fd->simple_ddr.saddr_hi = upper_32_bits(src); + + fd->simple_ddr.len = len; + + fd->simple_ddr.bmt = DPAA2_QDMA_BMT_DISABLE; + fd->simple_ddr.fmt = DPAA2_QDMA_FD_SHORT_FORMAT; + fd->simple_ddr.sl = 1; + fd->simple_ddr.ser = ser; + if (ser) + fd->simple.frc |= QDMA_SER_CTX; + /** + * src If RBP=0 {NS,RDTTYPE[3:0]}: 0_1011 + * Coherent copy of cacheable memory, + * lookup in downstream cache, no allocate + * on miss. + */ + fd->simple_ddr.rns = 0; + fd->simple_ddr.rdttype = dpaa2_coherent_alloc_cache; + /** + * dest If RBP=0 {NS,WRTTYPE[3:0]}: 0_0111 + * Coherent write of cacheable memory, + * lookup in downstream cache, no allocate on miss + */ + fd->simple_ddr.wns = 0; + fd->simple_ddr.wrttype = dpaa2_coherent_no_alloc_cache; + + fd->simple_ddr.daddr_lo = lower_32_bits(dest); + fd->simple_ddr.daddr_hi = upper_32_bits(dest); +} + static int -dpaa2_qdma_copy(void *dev_private, uint16_t vchan, - rte_iova_t src, rte_iova_t dst, - uint32_t length, uint64_t flags) +dpaa2_qdma_short_copy(struct qdma_virt_queue *qdma_vq, + rte_iova_t src, rte_iova_t dst, uint32_t length, + int is_silent, uint64_t flags) { - struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; - struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; - struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; int ret = 0, expected; struct qbman_fd *fd = &qdma_vq->fd[qdma_vq->fd_idx]; - struct qdma_cntx_long *cntx_long = NULL; - rte_iova_t cntx_iova, fle_iova, sdd_iova; + + memset(fd, 0, sizeof(struct qbman_fd)); + + if (qdma_vq->rbp.drbp || qdma_vq->rbp.srbp) { + /** PCIe EP*/ + qdma_populate_fd_pci(src, + dst, length, + fd, &qdma_vq->rbp, + is_silent ? 0 : 1); + } else { + /** DDR or PCIe RC*/ + qdma_populate_fd_ddr(src, + dst, length, + fd, is_silent ? 0 : 1); + } + dpaa2_qdma_fd_save_att(fd, DPAA2_QDMA_IDX_FROM_FLAG(flags), + DPAA2_QDMA_FD_SHORT); + qdma_vq->fd_idx++; + + if (flags & RTE_DMA_OP_FLAG_SUBMIT) { + expected = qdma_vq->fd_idx; + ret = dpaa2_qdma_multi_eq(qdma_vq); + if (likely(ret == expected)) { + qdma_vq->copy_num++; + return (qdma_vq->copy_num - 1) & UINT16_MAX; + } + } else { + qdma_vq->copy_num++; + return (qdma_vq->copy_num - 1) & UINT16_MAX; + } + + return ret; +} + +static int +dpaa2_qdma_long_copy(struct qdma_virt_queue *qdma_vq, + rte_iova_t src, rte_iova_t dst, uint32_t length, + int is_silent, uint64_t flags) +{ + int ret = 0, expected; + struct qbman_fd *fd = &qdma_vq->fd[qdma_vq->fd_idx]; + struct qdma_cntx_fle_sdd *fle_sdd = NULL; + rte_iova_t fle_iova, sdd_iova; struct qbman_fle *fle; struct qdma_sdd *sdd; memset(fd, 0, sizeof(struct qbman_fd)); - if (qdma_dev->is_silent) { - cntx_long = qdma_vq->cntx_long[qdma_vq->silent_idx]; + if (is_silent) { + fle_sdd = qdma_vq->cntx_fle_sdd[qdma_vq->silent_idx]; } else { ret = rte_mempool_get(qdma_vq->fle_pool, - (void **)&cntx_long); + (void **)&fle_sdd); if (ret) return ret; DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX); - cntx_long->cntx_idx = DPAA2_QDMA_IDX_FROM_FLAG(flags); } -#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - cntx_iova = rte_mempool_virt2iova(cntx_long); -#else - cntx_iova = DPAA2_VADDR_TO_IOVA(cntx_long); -#endif - - fle = cntx_long->fle_sdd.fle; - fle_iova = cntx_iova + - offsetof(struct qdma_cntx_long, fle_sdd) + - offsetof(struct qdma_cntx_fle_sdd, fle); + fle = fle_sdd->fle; + fle_iova = (uint64_t)fle - qdma_vq->fle_iova2va_offset; - DPAA2_SET_FD_ADDR(fd, fle_iova); + dpaa2_qdma_fd_set_addr(fd, fle_iova); DPAA2_SET_FD_COMPOUND_FMT(fd); - DPAA2_SET_FD_FLC(fd, (uint64_t)cntx_long); + DPAA2_SET_FD_FLC(fd, (uint64_t)fle); if (qdma_vq->fle_pre_populate) { if (unlikely(!fle[DPAA2_QDMA_SRC_FLE].length)) { - fle_sdd_pre_populate(&cntx_long->fle_sdd, + fle_sdd_pre_populate(fle_sdd, &qdma_vq->rbp, 0, 0, QBMAN_FLE_WORD4_FMT_SBF); - if (!qdma_dev->is_silent && cntx_long) { - cntx_long->cntx_idx = - DPAA2_QDMA_IDX_FROM_FLAG(flags); - } } fle_post_populate(fle, src, dst, length); } else { - sdd = cntx_long->fle_sdd.sdd; - sdd_iova = cntx_iova + - offsetof(struct qdma_cntx_long, fle_sdd) + - offsetof(struct qdma_cntx_fle_sdd, sdd); + sdd = fle_sdd->sdd; + sdd_iova = (uint64_t)sdd - qdma_vq->fle_iova2va_offset; fle_populate(fle, sdd, sdd_iova, &qdma_vq->rbp, src, dst, length, QBMAN_FLE_WORD4_FMT_SBF); } if (unlikely(qdma_vq->flags & DPAA2_QDMA_DESC_DEBUG_FLAG)) - dpaa2_qdma_long_fmt_dump(cntx_long->fle_sdd.fle); + dpaa2_qdma_long_fmt_dump(fle); + dpaa2_qdma_fd_save_att(fd, DPAA2_QDMA_IDX_FROM_FLAG(flags), + DPAA2_QDMA_FD_LONG); qdma_vq->fd_idx++; qdma_vq->silent_idx = (qdma_vq->silent_idx + 1) & (DPAA2_QDMA_MAX_DESC - 1); @@ -771,15 +869,89 @@ dpaa2_qdma_copy(void *dev_private, uint16_t vchan, if (flags & RTE_DMA_OP_FLAG_SUBMIT) { expected = qdma_vq->fd_idx; ret = dpaa2_qdma_multi_eq(qdma_vq); - if (likely(ret == expected)) - return 0; + if (likely(ret == expected)) { + qdma_vq->copy_num++; + return (qdma_vq->copy_num - 1) & UINT16_MAX; + } } else { - return 0; + qdma_vq->copy_num++; + return (qdma_vq->copy_num - 1) & UINT16_MAX; } return ret; } +static int +dpaa2_qdma_copy(void *dev_private, uint16_t vchan, + rte_iova_t src, rte_iova_t dst, + uint32_t length, uint64_t flags) +{ + struct dpaa2_dpdmai_dev *dpdmai_dev = dev_private; + struct qdma_device *qdma_dev = dpdmai_dev->qdma_dev; + struct qdma_virt_queue *qdma_vq = &qdma_dev->vqs[vchan]; + + if (qdma_vq->using_short_fd) + return dpaa2_qdma_short_copy(qdma_vq, src, dst, + length, qdma_dev->is_silent, flags); + else + return dpaa2_qdma_long_copy(qdma_vq, src, dst, + length, qdma_dev->is_silent, flags); +} + +static inline int +dpaa2_qdma_dq_fd(const struct qbman_fd *fd, + struct qdma_virt_queue *qdma_vq, + uint16_t *free_space, uint16_t *fle_elem_nb) +{ + uint16_t idx, att; + enum dpaa2_qdma_fd_type type; + int ret; + struct qdma_cntx_sg *cntx_sg; + struct qdma_cntx_fle_sdd *fle_sdd; + + att = dpaa2_qdma_fd_get_att(fd); + type = DPAA2_QDMA_FD_ATT_TYPE(att); + if (type == DPAA2_QDMA_FD_SHORT) { + idx = DPAA2_QDMA_FD_ATT_CNTX(att); + ret = qdma_cntx_idx_ring_eq(qdma_vq->ring_cntx_idx, + &idx, 1, free_space); + if (unlikely(ret != 1)) + return -ENOSPC; + + return 0; + } + if (type == DPAA2_QDMA_FD_LONG) { + idx = DPAA2_QDMA_FD_ATT_CNTX(att); + fle_sdd = (void *)(uintptr_t)DPAA2_GET_FD_FLC(fd); + qdma_vq->fle_elem[*fle_elem_nb] = fle_sdd; + (*fle_elem_nb)++; + ret = qdma_cntx_idx_ring_eq(qdma_vq->ring_cntx_idx, + &idx, 1, free_space); + if (unlikely(ret != 1)) + return -ENOSPC; + + return 0; + } + if (type == DPAA2_QDMA_FD_SG) { + fle_sdd = (void *)(uintptr_t)DPAA2_GET_FD_FLC(fd); + qdma_vq->fle_elem[*fle_elem_nb] = fle_sdd; + (*fle_elem_nb)++; + cntx_sg = container_of(fle_sdd, + struct qdma_cntx_sg, fle_sdd); + ret = qdma_cntx_idx_ring_eq(qdma_vq->ring_cntx_idx, + cntx_sg->cntx_idx, + cntx_sg->job_nb, free_space); + if (unlikely(ret < cntx_sg->job_nb)) + return -ENOSPC; + + return 0; + } + + DPAA2_QDMA_ERR("Invalid FD type, ATT=0x%04x", + fd->simple_ddr.rsv1_att); + return -EIO; +} + static uint16_t dpaa2_qdma_dequeue(void *dev_private, uint16_t vchan, const uint16_t nb_cpls, @@ -799,10 +971,6 @@ dpaa2_qdma_dequeue(void *dev_private, uint8_t num_rx = 0; const struct qbman_fd *fd; int ret, pull_size; - struct qbman_fle *fle; - struct qdma_cntx_fle_sdd *fle_sdd; - struct qdma_cntx_sg *cntx_sg; - struct qdma_cntx_long *cntx_long; uint16_t free_space = 0, fle_elem_nb = 0; if (unlikely(qdma_dev->is_silent)) @@ -901,25 +1069,8 @@ dpaa2_qdma_dequeue(void *dev_private, continue; } fd = qbman_result_DQ_fd(dq_storage); - fle_sdd = (void *)(uintptr_t)DPAA2_GET_FD_FLC(fd); - fle = fle_sdd->fle; - qdma_vq->fle_elem[fle_elem_nb] = fle_sdd; - fle_elem_nb++; - if (fle[DPAA2_QDMA_SRC_FLE].word4.fmt == - QBMAN_FLE_WORD4_FMT_SGE) { - cntx_sg = container_of(fle_sdd, - struct qdma_cntx_sg, fle_sdd); - ret = qdma_cntx_idx_ring_eq(qdma_vq->ring_cntx_idx, - cntx_sg->cntx_idx, - cntx_sg->job_nb, &free_space); - } else { - cntx_long = container_of(fle_sdd, - struct qdma_cntx_long, fle_sdd); - ret = qdma_cntx_idx_ring_eq(qdma_vq->ring_cntx_idx, - &cntx_long->cntx_idx, - 1, &free_space); - } - if (!ret || free_space < RTE_DPAA2_QDMA_JOB_SUBMIT_MAX) + ret = dpaa2_qdma_dq_fd(fd, qdma_vq, &free_space, &fle_elem_nb); + if (ret || free_space < RTE_DPAA2_QDMA_JOB_SUBMIT_MAX) pending = 0; dq_storage++; @@ -944,8 +1095,10 @@ dpaa2_qdma_dequeue(void *dev_private, q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index; set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index, dq_storage1); - rte_mempool_put_bulk(qdma_vq->fle_pool, - qdma_vq->fle_elem, fle_elem_nb); + if (fle_elem_nb > 0) { + rte_mempool_put_bulk(qdma_vq->fle_pool, + qdma_vq->fle_elem, fle_elem_nb); + } num_rx = qdma_cntx_idx_ring_dq(qdma_vq->ring_cntx_idx, cntx_idx, nb_cpls); @@ -1178,11 +1331,18 @@ dpaa2_qdma_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan, else qdma_dev->vqs[vchan].flags &= (~DPAA2_QDMA_DESC_DEBUG_FLAG); + /** Default Enable Short FD for nonSG format. + * Short FD has higher perf than FLE. + */ + env = getenv("DPAA2_QDMA_USING_SHORT_FD"); + if (env) + qdma_dev->vqs[vchan].using_short_fd = atoi(env); + else + qdma_dev->vqs[vchan].using_short_fd = 1; + snprintf(pool_name, sizeof(pool_name), "qdma_fle_pool_dev%d_qid%d", dpdmai_dev->dpdmai_id, vchan); - pool_size = RTE_MAX(sizeof(struct qdma_cntx_sg), - sizeof(struct qdma_cntx_long)); - + pool_size = sizeof(struct qdma_cntx_sg); qdma_dev->vqs[vchan].fle_pool = rte_mempool_create(pool_name, DPAA2_QDMA_MAX_DESC * 2, pool_size, 512, 0, NULL, NULL, NULL, NULL, @@ -1202,7 +1362,7 @@ dpaa2_qdma_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan, return ret; } ret = rte_mempool_get_bulk(qdma_dev->vqs[vchan].fle_pool, - (void **)qdma_dev->vqs[vchan].cntx_long, + (void **)qdma_dev->vqs[vchan].cntx_fle_sdd, DPAA2_QDMA_MAX_DESC); if (ret) { DPAA2_QDMA_ERR("long cntx get from %s for silent mode", diff --git a/drivers/dma/dpaa2/dpaa2_qdma.h b/drivers/dma/dpaa2/dpaa2_qdma.h index 371393cb85..0be65e1cc6 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.h +++ b/drivers/dma/dpaa2/dpaa2_qdma.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018-2023 NXP + * Copyright 2018-2024 NXP */ #ifndef _DPAA2_QDMA_H_ @@ -12,17 +12,8 @@ #define DPAA2_QDMA_MIN_DESC 1 #define DPAA2_QDMA_MAX_VHANS 64 -#define DPAA2_QDMA_VQ_FD_SHORT_FORMAT (1ULL << 0) -#define DPAA2_QDMA_VQ_FD_SG_FORMAT (1ULL << 1) -#define DPAA2_QDMA_VQ_NO_RESPONSE (1ULL << 2) - #define DPAA2_DPDMAI_MAX_QUEUES 16 -#define QDMA_JOB_HW_CNTX_IDX (RTE_DPAA2_QDMA_JOB_USR_CNTX_IDX + 1) - -/** FLE pool cache size */ -#define QDMA_FLE_CACHE_SIZE(_num) (_num/(RTE_MAX_LCORE * 2)) - /** Notification by FQD_CTX[fqid] */ #define QDMA_SER_CTX (1 << 8) #define DPAA2_RBP_MEM_RW 0x0 @@ -40,9 +31,14 @@ #define DPAA2_LX2_COHERENT_ALLOCATE_CACHE 0xb /** Maximum possible H/W Queues on each core */ -#define MAX_HW_QUEUE_PER_CORE 64 +#define MAX_HW_QUEUE_PER_CORE 64 + +#define DPAA2_QDMA_FD_FLUSH_FORMAT 0x0 +#define DPAA2_QDMA_FD_LONG_FORMAT 0x1 +#define DPAA2_QDMA_FD_SHORT_FORMAT 0x3 -#define QDMA_RBP_UPPER_ADDRESS_MASK (0xfff0000000000) +#define DPAA2_QDMA_BMT_ENABLE 0x1 +#define DPAA2_QDMA_BMT_DISABLE 0x0 /** Source/Destination Descriptor */ struct qdma_sdd { @@ -99,8 +95,8 @@ struct qdma_sdd { #define QDMA_SG_SL_SHORT 0x1 /* short length */ #define QDMA_SG_SL_LONG 0x0 /* long length */ #define QDMA_SG_F 0x1 /* last sg entry */ -#define QDMA_SG_BMT_ENABLE 0x1 -#define QDMA_SG_BMT_DISABLE 0x0 +#define QDMA_SG_BMT_ENABLE DPAA2_QDMA_BMT_ENABLE +#define QDMA_SG_BMT_DISABLE DPAA2_QDMA_BMT_DISABLE struct qdma_sg_entry { uint32_t addr_lo; /* address 0:31 */ @@ -166,6 +162,40 @@ struct dpaa2_qdma_rbp { uint32_t rsv:2; }; +enum dpaa2_qdma_fd_type { + DPAA2_QDMA_FD_SHORT = 1, + DPAA2_QDMA_FD_LONG = 2, + DPAA2_QDMA_FD_SG = 3 +}; + +#define DPAA2_QDMA_FD_ATT_TYPE_OFFSET 13 +#define DPAA2_QDMA_FD_ATT_TYPE(att) \ + (att >> DPAA2_QDMA_FD_ATT_TYPE_OFFSET) +#define DPAA2_QDMA_FD_ATT_CNTX(att) \ + (att & ((1 << DPAA2_QDMA_FD_ATT_TYPE_OFFSET) - 1)) + +static inline void +dpaa2_qdma_fd_set_addr(struct qbman_fd *fd, + uint64_t addr) +{ + fd->simple_ddr.saddr_lo = lower_32_bits(addr); + fd->simple_ddr.saddr_hi = upper_32_bits(addr); +} + +static inline void +dpaa2_qdma_fd_save_att(struct qbman_fd *fd, + uint16_t job_idx, enum dpaa2_qdma_fd_type type) +{ + fd->simple_ddr.rsv1_att = job_idx | + (type << DPAA2_QDMA_FD_ATT_TYPE_OFFSET); +} + +static inline uint16_t +dpaa2_qdma_fd_get_att(const struct qbman_fd *fd) +{ + return fd->simple_ddr.rsv1_att; +} + enum { DPAA2_QDMA_SDD_FLE, DPAA2_QDMA_SRC_FLE, @@ -193,12 +223,6 @@ struct qdma_cntx_sg { uint16_t rsv[3]; } __rte_packed; -struct qdma_cntx_long { - struct qdma_cntx_fle_sdd fle_sdd; - uint16_t cntx_idx; - uint16_t rsv[3]; -} __rte_packed; - #define DPAA2_QDMA_IDXADDR_FROM_SG_FLAG(flag) \ ((void *)(uintptr_t)((flag) - ((flag) & RTE_DPAA2_QDMA_SG_IDX_ADDR_MASK))) @@ -241,6 +265,7 @@ struct qdma_virt_queue { struct dpaa2_dpdmai_dev *dpdmai_dev; /** FLE pool for the queue */ struct rte_mempool *fle_pool; + uint64_t fle_iova2va_offset; void **fle_elem; /** Route by port */ struct dpaa2_qdma_rbp rbp; @@ -252,6 +277,7 @@ struct qdma_virt_queue { uint64_t num_enqueues; /* Total number of dequeues from this VQ */ uint64_t num_dequeues; + uint64_t copy_num; uint16_t vq_id; uint32_t flags; @@ -261,10 +287,11 @@ struct qdma_virt_queue { /**Used for silent enabled*/ struct qdma_cntx_sg *cntx_sg[DPAA2_QDMA_MAX_DESC]; - struct qdma_cntx_long *cntx_long[DPAA2_QDMA_MAX_DESC]; + struct qdma_cntx_fle_sdd *cntx_fle_sdd[DPAA2_QDMA_MAX_DESC]; uint16_t silent_idx; int num_valid_jobs; + int using_short_fd; struct rte_dma_stats stats; }; diff --git a/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h b/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h index e49604c8fc..df21b39cae 100644 --- a/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h +++ b/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h @@ -7,19 +7,6 @@ #include -#define RTE_DPAA2_QDMA_IDX_SHIFT_POS 20 -#define RTE_DPAA2_QDMA_LEN_MASK \ - (~((~0u) << RTE_DPAA2_QDMA_IDX_SHIFT_POS)) - -#define RTE_DPAA2_QDMA_IDX_LEN(idx, len) \ - ((uint32_t)((idx << RTE_DPAA2_QDMA_IDX_SHIFT_POS) | (len & RTE_DPAA2_QDMA_LEN_MASK))) - -#define RTE_DPAA2_QDMA_IDX_FROM_LENGTH(length) \ - ((uint16_t)((length) >> RTE_DPAA2_QDMA_IDX_SHIFT_POS)) - -#define RTE_DPAA2_QDMA_LEN_FROM_LENGTH(length) \ - ((length) & RTE_DPAA2_QDMA_LEN_MASK) - #define RTE_DPAA2_QDMA_COPY_IDX_OFFSET 8 #define RTE_DPAA2_QDMA_SG_IDX_ADDR_ALIGN \ RTE_BIT64(RTE_DPAA2_QDMA_COPY_IDX_OFFSET) From patchwork Mon Jul 22 11:58:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142588 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0AB0D4567F; Mon, 22 Jul 2024 14:00:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D19BC402E3; Mon, 22 Jul 2024 13:59:23 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013054.outbound.protection.outlook.com [52.101.67.54]) by mails.dpdk.org (Postfix) with ESMTP id 17A014029C for ; Mon, 22 Jul 2024 13:59:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Oh6/a1LOvoJHvOJbeMfNbYXrxVbD74qSEg2sQGz2/sXGq7FgCc9wL7zjHpVUrkgiGB8bBDrnKoJqOO9Imx+vTtmxL23rWwKf1EhkSvTNRkFl4awg5wW5FcqGlnn41rj1ZqxT/Yhp/BSY3kSqfD7NdVPHKZK0FKT0xLKhv6ggmbMS0oLMWI80YLwXYj65kDiBrYg9Wgr4hQkEGRuO91C5b/TtVS9+lApccwHFGUlRNmLELk8pFVX+vCY2RpzMAO4ZmAKlgXR/mczJW6KnI9OCCwOLwkeF4e+cv/NFo61hgyQ++lruLBJig/UWGH5xc6QMTUSEJtHwplOdHVLCocJk6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4q1fxoQiPsmfQAfJiuVe7Z6muFKkjz958KbTBYfNvSM=; b=JaxRxahU3QaZAJZ/ihNruRikbsiV3STsZrdgg2c2nMlXPKh7vEjikyu/gqlQbQrCYJ4IyLLj8InNmGYtBAaRHl2jJdS9wnIgH/cL1x/r8qyGsTtBVc/pNQ1wXbR4fzn/XtW2ow/sGpgSmjaJh1GjuzhFPLqVFAG3Qas/FaPR/eW1monXNOmCFkoeZt2TBUSY5wHsBE4xO2820gEFEjDZPqUkS27NrFJ4J+LIYPZUemmH7lINiX1Lk92tcB9RKbZGBz3VwHHp9zy2vsy0cLY6kjaqAmj9vl6ljr8Wlar4SxbJSvxdpbUpvjUiN7fUk18rf8FuiIm16MNJZ+d8z2rAXg== 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=4q1fxoQiPsmfQAfJiuVe7Z6muFKkjz958KbTBYfNvSM=; b=OcRXsVZ+RE3+VzaWnKsA/oDIeVmLSzFWZsYrWCv6QkelS9PUhFDkunGhx3i3I6FtbZgHPDeCY5IxwLLNORa2fb3F+7Sz8H29Oc0+iYBnCsfpLW7LIs+M5lrcub5G3OezH3qMqwyAnqKDJLI2nDyIKcTku/zGWyk4ZZJcgzRpuQ4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:19 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:19 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [v2 10/30] dma/dpaa2: limit the max descriptor number Date: Mon, 22 Jul 2024 17:28:23 +0530 Message-Id: <20240722115843.1830105-11-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: b181bfc0-796c-4b49-703d-08dcaa45b7f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: zAkeLBhp6rDfwWIEaNRh05ZLI8TY+pBhAKXFUpEa2YszpRoQ3rfYBUwGj1uzGILhegs+Lccadmb1paVXSQj7ZSgBSOxayTDennnsRXunw3v+n3jYrLAWvrwGJywGgO4bfDx+T8pPw93fNMnu/NIXS/c9MfY1OULMxkPQjLYQqQbpFNJa56B9SasoF3gTV0Pd03p+h3U0g42PriB5O8stu04C0vfa51Qpe4uIeYC0t5exdkS4zxiMSgud7V5ewcFQo/x5BgRjd9YXNGqNvwnIA555b4dCwhfpjEr/C7/9tXQ1qG/M/U1uc64W7LzON1SLLM5KrU24F64ecE1F0TIw7W6wnYYdwqHz24hcYsqMxEukJisyLq0dc0wTr0dz/QezVKcxYcDVNGeKyrHvYUxkCAvOrQDzzd/svAMVxMMg/HasvpwYQAGfv1IINAqr74JUI4Q9Zh2UxJSgXYStftOyeW5JfyifXDGQn7EYzylBXMCgRYG2dJybyEaqr4KGu/yuRgfdrrMsLIIfDR9MQQyF3v7xcjWLOfENPkTPiA7hMYm2LkUGAWKvdAnNBrN3/3euB4n1yEit8arIa0K3sGAg19smXpTpKJEDe09zKW6LoTBZVbtyVWeES2T4l8oiIUZfKh44FlBp6GWggTjFpduwHdzn+8LcXGBRKbJQaydwRUUjJT80dE3tB69/um+ucpk5jiA56FRI9iD963moFNG79OQDRxS1zCbVSpiJXCni3+r6MkmUQLMiiqGh5bj3X81hCg8/i7G1K4/AGDRImJwMC0HeDGxfzuuzxVX7AfocYITnchmS1yMjH1uEoCycgzpPxucnb34C8ZrrGDNh45Yh2x61UTYAatDfcTGo/ZVRWqta6UnupgMHtMUFjxqOuYn8n9edk6cVEDJnsyLMBKLHtVbqwTQVy0odQ286Pzk8/a9plccue3mup9MJ+l4J5HjVgd0K0aWrwTYcbJje3vEou+Srdw8gy8eGks9Ed3fPGjvxVf7FyGcbpnLYMnLJi+2FQWFskZU9/T1aOOujgpRFhsPjbzXyqpulwgFed91kGJFQoD8BQawPi2jdEYRcIzQ+f5Rn2Ch3IPmUnThl2zCFahvtc5q8iEfoz3p3LsjnOvkJKWSRpRwDjDQtG0lVA1DLDVR6pEuF3wBf6OgM8iN+uA2Y9VTadc/G4klkx9ckV4dT8w/FRSLYP6QNnYovm30U71fL2TlSnLcsNCiqsXAZEbC96hrBnq0uQeOabFYbU4q+rPVPhqda3f32IDIGdNVtq0mcHGCtm+b/3urGTjW7ZZXFTtrZlJn1wkPuPA7pTmA/4/78o5VJDAjLwVnf7QELX2bhjN7EetvLmkOIfW0Dm7pHYh3I7KgIU7LDuihYd2RH+qNAfOedpK9uzMHZvKKDJyPwI+7WP3R37LcMZIsh7g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o+WNO71dDKCMaXhgU/nZQcn6X28XYRNhwr2+eETAkeIQVuS560gvcGAm4j2aRiHnq/xjMIOE7yYab7Mk39ODlOTQkGI2ygFLh8Fn6+uWEiTy84PnrLsyw3cXitEAmgCJodkDVmV5rL+uCeQzHZLK0a0DDlM1Dja8mUHVPdlY17Rpa92BK7Nm17mvXPTuAERAWFJxa/gaRVtL47GaFuOzhK0XLKIVkODBIhEB4xoeLluVMNCtxPgVmvIfAti7+/n/oYLg7JUXgxoLEts+VlSB+vKi83lNADKNr7buVvzFuMvSOsC4MNWilvycPYoFm6QTf5pX6YyzBGsn33WtHbZapGL4Nt6kwgQ/AVN9i1vag7pCX52SDUPZVRBNCMirKQdPFxeDRs5NKsKIUUAKVnrp6dHxV81p2Tt/PVou+eFdNnOoFJI2pz4B4gfwonzqSvi2F3kXPjb8idq9YOzDHObvOOqsNziU3l0+d5SK/AIIvwZ4EhjZwUj2aVYbWVSCMDa3OJO8s28/HCUPUHnfchyI8xuNyMnRl2jphdg0qbnAPFpyG2FRduVmjPtKqqa0qD+Mcpa8g+c2ZRHFpIBwRNNhtpu0yNyv/htyiV1HS0oNrHM5OnBIzmQfsM/wuKyPUuxMCyvgQD23BWdeB2/wBgEaxBy4hcxYqsF/hcdP6vcO0g2eLvhuLlAqaPv9RT9WjZS/mE/Wz9kP1/eP5Ecyt/K7UaRXAQwJjsJeqmAEFzEZbDhg2fxThvO5oNGLgi/I7t9yCTiDfibEHz5qUqxo6vsmwf/oaEsHVY4ZH3PqA3REoX4Gb0OKhTJrhXDfm4yVSgGJLokbdHqh698ceEh1eI8CxvZhgtNfa0kD2ThipLUcQx0J+a1KnaX8i1EVeZS9Lvc4Q/ySgEmlXaYNU/SEsGHWB07xNb4f5h3tWG69mCBgposNS9A4i7m+7pdWVvaknhsKVHSN95oi/aT7NPAguuXSB4HNriCG5HKyjaFYWhvBRIWQ9jdRjqH0mwl+0J7eTw0jS0Ve+J5GXiXlLJzy9sVR0+duOUiANaFX/LQ3iwFIF7BtRag8GPUj6XZcELfSBrtxNRK3L1fYkczCTAG77+da5Deh3onMp6cRaWJhm6QPBA6fy7So8mClnz08jiMubrKtMuPSO3cr9amZW/HBDNJP3LvomPesDNdrRD0xQz9vpB4QduWb7Y4CIiPa4s1w06EvHw/MuOUnOjXjzuehih7rojdtYaOcHRDjSTNFqmNFw5BuapKiVGekjMz/e7r2e9kg1MCUxaQ4/lkLOdFCCv5/ISYgVLrImPkks9azr/r0tNkdQTw4UDQOA4ovbOniKaQEAcZ2TikGHFXCHu29R0WBe5h3jRq/kmwrgdyrhKwpVi9F3Ff9RhYwuCW0iiGW6V7jw+AQvhApzWC/NdUm2gxAi8QDfcmN75vkI/IHfHYqRmTzDz7MvmLKjJZel3ZgB/HUGgGOhvPBBgqq0k7J1KU2xb++A7Xdpes6j3UlLC1ybBKEBnVQ93VfFKUHlPfuU7nmz/HmDFI8q3s5UrEukvkK2JsT/yfu4drlNaCws8oz7FzJy7n0p7/Rdrb5mnK3wuuk X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b181bfc0-796c-4b49-703d-08dcaa45b7f4 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:19.7907 (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: Y6b9TMeDbH2jxsW/le7nQ99ciJny+ji2EJOELBlUzmEr1rWo+l/skhdpke7sm8oI X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 From: Jun Yang For non-SG format, the index is saved in FD with DPAA2_QDMA_FD_ATT_TYPE_OFFSET(13) bits width. The max descriptor number of ring is power of 2, so the eventual max number is: ((1 << DPAA2_QDMA_FD_ATT_TYPE_OFFSET) / 2) Signed-off-by: Jun Yang --- drivers/dma/dpaa2/dpaa2_qdma.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/dma/dpaa2/dpaa2_qdma.h b/drivers/dma/dpaa2/dpaa2_qdma.h index 0be65e1cc6..250c83c83c 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.h +++ b/drivers/dma/dpaa2/dpaa2_qdma.h @@ -8,8 +8,6 @@ #include "portal/dpaa2_hw_pvt.h" #include "portal/dpaa2_hw_dpio.h" -#define DPAA2_QDMA_MAX_DESC 4096 -#define DPAA2_QDMA_MIN_DESC 1 #define DPAA2_QDMA_MAX_VHANS 64 #define DPAA2_DPDMAI_MAX_QUEUES 16 @@ -169,10 +167,15 @@ enum dpaa2_qdma_fd_type { }; #define DPAA2_QDMA_FD_ATT_TYPE_OFFSET 13 +#define DPAA2_QDMA_FD_ATT_MAX_IDX \ + ((1 << DPAA2_QDMA_FD_ATT_TYPE_OFFSET) - 1) #define DPAA2_QDMA_FD_ATT_TYPE(att) \ (att >> DPAA2_QDMA_FD_ATT_TYPE_OFFSET) #define DPAA2_QDMA_FD_ATT_CNTX(att) \ - (att & ((1 << DPAA2_QDMA_FD_ATT_TYPE_OFFSET) - 1)) + (att & DPAA2_QDMA_FD_ATT_MAX_IDX) + +#define DPAA2_QDMA_MAX_DESC ((DPAA2_QDMA_FD_ATT_MAX_IDX + 1) / 2) +#define DPAA2_QDMA_MIN_DESC 1 static inline void dpaa2_qdma_fd_set_addr(struct qbman_fd *fd, @@ -186,6 +189,7 @@ static inline void dpaa2_qdma_fd_save_att(struct qbman_fd *fd, uint16_t job_idx, enum dpaa2_qdma_fd_type type) { + RTE_ASSERT(job_idx <= DPAA2_QDMA_FD_ATT_MAX_IDX); fd->simple_ddr.rsv1_att = job_idx | (type << DPAA2_QDMA_FD_ATT_TYPE_OFFSET); } From patchwork Mon Jul 22 11:58:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142589 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 86D1A45681; Mon, 22 Jul 2024 14:00:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8E18B402DD; Mon, 22 Jul 2024 13:59:25 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013015.outbound.protection.outlook.com [52.101.67.15]) by mails.dpdk.org (Postfix) with ESMTP id D75E0402BB for ; Mon, 22 Jul 2024 13:59:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zV5QfLynqb3iPr/e9eEbM82PdW50wSlyr+ZFlx6UPN2ZZsbk1/VUvDBrLYXoA79tZ+9OxinLVgiPsynBzvEHZAH7ZKdBHTMjH4UYNQKwxIn6244CTNlV9Y2AwS3aw2FdS/j/IUn0XJhmNDuZYa5M4kFJ1Xm7rSXm3+SauLMRJbxXRrNbU0EVEPg8aPWmoTESmWIrdL1Hf/o6DANPiD1aJZPcuGOCxq82pe2qLuVvUy07n+FCMk8Q7QlZPZCoW7q1evg2anm7TzWV9LDVzL7N6s2ALKSPKfsCMIe2Fy0iUFriDkYbKQHlzAXZ83K/B2RYwn2DcNjPcGPwdXFX/mr23Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yWsPspSFq1BN9HBYI4pESd6xE9rIijDhbgtkawU0EoA=; b=E31a4e5wnpocmYVGgkSsX9JzovRCUnFLMSquJBph60n1DhFiLf3mLQO/0cxtPSSW0DMp0Pb2+6FWnUGN1IITwk/++0Bd7bbN8RynIVTbpIn0j6wjWqkrgW6qcEvJvgyXnM1H6c4pkvoQg+kpmscGbSjRAiy++GJl1/gahh1xwtdJwsOe/EQsTZfWau+Lg3N/nMC+mwdLqX0d4cXD6+RfG9J4zi1XKx30DyDzAdK4AgqkiAwpewfjbpvnXc0WJqMvr23FGB3wYgisOlzGZeeBoMKVviSufW/v3wZ/oZs2E4HFYNDR6xaDW8hGzFlBL7IpRrFBroY5g7daa76zz4hiGw== 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=yWsPspSFq1BN9HBYI4pESd6xE9rIijDhbgtkawU0EoA=; b=dDRG99yrOSlBDZpDJUKM+/QB75ynWBa7pkiWefdr1AOxXnrQtJInC5/+AWZvZQqy6fum5LoXPKcpg9+gOKTFgIryBRWCaE74JxqFovzEzmHlVya/P0+VQiGuQCV006coqNsLmRwUh6JZAxC22Cjhwu4eFq1lZB4jWCmw6T8L43o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:21 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:21 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [v2 11/30] dma/dpaa2: change the DMA copy return value Date: Mon, 22 Jul 2024 17:28:24 +0530 Message-Id: <20240722115843.1830105-12-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b1d0aca-525e-496f-2948-08dcaa45b90b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: Zh6zCWTIjpQ2JrHkWiU5lRKTIp83bJXmDLd5ZtzrOcaT0qEKz91jn7TIumpd3GvJD/23/3AMnVL+ZVvUrsZpp/emZ18j5aKq/J/iuRi/wEJiMC2pjFIwklmpcnkTdu17FB0IQAYNzhqqhMeAVDDn+y0/vbwkjsjZIj6CaLbZK8jaEqERKHtv4W9mwgtgvcvutuOaTIPBxty9hC7C2bRqqwqrAE3fv4vce6akhBLIhPpNV/zAQZmMl5FobiQYQWI6fSjF5X7DmDMaAEC+Yay27mhB3HqxwOH/xio3nf52vqM+uOaP+EEfR4R0oePmZ9tD67lwHQfGPuQ006qdASLH+IwwD2WIcIWkycQka4u3BTumNuJzjh+y28MIVEPBSxfDIY1fTXsY2E9vlhjrYLU2oX2Rl0G/KUYqHoSyCYxYLfJKJfo14bsIHSjVUWSEjRuGuU1fYXx401qsfR19cnk9Ex6hveMGFnKf+4SKIX2ENEoqCpU11vCD8sYLlH6bHUo5y1iH4907AdhKNYAwQc3wkXxfotei5RzvsFIfvxdDrMtPBl1T86og3ET6XFdQkv5a8SEvhgV4Sl/hfgYi7Q1HB0Or1EGVXKAMrCTFol7+UPaKVu+TP1+Lxcuf0xydZaoHcGXrEoKSNVBLabPz/E0la9YcYUaAYbs3ijbK4XjFYa+Fee7SzydbxebPx4VxBAI55z1XJCfo52y275WgpcBNVTf7PZjdT9A5Dc01yowrLMhLxWOQQA+NN8w9GrZ9gRLEoxNWGGAYuGMNH9pCpDph1NX3ZChdBJ42qBPPd2Ih5dV8f5O2B3cseWIzktvZVKlSc8/iRa8ion4ryggg+Tt3pY8VisweFncTr85brO//urq5h8hqaM+odl2mO3ewA0B9hkNQw8WiDg7VQJwzPApKOk02GGIOhJCfyt5uZC+zRVFOalifdMXfZW7AoBGP6c8QGSVlIpLkyQswVBV8sHZqPK6GMaSc+7ph9xJVqHi2MM9lQ8NRKPDd+SNlJy0NKKA40Qpvazr4fJYl3lYbMBDbH34eP8vXvsxw3RuFuWblxldqtTcckye2lRIW5+254OefWp5IeNK+Iv0j5F1RkPismLXNNJSdViQE2yfCXNmKYvA1R+moeE+AyWh7Sspo4EZHXAPBhmAShvobTp70ZUHLy3yBftP6Vcg2kCEqdKmuD/HXSJEWXNNoZ+hA+tqpkDXr6G7YwOcAO7oN1UvHfZuC7q6JRl83ZCrDu3P6iZN2MFtNB8MCrPi27KF0JkEyJF5v0vKpr5tpbmI43UBdckKAdXzRBYMzLWsHQhy23/v4jKUdOU3/X6k1SpFtcoPFVi6tcuO+8lQt67w98Cd0aXdCGmcAc4pyEv7ibXWfYoEgO5PebJI/PWtuW5G9gPppJOy4F+vje+fk/mM5WHP2E4ms3g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: l/FFkxQ7OoPKqeWCs7V5F1n8U+bj2iBLYwEfkwJpUr4tVRXa2sEv5L74Mrga+ZSfEwAzOODZnzo/iICgvSm88FX6dvRe63WNyQc9BH9Ly71A9mcXQw1vqtdDj8Bqv0O6R9DNU66xt/0PPzXDfiN5dx4vXktF6pyPZPDJzTcEcmVgYDZVe1bUgvPR+yZhGFesrD+jK2AyUek9Jz4sz7Dq05yPcdJSrZDpsVEjKdbeITjka6z8aAZZgT2NJpz5nMkvzNl/LTPNQxgnZvRyDhC+6AJUYSjbAsv9lqnldPfJKIpYj44YPuLApdXcxRt6n6q7/NDk42Ar8wyQPjH2lUsVB72hM1+eYwvLw/Xhbk8F+59A3DXyUzbHo61msdGI2OmOSzIfT0eAIJC/OeMt40p3LL5TUgSuI7IvGEXW8XXUdO9V8fxIqEr8CiCIktwnBKizjXyBxE4Tk6nMsZYpzFi6ZblKC+qeJ5nl1/Z1y0lC/juvIuWvVStSb6J9vPfHpwPUZv8Jw1xe+JEXiIifhKcnw2PB4STbNrZfS/O4Ro+aZO0yJQc7NuTFo+5gET4rcbsFQ25WFYosolNzHQFQdYpJVFImsG2/a601Kp2zJyfzhTE7k0TsVEEowJZTx1w5HCAXhFEtZ/ndJB1SSWXHEjhoXlITYG6Da8/rDvU52ZKibPhXiCQUyDq3ySyTldhyFZ2GS9E9sPR3/+3qAahY6zG98IvrkfVsyiZkw4B5EEHn2KdM7aeaqaNLlCodkNEvRYfssm9fA97lPXC+yAeJKJn+mDtLsXGYRNsAiEuqfzXQasuNUFWbqWnv07PzR2H+hTpWGhhNulnRqkL6yN0O4YAu+RahdRfFIcaKJgbfvwFXswSP4ZwMeQUPP443+M8zXVYtdnmYdoBxLGeh+rBMZPABt95JPkPiRgQamvgFIJNplHjMSerx1k0bnZF6MLjfH/45leAcYCcYOOg7m6/Ws6T0nlH8MIJ2tWMYWwKYzqJAmjz2yBXtMK7aHdjBNUzXi5E9S+5DsVQ5KamGu4xKK1yVGS8aUoWXCxphRiIkFjoeacMn6sliGqfdtaQo35Lg+uN8pa1LLjn1jYRSEZ+O7cdoAlFXAlX90hGE5w+T13gJb9+U7ozfEgaFRnVE+axMKDr4SqDy/fm2+sR3yQBx8oHDkDZs/ZQLN+1zzAFxKHtaRtsb06HfBuNxId16in9RIzsUGLg9boMgHTVv56m+JtcHPcJsXhFxNfcYuCDQhjQs7sYhShMvipXHmYJgfYPpXchEiNOnRPbZKiI+uQjcG1oS6x53pXu1dgdpWA+6pi0AFbkbTlKau029+bQ3UmaYlSLxgwJ9gTibFP+xWWtVPxYizgaPgUa2SMNHVayo7Y/C7Xh6bLdihk+ilRgKQM0mB6Uby3INrMAVGQiRO9Gzf46OFBknmhhadz9HR2E98FqZAKwiggX+Dg3AGvuS7b1lAobi0xm6vUHaad9Vnwygyss/2elndVWYx7cKcZbVTOtAEqTNxwFjzOyTEdNX0zjHKGCAEQGcIRubUQO3TO5MV5Fa3vdWA80BNC+Dm49tmRoRPP1cKDmwTU9Ptx7NLBe4eMIZ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b1d0aca-525e-496f-2948-08dcaa45b90b X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:21.7388 (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: tFJeTmopzqEViMR70Zwq1yC45qLbaGHyKJS6ZfmBvF/YAuIiA+CFhK4rBNqIroUi X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 From: Jun Yang The return value of DMA copy/sg copy should be index of descriptor copied in success. Signed-off-by: Jun Yang --- drivers/dma/dpaa2/dpaa2_qdma.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c index d1358b686c..b70750fede 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.c +++ b/drivers/dma/dpaa2/dpaa2_qdma.c @@ -605,6 +605,11 @@ dpaa2_qdma_copy_sg(void *dev_private, return -ENOTSUP; } + if (unlikely(!nb_src)) { + DPAA2_QDMA_ERR("No SG entry specified"); + return -EINVAL; + } + if (unlikely(nb_src > RTE_DPAA2_QDMA_JOB_SUBMIT_MAX)) { DPAA2_QDMA_ERR("SG entry number(%d) > MAX(%d)", nb_src, RTE_DPAA2_QDMA_JOB_SUBMIT_MAX); @@ -681,10 +686,13 @@ dpaa2_qdma_copy_sg(void *dev_private, if (flags & RTE_DMA_OP_FLAG_SUBMIT) { expected = qdma_vq->fd_idx; ret = dpaa2_qdma_multi_eq(qdma_vq); - if (likely(ret == expected)) - return 0; + if (likely(ret == expected)) { + qdma_vq->copy_num += nb_src; + return (qdma_vq->copy_num - 1) & UINT16_MAX; + } } else { - return 0; + qdma_vq->copy_num += nb_src; + return (qdma_vq->copy_num - 1) & UINT16_MAX; } return ret; From patchwork Mon Jul 22 11:58:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142590 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 288A145681; Mon, 22 Jul 2024 14:00:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D32C7402DA; Mon, 22 Jul 2024 13:59:33 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012009.outbound.protection.outlook.com [52.101.66.9]) by mails.dpdk.org (Postfix) with ESMTP id 8EAB0402D9 for ; Mon, 22 Jul 2024 13:59:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dxOYRZdgoiniV1w+whH3Tz2zGe8UqFecYfGJMrbGDqyWBqkbqYVNUiaO8hiffNSIeKz3TSgbCbSzSOnh0BUTwRiMd5EgcXfMV6z3wplNO58KMdEoNVcLNczqHofAURRDEJNo9P4e8TpM7QN9EWkO58YWnxw+rNWeqEto2d1wemaPveTmqjHv/voiRzjvDQ/awgPooRr8pYz0Mg0U9W79uCLYDYM7o+LABHKB8UChZtBr3MCPI8qWB3GKbsiZxttoQjmxJGQno6NL2on48lZQ6rksgLuH6FfDBPSmbR+MF+VwxLd4xZBhd+WBJZNae3Xy5V05yoj/Fh0r8hwhRIAKZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+OQIMAYpdjI5L5WWLJgT4ukoxprozPZgO4Ga1Dv1rjo=; b=AiXu9VL81LoEcdFv9SClDlH0G4DS9mIvbxS2cG8R4wjoSXpxZOopBkUZMvKJ+yrkzdFA7iw8ZvnmOJ4l+2BEHZlNMC+V0NK7QpiOrVsXFfwS6afrNFvBMOkbebRcHdM5GUiys7RsbbVqwe7RD2GC55H9APA8zxy/LLRR3iruZMlD4TAtB4jLf+0EUvxphl/ncgO4A7ODVtf8ruW5yhcTETUXjve/8CZsJQyvxriFCcvLE8vRRqSFw9Zno6zEzT22lRRfmHX3tkm29xt8ZDjslQn/12CXILNlz3JkZbv4DeLsUSMtbaNRMudh/LVBs2Z0eiumwUeD4LgJFyg4mw37Ww== 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=+OQIMAYpdjI5L5WWLJgT4ukoxprozPZgO4Ga1Dv1rjo=; b=oiOHV7LNKB7GJ4wo4a3xjTuO9WCcMMPm5h15XaHHgRY5nkKjBKarunonTftNhW6TQVTlMbaayoWobxvZ5j/uArLshjOfVa/uQx7pMExB6Anhsm7hHOorgflEocGnrSAkY3GQFoLxweEKAC6mTgnJg7QmBrFr+IsCplIOZuepNDw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:24 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:24 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Jun Yang Subject: [v2 12/30] dma/dpaa2: move the qdma header to common place Date: Mon, 22 Jul 2024 17:28:25 +0530 Message-Id: <20240722115843.1830105-13-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: 75b9172f-6982-4d5a-002a-08dcaa45ba5d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: ZXXpgE9cMCT4R8YRY7WDShywt5wd4LOBmIoeYSeJoYQ+leDeOL6MlCiSCp/mI4zQMSojxAc4HBh6T17DytxIh0wwbB7SgF7cVOlNtwGpHx6Q4u5ru9VPoWMsn8BAqDBB3Td0Yshv/khIoK1CQFO996pcJh3UBKN1MhjT16F3L+tohZOz54PynvBCJ5NVmpO4I5TmJsWEmVwJXt1G6Bsy1j36UgpL2aHJbKZyufgOf4gHvI3aBW8HVO9UoI9AMwttFCUJ73VmztPky0RVQcyoy2NsJpAWrg+d+FltHQ5YvOfhF3OKDZStF0nHN+xhW9OPxT3SjKrBt0maLEqOTyidbMKzRyEI9pzoyjvUaU13q5coR/TD/cnM5EOwfZVew2JnWRR0LSreiELNCQzZYONzI0ydHs+4NK2YRYCpG3Y+qvYSBEhtt1xDUmSiGidmEj4eAN8qTRFR07QNUCOQdjYdgqywJ9pGhIuHvf2uprb0IC446st9qLCvMjpWGvNyOx2DoBAB7qYxIJOahCHfQqRijh6N5FqeS5NXWMhsgCg8JnZCkbCrtQzAcQLvaRXjbsBacsIBr96HWuJQN8NVpAeU5IrbY8eClHJyPBtD4cMMjQUALuweAQrEdKoJwijncZK7SUvsnUuq44SELJbMEWT9cxrdeYu0Nf2Yo0/sakZ3kik5sbfKKGTjHHvZtQjF1D8W1OW+t6jxvtqwKxvYbAszMaIdhujtwvgEbscPvehQHKfAlQg46FiW2Gv9VjzgcnNRnZGmcEY5oX99+fthaPtgvUmZBy5bv5M4r3XupVc3/NwfDoNIgH6jZZGm4z11a8eEqKTdRp5bt4wfbwve83wfcHc+i99IrYz+A+MIjEoIssUPYG5jv3AMI3dz+m2ygw7Q87syvuxa6Yxcx259zdE6BnFEbrUK0m1raddMnRUCQsiCF8PjNprTTkPDWTBuLeyhNk7SncwV0DcEDMgqgX6qpgfsNV5AcB6/26j5jbcvU1bIKBs6iDBSbrkDvvp7oUMNcix1S/AnhbFaQS5iGjCpvOiiCfY4uhNo6YJuDwL/Ur7QBovHn6h5vSESmCsYY+Dm71wa/P2oDhVB0yg5FUHlz1FTe4XutSuPgMYRj+822BJ2LMUeqNeVWeLRN+gfzwmK/0O16R9mgj2Pw2rmBzT1xXizTlZ/ajOeLaozTxz4MynkaZ93e+8Jh5bn6D1GpSBwKxB/GrQ8qOrjWD2FJXGrXLyXd6brj+hcHvTGukf4RxT8aHnY28KMkBAjJl3p6IudrMQVQGU1d9C2SNgPVC6UzHf4BYvd81iS5IXZDCiXn4N90OKAukdIu03qGh9eVqbaRKjJhYsE8Wcw4gp1sGWSNvIv2+lDpH51fj4TbebXoJsM/i2pn+ifWd7YQbBniwzkz6ewaB13078md5NkK5dtfw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: n9pwyAGcNXldPtt2f/VYh3WqRwJfpwXrNpunuCgOfSiGLNBoroMJMYS8LbMkCECoDGEKPzDAy4fduGtZmUoapKi1c2eDBShQr00LCZgoBPdGlbhlWgqdViSK0VHVopRIixZllYzk16MGqBBZp+7JNOh1toRKj/zo1PNt5AKWoKB590UQV1wlxRUlhUKddj317pwlDaOSs/H3ce3ZhrrlVCIcQ4wVE85b3kjIykunqDNoKQESwozww1ayliD/RYh4ntrv3UY2MfGwh8etM7VD+KdCdVCYhfcn8NAsn1tK94ymZGq79uvKXqUIxwyrgt4EgdVydNIE2lNDsbOYJasITMquTPKddtzigQDNeHhS/zNK1XRdlJ7FXrhz25emgvMdmKxQSohn99HVzgi2RtEEMQ+qduxfSEZ+uoz0w8IMGGjuw6ELW79Ig10WO2zAWrJwwQ+R3stMqXQ3oZRqlIWSFoqGDVFcAIDwiaACoCLdnwPfFQBqGXPcCmtGotEHKFo29WMTym60i+h9txpYkT1qD3u0zFynNcXkoZe4Baa0HcXSOURaqi8J/UPQH/f+rAkWMC9S3XfiPbJY+aqPLt4s3w1aJQgeqInGjDXCzClkYJ/341AfpDWXXtGem7bi81ckALgXADQ1CGfGS7VMSKd1pwwVAYYvgWO198bbXMLQvxHO+aA3EcNjeHzziDucvGqfvv4vcm4EtIg2n5vJimI6F1O96Cd/yqWerMNnKOj5sf5vQGUWDGCFwkak7udwEDQIxqfSGAeCVUwMPIurdfit3pCacHQFsCo4+aU0ZOvM/Hq49XVqB1PQ+eQC3fZc4WjNZtJBUREcYxZSeYcopVHyt04UFns0oBRuu/OiGLEMasEAb/csouhq+CLPgBwmxsTMPY34W4SO/Gv8DPICWCqp+EBHcZh/Tj6Kdugv/n9CYKDH42yz094DpHUC8oIiwhXfRo79FdnRgytsEHeNYY7C5ligStNwvtyBCmh+3FsdRZrr9p7jerao7lu2h7qZ7HAXiG5fEftZKZovKEQSi4JP2gBuqatanyF3WHPYFMyBMdSltCySzF2EHvpajtoBZE3kExXcypreAGEhE9I6i/bSJXQPqwdK+T/HkvhKv3qAN7RPluSw0sEO62S8KWlII9OrZygvvg+KkOH+BOOSmETQBFbF8yeP2EnKDd3RgGHhdFy7xb6GhzYVSnTmAyPc3XlxEFziqWt2YgNNrxxnYDMTRLkpwjpZix0CtWk5wIEVDW4/6dogASTcnHnlCsX6RsQgGWYTeRsGvOsShLokx9NDD1S9Pg/ze3FQuuTZiTve8pvOgevsr1cybciCIal7vVhkGB/O4hT5ANYpD9mN7uRm68Tp4WpjTtLZ/tjJUFPlrEBdSKsPAiqlu9pg8faSICkDe3GXECse5+kjq/SLcPtVpFdkLBVF3WvTuPSFHIkPvSPAoYqIoM/pglBTgsfjinVfn4uTqaxrcY/Ba2GEgXY62AjlOIMq3i3sSsLXljMJuJ6/Tpr1VNlwfu7RLMA3lPkR+JlweR531O/9GSXOqtEojdaR11D6brFVzt5ycRnYsK8Ya/RUlVixVopmWbEo8xbz X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75b9172f-6982-4d5a-002a-08dcaa45ba5d X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:24.0803 (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: 9mS4WEpX/wPPfqdev3gFbG0KSFLVbJcfk0pMIGn2ywIe78ZnjgVQsYt89EQkbSWq X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 From: Jun Yang Include rte_pmd_dpaax_qdma.h instead of rte_pmd_dpaa2_qdma.h and change code accordingly. Signed-off-by: Jun Yang --- doc/api/doxy-api-index.md | 2 +- doc/api/doxy-api.conf.in | 2 +- drivers/common/dpaax/meson.build | 3 +- drivers/common/dpaax/rte_pmd_dpaax_qdma.h | 23 +++++++ drivers/dma/dpaa2/dpaa2_qdma.c | 84 +++++++++++------------ drivers/dma/dpaa2/dpaa2_qdma.h | 10 +-- drivers/dma/dpaa2/meson.build | 4 +- drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h | 23 ------- 8 files changed, 72 insertions(+), 79 deletions(-) create mode 100644 drivers/common/dpaax/rte_pmd_dpaax_qdma.h delete mode 100644 drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index f9283154f8..ab42440733 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -57,7 +57,7 @@ The public API headers are grouped by topics: [mlx5](@ref rte_pmd_mlx5.h), [dpaa2_mempool](@ref rte_dpaa2_mempool.h), [dpaa2_cmdif](@ref rte_pmd_dpaa2_cmdif.h), - [dpaa2_qdma](@ref rte_pmd_dpaa2_qdma.h), + [dpaax](@ref rte_pmd_dpaax_qdma.h), [crypto_scheduler](@ref rte_cryptodev_scheduler.h), [dlb2](@ref rte_pmd_dlb2.h), [ifpga](@ref rte_pmd_ifpga.h) diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in index a8823c046f..33250d867c 100644 --- a/doc/api/doxy-api.conf.in +++ b/doc/api/doxy-api.conf.in @@ -8,7 +8,7 @@ INPUT = @TOPDIR@/doc/api/doxy-api-index.md \ @TOPDIR@/drivers/bus/vdev \ @TOPDIR@/drivers/crypto/cnxk \ @TOPDIR@/drivers/crypto/scheduler \ - @TOPDIR@/drivers/dma/dpaa2 \ + @TOPDIR@/drivers/common/dpaax \ @TOPDIR@/drivers/event/dlb2 \ @TOPDIR@/drivers/event/cnxk \ @TOPDIR@/drivers/mempool/cnxk \ diff --git a/drivers/common/dpaax/meson.build b/drivers/common/dpaax/meson.build index a162779116..db61b76ce3 100644 --- a/drivers/common/dpaax/meson.build +++ b/drivers/common/dpaax/meson.build @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2018 NXP +# Copyright 2018, 2024 NXP if not is_linux build = false @@ -16,3 +16,4 @@ endif if cc.has_argument('-Wno-pointer-arith') cflags += '-Wno-pointer-arith' endif +headers = files('rte_pmd_dpaax_qdma.h') diff --git a/drivers/common/dpaax/rte_pmd_dpaax_qdma.h b/drivers/common/dpaax/rte_pmd_dpaax_qdma.h new file mode 100644 index 0000000000..2552a4adfb --- /dev/null +++ b/drivers/common/dpaax/rte_pmd_dpaax_qdma.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2021-2024 NXP + */ + +#ifndef _RTE_PMD_DPAAX_QDMA_H_ +#define _RTE_PMD_DPAAX_QDMA_H_ + +#include + +#define RTE_DPAAX_QDMA_COPY_IDX_OFFSET 8 +#define RTE_DPAAX_QDMA_SG_IDX_ADDR_ALIGN \ + RTE_BIT64(RTE_DPAAX_QDMA_COPY_IDX_OFFSET) +#define RTE_DPAAX_QDMA_SG_IDX_ADDR_MASK \ + (RTE_DPAAX_QDMA_SG_IDX_ADDR_ALIGN - 1) +#define RTE_DPAAX_QDMA_SG_SUBMIT(idx_addr, flag) \ + (((uint64_t)idx_addr) | (flag)) + +#define RTE_DPAAX_QDMA_COPY_SUBMIT(idx, flag) \ + ((idx << RTE_DPAAX_QDMA_COPY_IDX_OFFSET) | (flag)) + +#define RTE_DPAAX_QDMA_JOB_SUBMIT_MAX 64 +#define RTE_DMA_CAPA_DPAAX_QDMA_FLAGS_INDEX RTE_BIT64(63) +#endif /* _RTE_PMD_DPAAX_QDMA_H_ */ diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c index b70750fede..19d8af9416 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.c +++ b/drivers/dma/dpaa2/dpaa2_qdma.c @@ -10,7 +10,7 @@ #include -#include "rte_pmd_dpaa2_qdma.h" +#include #include "dpaa2_qdma.h" #include "dpaa2_qdma_logs.h" @@ -212,16 +212,16 @@ fle_sdd_pre_populate(struct qdma_cntx_fle_sdd *fle_sdd, } /* source frame list to source buffer */ DPAA2_SET_FLE_ADDR(&fle[DPAA2_QDMA_SRC_FLE], src); -#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - DPAA2_SET_FLE_BMT(&fle[DPAA2_QDMA_SRC_FLE]); -#endif + /** IOMMU is always on for either VA or PA mode, + * so Bypass Memory Translation should be disabled. + * + * DPAA2_SET_FLE_BMT(&fle[DPAA2_QDMA_SRC_FLE]); + * DPAA2_SET_FLE_BMT(&fle[DPAA2_QDMA_DST_FLE]); + */ fle[DPAA2_QDMA_SRC_FLE].word4.fmt = fmt; /* destination frame list to destination buffer */ DPAA2_SET_FLE_ADDR(&fle[DPAA2_QDMA_DST_FLE], dest); -#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - DPAA2_SET_FLE_BMT(&fle[DPAA2_QDMA_DST_FLE]); -#endif fle[DPAA2_QDMA_DST_FLE].word4.fmt = fmt; /* Final bit: 1, for last frame list */ @@ -235,23 +235,21 @@ sg_entry_pre_populate(struct qdma_cntx_sg *sg_cntx) struct qdma_sg_entry *src_sge = sg_cntx->sg_src_entry; struct qdma_sg_entry *dst_sge = sg_cntx->sg_dst_entry; - for (i = 0; i < RTE_DPAA2_QDMA_JOB_SUBMIT_MAX; i++) { + for (i = 0; i < RTE_DPAAX_QDMA_JOB_SUBMIT_MAX; i++) { /* source SG */ src_sge[i].ctrl.sl = QDMA_SG_SL_LONG; src_sge[i].ctrl.fmt = QDMA_SG_FMT_SDB; -#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - src_sge[i].ctrl.bmt = QDMA_SG_BMT_ENABLE; -#else + /** IOMMU is always on for either VA or PA mode, + * so Bypass Memory Translation should be disabled. + */ src_sge[i].ctrl.bmt = QDMA_SG_BMT_DISABLE; -#endif /* destination SG */ dst_sge[i].ctrl.sl = QDMA_SG_SL_LONG; dst_sge[i].ctrl.fmt = QDMA_SG_FMT_SDB; -#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - dst_sge[i].ctrl.bmt = QDMA_SG_BMT_ENABLE; -#else + /** IOMMU is always on for either VA or PA mode, + * so Bypass Memory Translation should be disabled. + */ dst_sge[i].ctrl.bmt = QDMA_SG_BMT_DISABLE; -#endif } } @@ -350,21 +348,19 @@ sg_entry_populate(const struct rte_dma_sge *src, src_sge->data_len.data_len_sl0 = src[i].length; src_sge->ctrl.sl = QDMA_SG_SL_LONG; src_sge->ctrl.fmt = QDMA_SG_FMT_SDB; -#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - src_sge->ctrl.bmt = QDMA_SG_BMT_ENABLE; -#else + /** IOMMU is always on for either VA or PA mode, + * so Bypass Memory Translation should be disabled. + */ src_sge->ctrl.bmt = QDMA_SG_BMT_DISABLE; -#endif dst_sge->addr_lo = (uint32_t)dst[i].addr; dst_sge->addr_hi = (dst[i].addr >> 32); dst_sge->data_len.data_len_sl0 = dst[i].length; dst_sge->ctrl.sl = QDMA_SG_SL_LONG; dst_sge->ctrl.fmt = QDMA_SG_FMT_SDB; -#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - dst_sge->ctrl.bmt = QDMA_SG_BMT_ENABLE; -#else + /** IOMMU is always on for either VA or PA mode, + * so Bypass Memory Translation should be disabled. + */ dst_sge->ctrl.bmt = QDMA_SG_BMT_DISABLE; -#endif total_len += src[i].length; if (i == (nb_sge - 1)) { @@ -444,17 +440,16 @@ fle_populate(struct qbman_fle fle[], } /* source frame list to source buffer */ DPAA2_SET_FLE_ADDR(&fle[DPAA2_QDMA_SRC_FLE], src_iova); -#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - DPAA2_SET_FLE_BMT(&fle[DPAA2_QDMA_SRC_FLE]); -#endif + /** IOMMU is always on for either VA or PA mode, + * so Bypass Memory Translation should be disabled. + * DPAA2_SET_FLE_BMT(&fle[DPAA2_QDMA_SRC_FLE]); + * DPAA2_SET_FLE_BMT(&fle[DPAA2_QDMA_DST_FLE]); + */ fle[DPAA2_QDMA_SRC_FLE].word4.fmt = fmt; DPAA2_SET_FLE_LEN(&fle[DPAA2_QDMA_SRC_FLE], len); /* destination frame list to destination buffer */ DPAA2_SET_FLE_ADDR(&fle[DPAA2_QDMA_DST_FLE], dst_iova); -#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - DPAA2_SET_FLE_BMT(&fle[DPAA2_QDMA_DST_FLE]); -#endif fle[DPAA2_QDMA_DST_FLE].word4.fmt = fmt; DPAA2_SET_FLE_LEN(&fle[DPAA2_QDMA_DST_FLE], len); @@ -560,7 +555,7 @@ dpaa2_qdma_long_fmt_dump(const struct qbman_fle *fle) DPAA2_QDMA_INFO("long format/SG format, job number:%d", cntx_sg->job_nb); if (!cntx_sg->job_nb || - cntx_sg->job_nb > RTE_DPAA2_QDMA_JOB_SUBMIT_MAX) { + cntx_sg->job_nb > RTE_DPAAX_QDMA_JOB_SUBMIT_MAX) { DPAA2_QDMA_ERR("Invalid SG job number:%d", cntx_sg->job_nb); return; @@ -610,9 +605,9 @@ dpaa2_qdma_copy_sg(void *dev_private, return -EINVAL; } - if (unlikely(nb_src > RTE_DPAA2_QDMA_JOB_SUBMIT_MAX)) { + if (unlikely(nb_src > RTE_DPAAX_QDMA_JOB_SUBMIT_MAX)) { DPAA2_QDMA_ERR("SG entry number(%d) > MAX(%d)", - nb_src, RTE_DPAA2_QDMA_JOB_SUBMIT_MAX); + nb_src, RTE_DPAAX_QDMA_JOB_SUBMIT_MAX); return -EINVAL; } @@ -631,11 +626,7 @@ dpaa2_qdma_copy_sg(void *dev_private, cntx_sg->cntx_idx[i] = idx_addr[i]; } -#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA - cntx_iova = rte_mempool_virt2iova(cntx_sg); -#else - cntx_iova = DPAA2_VADDR_TO_IOVA(cntx_sg); -#endif + cntx_iova = (uint64_t)cntx_sg - qdma_vq->fle_iova2va_offset; fle = cntx_sg->fle_sdd.fle; fle_iova = cntx_iova + @@ -667,8 +658,7 @@ dpaa2_qdma_copy_sg(void *dev_private, offsetof(struct qdma_cntx_sg, sg_src_entry); dst_sge_iova = cntx_iova + offsetof(struct qdma_cntx_sg, sg_dst_entry); - len = sg_entry_populate(src, dst, - cntx_sg, nb_src); + len = sg_entry_populate(src, dst, cntx_sg, nb_src); fle_populate(fle, sdd, sdd_iova, &qdma_vq->rbp, src_sge_iova, dst_sge_iova, len, @@ -1011,7 +1001,7 @@ dpaa2_qdma_dequeue(void *dev_private, q_storage->last_num_pkts); qbman_pull_desc_set_fq(&pulldesc, fqid); qbman_pull_desc_set_storage(&pulldesc, dq_storage, - (size_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); + DPAA2_VADDR_TO_IOVA(dq_storage), 1); if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) { while (!qbman_check_command_complete( get_swp_active_dqs( @@ -1046,7 +1036,7 @@ dpaa2_qdma_dequeue(void *dev_private, qbman_pull_desc_set_numframes(&pulldesc, pull_size); qbman_pull_desc_set_fq(&pulldesc, fqid); qbman_pull_desc_set_storage(&pulldesc, dq_storage1, - (size_t)(DPAA2_VADDR_TO_IOVA(dq_storage1)), 1); + DPAA2_VADDR_TO_IOVA(dq_storage1), 1); /* Check if the previous issued command is completed. * Also seems like the SWP is shared between the Ethernet Driver @@ -1078,7 +1068,7 @@ dpaa2_qdma_dequeue(void *dev_private, } fd = qbman_result_DQ_fd(dq_storage); ret = dpaa2_qdma_dq_fd(fd, qdma_vq, &free_space, &fle_elem_nb); - if (ret || free_space < RTE_DPAA2_QDMA_JOB_SUBMIT_MAX) + if (ret || free_space < RTE_DPAAX_QDMA_JOB_SUBMIT_MAX) pending = 0; dq_storage++; @@ -1131,11 +1121,11 @@ dpaa2_qdma_info_get(const struct rte_dma_dev *dev, RTE_DMA_CAPA_SILENT | RTE_DMA_CAPA_OPS_COPY | RTE_DMA_CAPA_OPS_COPY_SG; - dev_info->dev_capa |= RTE_DMA_CAPA_DPAA2_QDMA_FLAGS_INDEX; + dev_info->dev_capa |= RTE_DMA_CAPA_DPAAX_QDMA_FLAGS_INDEX; dev_info->max_vchans = dpdmai_dev->num_queues; dev_info->max_desc = DPAA2_QDMA_MAX_DESC; dev_info->min_desc = DPAA2_QDMA_MIN_DESC; - dev_info->max_sges = RTE_DPAA2_QDMA_JOB_SUBMIT_MAX; + dev_info->max_sges = RTE_DPAAX_QDMA_JOB_SUBMIT_MAX; dev_info->dev_name = dev->device->name; if (dpdmai_dev->qdma_dev) dev_info->nb_vchans = dpdmai_dev->qdma_dev->num_vqs; @@ -1317,6 +1307,7 @@ dpaa2_qdma_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan, char pool_name[64]; int ret; char *env = NULL; + uint64_t iova, va; DPAA2_QDMA_FUNC_TRACE(); @@ -1359,6 +1350,9 @@ dpaa2_qdma_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan, DPAA2_QDMA_ERR("%s create failed", pool_name); return -ENOMEM; } + iova = qdma_dev->vqs[vchan].fle_pool->mz->iova; + va = qdma_dev->vqs[vchan].fle_pool->mz->addr_64; + qdma_dev->vqs[vchan].fle_iova2va_offset = va - iova; if (qdma_dev->is_silent) { ret = rte_mempool_get_bulk(qdma_dev->vqs[vchan].fle_pool, diff --git a/drivers/dma/dpaa2/dpaa2_qdma.h b/drivers/dma/dpaa2/dpaa2_qdma.h index 250c83c83c..0fd1debaf8 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.h +++ b/drivers/dma/dpaa2/dpaa2_qdma.h @@ -220,18 +220,18 @@ struct qdma_cntx_fle_sdd { struct qdma_cntx_sg { struct qdma_cntx_fle_sdd fle_sdd; - struct qdma_sg_entry sg_src_entry[RTE_DPAA2_QDMA_JOB_SUBMIT_MAX]; - struct qdma_sg_entry sg_dst_entry[RTE_DPAA2_QDMA_JOB_SUBMIT_MAX]; - uint16_t cntx_idx[RTE_DPAA2_QDMA_JOB_SUBMIT_MAX]; + struct qdma_sg_entry sg_src_entry[RTE_DPAAX_QDMA_JOB_SUBMIT_MAX]; + struct qdma_sg_entry sg_dst_entry[RTE_DPAAX_QDMA_JOB_SUBMIT_MAX]; + uint16_t cntx_idx[RTE_DPAAX_QDMA_JOB_SUBMIT_MAX]; uint16_t job_nb; uint16_t rsv[3]; } __rte_packed; #define DPAA2_QDMA_IDXADDR_FROM_SG_FLAG(flag) \ - ((void *)(uintptr_t)((flag) - ((flag) & RTE_DPAA2_QDMA_SG_IDX_ADDR_MASK))) + ((void *)(uintptr_t)((flag) - ((flag) & RTE_DPAAX_QDMA_SG_IDX_ADDR_MASK))) #define DPAA2_QDMA_IDX_FROM_FLAG(flag) \ - ((flag) >> RTE_DPAA2_QDMA_COPY_IDX_OFFSET) + ((flag) >> RTE_DPAAX_QDMA_COPY_IDX_OFFSET) /** Represents a DPDMAI device */ struct dpaa2_dpdmai_dev { diff --git a/drivers/dma/dpaa2/meson.build b/drivers/dma/dpaa2/meson.build index a99151e2a5..a523f5edb4 100644 --- a/drivers/dma/dpaa2/meson.build +++ b/drivers/dma/dpaa2/meson.build @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright 2021 NXP +# Copyright 2021, 2024 NXP if not is_linux build = false @@ -14,5 +14,3 @@ sources = files('dpaa2_qdma.c') if cc.has_argument('-Wno-pointer-arith') cflags += '-Wno-pointer-arith' endif - -headers = files('rte_pmd_dpaa2_qdma.h') diff --git a/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h b/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h deleted file mode 100644 index df21b39cae..0000000000 --- a/drivers/dma/dpaa2/rte_pmd_dpaa2_qdma.h +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2021-2023 NXP - */ - -#ifndef _RTE_PMD_DPAA2_QDMA_H_ -#define _RTE_PMD_DPAA2_QDMA_H_ - -#include - -#define RTE_DPAA2_QDMA_COPY_IDX_OFFSET 8 -#define RTE_DPAA2_QDMA_SG_IDX_ADDR_ALIGN \ - RTE_BIT64(RTE_DPAA2_QDMA_COPY_IDX_OFFSET) -#define RTE_DPAA2_QDMA_SG_IDX_ADDR_MASK \ - (RTE_DPAA2_QDMA_SG_IDX_ADDR_ALIGN - 1) -#define RTE_DPAA2_QDMA_SG_SUBMIT(idx_addr, flag) \ - (((uint64_t)idx_addr) | (flag)) - -#define RTE_DPAA2_QDMA_COPY_SUBMIT(idx, flag) \ - ((idx << RTE_DPAA2_QDMA_COPY_IDX_OFFSET) | (flag)) - -#define RTE_DPAA2_QDMA_JOB_SUBMIT_MAX (32 + 8) -#define RTE_DMA_CAPA_DPAA2_QDMA_FLAGS_INDEX RTE_BIT64(63) -#endif /* _RTE_PMD_DPAA2_QDMA_H_ */ From patchwork Mon Jul 22 11:58:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142591 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 69ED645681; Mon, 22 Jul 2024 14:00:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 27EE4402F2; Mon, 22 Jul 2024 13:59:35 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012009.outbound.protection.outlook.com [52.101.66.9]) by mails.dpdk.org (Postfix) with ESMTP id B84C7402DA for ; Mon, 22 Jul 2024 13:59:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QqHfNAggUG5VX7yJJ/N2wxmE//FOkeYOzIPxZNgt/2cTilll1OuLz7iZQTybXAOt8oJ27A93OOcf/L+ibxcFb4KrCrB10Z87ZMMhB5NyaV9SFnThEpuyPvGIQ2TSZXqwyzIeaxyJnvRjZ1/hqM5GIIbF+kOotqnBWD6HoGIOIqCVrpa6xUgSXrBjvLhsXgQmXAjfAslxt78CItLAAuuiSRX6QFJiCuID759MXRBOVUryADCecPOLhCF1B8KLwxHoGPJUP1EwxWS/Khk+9DgYe4hPTHuv2ZAchPGuxGcPLjc+mEGzCOzaX6C93GsljOV+DfpiqTxa0/C7Z743lTYsGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tWaV/ZlS74ufRVks7friUM9+wmCLCoIeAhgO7QRM3C8=; b=ilSri5Qz36EQWlSNLYqCwQlrNX8+WC0ntzbCIcIgzJ5VRD4G2mrTQMgMNmiOuLWfvuus2wLoITL0KBXTxAud/HCoqDCLilGo3Cr+Ib1zt04YfXT565X/ZkslLESAOdJB6nipgJpnSsYgQnBdWfisMgQeWmq7iZz3Ex/mZEUCPBkIxEtvsspb1DjkpO59MFRNm/c85aeRiBre6bs1dF6hbHyWDEBxq//9umklDiCgWqaiSrHQOJnPNqwdXVJQfvfu9ZFLswLfZ3NrwXmHLZSlm+UThmfAcyZxzAxeS/V7Jz6j6ujBIW2l7VS4jQfnYGKuRkoOBBFFQY5mcEoNjv3Mkg== 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=tWaV/ZlS74ufRVks7friUM9+wmCLCoIeAhgO7QRM3C8=; b=eSx1VeDO8e4BNq1GqY6M/9jE7YgdfzJZ5xf4MphEH61VrThKQdsyUm3YqM5/urwPa86s4bKhQkKB97Zq0p+u7IW60HfbparxvExHtmmmhVNI9l56Jz/0XFrci2sIz2NA4AI+B7YyDiB2IwMsYDh97FUc1khqqAKbs0HGpi8nZbM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:25 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:25 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Subject: [v2 13/30] dma/dpaa: support multi channels Date: Mon, 22 Jul 2024 17:28:26 +0530 Message-Id: <20240722115843.1830105-14-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: ddb8b8c1-27a0-48a5-d2b9-08dcaa45bb7b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: rSCAz0pxwUHcbwc+BKWWps+oqyD8fOhJFDeY0JsKSqOurwAU0gHXHxWHB8V6UCbb+uOl9gV/ZHnwV+D40Yyz3RryyrbeeDW2eSLalhqhDHsoRLF8fU3XtNWng1MNEFaXIzIHwYte2R8gurxApqG3MOb+FkGxze2rG6KlcqvXj02c5XG7GDfKCAtESaM/Di1TGh8hvIzm97Y+hEstU53+10NVbQOnVGNt5TBW6thUPq/YHr09yiVsBe1vOOVm2F3wASYPD8jcen3J31qAK+nUXBnY9QXHuwaBVL7c2T/MejYz34vyjdsjXKbfPJBwnyhxgDabvbl78E3rURy+lkTUksjE+ZfmTvJEF5xnZzD9UZtcCUy34vyUWTlbbhuk6G36oXeQI4A1nJt6mvrOoM2begoVXbvIdaQQduHUJXcT0k5SOVpHdZsqEmKfIW3gRqFlkryDBWV28wnnaioAf09q+1CeWj3QIKt1j8IdBa6i72LVOiOLrrJGz/oHiBIsu/tAwm0FkxESfHdaCpsUlf+1LiQ2X6DOPx4J3/UUdB2GJNiyiIDTPIDVCAZlfg02ia3vikkEvT7IIqZsXrD9mXejkuEu7bGR5EFFzH7ayqVvGQpWZmrtOY+Xgcgkgec2WJ3HNYY6GetzLNwlQihq7F7QMVw+zpwBXUGzuvcjONTAtER5gtmAUyDhF37NHxp469HDcOxApPATlIxoXikU/dwdfV490JK2pgV8Vbyr9EJFmWUM808q4i4rwv+l8XAvAu4M8T1AJ3ty4C8vpS8KKjndIrPf9DRd4NJA+PJKLYM8sY3JD4RaiOaUhPbepvxNMjsbD4AEvZNdh+KXMi05JZJtuLkEjyHX/bOPGhcmkPAcIvQVbxkrAtDsMtD9zQG8EPANZ1owVIyImTwOU9Oq22xkQ/lv2diHLPwOsFuRwpdO/dhsQ2DiOlT0gYp+z0nU95hQtgwT6tesURg4GS3SIjNCFHjpX04VJiwMt6sKcTKOuldMuuxDA8Oa/tNyBrZ8ApToRXIA+BT4mbBW41HiVLa+1HadwJzI3O3ZQe5vSmkqecSk7ACII1JlLP/iXCN5CPARFTAWBUyol2Z0MlLMD0zzGmMTJTYs+59a44kZ9EwGqGl08aLJn0QXvNRlP4xm+6f+FY5ExE2AVkgH97VKDnupkDQ94dP2w/EBhRkre/K1aN0nCUSLmxhhyAHmKKSqChZr2oYbhdvNL385GeOcQugo4CqdMMiJCLj8NoHOP7Q+VW4BjYDE51eti6ufjFrxmUZVG9YBmuy4OxjfG8x8hNorpJkxoFgvLV9VwY7KP0i51zM0wJmxAjh5cy6DZMlkhk2jWBYwNXKhgZzPOVfRyfCygiBJ4HVWfLJSHneh+89gLvzIJBJsrqpSYVjMcyOfcPFwSW/B9Y66nch5DSVd6wKUPg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BpVuxCwX2nwFePfJJgp73wLxJjW/WVdB+UBogU9G/9GIwgKvGaGkwKQbGotwW475ucWJjjOKVLLDQAMam7kkkZeZOHFEH6BDhKKzv+m9bEr7i6+lRfc9S8C6ABdwlJwCQcvqUux580h2E0IlA0cGR8mEp6gVy/0S1LE2ia48XiPBOiFmMRemjO2NiZkMtHLH2NvP32Hjy6GOZszVTS97QZXKaFh4I96AbsLhVmu1zOwhWFEJYyhEdM9nI3/kwkBb8Bh0bwxMLT79vUWZNsWy77fR1IXV4jtSW1ym69AkMY1ooI0DvtYwEclu/xwA7EL/YNbJ+DBLxkqi32byyhN7wJId06hZk9p3wwqxZIrJ1NkH91052CT+iuV9mKH9kGM2yPgAXlFE0UXlkEdfs/ZeCME7wMThxp3OmgZ8haFc6RHL1uEDMzuSpz7mEUS2HmXtjd4YuUru6w1bwGQQ+jQg1QJfjIf6Ah3DRX2/59J3tLJUu7AMBmheM7o0bpTgR7lX1JMAdqds5Gef3BkD7oxZ3RiHwJVpZGALVLDgVRZKTBIf+Tb1fF0BAy2MWTHIpB+NlaW6NpHJmWfTSHINpwhCHnp/6jn6RANQuVMT/UVzZyqUmCCMJKchjp53QkmIOO4YYuuWTPP3nasoDDis8ITg76MuHBJ1clcfPgnDSmTWG2/sCosO2yjpVxLa35Zf5qd4orjcm4KzX9svVol2Vnaic/r0mnKDfBCpdDrey5PQkK5mcKTZKOuLAJ0nxUh9KDGzHNht58DqexAf/eiDRbMwC28bfH/BNvZgDUpnqSbeThAjmG/3gmhwJxfyh0OFPt5NMg70ZW2M9nG/4OKXqNbLQwYTg7FroD3zcp3TUijXfUG81QI5vHJ2//o4ZP8OUiCXH+7cave0hETbRuNL0LlFMuXiV2MlBKRH3Z5unOZL1SoT75Vj7hhmtG3j6lW7leZ8g/Wuob40qWzmv5GypLUbvk0DHRk8FYkRx2xhzFLw0V9oItDygnAu6geVjYC+OFBypB3196JwTr3xIKs6gdQOMcRzidQrYIvxgyPVIQ3/tdLWTN+SO88NfK5Pb2xwflitVotJQkdyggJfTcAGugfUrhwpGn47dFMQsYvWE4wWKTdwGcZdhrZZbBS2OlP8zXmPa5iNrHaok2fx3uOUyeLTjK5/jRklGJkq2Y1Q/tjx0cFxfDhnaxA4/XRkq/iG41OO0YqjZAp9qjMhxdW/zRecQmSKa3j0j2TbDoJj6upOSLcgWurNZyK5LXjTERXS67a0ViJlmXLXDG11dPmPnd9DMplQRkgONE/+L+wMwJlkHe7e5oRv2fDN3Q29Ui4SxVvWGDd0AqI92oluRGLMLBA6igObtMD8SkNjQeuLGEJo+JYB/HhzrGs7alPyu4dykPW01ysYlvWikoUSvx4t/1J5Do0V2hULiKcWJG66LCd5peDPkn2ckl1VON0ckqVW70TJzAeyvCtXxXA7Vzf/YJ22pe7rt9yhdv2vSLeJ85W3HOpRVY7H5t8BNAsjJGbvI/IsdJbdPBHqS4JDjOpFfa2DRi25tBvGsA1u7c4Opv0E6cIgSwyJ96q2S3Mc/GLGiJbF X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ddb8b8c1-27a0-48a5-d2b9-08dcaa45bb7b X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:25.7666 (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: pXaIdMzwG+R/9PC53t/A0fGWHSDrXJ2uuVgLy5RFu8RAVVHdhejqXcE/LgNnwl1V X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 This patch add support to use multiple dma channel in the driver. Signed-off-by: Gagandeep Singh --- drivers/dma/dpaa/dpaa_qdma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 10e65ef1d7..24ad7ad019 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2021 NXP + * Copyright 2021-2024 NXP */ #include @@ -648,8 +648,8 @@ fsl_qdma_alloc_chan_resources(struct fsl_qdma_chan *fsl_chan) } finally: - return fsl_qdma->desc_allocated++; - + fsl_qdma->desc_allocated++; + return 0; exit: return -ENOMEM; } @@ -670,7 +670,7 @@ dpaa_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_info, RTE_DMA_CAPA_DEV_TO_MEM | RTE_DMA_CAPA_SILENT | RTE_DMA_CAPA_OPS_COPY; - dev_info->max_vchans = 1; + dev_info->max_vchans = 4; dev_info->max_desc = DPAADMA_MAX_DESC; dev_info->min_desc = DPAADMA_MIN_DESC; From patchwork Mon Jul 22 11:58:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142592 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 60EE545681; Mon, 22 Jul 2024 14:00:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 640244042F; Mon, 22 Jul 2024 13:59:36 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012009.outbound.protection.outlook.com [52.101.66.9]) by mails.dpdk.org (Postfix) with ESMTP id D84E4402E6; Mon, 22 Jul 2024 13:59:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VbH9wBC2TJy3FtPZ0lxIXDsQRUpX0BN7fdHvb9W99Oiaco/1cKS0pUOiNnvuSe/eFX2qpbe5E0iBA8rcbF1xKBBI5kgD0CMcdydLyunbjDnZCvP39Iy10PKnT3CRBF3CjcprUrfKr+Aucp1peD/P04d7YAXHfpDjbKIaFumLQYtJvCKLIf9YyL6giGo0iasBUrGWY8mALLSD+huKxdGcO9bVGVJX59cwhA5/NB3lPmJMxpVVZJYhKz1la0zRH4LiT16Ch/XSQt3uB99F4dJl7AU8nP6xRHQXHiKRPtm7705WjgyuMqVvN6YmznFRG5R7hsk5L6PPbs1+hIRWAqLWkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zx9hCaRsbM0Q/MQ2d5i0P3eAIyrrDJNW3zcZErewB4w=; b=GGsXtNuk38m+ySODQBMN1WhQzPuGU3NWGVAbm7PC2d6/QI7djPq1fGl5AKvCbvFm0nVTtwJlKarWTQh7XAUMQu4Fbf9dnbGkgbsRmUsRgxVCiftGP+OF+CyEUk6JM+mEtmkb0KxjjAhzHkEs0WH4MCJa/FMhD2R6IoGP6P7MRXFTF2AhM9UuLRfCEP7dxzLOonnNu+8haB/75Nt/w3E/Jaz0F+0QLLpzsjdgq+Z6mRQ1l9/PU+5bn/I3QgSQVXNcFNKWZgreBOVbFppUBjukbOqjxDsn/fUdE0p9R8+D8e1heLc26FunSQP497B+IhTT8krvtBHVaDsM3uF2Ht4wLA== 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=zx9hCaRsbM0Q/MQ2d5i0P3eAIyrrDJNW3zcZErewB4w=; b=lllh6UchrwhkvSnNlPs3B+H1fjRan50uXGHTd0kQYGNCaUOUGmLfq0eIGijCFVZ/7jHeYqEmNzcnMe28oGNhPHRBo8n2IucXFLQ4nsWjQ0IcyazRMMOKfv1CTGQ/GxyQQ/4dNdwGEcnnhGAIV4vyiAS+u0J6Pk9fmtVjLb3Wuj0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:27 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:27 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: stable@dpdk.org Subject: [v2 14/30] dma/dpaa: fix job enqueue Date: Mon, 22 Jul 2024 17:28:27 +0530 Message-Id: <20240722115843.1830105-15-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: 1b5eaf59-34d3-402f-0624-08dcaa45bc9a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: GS70e1bY9/+Wgysk5DOSexSUiqq4xET2gSkzYD/NZtxPMN0e4cqFCIE7VIG8LP1NyTFrnCKukqF3uK6GZur8b55RhHLzc1VfZtMb67/0/I14fozPa7LK/kAwlPKd6Ez8zrzzVDqJ5y9cC/hHroc8C9lHkdNphGJNioEu9XQU1Sm6loU604hbHY02NriSG1wyotUGFUG5jboAORzfbN8y62nSTEg+3TAEmLd2+oYZ9/vVORFOeTdP9gFOahoFda7NHyUEWrV1tlWnVeGfqWbiDFsW1fet2NQHKCnBvJjmt+bGuHFMCA5uJwD72b1Pz+HDv8dXagoQO7MFM2I1Z2dOvLVxjR3KFv/Bpb+W/h+WicdB1TVNmNVoCgIaDCv5s5YnteutBFWzwETMjRVkKCj3NJFLwDZ+xl2TSKWf2rTIE4HjSugzhIk/hanZP5INpkgoraTafJexV/75P+TRwMxAd+e6/h1GsX5bGn1k4/c4MOSj+DvOq9Z4BZ8jwNtvgwnOPE5Q07WV2kHm2ZaR+MltDn5oWBfPmfs6zYz3nCoimJk8WS50/c+MNaQujFnaChnWqCjx15nkVUoYA0aIkzQWW8qQzN4iO/VYb+b/Gd2a8AUcmd01YN+kPcCXvNfHtJ+/JqEYhsoACepArTgo3B/sinvU4IYrvIySwj9raluwlSwogVNiCwzQ4Cc8CoiR8kz925QY5UZ/OQD1zji25kNgdUpg6sN2+wlTQPAqW9TJyFC9IVha7H8ax+pFTVY7ZdwPMHikVew1HjPpr8eHXXhC9xTFnZ/utts4KZHO4GLYfy1psjzNazpBAGbG3z6FU/LcU7E0U6eVPh6RRTtYdMuShFZecvZLH+BIzl/zN10G9dg2KA6MFg47vg5TY9ECMZZmZUKZL178L52VYl/ynqbkVUmzYVFlsDKm1ZtOmKP5auwcJEJJjpuJH2Co77TvNYzUPTIBnwaboECzQAu8JGZ7Ul27uBCnmeYvwDfzxxlacpkUuK484gjFGhvfEQ1Qwbs+YEmitxWpgYlZyQql/Jb8U0iBTy/t+hgkIDVAvYRznRL4ngQMGO8yeH1sdvu8x/B7XhAunMkrpUBQI1dYI+Y26Yv9hXKOBz+B6qp20dBE+7L7yrNqUFGsLXp0J2v2xv6ZN4QfEDmeVmyzV8bA/MSs5mhRl9+xkGNTrl4Wr88NEyvHNdJi2kplbiy/vT8a2dwpffr/dr3ty8TEDjcoq4JyZfbsoQIC9U0gsHF7qQe34kSE5CwO3gERR44sFN0hgTgRo2za6I93IHwD5Iywr1fPQCGYOjhyD3MLUtjpR9+CmvIYlwJ0J9jKshG4zkzyyC68N5LASMGqBLR/kixWhmWSy20++HnUYVo1QhtMvxWLXGn9shWXNXwZIxQlApW+gnJ/L/KfHpQduC7m1pqnCjVBKw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TLCFtRwZpGMogwJES6u532y9rBEh8l2UOqWYiJAPTQgPEAftPBVyxeiHBGATZLw6qls94UCe6vtGCMFgISQtECCYFghiZEdOcveo+v+Oc/i1hWhowlJyLHTOwXjTzE7oVchBy0Va6RquhSLffYgxGnHocYUizbiMNhvN79XGBjQo48nOwqUB/kbFfXVgHRZW6zs/ToEV0vVwx3ShEWNFonW4n8OMG+oYn3cXHilRZqbD0IiBzKanmcQtW2Le7VhDMHOSqHp2WNho3JDCxBzFfsKO55CuCYfMKQpAy/q5NJyloiURqI6pmshR2OyjKHKTwKm0JxU84iauKn5yFrRFcUhtgfbL6zn+0BItSCx2ZJwJrrjWceJX4L146V4u+rH6gthpbPHeG2nxbeSJN2/ig9z9QHy120r/d+PYUfdNsXUzPJpseZTVFtrndTKFSWeYH7lc4p1AWCeYLBtEnF2BXcNR8T2njshH7Ellqpi6V4f4QoIv2iiE+y4D9RPxABE3WvTp1HEJ86yxG+uWkWhmB0wsOFtoBYvHuad0jEHQkVBQZH5q2OOPpkXH0O9aIlghAyHU/NHpvEcS7C32md2OE2fuaQrSenDDCbsONenstTWtr7M6KxsHIKdnOOynJgB68oqE859hVCnvLBWHJ3U6OvYU0z1MkbN8JVSp3FvfogyQxIG5J4yPtAuTgulSum84G5eTPWCduAYkQM8ygYsfeA3421YRO+64vbNmL0QneKWli+9Ll8xIIJ1D8XT7aHgeMZIda0B+myiH57ro9+Jx47ZWIWmvuW96gHvhWs/kCscAWGkHq23CcYiKU//rVmpSWO9QfH7iJk1Mn9b4I/Dy2PQpLxpnfnU9Fu8mOlYKhFX9CY3Rtx8C4KrN2gY5xnwvZy61poGxgYCBGrzhKRPlMmQVd7IHE6XlywGMo/fsmxZ6C5XydJ+Ti5nGDcWsG2KhajIe4x9ANR6LMXt/TF+AbNixnkLb4K++7RpnK3MueV2POB3tfsH7JRTyxDnbP7/zqH/dV/NtiKPvbSiPnPSqyfbyHWyc7BqkAQfeUFXQsQzeG8yM0Ax4blpv9rqXv2APe8ieW5D0nhQSi59QBfVjFeDFGhEtsoXdWcrCBAlR2bvtBB1L5e6XK0hBGXEM6cHWOjUlZWKjIsDjrek8NDS9A6ELWcnbgezlRXdBBB2ZnFwd1pZp4ajrv6EPb4h7fyZLemi4FrExHurOT5mTjGPm4VT3yLEI02GlPWZErH+/0btGsXkTrCOjRuAQq96VCRG5MRcKV1eQjDB1O7meP6/eEhaRari+yrjaNVokzh1Xgfu1gUeWMObnLuq63g4wpS6aFiWu3eu/4Gg94vN/gwxqThzEnEmqrHXYkRHu8ir1mZCYKqdzVahrBnUTwyCndHLkJkx+IOtAs5ZUyK2LMfTvBzf679E5ywslXdr4X2PXV4tCDO25w+jFHxjkk0JuxkrRcWCSU6ITHy2KyAN30o5RYlTb2C0edJ3X+nx3P0YGDX38AkIuqHQU9gahDBZAiTvp71INTR6Ppk+aIvF9Cznow/yiZPwUEtnOwI3AAWRcwEX5+Df88/ccRLibWyxQ/h6G X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b5eaf59-34d3-402f-0624-08dcaa45bc9a X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:27.6482 (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: br+RGj1VaUD4lsLuiFYBCM/iK+VwVmQRFiikHmKmFDEMv1st/5FLesr9XaQv41t6 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 The check shall be end instead of equal. Fixes: 7da29a644c51 ("dma/dpaa: support DMA operations") Cc: stable@dpdk.org Signed-off-by: Gagandeep Singh --- drivers/dma/dpaa/dpaa_qdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 24ad7ad019..0a91cf040a 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -615,7 +615,7 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_chan *fsl_chan, list_add_tail(&fsl_comp->list, &fsl_queue->comp_used); - if (flags == RTE_DMA_OP_FLAG_SUBMIT) { + if (flags & RTE_DMA_OP_FLAG_SUBMIT) { reg = qdma_readl_be(block + FSL_QDMA_BCQMR(fsl_queue->id)); reg |= FSL_QDMA_BCQMR_EI_BE; qdma_writel_be(reg, block + FSL_QDMA_BCQMR(fsl_queue->id)); From patchwork Mon Jul 22 11:58:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142593 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C798F45681; Mon, 22 Jul 2024 14:00:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BED5B402EA; Mon, 22 Jul 2024 13:59:37 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012009.outbound.protection.outlook.com [52.101.66.9]) by mails.dpdk.org (Postfix) with ESMTP id EEFA3402D9 for ; Mon, 22 Jul 2024 13:59:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XSB5nCTJ2Yi94/yCuZLa0tbWl7thxhsj043ACIACrCB4hB/drh7KBwuItKZSatR1MWm1QmgKEASX9uMJyzyTXLPs7JziS9pu8zLk1Ryb8MPf2LGEmgd+fx0U/+XO7dUIgm5cpZ5KQE84qlw4z58wxfVKe/ETLc8PDQ/Qn2y7T3tXH6cO3PqDHBV0K3jqoOWXURIV7/UvxfklCXMVIGZwmj4nDZHZh3giYa4JKCjgva2N9Gr5mglYoEiFIWSNXywyX5juNsObk7rkLaWelbHYhtvC6VKNPEXdBAeupZS3McnHXHN2FTbMJlxat845IDPpGb//AUsKqTJfbd/Z0mpK/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LyPst23F4dEFabeUjgji3XsXEmmbpjjOKbMsaEAw1ng=; b=AfUQzgpk9CI+arl2svDvKlMSBcxFFyZXX7lQdk3Ye8kqHRdhFSRgpzJb1aYs8Xv5SXEwOSn1ai4zlP3uwlhRxNaFLBev5M/Lq/u3i1/7SzvXGp4QAHzEx9ij2q+W75eGrjbW3XSdjKHpnFtsAtCzS78b8lEMEuVBkV/w13yiuYHx+enpqSbvg3TeLJgh/vsAKJ+34GA5JmuBsPMk2rKG3lUKGrVuAoGPZVOjIPAaW2A4BYdts08DUK7cAijEwKalQe0WmZHL9pU4BdyJj4af1zBgjOZe1kWlyCvehqStea+PK+DHo/ti+o7ayRpRumK4S3dg68+ILjboTDegOO4ibw== 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=LyPst23F4dEFabeUjgji3XsXEmmbpjjOKbMsaEAw1ng=; b=FvqaCAHK1rhnObItFcOyAL84Wzayj4aPMBJoSOx0zhyzG1hVQPyFMwWSLFS89gG9iZxhBFL7c0dCiOtytTjvn/KDQW71qn9IYLx0fSaZSapTx8EhQ9UjO3+VK/kaJynFPCyQlUpN2DwPLuME8HhC8/xo+iRaTcbQBBjNvosbMlg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:31 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:29 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Vanshika Shukla Subject: [v2 15/30] dma/dpaa: add burst capacity API Date: Mon, 22 Jul 2024 17:28:28 +0530 Message-Id: <20240722115843.1830105-16-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: 15139ad8-9a49-4410-e6ac-08dcaa45bdba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: znqDUEkUDlSYmvYZgwaOVyshiEwESSgWFH+yluaeDOexUuPY38/tMS7sOyZJd7Zaz8HE/IIJlhdbZ99vNW6wfHZEQaV4tEqsBV7zKYhcCWvxBrdU93oiQZvXSA6O49ezvttZr2qxUOTOWIs/ew9Wy07OoTpF4hTD85a6cKIPL/TMnmSt8hFJcnMSSSmhUTKp3w1XjZWKIWsQ4OxUc3ot61iJaWji5yuAjRyEYFk02WLPgdu0ZGl3mtVxuQzSkyAtz/umBMPGxSxsdGKeSHvKe5pOznbSpWejIbmbz5ezz6eKvqIKFG1rqIb10eRJYefm3iWQwea0auWIM+dKwp6PbCL55lu39RqG4BiFCH0QfzWuQMzxOvA1Ru6mSbSv+dm8v+/SFHWWBWHUVEvy/ePWgJbkJCT+uMEd4XwcCB8gJc5r42A/EKvZbII3+phq5beI9cIHyKzG/5hJsNjy3iz5qYn5iZ6sm9RvWk2WwZGQmr9uLv5G7uv21HziKEIkTo/3si0RozQ6hSbOQaR0ZNSSltwnpdMyMjCwsr96FdQPj1kDkqrhq8U150Ekei7IWSgmaZ/9WCmVGS5Jg4Aq+sVgFiJ2UpmLd3qUn3aQFE/O9wvNx9gwRaCAfCRLm/C3Rrw59PRIZvWdOIg0tABO12cS+GRwpWJNINGyXG/YvD9qxAc+oVnJGh5xqcvWnTQm7b/QE3hsaKCzGCIkSllUFzg1HGrFXyaEPmUfOJETY9s0C6gYYalsGlPtwNWBDj7jKitNfn6z8V6guk30ODu6MX3+tU4lg9FvoWBXvMOMQNhUfNd6v6WJ8hfsNTG1pXJxU+vqA1VDbKEDya7w8BQEkV1oCW3n/raDHEalTVHfi+Jy8qr3bPO0qkj0UmXxlxauEv5sTDgu1APcgXIYmgOnPdHVy+M21VhPcs15u0kVpKXbgrc44lK/8127A7V1F4PcTJf1N1frW75ZjPxR684x/ZWscOLsdRcVO1XjiRV5iIqfksOMZ/FCV58TRNUaUWB45PGMaymuQNK9M6hIW+JZTTAX4eqLrj8pfVfpbQ/NcAIfVPh1lCCydEUgkf/XOQrJj2Y793rXkapN+A3oI7cysIQoAYq+WdlKwidHqna60A7iC+FEm8IUW8ti31m2YfmsSvMbVV8R5vO+s3tpL912xSEN+jtF2MWjDFPUQePue4zfv0QpDm4CdQDP7q28VfYlYDlE2iOD45gFhWnrTr8FcbsXzik5CmkdvG1fL/HPb+SnmZt7LCbJ9cYElii2/fOxRbOBdcfWESMAiBZkICr8AWgCrpM4bDwR6cl7RVj38Wy/xd62lP6FlrKcQ2ZEwQirTaed4lt4RlMuQ08GjAvZ8WzZH1N3qTt8qF+/DMox/iQLq3erfXg2sdXXVsETgNJQx5Pvm/fOcuOxdo6/o+kl6+nlpg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1EhiuY7sjLT408PSfyyjmilEXGHMjsKqqkoDc3wUqaEq7PqgWxqc+852PYCWnk1DoEDdxduSsUNMXB91ZhM+RkZwnTqVJm2VQqJH/nq5HYu1LPGnObg6D8SlUTfvlSU6SSO4HO5bojlVBIYe92ItX68Dw40Zxv3HsmAUM7OLEkgs5mTqiHp65WQd8ylH0ruReCV0j/02sDbrj3Auz+KvRSxMsLnmiSJ7eq6uHD1GE4YRIt/E4lBK9m0agcVhl2ZtOokLMCnCPj/1Rn7pCy/bZV82qA5USEelU6jFXBzPa6K7gAoEZiM1oG7FLVDaS5W4srd0/609ySuBlR4FSKoOopAQ57yVJqx1cM7rxZIIWlQ/aCrrJ+gbqxs/36woGWL8i3IwMgZqioVJDyRjoW6KC+gL1DcvR2JeHF20oxt9QmCfshKI39vXp7Uugtb8UEKJQYwsgpkMLmkpeIWxqM3i3Sx4UKsv8ekPWQGCmTijG91FC9zuIRd8jJ15K4k20tATmA1UCOKlHP5StfeHDi4b69R03Yt4kjnqHHfxKXfcrti8irGxJt7Zmgf07RJTnDGHnaTl1aNWBnDZ20cWdqS1WvekKnXGzg9lAifefEJiGbCRbU0fNNo/rbkU+EPA7Hkw0R1vu6MKrtcPx/w+gtsJQIoytGPeBKRe8eApdkvYUXxIKecf58jK/KZMBZHxyf5XmNeDlCfJML6c1Rxqu6/KrZE2PTHUbLoP4+HV0SJhe+IwQAFwZWrz/ou/HnAQgM8yBwvEifeDD51wg0j8C/3Lok1Z9uJiL94ufDQSj2RkwPvUkx3hteuFOtEjW3gvGAeQwuzeFwVNLBaSWSvvQhOEyfERpHAwK2G73EVb/hgr9FwMiHkm7sWF46rJXwDY1EGMnA+28YpjeE9DLO5doe0YECOHRtDUad2cwQdMJG3Pxzn7pza8fbqtoX+RraaO+wOmnrhUSDFc0sF6UlAdfp/muAFW17f9Mk/WNtQ2SEr/z2f7JcUlspaWT0/MRjYydRaWca21Ywgr4NeuUqjRLErlPcBhs1w5Kri4PE3h9xwLvKWhbO3DrJS38DeGabrNe189pKQmczL0otxPBx21K7p5ECixSEnKuUCnFPKHMa9+HDDLOXGuVUxrnUxwjo9yJrV1FgUQkC+6/nWtKW6CbT1FUoS/nq9NXu/BhsA2YGLx/4ZAhGi6FVFb1n8V6AmAhfgpREZBULZY7Z4tK8SE7rYFmHWvkl0NuGCJKGu6gNZEPxqtJ7YLPJJKo+f0mn1qzqGwKiY40ScQRAHHGSd0Io4I8dAp6WWX/koCsiDSkK9C1rWdWvY3IuE9eflasyVWbFa1posXjA/KwldAc7tsz6E/gb7FKdgrVb3CQY4vKFhKrOhC9Ai/3s2ZR6EsqvsBDjn2EvUCwo7ULIAjlEQHANeBUIvyMASTukLuz5TkPqIZ27MJ7QqE+AWFR6O1r3IfNTcV85cpVH+ZJnW5UOp2QWLXYayOwgUAnowafZAtpCsM4N7CIJQFX6aEgaJpTn/PMGxae/zR/3BcRblMXlizQxtjPS05/R07IPNZH4vF7b6yqUHuGHFTtoFDjicUJ5fmkP5Y X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15139ad8-9a49-4410-e6ac-08dcaa45bdba X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:29.4023 (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: qBYMFr/Mbl6gPoE7jUMuFFhpxGXcPbEDy9miDI5twFaPfI9S7JfKTWIxFBfUfqie X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 From: Vanshika Shukla This patch improves the dpaa qdma driver and adds dpaa_qdma_burst_capacity API which returns the remaining space in the descriptor ring. Signed-off-by: Vanshika Shukla --- drivers/dma/dpaa/dpaa_qdma.c | 34 +++++++++++++++++++++++++--------- drivers/dma/dpaa/dpaa_qdma.h | 3 +-- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 0a91cf040a..bb6b54e583 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -423,7 +423,6 @@ fsl_qdma_halt(struct fsl_qdma_engine *fsl_qdma) static int fsl_qdma_queue_transfer_complete(struct fsl_qdma_engine *fsl_qdma, void *block, int id, const uint16_t nb_cpls, - uint16_t *last_idx, enum rte_dma_status_code *status) { struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue; @@ -457,7 +456,6 @@ fsl_qdma_queue_transfer_complete(struct fsl_qdma_engine *fsl_qdma, if (fsl_status->virt_head == fsl_status->cq + fsl_status->n_cq) fsl_status->virt_head = fsl_status->cq; qdma_writel_be(reg, block + FSL_QDMA_BSQMR); - *last_idx = fsl_comp->index; if (status != NULL) status[count] = RTE_DMA_STATUS_SUCCESSFUL; @@ -607,7 +605,6 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_chan *fsl_chan, qdma_desc_addr_set64(ccdf, fsl_comp->bus_addr + 16); qdma_ccdf_set_format(ccdf, qdma_ccdf_get_offset(fsl_comp->virt_addr)); qdma_ccdf_set_ser(ccdf, qdma_ccdf_get_status(fsl_comp->virt_addr)); - fsl_comp->index = fsl_queue->virt_head - fsl_queue->cq; fsl_queue->virt_head++; if (fsl_queue->virt_head == fsl_queue->cq + fsl_queue->n_cq) @@ -623,7 +620,7 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_chan *fsl_chan, } else { fsl_queue->pending++; } - return fsl_comp->index; + return 0; } static int @@ -771,8 +768,10 @@ dpaa_qdma_enqueue(void *dev_private, uint16_t vchan, struct fsl_qdma_engine *fsl_qdma = (struct fsl_qdma_engine *)dev_private; struct fsl_qdma_chan *fsl_chan = &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; - int ret; + struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; + int ret, idx; + idx = (uint16_t)(fsl_queue->stats.submitted + fsl_queue->pending); void *fsl_comp = NULL; fsl_comp = fsl_qdma_prep_memcpy(fsl_chan, @@ -783,8 +782,10 @@ dpaa_qdma_enqueue(void *dev_private, uint16_t vchan, return -1; } ret = fsl_qdma_enqueue_desc(fsl_chan, fsl_comp, flags); + if (ret < 0) + return ret; - return ret; + return idx; } static uint16_t @@ -826,8 +827,10 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, id); intr = fsl_qdma_queue_transfer_complete(fsl_qdma, block, id, nb_cpls, - last_idx, st); + st); fsl_queue->stats.completed += intr; + if (last_idx != NULL) + *last_idx = (uint16_t)(fsl_queue->stats.completed - 1); return intr; } @@ -873,9 +876,10 @@ dpaa_qdma_dequeue(void *dev_private, FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, id); intr = fsl_qdma_queue_transfer_complete(fsl_qdma, block, id, nb_cpls, - last_idx, NULL); + NULL); fsl_queue->stats.completed += intr; - + if (last_idx != NULL) + *last_idx = (uint16_t)(fsl_queue->stats.completed - 1); return intr; } @@ -912,6 +916,17 @@ dpaa_qdma_stats_reset(struct rte_dma_dev *dmadev, uint16_t vchan) return 0; } +static uint16_t +dpaa_qdma_burst_capacity(const void *dev_private, uint16_t vchan) +{ + const struct fsl_qdma_engine *fsl_qdma = dev_private; + struct fsl_qdma_chan *fsl_chan = + &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; + struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; + + return fsl_queue->n_cq - fsl_queue->pending; +} + static struct rte_dma_dev_ops dpaa_qdma_ops = { .dev_info_get = dpaa_info_get, .dev_configure = dpaa_qdma_configure, @@ -1035,6 +1050,7 @@ dpaa_qdma_probe(__rte_unused struct rte_dpaa_driver *dpaa_drv, dmadev->fp_obj->submit = dpaa_qdma_submit; dmadev->fp_obj->completed = dpaa_qdma_dequeue; dmadev->fp_obj->completed_status = dpaa_qdma_dequeue_status; + dmadev->fp_obj->burst_capacity = dpaa_qdma_burst_capacity; /* Invoke PMD device initialization function */ ret = dpaa_qdma_init(dmadev); diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 7e9e76e21a..2092fb39f5 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2021 NXP + * Copyright 2021-2024 NXP */ #ifndef _DPAA_QDMA_H_ @@ -176,7 +176,6 @@ struct fsl_qdma_comp { dma_addr_t bus_addr; dma_addr_t desc_bus_addr; void *virt_addr; - int index; void *desc_virt_addr; struct fsl_qdma_chan *qchan; dma_call_back call_back_func; From patchwork Mon Jul 22 11:58:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142594 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4E9DA45681; Mon, 22 Jul 2024 14:01:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1CE7E402F0; Mon, 22 Jul 2024 13:59:39 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012009.outbound.protection.outlook.com [52.101.66.9]) by mails.dpdk.org (Postfix) with ESMTP id 11FAC402E7 for ; Mon, 22 Jul 2024 13:59:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ir365IM24HstIzpl0bnn3jMUhuwbrHori7t/ROLDCpuTs1OXm0yk0pCuDYy6LTSlQfJaPDSAX64/Ru0OSS8MCWmZ9LHRzh6p2Ic/p5sCkwh+i9mGN1xGtSmiB18NFKqer0xRHgDgXJbR1S6ckMuntcL1StGDWdb95o81uvuxACwwriMLvcMLnpnLV6u8jf0kXu6gEj/TjF6PmyUTP5k+LEdlMGSjsWqPjkGJn96iuU03yMwpxb5SR29dCPObddkRnq3PFDa5x5KGl5GnA0KGuOpq7+EvFQwVa+md/oIcy9TojsZeHzPTd13PA+JN58wc8tA/CKLxWBx4e4y9mEdm+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PWUoMrkduhZmZKmC2LcLjnnDGF7Cw0n146YYyjYBPBI=; b=rbCPwsTXRN/wWLet3HM+S2Z5ISyhh8rtGeVdtqFseuK7y4DYHKSS9wOw8IgTT8x65M+7rp94HahfbMZWIQa1XG0Xtpq2Yq26AQFv9Q+NgZAx3xbU6d/ogcjU7HDL5ACpijQugCHpfR7lxfnxH7pIqSEp90mzrf+EoX+2S8To/jSWYzLIzb/hqO2iHiBSxvd/Xa8zg9ju/k58qBGreRVA1+fOnue5/M5StHWRlmat+VnJYlC+0YxNTcmLbCbncxMcpfEZh6D36y9S/pqiU3+Ebl2pUndBVnQtHtls/ZwjmTwe9tCiqpGrKt41drmIFYXoKa06jOJ9hg51h7taGQeJGg== 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=PWUoMrkduhZmZKmC2LcLjnnDGF7Cw0n146YYyjYBPBI=; b=Fh3ESwtyUh0TJE2j8mvk/hRHhxF4SDmX4rUbxP5UQ9WhrR6b9JEYBHCKPCcUNxjnlW2RQATqyMgJD7aB4lMe2NDHY73cKWghrVitms5ykanhOuaOEfZSqrLBufcWUD66vadyInJna/7Mjbz7x5ARk51YEx1EdqWFb7v/0zMSLOQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:31 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:31 +0000 From: Gagandeep Singh To: dev@dpdk.org, Wathsala Vithanage , Bruce Richardson , Sachin Saxena Subject: [v2 16/30] dma/dpaa: add workaround for ERR050757 Date: Mon, 22 Jul 2024 17:28:29 +0530 Message-Id: <20240722115843.1830105-17-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: 2e6fed2e-ea4b-4349-ffc7-08dcaa45beea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: DaSZmKHW+aLQcVXE9cAG/hVaIBZTUvoy9OS4qk5vVy2zX9SXnTHkrAag8b382oowRfPhtRRQKisfaGCKGfUtK6GzDxpDOsZTd9YQhKrTosY85nm7IJtz/Gb437Izd+v6CSsxt666nU7BxLU/Jcz2JWtFJ1fwRo2L6Y0uyJDfh7TNAzFfIu3fVfppdbCWNDiMWN813E9j2FBXV8pEEkrC4CJI0irhOnoqAWB2tAgHZe6FVb5zjYB54QgtffT62iwuVMexeiRhIvSmfNTAMKJdgcyvqQ6mQrlFC6pBPqxxsTlJaHdlsMHM1F6J/6x7DD2Bg8jvacRVp8BgR0POfzJPVAP0IOCzpnHbG9GpQtcIaV54gAMVwcWjH6Q1DYGHE/SGkU0k7WCecAcim/oJANbsdjNxVseglaCmSc/5kJXyS6NhltDdohdweHqPEFMgjHvbJzcQrD1Dx4HfRp86OU1zsDgCZTG3jG1PIFPL3rhifRn8inRIEdVLW/N4N172Ir9ISzPRKQDxuROjjs8zpQ69fvrNZlQQMME9Jveu8Vnchvp8zcKg7DYh9NoKzQVb0DZE449CPPljdH8OcfmA0udvhCfHOSEX1d+S+K13enI+RGE2Kua7bRx4QUCCqsWH7Ssyb8j6dSaw5O8NLClkm8ruFBY4qDmyCpv8lctoO0eTCJOJ9IGwJrXn7ic08oAGq3FieliT/4/HIbmY9xP8qNN98Nn5PMQLPFBDEJP7mI/clFNASsvNFFE/jq55tJ9b2sH+wtPx4J9o7rcANUJKn1ivrWsix/we3GuWW6USmydAbNPkq+Sd9ZUDdpbO54XdsgsJ8tQQrNq7sKFiKUzwqZGrLzGee3ikJjHvAxkkAYHUSuE8gb10S36D5S/2V+9nIToFxLU6R2f0w7TYApEluAudwTQUqqQCrsU+WIo2cfs7aYhAVB2GlZRhbsnOJ/4e+PD77isMcw5z0sm3Lp7gO7Av2WWmjWzr/Bi/2Yz2yaDe/OZ93qR2LazLipQ7zqMykqiMHCclRZTtbw8ZKd2u1CoelbBoX3fdaedrAD8TtpDwYKkdsQbopEn7cix1yYqx4O+Z0EQUkbiRjFSZo+rnAnigDQw5LnBd4RarUEKqLu14cY+qf7rYMElQmvU5YXSNkdNyP8TUCdkLFbVd7NCbCi2lgiXS2h7eO5BOvy1kcHJVGW6xMRgsPww+tRPf4VF/MtTO4BThSU9IvEVMCOjI9kW0z7boXR/I/eWVHoGzi9Ax6gH7bTTW6IMjQoKR7d+ZbUavmcB+EQqG11Oz3h568qfsxcQ4xX51KjJN+7Uq0Em2bJ6yGTgsGMHpuKG48SQnfHOCR5bbN6H2rpB4KbEyscyhhbfR9t8XDWLLeLIoga5ixZhC9fA+I9lVgtty9B2lAdnAzzbV/NrcT6fIBD9ieOsF5A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ka3qpMEALr6597FxAtzE8hKHlQckokK+unVJmNWbooExw99ffAWRT6vLDht2g3dkRBOTEFAbbA79FXlSCXNneZ9dOMXcAos3KEOi/ZuwZXHv9UBWyYV8/nPQ/nRHDeWdG5nzFQfOagFOazLvH+eRh99ZyufD75iwbwKnrEWGJSTx6H3EkuJwWReXDckkWY9QD/TYiE9VX1CdnGEWRRFXFWQGSaz1/I/CMA4LYOgM5yijvayxZw9YJgKKzGis6dpMNtJmonIC4LuIUcmiTEPnyMMfBmr7bSBHia8ydbruKF5zXFk+Hiaoc3FaHYWBAGixhS/dycAuduSEkL6+eb1xiBuNltp2uJYP2UUeQ26cPLqKbmjmnkHemX3JpZM3el4qpa4qI+1f/HnMSSpeHRvNRPGPs/ZjExiEl2JWXUWOwg3uY+WKdg2FZqd1dvK2mnATl245PhIsOVkfPBAIpbB3JWWvA/Pp1te4ufJdTkTaZM3fke/BQE1tmz+++ZY7UATzTSm+H/kN+MzBcQfDrKu8QkO9oPw/csDNntnKt+nO9Gy7VFdfBpdkVJwZaj/idhR8EQbBiP4mudELdJsRW75cN9hZ6n7F6NcYofpRv0YU8ztemyz/AfWaOs8b8BySyDEqCMyYxIFSk33j/Bvtuyv64vhI7a7FSU/CC4m1kjhGQl2efVB7XMWaTY4rDojVAAZptSioMNibmkHmZ6uvUXobum5jHT+1ZmJdUNgFHgkae1HHHvjYooJ3ZJkyY/YUa0Co9gX1cbiWjRjv1Md5i/3t8qunzgordwDfSr7YD9ICA3toGpN9Jk3jqaRhVyKuFPJngivRImezZseggCb4/iRgiYtdXjn/+nYkTjXlrCY9HCqtpPWsMqkVJMqeJlbdjmDuJQ3dfsd/FspBw5vy34cMA6ZRmNPzvns6tJnto4sn7P9wCtRBGD0d/Ao8z+0fLWhihXn3wXWE9zcBMsXjElFaXpM8uwFtVazxyi2oqUo4DRRLKmSZTHrW/sP96CZCFybqu9145yh6Y9eLaYALE+8dtWmKw/8UpFOapU0AaAuGE1kFy1JIspxEFScVTs6kM9nnM0qSlKtvs7HoUPBVE8czeaz/PzNOHkWsElG74Ik1n5gMPBOdgC8SYZ02UbxET9FYVKsdnFBwa3K1OuRs5kHuvz98LYAJi7BxPs1RcHUkRz/DcmSuLEs5796WpGcEoT+Zl2IOXe3c10Yt0QYkFjlLvPHVXfNfFneCxwGBavhSIW8Kuhp6AwJZqls5+DDioUtaYXyKUQTGTVo2f61oHI3FupBVWXTRea3hTdpe9uDMUKaSctz9HXiNihQlB9cVMbsoDCZGW1q62saHCbnSM8ppmL70zu3w/iXwAYl9DWHN/X+OBAaEaQjFRp5tR3pMgx/f3CKLdwrGg2ab5wTHbv/E4ladrFCe9IKWyQnHYYgLesWaGzIMaH0YmaQ1zRD1M7GaXBPIdL37bfAb4uyoVmTF0j3qSutAV1oywCNzNc0RNMiYFbYYGonNPHMpa69H2lF8fLYyXWYUqp6pbz9jpCXE/B/IVXAziW/UlqlLtqB7U/HOkM/w3mmkxXKND41jiEmD X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e6fed2e-ea4b-4349-ffc7-08dcaa45beea X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:31.4309 (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: 84Lf85JYn7DFPEWj2nuTHhBUWsSvkCl0UoagMiRYYKmMzVz2L0ogoP4tAM26EFou X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 ERR050757 on LS104x indicates: For outbound PCIe read transactions, a completion buffer is used to store the PCIe completions till the data is passed back to the initiator. At most 16 outstanding transactions are allowed and maximum read request is 256 bytes. The completion buffer size inside the controller needs to be at least 4KB, but the PCIe controller has 3 KB of buffer. In case the size of pending outbound read transactions of more than 3KB, the PCIe controller may drop the incoming completions without notifying the initiator of the transaction, leaving transactions unfinished. All subsequent outbound reads to PCIe are blocked permanently. To avoid qDMA hang as it keeps waiting for data that was silently dropped, set stride mode for qDMA Signed-off-by: Gagandeep Singh --- config/arm/meson.build | 3 ++- doc/guides/dmadevs/dpaa.rst | 2 ++ drivers/dma/dpaa/dpaa_qdma.c | 18 ++++++++++++++++++ drivers/dma/dpaa/dpaa_qdma.h | 5 +++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/config/arm/meson.build b/config/arm/meson.build index 012935d5d7..f81e466318 100644 --- a/config/arm/meson.build +++ b/config/arm/meson.build @@ -468,7 +468,8 @@ soc_dpaa = { ['RTE_MACHINE', '"dpaa"'], ['RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', false], ['RTE_MAX_LCORE', 16], - ['RTE_MAX_NUMA_NODES', 1] + ['RTE_MAX_NUMA_NODES', 1], + ['RTE_DMA_DPAA_ERRATA_ERR050757', true] ], 'numa': false } diff --git a/doc/guides/dmadevs/dpaa.rst b/doc/guides/dmadevs/dpaa.rst index f99bfc6087..746919ec6b 100644 --- a/doc/guides/dmadevs/dpaa.rst +++ b/doc/guides/dmadevs/dpaa.rst @@ -42,6 +42,8 @@ Compilation For builds using ``meson`` and ``ninja``, the driver will be built when the target platform is dpaa-based. No additional compilation steps are necessary. +- ``RTE_DMA_DPAA_ERRATA_ERR050757`` - enable software workaround for Errata-A050757 + Initialization -------------- diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index bb6b54e583..a21279293c 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -159,6 +159,10 @@ fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp, dma_addr_t dst, dma_addr_t src, u32 len) { struct fsl_qdma_format *csgf_src, *csgf_dest; +#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 + struct fsl_qdma_sdf *sdf; + u32 cfg = 0; +#endif /* Note: command table (fsl_comp->virt_addr) is getting filled * directly in cmd descriptors of queues while enqueuing the descriptor @@ -171,6 +175,20 @@ fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp, csgf_src = (struct fsl_qdma_format *)fsl_comp->virt_addr + 2; csgf_dest = (struct fsl_qdma_format *)fsl_comp->virt_addr + 3; +#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 + sdf = (struct fsl_qdma_sdf *)fsl_comp->desc_virt_addr; + sdf->cmd = rte_cpu_to_le_32(FSL_QDMA_CMD_RWTTYPE << + FSL_QDMA_CMD_RWTTYPE_OFFSET); + if (len > FSL_QDMA_CMD_SSS_DISTANCE) { + sdf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_SSEN); + cfg |= rte_cpu_to_le_32(FSL_QDMA_CMD_SSS_STRIDE << + FSL_QDMA_CFG_SSS_OFFSET | + FSL_QDMA_CMD_SSS_DISTANCE); + sdf->cfg = cfg; + } else + sdf->cfg = 0; +#endif + /* Status notification is enqueued to status queue. */ qdma_desc_addr_set64(csgf_src, src); qdma_csgf_set_len(csgf_src, len); diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 2092fb39f5..361f88856b 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -81,6 +81,11 @@ #define FSL_QDMA_CMD_RWTTYPE_OFFSET 28 #define FSL_QDMA_CMD_LWC_OFFSET 16 +#define FSL_QDMA_CMD_SSEN BIT(19) +#define FSL_QDMA_CFG_SSS_OFFSET 12 +#define FSL_QDMA_CMD_SSS_STRIDE 128 +#define FSL_QDMA_CMD_SSS_DISTANCE 128 + #define QDMA_CCDF_STATUS 20 #define QDMA_CCDF_OFFSET 20 #define QDMA_CCDF_MASK GENMASK(28, 20) From patchwork Mon Jul 22 11:58:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142612 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 10C3645681; Mon, 22 Jul 2024 14:04:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4353F4065C; Mon, 22 Jul 2024 14:01:06 +0200 (CEST) Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011006.outbound.protection.outlook.com [52.101.70.6]) by mails.dpdk.org (Postfix) with ESMTP id 235AA402DD for ; Mon, 22 Jul 2024 14:01:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DVAgbFtnFGpY96bQiEI9wBT3yWx62JBLcHgtgKZuS7SY1+bX+z9kVbsge7JaOaGtYv4H/wlLQEbOLcMpIUPhrXEzNLawzQPUtG9AOya4cmYpik5a/yq7eSC8Cx1JCtYeULEEl7doQfu+Exu772enXY4MTl6zYZenPaKMQjVfgu9BJyH/7Rmy+kAUo5U3pJZNNjPX+hqEqZZTbsrQvUJJMFbeM/tEYsDoA+Xs+gPSH3l4rcImJAn2hYXwZBVzEzuF2XtUUEn6Gux7jeQRzy3tUGwVDZoKubdotF+ZX9igGRIaq1Nrn8g/AIQr6GLV7QbYPAi76JZNt0vLQwNXAFiNBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DmwtVUZsJM/4Qi+nuyggRCNbFMQIB0bKuYJeEQVY58A=; b=HOeaupKWvuU+GT/Pt9CpfVbTBuPbdtOdF3hTQSR3P6nRv77aTnq3OtEIuVT50Sw60H38fzJ4EUU3ffbGVatA3mS/7tmarDxmYEsvevPNe3BzxaDbApXOPxDot0Fc0JQFyu8AfTY2W0WVf30Jedx7kRtCf9w8gnmt+Y3e+BqJ1nhnBFc6asqQazJRpLJGqS2kT6SI+cUzJOz6+qeE/jqiA2vdXwyNa3JAG9UZ2msrKmLSziWZQagR0V2AYyqdQBj0APygaR2soGbUBVvT9YBRvv7Hxq8uisIrYK65SsYaLwPxF1FDNtv4VZrbp7B1D3GGINcF9oWFm4BNkmwTdBgdkQ== 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=DmwtVUZsJM/4Qi+nuyggRCNbFMQIB0bKuYJeEQVY58A=; b=lHVjoQ4bS4qwFeG/dzGN8ET0o8wLfO79NqXc8PB2qxZu5AaaeXMUMpP9xNRCeUo/ImJSMQSgDBFc/Kqeax9Pn9HhhhhUAMs5qXbyyu2oCsRxD4VoHPLqoeB3+nfvguUQ499pJPD4j9mHmG0i44y7Wj1VM2JBfSr4erLyIRNXaC4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:33 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:33 +0000 From: Gagandeep Singh To: dev@dpdk.org, Wathsala Vithanage , Bruce Richardson , Sachin Saxena Subject: [v2 17/30] dma/dpaa: qdma stall workaround for ERR050265 Date: Mon, 22 Jul 2024 17:28:30 +0530 Message-Id: <20240722115843.1830105-18-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: 84cc9821-c9b7-4f5c-6ed2-08dcaa45c023 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: vRozHTvbHIDIRdc46c81rr9cQ8Oqx2eObYbqyFhGwEFCZQGbQNj9WlGO1QvIPSuAKqOBoDRV/cXueant0kJ2vhoXDEx4zCOQOQv9zQtc6MVljCJDER0BM9k6zDNabGTYJUjhZ63JdsLUwVFJIwQwZRLy/Z5RhaeOMfXuKbQQjBZocAYpV/fnMR7CGJnZEZrI63Azwq70x+Usz7S1CjkXrB9/ARem5d1FZvGQfBTeR3wggg7gADWowaLELYbrMqu+W78AUh1jJNH+7hz35pJyhvI//stRDVo/AbOS6LcY2v8cizaFOH0wwoKO5D3DNqNrAL2MSxB4UdzkQ+2qliix7/o/BTJv6ZNelx0RVRUSZLF/unZQyyLfJq4frT4Rzg7hrslFmQ0samUxFfnLWFZ+uX7PG05jPH5cMbppzktau7hSPheWoCAIABnKqMckh8OYSz/IWUSuHz9ZlxgnsOSirPuK/rbgXmK/JvQG1U9jobTIXEoiy5P8LCpLKlb8Hrr7GR6TkxIOvr/zcHiqOSK9ZtKtZfmXuWtIrLsNMSwye0NLy3iEZQWSxHmtlzNmwFD+99Zt9l3x+07CRgAfc7qtZ7dP7g2ALW7LL79+tAbMLpcz7i5ATRLT0bpy2FrYHIhLkAMXjvL/WCn/tNMFZ2w6XODoTcYOgweaIZm3sb9g3z4bPNMXUo7KzK2AmXT1Q951OfsYQ645obpm+omihk62KHYVvwYTyNoXaG5G9UPF7DQhgalDVJDVjoRZJd+PacFd0KxSpdc4jFdJcRW3SiYm/zKrhW/N0nk+desnOxaV5OAh9PydyTt3BBxBdJXbcmcy4s+mEHqqGEJL5wDfCVpt4uH5oDKh0dVXgjzTZccenbDiL/befAjBj7Ty/18w5xBxSiQNUcQhDjmvpe0Iwo5pIWU43sd4Ihvw9HqlI2YqKsS5Qau/C7ZLn2raCBe+V7wlFIR/DzFdbidxnXSZgZ+HG7wDdYCHFQf2i/+b8rw/MWzucoXbjR72sbqxHAwzImJ/MkM2YSggePtBd37Vkr9iqCRSNPI2rM0CyREbUoCxWjiZpbtiUhifvDQwp7GC5oAc1tI3HSwAfed/zhmPmVGskCcxI0jNFaAH4lm7iSnmeQv8wLag+QFap75otb+X25KSvqAA+kU5TNlE7rwyGIP2NoQVnPnLBa5u4t57p+sVB5vgZ85SAAOWz9mBtdzRYeAnqu/m5ZxJ+E5AT/mmyvF9s5rctU6rGXJ+KTXN971TLF2FSfYpP32WBE0inaGd9Q0QkRTqlWrdSXlRuvL6FIYWQzY++sfrsGw5ho29B2Zg3XRFJeNDpF/aNwhQ52lQ4b1uf4u08uFQ2//cUtgvTus3ue3kpA/1RYzT8RNL8YT6o3kDq4R470Q60t/UB0dzfWOUh/ithZYkJ3lAI0+Xa6J54g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Zoa7F8HKdK9t7e61I8UHaiKqIegI7Vs76WVFINXChfdcHP7/FddZpOhFvvxe25DxgIHD3EJhmTyVIB2XsI3p51fqH1VSO91yQeEMXLCBO7CuX40TW592/ncD0J+3m3UawXvaTyskayywDbn3ZOZKjZXIOJ7Cl2dRrZjS5iRqb3aHqz4aadz8K4cXGt8kzDvVKHtnaVkeaM/yP2uDVMx0F4xjNGkszZVzKHvwUvnAbtC8nbF0fxnVZ+Nvn3n9rFLAbxcxyrkxt5EvfwKiz5yj0RawjQoz+EQ2WkFTt2y3Vxt1nx6gcStRjItu1d8XDEIKO2O3nyTmFq1hJmJBrKjuO24Olv1DuXganwwkg13GPrIeCGicBIqKPA35hKsaszuYjWm9tSft4JdtxBUHu8wOl1jhSulHjgShW8hIZW2JbvwTz3KVZQkxlXsii+lYvVP+40C5sEF6LK3tIvUWVOffMM/uExxkD0TpRbruxK5JscDKlGNQr39Ll3njnNRAi7kNEIUZlhhXgz+PHNJvoCnu8WYMNHm4HNXSOG0OM6gPjaVOozhb+0x0b0JTJUBBrOSK7e9HzN/mjpCSRttu4v+PEgtVIL3L4GZD+CVK92/qNPJg6FRd9Bjfg605BK4Y87qxnsCPpSVC4qhBuQr9FO0h+tlLWPfIBkHO/67fR1FjZn92CPSkhDWqNa1RAOxmKVPIuk1ZEFqFP1vgo4M9ICD4w05PfK/dKhORa8t92UvlE/6G8pvIYi9B7ty0PE7WYi59BYIIoWWEXRLT6rZs5tQhVgBLNc6RdXJwKRm47apAwwM3/w2WTgJkVqzzgEfX7pOfaWwVSwXo2K+vrjDhhieQQQu9arlIkhf2F+AT5TxsPP6eQ1DBy+Sg8OLPS47mzZYw2kFUyLtFq6xvOFJ+b6710Z6kTHoM2zq8w2zeloQrcOtk8mkL0X8JT+sgUDdhUNzgaOLmegrapCIuLVzavQjAGWSYEOV5eSFAh6Fv7VIicpwlTBhLQMBnZvXtLor2uZ9zoey7w7/dpVaTCZS3nFlZVGcDY/RFSAN9o/0Mq8qTyu1O0+B6cPSGF+HeDoGJsw3QLOaoQouX8Ltv4UinVjVY57uWyOnmdYNE8O2SD5FjJsgWhegFUKIXxcO0CrFo1cn6EfLWwhrRhyW9IV3mIItdMqVzNTeHMDmiWM8cpOSaf1EEKK1mLzBLLhk+fwB8aqk5XnzceMpehvmHReYJGKxj31HGRWeOVB7zv1x1k1ZlgckQNiDCZPbFJcGt6+O5mlrorwJ6RHCq+CfIqcVpzhNw8hJ+yJT1wb5yPQEkj4aLsJJgcT1JwhSC+k7N1QitHWCZOpaVIaLiNVLrzT5jatZxTlpKEdvrgF6PSX0zv5ygLXGAmf2FOkcLhUIkTquzGlz+xxtLCX0QPS28B+bAg/FLcuv6W41XPANiTRXqbNgF8iL4BsxHCuL8lSXogQVYy1b/WcPfJn6nT+P/cuxKe4DjQb8FHBpVZcnHD8ioXMu+OSUb6IQeXXX9Bi0ZTUV/dE9A6LbvJRuYMITvunjBzs/9rlP0dwYQsGqWDePpZh77jWDzUvD9gmO4OpLdfo4qXOP7 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84cc9821-c9b7-4f5c-6ed2-08dcaa45c023 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:33.4811 (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: YoFLIrOr1DikvfT7p7DedXHqxUHoc3mid7fv2IAxQ5a/uGCE+MrSsts6OfnUwvYF X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 Non-prefetchable read setting in the source descriptor may be required for targets other than local memory. Prefetchable read setting will offer better performance for misaligned transfers in the form of fewer transactions and should be set if possible. This patch also fixes QDMA stall issue due to unaligned transactions. Signed-off-by: Gagandeep Singh --- config/arm/meson.build | 3 ++- doc/guides/dmadevs/dpaa.rst | 1 + drivers/dma/dpaa/dpaa_qdma.c | 6 ++++++ drivers/dma/dpaa/dpaa_qdma.h | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config/arm/meson.build b/config/arm/meson.build index f81e466318..f63ef41130 100644 --- a/config/arm/meson.build +++ b/config/arm/meson.build @@ -469,7 +469,8 @@ soc_dpaa = { ['RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', false], ['RTE_MAX_LCORE', 16], ['RTE_MAX_NUMA_NODES', 1], - ['RTE_DMA_DPAA_ERRATA_ERR050757', true] + ['RTE_DMA_DPAA_ERRATA_ERR050757', true], + ['RTE_DMA_DPAA_ERRATA_ERR050265', true] ], 'numa': false } diff --git a/doc/guides/dmadevs/dpaa.rst b/doc/guides/dmadevs/dpaa.rst index 746919ec6b..8a7c0befc3 100644 --- a/doc/guides/dmadevs/dpaa.rst +++ b/doc/guides/dmadevs/dpaa.rst @@ -43,6 +43,7 @@ For builds using ``meson`` and ``ninja``, the driver will be built when the target platform is dpaa-based. No additional compilation steps are necessary. - ``RTE_DMA_DPAA_ERRATA_ERR050757`` - enable software workaround for Errata-A050757 +- ``RTE_DMA_DPAA_ERRATA_ERR050265`` - enable software workaround for Errata-A050265 Initialization -------------- diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index a21279293c..f1878879af 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -179,6 +179,9 @@ fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp, sdf = (struct fsl_qdma_sdf *)fsl_comp->desc_virt_addr; sdf->cmd = rte_cpu_to_le_32(FSL_QDMA_CMD_RWTTYPE << FSL_QDMA_CMD_RWTTYPE_OFFSET); +#ifdef RTE_DMA_DPAA_ERRATA_ERR050265 + sdf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_PF); +#endif if (len > FSL_QDMA_CMD_SSS_DISTANCE) { sdf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_SSEN); cfg |= rte_cpu_to_le_32(FSL_QDMA_CMD_SSS_STRIDE << @@ -247,6 +250,9 @@ fsl_qdma_pre_request_enqueue_comp_sd_desc( /* Descriptor Buffer */ sdf->cmd = rte_cpu_to_le_32(FSL_QDMA_CMD_RWTTYPE << FSL_QDMA_CMD_RWTTYPE_OFFSET); +#ifdef RTE_DMA_DPAA_ERRATA_ERR050265 + sdf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_PF); +#endif ddf->cmd = rte_cpu_to_le_32(FSL_QDMA_CMD_RWTTYPE << FSL_QDMA_CMD_RWTTYPE_OFFSET); ddf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_LWC << diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 361f88856b..8cb4042bd0 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -80,6 +80,7 @@ #define FSL_QDMA_CMD_RWTTYPE_OFFSET 28 #define FSL_QDMA_CMD_LWC_OFFSET 16 +#define FSL_QDMA_CMD_PF BIT(17) #define FSL_QDMA_CMD_SSEN BIT(19) #define FSL_QDMA_CFG_SSS_OFFSET 12 From patchwork Mon Jul 22 11:58:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142608 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EEDA545681; Mon, 22 Jul 2024 14:03:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5371C40B8D; Mon, 22 Jul 2024 14:00:30 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013057.outbound.protection.outlook.com [52.101.67.57]) by mails.dpdk.org (Postfix) with ESMTP id 3A66F402B7 for ; Mon, 22 Jul 2024 14:00:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wSWwUbiSdMJDKVrlyKfZ53GYaF8DP/WO9li7NwHFBG84u5IZsgZfRXHCRZbvP/n+cNN3ED9x3i0ei6oeodA6+UNerGALljq7fRznU8gmEkTeTmwVBc4r2oHIoMmL50x3Pzg46byrCTkmMHKS6o0msexQeWJwY2PcQBxWBC+RXwJkaTLztZMNzhN4MkdlI9S5vGzODSreaR2h02lktkCLGtighBtp3vjVgm4EJ2yjIx0CeNQXHy+S1g2C86zhl1QgjN4rYutSlACgVxfGr+ppGAqjpNCAhtmgtWeLFeaZNhZeX37gqM01G7lvEp/eG9gVL5NSUYtVr1utr5G5eU376Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=daxQGNrfcyClhOeqasg/HjklJgMAOaSxjkk0365TURc=; b=hukA1mKoGuHq1cnE5cza/HMcXUCSpSFx8C8ba7V/PWJ+PO3rnN9x7bAXymxfPKuAp2hpLHNCQ04lwScrPWwljY7bWHh4n9hA8Yn4uZXVdgYDfRjFL92A1DoFKChUuTyptLwJjwMiFYOSgHMpn8HhVNTfEDyrblJuAYBVnJPo0eIbRtA9n3yKviKYJzAjw3Wx2EccIg7EKj0Cgxjf3YWfQcb3yU+BxjBPyPId5ZdUFT8CIjFzFrbHYasOK4FeWtgRnD2F5qGQGMTmRy1BFDcUjTog4f0RWftu9HY2jh6g3Qj9Rt1fCtV5yZGRHvSg1V1o4BSqb30rzpx7Vr4KNR0GqQ== 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=daxQGNrfcyClhOeqasg/HjklJgMAOaSxjkk0365TURc=; b=YnYPVsmIAvAPzvrrsIrWskSt8XMl6WnG/qc3M1WsRF1cWM8d4zeVVrLpCaiKdvjhTgN324XEffJfaJ94xH21EIvTdx3YaM+/CR9bmb+TyNugAAPJzJHii19ywXGlWYYv4RI9O3nVpxJKWrImMwHxRBcoxmHwzQ2RofDQy5OyA98= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by DUZPR04MB9919.eurprd04.prod.outlook.com (2603:10a6:10:4d9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.14; Mon, 22 Jul 2024 11:59:35 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:35 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Subject: [v2 18/30] dma/dpaa: remove unwanted desc Date: Mon, 22 Jul 2024 17:28:31 +0530 Message-Id: <20240722115843.1830105-19-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9919:EE_ X-MS-Office365-Filtering-Correlation-Id: 04f297e9-f8d3-4ffd-a56d-08dcaa45c115 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: HKsRif9GZv/wkq+iivT8MRR/sF69gLv9PPgb4+8fB8wmWPV293NcRu1JqkCYe2N+bKarbQr02YWN0ph7v16BoO2bALNVmE3R2wTDaUeGy4fb+PjX8Qxx9BSTdppgefZ27p1BU6gYMb0qGaSMuk2lc5H+XSWwup58kjw6GJtkaUqBtQnuBxk42va2NqY7Jqn8nrILTUohXWpq6CbHxwuHqfh2MfbUsWmuM7kaxe7jDWf1cHcMZkMKlG7KTDmIDAVnUXBk+0AsXLc5iPsNk6sr6waBxMgb4wu1/wSr+IcbbIkz+E2ODKzcoja2R15/Y7T5z2O6sSpH5sNOQlbQrk5NFvTNdjbMPuVOp5t9YwBbTgUPOs3N2G0fxoTTnPWQ3vpR5sEL+2+QdzuJSNAwQqm+BazvxF/QNaKXu0QufZvsBG1YMdlO+fJiGAovC4NtJE3XOZNX0mTJp9u+zv5Mk5ChujP5pi2HtxhzZvRU+aa3vIIr+vExzGLnAqtm4FTQ+ccU399IMEeuzvyM2KXC9XwxeYmFFK7LAVSMbuVtvuJGXJ7vDbf6HB4bkQ5U8Ak4jd3YDCUKVsP9oLPiDBQ1M8Grtn41JIf76NFXY+v+9SnNBq4f2moAkO3z0IAJkG0fa6ouEqsuZX8P76mWpF6GvIK82qI2jXqpBiwSSfnzqtw21JVmSNze6U6RklexTmZ7BCo3kd0CgrPtKjFcmejOinqblZ9WHCMblzIf3+bek5eUn8dZ3MyE7+SpyDdpXI1PqVx+ACpZGWQ6rFNUDdhd7a8S56NAo/BMpLaUv3DlEiQyZmFUUd12Pvvomef2iEzNy9lXs0suUK4EyY7YOHAB1KDFb05MC0bC6RXh/h4DM2OX6pX5hAihDVxKrEvBw4OklvrhIR+NhGlrAP8CsyCSRI+5iWBYf/vnM5Vgwb0DR7U0IhMSnz+Gq7BRyeP9K/n/9L730ehY9RMI1F2soJv6X3j0SeTI6FgOYEXk8CfI8N4DaN0auhOjyWlgos3STsF3iDJgzyrOZU+OFsrok9wgo9AZGXGZ9kjXT37U3+F0IeDPjaQ3yWtC7TpkhgxfOGu39zr2APXiC4gogTg9G/MbpIHAQ4r3TcQbvPVwpKpoIG/2CvKP5yQ4ikdwpSQyQ1bK2vxa0e1LQi7gVkuYLq1moeXlaD3EAcU1LQP1GyF70v8o8eGjrOajq9pQonLl50ifulVvYdL/jHkFR+19QCyhE8lWgjfh9mg4c3ZoNS4TGZwpMTTSWuLO2eK1FJ0ctWs/5/XZHij1kVM1uJe8gBHGwPWe0dyGZtvnOfdM8IOqPjLXZYSMBUp31nzFJ75dCqrRu/VHAsdWYv8eKA46D/PO7ecg9Io7hwOkaLpcx4WyFeU8Uc7WboEEFF15VFpEvl12GPF6j9ekjpRKOX6exIqCbZR2MQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H9tteJUW99a3KdPmgDuaCXrlq+LKjgx9C3zdGlf3TAgMwV6dLs1zUyGuaFDTl/iy9X6Lu8d+iTf3pNtv4TmcBsbOcKWJWWScCa4GKlv/+SLpbm1xyEdFTizGgLzukJ/ePJhmHMeHdgNPUFPRf7l/qbbqBqXcyGXatq4GEYkU+RTPzVYiOB7ZW7sIDxQvDcS4q1w1qrfQvsW3LdBWHc3mkuHhYMVvAr9ecM1h4U63tfA6n/S4XW7Tl/mUvrwE6NxXhZkpIq8uFOTMXjfOa+FqxnZ3fD/mcH2tQxrtL2L3XzPQw67ONip8DwhGD9iQud5oiTUvacJOIbcqMZjSOHID996OPg4S4MSrus83HXdW9dyjXK+oVvXCbtpb+HLKHTBSWqVfJdhx6fR2z/ujftlT8acBObluB2n7fHcMAe/82qzMtP+cSYJv4fXQm3ks9hrDy+ZfkMCg/vFqa5m8QMHJD2O2qrKh3qW9M3tIoqOoDcfNR1qdIDVl6VUtI5PqNXzzEesnLowA1G8+Ac3AqW6APMteG4pcJjqG/xs+Mww8gIjKT8Sg//ATY9ngthzLB4ItbGh/2FZNMFTTULg+mAqsRpT7jYNA2v81I8SwVjOMOBO7xAnqaisxT8JWy7DXsHgU9Z2qhnpn9yqoFA5JBM7acGIOQAk86E/dJ719E+uWczdggDR5g1EuRauaPz7t/JFqTSdCTm1cxp7DufzjYHCDBI/uuE21ywNfPCow9n4l/pw6Lan+u7jPk4NzKkVdRPflZQA2+R6AwH9A9OjCEkgRRO/MZLNMAStNYO3cdVdrkLU0DsV5ILB03PPmLQbciOFR49eyxKMHzaul9RR04ZQbW+gvhMcOpMGzKn/beCvYfcDoJT43WelO9APQI8xlpAblO6nHwUDFmgPVT5I6wqI5suJ/rO3kxEGGdwTUS/tiZSmsBa279lDhi3QpEVcCgOtAIoXdRoV8SolDzDhwhlLxcPysOg0BGnrfyY62uVBjfdL3aRcCtFOsHLUXhMCdcB5EX6VlOIHy0wmWq5FxmURn341x9bfrVDsNQRnG9DCSbdQ9lk4gn1sXGxlHe/TCjmQRxfnJBStMkkcXXq2he6vL1ImlBHvHmwJlxoOSnXzBjBA4kVW4u7R9SZxVX1ZlstqE5fhYvKsI8aErXJVBYknlGqPFwMzWWKd6xe73ml04EICdiAlzPA8SOGtSNit9dY5Ea6oswejxuyXbOKkuglqnHr1624f9thfLpNDWvi4jSa2v3j5SyeRVsbu33cvuykLw2puLcuR5xq5PnxEyoKADrqkpNRP/kOyBc0QHMf4wZ+fUBxb+KRi6HkAiHCetUMHrhX4PudAjuYK4mEgPHkUQS3yIcydy+Itdk8Zq8sBccGKS9tE9/GvPTDBLBdETES0+adj7PbUsCUn4aQm4Magg1fY+OB8byE0zqZNfTlp1TpTy8/Xv6SnjlU+9hxF7XroJv3VCl6UIm5a9ntLY1qHDXoge4MwU9qLSKgQE0/0PUa+vHt8/0mK+4ZB4aT/Ui4cGb+Tv6TswsDbyXXPdWfZ9ekfEp6G9SmT9JQ2ty+bEd32yl4mpPaOf2itO//3QTMGH X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04f297e9-f8d3-4ffd-a56d-08dcaa45c115 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:35.1068 (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: QoBdwGjv5tkigENFfPwKb7W0t5ZoUA7HJBycy5Yin6CXH1lW+NdLnAABqhEBWE+D X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9919 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 remove unwanted descriptor list maintenance and channels overhead. Signed-off-by: Gagandeep Singh --- drivers/dma/dpaa/dpaa_qdma.c | 594 +++++++++++++---------------------- drivers/dma/dpaa/dpaa_qdma.h | 43 +-- 2 files changed, 221 insertions(+), 416 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index f1878879af..8e8426b88d 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -111,96 +111,6 @@ static void return virt_addr; } -static void -dma_pool_free(void *addr) -{ - rte_free(addr); -} - -static void -fsl_qdma_free_chan_resources(struct fsl_qdma_chan *fsl_chan) -{ - struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; - struct fsl_qdma_engine *fsl_qdma = fsl_chan->qdma; - struct fsl_qdma_comp *comp_temp, *_comp_temp; - int id; - - if (--fsl_queue->count) - goto finally; - - id = (fsl_qdma->block_base - fsl_queue->block_base) / - fsl_qdma->block_offset; - - while (rte_atomic32_read(&wait_task[id]) == 1) - rte_delay_us(QDMA_DELAY); - - list_for_each_entry_safe(comp_temp, _comp_temp, - &fsl_queue->comp_used, list) { - list_del(&comp_temp->list); - dma_pool_free(comp_temp->virt_addr); - dma_pool_free(comp_temp->desc_virt_addr); - rte_free(comp_temp); - } - - list_for_each_entry_safe(comp_temp, _comp_temp, - &fsl_queue->comp_free, list) { - list_del(&comp_temp->list); - dma_pool_free(comp_temp->virt_addr); - dma_pool_free(comp_temp->desc_virt_addr); - rte_free(comp_temp); - } - -finally: - fsl_qdma->desc_allocated--; -} - -static void -fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp, - dma_addr_t dst, dma_addr_t src, u32 len) -{ - struct fsl_qdma_format *csgf_src, *csgf_dest; -#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 - struct fsl_qdma_sdf *sdf; - u32 cfg = 0; -#endif - - /* Note: command table (fsl_comp->virt_addr) is getting filled - * directly in cmd descriptors of queues while enqueuing the descriptor - * please refer fsl_qdma_enqueue_desc - * frame list table (virt_addr) + 1) and source, - * destination descriptor table - * (fsl_comp->desc_virt_addr and fsl_comp->desc_virt_addr+1) move to - * the control path to fsl_qdma_pre_request_enqueue_comp_sd_desc - */ - csgf_src = (struct fsl_qdma_format *)fsl_comp->virt_addr + 2; - csgf_dest = (struct fsl_qdma_format *)fsl_comp->virt_addr + 3; - -#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 - sdf = (struct fsl_qdma_sdf *)fsl_comp->desc_virt_addr; - sdf->cmd = rte_cpu_to_le_32(FSL_QDMA_CMD_RWTTYPE << - FSL_QDMA_CMD_RWTTYPE_OFFSET); -#ifdef RTE_DMA_DPAA_ERRATA_ERR050265 - sdf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_PF); -#endif - if (len > FSL_QDMA_CMD_SSS_DISTANCE) { - sdf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_SSEN); - cfg |= rte_cpu_to_le_32(FSL_QDMA_CMD_SSS_STRIDE << - FSL_QDMA_CFG_SSS_OFFSET | - FSL_QDMA_CMD_SSS_DISTANCE); - sdf->cfg = cfg; - } else - sdf->cfg = 0; -#endif - - /* Status notification is enqueued to status queue. */ - qdma_desc_addr_set64(csgf_src, src); - qdma_csgf_set_len(csgf_src, len); - qdma_desc_addr_set64(csgf_dest, dst); - qdma_csgf_set_len(csgf_dest, len); - /* This entry is the last entry. */ - qdma_csgf_set_f(csgf_dest, len); -} - /* * Pre-request command descriptor and compound S/G for enqueue. */ @@ -209,42 +119,41 @@ fsl_qdma_pre_request_enqueue_comp_sd_desc( struct fsl_qdma_queue *queue, int size, int aligned) { - struct fsl_qdma_comp *comp_temp, *_comp_temp; struct fsl_qdma_sdf *sdf; struct fsl_qdma_ddf *ddf; struct fsl_qdma_format *csgf_desc; - int i; - - for (i = 0; i < (int)(queue->n_cq + COMMAND_QUEUE_OVERFLOW); i++) { - comp_temp = rte_zmalloc("qdma: comp temp", - sizeof(*comp_temp), 0); - if (!comp_temp) - return -ENOMEM; - - comp_temp->virt_addr = - dma_pool_alloc(size, aligned, &comp_temp->bus_addr); - if (!comp_temp->virt_addr) { - rte_free(comp_temp); + struct fsl_qdma_format *ccdf; + int i, j; + struct fsl_qdma_format *head; + + head = queue->virt_head; + + for (i = 0; i < (int)(queue->n_cq); i++) { + dma_addr_t bus_addr = 0, desc_bus_addr = 0; + + queue->virt_addr[i] = + dma_pool_alloc(size, aligned, &bus_addr); + if (!queue->virt_addr[i]) goto fail; - } - comp_temp->desc_virt_addr = - dma_pool_alloc(size, aligned, &comp_temp->desc_bus_addr); - if (!comp_temp->desc_virt_addr) { - rte_free(comp_temp->virt_addr); - rte_free(comp_temp); + queue->desc_virt_addr[i] = + dma_pool_alloc(size, aligned, &desc_bus_addr); + if (!queue->desc_virt_addr[i]) { + rte_free(queue->virt_addr[i]); goto fail; } - memset(comp_temp->virt_addr, 0, FSL_QDMA_COMMAND_BUFFER_SIZE); - memset(comp_temp->desc_virt_addr, 0, + memset(queue->virt_addr[i], 0, FSL_QDMA_COMMAND_BUFFER_SIZE); + memset(queue->desc_virt_addr[i], 0, FSL_QDMA_DESCRIPTOR_BUFFER_SIZE); - csgf_desc = (struct fsl_qdma_format *)comp_temp->virt_addr + 1; - sdf = (struct fsl_qdma_sdf *)comp_temp->desc_virt_addr; - ddf = (struct fsl_qdma_ddf *)comp_temp->desc_virt_addr + 1; + csgf_desc = (struct fsl_qdma_format *)queue->virt_addr[i] + + QDMA_DESC_OFF; + sdf = (struct fsl_qdma_sdf *)queue->desc_virt_addr[i]; + ddf = (struct fsl_qdma_ddf *)sdf + QDMA_DESC_OFF; /* Compound Command Descriptor(Frame List Table) */ - qdma_desc_addr_set64(csgf_desc, comp_temp->desc_bus_addr); + qdma_desc_addr_set64(csgf_desc, desc_bus_addr); + /* It must be 32 as Compound S/G Descriptor */ qdma_csgf_set_len(csgf_desc, 32); /* Descriptor Buffer */ @@ -258,106 +167,84 @@ fsl_qdma_pre_request_enqueue_comp_sd_desc( ddf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET); - list_add_tail(&comp_temp->list, &queue->comp_free); + ccdf = (struct fsl_qdma_format *)queue->virt_head; + qdma_desc_addr_set64(ccdf, bus_addr + 16); + qdma_ccdf_set_format(ccdf, qdma_ccdf_get_offset(queue->virt_addr[i])); + qdma_ccdf_set_ser(ccdf, qdma_ccdf_get_status(queue->virt_addr[i])); + queue->virt_head++; } + queue->virt_head = head; + queue->ci = 0; return 0; fail: - list_for_each_entry_safe(comp_temp, _comp_temp, - &queue->comp_free, list) { - list_del(&comp_temp->list); - rte_free(comp_temp->virt_addr); - rte_free(comp_temp->desc_virt_addr); - rte_free(comp_temp); + for (j = 0; j < i; j++) { + rte_free(queue->virt_addr[j]); + rte_free(queue->desc_virt_addr[j]); } return -ENOMEM; } -/* - * Request a command descriptor for enqueue. - */ -static struct fsl_qdma_comp * -fsl_qdma_request_enqueue_desc(struct fsl_qdma_chan *fsl_chan) +static struct fsl_qdma_queue +*fsl_qdma_alloc_queue_resources(struct fsl_qdma_engine *fsl_qdma, int k, int b) { - struct fsl_qdma_queue *queue = fsl_chan->queue; - struct fsl_qdma_comp *comp_temp; - - if (!list_empty(&queue->comp_free)) { - comp_temp = list_first_entry(&queue->comp_free, - struct fsl_qdma_comp, - list); - list_del(&comp_temp->list); - return comp_temp; + struct fsl_qdma_queue *queue_temp; + + queue_temp = rte_zmalloc("qdma: queue head", sizeof(*queue_temp), 0); + if (!queue_temp) { + printf("no memory to allocate queues\n"); + return NULL; } - return NULL; -} + queue_temp->cq = + dma_pool_alloc(sizeof(struct fsl_qdma_format) * + QDMA_QUEUE_SIZE, + sizeof(struct fsl_qdma_format) * + QDMA_QUEUE_SIZE, &queue_temp->bus_addr); -static struct fsl_qdma_queue -*fsl_qdma_alloc_queue_resources(struct fsl_qdma_engine *fsl_qdma) -{ - struct fsl_qdma_queue *queue_head, *queue_temp; - int len, i, j; - int queue_num; - int blocks; - unsigned int queue_size[FSL_QDMA_QUEUE_MAX]; - - queue_num = fsl_qdma->n_queues; - blocks = fsl_qdma->num_blocks; - - len = sizeof(*queue_head) * queue_num * blocks; - queue_head = rte_zmalloc("qdma: queue head", len, 0); - if (!queue_head) + if (!queue_temp->cq) { + rte_free(queue_temp); return NULL; - - for (i = 0; i < FSL_QDMA_QUEUE_MAX; i++) - queue_size[i] = QDMA_QUEUE_SIZE; - - for (j = 0; j < blocks; j++) { - for (i = 0; i < queue_num; i++) { - if (queue_size[i] > FSL_QDMA_CIRCULAR_DESC_SIZE_MAX || - queue_size[i] < FSL_QDMA_CIRCULAR_DESC_SIZE_MIN) { - DPAA_QDMA_ERR("Get wrong queue-sizes.\n"); - goto fail; - } - queue_temp = queue_head + i + (j * queue_num); - - queue_temp->cq = - dma_pool_alloc(sizeof(struct fsl_qdma_format) * - queue_size[i], - sizeof(struct fsl_qdma_format) * - queue_size[i], &queue_temp->bus_addr); - - if (!queue_temp->cq) - goto fail; - - memset(queue_temp->cq, 0x0, queue_size[i] * - sizeof(struct fsl_qdma_format)); - - queue_temp->block_base = fsl_qdma->block_base + - FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, j); - queue_temp->n_cq = queue_size[i]; - queue_temp->id = i; - queue_temp->count = 0; - queue_temp->pending = 0; - queue_temp->virt_head = queue_temp->cq; - queue_temp->stats = (struct rte_dma_stats){0}; - } } - return queue_head; -fail: - for (j = 0; j < blocks; j++) { - for (i = 0; i < queue_num; i++) { - queue_temp = queue_head + i + (j * queue_num); - dma_pool_free(queue_temp->cq); - } + memset(queue_temp->cq, 0x0, QDMA_QUEUE_SIZE * + sizeof(struct fsl_qdma_format)); + + queue_temp->queue_base = fsl_qdma->block_base + + FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, b); + queue_temp->n_cq = QDMA_QUEUE_SIZE; + queue_temp->id = k; + queue_temp->pending = 0; + queue_temp->virt_head = queue_temp->cq; + queue_temp->virt_addr = rte_malloc("queue virt addr", + sizeof(void *) * QDMA_QUEUE_SIZE, 0); + if (!queue_temp->virt_addr) { + rte_free(queue_temp->cq); + rte_free(queue_temp); + return NULL; } - rte_free(queue_head); + queue_temp->desc_virt_addr = rte_malloc("queue desc virt addr", + sizeof(void *) * QDMA_QUEUE_SIZE, 0); + if (!queue_temp->desc_virt_addr) { + rte_free(queue_temp->virt_addr); + rte_free(queue_temp->cq); + rte_free(queue_temp); + return NULL; + } + queue_temp->stats = (struct rte_dma_stats){0}; + + return queue_temp; +} - return NULL; +static void +fsl_qdma_free_queue_resources(struct fsl_qdma_queue *queue) +{ + rte_free(queue->desc_virt_addr); + rte_free(queue->virt_addr); + rte_free(queue->cq); + rte_free(queue); } static struct @@ -367,11 +254,6 @@ fsl_qdma_queue *fsl_qdma_prep_status_queue(void) unsigned int status_size; status_size = QDMA_STATUS_SIZE; - if (status_size > FSL_QDMA_CIRCULAR_DESC_SIZE_MAX || - status_size < FSL_QDMA_CIRCULAR_DESC_SIZE_MIN) { - DPAA_QDMA_ERR("Get wrong status_size.\n"); - return NULL; - } status_head = rte_zmalloc("qdma: status head", sizeof(*status_head), 0); if (!status_head) @@ -399,6 +281,13 @@ fsl_qdma_queue *fsl_qdma_prep_status_queue(void) return status_head; } +static void +fsl_qdma_free_status_queue(struct fsl_qdma_queue *status) +{ + rte_free(status->cq); + rte_free(status); +} + static int fsl_qdma_halt(struct fsl_qdma_engine *fsl_qdma) { @@ -449,12 +338,9 @@ fsl_qdma_queue_transfer_complete(struct fsl_qdma_engine *fsl_qdma, void *block, int id, const uint16_t nb_cpls, enum rte_dma_status_code *status) { - struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue; struct fsl_qdma_queue *fsl_status = fsl_qdma->status[id]; - struct fsl_qdma_queue *temp_queue; struct fsl_qdma_format *status_addr; - struct fsl_qdma_comp *fsl_comp = NULL; - u32 reg, i; + u32 reg; int count = 0; while (count < nb_cpls) { @@ -464,14 +350,6 @@ fsl_qdma_queue_transfer_complete(struct fsl_qdma_engine *fsl_qdma, status_addr = fsl_status->virt_head; - i = qdma_ccdf_get_queue(status_addr) + - id * fsl_qdma->n_queues; - temp_queue = fsl_queue + i; - fsl_comp = list_first_entry(&temp_queue->comp_used, - struct fsl_qdma_comp, - list); - list_del(&fsl_comp->list); - reg = qdma_readl_be(block + FSL_QDMA_BSQMR); reg |= FSL_QDMA_BSQMR_DI_BE; @@ -483,7 +361,6 @@ fsl_qdma_queue_transfer_complete(struct fsl_qdma_engine *fsl_qdma, if (status != NULL) status[count] = RTE_DMA_STATUS_SUCCESSFUL; - list_add_tail(&fsl_comp->list, &temp_queue->comp_free); count++; } @@ -493,7 +370,6 @@ fsl_qdma_queue_transfer_complete(struct fsl_qdma_engine *fsl_qdma, static int fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) { - struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue; struct fsl_qdma_queue *temp; void *ctrl = fsl_qdma->ctrl_base; void *block; @@ -508,11 +384,13 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) return ret; } + int k = 0; for (j = 0; j < fsl_qdma->num_blocks; j++) { block = fsl_qdma->block_base + FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, j); - for (i = 0; i < fsl_qdma->n_queues; i++) { - temp = fsl_queue + i + (j * fsl_qdma->n_queues); + k = 0; + for (i = (j * QDMA_QUEUES); i < ((j * QDMA_QUEUES) + QDMA_QUEUES); i++) { + temp = fsl_qdma->queue[i]; /* * Initialize Command Queue registers to * point to the first @@ -522,19 +400,20 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) */ qdma_writel(lower_32_bits(temp->bus_addr), - block + FSL_QDMA_BCQDPA_SADDR(i)); + block + FSL_QDMA_BCQDPA_SADDR(k)); qdma_writel(upper_32_bits(temp->bus_addr), - block + FSL_QDMA_BCQEDPA_SADDR(i)); + block + FSL_QDMA_BCQEDPA_SADDR(k)); qdma_writel(lower_32_bits(temp->bus_addr), - block + FSL_QDMA_BCQEPA_SADDR(i)); + block + FSL_QDMA_BCQEPA_SADDR(k)); qdma_writel(upper_32_bits(temp->bus_addr), - block + FSL_QDMA_BCQEEPA_SADDR(i)); + block + FSL_QDMA_BCQEEPA_SADDR(k)); /* Initialize the queue mode. */ reg = FSL_QDMA_BCQMR_EN; reg |= FSL_QDMA_BCQMR_CD_THLD(ilog2(temp->n_cq) - 4); reg |= FSL_QDMA_BCQMR_CQ_SIZE(ilog2(temp->n_cq) - 6); - qdma_writel(reg, block + FSL_QDMA_BCQMR(i)); + qdma_writel(reg, block + FSL_QDMA_BCQMR(k)); + k++; } /* @@ -585,36 +464,19 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) return 0; } -static void * -fsl_qdma_prep_memcpy(void *fsl_chan, dma_addr_t dst, - dma_addr_t src, size_t len, - void *call_back, - void *param) -{ - struct fsl_qdma_comp *fsl_comp; - - fsl_comp = - fsl_qdma_request_enqueue_desc((struct fsl_qdma_chan *)fsl_chan); - if (!fsl_comp) - return NULL; - - fsl_comp->qchan = fsl_chan; - fsl_comp->call_back_func = call_back; - fsl_comp->params = param; - - fsl_qdma_comp_fill_memcpy(fsl_comp, dst, src, len); - return (void *)fsl_comp; -} static int -fsl_qdma_enqueue_desc(struct fsl_qdma_chan *fsl_chan, - struct fsl_qdma_comp *fsl_comp, - uint64_t flags) +fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue, + uint64_t flags, dma_addr_t dst, + dma_addr_t src, size_t len) { - struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; - void *block = fsl_queue->block_base; - struct fsl_qdma_format *ccdf; + void *block = fsl_queue->queue_base; + struct fsl_qdma_format *csgf_src, *csgf_dest; u32 reg; +#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 + struct fsl_qdma_sdf *sdf; + u32 cfg = 0; +#endif /* retrieve and store the register value in big endian * to avoid bits swap @@ -624,17 +486,40 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_chan *fsl_chan, if (reg & (FSL_QDMA_BCQSR_QF_XOFF_BE)) return -1; - /* filling descriptor command table */ - ccdf = (struct fsl_qdma_format *)fsl_queue->virt_head; - qdma_desc_addr_set64(ccdf, fsl_comp->bus_addr + 16); - qdma_ccdf_set_format(ccdf, qdma_ccdf_get_offset(fsl_comp->virt_addr)); - qdma_ccdf_set_ser(ccdf, qdma_ccdf_get_status(fsl_comp->virt_addr)); + csgf_src = (struct fsl_qdma_format *)fsl_queue->virt_addr[fsl_queue->ci] + + QDMA_SGF_SRC_OFF; + csgf_dest = (struct fsl_qdma_format *)fsl_queue->virt_addr[fsl_queue->ci] + + QDMA_SGF_DST_OFF; +#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 + sdf = (struct fsl_qdma_sdf *)fsl_queue->desc_virt_addr[fsl_queue->ci]; + sdf->cmd = rte_cpu_to_le_32(FSL_QDMA_CMD_RWTTYPE << + FSL_QDMA_CMD_RWTTYPE_OFFSET); +#ifdef RTE_DMA_DPAA_ERRATA_ERR050265 + sdf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_PF); +#endif + if (len > FSL_QDMA_CMD_SSS_DISTANCE) { + sdf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_SSEN); + cfg |= rte_cpu_to_le_32(FSL_QDMA_CMD_SSS_STRIDE << + FSL_QDMA_CFG_SSS_OFFSET | + FSL_QDMA_CMD_SSS_DISTANCE); + sdf->cfg = cfg; + } else + sdf->cfg = 0; +#endif + qdma_desc_addr_set64(csgf_src, src); + qdma_csgf_set_len(csgf_src, len); + qdma_desc_addr_set64(csgf_dest, dst); + qdma_csgf_set_len(csgf_dest, len); + /* This entry is the last entry. */ + qdma_csgf_set_f(csgf_dest, len); fsl_queue->virt_head++; + fsl_queue->ci++; - if (fsl_queue->virt_head == fsl_queue->cq + fsl_queue->n_cq) + if (fsl_queue->virt_head == fsl_queue->cq + fsl_queue->n_cq) { fsl_queue->virt_head = fsl_queue->cq; + fsl_queue->ci = 0; + } - list_add_tail(&fsl_comp->list, &fsl_queue->comp_used); if (flags & RTE_DMA_OP_FLAG_SUBMIT) { reg = qdma_readl_be(block + FSL_QDMA_BCQMR(fsl_queue->id)); @@ -647,34 +532,6 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_chan *fsl_chan, return 0; } -static int -fsl_qdma_alloc_chan_resources(struct fsl_qdma_chan *fsl_chan) -{ - struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; - struct fsl_qdma_engine *fsl_qdma = fsl_chan->qdma; - int ret; - - if (fsl_queue->count++) - goto finally; - - INIT_LIST_HEAD(&fsl_queue->comp_free); - INIT_LIST_HEAD(&fsl_queue->comp_used); - - ret = fsl_qdma_pre_request_enqueue_comp_sd_desc(fsl_queue, - FSL_QDMA_COMMAND_BUFFER_SIZE, 64); - if (ret) { - DPAA_QDMA_ERR( - "failed to alloc dma buffer for comp descriptor\n"); - goto exit; - } - -finally: - fsl_qdma->desc_allocated++; - return 0; -exit: - return -ENOMEM; -} - static int dpaa_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_info, uint32_t info_sz) @@ -701,35 +558,26 @@ dpaa_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_info, static int dpaa_get_channel(struct fsl_qdma_engine *fsl_qdma, uint16_t vchan) { - u32 i, start, end; + u32 i; int ret; + struct fsl_qdma_queue *fsl_queue; - start = fsl_qdma->free_block_id * QDMA_QUEUES; - fsl_qdma->free_block_id++; - - end = start + 1; - for (i = start; i < end; i++) { - struct fsl_qdma_chan *fsl_chan = &fsl_qdma->chans[i]; - - if (fsl_chan->free) { - fsl_chan->free = false; - ret = fsl_qdma_alloc_chan_resources(fsl_chan); - if (ret) - return ret; - - fsl_qdma->vchan_map[vchan] = i; - return 0; - } + if (fsl_qdma->free_block_id == QDMA_BLOCKS) { + DPAA_QDMA_ERR("Maximum 4 queues can be configured\n"); + return -1; } - return -1; -} + i = fsl_qdma->free_block_id * QDMA_QUEUES; -static void -dma_release(void *fsl_chan) -{ - ((struct fsl_qdma_chan *)fsl_chan)->free = true; - fsl_qdma_free_chan_resources((struct fsl_qdma_chan *)fsl_chan); + fsl_queue = fsl_qdma->queue[i]; + ret = fsl_qdma_pre_request_enqueue_comp_sd_desc(fsl_queue, + FSL_QDMA_COMMAND_BUFFER_SIZE, 64); + if (ret) + return ret; + + fsl_qdma->vchan_map[vchan] = i; + fsl_qdma->free_block_id++; + return 0; } static int @@ -767,10 +615,9 @@ static int dpaa_qdma_submit(void *dev_private, uint16_t vchan) { struct fsl_qdma_engine *fsl_qdma = (struct fsl_qdma_engine *)dev_private; - struct fsl_qdma_chan *fsl_chan = - &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; - struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; - void *block = fsl_queue->block_base; + struct fsl_qdma_queue *fsl_queue = + fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; + void *block = fsl_queue->queue_base; u32 reg; while (fsl_queue->pending) { @@ -790,22 +637,13 @@ dpaa_qdma_enqueue(void *dev_private, uint16_t vchan, uint32_t length, uint64_t flags) { struct fsl_qdma_engine *fsl_qdma = (struct fsl_qdma_engine *)dev_private; - struct fsl_qdma_chan *fsl_chan = - &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; - struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; + struct fsl_qdma_queue *fsl_queue = + fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; int ret, idx; idx = (uint16_t)(fsl_queue->stats.submitted + fsl_queue->pending); - void *fsl_comp = NULL; - fsl_comp = fsl_qdma_prep_memcpy(fsl_chan, - (dma_addr_t)dst, (dma_addr_t)src, - length, NULL, NULL); - if (!fsl_comp) { - DPAA_QDMA_DP_DEBUG("fsl_comp is NULL\n"); - return -1; - } - ret = fsl_qdma_enqueue_desc(fsl_chan, fsl_comp, flags); + ret = fsl_qdma_enqueue_desc(fsl_queue, flags, (dma_addr_t)dst, (dma_addr_t)src, length); if (ret < 0) return ret; @@ -822,9 +660,8 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, void *block; int intr; void *status = fsl_qdma->status_base; - struct fsl_qdma_chan *fsl_chan = - &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; - struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; + struct fsl_qdma_queue *fsl_queue = + fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; intr = qdma_readl_be(status + FSL_QDMA_DEDR); if (intr) { @@ -870,9 +707,8 @@ dpaa_qdma_dequeue(void *dev_private, void *block; int intr; void *status = fsl_qdma->status_base; - struct fsl_qdma_chan *fsl_chan = - &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; - struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; + struct fsl_qdma_queue *fsl_queue = + fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; intr = qdma_readl_be(status + FSL_QDMA_DEDR); if (intr) { @@ -912,9 +748,8 @@ dpaa_qdma_stats_get(const struct rte_dma_dev *dmadev, uint16_t vchan, struct rte_dma_stats *rte_stats, uint32_t size) { struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; - struct fsl_qdma_chan *fsl_chan = - &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; - struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; + struct fsl_qdma_queue *fsl_queue = + fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; struct rte_dma_stats *stats = &fsl_queue->stats; if (size < sizeof(rte_stats)) @@ -931,9 +766,8 @@ static int dpaa_qdma_stats_reset(struct rte_dma_dev *dmadev, uint16_t vchan) { struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; - struct fsl_qdma_chan *fsl_chan = - &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; - struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; + struct fsl_qdma_queue *fsl_queue = + fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; fsl_queue->stats = (struct rte_dma_stats){0}; @@ -944,9 +778,8 @@ static uint16_t dpaa_qdma_burst_capacity(const void *dev_private, uint16_t vchan) { const struct fsl_qdma_engine *fsl_qdma = dev_private; - struct fsl_qdma_chan *fsl_chan = - &fsl_qdma->chans[fsl_qdma->vchan_map[vchan]]; - struct fsl_qdma_queue *fsl_queue = fsl_chan->queue; + struct fsl_qdma_queue *fsl_queue = + fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; return fsl_queue->n_cq - fsl_queue->pending; } @@ -965,43 +798,21 @@ static int dpaa_qdma_init(struct rte_dma_dev *dmadev) { struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; - struct fsl_qdma_chan *fsl_chan; uint64_t phys_addr; - unsigned int len; int ccsr_qdma_fd; int regs_size; int ret; - u32 i; + u32 i, k = 0; + int j; - fsl_qdma->desc_allocated = 0; - fsl_qdma->n_chans = VIRT_CHANNELS; - fsl_qdma->n_queues = QDMA_QUEUES; + fsl_qdma->n_queues = QDMA_QUEUES * QDMA_BLOCKS; fsl_qdma->num_blocks = QDMA_BLOCKS; fsl_qdma->block_offset = QDMA_BLOCK_OFFSET; - len = sizeof(*fsl_chan) * fsl_qdma->n_chans; - fsl_qdma->chans = rte_zmalloc("qdma: fsl chans", len, 0); - if (!fsl_qdma->chans) - return -1; - - len = sizeof(struct fsl_qdma_queue *) * fsl_qdma->num_blocks; - fsl_qdma->status = rte_zmalloc("qdma: fsl status", len, 0); - if (!fsl_qdma->status) { - rte_free(fsl_qdma->chans); - return -1; - } - - for (i = 0; i < fsl_qdma->num_blocks; i++) { - rte_atomic32_init(&wait_task[i]); - fsl_qdma->status[i] = fsl_qdma_prep_status_queue(); - if (!fsl_qdma->status[i]) - goto err; - } - ccsr_qdma_fd = open("/dev/mem", O_RDWR); if (unlikely(ccsr_qdma_fd < 0)) { DPAA_QDMA_ERR("Can not open /dev/mem for qdma CCSR map"); - goto err; + return -1; } regs_size = fsl_qdma->block_offset * (fsl_qdma->num_blocks + 2); @@ -1014,39 +825,55 @@ dpaa_qdma_init(struct rte_dma_dev *dmadev) if (fsl_qdma->ctrl_base == MAP_FAILED) { DPAA_QDMA_ERR("Can not map CCSR base qdma: Phys: %08" PRIx64 "size %d\n", phys_addr, regs_size); - goto err; + return -1; } fsl_qdma->status_base = fsl_qdma->ctrl_base + QDMA_BLOCK_OFFSET; fsl_qdma->block_base = fsl_qdma->status_base + QDMA_BLOCK_OFFSET; - fsl_qdma->queue = fsl_qdma_alloc_queue_resources(fsl_qdma); + fsl_qdma->status = rte_malloc("status queue", sizeof(struct fsl_qdma_queue) * 4, 0); + if (!fsl_qdma->status) + goto err; + + fsl_qdma->queue = rte_malloc("cmd queue", sizeof(struct fsl_qdma_queue) * 32, 0); if (!fsl_qdma->queue) { - munmap(fsl_qdma->ctrl_base, regs_size); + rte_free(fsl_qdma->status); goto err; } - for (i = 0; i < fsl_qdma->n_chans; i++) { - struct fsl_qdma_chan *fsl_chan = &fsl_qdma->chans[i]; + for (i = 0; i < fsl_qdma->num_blocks; i++) { + fsl_qdma->status[i] = fsl_qdma_prep_status_queue(); + if (!fsl_qdma->status[i]) + goto mem_free; + j = 0; + for (k = (i * QDMA_QUEUES); k < ((i * QDMA_QUEUES) + QDMA_QUEUES); k++) { + fsl_qdma->queue[k] = fsl_qdma_alloc_queue_resources(fsl_qdma, j, i); + if (!fsl_qdma->queue[k]) + goto mem_free; + j++; + } - fsl_chan->qdma = fsl_qdma; - fsl_chan->queue = fsl_qdma->queue + i % (fsl_qdma->n_queues * - fsl_qdma->num_blocks); - fsl_chan->free = true; } ret = fsl_qdma_reg_init(fsl_qdma); if (ret) { DPAA_QDMA_ERR("Can't Initialize the qDMA engine.\n"); - munmap(fsl_qdma->ctrl_base, regs_size); - goto err; + rte_free(fsl_qdma->status); + goto mem_free; } return 0; -err: - rte_free(fsl_qdma->chans); +mem_free: + for (i = 0; i < fsl_qdma->num_blocks; i++) { + for (k = (i * QDMA_QUEUES); k < ((i * QDMA_QUEUES) + QDMA_QUEUES); k++) + fsl_qdma_free_queue_resources(fsl_qdma->queue[k]); + fsl_qdma_free_status_queue(fsl_qdma->status[i]); + } rte_free(fsl_qdma->status); +err: + rte_free(fsl_qdma->queue); + munmap(fsl_qdma->ctrl_base, regs_size); return -1; } @@ -1092,17 +919,16 @@ dpaa_qdma_remove(struct rte_dpaa_device *dpaa_dev) { struct rte_dma_dev *dmadev = dpaa_dev->dmadev; struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; - int i = 0, max = QDMA_QUEUES * QDMA_BLOCKS; + uint32_t i, k; - for (i = 0; i < max; i++) { - struct fsl_qdma_chan *fsl_chan = &fsl_qdma->chans[i]; - - if (fsl_chan->free == false) - dma_release(fsl_chan); + for (i = 0; i < fsl_qdma->num_blocks; i++) { + for (k = (i * QDMA_QUEUES); k < ((i * QDMA_QUEUES) + QDMA_QUEUES); k++) + fsl_qdma_free_queue_resources(fsl_qdma->queue[k]); + fsl_qdma_free_status_queue(fsl_qdma->status[i]); } + rte_free(fsl_qdma->queue); rte_free(fsl_qdma->status); - rte_free(fsl_qdma->chans); (void)rte_dma_pmd_release(dpaa_dev->device.name); diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 8cb4042bd0..80366ce890 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -107,6 +107,9 @@ #define QDMA_BLOCKS 4 #define QDMA_QUEUES 8 #define QDMA_DELAY 1000 +#define QDMA_SGF_SRC_OFF 2 +#define QDMA_SGF_DST_OFF 3 +#define QDMA_DESC_OFF 1 #define QDMA_BIG_ENDIAN 1 #ifdef QDMA_BIG_ENDIAN @@ -157,55 +160,31 @@ struct fsl_qdma_ddf { __le32 cmd; }; -struct fsl_qdma_chan { - struct fsl_qdma_engine *qdma; - struct fsl_qdma_queue *queue; - bool free; - struct list_head list; -}; - struct fsl_qdma_queue { struct fsl_qdma_format *virt_head; - struct list_head comp_used; - struct list_head comp_free; - dma_addr_t bus_addr; - u32 n_cq; - u32 id; - u32 count; - u32 pending; + void **virt_addr; + u8 ci; + u8 n_cq; + u8 id; + void *queue_base; struct fsl_qdma_format *cq; - void *block_base; struct rte_dma_stats stats; -}; - -struct fsl_qdma_comp { + u8 pending; dma_addr_t bus_addr; - dma_addr_t desc_bus_addr; - void *virt_addr; - void *desc_virt_addr; - struct fsl_qdma_chan *qchan; - dma_call_back call_back_func; - void *params; - struct list_head list; + void **desc_virt_addr; }; struct fsl_qdma_engine { - int desc_allocated; void *ctrl_base; void *status_base; void *block_base; - u32 n_chans; u32 n_queues; - int error_irq; - struct fsl_qdma_queue *queue; + struct fsl_qdma_queue **queue; struct fsl_qdma_queue **status; - struct fsl_qdma_chan *chans; u32 num_blocks; u8 free_block_id; u32 vchan_map[4]; int block_offset; }; -static rte_atomic32_t wait_task[CORE_NUMBER]; - #endif /* _DPAA_QDMA_H_ */ From patchwork Mon Jul 22 11:58:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142609 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BCEBD45681; Mon, 22 Jul 2024 14:03:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9FB5240B95; Mon, 22 Jul 2024 14:00:31 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013057.outbound.protection.outlook.com [52.101.67.57]) by mails.dpdk.org (Postfix) with ESMTP id 51A324029F for ; Mon, 22 Jul 2024 14:00:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nZaGYaeOX6ddpwu+aeNlnAd89kEDDtE0xiOsr4+nU+aP0UZ2cBkAo9xVNaOh0+rn4a9cPxs2NiNEYyXKtrenm+5fSQplqFsz/OLtCMYASp/7cklnuQRqfsoOA3qsv3mMhapOAkZwza1FuufxX3iV5PwrHnxZtbJBiffW4ldxdtUL4bTGXotlokmbSm+35aY5Ii9sReieWZVuJT7C5n+ba1YIg1Is+UZc3i4I0WITaI4hBFHjQwYypob7/cbU5WHCD5gVZdCmWjWy8cixSiT4V4zvjlbVX2jaEcaClEqmQ6iyespR3Df3Auem6GH5vofKSaIFGG4HQCNNBsGgiKulfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Rqzyuk5Fbicw5Hl1uw2MoeRW223qHkDJa3BqN0M4WUM=; b=VsuOvoV9z8ar9BQLv3Eu05PiSluXry0VK65FQajD33b2K17AqGbdrZmGbW5sFY7HbI2dGLP/eBziv3lC+VZeblKCMl+7WIGKUajjfMnTtwom1NDpVQSFiPgXwS3NVRulNRnryItbwqYtVNH9J1nawRfBydO7Tu8/9Yr67uQG0jwZaDVsf2WC6sJB7JoA2sDWxsB577LMJ8JeCjFgLBqPvgIvB2/CXbXZPP7SiAhpFDnaOuk6nfXe3p/bzRfEwL725dzGIEljKEZCrn95i+zVVGpb+opZaeW87eQJmKrtKEbh8i5M6HzzPQim8UVmcEt9cpMYgBwUJjKyQsEk3gwSqg== 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=Rqzyuk5Fbicw5Hl1uw2MoeRW223qHkDJa3BqN0M4WUM=; b=ZF9xSgYW9e0FB3Q+24iLGcWA0eQm6ceD0KgFFtffxPgg2cGSaIEE2/N2NE9kl96INonio8mvSnJHlXHS2R09KEFtjopKIRWrgv2r56crsLkWyWXyQFfMULpe1Yk0nsgkPaV7CGqt523K1kqzjijTLgjbp3ihoT1ehOuMBI0lBUw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by DUZPR04MB9919.eurprd04.prod.outlook.com (2603:10a6:10:4d9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.14; Mon, 22 Jul 2024 11:59:36 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:36 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Subject: [v2 19/30] dma/dpaa: data path optimization Date: Mon, 22 Jul 2024 17:28:32 +0530 Message-Id: <20240722115843.1830105-20-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9919:EE_ X-MS-Office365-Filtering-Correlation-Id: 172c656b-2719-4c39-9e5e-08dcaa45c205 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: FYEDNNuSKS2j7zEjP0XE7dp8FBXlTKZj/Ep4RvsSqMyspzc+o6PC/iHejRGo1ToFf5XuO4DNEH2i2Yg8N/PgysqtJGGXoWc510qtjEOpe5I1zGYIkgGBFGhktx+AQiWsVC6Ya7YXMUbGHwI3TWiVVauqMAAANIYbRELD6iIpdI2WaV6CmMW2dNsNW55stEeH9mgU7YWDPgVqT4XSXOs+vie1uRWegDn5wW2zhnCo9d8ediY8+yaRAJVi8un6NX/BTwhG+nNcjBV8CngSgaWHmtN6RbdJ+CfHCyTphhBIEIhTqhvlRgiUu2Qr/MtDzkTkRjW+pa57em5iCW1FX+wMxRyRsK4sw9AYXU9zc2lkh7gw+C3sac1ezsEM4Q/v/hD8zeZ7y2DlbFnE4vndzMv6Cr7ZAfcukVl17VZD6N1uoXIw17/bzcXJhXYk/FYIyu5nTsrIBKXk8abg+d0roUHf/jWPT79G9HiyabXbtaQxrxUw9WOnY7Td6Ocvtnd5bEI4WXNmn/iw6SKqNMNi7kQAHma2QGbA/e0D5zxRa3c5iqi8LTQbLDgPMH9AbiKkuq3E9ZVMzJVMLSfYe/lWmviCor7O94yKtWajty959+qrLhYdS19S0dvCD8ul8dcCf0McYiMPQA9FBm92C0sUP4q7X3OzLCTjs3EkYngayl/6jeNJudkFxYflmj3aVjxM+Nrhl6D8nMUqAASd18u4bYG4cpcZEKIL++8UdY+aO09zCRp/JZ/q2MVAJaNIxuNA+0dUbrgPtmav9nCpZylPg1nnrjzxkRpeZlZklnyoPF09cSiZCkzqm4YAJ/PlaAlaL51ZsfaLXintxZV5C5Uz2rDlJsHOJegxzmK1gm4zKEyqiDzxruSwCWIFb97xaJrN4rD7fSRxkwzuXhPm8SbECf1pj6wlNF8LThiopwOROBxnrGfQzRaMzZ0GF/Vh6rn2jVZRpIkAy9DRgtoBrtORZeQ5jGxWswh2nJJHGxFdGij0n0oXPJhhT9NKIARqa4JmNMwCR3w9gRjC7n7PzaSF7qnJ/8XjMLuoqpW23sQSg/4OZ68n0KTf2xtQVE/zWKlyT8jJOc5OvpJhccv9cHYcAhCOl+COgbzZHaEzATSb21EzrjqYxvhCr0kAAqGXHEvsySjLokQ4eFf+mWJqoPvRluN9Gg418c9zFZwlqCUXym3wKgEDf5C2OKRaHbPaManPxx3wz1+m51M47IeMU6dDhAKKKpXqecjbOR6GQgv4gPE9CzXskm4eDjErxwcg2FxZGwsOrIHUsGovAqfso7txdOG4ntBoFbGd+G/1l8nL3cLAxeMiDSUFgWbBdhTihYTDjKgurLyiJtGMXDtbrb8Bq1KhJQGGIKgGrHXOhwfS3v/QSQzm/GRND85Z+5lB8f1HiWPtC8yhpbi29XNJ0oTJdlourg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: g4U9UWPcEaH+QZb4/Q80Sz+XuxgFBXcFfYVIQCFY9eIGnqdbcYAVQ2jJgPl7fxh2api13Kp2ufRQh1+LMLM4wj7C/NTVEWa4Cy63MjMj8PhrLewWRzwupN4y36cyco2K1VGCoeZTRp2Ljvq/fwENXXd+ROQ0wtbtNGDmUsfYqUHwucLUMH+Nb7ff7hUPvhrs54EgwNoKedkO//qTampeVWJdyT1NUYbIItkPMfJggQw/NhD2AtXx9Nst1GdBopxQIM7R26Ngt23YXlk125REJPHQuXXYeoSeWT2ilZGo57hCt/mTncVh4ipTj8n1J6+6O7yS5q7bRjqfjo9SN7LZn3eSQ0OAGEMHuC2EwtxXqrgRSjb/clmZDiVKd4WYtHX93fOdzEkKPXZVg0L5UlDjzdvBY3nqrAJvASNSsPYlznB0RoJfLArK8wnomxJWwvOPEw5yXwK/grSi65+6j7BxdR7OpqP7ps+QxEv3drvGfPRsIcXssTGNCyiWNgWmHAF27WBrEMa9dtB4nFo9Wpo87hocWcvQoIKFjm3iv5/mFOFvY50fApXIocANLaxriz0Ve4gHSiZLkzUui30169bDZPhFHc6gSGOi/SKJkmzuUQHoRWIxeZXE/QzbG2d02i74EsYB+1IsxjUxppjrnS7QBHqGRvGTk2tcnxsOpGxzZ/r1M78kewaVTPileAYHcdPLWJQLQmxlYFQCXUaZKUrRoD6mvfG7mpqJIoma/Otqptn2vvxtXV8c4PcZoRKlaDzK85prImSbyzLEXgKpI1ib7F7oLeZBBzcUFdBkiRy4f2OcviXzLOf+7P0sL83XKlbPZGFSzI75+JTQVFkt6IL1SZveD0T5EBU4FtyN18qF3eEfVohkNmQeF1Q9+QZm4KlEiYAcwxfUfQJN3MgDbreMp5eeeHjpqeYH0RUGcQepSbsFcaEY3+PVw56yUYA3l72dWJEv/OgqGmLSjghZ8urTZcZUOJsAqTuwNdDXHZROeweeH2DD2lVwYV0y9WTLfppzyM/bvJnvAO4ZkrwvDF6QzQmGcBOrRq2eLGGFUHVQOSHWCF0/MgGSx2rfANXqv7DVkF6H92+3oUV8YQdpbwWSfpkp50HY57v6O4hz2ChpvNrTza+gA+3QzmXxabPblu+m5tYH/iv9jpiZ3SHNArZmnhOppDXqKW5H8QfaPO7xgLubNc1vlCjbeTAtSayzaIbNdvvXhH6HZHBnXJWKr58hEuuhbsYkIA0UcLBdEYLzuiAD64UK5z7cIYj0ZJKziUQ/O+Gd2sbU3g0olSlbjjQ4qfW1iCtmf2/GKWyBfsFhZ8bOQ5tg1WNDd4QMt8P0u3NcY/Gcq2yN9MUits+ioL+Yy9TjXuOolfrVRXoaLxuhDV+O+fRLr4f/hYC22BuAZTLG2gi01rIH6RzTmBUBbsMvMk7CCWmh1ZAOgtbVoSMPQqHCgp69RJW6u0aZXmuUtMVWO/L0ABxV2ejElRRJGnOrcVISAAjihCb+O0Jk5nPp0fF7cg1aWNSiuOrzx9vm7pbq1F4A++936Co9P1YI4wen/yuuaMGRXrUKuMbT2rCygKOq0QNT53cJC1M+vLojuur2 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 172c656b-2719-4c39-9e5e-08dcaa45c205 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:36.6348 (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: fibF6MA/AAPRkU4Vfva/RTBgxSk+vKpciHHFyseIeDXOaqlDjCOOWgoa0d83M1CT X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9919 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 Remove unnessary status read before every send. Signed-off-by: Gagandeep Singh --- drivers/dma/dpaa/dpaa_qdma.c | 186 ++++++++++++++++++----------------- drivers/dma/dpaa/dpaa_qdma.h | 7 ++ 2 files changed, 101 insertions(+), 92 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 8e8426b88d..4022ad6469 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -248,7 +248,8 @@ fsl_qdma_free_queue_resources(struct fsl_qdma_queue *queue) } static struct -fsl_qdma_queue *fsl_qdma_prep_status_queue(void) +fsl_qdma_queue *fsl_qdma_prep_status_queue(struct fsl_qdma_engine *fsl_qdma, + u32 id) { struct fsl_qdma_queue *status_head; unsigned int status_size; @@ -277,6 +278,8 @@ fsl_qdma_queue *fsl_qdma_prep_status_queue(void) sizeof(struct fsl_qdma_format)); status_head->n_cq = status_size; status_head->virt_head = status_head->cq; + status_head->queue_base = fsl_qdma->block_base + + FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, id); return status_head; } @@ -334,12 +337,9 @@ fsl_qdma_halt(struct fsl_qdma_engine *fsl_qdma) } static int -fsl_qdma_queue_transfer_complete(struct fsl_qdma_engine *fsl_qdma, - void *block, int id, const uint16_t nb_cpls, +fsl_qdma_queue_transfer_complete(void *block, const uint16_t nb_cpls, enum rte_dma_status_code *status) { - struct fsl_qdma_queue *fsl_status = fsl_qdma->status[id]; - struct fsl_qdma_format *status_addr; u32 reg; int count = 0; @@ -348,16 +348,7 @@ fsl_qdma_queue_transfer_complete(struct fsl_qdma_engine *fsl_qdma, if (reg & FSL_QDMA_BSQSR_QE_BE) return count; - status_addr = fsl_status->virt_head; - - reg = qdma_readl_be(block + FSL_QDMA_BSQMR); - reg |= FSL_QDMA_BSQMR_DI_BE; - - qdma_desc_addr_set64(status_addr, 0x0); - fsl_status->virt_head++; - if (fsl_status->virt_head == fsl_status->cq + fsl_status->n_cq) - fsl_status->virt_head = fsl_status->cq; - qdma_writel_be(reg, block + FSL_QDMA_BSQMR); + qdma_writel_be(FSL_QDMA_BSQMR_DI, block + FSL_QDMA_BSQMR); if (status != NULL) status[count] = RTE_DMA_STATUS_SUCCESSFUL; @@ -472,19 +463,37 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue, { void *block = fsl_queue->queue_base; struct fsl_qdma_format *csgf_src, *csgf_dest; - u32 reg; #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 struct fsl_qdma_sdf *sdf; u32 cfg = 0; #endif +#ifdef CONFIG_RTE_DMA_DPAA_ERR_CHK + u32 reg; + /* retrieve and store the register value in big endian * to avoid bits swap */ reg = qdma_readl_be(block + FSL_QDMA_BCQSR(fsl_queue->id)); - if (reg & (FSL_QDMA_BCQSR_QF_XOFF_BE)) + if (reg & (FSL_QDMA_BCQSR_QF_XOFF_BE)) { + DPAA_QDMA_ERR("QDMA Engine is busy\n"); return -1; + } +#else + /* check whether critical watermark level reached, + * below check is valid for only single queue per block + */ + if ((fsl_queue->stats.submitted - fsl_queue->stats.completed) + >= QDMA_QUEUE_CR_WM) { + DPAA_QDMA_DEBUG("Queue is full, try dequeue first\n"); + return -1; + } +#endif + if (unlikely(fsl_queue->pending == fsl_queue->n_cq)) { + DPAA_QDMA_DEBUG("Queue is full, try dma submit first\n"); + return -1; + } csgf_src = (struct fsl_qdma_format *)fsl_queue->virt_addr[fsl_queue->ci] + QDMA_SGF_SRC_OFF; @@ -512,19 +521,14 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue, qdma_csgf_set_len(csgf_dest, len); /* This entry is the last entry. */ qdma_csgf_set_f(csgf_dest, len); - fsl_queue->virt_head++; fsl_queue->ci++; - if (fsl_queue->virt_head == fsl_queue->cq + fsl_queue->n_cq) { - fsl_queue->virt_head = fsl_queue->cq; + if (fsl_queue->ci == fsl_queue->n_cq) fsl_queue->ci = 0; - } - if (flags & RTE_DMA_OP_FLAG_SUBMIT) { - reg = qdma_readl_be(block + FSL_QDMA_BCQMR(fsl_queue->id)); - reg |= FSL_QDMA_BCQMR_EI_BE; - qdma_writel_be(reg, block + FSL_QDMA_BCQMR(fsl_queue->id)); + qdma_writel_be(FSL_QDMA_BCQMR_EI, + block + FSL_QDMA_BCQMR(fsl_queue->id)); fsl_queue->stats.submitted++; } else { fsl_queue->pending++; @@ -618,12 +622,9 @@ dpaa_qdma_submit(void *dev_private, uint16_t vchan) struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; void *block = fsl_queue->queue_base; - u32 reg; while (fsl_queue->pending) { - reg = qdma_readl_be(block + FSL_QDMA_BCQMR(fsl_queue->id)); - reg |= FSL_QDMA_BCQMR_EI_BE; - qdma_writel_be(reg, block + FSL_QDMA_BCQMR(fsl_queue->id)); + qdma_writel_be(FSL_QDMA_BCQMR_EI, block + FSL_QDMA_BCQMR(fsl_queue->id)); fsl_queue->pending--; fsl_queue->stats.submitted++; } @@ -656,44 +657,43 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, enum rte_dma_status_code *st) { struct fsl_qdma_engine *fsl_qdma = (struct fsl_qdma_engine *)dev_private; - int id = (int)((fsl_qdma->vchan_map[vchan]) / QDMA_QUEUES); - void *block; - int intr; - void *status = fsl_qdma->status_base; + int ret; struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; + void *status = fsl_qdma->status_base; + int intr; - intr = qdma_readl_be(status + FSL_QDMA_DEDR); - if (intr) { - DPAA_QDMA_ERR("DMA transaction error! %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW0R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW0R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW1R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW1R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW2R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW2R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW3R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW3R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFQIDR); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFQIDR %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECBR); - DPAA_QDMA_INFO("reg FSL_QDMA_DECBR %x\n", intr); - qdma_writel(0xffffffff, - status + FSL_QDMA_DEDR); - intr = qdma_readl(status + FSL_QDMA_DEDR); - fsl_queue->stats.errors++; + ret = fsl_qdma_queue_transfer_complete(fsl_queue->queue_base, + nb_cpls, st); + if (!ret) { + intr = qdma_readl_be(status + FSL_QDMA_DEDR); + if (intr) { +#ifdef CONFIG_RTE_DMA_DPAA_ERR_CHK + DPAA_QDMA_ERR("DMA transaction error! %x\n", intr); + intr = qdma_readl(status + FSL_QDMA_DECFDW0R); + DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW0R %x\n", intr); + intr = qdma_readl(status + FSL_QDMA_DECFDW1R); + DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW1R %x\n", intr); + intr = qdma_readl(status + FSL_QDMA_DECFDW2R); + DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW2R %x\n", intr); + intr = qdma_readl(status + FSL_QDMA_DECFDW3R); + DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW3R %x\n", intr); + intr = qdma_readl(status + FSL_QDMA_DECFQIDR); + DPAA_QDMA_INFO("reg FSL_QDMA_DECFQIDR %x\n", intr); + intr = qdma_readl(status + FSL_QDMA_DECBR); + DPAA_QDMA_INFO("reg FSL_QDMA_DECBR %x\n", intr); +#endif + qdma_writel_be(0xbf, + status + FSL_QDMA_DEDR); + fsl_queue->stats.errors++; + } } - block = fsl_qdma->block_base + - FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, id); - - intr = fsl_qdma_queue_transfer_complete(fsl_qdma, block, id, nb_cpls, - st); - fsl_queue->stats.completed += intr; + fsl_queue->stats.completed += ret; if (last_idx != NULL) *last_idx = (uint16_t)(fsl_queue->stats.completed - 1); - return intr; + return ret; } @@ -703,44 +703,46 @@ dpaa_qdma_dequeue(void *dev_private, uint16_t *last_idx, bool *has_error) { struct fsl_qdma_engine *fsl_qdma = (struct fsl_qdma_engine *)dev_private; - int id = (int)((fsl_qdma->vchan_map[vchan]) / QDMA_QUEUES); - void *block; - int intr; - void *status = fsl_qdma->status_base; + int ret; struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; +#ifdef CONFIG_RTE_DMA_DPAA_ERR_CHK + void *status = fsl_qdma->status_base; + int intr; +#endif - intr = qdma_readl_be(status + FSL_QDMA_DEDR); - if (intr) { - DPAA_QDMA_ERR("DMA transaction error! %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW0R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW0R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW1R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW1R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW2R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW2R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW3R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW3R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFQIDR); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFQIDR %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECBR); - DPAA_QDMA_INFO("reg FSL_QDMA_DECBR %x\n", intr); - qdma_writel(0xffffffff, - status + FSL_QDMA_DEDR); - intr = qdma_readl(status + FSL_QDMA_DEDR); - *has_error = true; - fsl_queue->stats.errors++; + *has_error = false; + ret = fsl_qdma_queue_transfer_complete(fsl_queue->queue_base, + nb_cpls, NULL); +#ifdef CONFIG_RTE_DMA_DPAA_ERR_CHK + if (!ret) { + intr = qdma_readl_be(status + FSL_QDMA_DEDR); + if (intr) { + DPAA_QDMA_ERR("DMA transaction error! %x\n", intr); + intr = qdma_readl(status + FSL_QDMA_DECFDW0R); + DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW0R %x\n", intr); + intr = qdma_readl(status + FSL_QDMA_DECFDW1R); + DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW1R %x\n", intr); + intr = qdma_readl(status + FSL_QDMA_DECFDW2R); + DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW2R %x\n", intr); + intr = qdma_readl(status + FSL_QDMA_DECFDW3R); + DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW3R %x\n", intr); + intr = qdma_readl(status + FSL_QDMA_DECFQIDR); + DPAA_QDMA_INFO("reg FSL_QDMA_DECFQIDR %x\n", intr); + intr = qdma_readl(status + FSL_QDMA_DECBR); + DPAA_QDMA_INFO("reg FSL_QDMA_DECBR %x\n", intr); + qdma_writel_be(0xbf, + status + FSL_QDMA_DEDR); + intr = qdma_readl(status + FSL_QDMA_DEDR); + *has_error = true; + fsl_queue->stats.errors++; + } } - - block = fsl_qdma->block_base + - FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, id); - - intr = fsl_qdma_queue_transfer_complete(fsl_qdma, block, id, nb_cpls, - NULL); - fsl_queue->stats.completed += intr; +#endif + fsl_queue->stats.completed += ret; if (last_idx != NULL) *last_idx = (uint16_t)(fsl_queue->stats.completed - 1); - return intr; + return ret; } static int @@ -842,7 +844,7 @@ dpaa_qdma_init(struct rte_dma_dev *dmadev) } for (i = 0; i < fsl_qdma->num_blocks; i++) { - fsl_qdma->status[i] = fsl_qdma_prep_status_queue(); + fsl_qdma->status[i] = fsl_qdma_prep_status_queue(fsl_qdma, i); if (!fsl_qdma->status[i]) goto mem_free; j = 0; diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 80366ce890..8a4517a70a 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -58,11 +58,17 @@ #define FSL_QDMA_BCQMR_CD_THLD(x) ((x) << 20) #define FSL_QDMA_BCQMR_CQ_SIZE(x) ((x) << 16) +/* Update the value appropriately whenever QDMA_QUEUE_SIZE + * changes. + */ +#define FSL_QDMA_BCQMR_EI 0x20c0 + #define FSL_QDMA_BCQSR_QF_XOFF_BE 0x1000100 #define FSL_QDMA_BSQMR_EN 0x80000000 #define FSL_QDMA_BSQMR_DI_BE 0x40 #define FSL_QDMA_BSQMR_CQ_SIZE(x) ((x) << 16) +#define FSL_QDMA_BSQMR_DI 0xc0 #define FSL_QDMA_BSQSR_QE_BE 0x200 @@ -110,6 +116,7 @@ #define QDMA_SGF_SRC_OFF 2 #define QDMA_SGF_DST_OFF 3 #define QDMA_DESC_OFF 1 +#define QDMA_QUEUE_CR_WM 32 #define QDMA_BIG_ENDIAN 1 #ifdef QDMA_BIG_ENDIAN From patchwork Mon Jul 22 11:58:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142611 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5D75445681; Mon, 22 Jul 2024 14:04:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E862E402E3; Mon, 22 Jul 2024 14:01:04 +0200 (CEST) Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011006.outbound.protection.outlook.com [52.101.70.6]) by mails.dpdk.org (Postfix) with ESMTP id 0E6C2402B8 for ; Mon, 22 Jul 2024 14:01:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=b/I73S+QiIaXR9zVR8zGfVxeLWGs/ObTdWerv+l4MYIlOf55olWOEJKtNTgQR/LGjt2pY7gJzhaFKxhij21FC1jn7WfWYH1WBl7lciRDrH0MVMbxpJr5f3FI9Tj9NqPPRCCYAqPkgRtkmwAmYOPa/T3RZ6iSxbFA/kOyPbzUe6I2cuyJJs3+nF4LMeRJKiJgVlI5zOEFuCR1CZrY0OaA/JgmMd2qIvWHPuU2zYqCXqBzGFD1vije6hPcK8d85Nf1ZwO2iHqjq6FqfLrHo+Ss8mJQvHDnWxvrX48z7rNwSA9mxtXV52t0gjtdkWVKA2bRd0HV0ReZIkJKv0vlHiCK/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0oceSa2V9dPFo4/MN9QtnSRta+zsBgYlpiHnpHtDLzE=; b=ePwtfjVlx4YFHNohlQFG3zo13ziELRkW5Q0z6NO2b0L7YYC1g75j2fAZwq/g6PArYqhQQYoi2k0noaTIUAD7jXYmBJm85q2jBRjt125KUDc8VTt8pBLgwRmOEdWaAZM8smMJ8fuLX7Pf74PONeHDVfTXmjCQM7aBx1CydIUnlKR+z1rWQ8FdnFlgzO1EVml61/hFnrNPAiJdOu+dwWd83f41Yp4D17CtZRIVG+IDnXGo7lsSgOOHf8Y7hpDNmNpIIQIdcM49LIMVrDSG5E7qeblsP8Gv9pbh0azicDyCsEYXJQpPtKQWmM0/Kmq4isXaBcJ1s95ggqHzGfTCy5MlKQ== 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=0oceSa2V9dPFo4/MN9QtnSRta+zsBgYlpiHnpHtDLzE=; b=TPcIGCLh4mY63gqTVsCDnp8ItOvukc7KZcIgNkSWfS8AF9bdGxHjiKfEfTI7UPDgct5uUcGM8t/BfR53Wvs7ayRr5REIzNyTxT9Wecn8pc4l4gUnIupgEi35jcooSATDD+kZJGZo1rT3srr1caecsnTeJCYoHBpav20N+AT0JHQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:38 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:38 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v2 20/30] dma/dpaa: refactor driver Date: Mon, 22 Jul 2024 17:28:33 +0530 Message-Id: <20240722115843.1830105-21-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: 8cc39704-ea33-4e4c-3226-08dcaa45c325 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: V5XIXR+59T+XrGInSu6dqUMvSXhlKMOemvfE4tBPLCSqQ7fV28ikwCu7qIAOky2NPGccEqwBO3R2yfmdG/NnTNYkwit+wdxVafV79qYZzn5H/zrvWwDNPTag9qDsgMkoFDgI1R729HZyRaDQ3ll59+aOGb9nUN/5bDZbVzwk7tuHcdOSQ/ioRPw/GsHY/Rlu5jTxSCSb+1DQ9YMJKCZY63AadUgNFk1lDT/6hAsU+9ffDZ57YU2xc8muR8+g51K0nfItt/gPGtTqQ6bG8sIO5o88URCkToI1H2rHMffjOhOGT0hqe6nD1GzT77fnoB7b4KQMHXb01nytdM9ltE57zzhEhPjDtuh4DMwGHhzgTRH8yeCsa/DxpZS+hrUHhybU63EQusl3cVNOWpxNDw1oToTu98Z3RLu3RYJ7YQwYrlUBBJboiyul4aczSzmBmOsZsyb9/opV5JfbprRlZSwSLoNC2UtdYvJKBVt2DQ6ErqtADbbnp+l8q4pJxNUXztC29roGwS2AN/r43v6HOYs1ZhYLUSGFdSHidDVXv67oQsJ2BUClYlO9dEjYNrA3MqvnXDywGemr6UelHT7gbx87bDTeob1mb4dRRFaNbRTqRwuxVS8iszRRJbFx/OG7RttweTjjkXfvUwni0ri4gTFiTmxWouKSsc4ciRlynE4bfv9gQlr8ADOl2VKIV4mJnnHY0D+f2F9/0o7IcP4a8V8ln+tOZIEpgyURnQXXKrOAIopIF9A+hY3pAyZehXy39aGkg6qbTnUTawN04NtDCzTVZk3m4+h3qK9k0BslCwhDD4GiEJYnJXA7/aPibUfD4mpspwrYS/6RZWNFTD8MJK0mmeEvh1K17DByoQElRJDlKd3t0eme+DmUCTP4rMVwOWXHNKjrUHUPVnG9uP3IPiiwczD7JjyML2DNZq994wRQRZzDWFfU/iQZrCDbRlM0eKnMnvnZ50/rAakPko70RpcPXBm6jjMQU4IX3RiZpAT8Rgxxalvb0dPCaQJMbEmJFor6grDkFXW+dzmfWV2wyeuU75P+Jj0DHwO9g50vqV1fRYJM1fITenqwRs8XZWoY5ccoLWzZtsBUAanKj0UWYLoSh72fDmo3I1efXqnScFktGIdfa6cRxu7vQZR4vshCIJgpw7zRnELLSwWsJBfKlXRxXcNH3rV6ijuh5IapclmtYuRAnAtLgvZakkXiBUHQRmGKdQ1v6HdA20OJyEabTobBsdAJ2pN7mwaxGgCOGbKJSaKteb3C00B4kmeSmxpX+xqqtJHx/I2HLwgZnIc48+bgAmYPD6zmBCyXOTCAoARrk7Eb6bOCNAcSlBsdGKbrCgF2FcxsxTV3Ff6g7+7TWSLQxgj1hUjH6PeGSP/76T2qRg6/kdSpTyrQ2+uQwO6WGbw+ELYyYJQpBGBM6AdmGio0Uw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Nj5p/a5HwPGNP+F5D2klxjdCf8m7Olo1SbF+CwiFi/qkdo/N8HTikOvgZtllAkU43dyvLqH9Kkyt2la1JQxkv42B15QOzrxhSuGDYSfcGwv/BIfZEU3SzMD9NjxYal3C/Ruj49Gn0FFM64fPzB+mLbGjAEGUkKsaQsmz9MQ1CUsnxZkLjpaowb2gHl1fIHHzakN4U5ZzRQ61mGuhkIzLSULQ7HhYmq5FLvUCvqL1XbrIIy/I1PS6NTM2xdsZKwVCbSMDAWwQzdOjR87kNWnWAs5WPVYR9RWTXyv65kbemcyUkZj8jv1e/P3uSHcTUBhIXExMHVDiJCXce1o+OqjBlu82FjuMmkBUYedVOA4qZEfzNCmDNb2fuqr1s9mg/UAjJLUqDMoAmML91t1P5l7PHAGa7ZGQtZlKbIIULZjVPCP5h/Fmob570z+E6UflP+u83178PSsU9M9ZHzHZyL7LZtRHRUE7A8Tg+nhmZwM70a1BLvrXbjDYgir4dNZGUxKj8mkRoebgMW9WBXMTJ+Dpaw+7b5EKG1mobDKYblzIkP4fEfXi0yUPduygtw9yW7MR7MUULD7KV3FTEdrwz0iTYXMFdQCYCetKXBwSqsVlZSN7O9rRqQISoRnzaSE4yPysJ69JThBa+miD6a3FrGQInAevBmkeTmwF1N5GRIfDNuql2tfUx7fEeD5CfVSxU9b1UcecGvGi2EeUi2GX47Dj6pUu7jzN7yrld+S8f9gEAe69TkJUEs29VbbnPrmMj43vFrfL2D0IOIKYRAf7s+kV2pyZdQ/jfu+RTUIvgcEQ7SbNlSE8Dv9W+tzIJKKrmln6nSUzn40Cxb+8qYMqh+vSv9JSGlBqYQKZN8PMTR5VsrHXsCS+tm0dVGVFmcfXTiToQRna1lT7XT0OLnGNfd+qt4Tku2m5EbpNyGe3aEMg/6aPxPoVzbX4aAmJ9/d/D/JZiSiWzq5FYsiHMgNiVM1PiVeyjvoHe4eBGsRU45i9snOrcBx04W0tBLVq3vYW9C8cTk7JhlAtGT9xN0Dv0Ygbo7mnk9ICgATS5Zn91qhGQYyM5tPdBDDtURFtyUp1heZsWA1+wvgM4bhb0/GrsHm3Eh2KRt/D1iwsakeH+U+qAb9TwLMps2lRHrWocEhbPi5Sh3jY3JBTkZkHGw1brcpzZT5LVRd/1/5+JH3ovyrutAkihuWRh5/14eKGruY2x/2V4Z07/zwbId1mGEkACA7Dkw4ECRkckI5ZlECkWOVLWvhysvBODSQf7Bb9C/RhF3JMiPiMH/enIJeMAC7f/mMIVN9kw7clZaLTGuHMdLHMqviYJUx6GyBllcNYNs7Jd5hlU0z4dVgqQN323y0zZLbmrvZjNgghCW0RqXrzI7aR8zES0RkNRjwq9L8hj6LeUJsw4ac6BSDY1GhU89jraezEYi/AgxUZ6AmoU/c8vTG0uDd6P3zKLGvGQ2BWwI2CQ83ZDGsqEKlf0CCp9UwgeEiTZT71/qO2VL6pBvNPg0sj6YDF1G6IQw0ljCo+SKqtSvnjSSYv3G7/9i9ZuTd9vFFEPTc7T1WlswOyHSCx3y+xv+qFUwWj/t44+R5sJFUI3tGu X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8cc39704-ea33-4e4c-3226-08dcaa45c325 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:38.5895 (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: TD/1jGe5obwP9PiXPDXg94q420TUKHnScYS2gPoyXJnuMcgP2DueBck6+hSX/oNb X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 From: Jun Yang Return complete index instead of total complete counter in complete callback. Signed-off-by: Jun Yang --- drivers/dma/dpaa/dpaa_qdma.c | 534 ++++++++++++++++++----------------- drivers/dma/dpaa/dpaa_qdma.h | 109 +++---- 2 files changed, 330 insertions(+), 313 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 4022ad6469..dc17aa4520 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -15,19 +15,6 @@ qdma_desc_addr_set64(struct fsl_qdma_format *ccdf, u64 addr) ccdf->addr_lo = rte_cpu_to_le_32(lower_32_bits(addr)); } -static inline u64 -qdma_ccdf_get_queue(const struct fsl_qdma_format *ccdf) -{ - return ccdf->cfg8b_w1 & 0xff; -} - -static inline int -qdma_ccdf_get_offset(const struct fsl_qdma_format *ccdf) -{ - return (rte_le_to_cpu_32(ccdf->cfg) & QDMA_CCDF_MASK) - >> QDMA_CCDF_OFFSET; -} - static inline void qdma_ccdf_set_format(struct fsl_qdma_format *ccdf, int offset) { @@ -59,8 +46,7 @@ qdma_csgf_set_f(struct fsl_qdma_format *csgf, int len) csgf->cfg = rte_cpu_to_le_32(QDMA_SG_FIN | (len & QDMA_SG_LEN_MASK)); } -static inline int -ilog2(int x) +static inline int ilog2(int x) { int log = 0; @@ -73,32 +59,50 @@ ilog2(int x) return log; } -static u32 +static inline int ilog2_qsize(uint32_t q_size) +{ + return (ilog2(q_size) - ilog2(64)); +} + +static inline int ilog2_qthld(uint32_t q_thld) +{ + return (ilog2(q_thld) - ilog2(16)); +} + +static inline int +fsl_qdma_queue_bd_in_hw(struct fsl_qdma_queue *fsl_queue) +{ + struct rte_dma_stats *stats = &fsl_queue->stats; + + return (stats->submitted - stats->completed); +} + +static uint32_t qdma_readl(void *addr) { return QDMA_IN(addr); } static void -qdma_writel(u32 val, void *addr) +qdma_writel(uint32_t val, void *addr) { QDMA_OUT(addr, val); } -static u32 +static uint32_t qdma_readl_be(void *addr) { return QDMA_IN_BE(addr); } static void -qdma_writel_be(u32 val, void *addr) +qdma_writel_be(uint32_t val, void *addr) { QDMA_OUT_BE(addr, val); } -static void -*dma_pool_alloc(int size, int aligned, dma_addr_t *phy_addr) +static void * +dma_pool_alloc(int size, int aligned, dma_addr_t *phy_addr) { void *virt_addr; @@ -115,47 +119,48 @@ static void * Pre-request command descriptor and compound S/G for enqueue. */ static int -fsl_qdma_pre_request_enqueue_comp_sd_desc( - struct fsl_qdma_queue *queue, - int size, int aligned) +fsl_qdma_pre_comp_sd_desc(struct fsl_qdma_queue *queue) { struct fsl_qdma_sdf *sdf; struct fsl_qdma_ddf *ddf; - struct fsl_qdma_format *csgf_desc; struct fsl_qdma_format *ccdf; - int i, j; + uint16_t i, j; struct fsl_qdma_format *head; + struct fsl_qdma_cmpd_ft *ft; + struct fsl_qdma_df *df; - head = queue->virt_head; + head = queue->cmd_desc; - for (i = 0; i < (int)(queue->n_cq); i++) { - dma_addr_t bus_addr = 0, desc_bus_addr = 0; + for (i = 0; i < queue->n_cq; i++) { + dma_addr_t phy_ft = 0, phy_df = 0; - queue->virt_addr[i] = - dma_pool_alloc(size, aligned, &bus_addr); - if (!queue->virt_addr[i]) + queue->ft[i] = + dma_pool_alloc(sizeof(struct fsl_qdma_cmpd_ft), + RTE_CACHE_LINE_SIZE, &phy_ft); + if (!queue->ft[i]) goto fail; - queue->desc_virt_addr[i] = - dma_pool_alloc(size, aligned, &desc_bus_addr); - if (!queue->desc_virt_addr[i]) { - rte_free(queue->virt_addr[i]); + queue->df[i] = + dma_pool_alloc(sizeof(struct fsl_qdma_df), + RTE_CACHE_LINE_SIZE, &phy_df); + if (!queue->df[i]) { + rte_free(queue->ft[i]); goto fail; } - memset(queue->virt_addr[i], 0, FSL_QDMA_COMMAND_BUFFER_SIZE); - memset(queue->desc_virt_addr[i], 0, - FSL_QDMA_DESCRIPTOR_BUFFER_SIZE); + memset(queue->ft[i], 0, sizeof(struct fsl_qdma_cmpd_ft)); + memset(queue->df[i], 0, sizeof(struct fsl_qdma_df)); - csgf_desc = (struct fsl_qdma_format *)queue->virt_addr[i] + - QDMA_DESC_OFF; - sdf = (struct fsl_qdma_sdf *)queue->desc_virt_addr[i]; - ddf = (struct fsl_qdma_ddf *)sdf + QDMA_DESC_OFF; + ft = queue->ft[i]; + df = queue->df[i]; + sdf = &df->sdf; + ddf = &df->ddf; /* Compound Command Descriptor(Frame List Table) */ - qdma_desc_addr_set64(csgf_desc, desc_bus_addr); + qdma_desc_addr_set64(&ft->desc_buf, phy_df); /* It must be 32 as Compound S/G Descriptor */ - qdma_csgf_set_len(csgf_desc, 32); + qdma_csgf_set_len(&ft->desc_buf, + sizeof(struct fsl_qdma_df)); /* Descriptor Buffer */ sdf->cmd = rte_cpu_to_le_32(FSL_QDMA_CMD_RWTTYPE << FSL_QDMA_CMD_RWTTYPE_OFFSET); @@ -167,73 +172,72 @@ fsl_qdma_pre_request_enqueue_comp_sd_desc( ddf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET); - ccdf = (struct fsl_qdma_format *)queue->virt_head; - qdma_desc_addr_set64(ccdf, bus_addr + 16); - qdma_ccdf_set_format(ccdf, qdma_ccdf_get_offset(queue->virt_addr[i])); - qdma_ccdf_set_ser(ccdf, qdma_ccdf_get_status(queue->virt_addr[i])); - queue->virt_head++; + ccdf = queue->cmd_desc; + qdma_desc_addr_set64(ccdf, phy_ft); + qdma_ccdf_set_format(ccdf, 0); + qdma_ccdf_set_ser(ccdf, 0); + queue->cmd_desc++; } - queue->virt_head = head; + queue->cmd_desc = head; queue->ci = 0; return 0; fail: for (j = 0; j < i; j++) { - rte_free(queue->virt_addr[j]); - rte_free(queue->desc_virt_addr[j]); + rte_free(queue->ft[j]); + rte_free(queue->df[j]); } return -ENOMEM; } -static struct fsl_qdma_queue -*fsl_qdma_alloc_queue_resources(struct fsl_qdma_engine *fsl_qdma, int k, int b) +static struct fsl_qdma_queue * +fsl_qdma_alloc_queue_resources(struct fsl_qdma_engine *fsl_qdma, + int queue_id, int block_id) { struct fsl_qdma_queue *queue_temp; + uint32_t queue_size; - queue_temp = rte_zmalloc("qdma: queue head", sizeof(*queue_temp), 0); + queue_temp = rte_zmalloc("qdma: queue head", + sizeof(struct fsl_qdma_queue), 0); if (!queue_temp) { - printf("no memory to allocate queues\n"); + DPAA_QDMA_ERR("no memory to allocate queues\n"); return NULL; } + queue_size = sizeof(struct fsl_qdma_format) * QDMA_QUEUE_SIZE; - queue_temp->cq = - dma_pool_alloc(sizeof(struct fsl_qdma_format) * - QDMA_QUEUE_SIZE, - sizeof(struct fsl_qdma_format) * - QDMA_QUEUE_SIZE, &queue_temp->bus_addr); - + queue_temp->cq = dma_pool_alloc(queue_size, + queue_size, &queue_temp->bus_addr); if (!queue_temp->cq) { rte_free(queue_temp); return NULL; } - memset(queue_temp->cq, 0x0, QDMA_QUEUE_SIZE * - sizeof(struct fsl_qdma_format)); + memset(queue_temp->cq, 0x0, queue_size); - queue_temp->queue_base = fsl_qdma->block_base + - FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, b); + queue_temp->block_vir = fsl_qdma->block_base + + FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, block_id); queue_temp->n_cq = QDMA_QUEUE_SIZE; - queue_temp->id = k; + queue_temp->queue_id = queue_id; queue_temp->pending = 0; - queue_temp->virt_head = queue_temp->cq; - queue_temp->virt_addr = rte_malloc("queue virt addr", + queue_temp->cmd_desc = queue_temp->cq; + queue_temp->ft = rte_malloc("Compound Frame Table", sizeof(void *) * QDMA_QUEUE_SIZE, 0); - if (!queue_temp->virt_addr) { + if (!queue_temp->ft) { rte_free(queue_temp->cq); rte_free(queue_temp); return NULL; } - queue_temp->desc_virt_addr = rte_malloc("queue desc virt addr", + queue_temp->df = rte_malloc("Descriptor Buffer", sizeof(void *) * QDMA_QUEUE_SIZE, 0); - if (!queue_temp->desc_virt_addr) { - rte_free(queue_temp->virt_addr); + if (!queue_temp->df) { + rte_free(queue_temp->ft); rte_free(queue_temp->cq); rte_free(queue_temp); return NULL; } - queue_temp->stats = (struct rte_dma_stats){0}; + memset(&queue_temp->stats, 0, sizeof(struct rte_dma_stats)); return queue_temp; } @@ -241,45 +245,43 @@ static struct fsl_qdma_queue static void fsl_qdma_free_queue_resources(struct fsl_qdma_queue *queue) { - rte_free(queue->desc_virt_addr); - rte_free(queue->virt_addr); + rte_free(queue->df); + rte_free(queue->ft); rte_free(queue->cq); rte_free(queue); } -static struct -fsl_qdma_queue *fsl_qdma_prep_status_queue(struct fsl_qdma_engine *fsl_qdma, - u32 id) +static struct fsl_qdma_queue * +fsl_qdma_prep_status_queue(struct fsl_qdma_engine *fsl_qdma, + uint32_t block_id) { struct fsl_qdma_queue *status_head; - unsigned int status_size; + uint32_t status_size; - status_size = QDMA_STATUS_SIZE; + status_size = QDMA_STATUS_SIZE * sizeof(struct fsl_qdma_format); - status_head = rte_zmalloc("qdma: status head", sizeof(*status_head), 0); + status_head = rte_zmalloc("qdma: status head", + sizeof(*status_head), 0); if (!status_head) return NULL; /* * Buffer for queue command */ - status_head->cq = dma_pool_alloc(sizeof(struct fsl_qdma_format) * - status_size, - sizeof(struct fsl_qdma_format) * - status_size, - &status_head->bus_addr); + status_head->cq = dma_pool_alloc(status_size, + status_size, &status_head->bus_addr); if (!status_head->cq) { rte_free(status_head); return NULL; } - memset(status_head->cq, 0x0, status_size * - sizeof(struct fsl_qdma_format)); + memset(status_head->cq, 0x0, status_size); status_head->n_cq = status_size; - status_head->virt_head = status_head->cq; - status_head->queue_base = fsl_qdma->block_base + - FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, id); + status_head->cmd_desc = status_head->cq; + status_head->block_id = block_id; + status_head->block_vir = fsl_qdma->block_base + + FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, block_id); return status_head; } @@ -294,11 +296,11 @@ fsl_qdma_free_status_queue(struct fsl_qdma_queue *status) static int fsl_qdma_halt(struct fsl_qdma_engine *fsl_qdma) { - void *ctrl = fsl_qdma->ctrl_base; - void *block; + uint8_t *ctrl = fsl_qdma->ctrl_base; + uint8_t *block; int i, count = RETRIES; unsigned int j; - u32 reg; + uint32_t reg; /* Disable the command queue and wait for idle state. */ reg = qdma_readl(ctrl + FSL_QDMA_DMR); @@ -337,11 +339,13 @@ fsl_qdma_halt(struct fsl_qdma_engine *fsl_qdma) } static int -fsl_qdma_queue_transfer_complete(void *block, const uint16_t nb_cpls, - enum rte_dma_status_code *status) +fsl_qdma_queue_transfer_complete(struct fsl_qdma_queue *fsl_queue, + const uint16_t nb_cpls, + enum rte_dma_status_code *status) { - u32 reg; + uint32_t reg; int count = 0; + uint8_t *block = fsl_queue->block_vir; while (count < nb_cpls) { reg = qdma_readl_be(block + FSL_QDMA_BSQSR); @@ -351,9 +355,11 @@ fsl_qdma_queue_transfer_complete(void *block, const uint16_t nb_cpls, qdma_writel_be(FSL_QDMA_BSQMR_DI, block + FSL_QDMA_BSQMR); if (status != NULL) status[count] = RTE_DMA_STATUS_SUCCESSFUL; + fsl_queue->complete++; + if (unlikely(fsl_queue->complete >= fsl_queue->n_cq)) + fsl_queue->complete = 0; count++; - } return count; } @@ -363,9 +369,9 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) { struct fsl_qdma_queue *temp; void *ctrl = fsl_qdma->ctrl_base; - void *block; - u32 i, j; - u32 reg; + uint8_t *block; + uint32_t i, j, k = 0; + uint32_t reg; int ret, val; /* Try to halt the qDMA engine first. */ @@ -375,13 +381,11 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) return ret; } - int k = 0; for (j = 0; j < fsl_qdma->num_blocks; j++) { block = fsl_qdma->block_base + FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, j); - k = 0; - for (i = (j * QDMA_QUEUES); i < ((j * QDMA_QUEUES) + QDMA_QUEUES); i++) { - temp = fsl_qdma->queue[i]; + for (i = 0; i < QDMA_QUEUES; i++) { + temp = fsl_qdma->queue[k]; /* * Initialize Command Queue registers to * point to the first @@ -391,19 +395,20 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) */ qdma_writel(lower_32_bits(temp->bus_addr), - block + FSL_QDMA_BCQDPA_SADDR(k)); + block + FSL_QDMA_BCQDPA_SADDR(i)); qdma_writel(upper_32_bits(temp->bus_addr), - block + FSL_QDMA_BCQEDPA_SADDR(k)); + block + FSL_QDMA_BCQEDPA_SADDR(i)); qdma_writel(lower_32_bits(temp->bus_addr), - block + FSL_QDMA_BCQEPA_SADDR(k)); + block + FSL_QDMA_BCQEPA_SADDR(i)); qdma_writel(upper_32_bits(temp->bus_addr), - block + FSL_QDMA_BCQEEPA_SADDR(k)); + block + FSL_QDMA_BCQEEPA_SADDR(i)); /* Initialize the queue mode. */ reg = FSL_QDMA_BCQMR_EN; - reg |= FSL_QDMA_BCQMR_CD_THLD(ilog2(temp->n_cq) - 4); - reg |= FSL_QDMA_BCQMR_CQ_SIZE(ilog2(temp->n_cq) - 6); - qdma_writel(reg, block + FSL_QDMA_BCQMR(k)); + reg |= FSL_QDMA_BCQMR_CD_THLD(ilog2_qthld(temp->n_cq)); + reg |= FSL_QDMA_BCQMR_CQ_SIZE(ilog2_qsize(temp->n_cq)); + temp->le_cqmr = reg; + qdma_writel(reg, block + FSL_QDMA_BCQMR(i)); k++; } @@ -423,18 +428,15 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) * Enqueue Pointer Address Registers */ - qdma_writel( - upper_32_bits(fsl_qdma->status[j]->bus_addr), - block + FSL_QDMA_SQEEPAR); - qdma_writel( - lower_32_bits(fsl_qdma->status[j]->bus_addr), - block + FSL_QDMA_SQEPAR); - qdma_writel( - upper_32_bits(fsl_qdma->status[j]->bus_addr), - block + FSL_QDMA_SQEDPAR); - qdma_writel( - lower_32_bits(fsl_qdma->status[j]->bus_addr), - block + FSL_QDMA_SQDPAR); + temp = fsl_qdma->status[j]; + qdma_writel(upper_32_bits(temp->bus_addr), + block + FSL_QDMA_SQEEPAR); + qdma_writel(lower_32_bits(temp->bus_addr), + block + FSL_QDMA_SQEPAR); + qdma_writel(upper_32_bits(temp->bus_addr), + block + FSL_QDMA_SQEDPAR); + qdma_writel(lower_32_bits(temp->bus_addr), + block + FSL_QDMA_SQDPAR); /* Desiable status queue interrupt. */ qdma_writel(0x0, block + FSL_QDMA_BCQIER(0)); @@ -443,7 +445,7 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) /* Initialize the status queue mode. */ reg = FSL_QDMA_BSQMR_EN; - val = ilog2(fsl_qdma->status[j]->n_cq) - 6; + val = ilog2_qsize(temp->n_cq); reg |= FSL_QDMA_BSQMR_CQ_SIZE(val); qdma_writel(reg, block + FSL_QDMA_BSQMR); } @@ -455,52 +457,51 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) return 0; } - static int fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue, - uint64_t flags, dma_addr_t dst, - dma_addr_t src, size_t len) + uint64_t flags, dma_addr_t dst, + dma_addr_t src, size_t len) { - void *block = fsl_queue->queue_base; + uint8_t *block = fsl_queue->block_vir; struct fsl_qdma_format *csgf_src, *csgf_dest; + struct fsl_qdma_cmpd_ft *ft; #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 struct fsl_qdma_sdf *sdf; - u32 cfg = 0; + uint32_t cfg = 0; #endif #ifdef CONFIG_RTE_DMA_DPAA_ERR_CHK - u32 reg; + uint32_t reg; /* retrieve and store the register value in big endian * to avoid bits swap */ reg = qdma_readl_be(block + - FSL_QDMA_BCQSR(fsl_queue->id)); + FSL_QDMA_BCQSR(fsl_queue->queue_id)); if (reg & (FSL_QDMA_BCQSR_QF_XOFF_BE)) { DPAA_QDMA_ERR("QDMA Engine is busy\n"); - return -1; + return -EBUSY; } #else /* check whether critical watermark level reached, * below check is valid for only single queue per block */ - if ((fsl_queue->stats.submitted - fsl_queue->stats.completed) - >= QDMA_QUEUE_CR_WM) { + if (fsl_qdma_queue_bd_in_hw(fsl_queue) >= QDMA_QUEUE_CR_WM) { DPAA_QDMA_DEBUG("Queue is full, try dequeue first\n"); - return -1; + return -ENOSPC; } #endif + if (unlikely(fsl_queue->pending == fsl_queue->n_cq)) { DPAA_QDMA_DEBUG("Queue is full, try dma submit first\n"); - return -1; + return -ENOSPC; } - csgf_src = (struct fsl_qdma_format *)fsl_queue->virt_addr[fsl_queue->ci] + - QDMA_SGF_SRC_OFF; - csgf_dest = (struct fsl_qdma_format *)fsl_queue->virt_addr[fsl_queue->ci] + - QDMA_SGF_DST_OFF; + ft = fsl_queue->ft[fsl_queue->ci]; + csgf_src = &ft->desc_sbuf; + csgf_dest = &ft->desc_dbuf; #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 - sdf = (struct fsl_qdma_sdf *)fsl_queue->desc_virt_addr[fsl_queue->ci]; + sdf = fsl_queue->df[fsl_queue->ci]; sdf->cmd = rte_cpu_to_le_32(FSL_QDMA_CMD_RWTTYPE << FSL_QDMA_CMD_RWTTYPE_OFFSET); #ifdef RTE_DMA_DPAA_ERRATA_ERR050265 @@ -527,67 +528,57 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue, fsl_queue->ci = 0; if (flags & RTE_DMA_OP_FLAG_SUBMIT) { - qdma_writel_be(FSL_QDMA_BCQMR_EI, - block + FSL_QDMA_BCQMR(fsl_queue->id)); + qdma_writel(fsl_queue->le_cqmr | FSL_QDMA_BCQMR_EI, + block + FSL_QDMA_BCQMR(fsl_queue->queue_id)); fsl_queue->stats.submitted++; } else { fsl_queue->pending++; } - return 0; + + if (fsl_queue->ci) + return fsl_queue->ci - 1; + else + return fsl_queue->n_cq; } static int dpaa_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_info, - uint32_t info_sz) + __rte_unused uint32_t info_sz) { -#define DPAADMA_MAX_DESC 64 -#define DPAADMA_MIN_DESC 64 - - RTE_SET_USED(dev); - RTE_SET_USED(info_sz); + struct fsl_qdma_engine *fsl_qdma = dev->data->dev_private; dev_info->dev_capa = RTE_DMA_CAPA_MEM_TO_MEM | - RTE_DMA_CAPA_MEM_TO_DEV | - RTE_DMA_CAPA_DEV_TO_DEV | - RTE_DMA_CAPA_DEV_TO_MEM | - RTE_DMA_CAPA_SILENT | - RTE_DMA_CAPA_OPS_COPY; - dev_info->max_vchans = 4; - dev_info->max_desc = DPAADMA_MAX_DESC; - dev_info->min_desc = DPAADMA_MIN_DESC; + RTE_DMA_CAPA_SILENT | RTE_DMA_CAPA_OPS_COPY; + dev_info->max_vchans = fsl_qdma->n_queues; + dev_info->max_desc = QDMA_QUEUE_SIZE; + dev_info->min_desc = QDMA_QUEUE_SIZE; return 0; } static int -dpaa_get_channel(struct fsl_qdma_engine *fsl_qdma, uint16_t vchan) +dpaa_get_channel(struct fsl_qdma_engine *fsl_qdma, + uint16_t vchan) { - u32 i; int ret; - struct fsl_qdma_queue *fsl_queue; - - if (fsl_qdma->free_block_id == QDMA_BLOCKS) { - DPAA_QDMA_ERR("Maximum 4 queues can be configured\n"); - return -1; - } + struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; - i = fsl_qdma->free_block_id * QDMA_QUEUES; + if (fsl_queue->used) + return 0; - fsl_queue = fsl_qdma->queue[i]; - ret = fsl_qdma_pre_request_enqueue_comp_sd_desc(fsl_queue, - FSL_QDMA_COMMAND_BUFFER_SIZE, 64); + ret = fsl_qdma_pre_comp_sd_desc(fsl_queue); if (ret) return ret; - fsl_qdma->vchan_map[vchan] = i; - fsl_qdma->free_block_id++; + fsl_queue->used = 1; + return 0; } static int dpaa_qdma_configure(__rte_unused struct rte_dma_dev *dmadev, - __rte_unused const struct rte_dma_conf *dev_conf, - __rte_unused uint32_t conf_sz) + __rte_unused const struct rte_dma_conf *dev_conf, + __rte_unused uint32_t conf_sz) { return 0; } @@ -606,9 +597,9 @@ dpaa_qdma_close(__rte_unused struct rte_dma_dev *dev) static int dpaa_qdma_queue_setup(struct rte_dma_dev *dmadev, - uint16_t vchan, - __rte_unused const struct rte_dma_vchan_conf *conf, - __rte_unused uint32_t conf_sz) + uint16_t vchan, + __rte_unused const struct rte_dma_vchan_conf *conf, + __rte_unused uint32_t conf_sz) { struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; @@ -618,13 +609,13 @@ dpaa_qdma_queue_setup(struct rte_dma_dev *dmadev, static int dpaa_qdma_submit(void *dev_private, uint16_t vchan) { - struct fsl_qdma_engine *fsl_qdma = (struct fsl_qdma_engine *)dev_private; - struct fsl_qdma_queue *fsl_queue = - fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; - void *block = fsl_queue->queue_base; + struct fsl_qdma_engine *fsl_qdma = dev_private; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; + void *block = fsl_queue->block_vir; while (fsl_queue->pending) { - qdma_writel_be(FSL_QDMA_BCQMR_EI, block + FSL_QDMA_BCQMR(fsl_queue->id)); + qdma_writel(fsl_queue->le_cqmr | FSL_QDMA_BCQMR_EI, + block + FSL_QDMA_BCQMR(fsl_queue->queue_id)); fsl_queue->pending--; fsl_queue->stats.submitted++; } @@ -634,37 +625,31 @@ dpaa_qdma_submit(void *dev_private, uint16_t vchan) static int dpaa_qdma_enqueue(void *dev_private, uint16_t vchan, - rte_iova_t src, rte_iova_t dst, - uint32_t length, uint64_t flags) + rte_iova_t src, rte_iova_t dst, + uint32_t length, uint64_t flags) { - struct fsl_qdma_engine *fsl_qdma = (struct fsl_qdma_engine *)dev_private; - struct fsl_qdma_queue *fsl_queue = - fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; - int ret, idx; - - idx = (uint16_t)(fsl_queue->stats.submitted + fsl_queue->pending); + struct fsl_qdma_engine *fsl_qdma = dev_private; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; + int ret; - ret = fsl_qdma_enqueue_desc(fsl_queue, flags, (dma_addr_t)dst, (dma_addr_t)src, length); - if (ret < 0) - return ret; + ret = fsl_qdma_enqueue_desc(fsl_queue, flags, dst, src, length); - return idx; + return ret; } static uint16_t dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, - const uint16_t nb_cpls, uint16_t *last_idx, - enum rte_dma_status_code *st) + const uint16_t nb_cpls, uint16_t *last_idx, + enum rte_dma_status_code *st) { - struct fsl_qdma_engine *fsl_qdma = (struct fsl_qdma_engine *)dev_private; + struct fsl_qdma_engine *fsl_qdma = dev_private; int ret; - struct fsl_qdma_queue *fsl_queue = - fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; void *status = fsl_qdma->status_base; int intr; - ret = fsl_qdma_queue_transfer_complete(fsl_queue->queue_base, - nb_cpls, st); + ret = fsl_qdma_queue_transfer_complete(fsl_queue, + nb_cpls, st); if (!ret) { intr = qdma_readl_be(status + FSL_QDMA_DEDR); if (intr) { @@ -690,8 +675,12 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, } fsl_queue->stats.completed += ret; - if (last_idx != NULL) - *last_idx = (uint16_t)(fsl_queue->stats.completed - 1); + if (last_idx) { + if (unlikely(!fsl_queue->complete)) + *last_idx = fsl_queue->n_cq - 1; + else + *last_idx = fsl_queue->complete - 1; + } return ret; } @@ -699,21 +688,20 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, static uint16_t dpaa_qdma_dequeue(void *dev_private, - uint16_t vchan, const uint16_t nb_cpls, - uint16_t *last_idx, bool *has_error) + uint16_t vchan, const uint16_t nb_cpls, + uint16_t *last_idx, bool *has_error) { - struct fsl_qdma_engine *fsl_qdma = (struct fsl_qdma_engine *)dev_private; + struct fsl_qdma_engine *fsl_qdma = dev_private; int ret; - struct fsl_qdma_queue *fsl_queue = - fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; #ifdef CONFIG_RTE_DMA_DPAA_ERR_CHK void *status = fsl_qdma->status_base; int intr; #endif *has_error = false; - ret = fsl_qdma_queue_transfer_complete(fsl_queue->queue_base, - nb_cpls, NULL); + ret = fsl_qdma_queue_transfer_complete(fsl_queue, + nb_cpls, NULL); #ifdef CONFIG_RTE_DMA_DPAA_ERR_CHK if (!ret) { intr = qdma_readl_be(status + FSL_QDMA_DEDR); @@ -740,23 +728,27 @@ dpaa_qdma_dequeue(void *dev_private, } #endif fsl_queue->stats.completed += ret; - if (last_idx != NULL) - *last_idx = (uint16_t)(fsl_queue->stats.completed - 1); + if (last_idx) { + if (unlikely(!fsl_queue->complete)) + *last_idx = fsl_queue->n_cq - 1; + else + *last_idx = fsl_queue->complete - 1; + } + return ret; } static int -dpaa_qdma_stats_get(const struct rte_dma_dev *dmadev, uint16_t vchan, - struct rte_dma_stats *rte_stats, uint32_t size) +dpaa_qdma_stats_get(const struct rte_dma_dev *dmadev, + uint16_t vchan, struct rte_dma_stats *rte_stats, uint32_t size) { struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; - struct fsl_qdma_queue *fsl_queue = - fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; struct rte_dma_stats *stats = &fsl_queue->stats; if (size < sizeof(rte_stats)) return -EINVAL; - if (rte_stats == NULL) + if (!rte_stats) return -EINVAL; *rte_stats = *stats; @@ -768,10 +760,9 @@ static int dpaa_qdma_stats_reset(struct rte_dma_dev *dmadev, uint16_t vchan) { struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; - struct fsl_qdma_queue *fsl_queue = - fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; - fsl_queue->stats = (struct rte_dma_stats){0}; + memset(&fsl_queue->stats, 0, sizeof(struct rte_dma_stats)); return 0; } @@ -779,9 +770,8 @@ dpaa_qdma_stats_reset(struct rte_dma_dev *dmadev, uint16_t vchan) static uint16_t dpaa_qdma_burst_capacity(const void *dev_private, uint16_t vchan) { - const struct fsl_qdma_engine *fsl_qdma = dev_private; - struct fsl_qdma_queue *fsl_queue = - fsl_qdma->queue[fsl_qdma->vchan_map[vchan]]; + const struct fsl_qdma_engine *fsl_qdma = dev_private; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; return fsl_queue->n_cq - fsl_queue->pending; } @@ -804,8 +794,7 @@ dpaa_qdma_init(struct rte_dma_dev *dmadev) int ccsr_qdma_fd; int regs_size; int ret; - u32 i, k = 0; - int j; + uint32_t i, j, k; fsl_qdma->n_queues = QDMA_QUEUES * QDMA_BLOCKS; fsl_qdma->num_blocks = QDMA_BLOCKS; @@ -814,47 +803,63 @@ dpaa_qdma_init(struct rte_dma_dev *dmadev) ccsr_qdma_fd = open("/dev/mem", O_RDWR); if (unlikely(ccsr_qdma_fd < 0)) { DPAA_QDMA_ERR("Can not open /dev/mem for qdma CCSR map"); - return -1; + return ccsr_qdma_fd; } - regs_size = fsl_qdma->block_offset * (fsl_qdma->num_blocks + 2); + regs_size = fsl_qdma->block_offset * fsl_qdma->num_blocks; + regs_size += (QDMA_CTRL_REGION_SIZE + QDMA_STATUS_REGION_SIZE); phys_addr = QDMA_CCSR_BASE; - fsl_qdma->ctrl_base = mmap(NULL, regs_size, PROT_READ | - PROT_WRITE, MAP_SHARED, - ccsr_qdma_fd, phys_addr); + fsl_qdma->reg_base = mmap(NULL, regs_size, + PROT_READ | PROT_WRITE, MAP_SHARED, + ccsr_qdma_fd, phys_addr); close(ccsr_qdma_fd); - if (fsl_qdma->ctrl_base == MAP_FAILED) { - DPAA_QDMA_ERR("Can not map CCSR base qdma: Phys: %08" PRIx64 - "size %d\n", phys_addr, regs_size); - return -1; + if (fsl_qdma->reg_base == MAP_FAILED) { + DPAA_QDMA_ERR("Map qdma reg: Phys(0x%"PRIu64"), size(%d)", + phys_addr, regs_size); + return -ENOMEM; } - fsl_qdma->status_base = fsl_qdma->ctrl_base + QDMA_BLOCK_OFFSET; - fsl_qdma->block_base = fsl_qdma->status_base + QDMA_BLOCK_OFFSET; - - fsl_qdma->status = rte_malloc("status queue", sizeof(struct fsl_qdma_queue) * 4, 0); - if (!fsl_qdma->status) + fsl_qdma->ctrl_base = + fsl_qdma->reg_base + QDMA_CTRL_REGION_OFFSET; + fsl_qdma->status_base = + fsl_qdma->reg_base + QDMA_STATUS_REGION_OFFSET; + fsl_qdma->block_base = + fsl_qdma->status_base + QDMA_STATUS_REGION_SIZE; + + fsl_qdma->status = rte_malloc("status queue", + sizeof(struct fsl_qdma_queue) * QDMA_BLOCKS, 0); + if (!fsl_qdma->status) { + ret = -ENOMEM; goto err; + } - fsl_qdma->queue = rte_malloc("cmd queue", sizeof(struct fsl_qdma_queue) * 32, 0); + fsl_qdma->queue = rte_malloc("cmd queue", + sizeof(struct fsl_qdma_queue) * fsl_qdma->n_queues, 0); if (!fsl_qdma->queue) { rte_free(fsl_qdma->status); + ret = -ENOMEM; goto err; } + k = 0; for (i = 0; i < fsl_qdma->num_blocks; i++) { - fsl_qdma->status[i] = fsl_qdma_prep_status_queue(fsl_qdma, i); - if (!fsl_qdma->status[i]) + fsl_qdma->status[i] = + fsl_qdma_prep_status_queue(fsl_qdma, i); + if (!fsl_qdma->status[i]) { + ret = -ENOMEM; goto mem_free; + } j = 0; - for (k = (i * QDMA_QUEUES); k < ((i * QDMA_QUEUES) + QDMA_QUEUES); k++) { - fsl_qdma->queue[k] = fsl_qdma_alloc_queue_resources(fsl_qdma, j, i); - if (!fsl_qdma->queue[k]) + for (j = 0; j < QDMA_QUEUES; j++) { + fsl_qdma->queue[k] = + fsl_qdma_alloc_queue_resources(fsl_qdma, j, i); + if (!fsl_qdma->queue[k]) { + ret = -ENOMEM; goto mem_free; - j++; + } + k++; } - } ret = fsl_qdma_reg_init(fsl_qdma); @@ -867,17 +872,20 @@ dpaa_qdma_init(struct rte_dma_dev *dmadev) return 0; mem_free: - for (i = 0; i < fsl_qdma->num_blocks; i++) { - for (k = (i * QDMA_QUEUES); k < ((i * QDMA_QUEUES) + QDMA_QUEUES); k++) - fsl_qdma_free_queue_resources(fsl_qdma->queue[k]); - fsl_qdma_free_status_queue(fsl_qdma->status[i]); - } - rte_free(fsl_qdma->status); + for (j = 0; j < k; j++) + fsl_qdma_free_queue_resources(fsl_qdma->queue[j]); + + for (j = 0; j < i; j++) + fsl_qdma_free_status_queue(fsl_qdma->status[j]); + + if (fsl_qdma->status) + rte_free(fsl_qdma->status); err: - rte_free(fsl_qdma->queue); + if (fsl_qdma->queue) + rte_free(fsl_qdma->queue); munmap(fsl_qdma->ctrl_base, regs_size); - return -1; + return ret; } static int @@ -921,13 +929,13 @@ dpaa_qdma_remove(struct rte_dpaa_device *dpaa_dev) { struct rte_dma_dev *dmadev = dpaa_dev->dmadev; struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; - uint32_t i, k; + uint32_t i; - for (i = 0; i < fsl_qdma->num_blocks; i++) { - for (k = (i * QDMA_QUEUES); k < ((i * QDMA_QUEUES) + QDMA_QUEUES); k++) - fsl_qdma_free_queue_resources(fsl_qdma->queue[k]); + for (i = 0; i < fsl_qdma->num_blocks; i++) fsl_qdma_free_status_queue(fsl_qdma->status[i]); - } + + for (i = 0; i < fsl_qdma->num_blocks * QDMA_QUEUES; i++) + fsl_qdma_free_queue_resources(fsl_qdma->queue[i]); rte_free(fsl_qdma->queue); rte_free(fsl_qdma->status); diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 8a4517a70a..25954ef3a4 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -11,7 +11,6 @@ #define BIT(nr) (1UL << (nr)) #endif -#define CORE_NUMBER 4 #define RETRIES 5 #ifndef GENMASK @@ -20,6 +19,12 @@ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) #endif +#define QDMA_CTRL_REGION_OFFSET 0 +#define QDMA_CTRL_REGION_SIZE 0x10000 +#define QDMA_STATUS_REGION_OFFSET \ + (QDMA_CTRL_REGION_OFFSET + QDMA_CTRL_REGION_SIZE) +#define QDMA_STATUS_REGION_SIZE 0x10000 + #define FSL_QDMA_DMR 0x0 #define FSL_QDMA_DSR 0x4 #define FSL_QDMA_DEDR 0xe04 @@ -54,19 +59,18 @@ #define FSL_QDMA_QUEUE_MAX 8 #define FSL_QDMA_BCQMR_EN 0x80000000 -#define FSL_QDMA_BCQMR_EI_BE 0x40 +#define FSL_QDMA_BCQMR_EI 0x40000000 + #define FSL_QDMA_BCQMR_CD_THLD(x) ((x) << 20) #define FSL_QDMA_BCQMR_CQ_SIZE(x) ((x) << 16) /* Update the value appropriately whenever QDMA_QUEUE_SIZE * changes. */ -#define FSL_QDMA_BCQMR_EI 0x20c0 #define FSL_QDMA_BCQSR_QF_XOFF_BE 0x1000100 #define FSL_QDMA_BSQMR_EN 0x80000000 -#define FSL_QDMA_BSQMR_DI_BE 0x40 #define FSL_QDMA_BSQMR_CQ_SIZE(x) ((x) << 16) #define FSL_QDMA_BSQMR_DI 0xc0 @@ -75,8 +79,6 @@ #define FSL_QDMA_DMR_DQD 0x40000000 #define FSL_QDMA_DSR_DB 0x80000000 -#define FSL_QDMA_COMMAND_BUFFER_SIZE 64 -#define FSL_QDMA_DESCRIPTOR_BUFFER_SIZE 32 #define FSL_QDMA_CIRCULAR_DESC_SIZE_MIN 64 #define FSL_QDMA_CIRCULAR_DESC_SIZE_MAX 16384 #define FSL_QDMA_QUEUE_NUM_MAX 8 @@ -106,16 +108,11 @@ /* qdma engine attribute */ #define QDMA_QUEUE_SIZE 64 -#define QDMA_STATUS_SIZE 64 +#define QDMA_STATUS_SIZE QDMA_QUEUE_SIZE #define QDMA_CCSR_BASE 0x8380000 -#define VIRT_CHANNELS 32 #define QDMA_BLOCK_OFFSET 0x10000 #define QDMA_BLOCKS 4 #define QDMA_QUEUES 8 -#define QDMA_DELAY 1000 -#define QDMA_SGF_SRC_OFF 2 -#define QDMA_SGF_DST_OFF 3 -#define QDMA_DESC_OFF 1 #define QDMA_QUEUE_CR_WM 32 #define QDMA_BIG_ENDIAN 1 @@ -134,64 +131,76 @@ #define FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma_engine, x) \ (((fsl_qdma_engine)->block_offset) * (x)) -typedef void (*dma_call_back)(void *params); - /* qDMA Command Descriptor Formats */ struct fsl_qdma_format { - __le32 status; /* ser, status */ - __le32 cfg; /* format, offset */ + uint32_t status; /* ser, status */ + uint32_t cfg; /* format, offset */ union { struct { - __le32 addr_lo; /* low 32-bits of 40-bit address */ - u8 addr_hi; /* high 8-bits of 40-bit address */ - u8 __reserved1[2]; - u8 cfg8b_w1; /* dd, queue */ + uint32_t addr_lo; /* low 32-bits of 40-bit address */ + uint8_t addr_hi; /* high 8-bits of 40-bit address */ + uint8_t __reserved1[2]; + uint8_t cfg8b_w1; /* dd, queue */ }; - __le64 data; + uint64_t data; }; }; /* qDMA Source Descriptor Format */ struct fsl_qdma_sdf { - __le32 rev3; - __le32 cfg; /* rev4, bit[0-11] - ssd, bit[12-23] sss */ - __le32 rev5; - __le32 cmd; + uint32_t rev3; + uint32_t cfg; /* rev4, bit[0-11] - ssd, bit[12-23] sss */ + uint32_t rev5; + uint32_t cmd; }; /* qDMA Destination Descriptor Format */ struct fsl_qdma_ddf { - __le32 rev1; - __le32 cfg; /* rev2, bit[0-11] - dsd, bit[12-23] - dss */ - __le32 rev3; - __le32 cmd; + uint32_t rev1; + uint32_t cfg; /* rev2, bit[0-11] - dsd, bit[12-23] - dss */ + uint32_t rev3; + uint32_t cmd; +}; + +struct fsl_qdma_df { + struct fsl_qdma_sdf sdf; + struct fsl_qdma_ddf ddf; +}; + +struct fsl_qdma_cmpd_ft { + struct fsl_qdma_format desc_buf; + struct fsl_qdma_format desc_sbuf; + struct fsl_qdma_format desc_dbuf; }; struct fsl_qdma_queue { - struct fsl_qdma_format *virt_head; - void **virt_addr; - u8 ci; - u8 n_cq; - u8 id; - void *queue_base; - struct fsl_qdma_format *cq; - struct rte_dma_stats stats; - u8 pending; - dma_addr_t bus_addr; - void **desc_virt_addr; + struct fsl_qdma_format *cmd_desc; + int used; + struct fsl_qdma_cmpd_ft **ft; + uint16_t ci; + uint16_t complete; + uint16_t n_cq; + uint8_t block_id; + uint8_t queue_id; + void *block_vir; + uint32_t le_cqmr; + struct fsl_qdma_format *cq; + struct rte_dma_stats stats; + uint8_t pending; + dma_addr_t bus_addr; + struct fsl_qdma_df **df; }; struct fsl_qdma_engine { - void *ctrl_base; - void *status_base; - void *block_base; - u32 n_queues; - struct fsl_qdma_queue **queue; - struct fsl_qdma_queue **status; - u32 num_blocks; - u8 free_block_id; - u32 vchan_map[4]; - int block_offset; + void *reg_base; + void *ctrl_base; + void *status_base; + void *block_base; + uint32_t n_queues; + struct fsl_qdma_queue **queue; + struct fsl_qdma_queue **status; + uint32_t num_blocks; + int block_offset; }; #endif /* _DPAA_QDMA_H_ */ From patchwork Mon Jul 22 11:58:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142595 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1FC3745681; Mon, 22 Jul 2024 14:01:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 04E4E402AC; Mon, 22 Jul 2024 13:59:44 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013002.outbound.protection.outlook.com [52.101.67.2]) by mails.dpdk.org (Postfix) with ESMTP id 62D0340431 for ; Mon, 22 Jul 2024 13:59:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yjwtQdVYgy/9orXd3pJOEtDzJbfwCG7BnaufYAcvXlDQWztMvUVviowSlyGHwncoUidXxtMFhzvKJcZ11MpgRChVub9kGStlJ4hPu6rVjliGlXNvwhcQcShIVS1eJARbWDL5dI0k7Ah1KUmIFGi3VjJG2Drfetb6yPFgPnmzW3fsQ1zYOm2SBwoZqghIF1YnQgi6V/TlxaB0VZradEn6Ejk/H0EQ/Aw33q/1WsUs0EJcL9Se+5d+6GAPuVXvZKRW1TrCS+7bdmWYfVDVZhg9dbFD+7K68Yh6dRi2btEGQsCEYyZWLyT12bMkuG9cE1PaFnQK14UjAFdwmU7dNwCmDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OsF71cw1ox6IA9ZNtRsZFMh7CbPJfz7bvxtSblYVz2Y=; b=uvEvoobPzddOReEDSr+gETp8bZhfniZb8YL1lNKkZAM1slQ6yRLWL6WhMaASgWihsFMuksTGWDvhFzOgEz4U7dEwVDHvAFyoen8fKgtvgD2hq8VVA7zBC8xAyztrnllt4g2/Stg52eB+VWJDFVnTI+QNq9ZIn9gxwMFQTN2k6ZZiDpVuvubS8/RkICRlYlV9UyslP2RTzjfmAZWwc0UfVT5a4BlgMMH+rlYc9JEULAlDr0nzxBboI8cHFKm5pcbQXkAnwROX+9GdJHFjGc+6UvMV55i6YejBE+PDriHnil2z3KBWRF/lY6HGs0/c4uXS+bsorSPaEG5kfhnYIEP4UA== 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=OsF71cw1ox6IA9ZNtRsZFMh7CbPJfz7bvxtSblYVz2Y=; b=GEcVU/Rjekn26HrQWloLgpadgGsWfMJkSM2hYx8kpArQCGhuFnfwxEQdv6ciAr67jqLrJJ9aSO055FNCp1lroJjQpnsb8EL4janmsaz2TKEUz2Bk89w6hk9NDEA9oDQoqO3d5l0vdXWkfUn3kYX6gMwX7zGHtoKFlI+0kXCiUts= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by DUZPR04MB9917.eurprd04.prod.outlook.com (2603:10a6:10:4d8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Mon, 22 Jul 2024 11:59:40 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:40 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v2 21/30] dma/dpaa: dequeue status queue Date: Mon, 22 Jul 2024 17:28:34 +0530 Message-Id: <20240722115843.1830105-22-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9917:EE_ X-MS-Office365-Filtering-Correlation-Id: dd3f7d9f-1021-4fa5-d900-08dcaa45c442 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: kOuSCZk+gOmGjKxJYEeoJ/EEGiNUI0P8L5ofmFskrdNRf+R+v98XGMwkwqn5dSltGBrWiMi8TtKR7rYeWaErsuqQNuMGc+0pRxFyJaFN+rG/24WCm+QlQ2XQEBqfT6Ulxsbok/KQ5a0kHKTVDMM/k9SgPu0eVa4rki/R2ObV/LeGYui7YRqpU1gtaxi86oz2ttJ8dtsdAkJMdFlTugUHJStGHU5IaG5xirsnI7pW1w4Ms0Zyfzi86DDD3i2AxQMcOgmEF2Ae8ddbY7MWz0psUjVyHRNpRQscbnGbLDMEQNxWWoEkD8bugmO+uFEsIBcN6OCDzDbWozBbGDMPhpmPJGCpu8j9Og9hnZm1qbsPtGMljMuCi+xhKeSvnjNBTTnDLoa99ut8uAG0BgQwlVddhCxbQXgO5E0koHGrCf+KCjdVXDRODWFSkrD8hJJmGhX0t5tpya/+T81rcgTZrqf8ULvm8rAPoKzFLybI4FFAOlJdsdyvldJxNV+Pjop5dq2FSKs2KcpUq+P9TZk6SFQw9xWc8U5w1KSWs5PDQpnxgCB8zPC0rhkF6ziIA1yhUXorIW1Eow1kL7gxZjq7Xfz1cCHYBsEGbNct52EdBe4NiI/qGblxLejoC2RHNjcoqPoNc1ZMFO/c9Kx0FCwNhYjzjJ4kv5Q4EZMBMBMgZcxCNFAZD9YvOj+11FBuSkrcFsGEtXvDD00U994uQm9ccPo7w8IG3czx0rua/GZKZ4rY0y2OEw5Px600foqIoix7toCK2elOibWCnJt7mquFCAVG5Sn6PYiej0MTcXE0nfkxqaLqGwq/uWyoS4yuK81njiYqV2/JyxehCkQwBDmdINQF2XyLEsX81qHpxQQaUFZxuPpi1I8PTOxktSpPmbwzVwzZtYhU/Hs0aXKo1a2+ftGo7jCYDTuYjJarcUxrvE6TDSV8OSRO6CrFM0jvM2KanJrGcbVLulksB5JQw6kkZTurKsr14ET6FDFJq+UuuM+2cBYKyFApR8EdVj0AAnRfe7jU9QcoVx0u+o5nnFNBfp9ydLaKrHjMWHKnStZHad2b+ky8n5uripzDkaCQXybPIAvSfApp2S2WM99Wt/Z+tuqrkSU6Q0vlp4V2bxz19l1n7aqcqFjIh7vSLvKjv/aa+JFLI7+UAtqs/ZtmGJ7ORBBP/H1RfgH6gr1itbp+HQ0mBnYXSD80xzAvLQYgCQewYIawMsnOPAUOQ2J9gyQqwLzxiImUUbGkuSgUDvGKHZ9UYC0gaPJCE0x9NHBOhXn8e2vhMw7XT3k5CHR64Ob66v8MNIsN3eexbfe2c2B50+caQxI+qa4ok/fp0cZ7YScHJJCRvsX4hIQqd9IER/mgASCerIo8noirhx99ShWJ8lqREbGfL0NdZCkKhmotKP0MabsyoZ76yP5mNcaYI6QrK4Y2Ow== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ACaoe1lwfeFrhhrR+FFaS2W7Vw/UmsHkqT0nreXUEdvOuXPnP0QwWDHRMpdiMthh8+JhD8PWOHVQpKMoo/0yJzJ36c/C1T3giTXqMXk+x1xMbei+VfLPDlVzfanuutlANPaU/7/vo7jkCp8XD7+u4f1aoMgqr8Qw9P6uOKP4TDYDXc2OEePdwZrjOK+In42Msv2Zfemx2Yw0ncmlKp+wXazCjHy+Alla3UHMeQMxB24+SlRl3Dv/rJNu0bAjr6LATAln1w4Onwf4ajy8UV2CzVEegg5IR0z3AOrAGjey+pkq8rMjzeivgImdqdMjb5pbT0aaxAL6HKADzGF4j0SKW8l/OWL3hwSGSlW1Nm00pfbUdcXeDljF5BdYhXTj4zRbcI5NDOYMpwdR+NI4O4ZRma1ezSZp0pZI6Q0JN7KiID4AG+y0iWfSjRFYRI2nlrDMnp4VcciHxsBOeRZ1O8dZVboA0jMwUu0dqNv1fieryHcOz7VSfDuwVjjA12AmihNo8xOVDhBCPDo+lWlCdrszLhgGqs5PAZn6tMJ3mL7kib3xicAEnIPP7bVybIDYCtEWalOUtvREw8RDmKNn6ZeY+E529tNcw1VUsi2WhtuiSU9G6FtYblOydP73mkzZ/lOyuco5udZp+YvqL0fQWOm10IN/R+dKl1I++fU8G2B3kVP5z4wEQOqUqI/JDcEF1nJeNDcCRAlyECdWno9eojjf08FfC/T5yARLrLuM6Jr7/LS1ibqUZz92PB0stnDZguhKQ125Lr8RAAMjxmsJR2ujWUO3lzSsJRmfdN52mAExHcMXmMK8zmZ9jqEDIS+TX6ulpk2XPAth3oJtoe6cpml3YtmaybhJyfXEmhJ8dw4ZeRyuP/CD5Tv5POaVXYdYdi1iIxgBm+DYDWIfkL5rhQJOVea8f/FibgHWotXxcLoLUW1ag+AriWBkeNPtm4ZQidszE5cBUqSPaTJHE/z/66CnV/dQBwwTWYQBOZT2ue8ZHoePy4QpRoTz9PK6xNl89JF+6BB3gS0HD++QzLHqfxafRoV8EV2+SOyooHOT4/pR2dC6wiKoCaPuCDSZcg5goD7riB/AyW/Eznbn6zLXkMF68TFQbOXLLtWY4UWNw4WxRtRTwrn6VaGxe3gbT/rntkQNjAzUAf0kxeHuUC0G0AJ91a5xidXt6toKLlauqJ1wkaa74D9kNKlXdEwmlhcGEXjYaRFkeW4eWSmTrwDPonOr0NQtGGuBeJYo8Rne+/yPjIEl5rRRGXS2qC5BTaybb3aK+Dg4WtvbzRUb7AhNGt5kNPhgpsxwD93qQ3DeGb8KLVPmGxHqPDTqBTgv/zSw1oSKjEbkJsTVokY1L1Uy8PYBv7qnBIiGD6nONJ5ZFCfleTiQfVnCd+Q9been/cY3NU6jB1lPhCD5/LlTplisHf5uXYfX9oDHQWW9w0UL8bfJfQ842doheYD2TQUZBlb9Ev5A4D0jUldJB1utWBz44wFjw9iMEunHabP/uMf6KuZB9yQeUJt2412gy4tH1YPSU8xSHV1T380KCQQJnvfW8kdJesr9Qs2KoHNB/74zUphS48LuhoWhcqYogSLoN+oXsrVq X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd3f7d9f-1021-4fa5-d900-08dcaa45c442 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:40.4979 (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: HtIvvdRPPk7EMN+XvzTqE1EPp/Mjld6Nb2dWDRMKrOkLimx6Tgx82mGpiSPpePSq X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9917 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 From: Jun Yang To support multiple command queues of each block, status queue need support to notify which command queue of block is completed. The multiple command queues are balanced to blocks in setup. If multiple command queues are enabled in one block, de-queue status is performed instead of checking completion. DQ operation is not performed in silent mode. Signed-off-by: Jun Yang --- drivers/dma/dpaa/dpaa_qdma.c | 351 +++++++++++++++++++++-------------- drivers/dma/dpaa/dpaa_qdma.h | 38 +++- 2 files changed, 242 insertions(+), 147 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index dc17aa4520..825dead5cf 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -34,6 +34,30 @@ qdma_ccdf_set_ser(struct fsl_qdma_format *ccdf, int status) ccdf->status = rte_cpu_to_le_32(QDMA_CCDF_SER | status); } +static inline void +qdma_ccdf_set_queue(struct fsl_qdma_format *ccdf, + uint8_t queue_idx) +{ + ccdf->queue = queue_idx; +} + +static inline int +qdma_ccdf_get_queue(struct fsl_qdma_format *ccdf, + uint8_t *queue_idx) +{ + uint64_t addr = ((uint64_t)ccdf->addr_hi) << 32 | ccdf->addr_lo; + + if (addr && queue_idx) + *queue_idx = ccdf->queue; + if (addr) { + ccdf->addr_hi = 0; + ccdf->addr_lo = 0; + return true; + } + + return false; +} + static inline void qdma_csgf_set_len(struct fsl_qdma_format *csgf, int len) { @@ -110,7 +134,8 @@ dma_pool_alloc(int size, int aligned, dma_addr_t *phy_addr) if (!virt_addr) return NULL; - *phy_addr = rte_mem_virt2iova(virt_addr); + if (phy_addr) + *phy_addr = rte_mem_virt2iova(virt_addr); return virt_addr; } @@ -121,6 +146,7 @@ dma_pool_alloc(int size, int aligned, dma_addr_t *phy_addr) static int fsl_qdma_pre_comp_sd_desc(struct fsl_qdma_queue *queue) { + struct fsl_qdma_engine *fsl_qdma = queue->engine; struct fsl_qdma_sdf *sdf; struct fsl_qdma_ddf *ddf; struct fsl_qdma_format *ccdf; @@ -175,7 +201,9 @@ fsl_qdma_pre_comp_sd_desc(struct fsl_qdma_queue *queue) ccdf = queue->cmd_desc; qdma_desc_addr_set64(ccdf, phy_ft); qdma_ccdf_set_format(ccdf, 0); - qdma_ccdf_set_ser(ccdf, 0); + if (!fsl_qdma->is_silent) + qdma_ccdf_set_ser(ccdf, 0); + qdma_ccdf_set_queue(ccdf, queue->queue_id); queue->cmd_desc++; } queue->cmd_desc = head; @@ -192,105 +220,91 @@ fsl_qdma_pre_comp_sd_desc(struct fsl_qdma_queue *queue) return -ENOMEM; } -static struct fsl_qdma_queue * +static int fsl_qdma_alloc_queue_resources(struct fsl_qdma_engine *fsl_qdma, int queue_id, int block_id) { - struct fsl_qdma_queue *queue_temp; + struct fsl_qdma_queue *cmd_queue; uint32_t queue_size; - queue_temp = rte_zmalloc("qdma: queue head", - sizeof(struct fsl_qdma_queue), 0); - if (!queue_temp) { - DPAA_QDMA_ERR("no memory to allocate queues\n"); - return NULL; - } + cmd_queue = &fsl_qdma->cmd_queues[block_id][queue_id]; + cmd_queue->engine = fsl_qdma; + queue_size = sizeof(struct fsl_qdma_format) * QDMA_QUEUE_SIZE; - queue_temp->cq = dma_pool_alloc(queue_size, - queue_size, &queue_temp->bus_addr); - if (!queue_temp->cq) { - rte_free(queue_temp); - return NULL; - } + cmd_queue->cq = dma_pool_alloc(queue_size, + queue_size, &cmd_queue->bus_addr); + if (!cmd_queue->cq) + return -ENOMEM; - memset(queue_temp->cq, 0x0, queue_size); + memset(cmd_queue->cq, 0x0, queue_size); - queue_temp->block_vir = fsl_qdma->block_base + + cmd_queue->block_vir = fsl_qdma->block_base + FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, block_id); - queue_temp->n_cq = QDMA_QUEUE_SIZE; - queue_temp->queue_id = queue_id; - queue_temp->pending = 0; - queue_temp->cmd_desc = queue_temp->cq; - queue_temp->ft = rte_malloc("Compound Frame Table", + cmd_queue->n_cq = QDMA_QUEUE_SIZE; + cmd_queue->queue_id = queue_id; + cmd_queue->block_id = block_id; + cmd_queue->pending = 0; + cmd_queue->cmd_desc = cmd_queue->cq; + cmd_queue->ft = rte_malloc("Compound Frame Table", sizeof(void *) * QDMA_QUEUE_SIZE, 0); - if (!queue_temp->ft) { - rte_free(queue_temp->cq); - rte_free(queue_temp); - return NULL; + if (!cmd_queue->ft) { + rte_free(cmd_queue->cq); + return -ENOMEM; } - queue_temp->df = rte_malloc("Descriptor Buffer", + cmd_queue->df = rte_malloc("Descriptor Buffer", sizeof(void *) * QDMA_QUEUE_SIZE, 0); - if (!queue_temp->df) { - rte_free(queue_temp->ft); - rte_free(queue_temp->cq); - rte_free(queue_temp); - return NULL; + if (!cmd_queue->df) { + rte_free(cmd_queue->ft); + rte_free(cmd_queue->cq); + return -ENOMEM; } - memset(&queue_temp->stats, 0, sizeof(struct rte_dma_stats)); + memset(&cmd_queue->stats, 0, sizeof(struct rte_dma_stats)); - return queue_temp; + return 0; } static void -fsl_qdma_free_queue_resources(struct fsl_qdma_queue *queue) +fsl_qdma_free_cmdq_res(struct fsl_qdma_queue *queue) { rte_free(queue->df); rte_free(queue->ft); rte_free(queue->cq); - rte_free(queue); } -static struct fsl_qdma_queue * +static void +fsl_qdma_free_stq_res(struct fsl_qdma_status_queue *queue) +{ + rte_free(queue->cq); +} + + +static int fsl_qdma_prep_status_queue(struct fsl_qdma_engine *fsl_qdma, uint32_t block_id) { - struct fsl_qdma_queue *status_head; + struct fsl_qdma_status_queue *status; uint32_t status_size; - status_size = QDMA_STATUS_SIZE * sizeof(struct fsl_qdma_format); + status = &fsl_qdma->stat_queues[block_id]; + status->engine = fsl_qdma; - status_head = rte_zmalloc("qdma: status head", - sizeof(*status_head), 0); - if (!status_head) - return NULL; + status_size = QDMA_STATUS_SIZE * sizeof(struct fsl_qdma_format); - /* - * Buffer for queue command - */ - status_head->cq = dma_pool_alloc(status_size, - status_size, &status_head->bus_addr); + status->cq = dma_pool_alloc(status_size, + status_size, &status->bus_addr); - if (!status_head->cq) { - rte_free(status_head); - return NULL; - } + if (!status->cq) + return -ENOMEM; - memset(status_head->cq, 0x0, status_size); - status_head->n_cq = status_size; - status_head->cmd_desc = status_head->cq; - status_head->block_id = block_id; - status_head->block_vir = fsl_qdma->block_base + + memset(status->cq, 0x0, status_size); + status->n_cq = QDMA_STATUS_SIZE; + status->complete = 0; + status->block_id = block_id; + status->block_vir = fsl_qdma->block_base + FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, block_id); - return status_head; -} - -static void -fsl_qdma_free_status_queue(struct fsl_qdma_queue *status) -{ - rte_free(status->cq); - rte_free(status); + return 0; } static int @@ -358,6 +372,7 @@ fsl_qdma_queue_transfer_complete(struct fsl_qdma_queue *fsl_queue, fsl_queue->complete++; if (unlikely(fsl_queue->complete >= fsl_queue->n_cq)) fsl_queue->complete = 0; + fsl_queue->stats.completed++; count++; } @@ -368,9 +383,10 @@ static int fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) { struct fsl_qdma_queue *temp; + struct fsl_qdma_status_queue *temp_stat; void *ctrl = fsl_qdma->ctrl_base; uint8_t *block; - uint32_t i, j, k = 0; + uint32_t i, j; uint32_t reg; int ret, val; @@ -385,7 +401,7 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) block = fsl_qdma->block_base + FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, j); for (i = 0; i < QDMA_QUEUES; i++) { - temp = fsl_qdma->queue[k]; + temp = &fsl_qdma->cmd_queues[j][i]; /* * Initialize Command Queue registers to * point to the first @@ -409,7 +425,6 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) reg |= FSL_QDMA_BCQMR_CQ_SIZE(ilog2_qsize(temp->n_cq)); temp->le_cqmr = reg; qdma_writel(reg, block + FSL_QDMA_BCQMR(i)); - k++; } /* @@ -419,7 +434,7 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) */ qdma_writel(FSL_QDMA_SQCCMR_ENTER_WM, - block + FSL_QDMA_SQCCMR); + block + FSL_QDMA_SQCCMR); /* * Initialize status queue registers to point to the first @@ -428,14 +443,14 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) * Enqueue Pointer Address Registers */ - temp = fsl_qdma->status[j]; - qdma_writel(upper_32_bits(temp->bus_addr), + temp_stat = &fsl_qdma->stat_queues[j]; + qdma_writel(upper_32_bits(temp_stat->bus_addr), block + FSL_QDMA_SQEEPAR); - qdma_writel(lower_32_bits(temp->bus_addr), + qdma_writel(lower_32_bits(temp_stat->bus_addr), block + FSL_QDMA_SQEPAR); - qdma_writel(upper_32_bits(temp->bus_addr), + qdma_writel(upper_32_bits(temp_stat->bus_addr), block + FSL_QDMA_SQEDPAR); - qdma_writel(lower_32_bits(temp->bus_addr), + qdma_writel(lower_32_bits(temp_stat->bus_addr), block + FSL_QDMA_SQDPAR); /* Desiable status queue interrupt. */ @@ -445,7 +460,7 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) /* Initialize the status queue mode. */ reg = FSL_QDMA_BSQMR_EN; - val = ilog2_qsize(temp->n_cq); + val = ilog2_qsize(temp_stat->n_cq); reg |= FSL_QDMA_BSQMR_CQ_SIZE(val); qdma_writel(reg, block + FSL_QDMA_BSQMR); } @@ -560,8 +575,29 @@ static int dpaa_get_channel(struct fsl_qdma_engine *fsl_qdma, uint16_t vchan) { - int ret; - struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; + int ret, i, j, found = 0; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; + + if (fsl_queue) { + found = 1; + goto queue_found; + } + + for (i = 0; i < QDMA_BLOCKS; i++) { + for (j = 0; j < QDMA_QUEUES; j++) { + fsl_queue = &fsl_qdma->cmd_queues[i][j]; + + if (fsl_queue->channel_id == vchan) { + found = 1; + fsl_qdma->chan[vchan] = fsl_queue; + goto queue_found; + } + } + } + +queue_found: + if (!found) + return -ENXIO; if (fsl_queue->used) return 0; @@ -571,15 +607,19 @@ dpaa_get_channel(struct fsl_qdma_engine *fsl_qdma, return ret; fsl_queue->used = 1; + fsl_qdma->block_queues[fsl_queue->block_id]++; return 0; } static int -dpaa_qdma_configure(__rte_unused struct rte_dma_dev *dmadev, - __rte_unused const struct rte_dma_conf *dev_conf, +dpaa_qdma_configure(struct rte_dma_dev *dmadev, + const struct rte_dma_conf *dev_conf, __rte_unused uint32_t conf_sz) { + struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; + + fsl_qdma->is_silent = dev_conf->enable_silent; return 0; } @@ -610,7 +650,7 @@ static int dpaa_qdma_submit(void *dev_private, uint16_t vchan) { struct fsl_qdma_engine *fsl_qdma = dev_private; - struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; void *block = fsl_queue->block_vir; while (fsl_queue->pending) { @@ -629,7 +669,7 @@ dpaa_qdma_enqueue(void *dev_private, uint16_t vchan, uint32_t length, uint64_t flags) { struct fsl_qdma_engine *fsl_qdma = dev_private; - struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; int ret; ret = fsl_qdma_enqueue_desc(fsl_queue, flags, dst, src, length); @@ -637,6 +677,42 @@ dpaa_qdma_enqueue(void *dev_private, uint16_t vchan, return ret; } +static uint16_t +dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma, + uint8_t block_id) +{ + struct fsl_qdma_status_queue *stat_queue; + struct fsl_qdma_queue *cmd_queue; + struct fsl_qdma_format *cq; + uint16_t start, count = 0; + uint8_t qid; + int ret; + + stat_queue = &fsl_qdma->stat_queues[block_id]; + cq = stat_queue->cq; + start = stat_queue->complete; + + do { + ret = qdma_ccdf_get_queue(&cq[start], &qid); + if (ret == true) { + cmd_queue = &fsl_qdma->cmd_queues[block_id][qid]; + cmd_queue->stats.completed++; + cmd_queue->complete++; + if (unlikely(cmd_queue->complete == cmd_queue->n_cq)) + cmd_queue->complete = 0; + start++; + if (unlikely(start == stat_queue->n_cq)) + start = 0; + count++; + } else { + break; + } + } while (1); + stat_queue->complete = start; + + return count; +} + static uint16_t dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, const uint16_t nb_cpls, uint16_t *last_idx, @@ -644,12 +720,22 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, { struct fsl_qdma_engine *fsl_qdma = dev_private; int ret; - struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; void *status = fsl_qdma->status_base; int intr; - ret = fsl_qdma_queue_transfer_complete(fsl_queue, - nb_cpls, st); + if (unlikely(fsl_qdma->is_silent)) { + DPAA_QDMA_WARN("Can't dq in silent mode\n"); + return 0; + } + + if (fsl_qdma->block_queues[fsl_queue->block_id] > 1) { + ret = dpaa_qdma_block_dequeue(fsl_qdma, + fsl_queue->block_id); + } else { + ret = fsl_qdma_queue_transfer_complete(fsl_queue, + nb_cpls, st); + } if (!ret) { intr = qdma_readl_be(status + FSL_QDMA_DEDR); if (intr) { @@ -674,7 +760,6 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, } } - fsl_queue->stats.completed += ret; if (last_idx) { if (unlikely(!fsl_queue->complete)) *last_idx = fsl_queue->n_cq - 1; @@ -693,15 +778,26 @@ dpaa_qdma_dequeue(void *dev_private, { struct fsl_qdma_engine *fsl_qdma = dev_private; int ret; - struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; #ifdef CONFIG_RTE_DMA_DPAA_ERR_CHK void *status = fsl_qdma->status_base; int intr; #endif + if (unlikely(fsl_qdma->is_silent)) { + DPAA_QDMA_WARN("Can't dq in silent mode\n"); + + return 0; + } + *has_error = false; - ret = fsl_qdma_queue_transfer_complete(fsl_queue, - nb_cpls, NULL); + if (fsl_qdma->block_queues[fsl_queue->block_id] > 1) { + ret = dpaa_qdma_block_dequeue(fsl_qdma, + fsl_queue->block_id); + } else { + ret = fsl_qdma_queue_transfer_complete(fsl_queue, + nb_cpls, NULL); + } #ifdef CONFIG_RTE_DMA_DPAA_ERR_CHK if (!ret) { intr = qdma_readl_be(status + FSL_QDMA_DEDR); @@ -727,7 +823,6 @@ dpaa_qdma_dequeue(void *dev_private, } } #endif - fsl_queue->stats.completed += ret; if (last_idx) { if (unlikely(!fsl_queue->complete)) *last_idx = fsl_queue->n_cq - 1; @@ -743,7 +838,7 @@ dpaa_qdma_stats_get(const struct rte_dma_dev *dmadev, uint16_t vchan, struct rte_dma_stats *rte_stats, uint32_t size) { struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; - struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; struct rte_dma_stats *stats = &fsl_queue->stats; if (size < sizeof(rte_stats)) @@ -760,7 +855,7 @@ static int dpaa_qdma_stats_reset(struct rte_dma_dev *dmadev, uint16_t vchan) { struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; - struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; memset(&fsl_queue->stats, 0, sizeof(struct rte_dma_stats)); @@ -771,7 +866,7 @@ static uint16_t dpaa_qdma_burst_capacity(const void *dev_private, uint16_t vchan) { const struct fsl_qdma_engine *fsl_qdma = dev_private; - struct fsl_qdma_queue *fsl_queue = fsl_qdma->queue[vchan]; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; return fsl_queue->n_cq - fsl_queue->pending; } @@ -827,37 +922,19 @@ dpaa_qdma_init(struct rte_dma_dev *dmadev) fsl_qdma->block_base = fsl_qdma->status_base + QDMA_STATUS_REGION_SIZE; - fsl_qdma->status = rte_malloc("status queue", - sizeof(struct fsl_qdma_queue) * QDMA_BLOCKS, 0); - if (!fsl_qdma->status) { - ret = -ENOMEM; - goto err; - } - - fsl_qdma->queue = rte_malloc("cmd queue", - sizeof(struct fsl_qdma_queue) * fsl_qdma->n_queues, 0); - if (!fsl_qdma->queue) { - rte_free(fsl_qdma->status); - ret = -ENOMEM; - goto err; + for (i = 0; i < QDMA_BLOCKS; i++) { + ret = fsl_qdma_prep_status_queue(fsl_qdma, i); + if (ret) + goto mem_free; } k = 0; - for (i = 0; i < fsl_qdma->num_blocks; i++) { - fsl_qdma->status[i] = - fsl_qdma_prep_status_queue(fsl_qdma, i); - if (!fsl_qdma->status[i]) { - ret = -ENOMEM; - goto mem_free; - } - j = 0; - for (j = 0; j < QDMA_QUEUES; j++) { - fsl_qdma->queue[k] = - fsl_qdma_alloc_queue_resources(fsl_qdma, j, i); - if (!fsl_qdma->queue[k]) { - ret = -ENOMEM; + for (i = 0; i < QDMA_QUEUES; i++) { + for (j = 0; j < QDMA_BLOCKS; j++) { + ret = fsl_qdma_alloc_queue_resources(fsl_qdma, i, j); + if (ret) goto mem_free; - } + fsl_qdma->cmd_queues[j][i].channel_id = k; k++; } } @@ -865,24 +942,20 @@ dpaa_qdma_init(struct rte_dma_dev *dmadev) ret = fsl_qdma_reg_init(fsl_qdma); if (ret) { DPAA_QDMA_ERR("Can't Initialize the qDMA engine.\n"); - rte_free(fsl_qdma->status); goto mem_free; } return 0; mem_free: - for (j = 0; j < k; j++) - fsl_qdma_free_queue_resources(fsl_qdma->queue[j]); + for (i = 0; i < fsl_qdma->num_blocks; i++) + fsl_qdma_free_stq_res(&fsl_qdma->stat_queues[i]); - for (j = 0; j < i; j++) - fsl_qdma_free_status_queue(fsl_qdma->status[j]); + for (i = 0; i < fsl_qdma->num_blocks; i++) { + for (j = 0; j < QDMA_QUEUES; j++) + fsl_qdma_free_cmdq_res(&fsl_qdma->cmd_queues[i][j]); + } - if (fsl_qdma->status) - rte_free(fsl_qdma->status); -err: - if (fsl_qdma->queue) - rte_free(fsl_qdma->queue); munmap(fsl_qdma->ctrl_base, regs_size); return ret; @@ -929,16 +1002,20 @@ dpaa_qdma_remove(struct rte_dpaa_device *dpaa_dev) { struct rte_dma_dev *dmadev = dpaa_dev->dmadev; struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private; - uint32_t i; + uint32_t i, j, regs_size; - for (i = 0; i < fsl_qdma->num_blocks; i++) - fsl_qdma_free_status_queue(fsl_qdma->status[i]); + regs_size = fsl_qdma->block_offset * fsl_qdma->num_blocks; + regs_size += (QDMA_CTRL_REGION_SIZE + QDMA_STATUS_REGION_SIZE); - for (i = 0; i < fsl_qdma->num_blocks * QDMA_QUEUES; i++) - fsl_qdma_free_queue_resources(fsl_qdma->queue[i]); + for (i = 0; i < QDMA_BLOCKS; i++) + fsl_qdma_free_stq_res(&fsl_qdma->stat_queues[i]); - rte_free(fsl_qdma->queue); - rte_free(fsl_qdma->status); + for (i = 0; i < QDMA_BLOCKS; i++) { + for (j = 0; j < QDMA_QUEUES; j++) + fsl_qdma_free_cmdq_res(&fsl_qdma->cmd_queues[i][j]); + } + + munmap(fsl_qdma->ctrl_base, regs_size); (void)rte_dma_pmd_release(dpaa_dev->device.name); diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 25954ef3a4..da2dbf36c9 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -107,13 +107,13 @@ #define COMMAND_QUEUE_OVERFLOW 10 /* qdma engine attribute */ -#define QDMA_QUEUE_SIZE 64 -#define QDMA_STATUS_SIZE QDMA_QUEUE_SIZE -#define QDMA_CCSR_BASE 0x8380000 -#define QDMA_BLOCK_OFFSET 0x10000 -#define QDMA_BLOCKS 4 -#define QDMA_QUEUES 8 -#define QDMA_QUEUE_CR_WM 32 +#define QDMA_QUEUE_SIZE FSL_QDMA_CIRCULAR_DESC_SIZE_MIN +#define QDMA_STATUS_SIZE QDMA_QUEUE_SIZE +#define QDMA_CCSR_BASE 0x8380000 +#define QDMA_BLOCK_OFFSET 0x10000 +#define QDMA_BLOCKS 4 +#define QDMA_QUEUES 8 +#define QDMA_QUEUE_CR_WM 32 #define QDMA_BIG_ENDIAN 1 #ifdef QDMA_BIG_ENDIAN @@ -140,7 +140,9 @@ struct fsl_qdma_format { uint32_t addr_lo; /* low 32-bits of 40-bit address */ uint8_t addr_hi; /* high 8-bits of 40-bit address */ uint8_t __reserved1[2]; - uint8_t cfg8b_w1; /* dd, queue */ + uint8_t queue:3; + uint8_t rsv:3; + uint8_t dd:2; }; uint64_t data; }; @@ -182,6 +184,7 @@ struct fsl_qdma_queue { uint16_t n_cq; uint8_t block_id; uint8_t queue_id; + uint8_t channel_id; void *block_vir; uint32_t le_cqmr; struct fsl_qdma_format *cq; @@ -189,6 +192,18 @@ struct fsl_qdma_queue { uint8_t pending; dma_addr_t bus_addr; struct fsl_qdma_df **df; + void *engine; +}; + +struct fsl_qdma_status_queue { + uint16_t n_cq; + uint16_t complete; + uint8_t block_id; + void *block_vir; + struct fsl_qdma_format *cq; + struct rte_dma_stats stats; + dma_addr_t bus_addr; + void *engine; }; struct fsl_qdma_engine { @@ -197,10 +212,13 @@ struct fsl_qdma_engine { void *status_base; void *block_base; uint32_t n_queues; - struct fsl_qdma_queue **queue; - struct fsl_qdma_queue **status; + uint8_t block_queues[QDMA_BLOCKS]; + struct fsl_qdma_queue cmd_queues[QDMA_BLOCKS][QDMA_QUEUES]; + struct fsl_qdma_status_queue stat_queues[QDMA_BLOCKS]; + struct fsl_qdma_queue *chan[QDMA_BLOCKS * QDMA_QUEUES]; uint32_t num_blocks; int block_offset; + int is_silent; }; #endif /* _DPAA_QDMA_H_ */ From patchwork Mon Jul 22 11:58:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142596 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4708A45681; Mon, 22 Jul 2024 14:01:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E668940657; Mon, 22 Jul 2024 13:59:45 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013006.outbound.protection.outlook.com [52.101.67.6]) by mails.dpdk.org (Postfix) with ESMTP id 79D1A40658 for ; Mon, 22 Jul 2024 13:59:44 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FyqdSjFNFYbpaXIN42BTxxhWIElDQcvCNPyRWQlDSORYqRTAK6mIdfdNXizsDOgY2BYycGEOVfRC4bEpMt92UanUwiKPRMOBhBc+O8RLKWjwzt9pJnifhpewka4WuZI/oF/eW2jjbsq+JsFy+tFMGq3LDUsL3nzWTOpr7ePle/NxCgoYJwEP2vgM+csYIqRl7+gLZo9SkCkqlUI7XOSZoj9yO4WsQOiem8+QMW0EB8mYmNo69K9u5Rfg2OfrFc55/qQkGZ54ecVBkkPcVF2iEFzIw8bSTACYrOTd5jc1oTbYcC9mPeKhgAut49DhzSj03eIBLF5hnQ2aD6VRcdMrsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rmW3EgktaMIPSP6zzwFbwHNk7oZyfpfRgMeMXB4PzJ4=; b=nEO6HsTZ6asnXUsk+EyWofV057E/vyKs0iQ535mRqgfjwHkB2jOTIUyE9aiwn5eXA7JElIwoIjvLzDlY3y8JUZsOUBneXDPVVJc3OH6Taq194IurtGUlRdsv49M1ww/kWEt7C3NUp2zcD4pBvUzEb8yL7BMMCtGhhGnRpdGW80RgKybRqkDw07s5Z5FsjVtvJQ2MsooiBt99oBzFtJTaNOqsvjjmqCvH0nO9vSHv9IPBRSG4rmrUQwI554sS1xxXnEUK3W93dWKTpY4mpBANnRAGvUlpLZaDzng3OpGhIdXHi4C4TM/cSJyOhmnSKH/4WLdwNMq2HJc4XQE5hAU//Q== 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=rmW3EgktaMIPSP6zzwFbwHNk7oZyfpfRgMeMXB4PzJ4=; b=Zb2VoCSpW4qo1FqYx9T4ZDJYRr+IvQrTtH3vXKV1sO/UCzls7aXgTSr8OpcAwBOYQnMsLeFFmk2vQ/WPKnf3YqEHN4TPiB9Ppb9TZOwLD7QOriDvZKI+EdkYI3h/KP1xNG1ByUxQByYxug9Utf76mRjYpW0t/u/sJHlAJxYk470= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by DUZPR04MB9917.eurprd04.prod.outlook.com (2603:10a6:10:4d8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Mon, 22 Jul 2024 11:59:42 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:42 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v2 22/30] dma/dpaa: add Scatter Gather support Date: Mon, 22 Jul 2024 17:28:35 +0530 Message-Id: <20240722115843.1830105-23-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9917:EE_ X-MS-Office365-Filtering-Correlation-Id: f1b13448-d4a9-483a-fbbd-08dcaa45c56c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: 63HGRYY6oUJ5YluzFJFrdxCkIyYeyt9EF0Jl9zQcXK4iWkzUWsNGFhh2AOO9o3EAHotkBhmD/QPSstBlj9V++G2asrIZEEJgPgqaizc6/dDRLO1Sxr23sYS5Cj5vjsd7BmpvO0NUOpRVlfuygm+vnjd712n9z3jqKKLZTsnPIZnrM4MrdtJS5GJncbndTgJ8EC6B69MmeeGqqgifHCT8C2K2Yr4T6+UQTYtFNxCgAzEhNJ4M0qMJ2MP+QYpVxSf3oqEPYj0D9oCMW2FrcUlN0tXQLHF+G4k5/bDdpQLn9gl+3owgRW0VKP3faLSOW1eUVm+3CfYaLUXpsBtTrC3Pu+4skRIOKuPDps37tvObIPimWN/Mdi5vNsKi5P9j+E6Hrs2kdElPLRUJjJz8zYkyNS7yFfdQEblcBZy5Uy5esgK3SGpQSRBJmsFMf6h53hxsuuQ9DGHOqZVWe0H86xl53wmd9r0jojdlyIGNUlKNkexMIjIuusEW3xCudLu5FZ6xDfEjB8bPWJqP9WfOmdeb6ca3/Xo01DCLppcrsF3ihpQx4yS52wOgtJvG9HsXv6iGJEsUwqwC4tvoYUZjdUo7PtaRP9kde9LzThcELg4A2RUdqG7QqjDkBB/bm9C/+TMeEhHv3qqm01VaGmYxBQLdHTaPlZJC3PC05dkBFSHl31ADLup02sq07rbEPbBK3/D/vrAIGWG9vlkNvzRqV6lvLa9Yeon0Fa29e6gfCjZQZaGEzLn4H5mogjCcmkZOe+syPCN8bPx/mSYhnSv0SJpAgoghygCYNIYDJTZ8EDGHB1w6Atb8phyL/0A7uN8UaSOOKbSmYwR6Vy8Nluzqd7eJPsZYkvKyVHyU/5u/1KATCUdk4zPnF0SS+9HXBcDTWzwqLHNA70z10m+Trn97oM1xLxqBZVqfOfNJfMlX6CV/uLygryg3yPzRatUTzbS+FBnYVjZZ8PHYNHbYbRkelyhPyGwxMJybC0vntuvBHWu3pHxjQSbRGWcLorKyFkDMQTYNxxVG+aVNqkJTWOp8vpMRo0bWoprwFoWvnOlzvVOwumz/R6h5rsoACgoQSHlqUZxpwLJdyO4p6ZM5N0DuFOOtBd2wspWHE6lhXqC9pB/dmmrtoS24eksfVCGzvCnPvD7RyT77V2PIwdPKKi3sSBruLGr3uCym2Dxkq+dnBImFNydwwTnT/yB5JfSzysR0/1TN/tV3UrDH8Dk8egvcw2lGA7bbn1aysnOyoD6stsYpnynuJBWKqkQ+75st2tOp+XSVRbo47qJM/0A9w0n+ZgSiMduzeielCBw5YVpeusAfZEyXOBv4M9dBEuAxvIRaanPahkVPcGNiWlyfBmBalZKCz9UHjhAHCqQTa9pvH9atDaXpWkTaoHwn2gw8F4ltHRm0vmdK7iwOCBPuc4F4iE04Pw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OUEdkHLFiHIYQBi5n0sQXLTsG/tlaEodxY8KGs418XyDm6pbDuTiP3PR5vQjgjxXUDxqRcmjFOusl3Jj6L4vxxauA0oqN+klrgWfJMBiSFXm19h8zocRScstyUOKAnrC/jo+q3ACcPOyyVNFeIHs5VHb6omJxjNfE8kjHhKLjsaJP4VouvsIp4lsBTu4LVUZy4ad5TcofoUECt99qH3SW6JOrcROqWQG1Q6gD6Xp24J+H9GXzk24I/qWI9QB1CuF8Krit1uHJHcN1Ij/TNKfnYJB539QJL5rdI+2nF3ArVTMAJCGrbAzBtemNvo10fhEAMt9FCfpqctsI31748//nR8H4p8oU/Bd4Mduidrn1l8Nx5YXvAlrzxnwiiQ0f9jL9KXBNvgIG4YVoYbpT6YTJBbdXdusqWOom3yOQiNA+1KReehzNFQ+zsFUpY4kPDqWMJo9gwdrhwGqfuwDWC4me/9WXSRcX6aRAcSubk13+9Ns1hoHaz4h/HmeCzWJA/lyjUsdd8Vq8xmXYt1otyVdUVWH2Aistw/DB8a1DJPIC/56DwyqcJuma8rtCnf85g6FfrO2ulP6EOeit4QVNpGJBWe9E1QtoNHwSY8jEX2x/06bwc6CPRbwFk1ieUKFJoTURl0mMkazT3Hu4IEPsdJnvSRTqTOOLISsWa/VXa/ZxakMeLUR19Gz32exKgq8GJnbe22rG4xQdDIh3turB46pSjAVl2TwVuy4ZlxhYJ6kq8K7KJ46rQqXfAcL3VmTnjkgyhz+Y/gKGYb8CnucTiEYMiiDrWmTh2CG2SOYLKGHNPN0eX9FlNIfNHVyvKn1jgk78VBDG2RHm1Hwms1MQV8P/55sHVscrb/ka9poR65PxB4U+Y8E7frXjf/LX9+ccKYMSrVJFPWwzkxlx1KAahgujt7ZI632x5fz+DPd+MgHIdedbxKQ/g1OWoO4vPFDhYiqZQh+F9Im21xuZVlx5MDUuXcQGFVqeA9jB/L7g9ZDKPdJDX76apmUx2QrBtB99O32swjwqtX4QW7IzzKoZ4ADujHMF2tD6mg/Fq+K9He3ixkm4k13W28Kp3r/03R0LsefiEAzQsFEtBzb9zNf1yhWJYVHRiCjldnU+u5qAtRiTAYfOa1DO+rhPrBjOM76ZEVgk+KJFShH+ViMfTqZbOxuoQWlZ+5C9OIR6lfI/Xah6t0Xmr+0xYwgyYUQz08d/EFKDIrIighyhQPvjTB4uGJlzkX/JJx/D6MUCyjELxeyBDsDp74vYZ9uWZkM0YlIzj8jHk8oVIRfhWIe8ObbrHW++SCI3OTPVqNv7qeyjVC9MQH/C5UkaJ8dVbyRWBIF7Fio0K6jFvfdbXws7jF5dQpsx2ZJsyjXnJyu/NOBZRXt48Wo2w/uniT6e7BKdR3tBqoS+rkDgO+V0QzkdU2fyXBcvjVHfmF6j5p9u9BXHY1KCV7a2Ymir0xLl00XZAj5yuxC3ByWM5fMeV3iOijBzQ/hNAmk6r0FtWA+ymX0qsSzJQNYrOJq5R3n8lKB0/tLB05RvYpqPeH8gnFLj8ofU0GcXB2O0Pz090ekiIMknlAnLdOoP22LQY707TNS/eGyCwD/ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1b13448-d4a9-483a-fbbd-08dcaa45c56c X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:42.4014 (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: sskNd/L9HTZGo+RLrhauAGTt1XWNCR3SBzN0YsMsNKqRbzQEK/d9oSv8JIUSJZkz X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9917 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 From: Jun Yang Perform SG operation by copy_sg callback of DMA lib or burst request from application. Perform Simple operation if burst number is 1. Signed-off-by: Jun Yang --- drivers/dma/dpaa/dpaa_qdma.c | 856 ++++++++++++++++++++++++++--------- drivers/dma/dpaa/dpaa_qdma.h | 184 +++++--- 2 files changed, 763 insertions(+), 277 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 825dead5cf..f1ad60d1f2 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -4,45 +4,31 @@ #include #include +#include #include "dpaa_qdma.h" #include "dpaa_qdma_logs.h" +static int s_data_validation; +static int s_hw_err_check; +static int s_sg_disable; + static inline void -qdma_desc_addr_set64(struct fsl_qdma_format *ccdf, u64 addr) +qdma_desc_addr_set64(struct fsl_qdma_comp_cmd_desc *ccdf, u64 addr) { ccdf->addr_hi = upper_32_bits(addr); ccdf->addr_lo = rte_cpu_to_le_32(lower_32_bits(addr)); } static inline void -qdma_ccdf_set_format(struct fsl_qdma_format *ccdf, int offset) -{ - ccdf->cfg = rte_cpu_to_le_32(QDMA_CCDF_FOTMAT | offset); -} - -static inline int -qdma_ccdf_get_status(const struct fsl_qdma_format *ccdf) -{ - return (rte_le_to_cpu_32(ccdf->status) & QDMA_CCDF_MASK) - >> QDMA_CCDF_STATUS; -} - -static inline void -qdma_ccdf_set_ser(struct fsl_qdma_format *ccdf, int status) +qdma_desc_sge_addr_set64(struct fsl_qdma_comp_sg_desc *sge, u64 addr) { - ccdf->status = rte_cpu_to_le_32(QDMA_CCDF_SER | status); -} - -static inline void -qdma_ccdf_set_queue(struct fsl_qdma_format *ccdf, - uint8_t queue_idx) -{ - ccdf->queue = queue_idx; + sge->addr_hi = upper_32_bits(addr); + sge->addr_lo = rte_cpu_to_le_32(lower_32_bits(addr)); } static inline int -qdma_ccdf_get_queue(struct fsl_qdma_format *ccdf, +qdma_ccdf_get_queue(struct fsl_qdma_comp_cmd_desc *ccdf, uint8_t *queue_idx) { uint64_t addr = ((uint64_t)ccdf->addr_hi) << 32 | ccdf->addr_lo; @@ -58,18 +44,6 @@ qdma_ccdf_get_queue(struct fsl_qdma_format *ccdf, return false; } -static inline void -qdma_csgf_set_len(struct fsl_qdma_format *csgf, int len) -{ - csgf->cfg = rte_cpu_to_le_32(len & QDMA_SG_LEN_MASK); -} - -static inline void -qdma_csgf_set_f(struct fsl_qdma_format *csgf, int len) -{ - csgf->cfg = rte_cpu_to_le_32(QDMA_SG_FIN | (len & QDMA_SG_LEN_MASK)); -} - static inline int ilog2(int x) { int log = 0; @@ -126,11 +100,11 @@ qdma_writel_be(uint32_t val, void *addr) } static void * -dma_pool_alloc(int size, int aligned, dma_addr_t *phy_addr) +dma_pool_alloc(char *nm, int size, int aligned, dma_addr_t *phy_addr) { void *virt_addr; - virt_addr = rte_malloc("dma pool alloc", size, aligned); + virt_addr = rte_zmalloc(nm, size, aligned); if (!virt_addr) return NULL; @@ -149,28 +123,46 @@ fsl_qdma_pre_comp_sd_desc(struct fsl_qdma_queue *queue) struct fsl_qdma_engine *fsl_qdma = queue->engine; struct fsl_qdma_sdf *sdf; struct fsl_qdma_ddf *ddf; - struct fsl_qdma_format *ccdf; + struct fsl_qdma_comp_cmd_desc *ccdf; uint16_t i, j; - struct fsl_qdma_format *head; struct fsl_qdma_cmpd_ft *ft; struct fsl_qdma_df *df; - head = queue->cmd_desc; - for (i = 0; i < queue->n_cq; i++) { dma_addr_t phy_ft = 0, phy_df = 0; - queue->ft[i] = - dma_pool_alloc(sizeof(struct fsl_qdma_cmpd_ft), - RTE_CACHE_LINE_SIZE, &phy_ft); + queue->ft[i] = dma_pool_alloc(NULL, + sizeof(struct fsl_qdma_cmpd_ft), + RTE_CACHE_LINE_SIZE, &phy_ft); if (!queue->ft[i]) goto fail; - - queue->df[i] = - dma_pool_alloc(sizeof(struct fsl_qdma_df), - RTE_CACHE_LINE_SIZE, &phy_df); + if (((uint64_t)queue->ft[i]) & + (RTE_CACHE_LINE_SIZE - 1)) { + DPAA_QDMA_ERR("FD[%d] addr(%p) not cache aligned", + i, queue->ft[i]); + rte_free(queue->ft[i]); + queue->ft[i] = NULL; + goto fail; + } + if (((uint64_t)(&queue->ft[i]->desc_ssge[0])) & + (RTE_CACHE_LINE_SIZE - 1)) { + DPAA_QDMA_ERR("FD[%d] SGE addr(%p) not cache aligned", + i, &queue->ft[i]->desc_ssge[0]); + rte_free(queue->ft[i]); + queue->ft[i] = NULL; + goto fail; + } + queue->ft[i]->phy_ssge = phy_ft + + offsetof(struct fsl_qdma_cmpd_ft, desc_ssge); + queue->ft[i]->phy_dsge = phy_ft + + offsetof(struct fsl_qdma_cmpd_ft, desc_dsge); + + queue->df[i] = dma_pool_alloc(NULL, + sizeof(struct fsl_qdma_df), + RTE_CACHE_LINE_SIZE, &phy_df); if (!queue->df[i]) { rte_free(queue->ft[i]); + queue->ft[i] = NULL; goto fail; } @@ -182,31 +174,25 @@ fsl_qdma_pre_comp_sd_desc(struct fsl_qdma_queue *queue) sdf = &df->sdf; ddf = &df->ddf; /* Compound Command Descriptor(Frame List Table) */ - qdma_desc_addr_set64(&ft->desc_buf, phy_df); - + qdma_desc_sge_addr_set64(&ft->desc_buf, phy_df); /* It must be 32 as Compound S/G Descriptor */ - qdma_csgf_set_len(&ft->desc_buf, - sizeof(struct fsl_qdma_df)); + ft->desc_buf.length = sizeof(struct fsl_qdma_df); + /* Descriptor Buffer */ - sdf->cmd = rte_cpu_to_le_32(FSL_QDMA_CMD_RWTTYPE << - FSL_QDMA_CMD_RWTTYPE_OFFSET); + sdf->srttype = FSL_QDMA_CMD_RWTTYPE; #ifdef RTE_DMA_DPAA_ERRATA_ERR050265 - sdf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_PF); + sdf->prefetch = 1; #endif - ddf->cmd = rte_cpu_to_le_32(FSL_QDMA_CMD_RWTTYPE << - FSL_QDMA_CMD_RWTTYPE_OFFSET); - ddf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_LWC << - FSL_QDMA_CMD_LWC_OFFSET); + ddf->dwttype = FSL_QDMA_CMD_RWTTYPE; + ddf->lwc = FSL_QDMA_CMD_LWC; - ccdf = queue->cmd_desc; + ccdf = &queue->cq[i]; qdma_desc_addr_set64(ccdf, phy_ft); - qdma_ccdf_set_format(ccdf, 0); + ccdf->format = FSL_QDMA_COMP_SG_FORMAT; if (!fsl_qdma->is_silent) - qdma_ccdf_set_ser(ccdf, 0); - qdma_ccdf_set_queue(ccdf, queue->queue_id); - queue->cmd_desc++; + ccdf->ser = 1; + ccdf->queue = queue->queue_id; } - queue->cmd_desc = head; queue->ci = 0; return 0; @@ -226,40 +212,107 @@ fsl_qdma_alloc_queue_resources(struct fsl_qdma_engine *fsl_qdma, { struct fsl_qdma_queue *cmd_queue; uint32_t queue_size; + char nm[RTE_MEMZONE_NAMESIZE]; cmd_queue = &fsl_qdma->cmd_queues[block_id][queue_id]; cmd_queue->engine = fsl_qdma; - queue_size = sizeof(struct fsl_qdma_format) * QDMA_QUEUE_SIZE; + queue_size = sizeof(struct fsl_qdma_comp_cmd_desc) * + QDMA_QUEUE_SIZE; - cmd_queue->cq = dma_pool_alloc(queue_size, + sprintf(nm, "Command queue_%d_%d", + block_id, queue_id); + cmd_queue->cq = dma_pool_alloc(nm, queue_size, queue_size, &cmd_queue->bus_addr); - if (!cmd_queue->cq) + if (!cmd_queue->cq) { + DPAA_QDMA_ERR("%s alloc failed!", nm); return -ENOMEM; - - memset(cmd_queue->cq, 0x0, queue_size); + } cmd_queue->block_vir = fsl_qdma->block_base + FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, block_id); cmd_queue->n_cq = QDMA_QUEUE_SIZE; cmd_queue->queue_id = queue_id; cmd_queue->block_id = block_id; - cmd_queue->pending = 0; - cmd_queue->cmd_desc = cmd_queue->cq; - cmd_queue->ft = rte_malloc("Compound Frame Table", + cmd_queue->pending_start = 0; + cmd_queue->pending_num = 0; + cmd_queue->complete_start = 0; + + sprintf(nm, "Compound Table_%d_%d", + block_id, queue_id); + cmd_queue->ft = rte_zmalloc(nm, sizeof(void *) * QDMA_QUEUE_SIZE, 0); if (!cmd_queue->ft) { + DPAA_QDMA_ERR("%s zmalloc failed!", nm); rte_free(cmd_queue->cq); return -ENOMEM; } - cmd_queue->df = rte_malloc("Descriptor Buffer", + sprintf(nm, "Descriptor Buf_%d_%d", + block_id, queue_id); + cmd_queue->df = rte_zmalloc(nm, sizeof(void *) * QDMA_QUEUE_SIZE, 0); if (!cmd_queue->df) { + DPAA_QDMA_ERR("%s zmalloc failed!", nm); + rte_free(cmd_queue->ft); + rte_free(cmd_queue->cq); + return -ENOMEM; + } + sprintf(nm, "Pending_desc_%d_%d", + block_id, queue_id); + cmd_queue->pending_desc = rte_zmalloc(nm, + sizeof(struct fsl_qdma_desc) * FSL_QDMA_MAX_DESC_NUM, 0); + if (!cmd_queue->pending_desc) { + DPAA_QDMA_ERR("%s zmalloc failed!", nm); + rte_free(cmd_queue->df); + rte_free(cmd_queue->ft); + rte_free(cmd_queue->cq); + return -ENOMEM; + } + sprintf(nm, "complete-burst_ring_%d_%d", + block_id, queue_id); + cmd_queue->complete_burst = rte_ring_create(nm, + QDMA_QUEUE_SIZE * 2, 0, + RING_F_SP_ENQ | RING_F_SC_DEQ); + if (!cmd_queue->complete_burst) { + DPAA_QDMA_ERR("%s create failed!", nm); + rte_free(cmd_queue->pending_desc); rte_free(cmd_queue->ft); rte_free(cmd_queue->cq); + rte_free(cmd_queue->df); return -ENOMEM; } + sprintf(nm, "complete-desc_ring_%d_%d", + block_id, queue_id); + cmd_queue->complete_desc = rte_ring_create(nm, + FSL_QDMA_MAX_DESC_NUM * 2, 0, + RING_F_SP_ENQ | RING_F_SC_DEQ); + if (!cmd_queue->complete_desc) { + DPAA_QDMA_ERR("%s create failed!", nm); + rte_ring_free(cmd_queue->complete_burst); + rte_free(cmd_queue->pending_desc); + rte_free(cmd_queue->ft); + rte_free(cmd_queue->cq); + rte_free(cmd_queue->df); + return -ENOMEM; + } + sprintf(nm, "complete-pool-desc_ring_%d_%d", + block_id, queue_id); + cmd_queue->complete_pool = rte_ring_create(nm, + FSL_QDMA_MAX_DESC_NUM * 2, 0, + RING_F_SP_ENQ | RING_F_SC_DEQ); + if (!cmd_queue->complete_pool) { + DPAA_QDMA_ERR("%s create failed!", nm); + rte_ring_free(cmd_queue->complete_desc); + rte_ring_free(cmd_queue->complete_burst); + rte_free(cmd_queue->pending_desc); + rte_free(cmd_queue->ft); + rte_free(cmd_queue->cq); + rte_free(cmd_queue->df); + return -ENOMEM; + } + memset(&cmd_queue->stats, 0, sizeof(struct rte_dma_stats)); + cmd_queue->pending_max = FSL_QDMA_MAX_DESC_NUM; return 0; } @@ -270,6 +323,10 @@ fsl_qdma_free_cmdq_res(struct fsl_qdma_queue *queue) rte_free(queue->df); rte_free(queue->ft); rte_free(queue->cq); + rte_free(queue->pending_desc); + rte_ring_free(queue->complete_burst); + rte_ring_free(queue->complete_desc); + rte_ring_free(queue->complete_pool); } static void @@ -289,9 +346,10 @@ fsl_qdma_prep_status_queue(struct fsl_qdma_engine *fsl_qdma, status = &fsl_qdma->stat_queues[block_id]; status->engine = fsl_qdma; - status_size = QDMA_STATUS_SIZE * sizeof(struct fsl_qdma_format); + status_size = QDMA_STATUS_SIZE * + sizeof(struct fsl_qdma_comp_cmd_desc); - status->cq = dma_pool_alloc(status_size, + status->cq = dma_pool_alloc(NULL, status_size, status_size, &status->bus_addr); if (!status->cq) @@ -352,31 +410,116 @@ fsl_qdma_halt(struct fsl_qdma_engine *fsl_qdma) return 0; } +static void +fsl_qdma_data_validation(struct fsl_qdma_desc *desc[], + uint8_t num, struct fsl_qdma_queue *fsl_queue) +{ + uint32_t i, j; + uint8_t *v_src, *v_dst; + char err_msg[512]; + int offset; + + if (likely(!s_data_validation)) + return; + + offset = sprintf(err_msg, "Fatal TC%d/queue%d: ", + fsl_queue->block_id, + fsl_queue->queue_id); + for (i = 0; i < num; i++) { + v_src = rte_mem_iova2virt(desc[i]->src); + v_dst = rte_mem_iova2virt(desc[i]->dst); + for (j = 0; j < desc[i]->len; j++) { + if (v_src[j] != v_dst[j]) { + sprintf(&err_msg[offset], + "job[%"PRId64"]:src(%p)[%d](%d)!=dst(%p)[%d](%d)", + desc[i]->flag, v_src, j, v_src[j], + v_dst, j, v_dst[j]); + DPAA_QDMA_ERR("%s, stop validating!\r\n", + err_msg); + return; + } + } + } +} + static int -fsl_qdma_queue_transfer_complete(struct fsl_qdma_queue *fsl_queue, - const uint16_t nb_cpls, - enum rte_dma_status_code *status) +fsl_qdma_queue_drain(struct fsl_qdma_queue *fsl_queue) { uint32_t reg; - int count = 0; + int count = 0, ret; uint8_t *block = fsl_queue->block_vir; + uint16_t *dq_complete = NULL, drain_num = 0; + struct fsl_qdma_desc *desc[FSL_QDMA_SG_MAX_ENTRY]; - while (count < nb_cpls) { + while (1) { + if (rte_ring_free_count(fsl_queue->complete_pool) < + (FSL_QDMA_SG_MAX_ENTRY * 2)) + break; reg = qdma_readl_be(block + FSL_QDMA_BSQSR); if (reg & FSL_QDMA_BSQSR_QE_BE) - return count; + break; qdma_writel_be(FSL_QDMA_BSQMR_DI, block + FSL_QDMA_BSQMR); - if (status != NULL) - status[count] = RTE_DMA_STATUS_SUCCESSFUL; - fsl_queue->complete++; - if (unlikely(fsl_queue->complete >= fsl_queue->n_cq)) - fsl_queue->complete = 0; + ret = rte_ring_dequeue(fsl_queue->complete_burst, + (void **)&dq_complete); + if (ret) + DPAA_QDMA_ERR("DQ desc number failed!\n"); + + ret = rte_ring_dequeue_bulk(fsl_queue->complete_desc, + (void **)desc, *dq_complete, NULL); + if (ret != (*dq_complete)) { + DPAA_QDMA_ERR("DQ %d descs failed!(%d)\n", + *dq_complete, ret); + } + + fsl_qdma_data_validation(desc, *dq_complete, fsl_queue); + + ret = rte_ring_enqueue_bulk(fsl_queue->complete_pool, + (void **)desc, (*dq_complete), NULL); + if (ret != (*dq_complete)) { + DPAA_QDMA_ERR("EQ %d descs to return queue failed!(%d)\n", + *dq_complete, ret); + } + + drain_num += *dq_complete; + fsl_queue->complete_start = + (fsl_queue->complete_start + (*dq_complete)) & + (fsl_queue->pending_max - 1); fsl_queue->stats.completed++; count++; } - return count; + + return drain_num; +} + +static int +fsl_qdma_queue_transfer_complete(struct fsl_qdma_queue *fsl_queue, + const uint16_t nb_cpls, uint16_t *last_idx, + enum rte_dma_status_code *status) +{ + int ret; + uint16_t dq_num = 0, i; + struct fsl_qdma_desc *desc_complete[nb_cpls]; + + ret = fsl_qdma_queue_drain(fsl_queue); + if (ret < 0) { + DPAA_QDMA_ERR("Drain TX%d/Q%d failed!(%d)", + fsl_queue->block_id, fsl_queue->queue_id, + ret); + } + + dq_num = rte_ring_dequeue_burst(fsl_queue->complete_pool, + (void **)desc_complete, nb_cpls, NULL); + for (i = 0; i < dq_num; i++) + last_idx[i] = desc_complete[i]->flag; + + if (status) { + for (i = 0; i < dq_num; i++) + status[i] = RTE_DMA_STATUS_SUCCESSFUL; + } + + return dq_num; } static int @@ -473,87 +616,253 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) } static int -fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue, - uint64_t flags, dma_addr_t dst, - dma_addr_t src, size_t len) +fsl_qdma_enqueue_desc_to_ring(struct fsl_qdma_queue *fsl_queue, + int is_burst) +{ + uint16_t i, num = fsl_queue->pending_num, idx, start; + int ret; + + num = is_burst ? fsl_queue->pending_num : 1; + + fsl_queue->desc_in_hw[fsl_queue->ci] = num; + ret = rte_ring_enqueue(fsl_queue->complete_burst, + &fsl_queue->desc_in_hw[fsl_queue->ci]); + if (ret) { + DPAA_QDMA_ERR("%s: Queue is full, try dequeue first", + __func__); + DPAA_QDMA_ERR("%s: submitted:%"PRIu64", completed:%"PRIu64"", + __func__, fsl_queue->stats.submitted, + fsl_queue->stats.completed); + return ret; + } + start = fsl_queue->pending_start; + for (i = 0; i < num; i++) { + idx = (start + i) & (fsl_queue->pending_max - 1); + ret = rte_ring_enqueue(fsl_queue->complete_desc, + &fsl_queue->pending_desc[idx]); + if (ret) { + DPAA_QDMA_ERR("Descriptors eq failed!\r\n"); + return ret; + } + } + + return 0; +} + +static int +fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, + dma_addr_t dst, dma_addr_t src, size_t len) { uint8_t *block = fsl_queue->block_vir; - struct fsl_qdma_format *csgf_src, *csgf_dest; + struct fsl_qdma_comp_sg_desc *csgf_src, *csgf_dest; struct fsl_qdma_cmpd_ft *ft; -#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 - struct fsl_qdma_sdf *sdf; - uint32_t cfg = 0; -#endif + int ret; -#ifdef CONFIG_RTE_DMA_DPAA_ERR_CHK - uint32_t reg; + ft = fsl_queue->ft[fsl_queue->ci]; + csgf_src = &ft->desc_sbuf; + csgf_dest = &ft->desc_dbuf; + qdma_desc_sge_addr_set64(csgf_src, src); + csgf_src->length = len; + csgf_src->extion = 0; + qdma_desc_sge_addr_set64(csgf_dest, dst); + csgf_dest->length = len; + csgf_dest->extion = 0; + /* This entry is the last entry. */ + csgf_dest->final = 1; + + ret = fsl_qdma_enqueue_desc_to_ring(fsl_queue, 0); + if (ret) + return ret; + fsl_queue->ci = (fsl_queue->ci + 1) & (fsl_queue->n_cq - 1); + + qdma_writel(fsl_queue->le_cqmr | FSL_QDMA_BCQMR_EI, + block + FSL_QDMA_BCQMR(fsl_queue->queue_id)); + fsl_queue->stats.submitted++; + + return 0; +} + +static int +fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) +{ + int overflow = 0, drain; + uint32_t reg, check_num, drain_num; + uint8_t *block = fsl_queue->block_vir; + const struct rte_dma_stats *st = &fsl_queue->stats; - /* retrieve and store the register value in big endian - * to avoid bits swap - */ - reg = qdma_readl_be(block + + check_num = 0; +overflow_check: + if (unlikely(s_hw_err_check)) { + reg = qdma_readl_be(block + FSL_QDMA_BCQSR(fsl_queue->queue_id)); - if (reg & (FSL_QDMA_BCQSR_QF_XOFF_BE)) { - DPAA_QDMA_ERR("QDMA Engine is busy\n"); - return -EBUSY; + overflow = (reg & FSL_QDMA_BCQSR_QF_XOFF_BE) ? + 1 : 0; + } else { + overflow = (fsl_qdma_queue_bd_in_hw(fsl_queue) >= + QDMA_QUEUE_CR_WM) ? 1 : 0; + } + + if (likely(!overflow)) + return 0; + + DPAA_QDMA_ERR("TC%d/Q%d submitted(%"PRIu64")-completed(%"PRIu64") >= %d", + fsl_queue->block_id, fsl_queue->queue_id, + st->submitted, st->completed, QDMA_QUEUE_CR_WM); + drain_num = 0; + +drain_again: + drain = fsl_qdma_queue_drain(fsl_queue); + if (drain <= 0) { + drain_num++; + if (drain_num > 100) { + DPAA_QDMA_ERR("TC%d/Q%d failed drain, %"PRIu64" bd in HW.", + fsl_queue->block_id, fsl_queue->queue_id, + st->submitted - st->completed); + return -ENOSPC; + } + goto drain_again; } -#else - /* check whether critical watermark level reached, - * below check is valid for only single queue per block - */ - if (fsl_qdma_queue_bd_in_hw(fsl_queue) >= QDMA_QUEUE_CR_WM) { - DPAA_QDMA_DEBUG("Queue is full, try dequeue first\n"); + check_num++; + if (check_num > 10) { + DPAA_QDMA_ERR("TC%d/Q%d failed drain, %"PRIu64" bd in HW.", + fsl_queue->block_id, fsl_queue->queue_id, + st->submitted - st->completed); return -ENOSPC; } + goto overflow_check; + + return -ENOSPC; +} + +static int +fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue) +{ + uint8_t *block = fsl_queue->block_vir, i; + struct fsl_qdma_comp_sg_desc *csgf_src, *csgf_dest; + struct fsl_qdma_cmpd_ft *ft; + uint32_t total_len = 0; + uint8_t num = fsl_queue->pending_num; + uint16_t start = fsl_queue->pending_start, idx; + int ret; +#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 + struct fsl_qdma_sdf *sdf; #endif - if (unlikely(fsl_queue->pending == fsl_queue->n_cq)) { - DPAA_QDMA_DEBUG("Queue is full, try dma submit first\n"); - return -ENOSPC; - } + ret = fsl_qdma_enqueue_overflow(fsl_queue); + if (unlikely(ret)) + return ret; ft = fsl_queue->ft[fsl_queue->ci]; csgf_src = &ft->desc_sbuf; csgf_dest = &ft->desc_dbuf; #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 - sdf = fsl_queue->df[fsl_queue->ci]; - sdf->cmd = rte_cpu_to_le_32(FSL_QDMA_CMD_RWTTYPE << - FSL_QDMA_CMD_RWTTYPE_OFFSET); + sdf = &fsl_queue->df[fsl_queue->ci]->sdf; + sdf->srttype = FSL_QDMA_CMD_RWTTYPE; #ifdef RTE_DMA_DPAA_ERRATA_ERR050265 - sdf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_PF); + sdf->prefetch = 1; #endif - if (len > FSL_QDMA_CMD_SSS_DISTANCE) { - sdf->cmd |= rte_cpu_to_le_32(FSL_QDMA_CMD_SSEN); - cfg |= rte_cpu_to_le_32(FSL_QDMA_CMD_SSS_STRIDE << - FSL_QDMA_CFG_SSS_OFFSET | - FSL_QDMA_CMD_SSS_DISTANCE); - sdf->cfg = cfg; - } else - sdf->cfg = 0; #endif - qdma_desc_addr_set64(csgf_src, src); - qdma_csgf_set_len(csgf_src, len); - qdma_desc_addr_set64(csgf_dest, dst); - qdma_csgf_set_len(csgf_dest, len); - /* This entry is the last entry. */ - qdma_csgf_set_f(csgf_dest, len); - fsl_queue->ci++; - if (fsl_queue->ci == fsl_queue->n_cq) - fsl_queue->ci = 0; + if (num == 1) { +#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 + if (fsl_queue->pending_desc[start].len > + FSL_QDMA_CMD_SSS_DISTANCE) { + sdf->ssen = 1; + sdf->sss = FSL_QDMA_CMD_SSS_STRIDE; + sdf->ssd = FSL_QDMA_CMD_SSS_DISTANCE; + } else { + sdf->sss = 0; + sdf->ssd = 0; + } +#endif + ret = fsl_qdma_enqueue_desc_single(fsl_queue, + fsl_queue->pending_desc[start].dst, + fsl_queue->pending_desc[start].src, + fsl_queue->pending_desc[start].len); + if (!ret) { + fsl_queue->pending_start = + (start + 1) & (fsl_queue->pending_max - 1); + fsl_queue->pending_num = 0; + } + return ret; + } else if (s_sg_disable) { + while (fsl_queue->pending_num > 0) { +#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 + if (fsl_queue->pending_desc[start].len > + FSL_QDMA_CMD_SSS_DISTANCE) { + sdf->ssen = 1; + sdf->sss = FSL_QDMA_CMD_SSS_STRIDE; + sdf->ssd = FSL_QDMA_CMD_SSS_DISTANCE; + } else { + sdf->sss = 0; + sdf->ssd = 0; + } +#endif + ret = fsl_qdma_enqueue_desc_single(fsl_queue, + fsl_queue->pending_desc[start].dst, + fsl_queue->pending_desc[start].src, + fsl_queue->pending_desc[start].len); + if (!ret) { + start = (start + 1) & + (fsl_queue->pending_max - 1); + fsl_queue->pending_start = start; + fsl_queue->pending_num--; + } else { + DPAA_QDMA_ERR("Eq pending desc failed(%d)", + ret); + return -EIO; + } + } - if (flags & RTE_DMA_OP_FLAG_SUBMIT) { - qdma_writel(fsl_queue->le_cqmr | FSL_QDMA_BCQMR_EI, - block + FSL_QDMA_BCQMR(fsl_queue->queue_id)); - fsl_queue->stats.submitted++; + return 0; + } + qdma_desc_sge_addr_set64(csgf_src, ft->phy_ssge); + csgf_src->extion = 1; + qdma_desc_sge_addr_set64(csgf_dest, ft->phy_dsge); + csgf_dest->extion = 1; + /* This entry is the last entry. */ + csgf_dest->final = 1; + for (i = 0; i < num; i++) { + idx = (start + i) & (fsl_queue->pending_max - 1); + qdma_desc_sge_addr_set64(&ft->desc_ssge[i], + fsl_queue->pending_desc[idx].src); + ft->desc_ssge[i].length = fsl_queue->pending_desc[idx].len; + ft->desc_ssge[i].final = 0; + qdma_desc_sge_addr_set64(&ft->desc_dsge[i], + fsl_queue->pending_desc[idx].dst); + ft->desc_dsge[i].length = fsl_queue->pending_desc[idx].len; + ft->desc_dsge[i].final = 0; + total_len += fsl_queue->pending_desc[idx].len; + } + ft->desc_ssge[num - 1].final = 1; + ft->desc_dsge[num - 1].final = 1; + csgf_src->length = total_len; + csgf_dest->length = total_len; +#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 + if (total_len > FSL_QDMA_CMD_SSS_DISTANCE) { + sdf->ssen = 1; + sdf->sss = FSL_QDMA_CMD_SSS_STRIDE; + sdf->ssd = FSL_QDMA_CMD_SSS_DISTANCE; } else { - fsl_queue->pending++; + sdf->sss = 0; + sdf->ssd = 0; } +#endif + ret = fsl_qdma_enqueue_desc_to_ring(fsl_queue, 1); + if (ret) + return ret; + + fsl_queue->ci = (fsl_queue->ci + 1) & (fsl_queue->n_cq - 1); - if (fsl_queue->ci) - return fsl_queue->ci - 1; - else - return fsl_queue->n_cq; + qdma_writel(fsl_queue->le_cqmr | FSL_QDMA_BCQMR_EI, + block + FSL_QDMA_BCQMR(fsl_queue->queue_id)); + fsl_queue->stats.submitted++; + + fsl_queue->pending_start = + (start + num) & (fsl_queue->pending_max - 1); + fsl_queue->pending_num = 0; + + return 0; } static int @@ -564,8 +873,9 @@ dpaa_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_info, dev_info->dev_capa = RTE_DMA_CAPA_MEM_TO_MEM | RTE_DMA_CAPA_SILENT | RTE_DMA_CAPA_OPS_COPY; + dev_info->dev_capa |= RTE_DMA_CAPA_DPAAX_QDMA_FLAGS_INDEX; dev_info->max_vchans = fsl_qdma->n_queues; - dev_info->max_desc = QDMA_QUEUE_SIZE; + dev_info->max_desc = FSL_QDMA_MAX_DESC_NUM; dev_info->min_desc = QDMA_QUEUE_SIZE; return 0; @@ -651,16 +961,11 @@ dpaa_qdma_submit(void *dev_private, uint16_t vchan) { struct fsl_qdma_engine *fsl_qdma = dev_private; struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; - void *block = fsl_queue->block_vir; - while (fsl_queue->pending) { - qdma_writel(fsl_queue->le_cqmr | FSL_QDMA_BCQMR_EI, - block + FSL_QDMA_BCQMR(fsl_queue->queue_id)); - fsl_queue->pending--; - fsl_queue->stats.submitted++; - } + if (!fsl_queue->pending_num) + return 0; - return 0; + return fsl_qdma_enqueue_desc(fsl_queue); } static int @@ -670,9 +975,86 @@ dpaa_qdma_enqueue(void *dev_private, uint16_t vchan, { struct fsl_qdma_engine *fsl_qdma = dev_private; struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; + uint16_t start = fsl_queue->pending_start; + uint8_t pending = fsl_queue->pending_num; + uint16_t idx; int ret; - ret = fsl_qdma_enqueue_desc(fsl_queue, flags, dst, src, length); + if (pending >= FSL_QDMA_SG_MAX_ENTRY) { + DPAA_QDMA_ERR("Too many pending jobs on queue%d", + vchan); + return -ENOSPC; + } + idx = (start + pending) & (fsl_queue->pending_max - 1); + + fsl_queue->pending_desc[idx].src = src; + fsl_queue->pending_desc[idx].dst = dst; + fsl_queue->pending_desc[idx].flag = + DPAA_QDMA_IDX_FROM_FLAG(flags); + fsl_queue->pending_desc[idx].len = length; + fsl_queue->pending_num++; + + if (!(flags & RTE_DMA_OP_FLAG_SUBMIT)) + return idx; + + ret = fsl_qdma_enqueue_desc(fsl_queue); + if (!ret) + return fsl_queue->pending_start; + + return ret; +} + +static int +dpaa_qdma_copy_sg(void *dev_private, + uint16_t vchan, + const struct rte_dma_sge *src, + const struct rte_dma_sge *dst, + uint16_t nb_src, uint16_t nb_dst, + uint64_t flags) +{ + int ret; + uint16_t i, start, idx; + struct fsl_qdma_engine *fsl_qdma = dev_private; + struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; + const uint16_t *idx_addr = NULL; + + if (unlikely(nb_src != nb_dst)) { + DPAA_QDMA_ERR("%s: nb_src(%d) != nb_dst(%d) on queue%d", + __func__, nb_src, nb_dst, vchan); + return -EINVAL; + } + + if ((fsl_queue->pending_num + nb_src) > FSL_QDMA_SG_MAX_ENTRY) { + DPAA_QDMA_ERR("Too many pending jobs on queue%d", + vchan); + return -ENOSPC; + } + start = fsl_queue->pending_start + fsl_queue->pending_num; + start = start & (fsl_queue->pending_max - 1); + idx = start; + + idx_addr = DPAA_QDMA_IDXADDR_FROM_SG_FLAG(flags); + + for (i = 0; i < nb_src; i++) { + if (unlikely(src[i].length != dst[i].length)) { + DPAA_QDMA_ERR("src.len(%d) != dst.len(%d)", + src[i].length, dst[i].length); + return -EINVAL; + } + idx = (start + i) & (fsl_queue->pending_max - 1); + fsl_queue->pending_desc[idx].src = src[i].addr; + fsl_queue->pending_desc[idx].dst = dst[i].addr; + fsl_queue->pending_desc[idx].len = dst[i].length; + fsl_queue->pending_desc[idx].flag = idx_addr[i]; + } + fsl_queue->pending_num += nb_src; + + if (!(flags & RTE_DMA_OP_FLAG_SUBMIT)) + return idx; + + ret = fsl_qdma_enqueue_desc(fsl_queue); + if (!ret) + return fsl_queue->pending_start; return ret; } @@ -683,7 +1065,7 @@ dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma, { struct fsl_qdma_status_queue *stat_queue; struct fsl_qdma_queue *cmd_queue; - struct fsl_qdma_format *cq; + struct fsl_qdma_comp_cmd_desc *cq; uint16_t start, count = 0; uint8_t qid; int ret; @@ -697,9 +1079,6 @@ dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma, if (ret == true) { cmd_queue = &fsl_qdma->cmd_queues[block_id][qid]; cmd_queue->stats.completed++; - cmd_queue->complete++; - if (unlikely(cmd_queue->complete == cmd_queue->n_cq)) - cmd_queue->complete = 0; start++; if (unlikely(start == stat_queue->n_cq)) start = 0; @@ -713,16 +1092,81 @@ dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma, return count; } +static int +dpaa_qdma_err_handle(struct fsl_qdma_err_reg *reg) +{ + struct fsl_qdma_err_reg local; + size_t i, offset = 0; + char err_msg[512]; + + local.dedr_be = rte_read32(®->dedr_be); + if (!local.dedr_be) + return 0; + offset = sprintf(err_msg, "ERR detected:\n"); + if (local.dedr.ere) { + offset += sprintf(&err_msg[offset], + " ere(Enqueue rejection error)\n"); + } + if (local.dedr.dde) { + offset += sprintf(&err_msg[offset], + " dde(Destination descriptor error)\n"); + } + if (local.dedr.sde) { + offset += sprintf(&err_msg[offset], + " sde(Source descriptor error)\n"); + } + if (local.dedr.cde) { + offset += sprintf(&err_msg[offset], + " cde(Command descriptor error)\n"); + } + if (local.dedr.wte) { + offset += sprintf(&err_msg[offset], + " wte(Write transaction error)\n"); + } + if (local.dedr.rte) { + offset += sprintf(&err_msg[offset], + " rte(Read transaction error)\n"); + } + if (local.dedr.me) { + offset += sprintf(&err_msg[offset], + " me(Multiple errors of the same type)\n"); + } + DPAA_QDMA_ERR("%s", err_msg); + for (i = 0; i < FSL_QDMA_DECCD_ERR_NUM; i++) { + local.deccd_le[FSL_QDMA_DECCD_ERR_NUM - 1 - i] = + QDMA_IN(®->deccd_le[i]); + } + local.deccqidr_be = rte_read32(®->deccqidr_be); + local.decbr = rte_read32(®->decbr); + + offset = sprintf(err_msg, "ERR command:\n"); + offset += sprintf(&err_msg[offset], + " status: %02x, ser: %d, offset:%d, fmt: %02x\n", + local.err_cmd.status, local.err_cmd.ser, + local.err_cmd.offset, local.err_cmd.format); + offset += sprintf(&err_msg[offset], + " address: 0x%"PRIx64", queue: %d, dd: %02x\n", + (uint64_t)local.err_cmd.addr_hi << 32 | + local.err_cmd.addr_lo, + local.err_cmd.queue, local.err_cmd.dd); + DPAA_QDMA_ERR("%s", err_msg); + DPAA_QDMA_ERR("ERR command block: %d, queue: %d\n", + local.deccqidr.block, local.deccqidr.queue); + + rte_write32(local.dedr_be, ®->dedr_be); + + return -EIO; +} + static uint16_t dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, const uint16_t nb_cpls, uint16_t *last_idx, enum rte_dma_status_code *st) { struct fsl_qdma_engine *fsl_qdma = dev_private; - int ret; + int ret, err; struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; void *status = fsl_qdma->status_base; - int intr; if (unlikely(fsl_qdma->is_silent)) { DPAA_QDMA_WARN("Can't dq in silent mode\n"); @@ -734,55 +1178,27 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, fsl_queue->block_id); } else { ret = fsl_qdma_queue_transfer_complete(fsl_queue, - nb_cpls, st); + nb_cpls, last_idx, st); } - if (!ret) { - intr = qdma_readl_be(status + FSL_QDMA_DEDR); - if (intr) { -#ifdef CONFIG_RTE_DMA_DPAA_ERR_CHK - DPAA_QDMA_ERR("DMA transaction error! %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW0R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW0R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW1R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW1R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW2R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW2R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW3R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW3R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFQIDR); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFQIDR %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECBR); - DPAA_QDMA_INFO("reg FSL_QDMA_DECBR %x\n", intr); -#endif - qdma_writel_be(0xbf, - status + FSL_QDMA_DEDR); + if (s_hw_err_check) { + err = dpaa_qdma_err_handle(status + + FSL_QDMA_ERR_REG_STATUS_OFFSET); + if (err) fsl_queue->stats.errors++; - } - } - - if (last_idx) { - if (unlikely(!fsl_queue->complete)) - *last_idx = fsl_queue->n_cq - 1; - else - *last_idx = fsl_queue->complete - 1; } return ret; } - static uint16_t dpaa_qdma_dequeue(void *dev_private, uint16_t vchan, const uint16_t nb_cpls, uint16_t *last_idx, bool *has_error) { struct fsl_qdma_engine *fsl_qdma = dev_private; - int ret; + int ret, err; struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; -#ifdef CONFIG_RTE_DMA_DPAA_ERR_CHK void *status = fsl_qdma->status_base; - int intr; -#endif if (unlikely(fsl_qdma->is_silent)) { DPAA_QDMA_WARN("Can't dq in silent mode\n"); @@ -796,39 +1212,17 @@ dpaa_qdma_dequeue(void *dev_private, fsl_queue->block_id); } else { ret = fsl_qdma_queue_transfer_complete(fsl_queue, - nb_cpls, NULL); + nb_cpls, last_idx, NULL); } -#ifdef CONFIG_RTE_DMA_DPAA_ERR_CHK - if (!ret) { - intr = qdma_readl_be(status + FSL_QDMA_DEDR); - if (intr) { - DPAA_QDMA_ERR("DMA transaction error! %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW0R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW0R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW1R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW1R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW2R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW2R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFDW3R); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFDW3R %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECFQIDR); - DPAA_QDMA_INFO("reg FSL_QDMA_DECFQIDR %x\n", intr); - intr = qdma_readl(status + FSL_QDMA_DECBR); - DPAA_QDMA_INFO("reg FSL_QDMA_DECBR %x\n", intr); - qdma_writel_be(0xbf, - status + FSL_QDMA_DEDR); - intr = qdma_readl(status + FSL_QDMA_DEDR); - *has_error = true; + if (s_hw_err_check) { + err = dpaa_qdma_err_handle(status + + FSL_QDMA_ERR_REG_STATUS_OFFSET); + if (err) { + if (has_error) + *has_error = true; fsl_queue->stats.errors++; } } -#endif - if (last_idx) { - if (unlikely(!fsl_queue->complete)) - *last_idx = fsl_queue->n_cq - 1; - else - *last_idx = fsl_queue->complete - 1; - } return ret; } @@ -868,7 +1262,7 @@ dpaa_qdma_burst_capacity(const void *dev_private, uint16_t vchan) const struct fsl_qdma_engine *fsl_qdma = dev_private; struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; - return fsl_queue->n_cq - fsl_queue->pending; + return fsl_queue->pending_max - fsl_queue->pending_num; } static struct rte_dma_dev_ops dpaa_qdma_ops = { @@ -891,6 +1285,15 @@ dpaa_qdma_init(struct rte_dma_dev *dmadev) int ret; uint32_t i, j, k; + if (getenv("DPAA_QDMA_DATA_VALIDATION")) + s_data_validation = 1; + + if (getenv("DPAA_QDMA_HW_ERR_CHECK")) + s_hw_err_check = 1; + + if (getenv("DPAA_QDMA_SG_DISABLE")) + s_sg_disable = 1; + fsl_qdma->n_queues = QDMA_QUEUES * QDMA_BLOCKS; fsl_qdma->num_blocks = QDMA_BLOCKS; fsl_qdma->block_offset = QDMA_BLOCK_OFFSET; @@ -981,6 +1384,7 @@ dpaa_qdma_probe(__rte_unused struct rte_dpaa_driver *dpaa_drv, dmadev->device = &dpaa_dev->device; dmadev->fp_obj->dev_private = dmadev->data->dev_private; dmadev->fp_obj->copy = dpaa_qdma_enqueue; + dmadev->fp_obj->copy_sg = dpaa_qdma_copy_sg; dmadev->fp_obj->submit = dpaa_qdma_submit; dmadev->fp_obj->completed = dpaa_qdma_dequeue; dmadev->fp_obj->completed_status = dpaa_qdma_dequeue_status; diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index da2dbf36c9..9d8d9e865d 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -83,29 +83,15 @@ #define FSL_QDMA_CIRCULAR_DESC_SIZE_MAX 16384 #define FSL_QDMA_QUEUE_NUM_MAX 8 +#define FSL_QDMA_COMP_SG_FORMAT 0x1 + #define FSL_QDMA_CMD_RWTTYPE 0x4 #define FSL_QDMA_CMD_LWC 0x2 -#define FSL_QDMA_CMD_RWTTYPE_OFFSET 28 -#define FSL_QDMA_CMD_LWC_OFFSET 16 -#define FSL_QDMA_CMD_PF BIT(17) - -#define FSL_QDMA_CMD_SSEN BIT(19) #define FSL_QDMA_CFG_SSS_OFFSET 12 #define FSL_QDMA_CMD_SSS_STRIDE 128 #define FSL_QDMA_CMD_SSS_DISTANCE 128 -#define QDMA_CCDF_STATUS 20 -#define QDMA_CCDF_OFFSET 20 -#define QDMA_CCDF_MASK GENMASK(28, 20) -#define QDMA_CCDF_FOTMAT BIT(29) -#define QDMA_CCDF_SER BIT(30) - -#define QDMA_SG_FIN BIT(30) -#define QDMA_SG_LEN_MASK GENMASK(29, 0) - -#define COMMAND_QUEUE_OVERFLOW 10 - /* qdma engine attribute */ #define QDMA_QUEUE_SIZE FSL_QDMA_CIRCULAR_DESC_SIZE_MIN #define QDMA_STATUS_SIZE QDMA_QUEUE_SIZE @@ -132,64 +118,160 @@ (((fsl_qdma_engine)->block_offset) * (x)) /* qDMA Command Descriptor Formats */ -struct fsl_qdma_format { - uint32_t status; /* ser, status */ - uint32_t cfg; /* format, offset */ - union { - struct { - uint32_t addr_lo; /* low 32-bits of 40-bit address */ - uint8_t addr_hi; /* high 8-bits of 40-bit address */ - uint8_t __reserved1[2]; - uint8_t queue:3; - uint8_t rsv:3; - uint8_t dd:2; - }; - uint64_t data; - }; -}; +struct fsl_qdma_comp_cmd_desc { + uint8_t status; + uint32_t rsv0:22; + uint32_t ser:1; + uint32_t rsv1:21; + uint32_t offset:9; + uint32_t format:3; + uint32_t addr_lo; + uint8_t addr_hi; + uint16_t rsv3; + uint8_t queue:3; + uint8_t rsv4:3; + uint8_t dd:2; +} __rte_packed; + +struct fsl_qdma_comp_sg_desc { + uint32_t offset:13; + uint32_t rsv0:19; + uint32_t length:30; + uint32_t final:1; + uint32_t extion:1; + uint32_t addr_lo; + uint8_t addr_hi; + uint32_t rsv1:24; +} __rte_packed; -/* qDMA Source Descriptor Format */ struct fsl_qdma_sdf { - uint32_t rev3; - uint32_t cfg; /* rev4, bit[0-11] - ssd, bit[12-23] sss */ - uint32_t rev5; - uint32_t cmd; -}; + uint32_t rsv0; + uint32_t ssd:12; + uint32_t sss:12; + uint32_t rsv1:8; + uint32_t rsv2; + + uint32_t rsv3:17; + uint32_t prefetch:1; + uint32_t rsv4:1; + uint32_t ssen:1; + uint32_t rthrotl:4; + uint32_t sqos:3; + uint32_t ns:1; + uint32_t srttype:4; +} __rte_packed; -/* qDMA Destination Descriptor Format */ struct fsl_qdma_ddf { - uint32_t rev1; - uint32_t cfg; /* rev2, bit[0-11] - dsd, bit[12-23] - dss */ - uint32_t rev3; - uint32_t cmd; -}; + uint32_t rsv0; + uint32_t dsd:12; + uint32_t dss:12; + uint32_t rsv1:8; + uint32_t rsv2; + + uint16_t rsv3; + uint32_t lwc:2; + uint32_t rsv4:1; + uint32_t dsen:1; + uint32_t wthrotl:4; + uint32_t dqos:3; + uint32_t ns:1; + uint32_t dwttype:4; +} __rte_packed; struct fsl_qdma_df { struct fsl_qdma_sdf sdf; struct fsl_qdma_ddf ddf; }; +#define FSL_QDMA_SG_MAX_ENTRY RTE_DPAAX_QDMA_JOB_SUBMIT_MAX +#define FSL_QDMA_MAX_DESC_NUM (FSL_QDMA_SG_MAX_ENTRY * QDMA_QUEUE_SIZE) struct fsl_qdma_cmpd_ft { - struct fsl_qdma_format desc_buf; - struct fsl_qdma_format desc_sbuf; - struct fsl_qdma_format desc_dbuf; + struct fsl_qdma_comp_sg_desc desc_buf; + struct fsl_qdma_comp_sg_desc desc_sbuf; + struct fsl_qdma_comp_sg_desc desc_dbuf; + uint64_t cache_align[2]; + struct fsl_qdma_comp_sg_desc desc_ssge[FSL_QDMA_SG_MAX_ENTRY]; + struct fsl_qdma_comp_sg_desc desc_dsge[FSL_QDMA_SG_MAX_ENTRY]; + uint64_t phy_ssge; + uint64_t phy_dsge; +} __rte_packed; + +#define FSL_QDMA_ERR_REG_STATUS_OFFSET 0xe00 + +struct fsl_qdma_dedr_reg { + uint32_t me:1; + uint32_t rsv0:1; + uint32_t rte:1; + uint32_t wte:1; + uint32_t cde:1; + uint32_t sde:1; + uint32_t dde:1; + uint32_t ere:1; + uint32_t rsv1:24; +}; + +struct fsl_qdma_deccqidr_reg { + uint32_t rsv:27; + uint32_t block:2; + uint32_t queue:3; +}; + +#define FSL_QDMA_DECCD_ERR_NUM \ + (sizeof(struct fsl_qdma_comp_cmd_desc) / sizeof(uint32_t)) + +struct fsl_qdma_err_reg { + uint32_t deier; + union { + rte_be32_t dedr_be; + struct fsl_qdma_dedr_reg dedr; + }; + uint32_t rsv0[2]; + union { + rte_le32_t deccd_le[FSL_QDMA_DECCD_ERR_NUM]; + struct fsl_qdma_comp_cmd_desc err_cmd; + }; + uint32_t rsv1[4]; + union { + rte_be32_t deccqidr_be; + struct fsl_qdma_deccqidr_reg deccqidr; + }; + rte_be32_t decbr; +}; + +#define DPAA_QDMA_IDXADDR_FROM_SG_FLAG(flag) \ + ((void *)((flag) - ((flag) & RTE_DPAAX_QDMA_SG_IDX_ADDR_MASK))) + +#define DPAA_QDMA_IDX_FROM_FLAG(flag) \ + ((flag) >> RTE_DPAAX_QDMA_COPY_IDX_OFFSET) + +struct fsl_qdma_desc { + rte_iova_t src; + rte_iova_t dst; + uint64_t flag; + uint64_t len; }; struct fsl_qdma_queue { - struct fsl_qdma_format *cmd_desc; int used; struct fsl_qdma_cmpd_ft **ft; uint16_t ci; - uint16_t complete; + struct rte_ring *complete_burst; + struct rte_ring *complete_desc; + struct rte_ring *complete_pool; uint16_t n_cq; uint8_t block_id; uint8_t queue_id; uint8_t channel_id; void *block_vir; uint32_t le_cqmr; - struct fsl_qdma_format *cq; + struct fsl_qdma_comp_cmd_desc *cq; + uint16_t desc_in_hw[QDMA_QUEUE_SIZE]; struct rte_dma_stats stats; - uint8_t pending; + struct fsl_qdma_desc *pending_desc; + uint16_t pending_max; + uint16_t pending_start; + uint8_t pending_num; + uint16_t complete_start; dma_addr_t bus_addr; struct fsl_qdma_df **df; void *engine; @@ -200,7 +282,7 @@ struct fsl_qdma_status_queue { uint16_t complete; uint8_t block_id; void *block_vir; - struct fsl_qdma_format *cq; + struct fsl_qdma_comp_cmd_desc *cq; struct rte_dma_stats stats; dma_addr_t bus_addr; void *engine; From patchwork Mon Jul 22 11:58:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142598 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1D2EA45681; Mon, 22 Jul 2024 14:01:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC4AC40668; Mon, 22 Jul 2024 13:59:50 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013044.outbound.protection.outlook.com [52.101.67.44]) by mails.dpdk.org (Postfix) with ESMTP id 2D98540668 for ; Mon, 22 Jul 2024 13:59:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qnSQzbDmQE/IB2+OGhYJ3Y1Y+xz4sfGyWUFmaKAX0Rq8Lp4IC0ncKZpsGuvJx2K7RsJxpyXoaIrBqZiMgtneDMkGjM+a0TdjRImbhS4VFFEoscNBvd+mXRakFlF89p+Uen37TCJoeOy0JR6R71K3hMmUzm301j+Jtof7RdWHjA3QwyxexPTgbfVKb/6CedMelZpFcF/HfmT8A3oRtVWTHaC25L/K1SBhr+HQNowaMWp88eoAgVs7mnhivx1kkjxv+vwfxQgblijsVoC+/8KJ3l3dOmrBEhl77B4g1Mi8oc1wKHrRE00wLcV28qlUGRmBl0TvUAlRMWQ+2N1yjUfrPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZcaBT5JdVYlcj5qtIKVBbfnDEVA9hssFu9URcXFYI6U=; b=XcEel4ADss8RoygzKTwd8GdCpLlxTSLLpNlFj+YJgQkV1jQ+SoNQw5VGkXRFAtiJK5x2UpEo7B0PE6DWh+4uRD8UK7TGFWIBPpfe+NwSbAP2JP0SEubzXp0OCYOl7eKMoetrTH150HtOU+/mJr/SAkXDdOnXh2WSV5x92cQZXD3GghgyJ2ePB10ijdZM5rcIaMSXGuCJ8sBdKL+0RbPIHPkCQ3Qe5aWXZEMA4tbMIdEdHsCOYlPXa5xxN/0Q1696PzXKG49IfkxoqSB+lrgkfUPqYcOFvGox/Du24+hWKrm0v4342A0lEsWrrQH7Ff/Gp85fBTOaE6mhCaVlOP2h4g== 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=ZcaBT5JdVYlcj5qtIKVBbfnDEVA9hssFu9URcXFYI6U=; b=Rr8TXNpDRmCRHoU89rcpcsjBujz0V10LhF2pmXq2lcF755dgqaCSgcc2435tcFFD6b/iipUJrKh4Yit5len/4N8Ie3jphGOlXhM2+AOlojQ6xtgBqYeI0f0zeh287boDVEUqqF+o9YUNm072P33HVgPuwo2vf4DXmDF1DMHgRLg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by DUZPR04MB9917.eurprd04.prod.outlook.com (2603:10a6:10:4d8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Mon, 22 Jul 2024 11:59:44 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:44 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v2 23/30] dma/dpaa: block dequeue Date: Mon, 22 Jul 2024 17:28:36 +0530 Message-Id: <20240722115843.1830105-24-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9917:EE_ X-MS-Office365-Filtering-Correlation-Id: 6baf1e1b-05a7-4150-2a78-08dcaa45c68f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: ddNCHK/FowlsJZBHcdQ/uigWtCftTyqVu6aK+I2x618E+fC2vfBNZ3MoEkfI8qHS1RmH2TxdLl+npFLJaJVPkY69dDuN/4kgy/9SR5k9ZqVQKpZg2ULA3hAM9Kg6VqVUzu8nqNpBpGsNRDSbfGTcQVBFm+OKf6kCChx9LRoGkTJ94QYpudffqQeEeINBci7r5JDmezq3bB0/GHG/BXmyL/LNJ/YoKqVpJ8ZkheNlLNgvK6162hZFqeN9jUZoU8EJov2aHY/GhDlPVUWhKwWduyMUzknNpjpn1wwG4LWj4F8wY3h5Q5Dz+8YJCKX6wOKaXDwWhTS10qR39LcLYAu+K+T/Qsu2NQrZnuVLnf1aqFSNfr7N5SM2unZliGD0PZNA+3jgMbwsfeEfc2xegwYc6Zw2MY1ZQGlfcOpbZ3EOC/7NnFE79Yg4KyH2NBtmA55hgS86sVq/BOVPKgDxZSxgCtYji+dlc5UzTZ6If2xwKjwzPHGGQipmuaK6pivyQPnPITPe6/cA6cTt1XhcKf9OuxePRIHKp67TXzbH6mPdljbaz5rndOA6GuSjwbAQwSI6R2Ej98VuNlOKtaQCaMjVBtVq6O35kBNc/zZmiBYS/vohjfJPZKbgw1KG5eazfxOiObQtoxZcWsKewLO7qjffYCb6pF6QN1Ap+N8V9e7sSY4DzKRn8XrkwbxJ1N7mLq7mi29iIQ9gR0g9AvlcQFKMfqlREtEv510jpAcrGJjX6XLG53bvgbo1OSMfIWOgfrmXyj/sFpgTN8w/2nxoYLLBC3Vb3yDUTb5t1qEtQ3S+ibTDMwQss1kPzTjw2VxKxUXh2IKI//Zck9TxS7+jUjm+ynBUE14V/JS4rKUWDngxLdJhlszEbuKjoBsme4O1z3evwkRrE6SoKUtFkmRlOR9TIq229KQnNnvh0mQt40HbtDolOmKb87An6BCGFNSfQ/ooZG8D2+fmfwaaV8V2jWVSpmbufbWxnh/0BgoNRS/J7Dzj+Gwe/Tijlke/wwpx94Or7vkcgBfRv1LjelLQ7u1tfTzJw1memkIQ16eMuBAZq3jSIgXcAk3PfRM7AdVxRnSWk+JwKaMyE0Ez3iqae4t9CbjD++R9fhoXt4A6cy0sZJYeryNiGFYK1T9sc1uV/8Atp6XNTHaz8aLfYQsfRCDqNS03nBdpGG7JBZo2pgq5ksBchBrUX/Ufc5IOmQ2K642nsQtxavKS/fuO0yo6WDf9RGff62PeLBsztaVmCTUfKi60NztP1ezSiNzmJbZ4o6Fp9g3mzgQXj8CpGvl0DyH7jbSy1g8+NnKeu3q1V1njDaETEdJB/63187c3yzx9ZF7A0VZfYYOzM3qdiCBX9LQdCJCldrc3I8IXltJWju6CTF/i0F9rrX2SjTH1/r5NbB05i20Euj6sIqc2+gxtBqwD8A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R69ML2BOE3qzOOgvO++VppWGtQRE15LbjfSppTx6C/LByGeIr3JxzP6MouOI3/tVl94rJWwGjogkK9Fv22zFstHZU9MoPgZwnFARfEHdLizJhu1XPydTVY6oV0LNujUhu3fQgcMflO0X4DaDNdv0y5fodgvn+vRyzzszQlTvNW7pzFHPd7dgc6PbQiV6H4yxqgC8MvJAMIdJQA0+m2hq8X0D0NBAledhvswyCBVHCF/werFViDtLtG8fkHvdmCJYTqY1IUs8Tkh4zq7VNVD8oRzFjXbP9YYqNE0uOJ1Om7ZH8x9gZ9J1r3kJnFQhSfrFb8NLm2vQJryrYzF3j5joz/Qgzf/ApsxxHOKOi3RcXFRtkevy5XVkSzEJKEjvnNvl5XCaMv5u5YVIlgXQ//aWCSYsY6CsacBri/W7Bn8L2XDGY17l+OmBFkmkagdVQIa9sq671P3IGLqVlGEqxSI/2UJ/SoX9RAjH3EPcBYlbRnXntIkpP663KC3Fw6w8zSnvP8B6t/Wez+9VgWnBWrC/RmNEqZcybbfigBTgh2FtqkxQ9ML+Dxfn0ZiF43/yNZojYL0RT/CbFstcjrCNC4AFuwBUgxRq3BG+XnE313q7H4L2sHhnseTnsXbN64HTKkq+KPJVyyuw+QOSl4/Q72pONOkaKR9KXB2mC+oZ6y+8BlmWEGTJ4uyBKqv/DRBB0CGE2/8Rqmxuw0n3rZP6ETklIDTOIB4aRIlGV60Zvbt3gCtkp729W7ieMS4vg9l8PG4jNo+yXG5q8LjLnQLYpz3QCSzgKe5MHi9rBnsyNyPTD6NAnLZcmh6GXb1OSYMN68RpYS5L4DbE0KmxOojsjaYadsOC3L8SyC8t9R6E4V6ZAlDRbt42EJ+kfC0NmOw2k1g6TVa2C5YAYBHGcbKbEJqI5+pQPnsnE/r5qwLsKcrhfTzmYX6URwdpok4MfEDHvIDWsA+IKfz9yrPd2tmcaSwoVKkijL5KChCDpxz0VTADgkB1BENNQwssNdZhqBlWi5CMYPQOn5i4I3nHXYa3bp9d8bKLvYwljjr18tn3mkTH+wciQoVYUQNegO5Em8rLHN3/SxNfZEdfFIFNcncg8K10daCuPARBTRWeCMA7SvF9Jl0snbm09buiqGme9jDsxTmn1AzDdalfa3Jki8/hnOK2UmnNmU3WaGXW/4Q1OUX8SXpSMpyTUVgtOUknhP2EbGdAU4LR0yFv92xnKwpj71PwkFO/MlOwX7RGqWWAN5780KF66pZ1/N+ry2ffuVBSWWtPP4zIiqmTobRB9BKPuz25wO8Q+jtri5nVLrJ8hJJS7OkD4IH5gUHiWpHB6vEtuMiaMe3f3U2Hn+cfrqCONlDz+igv+ivX+1w1FeAR049vaFn1B0FaEePnfk+rRYVxdSKQ13FfHS+ZMsyswkSKEu5i2UWA7bO1tLfX37bkwAV1mxaeQo//hucvMbx823tQjL+feWQYQEvv/9wN1UBknDm6UCKmbZlLeny4rJOyrg8c8xALw0UP6/PU2kPAnx721OWLHSdLV34+X3HQHMPb6GZtZ9WKz/qaVYSVt+qjIF5xUCStayBOWlr7GpdX69wFLpIB X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6baf1e1b-05a7-4150-2a78-08dcaa45c68f X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:44.2355 (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: UJa3OsCZHw8PWxiH80VDr68LFR6q845AznTTdeibpJsplSsQ76nWHC/GaN9dkOox X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9917 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 From: Jun Yang Perform block dequeue to identify which queue of this block is completed. Signed-off-by: Jun Yang --- drivers/dma/dpaa/dpaa_qdma.c | 252 ++++++++++++++++------------------- 1 file changed, 116 insertions(+), 136 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index f1ad60d1f2..de5ecc7d0b 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -442,86 +442,6 @@ fsl_qdma_data_validation(struct fsl_qdma_desc *desc[], } } -static int -fsl_qdma_queue_drain(struct fsl_qdma_queue *fsl_queue) -{ - uint32_t reg; - int count = 0, ret; - uint8_t *block = fsl_queue->block_vir; - uint16_t *dq_complete = NULL, drain_num = 0; - struct fsl_qdma_desc *desc[FSL_QDMA_SG_MAX_ENTRY]; - - while (1) { - if (rte_ring_free_count(fsl_queue->complete_pool) < - (FSL_QDMA_SG_MAX_ENTRY * 2)) - break; - reg = qdma_readl_be(block + FSL_QDMA_BSQSR); - if (reg & FSL_QDMA_BSQSR_QE_BE) - break; - - qdma_writel_be(FSL_QDMA_BSQMR_DI, block + FSL_QDMA_BSQMR); - ret = rte_ring_dequeue(fsl_queue->complete_burst, - (void **)&dq_complete); - if (ret) - DPAA_QDMA_ERR("DQ desc number failed!\n"); - - ret = rte_ring_dequeue_bulk(fsl_queue->complete_desc, - (void **)desc, *dq_complete, NULL); - if (ret != (*dq_complete)) { - DPAA_QDMA_ERR("DQ %d descs failed!(%d)\n", - *dq_complete, ret); - } - - fsl_qdma_data_validation(desc, *dq_complete, fsl_queue); - - ret = rte_ring_enqueue_bulk(fsl_queue->complete_pool, - (void **)desc, (*dq_complete), NULL); - if (ret != (*dq_complete)) { - DPAA_QDMA_ERR("EQ %d descs to return queue failed!(%d)\n", - *dq_complete, ret); - } - - drain_num += *dq_complete; - fsl_queue->complete_start = - (fsl_queue->complete_start + (*dq_complete)) & - (fsl_queue->pending_max - 1); - fsl_queue->stats.completed++; - - count++; - } - - return drain_num; -} - -static int -fsl_qdma_queue_transfer_complete(struct fsl_qdma_queue *fsl_queue, - const uint16_t nb_cpls, uint16_t *last_idx, - enum rte_dma_status_code *status) -{ - int ret; - uint16_t dq_num = 0, i; - struct fsl_qdma_desc *desc_complete[nb_cpls]; - - ret = fsl_qdma_queue_drain(fsl_queue); - if (ret < 0) { - DPAA_QDMA_ERR("Drain TX%d/Q%d failed!(%d)", - fsl_queue->block_id, fsl_queue->queue_id, - ret); - } - - dq_num = rte_ring_dequeue_burst(fsl_queue->complete_pool, - (void **)desc_complete, nb_cpls, NULL); - for (i = 0; i < dq_num; i++) - last_idx[i] = desc_complete[i]->flag; - - if (status) { - for (i = 0; i < dq_num; i++) - status[i] = RTE_DMA_STATUS_SUCCESSFUL; - } - - return dq_num; -} - static int fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) { @@ -682,13 +602,90 @@ fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, return 0; } +static uint16_t +dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma, + uint8_t block_id) +{ + struct fsl_qdma_status_queue *stat_queue; + struct fsl_qdma_queue *cmd_queue; + struct fsl_qdma_comp_cmd_desc *cq; + uint16_t start, count = 0; + uint8_t qid = 0; + uint32_t reg; + int ret; + uint8_t *block; + uint16_t *dq_complete = NULL; + struct fsl_qdma_desc *desc[FSL_QDMA_SG_MAX_ENTRY]; + + stat_queue = &fsl_qdma->stat_queues[block_id]; + cq = stat_queue->cq; + start = stat_queue->complete; + + block = fsl_qdma->block_base + + FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, block_id); + + do { + reg = qdma_readl_be(block + FSL_QDMA_BSQSR); + if (reg & FSL_QDMA_BSQSR_QE_BE) + break; + + qdma_writel_be(FSL_QDMA_BSQMR_DI, block + FSL_QDMA_BSQMR); + ret = qdma_ccdf_get_queue(&cq[start], &qid); + if (ret == true) { + cmd_queue = &fsl_qdma->cmd_queues[block_id][qid]; + cmd_queue->stats.completed++; + + ret = rte_ring_dequeue(cmd_queue->complete_burst, + (void **)&dq_complete); + if (ret) + DPAA_QDMA_ERR("DQ desc number failed!\n"); + + ret = rte_ring_dequeue_bulk(cmd_queue->complete_desc, + (void **)desc, *dq_complete, NULL); + if (ret != (*dq_complete)) { + DPAA_QDMA_ERR("DQ %d descs failed!(%d)\n", + *dq_complete, ret); + } + + fsl_qdma_data_validation(desc, *dq_complete, cmd_queue); + + ret = rte_ring_enqueue_bulk(cmd_queue->complete_pool, + (void **)desc, (*dq_complete), NULL); + if (ret != (*dq_complete)) { + DPAA_QDMA_ERR("Failed desc eq %d!=%d to %s\n", + ret, *dq_complete, + cmd_queue->complete_pool->name); + } + + cmd_queue->complete_start = + (cmd_queue->complete_start + (*dq_complete)) & + (cmd_queue->pending_max - 1); + cmd_queue->stats.completed++; + + start++; + if (unlikely(start == stat_queue->n_cq)) + start = 0; + count++; + } else { + DPAA_QDMA_ERR("Block%d not empty but dq-queue failed!", + block_id); + break; + } + } while (1); + stat_queue->complete = start; + + return count; +} + static int fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) { - int overflow = 0, drain; - uint32_t reg, check_num, drain_num; + int overflow = 0; + uint32_t reg; + uint16_t blk_drain, check_num, drain_num; uint8_t *block = fsl_queue->block_vir; const struct rte_dma_stats *st = &fsl_queue->stats; + struct fsl_qdma_engine *fsl_qdma = fsl_queue->engine; check_num = 0; overflow_check: @@ -711,11 +708,12 @@ fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) drain_num = 0; drain_again: - drain = fsl_qdma_queue_drain(fsl_queue); - if (drain <= 0) { + blk_drain = dpaa_qdma_block_dequeue(fsl_qdma, + fsl_queue->block_id); + if (!blk_drain) { drain_num++; if (drain_num > 100) { - DPAA_QDMA_ERR("TC%d/Q%d failed drain, %"PRIu64" bd in HW.", + DPAA_QDMA_ERR("TC%d failed drain, Q%d's %"PRIu64" bd in HW.", fsl_queue->block_id, fsl_queue->queue_id, st->submitted - st->completed); return -ENOSPC; @@ -724,7 +722,7 @@ fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) } check_num++; if (check_num > 10) { - DPAA_QDMA_ERR("TC%d/Q%d failed drain, %"PRIu64" bd in HW.", + DPAA_QDMA_ERR("TC%d failed drain, Q%d's %"PRIu64" bd in HW.", fsl_queue->block_id, fsl_queue->queue_id, st->submitted - st->completed); return -ENOSPC; @@ -1059,39 +1057,6 @@ dpaa_qdma_copy_sg(void *dev_private, return ret; } -static uint16_t -dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma, - uint8_t block_id) -{ - struct fsl_qdma_status_queue *stat_queue; - struct fsl_qdma_queue *cmd_queue; - struct fsl_qdma_comp_cmd_desc *cq; - uint16_t start, count = 0; - uint8_t qid; - int ret; - - stat_queue = &fsl_qdma->stat_queues[block_id]; - cq = stat_queue->cq; - start = stat_queue->complete; - - do { - ret = qdma_ccdf_get_queue(&cq[start], &qid); - if (ret == true) { - cmd_queue = &fsl_qdma->cmd_queues[block_id][qid]; - cmd_queue->stats.completed++; - start++; - if (unlikely(start == stat_queue->n_cq)) - start = 0; - count++; - } else { - break; - } - } while (1); - stat_queue->complete = start; - - return count; -} - static int dpaa_qdma_err_handle(struct fsl_qdma_err_reg *reg) { @@ -1164,22 +1129,32 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, enum rte_dma_status_code *st) { struct fsl_qdma_engine *fsl_qdma = dev_private; - int ret, err; + int err; struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; void *status = fsl_qdma->status_base; + struct fsl_qdma_desc *desc_complete[nb_cpls]; + uint16_t i, dq_num; if (unlikely(fsl_qdma->is_silent)) { DPAA_QDMA_WARN("Can't dq in silent mode\n"); return 0; } - if (fsl_qdma->block_queues[fsl_queue->block_id] > 1) { - ret = dpaa_qdma_block_dequeue(fsl_qdma, - fsl_queue->block_id); - } else { - ret = fsl_qdma_queue_transfer_complete(fsl_queue, - nb_cpls, last_idx, st); + dq_num = dpaa_qdma_block_dequeue(fsl_qdma, + fsl_queue->block_id); + DPAA_QDMA_DP_DEBUG("%s: block dq(%d)\n", + __func__, dq_num); + + dq_num = rte_ring_dequeue_burst(fsl_queue->complete_pool, + (void **)desc_complete, nb_cpls, NULL); + for (i = 0; i < dq_num; i++) + last_idx[i] = desc_complete[i]->flag; + + if (st) { + for (i = 0; i < dq_num; i++) + st[i] = RTE_DMA_STATUS_SUCCESSFUL; } + if (s_hw_err_check) { err = dpaa_qdma_err_handle(status + FSL_QDMA_ERR_REG_STATUS_OFFSET); @@ -1187,7 +1162,7 @@ dpaa_qdma_dequeue_status(void *dev_private, uint16_t vchan, fsl_queue->stats.errors++; } - return ret; + return dq_num; } static uint16_t @@ -1196,9 +1171,11 @@ dpaa_qdma_dequeue(void *dev_private, uint16_t *last_idx, bool *has_error) { struct fsl_qdma_engine *fsl_qdma = dev_private; - int ret, err; + int err; struct fsl_qdma_queue *fsl_queue = fsl_qdma->chan[vchan]; void *status = fsl_qdma->status_base; + struct fsl_qdma_desc *desc_complete[nb_cpls]; + uint16_t i, dq_num; if (unlikely(fsl_qdma->is_silent)) { DPAA_QDMA_WARN("Can't dq in silent mode\n"); @@ -1207,13 +1184,16 @@ dpaa_qdma_dequeue(void *dev_private, } *has_error = false; - if (fsl_qdma->block_queues[fsl_queue->block_id] > 1) { - ret = dpaa_qdma_block_dequeue(fsl_qdma, - fsl_queue->block_id); - } else { - ret = fsl_qdma_queue_transfer_complete(fsl_queue, - nb_cpls, last_idx, NULL); - } + dq_num = dpaa_qdma_block_dequeue(fsl_qdma, + fsl_queue->block_id); + DPAA_QDMA_DP_DEBUG("%s: block dq(%d)\n", + __func__, dq_num); + + dq_num = rte_ring_dequeue_burst(fsl_queue->complete_pool, + (void **)desc_complete, nb_cpls, NULL); + for (i = 0; i < dq_num; i++) + last_idx[i] = desc_complete[i]->flag; + if (s_hw_err_check) { err = dpaa_qdma_err_handle(status + FSL_QDMA_ERR_REG_STATUS_OFFSET); @@ -1224,7 +1204,7 @@ dpaa_qdma_dequeue(void *dev_private, } } - return ret; + return dq_num; } static int From patchwork Mon Jul 22 11:58:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142597 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 64E5D45681; Mon, 22 Jul 2024 14:01:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8FE7340662; Mon, 22 Jul 2024 13:59:48 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013064.outbound.protection.outlook.com [52.101.67.64]) by mails.dpdk.org (Postfix) with ESMTP id 8066740689 for ; Mon, 22 Jul 2024 13:59:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bir4N9NiiwWSHe62XlsEJDWRnxcJloXkc/S3qPewEt3asSRztalsO4Vl/LbIq5zkayStWDQnqok07cA8eheG+xiUkfSVhUNg5tKEMLZC0JsGnMwaPhniyynD45reqbZAR8bnr2YTX6UWq/jHar4vnU6njMzisT+GPEhcVYBBcXrhCnRP/3AipnGGIWonYppYXIWLxkc97M2DwYoBKkDycCfwKSI6sCX0UPJMPF97PvOCwqJFdA2anCXmiS9R4RECbOv2pC7GQp+Z7DzVN+R9Vivz//rmIeUxDtnzGhnWR/VdRCrMWyjIyC7SjBG1lcmp8nYIMz/3krEpG2h30vprAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=A5goVnGFKicEl3EdTB46CLBe2PT9a2uXlS4uthFw5kw=; b=hI6TiSPKWc08lRPg153+O/RkWkagE7BTo8aWeC2MErwEKomSf2j4TkllhvwpNAD6Fc8N6ZlpW6+gONVMs8rJ53EFSx2Qkg/ivjhEJhIbmRtzxOEfx7vfSnKy84wINaHxbOAbHCziVpYOqXNy0/mjLgC9TZlFJWHPgKLYlZKI8FzLg8zUHeEbsWat7B/j5y8tXpoWrUf4KIyIdAv6l70RO+cSnVvoLUYU0nd27mfA15jhrZfwuewDauVPY19c+bZu8iCXQDdvC6Qtam1/5GrwozQ+pWKMiNOppxDGnV1Tm7/ztBhh970kIJD9Lbnv3lF0ol8uUhNfwY69SezB0j4ipw== 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=A5goVnGFKicEl3EdTB46CLBe2PT9a2uXlS4uthFw5kw=; b=agJkdBYntiqPJrLObjvjdgPtx34Y0JMb2rEuVJWdDPEXmGT0ulWIOEgYytBVVuTd6P1CBgtG6igDHAW8I4xF3q6+lWAsy6CgclAPY1NNZGeqCl0fLptiT3ptYvjY5XJ0PjAZyts7OmIzyioNv1FGIf9m7Rdvwu4d4A4kK3U7w4Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by VI1PR04MB7118.eurprd04.prod.outlook.com (2603:10a6:800:127::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Mon, 22 Jul 2024 11:59:46 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:46 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v2 24/30] dma/dpaa: improve congestion handling Date: Mon, 22 Jul 2024 17:28:37 +0530 Message-Id: <20240722115843.1830105-25-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|VI1PR04MB7118:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e01bd2a-cb41-47d8-ed8f-08dcaa45c79b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: BF+Lvfzu7casMaogHtVjxXGL29Qfzpl67XSxKkjj+1Vmrb7Q6FtPpgPCXtsdprsVVOPGxDRn9hb9FDn4nH832/y4O4vWrsUj+HRoa4tIo2NNcVv2Viidn/CkyvezDqffQNjlhxNrY4p08pqLiAdfaI5QbVDhDjIAfc+DYOnl1zY935i/p41GtPFjURH0cK+MSEJKTeFR3yPiUSjvjIS6OgNiwF/6hItChuG6ilhfMMtFPIfUlC5le6jelIQtOotaeH7FrNostL5D+wbHrSezeR/Kmu+E3DIAoZ/O9Dg5XotDoapK2TY2eY+dgaK0bkBioltd0poOHPyvmEOlnm0ADe8ibCkW5p1Z0pmqJDRgHEtjhN2xI1Gou21yP3rdYtG1O9H1yesdFXwGQMKTPaxe6hbW/80FUlk5JINo4SJZAIJ2pM6G5hBXBwHtWEaFTa2MidmphD20RuRdVCCAAUkBHmKnquY72ltfjPRtwgwUeC+FmiRTTEk/IeaAKthlDGCXUYY/lRDOpPFIOKblb1m9gf6rXB9GT5a1+am+yKtgXYbLyJ7bNtPmEPjSxpZHdEb8xd01sYAMfiIxGSU/1fH0NOlA7FXsXyrbp/zMcXtY0qm7VS9aHfcyrbJqJ5pHsk/PO7S6BXbX9ZjxIuGiVVEofd4PbXFc044dSjP277ClrqGYbPNG3g8Gsu8a5ELVDTW0OTgjCnvLRTlAJEj17ntjl63DlOEC+zMGOEmp5zYBnEYvf5RrioW4nmVvkudH9UMXv3kbDdERlzYJBv39R2OBmIEwWJz3/5vYf7XWB7zAcJoBUr7QZV1/vQW5FK+T0VKCtJPYQi8FnHMI9OCiwL0HY5oOe9TbUBsyciW7bmzKYj83nSQrBhuGyMyDbx2ZlxzcL5x4qZX/bUcZcfA76Y6XyEjspusi1Gsw0I72YFp/4aDO2E5etlTn4V4Enht4KCi2ISQLJ6BefVao/zrn3BeSbIE4M7qVxXwCYlV8or/YJRSQxPscz397EpOkskKqiVlZmrODN1RIWHwgLGiykJggRrcoXM5oKHEv9dtIsDpfenEjdG3QSJ4GZFEYOd4fLkctIOyb9qCOJ2TbgWAPY05mOnlGov4lczRIw/qUwsunqCZRCqQXF3pBYN752jTA/6teTRvw8dZiQqGXvNrg5e9ygoIVRkzel2nquNsPlMmEO9g240ydQc3pfRZ6nRWuoqvqkUBaQMyw0yJ5qZCecZBwG1AkjKrwoJshFw/BUz1CcpmIOwYWuxEq4Ld3cQWbPmb3+nJm3boOTv9hCdDVljosV46KrgbfbTxfnteTRgTEnVHb23wu8EAGDyhmF73K57Sa3+yAClU11uY3qiQuaGLywyJkEs/dsUzyDLzrOwubKmy141ROFtiQ2F7YYLzN9ROhzJpzXq1oUUUTtAdzjf1uUA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GsZ9FdOsyXbhyjxUiFln/ut4WGl3SK3ffA6bcoW7cKauAiv4xWA31YJ2l64bIW2jOZjNOuBvZbDAFlnU1xznPp81tMbuQszMTPI5j4NeBFFDvG6fwsCOPEL+s4b9JNA99/+0fcwNj8XTln4iBTdE+SJ6xpZ1M1IZrk3jC6zzg4bW1XnD//FY4ETWWa1IaGBmkhRAL926d5XPjR2YuyNtIvZ0gvDfcHdj3JArTqhizaUdhLPy0IxsvbYvMVA8uCLuhnhzWxwXil7F3OfZeum2gILEtCupgR66jE37w5hmZkUdYKNUV0HVDdJifpeX588KoLs0hyMQ2vhUVOEY8w2i1MlwijPhqsSCGoXNWfg5bUFEV4thTXEkfZo+t43rYJOyTtchZMEpW7IGh8+W3ggVeRZxVZhvN9pvunGzt5kF69NLEFpOJw9gsjJCkRD8W8bTLgXJq9St8dQsh4/Be+GKBdSmYK8E05Q6rfnJOB2VdIARULNWvYFrpJOclHmtAkvZ3lvWLM2W/bSy3xMdFNPWIXIgj8ik3y+62BFuWkkhQXnx/U2yQBYKPpAK8H8Q0YfqoNJuxmNrydmU5BCgWBOIzD1Bylq1l3xsMyded7y1TuHA8Nvp8VO9mwHjpjlhxWioK60DQOUcZELz7qtMdc3ua37UwO3Q57n7IXGOkEVP17THDktOlO2eBqaxs21oa/pJExkS3Mt1MkH+wB+EfxaXIbQiEkv3Ma+YsjSpnRuyWIxXFkaNrHE2zQU8AlTOLO/xl9vFp5i8W0+r9grGIlZKqn2gQ22VbVU/IGNcyNPaXXif46out3dFkZQo191YeGeC/Umkjp5PbnJlAEXfEaiJQHPJbo1P7pd0Qeunz1pgM3C8HJc1lJyghuoHvw2tPyYwFAY95GVUXfOnYtWKQ3bahN3Tlcl6DCgB1Z7TyTdykIk/2aa1WSC/qt7RsxX/UESe6GSRCtjiSfGGAX/V3G6xna+/EubCe2jg+kvhrk8sOFOacNDRlzBWJUhsLJvbKDAOiTAjx+/NvaGTHI9MEyt6jZZOeX9xis6fp4v8vtvAQ/YCfG4j375frJbulGFv3ik+OCVZJGSeYMt+VCGlyYsoosiZs6BIB2Sjk4LtHn+liKQcUvtqqIg2PLPpx9G7kUonvzMbjSzfAuGQoLKJa50LiHgzUNWEMedhvHvn/3ZYqbrz/KL2omULwYL9pZcNY9vmX7F5TRQK03MWlnuoOOCltxOmFQyyRR2DohaA81iUBJsvvWc5AgmhM721HF1j13YjCR2Ob4eBCKDcAH+mO8fauclQsSibCE393GqHzy0biypHF9M++vPL/XkS2VDcw6jLh7EyomtH3IhAl7ccOC2OLq97wXJMa33ZXT2S/wSC74gJsJ+orrZt9KH3SfOF9x4LiQMuNO65PeD+iqM8unYyyOfoqBjIry3RABVmSEDRgAsJqxrkDSDw/QJgwTX8L3EdSdwn+YpxQGopuKd82bcPOUkVs8BL3baPvPtafJLeJ8oRUBkYU1SFT5BV3CFxL67u+XWepKUg/iHjoQBSFIoPZR8Hu17jCCFqtfQYcRUKen59kiuVotklreYo3g6rU+1F X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e01bd2a-cb41-47d8-ed8f-08dcaa45c79b X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:45.9675 (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: RwgjjTJHqUV0NLLVa4n8jHXDQ19MQeMg6JzZ61uK4HbyCMWsHHp1t6zMLXkT1eeh X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7118 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 From: Jun Yang The congestion issue occurs frequently on low speed device(PCIe). We should drain the command queue to make dma work when congestion occurs. Signed-off-by: Jun Yang --- drivers/dma/dpaa/dpaa_qdma.c | 157 +++++++++++++++++++---------------- 1 file changed, 85 insertions(+), 72 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index de5ecc7d0b..eaa5f81f6d 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -535,73 +535,6 @@ fsl_qdma_reg_init(struct fsl_qdma_engine *fsl_qdma) return 0; } -static int -fsl_qdma_enqueue_desc_to_ring(struct fsl_qdma_queue *fsl_queue, - int is_burst) -{ - uint16_t i, num = fsl_queue->pending_num, idx, start; - int ret; - - num = is_burst ? fsl_queue->pending_num : 1; - - fsl_queue->desc_in_hw[fsl_queue->ci] = num; - ret = rte_ring_enqueue(fsl_queue->complete_burst, - &fsl_queue->desc_in_hw[fsl_queue->ci]); - if (ret) { - DPAA_QDMA_ERR("%s: Queue is full, try dequeue first", - __func__); - DPAA_QDMA_ERR("%s: submitted:%"PRIu64", completed:%"PRIu64"", - __func__, fsl_queue->stats.submitted, - fsl_queue->stats.completed); - return ret; - } - start = fsl_queue->pending_start; - for (i = 0; i < num; i++) { - idx = (start + i) & (fsl_queue->pending_max - 1); - ret = rte_ring_enqueue(fsl_queue->complete_desc, - &fsl_queue->pending_desc[idx]); - if (ret) { - DPAA_QDMA_ERR("Descriptors eq failed!\r\n"); - return ret; - } - } - - return 0; -} - -static int -fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, - dma_addr_t dst, dma_addr_t src, size_t len) -{ - uint8_t *block = fsl_queue->block_vir; - struct fsl_qdma_comp_sg_desc *csgf_src, *csgf_dest; - struct fsl_qdma_cmpd_ft *ft; - int ret; - - ft = fsl_queue->ft[fsl_queue->ci]; - csgf_src = &ft->desc_sbuf; - csgf_dest = &ft->desc_dbuf; - qdma_desc_sge_addr_set64(csgf_src, src); - csgf_src->length = len; - csgf_src->extion = 0; - qdma_desc_sge_addr_set64(csgf_dest, dst); - csgf_dest->length = len; - csgf_dest->extion = 0; - /* This entry is the last entry. */ - csgf_dest->final = 1; - - ret = fsl_qdma_enqueue_desc_to_ring(fsl_queue, 0); - if (ret) - return ret; - fsl_queue->ci = (fsl_queue->ci + 1) & (fsl_queue->n_cq - 1); - - qdma_writel(fsl_queue->le_cqmr | FSL_QDMA_BCQMR_EI, - block + FSL_QDMA_BCQMR(fsl_queue->queue_id)); - fsl_queue->stats.submitted++; - - return 0; -} - static uint16_t dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma, uint8_t block_id) @@ -633,7 +566,6 @@ dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma, ret = qdma_ccdf_get_queue(&cq[start], &qid); if (ret == true) { cmd_queue = &fsl_qdma->cmd_queues[block_id][qid]; - cmd_queue->stats.completed++; ret = rte_ring_dequeue(cmd_queue->complete_burst, (void **)&dq_complete); @@ -677,6 +609,87 @@ dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma, return count; } +static int +fsl_qdma_enqueue_desc_to_ring(struct fsl_qdma_queue *fsl_queue, + int is_burst) +{ + uint16_t i, num = fsl_queue->pending_num, idx, start, dq; + int ret, dq_cnt; + + num = is_burst ? fsl_queue->pending_num : 1; + + fsl_queue->desc_in_hw[fsl_queue->ci] = num; +eq_again: + ret = rte_ring_enqueue(fsl_queue->complete_burst, + &fsl_queue->desc_in_hw[fsl_queue->ci]); + if (ret) { + DPAA_QDMA_DP_DEBUG("%s: Queue is full, try dequeue first", + __func__); + DPAA_QDMA_DP_DEBUG("%s: submitted:%"PRIu64", completed:%"PRIu64"", + __func__, fsl_queue->stats.submitted, + fsl_queue->stats.completed); + dq_cnt = 0; +dq_again: + dq = dpaa_qdma_block_dequeue(fsl_queue->engine, + fsl_queue->block_id); + dq_cnt++; + if (dq > 0) { + goto eq_again; + } else { + if (dq_cnt < 100) + goto dq_again; + DPAA_QDMA_ERR("%s: Dq block%d failed!", + __func__, fsl_queue->block_id); + } + return ret; + } + start = fsl_queue->pending_start; + for (i = 0; i < num; i++) { + idx = (start + i) & (fsl_queue->pending_max - 1); + ret = rte_ring_enqueue(fsl_queue->complete_desc, + &fsl_queue->pending_desc[idx]); + if (ret) { + DPAA_QDMA_ERR("Descriptors eq failed!\r\n"); + return ret; + } + } + + return 0; +} + +static int +fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, + dma_addr_t dst, dma_addr_t src, size_t len) +{ + uint8_t *block = fsl_queue->block_vir; + struct fsl_qdma_comp_sg_desc *csgf_src, *csgf_dest; + struct fsl_qdma_cmpd_ft *ft; + int ret; + + ft = fsl_queue->ft[fsl_queue->ci]; + csgf_src = &ft->desc_sbuf; + csgf_dest = &ft->desc_dbuf; + qdma_desc_sge_addr_set64(csgf_src, src); + csgf_src->length = len; + csgf_src->extion = 0; + qdma_desc_sge_addr_set64(csgf_dest, dst); + csgf_dest->length = len; + csgf_dest->extion = 0; + /* This entry is the last entry. */ + csgf_dest->final = 1; + + ret = fsl_qdma_enqueue_desc_to_ring(fsl_queue, 0); + if (ret) + return ret; + fsl_queue->ci = (fsl_queue->ci + 1) & (fsl_queue->n_cq - 1); + + qdma_writel(fsl_queue->le_cqmr | FSL_QDMA_BCQMR_EI, + block + FSL_QDMA_BCQMR(fsl_queue->queue_id)); + fsl_queue->stats.submitted++; + + return 0; +} + static int fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) { @@ -702,7 +715,7 @@ fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) if (likely(!overflow)) return 0; - DPAA_QDMA_ERR("TC%d/Q%d submitted(%"PRIu64")-completed(%"PRIu64") >= %d", + DPAA_QDMA_DP_DEBUG("TC%d/Q%d submitted(%"PRIu64")-completed(%"PRIu64") >= %d", fsl_queue->block_id, fsl_queue->queue_id, st->submitted, st->completed, QDMA_QUEUE_CR_WM); drain_num = 0; @@ -712,7 +725,7 @@ fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) fsl_queue->block_id); if (!blk_drain) { drain_num++; - if (drain_num > 100) { + if (drain_num > 1000) { DPAA_QDMA_ERR("TC%d failed drain, Q%d's %"PRIu64" bd in HW.", fsl_queue->block_id, fsl_queue->queue_id, st->submitted - st->completed); @@ -721,8 +734,8 @@ fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) goto drain_again; } check_num++; - if (check_num > 10) { - DPAA_QDMA_ERR("TC%d failed drain, Q%d's %"PRIu64" bd in HW.", + if (check_num > 1000) { + DPAA_QDMA_ERR("TC%d failed check, Q%d's %"PRIu64" bd in HW.", fsl_queue->block_id, fsl_queue->queue_id, st->submitted - st->completed); return -ENOSPC; From patchwork Mon Jul 22 11:58:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142599 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 64BAB45681; Mon, 22 Jul 2024 14:01:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 753FF40693; Mon, 22 Jul 2024 13:59:53 +0200 (CEST) Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011007.outbound.protection.outlook.com [52.101.70.7]) by mails.dpdk.org (Postfix) with ESMTP id C0B6440691 for ; Mon, 22 Jul 2024 13:59:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OuIezklpngKm3biGtWzIRZMsl6PBrec748745femFAfBPd43lQt9X06/8MVVrqCgRpEr/YMIsWmj7nWYP/yk7YxH/5rpssbhDi+eg7X0DdYfKfJ2OBE+6NLZCgofPKpzzDmep9DyH4XJwgjrsbmY54gWCsneQGe/zZzpXssUvrH7Bg/2NzxB4UZDTm11+IFta52fqKqpxhGYUw8MvbWw897OARRI0hIIug5wdkbM5f8I0TZmF5iz6gmly28e3rnQ8Qwrh/ALuHwH79auUhC9X/yZ8BTEXTKIdnZGlRlYe907skRl3Cv3h4avud9vmXr608zK8GZGNcw5Wut4Zau+Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oQ+d4ctnqFcUbz+uqNwWNDWC8biD9PbzXf8h855UqUw=; b=Kr69pp7yI+zurKctS9q8gjgvgGYl4h81HIFB8YxppT1FSp+QJ2khcDeaw/xRavlMPlvf6roRYY1ra2LSzstMjGfDqR/ox5dTHk0L8ZKC3G+7tW0uIjhXm8YBaRrL/1Xa6TgnUOHpMV39Lio0xE0PLyfwRiUaOEW2PJpwwU0LXsCtc6Sn/ppF0kwWVAfPbeqNgzUMxiE94252jUmpKick/oitgX+dATzGmRoYdzZ97e8TH3Q0lFrlChwI8CsaCTLpYr67ilYgA+BELLRI7/6rPGAV8O33MshMgxmZd5rUMD11mxHBDWWvDzZ/j3HvnNXSa9eN4aDC6Mzdwte9Dzfrhg== 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=oQ+d4ctnqFcUbz+uqNwWNDWC8biD9PbzXf8h855UqUw=; b=JgbeuWb85omOwDaEr+GcfWz0kfiLRMuGY9Ganm71QYiRArDS7XE47DbAbGsPlbawUKYy5YpTjFRufmw6NBndKxvp5K0vqQtvh7gee3FOf9Fu/CqDphPdZ/lSOXz4eqL+Qzfj95tLDrPxsNW6dy1iVwm+nCJ0/OootdEJurdar5s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by VI1PR04MB7118.eurprd04.prod.outlook.com (2603:10a6:800:127::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Mon, 22 Jul 2024 11:59:48 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:48 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v2 25/30] dma/dpaa: disable SG descriptor as default Date: Mon, 22 Jul 2024 17:28:38 +0530 Message-Id: <20240722115843.1830105-26-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|VI1PR04MB7118:EE_ X-MS-Office365-Filtering-Correlation-Id: 04254906-44bd-4f13-461e-08dcaa45c8b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: A/5xNVEcETQGWBFtP0iI/P9HWmULqtypkKb65mgcNWDisbc5WZOf4WRY7nlU3/A+igBN1sbQSKOYTFKJbu5yZeV79TxuyiMwmvSQv3JeqUjsOIQKl5hQUFIbjhWC+eC8IHmcC2usUz9Z1mL6Xk0vscioPsEsLMKb4suOiJpf7q4geRx53iE9CmyqrqUCEKbMeckEkL4KKnoK+XPdHxOataqXbeXC2VLpydb08esKk8wnCqkE9n8EVlBirvsqt963FXjYhXZxYagwvC09MOs6wxHoS+/6d8rqLTU0rLjznAk++F0QmRT0xwifKaITcVBDCiqDK6nwuweoEBGlmPTvejwP6TE0pKkMtQ4CdartTigxG0Rf2FxmccxsLkawU95WWEQU/niMk8U8Q/hM8a8z9bwcDjVUPs6Ymw6QoCiKPCoRT7MlbVtLhmn4HmeyozPXggMO4dOMw+Y/INzc5+EPJ3QiivEBNJopofHodOnJPzjcHktWAj/8mAKrP1iPk2FsUYMH1FrTlaEvyyXMkn+FAqGnAZFuafQk3gDk/IFjt4p03rITwura70ehvBmRApopAJFyLYv9H32mlrVehuc8yoGwpORUxoY3G7sye1uWFyWPlFI3HZjkUkKAhzYVZU1b+nDg4Za3EZEsJCm44tgiV+vnEgkkqLS1jgq0TcmQbnsD+s0mSCjzGIy/7n/IWkya6IyRI9vHCwVzJ2tf49hgYQAQjfyWHOl3B7KMTadKskC6gd7niRrCeDtEjF71uQXgolCMpAO1xzEmznbqJO4Vn3aNuX7F4y8Ys4GBtbQMTS5gBJvyXtdP7wjh7Ma8U9N/op15yc6DZ5uocJH3SNEwbhbXdtKF7+TcHUncSn0PpUivchyLhGAMM9iWmvW2Fyg0LKLRXEGRzOUPbJ5rlF0OmM5hBMNLJd7QibWb+9s+XfGlu1FmUP4BwpD1AkFUSrF0QDGbJjws+FQSTYlbrIlQouS8kFsUOrE501gW3r9JTmjU+yEWeqiUUmaOT1VAiulRctR+t4mSeV33M72d81eH18a5B5DhRDsE29hRLn9KKliT7nMVAsrOX90/aCKX9DglZQTvHMWmi/Sd6KyRZz2Td+vckWmn/LuxvJ0De/90pi6H6vfUaWc/YOkJCd42P6C2Hh4KZl9PXOK47j/xUif6I/YoMRuIkNiGwlxTVRVtkzvnWwe38Eoc2V2CuI3a8k7NKYtgecxVs/7c/mNbtFMzqfvYpHG9jppu8ZtLYBa/AqwTkjsZGKX7lHaeJ8+DO+93k0oISpqD3IR1TpKiLeYWw5hupfAkhoKmpvfKVAcrGOPhn2oPU1sV8MynEsEHXesyWpEP9E2UpFKm35PpDhQhV6QxyS712Bt5nsUQqOMfUTlNgxi9bdSLEZBAdZv1V2Bdh0Bhuygc2Wy02osV12q71g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Wd9AuCduTcgz5e8uXzXxEkn4UgRpnd+K6jjis6FUi2uNadun3YCGVDVRzrsJXrEBMsTiqjwQqmQ+iavrqZDXrE017B1yCBzrvsZ3qGwE0iN4D5Ptnj6QqW4XqDr6iRu1zul829hdPOjwyFE7deBb9cVRTPXqh5mOTM7fDD439GNHNq30KwDdfJu0cG66Kh5xjYBC1BJb+nLshYCV4zmU7IhZqSjftOep6CsKzdyD+H8wOSy4NJPVz3ngytpAzQ00o7ZwpYPDLlZlPG2XyxOCKzSqACe/HQ0ThX8P4Is4VqxQ3DxDlB/piJczhJADKo0M5/7fuX4oe4yJyzyAXrFU9FNXjOaLLEcyXRm2PhGWimf5lMm9K0Ut2iLVqPRyVKI1Rex62Ln1Z9QCO65/X3M8fswuxpn8wUkaCQf39Qz3/9yW9w7BGPRq1qnoycABv+5P02Qi4F2zW0Pw4QqKAE7/1roWQSDdem3hF7HC6DTlfJwQ1u5cJ+WPkiJIInHxXUx0dxLXiW3H1C8f7b/3phIeKo268LTHcH96fEwK1X9OL/YYyFeg+m2DLt0SkiFOoNbX1kNRe/j0exdz00NGbvE/nraKHSQ1ynrk32U3/NLRdyHgg4Z850DLGztlfLwpgATnc7tbL3YKV4aBKHl4lWCsURxxOUad81RQHRs9fI7z0LcouKb87+rUJhaWBUbEZ7ABfI+HoDG8F2zzf/SZGzRVNVKuuEiGZQAvdU1oVGsfI5NnxGH9cpAqQqOlBpKe1/Go73qsuOGjr24S/4gBPINC/auTkdRzhZdvJOBnAiLPMIsm7Ndq4aeMB1zrGZWtQaJ9/IOzmysKbmh1gdRdHXtrfWQsgUhI5KnNGJIzVCQsDJsgATeYCZw/UsXKXFA2IlLuSZidMUa6UGVRRcAcdLapx1ca4ZZdQq27Lr3NFVsb0bA4kraiG81Yk3Vyvb6/DtDvBfgdfc/foXLBrU8AVeet63u4pKYge3WajafVralQw30MuAQMfrCwNs49lkYeooJ3+Mam7yml6Z1UgYxIJev6LR4TvldYXw7USs1XR+4wTdl1pJAjKmBW+WaIneMzb4BpxDIa3A7IIiaNoJQctvYFqeAUcz0WE57XThVnpWnR2cLaPDthtdhVJyflo63r5OMZmcE+p4ImNO7+xORHbMlCgc6/P5k9+wf5Eo2nRZEHk6fOUlNl7Hujln2xxjG0oWs0pKtWhk6oz/cZ3wpWQL++ACv+gQVARcnX4Fx+36OGvO7fejbgfFPup7BvaEE6is2P9w1nrhCznHA3FKElD8lz45+TjjNo6WPyoX5RFrSs9P+GHM8UHWF2tlXzoZg+D8bqL2YlYq8XQ9JvqsEGXxqMCmHcxEtuYB4gvjKsjOBuyJzICk0vkHMSXT+JJF1RnN8XDrLv4iKFq2qJJix0dVnA4l/EJqPRf6JoWjVfTyDc6Buwg/0IU5kzTAGKX9CcyYI2huu2PuflNZJlQZu0boCrjvhMlzXBGFTHwXgIczyYjA0cFxGdgFg3QBnsRbsa1bqzHCKHFDXty21K5WhTkHH0DiN2noD9kFNARq4Gqw4+GzuoaPpf4Y5DqfjQH8Jt6IEs X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04254906-44bd-4f13-461e-08dcaa45c8b4 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:47.9952 (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: LDrzoINPffjfj7GNYr/QzvG3p2Vek2TOME867lWEp5TaiStkg5qE7N7sduXyoaYz X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7118 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 From: Jun Yang Burst operation used for SG copy as default until SG issue is fixed. Signed-off-by: Jun Yang --- drivers/dma/dpaa/dpaa_qdma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index eaa5f81f6d..8492d0de5b 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -11,7 +11,7 @@ static int s_data_validation; static int s_hw_err_check; -static int s_sg_disable; +static int s_sg_disable = 1; static inline void qdma_desc_addr_set64(struct fsl_qdma_comp_cmd_desc *ccdf, u64 addr) @@ -335,7 +335,6 @@ fsl_qdma_free_stq_res(struct fsl_qdma_status_queue *queue) rte_free(queue->cq); } - static int fsl_qdma_prep_status_queue(struct fsl_qdma_engine *fsl_qdma, uint32_t block_id) From patchwork Mon Jul 22 11:58:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142600 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0541345681; Mon, 22 Jul 2024 14:02:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9F2084069D; Mon, 22 Jul 2024 13:59:54 +0200 (CEST) Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011007.outbound.protection.outlook.com [52.101.70.7]) by mails.dpdk.org (Postfix) with ESMTP id D9FB440695 for ; Mon, 22 Jul 2024 13:59:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=J+cNgMBR5AIQiyGS5fPcdhrOnUnOqmKegpHRUF3J3aHJGctiqB5mMXXZzbMi2A+mWFivH81zJ/gf+gFQjb1PXOm/7OV6ULTU7JUqW6RW8r9Od+ed0gSQ4NQjWuZ3XRQizaBb7yc0zmnEjlqXtvGPemq3uE8iN70cKSa3J8J0i/2JVAStKkgfVp3V3H+92HFySVVFWNshQ6mxRoSxyGRVcf1ybJfn5uZWbBVxiKM/fJNT/P9X840AHKq6HlP15zWsh09qN7MnO8KWJaeApxicI+etuYxS7ymhhqSWbUOZZbdjZysfAqf7RITM+5NPi6usl8VwLoZ/9m0bAkggzmlLiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ilVOOXQ/jGY2Vt2JCiEZ77aNAdQvp3e+1r14WSf179o=; b=y0888RoVpggtVEa+knUVhPEe7KFCkjX1XQUnAXvZz0zB/QPaAOkQwbKro1VyfTL2j6mAqj1t29BvIQBiL0glruXnCTP15V0QeUfj6sZI+o6MH41V2Qw0hQs7qz1Xfg7VuNKovdiStu+l5TK1nYvZ9L4YpabRNxtjOthLA9DPdh3eRjv4dKGBJ/EnLOPgH2getBzsF0qia46fF+tmNNVJWaXJVf4l0b0CpOHsMJuIBzJbzciJZiVezPtYKzrRaYhDRMJAsraUZLIrtWReNZAsdMQem1GLYeqI51/WAGH1lCsXIEIiw3Bplp5SoPYlA6vlr6ox1O8vwZjwcBnBegCWoQ== 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=ilVOOXQ/jGY2Vt2JCiEZ77aNAdQvp3e+1r14WSf179o=; b=ZQwXmfEA+eZzOjzk/nKTWAWCfZ8jpojd3/aC8Eg8zFRQ2RCYxafZXZYRv9VB1kuat0IdPEaQTf0xD4q0wGQkD1/AHiRTaEAqzG5y4muhd6UoAJJHxfTfoANSyw1g6Q4gFJQpU60ov/jB9nofIh9uTZDIHRYNtmdbhOcachXDXm0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by VI1PR04MB7118.eurprd04.prod.outlook.com (2603:10a6:800:127::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Mon, 22 Jul 2024 11:59:50 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:50 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v2 26/30] dma/dpaa: improve ERRATA workaround solution Date: Mon, 22 Jul 2024 17:28:39 +0530 Message-Id: <20240722115843.1830105-27-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|VI1PR04MB7118:EE_ X-MS-Office365-Filtering-Correlation-Id: ad3e049e-d3bb-4a60-814b-08dcaa45c9dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: p+lRXAQRyIaf6I6bdSPsWJxbVbrgTJTFdeXifVbT2ufZikUpIm4Nvl7LGuv+c+kP5nD7RuNzELXscv/lhxBlCb5kJcANKseUKIrQtfNZiQUqWUbNyjYz+R8F38XieafC5aWOT2Zhk+Ld03u7KBjWOBkDbZ1CNWCc7IKr/KbZt3sqLdtkPUEsHERXqMFWmPpMI3wwO6qPBg7F0aH8VnZVNPtFiRlZE+PjTrcX4/omyzwXlrdDuTdiZvB7AdmQVf/UCMC+Sj5M0GVzOf8huv+rdv5zcJIIUUJvXOrggnpMLoYTaPv0boUV+5KGiY4thxTFXQO1rUqKMbhtEg0cace05STgmCdWDVRlkXzFh5NdOpgeZv0S3EWbnB8AUUzu1DBzhXr21yVfzGCqlA39kwKYIvIOCQTmec60+uZNwkozKn8aAo621+1DS6kaD9xL3NfAxUzImR58hKndPtWwunJMaSAbWb6WSaCL0itA+NO2r7JnGMGSLOaK2Fpmg1qQRmh8xMXbYddmL+LRSwI1UkKMpLq0XLaDnEBRPyNm+dJ+DQ4XidEBASzOJzTMn0CbLx1QkCuMl2NjO482P8bQVaIXCxHpdfza/zQ8zCbPYhCsB9n74orjln7mMQqu0ewuO9LD8M2Tirg+m7eWuXbCM9DwGgfpG3zjTzXIzLdlGGpml1+HCGR1AAZ5Lx+JRmoJGZedDeexZ4aqZonIBDA3jssUhTD06cCgxHPYn0QvYyHj0GdqnetoJiUz/Yg1JeIlU47uLduNDdfklPSrgxG/XUiSIQhwblh3yMIfp1eMF4vkhvDGI7/HYjpkYQWzdNErCwnT+rOkRH1H6XGtXu21oLkjlRHNm3lZfdult9d7oLnTT1ulItrgAm8nPsg6ZzloI7YJA0e3HEF82pK6Vks3qxD5l3re121sShIGkZnF6exp2F/knxWdnpkaqay+izRn4kC5cB4EjNJIdXGPvJEDL5gnpfxYpxtaVdbf6asQ6cJ/qXhFajE6LuaAf+punqLwRhxlkLwKs7rMuElCgH2XtYmjujwG6oUi26HBFd6JODCZr1TAfBd+UApeRt49gr6a7Q9v9UzM1+DDrBHfEBuGGnz94F/6uJE5daWrPKDR4f3jz935KJ2ze+FoNJ2Nupoiz4oKLBsa2Y5uaFbngEBzIwl4QwmOn8VtydgTOANsbjcNV+J3PBj9G/OH84l4Ml2FvnDBwGD1v+yyBdpur4Oz6YOgaewsoqFEoAYG+nABt3IGSEgmMJUgCyvqckTDS/zrG6X1GUY8eUu1reXI7tMMsRw3wN/Xptc9ap0H+VLHogUQK1p0Xc7BbEO7hrLOp+UEkEGY2bqrvWmS6cauMrSJZhPVHJ/X9tutmcamT9NMaxCU54Dg7nxTRH3N1aTJ8jqB4+SVdZLYYZotmtEtz+Cf6D4vKg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tb7ybPop1EVAoCa5/Ge1+aAU0AzMI8Xbd0rVJBbXA+BS7EvwaWWrlxVNeCNTrEAREkJsPFXpbLq2f1Im3rZ179L1LiXDKLEgfWTXW+V3S5+4yySPisoA8/C9RqmqmumTCyW9iTCUSfcJL2/TEE0fZUz19DbRFC+NYG3YXbEmv2zeDHnmf5+CgutdcGIfkLDJOiR2ZYeoOxaEkzb2Bz/AUwx04K85pQ1bCh8dGAtEWqraXdySf0DqNA42Rc8mj2wa57MBiRHUsQU91z589/ae7LreDvZaagWaP0sujv2dzIy15mzuB6i65odUXZwBMFusl4v/uMWHd4ifBmORuTWtdPbtOhIKxZmtbO9Kh8kePbbwWuepPElQWklFaQYf5S1cUMwk6yAIqCWmvZ3UGYscmw4il+VS0jubFF2D0xEnRyav+So2eTFG7s47jKsphpm3Nhh5rLEUuecKcnpuXgWyGnImSs/dwfC+FMSw+UAy6bhJ2DczF+xAw99DwoDQY/f7C6TmSuzOxJR68kRSlZ9YWLL334RicefVUrF6TMCqaeOFHLspzoCWlCYrEc86IfHyx1wyHhzfsxCQ4i4H7BBk3oh0U1DNuig36PUlBImPAJbAKW1LGp2wUkUYE7ZrQekBWGXYqsyAbA35o+yp6CGyruFrSe237fJa13ENyy/JWQsOJ5WBogmvCW9iCPSNuuNKNudfHrgbVbzDfgNhKAUyVjwwmqISVEyGKdd6otMOpVfsi8jIMvJrVd7yHTNMo5uQeVyZJXTo7Tt+J1F541S6tMpfWLWVzUh/BKpb7VSLjO/D06jYu5zs5RDkfjKOWUI/9lDah1fteWHX+zzAM6f5UYxzBujQqMf+tZTHzEATBplbliisNq0qSSoMxmMXgE6BS7TdYxvxs/0Sw/VBpwRwq9d2tTtbvQosXN7KB49OkMGKYW2oa2xNY8jQeJY6Yjld2chf/sXFSe0FRESK/Uw/Fhzdxh/osL4w3O6NBTJ90StSaFpFIi4IfMBslyW+VRr9G8omZ2UXRCEek1qW9qlcgYANPVq0hTrrZq/NzII6RVat1HDa7NGBn0XlKkA8+2PzLEWau5nTEDTcR0ioNOolxw3vGsARQ8IkZKur6Yl93UTKzxKNIPluPJliwkBu3CvNeXNrJV0rlIQ6sVxLfky0ayv/o11VjRdJpR6jeapHjreBwKrOCp/ZeM2WGtvW50NL6dqFeLECq/BtREGyCJ4QrEeQllrYfM9a0AbZ1zESxCVteRxxC7srgHmlt1Zg38mUtAQY4zR7pwT1ckgTRI+Zi45IGRePFXZIXIMEbO5fML+XKjVC0mL8D/g1tiGPQuHvgNYx7NJQmxwlfuwiWAPFQHVvOvruFEU0JDDZ5WSb7d1Bt0TNj0mE+WIAgWIHvrBrzLzrQOdYDdkuYfngY3h2nFrb19C+brIGIJiM+P4/GtARJ14zuh9e08GHTr+XkFupu+yWF6NJxy2oUFnQ8XzsKE8jaNjda1ypU11riUU71QqwSLypsBoZseiaOq1DWG0wTG9tpgQ1OMrtsYBfHGEEfXpLu+8T1z3RrVKjLAcLe7CrvOxkSmDh42Waj7eSySrd X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad3e049e-d3bb-4a60-814b-08dcaa45c9dc X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:49.9274 (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: 8ds+QsjMy8rkMnAWghFUJZQcmuAcyHZEGG+A2RoEgb8CBvImQQvCYC3nAkP3ANZl X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7118 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 From: Jun Yang Fix issue of ERRATA 050757/050265 workaround which is not effective in burst mode. SDF/DDF is referred by first entry of compound frame table, move the DF to compound frame table description which is suitable to adapt single copy and SG/burst copy. Fix SG issue which was caused by memset clearing phy address of SGE in compound frame table. Signed-off-by: Jun Yang --- drivers/dma/dpaa/dpaa_qdma.c | 215 +++++++++++++++++------------------ drivers/dma/dpaa/dpaa_qdma.h | 7 +- 2 files changed, 107 insertions(+), 115 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 8492d0de5b..5d91ad2d70 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -11,7 +11,10 @@ static int s_data_validation; static int s_hw_err_check; -static int s_sg_disable = 1; +static int s_sg_enable = 1; +#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 +static int s_pci_read = 1; +#endif static inline void qdma_desc_addr_set64(struct fsl_qdma_comp_cmd_desc *ccdf, u64 addr) @@ -126,10 +129,9 @@ fsl_qdma_pre_comp_sd_desc(struct fsl_qdma_queue *queue) struct fsl_qdma_comp_cmd_desc *ccdf; uint16_t i, j; struct fsl_qdma_cmpd_ft *ft; - struct fsl_qdma_df *df; for (i = 0; i < queue->n_cq; i++) { - dma_addr_t phy_ft = 0, phy_df = 0; + dma_addr_t phy_ft = 0; queue->ft[i] = dma_pool_alloc(NULL, sizeof(struct fsl_qdma_cmpd_ft), @@ -156,25 +158,14 @@ fsl_qdma_pre_comp_sd_desc(struct fsl_qdma_queue *queue) offsetof(struct fsl_qdma_cmpd_ft, desc_ssge); queue->ft[i]->phy_dsge = phy_ft + offsetof(struct fsl_qdma_cmpd_ft, desc_dsge); - - queue->df[i] = dma_pool_alloc(NULL, - sizeof(struct fsl_qdma_df), - RTE_CACHE_LINE_SIZE, &phy_df); - if (!queue->df[i]) { - rte_free(queue->ft[i]); - queue->ft[i] = NULL; - goto fail; - } - - memset(queue->ft[i], 0, sizeof(struct fsl_qdma_cmpd_ft)); - memset(queue->df[i], 0, sizeof(struct fsl_qdma_df)); + queue->ft[i]->phy_df = phy_ft + + offsetof(struct fsl_qdma_cmpd_ft, df); ft = queue->ft[i]; - df = queue->df[i]; - sdf = &df->sdf; - ddf = &df->ddf; + sdf = &ft->df.sdf; + ddf = &ft->df.ddf; /* Compound Command Descriptor(Frame List Table) */ - qdma_desc_sge_addr_set64(&ft->desc_buf, phy_df); + qdma_desc_sge_addr_set64(&ft->desc_buf, ft->phy_df); /* It must be 32 as Compound S/G Descriptor */ ft->desc_buf.length = sizeof(struct fsl_qdma_df); @@ -198,10 +189,8 @@ fsl_qdma_pre_comp_sd_desc(struct fsl_qdma_queue *queue) return 0; fail: - for (j = 0; j < i; j++) { + for (j = 0; j < i; j++) rte_free(queue->ft[j]); - rte_free(queue->df[j]); - } return -ENOMEM; } @@ -247,23 +236,12 @@ fsl_qdma_alloc_queue_resources(struct fsl_qdma_engine *fsl_qdma, rte_free(cmd_queue->cq); return -ENOMEM; } - sprintf(nm, "Descriptor Buf_%d_%d", - block_id, queue_id); - cmd_queue->df = rte_zmalloc(nm, - sizeof(void *) * QDMA_QUEUE_SIZE, 0); - if (!cmd_queue->df) { - DPAA_QDMA_ERR("%s zmalloc failed!", nm); - rte_free(cmd_queue->ft); - rte_free(cmd_queue->cq); - return -ENOMEM; - } sprintf(nm, "Pending_desc_%d_%d", block_id, queue_id); cmd_queue->pending_desc = rte_zmalloc(nm, sizeof(struct fsl_qdma_desc) * FSL_QDMA_MAX_DESC_NUM, 0); if (!cmd_queue->pending_desc) { DPAA_QDMA_ERR("%s zmalloc failed!", nm); - rte_free(cmd_queue->df); rte_free(cmd_queue->ft); rte_free(cmd_queue->cq); return -ENOMEM; @@ -278,7 +256,6 @@ fsl_qdma_alloc_queue_resources(struct fsl_qdma_engine *fsl_qdma, rte_free(cmd_queue->pending_desc); rte_free(cmd_queue->ft); rte_free(cmd_queue->cq); - rte_free(cmd_queue->df); return -ENOMEM; } sprintf(nm, "complete-desc_ring_%d_%d", @@ -292,7 +269,6 @@ fsl_qdma_alloc_queue_resources(struct fsl_qdma_engine *fsl_qdma, rte_free(cmd_queue->pending_desc); rte_free(cmd_queue->ft); rte_free(cmd_queue->cq); - rte_free(cmd_queue->df); return -ENOMEM; } sprintf(nm, "complete-pool-desc_ring_%d_%d", @@ -307,7 +283,6 @@ fsl_qdma_alloc_queue_resources(struct fsl_qdma_engine *fsl_qdma, rte_free(cmd_queue->pending_desc); rte_free(cmd_queue->ft); rte_free(cmd_queue->cq); - rte_free(cmd_queue->df); return -ENOMEM; } @@ -320,7 +295,6 @@ fsl_qdma_alloc_queue_resources(struct fsl_qdma_engine *fsl_qdma, static void fsl_qdma_free_cmdq_res(struct fsl_qdma_queue *queue) { - rte_free(queue->df); rte_free(queue->ft); rte_free(queue->cq); rte_free(queue->pending_desc); @@ -664,8 +638,30 @@ fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, struct fsl_qdma_comp_sg_desc *csgf_src, *csgf_dest; struct fsl_qdma_cmpd_ft *ft; int ret; +#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 + struct fsl_qdma_sdf *sdf; +#endif ft = fsl_queue->ft[fsl_queue->ci]; + +#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 + if (s_pci_read) { + sdf = &ft->df.sdf; + sdf->srttype = FSL_QDMA_CMD_RWTTYPE; +#ifdef RTE_DMA_DPAA_ERRATA_ERR050265 + sdf->prefetch = 1; +#endif + if (len > FSL_QDMA_CMD_SS_ERR050757_LEN) { + sdf->ssen = 1; + sdf->sss = FSL_QDMA_CMD_SS_ERR050757_LEN; + sdf->ssd = FSL_QDMA_CMD_SS_ERR050757_LEN; + } else { + sdf->ssen = 0; + sdf->sss = 0; + sdf->ssd = 0; + } + } +#endif csgf_src = &ft->desc_sbuf; csgf_dest = &ft->desc_dbuf; qdma_desc_sge_addr_set64(csgf_src, src); @@ -745,7 +741,7 @@ fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) } static int -fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue) +fsl_qdma_enqueue_desc_sg(struct fsl_qdma_queue *fsl_queue) { uint8_t *block = fsl_queue->block_vir, i; struct fsl_qdma_comp_sg_desc *csgf_src, *csgf_dest; @@ -758,74 +754,10 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue) struct fsl_qdma_sdf *sdf; #endif - ret = fsl_qdma_enqueue_overflow(fsl_queue); - if (unlikely(ret)) - return ret; - ft = fsl_queue->ft[fsl_queue->ci]; csgf_src = &ft->desc_sbuf; csgf_dest = &ft->desc_dbuf; -#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 - sdf = &fsl_queue->df[fsl_queue->ci]->sdf; - sdf->srttype = FSL_QDMA_CMD_RWTTYPE; -#ifdef RTE_DMA_DPAA_ERRATA_ERR050265 - sdf->prefetch = 1; -#endif -#endif - - if (num == 1) { -#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 - if (fsl_queue->pending_desc[start].len > - FSL_QDMA_CMD_SSS_DISTANCE) { - sdf->ssen = 1; - sdf->sss = FSL_QDMA_CMD_SSS_STRIDE; - sdf->ssd = FSL_QDMA_CMD_SSS_DISTANCE; - } else { - sdf->sss = 0; - sdf->ssd = 0; - } -#endif - ret = fsl_qdma_enqueue_desc_single(fsl_queue, - fsl_queue->pending_desc[start].dst, - fsl_queue->pending_desc[start].src, - fsl_queue->pending_desc[start].len); - if (!ret) { - fsl_queue->pending_start = - (start + 1) & (fsl_queue->pending_max - 1); - fsl_queue->pending_num = 0; - } - return ret; - } else if (s_sg_disable) { - while (fsl_queue->pending_num > 0) { -#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 - if (fsl_queue->pending_desc[start].len > - FSL_QDMA_CMD_SSS_DISTANCE) { - sdf->ssen = 1; - sdf->sss = FSL_QDMA_CMD_SSS_STRIDE; - sdf->ssd = FSL_QDMA_CMD_SSS_DISTANCE; - } else { - sdf->sss = 0; - sdf->ssd = 0; - } -#endif - ret = fsl_qdma_enqueue_desc_single(fsl_queue, - fsl_queue->pending_desc[start].dst, - fsl_queue->pending_desc[start].src, - fsl_queue->pending_desc[start].len); - if (!ret) { - start = (start + 1) & - (fsl_queue->pending_max - 1); - fsl_queue->pending_start = start; - fsl_queue->pending_num--; - } else { - DPAA_QDMA_ERR("Eq pending desc failed(%d)", - ret); - return -EIO; - } - } - return 0; - } qdma_desc_sge_addr_set64(csgf_src, ft->phy_ssge); csgf_src->extion = 1; qdma_desc_sge_addr_set64(csgf_dest, ft->phy_dsge); @@ -849,13 +781,21 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue) csgf_src->length = total_len; csgf_dest->length = total_len; #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 - if (total_len > FSL_QDMA_CMD_SSS_DISTANCE) { - sdf->ssen = 1; - sdf->sss = FSL_QDMA_CMD_SSS_STRIDE; - sdf->ssd = FSL_QDMA_CMD_SSS_DISTANCE; - } else { - sdf->sss = 0; - sdf->ssd = 0; + if (s_pci_read) { + sdf = &ft->df.sdf; + sdf->srttype = FSL_QDMA_CMD_RWTTYPE; +#ifdef RTE_DMA_DPAA_ERRATA_ERR050265 + sdf->prefetch = 1; +#endif + if (total_len > FSL_QDMA_CMD_SS_ERR050757_LEN) { + sdf->ssen = 1; + sdf->sss = FSL_QDMA_CMD_SS_ERR050757_LEN; + sdf->ssd = FSL_QDMA_CMD_SS_ERR050757_LEN; + } else { + sdf->ssen = 0; + sdf->sss = 0; + sdf->ssd = 0; + } } #endif ret = fsl_qdma_enqueue_desc_to_ring(fsl_queue, 1); @@ -875,6 +815,51 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue) return 0; } +static int +fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue) +{ + uint16_t start = fsl_queue->pending_start; + int ret; + + ret = fsl_qdma_enqueue_overflow(fsl_queue); + if (unlikely(ret)) + return ret; + + if (fsl_queue->pending_num == 1) { + ret = fsl_qdma_enqueue_desc_single(fsl_queue, + fsl_queue->pending_desc[start].dst, + fsl_queue->pending_desc[start].src, + fsl_queue->pending_desc[start].len); + if (!ret) { + fsl_queue->pending_start = + (start + 1) & (fsl_queue->pending_max - 1); + fsl_queue->pending_num = 0; + } + return ret; + } else if (!s_sg_enable) { + while (fsl_queue->pending_num > 0) { + ret = fsl_qdma_enqueue_desc_single(fsl_queue, + fsl_queue->pending_desc[start].dst, + fsl_queue->pending_desc[start].src, + fsl_queue->pending_desc[start].len); + if (!ret) { + start = (start + 1) & + (fsl_queue->pending_max - 1); + fsl_queue->pending_start = start; + fsl_queue->pending_num--; + } else { + DPAA_QDMA_ERR("Eq pending desc failed(%d)", + ret); + return -EIO; + } + } + + return 0; + } + + return fsl_qdma_enqueue_desc_sg(fsl_queue); +} + static int dpaa_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_info, __rte_unused uint32_t info_sz) @@ -1276,6 +1261,7 @@ dpaa_qdma_init(struct rte_dma_dev *dmadev) int regs_size; int ret; uint32_t i, j, k; + char *penv; if (getenv("DPAA_QDMA_DATA_VALIDATION")) s_data_validation = 1; @@ -1283,8 +1269,15 @@ dpaa_qdma_init(struct rte_dma_dev *dmadev) if (getenv("DPAA_QDMA_HW_ERR_CHECK")) s_hw_err_check = 1; - if (getenv("DPAA_QDMA_SG_DISABLE")) - s_sg_disable = 1; + penv = getenv("DPAA_QDMA_SG_ENABLE"); + if (penv) + s_sg_enable = atoi(penv); + +#ifdef RTE_DMA_DPAA_ERRATA_ERR050757 + penv = getenv("DPAA_QDMA_PCI_READ"); + if (penv) + s_pci_read = atoi(penv); +#endif fsl_qdma->n_queues = QDMA_QUEUES * QDMA_BLOCKS; fsl_qdma->num_blocks = QDMA_BLOCKS; diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 9d8d9e865d..753ac6973d 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -88,9 +88,7 @@ #define FSL_QDMA_CMD_RWTTYPE 0x4 #define FSL_QDMA_CMD_LWC 0x2 -#define FSL_QDMA_CFG_SSS_OFFSET 12 -#define FSL_QDMA_CMD_SSS_STRIDE 128 -#define FSL_QDMA_CMD_SSS_DISTANCE 128 +#define FSL_QDMA_CMD_SS_ERR050757_LEN 128 /* qdma engine attribute */ #define QDMA_QUEUE_SIZE FSL_QDMA_CIRCULAR_DESC_SIZE_MIN @@ -192,8 +190,10 @@ struct fsl_qdma_cmpd_ft { uint64_t cache_align[2]; struct fsl_qdma_comp_sg_desc desc_ssge[FSL_QDMA_SG_MAX_ENTRY]; struct fsl_qdma_comp_sg_desc desc_dsge[FSL_QDMA_SG_MAX_ENTRY]; + struct fsl_qdma_df df; uint64_t phy_ssge; uint64_t phy_dsge; + uint64_t phy_df; } __rte_packed; #define FSL_QDMA_ERR_REG_STATUS_OFFSET 0xe00 @@ -273,7 +273,6 @@ struct fsl_qdma_queue { uint8_t pending_num; uint16_t complete_start; dma_addr_t bus_addr; - struct fsl_qdma_df **df; void *engine; }; From patchwork Mon Jul 22 11:58:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142601 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A89C645681; Mon, 22 Jul 2024 14:02:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CF16C406B8; Mon, 22 Jul 2024 13:59:55 +0200 (CEST) Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011007.outbound.protection.outlook.com [52.101.70.7]) by mails.dpdk.org (Postfix) with ESMTP id F1B1940697 for ; Mon, 22 Jul 2024 13:59:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZRS2grZeuIZ5R8Yn5cFDIBsQbcgfkkr9cljfdt2Rw9vmLuDcpv3ITxHycMUJM8SVP25TM5Yky+7lWDnxECPm1kUGtR1SzaWs832thwV+3Ijtkbr/OBNVm7Ntr65GQBDwnQlRC3fqG79j2l4D4jmxTF6S1VgDy6jkYQ7J6AW/WILSnYZJlU7g0H+iY7ITdOZfBjXiRp8IIe5Ve3kUXvNSdsMMt7LhCvMX8o6fROcvWwuSPxRRrvqWh7Emd0cwoIycEM3+8F19hQW/RoKGKvtnN4wDLbQw2XSH9J+1sftUiAMc8KDHbzUzITNhxDjOvl9rptgJuoXnAgx14lC0bOrVVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dD6irFh+S+2CpJUTE5a7b/XIGzFEL71shfOr244B+3g=; b=IP3dx75uE0amT3StNugRs5uHNwgQtQhCSV9Ki1KPrxjIQgl+B5Gol1xjtmdR1AW5+SFJXAOmdHiQLm0Q7R5tXGtnZqY/0WU7HuLI9dnIE68Yk2/2b+G35wClbluNFCs8HOvyCVmpfhzn5C1yximQasaKYP9gI1Z74l+MapJ+OwNtJka6bENPf7F/ARp5/Kh++KLdehUQV7h3WXm30KPQoT7bsS8VnRvzEpjk8Qt7Qtag7OFLpY6tV9XJfNvrzEPWvmbXpbzFRmIAoSw09MMrpvSPNNUgHKGTaCOivWXiU9vEkXDHahTaoqeb7BSLJTQpo3jtN5cZDuS3fLpK1ZWx8Q== 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=dD6irFh+S+2CpJUTE5a7b/XIGzFEL71shfOr244B+3g=; b=rDQc2hjfEkZpbmsx7N1HfBlcdE3+mSGsXPN6sCE8jA8f2gQkynZyYXGgp8sRWjL5vrTwx6P51PKLUtZCmh8jjEvOjwomolcqO2rIkr1iAdfoEoMDStB1rlqHzDhHj9F/JHOlPBJhNWn7TlT3FYyxUkNUSdff4wgBtxJU9YeA8dA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by VI1PR04MB7118.eurprd04.prod.outlook.com (2603:10a6:800:127::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Mon, 22 Jul 2024 11:59:51 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:51 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v2 27/30] dma/dpaa: improve silent mode support Date: Mon, 22 Jul 2024 17:28:40 +0530 Message-Id: <20240722115843.1830105-28-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|VI1PR04MB7118:EE_ X-MS-Office365-Filtering-Correlation-Id: f62e5d5e-ef51-409e-d36b-08dcaa45cafb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: d5ssGRtDK+idvVYl5ch3ntJhJruD/lLfC+b0KnNxtwWLMvvKd4pYqBxsty/bdLsxU0iJRDwTwBvUQnTO+O8RvHamh0BIqiaTT6iy+sKgctYvAUpTaFmQ6r/khIV6gD6z8cBR1GSGcR4oOby3+cOvnrslQRWSX48rb4KtiuF+W5s9knHiv+gPouluavplIjHH2uEzNlMo96srz1AzLqb5Rb1hMhSmfOXEe1/JKWVgl7V62eudBFPF8n7XuPLxGNEKnf4iUGJ39RM8du5rXXnhZDuZ0YZ59Er99VHuPp7GJ4VzBqlp1O80pk9yONvVwFEYlXp60eavH7FCs6oYQhzuYRU5kKfspnounIHVS1pnEZbPjH5dMDMpF3AXBh3uvgxKdItsKNWxNk71aJg2IwzvmXLPqU2EDkxvKgA2SW37W0MsEgwmmZfDUhHizQXgeba4Fpsf+NlMKMrzm9zCanpOCYENfe17ysmFSXDXQcR6IDSbZyZ3STE91yG5JfSqURYRSn9ZnVWVL7ApbwH9yrGXbgVjJrSznl66XZNP0fkUgp2kEv9kjHUtCwcg3n6G1a/oPnNdYhBlvhRUO70IG6ec6S1NCWlIK/BWWz3Utbt3J0ALIsYrPR0H68IK2viLcgwYwQf6z9TjwktlXv0TWHdN2ggTXg46AIACc98fMVDBrbUn/uupaUuLwmTO8csutmSse+WMYnqFLd5KRiSHmwwN2NvUxgioBJdsXj2FvXJwthlujK0/mkt69fewGytcXZdWN7gqhDl1jSF3u6ZEa2DmILzPqW4ToChOcLpRhL5ibZJObZdviVBys9FQVyv7o4NncYP7VWzQZbhkHcc9+W4eCt7S+y3XXorwDYuE893vZer+I51aSZVU8OH6erH7byCAynEd5BemnsLSPRB9SPTi/cEXDJNi/TbRTXJs2+eZcdWQFZL6pzr/vViHXnw0DVDEpaKhQphVSLqi12eQD97FOcXnOKRR5tHSievfzWuzprqNK/Jnn1N/PNDcFDxlApNf5GawWwmsRAESRSNo7j8cNzjNwtrS4qps5IeDJMyY7j0g7jG7Iz1oAp4/Ay1RTjrx1zpA3sysZeZCYIDcJKgsSRNkDZssdWSVg9rh3O5aQBdUdzEOAGE7giHFcQ6Ln+Ej4p9L0q1aGb4cfo1eN1Kdpv98Hh9HWAPMV+vmndsg/wZftl/+JynlerqB/2enIG+Hp8ZMbFO/c/wWgdHjTJRoZ6dRHN6TJ/Hbs6RLnPXUuObbPI6rIfLVWZy8knjCuqzDXLDc6zfCjNyjGbfFFvpnJun3ZR5L1LVTuHhBRXfxopjeiXvDVU2uyIwbpZyszqHGl4nzkYu2QlszLwHOZrGRkNrXu1eYiPoX9m8YIQ87bA/Er93KNJC7q9Ce2HWI7MyckFyTDq+x9V5EqgKCEYGnHQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LWtDJL/NF1LP3CQK5NT7Zl3ZeW8hu1jeR8KdRT4a6MZz5oTIkea51GuLELuS1fjvqV7DI1SrYIHgcqkzG74/hN5CV6umGqLG7VBAmnpX/1Fap9s25NPKzfD3qlnbxBTQ/EHVf7Ppe2pzI11ELfFDIR4POnmNZ+vm1z/LjqounEco1V4C5cIq8wEMecPJ0NYSZwwjs2RZhcIgoUQzuHe7PdOlhOHsGhRsU3PMFSURct5f5XK0+j/zgWeaaDJBmvY7LVsfUSxgWrHNGHFjg9lLbm1RhyF916Y6NxRv6U3XDx2SNjSb/fg8q26RIu7f6OP+Uq3E7wP/ptoyiQPhQm41AJlbmpRhaDwZOMRNLZR9bvWmhN2dd6lbiAnwrrd5e3+OlTKW9v9qBEATvA9AhvvGIB8JwGErDQbAWdVBY0DTEv4/QnlWba51eTN1k4zQqbgIfI1pYl8DkRXfVFBkUyd39WjPqSRIcMLcI2v0WXXBwFYibbqpCzDrJpS1Ep3VMiQgFYvBzI/K0aBYSLyb0V2mER84ra7ENOgYUFjBBgeIqL2c3nXL0egkkycBxtbUTaZb+KehMfIsIb7ypopMhpJQiUz/u5gXBm6vKG8XHS2U0n1UDS7Q4NpWNSkom0z1ZEk4QcrWso0AKTk1qjhKYvRD/GAUExIoPOpwzMpp9YDIk23EYM0+BlbekQnp3QC59ebt0VoZG8SJm+niH8ak8B29u82Py/hE7HOfRBxhHOGz6KRk/W/KB0qmJO/aIkPkjEy7JHvzw+N/OniPIeOV2Ax54jVekmPIRN0w0pF9h/CU1H+wW77xLE7rrjP+8w9Uem9AVD0SBOAWjJiExT2vmYzndRK9kkfccZ/VDuRywBM8u8TDstbUgHa/ggX0TRiX08+2LFYPrgnD4eEyQwGFLSHds2h7q1hxVrlxgxE2uB3KGiEXP0Ln/vwTDCeOmPHR3Xc4foPPQDgKFWgZbjA2b7UDAvuMAK63Z4HkstWddnDNv+qyq0Hnj476RpbhlwbIxzDiNSpZ8rVuZpArzPXcFH3aDw9wYkXEQ4FmGDdhe+h4Dpm5bFFnruAtdOi0N33jliehLmfSNfCHv7L1YFGVKeOTFjmotsLooYSNkgka3Cn+/htutooYzvaRDOEIC9Vg3Lcx72kTxlUF5M9KyC99wNa67OdHj++VtooZvd9Kb+v2iTFzGBgMjHbs9REWra8rVQqexnDcbMf0/O/SWIK9rEaVeCb3ox1swULTk7HeX400Xmq+JGsP75kMVzZGcyrnB+lmLYlhxiXA6K2BjJQ8aG/NUz19U5fvDFr92OFbDPi2U29/dlF2TB+bxm4esiBxerEh68sL3SSjguA872gFaJ1cow+pWPGwN2mzHVZbTR/A2B7lu0UNLTlN6/YMMr13XzHkY/n3bK+0LxvCBp+nWN1RsGMwvNeJQZAw5tf71Ia/NT1/TnmSt+GJx7fr99IUPrhWFNubFY1lE8p+6W9acrTjakxfAU2dseQBs24rq9kVyulFHiz7DcjKjwJ45Jy2dBoOzuyA++rIKyj1xjl+7JArqkMoKoP/cnSFAgKGpXK3pW1wl0iBkUspLUwlC+6Z2ZB7 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f62e5d5e-ef51-409e-d36b-08dcaa45cafb X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:51.7107 (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: e4D6nL6URmEFB3dx/cVm3FGb5iMMMLI+Dff1vERMYwIpNZxl46Ye+zRcJfaSAdbN X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7118 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 From: Jun Yang Don't save eq context in silent mode, check HW status only to identify if queue is full. Signed-off-by: Jun Yang --- drivers/dma/dpaa/dpaa_qdma.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 5d91ad2d70..8f5b6c6ea5 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -586,9 +586,13 @@ static int fsl_qdma_enqueue_desc_to_ring(struct fsl_qdma_queue *fsl_queue, int is_burst) { + struct fsl_qdma_engine *fsl_qdma = fsl_queue->engine; uint16_t i, num = fsl_queue->pending_num, idx, start, dq; int ret, dq_cnt; + if (fsl_qdma->is_silent) + return 0; + num = is_burst ? fsl_queue->pending_num : 1; fsl_queue->desc_in_hw[fsl_queue->ci] = num; @@ -697,7 +701,7 @@ fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) check_num = 0; overflow_check: - if (unlikely(s_hw_err_check)) { + if (fsl_qdma->is_silent || unlikely(s_hw_err_check)) { reg = qdma_readl_be(block + FSL_QDMA_BCQSR(fsl_queue->queue_id)); overflow = (reg & FSL_QDMA_BCQSR_QF_XOFF_BE) ? @@ -707,8 +711,14 @@ fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) QDMA_QUEUE_CR_WM) ? 1 : 0; } - if (likely(!overflow)) + if (likely(!overflow)) { return 0; + } else if (fsl_qdma->is_silent) { + check_num++; + if (check_num < 1000) + goto overflow_check; + return -ENOSPC; + } DPAA_QDMA_DP_DEBUG("TC%d/Q%d submitted(%"PRIu64")-completed(%"PRIu64") >= %d", fsl_queue->block_id, fsl_queue->queue_id, From patchwork Mon Jul 22 11:58:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142602 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 59C0045681; Mon, 22 Jul 2024 14:02:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 72D4F40A75; Mon, 22 Jul 2024 13:59:57 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013043.outbound.protection.outlook.com [52.101.67.43]) by mails.dpdk.org (Postfix) with ESMTP id A2D16406FF for ; Mon, 22 Jul 2024 13:59:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MBeIJReaSjMgJS7X+LaJbCz853W3czfHDUmerIkh6JhTkzXoIMyCvgewqnHmvG0MAhGXD4wQUoLeXdlSod48w932raijOJajD96+1UMtnUet7uK11nqaeOHDbsMywiO9IqTeNyxY1RLClyMX0iztd/u2n/LS6xwEo7UhRXPWWgzmjcZXTbkFek5KK/rSbQ+gk62E49lpHZWJfbGFkEGmPGCegsau/rlyZi4H/k2w/kJab8KT0eWUvyMR4nfa2PjpBoyWuIQskmrhPYYrhrpDGeEC1JCvwk5z4m17BePdiudaTmD1i2UjOQBdkR4np0Jx8vgm+2+pKg85UMtai0EKzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=M3FwTatwbHj/wkIh8g2ZxZbkWpHC+V/fkpYcUEth8ro=; b=hFMGCBOtXDMEiY3nd93WMYpgYRE6WbzSUcgJJlkWgJZcYyRRcjaki7PwKWQxYLf+egEbBLATQUvIFw9sb/bB2YdyE9FzUniYDpLY7A6ItJOblH5GOdH6VLZWD9aVEjLgAb86nn9q+30HIk5mwNIQJOw7JmQC92hhu08ih/sHTrcpPagab2tvwhGj7XRrwRVJVG5D0IfXsouZ8Fr1fylx+PBJaceHrB5pNZjl5f7dllv9snq+ycdZmDV7T8lEWCa59ZbqJUGKicJMx7BVv2seHuvZmmjh8v0GBDMsqWMo7eagGqCMEUsA4wZLIg/UiukrWC4GEXTjrzi6nre249cDhg== 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=M3FwTatwbHj/wkIh8g2ZxZbkWpHC+V/fkpYcUEth8ro=; b=H9w+jTo6MY90m908f8NQQ8LajOLWehmxbRnQLirl/oFy9CB/Owp+mPaCkZWDKGhQ8GQx11U9wK1XwuQE9QZJPR/GSZ6LDAUVSEzgEEfN5QC2VontaFXZhgGDVuVWi61ctcgSRgqzBMJOI1PFAu/lyNDw0/KBwd1ee0HZNrX7Kzs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by DUZPR04MB9917.eurprd04.prod.outlook.com (2603:10a6:10:4d8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Mon, 22 Jul 2024 11:59:53 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:53 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v2 28/30] dma/dpaa: support multiple SG copies Date: Mon, 22 Jul 2024 17:28:41 +0530 Message-Id: <20240722115843.1830105-29-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9917:EE_ X-MS-Office365-Filtering-Correlation-Id: 56bc6d2a-f859-417c-4ef7-08dcaa45cc11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: rNw7tz9lbQR3Ofq6OANj1rHK5rIiaxa+PIFJ8SyyG0zKJXFlilDFTtsIIB7wF9WTy92GlZJ54P9EfbrK7+rtIOjJNm8vXx7WNUf9s9YRlyWP4xI6pOXaiGcrcb3IljD2BTT9+23gooRyk/WvkM7xMZtzw9Mnjnh+n9OEKCZVyjdTEufz+xKkgfX5XxB7Bq0EP7ccm8V2VxvT/TPpShTY9fAaZfWoCOeiTpQE/DNeVuygzQuUauqMhpSL4q77ao8B/OIYWLoEO+MJichAynumYBdK5oeIwn3pCwNVtn5SS84vGaUfX1C0OuIkzf7pIaRxVawLd8lWtkc3QuvBEsWpdViZocdejNffZz1Dbc5KKjZSbqYkeTct8/MaYcagMOuxhr8kvYwAQiymSrlAPzYgnx1IqSHumvMVIbD1G1MsvIovXYmrgHaUA06YKkOR5Viy3dwcKgQ9g9jCG4ZLQbsNoKBZXmjOanpp7A7fDHn8D/9o1XClmXz990L/gmvH/AxWCfNvLLegW5z9cHlR0k9mMStelUuLWBJadyNRJV9PBbDn5s2w5DWKFDEHwq17xipBy7IK1nZmiwPc9aHa3j891MEu1lrM+zGD5qqL4Yf5tp+wQ48tyIuRT4GSX+sIlBhoxfnRmPhfJYPrw58UxAr+QBENKxy1HdBS+9QzSf1MzetKSQ98fM3M0Om9dTTO6+L/Bdl4zJAORWZbd4VCB+sbR+pIqgM/3A53+haP8TH4tKJtKasG/BxfKujCgBgKSHtV4tDuZ2SmIYQgeGMQfWv3+L8YZQvARn9KkZfSeYVoxdUoEancUCJgObnYlIAcOh3hf/HYEaU88fmYhBfgvdej4vqm3yY/0VsmejvqmV0Qd1aItl52dioWLOsY9vBore6mudToxQFpnPLLjkNuu9DvoF4tbNFDEOAdAAtEfGVa9grryNdgFKIM/97deAc3k3ahaREKg84c2ssuSkYr31bKvqvOth9iNgSSWPDY+m48+foHygl6N39r2pLYRbdXVq6GIv8ej/mbfdO5LtIwO9B1ng21QCadMCQVrBAym/PTJCx5VRO6YYfJEev4tTWnfU9/nKLQfcjM9Iz/LVUTefGag5MCMHVVbSqVve/V7xJiaCRECf2S6Pl84s8Bic2NWz1ue1rKkyemFb3fy8anOKO5J0rs2sCx8TIfn0kXFPBsjLAp3nZOTn6pFxmQLrkgbo5DXnvPk8sH6iSb99NDZ8Dak4VSabnpGzMpK9ENhaKvyvyMVzFFAAmFgGOTFkYRbIs/m5CeXU+0C12U+uqW/j8qfUt8BYJqtRGHSYeWcbQxIwRXqfvbwCX7ASJjySAS+pnsT1S18v50MWwf195kFd5SwEadiDIIdRpYZ7wbHO3pEcCip6jxs1RdKbmrM67GB/0V5OAqKx2jiIJ5k10bEdgCJg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8+KqeGBUGsWMzzK8KCse0dVwjaLOhQuDftEGcWVTIFj8CkCZRmm6Ts/xJcs0iaIPVyTjPF0F8umq1T4c2UhhbeE9KAiOEoaALXU0IAy/QR4ixFZjsfFT1ya62ym3KDaw9e3OpqUwF+8ZI0AYmTmIVFgw76k9VsoVRbHY4v23FwukMt+QszJJWO5kINCzOtmCZRd8jUcny/CbzJRt9A/u76RKxAmfznlZ5WsJjCQ8RXEpdIDy4e6/AucHcsQbz2umOQQYLLJrw5nYIVOAZqJLeDGfxqB3MkVFDK2ZnUAtwNcmiMly2eAaTuQPM+rqXYyjArzeDC1FQBBQ+pGgKPOXIiPdQOOQb4/kUUndqeQ7/WSyeIKiDBMiabExNYRWZZhGr5ksUYmwzeRmHV9f7fEHUBwIbZEMUfL441IiWdp4rLwrsYvcdr1U6kBcntlvIgWILaC8SknAK5N7qEZWhnUZcKNvgdqO02i/ocFOV1Guif+ybrzqWqNkgOkab7EI3EiXbcFauosfxzTrS9VznavCDzmIi0rPIt0eGURMj6Tw8xtIq6XQuKCi0+NM+aR0WXVkY1vJWcP+EbQjH3e1A5iLHlAv042zZBhWY0KVDu/cBrC1uNWPwWjOcigY8JSa7wGIhrLwmo46pa9nfueFPiQwkpzxCJJV4ZQMMXYwRIhhTgwILmgZKENcti9o+c4qFMv1TBCv8D70kvoVWt5OAkm/0e20oVptXJ5waIFBfe8sUsg09CPdeF3E4pFaDrT9rl5DB1+GUlhsTh1/JJlxcoHVdYMoJPLZzHYARv4LGq4nnDvtuBvg2ffpfEwTuU95JRIthKrl8hXAsSxCDRKiwF4cZpbSDQZKOS/4/9kQcWPiM9ChxVF1FzaUXya3x8pEXoZrS1UWrIWI2yGtuGoDbtPNQ5sZsFtf/iG9+OnNRpL4axTrZTZg7rzF9xxT8/7NB2IZCc0NZM1qnvNnqsTTHAu9FTiKEEGNVBzlfK7S3wyGbk23miBhPc440mDi+zZnwlo/D2stFPDiPIv2/bdSzG5gqGZ1toeya/er9dZQF/ZAUYL0rfhOLshMac4ozGtiu2uDSlDRCu86XnIk79gbrXCc53Go8pn2XjEi5mZoTBSrL4oxA58kOtlpyEgTs/9VCD72Z3zOIbyLhNr7KrKOWEulWAVn6ZFg3sf9PcYoBTa7xZPN42Bz7SFWY/sj3g11yP3uw89Edh1FEsI/r5610pZgdno2zXdZvN/xXKiXXV4V7dbyC4wGdmXRZa6TmzisMFVrlHJESaltXAtvGb84aueT9Q+0b2hkG4tzf/5s3/oYSH3i8J8f1HPcIGPMZb4MGAU9sSv0TPgtRuoOdFt5N1EVr3yeAw3e2C7jZyb8UXSOQTmeDOsjnHbAyBhxopKkpsR9SFHFIIb4HqunlbvYyhQWqq6NJGPzUGo5zqwL8U1BnWwCymHE3d3DHtBla+mt8qJuYEZdYVq9BhxeF5HyVPAbnAO3gcXyKXaqrWmUbZgDKPUzLNrY+lDJH1Sz3tEZDyMUqbBz/eDGhg7fR0dOKDsmSUPWBTVym97/6kezLzOaEE2nXxspGEWVaw2YJ35m1y6O X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 56bc6d2a-f859-417c-4ef7-08dcaa45cc11 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:53.5514 (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: gI2O0gMy/IUes6vOuUr+jAPsvspqLmkIe/9bYn7qM7dOz6YsQ+8yVtq8SPaIhPYn X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9917 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 From: Jun Yang Split burst copies to multiple SG copies if burst number exceeds max number of SG entries. Signed-off-by: Jun Yang --- drivers/dma/dpaa/dpaa_qdma.c | 180 +++++++++++++++++++---------------- drivers/dma/dpaa/dpaa_qdma.h | 2 +- 2 files changed, 98 insertions(+), 84 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 8f5b6c6ea5..383142fc75 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -584,17 +584,15 @@ dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma, static int fsl_qdma_enqueue_desc_to_ring(struct fsl_qdma_queue *fsl_queue, - int is_burst) + uint16_t num) { struct fsl_qdma_engine *fsl_qdma = fsl_queue->engine; - uint16_t i, num = fsl_queue->pending_num, idx, start, dq; + uint16_t i, idx, start, dq; int ret, dq_cnt; if (fsl_qdma->is_silent) return 0; - num = is_burst ? fsl_queue->pending_num : 1; - fsl_queue->desc_in_hw[fsl_queue->ci] = num; eq_again: ret = rte_ring_enqueue(fsl_queue->complete_burst, @@ -634,6 +632,69 @@ fsl_qdma_enqueue_desc_to_ring(struct fsl_qdma_queue *fsl_queue, return 0; } +static int +fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) +{ + int overflow = 0; + uint32_t reg; + uint16_t blk_drain, check_num, drain_num; + uint8_t *block = fsl_queue->block_vir; + const struct rte_dma_stats *st = &fsl_queue->stats; + struct fsl_qdma_engine *fsl_qdma = fsl_queue->engine; + + check_num = 0; +overflow_check: + if (fsl_qdma->is_silent || unlikely(s_hw_err_check)) { + reg = qdma_readl_be(block + + FSL_QDMA_BCQSR(fsl_queue->queue_id)); + overflow = (reg & FSL_QDMA_BCQSR_QF_XOFF_BE) ? + 1 : 0; + } else { + overflow = (fsl_qdma_queue_bd_in_hw(fsl_queue) >= + QDMA_QUEUE_CR_WM) ? 1 : 0; + } + + if (likely(!overflow)) { + return 0; + } else if (fsl_qdma->is_silent) { + check_num++; + if (check_num >= 10000) { + DPAA_QDMA_WARN("Waiting for HW complete in silent mode"); + check_num = 0; + } + goto overflow_check; + } + + DPAA_QDMA_DP_DEBUG("TC%d/Q%d submitted(%"PRIu64")-completed(%"PRIu64") >= %d", + fsl_queue->block_id, fsl_queue->queue_id, + st->submitted, st->completed, QDMA_QUEUE_CR_WM); + drain_num = 0; + +drain_again: + blk_drain = dpaa_qdma_block_dequeue(fsl_qdma, + fsl_queue->block_id); + if (!blk_drain) { + drain_num++; + if (drain_num >= 10000) { + DPAA_QDMA_WARN("TC%d failed drain, Q%d's %"PRIu64" bd in HW.", + fsl_queue->block_id, fsl_queue->queue_id, + st->submitted - st->completed); + drain_num = 0; + } + goto drain_again; + } + check_num++; + if (check_num >= 1000) { + DPAA_QDMA_WARN("TC%d failed check, Q%d's %"PRIu64" bd in HW.", + fsl_queue->block_id, fsl_queue->queue_id, + st->submitted - st->completed); + check_num = 0; + } + goto overflow_check; + + return 0; +} + static int fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, dma_addr_t dst, dma_addr_t src, size_t len) @@ -646,6 +707,10 @@ fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, struct fsl_qdma_sdf *sdf; #endif + ret = fsl_qdma_enqueue_overflow(fsl_queue); + if (unlikely(ret)) + return ret; + ft = fsl_queue->ft[fsl_queue->ci]; #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 @@ -677,7 +742,7 @@ fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, /* This entry is the last entry. */ csgf_dest->final = 1; - ret = fsl_qdma_enqueue_desc_to_ring(fsl_queue, 0); + ret = fsl_qdma_enqueue_desc_to_ring(fsl_queue, 1); if (ret) return ret; fsl_queue->ci = (fsl_queue->ci + 1) & (fsl_queue->n_cq - 1); @@ -689,81 +754,30 @@ fsl_qdma_enqueue_desc_single(struct fsl_qdma_queue *fsl_queue, return 0; } -static int -fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue) -{ - int overflow = 0; - uint32_t reg; - uint16_t blk_drain, check_num, drain_num; - uint8_t *block = fsl_queue->block_vir; - const struct rte_dma_stats *st = &fsl_queue->stats; - struct fsl_qdma_engine *fsl_qdma = fsl_queue->engine; - - check_num = 0; -overflow_check: - if (fsl_qdma->is_silent || unlikely(s_hw_err_check)) { - reg = qdma_readl_be(block + - FSL_QDMA_BCQSR(fsl_queue->queue_id)); - overflow = (reg & FSL_QDMA_BCQSR_QF_XOFF_BE) ? - 1 : 0; - } else { - overflow = (fsl_qdma_queue_bd_in_hw(fsl_queue) >= - QDMA_QUEUE_CR_WM) ? 1 : 0; - } - - if (likely(!overflow)) { - return 0; - } else if (fsl_qdma->is_silent) { - check_num++; - if (check_num < 1000) - goto overflow_check; - return -ENOSPC; - } - - DPAA_QDMA_DP_DEBUG("TC%d/Q%d submitted(%"PRIu64")-completed(%"PRIu64") >= %d", - fsl_queue->block_id, fsl_queue->queue_id, - st->submitted, st->completed, QDMA_QUEUE_CR_WM); - drain_num = 0; - -drain_again: - blk_drain = dpaa_qdma_block_dequeue(fsl_qdma, - fsl_queue->block_id); - if (!blk_drain) { - drain_num++; - if (drain_num > 1000) { - DPAA_QDMA_ERR("TC%d failed drain, Q%d's %"PRIu64" bd in HW.", - fsl_queue->block_id, fsl_queue->queue_id, - st->submitted - st->completed); - return -ENOSPC; - } - goto drain_again; - } - check_num++; - if (check_num > 1000) { - DPAA_QDMA_ERR("TC%d failed check, Q%d's %"PRIu64" bd in HW.", - fsl_queue->block_id, fsl_queue->queue_id, - st->submitted - st->completed); - return -ENOSPC; - } - goto overflow_check; - - return -ENOSPC; -} - static int fsl_qdma_enqueue_desc_sg(struct fsl_qdma_queue *fsl_queue) { - uint8_t *block = fsl_queue->block_vir, i; + uint8_t *block = fsl_queue->block_vir; struct fsl_qdma_comp_sg_desc *csgf_src, *csgf_dest; struct fsl_qdma_cmpd_ft *ft; - uint32_t total_len = 0; - uint8_t num = fsl_queue->pending_num; - uint16_t start = fsl_queue->pending_start, idx; + uint32_t total_len; + uint16_t start, idx, num, i; int ret; #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 struct fsl_qdma_sdf *sdf; #endif +eq_sg: + total_len = 0; + start = fsl_queue->pending_start; + if (fsl_queue->pending_num > FSL_QDMA_SG_MAX_ENTRY) + num = FSL_QDMA_SG_MAX_ENTRY; + else + num = fsl_queue->pending_num; + ret = fsl_qdma_enqueue_overflow(fsl_queue); + if (unlikely(ret)) + return ret; + ft = fsl_queue->ft[fsl_queue->ci]; csgf_src = &ft->desc_sbuf; csgf_dest = &ft->desc_dbuf; @@ -808,7 +822,7 @@ fsl_qdma_enqueue_desc_sg(struct fsl_qdma_queue *fsl_queue) } } #endif - ret = fsl_qdma_enqueue_desc_to_ring(fsl_queue, 1); + ret = fsl_qdma_enqueue_desc_to_ring(fsl_queue, num); if (ret) return ret; @@ -820,7 +834,9 @@ fsl_qdma_enqueue_desc_sg(struct fsl_qdma_queue *fsl_queue) fsl_queue->pending_start = (start + num) & (fsl_queue->pending_max - 1); - fsl_queue->pending_num = 0; + fsl_queue->pending_num -= num; + if (fsl_queue->pending_num > 0) + goto eq_sg; return 0; } @@ -831,10 +847,6 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue) uint16_t start = fsl_queue->pending_start; int ret; - ret = fsl_qdma_enqueue_overflow(fsl_queue); - if (unlikely(ret)) - return ret; - if (fsl_queue->pending_num == 1) { ret = fsl_qdma_enqueue_desc_single(fsl_queue, fsl_queue->pending_desc[start].dst, @@ -871,17 +883,19 @@ fsl_qdma_enqueue_desc(struct fsl_qdma_queue *fsl_queue) } static int -dpaa_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_info, - __rte_unused uint32_t info_sz) +dpaa_qdma_info_get(const struct rte_dma_dev *dev, + struct rte_dma_info *dev_info, __rte_unused uint32_t info_sz) { struct fsl_qdma_engine *fsl_qdma = dev->data->dev_private; dev_info->dev_capa = RTE_DMA_CAPA_MEM_TO_MEM | - RTE_DMA_CAPA_SILENT | RTE_DMA_CAPA_OPS_COPY; + RTE_DMA_CAPA_SILENT | RTE_DMA_CAPA_OPS_COPY | + RTE_DMA_CAPA_OPS_COPY_SG; dev_info->dev_capa |= RTE_DMA_CAPA_DPAAX_QDMA_FLAGS_INDEX; dev_info->max_vchans = fsl_qdma->n_queues; dev_info->max_desc = FSL_QDMA_MAX_DESC_NUM; dev_info->min_desc = QDMA_QUEUE_SIZE; + dev_info->max_sges = FSL_QDMA_SG_MAX_ENTRY; return 0; } @@ -985,9 +999,9 @@ dpaa_qdma_enqueue(void *dev_private, uint16_t vchan, uint16_t idx; int ret; - if (pending >= FSL_QDMA_SG_MAX_ENTRY) { - DPAA_QDMA_ERR("Too many pending jobs on queue%d", - vchan); + if (pending >= fsl_queue->pending_max) { + DPAA_QDMA_ERR("Too many pending jobs(%d) on queue%d", + pending, vchan); return -ENOSPC; } idx = (start + pending) & (fsl_queue->pending_max - 1); @@ -1253,7 +1267,7 @@ dpaa_qdma_burst_capacity(const void *dev_private, uint16_t vchan) } static struct rte_dma_dev_ops dpaa_qdma_ops = { - .dev_info_get = dpaa_info_get, + .dev_info_get = dpaa_qdma_info_get, .dev_configure = dpaa_qdma_configure, .dev_start = dpaa_qdma_start, .dev_close = dpaa_qdma_close, diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 753ac6973d..146151ab8c 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -270,7 +270,7 @@ struct fsl_qdma_queue { struct fsl_qdma_desc *pending_desc; uint16_t pending_max; uint16_t pending_start; - uint8_t pending_num; + uint16_t pending_num; uint16_t complete_start; dma_addr_t bus_addr; void *engine; From patchwork Mon Jul 22 11:58:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142603 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4B59445681; Mon, 22 Jul 2024 14:02:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C1B2540431; Mon, 22 Jul 2024 14:00:06 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013071.outbound.protection.outlook.com [52.101.67.71]) by mails.dpdk.org (Postfix) with ESMTP id 0FFEE402C5 for ; Mon, 22 Jul 2024 14:00:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LOR1ahDxb6yCUvkKLN361P1bgDZewuKlNl8DNMRfV7lKlD1/laxwfdHnWVlrhiVXMRjdVm1qNSGs1hnQMDpqrTZoAsGSOKamjoqmlFU6/OHlYoQUEukE4jcbOivr6bIRegxrcQU1uYbrqn9bEjeNQSbpbEgFTRbYTXRPdFDiDilrK66bhSfdL+WCdgW5QQoKULBpAWtmJyJ64bEwkoAoQ5/NIovSy+aPvPjihsk3A83HkrBE1t3q78NUpNlvcsXiy7KwOhMMlpd2e0P2M3yATTfSrh3quOBRKlHNBFUEEsfRvl6xqqYtwg7IVwAf3lmlhDDsg2dkyz4ZgDVo4mYEfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CyIacJRP6zeJrrMmkQwX9RUwoPeer75zSeaT0riO7Vg=; b=h9aI/fQSpLX3jI6wI2iGJEQhdbnNdkLMfJD/Hw51UG0GCQQIHXhSkGRZYQ4Odrd1jM0uDXuzNdixWgpC1X/d/nehCIpJrixrKX3l1TWPAH86ChqLsz1B7aPd9p8g7sQMf0OTLZIGgeiXQayyweeQYD38j2mYokgmCT/bazyHi+ejl9kLCfAwa8bDrA/UyJm9uUj5fVOum7SyMmxPmzl/hrlho3QBtoCoBMm+CMw3zJ+/3WY56V7fIE4JQsa+tr22KVYDSPuYuAQn3b+T8TuC/UnE0sQIUX3PUIzMpXc6REayasVnfr4fxqsoN26Jaq75LtdIVqlL5Q21M/v+zLLXkw== 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=CyIacJRP6zeJrrMmkQwX9RUwoPeer75zSeaT0riO7Vg=; b=LnrQLX0E6++LwqHBS3vvcb6NHZmHm0uV/aY/oHSoonvl3faWCIAYS353UXdpgdGTHdxReOiCEpiG1WAU6hW3g4dnGfqut/iNzB+W8+wYr+iG7g8sAjwJmSS4GeXM1UEIj9lZIfjtDjsJDIIOr8WK8xmElydIkrHNCNGziNG2GtY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by DUZPR04MB9917.eurprd04.prod.outlook.com (2603:10a6:10:4d8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Mon, 22 Jul 2024 11:59:55 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:55 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v2 29/30] dma/dpaa: support max SG entry size Date: Mon, 22 Jul 2024 17:28:42 +0530 Message-Id: <20240722115843.1830105-30-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9917:EE_ X-MS-Office365-Filtering-Correlation-Id: e7253c12-f91f-45b6-3280-08dcaa45cd27 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: vYgg0wo4QcLkW5+N8cFp8NpNm2Ej1oO/SbAgGNVOQIkiup6HcqIGsmB86vrsjKbWPUT/66gjx4fmxH0bf2M7pMLNv95MZcD1U9/OcwoSRSeiQy+E8TKGHXLmE/pYvrl05D+HSYFJF7rJ/byL2p/7xH9MTKd/4mJIs44N7d6p1oswqciqIvBDXm02IXvZBFB6ndmhZs5ar+GZ5X4gPd5Rj0ppU0lDH1+bDpeijcha46ihb93zpZBz271vgXxkKTvYWFrfMhku2jM7G2ZeJXxBYj1E08z3cMAGz7A0ZwBa+HoKSL02FQqYUkSOKHSn0ZyAHj94qzCG7aYaeFocbl9lnQXfQ2YWZRzUkwQjyBpaDL2lCRlZuWrvj2v2VYBkyHz6bLyzqYQzDBmnffO2X18D+cgJYpeqwwtGKVyA8ZfGR2w7ubcNOrgqEqefbdR2wLnffsV5+EJevV1dupcfhFxMXxrGc8mMD9IMjJn/45SLGPI5u7BPbhTfaZ8erYA4Qd0enIprVtMVyFZmKO0NQq00liQ2YrOGt4dRjygWHRNOQFf+h56Z8Gx5na9QqPCPJM9lXoO2j2d/xny15suwJhyvWXQxHigmO5FFrG85ileCG1SsLkwXOSx1fZMbsBGq/CNyI6G9AcLFnsFpOIdwmjvdCY8Hlg0GTN+80IeE/OG2NvWlmqP/aWzqEU+Fk9PllCLmnvjW29qevihn/meCqs8GIFxT1IW586yF+D5TE4Zmp7ZpbjawdHE5YDIyjQNinsDpCz4v72V9j5PzvvJ5hTtVeWryCLzVa9L0K09ffO+dDd1zIfwdX98m3rFEtEBSXLMP4NI0UtisYHMZNGEeNJr1Vgq3VAc/QcB4JBL96sB4IT7XbFwLsF7DXME0XObH2KJyfEr6LuzFT/Svrjy5il/eM0a2LB7c79AtipMMi8hR0wgL7b2gyaI6sfrcSDkcuOenyoZIiMM148aUz0a82R4cJ/X0K6mi8EQpkiLCuoqbIYv/wDAccBxpONBQTYFMG39xdtlS5zFM2tVy1ZhkJhjskBpjtwytXw3u25GXRewD33FH6yjBXwlgwslYJM+8lmfhZNosezjnZcAbjT/iMleJyerXFeBJujs9IzoV0ONzBLmRIIIts9LN/aN4c+bAXpBdjBzKAZJr9kvOgwQW/8qurZnTR2VCH6MDX59C8AjJA340TWYy7KRJ0K3wHWk/sJYHu7FWf67111KrVywN3JaZFDfFO4MVwhk8A7+uZ6HQx78c5FwAkcvMHP1q1cv8iOcOvZ/bcAFIWqwmSFFsIM7+h3RRNB+8IPU3KU6r3z0AcGu/N7OhpK7D9Dxd2xv1AhhL4wbLtjne23r5GszXarToVgLm1qziQn6H4MOPtVa/0dOouC1Fwi6pPNNmbMtYk3tMZglRbqbZHG+Bwp9toHCp3g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EFRmMZnVjUjVaX4rL/Z3qFRO3KOfKB4ns39gmWgFTMHP0fs7tjjvsTrBTVPF+EkSYFaLmZ8L8wKRIpUujcNsYautPTI76jzGQJALH+VxBR7h9HzVBaKwQ0u4qawATKSWQ56Sv5SaRf5uiffQFZik38F+RmprNlbgD3XAadLxUmbW6Os7Sbmfs9tLYT5nkA/CV5Dk9w6qxXrw6Af2D2Uj/snhEl5kvE8EOfkZfqkAcNTelDsXVDCSS6QCHbxjKS1OM5ikeVBd8OG/dEi82C1HuJ8iD0jyoHlej76+ld+RF3NjHNKJBgRSLufw1lPvXxvrIykTTcLyA+nJiYXeIO8oluRHY2YXr11k1iHAWPKyN3Z1nUNo0fDwQGKbeEhKrFZNN8FdC8j2A1/Ptj1ih3vX8/kv9TwqKo8+j8Y8XQxNSqGsPODnuOrpqyy8xKneB7ie+mNiK0BzhFcDfmr/+RoY4/ZFa0fkamVCNQeoYjz6bTNbagrVApY+fiNC7sFjn8HEkAfPhYpHxxCKrJU7FD64UW4Cc4pYo8yoS2MhxRUgUTocHkiTn1BEYsSmuhy0XWYEr6+GzOcZwZ5XDnk3d4YZjluEm+U8YrWPIan6ACNvxWz5AM27hrJiZdn4Zbdgw5rJi31XvTW/AZIoDl662AEvMUkSj/+Q9/h7rt2QVKv6fQm6vLWwN7oNL3/76RuMoy6/NeyiWysJUvhNxTc14HxrQSZyK2AWGZsO/5kioAU8Y+u+OgaEhYOehB3iY4wOibJpgjeQoB7WupogqC76LVFhqDeGKaRWUTanUo6ZIqV78B3XbNY6JGUIN1XTxlsLOi7JsoKqZ2DK1yd9tupFaR12DG9xrmsNaoYt04xV7YkDvneuEm3vyY88c8UHrBegcSSxQUaayqaSSbpC6CRm00dD083GWGfu0xJLIuh4Bppoh5kcZJ0IudfjCo9Fq38ntF3PJ3Vobr/ThyZ3uGT8hza+Kb0W1uQUUyU/OWkUXccO5NXOSHsUTcqkh5oguVLbuC+RuMnX8p6Pt+8d+zhwNI4eopOrEX9BZKGqg1SSjKXvI8iCJURphWhR8v8xRfRqb/k2FCtcHtFHFcUnKbOpzl2hpADJFTYlWJdsp8Db09mS3IrTkSCVp6hsx50W9ud25d6UM9PElmBtwflbPfadpqJ2KV9UlqapDxpUj+zhQercIqVEeVfzTND7YwRKhOBm+JMKbKy4ThbQrAd0ItAGn7Y2fifXxoMLPMgeOsNrWjgheTOzGlWuqMdvmj1hSfSxrp19Fp14JJZMEewWMJN47L+UGSk6kehsLkOAI8AyZLZji/n6Pbs/xsUIqWMSJg+5WfeyCIf/0umr8pSP37jFhcni0iUC8u1uc5ClRktsr+U4bY/Tbn9oKb/wUQU8KPSmsm4507NmpTdCc8epxAeYYY+yT6uedPZQMrYZzE52ntY56J74TMWHwMNGAV8JX8SEJU97qDYLX7yEweIdLgJ8pH9daEDPZBEdZyhpXbFcXzAemGzAWrOx4EJkV/QfGVA/FPi6RvqOK69vgez1hxy3HS5YsmTRsXS+spgV3O7WdX7RQIccKWU5HISm/ix88l0ecaTy X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7253c12-f91f-45b6-3280-08dcaa45cd27 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:55.3010 (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: wuS/Xy9WAU9Lu5xgk1NlJ54Tc+w9NPwpExeFPNCMQHQwQxO254PkBCwI4u/EiJAe X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9917 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 From: Jun Yang SG transaction is not helpful for performance of large transaction size. Start single transaction for size > max SG entry size in SG copy. Default MAX SG entry size is 2000 bytes which is experiment data of mem to mem, user can change it according to experiment: export DPAA_QDMA_SG_MAX_ENTRY_SIZE=xxx Signed-off-by: Jun Yang --- drivers/dma/dpaa/dpaa_qdma.c | 41 ++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c index 383142fc75..e3f2777b40 100644 --- a/drivers/dma/dpaa/dpaa_qdma.c +++ b/drivers/dma/dpaa/dpaa_qdma.c @@ -12,6 +12,8 @@ static int s_data_validation; static int s_hw_err_check; static int s_sg_enable = 1; +static uint32_t s_sg_max_entry_sz = 2000; + #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 static int s_pci_read = 1; #endif @@ -761,7 +763,7 @@ fsl_qdma_enqueue_desc_sg(struct fsl_qdma_queue *fsl_queue) struct fsl_qdma_comp_sg_desc *csgf_src, *csgf_dest; struct fsl_qdma_cmpd_ft *ft; uint32_t total_len; - uint16_t start, idx, num, i; + uint16_t start, idx, num, i, next_idx; int ret; #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 struct fsl_qdma_sdf *sdf; @@ -770,13 +772,31 @@ fsl_qdma_enqueue_desc_sg(struct fsl_qdma_queue *fsl_queue) eq_sg: total_len = 0; start = fsl_queue->pending_start; + if (fsl_queue->pending_desc[start].len > s_sg_max_entry_sz || + fsl_queue->pending_num == 1) { + ret = fsl_qdma_enqueue_desc_single(fsl_queue, + fsl_queue->pending_desc[start].dst, + fsl_queue->pending_desc[start].src, + fsl_queue->pending_desc[start].len); + if (!ret) { + fsl_queue->pending_start = + (start + 1) & (fsl_queue->pending_max - 1); + fsl_queue->pending_num--; + } + if (fsl_queue->pending_num > 0) + goto eq_sg; + + return ret; + } + + ret = fsl_qdma_enqueue_overflow(fsl_queue); + if (unlikely(ret)) + return ret; + if (fsl_queue->pending_num > FSL_QDMA_SG_MAX_ENTRY) num = FSL_QDMA_SG_MAX_ENTRY; else num = fsl_queue->pending_num; - ret = fsl_qdma_enqueue_overflow(fsl_queue); - if (unlikely(ret)) - return ret; ft = fsl_queue->ft[fsl_queue->ci]; csgf_src = &ft->desc_sbuf; @@ -799,7 +819,16 @@ fsl_qdma_enqueue_desc_sg(struct fsl_qdma_queue *fsl_queue) ft->desc_dsge[i].length = fsl_queue->pending_desc[idx].len; ft->desc_dsge[i].final = 0; total_len += fsl_queue->pending_desc[idx].len; + if ((i + 1) != num) { + next_idx = (idx + 1) & (fsl_queue->pending_max - 1); + if (fsl_queue->pending_desc[next_idx].len > + s_sg_max_entry_sz) { + num = i + 1; + break; + } + } } + ft->desc_ssge[num - 1].final = 1; ft->desc_dsge[num - 1].final = 1; csgf_src->length = total_len; @@ -1297,6 +1326,10 @@ dpaa_qdma_init(struct rte_dma_dev *dmadev) if (penv) s_sg_enable = atoi(penv); + penv = getenv("DPAA_QDMA_SG_MAX_ENTRY_SIZE"); + if (penv) + s_sg_max_entry_sz = atoi(penv); + #ifdef RTE_DMA_DPAA_ERRATA_ERR050757 penv = getenv("DPAA_QDMA_PCI_READ"); if (penv) From patchwork Mon Jul 22 11:58:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142604 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D090745681; Mon, 22 Jul 2024 14:02:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CB8DC40A4B; Mon, 22 Jul 2024 14:00:07 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013071.outbound.protection.outlook.com [52.101.67.71]) by mails.dpdk.org (Postfix) with ESMTP id 2A710402D9 for ; Mon, 22 Jul 2024 14:00:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OXgkfCE1gOavDRNfFjS5A+CZmJ6Pe72BKZuQLZinz7qT4xkQ9WnpvEa0mQ45BJ/H0ShTZLSTMm/7UEsyht9yhdl0l/PA5hVbHuKZQda1M5G/IcDJXbfLZcdTUkJAfQKEB8T3Jo4aeCHKxvCvPtibL2rxqI1SOZ2Qh2dKMHS9oB+71bOOZ7budGtZozITbGC7mqEpeHDy2A26IGwXF+LygVNgLadvOCbM343mzueSmxyPvXMnYkGnbOg3FUajMiy64CmoJUhShEgUEaHfonIU/M6EtpK9+h2AcFK+a/zpEb0UmAQcBiJcGAs0RYCwmXUNte0S4b4KJ8t6s8Vu5wHWbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QdGNxX/ruKA41O16rVCFtuII3G3z7JWCmG/SzfQMcdo=; b=rRd/gI+hmQ2+PuK45LqbOT+XKyJMn+U+kphAAtxYYRzl6WCFCAtaHiLTG0mG3gmJMU7O1K0jWZDcqCCqdj3jaSebm0XwB2DeNJmjTpeMEmnnRxfE3bmwyq1aTFM8gcB8OSxiAQloMN0juAcWlz9NIY4Zznw9UFBt364lIOX/9qXGCRQXqRI9FAg08IPVM0WyaPVtnf+o6YZUzdgZZ1NFa2UFRkvLlPj3EsHBmWvtoadp0cNVX16+PI2jdNLbfmHxdLgY7sYh4KZfMLe/GyiZGF/s2mdoN+OFjo7eYYTA28oDQFkHZoDa+mD6lcUESlH03e0w9MfZ7nEMwmail2S3+Q== 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=QdGNxX/ruKA41O16rVCFtuII3G3z7JWCmG/SzfQMcdo=; b=clvpQ//E9Rw5cjxxfiwvn3nlrqEtzJftPeVXP61KBwWVlBZ4iOQW6C7FIGUKOkG91TYUQX4SdFdYugCuEyBdoZcIjUNbR+72BtEIU2apH7L1xeANAJZc7anMmChargJlHeJlwLOcC5o3x+k05LwQHwCQBSzyEjxWVxJN/JrwlRk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by DUZPR04MB9917.eurprd04.prod.outlook.com (2603:10a6:10:4d8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Mon, 22 Jul 2024 11:59:58 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:58 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Subject: [v2 30/30] bus/dpaa: add port bmi stats Date: Mon, 22 Jul 2024 17:28:43 +0530 Message-Id: <20240722115843.1830105-31-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9917:EE_ X-MS-Office365-Filtering-Correlation-Id: fc44bc5c-7e18-499b-efbe-08dcaa45ce38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: CpC9IeNe5kUUj2U2UYqZBd8MYnLqcP81UTUmNikT1h19PeY10Qcsn08ZrYpquGAd2+CKxb24XthWCVzMAjsD8crFIoFXOnNR73pTQPM0MFCjTzObWe1XJpMg7Sg6Bdfn6AkNdZcY3BS1GL80TnRpgEwI64Dwm7G045dGB626a1mJK2uWD4EuA8U1uCX1FQ64jLpX0ka3oPmkTxgMzazij2tsFUe934duv1W/OGgmqIxpb/gAwS4Y0vmtnKxCYroxqFgOMmy1U5cuCAMhatKTLj9mu1xN8hRt1wOCslBk+y8jGvwKCWKCM3B9iMua2Mp81YNGs1YPOH6JRfja5J8HXxbETPZZprqcy8C4eTgJfQRQSRVeB3PMrhgbht00tADqyGm8jVAXR0tRSaSzXBXhwAMqcPXA9gmnut+AY2NUuxeAxCF79LfbxRdieVZQ9OF1vza8W/+4yMHoWgcHroP/YvnnWWYo7/cu41awdb/XnZDCr0RtWIR7+wXkBtLHyA5cUpOpVFrX6LB6MiLFBnnM5hvn1bTjWFbHyWxFvhxEgp796I90mk2z7RIV1+LZMtzM6FSyZEmzx0bzN61/CDZvvKuv0L7m7PfUSuLOGL2+L9HEMRhoECk4WG8A3PJNES3VZDySVtY3EkSDgBRCkRxz20VKfYnXInBegt7YvG2JKh8oNnLd0RA1glMhbTvS1o1z+DMuekum2PxAGf/S2br37CvVDfVSraBgmWFUS/hpgxdjMDozGFg8IulM9grzAylaFuyU2KiByED3QBcnh1cV6psyPatDMvdyaxTC00iZ7YLNEJikeWjkBTb25+ClSwcqyGsQvImBN12FtnJunup3486x/GKoaxkDo0sn75obPfcU1r2pz0ykvE+3wVb7qmP8I2o77ypqTtuFpstpKqrEYvxGD8uwJw1wv6c34yRjhTNjiq841mTJP/hyw2htWlk012z1AWMpILZGfCq8AA2ge+F1pidzjd+I2jIW/I7udVhT6hULR24IrZFEYEkIrbzDtb876VN2Tj2HzOqFvw/MfR/1MEutHiYEO7RtmRsk6GegXosBC6uiH3cM1tzaQX8Y/mF8kLVAlyl9pr+Puv0qxULUnZ8wi1lwDup+UhgBhTQEDhZf1H0ts1ce0J2XdwHzEG04dQwJgEWFaarrYkJuutq+oMujwjmAIT0gK5GWx9ksUY68gMBc6FwE1RVEzD2n/lceV6dUv3tG2WqMfNdGFXC8B0LHC7k0fPJCyb2C62rI3hMTstacL1Q8nfbzGZk3PE9pQaxEyr5nLJ+vMY6pMv5MISI+DYo7vnVbIFp/csAqcwDkSac4ZtEzFmi1XDM6vO5zDnrADspPdM8U4fZrZwtf1WfdQx8Uaj9gzZzwMTKmAIEqSgTUb1V42izPvi5P1Nw7mFl0p9ej5SbuIn5HVg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eFWyq6Y2Xzj00NV3+M7d/4u4YPOZzef6sMT2OKMoeY3tGst2CqXT/ZTxAQmn4twfu5QmUj8ZRNRfitvAZQUVHTk3sY1S+BuHW/Dq0ssZFTEPuOlueNZ+NDGIluTOLcoCn/1W7E2Ep0tMLEk26COtV1Y/aeRIsvgXnROgecdJ6d50ERBI3V7s6dbvlo0+0whb05GaUBSRfGGKUZBNH2OFFuQMCyzVSbQEIRoldAgIajIXpW9yOlRA0lBP7Z1+De0sG4Vfugvp65qMrsemzNhs0Ha3UvL9HEUIqVqP8LeZhu2Yrw9IvUw718WTlfogVyiAFr5HOHjb/jNs8F9w5sPLpeBChFt+t9TG8QNs8aU5LaAGDf7wwBosQdKZxGK2bTAdGvDfLJn/E/fnJWVmqtATiDdupN994008Ekl0ZH6BTcSOfd/qGOvIjI+QdVjIxET2zU/9kN8tWdrYk81SHVwrxsy3oC7MB5FMBchztN9inWTY4fhOJceIFDDx8VE2vLyyWBZ8uN4xFiPb5XkL8L0fbTlArlEnqlQjbFpWefcjS6gi72zAsiuFxoYzd8z7zcVJ/97qIcuTGWlKPJglstXy4cl8ZSoV6xd4g+F1V5WEmnlHTv4vpFO9v4/ArOX3VRuRPpZDzsw1UZeL/UselIJXaywUwLIwbtZFyVAVOXKtmVOGbHaOCRYW3bP8S7oiExBquxPQO75SARdzFKwJix1QdLihw/oiVjmaBbGGDSkbw4QczMIrt4K8ziaeuyh+E9c542tfthzhqgGEMLxpLWl4zZmz55GQvq9zCxKA3ffxgE01Ct/sqqXr5yZdhSWvh5ZjpA7KCTUpblXNC7iI16lQ6DSSwo92dgLtZTBV9qWhZ9s2y6MHIC2GtOlZju5yV6eHA4JPThDiylH5kIBfyitI8Nv6GiOov8Q1RhvG+yR1fDX8jFgeNCmHuM1bcJOq1aQngG6k06C3Efx14Te3Z50bnvN41b7he5PZo+tsS1UxYyLHKXIpzpnga8fjbeNRyPYnKud0PJztdkch0ZfgRvg3QJZQJopippf6c5yMtYGXRZ4PiQd6vMAyTVQMXeq60+XXYBptOi/MDcacdVmmzFTwvS3ODI7RXTDcQEbebt/sWs/qNbK+IKeoXhSvVbNnheafecUqDW2+9Bl7LWRBrxFGRX+/sZ6Evj2fQnB//JR0KzByHrKjV27r/RMEaGGeCS7ySTg8q6AeufVOxSYb/iVGR3wQv7clRLNhP1cb+Donp/EGiLjDVr8hQ5kDf5CIoWOmUvk5dRM9ZNCYRxJkxiiCohB7R/DsG5SbdmRHznyAqoTwm8wKfF7YabA0QWLhDBmZDr1yUBNdsojTfME8pOGYpceRL241LC8mYk9Y+aVuxe6gMJkH2QSw2lQzsVBylC9pQRtIi7GdKiZdEB/FX38c+SKukJWAhh9x1ldCl6noLnZtpKGNL6ANNebSjERCwQwWdLZRDPKsutnNpHFP4pQ9Zq2FLPLtawB7BEaxkeAcb7Y/biTfd06cfOfquUfBwbF4D73OzdC5A9DqM3KHy87ND6jt4WPJdLRVJesFiC+GvH0CoASgK3IQSz9zSF6WxrLz X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc44bc5c-7e18-499b-efbe-08dcaa45ce38 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:57.4477 (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: M/p5EAVqsqLQTQRIFneTiEl0tEx7vDFJIT0vKmEcyUl7KtsyRwUbYwVydi1h2qPr X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9917 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 From: Hemant Agrawal Add BMI statistics and fixing the existing extended statistics Signed-off-by: Hemant Agrawal Signed-off-by: Gagandeep Singh --- drivers/bus/dpaa/base/fman/fman_hw.c | 65 +++++++++++++++++++++++++++- drivers/bus/dpaa/include/fman.h | 4 +- drivers/bus/dpaa/include/fsl_fman.h | 12 +++++ drivers/bus/dpaa/version.map | 4 ++ drivers/net/dpaa/dpaa_ethdev.c | 46 +++++++++++++++++--- drivers/net/dpaa/dpaa_ethdev.h | 12 +++++ 6 files changed, 134 insertions(+), 9 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c index 24a99f7235..27b39a4975 100644 --- a/drivers/bus/dpaa/base/fman/fman_hw.c +++ b/drivers/bus/dpaa/base/fman/fman_hw.c @@ -244,8 +244,8 @@ fman_if_stats_get_all(struct fman_if *p, uint64_t *value, int n) uint64_t base_offset = offsetof(struct memac_regs, reoct_l); for (i = 0; i < n; i++) - value[i] = (((u64)in_be32((char *)regs + base_offset + 8 * i) | - (u64)in_be32((char *)regs + base_offset + + value[i] = ((u64)in_be32((char *)regs + base_offset + 8 * i) | + ((u64)in_be32((char *)regs + base_offset + 8 * i + 4)) << 32); } @@ -266,6 +266,67 @@ fman_if_stats_reset(struct fman_if *p) ; } +void +fman_if_bmi_stats_enable(struct fman_if *p) +{ + struct __fman_if *m = container_of(p, struct __fman_if, __if); + struct rx_bmi_regs *regs = (struct rx_bmi_regs *)m->bmi_map; + uint32_t tmp; + + tmp = in_be32(®s->fmbm_rstc); + + tmp |= FMAN_BMI_COUNTERS_EN; + + out_be32(®s->fmbm_rstc, tmp); +} + +void +fman_if_bmi_stats_disable(struct fman_if *p) +{ + struct __fman_if *m = container_of(p, struct __fman_if, __if); + struct rx_bmi_regs *regs = (struct rx_bmi_regs *)m->bmi_map; + uint32_t tmp; + + tmp = in_be32(®s->fmbm_rstc); + + tmp &= ~FMAN_BMI_COUNTERS_EN; + + out_be32(®s->fmbm_rstc, tmp); +} + +void +fman_if_bmi_stats_get_all(struct fman_if *p, uint64_t *value) +{ + struct __fman_if *m = container_of(p, struct __fman_if, __if); + struct rx_bmi_regs *regs = (struct rx_bmi_regs *)m->bmi_map; + int i = 0; + + value[i++] = (u32)in_be32(®s->fmbm_rfrc); + value[i++] = (u32)in_be32(®s->fmbm_rfbc); + value[i++] = (u32)in_be32(®s->fmbm_rlfc); + value[i++] = (u32)in_be32(®s->fmbm_rffc); + value[i++] = (u32)in_be32(®s->fmbm_rfdc); + value[i++] = (u32)in_be32(®s->fmbm_rfldec); + value[i++] = (u32)in_be32(®s->fmbm_rodc); + value[i++] = (u32)in_be32(®s->fmbm_rbdc); +} + +void +fman_if_bmi_stats_reset(struct fman_if *p) +{ + struct __fman_if *m = container_of(p, struct __fman_if, __if); + struct rx_bmi_regs *regs = (struct rx_bmi_regs *)m->bmi_map; + + out_be32(®s->fmbm_rfrc, 0); + out_be32(®s->fmbm_rfbc, 0); + out_be32(®s->fmbm_rlfc, 0); + out_be32(®s->fmbm_rffc, 0); + out_be32(®s->fmbm_rfdc, 0); + out_be32(®s->fmbm_rfldec, 0); + out_be32(®s->fmbm_rodc, 0); + out_be32(®s->fmbm_rbdc, 0); +} + void fman_if_promiscuous_enable(struct fman_if *p) { diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 3a6dd555a7..60681068ea 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -56,6 +56,8 @@ #define FMAN_PORT_BMI_FIFO_UNITS 0x100 #define FMAN_PORT_IC_OFFSET_UNITS 0x10 +#define FMAN_BMI_COUNTERS_EN 0x80000000 + #define FMAN_ENABLE_BPOOL_DEPLETION 0xF00000F0 #define HASH_CTRL_MCAST_EN 0x00000100 @@ -260,7 +262,7 @@ struct rx_bmi_regs { /**< Buffer Manager pool Information-*/ uint32_t fmbm_acnt[FMAN_PORT_MAX_EXT_POOLS_NUM]; /**< Allocate Counter-*/ - uint32_t reserved0130[8]; + uint32_t reserved0120[16]; /**< 0x130/0x140 - 0x15F reserved -*/ uint32_t fmbm_rcgm[FMAN_PORT_CG_MAP_NUM]; /**< Congestion Group Map*/ diff --git a/drivers/bus/dpaa/include/fsl_fman.h b/drivers/bus/dpaa/include/fsl_fman.h index 20690f8329..5a9750ad0c 100644 --- a/drivers/bus/dpaa/include/fsl_fman.h +++ b/drivers/bus/dpaa/include/fsl_fman.h @@ -60,6 +60,18 @@ void fman_if_stats_reset(struct fman_if *p); __rte_internal void fman_if_stats_get_all(struct fman_if *p, uint64_t *value, int n); +__rte_internal +void fman_if_bmi_stats_enable(struct fman_if *p); + +__rte_internal +void fman_if_bmi_stats_disable(struct fman_if *p); + +__rte_internal +void fman_if_bmi_stats_get_all(struct fman_if *p, uint64_t *value); + +__rte_internal +void fman_if_bmi_stats_reset(struct fman_if *p); + /* Set ignore pause option for a specific interface */ void fman_if_set_rx_ignore_pause_frames(struct fman_if *p, bool enable); diff --git a/drivers/bus/dpaa/version.map b/drivers/bus/dpaa/version.map index 3f547f75cf..a17d57632e 100644 --- a/drivers/bus/dpaa/version.map +++ b/drivers/bus/dpaa/version.map @@ -24,6 +24,10 @@ INTERNAL { fman_dealloc_bufs_mask_hi; fman_dealloc_bufs_mask_lo; fman_if_add_mac_addr; + fman_if_bmi_stats_enable; + fman_if_bmi_stats_disable; + fman_if_bmi_stats_get_all; + fman_if_bmi_stats_reset; fman_if_clear_mac_addr; fman_if_disable_rx; fman_if_discard_rx_errors; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 060b8c678f..4d9a4c7e6d 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -131,6 +131,22 @@ static const struct rte_dpaa_xstats_name_off dpaa_xstats_strings[] = { offsetof(struct dpaa_if_stats, tvlan)}, {"rx_undersized", offsetof(struct dpaa_if_stats, tund)}, + {"rx_frame_counter", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rfrc)}, + {"rx_bad_frames_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rfbc)}, + {"rx_large_frames_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rlfc)}, + {"rx_filter_frames_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rffc)}, + {"rx_frame_discrad_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rfdc)}, + {"rx_frame_list_dma_err_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rfldec)}, + {"rx_out_of_buffer_discard ", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rodc)}, + {"rx_buf_diallocate", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rbdc)}, }; static struct rte_dpaa_driver rte_dpaa_pmd; @@ -430,6 +446,7 @@ static void dpaa_interrupt_handler(void *param) static int dpaa_eth_dev_start(struct rte_eth_dev *dev) { struct dpaa_if *dpaa_intf = dev->data->dev_private; + struct fman_if *fif = dev->process_private; uint16_t i; PMD_INIT_FUNC_TRACE(); @@ -443,7 +460,9 @@ static int dpaa_eth_dev_start(struct rte_eth_dev *dev) else dev->tx_pkt_burst = dpaa_eth_queue_tx; - fman_if_enable_rx(dev->process_private); + fman_if_bmi_stats_enable(fif); + fman_if_bmi_stats_reset(fif); + fman_if_enable_rx(fif); for (i = 0; i < dev->data->nb_rx_queues; i++) dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; @@ -461,8 +480,10 @@ static int dpaa_eth_dev_stop(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); dev->data->dev_started = 0; - if (!fif->is_shared_mac) + if (!fif->is_shared_mac) { + fman_if_bmi_stats_disable(fif); fman_if_disable_rx(fif); + } dev->tx_pkt_burst = dpaa_eth_tx_drop_all; for (i = 0; i < dev->data->nb_rx_queues; i++) @@ -769,6 +790,7 @@ static int dpaa_eth_stats_reset(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); fman_if_stats_reset(dev->process_private); + fman_if_bmi_stats_reset(dev->process_private); return 0; } @@ -777,8 +799,9 @@ static int dpaa_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, unsigned int n) { - unsigned int i = 0, num = RTE_DIM(dpaa_xstats_strings); + unsigned int i = 0, j, num = RTE_DIM(dpaa_xstats_strings); uint64_t values[sizeof(struct dpaa_if_stats) / 8]; + unsigned int bmi_count = sizeof(struct dpaa_if_rx_bmi_stats) / 4; if (n < num) return num; @@ -789,10 +812,16 @@ dpaa_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, fman_if_stats_get_all(dev->process_private, values, sizeof(struct dpaa_if_stats) / 8); - for (i = 0; i < num; i++) { + for (i = 0; i < num - (bmi_count - 1); i++) { xstats[i].id = i; xstats[i].value = values[dpaa_xstats_strings[i].offset / 8]; } + fman_if_bmi_stats_get_all(dev->process_private, values); + for (j = 0; i < num; i++, j++) { + xstats[i].id = i; + xstats[i].value = values[j]; + } + return i; } @@ -819,8 +848,9 @@ static int dpaa_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, uint64_t *values, unsigned int n) { - unsigned int i, stat_cnt = RTE_DIM(dpaa_xstats_strings); + unsigned int i, j, stat_cnt = RTE_DIM(dpaa_xstats_strings); uint64_t values_copy[sizeof(struct dpaa_if_stats) / 8]; + unsigned int bmi_count = sizeof(struct dpaa_if_rx_bmi_stats) / 4; if (!ids) { if (n < stat_cnt) @@ -832,10 +862,14 @@ dpaa_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, fman_if_stats_get_all(dev->process_private, values_copy, sizeof(struct dpaa_if_stats) / 8); - for (i = 0; i < stat_cnt; i++) + for (i = 0; i < stat_cnt - (bmi_count - 1); i++) values[i] = values_copy[dpaa_xstats_strings[i].offset / 8]; + fman_if_bmi_stats_get_all(dev->process_private, values); + for (j = 0; i < stat_cnt; i++, j++) + values[i] = values_copy[j]; + return stat_cnt; } diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index b6c61b8b6b..261a5a3ca7 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -212,6 +212,18 @@ dpaa_rx_cb_atomic(void *event, const struct qm_dqrr_entry *dqrr, void **bufs); +struct dpaa_if_rx_bmi_stats { + uint32_t fmbm_rstc; /**< Rx Statistics Counters*/ + uint32_t fmbm_rfrc; /**< Rx Frame Counter*/ + uint32_t fmbm_rfbc; /**< Rx Bad Frames Counter*/ + uint32_t fmbm_rlfc; /**< Rx Large Frames Counter*/ + uint32_t fmbm_rffc; /**< Rx Filter Frames Counter*/ + uint32_t fmbm_rfdc; /**< Rx Frame Discard Counter*/ + uint32_t fmbm_rfldec; /**< Rx Frames List DMA Error Counter*/ + uint32_t fmbm_rodc; /**< Rx Out of Buffers Discard nntr*/ + uint32_t fmbm_rbdc; /**< Rx Buffers Deallocate Counter*/ +}; + /* PMD related logs */ extern int dpaa_logtype_pmd; #define RTE_LOGTYPE_DPAA_PMD dpaa_logtype_pmd