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 868FD45A68; Mon, 30 Sep 2024 14:18:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 13EA4406BC; Mon, 30 Sep 2024 14:16:36 +0200 (CEST) Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011001.outbound.protection.outlook.com [52.101.70.1]) by mails.dpdk.org (Postfix) with ESMTP id D764E40A6D for ; Mon, 30 Sep 2024 14:16:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sbkORhs88y2w0n6I+Zo1V2ViIwaDfltuLcnH99Vw1VZq8TYqniu+GGsgf0xlQfOk1iDSJa0aQfddjnaFNjhM9EhtWyKdWP1LfTkkFd92Jq3DxojIRnZoH3ZXETrg6MXtqb5PNeYqrnz2MlvkuEUcpY6+V0/vYhDLKRmGzZNKSBj9e38BBntIqa1uLTvkzsuT2O4eDB9IvuyGIycbjnoq4bmbMJSJ5/t3JJDNoPcouwrYLKeJtyDsWQVhxV/BkwcC45e39EgAfFHMvpd83gF6lXbjgHzGv9Mebs/N5hOqbD+pTzE+7B3U04SZCFbAc8w4/Gsxs7cViI+R9zszdoOZmg== 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=F+xPkfE9uKDFaw/sPEcVl2U6PsMndfeXrxB1MJxKCno=; b=Xo4rK5qzcpaHDHFYgcZRjaSgFzy0faBbLriap7IXDuJOMbPgaQclT4MhYmmxx1BwP3BLC5sOck+CeWKsKS3xCrZbsJ7/dKjHpgMmnIjYlah1VKCOZvjRN2KbfBfm4KijnEW6rXV5ToWXlYajtEXeWuTDomsL9g3Qu5JFlYYYEC26nvrAxnP+wmuDklEPloDXDuAfJLtZekL7SyQu4GI2D4LZZcYMg1TUPy9CyoNGcd30w5KuzvaYLsadNal989oABDYDktK5K8o/3wZpiLvMrfoNX20qv1bvn+9i6KwnXC0p5VLRK1Au/6BNrpYs7okOlVyWeTYhTy6QBUy77+t7nQ== 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=F+xPkfE9uKDFaw/sPEcVl2U6PsMndfeXrxB1MJxKCno=; b=cuK2puksXcSmy23PmJwbQ//TBB0h9Bl3eI2Fj/HM6A9OugTZ2snrSB1kPkKujbff0IdqXehNm76wPct3mQ8aHc4mE7FUeZl4p9r1jNbG8FmCM06fJMPDamhHZEmuurVnZYH82c5tWb+42f9c58mkzq1/ISuS/oT4k9xtjRrHu08Zv4cmCuWnStcrzNHdQmHGf3AI7YK6ZJLQ/KBlhGi161hpovnT6vaHi0Z0Bol8yv4yL5oEk4fhDjzpvb3Tpy5EIHaPeSzRDDAHSvGsosIKTdxOQH2AdT1jQ7m/9J6f2YpPcWadLxVBhTTqQI1HV5Ht5CdVKFn1wi4W4vXTTl/i9A== 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 GV1PR04MB10583.eurprd04.prod.outlook.com (2603:10a6:150:203::7) 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:27 +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:27 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Rohit Raj Subject: [PATCH v4 14/18] bus/dpaa: add OH port mode for dpaa eth Date: Mon, 30 Sep 2024 17:45:21 +0530 Message-Id: <20240930121525.3452847-15-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_|GV1PR04MB10583:EE_ X-MS-Office365-Filtering-Correlation-Id: 72b153a6-13ec-4f50-7ede-08dce149b556 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?/QTIlO+JzTXxYAHQiDsa04gxCcriB2KVl2NkKpJle4LL8SvXqNbYCwbtHdSk?= =?us-ascii?Q?Nqkb8wphv98MYJn7pz8rwBfTclSN/BdUwIJEOxCRGbbBsPXgownC1JtX3JiH?= =?us-ascii?Q?Louy60Hiz4hx1mN4YfYwKai1mBp8ptobWHKHG39lZH5javdsNeT6v+kaulKq?= =?us-ascii?Q?wqvPjZtS8UqboCGD86YDPuqRVpXMMz30FsuR69pifyA0YRFDoHr3ly+hj9BG?= =?us-ascii?Q?J9PTYkMueflnP6/1kFOhxEMFFY11aV714n3D6ROALyOvJTI8C3b1aUt/Ynir?= =?us-ascii?Q?Sa4mZJBBjbyEabvyKoHKymv8xrmVxEtO7rcp3GnIF4dSjZYizCCBDOGrpSgz?= =?us-ascii?Q?uxOkKdqpbspsFqMTCT70m79PruFma7o96Tl5mVsawQ1ty+RYkBVQf11kM14O?= =?us-ascii?Q?Qcouw+onFtP8qqbeZVh2IOc1CsXvHUsrStJgFTfbnQ/+4UEZaekaq4atrpwW?= =?us-ascii?Q?RXxzy+RaYppn3ickUk2pq9yHEoxXsLZQS3JFanHlqollNSbUKotAA1xE2EbJ?= =?us-ascii?Q?9WwRxIGQCryamnghqf0cvTlVhriXjSvusZ1oB2/cd7XnojgidU2sjntXhhmu?= =?us-ascii?Q?cDyR4AgBggGbVJMRxS8O78SBWVDc0fuK7zo/TN7V3qvAdSxYOYjkvix5Q8/Z?= =?us-ascii?Q?pCLmfSjDj6EFcDouM5CMJDqRASiNsAexYgPKIUE0XFYE61za757N3YaLCE1a?= =?us-ascii?Q?/STyMsAxEpEdKs50UipNc44rUszlYQISSOJ5tFdMWEq0tfTVxLgaPSpA74f3?= =?us-ascii?Q?p22ejcpOBXL4HaAObEbO+FKPL0S1WOCg7j6Xg/AcJU/Dg4xWUky7qNKQakvV?= =?us-ascii?Q?fueotqWoQpU43+Z4Ggmlk+qgiCCiCxPmr7BrFe1TSbV4i99V+tYTI4xW+f+6?= =?us-ascii?Q?M0ogGrk4ehewSAyEMsttn1sVoD6jPTjrYaEJv2x/i3b5CiC/uzmj3X72nebo?= =?us-ascii?Q?OwOaZghISt0hd+W/NT48oNm9QNAukGJ6BCjw6fiiT7gnRtja2sdfAH3J1mCp?= =?us-ascii?Q?GbHEhqt1Ki+6bhKVM18lOkfGY+OeKJn2Bnkti/SxBSYER9tXwdWZQqMfQc/w?= =?us-ascii?Q?n6lejpIXHpboGfziE0rCkjb7mqCRqPZebiB8yPlP3z21CxECmDcs4FUduNSw?= =?us-ascii?Q?Enig2XpewsqZinIDzj3ueMe2bYNymYpRl0PySI2SGOn3gzIrpBorQSoeDe5G?= =?us-ascii?Q?T0bLRygmGl8G8RMrTfjwG9VFP/+PY5yG2ziVm1Orzv4EIs21Eh0OvHVt+jqC?= =?us-ascii?Q?JDH8godhaL72TQ9GOoilA+d0GXZ+F64dLgaS3/jA7w9dxffuVYRgH8iEWE6Q?= =?us-ascii?Q?NAQ=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)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?T3JcLvghiIdsilFEL7mYiiVp9OAQ7xc3sJJ8MeAeUJvtoFWqcfyi/hkn0hxd?= =?us-ascii?Q?lzP60S6XLObOxkx1SnHHua8/WScJ3o9KOdB9EcElDNQ/TtvrDGfexjMlDMJ3?= =?us-ascii?Q?eijVLB3UErX/1knagu+4Wa+9eSNdlDdYmxK2E+pgrrOGq7BXJx0e3pYJbBkH?= =?us-ascii?Q?xm49VsZBLMcaJzfZ7LkjHUj1TEjffpIkkf82Id6b2079o/vmiu5oLrJuguRf?= =?us-ascii?Q?ODb0CboZaWHD5mx3bdrw/XlcxvsA+vIjTTopcaRwQkqqEL9LERbfBlG8kj3U?= =?us-ascii?Q?y8w6ihdxvrK7Am6VdyPZFQ/HfLgpFOzDpdVbSNRsQGibUzT7eNYvkiP+aZCo?= =?us-ascii?Q?AJ+U5A5JIPBrvuu1HCuPztqBE5vd9V9h+jyzoBRtPffEpDbLGm5cZr4aG1wN?= =?us-ascii?Q?YMqgTkXNIYudds58EoqULK05DJ8ppcjQyLzhIJwL8TC5hn+8Ekn3m/AhwPjl?= =?us-ascii?Q?tI410MANScfBKDd3bwPY3EkhnzrpDake8D9OIuG4V0sh43bPKhS6By/l/4sD?= =?us-ascii?Q?8NsXCT/Je9XThATh692rw6oMcg4UZAUHwzu+gX8sp8g6wvdoE8bNuAMPwjj1?= =?us-ascii?Q?aysCq2AOT4CJjAyVl/vNaWDbjPYW1vt0sOR/WEGQGpDTdfmxqN9zEeBGjMr7?= =?us-ascii?Q?66F1ZcjpFFwpR5s80YP/hmJ4KQAXKE6vnF4uPbv6CmvtwB+xjLkbzGpp0cD/?= =?us-ascii?Q?9Erdla536ntpc+dBr/UEI/sc4OtB9lFgQazG/9g97/HqAsEPQOK5umDQwdzX?= =?us-ascii?Q?0WQ28PPXg2ub8IQw4eYi8qx2VqE5p/NbzLWICSv5iSYTxNAkkr091nsepa8x?= =?us-ascii?Q?oCD7eSynrKmQCB44QZFUOqlIJyu9G+90hKx72GAaArlOqKGRJSkv1lBV6lmp?= =?us-ascii?Q?ykhcZKECGmNgZ2HGhmpl+Ln5HjVJ0KiipqRhYvCCD8/WKiISy2MugwXWzR0k?= =?us-ascii?Q?A2enff7gUvQXSGic4sHa90OTnF0m57UuxctKiN8r8YZC6YUvKsU+lDxQGU1Q?= =?us-ascii?Q?eKTuMIoCAjeiik8KR8ncuf/ESzttERCFfnqB9j7Z4X9foJUTcHNNuNA7uxhY?= =?us-ascii?Q?cT+gdJpPCHIGnRYtE/6EETFamhTDRBtIv50NtnkMPBqu5AxdlkDr6i0HeBih?= =?us-ascii?Q?a9ps73Ii5k/pJPetVIAT9MhncHYjgtYzZzJ8x1LTJ7AQ+DaysCXmbCL93yrt?= =?us-ascii?Q?X8XwJM/eyUKN/Nn1kQjyGnqtBfwv+WZe4fHfqtR/W/WfIiLdlv/vASFUXi9g?= =?us-ascii?Q?zIzXTY7aj75ZeeIWl/2sdxcrciAvMmB3fSBbQQF2Gy44N8crFVWsqvLpc83M?= =?us-ascii?Q?APNZ2bbKon6nYwtP+66G1JeWCozqzoBTr6claZ1utnqz4dNEH9kSlES68JoY?= =?us-ascii?Q?1eAfmHC+z5JnHP8iN0Ccx9/CVnGdeikkyRB/VFVrgOZh/MIZZaKilEqYtigC?= =?us-ascii?Q?f0SPnpkUzA5LACEqzw7mNeOSvgNFa7tLst2++rlviEZcTdmChCLMd0T2YnOh?= =?us-ascii?Q?zXFhgwPWLuPUbn6fUJ9fRW1XKI92PIWX4fgcXk+Rf3aqax+k1AlvLddKgeBW?= =?us-ascii?Q?Qmx4sQKmsCw1l6g3pHLsUGYacyTowEk6hnWkeibk4hX3tnJLeQkD/MKzCr7f?= =?us-ascii?Q?jw=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72b153a6-13ec-4f50-7ede-08dce149b556 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:27.4862 (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: MtKTEEFLjc0eVEGQHM2Jo3onLRNjRG5MJzLHAOQPm0S3TVRJH1oog7fP6UbO294iWpRomM8Q+jZ1XCCg2WUeLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10583 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: Rohit Raj NXP DPAA architecture supports the concept of DPAA port as Offline Port - meaning - not connected to an actual MAC. This is an hardware assited IPC mechanism for communiting between two applications. Offline(O/H) port is a type of hardware port which is able to dequeue and enqueue from/to a QMan queue. The FMan applies a Parse Classify Distribute (PCD) flow and (if configured to do so) enqueues the frame back in a QMan queue. The FMan is able to copy the frame into new buffers and enqueue back to the QMan. This means these ports can be used to send and receive packet between two applications. An O/H port Have two queues. One to receive and one to send the packets. It will loopback all the packets on Tx queue which are received on Rx queue. This property is completely driven by the device-tree. During the DPAA bus scan, based on the platform device properties as in device-tree, the port can be classified as OH port. This patch add support in the driver to use dpaa eth port in OH mode as well with DPDK applications. Signed-off-by: Rohit Raj --- doc/guides/nics/dpaa.rst | 26 ++- drivers/bus/dpaa/base/fman/fman.c | 259 ++++++++++++++-------- drivers/bus/dpaa/base/fman/fman_hw.c | 24 +- drivers/bus/dpaa/base/fman/netcfg_layer.c | 19 +- drivers/bus/dpaa/dpaa_bus.c | 23 +- drivers/bus/dpaa/include/fman.h | 31 ++- drivers/net/dpaa/dpaa_ethdev.c | 85 ++++++- drivers/net/dpaa/dpaa_ethdev.h | 6 + drivers/net/dpaa/dpaa_flow.c | 51 +++-- 9 files changed, 378 insertions(+), 146 deletions(-) diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst index edf7a7e350..47dcce334c 100644 --- a/doc/guides/nics/dpaa.rst +++ b/doc/guides/nics/dpaa.rst @@ -1,5 +1,5 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright 2017,2020 NXP + Copyright 2017,2020-2024 NXP DPAA Poll Mode Driver @@ -136,6 +136,8 @@ RTE framework and DPAA internal components/drivers. The Ethernet driver is bound to a FMAN port and implements the interfaces needed to connect the DPAA network interface to the network stack. Each FMAN Port corresponds to a DPDK network interface. +- PMD also support OH mode, where the port works as a HW assisted + virtual port without actually connecting to a Physical MAC. Features @@ -149,6 +151,8 @@ Features - Checksum offload - Promiscuous mode - IEEE1588 PTP + - OH Port for inter application communication + DPAA Mempool Driver ~~~~~~~~~~~~~~~~~~~ @@ -326,6 +330,26 @@ FMLIB `Kernel FMD Driver `_. +OH Port +~~~~~~~ + Offline(O/H) port is a type of hardware port which is able to dequeue and + enqueue from/to a QMan queue. The FMan applies a Parse Classify Distribute (PCD) + flow and (if configured to do so) enqueues the frame back in a QMan queue. + + The FMan is able to copy the frame into new buffers and enqueue back to the + QMan. This means these ports can be used to send and receive packets between two + applications as well. + + An O/H port have two queues. One to receive and one to send the packets. It will + loopback all the packets on Tx queue which are received on Rx queue. + + + -------- Tx Packets --------- + | App | - - - - - - - - - > | O/H | + | | < - - - - - - - - - | Port | + -------- Rx Packets --------- + + VSP (Virtual Storage Profile) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The storage profiled are means to provide virtualized interface. A ranges of diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index e2b7120237..f817305ab7 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -246,26 +246,34 @@ fman_if_init(const struct device_node *dpa_node) uint64_t port_cell_idx_val = 0; uint64_t ext_args_cell_idx_val = 0; - const struct device_node *mac_node = NULL, *tx_node, *ext_args_node; - const struct device_node *pool_node, *fman_node, *rx_node; + const struct device_node *mac_node = NULL, *ext_args_node; + const struct device_node *pool_node, *fman_node; + const struct device_node *rx_node = NULL, *tx_node = NULL; + const struct device_node *oh_node = NULL; const uint32_t *regs_addr = NULL; const char *mname, *fname; const char *dname = dpa_node->full_name; size_t lenp; - int _errno, is_shared = 0; + int _errno, is_shared = 0, is_offline = 0; const char *char_prop; uint32_t na; if (of_device_is_available(dpa_node) == false) return 0; - if (!of_device_is_compatible(dpa_node, "fsl,dpa-ethernet-init") && - !of_device_is_compatible(dpa_node, "fsl,dpa-ethernet")) { + if (of_device_is_compatible(dpa_node, "fsl,dpa-oh")) + is_offline = 1; + + if (!of_device_is_compatible(dpa_node, "fsl,dpa-oh") && + !of_device_is_compatible(dpa_node, "fsl,dpa-ethernet-init") && + !of_device_is_compatible(dpa_node, "fsl,dpa-ethernet")) { return 0; } - rprop = "fsl,qman-frame-queues-rx"; - mprop = "fsl,fman-mac"; + rprop = is_offline ? "fsl,qman-frame-queues-oh" : + "fsl,qman-frame-queues-rx"; + mprop = is_offline ? "fsl,fman-oh-port" : + "fsl,fman-mac"; /* Obtain the MAC node used by this interface except macless */ mac_phandle = of_get_property(dpa_node, mprop, &lenp); @@ -281,27 +289,43 @@ fman_if_init(const struct device_node *dpa_node) } mname = mac_node->full_name; - /* Extract the Rx and Tx ports */ - ports_phandle = of_get_property(mac_node, "fsl,port-handles", - &lenp); - if (!ports_phandle) - ports_phandle = of_get_property(mac_node, "fsl,fman-ports", + if (!is_offline) { + /* Extract the Rx and Tx ports */ + ports_phandle = of_get_property(mac_node, "fsl,port-handles", &lenp); - if (!ports_phandle) { - FMAN_ERR(-EINVAL, "%s: no fsl,port-handles", - mname); - return -EINVAL; - } - assert(lenp == (2 * sizeof(phandle))); - rx_node = of_find_node_by_phandle(ports_phandle[0]); - if (!rx_node) { - FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[0]", mname); - return -ENXIO; - } - tx_node = of_find_node_by_phandle(ports_phandle[1]); - if (!tx_node) { - FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[1]", mname); - return -ENXIO; + if (!ports_phandle) + ports_phandle = of_get_property(mac_node, "fsl,fman-ports", + &lenp); + if (!ports_phandle) { + FMAN_ERR(-EINVAL, "%s: no fsl,port-handles", + mname); + return -EINVAL; + } + assert(lenp == (2 * sizeof(phandle))); + rx_node = of_find_node_by_phandle(ports_phandle[0]); + if (!rx_node) { + FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[0]", mname); + return -ENXIO; + } + tx_node = of_find_node_by_phandle(ports_phandle[1]); + if (!tx_node) { + FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[1]", mname); + return -ENXIO; + } + } else { + /* Extract the OH ports */ + ports_phandle = of_get_property(dpa_node, "fsl,fman-oh-port", + &lenp); + if (!ports_phandle) { + FMAN_ERR(-EINVAL, "%s: no fsl,fman-oh-port", dname); + return -EINVAL; + } + assert(lenp == (sizeof(phandle))); + oh_node = of_find_node_by_phandle(ports_phandle[0]); + if (!oh_node) { + FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[0]", mname); + return -ENXIO; + } } /* Check if the port is shared interface */ @@ -430,17 +454,19 @@ fman_if_init(const struct device_node *dpa_node) * Set A2V, OVOM, EBD bits in contextA to allow external * buffer deallocation by fman. */ - fman_dealloc_bufs_mask_hi = FMAN_V3_CONTEXTA_EN_A2V | - FMAN_V3_CONTEXTA_EN_OVOM; - fman_dealloc_bufs_mask_lo = FMAN_V3_CONTEXTA_EN_EBD; + fman_dealloc_bufs_mask_hi = DPAA_FQD_CTX_A_A2_FIELD_VALID | + DPAA_FQD_CTX_A_OVERRIDE_OMB; + fman_dealloc_bufs_mask_lo = DPAA_FQD_CTX_A2_EBD_BIT; } else { fman_dealloc_bufs_mask_hi = 0; fman_dealloc_bufs_mask_lo = 0; } - /* Is the MAC node 1G, 2.5G, 10G? */ + /* Is the MAC node 1G, 2.5G, 10G or offline? */ __if->__if.is_memac = 0; - if (of_device_is_compatible(mac_node, "fsl,fman-1g-mac")) + if (is_offline) + __if->__if.mac_type = fman_offline; + else if (of_device_is_compatible(mac_node, "fsl,fman-1g-mac")) __if->__if.mac_type = fman_mac_1g; else if (of_device_is_compatible(mac_node, "fsl,fman-10g-mac")) __if->__if.mac_type = fman_mac_10g; @@ -468,46 +494,81 @@ fman_if_init(const struct device_node *dpa_node) goto err; } - /* - * For MAC ports, we cannot rely on cell-index. In - * T2080, two of the 10G ports on single FMAN have same - * duplicate cell-indexes as the other two 10G ports on - * same FMAN. Hence, we now rely upon addresses of the - * ports from device tree to deduce the index. - */ + if (!is_offline) { + /* + * For MAC ports, we cannot rely on cell-index. In + * T2080, two of the 10G ports on single FMAN have same + * duplicate cell-indexes as the other two 10G ports on + * same FMAN. Hence, we now rely upon addresses of the + * ports from device tree to deduce the index. + */ - _errno = fman_get_mac_index(regs_addr_host, &__if->__if.mac_idx); - if (_errno) { - FMAN_ERR(-EINVAL, "Invalid register address: %" PRIx64, - regs_addr_host); - goto err; - } + _errno = fman_get_mac_index(regs_addr_host, &__if->__if.mac_idx); + if (_errno) { + FMAN_ERR(-EINVAL, "Invalid register address: %" PRIx64, + regs_addr_host); + goto err; + } + } else { + cell_idx = of_get_property(oh_node, "cell-index", &lenp); + if (!cell_idx) { + FMAN_ERR(-ENXIO, "%s: no cell-index)\n", + oh_node->full_name); + goto err; + } + assert(lenp == sizeof(*cell_idx)); + cell_idx_host = of_read_number(cell_idx, + lenp / sizeof(phandle)); - /* Extract the MAC address for private and shared interfaces */ - mac_addr = of_get_property(mac_node, "local-mac-address", - &lenp); - if (!mac_addr) { - FMAN_ERR(-EINVAL, "%s: no local-mac-address", - mname); - goto err; + __if->__if.mac_idx = cell_idx_host; } - memcpy(&__if->__if.mac_addr, mac_addr, ETHER_ADDR_LEN); - /* Extract the channel ID (from tx-port-handle) */ - tx_channel_id = of_get_property(tx_node, "fsl,qman-channel-id", - &lenp); - if (!tx_channel_id) { - FMAN_ERR(-EINVAL, "%s: no fsl-qman-channel-id", - tx_node->full_name); - goto err; + if (!is_offline) { + /* Extract the MAC address for private and shared interfaces */ + mac_addr = of_get_property(mac_node, "local-mac-address", + &lenp); + if (!mac_addr) { + FMAN_ERR(-EINVAL, "%s: no local-mac-address", + mname); + goto err; + } + memcpy(&__if->__if.mac_addr, mac_addr, ETHER_ADDR_LEN); + + /* Extract the channel ID (from tx-port-handle) */ + tx_channel_id = of_get_property(tx_node, "fsl,qman-channel-id", + &lenp); + if (!tx_channel_id) { + FMAN_ERR(-EINVAL, "%s: no fsl-qman-channel-id", + tx_node->full_name); + goto err; + } + } else { + /* Extract the channel ID (from mac) */ + tx_channel_id = of_get_property(mac_node, "fsl,qman-channel-id", + &lenp); + if (!tx_channel_id) { + FMAN_ERR(-EINVAL, "%s: no fsl-qman-channel-id", + tx_node->full_name); + goto err; + } } - regs_addr = of_get_address(rx_node, 0, &__if->regs_size, NULL); + na = of_n_addr_cells(mac_node); + __if->__if.tx_channel_id = of_read_number(tx_channel_id, na); + + if (!is_offline) + regs_addr = of_get_address(rx_node, 0, &__if->regs_size, NULL); + else + regs_addr = of_get_address(oh_node, 0, &__if->regs_size, NULL); if (!regs_addr) { FMAN_ERR(-EINVAL, "of_get_address(%s)", mname); goto err; } - phys_addr = of_translate_address(rx_node, regs_addr); + + if (!is_offline) + phys_addr = of_translate_address(rx_node, regs_addr); + else + phys_addr = of_translate_address(oh_node, regs_addr); if (!phys_addr) { FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)", mname, regs_addr); @@ -521,23 +582,27 @@ fman_if_init(const struct device_node *dpa_node) goto err; } - regs_addr = of_get_address(tx_node, 0, &__if->regs_size, NULL); - if (!regs_addr) { - FMAN_ERR(-EINVAL, "of_get_address(%s)\n", mname); - goto err; - } - phys_addr = of_translate_address(tx_node, regs_addr); - if (!phys_addr) { - FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)\n", - mname, regs_addr); - goto err; - } - __if->tx_bmi_map = mmap(NULL, __if->regs_size, - PROT_READ | PROT_WRITE, MAP_SHARED, - fman_ccsr_map_fd, phys_addr); - if (__if->tx_bmi_map == MAP_FAILED) { - FMAN_ERR(-errno, "mmap(0x%"PRIx64")\n", phys_addr); - goto err; + if (!is_offline) { + regs_addr = of_get_address(tx_node, 0, &__if->regs_size, NULL); + if (!regs_addr) { + FMAN_ERR(-EINVAL, "of_get_address(%s)\n", mname); + goto err; + } + + phys_addr = of_translate_address(tx_node, regs_addr); + if (!phys_addr) { + FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)\n", + mname, regs_addr); + goto err; + } + + __if->tx_bmi_map = mmap(NULL, __if->regs_size, + PROT_READ | PROT_WRITE, MAP_SHARED, + fman_ccsr_map_fd, phys_addr); + if (__if->tx_bmi_map == MAP_FAILED) { + FMAN_ERR(-errno, "mmap(0x%"PRIx64")\n", phys_addr); + goto err; + } } if (!rtc_map) { @@ -554,11 +619,6 @@ fman_if_init(const struct device_node *dpa_node) __if->rtc_map = rtc_map; } - /* No channel ID for MAC-less */ - assert(lenp == sizeof(*tx_channel_id)); - na = of_n_addr_cells(mac_node); - __if->__if.tx_channel_id = of_read_number(tx_channel_id, na); - /* Extract the Rx FQIDs. (Note, the device representation is silly, * there are "counts" that must always be 1.) */ @@ -568,13 +628,26 @@ fman_if_init(const struct device_node *dpa_node) goto err; } - /* Check if "fsl,qman-frame-queues-rx" in dtb file is valid entry or - * not. A valid entry contains at least 4 entries, rx_error_queue, - * rx_error_queue_count, fqid_rx_def and rx_error_queue_count. + /* + * Check if "fsl,qman-frame-queues-rx/oh" in dtb file is valid entry or + * not. + * + * A valid rx entry contains either 4 or 6 entries. Mandatory entries + * are rx_error_queue, rx_error_queue_count, fqid_rx_def and + * fqid_rx_def_count. Optional entries are fqid_rx_pcd and + * fqid_rx_pcd_count. + * + * A valid oh entry contains 4 entries. Those entries are + * rx_error_queue, rx_error_queue_count, fqid_rx_def and + * fqid_rx_def_count. */ - assert(lenp >= (4 * sizeof(phandle))); - na = of_n_addr_cells(mac_node); + if (!is_offline) + assert(lenp == (4 * sizeof(phandle)) || + lenp == (6 * sizeof(phandle))); + else + assert(lenp == (4 * sizeof(phandle))); + /* Get rid of endianness (issues). Convert to host byte order */ rx_phandle_host[0] = of_read_number(&rx_phandle[0], na); rx_phandle_host[1] = of_read_number(&rx_phandle[1], na); @@ -595,6 +668,9 @@ fman_if_init(const struct device_node *dpa_node) __if->__if.fqid_rx_pcd_count = rx_phandle_host[5]; } + if (is_offline) + goto oh_init_done; + /* Extract the Tx FQIDs */ tx_phandle = of_get_property(dpa_node, "fsl,qman-frame-queues-tx", &lenp); @@ -706,6 +782,7 @@ fman_if_init(const struct device_node *dpa_node) if (is_shared) __if->__if.is_shared_mac = 1; +oh_init_done: fman_if_vsp_init(__if); /* Parsing of the network interface is complete, add it to the list */ @@ -769,6 +846,10 @@ fman_finish(void) list_for_each_entry_safe(__if, tmpif, &__ifs, __if.node) { int _errno; + /* No need to disable Offline port */ + if (__if->__if.mac_type == fman_offline) + continue; + /* disable Rx and Tx */ if ((__if->__if.mac_type == fman_mac_1g) && (!__if->__if.is_memac)) diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c index 4fc41c1ae9..1f61ae406b 100644 --- a/drivers/bus/dpaa/base/fman/fman_hw.c +++ b/drivers/bus/dpaa/base/fman/fman_hw.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * - * Copyright 2017,2020,2022 NXP + * Copyright 2017,2020,2022-2023 NXP * */ @@ -88,6 +88,10 @@ fman_if_add_hash_mac_addr(struct fman_if *p, uint8_t *eth) struct __fman_if *__if = container_of(p, struct __fman_if, __if); + /* Add hash mac addr not supported on Offline port */ + if (__if->__if.mac_type == fman_offline) + return 0; + eth_addr = ETH_ADDR_TO_UINT64(eth); if (!(eth_addr & GROUP_ADDRESS)) @@ -109,6 +113,15 @@ fman_if_get_primary_mac_addr(struct fman_if *p, uint8_t *eth) void *mac_reg = &((struct memac_regs *)__if->ccsr_map)->mac_addr0.mac_addr_l; u32 val = in_be32(mac_reg); + int i; + + /* Get mac addr not supported on Offline port */ + /* Return NULL mac address */ + if (__if->__if.mac_type == fman_offline) { + for (i = 0; i < 6; i++) + eth[i] = 0x0; + return 0; + } eth[0] = (val & 0x000000ff) >> 0; eth[1] = (val & 0x0000ff00) >> 8; @@ -130,6 +143,10 @@ fman_if_clear_mac_addr(struct fman_if *p, uint8_t addr_num) struct __fman_if *m = container_of(p, struct __fman_if, __if); void *reg; + /* Clear mac addr not supported on Offline port */ + if (m->__if.mac_type == fman_offline) + return; + if (addr_num) { reg = &((struct memac_regs *)m->ccsr_map)-> mac_addr[addr_num-1].mac_addr_l; @@ -149,10 +166,13 @@ int fman_if_add_mac_addr(struct fman_if *p, uint8_t *eth, uint8_t addr_num) { struct __fman_if *m = container_of(p, struct __fman_if, __if); - void *reg; u32 val; + /* Set mac addr not supported on Offline port */ + if (m->__if.mac_type == fman_offline) + return 0; + memcpy(&m->__if.mac_addr, eth, ETHER_ADDR_LEN); if (addr_num) diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c index 57d87afcb0..e6a6ed1eb6 100644 --- a/drivers/bus/dpaa/base/fman/netcfg_layer.c +++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2010-2016 Freescale Semiconductor Inc. - * Copyright 2017-2019 NXP + * Copyright 2017-2019,2023 NXP * */ #include @@ -44,6 +44,7 @@ dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f) fprintf(f, "\n+ Fman %d, MAC %d (%s);\n", __if->fman_idx, __if->mac_idx, + (__if->mac_type == fman_offline) ? "OFFLINE" : (__if->mac_type == fman_mac_1g) ? "1G" : (__if->mac_type == fman_mac_2_5g) ? "2.5G" : "10G"); @@ -56,13 +57,15 @@ dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f) fprintf(f, "\tfqid_rx_def: 0x%x\n", p_cfg->rx_def); fprintf(f, "\tfqid_rx_err: 0x%x\n", __if->fqid_rx_err); - fprintf(f, "\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); - fprintf(f, "\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); - fman_if_for_each_bpool(bpool, __if) - fprintf(f, "\tbuffer pool: (bpid=%d, count=%"PRId64 - " size=%"PRId64", addr=0x%"PRIx64")\n", - bpool->bpid, bpool->count, bpool->size, - bpool->addr); + if (__if->mac_type != fman_offline) { + fprintf(f, "\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); + fprintf(f, "\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); + fman_if_for_each_bpool(bpool, __if) + fprintf(f, "\tbuffer pool: (bpid=%d, count=%"PRId64 + " size=%"PRId64", addr=0x%"PRIx64")\n", + bpool->bpid, bpool->count, bpool->size, + bpool->addr); + } } } #endif /* RTE_LIBRTE_DPAA_DEBUG_DRIVER */ diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index 1f6997c77e..6e4ec90670 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -43,6 +43,7 @@ #include #include #include +#include struct rte_dpaa_bus { struct rte_bus bus; @@ -203,9 +204,12 @@ dpaa_create_device_list(void) /* Create device name */ memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN); - sprintf(dev->name, "fm%d-mac%d", (fman_intf->fman_idx + 1), - fman_intf->mac_idx); - DPAA_BUS_LOG(INFO, "%s netdev added", dev->name); + if (fman_intf->mac_type == fman_offline) + sprintf(dev->name, "fm%d-oh%d", + (fman_intf->fman_idx + 1), fman_intf->mac_idx); + else + sprintf(dev->name, "fm%d-mac%d", + (fman_intf->fman_idx + 1), fman_intf->mac_idx); dev->device.name = dev->name; dev->device.devargs = dpaa_devargs_lookup(dev); @@ -441,7 +445,7 @@ static int rte_dpaa_bus_parse(const char *name, void *out) { unsigned int i, j; - size_t delta; + size_t delta, dev_delta; size_t max_name_len; /* There are two ways of passing device name, with and without @@ -458,16 +462,25 @@ rte_dpaa_bus_parse(const char *name, void *out) delta = 5; } + /* dev_delta points to the dev name (mac/oh/onic). Not valid for + * dpaa_sec. + */ + dev_delta = delta + sizeof("fm.-") - 1; + if (strncmp("dpaa_sec", &name[delta], 8) == 0) { if (sscanf(&name[delta], "dpaa_sec-%u", &i) != 1 || i < 1 || i > 4) return -EINVAL; max_name_len = sizeof("dpaa_sec-.") - 1; + } else if (strncmp("oh", &name[dev_delta], 2) == 0) { + if (sscanf(&name[delta], "fm%u-oh%u", &i, &j) != 2 || + i >= 2 || j >= 16) + return -EINVAL; + max_name_len = sizeof("fm.-oh..") - 1; } else { if (sscanf(&name[delta], "fm%u-mac%u", &i, &j) != 2 || i >= 2 || j >= 16) return -EINVAL; - max_name_len = sizeof("fm.-mac..") - 1; } diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index e8bc913943..377f73bf0d 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -2,7 +2,7 @@ * * Copyright 2010-2012 Freescale Semiconductor, Inc. * All rights reserved. - * Copyright 2019-2022 NXP + * Copyright 2019-2023 NXP * */ @@ -474,11 +474,30 @@ extern int fman_ccsr_map_fd; #define FMAN_IP_REV_1_MAJOR_MASK 0x0000FF00 #define FMAN_IP_REV_1_MAJOR_SHIFT 8 #define FMAN_V3 0x06 -#define FMAN_V3_CONTEXTA_EN_A2V 0x10000000 -#define FMAN_V3_CONTEXTA_EN_OVOM 0x02000000 -#define FMAN_V3_CONTEXTA_EN_EBD 0x80000000 -#define FMAN_CONTEXTA_DIS_CHECKSUM 0x7ull -#define FMAN_CONTEXTA_SET_OPCODE11 0x2000000b00000000 + +#define DPAA_FQD_CTX_A_SHIFT_BITS 24 +#define DPAA_FQD_CTX_B_SHIFT_BITS 24 + +/* Following flags are used to set in context A hi field of FQD */ +#define DPAA_FQD_CTX_A_OVERRIDE_FQ (0x80 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_IGNORE_CMD (0x40 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_A1_FIELD_VALID (0x20 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_A2_FIELD_VALID (0x10 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_A0_FIELD_VALID (0x08 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_B0_FIELD_VALID (0x04 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_OVERRIDE_OMB (0x02 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_RESERVED (0x01 << DPAA_FQD_CTX_A_SHIFT_BITS) + +/* Following flags are used to set in context A lo field of FQD */ +#define DPAA_FQD_CTX_A2_EBD_BIT (0x80 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_EBAD_BIT (0x40 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_FWD_BIT (0x20 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_NL_BIT (0x10 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_CWD_BIT (0x08 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_NENQ_BIT (0x04 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_RESERVED_BIT (0x02 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_VSPE_BIT (0x01 << DPAA_FQD_CTX_A_SHIFT_BITS) + extern u16 fman_ip_rev; extern u32 fman_dealloc_bufs_mask_hi; extern u32 fman_dealloc_bufs_mask_lo; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 4ead890278..f8196ddd14 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -295,7 +295,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) max_rx_pktlen = DPAA_MAX_RX_PKT_LEN; } - if (!fif->is_shared_mac) + if (fif->mac_type != fman_offline) fman_if_set_maxfrm(dev->process_private, max_rx_pktlen); if (rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) { @@ -314,6 +314,10 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) dpaa_write_fm_config_to_file(); } + /* Disable interrupt support on offline port*/ + if (fif->mac_type == fman_offline) + return 0; + /* if the interrupts were configured on this devices*/ if (intr_handle && rte_intr_fd_get(intr_handle)) { if (dev->data->dev_conf.intr_conf.lsc != 0) @@ -531,6 +535,9 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) ret = dpaa_eth_dev_stop(dev); + if (fif->mac_type == fman_offline) + return 0; + /* Reset link to autoneg */ if (link->link_status && !link->link_autoneg) dpaa_restart_link_autoneg(__fif->node_name); @@ -644,6 +651,11 @@ static int dpaa_eth_dev_info(struct rte_eth_dev *dev, | RTE_ETH_LINK_SPEED_1G | RTE_ETH_LINK_SPEED_2_5G | RTE_ETH_LINK_SPEED_10G; + } else if (fif->mac_type == fman_offline) { + dev_info->speed_capa = RTE_ETH_LINK_SPEED_10M_HD + | RTE_ETH_LINK_SPEED_10M + | RTE_ETH_LINK_SPEED_100M_HD + | RTE_ETH_LINK_SPEED_100M; } else { DPAA_PMD_ERR("invalid link_speed: %s, %d", dpaa_intf->name, fif->mac_type); @@ -744,7 +756,8 @@ static int dpaa_eth_link_update(struct rte_eth_dev *dev, ioctl_version = dpaa_get_ioctl_version_number(); - if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) { + if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC && + fif->mac_type != fman_offline) { for (count = 0; count <= MAX_REPEAT_TIME; count++) { ret = dpaa_get_link_status(__fif->node_name, link); if (ret) @@ -757,6 +770,11 @@ static int dpaa_eth_link_update(struct rte_eth_dev *dev, } } else { link->link_status = dpaa_intf->valid; + if (fif->mac_type == fman_offline) { + /*Max supported rate for O/H port is 3.75Mpps*/ + link->link_speed = RTE_ETH_SPEED_NUM_2_5G; + link->link_duplex = RTE_ETH_LINK_FULL_DUPLEX; + } } if (ioctl_version < 2) { @@ -1077,7 +1095,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, dpaa_intf->bp_info = DPAA_MEMPOOL_TO_POOL_INFO(mp); /* For shared interface, it's done in kernel, skip.*/ - if (!fif->is_shared_mac) + if (!fif->is_shared_mac && fif->mac_type != fman_offline) dpaa_fman_if_pool_setup(dev); if (fif->num_profiles) { @@ -1222,8 +1240,11 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, rxq->fqid, ret); } } + /* Enable main queue to receive error packets also by default */ - fman_if_set_err_fqid(fif, rxq->fqid); + if (fif->mac_type != fman_offline) + fman_if_set_err_fqid(fif, rxq->fqid); + return 0; } @@ -1372,7 +1393,8 @@ static int dpaa_link_down(struct rte_eth_dev *dev) __fif = container_of(fif, struct __fman_if, __if); - if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) + if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC && + fif->mac_type != fman_offline) dpaa_update_link_status(__fif->node_name, RTE_ETH_LINK_DOWN); else return dpaa_eth_dev_stop(dev); @@ -1388,7 +1410,8 @@ static int dpaa_link_up(struct rte_eth_dev *dev) __fif = container_of(fif, struct __fman_if, __if); - if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) + if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC && + fif->mac_type != fman_offline) dpaa_update_link_status(__fif->node_name, RTE_ETH_LINK_UP); else dpaa_eth_dev_start(dev); @@ -1483,9 +1506,15 @@ dpaa_dev_add_mac_addr(struct rte_eth_dev *dev, __rte_unused uint32_t pool) { int ret; + struct fman_if *fif = dev->process_private; PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_offline) { + DPAA_PMD_DEBUG("Add MAC Address not supported on O/H port"); + return 0; + } + ret = fman_if_add_mac_addr(dev->process_private, addr->addr_bytes, index); @@ -1498,8 +1527,15 @@ static void dpaa_dev_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) { + struct fman_if *fif = dev->process_private; + PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_offline) { + DPAA_PMD_DEBUG("Remove MAC Address not supported on O/H port"); + return; + } + fman_if_clear_mac_addr(dev->process_private, index); } @@ -1508,9 +1544,15 @@ dpaa_dev_set_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { int ret; + struct fman_if *fif = dev->process_private; PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_offline) { + DPAA_PMD_DEBUG("Set MAC Address not supported on O/H port"); + return 0; + } + ret = fman_if_add_mac_addr(dev->process_private, addr->addr_bytes, 0); if (ret) DPAA_PMD_ERR("Setting the MAC ADDR failed %d", ret); @@ -1807,6 +1849,17 @@ static int dpaa_rx_queue_init(struct qman_fq *fq, struct qman_cgr *cgr_rx, return ret; } +uint8_t fm_default_vsp_id(struct fman_if *fif) +{ + /* Avoid being same as base profile which could be used + * for kernel interface of shared mac. + */ + if (fif->base_profile_id) + return 0; + else + return DPAA_DEFAULT_RXQ_VSP_ID; +} + /* Initialise a Tx FQ */ static int dpaa_tx_queue_init(struct qman_fq *fq, struct fman_if *fman_intf, @@ -1842,13 +1895,20 @@ static int dpaa_tx_queue_init(struct qman_fq *fq, } 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; + opts.fqd.context_a.hi = DPAA_FQD_CTX_A_OVERRIDE_FQ | + fman_dealloc_bufs_mask_hi; } - if (fman_ip_rev >= FMAN_V3) { + if (fman_ip_rev >= FMAN_V3) /* Set B0V bit in contextA to set ASPID to 0 */ - opts.fqd.context_a.hi |= 0x04000000; + opts.fqd.context_a.hi |= DPAA_FQD_CTX_A_B0_FIELD_VALID; + + if (fman_intf->mac_type == fman_offline) { + opts.fqd.context_a.lo |= DPAA_FQD_CTX_A2_VSPE_BIT; + opts.fqd.context_b = fm_default_vsp_id(fman_intf) << + DPAA_FQD_CTX_B_SHIFT_BITS; } + DPAA_PMD_DEBUG("init tx fq %p, fqid 0x%x", fq, fq->fqid); if (cgr_tx) { @@ -2263,7 +2323,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) DPAA_PMD_DEBUG("All frame queues created"); /* Get the initial configuration for flow control */ - dpaa_fc_set_default(dpaa_intf, fman_intf); + if (fman_intf->mac_type != fman_offline) + dpaa_fc_set_default(dpaa_intf, fman_intf); /* reset bpool list, initialize bpool dynamically */ list_for_each_entry_safe(bp, tmp_bp, &cfg->fman_if->bpool_list, node) { @@ -2294,10 +2355,10 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) DPAA_PMD_INFO("net: dpaa: %s: " RTE_ETHER_ADDR_PRT_FMT, dpaa_device->name, RTE_ETHER_ADDR_BYTES(&fman_intf->mac_addr)); - if (!fman_intf->is_shared_mac) { + if (!fman_intf->is_shared_mac && fman_intf->mac_type != fman_offline) { /* Configure error packet handling */ fman_if_receive_rx_errors(fman_intf, - FM_FD_RX_STATUS_ERR_MASK); + FM_FD_RX_STATUS_ERR_MASK); /* Disable RX mode */ fman_if_disable_rx(fman_intf); /* Disable promiscuous mode */ diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index 7884cc034c..8ec5155cfc 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -121,6 +121,9 @@ enum { extern struct rte_mempool *dpaa_tx_sg_pool; extern int dpaa_ieee_1588; +/* PMD related logs */ +extern int dpaa_logtype_pmd; + /* structure to free external and indirect * buffers. */ @@ -266,6 +269,9 @@ dpaa_timesync_read_rx_timestamp(struct rte_eth_dev *dev, struct timespec *timestamp, uint32_t flags __rte_unused); +uint8_t +fm_default_vsp_id(struct fman_if *fif); + /* PMD related logs */ extern int dpaa_logtype_pmd; #define RTE_LOGTYPE_DPAA_PMD dpaa_logtype_pmd diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c index 082bd5d014..9ef0cce38a 100644 --- a/drivers/net/dpaa/dpaa_flow.c +++ b/drivers/net/dpaa/dpaa_flow.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2017-2019,2021 NXP + * Copyright 2017-2019,2021-2024 NXP */ /* System headers */ @@ -29,6 +29,11 @@ return &scheme_params->param.key_ext_and_hash.extract_array[hdr_idx]; #define SCH_EXT_FULL_FLD(scheme_params, hdr_idx) \ SCH_EXT_HDR(scheme_params, hdr_idx).extract_by_hdr_type.full_field +/* FMAN mac indexes mappings (0 is unused, first 8 are for 1G, next for 10G + * ports). + */ +const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1}; + /* FM global info */ struct dpaa_fm_info { t_handle fman_handle; @@ -48,17 +53,6 @@ static struct dpaa_fm_info fm_info; static struct dpaa_fm_model fm_model; static const char *fm_log = "/tmp/fmdpdk.bin"; -static inline uint8_t fm_default_vsp_id(struct fman_if *fif) -{ - /* Avoid being same as base profile which could be used - * for kernel interface of shared mac. - */ - if (fif->base_profile_id) - return 0; - else - return DPAA_DEFAULT_RXQ_VSP_ID; -} - static void fm_prev_cleanup(void) { uint32_t fman_id = 0, i = 0, devid; @@ -649,12 +643,15 @@ static inline int set_pcd_netenv_scheme(struct dpaa_if *dpaa_intf, } -static inline int get_port_type(struct fman_if *fif) +static inline int get_rx_port_type(struct fman_if *fif) { + + if (fif->mac_type == fman_offline_internal) + return e_FM_PORT_TYPE_OH_OFFLINE_PARSING; /* For 1G fm-mac9 and fm-mac10 ports, configure the VSP as 10G * ports so that kernel can configure correct port. */ - if (fif->mac_type == fman_mac_1g && + else if (fif->mac_type == fman_mac_1g && fif->mac_idx >= DPAA_10G_MAC_START_IDX) return e_FM_PORT_TYPE_RX_10G; else if (fif->mac_type == fman_mac_1g) @@ -665,7 +662,7 @@ static inline int get_port_type(struct fman_if *fif) return e_FM_PORT_TYPE_RX_10G; DPAA_PMD_ERR("MAC type unsupported"); - return -1; + return e_FM_PORT_TYPE_DUMMY; } static inline int set_fm_port_handle(struct dpaa_if *dpaa_intf, @@ -676,17 +673,12 @@ static inline int set_fm_port_handle(struct dpaa_if *dpaa_intf, ioc_fm_pcd_net_env_params_t dist_units; PMD_INIT_FUNC_TRACE(); - /* FMAN mac indexes mappings (0 is unused, - * first 8 are for 1G, next for 10G ports - */ - uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1}; - /* Memset FM port params */ memset(&fm_port_params, 0, sizeof(fm_port_params)); /* Set FM port params */ fm_port_params.h_fm = fm_info.fman_handle; - fm_port_params.port_type = get_port_type(fif); + fm_port_params.port_type = get_rx_port_type(fif); fm_port_params.port_id = mac_idx[fif->mac_idx]; /* FM PORT Open */ @@ -949,7 +941,6 @@ static int dpaa_port_vsp_configure(struct dpaa_if *dpaa_intf, { t_fm_vsp_params vsp_params; t_fm_buffer_prefix_content buf_prefix_cont; - uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1}; uint8_t idx = mac_idx[fif->mac_idx]; int ret; @@ -970,17 +961,31 @@ static int dpaa_port_vsp_configure(struct dpaa_if *dpaa_intf, memset(&vsp_params, 0, sizeof(vsp_params)); vsp_params.h_fm = fman_handle; vsp_params.relative_profile_id = vsp_id; - vsp_params.port_params.port_id = idx; + if (fif->mac_type == fman_offline_internal) + vsp_params.port_params.port_id = fif->mac_idx; + else + vsp_params.port_params.port_id = idx; + if (fif->mac_type == fman_mac_1g) { vsp_params.port_params.port_type = e_FM_PORT_TYPE_RX; } else if (fif->mac_type == fman_mac_2_5g) { vsp_params.port_params.port_type = e_FM_PORT_TYPE_RX_2_5G; } else if (fif->mac_type == fman_mac_10g) { vsp_params.port_params.port_type = e_FM_PORT_TYPE_RX_10G; + } else if (fif->mac_type == fman_offline) { + vsp_params.port_params.port_type = + e_FM_PORT_TYPE_OH_OFFLINE_PARSING; } else { DPAA_PMD_ERR("Mac type %d error", fif->mac_type); return -1; } + + vsp_params.port_params.port_type = get_rx_port_type(fif); + if (vsp_params.port_params.port_type == e_FM_PORT_TYPE_DUMMY) { + DPAA_PMD_ERR("Mac type %d error", fif->mac_type); + return -1; + } + vsp_params.ext_buf_pools.num_of_pools_used = 1; vsp_params.ext_buf_pools.ext_buf_pool[0].id = dpaa_intf->vsp_bpid[vsp_id]; vsp_params.ext_buf_pools.ext_buf_pool[0].size = mbuf_data_room_size; -- 2.25.1