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 39D7745A67; Mon, 30 Sep 2024 12:30:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E4914064F; Mon, 30 Sep 2024 12:30:24 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2072.outbound.protection.outlook.com [40.107.20.72]) by mails.dpdk.org (Postfix) with ESMTP id 274BA402BE for ; Mon, 30 Sep 2024 12:30:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HsbZKXj8pna18RuwqnULFyHvGkeeGT2dntuOR0GgzVbyit7XXBVf3INYhDcZoFRV5t+w5Wx4omp9TSdD8EVGF6gu9eg277g1V5TID6TA9WYSds+BKOt1Ks9m7LSuu2qjkc6vUIfEHKh7h32HtDj5X3PAto7mQy7ZgzfRGi8/2QKFzvonVsb55Y46xI8qqIhZgtsXYNWTjN8e5cX0TNUBoQWC/zOh7facGtcDIo2YMwWh7A2j/2L+JnBT8WdrcVuw5sG/fbEfyzWzsIhlBt/NxByJIBevPx81Ft8hkLBslUO5Mrf1c0rykWKZ62CCypHpRNkJN7mFwqQkHUnqHsSkZw== 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=LScMdrjMiBUeUJzWdm/3WIxtfxkGzYH2iNgttEW5GO01Aqmobxorc4riRvAHj6gdWgdbQy3VLNaX7kn950HctwLXYnzHBBdLv5Ixie7ANLs7AE9PLysg5lrFNzuEKzTZV2MJl/lKHhWNev2ab8jk97wN4uEDSwqzs2h+ibyDIooUIUzS9jQhtQGZgbgPuteOrhITeYT3WOhEkHJSRnFsc/CxfSwrO+E61u4x0XTxRL/iTW5MqFD48cNj9bCym47+TIpmstDzvRfnBzbpVGrf9L2c+c7Uny9ah9bwxHfJSLn9+WdAxhfEncLf7m9lQu282IFi7p/tJ/XHAL0SODsGHA== 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=QfD7GK7VBheWy8DFwZyK0BnsJeTXoMzcortsCGbuRjdpCw5Q4OlWFF+ih1fcMeqKVuJFLnjQE6L0bILZ+3SX3lwuXOSvaKW+coxRXvbkBrftSieOOTDXXvbr2yQEiqiFd0s9RG+vutpnKwEk2NA/IGyr8wHuIuuxyE5SbY7WIW3OoIu65BD4+HeuTWln1lGlT9XyJ17/zgXDIbW1U3i+rKzoDACy2nfhcMRgp5jHzznsFNScbKML/FXflFQ6/Qzoc2GsYNx3SRnmdAMJfunccLNmqGGQtLMZAmkHDGM5wLyG4Smx2m/+B2fedljxI159OByb5/lfrW38Gl87bBGkKA== 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 VI0PR04MB10161.eurprd04.prod.outlook.com (2603:10a6:800:242::6) 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 10:30:11 +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 10:30:11 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Vanshika Shukla Subject: [PATCH v3 06/18] net/dpaa: support Tx confirmation to enable PTP Date: Mon, 30 Sep 2024 15:59:34 +0530 Message-Id: <20240930102946.3236998-7-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240930102946.3236998-1-hemant.agrawal@nxp.com> References: <20240823073240.3708320-1-hemant.agrawal@nxp.com> <20240930102946.3236998-1-hemant.agrawal@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2P153CA0027.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::14) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|VI0PR04MB10161:EE_ X-MS-Office365-Filtering-Correlation-Id: aa1c5834-f53c-49c9-aec0-08dce13add00 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?grXHIxj9e+ZJFDsQ0oqKxJOauxTcgZ63k9aSqXdjBiLHct5+PRxUqujbDalc?= =?us-ascii?Q?tp6ZMwp2w6p9gNsf+esQbtst68ssgxl22NuBFOU+d2s0ympZNoczXUm8eUJZ?= =?us-ascii?Q?79jY+OOgA6qJlnzYaf++kqA/Kqk44hikx9Q4sKekoK/UFSd5xS6JvY/NRvwr?= =?us-ascii?Q?EBX/sQSdru3mx6sfw9QUKj+0Pd3qEffiPS0V1UkS+x27mHNvX4m/TNs5UOzg?= =?us-ascii?Q?0uDVtWEFNM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4CCXtoLB0MvNeNglQnA+iGa3h?= =?us-ascii?Q?tInuhB8fDtdqkLEMOhxDzzpYAuTj2bYvkivxnPS5Qlt8zfeoCMerG8Jkntjg?= =?us-ascii?Q?R0xH+cpHmAX0Pg9RHtRM7v4czu5v1fmVUSIsHi7JTOvjXpEByOoIcTxJo/DC?= =?us-ascii?Q?dxfH8UBKQm10d8XjCnGyspIkeTt3huhRGTS7RXDXeLIBc42MPT9S/F1/QRX1?= =?us-ascii?Q?AKyDLWrqXXiHfFw3oDrSRG8dt6ryMmp0jdeLgkn2IpNGHg=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)(52116014)(376014)(366016)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ozyBjf97dlPsSqDu3vWUTYivNQC1qwng1uxefYnv/Wt1sVhoxAdw3TBdoWp1?= =?us-ascii?Q?Emgxw/uqzXvkc9ia7S3ZhSZWd0/G49A0WFP745vRIc4AfysFl3k1Sem9AMDn?= =?us-ascii?Q?WdRSyjdfXkyVtivqYw2vvCRTBtGhojUwotOkupdLY1HAo2WXfBZKFxvPtgCT?= =?us-ascii?Q?8j0QWYogvuwHtUz1uW1JZd1oMn++2cIfZ3ZHdggPTjJIpXD5PAio4w1GLw7Q?= =?us-ascii?Q?/fxl8kdzLdmDhk0anUXrKPbguEAFWEIeBn69ut2Ox8zYIzCfEZ+AjtPYS8Xf?= =?us-ascii?Q?EyXrsdD10XNUtO4Yut0DfXyJpuLlhyGe9hhGCIzvUT/2mH93QLt7MQqjGXh6?= =?us-ascii?Q?ZkVRpBj4uDrrUJSPw6VIGYr6lPES+1QtbFa5ydK04ul8Yncr907b/PLV2zMH?= =?us-ascii?Q?tX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ttriyl9L2tmtau7n4EQC?= =?us-ascii?Q?mLpucL8DSonurL0vHxnjfLqaaeG0tbp1VfJqZ2TWn9TmuoM+uVwTl37UQCqn?= =?us-ascii?Q?kmtgsDcLoX+ElBpZa2VsIkqRuwPoN4nDu87gVzAHI8H4rv3ocFwFS6jehlnN?= =?us-ascii?Q?52uBylQ64qTWxMoGi1xj1+CQVg4UinLj/367OXJc8KRg0tXDc7QMQ4pTKjXa?= =?us-ascii?Q?I/EQmLQ37Z4inFhPGRMQIU0vwJg0rzZ1PnjCOUZouhY2yHqD1wSGVqjZ8ei/?= =?us-ascii?Q?MPbNKKzypiTJ6lYcrEwILjo8wv3MrUIC2N6fI3BobH69XAYjI0fhnHYsorya?= =?us-ascii?Q?sQ=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa1c5834-f53c-49c9-aec0-08dce13add00 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2024 10:30:11.4955 (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: eYHQNrGXPKxZP2TMk13XJyJV+uz9HnbMNrImd7ZaL0w8GavFwUF2M7P0Rq7cTma5+iRMslP1pEtobcJuu9xHMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10161 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