Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci device drivers should not divert ifp->if_flags t...



details:   https://anonhg.NetBSD.org/src/rev/592cbea582be
branches:  trunk
changeset: 345308:592cbea582be
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Wed May 18 07:49:34 2016 +0000

description:
device drivers should not divert ifp->if_flags to manage H/W satatus.

diffstat:

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

diffs (77 lines):

diff -r a3b6eeffda8d -r 592cbea582be sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Wed May 18 06:59:59 2016 +0000
+++ b/sys/dev/pci/if_wm.c       Wed May 18 07:49:34 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.399 2016/05/18 06:59:59 knakahara Exp $    */
+/*     $NetBSD: if_wm.c,v 1.400 2016/05/18 07:49:34 knakahara 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.399 2016/05/18 06:59:59 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.400 2016/05/18 07:49:34 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -287,6 +287,13 @@
        uint32_t txq_fifo_addr;         /* internal address of start of FIFO */
        int txq_fifo_stall;             /* Tx FIFO is stalled */
 
+       /*
+        * NEWQUEUE devices must use not ifp->if_flags but txq->txq_flags
+        * to manage Tx H/W queue's busy flag.
+        */
+       int txq_flags;                  /* flags for H/W queue, see below */
+#define        WM_TXQ_WORKING  0x1
+
        /* XXX which event counter is required? */
 };
 
@@ -6695,6 +6702,8 @@
 
        if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
                return;
+       if ((txq->txq_flags & WM_TXQ_WORKING) != 0)
+               return;
 
        sent = false;
 
@@ -6778,7 +6787,7 @@
                            ("%s: TX: need %d (%d) descriptors, have %d\n",
                            device_xname(sc->sc_dev), dmamap->dm_nsegs,
                            segs_needed, txq->txq_free - 1));
-                       ifp->if_flags |= IFF_OACTIVE;
+                       txq->txq_flags |= WM_TXQ_WORKING;
                        bus_dmamap_unload(sc->sc_dmat, dmamap);
                        WM_EVCNT_INCR(&sc->sc_ev_txdstall);
                        break;
@@ -6935,7 +6944,7 @@
        }
 
        if (m0 != NULL) {
-               ifp->if_flags |= IFF_OACTIVE;
+               txq->txq_flags |= WM_TXQ_WORKING;
                WM_EVCNT_INCR(&sc->sc_ev_txdrop);
                DPRINTF(WM_DEBUG_TX, ("%s: TX: error after IFQ_DEQUEUE\n",
                        __func__));
@@ -6944,7 +6953,7 @@
 
        if (txq->txq_sfree == 0 || txq->txq_free <= 2) {
                /* No more slots; notify upper layer. */
-               ifp->if_flags |= IFF_OACTIVE;
+               txq->txq_flags |= WM_TXQ_WORKING;
        }
 
        if (sent) {
@@ -6974,7 +6983,7 @@
        if (sc->sc_stopping)
                return 0;
 
-       ifp->if_flags &= ~IFF_OACTIVE;
+       txq->txq_flags &= ~WM_TXQ_WORKING;
 
        /*
         * Go through the Tx list and free mbufs for those



Home | Main Index | Thread Index | Old Index