[PATCH 3/3] bridge: Add support for VLANs

Thomas Haller thaller at redhat.com
Mon Dec 7 03:25:07 PST 2015


On Sat, 2015-12-05 at 13:27 -0700, David Ahern wrote:
> On 12/2/15 11:30 AM, Thomas Haller wrote:
> > Hi David, Tobias,
> > 
> > I just reworked the branch again (heavily).
> > 
> > Latest and greatest at:
> > https://github.com/thom311/libnl/commit/bridge-vlan
> > 
> > 
> > Now it contains Tobias' patch and I did the changes I was talking
> > in
> > the other thread about.
> > 
> > I added your original patches with fixup commits to make it
> > somewhat
> > clearer what I changed.
> > 
> 
> A couple of comments:
> 1. since you changed the bitmap from unsigned longs to uint32 the 
> __builtin_ffsl should be changed to __builtin_ffs.

Changed. I think it is always true on supported archs that
sizeof(uint32_t) <= sizeof(int).
I am unsure what happens when casting the unsigned value to "signed
int", but I guess it will still work as expected/correctly.



> 2. Why not leave the macros:
> 
> +#define BR_VLAN_MAX            4096
> +#define BR_VLAN_BITMAP_LEN     (BR_VLAN_MAX / sizeof(uint32_t))

Added back:
+#define RTNL_LINK_BRIDGE_VLAN_BITMAP_MAX 4096
+#define RTNL_LINK_BRIDGE_VLAN_BITMAP_LEN (RTNL_LINK_BRIDGE_VLAN_BITMAP_MAX / 32)

> in include/netlink/route/link/bridge.h and avoid magic numbers?
> 
> > 
> > (beware: I didn't actually test it).
> 
> 
> I did test it; works fine for me.

Thank you.

Merged to master:
https://github.com/thom311/libnl/commit/6555b0df89b1a99cfc32431600cd0a83345274ab



Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20151207/0b1819f8/attachment.sig>


More information about the libnl mailing list