Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Establish a softint for legacy, otherwise BOOM!



details:   https://anonhg.NetBSD.org/src/rev/1887a8d51657
branches:  trunk
changeset: 351579:1887a8d51657
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Feb 18 14:48:43 2017 +0000

description:
Establish a softint for legacy, otherwise BOOM!

diffstat:

 sys/dev/pci/if_wm.c |  43 +++++++++++++++++++++++++++----------------
 1 files changed, 27 insertions(+), 16 deletions(-)

diffs (79 lines):

diff -r 01266c83090e -r 1887a8d51657 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Sat Feb 18 14:43:34 2017 +0000
+++ b/sys/dev/pci/if_wm.c       Sat Feb 18 14:48:43 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.484 2017/02/17 12:16:37 knakahara Exp $    */
+/*     $NetBSD: if_wm.c,v 1.485 2017/02/18 14:48:43 christos 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.484 2017/02/17 12:16:37 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.485 2017/02/18 14:48:43 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4565,6 +4565,28 @@
                sc->sc_nqueues = ncpu;
 }
 
+static int
+wm_softint_establish(struct wm_softc *sc, int qidx, int intr_idx)
+{
+       struct wm_queue *wmq = &sc->sc_queue[qidx];
+       wmq->wmq_id = qidx;
+       wmq->wmq_intr_idx = intr_idx;
+       wmq->wmq_si = softint_establish(SOFTINT_NET
+#ifdef WM_MPSAFE
+           | SOFTINT_MPSAFE
+#endif
+           , wm_handle_queue, wmq);
+       if (wmq->wmq_si != NULL)
+               return 0;
+
+       aprint_error_dev(sc->sc_dev, "unable to establish queue[%d] handler\n",
+           wmq->wmq_id);
+
+       pci_intr_disestablish(sc->sc_pc, sc->sc_ihs[wmq->wmq_intr_idx]);
+       sc->sc_ihs[wmq->wmq_intr_idx] = NULL;
+       return ENOMEM;
+}
+
 /*
  * Both single interrupt MSI and INTx can use this function.
  */
@@ -4598,7 +4620,8 @@
 
        aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr);
        sc->sc_nintrs = 1;
-       return 0;
+
+       return wm_softint_establish(sc, 0, 0);
 }
 
 static int
@@ -4676,20 +4699,8 @@
                            "for TX and RX interrupting at %s\n", intrstr);
                }
                sc->sc_ihs[intr_idx] = vih;
-               wmq->wmq_id = qidx;
-               wmq->wmq_intr_idx = intr_idx;
-               wmq->wmq_si = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
-                   wm_handle_queue, wmq);
-               if (wmq->wmq_si == NULL) {
-                       aprint_error_dev(sc->sc_dev,
-                           "unable to establish queue[%d] handler\n",
-                           wmq->wmq_id);
-                       pci_intr_disestablish(sc->sc_pc,
-                           sc->sc_ihs[wmq->wmq_intr_idx]);
-                       sc->sc_ihs[wmq->wmq_intr_idx] = NULL;
+               if (wm_softint_establish(sc, qidx, intr_idx) != 0)
                        goto fail;
-               }
-
                txrx_established++;
                intr_idx++;
        }



Home | Main Index | Thread Index | Old Index