• Or Gerlitz's avatar
    net/mlx5e: Properly deal with resource cleanup when adding TC flow fails · aa0cbbae
    Or Gerlitz authored
    The code for adding tc fdb flows leaves things half set when it fails
    in the middle. Currently we are not leaking things (e.g eswitch
    vlan reference, encap reference and HW resources) since the main
    code to add flower rules does a cleanup by calling mlx5e_tc_del_flow().
    
    This cleanup further works just b/c we're checking there if the HW rule
    for the flow we are attempting to delete is valid before touching it, and
    since under the current possible combinations of supported actions it's okay
    to go and blidnly deref or delete all the action related resources (encap, vlan).
    
    Instead, do things properly, namely make sure that if add flow fails we
    clean all what was allocated or referenced. Now, the flow delete code can
    blindly deref/deallocate both the rule and the actions related resources and
    when more action combinations are introduced (such as the upcoming header
    re-write) we are fine with clear and robust code.
    
    While here, align all of nic/fdb parse actions/add flow functions to get
    mlx5e_tc_flow struct param and pick the attributes or whatever else needed
    from there.
    Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
    Reviewed-by: default avatarHadar Hen Zion <hadarh@mellanox.com>
    Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
    aa0cbbae
eswitch_offloads.c 26.9 KB