Re: [net-next v2 09/11] net: bridge: mcast: split multicast router state for IPv4 and IPv6

From: Linus Lüssing
Date: Tue May 11 2021 - 07:29:03 EST


On Tue, May 11, 2021 at 12:29:41PM +0300, Nikolay Aleksandrov wrote:
> [...]
> > -static void br_multicast_mark_router(struct net_bridge *br,
> > - struct net_bridge_port *port)
> > +#if IS_ENABLED(CONFIG_IPV6)
> > +struct hlist_node *
> > +br_ip6_multicast_get_rport_slot(struct net_bridge *br, struct net_bridge_port *port)
> > +{
> > + struct hlist_node *slot = NULL;
> > + struct net_bridge_port *p;
> > +
> > + hlist_for_each_entry(p, &br->ip6_mc_router_list, ip6_rlist) {
> > + if ((unsigned long)port >= (unsigned long)p)
> > + break;
> > + slot = &p->ip6_rlist;
> > + }
> > +
> > + return slot;
> > +}
>
> The ip4/ip6 get_rport_slot functions are identical, why not add a list pointer
> and use one function ?

Hi Nikolay,

Thanks for all the feedback and reviewing again! I'll
remove (most of) the inlines as the router list modifications are
not in the fast path.

For the get_rport_slot functions, maybe I'm missing a simple
solution. Note that "ip6_rlist" in hlist_for_each_entry() is not a
pointer but will be expanded by the macro. I currently don't see
how I could solve this with just one hlist_for_each_entry().

Regards, Linus