1 diff -urN madwifi-ng-refcount-r2313-20070505.old/ath/if_ath_ahb.c madwifi-ng-refcount-r2313-20070505.dev/ath/if_ath_ahb.c
2 --- madwifi-ng-refcount-r2313-20070505.old/ath/if_ath_ahb.c 2007-03-08 20:59:06.000000000 +0100
3 +++ madwifi-ng-refcount-r2313-20070505.dev/ath/if_ath_ahb.c 2007-05-13 18:17:56.367999800 +0200
10 -exit_ath_wmac(u_int16_t wlanNum)
11 +exit_ath_wmac(u_int16_t wlanNum, struct ar531x_config *config)
13 struct ath_ahb_softc *sc = sclist[wlanNum];
14 struct net_device *dev;
15 - const char *sysType;
22 free_irq(dev->irq, dev);
23 - sysType = get_system_type();
24 - if (!strcmp(sysType, "Atheros AR5315"))
26 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
27 + devid = (u32) config->tag;
29 + if (!strcmp(get_system_type(), "Atheros AR5315"))
30 devid = (u_int16_t) (sysRegRead(AR5315_SREV) &
31 (AR5315_REV_MAJ_M | AR5315_REV_MIN_M));
33 devid = (u_int16_t) ((sysRegRead(AR531X_REV) >> 8) &
34 (AR531X_REV_MAJ | AR531X_REV_MIN));
37 ahb_disable_wmac(devid, wlanNum);
41 static int ahb_wmac_remove(struct platform_device *pdev)
43 - exit_ath_wmac(pdev->id);
44 + exit_ath_wmac(pdev->id, (struct ar531x_config *) pdev->dev.platform_data);
49 (AR5315_REV_MAJ_M | AR5315_REV_MIN_M));
50 if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
51 ((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ))
52 - return init_ath_wmac(devid, 0, &config);
53 + return init_ath_wmac(devid, 0);
56 devid = (u_int16_t) ((sysRegRead(AR531X_REV) >>8) &
58 ar5312BspEepromRead(2 * AR531X_RADIO_MASK_OFF, 2,
60 if ((radioMask & AR531X_RADIO0_MASK) != 0)
61 - if ((ret = init_ath_wmac(devid, 0, &config)) !=0 )
62 + if ((ret = init_ath_wmac(devid, 0)) !=0 )
64 /* XXX: Fall through?! */
65 case AR5212_AR2313_REV8:
66 - if ((ret = init_ath_wmac(devid, 1, &config)) != 0)
67 + if ((ret = init_ath_wmac(devid, 1)) != 0)
71 diff -urN madwifi-ng-refcount-r2313-20070505.old/ath/if_ath.c madwifi-ng-refcount-r2313-20070505.dev/ath/if_ath.c
72 --- madwifi-ng-refcount-r2313-20070505.old/ath/if_ath.c 2007-05-13 18:17:56.362000712 +0200
73 +++ madwifi-ng-refcount-r2313-20070505.dev/ath/if_ath.c 2007-05-13 18:17:56.371999192 +0200
75 DPRINTF(sc,ATH_DEBUG_XMIT, \
76 "%s: discard, no xmit buf\n", __func__); \
77 sc->sc_stats.ast_tx_nobuf++; \
78 + goto hardstart_fail; \
82 @@ -2676,14 +2677,13 @@
83 else if (an->an_tx_ffbuf[skb->priority]) {
84 DPRINTF(sc, ATH_DEBUG_XMIT | ATH_DEBUG_FF,
85 "%s: Out-Of-Order fast-frame\n", __func__);
86 - ATH_TXQ_UNLOCK(txq);
87 + ATH_TXQ_UNLOCK_BH(txq);
89 - ATH_TXQ_UNLOCK(txq);
90 + ATH_TXQ_UNLOCK_BH(txq);
93 ATH_HARDSTART_GET_TX_BUF_WITH_LOCK;
95 - goto hardstart_fail;
96 + ATH_HARDSTART_REL_TX_BUF_WITH_TXQLOCK_OFF;
100 @@ -5668,6 +5668,7 @@
101 sc->sc_stats.ast_rx_phyerr++;
102 phyerr = ds->ds_rxstat.rs_phyerr & 0x1f;
103 sc->sc_stats.ast_rx_phy[phyerr]++;
106 if (ds->ds_rxstat.rs_status & HAL_RXERR_DECRYPT) {
108 @@ -7662,6 +7663,7 @@
109 ath_draintxq(struct ath_softc *sc)
111 struct ath_hal *ah = sc->sc_ah;
115 /* XXX return value */
116 @@ -7670,9 +7672,24 @@
117 DPRINTF(sc, ATH_DEBUG_RESET, "%s: beacon queue 0x%x\n",
118 __func__, ath_hal_gettxbuf(ah, sc->sc_bhalq));
119 for (i = 0; i < HAL_NUM_TX_QUEUES; i++)
120 - if (ATH_TXQ_SETUP(sc, i))
121 + if (ATH_TXQ_SETUP(sc, i)) {
122 ath_tx_stopdma(sc, &sc->sc_txq[i]);
124 + /* The TxDMA may not really be stopped.
125 + * Double check the hal tx pending count */
126 + npend += ath_hal_numtxpending(ah, sc->sc_txq[i].axq_qnum);
133 + /* TxDMA not stopped, reset the hal */
134 + DPRINTF(sc, ATH_DEBUG_RESET, "%s: Unable to stop TxDMA. Reset HAL!\n", __func__);
135 + if (!ath_hal_reset(ah, sc->sc_ic.ic_opmode, &sc->sc_curchan, AH_TRUE, &status))
136 + printk("%s: unable to reset hardware; hal status %u\n", __func__, status);
139 sc->sc_dev->trans_start = jiffies;
140 netif_start_queue(sc->sc_dev); /* XXX move to callers */
141 for (i = 0; i < HAL_NUM_TX_QUEUES; i++)