Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Oct 2001 21:27:41 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        stable@freebsd.org, audit@freebsd.org
Subject:   call for test/review: vlan cloning patch
Message-ID:  <20011021212741.A30521@Odin.AC.HMC.Edu>

next in thread | raw e-mail | index | archive | help

--RnlQjJ0d97Da+TV1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Please review and test the following patch to add cloning and module
support to the vlan device in stable.  Unlike the gif cloning support,
this attempts to avoid a POLA violation by adding the number of vlan
devices requested by the kernel config (this behavior will go away in
5.0-RELEASE).

I plan to commit this sometime in the next week.

If I make updates to the patch, they will be reflected in the copy found
at:

http://people.freebsd.org/~brooks/patches/vlan-stable.diff

-- Brooks

--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

Index: sys/net/ethernet.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/net/ethernet.h,v
retrieving revision 1.12.2.5
diff -u -r1.12.2.5 ethernet.h
--- sys/net/ethernet.h	2000/07/19 21:43:52	1.12.2.5
+++ sys/net/ethernet.h	2001/10/21 20:25:14
@@ -99,6 +99,41 @@
 extern	void (*ng_ether_attach_p)(struct ifnet *ifp);
 extern	void (*ng_ether_detach_p)(struct ifnet *ifp);
=20
+extern	int (*vlan_input_p)(struct ether_header *eh, struct mbuf *m);
+extern	int (*vlan_input_tag_p)(struct ether_header *eh, struct mbuf *m,
+		u_int16_t t);
+#define _VLAN_INPUT(ifp, eh, m) do {				\
+	if (vlan_input_p !=3D NULL) {				\
+		if ((*vlan_input_p)(eh, m) =3D=3D -1)		\
+			(ifp)->if_noproto++;			\
+	} else {						\
+		m_free(m);					\
+		(ifp)->if_noproto++;				\
+	}							\
+} while (0)
+
+#define VLAN_INPUT(ifp, eh, m) do {				\
+	/* XXX: lock */						\
+	_VLAN_INPUT(ifp, eh, m);				\
+	/* XXX: unlock */					\
+} while (0)
+
+#define	_VLAN_INPUT_TAG(ifp, eh, m, t) do {			\
+	if (vlan_input_tag_p !=3D NULL) { 			\
+		if ((*vlan_input_tag_p)(eh, m, t) =3D=3D -1)	\
+			(ifp)->if_noproto++;			\
+	} else {						\
+		m_free(m);					\
+		(ifp)->if_noproto++;				\
+	}							\
+} while (0)
+
+#define VLAN_INPUT_TAG(ifp, eh, m, t) do {			\
+	/* XXX: lock */						\
+	_VLAN_INPUT_TAG(ifp, eh, m, t);				\
+	/* XXX: unlock */					\
+} while (0)
+
 #else /* _KERNEL */
=20
 #include <sys/cdefs.h>
Index: sys/net/if_ethersubr.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v
retrieving revision 1.70.2.17
diff -u -r1.70.2.17 if_ethersubr.c
--- sys/net/if_ethersubr.c	2001/08/01 00:47:49	1.70.2.17
+++ sys/net/if_ethersubr.c	2001/10/21 20:26:03
@@ -100,11 +100,6 @@
 #include <net/bridge.h>
 #endif
=20
-#include "vlan.h"
-#if NVLAN > 0
-#include <net/if_vlan_var.h>
-#endif /* NVLAN > 0 */
-
 /* netgraph node hooks for ng_ether(4) */
 void	(*ng_ether_input_p)(struct ifnet *ifp,
 		struct mbuf **mp, struct ether_header *eh);
@@ -114,6 +109,10 @@
 void	(*ng_ether_attach_p)(struct ifnet *ifp);
 void	(*ng_ether_detach_p)(struct ifnet *ifp);
=20
+int	(*vlan_input_p)(struct ether_header *eh, struct mbuf *m);
+int	(*vlan_input_tag_p)(struct ether_header *eh, struct mbuf *m,
+		u_int16_t t);
+
 static	int ether_resolvemulti __P((struct ifnet *, struct sockaddr **,
 				    struct sockaddr *));
 u_char	etherbroadcastaddr[6] =3D { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
@@ -533,14 +532,6 @@
=20
 	ether_type =3D ntohs(eh->ether_type);
=20
-#if NVLAN > 0
-	if (ether_type =3D=3D vlan_proto) {
-		if (vlan_input(eh, m) < 0)
-			ifp->if_data.ifi_noproto++;
-		return;
-	}
-#endif /* NVLAN > 0 */
-
 	switch (ether_type) {
 #ifdef INET
 	case ETHERTYPE_IP:
@@ -591,6 +582,9 @@
                 aarpinput(IFP2AC(ifp), m); /* XXX */
                 return;
 #endif NETATALK
+	case ETHERTYPE_VLAN:
+		VLAN_INPUT(ifp, eh, m);
+		return;
 	default:
 #ifdef IPX
 		if (ef_inputp && ef_inputp(ifp, eh, m) =3D=3D 0)
Index: sys/net/if_vlan.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/net/if_vlan.c,v
retrieving revision 1.15.2.8
diff -u -r1.15.2.8 if_vlan.c
--- sys/net/if_vlan.c	2001/08/01 00:47:50	1.15.2.8
+++ sys/net/if_vlan.c	2001/10/21 20:36:02
@@ -54,7 +54,9 @@
  * tag value that goes with it.
  */
=20
+#ifndef NVLAN
 #include "vlan.h"
+#endif
 #include "opt_inet.h"
=20
 #include <sys/param.h>
@@ -67,6 +69,8 @@
 #include <sys/sockio.h>
 #include <sys/sysctl.h>
 #include <sys/systm.h>
+#include <machine/bus.h>	/* XXX: Shouldn't really be required! */
+#include <sys/rman.h>
=20
 #include <net/bpf.h>
 #include <net/ethernet.h>
@@ -81,23 +85,32 @@
 #include <netinet/if_ether.h>
 #endif
=20
+#define VLANNAME	"vlan"
+#define VLAN_MAXUNIT	0x7fff	/* ifp->if_unit is only 15 bits */
+
 SYSCTL_DECL(_net_link);
 SYSCTL_NODE(_net_link, IFT_L2VLAN, vlan, CTLFLAG_RW, 0, "IEEE 802.1Q VLAN"=
);
 SYSCTL_NODE(_net_link_vlan, PF_LINK, link, CTLFLAG_RW, 0, "for consistency=
");
-
-u_int	vlan_proto =3D ETHERTYPE_VLAN;
-SYSCTL_INT(_net_link_vlan_link, VLANCTL_PROTO, proto, CTLFLAG_RW, &vlan_pr=
oto,
-	   0, "Ethernet protocol used for VLAN encapsulation");
=20
-static	struct ifvlan ifv_softc[NVLAN];
+static MALLOC_DEFINE(M_VLAN, "vlan", "802.1Q Virtual LAN Interface");
+static struct rman vlanunits[1];
+static LIST_HEAD(, ifvlan) ifv_list;
=20
+static	int vlan_clone_create(struct if_clone *, int *);
+static	void vlan_clone_destroy(struct ifnet *);
 static	void vlan_start(struct ifnet *ifp);
 static	void vlan_ifinit(void *foo);
+static	int vlan_input(struct ether_header *eh, struct mbuf *m);
+static	int vlan_input_tag(struct ether_header *eh, struct mbuf *m,
+		u_int16_t t);
 static	int vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr);
 static	int vlan_setmulti(struct ifnet *ifp);
 static	int vlan_unconfig(struct ifnet *ifp);
 static	int vlan_config(struct ifvlan *ifv, struct ifnet *p);
=20
+struct if_clone vlan_cloner =3D
+    IF_CLONE_INITIALIZER("vlan", vlan_clone_create, vlan_clone_destroy);
+
 /*
  * Program our multicast filter. What we're actually doing is
  * programming the multicast filter of the parent. This has the
@@ -142,14 +155,14 @@
 		if (error)
 			return(error);
 		SLIST_REMOVE_HEAD(&sc->vlan_mc_listhead, mc_entries);
-		free(mc, M_DEVBUF);
+		free(mc, M_VLAN);
 	}
=20
 	/* Now program new ones. */
 	LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 		if (ifma->ifma_addr->sa_family !=3D AF_LINK)
 			continue;
-		mc =3D malloc(sizeof(struct vlan_mc_entry), M_DEVBUF, M_WAITOK);
+		mc =3D malloc(sizeof(struct vlan_mc_entry), M_VLAN, M_WAITOK);
 		bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
 		    (char *)&mc->mc_addr, ETHER_ADDR_LEN);
 		SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries);
@@ -163,44 +176,46 @@
 	return(0);
 }
=20
-static void
-vlaninit(void)
-{
-	int i;
-
-	for (i =3D 0; i < NVLAN; i++) {
-		struct ifnet *ifp =3D &ifv_softc[i].ifv_if;
-
-		ifp->if_softc =3D &ifv_softc[i];
-		ifp->if_name =3D "vlan";
-		ifp->if_unit =3D i;
-		/* NB: flags are not set here */
-		ifp->if_linkmib =3D &ifv_softc[i].ifv_mib;
-		ifp->if_linkmiblen =3D sizeof ifv_softc[i].ifv_mib;
-		/* NB: mtu is not set here */
-
-		ifp->if_init =3D vlan_ifinit;
-		ifp->if_start =3D vlan_start;
-		ifp->if_ioctl =3D vlan_ioctl;
-		ifp->if_output =3D ether_output;
-		ifp->if_snd.ifq_maxlen =3D ifqmaxlen;
-		ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
-		/* Now undo some of the damage... */
-		ifp->if_data.ifi_type =3D IFT_L2VLAN;
-		ifp->if_data.ifi_hdrlen =3D EVL_ENCAPLEN;
-	}
-}
-
 static int
 vlan_modevent(module_t mod, int type, void *data)=20
 {=20
+	int i;
+	int err;
+
 	switch (type) {=20
 	case MOD_LOAD:=20
-		vlaninit();
+		vlanunits->rm_type =3D RMAN_ARRAY;
+		vlanunits->rm_descr =3D "configurable if_vlan units";
+		err =3D rman_init(vlanunits);
+		if (err !=3D 0)
+			return (err);
+		err =3D rman_manage_region(vlanunits, 0, VLAN_MAXUNIT);
+		if (err !=3D 0) {
+			printf("%s: vlanunits: rman_manage_region: Failed %d\n",
+			    VLANNAME, err);
+			rman_fini(vlanunits);
+			return (err);
+		}
+		LIST_INIT(&ifv_list);
+		vlan_input_p =3D vlan_input;
+		vlan_input_tag_p =3D vlan_input_tag;
+		if_clone_attach(&vlan_cloner);
+		for(i =3D 0; i < NVLAN; i ++) {
+			err =3D vlan_clone_create(&vlan_cloner, &i);
+			KASSERT(err =3D=3D 0,
+			    ("Unexpected error creating initial VLANs"));
+		}
 		break;=20
 	case MOD_UNLOAD:=20
-		printf("if_vlan module unload - not possible for this module type\n");=
=20
-		return EINVAL;=20
+		if_clone_detach(&vlan_cloner);
+		vlan_input_p =3D NULL;
+		vlan_input_tag_p =3D NULL;
+		while (!LIST_EMPTY(&ifv_list))
+			vlan_clone_destroy(&LIST_FIRST(&ifv_list)->ifv_if);
+		err =3D rman_fini(vlanunits);
+		if (err !=3D 0)
+			 return (err);
+		break;
 	}=20
 	return 0;=20
 }=20
@@ -213,7 +228,81 @@
=20
 DECLARE_MODULE(if_vlan, vlan_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
=20
+static int
+vlan_clone_create(struct if_clone *ifc, int *unit)
+{
+	struct resource *r;
+	struct ifvlan *ifv;
+	struct ifnet *ifp;
+	int s;
+
+	if (*unit > VLAN_MAXUNIT)
+		return (ENXIO);
+
+	if (*unit < 0) {
+		r  =3D rman_reserve_resource(vlanunits, 0, VLAN_MAXUNIT, 1,
+		    RF_ALLOCATED | RF_ACTIVE, NULL);
+		if (r =3D=3D NULL)
+			return (ENOSPC);
+		*unit =3D rman_get_start(r);
+	} else {
+		r  =3D rman_reserve_resource(vlanunits, *unit, *unit, 1,
+		    RF_ALLOCATED | RF_ACTIVE, NULL);
+		if (r =3D=3D NULL)
+			return (EEXIST);
+	}
+
+	ifv =3D malloc(sizeof(struct ifvlan), M_VLAN, M_WAITOK);
+	memset(ifv, 0, sizeof(struct ifvlan));
+	ifp =3D &ifv->ifv_if;
+	SLIST_INIT(&ifv->vlan_mc_listhead);
+
+	s =3D splnet();
+	LIST_INSERT_HEAD(&ifv_list, ifv, ifv_list);
+	splx(s);
+
+	ifp->if_softc =3D ifv;
+	ifp->if_name =3D "vlan";
+	ifp->if_unit =3D *unit;
+	ifv->r_unit =3D r;
+	/* NB: flags are not set here */
+	ifp->if_linkmib =3D &ifv->ifv_mib;
+	ifp->if_linkmiblen =3D sizeof ifv->ifv_mib;
+	/* NB: mtu is not set here */
+
+	ifp->if_init =3D vlan_ifinit;
+	ifp->if_start =3D vlan_start;
+	ifp->if_ioctl =3D vlan_ioctl;
+	ifp->if_output =3D ether_output;
+	ifp->if_snd.ifq_maxlen =3D ifqmaxlen;
+	ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
+	/* Now undo some of the damage... */
+	ifp->if_data.ifi_type =3D IFT_L2VLAN;
+	ifp->if_data.ifi_hdrlen =3D EVL_ENCAPLEN;
+
+	return (0);
+}
+
 static void
+vlan_clone_destroy(struct ifnet *ifp)
+{
+	struct ifvlan *ifv =3D ifp->if_softc;
+	int s;
+	int err;
+
+	s =3D splnet();
+	LIST_REMOVE(ifv, ifv_list);
+	vlan_unconfig(ifp);
+	splx(s);
+
+	ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
+
+	err =3D rman_release_resource(ifv->r_unit);
+	KASSERT(err =3D=3D 0, ("Unexpected error freeing resource"));
+	free(ifv, M_VLAN);
+}
+
+static void
 vlan_ifinit(void *foo)
 {
 	return;
@@ -294,7 +383,7 @@
 			      sizeof(struct ether_header));
 			evl =3D mtod(m, struct ether_vlan_header *);
 			evl->evl_proto =3D evl->evl_encap_proto;
-			evl->evl_encap_proto =3D htons(vlan_proto);
+			evl->evl_encap_proto =3D htons(ETHERTYPE_VLAN);
 			evl->evl_tag =3D htons(ifv->ifv_tag);
 #ifdef DEBUG
 			printf("vlan_start: %*D\n", sizeof *evl,
@@ -326,19 +415,19 @@
 	return;
 }
=20
-int
+static int
 vlan_input_tag(struct ether_header *eh, struct mbuf *m, u_int16_t t)
 {
-	int i;
 	struct ifvlan *ifv;
=20
-	for (i =3D 0; i < NVLAN; i++) {
-		ifv =3D &ifv_softc[i];
-		if (ifv->ifv_tag =3D=3D t)
+	for (ifv =3D LIST_FIRST(&ifv_list); ifv !=3D NULL;
+	    ifv =3D LIST_NEXT(ifv, ifv_list)) {
+		if (m->m_pkthdr.rcvif =3D=3D ifv->ifv_p
+		    && ifv->ifv_tag =3D=3D t)
 			break;
 	}
=20
-	if (i >=3D NVLAN || (ifv->ifv_if.if_flags & IFF_UP) =3D=3D 0) {
+	if (ifv =3D=3D NULL || (ifv->ifv_if.if_flags & IFF_UP) =3D=3D 0) {
 		m_free(m);
 		return -1;	/* So the parent can take note */
 	}
@@ -346,7 +435,7 @@
 	/*
 	 * Having found a valid vlan interface corresponding to
 	 * the given source interface and vlan tag, run the
-	 * the real packet through ethert_input().
+	 * the real packet through ether_input().
 	 */
 	m->m_pkthdr.rcvif =3D &ifv->ifv_if;
=20
@@ -355,21 +444,20 @@
 	return 0;
 }
=20
-int
+static int
 vlan_input(struct ether_header *eh, struct mbuf *m)
 {
-	int i;
 	struct ifvlan *ifv;
=20
-	for (i =3D 0; i < NVLAN; i++) {
-		ifv =3D &ifv_softc[i];
+	for (ifv =3D LIST_FIRST(&ifv_list); ifv !=3D NULL;
+	    ifv =3D LIST_NEXT(ifv, ifv_list)) {
 		if (m->m_pkthdr.rcvif =3D=3D ifv->ifv_p
 		    && (EVL_VLANOFTAG(ntohs(*mtod(m, u_int16_t *)))
 			=3D=3D ifv->ifv_tag))
 			break;
 	}
=20
-	if (i >=3D NVLAN || (ifv->ifv_if.if_flags & IFF_UP) =3D=3D 0) {
+	if (ifv =3D=3D NULL || (ifv->ifv_if.if_flags & IFF_UP) =3D=3D 0) {
 		m_freem(m);
 		return -1;	/* so ether_input can take note */
 	}
@@ -472,7 +560,7 @@
 			if (error)
 				return(error);
 			SLIST_REMOVE_HEAD(&ifv->vlan_mc_listhead, mc_entries);
-			free(mc, M_DEVBUF);
+			free(mc, M_VLAN);
 		}
 	}
=20
Index: sys/net/if_vlan_var.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/net/if_vlan_var.h,v
retrieving revision 1.5.2.2
diff -u -r1.5.2.2 if_vlan_var.h
--- sys/net/if_vlan_var.h	2001/08/01 00:47:50	1.5.2.2
+++ sys/net/if_vlan_var.h	2001/10/21 20:28:44
@@ -47,6 +47,8 @@
 		u_int16_t ifvm_tag; /* tag to apply on packets leaving if */
 	}	ifv_mib;
 	SLIST_HEAD(__vlan_mchead, vlan_mc_entry)	vlan_mc_listhead;
+	LIST_ENTRY(ifvlan) ifv_list;
+	struct resource *r_unit;	/* resource allocated for this unit */
 };
 #define	ifv_if	ifv_ac.ac_if
 #define	ifv_tag	ifv_mib.ifvm_tag
@@ -77,13 +79,5 @@
 };
 #define	SIOCSETVLAN	SIOCSIFGENERIC
 #define	SIOCGETVLAN	SIOCGIFGENERIC
-
-#ifdef _KERNEL
-/* shared with if_ethersubr.c: */
-extern	u_int vlan_proto;
-extern	int vlan_input(struct ether_header *eh, struct mbuf *m);
-extern	int vlan_input_tag(struct ether_header *eh,
-			struct mbuf *m, u_int16_t t);
-#endif
=20
 #endif /* _NET_IF_VLAN_VAR_H_ */
Index: sys/dev/bge/if_bge.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v
retrieving revision 1.3.2.2
diff -u -r1.3.2.2 if_bge.c
--- sys/dev/bge/if_bge.c	2001/10/05 20:13:41	1.3.2.2
+++ sys/dev/bge/if_bge.c	2001/10/21 20:22:33
@@ -70,8 +70,6 @@
  * ring.
  */
=20
-#include "vlan.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/sockio.h>
@@ -89,10 +87,8 @@
=20
 #include <net/bpf.h>
=20
-#if NVLAN > 0
 #include <net/if_types.h>
 #include <net/if_vlan_var.h>
-#endif
=20
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
@@ -1901,10 +1897,8 @@
 		u_int32_t		rxidx;
 		struct ether_header	*eh;
 		struct mbuf		*m =3D NULL;
-#if NVLAN > 0
 		u_int16_t		vlan_tag =3D 0;
 		int			have_tag =3D 0;
-#endif
=20
 		cur_rx =3D
 	    &sc->bge_rdata->bge_rx_return_ring[sc->bge_rx_saved_considx];
@@ -1912,12 +1906,10 @@
 		rxidx =3D cur_rx->bge_idx;
 		BGE_INC(sc->bge_rx_saved_considx, BGE_RETURN_RING_CNT);
=20
-#if NVLAN > 0
 		if (cur_rx->bge_flags & BGE_RXBDFLAG_VLAN_TAG) {
 			have_tag =3D 1;
 			vlan_tag =3D cur_rx->bge_vlan_tag;
 		}
-#endif
=20
 		if (cur_rx->bge_flags & BGE_RXBDFLAG_JUMBO_RING) {
 			BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT);
@@ -1972,17 +1964,16 @@
 			}
 		}
=20
-#if NVLAN > 0
 		/*
 		 * If we received a packet with a vlan tag, pass it
 		 * to vlan_input() instead of ether_input().
 		 */
 		if (have_tag) {
-			vlan_input_tag(eh, m, vlan_tag);
+			VLAN_INPUT_TAG(ifp, eh, m, vlan_tag);
 			have_tag =3D vlan_tag =3D 0;
 			continue;
 		}
-#endif
+
 		ether_input(ifp, eh, m);
 	}
=20
@@ -2181,14 +2172,12 @@
 	struct mbuf		*m;
 	u_int32_t		frag, cur, cnt =3D 0;
 	u_int16_t		csum_flags =3D 0;
-#if NVLAN > 0
 	struct ifvlan		*ifv =3D NULL;
=20
 	if ((m_head->m_flags & (M_PROTO1|M_PKTHDR)) =3D=3D (M_PROTO1|M_PKTHDR) &&
 	    m_head->m_pkthdr.rcvif !=3D NULL &&
 	    m_head->m_pkthdr.rcvif->if_type =3D=3D IFT_L2VLAN)
 		ifv =3D m_head->m_pkthdr.rcvif->if_softc;
-#endif
=20
 	m =3D m_head;
 	cur =3D frag =3D *txidx;
@@ -2217,14 +2206,12 @@
 			   vtophys(mtod(m, vm_offset_t));
 			f->bge_len =3D m->m_len;
 			f->bge_flags =3D csum_flags;
-#if NVLAN > 0
 			if (ifv !=3D NULL) {
 				f->bge_flags |=3D BGE_TXBDFLAG_VLAN_TAG;
 				f->bge_vlan_tag =3D ifv->ifv_tag;
 			} else {
 				f->bge_vlan_tag =3D 0;
 			}
-#endif
 			/*
 			 * Sanity check: avoid coming within 16 descriptors
 			 * of the end of the ring.
Index: sys/dev/fxp/if_fxp.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/dev/fxp/if_fxp.c,v
retrieving revision 1.110.2.7
diff -u -r1.110.2.7 if_fxp.c
--- sys/dev/fxp/if_fxp.c	2001/08/31 02:17:02	1.110.2.7
+++ sys/dev/fxp/if_fxp.c	2001/10/21 20:16:16
@@ -32,8 +32,6 @@
  * Intel EtherExpress Pro/100B PCI Fast Ethernet driver
  */
=20
-#include "vlan.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
@@ -65,10 +63,8 @@
 #include <vm/pmap.h>		/* for vtophys */
 #include <machine/clock.h>	/* for DELAY */
=20
-#if NVLAN > 0
 #include <net/if_types.h>
 #include <net/if_vlan_var.h>
-#endif
=20
 #include <pci/pcivar.h>
 #include <pci/pcireg.h>		/* for PCIM_CMD_xxx */
@@ -559,10 +555,9 @@
=20
 		/* turn on the extended TxCB feature */
 		sc->flags |=3D FXP_FLAG_EXT_TXCB;
-#if NVLAN > 0
+
 		/* enable reception of long frames for VLAN */
 		sc->flags |=3D FXP_FLAG_LONG_PKT_EN;
-#endif
 	}
=20
 	/*
@@ -620,12 +615,10 @@
 	 */
 	ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
=20
-#if NVLAN > 0
 	/*
 	 * Tell the upper layer(s) we support long frames.
 	 */
 	ifp->if_data.ifi_hdrlen =3D sizeof(struct ether_vlan_header);
-#endif
=20
 	/*
 	 * Let the system queue as many packets as we have available
@@ -1225,7 +1218,7 @@
 						m_freem(m);
 						goto rcvloop;
 					}
-#if NVLAN > 0
+
 					/*
 					 * Drop the packet if it has CRC
 					 * errors.  This test is only needed
@@ -1237,7 +1230,7 @@
 						m_freem(m);
 						goto rcvloop;
 					}
-#endif
+
 					m->m_pkthdr.rcvif =3D ifp;
 					m->m_pkthdr.len =3D m->m_len =3D total_len;
 					eh =3D mtod(m, struct ether_header *);
@@ -1519,11 +1512,7 @@
 	cbp->ext_txcb_dis =3D 	sc->flags & FXP_FLAG_EXT_TXCB ? 0 : 1;
 	cbp->ext_stats_dis =3D 	1;	/* disable extended counters */
 	cbp->keep_overrun_rx =3D 	0;	/* don't pass overrun frames to host */
-#if NVLAN > 0
 	cbp->save_bf =3D		sc->chip =3D=3D FXP_CHIP_82557 ? 1 : prm;
-#else
-	cbp->save_bf =3D		prm;	/* save bad frames */
-#endif
 	cbp->disc_short_rx =3D	!prm;	/* discard short packets */
 	cbp->underrun_retry =3D	1;	/* retry mode (once) on DMA underrun */
 	cbp->two_frames =3D	0;	/* do not limit FIFO to 2 frames */
Index: sys/dev/nge/if_nge.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/dev/nge/if_nge.c,v
retrieving revision 1.13.2.5
diff -u -r1.13.2.5 if_nge.c
--- sys/dev/nge/if_nge.c	2001/09/19 23:14:28	1.13.2.5
+++ sys/dev/nge/if_nge.c	2001/10/21 20:14:05
@@ -87,8 +87,6 @@
  * if the user selects an MTU larger than 8152 (8170 - 18)
  */
=20
-#include "vlan.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/sockio.h>
@@ -102,11 +100,8 @@
 #include <net/ethernet.h>
 #include <net/if_dl.h>
 #include <net/if_media.h>
-
-#if NVLAN > 0
 #include <net/if_types.h>
 #include <net/if_vlan_var.h>
-#endif
=20
 #include <net/bpf.h>
=20
@@ -1402,16 +1397,14 @@
 			m->m_pkthdr.csum_data =3D 0xffff;
 		}
=20
-#if NVLAN > 0
 		/*
 		 * If we received a packet with a vlan tag, pass it
 		 * to vlan_input() instead of ether_input().
 		 */
 		if (extsts & NGE_RXEXTSTS_VLANPKT) {
-			vlan_input_tag(eh, m, extsts & NGE_RXEXTSTS_VTCI);
+			VLAN_INPUT_TAG(ifp, eh, m, extsts & NGE_RXEXTSTS_VTCI);
                         continue;
                 }
-#endif
=20
 		ether_input(ifp, eh, m);
 	}
@@ -1608,14 +1601,12 @@
 	struct nge_desc		*f =3D NULL;
 	struct mbuf		*m;
 	int			frag, cur, cnt =3D 0;
-#if NVLAN > 0
 	struct ifvlan		*ifv =3D NULL;
=20
 	if ((m_head->m_flags & (M_PROTO1|M_PKTHDR)) =3D=3D (M_PROTO1|M_PKTHDR) &&
 	    m_head->m_pkthdr.rcvif !=3D NULL &&
 	    m_head->m_pkthdr.rcvif->if_type =3D=3D IFT_L2VLAN)
 		ifv =3D m_head->m_pkthdr.rcvif->if_softc;
-#endif
=20
 	/*
  	 * Start packing the mbufs in this chain into
@@ -1657,12 +1648,10 @@
 			    NGE_TXEXTSTS_UDPCSUM;
 	}
=20
-#if NVLAN > 0
 	if (ifv !=3D NULL) {
 		sc->nge_ldata->nge_tx_list[cur].nge_extsts |=3D
 			(NGE_TXEXTSTS_VLANPKT|ifv->ifv_tag);
 	}
-#endif
=20
 	sc->nge_ldata->nge_tx_list[cur].nge_mbuf =3D m_head;
 	sc->nge_ldata->nge_tx_list[cur].nge_ctl &=3D ~NGE_CMDSTS_MORE;
@@ -1823,15 +1812,13 @@
 	 */
 	CSR_WRITE_4(sc, NGE_VLAN_IP_RXCTL, NGE_VIPRXCTL_IPCSUM_ENB);
=20
-#if NVLAN > 0
 	/*
-	 * If VLAN support is enabled, tell the chip to detect
-	 * and strip VLAN tag info from received frames. The tag
-	 * will be provided in the extsts field in the RX descriptors.
+	 * Tell the chip to detect and strip VLAN tag info from
+	 * received frames. The tag will be provided in the extsts
+	 * field in the RX descriptors.
 	 */
 	NGE_SETBIT(sc, NGE_VLAN_IP_RXCTL,
 	    NGE_VIPRXCTL_TAG_DETECT_ENB|NGE_VIPRXCTL_TAG_STRIP_ENB);
-#endif
=20
 	/* Set TX configuration */
 	CSR_WRITE_4(sc, NGE_TX_CFG, NGE_TXCFG);
@@ -1841,14 +1828,11 @@
 	 */
 	CSR_WRITE_4(sc, NGE_VLAN_IP_TXCTL, NGE_VIPTXCTL_CSUM_PER_PKT);
=20
-#if NVLAN > 0
 	/*
-	 * If VLAN support is enabled, tell the chip to insert
-	 * VLAN tags on a per-packet basis as dictated by the
-	 * code in the frame encapsulation routine.
+	 * Tell the chip to insert VLAN tags on a per-packet basis as
+	 * dictated by the code in the frame encapsulation routine.
 	 */
 	NGE_SETBIT(sc, NGE_VLAN_IP_TXCTL, NGE_VIPTXCTL_TAG_PER_PKT);
-#endif
=20
 	/* Set full/half duplex mode. */
 	if ((mii->mii_media_active & IFM_GMASK) =3D=3D IFM_FDX) {
Index: sys/dev/txp/if_txp.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/dev/txp/if_txp.c,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 if_txp.c
--- sys/dev/txp/if_txp.c	2001/07/31 16:39:34	1.4.2.2
+++ sys/dev/txp/if_txp.c	2001/10/21 20:15:01
@@ -39,8 +39,6 @@
  * Driver for 3c990 (Typhoon) Ethernet ASIC
  */
=20
-#include "vlan.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/sockio.h>
@@ -54,6 +52,7 @@
 #include <net/ethernet.h>
 #include <net/if_dl.h>
 #include <net/if_types.h>
+#include <net/if_vlan_var.h>
=20
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
@@ -66,10 +65,6 @@
=20
 #include <net/bpf.h>
=20
-#if NVLAN > 0
-#include <net/if_vlan_var.h>
-#endif
-
 #include <vm/vm.h>              /* for vtophys */
 #include <vm/pmap.h>            /* for vtophys */
 #include <machine/clock.h>	/* for DELAY */
@@ -783,14 +778,11 @@
 		/* Remove header from mbuf and pass it on. */
 		m_adj(m, sizeof(struct ether_header));
=20
-#if NVLAN > 0
 		if (rxd->rx_stat & RX_STAT_VLAN) {
-			if (vlan_input_tag(eh, m,
-			    htons(rxd->rx_vlan >> 16)) < 0)
-				ifp->if_noproto++;
+			VLAN_INPUT_TAG(ifp, eh, m, htons(rxd->rx_vlan >> 16));
 			goto next;
 		}
-#endif
+
 		ether_input(ifp, eh, m);
=20
 next:
@@ -1291,9 +1283,7 @@
 	struct mbuf *m, *m0;
 	struct txp_swdesc *sd;
 	u_int32_t firstprod, firstcnt, prod, cnt;
-#if NVLAN > 0
 	struct ifvlan		*ifv;
-#endif
=20
 	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) !=3D IFF_RUNNING)
 		return;
@@ -1330,14 +1320,13 @@
 		if (++cnt >=3D (TX_ENTRIES - 4))
 			goto oactive;
=20
-#if NVLAN > 0
 		if ((m->m_flags & (M_PROTO1|M_PKTHDR)) =3D=3D (M_PROTO1|M_PKTHDR) &&
 		    m->m_pkthdr.rcvif !=3D NULL) {
 			ifv =3D m->m_pkthdr.rcvif->if_softc;
 			txd->tx_pflags =3D TX_PFLAGS_VLAN |
 			    (htons(ifv->ifv_tag) << TX_PFLAGS_VLANTAG_S);
 		}
-#endif
+
 		if (m->m_pkthdr.csum_flags & CSUM_IP)
 			txd->tx_pflags |=3D TX_PFLAGS_IPCKSUM;
=20
@@ -1854,12 +1843,10 @@
 	sc->sc_tx_capability =3D ext->ext_1 & OFFLOAD_MASK;
 	sc->sc_rx_capability =3D ext->ext_2 & OFFLOAD_MASK;
=20
-#if NVLAN > 0
 	if (rsp->rsp_par2 & rsp->rsp_par3 & OFFLOAD_VLAN) {
 		sc->sc_tx_capability |=3D OFFLOAD_VLAN;
 		sc->sc_rx_capability |=3D OFFLOAD_VLAN;
 	}
-#endif
=20
 #if 0
 	/* not ready yet */
Index: sys/modules/bge/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/modules/bge/Makefile,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 Makefile
--- sys/modules/bge/Makefile	2001/10/01 18:19:12	1.1.2.1
+++ sys/modules/bge/Makefile	2001/10/21 20:41:49
@@ -3,11 +3,7 @@
 .PATH: ${.CURDIR}/../../dev/bge
=20
 KMOD=3D	if_bge
-SRCS=3D	if_bge.c miibus_if.h opt_bdg.h vlan.h device_if.h bus_if.h pci_if.h
+SRCS=3D	if_bge.c miibus_if.h opt_bdg.h device_if.h bus_if.h pci_if.h
 KMODDEPS =3D miibus
-CLEANFILES=3D	vlan.h
-
-vlan.h:
-	touch vlan.h
=20
 .include <bsd.kmod.mk>
Index: sys/modules/fxp/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/modules/fxp/Makefile,v
retrieving revision 1.9.2.2
diff -u -r1.9.2.2 Makefile
--- sys/modules/fxp/Makefile	2001/07/25 17:46:03	1.9.2.2
+++ sys/modules/fxp/Makefile	2001/10/21 20:40:40
@@ -2,11 +2,7 @@
=20
 .PATH:	${.CURDIR}/../../dev/fxp
 KMOD	=3D if_fxp
-SRCS	=3D if_fxp.c opt_bdg.h vlan.h device_if.h bus_if.h pci_if.h miibus_if=
.h
+SRCS	=3D if_fxp.c opt_bdg.h device_if.h bus_if.h pci_if.h miibus_if.h
 KMODDEPS =3D miibus
-
-CLEANFILES =3D vlan.h
-vlan.h:
-	echo '#define NVLAN 1' > vlan.h
=20
 .include <bsd.kmod.mk>
Index: sys/modules/nge/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/modules/nge/Makefile,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 Makefile
--- sys/modules/nge/Makefile	2001/06/19 19:42:42	1.2.2.1
+++ sys/modules/nge/Makefile	2001/10/21 20:40:55
@@ -3,11 +3,7 @@
 .PATH: ${.CURDIR}/../../dev/nge
=20
 KMOD=3D	if_nge
-SRCS=3D	if_nge.c miibus_if.h opt_bdg.h vlan.h device_if.h bus_if.h pci_if.h
+SRCS=3D	if_nge.c miibus_if.h opt_bdg.h device_if.h bus_if.h pci_if.h
 KMODDEPS =3D miibus
-CLEANFILES=3D	vlan.h
-
-vlan.h:
-	touch vlan.h
=20
 .include <bsd.kmod.mk>
Index: sys/modules/ti/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/modules/ti/Makefile,v
retrieving revision 1.8
diff -u -r1.8 Makefile
--- sys/modules/ti/Makefile	2000/01/28 11:26:38	1.8
+++ sys/modules/ti/Makefile	2001/10/21 20:41:08
@@ -2,10 +2,6 @@
=20
 .PATH:	${.CURDIR}/../../pci
 KMOD	=3D if_ti
-SRCS	=3D if_ti.c opt_bdg.h vlan.h device_if.h bus_if.h pci_if.h
-CLEANFILES	=3D vlan.h
-
-vlan.h:
-	touch vlan.h
+SRCS	=3D if_ti.c opt_bdg.h device_if.h bus_if.h pci_if.h
=20
 .include <bsd.kmod.mk>
Index: sys/modules/txp/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/modules/txp/Makefile,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 Makefile
--- sys/modules/txp/Makefile	2001/07/30 17:31:41	1.2.2.1
+++ sys/modules/txp/Makefile	2001/10/21 20:41:20
@@ -3,10 +3,6 @@
 .PATH: ${.CURDIR}/../../dev/txp
=20
 KMOD=3D	if_txp
-SRCS=3D	if_txp.c opt_bdg.h device_if.h bus_if.h pci_if.h vlan.h
-CLEANFILES=3D	vlan.h
-
-vlan.h:
-	touch vlan.h
+SRCS=3D	if_txp.c opt_bdg.h device_if.h bus_if.h pci_if.h
=20
 .include <bsd.kmod.mk>
Index: sys/modules/tx/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/modules/tx/Makefile,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 Makefile
--- sys/modules/tx/Makefile	2001/09/01 07:17:11	1.4.2.2
+++ sys/modules/tx/Makefile	2001/10/21 20:41:34
@@ -3,10 +3,6 @@
 .PATH:	${.CURDIR}/../../pci
 KMOD	=3D if_tx
 SRCS	=3D if_tx.c opt_bdg.h device_if.h bus_if.h pci_if.h
-SRCS	+=3D miibus_if.h vlan.h
-CLEANFILES =3D vlan.h
-
-vlan.h:
-	touch vlan.h
+SRCS	+=3D miibus_if.h
=20
 .include <bsd.kmod.mk>
Index: sys/pci/if_ti.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/pci/if_ti.c,v
retrieving revision 1.25.2.10
diff -u -r1.25.2.10 if_ti.c
--- sys/pci/if_ti.c	2001/08/01 01:08:25	1.25.2.10
+++ sys/pci/if_ti.c	2001/10/21 20:38:59
@@ -78,8 +78,6 @@
  * - Andrew Gallatin for providing FreeBSD/Alpha support.
  */
=20
-#include "vlan.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/sockio.h>
@@ -94,14 +92,11 @@
 #include <net/ethernet.h>
 #include <net/if_dl.h>
 #include <net/if_media.h>
-
-#include <net/bpf.h>
-
-#if NVLAN > 0
 #include <net/if_types.h>
 #include <net/if_vlan_var.h>
-#endif
=20
+#include <net/bpf.h>
+
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <netinet/ip.h>
@@ -1414,9 +1409,7 @@
 	if (sc->arpcom.ac_if.if_hwassist)
 		rcb->ti_flags |=3D TI_RCB_FLAG_TCP_UDP_CKSUM |
 		     TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM;
-#if NVLAN > 0
 	rcb->ti_flags |=3D TI_RCB_FLAG_VLAN_ASSIST;
-#endif
=20
 	/* Set up the jumbo receive ring. */
 	rcb =3D &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb;
@@ -1427,9 +1420,7 @@
 	if (sc->arpcom.ac_if.if_hwassist)
 		rcb->ti_flags |=3D TI_RCB_FLAG_TCP_UDP_CKSUM |
 		     TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM;
-#if NVLAN > 0
 	rcb->ti_flags |=3D TI_RCB_FLAG_VLAN_ASSIST;
-#endif
=20
 	/*
 	 * Set up the mini ring. Only activated on the
@@ -1447,9 +1438,7 @@
 	if (sc->arpcom.ac_if.if_hwassist)
 		rcb->ti_flags |=3D TI_RCB_FLAG_TCP_UDP_CKSUM |
 		     TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM;
-#if NVLAN > 0
 	rcb->ti_flags |=3D TI_RCB_FLAG_VLAN_ASSIST;
-#endif
=20
 	/*
 	 * Set up the receive return ring.
@@ -1483,9 +1472,7 @@
 		rcb->ti_flags =3D 0;
 	else
 		rcb->ti_flags =3D TI_RCB_FLAG_HOST_RING;
-#if NVLAN > 0
 	rcb->ti_flags |=3D TI_RCB_FLAG_VLAN_ASSIST;
-#endif
 	if (sc->arpcom.ac_if.if_hwassist)
 		rcb->ti_flags |=3D TI_RCB_FLAG_TCP_UDP_CKSUM |
 		     TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM;
@@ -1833,22 +1820,18 @@
 		u_int32_t		rxidx;
 		struct ether_header	*eh;
 		struct mbuf		*m =3D NULL;
-#if NVLAN > 0
 		u_int16_t		vlan_tag =3D 0;
 		int			have_tag =3D 0;
-#endif
=20
 		cur_rx =3D
 		    &sc->ti_rdata->ti_rx_return_ring[sc->ti_rx_saved_considx];
 		rxidx =3D cur_rx->ti_idx;
 		TI_INC(sc->ti_rx_saved_considx, TI_RETURN_RING_CNT);
=20
-#if NVLAN > 0
 		if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) {
 			have_tag =3D 1;
 			vlan_tag =3D cur_rx->ti_vlan_tag & 0xfff;
 		}
-#endif
=20
 		if (cur_rx->ti_flags & TI_BDFLAG_JUMBO_RING) {
 			TI_INC(sc->ti_jumbo, TI_JUMBO_RX_RING_CNT);
@@ -1910,17 +1893,15 @@
 			m->m_pkthdr.csum_data =3D cur_rx->ti_tcp_udp_cksum;
 		}
=20
-#if NVLAN > 0
 		/*
 		 * If we received a packet with a vlan tag, pass it
 		 * to vlan_input() instead of ether_input().
 		 */
 		if (have_tag) {
-			vlan_input_tag(eh, m, vlan_tag);
+			VLAN_INPUT_TAG(ifp, eh, m, vlan_tag);
 			have_tag =3D vlan_tag =3D 0;
 			continue;
 		}
-#endif
 		ether_input(ifp, eh, m);
 	}
=20
@@ -2053,14 +2034,12 @@
 	struct mbuf		*m;
 	u_int32_t		frag, cur, cnt =3D 0;
 	u_int16_t		csum_flags =3D 0;
-#if NVLAN > 0
 	struct ifvlan		*ifv =3D NULL;
=20
 	if ((m_head->m_flags & (M_PROTO1|M_PKTHDR)) =3D=3D (M_PROTO1|M_PKTHDR) &&
 	    m_head->m_pkthdr.rcvif !=3D NULL &&
 	    m_head->m_pkthdr.rcvif->if_type =3D=3D IFT_L2VLAN)
 		ifv =3D m_head->m_pkthdr.rcvif->if_softc;
-#endif
=20
 	m =3D m_head;
 	cur =3D frag =3D *txidx;
@@ -2103,14 +2082,14 @@
 			TI_HOSTADDR(f->ti_addr) =3D vtophys(mtod(m, vm_offset_t));
 			f->ti_len =3D m->m_len;
 			f->ti_flags =3D csum_flags;
-#if NVLAN > 0
+
 			if (ifv !=3D NULL) {
 				f->ti_flags |=3D TI_BDFLAG_VLAN_TAG;
 				f->ti_vlan_tag =3D ifv->ifv_tag & 0xfff;
 			} else {
 				f->ti_vlan_tag =3D 0;
 			}
-#endif
+
 			/*
 			 * Sanity check: avoid coming within 16 descriptors
 			 * of the end of the ring.
Index: sys/pci/if_tx.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/pci/if_tx.c,v
retrieving revision 1.34.2.8
diff -u -r1.34.2.8 if_tx.c
--- sys/pci/if_tx.c	2001/09/01 07:21:56	1.34.2.8
+++ sys/pci/if_tx.c	2001/10/21 20:40:05
@@ -54,8 +54,6 @@
 #if defined(__FreeBSD__)
 #define NBPFILTER	1
=20
-#include "vlan.h"
-
 #include <net/if.h>
 #include <net/if_arp.h>
 #include <net/ethernet.h>
@@ -63,9 +61,7 @@
=20
 #include <net/bpf.h>
=20
-#if NVLAN > 0
 #include <net/if_vlan_var.h>
-#endif
=20
 #include <vm/vm.h>              /* for vtophys */
 #include <vm/pmap.h>            /* for vtophys */
@@ -562,9 +558,7 @@
=20
 	/* Attach to OS's managers */
 	ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
-#if NVLAN > 0
 	ifp->if_hdrlen =3D sizeof(struct ether_vlan_header);
-#endif
 	callout_handle_init(&sc->stat_ch);
=20
 fail:
Index: share/man/man4/man4.i386/tx.4
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/share/man/man4/man4.i386/tx.4,v
retrieving revision 1.11.2.7
diff -u -r1.11.2.7 tx.4
--- share/man/man4/man4.i386/tx.4	2001/09/01 07:17:31	1.11.2.7
+++ share/man/man4/man4.i386/tx.4	2001/10/21 20:47:04
@@ -80,10 +80,7 @@
 .Xr vlan 4
 inteface) without decreasing the MTU on the=20
 .Xr vlan 4
-interfaces. This support must be enabled by adding ``pseudo-device vlan''
-to the kernel configuration file (if compiling staticaly) or inserting=20
-the ``#define NVLAN 1'' line into the sys/modules/tx/vlan.h (if compiling
-as KLD)
+interfaces.
 .Sh DIAGNOSTICS
 .Bl -diag
 .It "tx%d: device timeout %d packets"

--RnlQjJ0d97Da+TV1
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE706A8XY6L6fI4GtQRAsElAJ9kUUi+aYGrQ/Fnwks1nxKsJwJyTwCdGILI
cvm4GmEDlwvIfrBta3oTAA4=
=Cb+x
-----END PGP SIGNATURE-----

--RnlQjJ0d97Da+TV1--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011021212741.A30521>