Skip to content

Commit de0f43c

Browse files
pmachatadavem330
authored andcommitted
mlxsw: spectrum_router: Track RIF of IPIP next hops
When considering whether to set RTNH_F_OFFLOAD flag on an IPv6 route, mlxsw_sp_fib6_entry_offload_set() looks up the mlxsw_sp_nexthop corresponding to a given route, and decides based on whether the next hop's offloaded flag was set. When looking for the matching next hop, it also takes into account the device of the route, which must match next hop's RIF. IPIP next hops however hitherto didn't set the RIF. As a result, IPv6 routes forwarding traffic to IP-in-IP netdevices are never marked as offloaded, even when they actually are. Thus track RIF of IPIP next hops the same way as that of ETHERNET next hops. Fixes: 8f28a30 ("mlxsw: spectrum_router: Support IPv6 overlay encap") Signed-off-by: Petr Machata <petrm@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 28a04c7 commit de0f43c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2723,6 +2723,7 @@ static void mlxsw_sp_nexthop_type_fini(struct mlxsw_sp *mlxsw_sp,
27232723
mlxsw_sp_nexthop_rif_fini(nh);
27242724
break;
27252725
case MLXSW_SP_NEXTHOP_TYPE_IPIP:
2726+
mlxsw_sp_nexthop_rif_fini(nh);
27262727
mlxsw_sp_nexthop_ipip_fini(mlxsw_sp, nh);
27272728
break;
27282729
}
@@ -2742,7 +2743,11 @@ static int mlxsw_sp_nexthop4_type_init(struct mlxsw_sp *mlxsw_sp,
27422743
router->ipip_ops_arr[ipipt]->can_offload(mlxsw_sp, dev,
27432744
MLXSW_SP_L3_PROTO_IPV4)) {
27442745
nh->type = MLXSW_SP_NEXTHOP_TYPE_IPIP;
2745-
return mlxsw_sp_nexthop_ipip_init(mlxsw_sp, ipipt, nh, dev);
2746+
err = mlxsw_sp_nexthop_ipip_init(mlxsw_sp, ipipt, nh, dev);
2747+
if (err)
2748+
return err;
2749+
mlxsw_sp_nexthop_rif_init(nh, &nh->ipip_entry->ol_lb->common);
2750+
return 0;
27462751
}
27472752

27482753
nh->type = MLXSW_SP_NEXTHOP_TYPE_ETH;
@@ -4009,7 +4014,11 @@ static int mlxsw_sp_nexthop6_type_init(struct mlxsw_sp *mlxsw_sp,
40094014
router->ipip_ops_arr[ipipt]->can_offload(mlxsw_sp, dev,
40104015
MLXSW_SP_L3_PROTO_IPV6)) {
40114016
nh->type = MLXSW_SP_NEXTHOP_TYPE_IPIP;
4012-
return mlxsw_sp_nexthop_ipip_init(mlxsw_sp, ipipt, nh, dev);
4017+
err = mlxsw_sp_nexthop_ipip_init(mlxsw_sp, ipipt, nh, dev);
4018+
if (err)
4019+
return err;
4020+
mlxsw_sp_nexthop_rif_init(nh, &nh->ipip_entry->ol_lb->common);
4021+
return 0;
40134022
}
40144023

40154024
nh->type = MLXSW_SP_NEXTHOP_TYPE_ETH;

0 commit comments

Comments
 (0)