summaryrefslogtreecommitdiffstats
path: root/sys/dev/fxp
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2009-06-21 06:46:32 +0000
committeryongari <yongari@FreeBSD.org>2009-06-21 06:46:32 +0000
commit6232dd892e1706d2673eb010f74e3de61a364ac4 (patch)
tree03c9781d8b4b0a01b97b869facc1d731d3ce5c48 /sys/dev/fxp
parentb8c10ee72ca8de1ab11e13f66c671183cf52e46b (diff)
downloadFreeBSD-src-6232dd892e1706d2673eb010f74e3de61a364ac4.zip
FreeBSD-src-6232dd892e1706d2673eb010f74e3de61a364ac4.tar.gz
Always check fxp(4) is running, see if it can accept frames from
upper stack in fxp_start_body(). fxp(4) drops driver lock in Rx path so check the fxp(4) is still running after reacquiring driver lock in Rx path. Also don't invoke fxp_intr_body if fxp(4) is not running. With this change there is no need to set suspend bit in device attach phase.
Diffstat (limited to 'sys/dev/fxp')
-rw-r--r--sys/dev/fxp/if_fxp.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c
index 5c25553..5c08c28 100644
--- a/sys/dev/fxp/if_fxp.c
+++ b/sys/dev/fxp/if_fxp.c
@@ -992,7 +992,6 @@ fxp_detach(device_t dev)
#endif
FXP_LOCK(sc);
- sc->suspended = 1; /* Do same thing as we do for suspend */
/*
* Stop DMA and drop transmit queue, but disable interrupts first.
*/
@@ -1319,6 +1318,10 @@ fxp_start_body(struct ifnet *ifp)
if (sc->need_mcsetup)
return;
+ if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
+ IFF_DRV_RUNNING)
+ return;
+
if (sc->tx_queued > FXP_NTXCB_HIWAT)
fxp_txeof(sc);
/*
@@ -1727,7 +1730,8 @@ fxp_intr(void *xsc)
* First ACK all the interrupts in this pass.
*/
CSR_WRITE_1(sc, FXP_CSR_SCB_STATACK, statack);
- fxp_intr_body(sc, ifp, statack, -1);
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+ fxp_intr_body(sc, ifp, statack, -1);
}
FXP_UNLOCK(sc);
}
@@ -1987,6 +1991,8 @@ fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp, uint8_t statack,
(*ifp->if_input)(ifp, m);
FXP_LOCK(sc);
rx_npkts++;
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+ return (rx_npkts);
} else {
/* Reuse RFA and loaded DMA map. */
ifp->if_iqdrops++;
@@ -2070,7 +2076,8 @@ fxp_tick(void *xsc)
*/
if (sc->rx_idle_secs > FXP_MAX_RX_IDLE) {
sc->rx_idle_secs = 0;
- fxp_mc_setup(sc);
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+ fxp_mc_setup(sc);
}
/*
* If there is no pending command, start another stats
OpenPOWER on IntegriCloud