···11/*22- * Copyright (c) 2008-2010 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ani.h
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar5008_initvals.h
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar5008_phy.c
···11/*22- * Copyright (c) 2008-2010 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9001_initvals.h
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9002_calib.c
···11/*22- * Copyright (c) 2008-2010 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9002_hw.c
···11/*22- * Copyright (c) 2008-2010 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9002_initvals.h
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9002_mac.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9002_phy.c
···11/*22- * Copyright (c) 2008-2010 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9002_phy.h
···11/*22- * Copyright (c) 2008-2010 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9003_calib.c
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+16
drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
···11+/*22+ * Copyright (c) 2010-2011 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+117#ifndef AR9003_EEPROM_H218#define AR9003_EEPROM_H319
+1-1
drivers/net/wireless/ath/ath9k/ar9003_hw.c
···11/*22- * Copyright (c) 2008-2010 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9003_mac.c
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9003_mac.h
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9003_paprd.c
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9003_phy.c
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9003_phy.h
···11/*22- * Copyright (c) 2002-2010 Atheros Communications, Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/ar9485_initvals.h
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+4-1
drivers/net/wireless/ath/ath9k/ath9k.h
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above···397397 struct ath_descdma bdma;398398 struct ath_txq *cabq;399399 struct list_head bbuf;400400+401401+ bool tx_processed;402402+ bool tx_last;400403};401404402405void ath_beacon_tasklet(unsigned long data);
···11/*22- * Copyright (c) 2009 Atheros Communications Inc.22+ * Copyright (c) 2009-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/btcoex.h
···11/*22- * Copyright (c) 2009 Atheros Communications Inc.22+ * Copyright (c) 2009-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/calib.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/calib.h
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/common.c
···11/*22- * Copyright (c) 2009 Atheros Communications Inc.22+ * Copyright (c) 2009-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/common.h
···11/*22- * Copyright (c) 2009 Atheros Communications Inc.22+ * Copyright (c) 2009-2011 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 above
+9-1
drivers/net/wireless/ath/ath9k/debug.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above···435435 conf->channel_type,436436 channel_type_str(conf->channel_type));437437438438+ ath9k_ps_wakeup(sc);438439 put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_STA_ID0), addr);439440 put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_STA_ID1) & 0xffff, addr + 4);440441 len += snprintf(buf + len, sizeof(buf) - len,···445444 len += snprintf(buf + len, sizeof(buf) - len,446445 "addrmask: %pM\n", addr);447446 tmp = ath9k_hw_getrxfilter(sc->sc_ah);447447+ ath9k_ps_restore(sc);448448 len += snprintf(buf + len, sizeof(buf) - len,449449 "rfilt: 0x%x", tmp);450450 if (tmp & ATH9K_RX_FILTER_UCAST)···727725 break;728726 }729727728728+ ath9k_ps_wakeup(sc);730729 len += snprintf(buf + len, size - len,731730 "curbssid: %pM\n"732731 "OP-Mode: %s(%i)\n"···737734 REG_READ(ah, AR_BEACON_PERIOD));738735739736 reg = REG_READ(ah, AR_TIMER_MODE);737737+ ath9k_ps_restore(sc);740738 len += snprintf(buf + len, size - len, "Timer-Mode-Register: 0x%x (",741739 reg);742740 if (reg & AR_TBTT_TIMER_EN)···10541050 unsigned int len;10551051 u32 regval;1056105210531053+ ath9k_ps_wakeup(sc);10571054 regval = REG_READ_D(ah, sc->debug.regidx);10551055+ ath9k_ps_restore(sc);10581056 len = sprintf(buf, "0x%08x\n", regval);10591057 return simple_read_from_buffer(user_buf, count, ppos, buf, len);10601058}···10781072 if (strict_strtoul(buf, 0, ®val))10791073 return -EINVAL;1080107410751075+ ath9k_ps_wakeup(sc);10811076 REG_WRITE_D(ah, sc->debug.regidx, regval);10771077+ ath9k_ps_restore(sc);10821078 return count;10831079}10841080
+1-1
drivers/net/wireless/ath/ath9k/debug.h
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/eeprom.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/eeprom.h
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/eeprom_4k.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/eeprom_9287.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/eeprom_def.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/gpio.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/hif_usb.c
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+2-2
drivers/net/wireless/ath/ath9k/hif_usb.h
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above···1818#define HTC_USB_H19192020#define MAJOR_VERSION_REQ 12121-#define MINOR_VERSION_REQ 22121+#define MINOR_VERSION_REQ 322222323#define IS_AR7010_DEVICE(_v) (((_v) == AR9280_USB) || ((_v) == AR9287_USB))2424
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+2-7
drivers/net/wireless/ath/ath9k/htc_drv_init.c
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above···258258 */259259260260 if (IS_AR7010_DEVICE(drv_info))261261- priv->htc->credits = 48;261261+ priv->htc->credits = 45;262262 else263263 priv->htc->credits = 33;264264···768768 hw->queues = 4;769769 hw->channel_change_time = 5000;770770 hw->max_listen_interval = 10;771771-772772- if (AR_SREV_9271(priv->ah))773773- hw->max_tx_aggregation_subframes = MAX_TX_AMPDU_SUBFRAMES_9271;774774- else775775- hw->max_tx_aggregation_subframes = MAX_TX_AMPDU_SUBFRAMES_7010;776771777772 hw->vif_data_size = sizeof(struct ath9k_htc_vif);778773 hw->sta_data_size = sizeof(struct ath9k_htc_sta);
+50-29
drivers/net/wireless/ath/ath9k/htc_drv_main.c
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above···2626{2727 enum htc_phymode mode;28282929- mode = HTC_MODE_AUTO;2929+ mode = -EINVAL;30303131 switch (ichan->chanmode) {3232 case CHANNEL_G:···4444 default:4545 break;4646 }4747+4848+ WARN_ON(mode < 0);47494850 return mode;4951}···502500 tsta.maxampdu = cpu_to_be16(maxampdu);503501 }504502505505- if (sta && sta->ht_cap.ht_supported)506506- tsta.flags = cpu_to_be16(ATH_HTC_STA_HT);507507-508503 WMI_CMD_BUF(WMI_NODE_CREATE_CMDID, &tsta);509504 if (ret) {510505 if (sta)···581582 memset(&tcap, 0, sizeof(struct ath9k_htc_cap_target));582583583584 tcap.ampdu_limit = cpu_to_be32(0xffff);584584- tcap.ampdu_subframes = priv->hw->max_tx_aggregation_subframes;585585+ tcap.ampdu_subframes = 0xff;585586 tcap.enable_coex = enable_coex;586587 tcap.tx_chainmask = priv->ah->caps.tx_chainmask;587588···1164116511651166 ath9k_htc_set_opmode(priv);1166116711681168+ ath9k_htc_set_bssid_mask(priv, vif);11691169+11671170 /*11681171 * Stop ANI only if there are no associated station interfaces.11691172 */···14361435 return ret;14371436}1438143714381438+static void ath9k_htc_set_bssid(struct ath9k_htc_priv *priv)14391439+{14401440+ struct ath_common *common = ath9k_hw_common(priv->ah);14411441+14421442+ ath9k_hw_write_associd(priv->ah);14431443+ ath_dbg(common, ATH_DBG_CONFIG,14441444+ "BSSID: %pM aid: 0x%x\n",14451445+ common->curbssid, common->curaid);14461446+}14471447+14481448+static void ath9k_htc_bss_iter(void *data, u8 *mac, struct ieee80211_vif *vif)14491449+{14501450+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data;14511451+ struct ath_common *common = ath9k_hw_common(priv->ah);14521452+ struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;14531453+14541454+ if ((vif->type == NL80211_IFTYPE_STATION) && bss_conf->assoc) {14551455+ common->curaid = bss_conf->aid;14561456+ memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);14571457+ }14581458+}14591459+14601460+static void ath9k_htc_choose_set_bssid(struct ath9k_htc_priv *priv)14611461+{14621462+ if (priv->num_sta_assoc_vif == 1) {14631463+ ieee80211_iterate_active_interfaces_atomic(priv->hw,14641464+ ath9k_htc_bss_iter, priv);14651465+ ath9k_htc_set_bssid(priv);14661466+ }14671467+}14681468+14391469static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,14401470 struct ieee80211_vif *vif,14411471 struct ieee80211_bss_conf *bss_conf,···14751443 struct ath9k_htc_priv *priv = hw->priv;14761444 struct ath_hw *ah = priv->ah;14771445 struct ath_common *common = ath9k_hw_common(ah);14781478- bool set_assoc;1479144614801447 mutex_lock(&priv->mutex);14811448 ath9k_htc_ps_wakeup(priv);1482144914831483- /*14841484- * Set the HW AID/BSSID only for the first station interface14851485- * or in IBSS mode.14861486- */14871487- set_assoc = !!((priv->ah->opmode == NL80211_IFTYPE_ADHOC) ||14881488- ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&14891489- (priv->num_sta_vif == 1)));14901490-14911491-14921450 if (changed & BSS_CHANGED_ASSOC) {14931493- if (set_assoc) {14941494- ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n",14951495- bss_conf->assoc);14511451+ ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n",14521452+ bss_conf->assoc);1496145314971497- common->curaid = bss_conf->assoc ?14981498- bss_conf->aid : 0;14541454+ bss_conf->assoc ?14551455+ priv->num_sta_assoc_vif++ : priv->num_sta_assoc_vif--;1499145615001500- if (bss_conf->assoc)14571457+ if (priv->ah->opmode == NL80211_IFTYPE_STATION) {14581458+ if (bss_conf->assoc && (priv->num_sta_assoc_vif == 1))15011459 ath9k_htc_start_ani(priv);15021502- else14601460+ else if (priv->num_sta_assoc_vif == 0)15031461 ath9k_htc_stop_ani(priv);15041462 }15051463 }1506146415071465 if (changed & BSS_CHANGED_BSSID) {15081508- if (set_assoc) {14661466+ if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) {14671467+ common->curaid = bss_conf->aid;15091468 memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);15101510- ath9k_hw_write_associd(ah);15111511-15121512- ath_dbg(common, ATH_DBG_CONFIG,15131513- "BSSID: %pM aid: 0x%x\n",15141514- common->curbssid, common->curaid);14691469+ ath9k_htc_set_bssid(priv);14701470+ } else if (priv->ah->opmode == NL80211_IFTYPE_STATION) {14711471+ ath9k_htc_choose_set_bssid(priv);15151472 }15161473 }15171474
+5-1
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above···875875 rfilt |= ATH9K_RX_FILTER_CONTROL;876876877877 if ((ah->opmode == NL80211_IFTYPE_STATION) &&878878+ (priv->nvifs <= 1) &&878879 !(priv->rxfilter & FIF_BCN_PRBRESP_PROMISC))879880 rfilt |= ATH9K_RX_FILTER_MYBEACON;880881 else···888887889888 if (priv->rxfilter & FIF_PSPOLL)890889 rfilt |= ATH9K_RX_FILTER_PSPOLL;890890+891891+ if (priv->nvifs > 1)892892+ rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL;891893892894 return rfilt;893895
+1-1
drivers/net/wireless/ath/ath9k/htc_hst.c
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/htc_hst.h
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/hw-ops.h
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/hw.c
···11/*22- * Copyright (c) 2008-2010 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/hw.h
···11/*22- * Copyright (c) 2008-2010 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/init.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/mac.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/mac.h
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+41-1
drivers/net/wireless/ath/ath9k/main.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above···23322332 return false;23332333}2334233423352335+int ath9k_tx_last_beacon(struct ieee80211_hw *hw)23362336+{23372337+ struct ath_softc *sc = hw->priv;23382338+ struct ath_hw *ah = sc->sc_ah;23392339+ struct ieee80211_vif *vif;23402340+ struct ath_vif *avp;23412341+ struct ath_buf *bf;23422342+ struct ath_tx_status ts;23432343+ int status;23442344+23452345+ vif = sc->beacon.bslot[0];23462346+ if (!vif)23472347+ return 0;23482348+23492349+ avp = (void *)vif->drv_priv;23502350+ if (!avp->is_bslot_active)23512351+ return 0;23522352+23532353+ if (!sc->beacon.tx_processed) {23542354+ tasklet_disable(&sc->bcon_tasklet);23552355+23562356+ bf = avp->av_bcbuf;23572357+ if (!bf || !bf->bf_mpdu)23582358+ goto skip;23592359+23602360+ status = ath9k_hw_txprocdesc(ah, bf->bf_desc, &ts);23612361+ if (status == -EINPROGRESS)23622362+ goto skip;23632363+23642364+ sc->beacon.tx_processed = true;23652365+ sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK);23662366+23672367+skip:23682368+ tasklet_enable(&sc->bcon_tasklet);23692369+ }23702370+23712371+ return sc->beacon.tx_last;23722372+}23732373+23352374struct ieee80211_ops ath9k_ops = {23362375 .tx = ath9k_tx,23372376 .start = ath9k_start,···23952356 .set_coverage_class = ath9k_set_coverage_class,23962357 .flush = ath9k_flush,23972358 .tx_frames_pending = ath9k_tx_frames_pending,23592359+ .tx_last_beacon = ath9k_tx_last_beacon,23982360};
+1-1
drivers/net/wireless/ath/ath9k/pci.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/phy.h
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/rc.c
···11/*22 * Copyright (c) 2004 Video54 Technologies, Inc.33- * Copyright (c) 2004-2009 Atheros Communications, Inc.33+ * Copyright (c) 2004-2011 Atheros Communications, Inc.44 *55 * Permission to use, copy, modify, and/or distribute this software for any66 * purpose with or without fee is hereby granted, provided that the above
+1-1
drivers/net/wireless/ath/ath9k/rc.h
···11/*22 * Copyright (c) 2004 Sam Leffler, Errno Consulting33 * Copyright (c) 2004 Video54 Technologies, Inc.44- * Copyright (c) 2008-2009 Atheros Communications Inc.44+ * Copyright (c) 2008-2011 Atheros Communications Inc.55 *66 * Permission to use, copy, modify, and/or distribute this software for any77 * purpose with or without fee is hereby granted, provided that the above
+1-1
drivers/net/wireless/ath/ath9k/recv.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/reg.h
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/wmi.c
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/wmi.h
···11/*22- * Copyright (c) 2010 Atheros Communications Inc.22+ * Copyright (c) 2010-2011 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 above
+1-1
drivers/net/wireless/ath/ath9k/xmit.c
···11/*22- * Copyright (c) 2008-2009 Atheros Communications Inc.22+ * Copyright (c) 2008-2011 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 above
···15701570 INIT_LIST_HEAD(&ar->vif_list);15711571 init_completion(&ar->tx_flush);1572157215731573- /*15741574- * Note:15751575- * IBSS/ADHOC and AP mode are only enabled, if the firmware15761576- * supports these modes. The code which will add the15771577- * additional interface_modes is in fw.c.15781578- */15791579- hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |15801580- BIT(NL80211_IFTYPE_P2P_CLIENT);15731573+ /* firmware decides which modes we support */15741574+ hw->wiphy->interface_modes = 0;1581157515821576 hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS |15831577 IEEE80211_HW_REPORTS_TX_ACK_STATUS |
+4-6
drivers/net/wireless/ath/hw.c
···4343 * set of ~ ( MAC XOR BSSID ) for all bssids we handle.4444 *4545 * When you do this you are essentially computing the common bits of all your4646- * BSSes. Later it is assumed the harware will "and" (&) the BSSID mask with4646+ * BSSes. Later it is assumed the hardware will "and" (&) the BSSID mask with4747 * the MAC address to obtain the relevant bits and compare the result with4848 * (frame's BSSID & mask) to see if they match.4949 *···7171 * On loop iteration for BSSID-02:7272 * bssid_mask &= ~(0001 ^ 1001)7373 * bssid_mask = (1010) & ~(0001 ^ 1001)7474- * bssid_mask = (1010) & ~(1001)7575- * bssid_mask = (1010) & (0110)7474+ * bssid_mask = (1010) & ~(1000)7575+ * bssid_mask = (1010) & (0111)7676 * bssid_mask = 00107777 *7878 * A bssid_mask of 0010 means "only pay attention to the second least···102102 *103103 * IFRAME-02: 0001 (we should allow)104104 *105105- * allow = (0001 & 1010) == 1010106106- *107105 * allow = (IFRAME-02 & bssid_mask) == (bssid_mask & MAC) ? 1 : 0;108106 * --> allow = (0001 & 0010) == (0010 & 0001) ? 1 :0;109109- * --> allow = (0010) == (0010)107107+ * --> allow = (0000) == (0000)110108 * --> allow = 1111109 *112110 * Other examples:
···289289 /* cast away the const for active_rxon in this function */290290 struct iwl_rxon_cmd *active = (void *)&ctx->active;291291 bool new_assoc = !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK);292292- bool old_assoc = !!(ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK);293292 int ret;294293295294 lockdep_assert_held(&priv->mutex);···388389 * AP station must be done after the BSSID is set to correctly389390 * set up filters in the device.390391 */391391- if ((old_assoc && new_assoc) || !new_assoc) {392392- ret = iwlagn_rxon_disconn(priv, ctx);393393- if (ret)394394- return ret;395395- }392392+ ret = iwlagn_rxon_disconn(priv, ctx);393393+ if (ret)394394+ return ret;396395397396 if (new_assoc)398397 return iwlagn_rxon_connect(priv, ctx);
···4848#include "iwl-agn-rs.h"4949#include "iwl-agn-tt.h"50505151-#define U32_PAD(n) ((4-(n))&0x3)5252-5351struct iwl_tx_queue;54525553/* CT-KILL constants */···8183#define MAX_RTS_THRESHOLD 2347U8284#define MAX_MSDU_SIZE 2304U8385#define MAX_MPDU_SIZE 2346U8484-#define DEFAULT_BEACON_INTERVAL 100U8686+#define DEFAULT_BEACON_INTERVAL 200U8587#define DEFAULT_SHORT_RETRY_LIMIT 7U8688#define DEFAULT_LONG_RETRY_LIMIT 4U8789···110112 struct iwl_device_cmd *cmd,111113 struct iwl_rx_packet *pkt);112114113113- /* The CMD_SIZE_HUGE flag bit indicates that the command114114- * structure is stored at the end of the shared queue memory. */115115 u32 flags;116116117117 DEFINE_DMA_UNMAP_ADDR(mapping);···119123/*120124 * Generic queue structure121125 *122122- * Contains common data for Rx and Tx queues126126+ * Contains common data for Rx and Tx queues.127127+ *128128+ * Note the difference between n_bd and n_window: the hardware129129+ * always assumes 256 descriptors, so n_bd is always 256 (unless130130+ * there might be HW changes in the future). For the normal TX131131+ * queues, n_window, which is the size of the software queue data132132+ * is also 256; however, for the command queue, n_window is only133133+ * 32 since we don't need so many commands pending. Since the HW134134+ * still uses 256 BDs for DMA though, n_bd stays 256. As a result,135135+ * the software buffers (in the variables @meta, @txb in struct136136+ * iwl_tx_queue) only have 32 entries, while the HW buffers (@tfds137137+ * in the same struct) have 256.138138+ * This means that we end up with the following:139139+ * HW entries: | 0 | ... | N * 32 | ... | N * 32 + 31 | ... | 255 |140140+ * SW entries: | 0 | ... | 31 |141141+ * where N is a number between 0 and 7. This means that the SW142142+ * data is a window overlayed over the HW queue.123143 */124144struct iwl_queue {125145 int n_bd; /* number of BDs in this queue */···177165178166struct iwl_tx_queue {179167 struct iwl_queue q;180180- void *tfds;168168+ struct iwl_tfd *tfds;181169 struct iwl_device_cmd **cmd;182170 struct iwl_cmd_meta *meta;183171 struct iwl_tx_info *txb;···259247 CMD_SYNC = 0,260248 CMD_SIZE_NORMAL = 0,261249 CMD_NO_SKB = 0,262262- CMD_SIZE_HUGE = (1 << 0),263250 CMD_ASYNC = (1 << 1),264251 CMD_WANT_SKB = (1 << 2),265252 CMD_MAPPED = (1 << 3),···270259 * struct iwl_device_cmd271260 *272261 * For allocation of the command and tx queues, this establishes the overall273273- * size of the largest command we send to uCode, except for a scan command274274- * (which is relatively huge; space is allocated separately).262262+ * size of the largest command we send to uCode, except for commands that263263+ * aren't fully copied and use other TFD space.275264 */276265struct iwl_device_cmd {277266 struct iwl_cmd_header hdr; /* uCode API */···288277289278#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd))290279280280+#define IWL_MAX_CMD_TFDS 2281281+282282+enum iwl_hcmd_dataflag {283283+ IWL_HCMD_DFL_NOCOPY = BIT(0),284284+};291285292286struct iwl_host_cmd {293293- const void *data;287287+ const void *data[IWL_MAX_CMD_TFDS];294288 unsigned long reply_page;295289 void (*callback)(struct iwl_priv *priv,296290 struct iwl_device_cmd *cmd,297291 struct iwl_rx_packet *pkt);298292 u32 flags;299299- u16 len;293293+ u16 len[IWL_MAX_CMD_TFDS];294294+ u8 dataflags[IWL_MAX_CMD_TFDS];300295 u8 id;301296};302297···705688}706689707690708708-static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge)691691+static inline u8 get_cmd_index(struct iwl_queue *q, u32 index)709692{710710- /*711711- * This is for init calibration result and scan command which712712- * required buffer > TFD_MAX_PAYLOAD_SIZE,713713- * the big buffer at end of command array714714- */715715- if (is_huge)716716- return q->n_window; /* must be power of 2 */717717-718718- /* Otherwise, use normal size buffers */719693 return index & (q->n_window - 1);720694}721695···11791171 IWL_SCAN_OFFCH_TX,11801172};1181117311741174+#ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL11751175+struct iwl_testmode_trace {11761176+ u8 *cpu_addr;11771177+ u8 *trace_addr;11781178+ dma_addr_t dma_addr;11791179+ bool trace_enabled;11801180+};11811181+#endif11821182struct iwl_priv {1183118311841184 /* ieee device used by generic ieee processing code */···14681452 struct work_struct beacon_update;14691453 struct iwl_rxon_context *beacon_ctx;14701454 struct sk_buff *beacon_skb;14551455+ void *beacon_cmd;1471145614721457 struct work_struct tt_work;14731458 struct work_struct ct_enter;···15181501 struct led_classdev led;15191502 unsigned long blink_on, blink_off;15201503 bool led_registered;15041504+#ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL15051505+ struct iwl_testmode_trace testmode_trace;15061506+#endif15071507+ u32 dbg_fixed_rate;15081508+15211509}; /*iwl_priv */1522151015231511static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id)
···97979898 [IWL_TM_ATTR_SYNC_RSP] = { .type = NLA_UNSPEC, },9999 [IWL_TM_ATTR_UCODE_RX_PKT] = { .type = NLA_UNSPEC, },100100+101101+ [IWL_TM_ATTR_EEPROM] = { .type = NLA_UNSPEC, },102102+103103+ [IWL_TM_ATTR_TRACE_ADDR] = { .type = NLA_UNSPEC, },104104+ [IWL_TM_ATTR_TRACE_DATA] = { .type = NLA_UNSPEC, },105105+106106+ [IWL_TM_ATTR_FIXRATE] = { .type = NLA_U32, },100107};101108102109/*···174167void iwl_testmode_init(struct iwl_priv *priv)175168{176169 priv->pre_rx_handler = iwl_testmode_ucode_rx_pkt;170170+ priv->testmode_trace.trace_enabled = false;171171+}172172+173173+static void iwl_trace_cleanup(struct iwl_priv *priv)174174+{175175+ struct device *dev = &priv->pci_dev->dev;176176+177177+ if (priv->testmode_trace.trace_enabled) {178178+ if (priv->testmode_trace.cpu_addr &&179179+ priv->testmode_trace.dma_addr)180180+ dma_free_coherent(dev,181181+ TRACE_TOTAL_SIZE,182182+ priv->testmode_trace.cpu_addr,183183+ priv->testmode_trace.dma_addr);184184+ priv->testmode_trace.trace_enabled = false;185185+ priv->testmode_trace.cpu_addr = NULL;186186+ priv->testmode_trace.trace_addr = NULL;187187+ priv->testmode_trace.dma_addr = 0;188188+ }189189+}190190+191191+192192+void iwl_testmode_cleanup(struct iwl_priv *priv)193193+{194194+ iwl_trace_cleanup(priv);177195}178196179197/*···230198 }231199232200 cmd.id = nla_get_u8(tb[IWL_TM_ATTR_UCODE_CMD_ID]);233233- cmd.data = nla_data(tb[IWL_TM_ATTR_UCODE_CMD_DATA]);234234- cmd.len = nla_len(tb[IWL_TM_ATTR_UCODE_CMD_DATA]);201201+ cmd.data[0] = nla_data(tb[IWL_TM_ATTR_UCODE_CMD_DATA]);202202+ cmd.len[0] = nla_len(tb[IWL_TM_ATTR_UCODE_CMD_DATA]);203203+ cmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;235204 IWL_INFO(priv, "testmode ucode command ID 0x%x, flags 0x%x,"236236- " len %d\n", cmd.id, cmd.flags, cmd.len);205205+ " len %d\n", cmd.id, cmd.flags, cmd.len[0]);237206 /* ok, let's submit the command to ucode */238207 return iwl_send_cmd(priv, &cmd);239208}···421388 "Error starting the device: %d\n", status);422389 break;423390391391+ case IWL_TM_CMD_APP2DEV_GET_EEPROM:392392+ if (priv->eeprom) {393393+ skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,394394+ priv->cfg->base_params->eeprom_size + 20);395395+ if (!skb) {396396+ IWL_DEBUG_INFO(priv,397397+ "Error allocating memory\n");398398+ return -ENOMEM;399399+ }400400+ NLA_PUT_U32(skb, IWL_TM_ATTR_COMMAND,401401+ IWL_TM_CMD_DEV2APP_EEPROM_RSP);402402+ NLA_PUT(skb, IWL_TM_ATTR_EEPROM,403403+ priv->cfg->base_params->eeprom_size,404404+ priv->eeprom);405405+ status = cfg80211_testmode_reply(skb);406406+ if (status < 0)407407+ IWL_DEBUG_INFO(priv,408408+ "Error sending msg : %d\n",409409+ status);410410+ } else411411+ return -EFAULT;412412+ break;413413+414414+ case IWL_TM_CMD_APP2DEV_FIXRATE_REQ:415415+ if (!tb[IWL_TM_ATTR_FIXRATE]) {416416+ IWL_DEBUG_INFO(priv,417417+ "Error finding fixrate setting\n");418418+ return -ENOMSG;419419+ }420420+ priv->dbg_fixed_rate = nla_get_u32(tb[IWL_TM_ATTR_FIXRATE]);421421+ break;422422+424423 default:425424 IWL_DEBUG_INFO(priv, "Unknown testmode driver command ID\n");426425 return -ENOSYS;···461396462397nla_put_failure:463398 kfree_skb(skb);399399+ return -EMSGSIZE;400400+}401401+402402+403403+/*404404+ * This function handles the user application commands for uCode trace405405+ *406406+ * It retrieves command ID carried with IWL_TM_ATTR_COMMAND and calls to the407407+ * handlers respectively.408408+ *409409+ * If it's an unknown commdn ID, -ENOSYS is replied; otherwise, the returned410410+ * value of the actual command execution is replied to the user application.411411+ *412412+ * @hw: ieee80211_hw object that represents the device413413+ * @tb: gnl message fields from the user space414414+ */415415+static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb)416416+{417417+ struct iwl_priv *priv = hw->priv;418418+ struct sk_buff *skb;419419+ int status = 0;420420+ struct device *dev = &priv->pci_dev->dev;421421+422422+ switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {423423+ case IWL_TM_CMD_APP2DEV_BEGIN_TRACE:424424+ if (priv->testmode_trace.trace_enabled)425425+ return -EBUSY;426426+427427+ priv->testmode_trace.cpu_addr =428428+ dma_alloc_coherent(dev,429429+ TRACE_TOTAL_SIZE,430430+ &priv->testmode_trace.dma_addr,431431+ GFP_KERNEL);432432+ if (!priv->testmode_trace.cpu_addr)433433+ return -ENOMEM;434434+ priv->testmode_trace.trace_enabled = true;435435+ priv->testmode_trace.trace_addr = (u8 *)PTR_ALIGN(436436+ priv->testmode_trace.cpu_addr, 0x100);437437+ memset(priv->testmode_trace.trace_addr, 0x03B,438438+ TRACE_BUFF_SIZE);439439+ skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,440440+ sizeof(priv->testmode_trace.dma_addr) + 20);441441+ if (!skb) {442442+ IWL_DEBUG_INFO(priv,443443+ "Error allocating memory\n");444444+ iwl_trace_cleanup(priv);445445+ return -ENOMEM;446446+ }447447+ NLA_PUT(skb, IWL_TM_ATTR_TRACE_ADDR,448448+ sizeof(priv->testmode_trace.dma_addr),449449+ (u64 *)&priv->testmode_trace.dma_addr);450450+ status = cfg80211_testmode_reply(skb);451451+ if (status < 0) {452452+ IWL_DEBUG_INFO(priv,453453+ "Error sending msg : %d\n",454454+ status);455455+ }456456+ break;457457+458458+ case IWL_TM_CMD_APP2DEV_END_TRACE:459459+ iwl_trace_cleanup(priv);460460+ break;461461+462462+ case IWL_TM_CMD_APP2DEV_READ_TRACE:463463+ if (priv->testmode_trace.trace_enabled &&464464+ priv->testmode_trace.trace_addr) {465465+ skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,466466+ 20 + TRACE_BUFF_SIZE);467467+ if (skb == NULL) {468468+ IWL_DEBUG_INFO(priv,469469+ "Error allocating memory\n");470470+ return -ENOMEM;471471+ }472472+ NLA_PUT(skb, IWL_TM_ATTR_TRACE_DATA,473473+ TRACE_BUFF_SIZE,474474+ priv->testmode_trace.trace_addr);475475+ status = cfg80211_testmode_reply(skb);476476+ if (status < 0) {477477+ IWL_DEBUG_INFO(priv,478478+ "Error sending msg : %d\n", status);479479+ }480480+ } else481481+ return -EFAULT;482482+ break;483483+484484+ default:485485+ IWL_DEBUG_INFO(priv, "Unknown testmode mem command ID\n");486486+ return -ENOSYS;487487+ }488488+ return status;489489+490490+nla_put_failure:491491+ kfree_skb(skb);492492+ if (nla_get_u32(tb[IWL_TM_ATTR_COMMAND]) ==493493+ IWL_TM_CMD_APP2DEV_BEGIN_TRACE)494494+ iwl_trace_cleanup(priv);464495 return -EMSGSIZE;465496}466497···616455 case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW:617456 case IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB:618457 case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW:458458+ case IWL_TM_CMD_APP2DEV_GET_EEPROM:459459+ case IWL_TM_CMD_APP2DEV_FIXRATE_REQ:619460 IWL_DEBUG_INFO(priv, "testmode cmd to driver\n");620461 result = iwl_testmode_driver(hw, tb);621462 break;463463+464464+ case IWL_TM_CMD_APP2DEV_BEGIN_TRACE:465465+ case IWL_TM_CMD_APP2DEV_END_TRACE:466466+ case IWL_TM_CMD_APP2DEV_READ_TRACE:467467+ IWL_DEBUG_INFO(priv, "testmode uCode trace cmd to driver\n");468468+ result = iwl_testmode_trace(hw, tb);469469+ break;470470+622471 default:623472 IWL_DEBUG_INFO(priv, "Unknown testmode command\n");624473 result = -ENOSYS;
+34
drivers/net/wireless/iwlwifi/iwl-testmode.h
···8888 IWL_TM_CMD_APP2DEV_LOAD_INIT_FW,8989 IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB,9090 IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW,9191+ IWL_TM_CMD_APP2DEV_GET_EEPROM,9292+ IWL_TM_CMD_APP2DEV_FIXRATE_REQ,9193 /* if there is other new command for the driver layer operation,9294 * append them here */93959696+ /* commands fom user space for uCode trace operations */9797+ IWL_TM_CMD_APP2DEV_BEGIN_TRACE,9898+ IWL_TM_CMD_APP2DEV_END_TRACE,9999+ IWL_TM_CMD_APP2DEV_READ_TRACE,9410095101 /* commands from kernel space to carry the synchronous response96102 * to user application */···10599 /* commands from kernel space to multicast the spontaneous messages106100 * to user application */107101 IWL_TM_CMD_DEV2APP_UCODE_RX_PKT,102102+103103+ /* commands from kernel space to carry the eeprom response104104+ * to user application */105105+ IWL_TM_CMD_DEV2APP_EEPROM_RSP,106106+108107 IWL_TM_CMD_MAX,109108};110109···155144 * application */156145 IWL_TM_ATTR_UCODE_RX_PKT,157146147147+ /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_EEPROM,148148+ * The mandatory fields are:149149+ * IWL_TM_ATTR_EEPROM for the data content responging to the user150150+ * application */151151+ IWL_TM_ATTR_EEPROM,152152+153153+ /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_XXX_TRACE,154154+ * The mandatory fields are:155155+ * IWL_TM_ATTR_MEM_TRACE_ADDR for the trace address156156+ */157157+ IWL_TM_ATTR_TRACE_ADDR,158158+ IWL_TM_ATTR_TRACE_DATA,159159+160160+ /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_FIXRATE_REQ,161161+ * The mandatory fields are:162162+ * IWL_TM_ATTR_FIXRATE for the fixed rate163163+ */164164+ IWL_TM_ATTR_FIXRATE,165165+158166 IWL_TM_ATTR_MAX,159167};160168169169+/* uCode trace buffer */170170+#define TRACE_BUFF_SIZE 0x20000171171+#define TRACE_BUFF_PADD 0x2000172172+#define TRACE_TOTAL_SIZE (TRACE_BUFF_SIZE + TRACE_BUFF_PADD)161173162174#endif
+265-97
drivers/net/wireless/iwlwifi/iwl-tx.c
···3232#include <linux/slab.h>3333#include <net/mac80211.h>3434#include "iwl-eeprom.h"3535+#include "iwl-agn.h"3536#include "iwl-dev.h"3637#include "iwl-core.h"3738#include "iwl-sta.h"···8685 txq->need_update = 0;8786}88878888+static inline dma_addr_t iwl_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx)8989+{9090+ struct iwl_tfd_tb *tb = &tfd->tbs[idx];9191+9292+ dma_addr_t addr = get_unaligned_le32(&tb->lo);9393+ if (sizeof(dma_addr_t) > sizeof(u32))9494+ addr |=9595+ ((dma_addr_t)(le16_to_cpu(tb->hi_n_len) & 0xF) << 16) << 16;9696+9797+ return addr;9898+}9999+100100+static inline u16 iwl_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx)101101+{102102+ struct iwl_tfd_tb *tb = &tfd->tbs[idx];103103+104104+ return le16_to_cpu(tb->hi_n_len) >> 4;105105+}106106+107107+static inline void iwl_tfd_set_tb(struct iwl_tfd *tfd, u8 idx,108108+ dma_addr_t addr, u16 len)109109+{110110+ struct iwl_tfd_tb *tb = &tfd->tbs[idx];111111+ u16 hi_n_len = len << 4;112112+113113+ put_unaligned_le32(addr, &tb->lo);114114+ if (sizeof(dma_addr_t) > sizeof(u32))115115+ hi_n_len |= ((addr >> 16) >> 16) & 0xF;116116+117117+ tb->hi_n_len = cpu_to_le16(hi_n_len);118118+119119+ tfd->num_tbs = idx + 1;120120+}121121+122122+static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd)123123+{124124+ return tfd->num_tbs & 0x1f;125125+}126126+127127+static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta,128128+ struct iwl_tfd *tfd)129129+{130130+ struct pci_dev *dev = priv->pci_dev;131131+ int i;132132+ int num_tbs;133133+134134+ /* Sanity check on number of chunks */135135+ num_tbs = iwl_tfd_get_num_tbs(tfd);136136+137137+ if (num_tbs >= IWL_NUM_OF_TBS) {138138+ IWL_ERR(priv, "Too many chunks: %i\n", num_tbs);139139+ /* @todo issue fatal error, it is quite serious situation */140140+ return;141141+ }142142+143143+ /* Unmap tx_cmd */144144+ if (num_tbs)145145+ pci_unmap_single(dev,146146+ dma_unmap_addr(meta, mapping),147147+ dma_unmap_len(meta, len),148148+ PCI_DMA_BIDIRECTIONAL);149149+150150+ /* Unmap chunks, if any. */151151+ for (i = 1; i < num_tbs; i++)152152+ pci_unmap_single(dev, iwl_tfd_tb_get_addr(tfd, i),153153+ iwl_tfd_tb_get_len(tfd, i), PCI_DMA_TODEVICE);154154+}155155+156156+/**157157+ * iwlagn_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr]158158+ * @priv - driver private data159159+ * @txq - tx queue160160+ *161161+ * Does NOT advance any TFD circular buffer read/write indexes162162+ * Does NOT free the TFD itself (which is within circular buffer)163163+ */164164+void iwlagn_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)165165+{166166+ struct iwl_tfd *tfd_tmp = txq->tfds;167167+ int index = txq->q.read_ptr;168168+169169+ iwlagn_unmap_tfd(priv, &txq->meta[index], &tfd_tmp[index]);170170+171171+ /* free SKB */172172+ if (txq->txb) {173173+ struct sk_buff *skb;174174+175175+ skb = txq->txb[txq->q.read_ptr].skb;176176+177177+ /* can be called from irqs-disabled context */178178+ if (skb) {179179+ dev_kfree_skb_any(skb);180180+ txq->txb[txq->q.read_ptr].skb = NULL;181181+ }182182+ }183183+}184184+185185+int iwlagn_txq_attach_buf_to_tfd(struct iwl_priv *priv,186186+ struct iwl_tx_queue *txq,187187+ dma_addr_t addr, u16 len,188188+ u8 reset)189189+{190190+ struct iwl_queue *q;191191+ struct iwl_tfd *tfd, *tfd_tmp;192192+ u32 num_tbs;193193+194194+ q = &txq->q;195195+ tfd_tmp = txq->tfds;196196+ tfd = &tfd_tmp[q->write_ptr];197197+198198+ if (reset)199199+ memset(tfd, 0, sizeof(*tfd));200200+201201+ num_tbs = iwl_tfd_get_num_tbs(tfd);202202+203203+ /* Each TFD can point to a maximum 20 Tx buffers */204204+ if (num_tbs >= IWL_NUM_OF_TBS) {205205+ IWL_ERR(priv, "Error can not send more than %d chunks\n",206206+ IWL_NUM_OF_TBS);207207+ return -EINVAL;208208+ }209209+210210+ if (WARN_ON(addr & ~DMA_BIT_MASK(36)))211211+ return -EINVAL;212212+213213+ if (unlikely(addr & ~IWL_TX_DMA_MASK))214214+ IWL_ERR(priv, "Unaligned address = %llx\n",215215+ (unsigned long long)addr);216216+217217+ iwl_tfd_set_tb(tfd, num_tbs, addr, len);218218+219219+ return 0;220220+}221221+222222+/*223223+ * Tell nic where to find circular buffer of Tx Frame Descriptors for224224+ * given Tx queue, and enable the DMA channel used for that queue.225225+ *226226+ * supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA227227+ * channels supported in hardware.228228+ */229229+static int iwlagn_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq)230230+{231231+ int txq_id = txq->q.id;232232+233233+ /* Circular buffer (TFD queue in DRAM) physical base address */234234+ iwl_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id),235235+ txq->q.dma_addr >> 8);236236+237237+ return 0;238238+}239239+89240/**90241 * iwl_tx_queue_unmap - Unmap any remaining DMA mappings and free skb's91242 */···25097 return;2519825299 while (q->write_ptr != q->read_ptr) {253253- priv->cfg->ops->lib->txq_free_tfd(priv, txq);100100+ iwlagn_txq_free_tfd(priv, txq);254101 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd);255102 }256103}···307154 return;308155309156 while (q->read_ptr != q->write_ptr) {310310- i = get_cmd_index(q, q->read_ptr, 0);157157+ i = get_cmd_index(q, q->read_ptr);311158312159 if (txq->meta[i].flags & CMD_MAPPED) {313160 pci_unmap_single(priv->pci_dev,···318165 }319166320167 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd);321321- }322322-323323- i = q->n_window;324324- if (txq->meta[i].flags & CMD_MAPPED) {325325- pci_unmap_single(priv->pci_dev,326326- dma_unmap_addr(&txq->meta[i], mapping),327327- dma_unmap_len(&txq->meta[i], len),328328- PCI_DMA_BIDIRECTIONAL);329329- txq->meta[i].flags = 0;330168 }331169}332170···338194 iwl_cmd_queue_unmap(priv);339195340196 /* De-alloc array of command/tx buffers */341341- for (i = 0; i <= TFD_CMD_SLOTS; i++)197197+ for (i = 0; i < TFD_CMD_SLOTS; i++)342198 kfree(txq->cmd[i]);343199344200 /* De-alloc circular buffer of TFDs */···478334{479335 int i, len;480336 int ret;481481- int actual_slots = slots_num;482337483483- /*484484- * Alloc buffer array for commands (Tx or other types of commands).485485- * For the command queue (#4/#9), allocate command space + one big486486- * command for scan, since scan command is very huge; the system will487487- * not have two scans at the same time, so only one is needed.488488- * For normal Tx queues (all other queues), no super-size command489489- * space is needed.490490- */491491- if (txq_id == priv->cmd_queue)492492- actual_slots++;493493-494494- txq->meta = kzalloc(sizeof(struct iwl_cmd_meta) * actual_slots,338338+ txq->meta = kzalloc(sizeof(struct iwl_cmd_meta) * slots_num,495339 GFP_KERNEL);496496- txq->cmd = kzalloc(sizeof(struct iwl_device_cmd *) * actual_slots,340340+ txq->cmd = kzalloc(sizeof(struct iwl_device_cmd *) * slots_num,497341 GFP_KERNEL);498342499343 if (!txq->meta || !txq->cmd)500344 goto out_free_arrays;501345502346 len = sizeof(struct iwl_device_cmd);503503- for (i = 0; i < actual_slots; i++) {504504- /* only happens for cmd queue */505505- if (i == slots_num)506506- len = IWL_MAX_CMD_SIZE;507507-347347+ for (i = 0; i < slots_num; i++) {508348 txq->cmd[i] = kmalloc(len, GFP_KERNEL);509349 if (!txq->cmd[i])510350 goto err;···519391 return ret;520392521393 /* Tell device where to find queue */522522- priv->cfg->ops->lib->txq_init(priv, txq);394394+ iwlagn_tx_queue_init(priv, txq);523395524396 return 0;525397err:526526- for (i = 0; i < actual_slots; i++)398398+ for (i = 0; i < slots_num; i++)527399 kfree(txq->cmd[i]);528400out_free_arrays:529401 kfree(txq->meta);···548420 iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id);549421550422 /* Tell device where to find queue */551551- priv->cfg->ops->lib->txq_init(priv, txq);423423+ iwlagn_tx_queue_init(priv, txq);552424}553425554426/*************** HOST COMMAND QUEUE FUNCTIONS *****/···571443 dma_addr_t phys_addr;572444 unsigned long flags;573445 u32 idx;574574- u16 fix_size;446446+ u16 copy_size, cmd_size;575447 bool is_ct_kill = false;448448+ bool had_nocopy = false;449449+ int i;450450+ u8 *cmd_dest;451451+#ifdef CONFIG_IWLWIFI_DEVICE_TRACING452452+ const void *trace_bufs[IWL_MAX_CMD_TFDS + 1] = {};453453+ int trace_lens[IWL_MAX_CMD_TFDS + 1] = {};454454+ int trace_idx;455455+#endif576456577577- fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr));457457+ if (test_bit(STATUS_FW_ERROR, &priv->status)) {458458+ IWL_WARN(priv, "fw recovery, no hcmd send\n");459459+ return -EIO;460460+ }461461+462462+ copy_size = sizeof(out_cmd->hdr);463463+ cmd_size = sizeof(out_cmd->hdr);464464+465465+ /* need one for the header if the first is NOCOPY */466466+ BUILD_BUG_ON(IWL_MAX_CMD_TFDS > IWL_NUM_OF_TBS - 1);467467+468468+ for (i = 0; i < IWL_MAX_CMD_TFDS; i++) {469469+ if (!cmd->len[i])470470+ continue;471471+ if (cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY) {472472+ had_nocopy = true;473473+ } else {474474+ /* NOCOPY must not be followed by normal! */475475+ if (WARN_ON(had_nocopy))476476+ return -EINVAL;477477+ copy_size += cmd->len[i];478478+ }479479+ cmd_size += cmd->len[i];480480+ }578481579482 /*580483 * If any of the command structures end up being larger than581581- * the TFD_MAX_PAYLOAD_SIZE, and it sent as a 'small' command then582582- * we will need to increase the size of the TFD entries583583- * Also, check to see if command buffer should not exceed the size584584- * of device_cmd and max_cmd_size.484484+ * the TFD_MAX_PAYLOAD_SIZE and they aren't dynamically485485+ * allocated into separate TFDs, then we will need to486486+ * increase the size of the buffers.585487 */586586- if (WARN_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&587587- !(cmd->flags & CMD_SIZE_HUGE)))588588- return -EINVAL;589589-590590- if (WARN_ON(fix_size > IWL_MAX_CMD_SIZE))488488+ if (WARN_ON(copy_size > TFD_MAX_PAYLOAD_SIZE))591489 return -EINVAL;592490593491 if (iwl_is_rfkill(priv) || iwl_is_ctkill(priv)) {···621467 iwl_is_rfkill(priv) ? "RF" : "CT");622468 return -EIO;623469 }624624-625625- /*626626- * As we only have a single huge buffer, check that the command627627- * is synchronous (otherwise buffers could end up being reused).628628- */629629-630630- if (WARN_ON((cmd->flags & CMD_ASYNC) && (cmd->flags & CMD_SIZE_HUGE)))631631- return -EINVAL;632470633471 spin_lock_irqsave(&priv->hcmd_lock, flags);634472···636490 return -ENOSPC;637491 }638492639639- idx = get_cmd_index(q, q->write_ptr, cmd->flags & CMD_SIZE_HUGE);493493+ idx = get_cmd_index(q, q->write_ptr);640494 out_cmd = txq->cmd[idx];641495 out_meta = &txq->meta[idx];642496···651505 if (cmd->flags & CMD_ASYNC)652506 out_meta->callback = cmd->callback;653507508508+ /* set up the header */509509+654510 out_cmd->hdr.cmd = cmd->id;655655- memcpy(&out_cmd->cmd.payload, cmd->data, cmd->len);656656-657657- /* At this point, the out_cmd now has all of the incoming cmd658658- * information */659659-660511 out_cmd->hdr.flags = 0;661512 out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(priv->cmd_queue) |662662- INDEX_TO_SEQ(q->write_ptr));663663- if (cmd->flags & CMD_SIZE_HUGE)664664- out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;513513+ INDEX_TO_SEQ(q->write_ptr));665514666666-#ifdef CONFIG_IWLWIFI_DEBUG667667- switch (out_cmd->hdr.cmd) {668668- case REPLY_TX_LINK_QUALITY_CMD:669669- case SENSITIVITY_CMD:670670- IWL_DEBUG_HC_DUMP(priv, "Sending command %s (#%x), seq: 0x%04X, "671671- "%d bytes at %d[%d]:%d\n",672672- get_cmd_string(out_cmd->hdr.cmd),673673- out_cmd->hdr.cmd,674674- le16_to_cpu(out_cmd->hdr.sequence), fix_size,675675- q->write_ptr, idx, priv->cmd_queue);676676- break;677677- default:678678- IWL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, "679679- "%d bytes at %d[%d]:%d\n",680680- get_cmd_string(out_cmd->hdr.cmd),681681- out_cmd->hdr.cmd,682682- le16_to_cpu(out_cmd->hdr.sequence), fix_size,683683- q->write_ptr, idx, priv->cmd_queue);515515+ /* and copy the data that needs to be copied */516516+517517+ cmd_dest = &out_cmd->cmd.payload[0];518518+ for (i = 0; i < IWL_MAX_CMD_TFDS; i++) {519519+ if (!cmd->len[i])520520+ continue;521521+ if (cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)522522+ break;523523+ memcpy(cmd_dest, cmd->data[i], cmd->len[i]);524524+ cmd_dest += cmd->len[i];684525 }685685-#endif526526+527527+ IWL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, "528528+ "%d bytes at %d[%d]:%d\n",529529+ get_cmd_string(out_cmd->hdr.cmd),530530+ out_cmd->hdr.cmd,531531+ le16_to_cpu(out_cmd->hdr.sequence), cmd_size,532532+ q->write_ptr, idx, priv->cmd_queue);533533+686534 phys_addr = pci_map_single(priv->pci_dev, &out_cmd->hdr,687687- fix_size, PCI_DMA_BIDIRECTIONAL);535535+ copy_size, PCI_DMA_BIDIRECTIONAL);688536 if (unlikely(pci_dma_mapping_error(priv->pci_dev, phys_addr))) {689537 idx = -ENOMEM;690538 goto out;691539 }692540693541 dma_unmap_addr_set(out_meta, mapping, phys_addr);694694- dma_unmap_len_set(out_meta, len, fix_size);542542+ dma_unmap_len_set(out_meta, len, copy_size);543543+544544+ iwlagn_txq_attach_buf_to_tfd(priv, txq, phys_addr, copy_size, 1);545545+#ifdef CONFIG_IWLWIFI_DEVICE_TRACING546546+ trace_bufs[0] = &out_cmd->hdr;547547+ trace_lens[0] = copy_size;548548+ trace_idx = 1;549549+#endif550550+551551+ for (i = 0; i < IWL_MAX_CMD_TFDS; i++) {552552+ if (!cmd->len[i])553553+ continue;554554+ if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY))555555+ continue;556556+ phys_addr = pci_map_single(priv->pci_dev, (void *)cmd->data[i],557557+ cmd->len[i], PCI_DMA_TODEVICE);558558+ if (pci_dma_mapping_error(priv->pci_dev, phys_addr)) {559559+ iwlagn_unmap_tfd(priv, out_meta,560560+ &txq->tfds[q->write_ptr]);561561+ idx = -ENOMEM;562562+ goto out;563563+ }564564+565565+ iwlagn_txq_attach_buf_to_tfd(priv, txq, phys_addr,566566+ cmd->len[i], 0);567567+#ifdef CONFIG_IWLWIFI_DEVICE_TRACING568568+ trace_bufs[trace_idx] = cmd->data[i];569569+ trace_lens[trace_idx] = cmd->len[i];570570+ trace_idx++;571571+#endif572572+ }695573696574 out_meta->flags = cmd->flags | CMD_MAPPED;697575698576 txq->need_update = 1;699577700700- trace_iwlwifi_dev_hcmd(priv, &out_cmd->hdr, fix_size, cmd->flags);701701-702702- priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,703703- phys_addr, fix_size, 1,704704- U32_PAD(cmd->len));578578+ /* check that tracing gets all possible blocks */579579+ BUILD_BUG_ON(IWL_MAX_CMD_TFDS + 1 != 3);580580+#ifdef CONFIG_IWLWIFI_DEVICE_TRACING581581+ trace_iwlwifi_dev_hcmd(priv, cmd->flags,582582+ trace_bufs[0], trace_lens[0],583583+ trace_bufs[1], trace_lens[1],584584+ trace_bufs[2], trace_lens[2]);585585+#endif705586706587 /* Increment and update queue's write index */707588 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);···746573 * need to be reclaimed. As result, some free space forms. If there is747574 * enough free space (> low mark), wake the stack that feeds us.748575 */749749-static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id,750750- int idx, int cmd_idx)576576+static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int idx)751577{752578 struct iwl_tx_queue *txq = &priv->txq[txq_id];753579 struct iwl_queue *q = &txq->q;···786614 int txq_id = SEQ_TO_QUEUE(sequence);787615 int index = SEQ_TO_INDEX(sequence);788616 int cmd_index;789789- bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME);790617 struct iwl_device_cmd *cmd;791618 struct iwl_cmd_meta *meta;792619 struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue];···803632 return;804633 }805634806806- cmd_index = get_cmd_index(&txq->q, index, huge);635635+ cmd_index = get_cmd_index(&txq->q, index);807636 cmd = txq->cmd[cmd_index];808637 meta = &txq->meta[cmd_index];809638810810- pci_unmap_single(priv->pci_dev,811811- dma_unmap_addr(meta, mapping),812812- dma_unmap_len(meta, len),813813- PCI_DMA_BIDIRECTIONAL);639639+ iwlagn_unmap_tfd(priv, meta, &txq->tfds[index]);814640815641 /* Input error checking is done when commands are added to queue. */816642 if (meta->flags & CMD_WANT_SKB) {···818650819651 spin_lock_irqsave(&priv->hcmd_lock, flags);820652821821- iwl_hcmd_queue_reclaim(priv, txq_id, index, cmd_index);653653+ iwl_hcmd_queue_reclaim(priv, txq_id, index);822654823655 if (!(meta->flags & CMD_ASYNC)) {824656 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
···11+/*22+ * Copyright (c) 2011, NVIDIA Corporation.33+ *44+ * This program is free software; you can redistribute it and/or modify55+ * it under the terms of the GNU General Public License as published by66+ * the Free Software Foundation; either version 2 of the License, or77+ * (at your option) any later version.88+ *99+ * This program is distributed in the hope that it will be useful, but WITHOUT1010+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1111+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1212+ * more details.1313+ *1414+ * You should have received a copy of the GNU General Public License along1515+ * with this program; if not, write to the Free Software Foundation, Inc.,1616+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.1717+ */1818+1919+2020+#ifndef __RFKILL_GPIO_H2121+#define __RFKILL_GPIO_H2222+2323+#include <linux/types.h>2424+#include <linux/rfkill.h>2525+2626+/**2727+ * struct rfkill_gpio_platform_data - platform data for rfkill gpio device.2828+ * for unused gpio's, the expected value is -1.2929+ * @name: name for the gpio rf kill instance3030+ * @reset_gpio: GPIO which is used for reseting rfkill switch3131+ * @shutdown_gpio: GPIO which is used for shutdown of rfkill switch3232+ * @power_clk_name: [optional] name of clk to turn off while blocked3333+ */3434+3535+struct rfkill_gpio_platform_data {3636+ char *name;3737+ int reset_gpio;3838+ int shutdown_gpio;3939+ const char *power_clk_name;4040+ enum rfkill_type type;4141+};4242+4343+#endif /* __RFKILL_GPIO_H */
+6-2
include/net/cfg80211.h
···531531 * @tx_retries: cumulative retry counts532532 * @tx_failed: number of failed transmissions (retries exceeded, no ACK)533533 * @rx_dropped_misc: Dropped for un-specified reason.534534+ * @bss_param: current BSS parameters534535 * @generation: generation number for nl80211 dumps.535536 * This number should increase every time the list of stations536537 * changes, i.e. when a station is added or removed, so that···15381537 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.15391538 * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing15401539 * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.15411541- * @WIPHY_FLAG_SCHED_SCAN: The device supports scheduled scans.15401540+ * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans.15421541 */15431542enum wiphy_flags {15441543 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0),···28792878 * cfg80211_roamed - notify cfg80211 of roaming28802879 *28812880 * @dev: network device28812881+ * @channel: the channel of the new AP28822882 * @bssid: the BSSID of the new AP28832883 * @req_ie: association request IEs (maybe be %NULL)28842884 * @req_ie_len: association request IEs length···28902888 * It should be called by the underlying driver whenever it roamed28912889 * from one AP to another while connected.28922890 */28932893-void cfg80211_roamed(struct net_device *dev, const u8 *bssid,28912891+void cfg80211_roamed(struct net_device *dev,28922892+ struct ieee80211_channel *channel,28932893+ const u8 *bssid,28942894 const u8 *req_ie, size_t req_ie_len,28952895 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);28962896
+2-2
net/mac80211/iface.c
···384384 int i;385385 enum nl80211_channel_type orig_ct;386386387387+ clear_bit(SDATA_STATE_RUNNING, &sdata->state);388388+387389 if (local->scan_sdata == sdata)388390 ieee80211_scan_cancel(local);389389-390390- clear_bit(SDATA_STATE_RUNNING, &sdata->state);391391392392 /*393393 * Stop TX on this interface first.
+19-3
net/mac80211/main.c
···752752 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);753753 hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR);754754755755- /* mac80211 doesn't support more than 1 channel */756756- for (i = 0; i < hw->wiphy->n_iface_combinations; i++)757757- if (hw->wiphy->iface_combinations[i].num_different_channels > 1)755755+ /*756756+ * mac80211 doesn't support more than 1 channel, and also not more757757+ * than one IBSS interface758758+ */759759+ for (i = 0; i < hw->wiphy->n_iface_combinations; i++) {760760+ const struct ieee80211_iface_combination *c;761761+ int j;762762+763763+ c = &hw->wiphy->iface_combinations[i];764764+765765+ if (c->num_different_channels > 1)758766 return -EINVAL;767767+768768+ for (j = 0; j < c->n_limits; j++)769769+ if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) &&770770+ c->limits[j].max > 1)771771+ return -EINVAL;772772+ }759773760774#ifndef CONFIG_MAC80211_MESH761775 /* mesh depends on Kconfig, but drivers should set it if they want */···10901076 ieee80211s_stop();1091107710921078 ieee80211_iface_exit();10791079+10801080+ rcu_barrier();10931081}1094108210951083
+3-4
net/mac80211/mesh.h
···120120 * buckets121121 * @mean_chain_len: maximum average length for the hash buckets' list, if it is122122 * reached, the table will grow123123+ * rcu_head: RCU head to free the table123124 */124125struct mesh_table {125126 /* Number of buckets will be 2^N */···133132 int (*copy_node) (struct hlist_node *p, struct mesh_table *newtbl);134133 int size_order;135134 int mean_chain_len;135135+136136+ struct rcu_head rcu_head;136137};137138138139/* Recent multicast cache */···288285{289286 return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP;290287}291291-292292-#define for_each_mesh_entry(x, p, node, i) \293293- for (i = 0; i <= x->hash_mask; i++) \294294- hlist_for_each_entry_rcu(node, p, &x->hash_buckets[i], list)295288296289void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local);297290
···719719 * without scheduling a new work720720 */721721 do {722722+ if (!ieee80211_sdata_running(sdata)) {723723+ aborted = true;724724+ goto out_complete;725725+ }726726+722727 switch (local->next_scan_state) {723728 case SCAN_DECISION:724729 /* if no more bands/channels left, complete scan */
+9
net/rfkill/Kconfig
···33333434 To compile this driver as a module, choose M here: the module will3535 be called rfkill-regulator.3636+3737+config RFKILL_GPIO3838+ tristate "GPIO RFKILL driver"3939+ depends on RFKILL && GPIOLIB && HAVE_CLK4040+ default n4141+ help4242+ If you say yes here you get support of a generic gpio RFKILL4343+ driver. The platform should fill in the appropriate fields in the4444+ rfkill_gpio_platform_data structure and pass that to the driver.
···11+/*22+ * Copyright (c) 2011, NVIDIA Corporation.33+ *44+ * This program is free software; you can redistribute it and/or modify55+ * it under the terms of the GNU General Public License as published by66+ * the Free Software Foundation; either version 2 of the License, or77+ * (at your option) any later version.88+ *99+ * This program is distributed in the hope that it will be useful, but WITHOUT1010+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1111+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1212+ * more details.1313+ *1414+ * You should have received a copy of the GNU General Public License along1515+ * with this program; if not, write to the Free Software Foundation, Inc.,1616+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.1717+ */1818+1919+#include <linux/gpio.h>2020+#include <linux/init.h>2121+#include <linux/kernel.h>2222+#include <linux/module.h>2323+#include <linux/rfkill.h>2424+#include <linux/platform_device.h>2525+#include <linux/clk.h>2626+#include <linux/slab.h>2727+2828+#include <linux/rfkill-gpio.h>2929+3030+enum rfkill_gpio_clk_state {3131+ UNSPECIFIED = 0,3232+ PWR_ENABLED,3333+ PWR_DISABLED3434+};3535+3636+#define PWR_CLK_SET(_RF, _EN) \3737+ ((_RF)->pwr_clk_enabled = (!(_EN) ? PWR_ENABLED : PWR_DISABLED))3838+#define PWR_CLK_ENABLED(_RF) ((_RF)->pwr_clk_enabled == PWR_ENABLED)3939+#define PWR_CLK_DISABLED(_RF) ((_RF)->pwr_clk_enabled != PWR_ENABLED)4040+4141+struct rfkill_gpio_data {4242+ struct rfkill_gpio_platform_data *pdata;4343+ struct rfkill *rfkill_dev;4444+ char *reset_name;4545+ char *shutdown_name;4646+ enum rfkill_gpio_clk_state pwr_clk_enabled;4747+ struct clk *pwr_clk;4848+};4949+5050+static int rfkill_gpio_set_power(void *data, bool blocked)5151+{5252+ struct rfkill_gpio_data *rfkill = data;5353+5454+ if (blocked) {5555+ if (gpio_is_valid(rfkill->pdata->shutdown_gpio))5656+ gpio_direction_output(rfkill->pdata->shutdown_gpio, 0);5757+ if (gpio_is_valid(rfkill->pdata->reset_gpio))5858+ gpio_direction_output(rfkill->pdata->reset_gpio, 0);5959+ if (rfkill->pwr_clk && PWR_CLK_ENABLED(rfkill))6060+ clk_disable(rfkill->pwr_clk);6161+ } else {6262+ if (rfkill->pwr_clk && PWR_CLK_DISABLED(rfkill))6363+ clk_enable(rfkill->pwr_clk);6464+ if (gpio_is_valid(rfkill->pdata->reset_gpio))6565+ gpio_direction_output(rfkill->pdata->reset_gpio, 1);6666+ if (gpio_is_valid(rfkill->pdata->shutdown_gpio))6767+ gpio_direction_output(rfkill->pdata->shutdown_gpio, 1);6868+ }6969+7070+ if (rfkill->pwr_clk)7171+ PWR_CLK_SET(rfkill, blocked);7272+7373+ return 0;7474+}7575+7676+static const struct rfkill_ops rfkill_gpio_ops = {7777+ .set_block = rfkill_gpio_set_power,7878+};7979+8080+static int rfkill_gpio_probe(struct platform_device *pdev)8181+{8282+ struct rfkill_gpio_data *rfkill;8383+ struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;8484+ int ret = 0;8585+ int len = 0;8686+8787+ if (!pdata) {8888+ pr_warn("%s: No platform data specified\n", __func__);8989+ return -EINVAL;9090+ }9191+9292+ /* make sure at-least one of the GPIO is defined and that9393+ * a name is specified for this instance */9494+ if (!pdata->name || (!gpio_is_valid(pdata->reset_gpio) &&9595+ !gpio_is_valid(pdata->shutdown_gpio))) {9696+ pr_warn("%s: invalid platform data\n", __func__);9797+ return -EINVAL;9898+ }9999+100100+ rfkill = kzalloc(sizeof(*rfkill), GFP_KERNEL);101101+ if (!rfkill)102102+ return -ENOMEM;103103+104104+ rfkill->pdata = pdata;105105+106106+ len = strlen(pdata->name);107107+ rfkill->reset_name = kzalloc(len + 7, GFP_KERNEL);108108+ if (!rfkill->reset_name) {109109+ ret = -ENOMEM;110110+ goto fail_alloc;111111+ }112112+113113+ rfkill->shutdown_name = kzalloc(len + 10, GFP_KERNEL);114114+ if (!rfkill->shutdown_name) {115115+ ret = -ENOMEM;116116+ goto fail_reset_name;117117+ }118118+119119+ snprintf(rfkill->reset_name, len + 6 , "%s_reset", pdata->name);120120+ snprintf(rfkill->shutdown_name, len + 9, "%s_shutdown", pdata->name);121121+122122+ if (pdata->power_clk_name) {123123+ rfkill->pwr_clk = clk_get(&pdev->dev, pdata->power_clk_name);124124+ if (IS_ERR(rfkill->pwr_clk)) {125125+ pr_warn("%s: can't find pwr_clk.\n", __func__);126126+ goto fail_shutdown_name;127127+ }128128+ }129129+130130+ if (gpio_is_valid(pdata->reset_gpio)) {131131+ ret = gpio_request(pdata->reset_gpio, rfkill->reset_name);132132+ if (ret) {133133+ pr_warn("%s: failed to get reset gpio.\n", __func__);134134+ goto fail_clock;135135+ }136136+ }137137+138138+ if (gpio_is_valid(pdata->shutdown_gpio)) {139139+ ret = gpio_request(pdata->shutdown_gpio, rfkill->shutdown_name);140140+ if (ret) {141141+ pr_warn("%s: failed to get shutdown gpio.\n", __func__);142142+ goto fail_reset;143143+ }144144+ }145145+146146+ rfkill->rfkill_dev = rfkill_alloc(pdata->name, &pdev->dev, pdata->type,147147+ &rfkill_gpio_ops, rfkill);148148+ if (!rfkill->rfkill_dev)149149+ goto fail_shutdown;150150+151151+ ret = rfkill_register(rfkill->rfkill_dev);152152+ if (ret < 0)153153+ goto fail_rfkill;154154+155155+ platform_set_drvdata(pdev, rfkill);156156+157157+ dev_info(&pdev->dev, "%s device registered.\n", pdata->name);158158+159159+ return 0;160160+161161+fail_rfkill:162162+ rfkill_destroy(rfkill->rfkill_dev);163163+fail_shutdown:164164+ if (gpio_is_valid(pdata->shutdown_gpio))165165+ gpio_free(pdata->shutdown_gpio);166166+fail_reset:167167+ if (gpio_is_valid(pdata->reset_gpio))168168+ gpio_free(pdata->reset_gpio);169169+fail_clock:170170+ if (rfkill->pwr_clk)171171+ clk_put(rfkill->pwr_clk);172172+fail_shutdown_name:173173+ kfree(rfkill->shutdown_name);174174+fail_reset_name:175175+ kfree(rfkill->reset_name);176176+fail_alloc:177177+ kfree(rfkill);178178+179179+ return ret;180180+}181181+182182+static int rfkill_gpio_remove(struct platform_device *pdev)183183+{184184+ struct rfkill_gpio_data *rfkill = platform_get_drvdata(pdev);185185+186186+ rfkill_unregister(rfkill->rfkill_dev);187187+ rfkill_destroy(rfkill->rfkill_dev);188188+ if (gpio_is_valid(rfkill->pdata->shutdown_gpio))189189+ gpio_free(rfkill->pdata->shutdown_gpio);190190+ if (gpio_is_valid(rfkill->pdata->reset_gpio))191191+ gpio_free(rfkill->pdata->reset_gpio);192192+ if (rfkill->pwr_clk && PWR_CLK_ENABLED(rfkill))193193+ clk_disable(rfkill->pwr_clk);194194+ if (rfkill->pwr_clk)195195+ clk_put(rfkill->pwr_clk);196196+ kfree(rfkill->shutdown_name);197197+ kfree(rfkill->reset_name);198198+ kfree(rfkill);199199+200200+ return 0;201201+}202202+203203+static struct platform_driver rfkill_gpio_driver = {204204+ .probe = rfkill_gpio_probe,205205+ .remove = __devexit_p(rfkill_gpio_remove),206206+ .driver = {207207+ .name = "rfkill_gpio",208208+ .owner = THIS_MODULE,209209+ },210210+};211211+212212+static int __init rfkill_gpio_init(void)213213+{214214+ return platform_driver_register(&rfkill_gpio_driver);215215+}216216+217217+static void __exit rfkill_gpio_exit(void)218218+{219219+ platform_driver_unregister(&rfkill_gpio_driver);220220+}221221+222222+module_init(rfkill_gpio_init);223223+module_exit(rfkill_gpio_exit);224224+225225+MODULE_DESCRIPTION("gpio rfkill");226226+MODULE_AUTHOR("NVIDIA");227227+MODULE_LICENSE("GPL");