diff options
author | andre <andre@FreeBSD.org> | 2006-09-17 13:33:30 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2006-09-17 13:33:30 +0000 |
commit | 2d9e7e4a32c8c33011a4a625f3560ff186124090 (patch) | |
tree | 0c60fd4adaa245ddeb4255e5c579b7939f52463f /sys/net80211 | |
parent | 9f404382211c4f1a6f9dccff7813b9ce26b9fcef (diff) | |
download | FreeBSD-src-2d9e7e4a32c8c33011a4a625f3560ff186124090.zip FreeBSD-src-2d9e7e4a32c8c33011a4a625f3560ff186124090.tar.gz |
Move ethernet VLAN tags from mtags to its own mbuf packet header field
m_pkthdr.ether_vlan. The presence of the M_VLANTAG flag on the mbuf
signifies the presence and validity of its content.
Drivers that support hardware VLAN tag stripping fill in the received
VLAN tag (containing both vlan and priority information) into the
ether_vtag mbuf packet header field:
m->m_pkthdr.ether_vtag = vlan_id; /* ntohs()? */
m->m_flags |= M_VLANTAG;
to mark the packet m with the specified VLAN tag.
On output the driver should check the mbuf for the M_VLANTAG flag to
see if a VLAN tag is present and valid:
if (m->m_flags & M_VLANTAG) {
... = m->m_pkthdr.ether_vtag; /* htons()? */
... pass tag to hardware ...
}
VLAN tags are stored in host byte order. Byte swapping may be necessary.
(Note: This driver conversion was mechanic and did not add or remove any
byte swapping in the drivers.)
Remove zone_mtag_vlan UMA zone and MTAG_VLAN definition. No more tag
memory allocation have to be done.
Reviewed by: thompsa, yar
Sponsored by: TCP/IP Optimization Fundraise 2005
Diffstat (limited to 'sys/net80211')
-rw-r--r-- | sys/net80211/ieee80211_input.c | 12 | ||||
-rw-r--r-- | sys/net80211/ieee80211_output.c | 5 |
2 files changed, 4 insertions, 13 deletions
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index 12cdf3d..511e6e1 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -722,19 +722,11 @@ ieee80211_deliver_data(struct ieee80211com *ic, m->m_pkthdr.rcvif = ifp; if (ni->ni_vlan != 0) { /* attach vlan tag */ - VLAN_INPUT_TAG(ifp, m, ni->ni_vlan); - if (m == NULL) - goto out; /* XXX goto err? */ + m->m_pkthdr.ether_vtag = ni->ni_vlan; + m->m_flags |= M_VLANTAG; } (*ifp->if_input)(ifp, m); } - return; - out: - if (m != NULL) { - if (bpf_peers_present(ic->ic_rawbpf)) - bpf_mtap(ic->ic_rawbpf, m); - m_freem(m); - } } static struct mbuf * diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index 73e11fb..76101be 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -400,12 +400,11 @@ ieee80211_classify(struct ieee80211com *ic, struct mbuf *m, struct ieee80211_nod */ v_wme_ac = 0; if (ni->ni_vlan != 0) { - struct m_tag *mtag = VLAN_OUTPUT_TAG(ic->ic_ifp, m); - if (mtag == NULL) { + if ((m->m_flags & M_VLANTAG) == 0) { IEEE80211_NODE_STAT(ni, tx_novlantag); return 1; } - if (EVL_VLANOFTAG(VLAN_TAG_VALUE(mtag)) != + if (EVL_VLANOFTAG(m->m_pkthdr.ether_vtag) != EVL_VLANOFTAG(ni->ni_vlan)) { IEEE80211_NODE_STAT(ni, tx_vlanmismatch); return 1; |