diff mbox series

[net-next,v2] net/mlx5e: flower: check for unsupported control flags

Message ID 20240422152728.175677-1-ast@fiberby.net (mailing list archive)
State Accepted
Commit 3d549c382297f4d7646e327c817107a88d3f931b
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] net/mlx5e: flower: check for unsupported control flags | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 926 this patch: 926
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: linux-rdma@vger.kernel.org
netdev/build_clang success Errors and warnings before: 937 this patch: 937
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 937 this patch: 937
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 22 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-05-02--15-00 (tests: 1000)

Commit Message

Asbjørn Sloth Tønnesen April 22, 2024, 3:27 p.m. UTC
Use flow_rule_is_supp_control_flags() to reject filters
with unsupported control flags.

In case any unsupported control flags are masked,
flow_rule_is_supp_control_flags() sets a NL extended
error message, and we return -EOPNOTSUPP.

Remove FLOW_DIS_FIRST_FRAG specific error message,
and treat it as any other unsupported control flag.

Only compile-tested.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
---

Changelog:

v2:
- remove existing FLOW_DIS_FIRST_FRAG "support" (requested by Jianbo)

v1: https://lore.kernel.org/netdev/20240417135110.99900-1-ast@fiberby.net/

 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Jianbo Liu April 23, 2024, 3:54 a.m. UTC | #1
On Mon, 2024-04-22 at 15:27 +0000, Asbjørn Sloth Tønnesen wrote:
> Use flow_rule_is_supp_control_flags() to reject filters
> with unsupported control flags.
> 
> In case any unsupported control flags are masked,
> flow_rule_is_supp_control_flags() sets a NL extended
> error message, and we return -EOPNOTSUPP.
> 
> Remove FLOW_DIS_FIRST_FRAG specific error message,
> and treat it as any other unsupported control flag.
> 
> Only compile-tested.
> 
> Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>

Reviewed-by: Jianbo Liu <jianbol@nvidia.com>
Simon Horman April 23, 2024, 2:08 p.m. UTC | #2
On Mon, Apr 22, 2024 at 03:27:27PM +0000, Asbjørn Sloth Tønnesen wrote:
> Use flow_rule_is_supp_control_flags() to reject filters
> with unsupported control flags.
> 
> In case any unsupported control flags are masked,
> flow_rule_is_supp_control_flags() sets a NL extended
> error message, and we return -EOPNOTSUPP.
> 
> Remove FLOW_DIS_FIRST_FRAG specific error message,
> and treat it as any other unsupported control flag.
> 
> Only compile-tested.
> 
> Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>

Reviewed-by: Simon Horman <horms@kernel.org>
Tariq Toukan April 30, 2024, 5:15 a.m. UTC | #3
On 22/04/2024 18:27, Asbjørn Sloth Tønnesen wrote:
> Use flow_rule_is_supp_control_flags() to reject filters
> with unsupported control flags.
> 
> In case any unsupported control flags are masked,
> flow_rule_is_supp_control_flags() sets a NL extended
> error message, and we return -EOPNOTSUPP.
> 
> Remove FLOW_DIS_FIRST_FRAG specific error message,
> and treat it as any other unsupported control flag.
> 
> Only compile-tested.
> 
> Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
> ---
> 
> Changelog:
> 
> v2:
> - remove existing FLOW_DIS_FIRST_FRAG "support" (requested by Jianbo)
> 
> v1: https://lore.kernel.org/netdev/20240417135110.99900-1-ast@fiberby.net/
> 
>   drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> index aeb32cb27182..30673292e15f 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> @@ -2801,12 +2801,6 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
>   		flow_rule_match_control(rule, &match);
>   		addr_type = match.key->addr_type;
>   
> -		/* the HW doesn't support frag first/later */
> -		if (match.mask->flags & FLOW_DIS_FIRST_FRAG) {
> -			NL_SET_ERR_MSG_MOD(extack, "Match on frag first/later is not supported");
> -			return -EOPNOTSUPP;
> -		}
> -
>   		if (match.mask->flags & FLOW_DIS_IS_FRAGMENT) {
>   			MLX5_SET(fte_match_set_lyr_2_4, headers_c, frag, 1);
>   			MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
> @@ -2819,6 +2813,10 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
>   			else
>   				*match_level = MLX5_MATCH_L3;
>   		}
> +
> +		if (!flow_rule_is_supp_control_flags(FLOW_DIS_IS_FRAGMENT,
> +						     match.mask->flags, extack))
> +			return -EOPNOTSUPP;
>   	}
>   
>   	if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC)) {

Acked-by: Tariq Toukan <tariqt@nvidia.com>
Paolo Abeni May 2, 2024, 11:30 a.m. UTC | #4
On Tue, 2024-04-30 at 08:15 +0300, Tariq Toukan wrote:
> 
> On 22/04/2024 18:27, Asbjørn Sloth Tønnesen wrote:
> > Use flow_rule_is_supp_control_flags() to reject filters
> > with unsupported control flags.
> > 
> > In case any unsupported control flags are masked,
> > flow_rule_is_supp_control_flags() sets a NL extended
> > error message, and we return -EOPNOTSUPP.
> > 
> > Remove FLOW_DIS_FIRST_FRAG specific error message,
> > and treat it as any other unsupported control flag.
> > 
> > Only compile-tested.
> > 
> > Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
> > ---
> > 
> > Changelog:
> > 
> > v2:
> > - remove existing FLOW_DIS_FIRST_FRAG "support" (requested by Jianbo)
> > 
> > v1: https://lore.kernel.org/netdev/20240417135110.99900-1-ast@fiberby.net/
> > 
> >   drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 10 ++++------
> >   1 file changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> > index aeb32cb27182..30673292e15f 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> > @@ -2801,12 +2801,6 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
> >   		flow_rule_match_control(rule, &match);
> >   		addr_type = match.key->addr_type;
> >   
> > -		/* the HW doesn't support frag first/later */
> > -		if (match.mask->flags & FLOW_DIS_FIRST_FRAG) {
> > -			NL_SET_ERR_MSG_MOD(extack, "Match on frag first/later is not supported");
> > -			return -EOPNOTSUPP;
> > -		}
> > -
> >   		if (match.mask->flags & FLOW_DIS_IS_FRAGMENT) {
> >   			MLX5_SET(fte_match_set_lyr_2_4, headers_c, frag, 1);
> >   			MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
> > @@ -2819,6 +2813,10 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
> >   			else
> >   				*match_level = MLX5_MATCH_L3;
> >   		}
> > +
> > +		if (!flow_rule_is_supp_control_flags(FLOW_DIS_IS_FRAGMENT,
> > +						     match.mask->flags, extack))
> > +			return -EOPNOTSUPP;
> >   	}
> >   
> >   	if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC)) {
> 
> Acked-by: Tariq Toukan <tariqt@nvidia.com>

@Tariq/@Saeed: do you want to take this patch towards your tree and
send or do you prefer we merge it directly? I tend to read the above
ack as the 2nd option, but given this is only build tested I guess the
first would be better...

Thanks,

Paolo
patchwork-bot+netdevbpf@kernel.org May 3, 2024, 1:40 a.m. UTC | #5
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 22 Apr 2024 15:27:27 +0000 you wrote:
> Use flow_rule_is_supp_control_flags() to reject filters
> with unsupported control flags.
> 
> In case any unsupported control flags are masked,
> flow_rule_is_supp_control_flags() sets a NL extended
> error message, and we return -EOPNOTSUPP.
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net/mlx5e: flower: check for unsupported control flags
    https://git.kernel.org/netdev/net-next/c/3d549c382297

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index aeb32cb27182..30673292e15f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2801,12 +2801,6 @@  static int __parse_cls_flower(struct mlx5e_priv *priv,
 		flow_rule_match_control(rule, &match);
 		addr_type = match.key->addr_type;
 
-		/* the HW doesn't support frag first/later */
-		if (match.mask->flags & FLOW_DIS_FIRST_FRAG) {
-			NL_SET_ERR_MSG_MOD(extack, "Match on frag first/later is not supported");
-			return -EOPNOTSUPP;
-		}
-
 		if (match.mask->flags & FLOW_DIS_IS_FRAGMENT) {
 			MLX5_SET(fte_match_set_lyr_2_4, headers_c, frag, 1);
 			MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
@@ -2819,6 +2813,10 @@  static int __parse_cls_flower(struct mlx5e_priv *priv,
 			else
 				*match_level = MLX5_MATCH_L3;
 		}
+
+		if (!flow_rule_is_supp_control_flags(FLOW_DIS_IS_FRAGMENT,
+						     match.mask->flags, extack))
+			return -EOPNOTSUPP;
 	}
 
 	if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC)) {