Skip to content

Commit df6dd79

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum_router: Don't reflect LINKDOWN nexthops
The kernel resolves the nexthops for a given route using FIB_LOOKUP_IGNORE_LINKSTATE which means a notification can be sent for a route with one of its nexthops being LINKDOWN. In case IGNORE_ROUTES_WITH_LINKDOWN is set for the nexthop netdev, then we shouldn't reflect the nexthop to the device's table. Once the nexthop netdev's carrier goes up we'll be notified using NH_ADD and reflect it to the device. Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d9e1661 commit df6dd79

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <linux/bitops.h>
4141
#include <linux/in6.h>
4242
#include <linux/notifier.h>
43+
#include <linux/inetdevice.h>
4344
#include <net/netevent.h>
4445
#include <net/neighbour.h>
4546
#include <net/arp.h>
@@ -1548,6 +1549,7 @@ static int mlxsw_sp_nexthop_init(struct mlxsw_sp *mlxsw_sp,
15481549
struct fib_nh *fib_nh)
15491550
{
15501551
struct net_device *dev = fib_nh->nh_dev;
1552+
struct in_device *in_dev;
15511553
struct mlxsw_sp_rif *r;
15521554
int err;
15531555

@@ -1557,6 +1559,11 @@ static int mlxsw_sp_nexthop_init(struct mlxsw_sp *mlxsw_sp,
15571559
if (err)
15581560
return err;
15591561

1562+
in_dev = __in_dev_get_rtnl(dev);
1563+
if (in_dev && IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev) &&
1564+
fib_nh->nh_flags & RTNH_F_LINKDOWN)
1565+
return 0;
1566+
15601567
r = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev);
15611568
if (!r)
15621569
return 0;
@@ -1660,8 +1667,10 @@ mlxsw_sp_nexthop_group_create(struct mlxsw_sp *mlxsw_sp, struct fib_info *fi)
16601667

16611668
err_nexthop_group_insert:
16621669
err_nexthop_init:
1663-
for (i--; i >= 0; i--)
1670+
for (i--; i >= 0; i--) {
1671+
nh = &nh_grp->nexthops[i];
16641672
mlxsw_sp_nexthop_fini(mlxsw_sp, nh);
1673+
}
16651674
kfree(nh_grp);
16661675
return ERR_PTR(err);
16671676
}

0 commit comments

Comments
 (0)