summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2006-09-17 13:33:30 +0000
committerandre <andre@FreeBSD.org>2006-09-17 13:33:30 +0000
commit2d9e7e4a32c8c33011a4a625f3560ff186124090 (patch)
tree0c60fd4adaa245ddeb4255e5c579b7939f52463f /sys/netgraph
parent9f404382211c4f1a6f9dccff7813b9ce26b9fcef (diff)
downloadFreeBSD-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/netgraph')
-rw-r--r--sys/netgraph/ng_vlan.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/netgraph/ng_vlan.c b/sys/netgraph/ng_vlan.c
index 437f232..8148639 100644
--- a/sys/netgraph/ng_vlan.c
+++ b/sys/netgraph/ng_vlan.c
@@ -345,7 +345,6 @@ ng_vlan_rcvdata(hook_p hook, item_p item)
int error;
u_int16_t vlan;
struct mbuf *m;
- struct m_tag *mtag;
struct filter *f;
/* Make sure we have an entire header. */
@@ -361,14 +360,14 @@ ng_vlan_rcvdata(hook_p hook, item_p item)
* If from downstream, select between a match hook
* or the nomatch hook.
*/
- mtag = m_tag_locate(m, MTAG_VLAN, MTAG_VLAN_TAG, NULL);
- if (mtag != NULL || eh->ether_type == htons(ETHERTYPE_VLAN)) {
- if (mtag != NULL) {
+ if (m->m_flags & M_VLANTAG ||
+ eh->ether_type == htons(ETHERTYPE_VLAN)) {
+ if (m->m_flags & M_VLANTAG) {
/*
* Packet is tagged, m contains a normal
* Ethernet frame; tag is stored out-of-band.
*/
- vlan = EVL_VLANOFTAG(VLAN_TAG_VALUE(mtag));
+ vlan = EVL_VLANOFTAG(m->m_pkthdr.ether_vtag);
(void)&evl; /* XXX silence GCC */
} else {
if (m->m_len < sizeof(*evl) &&
@@ -380,9 +379,10 @@ ng_vlan_rcvdata(hook_p hook, item_p item)
vlan = EVL_VLANOFTAG(ntohs(evl->evl_tag));
}
if ((f = ng_vlan_findentry(priv, vlan)) != NULL) {
- if (mtag != NULL)
- m_tag_delete(m, mtag);
- else {
+ if (m->m_flags & M_VLANTAG) {
+ m->m_pkthdr.ether_vtag = 0;
+ m->m_flags &= ~M_VLANTAG;
+ } else {
evl->evl_encap_proto = evl->evl_proto;
bcopy(mtod(m, caddr_t),
mtod(m, caddr_t) +
OpenPOWER on IntegriCloud