Skip to content

Commit 22b9905

Browse files
pmachatadavem330
authored andcommitted
mlxsw: spectrum_router: Move mlxsw_sp_rif_ipip_lb_op()
Move the function so that it can be called without forward declaration from a function that will be added in a follow-up patch. Fixes: 0063587 ("mlxsw: spectrum: Support decap-only IP-in-IP tunnels") Signed-off-by: Petr Machata <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f6cc9c0 commit 22b9905

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

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

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,33 @@ mlxsw_sp_ipip_entry_ol_up_event(struct mlxsw_sp *mlxsw_sp,
13801380
decap_fib_entry);
13811381
}
13821382

1383+
static int
1384+
mlxsw_sp_rif_ipip_lb_op(struct mlxsw_sp_rif_ipip_lb *lb_rif,
1385+
struct mlxsw_sp_vr *ul_vr, bool enable)
1386+
{
1387+
struct mlxsw_sp_rif_ipip_lb_config lb_cf = lb_rif->lb_config;
1388+
struct mlxsw_sp_rif *rif = &lb_rif->common;
1389+
struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
1390+
char ritr_pl[MLXSW_REG_RITR_LEN];
1391+
u32 saddr4;
1392+
1393+
switch (lb_cf.ul_protocol) {
1394+
case MLXSW_SP_L3_PROTO_IPV4:
1395+
saddr4 = be32_to_cpu(lb_cf.saddr.addr4);
1396+
mlxsw_reg_ritr_pack(ritr_pl, enable, MLXSW_REG_RITR_LOOPBACK_IF,
1397+
rif->rif_index, rif->vr_id, rif->dev->mtu);
1398+
mlxsw_reg_ritr_loopback_ipip4_pack(ritr_pl, lb_cf.lb_ipipt,
1399+
MLXSW_REG_RITR_LOOPBACK_IPIP_OPTIONS_GRE_KEY_PRESET,
1400+
ul_vr->id, saddr4, lb_cf.okey);
1401+
break;
1402+
1403+
case MLXSW_SP_L3_PROTO_IPV6:
1404+
return -EAFNOSUPPORT;
1405+
}
1406+
1407+
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ritr), ritr_pl);
1408+
}
1409+
13831410
static void mlxsw_sp_netdevice_ipip_ol_up_event(struct mlxsw_sp *mlxsw_sp,
13841411
struct net_device *ol_dev)
13851412
{
@@ -6843,33 +6870,6 @@ mlxsw_sp_rif_ipip_lb_setup(struct mlxsw_sp_rif *rif,
68436870
rif_lb->lb_config = params_lb->lb_config;
68446871
}
68456872

6846-
static int
6847-
mlxsw_sp_rif_ipip_lb_op(struct mlxsw_sp_rif_ipip_lb *lb_rif,
6848-
struct mlxsw_sp_vr *ul_vr, bool enable)
6849-
{
6850-
struct mlxsw_sp_rif_ipip_lb_config lb_cf = lb_rif->lb_config;
6851-
struct mlxsw_sp_rif *rif = &lb_rif->common;
6852-
struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
6853-
char ritr_pl[MLXSW_REG_RITR_LEN];
6854-
u32 saddr4;
6855-
6856-
switch (lb_cf.ul_protocol) {
6857-
case MLXSW_SP_L3_PROTO_IPV4:
6858-
saddr4 = be32_to_cpu(lb_cf.saddr.addr4);
6859-
mlxsw_reg_ritr_pack(ritr_pl, enable, MLXSW_REG_RITR_LOOPBACK_IF,
6860-
rif->rif_index, rif->vr_id, rif->dev->mtu);
6861-
mlxsw_reg_ritr_loopback_ipip4_pack(ritr_pl, lb_cf.lb_ipipt,
6862-
MLXSW_REG_RITR_LOOPBACK_IPIP_OPTIONS_GRE_KEY_PRESET,
6863-
ul_vr->id, saddr4, lb_cf.okey);
6864-
break;
6865-
6866-
case MLXSW_SP_L3_PROTO_IPV6:
6867-
return -EAFNOSUPPORT;
6868-
}
6869-
6870-
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ritr), ritr_pl);
6871-
}
6872-
68736873
static int
68746874
mlxsw_sp_rif_ipip_lb_configure(struct mlxsw_sp_rif *rif)
68756875
{

0 commit comments

Comments
 (0)