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 A886C45A68; Mon, 30 Sep 2024 14:17:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1AA1E4066E; Mon, 30 Sep 2024 14:16:21 +0200 (CEST) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2089.outbound.protection.outlook.com [40.107.249.89]) by mails.dpdk.org (Postfix) with ESMTP id BCC004025D for ; Mon, 30 Sep 2024 14:16:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CQbvV+UTzeOQ363tYhUsIH2N14ZIMpLjVR6cjm6LVV55b+3OAcRLqc896T3xjT6GiXn2keAjZAMqRaauudgA0R66nF4BNT2Oc9RQcxQSmuV5B3wvkPXMAkMGsCpw1B7ICYPFKqyyvxlvxiKUJFGyCQXul0XvJsehlBCsUa88UufT4e7S4EBvyP9FKzIHN2qrCAsaRrOzeDiaZ7+QPIFmY4eQPH+FIsCFsVafB5P8+EzR5/XQx00YM0EzXLZvYRsZkN4d1tcRrtcmbHz4W6H8PnMnqsl3FRm+n8MqnolOknYsA+Og9VvQHiqyKxJWvDi2cHUe/7qm+oM+KnkdGkCBuw== 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=FB0VLnXzze0ipCvIEtHrW8rtXJOggU+Dm65euZu/sPg=; b=g2qmNDqstqlVokrYhpQA8lS/tS79hX5MxmMSqS+NZSIhoMds9TbMr4oFcjpympHv6jS8gZixuEQTTYibPxirzjIaZYqoJlU78nipANoTdwm3I2qnpzzcqzu49SKYDb0NtM4ygegxoGXrfuQ0Xja2RIcViub+gcTtTtH/zY9K5xY4dkZcJmhopDpgMZ/2VTdkuFDKMmR0sBic2lFxXCVmRhviqetCTaQekjKrD2NOELyHkALYP+3BqHCACY0YgzCj1Ut4EDz3VuIqaNnQfERcGmhdpcMW5HBDh0bGbAUyMxerFVRHuw62E5+5tbvvgUyLDWkVKewIgRUX5kMB1Nlb8A== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FB0VLnXzze0ipCvIEtHrW8rtXJOggU+Dm65euZu/sPg=; b=foaZ3QHDrd2unXoHq5BQZmTvUgyXAEYVsRISaALlibKV2PS5Y0JnjTEvA7GB7CwMbCHuZrOk6BXOb6vgT0/8AEzgO/r4tYwGjKVTh5BhG+LyVHgZ+4RrpQwJY8DiZRpWrFdyZhi67cWnqnIp2+naNXkk3kkO5JwhccKq9AR9B4lAR9TNGlq/4fmEv85sxEomcxWfhj6Bv9NoO0qf8HL81rhe0J+qnV3A+JbOZHtA/kC/KiDUPeQRwQYz2SwIwSzq6ro3wfvHPzZrx8rKWUBrX6pBZZXxsLQfJjuxa8afVxUV2Dh1nu2Co/2uiBL05kSvdBAZ8GlHWyZqfp44KqEKHw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by PAXPR04MB8334.eurprd04.prod.outlook.com (2603:10a6:102:1cc::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.26; Mon, 30 Sep 2024 12:16:15 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.8005.026; Mon, 30 Sep 2024 12:16:15 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Vanshika Shukla Subject: [PATCH v4 06/18] net/dpaa: support Tx confirmation to enable PTP Date: Mon, 30 Sep 2024 17:45:13 +0530 Message-Id: <20240930121525.3452847-7-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240930121525.3452847-1-hemant.agrawal@nxp.com> References: <20240823073240.3708320-1-hemant.agrawal@nxp.com> <20240930121525.3452847-1-hemant.agrawal@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR01CA0124.apcprd01.prod.exchangelabs.com (2603:1096:4:40::28) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|PAXPR04MB8334:EE_ X-MS-Office365-Filtering-Correlation-Id: 247ef00c-2909-4d23-34bf-08dce149ae0d 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?hRJCz27QoPELqEFsVslKrnWi3nG9XuB3dzkYowc0N3xjIXnQBBhvzGJJMgS2?= =?us-ascii?Q?3tA0GKiacaLw21Z10NGWniDvk248SLt6ItLzZVk1rACGJmI5onMu+igLyS5z?= =?us-ascii?Q?xvelW45pM0onW69y1jAswVFXW1n0Jx/AhXy2uFWvaSF6dbl/xwSAV+25u8Kq?= =?us-ascii?Q?B50EwXjYJimeiiGEU938QK9cFMJfVLgTBULZdtZeIqIn9LUMRsi0jU9sB9IB?= =?us-ascii?Q?fb2nVv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?us-ascii?Q?3IovV59DeqCSnkxPMwGKo8ryj3sk7nL43MA7AVWoObuonXhfZDIYVD8QenWG?= =?us-ascii?Q?d0sGyzcavjp5/cDadmpmDwRuBQByn151Fgh3C3dQZWRWF2EK8uMFibYOPRRx?= =?us-ascii?Q?Q+cG+K0mwKo/re25CzNNKG6yCzgWxDCcfsnXk8UHBus1xBuBNgf7qlY56YbF?= =?us-ascii?Q?qly2KCqadCkqb5xLbfHJmRJ4GdhjhISazPg2zStpfUYORQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.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?H8bp7WBdws7J/4/ZvK7PJ0pHofUu5MZM1g6MhIssHGrN8rv/5Eh6t3+kPDoR?= =?us-ascii?Q?Nr2PQ5DjSz3emoh0gNOhFmiuzzko/r5yOJBqo8w1B4UEJ1qC+ytp1i6kpr+O?= =?us-ascii?Q?ZfHSvz6W9yWlnDwcbKQQRMCd7IPdNU/jukUX9NGRMvLzoF5LuPL6kq1RePZ2?= =?us-ascii?Q?LLMXcqcQBGkxEFz3+IUve2+AX1OrvWvXpw8hqQmAzvZV5mTdgOBR9UfhP/Jt?= =?us-ascii?Q?SQ8chV53UaZHXnlsVbZiUAw2bTTWlRaSqhp7RfGSVkRu3VB/E95E420KeCF0?= =?us-ascii?Q?IVxmpEU5xGkKwT6QnJ8h9/ro3+9zhvQm04GLqc0m1/4XTg5rW6f96uf2QGup?= =?us-ascii?Q?7D8v9r2AXzkR7p1nYPw1Ht8JhLHNxAcutVRu3gyrN7pcVSry54o48fqkWnSY?= =?us-ascii?Q?N2Kq5MholD/iqI/2klY9jR5+IEO9fKTbtW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q?qFWGSt8XasAdxEGDvRyl/eq/H/Ai/S6usnLbovLghkXXurKQMoPw0Rc93/YP?= =?us-ascii?Q?5gXPFoujFjCKgfiOrxHB9BJHzn1Lz0xgt53OvPc5wdWWf+8o5PSUa2G2ZhoZ?= =?us-ascii?Q?Wd12jc4qkgDHIpPQlNklb5hfQRm8NVUvWdvziduhpgfxVYvOoz7UJdlQCbmW?= =?us-ascii?Q?6l8q8bk3M/DVA4Pv8Grfb67c9DMIF84QTygdH7LYsn8bGl4ckc2q1X3G2gjE?= =?us-ascii?Q?QJ3gsu/R5wY0TDJM0UWBZs4k/1GXFYeQd0WPao985BROm59AyinI7af2VBFH?= =?us-ascii?Q?KA=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 247ef00c-2909-4d23-34bf-08dce149ae0d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2024 12:16:15.1741 (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: 1AIjNaw638A7d38Ej2Nan1/vzKl6zHq/AgBRYvgpegiTE+TL48reiV3Kxu8lWITpb2oFzfqxy2k7OVrKstOxEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8334 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: Vanshika Shukla TX confirmation provides dedicated confirmation queues for transmitted packets. These queues are used by software to get the status and release transmitted packets buffers. This patch also changes the IEEE1588 support as devargs Signed-off-by: Vanshika Shukla Acked-by: Hemant Agrawal --- doc/guides/nics/dpaa.rst | 3 + drivers/net/dpaa/dpaa_ethdev.c | 124 ++++++++++++++++++++++++++------- drivers/net/dpaa/dpaa_ethdev.h | 4 +- drivers/net/dpaa/dpaa_rxtx.c | 49 +++++++++++++ drivers/net/dpaa/dpaa_rxtx.h | 2 + 5 files changed, 154 insertions(+), 28 deletions(-) diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst index e8402dff52..acf4daab02 100644 --- a/doc/guides/nics/dpaa.rst +++ b/doc/guides/nics/dpaa.rst @@ -264,6 +264,9 @@ for details. Done testpmd> +* Use dev arg option ``drv_ieee1588=1`` to enable ieee 1588 support at + driver level. e.g. ``dpaa:fm1-mac3,drv_ieee1588=1`` + FMAN Config ----------- diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 90b34e42f2..bba305cfb1 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2017-2020 NXP + * Copyright 2017-2020,2022-2024 NXP * */ /* System headers */ @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -50,6 +51,7 @@ #include #include +#define DRIVER_IEEE1588 "drv_ieee1588" #define CHECK_INTERVAL 100 /* 100ms */ #define MAX_REPEAT_TIME 90 /* 9s (90 * 100ms) in total */ @@ -83,6 +85,7 @@ static uint64_t dev_tx_offloads_nodis = static int is_global_init; static int fmc_q = 1; /* Indicates the use of static fmc for distribution */ static int default_q; /* use default queue - FMC is not executed*/ +int dpaa_ieee_1588; /* use to indicate if IEEE 1588 is enabled for the driver */ /* At present we only allow up to 4 push mode queues as default - as each of * this queue need dedicated portal and we are short of portals. */ @@ -1826,9 +1829,15 @@ static int dpaa_tx_queue_init(struct qman_fq *fq, opts.fqd.dest.wq = DPAA_IF_TX_PRIORITY; opts.fqd.fq_ctrl = QM_FQCTRL_PREFERINCACHE; opts.fqd.context_b = 0; - /* no tx-confirmation */ - opts.fqd.context_a.hi = 0x80000000 | fman_dealloc_bufs_mask_hi; - opts.fqd.context_a.lo = 0 | fman_dealloc_bufs_mask_lo; + if (dpaa_ieee_1588) { + opts.fqd.context_a.lo = 0; + opts.fqd.context_a.hi = fman_dealloc_bufs_mask_hi; + } else { + /* no tx-confirmation */ + opts.fqd.context_a.lo = fman_dealloc_bufs_mask_lo; + opts.fqd.context_a.hi = 0x80000000 | fman_dealloc_bufs_mask_hi; + } + if (fman_ip_rev >= FMAN_V3) { /* Set B0V bit in contextA to set ASPID to 0 */ opts.fqd.context_a.hi |= 0x04000000; @@ -1861,9 +1870,10 @@ static int dpaa_tx_queue_init(struct qman_fq *fq, return ret; } -#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER -/* Initialise a DEBUG FQ ([rt]x_error, rx_default). */ -static int dpaa_debug_queue_init(struct qman_fq *fq, uint32_t fqid) +/* Initialise a DEBUG FQ ([rt]x_error, rx_default) and DPAA TX CONFIRM queue + * to support PTP + */ +static int dpaa_def_queue_init(struct qman_fq *fq, uint32_t fqid) { struct qm_mcc_initfq opts = {0}; int ret; @@ -1872,15 +1882,15 @@ static int dpaa_debug_queue_init(struct qman_fq *fq, uint32_t fqid) ret = qman_reserve_fqid(fqid); if (ret) { - DPAA_PMD_ERR("Reserve debug fqid %d failed with ret: %d", + DPAA_PMD_ERR("Reserve fqid %d failed with ret: %d", fqid, ret); return -EINVAL; } /* "map" this Rx FQ to one of the interfaces Tx FQID */ - DPAA_PMD_DEBUG("Creating debug fq %p, fqid %d", fq, fqid); + DPAA_PMD_DEBUG("Creating fq %p, fqid %d", fq, fqid); ret = qman_create_fq(fqid, QMAN_FQ_FLAG_NO_ENQUEUE, fq); if (ret) { - DPAA_PMD_ERR("create debug fqid %d failed with ret: %d", + DPAA_PMD_ERR("create fqid %d failed with ret: %d", fqid, ret); return ret; } @@ -1888,11 +1898,10 @@ static int dpaa_debug_queue_init(struct qman_fq *fq, uint32_t fqid) opts.fqd.dest.wq = DPAA_IF_DEBUG_PRIORITY; ret = qman_init_fq(fq, 0, &opts); if (ret) - DPAA_PMD_ERR("init debug fqid %d failed with ret: %d", + DPAA_PMD_ERR("init fqid %d failed with ret: %d", fqid, ret); return ret; } -#endif /* Initialise a network interface */ static int @@ -1927,6 +1936,43 @@ dpaa_dev_init_secondary(struct rte_eth_dev *eth_dev) return 0; } +static int +check_devargs_handler(__rte_unused const char *key, const char *value, + __rte_unused void *opaque) +{ + if (strcmp(value, "1")) + return -1; + + return 0; +} + +static int +dpaa_get_devargs(struct rte_devargs *devargs, const char *key) +{ + struct rte_kvargs *kvlist; + + if (!devargs) + return 0; + + kvlist = rte_kvargs_parse(devargs->args, NULL); + if (!kvlist) + return 0; + + if (!rte_kvargs_count(kvlist, key)) { + rte_kvargs_free(kvlist); + return 0; + } + + if (rte_kvargs_process(kvlist, key, + check_devargs_handler, NULL) < 0) { + rte_kvargs_free(kvlist); + return 0; + } + rte_kvargs_free(kvlist); + + return 1; +} + /* Initialise a network interface */ static int dpaa_dev_init(struct rte_eth_dev *eth_dev) @@ -1944,6 +1990,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) uint32_t dev_rx_fqids[DPAA_MAX_NUM_PCD_QUEUES]; int8_t dev_vspids[DPAA_MAX_NUM_PCD_QUEUES]; int8_t vsp_id = -1; + struct rte_device *dev = eth_dev->device; PMD_INIT_FUNC_TRACE(); @@ -1960,6 +2007,9 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) dpaa_intf->ifid = dev_id; dpaa_intf->cfg = cfg; + if (dpaa_get_devargs(dev->devargs, DRIVER_IEEE1588)) + dpaa_ieee_1588 = 1; + memset((char *)dev_rx_fqids, 0, sizeof(uint32_t) * DPAA_MAX_NUM_PCD_QUEUES); @@ -2079,6 +2129,14 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) goto free_rx; } + dpaa_intf->tx_conf_queues = rte_zmalloc(NULL, sizeof(struct qman_fq) * + MAX_DPAA_CORES, MAX_CACHELINE); + if (!dpaa_intf->tx_conf_queues) { + DPAA_PMD_ERR("Failed to alloc mem for TX conf queues\n"); + ret = -ENOMEM; + goto free_rx; + } + /* If congestion control is enabled globally*/ if (td_tx_threshold) { dpaa_intf->cgr_tx = rte_zmalloc(NULL, @@ -2115,22 +2173,32 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) } dpaa_intf->nb_tx_queues = MAX_DPAA_CORES; -#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER - ret = dpaa_debug_queue_init(&dpaa_intf->debug_queues - [DPAA_DEBUG_FQ_RX_ERROR], fman_intf->fqid_rx_err); - if (ret) { - DPAA_PMD_ERR("DPAA RX ERROR queue init failed!"); - goto free_tx; - } - dpaa_intf->debug_queues[DPAA_DEBUG_FQ_RX_ERROR].dpaa_intf = dpaa_intf; - ret = dpaa_debug_queue_init(&dpaa_intf->debug_queues - [DPAA_DEBUG_FQ_TX_ERROR], fman_intf->fqid_tx_err); - if (ret) { - DPAA_PMD_ERR("DPAA TX ERROR queue init failed!"); - goto free_tx; - } - dpaa_intf->debug_queues[DPAA_DEBUG_FQ_TX_ERROR].dpaa_intf = dpaa_intf; +#if !defined(RTE_LIBRTE_DPAA_DEBUG_DRIVER) + if (dpaa_ieee_1588) #endif + { + ret = dpaa_def_queue_init(&dpaa_intf->debug_queues + [DPAA_DEBUG_FQ_RX_ERROR], fman_intf->fqid_rx_err); + if (ret) { + DPAA_PMD_ERR("DPAA RX ERROR queue init failed!"); + goto free_tx; + } + dpaa_intf->debug_queues[DPAA_DEBUG_FQ_RX_ERROR].dpaa_intf = dpaa_intf; + ret = dpaa_def_queue_init(&dpaa_intf->debug_queues + [DPAA_DEBUG_FQ_TX_ERROR], fman_intf->fqid_tx_err); + if (ret) { + DPAA_PMD_ERR("DPAA TX ERROR queue init failed!"); + goto free_tx; + } + dpaa_intf->debug_queues[DPAA_DEBUG_FQ_TX_ERROR].dpaa_intf = dpaa_intf; + ret = dpaa_def_queue_init(dpaa_intf->tx_conf_queues, + fman_intf->fqid_tx_confirm); + if (ret) { + DPAA_PMD_ERR("DPAA TX CONFIRM queue init failed!"); + goto free_tx; + } + dpaa_intf->tx_conf_queues->dpaa_intf = dpaa_intf; + } DPAA_PMD_DEBUG("All frame queues created"); @@ -2388,4 +2456,6 @@ static struct rte_dpaa_driver rte_dpaa_pmd = { }; RTE_PMD_REGISTER_DPAA(net_dpaa, rte_dpaa_pmd); +RTE_PMD_REGISTER_PARAM_STRING(net_dpaa, + DRIVER_IEEE1588 "="); RTE_LOG_REGISTER_DEFAULT(dpaa_logtype_pmd, NOTICE); diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index 261a5a3ca7..b427b29cb6 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2014-2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2017-2019 NXP + * Copyright 2017-2024 NXP * */ #ifndef __DPAA_ETHDEV_H__ @@ -112,6 +112,7 @@ #define FMC_FILE "/tmp/fmc.bin" extern struct rte_mempool *dpaa_tx_sg_pool; +extern int dpaa_ieee_1588; /* structure to free external and indirect * buffers. @@ -131,6 +132,7 @@ struct dpaa_if { struct qman_fq *rx_queues; struct qman_cgr *cgr_rx; struct qman_fq *tx_queues; + struct qman_fq *tx_conf_queues; struct qman_cgr *cgr_tx; struct qman_fq debug_queues[2]; uint16_t nb_rx_queues; diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index c2579d65ee..8593e20200 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -1082,6 +1082,9 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) uint32_t seqn, index, flags[DPAA_TX_BURST_SIZE] = {0}; struct dpaa_sw_buf_free buf_to_free[DPAA_MAX_SGS * DPAA_MAX_DEQUEUE_NUM_FRAMES]; uint32_t free_count = 0; + struct qman_fq *fq = q; + struct dpaa_if *dpaa_intf = fq->dpaa_intf; + struct qman_fq *fq_txconf = dpaa_intf->tx_conf_queues; if (unlikely(!DPAA_PER_LCORE_PORTAL)) { ret = rte_dpaa_portal_init((void *)0); @@ -1162,6 +1165,10 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) mbuf = temp_mbuf; realloc_mbuf = 0; } + + if (dpaa_ieee_1588) + fd_arr[loop].cmd |= DPAA_FD_CMD_FCO | qman_fq_fqid(fq_txconf); + indirect_buf: state = tx_on_dpaa_pool(mbuf, bp_info, &fd_arr[loop], @@ -1190,6 +1197,9 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) sent += frames_to_send; } + if (dpaa_ieee_1588) + dpaa_eth_tx_conf(fq_txconf); + DPAA_DP_LOG(DEBUG, "Transmitted %d buffers on queue: %p", sent, q); for (loop = 0; loop < free_count; loop++) { @@ -1200,6 +1210,45 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) return sent; } +void +dpaa_eth_tx_conf(void *q) +{ + struct qman_fq *fq = q; + struct qm_dqrr_entry *dq; + int num_tx_conf, ret, dq_num; + uint32_t vdqcr_flags = 0; + + if (unlikely(rte_dpaa_bpid_info == NULL && + rte_eal_process_type() == RTE_PROC_SECONDARY)) + rte_dpaa_bpid_info = fq->bp_array; + + if (unlikely(!DPAA_PER_LCORE_PORTAL)) { + ret = rte_dpaa_portal_init((void *)0); + if (ret) { + DPAA_PMD_ERR("Failure in affining portal"); + return; + } + } + + num_tx_conf = DPAA_MAX_DEQUEUE_NUM_FRAMES - 2; + + do { + dq_num = 0; + ret = qman_set_vdq(fq, num_tx_conf, vdqcr_flags); + if (ret) + return; + do { + dq = qman_dequeue(fq); + if (!dq) + continue; + dq_num++; + dpaa_display_frame_info(&dq->fd, fq->fqid, true); + qman_dqrr_consume(fq, dq); + dpaa_free_mbuf(&dq->fd); + } while (fq->flags & QMAN_FQ_STATE_VDQCR); + } while (dq_num == num_tx_conf); +} + uint16_t dpaa_eth_queue_tx_slow(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) { diff --git a/drivers/net/dpaa/dpaa_rxtx.h b/drivers/net/dpaa/dpaa_rxtx.h index b2d7c0f2a3..042602e087 100644 --- a/drivers/net/dpaa/dpaa_rxtx.h +++ b/drivers/net/dpaa/dpaa_rxtx.h @@ -281,6 +281,8 @@ uint16_t dpaa_eth_queue_tx_slow(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs); uint16_t dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs); +void dpaa_eth_tx_conf(void *q); + uint16_t dpaa_eth_tx_drop_all(void *q __rte_unused, struct rte_mbuf **bufs __rte_unused, uint16_t nb_bufs __rte_unused); -- 2.25.1