summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2005-09-16 11:44:43 +0000
committeryar <yar@FreeBSD.org>2005-09-16 11:44:43 +0000
commita930847e8fda73b5d669020b34d381b323554708 (patch)
tree5a997fbba85a862198208cf01000a90ebf4df359
parentffd86537c18a9461b7ba5750e9c1614efab9e102 (diff)
downloadFreeBSD-src-a930847e8fda73b5d669020b34d381b323554708.zip
FreeBSD-src-a930847e8fda73b5d669020b34d381b323554708.tar.gz
Test the new M_VLANTAG packet flag before calling
m_tag_locate(). This adds little overhead of a simple bitwise operation in case hardware VLAN acceleration is on, yet saves the more expensive function call if the acceleration is off. Reviewed by: ru, glebius X-MFC-after: 6.0
-rw-r--r--sys/net/if_vlan.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 758800a..5c7166e 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -562,16 +562,19 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
struct m_tag *mtag;
u_int tag;
- mtag = m_tag_locate(m, MTAG_VLAN, MTAG_VLAN_TAG, NULL);
- if (mtag != NULL) {
+ if (m->m_flags & M_VLANTAG) {
/*
* Packet is tagged, m contains a normal
* Ethernet frame; the tag is stored out-of-band.
*/
+ mtag = m_tag_locate(m, MTAG_VLAN, MTAG_VLAN_TAG, NULL);
+ KASSERT(mtag != NULL,
+ ("%s: M_VLANTAG without m_tag", __func__));
tag = EVL_VLANOFTAG(VLAN_TAG_VALUE(mtag));
m_tag_delete(m, mtag);
m->m_flags &= ~M_VLANTAG;
} else {
+ mtag = NULL;
switch (ifp->if_type) {
case IFT_ETHER:
if (m->m_len < sizeof(*evl) &&
OpenPOWER on IntegriCloud