aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ti/if_ti.c
diff options
context:
space:
mode:
authorAndre Oppermann <andre@FreeBSD.org>2006-09-17 13:33:30 +0000
committerAndre Oppermann <andre@FreeBSD.org>2006-09-17 13:33:30 +0000
commit78ba57b9e1fd08812b6f5a1b48a20d624a23b31d (patch)
tree0c60fd4adaa245ddeb4255e5c579b7939f52463f /sys/dev/ti/if_ti.c
parentda7cbdc2b35dbefee71d96d4df0d67b427b92f75 (diff)
downloadsrc-78ba57b9e1fd08812b6f5a1b48a20d624a23b31d.tar.gz
src-78ba57b9e1fd08812b6f5a1b48a20d624a23b31d.zip
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
Notes
Notes: svn path=/head/; revision=162375
Diffstat (limited to 'sys/dev/ti/if_ti.c')
-rw-r--r--sys/dev/ti/if_ti.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c
index edbab1bd0e54..4440afa79405 100644
--- a/sys/dev/ti/if_ti.c
+++ b/sys/dev/ti/if_ti.c
@@ -2813,9 +2813,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_vtag = vlan_tag;
+ m->m_flags |= M_VLANTAG;
}
TI_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
@@ -2957,7 +2956,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;
@@ -3013,7 +3011,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) {
@@ -3024,9 +3021,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_vtag & 0xfff;
} else {
f->ti_vlan_tag = 0;
}