• Ariel Levkovich's avatar
    net/mlx5e: TC, Fix ct_clear overwriting ct action metadata · 087032ee
    Ariel Levkovich authored
    ct_clear action is translated to clearing reg_c metadata
    which holds ct state and zone information using mod header
    actions.
    These actions are allocated during the actions parsing, as
    part of the flow attributes main mod header action list.
    
    If ct action exists in the rule, the flow's main mod header
    is used only in the post action table rule, after the ct tables
    which set the ct info in the reg_c as part of the ct actions.
    
    Therefore, if the original rule has a ct_clear action followed
    by a ct action, the ct action reg_c setting will be done first and
    will be followed by the ct_clear resetting reg_c and overwriting
    the ct info.
    
    Fix this by moving the ct_clear mod header actions allocation from
    the ct action parsing stage to the ct action post parsing stage where
    it is already known if ct_clear is followed by a ct action.
    In such case, we skip the mod header actions allocation for the ct
    clear since the ct action will write to reg_c anyway after clearing it.
    
    Fixes: 806401c2 ("net/mlx5e: CT, Fix multiple allocations and memleak of mod acts")
    Signed-off-by: default avatarAriel Levkovich <lariel@nvidia.com>
    Reviewed-by: default avatarPaul Blakey <paulb@nvidia.com>
    Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
    Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
    Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
    087032ee
ct.c 2.54 KB