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/ixgb | |
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/ixgb')
-rw-r--r-- | sys/dev/ixgb/if_ixgb.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/dev/ixgb/if_ixgb.c b/sys/dev/ixgb/if_ixgb.c index bed748c..3886465 100644 --- a/sys/dev/ixgb/if_ixgb.c +++ b/sys/dev/ixgb/if_ixgb.c @@ -926,8 +926,6 @@ ixgb_encap(struct adapter * adapter, struct mbuf * m_head) #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, struct mbuf * m_head) 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, struct mbuf * m_head) 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_vtag; #endif /* Tell hardware to add tag */ @@ -2151,9 +2152,17 @@ ixgb_process_receive_interrupts(struct adapter * adapter, int count) #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_vtag = + current_desc->special; + adapter->fmp->m_flags |= M_VLANTAG; + } +#endif if (adapter->fmp != NULL) { IXGB_UNLOCK(adapter); |