From nobody Mon Nov 25 22:53:51 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2089.outbound.protection.outlook.com [40.107.22.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F14B1B4F15; Wed, 23 Oct 2024 13:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729691590; cv=fail; b=iw1jcGh8QCerXMe15bhfpdvbtJV80dmvIxZE7jjngydB1tvP09PhvBbZz3AI37FnVD4ZkeduEVLyz9aZHFIU3LpxjvrhMie48dB7BYuGklU1jt0yVvbeu0kzWw5LE5iPUbxtLJ108NF/rST+2iIT6BIPjs1fxd8vNo/z8QQhuHs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729691590; c=relaxed/simple; bh=dZfy9t2RV+K/4GztmEvHNkLAvswoQDvmyKRokEz4Apw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=VjUoLuWW3wPS6XGiARwPBsDpsk9uzqKNonsALjWxSKgt0gdFIBxA47p0c8o9AjONUedOyyKgijYb58cK+BsOFZ1SxcFIr59z9gTAI8i8z0ZziNzYwyNKZcYjZzO32J9Wc2P8B0sMO2MogiBEfuTC3FycSdpiD7xR1AXim69Onjs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=c9IC2O16; arc=fail smtp.client-ip=40.107.22.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="c9IC2O16" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=em6JSvDrDVcpoET3gvzrIzccQjnaBLMFE9h+HYU7svRmPgFhbv4/IIhZhNg30HbHzm8uIZNW1zh+yIN3mFgjsWbltzZh1SAqNlwkrEDmeTUchNkoKAlFskjrbXGwEXIll5LDWYCeZTkGsx5SJ1ccmBAmi6M1UcjRQ3/vYD0zK/MHz0yN53igKlOjspZZ83HivqSFjN9Ay31XRePArzKDp7wnBqEe+XK/33f0dp9K4XInPrkXVMevWMDuQmPml3Z9vjrxoj2btMX2xw/J9CckxN6m8OFVC9Us+UUncBEjZOob6al1NwxwJZhZRYrarE9HP9/oAjgdjT7hH6/tcYebOA== 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=KO/gNL7mcxOGWPQb2ExICHs7JMw60lCeiJczgEiVCaM=; b=WBIwsxupn7Uwb6wjIPPgsUScONcgOy3APs7a4KMNJJ/UcAQLhm2m9yFsEAHd8QahqyDtD7YjFTOyxK6AVK3YB1n/N8wXoWrVVr1fibGORXrQj32DBfVLREP1sTXduhY0THyTwNZ/91lsQi0STAVo/oOUlueSV18IjOpLskXdXHASJCtDjQfPbCGZgMDjTdaQmVJ8fMKNoZZwZ7xx8fUncn6n+g40KTBhkIgB3JpKgPXbxG4vClPtpsdDvX0mpAUMbQ3vhNjmlUD5jxOlsZYsMAx0Y/8oKDqY0hmFQO3m/6suuRHrGbTDL5kpcnC6o+scLG2vx2/q6LNq+yvJ01iqVQ== 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=KO/gNL7mcxOGWPQb2ExICHs7JMw60lCeiJczgEiVCaM=; b=c9IC2O167mWbTNjKfseQeXWTQukCWl7b7K2iHO3f/1x5okE5q/OHw51Go9tjQBgxCvt0KQFDaCXW3QIB/y+4y6APSJINUuts+l5SJfg5dWBF7UoAhOBRehWsAgf/tfCD645uUbyKFIJd0Js1LwUmntdhDCiR0lsPzSCx83KlITP3BXIlU7aZndSECAbGipEy640SIuCSxp5c/iGwiqfaX2UUvSCRpsdQccYA34dWtQTGRlmzzhyz0qpKXVrFBIznZ1fc2bfGIPaCJaBUelbJe9wWCvTLVxp78I8lMCsLVuMmCSSIcVH8r+mTwxgn6WQ/exzZToduuPTvXNGEaCkStQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by AS1PR04MB9683.eurprd04.prod.outlook.com (2603:10a6:20b:473::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18; Wed, 23 Oct 2024 13:53:03 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%3]) with mapi id 15.20.8093.014; Wed, 23 Oct 2024 13:53:03 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Petr Machata , Ido Schimmel , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vlad Buslov , Simon Horman , Christian Marangi , Arun Ramadoss , =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , linux-kernel@vger.kernel.org Subject: [PATCH v3 net-next 1/6] net: sched: propagate "skip_sw" flag to struct flow_cls_common_offload Date: Wed, 23 Oct 2024 16:52:46 +0300 Message-ID: <20241023135251.1752488-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023135251.1752488-1-vladimir.oltean@nxp.com> References: <20241023135251.1752488-1-vladimir.oltean@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1PR10CA0105.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::34) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8PR04MB7779:EE_|AS1PR04MB9683:EE_ X-MS-Office365-Filtering-Correlation-Id: ac452d96-4c79-43b4-eba6-08dcf36a036f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?EArAz6N4H3pzMfm6Wv/Ly5tST4l7hfS31p0b5xs8Cshx4NFn2yBaFomlinVr?= =?us-ascii?Q?ZtjvX9I7NyU/Hl0kGNkHXxDUTLUyAiwMpTi7V6xBYJFuc5BV/O9QuTrqdipg?= =?us-ascii?Q?viNMnBlz1PNt9wFV9X7+Ifxtvypb+rClF7+6JhSw2IfRiriYs1jyRWYxJmbM?= =?us-ascii?Q?4JCfYC/w+Q7+rHQbVfFyWU8MmMKJcEe9hMTKYBn6ditAXku+DVlgALb8+MWv?= =?us-ascii?Q?4ck5fxqLDKXt/f2z8C6ScVDND/6y+awFS2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ascii?Q?6bfqcYMebF5nV0fVKFQ3nbA568nwOSKTtbb7zXRsGSts7uYYxoVb/8IiECvf?= =?us-ascii?Q?x6STlwLqaxVh5YsZIj2D8snUk8C3tDGeEYPJZCd7juOm9jhonnivNLo+Ipkt?= =?us-ascii?Q?F2v/1DajJ9ixSldIGAEcvdM3M9AQ56Dzel1/xfVhnwUyqYuIe4EAu21pMnAE?= =?us-ascii?Q?QSWww0kXtwI/t/1/wXxTbUTp7fsLo+LPZLZ2vORfB0I0rJoZBoozdfmHpHrN?= =?us-ascii?Q?dVj3gySGX+mY0Cl3kgUPUVmpDtCD?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(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?41GZ8bvQu+VAQD7FCBOFIKTsRShQ3TD/M4RUKUQqSLzcd0LBV6KWFIZepJtw?= =?us-ascii?Q?G1tHVq4GAA4F6D26Ims0/RzLoJ7thYsAroAMphtxPgw/7bMqWc1QN+i/025k?= =?us-ascii?Q?bCRX5fpAwETh+xJDbspDB+ErTpIFbdXJWO/wbiRTBfPoY1XfvEBgKUFjdbdm?= =?us-ascii?Q?ty3wRpFOr/cy5TO7RZAWyStSWy7cTj1Sw2q2CC+z0mklThMI1cWRLDyHLk9O?= =?us-ascii?Q?Lcf3U/SgK7w8yNH0DIp+L1PgszDtUJ4NPBjrCB26OGuj36vWHPQKMD73u+XQ?= =?us-ascii?Q?6cpmwCUU5NrrYuwuGvrFllI4wyVRfln31OWw3Qq3xqWSqpKaV1tRlZL2AiJg?= =?us-ascii?Q?PD0vq63CwMa9Zw2i/VcUu0XGsf3pZzcRBYHOsnHQMKxyZxPxTXcYfd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qt+Z8wKTtj21r8cTU2sdMmQu+/Cnfg+Y?= =?us-ascii?Q?tp76H1wsgnWx8VE9uOrI+12FNVp+nk3mYeADfNU3zKCUZPd16ofHNUZHRfHa?= =?us-ascii?Q?OejPIkgmHuFSjp+sxx3zqlndTquSdzKcNUwSyiPMUdCynTbIC3pjIOQHeFPk?= =?us-ascii?Q?/PjvEDf3RlPFJzypVvPcZXs0HxL+8pZqcQWdncgUZ4uODRH9lYNOx9bQ2pyJ?= =?us-ascii?Q?EwRqN5fWT9/UXw6qx8gjx7MhTZwcIzORa3Lxz5KlEOxFAFCMWxX+tw2F9FdC?= =?us-ascii?Q?TUuxd9dkVmph21P7wVqR192g4HBH/ujpEyt16YTB49safAGXFOyoc9+qEpcE?= =?us-ascii?Q?ng=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac452d96-4c79-43b4-eba6-08dcf36a036f X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 13:53:03.1525 (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: Oxv0YpAXOxcq4TY1sJ1GZlxj5tyuLRcDwdl8V7ExDtBC9NpXp8qQ+j+AKkZQWjvrVh7eJkQSDFn4SFmOxWzJPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9683 Content-Type: text/plain; charset="utf-8" Background: switchdev ports offload the Linux bridge, and most of the packets they handle will never see the CPU. The ports between which there exists no hardware data path are considered 'foreign' to switchdev. These can either be normal physical NICs without switchdev offload, or incompatible switchdev ports, or virtual interfaces like veth/dummy/etc. In some cases, an offloaded filter can only do half the work, and the rest must be handled by software. Redirecting/mirroring from the ingress of a switchdev port towards a foreign interface is one example of combined hardware/software data path. The most that the switchdev port can do is to extract the matching packets from its offloaded data path and send them to the CPU. From there on, the software filter runs (a second time, after the first run in hardware) on the packet and performs the mirred action. It makes sense for switchdev drivers which allow this kind of "half offloading" to sense the "skip_sw" flag of the filter/action pair, and deny attempts from the user to install a filter that does not run in software, because that simply won't work. In fact, a mirred action on a switchdev port towards a dummy interface appears to be a valid way of (selectively) monitoring offloaded traffic that flows through it. IFF_PROMISC was also discussed years ago, but (despite initial disagreement) there seems to be consensus that this flag should not affect the destination taken by packets, but merely whether or not the NIC discards packets with unknown MAC DA for local processing. [1] https://lore.kernel.org/netdev/20190830092637.7f83d162@ceranb/ [2] https://lore.kernel.org/netdev/20191002233750.13566-1-olteanv@gmail.com/ Suggested-by: Ido Schimmel Link: https://lore.kernel.org/netdev/ZxUo0Dc0M5Y6l9qF@shredder.mtl.com/ Signed-off-by: Vladimir Oltean Reviewed-by: Ido Schimmel --- v2->v3: move skip_sw from struct flow_cls_offload and struct tc_cls_matchall_offload to struct flow_cls_common_offload. v1->v2: rewrite commit message include/net/flow_offload.h | 1 + include/net/pkt_cls.h | 1 + 2 files changed, 2 insertions(+) diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index 292cd8f4b762..596ab9791e4d 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -685,6 +685,7 @@ struct flow_cls_common_offload { u32 chain_index; __be16 protocol; u32 prio; + bool skip_sw; struct netlink_ext_ack *extack; }; =20 diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 4880b3a7aced..cf199af85c52 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -755,6 +755,7 @@ tc_cls_common_offload_init(struct flow_cls_common_offlo= ad *cls_common, cls_common->chain_index =3D tp->chain->index; cls_common->protocol =3D tp->protocol; cls_common->prio =3D tp->prio >> 16; + cls_common->skip_sw =3D tc_skip_sw(flags); if (tc_skip_sw(flags) || flags & TCA_CLS_FLAGS_VERBOSE) cls_common->extack =3D extack; } --=20 2.43.0 From nobody Mon Nov 25 22:53:51 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2089.outbound.protection.outlook.com [40.107.22.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7468F1BC9EB; Wed, 23 Oct 2024 13:53:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729691592; cv=fail; b=JNpaLeV+onvwYGsudTr5H5hbLG4PhajqP4UB42ZFDzcQYh6gRF8D9yGJ6mBs2AUFhYpraopyrRqvuw0KlHMCpghBtZopbYDJS/30BV9sosiJi77XgyhnbgUNyQ0NtsmgekomXfmxgVU1ElN5Uu8kVpZvBfILzfnCkYOE/uLHn04= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729691592; c=relaxed/simple; bh=WFP7RmBPECgC9N/ARtf9EYD0haXHFNnHEAG2WpEGSgY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=m5G9AqpBzJXw+CxM//FhMja7/xzv+Cjjh6CjrQhXVlMT9Oy4NA56rQexif9GIvHVjOrGVjifREZtSDShy9L30Q3hH/G5sxbyKcvxIx3QO3nH+D9J6AlBUd1QgczDRIL+OHoDyz/jorERCv1aTzr2Zr15Cu6xfqeFT/PQinMOmqc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=J/ShAlm2; arc=fail smtp.client-ip=40.107.22.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="J/ShAlm2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WMpC22tpGAfi3xXWELg9dX/OXwUS0jfm3u1TxHnwdEzy/3Xx5MSB6+FfuqqriTrbSktod/IkiI0g/29fQHkapasO/9F7D+SUd6DXw+znQ4c0CkqZR5DlgzmOaEmaSaN5nZjXan2y+B0Pud/Ho2P0ND+mmKWYDk0LwddR3nAIcr/POseQy4jsONEfrlSkV2ad+CjM6LGyKNzhbsRHLSDbL/gBUkuEgxQCNhYgrSu/y/h1VGMMox8JVyIFlNNojoWSi1305xfLtVV6qOKKphhw1QCrbB5LB/zpRicRT08x7sShZmLANQFrGFMfMR/TIkp5iF0WU/5FTZQMF7++e3Qb/Q== 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=O3AHksdjf87SjJsNfqjc72/8+TaQDuPWe1fjxFyDWEQ=; b=hgRbyhAoIul31m+yhbLk7vIqTdpuldYIyJTxkAOu7UYfDzmycsuOxwV98bXUo5G47EKqWOMEBPcv+v+DJdVlkQKaZ6vagzcRo1NWKJkI94/pOdYaxUnDBQfvi0VLJ2WOhR8Xnsf1lfBSQzj0UMjIV8vGc+vPuXLRMY9syLmma1nE5dZzYP5XCGz7M1Jfu2OKjg82GvSAnA2COztgWGesiQwsBXqlL4ewH3WSigQTbXlDbfEj5zJZan7cauvEeLfVZoIF42+XeVdkAiM5FPax5D0wBKRC+vGohs4uBGjZ+TPz0u7tyBffuzRWmktgF7rksqKAW49Y2qzsXHeISuYB5w== 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=O3AHksdjf87SjJsNfqjc72/8+TaQDuPWe1fjxFyDWEQ=; b=J/ShAlm2KD8e+ixvxeV8ZrNWAOYQAJV3GlN1q8i8+jiFoJiVDX4Ymk8KGhovec309fH7uzcRi1iyFGO8jgZ+NiuDgdSce486EZ1Q9AZMGE7rOVhNyIUMtvWHyFrzimi18yhOsAZbdZQS1pFkBipLACZbN2sysV5xPnUC9+/ALXC9WOnHktTjeXkir9C+fJBoyRH50vbPBTCaYihz9ndM/YDC8ze6h4rGFO1PEPZ1FXKaQA50LJsP+Y/TKUNegy0HTpBkgmmsvmY4YYFK9RvL3OtapGQ1/QDjVre91T3aC/iIxKaxX9ATB5Uy6nO88hdGwQLxjw5tlukoPYW7vSkifg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by AS1PR04MB9683.eurprd04.prod.outlook.com (2603:10a6:20b:473::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18; Wed, 23 Oct 2024 13:53:04 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%3]) with mapi id 15.20.8093.014; Wed, 23 Oct 2024 13:53:04 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Petr Machata , Ido Schimmel , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vlad Buslov , Simon Horman , Christian Marangi , Arun Ramadoss , =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , linux-kernel@vger.kernel.org Subject: [PATCH v3 net-next 2/6] net: dsa: clean up dsa_user_add_cls_matchall() Date: Wed, 23 Oct 2024 16:52:47 +0300 Message-ID: <20241023135251.1752488-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023135251.1752488-1-vladimir.oltean@nxp.com> References: <20241023135251.1752488-1-vladimir.oltean@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1PR10CA0105.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::34) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8PR04MB7779:EE_|AS1PR04MB9683:EE_ X-MS-Office365-Filtering-Correlation-Id: c97909d1-7607-4232-8602-08dcf36a0452 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?zauEWOnPF0P3Uv5XHlVloUlHkfBh8rzORBaylRdAiKLLVAczJFiSIlwYo6wt?= =?us-ascii?Q?5BLPOdECd8sw0ylHKu6WTMy0Y0dAUlgmmBdOyWSv/XfqTmmf4zh9fHW6C8ZJ?= =?us-ascii?Q?OWVe9XlIeaEh4mocA77V6rB0ZSRWdfKfLt9NHLR4e2tBddjn7+enPUKHVxUe?= =?us-ascii?Q?pzOKZQmQAKXelQI1gyPenwhUl25APEndr5r8G0ahh2ZlX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/UnyUQLTQn4BJxHkdK19KDIT13MUTidfyhlhzaoCC?= =?us-ascii?Q?y7QN/av69eP4viBTAsYHxWgJXlUyndrMyyJCHzPpudota2U8rvidWZYZtDJ3?= =?us-ascii?Q?RmHOR9VPNha9JRTVkKNxGAbvXZk/38kzsKO2IRwEa9g/bkyP4/KhIAd3dTIO?= =?us-ascii?Q?9hDUKTZMXiVEItbOXAZ06hvX+Lwf+Kg+acaoin1AGyFe+rrVbki5vghwD1x/?= =?us-ascii?Q?JZ4+U8cLSByvs73E4zhT7VRlVbEnG5/20jyM26ghaaK6dYnkGMEmgWblH5oo?= =?us-ascii?Q?t42/kmE=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(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?RXawPqTncUO5Fc8EugWMTTc6MLvULCshFzzPcRm+CKomYCStWzDFifRkxYJ9?= =?us-ascii?Q?iys/F2qYPIYmcv8+VmcXUU/9Xt0j+neLqtrc7e/KKQXbk40+vZYq04zRTYJM?= =?us-ascii?Q?NYxsgEIWJu/TQY8wu4agDaDWhsIrVHbXlvBUkMl0M71kBpGhLEr4uOwPKtro?= =?us-ascii?Q?bKjQhfoUHCnXi375r4mj3GTFMVAmO+/sKN9nYsvxkv7YAr2NxJI0ERVqRqAe?= =?us-ascii?Q?YwKc8jVOWRjRB4Q+S8OEa71f/E/Ph21roI9BSPisY2Kr95dQl6B8wfNYq98I?= =?us-ascii?Q?ChYdo/MRcOPZukd4sQEG1nmdOOaDX5Lhx76EN0nbV6a8Ak+YUoRojiSG8t7b?= =?us-ascii?Q?lKHAigcC686BT21vNiLFtZRPv4FGzN5pWT4OhIrN/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rPPOIOGZaCUTCpOxqQ9AlOjZxn2IhwoB9Gh2v5OjjU41sLYy/hqK?= =?us-ascii?Q?49aUe+4WQ5TlZSYEAwTrli9LKFmhImoKiiciGA+G4JznOExVUGReSjbnzPtu?= =?us-ascii?Q?uNpji8MSd4c+bTDRF5d59rUDya92TwVrvSYLN56uvpD/vAZ0YK5wvEM3vv8z?= =?us-ascii?Q?WYu4Rmx9B7/ouwfP8BZb/8jnbLpxvF/qFvMAwfblmfQ6IEyEvZqL7Hg0GKdT?= =?us-ascii?Q?xkrxpd4yhfXwSRQkhdSX4WsybGiWeV6juNWoM8ViOmc1j67x9zThhPlw91PZ?= =?us-ascii?Q?cice7ctcvWnX7qw2e/sBxOEE978N1G+/mVz6p8RjGzbTZwD5frdFGNgjuoD4?= =?us-ascii?Q?IA=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c97909d1-7607-4232-8602-08dcf36a0452 X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 13:53:04.5859 (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: 3qzig9AlGbVMxyRa1bPO2fjsfl8X9GyzfAv48I6T6qub4qCL2UDoJM0L0hRrH3O4g9p4Oge8bohzCGt9jwnHXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9683 Content-Type: text/plain; charset="utf-8" The body is a bit hard to read, hard to extend, and has duplicated conditions. Clean up the "if (many conditions) else if (many conditions, some of them repeated)" pattern by: - Moving the repeated conditions out - Replacing the repeated tests for the same variable with a switch/case - Moving the protocol check inside the dsa_user_add_cls_matchall_mirred() function call. This is pure refactoring, no logic has been changed, though some tests were reordered. The order does not matter - they are independent things to be tested for. Signed-off-by: Vladimir Oltean --- v2->v3: none v1->v2: add some more info in commit message net/dsa/user.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/net/dsa/user.c b/net/dsa/user.c index 64f660d2334b..5d78a881ddc2 100644 --- a/net/dsa/user.c +++ b/net/dsa/user.c @@ -1377,6 +1377,9 @@ dsa_user_add_cls_matchall_mirred(struct net_device *d= ev, struct dsa_port *to_dp; int err; =20 + if (cls->common.protocol !=3D htons(ETH_P_ALL)) + return -EOPNOTSUPP; + if (!ds->ops->port_mirror_add) return -EOPNOTSUPP; =20 @@ -1486,17 +1489,21 @@ static int dsa_user_add_cls_matchall(struct net_dev= ice *dev, struct tc_cls_matchall_offload *cls, bool ingress) { - int err =3D -EOPNOTSUPP; + const struct flow_action *action =3D &cls->rule->action; =20 - if (cls->common.protocol =3D=3D htons(ETH_P_ALL) && - flow_offload_has_one_action(&cls->rule->action) && - cls->rule->action.entries[0].id =3D=3D FLOW_ACTION_MIRRED) - err =3D dsa_user_add_cls_matchall_mirred(dev, cls, ingress); - else if (flow_offload_has_one_action(&cls->rule->action) && - cls->rule->action.entries[0].id =3D=3D FLOW_ACTION_POLICE) - err =3D dsa_user_add_cls_matchall_police(dev, cls, ingress); + if (!flow_offload_has_one_action(action)) + return -EOPNOTSUPP; =20 - return err; + switch (action->entries[0].id) { + case FLOW_ACTION_MIRRED: + return dsa_user_add_cls_matchall_mirred(dev, cls, ingress); + case FLOW_ACTION_POLICE: + return dsa_user_add_cls_matchall_police(dev, cls, ingress); + default: + break; + } + + return -EOPNOTSUPP; } =20 static void dsa_user_del_cls_matchall(struct net_device *dev, --=20 2.43.0 From nobody Mon Nov 25 22:53:51 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2089.outbound.protection.outlook.com [40.107.22.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EDA51C2432; Wed, 23 Oct 2024 13:53:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729691595; cv=fail; b=X7/0LPThonbgIWtc6rDLOVb3JHZkYMI9C1qWS9eJanKj5lbwFG431MPlVGm66BkLei0l9al9+5yn3423Pi9jUB8Z8Ij5eAA6GjKoYtinss80d9NzaRAk8xaKSYadULU5CISmAnDD2AlmhhpXg+GseT71j51WebzEt/kRubC8wQo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729691595; c=relaxed/simple; bh=uqehQ4dw8+6/V/ZBC3WY7b9QmihmGeiBooNsGJgwZZk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=ejjLBIN1zvHKjAsP5aPIxWD6XDHroT3fzgQCBUC2zd2jOEJvDOSk+4H3deb1kMDh53TZ4KJUd4bv1WALLpNvgfoXD63QdV+7YW6gl2KJMCbc5ToXjHobcXEPDLOPVQ9N+uvnBOnSqZF7z7i570K9+U4R+V19GUO+7eR7XNtcbP0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=bewmE+0L; arc=fail smtp.client-ip=40.107.22.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="bewmE+0L" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UrtCSw2U489mmYHxk4xmI+UfFI/43gu9xWYAera+/DSfx0bR4dqayTQqG71/tN7fTTcbemZeGJUdrOcRYKUGbe4HJeaeuf23WJs2iP/nph0BVB6R+94k52I2lnnAfSgzdGBEX+tVJJf6bdtCDLvg+4OwzL+KSTa5Pv+Hf97gLuSnQXlJc3M1V/qwSNIfxlE+v2rmSP5sEKVL3VxJzwGYu83K+aEc2Uwqy6T176TUE1F+MsmRyHYCWWUIVCFNHozwUUchTNrts/jioj1rWvaZ9N4Q2Z/17gdJy4ViXrTJpvTcssBq6jK5qN7tMOcbD4pFm1gYh+GPlyKfyOsAvIcG8w== 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=MLrDmDYggFUEiQ/FfLYjaS5I+I5mtrq6iqwDabYM/J4=; b=jQAgLwNLWnOGTB68WhJtO8ow9JGsiZCHNYGAayrUJ2rwL8mg3fcrw4VEoc034D5hCI0mg2qp2dz6OaLRbmeSkSR2OHxGs2uNCZzxQoNhK41rdDkhsIr7gF96CV84ZeGKzlwLBGuyT+qt/oX5IZRw2yLI6P1T8msV4sHNCRdBs5r8i0brC7heCiTOv5s8gEI37kyvBBKSLDWVJPBs3OSgwKz6eozm2NIciEtdRh4ISaXcz66EPck4x2XMXijhbmnLRhxnUeHLXPOSZGdmjG2QJ3mxRlDJwcWcsJksYu5bp/rucE+T60HxRpeAgsX/MZpbCeaCcXZEcWBB17Ux9ttQqg== 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=MLrDmDYggFUEiQ/FfLYjaS5I+I5mtrq6iqwDabYM/J4=; b=bewmE+0LAtrb13hMPt5eM4OSdKUxqHqT1ovLRxgoMnVm3QKHAjsOGQaWe9pbru+bPHrJF1dSJX9rpnRsuM5Lu7X4r8m8WohLkcydRbPgjNNEFgNnm9jon/AZrddRPGtZScUe4fVUbLkzddWiLcoYFAk9uMnJWaREaBXF1ZfY4C/iiHjks6Lxm4Pojj4hvZyfM8QvNWhLZ/HV8EAjb0HP1NI9ufN/oQGWJ38W9iV/PMq8gU31qXMfbuEecloqjwdP5kPN6gQBKMl6AyqGxHOmf5yzhLlZbApdjwJ72JTx72kYwgalQ0kwRKQuDl5OsitoSrBw6p+gS8Ica/js7czl2Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by AS1PR04MB9683.eurprd04.prod.outlook.com (2603:10a6:20b:473::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18; Wed, 23 Oct 2024 13:53:06 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%3]) with mapi id 15.20.8093.014; Wed, 23 Oct 2024 13:53:06 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Petr Machata , Ido Schimmel , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vlad Buslov , Simon Horman , Christian Marangi , Arun Ramadoss , =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , linux-kernel@vger.kernel.org Subject: [PATCH v3 net-next 3/6] net: dsa: use "extack" as argument to flow_action_basic_hw_stats_check() Date: Wed, 23 Oct 2024 16:52:48 +0300 Message-ID: <20241023135251.1752488-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023135251.1752488-1-vladimir.oltean@nxp.com> References: <20241023135251.1752488-1-vladimir.oltean@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1PR10CA0105.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::34) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8PR04MB7779:EE_|AS1PR04MB9683:EE_ X-MS-Office365-Filtering-Correlation-Id: c345ed73-b4b1-4d4f-7eaf-08dcf36a052e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?apG/GKaPQOIdtbDlj0RCRpa+shkkc0SB67KDrZLjEUE5f4x2aSi2PdyKNn0k?= =?us-ascii?Q?oYHn6YbBpgSJQbKYVIGylUzi6+F8FAXh06gf+fOE8VicZfBWYod0GOnn3YYE?= =?us-ascii?Q?PZmBymKC2tv2/p0bQYgmwfpJqglRi3U6KHnBeZvJyp2jcrvSsPq4V8wlpDLH?= =?us-ascii?Q?unFH+kN7DTRaQicUHHrgbDM2yFABx/f9VTmTtXhedu7PGCLxOOZhBll/t65+?= =?us-ascii?Q?qRd40zJKFBoEPSJ+8YhmeCwbN+kfKUshEq4cxGnQeAUdNE6KZzAsBcOGULPP?= =?us-ascii?Q?40SPqK22K38CV6dlUJQ8NPCasL6oxj5TI1FVpAnjeWsK6zDSqfjQ9zslZWOf?= =?us-ascii?Q?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Nf3J9nI3Ps/YFue3urkx2xqxj?= =?us-ascii?Q?Ev8CkpGzrLG07yrZuKSinPoe5zwQa0ALIdABmJ+mLkIwTEpc60BchMdKPbcY?= =?us-ascii?Q?jY2B//9GcpmDy86A9mrcXRNNWPXTpQMFgnmefcgPlDTl/GnkaBfZ6DPXZo65?= =?us-ascii?Q?5fe0mUo=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(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?/KO3QERwpQ55xydBfrUVWMWvpcdBNayqQHGW3JK+F5kSZl9KdkJTuueUYpSH?= =?us-ascii?Q?OGudRSrzfnes2xfrOuR66bhSsDLq/yCK/0EIhlIKkjleEuT6zd32ic9Gdmoz?= =?us-ascii?Q?yVqa2JKcRcGRZ09ksI7tucghpfxl72KIrlh10bwQ0Ygllz2Nu/erDecmVony?= =?us-ascii?Q?PuR4Lf/y642CBVoK1+h5VOxLkLksAXg2BOzf7jtlbqWThUYamYFzjQYB+9VT?= =?us-ascii?Q?IOsTg83zvxy/YhXmQDIxZMqQPAdpRpID2n5vMaCIX+jwY1uqivvCyEWgaWJn?= =?us-ascii?Q?uceU0vhD3f2eqhGfxaI1u8vCRdMYXHL3qQZillKL+BbrdwpxeszJwikZWD/c?= =?us-ascii?Q?6JHqXX3a41BID/XdPeNRidJG6vHoqxckD2vDOGQqCdoUQN795g4u4H3vIC2N?= =?us-ascii?Q?3EdH14XbUFDTdiwzrrISQmv/NfjDSlRZZVGAUHjcnA/n65iTsXGoTf0IUOhs?= =?us-ascii?Q?v5M62BrPAdRRX/2ZywcL4Z+jwYnuxgRhe2fdH8y+7pFR+14vQBkAQvycqLD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2O7Z9uOKhwF8pvh720xmiZM?= =?us-ascii?Q?6AfIbLo8DJzkEIs6tdcdt+d4vWJopx7TMUtD+0KQ9cq3UyB6kqElef1axlN6?= =?us-ascii?Q?gjFw58r5xkjQW5Ks1wYTXkYSrCDW+Zbd+vYfPQayHtE/hP8LgeYAfYATJDbT?= =?us-ascii?Q?0gvUBfrH6SdbII1LudlaJghODZIXZaDTnQzOFQjrRDoQTaIuAJVLmr86+gO/?= =?us-ascii?Q?mA=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c345ed73-b4b1-4d4f-7eaf-08dcf36a052e X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 13:53:06.1088 (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: Cxufpt6MxTYzkZOniscfEq8teBnygjcHK/aU9xusaH9GrfmVpEh0ty1Vd/Mcee6lK4YxijV+izwM2cYYXtoqKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9683 Content-Type: text/plain; charset="utf-8" We already have an "extack" stack variable in dsa_user_add_cls_matchall_police() and dsa_user_add_cls_matchall_mirred(), there is no need to retrieve it again from cls->common.extack. Signed-off-by: Vladimir Oltean --- v2->v3: none v1->v2: patch is new net/dsa/user.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/dsa/user.c b/net/dsa/user.c index 5d78a881ddc2..c398a4479b36 100644 --- a/net/dsa/user.c +++ b/net/dsa/user.c @@ -1383,8 +1383,7 @@ dsa_user_add_cls_matchall_mirred(struct net_device *d= ev, if (!ds->ops->port_mirror_add) return -EOPNOTSUPP; =20 - if (!flow_action_basic_hw_stats_check(&cls->rule->action, - cls->common.extack)) + if (!flow_action_basic_hw_stats_check(&cls->rule->action, extack)) return -EOPNOTSUPP; =20 act =3D &cls->rule->action.entries[0]; @@ -1450,8 +1449,7 @@ dsa_user_add_cls_matchall_police(struct net_device *d= ev, return -EOPNOTSUPP; } =20 - if (!flow_action_basic_hw_stats_check(&cls->rule->action, - cls->common.extack)) + if (!flow_action_basic_hw_stats_check(&cls->rule->action, extack)) return -EOPNOTSUPP; =20 list_for_each_entry(mall_tc_entry, &p->mall_tc_list, list) { --=20 2.43.0 From nobody Mon Nov 25 22:53:51 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2089.outbound.protection.outlook.com [40.107.22.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6ACB61C304A; Wed, 23 Oct 2024 13:53:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729691598; cv=fail; b=KHSkVotNidLF5q2ZKKdy2Fq7OfSLA7RXaTZVpflBlV8xefe0IbjI0zJuuepTUL3wdvNmLgevyHDQfSnt5q+FvxF4yzAKOave3SRLKV0NluScxCRhNVMOSXuNOdSUMeYGEvfqdzQgyu9j+BrZBtjpJFUjZ1TzpwQm3c0473BWZe8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729691598; c=relaxed/simple; bh=J5nqIxJYCbjEiBLFDxqkgyhH2Xb70Yfh/m9zFeZCmec=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Fd0I8NaqWWDL7nbgJEa+1+QVDuoDc9KwSSQRH1uRbgES9nCgJzMDyOYZ4P0uJFM7CeXxgUcw5nOHTv8Jhdeu2Qky3EZg5YL7Du1CIsGBWX3LFL0dYFopXHZsgqDg8D3ZBcFD8q+F6pwCqLLkgbFIS4Pkip61ujhT1XuEnQpmggU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=Bi2jYCf9; arc=fail smtp.client-ip=40.107.22.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Bi2jYCf9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LQRi+rV9oAa3HHvDmed5c4n4Hh94ZFAnVayeb/pIKmqjDUg724gzs/qZmmg7+tNVHSxUjB5FZdU3GN2fI1ilkCcwj8lKMaHRSDvAT+FSkD5VAFRr9LypE8olxYP2CDEMB1f09scQkJn9fAB8aecwnl9bPKcDHxziHob6IP0hDhkpOP35t56xo7HESmJ6mOgfoXEiQbRYxZOO4j7AuV96br9cJthXZNv16V/mrpuY6sCA4YCNtugSbc6KDKM/h29n7lrBsdq/whxLHe+eAbAE8h0QZZfDA9rz8j979Klf8wi64JCBj26lO5DrakHKOFbjGI2SpInVmxwycLW+rJabuA== 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=LQTNKadeoYs6F3NyWhGH5i9TxE/78t/tgdfthC37ucA=; b=Ww8lHbB8PwLiGT2xG1sdI1D6Mi0O9YN1zDvX5+rA9YUE8jqiPkdPmQwwtM9KhUECupwMvINL4iJ3drG7L/wmpenUR+F6WKqn2lQMRxzpNBMMWDtofdZrDJu57uHTAhmWmVSV9pQEZJexGlef4faKItzgPxjLQGAzmVjnY12nfcg+z8ZLlCfeyOwmD1lvbYHsAjc729FQgfQeoKgI3Tya62CK/ebsYeb0ziN1Wg+wcroK0/s0wmZN2h/8VYDHLDqccavaL0yEBtVf0liuLHg0Pv3/O3v+ILd3tvNBq9Peqs9WFSZfNm7PO5vfu2RRSlaMjyy1VYpdfXuDX05wkI9P8A== 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=LQTNKadeoYs6F3NyWhGH5i9TxE/78t/tgdfthC37ucA=; b=Bi2jYCf9l+36wP8Lz34r1Yq+LdyBqjC0Leb5yzb+D/pJ7+wLYs6c8xwLDDtNFepUkjR0MrgN4bwEOUWcvJZaXuuszv3T4lK2je8YP3qFvz3mFTfpXZeOL6gzcPhPveEX2MW9ngNb7vDnmLSIJk4nXQ/K2CbHx6xv1Dph/gcaH/AsFypWzQU2Fvh3vEO7zHFyu+p6VGGnmTvQxWPPkIRhJZyOKeGzIMibQvnYEF8I5jPLqQ3a9JNQErq/IqjDTEUeC6+tA8V0kwEqlzN3K7DhIPrfUvWJxlggVqxpCWVS2O7Ne32kwFlq8yRCy56yqWU10Ou4Tz9Hg49D5/SRx4/X+w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by AS1PR04MB9683.eurprd04.prod.outlook.com (2603:10a6:20b:473::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18; Wed, 23 Oct 2024 13:53:07 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%3]) with mapi id 15.20.8093.014; Wed, 23 Oct 2024 13:53:07 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Petr Machata , Ido Schimmel , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vlad Buslov , Simon Horman , Christian Marangi , Arun Ramadoss , =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , linux-kernel@vger.kernel.org Subject: [PATCH v3 net-next 4/6] net: dsa: add more extack messages in dsa_user_add_cls_matchall_mirred() Date: Wed, 23 Oct 2024 16:52:49 +0300 Message-ID: <20241023135251.1752488-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023135251.1752488-1-vladimir.oltean@nxp.com> References: <20241023135251.1752488-1-vladimir.oltean@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1PR10CA0105.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::34) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8PR04MB7779:EE_|AS1PR04MB9683:EE_ X-MS-Office365-Filtering-Correlation-Id: f4638d73-ca06-4c10-5d35-08dcf36a0617 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?A5aof6VUiVhzorqZfrhIKzS0Dqabq86VfvP34HeS4n0uO42gBtnj0lRwiURw?= =?us-ascii?Q?euJiH82nLDCybv/fbywb6Z5PmQNe4MrYwd+Ke47H6T3W/RkCFWIiRYUdUqrY?= =?us-ascii?Q?D0sOkxk9bFFiEvjmqRE/rJRY5kJCaJ+FYh663bNybbpIJbj4YweqYtCouu5v?= =?us-ascii?Q?qIkRdBifalCzoqluPlxIEz534vSa0F9B4cSc2UOvIDxEenXi+LqVZfKULnhM?= =?us-ascii?Q?7HwLXAoGzDrHk8pXtPL1mcWh2/0QlpQnDLAEfA1D6Mbcf98/B5mYygzFldz9?= =?us-ascii?Q?ROU9I5V5Wyctr1A3h3lAI2dKgQ30MU+OEuEIZ22nZ7K4QRZ9w4ZiOndInCTB?= =?us-ascii?Q?Llg7bqWe3d0OD3ykXU9Oa+QnrI6vTctJ0J4Y/SYiKIY8qiNnM0rF8vYNQKEX?= =?us-ascii?Q?ZKTp3klbXcEho3XpZoP0IA1M60iK0UAG1EQJ9cVlFZKxJt81KylXtZG5V17w?= =?us-ascii?Q?G5wkyqVu3T7VLkexGy+6bkgdolWrSf+T2tnbSSSLF2jax2gfUDjZlV+IYpi2?= =?us-ascii?Q?ZACLRB9Q1wNJDtAIGNGcP7D/tIddadTphZ5oPODqtz/RfUkobTXpt/K5qEHq?= =?us-ascii?Q?FENwulKcn2ao+jeAG89JB59wuOR5KglIqmTbuyFBpB/tFFcCElHZElpPTjB/?= =?us-ascii?Q?VVI6bGVZCHadcNcHYp6nv0ZPZBSyO7/0sH9sBeWk0O9Ck251CmT5KPK9uWxq?= =?us-ascii?Q?QRQkKmusriQ59esrL3TRSCrMSO2m8RUNGaUOpOELBmltB8y1YZVxSSVwoyAM?= =?us-ascii?Q?ZwxPiuOHP9BAFNAI6ld8oKVr8g5CNAdi1nKCJm35OwUdduSunohyPBtZiuSW?= =?us-ascii?Q?yz+fUStbz90SbyAjI8Ereg5HjwTHQ9ymFWWZiWsIaUgvmkFXd5jtRqujakxz?= =?us-ascii?Q?bo/GhTz1jaGjh92T1BAwTwffOeCwJGrw+3QNNMnQ23vtLhPld8dw4l6OZ2dd?= =?us-ascii?Q?lY8G+x1OkyiTsDzMZcUrlnHlQOoBgCHYHY15ZVo3xV9lj6UQIbdiaNbCS2Ko?= =?us-ascii?Q?dpNiDa7QM4scFkvAq5Qoh58TECiRZTYi4Zp3p0sTEVj+RFiq/oSkI/BQU5tN?= =?us-ascii?Q?v5poSmYTFcIdovazRzFqPFlabg69MLMXmTbmubp6TF7IXCn1nAIEeks1qUiN?= =?us-ascii?Q?TOJLiHxCKCj/UjxdOMCh0Hyj6QTQjAG0YCKU97Q7IyU5k94K5m0kPuzAShOR?= =?us-ascii?Q?+EctteVijwfNN/IPMy0sXvC0Obtg1EpAFWVJuL6RZ+MFw+FKCoVSyIHMnf2z?= =?us-ascii?Q?dmwJtIZZMQ0zOQCp43Bx5VPW1kKrI/2jWx2Ia4ZovIoJLpevUVqyyQSz8qeT?= =?us-ascii?Q?zPjlbsalT6XIm8XZgXIvV5keZ54IE/aRJz9sFQycwbA4IOou+cssuejklL5G?= =?us-ascii?Q?ONHN6LA=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(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?64S2PlVIKRXIG64UjwsDWHgETSOSu/t1MXZWcSuJRf2V/GkouFRTpO/nLCXl?= =?us-ascii?Q?TIkwbTvYD8Eeo5S0HmTFuw0VvJOvTeHqPwzbbO7LuXVwPBYhB7KVhSrORxcv?= =?us-ascii?Q?ld/RPHf86JQtXq+f9/7tv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?Q?ysyJi/wN72Owb77OYdKyCmISFPmQCmuaVHFIZomSFIkfFYEn+/66rONsIIX/?= =?us-ascii?Q?lfco1Q/po1c+zUh8m1eK0c5KkMSNXHkKjMEhjT7PdmHpHboToioaTqovvh1z?= =?us-ascii?Q?s+8f7QQlbEmCyBNzcqYW1+zhj6hz8IUoa1RqjAT2CwUXmxFoySgqK0uU67I1?= =?us-ascii?Q?VydsnDtzRrc0ejuqZblt0y+DTK+MeqXg4KYseF4gj+hrCLyxv67t7iHkXfHr?= =?us-ascii?Q?+EIOSfalUNISZzq9g68PsWQvueWpC5UtobMlkixEhmmyEuP+moQYRx2NNHsl?= =?us-ascii?Q?tlW4jzjgws4kEEEKZVb5HCgUEZ1D2O3ulqFPxC2M/tZuYNo1oIY8ra3lD9T5?= =?us-ascii?Q?LcY1/tHHD3L625tiIXsdkMcY2SR61aqQmppy31wS7qIxdC4G/RxtjEcwM651?= =?us-ascii?Q?Xa9tKLq/Ly3pqc63V7Qvu9bf6Iw19/MXozaQywz2hOY+DvFrJn7Rn2RG+POz?= =?us-ascii?Q?tiucU9kMKj/Ddr4BC47asEvmPNgQAanmsInP7q6gberQSHrIICJvGvs4BWz2?= =?us-ascii?Q?Xo+oAyxLbwktM31SFCVFraSTl0C1ZGDsMRm0fTpPDMnh0c+Tkamv+wGyfX58?= =?us-ascii?Q?Gw=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4638d73-ca06-4c10-5d35-08dcf36a0617 X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 13:53:07.5854 (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: QBdOwFkJ9yZ0zkbLF1WBFDSHXjRJnOeu/ntfFolzAbagDlImVcHHhFDam350usKGMkXJd0y4xwgri1EVr/wy1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9683 Content-Type: text/plain; charset="utf-8" Do not leave -EOPNOTSUPP errors without an explanation. It is confusing for the user to figure out what is wrong otherwise. Signed-off-by: Vladimir Oltean --- v1->v3: none net/dsa/user.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/net/dsa/user.c b/net/dsa/user.c index c398a4479b36..2fead3a4fa84 100644 --- a/net/dsa/user.c +++ b/net/dsa/user.c @@ -1377,11 +1377,17 @@ dsa_user_add_cls_matchall_mirred(struct net_device = *dev, struct dsa_port *to_dp; int err; =20 - if (cls->common.protocol !=3D htons(ETH_P_ALL)) + if (cls->common.protocol !=3D htons(ETH_P_ALL)) { + NL_SET_ERR_MSG_MOD(extack, + "Can only offload \"protocol all\" matchall filter"); return -EOPNOTSUPP; + } =20 - if (!ds->ops->port_mirror_add) + if (!ds->ops->port_mirror_add) { + NL_SET_ERR_MSG_MOD(extack, + "Switch does not support mirroring operation"); return -EOPNOTSUPP; + } =20 if (!flow_action_basic_hw_stats_check(&cls->rule->action, extack)) return -EOPNOTSUPP; @@ -1488,9 +1494,13 @@ static int dsa_user_add_cls_matchall(struct net_devi= ce *dev, bool ingress) { const struct flow_action *action =3D &cls->rule->action; + struct netlink_ext_ack *extack =3D cls->common.extack; =20 - if (!flow_offload_has_one_action(action)) + if (!flow_offload_has_one_action(action)) { + NL_SET_ERR_MSG_MOD(extack, + "Cannot offload matchall filter with more than one action"); return -EOPNOTSUPP; + } =20 switch (action->entries[0].id) { case FLOW_ACTION_MIRRED: @@ -1498,6 +1508,7 @@ static int dsa_user_add_cls_matchall(struct net_devic= e *dev, case FLOW_ACTION_POLICE: return dsa_user_add_cls_matchall_police(dev, cls, ingress); default: + NL_SET_ERR_MSG_MOD(extack, "Unknown action"); break; } =20 --=20 2.43.0 From nobody Mon Nov 25 22:53:51 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2089.outbound.protection.outlook.com [40.107.22.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D1A81C57B2; Wed, 23 Oct 2024 13:53:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729691600; cv=fail; b=FA+3fD5L2F1UXgr6pvK94MK6l1JtF/MpyOEyZ3QkkLC+A0uwC2uft29KEyQQiU/lurxC/CjsyxDkY/8YX9SDeaH8ZWmaDkogAPvBo6N4NU6l6yvbwMnggGT65pO1dswRZ6Y+uTZa92ZBX8QlfFgt9U4NMqXa6MgoGpYUaumlf+c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729691600; c=relaxed/simple; bh=lrGkvdsI6XLjEnZzrR73ZfsBLSRkvTMFWldVUxxDBjs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=UWRbESiaRd+ww2XuvtU33/jqC/9+rbMilp77/HvfAEjUkFNhiEfp6RjvR3Ot7HLh8XaEK4YVEsa8lTFDC06U3IhoOd3FdxHiT5tp/WSzF3RzSm0tUv1qjmfAek5wAgsVkyH5jigroUnTkrHZ65HPeHHjAFV4qv9a72Z5oEr9MAw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=lNInH8wM; arc=fail smtp.client-ip=40.107.22.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="lNInH8wM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jEloULr0oWz26vQ1ggeFaDf8dlNTTckS6ZdDS4DsfT+1xfaBofBS5ch9O1ZLsWUo0hgdK4IwG+83fVlBwMTqk9IEjndi0KPtnACehkX+k7ggEXHWVEdyhTu3w/1K9ocG2Ssyg4PfT4DnkiA7Pe6ltsjUbT5L1UkOlAG39gEA3Uzm1jzBhRpSUyxhSPfG7kDSCQTQn5l9MUXFTIGVFfPsnrGgxGylioEseyAEH87vo7jGBzjdRVhReDsMytf+pQQDNvTYO5zIVfWVlTr3gKkscNeZXN65JkXBgSBKdq0G+5n5oCpCFUb/cvOv5DKMzdQC5CHI2+sA2/gq9AUTdw4Krw== 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=Rxg9EYijX80sgLTTaQx7ElHE1MHgP92O8KU++Jqszbk=; b=oBC2Ok08waQjLGFKYUY1lhoZUYlKcWuWqMcdp7jxYgTwN19AQLkNcVynnjjccjuMh9uMok1dsPLLocEuklp3I6+wYK40t+1OaBnmLxrn1cD13BHimEA4gQY+eOq6yNo07cRVLrsXX2zyBIp8tRf13XtmNvz8cAR22Xs0gbxNUdlBEVr3oCh5xPISidSGRjoH71tys7CYwGqxZnUQZKq144qY/kkP02kLGTa3hHR1zLrXm0Hon2FmrZBKIKhV9aQQZCB2E5lPtEa0RTPXNa/LzeKqehaNYBjYZeqhWiWWuSb6wBzYaxdlqwAQblS9UBeb1ymNTiqq1E3zixXIHOVe4A== 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=Rxg9EYijX80sgLTTaQx7ElHE1MHgP92O8KU++Jqszbk=; b=lNInH8wM+TzDrSVRQw09wJhrbseocEOkS5ZX45btIVUntEiGamASm68YR/nL5vgqzstrXsbnWLSN97g1ukE1Cx60tlar4V5IaTXNP010c1J8x8PZoT/0PZXC3qiqruAFGsinBWkBC0lHq7qGC37ajpunKKt0WUwTybiOSDeRec1w0wS4+OUubi0mfgv5KVov0d7uiiaS3ZbKv1Xs7YMOXOhmRjK7EgK9pkOuw8/en3EcM9yoFztOLHzAaICx4WGkyUiW7GyD7eTAGD37JM4N/Us7CuhZ5iy/TyzpECtR/rRs39WJ8WjLgQo2vMKuom8x9OEXwpYadTeNTVwmjCHSDw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by AS1PR04MB9683.eurprd04.prod.outlook.com (2603:10a6:20b:473::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18; Wed, 23 Oct 2024 13:53:09 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%3]) with mapi id 15.20.8093.014; Wed, 23 Oct 2024 13:53:09 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Petr Machata , Ido Schimmel , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vlad Buslov , Simon Horman , Christian Marangi , Arun Ramadoss , =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , linux-kernel@vger.kernel.org Subject: [PATCH v3 net-next 5/6] net: dsa: allow matchall mirroring rules towards the CPU Date: Wed, 23 Oct 2024 16:52:50 +0300 Message-ID: <20241023135251.1752488-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023135251.1752488-1-vladimir.oltean@nxp.com> References: <20241023135251.1752488-1-vladimir.oltean@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1PR10CA0105.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::34) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8PR04MB7779:EE_|AS1PR04MB9683:EE_ X-MS-Office365-Filtering-Correlation-Id: 32c9522a-1acf-4874-f62d-08dcf36a06f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ZRsbP6jscWG7YU7cMPWM3EX4ncsCVWr/fajgn9a+4/RrKSQxvvxanCU2rdHy?= =?us-ascii?Q?oA/tdq6+MC50lyTHWc5rRxC/HuAvABqDtygPfg8SkUaR7VX+bKjaopZSSxWO?= =?us-ascii?Q?H2pvTMYiUG+xAlLjKuEvbcNxE2GA+MVUDvz6/z32pUfnRY0PhG+v2cLwMc44?= =?us-ascii?Q?cu40HIBTiKTXxEx1KTXsK3w4B3QL8B2CGE+qCCk3DVfjBO2rgoGLo5CUO/OL?= =?us-ascii?Q?BS2T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eKpgNHxQvAvN?= =?us-ascii?Q?7zUHglb8YIJLuCEMYaO8MK0rT1VEqT8o9M9Vn804nmyDhFZ80iIngfml4mAK?= =?us-ascii?Q?eMXriK3XT1wPgQL5g86IuVwur/0yzOC1Ucioqo6eRd6mV0e/7Y6gfDzbviN5?= =?us-ascii?Q?E1fYEmtTqDVziCRIpswit8U2MbW2g6mNbBs++l2dkUdIfZjR/MvjyR0EyKOi?= =?us-ascii?Q?w0Jimea2TjRnFvr6KcqE80b6kFUejW5YcU7FhwYXC7xE/EBtAOsFTN8ecuQI?= =?us-ascii?Q?kqHg6JqkJVELeVOJcE9/BFX7n87G?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(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?AQd5YbzBmLXHsMoPetK36PstV9NWMN2CW+HdLK9J/Zyh37wxz1LnkaepcxDE?= =?us-ascii?Q?efokZeBD+3hEpg7w0Xq2C1oR8yw3LNFeSrdmDqFrmujdhmF3h2MqVNHhGB/6?= =?us-ascii?Q?i/gyMEnwDcqCKonvfEeOg7gu5PdgFZr/L/PVvc/pQfk9daxpbWb3c4zCypBx?= =?us-ascii?Q?P9nUDa4Uh5ub+gWuWjZt06XcsnHZ3v5nbjk3X9YsQUOX9arVw6Ll0ZoAzEz0?= =?us-ascii?Q?AnOppZKZZiXdxYOBOeMgSaMjz/ACmbpLx5G9ezwOXXftxGI7iyrUgK3c0xCl?= =?us-ascii?Q?9oLFcnQfHOEKZy3MBBAMmyRS8TuVJUpJNbYfo0D4Aa7+6hbRD5XIDDcfRIxa?= =?us-ascii?Q?Ax12ty0F1ceLFIeeH2ojqvnY3wvG8IdxlR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FYPOPMK+4hOlcIZ78XPm2HBzVuv0Nck+oPUDwx3bpo2gaI/tfWZAW?= =?us-ascii?Q?WUmEBAL+YR+tJ/V7NwvwWbxZCcNkEGOY+7jNEBSLiC9ZJg+0HdlEhPHy2Pgu?= =?us-ascii?Q?Di0Sl1o0DiM+fi/S65uUvBw0Z6qmVuhBH7p1uzMatMDWn2m5R31QoA7N7pT8?= =?us-ascii?Q?IncD05ls8CuA8NJsU61RcBTOyejVadUPc00MmfWRSeHD+XiwrBW4Ozh+Y8bH?= =?us-ascii?Q?hv+8Q7EvNZuYZIt8YP4/2Gu+kBM1yrqC4ACvcJhVoaOGOuTUpfcbNzIqsHuV?= =?us-ascii?Q?RFrcEdOvnL6AwTKwz6sKPY0Y3GTVsbOgrugJ2mlHdtWR3pwQWEmg8DmZc6Fk?= =?us-ascii?Q?0w=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32c9522a-1acf-4874-f62d-08dcf36a06f3 X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 13:53:08.9924 (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: 8dXe9QsUIaCOt8Mjxg3KuF/VGAJj9IW0R3KTEUAFrLWfkWxSaHEOjCu4prgeUu8p8DWeE2c4gRVEQQwG2XfNIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9683 Content-Type: text/plain; charset="utf-8" If the CPU bandwidth capacity permits, it may be useful to mirror the entire ingress of a user port to software. This is in fact possible to express even if there is no net_device representation for the CPU port. In fact, that approach was already exhausted and that representation wouldn't have even helped [1]. The idea behind implementing this is that currently, we refuse to offload any mirroring towards a non-DSA target net_device. But if we acknowledge the fact that to reach any foreign net_device, the switch must send the packet to the CPU anyway, then we can simply offload just that part, and let the software do the rest. There is only one condition we need to uphold: the filter needs to be present in the software data path as well (no skip_sw). There are 2 actions to consider: FLOW_ACTION_MIRRED (redirect to egress of target interface) and FLOW_ACTION_MIRRED_INGRESS (redirect to ingress of target interface). We don't have the ability/API to offload FLOW_ACTION_MIRRED_INGRESS when the target port is also a DSA user port, but we could also permit that through mirred to the CPU + software. Example: $ ip link add dummy0 type dummy; ip link set dummy0 up $ tc qdisc add dev swp0 clsact $ tc filter add dev swp0 ingress matchall action mirred ingress mirror dev = dummy0 Any DSA driver with a ds->ops->port_mirror_add() implementation can now make use of this with no additional change. [1] https://lore.kernel.org/netdev/20191002233750.13566-1-olteanv@gmail.com/ Signed-off-by: Vladimir Oltean --- v2->v3: s/cls->skip_sw/cls->common.skip_sw/ v1->v2: allow mirroring to the ingress of another DSA user port (using software) net/dsa/user.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/net/dsa/user.c b/net/dsa/user.c index 2fead3a4fa84..6b718960f40d 100644 --- a/net/dsa/user.c +++ b/net/dsa/user.c @@ -1365,7 +1365,7 @@ dsa_user_mall_tc_entry_find(struct net_device *dev, u= nsigned long cookie) static int dsa_user_add_cls_matchall_mirred(struct net_device *dev, struct tc_cls_matchall_offload *cls, - bool ingress) + bool ingress, bool ingress_target) { struct netlink_ext_ack *extack =3D cls->common.extack; struct dsa_port *dp =3D dsa_user_to_port(dev); @@ -1397,10 +1397,30 @@ dsa_user_add_cls_matchall_mirred(struct net_device = *dev, if (!act->dev) return -EINVAL; =20 - if (!dsa_user_dev_check(act->dev)) - return -EOPNOTSUPP; - - to_dp =3D dsa_user_to_port(act->dev); + if (dsa_user_dev_check(act->dev)) { + if (ingress_target) { + /* We can only fulfill this using software assist */ + if (cls->common.skip_sw) { + NL_SET_ERR_MSG_MOD(extack, + "Can only mirred to ingress of DSA user port if filter also runs = in software"); + return -EOPNOTSUPP; + } + to_dp =3D dp->cpu_dp; + } else { + to_dp =3D dsa_user_to_port(act->dev); + } + } else { + /* Handle mirroring to foreign target ports as a mirror towards + * the CPU. The software tc rule will take the packets from + * there. + */ + if (cls->common.skip_sw) { + NL_SET_ERR_MSG_MOD(extack, + "Can only mirred to CPU if filter also runs in software"); + return -EOPNOTSUPP; + } + to_dp =3D dp->cpu_dp; + } =20 if (dp->ds !=3D to_dp->ds) { NL_SET_ERR_MSG_MOD(extack, @@ -1504,7 +1524,11 @@ static int dsa_user_add_cls_matchall(struct net_devi= ce *dev, =20 switch (action->entries[0].id) { case FLOW_ACTION_MIRRED: - return dsa_user_add_cls_matchall_mirred(dev, cls, ingress); + return dsa_user_add_cls_matchall_mirred(dev, cls, ingress, + false); + case FLOW_ACTION_MIRRED_INGRESS: + return dsa_user_add_cls_matchall_mirred(dev, cls, ingress, + true); case FLOW_ACTION_POLICE: return dsa_user_add_cls_matchall_police(dev, cls, ingress); default: --=20 2.43.0 From nobody Mon Nov 25 22:53:51 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2089.outbound.protection.outlook.com [40.107.22.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D77611C82F0; Wed, 23 Oct 2024 13:53:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729691602; cv=fail; b=LH+DGEhhtxlvCPNY5SXIqA7/wd/i8PtW/dULNvebeEYn4WuItKF7YxmedEPYPzVKmX3QkXM4wkUR1F2iGDUH9Ri0LEuyTRi9UmIdpECPKXezdTCEHengUmxSNuBdsl/3UZm46/1cux8yyfJMOOlScSe1xxLSMDa4j/ovLUcvYWU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729691602; c=relaxed/simple; bh=qDQ4/apa5Np7DxGWe6lGoYYxJFhwh5/w/d6B/gN64uk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=h0Gpxc00UADtrfq+FiUKP96DsrKuMKDUWn1loL9CcWAZcVLBp60m6Gz0WNBgVuWimVBbsF1tE16irVf8QEGQxVI9/GG/aC+D5N631XV76FBSM2X6KjSc/GgMDgc7l82MHN36gUEKhmZ3V+jQKQsVr4oWWu+lzigOBNguzA8+rqo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=jsRC3kJT; arc=fail smtp.client-ip=40.107.22.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="jsRC3kJT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L8XftjDaiDdxLqNCQmM83of4erS2zY5fUtwywEp0GM9B7U0K1EstZPqLIA0MgUtAv3YJHymBXqo3Of3qhF3D+oK43ktNF3iK4ZEbyURCTYABiFcmavteElD+uc5vPTrwT2wqZw8dGPmxWmDLwgbwlP2sYOTBHI8FU1sYary3711BTJOv1OgTcAKf5rHWTCr/CN5ioLqXVvAJ8EaXmCuR1Fun+hE+JCAR6Ghg8cOh6QRSGoPWqAlIgSvYkcT5bJFry1cBypuoE6za+Oi7tmV8Vxi0woLQsg8qt0hhrSmcfA4cjJOEFzdDfIvQOjSxZOafDmPkEaF6tM1p6hJfMASTmw== 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=GJhl1Detx37WtzzPxfRpyz7V2fR+D6VNo/usW0FxOm0=; b=YeTJ/YH1/HV8DHlCx7mYY6i4YvPs7+8PyDR/ScC6eIvogD7N4ntfGdblb190hBX9ZK7YiK5eOCkNUGPEz7CEVKsaNsXcnGNCI2Fk+5DeHOS16LOUNPaQjoTdaBQLGGW/WbhdEItCLb7kyc10tv3JCe+KzmGbab3jIFa5gLT8B8QruglyqPbUPCM8uRahlvfRRa0ZATTC5OgDuxuiwgXqJchp0+xG+aBRgigbAlaKTOyJkAeFs4m8CljNisw5LyKku34rq2DB1xIZZ4HL/ErgDNtjDhSVJw3OkrcpoWw4B24WaMVCOH+qCwMXPhxGpeV8SAIlKWdEPA4ds70yLIIeSA== 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=GJhl1Detx37WtzzPxfRpyz7V2fR+D6VNo/usW0FxOm0=; b=jsRC3kJTVpHQrh7eC6+FYPiKniNbK2Q7L+NlIeRm42Ez3ahmrr/96Tvat+RoZxWwoe4PERU3/S7T0/XDiLx+DCDPyU78DCG6InFVhEEZ4QBeGpYmneoQxAAKTATuLT1WchQjdtOsvZrP0OKbPC7MkVaZ8P442Dbr2AbtU6lbvxp8eM/zoG5Z0A4wxagz3r72XrKFnBDcZK8wg13qkHvOs9Wm2+d2rTYRR4UnlcOb/M0bHta+TcWmC+zRMv4tywuS+p7fMhzCy9Nrhcm0sVzfR1/1ZuCW8VhAUaljvm5wmC5vHYqrcY6H6xsmj33M1NsiwihCizjME77LR8YgJXRdMQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by AS1PR04MB9683.eurprd04.prod.outlook.com (2603:10a6:20b:473::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18; Wed, 23 Oct 2024 13:53:10 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%3]) with mapi id 15.20.8093.014; Wed, 23 Oct 2024 13:53:10 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Petr Machata , Ido Schimmel , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vlad Buslov , Simon Horman , Christian Marangi , Arun Ramadoss , =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , linux-kernel@vger.kernel.org Subject: [PATCH v3 net-next 6/6] net: mscc: ocelot: allow tc-flower mirred action towards foreign interfaces Date: Wed, 23 Oct 2024 16:52:51 +0300 Message-ID: <20241023135251.1752488-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023135251.1752488-1-vladimir.oltean@nxp.com> References: <20241023135251.1752488-1-vladimir.oltean@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1PR10CA0105.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::34) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8PR04MB7779:EE_|AS1PR04MB9683:EE_ X-MS-Office365-Filtering-Correlation-Id: 44b3559d-3226-42f2-5f4a-08dcf36a07cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?RrsnBsbfGVqFo0rmpBfg3938QxBRi5rlXYhlV10Jq3Y+btWKrZNLgzzRsx+i?= =?us-ascii?Q?NM7q1lgKnJtjDLAhX2zrq/2vVs1xqvHlf1AeoGbkikdWJyNMqwfzvMQL4bS3?= =?us-ascii?Q?a3t8TffYNMuop6yhehQoCxVQ9j70PbwQQxKOec3RjoVB1wKWgnoyOorIvMeD?= =?us-ascii?Q?GOMnT5y1ODJ9QiAUOxca2lFlmFoHyt1h7clnfMSJTwyiufZtbZ1pq7MhWTIo?= =?us-ascii?Q?zsDPD+bUliNu5Zz6dPlrc2KLt1zKRYIt89+IHoNOP1LXAojyNzwaVhL5GKQq?= =?us-ascii?Q?U8HCdozZvaSda5ql2XWP8j+kr4yGL4Lpmt07GoAvFNryOw6f31+mpqC1f9K2?= =?us-ascii?Q?bnosGp0h5sjppR+x4Gs9y/i09OCIE0HPpk2O+o2VIRdH1tUIA4w/T91bi9h/?= =?us-ascii?Q?NrY+9H8Imn9lQDAhAPXZERjwKcVCwQoceXVqh5O3f39/i/efBjou4w0gxZZH?= =?us-ascii?Q?2+lvLZ+FVxtfsdOyxiaxF4AOs+LI29wKYm4+83GqyMt0+uhMuRe5q6QHdBrY?= =?us-ascii?Q?+tznTblWSbCrnBiArerz0JS//Yz1cRVIMW3JEsMSj5TTONF95EAIhpKe56M0?= =?us-ascii?Q?J/sJAX/CxmI9s2FeJep0XT6eBlnLr7K6sUZR1cGlhQ1EuLBpgqbRGp7ueB48?= =?us-ascii?Q?CwpIrTUDjXivZMSVEFG861owC0Pjcf1KkoLQsoNgg5lgIoInGq/hyMgDrbTi?= =?us-ascii?Q?QEW/BTbJeiVKVdM1swA49mYLpfcumzBqxuK8F6uEFvfD6YbjOTdaHNL/Xyg4?= =?us-ascii?Q?AwshmH7NpgWPeFQIqzBJ3VuQM3N9BWEKI2SqFIvNpMuZgwcOx0Vt6g8+uYT8?= =?us-ascii?Q?UTwJLcMJpKwF5Yxso1zyZt54gGxbWeT2/D4wmU4wzQs3CHKCP3KlOEe+tBbC?= =?us-ascii?Q?OD1PFdspIT2X41XhTnv0lbODT1utLv4gKgJLUr1U30SF8yA0aMBtwWTBgP3q?= =?us-ascii?Q?Mrs5tKKS1zzsmMGaPWtR/AMLtHXff4A9xB7umNfp2ekQfsLLpkDRbIzZ5JZF?= =?us-ascii?Q?AjTZUF8ZVbcfups92NWBdG3lqE5TM1YtucFzRv8XZMhyY5zm8AxtU9K1W4Op?= =?us-ascii?Q?iCkVV8hpbmvxQtgEcUCOP46n4MEPIxA1FfR4qasJuwdIP76szz9eEprBhjQx?= =?us-ascii?Q?bEvCLRmftQhhWYR+wz1w/vzi0Ub0mPi6lltStWhCyzC0bw2fKcBqYC3B8ilT?= =?us-ascii?Q?I7WnqQNhqdmRWBuMn69co5ohSAEt2d4nwxB9DsQ6+CkP70i5nI+5iHJdhY9B?= =?us-ascii?Q?0x51NSs7vsInaM06EPxAX4/fwZRWre9tw8e/XKgIVlLEJLIAMbS3KncGvAC8?= =?us-ascii?Q?8nBc23junDcwvi2eiaJmME4vpAyfJeV/RoraEHKSUIp6ueSghb1hXbjVw+72?= =?us-ascii?Q?ykWnXeo=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(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?6vDxSwcFzfLr4o1LoS+UH2jdiCtwjJQoEnUSCi67e4eDbo4x/a4Q2aFRUV95?= =?us-ascii?Q?sC+tAgseWGQf3QWHIgGr6siWL/Td2hQCIuNONKL3UKQB07gGKiX9e5nNqHJ7?= =?us-ascii?Q?C81++6I27+FE6ImSM61y0cpip2FuqRc9DLBWpOq7JM7iLPOC9R3HN+8/FelL?= =?us-ascii?Q?8uorTfvHgmOomgftaeJkDPNZLb5HcsDAMknMl4/yIbgHJnCJSwmjDXarXKWS?= =?us-ascii?Q?CE5bj9vars2MLN5QbxAbpSGvJD1wMhXKyHeLBg0g9hvRciOamdZr9GQsvmeI?= =?us-ascii?Q?/iOkzGUT8tguy/E/6zVxbjvOhpUbqDcoDBO7+sPp9Bhr8/B0WIuSxYvGLJNX?= =?us-ascii?Q?AsiKuo14CzxiIGbOxoEcTW9OpfxsdS2jJAI4G6bWT0TfkRXXqD3J7mWV8ZnK?= =?us-ascii?Q?xcXf6K+O+3LKyoBYpJGp6q3p3LSRVzB7AmgyHT9Jq84cjyAkzMQHetLCYvEK?= =?us-ascii?Q?f/YiHwXbew1t3GBcTxit8f9KqF1aV3NGSPmjCaJ9hGK04DN3hFhfqUdCJiLm?= =?us-ascii?Q?qyge3a8qL8o9jXDhN9nf9gd8mAsx8baKLLyhwK1hvQO0J4XsrnX7a5BJBHgd?= =?us-ascii?Q?sxCyRmb+rn+SSNz3/e6xpJYfReBSWIdJdIQiNhL2+LH3qWpQiYotVNU4U+n2?= =?us-ascii?Q?oli1PUWvVc68A5xs429ITwbcEEaAURc0FRBfFEej38qIRyfjMdHQX2wM+IU/?= =?us-ascii?Q?4Nzdo1JKOvIofTYTumEURpxQ3jsr+xCik7VIWPELx8H7TCNPLuj4pyfOzJtb?= =?us-ascii?Q?rKmeQINojfEU8J/glFuI8oqnNlcACfZmT937pJCeMaavPrMigoigQ1ZOJSt8?= =?us-ascii?Q?nJHesf4d5mZk01Q7e+ZQngj3KyOs76S+89Hg7hWzrhZf80E40ur/AqSDUVdo?= =?us-ascii?Q?cDkhaUe1Yp13o63msdFJbujHSnT136zYbdBlYp6YA6ThmrPqcsXls3szBkap?= =?us-ascii?Q?IgWNttkXiWMJaqUlb3JKGA7CCh6jWmj3zbFtDe0yZHxkWwn6RKdcPMh2egGX?= =?us-ascii?Q?T1rIHYNsOSGMKV+fwiflOulujdNoOdMFU8IaIwGWXFWyUMTcwL6tNHp53p09?= =?us-ascii?Q?f0LsFrWnnNrt7h8LpoF8kBA68PvlRIYoaMD2T7LAD7fYdC6TdwD2jXg06CFt?= =?us-ascii?Q?T2vf6gzeGUNADvkob2nW3+/CK6rjgzDvfAuMPdujvnYWrpp7m0qSbpSzr3NU?= =?us-ascii?Q?9oDDq2wUxc27IBnE3r6aR0sOCe8lFnK9vcq4ZAFYo9Dpc6I23c1y89dy13s+?= =?us-ascii?Q?B2BYeL7BIi9vei9CnInemgjWa84SdLlrdVL2xhwWKUEywQF/XDnYMc6IhDPU?= =?us-ascii?Q?oJwoSnWIhtMZzRpNU/4RJ/MGFZuPpi/Lp0DZP1hrddviftikUp7suUywdnm/?= =?us-ascii?Q?wHpm7kgsh5fHbnS/FEtubtretd3lIg/tEug6hLLx+abjoNJydj9KHo6r5MHa?= =?us-ascii?Q?4NsDDRI7ONKVkIXDNcXG2lB7FkCKDzXL+UT442dafK4hNrDtsy3eqoyrHI0T?= =?us-ascii?Q?fAKQuSkKAPRS1yp/FeV5XvOuhSyrJaw+CB3QFLF7LjKt5Rfuamfb+mMw7/ps?= =?us-ascii?Q?/c3dCne0NQtDIXUlFpXYebWaGqwmveWiOmrd+I4HwToADvvzVSBEcd3nNFuc?= =?us-ascii?Q?hA=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44b3559d-3226-42f2-5f4a-08dcf36a07cd X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 13:53:10.4027 (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: /HOQmtUmMmRCCF50vUVGIC8Ij+I6/NnwnWCEK+Aa0cWX6FHD4bXRiINuEeSZGTCRSLoOzwm8v3hLkXMbQVxBeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9683 Content-Type: text/plain; charset="utf-8" Debugging certain flows in the offloaded switch data path can be done by installing two tc-mirred filters for mirroring: one in the hardware data path, which copies the frames to the CPU, and one which takes the frame from there and mirrors it to a virtual interface like a dummy device, where it can be seen with tcpdump. The effect of having 2 filters run on the same packet can be obtained by default using tc, by not specifying either the 'skip_sw' or 'skip_hw' keywords. Instead of refusing to offload mirroring/redirecting packets towards interfaces that aren't switch ports, just treat every other destination for what it is: something that is handled in software, behind the CPU port. Usage: $ ip link add dummy0 type dummy; ip link set dummy0 up $ tc qdisc add dev swp0 clsact $ tc filter add dev swp0 ingress protocol ip flower action mirred ingress m= irror dev dummy0 Signed-off-by: Vladimir Oltean --- v2->v3: s/f->skip_sw/f->common.skip_sw/ v1->v2: allow mirroring to the ingress of another ocelot port (using software) drivers/net/ethernet/mscc/ocelot_flower.c | 54 ++++++++++++++++++----- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethern= et/mscc/ocelot_flower.c index a057ec3dab97..986b1f150e3b 100644 --- a/drivers/net/ethernet/mscc/ocelot_flower.c +++ b/drivers/net/ethernet/mscc/ocelot_flower.c @@ -228,6 +228,32 @@ ocelot_flower_parse_egress_vlan_modify(struct ocelot_v= cap_filter *filter, return 0; } =20 +static int +ocelot_flower_parse_egress_port(struct ocelot *ocelot, struct flow_cls_off= load *f, + const struct flow_action_entry *a, bool mirror, + struct netlink_ext_ack *extack) +{ + const char *act_string =3D mirror ? "mirror" : "redirect"; + int egress_port =3D ocelot->ops->netdev_to_port(a->dev); + enum flow_action_id offloadable_act_id; + + offloadable_act_id =3D mirror ? FLOW_ACTION_MIRRED : FLOW_ACTION_REDIRECT; + + /* Mirroring towards foreign interfaces is handled in software */ + if (egress_port < 0 || a->id !=3D offloadable_act_id) { + if (f->common.skip_sw) { + NL_SET_ERR_MSG_FMT(extack, + "Can only %s to %s if filter also runs in software", + act_string, egress_port < 0 ? + "CPU" : "ingress of ocelot port"); + return -EOPNOTSUPP; + } + egress_port =3D ocelot->num_phys_ports; + } + + return egress_port; +} + static int ocelot_flower_parse_action(struct ocelot *ocelot, int port, bool ingress, struct flow_cls_offload *f, struct ocelot_vcap_filter *filter) @@ -356,6 +382,7 @@ static int ocelot_flower_parse_action(struct ocelot *oc= elot, int port, filter->type =3D OCELOT_VCAP_FILTER_OFFLOAD; break; case FLOW_ACTION_REDIRECT: + case FLOW_ACTION_REDIRECT_INGRESS: if (filter->block_id !=3D VCAP_IS2) { NL_SET_ERR_MSG_MOD(extack, "Redirect action can only be offloaded to VCAP IS2"); @@ -366,17 +393,19 @@ static int ocelot_flower_parse_action(struct ocelot *= ocelot, int port, "Last action must be GOTO"); return -EOPNOTSUPP; } - egress_port =3D ocelot->ops->netdev_to_port(a->dev); - if (egress_port < 0) { - NL_SET_ERR_MSG_MOD(extack, - "Destination not an ocelot port"); - return -EOPNOTSUPP; - } + + egress_port =3D ocelot_flower_parse_egress_port(ocelot, f, + a, false, + extack); + if (egress_port < 0) + return egress_port; + filter->action.mask_mode =3D OCELOT_MASK_MODE_REDIRECT; filter->action.port_mask =3D BIT(egress_port); filter->type =3D OCELOT_VCAP_FILTER_OFFLOAD; break; case FLOW_ACTION_MIRRED: + case FLOW_ACTION_MIRRED_INGRESS: if (filter->block_id !=3D VCAP_IS2) { NL_SET_ERR_MSG_MOD(extack, "Mirror action can only be offloaded to VCAP IS2"); @@ -387,12 +416,13 @@ static int ocelot_flower_parse_action(struct ocelot *= ocelot, int port, "Last action must be GOTO"); return -EOPNOTSUPP; } - egress_port =3D ocelot->ops->netdev_to_port(a->dev); - if (egress_port < 0) { - NL_SET_ERR_MSG_MOD(extack, - "Destination not an ocelot port"); - return -EOPNOTSUPP; - } + + egress_port =3D ocelot_flower_parse_egress_port(ocelot, f, + a, true, + extack); + if (egress_port < 0) + return egress_port; + filter->egress_port.value =3D egress_port; filter->action.mirror_ena =3D true; filter->type =3D OCELOT_VCAP_FILTER_OFFLOAD; --=20 2.43.0