Unify vlan_input() and vlan_input_tag():
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 16 May 2008 13:19:12 +0000 (13:19 +0000)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 16 May 2008 13:19:12 +0000 (13:19 +0000)
commite6b5847cec36d34d78ec0337eee5cbf5cfbd80e5
tree2c2bd71fce13f0bb3df7b98ecab09d94c0f72fe3
parent8773ea83cafd27ec2303dc02816b137bd194591d
Unify vlan_input() and vlan_input_tag():
- For device drivers that support hardware vlan tag extraction, mbuf's
  M_VLANTAG is turned on and vlan tag is saved in mbuf.m_pkthdr.ether_vlantag
- At the very beginning of ether_input_chain(), if the packet's ether type is
  vlan and hardware does not extract vlan tag, vlan_ether_decap() is called to
  do software vlan tag extraction.
- Instead of BPF_MTAP(), ETHER_BPF_MTAP() is used in ether_input_chain() to
  deliver possible vlan tagging information to the bpf listeners.
- Ether header is restored before calling vlan_input(), so under most cases,
  extra ether header copy is avoided.  vlan_input() does nothing more than
  finding vlan interface and looping back the packet to ether_input_chain()
  with vlan interface as input interface.

Ideas-from: FreeBSD
14 files changed:
sys/dev/netif/bce/if_bce.c
sys/dev/netif/bge/if_bge.c
sys/dev/netif/em/if_em.c
sys/dev/netif/nge/if_nge.c
sys/dev/netif/re/if_re.c
sys/dev/netif/stge/if_stge.c
sys/dev/netif/ti/if_ti.c
sys/dev/netif/txp/if_txp.c
sys/dev/netif/vge/if_vge.c
sys/net/ethernet.h
sys/net/if_ethersubr.c
sys/net/vlan/if_vlan.c
sys/net/vlan/if_vlan_ether.c
sys/net/vlan/if_vlan_ether.h