From patchwork Thu Oct 17 16:52:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13840376 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2055.outbound.protection.outlook.com [40.107.21.55]) (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 B762A1E0B82; Thu, 17 Oct 2024 16:53:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729183988; cv=fail; b=jn9ONk20Z2wzfQV82umVqF/if9ayvdKVopWqeocXGgVrvKzpgDykA2V/7MLvHA/bHIbCFcdN/Wqd+Zujf/GKxfOZTHJvxrpDdaPIWGsyVlDhXT/vlfE5irziTph1AodL9IZd9Vb0uwgjE+8LiGbwc+pienAYDcliycpGhu0bGr0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729183988; c=relaxed/simple; bh=PntiEBqexw0QfEoQA6A3oK0bsZq5itXTlRG1cvsDOTI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=rmZJ7IpiLh5Ay/knARPaU7bAbi22gyM2y930ModzqMjxC7tg8VPoE5TsGW59mdYZq+MDa1BTuQ/Ox4Qx4lhxnuI7VwTEs97aIG0HpuTyBeNO8Kw1+6XGe3/wZhDuru2RwA52Ma9nhOLUTmZuvpWz5Cf73ZB8tRDBn2B8zBUJdmo= 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=MHSQvDuh; arc=fail smtp.client-ip=40.107.21.55 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="MHSQvDuh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pHvfftrhYIuypu2J2CCS2V5Gnub9y6lAngeqVI8VQvcGobk0dek7rChQfK4QW9xrLqm8AYoXwy7NQ8GRHkD7n5TEwR7PD2LrFk3mp1a0Y6+8+adQ9x/Ge0bEf/GEruPTwAKXkZunLOkD+pKEtme+XGRtvZuGyskgd0KTEYIdTy12dEpbdWWZM+KsKMfyya5typ25AM7rb5a1tmzrtu6/5z9cL+BqbJbWkBWlnSq4KXUzlkldgzc9MCXvszRZH0bolDVUy0Cr91cmkoIosXHpzITgZVp/2iZn9w06uY6INQuG4llKWid8MuHOY/lMQ3kNRwufkMtssDluWMA4tMZg2A== 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=gGYLQ0WHKOepT8HqoJkQzEoU2goA8RE8A0SaxCVq3Ak=; b=fQUfEPtcMwVm1lx677lLzrwkRYkHtd4PS/gSqvAIMToCEtFV5S4s/zenzulLu5CWY+kiLJYXrjxumSX+dPwzTcTFDr7Up/MvinUNRqb8l+O/RD9IWfgPPtod1thLY5qkHAjYyu+2XdXn40+sg0S2Zl144x74O0BoDVlx9thzzaGP49+9byM28u9jiV26F3qGvRvdmjPcC9qBtsts7HjgSpnMGFO933tkjXs1gR8GiFJVGwYJMmdT0J6UcuYn2bbeMIM8opE9abv3knHxhpp2ggTcP0nxKhGgwDnN6Rd2OSS3YnKuOqeUnBQ+9HWk6giFmw1kMrVTbxKzp8rPC7ETCw== 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=gGYLQ0WHKOepT8HqoJkQzEoU2goA8RE8A0SaxCVq3Ak=; b=MHSQvDuh592Y7KYQHvYrKsaIrmt/fyDyeii4ZXszVqvkn4sd9D8pRmX56KTSePSoUAKVKS/kXao/1/fqjSK91OsyiP23UpP0FkF3CzAb0aOR8S7n7U78fL4tJbXm3gfjm1f/THJopcYZwmdsgRLWsMR/oNCYpkUmKfna5Gw2Twy7REX8wPvXZZc8e3fAXmnBNNDHcg+RyuPcu4J783yyq8lMLJgU8stN+uYTsaN+Ydb/9DjqGN1Yf+YIku35nKS2u+PPQlX1ovKi2CcdcEymoaZAh/+Bj+MKt4uG5m84FJgKEOwiWQg4l8s+/c1SGaC2AMk2Iyj1WHkd6iCnjhmrgw== 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 VE1PR04MB7456.eurprd04.prod.outlook.com (2603:10a6:800:1ac::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.22; Thu, 17 Oct 2024 16:52:46 +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.8069.016; Thu, 17 Oct 2024 16:52:46 +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 v2 net-next 4/6] net: dsa: add more extack messages in dsa_user_add_cls_matchall_mirred() Date: Thu, 17 Oct 2024 19:52:13 +0300 Message-ID: <20241017165215.3709000-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241017165215.3709000-1-vladimir.oltean@nxp.com> References: <20241017165215.3709000-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR07CA0259.eurprd07.prod.outlook.com (2603:10a6:803:b4::26) 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_|VE1PR04MB7456:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ac8c848-78bb-4ea4-b410-08dceecc208c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|366016|1800799024|52116014|38350700014; X-Microsoft-Antispam-Message-Info: ZWHDjk1MaeQOtJUjzJumCn6n1dUgziDk648F1TgmSO5iTgfxGBLIUMlZ9k65XjpqmeGEzOpCvk0+j2Q5TnPb5aMhFwY7yN5KZrRGkMN4lAj+1sHayybjqOZBi0XuidXjM1ryH30Rly2awQCdhF6PIQZ767MPjJM1qn7JOqnFO4ZD6hovLlL3I9M2OCjuhn9fmnU7PEvLoMCFDPWQeJuHmrc0VeCcWQoq0MvL20Vdb23jBjI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b+hzf9vBg6mvwVYiM6ubSysDDItkoxHCZZvg1KsmSFN2oZ3zSHYFvhyr/mrMijdH4jA= 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)(376014)(366016)(1800799024)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nU2YwVH2QkEbFxF+B6nnP7WG/29p5d4YQec9eSVD8+dpq722NQfGG1gGq7XtHDRaaHfwlORtNMaAs8x+l2YgDZwgscRlo6It/anHspr8/ytXdOYgi0M1cdBgwVv4hgt0goI/0U29/FNxnHBAcUAGLiEFrv/7y7Wyd30JReP+zMIs5hZVVvBhN/b9Dp3qLpHf6utSqNxGtiTF0eVYoTwZDW001F34NG6yE7SXorLBS6QQd97gG4VLPU7hGHe77hDGtcQGq5O493/viLWII0tLrZzlmCvMmMw1VtlsIfdTl532x35NB7yE8/0SSx/ecPwwNidiNgdJhDeFKsUR8MrS5/bmljjwhK3QMySpCF0/XvcoL/PPxQMnb5MqKazZM9B8Xo/w/iITDNG7W2MsJzZJY8ODxsMK8VlMez/qz7oLgk4T5gQYecowGFZYnAbHpnRMeeMZd8HeGEvs5lV/Uok9zTuaE1Q0vkxZfcbQumQGnvsPzXUIf/iM9y8d3i8yTDAvhNzKVGRtDIJhXGx78KxtHXlU89m5cV23B/qLg2onBBF4YKn6vIcRxiGVZn6Czi1Pnzk1NtyEnKKOMH5xNalYBLVzQVhcjDA2NMvfw7XsCarmfs8xsEd9k/DXqthBt3/HRCzU3mHXogi3PoxDiRXVLYMWpDUm1WkOu26LbIAnSc9sOZZI/YhjApd+Zd3HLMambnqv5Wc8K/cI4/YPq5XqPK1ZvA5efD7XAhqJEUVg8rm1ll9ZqP3gidU+t07EWLRzJ5EZBfs8aI9emKXcwMVWwuixTTVX7wvKaOhBgXBh4wi95WgFXPb+Drle8e7f3jgEDirGWwtXWBBUMd6nDzTxANYYilBxGUXnKQjduVmAj+8c6vP+MspA6CE34gr6Tz37pvx5FC9jyQRlm2oXujPU3+WdMm2RwMHgzrIx3DuJ5BCDhfJ7kOhIOr4dOTd6BFEO6r3RNPWox9MI3nrMLJMUEnxpJw3FrDlv2+X69FEhqe+gtsk+h5580R32yNWNgfGxrK1l8G/uSDH2texn7snsuDX+3rOb1a6wBd+iBgC6zM4kTWMxZgivSl+Nj3ThusdiRveaMyAelVVHvqCzN1azMD3GAzZKFd1LVZmiFBeB3TW83kU810ewDTNgu1+EnqvSEC+3JsscfU1ZefxOreKfbigHLWv2NCwgXR2AN96vc72EgLKOfpTicApE9iK4wM2KUFRVfjwRGQi/DKo1l+M3F2g3d1j656Czjqb48pbqNTuX7B/9j0tQZhVU12g4CA5Q50UG2E7SIH7oFwvS0qQah6xuSJ8nDGgUctj1DwG/yhdeNU4akY1VBK40xR4MwdwB6ImyUTWHGhPCHEhrjonoNKqC0W9rlo4JETuVU1YbrVDyV8xXBp6Bmm9RSAQTwzuDxF0Yne2PcgwzVXuUqfjL72bWXqXYkp5RXJK0TtGoeLHu3aTd6neQgF2fzMMpfjitmKihenN4sEWiBML4bLLTaqsXRIahK4cP4AM3NlCD5+QGqAi8N6EHQamYtFSv/gXhgq+b+P22l80Ex/TMWpv6B7nzOlznNPoK+R0usssdIdDkoUTo0AiczOQ7kFI38pfxMlKCfcfojn2lH3hOxs/tOQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ac8c848-78bb-4ea4-b410-08dceecc208c X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 16:52:46.7754 (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: FVIU66MNl/GCCqSbyBnJFyaQxNVyO9AygsZFxFs712gFdcwgLHqQBF9DTAALgw9diqGY3bqnbsWxNjHxJ/ntjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7456 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->v2: 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; }