mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: mmyangfl@gmail.com
Cc: netdev@vger.kernel.org, andrew@lunn.ch, olteanv@gmail.com,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3 2/3] net: dsa: motorcomm: Resolve the flower action list to one ACL verdict
Date: Tue, 10 Nov 2026 08:11:27 +0000	[thread overview]
Message-ID: <179429828784.994134.6502837547336557554@kernel.org> (raw)
In-Reply-To: <20261106073806.112122-3-mmyangfl@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] This patch adds a claim to both the commit message and a new
  comment in yt921x_acl_rule_ext_parse_flow_action()…

--

net: dsa: motorcomm: Resolve the flower action list to one ACL verdict

This commit changes yt921x_acl_rule_ext_parse_flow_action() so the flower
action list resolves to its first terminal action. Before, every action was
accumulated into the ACL verdict. After a redirect only a drop is allowed.
Any other action after a redirect falls back to a CPU trap, or is rejected
when skip_sw is set.

> diff --git a/drivers/net/dsa/motorcomm/tc.c b/drivers/net/dsa/motorcomm/tc.c
> index 90b017a11a1b1..5c82719e461f3 100644
> --- a/drivers/net/dsa/motorcomm/tc.c
> +++ b/drivers/net/dsa/motorcomm/tc.c
> @@ -1030,55 +1030,56 @@ yt921x_acl_rule_ext_parse_flow_action(struct yt921x_acl_rule_ext *ruleext,

[ ... ]

>  	memset(action, 0, 3 * sizeof(*action));
> -	flow_action_for_each(i, act, flow_action)
> +	flow_action_for_each(i, act, flow_action) {
> +		/* Only a drop can follow a redirect: a drop is an empty
> +		 * destination set, so the software verdict is the same
> +		 * whichever control the redirect carries. A second redirect
> +		 * would only extend it if software continued past the first
> +		 * one, and the flow action entry carries no mirred control
> +		 * verdict to tell that.
> +		 */
> +		if (redir && act->id != FLOW_ACTION_DROP) {
> +			reason = "Action after redirect";
> +			goto fallback;
> +		}
> +
>  		switch (act->id) {
>  		case FLOW_ACTION_ACCEPT:
> +			action[2] |= YT921X_ACL_ACTc_FWD_EN |
> +				     YT921X_ACL_ACTc_FWD_FWD;
> +			terminal = true;
> +			break;
>  		case FLOW_ACTION_DROP:
> -		case FLOW_ACTION_REDIRECT:
> -			if (redir_act != NUM_FLOW_ACTIONS &&
> -			    redir_act != act->id) {
> -				reason = "Different redirect actions";
> +			action[2] |= YT921X_ACL_ACTc_FWD_EN |
> +				     YT921X_ACL_ACTc_FWD_REDIR;
> +			terminal = true;
> +			break;

[Severity: Medium]
Is the software verdict really the same "whichever control the redirect
carries"? The commit message makes the same claim:

  Only a drop can follow a redirect: a drop is an empty
  destination set, so the software verdict is the same
  whichever control the redirect carries

This seems to hold for pipe, and for the controls that
tcf_mirred_can_reinsert() accepts (shot, stolen, queued, trap). For pass,
continue, reclassify, goto chain and jump, software looks different.

In net/sched/act_mirred.c:tcf_mirred_to_dev():

	dont_clone = skb_at_tc_ingress(skb) && is_redirect &&
		tcf_mirred_can_reinsert(retval);
	if (!dont_clone) {
		skb_to_send = skb_clone(skb, GFP_ATOMIC);

With these controls a clone is redirected and the control is returned
unchanged. Then net/sched/act_api.c:tcf_action_exec() ends the action list:

	if (ret != TC_ACT_PIPE)
		break;

So the trailing drop never runs in software. A jump control skips over it.

Take a rule like this:

  flower ... action mirred egress redirect dev swp1 pass action drop

Software sends a copy to swp1, and the original frame continues into the
stack or on to the next filter. In hardware, the FLOW_ACTION_DROP case keeps
FWD_REDIR together with the DPORTn bit set by the redirect. The rule is
therefore programmed as a pure redirect, and the original frame is only
forwarded to swp1.

Before this patch, this action list hit the "Different redirect actions"
fallback. It was trapped to the CPU, or rejected under skip_sw. Does the
patch now offload a combination where hardware and software behave
differently?

A standalone redirect with one of these controls already had a similar
mismatch, as the second half of the comment says. But
tcf_mirred_offload_act_setup() only fills in entry->id =
FLOW_ACTION_REDIRECT and the device, not the mirred control. That means the
driver cannot check the equivalence this gate relies on.

Should a drop after a redirect go through the fallback path as well? And
could the comment and the commit message be narrowed to the controls where
the equivalence actually holds?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261106073806.112122-1-mmyangfl%40gmail.com

  reply	other threads:[~2026-11-10  8:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  7:37 [PATCH net v3 0/3] net: dsa: motorcomm: ACL fixup David Yang
2026-11-06  7:38 ` [PATCH net v3 1/3] net: dsa: motorcomm: Fix extack message on unsupported TC actions David Yang
2026-11-06  7:38 ` [PATCH net v3 2/3] net: dsa: motorcomm: Resolve the flower action list to one ACL verdict David Yang
2026-11-10  8:11   ` netdev-bot+sashiko [this message]
2026-11-06  7:38 ` [PATCH net v3 3/3] net: dsa: motorcomm: Delete the ACL rule of the port being unbound David Yang

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=179429828784.994134.6502837547336557554@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmyangfl@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®