Index: dev/bce/if_bce.c =================================================================== RCS file: /home/ncvs/src/sys/dev/bce/if_bce.c,v retrieving revision 1.7 diff -u -p -r1.7 if_bce.c --- dev/bce/if_bce.c 15 Aug 2006 04:56:29 -0000 1.7 +++ dev/bce/if_bce.c 7 Sep 2006 15:03:42 -0000 @@ -4251,9 +4251,8 @@ bce_rx_intr(struct bce_softc *sc) #if __FreeBSD_version < 700000 VLAN_INPUT_TAG(ifp, m, l2fhdr->l2_fhdr_vlan_tag, continue); #else - VLAN_INPUT_TAG(ifp, m, l2fhdr->l2_fhdr_vlan_tag); - if (m == NULL) - continue; + m->m_pkthdr.ether_vlan = l2fhdr->l2_fhdr_vlan_tag; + m->m_flags |= M_VLANTAG; #endif } @@ -4600,7 +4599,6 @@ bce_tx_encap(struct bce_softc *sc, struc u16 *chain_prod, u32 *prod_bseq) { u32 vlan_tag_flags = 0; - struct m_tag *mtag; struct bce_dmamap_arg map_arg; bus_dmamap_t map; int i, error, rc = 0; @@ -4614,10 +4612,9 @@ bce_tx_encap(struct bce_softc *sc, struc } /* Transfer any VLAN tags to the bd. */ - mtag = VLAN_OUTPUT_TAG(sc->bce_ifp, m_head); - if (mtag != NULL) + if (m_head->m_flags & M_VLANTAG) vlan_tag_flags |= (TX_BD_FLAGS_VLAN_TAG | - (VLAN_TAG_VALUE(mtag) << 16)); + (m_head->m_pkthdr.ether_vlan << 16)); /* Map the mbuf into DMAable memory. */ map = sc->tx_mbuf_map[*chain_prod]; Index: dev/bge/if_bge.c =================================================================== RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v retrieving revision 1.143 diff -u -p -r1.143 if_bge.c --- dev/bge/if_bge.c 3 Sep 2006 00:27:41 -0000 1.143 +++ dev/bge/if_bge.c 7 Sep 2006 15:03:43 -0000 @@ -2568,9 +2568,8 @@ bge_rxeof(struct bge_softc *sc) * attach that information to the packet. */ if (have_tag) { - VLAN_INPUT_TAG(ifp, m, vlan_tag); - if (m == NULL) - continue; + m->m_pkthdr.ether_vlan = vlan_tag; + m->m_flags |= M_VLANTAG; } BGE_UNLOCK(sc); @@ -2907,7 +2906,6 @@ bge_encap(struct bge_softc *sc, struct m bus_dmamap_t map; struct bge_tx_bd *d; struct mbuf *m = *m_head; - struct m_tag *mtag; uint32_t idx = *txidx; uint16_t csum_flags; int nsegs, i, error; @@ -2979,9 +2977,9 @@ bge_encap(struct bge_softc *sc, struct m /* ... and put VLAN tag into first segment. */ d = &sc->bge_ldata.bge_tx_ring[*txidx]; - if ((mtag = VLAN_OUTPUT_TAG(sc->bge_ifp, m)) != NULL) { + if (m->m_flags & M_VLANTAG) { d->bge_flags |= BGE_TXBDFLAG_VLAN_TAG; - d->bge_vlan_tag = VLAN_TAG_VALUE(mtag); + d->bge_vlan_tag = m->m_pkthdr.ether_vlan; } else d->bge_vlan_tag = 0; Index: dev/em/if_em.c =================================================================== RCS file: /home/ncvs/src/sys/dev/em/if_em.c,v retrieving revision 1.139 diff -u -p -r1.139 if_em.c --- dev/em/if_em.c 3 Sep 2006 00:27:41 -0000 1.139 +++ dev/em/if_em.c 7 Sep 2006 15:03:43 -0000 @@ -1438,7 +1438,6 @@ em_encap(struct adapter *adapter, struct struct em_buffer *tx_buffer, *tx_buffer_last; struct em_tx_desc *current_tx_desc; struct mbuf *m_head; - struct m_tag *mtag; uint32_t txd_upper, txd_lower, txd_used, txd_saved; int nsegs, i, j; int error; @@ -1459,16 +1458,13 @@ em_encap(struct adapter *adapter, struct } } - /* Find out if we are in vlan mode. */ - mtag = VLAN_OUTPUT_TAG(ifp, m_head); - /* * When operating in promiscuous mode, hardware encapsulation for * packets is disabled. This means we have to add the vlan * encapsulation in the driver, since it will have come down from the * VLAN layer with a tag instead of a VLAN header. */ - if (mtag != NULL && adapter->em_insert_vlan_header) { + if ((m_head->m_flags & M_VLANTAG) && adapter->em_insert_vlan_header) { struct ether_vlan_header *evl; struct ether_header eh; @@ -1492,9 +1488,7 @@ em_encap(struct adapter *adapter, struct bcopy(&eh, evl, sizeof(*evl)); evl->evl_proto = evl->evl_encap_proto; evl->evl_encap_proto = htons(ETHERTYPE_VLAN); - evl->evl_tag = htons(VLAN_TAG_VALUE(mtag)); - m_tag_delete(m_head, mtag); - mtag = NULL; + evl->evl_tag = htons(m_head->m_pkthdr.ether_vlan); *m_headp = m_head; } @@ -1608,10 +1602,10 @@ em_encap(struct adapter *adapter, struct else adapter->num_tx_desc_avail -= nsegs; - if (mtag != NULL) { + if (m_head->m_flags & M_VLANTAG) { /* Set the vlan id. */ current_tx_desc->upper.fields.special = - htole16(VLAN_TAG_VALUE(mtag)); + htole16(m_head->m_pkthdr.ether_vlan); /* Tell hardware to add tag. */ current_tx_desc->lower.data |= htole32(E1000_TXD_CMD_VLE); @@ -3236,9 +3230,10 @@ em_rxeof(struct adapter *adapter, int co goto skip; #endif if (status & E1000_RXD_STAT_VP) - VLAN_INPUT_TAG(ifp, adapter->fmp, + adapter->fmp->m_pkthdr.ether_vlan = (le16toh(current_desc->special) & - E1000_RXD_SPC_VLAN_MASK)); + E1000_RXD_SPC_VLAN_MASK); + adapter->fmp->m_flags |= M_VLANTAG; #ifndef __NO_STRICT_ALIGNMENT skip: #endif Index: dev/ixgb/if_ixgb.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ixgb/if_ixgb.c,v retrieving revision 1.19 diff -u -p -r1.19 if_ixgb.c --- dev/ixgb/if_ixgb.c 4 Aug 2006 07:56:33 -0000 1.19 +++ dev/ixgb/if_ixgb.c 7 Sep 2006 15:03:44 -0000 @@ -926,8 +926,6 @@ ixgb_encap(struct adapter * adapter, str #if __FreeBSD_version < 500000 struct ifvlan *ifv = NULL; -#else - struct m_tag *mtag; #endif bus_dma_segment_t segs[IXGB_MAX_SCATTER]; bus_dmamap_t map; @@ -981,7 +979,7 @@ ixgb_encap(struct adapter * adapter, str m_head->m_pkthdr.rcvif != NULL && m_head->m_pkthdr.rcvif->if_type == IFT_L2VLAN) ifv = m_head->m_pkthdr.rcvif->if_softc; -#else +#elseif __FreeBSD_version < 700000 mtag = VLAN_OUTPUT_TAG(ifp, m_head); #endif i = adapter->next_avail_tx_desc; @@ -1005,10 +1003,13 @@ ixgb_encap(struct adapter * adapter, str if (ifv != NULL) { /* Set the vlan id */ current_tx_desc->vlan = ifv->ifv_tag; -#else +#elseif __FreeBSD_version < 700000 if (mtag != NULL) { /* Set the vlan id */ current_tx_desc->vlan = VLAN_TAG_VALUE(mtag); +#else + if (m_head->m_flags & M_VLANTAG) { + current_tx_desc->vlan = m_head->m_pkthdr.ether_vlan; #endif /* Tell hardware to add tag */ @@ -2151,9 +2152,17 @@ ixgb_process_receive_interrupts(struct a #else ixgb_receive_checksum(adapter, current_desc, adapter->fmp); +#if __FreeBSD_version < 700000 if (current_desc->status & IXGB_RX_DESC_STATUS_VP) VLAN_INPUT_TAG(ifp, adapter->fmp, current_desc->special); +#else + if (current_desc->status & IXGB_RX_DESC_STATUS_VP) { + adapter->fmp->m_pkthdr.ether_vlan = + current_desc->special; + adapter->fmp->m_flags |= M_VLANTAG; + } +#endif if (adapter->fmp != NULL) { IXGB_UNLOCK(adapter); Index: dev/nfe/if_nfe.c =================================================================== RCS file: /home/ncvs/src/sys/dev/nfe/if_nfe.c,v retrieving revision 1.3 diff -u -p -r1.3 if_nfe.c --- dev/nfe/if_nfe.c 14 Aug 2006 15:35:43 -0000 1.3 +++ dev/nfe/if_nfe.c 7 Sep 2006 15:03:44 -0000 @@ -1454,9 +1454,8 @@ static void nfe_rxeof(struct nfe_softc * #if NVLAN > 1 if (have_tag) { - VLAN_INPUT_TAG_NEW(ifp, m, vlan_tag); - if (m == NULL) - continue; + m->m_pkthdr.ether_vlan = vlan_tag; + m->m_flags |= M_VLANTAG; } #endif @@ -1576,9 +1575,6 @@ static int nfe_encap(struct nfe_softc *s struct nfe_tx_data *data=NULL; bus_dmamap_t map; u_int16_t flags = NFE_TX_VALID; -#if NVLAN > 0 - struct m_tag *vtag; -#endif bus_dma_segment_t segs[NFE_MAX_SCATTER]; int nsegs; int error, i; @@ -1600,11 +1596,6 @@ static int nfe_encap(struct nfe_softc *s } -#if NVLAN > 0 - /* setup h/w VLAN tagging */ - vtag = VLAN_OUTPUT_TAG(sc->nfe_ifp, m0); -#endif - #ifdef NFE_CSUM if (m0->m_pkthdr.csum_flags & CSUM_IP) flags |= NFE_TX_IP_CSUM; @@ -1627,8 +1618,9 @@ static int nfe_encap(struct nfe_softc *s desc64->length = htole16(segs[i].ds_len - 1); desc64->flags = htole16(flags); #if NVLAN > 0 - desc64->vtag = htole32(NFE_TX_VTAG | - VLAN_TAG_VALUE(vtag)); + if (m0->m_flags & M_VLANTAG) + desc64->vtag = htole32(NFE_TX_VTAG | + m0->m_pkthdr.ether_vlan); #endif } else { desc32 = &sc->txq.desc32[sc->txq.cur]; @@ -1641,9 +1633,6 @@ static int nfe_encap(struct nfe_softc *s /* csum flags and vtag belong to the first fragment only */ if (nsegs > 1) { flags &= ~(NFE_TX_IP_CSUM | NFE_TX_TCP_CSUM); -#if NVLAN > 0 - vtag = 0; -#endif } sc->txq.queued++; Index: dev/nge/if_nge.c =================================================================== RCS file: /home/ncvs/src/sys/dev/nge/if_nge.c,v retrieving revision 1.87 diff -u -p -r1.87 if_nge.c --- dev/nge/if_nge.c 16 May 2006 14:36:29 -0000 1.87 +++ dev/nge/if_nge.c 7 Sep 2006 15:03:44 -0000 @@ -1226,10 +1226,9 @@ nge_rxeof(sc) * to vlan_input() instead of ether_input(). */ if (extsts & NGE_RXEXTSTS_VLANPKT) { - VLAN_INPUT_TAG(ifp, m, - ntohs(extsts & NGE_RXEXTSTS_VTCI)); - if (m == NULL) - continue; + m->m_pkthdr.ether_vlan = + ntohs(extsts & NGE_RXEXTSTS_VTCI); + m->m_flags |= M_VLANTAG; } NGE_UNLOCK(sc); (*ifp->if_input)(ifp, m); @@ -1506,7 +1505,6 @@ nge_encap(sc, m_head, txidx) struct nge_desc *f = NULL; struct mbuf *m; int frag, cur, cnt = 0; - struct m_tag *mtag; /* * Start packing the mbufs in this chain into @@ -1548,10 +1546,9 @@ nge_encap(sc, m_head, txidx) NGE_TXEXTSTS_UDPCSUM; } - mtag = VLAN_OUTPUT_TAG(sc->nge_ifp, m_head); - if (mtag != NULL) { + if (m_head->m_flags & M_VLANTAG) { sc->nge_ldata->nge_tx_list[cur].nge_extsts |= - (NGE_TXEXTSTS_VLANPKT|htons(VLAN_TAG_VALUE(mtag))); + (NGE_TXEXTSTS_VLANPKT|htons(m_head->m_pkthdr.ether_vlan)); } sc->nge_ldata->nge_tx_list[cur].nge_mbuf = m_head; Index: dev/re/if_re.c =================================================================== RCS file: /home/ncvs/src/sys/dev/re/if_re.c,v retrieving revision 1.72 diff -u -p -r1.72 if_re.c --- dev/re/if_re.c 3 Aug 2006 00:15:19 -0000 1.72 +++ dev/re/if_re.c 7 Sep 2006 15:03:45 -0000 @@ -1715,10 +1715,9 @@ re_rxeof(sc) } maxpkt--; if (rxvlan & RL_RDESC_VLANCTL_TAG) { - VLAN_INPUT_TAG(ifp, m, - ntohs((rxvlan & RL_RDESC_VLANCTL_DATA))); - if (m == NULL) - continue; + m->m_pkthdr.ether_vlan = + ntohs((rxvlan & RL_RDESC_VLANCTL_DATA)); + m->m_flags |= M_VLANTAG; } RL_UNLOCK(sc); (*ifp->if_input)(ifp, m); @@ -1996,7 +1995,6 @@ re_encap(sc, m_head, idx) struct rl_dmaload_arg arg; bus_dmamap_t map; int error; - struct m_tag *mtag; RL_LOCK_ASSERT(sc); @@ -2107,11 +2105,10 @@ re_encap(sc, m_head, idx) * appear in the first descriptor of a multi-descriptor * transmission attempt. */ - - mtag = VLAN_OUTPUT_TAG(sc->rl_ifp, *m_head); - if (mtag != NULL) + if ((*m_head)->m_flags & M_VLANTAG) sc->rl_ldata.rl_tx_list[*idx].rl_vlanctl = - htole32(htons(VLAN_TAG_VALUE(mtag)) | RL_TDESC_VLANCTL_TAG); + htole32(htons((*m_head)->m_pkthdr.ether_vlan) | + RL_TDESC_VLANCTL_TAG); /* Transfer ownership of packet to the chip. */ Index: dev/stge/if_stge.c =================================================================== RCS file: /home/ncvs/src/sys/dev/stge/if_stge.c,v retrieving revision 1.2 diff -u -p -r1.2 if_stge.c --- dev/stge/if_stge.c 12 Aug 2006 01:21:36 -0000 1.2 +++ dev/stge/if_stge.c 7 Sep 2006 15:03:46 -0000 @@ -1207,7 +1207,6 @@ stge_encap(struct stge_softc *sc, struct struct stge_txdesc *txd; struct stge_tfd *tfd; struct mbuf *m; - struct m_tag *mtag; bus_dma_segment_t txsegs[STGE_MAXTXSEGS]; int error, i, nsegs, si; uint64_t csum_flags, tfc; @@ -1270,9 +1269,8 @@ stge_encap(struct stge_softc *sc, struct sc->sc_cdata.stge_tx_prod = (si + 1) % STGE_TX_RING_CNT; /* Check if we have a VLAN tag to insert. */ - mtag = VLAN_OUTPUT_TAG(sc->sc_ifp, m); - if (mtag != NULL) - tfc |= TFD_VLANTagInsert | TFD_VID(VLAN_TAG_VALUE(mtag)); + if (m->m_flags & M_VLANTAG) + tfc |= (TFD_VLANTagInsert | TFD_VID(m->m_pkthdr.ether_vlan)); tfd->tfd_control = htole64(tfc); /* Update Tx Queue. */ @@ -1859,8 +1857,10 @@ stge_rxeof(struct stge_softc *sc) #endif /* Check for VLAN tagged packets. */ if ((status & RFD_VLANDetected) != 0 && - (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) - VLAN_INPUT_TAG(ifp, m, RFD_TCI(status64)); + (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) { + m->m_pkthdr.ether_vlan = RFD_TCI(status64); + m->m_flags |= M_VLANTAG; + } STGE_UNLOCK(sc); /* Pass it on. */ Index: dev/ti/if_ti.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ti/if_ti.c,v retrieving revision 1.123 diff -u -p -r1.123 if_ti.c --- dev/ti/if_ti.c 12 Aug 2006 01:30:38 -0000 1.123 +++ dev/ti/if_ti.c 7 Sep 2006 15:03:46 -0000 @@ -2812,9 +2812,8 @@ ti_rxeof(sc) * tag it before passing the packet upward. */ if (have_tag) { - VLAN_INPUT_TAG(ifp, m, vlan_tag); - if (m == NULL) - continue; + m->m_pkthdr.ether_vlan = vlan_tag; + m->m_flags |= M_VLANTAG; } TI_UNLOCK(sc); (*ifp->if_input)(ifp, m); @@ -2956,7 +2955,6 @@ ti_encap(sc, m_head) struct ti_tx_desc *f; struct ti_tx_desc txdesc; struct mbuf *m; - struct m_tag *mtag; bus_dma_segment_t txsegs[TI_MAXTXSEGS]; u_int16_t csum_flags; int error, frag, i, nseg; @@ -3012,7 +3010,6 @@ ti_encap(sc, m_head) bus_dmamap_sync(sc->ti_rdata_dmat, sc->ti_rdata_dmamap, BUS_DMASYNC_PREWRITE); - mtag = VLAN_OUTPUT_TAG(sc->ti_ifp, m); frag = sc->ti_tx_saved_prodidx; for (i = 0; i < nseg; i++) { if (sc->ti_hwrev == TI_HWREV_TIGON) { @@ -3023,9 +3020,9 @@ ti_encap(sc, m_head) ti_hostaddr64(&f->ti_addr, txsegs[i].ds_addr); f->ti_len = txsegs[i].ds_len; f->ti_flags = csum_flags; - if (mtag != NULL) { + if (m->m_flags & M_VLANTAG) { f->ti_flags |= TI_BDFLAG_VLAN_TAG; - f->ti_vlan_tag = VLAN_TAG_VALUE(mtag) & 0xfff; + f->ti_vlan_tag = m->m_pkthdr.ether_vlan & 0xfff; } else { f->ti_vlan_tag = 0; } Index: dev/txp/if_txp.c =================================================================== RCS file: /home/ncvs/src/sys/dev/txp/if_txp.c,v retrieving revision 1.41 diff -u -p -r1.41 if_txp.c --- dev/txp/if_txp.c 16 May 2006 14:36:32 -0000 1.41 +++ dev/txp/if_txp.c 7 Sep 2006 15:03:47 -0000 @@ -765,9 +765,8 @@ txp_rx_reclaim(sc, r) } if (rxd->rx_stat & RX_STAT_VLAN) { - VLAN_INPUT_TAG(ifp, m, htons(rxd->rx_vlan >> 16)); - if (m == NULL) - goto next; + m->m_pkthdr.ether_vlan = htons(rxd->rx_vlan >> 16); + m->m_flags |= M_VLANTAG; } TXP_UNLOCK(sc); @@ -1272,7 +1271,6 @@ txp_start_locked(ifp) struct mbuf *m, *m0; struct txp_swdesc *sd; u_int32_t firstprod, firstcnt, prod, cnt; - struct m_tag *mtag; TXP_LOCK_ASSERT(sc); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != @@ -1311,10 +1309,9 @@ txp_start_locked(ifp) if (++cnt >= (TX_ENTRIES - 4)) goto oactive; - mtag = VLAN_OUTPUT_TAG(ifp, m); - if (mtag != NULL) { + if (m->m_flags & M_VLANTAG) { txd->tx_pflags = TX_PFLAGS_VLAN | - (htons(VLAN_TAG_VALUE(mtag)) << TX_PFLAGS_VLANTAG_S); + (htons(m->m_pkthdr.ether_vlan) << TX_PFLAGS_VLANTAG_S); } if (m->m_pkthdr.csum_flags & CSUM_IP) Index: dev/vge/if_vge.c =================================================================== RCS file: /home/ncvs/src/sys/dev/vge/if_vge.c,v retrieving revision 1.25 diff -u -p -r1.25 if_vge.c --- dev/vge/if_vge.c 4 Sep 2006 13:14:44 -0000 1.25 +++ dev/vge/if_vge.c 7 Sep 2006 15:03:48 -0000 @@ -1490,10 +1490,9 @@ vge_rxeof(sc) } if (rxstat & VGE_RDSTS_VTAG) { - VLAN_INPUT_TAG(ifp, m, - ntohs((rxctl & VGE_RDCTL_VLANID))); - if (m == NULL) - continue; + m->m_pkthdr.ether_vlan = + ntohs((rxctl & VGE_RDCTL_VLANID)); + m->m_flags |= M_VLANTAG; } VGE_UNLOCK(sc); @@ -1757,7 +1756,6 @@ vge_encap(sc, m_head, idx) struct vge_dmaload_arg arg; bus_dmamap_t map; int error; - struct m_tag *mtag; if (sc->vge_ldata.vge_tx_free <= 2) return (EFBIG); @@ -1816,10 +1814,9 @@ vge_encap(sc, m_head, idx) * Set up hardware VLAN tagging. */ - mtag = VLAN_OUTPUT_TAG(sc->vge_ifp, m_head); - if (mtag != NULL) + if (m_head->m_flags & M_VLANTAG) sc->vge_ldata.vge_tx_list[idx].vge_ctl |= - htole32(htons(VLAN_TAG_VALUE(mtag)) | VGE_TDCTL_VTAG); + htole32(htons(m_head->m_pkthdr.ether_vlan) | VGE_TDCTL_VTAG); sc->vge_ldata.vge_tx_list[idx].vge_sts |= htole32(VGE_TDSTS_OWN); Index: kern/kern_mbuf.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_mbuf.c,v retrieving revision 1.25 diff -u -p -r1.25 kern_mbuf.c --- kern/kern_mbuf.c 10 Jun 2006 14:34:07 -0000 1.25 +++ kern/kern_mbuf.c 7 Sep 2006 15:03:49 -0000 @@ -150,7 +150,6 @@ uma_zone_t zone_jumbop; uma_zone_t zone_jumbo9; uma_zone_t zone_jumbo16; uma_zone_t zone_ext_refcnt; -uma_zone_t zone_mtag_vlan; /* * Local prototypes. @@ -163,7 +162,6 @@ static void mb_dtor_clust(void *, int, v static void mb_dtor_pack(void *, int, void *); static int mb_zinit_pack(void *, int, int); static void mb_zfini_pack(void *, int); -static int mt_zinit_vlan(void *, int, int); static void mb_reclaim(void *); static void mbuf_init(void *); @@ -244,12 +242,6 @@ mbuf_init(void *dummy) NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); - zone_mtag_vlan = uma_zcreate("mtag_vlan", - sizeof(struct m_tag) + sizeof(u_int), - NULL, NULL, - mt_zinit_vlan, NULL, - UMA_ALIGN_INT, 0); - /* uma_prealloc() goes here... */ /* @@ -536,23 +528,6 @@ mb_ctor_pack(void *mem, int size, void * return (0); } -static void -mt_vlan_free(struct m_tag *mtag) -{ - uma_zfree(zone_mtag_vlan, mtag); -} - -static int -mt_zinit_vlan(void *mem, int size, int how) -{ - struct m_tag *mtag = (struct m_tag *)mem; - - m_tag_setup(mtag, MTAG_VLAN, MTAG_VLAN_TAG, sizeof(u_int)); - mtag->m_tag_free = mt_vlan_free; - - return (0); -} - /* * This is the protocol drain routine. * Index: net/if_vlan.c =================================================================== RCS file: /home/ncvs/src/sys/net/if_vlan.c,v retrieving revision 1.114 diff -u -p -r1.114 if_vlan.c --- net/if_vlan.c 25 Aug 2006 08:25:35 -0000 1.114 +++ net/if_vlan.c 7 Sep 2006 15:03:58 -0000 @@ -850,15 +850,7 @@ vlan_start(struct ifnet *ifp) * packet tag that holds it. */ if (p->if_capenable & IFCAP_VLAN_HWTAGGING) { - struct m_tag *mtag = (struct m_tag *) - uma_zalloc(zone_mtag_vlan, M_NOWAIT); - if (mtag == NULL) { - ifp->if_oerrors++; - m_freem(m); - continue; - } - VLAN_TAG_VALUE(mtag) = ifv->ifv_tag; - m_tag_prepend(m, mtag); + m->m_pkthdr.ether_vlan = ifv->ifv_tag; m->m_flags |= M_VLANTAG; } else { struct ether_vlan_header *evl; @@ -915,7 +907,7 @@ vlan_input(struct ifnet *ifp, struct mbu { struct ifvlantrunk *trunk = ifp->if_vlantrunk; struct ifvlan *ifv; - struct m_tag *mtag; + int inenc = 0; uint16_t tag; KASSERT(trunk != NULL, ("%s: no trunk", __func__)); @@ -925,11 +917,7 @@ vlan_input(struct ifnet *ifp, struct mbu * Packet is tagged, but 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); + tag = EVL_VLANOFTAG(m->m_pkthdr.ether_vlan); m->m_flags &= ~M_VLANTAG; } else { struct ether_vlan_header *evl; @@ -937,7 +925,7 @@ vlan_input(struct ifnet *ifp, struct mbu /* * Packet is tagged in-band as specified by 802.1q. */ - mtag = NULL; + inenc = 1; switch (ifp->if_type) { case IFT_ETHER: if (m->m_len < sizeof(*evl) && @@ -980,7 +968,7 @@ vlan_input(struct ifnet *ifp, struct mbu } TRUNK_RUNLOCK(trunk); - if (mtag == NULL) { + if (inenc) { /* * Packet had an in-line encapsulation header; * remove it. The original header has already Index: net/if_vlan_var.h =================================================================== RCS file: /home/ncvs/src/sys/net/if_vlan_var.h,v retrieving revision 1.24 diff -u -p -r1.24 if_vlan_var.h --- net/if_vlan_var.h 30 Jan 2006 13:45:15 -0000 1.24 +++ net/if_vlan_var.h 7 Sep 2006 15:03:58 -0000 @@ -70,23 +70,20 @@ struct vlanreq { */ /* - * Drivers that support hardware VLAN tagging pass a packet's tag - * up through the stack by appending a packet tag with this value. + * XXX: Rewrite description... + * Drivers that support hardware VLAN tagging fill in the received * Output is handled likewise, the driver must locate the packet - * tag to extract the VLAN tag. The following macros are used to - * do this work. On input, do: * - * VLAN_INPUT_TAG(ifp, m, tag,); + * m->m_pkthdr.ether_vlan = vlan_id; + * m->m_flags |= M_VLANTAG; * * 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 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); - * if (mtag != NULL) { - * ... = VLAN_TAG_VALUE(mtag); + * if (m->m_flags & M_VLANTAG) { + * ... = m->m_pkthdr.ether_vlan; * ... pass tag to hardware ... * } * @@ -94,30 +91,6 @@ struct vlanreq { * tagging by marking IFCAP_VLAN_HWTAGGING in if_capabilities. */ -/* - * This macro must expand to a lvalue so that it can be used - * to set a tag with a simple assignment. - */ -#define VLAN_TAG_VALUE(_mt) (*(u_int *)((_mt) + 1)) - -#define VLAN_INPUT_TAG(_ifp, _m, _t) do { \ - struct m_tag *mtag = (struct m_tag *) \ - uma_zalloc(zone_mtag_vlan, M_NOWAIT); \ - if (mtag != NULL) { \ - VLAN_TAG_VALUE(mtag) = (_t); \ - m_tag_prepend((_m), mtag); \ - (_m)->m_flags |= M_VLANTAG; \ - } else { \ - (_ifp)->if_ierrors++; \ - m_freem(_m); \ - _m = NULL; \ - } \ -} while (0) - -#define VLAN_OUTPUT_TAG(_ifp, _m) \ - ((_m)->m_flags & M_VLANTAG ? \ - m_tag_locate((_m), MTAG_VLAN, MTAG_VLAN_TAG, NULL) : NULL) - #define VLAN_CAPABILITIES(_ifp) do { \ if ((_ifp)->if_vlantrunk != NULL) \ (*vlan_trunk_cap_p)(_ifp); \ Index: net80211/ieee80211_input.c =================================================================== RCS file: /home/ncvs/src/sys/net80211/ieee80211_input.c,v retrieving revision 1.94 diff -u -p -r1.94 ieee80211_input.c --- net80211/ieee80211_input.c 10 Aug 2006 05:54:36 -0000 1.94 +++ net80211/ieee80211_input.c 7 Sep 2006 15:03:58 -0000 @@ -722,19 +722,11 @@ ieee80211_deliver_data(struct ieee80211c m->m_pkthdr.rcvif = ifp; if (ni->ni_vlan != 0) { /* attach vlan tag */ - VLAN_INPUT_TAG(ifp, m, ni->ni_vlan); - if (m == NULL) - goto out; /* XXX goto err? */ + m->m_pkthdr.ether_vlan = ni->ni_vlan; + m->m_flags |= M_VLANTAG; } (*ifp->if_input)(ifp, m); } - return; - out: - if (m != NULL) { - if (bpf_peers_present(ic->ic_rawbpf)) - bpf_mtap(ic->ic_rawbpf, m); - m_freem(m); - } } static struct mbuf * Index: net80211/ieee80211_output.c =================================================================== RCS file: /home/ncvs/src/sys/net80211/ieee80211_output.c,v retrieving revision 1.42 diff -u -p -r1.42 ieee80211_output.c --- net80211/ieee80211_output.c 10 Aug 2006 05:37:49 -0000 1.42 +++ net80211/ieee80211_output.c 7 Sep 2006 15:03:58 -0000 @@ -400,12 +400,11 @@ ieee80211_classify(struct ieee80211com * */ v_wme_ac = 0; if (ni->ni_vlan != 0) { - struct m_tag *mtag = VLAN_OUTPUT_TAG(ic->ic_ifp, m); - if (mtag == NULL) { + if ((m->m_flags & M_VLANTAG) == 0) { IEEE80211_NODE_STAT(ni, tx_novlantag); return 1; } - if (EVL_VLANOFTAG(VLAN_TAG_VALUE(mtag)) != + if (EVL_VLANOFTAG(m->m_pkthdr.ether_vlan) != EVL_VLANOFTAG(ni->ni_vlan)) { IEEE80211_NODE_STAT(ni, tx_vlanmismatch); return 1; Index: netgraph/ng_vlan.c =================================================================== RCS file: /home/ncvs/src/sys/netgraph/ng_vlan.c,v retrieving revision 1.3 diff -u -p -r1.3 ng_vlan.c --- netgraph/ng_vlan.c 20 Apr 2005 14:19:20 -0000 1.3 +++ netgraph/ng_vlan.c 7 Sep 2006 15:03:58 -0000 @@ -345,7 +345,6 @@ ng_vlan_rcvdata(hook_p hook, item_p item int error; u_int16_t vlan; struct mbuf *m; - struct m_tag *mtag; struct filter *f; /* Make sure we have an entire header. */ @@ -361,14 +360,14 @@ ng_vlan_rcvdata(hook_p hook, item_p item * If from downstream, select between a match hook * or the nomatch hook. */ - mtag = m_tag_locate(m, MTAG_VLAN, MTAG_VLAN_TAG, NULL); - if (mtag != NULL || eh->ether_type == htons(ETHERTYPE_VLAN)) { - if (mtag != NULL) { + if (m->m_flags & M_VLANTAG || + eh->ether_type == htons(ETHERTYPE_VLAN)) { + if (m->m_flags & M_VLANTAG) { /* * Packet is tagged, m contains a normal * Ethernet frame; tag is stored out-of-band. */ - vlan = EVL_VLANOFTAG(VLAN_TAG_VALUE(mtag)); + vlan = m->m_pkthdr.ether_vlan; (void)&evl; /* XXX silence GCC */ } else { if (m->m_len < sizeof(*evl) && @@ -380,9 +379,10 @@ ng_vlan_rcvdata(hook_p hook, item_p item vlan = EVL_VLANOFTAG(ntohs(evl->evl_tag)); } if ((f = ng_vlan_findentry(priv, vlan)) != NULL) { - if (mtag != NULL) - m_tag_delete(m, mtag); - else { + if (m->m_flags & M_VLANTAG) { + m->m_pkthdr.ether_vlan = 0; + m->m_flags &= ~M_VLANTAG; + } else { evl->evl_encap_proto = evl->evl_proto; bcopy(mtod(m, caddr_t), mtod(m, caddr_t) + Index: sys/mbuf.h =================================================================== RCS file: /home/ncvs/src/sys/sys/mbuf.h,v retrieving revision 1.195 diff -u -p -r1.195 mbuf.h --- sys/mbuf.h 6 Sep 2006 22:33:49 -0000 1.195 +++ sys/mbuf.h 7 Sep 2006 15:04:01 -0000 @@ -329,7 +329,6 @@ extern uma_zone_t zone_jumbop; extern uma_zone_t zone_jumbo9; extern uma_zone_t zone_jumbo16; extern uma_zone_t zone_ext_refcnt; -extern uma_zone_t zone_mtag_vlan; static __inline struct mbuf *m_get(int how, short type); static __inline struct mbuf *m_gethdr(int how, short type); @@ -755,8 +754,6 @@ struct mbuf *m_unshare(struct mbuf *, in #define PACKET_TAG_CARP 28 /* CARP info */ /* Specific cookies and tags. */ -#define MTAG_VLAN 1035328035 -#define MTAG_VLAN_TAG 0 /* tag of VLAN interface */ /* Packet tag routines. */ struct m_tag *m_tag_alloc(u_int32_t, int, int, int);