From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7FD2F45683; Mon, 22 Jul 2024 18:43:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 11852410F6; Mon, 22 Jul 2024 18:40:55 +0200 (CEST) Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011041.outbound.protection.outlook.com [52.101.65.41]) by mails.dpdk.org (Postfix) with ESMTP id DDA3C40E0B for ; Mon, 22 Jul 2024 18:40:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NitpF3tsr/iU48ZQEAQ9pMetd6SnZnZu68WX5z94DQ7wAFuDghERGlQsE/e0bYdoT5nQpANTRv/GgWbbstTHADRyCwCK2N9ycD95l7h1+DbDU98nqP3keSaTtkSm7x5Z0Q3AcdQxMa3KW2kvFLFK5+qDl1tU65ui4a8JugtNfjeSh2citUTtBhSud8++LlF9Wrx8uVEK28j+YVUrRfErfMJy/hGcljpe4p84pONCjPZOysMvfeZUMGtrycOmbuCVSgTH9zGenKVesPZwDkMSaFy5Ra1T18KxsEFdWgaFjr0bOxPo4Yw3Du7g1vJVU7vJOLglxCnul27EK/N2gUBHqw== 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=/I4kTk19N/RvpOYdeVztlpI5MAk1ib+Bl1T88Z59Lw0=; b=PJfaCHNIe7mNUhSefBrk4Zvevoe0FU8D+/YnlJxEaXehrdPa/ye7cqRYDhVb8e2IFcYRyQ+FykGWMJbVNWZILpvl3nWjUWk8LMNAui9SYLTvFqwJuHm77x8/Lr1en5Wbz2RFZiBl/2VVHQG+pFdaDjt28EZuRroMhMuXQz2s/MKOI3ltasQHCxCmKKDkQrzeoHkhLwqhwKnXs7CWSa3kzRNgyHTxh3WQAcxc3LadDR3uyJIGcBGFmRSHsw3zJDMmhEUXBSL6msD+KyPslcq0mSBbcx4lfeBB1HwlbIvvMTFvPM6w/L6mO4pPIfwXiICSClCJqOMbQq0zr3FI4Ct/Yg== 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=/I4kTk19N/RvpOYdeVztlpI5MAk1ib+Bl1T88Z59Lw0=; b=dNbBnthAK7kCA4/0ewpBzj4JNBKKTo9yb2pik1l6zJKCBQ2w1SdZ5qt1X3QXR9WU14lrjDHksgWPJVJcnsbNEn6w45VyUOERDBpL7HYdc+Ah6QzuTfSAkbAtf/22fGxGaSzsQYlhSm+eyG/3cSj62z4oxdQLJZE6TdqpmDUbkRQ= 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:32 +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:32 +0000 From: Gagandeep Singh To: dev@dpdk.org, Sachin Saxena Cc: Jun Yang Subject: [v3 26/30] dma/dpaa: improve ERRATA workaround solution Date: Mon, 22 Jul 2024 22:09:26 +0530 Message-Id: <20240722163930.2171568-27-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> Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: 50e85015-b89d-4bd3-d3e4-08dcaa6d00e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?xFTTEqxEZSxPEOgFw0c8wxGbQIF1EHiAUe5gzSI4c2XNsmsiRyydSOwC52s9?= =?us-ascii?Q?O4m1LDyz46BHKE0MSJzJIbRPBYSnMN7RgZKMYRxanfCQ5BSP2+09spUGIN7r?= =?us-ascii?Q?EpXajQYHZS1skjMBoHZBuqRK6u5sCYcRFl6QfuTLGQY4mTgyTCSKSSjFq1dL?= =?us-ascii?Q?ZKFWNroy8AjHRSqqqVsqO9dL0K6yo883WiQSxslHuPvmaxaqVPLn0LMiYHYc?= =?us-ascii?Q?L5cNzSFjyOUBUbR/mrx6RYY8+PRsY0B1uceEyJV3buDEds4RwTEh+H5bHdMK?= =?us-ascii?Q?A+8P8vTc5vQxs5tJK6agA6jFgSxyUO6/cFW9obDkjKHQ+mZ3RbecuVXbhOXd?= =?us-ascii?Q?dzEJlUxJsVCcadTqsiePbq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us-ascii?Q?ArjEr/ZIUaBZxHKXNw6XTiU48IT54I8ZflxrXU7qWgwKsahNz+e9gkpGdT/5?= =?us-ascii?Q?cdlQaiWHADDPDe6YmcHOYhmfKO8dwxU0TdwCNXrjg0PIDsn1Dr68PdUAP9Wv?= =?us-ascii?Q?Nz41Nz7Wzjbc44M60shvrpAT6eX4xQqNMmp8a3WIQWVf9ZEWnw=3D=3D?= 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)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?tiSpoPb1VotfUQqn0NTplVPyepVTmwI66t8rufasalxhp3GELBGk/XN4y5nn?= =?us-ascii?Q?rmevX+pghXllo2w2PSGLTs0x8k3ltUYz6TiyUi5TBQG1mp7dciGWn6tIjSjx?= =?us-ascii?Q?PukPGjUBpGP9lfdOeRSmpkBCuRwKHIsLMDUTSrlHr+SILQzazelSg+kOp2Ti?= =?us-ascii?Q?V11Q1x7UNFcEtUeLpd7a7tJeL9qS0KxNZVXfBbMn+lMGEa9pkT8arHNxJcWa?= =?us-ascii?Q?gyFU+83XQVEMoQJ0D0R9bPM1LAENZY97Fr3715cknkraazI4L9KlMJ2PVvxq?= =?us-ascii?Q?rgyDWBiWLyhVOAjyy33/1bUVLYWIaNRC9ZyrblsK25AIdQQSPslyaPQdshqx?= =?us-ascii?Q?u6xtUH0kFP5qtSA9+cMxSRSHqxHJ8Y9KoFQXEuRsYlbIxLRsmclrzYxKqeXG?= =?us-ascii?Q?gba4bQXGO31sjv2zFu7qs3Lc0Lif3EkSFmkS2YoqXCniqY+GEMLB8shN/4u6?= =?us-ascii?Q?hFa4OrVU76LnyAUMObHgOt7n1vQJMaJ+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SoSh1uUjV1Te4cDhVXRBboSJCTGhhoEid0F0S0Mo+t9Wa/8gfEg?= =?us-ascii?Q?SuZ+avetCP6WP4I6X04+QZyfCFS1n9yDeBD8yyxI6PDV4LsOH7P48BuD3E1/?= =?us-ascii?Q?PFeFo3V03Tdju0q9AJPvxyK/qJAZvL9iXQu6pn2LgB6f8D/pxn01DmkvZS2I?= =?us-ascii?Q?Q7Euf+8gPfHp0KVxd3FsSaCXycBGmvzg1ZIjYxBl?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50e85015-b89d-4bd3-d3e4-08dcaa6d00e6 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:32.5968 (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: Gc+IJgrD/bmxtTKiiAnkFevQJGmcsCuEbfnX5Wc/szwZUHsKSHLbOGffhlugcAyc 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 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 6c74d632e6..f2aa6fdd34 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; }; -- 2.25.1