Deleted Added
full compact
if_vlan_var.h (153512) if_vlan_var.h (155051)
1/*-
2 * Copyright 1998 Massachusetts Institute of Technology
3 *
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose and without fee is hereby
6 * granted, provided that both the above copyright notice and this
7 * permission notice appear in all copies, that both the above
8 * copyright notice and this permission notice appear in all

--- 12 unchanged lines hidden (view full) ---

21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*-
2 * Copyright 1998 Massachusetts Institute of Technology
3 *
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose and without fee is hereby
6 * granted, provided that both the above copyright notice and this
7 * permission notice appear in all copies, that both the above
8 * copyright notice and this permission notice appear in all

--- 12 unchanged lines hidden (view full) ---

21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/net/if_vlan_var.h 153512 2005-12-18 18:24:27Z glebius $
29 * $FreeBSD: head/sys/net/if_vlan_var.h 155051 2006-01-30 13:45:15Z glebius $
30 */
31
32#ifndef _NET_IF_VLAN_VAR_H_
33#define _NET_IF_VLAN_VAR_H_ 1
34
35struct ether_vlan_header {
36 u_char evl_dhost[ETHER_ADDR_LEN];
37 u_char evl_shost[ETHER_ADDR_LEN];

--- 50 unchanged lines hidden (view full) ---

88 * if (mtag != NULL) {
89 * ... = VLAN_TAG_VALUE(mtag);
90 * ... pass tag to hardware ...
91 * }
92 *
93 * Note that a driver must indicate it supports hardware VLAN
94 * tagging by marking IFCAP_VLAN_HWTAGGING in if_capabilities.
95 */
30 */
31
32#ifndef _NET_IF_VLAN_VAR_H_
33#define _NET_IF_VLAN_VAR_H_ 1
34
35struct ether_vlan_header {
36 u_char evl_dhost[ETHER_ADDR_LEN];
37 u_char evl_shost[ETHER_ADDR_LEN];

--- 50 unchanged lines hidden (view full) ---

88 * if (mtag != NULL) {
89 * ... = VLAN_TAG_VALUE(mtag);
90 * ... pass tag to hardware ...
91 * }
92 *
93 * Note that a driver must indicate it supports hardware VLAN
94 * tagging by marking IFCAP_VLAN_HWTAGGING in if_capabilities.
95 */
96#define MTAG_VLAN 1035328035
97#define MTAG_VLAN_TAG 0 /* tag of VLAN interface */
98
99/*
100 * This macro must expand to a lvalue so that it can be used
101 * to set a tag with a simple assignment.
102 */
103#define VLAN_TAG_VALUE(_mt) (*(u_int *)((_mt) + 1))
104
105#define VLAN_INPUT_TAG(_ifp, _m, _t) do { \
96
97/*
98 * This macro must expand to a lvalue so that it can be used
99 * to set a tag with a simple assignment.
100 */
101#define VLAN_TAG_VALUE(_mt) (*(u_int *)((_mt) + 1))
102
103#define VLAN_INPUT_TAG(_ifp, _m, _t) do { \
106 struct m_tag *mtag; \
107 mtag = m_tag_alloc(MTAG_VLAN, MTAG_VLAN_TAG, \
108 sizeof (u_int), M_NOWAIT); \
104 struct m_tag *mtag = (struct m_tag *) \
105 uma_zalloc(zone_mtag_vlan, M_NOWAIT); \
109 if (mtag != NULL) { \
110 VLAN_TAG_VALUE(mtag) = (_t); \
111 m_tag_prepend((_m), mtag); \
112 (_m)->m_flags |= M_VLANTAG; \
113 } else { \
114 (_ifp)->if_ierrors++; \
115 m_freem(_m); \
116 _m = NULL; \
117 } \
118} while (0)
119
120#define VLAN_OUTPUT_TAG(_ifp, _m) \
121 ((_m)->m_flags & M_VLANTAG ? \
122 m_tag_locate((_m), MTAG_VLAN, MTAG_VLAN_TAG, NULL) : NULL)
106 if (mtag != NULL) { \
107 VLAN_TAG_VALUE(mtag) = (_t); \
108 m_tag_prepend((_m), mtag); \
109 (_m)->m_flags |= M_VLANTAG; \
110 } else { \
111 (_ifp)->if_ierrors++; \
112 m_freem(_m); \
113 _m = NULL; \
114 } \
115} while (0)
116
117#define VLAN_OUTPUT_TAG(_ifp, _m) \
118 ((_m)->m_flags & M_VLANTAG ? \
119 m_tag_locate((_m), MTAG_VLAN, MTAG_VLAN_TAG, NULL) : NULL)
120
121#define VLAN_CAPABILITIES(_ifp) do { \
122 if ((_ifp)->if_vlantrunk != NULL) \
123 (*vlan_trunk_cap_p)(_ifp); \
124} while (0)
125
126extern void (*vlan_trunk_cap_p)(struct ifnet *);
123#endif /* _KERNEL */
124
125#endif /* _NET_IF_VLAN_VAR_H_ */
127#endif /* _KERNEL */
128
129#endif /* _NET_IF_VLAN_VAR_H_ */