nexthop: Fix fdb labeling for groups
Subsystems (3)
David Ahern
maintainerPATCH v2 1/1 nexthop: Fix fdb labeling for groups
fdb nexthops are marked with a flag. For standalone nexthops, a flag was added to the nh_info struct. For groups that flag was added to struct nexthop when it should have been added to the group information. Fix by removing the flag from the nexthop struct and adding a flag to nh_group that mirrors nh_info and is really only a caching of the individual types. Add a helper, nexthop_is_fdb, for use by the vxlan code and fixup the internal code to use the flag from either nh_info or nh_group.
v2
- propagate fdb_nh in remove_nh_grp_entry
---
Roopa: you have not submitted the iproute2 patch, so I can not run the fdb selftests added to fib_nexthops.sh
drivers/net/vxlan.c | 2 +- include/net/nexthop.h | 17 ++++++++- net/ipv4/nexthop.c | 82 ++++++++++++++++++++++++++----------------- 3 files changed, 66 insertions(+), 35 deletions(-)
drivers/net/vxlan.c +1 -1
@@ -876,7 +876,7 @@ static int vxlan_fdb_nh_update(struct vxlan_dev *vxlan, struct vxlan_fdb *fdb, nh =NULL ; goto err_inval; } -if (!nh->is_fdb_nh) { +if (!nexthop_is_fdb (nh)) {NL_SET_ERR_MSG (extack,"Nexthop is not a fdb nexthop" ); goto err_inval; }
include/net/nexthop.h +16 -1
@@ -76,6 +76,7 @@ struct nh_group {struct nh_group *spare;/* spare group for removals */ u16 num_nh;bool mpath; +bool fdb_nh;bool has_v4;struct nh_grp_entry nh_entries[]; };
@@ -93,7 +94,6 @@ struct nexthop {u8 protocol;/* app managing this nh */ u8 nh_flags;bool is_group; -bool is_fdb_nh;refcount_t refcnt;struct rcu_head rcu;
@@ -136,6 +136,21 @@ static inline bool nexthop_cmp(const struct nexthop *nh1,return nh1 == nh2; } +static inline bool nexthop_is_fdb (const struct nexthop *nh) +{ +if (nh->is_group) { +const struct nh_group *nh_grp; + + nh_grp =rcu_dereference_rtnl (nh->nh_grp); +return nh_grp->fdb_nh; + }else { +const struct nh_info *nhi; + + nhi =rcu_dereference_rtnl (nh->nh_info); +return nhi->fdb_nh; + } +} +static inline bool nexthop_is_multipath (const struct nexthop *nh) {if (nh->is_group) {
net/ipv4/nexthop.c +49 -33
227 lines not on this page · raw message
Signature · 1 line
2.17.1
From: David Ahern <[email protected]>
Date: Mon, 8 Jun 2020 20:54:43 -0600
Quoted 8 lines
fdb nexthops are marked with a flag. For standalone nexthops, a flag was added to the
nh_infostruct. For groups that flag was added to struct nexthop when it should have been added to the group information. Fix by removing the flag from the nexthop struct and adding a flag tonh_groupthat mirrorsnh_infoand is really only a caching of the individual types. Add a helper,nexthop_is_fdb, for use by the vxlan code and fixup the internal code to use the flag from eithernh_infoornh_group.
Quoted 6 lines
v2
- propagatefdb_nhinremove_nh_grp_entryFixes 38428d68719c ("nexthop: support for fdb ecmp nexthops")Cc Roopa Prabhu <[email protected]>Signed-off-by David Ahern <[email protected]>
Applied, thanks David.
Quoted 9 lines · David Ahern
fdb nexthops are marked with a flag. For standalone nexthops, a flag was added to the
nh_infostruct. For groups that flag was added to struct nexthop when it should have been added to the group information. Fix by removing the flag from the nexthop struct and adding a flag tonh_groupthat mirrorsnh_infoand is really only a caching of the individual types. Add a helper,nexthop_is_fdb, for use by the vxlan code and fixup the internal code to use the flag from eithernh_infoornh_group.
Quoted 6 lines
v2
- propagatefdb_nhinremove_nh_grp_entryFixes 38428d68719c ("nexthop: support for fdb ecmp nexthops")Cc Roopa Prabhu <[email protected]>Signed-off-by David Ahern <[email protected]>
nice cleanups. Thanks David.
looks like the patches were just applied, FWIW,