Skip to content

Commit ae9ce81

Browse files
Jiri Pirkokuba-moo
authored andcommitted
mlxsw: spectrum_router: Introduce fib_entry priv for low-level ops
Prepare for the low-level ops that need to store some data alongside the fib_entry and introduce a per-fib_entry priv for ll ops. The priv is reference counted as in the follow-up patch it is going to be saved in pack() function and used later on in commit() even in case the related fib_entry gets freed in the middle. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 91d20d7 commit ae9ce81

File tree

4 files changed

+176
-44
lines changed

4 files changed

+176
-44
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,19 +186,21 @@ mlxsw_sp_ipip_fib_entry_op_gre4_do(struct mlxsw_sp *mlxsw_sp,
186186
struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
187187
u32 dip, u8 prefix_len, u16 ul_vr_id,
188188
enum mlxsw_sp_fib_entry_op op,
189-
u32 tunnel_index)
189+
u32 tunnel_index,
190+
struct mlxsw_sp_fib_entry_priv *priv)
190191
{
191192
ll_ops->fib_entry_pack(op_ctx, MLXSW_SP_L3_PROTO_IPV4, op, ul_vr_id,
192-
prefix_len, (unsigned char *) &dip);
193+
prefix_len, (unsigned char *) &dip, priv);
193194
ll_ops->fib_entry_act_ip2me_tun_pack(op_ctx, tunnel_index);
194-
return ll_ops->fib_entry_commit(mlxsw_sp, op_ctx);
195+
return mlxsw_sp_fib_entry_commit(mlxsw_sp, op_ctx, ll_ops);
195196
}
196197

197198
static int mlxsw_sp_ipip_fib_entry_op_gre4(struct mlxsw_sp *mlxsw_sp,
198199
const struct mlxsw_sp_router_ll_ops *ll_ops,
199200
struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
200201
struct mlxsw_sp_ipip_entry *ipip_entry,
201-
enum mlxsw_sp_fib_entry_op op, u32 tunnel_index)
202+
enum mlxsw_sp_fib_entry_op op, u32 tunnel_index,
203+
struct mlxsw_sp_fib_entry_priv *priv)
202204
{
203205
u16 ul_vr_id = mlxsw_sp_ipip_lb_ul_vr_id(ipip_entry->ol_lb);
204206
__be32 dip;
@@ -212,7 +214,7 @@ static int mlxsw_sp_ipip_fib_entry_op_gre4(struct mlxsw_sp *mlxsw_sp,
212214
dip = mlxsw_sp_ipip_netdev_saddr(MLXSW_SP_L3_PROTO_IPV4,
213215
ipip_entry->ol_dev).addr4;
214216
return mlxsw_sp_ipip_fib_entry_op_gre4_do(mlxsw_sp, ll_ops, op_ctx, be32_to_cpu(dip),
215-
32, ul_vr_id, op, tunnel_index);
217+
32, ul_vr_id, op, tunnel_index, priv);
216218
}
217219

218220
static bool mlxsw_sp_ipip_tunnel_complete(enum mlxsw_sp_l3proto proto,

drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ struct mlxsw_sp_ipip_ops {
5656
struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
5757
struct mlxsw_sp_ipip_entry *ipip_entry,
5858
enum mlxsw_sp_fib_entry_op op,
59-
u32 tunnel_index);
59+
u32 tunnel_index,
60+
struct mlxsw_sp_fib_entry_priv *priv);
6061

6162
int (*ol_netdev_change)(struct mlxsw_sp *mlxsw_sp,
6263
struct mlxsw_sp_ipip_entry *ipip_entry,

0 commit comments

Comments
 (0)