From patchwork Wed Oct 23 13:52:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13847133 X-Patchwork-Delegate: kuba@kernel.org 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?b?QXLEsW7DpyDDnE5BTA==?= , 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> 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: netdev@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: EArAz6N4H3pzMfm6Wv/Ly5tST4l7hfS31p0b5xs8Cshx4NFn2yBaFomlinVrZtjvX9I7NyU/Hl0kGNkHXxDUTLUyAiwMpTi7V6xBYJFuc5BV/O9QuTrqdipgviNMnBlz1PNt9wFV9X7+Ifxtvypb+rClF7+6JhSw2IfRiriYs1jyRWYxJmbM4JCfYC/w+Q7+rHQbVfFyWU8MmMKJcEe9hMTKYBn6ditAXku+DVlgALb8+MWv4ck5fxqLDKXt/f2z8C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1/wXxTbUTp7fsLo+LPZLZ2vORfB0I0rJoZBoozdfmHpHrNdVj3gySGX+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: 41GZ8bvQu+VAQD7FCBOFIKTsRShQ3TD/M4RUKUQqSLzcd0LBV6KWFIZepJtwG1tHVq4GAA4F6D26Ims0/RzLoJ7thYsAroAMphtxPgw/7bMqWc1QN+i/025kbCRX5fpAwETh+xJDbspDB+ErTpIFbdXJWO/wbiRTBfPoY1XfvEBgKUFjdbdmty3wRpFOr/cy5TO7RZAWyStSWy7cTj1Sw2q2CC+z0mklThMI1cWRLDyHLk9OLcf3U/SgK7w8yNH0DIp+L1PgszDtUJ4NPBjrCB26OGuj36vWHPQKMD73u+XQ6cpmwCUU5NrrYuwuGvrFllI4wyVRfln31OWw3Qq3xqWSqpKaV1tRlZL2AiJgPD0vq63CwMa9Zw2i/VcUu0XGsf3pZzcRBYHOsnHQMKxyZxPxTXcYfdkFewIHTQatqBXLywU7Xb62BxEyeJ98ItVZ30PYF3shktX4miDdczYBJrD30nKz7SP8uP9yjOQHDfUQsZdPpAgfCQA5HDHmKB4YpyNuTvbMkGsHhUEZ9UMoaJYscFfiXkn9eoXqaB3qTxrRzornCX20ZXlkdV+cH4suWserdyhdMBXDdMyelDGJteBRP2KomMVpOqwzOnZ+xBH4eR9WM/3sF6cPvyhPYe42pWWxXHRkKY4Dg0e39ppL7/22dIUnf73RA/0JPevVv/DG+Us0F/Wotbxne9ZgOk4f/jkoUVyzNf8JTypeqycHd2MhZpJYJ3Vpd0bAuERCwYg+8wvjmA/SblCYxtog66bG7smDwogQKpZPXfms/NwzUrik27CNZD5GkmkzYomq0/AQ0d3jpW9OmjMPjZzYPdqLoyqsQ+H6iUMOLKyYEd3THtIvC42r8rUaS4YXYSiEjAjx9AqIFHHyJd7/a6e7NR+RHZ6qs7ih2Ul9o/tEAk8PmRkHzIXxSwUANDBJvaN5PMbMJC3vjt0petSGx/tVbiPtH8C2llMVobVmPI8e2QiS4F7txiF87PU6XHCBy+ZRsfvY97i4l9+o0aZtB3Myc9cqXgsyuRFdwUJJodO7F0NWyvI4yFYzi0KP+3Ww4TJxjldry/bT8RQPdy5Rt69FgFg2VXAcn6wIuxxwDgEJMjNvG08ZOB0AiZzeccsiNPLJNq0sBCyy3b1XBTXHx/EQEU4AFP7QldWlEBfVIYBgwVAifJEO0wlo6LuJuSHEKUN4zPF8T42z7DBb+CK36o9D7MYpEq+Eq6+UNdnnysFu3GLY0yZ8DllMQZsqn55InPbTNQ6M2yMar4PKMRpcwY3lPqFrcfJWYJMsqt+Z8wKTtj21r8cTU2sdMmQu+/Cnfg+Ytp76H1wsgnWx8VE9uOrI+12FNVp+nk3mYeADfNU3zKCUZPd16ofHNUZHRfHaOejPIkgmHuFSjp+sxx3zqlndTquSdzKcNUwSyiPMUdCynTbIC3pjIOQHeFPk/PjvEDf3RlPFJzypVvPcZXs0HxL+8pZqcQWdncgUZ4uODRH9lYNOx9bQ2pyJEwRqN5fWT9/UXw6qx8gjx7MhTZwcIzORa3Lxz5KlEOxFAFCMWxX+tw2F9FdCTUuxd9dkVmph21P7wVqR192g4HBH/ujpEyt16YTB49safAGXFOyoc9+qEpcEng== 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 X-Patchwork-Delegate: kuba@kernel.org 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; }; 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_offload *cls_common, cls_common->chain_index = tp->chain->index; cls_common->protocol = tp->protocol; cls_common->prio = tp->prio >> 16; + cls_common->skip_sw = tc_skip_sw(flags); if (tc_skip_sw(flags) || flags & TCA_CLS_FLAGS_VERBOSE) cls_common->extack = extack; } From patchwork Wed Oct 23 13:52:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13847134 X-Patchwork-Delegate: kuba@kernel.org 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?b?QXLEsW7DpyDDnE5BTA==?= , 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> 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: netdev@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: zauEWOnPF0P3Uv5XHlVloUlHkfBh8rzORBaylRdAiKLLVAczJFiSIlwYo6wt5BLPOdECd8sw0ylHKu6WTMy0Y0dAUlgmmBdOyWSv/XfqTmmf4zh9fHW6C8ZJOWVe9XlIeaEh4mocA77V6rB0ZSRWdfKfLt9NHLR4e2tBddjn7+enPUKHVxUepzOKZQmQAKXelQI1gyPenwhUl25APEndr5r8G0ahh2ZlXwW58DSpJN8F8wDB20GbAEuBGPi0yFYAAGEogxeOTqeFIeeNbnp/rGUJ8TYZpl36yezx6FGuas/2i7uWEjWoQL4xCD168zMHc/LkUcmrphdKCH9vrKSfRafHpQyGF4ldEXbysY7t0Gz/UQcbxml3iy1EYYU3klQp97tI6+KJL//bxlcCJJfl97yP0wRP7HKT8DnCWPMe2bLewnvRPIsrjtauxtbK/e7N6p0jkLUeX1aEiULpke+WGlLEGWTHlWnVkfes3DoHdxray/Uy6AP5yxZBS8/2/SpnizdJhX5ydwGU3J1vOltUOgY5U3vH3gFnlIYv0yFxXufwHIGg0NRySbAye/gUJ704zy3BZ5nuSSMhc7z1QRxIMKSiZ4ei/vrZCtQ3oYSkfmbDav+CJR19ZudB8N5sSftYtJxRKGa40Ijac1I3djURz0aYKl2btvTWPRrNPZ6Zkl6207hHm4i4sMTjhE5lZE36ErgMe7Z/g3pF8LVpK9GARj12mAjCQ+pcN8T/6ZliQNgSV0GrVNLRt4hPzzz1sH38KOvXuHWmVVllFdeDBNT/aHjjBW4uuNHKS+JuyNtnm8TVWx/+BNykCxu1zP0lFvgOKGNDR9vF57b9VW2Xq8XWSGpR7S7RvN45bi2MlRigKHhYrRs0LvMK17GcdNUfFKS+rxWd9jDgvq1yEwRdWZKHVFkrByl3OIPuTooDyF8QnByfPZ2RMDl9q7wQcZqKFeNxJByLZO09AJtCclj4c3kPFzrPS+ivdNUEvFm/7aNkjIbn3+z1WY5V1ot16cl2ovCatpcKh4KwMDxjx8agGPwrgHbnMKjvGEXxOPuS6kjrpsFb4CTJ+EfDHacVkfzduY+H8mOdKvLkCfN/UnyUQLTQn4BJxHkdK19KDIT13MUTidfyhlhzaoCCy7QN/av69eP4viBTAsYHxWgJXlUyndrMyyJCHzPpudota2U8rvidWZYZtDJ3RmHOR9VPNha9JRTVkKNxGAbvXZk/38kzsKO2IRwEa9g/bkyP4/KhIAd3dTIO9hDUKTZMXiVEItbOXAZ06hvX+Lwf+Kg+acaoin1AGyFe+rrVbki5vghwD1x/JZ4+U8cLSByvs73E4zhT7VRlVbEnG5/20jyM26ghaaK6dYnkGMEmgWblH5oot42/kmE= 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: RXawPqTncUO5Fc8EugWMTTc6MLvULCshFzzPcRm+CKomYCStWzDFifRkxYJ9iys/F2qYPIYmcv8+VmcXUU/9Xt0j+neLqtrc7e/KKQXbk40+vZYq04zRTYJMNYxsgEIWJu/TQY8wu4agDaDWhsIrVHbXlvBUkMl0M71kBpGhLEr4uOwPKtrobKjQhfoUHCnXi375r4mj3GTFMVAmO+/sKN9nYsvxkv7YAr2NxJI0ERVqRqAeYwKc8jVOWRjRB4Q+S8OEa71f/E/Ph21roI9BSPisY2Kr95dQl6B8wfNYq98IChYdo/MRcOPZukd4sQEG1nmdOOaDX5Lhx76EN0nb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N56uvpD/vAZ0YK5wvEM3vv8zWYu4Rmx9B7/ouwfP8BZb/8jnbLpxvF/qFvMAwfblmfQ6IEyEvZqL7Hg0GKdTxkrxpd4yhfXwSRQkhdSX4WsybGiWeV6juNWoM8ViOmc1j67x9zThhPlw91PZcice7ctcvWnX7qw2e/sBxOEE978N1G+/mVz6p8RjGzbTZwD5frdFGNgjuoD4IA== 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 X-Patchwork-Delegate: kuba@kernel.org 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 *dev, struct dsa_port *to_dp; int err; + if (cls->common.protocol != htons(ETH_P_ALL)) + return -EOPNOTSUPP; + if (!ds->ops->port_mirror_add) return -EOPNOTSUPP; @@ -1486,17 +1489,21 @@ static int dsa_user_add_cls_matchall(struct net_device *dev, struct tc_cls_matchall_offload *cls, bool ingress) { - int err = -EOPNOTSUPP; + const struct flow_action *action = &cls->rule->action; - if (cls->common.protocol == htons(ETH_P_ALL) && - flow_offload_has_one_action(&cls->rule->action) && - cls->rule->action.entries[0].id == FLOW_ACTION_MIRRED) - err = 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 == FLOW_ACTION_POLICE) - err = dsa_user_add_cls_matchall_police(dev, cls, ingress); + if (!flow_offload_has_one_action(action)) + return -EOPNOTSUPP; - 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; } static void dsa_user_del_cls_matchall(struct net_device *dev, From patchwork Wed Oct 23 13:52:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13847135 X-Patchwork-Delegate: kuba@kernel.org 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?b?QXLEsW7DpyDDnE5BTA==?= , 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> 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: netdev@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: apG/GKaPQOIdtbDlj0RCRpa+shkkc0SB67KDrZLjEUE5f4x2aSi2PdyKNn0koYHn6YbBpgSJQbKYVIGylUzi6+F8FAXh06gf+fOE8VicZfBWYod0GOnn3YYEPZmBymKC2tv2/p0bQYgmwfpJqglRi3U6KHnBeZvJyp2jcrvSsPq4V8wlpDLHunFH+kN7DTRaQicUHHrgbDM2yFABx/f9VTmTtXhedu7PGCLxOOZhBll/t65+qRd40zJKFBoEPSJ+8YhmeCwbN+kfKUshEq4cxGnQeAUdNE6KZzAsBcOGULPP40SPqK22K38CV6dlUJQ8NPCasL6oxj5TI1FVpAnjeWsK6zDSqfjQ9zslZWOfonRv4z/hHgxXeaqu1ABbVo5c3ONN3ndjwzookZeS/m51IrlrrySbWQyCzbwOzPt89VVvoUL1KLVCxRFPIqhpISoRnUYdlZMRuZj72x3DhMMiglRw+/EDeAn7kU9MRm3TU9XkVemKAVyNpWax4TfNM2rHSLHS6UqxAYLLdtAS9/g8h65lHOveaxoJRK5mQ6boPvnPi+95gKwqX6z5Aox8ywNAhj2MZojCC17RYkt/HJSC+2UM8m7Sl2V51nN79fL/de05xwN9Ic4jm0G7nBWoqlxYlUJh5CVH6d3cv8AFflMGkP51gbF2Kc0NS/JU1b/2HQrMbFBfEwhmzEbzNkA+w9pGqV09SYD1iU9BXlkVBknJdkFegWbwru+glb76TPX5fdfT0uAEtF3YcnkzMzq1XTJyO9kOeTgLEwcj8hFJ7EaZYEzkr7YjymNBJQfR6bvBqbqYkAEr3YZSyG9ZinwPaMOpK3ixtbbPz6YYKHpCDbb8oFsITN5L1I+dPfVuySJ6Oekua69DL9SDK4UwknSMx/XvyQVPBDkgEwhjVrgfzuFodPM3SbdrKCc7sUQcRZ7pg0QzEWsxzbrK42L4zjdAhJQgBMv7qYCJBsLr2pRphHpjdJZ1V/pU1ztxMmP9+DZW2rKVPttb2EGpjmWJ74Y62Jeium1vRFzSe3ddHHhQlDmxpfdldk6bPzWaEp9Bz8GgdD0CZLwa1D7DZ/cP/sXm62s2e9G8Usd3GYwQjORfhTRNuIya5ZdUFAdGFc5JUF9S/gpfiTEF5ZrJ7x2Rl804B2WyG2/+wJC7dWTj5qegAZzvBeEDjeFAlU9CHV4/uHTc7r9hyB0HIsRG4BgkGNyDw4kGLCBqqxAbUZL5R0SSVjvNf3J9nI3Ps/YFue3urkx2xqxjEv8CkpGzrLG07yrZuKSinPoe5zwQa0ALIdABmJ+mLkIwTEpc60BchMdKPbcYjY2B//9GcpmDy86A9mrcXRNNWPXTpQMFgnmefcgPlDTl/GnkaBfZ6DPXZo655fe0mUo= 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: /KO3QERwpQ55xydBfrUVWMWvpcdBNayqQHGW3JK+F5kSZl9KdkJTuueUYpSHOGudRSrzfnes2xfrOuR66bhSsDLq/yCK/0EIhlIKkjleEuT6zd32ic9Gdmozy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iMx5dLNUPphQzdWJeGrvSqfPvwHIzVh0aJskskpg+lYk7Uj9xyPC8jjYQ7x4jPrU2f2eW4wzxsmgYDCN57opCR9Df8iut6KfVuoGrrijw4n4tWpIhxpSD5xciisZsZ8TBNPncUgE842CcG0+OcWkvsoyo2Rd0v8dIHmEvzyp2aDAUDiB9HgsikqeF5ZSl3/WJC0ilNasDcI2O7Z9uOKhwF8pvh720xmiZM6AfIbLo8DJzkEIs6tdcdt+d4vWJopx7TMUtD+0KQ9cq3UyB6kqElef1axlN6gjFw58r5xkjQW5Ks1wYTXkYSrCDW+Zbd+vYfPQayHtE/hP8LgeYAfYATJDbT0gvUBfrH6SdbII1LudlaJghODZIXZaDTnQzOFQjrRDoQTaIuAJVLmr86+gO/mA== 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 X-Patchwork-Delegate: kuba@kernel.org 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 *dev, if (!ds->ops->port_mirror_add) return -EOPNOTSUPP; - 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; act = &cls->rule->action.entries[0]; @@ -1450,8 +1449,7 @@ dsa_user_add_cls_matchall_police(struct net_device *dev, return -EOPNOTSUPP; } - 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; list_for_each_entry(mall_tc_entry, &p->mall_tc_list, list) { From patchwork Wed Oct 23 13:52:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13847136 X-Patchwork-Delegate: kuba@kernel.org 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?b?QXLEsW7DpyDDnE5BTA==?= , 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> 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: netdev@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: A5aof6VUiVhzorqZfrhIKzS0Dqabq86VfvP34HeS4n0uO42gBtnj0lRwiURweuJiH82nLDCybv/fbywb6Z5PmQNe4MrYwd+Ke47H6T3W/RkCFWIiRYUdUqrYD0sOkxk9bFFiEvjmqRE/rJRY5kJCaJ+FYh663bNybbpIJbj4YweqYtCouu5vqIkRdBifalCzoqluPlxIEz534vSa0F9B4cSc2UOvIDxEenXi+LqVZfKULnhM7HwLXAoGzDrHk8pXtPL1mcWh2/0QlpQnDLAEfA1D6Mbcf98/B5mYygzFldz9ROU9I5V5Wyctr1A3h3lAI2dKgQ30MU+OEuEIZ22nZ7K4QRZ9w4ZiOndInCTBLlg7bqWe3d0OD3ykXU9Oa+QnrI6vTctJ0J4Y/SYiKIY8qiNnM0rF8vYNQKEXZKTp3klbXcEho3XpZoP0IA1M60iK0UAG1EQJ9cVlFZKxJt81KylXtZG5V17wG5wkyqVu3T7VLkexGy+6bkgdolWrSf+T2tnbSSSLF2jax2gfUDjZlV+IYpi2ZACLRB9Q1wNJDtAIGNGcP7D/tIddadTphZ5oPODqtz/RfUkobTXpt/K5qEHqFENwulKcn2ao+jeAG89JB59wuOR5KglIqmTbuyFBpB/tFFcCElHZElpPTjB/VVI6bGVZCHadcNcHYp6nv0ZPZBSyO7/0sH9sBeWk0O9Ck251CmT5KPK9uWxqQRQkKmusriQ59esrL3TRSCrMSO2m8RUNGaUOpOELBmltB8y1YZVxSSVwoyAMZwxPiuOHP9BAFNAI6ld8oKVr8g5CNAdi1nKCJm35OwUdduSunohyPBtZiuSWyz+fUStbz90SbyAjI8Ereg5HjwTHQ9ymFWWZiWsIaUgvmkFXd5jtRqujakxzbo/GhTz1jaGjh92T1BAwTwffOeCwJGrw+3QNNMnQ23vtLhPld8dw4l6OZ2ddlY8G+x1OkyiTsDzMZcUrlnHlQOoBgCHYHY15ZVo3xV9lj6UQIbdiaNbCS2KodpNiDa7QM4scFkvAq5Qoh58TECiRZTYi4Zp3p0sTEVj+RFiq/oSkI/BQU5tNv5poSmYTFcIdovazRzFqPFlabg69MLMXmTbmubp6TF7IXCn1nAIEeks1qUiNTOJLiHxCKCj/UjxdOMCh0Hyj6QTQjAG0YCKU97Q7IyU5k94K5m0kPuzAShOR+EctteVijwfNN/IPMy0sXvC0Obtg1EpAFWVJuL6RZ+MFw+FKCoVSyIHMnf2zdmwJtIZZMQ0zOQCp43Bx5VPW1kKrI/2jWx2Ia4ZovIoJLpevUVqyyQSz8qeTzPjlbsalT6XIm8XZgXIvV5keZ54IE/aRJz9sFQycwbA4IOou+cssuejklL5GONHN6LA= 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: 64S2PlVIKRXIG64UjwsDWHgETSOSu/t1MXZWcSuJRf2V/GkouFRTpO/nLCXlTIkwbTvYD8Eeo5S0HmTFuw0VvJOvTeHqPwzbbO7LuXVwPBYhB7KVhSrORxcvld/RPHf86JQtXq+f9/7tvv/Ad19N/+wazsvjniWVP9pnEHlFKOOaAXep3b7xM2OTaIoQ0HBBp2kMgcBNrQf2Of+jrfNFookFARMe/QtyfB7Z8nQD7KZiy+esQGbMxN8cqDvg52Jx2skfmDh98xwHhQUsfoaz+eqRjjEhmtFMtIEV8wcgVNydEN0JcOIQJdcH6p+YV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mppy31wS7qIxdC4G/RxtjEcwM651Xa9tKLq/Ly3pqc63V7Qvu9bf6Iw19/MXozaQywz2hOY+DvFrJn7Rn2RG+POztiucU9kMKj/Ddr4BC47asEvmPNgQAanmsInP7q6gberQSHrIICJvGvs4BWz2Xo+oAyxLbwktM31SFCVFraSTl0C1ZGDsMRm0fTpPDMnh0c+Tkamv+wGyfX58Gw== 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 X-Patchwork-Delegate: kuba@kernel.org 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; - if (cls->common.protocol != htons(ETH_P_ALL)) + if (cls->common.protocol != htons(ETH_P_ALL)) { + NL_SET_ERR_MSG_MOD(extack, + "Can only offload \"protocol all\" matchall filter"); return -EOPNOTSUPP; + } - 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; + } 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_device *dev, bool ingress) { const struct flow_action *action = &cls->rule->action; + struct netlink_ext_ack *extack = cls->common.extack; - 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; + } switch (action->entries[0].id) { case FLOW_ACTION_MIRRED: @@ -1498,6 +1508,7 @@ static int dsa_user_add_cls_matchall(struct net_device *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; } From patchwork Wed Oct 23 13:52:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13847137 X-Patchwork-Delegate: kuba@kernel.org 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?b?QXLEsW7DpyDDnE5BTA==?= , 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> 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: netdev@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: ZRsbP6jscWG7YU7cMPWM3EX4ncsCVWr/fajgn9a+4/RrKSQxvvxanCU2rdHyoA/tdq6+MC50lyTHWc5rRxC/HuAvABqDtygPfg8SkUaR7VX+bKjaopZSSxWOH2pvTMYiUG+xAlLjKuEvbcNxE2GA+MVUDvz6/z32pUfnRY0PhG+v2cLwMc44cu40HIBTiKTXxEx1KTXsK3w4B3QL8B2CGE+qCCk3DVfjBO2rgoGLo5CUO/OLBS2TeUDrMBqngwuvLWmZiA2G0nZnvbLfqUlWHiPg+0pUsP9vdwvHhuXIiJOhe7KpOzxgvhHEDlbKApBrkXfpPjoeOWx3MoRl402ZSWIh4THVdKbGLRZk/b8nzC64vBXBiQ0CpqmX3evUfMgWfnyxHNmxSj2dcFgjZxSBHDaBA72lui+uy9xTqMHmiLuv7HHLljAbMcBwAGeFOTVvzyYd2Huc9Zhh0cqA3PoTWoTU2653zzTKpfmaZEEYnDUFzNJK1Z4HNd/9zIcSQy6gRbDTTDNFE0UaXy1x0fYguIlXUzr9P7EoTP8CL7HilHkTV8vy8lVriaW1zjmXpaNvxHkLlp9LHMVsMlFvmwCcyYT1EWlEohr39Fr4dAy1eZUnbZYNZuqJawYKftcSucyiXkBRaEWe9N//hyjOm3c21QDQS8d/gAiTPXzozmQPtS9ZU1l8DkbA703VDknW/SCIbw9IlAfkIE63NbzJG1JuT4KHh1Mg0d8hEEtsPpj0UDxOdSdS65rXUy6PjlpCUeeDBIvMMBN1qxKGO6lciSHGF4p+WtuLMyPNhtrVYTrG0/KFwFxwJSQclSzQRVFQNXZ9cXX/ECDEXUWHpgW6YY0iKvqQrxHZm92WsgLsgVGbKRWchC5SXai3AwQO1mBV30gRyp3bSaO5vlPIF2WmTOitogporeFm1w0uYyoADlSbnFhIWNJjsHknB9tfOdpqSnHPI5h5IzaS8hxpy4KK3avXAY4wPXgt0svb3bzbdvalI93cwXIZWcEcvzblcbg1lvfvoARB0JtalsLmxDRrtVFkAChoGCx0VUE4Syp8gnapQDqxkZqBiqWAmg2ceINpu83AuyjvQqaGW2fcoFW7zfpPoSyKKYeyKAszUl7nmkv9eKpgNHxQvAvN7zUHglb8YIJLuCEMYaO8MK0rT1VEqT8o9M9Vn804nmyDhFZ80iIngfml4mAKeMXriK3XT1wPgQL5g86IuVwur/0yzOC1Ucioqo6eRd6mV0e/7Y6gfDzbviN5E1fYEmtTqDVziCRIpswit8U2MbW2g6mNbBs++l2dkUdIfZjR/MvjyR0EyKOiw0Jimea2TjRnFvr6KcqE80b6kFUejW5YcU7FhwYXC7xE/EBtAOsFTN8ecuQIkqHg6JqkJVELeVOJcE9/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: AQd5YbzBmLXHsMoPetK36PstV9NWMN2CW+HdLK9J/Zyh37wxz1LnkaepcxDEefokZeBD+3hEpg7w0Xq2C1oR8yw3LNFeSrdmDqFrmujdhmF3h2MqVNHhGB/6i/gyMEnwDcqCKonvfEeOg7gu5PdgFZr/L/PVvc/pQfk9daxpbWb3c4zCypBxP9nUDa4Uh5ub+gWuWjZt06XcsnHZ3v5nbjk3X9YsQUOX9arVw6Ll0ZoAzEz0AnOpp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tfWZAWWUmEBAL+YR+tJ/V7NwvwWbxZCcNkEGOY+7jNEBSLiC9ZJg+0HdlEhPHy2PguDi0Sl1o0DiM+fi/S65uUvBw0Z6qmVuhBH7p1uzMatMDWn2m5R31QoA7N7pT8IncD05ls8CuA8NJsU61RcBTOyejVadUPc00MmfWRSeHD+XiwrBW4Ozh+Y8bHhv+8Q7EvNZuYZIt8YP4/2Gu+kBM1yrqC4ACvcJhVoaOGOuTUpfcbNzIqsHuVRFrcEdOvnL6AwTKwz6sKPY0Y3GTVsbOgrugJ2mlHdtWR3pwQWEmg8DmZc6Fk0w== 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 X-Patchwork-Delegate: kuba@kernel.org 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, unsigned 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 = cls->common.extack; struct dsa_port *dp = dsa_user_to_port(dev); @@ -1397,10 +1397,30 @@ dsa_user_add_cls_matchall_mirred(struct net_device *dev, if (!act->dev) return -EINVAL; - if (!dsa_user_dev_check(act->dev)) - return -EOPNOTSUPP; - - to_dp = 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 = dp->cpu_dp; + } else { + to_dp = 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 = dp->cpu_dp; + } if (dp->ds != to_dp->ds) { NL_SET_ERR_MSG_MOD(extack, @@ -1504,7 +1524,11 @@ static int dsa_user_add_cls_matchall(struct net_device *dev, 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: From patchwork Wed Oct 23 13:52:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13847138 X-Patchwork-Delegate: kuba@kernel.org 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?b?QXLEsW7DpyDDnE5BTA==?= , 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> 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: netdev@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: RrsnBsbfGVqFo0rmpBfg3938QxBRi5rlXYhlV10Jq3Y+btWKrZNLgzzRsx+iNM7q1lgKnJtjDLAhX2zrq/2vVs1xqvHlf1AeoGbkikdWJyNMqwfzvMQL4bS3a3t8TffYNMuop6yhehQoCxVQ9j70PbwQQxKOec3RjoVB1wKWgnoyOorIvMeDGOMnT5y1ODJ9QiAUOxca2lFlmFoHyt1h7clnfMSJTwyiufZtbZ1pq7MhWTIozsDPD+bUliNu5Zz6dPlrc2KLt1zKRYIt89+IHoNOP1LXAojyNzwaVhL5GKQqU8HCdozZvaSda5ql2XWP8j+kr4yGL4Lpmt07GoAvFNryOw6f31+mpqC1f9K2bnosGp0h5sjppR+x4Gs9y/i09OCIE0HPpk2O+o2VIRdH1tUIA4w/T91bi9h/NrY+9H8Imn9lQDAhAPXZERjwKcVCwQoceXVqh5O3f39/i/efBjou4w0gxZZH2+lvLZ+FVxtfsdOyxiaxF4AOs+LI29wKYm4+83GqyMt0+uhMuRe5q6QHdBrY+tznTblWSbCrnBiArerz0JS//Yz1cRVIMW3JEsMSj5TTONF95EAIhpKe56M0J/sJAX/CxmI9s2FeJep0XT6eBlnLr7K6sUZR1cGlhQ1EuLBpgqbRGp7ueB48CwpIrTUDjXivZMSVEFG861owC0Pjcf1KkoLQsoNgg5lgIoInGq/hyMgDrbTiQEW/BTbJeiVKVdM1swA49mYLpfcumzBqxuK8F6uEFvfD6YbjOTdaHNL/Xyg4AwshmH7NpgWPeFQIqzBJ3VuQM3N9BWEKI2SqFIvNpMuZgwcOx0Vt6g8+uYT8UTwJLcMJpKwF5Yxso1zyZt54gGxbWeT2/D4wmU4wzQs3CHKCP3KlOEe+tBbCOD1PFdspIT2X41XhTnv0lbODT1utLv4gKgJLUr1U30SF8yA0aMBtwWTBgP3qMrs5tKKS1zzsmMGaPWtR/AMLtHXff4A9xB7umNfp2ekQfsLLpkDRbIzZ5JZFAjTZUF8ZVbcfups92NWBdG3lqE5TM1YtucFzRv8XZMhyY5zm8AxtU9K1W4OpiCkVV8hpbmvxQtgEcUCOP46n4MEPIxA1FfR4qasJuwdIP76szz9eEprBhjQxbEvCLRmftQhhWYR+wz1w/vzi0Ub0mPi6lltStWhCyzC0bw2fKcBqYC3B8ilTI7WnqQNhqdmRWBuMn69co5ohSAEt2d4nwxB9DsQ6+CkP70i5nI+5iHJdhY9B0x51NSs7vsInaM06EPxAX4/fwZRWre9tw8e/XKgIVlLEJLIAMbS3KncGvAC88nBc23junDcwvi2eiaJmME4vpAyfJeV/RoraEHKSUIp6ueSghb1hXbjVw+72ykWnXeo= 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: 6vDxSwcFzfLr4o1LoS+UH2jdiCtwjJQoEnUSCi67e4eDbo4x/a4Q2aFRUV95sC+tAgseWGQf3QWHIgGr6siWL/Td2hQCIuNONKL3UKQB07gGKiX9e5nNqHJ7C81++6I27+FE6ImSM61y0cpip2FuqRc9DLBWpOq7JM7iLPOC9R3HN+8/FelL8uorTfvHgmOomgftaeJkDPNZLb5HcsDAMknMl4/yIbgHJnCJSwmjDXarXKWSCE5bj9vars2MLN5QbxAbpSGvJD1wMhXKyHeLBg0g9hvRciOamdZr9GQsvmeI/iOkzGUT8tguy/E/6zVxbjvOhpUbqDcoDBO7+sPp9Bhr8/B0WIuSxYvGLJNXAsiKuo14CzxiIGbOxoEcTW9Opfxsd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K4hNrDtsy3eqoyrHI0TfAKQuSkKAPRS1yp/FeV5XvOuhSyrJaw+CB3QFLF7LjKt5Rfuamfb+mMw7/ps/c3dCne0NQtDIXUlFpXYebWaGqwmveWiOmrd+I4HwToADvvzVSBEcd3nNFuchA== 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 X-Patchwork-Delegate: kuba@kernel.org 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 mirror 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/ethernet/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_vcap_filter *filter, return 0; } +static int +ocelot_flower_parse_egress_port(struct ocelot *ocelot, struct flow_cls_offload *f, + const struct flow_action_entry *a, bool mirror, + struct netlink_ext_ack *extack) +{ + const char *act_string = mirror ? "mirror" : "redirect"; + int egress_port = ocelot->ops->netdev_to_port(a->dev); + enum flow_action_id offloadable_act_id; + + offloadable_act_id = mirror ? FLOW_ACTION_MIRRED : FLOW_ACTION_REDIRECT; + + /* Mirroring towards foreign interfaces is handled in software */ + if (egress_port < 0 || a->id != 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 = 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 *ocelot, int port, filter->type = OCELOT_VCAP_FILTER_OFFLOAD; break; case FLOW_ACTION_REDIRECT: + case FLOW_ACTION_REDIRECT_INGRESS: if (filter->block_id != 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 = 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 = ocelot_flower_parse_egress_port(ocelot, f, + a, false, + extack); + if (egress_port < 0) + return egress_port; + filter->action.mask_mode = OCELOT_MASK_MODE_REDIRECT; filter->action.port_mask = BIT(egress_port); filter->type = OCELOT_VCAP_FILTER_OFFLOAD; break; case FLOW_ACTION_MIRRED: + case FLOW_ACTION_MIRRED_INGRESS: if (filter->block_id != 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 = 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 = ocelot_flower_parse_egress_port(ocelot, f, + a, true, + extack); + if (egress_port < 0) + return egress_port; + filter->egress_port.value = egress_port; filter->action.mirror_ena = true; filter->type = OCELOT_VCAP_FILTER_OFFLOAD;