Re: [PATCH v2] bridge: Fix a deadlock when enabling multicast snooping
From: Huang, Joseph
Date: Fri Dec 04 2020 - 17:31:17 EST
> > + if (join_snoopers)
> > + br_multicast_join_snoopers(br);
> > + else if (leave_snoopers)
> > + br_multicast_leave_snoopers(br);
>
> If I'm not missing anything this can be just 1 bool like "change_snoopers" or
> something which if set to true will check BROPT_MULTICAST_ENABLED and
> act accordingly, i.e.
> if (change_snoopers) {
> if (br_opt_get(br, BROPT_MULTICAST_ENABLED))
> br_multicast_join_snoopers(br);
> else
> br_multicast_leave_snoopers(br); }
>
> This is not really something critical, just an observation. Up to your
> preference if you decide to leave it with 2 bools. :-)
>
> Cheers,
> Nik
I wasn't sure how expensive the call to br_opt_get is, so I used a bool for each.
I just checked and it seems that br_opt_get is probably just as cheap as a bool,
so I'll change it according to what you suggested here.
Thanks for your comments!!
Thanks,
Joseph