Commit 8f28a309 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller

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: default avatarPetr Machata <petrm@mellanox.com>
Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1012b9ac
...@@ -3757,15 +3757,32 @@ mlxsw_sp_fib6_entry_rt_find(const struct mlxsw_sp_fib6_entry *fib6_entry, ...@@ -3757,15 +3757,32 @@ mlxsw_sp_fib6_entry_rt_find(const struct mlxsw_sp_fib6_entry *fib6_entry,
return NULL; return NULL;
} }
static bool mlxsw_sp_nexthop6_ipip_type(const struct mlxsw_sp *mlxsw_sp,
const struct rt6_info *rt,
enum mlxsw_sp_ipip_type *ret)
{
return rt->dst.dev &&
mlxsw_sp_netdev_ipip_type(mlxsw_sp, rt->dst.dev, ret);
}
static int mlxsw_sp_nexthop6_type_init(struct mlxsw_sp *mlxsw_sp, static int mlxsw_sp_nexthop6_type_init(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_nexthop_group *nh_grp, struct mlxsw_sp_nexthop_group *nh_grp,
struct mlxsw_sp_nexthop *nh, struct mlxsw_sp_nexthop *nh,
const struct rt6_info *rt) const struct rt6_info *rt)
{ {
struct mlxsw_sp_router *router = mlxsw_sp->router;
struct net_device *dev = rt->dst.dev; struct net_device *dev = rt->dst.dev;
enum mlxsw_sp_ipip_type ipipt;
struct mlxsw_sp_rif *rif; struct mlxsw_sp_rif *rif;
int err; int err;
if (mlxsw_sp_nexthop6_ipip_type(mlxsw_sp, rt, &ipipt) &&
router->ipip_ops_arr[ipipt]->can_offload(mlxsw_sp, dev,
MLXSW_SP_L3_PROTO_IPV6)) {
nh->type = MLXSW_SP_NEXTHOP_TYPE_IPIP;
return mlxsw_sp_nexthop_ipip_init(mlxsw_sp, ipipt, nh, dev);
}
nh->type = MLXSW_SP_NEXTHOP_TYPE_ETH; nh->type = MLXSW_SP_NEXTHOP_TYPE_ETH;
rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev); rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev);
if (!rif) if (!rif)
...@@ -3815,7 +3832,8 @@ static void mlxsw_sp_nexthop6_fini(struct mlxsw_sp *mlxsw_sp, ...@@ -3815,7 +3832,8 @@ static void mlxsw_sp_nexthop6_fini(struct mlxsw_sp *mlxsw_sp,
static bool mlxsw_sp_rt6_is_gateway(const struct mlxsw_sp *mlxsw_sp, static bool mlxsw_sp_rt6_is_gateway(const struct mlxsw_sp *mlxsw_sp,
const struct rt6_info *rt) const struct rt6_info *rt)
{ {
return rt->rt6i_flags & RTF_GATEWAY; return rt->rt6i_flags & RTF_GATEWAY ||
mlxsw_sp_nexthop6_ipip_type(mlxsw_sp, rt, NULL);
} }
static struct mlxsw_sp_nexthop_group * static struct mlxsw_sp_nexthop_group *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment