From patchwork Mon Jul 22 16:39:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142629 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 B8E1D45683; Mon, 22 Jul 2024 18:41:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4654F40E28; Mon, 22 Jul 2024 18:40:07 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012027.outbound.protection.outlook.com [52.101.66.27]) by mails.dpdk.org (Postfix) with ESMTP id 0A46B40E2C for ; Mon, 22 Jul 2024 18:40:04 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qaV9romzNxdgaORmhDxFWaRyKXGN2GMAWDQvVwT1SLDZX7ye2CbLf52MopJR3GHjg4S2v2WZD52ghvEDef62iGJGvE58dYU36RgehMIvfnGaZJjllFo22YLRW+2jg08QWURRG2rDXpSknjjjlQ+m/IaxywqHMedSwzrdvlS/WdhQ9eV704bUK+eEB7DcOeYrsF/5uRhfs6m6PxzPVb2TAdyuvhns1IsCe9QD671YzS52IqU4vrQXUcbk2yMJBVN/hNym/vur4NOSFT5gWZYjfSppraYiukzJN5ccOuzJ12FyQoBVMNaKgnu2sonXR3tdCcgRbKcOB+rB5JJuUaEXIg== 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=LTP13+6EKlZCC2JA/HyFSqlxbGGPZla5ADfuVcJKZitvisSLfYXVLJegUx5jWYZAt+9x7u/m7EFWvN39/8HcEDgBrqYHo+V1ENGrUPJVZeIBpm5A8EmJLbfXUsWzkoPmhd1LLv3oV61iks8kk+0Iq1P/yY9veldtYMvCGvU+UolxlJagqm/B8QTshA3rDPV3bBCMs/Fn4Uy4eKr2SGSCWhRRVuSPNye37BUNXjxuFt2Az3/p6MrROARW9I3IcLfTqTvWCPQsk7YEJUcOmP6iSHTVvmYEEI77ixshO9D1SbJIRscoqgs/uVdjR18LYTUkIeVC0pXGIqjQoN25QC36sA== 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=Emn5lCRj6w9JHDFr0CipuqQcEY5/6PNu/Zvsljxt38mhjf1Z2oIoM2HSB7uF6LoKZ7DvJ8q8sD3JXjCt/Nv3N03Nt2fw0AOmXt0QUex7dZHUX6VBSWE5RIOAEaKlS0IgxpHIuwwfbAy3JsomOPFlJNwma4mbOlfs5D2XSnCqXWk= 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 PA1PR04MB10652.eurprd04.prod.outlook.com (2603:10a6:102:491::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16; Mon, 22 Jul 2024 16:40:03 +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 16:40:03 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [v3 10/30] dma/dpaa2: limit the max descriptor number Date: Mon, 22 Jul 2024 22:09:10 +0530 Message-Id: <20240722163930.2171568-11-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722163930.2171568-1-g.singh@nxp.com> References: <20240722115843.1830105-1-g.singh@nxp.com> <20240722163930.2171568-1-g.singh@nxp.com> X-ClientProxiedBy: SG3P274CA0014.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::26) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|PA1PR04MB10652:EE_ X-MS-Office365-Filtering-Correlation-Id: 31423840-8d31-4d13-f39b-08dcaa6cefbd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: HQe9EEzQ9zqTRGa6N3ATJ4n8O6zEmwRzZh3gFbPQh8Z2EHJN23h8KotYmIvYZ69oVN/sbxng26NewLU/LlNXCGC7iEaCjWjnoPdUrrJUK1SoYa9NOI/b8QWPN/OzExPZ4B1y4dINbwzd/fOW5C8LH3pNPjJdKuwtbfSOzyRkaWDEp6qqmn01GqvtAtIfs+FhbwBSs2k67eSIf+YJQcqvFfJxHH+ATzw0dR3bThvwtH19q6SYtSd2kBD9PCL4kBRF3an++3hPX2+f0j0qArfnMATi6pZrE0UL2VCWD1RT/oinwiBJKBIPZPLfbhLRG9PXVOXM9LXQ2KFx+bZbAG3r3FwlYzk7cI42w5SqZ+jgRPK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.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)(366016)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8yzlRkRYL4P1Iy0+KZFQi1SmNQqyiJi2zNhhEysJaDFFigay+hLaDw8iUEaPDUJ2UtLwW4fQ804LUQ0iPNnK4ZDe5fsL4cabpOZrajyMq3emj5HRZsk5D2VbEU5dCkmZRanmEpOtp9Le4+prbEavjKsyUjqb4NBk3spTyF65tHHPGiiMMrRcRM1GhtC/JgpkZAKtbOCV2juq/u+VTZRSm1vQtzTMHzSfII2wApfE41sSQ7ZFXYXmX2K8LOloe791ctDwlGbAOL/FusdtzqtiemwQxq0b2lDwilo7OiDlndYFbxSgkb86kaz4mc42ojqsdjV5fwgomx5tGrDYhJr9dYdq/dUFwyExUJWi1SrB7WrbDtznWG1Pb1LCaOJJKNeEMagv6pWH7wzHc8PftH3Bjq1zZpWlbZw8Uc3xN/A/UuZ/cOf3w6e33f1NZJLcTagQBMaLmQaCjaJF1fBogWsBa9nH/ZtaiVJAie3/I/V8+gt+Kf+K07dZBJAJ8FxWJIW4ChAEaZP0+YZnGZ+3B2qNvnVy1cFxLlkctCqgzElCg7bW+uSa06L82ulZZLhbWR9+KLS2UiqIfunoLv0eUwcBNz9nAj6FMcuXSrehhjU0QMXi0YCumFdX2ghozMI1h9eQJS49T4gRDESWHpwDBiY8EPK2+2xK7VN54q6kk+MAKHAqWUlfne8pOSw2lMvcufiA5REaxvWPe1HlxsIlQln2HlCNabSj4YTN/yul4nDqwLzpg5ub+619YWz/nqtgWQIZl5JZC9M32YaR54ixy0QBBrB6XwVO9c0b5dRWIUZjz/NTEhVrRQ/J/xbYRM9WDbOoBQcXH0ocYGUhu+VCC0r9aiiK59OKv1hqoLmSBWJ7wu4LhSSd51iOJO4nfe4mHlfhcr9knGPH93WEQ8CaMc7w3XH+OFfOVsxuhCSm6/y3jUHI/n+eEi+eh8b9FokMRcnTzvMttPIKpjs0sRW/jQF43LUzqi5kxJS5w1thPdnHAzy67Q2M00bg4GQLMRsMcmvf3hcRGivQMg4f28MCUjprQI0lIBBs/RAWDxzJuYBs2WvOf/6SF+PTA6C1U5m2f+WVfTRiHbB+zzaOayAH54A463Ws4vj+nSrFyVhYhf1bpVnfV0JJ87+YuZWlmaoVHxgsrbPrq9h6K9ysw2x3+jEKVuMYNc9YzoERN/B0L+KtyuMc8g73yCOf37hBtAeegVS8ynHOCgf4Zp+nLzTgIRp8X9I+A/iq2wOLS+3N5EV5kZwnMFm/KIgBxei99XwTtUCcMNQfjN9+5w03TGq4TCkCEOOJ3QSf+8O8ht7jctp4a7/4tcL+mn3bFQ/Lgam6KFXs9mhmUZJwFAt9lg7rWU5o8GzCJ4y39Lo8RdDmUqz3vw2eHqGy6n7zrU4u3EgP9clMOlzYOFFtID6A1OARmKwWDTwwKDa/X9+6uNBmi3JIeWqAtHGuA1sXCqO/t1IoSQD1wO3VLYGDjxTrLHhnihZ0bPOfb6KFIS464cf8bKWc74b8tmMtTUL1z2P2hnRIMO6ctLmR+4QO6IQ1ix+1ZdBsql9EfJTMwtOV1rAmI7AQJKUlppVwCttE0B2fmG0qv7KQ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31423840-8d31-4d13-f39b-08dcaa6cefbd X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 16:40:03.7117 (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: RLFMlFz0sqbM7ykGlvRiyDjIrfAflJrALcOK7JEhWeTu6KHztyt8lxC/2U3luC/h X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10652 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); }