aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/bce
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/bce
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/bce')
-rw-r--r--sys/dev/bce/if_bce.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/dev/bce/if_bce.c b/sys/dev/bce/if_bce.c
index 5ff3531b8b4c..34ba0c6b7366 100644
--- a/sys/dev/bce/if_bce.c
+++ b/sys/dev/bce/if_bce.c
@@ -4251,9 +4251,8 @@ bce_rx_intr(struct bce_softc *sc)
#if __FreeBSD_version < 700000
VLAN_INPUT_TAG(ifp, m, l2fhdr->l2_fhdr_vlan_tag, continue);
#else
- VLAN_INPUT_TAG(ifp, m, l2fhdr->l2_fhdr_vlan_tag);
- if (m == NULL)
- continue;
+ m->m_pkthdr.ether_vtag = l2fhdr->l2_fhdr_vlan_tag;
+ m->m_flags |= M_VLANTAG;
#endif
}
@@ -4600,7 +4599,6 @@ bce_tx_encap(struct bce_softc *sc, struct mbuf *m_head, u16 *prod,
u16 *chain_prod, u32 *prod_bseq)
{
u32 vlan_tag_flags = 0;
- struct m_tag *mtag;
struct bce_dmamap_arg map_arg;
bus_dmamap_t map;
int i, error, rc = 0;
@@ -4614,10 +4612,9 @@ bce_tx_encap(struct bce_softc *sc, struct mbuf *m_head, u16 *prod,
}
/* Transfer any VLAN tags to the bd. */
- mtag = VLAN_OUTPUT_TAG(sc->bce_ifp, m_head);
- if (mtag != NULL)
+ if (m_head->m_flags & M_VLANTAG)
vlan_tag_flags |= (TX_BD_FLAGS_VLAN_TAG |
- (VLAN_TAG_VALUE(mtag) << 16));
+ (m_head->m_pkthdr.ether_vtag << 16));
/* Map the mbuf into DMAable memory. */
map = sc->tx_mbuf_map[*chain_prod];