Skip to content

Commit d9e1661

Browse files
committed
Merge branch 'mlxsw-Reflect-nexthop-status-changes'
Jiri Pirko says: ==================== mlxsw: Reflect nexthop status changes Ido says: When the kernel forwards IPv4 packets via multipath routes it doesn't consider nexthops that are dead or linkdown. For example, if the nexthop netdev is administratively down or doesn't have a carrier. Devices capable of offloading such multipath routes need to be made aware of changes in the reflected nexthops' status. Otherwise, the device might forward packets via non-functional nexthops, resulting in packet loss. This patchset aims to fix that. The first 11 patches deal with the necessary restructuring in the mlxsw driver, so that it's able to correctly add and remove nexthops from the device's adjacency table. The 12th patch adds the NH_{ADD,DEL} events to the FIB notification chain. These notifications are sent whenever the kernel decides to add or remove a nexthop from the forwarding plane. Finally, the last three patches add support for these events in the mlxsw driver, which is currently the only driver capable of offloading multipath routes. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents b05d0cf + 9665b74 commit d9e1661

File tree

5 files changed

+450
-130
lines changed

5 files changed

+450
-130
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3473,6 +3473,8 @@ mlxsw_sp_rif_alloc(u16 rif, struct net_device *l3_dev, struct mlxsw_sp_fid *f)
34733473
if (!r)
34743474
return NULL;
34753475

3476+
INIT_LIST_HEAD(&r->nexthop_list);
3477+
INIT_LIST_HEAD(&r->neigh_list);
34763478
ether_addr_copy(r->addr, l3_dev->dev_addr);
34773479
r->mtu = l3_dev->mtu;
34783480
r->ref_count = 1;
@@ -3541,6 +3543,8 @@ static void mlxsw_sp_vport_rif_sp_destroy(struct mlxsw_sp_port *mlxsw_sp_vport,
35413543
u16 fid = f->fid;
35423544
u16 rif = r->rif;
35433545

3546+
mlxsw_sp_router_rif_gone_sync(mlxsw_sp, r);
3547+
35443548
mlxsw_sp->rifs[rif] = NULL;
35453549
f->r = NULL;
35463550

@@ -3770,6 +3774,8 @@ void mlxsw_sp_rif_bridge_destroy(struct mlxsw_sp *mlxsw_sp,
37703774
struct mlxsw_sp_fid *f = r->f;
37713775
u16 rif = r->rif;
37723776

3777+
mlxsw_sp_router_rif_gone_sync(mlxsw_sp, r);
3778+
37733779
mlxsw_sp->rifs[rif] = NULL;
37743780
f->r = NULL;
37753781

drivers/net/ethernet/mellanox/mlxsw/spectrum.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ struct mlxsw_sp_fid {
108108
};
109109

110110
struct mlxsw_sp_rif {
111+
struct list_head nexthop_list;
112+
struct list_head neigh_list;
111113
struct net_device *dev;
112114
unsigned int ref_count;
113115
struct mlxsw_sp_fid *f;
@@ -254,13 +256,14 @@ struct mlxsw_sp_router {
254256
struct mlxsw_sp_lpm_tree lpm_trees[MLXSW_SP_LPM_TREE_COUNT];
255257
struct mlxsw_sp_vr *vrs;
256258
struct rhashtable neigh_ht;
259+
struct rhashtable nexthop_group_ht;
260+
struct rhashtable nexthop_ht;
257261
struct {
258262
struct delayed_work dw;
259263
unsigned long interval; /* ms */
260264
} neighs_update;
261265
struct delayed_work nexthop_probe_dw;
262266
#define MLXSW_SP_UNRESOLVED_NH_PROBE_INTERVAL 5000 /* ms */
263-
struct list_head nexthop_group_list;
264267
struct list_head nexthop_neighs_list;
265268
bool aborted;
266269
};
@@ -601,6 +604,8 @@ int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp);
601604
void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp);
602605
int mlxsw_sp_router_netevent_event(struct notifier_block *unused,
603606
unsigned long event, void *ptr);
607+
void mlxsw_sp_router_rif_gone_sync(struct mlxsw_sp *mlxsw_sp,
608+
struct mlxsw_sp_rif *r);
604609

605610
int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int entry_count);
606611
void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, int entry_index);

0 commit comments

Comments
 (0)