Henning Brauer (henning@) writes in to let us know that he has some vlan(4) improvements in the pipeline:
so, on vlan, to insert the vlan tag, we right now: -copy (most of) the existing ethernet header into a ether_vlan_header on the stack -fill the extra fields (tag, inside ether type) in ether_vlan_header -set the ether type -m_adj() to make room for the extra space ether_vlan_header needs -m_copyback the ether_vlan_header into the mbuf that involves moving data around, which isn't all that cheap. now it turns out it is trivial to have ether_output prepend the ether_vlan_header instead of the regular ethernet header, which makes the vlan tagging essentially free in most cases. you need a very current src tree to test this, relies on the code shuffling in if_ethersubr.c I did a few hours ago.
If you have a setup that involves vlan(4), you can test by applying the patch and pushing some packets. As always, widespread testing is key to the continued quality of our releases.