summaryrefslogtreecommitdiffstats
path: root/sys/dev/stge
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2006-09-17 13:33:30 +0000
committerandre <andre@FreeBSD.org>2006-09-17 13:33:30 +0000
commit2d9e7e4a32c8c33011a4a625f3560ff186124090 (patch)
tree0c60fd4adaa245ddeb4255e5c579b7939f52463f /sys/dev/stge
parent9f404382211c4f1a6f9dccff7813b9ce26b9fcef (diff)
downloadFreeBSD-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/stge')
-rw-r--r--sys/dev/stge/if_stge.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/stge/if_stge.c b/sys/dev/stge/if_stge.c
index 10dddae..59711d0 100644
--- a/sys/dev/stge/if_stge.c
+++ b/sys/dev/stge/if_stge.c
@@ -1207,7 +1207,6 @@ stge_encap(struct stge_softc *sc, struct mbuf **m_head)
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 mbuf **m_head)
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_vtag));
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_vtag = RFD_TCI(status64);
+ m->m_flags |= M_VLANTAG;
+ }
STGE_UNLOCK(sc);
/* Pass it on. */
OpenPOWER on IntegriCloud