From patchwork Thu Apr 11 10:52:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13625731 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (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 DAC991448F3; Thu, 11 Apr 2024 10:53:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832826; cv=none; b=MzzUIpf8adl5EDsc6fKPUotcZSSyDes+fkqfn6KC4bMujGAhRXIxDMEbPVl5BRlA6EaCa7OieumIEraWYyZ6EU5/FnNwfhV/MiT85s7XbIRv2ZWkc4QjobrZQnVsJoOrHrOEkqyA75e3pZJEkOTGm0cmqqXXXHzUpvK7bqISgSw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832826; c=relaxed/simple; bh=AfyMjC1FaXvd5ToX0H0wu1qi+kPBVGLrisweV0XUBhU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VUoh2qKbZYmmyWMD0OjyEFoAqf65xIjhjYfmpExt5n4VbNxqbOJ5KTC/JNqdyCMsRtA9mCOiu9E8qhA8Deou9U1CZD0LCV6PWWbEMoGkziy57C5TxmMLiNF0ztr6EygP+0W4LYzB+OkdnJR7PU+YSxX6EK5sJhR7prSdcOFzGu4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=j/bq5ZU1; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="j/bq5ZU1" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 5AE81600A7; Thu, 11 Apr 2024 10:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1712832815; bh=AfyMjC1FaXvd5ToX0H0wu1qi+kPBVGLrisweV0XUBhU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/bq5ZU1DnUqAvGRx9YasD/ShxugeonrPd1pqcorXBPi8htKPbVKoUhPAZtxTbF5q qFnORG89W2FeaP5hqUBASXAnqngSqIIYqLyei+5aB/gsI8BA6ROkvm0Ehm0GenLzah l1Eubm4+r/1F869vJMd+CkMLs1RzF0gRT92vQ5Jdcu2A0nOoeTe8meQAE4PbA/MSK1 DqHTCQy1iybywUsGRgnR+vzWx+bvraGf1X13Q+CvIbIQuxkqOy2SLq2Rq7BLEpAV5C MfK7VeuVBpfPoV/AzydqnLL5B+4hNywzOnB8qecakZcqN1lP9Bju8iOlY5B0mdKVfl obk8Z0ECFyfrg== Received: by x201s (Postfix, from userid 1000) id A69B020EF2F; Thu, 11 Apr 2024 10:53:14 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, Louis Peens , Yanguo Li , oss-drivers@corigine.com, Taras Chornyi , Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , Vladimir Oltean , Edward Cree , Jamal Hadi Salim , Cong Wang , Jiri Pirko Subject: [PATCH net-next v3 1/4] flow_offload: add control flag checking helpers Date: Thu, 11 Apr 2024 10:52:54 +0000 Message-ID: <20240411105302.112091-2-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240411105302.112091-1-ast@fiberby.net> References: <20240411105302.112091-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org These helpers aim to help drivers, with checking for the presence of unsupported control flags. For drivers supporting at least one control flag: flow_rule_is_supp_control_flags() For drivers using flow_rule_match_control(), but not using flags: flow_rule_has_control_flags() For drivers not using flow_rule_match_control(): flow_rule_match_has_control_flags() While primarily aimed at FLOW_DISSECTOR_KEY_CONTROL and flow_rule_match_control(), then the first two can also be used with FLOW_DISSECTOR_KEY_ENC_CONTROL and flow_rule_match_enc_control(). These helpers mirrors the existing check done in sfc: drivers/net/ethernet/sfc/tc.c +276 Only compile-tested. Signed-off-by: Asbjørn Sloth Tønnesen Reviewed-by: Louis Peens --- include/net/flow_offload.h | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index 314087a5e1818..0e3d3dc332e47 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -449,6 +449,61 @@ static inline bool flow_rule_match_key(const struct flow_rule *rule, return dissector_uses_key(rule->match.dissector, key); } +/** + * flow_rule_is_supp_control_flags() - check for supported control flags + * @supp_flags: control flags supported by driver + * @ctrl_flags: control flags present in rule + * @extack: The netlink extended ACK for reporting errors. + * + * Return: true if only supported control flags are set, false otherwise. + */ +static inline bool flow_rule_is_supp_control_flags(const u32 supp_flags, + const u32 ctrl_flags, + struct netlink_ext_ack *extack) +{ + if (likely((ctrl_flags & ~supp_flags) == 0)) + return true; + + NL_SET_ERR_MSG_FMT_MOD(extack, + "Unsupported match on control.flags %#x", + ctrl_flags); + + return false; +} + +/** + * flow_rule_has_control_flags() - check for presence of any control flags + * @ctrl_flags: control flags present in rule + * @extack: The netlink extended ACK for reporting errors. + * + * Return: true if control flags are set, false otherwise. + */ +static inline bool flow_rule_has_control_flags(const u32 ctrl_flags, + struct netlink_ext_ack *extack) +{ + return !flow_rule_is_supp_control_flags(0, ctrl_flags, extack); +} + +/** + * flow_rule_match_has_control_flags() - match and check for any control flags + * @rule: The flow_rule under evaluation. + * @extack: The netlink extended ACK for reporting errors. + * + * Return: true if control flags are set, false otherwise. + */ +static inline bool flow_rule_match_has_control_flags(struct flow_rule *rule, + struct netlink_ext_ack *extack) +{ + struct flow_match_control match; + + if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CONTROL)) + return false; + + flow_rule_match_control(rule, &match); + + return flow_rule_has_control_flags(match.mask->flags, extack); +} + struct flow_stats { u64 pkts; u64 bytes; From patchwork Thu Apr 11 10:52:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13625732 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (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 CEDC81448EF; Thu, 11 Apr 2024 10:53:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832826; cv=none; b=orN6d5IXPf9uQOqlbFvJ+IuLWDhBXgYGkXlcmq5L/wz752VP4P2mmN4YdByKcp/HOyuWsQr2u863k+Ai1SjdNcSeZHGdZiR2JNFLiGHgRC4OEcBhglIk9O/FXU+FqoY2cOHj0Tmq1VoYxScJFIzap1/dhe0cXJf6ef+zR6qbizA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832826; c=relaxed/simple; bh=9YVU8sC5lyA2gQoDE2b9psBJEuL/8EhzWJnh02ASQX0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=T0mSIPynRKm7Nq90TGiyAHmfZsW7RUSEUt4X1o+Bn7lBf9CyGqCsazZZ6A2heM18lv8irzNHAGkQHe5yRZoCmIf2oLn87OsIyIe/4re+eZGn0BBG7kdnY4Gvk0/cnamz5R6gpCvrkH8h5XpjYnOkTeiAzDhT9Bx2aBDnMkIKv3U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=mX2+yU/K; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="mX2+yU/K" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 5875D600A5; Thu, 11 Apr 2024 10:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1712832815; bh=9YVU8sC5lyA2gQoDE2b9psBJEuL/8EhzWJnh02ASQX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mX2+yU/KhoZUmwWalHJVw5OA5QOwvXERX7UUuRxvkKcd+M4ngWuItmyAm9Rme0kX8 Y+jBSnLqD2LUQyIM9h7YvBypjvZRm/mL3MIwUHg3awRXZaluEBH4xa8syaZtsvu5q7 95YD2pt3FA+AMDikecxoccUaK7/Q09KzUW1kisK2qMBJRVPYu16KuqRHucq5LO1fhW kjWUTBObSERTb3eBNV6UCHf3mvpHAk7vfX2Ol1jZkNIZnTMgg+xGxpScIZAt2x31jZ w13KJwT2NoHn/LN1lQil3qkhe8TM8Sv2nNTyMc7E6edZGifOnK/O89AQn1o4GCmTvH LUZwMoUMy09tA== Received: by x201s (Postfix, from userid 1000) id B817D20EF33; Thu, 11 Apr 2024 10:53:15 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, Louis Peens , Yanguo Li , oss-drivers@corigine.com, Taras Chornyi , Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , Vladimir Oltean , Edward Cree , Jamal Hadi Salim , Cong Wang , Jiri Pirko Subject: [PATCH net-next v3 2/4] nfp: flower: fix check for unsupported control flags Date: Thu, 11 Apr 2024 10:52:55 +0000 Message-ID: <20240411105302.112091-3-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240411105302.112091-1-ast@fiberby.net> References: <20240411105302.112091-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Use flow_rule_is_supp_control_flags() Check the mask, not the key, for unsupported control flags. Only compile-tested, no access to HW Signed-off-by: Asbjørn Sloth Tønnesen Reviewed-by: Louis Peens --- drivers/net/ethernet/netronome/nfp/flower/offload.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c index 0aceef9fe5826..8e0a890381b60 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/offload.c +++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c @@ -527,10 +527,10 @@ nfp_flower_calculate_key_layers(struct nfp_app *app, struct flow_match_control ctl; flow_rule_match_control(rule, &ctl); - if (ctl.key->flags & ~NFP_FLOWER_SUPPORTED_CTLFLAGS) { - NL_SET_ERR_MSG_MOD(extack, "unsupported offload: match on unknown control flag"); + + if (!flow_rule_is_supp_control_flags(NFP_FLOWER_SUPPORTED_CTLFLAGS, + ctl.mask->flags, extack)) return -EOPNOTSUPP; - } } ret_key_ls->key_layer = key_layer; From patchwork Thu Apr 11 10:52:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13625734 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (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 2871E140E3C; Thu, 11 Apr 2024 10:53:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832827; cv=none; b=q0Q8D0lScb7b1yHu25zGm5a+5HptxEts0Y4EdJIpOohmEr1yeacYWdRH+tWIK0fQEgSxL5QEhBgHgCHs9hbo0EgSlfvD+4a602JxYhu7Okxq1doNIEyaGlKbNiF0wTJsDXVVezRH/5m+EtX/M5dG3wwiq74SnO2UHHndeEcaz/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832827; c=relaxed/simple; bh=Sy9vwHM9lL5sKyKFDT+sqtrTgE6HSdTNapyCUyx55lE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=vDkkv1/Ug+xA+GMXr/TZIaJgxwWjk+WKsOJhT2drdzylzBIx/E2fBgrxE3gdWnTBhqplGeJknGokVAQw9HiFwW2CqweCvuzS+ss1ggvVpo6kcUHAUr9znWdVaEHkP1WbcjjA1+WTNj75AmjKgb+BDkz/qPSbn/eaJxH/uo+D2yM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=FE0s0iX7; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="FE0s0iX7" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 6293D600A9; Thu, 11 Apr 2024 10:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1712832815; bh=Sy9vwHM9lL5sKyKFDT+sqtrTgE6HSdTNapyCUyx55lE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FE0s0iX7zfOIYHPXs42ynIILdQ6X+cBY/6D9s+2ACqgR/LBQAwRAYxrpoLAz6Dspt Y0kPsGL3LwzsgVKQ6ertwd69M2HUevzEMopa8vmY2L8bukT87K9xr3Kx700+Xajwyh 0ZGSx6vAu/ua/ULEZzko76gRaB64aJbRWotkzen8AImRa1QmwdwFIIaq1E1hxCZdAT ewJWmeGCLZdGBUrao5uM2JkotYK2VMiRNhxeGxsOBAqkFZcliQ+cYdYhutwhsG94cS 5sZhdsZDH0fLkTojE2KMYYUxKcNib+7aBZQnB/GmhI8/jJIM8eHfs9J8kC04MhIxgw 9Mzn9WJuUYwrw== Received: by x201s (Postfix, from userid 1000) id BE2F120EF37; Thu, 11 Apr 2024 10:53:16 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, Louis Peens , Yanguo Li , oss-drivers@corigine.com, Taras Chornyi , Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , Vladimir Oltean , Edward Cree , Jamal Hadi Salim , Cong Wang , Jiri Pirko Subject: [PATCH net-next v3 3/4] net: prestera: flower: validate control flags Date: Thu, 11 Apr 2024 10:52:56 +0000 Message-ID: <20240411105302.112091-4-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240411105302.112091-1-ast@fiberby.net> References: <20240411105302.112091-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add check for unsupported control flags. Only compile-tested, no access to HW. Signed-off-by: Asbjørn Sloth Tønnesen --- drivers/net/ethernet/marvell/prestera/prestera_flower.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_flower.c b/drivers/net/ethernet/marvell/prestera/prestera_flower.c index 8b9455d8a4f7a..418101a931490 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_flower.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_flower.c @@ -229,6 +229,10 @@ static int prestera_flower_parse(struct prestera_flow_block *block, flow_rule_match_control(f_rule, &match); addr_type = match.key->addr_type; + + if (flow_rule_has_control_flags(match.mask->flags, + f->common.extack)) + return -EOPNOTSUPP; } if (flow_rule_match_key(f_rule, FLOW_DISSECTOR_KEY_BASIC)) { From patchwork Thu Apr 11 10:52:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13625730 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (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 C352A2EAE5; Thu, 11 Apr 2024 10:53:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832826; cv=none; b=T6ff7Y9+KQzjlz4EC+HqZQJEF/hdcyTZKKofpE0UL8MHsGko6XvnVqHQnvwJHeCodmTWlalimmCiVj3WfH3ByJTragGeVs69AMe5mDYpC9nQPL4wPPFKjs3fJMfvZsHORoezLEv9UsAfpUiA7qb3PLC+H5id1LZB+aERA39EN5s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832826; c=relaxed/simple; bh=hA4bLqry0f38bkJtkBZ2E//5jq8jhyAZdUEvMOe9BL8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bvHAwYkWcbTzAN85H23yAwTkRHV24TZYJMmHu+wLmNxnzNBi7bhAnIxfY2BiwA0YMVFccdBGkJUeZmATgbLl64W/mKjBFFnqHCMicjB4oBmDwJIjuA14Toiz4BEuhTGluyxXiM6Q5f9Bke/HY2y27Hf1mkgzK6zcV0pA1Uvv2m4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=UYmPND8P; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="UYmPND8P" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 55E8D600A2; Thu, 11 Apr 2024 10:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1712832815; bh=hA4bLqry0f38bkJtkBZ2E//5jq8jhyAZdUEvMOe9BL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UYmPND8PWvAcLq6omI3g5jtVViO9/dxL2Wk03v6XNMtrT6XHlbH7nu/7jW8noNUqZ 3S1kQrrriI9Ad6vdVoYnonijbCx+at6UB2jobo2ts6p8cdx2vQncrIVUL35wvVZA/u EeT6I03o5GcgzvQNa+PY1cFSYHEIygkTznzWTDXoJbnqivS7xBf1wrwTuHJrw2Drf0 6nXPkb9zD9Iukr24ssq/Epw7wVLLaQzIMvVdFCxjPGCRQFRciZFEp7L5x7QeKrAncf G+O6S5xjV0u7EGJfvc5T3cRmTVBdXk8Ukr8SJgbaGz17PX4QG3LNIypPr1YT/YlzYp MN89YGRRQ/Vzg== Received: by x201s (Postfix, from userid 1000) id B250620EF3B; Thu, 11 Apr 2024 10:53:18 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, Louis Peens , Yanguo Li , oss-drivers@corigine.com, Taras Chornyi , Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , Vladimir Oltean , Edward Cree , Jamal Hadi Salim , Cong Wang , Jiri Pirko Subject: [PATCH net-next v3 4/4] net: dsa: microchip: ksz9477: flower: validate control flags Date: Thu, 11 Apr 2024 10:52:57 +0000 Message-ID: <20240411105302.112091-5-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240411105302.112091-1-ast@fiberby.net> References: <20240411105302.112091-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add check for unsupported control flags. Only compile-tested, no access to HW. Signed-off-by: Asbjørn Sloth Tønnesen --- drivers/net/dsa/microchip/ksz9477_tc_flower.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz9477_tc_flower.c b/drivers/net/dsa/microchip/ksz9477_tc_flower.c index 8b2f5be667e01..ca7830ab168ac 100644 --- a/drivers/net/dsa/microchip/ksz9477_tc_flower.c +++ b/drivers/net/dsa/microchip/ksz9477_tc_flower.c @@ -124,6 +124,9 @@ static int ksz9477_flower_parse_key(struct ksz_device *dev, int port, return -EOPNOTSUPP; } + if (flow_rule_match_has_control_flags(rule, extack)) + return -EOPNOTSUPP; + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC) || flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ETH_ADDRS)) { ret = ksz9477_flower_parse_key_l2(dev, port, extack, rule,