Message ID | 20200908091037.2709823-9-idosch@idosch.org |
---|---|
State | New |
Headers | show |
Series | nexthop: Add support for nexthop objects offload | expand |
On Tue, Sep 08, 2020 at 08:58:07AM -0600, David Ahern wrote: > On 9/8/20 3:10 AM, Ido Schimmel wrote: > > From: Ido Schimmel <idosch@nvidia.com> > > > > Convert the sole listener of the nexthop notification chain (the VXLAN > > driver) to the new notification info. > > > > Signed-off-by: Ido Schimmel <idosch@nvidia.com> > > --- > > drivers/net/vxlan.c | 9 +++++++-- > > net/ipv4/nexthop.c | 2 +- > > 2 files changed, 8 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c > > index b9fefe27e3e8..29deedee6ef4 100644 > > --- a/drivers/net/vxlan.c > > +++ b/drivers/net/vxlan.c > > @@ -4687,9 +4687,14 @@ static void vxlan_fdb_nh_flush(struct nexthop *nh) > > static int vxlan_nexthop_event(struct notifier_block *nb, > > unsigned long event, void *ptr) > > { > > - struct nexthop *nh = ptr; > > + struct nh_notifier_info *info = ptr; > > + struct nexthop *nh; > > + > > + if (event != NEXTHOP_EVENT_DEL) > > + return NOTIFY_DONE; > > > > - if (!nh || event != NEXTHOP_EVENT_DEL) > > + nh = nexthop_find_by_id(info->net, info->id); > > hmmm.... why add the id to the info versus a nh pointer if a lookup is > needed? This goes back to my reasoning in patch #5. I preferred not to pass the raw nexthop data structures to listeners as they usually have no business poking into them. I believe the VXLAN driver is the exception here as it does need access to 'fdb_list'. > > > + if (!nh) > > return NOTIFY_DONE; > > > > vxlan_fdb_nh_flush(nh); >
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index b9fefe27e3e8..29deedee6ef4 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -4687,9 +4687,14 @@ static void vxlan_fdb_nh_flush(struct nexthop *nh) static int vxlan_nexthop_event(struct notifier_block *nb, unsigned long event, void *ptr) { - struct nexthop *nh = ptr; + struct nh_notifier_info *info = ptr; + struct nexthop *nh; + + if (event != NEXTHOP_EVENT_DEL) + return NOTIFY_DONE; - if (!nh || event != NEXTHOP_EVENT_DEL) + nh = nexthop_find_by_id(info->net, info->id); + if (!nh) return NOTIFY_DONE; vxlan_fdb_nh_flush(nh); diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index 68fd25c6eec7..70c8ab6906ec 100644 --- a/net/ipv4/nexthop.c +++ b/net/ipv4/nexthop.c @@ -150,7 +150,7 @@ static int call_nexthop_notifiers(struct net *net, } err = blocking_notifier_call_chain(&net->nexthop.notifier_chain, - event_type, nh); + event_type, &info); nh_notifier_info_fini(&info); return notifier_to_errno(err);