Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Crash related to VLANs in Oct 18th -current



Hi,

On 2017/10/20 2:30, Tom Ivar Helbekkmo wrote:
> I just updated to a fresh -current yesterday, and am running it on a
> couple of amd64 systems.  It crashes during boot on the third one,
> though, the one that has VLANs.
> 
> It configures wm0 thus:
> 
> # cat ifconfig.wm0
> up
> media 100baseTX mediaopt full-duplex
> ip4csum tcp4csum udp4csum
> 
> ...and then goes on to create a number of VLANs, by this pattern:
> 
> # cat ifconfig.vlan0
> create
> vlan 10 vlanif wm0
> ip4csum tcp4csum udp4csum
> inet 193.71.27.8 prefixlen 27
> inet6 2001:8c0:c904:10::8 prefixlen 64
> 
> ...and so on.  I set up five of those VLANs, and a split second later
> (copied by hand from a photograph of a console terminal, as for some
> reason I didn't get a valid crash dump) (the first line is truncated):
> 
> panic: kernel diagnostic assertion "(vlanid & ~ETHER_VLAN_MASK) == 0" failed: f
> cpu0: Begin traceback...
> vpanic() at netbsd:vpanic+0x140
> ch_voltag_convert_in() at netbsd:ch_voltag_convert_in
> wm_rxeof() at netbsd:wm_rxeof+0x88f
> wm_intr_legacy() at netbsd:wm_intr_legacy+0xa1
> intr_biglock_wrapper() [...]
> 
> The KASSERT is in the vlan_set_tag() function in sys/net/if_ether.h.
// snip

Thank you for your detailed reporting, it helps to find out the cause
very much.

Could you try the following patch?

====================
diff --git a/sys/dev/pci/if_wm.c b/sys/dev/pci/if_wm.c
index 8a2feedb607..00d06331c93 100644
--- a/sys/dev/pci/if_wm.c
+++ b/sys/dev/pci/if_wm.c
@@ -8095,11 +8095,11 @@ wm_rxdesc_get_vlantag(struct wm_rxqueue *rxq, int idx)
 	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
diff --git a/sys/dev/pci/if_wmreg.h b/sys/dev/pci/if_wmreg.h
index c005414764c..97a9964b2be 100644
--- a/sys/dev/pci/if_wmreg.h
+++ b/sys/dev/pci/if_wmreg.h
@@ -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.
  *
====================


Thanks,

-- 
//////////////////////////////////////////////////////////////////////
Internet Initiative Japan Inc.

Device Engineering Section,
IoT Platform Development Department,
Network Division,
Technology Unit

Kengo NAKAHARA <k-nakahara%iij.ad.jp@localhost>


Home | Main Index | Thread Index | Old Index