···18141814 u8 def_ant, tx_ant, ee_mode;18151815 u32 sta_id1 = 0;1816181618171817+ /* if channel is not initialized yet we can't set the antennas18181818+ * so just store the mode. it will be set on the next reset */18191819+ if (channel == NULL) {18201820+ ah->ah_ant_mode = ant_mode;18211821+ return;18221822+ }18231823+18171824 def_ant = ah->ah_def_ant;1818182518191826 ATH5K_TRACE(ah->ah_sc);
-9
drivers/net/wireless/hostap/hostap_hw.c
···26182618 int events = 0;26192619 u16 ev;2620262026212621- /* Detect early interrupt before driver is fully configued */26222622- if (!dev->base_addr) {26232623- if (net_ratelimit()) {26242624- printk(KERN_DEBUG "%s: Interrupt, but dev not configured\n",26252625- dev->name);26262626- }26272627- return IRQ_HANDLED;26282628- }26292629-26302621 iface = netdev_priv(dev);26312622 local = iface->local;26322623
···14841484}148514851486148614871487+/*****************************************************************************14881488+ *14891489+ * sysfs attributes14901490+ *14911491+ *****************************************************************************/14921492+14931493+#ifdef CONFIG_IWLWIFI_DEBUG14941494+14951495+/*14961496+ * The following adds a new attribute to the sysfs representation14971497+ * of this device driver (i.e. a new file in /sys/class/net/wlan0/device/)14981498+ * used for controlling the debug level.14991499+ *15001500+ * See the level definitions in iwl for details.15011501+ *15021502+ * The debug_level being managed using sysfs below is a per device debug15031503+ * level that is used instead of the global debug level if it (the per15041504+ * device debug level) is set.15051505+ */15061506+static ssize_t show_debug_level(struct device *d,15071507+ struct device_attribute *attr, char *buf)15081508+{15091509+ struct iwl_priv *priv = dev_get_drvdata(d);15101510+ return sprintf(buf, "0x%08X\n", iwl_get_debug_level(priv));15111511+}15121512+static ssize_t store_debug_level(struct device *d,15131513+ struct device_attribute *attr,15141514+ const char *buf, size_t count)15151515+{15161516+ struct iwl_priv *priv = dev_get_drvdata(d);15171517+ unsigned long val;15181518+ int ret;15191519+15201520+ ret = strict_strtoul(buf, 0, &val);15211521+ if (ret)15221522+ IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf);15231523+ else {15241524+ priv->debug_level = val;15251525+ if (iwl_alloc_traffic_mem(priv))15261526+ IWL_ERR(priv,15271527+ "Not enough memory to generate traffic log\n");15281528+ }15291529+ return strnlen(buf, count);15301530+}15311531+15321532+static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,15331533+ show_debug_level, store_debug_level);15341534+15351535+15361536+#endif /* CONFIG_IWLWIFI_DEBUG */15371537+15381538+15391539+static ssize_t show_temperature(struct device *d,15401540+ struct device_attribute *attr, char *buf)15411541+{15421542+ struct iwl_priv *priv = dev_get_drvdata(d);15431543+15441544+ if (!iwl_is_alive(priv))15451545+ return -EAGAIN;15461546+15471547+ return sprintf(buf, "%d\n", priv->temperature);15481548+}15491549+15501550+static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);15511551+15521552+static ssize_t show_tx_power(struct device *d,15531553+ struct device_attribute *attr, char *buf)15541554+{15551555+ struct iwl_priv *priv = dev_get_drvdata(d);15561556+15571557+ if (!iwl_is_ready_rf(priv))15581558+ return sprintf(buf, "off\n");15591559+ else15601560+ return sprintf(buf, "%d\n", priv->tx_power_user_lmt);15611561+}15621562+15631563+static ssize_t store_tx_power(struct device *d,15641564+ struct device_attribute *attr,15651565+ const char *buf, size_t count)15661566+{15671567+ struct iwl_priv *priv = dev_get_drvdata(d);15681568+ unsigned long val;15691569+ int ret;15701570+15711571+ ret = strict_strtoul(buf, 10, &val);15721572+ if (ret)15731573+ IWL_INFO(priv, "%s is not in decimal form.\n", buf);15741574+ else {15751575+ ret = iwl_set_tx_power(priv, val, false);15761576+ if (ret)15771577+ IWL_ERR(priv, "failed setting tx power (0x%d).\n",15781578+ ret);15791579+ else15801580+ ret = count;15811581+ }15821582+ return ret;15831583+}15841584+15851585+static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);15861586+15871587+static ssize_t show_rts_ht_protection(struct device *d,15881588+ struct device_attribute *attr, char *buf)15891589+{15901590+ struct iwl_priv *priv = dev_get_drvdata(d);15911591+15921592+ return sprintf(buf, "%s\n",15931593+ priv->cfg->use_rts_for_ht ? "RTS/CTS" : "CTS-to-self");15941594+}15951595+15961596+static ssize_t store_rts_ht_protection(struct device *d,15971597+ struct device_attribute *attr,15981598+ const char *buf, size_t count)15991599+{16001600+ struct iwl_priv *priv = dev_get_drvdata(d);16011601+ unsigned long val;16021602+ int ret;16031603+16041604+ ret = strict_strtoul(buf, 10, &val);16051605+ if (ret)16061606+ IWL_INFO(priv, "Input is not in decimal form.\n");16071607+ else {16081608+ if (!iwl_is_associated(priv))16091609+ priv->cfg->use_rts_for_ht = val ? true : false;16101610+ else16111611+ IWL_ERR(priv, "Sta associated with AP - "16121612+ "Change protection mechanism is not allowed\n");16131613+ ret = count;16141614+ }16151615+ return ret;16161616+}16171617+16181618+static DEVICE_ATTR(rts_ht_protection, S_IWUSR | S_IRUGO,16191619+ show_rts_ht_protection, store_rts_ht_protection);16201620+16211621+16221622+static struct attribute *iwl_sysfs_entries[] = {16231623+ &dev_attr_temperature.attr,16241624+ &dev_attr_tx_power.attr,16251625+ &dev_attr_rts_ht_protection.attr,16261626+#ifdef CONFIG_IWLWIFI_DEBUG16271627+ &dev_attr_debug_level.attr,16281628+#endif16291629+ NULL16301630+};16311631+16321632+static struct attribute_group iwl_attribute_group = {16331633+ .name = NULL, /* put in device directory */16341634+ .attrs = iwl_sysfs_entries,16351635+};16361636+14871637/******************************************************************************14881638 *14891639 * uCode download functions···21141964 err = iwl_dbgfs_register(priv, DRV_NAME);21151965 if (err)21161966 IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err);19671967+19681968+ err = sysfs_create_group(&priv->pci_dev->dev.kobj,19691969+ &iwl_attribute_group);19701970+ if (err) {19711971+ IWL_ERR(priv, "failed to create sysfs device attributes\n");19721972+ goto out_unbind;19731973+ }2117197421181975 /* We have our copies now, allow OS release its copies */21191976 release_firmware(ucode_raw);···3421326434223265/*****************************************************************************34233266 *34243424- * sysfs attributes34253425- *34263426- *****************************************************************************/34273427-34283428-#ifdef CONFIG_IWLWIFI_DEBUG34293429-34303430-/*34313431- * The following adds a new attribute to the sysfs representation34323432- * of this device driver (i.e. a new file in /sys/class/net/wlan0/device/)34333433- * used for controlling the debug level.34343434- *34353435- * See the level definitions in iwl for details.34363436- *34373437- * The debug_level being managed using sysfs below is a per device debug34383438- * level that is used instead of the global debug level if it (the per34393439- * device debug level) is set.34403440- */34413441-static ssize_t show_debug_level(struct device *d,34423442- struct device_attribute *attr, char *buf)34433443-{34443444- struct iwl_priv *priv = dev_get_drvdata(d);34453445- return sprintf(buf, "0x%08X\n", iwl_get_debug_level(priv));34463446-}34473447-static ssize_t store_debug_level(struct device *d,34483448- struct device_attribute *attr,34493449- const char *buf, size_t count)34503450-{34513451- struct iwl_priv *priv = dev_get_drvdata(d);34523452- unsigned long val;34533453- int ret;34543454-34553455- ret = strict_strtoul(buf, 0, &val);34563456- if (ret)34573457- IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf);34583458- else {34593459- priv->debug_level = val;34603460- if (iwl_alloc_traffic_mem(priv))34613461- IWL_ERR(priv,34623462- "Not enough memory to generate traffic log\n");34633463- }34643464- return strnlen(buf, count);34653465-}34663466-34673467-static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,34683468- show_debug_level, store_debug_level);34693469-34703470-34713471-#endif /* CONFIG_IWLWIFI_DEBUG */34723472-34733473-34743474-static ssize_t show_temperature(struct device *d,34753475- struct device_attribute *attr, char *buf)34763476-{34773477- struct iwl_priv *priv = dev_get_drvdata(d);34783478-34793479- if (!iwl_is_alive(priv))34803480- return -EAGAIN;34813481-34823482- return sprintf(buf, "%d\n", priv->temperature);34833483-}34843484-34853485-static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);34863486-34873487-static ssize_t show_tx_power(struct device *d,34883488- struct device_attribute *attr, char *buf)34893489-{34903490- struct iwl_priv *priv = dev_get_drvdata(d);34913491-34923492- if (!iwl_is_ready_rf(priv))34933493- return sprintf(buf, "off\n");34943494- else34953495- return sprintf(buf, "%d\n", priv->tx_power_user_lmt);34963496-}34973497-34983498-static ssize_t store_tx_power(struct device *d,34993499- struct device_attribute *attr,35003500- const char *buf, size_t count)35013501-{35023502- struct iwl_priv *priv = dev_get_drvdata(d);35033503- unsigned long val;35043504- int ret;35053505-35063506- ret = strict_strtoul(buf, 10, &val);35073507- if (ret)35083508- IWL_INFO(priv, "%s is not in decimal form.\n", buf);35093509- else {35103510- ret = iwl_set_tx_power(priv, val, false);35113511- if (ret)35123512- IWL_ERR(priv, "failed setting tx power (0x%d).\n",35133513- ret);35143514- else35153515- ret = count;35163516- }35173517- return ret;35183518-}35193519-35203520-static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);35213521-35223522-static ssize_t show_rts_ht_protection(struct device *d,35233523- struct device_attribute *attr, char *buf)35243524-{35253525- struct iwl_priv *priv = dev_get_drvdata(d);35263526-35273527- return sprintf(buf, "%s\n",35283528- priv->cfg->use_rts_for_ht ? "RTS/CTS" : "CTS-to-self");35293529-}35303530-35313531-static ssize_t store_rts_ht_protection(struct device *d,35323532- struct device_attribute *attr,35333533- const char *buf, size_t count)35343534-{35353535- struct iwl_priv *priv = dev_get_drvdata(d);35363536- unsigned long val;35373537- int ret;35383538-35393539- ret = strict_strtoul(buf, 10, &val);35403540- if (ret)35413541- IWL_INFO(priv, "Input is not in decimal form.\n");35423542- else {35433543- if (!iwl_is_associated(priv))35443544- priv->cfg->use_rts_for_ht = val ? true : false;35453545- else35463546- IWL_ERR(priv, "Sta associated with AP - "35473547- "Change protection mechanism is not allowed\n");35483548- ret = count;35493549- }35503550- return ret;35513551-}35523552-35533553-static DEVICE_ATTR(rts_ht_protection, S_IWUSR | S_IRUGO,35543554- show_rts_ht_protection, store_rts_ht_protection);35553555-35563556-35573557-/*****************************************************************************35583558- *35593267 * driver setup and teardown35603268 *35613269 *****************************************************************************/···35713549 iwl_free_channel_map(priv);35723550 kfree(priv->scan_cmd);35733551}35743574-35753575-static struct attribute *iwl_sysfs_entries[] = {35763576- &dev_attr_temperature.attr,35773577- &dev_attr_tx_power.attr,35783578- &dev_attr_rts_ht_protection.attr,35793579-#ifdef CONFIG_IWLWIFI_DEBUG35803580- &dev_attr_debug_level.attr,35813581-#endif35823582- NULL35833583-};35843584-35853585-static struct attribute_group iwl_attribute_group = {35863586- .name = NULL, /* put in device directory */35873587- .attrs = iwl_sysfs_entries,35883588-};3589355235903553static struct ieee80211_ops iwl_hw_ops = {35913554 .tx = iwl_mac_tx,···37573750 IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq);37583751 goto out_disable_msi;37593752 }37603760- err = sysfs_create_group(&pdev->dev.kobj, &iwl_attribute_group);37613761- if (err) {37623762- IWL_ERR(priv, "failed to create sysfs device attributes\n");37633763- goto out_free_irq;37643764- }3765375337663754 iwl_setup_deferred_work(priv);37673755 iwl_setup_rx_handlers(priv);···3790378837913789 err = iwl_request_firmware(priv, true);37923790 if (err)37933793- goto out_remove_sysfs;37913791+ goto out_destroy_workqueue;3794379237953793 return 0;3796379437973797- out_remove_sysfs:37953795+ out_destroy_workqueue:37983796 destroy_workqueue(priv->workqueue);37993797 priv->workqueue = NULL;38003800- sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group);38013801- out_free_irq:38023798 free_irq(priv->pci_dev->irq, priv);38033799 iwl_free_isr_ict(priv);38043800 out_disable_msi:
+39
drivers/net/wireless/iwlwifi/iwl-core.c
···854854}855855EXPORT_SYMBOL(iwl_set_rxon_chain);856856857857+/* Return valid channel */858858+u8 iwl_get_single_channel_number(struct iwl_priv *priv,859859+ enum ieee80211_band band)860860+{861861+ const struct iwl_channel_info *ch_info;862862+ int i;863863+ u8 channel = 0;864864+865865+ /* only scan single channel, good enough to reset the RF */866866+ /* pick the first valid not in-use channel */867867+ if (band == IEEE80211_BAND_5GHZ) {868868+ for (i = 14; i < priv->channel_count; i++) {869869+ if (priv->channel_info[i].channel !=870870+ le16_to_cpu(priv->staging_rxon.channel)) {871871+ channel = priv->channel_info[i].channel;872872+ ch_info = iwl_get_channel_info(priv,873873+ band, channel);874874+ if (is_channel_valid(ch_info))875875+ break;876876+ }877877+ }878878+ } else {879879+ for (i = 0; i < 14; i++) {880880+ if (priv->channel_info[i].channel !=881881+ le16_to_cpu(priv->staging_rxon.channel)) {882882+ channel =883883+ priv->channel_info[i].channel;884884+ ch_info = iwl_get_channel_info(priv,885885+ band, channel);886886+ if (is_channel_valid(ch_info))887887+ break;888888+ }889889+ }890890+ }891891+892892+ return channel;893893+}894894+EXPORT_SYMBOL(iwl_get_single_channel_number);895895+857896/**858897 * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON859898 * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz
···349349 struct survey_info *survey)350350{351351 int ret = -EOPNOTSUPP;352352- if (local->ops->conf_tx)352352+ if (local->ops->get_survey)353353 ret = local->ops->get_survey(&local->hw, idx, survey);354354 /* trace_drv_get_survey(local, idx, survey, ret); */355355 return ret;
+83-9
net/mac80211/mlme.c
···16921692 rma = ieee80211_rx_mgmt_disassoc(sdata, mgmt, skb->len);16931693 break;16941694 case IEEE80211_STYPE_ACTION:16951695- if (mgmt->u.action.category != WLAN_CATEGORY_SPECTRUM_MGMT)16961696- break;16951695+ switch (mgmt->u.action.category) {16961696+ case WLAN_CATEGORY_BACK: {16971697+ struct ieee80211_local *local = sdata->local;16981698+ int len = skb->len;16991699+ struct sta_info *sta;1697170016981698- ieee80211_sta_process_chanswitch(sdata,16991699- &mgmt->u.action.u.chan_switch.sw_elem,17001700- (void *)ifmgd->associated->priv,17011701- rx_status->mactime);17021702- break;17011701+ rcu_read_lock();17021702+ sta = sta_info_get(sdata, mgmt->sa);17031703+ if (!sta) {17041704+ rcu_read_unlock();17051705+ break;17061706+ }17071707+17081708+ local_bh_disable();17091709+17101710+ switch (mgmt->u.action.u.addba_req.action_code) {17111711+ case WLAN_ACTION_ADDBA_REQ:17121712+ if (len < (IEEE80211_MIN_ACTION_SIZE +17131713+ sizeof(mgmt->u.action.u.addba_req)))17141714+ break;17151715+ ieee80211_process_addba_request(local, sta, mgmt, len);17161716+ break;17171717+ case WLAN_ACTION_ADDBA_RESP:17181718+ if (len < (IEEE80211_MIN_ACTION_SIZE +17191719+ sizeof(mgmt->u.action.u.addba_resp)))17201720+ break;17211721+ ieee80211_process_addba_resp(local, sta, mgmt, len);17221722+ break;17231723+ case WLAN_ACTION_DELBA:17241724+ if (len < (IEEE80211_MIN_ACTION_SIZE +17251725+ sizeof(mgmt->u.action.u.delba)))17261726+ break;17271727+ ieee80211_process_delba(sdata, sta, mgmt, len);17281728+ break;17291729+ }17301730+ local_bh_enable();17311731+ rcu_read_unlock();17321732+ break;17331733+ }17341734+ case WLAN_CATEGORY_SPECTRUM_MGMT:17351735+ ieee80211_sta_process_chanswitch(sdata,17361736+ &mgmt->u.action.u.chan_switch.sw_elem,17371737+ (void *)ifmgd->associated->priv,17381738+ rx_status->mactime);17391739+ break;17401740+ }17031741 }17041742 mutex_unlock(&ifmgd->mtx);17051743···17601722 mutex_unlock(&ifmgd->mtx);1761172317621724 if (skb->len >= 24 + 2 /* mgmt + deauth reason */ &&17631763- (fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_DEAUTH)17641764- cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len);17251725+ (fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_DEAUTH) {17261726+ struct ieee80211_local *local = sdata->local;17271727+ struct ieee80211_work *wk;1765172817291729+ mutex_lock(&local->work_mtx);17301730+ list_for_each_entry(wk, &local->work_list, list) {17311731+ if (wk->sdata != sdata)17321732+ continue;17331733+17341734+ if (wk->type != IEEE80211_WORK_ASSOC)17351735+ continue;17361736+17371737+ if (memcmp(mgmt->bssid, wk->filter_ta, ETH_ALEN))17381738+ continue;17391739+ if (memcmp(mgmt->sa, wk->filter_ta, ETH_ALEN))17401740+ continue;17411741+17421742+ /*17431743+ * Printing the message only here means we can't17441744+ * spuriously print it, but it also means that it17451745+ * won't be printed when the frame comes in before17461746+ * we even tried to associate or in similar cases.17471747+ *17481748+ * Ultimately, I suspect cfg80211 should print the17491749+ * messages instead.17501750+ */17511751+ printk(KERN_DEBUG17521752+ "%s: deauthenticated from %pM (Reason: %u)\n",17531753+ sdata->name, mgmt->bssid,17541754+ le16_to_cpu(mgmt->u.deauth.reason_code));17551755+17561756+ list_del_rcu(&wk->list);17571757+ free_work(wk);17581758+ break;17591759+ }17601760+ mutex_unlock(&local->work_mtx);17611761+17621762+ cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len);17631763+ }17661764 out:17671765 kfree_skb(skb);17681766}
+3
net/mac80211/rx.c
···19441944 if (len < IEEE80211_MIN_ACTION_SIZE + 1)19451945 break;1946194619471947+ if (sdata->vif.type == NL80211_IFTYPE_STATION)19481948+ return ieee80211_sta_rx_mgmt(sdata, rx->skb);19491949+19471950 switch (mgmt->u.action.u.addba_req.action_code) {19481951 case WLAN_ACTION_ADDBA_REQ:19491952 if (len < (IEEE80211_MIN_ACTION_SIZE +