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 C304CA00C2 for ; Fri, 7 Oct 2022 05:28:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D5C842B6C; Fri, 7 Oct 2022 05:28:45 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50088.outbound.protection.outlook.com [40.107.5.88]) by mails.dpdk.org (Postfix) with ESMTP id 32F0442B76; Fri, 7 Oct 2022 05:28:44 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gqQgO6ZC+RijPqmwtjUkmCRS44FBWiR1d+AusG9WIqLIuCM+fgS/Q3DEYO6GZslaAHAO7q1pMm+v2aHhOFqhFH0UfXxjjLGQUgRobKAjLnVxEiOYdV/9o0m1I9pvSvQM/8t6bXSqHgY6BXsEKDyXW2F5Mlj9Ac+s1eJO/Qj/w5uLnehCHAKuq/qWjwHQVOQsiTqWetC5c3yYsAvhsfjID299TORmeIguOoSgIYx/ANfCDIzUdSshKco057JXMx6gpSRew9vItrCkH7rp6c3RNQZlU8aezOP1oM6Iyn8KuJtRkj+NvWLdzzMnyPlJy2DUeWl1NzsaKitIpTWL5dlLbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QBsjEtyx25KDbQfvKlMj6Ekucm573JONR1LpNsTeFX8=; b=nR2SMlPvGwa3si71pskuhrbnoAlZCGOtXwU42SVTua7SUHIFHulxq8QHL2juYm6sOTB41B+/KdjMeaV75h8uR9sx5unyJpiaZxjs1OhpAeyBb17nurHyX/svpgzEWM97RCU4jnHmHaDUCBpCbifFsWPWODXHhS8nxqKx/w8yPWGCVk9j0vnzLrdr5d1nqmgFBxxBscUUq85vlskadZ/RGi5CooS0sDM3VqJ4gMnRt/xDDAEIToHSYv9ALsyuW28DjMakw8fNRw4/TBHLy+sP4mKlPUpLzJ4ULHg1twSGtL0CvyDi2a5VCvq/n12HF6XmmgDvl8X18sJ2NO06mBVJrg== 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=QBsjEtyx25KDbQfvKlMj6Ekucm573JONR1LpNsTeFX8=; b=ZXXG4A3aWZ152FErr+WMjov5A+o60L5xus5VRIRybVhU37QsfJkIJRl0yj28tO7/cYDf9hkkttvvPO1bl9Fu+UgZ8SXVtGs3CMQOP8Y4wCvD1pPSvxcWPGLyegWliMKsZ+wWPmneyDsP/HQOmIGi9hEGtA1C5gpDrt4S0u8n9ik= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by AS8PR04MB8641.eurprd04.prod.outlook.com (2603:10a6:20b:428::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.38; Fri, 7 Oct 2022 03:28:42 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::9ee7:dafa:ba51:c71e]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::9ee7:dafa:ba51:c71e%7]) with mapi id 15.20.5676.032; Fri, 7 Oct 2022 03:28:42 +0000 From: Gagandeep Singh To: ferruh.yigit@amd.com, dev@dpdk.org Cc: Brick Yang , stable@dpdk.org, Rohit Raj , Hemant Agrawal Subject: [PATCH v2 05/16] net/dpaa2: check free enqueue descriptors before Tx Date: Fri, 7 Oct 2022 08:57:32 +0530 Message-Id: <20221007032743.2129353-6-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221007032743.2129353-1-g.singh@nxp.com> References: <20220928052516.1279442-1-g.singh@nxp.com> <20221007032743.2129353-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2P153CA0033.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::20) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8198:EE_|AS8PR04MB8641:EE_ X-MS-Office365-Filtering-Correlation-Id: 2507083e-32d9-45e3-14dd-08daa81408aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LNxHCjvbIhCoMzauq1bjDzbhhuZpSCcRbHe+cJjqGgW+U+aOm/QSF9eguujaQeg1Pmx05nTIi+kwGWVLvCjhfYmFKc2g2SImDUqaOiAZ5xWCREsIofO6Y4fU6DQ6UDNlYEpJDIKPn9R0qI/EGf0KlTWleKxkj2cplzLQcBV2sC/Ic48NMBMarQX9DO+xhDId59ZZwxlMl68qspS8VZtH80+s64B8eF4GaBBq/27J//e475ZoGruI7vKRXRZr2c7dPUuawTM+P3gO1urLVBEIiLwQBdKvpID6D04qaJd9+uQKUqsesS9F9/IHoFJTBdDDQyIBldyVgq0MoXGiCpimmXL24zqVkknmxtF1S44Oo0tbDtiXOOSXBfSSpMY/y/Wion0blilnjkLQLASCJsa7qI85SqfCvQHopjGBxzZdFBuu2N9Re3qx/2/h7rmM9UdsSDLb++j9bi08fPOu/JDVNZDbEMfa/Ij15XuLsiYV+VG5AVUU/US2XMkGqfgz25byBoxO5iNFrdGMrmiTm2BnCH4jBtzoiBqeSIckJdMnGDRl42r83phBwrnfkL7bwAwHkzKQ64CMYhjnTPyoaq/7PG93ylxfpfKQavsPhCn3a0x61MQIsL7ZzcGWgOYNwoTpBl7twYErCwvCLh/KANaJpMrBO5H8550mfR6agiO6g8adMXKU4qzHWRrYzQepSxlyjk7VcL1ksd/4+qFpSA6+UOOECc2DqJKvlhbegKQrjOeTmWfasFwsd7EypfS81F77lUlL0DTeDHBwweoMy7u/5w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(136003)(366004)(396003)(376002)(346002)(451199015)(36756003)(54906003)(6486002)(6512007)(52116002)(26005)(83380400001)(6506007)(86362001)(5660300002)(8936002)(41300700001)(2906002)(38100700002)(316002)(38350700002)(8676002)(4326008)(478600001)(186003)(1076003)(6666004)(66476007)(66556008)(2616005)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xLauB4W0IgxyjAgsWiH2upGdUO7s3/eLZsGbYl1PXd6FJrMjmAvhWeZ2561E?= =?us-ascii?Q?pjf1hofuCyGm+L+QI88A8kWVbwb6fjJou9wf9H+wJI5iV1VW5OLILnpyiRmk?= =?us-ascii?Q?bl4wbpwvyO5jkbpA0H2Be/OhYyZBRIIzn2T9MNF5sBUZYBTLEtmtAHDcHX58?= =?us-ascii?Q?tMajOzOpvfTAVMoGqYGf6dlHmzYaDCEvhIWvubQ1B3Skau5Ii+twCatYYs9g?= =?us-ascii?Q?5F7/DRQRbK5nuj3+TxGTL9LAzFFPBjirkmu/JZGWrh9NBIINbUrNdFvAKviV?= =?us-ascii?Q?AaUC7Uix+H5RTzqRmrDSmiPjOCxnUu6a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ii?Q?bNSOZh1ZlgpHUJSWUoJZTjMp1Ycpzbwwpi5Ucg4/gBFRKYzC8Rz1DFHaHHby?= =?us-ascii?Q?hnEKt0lD2L2tRXiRmLAvhP4vqOHFwnFa2gwWaaQm9+ZtdPGRwcMSz1BPG3wK?= =?us-ascii?Q?hJ/ALGQV4Nd2vTRkJhZvd05+OG4GuD5FdtCcXoOMN0ZS8OacS+aepih+AwBz?= =?us-ascii?Q?96pbqLVZ/YP4j6Bs/3snmllR+wXHGLxGN2BQmy+o1MG3i6NJsmQDAMo4GpE6?= =?us-ascii?Q?E59VLTNvSnpTghTXztn+dus7b1RK2J3dihDusd+BvVxhuf2VDmAuFj6pfAYa?= =?us-ascii?Q?zWyi96brTUDye7KYYp/9uyVVrjBWdmQcL7D7mIjgwtWy/z27qa47ZR0BGzmu?= =?us-ascii?Q?fIFhoEGl542J+Y4SU5ooofwpfqhX/obzI6iWBRYX?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2507083e-32d9-45e3-14dd-08daa81408aa X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2022 03:28:42.7022 (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: WOGMCsEW5m/tQ6ywAGSJmCM18webCK71VlmoRtPvjGDLcfYbzYqlhceUUD3UKfbr X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8641 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Brick Yang Check if there exists free enqueue descriptors before enqueuing Tx packet. Also try to free enqueue descriptors in case they are not free. Fixes: ed1cdbed6a15 ("net/dpaa2: support multiple Tx queues enqueue for ordered") Cc: stable@dpdk.org Signed-off-by: Brick Yang Signed-off-by: Rohit Raj Acked-by: Hemant Agrawal --- drivers/event/dpaa2/dpaa2_eventdev.c | 8 ++--- drivers/net/dpaa2/dpaa2_rxtx.c | 50 +++++++++++++++++++--------- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index f499d0d015..fa1a1ade80 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2017,2019-2021 NXP + * Copyright 2017,2019-2022 NXP */ #include @@ -176,7 +176,7 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[], if (retry_count > DPAA2_EV_TX_RETRY_COUNT) { num_tx += loop; nb_events -= loop; - return num_tx + loop; + return num_tx; } } else { loop += ret; @@ -1016,9 +1016,7 @@ dpaa2_eventdev_txa_enqueue(void *port, txq[i] = rte_eth_devices[m[i]->port].data->tx_queues[qid]; } - dpaa2_dev_tx_multi_txq_ordered(txq, m, nb_events); - - return nb_events; + return dpaa2_dev_tx_multi_txq_ordered(txq, m, nb_events); } static struct eventdev_ops dpaa2_eventdev_ops = { diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 9436a95ac8..571ea6d16d 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -1525,7 +1525,7 @@ dpaa2_dev_tx_multi_txq_ordered(void **queue, uint32_t loop, retry_count; int32_t ret; struct qbman_fd fd_arr[MAX_TX_RING_SLOTS]; - uint32_t frames_to_send; + uint32_t frames_to_send, num_free_eq_desc = 0; struct rte_mempool *mp; struct qbman_eq_desc eqdesc[MAX_TX_RING_SLOTS]; struct dpaa2_queue *dpaa2_q[MAX_TX_RING_SLOTS]; @@ -1547,16 +1547,44 @@ dpaa2_dev_tx_multi_txq_ordered(void **queue, } swp = DPAA2_PER_LCORE_PORTAL; - for (loop = 0; loop < nb_pkts; loop++) { + frames_to_send = (nb_pkts > dpaa2_eqcr_size) ? + dpaa2_eqcr_size : nb_pkts; + + for (loop = 0; loop < frames_to_send; loop++) { dpaa2_q[loop] = (struct dpaa2_queue *)queue[loop]; eth_data = dpaa2_q[loop]->eth_data; priv = eth_data->dev_private; + if (!priv->en_loose_ordered) { + if (*dpaa2_seqn(*bufs) & DPAA2_ENQUEUE_FLAG_ORP) { + if (!num_free_eq_desc) { + num_free_eq_desc = dpaa2_free_eq_descriptors(); + if (!num_free_eq_desc) + goto send_frames; + } + num_free_eq_desc--; + } + } + + DPAA2_PMD_DP_DEBUG("===> eth_data =%p, fqid =%d\n", + eth_data, dpaa2_q[loop]->fqid); + + /* Check if the queue is congested */ + retry_count = 0; + while (qbman_result_SCN_state(dpaa2_q[loop]->cscn)) { + retry_count++; + /* Retry for some time before giving up */ + if (retry_count > CONG_RETRY_COUNT) + goto send_frames; + } + + /* Prepare enqueue descriptor */ qbman_eq_desc_clear(&eqdesc[loop]); + if (*dpaa2_seqn(*bufs) && priv->en_ordered) { order_sendq = (struct dpaa2_queue *)priv->tx_vq[0]; dpaa2_set_enqueue_descriptor(order_sendq, - (*bufs), - &eqdesc[loop]); + (*bufs), + &eqdesc[loop]); } else { qbman_eq_desc_set_no_orp(&eqdesc[loop], DPAA2_EQ_RESP_ERR_FQ); @@ -1564,14 +1592,6 @@ dpaa2_dev_tx_multi_txq_ordered(void **queue, dpaa2_q[loop]->fqid); } - retry_count = 0; - while (qbman_result_SCN_state(dpaa2_q[loop]->cscn)) { - retry_count++; - /* Retry for some time before giving up */ - if (retry_count > CONG_RETRY_COUNT) - goto send_frames; - } - if (likely(RTE_MBUF_DIRECT(*bufs))) { mp = (*bufs)->pool; /* Check the basic scenario and set @@ -1591,7 +1611,6 @@ dpaa2_dev_tx_multi_txq_ordered(void **queue, &fd_arr[loop], mempool_to_bpid(mp)); bufs++; - dpaa2_q[loop]++; continue; } } else { @@ -1637,18 +1656,19 @@ dpaa2_dev_tx_multi_txq_ordered(void **queue, } bufs++; - dpaa2_q[loop]++; } send_frames: frames_to_send = loop; loop = 0; + retry_count = 0; while (loop < frames_to_send) { ret = qbman_swp_enqueue_multiple_desc(swp, &eqdesc[loop], &fd_arr[loop], frames_to_send - loop); if (likely(ret > 0)) { loop += ret; + retry_count = 0; } else { retry_count++; if (retry_count > DPAA2_MAX_TX_RETRY_COUNT) @@ -1834,7 +1854,7 @@ dpaa2_dev_tx_ordered(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) retry_count = 0; while (i < loop) { ret = qbman_swp_enqueue_multiple_desc(swp, - &eqdesc[loop], &fd_arr[i], loop - i); + &eqdesc[i], &fd_arr[i], loop - i); if (unlikely(ret < 0)) { retry_count++; if (retry_count > DPAA2_MAX_TX_RETRY_COUNT) -- 2.25.1