···6060#include "reg.h"6161#include "debug.h"6262#include "ani.h"6363-#include "../debug.h"64636564static int modparam_nohwcrypt;6665module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);···7576MODULE_DESCRIPTION("Support for 5xxx series of Atheros 802.11 wireless LAN cards.");7677MODULE_SUPPORTED_DEVICE("Atheros 5xxx WLAN cards");7778MODULE_LICENSE("Dual BSD/GPL");7878-MODULE_VERSION("0.6.0 (EXPERIMENTAL)");79798080static int ath5k_init(struct ieee80211_hw *hw);8181static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,···18791881 sc->bmisscount = 0;18801882 }1881188318821882- if (sc->opmode == NL80211_IFTYPE_AP && sc->num_ap_vifs > 1) {18841884+ if ((sc->opmode == NL80211_IFTYPE_AP && sc->num_ap_vifs > 1) ||18851885+ sc->opmode == NL80211_IFTYPE_MESH_POINT) {18831886 u64 tsf = ath5k_hw_get_tsf64(ah);18841887 u32 tsftu = TSF_TO_TU(tsf);18851888 int slot = ((tsftu % sc->bintval) * ATH_BCBUF) / sc->bintval;···19121913 /* NB: hw still stops DMA, so proceed */19131914 }1914191519151915- /* refresh the beacon for AP mode */19161916- if (sc->opmode == NL80211_IFTYPE_AP)19161916+ /* refresh the beacon for AP or MESH mode */19171917+ if (sc->opmode == NL80211_IFTYPE_AP ||19181918+ sc->opmode == NL80211_IFTYPE_MESH_POINT)19171919 ath5k_beacon_update(sc->hw, vif);1918192019191921 ath5k_hw_set_txdp(ah, sc->bhalq, bf->daddr);···23412341 /* Initialize driver private data */23422342 SET_IEEE80211_DEV(hw, sc->dev);23432343 hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |23442344- IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |23452345- IEEE80211_HW_SIGNAL_DBM;23442344+ IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |23452345+ IEEE80211_HW_SIGNAL_DBM |23462346+ IEEE80211_HW_REPORTS_TX_ACK_STATUS;2346234723472348 hw->wiphy->interface_modes =23482349 BIT(NL80211_IFTYPE_AP) |···26542653 bool skip_pcu)26552654{26562655 struct ath5k_hw *ah = sc->ah;26572657- int ret;26562656+ int ret, ani_mode;2658265726592658 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n");26602659···26622661 synchronize_irq(sc->irq);26632662 stop_tasklets(sc);2664266326652665- if (chan) {26662666- ath5k_drain_tx_buffs(sc);26642664+ /* Save ani mode and disable ANI durring26652665+ * reset. If we don't we might get false26662666+ * PHY error interrupts. */26672667+ ani_mode = ah->ah_sc->ani_state.ani_mode;26682668+ ath5k_ani_init(ah, ATH5K_ANI_MODE_OFF);2667266926702670+ /* We are going to empty hw queues26712671+ * so we should also free any remaining26722672+ * tx buffers */26732673+ ath5k_drain_tx_buffs(sc);26742674+ if (chan) {26682675 sc->curchan = chan;26692676 sc->curband = &sc->sbands[chan->band];26702677 }···26892680 goto err;26902681 }2691268226922692- ath5k_ani_init(ah, ah->ah_sc->ani_state.ani_mode);26832683+ ath5k_ani_init(ah, ani_mode);2693268426942685 ah->ah_cal_next_full = jiffies;26952686 ah->ah_cal_next_ani = jiffies;26962687 ah->ah_cal_next_nf = jiffies;26972697- ewma_init(&ah->ah_beacon_rssi_avg, 1000, 8);26882688+ ewma_init(&ah->ah_beacon_rssi_avg, 1024, 8);2698268926992690 /*27002691 * Change channels and update the h/w rate map if we're switching;···27992790 goto err_bhal;28002791 }2801279228022802- /* This order matches mac80211's queue priority, so we can28032803- * directly use the mac80211 queue number without any mapping */28042804- txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VO);28052805- if (IS_ERR(txq)) {28062806- ATH5K_ERR(sc, "can't setup xmit queue\n");28072807- ret = PTR_ERR(txq);28082808- goto err_queues;27932793+ /* 5211 and 5212 usually support 10 queues but we better rely on the27942794+ * capability information */27952795+ if (ah->ah_capabilities.cap_queues.q_tx_num >= 6) {27962796+ /* This order matches mac80211's queue priority, so we can27972797+ * directly use the mac80211 queue number without any mapping */27982798+ txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VO);27992799+ if (IS_ERR(txq)) {28002800+ ATH5K_ERR(sc, "can't setup xmit queue\n");28012801+ ret = PTR_ERR(txq);28022802+ goto err_queues;28032803+ }28042804+ txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VI);28052805+ if (IS_ERR(txq)) {28062806+ ATH5K_ERR(sc, "can't setup xmit queue\n");28072807+ ret = PTR_ERR(txq);28082808+ goto err_queues;28092809+ }28102810+ txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BE);28112811+ if (IS_ERR(txq)) {28122812+ ATH5K_ERR(sc, "can't setup xmit queue\n");28132813+ ret = PTR_ERR(txq);28142814+ goto err_queues;28152815+ }28162816+ txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BK);28172817+ if (IS_ERR(txq)) {28182818+ ATH5K_ERR(sc, "can't setup xmit queue\n");28192819+ ret = PTR_ERR(txq);28202820+ goto err_queues;28212821+ }28222822+ hw->queues = 4;28232823+ } else {28242824+ /* older hardware (5210) can only support one data queue */28252825+ txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BE);28262826+ if (IS_ERR(txq)) {28272827+ ATH5K_ERR(sc, "can't setup xmit queue\n");28282828+ ret = PTR_ERR(txq);28292829+ goto err_queues;28302830+ }28312831+ hw->queues = 1;28092832 }28102810- txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VI);28112811- if (IS_ERR(txq)) {28122812- ATH5K_ERR(sc, "can't setup xmit queue\n");28132813- ret = PTR_ERR(txq);28142814- goto err_queues;28152815- }28162816- txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BE);28172817- if (IS_ERR(txq)) {28182818- ATH5K_ERR(sc, "can't setup xmit queue\n");28192819- ret = PTR_ERR(txq);28202820- goto err_queues;28212821- }28222822- txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BK);28232823- if (IS_ERR(txq)) {28242824- ATH5K_ERR(sc, "can't setup xmit queue\n");28252825- ret = PTR_ERR(txq);28262826- goto err_queues;28272827- }28282828- hw->queues = 4;2829283328302834 tasklet_init(&sc->rxtq, ath5k_tasklet_rx, (unsigned long)sc);28312835 tasklet_init(&sc->txtq, ath5k_tasklet_tx, (unsigned long)sc);···2999297730002978 /* Assign the vap/adhoc to a beacon xmit slot. */30012979 if ((avf->opmode == NL80211_IFTYPE_AP) ||30023002- (avf->opmode == NL80211_IFTYPE_ADHOC)) {29802980+ (avf->opmode == NL80211_IFTYPE_ADHOC) ||29812981+ (avf->opmode == NL80211_IFTYPE_MESH_POINT)) {30032982 int slot;3004298330052984 WARN_ON(list_empty(&sc->bcbuf));···30192996 sc->bslot[avf->bslot] = vif;30202997 if (avf->opmode == NL80211_IFTYPE_AP)30212998 sc->num_ap_vifs++;30223022- else29992999+ else if (avf->opmode == NL80211_IFTYPE_ADHOC)30233000 sc->num_adhoc_vifs++;30243001 }30253002
-1
drivers/net/wireless/ath/ath5k/debug.c
···60606161#include "base.h"6262#include "debug.h"6363-#include "../debug.h"64636564static unsigned int ath5k_debug;6665module_param_named(debug, ath5k_debug, uint, 0);
+1-1
drivers/net/wireless/ath/ath5k/dma.c
···7272 i--)7373 udelay(100);74747575- if (i)7575+ if (!i)7676 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA,7777 "failed to stop RX DMA !\n");7878
+1
drivers/net/wireless/ath/ath5k/pci.c
···4545 { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */4646 { 0 }4747};4848+MODULE_DEVICE_TABLE(pci, ath5k_pci_id_table);48494950/* return bus cachesize in 4B word units */5051static void ath5k_pci_read_cachesize(struct ath_common *common, int *csz)
+21-12
drivers/net/wireless/ath/ath5k/phy.c
···2742274227432743/* Write PDADC values on hw */27442744static void27452745-ath5k_setup_pwr_to_pdadc_table(struct ath5k_hw *ah,27462746- u8 pdcurves, u8 *pdg_to_idx)27452745+ath5k_setup_pwr_to_pdadc_table(struct ath5k_hw *ah, u8 ee_mode)27472746{27472747+ struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;27482748 u8 *pdadc_out = ah->ah_txpower.txp_pd_table;27492749+ u8 *pdg_to_idx = ee->ee_pdc_to_idx[ee_mode];27502750+ u8 pdcurves = ee->ee_pd_gains[ee_mode];27492751 u32 reg;27502752 u8 i;27512753···29942992 ee->ee_pd_gains[ee_mode]);2995299329962994 /* Write settings on hw */29972997- ath5k_setup_pwr_to_pdadc_table(ah, pdg, pdg_curve_to_idx);29952995+ ath5k_setup_pwr_to_pdadc_table(ah, ee_mode);2998299629992997 /* Set txp.offset, note that table_min30002998 * can be negative */···31163114 return -EINVAL;31173115 }3118311631193119- /* Reset TX power values */31203120- memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));31213121- ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;31223122- ah->ah_txpower.txp_min_pwr = 0;31233123- ah->ah_txpower.txp_max_pwr = AR5K_TUNE_MAX_TXPOWER;31243124-31253117 /* Initialize TX power table */31263118 switch (ah->ah_radio) {31273119 case AR5K_RF5110:···31423146 * so there is no need to recalculate the powertable, we 'll31433147 * just use the cached one */31443148 if (!fast) {31493149+ /* Reset TX power values */31503150+ memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));31513151+ ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;31523152+ ah->ah_txpower.txp_min_pwr = 0;31533153+ ah->ah_txpower.txp_max_pwr = AR5K_TUNE_MAX_TXPOWER;31543154+31553155+ /* Calculate the powertable */31453156 ret = ath5k_setup_channel_powertable(ah, channel,31463157 ee_mode, type);31473147- if (ret)31483148- return ret;31493149- }31583158+ if (ret)31593159+ return ret;31603160+ /* Write cached table on hw */31613161+ } else if (type == AR5K_PWRTABLE_PWR_TO_PDADC)31623162+ ath5k_setup_pwr_to_pdadc_table(ah, ee_mode);31633163+ else31643164+ ath5k_setup_pcdac_table(ah);31653165+31663166+3150316731513168 /* Limit max power if we have a CTL available */31523169 ath5k_get_max_ctl_power(ah, channel);
+2-2
drivers/net/wireless/ath/ath5k/qcu.c
···152152 /*153153 * Get queue by type154154 */155155- /*5210 only has 2 queues*/156156- if (ah->ah_version == AR5K_AR5210) {155155+ /* 5210 only has 2 queues */156156+ if (ah->ah_capabilities.cap_queues.q_tx_num == 2) {157157 switch (queue_type) {158158 case AR5K_TX_QUEUE_DATA:159159 queue = AR5K_TX_QUEUE_ID_NOQCU_DATA;
+3-4
drivers/net/wireless/ath/ath9k/ahb.c
···35353636 pdata = (struct ath9k_platform_data *) pdev->dev.platform_data;3737 if (off >= (ARRAY_SIZE(pdata->eeprom_data))) {3838- ath_print(common, ATH_DBG_FATAL,3939- "%s: flash read failed, offset %08x "4040- "is out of range\n",4141- __func__, off);3838+ ath_err(common,3939+ "%s: flash read failed, offset %08x is out of range\n",4040+ __func__, off);4241 return false;4342 }4443
···11-/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.33- *44- * Permission to use, copy, modify, and/or distribute this software for any55- * purpose with or without fee is hereby granted, provided that the above66- * copyright notice and this permission notice appear in all copies.77- *88- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES99- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF1010- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR1111- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES1212- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN1313- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF1414- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.1515- */1616-1717-#ifndef ATH_DEBUG_H1818-#define ATH_DEBUG_H1919-2020-#include "ath.h"2121-2222-/**2323- * enum ath_debug_level - atheros wireless debug level2424- *2525- * @ATH_DBG_RESET: reset processing2626- * @ATH_DBG_QUEUE: hardware queue management2727- * @ATH_DBG_EEPROM: eeprom processing2828- * @ATH_DBG_CALIBRATE: periodic calibration2929- * @ATH_DBG_INTERRUPT: interrupt processing3030- * @ATH_DBG_REGULATORY: regulatory processing3131- * @ATH_DBG_ANI: adaptive noise immunitive processing3232- * @ATH_DBG_XMIT: basic xmit operation3333- * @ATH_DBG_BEACON: beacon handling3434- * @ATH_DBG_CONFIG: configuration of the hardware3535- * @ATH_DBG_FATAL: fatal errors, this is the default, DBG_DEFAULT3636- * @ATH_DBG_PS: power save processing3737- * @ATH_DBG_HWTIMER: hardware timer handling3838- * @ATH_DBG_BTCOEX: bluetooth coexistance3939- * @ATH_DBG_BSTUCK: stuck beacons4040- * @ATH_DBG_ANY: enable all debugging4141- *4242- * The debug level is used to control the amount and type of debugging output4343- * we want to see. Each driver has its own method for enabling debugging and4444- * modifying debug level states -- but this is typically done through a4545- * module parameter 'debug' along with a respective 'debug' debugfs file4646- * entry.4747- */4848-enum ATH_DEBUG {4949- ATH_DBG_RESET = 0x00000001,5050- ATH_DBG_QUEUE = 0x00000002,5151- ATH_DBG_EEPROM = 0x00000004,5252- ATH_DBG_CALIBRATE = 0x00000008,5353- ATH_DBG_INTERRUPT = 0x00000010,5454- ATH_DBG_REGULATORY = 0x00000020,5555- ATH_DBG_ANI = 0x00000040,5656- ATH_DBG_XMIT = 0x00000080,5757- ATH_DBG_BEACON = 0x00000100,5858- ATH_DBG_CONFIG = 0x00000200,5959- ATH_DBG_FATAL = 0x00000400,6060- ATH_DBG_PS = 0x00000800,6161- ATH_DBG_HWTIMER = 0x00001000,6262- ATH_DBG_BTCOEX = 0x00002000,6363- ATH_DBG_WMI = 0x00004000,6464- ATH_DBG_BSTUCK = 0x00008000,6565- ATH_DBG_ANY = 0xffffffff6666-};6767-6868-#define ATH_DBG_DEFAULT (ATH_DBG_FATAL)6969-7070-#ifdef CONFIG_ATH_DEBUG7171-void ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)7272- __attribute__ ((format (printf, 3, 4)));7373-#define ATH_DBG_WARN(foo, arg...) WARN(foo, arg)7474-#else7575-static inline void __attribute__ ((format (printf, 3, 4)))7676-ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)7777-{7878-}7979-#define ATH_DBG_WARN(foo, arg)8080-#endif /* CONFIG_ATH_DEBUG */8181-8282-/** Returns string describing opmode, or NULL if unknown mode. */8383-#ifdef CONFIG_ATH_DEBUG8484-const char *ath_opmode_to_string(enum nl80211_iftype opmode);8585-#else8686-static inline const char *ath_opmode_to_string(enum nl80211_iftype opmode)8787-{8888- return "UNKNOWN";8989-}9090-#endif9191-9292-#endif /* ATH_DEBUG_H */
+11-17
drivers/net/wireless/ath/key.c
···20202121#include "ath.h"2222#include "reg.h"2323-#include "debug.h"24232524#define REG_READ (common->ops->read)2625#define REG_WRITE(_ah, _reg, _val) (common->ops->write)(_ah, _val, _reg)···3637 void *ah = common->ah;37383839 if (entry >= common->keymax) {3939- ath_print(common, ATH_DBG_FATAL,4040- "keychache entry %u out of range\n", entry);4040+ ath_err(common, "keycache entry %u out of range\n", entry);4141 return false;4242 }4343···7375 void *ah = common->ah;74767577 if (entry >= common->keymax) {7676- ath_print(common, ATH_DBG_FATAL,7777- "keychache entry %u out of range\n", entry);7878+ ath_err(common, "keycache entry %u out of range\n", entry);7879 return false;7980 }8081···114117 u32 keyType;115118116119 if (entry >= common->keymax) {117117- ath_print(common, ATH_DBG_FATAL,118118- "keycache entry %u out of range\n", entry);120120+ ath_err(common, "keycache entry %u out of range\n", entry);119121 return false;120122 }121123···124128 break;125129 case ATH_CIPHER_AES_CCM:126130 if (!(common->crypt_caps & ATH_CRYPT_CAP_CIPHER_AESCCM)) {127127- ath_print(common, ATH_DBG_ANY,128128- "AES-CCM not supported by this mac rev\n");131131+ ath_dbg(common, ATH_DBG_ANY,132132+ "AES-CCM not supported by this mac rev\n");129133 return false;130134 }131135 keyType = AR_KEYTABLE_TYPE_CCM;···133137 case ATH_CIPHER_TKIP:134138 keyType = AR_KEYTABLE_TYPE_TKIP;135139 if (entry + 64 >= common->keymax) {136136- ath_print(common, ATH_DBG_ANY,137137- "entry %u inappropriate for TKIP\n", entry);140140+ ath_dbg(common, ATH_DBG_ANY,141141+ "entry %u inappropriate for TKIP\n", entry);138142 return false;139143 }140144 break;141145 case ATH_CIPHER_WEP:142146 if (k->kv_len < WLAN_KEY_LEN_WEP40) {143143- ath_print(common, ATH_DBG_ANY,144144- "WEP key length %u too small\n", k->kv_len);147147+ ath_dbg(common, ATH_DBG_ANY,148148+ "WEP key length %u too small\n", k->kv_len);145149 return false;146150 }147151 if (k->kv_len <= WLAN_KEY_LEN_WEP40)···155159 keyType = AR_KEYTABLE_TYPE_CLR;156160 break;157161 default:158158- ath_print(common, ATH_DBG_FATAL,159159- "cipher %u not supported\n", k->kv_type);162162+ ath_err(common, "cipher %u not supported\n", k->kv_type);160163 return false;161164 }162165···336341 memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic));337342 if (!ath_hw_set_keycache_entry(common, keyix, hk, NULL)) {338343 /* TX MIC entry failed. No need to proceed further */339339- ath_print(common, ATH_DBG_FATAL,340340- "Setting TX MIC Key Failed\n");344344+ ath_err(common, "Setting TX MIC Key Failed\n");341345 return 0;342346 }343347
···8686 select SSB_BLOCKIO8787 default y88888989-config B43_NPHY9090- bool "Pre IEEE 802.11n support (BROKEN)"9191- depends on B43 && EXPERIMENTAL && BROKEN8989+config B43_PHY_N9090+ bool "Support for 802.11n (N-PHY) devices (EXPERIMENTAL)"9191+ depends on B43 && EXPERIMENTAL9292 ---help---9393- Support for the IEEE 802.11n draft.9393+ Support for the N-PHY.94949595- THIS IS BROKEN AND DOES NOT WORK YET.9595+ This enables support for devices with N-PHY revision up to 2.96969797- SAY N.9797+ Say N if you expect high stability and performance. Saying Y will not9898+ affect other devices support and may provide support for basic needs.989999100config B43_PHY_LP100101 bool "Support for low-power (LP-PHY) devices (EXPERIMENTAL)"
···18941894}18951895EXPORT_SYMBOL(iwl_mac_change_interface);1896189618971897-/**18981898- * iwl_bg_monitor_recover - Timer callback to check for stuck queue and recover18991899- *19001900- * During normal condition (no queue is stuck), the timer is continually set to19011901- * execute every monitor_recover_period milliseconds after the last timer19021902- * expired. When the queue read_ptr is at the same place, the timer is19031903- * shorten to 100mSecs. This is19041904- * 1) to reduce the chance that the read_ptr may wrap around (not stuck)19051905- * 2) to detect the stuck queues quicker before the station and AP can19061906- * disassociate each other.19071907- *19081908- * This function monitors all the tx queues and recover from it if any19091909- * of the queues are stuck.19101910- * 1. It first check the cmd queue for stuck conditions. If it is stuck,19111911- * it will recover by resetting the firmware and return.19121912- * 2. Then, it checks for station association. If it associates it will check19131913- * other queues. If any queue is stuck, it will recover by resetting19141914- * the firmware.19151915- * Note: It the number of times the queue read_ptr to be at the same place to19161916- * be MAX_REPEAT+1 in order to consider to be stuck.19171917- */19181897/*19191919- * The maximum number of times the read pointer of the tx queue at the19201920- * same place without considering to be stuck.18981898+ * On every watchdog tick we check (latest) time stamp. If it does not18991899+ * change during timeout period and queue is not empty we reset firmware.19211900 */19221922-#define MAX_REPEAT (2)19231901static int iwl_check_stuck_queue(struct iwl_priv *priv, int cnt)19241902{19251925- struct iwl_tx_queue *txq;19261926- struct iwl_queue *q;19031903+ struct iwl_tx_queue *txq = &priv->txq[cnt];19041904+ struct iwl_queue *q = &txq->q;19051905+ unsigned long timeout;19061906+ int ret;1927190719281928- txq = &priv->txq[cnt];19291929- q = &txq->q;19301930- /* queue is empty, skip */19311931- if (q->read_ptr == q->write_ptr)19081908+ if (q->read_ptr == q->write_ptr) {19091909+ txq->time_stamp = jiffies;19321910 return 0;19331933-19341934- if (q->read_ptr == q->last_read_ptr) {19351935- /* a queue has not been read from last time */19361936- if (q->repeat_same_read_ptr > MAX_REPEAT) {19371937- IWL_ERR(priv,19381938- "queue %d stuck %d time. Fw reload.\n",19391939- q->id, q->repeat_same_read_ptr);19401940- q->repeat_same_read_ptr = 0;19411941- iwl_force_reset(priv, IWL_FW_RESET, false);19421942- } else {19431943- q->repeat_same_read_ptr++;19441944- IWL_DEBUG_RADIO(priv,19451945- "queue %d, not read %d time\n",19461946- q->id,19471947- q->repeat_same_read_ptr);19481948- mod_timer(&priv->monitor_recover,19491949- jiffies + msecs_to_jiffies(19501950- IWL_ONE_HUNDRED_MSECS));19511951- return 1;19521952- }19531953- } else {19541954- q->last_read_ptr = q->read_ptr;19551955- q->repeat_same_read_ptr = 0;19561911 }19121912+19131913+ timeout = txq->time_stamp +19141914+ msecs_to_jiffies(priv->cfg->base_params->wd_timeout);19151915+19161916+ if (time_after(jiffies, timeout)) {19171917+ IWL_ERR(priv, "Queue %d stuck for %u ms.\n",19181918+ q->id, priv->cfg->base_params->wd_timeout);19191919+ ret = iwl_force_reset(priv, IWL_FW_RESET, false);19201920+ return (ret == -EAGAIN) ? 0 : 1;19211921+ }19221922+19571923 return 0;19581924}1959192519601960-void iwl_bg_monitor_recover(unsigned long data)19261926+/*19271927+ * Making watchdog tick be a quarter of timeout assure we will19281928+ * discover the queue hung between timeout and 1.25*timeout19291929+ */19301930+#define IWL_WD_TICK(timeout) ((timeout) / 4)19311931+19321932+/*19331933+ * Watchdog timer callback, we check each tx queue for stuck, if if hung19341934+ * we reset the firmware. If everything is fine just rearm the timer.19351935+ */19361936+void iwl_bg_watchdog(unsigned long data)19611937{19621938 struct iwl_priv *priv = (struct iwl_priv *)data;19631939 int cnt;19401940+ unsigned long timeout;1964194119651942 if (test_bit(STATUS_EXIT_PENDING, &priv->status))19431943+ return;19441944+19451945+ timeout = priv->cfg->base_params->wd_timeout;19461946+ if (timeout == 0)19661947 return;1967194819681949 /* monitor and check for stuck cmd queue */···19601979 return;19611980 }19621981 }19631963- if (priv->cfg->base_params->monitor_recover_period) {19641964- /*19651965- * Reschedule the timer to occur in19661966- * priv->cfg->base_params->monitor_recover_period19671967- */19681968- mod_timer(&priv->monitor_recover, jiffies + msecs_to_jiffies(19691969- priv->cfg->base_params->monitor_recover_period));19701970- }19711971-}19721972-EXPORT_SYMBOL(iwl_bg_monitor_recover);1973198219831983+ mod_timer(&priv->watchdog, jiffies +19841984+ msecs_to_jiffies(IWL_WD_TICK(timeout)));19851985+}19861986+EXPORT_SYMBOL(iwl_bg_watchdog);19871987+19881988+void iwl_setup_watchdog(struct iwl_priv *priv)19891989+{19901990+ unsigned int timeout = priv->cfg->base_params->wd_timeout;19911991+19921992+ if (timeout)19931993+ mod_timer(&priv->watchdog,19941994+ jiffies + msecs_to_jiffies(IWL_WD_TICK(timeout)));19951995+ else19961996+ del_timer(&priv->watchdog);19971997+}19981998+EXPORT_SYMBOL(iwl_setup_watchdog);1974199919752000/*19762001 * extended beacon time format
+4-6
drivers/net/wireless/iwlwifi/iwl-core.h
···210210211211 /* temperature */212212 struct iwl_temp_ops temp_ops;213213- /* recover from tx queue stall */214214- void (*recover_from_tx_stall)(unsigned long data);215213 /* check for plcp health */216214 bool (*check_plcp_health)(struct iwl_priv *priv,217215 struct iwl_rx_packet *pkt);···278280 * @plcp_delta_threshold: plcp error rate threshold used to trigger279281 * radio tuning when there is a high receiving plcp error rate280282 * @chain_noise_scale: default chain noise scale used for gain computation281281- * @monitor_recover_period: default timer used to check stuck queues283283+ * @wd_timeout: TX queues watchdog timeout282284 * @temperature_kelvin: temperature report by uCode in kelvin283285 * @max_event_log_size: size of event log buffer size for ucode event logging284286 * @tx_power_by_driver: tx power calibration performed by driver···313315 const bool support_wimax_coexist;314316 u8 plcp_delta_threshold;315317 s32 chain_noise_scale;316316- /* timer period for monitor the driver queues */317317- u32 monitor_recover_period;318318+ unsigned int wd_timeout;318319 bool temperature_kelvin;319320 u32 max_event_log_size;320321 const bool tx_power_by_driver;···543546void iwl_tx_queue_reset(struct iwl_priv *priv, struct iwl_tx_queue *txq,544547 int slots_num, u32 txq_id);545548void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id);549549+void iwl_setup_watchdog(struct iwl_priv *priv);546550/*****************************************************547551 * TX power548552 ****************************************************/···623625 return pci_lnk_ctl;624626}625627626626-void iwl_bg_monitor_recover(unsigned long data);628628+void iwl_bg_watchdog(unsigned long data);627629u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval);628630__le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,629631 u32 addon, u32 beacon_interval);
···25092509 /* After the ALIVE response, we can send commands to 3945 uCode */25102510 set_bit(STATUS_ALIVE, &priv->status);2511251125122512- if (priv->cfg->ops->lib->recover_from_tx_stall) {25132513- /* Enable timer to monitor the driver queues */25142514- mod_timer(&priv->monitor_recover,25152515- jiffies +25162516- msecs_to_jiffies(25172517- priv->cfg->base_params->monitor_recover_period));25182518- }25122512+ /* Enable watchdog to monitor the driver tx queues */25132513+ iwl_setup_watchdog(priv);2519251425202515 if (iwl_is_rfkill(priv))25212516 return;···2567257225682573 /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set25692574 * to prevent rearm timer */25702570- if (priv->cfg->ops->lib->recover_from_tx_stall)25712571- del_timer_sync(&priv->monitor_recover);25752575+ del_timer_sync(&priv->watchdog);2572257625732577 /* Station information will now be cleared in device */25742578 iwl_clear_ucode_stations(priv, NULL);···3769377537703776 iwl3945_hw_setup_deferred_work(priv);3771377737723772- if (priv->cfg->ops->lib->recover_from_tx_stall) {37733773- init_timer(&priv->monitor_recover);37743774- priv->monitor_recover.data = (unsigned long)priv;37753775- priv->monitor_recover.function =37763776- priv->cfg->ops->lib->recover_from_tx_stall;37773777- }37783778+ init_timer(&priv->watchdog);37793779+ priv->watchdog.data = (unsigned long)priv;37803780+ priv->watchdog.function = iwl_bg_watchdog;3778378137793782 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))37803783 iwl3945_irq_tasklet, (unsigned long)priv);···3851386038523861 priv->iw_mode = NL80211_IFTYPE_STATION;38533862 priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF;38633863+38643864+ /* initialize force reset */38653865+ priv->force_reset[IWL_RF_RESET].reset_duration =38663866+ IWL_DELAY_NEXT_FORCE_RF_RESET;38673867+ priv->force_reset[IWL_FW_RESET].reset_duration =38683868+ IWL_DELAY_NEXT_FORCE_FW_RELOAD;38693869+3854387038553871 priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER;38563872 priv->tx_power_next = IWL_DEFAULT_TX_POWER;
+6
drivers/net/wireless/orinoco/main.c
···18111811 struct net_device *dev = priv->ndev;18121812 int err = 0;1813181318141814+ /* If we've called commit, we are reconfiguring or bringing the18151815+ * interface up. Maintaining countermeasures across this would18161816+ * be confusing, so note that we've disabled them. The port will18171817+ * be enabled later in orinoco_commit or __orinoco_up. */18181818+ priv->tkip_cm_active = 0;18191819+18141820 err = orinoco_hw_program_rids(priv);1815182118161822 /* FIXME: what about netif_tx_lock */
+7-7
drivers/net/wireless/orinoco/orinoco_cs.c
···151151 goto failed;152152 }153153154154- ret = pcmcia_request_irq(link, orinoco_interrupt);155155- if (ret)156156- goto failed;157157-158158- /* We initialize the hermes structure before completing PCMCIA159159- * configuration just in case the interrupt handler gets160160- * called. */161154 mem = ioport_map(link->resource[0]->start,162155 resource_size(link->resource[0]));163156 if (!mem)164157 goto failed;165158159159+ /* We initialize the hermes structure before completing PCMCIA160160+ * configuration just in case the interrupt handler gets161161+ * called. */166162 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);163163+164164+ ret = pcmcia_request_irq(link, orinoco_interrupt);165165+ if (ret)166166+ goto failed;167167168168 ret = pcmcia_enable_device(link);169169 if (ret)
+7-7
drivers/net/wireless/orinoco/spectrum_cs.c
···214214 goto failed;215215 }216216217217- ret = pcmcia_request_irq(link, orinoco_interrupt);218218- if (ret)219219- goto failed;220220-221221- /* We initialize the hermes structure before completing PCMCIA222222- * configuration just in case the interrupt handler gets223223- * called. */224217 mem = ioport_map(link->resource[0]->start,225218 resource_size(link->resource[0]));226219 if (!mem)227220 goto failed;228221222222+ /* We initialize the hermes structure before completing PCMCIA223223+ * configuration just in case the interrupt handler gets224224+ * called. */229225 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);230226 hw->eeprom_pda = true;227227+228228+ ret = pcmcia_request_irq(link, orinoco_interrupt);229229+ if (ret)230230+ goto failed;231231232232 ret = pcmcia_enable_device(link);233233 if (ret)
+10-2
drivers/net/wireless/orinoco/wext.c
···893893 */894894 break;895895896896+ case IW_AUTH_MFP:897897+ /* Management Frame Protection not supported.898898+ * Only fail if set to required.899899+ */900900+ if (param->value == IW_AUTH_MFP_REQUIRED)901901+ ret = -EINVAL;902902+ break;903903+896904 case IW_AUTH_KEY_MGMT:897905 /* wl_lkm implies value 2 == PSK for Hermes I898906 * which ties in with WEXT···919911 */920912 if (param->value) {921913 priv->tkip_cm_active = 1;922922- ret = hermes_enable_port(hw, 0);914914+ ret = hermes_disable_port(hw, 0);923915 } else {924916 priv->tkip_cm_active = 0;925925- ret = hermes_disable_port(hw, 0);917917+ ret = hermes_enable_port(hw, 0);926918 }927919 break;928920
+1-3
include/linux/average.h
···11#ifndef _LINUX_AVERAGE_H22#define _LINUX_AVERAGE_H3344-#include <linux/kernel.h>55-64/* Exponentially weighted moving average (EWMA) */7586/* For more documentation see lib/average.c */···2426 */2527static inline unsigned long ewma_read(const struct ewma *avg)2628{2727- return DIV_ROUND_CLOSEST(avg->internal, avg->factor);2929+ return avg->internal >> avg->factor;2830}29313032#endif /* _LINUX_AVERAGE_H */
···394394 *395395 * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface.396396 *397397+ * @NL80211_CMD_JOIN_MESH: Join a mesh. The mesh ID must be given, and initial398398+ * mesh config parameters may be given.399399+ * @NL80211_CMD_LEAVE_MESH: Leave the mesh network -- no special arguments, the400400+ * network is determined by the network interface.401401+ *397402 * @NL80211_CMD_MAX: highest used command number398403 * @__NL80211_CMD_AFTER_LAST: internal use399404 */···504499 NL80211_CMD_SET_WDS_PEER,505500506501 NL80211_CMD_FRAME_WAIT_CANCEL,502502+503503+ NL80211_CMD_JOIN_MESH,504504+ NL80211_CMD_LEAVE_MESH,507505508506 /* add new commands above here */509507···849841 * flag isn't set, the frame will be rejected. This is also used as an850842 * nl80211 capability flag.851843 *844844+ * @NL80211_ATTR_BSS_HTOPMODE: HT operation mode (u16)845845+ *852846 * @NL80211_ATTR_MAX: highest attribute number currently defined853847 * @__NL80211_ATTR_AFTER_LAST: internal use854848 */···1027101710281018 NL80211_ATTR_OFFCHANNEL_TX_OK,1029101910201020+ NL80211_ATTR_BSS_HT_OPMODE,10211021+10301022 /* add attributes here, update the policy in nl80211.c */1031102310321024 __NL80211_ATTR_AFTER_LAST,···11951183 * station)11961184 * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station)11971185 * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station)11861186+ * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm)11981187 */11991188enum nl80211_sta_info {12001189 __NL80211_STA_INFO_INVALID,···12111198 NL80211_STA_INFO_TX_PACKETS,12121199 NL80211_STA_INFO_TX_RETRIES,12131200 NL80211_STA_INFO_TX_FAILED,12011201+ NL80211_STA_INFO_SIGNAL_AVG,1214120212151203 /* keep last */12161204 __NL80211_STA_INFO_AFTER_LAST,···15611547 * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh15621548 * point.15631549 *15501550+ * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a15511551+ * source mesh point for path selection elements.15521552+ *15641553 * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically15651554 * open peer links when we detect compatible mesh peers.15661555 *···16101593 NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,16111594 NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,16121595 NL80211_MESHCONF_HWMP_ROOTMODE,15961596+ NL80211_MESHCONF_ELEMENT_TTL,1613159716141598 /* keep last */16151599 __NL80211_MESHCONF_ATTR_AFTER_LAST,
+45-13
include/net/cfg80211.h
···258258259259/**260260 * struct vif_params - describes virtual interface parameters261261- * @mesh_id: mesh ID to use262262- * @mesh_id_len: length of the mesh ID263261 * @use_4addr: use 4-address frames264262 */265263struct vif_params {266266- u8 *mesh_id;267267- int mesh_id_len;268264 int use_4addr;269265};270266···420424 * @STATION_INFO_TX_RETRIES: @tx_retries filled421425 * @STATION_INFO_TX_FAILED: @tx_failed filled422426 * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled427427+ * @STATION_INFO_SIGNAL_AVG: @signal_avg filled423428 */424429enum station_info_flags {425430 STATION_INFO_INACTIVE_TIME = 1<<0,···436439 STATION_INFO_TX_RETRIES = 1<<10,437440 STATION_INFO_TX_FAILED = 1<<11,438441 STATION_INFO_RX_DROP_MISC = 1<<12,442442+ STATION_INFO_SIGNAL_AVG = 1<<13,439443};440444441445/**···483485 * @plid: mesh peer link id484486 * @plink_state: mesh peer link state485487 * @signal: signal strength of last received packet in dBm488488+ * @signal_avg: signal strength average in dBm486489 * @txrate: current unicast bitrate to this station487490 * @rx_packets: packets received from this station488491 * @tx_packets: packets transmitted to this station···504505 u16 plid;505506 u8 plink_state;506507 s8 signal;508508+ s8 signal_avg;507509 struct rate_info txrate;508510 u32 rx_packets;509511 u32 tx_packets;···605605 * (or NULL for no change)606606 * @basic_rates_len: number of basic rates607607 * @ap_isolate: do not forward packets between connected stations608608+ * @ht_opmode: HT Operation mode609609+ * (u16 = opmode, -1 = do not change)608610 */609611struct bss_parameters {610612 int use_cts_prot;···615613 u8 *basic_rates;616614 u8 basic_rates_len;617615 int ap_isolate;616616+ int ht_opmode;618617};619618619619+/*620620+ * struct mesh_config - 802.11s mesh configuration621621+ *622622+ * These parameters can be changed while the mesh is active.623623+ */620624struct mesh_config {621625 /* Timeouts in ms */622626 /* Mesh plink management parameters */···632624 u16 dot11MeshMaxPeerLinks;633625 u8 dot11MeshMaxRetries;634626 u8 dot11MeshTTL;627627+ /* ttl used in path selection information elements */628628+ u8 element_ttl;635629 bool auto_open_plinks;636630 /* HWMP parameters */637631 u8 dot11MeshHWMPmaxPREQretries;···643633 u16 dot11MeshHWMPpreqMinInterval;644634 u16 dot11MeshHWMPnetDiameterTraversalTime;645635 u8 dot11MeshHWMPRootMode;636636+};637637+638638+/**639639+ * struct mesh_setup - 802.11s mesh setup configuration640640+ * @mesh_id: the mesh ID641641+ * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes642642+ *643643+ * These parameters are fixed when the mesh is created.644644+ */645645+struct mesh_setup {646646+ const u8 *mesh_id;647647+ u8 mesh_id_len;646648};647649648650/**···10531031 *10541032 * @add_virtual_intf: create a new virtual interface with the given name,10551033 * must set the struct wireless_dev's iftype. Beware: You must create10561056- * the new netdev in the wiphy's network namespace!10341034+ * the new netdev in the wiphy's network namespace! Returns the netdev,10351035+ * or an ERR_PTR.10571036 *10581037 * @del_virtual_intf: remove the virtual interface determined by ifindex.10591038 *···10981075 *10991076 * @get_mesh_params: Put the current mesh parameters into *params11001077 *11011101- * @set_mesh_params: Set mesh parameters.10781078+ * @update_mesh_params: Update mesh parameters on a running mesh.11021079 * The mask is a bitfield which tells us which parameters to11031080 * set, and which to leave alone.11041081 *···11891166 int (*suspend)(struct wiphy *wiphy);11901167 int (*resume)(struct wiphy *wiphy);1191116811921192- int (*add_virtual_intf)(struct wiphy *wiphy, char *name,11931193- enum nl80211_iftype type, u32 *flags,11941194- struct vif_params *params);11691169+ struct net_device * (*add_virtual_intf)(struct wiphy *wiphy,11701170+ char *name,11711171+ enum nl80211_iftype type,11721172+ u32 *flags,11731173+ struct vif_params *params);11951174 int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev);11961175 int (*change_virtual_intf)(struct wiphy *wiphy,11971176 struct net_device *dev,···12491224 int (*get_mesh_params)(struct wiphy *wiphy,12501225 struct net_device *dev,12511226 struct mesh_config *conf);12521252- int (*set_mesh_params)(struct wiphy *wiphy,12531253- struct net_device *dev,12541254- const struct mesh_config *nconf, u32 mask);12271227+ int (*update_mesh_params)(struct wiphy *wiphy,12281228+ struct net_device *dev, u32 mask,12291229+ const struct mesh_config *nconf);12301230+ int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,12311231+ const struct mesh_config *conf,12321232+ const struct mesh_setup *setup);12331233+ int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);12341234+12551235 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,12561236 struct bss_parameters *params);12571237···16721642 * @bssid: (private) Used by the internal configuration code16731643 * @ssid: (private) Used by the internal configuration code16741644 * @ssid_len: (private) Used by the internal configuration code16451645+ * @mesh_id_len: (private) Used by the internal configuration code16461646+ * @mesh_id_up_len: (private) Used by the internal configuration code16751647 * @wext: (private) Used by the internal wireless extensions compat code16761648 * @use_4addr: indicates 4addr mode is used on this interface, must be16771649 * set by driver (if supported) on add_interface BEFORE registering the···1703167117041672 /* currently used for IBSS and SME - might be rearranged later */17051673 u8 ssid[IEEE80211_MAX_SSID_LEN];17061706- u8 ssid_len;16741674+ u8 ssid_len, mesh_id_len, mesh_id_up_len;17071675 enum {17081676 CFG80211_SME_IDLE,17091677 CFG80211_SME_CONNECTING,
+12-8
lib/average.c
···88#include <linux/module.h>99#include <linux/average.h>1010#include <linux/bug.h>1111+#include <linux/log2.h>11121213/**1314 * DOC: Exponentially Weighted Moving Average (EWMA)···2524 * ewma_init() - Initialize EWMA parameters2625 * @avg: Average structure2726 * @factor: Factor to use for the scaled up internal value. The maximum value2828- * of averages can be ULONG_MAX/(factor*weight).2727+ * of averages can be ULONG_MAX/(factor*weight). For performance reasons2828+ * factor has to be a power of 2.2929 * @weight: Exponential weight, or decay rate. This defines how fast the3030- * influence of older values decreases. Has to be bigger than 1.3030+ * influence of older values decreases. For performance reasons weight has3131+ * to be a power of 2.3132 *3233 * Initialize the EWMA parameters for a given struct ewma @avg.3334 */3435void ewma_init(struct ewma *avg, unsigned long factor, unsigned long weight)3536{3636- WARN_ON(weight <= 1 || factor == 0);3737+ WARN_ON(!is_power_of_2(weight) || !is_power_of_2(factor));3838+3939+ avg->weight = ilog2(weight);4040+ avg->factor = ilog2(factor);3741 avg->internal = 0;3838- avg->weight = weight;3939- avg->factor = factor;4042}4143EXPORT_SYMBOL(ewma_init);4244···5349struct ewma *ewma_add(struct ewma *avg, unsigned long val)5450{5551 avg->internal = avg->internal ?5656- (((avg->internal * (avg->weight - 1)) +5757- (val * avg->factor)) / avg->weight) :5858- (val * avg->factor);5252+ (((avg->internal << avg->weight) - avg->internal) +5353+ (val << avg->factor)) >> avg->weight :5454+ (val << avg->factor);5955 return avg;6056}6157EXPORT_SYMBOL(ewma_add);
+1
net/mac80211/Kconfig
···66 select CRYPTO_ARC477 select CRYPTO_AES88 select CRC3299+ select AVERAGE910 ---help---1011 This option enables the hardware independent IEEE 802.111112 networking stack.
···197197 sdata->bss = &sdata->u.ap;198198 break;199199 case NL80211_IFTYPE_MESH_POINT:200200- if (!ieee80211_vif_is_mesh(&sdata->vif))201201- break;202202- /* mesh ifaces must set allmulti to forward mcast traffic */203203- atomic_inc(&local->iff_allmultis);204204- break;205200 case NL80211_IFTYPE_STATION:206201 case NL80211_IFTYPE_MONITOR:207202 case NL80211_IFTYPE_ADHOC:···268273 goto err_stop;269274 }270275271271- if (ieee80211_vif_is_mesh(&sdata->vif)) {272272- local->fif_other_bss++;273273- ieee80211_configure_filter(local);274274-275275- ieee80211_start_mesh(sdata);276276- } else if (sdata->vif.type == NL80211_IFTYPE_AP) {276276+ if (sdata->vif.type == NL80211_IFTYPE_AP) {277277 local->fif_pspoll++;278278 local->fif_probe_req++;279279···493503 ieee80211_adjust_monitor_flags(sdata, -1);494504 ieee80211_configure_filter(local);495505 break;496496- case NL80211_IFTYPE_MESH_POINT:497497- if (ieee80211_vif_is_mesh(&sdata->vif)) {498498- /* other_bss and allmulti are always set on mesh499499- * ifaces */500500- local->fif_other_bss--;501501- atomic_dec(&local->iff_allmultis);502502-503503- ieee80211_configure_filter(local);504504-505505- ieee80211_stop_mesh(sdata);506506- }507507- /* fall through */508506 default:509507 flush_work(&sdata->work);510508 /*···11811203 ret = register_netdevice(ndev);11821204 if (ret)11831205 goto fail;11841184-11851185- if (ieee80211_vif_is_mesh(&sdata->vif) &&11861186- params && params->mesh_id_len)11871187- ieee80211_sdata_set_mesh_id(sdata,11881188- params->mesh_id_len,11891189- params->mesh_id);1190120611911207 mutex_lock(&local->iflist_mtx);11921208 list_add_tail_rcu(&sdata->list, &local->interfaces);
···175175 */176176#define MESH_CFG_CMP_LEN (IEEE80211_MESH_CONFIG_LEN - 2)177177178178-/* Default values, timeouts in ms */179179-#define MESH_TTL 31180180-#define MESH_MAX_RETR 3181181-#define MESH_RET_T 100182182-#define MESH_CONF_T 100183183-#define MESH_HOLD_T 100184184-185185-#define MESH_PATH_TIMEOUT 5000186186-/* Minimum interval between two consecutive PREQs originated by the same187187- * interface188188- */189189-#define MESH_PREQ_MIN_INT 10190190-#define MESH_DIAM_TRAVERSAL_TIME 50191191-/* A path will be refreshed if it is used PATH_REFRESH_TIME milliseconds before192192- * timing out. This way it will remain ACTIVE and no data frames will be193193- * unnecesarily held in the pending queue.194194- */195195-#define MESH_PATH_REFRESH_TIME 1000196196-#define MESH_MIN_DISCOVERY_TIMEOUT (2 * MESH_DIAM_TRAVERSAL_TIME)197178#define MESH_DEFAULT_BEACON_INTERVAL 1000 /* in 1024 us units */198179199199-#define MESH_MAX_PREQ_RETRIES 4200180#define MESH_PATH_EXPIRE (600 * HZ)201201-202202-/* Default maximum number of established plinks per interface */203203-#define MESH_MAX_ESTAB_PLINKS 32204181205182/* Default maximum number of plinks per interface */206183#define MESH_MAX_PLINKS 256
···625625 /*626626 * Go to full PSM if the user configures a very low627627 * latency requirement.628628- * The 2 second value is there for compatibility until629629- * the PM_QOS_NETWORK_LATENCY is configured with real630630- * values.628628+ * The 2000 second value is there for compatibility629629+ * until the PM_QOS_NETWORK_LATENCY is configured630630+ * with real values.631631 */632632- if (latency > 1900000000 && latency != 2000000000)632632+ if (latency > (1900 * USEC_PER_MSEC) &&633633+ latency != (2000 * USEC_PER_SEC))633634 timeout = 0;634635 else635636 timeout = 100;···10661065}1067106610681067void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,10691069- struct ieee80211_hdr *hdr)10681068+ struct ieee80211_hdr *hdr, bool ack)10701069{10711071- if (!ieee80211_is_data(hdr->frame_control) &&10721072- !ieee80211_is_nullfunc(hdr->frame_control))10701070+ if (!ieee80211_is_data(hdr->frame_control))10731071 return;1074107210751075- ieee80211_sta_reset_conn_monitor(sdata);10731073+ if (ack)10741074+ ieee80211_sta_reset_conn_monitor(sdata);1076107510771076 if (ieee80211_is_nullfunc(hdr->frame_control) &&10781077 sdata->u.mgd.probe_send_count > 0) {10791079- sdata->u.mgd.probe_send_count = 0;10781078+ if (ack)10791079+ sdata->u.mgd.probe_send_count = 0;10801080+ else10811081+ sdata->u.mgd.nullfunc_failed = true;10801082 ieee80211_queue_work(&sdata->local->hw, &sdata->work);10811083 }10821084}···11061102 * anymore. The timeout will be reset if the frame is ACKed by11071103 * the AP.11081104 */11091109- if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)11051105+ if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) {11061106+ ifmgd->nullfunc_failed = false;11101107 ieee80211_send_nullfunc(sdata->local, sdata, 0);11111111- else {11081108+ } else {11121109 ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID);11131110 ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid[1], NULL, 0);11141111 }···19181913 ieee80211_queue_work(&local->hw, &sdata->work);19191914}1920191519161916+static void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata,19171917+ u8 *bssid)19181918+{19191919+ struct ieee80211_local *local = sdata->local;19201920+ struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;19211921+19221922+ ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL |19231923+ IEEE80211_STA_BEACON_POLL);19241924+19251925+ ieee80211_set_disassoc(sdata, true, true);19261926+ mutex_unlock(&ifmgd->mtx);19271927+ mutex_lock(&local->mtx);19281928+ ieee80211_recalc_idle(local);19291929+ mutex_unlock(&local->mtx);19301930+ /*19311931+ * must be outside lock due to cfg80211,19321932+ * but that's not a problem.19331933+ */19341934+ ieee80211_send_deauth_disassoc(sdata, bssid,19351935+ IEEE80211_STYPE_DEAUTH,19361936+ WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,19371937+ NULL, true);19381938+ mutex_lock(&ifmgd->mtx);19391939+}19401940+19211941void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)19221942{19231943 struct ieee80211_local *local = sdata->local;···19671937 /* ACK received for nullfunc probing frame */19681938 if (!ifmgd->probe_send_count)19691939 ieee80211_reset_ap_probe(sdata);19701970-19711971- else if (time_is_after_jiffies(ifmgd->probe_timeout))19401940+ else if (ifmgd->nullfunc_failed) {19411941+ if (ifmgd->probe_send_count < max_tries) {19421942+#ifdef CONFIG_MAC80211_VERBOSE_DEBUG19431943+ wiphy_debug(local->hw.wiphy,19441944+ "%s: No ack for nullfunc frame to"19451945+ " AP %pM, try %d\n",19461946+ sdata->name, bssid,19471947+ ifmgd->probe_send_count);19481948+#endif19491949+ ieee80211_mgd_probe_ap_send(sdata);19501950+ } else {19511951+#ifdef CONFIG_MAC80211_VERBOSE_DEBUG19521952+ wiphy_debug(local->hw.wiphy,19531953+ "%s: No ack for nullfunc frame to"19541954+ " AP %pM, disconnecting.\n",19551955+ sdata->name, bssid);19561956+#endif19571957+ ieee80211_sta_connection_lost(sdata, bssid);19581958+ }19591959+ } else if (time_is_after_jiffies(ifmgd->probe_timeout))19721960 run_again(ifmgd, ifmgd->probe_timeout);19731973-19741974- else if (ifmgd->probe_send_count < max_tries) {19611961+ else if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) {19621962+#ifdef CONFIG_MAC80211_VERBOSE_DEBUG19631963+ wiphy_debug(local->hw.wiphy,19641964+ "%s: Failed to send nullfunc to AP %pM"19651965+ " after %dms, disconnecting.\n",19661966+ sdata->name,19671967+ bssid, (1000 * IEEE80211_PROBE_WAIT)/HZ);19681968+#endif19691969+ ieee80211_sta_connection_lost(sdata, bssid);19701970+ } else if (ifmgd->probe_send_count < max_tries) {19751971#ifdef CONFIG_MAC80211_VERBOSE_DEBUG19761972 wiphy_debug(local->hw.wiphy,19771973 "%s: No probe response from AP %pM"···20121956 * We actually lost the connection ... or did we?20131957 * Let's make sure!20141958 */20152015- ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL |20162016- IEEE80211_STA_BEACON_POLL);20171959 wiphy_debug(local->hw.wiphy,20181960 "%s: No probe response from AP %pM"20191961 " after %dms, disconnecting.\n",20201962 sdata->name,20211963 bssid, (1000 * IEEE80211_PROBE_WAIT)/HZ);20222022- ieee80211_set_disassoc(sdata, true, true);20232023- mutex_unlock(&ifmgd->mtx);20242024- mutex_lock(&local->mtx);20252025- ieee80211_recalc_idle(local);20262026- mutex_unlock(&local->mtx);20272027- /*20282028- * must be outside lock due to cfg80211,20292029- * but that's not a problem.20302030- */20312031- ieee80211_send_deauth_disassoc(sdata, bssid,20322032- IEEE80211_STYPE_DEAUTH,20332033- WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,20342034- NULL, true);20352035- mutex_lock(&ifmgd->mtx);19641964+19651965+ ieee80211_sta_connection_lost(sdata, bssid);20361966 }20371967 }20381968
+1
net/mac80211/rx.c
···11631163 sta->rx_fragments++;11641164 sta->rx_bytes += rx->skb->len;11651165 sta->last_signal = status->signal;11661166+ ewma_add(&sta->avg_signal, -status->signal);1166116711671168 /*11681169 * Change STA power saving mode only at the end of a frame
···1313#include <linux/types.h>1414#include <linux/if_ether.h>1515#include <linux/workqueue.h>1616+#include <linux/average.h>1617#include "key.h"17181819/**···224223 * @rx_fragments: number of received MPDUs225224 * @rx_dropped: number of dropped MPDUs from this STA226225 * @last_signal: signal of last received frame from this STA226226+ * @avg_signal: moving average of signal of received frames from this STA227227 * @last_seq_ctrl: last received seq/frag number from this STA (per RX queue)228228 * @tx_filtered_count: number of frames the hardware filtered for this STA229229 * @tx_retry_failed: number of frames that failed retry···293291 unsigned long rx_fragments;294292 unsigned long rx_dropped;295293 int last_signal;294294+ struct ewma avg_signal;296295 __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES];297296298297 /* Updated from TX status path only, no locking requirements */
+9-9
net/mac80211/status.c
···155155156156 ieee80211_queue_work(&local->hw, &local->recalc_smps);157157 }158158-159159- if ((sdata->vif.type == NL80211_IFTYPE_STATION) &&160160- (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS))161161- ieee80211_sta_tx_notify(sdata, (void *) skb->data);162158}163159164160/*···182186 int retry_count = -1, i;183187 int rates_idx = -1;184188 bool send_to_cooked;189189+ bool acked;185190186191 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {187192 /* the HW cannot have attempted that rate */···208211 if (memcmp(hdr->addr2, sta->sdata->vif.addr, ETH_ALEN))209212 continue;210213211211- if (!(info->flags & IEEE80211_TX_STAT_ACK) &&212212- test_sta_flags(sta, WLAN_STA_PS_STA)) {214214+ acked = !!(info->flags & IEEE80211_TX_STAT_ACK);215215+ if (!acked && test_sta_flags(sta, WLAN_STA_PS_STA)) {213216 /*214217 * The STA is in power save mode, so assume215218 * that this TX packet failed because of that.···241244 rcu_read_unlock();242245 return;243246 } else {244244- if (!(info->flags & IEEE80211_TX_STAT_ACK))247247+ if (!acked)245248 sta->tx_retry_failed++;246249 sta->tx_retry_count += retry_count;247250 }···250253 if (ieee80211_vif_is_mesh(&sta->sdata->vif))251254 ieee80211s_update_metric(local, sta, skb);252255253253- if (!(info->flags & IEEE80211_TX_CTL_INJECTED) &&254254- (info->flags & IEEE80211_TX_STAT_ACK))256256+ if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked)255257 ieee80211_frame_acked(sta, skb);258258+259259+ if ((sta->sdata->vif.type == NL80211_IFTYPE_STATION) &&260260+ (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS))261261+ ieee80211_sta_tx_notify(sta->sdata, (void *) skb->data, acked);256262257263 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) {258264 if (info->flags & IEEE80211_TX_STAT_ACK) {
+22-6
net/mac80211/tx.c
···666666 if (unlikely(info->control.rates[0].idx < 0))667667 return TX_DROP;668668669669- if (txrc.reported_rate.idx < 0)669669+ if (txrc.reported_rate.idx < 0) {670670 txrc.reported_rate = info->control.rates[0];671671-672672- if (tx->sta)671671+ if (tx->sta && ieee80211_is_data(hdr->frame_control))672672+ tx->sta->last_tx_rate = txrc.reported_rate;673673+ } else if (tx->sta)673674 tx->sta->last_tx_rate = txrc.reported_rate;674675675676 if (unlikely(!info->control.rates[0].count))···17461745 int nh_pos, h_pos;17471746 struct sta_info *sta = NULL;17481747 u32 sta_flags = 0;17481748+ struct sk_buff *tmp_skb;1749174917501750 if (unlikely(skb->len < ETH_HLEN)) {17511751 ret = NETDEV_TX_OK;17521752 goto fail;17531753 }17541754-17551755- nh_pos = skb_network_header(skb) - skb->data;17561756- h_pos = skb_transport_header(skb) - skb->data;1757175417581755 /* convert Ethernet header to proper 802.11 header (based on17591756 * operation mode) */···19251926 goto fail;19261927 }1927192819291929+ /*19301930+ * If the skb is shared we need to obtain our own copy.19311931+ */19321932+ if (skb_shared(skb)) {19331933+ tmp_skb = skb;19341934+ skb = skb_copy(skb, GFP_ATOMIC);19351935+ kfree_skb(tmp_skb);19361936+19371937+ if (!skb) {19381938+ ret = NETDEV_TX_OK;19391939+ goto fail;19401940+ }19411941+ }19421942+19281943 hdr.frame_control = fc;19291944 hdr.duration_id = 0;19301945 hdr.seq_ctrl = 0;···19561943 encaps_data = NULL;19571944 encaps_len = 0;19581945 }19461946+19471947+ nh_pos = skb_network_header(skb) - skb->data;19481948+ h_pos = skb_transport_header(skb) - skb->data;1959194919601950 skb_pull(skb, skip_header_bytes);19611951 nh_pos -= skip_header_bytes;
+3-2
net/mac80211/work.c
···458458 return WORK_ACT_TIMEOUT;459459 }460460461461- printk(KERN_DEBUG "%s: direct probe to %pM (try %d)\n",462462- sdata->name, wk->filter_ta, wk->probe_auth.tries);461461+ printk(KERN_DEBUG "%s: direct probe to %pM (try %d/%i)\n",462462+ sdata->name, wk->filter_ta, wk->probe_auth.tries,463463+ IEEE80211_AUTH_MAX_TRIES);463464464465 /*465466 * Direct probe is sent to broadcast address as some APs