From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796246712; b=h1nV4no84uxiTiGNJCx62gf3fUBCalLfKarbmq4/lBn6i3uz9BnVVQrVSA2iWuwOLo2E M6XBSYh1popAZNY6j8IaSSiEUvxR/mjcizgMQVUMz4XC1KijWgI9Qx1lnJucVmXp2Jf7G TTptvtKKGcdKWyhB0v6/lwjySQrcqKsy5ztIVkeUokSD1hNGEYWLZa63Zg3b7pHna+Vj4 1h2zgVsmf9Lxkbag52z8vK1QWyBxkRulfRwCqrAcA0MBFwsI1WfeQ8NbriTvlFBYO1AHr 2owqHKjje4cklF/AdjPU34DEVnMRJxzpQa9rFyGRU/5xP7bW41QFZlbiHOUMDPMS/UA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796246712; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=CTKFLx3WIrLFmpFpn3wMFFzCLH6RCIz9n9C6IFUt2ow=; b=tQmefT8gaBY9pOXYwOOlm17VxXwWHnk7dw3sAoe4OUMpm4r2g3IcZnagHUcB2AHdIjjj ncuTVIwbSt0A5lm5vDu+XF2mSKBIYSee/0BPRqXQOEvj6E+cXo7ldGnP0Ziz1ALYetGqo QQ6jWsc3ylgBonw2kJSaAVEVbdCl11NfKm5Pc/KRTYtetLngi+d4CPBqi0mOcgJMSMUhE zWbfwNwNV8zPfEOxN8s6USF7KIeRXpAHLvnW7fG1BiaqpuesmUFEr1I18uUrnUh2QmUCR hm8CI6WlwIde9EroEghAxjlG0zSEJFPTjTL7zWXvvL+obCb+ns10SpcwIapBlg4c+Og== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nLl54e85; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6085D606A322 for ; Wed, 2 Dec 2026 21:25:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nLl54e85 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9A821F0089A; Wed, 2 Dec 2026 21:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796246711; bh=CTKFLx3WIrLFmpFpn3wMFFzCLH6RCIz9n9C6IFUt2ow=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=nLl54e85IwMukHRczn2RmfZr9x3WetZ1FbkJ1IiJpXx3avE8nOUmkQ53o0BYNg1rp 8BQ3a6Rjx10uIssnqBqPgMIT5KNqYWlfe5TcazMqlYmXnWr/QdfSgdD/EejajjO/Re 70b28X/GUi45Dl6mOWxGr5P2HNSLPviSDuRJ/sFpE7GBR9LBkUzZYOxhIjQJNP37xS JlbRVWPzcYX6PCbUSnLv6c6B0GmnZad9pEuksVaZ+8ExCWRCoQgf2+j34LqHUsl+DS 9/l3EPwFo+Retco3QDvdWSjl2P3+lEqzSXcWCCdNUaNLyuMWj8XC8U2YsFaOjjk81g SqnOHaDMS2zjQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net-next v4] net: mlx5: Allow police as the last action of a TC rule Reply-To: sashiko-reviews@lists.linux.dev To: "Mohsin Bashir" Cc: linux-rdma@vger.kernel.org In-Reply-To: <20261201212455.2836814-1-mohsin.bashr@gmail.com> References: <20261201212455.2836814-1-mohsin.bashr@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 21:25:11 +0000 X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] net/mlx5e: miscompiled skipped actions in police_act_can_offload_jump() -- commit ca98fcfa7fb19e6a3e27e9587d032f9f75c3bf2b Author: Mohsin Bashir net: mlx5: Allow police as the last action of a TC rule This commit updates mlx5 TC police action offloading to allow police as the last action in a flow, handle ok and terminal pipe branch controls as accept, and validate police jump targets. > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/police.c b= /drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/police.c > index 1bd1c94fb9776..1e6babff8b2b7 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/police.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/police.c > @@ -37,6 +37,52 @@ static int police_act_validate(const struct flow_actio= n_entry *act, > return 0; > } > =20 > +static bool > +police_act_can_offload_jump(struct mlx5e_tc_act_parse_state *parse_state, > + const struct flow_action_entry *act, > + int act_index, u32 target) > +{ > + const struct flow_action *flow_action =3D parse_state->flow_action; > + struct netlink_ext_ack *extack =3D parse_state->extack; > + const struct flow_action_entry *prev, *entry; > + u32 i; > + > + if (act_index) { > + NL_SET_ERR_MSG_MOD(extack, > + "Jump is only supported when police is the first action"); > + return false; > + } > + > + if (!target || target >=3D flow_action->num_entries) { > + NL_SET_ERR_MSG_MOD(extack, "Jump target must be a later action"); > + return false; > + } > + > + prev =3D act; > + for (i =3D 1; i <=3D target; i++) { > + entry =3D &flow_action->entries[i]; > + > + if (i < target && > + (entry->id =3D=3D FLOW_ACTION_MANGLE || > + entry->id =3D=3D FLOW_ACTION_ADD || > + entry->id =3D=3D FLOW_ACTION_POLICE)) { > + NL_SET_ERR_MSG_MOD(extack, > + "Jump over a pedit or police action is not supported"); > + return false; > + } [Severity: Medium] Can police_act_can_offload_jump() allow skipped action sequences that dec_jump_count() and parse_tc_actions() miscompile into hardware rules? dec_jump_count() only sets jump_state->jump_target and checks tc_act->is_terminating_action when --jump_state->jump_count =3D=3D 1: drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:dec_jump_count() { ... /* nothing to do for intermediate actions */ if (--jump_state->jump_count > 1) return; if (jump_state->jump_count =3D=3D 1) { /* last action in the jump action l= ist */ /* create a new attribute after this action */ jump_state->jump_target =3D true; if (tc_act->is_terminating_action) { /* the branch ends here */ attr->flags |=3D MLX5_ATTR_FLAG_TERMINATING; attr->action |=3D MLX5_FLOW_CONTEXT_ACTION_COUNT; } else { /* the branch continues executing the rest of the actions */ struct mlx5e_post_act *post_act; attr->action |=3D MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; post_act =3D get_post_action(priv); attr->dest_ft =3D mlx5e_tc_post_act_get_ft(post_act); } ... } When target >=3D 3, parse_tc_actions() merges all non-multi-table skipped actions in 1 <=3D i < target into a single mlx5_flow_attr. If an earlier skipped action is terminating (for example, conform-exceed pipe / jump 3 followed by redirect eth1 and ok), TC software stops at entries[1], whereas merging entries[2] into the same attr sets MLX5_ATTR_FLAG_ACCEPT or combines incompatible actions (such as drop and ok) that fail in verify_attr_actions(). Even when target =3D=3D 2, several allowed skipped actions do not work with the jump split in parse_tc_actions(): - FLOW_ACTION_TRAP has is_terminating_action =3D=3D false on mlx5e_tc_act_t= rap, so dec_jump_count() overwrites attr->dest_ft (slow_fdb) with post_act->ft and chains the trap rule into the jump target instead of trapping to the CPU. - Actions that only record state in parse_state (such as FLOW_ACTION_TUNNEL_ENCAP, FLOW_ACTION_TUNNEL_DECAP, FLOW_ACTION_MPLS_PUSH, FLOW_ACTION_PTYPE, FLOW_ACTION_VLAN_PUSH_ETH and FLOW_ACTION_VLAN_POP_ETH) leave their parse_state flags set across the jump_target split because parse_tc_actions() only resets parse_state->if_count =3D 0, applying the skipped action to the jump target attribute. - Any skipped action with is_terminating_action =3D=3D false does not get MLX5_FLOW_CONTEXT_ACTION_COUNT in dec_jump_count(), so mlx5e_tc_act_stats_add_flow() attaches the jump target's counter to the skipped action's cookie and counts packets that jumped over it. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201212455.2836= 814-1-mohsin.bashr@gmail.com?part=3D1