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 76DC245843; Fri, 23 Aug 2024 09:33:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E046443248; Fri, 23 Aug 2024 09:33:15 +0200 (CEST) Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010060.outbound.protection.outlook.com [52.101.69.60]) by mails.dpdk.org (Postfix) with ESMTP id 3A98643005 for ; Fri, 23 Aug 2024 09:33:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yAZFB9XLi5LlS8bCWg9OD5HjlgxJzgLY2Z7kfbaR93kfcSeH67Ma2yG0Cs3ED3cd2/N28exYopRU7IYWnsCzc0OUBJO+zcVnZTUbLAIs9zYxnw+MTQxiGK1y+l57guwCqWPqB7XBaSIAfYNFmOh0ax1BfCxbWL/U5LAoULXSeTqzFJ+of71T50NbI6shML1F1bPRbZ8ks8cmK7vUnrygooJ/ORUShbGIR9QzCDbykHnvZA6bqLR/vjDEwuMv7gIEwV20aix727//BoXT8VKxtVVIPMF3bLB2ekWljRRc0+I+vdIX6Sz0es4uYZIRlC4hRVfdX3ksy8PYj8tFdpHN2A== 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=quwFNV0Zb8LFw/wBGOZ+q1yE2D4E+zMZ3jSuCjjSKIRWqMXfiiacSB8a4avzsQnsTQDuiHxhLDVak4pJMzVOGrRauxoObpE53EuhL7Bi5yzM8+I1KKqvowj2ZMvhaW+dZogddl7a1k3Yj7qjlf6XP41W1AriijMx4jMB1xfvmN6hYmxGYEBqErm2V0wLe2ETLoXU8oPjo2fExwJOOixmd5X8otCRbMPId32B2EjPBWf8FHySX0EV+U+0s/wZSDm10g/IIW2+Kq6BzjXO5by2siiWSgI4OEiZtK9idnoRK3g5RBwfnUCzBsX/wWlNfK/vSKkB4DUOyFW/7HB9a4ULQw== 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=f0qNMCQopclxIaJB/RR5mws9c2Gr5IWBmTZpVQQoieQ7L5LHYb/YItqRmEehZFK1xyLXNg7kbM2muI1MUFVQF/5RDQZhpHskKevpOy1zkXLbwouzpd8yKnNfVdkOjXASlCYAIenEbDmYAUcJg+sYUdYDGTWETBIAZGlU2CsqOAYM43uzeVlxnXO9kq5QXWDJvTmuIPhZhw9CvRVCwF8mB37MBGw7/uaRGo0wpqJxf1P2JtUzjbXfWsw01z0CCVhan+JvaLlth8xAc1o+O3azZDeDoo5J2wON5WLFcpyOe4ZhnnmVmgKunfLxTXMz91n/ayQQUOrkAqEeDroMAx09Ng== 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 DU2PR04MB8789.eurprd04.prod.outlook.com (2603:10a6:10:2e0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.18; Fri, 23 Aug 2024 07:33:07 +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.7875.019; Fri, 23 Aug 2024 07:33:07 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Vanshika Shukla Subject: [PATCH v2 06/18] net/dpaa: support Tx confirmation to enable PTP Date: Fri, 23 Aug 2024 13:02:28 +0530 Message-Id: <20240823073240.3708320-7-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823073240.3708320-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> <20240823073240.3708320-1-hemant.agrawal@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR02CA0028.apcprd02.prod.outlook.com (2603:1096:3:18::16) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|DU2PR04MB8789:EE_ X-MS-Office365-Filtering-Correlation-Id: 95d647d6-5ba9-4cc7-f1a7-08dcc345d4b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Lb76fiZuXgRMO8XqNe1vEr4owgMPCSZZcHx76Z2ROebABmm/uMmGe1SNtzdL?= =?us-ascii?Q?Q94/Q1I3Yx5ckeegxid+STHdnjl/98v2CyTemnbt+z6PU+hZn48XkXR1PViz?= =?us-ascii?Q?NWWBxs4yPHrEUH1JOtv44EWU+xiIXSkFXlu3RyO83eBkKFRJSWTMLvsdvWwI?= =?us-ascii?Q?roRcvbFn9DFvgIVd1NOpj088lSW/971DGB2EHZ3kq8ZDjlBA2GAgag/eKQik?= =?us-ascii?Q?/go2xIQVHoHNe6LY8nGB0qIL68vcRtf0GGFnyB2Iz6YKtELYOe9CAcRv8cZy?= =?us-ascii?Q?KDrezAkS1HyAatuuYiuKiux+FJUXCEP67cPIQ4e1AswDk8PTqujRhP+6T428?= =?us-ascii?Q?Re56zXflS+q6z3Wc57qcj2cT0exggoazPkEDRqHNar7iZ1hVK5YrXokuTZcS?= =?us-ascii?Q?MgxYzrI09ux76pIAzFmZyNW0ei0ld7ZwxwqypgjyjjQ0C9gUdewgCfJMBhx0?= =?us-ascii?Q?Gupdzx68Pbr90KNHXoQ817fXMuY1RaTIlxJTlqk2ltpYcczGqU2CbZ9+zwl2?= =?us-ascii?Q?ddMXkuN2GWUsse2203+woWpMm5Kt1O7oX6KP4hxDdHCTuN0OQq7ozkQgTZYL?= =?us-ascii?Q?CwwATfcUpatPH+w3WPNfa+zExgjhMxnywl57283yAYAHi8v+Q9MmL5iRFcPq?= =?us-ascii?Q?lx5WEpVBtFULH/T5+klDzaS04U0sdHQEbGNcXnqVox0ZRWwakqATMJJ9iFoP?= =?us-ascii?Q?qIi6oIMrV0nNecsLHRvZ60AByEv67xQDAep8zacuhyKROCUt4U2W++SQiFLk?= =?us-ascii?Q?rfDzl5Ce8YwxpmqjUYKbtDRYGl/qCaVphe1zLptD1UflXoga5mvy94LPO/T5?= =?us-ascii?Q?hswLxhKtedu34m+wuyQaJBU+i3IXd7fJjCgNsd3oXreLyYsb1WruxugWDBYf?= =?us-ascii?Q?b3vL3LKz90kkcQnvxhBryH2eQGwW2Q/wCMlYxCFBliESBqylvmDRW8SZEswt?= =?us-ascii?Q?OI/DC2yx2tERmK8MGgLPxan+VL1LVRRUfj2oyKyk4ht5PA87Zvy7W+0ee8p/?= =?us-ascii?Q?hu5CZEfDZdvp+gDQHHSr+4jXeNZGtDtZujDzCx4JZUtW1JZMW+29WVybFU0a?= =?us-ascii?Q?AGrvf1KeeWLOGB631ezWo+326aH3DTETBx5a8y+/5YhDX8xRyDURWJs/WQ5i?= =?us-ascii?Q?erARTFWm/YM/DUh+TANHg0TT/UO2eB1JbBzD3AmxBj8xuTvmJTKGrS30s+Fv?= =?us-ascii?Q?hZM6NSovDHe94mWBxh76hZZvPewrqXnDp94otDl28BlmDEHCsfOjaPmsO7yY?= =?us-ascii?Q?wig9dgXphe5sGbCixjqrAobOp0ZFPELsRAfqbZtUk+eEAxzuz9LYHEV9sZFM?= =?us-ascii?Q?zS6yQhek6lQSJWmSQP+Wyx/5HUaxqCtwYmIr6Kynv2HQP5ghcgb/3UIMVIjy?= =?us-ascii?Q?erXsw2BbbUS7V1L6VGHO7poPlnywXokY3Eiojw5gmTIUoZ/BhA=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)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?XZZ20BFR0BDBYpLlXkR9bVAyvT2zNATbh3dy7VoL4/4ByR2gBW8vKw0lAW8G?= =?us-ascii?Q?jOJEAbDOjcMci4nomQ+9nsTV/n7beTAB2D/n0xVY597mpcInw7NtT/hJ8aa7?= =?us-ascii?Q?VDO8vukH+k1ZAfSw1fcUTefl1UmIhYMWDy1uZoS/eccwhb07aJRbOFrhL3ND?= =?us-ascii?Q?pLW08fSEIbd/m+EW2AbRyEOhEC1WKP4Z0q/HogUGZYB7Stdyxu9FoqY6dZhi?= =?us-ascii?Q?GMFofirXVttV1S7pJyEZy6Rn+RjyQ42RDPlotwpEBlqUkwKu49x4AlOB+gdl?= =?us-ascii?Q?5l0LZjW8earZlDcIgUtakv6xpdhB0JCiNA/jqr87KizsbWZD2+lx32FXdIh2?= =?us-ascii?Q?QmUf8cXg89Vo2dL22k7RGuh3arqyZp5xr4TNTjtFYIqpcZaZVZ6FmWiBUKFt?= =?us-ascii?Q?wmMyDsav2YQHRR64PVPaB2ufQ1pDAacrssY/0p+sPZlquE245dKIzkfjBdBD?= =?us-ascii?Q?D+nK34zAV5byE3yGaHGUemL8Tlg8j1HdcJhEneP7FelUXtGvtRlCZN558NUD?= =?us-ascii?Q?uqvvq5HLQ18m4jyfJfXxwY6rBNd+9LfKu5ZXTWXXw/8ygf1UJ0mYkKOTwEbA?= =?us-ascii?Q?vRaQOF3dhisNlZJRFbdPxw1YECyWZJ+XM3EZwEu7gwXdMXN19hik28o+Hk8r?= =?us-ascii?Q?P9MrY50vo5ojmuMDMBTafzkO6yjwY1ivTs868VlLMbj4q7z1dEai8N1Yq3J+?= =?us-ascii?Q?rTiff6i5m0ozV4i1v6NUi17TdHkmNhDB/nU1yIjZ68KpNkrHXeP7MBPJVFyN?= =?us-ascii?Q?mLOXE3RQTTPgVux0qIge3ZbMm52TqGKQBqV1xyFAaIZm3ReLjXuLXMISFvN+?= =?us-ascii?Q?dcPn4ACGw3xfhAatotH0VJ0/0iDKifaaUuUGpUA+hlBiGLUI3/2+vprRF0GY?= =?us-ascii?Q?E0qXIZ6HwkYOByQJVAi2/kn1R8fQot9MkoS2v/BRNaW7hX+z03rkFgmtOOj5?= =?us-ascii?Q?KQNFARS/L72rV9xasjNn4rO5bVRarF5Pxxy4DRUq38lxPCp9FO4R5+NhVXDp?= =?us-ascii?Q?Arn4/rVrd5W01SZQ8200Z/sXRn74I3iOxQMrQmkMK3AlZhI3V4w6trE5PSp0?= =?us-ascii?Q?8RZFIeFr5suwlQLaZmw8Hgf7SLizuuZof1SZNn+YZsdyLSYNEzuUEgwAbxHh?= =?us-ascii?Q?I/MQYjCvJ1rqhLMotIJp9ht3ziaWhp+WWddfRUuLQ1awWL3D+AREKciTrabu?= =?us-ascii?Q?IiLCww/GLc7hafsbW0FSOFwDS1+RxUImtX8MJBg/2Z527wjUTDQLvP30+GDc?= =?us-ascii?Q?kdZTetifc9BK98nDI87eUmOx99C4dDBC9ZtQx0OL4sCO2CoMhGuPui0Hk7id?= =?us-ascii?Q?nj6MNckRMBfiAgVlQK4ZT2VVx9D6ErQIcwNwtSDuoLurymi/N+G7KMNxzQQi?= =?us-ascii?Q?/nbJy6NH63qezQzT43AcfcmtQ/ekCUU0sA+cwoHg9CnWya5F/b1aW4SSMp5t?= =?us-ascii?Q?lisvaPWZQwyuPKjCyA3UAOaC0CkndCKIZlWB9lCh46UdmoshNympL11k9IjQ?= =?us-ascii?Q?hkjiJyaGFDqUwp5o4Trt4Jeoz0tS9oP9SoLL2D0SAMyBARfvyHLVmCwVOxdo?= =?us-ascii?Q?yqD0tJ77HQf2n4Atu45ISJnziTtngBjgIaaADLWcIoQpI3B3xm57kfTy7VXC?= =?us-ascii?Q?wg=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95d647d6-5ba9-4cc7-f1a7-08dcc345d4b0 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 07:33:07.1055 (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: Yd4M6YcoSQgaM2XBFb48TkXdSxld/z8rZSPxnDjaa8ovMeuM0fp1E4y3SAMLqS1rhd2NdIkjm8hycPZyN8Er7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8789 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