From 2d9e7e4a32c8c33011a4a625f3560ff186124090 Mon Sep 17 00:00:00 2001 From: andre Date: Sun, 17 Sep 2006 13:33:30 +0000 Subject: Move ethernet VLAN tags from mtags to its own mbuf packet header field m_pkthdr.ether_vlan. The presence of the M_VLANTAG flag on the mbuf signifies the presence and validity of its content. Drivers that support hardware VLAN tag stripping fill in the received VLAN tag (containing both vlan and priority information) into the ether_vtag mbuf packet header field: m->m_pkthdr.ether_vtag = vlan_id; /* ntohs()? */ m->m_flags |= M_VLANTAG; to mark the packet m with the specified VLAN tag. On output the driver should check the mbuf for the M_VLANTAG flag to see if a VLAN tag is present and valid: if (m->m_flags & M_VLANTAG) { ... = m->m_pkthdr.ether_vtag; /* htons()? */ ... pass tag to hardware ... } VLAN tags are stored in host byte order. Byte swapping may be necessary. (Note: This driver conversion was mechanic and did not add or remove any byte swapping in the drivers.) Remove zone_mtag_vlan UMA zone and MTAG_VLAN definition. No more tag memory allocation have to be done. Reviewed by: thompsa, yar Sponsored by: TCP/IP Optimization Fundraise 2005 --- sys/dev/txp/if_txp.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'sys/dev/txp') diff --git a/sys/dev/txp/if_txp.c b/sys/dev/txp/if_txp.c index 9b8ba38..86519fe 100644 --- a/sys/dev/txp/if_txp.c +++ b/sys/dev/txp/if_txp.c @@ -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_vtag = 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_vtag) << TX_PFLAGS_VLANTAG_S); } if (m->m_pkthdr.csum_flags & CSUM_IP) -- cgit v1.1