Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci more fix about IFF_OACTIVE.



details:   https://anonhg.NetBSD.org/src/rev/c1fc5daa72aa
branches:  trunk
changeset: 821779:c1fc5daa72aa
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Fri Feb 17 07:21:28 2017 +0000

description:
more fix about IFF_OACTIVE.

fix TODO of r1.479 and reduce IFF_OACTIVE manipulation.

diffstat:

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

diffs (113 lines):

diff -r 3b8ca7ac5597 -r c1fc5daa72aa sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Fri Feb 17 05:20:01 2017 +0000
+++ b/sys/dev/pci/if_wm.c       Fri Feb 17 07:21:28 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.481 2017/02/17 05:20:01 knakahara Exp $    */
+/*     $NetBSD: if_wm.c,v 1.482 2017/02/17 07:21:28 knakahara 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.481 2017/02/17 05:20:01 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.482 2017/02/17 07:21:28 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -6525,12 +6525,12 @@
        bus_size_t seglen, curlen;
        uint32_t cksumcmd;
        uint8_t cksumfields;
-       struct wm_queue *wmq = container_of(txq, struct wm_queue, wmq_txq);
-       int qid = wmq->wmq_id;
 
        KASSERT(mutex_owned(txq->txq_lock));
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
+               return;
+       if ((ifp->if_flags & IFF_OACTIVE) != 0 && !is_transmit)
                return;
        if ((txq->txq_flags & WM_TXQ_NO_SPACE) != 0)
                return;
@@ -6642,7 +6642,7 @@
                            ("%s: TX: need %d (%d) descriptors, have %d\n",
                            device_xname(sc->sc_dev), dmamap->dm_nsegs,
                            segs_needed, txq->txq_free - 1));
-                       if (qid == 0)
+                       if (!is_transmit)
                                ifp->if_flags |= IFF_OACTIVE;
                        txq->txq_flags |= WM_TXQ_NO_SPACE;
                        bus_dmamap_unload(sc->sc_dmat, dmamap);
@@ -6660,7 +6660,7 @@
                        DPRINTF(WM_DEBUG_TX,
                            ("%s: TX: 82547 Tx FIFO bug detected\n",
                            device_xname(sc->sc_dev)));
-                       if (qid == 0)
+                       if (!is_transmit)
                                ifp->if_flags |= IFF_OACTIVE;
                        txq->txq_flags |= WM_TXQ_NO_SPACE;
                        bus_dmamap_unload(sc->sc_dmat, dmamap);
@@ -6806,7 +6806,7 @@
        }
 
        if (m0 != NULL) {
-               if (qid == 0)
+               if (!is_transmit)
                        ifp->if_flags |= IFF_OACTIVE;
                txq->txq_flags |= WM_TXQ_NO_SPACE;
                WM_Q_EVCNT_INCR(txq, txdrop);
@@ -6817,7 +6817,7 @@
 
        if (txq->txq_sfree == 0 || txq->txq_free <= 2) {
                /* No more slots; notify upper layer. */
-               if (qid == 0)
+               if (!is_transmit)
                        ifp->if_flags |= IFF_OACTIVE;
                txq->txq_flags |= WM_TXQ_NO_SPACE;
        }
@@ -7118,12 +7118,12 @@
        bus_dmamap_t dmamap;
        int error, nexttx, lasttx = -1, seg, segs_needed;
        bool do_csum, sent;
-       struct wm_queue *wmq = container_of(txq, struct wm_queue, wmq_txq);
-       int qid = wmq->wmq_id;
 
        KASSERT(mutex_owned(txq->txq_lock));
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
+               return;
+       if ((ifp->if_flags & IFF_OACTIVE) != 0 && !is_transmit)
                return;
        if ((txq->txq_flags & WM_TXQ_NO_SPACE) != 0)
                return;
@@ -7213,7 +7213,7 @@
                            ("%s: TX: need %d (%d) descriptors, have %d\n",
                            device_xname(sc->sc_dev), dmamap->dm_nsegs,
                            segs_needed, txq->txq_free - 1));
-                       if (qid == 0)
+                       if (!is_transmit)
                                ifp->if_flags |= IFF_OACTIVE;
                        txq->txq_flags |= WM_TXQ_NO_SPACE;
                        bus_dmamap_unload(sc->sc_dmat, dmamap);
@@ -7372,7 +7372,7 @@
        }
 
        if (m0 != NULL) {
-               if (qid == 0)
+               if (!is_transmit)
                        ifp->if_flags |= IFF_OACTIVE;
                txq->txq_flags |= WM_TXQ_NO_SPACE;
                WM_Q_EVCNT_INCR(txq, txdrop);
@@ -7383,7 +7383,7 @@
 
        if (txq->txq_sfree == 0 || txq->txq_free <= 2) {
                /* No more slots; notify upper layer. */
-               if (qid == 0)
+               if (!is_transmit)
                        ifp->if_flags |= IFF_OACTIVE;
                txq->txq_flags |= WM_TXQ_NO_SPACE;
        }



Home | Main Index | Thread Index | Old Index