vlan patch

Brooks Davis brooks at one-eyed-alien.net
Wed Oct 19 10:17:13 PDT 2005


On Wed, Oct 19, 2005 at 11:25:59PM +1300, Andrew Thompson wrote:
> Hi,
>    
> It has always bugged me how the vlan code traverses the linked-list for
> each incoming packet to find the right ifvlan, I have this patch which
> attempts to fix this.
>   
> What it does is replace the linear search for the vlan with a constant
> time lookup. It does this by allocating an array for each vlan enabled
> parent interface so the tag can be directly indexed.
>   
> This has an overhead of ~16kb on 32bit, this is not too bad as there is
> usually only one physical interface when using a large number of vlans.
>   
> I have measured a 1.6% pps increase with 100 vlans, and 8% with 500, and
> yes, some people use this many in production.
>   
> It also has the benefit of enforcing unique vlan tags per parent which   
> the current code doesn't do.

I like the idea and had been thinking of doing something similar.  I'm a
bit concerned about cleanup.  It doens't look like the network code
needs to grow the ability to unconfig existing vlans if they are there
during if_detach.  It looks like publishing a pointer to vlan_config is
the thing to do.

It would be best if the new member where added to the end of struct
ifnet to avoid breaking the ABI for now.

We may want to develop some sort of policy around that sort of thing
where we append each time, but mark the correct location for each one
with #ifdef BREAK_IFNET_ABI.  Then when an ABI breaking change has to
happen in current, we resort the structure correctly.

-- Brooks

-- 
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20051019/9d1f3019/attachment.bin


More information about the freebsd-net mailing list