commit 99200dfda61a570a57514443ead80093dfb0da24 Author: Jiri Slaby Date: Sat Jul 14 13:33:25 2007 +0200 implement reset diff --git a/ath/if_ath.c b/ath/if_ath.c index 0ba0492..794df8a 100644 --- a/ath/if_ath.c +++ b/ath/if_ath.c @@ -193,64 +193,6 @@ ath_bmiss_tasklet(unsigned long data) #endif } -/* - * Reset the hardware w/o losing operational state. This is - * basically a more efficient way of doing ath_stop, ath_init, - * followed by state transitions to the current 802.11 - * operational state. Used to recover from various errors and - * to reset or reload hardware state. - */ -static int -ath_reset(struct ieee80211_hw *hw) -{ -#ifdef BLE - struct ath_softc *sc = hw->priv; - struct ath_hal *ah = sc->sc_ah; - struct ieee80211_channel *c; - enum ath5k_status status; - int opmode; - - DPRINTF(sc, ATH_DEBUG_RESET, "%s: resetting\n", dev->name); - /* - * Convert to a HAL channel description with the flags - * constrained to reflect the current operating mode. - */ - c = ic->ic_ibss_chan; - sc->sc_curchan.freq = c->ic_freq; - sc->sc_curchan.channel_flags = ath_chan2flags(ic, c); - - ath5k_hw_set_intr(ah, 0); /* disable interrupts */ - ath_draintxq(sc); /* stop xmit side */ - ath_stoprecv(sc); /* stop recv side */ - - opmode = (ic->ic_opmode == IEEE80211_M_AHDEMO) ? 0 : ic->ic_opmode; - /* NB: indicate channel change so we do a full reset */ - if (!ath5k_hw_reset(ah, opmode, &sc->sc_curchan, true, &status)) - if_printf(dev, "%s: unable to reset hardware: '%s' (%u)\n", - __func__, hal_status_desc[status], status); - ath_update_txpow(sc); /* update tx power state */ - sc->sc_diversity = ath_hal_getdiversity(ah); /*get diversity status*/ - if (ath_startrecv(sc) != 0) /* restart recv */ - if_printf(dev, "%s: unable to start recv logic\n", __func__); - /* - * We may be doing a reset in response to an ioctl - * that changes the channel so update any state that - * might change as a result. - */ - ath_chan_change(sc, c); - if (ic->ic_state == IEEE80211_S_RUN) - ath_beacon_config(sc); /* restart beacons */ - ath5k_hw_set_intr(ah, sc->sc_imask); - - if (ic->ic_state == IEEE80211_S_RUN) - netif_wake_queue(dev); /* restart xmit */ - - if (sc->sc_rawdev_enabled) - netif_wake_queue(&sc->sc_rawdev); -#endif - return 0; -} - #define NUM_RADIOTAP_ELEMENTS 18 diff --git a/ath/if_ath_pci.c b/ath/if_ath_pci.c index 91e884f..d877636 100644 --- a/ath/if_ath_pci.c +++ b/ath/if_ath_pci.c @@ -982,6 +982,50 @@ static int ath_tx(struct ieee80211_hw *hw, struct sk_buff *skb, return 0; } +static int ath_reset(struct ieee80211_hw *hw) +{ + struct ath_softc *sc = hw->priv; + struct ath_hw *ah = sc->ah; + int ret; + + DPRINTF(sc, ATH_DEBUG_RESET, "resetting\n"); + /* + * Convert to a HAL channel description with the flags + * constrained to reflect the current operating mode. + */ + sc->curchan = hw->conf.chan; + + ath5k_hw_set_intr(ah, 0); + ath_draintxq(sc); + ath_stoprecv(sc); + + ret = ath5k_hw_reset(ah, IEEE80211_IF_TYPE_STA, sc->curchan, true); + if (ret) { + printk(KERN_ERR "ath: can't reset hardware (%d)\n", ret); + goto err; + } + ath_update_txpow(sc); + + ret = ath_startrecv(sc); + if (ret) { + printk(KERN_ERR "ath: can't start recv logic\n"); + goto err; + } + /* + * We may be doing a reset in response to an ioctl + * that changes the channel so update any state that + * might change as a result. + */ +// ath_chan_change(sc, c); + ath5k_hw_set_intr(ah, sc->imask); + + ieee80211_wake_queues(hw); + + return 0; +err: + return ret; +} + static int ath_open(struct ieee80211_hw *hw) { return ath_init(hw->priv); @@ -1051,13 +1095,13 @@ unlock: static struct ieee80211_ops ath_hw_ops = { .tx = ath_tx, - .reset = NULL, + .reset = ath_reset, .open = ath_open, .stop = ath_stop, .add_interface = NULL, .remove_interface = NULL, .config = ath_config, -/* .config_interface = ,*/ + .config_interface = NULL, .set_key = ath_set_key, /* .get_stats = , .conf_tx = ,