Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci - Flush every MTA write. Same as Linux.



details:   https://anonhg.NetBSD.org/src/rev/b267333fefd4
branches:  trunk
changeset: 354703:b267333fefd4
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Jun 26 04:15:06 2017 +0000

description:
- Flush every MTA write. Same as Linux.
- Move the location of calling wm_set_filter. Same as some other OSes.
- Add CSR_WRITE_FLUSH() after writing WMREG_CTRL in wm_gmii_mediachange().

diffstat:

 sys/dev/pci/if_wm.c |  21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diffs (73 lines):

diff -r 72a7ac1ab791 -r b267333fefd4 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Mon Jun 26 04:09:02 2017 +0000
+++ b/sys/dev/pci/if_wm.c       Mon Jun 26 04:15:06 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.514 2017/06/26 04:09:02 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.515 2017/06/26 04:15:06 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.514 2017/06/26 04:09:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.515 2017/06/26 04:15:06 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -3386,8 +3386,10 @@
        else
                size = WM_MC_TABSIZE;
        /* Clear out the multicast table. */
-       for (i = 0; i < size; i++)
+       for (i = 0; i < size; i++) {
                CSR_WRITE(sc, mta_reg + (i << 2), 0);
+               CSR_WRITE_FLUSH(sc);
+       }
 
        ETHER_LOCK(ec);
        ETHER_FIRST_MULTI(step, ec, enm);
@@ -3429,9 +3431,13 @@
                         */
                        bit = CSR_READ(sc, mta_reg + ((reg - 1) << 2));
                        CSR_WRITE(sc, mta_reg + (reg << 2), hash);
+                       CSR_WRITE_FLUSH(sc);
                        CSR_WRITE(sc, mta_reg + ((reg - 1) << 2), bit);
-               } else
+                       CSR_WRITE_FLUSH(sc);
+               } else {
                        CSR_WRITE(sc, mta_reg + (reg << 2), hash);
+                       CSR_WRITE_FLUSH(sc);
+               }
 
                ETHER_NEXT_MULTI(step, enm);
        }
@@ -5524,9 +5530,6 @@
                } else panic("wm_init: i82542 requires MCLBYTES = 2048");
        }
 
-       /* Set the receive filter. */
-       wm_set_filter(sc);
-
        /* Enable ECC */
        switch (sc->sc_type) {
        case WM_T_82571:
@@ -5561,6 +5564,9 @@
                }
        }
 
+       /* Set the receive filter. */
+       wm_set_filter(sc);
+
        wm_turnon(sc);
 
        /* Start the one second link check clock. */
@@ -9442,6 +9448,7 @@
                }
        }
        CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
+       CSR_WRITE_FLUSH(sc);
        if (sc->sc_type <= WM_T_82543)
                wm_gmii_reset(sc);
 



Home | Main Index | Thread Index | Old Index