Netdev List
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Mohsin Bashir <mohsin.bashr@gmail.com>, netdev@vger.kernel.org
Cc: saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com,
	mbloch@nvidia.com, cjubran@nvidia.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3] net: mlx5: Allow police as the last action of a TC rule
Date: Tue, 1 Dec 2026 13:18:48 +0100	[thread overview]
Message-ID: <f6c351cb-73a4-48f8-8df7-673f2a150dc6@redhat.com> (raw)
In-Reply-To: <20261124220251.776944-1-mohsin.bashr@gmail.com>

On 11/24/26 23:02, Mohsin Bashir wrote:
> From: Mohsin Bashir <hmohsin@meta.com>
> 
> In switchdev mode, mlx5 does not offload a rule where police is the last
> action, although TC needs no other action for such a rule. The upcoming
> selftest series relies on these rules. With nothing after police, the
> police result alone decides where the packet goes, so each result must
> be offloaded as TC executes it. The driver does not do that today. An ok
> result is handled as pipe and runs the actions after police, a pipe
> result always returns to the post action table, and a jump is counted
> from police while TC counts it from the start of the action list. A rate
> police is also rejected by verify_attr_actions(), as its forward to the
> post meter table is added only after the check.
> 
> Make the offloaded rule behave as it does in TC. An ok result ends
> processing in TC. A pipe result does the same when police is the last
> action. Send both to the end of the TC chains as the driver already does
> for gact ok. For jump, offload only the simple case where police is the
> first action and the skipped actions are all drop or all ok. Reject the
> rest. Existing rules where police is followed by other actions also
> change. An ok result now accepts the packet instead of running those
> actions. Finally set the forward to the post meter table while parsing
> police. This is already done for police with mtu and lets a police-only
> rule pass verify_attr_actions().
> 
> Tested on a ConnectX-7 in switchdev mode with the commands below. The
> hardware drop counter showed that the rules are offloaded and limit the
> traffic to the configured rate, that the second police only sees the
> packets conforming to the first, and that the jump lands on its target.
> 
>    tc filter add dev eth0 ingress pref 100 protocol ipv6 flower skip_sw \
>      ip_proto udp dst_port 5201 \
>      action police rate 100mbit burst 1m conform-exceed drop/ok
> 
>    tc filter add dev eth0 ingress pref 100 protocol ipv6 flower skip_sw \
>      ip_proto udp dst_port 5201 \
>      action police rate 200mbit burst 1m conform-exceed drop/pipe \
>      action police rate 100mbit burst 1m conform-exceed drop/pipe
> 
>    tc filter add dev eth0 ingress pref 100 protocol ipv6 flower skip_sw \
>      ip_proto udp dst_port 5201 \
>      action police rate 100mbit burst 1m conform-exceed drop / jump 2 \
>      action drop action ok
> 
> Cc: Carolina Jubran <cjubran@nvidia.com>
> Signed-off-by: Mohsin Bashir <hmohsin@meta.com>
@nvidia: could you please TAL here?

Thanks,

Paolo

      parent reply	other threads:[~2026-12-01 12:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 22:02 [PATCH net-next v3] net: mlx5: Allow police as the last action of a TC rule Mohsin Bashir
2026-11-26 16:04 ` netdev-bot+sashiko
2026-11-26 21:54   ` Mohsin Bashir
2026-12-01 12:18 ` Paolo Abeni [this message]

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=f6c351cb-73a4-48f8-8df7-673f2a150dc6@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=cjubran@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=mohsin.bashr@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox