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 0685AA00C3 for ; Wed, 28 Sep 2022 07:25:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E5BD42B72; Wed, 28 Sep 2022 07:25:48 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60080.outbound.protection.outlook.com [40.107.6.80]) by mails.dpdk.org (Postfix) with ESMTP id 4257142B84; Wed, 28 Sep 2022 07:25:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bXPJlSI8qqDaR8+QsJ3IzQsppMsg9BaGg45BraR87HKcaMx1vVOStOlP9/YE9rhtMUHA0Y+kUrt4Q8j5jhprbxUHyDGONkbRUx28lQpLH3xInSxEFPbfqODajcaHkewclABp0vLXykeXcwqWGaqj2EFf6xXQwCGcZh3SZ9VJabQjY43Jc4DzqFwjb9doptva+EGit5xFsQYb91Uh30ukHP5WpRhKm7oC021iK4rwE6UQvIVn2zihsZ60SOvx0TwdFTxju3ZFEUHEQKS9/DRo8NKjtgxgwf6rzmxa1NNoMHO57s/KbSquvVExEwWdsMmvVbVvmJKGi9oz609BdZYYrg== 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=RNvpqKf4OPl+YInJxJ6qkxSMrig5vURCxahDcAvSCVQ=; b=OzsgAEe413QRutglKfYpI7tDkeEOgrzkTyOEPqwGwc9yy+/J1q85pV0EVE7Ps81Pwz8o2vSWy3b6bFtuDT5yo8agTmt9bNkN0GWx8HKDJoldLVAX8lbVgfPKSswm/8fiq/g6kHpdSvdfSwVvQfwidpM/q1UukMl6ndEC5n5va7POxWnSpJ2xqiBxFQhMvetrdLFEi34ij/KyP5ZMab1fBHGYvJdUzWJx+28rw3u/NPF6ORWjIUavRN7HtXSF5RhU19jyHXcbL6ghKM6fFYrZzg4N1gDSWvgQWW0Q84zt+fKYrTPkC5iql4S3E0hLAjf1DTweFxAY49kS03Zoa/+DpA== 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=RNvpqKf4OPl+YInJxJ6qkxSMrig5vURCxahDcAvSCVQ=; b=RBj9rueQmyaUEElaNJBAAEkFPgO9dGjAnlhVUE9FPH9oiYORZLogdacBfiZ4ERO37SVMISK+RQZb9T1oopTXYbwXI2oy/Id7OdvDuIhonvzjWU59+5On+PLzj55H3DawPreCIYlAoTZGyRClTTZep1wzybv6+MKUWBettVufj8M= 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 PA4PR04MB7504.eurprd04.prod.outlook.com (2603:10a6:102:e6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.25; Wed, 28 Sep 2022 05:25:46 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::14d0:4458:d6ec:b8b1]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::14d0:4458:d6ec:b8b1%7]) with mapi id 15.20.5676.017; Wed, 28 Sep 2022 05:25:46 +0000 From: Gagandeep Singh To: ferruh.yigit@amd.com, dev@dpdk.org Cc: brick , stable@dpdk.org, Rohit Raj Subject: [PATCH 05/15] net/dpaa2: check free enqueue descriptors before Tx Date: Wed, 28 Sep 2022 10:55:06 +0530 Message-Id: <20220928052516.1279442-6-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220928052516.1279442-1-g.singh@nxp.com> References: <20220928052516.1279442-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SGBP274CA0015.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::27) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8198:EE_|PA4PR04MB7504:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c8456ee-e1f5-463c-e3c7-08daa111e51e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qXfV3tOIwCJ5vfjEQ2bg871S3SvewzzxHRyeOt6iUakLe4sAgySWpROn5UfVELYK7tsLikj8JFVynCb7/fU7yFfEyYtMj5bvihi0jqegRc5hTviinQTSG4w+SnrX9uMFb9bAHpYwnM+Ah5FK/zZ3j7J5pV6WdXI/Bur1Y/gsoTUbmMJenG8ILy03/R4q5OHl86wMofeLqvP91ZC79HGNbowMPvQbEPWk1UYkRJJOi53+vyj4TsKmxc0Qveanbt1NP+9PhmC5TEgvLJ6gx8bWJ5/68WFVHfErx57UGsFmsDet/DVceSkE8+2LWjv17kcqPdJnfXNifDRvWc+fdKe8l0uy81HVHY1SgCOw4/Yo+CIHivb5dCaN9GAqVZmkoWxl42KfNXAykJbo6PCqZk9EQTkxTpI3IP6M7OfvE2i2D7Ah2mWqsHq80Yt5d04TIiZT+8R+M8KEvSDj7DiYRIhPC68qB3MNPUkjw5H2DXWVle67i1gOy/YJ/WLz9DAkVlvg3LRJsQuainzUFEoBc8/jWtBgwCWiP9+eLoOvgrl7O5TId28/3XJ0wsg7in4gm89lSazaXCTbuvc37QxJUEOc8/5Oewm6FFokrSnEim6xn+w1k1AIjsZagyskIOX5lKQRV28jsVGH5MuYnWxQtFyt6Gf3eVoTRLdgOcWu4BIgaw3YtvqlFSKx0rB+dEWGhK5Wd5Z7CuYLe9EdawgspKJvdA8KwY1nZOJYtjOCL+z5yJm7Tt5TEFiIB3O5xR3/iBEaq/sb5nbWHNe+r4bXbhNPqw== 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)(346002)(366004)(376002)(396003)(136003)(39860400002)(451199015)(1076003)(186003)(2616005)(8676002)(83380400001)(38350700002)(8936002)(6506007)(38100700002)(26005)(86362001)(6512007)(6666004)(2906002)(5660300002)(52116002)(478600001)(66556008)(66476007)(54906003)(66946007)(316002)(36756003)(41300700001)(4326008)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?dytqerMy2nTLMs2AvBBSnkvlu7iclubrLy6+HG/+cNftM9DudSw5mibx3ND4?= =?us-ascii?Q?xs6aaO/8jUMYT0edUYGcuRyd27mS7ILVe3+Zj3mke1cbDHbGZHTFst2PBLNN?= =?us-ascii?Q?REz/UXgu1FgpkguAz1eBhevOshPrNOG1nbYUR8qgLy054hdKPZKggs8pNJRs?= =?us-ascii?Q?sFwH3l+5AfmZoHmm7wAHzojr2P4KCK5ZrXi1O+0i7IhitSJ6CrRIzjAmMVc3?= =?us-ascii?Q?bIEXJL6c3aC7O8+n79C206bLVwRssWYW/F+cJjKijsazEQ6XVd603VeXUrhu?= =?us-ascii?Q?8K7Ix6uZTMRMjDAOdk+teDmR1alYY5XP8+dgggJHEqjmqKOx8tsPBFGorchF?= =?us-ascii?Q?Hz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p+HZ4BQ1y+otBEt?= =?us-ascii?Q?lYxad+vnFHJ5/ffa12cVMIfYMlU58Lw/7Iqs0BGLCN5/sjXlNcHruYUgLIM3?= =?us-ascii?Q?NVfytricThwb0P4FW2roj5FoZ5kPxvpJa5N+WPAO8nUm4bt3SjNSgyFpgd1Z?= =?us-ascii?Q?N1gjUr2jF6yqd18NHTFt9zQgYE227QxsxPmn7E05YiZ0g7c09cy3a6VapdqU?= =?us-ascii?Q?a71tA48Hb0Mu1dkVQGE3zpb6uwo+xyuJZiRvqaymyAU1WA08E2aoXwQqjMJ9?= =?us-ascii?Q?qD66TV5WeRJGu3nxVdYWSAwRRe+xaFCIf3TyKN2Z7uffz1/ghtw4PbSXek+I?= =?us-ascii?Q?I3OmHLrX/Ql7h4T8ny9W4fo9W8F/2kh6xK+9/DYo?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c8456ee-e1f5-463c-e3c7-08daa111e51e X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2022 05:25:46.3287 (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: Ck/iE2H7NkwaRYV1746dDv806aR0D9AKYFbxhhiAV86xvFDdd3nNegTYy/rEt88c X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7504 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 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 Signed-off-by: Rohit Raj --- 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 1001297cda..d09c5b8778 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 @@ -175,7 +175,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; @@ -1015,9 +1015,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..bc0e49b0d4 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