Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev/pci Pull up following revision(s) (r...



details:   https://anonhg.NetBSD.org/src/rev/86818e01e9f2
branches:  netbsd-8
changeset: 318922:86818e01e9f2
user:      martin <martin%NetBSD.org@localhost>
date:      Wed May 09 14:52:40 2018 +0000
description:
Pull up following revision(s) (requested by msaitoh in ticket #814):

        sys/dev/pci/if_bnxvar.h: revision 1.7
        sys/dev/pci/if_bnx.c: revision 1.64

- Fix a bug that bnx(4) panics on shutdown. Stop callout before restroy.
   Reported by Andreas Gustafsson in PR#53265.
- Make sure not to re-arm the callout when we are about to detach. Same as
   if_bge.c rev. 1.292.
- Use pci_intr_establish_xname().

diffstat:

 sys/dev/pci/if_bnx.c    |  36 +++++++++++++++---------------------
 sys/dev/pci/if_bnxvar.h |   1 +
 2 files changed, 16 insertions(+), 21 deletions(-)

diffs (96 lines):

diff -r fe95d2a16ec8 -r 86818e01e9f2 sys/dev/pci/if_bnx.c
--- a/sys/dev/pci/if_bnx.c      Mon May 07 13:28:35 2018 +0000
+++ b/sys/dev/pci/if_bnx.c      Wed May 09 14:52:40 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bnx.c,v 1.61.8.1 2017/10/24 08:38:59 snj Exp $      */
+/*     $NetBSD: if_bnx.c,v 1.61.8.2 2018/05/09 14:52:40 martin Exp $   */
 /*     $OpenBSD: if_bnx.c,v 1.85 2009/11/09 14:32:41 dlg Exp $ */
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.61.8.1 2017/10/24 08:38:59 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.61.8.2 2018/05/09 14:52:40 martin Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -792,7 +792,8 @@
            IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
 
        /* Hookup IRQ last. */
-       sc->bnx_intrhand = pci_intr_establish(pc, ih, IPL_NET, bnx_intr, sc);
+       sc->bnx_intrhand = pci_intr_establish_xname(pc, ih, IPL_NET, bnx_intr,
+           sc, device_xname(self));
        if (sc->bnx_intrhand == NULL) {
                aprint_error_dev(self, "couldn't establish interrupt");
                if (intrstr != NULL)
@@ -890,17 +891,7 @@
 
        /* Stop and reset the controller. */
        s = splnet();
-       if (ifp->if_flags & IFF_RUNNING)
-               bnx_stop(ifp, 1);
-       else {
-               /* Disable the transmit/receive blocks. */
-               REG_WR(sc, BNX_MISC_ENABLE_CLR_BITS, 0x5ffffff);
-               REG_RD(sc, BNX_MISC_ENABLE_CLR_BITS);
-               DELAY(20);
-               bnx_disable_intr(sc);
-               bnx_reset(sc, BNX_DRV_MSG_CODE_RESET);
-       }
-
+       bnx_stop(ifp, 1);
        splx(s);
 
        pmf_device_deregister(dev);
@@ -3371,10 +3362,11 @@
 
        DBPRINT(sc, BNX_VERBOSE_RESET, "Entering %s()\n", __func__);
 
-       if ((ifp->if_flags & IFF_RUNNING) == 0)
-               return;
-
-       callout_stop(&sc->bnx_timeout);
+       if (disable) {
+               sc->bnx_detaching = 1;
+               callout_halt(&sc->bnx_timeout, NULL);
+       } else
+               callout_stop(&sc->bnx_timeout);
 
        mii_down(&sc->bnx_mii);
 
@@ -5694,9 +5686,6 @@
        /* Update the statistics from the hardware statistics block. */
        bnx_stats_update(sc);
 
-       /* Schedule the next tick. */
-       callout_reset(&sc->bnx_timeout, hz, bnx_tick, sc);
-
        mii = &sc->bnx_mii;
        mii_tick(mii);
 
@@ -5707,6 +5696,11 @@
        bnx_get_buf(sc, &prod, &chain_prod, &prod_bseq);
        sc->rx_prod = prod;
        sc->rx_prod_bseq = prod_bseq;
+
+       /* Schedule the next tick. */
+       if (!sc->bnx_detaching)
+               callout_reset(&sc->bnx_timeout, hz, bnx_tick, sc);
+
        splx(s);
        return;
 }
diff -r fe95d2a16ec8 -r 86818e01e9f2 sys/dev/pci/if_bnxvar.h
--- a/sys/dev/pci/if_bnxvar.h   Mon May 07 13:28:35 2018 +0000
+++ b/sys/dev/pci/if_bnxvar.h   Wed May 09 14:52:40 2018 +0000
@@ -210,6 +210,7 @@
        uint32_t                tx_prod_bseq;   /* Counts the bytes used.  */
 
        struct callout          bnx_timeout;
+       int                     bnx_detaching;
 
        /* Frame size and mbuf allocation size for RX frames. */
        uint32_t                max_frame_size;



Home | Main Index | Thread Index | Old Index