From 79c91b9063b488741efc68e2badefc608f4fb4d4 Mon Sep 17 00:00:00 2001 From: ru Date: Fri, 18 Feb 2005 22:31:19 +0000 Subject: 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 --- sys/net/if_vlan_var.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/net/if_vlan_var.h') 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 */ -- cgit v1.1