Enable the vlan code that thorpej@NetBSD.org added, and fix a bug where

the vlan tag was read from the rx descriptor after it was reinitialized
(and hence was always 0).  Hardware vlan support looks good tested
between two vmware clients.
With support from tls@NetBSD.org.
This commit is contained in:
darran 2009-03-31 04:16:57 +00:00
parent 44170e3c3a
commit 0b4bf6c76b
1 changed files with 5 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_wm.c,v 1.170 2009/03/29 16:22:17 msaitoh Exp $ */
/* $NetBSD: if_wm.c,v 1.171 2009/03/31 04:16:57 darran Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.170 2009/03/29 16:22:17 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.171 2009/03/31 04:16:57 darran Exp $");
#include "bpfilter.h"
#include "rnd.h"
@ -2019,9 +2019,7 @@ wm_start(struct ifnet *ifp)
{
struct wm_softc *sc = ifp->if_softc;
struct mbuf *m0;
#if 0 /* XXXJRT */
struct m_tag *mtag;
#endif
struct wm_txsoft *txs;
bus_dmamap_t dmamap;
int error, nexttx, lasttx = -1, ofree, seg, segs_needed, use_tso;
@ -2262,7 +2260,6 @@ wm_start(struct ifnet *ifp)
sc->sc_txdescs[lasttx].wtx_cmdlen |=
htole32(WTX_CMD_EOP | WTX_CMD_RS);
#if 0 /* XXXJRT */
/*
* If VLANs are enabled and the packet has a VLAN tag, set
* up the descriptor to encapsulate the packet for us.
@ -2275,7 +2272,6 @@ wm_start(struct ifnet *ifp)
sc->sc_txdescs[lasttx].wtx_fields.wtxu_vlan
= htole16(VLAN_TAG_VALUE(mtag) & 0xffff);
}
#endif /* XXXJRT */
txs->txs_lastdesc = lasttx;
@ -2579,6 +2575,7 @@ wm_rxintr(struct wm_softc *sc)
struct mbuf *m;
int i, len;
uint8_t status, errors;
uint16_t vlantag;
for (i = sc->sc_rxptr;; i = WM_NEXTRX(i)) {
rxs = &sc->sc_rxsoft[i];
@ -2592,6 +2589,7 @@ wm_rxintr(struct wm_softc *sc)
status = sc->sc_rxdescs[i].wrx_status;
errors = sc->sc_rxdescs[i].wrx_errors;
len = le16toh(sc->sc_rxdescs[i].wrx_len);
vlantag = sc->sc_rxdescs[i].wrx_special;
if ((status & WRX_ST_DD) == 0) {
/*
@ -2716,17 +2714,15 @@ wm_rxintr(struct wm_softc *sc)
m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = len;
#if 0 /* XXXJRT */
/*
* If VLANs are enabled, VLAN packets have been unwrapped
* for us. Associate the tag with the packet.
*/
if ((status & WRX_ST_VP) != 0) {
VLAN_INPUT_TAG(ifp, m,
le16toh(sc->sc_rxdescs[i].wrx_special,
le16toh(vlantag),
continue);
}
#endif /* XXXJRT */
/*
* Set up checksum info for this packet.
@ -3260,12 +3256,10 @@ wm_init(struct ifnet *ifp)
}
CSR_WRITE(sc, WMREG_FCTTV, FCTTV_DFLT);
#if 0 /* XXXJRT */
/* Deal with VLAN enables. */
if (VLAN_ATTACHED(&sc->sc_ethercom))
sc->sc_ctrl |= CTRL_VME;
else
#endif /* XXXJRT */
sc->sc_ctrl &= ~CTRL_VME;
/* Write the control registers. */
@ -3348,10 +3342,8 @@ wm_init(struct ifnet *ifp)
CSR_WRITE(sc, WMREG_ITR, sc->sc_itr);
}
#if 0 /* XXXJRT */
/* Set the VLAN ethernetype. */
CSR_WRITE(sc, WMREG_VET, ETHERTYPE_VLAN);
#endif
/*
* Set up the transmit control register; we start out with