Module Name: src Committed By: snj Date: Mon Nov 6 09:54:01 UTC 2017
Modified Files: src/sys/dev/pci [netbsd-8]: if_wm.c if_wmreg.h Log Message: Pull up following revision(s) (requested by knakahara in ticket #348): sys/dev/pci/if_wm.c: revision 1.542 sys/dev/pci/if_wmreg.h: revision 1.104 fix wm(4) vlan panic. Reported and tested by Tom Ivar Helbekkmo, thanks. wm(4) used PRI bits and CFI bit as vlantag by mistake. It is found out by if_ether.h:r1.67. To generate a diff of this commit: cvs rdiff -u -r1.508.4.4 -r1.508.4.5 src/sys/dev/pci/if_wm.c cvs rdiff -u -r1.98.6.1 -r1.98.6.2 src/sys/dev/pci/if_wmreg.h 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.508.4.4 src/sys/dev/pci/if_wm.c:1.508.4.5 --- src/sys/dev/pci/if_wm.c:1.508.4.4 Tue Oct 24 08:38:59 2017 +++ src/sys/dev/pci/if_wm.c Mon Nov 6 09:54:01 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.508.4.4 2017/10/24 08:38:59 snj Exp $ */ +/* $NetBSD: if_wm.c,v 1.508.4.5 2017/11/06 09:54:01 snj Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -83,7 +83,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.4 2017/10/24 08:38:59 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.5 2017/11/06 09:54:01 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -8095,11 +8095,11 @@ wm_rxdesc_get_vlantag(struct wm_rxqueue struct wm_softc *sc = rxq->rxq_sc; if (sc->sc_type == WM_T_82574) - return rxq->rxq_ext_descs[idx].erx_ctx.erxc_vlan; + return EXTRXC_VLAN_ID(rxq->rxq_ext_descs[idx].erx_ctx.erxc_vlan); else if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) - return rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_vlan; + return NQRXC_VLAN_ID(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_vlan); else - return rxq->rxq_descs[idx].wrx_special; + return WRX_VLAN_ID(rxq->rxq_descs[idx].wrx_special); } static inline int Index: src/sys/dev/pci/if_wmreg.h diff -u src/sys/dev/pci/if_wmreg.h:1.98.6.1 src/sys/dev/pci/if_wmreg.h:1.98.6.2 --- src/sys/dev/pci/if_wmreg.h:1.98.6.1 Tue Aug 1 23:33:18 2017 +++ src/sys/dev/pci/if_wmreg.h Mon Nov 6 09:54:01 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wmreg.h,v 1.98.6.1 2017/08/01 23:33:18 snj Exp $ */ +/* $NetBSD: if_wmreg.h,v 1.98.6.2 2017/11/06 09:54:01 snj Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -208,6 +208,12 @@ typedef union ext_rxdesc { #define EXTRXC_STATUS_PKTTYPE_MASK __BITS(19,16) #define EXTRXC_STATUS_PKTTYPE(status) __SHIFTOUT(status,EXTRXC_STATUS_PKTTYPE_MASK) +#define EXTRXC_VLAN_ID_MASK __BITS(11,0) /* VLAN identifier mask */ +#define EXTRXC_VLAN_ID(x) ((x) & EXTRXC_VLAN_ID_MASK) /* VLAN identifier */ +#define EXTRXC_VLAN_CFI __BIT(12) /* Canonical Form Indicator */ +#define EXTRXC_VLAN_PRI_MASK __BITS(15,13) /* VLAN priority mask */ +#define EXTRXC_VLAN_PRI(x) __SHIFTOUT((x),EXTRXC_VLAN_PRI_MASK) /* VLAN priority */ + /* advanced RX descriptor for 82575 and newer */ typedef union nq_rxdesc { struct { @@ -330,6 +336,12 @@ typedef union nq_rxdesc { #define NQRXC_STATUS_MC __BIT(19) /* Packet received from Manageability Controller */ /* "MBC" in i350 spec */ +#define NQRXC_VLAN_ID_MASK __BITS(11,0) /* VLAN identifier mask */ +#define NQRXC_VLAN_ID(x) ((x) & NQRXC_VLAN_ID_MASK) /* VLAN identifier */ +#define NQRXC_VLAN_CFI __BIT(12) /* Canonical Form Indicator */ +#define NQRXC_VLAN_PRI_MASK __BITS(15,13) /* VLAN priority mask */ +#define NQRXC_VLAN_PRI(x) __SHIFTOUT((x),NQRXC_VLAN_PRI_MASK) /* VLAN priority */ + /* * The Wiseman transmit descriptor. *