From 7da2447808dd5233fae946a91d1cbc895d9ed346 Mon Sep 17 00:00:00 2001 From: brooks Date: Wed, 5 Sep 2001 21:10:28 +0000 Subject: Make vlan(4) loadable, unloadable, and clonable. As a side effect, interfaces must now always enable VLAN support. Reviewed by: jlemon MFC after: 3 weeks --- sys/pci/if_ti.c | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) (limited to 'sys/pci/if_ti.c') diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c index 3b16fdb..996a0dd 100644 --- a/sys/pci/if_ti.c +++ b/sys/pci/if_ti.c @@ -78,8 +78,6 @@ * - Andrew Gallatin for providing FreeBSD/Alpha support. */ -#include "vlan.h" - #include #include #include @@ -94,13 +92,10 @@ #include #include #include - -#include - -#if NVLAN > 0 #include #include -#endif + +#include #include #include @@ -1334,9 +1329,7 @@ static int ti_gibinit(sc) if (sc->arpcom.ac_if.if_hwassist) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; -#if NVLAN > 0 rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; -#endif /* Set up the jumbo receive ring. */ rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb; @@ -1347,9 +1340,7 @@ static int ti_gibinit(sc) if (sc->arpcom.ac_if.if_hwassist) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; -#if NVLAN > 0 rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; -#endif /* * Set up the mini ring. Only activated on the @@ -1367,9 +1358,7 @@ static int ti_gibinit(sc) if (sc->arpcom.ac_if.if_hwassist) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; -#if NVLAN > 0 rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; -#endif /* * Set up the receive return ring. @@ -1403,9 +1392,7 @@ static int ti_gibinit(sc) rcb->ti_flags = 0; else rcb->ti_flags = TI_RCB_FLAG_HOST_RING; -#if NVLAN > 0 rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; -#endif if (sc->arpcom.ac_if.if_hwassist) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; @@ -1738,22 +1725,18 @@ static void ti_rxeof(sc) u_int32_t rxidx; struct ether_header *eh; struct mbuf *m = NULL; -#if NVLAN > 0 u_int16_t vlan_tag = 0; int have_tag = 0; -#endif cur_rx = &sc->ti_rdata->ti_rx_return_ring[sc->ti_rx_saved_considx]; rxidx = cur_rx->ti_idx; TI_INC(sc->ti_rx_saved_considx, TI_RETURN_RING_CNT); -#if NVLAN > 0 if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) { have_tag = 1; vlan_tag = cur_rx->ti_vlan_tag & 0xfff; } -#endif if (cur_rx->ti_flags & TI_BDFLAG_JUMBO_RING) { TI_INC(sc->ti_jumbo, TI_JUMBO_RX_RING_CNT); @@ -1815,17 +1798,15 @@ static void ti_rxeof(sc) m->m_pkthdr.csum_data = cur_rx->ti_tcp_udp_cksum; } -#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 = vlan_tag = 0; continue; } -#endif ether_input(ifp, eh, m); } @@ -1963,14 +1944,12 @@ static int ti_encap(sc, m_head, txidx) struct mbuf *m; u_int32_t frag, cur, cnt = 0; u_int16_t csum_flags = 0; -#if NVLAN > 0 struct ifvlan *ifv = NULL; if ((m_head->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) && m_head->m_pkthdr.rcvif != NULL && m_head->m_pkthdr.rcvif->if_type == IFT_L2VLAN) ifv = m_head->m_pkthdr.rcvif->if_softc; -#endif m = m_head; cur = frag = *txidx; @@ -2013,14 +1992,14 @@ static int ti_encap(sc, m_head, txidx) TI_HOSTADDR(f->ti_addr) = vtophys(mtod(m, vm_offset_t)); f->ti_len = m->m_len; f->ti_flags = csum_flags; -#if NVLAN > 0 + if (ifv != NULL) { f->ti_flags |= TI_BDFLAG_VLAN_TAG; f->ti_vlan_tag = ifv->ifv_tag & 0xfff; } else { f->ti_vlan_tag = 0; } -#endif + /* * Sanity check: avoid coming within 16 descriptors * of the end of the ring. -- cgit v1.1