From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Petr Machata <petrm@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
netdev@vger.kernel.org, Ido Schimmel <idosch@nvidia.com>,
mlxsw@nvidia.com, Vladyslav Mykhaliuk <vmykhaliuk@nvidia.com>,
Amit Cohen <amcohen@nvidia.com>, Jiri Pirko <jiri@nvidia.com>
Subject: Re: [PATCH net-next] mlxsw: spectrum_flower: Do not allow mixing sample and mirror actions
Date: Tue, 10 Dec 2024 10:50:21 +0100 [thread overview]
Message-ID: <Z1gO3ewMq07er0TN@mev-dev.igk.intel.com> (raw)
In-Reply-To: <d6c979914e8706dbe1dedbaf29ffffb0b8d71166.1733822570.git.petrm@nvidia.com>
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
next prev parent reply other threads:[~2024-12-10 9:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2024-12-10 10:15 ` Kalesh Anakkur Purayil
2024-12-12 4:30 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z1gO3ewMq07er0TN@mev-dev.igk.intel.com \
--to=michal.swiatkowski@linux.intel.com \
--cc=amcohen@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=vmykhaliuk@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.