]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net/mlx5: CT: Use the correct counter offset
authorVlad Dogaru <vdogaru@nvidia.com>
Sun, 17 Aug 2025 20:23:23 +0000 (23:23 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:34:48 +0000 (16:34 +0200)
[ Upstream commit d2d6f950cb43be6845a41cac5956cb2a10e657e5 ]

Specifying the counter action is not enough, as it is used by multiple
counters that were allocated in a bulk. By omitting the offset, rules
will be associated with a different counter from the same bulk.
Subsequently, the CT subsystem checks the correct counter, assumes that
no traffic has triggered the rule, and ages out the rule. The end result
is intermittent offloading of long lived connections, as rules are aged
out then promptly re-added.

Fix this by specifying the correct offset along with the counter rule.

Fixes: 34eea5b12a10 ("net/mlx5e: CT: Add initial support for Hardware Steering")
Signed-off-by: Vlad Dogaru <vdogaru@nvidia.com>
Reviewed-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Link: https://patch.msgid.link/20250817202323.308604-8-mbloch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_hmfs.c

index a4263137fef5a013830f43f4072468e744f931bc..01d522b029470719770a7c66cbc66002a4b8943f 100644 (file)
@@ -173,6 +173,8 @@ static void mlx5_ct_fs_hmfs_fill_rule_actions(struct mlx5_ct_fs_hmfs *fs_hmfs,
 
        memset(rule_actions, 0, NUM_CT_HMFS_RULES * sizeof(*rule_actions));
        rule_actions[0].action = mlx5_fc_get_hws_action(fs_hmfs->ctx, attr->counter);
+       rule_actions[0].counter.offset =
+               attr->counter->id - attr->counter->bulk->base_id;
        /* Modify header is special, it may require extra arguments outside the action itself. */
        if (mh_action->mh_data) {
                rule_actions[1].modify_header.offset = mh_action->mh_data->offset;