diff options
author | andre <andre@FreeBSD.org> | 2006-09-17 13:33:30 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2006-09-17 13:33:30 +0000 |
commit | 2d9e7e4a32c8c33011a4a625f3560ff186124090 (patch) | |
tree | 0c60fd4adaa245ddeb4255e5c579b7939f52463f /sys/dev/nfe | |
parent | 9f404382211c4f1a6f9dccff7813b9ce26b9fcef (diff) | |
download | FreeBSD-src-2d9e7e4a32c8c33011a4a625f3560ff186124090.zip FreeBSD-src-2d9e7e4a32c8c33011a4a625f3560ff186124090.tar.gz |
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
Diffstat (limited to 'sys/dev/nfe')
-rw-r--r-- | sys/dev/nfe/if_nfe.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/sys/dev/nfe/if_nfe.c b/sys/dev/nfe/if_nfe.c index 356f50c..9890ddd 100644 --- a/sys/dev/nfe/if_nfe.c +++ b/sys/dev/nfe/if_nfe.c @@ -1482,9 +1482,8 @@ static void nfe_rxeof(struct nfe_softc *sc) #if NVLAN > 1 if (have_tag) { - VLAN_INPUT_TAG_NEW(ifp, m, vlan_tag); - if (m == NULL) - continue; + m->m_pkthdr.ether_vtag = vlan_tag; + m->m_flags |= M_VLANTAG; } #endif @@ -1604,9 +1603,6 @@ static int nfe_encap(struct nfe_softc *sc, struct mbuf *m0) 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; @@ -1628,11 +1624,6 @@ static int nfe_encap(struct nfe_softc *sc, struct mbuf *m0) } -#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; @@ -1655,8 +1646,9 @@ static int nfe_encap(struct nfe_softc *sc, struct mbuf *m0) 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_vtag); #endif } else { desc32 = &sc->txq.desc32[sc->txq.cur]; @@ -1669,9 +1661,6 @@ static int nfe_encap(struct nfe_softc *sc, struct mbuf *m0) /* 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++; |