Module Name: src
Committed By: knakahara
Date: Fri Feb 17 07:21:28 UTC 2017
Modified Files:
src/sys/dev/pci: if_wm.c
Log Message:
more fix about IFF_OACTIVE.
fix TODO of r1.479 and reduce IFF_OACTIVE manipulation.
To generate a diff of this commit:
cvs rdiff -u -r1.481 -r1.482 src/sys/dev/pci/if_wm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.481 src/sys/dev/pci/if_wm.c:1.482
--- src/sys/dev/pci/if_wm.c:1.481 Fri Feb 17 05:20:01 2017
+++ src/sys/dev/pci/if_wm.c Fri Feb 17 07:21:28 2017
@@ -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 @@ wm_send_common_locked(struct ifnet *ifp,
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 @@ wm_send_common_locked(struct ifnet *ifp,
("%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 @@ wm_send_common_locked(struct ifnet *ifp,
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 @@ wm_send_common_locked(struct ifnet *ifp,
}
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 @@ wm_send_common_locked(struct ifnet *ifp,
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 @@ wm_nq_send_common_locked(struct ifnet *i
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 @@ wm_nq_send_common_locked(struct ifnet *i
("%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 @@ wm_nq_send_common_locked(struct ifnet *i
}
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 @@ wm_nq_send_common_locked(struct ifnet *i
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;
}