netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] mlxsw: spectrum_flower: Do not allow mixing sample and mirror actions
@ 2024-12-10  9:45 Petr Machata
  2024-12-10  9:50 ` Michal Swiatkowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Petr Machata @ 2024-12-10  9:45 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Andrew Lunn, netdev
  Cc: Ido Schimmel, Petr Machata, mlxsw, Vladyslav Mykhaliuk,
	Amit Cohen, Jiri Pirko

From: Ido Schimmel <idosch@nvidia.com>

The device does not support multiple mirror actions per rule and the
driver rejects such configuration:

 # tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw action mirred egress mirror dev swp2 action mirred egress mirror dev swp3
 Error: mlxsw_spectrum: Multiple mirror actions per rule are not supported.
 We have an error talking to the kernel

Internally, the sample action is implemented by the device by mirroring
to the CPU port. Therefore, mixing sample and mirror actions in a single
rule does not work correctly and results in the last action effect.

Solve by rejecting such misconfiguration:

 # tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw action mirred egress mirror dev swp2 action sample rate 100 group 1
 Error: mlxsw_spectrum: Sample action after mirror action is not supported.
 We have an error talking to the kernel

 # tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw action sample rate 100 group 1 action mirred egress mirror dev swp2
 Error: mlxsw_spectrum: Mirror action after sample action is not supported.
 We have an error talking to the kernel

Reported-by: Vladyslav Mykhaliuk <vmykhaliuk@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
index f07955b5439f..6a4a81c63451 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
@@ -192,6 +192,11 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
 				return -EOPNOTSUPP;
 			}
 
+			if (sample_act_count) {
+				NL_SET_ERR_MSG_MOD(extack, "Mirror action after sample action is not supported");
+				return -EOPNOTSUPP;
+			}
+
 			err = mlxsw_sp_acl_rulei_act_mirror(mlxsw_sp, rulei,
 							    block, out_dev,
 							    extack);
@@ -265,6 +270,11 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
 				return -EOPNOTSUPP;
 			}
 
+			if (mirror_act_count) {
+				NL_SET_ERR_MSG_MOD(extack, "Sample action after mirror action is not supported");
+				return -EOPNOTSUPP;
+			}
+
 			err = mlxsw_sp_acl_rulei_act_sample(mlxsw_sp, rulei,
 							    block,
 							    act->sample.psample_group,
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] mlxsw: spectrum_flower: Do not allow mixing sample and mirror actions
  2024-12-10  9:45 [PATCH net-next] mlxsw: spectrum_flower: Do not allow mixing sample and mirror actions Petr Machata
@ 2024-12-10  9:50 ` Michal Swiatkowski
  2024-12-10 10:15 ` Kalesh Anakkur Purayil
  2024-12-12  4:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Swiatkowski @ 2024-12-10  9:50 UTC (permalink / raw)
  To: Petr Machata
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Andrew Lunn, netdev, Ido Schimmel, mlxsw, Vladyslav Mykhaliuk,
	Amit Cohen, Jiri Pirko

On Tue, Dec 10, 2024 at 10:45:37AM +0100, Petr Machata wrote:
> From: Ido Schimmel <idosch@nvidia.com>
> 
> The device does not support multiple mirror actions per rule and the
> driver rejects such configuration:
> 
>  # tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw action mirred egress mirror dev swp2 action mirred egress mirror dev swp3
>  Error: mlxsw_spectrum: Multiple mirror actions per rule are not supported.
>  We have an error talking to the kernel
> 
> Internally, the sample action is implemented by the device by mirroring
> to the CPU port. Therefore, mixing sample and mirror actions in a single
> rule does not work correctly and results in the last action effect.
> 
> Solve by rejecting such misconfiguration:
> 
>  # tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw action mirred egress mirror dev swp2 action sample rate 100 group 1
>  Error: mlxsw_spectrum: Sample action after mirror action is not supported.
>  We have an error talking to the kernel
> 
>  # tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw action sample rate 100 group 1 action mirred egress mirror dev swp2
>  Error: mlxsw_spectrum: Mirror action after sample action is not supported.
>  We have an error talking to the kernel
> 
> Reported-by: Vladyslav Mykhaliuk <vmykhaliuk@nvidia.com>
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> Reviewed-by: Amit Cohen <amcohen@nvidia.com>
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> Signed-off-by: Petr Machata <petrm@nvidia.com>
> ---
>  drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
> index f07955b5439f..6a4a81c63451 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
> @@ -192,6 +192,11 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
>  				return -EOPNOTSUPP;
>  			}
>  
> +			if (sample_act_count) {
> +				NL_SET_ERR_MSG_MOD(extack, "Mirror action after sample action is not supported");
> +				return -EOPNOTSUPP;
> +			}
> +
>  			err = mlxsw_sp_acl_rulei_act_mirror(mlxsw_sp, rulei,
>  							    block, out_dev,
>  							    extack);
> @@ -265,6 +270,11 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
>  				return -EOPNOTSUPP;
>  			}
>  
> +			if (mirror_act_count) {
> +				NL_SET_ERR_MSG_MOD(extack, "Sample action after mirror action is not supported");
> +				return -EOPNOTSUPP;
> +			}
> +
>  			err = mlxsw_sp_acl_rulei_act_sample(mlxsw_sp, rulei,
>  							    block,
>  							    act->sample.psample_group,
> -- 
> 2.47.0

Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>

Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] mlxsw: spectrum_flower: Do not allow mixing sample and mirror actions
  2024-12-10  9:45 [PATCH net-next] mlxsw: spectrum_flower: Do not allow mixing sample and mirror actions Petr Machata
  2024-12-10  9:50 ` Michal Swiatkowski
@ 2024-12-10 10:15 ` Kalesh Anakkur Purayil
  2024-12-12  4:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Kalesh Anakkur Purayil @ 2024-12-10 10:15 UTC (permalink / raw)
  To: Petr Machata
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Andrew Lunn, netdev, Ido Schimmel, mlxsw, Vladyslav Mykhaliuk,
	Amit Cohen, Jiri Pirko

[-- Attachment #1: Type: text/plain, Size: 1643 bytes --]

On Tue, Dec 10, 2024 at 3:26 PM Petr Machata <petrm@nvidia.com> wrote:
>
> From: Ido Schimmel <idosch@nvidia.com>
>
> The device does not support multiple mirror actions per rule and the
> driver rejects such configuration:
>
>  # tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw action mirred egress mirror dev swp2 action mirred egress mirror dev swp3
>  Error: mlxsw_spectrum: Multiple mirror actions per rule are not supported.
>  We have an error talking to the kernel
>
> Internally, the sample action is implemented by the device by mirroring
> to the CPU port. Therefore, mixing sample and mirror actions in a single
> rule does not work correctly and results in the last action effect.
>
> Solve by rejecting such misconfiguration:
>
>  # tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw action mirred egress mirror dev swp2 action sample rate 100 group 1
>  Error: mlxsw_spectrum: Sample action after mirror action is not supported.
>  We have an error talking to the kernel
>
>  # tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw action sample rate 100 group 1 action mirred egress mirror dev swp2
>  Error: mlxsw_spectrum: Mirror action after sample action is not supported.
>  We have an error talking to the kernel
>
> Reported-by: Vladyslav Mykhaliuk <vmykhaliuk@nvidia.com>
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> Reviewed-by: Amit Cohen <amcohen@nvidia.com>
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> Signed-off-by: Petr Machata <petrm@nvidia.com>

Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

-- 
Regards,
Kalesh AP

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4239 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] mlxsw: spectrum_flower: Do not allow mixing sample and mirror actions
  2024-12-10  9:45 [PATCH net-next] mlxsw: spectrum_flower: Do not allow mixing sample and mirror actions Petr Machata
  2024-12-10  9:50 ` Michal Swiatkowski
  2024-12-10 10:15 ` Kalesh Anakkur Purayil
@ 2024-12-12  4:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-12-12  4:30 UTC (permalink / raw)
  To: Petr Machata
  Cc: davem, edumazet, kuba, pabeni, andrew+netdev, netdev, idosch,
	mlxsw, vmykhaliuk, amcohen, jiri

Hello:

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

On Tue, 10 Dec 2024 10:45:37 +0100 you wrote:
> From: Ido Schimmel <idosch@nvidia.com>
> 
> The device does not support multiple mirror actions per rule and the
> driver rejects such configuration:
> 
>  # tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw action mirred egress mirror dev swp2 action mirred egress mirror dev swp3
>  Error: mlxsw_spectrum: Multiple mirror actions per rule are not supported.
>  We have an error talking to the kernel
> 
> [...]

Here is the summary with links:
  - [net-next] mlxsw: spectrum_flower: Do not allow mixing sample and mirror actions
    https://git.kernel.org/netdev/net-next/c/175dd9079ecb

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-12-12  4:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-10  9:45 [PATCH net-next] mlxsw: spectrum_flower: Do not allow mixing sample and mirror actions Petr Machata
2024-12-10  9:50 ` Michal Swiatkowski
2024-12-10 10:15 ` Kalesh Anakkur Purayil
2024-12-12  4:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).