Message ID | 99559c7574a7081b26a8ff466b8abb49e22789c7.1615387786.git.petrm@nvidia.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | nexthop: Resilient next-hop groups | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 1 maintainers not CCed: yoshfuji@linux-ipv6.org |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 636 this patch: 636 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 49 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 661 this patch: 661 |
netdev/header_inline | success | Link |
On 3/10/21 8:02 AM, Petr Machata wrote: > With the introduction of resilient nexthop groups, there will be two types > of multipath groups: the current hash-threshold "mpath" ones, and resilient > groups. Both are multipath, but to determine the fact, the system needs to > consider two flags. This might prove costly in the datapath. Therefore, > introduce a new flag, that should be set for next-hop groups that have more > than one nexthop, and should be considered multipath. > > Signed-off-by: Petr Machata <petrm@nvidia.com> > Reviewed-by: Ido Schimmel <idosch@nvidia.com> > --- > > Notes: > v1 (changes since RFC): > - This patch is new > > include/net/nexthop.h | 7 ++++--- > net/ipv4/nexthop.c | 5 ++++- > 2 files changed, 8 insertions(+), 4 deletions(-) This patch looks good: Reviewed-by: David Ahern <dsahern@kernel.org> > > diff --git a/include/net/nexthop.h b/include/net/nexthop.h > index 7bc057aee40b..5062c2c08e2b 100644 > --- a/include/net/nexthop.h > +++ b/include/net/nexthop.h > @@ -80,6 +80,7 @@ struct nh_grp_entry { > struct nh_group { > struct nh_group *spare; /* spare group for removals */ > u16 num_nh; > + bool is_multipath; > bool mpath; It would be good to rename the existing type 'mpath' to something else. You have 'resilient' as a group type later, so maybe rename this one to hash or hash_threshold.
David Ahern <dsahern@gmail.com> writes: >> diff --git a/include/net/nexthop.h b/include/net/nexthop.h >> index 7bc057aee40b..5062c2c08e2b 100644 >> --- a/include/net/nexthop.h >> +++ b/include/net/nexthop.h >> @@ -80,6 +80,7 @@ struct nh_grp_entry { >> struct nh_group { >> struct nh_group *spare; /* spare group for removals */ >> u16 num_nh; >> + bool is_multipath; >> bool mpath; > > > It would be good to rename the existing type 'mpath' to something else. > You have 'resilient' as a group type later, so maybe rename this one to > hash or hash_threshold. All right, I'll send a follow-up with that.
On 3/11/21 8:39 AM, Petr Machata wrote: > > David Ahern <dsahern@gmail.com> writes: > >>> diff --git a/include/net/nexthop.h b/include/net/nexthop.h >>> index 7bc057aee40b..5062c2c08e2b 100644 >>> --- a/include/net/nexthop.h >>> +++ b/include/net/nexthop.h >>> @@ -80,6 +80,7 @@ struct nh_grp_entry { >>> struct nh_group { >>> struct nh_group *spare; /* spare group for removals */ >>> u16 num_nh; >>> + bool is_multipath; >>> bool mpath; >> >> >> It would be good to rename the existing type 'mpath' to something else. >> You have 'resilient' as a group type later, so maybe rename this one to >> hash or hash_threshold. > > All right, I'll send a follow-up with that. > I'm fine with the rename being a followup after this patch set or as the last patch in this set.
David Ahern <dsahern@gmail.com> writes: > On 3/11/21 8:39 AM, Petr Machata wrote: >> >> David Ahern <dsahern@gmail.com> writes: >> >>>> diff --git a/include/net/nexthop.h b/include/net/nexthop.h >>>> index 7bc057aee40b..5062c2c08e2b 100644 >>>> --- a/include/net/nexthop.h >>>> +++ b/include/net/nexthop.h >>>> @@ -80,6 +80,7 @@ struct nh_grp_entry { >>>> struct nh_group { >>>> struct nh_group *spare; /* spare group for removals */ >>>> u16 num_nh; >>>> + bool is_multipath; >>>> bool mpath; >>> >>> >>> It would be good to rename the existing type 'mpath' to something else. >>> You have 'resilient' as a group type later, so maybe rename this one to >>> hash or hash_threshold. >> >> All right, I'll send a follow-up with that. > > I'm fine with the rename being a followup after this patch set or as the > last patch in this set. I looked at this, it's more than just this struct field. There is a whole number of functions with mpath in their name to reflect that they are for the hash-threshold algorithm. (And then some where the "mpath" reflects is_multipath assumption.) So I'll send this separately, and have it go through our regression. It's still trivialish renaming, but a fair amount thereof.
diff --git a/include/net/nexthop.h b/include/net/nexthop.h index 7bc057aee40b..5062c2c08e2b 100644 --- a/include/net/nexthop.h +++ b/include/net/nexthop.h @@ -80,6 +80,7 @@ struct nh_grp_entry { struct nh_group { struct nh_group *spare; /* spare group for removals */ u16 num_nh; + bool is_multipath; bool mpath; bool fdb_nh; bool has_v4; @@ -212,7 +213,7 @@ static inline bool nexthop_is_multipath(const struct nexthop *nh) struct nh_group *nh_grp; nh_grp = rcu_dereference_rtnl(nh->nh_grp); - return nh_grp->mpath; + return nh_grp->is_multipath; } return false; } @@ -227,7 +228,7 @@ static inline unsigned int nexthop_num_path(const struct nexthop *nh) struct nh_group *nh_grp; nh_grp = rcu_dereference_rtnl(nh->nh_grp); - if (nh_grp->mpath) + if (nh_grp->is_multipath) rc = nh_grp->num_nh; } @@ -308,7 +309,7 @@ struct fib_nh_common *nexthop_fib_nhc(struct nexthop *nh, int nhsel) struct nh_group *nh_grp; nh_grp = rcu_dereference_rtnl(nh->nh_grp); - if (nh_grp->mpath) { + if (nh_grp->is_multipath) { nh = nexthop_mpath_select(nh_grp, nhsel); if (!nh) return NULL; diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index 69c8b50a936e..56c54d0fbacc 100644 --- a/net/ipv4/nexthop.c +++ b/net/ipv4/nexthop.c @@ -967,6 +967,7 @@ static void remove_nh_grp_entry(struct net *net, struct nh_grp_entry *nhge, } newg->has_v4 = false; + newg->is_multipath = nhg->is_multipath; newg->mpath = nhg->mpath; newg->fdb_nh = nhg->fdb_nh; newg->num_nh = nhg->num_nh; @@ -1488,8 +1489,10 @@ static struct nexthop *nexthop_create_group(struct net *net, nhg->nh_entries[i].nh_parent = nh; } - if (cfg->nh_grp_type == NEXTHOP_GRP_TYPE_MPATH) + if (cfg->nh_grp_type == NEXTHOP_GRP_TYPE_MPATH) { nhg->mpath = 1; + nhg->is_multipath = true; + } WARN_ON_ONCE(nhg->mpath != 1);