Re: [RFC PATCH] net: bridge: multicast: add support for L2 entries
From: Nikolay Aleksandrov
Date: Sun Oct 25 2020 - 06:50:27 EST
On Sun, 2020-10-25 at 06:59 +0000, Vladimir Oltean wrote:
> On Wed, Oct 21, 2020 at 09:17:07AM +0000, Nikolay Aleksandrov wrote:
> > > diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
> > > index 4c687686aa8f..a25f6f9aa8c3 100644
> > > --- a/include/uapi/linux/if_bridge.h
> > > +++ b/include/uapi/linux/if_bridge.h
> > > @@ -520,12 +520,14 @@ struct br_mdb_entry {
> > > #define MDB_FLAGS_FAST_LEAVE (1 << 1)
> > > #define MDB_FLAGS_STAR_EXCL (1 << 2)
> > > #define MDB_FLAGS_BLOCKED (1 << 3)
> > > +#define MDB_FLAGS_L2 (1 << 5)
> >
> > I think this should be 4.
> >
>
> Shouldn't this be in sync with MDB_PG_FLAGS_L2 though? We also have
> MDB_PG_FLAGS_BLOCKED which is BIT(4).
Unfortunately they haven't been in sync from the start. MDB_FLAGS bit
0 is offload, while MDB_PG_FLAGS bit 0 is permanent. As you can see
here blocked is bit 3, while internally it's 4 due to the same reason.
We can't afford to skip 1 bit since this is uAPI and we only got 8
available bits. I wonder if we need these L2 bits at all, why not use
only proto == 0 to denote it's a L2 entry? I can't remember why I added
the bits back then, but until now proto == 0 wasn't allowed and the
kernel couldn't export it as such, so it seems possible to use it.