summaryrefslogtreecommitdiffstats
path: root/sys/net/if_vlan_var.h
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-02-18 22:31:19 +0000
committerru <ru@FreeBSD.org>2005-02-18 22:31:19 +0000
commit79c91b9063b488741efc68e2badefc608f4fb4d4 (patch)
treed7beeb22153c2c6c50bd61f34eaab74d6bc20b1b /sys/net/if_vlan_var.h
parentf35103b728ad51548ba5fbf5f098634a370e7635 (diff)
downloadFreeBSD-src-79c91b9063b488741efc68e2badefc608f4fb4d4.zip
FreeBSD-src-79c91b9063b488741efc68e2badefc608f4fb4d4.tar.gz
Allocate the M_VLANTAG m_pkthdr flag, and use it to indicate that
a packet has VLAN mbuf tag attached. This is faster to check than m_tag_locate(), and allows us to use the tags in non-vlan(4) VLAN producers. The first argument to VLAN_OUTPUT_TAG() is now unused but retained for backward compatibility. While here, embellish a fix in rev. 1.174 of if_ethersubr.c -- it now checks for packets with VLAN (mbuf) tags, and it should now be possible to bridge(4) on vlan(4)'s whose parent interfaces support VLAN decapsulation in hardware. Reviewed by: sam
Diffstat (limited to 'sys/net/if_vlan_var.h')
-rw-r--r--sys/net/if_vlan_var.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h
index b8b9997..11cbf7b 100644
--- a/sys/net/if_vlan_var.h
+++ b/sys/net/if_vlan_var.h
@@ -80,8 +80,8 @@ struct vlanreq {
*
* to mark the packet m with the specified VLAN tag. The last
* parameter provides code to execute in case of an error. On
- * output the driver should check ifnet to see if any VLANs are
- * in use and only then check for a packet tag; this is done with:
+ * output the driver should check mbuf to see if a VLAN tag is
+ * present and only then check for a tag; this is done with:
*
* struct m_tag *mtag;
* mtag = VLAN_OUTPUT_TAG(ifp, m);
@@ -107,10 +107,11 @@ struct vlanreq {
} \
*(u_int *)(mtag+1) = (_t); \
m_tag_prepend((_m), mtag); \
+ (_m)->m_flags |= M_VLANTAG; \
} while (0)
#define VLAN_OUTPUT_TAG(_ifp, _m) \
- ((_ifp)->if_nvlans != 0 ? \
+ ((_m)->m_flags & M_VLANTAG ? \
m_tag_locate((_m), MTAG_VLAN, MTAG_VLAN_TAG, NULL) : NULL)
#define VLAN_TAG_VALUE(_mt) (*(u_int *)((_mt)+1))
#endif /* _KERNEL */
OpenPOWER on IntegriCloud