Deleted Added
full compact
31c31
< __FBSDID("$FreeBSD: head/sys/dev/ath/if_ath.c 227344 2011-11-08 17:08:12Z adrian $");
---
> __FBSDID("$FreeBSD: head/sys/dev/ath/if_ath.c 227346 2011-11-08 18:10:04Z adrian $");
1306a1307
> uint32_t txqs;
1380c1381
< int imask = sc->sc_imask;
---
> int imask;
1395a1397,1398
> ATH_LOCK(sc);
> imask = sc->sc_imask;
1398a1402,1416
> * Only blank sc_rxlink if we've not yet kicked
> * the PCU.
> *
> * This isn't entirely correct - the correct solution
> * would be to have a PCU lock and engage that for
> * the duration of the PCU fiddling; which would include
> * running the RX process. Otherwise we could end up
> * messing up the RX descriptor chain and making the
> * RX desc list much shorter.
> */
> if (! sc->sc_kickpcu)
> sc->sc_rxlink = NULL;
> sc->sc_kickpcu = 1;
> ATH_UNLOCK(sc);
> /*
1404,1405d1421
< sc->sc_rxlink = NULL;
< sc->sc_kickpcu = 1;
1412c1428,1429
< if (status & HAL_INT_RX)
---
> if (status & HAL_INT_RX) {
> sc->sc_stats.ast_rx_intr++;
1414c1431,1443
< if (status & HAL_INT_TX)
---
> }
> if (status & HAL_INT_TX) {
> sc->sc_stats.ast_tx_intr++;
> /*
> * Grab all the currently set bits in the HAL txq bitmap
> * and blank them. This is the only place we should be
> * doing this.
> */
> ATH_LOCK(sc);
> txqs = 0xffffffff;
> ath_hal_gettxintrtxqs(sc->sc_ah, &txqs);
> sc->sc_txq_active |= txqs;
> ATH_UNLOCK(sc);
1415a1445
> }
1436c1466,1475
< ath_hal_intrset(ah, sc->sc_imask);
---
> /*
> * Don't reset the interrupt if we've just
> * kicked the PCU, or we may get a nested
> * RXEOL before the rxproc has had a chance
> * to run.
> */
> ATH_LOCK(sc);
> if (sc->sc_kickpcu == 0)
> ath_hal_intrset(ah, sc->sc_imask);
> ATH_UNLOCK(sc);
1611a1651,1657
> * Initial aggregation settings.
> */
> sc->sc_hwq_limit = ATH_AGGR_MIN_QDEPTH;
> sc->sc_tid_hwq_lo = ATH_AGGR_SCHED_LOW;
> sc->sc_tid_hwq_hi = ATH_AGGR_SCHED_HIGH;
>
> /*
3480a3527
> int npkts = 0;
3539a3587
> npkts++;
3826,3835c3874,3884
< sc->sc_kickpcu = 0;
< ath_stoprecv(sc);
< sc->sc_imask |= (HAL_INT_RXEOL | HAL_INT_RXORN);
< if (ath_startrecv(sc) != 0) {
< if_printf(ifp,
< "%s: couldn't restart RX after RXEOL; resetting\n",
< __func__);
< ath_reset(ifp);
< return;
< }
---
> device_printf(sc->sc_dev, "%s: kickpcu; handled %d packets\n",
> __func__, npkts);
>
> /* XXX rxslink? */
> bf = TAILQ_FIRST(&sc->sc_rxbuf);
> ath_hal_putrxbuf(ah, bf->bf_daddr);
> ath_hal_rxena(ah); /* enable recv descriptors */
> ath_mode_init(sc); /* set filters, etc. */
> ath_hal_startpcurecv(ah); /* re-enable PCU/DMA engine */
>
> ATH_LOCK(sc);
3836a3886,3887
> sc->sc_kickpcu = 0;
> ATH_UNLOCK(sc);
4221,4227c4272
< static __inline int
< txqactive(struct ath_hal *ah, int qnum)
< {
< u_int32_t txqs = 1<<qnum;
< ath_hal_gettxintrtxqs(ah, &txqs);
< return (txqs & (1<<qnum));
< }
---
> #define TXQACTIVE(t, q) ( (t) & (1 << (q)))
4237a4283
> uint32_t txqs;
4239c4285,4291
< if (txqactive(sc->sc_ah, 0) && ath_tx_processq(sc, &sc->sc_txq[0]))
---
> ATH_LOCK(sc);
> txqs = sc->sc_txq_active;
> sc->sc_txq_active &= ~txqs;
> ATH_UNLOCK(sc);
>
> if (TXQACTIVE(txqs, 0) && ath_tx_processq(sc, &sc->sc_txq[0]))
> /* XXX why is lastrx updated in tx code? */
4241c4293
< if (txqactive(sc->sc_ah, sc->sc_cabq->axq_qnum))
---
> if (TXQACTIVE(txqs, sc->sc_cabq->axq_qnum))
4261a4314
> uint32_t txqs;
4262a4316,4320
> ATH_LOCK(sc);
> txqs = sc->sc_txq_active;
> sc->sc_txq_active &= ~txqs;
> ATH_UNLOCK(sc);
>
4267c4325
< if (txqactive(sc->sc_ah, 0))
---
> if (TXQACTIVE(txqs, 0))
4269c4327
< if (txqactive(sc->sc_ah, 1))
---
> if (TXQACTIVE(txqs, 1))
4271c4329
< if (txqactive(sc->sc_ah, 2))
---
> if (TXQACTIVE(txqs, 2))
4273c4331
< if (txqactive(sc->sc_ah, 3))
---
> if (TXQACTIVE(txqs, 3))
4275c4333
< if (txqactive(sc->sc_ah, sc->sc_cabq->axq_qnum))
---
> if (TXQACTIVE(txqs, sc->sc_cabq->axq_qnum))
4297a4356
> uint32_t txqs;
4298a4358,4362
> ATH_LOCK(sc);
> txqs = sc->sc_txq_active;
> sc->sc_txq_active &= ~txqs;
> ATH_UNLOCK(sc);
>
4304c4368
< if (ATH_TXQ_SETUP(sc, i) && txqactive(sc->sc_ah, i))
---
> if (ATH_TXQ_SETUP(sc, i) && TXQACTIVE(txqs, i))