mlxsw: spectrum_router: Track FIB entry committed state and skip uncommitted on delete
authorJiri Pirko <jiri@nvidia.com>
Tue, 10 Nov 2020 09:48:59 +0000 (11:48 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 12 Nov 2020 23:55:22 +0000 (15:55 -0800)
In case bulking is used, the entry that was previously added may not
be yet committed to the HW as it waits in the queue for bulk send. For
such entries, skip the deletion.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.h

index 9d3ead1..ef95d12 100644 (file)
@@ -4453,6 +4453,12 @@ mlxsw_sp_router_ll_basic_fib_entry_commit(struct mlxsw_sp *mlxsw_sp,
                               op_ctx_basic->ralue_pl);
 }
 
+static bool
+mlxsw_sp_router_ll_basic_fib_entry_is_committed(struct mlxsw_sp_fib_entry_priv *priv)
+{
+       return true;
+}
+
 static void mlxsw_sp_fib_entry_pack(struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                    struct mlxsw_sp_fib_entry *fib_entry,
                                    enum mlxsw_sp_fib_entry_op op)
@@ -4712,6 +4718,10 @@ static int mlxsw_sp_fib_entry_del(struct mlxsw_sp *mlxsw_sp,
                                  struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                  struct mlxsw_sp_fib_entry *fib_entry)
 {
+       const struct mlxsw_sp_router_ll_ops *ll_ops = fib_entry->fib_node->fib->ll_ops;
+
+       if (!ll_ops->fib_entry_is_committed(fib_entry->priv))
+               return 0;
        return mlxsw_sp_fib_entry_op(mlxsw_sp, op_ctx, fib_entry,
                                     MLXSW_SP_FIB_ENTRY_OP_DELETE);
 }
@@ -8370,6 +8380,7 @@ static const struct mlxsw_sp_router_ll_ops mlxsw_sp_router_ll_basic_ops = {
        .fib_entry_act_ip2me_pack = mlxsw_sp_router_ll_basic_fib_entry_act_ip2me_pack,
        .fib_entry_act_ip2me_tun_pack = mlxsw_sp_router_ll_basic_fib_entry_act_ip2me_tun_pack,
        .fib_entry_commit = mlxsw_sp_router_ll_basic_fib_entry_commit,
+       .fib_entry_is_committed = mlxsw_sp_router_ll_basic_fib_entry_is_committed,
 };
 
 static int mlxsw_sp_router_ll_op_ctx_init(struct mlxsw_sp_router *router)
index 4dacbee..ed651b4 100644 (file)
@@ -112,6 +112,7 @@ struct mlxsw_sp_router_ll_ops {
        int (*fib_entry_commit)(struct mlxsw_sp *mlxsw_sp,
                                struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                bool *postponed_for_bulk);
+       bool (*fib_entry_is_committed)(struct mlxsw_sp_fib_entry_priv *priv);
 };
 
 int mlxsw_sp_fib_entry_commit(struct mlxsw_sp *mlxsw_sp,