Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (78 commits)
AX.25: Fix sysctl registration if !CONFIG_AX25_DAMA_SLAVE
pktgen: mac count
pktgen: random flow
bridge: Eliminate unnecessary forward delay
bridge: fix compile warning in net/bridge/br_netfilter.c
ipv4: remove unused field in struct flowi (include/net/flow.h).
tg3: Fix 'scheduling while atomic' errors
net: Kill plain NET_XMIT_BYPASS.
net_sched: Add qdisc __NET_XMIT_BYPASS flag
net_sched: Add qdisc __NET_XMIT_STOLEN flag
iwl3945: fix merge mistake for packet injection
iwlwifi: grap nic access before accessing periphery registers
iwlwifi: decrement rx skb counter in scan abort handler
iwlwifi: fix unhandled interrupt when HW rfkill is on
iwlwifi: implement iwl5000_calc_rssi
iwlwifi: memory allocation optimization
iwlwifi: HW bug fixes
p54: Fix potential concurrent access to private data
rt2x00: Disable link tuning in rt2500usb
iwlwifi: Don't use buffer allocated on the stack for led names
...

+2168 -1293
+4 -16
drivers/net/tg3.c
··· 7687 7687 */ 7688 7688 static int tg3_init_hw(struct tg3 *tp, int reset_phy) 7689 7689 { 7690 - int err; 7691 - 7692 - /* Force the chip into D0. */ 7693 - err = tg3_set_power_state(tp, PCI_D0); 7694 - if (err) 7695 - goto out; 7696 - 7697 7690 tg3_switch_clocks(tp); 7698 7691 7699 7692 tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); 7700 7693 7701 - err = tg3_reset_hw(tp, reset_phy); 7702 - 7703 - out: 7704 - return err; 7694 + return tg3_reset_hw(tp, reset_phy); 7705 7695 } 7706 7696 7707 7697 #define TG3_STAT_ADD32(PSTAT, REG) \ ··· 8006 8016 8007 8017 netif_carrier_off(tp->dev); 8008 8018 8009 - tg3_full_lock(tp, 0); 8010 - 8011 8019 err = tg3_set_power_state(tp, PCI_D0); 8012 - if (err) { 8013 - tg3_full_unlock(tp); 8020 + if (err) 8014 8021 return err; 8015 - } 8022 + 8023 + tg3_full_lock(tp, 0); 8016 8024 8017 8025 tg3_disable_ints(tp); 8018 8026 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
+1
drivers/net/wireless/Kconfig
··· 649 649 Trendnet TEW-424UB 650 650 ASUS P5B Deluxe 651 651 Toshiba Satellite Pro series of laptops 652 + Asus Wireless Link 652 653 653 654 Thanks to Realtek for their support! 654 655
+5 -3
drivers/net/wireless/ath5k/ath5k.h
··· 186 186 #define AR5K_SREV_RAD_2111 0x20 187 187 #define AR5K_SREV_RAD_5112 0x30 188 188 #define AR5K_SREV_RAD_5112A 0x35 189 + #define AR5K_SREV_RAD_5112B 0x36 189 190 #define AR5K_SREV_RAD_2112 0x40 190 191 #define AR5K_SREV_RAD_2112A 0x45 191 - #define AR5K_SREV_RAD_SC0 0x56 /* Found on 2413/2414 */ 192 - #define AR5K_SREV_RAD_SC1 0x63 /* Found on 5413/5414 */ 193 - #define AR5K_SREV_RAD_SC2 0xa2 /* Found on 2424-5/5424 */ 192 + #define AR5K_SREV_RAD_2112B 0x46 193 + #define AR5K_SREV_RAD_SC0 0x50 /* Found on 2413/2414 */ 194 + #define AR5K_SREV_RAD_SC1 0x60 /* Found on 5413/5414 */ 195 + #define AR5K_SREV_RAD_SC2 0xa0 /* Found on 2424-5/5424 */ 194 196 #define AR5K_SREV_RAD_5133 0xc0 /* MIMO found on 5418 */ 195 197 196 198 /* IEEE defs */
+1
drivers/net/wireless/ath5k/base.c
··· 2170 2170 2171 2171 ath5k_hw_set_intr(ah, 0); 2172 2172 sc->bmisscount = 0; 2173 + sc->imask &= ~(AR5K_INT_BMISS | AR5K_INT_SWBA); 2173 2174 2174 2175 if (sc->opmode == IEEE80211_IF_TYPE_STA) { 2175 2176 sc->imask |= AR5K_INT_BMISS;
+1 -1
drivers/net/wireless/ath5k/debug.c
··· 129 129 REG_STRUCT_INIT(AR5K_CPC1), 130 130 REG_STRUCT_INIT(AR5K_CPC2), 131 131 REG_STRUCT_INIT(AR5K_CPC3), 132 - REG_STRUCT_INIT(AR5K_CPCORN), 132 + REG_STRUCT_INIT(AR5K_CPCOVF), 133 133 REG_STRUCT_INIT(AR5K_RESET_CTL), 134 134 REG_STRUCT_INIT(AR5K_SLEEP_CTL), 135 135 REG_STRUCT_INIT(AR5K_INTPEND),
-1
drivers/net/wireless/ath5k/debug.h
··· 63 63 64 64 struct ath5k_softc; 65 65 struct ath5k_hw; 66 - struct ieee80211_hw_mode; 67 66 struct sk_buff; 68 67 struct ath5k_buf; 69 68
+158 -99
drivers/net/wireless/ath5k/hw.c
··· 139 139 for (c = 0; c < 2; c++) { 140 140 141 141 cur_reg = regs[c]; 142 + 143 + /* Save previous value */ 142 144 init_val = ath5k_hw_reg_read(ah, cur_reg); 143 145 144 146 for (i = 0; i < 256; i++) { ··· 172 170 var_pattern = 0x003b080f; 173 171 ath5k_hw_reg_write(ah, var_pattern, cur_reg); 174 172 } 173 + 174 + /* Restore previous value */ 175 + ath5k_hw_reg_write(ah, init_val, cur_reg); 176 + 175 177 } 176 178 177 179 return 0; ··· 293 287 /* Identify the radio chip*/ 294 288 if (ah->ah_version == AR5K_AR5210) { 295 289 ah->ah_radio = AR5K_RF5110; 296 - } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112) { 297 - ah->ah_radio = AR5K_RF5111; 298 - ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5111; 299 - } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC0) { 300 - 301 - ah->ah_radio = AR5K_RF5112; 302 - 303 - if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112A) { 304 - ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112; 305 - } else { 306 - ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A; 307 - } 308 - 309 - } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC1) { 310 - ah->ah_radio = AR5K_RF2413; 311 - ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A; 312 - } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC2) { 313 - ah->ah_radio = AR5K_RF5413; 314 - ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A; 315 - } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5133) { 316 - 317 - /* AR5424 */ 318 - if (srev >= AR5K_SREV_VER_AR5424) { 319 - ah->ah_radio = AR5K_RF5413; 320 - ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5424; 321 - /* AR2424 */ 322 - } else { 323 - ah->ah_radio = AR5K_RF2413; /* For testing */ 324 - ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A; 325 - } 326 - 327 290 /* 328 - * Register returns 0x4 for radio revision 291 + * Register returns 0x0/0x04 for radio revision 329 292 * so ath5k_hw_radio_revision doesn't parse the value 330 293 * correctly. For now we are based on mac's srev to 331 294 * identify RF2425 radio. 332 295 */ 333 296 } else if (srev == AR5K_SREV_VER_AR2425) { 334 297 ah->ah_radio = AR5K_RF2425; 298 + ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2425; 299 + } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112) { 300 + ah->ah_radio = AR5K_RF5111; 301 + ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5111; 302 + } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC0) { 303 + ah->ah_radio = AR5K_RF5112; 335 304 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112; 305 + } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC1) { 306 + ah->ah_radio = AR5K_RF2413; 307 + ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2413; 308 + } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC2) { 309 + ah->ah_radio = AR5K_RF5413; 310 + ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413; 311 + } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5133) { 312 + /* AR5424 */ 313 + if (srev >= AR5K_SREV_VER_AR5424) { 314 + ah->ah_radio = AR5K_RF5413; 315 + ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413; 316 + /* AR2424 */ 317 + } else { 318 + ah->ah_radio = AR5K_RF2413; /* For testing */ 319 + ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2413; 320 + } 336 321 } 337 - 338 322 ah->ah_phy = AR5K_PHY(0); 339 323 340 324 /* 341 - * Identify AR5212-based PCI-E cards 342 - * And write some initial settings. 343 - * 344 - * (doing a "strings" on ndis driver 345 - * -ar5211.sys- reveals the following 346 - * pci-e related functions: 347 - * 348 - * pcieClockReq 349 - * pcieRxErrNotify 350 - * pcieL1SKPEnable 351 - * pcieAspm 352 - * pcieDisableAspmOnRfWake 353 - * pciePowerSaveEnable 354 - * 355 - * I guess these point to ClockReq but 356 - * i'm not sure.) 325 + * Write PCI-E power save settings 357 326 */ 358 327 if ((ah->ah_version == AR5K_AR5212) && (pdev->is_pcie)) { 359 328 ath5k_hw_reg_write(ah, 0x9248fc00, 0x4080); ··· 350 369 if (ret) 351 370 goto err_free; 352 371 372 + /* Write AR5K_PCICFG_UNK on 2112B and later chips */ 373 + if (ah->ah_radio_5ghz_revision > AR5K_SREV_RAD_2112B || 374 + srev > AR5K_SREV_VER_AR2413) { 375 + ath5k_hw_reg_write(ah, AR5K_PCICFG_UNK, AR5K_PCICFG); 376 + } 377 + 353 378 /* 354 379 * Get card capabilities, values, ... 355 380 */ 356 - 357 381 ret = ath5k_eeprom_init(ah); 358 382 if (ret) { 359 383 ATH5K_ERR(sc, "unable to init EEPROM\n"); ··· 829 843 * Write some more initial register settings 830 844 */ 831 845 if (ah->ah_version == AR5K_AR5212) { 832 - ath5k_hw_reg_write(ah, 0x0002a002, AR5K_PHY(11)); 846 + ath5k_hw_reg_write(ah, 0x0002a002, 0x982c); 833 847 834 848 if (channel->hw_value == CHANNEL_G) 835 849 if (ah->ah_mac_srev < AR5K_SREV_VER_AR2413) 836 850 ath5k_hw_reg_write(ah, 0x00f80d80, 837 - AR5K_PHY(83)); 851 + 0x994c); 838 852 else if (ah->ah_mac_srev < AR5K_SREV_VER_AR2424) 839 853 ath5k_hw_reg_write(ah, 0x00380140, 840 - AR5K_PHY(83)); 854 + 0x994c); 841 855 else if (ah->ah_mac_srev < AR5K_SREV_VER_AR2425) 842 856 ath5k_hw_reg_write(ah, 0x00fc0ec0, 843 - AR5K_PHY(83)); 857 + 0x994c); 844 858 else /* 2425 */ 845 859 ath5k_hw_reg_write(ah, 0x00fc0fc0, 846 - AR5K_PHY(83)); 860 + 0x994c); 847 861 else 848 - ath5k_hw_reg_write(ah, 0x00000000, 849 - AR5K_PHY(83)); 862 + ath5k_hw_reg_write(ah, 0x00000000, 0x994c); 850 863 851 - ath5k_hw_reg_write(ah, 0x000009b5, 0xa228); 852 - ath5k_hw_reg_write(ah, 0x0000000f, 0x8060); 864 + /* Some bits are disabled here, we know nothing about 865 + * register 0xa228 yet, most of the times this ends up 866 + * with a value 0x9b5 -haven't seen any dump with 867 + * a different value- */ 868 + /* Got this from decompiling binary HAL */ 869 + data = ath5k_hw_reg_read(ah, 0xa228); 870 + data &= 0xfffffdff; 871 + ath5k_hw_reg_write(ah, data, 0xa228); 872 + 873 + data = ath5k_hw_reg_read(ah, 0xa228); 874 + data &= 0xfffe03ff; 875 + ath5k_hw_reg_write(ah, data, 0xa228); 876 + data = 0; 877 + 878 + /* Just write 0x9b5 ? */ 879 + /* ath5k_hw_reg_write(ah, 0x000009b5, 0xa228); */ 880 + ath5k_hw_reg_write(ah, 0x0000000f, AR5K_SEQ_MASK); 853 881 ath5k_hw_reg_write(ah, 0x00000000, 0xa254); 854 882 ath5k_hw_reg_write(ah, 0x0000000e, AR5K_PHY_SCAL); 855 883 } ··· 879 879 else 880 880 data = 0xffb80d20; 881 881 ath5k_hw_reg_write(ah, data, AR5K_PHY_FRAME_CTL); 882 + data = 0; 882 883 } 883 884 884 885 /* ··· 899 898 900 899 /* 901 900 * Write RF registers 902 - * TODO:Does this work on 5211 (5111) ? 903 901 */ 904 902 ret = ath5k_hw_rfregs(ah, channel, mode); 905 903 if (ret) ··· 935 935 return ret; 936 936 937 937 /* Set antenna mode */ 938 - AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x44), 938 + AR5K_REG_MASKED_BITS(ah, AR5K_PHY_ANT_CTL, 939 939 ah->ah_antenna[ee_mode][0], 0xfffffc06); 940 940 941 941 /* ··· 965 965 966 966 ath5k_hw_reg_write(ah, 967 967 AR5K_PHY_NF_SVAL(ee->ee_noise_floor_thr[ee_mode]), 968 - AR5K_PHY(0x5a)); 968 + AR5K_PHY_NFTHRES); 969 969 970 - AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x11), 970 + AR5K_REG_MASKED_BITS(ah, AR5K_PHY_SETTLING, 971 971 (ee->ee_switch_settling[ee_mode] << 7) & 0x3f80, 972 972 0xffffc07f); 973 - AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x12), 973 + AR5K_REG_MASKED_BITS(ah, AR5K_PHY_GAIN, 974 974 (ee->ee_ant_tx_rx[ee_mode] << 12) & 0x3f000, 975 975 0xfffc0fff); 976 - AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x14), 976 + AR5K_REG_MASKED_BITS(ah, AR5K_PHY_DESIRED_SIZE, 977 977 (ee->ee_adc_desired_size[ee_mode] & 0x00ff) | 978 978 ((ee->ee_pga_desired_size[ee_mode] << 8) & 0xff00), 979 979 0xffff0000); ··· 982 982 (ee->ee_tx_end2xpa_disable[ee_mode] << 24) | 983 983 (ee->ee_tx_end2xpa_disable[ee_mode] << 16) | 984 984 (ee->ee_tx_frm2xpa_enable[ee_mode] << 8) | 985 - (ee->ee_tx_frm2xpa_enable[ee_mode]), AR5K_PHY(0x0d)); 985 + (ee->ee_tx_frm2xpa_enable[ee_mode]), AR5K_PHY_RF_CTL4); 986 986 987 - AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x0a), 987 + AR5K_REG_MASKED_BITS(ah, AR5K_PHY_RF_CTL3, 988 988 ee->ee_tx_end2xlna_enable[ee_mode] << 8, 0xffff00ff); 989 - AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x19), 989 + AR5K_REG_MASKED_BITS(ah, AR5K_PHY_NF, 990 990 (ee->ee_thr_62[ee_mode] << 12) & 0x7f000, 0xfff80fff); 991 - AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x49), 4, 0xffffff01); 991 + AR5K_REG_MASKED_BITS(ah, AR5K_PHY_OFDM_SELFCORR, 4, 0xffffff01); 992 992 993 993 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, 994 994 AR5K_PHY_IQ_CORR_ENABLE | ··· 1063 1063 ath5k_hw_reg_write(ah, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ACT); 1064 1064 1065 1065 /* 1066 - * 5111/5112 Specific 1066 + * On 5211+ read activation -> rx delay 1067 + * and use it. 1067 1068 */ 1068 1069 if (ah->ah_version != AR5K_AR5210) { 1069 1070 data = ath5k_hw_reg_read(ah, AR5K_PHY_RX_DELAY) & ··· 1072 1071 data = (channel->hw_value & CHANNEL_CCK) ? 1073 1072 ((data << 2) / 22) : (data / 10); 1074 1073 1075 - udelay(100 + data); 1074 + udelay(100 + (2 * data)); 1075 + data = 0; 1076 1076 } else { 1077 1077 mdelay(1); 1078 1078 } 1079 1079 1080 1080 /* 1081 - * Enable calibration and wait until completion 1081 + * Perform ADC test (?) 1082 + */ 1083 + data = ath5k_hw_reg_read(ah, AR5K_PHY_TST1); 1084 + ath5k_hw_reg_write(ah, AR5K_PHY_TST1_TXHOLD, AR5K_PHY_TST1); 1085 + for (i = 0; i <= 20; i++) { 1086 + if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10)) 1087 + break; 1088 + udelay(200); 1089 + } 1090 + ath5k_hw_reg_write(ah, data, AR5K_PHY_TST1); 1091 + data = 0; 1092 + 1093 + /* 1094 + * Start automatic gain calibration 1095 + * 1096 + * During AGC calibration RX path is re-routed to 1097 + * a signal detector so we don't receive anything. 1098 + * 1099 + * This method is used to calibrate some static offsets 1100 + * used together with on-the fly I/Q calibration (the 1101 + * one performed via ath5k_hw_phy_calibrate), that doesn't 1102 + * interrupt rx path. 1103 + * 1104 + * If we are in a noisy environment AGC calibration may time 1105 + * out. 1082 1106 */ 1083 1107 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL, 1084 1108 AR5K_PHY_AGCCTL_CAL); 1085 1109 1086 - if (ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL, 1087 - AR5K_PHY_AGCCTL_CAL, 0, false)) { 1088 - ATH5K_ERR(ah->ah_sc, "calibration timeout (%uMHz)\n", 1089 - channel->center_freq); 1090 - return -EAGAIN; 1091 - } 1092 - 1093 - ret = ath5k_hw_noise_floor_calibration(ah, channel->center_freq); 1094 - if (ret) 1095 - return ret; 1096 - 1110 + /* At the same time start I/Q calibration for QAM constellation 1111 + * -no need for CCK- */ 1097 1112 ah->ah_calibration = false; 1098 - 1099 - /* A and G modes can use QAM modulation which requires enabling 1100 - * I and Q calibration. Don't bother in B mode. */ 1101 1113 if (!(mode == AR5K_MODE_11B)) { 1102 1114 ah->ah_calibration = true; 1103 1115 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, ··· 1118 1104 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, 1119 1105 AR5K_PHY_IQ_RUN); 1120 1106 } 1107 + 1108 + /* Wait for gain calibration to finish (we check for I/Q calibration 1109 + * during ath5k_phy_calibrate) */ 1110 + if (ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL, 1111 + AR5K_PHY_AGCCTL_CAL, 0, false)) { 1112 + ATH5K_ERR(ah->ah_sc, "gain calibration timeout (%uMHz)\n", 1113 + channel->center_freq); 1114 + return -EAGAIN; 1115 + } 1116 + 1117 + /* 1118 + * Start noise floor calibration 1119 + * 1120 + * If we run NF calibration before AGC, it always times out. 1121 + * Binary HAL starts NF and AGC calibration at the same time 1122 + * and only waits for AGC to finish. I believe that's wrong because 1123 + * during NF calibration, rx path is also routed to a detector, so if 1124 + * it doesn't finish we won't have RX. 1125 + * 1126 + * XXX: Find an interval that's OK for all cards... 1127 + */ 1128 + ret = ath5k_hw_noise_floor_calibration(ah, channel->center_freq); 1129 + if (ret) 1130 + return ret; 1121 1131 1122 1132 /* 1123 1133 * Reset queues and start beacon timers at the end of the reset routine ··· 1192 1154 ath5k_hw_reg_write(ah, AR5K_PHY_SCLOCK_32MHZ, AR5K_PHY_SCLOCK); 1193 1155 ath5k_hw_reg_write(ah, AR5K_PHY_SDELAY_32MHZ, AR5K_PHY_SDELAY); 1194 1156 ath5k_hw_reg_write(ah, ah->ah_phy_spending, AR5K_PHY_SPENDING); 1157 + 1158 + data = ath5k_hw_reg_read(ah, AR5K_USEC_5211) & 0xffffc07f ; 1159 + data |= (ah->ah_phy_spending == AR5K_PHY_SPENDING_18) ? 1160 + 0x00000f80 : 0x00001380 ; 1161 + ath5k_hw_reg_write(ah, data, AR5K_USEC_5211); 1162 + data = 0; 1195 1163 } 1196 1164 1197 1165 if (ah->ah_version == AR5K_AR5212) { ··· 1270 1226 bool set_chip, u16 sleep_duration) 1271 1227 { 1272 1228 unsigned int i; 1273 - u32 staid; 1229 + u32 staid, data; 1274 1230 1275 1231 ATH5K_TRACE(ah->ah_sc); 1276 1232 staid = ath5k_hw_reg_read(ah, AR5K_STA_ID1); ··· 1282 1238 case AR5K_PM_NETWORK_SLEEP: 1283 1239 if (set_chip) 1284 1240 ath5k_hw_reg_write(ah, 1285 - AR5K_SLEEP_CTL_SLE | sleep_duration, 1241 + AR5K_SLEEP_CTL_SLE_ALLOW | 1242 + sleep_duration, 1286 1243 AR5K_SLEEP_CTL); 1287 1244 1288 1245 staid |= AR5K_STA_ID1_PWR_SV; ··· 1298 1253 break; 1299 1254 1300 1255 case AR5K_PM_AWAKE: 1256 + 1257 + staid &= ~AR5K_STA_ID1_PWR_SV; 1258 + 1301 1259 if (!set_chip) 1302 1260 goto commit; 1303 1261 1304 - ath5k_hw_reg_write(ah, AR5K_SLEEP_CTL_SLE_WAKE, 1305 - AR5K_SLEEP_CTL); 1262 + /* Preserve sleep duration */ 1263 + data = ath5k_hw_reg_read(ah, AR5K_SLEEP_CTL); 1264 + if( data & 0xffc00000 ){ 1265 + data = 0; 1266 + } else { 1267 + data = data & 0xfffcffff; 1268 + } 1306 1269 1307 - for (i = 5000; i > 0; i--) { 1270 + ath5k_hw_reg_write(ah, data, AR5K_SLEEP_CTL); 1271 + udelay(15); 1272 + 1273 + for (i = 50; i > 0; i--) { 1308 1274 /* Check if the chip did wake up */ 1309 1275 if ((ath5k_hw_reg_read(ah, AR5K_PCICFG) & 1310 1276 AR5K_PCICFG_SPWR_DN) == 0) ··· 1323 1267 1324 1268 /* Wait a bit and retry */ 1325 1269 udelay(200); 1326 - ath5k_hw_reg_write(ah, AR5K_SLEEP_CTL_SLE_WAKE, 1327 - AR5K_SLEEP_CTL); 1270 + ath5k_hw_reg_write(ah, data, AR5K_SLEEP_CTL); 1328 1271 } 1329 1272 1330 1273 /* Fail if the chip didn't wake up */ 1331 1274 if (i <= 0) 1332 1275 return -EIO; 1333 1276 1334 - staid &= ~AR5K_STA_ID1_PWR_SV; 1335 1277 break; 1336 1278 1337 1279 default: ··· 1358 1304 { 1359 1305 ATH5K_TRACE(ah->ah_sc); 1360 1306 ath5k_hw_reg_write(ah, AR5K_CR_RXE, AR5K_CR); 1307 + ath5k_hw_reg_read(ah, AR5K_CR); 1361 1308 } 1362 1309 1363 1310 /* ··· 1445 1390 } 1446 1391 /* Start queue */ 1447 1392 ath5k_hw_reg_write(ah, tx_queue, AR5K_CR); 1393 + ath5k_hw_reg_read(ah, AR5K_CR); 1448 1394 } else { 1449 1395 /* Return if queue is disabled */ 1450 1396 if (AR5K_REG_READ_Q(ah, AR5K_QCU_TXD, queue)) ··· 1743 1687 * (they will be re-enabled afterwards). 1744 1688 */ 1745 1689 ath5k_hw_reg_write(ah, AR5K_IER_DISABLE, AR5K_IER); 1690 + ath5k_hw_reg_read(ah, AR5K_IER); 1746 1691 1747 1692 old_mask = ah->ah_imr; 1748 1693 ··· 3420 3363 ath5k_hw_reg_write(ah, ah->ah_turbo ? 3421 3364 AR5K_INIT_PROTO_TIME_CNTRL_TURBO : 3422 3365 AR5K_INIT_PROTO_TIME_CNTRL, AR5K_IFS1); 3423 - /* Set PHY register 0x9844 (??) */ 3366 + /* Set AR5K_PHY_SETTLING */ 3424 3367 ath5k_hw_reg_write(ah, ah->ah_turbo ? 3425 - (ath5k_hw_reg_read(ah, AR5K_PHY(17)) & ~0x7F) | 0x38 : 3426 - (ath5k_hw_reg_read(ah, AR5K_PHY(17)) & ~0x7F) | 0x1C, 3427 - AR5K_PHY(17)); 3368 + (ath5k_hw_reg_read(ah, AR5K_PHY_SETTLING) & ~0x7F) 3369 + | 0x38 : 3370 + (ath5k_hw_reg_read(ah, AR5K_PHY_SETTLING) & ~0x7F) 3371 + | 0x1C, 3372 + AR5K_PHY_SETTLING); 3428 3373 /* Set Frame Control Register */ 3429 3374 ath5k_hw_reg_write(ah, ah->ah_turbo ? 3430 3375 (AR5K_PHY_FRAME_CTL_INI | AR5K_PHY_TURBO_MODE | ··· 3547 3488 if (tq->tqi_flags & AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE) 3548 3489 AR5K_REG_ENABLE_BITS(ah, 3549 3490 AR5K_QUEUE_MISC(queue), 3550 - AR5K_QCU_MISC_TXE); 3491 + AR5K_QCU_MISC_RDY_VEOL_POLICY); 3551 3492 } 3552 3493 3553 3494 if (tq->tqi_flags & AR5K_TXQ_FLAG_BACKOFF_DISABLE)
+2 -2
drivers/net/wireless/ath5k/initvals.c
··· 489 489 { AR5K_QUEUE_TXDP(9), 0x00000000 }, 490 490 { AR5K_DCU_FP, 0x00000000 }, 491 491 { AR5K_DCU_TXP, 0x00000000 }, 492 - { AR5K_DCU_TX_FILTER, 0x00000000 }, 492 + { AR5K_DCU_TX_FILTER_0_BASE, 0x00000000 }, 493 493 /* Unknown table */ 494 494 { 0x1078, 0x00000000 }, 495 495 { 0x10b8, 0x00000000 }, ··· 679 679 { AR5K_PHY(645), 0x00106c10 }, 680 680 { AR5K_PHY(646), 0x009c4060 }, 681 681 { AR5K_PHY(647), 0x1483800a }, 682 - /* { AR5K_PHY(648), 0x018830c6 },*/ /* 2413 */ 682 + /* { AR5K_PHY(648), 0x018830c6 },*/ /* 2413/2425 */ 683 683 { AR5K_PHY(648), 0x01831061 }, 684 684 { AR5K_PHY(649), 0x00000400 }, 685 685 /*{ AR5K_PHY(650), 0x000001b5 },*/
+167 -18
drivers/net/wireless/ath5k/phy.c
··· 1020 1020 { AR5K_RF_GAIN(63), { 0x000000f9 } }, 1021 1021 }; 1022 1022 1023 + /* Initial RF Gain settings for RF2425 */ 1024 + static const struct ath5k_ini_rfgain rfgain_2425[] = { 1025 + { AR5K_RF_GAIN(0), { 0x00000000 } }, 1026 + { AR5K_RF_GAIN(1), { 0x00000040 } }, 1027 + { AR5K_RF_GAIN(2), { 0x00000080 } }, 1028 + { AR5K_RF_GAIN(3), { 0x00000181 } }, 1029 + { AR5K_RF_GAIN(4), { 0x000001c1 } }, 1030 + { AR5K_RF_GAIN(5), { 0x00000001 } }, 1031 + { AR5K_RF_GAIN(6), { 0x00000041 } }, 1032 + { AR5K_RF_GAIN(7), { 0x00000081 } }, 1033 + { AR5K_RF_GAIN(8), { 0x00000188 } }, 1034 + { AR5K_RF_GAIN(9), { 0x000001c8 } }, 1035 + { AR5K_RF_GAIN(10), { 0x00000008 } }, 1036 + { AR5K_RF_GAIN(11), { 0x00000048 } }, 1037 + { AR5K_RF_GAIN(12), { 0x00000088 } }, 1038 + { AR5K_RF_GAIN(13), { 0x00000189 } }, 1039 + { AR5K_RF_GAIN(14), { 0x000001c9 } }, 1040 + { AR5K_RF_GAIN(15), { 0x00000009 } }, 1041 + { AR5K_RF_GAIN(16), { 0x00000049 } }, 1042 + { AR5K_RF_GAIN(17), { 0x00000089 } }, 1043 + { AR5K_RF_GAIN(18), { 0x000001b0 } }, 1044 + { AR5K_RF_GAIN(19), { 0x000001f0 } }, 1045 + { AR5K_RF_GAIN(20), { 0x00000030 } }, 1046 + { AR5K_RF_GAIN(21), { 0x00000070 } }, 1047 + { AR5K_RF_GAIN(22), { 0x00000171 } }, 1048 + { AR5K_RF_GAIN(23), { 0x000001b1 } }, 1049 + { AR5K_RF_GAIN(24), { 0x000001f1 } }, 1050 + { AR5K_RF_GAIN(25), { 0x00000031 } }, 1051 + { AR5K_RF_GAIN(26), { 0x00000071 } }, 1052 + { AR5K_RF_GAIN(27), { 0x000001b8 } }, 1053 + { AR5K_RF_GAIN(28), { 0x000001f8 } }, 1054 + { AR5K_RF_GAIN(29), { 0x00000038 } }, 1055 + { AR5K_RF_GAIN(30), { 0x00000078 } }, 1056 + { AR5K_RF_GAIN(31), { 0x000000b8 } }, 1057 + { AR5K_RF_GAIN(32), { 0x000001b9 } }, 1058 + { AR5K_RF_GAIN(33), { 0x000001f9 } }, 1059 + { AR5K_RF_GAIN(34), { 0x00000039 } }, 1060 + { AR5K_RF_GAIN(35), { 0x00000079 } }, 1061 + { AR5K_RF_GAIN(36), { 0x000000b9 } }, 1062 + { AR5K_RF_GAIN(37), { 0x000000f9 } }, 1063 + { AR5K_RF_GAIN(38), { 0x000000f9 } }, 1064 + { AR5K_RF_GAIN(39), { 0x000000f9 } }, 1065 + { AR5K_RF_GAIN(40), { 0x000000f9 } }, 1066 + { AR5K_RF_GAIN(41), { 0x000000f9 } }, 1067 + { AR5K_RF_GAIN(42), { 0x000000f9 } }, 1068 + { AR5K_RF_GAIN(43), { 0x000000f9 } }, 1069 + { AR5K_RF_GAIN(44), { 0x000000f9 } }, 1070 + { AR5K_RF_GAIN(45), { 0x000000f9 } }, 1071 + { AR5K_RF_GAIN(46), { 0x000000f9 } }, 1072 + { AR5K_RF_GAIN(47), { 0x000000f9 } }, 1073 + { AR5K_RF_GAIN(48), { 0x000000f9 } }, 1074 + { AR5K_RF_GAIN(49), { 0x000000f9 } }, 1075 + { AR5K_RF_GAIN(50), { 0x000000f9 } }, 1076 + { AR5K_RF_GAIN(51), { 0x000000f9 } }, 1077 + { AR5K_RF_GAIN(52), { 0x000000f9 } }, 1078 + { AR5K_RF_GAIN(53), { 0x000000f9 } }, 1079 + { AR5K_RF_GAIN(54), { 0x000000f9 } }, 1080 + { AR5K_RF_GAIN(55), { 0x000000f9 } }, 1081 + { AR5K_RF_GAIN(56), { 0x000000f9 } }, 1082 + { AR5K_RF_GAIN(57), { 0x000000f9 } }, 1083 + { AR5K_RF_GAIN(58), { 0x000000f9 } }, 1084 + { AR5K_RF_GAIN(59), { 0x000000f9 } }, 1085 + { AR5K_RF_GAIN(60), { 0x000000f9 } }, 1086 + { AR5K_RF_GAIN(61), { 0x000000f9 } }, 1087 + { AR5K_RF_GAIN(62), { 0x000000f9 } }, 1088 + { AR5K_RF_GAIN(63), { 0x000000f9 } }, 1089 + }; 1090 + 1023 1091 static const struct ath5k_gain_opt rfgain_opt_5112 = { 1024 1092 1, 1025 1093 8, ··· 1656 1588 freq = 0; /* only 2Ghz */ 1657 1589 break; 1658 1590 case AR5K_RF2425: 1659 - ath5k_rfg = rfgain_2413; 1660 - size = ARRAY_SIZE(rfgain_2413); 1591 + ath5k_rfg = rfgain_2425; 1592 + size = ARRAY_SIZE(rfgain_2425); 1661 1593 freq = 0; /* only 2Ghz */ 1662 1594 break; 1663 1595 default: ··· 1898 1830 data = data0 = data1 = data2 = 0; 1899 1831 c = channel->center_freq; 1900 1832 1901 - /* 1902 - * Set the channel on the RF5112 or newer 1903 - */ 1904 1833 if (c < 4800) { 1905 1834 if (!((c - 2224) % 5)) { 1906 1835 data0 = ((2 * (c - 704)) - 3040) / 10; ··· 1909 1844 return -EINVAL; 1910 1845 1911 1846 data0 = ath5k_hw_bitswap((data0 << 2) & 0xff, 8); 1912 - } else { 1847 + } else if ((c - (c % 5)) != 2 || c > 5435) { 1913 1848 if (!(c % 20) && c >= 5120) { 1914 1849 data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8); 1915 1850 data2 = ath5k_hw_bitswap(3, 2); ··· 1921 1856 data2 = ath5k_hw_bitswap(1, 2); 1922 1857 } else 1923 1858 return -EINVAL; 1859 + } else { 1860 + data0 = ath5k_hw_bitswap((10 * (c - 2) - 4800) / 25 + 1, 8); 1861 + data2 = ath5k_hw_bitswap(0, 2); 1924 1862 } 1925 1863 1926 1864 data = (data0 << 4) | (data1 << 1) | (data2 << 2) | 0x1001; 1865 + 1866 + ath5k_hw_reg_write(ah, data & 0xff, AR5K_RF_BUFFER); 1867 + ath5k_hw_reg_write(ah, (data >> 8) & 0x7f, AR5K_RF_BUFFER_CONTROL_5); 1868 + 1869 + return 0; 1870 + } 1871 + 1872 + /* 1873 + * Set the channel on the RF2425 1874 + */ 1875 + static int ath5k_hw_rf2425_channel(struct ath5k_hw *ah, 1876 + struct ieee80211_channel *channel) 1877 + { 1878 + u32 data, data0, data2; 1879 + u16 c; 1880 + 1881 + data = data0 = data2 = 0; 1882 + c = channel->center_freq; 1883 + 1884 + if (c < 4800) { 1885 + data0 = ath5k_hw_bitswap((c - 2272), 8); 1886 + data2 = 0; 1887 + /* ? 5GHz ? */ 1888 + } else if ((c - (c % 5)) != 2 || c > 5435) { 1889 + if (!(c % 20) && c < 5120) 1890 + data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8); 1891 + else if (!(c % 10)) 1892 + data0 = ath5k_hw_bitswap(((c - 4800) / 10 << 1), 8); 1893 + else if (!(c % 5)) 1894 + data0 = ath5k_hw_bitswap((c - 4800) / 5, 8); 1895 + else 1896 + return -EINVAL; 1897 + data2 = ath5k_hw_bitswap(1, 2); 1898 + } else { 1899 + data0 = ath5k_hw_bitswap((10 * (c - 2) - 4800) / 25 + 1, 8); 1900 + data2 = ath5k_hw_bitswap(0, 2); 1901 + } 1902 + 1903 + data = (data0 << 4) | data2 << 2 | 0x1001; 1927 1904 1928 1905 ath5k_hw_reg_write(ah, data & 0xff, AR5K_RF_BUFFER); 1929 1906 ath5k_hw_reg_write(ah, (data >> 8) & 0x7f, AR5K_RF_BUFFER_CONTROL_5); ··· 2002 1895 case AR5K_RF5111: 2003 1896 ret = ath5k_hw_rf5111_channel(ah, channel); 2004 1897 break; 1898 + case AR5K_RF2425: 1899 + ret = ath5k_hw_rf2425_channel(ah, channel); 1900 + break; 2005 1901 default: 2006 1902 ret = ath5k_hw_rf5112_channel(ah, channel); 2007 1903 break; ··· 2012 1902 2013 1903 if (ret) 2014 1904 return ret; 1905 + 1906 + /* Set JAPAN setting for channel 14 */ 1907 + if (channel->center_freq == 2484) { 1908 + AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_CCKTXCTL, 1909 + AR5K_PHY_CCKTXCTL_JAPAN); 1910 + } else { 1911 + AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_CCKTXCTL, 1912 + AR5K_PHY_CCKTXCTL_WORLD); 1913 + } 2015 1914 2016 1915 ah->ah_current_channel.center_freq = channel->center_freq; 2017 1916 ah->ah_current_channel.hw_value = channel->hw_value; ··· 2052 1933 * http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PALL \ 2053 1934 * &p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.htm&r=1&f=G&l=50&s1=7245893.PN.&OS=PN/7 2054 1935 * 1936 + * XXX: Since during noise floor calibration antennas are detached according to 1937 + * the patent, we should stop tx queues here. 2055 1938 */ 2056 1939 int 2057 1940 ath5k_hw_noise_floor_calibration(struct ath5k_hw *ah, short freq) ··· 2063 1942 s32 noise_floor; 2064 1943 2065 1944 /* 2066 - * Enable noise floor calibration and wait until completion 1945 + * Enable noise floor calibration 2067 1946 */ 2068 1947 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL, 2069 1948 AR5K_PHY_AGCCTL_NF); ··· 2073 1952 if (ret) { 2074 1953 ATH5K_ERR(ah->ah_sc, 2075 1954 "noise floor calibration timeout (%uMHz)\n", freq); 2076 - return ret; 1955 + return -EAGAIN; 2077 1956 } 2078 1957 2079 1958 /* Wait until the noise floor is calibrated and read the value */ ··· 2095 1974 if (noise_floor > AR5K_TUNE_NOISE_FLOOR) { 2096 1975 ATH5K_ERR(ah->ah_sc, 2097 1976 "noise floor calibration failed (%uMHz)\n", freq); 2098 - return -EIO; 1977 + return -EAGAIN; 2099 1978 } 2100 1979 2101 1980 ah->ah_noise_floor = noise_floor; ··· 2208 2087 } 2209 2088 2210 2089 /* 2211 - * Perform a PHY calibration on RF5111/5112 2090 + * Perform a PHY calibration on RF5111/5112 and newer chips 2212 2091 */ 2213 2092 static int ath5k_hw_rf511x_calibrate(struct ath5k_hw *ah, 2214 2093 struct ieee80211_channel *channel) 2215 2094 { 2216 2095 u32 i_pwr, q_pwr; 2217 2096 s32 iq_corr, i_coff, i_coffd, q_coff, q_coffd; 2097 + int i; 2218 2098 ATH5K_TRACE(ah->ah_sc); 2219 2099 2220 2100 if (!ah->ah_calibration || 2221 - ath5k_hw_reg_read(ah, AR5K_PHY_IQ) & AR5K_PHY_IQ_RUN) 2101 + ath5k_hw_reg_read(ah, AR5K_PHY_IQ) & AR5K_PHY_IQ_RUN) 2222 2102 goto done; 2223 2103 2224 - ah->ah_calibration = false; 2104 + /* Calibration has finished, get the results and re-run */ 2105 + for (i = 0; i <= 10; i++) { 2106 + iq_corr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_CORR); 2107 + i_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_I); 2108 + q_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_Q); 2109 + } 2225 2110 2226 - iq_corr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_CORR); 2227 - i_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_I); 2228 - q_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_Q); 2229 2111 i_coffd = ((i_pwr >> 1) + (q_pwr >> 1)) >> 7; 2230 - q_coffd = q_pwr >> 6; 2112 + q_coffd = q_pwr >> 7; 2231 2113 2114 + /* No correction */ 2232 2115 if (i_coffd == 0 || q_coffd == 0) 2233 2116 goto done; 2234 2117 2235 2118 i_coff = ((-iq_corr) / i_coffd) & 0x3f; 2236 - q_coff = (((s32)i_pwr / q_coffd) - 64) & 0x1f; 2237 2119 2238 - /* Commit new IQ value */ 2120 + /* Boundary check */ 2121 + if (i_coff > 31) 2122 + i_coff = 31; 2123 + if (i_coff < -32) 2124 + i_coff = -32; 2125 + 2126 + q_coff = (((s32)i_pwr / q_coffd) - 128) & 0x1f; 2127 + 2128 + /* Boundary check */ 2129 + if (q_coff > 15) 2130 + q_coff = 15; 2131 + if (q_coff < -16) 2132 + q_coff = -16; 2133 + 2134 + /* Commit new I/Q value */ 2239 2135 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_ENABLE | 2240 2136 ((u32)q_coff) | ((u32)i_coff << AR5K_PHY_IQ_CORR_Q_I_COFF_S)); 2241 2137 2138 + /* Re-enable calibration -if we don't we'll commit 2139 + * the same values again and again */ 2140 + AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, 2141 + AR5K_PHY_IQ_CAL_NUM_LOG_MAX, 15); 2142 + AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_RUN); 2143 + 2242 2144 done: 2145 + 2146 + /* TODO: Separate noise floor calibration from I/Q calibration 2147 + * since noise floor calibration interrupts rx path while I/Q 2148 + * calibration doesn't. We don't need to run noise floor calibration 2149 + * as often as I/Q calibration.*/ 2243 2150 ath5k_hw_noise_floor_calibration(ah, channel->center_freq); 2244 2151 2245 2152 /* Request RF gain */
+696 -240
drivers/net/wireless/ath5k/reg.h
··· 53 53 #define AR5K_CR_TXD0 0x00000008 /* TX Disable for queue 0 on 5210 */ 54 54 #define AR5K_CR_TXD1 0x00000010 /* TX Disable for queue 1 on 5210 */ 55 55 #define AR5K_CR_RXD 0x00000020 /* RX Disable */ 56 - #define AR5K_CR_SWI 0x00000040 56 + #define AR5K_CR_SWI 0x00000040 /* Software Interrupt */ 57 57 58 58 /* 59 59 * RX Descriptor Pointer register ··· 65 65 */ 66 66 #define AR5K_CFG 0x0014 /* Register Address */ 67 67 #define AR5K_CFG_SWTD 0x00000001 /* Byte-swap TX descriptor (for big endian archs) */ 68 - #define AR5K_CFG_SWTB 0x00000002 /* Byte-swap TX buffer (?) */ 68 + #define AR5K_CFG_SWTB 0x00000002 /* Byte-swap TX buffer */ 69 69 #define AR5K_CFG_SWRD 0x00000004 /* Byte-swap RX descriptor */ 70 - #define AR5K_CFG_SWRB 0x00000008 /* Byte-swap RX buffer (?) */ 71 - #define AR5K_CFG_SWRG 0x00000010 /* Byte-swap Register values (?) */ 72 - #define AR5K_CFG_ADHOC 0x00000020 /* [5211+] */ 70 + #define AR5K_CFG_SWRB 0x00000008 /* Byte-swap RX buffer */ 71 + #define AR5K_CFG_SWRG 0x00000010 /* Byte-swap Register access */ 72 + #define AR5K_CFG_ADHOC 0x00000020 /* AP/Adhoc indication [5211+] */ 73 73 #define AR5K_CFG_PHY_OK 0x00000100 /* [5211+] */ 74 74 #define AR5K_CFG_EEBS 0x00000200 /* EEPROM is busy */ 75 - #define AR5K_CFG_CLKGD 0x00000400 /* Clock gated (?) */ 75 + #define AR5K_CFG_CLKGD 0x00000400 /* Clock gated (Disable dynamic clock) */ 76 76 #define AR5K_CFG_TXCNT 0x00007800 /* Tx frame count (?) [5210] */ 77 77 #define AR5K_CFG_TXCNT_S 11 78 78 #define AR5K_CFG_TXFSTAT 0x00008000 /* Tx frame status (?) [5210] */ 79 79 #define AR5K_CFG_TXFSTRT 0x00010000 /* [5210] */ 80 - #define AR5K_CFG_PCI_THRES 0x00060000 /* [5211+] */ 80 + #define AR5K_CFG_PCI_THRES 0x00060000 /* PCI Master req q threshold [5211+] */ 81 81 #define AR5K_CFG_PCI_THRES_S 17 82 82 83 83 /* ··· 162 162 /* 163 163 * Transmit configuration register 164 164 */ 165 - #define AR5K_TXCFG 0x0030 /* Register Address */ 166 - #define AR5K_TXCFG_SDMAMR 0x00000007 /* DMA size */ 167 - #define AR5K_TXCFG_SDMAMR_S 0 168 - #define AR5K_TXCFG_B_MODE 0x00000008 /* Set b mode for 5111 (enable 2111) */ 169 - #define AR5K_TXCFG_TXFSTP 0x00000008 /* TX DMA full Stop [5210] */ 170 - #define AR5K_TXCFG_TXFULL 0x000003f0 /* TX Triger level mask */ 171 - #define AR5K_TXCFG_TXFULL_S 4 172 - #define AR5K_TXCFG_TXFULL_0B 0x00000000 173 - #define AR5K_TXCFG_TXFULL_64B 0x00000010 174 - #define AR5K_TXCFG_TXFULL_128B 0x00000020 175 - #define AR5K_TXCFG_TXFULL_192B 0x00000030 176 - #define AR5K_TXCFG_TXFULL_256B 0x00000040 177 - #define AR5K_TXCFG_TXCONT_EN 0x00000080 178 - #define AR5K_TXCFG_DMASIZE 0x00000100 /* Flag for passing DMA size [5210] */ 179 - #define AR5K_TXCFG_JUMBO_TXE 0x00000400 /* Enable jumbo frames transmition (?) [5211+] */ 180 - #define AR5K_TXCFG_RTSRND 0x00001000 /* [5211+] */ 181 - #define AR5K_TXCFG_FRMPAD_DIS 0x00002000 /* [5211+] */ 182 - #define AR5K_TXCFG_RDY_DIS 0x00004000 /* [5211+] */ 165 + #define AR5K_TXCFG 0x0030 /* Register Address */ 166 + #define AR5K_TXCFG_SDMAMR 0x00000007 /* DMA size (read) */ 167 + #define AR5K_TXCFG_SDMAMR_S 0 168 + #define AR5K_TXCFG_B_MODE 0x00000008 /* Set b mode for 5111 (enable 2111) */ 169 + #define AR5K_TXCFG_TXFSTP 0x00000008 /* TX DMA full Stop [5210] */ 170 + #define AR5K_TXCFG_TXFULL 0x000003f0 /* TX Triger level mask */ 171 + #define AR5K_TXCFG_TXFULL_S 4 172 + #define AR5K_TXCFG_TXFULL_0B 0x00000000 173 + #define AR5K_TXCFG_TXFULL_64B 0x00000010 174 + #define AR5K_TXCFG_TXFULL_128B 0x00000020 175 + #define AR5K_TXCFG_TXFULL_192B 0x00000030 176 + #define AR5K_TXCFG_TXFULL_256B 0x00000040 177 + #define AR5K_TXCFG_TXCONT_EN 0x00000080 178 + #define AR5K_TXCFG_DMASIZE 0x00000100 /* Flag for passing DMA size [5210] */ 179 + #define AR5K_TXCFG_JUMBO_DESC_EN 0x00000400 /* Enable jumbo tx descriptors [5211+] */ 180 + #define AR5K_TXCFG_ADHOC_BCN_ATIM 0x00000800 /* Adhoc Beacon ATIM Policy */ 181 + #define AR5K_TXCFG_ATIM_WINDOW_DEF_DIS 0x00001000 /* Disable ATIM window defer [5211+] */ 182 + #define AR5K_TXCFG_RTSRND 0x00001000 /* [5211+] */ 183 + #define AR5K_TXCFG_FRMPAD_DIS 0x00002000 /* [5211+] */ 184 + #define AR5K_TXCFG_RDY_CBR_DIS 0x00004000 /* Ready time CBR disable [5211+] */ 185 + #define AR5K_TXCFG_JUMBO_FRM_MODE 0x00008000 /* Jumbo frame mode [5211+] */ 186 + #define AR5K_TXCFG_DCU_CACHING_DIS 0x00010000 /* Disable DCU caching */ 183 187 184 188 /* 185 189 * Receive configuration register 186 190 */ 187 191 #define AR5K_RXCFG 0x0034 /* Register Address */ 188 - #define AR5K_RXCFG_SDMAMW 0x00000007 /* DMA size */ 192 + #define AR5K_RXCFG_SDMAMW 0x00000007 /* DMA size (write) */ 189 193 #define AR5K_RXCFG_SDMAMW_S 0 190 - #define AR5K_RXCFG_DEF_ANTENNA 0x00000008 /* Default antenna */ 191 - #define AR5K_RXCFG_ZLFDMA 0x00000010 /* Zero-length DMA */ 192 - #define AR5K_RXCFG_JUMBO_RXE 0x00000020 /* Enable jumbo frames reception (?) [5211+] */ 193 - #define AR5K_RXCFG_JUMBO_WRAP 0x00000040 /* Wrap jumbo frames (?) [5211+] */ 194 + #define AR5K_RXCFG_ZLFDMA 0x00000008 /* Enable Zero-length frame DMA */ 195 + #define AR5K_RXCFG_DEF_ANTENNA 0x00000010 /* Default antenna (?) */ 196 + #define AR5K_RXCFG_JUMBO_RXE 0x00000020 /* Enable jumbo rx descriptors [5211+] */ 197 + #define AR5K_RXCFG_JUMBO_WRAP 0x00000040 /* Wrap jumbo frames [5211+] */ 198 + #define AR5K_RXCFG_SLE_ENTRY 0x00000080 /* Sleep entry policy */ 194 199 195 200 /* 196 201 * Receive jumbo descriptor last address register ··· 207 202 * MIB control register 208 203 */ 209 204 #define AR5K_MIBC 0x0040 /* Register Address */ 210 - #define AR5K_MIBC_COW 0x00000001 211 - #define AR5K_MIBC_FMC 0x00000002 /* Freeze Mib Counters (?) */ 212 - #define AR5K_MIBC_CMC 0x00000004 /* Clean Mib Counters (?) */ 213 - #define AR5K_MIBC_MCS 0x00000008 205 + #define AR5K_MIBC_COW 0x00000001 /* Warn test indicator */ 206 + #define AR5K_MIBC_FMC 0x00000002 /* Freeze MIB Counters */ 207 + #define AR5K_MIBC_CMC 0x00000004 /* Clean MIB Counters */ 208 + #define AR5K_MIBC_MCS 0x00000008 /* MIB counter strobe */ 214 209 215 210 /* 216 211 * Timeout prescale register 217 212 */ 218 213 #define AR5K_TOPS 0x0044 219 - #define AR5K_TOPS_M 0x0000ffff /* [5211+] (?) */ 214 + #define AR5K_TOPS_M 0x0000ffff 220 215 221 216 /* 222 217 * Receive timeout register (no frame received) 223 218 */ 224 219 #define AR5K_RXNOFRM 0x0048 225 - #define AR5K_RXNOFRM_M 0x000003ff /* [5211+] (?) */ 220 + #define AR5K_RXNOFRM_M 0x000003ff 226 221 227 222 /* 228 223 * Transmit timeout register (no frame sent) 229 224 */ 230 225 #define AR5K_TXNOFRM 0x004c 231 - #define AR5K_TXNOFRM_M 0x000003ff /* [5211+] (?) */ 232 - #define AR5K_TXNOFRM_QCU 0x000ffc00 /* [5211+] (?) */ 226 + #define AR5K_TXNOFRM_M 0x000003ff 227 + #define AR5K_TXNOFRM_QCU 0x000ffc00 233 228 234 229 /* 235 230 * Receive frame gap timeout register 236 231 */ 237 232 #define AR5K_RPGTO 0x0050 238 - #define AR5K_RPGTO_M 0x000003ff /* [5211+] (?) */ 233 + #define AR5K_RPGTO_M 0x000003ff 239 234 240 235 /* 241 236 * Receive frame count limit register ··· 246 241 247 242 /* 248 243 * Misc settings register 244 + * (reserved0-3) 249 245 */ 250 246 #define AR5K_MISC 0x0058 /* Register Address */ 251 247 #define AR5K_MISC_DMA_OBS_M 0x000001e0 ··· 262 256 263 257 /* 264 258 * QCU/DCU clock gating register (5311) 259 + * (reserved4-5) 265 260 */ 266 261 #define AR5K_QCUDCU_CLKGT 0x005c /* Register Address (?) */ 267 262 #define AR5K_QCUDCU_CLKGT_QCU 0x0000ffff /* Mask for QCU clock */ ··· 291 284 #define AR5K_ISR_TXEOL 0x00000400 /* Empty TX descriptor */ 292 285 #define AR5K_ISR_TXURN 0x00000800 /* Transmit FIFO underrun */ 293 286 #define AR5K_ISR_MIB 0x00001000 /* Update MIB counters */ 294 - #define AR5K_ISR_SWI 0x00002000 /* Software interrupt (?) */ 287 + #define AR5K_ISR_SWI 0x00002000 /* Software interrupt */ 295 288 #define AR5K_ISR_RXPHY 0x00004000 /* PHY error */ 296 - #define AR5K_ISR_RXKCM 0x00008000 289 + #define AR5K_ISR_RXKCM 0x00008000 /* RX Key cache miss */ 297 290 #define AR5K_ISR_SWBA 0x00010000 /* Software beacon alert */ 298 291 #define AR5K_ISR_BRSSI 0x00020000 299 292 #define AR5K_ISR_BMISS 0x00040000 /* Beacon missed */ 300 293 #define AR5K_ISR_HIUERR 0x00080000 /* Host Interface Unit error [5211+] */ 301 294 #define AR5K_ISR_BNR 0x00100000 /* Beacon not ready [5211+] */ 302 - #define AR5K_ISR_MCABT 0x00100000 /* [5210] */ 303 - #define AR5K_ISR_RXCHIRP 0x00200000 /* [5212+] */ 304 - #define AR5K_ISR_SSERR 0x00200000 /* [5210] */ 305 - #define AR5K_ISR_DPERR 0x00400000 /* [5210] */ 295 + #define AR5K_ISR_MCABT 0x00100000 /* Master Cycle Abort [5210] */ 296 + #define AR5K_ISR_RXCHIRP 0x00200000 /* CHIRP Received [5212+] */ 297 + #define AR5K_ISR_SSERR 0x00200000 /* Signaled System Error [5210] */ 298 + #define AR5K_ISR_DPERR 0x00400000 /* Det par Error (?) [5210] */ 306 299 #define AR5K_ISR_TIM 0x00800000 /* [5210] */ 307 300 #define AR5K_ISR_BCNMISC 0x00800000 /* [5212+] */ 308 301 #define AR5K_ISR_GPIO 0x01000000 /* GPIO (rf kill)*/ ··· 327 320 328 321 #define AR5K_SISR2 0x008c /* Register Address [5211+] */ 329 322 #define AR5K_SISR2_QCU_TXURN 0x000003ff /* Mask for QCU_TXURN */ 330 - #define AR5K_SISR2_MCABT 0x00100000 331 - #define AR5K_SISR2_SSERR 0x00200000 332 - #define AR5K_SISR2_DPERR 0x00400000 323 + #define AR5K_SISR2_MCABT 0x00100000 /* Master Cycle Abort */ 324 + #define AR5K_SISR2_SSERR 0x00200000 /* Signaled System Error */ 325 + #define AR5K_SISR2_DPERR 0x00400000 /* Det par Error (?) */ 333 326 #define AR5K_SISR2_TIM 0x01000000 /* [5212+] */ 334 327 #define AR5K_SISR2_CAB_END 0x02000000 /* [5212+] */ 335 - #define AR5K_SISR2_DTIM_SYNC 0x04000000 /* [5212+] */ 336 - #define AR5K_SISR2_BCN_TIMEOUT 0x08000000 /* [5212+] */ 337 - #define AR5K_SISR2_CAB_TIMEOUT 0x10000000 /* [5212+] */ 328 + #define AR5K_SISR2_DTIM_SYNC 0x04000000 /* DTIM sync lost [5212+] */ 329 + #define AR5K_SISR2_BCN_TIMEOUT 0x08000000 /* Beacon Timeout [5212+] */ 330 + #define AR5K_SISR2_CAB_TIMEOUT 0x10000000 /* CAB Timeout [5212+] */ 338 331 #define AR5K_SISR2_DTIM 0x20000000 /* [5212+] */ 339 332 340 333 #define AR5K_SISR3 0x0090 /* Register Address [5211+] */ ··· 375 368 #define AR5K_IMR_TXEOL 0x00000400 /* Empty TX descriptor*/ 376 369 #define AR5K_IMR_TXURN 0x00000800 /* Transmit FIFO underrun*/ 377 370 #define AR5K_IMR_MIB 0x00001000 /* Update MIB counters*/ 378 - #define AR5K_IMR_SWI 0x00002000 371 + #define AR5K_IMR_SWI 0x00002000 /* Software interrupt */ 379 372 #define AR5K_IMR_RXPHY 0x00004000 /* PHY error*/ 380 - #define AR5K_IMR_RXKCM 0x00008000 373 + #define AR5K_IMR_RXKCM 0x00008000 /* RX Key cache miss */ 381 374 #define AR5K_IMR_SWBA 0x00010000 /* Software beacon alert*/ 382 375 #define AR5K_IMR_BRSSI 0x00020000 383 376 #define AR5K_IMR_BMISS 0x00040000 /* Beacon missed*/ 384 377 #define AR5K_IMR_HIUERR 0x00080000 /* Host Interface Unit error [5211+] */ 385 378 #define AR5K_IMR_BNR 0x00100000 /* Beacon not ready [5211+] */ 386 - #define AR5K_IMR_MCABT 0x00100000 /* [5210] */ 387 - #define AR5K_IMR_RXCHIRP 0x00200000 /* [5212+]*/ 388 - #define AR5K_IMR_SSERR 0x00200000 /* [5210] */ 389 - #define AR5K_IMR_DPERR 0x00400000 /* [5210] */ 379 + #define AR5K_IMR_MCABT 0x00100000 /* Master Cycle Abort [5210] */ 380 + #define AR5K_IMR_RXCHIRP 0x00200000 /* CHIRP Received [5212+]*/ 381 + #define AR5K_IMR_SSERR 0x00200000 /* Signaled System Error [5210] */ 382 + #define AR5K_IMR_DPERR 0x00400000 /* Det par Error (?) [5210] */ 390 383 #define AR5K_IMR_TIM 0x00800000 /* [5211+] */ 391 384 #define AR5K_IMR_BCNMISC 0x00800000 /* [5212+] */ 392 385 #define AR5K_IMR_GPIO 0x01000000 /* GPIO (rf kill)*/ ··· 412 405 #define AR5K_SIMR2 0x00ac /* Register Address [5211+] */ 413 406 #define AR5K_SIMR2_QCU_TXURN 0x000003ff /* Mask for QCU_TXURN */ 414 407 #define AR5K_SIMR2_QCU_TXURN_S 0 415 - #define AR5K_SIMR2_MCABT 0x00100000 416 - #define AR5K_SIMR2_SSERR 0x00200000 417 - #define AR5K_SIMR2_DPERR 0x00400000 408 + #define AR5K_SIMR2_MCABT 0x00100000 /* Master Cycle Abort */ 409 + #define AR5K_SIMR2_SSERR 0x00200000 /* Signaled System Error */ 410 + #define AR5K_SIMR2_DPERR 0x00400000 /* Det par Error (?) */ 418 411 #define AR5K_SIMR2_TIM 0x01000000 /* [5212+] */ 419 412 #define AR5K_SIMR2_CAB_END 0x02000000 /* [5212+] */ 420 - #define AR5K_SIMR2_DTIM_SYNC 0x04000000 /* [5212+] */ 421 - #define AR5K_SIMR2_BCN_TIMEOUT 0x08000000 /* [5212+] */ 422 - #define AR5K_SIMR2_CAB_TIMEOUT 0x10000000 /* [5212+] */ 413 + #define AR5K_SIMR2_DTIM_SYNC 0x04000000 /* DTIM Sync lost [5212+] */ 414 + #define AR5K_SIMR2_BCN_TIMEOUT 0x08000000 /* Beacon Timeout [5212+] */ 415 + #define AR5K_SIMR2_CAB_TIMEOUT 0x10000000 /* CAB Timeout [5212+] */ 423 416 #define AR5K_SIMR2_DTIM 0x20000000 /* [5212+] */ 424 417 425 418 #define AR5K_SIMR3 0x00b0 /* Register Address [5211+] */ ··· 432 425 #define AR5K_SIMR4_QTRIG 0x000003ff /* Mask for QTRIG */ 433 426 #define AR5K_SIMR4_QTRIG_S 0 434 427 428 + /* 429 + * DMA Debug registers 0-7 430 + * 0xe0 - 0xfc 431 + */ 435 432 436 433 /* 437 434 * Decompression mask registers [5212+] 438 435 */ 439 - #define AR5K_DCM_ADDR 0x0400 /*Decompression mask address (?)*/ 440 - #define AR5K_DCM_DATA 0x0404 /*Decompression mask data (?)*/ 436 + #define AR5K_DCM_ADDR 0x0400 /*Decompression mask address (index) */ 437 + #define AR5K_DCM_DATA 0x0404 /*Decompression mask data */ 438 + 439 + /* 440 + * Wake On Wireless pattern control register [5212+] 441 + */ 442 + #define AR5K_WOW_PCFG 0x0410 /* Register Address */ 443 + #define AR5K_WOW_PCFG_PAT_MATCH_EN 0x00000001 /* Pattern match enable */ 444 + #define AR5K_WOW_PCFG_LONG_FRAME_POL 0x00000002 /* Long frame policy */ 445 + #define AR5K_WOW_PCFG_WOBMISS 0x00000004 /* Wake on bea(con) miss (?) */ 446 + #define AR5K_WOW_PCFG_PAT_0_EN 0x00000100 /* Enable pattern 0 */ 447 + #define AR5K_WOW_PCFG_PAT_1_EN 0x00000200 /* Enable pattern 1 */ 448 + #define AR5K_WOW_PCFG_PAT_2_EN 0x00000400 /* Enable pattern 2 */ 449 + #define AR5K_WOW_PCFG_PAT_3_EN 0x00000800 /* Enable pattern 3 */ 450 + #define AR5K_WOW_PCFG_PAT_4_EN 0x00001000 /* Enable pattern 4 */ 451 + #define AR5K_WOW_PCFG_PAT_5_EN 0x00002000 /* Enable pattern 5 */ 452 + 453 + /* 454 + * Wake On Wireless pattern index register (?) [5212+] 455 + */ 456 + #define AR5K_WOW_PAT_IDX 0x0414 457 + 458 + /* 459 + * Wake On Wireless pattern data register [5212+] 460 + */ 461 + #define AR5K_WOW_PAT_DATA 0x0418 /* Register Address */ 462 + #define AR5K_WOW_PAT_DATA_0_3_V 0x00000001 /* Pattern 0, 3 value */ 463 + #define AR5K_WOW_PAT_DATA_1_4_V 0x00000100 /* Pattern 1, 4 value */ 464 + #define AR5K_WOW_PAT_DATA_2_5_V 0x00010000 /* Pattern 2, 5 value */ 465 + #define AR5K_WOW_PAT_DATA_0_3_M 0x01000000 /* Pattern 0, 3 mask */ 466 + #define AR5K_WOW_PAT_DATA_1_4_M 0x04000000 /* Pattern 1, 4 mask */ 467 + #define AR5K_WOW_PAT_DATA_2_5_M 0x10000000 /* Pattern 2, 5 mask */ 441 468 442 469 /* 443 470 * Decompression configuration registers [5212+] 444 471 */ 445 - #define AR5K_DCCFG 0x0420 472 + #define AR5K_DCCFG 0x0420 /* Register Address */ 473 + #define AR5K_DCCFG_GLOBAL_EN 0x00000001 /* Enable decompression on all queues */ 474 + #define AR5K_DCCFG_BYPASS_EN 0x00000002 /* Bypass decompression */ 475 + #define AR5K_DCCFG_BCAST_EN 0x00000004 /* Enable decompression for bcast frames */ 476 + #define AR5K_DCCFG_MCAST_EN 0x00000008 /* Enable decompression for mcast frames */ 446 477 447 478 /* 448 479 * Compression configuration registers [5212+] 449 480 */ 450 - #define AR5K_CCFG 0x0600 451 - #define AR5K_CCFG_CUP 0x0604 481 + #define AR5K_CCFG 0x0600 /* Register Address */ 482 + #define AR5K_CCFG_WINDOW_SIZE 0x00000007 /* Compression window size */ 483 + #define AR5K_CCFG_CPC_EN 0x00000008 /* Enable performance counters */ 484 + 485 + #define AR5K_CCFG_CCU 0x0604 /* Register Address */ 486 + #define AR5K_CCFG_CCU_CUP_EN 0x00000001 /* CCU Catchup enable */ 487 + #define AR5K_CCFG_CCU_CREDIT 0x00000002 /* CCU Credit (field) */ 488 + #define AR5K_CCFG_CCU_CD_THRES 0x00000080 /* CCU Cyc(lic?) debt threshold (field) */ 489 + #define AR5K_CCFG_CCU_CUP_LCNT 0x00010000 /* CCU Catchup lit(?) count */ 490 + #define AR5K_CCFG_CCU_INIT 0x00100200 /* Initial value during reset */ 452 491 453 492 /* 454 493 * Compression performance counter registers [5212+] ··· 503 450 #define AR5K_CPC1 0x0614 /* Compression performance counter 1*/ 504 451 #define AR5K_CPC2 0x0618 /* Compression performance counter 2 */ 505 452 #define AR5K_CPC3 0x061c /* Compression performance counter 3 */ 506 - #define AR5K_CPCORN 0x0620 /* Compression performance overrun (?) */ 453 + #define AR5K_CPCOVF 0x0620 /* Compression performance overflow */ 507 454 508 455 509 456 /* ··· 519 466 * set/clear, which contain status for all queues (we shift by 1 for each 520 467 * queue). To access these registers easily we define some macros here 521 468 * that are used inside HAL. For more infos check out *_tx_queue functs. 522 - * 523 - * TODO: Boundary checking on macros (here?) 524 469 */ 525 470 526 471 /* ··· 564 513 #define AR5K_QCU_RDYTIMECFG_BASE 0x0900 /* Register Address - Queue0 RDYTIMECFG */ 565 514 #define AR5K_QCU_RDYTIMECFG_INTVAL 0x00ffffff /* Ready time interval mask */ 566 515 #define AR5K_QCU_RDYTIMECFG_INTVAL_S 0 567 - #define AR5K_QCU_RDYTIMECFG_DURATION 0x00ffffff /* Ready time duration mask */ 568 516 #define AR5K_QCU_RDYTIMECFG_ENABLE 0x01000000 /* Ready time enable mask */ 569 517 #define AR5K_QUEUE_RDYTIMECFG(_q) AR5K_QUEUE_REG(AR5K_QCU_RDYTIMECFG_BASE, _q) 570 518 ··· 584 534 */ 585 535 #define AR5K_QCU_MISC_BASE 0x09c0 /* Register Address -Queue0 MISC */ 586 536 #define AR5K_QCU_MISC_FRSHED_M 0x0000000f /* Frame sheduling mask */ 587 - #define AR5K_QCU_MISC_FRSHED_ASAP 0 /* ASAP */ 588 - #define AR5K_QCU_MISC_FRSHED_CBR 1 /* Constant Bit Rate */ 589 - #define AR5K_QCU_MISC_FRSHED_DBA_GT 2 /* DMA Beacon alert gated (?) */ 590 - #define AR5K_QCU_MISC_FRSHED_TIM_GT 3 /* Time gated (?) */ 537 + #define AR5K_QCU_MISC_FRSHED_ASAP 0 /* ASAP */ 538 + #define AR5K_QCU_MISC_FRSHED_CBR 1 /* Constant Bit Rate */ 539 + #define AR5K_QCU_MISC_FRSHED_DBA_GT 2 /* DMA Beacon alert gated (?) */ 540 + #define AR5K_QCU_MISC_FRSHED_TIM_GT 3 /* Time gated (?) */ 591 541 #define AR5K_QCU_MISC_FRSHED_BCN_SENT_GT 4 /* Beacon sent gated (?) */ 592 542 #define AR5K_QCU_MISC_ONESHOT_ENABLE 0x00000010 /* Oneshot enable */ 593 543 #define AR5K_QCU_MISC_CBREXP 0x00000020 /* CBR expired (normal queue) */ 594 544 #define AR5K_QCU_MISC_CBREXP_BCN 0x00000040 /* CBR expired (beacon queue) */ 595 - #define AR5K_QCU_MISC_BCN_ENABLE 0x00000080 /* Beacons enabled */ 596 - #define AR5K_QCU_MISC_CBR_THRES_ENABLE 0x00000100 /* CBR threshold enabled (?) */ 597 - #define AR5K_QCU_MISC_TXE 0x00000200 /* TXE reset when RDYTIME enalbed (?) */ 598 - #define AR5K_QCU_MISC_CBR 0x00000400 /* CBR threshold reset (?) */ 599 - #define AR5K_QCU_MISC_DCU_EARLY 0x00000800 /* DCU reset (?) */ 545 + #define AR5K_QCU_MISC_BCN_ENABLE 0x00000080 /* Enable Beacon use */ 546 + #define AR5K_QCU_MISC_CBR_THRES_ENABLE 0x00000100 /* CBR threshold enabled */ 547 + #define AR5K_QCU_MISC_RDY_VEOL_POLICY 0x00000200 /* TXE reset when RDYTIME enalbed */ 548 + #define AR5K_QCU_MISC_CBR_RESET_CNT 0x00000400 /* CBR threshold (counter) reset */ 549 + #define AR5K_QCU_MISC_DCU_EARLY 0x00000800 /* DCU early termination */ 550 + #define AR5K_QCU_MISC_DCU_CMP_EN 0x00001000 /* Enable frame compression */ 600 551 #define AR5K_QUEUE_MISC(_q) AR5K_QUEUE_REG(AR5K_QCU_MISC_BASE, _q) 601 552 602 553 ··· 606 555 */ 607 556 #define AR5K_QCU_STS_BASE 0x0a00 /* Register Address - Queue0 STS */ 608 557 #define AR5K_QCU_STS_FRMPENDCNT 0x00000003 /* Frames pending counter */ 609 - #define AR5K_QCU_STS_CBREXPCNT 0x0000ff00 /* CBR expired counter (?) */ 558 + #define AR5K_QCU_STS_CBREXPCNT 0x0000ff00 /* CBR expired counter */ 610 559 #define AR5K_QUEUE_STATUS(_q) AR5K_QUEUE_REG(AR5K_QCU_STS_BASE, _q) 611 560 612 561 /* ··· 620 569 */ 621 570 #define AR5K_QCU_CBB_SELECT 0x0b00 622 571 #define AR5K_QCU_CBB_ADDR 0x0b04 572 + #define AR5K_QCU_CBB_ADDR_S 9 623 573 624 574 /* 625 575 * QCU compression buffer configuration register [5212+] 576 + * (buffer size) 626 577 */ 627 578 #define AR5K_QCU_CBCFG 0x0b08 628 579 ··· 705 652 * No lockout means there is no special handling. 706 653 */ 707 654 #define AR5K_DCU_MISC_BASE 0x1100 /* Register Address -Queue0 DCU_MISC */ 708 - #define AR5K_DCU_MISC_BACKOFF 0x000007ff /* Mask for backoff setting (?) */ 655 + #define AR5K_DCU_MISC_BACKOFF 0x000007ff /* Mask for backoff threshold */ 709 656 #define AR5K_DCU_MISC_BACKOFF_FRAG 0x00000200 /* Enable backoff while bursting */ 710 - #define AR5K_DCU_MISC_HCFPOLL_ENABLE 0x00000800 /* CF - Poll (?) */ 711 - #define AR5K_DCU_MISC_BACKOFF_PERSIST 0x00001000 /* Persistent backoff (?) */ 712 - #define AR5K_DCU_MISC_FRMPRFTCH_ENABLE 0x00002000 /* Enable frame pre-fetch (?) */ 657 + #define AR5K_DCU_MISC_HCFPOLL_ENABLE 0x00000800 /* CF - Poll enable */ 658 + #define AR5K_DCU_MISC_BACKOFF_PERSIST 0x00001000 /* Persistent backoff */ 659 + #define AR5K_DCU_MISC_FRMPRFTCH_ENABLE 0x00002000 /* Enable frame pre-fetch */ 713 660 #define AR5K_DCU_MISC_VIRTCOL 0x0000c000 /* Mask for Virtual Collision (?) */ 714 - #define AR5K_DCU_MISC_VIRTCOL_NORMAL 0 715 - #define AR5K_DCU_MISC_VIRTCOL_MODIFIED 1 716 - #define AR5K_DCU_MISC_VIRTCOL_IGNORE 2 717 - #define AR5K_DCU_MISC_BCN_ENABLE 0x00010000 /* Beacon enable (?) */ 661 + #define AR5K_DCU_MISC_VIRTCOL_NORMAL 0 662 + #define AR5K_DCU_MISC_VIRTCOL_MODIFIED 1 663 + #define AR5K_DCU_MISC_VIRTCOL_IGNORE 2 664 + #define AR5K_DCU_MISC_BCN_ENABLE 0x00010000 /* Enable Beacon use */ 718 665 #define AR5K_DCU_MISC_ARBLOCK_CTL 0x00060000 /* Arbiter lockout control mask */ 719 666 #define AR5K_DCU_MISC_ARBLOCK_CTL_S 17 720 - #define AR5K_DCU_MISC_ARBLOCK_CTL_NONE 0 /* No arbiter lockout */ 667 + #define AR5K_DCU_MISC_ARBLOCK_CTL_NONE 0 /* No arbiter lockout */ 721 668 #define AR5K_DCU_MISC_ARBLOCK_CTL_INTFRM 1 /* Intra-frame lockout */ 722 669 #define AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL 2 /* Global lockout */ 723 - #define AR5K_DCU_MISC_ARBLOCK_IGNORE 0x00080000 724 - #define AR5K_DCU_MISC_SEQ_NUM_INCR_DIS 0x00100000 /* Disable sequence number increment (?) */ 725 - #define AR5K_DCU_MISC_POST_FR_BKOFF_DIS 0x00200000 /* Disable post-frame backoff (?) */ 726 - #define AR5K_DCU_MISC_VIRT_COLL_POLICY 0x00400000 /* Virtual Collision policy (?) */ 727 - #define AR5K_DCU_MISC_BLOWN_IFS_POLICY 0x00800000 670 + #define AR5K_DCU_MISC_ARBLOCK_IGNORE 0x00080000 /* Ignore Arbiter lockout */ 671 + #define AR5K_DCU_MISC_SEQ_NUM_INCR_DIS 0x00100000 /* Disable sequence number increment */ 672 + #define AR5K_DCU_MISC_POST_FR_BKOFF_DIS 0x00200000 /* Disable post-frame backoff */ 673 + #define AR5K_DCU_MISC_VIRT_COLL_POLICY 0x00400000 /* Virtual Collision cw policy */ 674 + #define AR5K_DCU_MISC_BLOWN_IFS_POLICY 0x00800000 /* Blown IFS policy (?) */ 728 675 #define AR5K_DCU_MISC_SEQNUM_CTL 0x01000000 /* Sequence number control (?) */ 729 676 #define AR5K_QUEUE_DFS_MISC(_q) AR5K_QUEUE_REG(AR5K_DCU_MISC_BASE, _q) 730 677 731 678 /* 732 679 * DCU frame sequence number registers 733 680 */ 734 - #define AR5K_DCU_SEQNUM_BASE 0x1140 735 - #define AR5K_DCU_SEQNUM_M 0x00000fff 681 + #define AR5K_DCU_SEQNUM_BASE 0x1140 682 + #define AR5K_DCU_SEQNUM_M 0x00000fff 736 683 #define AR5K_QUEUE_DFS_SEQNUM(_q) AR5K_QUEUE_REG(AR5K_DCU_SEQNUM_BASE, _q) 737 684 738 685 /* 739 - * DCU global IFS SIFS registers 686 + * DCU global IFS SIFS register 740 687 */ 741 688 #define AR5K_DCU_GBL_IFS_SIFS 0x1030 742 689 #define AR5K_DCU_GBL_IFS_SIFS_M 0x0000ffff 743 690 744 691 /* 745 - * DCU global IFS slot interval registers 692 + * DCU global IFS slot interval register 746 693 */ 747 694 #define AR5K_DCU_GBL_IFS_SLOT 0x1070 748 695 #define AR5K_DCU_GBL_IFS_SLOT_M 0x0000ffff 749 696 750 697 /* 751 - * DCU global IFS EIFS registers 698 + * DCU global IFS EIFS register 752 699 */ 753 700 #define AR5K_DCU_GBL_IFS_EIFS 0x10b0 754 701 #define AR5K_DCU_GBL_IFS_EIFS_M 0x0000ffff 755 702 756 703 /* 757 - * DCU global IFS misc registers 704 + * DCU global IFS misc register 705 + * 706 + * LFSR stands for Linear Feedback Shift Register 707 + * and it's used for generating pseudo-random 708 + * number sequences. 709 + * 710 + * (If i understand corectly, random numbers are 711 + * used for idle sensing -multiplied with cwmin/max etc-) 758 712 */ 759 713 #define AR5K_DCU_GBL_IFS_MISC 0x10f0 /* Register Address */ 760 - #define AR5K_DCU_GBL_IFS_MISC_LFSR_SLICE 0x00000007 761 - #define AR5K_DCU_GBL_IFS_MISC_TURBO_MODE 0x00000008 /* Turbo mode (?) */ 762 - #define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC 0x000003f0 /* SIFS Duration mask (?) */ 763 - #define AR5K_DCU_GBL_IFS_MISC_USEC_DUR 0x000ffc00 764 - #define AR5K_DCU_GBL_IFS_MISC_DCU_ARB_DELAY 0x00300000 714 + #define AR5K_DCU_GBL_IFS_MISC_LFSR_SLICE 0x00000007 /* LFSR Slice Select */ 715 + #define AR5K_DCU_GBL_IFS_MISC_TURBO_MODE 0x00000008 /* Turbo mode */ 716 + #define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC 0x000003f0 /* SIFS Duration mask */ 717 + #define AR5K_DCU_GBL_IFS_MISC_USEC_DUR 0x000ffc00 /* USEC Duration mask */ 718 + #define AR5K_DCU_GBL_IFS_MISC_DCU_ARB_DELAY 0x00300000 /* DCU Arbiter delay mask */ 719 + #define AR5K_DCU_GBL_IFS_MISC_SIFS_CNT_RST 0x00400000 /* SIFC cnt reset policy (?) */ 720 + #define AR5K_DCU_GBL_IFS_MISC_AIFS_CNT_RST 0x00800000 /* AIFS cnt reset policy (?) */ 721 + #define AR5K_DCU_GBL_IFS_MISC_RND_LFSR_SL_DIS 0x01000000 /* Disable random LFSR slice */ 765 722 766 723 /* 767 724 * DCU frame prefetch control register 768 725 */ 769 - #define AR5K_DCU_FP 0x1230 726 + #define AR5K_DCU_FP 0x1230 /* Register Address */ 727 + #define AR5K_DCU_FP_NOBURST_DCU_EN 0x00000001 /* Enable non-burst prefetch on DCU (?) */ 728 + #define AR5K_DCU_FP_NOBURST_EN 0x00000010 /* Enable non-burst prefetch (?) */ 729 + #define AR5K_DCU_FP_BURST_DCU_EN 0x00000020 /* Enable burst prefetch on DCU (?) */ 770 730 771 731 /* 772 732 * DCU transmit pause control/status register 773 733 */ 774 734 #define AR5K_DCU_TXP 0x1270 /* Register Address */ 775 - #define AR5K_DCU_TXP_M 0x000003ff /* Tx pause mask (?) */ 776 - #define AR5K_DCU_TXP_STATUS 0x00010000 /* Tx pause status (?) */ 735 + #define AR5K_DCU_TXP_M 0x000003ff /* Tx pause mask */ 736 + #define AR5K_DCU_TXP_STATUS 0x00010000 /* Tx pause status */ 777 737 778 738 /* 779 - * DCU transmit filter register 739 + * DCU transmit filter table 0 (32 entries) 780 740 */ 781 - #define AR5K_DCU_TX_FILTER 0x1038 741 + #define AR5K_DCU_TX_FILTER_0_BASE 0x1038 742 + #define AR5K_DCU_TX_FILTER_0(_n) (AR5K_DCU_TX_FILTER_0_BASE + (_n * 64)) 743 + 744 + /* 745 + * DCU transmit filter table 1 (16 entries) 746 + */ 747 + #define AR5K_DCU_TX_FILTER_1_BASE 0x103c 748 + #define AR5K_DCU_TX_FILTER_1(_n) (AR5K_DCU_TX_FILTER_1_BASE + ((_n - 32) * 64)) 782 749 783 750 /* 784 751 * DCU clear transmit filter register ··· 812 739 813 740 /* 814 741 * Reset control register 815 - * 816 - * 4 and 8 are not used in 5211/5212 and 817 - * 2 means "baseband reset" on 5211/5212. 818 742 */ 819 743 #define AR5K_RESET_CTL 0x4000 /* Register Address */ 820 744 #define AR5K_RESET_CTL_PCU 0x00000001 /* Protocol Control Unit reset */ ··· 835 765 #define AR5K_SLEEP_CTL_SLE_SLP 0x00010000 /* Force chip sleep */ 836 766 #define AR5K_SLEEP_CTL_SLE_ALLOW 0x00020000 837 767 #define AR5K_SLEEP_CTL_SLE_UNITS 0x00000008 /* [5211+] */ 768 + /* more bits */ 838 769 839 770 /* 840 771 * Interrupt pending register ··· 847 776 * Sleep force register 848 777 */ 849 778 #define AR5K_SFR 0x400c 850 - #define AR5K_SFR_M 0x00000001 779 + #define AR5K_SFR_EN 0x00000001 851 780 852 781 /* 853 782 * PCI configuration register 854 783 */ 855 784 #define AR5K_PCICFG 0x4010 /* Register Address */ 856 785 #define AR5K_PCICFG_EEAE 0x00000001 /* Eeprom access enable [5210] */ 786 + #define AR5K_PCICFG_SLEEP_CLOCK_EN 0x00000002 /* Enable sleep clock (?) */ 857 787 #define AR5K_PCICFG_CLKRUNEN 0x00000004 /* CLKRUN enable [5211+] */ 858 788 #define AR5K_PCICFG_EESIZE 0x00000018 /* Mask for EEPROM size [5211+] */ 859 789 #define AR5K_PCICFG_EESIZE_S 3 ··· 870 798 #define AR5K_PCICFG_CBEFIX_DIS 0x00000400 /* Disable CBE fix (?) */ 871 799 #define AR5K_PCICFG_SL_INTEN 0x00000800 /* Enable interrupts when asleep (?) */ 872 800 #define AR5K_PCICFG_LED_BCTL 0x00001000 /* Led blink (?) [5210] */ 873 - #define AR5K_PCICFG_SL_INPEN 0x00002800 /* Sleep even whith pending interrupts (?) */ 801 + #define AR5K_PCICFG_UNK 0x00001000 /* Passed on some parts durring attach (?) */ 802 + #define AR5K_PCICFG_SL_INPEN 0x00002000 /* Sleep even whith pending interrupts (?) */ 874 803 #define AR5K_PCICFG_SPWR_DN 0x00010000 /* Mask for power status */ 875 804 #define AR5K_PCICFG_LEDMODE 0x000e0000 /* Ledmode [5211+] */ 876 805 #define AR5K_PCICFG_LEDMODE_PROP 0x00000000 /* Blink on standard traffic [5211+] */ 877 806 #define AR5K_PCICFG_LEDMODE_PROM 0x00020000 /* Default mode (blink on any traffic) [5211+] */ 878 807 #define AR5K_PCICFG_LEDMODE_PWR 0x00040000 /* Some other blinking mode (?) [5211+] */ 879 808 #define AR5K_PCICFG_LEDMODE_RAND 0x00060000 /* Random blinking (?) [5211+] */ 880 - #define AR5K_PCICFG_LEDBLINK 0x00700000 809 + #define AR5K_PCICFG_LEDBLINK 0x00700000 /* Led blink rate */ 881 810 #define AR5K_PCICFG_LEDBLINK_S 20 882 - #define AR5K_PCICFG_LEDSLOW 0x00800000 /* Slow led blink rate (?) [5211+] */ 811 + #define AR5K_PCICFG_LEDSLOW 0x00800000 /* Slowest led blink rate [5211+] */ 883 812 #define AR5K_PCICFG_LEDSTATE \ 884 813 (AR5K_PCICFG_LED | AR5K_PCICFG_LEDMODE | \ 885 814 AR5K_PCICFG_LEDBLINK | AR5K_PCICFG_LEDSLOW) 815 + #define AR5K_PCICFG_SLEEP_CLOCK_RATE 0x03000000 /* Sleep clock rate (field) */ 886 816 887 817 /* 888 818 * "General Purpose Input/Output" (GPIO) control register ··· 1021 947 #define AR5K_EEPROM_VERSION_4_4 0x4004 1022 948 #define AR5K_EEPROM_VERSION_4_5 0x4005 1023 949 #define AR5K_EEPROM_VERSION_4_6 0x4006 /* has ee_scaled_cck_delta */ 1024 - #define AR5K_EEPROM_VERSION_4_7 0x3007 950 + #define AR5K_EEPROM_VERSION_4_7 0x4007 1025 951 1026 952 #define AR5K_EEPROM_MODE_11A 0 1027 953 #define AR5K_EEPROM_MODE_11B 1 ··· 1097 1023 #define AR5K_EEPROM_STAT_WRDONE 0x00000008 /* EEPROM write successful */ 1098 1024 1099 1025 /* 1100 - * EEPROM config register (?) 1026 + * EEPROM config register 1101 1027 */ 1102 - #define AR5K_EEPROM_CFG 0x6010 1103 - 1028 + #define AR5K_EEPROM_CFG 0x6010 /* Register Addres */ 1029 + #define AR5K_EEPROM_CFG_SIZE_OVR 0x00000001 1030 + #define AR5K_EEPROM_CFG_WR_WAIT_DIS 0x00000004 /* Disable write wait */ 1031 + #define AR5K_EEPROM_CFG_CLK_RATE 0x00000018 /* Clock rate */ 1032 + #define AR5K_EEPROM_CFG_PROT_KEY 0x00ffff00 /* Protectio key */ 1033 + #define AR5K_EEPROM_CFG_LIND_EN 0x01000000 /* Enable length indicator (?) */ 1104 1034 1105 1035 1106 1036 /* ··· 1128 1050 #define AR5K_STA_ID1 0x8004 /* Register Address */ 1129 1051 #define AR5K_STA_ID1_AP 0x00010000 /* Set AP mode */ 1130 1052 #define AR5K_STA_ID1_ADHOC 0x00020000 /* Set Ad-Hoc mode */ 1131 - #define AR5K_STA_ID1_PWR_SV 0x00040000 /* Power save reporting (?) */ 1053 + #define AR5K_STA_ID1_PWR_SV 0x00040000 /* Power save reporting */ 1132 1054 #define AR5K_STA_ID1_NO_KEYSRCH 0x00080000 /* No key search */ 1133 1055 #define AR5K_STA_ID1_NO_PSPOLL 0x00100000 /* No power save polling [5210] */ 1134 1056 #define AR5K_STA_ID1_PCF_5211 0x00100000 /* Enable PCF on [5211+] */ ··· 1137 1059 AR5K_STA_ID1_PCF_5210 : AR5K_STA_ID1_PCF_5211) 1138 1060 #define AR5K_STA_ID1_DEFAULT_ANTENNA 0x00200000 /* Use default antenna */ 1139 1061 #define AR5K_STA_ID1_DESC_ANTENNA 0x00400000 /* Update antenna from descriptor */ 1140 - #define AR5K_STA_ID1_RTS_DEF_ANTENNA 0x00800000 /* Use default antenna for RTS (?) */ 1141 - #define AR5K_STA_ID1_ACKCTS_6MB 0x01000000 /* Use 6Mbit/s for ACK/CTS (?) */ 1062 + #define AR5K_STA_ID1_RTS_DEF_ANTENNA 0x00800000 /* Use default antenna for RTS */ 1063 + #define AR5K_STA_ID1_ACKCTS_6MB 0x01000000 /* Use 6Mbit/s for ACK/CTS */ 1142 1064 #define AR5K_STA_ID1_BASE_RATE_11B 0x02000000 /* Use 11b base rate (for ACK/CTS ?) [5211+] */ 1065 + #define AR5K_STA_ID1_SELF_GEN_SECTORE 0x04000000 /* Self generate sectore (?) */ 1066 + #define AR5K_STA_ID1_CRYPT_MIC_EN 0x08000000 /* Enable MIC */ 1067 + #define AR5K_STA_ID1_KEYSRCH_MODE 0x10000000 /* Keysearch mode (?) */ 1068 + #define AR5K_STA_ID1_PRESERVE_SEQ_NUM 0x20000000 /* Preserve sequence number */ 1143 1069 1144 1070 /* 1145 1071 * First BSSID register (MAC address, lower 32bits) ··· 1199 1117 * 1200 1118 * Retry limit register for 5210 (no QCU/DCU so it's done in PCU) 1201 1119 */ 1202 - #define AR5K_NODCU_RETRY_LMT 0x801c /*Register Address */ 1120 + #define AR5K_NODCU_RETRY_LMT 0x801c /* Register Address */ 1203 1121 #define AR5K_NODCU_RETRY_LMT_SH_RETRY 0x0000000f /* Short retry limit mask */ 1204 1122 #define AR5K_NODCU_RETRY_LMT_SH_RETRY_S 0 1205 1123 #define AR5K_NODCU_RETRY_LMT_LG_RETRY 0x000000f0 /* Long retry mask */ ··· 1218 1136 #define AR5K_USEC_5211 0x801c /* Register Address [5211+] */ 1219 1137 #define AR5K_USEC (ah->ah_version == AR5K_AR5210 ? \ 1220 1138 AR5K_USEC_5210 : AR5K_USEC_5211) 1221 - #define AR5K_USEC_1 0x0000007f 1139 + #define AR5K_USEC_1 0x0000007f /* clock cycles for 1us */ 1222 1140 #define AR5K_USEC_1_S 0 1223 - #define AR5K_USEC_32 0x00003f80 1141 + #define AR5K_USEC_32 0x00003f80 /* clock cycles for 1us while on 32Mhz clock */ 1224 1142 #define AR5K_USEC_32_S 7 1225 1143 #define AR5K_USEC_TX_LATENCY_5211 0x007fc000 1226 1144 #define AR5K_USEC_TX_LATENCY_5211_S 14 ··· 1234 1152 /* 1235 1153 * PCU beacon control register 1236 1154 */ 1237 - #define AR5K_BEACON_5210 0x8024 1238 - #define AR5K_BEACON_5211 0x8020 1155 + #define AR5K_BEACON_5210 0x8024 /*Register Address [5210] */ 1156 + #define AR5K_BEACON_5211 0x8020 /*Register Address [5211+] */ 1239 1157 #define AR5K_BEACON (ah->ah_version == AR5K_AR5210 ? \ 1240 1158 AR5K_BEACON_5210 : AR5K_BEACON_5211) 1241 - #define AR5K_BEACON_PERIOD 0x0000ffff 1159 + #define AR5K_BEACON_PERIOD 0x0000ffff /* Mask for beacon period */ 1242 1160 #define AR5K_BEACON_PERIOD_S 0 1243 - #define AR5K_BEACON_TIM 0x007f0000 1161 + #define AR5K_BEACON_TIM 0x007f0000 /* Mask for TIM offset */ 1244 1162 #define AR5K_BEACON_TIM_S 16 1245 - #define AR5K_BEACON_ENABLE 0x00800000 1246 - #define AR5K_BEACON_RESET_TSF 0x01000000 1163 + #define AR5K_BEACON_ENABLE 0x00800000 /* Enable beacons */ 1164 + #define AR5K_BEACON_RESET_TSF 0x01000000 /* Force TSF reset */ 1247 1165 1248 1166 /* 1249 1167 * CFP period register ··· 1316 1234 1317 1235 /* 1318 1236 * Receive filter register 1319 - * TODO: Get these out of ar5xxx.h on ath5k 1320 1237 */ 1321 1238 #define AR5K_RX_FILTER_5210 0x804c /* Register Address [5210] */ 1322 1239 #define AR5K_RX_FILTER_5211 0x803c /* Register Address [5211+] */ ··· 1388 1307 #define AR5K_DIAG_SW_5211 0x8048 /* Register Address [5211+] */ 1389 1308 #define AR5K_DIAG_SW (ah->ah_version == AR5K_AR5210 ? \ 1390 1309 AR5K_DIAG_SW_5210 : AR5K_DIAG_SW_5211) 1391 - #define AR5K_DIAG_SW_DIS_WEP_ACK 0x00000001 1392 - #define AR5K_DIAG_SW_DIS_ACK 0x00000002 /* Disable ACKs (?) */ 1393 - #define AR5K_DIAG_SW_DIS_CTS 0x00000004 /* Disable CTSs (?) */ 1394 - #define AR5K_DIAG_SW_DIS_ENC 0x00000008 /* Disable encryption (?) */ 1395 - #define AR5K_DIAG_SW_DIS_DEC 0x00000010 /* Disable decryption (?) */ 1310 + #define AR5K_DIAG_SW_DIS_WEP_ACK 0x00000001 /* Disable ACKs if WEP key is invalid */ 1311 + #define AR5K_DIAG_SW_DIS_ACK 0x00000002 /* Disable ACKs */ 1312 + #define AR5K_DIAG_SW_DIS_CTS 0x00000004 /* Disable CTSs */ 1313 + #define AR5K_DIAG_SW_DIS_ENC 0x00000008 /* Disable encryption */ 1314 + #define AR5K_DIAG_SW_DIS_DEC 0x00000010 /* Disable decryption */ 1396 1315 #define AR5K_DIAG_SW_DIS_TX 0x00000020 /* Disable transmit [5210] */ 1397 1316 #define AR5K_DIAG_SW_DIS_RX_5210 0x00000040 /* Disable recieve */ 1398 1317 #define AR5K_DIAG_SW_DIS_RX_5211 0x00000020 ··· 1410 1329 #define AR5K_DIAG_SW_CHAN_INFO_5211 0x00000100 1411 1330 #define AR5K_DIAG_SW_CHAN_INFO (ah->ah_version == AR5K_AR5210 ? \ 1412 1331 AR5K_DIAG_SW_CHAN_INFO_5210 : AR5K_DIAG_SW_CHAN_INFO_5211) 1413 - #define AR5K_DIAG_SW_EN_SCRAM_SEED_5211 0x00000200 /* Scrambler seed (?) */ 1332 + #define AR5K_DIAG_SW_EN_SCRAM_SEED_5211 0x00000200 /* Enable scrambler seed */ 1414 1333 #define AR5K_DIAG_SW_EN_SCRAM_SEED_5210 0x00000400 1415 1334 #define AR5K_DIAG_SW_EN_SCRAM_SEED (ah->ah_version == AR5K_AR5210 ? \ 1416 1335 AR5K_DIAG_SW_EN_SCRAM_SEED_5210 : AR5K_DIAG_SW_EN_SCRAM_SEED_5211) 1417 1336 #define AR5K_DIAG_SW_ECO_ENABLE 0x00000400 /* [5211+] */ 1418 1337 #define AR5K_DIAG_SW_SCVRAM_SEED 0x0003f800 /* [5210] */ 1419 - #define AR5K_DIAG_SW_SCRAM_SEED_M 0x0001fc00 /* Scrambler seed mask (?) */ 1338 + #define AR5K_DIAG_SW_SCRAM_SEED_M 0x0001fc00 /* Scrambler seed mask */ 1420 1339 #define AR5K_DIAG_SW_SCRAM_SEED_S 10 1421 1340 #define AR5K_DIAG_SW_DIS_SEQ_INC 0x00040000 /* Disable seqnum increment (?)[5210] */ 1422 1341 #define AR5K_DIAG_SW_FRAME_NV0_5210 0x00080000 ··· 1425 1344 AR5K_DIAG_SW_FRAME_NV0_5210 : AR5K_DIAG_SW_FRAME_NV0_5211) 1426 1345 #define AR5K_DIAG_SW_OBSPT_M 0x000c0000 1427 1346 #define AR5K_DIAG_SW_OBSPT_S 18 1347 + /* more bits */ 1428 1348 1429 1349 /* 1430 1350 * TSF (clock) register (lower 32 bits) ··· 1451 1369 /* 1452 1370 * ADDAC test register [5211+] 1453 1371 */ 1454 - #define AR5K_ADDAC_TEST 0x8054 1455 - #define AR5K_ADDAC_TEST_TXCONT 0x00000001 1372 + #define AR5K_ADDAC_TEST 0x8054 /* Register Address */ 1373 + #define AR5K_ADDAC_TEST_TXCONT 0x00000001 /* Test continuous tx */ 1374 + #define AR5K_ADDAC_TEST_TST_MODE 0x00000002 /* Test mode */ 1375 + #define AR5K_ADDAC_TEST_LOOP_EN 0x00000004 /* Enable loop */ 1376 + #define AR5K_ADDAC_TEST_LOOP_LEN 0x00000008 /* Loop length (field) */ 1377 + #define AR5K_ADDAC_TEST_USE_U8 0x00004000 /* Use upper 8 bits */ 1378 + #define AR5K_ADDAC_TEST_MSB 0x00008000 /* State of MSB */ 1379 + #define AR5K_ADDAC_TEST_TRIG_SEL 0x00010000 /* Trigger select */ 1380 + #define AR5K_ADDAC_TEST_TRIG_PTY 0x00020000 /* Trigger polarity */ 1381 + #define AR5K_ADDAC_TEST_RXCONT 0x00040000 /* Continuous capture */ 1382 + #define AR5K_ADDAC_TEST_CAPTURE 0x00080000 /* Begin capture */ 1383 + #define AR5K_ADDAC_TEST_TST_ARM 0x00100000 /* Test ARM (Adaptive Radio Mode ?) */ 1456 1384 1457 1385 /* 1458 1386 * Default antenna register [5211+] 1459 1387 */ 1460 1388 #define AR5K_DEFAULT_ANTENNA 0x8058 1461 1389 1390 + /* 1391 + * Frame control QoS mask register (?) [5211+] 1392 + * (FC_QOS_MASK) 1393 + */ 1394 + #define AR5K_FRAME_CTL_QOSM 0x805c 1462 1395 1396 + /* 1397 + * Seq mask register (?) [5211+] 1398 + */ 1399 + #define AR5K_SEQ_MASK 0x8060 1463 1400 1464 1401 /* 1465 1402 * Retry count register [5210] ··· 1550 1449 /* 1551 1450 * XR (eXtended Range) mode register 1552 1451 */ 1553 - #define AR5K_XRMODE 0x80c0 1554 - #define AR5K_XRMODE_POLL_TYPE_M 0x0000003f 1452 + #define AR5K_XRMODE 0x80c0 /* Register Address */ 1453 + #define AR5K_XRMODE_POLL_TYPE_M 0x0000003f /* Mask for Poll type (?) */ 1555 1454 #define AR5K_XRMODE_POLL_TYPE_S 0 1556 - #define AR5K_XRMODE_POLL_SUBTYPE_M 0x0000003c 1455 + #define AR5K_XRMODE_POLL_SUBTYPE_M 0x0000003c /* Mask for Poll subtype (?) */ 1557 1456 #define AR5K_XRMODE_POLL_SUBTYPE_S 2 1558 - #define AR5K_XRMODE_POLL_WAIT_ALL 0x00000080 1559 - #define AR5K_XRMODE_SIFS_DELAY 0x000fff00 1560 - #define AR5K_XRMODE_FRAME_HOLD_M 0xfff00000 1457 + #define AR5K_XRMODE_POLL_WAIT_ALL 0x00000080 /* Wait for poll */ 1458 + #define AR5K_XRMODE_SIFS_DELAY 0x000fff00 /* Mask for SIFS delay */ 1459 + #define AR5K_XRMODE_FRAME_HOLD_M 0xfff00000 /* Mask for frame hold (?) */ 1561 1460 #define AR5K_XRMODE_FRAME_HOLD_S 20 1562 1461 1563 1462 /* 1564 1463 * XR delay register 1565 1464 */ 1566 - #define AR5K_XRDELAY 0x80c4 1567 - #define AR5K_XRDELAY_SLOT_DELAY_M 0x0000ffff 1465 + #define AR5K_XRDELAY 0x80c4 /* Register Address */ 1466 + #define AR5K_XRDELAY_SLOT_DELAY_M 0x0000ffff /* Mask for slot delay */ 1568 1467 #define AR5K_XRDELAY_SLOT_DELAY_S 0 1569 - #define AR5K_XRDELAY_CHIRP_DELAY_M 0xffff0000 1468 + #define AR5K_XRDELAY_CHIRP_DELAY_M 0xffff0000 /* Mask for CHIRP data delay */ 1570 1469 #define AR5K_XRDELAY_CHIRP_DELAY_S 16 1571 1470 1572 1471 /* 1573 1472 * XR timeout register 1574 1473 */ 1575 - #define AR5K_XRTIMEOUT 0x80c8 1576 - #define AR5K_XRTIMEOUT_CHIRP_M 0x0000ffff 1474 + #define AR5K_XRTIMEOUT 0x80c8 /* Register Address */ 1475 + #define AR5K_XRTIMEOUT_CHIRP_M 0x0000ffff /* Mask for CHIRP timeout */ 1577 1476 #define AR5K_XRTIMEOUT_CHIRP_S 0 1578 - #define AR5K_XRTIMEOUT_POLL_M 0xffff0000 1477 + #define AR5K_XRTIMEOUT_POLL_M 0xffff0000 /* Mask for Poll timeout */ 1579 1478 #define AR5K_XRTIMEOUT_POLL_S 16 1580 1479 1581 1480 /* 1582 1481 * XR chirp register 1583 1482 */ 1584 - #define AR5K_XRCHIRP 0x80cc 1585 - #define AR5K_XRCHIRP_SEND 0x00000001 1586 - #define AR5K_XRCHIRP_GAP 0xffff0000 1483 + #define AR5K_XRCHIRP 0x80cc /* Register Address */ 1484 + #define AR5K_XRCHIRP_SEND 0x00000001 /* Send CHIRP */ 1485 + #define AR5K_XRCHIRP_GAP 0xffff0000 /* Mask for CHIRP gap (?) */ 1587 1486 1588 1487 /* 1589 1488 * XR stomp register 1590 1489 */ 1591 - #define AR5K_XRSTOMP 0x80d0 1592 - #define AR5K_XRSTOMP_TX 0x00000001 1593 - #define AR5K_XRSTOMP_RX_ABORT 0x00000002 1594 - #define AR5K_XRSTOMP_RSSI_THRES 0x0000ff00 1490 + #define AR5K_XRSTOMP 0x80d0 /* Register Address */ 1491 + #define AR5K_XRSTOMP_TX 0x00000001 /* Stomp Tx (?) */ 1492 + #define AR5K_XRSTOMP_RX 0x00000002 /* Stomp Rx (?) */ 1493 + #define AR5K_XRSTOMP_TX_RSSI 0x00000004 /* Stomp Tx RSSI (?) */ 1494 + #define AR5K_XRSTOMP_TX_BSSID 0x00000008 /* Stomp Tx BSSID (?) */ 1495 + #define AR5K_XRSTOMP_DATA 0x00000010 /* Stomp data (?)*/ 1496 + #define AR5K_XRSTOMP_RSSI_THRES 0x0000ff00 /* Mask for XR RSSI threshold */ 1595 1497 1596 1498 /* 1597 1499 * First enhanced sleep register 1598 1500 */ 1599 - #define AR5K_SLEEP0 0x80d4 1600 - #define AR5K_SLEEP0_NEXT_DTIM 0x0007ffff 1501 + #define AR5K_SLEEP0 0x80d4 /* Register Address */ 1502 + #define AR5K_SLEEP0_NEXT_DTIM 0x0007ffff /* Mask for next DTIM (?) */ 1601 1503 #define AR5K_SLEEP0_NEXT_DTIM_S 0 1602 - #define AR5K_SLEEP0_ASSUME_DTIM 0x00080000 1603 - #define AR5K_SLEEP0_ENH_SLEEP_EN 0x00100000 1604 - #define AR5K_SLEEP0_CABTO 0xff000000 1504 + #define AR5K_SLEEP0_ASSUME_DTIM 0x00080000 /* Assume DTIM */ 1505 + #define AR5K_SLEEP0_ENH_SLEEP_EN 0x00100000 /* Enable enchanced sleep control */ 1506 + #define AR5K_SLEEP0_CABTO 0xff000000 /* Mask for CAB Time Out */ 1605 1507 #define AR5K_SLEEP0_CABTO_S 24 1606 1508 1607 1509 /* 1608 1510 * Second enhanced sleep register 1609 1511 */ 1610 - #define AR5K_SLEEP1 0x80d8 1611 - #define AR5K_SLEEP1_NEXT_TIM 0x0007ffff 1512 + #define AR5K_SLEEP1 0x80d8 /* Register Address */ 1513 + #define AR5K_SLEEP1_NEXT_TIM 0x0007ffff /* Mask for next TIM (?) */ 1612 1514 #define AR5K_SLEEP1_NEXT_TIM_S 0 1613 - #define AR5K_SLEEP1_BEACON_TO 0xff000000 1515 + #define AR5K_SLEEP1_BEACON_TO 0xff000000 /* Mask for Beacon Time Out */ 1614 1516 #define AR5K_SLEEP1_BEACON_TO_S 24 1615 1517 1616 1518 /* 1617 1519 * Third enhanced sleep register 1618 1520 */ 1619 - #define AR5K_SLEEP2 0x80dc 1620 - #define AR5K_SLEEP2_TIM_PER 0x0000ffff 1521 + #define AR5K_SLEEP2 0x80dc /* Register Address */ 1522 + #define AR5K_SLEEP2_TIM_PER 0x0000ffff /* Mask for TIM period (?) */ 1621 1523 #define AR5K_SLEEP2_TIM_PER_S 0 1622 - #define AR5K_SLEEP2_DTIM_PER 0xffff0000 1524 + #define AR5K_SLEEP2_DTIM_PER 0xffff0000 /* Mask for DTIM period (?) */ 1623 1525 #define AR5K_SLEEP2_DTIM_PER_S 16 1624 1526 1625 1527 /* 1626 1528 * BSSID mask registers 1627 1529 */ 1628 - #define AR5K_BSS_IDM0 0x80e0 1629 - #define AR5K_BSS_IDM1 0x80e4 1530 + #define AR5K_BSS_IDM0 0x80e0 /* Upper bits */ 1531 + #define AR5K_BSS_IDM1 0x80e4 /* Lower bits */ 1630 1532 1631 1533 /* 1632 1534 * TX power control (TPC) register 1535 + * 1536 + * XXX: PCDAC steps (0.5dbm) or DBM ? 1537 + * 1538 + * XXX: Mask changes for newer chips to 7f 1539 + * like tx power table ? 1633 1540 */ 1634 - #define AR5K_TXPC 0x80e8 1635 - #define AR5K_TXPC_ACK_M 0x0000003f 1541 + #define AR5K_TXPC 0x80e8 /* Register Address */ 1542 + #define AR5K_TXPC_ACK_M 0x0000003f /* Mask for ACK tx power */ 1636 1543 #define AR5K_TXPC_ACK_S 0 1637 - #define AR5K_TXPC_CTS_M 0x00003f00 1544 + #define AR5K_TXPC_CTS_M 0x00003f00 /* Mask for CTS tx power */ 1638 1545 #define AR5K_TXPC_CTS_S 8 1639 - #define AR5K_TXPC_CHIRP_M 0x003f0000 1546 + #define AR5K_TXPC_CHIRP_M 0x003f0000 /* Mask for CHIRP tx power */ 1640 1547 #define AR5K_TXPC_CHIRP_S 22 1641 1548 1642 1549 /* 1643 1550 * Profile count registers 1644 1551 */ 1645 - #define AR5K_PROFCNT_TX 0x80ec 1646 - #define AR5K_PROFCNT_RX 0x80f0 1647 - #define AR5K_PROFCNT_RXCLR 0x80f4 1648 - #define AR5K_PROFCNT_CYCLE 0x80f8 1552 + #define AR5K_PROFCNT_TX 0x80ec /* Tx count */ 1553 + #define AR5K_PROFCNT_RX 0x80f0 /* Rx count */ 1554 + #define AR5K_PROFCNT_RXCLR 0x80f4 /* Clear Rx count */ 1555 + #define AR5K_PROFCNT_CYCLE 0x80f8 /* Cycle count (?) */ 1556 + 1557 + /* 1558 + * Quiet (period) control registers (?) 1559 + */ 1560 + #define AR5K_QUIET_CTL1 0x80fc /* Register Address */ 1561 + #define AR5K_QUIET_CTL1_NEXT_QT 0x0000ffff /* Mask for next quiet (period?) (?) */ 1562 + #define AR5K_QUIET_CTL1_QT_EN 0x00010000 /* Enable quiet (period?) */ 1563 + #define AR5K_QUIET_CTL2 0x8100 /* Register Address */ 1564 + #define AR5K_QUIET_CTL2_QT_PER 0x0000ffff /* Mask for quiet period (?) */ 1565 + #define AR5K_QUIET_CTL2_QT_DUR 0xffff0000 /* Mask for quiet duration (?) */ 1649 1566 1650 1567 /* 1651 1568 * TSF parameter register 1652 1569 */ 1653 - #define AR5K_TSF_PARM 0x8104 1654 - #define AR5K_TSF_PARM_INC_M 0x000000ff 1570 + #define AR5K_TSF_PARM 0x8104 /* Register Address */ 1571 + #define AR5K_TSF_PARM_INC_M 0x000000ff /* Mask for TSF increment */ 1655 1572 #define AR5K_TSF_PARM_INC_S 0 1573 + 1574 + /* 1575 + * QoS register (?) 1576 + */ 1577 + #define AR5K_QOS 0x8108 /* Register Address */ 1578 + #define AR5K_QOS_NOACK_2BIT_VALUES 0x00000000 /* (field) */ 1579 + #define AR5K_QOS_NOACK_BIT_OFFSET 0x00000020 /* (field) */ 1580 + #define AR5K_QOS_NOACK_BYTE_OFFSET 0x00000080 /* (field) */ 1656 1581 1657 1582 /* 1658 1583 * PHY error filter register 1659 1584 */ 1660 1585 #define AR5K_PHY_ERR_FIL 0x810c 1661 - #define AR5K_PHY_ERR_FIL_RADAR 0x00000020 1662 - #define AR5K_PHY_ERR_FIL_OFDM 0x00020000 1663 - #define AR5K_PHY_ERR_FIL_CCK 0x02000000 1586 + #define AR5K_PHY_ERR_FIL_RADAR 0x00000020 /* Radar signal */ 1587 + #define AR5K_PHY_ERR_FIL_OFDM 0x00020000 /* OFDM false detect (ANI) */ 1588 + #define AR5K_PHY_ERR_FIL_CCK 0x02000000 /* CCK false detect (ANI) */ 1664 1589 1665 1590 /* 1666 - * Rate duration register 1591 + * XR latency register 1592 + */ 1593 + #define AR5K_XRLAT_TX 0x8110 1594 + 1595 + /* 1596 + * ACK SIFS register 1597 + */ 1598 + #define AR5K_ACKSIFS 0x8114 /* Register Address */ 1599 + #define AR5K_ACKSIFS_INC 0x00000000 /* ACK SIFS Increment (field) */ 1600 + 1601 + /* 1602 + * MIC QoS control register (?) 1603 + */ 1604 + #define AR5K_MIC_QOS_CTL 0x8118 /* Register Address */ 1605 + #define AR5K_MIC_QOS_CTL_0 0x00000001 /* MIC QoS control 0 (?) */ 1606 + #define AR5K_MIC_QOS_CTL_1 0x00000004 /* MIC QoS control 1 (?) */ 1607 + #define AR5K_MIC_QOS_CTL_2 0x00000010 /* MIC QoS control 2 (?) */ 1608 + #define AR5K_MIC_QOS_CTL_3 0x00000040 /* MIC QoS control 3 (?) */ 1609 + #define AR5K_MIC_QOS_CTL_4 0x00000100 /* MIC QoS control 4 (?) */ 1610 + #define AR5K_MIC_QOS_CTL_5 0x00000400 /* MIC QoS control 5 (?) */ 1611 + #define AR5K_MIC_QOS_CTL_6 0x00001000 /* MIC QoS control 6 (?) */ 1612 + #define AR5K_MIC_QOS_CTL_7 0x00004000 /* MIC QoS control 7 (?) */ 1613 + #define AR5K_MIC_QOS_CTL_MQ_EN 0x00010000 /* Enable MIC QoS */ 1614 + 1615 + /* 1616 + * MIC QoS select register (?) 1617 + */ 1618 + #define AR5K_MIC_QOS_SEL 0x811c 1619 + #define AR5K_MIC_QOS_SEL_0 0x00000001 1620 + #define AR5K_MIC_QOS_SEL_1 0x00000010 1621 + #define AR5K_MIC_QOS_SEL_2 0x00000100 1622 + #define AR5K_MIC_QOS_SEL_3 0x00001000 1623 + #define AR5K_MIC_QOS_SEL_4 0x00010000 1624 + #define AR5K_MIC_QOS_SEL_5 0x00100000 1625 + #define AR5K_MIC_QOS_SEL_6 0x01000000 1626 + #define AR5K_MIC_QOS_SEL_7 0x10000000 1627 + 1628 + /* 1629 + * Misc mode control register (?) 1630 + */ 1631 + #define AR5K_MISC_MODE 0x8120 /* Register Address */ 1632 + #define AR5K_MISC_MODE_FBSSID_MATCH 0x00000001 /* Force BSSID match */ 1633 + #define AR5K_MISC_MODE_ACKSIFS_MEM 0x00000002 /* ACK SIFS memory (?) */ 1634 + /* more bits */ 1635 + 1636 + /* 1637 + * OFDM Filter counter 1638 + */ 1639 + #define AR5K_OFDM_FIL_CNT 0x8124 1640 + 1641 + /* 1642 + * CCK Filter counter 1643 + */ 1644 + #define AR5K_CCK_FIL_CNT 0x8128 1645 + 1646 + /* 1647 + * PHY Error Counters (?) 1648 + */ 1649 + #define AR5K_PHYERR_CNT1 0x812c 1650 + #define AR5K_PHYERR_CNT1_MASK 0x8130 1651 + 1652 + #define AR5K_PHYERR_CNT2 0x8134 1653 + #define AR5K_PHYERR_CNT2_MASK 0x8138 1654 + 1655 + /* 1656 + * TSF Threshold register (?) 1657 + */ 1658 + #define AR5K_TSF_THRES 0x813c 1659 + 1660 + /* 1661 + * Rate -> ACK SIFS mapping table (32 entries) 1662 + */ 1663 + #define AR5K_RATE_ACKSIFS_BASE 0x8680 /* Register Address */ 1664 + #define AR5K_RATE_ACKSIFS(_n) (AR5K_RATE_ACKSIFS_BSE + ((_n) << 2)) 1665 + #define AR5K_RATE_ACKSIFS_NORMAL 0x00000001 /* Normal SIFS (field) */ 1666 + #define AR5K_RATE_ACKSIFS_TURBO 0x00000400 /* Turbo SIFS (field) */ 1667 + 1668 + /* 1669 + * Rate -> duration mapping table (32 entries) 1667 1670 */ 1668 1671 #define AR5K_RATE_DUR_BASE 0x8700 1669 1672 #define AR5K_RATE_DUR(_n) (AR5K_RATE_DUR_BASE + ((_n) << 2)) 1673 + 1674 + /* 1675 + * Rate -> db mapping table 1676 + * (8 entries, each one has 4 8bit fields) 1677 + */ 1678 + #define AR5K_RATE2DB_BASE 0x87c0 1679 + #define AR5K_RATE2DB(_n) (AR5K_RATE2DB_BASE + ((_n) << 2)) 1680 + 1681 + /* 1682 + * db -> Rate mapping table 1683 + * (8 entries, each one has 4 8bit fields) 1684 + */ 1685 + #define AR5K_DB2RATE_BASE 0x87e0 1686 + #define AR5K_DB2RATE(_n) (AR5K_DB2RATE_BASE + ((_n) << 2)) 1670 1687 1671 1688 /*===5212 end===*/ 1672 1689 ··· 1832 1613 /*===PHY REGISTERS===*/ 1833 1614 1834 1615 /* 1835 - * PHY register 1616 + * PHY registers start 1836 1617 */ 1837 1618 #define AR5K_PHY_BASE 0x9800 1838 1619 #define AR5K_PHY(_n) (AR5K_PHY_BASE + ((_n) << 2)) 1839 - #define AR5K_PHY_SHIFT_2GHZ 0x00004007 1840 - #define AR5K_PHY_SHIFT_5GHZ 0x00000007 1620 + 1621 + /* 1622 + * TST_2 (Misc config parameters) 1623 + */ 1624 + #define AR5K_PHY_TST2 0x9800 /* Register Address */ 1625 + #define AR5K_PHY_TST2_TRIG_SEL 0x00000001 /* Trigger select (?) (field ?) */ 1626 + #define AR5K_PHY_TST2_TRIG 0x00000010 /* Trigger (?) (field ?) */ 1627 + #define AR5K_PHY_TST2_CBUS_MODE 0x00000100 /* Cardbus mode (?) */ 1628 + /* bit reserved */ 1629 + #define AR5K_PHY_TST2_CLK32 0x00000400 /* CLK_OUT is CLK32 (32Khz external) */ 1630 + #define AR5K_PHY_TST2_CHANCOR_DUMP_EN 0x00000800 /* Enable Chancor dump (?) */ 1631 + #define AR5K_PHY_TST2_EVEN_CHANCOR_DUMP 0x00001000 /* Even Chancor dump (?) */ 1632 + #define AR5K_PHY_TST2_RFSILENT_EN 0x00002000 /* Enable RFSILENT */ 1633 + #define AR5K_PHY_TST2_ALT_RFDATA 0x00004000 /* Alternate RFDATA (5-2GHz switch) */ 1634 + #define AR5K_PHY_TST2_MINI_OBS_EN 0x00008000 /* Enable mini OBS (?) */ 1635 + #define AR5K_PHY_TST2_RX2_IS_RX5_INV 0x00010000 /* 2GHz rx path is the 5GHz path inverted (?) */ 1636 + #define AR5K_PHY_TST2_SLOW_CLK160 0x00020000 /* Slow CLK160 (?) */ 1637 + #define AR5K_PHY_TST2_AGC_OBS_SEL_3 0x00040000 /* AGC OBS Select 3 (?) */ 1638 + #define AR5K_PHY_TST2_BBB_OBS_SEL 0x00080000 /* BB OBS Select (field ?) */ 1639 + #define AR5K_PHY_TST2_ADC_OBS_SEL 0x00800000 /* ADC OBS Select (field ?) */ 1640 + #define AR5K_PHY_TST2_RX_CLR_SEL 0x08000000 /* RX Clear Select (?) */ 1641 + #define AR5K_PHY_TST2_FORCE_AGC_CLR 0x10000000 /* Force AGC clear (?) */ 1642 + #define AR5K_PHY_SHIFT_2GHZ 0x00004007 /* Used to access 2GHz radios */ 1643 + #define AR5K_PHY_SHIFT_5GHZ 0x00000007 /* Used to access 5GHz radios (default) */ 1841 1644 1842 1645 /* 1843 1646 * PHY frame control register [5110] /turbo mode register [5111+] ··· 1871 1630 * a "turbo mode register" for 5110. We treat this one as 1872 1631 * a frame control register for 5110 below. 1873 1632 */ 1874 - #define AR5K_PHY_TURBO 0x9804 1875 - #define AR5K_PHY_TURBO_MODE 0x00000001 1876 - #define AR5K_PHY_TURBO_SHORT 0x00000002 1633 + #define AR5K_PHY_TURBO 0x9804 /* Register Address */ 1634 + #define AR5K_PHY_TURBO_MODE 0x00000001 /* Enable turbo mode */ 1635 + #define AR5K_PHY_TURBO_SHORT 0x00000002 /* Short mode (20Mhz channels) (?) */ 1877 1636 1878 1637 /* 1879 1638 * PHY agility command register 1639 + * (aka TST_1) 1880 1640 */ 1881 - #define AR5K_PHY_AGC 0x9808 1882 - #define AR5K_PHY_AGC_DISABLE 0x08000000 1641 + #define AR5K_PHY_AGC 0x9808 /* Register Address */ 1642 + #define AR5K_PHY_TST1 0x9808 1643 + #define AR5K_PHY_AGC_DISABLE 0x08000000 /* Disable AGC to A2 (?)*/ 1644 + #define AR5K_PHY_TST1_TXHOLD 0x00003800 /* Set tx hold (?) */ 1883 1645 1884 1646 /* 1885 - * PHY timing register [5112+] 1647 + * PHY timing register 3 [5112+] 1886 1648 */ 1887 1649 #define AR5K_PHY_TIMING_3 0x9814 1888 1650 #define AR5K_PHY_TIMING_3_DSC_MAN 0xfffe0000 ··· 1901 1657 /* 1902 1658 * PHY activation register 1903 1659 */ 1904 - #define AR5K_PHY_ACT 0x981c 1905 - #define AR5K_PHY_ACT_ENABLE 0x00000001 1906 - #define AR5K_PHY_ACT_DISABLE 0x00000002 1660 + #define AR5K_PHY_ACT 0x981c /* Register Address */ 1661 + #define AR5K_PHY_ACT_ENABLE 0x00000001 /* Activate PHY */ 1662 + #define AR5K_PHY_ACT_DISABLE 0x00000002 /* Deactivate PHY */ 1663 + 1664 + /* 1665 + * PHY RF control registers 1666 + * (i think these are delay times, 1667 + * these calibration values exist 1668 + * in EEPROM) 1669 + */ 1670 + #define AR5K_PHY_RF_CTL2 0x9824 /* Register Address */ 1671 + #define AR5K_PHY_RF_CTL2_TXF2TXD_START 0x0000000f /* Mask for TX frame to TX d(esc?) start */ 1672 + 1673 + #define AR5K_PHY_RF_CTL3 0x9828 /* Register Address */ 1674 + #define AR5K_PHY_RF_CTL3_TXE2XLNA_ON 0x0000000f /* Mask for TX end to XLNA on */ 1675 + 1676 + #define AR5K_PHY_RF_CTL4 0x9834 /* Register Address */ 1677 + #define AR5K_PHY_RF_CTL4_TXF2XPA_A_ON 0x00000001 /* TX frame to XPA A on (field) */ 1678 + #define AR5K_PHY_RF_CTL4_TXF2XPA_B_ON 0x00000100 /* TX frame to XPA B on (field) */ 1679 + #define AR5K_PHY_RF_CTL4_TXE2XPA_A_OFF 0x00010000 /* TX end to XPA A off (field) */ 1680 + #define AR5K_PHY_RF_CTL4_TXE2XPA_B_OFF 0x01000000 /* TX end to XPA B off (field) */ 1681 + 1682 + /* 1683 + * Pre-Amplifier control register 1684 + * (XPA -> external pre-amplifier) 1685 + */ 1686 + #define AR5K_PHY_PA_CTL 0x9838 /* Register Address */ 1687 + #define AR5K_PHY_PA_CTL_XPA_A_HI 0x00000001 /* XPA A high (?) */ 1688 + #define AR5K_PHY_PA_CTL_XPA_B_HI 0x00000002 /* XPA B high (?) */ 1689 + #define AR5K_PHY_PA_CTL_XPA_A_EN 0x00000004 /* Enable XPA A */ 1690 + #define AR5K_PHY_PA_CTL_XPA_B_EN 0x00000008 /* Enable XPA B */ 1691 + 1692 + /* 1693 + * PHY settling register 1694 + */ 1695 + #define AR5K_PHY_SETTLING 0x9844 /* Register Address */ 1696 + #define AR5K_PHY_SETTLING_AGC 0x0000007f /* Mask for AGC settling time */ 1697 + #define AR5K_PHY_SETTLING_SWITCH 0x00003f80 /* Mask for Switch settlig time */ 1698 + 1699 + /* 1700 + * PHY Gain registers 1701 + */ 1702 + #define AR5K_PHY_GAIN 0x9848 /* Register Address */ 1703 + #define AR5K_PHY_GAIN_TXRX_ATTEN 0x0003f000 /* Mask for TX-RX Attenuation */ 1704 + 1705 + #define AR5K_PHY_GAIN_OFFSET 0x984c /* Register Address */ 1706 + #define AR5K_PHY_GAIN_OFFSET_RXTX_FLAG 0x00020000 /* RX-TX flag (?) */ 1707 + 1708 + /* 1709 + * Desired size register 1710 + * (for more infos read ANI patent) 1711 + */ 1712 + #define AR5K_PHY_DESIRED_SIZE 0x9850 /* Register Address */ 1713 + #define AR5K_PHY_DESIRED_SIZE_ADC 0x000000ff /* Mask for ADC desired size */ 1714 + #define AR5K_PHY_DESIRED_SIZE_PGA 0x0000ff00 /* Mask for PGA desired size */ 1715 + #define AR5K_PHY_DESIRED_SIZE_TOT 0x0ff00000 /* Mask for Total desired size (?) */ 1907 1716 1908 1717 /* 1909 1718 * PHY signal register 1719 + * (for more infos read ANI patent) 1910 1720 */ 1911 - #define AR5K_PHY_SIG 0x9858 1912 - #define AR5K_PHY_SIG_FIRSTEP 0x0003f000 1721 + #define AR5K_PHY_SIG 0x9858 /* Register Address */ 1722 + #define AR5K_PHY_SIG_FIRSTEP 0x0003f000 /* Mask for FIRSTEP */ 1913 1723 #define AR5K_PHY_SIG_FIRSTEP_S 12 1914 - #define AR5K_PHY_SIG_FIRPWR 0x03fc0000 1724 + #define AR5K_PHY_SIG_FIRPWR 0x03fc0000 /* Mask for FIPWR */ 1915 1725 #define AR5K_PHY_SIG_FIRPWR_S 18 1916 1726 1917 1727 /* 1918 1728 * PHY coarse agility control register 1729 + * (for more infos read ANI patent) 1919 1730 */ 1920 - #define AR5K_PHY_AGCCOARSE 0x985c 1921 - #define AR5K_PHY_AGCCOARSE_LO 0x00007f80 1731 + #define AR5K_PHY_AGCCOARSE 0x985c /* Register Address */ 1732 + #define AR5K_PHY_AGCCOARSE_LO 0x00007f80 /* Mask for AGC Coarse low */ 1922 1733 #define AR5K_PHY_AGCCOARSE_LO_S 7 1923 - #define AR5K_PHY_AGCCOARSE_HI 0x003f8000 1734 + #define AR5K_PHY_AGCCOARSE_HI 0x003f8000 /* Mask for AGC Coarse high */ 1924 1735 #define AR5K_PHY_AGCCOARSE_HI_S 15 1925 1736 1926 1737 /* ··· 1988 1689 /* 1989 1690 * PHY noise floor status register 1990 1691 */ 1991 - #define AR5K_PHY_NF 0x9864 1992 - #define AR5K_PHY_NF_M 0x000001ff 1993 - #define AR5K_PHY_NF_ACTIVE 0x00000100 1692 + #define AR5K_PHY_NF 0x9864 /* Register address */ 1693 + #define AR5K_PHY_NF_M 0x000001ff /* Noise floor mask */ 1694 + #define AR5K_PHY_NF_ACTIVE 0x00000100 /* Noise floor calibration still active */ 1994 1695 #define AR5K_PHY_NF_RVAL(_n) (((_n) >> 19) & AR5K_PHY_NF_M) 1995 1696 #define AR5K_PHY_NF_AVAL(_n) (-((_n) ^ AR5K_PHY_NF_M) + 1) 1996 1697 #define AR5K_PHY_NF_SVAL(_n) (((_n) & AR5K_PHY_NF_M) | (1 << 9)) 1698 + #define AR5K_PHY_NF_THRESH62 0x00001000 /* Thresh62 -check ANI patent- (field) */ 1997 1699 1998 1700 /* 1999 1701 * PHY ADC saturation register [5110] ··· 2004 1704 #define AR5K_PHY_ADCSAT_ICNT_S 11 2005 1705 #define AR5K_PHY_ADCSAT_THR 0x000007e0 2006 1706 #define AR5K_PHY_ADCSAT_THR_S 5 1707 + 1708 + /* 1709 + * PHY Weak ofdm signal detection threshold registers (ANI) [5212+] 1710 + */ 1711 + 1712 + /* High thresholds */ 1713 + #define AR5K_PHY_WEAK_OFDM_HIGH_THR 0x9868 1714 + #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT 0x0000001f 1715 + #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT_S 0 1716 + #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M1 0x00fe0000 1717 + #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M1_S 17 1718 + #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2 0x7f000000 1719 + #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_S 24 1720 + 1721 + /* Low thresholds */ 1722 + #define AR5K_PHY_WEAK_OFDM_LOW_THR 0x986c 1723 + #define AR5K_PHY_WEAK_OFDM_LOW_THR_SELFCOR_EN 0x00000001 1724 + #define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT 0x00003f00 1725 + #define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT_S 8 1726 + #define AR5K_PHY_WEAK_OFDM_LOW_THR_M1 0x001fc000 1727 + #define AR5K_PHY_WEAK_OFDM_LOW_THR_M1_S 14 1728 + #define AR5K_PHY_WEAK_OFDM_LOW_THR_M2 0x0fe00000 1729 + #define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_S 21 1730 + 2007 1731 2008 1732 /* 2009 1733 * PHY sleep registers [5112+] ··· 2054 1730 AR5K_PHY_PLL_44MHZ_5211 : AR5K_PHY_PLL_44MHZ_5212) 2055 1731 #define AR5K_PHY_PLL_RF5111 0x00000000 2056 1732 #define AR5K_PHY_PLL_RF5112 0x00000040 1733 + #define AR5K_PHY_PLL_HALF_RATE 0x00000100 1734 + #define AR5K_PHY_PLL_QUARTER_RATE 0x00000200 2057 1735 2058 1736 /* 2059 1737 * RF Buffer register ··· 2118 1792 #define AR5K_PHY_RFSTG_DISABLE 0x00000021 2119 1793 2120 1794 /* 2121 - * PHY receiver delay register [5111+] 1795 + * PHY Antenna control register 2122 1796 */ 2123 - #define AR5K_PHY_RX_DELAY 0x9914 2124 - #define AR5K_PHY_RX_DELAY_M 0x00003fff 1797 + #define AR5K_PHY_ANT_CTL 0x9910 /* Register Address */ 1798 + #define AR5K_PHY_ANT_CTL_TXRX_EN 0x00000001 /* Enable TX/RX (?) */ 1799 + #define AR5K_PHY_ANT_CTL_SECTORED_ANT 0x00000004 /* Sectored Antenna */ 1800 + #define AR5K_PHY_ANT_CTL_HITUNE5 0x00000008 /* Hitune5 (?) */ 1801 + #define AR5K_PHY_ANT_CTL_SWTABLE_IDLE 0x00000010 /* Switch table idle (?) */ 2125 1802 2126 1803 /* 2127 - * PHY timing I(nphase) Q(adrature) control register [5111+] 1804 + * PHY receiver delay register [5111+] 2128 1805 */ 2129 - #define AR5K_PHY_IQ 0x9920 /* Register address */ 1806 + #define AR5K_PHY_RX_DELAY 0x9914 /* Register Address */ 1807 + #define AR5K_PHY_RX_DELAY_M 0x00003fff /* Mask for RX activate to receive delay (/100ns) */ 1808 + 1809 + /* 1810 + * PHY max rx length register (?) [5111] 1811 + */ 1812 + #define AR5K_PHY_MAX_RX_LEN 0x991c 1813 + 1814 + /* 1815 + * PHY timing register 4 1816 + * I(nphase)/Q(adrature) calibration register [5111+] 1817 + */ 1818 + #define AR5K_PHY_IQ 0x9920 /* Register Address */ 2130 1819 #define AR5K_PHY_IQ_CORR_Q_Q_COFF 0x0000001f /* Mask for q correction info */ 2131 1820 #define AR5K_PHY_IQ_CORR_Q_I_COFF 0x000007e0 /* Mask for i correction info */ 2132 1821 #define AR5K_PHY_IQ_CORR_Q_I_COFF_S 5 2133 1822 #define AR5K_PHY_IQ_CORR_ENABLE 0x00000800 /* Enable i/q correction */ 2134 - #define AR5K_PHY_IQ_CAL_NUM_LOG_MAX 0x0000f000 1823 + #define AR5K_PHY_IQ_CAL_NUM_LOG_MAX 0x0000f000 /* Mask for max number of samples in log scale */ 2135 1824 #define AR5K_PHY_IQ_CAL_NUM_LOG_MAX_S 12 2136 1825 #define AR5K_PHY_IQ_RUN 0x00010000 /* Run i/q calibration */ 1826 + #define AR5K_PHY_IQ_USE_PT_DF 0x00020000 /* Use pilot track df (?) */ 1827 + #define AR5K_PHY_IQ_EARLY_TRIG_THR 0x00200000 /* Early trigger threshold (?) (field) */ 1828 + #define AR5K_PHY_IQ_PILOT_MASK_EN 0x10000000 /* Enable pilot mask (?) */ 1829 + #define AR5K_PHY_IQ_CHAN_MASK_EN 0x20000000 /* Enable channel mask (?) */ 1830 + #define AR5K_PHY_IQ_SPUR_FILT_EN 0x40000000 /* Enable spur filter */ 1831 + #define AR5K_PHY_IQ_SPUR_RSSI_EN 0x80000000 /* Enable spur rssi */ 2137 1832 1833 + /* 1834 + * PHY timing register 5 1835 + * OFDM Self-correlator Cyclic RSSI threshold params 1836 + * (Check out bb_cycpwr_thr1 on ANI patent) 1837 + */ 1838 + #define AR5K_PHY_OFDM_SELFCORR 0x9924 /* Register Address */ 1839 + #define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_EN 0x00000001 /* Enable cyclic RSSI thr 1 */ 1840 + #define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1 0x000000fe /* Mask for Cyclic RSSI threshold 1 */ 1841 + #define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR3 0x00000100 /* Cyclic RSSI threshold 3 (field) (?) */ 1842 + #define AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR_EN 0x00008000 /* Enable 1A RSSI threshold (?) */ 1843 + #define AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR 0x00010000 /* 1A RSSI threshold (field) (?) */ 1844 + #define AR5K_PHY_OFDM_SELFCORR_LSCTHR_HIRSSI 0x00800000 /* Long sc threshold hi rssi (?) */ 1845 + 1846 + /* 1847 + * PHY-only warm reset register 1848 + */ 1849 + #define AR5K_PHY_WARM_RESET 0x9928 1850 + 1851 + /* 1852 + * PHY-only control register 1853 + */ 1854 + #define AR5K_PHY_CTL 0x992c /* Register Address */ 1855 + #define AR5K_PHY_CTL_RX_DRAIN_RATE 0x00000001 /* RX drain rate (?) */ 1856 + #define AR5K_PHY_CTL_LATE_TX_SIG_SYM 0x00000002 /* Late tx signal symbol (?) */ 1857 + #define AR5K_PHY_CTL_GEN_SCRAMBLER 0x00000004 /* Generate scrambler */ 1858 + #define AR5K_PHY_CTL_TX_ANT_SEL 0x00000008 /* TX antenna select */ 1859 + #define AR5K_PHY_CTL_TX_ANT_STATIC 0x00000010 /* Static TX antenna */ 1860 + #define AR5K_PHY_CTL_RX_ANT_SEL 0x00000020 /* RX antenna select */ 1861 + #define AR5K_PHY_CTL_RX_ANT_STATIC 0x00000040 /* Static RX antenna */ 1862 + #define AR5K_PHY_CTL_LOW_FREQ_SLE_EN 0x00000080 /* Enable low freq sleep */ 2138 1863 2139 1864 /* 2140 1865 * PHY PAPD probe register [5111+ (?)] ··· 2193 1816 * Because it's always 0 in 5211 initialization code 2194 1817 */ 2195 1818 #define AR5K_PHY_PAPD_PROBE 0x9930 1819 + #define AR5K_PHY_PAPD_PROBE_SH_HI_PAR 0x00000001 1820 + #define AR5K_PHY_PAPD_PROBE_PCDAC_BIAS 0x00000002 1821 + #define AR5K_PHY_PAPD_PROBE_COMP_GAIN 0x00000040 2196 1822 #define AR5K_PHY_PAPD_PROBE_TXPOWER 0x00007e00 2197 1823 #define AR5K_PHY_PAPD_PROBE_TXPOWER_S 9 2198 1824 #define AR5K_PHY_PAPD_PROBE_TX_NEXT 0x00008000 1825 + #define AR5K_PHY_PAPD_PROBE_PREDIST_EN 0x00010000 2199 1826 #define AR5K_PHY_PAPD_PROBE_TYPE 0x01800000 /* [5112+] */ 2200 1827 #define AR5K_PHY_PAPD_PROBE_TYPE_S 23 2201 1828 #define AR5K_PHY_PAPD_PROBE_TYPE_OFDM 0 ··· 2229 1848 #define AR5K_PHY_FRAME_CTL (ah->ah_version == AR5K_AR5210 ? \ 2230 1849 AR5K_PHY_FRAME_CTL_5210 : AR5K_PHY_FRAME_CTL_5211) 2231 1850 /*---[5111+]---*/ 2232 - #define AR5K_PHY_FRAME_CTL_TX_CLIP 0x00000038 1851 + #define AR5K_PHY_FRAME_CTL_TX_CLIP 0x00000038 /* Mask for tx clip (?) */ 2233 1852 #define AR5K_PHY_FRAME_CTL_TX_CLIP_S 3 1853 + #define AR5K_PHY_FRAME_CTL_PREP_CHINFO 0x00010000 /* Prepend chan info */ 2234 1854 /*---[5110/5111]---*/ 2235 - #define AR5K_PHY_FRAME_CTL_TIMING_ERR 0x01000000 2236 - #define AR5K_PHY_FRAME_CTL_PARITY_ERR 0x02000000 2237 - #define AR5K_PHY_FRAME_CTL_ILLRATE_ERR 0x04000000 /* illegal rate */ 2238 - #define AR5K_PHY_FRAME_CTL_ILLLEN_ERR 0x08000000 /* illegal length */ 1855 + #define AR5K_PHY_FRAME_CTL_TIMING_ERR 0x01000000 /* PHY timing error */ 1856 + #define AR5K_PHY_FRAME_CTL_PARITY_ERR 0x02000000 /* Parity error */ 1857 + #define AR5K_PHY_FRAME_CTL_ILLRATE_ERR 0x04000000 /* Illegal rate */ 1858 + #define AR5K_PHY_FRAME_CTL_ILLLEN_ERR 0x08000000 /* Illegal length */ 2239 1859 #define AR5K_PHY_FRAME_CTL_SERVICE_ERR 0x20000000 2240 - #define AR5K_PHY_FRAME_CTL_TXURN_ERR 0x40000000 /* tx underrun */ 1860 + #define AR5K_PHY_FRAME_CTL_TXURN_ERR 0x40000000 /* TX underrun */ 2241 1861 #define AR5K_PHY_FRAME_CTL_INI AR5K_PHY_FRAME_CTL_SERVICE_ERR | \ 2242 1862 AR5K_PHY_FRAME_CTL_TXURN_ERR | \ 2243 1863 AR5K_PHY_FRAME_CTL_ILLLEN_ERR | \ ··· 2297 1915 #define AR5K_PHY_ANT_SWITCH_TABLE_1 0x9964 2298 1916 2299 1917 /* 1918 + * PHY Noise floor threshold 1919 + */ 1920 + #define AR5K_PHY_NFTHRES 0x9968 1921 + 1922 + /* 2300 1923 * PHY clock sleep registers [5112+] 2301 1924 */ 2302 1925 #define AR5K_PHY_SCLOCK 0x99f0 ··· 2309 1922 #define AR5K_PHY_SDELAY 0x99f4 2310 1923 #define AR5K_PHY_SDELAY_32MHZ 0x000000ff 2311 1924 #define AR5K_PHY_SPENDING 0x99f8 1925 + #define AR5K_PHY_SPENDING_14 0x00000014 1926 + #define AR5K_PHY_SPENDING_18 0x00000018 2312 1927 #define AR5K_PHY_SPENDING_RF5111 0x00000018 2313 - #define AR5K_PHY_SPENDING_RF5112 0x00000014 /* <- i 've only seen this on 2425 dumps ! */ 2314 - #define AR5K_PHY_SPENDING_RF5112A 0x0000000e /* but since i only have 5112A-based chips */ 2315 - #define AR5K_PHY_SPENDING_RF5424 0x00000012 /* to test it might be also for old 5112. */ 1928 + #define AR5K_PHY_SPENDING_RF5112 0x00000014 1929 + /* #define AR5K_PHY_SPENDING_RF5112A 0x0000000e */ 1930 + /* #define AR5K_PHY_SPENDING_RF5424 0x00000012 */ 1931 + #define AR5K_PHY_SPENDING_RF5413 0x00000014 1932 + #define AR5K_PHY_SPENDING_RF2413 0x00000014 1933 + #define AR5K_PHY_SPENDING_RF2425 0x00000018 2316 1934 2317 1935 /* 2318 1936 * Misc PHY/radio registers [5110 - 5111] 2319 1937 */ 2320 - #define AR5K_BB_GAIN_BASE 0x9b00 /* BaseBand Amplifier Gain table base address */ 1938 + #define AR5K_BB_GAIN_BASE 0x9b00 /* BaseBand Amplifier Gain table base address */ 2321 1939 #define AR5K_BB_GAIN(_n) (AR5K_BB_GAIN_BASE + ((_n) << 2)) 2322 - #define AR5K_RF_GAIN_BASE 0x9a00 /* RF Amplrifier Gain table base address */ 1940 + #define AR5K_RF_GAIN_BASE 0x9a00 /* RF Amplrifier Gain table base address */ 2323 1941 #define AR5K_RF_GAIN(_n) (AR5K_RF_GAIN_BASE + ((_n) << 2)) 2324 1942 2325 1943 /* 2326 1944 * PHY timing IQ calibration result register [5111+] 2327 1945 */ 2328 - #define AR5K_PHY_IQRES_CAL_PWR_I 0x9c10 /* I (Inphase) power value */ 2329 - #define AR5K_PHY_IQRES_CAL_PWR_Q 0x9c14 /* Q (Quadrature) power value */ 1946 + #define AR5K_PHY_IQRES_CAL_PWR_I 0x9c10 /* I (Inphase) power value */ 1947 + #define AR5K_PHY_IQRES_CAL_PWR_Q 0x9c14 /* Q (Quadrature) power value */ 2330 1948 #define AR5K_PHY_IQRES_CAL_CORR 0x9c18 /* I/Q Correlation */ 2331 1949 2332 1950 /* 2333 1951 * PHY current RSSI register [5111+] 2334 1952 */ 2335 - #define AR5K_PHY_CURRENT_RSSI 0x9c1c 1953 + #define AR5K_PHY_CURRENT_RSSI 0x9c1c 1954 + 1955 + /* 1956 + * PHY RF Bus grant register (?) 1957 + */ 1958 + #define AR5K_PHY_RFBUS_GRANT 0x9c20 1959 + 1960 + /* 1961 + * PHY ADC test register 1962 + */ 1963 + #define AR5K_PHY_ADC_TEST 0x9c24 1964 + #define AR5K_PHY_ADC_TEST_I 0x00000001 1965 + #define AR5K_PHY_ADC_TEST_Q 0x00000200 1966 + 1967 + /* 1968 + * PHY DAC test register 1969 + */ 1970 + #define AR5K_PHY_DAC_TEST 0x9c28 1971 + #define AR5K_PHY_DAC_TEST_I 0x00000001 1972 + #define AR5K_PHY_DAC_TEST_Q 0x00000200 1973 + 1974 + /* 1975 + * PHY PTAT register (?) 1976 + */ 1977 + #define AR5K_PHY_PTAT 0x9c2c 1978 + 1979 + /* 1980 + * PHY Illegal TX rate register [5112+] 1981 + */ 1982 + #define AR5K_PHY_BAD_TX_RATE 0x9c30 1983 + 1984 + /* 1985 + * PHY SPUR Power register [5112+] 1986 + */ 1987 + #define AR5K_PHY_SPUR_PWR 0x9c34 /* Register Address */ 1988 + #define AR5K_PHY_SPUR_PWR_I 0x00000001 /* SPUR Power estimate for I (field) */ 1989 + #define AR5K_PHY_SPUR_PWR_Q 0x00000100 /* SPUR Power estimate for Q (field) */ 1990 + #define AR5K_PHY_SPUR_PWR_FILT 0x00010000 /* Power with SPUR removed (field) */ 1991 + 1992 + /* 1993 + * PHY Channel status register [5112+] (?) 1994 + */ 1995 + #define AR5K_PHY_CHAN_STATUS 0x9c38 1996 + #define AR5K_PHY_CHAN_STATUS_BT_ACT 0x00000001 1997 + #define AR5K_PHY_CHAN_STATUS_RX_CLR_RAW 0x00000002 1998 + #define AR5K_PHY_CHAN_STATUS_RX_CLR_MAC 0x00000004 1999 + #define AR5K_PHY_CHAN_STATUS_RX_CLR_PAP 0x00000008 2000 + 2001 + /* 2002 + * PHY PAPD I (power?) table (?) 2003 + * (92! entries) 2004 + */ 2005 + #define AR5K_PHY_PAPD_I_BASE 0xa000 2006 + #define AR5K_PHY_PAPD_I(_n) (AR5K_PHY_PAPD_I_BASE + ((_n) << 2)) 2336 2007 2337 2008 /* 2338 2009 * PHY PCDAC TX power table 2339 2010 */ 2340 2011 #define AR5K_PHY_PCDAC_TXPOWER_BASE_5211 0xa180 2341 - #define AR5K_PHY_PCDAC_TXPOWER_BASE_5413 0xa280 2342 - #define AR5K_PHY_PCDAC_TXPOWER_BASE (ah->ah_radio >= AR5K_RF5413 ? \ 2343 - AR5K_PHY_PCDAC_TXPOWER_BASE_5413 :\ 2012 + #define AR5K_PHY_PCDAC_TXPOWER_BASE_2413 0xa280 2013 + #define AR5K_PHY_PCDAC_TXPOWER_BASE (ah->ah_radio >= AR5K_RF2413 ? \ 2014 + AR5K_PHY_PCDAC_TXPOWER_BASE_2413 :\ 2344 2015 AR5K_PHY_PCDAC_TXPOWER_BASE_5211) 2345 2016 #define AR5K_PHY_PCDAC_TXPOWER(_n) (AR5K_PHY_PCDAC_TXPOWER_BASE + ((_n) << 2)) 2346 2017 2347 2018 /* 2348 2019 * PHY mode register [5111+] 2349 2020 */ 2350 - #define AR5K_PHY_MODE 0x0a200 /* Register address */ 2351 - #define AR5K_PHY_MODE_MOD 0x00000001 /* PHY Modulation mask*/ 2021 + #define AR5K_PHY_MODE 0x0a200 /* Register Address */ 2022 + #define AR5K_PHY_MODE_MOD 0x00000001 /* PHY Modulation bit */ 2352 2023 #define AR5K_PHY_MODE_MOD_OFDM 0 2353 2024 #define AR5K_PHY_MODE_MOD_CCK 1 2354 - #define AR5K_PHY_MODE_FREQ 0x00000002 /* Freq mode mask */ 2025 + #define AR5K_PHY_MODE_FREQ 0x00000002 /* Freq mode bit */ 2355 2026 #define AR5K_PHY_MODE_FREQ_5GHZ 0 2356 2027 #define AR5K_PHY_MODE_FREQ_2GHZ 2 2357 - #define AR5K_PHY_MODE_MOD_DYN 0x00000004 /* Dynamic OFDM/CCK mode mask [5112+] */ 2028 + #define AR5K_PHY_MODE_MOD_DYN 0x00000004 /* Enable Dynamic OFDM/CCK mode [5112+] */ 2358 2029 #define AR5K_PHY_MODE_RAD 0x00000008 /* [5212+] */ 2359 2030 #define AR5K_PHY_MODE_RAD_RF5111 0 2360 2031 #define AR5K_PHY_MODE_RAD_RF5112 8 2361 - #define AR5K_PHY_MODE_XR 0x00000010 /* [5112+] */ 2032 + #define AR5K_PHY_MODE_XR 0x00000010 /* Enable XR mode [5112+] */ 2033 + #define AR5K_PHY_MODE_HALF_RATE 0x00000020 /* Enable Half rate (test) */ 2034 + #define AR5K_PHY_MODE_QUARTER_RATE 0x00000040 /* Enable Quarter rat (test) */ 2362 2035 2363 2036 /* 2364 2037 * PHY CCK transmit control register [5111+ (?)] ··· 2426 1979 #define AR5K_PHY_CCKTXCTL 0xa204 2427 1980 #define AR5K_PHY_CCKTXCTL_WORLD 0x00000000 2428 1981 #define AR5K_PHY_CCKTXCTL_JAPAN 0x00000010 1982 + #define AR5K_PHY_CCKTXCTL_SCRAMBLER_DIS 0x00000001 1983 + #define AR5K_PHY_CCKTXCTK_DAC_SCALE 0x00000004 1984 + 1985 + /* 1986 + * PHY CCK Cross-correlator Barker RSSI threshold register [5212+] 1987 + */ 1988 + #define AR5K_PHY_CCK_CROSSCORR 0xa208 1989 + #define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR 0x0000000f 1990 + #define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR_S 0 2429 1991 2430 1992 /* 2431 1993 * PHY 2GHz gain register [5111+]
+3 -2
drivers/net/wireless/ipw2200.c
··· 305 305 #define _ipw_write8(ipw, ofs, val) writeb((val), (ipw)->hw_base + (ofs)) 306 306 307 307 /* 8-bit direct write (for low 4K of SRAM/regs), with debug wrapper */ 308 - #define ipw_write8(ipw, ofs, val) \ 308 + #define ipw_write8(ipw, ofs, val) do { \ 309 309 IPW_DEBUG_IO("%s %d: write_direct8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ 310 - _ipw_write8(ipw, ofs, val) 310 + _ipw_write8(ipw, ofs, val); \ 311 + } while (0) 311 312 312 313 /* 16-bit direct write (low 4K) */ 313 314 #define _ipw_write16(ipw, ofs, val) writew((val), (ipw)->hw_base + (ofs))
+51 -47
drivers/net/wireless/iwlwifi/Kconfig
··· 14 14 default n 15 15 16 16 config IWLWIFI_RFKILL 17 - boolean "IWLWIFI RF kill support" 17 + boolean "Iwlwifi RF kill support" 18 18 depends on IWLCORE 19 19 20 - config IWL4965 21 - tristate "Intel Wireless WiFi 4965AGN" 20 + config IWLWIFI_DEBUG 21 + bool "Enable full debugging output in iwlagn driver" 22 + depends on IWLCORE 23 + ---help--- 24 + This option will enable debug tracing output for the iwlwifi drivers 25 + 26 + This will result in the kernel module being ~100k larger. You can 27 + control which debug output is sent to the kernel log by setting the 28 + value in 29 + 30 + /sys/class/net/wlan0/device/debug_level 31 + 32 + This entry will only exist if this option is enabled. 33 + 34 + To set a value, simply echo an 8-byte hex value to the same file: 35 + 36 + % echo 0x43fff > /sys/class/net/wlan0/device/debug_level 37 + 38 + You can find the list of debug mask values in: 39 + drivers/net/wireless/iwlwifi/iwl-debug.h 40 + 41 + If this is your first time using this driver, you should say Y here 42 + as the debug information can assist others in helping you resolve 43 + any problems you may encounter. 44 + 45 + config IWLWIFI_DEBUGFS 46 + bool "Iwlwifi debugfs support" 47 + depends on IWLCORE && IWLWIFI_DEBUG && MAC80211_DEBUGFS 48 + ---help--- 49 + Enable creation of debugfs files for the iwlwifi drivers. 50 + 51 + config IWLAGN 52 + tristate "Intel Wireless WiFi Next Gen AGN" 22 53 depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL 23 54 select FW_LOADER 24 55 select IWLCORE 25 56 ---help--- 26 57 Select to build the driver supporting the: 27 58 28 - Intel Wireless WiFi Link 4965AGN 59 + Intel Wireless WiFi Link Next-Gen AGN 29 60 30 61 This driver uses the kernel's mac80211 subsystem. 31 62 ··· 73 42 If you want to compile the driver as a module ( = code which can be 74 43 inserted in and removed from the running kernel whenever you want), 75 44 say M here and read <file:Documentation/kbuild/modules.txt>. The 76 - module will be called iwl4965.ko. 45 + module will be called iwlagn.ko. 77 46 78 - config IWL4965_LEDS 79 - bool "Enable LEDS features in iwl4965 driver" 80 - depends on IWL4965 47 + config IWLAGN_SPECTRUM_MEASUREMENT 48 + bool "Enable Spectrum Measurement in iwlagn driver" 49 + depends on IWLAGN 50 + ---help--- 51 + This option will enable spectrum measurement for the iwlagn driver. 52 + 53 + config IWLAGN_LEDS 54 + bool "Enable LEDS features in iwlagn driver" 55 + depends on IWLAGN 81 56 select IWLWIFI_LEDS 82 57 ---help--- 83 - This option enables LEDS for the iwlwifi drivers 58 + This option enables LEDS for the iwlagn drivers 84 59 85 60 86 - config IWL4965_SPECTRUM_MEASUREMENT 87 - bool "Enable Spectrum Measurement in iwl4965 driver" 88 - depends on IWL4965 61 + config IWL4965 62 + bool "Intel Wireless WiFi 4965AGN" 63 + depends on IWLAGN 89 64 ---help--- 90 - This option will enable spectrum measurement for the iwl4965 driver. 91 - 92 - config IWLWIFI_DEBUG 93 - bool "Enable full debugging output in iwl4965 driver" 94 - depends on IWL4965 95 - ---help--- 96 - This option will enable debug tracing output for the iwl4965 97 - driver. 98 - 99 - This will result in the kernel module being ~100k larger. You can 100 - control which debug output is sent to the kernel log by setting the 101 - value in 102 - 103 - /sys/class/net/wlan0/device/debug_level 104 - 105 - This entry will only exist if this option is enabled. 106 - 107 - To set a value, simply echo an 8-byte hex value to the same file: 108 - 109 - % echo 0x43fff > /sys/class/net/wlan0/device/debug_level 110 - 111 - You can find the list of debug mask values in: 112 - drivers/net/wireless/iwlwifi/iwl-4965-debug.h 113 - 114 - If this is your first time using this driver, you should say Y here 115 - as the debug information can assist others in helping you resolve 116 - any problems you may encounter. 65 + This option enables support for Intel Wireless WiFi Link 4965AGN 117 66 118 67 config IWL5000 119 68 bool "Intel Wireless WiFi 5000AGN" 120 - depends on IWL4965 69 + depends on IWLAGN 121 70 ---help--- 122 71 This option enables support for Intel Wireless WiFi Link 5000AGN Family 123 - Dependency on 4965 is temporary 124 - 125 - config IWLWIFI_DEBUGFS 126 - bool "Iwlwifi debugfs support" 127 - depends on IWLCORE && IWLWIFI_DEBUG && MAC80211_DEBUGFS 128 - ---help--- 129 - Enable creation of debugfs files for the iwlwifi drivers. 130 72 131 73 config IWL3945 132 74 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection"
+6 -7
drivers/net/wireless/iwlwifi/Makefile
··· 6 6 iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o 7 7 iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o 8 8 9 + obj-$(CONFIG_IWLAGN) += iwlagn.o 10 + iwlagn-objs := iwl-agn.o iwl-agn-rs.o 11 + 12 + iwlagn-$(CONFIG_IWL4965) += iwl-4965.o 13 + iwlagn-$(CONFIG_IWL5000) += iwl-5000.o 14 + 9 15 obj-$(CONFIG_IWL3945) += iwl3945.o 10 16 iwl3945-objs := iwl3945-base.o iwl-3945.o iwl-3945-rs.o 11 17 iwl3945-$(CONFIG_IWL3945_LEDS) += iwl-3945-led.o 12 - 13 - obj-$(CONFIG_IWL4965) += iwl4965.o 14 - iwl4965-objs := iwl4965-base.o iwl-4965.o iwl-4965-rs.o 15 - 16 - ifeq ($(CONFIG_IWL5000),y) 17 - iwl4965-objs += iwl-5000.o 18 - endif 19 18 20 19
+17 -16
drivers/net/wireless/iwlwifi/iwl-3945-led.c
··· 206 206 static int iwl3945_led_register_led(struct iwl3945_priv *priv, 207 207 struct iwl3945_led *led, 208 208 enum led_type type, u8 set_led, 209 - const char *name, char *trigger) 209 + char *trigger) 210 210 { 211 211 struct device *device = wiphy_dev(priv->hw->wiphy); 212 212 int ret; 213 213 214 - led->led_dev.name = name; 214 + led->led_dev.name = led->name; 215 215 led->led_dev.brightness_set = iwl3945_led_brightness_set; 216 216 led->led_dev.default_trigger = trigger; 217 217 ··· 308 308 int iwl3945_led_register(struct iwl3945_priv *priv) 309 309 { 310 310 char *trigger; 311 - char name[32]; 312 311 int ret; 313 312 314 313 priv->last_blink_rate = 0; ··· 317 318 priv->allow_blinking = 0; 318 319 319 320 trigger = ieee80211_get_radio_led_name(priv->hw); 320 - snprintf(name, sizeof(name), "iwl-%s:radio", 321 + snprintf(priv->led[IWL_LED_TRG_RADIO].name, 322 + sizeof(priv->led[IWL_LED_TRG_RADIO].name), "iwl-%s:radio", 321 323 wiphy_name(priv->hw->wiphy)); 322 324 323 325 priv->led[IWL_LED_TRG_RADIO].led_on = iwl3945_led_on; ··· 327 327 328 328 ret = iwl3945_led_register_led(priv, 329 329 &priv->led[IWL_LED_TRG_RADIO], 330 - IWL_LED_TRG_RADIO, 1, 331 - name, trigger); 330 + IWL_LED_TRG_RADIO, 1, trigger); 331 + 332 332 if (ret) 333 333 goto exit_fail; 334 334 335 335 trigger = ieee80211_get_assoc_led_name(priv->hw); 336 - snprintf(name, sizeof(name), "iwl-%s:assoc", 336 + snprintf(priv->led[IWL_LED_TRG_ASSOC].name, 337 + sizeof(priv->led[IWL_LED_TRG_ASSOC].name), "iwl-%s:assoc", 337 338 wiphy_name(priv->hw->wiphy)); 338 339 339 340 ret = iwl3945_led_register_led(priv, 340 341 &priv->led[IWL_LED_TRG_ASSOC], 341 - IWL_LED_TRG_ASSOC, 0, 342 - name, trigger); 342 + IWL_LED_TRG_ASSOC, 0, trigger); 343 + 343 344 /* for assoc always turn led on */ 344 345 priv->led[IWL_LED_TRG_ASSOC].led_on = iwl3945_led_on; 345 346 priv->led[IWL_LED_TRG_ASSOC].led_off = iwl3945_led_on; ··· 350 349 goto exit_fail; 351 350 352 351 trigger = ieee80211_get_rx_led_name(priv->hw); 353 - snprintf(name, sizeof(name), "iwl-%s:RX", 352 + snprintf(priv->led[IWL_LED_TRG_RX].name, 353 + sizeof(priv->led[IWL_LED_TRG_RX].name), "iwl-%s:RX", 354 354 wiphy_name(priv->hw->wiphy)); 355 - 356 355 357 356 ret = iwl3945_led_register_led(priv, 358 357 &priv->led[IWL_LED_TRG_RX], 359 - IWL_LED_TRG_RX, 0, 360 - name, trigger); 358 + IWL_LED_TRG_RX, 0, trigger); 361 359 362 360 priv->led[IWL_LED_TRG_RX].led_on = iwl3945_led_associated; 363 361 priv->led[IWL_LED_TRG_RX].led_off = iwl3945_led_associated; ··· 366 366 goto exit_fail; 367 367 368 368 trigger = ieee80211_get_tx_led_name(priv->hw); 369 - snprintf(name, sizeof(name), "iwl-%s:TX", 369 + snprintf(priv->led[IWL_LED_TRG_TX].name, 370 + sizeof(priv->led[IWL_LED_TRG_TX].name), "iwl-%s:TX", 370 371 wiphy_name(priv->hw->wiphy)); 371 372 372 373 ret = iwl3945_led_register_led(priv, 373 374 &priv->led[IWL_LED_TRG_TX], 374 - IWL_LED_TRG_TX, 0, 375 - name, trigger); 375 + IWL_LED_TRG_TX, 0, trigger); 376 + 376 377 priv->led[IWL_LED_TRG_TX].led_on = iwl3945_led_associated; 377 378 priv->led[IWL_LED_TRG_TX].led_off = iwl3945_led_associated; 378 379 priv->led[IWL_LED_TRG_TX].led_pattern = iwl3945_led_pattern;
+1
drivers/net/wireless/iwlwifi/iwl-3945-led.h
··· 50 50 struct iwl3945_led { 51 51 struct iwl3945_priv *priv; 52 52 struct led_classdev led_dev; 53 + char name[32]; 53 54 54 55 int (*led_on) (struct iwl3945_priv *priv, int led_id); 55 56 int (*led_off) (struct iwl3945_priv *priv, int led_id);
+9 -8
drivers/net/wireless/iwlwifi/iwl-3945.c
··· 710 710 return; 711 711 } 712 712 713 - if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { 714 - iwl3945_pass_packet_to_mac80211(priv, rxb, &rx_status); 715 - return; 716 - } 713 + 717 714 718 715 /* Convert 3945's rssi indicator to dBm */ 719 716 rx_status.signal = rx_stats->rssi - IWL_RSSI_OFFSET; ··· 772 775 priv->last_rx_noise = rx_status.noise; 773 776 } 774 777 778 + if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { 779 + iwl3945_pass_packet_to_mac80211(priv, rxb, &rx_status); 780 + return; 781 + } 782 + 775 783 switch (le16_to_cpu(header->frame_control) & IEEE80211_FCTL_FTYPE) { 776 784 case IEEE80211_FTYPE_MGMT: 777 785 switch (le16_to_cpu(header->frame_control) & ··· 795 793 struct ieee80211_mgmt *mgmt = 796 794 (struct ieee80211_mgmt *)header; 797 795 __le32 *pos; 798 - pos = 799 - (__le32 *) & mgmt->u.beacon. 796 + pos = (__le32 *)&mgmt->u.beacon. 800 797 timestamp; 801 798 priv->timestamp0 = le32_to_cpu(pos[0]); 802 799 priv->timestamp1 = le32_to_cpu(pos[1]); ··· 1508 1507 */ 1509 1508 static inline int iwl3945_hw_reg_temp_out_of_range(int temperature) 1510 1509 { 1511 - return (((temperature < -260) || (temperature > 25)) ? 1 : 0); 1510 + return ((temperature < -260) || (temperature > 25)) ? 1 : 0; 1512 1511 } 1513 1512 1514 1513 int iwl3945_hw_get_temperature(struct iwl3945_priv *priv) ··· 2629 2628 tx_beacon_cmd->tx.supp_rates[1] = 2630 2629 (IWL_CCK_BASIC_RATES_MASK & 0xF); 2631 2630 2632 - return (sizeof(struct iwl3945_tx_beacon_cmd) + frame_size); 2631 + return sizeof(struct iwl3945_tx_beacon_cmd) + frame_size; 2633 2632 } 2634 2633 2635 2634 void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv)
+114 -213
drivers/net/wireless/iwlwifi/iwl-4965-rs.c drivers/net/wireless/iwlwifi/iwl-agn-rs.c
··· 42 42 #include "iwl-core.h" 43 43 #include "iwl-helpers.h" 44 44 45 - #define RS_NAME "iwl-4965-rs" 45 + #define RS_NAME "iwl-agn-rs" 46 46 47 47 #define NUM_TRY_BEFORE_ANT_TOGGLE 1 48 48 #define IWL_NUMBER_TRY 1 ··· 77 77 }; 78 78 79 79 /** 80 - * struct iwl4965_rate_scale_data -- tx success history for one rate 80 + * struct iwl_rate_scale_data -- tx success history for one rate 81 81 */ 82 - struct iwl4965_rate_scale_data { 82 + struct iwl_rate_scale_data { 83 83 u64 data; /* bitmap of successful frames */ 84 84 s32 success_counter; /* number of frames successful */ 85 85 s32 success_ratio; /* per-cent * 128 */ ··· 89 89 }; 90 90 91 91 /** 92 - * struct iwl4965_scale_tbl_info -- tx params and success history for all rates 92 + * struct iwl_scale_tbl_info -- tx params and success history for all rates 93 93 * 94 - * There are two of these in struct iwl4965_lq_sta, 94 + * There are two of these in struct iwl_lq_sta, 95 95 * one for "active", and one for "search". 96 96 */ 97 - struct iwl4965_scale_tbl_info { 97 + struct iwl_scale_tbl_info { 98 98 enum iwl_table_type lq_type; 99 99 u8 ant_type; 100 100 u8 is_SGI; /* 1 = short guard interval */ ··· 103 103 u8 action; /* change modulation; IWL_[LEGACY/SISO/MIMO]_SWITCH_* */ 104 104 s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */ 105 105 u32 current_rate; /* rate_n_flags, uCode API format */ 106 - struct iwl4965_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */ 106 + struct iwl_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */ 107 107 }; 108 108 109 - struct iwl4965_traffic_load { 109 + struct iwl_traffic_load { 110 110 unsigned long time_stamp; /* age of the oldest statistics */ 111 111 u32 packet_count[TID_QUEUE_MAX_SIZE]; /* packet count in this time 112 112 * slice */ ··· 118 118 }; 119 119 120 120 /** 121 - * struct iwl4965_lq_sta -- driver's rate scaling private structure 121 + * struct iwl_lq_sta -- driver's rate scaling private structure 122 122 * 123 123 * Pointer to this gets passed back and forth between driver and mac80211. 124 124 */ 125 - struct iwl4965_lq_sta { 125 + struct iwl_lq_sta { 126 126 u8 active_tbl; /* index of active table, range 0-1 */ 127 127 u8 enable_counter; /* indicates HT mode */ 128 128 u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */ ··· 153 153 u16 active_rate_basic; 154 154 155 155 struct iwl_link_quality_cmd lq; 156 - struct iwl4965_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ 157 - struct iwl4965_traffic_load load[TID_MAX_LOAD_COUNT]; 156 + struct iwl_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ 157 + struct iwl_traffic_load load[TID_MAX_LOAD_COUNT]; 158 158 u8 tx_agg_tid_en; 159 159 #ifdef CONFIG_MAC80211_DEBUGFS 160 160 struct dentry *rs_sta_dbgfs_scale_table_file; ··· 170 170 struct ieee80211_hdr *hdr, 171 171 struct sta_info *sta); 172 172 static void rs_fill_link_cmd(const struct iwl_priv *priv, 173 - struct iwl4965_lq_sta *lq_sta, 174 - u32 rate_n_flags); 173 + struct iwl_lq_sta *lq_sta, u32 rate_n_flags); 175 174 176 175 177 176 #ifdef CONFIG_MAC80211_DEBUGFS 178 - static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta, 179 - u32 *rate_n_flags, int index); 177 + static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, 178 + u32 *rate_n_flags, int index); 180 179 #else 181 - static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta, 182 - u32 *rate_n_flags, int index) 180 + static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, 181 + u32 *rate_n_flags, int index) 183 182 {} 184 183 #endif 185 184 ··· 233 234 return (u8)(rate_n_flags & 0xFF); 234 235 } 235 236 236 - static void rs_rate_scale_clear_window(struct iwl4965_rate_scale_data *window) 237 + static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window) 237 238 { 238 239 window->data = 0; 239 240 window->success_counter = 0; ··· 245 246 246 247 static inline u8 rs_is_valid_ant(u8 valid_antenna, u8 ant_type) 247 248 { 248 - return ((ant_type & valid_antenna) == ant_type); 249 + return (ant_type & valid_antenna) == ant_type; 249 250 } 250 251 251 252 /* 252 253 * removes the old data from the statistics. All data that is older than 253 254 * TID_MAX_TIME_DIFF, will be deleted. 254 255 */ 255 - static void rs_tl_rm_old_stats(struct iwl4965_traffic_load *tl, u32 curr_time) 256 + static void rs_tl_rm_old_stats(struct iwl_traffic_load *tl, u32 curr_time) 256 257 { 257 258 /* The oldest age we want to keep */ 258 259 u32 oldest_time = curr_time - TID_MAX_TIME_DIFF; ··· 273 274 * increment traffic load value for tid and also remove 274 275 * any old values if passed the certain time period 275 276 */ 276 - static u8 rs_tl_add_packet(struct iwl4965_lq_sta *lq_data, 277 + static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data, 277 278 struct ieee80211_hdr *hdr) 278 279 { 279 280 u32 curr_time = jiffies_to_msecs(jiffies); 280 281 u32 time_diff; 281 282 s32 index; 282 - struct iwl4965_traffic_load *tl = NULL; 283 + struct iwl_traffic_load *tl = NULL; 283 284 __le16 fc = hdr->frame_control; 284 285 u8 tid; 285 286 ··· 324 325 /* 325 326 get the traffic load value for tid 326 327 */ 327 - static u32 rs_tl_get_load(struct iwl4965_lq_sta *lq_data, u8 tid) 328 + static u32 rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid) 328 329 { 329 330 u32 curr_time = jiffies_to_msecs(jiffies); 330 331 u32 time_diff; 331 332 s32 index; 332 - struct iwl4965_traffic_load *tl = NULL; 333 + struct iwl_traffic_load *tl = NULL; 333 334 334 335 if (tid >= TID_MAX_LOAD_COUNT) 335 336 return 0; ··· 353 354 } 354 355 355 356 static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, 356 - struct iwl4965_lq_sta *lq_data, u8 tid, 357 - struct sta_info *sta) 357 + struct iwl_lq_sta *lq_data, u8 tid, 358 + struct sta_info *sta) 358 359 { 359 360 unsigned long state; 360 361 DECLARE_MAC_BUF(mac); ··· 372 373 } 373 374 374 375 static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, 375 - struct iwl4965_lq_sta *lq_data, 376 - struct sta_info *sta) 376 + struct iwl_lq_sta *lq_data, 377 + struct sta_info *sta) 377 378 { 378 379 if ((tid < TID_MAX_LOAD_COUNT)) 379 380 rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); ··· 384 385 385 386 static inline int get_num_of_ant_from_rate(u32 rate_n_flags) 386 387 { 387 - return (!!(rate_n_flags & RATE_MCS_ANT_A_MSK) + 388 - !!(rate_n_flags & RATE_MCS_ANT_B_MSK) + 389 - !!(rate_n_flags & RATE_MCS_ANT_C_MSK)); 388 + return !!(rate_n_flags & RATE_MCS_ANT_A_MSK) + 389 + !!(rate_n_flags & RATE_MCS_ANT_B_MSK) + 390 + !!(rate_n_flags & RATE_MCS_ANT_C_MSK); 390 391 } 391 392 392 393 /** ··· 396 397 * at this rate. window->data contains the bitmask of successful 397 398 * packets. 398 399 */ 399 - static int rs_collect_tx_data(struct iwl4965_rate_scale_data *windows, 400 + static int rs_collect_tx_data(struct iwl_rate_scale_data *windows, 400 401 int scale_index, s32 tpt, int retries, 401 402 int successes) 402 403 { 403 - struct iwl4965_rate_scale_data *window = NULL; 404 + struct iwl_rate_scale_data *window = NULL; 404 405 static const u64 mask = (((u64)1) << (IWL_RATE_MAX_WINDOW - 1)); 405 406 s32 fail_count; 406 407 ··· 472 473 * Fill uCode API rate_n_flags field, based on "search" or "active" table. 473 474 */ 474 475 /* FIXME:RS:remove this function and put the flags statically in the table */ 475 - static u32 rate_n_flags_from_tbl(struct iwl4965_scale_tbl_info *tbl, 476 + static u32 rate_n_flags_from_tbl(struct iwl_scale_tbl_info *tbl, 476 477 int index, u8 use_green) 477 478 { 478 479 u32 rate_n_flags = 0; ··· 529 530 */ 530 531 static int rs_get_tbl_info_from_mcs(const u32 rate_n_flags, 531 532 enum ieee80211_band band, 532 - struct iwl4965_scale_tbl_info *tbl, 533 + struct iwl_scale_tbl_info *tbl, 533 534 int *rate_idx) 534 535 { 535 536 u32 ant_msk = (rate_n_flags & RATE_MCS_ANT_ABC_MSK); ··· 590 591 /* switch to another antenna/antennas and return 1 */ 591 592 /* if no other valid antenna found, return 0 */ 592 593 static int rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags, 593 - struct iwl4965_scale_tbl_info *tbl) 594 + struct iwl_scale_tbl_info *tbl) 594 595 { 595 596 u8 new_ant_type; 596 597 ··· 620 621 #if 0 621 622 static inline u8 rs_use_green(struct iwl_priv *priv, struct ieee80211_conf *conf) 622 623 { 623 - return ((conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) && 624 + return (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) && 624 625 priv->current_ht_config.is_green_field && 625 - !priv->current_ht_config.non_GF_STA_present); 626 + !priv->current_ht_config.non_GF_STA_present; 626 627 } 627 628 #endif 628 629 static inline u8 rs_use_green(struct iwl_priv *priv, struct ieee80211_conf *conf) ··· 637 638 * basic available rates. 638 639 * 639 640 */ 640 - static u16 rs_get_supported_rates(struct iwl4965_lq_sta *lq_sta, 641 - struct ieee80211_hdr *hdr, 642 - enum iwl_table_type rate_type) 641 + static u16 rs_get_supported_rates(struct iwl_lq_sta *lq_sta, 642 + struct ieee80211_hdr *hdr, 643 + enum iwl_table_type rate_type) 643 644 { 644 645 if (hdr && is_multicast_ether_addr(hdr->addr1) && 645 646 lq_sta->active_rate_basic) ··· 713 714 return (high << 8) | low; 714 715 } 715 716 716 - static u32 rs_get_lower_rate(struct iwl4965_lq_sta *lq_sta, 717 - struct iwl4965_scale_tbl_info *tbl, u8 scale_index, 718 - u8 ht_possible) 717 + static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta, 718 + struct iwl_scale_tbl_info *tbl, 719 + u8 scale_index, u8 ht_possible) 719 720 { 720 721 s32 low; 721 722 u16 rate_mask; ··· 779 780 int status; 780 781 u8 retries; 781 782 int rs_index, index = 0; 782 - struct iwl4965_lq_sta *lq_sta; 783 + struct iwl_lq_sta *lq_sta; 783 784 struct iwl_link_quality_cmd *table; 784 785 struct sta_info *sta; 785 786 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; ··· 787 788 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 788 789 struct ieee80211_hw *hw = local_to_hw(local); 789 790 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 790 - struct iwl4965_rate_scale_data *window = NULL; 791 - struct iwl4965_rate_scale_data *search_win = NULL; 791 + struct iwl_rate_scale_data *window = NULL; 792 + struct iwl_rate_scale_data *search_win = NULL; 792 793 u32 tx_rate; 793 - struct iwl4965_scale_tbl_info tbl_type; 794 - struct iwl4965_scale_tbl_info *curr_tbl, *search_tbl; 794 + struct iwl_scale_tbl_info tbl_type; 795 + struct iwl_scale_tbl_info *curr_tbl, *search_tbl; 795 796 u8 active_index = 0; 796 797 __le16 fc = hdr->frame_control; 797 798 s32 tpt = 0; ··· 819 820 goto out; 820 821 821 822 822 - lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; 823 + lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 823 824 824 825 if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && 825 826 !lq_sta->ibss_sta_added) ··· 830 831 831 832 curr_tbl = &(lq_sta->lq_info[active_index]); 832 833 search_tbl = &(lq_sta->lq_info[(1 - active_index)]); 833 - window = (struct iwl4965_rate_scale_data *) 834 - &(curr_tbl->win[0]); 835 - search_win = (struct iwl4965_rate_scale_data *) 836 - &(search_tbl->win[0]); 834 + window = (struct iwl_rate_scale_data *)&(curr_tbl->win[0]); 835 + search_win = (struct iwl_rate_scale_data *)&(search_tbl->win[0]); 837 836 838 837 /* 839 838 * Ignore this Tx frame response if its initial rate doesn't match ··· 980 983 * searching for a new mode. 981 984 */ 982 985 static void rs_set_stay_in_table(struct iwl_priv *priv, u8 is_legacy, 983 - struct iwl4965_lq_sta *lq_sta) 986 + struct iwl_lq_sta *lq_sta) 984 987 { 985 988 IWL_DEBUG_RATE("we are staying in the same table\n"); 986 989 lq_sta->stay_in_tbl = 1; /* only place this gets set */ ··· 1001 1004 /* 1002 1005 * Find correct throughput table for given mode of modulation 1003 1006 */ 1004 - static void rs_set_expected_tpt_table(struct iwl4965_lq_sta *lq_sta, 1005 - struct iwl4965_scale_tbl_info *tbl) 1007 + static void rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta, 1008 + struct iwl_scale_tbl_info *tbl) 1006 1009 { 1007 1010 if (is_legacy(tbl->lq_type)) { 1008 1011 if (!is_a_band(tbl->lq_type)) ··· 1047 1050 * bit rate will typically need to increase, but not if performance was bad. 1048 1051 */ 1049 1052 static s32 rs_get_best_rate(struct iwl_priv *priv, 1050 - struct iwl4965_lq_sta *lq_sta, 1051 - struct iwl4965_scale_tbl_info *tbl, /* "search" */ 1053 + struct iwl_lq_sta *lq_sta, 1054 + struct iwl_scale_tbl_info *tbl, /* "search" */ 1052 1055 u16 rate_mask, s8 index) 1053 1056 { 1054 1057 /* "active" values */ 1055 - struct iwl4965_scale_tbl_info *active_tbl = 1058 + struct iwl_scale_tbl_info *active_tbl = 1056 1059 &(lq_sta->lq_info[lq_sta->active_tbl]); 1057 1060 s32 active_sr = active_tbl->win[index].success_ratio; 1058 1061 s32 active_tpt = active_tbl->expected_tpt[index]; ··· 1140 1143 * Set up search table for MIMO 1141 1144 */ 1142 1145 static int rs_switch_to_mimo2(struct iwl_priv *priv, 1143 - struct iwl4965_lq_sta *lq_sta, 1146 + struct iwl_lq_sta *lq_sta, 1144 1147 struct ieee80211_conf *conf, 1145 1148 struct sta_info *sta, 1146 - struct iwl4965_scale_tbl_info *tbl, int index) 1149 + struct iwl_scale_tbl_info *tbl, int index) 1147 1150 { 1148 1151 u16 rate_mask; 1149 1152 s32 rate; ··· 1207 1210 * Set up search table for SISO 1208 1211 */ 1209 1212 static int rs_switch_to_siso(struct iwl_priv *priv, 1210 - struct iwl4965_lq_sta *lq_sta, 1213 + struct iwl_lq_sta *lq_sta, 1211 1214 struct ieee80211_conf *conf, 1212 1215 struct sta_info *sta, 1213 - struct iwl4965_scale_tbl_info *tbl, int index) 1216 + struct iwl_scale_tbl_info *tbl, int index) 1214 1217 { 1215 1218 u16 rate_mask; 1216 1219 u8 is_green = lq_sta->is_green; ··· 1267 1270 * Try to switch to new modulation mode from legacy 1268 1271 */ 1269 1272 static int rs_move_legacy_other(struct iwl_priv *priv, 1270 - struct iwl4965_lq_sta *lq_sta, 1273 + struct iwl_lq_sta *lq_sta, 1271 1274 struct ieee80211_conf *conf, 1272 1275 struct sta_info *sta, 1273 1276 int index) 1274 1277 { 1275 - struct iwl4965_scale_tbl_info *tbl = 1276 - &(lq_sta->lq_info[lq_sta->active_tbl]); 1277 - struct iwl4965_scale_tbl_info *search_tbl = 1278 - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1279 - struct iwl4965_rate_scale_data *window = &(tbl->win[index]); 1280 - u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - 1281 - (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); 1278 + struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1279 + struct iwl_scale_tbl_info *search_tbl = 1280 + &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1281 + struct iwl_rate_scale_data *window = &(tbl->win[index]); 1282 + u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1283 + (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1282 1284 u8 start_action = tbl->action; 1283 1285 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1284 1286 int ret = 0; ··· 1356 1360 * Try to switch to new modulation mode from SISO 1357 1361 */ 1358 1362 static int rs_move_siso_to_other(struct iwl_priv *priv, 1359 - struct iwl4965_lq_sta *lq_sta, 1363 + struct iwl_lq_sta *lq_sta, 1360 1364 struct ieee80211_conf *conf, 1361 - struct sta_info *sta, 1362 - int index) 1365 + struct sta_info *sta, int index) 1363 1366 { 1364 1367 u8 is_green = lq_sta->is_green; 1365 - struct iwl4965_scale_tbl_info *tbl = 1366 - &(lq_sta->lq_info[lq_sta->active_tbl]); 1367 - struct iwl4965_scale_tbl_info *search_tbl = 1368 - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1369 - struct iwl4965_rate_scale_data *window = &(tbl->win[index]); 1370 - u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - 1371 - (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); 1368 + struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1369 + struct iwl_scale_tbl_info *search_tbl = 1370 + &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1371 + struct iwl_rate_scale_data *window = &(tbl->win[index]); 1372 + u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1373 + (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1372 1374 u8 start_action = tbl->action; 1373 1375 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1374 1376 int ret; ··· 1449 1455 * Try to switch to new modulation mode from MIMO 1450 1456 */ 1451 1457 static int rs_move_mimo_to_other(struct iwl_priv *priv, 1452 - struct iwl4965_lq_sta *lq_sta, 1458 + struct iwl_lq_sta *lq_sta, 1453 1459 struct ieee80211_conf *conf, 1454 - struct sta_info *sta, 1455 - int index) 1460 + struct sta_info *sta, int index) 1456 1461 { 1457 1462 s8 is_green = lq_sta->is_green; 1458 - struct iwl4965_scale_tbl_info *tbl = 1459 - &(lq_sta->lq_info[lq_sta->active_tbl]); 1460 - struct iwl4965_scale_tbl_info *search_tbl = 1461 - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1462 - u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - 1463 - (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); 1463 + struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1464 + struct iwl_scale_tbl_info *search_tbl = 1465 + &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1466 + u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1467 + (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1464 1468 u8 start_action = tbl->action; 1465 1469 /*u8 valid_tx_ant = priv->hw_params.valid_tx_ant;*/ 1466 1470 int ret; ··· 1544 1552 * 2) # times calling this function 1545 1553 * 3) elapsed time in this mode (not used, for now) 1546 1554 */ 1547 - static void rs_stay_in_table(struct iwl4965_lq_sta *lq_sta) 1555 + static void rs_stay_in_table(struct iwl_lq_sta *lq_sta) 1548 1556 { 1549 - struct iwl4965_scale_tbl_info *tbl; 1557 + struct iwl_scale_tbl_info *tbl; 1550 1558 int i; 1551 1559 int active_tbl; 1552 1560 int flush_interval_passed = 0; ··· 1634 1642 int high = IWL_RATE_INVALID; 1635 1643 int index; 1636 1644 int i; 1637 - struct iwl4965_rate_scale_data *window = NULL; 1645 + struct iwl_rate_scale_data *window = NULL; 1638 1646 int current_tpt = IWL_INVALID_VALUE; 1639 1647 int low_tpt = IWL_INVALID_VALUE; 1640 1648 int high_tpt = IWL_INVALID_VALUE; ··· 1643 1651 __le16 fc; 1644 1652 u16 rate_mask; 1645 1653 u8 update_lq = 0; 1646 - struct iwl4965_lq_sta *lq_sta; 1647 - struct iwl4965_scale_tbl_info *tbl, *tbl1; 1654 + struct iwl_lq_sta *lq_sta; 1655 + struct iwl_scale_tbl_info *tbl, *tbl1; 1648 1656 u16 rate_scale_index_msk = 0; 1649 1657 u32 rate; 1650 1658 u8 is_green = 0; ··· 1667 1675 if (!sta || !sta->rate_ctrl_priv) 1668 1676 return; 1669 1677 1670 - lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; 1678 + lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 1671 1679 1672 1680 tid = rs_tl_add_packet(lq_sta, hdr); 1673 1681 ··· 2022 2030 struct ieee80211_conf *conf, 2023 2031 struct sta_info *sta) 2024 2032 { 2025 - struct iwl4965_lq_sta *lq_sta; 2026 - struct iwl4965_scale_tbl_info *tbl; 2033 + struct iwl_lq_sta *lq_sta; 2034 + struct iwl_scale_tbl_info *tbl; 2027 2035 int rate_idx; 2028 2036 int i; 2029 2037 u32 rate; ··· 2034 2042 if (!sta || !sta->rate_ctrl_priv) 2035 2043 goto out; 2036 2044 2037 - lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; 2045 + lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 2038 2046 i = sta->last_txrate_idx; 2039 2047 2040 2048 if ((lq_sta->lq.sta_id == 0xff) && ··· 2088 2096 struct sta_info *sta; 2089 2097 __le16 fc; 2090 2098 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 2091 - struct iwl4965_lq_sta *lq_sta; 2099 + struct iwl_lq_sta *lq_sta; 2092 2100 2093 2101 IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); 2094 2102 ··· 2105 2113 goto out; 2106 2114 } 2107 2115 2108 - lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; 2116 + lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 2109 2117 i = sta->last_txrate_idx; 2110 2118 2111 2119 if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && ··· 2141 2149 2142 2150 static void *rs_alloc_sta(void *priv_rate, gfp_t gfp) 2143 2151 { 2144 - struct iwl4965_lq_sta *lq_sta; 2152 + struct iwl_lq_sta *lq_sta; 2145 2153 struct iwl_priv *priv; 2146 2154 int i, j; 2147 2155 2148 2156 priv = (struct iwl_priv *)priv_rate; 2149 2157 IWL_DEBUG_RATE("create station rate scale window\n"); 2150 2158 2151 - lq_sta = kzalloc(sizeof(struct iwl4965_lq_sta), gfp); 2159 + lq_sta = kzalloc(sizeof(struct iwl_lq_sta), gfp); 2152 2160 2153 2161 if (lq_sta == NULL) 2154 2162 return NULL; ··· 2157 2165 2158 2166 for (j = 0; j < LQ_SIZE; j++) 2159 2167 for (i = 0; i < IWL_RATE_COUNT; i++) 2160 - rs_rate_scale_clear_window(&(lq_sta->lq_info[j].win[i])); 2168 + rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); 2161 2169 2162 2170 return lq_sta; 2163 2171 } ··· 2170 2178 struct ieee80211_conf *conf = &local->hw.conf; 2171 2179 struct ieee80211_supported_band *sband; 2172 2180 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 2173 - struct iwl4965_lq_sta *lq_sta = priv_sta; 2181 + struct iwl_lq_sta *lq_sta = priv_sta; 2174 2182 2175 2183 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 2176 2184 ··· 2179 2187 sta->txrate_idx = 3; 2180 2188 for (j = 0; j < LQ_SIZE; j++) 2181 2189 for (i = 0; i < IWL_RATE_COUNT; i++) 2182 - rs_rate_scale_clear_window(&(lq_sta->lq_info[j].win[i])); 2190 + rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); 2183 2191 2184 2192 IWL_DEBUG_RATE("LQ: *** rate scale global init ***\n"); 2185 2193 /* TODO: what is a good starting rate for STA? About middle? Maybe not ··· 2263 2271 } 2264 2272 2265 2273 static void rs_fill_link_cmd(const struct iwl_priv *priv, 2266 - struct iwl4965_lq_sta *lq_sta, 2267 - u32 new_rate) 2274 + struct iwl_lq_sta *lq_sta, u32 new_rate) 2268 2275 { 2269 - struct iwl4965_scale_tbl_info tbl_type; 2276 + struct iwl_scale_tbl_info tbl_type; 2270 2277 int index = 0; 2271 2278 int rate_idx; 2272 2279 int repeat_rate = 0; ··· 2393 2402 2394 2403 static void rs_clear(void *priv_rate) 2395 2404 { 2405 + #ifdef CONFIG_IWLWIFI_DEBUG 2396 2406 struct iwl_priv *priv = (struct iwl_priv *) priv_rate; 2397 2407 2398 2408 IWL_DEBUG_RATE("enter\n"); ··· 2401 2409 /* TODO - add rate scale state reset */ 2402 2410 2403 2411 IWL_DEBUG_RATE("leave\n"); 2412 + #endif /* CONFIG_IWLWIFI_DEBUG */ 2404 2413 } 2405 2414 2406 2415 static void rs_free_sta(void *priv_rate, void *priv_sta) 2407 2416 { 2408 - struct iwl4965_lq_sta *lq_sta = priv_sta; 2417 + struct iwl_lq_sta *lq_sta = priv_sta; 2409 2418 struct iwl_priv *priv; 2410 2419 2411 2420 priv = (struct iwl_priv *)priv_rate; ··· 2422 2429 file->private_data = inode->i_private; 2423 2430 return 0; 2424 2431 } 2425 - static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta, 2426 - u32 *rate_n_flags, int index) 2432 + static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, 2433 + u32 *rate_n_flags, int index) 2427 2434 { 2428 2435 struct iwl_priv *priv; 2429 2436 ··· 2446 2453 static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, 2447 2454 const char __user *user_buf, size_t count, loff_t *ppos) 2448 2455 { 2449 - struct iwl4965_lq_sta *lq_sta = file->private_data; 2456 + struct iwl_lq_sta *lq_sta = file->private_data; 2450 2457 struct iwl_priv *priv; 2451 2458 char buf[64]; 2452 2459 int buf_size; ··· 2486 2493 int desc = 0; 2487 2494 int i = 0; 2488 2495 2489 - struct iwl4965_lq_sta *lq_sta = file->private_data; 2496 + struct iwl_lq_sta *lq_sta = file->private_data; 2490 2497 2491 2498 desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id); 2492 2499 desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n", ··· 2534 2541 int desc = 0; 2535 2542 int i, j; 2536 2543 2537 - struct iwl4965_lq_sta *lq_sta = file->private_data; 2544 + struct iwl_lq_sta *lq_sta = file->private_data; 2538 2545 for (i = 0; i < LQ_SIZE; i++) { 2539 2546 desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n" 2540 2547 "rate=0x%X\n", ··· 2563 2570 static void rs_add_debugfs(void *priv, void *priv_sta, 2564 2571 struct dentry *dir) 2565 2572 { 2566 - struct iwl4965_lq_sta *lq_sta = priv_sta; 2573 + struct iwl_lq_sta *lq_sta = priv_sta; 2567 2574 lq_sta->rs_sta_dbgfs_scale_table_file = 2568 2575 debugfs_create_file("rate_scale_table", 0600, dir, 2569 2576 lq_sta, &rs_sta_dbgfs_scale_table_ops); ··· 2578 2585 2579 2586 static void rs_remove_debugfs(void *priv, void *priv_sta) 2580 2587 { 2581 - struct iwl4965_lq_sta *lq_sta = priv_sta; 2588 + struct iwl_lq_sta *lq_sta = priv_sta; 2582 2589 debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); 2583 2590 debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); 2584 2591 debugfs_remove(lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file); ··· 2602 2609 #endif 2603 2610 }; 2604 2611 2605 - int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) 2606 - { 2607 - struct ieee80211_local *local = hw_to_local(hw); 2608 - struct iwl_priv *priv = hw->priv; 2609 - struct iwl4965_lq_sta *lq_sta; 2610 - struct sta_info *sta; 2611 - int cnt = 0, i; 2612 - u32 samples = 0, success = 0, good = 0; 2613 - unsigned long now = jiffies; 2614 - u32 max_time = 0; 2615 - u8 lq_type, antenna; 2616 - 2617 - rcu_read_lock(); 2618 - 2619 - sta = sta_info_get(local, priv->stations[sta_id].sta.sta.addr); 2620 - if (!sta || !sta->rate_ctrl_priv) { 2621 - if (sta) 2622 - IWL_DEBUG_RATE("leave - no private rate data!\n"); 2623 - else 2624 - IWL_DEBUG_RATE("leave - no station!\n"); 2625 - rcu_read_unlock(); 2626 - return sprintf(buf, "station %d not found\n", sta_id); 2627 - } 2628 - 2629 - lq_sta = (void *)sta->rate_ctrl_priv; 2630 - 2631 - lq_type = lq_sta->lq_info[lq_sta->active_tbl].lq_type; 2632 - antenna = lq_sta->lq_info[lq_sta->active_tbl].ant_type; 2633 - 2634 - if (is_legacy(lq_type)) 2635 - i = IWL_RATE_54M_INDEX; 2636 - else 2637 - i = IWL_RATE_60M_INDEX; 2638 - while (1) { 2639 - u64 mask; 2640 - int j; 2641 - int active = lq_sta->active_tbl; 2642 - 2643 - cnt += 2644 - sprintf(&buf[cnt], " %2dMbs: ", iwl_rates[i].ieee / 2); 2645 - 2646 - mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1)); 2647 - for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1) 2648 - buf[cnt++] = 2649 - (lq_sta->lq_info[active].win[i].data & mask) 2650 - ? '1' : '0'; 2651 - 2652 - samples += lq_sta->lq_info[active].win[i].counter; 2653 - good += lq_sta->lq_info[active].win[i].success_counter; 2654 - success += lq_sta->lq_info[active].win[i].success_counter * 2655 - iwl_rates[i].ieee; 2656 - 2657 - if (lq_sta->lq_info[active].win[i].stamp) { 2658 - int delta = 2659 - jiffies_to_msecs(now - 2660 - lq_sta->lq_info[active].win[i].stamp); 2661 - 2662 - if (delta > max_time) 2663 - max_time = delta; 2664 - 2665 - cnt += sprintf(&buf[cnt], "%5dms\n", delta); 2666 - } else 2667 - buf[cnt++] = '\n'; 2668 - 2669 - j = iwl4965_get_prev_ieee_rate(i); 2670 - if (j == i) 2671 - break; 2672 - i = j; 2673 - } 2674 - 2675 - /* 2676 - * Display the average rate of all samples taken. 2677 - * NOTE: We multiply # of samples by 2 since the IEEE measurement 2678 - * added from iwl_rates is actually 2X the rate. 2679 - */ 2680 - if (samples) 2681 - cnt += sprintf(&buf[cnt], 2682 - "\nAverage rate is %3d.%02dMbs over last %4dms\n" 2683 - "%3d%% success (%d good packets over %d tries)\n", 2684 - success / (2 * samples), (success * 5 / samples) % 10, 2685 - max_time, good * 100 / samples, good, samples); 2686 - else 2687 - cnt += sprintf(&buf[cnt], "\nAverage rate: 0Mbs\n"); 2688 - 2689 - cnt += sprintf(&buf[cnt], "\nrate scale type %d antenna %d " 2690 - "active_search %d rate index %d\n", lq_type, antenna, 2691 - lq_sta->search_better_tbl, sta->last_txrate_idx); 2692 - 2693 - rcu_read_unlock(); 2694 - return cnt; 2695 - } 2696 - 2697 - int iwl4965_rate_control_register(void) 2612 + int iwlagn_rate_control_register(void) 2698 2613 { 2699 2614 return ieee80211_rate_control_register(&rs_ops); 2700 2615 } 2701 2616 2702 - void iwl4965_rate_control_unregister(void) 2617 + void iwlagn_rate_control_unregister(void) 2703 2618 { 2704 2619 ieee80211_rate_control_unregister(&rs_ops); 2705 2620 }
+7 -16
drivers/net/wireless/iwlwifi/iwl-4965-rs.h drivers/net/wireless/iwlwifi/iwl-agn-rs.h
··· 24 24 * 25 25 *****************************************************************************/ 26 26 27 - #ifndef __iwl_4965_rs_h__ 28 - #define __iwl_4965_rs_h__ 27 + #ifndef __iwl_agn_rs_h__ 28 + #define __iwl_agn_rs_h__ 29 29 30 30 #include "iwl-dev.h" 31 31 ··· 88 88 #define IWL_RATE_5M_MASK (1 << IWL_RATE_5M_INDEX) 89 89 #define IWL_RATE_11M_MASK (1 << IWL_RATE_11M_INDEX) 90 90 91 - /* 4965 uCode API values for legacy bit rates, both OFDM and CCK */ 91 + /* uCode API values for legacy bit rates, both OFDM and CCK */ 92 92 enum { 93 93 IWL_RATE_6M_PLCP = 13, 94 94 IWL_RATE_9M_PLCP = 15, ··· 107 107 /*FIXME:RS:add IWL_RATE_LEGACY_INVM_PLCP = 0,*/ 108 108 }; 109 109 110 - /* 4965 uCode API values for OFDM high-throughput (HT) bit rates */ 110 + /* uCode API values for OFDM high-throughput (HT) bit rates */ 111 111 enum { 112 112 IWL_RATE_SISO_6M_PLCP = 0, 113 113 IWL_RATE_SISO_12M_PLCP = 1, ··· 287 287 } 288 288 289 289 /** 290 - * iwl4965_fill_rs_info - Fill an output text buffer with the rate representation 291 - * 292 - * NOTE: This is provided as a quick mechanism for a user to visualize 293 - * the performance of the rate control algorithm and is not meant to be 294 - * parsed software. 295 - */ 296 - extern int iwl4965_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id); 297 - 298 - /** 299 290 * iwl4965_rate_control_register - Register the rate control algorithm callbacks 300 291 * 301 292 * Since the rate control algorithm is hardware specific, there is no need ··· 296 305 * ieee80211_register_hw 297 306 * 298 307 */ 299 - extern int iwl4965_rate_control_register(void); 308 + extern int iwlagn_rate_control_register(void); 300 309 301 310 /** 302 311 * iwl4965_rate_control_unregister - Unregister the rate control callbacks ··· 304 313 * This should be called after calling ieee80211_unregister_hw, but before 305 314 * the driver is unloaded. 306 315 */ 307 - extern void iwl4965_rate_control_unregister(void); 316 + extern void iwlagn_rate_control_unregister(void); 308 317 309 - #endif 318 + #endif /* __iwl_agn__rs__ */
+40 -116
drivers/net/wireless/iwlwifi/iwl-4965.c
··· 341 341 return -EINVAL; 342 342 343 343 } 344 - int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) 345 - { 346 - int ret; 347 - unsigned long flags; 348 - 349 - spin_lock_irqsave(&priv->lock, flags); 350 - ret = iwl_grab_nic_access(priv); 351 - if (ret) { 352 - spin_unlock_irqrestore(&priv->lock, flags); 353 - return ret; 354 - } 355 - 356 - if (src == IWL_PWR_SRC_VAUX) { 357 - u32 val; 358 - ret = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE, 359 - &val); 360 - 361 - if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) { 362 - iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 363 - APMG_PS_CTRL_VAL_PWR_SRC_VAUX, 364 - ~APMG_PS_CTRL_MSK_PWR_SRC); 365 - } 366 - } else { 367 - iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 368 - APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, 369 - ~APMG_PS_CTRL_MSK_PWR_SRC); 370 - } 371 - 372 - iwl_release_nic_access(priv); 373 - spin_unlock_irqrestore(&priv->lock, flags); 374 - 375 - return ret; 376 - } 377 344 378 345 /* 379 346 * Activate/Deactivat Tx DMA/FIFO channels according tx fifos mask ··· 840 873 priv->hw_params.sens = &iwl4965_sensitivity; 841 874 842 875 return 0; 843 - } 844 - 845 - /* set card power command */ 846 - static int iwl4965_set_power(struct iwl_priv *priv, 847 - void *cmd) 848 - { 849 - int ret = 0; 850 - 851 - ret = iwl_send_cmd_pdu_async(priv, POWER_TABLE_CMD, 852 - sizeof(struct iwl4965_powertable_cmd), 853 - cmd, NULL); 854 - return ret; 855 876 } 856 877 857 878 static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res) ··· 1515 1560 c, atten_value, power_index, 1516 1561 tx_power.s.radio_tx_gain[c], 1517 1562 tx_power.s.dsp_predis_atten[c]); 1518 - }/* for each chain */ 1563 + } /* for each chain */ 1519 1564 1520 1565 tx_power_tbl->power_tbl[i].dw = cpu_to_le32(tx_power.dw); 1521 1566 1522 - }/* for each rate */ 1567 + } /* for each rate */ 1523 1568 1524 1569 return 0; 1525 1570 } ··· 1654 1699 { 1655 1700 struct iwl4965_shared *s = priv->shared_virt; 1656 1701 return le32_to_cpu(s->rb_closed) & 0xFFF; 1657 - } 1658 - 1659 - unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, 1660 - struct iwl_frame *frame, u8 rate) 1661 - { 1662 - struct iwl4965_tx_beacon_cmd *tx_beacon_cmd; 1663 - unsigned int frame_size; 1664 - 1665 - tx_beacon_cmd = &frame->u.beacon; 1666 - memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); 1667 - 1668 - tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id; 1669 - tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 1670 - 1671 - frame_size = iwl4965_fill_beacon_frame(priv, 1672 - tx_beacon_cmd->frame, 1673 - iwl_bcast_addr, 1674 - sizeof(frame->u) - sizeof(*tx_beacon_cmd)); 1675 - 1676 - BUG_ON(frame_size > MAX_MPDU_SIZE); 1677 - tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); 1678 - 1679 - if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP)) 1680 - tx_beacon_cmd->tx.rate_n_flags = 1681 - iwl_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK); 1682 - else 1683 - tx_beacon_cmd->tx.rate_n_flags = 1684 - iwl_hw_set_rate_n_flags(rate, 0); 1685 - 1686 - tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK | 1687 - TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK); 1688 - return (sizeof(*tx_beacon_cmd) + frame_size); 1689 1702 } 1690 1703 1691 1704 static int iwl4965_alloc_shared_mem(struct iwl_priv *priv) ··· 2002 2079 return 0; 2003 2080 } 2004 2081 2005 - int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, 2006 - enum ieee80211_ampdu_mlme_action action, 2007 - const u8 *addr, u16 tid, u16 *ssn) 2008 - { 2009 - struct iwl_priv *priv = hw->priv; 2010 - DECLARE_MAC_BUF(mac); 2011 - 2012 - IWL_DEBUG_HT("A-MPDU action on addr %s tid %d\n", 2013 - print_mac(mac, addr), tid); 2014 - 2015 - if (!(priv->cfg->sku & IWL_SKU_N)) 2016 - return -EACCES; 2017 - 2018 - switch (action) { 2019 - case IEEE80211_AMPDU_RX_START: 2020 - IWL_DEBUG_HT("start Rx\n"); 2021 - return iwl_rx_agg_start(priv, addr, tid, *ssn); 2022 - case IEEE80211_AMPDU_RX_STOP: 2023 - IWL_DEBUG_HT("stop Rx\n"); 2024 - return iwl_rx_agg_stop(priv, addr, tid); 2025 - case IEEE80211_AMPDU_TX_START: 2026 - IWL_DEBUG_HT("start Tx\n"); 2027 - return iwl_tx_agg_start(priv, addr, tid, ssn); 2028 - case IEEE80211_AMPDU_TX_STOP: 2029 - IWL_DEBUG_HT("stop Tx\n"); 2030 - return iwl_tx_agg_stop(priv, addr, tid); 2031 - default: 2032 - IWL_DEBUG_HT("unknown\n"); 2033 - return -EINVAL; 2034 - break; 2035 - } 2036 - return 0; 2037 - } 2038 2082 2039 2083 static u16 iwl4965_get_hcmd_size(u8 cmd_id, u16 len) 2040 2084 { ··· 2130 2240 bitmap = bitmap << sh; 2131 2241 sh = 0; 2132 2242 } 2133 - bitmap |= (1 << sh); 2134 - IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%x\n", 2135 - start, (u32)(bitmap & 0xFFFFFFFF)); 2243 + bitmap |= 1ULL << sh; 2244 + IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%llx\n", 2245 + start, (unsigned long long)bitmap); 2136 2246 } 2137 2247 2138 2248 agg->bitmap = bitmap; ··· 2258 2368 IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); 2259 2369 } 2260 2370 2371 + static int iwl4965_calc_rssi(struct iwl_priv *priv, 2372 + struct iwl_rx_phy_res *rx_resp) 2373 + { 2374 + /* data from PHY/DSP regarding signal strength, etc., 2375 + * contents are always there, not configurable by host. */ 2376 + struct iwl4965_rx_non_cfg_phy *ncphy = 2377 + (struct iwl4965_rx_non_cfg_phy *)rx_resp->non_cfg_phy_buf; 2378 + u32 agc = (le16_to_cpu(ncphy->agc_info) & IWL49_AGC_DB_MASK) 2379 + >> IWL49_AGC_DB_POS; 2380 + 2381 + u32 valid_antennae = 2382 + (le16_to_cpu(rx_resp->phy_flags) & IWL49_RX_PHY_FLAGS_ANTENNAE_MASK) 2383 + >> IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET; 2384 + u8 max_rssi = 0; 2385 + u32 i; 2386 + 2387 + /* Find max rssi among 3 possible receivers. 2388 + * These values are measured by the digital signal processor (DSP). 2389 + * They should stay fairly constant even as the signal strength varies, 2390 + * if the radio's automatic gain control (AGC) is working right. 2391 + * AGC value (see below) will provide the "interesting" info. */ 2392 + for (i = 0; i < 3; i++) 2393 + if (valid_antennae & (1 << i)) 2394 + max_rssi = max(ncphy->rssi_info[i << 1], max_rssi); 2395 + 2396 + IWL_DEBUG_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n", 2397 + ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4], 2398 + max_rssi, agc); 2399 + 2400 + /* dBm = max_rssi dB - agc dB - constant. 2401 + * Higher AGC (higher radio gain) means lower signal. */ 2402 + return max_rssi - agc - IWL_RSSI_OFFSET; 2403 + } 2404 + 2261 2405 2262 2406 /* Set up 4965-specific Rx frame reply handlers */ 2263 2407 static void iwl4965_rx_handler_setup(struct iwl_priv *priv) ··· 2323 2399 .chain_noise_reset = iwl4965_chain_noise_reset, 2324 2400 .gain_computation = iwl4965_gain_computation, 2325 2401 .rts_tx_cmd_flag = iwl4965_rts_tx_cmd_flag, 2402 + .calc_rssi = iwl4965_calc_rssi, 2326 2403 }; 2327 2404 2328 2405 static struct iwl_lib_ops iwl4965_lib = { ··· 2365 2440 .check_version = iwl4965_eeprom_check_version, 2366 2441 .query_addr = iwlcore_eeprom_query_addr, 2367 2442 }, 2368 - .set_power = iwl4965_set_power, 2369 2443 .send_tx_power = iwl4965_send_tx_power, 2370 2444 .update_chain_flags = iwl4965_update_chain_flags, 2371 2445 .temperature = iwl4965_temperature_calib,
+64 -7
drivers/net/wireless/iwlwifi/iwl-5000.c
··· 93 93 iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS, 94 94 CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); 95 95 96 + /* Set FH wait treshold to maximum (HW error during stress W/A) */ 97 + iwl_set_bit(priv, CSR_DBG_HPET_MEM_REG, CSR_DBG_HPET_MEM_REG_VAL); 98 + 99 + /* enable HAP INTA to move device L1a -> L0s */ 100 + iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, 101 + CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); 102 + 96 103 iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL); 97 104 98 105 /* set "initialization complete" bit to move adapter ··· 236 229 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, 237 230 CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | 238 231 CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); 232 + 233 + /* W/A : NIC is stuck in a reset state after Early PCIe power off 234 + * (PCIe power is lost before PERST# is asserted), 235 + * causing ME FW to lose ownership and not being able to obtain it back. 236 + */ 237 + iwl_grab_nic_access(priv); 238 + iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 239 + APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS, 240 + ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS); 241 + iwl_release_nic_access(priv); 239 242 240 243 spin_unlock_irqrestore(&priv->lock, flags); 241 244 } ··· 941 924 len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; 942 925 943 926 if (txq_id != IWL_CMD_QUEUE_NUM) { 944 - sta = txq->cmd[txq->q.write_ptr].cmd.tx.sta_id; 945 - sec_ctl = txq->cmd[txq->q.write_ptr].cmd.tx.sec_ctl; 927 + sta = txq->cmd[txq->q.write_ptr]->cmd.tx.sta_id; 928 + sec_ctl = txq->cmd[txq->q.write_ptr]->cmd.tx.sec_ctl; 946 929 947 930 switch (sec_ctl & TX_CMD_SEC_MSK) { 948 931 case TX_CMD_SEC_CCM: ··· 981 964 u8 sta = 0; 982 965 983 966 if (txq_id != IWL_CMD_QUEUE_NUM) 984 - sta = txq->cmd[txq->q.read_ptr].cmd.tx.sta_id; 967 + sta = txq->cmd[txq->q.read_ptr]->cmd.tx.sta_id; 985 968 986 969 shared_data->queues_byte_cnt_tbls[txq_id].tfd_offset[txq->q.read_ptr]. 987 970 val = cpu_to_le16(1 | (sta << 12)); ··· 1148 1131 1149 1132 static inline u32 iwl5000_get_scd_ssn(struct iwl5000_tx_resp *tx_resp) 1150 1133 { 1151 - return le32_to_cpup((__le32*)&tx_resp->status + 1134 + return le32_to_cpup((__le32 *)&tx_resp->status + 1152 1135 tx_resp->frame_count) & MAX_SN; 1153 1136 } 1154 1137 ··· 1245 1228 bitmap = bitmap << sh; 1246 1229 sh = 0; 1247 1230 } 1248 - bitmap |= (1 << sh); 1249 - IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%x\n", 1250 - start, (u32)(bitmap & 0xFFFFFFFF)); 1231 + bitmap |= 1ULL << sh; 1232 + IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%llx\n", 1233 + start, (unsigned long long)bitmap); 1251 1234 } 1252 1235 1253 1236 agg->bitmap = bitmap; ··· 1461 1444 priv->temperature = le32_to_cpu(priv->statistics.general.temperature); 1462 1445 } 1463 1446 1447 + /* Calc max signal level (dBm) among 3 possible receivers */ 1448 + static int iwl5000_calc_rssi(struct iwl_priv *priv, 1449 + struct iwl_rx_phy_res *rx_resp) 1450 + { 1451 + /* data from PHY/DSP regarding signal strength, etc., 1452 + * contents are always there, not configurable by host 1453 + */ 1454 + struct iwl5000_non_cfg_phy *ncphy = 1455 + (struct iwl5000_non_cfg_phy *)rx_resp->non_cfg_phy_buf; 1456 + u32 val, rssi_a, rssi_b, rssi_c, max_rssi; 1457 + u8 agc; 1458 + 1459 + val = le32_to_cpu(ncphy->non_cfg_phy[IWL50_RX_RES_AGC_IDX]); 1460 + agc = (val & IWL50_OFDM_AGC_MSK) >> IWL50_OFDM_AGC_BIT_POS; 1461 + 1462 + /* Find max rssi among 3 possible receivers. 1463 + * These values are measured by the digital signal processor (DSP). 1464 + * They should stay fairly constant even as the signal strength varies, 1465 + * if the radio's automatic gain control (AGC) is working right. 1466 + * AGC value (see below) will provide the "interesting" info. 1467 + */ 1468 + val = le32_to_cpu(ncphy->non_cfg_phy[IWL50_RX_RES_RSSI_AB_IDX]); 1469 + rssi_a = (val & IWL50_OFDM_RSSI_A_MSK) >> IWL50_OFDM_RSSI_A_BIT_POS; 1470 + rssi_b = (val & IWL50_OFDM_RSSI_B_MSK) >> IWL50_OFDM_RSSI_B_BIT_POS; 1471 + val = le32_to_cpu(ncphy->non_cfg_phy[IWL50_RX_RES_RSSI_C_IDX]); 1472 + rssi_c = (val & IWL50_OFDM_RSSI_C_MSK) >> IWL50_OFDM_RSSI_C_BIT_POS; 1473 + 1474 + max_rssi = max_t(u32, rssi_a, rssi_b); 1475 + max_rssi = max_t(u32, max_rssi, rssi_c); 1476 + 1477 + IWL_DEBUG_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n", 1478 + rssi_a, rssi_b, rssi_c, max_rssi, agc); 1479 + 1480 + /* dBm = max_rssi dB - agc dB - constant. 1481 + * Higher AGC (higher radio gain) means lower signal. */ 1482 + return max_rssi - agc - IWL_RSSI_OFFSET; 1483 + } 1484 + 1464 1485 static struct iwl_hcmd_ops iwl5000_hcmd = { 1465 1486 .rxon_assoc = iwl5000_send_rxon_assoc, 1466 1487 }; ··· 1509 1454 .gain_computation = iwl5000_gain_computation, 1510 1455 .chain_noise_reset = iwl5000_chain_noise_reset, 1511 1456 .rts_tx_cmd_flag = iwl5000_rts_tx_cmd_flag, 1457 + .calc_rssi = iwl5000_calc_rssi, 1512 1458 }; 1513 1459 1514 1460 static struct iwl_lib_ops iwl5000_lib = { ··· 1530 1474 .alive_notify = iwl5000_alive_notify, 1531 1475 .send_tx_power = iwl5000_send_tx_power, 1532 1476 .temperature = iwl5000_temperature, 1477 + .update_chain_flags = iwl4965_update_chain_flags, 1533 1478 .apm_ops = { 1534 1479 .init = iwl5000_apm_init, 1535 1480 .reset = iwl5000_apm_reset,
+31 -13
drivers/net/wireless/iwlwifi/iwl-commands.h
··· 666 666 __le16 reserved; 667 667 } __attribute__ ((packed)); 668 668 669 - 670 - 669 + #define IWL_CONN_MAX_LISTEN_INTERVAL 10 671 670 672 671 /* 673 672 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) ··· 1075 1076 } __attribute__ ((packed)); 1076 1077 1077 1078 /* Fixed (non-configurable) rx data from phy */ 1078 - #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4) 1079 - #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70) 1080 - #define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ 1081 - #define IWL_AGC_DB_POS (7) 1079 + 1080 + #define IWL49_RX_RES_PHY_CNT 14 1081 + #define IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET (4) 1082 + #define IWL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70) 1083 + #define IWL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ 1084 + #define IWL49_AGC_DB_POS (7) 1082 1085 struct iwl4965_rx_non_cfg_phy { 1083 1086 __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ 1084 1087 __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ ··· 1088 1087 u8 pad[0]; 1089 1088 } __attribute__ ((packed)); 1090 1089 1090 + 1091 + #define IWL50_RX_RES_PHY_CNT 8 1092 + #define IWL50_RX_RES_AGC_IDX 1 1093 + #define IWL50_RX_RES_RSSI_AB_IDX 2 1094 + #define IWL50_RX_RES_RSSI_C_IDX 3 1095 + #define IWL50_OFDM_AGC_MSK 0xfe00 1096 + #define IWL50_OFDM_AGC_BIT_POS 9 1097 + #define IWL50_OFDM_RSSI_A_MSK 0x00ff 1098 + #define IWL50_OFDM_RSSI_A_BIT_POS 0 1099 + #define IWL50_OFDM_RSSI_B_MSK 0xff0000 1100 + #define IWL50_OFDM_RSSI_B_BIT_POS 16 1101 + #define IWL50_OFDM_RSSI_C_MSK 0x00ff 1102 + #define IWL50_OFDM_RSSI_C_BIT_POS 0 1103 + 1104 + struct iwl5000_non_cfg_phy { 1105 + __le32 non_cfg_phy[IWL50_RX_RES_PHY_CNT]; /* upto 8 phy entries */ 1106 + } __attribute__ ((packed)); 1107 + 1108 + 1091 1109 /* 1092 1110 * REPLY_RX = 0xc3 (response only, not a command) 1093 1111 * Used only for legacy (non 11n) frames. 1094 1112 */ 1095 - #define RX_RES_PHY_CNT 14 1096 - struct iwl4965_rx_phy_res { 1113 + struct iwl_rx_phy_res { 1097 1114 u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ 1098 1115 u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ 1099 1116 u8 stat_id; /* configurable DSP phy data set ID */ ··· 1120 1101 __le32 beacon_time_stamp; /* beacon at on-air rise */ 1121 1102 __le16 phy_flags; /* general phy flags: band, modulation, ... */ 1122 1103 __le16 channel; /* channel number */ 1123 - __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */ 1124 - __le32 reserved2; 1104 + u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */ 1125 1105 __le32 rate_n_flags; /* RATE_MCS_* */ 1126 1106 __le16 byte_count; /* frame's byte-count */ 1127 1107 __le16 reserved3; ··· 2011 1993 *****************************************************************************/ 2012 1994 2013 1995 /** 2014 - * struct iwl4965_powertable_cmd - Power Table Command 1996 + * struct iwl_powertable_cmd - Power Table Command 2015 1997 * @flags: See below: 2016 1998 * 2017 1999 * POWER_TABLE_CMD = 0x77 (command, has simple generic response) ··· 2045 2027 #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1 << 3) 2046 2028 #define IWL_POWER_FAST_PD __constant_cpu_to_le16(1 << 4) 2047 2029 2048 - struct iwl4965_powertable_cmd { 2030 + struct iwl_powertable_cmd { 2049 2031 __le16 flags; 2050 2032 u8 keep_alive_seconds; 2051 2033 u8 debug_flags; ··· 2342 2324 /* 2343 2325 * REPLY_TX_BEACON = 0x91 (command, has simple generic response) 2344 2326 */ 2345 - struct iwl4965_tx_beacon_cmd { 2327 + struct iwl_tx_beacon_cmd { 2346 2328 struct iwl_tx_cmd tx; 2347 2329 __le16 tim_idx; 2348 2330 u8 tim_size;
+4 -3
drivers/net/wireless/iwlwifi/iwl-core.c
··· 383 383 } 384 384 EXPORT_SYMBOL(iwl_reset_qos); 385 385 386 - #define MAX_BIT_RATE_40_MHZ 0x96; /* 150 Mbps */ 387 - #define MAX_BIT_RATE_20_MHZ 0x48; /* 72 Mbps */ 386 + #define MAX_BIT_RATE_40_MHZ 0x96 /* 150 Mbps */ 387 + #define MAX_BIT_RATE_20_MHZ 0x48 /* 72 Mbps */ 388 388 static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv, 389 389 struct ieee80211_ht_info *ht_info, 390 390 enum ieee80211_band band) ··· 815 815 { 816 816 int ret; 817 817 struct ieee80211_hw *hw = priv->hw; 818 - hw->rate_control_algorithm = "iwl-4965-rs"; 818 + hw->rate_control_algorithm = "iwl-agn-rs"; 819 819 820 820 /* Tell mac80211 our characteristics */ 821 821 hw->flags = IEEE80211_HW_SIGNAL_DBM | ··· 827 827 hw->ampdu_queues = priv->cfg->mod_params->num_of_ampdu_queues; 828 828 829 829 hw->conf.beacon_int = 100; 830 + hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; 830 831 831 832 if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) 832 833 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
+2 -1
drivers/net/wireless/iwlwifi/iwl-core.h
··· 95 95 void (*chain_noise_reset)(struct iwl_priv *priv); 96 96 void (*rts_tx_cmd_flag)(struct ieee80211_tx_info *info, 97 97 __le32 *tx_flags); 98 + int (*calc_rssi)(struct iwl_priv *priv, 99 + struct iwl_rx_phy_res *rx_resp); 98 100 }; 99 101 100 102 struct iwl_lib_ops { ··· 141 139 int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src); 142 140 } apm_ops; 143 141 /* power */ 144 - int (*set_power)(struct iwl_priv *priv, void *cmd); 145 142 int (*send_tx_power) (struct iwl_priv *priv); 146 143 void (*update_chain_flags)(struct iwl_priv *priv); 147 144 void (*temperature) (struct iwl_priv *priv);
+9 -1
drivers/net/wireless/iwlwifi/iwl-csr.h
··· 104 104 * 3-2: 0 = A, 1 = B, 2 = C, 3 = D step 105 105 */ 106 106 #define CSR_HW_REV_WA_REG (CSR_BASE+0x22C) 107 + #define CSR_DBG_HPET_MEM_REG (CSR_BASE+0x240) 107 108 108 109 /* Bits for CSR_HW_IF_CONFIG_REG */ 109 110 #define CSR49_HW_IF_CONFIG_REG_BIT_4965_R (0x00000010) ··· 119 118 #define CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A (0x00000000) 120 119 #define CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B (0x00001000) 121 120 122 - #define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000) 121 + #define CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A (0x00080000) 122 + #define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000) 123 + #define CSR_HW_IF_CONFIG_REG_BIT_PCI_OWN_SEM (0x00400000) 124 + #define CSR_HW_IF_CONFIG_REG_BIT_ME_OWN (0x02000000) 125 + #define CSR_HW_IF_CONFIG_REG_BIT_WAKE_ME (0x08000000) 126 + 123 127 124 128 /* interrupt flags in INTA, set by uCode or hardware (e.g. dma), 125 129 * acknowledged (reset) by host writing "1" to flagged bits. */ ··· 242 236 #define CSR39_ANA_PLL_CFG_VAL (0x01000000) 243 237 #define CSR50_ANA_PLL_CFG_VAL (0x00880300) 244 238 239 + /* HPET MEM debug */ 240 + #define CSR_DBG_HPET_MEM_REG_VAL (0xFFFF0000) 245 241 /*=== HBUS (Host-side Bus) ===*/ 246 242 #define HBUS_BASE (0x400) 247 243 /*
+2 -2
drivers/net/wireless/iwlwifi/iwl-debug.h
··· 33 33 #define IWL_DEBUG(level, fmt, args...) \ 34 34 do { if (priv->debug_level & (level)) \ 35 35 dev_printk(KERN_ERR, &(priv->hw->wiphy->dev), "%c %s " fmt, \ 36 - in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) 36 + in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) 37 37 38 38 #define IWL_DEBUG_LIMIT(level, fmt, args...) \ 39 39 do { if ((priv->debug_level & (level)) && net_ratelimit()) \ 40 40 dev_printk(KERN_ERR, &(priv->hw->wiphy->dev), "%c %s " fmt, \ 41 - in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) 41 + in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) 42 42 43 43 #ifdef CONFIG_IWLWIFI_DEBUGFS 44 44 struct iwl_debugfs {
+7 -4
drivers/net/wireless/iwlwifi/iwl-debugfs.c
··· 231 231 DECLARE_MAC_BUF(mac); 232 232 233 233 buf = kmalloc(bufsz, GFP_KERNEL); 234 - if(!buf) 234 + if (!buf) 235 235 return -ENOMEM; 236 236 237 237 pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n", ··· 364 364 { 365 365 struct iwl_debugfs *dbgfs; 366 366 struct dentry *phyd = priv->hw->wiphy->debugfsdir; 367 + int ret = 0; 367 368 368 369 dbgfs = kzalloc(sizeof(struct iwl_debugfs), GFP_KERNEL); 369 370 if (!dbgfs) { 371 + ret = -ENOMEM; 370 372 goto err; 371 373 } 372 374 373 375 priv->dbgfs = dbgfs; 374 376 dbgfs->name = name; 375 377 dbgfs->dir_drv = debugfs_create_dir(name, phyd); 376 - if (!dbgfs->dir_drv || IS_ERR(dbgfs->dir_drv)){ 378 + if (!dbgfs->dir_drv || IS_ERR(dbgfs->dir_drv)) { 379 + ret = -ENOENT; 377 380 goto err; 378 381 } 379 382 ··· 397 394 err: 398 395 IWL_ERROR("Can't open the debugfs directory\n"); 399 396 iwl_dbgfs_unregister(priv); 400 - return -ENOENT; 397 + return ret; 401 398 } 402 399 EXPORT_SYMBOL(iwl_dbgfs_register); 403 400 ··· 407 404 */ 408 405 void iwl_dbgfs_unregister(struct iwl_priv *priv) 409 406 { 410 - if (!(priv->dbgfs)) 407 + if (!priv->dbgfs) 411 408 return; 412 409 413 410 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_eeprom);
+7 -15
drivers/net/wireless/iwlwifi/iwl-dev.h
··· 36 36 #include <linux/kernel.h> 37 37 #include <net/ieee80211_radiotap.h> 38 38 39 - #define DRV_NAME "iwl4965" 39 + #define DRV_NAME "iwlagn" 40 40 #include "iwl-rfkill.h" 41 41 #include "iwl-eeprom.h" 42 42 #include "iwl-4965-hw.h" ··· 45 45 #include "iwl-debug.h" 46 46 #include "iwl-led.h" 47 47 #include "iwl-power.h" 48 + #include "iwl-agn-rs.h" 48 49 49 50 /* configuration for the iwl4965 */ 50 51 extern struct iwl_cfg iwl4965_agn_cfg; ··· 135 134 struct iwl_tx_queue { 136 135 struct iwl_queue q; 137 136 struct iwl_tfd_frame *bd; 138 - struct iwl_cmd *cmd; 139 - dma_addr_t dma_addr_cmd; 137 + struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS]; 140 138 struct iwl_tx_info *txb; 141 139 int need_update; 142 140 int sched_retry; ··· 191 191 const s8 clip_powers[IWL_MAX_RATES]; 192 192 }; 193 193 194 - #include "iwl-4965-rs.h" 195 194 196 195 #define IWL_TX_FIFO_AC0 0 197 196 #define IWL_TX_FIFO_AC1 1 ··· 218 219 struct iwl_frame { 219 220 union { 220 221 struct ieee80211_hdr frame; 221 - struct iwl4965_tx_beacon_cmd beacon; 222 + struct iwl_tx_beacon_cmd beacon; 222 223 u8 raw[IEEE80211_FRAME_LEN]; 223 224 u8 cmd[360]; 224 225 } u; ··· 282 283 u32 val32; 283 284 struct iwl4965_bt_cmd bt; 284 285 struct iwl4965_rxon_time_cmd rxon_time; 285 - struct iwl4965_powertable_cmd powertable; 286 + struct iwl_powertable_cmd powertable; 286 287 struct iwl_qosparam_cmd qosparam; 287 288 struct iwl_tx_cmd tx; 288 - struct iwl4965_tx_beacon_cmd tx_beacon; 289 289 struct iwl4965_rxon_assoc_cmd rxon_assoc; 290 290 struct iwl_rem_sta_cmd rm_sta; 291 291 u8 *indirect; ··· 588 590 const u8 *dest, int left); 589 591 extern void iwl4965_update_chain_flags(struct iwl_priv *priv); 590 592 int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src); 593 + extern int iwl4965_set_power(struct iwl_priv *priv, void *cmd); 591 594 592 595 extern const u8 iwl_bcast_addr[ETH_ALEN]; 593 596 ··· 641 642 * Forward declare iwl-4965.c functions for iwl-base.c 642 643 */ 643 644 extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv); 644 - 645 - int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, 646 - enum ieee80211_ampdu_mlme_action action, 647 - const u8 *addr, u16 tid, u16 *ssn); 648 645 int iwl4965_check_empty_hw_queue(struct iwl_priv *priv, int sta_id, 649 646 u8 tid, int txq_id); 650 647 ··· 807 812 #define EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ 808 813 809 814 810 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 811 - 812 815 enum { 813 816 MEASUREMENT_READY = (1 << 0), 814 817 MEASUREMENT_ACTIVE = (1 << 1), 815 818 }; 816 819 817 - #endif 818 820 819 821 #define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */ 820 822 ··· 836 844 837 845 struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; 838 846 839 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 847 + #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 840 848 /* spectrum measurement report caching */ 841 849 struct iwl4965_spectrum_notification measure_report; 842 850 u8 measurement_status;
+1 -2
drivers/net/wireless/iwlwifi/iwl-eeprom.c
··· 273 273 274 274 void iwl_eeprom_free(struct iwl_priv *priv) 275 275 { 276 - if(priv->eeprom) 277 - kfree(priv->eeprom); 276 + kfree(priv->eeprom); 278 277 priv->eeprom = NULL; 279 278 } 280 279 EXPORT_SYMBOL(iwl_eeprom_free);
+1 -1
drivers/net/wireless/iwlwifi/iwl-hcmd.c
··· 228 228 * TX cmd queue. Otherwise in case the cmd comes 229 229 * in later, it will possibly set an invalid 230 230 * address (cmd->meta.source). */ 231 - qcmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx]; 231 + qcmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx]; 232 232 qcmd->meta.flags &= ~CMD_WANT_SKB; 233 233 } 234 234 fail:
+41 -28
drivers/net/wireless/iwlwifi/iwl-led.c
··· 161 161 /* Set led register off */ 162 162 static int iwl4965_led_off_reg(struct iwl_priv *priv, int led_id) 163 163 { 164 - IWL_DEBUG_LED("radio off\n"); 164 + IWL_DEBUG_LED("LED Reg off\n"); 165 165 iwl_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_OFF); 166 + return 0; 167 + } 168 + 169 + /* 170 + * Set led register in case of disassociation according to rfkill state 171 + */ 172 + static int iwl_led_associate(struct iwl_priv *priv, int led_id) 173 + { 174 + IWL_DEBUG_LED("Associated\n"); 175 + priv->allow_blinking = 1; 176 + return iwl4965_led_on_reg(priv, led_id); 177 + } 178 + static int iwl_led_disassociate(struct iwl_priv *priv, int led_id) 179 + { 180 + priv->allow_blinking = 0; 181 + if (iwl_is_rfkill(priv)) 182 + iwl4965_led_off_reg(priv, led_id); 183 + else 184 + iwl4965_led_on_reg(priv, led_id); 185 + 166 186 return 0; 167 187 } 168 188 ··· 219 199 led_type_str[led->type], brightness); 220 200 switch (brightness) { 221 201 case LED_FULL: 222 - if (led->type == IWL_LED_TRG_ASSOC) 223 - priv->allow_blinking = 1; 224 - 225 202 if (led->led_on) 226 203 led->led_on(priv, IWL_LED_LINK); 227 204 break; 228 205 case LED_OFF: 229 - if (led->type == IWL_LED_TRG_ASSOC) 230 - priv->allow_blinking = 0; 231 - 232 206 if (led->led_off) 233 207 led->led_off(priv, IWL_LED_LINK); 234 208 break; ··· 242 228 */ 243 229 static int iwl_leds_register_led(struct iwl_priv *priv, struct iwl_led *led, 244 230 enum led_type type, u8 set_led, 245 - const char *name, char *trigger) 231 + char *trigger) 246 232 { 247 233 struct device *device = wiphy_dev(priv->hw->wiphy); 248 234 int ret; 249 235 250 - led->led_dev.name = name; 236 + led->led_dev.name = led->name; 251 237 led->led_dev.brightness_set = iwl_led_brightness_set; 252 238 led->led_dev.default_trigger = trigger; 253 239 ··· 298 284 return i; 299 285 } 300 286 301 - static inline int is_rf_kill(struct iwl_priv *priv) 302 - { 303 - return test_bit(STATUS_RF_KILL_HW, &priv->status) || 304 - test_bit(STATUS_RF_KILL_SW, &priv->status); 305 - } 306 - 307 287 /* 308 288 * this function called from handler. Since setting Led command can 309 289 * happen very frequent we postpone led command to be called from ··· 311 303 priv->last_blink_time = 0; 312 304 return; 313 305 } 314 - if (is_rf_kill(priv)) { 306 + if (iwl_is_rfkill(priv)) { 315 307 priv->last_blink_time = 0; 316 308 return; 317 309 } ··· 345 337 int iwl_leds_register(struct iwl_priv *priv) 346 338 { 347 339 char *trigger; 348 - char name[32]; 349 340 int ret; 350 341 351 342 priv->last_blink_rate = 0; ··· 353 346 priv->allow_blinking = 0; 354 347 355 348 trigger = ieee80211_get_radio_led_name(priv->hw); 356 - snprintf(name, sizeof(name), "iwl-%s:radio", 349 + snprintf(priv->led[IWL_LED_TRG_RADIO].name, 350 + sizeof(priv->led[IWL_LED_TRG_RADIO].name), "iwl-%s:radio", 357 351 wiphy_name(priv->hw->wiphy)); 358 352 359 353 priv->led[IWL_LED_TRG_RADIO].led_on = iwl4965_led_on_reg; ··· 362 354 priv->led[IWL_LED_TRG_RADIO].led_pattern = NULL; 363 355 364 356 ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_RADIO], 365 - IWL_LED_TRG_RADIO, 1, name, trigger); 357 + IWL_LED_TRG_RADIO, 1, trigger); 366 358 if (ret) 367 359 goto exit_fail; 368 360 369 361 trigger = ieee80211_get_assoc_led_name(priv->hw); 370 - snprintf(name, sizeof(name), "iwl-%s:assoc", 362 + snprintf(priv->led[IWL_LED_TRG_ASSOC].name, 363 + sizeof(priv->led[IWL_LED_TRG_ASSOC].name), "iwl-%s:assoc", 371 364 wiphy_name(priv->hw->wiphy)); 372 365 373 366 ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_ASSOC], 374 - IWL_LED_TRG_ASSOC, 0, name, trigger); 367 + IWL_LED_TRG_ASSOC, 0, trigger); 375 368 376 369 /* for assoc always turn led on */ 377 - priv->led[IWL_LED_TRG_ASSOC].led_on = iwl4965_led_on_reg; 378 - priv->led[IWL_LED_TRG_ASSOC].led_off = iwl4965_led_on_reg; 370 + priv->led[IWL_LED_TRG_ASSOC].led_on = iwl_led_associate; 371 + priv->led[IWL_LED_TRG_ASSOC].led_off = iwl_led_disassociate; 379 372 priv->led[IWL_LED_TRG_ASSOC].led_pattern = NULL; 380 373 381 374 if (ret) 382 375 goto exit_fail; 383 376 384 377 trigger = ieee80211_get_rx_led_name(priv->hw); 385 - snprintf(name, sizeof(name), "iwl-%s:RX", wiphy_name(priv->hw->wiphy)); 386 - 378 + snprintf(priv->led[IWL_LED_TRG_RX].name, 379 + sizeof(priv->led[IWL_LED_TRG_RX].name), "iwl-%s:RX", 380 + wiphy_name(priv->hw->wiphy)); 387 381 388 382 ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_RX], 389 - IWL_LED_TRG_RX, 0, name, trigger); 383 + IWL_LED_TRG_RX, 0, trigger); 390 384 391 385 priv->led[IWL_LED_TRG_RX].led_on = iwl_led_associated; 392 386 priv->led[IWL_LED_TRG_RX].led_off = iwl_led_associated; ··· 398 388 goto exit_fail; 399 389 400 390 trigger = ieee80211_get_tx_led_name(priv->hw); 401 - snprintf(name, sizeof(name), "iwl-%s:TX", wiphy_name(priv->hw->wiphy)); 391 + snprintf(priv->led[IWL_LED_TRG_TX].name, 392 + sizeof(priv->led[IWL_LED_TRG_TX].name), "iwl-%s:TX", 393 + wiphy_name(priv->hw->wiphy)); 394 + 402 395 ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_TX], 403 - IWL_LED_TRG_TX, 0, name, trigger); 396 + IWL_LED_TRG_TX, 0, trigger); 404 397 405 398 priv->led[IWL_LED_TRG_TX].led_on = iwl_led_associated; 406 399 priv->led[IWL_LED_TRG_TX].led_off = iwl_led_associated;
+1
drivers/net/wireless/iwlwifi/iwl-led.h
··· 52 52 struct iwl_led { 53 53 struct iwl_priv *priv; 54 54 struct led_classdev led_dev; 55 + char name[32]; 55 56 56 57 int (*led_on) (struct iwl_priv *priv, int led_id); 57 58 int (*led_off) (struct iwl_priv *priv, int led_id);
+28 -17
drivers/net/wireless/iwlwifi/iwl-power.c
··· 82 82 83 83 /* default power management (not Tx power) table values */ 84 84 /* for tim 0-10 */ 85 - static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = { 85 + static struct iwl_power_vec_entry range_0[IWL_POWER_MAX] = { 86 86 {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 87 87 {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, 88 88 {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, ··· 93 93 94 94 95 95 /* for tim = 3-10 */ 96 - static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = { 96 + static struct iwl_power_vec_entry range_1[IWL_POWER_MAX] = { 97 97 {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 98 98 {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, 99 99 {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 3, 4, 7)}, 0}, ··· 103 103 }; 104 104 105 105 /* for tim > 11 */ 106 - static struct iwl_power_vec_entry range_2[IWL_POWER_AC] = { 106 + static struct iwl_power_vec_entry range_2[IWL_POWER_MAX] = { 107 107 {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 108 108 {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, 109 109 {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(2, 4, 6, 7, 0xFF)}, 0}, ··· 112 112 {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} 113 113 }; 114 114 115 + /* set card power command */ 116 + static int iwl_set_power(struct iwl_priv *priv, void *cmd) 117 + { 118 + return iwl_send_cmd_pdu_async(priv, POWER_TABLE_CMD, 119 + sizeof(struct iwl_powertable_cmd), 120 + cmd, NULL); 121 + } 115 122 /* decide the right power level according to association status 116 123 * and battery status 117 124 */ 118 125 static u16 iwl_get_auto_power_mode(struct iwl_priv *priv) 119 126 { 120 - u16 mode = priv->power_data.user_power_setting; 127 + u16 mode; 121 128 122 129 switch (priv->power_data.user_power_setting) { 123 130 case IWL_POWER_AUTO: ··· 136 129 else 137 130 mode = IWL_POWER_ON_AC_DISASSOC; 138 131 break; 132 + /* FIXME: remove battery and ac from here */ 139 133 case IWL_POWER_BATTERY: 140 134 mode = IWL_POWER_INDEX_3; 141 135 break; 142 136 case IWL_POWER_AC: 143 137 mode = IWL_POWER_MODE_CAM; 138 + break; 139 + default: 140 + mode = priv->power_data.user_power_setting; 144 141 break; 145 142 } 146 143 return mode; ··· 155 144 { 156 145 int ret = 0, i; 157 146 struct iwl_power_mgr *pow_data; 158 - int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_AC; 147 + int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_MAX; 159 148 u16 pci_pm; 160 149 161 150 IWL_DEBUG_POWER("Initialize power \n"); ··· 173 162 if (ret != 0) 174 163 return 0; 175 164 else { 176 - struct iwl4965_powertable_cmd *cmd; 165 + struct iwl_powertable_cmd *cmd; 177 166 178 167 IWL_DEBUG_POWER("adjust power command flags\n"); 179 168 180 - for (i = 0; i < IWL_POWER_AC; i++) { 169 + for (i = 0; i < IWL_POWER_MAX; i++) { 181 170 cmd = &pow_data->pwr_range_0[i].cmd; 182 171 183 172 if (pci_pm & 0x1) ··· 191 180 192 181 /* adjust power command according to dtim period and power level*/ 193 182 static int iwl_update_power_command(struct iwl_priv *priv, 194 - struct iwl4965_powertable_cmd *cmd, 183 + struct iwl_powertable_cmd *cmd, 195 184 u16 mode) 196 185 { 197 186 int ret = 0, i; ··· 215 204 range = &pow_data->pwr_range_2[0]; 216 205 217 206 period = pow_data->dtim_period; 218 - memcpy(cmd, &range[mode].cmd, sizeof(struct iwl4965_powertable_cmd)); 207 + memcpy(cmd, &range[mode].cmd, sizeof(struct iwl_powertable_cmd)); 219 208 220 209 if (period == 0) { 221 210 period = 1; ··· 269 258 * else user level */ 270 259 271 260 switch (setting->system_power_setting) { 272 - case IWL_POWER_AUTO: 261 + case IWL_POWER_SYS_AUTO: 273 262 final_mode = iwl_get_auto_power_mode(priv); 274 263 break; 275 - case IWL_POWER_BATTERY: 264 + case IWL_POWER_SYS_BATTERY: 276 265 final_mode = IWL_POWER_INDEX_3; 277 266 break; 278 - case IWL_POWER_AC: 267 + case IWL_POWER_SYS_AC: 279 268 final_mode = IWL_POWER_MODE_CAM; 280 269 break; 281 270 default: 282 - final_mode = setting->system_power_setting; 271 + final_mode = IWL_POWER_INDEX_3; 272 + WARN_ON(1); 283 273 } 284 274 285 275 if (setting->critical_power_setting > final_mode) ··· 292 280 293 281 if (!iwl_is_rfkill(priv) && !setting->power_disabled && 294 282 ((setting->power_mode != final_mode) || refresh)) { 295 - struct iwl4965_powertable_cmd cmd; 283 + struct iwl_powertable_cmd cmd; 296 284 297 285 if (final_mode != IWL_POWER_MODE_CAM) 298 286 set_bit(STATUS_POWER_PMI, &priv->status); ··· 303 291 if (final_mode == IWL_POWER_INDEX_5) 304 292 cmd.flags |= IWL_POWER_FAST_PD; 305 293 306 - if (priv->cfg->ops->lib->set_power) 307 - ret = priv->cfg->ops->lib->set_power(priv, &cmd); 294 + ret = iwl_set_power(priv, &cmd); 308 295 309 296 if (final_mode == IWL_POWER_MODE_CAM) 310 297 clear_bit(STATUS_POWER_PMI, &priv->status); ··· 399 388 iwl_power_init_handle(priv); 400 389 priv->power_data.user_power_setting = IWL_POWER_AUTO; 401 390 priv->power_data.power_disabled = 0; 402 - priv->power_data.system_power_setting = IWL_POWER_AUTO; 391 + priv->power_data.system_power_setting = IWL_POWER_SYS_AUTO; 403 392 priv->power_data.is_battery_active = 0; 404 393 priv->power_data.power_disabled = 0; 405 394 priv->power_data.critical_power_setting = 0;
+23 -10
drivers/net/wireless/iwlwifi/iwl-power.h
··· 33 33 34 34 struct iwl_priv; 35 35 36 - #define IWL_POWER_MODE_CAM 0x00 /* Continuously Aware Mode, always on */ 37 - #define IWL_POWER_INDEX_3 0x03 38 - #define IWL_POWER_INDEX_5 0x05 39 - #define IWL_POWER_AC 0x06 40 - #define IWL_POWER_BATTERY 0x07 41 - #define IWL_POWER_AUTO 0x08 36 + enum { 37 + IWL_POWER_MODE_CAM, /* Continuously Aware Mode, always on */ 38 + IWL_POWER_INDEX_1, 39 + IWL_POWER_INDEX_2, 40 + IWL_POWER_INDEX_3, 41 + IWL_POWER_INDEX_4, 42 + IWL_POWER_INDEX_5, 43 + IWL_POWER_AUTO, 44 + IWL_POWER_MAX = IWL_POWER_AUTO, 45 + IWL_POWER_AC, 46 + IWL_POWER_BATTERY, 47 + }; 48 + 49 + enum { 50 + IWL_POWER_SYS_AUTO, 51 + IWL_POWER_SYS_AC, 52 + IWL_POWER_SYS_BATTERY, 53 + }; 54 + 42 55 #define IWL_POWER_LIMIT 0x08 43 56 #define IWL_POWER_MASK 0x0F 44 57 #define IWL_POWER_ENABLED 0x10 ··· 59 46 /* Power management (not Tx power) structures */ 60 47 61 48 struct iwl_power_vec_entry { 62 - struct iwl4965_powertable_cmd cmd; 49 + struct iwl_powertable_cmd cmd; 63 50 u8 no_dtim; 64 51 }; 65 52 66 53 struct iwl_power_mgr { 67 54 spinlock_t lock; 68 - struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC]; 69 - struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC]; 70 - struct iwl_power_vec_entry pwr_range_2[IWL_POWER_AC]; 55 + struct iwl_power_vec_entry pwr_range_0[IWL_POWER_MAX]; 56 + struct iwl_power_vec_entry pwr_range_1[IWL_POWER_MAX]; 57 + struct iwl_power_vec_entry pwr_range_2[IWL_POWER_MAX]; 71 58 u32 dtim_period; 72 59 /* final power level that used to calculate final power command */ 73 60 u8 power_mode;
+7 -5
drivers/net/wireless/iwlwifi/iwl-prph.h
··· 84 84 #define APMG_CLK_VAL_DMA_CLK_RQT (0x00000200) 85 85 #define APMG_CLK_VAL_BSM_CLK_RQT (0x00000800) 86 86 87 - #define APMG_PS_CTRL_VAL_RESET_REQ (0x04000000) 88 87 89 - #define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800) 88 + #define APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS (0x00400000) 89 + #define APMG_PS_CTRL_VAL_RESET_REQ (0x04000000) 90 + #define APMG_PS_CTRL_MSK_PWR_SRC (0x03000000) 91 + #define APMG_PS_CTRL_VAL_PWR_SRC_VMAIN (0x00000000) 92 + #define APMG_PS_CTRL_VAL_PWR_SRC_MAX (0x01000000) /* 3945 only */ 93 + #define APMG_PS_CTRL_VAL_PWR_SRC_VAUX (0x02000000) 90 94 91 - #define APMG_PS_CTRL_MSK_PWR_SRC (0x03000000) 92 - #define APMG_PS_CTRL_VAL_PWR_SRC_VMAIN (0x00000000) 93 - #define APMG_PS_CTRL_VAL_PWR_SRC_VAUX (0x01000000) 94 95 96 + #define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800) 95 97 96 98 /** 97 99 * BSM (Bootstrap State Machine)
+16 -43
drivers/net/wireless/iwlwifi/iwl-rx.c
··· 791 791 792 792 static void iwl_add_radiotap(struct iwl_priv *priv, 793 793 struct sk_buff *skb, 794 - struct iwl4965_rx_phy_res *rx_start, 794 + struct iwl_rx_phy_res *rx_start, 795 795 struct ieee80211_rx_status *stats, 796 796 u32 ampdu_status) 797 797 { ··· 1010 1010 struct ieee80211_rx_status *stats) 1011 1011 { 1012 1012 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 1013 - struct iwl4965_rx_phy_res *rx_start = (include_phy) ? 1014 - (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : NULL; 1013 + struct iwl_rx_phy_res *rx_start = (include_phy) ? 1014 + (struct iwl_rx_phy_res *)&(pkt->u.raw[0]) : NULL; 1015 1015 struct ieee80211_hdr *hdr; 1016 1016 u16 len; 1017 1017 __le32 *rx_end; ··· 1020 1020 u32 ampdu_status_legacy; 1021 1021 1022 1022 if (!include_phy && priv->last_phy_res[0]) 1023 - rx_start = (struct iwl4965_rx_phy_res *)&priv->last_phy_res[1]; 1023 + rx_start = (struct iwl_rx_phy_res *)&priv->last_phy_res[1]; 1024 1024 1025 1025 if (!rx_start) { 1026 1026 IWL_ERROR("MPDU frame without a PHY data\n"); ··· 1032 1032 1033 1033 len = le16_to_cpu(rx_start->byte_count); 1034 1034 1035 - rx_end = (__le32 *) ((u8 *) &pkt->u.raw[0] + 1036 - sizeof(struct iwl4965_rx_phy_res) + 1035 + rx_end = (__le32 *)((u8 *) &pkt->u.raw[0] + 1036 + sizeof(struct iwl_rx_phy_res) + 1037 1037 rx_start->cfg_phy_cnt + len); 1038 1038 1039 1039 } else { ··· 1084 1084 } 1085 1085 1086 1086 /* Calc max signal level (dBm) among 3 possible receivers */ 1087 - static int iwl_calc_rssi(struct iwl_priv *priv, 1088 - struct iwl4965_rx_phy_res *rx_resp) 1087 + static inline int iwl_calc_rssi(struct iwl_priv *priv, 1088 + struct iwl_rx_phy_res *rx_resp) 1089 1089 { 1090 - /* data from PHY/DSP regarding signal strength, etc., 1091 - * contents are always there, not configurable by host. */ 1092 - struct iwl4965_rx_non_cfg_phy *ncphy = 1093 - (struct iwl4965_rx_non_cfg_phy *)rx_resp->non_cfg_phy; 1094 - u32 agc = (le16_to_cpu(ncphy->agc_info) & IWL_AGC_DB_MASK) 1095 - >> IWL_AGC_DB_POS; 1096 - 1097 - u32 valid_antennae = 1098 - (le16_to_cpu(rx_resp->phy_flags) & RX_PHY_FLAGS_ANTENNAE_MASK) 1099 - >> RX_PHY_FLAGS_ANTENNAE_OFFSET; 1100 - u8 max_rssi = 0; 1101 - u32 i; 1102 - 1103 - /* Find max rssi among 3 possible receivers. 1104 - * These values are measured by the digital signal processor (DSP). 1105 - * They should stay fairly constant even as the signal strength varies, 1106 - * if the radio's automatic gain control (AGC) is working right. 1107 - * AGC value (see below) will provide the "interesting" info. */ 1108 - for (i = 0; i < 3; i++) 1109 - if (valid_antennae & (1 << i)) 1110 - max_rssi = max(ncphy->rssi_info[i << 1], max_rssi); 1111 - 1112 - IWL_DEBUG_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n", 1113 - ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4], 1114 - max_rssi, agc); 1115 - 1116 - /* dBm = max_rssi dB - agc dB - constant. 1117 - * Higher AGC (higher radio gain) means lower signal. */ 1118 - return max_rssi - agc - IWL_RSSI_OFFSET; 1090 + return priv->cfg->ops->utils->calc_rssi(priv, rx_resp); 1119 1091 } 1092 + 1120 1093 1121 1094 static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) 1122 1095 { ··· 1153 1180 * this rx packet for legacy frames, 1154 1181 * or phy data cached from REPLY_RX_PHY_CMD for HT frames. */ 1155 1182 int include_phy = (pkt->hdr.cmd == REPLY_RX); 1156 - struct iwl4965_rx_phy_res *rx_start = (include_phy) ? 1157 - (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : 1158 - (struct iwl4965_rx_phy_res *)&priv->last_phy_res[1]; 1183 + struct iwl_rx_phy_res *rx_start = (include_phy) ? 1184 + (struct iwl_rx_phy_res *)&(pkt->u.raw[0]) : 1185 + (struct iwl_rx_phy_res *)&priv->last_phy_res[1]; 1159 1186 __le32 *rx_end; 1160 1187 unsigned int len = 0; 1161 1188 u16 fc; ··· 1183 1210 1184 1211 if (!include_phy) { 1185 1212 if (priv->last_phy_res[0]) 1186 - rx_start = (struct iwl4965_rx_phy_res *) 1213 + rx_start = (struct iwl_rx_phy_res *) 1187 1214 &priv->last_phy_res[1]; 1188 1215 else 1189 1216 rx_start = NULL; ··· 1200 1227 1201 1228 len = le16_to_cpu(rx_start->byte_count); 1202 1229 rx_end = (__le32 *)(pkt->u.raw + rx_start->cfg_phy_cnt + 1203 - sizeof(struct iwl4965_rx_phy_res) + len); 1230 + sizeof(struct iwl_rx_phy_res) + len); 1204 1231 } else { 1205 1232 struct iwl4965_rx_mpdu_res_start *amsdu = 1206 1233 (struct iwl4965_rx_mpdu_res_start *)pkt->u.raw; ··· 1289 1316 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 1290 1317 priv->last_phy_res[0] = 1; 1291 1318 memcpy(&priv->last_phy_res[1], &(pkt->u.raw[0]), 1292 - sizeof(struct iwl4965_rx_phy_res)); 1319 + sizeof(struct iwl_rx_phy_res)); 1293 1320 } 1294 1321 EXPORT_SYMBOL(iwl_rx_reply_rx_phy);
+1
drivers/net/wireless/iwlwifi/iwl-scan.c
··· 202 202 clear_bit(STATUS_SCAN_HW, &priv->status); 203 203 } 204 204 205 + priv->alloc_rxb_skb--; 205 206 dev_kfree_skb_any(cmd.meta.u.skb); 206 207 207 208 return ret;
+2 -2
drivers/net/wireless/iwlwifi/iwl-sta.c
··· 823 823 if (lq->sta_id == 0xFF) 824 824 lq->sta_id = IWL_AP_ID; 825 825 826 - iwl_dump_lq_cmd(priv,lq); 826 + iwl_dump_lq_cmd(priv, lq); 827 827 828 828 if (iwl_is_associated(priv) && priv->assoc_station_added) 829 829 return iwl_send_cmd(priv, &cmd); ··· 839 839 * for automatic fallback during transmission. 840 840 * 841 841 * NOTE: This sets up a default set of values. These will be replaced later 842 - * if the driver's iwl-4965-rs rate scaling algorithm is used, instead of 842 + * if the driver's iwl-agn-rs rate scaling algorithm is used, instead of 843 843 * rc80211_simple. 844 844 * 845 845 * NOTE: Run REPLY_ADD_STA command to set up station table entry, before
+59 -27
drivers/net/wireless/iwlwifi/iwl-tx.c
··· 208 208 * Free all buffers. 209 209 * 0-fill, but do not free "txq" descriptor structure. 210 210 */ 211 - static void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) 211 + static void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id) 212 212 { 213 + struct iwl_tx_queue *txq = &priv->txq[txq_id]; 213 214 struct iwl_queue *q = &txq->q; 214 215 struct pci_dev *dev = priv->pci_dev; 215 - int len; 216 + int i, slots_num, len; 216 217 217 218 if (q->n_bd == 0) 218 219 return; ··· 228 227 len += IWL_MAX_SCAN_SIZE; 229 228 230 229 /* De-alloc array of command/tx buffers */ 231 - pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); 230 + slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ? 231 + TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 232 + for (i = 0; i < slots_num; i++) 233 + kfree(txq->cmd[i]); 234 + if (txq_id == IWL_CMD_QUEUE_NUM) 235 + kfree(txq->cmd[slots_num]); 232 236 233 237 /* De-alloc circular buffer of TFDs */ 234 238 if (txq->q.n_bd) ··· 406 400 struct iwl_tx_queue *txq, 407 401 int slots_num, u32 txq_id) 408 402 { 409 - struct pci_dev *dev = priv->pci_dev; 410 - int len; 403 + int i, len; 411 404 int rc = 0; 412 405 413 406 /* ··· 417 412 * For normal Tx queues (all other queues), no super-size command 418 413 * space is needed. 419 414 */ 420 - len = sizeof(struct iwl_cmd) * slots_num; 421 - if (txq_id == IWL_CMD_QUEUE_NUM) 422 - len += IWL_MAX_SCAN_SIZE; 423 - txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd); 424 - if (!txq->cmd) 425 - return -ENOMEM; 415 + len = sizeof(struct iwl_cmd); 416 + for (i = 0; i <= slots_num; i++) { 417 + if (i == slots_num) { 418 + if (txq_id == IWL_CMD_QUEUE_NUM) 419 + len += IWL_MAX_SCAN_SIZE; 420 + else 421 + continue; 422 + } 423 + 424 + txq->cmd[i] = kmalloc(len, GFP_KERNEL | GFP_DMA); 425 + if (!txq->cmd[i]) 426 + return -ENOMEM; 427 + } 426 428 427 429 /* Alloc driver data array and TFD circular buffer */ 428 430 rc = iwl_tx_queue_alloc(priv, txq, txq_id); 429 431 if (rc) { 430 - pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); 432 + for (i = 0; i < slots_num; i++) 433 + kfree(txq->cmd[i]); 431 434 432 435 return -ENOMEM; 433 436 } ··· 464 451 465 452 /* Tx queues */ 466 453 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) 467 - iwl_tx_queue_free(priv, &priv->txq[txq_id]); 454 + iwl_tx_queue_free(priv, txq_id); 468 455 469 456 /* Keep-warm buffer */ 470 457 iwl_kw_free(priv); ··· 872 859 txq->txb[q->write_ptr].skb[0] = skb; 873 860 874 861 /* Set up first empty entry in queue's array of Tx/cmd buffers */ 875 - out_cmd = &txq->cmd[idx]; 862 + out_cmd = txq->cmd[idx]; 876 863 tx_cmd = &out_cmd->cmd.tx; 877 864 memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); 878 865 memset(tx_cmd, 0, sizeof(struct iwl_tx_cmd)); ··· 912 899 913 900 /* Physical address of this Tx command's header (not MAC header!), 914 901 * within command buffer array. */ 915 - txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl_cmd) * idx + 916 - offsetof(struct iwl_cmd, hdr); 902 + txcmd_phys = pci_map_single(priv->pci_dev, out_cmd, 903 + sizeof(struct iwl_cmd), PCI_DMA_TODEVICE); 904 + txcmd_phys += offsetof(struct iwl_cmd, hdr); 917 905 918 906 /* Add buffer containing Tx command and MAC(!) header to TFD's 919 907 * first entry */ ··· 976 962 if (ret) 977 963 return ret; 978 964 979 - if ((iwl_queue_space(q) < q->high_mark) 980 - && priv->mac80211_registered) { 965 + if ((iwl_queue_space(q) < q->high_mark) && priv->mac80211_registered) { 981 966 if (wait_write_ptr) { 982 967 spin_lock_irqsave(&priv->lock, flags); 983 968 txq->need_update = 1; 984 969 iwl_txq_update_write_ptr(priv, txq); 985 970 spin_unlock_irqrestore(&priv->lock, flags); 971 + } else { 972 + ieee80211_stop_queue(priv->hw, 973 + skb_get_queue_mapping(skb)); 986 974 } 987 - 988 - ieee80211_stop_queue(priv->hw, skb_get_queue_mapping(skb)); 989 975 } 990 976 991 977 return 0; ··· 1018 1004 u32 idx; 1019 1005 u16 fix_size; 1020 1006 dma_addr_t phys_addr; 1021 - int ret; 1007 + int len, ret; 1022 1008 unsigned long flags; 1023 1009 1024 1010 cmd->len = priv->cfg->ops->utils->get_hcmd_size(cmd->id, cmd->len); ··· 1048 1034 control_flags = (u32 *) tfd; 1049 1035 1050 1036 idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE); 1051 - out_cmd = &txq->cmd[idx]; 1037 + out_cmd = txq->cmd[idx]; 1052 1038 1053 1039 out_cmd->hdr.cmd = cmd->id; 1054 1040 memcpy(&out_cmd->meta, &cmd->meta, sizeof(cmd->meta)); ··· 1062 1048 INDEX_TO_SEQ(q->write_ptr)); 1063 1049 if (out_cmd->meta.flags & CMD_SIZE_HUGE) 1064 1050 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); 1065 - 1066 - phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + 1067 - offsetof(struct iwl_cmd, hdr); 1051 + len = (idx == TFD_CMD_SLOTS) ? 1052 + IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd); 1053 + phys_addr = pci_map_single(priv->pci_dev, out_cmd, len, 1054 + PCI_DMA_TODEVICE); 1055 + phys_addr += offsetof(struct iwl_cmd, hdr); 1068 1056 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); 1069 1057 1070 1058 IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, " ··· 1131 1115 { 1132 1116 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 1133 1117 struct iwl_queue *q = &txq->q; 1118 + struct iwl_tfd_frame *bd = &txq->bd[index]; 1119 + dma_addr_t dma_addr; 1120 + int is_odd, buf_len; 1134 1121 int nfreed = 0; 1135 1122 1136 1123 if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) { ··· 1151 1132 q->write_ptr, q->read_ptr); 1152 1133 queue_work(priv->workqueue, &priv->restart); 1153 1134 } 1135 + is_odd = (index/2) & 0x1; 1136 + if (is_odd) { 1137 + dma_addr = IWL_GET_BITS(bd->pa[index], tb2_addr_lo16) | 1138 + (IWL_GET_BITS(bd->pa[index], 1139 + tb2_addr_hi20) << 16); 1140 + buf_len = IWL_GET_BITS(bd->pa[index], tb2_len); 1141 + } else { 1142 + dma_addr = le32_to_cpu(bd->pa[index].tb1_addr); 1143 + buf_len = IWL_GET_BITS(bd->pa[index], tb1_len); 1144 + } 1145 + 1146 + pci_unmap_single(priv->pci_dev, dma_addr, buf_len, 1147 + PCI_DMA_TODEVICE); 1154 1148 nfreed++; 1155 1149 } 1156 1150 } ··· 1195 1163 BUG_ON(txq_id != IWL_CMD_QUEUE_NUM); 1196 1164 1197 1165 cmd_index = get_cmd_index(&priv->txq[IWL_CMD_QUEUE_NUM].q, index, huge); 1198 - cmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index]; 1166 + cmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index]; 1199 1167 1200 1168 /* Input error checking is done when commands are added to queue. */ 1201 1169 if (cmd->meta.flags & CMD_WANT_SKB) { ··· 1423 1391 /* For each frame attempted in aggregation, 1424 1392 * update driver's record of tx frame's status. */ 1425 1393 for (i = 0; i < agg->frame_count ; i++) { 1426 - ack = bitmap & (1 << i); 1394 + ack = bitmap & (1ULL << i); 1427 1395 successes += !!ack; 1428 1396 IWL_DEBUG_TX_REPLY("%s ON i=%d idx=%d raw=%d\n", 1429 1397 ack? "ACK":"NACK", i, (agg->start_idx + i) & 0xff,
+22 -34
drivers/net/wireless/iwlwifi/iwl3945-base.c
··· 275 275 return 0; 276 276 277 277 error: 278 - if (txq->txb) { 279 - kfree(txq->txb); 280 - txq->txb = NULL; 281 - } 278 + kfree(txq->txb); 279 + txq->txb = NULL; 282 280 283 281 return -ENOMEM; 284 282 } ··· 363 365 txq->q.n_bd, txq->bd, txq->q.dma_addr); 364 366 365 367 /* De-alloc array of per-TFD driver data */ 366 - if (txq->txb) { 367 - kfree(txq->txb); 368 - txq->txb = NULL; 369 - } 368 + kfree(txq->txb); 369 + txq->txb = NULL; 370 370 371 371 /* 0-fill queue descriptor structure */ 372 372 memset(txq, 0, sizeof(*txq)); ··· 2699 2703 2700 2704 if (!ieee80211_has_morefrags(hdr->frame_control)) { 2701 2705 txq->need_update = 1; 2702 - if (qc) { 2706 + if (qc) 2703 2707 priv->stations[sta_id].tid[tid].seq_number = seq_number; 2704 - } 2705 2708 } else { 2706 2709 wait_write_ptr = 1; 2707 2710 txq->need_update = 0; ··· 3808 3813 /* 100:1 or higher, divide by 10 and use table, 3809 3814 * add 20 dB to make up for divide by 10 */ 3810 3815 if (sig_ratio >= 100) 3811 - return (20 + (int)ratio2dB[sig_ratio/10]); 3816 + return 20 + (int)ratio2dB[sig_ratio/10]; 3812 3817 3813 3818 /* We shouldn't see this */ 3814 3819 if (sig_ratio < 1) ··· 5083 5088 * iwl3945_verify_inst_full - verify runtime uCode image in card vs. host, 5084 5089 * looking at all data. 5085 5090 */ 5086 - static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 * image, u32 len) 5091 + static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 *image, u32 len) 5087 5092 { 5088 5093 u32 val; 5089 5094 u32 save_len = len; ··· 5232 5237 val = iwl3945_read_prph(priv, BSM_WR_DWCOUNT_REG); 5233 5238 for (reg = BSM_SRAM_LOWER_BOUND; 5234 5239 reg < BSM_SRAM_LOWER_BOUND + len; 5235 - reg += sizeof(u32), image ++) { 5240 + reg += sizeof(u32), image++) { 5236 5241 val = iwl3945_read_prph(priv, reg); 5237 5242 if (val != le32_to_cpu(*image)) { 5238 5243 IWL_ERROR("BSM uCode verification failed at " ··· 6331 6336 DECLARE_MAC_BUF(mac); 6332 6337 6333 6338 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { 6334 - IWL_ERROR("%s Should not be called in AP mode\n", __FUNCTION__); 6339 + IWL_ERROR("%s Should not be called in AP mode\n", __func__); 6335 6340 return; 6336 6341 } 6337 6342 ··· 6412 6417 6413 6418 default: 6414 6419 IWL_ERROR("%s Should not be called in %d mode\n", 6415 - __FUNCTION__, priv->iw_mode); 6420 + __func__, priv->iw_mode); 6416 6421 break; 6417 6422 } 6418 6423 ··· 6588 6593 struct iwl3945_priv *priv = hw->priv; 6589 6594 6590 6595 IWL_DEBUG_MAC80211("enter\n"); 6591 - 6592 - if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { 6593 - IWL_DEBUG_MAC80211("leave - monitor\n"); 6594 - dev_kfree_skb_any(skb); 6595 - return 0; 6596 - } 6597 6596 6598 6597 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 6599 6598 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); ··· 7445 7456 struct iwl3945_priv *priv = dev_get_drvdata(d); 7446 7457 struct iwl3945_spectrum_notification measure_report; 7447 7458 u32 size = sizeof(measure_report), len = 0, ofs = 0; 7448 - u8 *data = (u8 *) & measure_report; 7459 + u8 *data = (u8 *)&measure_report; 7449 7460 unsigned long flags; 7450 7461 7451 7462 spin_lock_irqsave(&priv->lock, flags); ··· 7616 7627 else 7617 7628 p += sprintf(p, " \n"); 7618 7629 7619 - return (p - buf + 1); 7630 + return p - buf + 1; 7620 7631 7621 7632 } 7622 7633 ··· 7638 7649 struct iwl3945_priv *priv = dev_get_drvdata(d); 7639 7650 u32 size = sizeof(struct iwl3945_notif_statistics); 7640 7651 u32 len = 0, ofs = 0; 7641 - u8 *data = (u8 *) & priv->statistics; 7652 + u8 *data = (u8 *)&priv->statistics; 7642 7653 int rc = 0; 7643 7654 7644 7655 if (!iwl3945_is_alive(priv)) ··· 7992 8003 7993 8004 /* nic init */ 7994 8005 iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS, 7995 - CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); 8006 + CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); 7996 8007 7997 - iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 7998 - err = iwl3945_poll_bit(priv, CSR_GP_CNTRL, 7999 - CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 8000 - CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); 8001 - if (err < 0) { 8002 - IWL_DEBUG_INFO("Failed to init the card\n"); 8008 + iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 8009 + err = iwl3945_poll_bit(priv, CSR_GP_CNTRL, 8010 + CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 8011 + CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); 8012 + if (err < 0) { 8013 + IWL_DEBUG_INFO("Failed to init the card\n"); 8003 8014 goto out_remove_sysfs; 8004 - } 8015 + } 8005 8016 /* Read the EEPROM */ 8006 8017 err = iwl3945_eeprom_init(priv); 8007 8018 if (err) { ··· 8103 8114 iwl3945_unset_hw_setting(priv); 8104 8115 iwl3945_clear_stations_table(priv); 8105 8116 8106 - if (priv->mac80211_registered) { 8117 + if (priv->mac80211_registered) 8107 8118 ieee80211_unregister_hw(priv->hw); 8108 - } 8109 8119 8110 8120 /*netif_stop_queue(dev); */ 8111 8121 flush_workqueue(priv->workqueue);
+148 -84
drivers/net/wireless/iwlwifi/iwl4965-base.c drivers/net/wireless/iwlwifi/iwl-agn.c
··· 65 65 * NOTE: DRV_NAME is defined in iwlwifi.h for use by iwl-debug.h and printk 66 66 */ 67 67 68 - #define DRV_DESCRIPTION "Intel(R) Wireless WiFi Link 4965AGN driver for Linux" 68 + #define DRV_DESCRIPTION "Intel(R) Wireless WiFi Link AGN driver for Linux" 69 69 70 70 #ifdef CONFIG_IWLWIFI_DEBUG 71 71 #define VD "d" ··· 73 73 #define VD 74 74 #endif 75 75 76 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 76 + #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 77 77 #define VS "s" 78 78 #else 79 79 #define VS ··· 86 86 MODULE_VERSION(DRV_VERSION); 87 87 MODULE_AUTHOR(DRV_COPYRIGHT); 88 88 MODULE_LICENSE("GPL"); 89 + MODULE_ALIAS("iwl4965"); 89 90 90 91 /*************** STATION TABLE MANAGEMENT **** 91 92 * mac80211 should be examined to determine if sta_info is duplicating ··· 445 444 list_add(&frame->list, &priv->free_frames); 446 445 } 447 446 448 - unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv, 449 - struct ieee80211_hdr *hdr, 450 - const u8 *dest, int left) 447 + static unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, 448 + struct ieee80211_hdr *hdr, 449 + const u8 *dest, int left) 451 450 { 452 - 453 451 if (!iwl_is_associated(priv) || !priv->ibss_beacon || 454 452 ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && 455 453 (priv->iw_mode != IEEE80211_IF_TYPE_AP))) ··· 487 487 return IWL_RATE_6M_PLCP; 488 488 } 489 489 490 + unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, 491 + struct iwl_frame *frame, u8 rate) 492 + { 493 + struct iwl_tx_beacon_cmd *tx_beacon_cmd; 494 + unsigned int frame_size; 495 + 496 + tx_beacon_cmd = &frame->u.beacon; 497 + memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); 498 + 499 + tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id; 500 + tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 501 + 502 + frame_size = iwl_fill_beacon_frame(priv, tx_beacon_cmd->frame, 503 + iwl_bcast_addr, 504 + sizeof(frame->u) - sizeof(*tx_beacon_cmd)); 505 + 506 + BUG_ON(frame_size > MAX_MPDU_SIZE); 507 + tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); 508 + 509 + if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP)) 510 + tx_beacon_cmd->tx.rate_n_flags = 511 + iwl_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK); 512 + else 513 + tx_beacon_cmd->tx.rate_n_flags = 514 + iwl_hw_set_rate_n_flags(rate, 0); 515 + 516 + tx_beacon_cmd->tx.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK | 517 + TX_CMD_FLG_TSF_MSK | 518 + TX_CMD_FLG_STA_RATE_MSK; 519 + 520 + return sizeof(*tx_beacon_cmd) + frame_size; 521 + } 490 522 static int iwl4965_send_beacon_cmd(struct iwl_priv *priv) 491 523 { 492 524 struct iwl_frame *frame; ··· 640 608 } 641 609 642 610 #define MAX_UCODE_BEACON_INTERVAL 4096 643 - #define INTEL_CONN_LISTEN_INTERVAL __constant_cpu_to_le16(0xA) 644 611 645 612 static __le16 iwl4965_adjust_beacon_interval(u16 beacon_val) 646 613 { ··· 669 638 priv->rxon_timing.timestamp.dw[0] = 670 639 cpu_to_le32(priv->timestamp & 0xFFFFFFFF); 671 640 672 - priv->rxon_timing.listen_interval = INTEL_CONN_LISTEN_INTERVAL; 641 + priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval); 673 642 674 643 tsf = priv->timestamp; 675 644 ··· 884 853 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 885 854 } 886 855 887 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 856 + #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 888 857 889 858 #include "iwl-spectrum.h" 890 859 ··· 1088 1057 static void iwl4965_rx_spectrum_measure_notif(struct iwl_priv *priv, 1089 1058 struct iwl_rx_mem_buffer *rxb) 1090 1059 { 1091 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 1060 + #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 1092 1061 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 1093 1062 struct iwl4965_spectrum_notification *report = &(pkt->u.spectrum_notif); 1094 1063 ··· 1260 1229 queue_work(priv->workqueue, &priv->rf_kill); 1261 1230 else 1262 1231 wake_up_interruptible(&priv->wait_command_queue); 1232 + } 1233 + 1234 + int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) 1235 + { 1236 + int ret; 1237 + unsigned long flags; 1238 + 1239 + spin_lock_irqsave(&priv->lock, flags); 1240 + ret = iwl_grab_nic_access(priv); 1241 + if (ret) 1242 + goto err; 1243 + 1244 + if (src == IWL_PWR_SRC_VAUX) { 1245 + u32 val; 1246 + ret = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE, 1247 + &val); 1248 + 1249 + if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) 1250 + iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 1251 + APMG_PS_CTRL_VAL_PWR_SRC_VAUX, 1252 + ~APMG_PS_CTRL_MSK_PWR_SRC); 1253 + } else { 1254 + iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 1255 + APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, 1256 + ~APMG_PS_CTRL_MSK_PWR_SRC); 1257 + } 1258 + 1259 + iwl_release_nic_access(priv); 1260 + err: 1261 + spin_unlock_irqrestore(&priv->lock, flags); 1262 + return ret; 1263 1263 } 1264 1264 1265 1265 /** ··· 2232 2170 } 2233 2171 2234 2172 /* If platform's RF_KILL switch is NOT set to KILL */ 2235 - if (iwl_read32(priv, CSR_GP_CNTRL) & 2236 - CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) 2173 + if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) 2237 2174 clear_bit(STATUS_RF_KILL_HW, &priv->status); 2238 2175 else 2239 2176 set_bit(STATUS_RF_KILL_HW, &priv->status); 2240 2177 2241 - if (!test_bit(STATUS_IN_SUSPEND, &priv->status) && 2242 - iwl_is_rfkill(priv)) { 2178 + if (iwl_is_rfkill(priv)) { 2179 + iwl4965_enable_interrupts(priv); 2243 2180 IWL_WARNING("Radio disabled by %s RF Kill switch\n", 2244 2181 test_bit(STATUS_RF_KILL_HW, &priv->status) ? "HW" : "SW"); 2245 - return -ENODEV; 2182 + return 0; 2246 2183 } 2247 2184 2248 2185 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); ··· 2276 2215 * data SRAM for a clean start when the runtime program first loads. */ 2277 2216 memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr, 2278 2217 priv->ucode_data.len); 2279 - 2280 - /* We return success when we resume from suspend and rf_kill is on. */ 2281 - if (test_bit(STATUS_RF_KILL_HW, &priv->status) || 2282 - test_bit(STATUS_RF_KILL_SW, &priv->status)) 2283 - return 0; 2284 2218 2285 2219 for (i = 0; i < MAX_HW_RESTARTS; i++) { 2286 2220 ··· 2471 2415 unsigned long flags; 2472 2416 2473 2417 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { 2474 - IWL_ERROR("%s Should not be called in AP mode\n", __FUNCTION__); 2418 + IWL_ERROR("%s Should not be called in AP mode\n", __func__); 2475 2419 return; 2476 2420 } 2477 2421 ··· 2547 2491 2548 2492 default: 2549 2493 IWL_ERROR("%s Should not be called in %d mode\n", 2550 - __FUNCTION__, priv->iw_mode); 2494 + __func__, priv->iw_mode); 2551 2495 break; 2552 2496 } 2553 2497 ··· 2645 2589 if (ret) 2646 2590 goto out_release_irq; 2647 2591 2592 + if (iwl_is_rfkill(priv)) 2593 + goto out; 2594 + 2648 2595 IWL_DEBUG_INFO("Start UP work done.\n"); 2649 2596 2650 2597 if (test_bit(STATUS_IN_SUSPEND, &priv->status)) ··· 2667 2608 } 2668 2609 } 2669 2610 2611 + out: 2670 2612 priv->is_open = 1; 2671 2613 IWL_DEBUG_MAC80211("leave\n"); 2672 2614 return 0; ··· 2832 2772 } 2833 2773 2834 2774 spin_lock_irqsave(&priv->lock, flags); 2775 + 2835 2776 2836 2777 /* if we are switching from ht to 2.4 clear flags 2837 2778 * from any ht related info since 2.4 does not ··· 3163 3102 if (bss_conf->assoc) { 3164 3103 priv->assoc_id = bss_conf->aid; 3165 3104 priv->beacon_int = bss_conf->beacon_int; 3105 + priv->power_data.dtim_period = bss_conf->dtim_period; 3166 3106 priv->timestamp = bss_conf->timestamp; 3167 3107 priv->assoc_capability = bss_conf->assoc_capability; 3168 3108 priv->next_scan_jiffies = jiffies + ··· 3407 3345 return 0; 3408 3346 } 3409 3347 3348 + static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, 3349 + enum ieee80211_ampdu_mlme_action action, 3350 + const u8 *addr, u16 tid, u16 *ssn) 3351 + { 3352 + struct iwl_priv *priv = hw->priv; 3353 + DECLARE_MAC_BUF(mac); 3354 + 3355 + IWL_DEBUG_HT("A-MPDU action on addr %s tid %d\n", 3356 + print_mac(mac, addr), tid); 3357 + 3358 + if (!(priv->cfg->sku & IWL_SKU_N)) 3359 + return -EACCES; 3360 + 3361 + switch (action) { 3362 + case IEEE80211_AMPDU_RX_START: 3363 + IWL_DEBUG_HT("start Rx\n"); 3364 + return iwl_rx_agg_start(priv, addr, tid, *ssn); 3365 + case IEEE80211_AMPDU_RX_STOP: 3366 + IWL_DEBUG_HT("stop Rx\n"); 3367 + return iwl_rx_agg_stop(priv, addr, tid); 3368 + case IEEE80211_AMPDU_TX_START: 3369 + IWL_DEBUG_HT("start Tx\n"); 3370 + return iwl_tx_agg_start(priv, addr, tid, ssn); 3371 + case IEEE80211_AMPDU_TX_STOP: 3372 + IWL_DEBUG_HT("stop Tx\n"); 3373 + return iwl_tx_agg_stop(priv, addr, tid); 3374 + default: 3375 + IWL_DEBUG_HT("unknown\n"); 3376 + return -EINVAL; 3377 + break; 3378 + } 3379 + return 0; 3380 + } 3410 3381 static int iwl4965_mac_get_tx_stats(struct ieee80211_hw *hw, 3411 3382 struct ieee80211_tx_queue_stats *stats) 3412 3383 { ··· 3687 3592 3688 3593 static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); 3689 3594 3690 - static ssize_t show_rs_window(struct device *d, 3691 - struct device_attribute *attr, 3692 - char *buf) 3693 - { 3694 - struct iwl_priv *priv = d->driver_data; 3695 - return iwl4965_fill_rs_info(priv->hw, buf, IWL_AP_ID); 3696 - } 3697 - static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL); 3698 - 3699 3595 static ssize_t show_tx_power(struct device *d, 3700 3596 struct device_attribute *attr, char *buf) 3701 3597 { ··· 3785 3699 static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags, 3786 3700 store_filter_flags); 3787 3701 3788 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 3702 + #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 3789 3703 3790 3704 static ssize_t show_measurement(struct device *d, 3791 3705 struct device_attribute *attr, char *buf) ··· 3793 3707 struct iwl_priv *priv = dev_get_drvdata(d); 3794 3708 struct iwl4965_spectrum_notification measure_report; 3795 3709 u32 size = sizeof(measure_report), len = 0, ofs = 0; 3796 - u8 *data = (u8 *) & measure_report; 3710 + u8 *data = (u8 *)&measure_report; 3797 3711 unsigned long flags; 3798 3712 3799 3713 spin_lock_irqsave(&priv->lock, flags); ··· 3856 3770 3857 3771 static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR, 3858 3772 show_measurement, store_measurement); 3859 - #endif /* CONFIG_IWL4965_SPECTRUM_MEASUREMENT */ 3773 + #endif /* CONFIG_IWLAGN_SPECTRUM_MEASUREMENT */ 3860 3774 3861 3775 static ssize_t store_retry_rate(struct device *d, 3862 3776 struct device_attribute *attr, ··· 3886 3800 const char *buf, size_t count) 3887 3801 { 3888 3802 struct iwl_priv *priv = dev_get_drvdata(d); 3889 - int rc; 3803 + int ret; 3890 3804 int mode; 3891 3805 3892 3806 mode = simple_strtoul(buf, NULL, 0); 3893 3807 mutex_lock(&priv->mutex); 3894 3808 3895 3809 if (!iwl_is_ready(priv)) { 3896 - rc = -EAGAIN; 3810 + ret = -EAGAIN; 3897 3811 goto out; 3898 3812 } 3899 3813 3900 - rc = iwl_power_set_user_mode(priv, mode); 3901 - if (rc) { 3814 + ret = iwl_power_set_user_mode(priv, mode); 3815 + if (ret) { 3902 3816 IWL_DEBUG_MAC80211("failed setting power mode.\n"); 3903 3817 goto out; 3904 3818 } 3905 - rc = count; 3819 + ret = count; 3906 3820 3907 3821 out: 3908 3822 mutex_unlock(&priv->mutex); 3909 - return rc; 3823 + return ret; 3910 3824 } 3911 - 3912 - #define MAX_WX_STRING 80 3913 - 3914 - /* Values are in microsecond */ 3915 - static const s32 timeout_duration[] = { 3916 - 350000, 3917 - 250000, 3918 - 75000, 3919 - 37000, 3920 - 25000, 3921 - }; 3922 - static const s32 period_duration[] = { 3923 - 400000, 3924 - 700000, 3925 - 1000000, 3926 - 1000000, 3927 - 1000000 3928 - }; 3929 3825 3930 3826 static ssize_t show_power_level(struct device *d, 3931 3827 struct device_attribute *attr, char *buf) 3932 3828 { 3933 3829 struct iwl_priv *priv = dev_get_drvdata(d); 3830 + int mode = priv->power_data.user_power_setting; 3831 + int system = priv->power_data.system_power_setting; 3934 3832 int level = priv->power_data.power_mode; 3935 3833 char *p = buf; 3936 3834 3937 - p += sprintf(p, "%d ", level); 3938 - switch (level) { 3939 - case IWL_POWER_MODE_CAM: 3940 - case IWL_POWER_AC: 3941 - p += sprintf(p, "(AC)"); 3835 + switch (system) { 3836 + case IWL_POWER_SYS_AUTO: 3837 + p += sprintf(p, "SYSTEM:auto"); 3942 3838 break; 3943 - case IWL_POWER_BATTERY: 3944 - p += sprintf(p, "(BATTERY)"); 3839 + case IWL_POWER_SYS_AC: 3840 + p += sprintf(p, "SYSTEM:ac"); 3945 3841 break; 3946 - default: 3947 - p += sprintf(p, 3948 - "(Timeout %dms, Period %dms)", 3949 - timeout_duration[level - 1] / 1000, 3950 - period_duration[level - 1] / 1000); 3842 + case IWL_POWER_SYS_BATTERY: 3843 + p += sprintf(p, "SYSTEM:battery"); 3844 + break; 3951 3845 } 3952 - /* 3953 - if (!(priv->power_mode & IWL_POWER_ENABLED)) 3954 - p += sprintf(p, " OFF\n"); 3955 - else 3956 - p += sprintf(p, " \n"); 3957 - */ 3958 - p += sprintf(p, " \n"); 3959 - return (p - buf + 1); 3846 + 3847 + p += sprintf(p, "\tMODE:%s", (mode < IWL_POWER_AUTO)?"fixed":"auto"); 3848 + p += sprintf(p, "\tINDEX:%d", level); 3849 + p += sprintf(p, "\n"); 3850 + return p - buf + 1; 3960 3851 } 3961 3852 3962 3853 static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, ··· 4008 3945 struct iwl_priv *priv = dev_get_drvdata(d); 4009 3946 u32 size = sizeof(struct iwl_notif_statistics); 4010 3947 u32 len = 0, ofs = 0; 4011 - u8 *data = (u8 *) & priv->statistics; 3948 + u8 *data = (u8 *)&priv->statistics; 4012 3949 int rc = 0; 4013 3950 4014 3951 if (!iwl_is_alive(priv)) ··· 4104 4041 &dev_attr_channels.attr, 4105 4042 &dev_attr_flags.attr, 4106 4043 &dev_attr_filter_flags.attr, 4107 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 4044 + #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 4108 4045 &dev_attr_measurement.attr, 4109 4046 #endif 4110 4047 &dev_attr_power_level.attr, 4111 4048 &dev_attr_retry_rate.attr, 4112 - &dev_attr_rs_window.attr, 4113 4049 &dev_attr_statistics.attr, 4114 4050 &dev_attr_status.attr, 4115 4051 &dev_attr_temperature.attr, ··· 4456 4394 4457 4395 /* Hardware specific file defines the PCI IDs table for that hardware module */ 4458 4396 static struct pci_device_id iwl_hw_card_ids[] = { 4397 + #ifdef CONFIG_IWL4965 4459 4398 {IWL_PCI_DEVICE(0x4229, PCI_ANY_ID, iwl4965_agn_cfg)}, 4460 4399 {IWL_PCI_DEVICE(0x4230, PCI_ANY_ID, iwl4965_agn_cfg)}, 4400 + #endif /* CONFIG_IWL4965 */ 4461 4401 #ifdef CONFIG_IWL5000 4462 4402 {IWL_PCI_DEVICE(0x4232, 0x1205, iwl5100_bg_cfg)}, 4463 4403 {IWL_PCI_DEVICE(0x4232, 0x1305, iwl5100_bg_cfg)}, ··· 4495 4431 printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); 4496 4432 printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); 4497 4433 4498 - ret = iwl4965_rate_control_register(); 4434 + ret = iwlagn_rate_control_register(); 4499 4435 if (ret) { 4500 4436 IWL_ERROR("Unable to register rate control algorithm: %d\n", ret); 4501 4437 return ret; ··· 4510 4446 return ret; 4511 4447 4512 4448 error_register: 4513 - iwl4965_rate_control_unregister(); 4449 + iwlagn_rate_control_unregister(); 4514 4450 return ret; 4515 4451 } 4516 4452 4517 4453 static void __exit iwl4965_exit(void) 4518 4454 { 4519 4455 pci_unregister_driver(&iwl_driver); 4520 - iwl4965_rate_control_unregister(); 4456 + iwlagn_rate_control_unregister(); 4521 4457 } 4522 4458 4523 4459 module_exit(iwl4965_exit);
+9 -6
drivers/net/wireless/libertas/main.c
··· 297 297 lbs_add_rtap(priv); 298 298 } 299 299 priv->monitormode = monitor_mode; 300 - } 301 - 302 - else { 300 + } else { 303 301 if (!priv->monitormode) 304 302 return strlen(buf); 305 303 priv->monitormode = 0; ··· 1240 1242 lbs_pr_err("cannot register ethX device\n"); 1241 1243 goto done; 1242 1244 } 1243 - if (device_create_file(&dev->dev, &dev_attr_lbs_rtap)) 1244 - lbs_pr_err("cannot register lbs_rtap attribute\n"); 1245 1245 1246 1246 lbs_update_channel(priv); 1247 1247 ··· 1271 1275 1272 1276 if (device_create_file(&dev->dev, &dev_attr_lbs_mesh)) 1273 1277 lbs_pr_err("cannot register lbs_mesh attribute\n"); 1278 + 1279 + /* While rtap isn't related to mesh, only mesh-enabled 1280 + * firmware implements the rtap functionality via 1281 + * CMD_802_11_MONITOR_MODE. 1282 + */ 1283 + if (device_create_file(&dev->dev, &dev_attr_lbs_rtap)) 1284 + lbs_pr_err("cannot register lbs_rtap attribute\n"); 1274 1285 } 1275 1286 } 1276 1287 ··· 1309 1306 netif_carrier_off(priv->dev); 1310 1307 1311 1308 lbs_debugfs_remove_one(priv); 1312 - device_remove_file(&dev->dev, &dev_attr_lbs_rtap); 1313 1309 if (priv->mesh_tlv) { 1314 1310 device_remove_file(&dev->dev, &dev_attr_lbs_mesh); 1311 + device_remove_file(&dev->dev, &dev_attr_lbs_rtap); 1315 1312 } 1316 1313 1317 1314 /* Flush pending command nodes */
+1
drivers/net/wireless/p54/p54.h
··· 52 52 int (*open)(struct ieee80211_hw *dev); 53 53 void (*stop)(struct ieee80211_hw *dev); 54 54 int mode; 55 + struct mutex conf_mutex; 55 56 u8 mac_addr[ETH_ALEN]; 56 57 u8 bssid[ETH_ALEN]; 57 58 struct pda_iq_autocal_entry *iq_autocal;
+6
drivers/net/wireless/p54/p54common.c
··· 886 886 static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) 887 887 { 888 888 int ret; 889 + struct p54_common *priv = dev->priv; 889 890 891 + mutex_lock(&priv->conf_mutex); 890 892 ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq)); 891 893 p54_set_vdcf(dev); 894 + mutex_unlock(&priv->conf_mutex); 892 895 return ret; 893 896 } 894 897 ··· 901 898 { 902 899 struct p54_common *priv = dev->priv; 903 900 901 + mutex_lock(&priv->conf_mutex); 904 902 p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 0, 1, 0, 0xF642); 905 903 p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 2, 0, 0, 0); 906 904 p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0); 907 905 memcpy(priv->bssid, conf->bssid, ETH_ALEN); 906 + mutex_unlock(&priv->conf_mutex); 908 907 return 0; 909 908 } 910 909 ··· 1014 1009 } 1015 1010 1016 1011 p54_init_vdcf(dev); 1012 + mutex_init(&priv->conf_mutex); 1017 1013 1018 1014 return dev; 1019 1015 }
+1 -1
drivers/net/wireless/prism54/isl_ioctl.c
··· 2518 2518 2519 2519 #define PRISM2_HOSTAPD_MAX_BUF_SIZE 1024 2520 2520 #define PRISM2_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \ 2521 - ((int) (&((struct prism2_hostapd_param *) 0)->u.generic_elem.data)) 2521 + offsetof(struct prism2_hostapd_param, u.generic_elem.data) 2522 2522 2523 2523 /* Maximum length for algorithm names (-1 for nul termination) 2524 2524 * used in ioctl() */
+1
drivers/net/wireless/rt2x00/rt2500pci.c
··· 1220 1220 rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); 1221 1221 rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, 1222 1222 test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags)); 1223 + rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, skb->len); 1223 1224 rt2x00_set_field32(&word, TXD_W0_CIPHER_ALG, CIPHER_NONE); 1224 1225 rt2x00_desc_write(txd, 0, word); 1225 1226 }
+17 -3
drivers/net/wireless/rt2x00/rt2500usb.c
··· 633 633 rt2x00dev->link.vgc_level = value; 634 634 } 635 635 636 + /* 637 + * NOTE: This function is directly ported from legacy driver, but 638 + * despite it being declared it was never called. Although link tuning 639 + * sounds like a good idea, and usually works well for the other drivers, 640 + * it does _not_ work with rt2500usb. Enabling this function will result 641 + * in TX capabilities only until association kicks in. Immediately 642 + * after the successful association all TX frames will be kept in the 643 + * hardware queue and never transmitted. 644 + */ 645 + #if 0 636 646 static void rt2500usb_link_tuner(struct rt2x00_dev *rt2x00dev) 637 647 { 638 648 int rssi = rt2x00_get_link_rssi(&rt2x00dev->link); ··· 762 752 rt2x00dev->link.vgc_level = r17; 763 753 } 764 754 } 755 + #else 756 + #define rt2500usb_link_tuner NULL 757 + #endif 765 758 766 759 /* 767 760 * Initialization functions. ··· 1389 1376 rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp); 1390 1377 rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word); 1391 1378 EEPROM(rt2x00dev, "BBPtune vgc: 0x%04x\n", word); 1379 + } else { 1380 + rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp); 1381 + rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word); 1392 1382 } 1393 1383 1394 1384 rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R17, &word); ··· 1400 1384 rt2x00_set_field16(&word, EEPROM_BBPTUNE_R17_HIGH, 0x41); 1401 1385 rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_R17, word); 1402 1386 EEPROM(rt2x00dev, "BBPtune r17: 0x%04x\n", word); 1403 - } else { 1404 - rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp); 1405 - rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word); 1406 1387 } 1407 1388 1408 1389 rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R24, &word); ··· 1750 1737 __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); 1751 1738 __set_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags); 1752 1739 __set_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags); 1740 + __set_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags); 1753 1741 1754 1742 /* 1755 1743 * Set the rssi offset.
+6
drivers/net/wireless/rt2x00/rt2x00.h
··· 368 368 #define DELAYED_CONFIG_ERP 0x00000002 369 369 #define DELAYED_LED_ASSOC 0x00000004 370 370 371 + /* 372 + * Software sequence counter, this is only required 373 + * for hardware which doesn't support hardware 374 + * sequence counting. 375 + */ 376 + spinlock_t seqlock; 371 377 u16 seqno; 372 378 }; 373 379
+4
drivers/net/wireless/rt2x00/rt2x00config.c
··· 254 254 libconf.ant.rx = default_ant->rx; 255 255 else if (active_ant->rx == ANTENNA_SW_DIVERSITY) 256 256 libconf.ant.rx = ANTENNA_B; 257 + else 258 + libconf.ant.rx = active_ant->rx; 257 259 258 260 if (conf->antenna_sel_tx) 259 261 libconf.ant.tx = conf->antenna_sel_tx; ··· 263 261 libconf.ant.tx = default_ant->tx; 264 262 else if (active_ant->tx == ANTENNA_SW_DIVERSITY) 265 263 libconf.ant.tx = ANTENNA_B; 264 + else 265 + libconf.ant.tx = active_ant->tx; 266 266 } 267 267 268 268 if (flags & CONFIG_UPDATE_SLOT_TIME) {
+7 -10
drivers/net/wireless/rt2x00/rt2x00debug.c
··· 372 372 if (*offset) \ 373 373 return 0; \ 374 374 \ 375 - if (!capable(CAP_NET_ADMIN)) \ 376 - return -EPERM; \ 377 - \ 378 375 if (intf->offset_##__name >= debug->__name.word_count) \ 379 376 return -EINVAL; \ 380 377 \ ··· 451 454 data += sprintf(data, "compiled: %s %s\n", __DATE__, __TIME__); 452 455 blob->size = strlen(blob->data); 453 456 454 - return debugfs_create_blob(name, S_IRUGO, intf->driver_folder, blob); 457 + return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob); 455 458 } 456 459 457 460 static struct dentry *rt2x00debug_create_file_chipset(const char *name, ··· 479 482 data += sprintf(data, "rf length: %d\n", debug->rf.word_count); 480 483 blob->size = strlen(blob->data); 481 484 482 - return debugfs_create_blob(name, S_IRUGO, intf->driver_folder, blob); 485 + return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob); 483 486 } 484 487 485 488 void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) ··· 514 517 if (IS_ERR(intf->chipset_entry)) 515 518 goto exit; 516 519 517 - intf->dev_flags = debugfs_create_file("dev_flags", S_IRUGO, 520 + intf->dev_flags = debugfs_create_file("dev_flags", S_IRUSR, 518 521 intf->driver_folder, intf, 519 522 &rt2x00debug_fop_dev_flags); 520 523 if (IS_ERR(intf->dev_flags)) ··· 529 532 ({ \ 530 533 (__intf)->__name##_off_entry = \ 531 534 debugfs_create_u32(__stringify(__name) "_offset", \ 532 - S_IRUGO | S_IWUSR, \ 535 + S_IRUSR | S_IWUSR, \ 533 536 (__intf)->register_folder, \ 534 537 &(__intf)->offset_##__name); \ 535 538 if (IS_ERR((__intf)->__name##_off_entry)) \ ··· 537 540 \ 538 541 (__intf)->__name##_val_entry = \ 539 542 debugfs_create_file(__stringify(__name) "_value", \ 540 - S_IRUGO | S_IWUSR, \ 543 + S_IRUSR | S_IWUSR, \ 541 544 (__intf)->register_folder, \ 542 545 (__intf), &rt2x00debug_fop_##__name);\ 543 546 if (IS_ERR((__intf)->__name##_val_entry)) \ ··· 557 560 goto exit; 558 561 559 562 intf->queue_frame_dump_entry = 560 - debugfs_create_file("dump", S_IRUGO, intf->queue_folder, 563 + debugfs_create_file("dump", S_IRUSR, intf->queue_folder, 561 564 intf, &rt2x00debug_fop_queue_dump); 562 565 if (IS_ERR(intf->queue_frame_dump_entry)) 563 566 goto exit; ··· 566 569 init_waitqueue_head(&intf->frame_dump_waitqueue); 567 570 568 571 intf->queue_stats_entry = 569 - debugfs_create_file("queue", S_IRUGO, intf->queue_folder, 572 + debugfs_create_file("queue", S_IRUSR, intf->queue_folder, 570 573 intf, &rt2x00debug_fop_queue_stats); 571 574 572 575 return;
+1
drivers/net/wireless/rt2x00/rt2x00mac.c
··· 247 247 rt2x00dev->intf_sta_count++; 248 248 249 249 spin_lock_init(&intf->lock); 250 + spin_lock_init(&intf->seqlock); 250 251 intf->beacon = entry; 251 252 252 253 if (conf->type == IEEE80211_IF_TYPE_AP)
+3 -2
drivers/net/wireless/rt2x00/rt2x00queue.c
··· 128 128 unsigned int data_length; 129 129 unsigned int duration; 130 130 unsigned int residual; 131 + unsigned long irqflags; 131 132 132 133 memset(txdesc, 0, sizeof(*txdesc)); 133 134 ··· 214 213 * sequence counter given by mac80211. 215 214 */ 216 215 if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { 217 - spin_lock(&intf->lock); 216 + spin_lock_irqsave(&intf->seqlock, irqflags); 218 217 219 218 if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)) 220 219 intf->seqno += 0x10; 221 220 hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); 222 221 hdr->seq_ctrl |= cpu_to_le16(intf->seqno); 223 222 224 - spin_unlock(&intf->lock); 223 + spin_unlock_irqrestore(&intf->seqlock, irqflags); 225 224 226 225 __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); 227 226 }
+2 -2
drivers/net/wireless/rt2x00/rt2x00usb.c
··· 124 124 125 125 int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev, 126 126 const u8 request, const u8 requesttype, 127 - const u16 offset, void *buffer, 127 + const u16 offset, const void *buffer, 128 128 const u16 buffer_length, 129 129 const int timeout) 130 130 { ··· 134 134 135 135 mutex_lock(&rt2x00dev->usb_cache_mutex); 136 136 137 - tb = buffer; 137 + tb = (char *)buffer; 138 138 off = offset; 139 139 len = buffer_length; 140 140 while (len && !status) {
+1 -1
drivers/net/wireless/rt2x00/rt2x00usb.h
··· 185 185 */ 186 186 int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev, 187 187 const u8 request, const u8 requesttype, 188 - const u16 offset, void *buffer, 188 + const u16 offset, const void *buffer, 189 189 const u16 buffer_length, 190 190 const int timeout); 191 191
+5
drivers/net/wireless/rt2x00/rt61pci.c
··· 1004 1004 } 1005 1005 1006 1006 /* 1007 + * Hardware needs another millisecond before it is ready. 1008 + */ 1009 + msleep(1); 1010 + 1011 + /* 1007 1012 * Reset MAC and BBP registers. 1008 1013 */ 1009 1014 reg = 0;
+4
drivers/net/wireless/rtl8187.h
··· 94 94 const struct rtl818x_rf_ops *rf; 95 95 struct ieee80211_vif *vif; 96 96 int mode; 97 + /* The mutex protects the TX loopback state. 98 + * Any attempt to set channels concurrently locks the device. 99 + */ 100 + struct mutex conf_mutex; 97 101 98 102 /* rtl8187 specific */ 99 103 struct ieee80211_channel channels[14];
+16 -1
drivers/net/wireless/rtl8187_dev.c
··· 31 31 MODULE_LICENSE("GPL"); 32 32 33 33 static struct usb_device_id rtl8187_table[] __devinitdata = { 34 + /* Asus */ 35 + {USB_DEVICE(0x0b05, 0x171d), .driver_info = DEVICE_RTL8187}, 34 36 /* Realtek */ 35 37 {USB_DEVICE(0x0bda, 0x8187), .driver_info = DEVICE_RTL8187}, 36 38 {USB_DEVICE(0x0bda, 0x8189), .driver_info = DEVICE_RTL8187B}, ··· 728 726 if (ret) 729 727 return ret; 730 728 729 + mutex_lock(&priv->conf_mutex); 731 730 if (priv->is_rtl8187b) { 732 731 reg = RTL818X_RX_CONF_MGMT | 733 732 RTL818X_RX_CONF_DATA | ··· 750 747 (7 << 0 /* long retry limit */) | 751 748 (7 << 21 /* MAX TX DMA */)); 752 749 rtl8187_init_urbs(dev); 750 + mutex_unlock(&priv->conf_mutex); 753 751 return 0; 754 752 } 755 753 ··· 794 790 reg |= RTL818X_CMD_TX_ENABLE; 795 791 reg |= RTL818X_CMD_RX_ENABLE; 796 792 rtl818x_iowrite8(priv, &priv->map->CMD, reg); 793 + mutex_unlock(&priv->conf_mutex); 797 794 798 795 return 0; 799 796 } ··· 806 801 struct sk_buff *skb; 807 802 u32 reg; 808 803 804 + mutex_lock(&priv->conf_mutex); 809 805 rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0); 810 806 811 807 reg = rtl818x_ioread8(priv, &priv->map->CMD); ··· 826 820 usb_kill_urb(info->urb); 827 821 kfree_skb(skb); 828 822 } 829 - return; 823 + mutex_unlock(&priv->conf_mutex); 830 824 } 831 825 832 826 static int rtl8187_add_interface(struct ieee80211_hw *dev, ··· 846 840 return -EOPNOTSUPP; 847 841 } 848 842 843 + mutex_lock(&priv->conf_mutex); 849 844 priv->vif = conf->vif; 850 845 851 846 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); ··· 855 848 ((u8 *)conf->mac_addr)[i]); 856 849 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); 857 850 851 + mutex_unlock(&priv->conf_mutex); 858 852 return 0; 859 853 } 860 854 ··· 863 855 struct ieee80211_if_init_conf *conf) 864 856 { 865 857 struct rtl8187_priv *priv = dev->priv; 858 + mutex_lock(&priv->conf_mutex); 866 859 priv->mode = IEEE80211_IF_TYPE_MNTR; 867 860 priv->vif = NULL; 861 + mutex_unlock(&priv->conf_mutex); 868 862 } 869 863 870 864 static int rtl8187_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) ··· 874 864 struct rtl8187_priv *priv = dev->priv; 875 865 u32 reg; 876 866 867 + mutex_lock(&priv->conf_mutex); 877 868 reg = rtl818x_ioread32(priv, &priv->map->TX_CONF); 878 869 /* Enable TX loopback on MAC level to avoid TX during channel 879 870 * changes, as this has be seen to causes problems and the ··· 907 896 rtl818x_iowrite16(priv, &priv->map->ATIMTR_INTERVAL, 100); 908 897 rtl818x_iowrite16(priv, &priv->map->BEACON_INTERVAL, 100); 909 898 rtl818x_iowrite16(priv, &priv->map->BEACON_INTERVAL_TIME, 100); 899 + mutex_unlock(&priv->conf_mutex); 910 900 return 0; 911 901 } 912 902 ··· 919 907 int i; 920 908 u8 reg; 921 909 910 + mutex_lock(&priv->conf_mutex); 922 911 for (i = 0; i < ETH_ALEN; i++) 923 912 rtl818x_iowrite8(priv, &priv->map->BSSID[i], conf->bssid[i]); 924 913 ··· 933 920 rtl818x_iowrite8(priv, &priv->map->MSR, reg); 934 921 } 935 922 923 + mutex_unlock(&priv->conf_mutex); 936 924 return 0; 937 925 } 938 926 ··· 1201 1187 printk(KERN_ERR "rtl8187: Cannot register device\n"); 1202 1188 goto err_free_dev; 1203 1189 } 1190 + mutex_init(&priv->conf_mutex); 1204 1191 1205 1192 printk(KERN_INFO "%s: hwaddr %s, %s V%d + %s\n", 1206 1193 wiphy_name(dev->wiphy), print_mac(mac, dev->wiphy->perm_addr),
+13
include/linux/ieee80211.h
··· 506 506 u8 count; 507 507 } __attribute__ ((packed)); 508 508 509 + /** 510 + * struct ieee80211_tim 511 + * 512 + * This structure refers to "Traffic Indication Map information element" 513 + */ 514 + struct ieee80211_tim_ie { 515 + u8 dtim_count; 516 + u8 dtim_period; 517 + u8 bitmap_ctrl; 518 + /* variable size: 1 - 251 bytes */ 519 + u8 virtual_map[0]; 520 + } __attribute__ ((packed)); 521 + 509 522 struct ieee80211_mgmt { 510 523 __le16 frame_control; 511 524 __le16 duration;
+1 -3
include/linux/netdevice.h
··· 61 61 #define NET_XMIT_DROP 1 /* skb dropped */ 62 62 #define NET_XMIT_CN 2 /* congestion notification */ 63 63 #define NET_XMIT_POLICED 3 /* skb is shot by police */ 64 - #define NET_XMIT_BYPASS 4 /* packet does not leave via dequeue; 65 - (TC use only - dev_queue_xmit 66 - returns this as NET_XMIT_SUCCESS) */ 64 + #define NET_XMIT_MASK 0xFFFF /* qdisc flags in net/sch_generic.h */ 67 65 68 66 /* Backlog congestion levels */ 69 67 #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
+1 -11
include/net/dst.h
··· 252 252 /* Input packet from network to transport. */ 253 253 static inline int dst_input(struct sk_buff *skb) 254 254 { 255 - int err; 256 - 257 - for (;;) { 258 - err = skb->dst->input(skb); 259 - 260 - if (likely(err == 0)) 261 - return err; 262 - /* Oh, Jamal... Seems, I will not forgive you this mess. :-) */ 263 - if (unlikely(err != NET_XMIT_BYPASS)) 264 - return err; 265 - } 255 + return skb->dst->input(skb); 266 256 } 267 257 268 258 static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
-1
include/net/flow.h
··· 47 47 #define fl4_scope nl_u.ip4_u.scope 48 48 49 49 __u8 proto; 50 - __u8 flags; 51 50 union { 52 51 struct { 53 52 __be16 sport;
+11 -2
include/net/mac80211.h
··· 177 177 * @aid: association ID number, valid only when @assoc is true 178 178 * @use_cts_prot: use CTS protection 179 179 * @use_short_preamble: use 802.11b short preamble 180 + * @dtim_period: num of beacons before the next DTIM, for PSM 180 181 * @timestamp: beacon timestamp 181 182 * @beacon_int: beacon interval 182 - * @assoc_capability: capabbilities taken from assoc resp 183 + * @assoc_capability: capabilities taken from assoc resp 183 184 * @assoc_ht: association in HT mode 184 185 * @ht_conf: ht capabilities 185 186 * @ht_bss_conf: ht extended capabilities ··· 192 191 /* erp related data */ 193 192 bool use_cts_prot; 194 193 bool use_short_preamble; 194 + u8 dtim_period; 195 195 u16 beacon_int; 196 196 u16 assoc_capability; 197 197 u64 timestamp; ··· 432 430 * @radio_enabled: when zero, driver is required to switch off the radio. 433 431 * TODO make a flag 434 432 * @beacon_int: beacon interval (TODO make interface config) 433 + * @listen_interval: listen interval in units of beacon interval 435 434 * @flags: configuration flags defined above 436 435 * @power_level: requested transmit power (in dBm) 437 436 * @max_antenna_gain: maximum antenna gain (in dBi) ··· 447 444 int radio_enabled; 448 445 449 446 int beacon_int; 447 + u16 listen_interval; 450 448 u32 flags; 451 449 int power_level; 452 450 int max_antenna_gain; ··· 789 785 * @max_signal: Maximum value for signal (rssi) in RX information, used 790 786 * only when @IEEE80211_HW_SIGNAL_UNSPEC or @IEEE80211_HW_SIGNAL_DB 791 787 * 788 + * @max_listen_interval: max listen interval in units of beacon interval 789 + * that HW supports 790 + * 792 791 * @queues: number of available hardware transmit queues for 793 792 * data packets. WMM/QoS requires at least four, these 794 793 * queues need to have configurable access parameters. ··· 819 812 unsigned int extra_tx_headroom; 820 813 int channel_change_time; 821 814 int vif_data_size; 822 - u16 queues, ampdu_queues; 815 + u16 queues; 816 + u16 ampdu_queues; 817 + u16 max_listen_interval; 823 818 s8 max_signal; 824 819 }; 825 820
+25 -1
include/net/sch_generic.h
··· 193 193 return qdisc->dev_queue->qdisc; 194 194 } 195 195 196 + /* The qdisc root lock is a mechanism by which to top level 197 + * of a qdisc tree can be locked from any qdisc node in the 198 + * forest. This allows changing the configuration of some 199 + * aspect of the qdisc tree while blocking out asynchronous 200 + * qdisc access in the packet processing paths. 201 + * 202 + * It is only legal to do this when the root will not change 203 + * on us. Otherwise we'll potentially lock the wrong qdisc 204 + * root. This is enforced by holding the RTNL semaphore, which 205 + * all users of this lock accessor must do. 206 + */ 196 207 static inline spinlock_t *qdisc_root_lock(struct Qdisc *qdisc) 197 208 { 198 209 struct Qdisc *root = qdisc_root(qdisc); 199 210 211 + ASSERT_RTNL(); 200 212 return qdisc_lock(root); 201 213 } 202 214 ··· 343 331 return qdisc_skb_cb(skb)->pkt_len; 344 332 } 345 333 334 + /* additional qdisc xmit flags (NET_XMIT_MASK in linux/netdevice.h) */ 335 + enum net_xmit_qdisc_t { 336 + __NET_XMIT_STOLEN = 0x00010000, 337 + __NET_XMIT_BYPASS = 0x00020000, 338 + }; 339 + 340 + #ifdef CONFIG_NET_CLS_ACT 341 + #define net_xmit_drop_count(e) ((e) & __NET_XMIT_STOLEN ? 0 : 1) 342 + #else 343 + #define net_xmit_drop_count(e) (1) 344 + #endif 345 + 346 346 static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch) 347 347 { 348 348 #ifdef CONFIG_NET_SCHED ··· 367 343 static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch) 368 344 { 369 345 qdisc_skb_cb(skb)->pkt_len = skb->len; 370 - return qdisc_enqueue(skb, sch); 346 + return qdisc_enqueue(skb, sch) & NET_XMIT_MASK; 371 347 } 372 348 373 349 static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
+1 -2
include/net/sctp/structs.h
··· 524 524 */ 525 525 struct sctp_af { 526 526 int (*sctp_xmit) (struct sk_buff *skb, 527 - struct sctp_transport *, 528 - int ipfragok); 527 + struct sctp_transport *); 529 528 int (*setsockopt) (struct sock *sk, 530 529 int level, 531 530 int optname,
+4 -10
net/ax25/sysctl_net_ax25.c
··· 36 36 { .procname = "ax25", .ctl_name = NET_AX25, }, 37 37 { } 38 38 }; 39 + 39 40 static const ctl_table ax25_param_table[] = { 40 41 { 41 42 .ctl_name = NET_AX25_IP_DEFAULT_MODE, ··· 168 167 .extra1 = &min_proto, 169 168 .extra2 = &max_proto 170 169 }, 170 + #ifdef CONFIG_AX25_DAMA_SLAVE 171 171 { 172 172 .ctl_name = NET_AX25_DAMA_SLAVE_TIMEOUT, 173 173 .procname = "dama_slave_timeout", ··· 179 177 .extra1 = &min_ds_timeout, 180 178 .extra2 = &max_ds_timeout 181 179 }, 180 + #endif 181 + 182 182 { .ctl_name = 0 } /* that's all, folks! */ 183 183 }; 184 184 ··· 213 209 ax25_table[n].ctl_name = n + 1; 214 210 ax25_table[n].procname = ax25_dev->dev->name; 215 211 ax25_table[n].mode = 0555; 216 - 217 - #ifndef CONFIG_AX25_DAMA_SLAVE 218 - /* 219 - * We do not wish to have a representation of this parameter 220 - * in /proc/sys/ when configured *not* to include the 221 - * AX.25 DAMA slave code, do we? 222 - */ 223 - 224 - child[AX25_VALUES_DS_TIMEOUT].procname = NULL; 225 - #endif 226 212 227 213 child[AX25_MAX_VALUES].ctl_name = 0; /* just in case... */ 228 214
+1 -1
net/bridge/br_netfilter.c
··· 113 113 struct rtable *rt = &br->fake_rtable; 114 114 115 115 atomic_set(&rt->u.dst.__refcnt, 1); 116 - rt->u.dst.dev = &br->dev; 116 + rt->u.dst.dev = br->dev; 117 117 rt->u.dst.path = &rt->u.dst; 118 118 rt->u.dst.metrics[RTAX_MTU - 1] = 1500; 119 119 rt->u.dst.flags = DST_NOXFRM;
+18 -7
net/bridge/br_stp.c
··· 368 368 /* called under bridge lock */ 369 369 static void br_make_forwarding(struct net_bridge_port *p) 370 370 { 371 - if (p->state == BR_STATE_BLOCKING) { 372 - if (p->br->stp_enabled == BR_KERNEL_STP) 373 - p->state = BR_STATE_LISTENING; 374 - else 375 - p->state = BR_STATE_LEARNING; 371 + struct net_bridge *br = p->br; 376 372 377 - br_log_state(p); 378 - mod_timer(&p->forward_delay_timer, jiffies + p->br->forward_delay); } 373 + if (p->state != BR_STATE_BLOCKING) 374 + return; 375 + 376 + if (br->forward_delay == 0) { 377 + p->state = BR_STATE_FORWARDING; 378 + br_topology_change_detection(br); 379 + del_timer(&p->forward_delay_timer); 380 + } 381 + else if (p->br->stp_enabled == BR_KERNEL_STP) 382 + p->state = BR_STATE_LISTENING; 383 + else 384 + p->state = BR_STATE_LEARNING; 385 + 386 + br_log_state(p); 387 + 388 + if (br->forward_delay != 0) 389 + mod_timer(&p->forward_delay_timer, jiffies + br->forward_delay); 379 390 } 380 391 381 392 /* called under bridge lock */
+22 -10
net/core/dev.c
··· 1796 1796 skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_EGRESS); 1797 1797 #endif 1798 1798 if (q->enqueue) { 1799 - spinlock_t *root_lock = qdisc_root_lock(q); 1799 + spinlock_t *root_lock = qdisc_lock(q); 1800 1800 1801 1801 spin_lock(root_lock); 1802 1802 ··· 1805 1805 1806 1806 spin_unlock(root_lock); 1807 1807 1808 - rc = rc == NET_XMIT_BYPASS ? NET_XMIT_SUCCESS : rc; 1809 1808 goto out; 1810 1809 } 1811 1810 ··· 1908 1909 if (queue->input_pkt_queue.qlen <= netdev_max_backlog) { 1909 1910 if (queue->input_pkt_queue.qlen) { 1910 1911 enqueue: 1911 - dev_hold(skb->dev); 1912 1912 __skb_queue_tail(&queue->input_pkt_queue, skb); 1913 1913 local_irq_restore(flags); 1914 1914 return NET_RX_SUCCESS; ··· 1993 1995 smp_mb__before_clear_bit(); 1994 1996 clear_bit(__QDISC_STATE_SCHED, &q->state); 1995 1997 1996 - root_lock = qdisc_root_lock(q); 1998 + root_lock = qdisc_lock(q); 1997 1999 if (spin_trylock(root_lock)) { 1998 2000 qdisc_run(q); 1999 2001 spin_unlock(root_lock); ··· 2268 2270 return ret; 2269 2271 } 2270 2272 2273 + /* Network device is going away, flush any packets still pending */ 2274 + static void flush_backlog(void *arg) 2275 + { 2276 + struct net_device *dev = arg; 2277 + struct softnet_data *queue = &__get_cpu_var(softnet_data); 2278 + struct sk_buff *skb, *tmp; 2279 + 2280 + skb_queue_walk_safe(&queue->input_pkt_queue, skb, tmp) 2281 + if (skb->dev == dev) { 2282 + __skb_unlink(skb, &queue->input_pkt_queue); 2283 + kfree_skb(skb); 2284 + } 2285 + } 2286 + 2271 2287 static int process_backlog(struct napi_struct *napi, int quota) 2272 2288 { 2273 2289 int work = 0; ··· 2291 2279 napi->weight = weight_p; 2292 2280 do { 2293 2281 struct sk_buff *skb; 2294 - struct net_device *dev; 2295 2282 2296 2283 local_irq_disable(); 2297 2284 skb = __skb_dequeue(&queue->input_pkt_queue); ··· 2299 2288 local_irq_enable(); 2300 2289 break; 2301 2290 } 2302 - 2303 2291 local_irq_enable(); 2304 2292 2305 - dev = skb->dev; 2306 - 2307 2293 netif_receive_skb(skb); 2308 - 2309 - dev_put(dev); 2310 2294 } while (++work < quota && jiffies == start_time); 2311 2295 2312 2296 return work; ··· 3994 3988 } 3995 3989 } 3996 3990 3991 + /* Enable software GSO if SG is supported. */ 3992 + if (dev->features & NETIF_F_SG) 3993 + dev->features |= NETIF_F_GSO; 3994 + 3997 3995 netdev_initialize_kobject(dev); 3998 3996 ret = netdev_register_kobject(dev); 3999 3997 if (ret) ··· 4174 4164 } 4175 4165 4176 4166 dev->reg_state = NETREG_UNREGISTERED; 4167 + 4168 + on_each_cpu(flush_backlog, dev, 1); 4177 4169 4178 4170 netdev_wait_allrefs(dev); 4179 4171
+7 -6
net/core/neighbour.c
··· 2281 2281 struct neighbour *n = neigh_get_first(seq); 2282 2282 2283 2283 if (n) { 2284 + --(*pos); 2284 2285 while (*pos) { 2285 2286 n = neigh_get_next(seq, n, pos); 2286 2287 if (!n) ··· 2342 2341 struct pneigh_entry *pn = pneigh_get_first(seq); 2343 2342 2344 2343 if (pn) { 2344 + --(*pos); 2345 2345 while (*pos) { 2346 2346 pn = pneigh_get_next(seq, pn, pos); 2347 2347 if (!pn) ··· 2356 2354 { 2357 2355 struct neigh_seq_state *state = seq->private; 2358 2356 void *rc; 2357 + loff_t idxpos = *pos; 2359 2358 2360 - rc = neigh_get_idx(seq, pos); 2359 + rc = neigh_get_idx(seq, &idxpos); 2361 2360 if (!rc && !(state->flags & NEIGH_SEQ_NEIGH_ONLY)) 2362 - rc = pneigh_get_idx(seq, pos); 2361 + rc = pneigh_get_idx(seq, &idxpos); 2363 2362 2364 2363 return rc; 2365 2364 } ··· 2369 2366 __acquires(tbl->lock) 2370 2367 { 2371 2368 struct neigh_seq_state *state = seq->private; 2372 - loff_t pos_minus_one; 2373 2369 2374 2370 state->tbl = tbl; 2375 2371 state->bucket = 0; ··· 2376 2374 2377 2375 read_lock_bh(&tbl->lock); 2378 2376 2379 - pos_minus_one = *pos - 1; 2380 - return *pos ? neigh_get_idx_any(seq, &pos_minus_one) : SEQ_START_TOKEN; 2377 + return *pos ? neigh_get_idx_any(seq, pos) : SEQ_START_TOKEN; 2381 2378 } 2382 2379 EXPORT_SYMBOL(neigh_seq_start); 2383 2380 ··· 2386 2385 void *rc; 2387 2386 2388 2387 if (v == SEQ_START_TOKEN) { 2389 - rc = neigh_get_idx(seq, pos); 2388 + rc = neigh_get_first(seq); 2390 2389 goto out; 2391 2390 } 2392 2391
+7 -3
net/core/pktgen.c
··· 2085 2085 if (pkt_dev->flows[flow].count >= pkt_dev->lflow) { 2086 2086 /* reset time */ 2087 2087 pkt_dev->flows[flow].count = 0; 2088 + pkt_dev->flows[flow].flags = 0; 2088 2089 pkt_dev->curfl += 1; 2089 2090 if (pkt_dev->curfl >= pkt_dev->cflows) 2090 2091 pkt_dev->curfl = 0; /*reset */ 2091 2092 } 2092 2093 } else { 2093 2094 flow = random32() % pkt_dev->cflows; 2095 + pkt_dev->curfl = flow; 2094 2096 2095 - if (pkt_dev->flows[flow].count > pkt_dev->lflow) 2097 + if (pkt_dev->flows[flow].count > pkt_dev->lflow) { 2096 2098 pkt_dev->flows[flow].count = 0; 2099 + pkt_dev->flows[flow].flags = 0; 2100 + } 2097 2101 } 2098 2102 2099 2103 return pkt_dev->curfl; ··· 2166 2162 mc = random32() % pkt_dev->src_mac_count; 2167 2163 else { 2168 2164 mc = pkt_dev->cur_src_mac_offset++; 2169 - if (pkt_dev->cur_src_mac_offset > 2165 + if (pkt_dev->cur_src_mac_offset >= 2170 2166 pkt_dev->src_mac_count) 2171 2167 pkt_dev->cur_src_mac_offset = 0; 2172 2168 } ··· 2193 2189 2194 2190 else { 2195 2191 mc = pkt_dev->cur_dst_mac_offset++; 2196 - if (pkt_dev->cur_dst_mac_offset > 2192 + if (pkt_dev->cur_dst_mac_offset >= 2197 2193 pkt_dev->dst_mac_count) { 2198 2194 pkt_dev->cur_dst_mac_offset = 0; 2199 2195 }
+1
net/ipv4/sysctl_net_ipv4.c
··· 232 232 .mode = 0644, 233 233 .proc_handler = &ipv4_doint_and_flush, 234 234 .strategy = &ipv4_doint_and_flush_strategy, 235 + .extra2 = &init_net, 235 236 }, 236 237 { 237 238 .ctl_name = NET_IPV4_NO_PMTU_DISC,
+1 -1
net/ipv6/ip6_output.c
··· 269 269 skb->mark = sk->sk_mark; 270 270 271 271 mtu = dst_mtu(dst); 272 - if ((skb->len <= mtu) || ipfragok || skb_is_gso(skb)) { 272 + if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) { 273 273 IP6_INC_STATS(ip6_dst_idev(skb->dst), 274 274 IPSTATS_MIB_OUTREQUESTS); 275 275 return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev,
+2
net/ipv6/ipv6_sockglue.c
··· 346 346 */ 347 347 if (optlen == 0) 348 348 optval = NULL; 349 + else if (optval == NULL) 350 + goto e_inval; 349 351 else if (optlen < sizeof(struct ipv6_opt_hdr) || 350 352 optlen & 0x7 || optlen > 8 * 255) 351 353 goto e_inval;
+11 -11
net/ipv6/syncookies.c
··· 199 199 ireq6 = inet6_rsk(req); 200 200 treq = tcp_rsk(req); 201 201 202 - if (security_inet_conn_request(sk, skb, req)) { 203 - reqsk_free(req); 204 - goto out; 205 - } 202 + if (security_inet_conn_request(sk, skb, req)) 203 + goto out_free; 206 204 207 205 req->mss = mss; 208 206 ireq->rmt_port = th->source; ··· 253 255 fl.fl_ip_dport = inet_rsk(req)->rmt_port; 254 256 fl.fl_ip_sport = inet_sk(sk)->sport; 255 257 security_req_classify_flow(req, &fl); 256 - if (ip6_dst_lookup(sk, &dst, &fl)) { 257 - reqsk_free(req); 258 - goto out; 259 - } 258 + if (ip6_dst_lookup(sk, &dst, &fl)) 259 + goto out_free; 260 + 260 261 if (final_p) 261 262 ipv6_addr_copy(&fl.fl6_dst, final_p); 262 263 if ((xfrm_lookup(&dst, &fl, sk, 0)) < 0) 263 - goto out; 264 + goto out_free; 264 265 } 265 266 266 267 req->window_clamp = tp->window_clamp ? :dst_metric(dst, RTAX_WINDOW); ··· 270 273 ireq->rcv_wscale = rcv_wscale; 271 274 272 275 ret = get_cookie_sock(sk, skb, req, dst); 273 - 274 - out: return ret; 276 + out: 277 + return ret; 278 + out_free: 279 + reqsk_free(req); 280 + return NULL; 275 281 } 276 282
+2
net/mac80211/ieee80211_i.h
··· 82 82 83 83 u8 bssid[ETH_ALEN]; 84 84 u8 ssid[IEEE80211_MAX_SSID_LEN]; 85 + u8 dtim_period; 85 86 u16 capability; /* host byte order */ 86 87 enum ieee80211_band band; 87 88 int freq; ··· 587 586 struct timer_list sta_cleanup; 588 587 589 588 unsigned long queues_pending[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)]; 589 + unsigned long queues_pending_run[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)]; 590 590 struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_QUEUES]; 591 591 struct tasklet_struct tx_pending_tasklet; 592 592
+5
net/mac80211/main.c
··· 1689 1689 if (local->hw.conf.beacon_int < 10) 1690 1690 local->hw.conf.beacon_int = 100; 1691 1691 1692 + if (local->hw.max_listen_interval == 0) 1693 + local->hw.max_listen_interval = 1; 1694 + 1695 + local->hw.conf.listen_interval = local->hw.max_listen_interval; 1696 + 1692 1697 local->wstats_flags |= local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC | 1693 1698 IEEE80211_HW_SIGNAL_DB | 1694 1699 IEEE80211_HW_SIGNAL_DBM) ?
+32 -7
net/mac80211/mlme.c
··· 551 551 /* set timing information */ 552 552 sdata->bss_conf.beacon_int = bss->beacon_int; 553 553 sdata->bss_conf.timestamp = bss->timestamp; 554 + sdata->bss_conf.dtim_period = bss->dtim_period; 554 555 555 556 changed |= ieee80211_handle_bss_capability(sdata, bss); 556 557 ··· 774 773 mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, 775 774 IEEE80211_STYPE_REASSOC_REQ); 776 775 mgmt->u.reassoc_req.capab_info = cpu_to_le16(capab); 777 - mgmt->u.reassoc_req.listen_interval = cpu_to_le16(1); 776 + mgmt->u.reassoc_req.listen_interval = 777 + cpu_to_le16(local->hw.conf.listen_interval); 778 778 memcpy(mgmt->u.reassoc_req.current_ap, ifsta->prev_bssid, 779 779 ETH_ALEN); 780 780 } else { ··· 783 781 mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, 784 782 IEEE80211_STYPE_ASSOC_REQ); 785 783 mgmt->u.assoc_req.capab_info = cpu_to_le16(capab); 786 - mgmt->u.assoc_req.listen_interval = cpu_to_le16(1); 784 + mgmt->u.reassoc_req.listen_interval = 785 + cpu_to_le16(local->hw.conf.listen_interval); 787 786 } 788 787 789 788 /* SSID */ ··· 2691 2688 bss->beacon_int = le16_to_cpu(mgmt->u.beacon.beacon_int); 2692 2689 bss->capability = le16_to_cpu(mgmt->u.beacon.capab_info); 2693 2690 2691 + if (elems->tim) { 2692 + struct ieee80211_tim_ie *tim_ie = 2693 + (struct ieee80211_tim_ie *)elems->tim; 2694 + bss->dtim_period = tim_ie->dtim_period; 2695 + } 2696 + 2697 + /* set default value for buggy APs */ 2698 + if (!elems->tim || bss->dtim_period == 0) 2699 + bss->dtim_period = 1; 2700 + 2694 2701 bss->supp_rates_len = 0; 2695 2702 if (elems->supp_rates) { 2696 2703 clen = IEEE80211_MAX_SUPP_RATES - bss->supp_rates_len; ··· 3663 3650 "%s\n", print_mac(mac, bssid), 3664 3651 print_mac(mac2, ifsta->bssid)); 3665 3652 #endif /* CONFIG_MAC80211_IBSS_DEBUG */ 3666 - if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 && 3667 - (bss = ieee80211_rx_bss_get(dev, bssid, 3668 - local->hw.conf.channel->center_freq, 3669 - ifsta->ssid, ifsta->ssid_len))) { 3653 + 3654 + if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { 3670 3655 int ret; 3656 + int search_freq; 3657 + 3658 + if (ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL) 3659 + search_freq = bss->freq; 3660 + else 3661 + search_freq = local->hw.conf.channel->center_freq; 3662 + 3663 + bss = ieee80211_rx_bss_get(dev, bssid, search_freq, 3664 + ifsta->ssid, ifsta->ssid_len); 3665 + if (!bss) 3666 + goto dont_join; 3667 + 3671 3668 printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" 3672 3669 " based on configured SSID\n", 3673 3670 dev->name, print_mac(mac, bssid)); ··· 3685 3662 ieee80211_rx_bss_put(local, bss); 3686 3663 return ret; 3687 3664 } 3665 + 3666 + dont_join: 3688 3667 #ifdef CONFIG_MAC80211_IBSS_DEBUG 3689 3668 printk(KERN_DEBUG " did not try to join ibss\n"); 3690 3669 #endif /* CONFIG_MAC80211_IBSS_DEBUG */ ··· 3920 3895 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { 3921 3896 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 3922 3897 if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || 3923 - (!ifsta->state == IEEE80211_IBSS_JOINED && 3898 + (!(ifsta->state == IEEE80211_IBSS_JOINED) && 3924 3899 !ieee80211_sta_active_ibss(dev))) 3925 3900 ieee80211_sta_find_ibss(dev, ifsta); 3926 3901 }
+12 -5
net/mac80211/tx.c
··· 1060 1060 static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, 1061 1061 struct ieee80211_tx_data *tx) 1062 1062 { 1063 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1063 + struct ieee80211_tx_info *info; 1064 1064 int ret, i; 1065 1065 1066 - if (netif_subqueue_stopped(local->mdev, skb)) 1067 - return IEEE80211_TX_AGAIN; 1068 - 1069 1066 if (skb) { 1067 + if (netif_subqueue_stopped(local->mdev, skb)) 1068 + return IEEE80211_TX_AGAIN; 1069 + info = IEEE80211_SKB_CB(skb); 1070 + 1070 1071 ieee80211_dump_frame(wiphy_name(local->hw.wiphy), 1071 1072 "TX to low-level driver", skb); 1072 1073 ret = local->ops->tx(local_to_hw(local), skb); ··· 1216 1215 1217 1216 if (ret == IEEE80211_TX_FRAG_AGAIN) 1218 1217 skb = NULL; 1218 + 1219 1219 set_bit(queue, local->queues_pending); 1220 1220 smp_mb(); 1221 1221 /* ··· 1710 1708 netif_tx_lock_bh(dev); 1711 1709 for (i = 0; i < ieee80211_num_regular_queues(&local->hw); i++) { 1712 1710 /* Check that this queue is ok */ 1713 - if (__netif_subqueue_stopped(local->mdev, i)) 1711 + if (__netif_subqueue_stopped(local->mdev, i) && 1712 + !test_bit(i, local->queues_pending_run)) 1714 1713 continue; 1715 1714 1716 1715 if (!test_bit(i, local->queues_pending)) { 1716 + clear_bit(i, local->queues_pending_run); 1717 1717 ieee80211_wake_queue(&local->hw, i); 1718 1718 continue; 1719 1719 } 1720 + 1721 + clear_bit(i, local->queues_pending_run); 1722 + netif_start_subqueue(local->mdev, i); 1720 1723 1721 1724 store = &local->pending_packet[i]; 1722 1725 tx.extra_frag = store->extra_frag;
+1
net/mac80211/util.c
··· 361 361 struct ieee80211_local *local = hw_to_local(hw); 362 362 363 363 if (test_bit(queue, local->queues_pending)) { 364 + set_bit(queue, local->queues_pending_run); 364 365 tasklet_schedule(&local->tx_pending_tasklet); 365 366 } else { 366 367 netif_wake_subqueue(local->mdev, queue);
+4 -2
net/mac80211/wme.c
··· 241 241 } else { 242 242 struct netdev_queue *txq; 243 243 spinlock_t *root_lock; 244 + struct Qdisc *q; 244 245 245 246 txq = netdev_get_tx_queue(local->mdev, agg_queue); 246 - root_lock = qdisc_root_lock(txq->qdisc); 247 + q = rcu_dereference(txq->qdisc); 248 + root_lock = qdisc_lock(q); 247 249 248 250 spin_lock_bh(root_lock); 249 - qdisc_reset(txq->qdisc); 251 + qdisc_reset(q); 250 252 spin_unlock_bh(root_lock); 251 253 } 252 254 }
+39 -15
net/rfkill/rfkill-input.c
··· 109 109 static DEFINE_RFKILL_TASK(rfkill_wimax, RFKILL_TYPE_WIMAX); 110 110 static DEFINE_RFKILL_TASK(rfkill_wwan, RFKILL_TYPE_WWAN); 111 111 112 + static void rfkill_schedule_evsw_rfkillall(int state) 113 + { 114 + /* EVERY radio type. state != 0 means radios ON */ 115 + /* handle EPO (emergency power off) through shortcut */ 116 + if (state) { 117 + rfkill_schedule_set(&rfkill_wwan, 118 + RFKILL_STATE_UNBLOCKED); 119 + rfkill_schedule_set(&rfkill_wimax, 120 + RFKILL_STATE_UNBLOCKED); 121 + rfkill_schedule_set(&rfkill_uwb, 122 + RFKILL_STATE_UNBLOCKED); 123 + rfkill_schedule_set(&rfkill_bt, 124 + RFKILL_STATE_UNBLOCKED); 125 + rfkill_schedule_set(&rfkill_wlan, 126 + RFKILL_STATE_UNBLOCKED); 127 + } else 128 + rfkill_schedule_epo(); 129 + } 130 + 112 131 static void rfkill_event(struct input_handle *handle, unsigned int type, 113 132 unsigned int code, int data) 114 133 { ··· 151 132 } else if (type == EV_SW) { 152 133 switch (code) { 153 134 case SW_RFKILL_ALL: 154 - /* EVERY radio type. data != 0 means radios ON */ 155 - /* handle EPO (emergency power off) through shortcut */ 156 - if (data) { 157 - rfkill_schedule_set(&rfkill_wwan, 158 - RFKILL_STATE_UNBLOCKED); 159 - rfkill_schedule_set(&rfkill_wimax, 160 - RFKILL_STATE_UNBLOCKED); 161 - rfkill_schedule_set(&rfkill_uwb, 162 - RFKILL_STATE_UNBLOCKED); 163 - rfkill_schedule_set(&rfkill_bt, 164 - RFKILL_STATE_UNBLOCKED); 165 - rfkill_schedule_set(&rfkill_wlan, 166 - RFKILL_STATE_UNBLOCKED); 167 - } else 168 - rfkill_schedule_epo(); 135 + rfkill_schedule_evsw_rfkillall(data); 169 136 break; 170 137 default: 171 138 break; ··· 173 168 handle->handler = handler; 174 169 handle->name = "rfkill"; 175 170 171 + /* causes rfkill_start() to be called */ 176 172 error = input_register_handle(handle); 177 173 if (error) 178 174 goto err_free_handle; ··· 189 183 err_free_handle: 190 184 kfree(handle); 191 185 return error; 186 + } 187 + 188 + static void rfkill_start(struct input_handle *handle) 189 + { 190 + /* Take event_lock to guard against configuration changes, we 191 + * should be able to deal with concurrency with rfkill_event() 192 + * just fine (which event_lock will also avoid). */ 193 + spin_lock_irq(&handle->dev->event_lock); 194 + 195 + if (test_bit(EV_SW, handle->dev->evbit)) { 196 + if (test_bit(SW_RFKILL_ALL, handle->dev->swbit)) 197 + rfkill_schedule_evsw_rfkillall(test_bit(SW_RFKILL_ALL, 198 + handle->dev->sw)); 199 + /* add resync for further EV_SW events here */ 200 + } 201 + 202 + spin_unlock_irq(&handle->dev->event_lock); 192 203 } 193 204 194 205 static void rfkill_disconnect(struct input_handle *handle) ··· 248 225 .event = rfkill_event, 249 226 .connect = rfkill_connect, 250 227 .disconnect = rfkill_disconnect, 228 + .start = rfkill_start, 251 229 .name = "rfkill", 252 230 .id_table = rfkill_ids, 253 231 };
+14 -1
net/rfkill/rfkill.c
··· 105 105 #endif /* CONFIG_RFKILL_LEDS */ 106 106 } 107 107 108 + #ifdef CONFIG_RFKILL_LEDS 109 + static void rfkill_led_trigger_activate(struct led_classdev *led) 110 + { 111 + struct rfkill *rfkill = container_of(led->trigger, 112 + struct rfkill, led_trigger); 113 + 114 + rfkill_led_trigger(rfkill, rfkill->state); 115 + } 116 + #endif /* CONFIG_RFKILL_LEDS */ 117 + 108 118 static void notify_rfkill_state_change(struct rfkill *rfkill) 109 119 { 110 120 blocking_notifier_call_chain(&rfkill_notifier_list, ··· 599 589 #ifdef CONFIG_RFKILL_LEDS 600 590 int error; 601 591 602 - rfkill->led_trigger.name = rfkill->dev.bus_id; 592 + if (!rfkill->led_trigger.name) 593 + rfkill->led_trigger.name = rfkill->dev.bus_id; 594 + if (!rfkill->led_trigger.activate) 595 + rfkill->led_trigger.activate = rfkill_led_trigger_activate; 603 596 error = led_trigger_register(&rfkill->led_trigger); 604 597 if (error) 605 598 rfkill->led_trigger.name = NULL;
+8 -6
net/sched/sch_atm.c
··· 415 415 case TC_ACT_QUEUED: 416 416 case TC_ACT_STOLEN: 417 417 kfree_skb(skb); 418 - return NET_XMIT_SUCCESS; 418 + return NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; 419 419 case TC_ACT_SHOT: 420 420 kfree_skb(skb); 421 421 goto drop; ··· 432 432 ret = qdisc_enqueue(skb, flow->q); 433 433 if (ret != 0) { 434 434 drop: __maybe_unused 435 - sch->qstats.drops++; 436 - if (flow) 437 - flow->qstats.drops++; 435 + if (net_xmit_drop_count(ret)) { 436 + sch->qstats.drops++; 437 + if (flow) 438 + flow->qstats.drops++; 439 + } 438 440 return ret; 439 441 } 440 442 sch->bstats.bytes += qdisc_pkt_len(skb); ··· 457 455 return 0; 458 456 } 459 457 tasklet_schedule(&p->task); 460 - return NET_XMIT_BYPASS; 458 + return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; 461 459 } 462 460 463 461 /* ··· 532 530 if (!ret) { 533 531 sch->q.qlen++; 534 532 sch->qstats.requeues++; 535 - } else { 533 + } else if (net_xmit_drop_count(ret)) { 536 534 sch->qstats.drops++; 537 535 p->link.qstats.drops++; 538 536 }
+17 -10
net/sched/sch_cbq.c
··· 230 230 (cl = cbq_class_lookup(q, prio)) != NULL) 231 231 return cl; 232 232 233 - *qerr = NET_XMIT_BYPASS; 233 + *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; 234 234 for (;;) { 235 235 int result = 0; 236 236 defmap = head->defaults; ··· 256 256 switch (result) { 257 257 case TC_ACT_QUEUED: 258 258 case TC_ACT_STOLEN: 259 - *qerr = NET_XMIT_SUCCESS; 259 + *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; 260 260 case TC_ACT_SHOT: 261 261 return NULL; 262 262 case TC_ACT_RECLASSIFY: ··· 377 377 q->rx_class = cl; 378 378 #endif 379 379 if (cl == NULL) { 380 - if (ret == NET_XMIT_BYPASS) 380 + if (ret & __NET_XMIT_BYPASS) 381 381 sch->qstats.drops++; 382 382 kfree_skb(skb); 383 383 return ret; ··· 397 397 return ret; 398 398 } 399 399 400 - sch->qstats.drops++; 401 - cbq_mark_toplevel(q, cl); 402 - cl->qstats.drops++; 400 + if (net_xmit_drop_count(ret)) { 401 + sch->qstats.drops++; 402 + cbq_mark_toplevel(q, cl); 403 + cl->qstats.drops++; 404 + } 403 405 return ret; 404 406 } 405 407 ··· 432 430 cbq_activate_class(cl); 433 431 return 0; 434 432 } 435 - sch->qstats.drops++; 436 - cl->qstats.drops++; 433 + if (net_xmit_drop_count(ret)) { 434 + sch->qstats.drops++; 435 + cl->qstats.drops++; 436 + } 437 437 return ret; 438 438 } 439 439 ··· 668 664 q->rx_class = NULL; 669 665 670 666 if (cl && (cl = cbq_reclassify(skb, cl)) != NULL) { 667 + int ret; 671 668 672 669 cbq_mark_toplevel(q, cl); 673 670 674 671 q->rx_class = cl; 675 672 cl->q->__parent = sch; 676 673 677 - if (qdisc_enqueue(skb, cl->q) == 0) { 674 + ret = qdisc_enqueue(skb, cl->q); 675 + if (ret == NET_XMIT_SUCCESS) { 678 676 sch->q.qlen++; 679 677 sch->bstats.packets++; 680 678 sch->bstats.bytes += qdisc_pkt_len(skb); ··· 684 678 cbq_activate_class(cl); 685 679 return 0; 686 680 } 687 - sch->qstats.drops++; 681 + if (net_xmit_drop_count(ret)) 682 + sch->qstats.drops++; 688 683 return 0; 689 684 } 690 685
+6 -4
net/sched/sch_dsmark.c
··· 236 236 case TC_ACT_QUEUED: 237 237 case TC_ACT_STOLEN: 238 238 kfree_skb(skb); 239 - return NET_XMIT_SUCCESS; 239 + return NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; 240 240 241 241 case TC_ACT_SHOT: 242 242 goto drop; ··· 254 254 255 255 err = qdisc_enqueue(skb, p->q); 256 256 if (err != NET_XMIT_SUCCESS) { 257 - sch->qstats.drops++; 257 + if (net_xmit_drop_count(err)) 258 + sch->qstats.drops++; 258 259 return err; 259 260 } 260 261 ··· 268 267 drop: 269 268 kfree_skb(skb); 270 269 sch->qstats.drops++; 271 - return NET_XMIT_BYPASS; 270 + return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; 272 271 } 273 272 274 273 static struct sk_buff *dsmark_dequeue(struct Qdisc *sch) ··· 322 321 323 322 err = p->q->ops->requeue(skb, p->q); 324 323 if (err != NET_XMIT_SUCCESS) { 325 - sch->qstats.drops++; 324 + if (net_xmit_drop_count(err)) 325 + sch->qstats.drops++; 326 326 return err; 327 327 } 328 328
+6 -6
net/sched/sch_generic.c
··· 29 29 /* Main transmission queue. */ 30 30 31 31 /* Modifications to data participating in scheduling must be protected with 32 - * qdisc_root_lock(qdisc) spinlock. 32 + * qdisc_lock(qdisc) spinlock. 33 33 * 34 34 * The idea is the following: 35 35 * - enqueue, dequeue are serialized via qdisc root lock ··· 126 126 if (unlikely((skb = dequeue_skb(q)) == NULL)) 127 127 return 0; 128 128 129 - root_lock = qdisc_root_lock(q); 129 + root_lock = qdisc_lock(q); 130 130 131 131 /* And release qdisc */ 132 132 spin_unlock(root_lock); ··· 507 507 } 508 508 EXPORT_SYMBOL(qdisc_create_dflt); 509 509 510 - /* Under qdisc_root_lock(qdisc) and BH! */ 510 + /* Under qdisc_lock(qdisc) and BH! */ 511 511 512 512 void qdisc_reset(struct Qdisc *qdisc) 513 513 { ··· 543 543 kfree((char *) qdisc - qdisc->padded); 544 544 } 545 545 546 - /* Under qdisc_root_lock(qdisc) and BH! */ 546 + /* Under qdisc_lock(qdisc) and BH! */ 547 547 548 548 void qdisc_destroy(struct Qdisc *qdisc) 549 549 { ··· 659 659 660 660 dev_queue = netdev_get_tx_queue(dev, i); 661 661 q = dev_queue->qdisc; 662 - root_lock = qdisc_root_lock(q); 662 + root_lock = qdisc_lock(q); 663 663 664 664 if (lock) 665 665 spin_lock_bh(root_lock); ··· 735 735 struct Qdisc *qdisc_default = _qdisc_default; 736 736 737 737 if (qdisc) { 738 - spinlock_t *root_lock = qdisc_root_lock(qdisc); 738 + spinlock_t *root_lock = qdisc_lock(qdisc); 739 739 740 740 dev_queue->qdisc = qdisc_default; 741 741 dev_queue->qdisc_sleeping = qdisc_default;
+7 -5
net/sched/sch_hfsc.c
··· 1159 1159 if (cl->level == 0) 1160 1160 return cl; 1161 1161 1162 - *qerr = NET_XMIT_BYPASS; 1162 + *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; 1163 1163 tcf = q->root.filter_list; 1164 1164 while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) { 1165 1165 #ifdef CONFIG_NET_CLS_ACT 1166 1166 switch (result) { 1167 1167 case TC_ACT_QUEUED: 1168 1168 case TC_ACT_STOLEN: 1169 - *qerr = NET_XMIT_SUCCESS; 1169 + *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; 1170 1170 case TC_ACT_SHOT: 1171 1171 return NULL; 1172 1172 } ··· 1578 1578 1579 1579 cl = hfsc_classify(skb, sch, &err); 1580 1580 if (cl == NULL) { 1581 - if (err == NET_XMIT_BYPASS) 1581 + if (err & __NET_XMIT_BYPASS) 1582 1582 sch->qstats.drops++; 1583 1583 kfree_skb(skb); 1584 1584 return err; ··· 1586 1586 1587 1587 err = qdisc_enqueue(skb, cl->qdisc); 1588 1588 if (unlikely(err != NET_XMIT_SUCCESS)) { 1589 - cl->qstats.drops++; 1590 - sch->qstats.drops++; 1589 + if (net_xmit_drop_count(err)) { 1590 + cl->qstats.drops++; 1591 + sch->qstats.drops++; 1592 + } 1591 1593 return err; 1592 1594 } 1593 1595
+14 -10
net/sched/sch_htb.c
··· 214 214 if ((cl = htb_find(skb->priority, sch)) != NULL && cl->level == 0) 215 215 return cl; 216 216 217 - *qerr = NET_XMIT_BYPASS; 217 + *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; 218 218 tcf = q->filter_list; 219 219 while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) { 220 220 #ifdef CONFIG_NET_CLS_ACT 221 221 switch (result) { 222 222 case TC_ACT_QUEUED: 223 223 case TC_ACT_STOLEN: 224 - *qerr = NET_XMIT_SUCCESS; 224 + *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; 225 225 case TC_ACT_SHOT: 226 226 return NULL; 227 227 } ··· 567 567 } 568 568 #ifdef CONFIG_NET_CLS_ACT 569 569 } else if (!cl) { 570 - if (ret == NET_XMIT_BYPASS) 570 + if (ret & __NET_XMIT_BYPASS) 571 571 sch->qstats.drops++; 572 572 kfree_skb(skb); 573 573 return ret; 574 574 #endif 575 - } else if (qdisc_enqueue(skb, cl->un.leaf.q) != NET_XMIT_SUCCESS) { 576 - sch->qstats.drops++; 577 - cl->qstats.drops++; 575 + } else if ((ret = qdisc_enqueue(skb, cl->un.leaf.q)) != NET_XMIT_SUCCESS) { 576 + if (net_xmit_drop_count(ret)) { 577 + sch->qstats.drops++; 578 + cl->qstats.drops++; 579 + } 578 580 return NET_XMIT_DROP; 579 581 } else { 580 582 cl->bstats.packets += ··· 612 610 } 613 611 #ifdef CONFIG_NET_CLS_ACT 614 612 } else if (!cl) { 615 - if (ret == NET_XMIT_BYPASS) 613 + if (ret & __NET_XMIT_BYPASS) 616 614 sch->qstats.drops++; 617 615 kfree_skb(skb); 618 616 return ret; 619 617 #endif 620 - } else if (cl->un.leaf.q->ops->requeue(skb, cl->un.leaf.q) != 618 + } else if ((ret = cl->un.leaf.q->ops->requeue(skb, cl->un.leaf.q)) != 621 619 NET_XMIT_SUCCESS) { 622 - sch->qstats.drops++; 623 - cl->qstats.drops++; 620 + if (net_xmit_drop_count(ret)) { 621 + sch->qstats.drops++; 622 + cl->qstats.drops++; 623 + } 624 624 return NET_XMIT_DROP; 625 625 } else 626 626 htb_activate(q, cl);
+3 -2
net/sched/sch_netem.c
··· 176 176 if (count == 0) { 177 177 sch->qstats.drops++; 178 178 kfree_skb(skb); 179 - return NET_XMIT_BYPASS; 179 + return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; 180 180 } 181 181 182 182 skb_orphan(skb); ··· 240 240 sch->q.qlen++; 241 241 sch->bstats.bytes += qdisc_pkt_len(skb); 242 242 sch->bstats.packets++; 243 - } else 243 + } else if (net_xmit_drop_count(ret)) { 244 244 sch->qstats.drops++; 245 + } 245 246 246 247 pr_debug("netem: enqueue ret %d\n", ret); 247 248 return ret;
+8 -6
net/sched/sch_prio.c
··· 38 38 struct tcf_result res; 39 39 int err; 40 40 41 - *qerr = NET_XMIT_BYPASS; 41 + *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; 42 42 if (TC_H_MAJ(skb->priority) != sch->handle) { 43 43 err = tc_classify(skb, q->filter_list, &res); 44 44 #ifdef CONFIG_NET_CLS_ACT 45 45 switch (err) { 46 46 case TC_ACT_STOLEN: 47 47 case TC_ACT_QUEUED: 48 - *qerr = NET_XMIT_SUCCESS; 48 + *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; 49 49 case TC_ACT_SHOT: 50 50 return NULL; 51 51 } ··· 74 74 #ifdef CONFIG_NET_CLS_ACT 75 75 if (qdisc == NULL) { 76 76 77 - if (ret == NET_XMIT_BYPASS) 77 + if (ret & __NET_XMIT_BYPASS) 78 78 sch->qstats.drops++; 79 79 kfree_skb(skb); 80 80 return ret; ··· 88 88 sch->q.qlen++; 89 89 return NET_XMIT_SUCCESS; 90 90 } 91 - sch->qstats.drops++; 91 + if (net_xmit_drop_count(ret)) 92 + sch->qstats.drops++; 92 93 return ret; 93 94 } 94 95 ··· 103 102 qdisc = prio_classify(skb, sch, &ret); 104 103 #ifdef CONFIG_NET_CLS_ACT 105 104 if (qdisc == NULL) { 106 - if (ret == NET_XMIT_BYPASS) 105 + if (ret & __NET_XMIT_BYPASS) 107 106 sch->qstats.drops++; 108 107 kfree_skb(skb); 109 108 return ret; ··· 115 114 sch->qstats.requeues++; 116 115 return 0; 117 116 } 118 - sch->qstats.drops++; 117 + if (net_xmit_drop_count(ret)) 118 + sch->qstats.drops++; 119 119 return NET_XMIT_DROP; 120 120 } 121 121
+1 -1
net/sched/sch_red.c
··· 97 97 sch->bstats.bytes += qdisc_pkt_len(skb); 98 98 sch->bstats.packets++; 99 99 sch->q.qlen++; 100 - } else { 100 + } else if (net_xmit_drop_count(ret)) { 101 101 q->stats.pdrop++; 102 102 sch->qstats.drops++; 103 103 }
+4 -4
net/sched/sch_sfq.c
··· 171 171 if (!q->filter_list) 172 172 return sfq_hash(q, skb) + 1; 173 173 174 - *qerr = NET_XMIT_BYPASS; 174 + *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; 175 175 result = tc_classify(skb, q->filter_list, &res); 176 176 if (result >= 0) { 177 177 #ifdef CONFIG_NET_CLS_ACT 178 178 switch (result) { 179 179 case TC_ACT_STOLEN: 180 180 case TC_ACT_QUEUED: 181 - *qerr = NET_XMIT_SUCCESS; 181 + *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; 182 182 case TC_ACT_SHOT: 183 183 return 0; 184 184 } ··· 285 285 286 286 hash = sfq_classify(skb, sch, &ret); 287 287 if (hash == 0) { 288 - if (ret == NET_XMIT_BYPASS) 288 + if (ret & __NET_XMIT_BYPASS) 289 289 sch->qstats.drops++; 290 290 kfree_skb(skb); 291 291 return ret; ··· 339 339 340 340 hash = sfq_classify(skb, sch, &ret); 341 341 if (hash == 0) { 342 - if (ret == NET_XMIT_BYPASS) 342 + if (ret & __NET_XMIT_BYPASS) 343 343 sch->qstats.drops++; 344 344 kfree_skb(skb); 345 345 return ret;
+2 -1
net/sched/sch_tbf.c
··· 135 135 136 136 ret = qdisc_enqueue(skb, q->qdisc); 137 137 if (ret != 0) { 138 - sch->qstats.drops++; 138 + if (net_xmit_drop_count(ret)) 139 + sch->qstats.drops++; 139 140 return ret; 140 141 } 141 142
+5 -3
net/sctp/ipv6.c
··· 195 195 } 196 196 197 197 /* Based on tcp_v6_xmit() in tcp_ipv6.c. */ 198 - static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport, 199 - int ipfragok) 198 + static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport) 200 199 { 201 200 struct sock *sk = skb->sk; 202 201 struct ipv6_pinfo *np = inet6_sk(sk); ··· 230 231 231 232 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); 232 233 233 - return ip6_xmit(sk, skb, &fl, np->opt, ipfragok); 234 + if (!(transport->param_flags & SPP_PMTUD_ENABLE)) 235 + skb->local_df = 1; 236 + 237 + return ip6_xmit(sk, skb, &fl, np->opt, 0); 234 238 } 235 239 236 240 /* Returns the dst cache entry for the given source and destination ip
+2 -4
net/sctp/output.c
··· 586 586 SCTP_DEBUG_PRINTK("***sctp_transmit_packet*** skb len %d\n", 587 587 nskb->len); 588 588 589 - if (tp->param_flags & SPP_PMTUD_ENABLE) 590 - (*tp->af_specific->sctp_xmit)(nskb, tp, packet->ipfragok); 591 - else 592 - (*tp->af_specific->sctp_xmit)(nskb, tp, 1); 589 + nskb->local_df = packet->ipfragok; 590 + (*tp->af_specific->sctp_xmit)(nskb, tp); 593 591 594 592 out: 595 593 packet->size = packet->overhead;
+7 -2
net/sctp/protocol.c
··· 862 862 863 863 /* Wrapper routine that calls the ip transmit routine. */ 864 864 static inline int sctp_v4_xmit(struct sk_buff *skb, 865 - struct sctp_transport *transport, int ipfragok) 865 + struct sctp_transport *transport) 866 866 { 867 + struct inet_sock *inet = inet_sk(skb->sk); 868 + 867 869 SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, " 868 870 "src:%u.%u.%u.%u, dst:%u.%u.%u.%u\n", 869 871 __func__, skb, skb->len, 870 872 NIPQUAD(skb->rtable->rt_src), 871 873 NIPQUAD(skb->rtable->rt_dst)); 872 874 875 + inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ? 876 + IP_PMTUDISC_DO : IP_PMTUDISC_DONT; 877 + 873 878 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); 874 - return ip_queue_xmit(skb, ipfragok); 879 + return ip_queue_xmit(skb, 0); 875 880 } 876 881 877 882 static struct sctp_af sctp_af_inet;