Module Name:    src
Committed By:   msaitoh
Date:           Thu Dec  7 00:38:38 UTC 2017

Modified Files:
        src/sys/dev/pci: if_wm.c

Log Message:
 Fix a bug that 8257[56] can't receive packet reported by Bert Kiers in
PR#52717. For 82575 and 82576, the RX descriptors must be initialized after
the setting of RCTL.EN in wm_set_filter(). This bug was added in if_wm.c
rev. 1.515.


To generate a diff of this commit:
cvs rdiff -u -r1.547 -r1.548 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.547 src/sys/dev/pci/if_wm.c:1.548
--- src/sys/dev/pci/if_wm.c:1.547	Wed Dec  6 09:03:12 2017
+++ src/sys/dev/pci/if_wm.c	Thu Dec  7 00:38:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.547 2017/12/06 09:03:12 ozaki-r Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.548 2017/12/07 00:38:38 msaitoh 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.547 2017/12/06 09:03:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.548 2017/12/07 00:38:38 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -5814,6 +5814,14 @@ wm_init_locked(struct ifnet *ifp)
 		break;
 	}
 
+	/*
+	 * Set the receive filter.
+	 *
+	 * For 82575 and 82576, the RX descriptors must be initialized after
+	 * the setting of RCTL.EN in wm_set_filter()
+	 */
+	wm_set_filter(sc);
+
 	/* On 575 and later set RDT only if RX enabled */
 	if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) {
 		int qidx;
@@ -5828,9 +5836,6 @@ wm_init_locked(struct ifnet *ifp)
 		}
 	}
 
-	/* Set the receive filter. */
-	wm_set_filter(sc);
-
 	wm_unset_stopping_flags(sc);
 
 	/* Start the one second link check clock. */
@@ -6688,13 +6693,13 @@ wm_init_rx_buffer(struct wm_softc *sc, s
 				return ENOMEM;
 			}
 		} else {
-			if ((sc->sc_flags & WM_F_NEWQUEUE) == 0)
-				wm_init_rxdesc(rxq, i);
 			/*
-			 * For 82575 and newer device, the RX descriptors
-			 * must be initialized after the setting of RCTL.EN in
+			 * For 82575 and 82576, the RX descriptors must be
+			 * initialized after the setting of RCTL.EN in
 			 * wm_set_filter()
 			 */
+			if ((sc->sc_flags & WM_F_NEWQUEUE) == 0)
+				wm_init_rxdesc(rxq, i);
 		}
 	}
 	rxq->rxq_ptr = 0;

Reply via email to