Module Name: src Committed By: darran Date: Tue Mar 31 04:16:58 UTC 2009
Modified Files: src/sys/dev/pci: if_wm.c Log Message: Enable the vlan code that thor...@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 t...@netbsd.org. To generate a diff of this commit: cvs rdiff -u -r1.170 -r1.171 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.170 src/sys/dev/pci/if_wm.c:1.171 --- src/sys/dev/pci/if_wm.c:1.170 Sun Mar 29 16:22:17 2009 +++ src/sys/dev/pci/if_wm.c Tue Mar 31 04:16:57 2009 @@ -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 @@ { 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 @@ 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 @@ sc->sc_txdescs[lasttx].wtx_fields.wtxu_vlan = htole16(VLAN_TAG_VALUE(mtag) & 0xffff); } -#endif /* XXXJRT */ txs->txs_lastdesc = lasttx; @@ -2579,6 +2575,7 @@ 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 @@ 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 @@ 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 @@ } 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 @@ 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