Skip to content

Commit e708621

Browse files
committed
Merge branch 'mlxsw-spectrum-prepare-for-xm-implementation-prefix-insertion-and-removal'
Ido Schimmel says: ==================== mlxsw: spectrum: Prepare for XM implementation - prefix insertion and removal Jiri says: This is a preparation patchset for follow-up support of boards with extended mezzanine (XM), which is going to allow extended (scale-wise) router offload. XM requires a separate PRM register named XMDR to be used instead of RALUE to insert/update/remove FIB entries. Therefore, this patchset extends the previously introduces low-level ops to be able to have XM-specific FIB entry config implementation. Currently the existing original RALUE implementation is moved to "basic" low-level ops. Unlike legacy router, insertion/update/removal of FIB entries into XM could be done in bulks up to 4 items in a single PRM register write. That is why this patchset implements "an op context", that allows the future XM ops implementation to squash multiple FIB events to single register write. For that, the way in which the FIB events are processed by the work queue has to be changed. The conversion from 1:1 FIB event - work callback call to event queue is implemented in patch #3. Patch #4 introduces "an op context" that will allow in future to squash multiple FIB events into one XMDR register write. Patch #12 converts it from stack to be allocated per instance. Existing RALUE manipulations are pushed to ops in patch #10. Patch #13 is introducing a possibility for low-level implementation to have per FIB entry private memory. The rest of the patches are either cosmetics or smaller preparations. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 85ce50d + 173f14c commit e708621

File tree

5 files changed

+635
-234
lines changed

5 files changed

+635
-234
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7279,10 +7279,11 @@ static inline void mlxsw_reg_ralue_pack4(char *payload,
72797279
enum mlxsw_reg_ralxx_protocol protocol,
72807280
enum mlxsw_reg_ralue_op op,
72817281
u16 virtual_router, u8 prefix_len,
7282-
u32 dip)
7282+
u32 *dip)
72837283
{
72847284
mlxsw_reg_ralue_pack(payload, protocol, op, virtual_router, prefix_len);
7285-
mlxsw_reg_ralue_dip4_set(payload, dip);
7285+
if (dip)
7286+
mlxsw_reg_ralue_dip4_set(payload, *dip);
72867287
}
72877288

72887289
static inline void mlxsw_reg_ralue_pack6(char *payload,
@@ -7292,7 +7293,8 @@ static inline void mlxsw_reg_ralue_pack6(char *payload,
72927293
const void *dip)
72937294
{
72947295
mlxsw_reg_ralue_pack(payload, protocol, op, virtual_router, prefix_len);
7295-
mlxsw_reg_ralue_dip6_memcpy_to(payload, dip);
7296+
if (dip)
7297+
mlxsw_reg_ralue_dip6_memcpy_to(payload, dip);
72967298
}
72977299

72987300
static inline void

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

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -181,23 +181,26 @@ mlxsw_sp_ipip_fib_entry_op_gre4_rtdp(struct mlxsw_sp *mlxsw_sp,
181181
}
182182

183183
static int
184-
mlxsw_sp_ipip_fib_entry_op_gre4_ralue(struct mlxsw_sp *mlxsw_sp,
185-
u32 dip, u8 prefix_len, u16 ul_vr_id,
186-
enum mlxsw_reg_ralue_op op,
187-
u32 tunnel_index)
184+
mlxsw_sp_ipip_fib_entry_op_gre4_do(struct mlxsw_sp *mlxsw_sp,
185+
const struct mlxsw_sp_router_ll_ops *ll_ops,
186+
struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
187+
u32 dip, u8 prefix_len, u16 ul_vr_id,
188+
enum mlxsw_sp_fib_entry_op op,
189+
u32 tunnel_index,
190+
struct mlxsw_sp_fib_entry_priv *priv)
188191
{
189-
char ralue_pl[MLXSW_REG_RALUE_LEN];
190-
191-
mlxsw_reg_ralue_pack4(ralue_pl, MLXSW_REG_RALXX_PROTOCOL_IPV4, op,
192-
ul_vr_id, prefix_len, dip);
193-
mlxsw_reg_ralue_act_ip2me_tun_pack(ralue_pl, tunnel_index);
194-
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralue), ralue_pl);
192+
ll_ops->fib_entry_pack(op_ctx, MLXSW_SP_L3_PROTO_IPV4, op, ul_vr_id,
193+
prefix_len, (unsigned char *) &dip, priv);
194+
ll_ops->fib_entry_act_ip2me_tun_pack(op_ctx, tunnel_index);
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,
198-
struct mlxsw_sp_ipip_entry *ipip_entry,
199-
enum mlxsw_reg_ralue_op op,
200-
u32 tunnel_index)
199+
const struct mlxsw_sp_router_ll_ops *ll_ops,
200+
struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
201+
struct mlxsw_sp_ipip_entry *ipip_entry,
202+
enum mlxsw_sp_fib_entry_op op, u32 tunnel_index,
203+
struct mlxsw_sp_fib_entry_priv *priv)
201204
{
202205
u16 ul_vr_id = mlxsw_sp_ipip_lb_ul_vr_id(ipip_entry->ol_lb);
203206
__be32 dip;
@@ -210,9 +213,8 @@ static int mlxsw_sp_ipip_fib_entry_op_gre4(struct mlxsw_sp *mlxsw_sp,
210213

211214
dip = mlxsw_sp_ipip_netdev_saddr(MLXSW_SP_L3_PROTO_IPV4,
212215
ipip_entry->ol_dev).addr4;
213-
return mlxsw_sp_ipip_fib_entry_op_gre4_ralue(mlxsw_sp, be32_to_cpu(dip),
214-
32, ul_vr_id, op,
215-
tunnel_index);
216+
return mlxsw_sp_ipip_fib_entry_op_gre4_do(mlxsw_sp, ll_ops, op_ctx, be32_to_cpu(dip),
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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ struct mlxsw_sp_ipip_ops {
5252
const struct net_device *ol_dev);
5353

5454
int (*fib_entry_op)(struct mlxsw_sp *mlxsw_sp,
55+
const struct mlxsw_sp_router_ll_ops *ll_ops,
56+
struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
5557
struct mlxsw_sp_ipip_entry *ipip_entry,
56-
enum mlxsw_reg_ralue_op op,
57-
u32 tunnel_index);
58+
enum mlxsw_sp_fib_entry_op op,
59+
u32 tunnel_index,
60+
struct mlxsw_sp_fib_entry_priv *priv);
5861

5962
int (*ol_netdev_change)(struct mlxsw_sp *mlxsw_sp,
6063
struct mlxsw_sp_ipip_entry *ipip_entry,

0 commit comments

Comments
 (0)