Skip to content

Commit 8f28a30

Browse files
pmachatadavem330
authored andcommitted
mlxsw: spectrum_router: Support IPv6 overlay encap
Add the missing bits to recognize IPv6 next hops as IPIP ones to enable offloading of IPv6 overlay encapsulation. Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1012b9a commit 8f28a30

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3757,15 +3757,32 @@ mlxsw_sp_fib6_entry_rt_find(const struct mlxsw_sp_fib6_entry *fib6_entry,
37573757
return NULL;
37583758
}
37593759

3760+
static bool mlxsw_sp_nexthop6_ipip_type(const struct mlxsw_sp *mlxsw_sp,
3761+
const struct rt6_info *rt,
3762+
enum mlxsw_sp_ipip_type *ret)
3763+
{
3764+
return rt->dst.dev &&
3765+
mlxsw_sp_netdev_ipip_type(mlxsw_sp, rt->dst.dev, ret);
3766+
}
3767+
37603768
static int mlxsw_sp_nexthop6_type_init(struct mlxsw_sp *mlxsw_sp,
37613769
struct mlxsw_sp_nexthop_group *nh_grp,
37623770
struct mlxsw_sp_nexthop *nh,
37633771
const struct rt6_info *rt)
37643772
{
3773+
struct mlxsw_sp_router *router = mlxsw_sp->router;
37653774
struct net_device *dev = rt->dst.dev;
3775+
enum mlxsw_sp_ipip_type ipipt;
37663776
struct mlxsw_sp_rif *rif;
37673777
int err;
37683778

3779+
if (mlxsw_sp_nexthop6_ipip_type(mlxsw_sp, rt, &ipipt) &&
3780+
router->ipip_ops_arr[ipipt]->can_offload(mlxsw_sp, dev,
3781+
MLXSW_SP_L3_PROTO_IPV6)) {
3782+
nh->type = MLXSW_SP_NEXTHOP_TYPE_IPIP;
3783+
return mlxsw_sp_nexthop_ipip_init(mlxsw_sp, ipipt, nh, dev);
3784+
}
3785+
37693786
nh->type = MLXSW_SP_NEXTHOP_TYPE_ETH;
37703787
rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev);
37713788
if (!rif)
@@ -3815,7 +3832,8 @@ static void mlxsw_sp_nexthop6_fini(struct mlxsw_sp *mlxsw_sp,
38153832
static bool mlxsw_sp_rt6_is_gateway(const struct mlxsw_sp *mlxsw_sp,
38163833
const struct rt6_info *rt)
38173834
{
3818-
return rt->rt6i_flags & RTF_GATEWAY;
3835+
return rt->rt6i_flags & RTF_GATEWAY ||
3836+
mlxsw_sp_nexthop6_ipip_type(mlxsw_sp, rt, NULL);
38193837
}
38203838

38213839
static struct mlxsw_sp_nexthop_group *

0 commit comments

Comments
 (0)