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 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> Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: =?us-ascii?Q?FYEDNNuSKS2j7zEjP0XE7dp8FBXlTKZj/Ep4RvsSqMyspzc+o6PC/iHejRGo?= =?us-ascii?Q?1ToFf5XuO4DNEH2i2Yg8N/PgysqtJGGXoWc510qtjEOpe5I1zGYIkgGBFGhk?= =?us-ascii?Q?tx+AQiWsVC6Ya7YXMUbGHwI3TWiVVauqMAAANIYbRELD6iIpdI2WaV6CmMW2?= =?us-ascii?Q?dNsNW55stEeH9mgU7YWDPgVqT4XSXOs+vie1uRWegDn5wW2zhnCo9d8ediY8?= =?us-ascii?Q?+yaRAJVi8un6NX/BTwhG+nNcjBV8CngSgaWHmtN6RbdJ+CfHCyTphhBIEIhT?= =?us-ascii?Q?qhvlRgiUu2Qr/MtDzkTkRjW+pa57em5iCW1FX+wMxRyRsK4sw9AYXU9zc2lk?= =?us-ascii?Q?h7gw+C3sac1ezsEM4Q/v/hD8zeZ7y2DlbFnE4vndzMv6Cr7ZAfcukVl17VZD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dOG4ntBoFbGd+G/1l8nL3cLA?= =?us-ascii?Q?xeMiDSUFgWbBdhTihYTDjKgurLyiJtGMXDtbrb8Bq1KhJQGGIKgGrHXOhwfS?= =?us-ascii?Q?3v/QSQzm/GRND85Z+5lB8f1HiWPtC8yhpbi29XNJ0oTJdlourg=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)(1800799024)(366016)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?g4U9UWPcEaH+QZb4/Q80Sz+XuxgFBXcFfYVIQCFY9eIGnqdbcYAVQ2jJgPl7?= =?us-ascii?Q?fxh2api13Kp2ufRQh1+LMLM4wj7C/NTVEWa4Cy63MjMj8PhrLewWRzwupN4y?= =?us-ascii?Q?36cyco2K1VGCoeZTRp2Ljvq/fwENXXd+ROQ0wtbtNGDmUsfYqUHwucLUMH+N?= =?us-ascii?Q?b7ff7hUPvhrs54EgwNoKedkO//qTampeVWJdyT1NUYbIItkPMfJggQw/NhD2?= =?us-ascii?Q?AtXx9Nst1GdBopxQIM7R26Ngt23YXlk125REJPHQuXXYeoSeWT2ilZGo57hC?= =?us-ascii?Q?t/mTncVh4ipTj8n1J6+6O7yS5q7bRjqfjo9SN7LZn3eSQ0OAGEMHuC2EwtxX?= =?us-ascii?Q?qrgRSjb/clmZDiVKd4WYtHX93fOdzEkKPXZVg0L5UlDjzdvBY3nqrAJvASNS?= =?us-ascii?Q?sPYlznB0RoJfLArK8wnomxJWwvOPEw5yXwK/grSi65+6j7BxdR7OpqP7ps+Q?= =?us-ascii?Q?xEv3drvGfPRsIcXssTGNCyiWNgWmHAF27WBrEMa9dtB4nFo9Wpo87hocWcvQ?= =?us-ascii?Q?oIKFj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bsMvMk7CCWmh1ZAO?= =?us-ascii?Q?gtbVoSMPQqHCgp69RJW6u0aZXmuUtMVWO/L0ABxV2ejElRRJGnOrcVISAAji?= =?us-ascii?Q?hCb+O0Jk5nPp0fF7cg1aWNSiuOrzx9vm7pbq1F4A++936Co9P1YI4wen/yuu?= =?us-ascii?Q?aMGRXrUKuMbT2rCygKOq0QNT53cJC1M+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 -- 2.25.1