summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorChristian Weisgerber <naddy@cvs.openbsd.org>2008-10-16 19:18:04 +0000
committerChristian Weisgerber <naddy@cvs.openbsd.org>2008-10-16 19:18:04 +0000
commit7b27043f229c9133ae33baf4b80e762cd23177b0 (patch)
treef9d77bd5838c2cbb2089d11dd8b1a4f243c14f0d /sys/dev
parent90aabd4ca2cee27b46f35ad2bde34bdc150da7d6 (diff)
Switch the existing TX VLAN hardware support over to having the
tag in the header. Convert TX tagging in the drivers. Help and ok brad@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/re.c14
-rw-r--r--sys/dev/pci/if_bge.c13
-rw-r--r--sys/dev/pci/if_bnx.c8
-rw-r--r--sys/dev/pci/if_ix.c25
-rw-r--r--sys/dev/pci/if_nfe.c9
-rw-r--r--sys/dev/pci/if_nge.c13
-rw-r--r--sys/dev/pci/if_ti.c24
-rw-r--r--sys/dev/pci/if_txp.c11
-rw-r--r--sys/dev/pci/if_xge.c13
9 files changed, 34 insertions, 96 deletions
diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c
index 35520604f42..5a4cd7b5d28 100644
--- a/sys/dev/ic/re.c
+++ b/sys/dev/ic/re.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: re.c,v 1.95 2008/10/16 19:16:21 naddy Exp $ */
+/* $OpenBSD: re.c,v 1.96 2008/10/16 19:18:03 naddy Exp $ */
/* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@@ -1649,13 +1649,6 @@ re_encap(struct rl_softc *sc, struct mbuf *m, int *idx)
struct rl_desc *d;
u_int32_t cmdstat, vlanctl = 0, csum_flags = 0;
struct rl_txq *txq;
-#if NVLAN > 0
- struct ifvlan *ifv = NULL;
-
- if ((m->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) &&
- m->m_pkthdr.rcvif != NULL)
- ifv = m->m_pkthdr.rcvif->if_softc;
-#endif
if (sc->rl_ldata.rl_tx_free <= RL_NTXDESC_RSVD)
return (EFBIG);
@@ -1728,8 +1721,9 @@ re_encap(struct rl_softc *sc, struct mbuf *m, int *idx)
* transmission attempt.
*/
#if NVLAN > 0
- if (ifv != NULL)
- vlanctl |= swap16(ifv->ifv_tag) | RL_TDESC_VLANCTL_TAG;
+ if (m->m_flags & M_VLANTAG)
+ vlanctl |= swap16(m->m_pkthdr.ether_vtag) |
+ RL_TDESC_VLANCTL_TAG;
#endif
/*
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index 7ef02187d77..86f83eced2b 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bge.c,v 1.247 2008/10/14 18:01:53 naddy Exp $ */
+/* $OpenBSD: if_bge.c,v 1.248 2008/10/16 19:18:03 naddy Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -2870,13 +2870,6 @@ bge_encap(struct bge_softc *sc, struct mbuf *m_head, u_int32_t *txidx)
struct txdmamap_pool_entry *dma;
bus_dmamap_t dmamap;
int i = 0;
-#if NVLAN > 0
- struct ifvlan *ifv = NULL;
-
- if ((m_head->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) &&
- m_head->m_pkthdr.rcvif != NULL)
- ifv = m_head->m_pkthdr.rcvif->if_softc;
-#endif
cur = frag = *txidx;
@@ -2936,9 +2929,9 @@ doit:
f->bge_len = dmamap->dm_segs[i].ds_len;
f->bge_flags = csum_flags;
#if NVLAN > 0
- if (ifv != NULL) {
+ if (m_head->m_flags & M_VLANTAG) {
f->bge_flags |= BGE_TXBDFLAG_VLAN_TAG;
- f->bge_vlan_tag = ifv->ifv_tag;
+ f->bge_vlan_tag = m_head->m_pkthdr.ether_vtag;
} else {
f->bge_vlan_tag = 0;
}
diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c
index b5fc6269d48..405b1e660d2 100644
--- a/sys/dev/pci/if_bnx.c
+++ b/sys/dev/pci/if_bnx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bnx.c,v 1.67 2008/10/16 19:16:21 naddy Exp $ */
+/* $OpenBSD: if_bnx.c,v 1.68 2008/10/16 19:18:03 naddy Exp $ */
/*-
* Copyright (c) 2006 Broadcom Corporation
@@ -4388,11 +4388,9 @@ bnx_tx_encap(struct bnx_softc *sc, struct mbuf **m_head)
#if NVLAN > 0
/* Transfer any VLAN tags to the bd. */
- if ((m0->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) &&
- m0->m_pkthdr.rcvif != NULL) {
- struct ifvlan *ifv = m0->m_pkthdr.rcvif->if_softc;
+ if (m0->m_flags & M_VLANTAG) {
flags |= TX_BD_FLAGS_VLAN_TAG;
- vlan_tag = ifv->ifv_tag;
+ vlan_tag = m0->m_pkthdr.ether_vtag;
}
#endif
diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c
index f7d962f8f54..dd864130444 100644
--- a/sys/dev/pci/if_ix.c
+++ b/sys/dev/pci/if_ix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ix.c,v 1.11 2008/10/16 19:16:21 naddy Exp $ */
+/* $OpenBSD: if_ix.c,v 1.12 2008/10/16 19:18:03 naddy Exp $ */
/******************************************************************************
@@ -841,9 +841,7 @@ ixgbe_encap(struct tx_ring *txr, struct mbuf *m_head)
cmd_type_len |= IXGBE_ADVTXD_DCMD_IFCS | IXGBE_ADVTXD_DCMD_DEXT;
#if NVLAN > 0
- /* VLAN tagging? */
- if ((m_head->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) &&
- m_head->m_pkthdr.rcvif != NULL)
+ if (m_head->m_flags & M_VLANTAG)
cmd_type_len |= IXGBE_ADVTXD_DCMD_VLE;
#endif
@@ -1888,11 +1886,6 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp)
int ctxd = txr->next_avail_tx_desc;
#if NVLAN > 0
struct ether_vlan_header *eh;
- struct ifvlan *ifv = NULL;
-
- if ((mp->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) &&
- mp->m_pkthdr.rcvif != NULL)
- ifv = mp->m_pkthdr.rcvif->if_softc;
#else
struct ether_header *eh;
#endif
@@ -1908,9 +1901,9 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp)
* be placed into the descriptor itself.
*/
#if NVLAN > 0
- if (ifv != NULL) {
+ if (mp->m_flags & M_VLANTAG) {
vlan_macip_lens |=
- htole16(ifv->ifv_tag) << IXGBE_ADVTXD_VLAN_SHIFT;
+ htole16(mp->m_pkthdr.ether_vtag) << IXGBE_ADVTXD_VLAN_SHIFT;
} else
#endif
if (offload == FALSE)
@@ -2021,12 +2014,6 @@ ixgbe_tso_setup(struct tx_ring *txr, struct mbuf *mp, uint32_t *paylen)
#if NVLAN > 0
uint16_t vtag = 0;
struct ether_vlan_header *eh;
-
- struct ifvlan *ifv = NULL;
-
- if ((mp->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) &&
- mp->m_pkthdr.rcvif != NULL)
- ifv = mp->m_pkthdr.rcvif->if_softc;
#else
struct ether_header *eh;
#endif
@@ -2076,9 +2063,9 @@ ixgbe_tso_setup(struct tx_ring *txr, struct mbuf *mp, uint32_t *paylen)
#if NVLAN > 0
/* VLAN MACLEN IPLEN */
- if (ifv != NULL) {
+ if (mp->m_flags & M_VLANTAG) {
vtag = htole16(mp->m_pkthdr.ether_vtag);
- vlan_macip_lens |= (ifv->ifv_tag << IXGBE_ADVTXD_VLAN_SHIFT);
+ vlan_macip_lens |= (vtag << IXGBE_ADVTXD_VLAN_SHIFT);
}
#endif
diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c
index 79d09748713..0552416b24c 100644
--- a/sys/dev/pci/if_nfe.c
+++ b/sys/dev/pci/if_nfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nfe.c,v 1.82 2008/10/02 20:21:14 brad Exp $ */
+/* $OpenBSD: if_nfe.c,v 1.83 2008/10/16 19:18:03 naddy Exp $ */
/*-
* Copyright (c) 2006, 2007 Damien Bergamini <damien.bergamini@free.fr>
@@ -933,11 +933,8 @@ nfe_encap(struct nfe_softc *sc, struct mbuf *m0)
#if NVLAN > 0
/* setup h/w VLAN tagging */
- if ((m0->m_flags & (M_PROTO1 | M_PKTHDR)) == (M_PROTO1 | M_PKTHDR) &&
- m0->m_pkthdr.rcvif != NULL) {
- struct ifvlan *ifv = m0->m_pkthdr.rcvif->if_softc;
- vtag = NFE_TX_VTAG | htons(ifv->ifv_tag);
- }
+ if (m0->m_flags & M_VLANTAG)
+ vtag = NFE_TX_VTAG | htons(m0->m_pkthdr.ether_vtag);
#endif
if (m0->m_pkthdr.csum_flags & M_IPV4_CSUM_OUT)
flags |= NFE_TX_IP_CSUM;
diff --git a/sys/dev/pci/if_nge.c b/sys/dev/pci/if_nge.c
index 3ee2a043e6a..85ac6a95341 100644
--- a/sys/dev/pci/if_nge.c
+++ b/sys/dev/pci/if_nge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nge.c,v 1.60 2008/10/15 19:12:18 blambert Exp $ */
+/* $OpenBSD: if_nge.c,v 1.61 2008/10/16 19:18:03 naddy Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
* Copyright (c) 1997, 1998, 1999, 2000, 2001
@@ -1593,13 +1593,6 @@ nge_encap(sc, m_head, txidx)
struct nge_desc *f = NULL;
struct mbuf *m;
int frag, cur, cnt = 0;
-#if NVLAN > 0
- struct ifvlan *ifv = NULL;
-
- if ((m_head->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) &&
- m_head->m_pkthdr.rcvif != NULL)
- ifv = m_head->m_pkthdr.rcvif->if_softc;
-#endif
/*
* Start packing the mbufs in this chain into
@@ -1633,9 +1626,9 @@ nge_encap(sc, m_head, txidx)
sc->nge_ldata->nge_tx_list[*txidx].nge_extsts = 0;
#if NVLAN > 0
- if (ifv != NULL) {
+ if (m_head->m_flags & M_VLANTAG) {
sc->nge_ldata->nge_tx_list[cur].nge_extsts |=
- (NGE_TXEXTSTS_VLANPKT|ifv->ifv_tag);
+ (NGE_TXEXTSTS_VLANPKT|m_head->m_pkthdr.ether_vtag);
}
#endif
diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c
index 4520179b368..f9836b244ac 100644
--- a/sys/dev/pci/if_ti.c
+++ b/sys/dev/pci/if_ti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ti.c,v 1.89 2008/10/14 18:01:53 naddy Exp $ */
+/* $OpenBSD: if_ti.c,v 1.90 2008/10/16 19:18:03 naddy Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -2027,13 +2027,6 @@ ti_encap_tigon1(struct ti_softc *sc, struct mbuf *m_head, u_int32_t *txidx)
bus_dmamap_t txmap;
struct ti_tx_desc txdesc;
int i = 0;
-#if NVLAN > 0
- struct ifvlan *ifv = NULL;
-
- if ((m_head->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) &&
- m_head->m_pkthdr.rcvif != NULL)
- ifv = m_head->m_pkthdr.rcvif->if_softc;
-#endif
entry = SLIST_FIRST(&sc->ti_tx_map_listhead);
if (entry == NULL)
@@ -2062,9 +2055,9 @@ ti_encap_tigon1(struct ti_softc *sc, struct mbuf *m_head, u_int32_t *txidx)
txdesc.ti_flags = 0;
#if NVLAN > 0
- if (ifv != NULL) {
+ if (m_head->m_flags & M_VLANTAG) {
txdesc.ti_flags |= TI_BDFLAG_VLAN_TAG;
- txdesc.ti_vlan_tag = ifv->ifv_tag;
+ txdesc.ti_vlan_tag = m_head->m_pkthdr.ether_vtag;
}
#endif
@@ -2114,13 +2107,6 @@ ti_encap_tigon2(struct ti_softc *sc, struct mbuf *m_head, u_int32_t *txidx)
struct ti_txmap_entry *entry;
bus_dmamap_t txmap;
int i = 0;
-#if NVLAN > 0
- struct ifvlan *ifv = NULL;
-
- if ((m_head->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) &&
- m_head->m_pkthdr.rcvif != NULL)
- ifv = m_head->m_pkthdr.rcvif->if_softc;
-#endif
entry = SLIST_FIRST(&sc->ti_tx_map_listhead);
if (entry == NULL)
@@ -2148,9 +2134,9 @@ ti_encap_tigon2(struct ti_softc *sc, struct mbuf *m_head, u_int32_t *txidx)
f->ti_len = txmap->dm_segs[i].ds_len & 0xffff;
f->ti_flags = 0;
#if NVLAN > 0
- if (ifv != NULL) {
+ if (m_head->m_flags & M_VLANTAG) {
f->ti_flags |= TI_BDFLAG_VLAN_TAG;
- f->ti_vlan_tag = ifv->ifv_tag;
+ f->ti_vlan_tag = m_head->m_pkthdr.ether_vtag;
} else {
f->ti_vlan_tag = 0;
}
diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c
index 24d1547b530..343bb2c6dc1 100644
--- a/sys/dev/pci/if_txp.c
+++ b/sys/dev/pci/if_txp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_txp.c,v 1.96 2008/10/16 19:16:21 naddy Exp $ */
+/* $OpenBSD: if_txp.c,v 1.97 2008/10/16 19:18:03 naddy Exp $ */
/*
* Copyright (c) 2001
@@ -1328,9 +1328,6 @@ txp_start(struct ifnet *ifp)
struct mbuf *m, *mnew;
struct txp_swdesc *sd;
u_int32_t firstprod, firstcnt, prod, cnt, i;
-#if NVLAN > 0
- struct ifvlan *ifv;
-#endif
if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
return;
@@ -1392,11 +1389,9 @@ txp_start(struct ifnet *ifp)
goto oactive;
#if NVLAN > 0
- if ((m->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) &&
- m->m_pkthdr.rcvif != NULL) {
- ifv = m->m_pkthdr.rcvif->if_softc;
+ if (m->m_flags & M_VLANTAG) {
txd->tx_pflags = TX_PFLAGS_VLAN |
- (htons(ifv->ifv_tag) << TX_PFLAGS_VLANTAG_S);
+ (htons(m->m_pkthdr.ether_vtag) << TX_PFLAGS_VLANTAG_S);
}
#endif
diff --git a/sys/dev/pci/if_xge.c b/sys/dev/pci/if_xge.c
index 53db5138991..94a8656da9d 100644
--- a/sys/dev/pci/if_xge.c
+++ b/sys/dev/pci/if_xge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xge.c,v 1.45 2008/10/02 20:21:14 brad Exp $ */
+/* $OpenBSD: if_xge.c,v 1.46 2008/10/16 19:18:03 naddy Exp $ */
/* $NetBSD: if_xge.c,v 1.1 2005/09/09 10:30:27 ragge Exp $ */
/*
@@ -1099,9 +1099,6 @@ xge_start(struct ifnet *ifp)
struct mbuf *m;
uint64_t par, lcr;
int nexttx = 0, ntxd, error, i;
-#if NVLAN > 0
- struct ifvlan *ifv = NULL;
-#endif
if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
return;
@@ -1145,12 +1142,10 @@ xge_start(struct ifnet *ifp)
txd->txd_control2 = TXD_CTL2_UTIL;
#if NVLAN > 0
- if ((m->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) &&
- m->m_pkthdr.rcvif != NULL) {
- ifv = m->m_pkthdr.rcvif->if_softc;
-
+ if (m->m_flags & M_VLANTAG) {
txd->txd_control2 |= TXD_CTL2_VLANE;
- txd->txd_control2 |= TXD_CTL2_VLANT(ifv->ifv_tag);
+ txd->txd_control2 |=
+ TXD_CTL2_VLANT(m->m_pkthdr.ether_vtag);
}
#endif