From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.201.58 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796130253; b=mPI4ezg2tuvHd28Sidm1wd48ww+pDRWgf8HVjGNQGiLJH0W7C0ZgULiQKwsCPcankTzA cHtS10Zb3GFNEdxya+DNuwGZX9zl7J1GcXDy/JLw60DFrjvMv2hw8y7SWByFepjKe5wKW 0ybNMP4iouoFNCC4J8UCw/EaVl/kqz/d6czzWW+agEVL0dofbzxf3X+gUvYcuhgedEjZQ JAhdhCNtzySjRLhYSJadifnCh9LazszqDhv0jblK8AuZSGQ68lbQyrxo7WSvuvTLtmYqj B2AYNCbqsmbvO7wVKrKFbD5QZd83rYVPPkf6zkFHVld5nRXqMu7tdtDhYK9FDHODiGQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796130253; h=DMARC-Filter:DKIM-Signature:Received:Received:Message-ID:Date: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-ClientProxiedBy:MIME-Version: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=GXDoc5inY+gNDB3++lUPoYi8kXaAHYE2dSJjRbxdvck=; b=1TvhRXgFZmnfVnEq7YLmfoOUXFGvPEb0I54grWsgR3jTT2n4ksiAtJkQ2zrKLFvlbeFn DJelcUQ+j1mI2z4UcjM2jQxYrOlzUjEb4oY2syq/KSGp5yIiCIxhsDQ9rR5svnhF33/N8 2cpLDmd8WIFn6AmVQWln9550x6tDdpJeVQ4YagNby0A1nGKy44koPipYSWnBW41tJn0zi 32SR1WxxwBmwhctXmt/ICZQThBb8awlGzXc5ARLYqUKMpiC3yb9ugJaZ/nCpWVuYfE9Mh rqgbBXmo6XzWccrt87ky6/wmi8d7L1kKxpakMYvBjxHW0KFgmqiayV3DD07QR1b2boQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=teLoUMmG; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.201.58 Received: from CY3PR05CU001.outbound.protection.outlook.com (mail-westcentralusazon11013058.outbound.protection.outlook.com [40.93.201.58]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36F2B606A31A; Tue, 1 Dec 2026 13:04:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 36F2B606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=teLoUMmG ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZZmb7reSjaisprMZCq/B9kVQwOjb5VBKquLxS04kAUmXPI+kgBq5fqyZZ4H8Ogcb9tWwoT/3ijIV5f5qw0AR+cTBFMJ5sCIOs1lLOWv9As5+NPCjj4u4e4hgDot4X5m4fykhlbKfueREpv33UiE+Ki5CLwyFvxpqVEiZ+MbHM4Iy6tH3OkpZmBayhFIutQvJhbJtkYDY9s6jfxF5G1OEWuOnoLhMgeQOi+O7nOTo35dsPx4Wh1M9fNrdGoZiBX9jxlAue+7qpUeCHdqOrtfLIE5OYHqBSXnNnk/By60t5kOPTSQym6na77vl1QQyzGOBF6hupQzEU1rX5r6U6p1tfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GXDoc5inY+gNDB3++lUPoYi8kXaAHYE2dSJjRbxdvck=; b=jXYttW2539S2ken4/41RSD9PSZQvZ2i/Txk8GEUfv8qF2Oy1K7rN3HZlgKxMTVRT9Kg4bFP2yZqVG8FusRYRlQawKNURBT5NLoBK4NJIDpPmhf23TR6nMG1oNfaKh2BB9P2rYl2c6OEQ/jGefnNzSN/GnAhsozIaFRdthpCf8cPBaBaGR6wQYyx4zCPzjIVv+ls3c5j+o0MPUTOUcZU6qpWK4uRF72Rs3yloSP4xfLtkBUM+O5zawTGY7NRBfMQpwOnvweWqu05OSfntrOnrPFjFl9psIGaj9cykUn7KQEBp+XSO58ASlgN4s2SdrRvM1ZrjURyuk/EADli33Sms1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GXDoc5inY+gNDB3++lUPoYi8kXaAHYE2dSJjRbxdvck=; b=teLoUMmGfrXv63/YRZpgV9g5Tz4kZsWYiFVvrvmsMWftgzXu6NyUJNg8MTWpAJ2jrR7pGgTYgfiLn7jgtZRxZ1qTNCc7uH5BB6+H91m28aPbkFy8DZ73O3g58kCJ9TOwcMNn4jx4GnmzS2ni38NabPP92gLShCkOhf60QqZ6jkAmduENT6v0VkuH+tXyxKl1iVYBDM051BmHBzxyEPxszDJ4rUB7UhVRJkRRZn/SeL7vnO5XJ8ukZ/tyAZwfIJ10yPSy2NNRHLsXYkQE6PaLIH7uZVgz9ELxqPvvzog6XH6PdbzuHFSAswj3Li8rhzdtYnenFkP7XYVPX3BiISpLNg== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from SA0PR12MB4367.namprd12.prod.outlook.com (2603:10b6:806:94::13) by DS2PR12MB101350.namprd12.prod.outlook.com (2603:10b6:8:70c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Tue, 1 Dec 2026 13:04:07 +0000 Received: from SA0PR12MB4367.namprd12.prod.outlook.com ([fe80::2815:8a95:1a44:be1c]) by SA0PR12MB4367.namprd12.prod.outlook.com ([fe80::2815:8a95:1a44:be1c%6]) with mapi id 15.21.0662.012; Tue, 1 Dec 2026 13:04:07 +0000 Message-ID: Date: Tue, 1 Dec 2026 15:04:03 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v3] net: mlx5: Allow police as the last action of a TC rule To: Mohsin Bashir , netdev-bot+sashiko@kernel.org Cc: netdev@vger.kernel.org, saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com, cjubran@nvidia.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org References: <20261124220251.776944-1-mohsin.bashr@gmail.com> <179570909592.3135.1382351175870070773@kernel.org> Content-Language: en-US From: Mark Bloch In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: TL2P290CA0021.ISRP290.PROD.OUTLOOK.COM (2603:1096:950:3::15) To SA0PR12MB4367.namprd12.prod.outlook.com (2603:10b6:806:94::13) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA0PR12MB4367:EE_|DS2PR12MB101350:EE_ X-MS-Office365-Filtering-Correlation-Id: dcf2cc5a-532a-48c0-515a-08df4fab9503 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016|23010399003|11063799006|4143699003|6133799003|22082099003|18002099003|261009223027099003|56012099006|10067099003|261028144727099003|261026121527099003|261026140227099003|261022105027099003|261102123227099003|261021121427099003; X-Microsoft-Antispam-Message-Info: RT8gTre/mei52JOGKgrdzz8ZBVcSiKMpadc4torciPNnUIEYbip9M8UUDjgTKzzoLpIcdjZ/vEctuCyH3skPhNPnw/KloOT07BOLOqOKWdNi3lD/jdpynOgcT3YXXwdSFq7FETgXxOQ2WSWyfFCFdBQQXE2ayO/dZXyJCrQOzkIUCTWaM9GcJ4tFbOvuSqmUL28hwqEup51tdqaA0H330fBRJ527QIXCVAThHhzLSOgJz7HZvzu8yGhUCqeJNHui8UKJ3ruwSQZ0Hr7YPWYkQhvQydNzMKHSaQ34yH3BRIjFuyCJyovL1d75QofOv89ikbB8PPGXdXNRmQoIlQ47SEpXUUcBKoPDPgBY6X3nCx+mC5oEfj7cuktgUUaU/bjxEvCnIhqwBcfzJm9faIq6qGZaLp9P3045k1t2urGbSlC4RiE3cGknPpdHB8iRzhXjO4yS6wujvG/mZ5lfmASfC8/51lagrQrfSKP1aAKyShDXxOj2cOmCtEywaR2U01Pi7MfroFBjR1UMt6Lcai725aaz4WGthKbSlD2F6a9YsgjD7HjceFG/Swd6pYMcPoZUQFtDvOtN5ioVEg0QYDvIL+r5FvuAvpWzsR4KCNxz+yCPU7OCEePZp7Qxe2ryRmbNLUuILhXLzU0CmGgo3lFjEMmt/i66ROcZq2dttMLtHc4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR12MB4367.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(366016)(23010399003)(11063799006)(4143699003)(6133799003)(22082099003)(18002099003)(261009223027099003)(56012099006)(10067099003)(261028144727099003)(261026121527099003)(261026140227099003)(261022105027099003)(261102123227099003)(261021121427099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TFF1Zkd2ZzJZbzZmMmRSeXdnZ0IyblRTRDNTdU1Id1Y4NllydkNqN2R3bFo0?= =?utf-8?B?a2tIc0t2dUo5TzgvSnh5Ums2ZHJSaHRSS0M5M1BqZGw2ejYvdFFwU1dWMTRw?= =?utf-8?B?eWEyVk9EcTdTdldRdC9EUTZsVlJnMnhCK2dhdWpud3ZGcXRZVzBwZ1Zqb0gv?= =?utf-8?B?ajhaaERvYTJ2NHdIMWdOaklzeC9SKzZmRzVEbVl3dEZXdFhVcVdnK2Z6YUNM?= =?utf-8?B?dE9mdkgyRE9wMDhBajkrZ0JiZ1RDZUJjUG5tajF0YVJlYjlnaEF0ejE3blA5?= =?utf-8?B?Vkx2SGZMbmlVL2RPbFI3ZjNIMHZ0OG5Mdk41TU5ORVpUREgrM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utf-8?B?WmJ6QVhUcG5zdHBUSGExSEQyYjJEdTZrNHZxYThzOFNFMG5ONW9ZN2tOSWNI?= =?utf-8?B?SkNWckdHZWNHNGZiUG1CYTlTR0FXUGxrMnFvcDRwd1VFYjd3ZVY4RGFZckNq?= =?utf-8?B?SWVkaHNXZFBaSWI2UE5kNWhsVHFOeFhTRG1KeDNuTnhYU0ZzN3VhTDJRYjY0?= =?utf-8?B?OE9LWlpKRkxFT1Z2OFoyTm9JWStHc1NvMlM0cmJGMHpHWEZJZVlYZz09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: dcf2cc5a-532a-48c0-515a-08df4fab9503 X-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4367.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 13:04:06.9753 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XtyuTcOuURIHxwXWNkoTJ3y9btjGhd+J7rlmwEC+mwhQVod7aBH/VOk+iQrnuIYiJXsFwFA0uRUKPb5xuta3DQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS2PR12MB101350 On 26/11/2026 23:54, Mohsin Bashir wrote: > > > On 11/26/26 8:04 AM, netdev-bot+sashiko@kernel.org wrote: >> Thank you for your contribution! Sashiko AI review found 2 potential >> issue(s) to consider. >> >> Critical: 0 · High: 0 · Medium: 1 · Low: 1 >> >> 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] In police_act_can_offload_jump() >>    (drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/police.c), every… >> - [Low] Besides adding police-as-last-action support, the patch fixes two >>    hardware/software mismatches in existing offloaded rules, both present… >> >> -- >> >> net: mlx5: Allow police as the last action of a TC rule >> >> This patch lets mlx5 offload TC rules in switchdev mode where police is >> the last action. It also changes how police results are offloaded: ok is >> now accept, pipe as the last action is accept, and a jump is only >> offloaded when police is the first action and the skipped actions are all >> drop or all ok. The forward to the post meter table is now set for rate >> police as well as mtu police. >> >>> 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..f03a992cbc270 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_action_entry *act, >>>       return 0; >>>   } >>>   +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) >>> +{ >> >> [ ... ] >> >>> +    prev = act; >>> +    for (i = 1; i <= target; i++) { >>> +        entry = &flow_action->entries[i]; >>> + >>> +        if (i < target && >>> +            ((entry->id != FLOW_ACTION_DROP && >>> +              entry->id != FLOW_ACTION_ACCEPT) || >>> +             entry->id != flow_action->entries[1].id)) { >>> +            NL_SET_ERR_MSG_MOD(extack, >>> +                       "Jump can only skip actions that are all drop or all ok"); >>> +            return false; >>> +        } >> >> [Severity: Medium] >> >> Does this check stop offloading police-first jump rules that were offloaded >> correctly before this patch? >> >> tc_act_can_offload_police() calls police_act_can_offload_jump() for each >> jump result of both rate and mtu police. With police at index 0, any >> skipped action other than drop or ok is now rejected. For example: >> >>    action police mtu 1500 conform-exceed pipe/jump 2 \ >>    action mirred egress redirect dev A \ >>    action mirred egress redirect dev B >> >> Before this patch, dec_jump_count() already handled this case when police >> is at index 0. jump_count is set to extval and decremented once per >> distinct TC action, so the jump lands on the same entry where >> tcf_action_exec() restarts. >> >> The last skipped action is either marked terminating or forwarded to the >> post action table (as for mirror): >> >> dec_jump_count() { >>      ... >>         if (tc_act->is_terminating_action) { /* the branch ends here */ >>             attr->flags |= MLX5_ATTR_FLAG_TERMINATING; >>             ... >>         } else { /* the branch continues executing the rest of the actions */ >>             attr->action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; >>             ... >> } >> >> With this patch these rules fail can_offload with "Jump can only skip >> actions that are all drop or all ok". With skip_sw the filter add fails. >> Without skip_sw (for example with OVS) the traffic goes to the software >> datapath. >> >> The only flaw the commit message names in the old jump handling is that >> the jump is counted from police instead of from the start of the action >> list. That cannot happen when police is at index 0, and the act_index >> check above already rejects the other case. >> >> Is the extra all drop or all ok restriction needed? If it is intentional, >> could the commit message say that rules which offload today will stop >> offloading, instead of only "Reject the rest"? >> > > Thanks for the review. Yes, this is intentional. Please see the discussion on v1 and v2 > https://lore.kernel.org/netdev/20261117031337.4126403-1-mohsin.bashr@gmail.com > https://lore.kernel.org/netdev/20261119040010.1405900-1-mohsin.bashr@gmail.com > > In summary, we discussed that a jump either executes the correct target or the offload is rejected. > > Police first alone does not meet this expectation. My understanding is that the driver counts a jump in flow action entries, while TC counts it in TC actions, and the two do not always match. This can be an issue when one TC action gives entries of different types, for example a pedit with a set and an add key. I have not tested this on HW though. Maybe Mark or someone else from NVIDIA can correct me here. > So sashiko has a point there. How about rejecting only what the countdown gets wrong: --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/police.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/police.c @@ -62,12 +62,16 @@ police_act_can_offload_jump(struct mlx5e for (i = 1; i <= target; i++) { entry = &flow_action->entries[i]; + /* The jump is counted in flow action entries. A pedit has one + * entry per key, and a police among the skipped actions takes + * over the jump of this one. + */ if (i < target && - ((entry->id != FLOW_ACTION_DROP && - entry->id != FLOW_ACTION_ACCEPT) || - entry->id != flow_action->entries[1].id)) { + (entry->id == FLOW_ACTION_MANGLE || + entry->id == FLOW_ACTION_ADD || + entry->id == FLOW_ACTION_POLICE)) { NL_SET_ERR_MSG_MOD(extack, - "Jump can only skip actions that are all drop or all ok"); + "Jump over a pedit or police action is not supported"); return false; } A jump over a pedit with only set keys, or a single key, is counted correctly today and is rejected by this as well. Handling that needs a bigger change, which we can leave for later probably. Mark >>> + >>> +        if (entry->id == prev->id && entry->hw_index == prev->hw_index) { >> >> [ ... ] >> >>> @@ -49,6 +95,16 @@ tc_act_can_offload_police(struct mlx5e_tc_act_parse_state *parse_state, >>>       if (err) >>>           return false; >>>   +    if (act->police.exceed.act_id == FLOW_ACTION_JUMP && >>> +        !police_act_can_offload_jump(parse_state, act, act_index, >>> +                     act->police.exceed.extval)) >>> +        return false; >>> + >>> +    if (act->police.notexceed.act_id == FLOW_ACTION_JUMP && >>> +        !police_act_can_offload_jump(parse_state, act, act_index, >>> +                     act->police.notexceed.extval)) >>> +        return false; >>> + >>>       return !!mlx5e_get_flow_meters(parse_state->flow->priv->mdev); >>>   } >> >> [ ... ] >> >>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c >>> index 1d35c97aea0bc..7e7111e6d058b 100644 >>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c >>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c >> >> [ ... ] >> >>> @@ -3891,11 +3891,17 @@ alloc_branch_attr(struct mlx5e_tc_flow *flow, >>>       case FLOW_ACTION_DROP: >>>           attr->action |= MLX5_FLOW_CONTEXT_ACTION_DROP; >>>           break; >>> -    case FLOW_ACTION_ACCEPT: >>>       case FLOW_ACTION_PIPE: >>> -        err = set_branch_dest_ft(flow->priv, attr); >>> -        if (err) >>> -            goto out_err; >>> +        if (!last) { >>> +            err = set_branch_dest_ft(flow->priv, attr); >>> +            if (err) >>> +                goto out_err; >>> +            break; >>> +        } >>> +        fallthrough; >>> +    case FLOW_ACTION_ACCEPT: >>> +        attr->action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; >>> +        attr->flags |= MLX5_ATTR_FLAG_ACCEPT; >>>           break; >> >> [Severity: Low] >> >> This isn't a runtime bug in the patch. However, this hunk and the >> act_index check in police_act_can_offload_jump() also fix two >> hardware/software mismatches in rules that are already offloaded. >> >> First, alloc_branch_attr() handled an ok police result like pipe. For >> "police ... conform-exceed drop/ok action mirred ...", the hardware ran >> the following actions for conforming packets, while tcf_action_exec() >> stops at TC_ACT_OK. >> >> Second, dec_jump_count() counts a police jump from the police action, >> while TC counts from the start of the list. With police at a non-zero >> index, the hardware ran different actions than software did. >> >> Both seem to date back to the branching support in commit f86488cb4685 >> ("net/mlx5e: TC, initialize branch flow attributes") and its follow-up >> c84fa1ab94a77c ("net/mlx5e: TC, initialize branching action with target >> attr"). >> >> The commit message describes the behavior change, but there is no Fixes: >> tag, and the fixes are mixed with the new police-as-last-action support. >> Could these fixes be split out and sent to net with Fixes: tags, so that >> stable trees pick them up? >> > > I kept them in net-next on purpose, since both change the behavior of rules that are offloaded today. That said, if the maintainers prefer, I can split them out to net with appropriate fixes tags. > >>>       case FLOW_ACTION_JUMP: >>>           if (*jump_count) { >> >> [ ... ] >> >