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

Merge remote branch 'wireless-next/master' into ath6kl-next

+3844 -3426
+1
drivers/net/wireless/ath/ath9k/Kconfig
··· 25 25 26 26 config ATH9K_PCI 27 27 bool "Atheros ath9k PCI/PCIe bus support" 28 + default y 28 29 depends on ATH9K && PCI 29 30 ---help--- 30 31 This option enables the PCI bus support in ath9k.
+75 -65
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
··· 121 121 * if the register is per chain 122 122 */ 123 123 .noiseFloorThreshCh = {-1, 0, 0}, 124 - .ob = {1, 1, 1},/* 3 chain */ 125 - .db_stage2 = {1, 1, 1}, /* 3 chain */ 126 - .db_stage3 = {0, 0, 0}, 127 - .db_stage4 = {0, 0, 0}, 124 + .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 125 + .quick_drop = 0, 128 126 .xpaBiasLvl = 0, 129 127 .txFrameToDataStart = 0x0e, 130 128 .txFrameToPaOn = 0x0e, ··· 142 144 }, 143 145 .base_ext1 = { 144 146 .ant_div_control = 0, 145 - .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 147 + .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 146 148 }, 147 149 .calFreqPier2G = { 148 150 FREQ2FBIN(2412, 1), ··· 321 323 .spurChans = {0, 0, 0, 0, 0}, 322 324 /* noiseFloorThreshCh Check if the register is per chain */ 323 325 .noiseFloorThreshCh = {-1, 0, 0}, 324 - .ob = {3, 3, 3}, /* 3 chain */ 325 - .db_stage2 = {3, 3, 3}, /* 3 chain */ 326 - .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */ 327 - .db_stage4 = {3, 3, 3}, /* don't exist for 2G */ 326 + .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 327 + .quick_drop = 0, 328 328 .xpaBiasLvl = 0, 329 329 .txFrameToDataStart = 0x0e, 330 330 .txFrameToPaOn = 0x0e, ··· 694 698 * if the register is per chain 695 699 */ 696 700 .noiseFloorThreshCh = {-1, 0, 0}, 697 - .ob = {1, 1, 1},/* 3 chain */ 698 - .db_stage2 = {1, 1, 1}, /* 3 chain */ 699 - .db_stage3 = {0, 0, 0}, 700 - .db_stage4 = {0, 0, 0}, 701 + .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 702 + .quick_drop = 0, 701 703 .xpaBiasLvl = 0, 702 704 .txFrameToDataStart = 0x0e, 703 705 .txFrameToPaOn = 0x0e, ··· 715 721 }, 716 722 .base_ext1 = { 717 723 .ant_div_control = 0, 718 - .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 724 + .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 719 725 }, 720 726 .calFreqPier2G = { 721 727 FREQ2FBIN(2412, 1), ··· 894 900 .spurChans = {FREQ2FBIN(5500, 0), 0, 0, 0, 0}, 895 901 /* noiseFloorThreshCh Check if the register is per chain */ 896 902 .noiseFloorThreshCh = {-1, 0, 0}, 897 - .ob = {3, 3, 3}, /* 3 chain */ 898 - .db_stage2 = {3, 3, 3}, /* 3 chain */ 899 - .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */ 900 - .db_stage4 = {3, 3, 3}, /* don't exist for 2G */ 903 + .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 904 + .quick_drop = 0, 901 905 .xpaBiasLvl = 0xf, 902 906 .txFrameToDataStart = 0x0e, 903 907 .txFrameToPaOn = 0x0e, ··· 1268 1276 * if the register is per chain 1269 1277 */ 1270 1278 .noiseFloorThreshCh = {-1, 0, 0}, 1271 - .ob = {1, 1, 1},/* 3 chain */ 1272 - .db_stage2 = {1, 1, 1}, /* 3 chain */ 1273 - .db_stage3 = {0, 0, 0}, 1274 - .db_stage4 = {0, 0, 0}, 1279 + .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 1280 + .quick_drop = 0, 1275 1281 .xpaBiasLvl = 0, 1276 1282 .txFrameToDataStart = 0x0e, 1277 1283 .txFrameToPaOn = 0x0e, ··· 1281 1291 .txEndToRxOn = 0x2, 1282 1292 .txFrameToXpaOn = 0xe, 1283 1293 .thresh62 = 28, 1284 - .papdRateMaskHt20 = LE32(0x80c080), 1285 - .papdRateMaskHt40 = LE32(0x80c080), 1294 + .papdRateMaskHt20 = LE32(0x0c80c080), 1295 + .papdRateMaskHt40 = LE32(0x0080c080), 1286 1296 .futureModal = { 1287 1297 0, 0, 0, 0, 0, 0, 0, 0, 1288 1298 }, 1289 1299 }, 1290 1300 .base_ext1 = { 1291 1301 .ant_div_control = 0, 1292 - .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 1302 + .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 1293 1303 }, 1294 1304 .calFreqPier2G = { 1295 1305 FREQ2FBIN(2412, 1), 1296 1306 FREQ2FBIN(2437, 1), 1297 - FREQ2FBIN(2472, 1), 1307 + FREQ2FBIN(2462, 1), 1298 1308 }, 1299 1309 /* ar9300_cal_data_per_freq_op_loop 2g */ 1300 1310 .calPierData2G = { ··· 1304 1314 }, 1305 1315 .calTarget_freqbin_Cck = { 1306 1316 FREQ2FBIN(2412, 1), 1307 - FREQ2FBIN(2484, 1), 1317 + FREQ2FBIN(2472, 1), 1308 1318 }, 1309 1319 .calTarget_freqbin_2G = { 1310 1320 FREQ2FBIN(2412, 1), ··· 1468 1478 .spurChans = {0, 0, 0, 0, 0}, 1469 1479 /* noiseFloorThreshCh Check if the register is per chain */ 1470 1480 .noiseFloorThreshCh = {-1, 0, 0}, 1471 - .ob = {3, 3, 3}, /* 3 chain */ 1472 - .db_stage2 = {3, 3, 3}, /* 3 chain */ 1473 - .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */ 1474 - .db_stage4 = {3, 3, 3}, /* don't exist for 2G */ 1481 + .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 1482 + .quick_drop = 0, 1475 1483 .xpaBiasLvl = 0, 1476 1484 .txFrameToDataStart = 0x0e, 1477 1485 .txFrameToPaOn = 0x0e, ··· 1503 1515 FREQ2FBIN(5500, 0), 1504 1516 FREQ2FBIN(5600, 0), 1505 1517 FREQ2FBIN(5700, 0), 1506 - FREQ2FBIN(5825, 0) 1518 + FREQ2FBIN(5785, 0) 1507 1519 }, 1508 1520 .calPierData5G = { 1509 1521 { ··· 1842 1854 * if the register is per chain 1843 1855 */ 1844 1856 .noiseFloorThreshCh = {-1, 0, 0}, 1845 - .ob = {1, 1, 1},/* 3 chain */ 1846 - .db_stage2 = {1, 1, 1}, /* 3 chain */ 1847 - .db_stage3 = {0, 0, 0}, 1848 - .db_stage4 = {0, 0, 0}, 1857 + .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 1858 + .quick_drop = 0, 1849 1859 .xpaBiasLvl = 0, 1850 1860 .txFrameToDataStart = 0x0e, 1851 1861 .txFrameToPaOn = 0x0e, ··· 1863 1877 }, 1864 1878 .base_ext1 = { 1865 1879 .ant_div_control = 0, 1866 - .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 1880 + .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 1867 1881 }, 1868 1882 .calFreqPier2G = { 1869 1883 FREQ2FBIN(2412, 1), ··· 2042 2056 .spurChans = {0, 0, 0, 0, 0}, 2043 2057 /* noiseFloorThreshch check if the register is per chain */ 2044 2058 .noiseFloorThreshCh = {-1, 0, 0}, 2045 - .ob = {3, 3, 3}, /* 3 chain */ 2046 - .db_stage2 = {3, 3, 3}, /* 3 chain */ 2047 - .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */ 2048 - .db_stage4 = {3, 3, 3}, /* don't exist for 2G */ 2059 + .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 2060 + .quick_drop = 0, 2049 2061 .xpaBiasLvl = 0, 2050 2062 .txFrameToDataStart = 0x0e, 2051 2063 .txFrameToPaOn = 0x0e, ··· 2415 2431 * if the register is per chain 2416 2432 */ 2417 2433 .noiseFloorThreshCh = {-1, 0, 0}, 2418 - .ob = {1, 1, 1},/* 3 chain */ 2419 - .db_stage2 = {1, 1, 1}, /* 3 chain */ 2420 - .db_stage3 = {0, 0, 0}, 2421 - .db_stage4 = {0, 0, 0}, 2434 + .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 2435 + .quick_drop = 0, 2422 2436 .xpaBiasLvl = 0, 2423 2437 .txFrameToDataStart = 0x0e, 2424 2438 .txFrameToPaOn = 0x0e, ··· 2436 2454 }, 2437 2455 .base_ext1 = { 2438 2456 .ant_div_control = 0, 2439 - .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 2457 + .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 2440 2458 }, 2441 2459 .calFreqPier2G = { 2442 2460 FREQ2FBIN(2412, 1), 2443 2461 FREQ2FBIN(2437, 1), 2444 - FREQ2FBIN(2472, 1), 2462 + FREQ2FBIN(2462, 1), 2445 2463 }, 2446 2464 /* ar9300_cal_data_per_freq_op_loop 2g */ 2447 2465 .calPierData2G = { ··· 2615 2633 .spurChans = {0, 0, 0, 0, 0}, 2616 2634 /* noiseFloorThreshCh Check if the register is per chain */ 2617 2635 .noiseFloorThreshCh = {-1, 0, 0}, 2618 - .ob = {3, 3, 3}, /* 3 chain */ 2619 - .db_stage2 = {3, 3, 3}, /* 3 chain */ 2620 - .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */ 2621 - .db_stage4 = {3, 3, 3}, /* don't exist for 2G */ 2636 + .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 2637 + .quick_drop = 0, 2622 2638 .xpaBiasLvl = 0, 2623 2639 .txFrameToDataStart = 0x0e, 2624 2640 .txFrameToPaOn = 0x0e, ··· 2643 2663 .xatten1MarginHigh = {0, 0, 0} 2644 2664 }, 2645 2665 .calFreqPier5G = { 2646 - FREQ2FBIN(5180, 0), 2666 + FREQ2FBIN(5160, 0), 2647 2667 FREQ2FBIN(5220, 0), 2648 2668 FREQ2FBIN(5320, 0), 2649 2669 FREQ2FBIN(5400, 0), ··· 3003 3023 return eep->modalHeader5G.antennaGain; 3004 3024 case EEP_ANTENNA_GAIN_2G: 3005 3025 return eep->modalHeader2G.antennaGain; 3026 + case EEP_QUICK_DROP: 3027 + return pBase->miscConfiguration & BIT(1); 3006 3028 default: 3007 3029 return 0; 3008 3030 } ··· 3410 3428 PR_EEP("Chain0 NF Threshold", modal_hdr->noiseFloorThreshCh[0]); 3411 3429 PR_EEP("Chain1 NF Threshold", modal_hdr->noiseFloorThreshCh[1]); 3412 3430 PR_EEP("Chain2 NF Threshold", modal_hdr->noiseFloorThreshCh[2]); 3431 + PR_EEP("Quick Drop", modal_hdr->quick_drop); 3432 + PR_EEP("txEndToXpaOff", modal_hdr->txEndToXpaOff); 3413 3433 PR_EEP("xPA Bias Level", modal_hdr->xpaBiasLvl); 3414 3434 PR_EEP("txFrameToDataStart", modal_hdr->txFrameToDataStart); 3415 3435 PR_EEP("txFrameToPaOn", modal_hdr->txFrameToPaOn); 3416 3436 PR_EEP("txFrameToXpaOn", modal_hdr->txFrameToXpaOn); 3417 3437 PR_EEP("txClip", modal_hdr->txClip); 3418 3438 PR_EEP("ADC Desired size", modal_hdr->adcDesiredSize); 3419 - PR_EEP("Chain0 ob", modal_hdr->ob[0]); 3420 - PR_EEP("Chain1 ob", modal_hdr->ob[1]); 3421 - PR_EEP("Chain2 ob", modal_hdr->ob[2]); 3422 - 3423 - PR_EEP("Chain0 db_stage2", modal_hdr->db_stage2[0]); 3424 - PR_EEP("Chain1 db_stage2", modal_hdr->db_stage2[1]); 3425 - PR_EEP("Chain2 db_stage2", modal_hdr->db_stage2[2]); 3426 - PR_EEP("Chain0 db_stage3", modal_hdr->db_stage3[0]); 3427 - PR_EEP("Chain1 db_stage3", modal_hdr->db_stage3[1]); 3428 - PR_EEP("Chain2 db_stage3", modal_hdr->db_stage3[2]); 3429 - PR_EEP("Chain0 db_stage4", modal_hdr->db_stage4[0]); 3430 - PR_EEP("Chain1 db_stage4", modal_hdr->db_stage4[1]); 3431 - PR_EEP("Chain2 db_stage4", modal_hdr->db_stage4[2]); 3432 3439 3433 3440 return len; 3434 3441 } ··· 3474 3503 PR_EEP("Internal regulator", !!(pBase->featureEnable & BIT(4))); 3475 3504 PR_EEP("Enable Paprd", !!(pBase->featureEnable & BIT(5))); 3476 3505 PR_EEP("Driver Strength", !!(pBase->miscConfiguration & BIT(0))); 3506 + PR_EEP("Quick Drop", !!(pBase->miscConfiguration & BIT(1))); 3477 3507 PR_EEP("Chain mask Reduce", (pBase->miscConfiguration >> 0x3) & 0x1); 3478 3508 PR_EEP("Write enable Gpio", pBase->eepromWriteEnableGpio); 3479 3509 PR_EEP("WLAN Disable Gpio", pBase->wlanDisableGpio); ··· 3937 3965 } 3938 3966 } 3939 3967 3968 + static void ar9003_hw_quick_drop_apply(struct ath_hw *ah, u16 freq) 3969 + { 3970 + struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; 3971 + int quick_drop = ath9k_hw_ar9300_get_eeprom(ah, EEP_QUICK_DROP); 3972 + s32 t[3], f[3] = {5180, 5500, 5785}; 3973 + 3974 + if (!quick_drop) 3975 + return; 3976 + 3977 + if (freq < 4000) 3978 + quick_drop = eep->modalHeader2G.quick_drop; 3979 + else { 3980 + t[0] = eep->base_ext1.quick_drop_low; 3981 + t[1] = eep->modalHeader5G.quick_drop; 3982 + t[2] = eep->base_ext1.quick_drop_high; 3983 + quick_drop = ar9003_hw_power_interpolate(freq, f, t, 3); 3984 + } 3985 + REG_RMW_FIELD(ah, AR_PHY_AGC, AR_PHY_AGC_QUICK_DROP, quick_drop); 3986 + } 3987 + 3988 + static void ar9003_hw_txend_to_xpa_off_apply(struct ath_hw *ah, u16 freq) 3989 + { 3990 + struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; 3991 + u32 value; 3992 + 3993 + value = (freq < 4000) ? eep->modalHeader2G.txEndToXpaOff : 3994 + eep->modalHeader5G.txEndToXpaOff; 3995 + 3996 + REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL, 3997 + AR_PHY_XPA_TIMING_CTL_TX_END_XPAB_OFF, value); 3998 + REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL, 3999 + AR_PHY_XPA_TIMING_CTL_TX_END_XPAA_OFF, value); 4000 + } 4001 + 3940 4002 static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah, 3941 4003 struct ath9k_channel *chan) 3942 4004 { ··· 3978 3972 ar9003_hw_ant_ctrl_apply(ah, IS_CHAN_2GHZ(chan)); 3979 3973 ar9003_hw_drive_strength_apply(ah); 3980 3974 ar9003_hw_atten_apply(ah, chan); 3975 + ar9003_hw_quick_drop_apply(ah, chan->channel); 3981 3976 if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah)) 3982 3977 ar9003_hw_internal_regulator_apply(ah); 3983 3978 if (AR_SREV_9485(ah) || AR_SREV_9330(ah) || AR_SREV_9340(ah)) 3984 3979 ar9003_hw_apply_tuning_caps(ah); 3980 + ar9003_hw_txend_to_xpa_off_apply(ah, chan->channel); 3985 3981 } 3986 3982 3987 3983 static void ath9k_hw_ar9300_set_addac(struct ath_hw *ah, ··· 5058 5050 if (targetPowerValT2[i] > regulatory->max_power_level) 5059 5051 regulatory->max_power_level = targetPowerValT2[i]; 5060 5052 } 5053 + 5054 + ath9k_hw_update_regulatory_maxpower(ah); 5061 5055 5062 5056 if (test) 5063 5057 return;
+5 -5
drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
··· 216 216 u8 spurChans[AR_EEPROM_MODAL_SPURS]; 217 217 /* 3 Check if the register is per chain */ 218 218 int8_t noiseFloorThreshCh[AR9300_MAX_CHAINS]; 219 - u8 ob[AR9300_MAX_CHAINS]; 220 - u8 db_stage2[AR9300_MAX_CHAINS]; 221 - u8 db_stage3[AR9300_MAX_CHAINS]; 222 - u8 db_stage4[AR9300_MAX_CHAINS]; 219 + u8 reserved[11]; 220 + int8_t quick_drop; 223 221 u8 xpaBiasLvl; 224 222 u8 txFrameToDataStart; 225 223 u8 txFrameToPaOn; ··· 267 269 268 270 struct ar9300_BaseExtension_1 { 269 271 u8 ant_div_control; 270 - u8 future[13]; 272 + u8 future[11]; 273 + int8_t quick_drop_low; 274 + int8_t quick_drop_high; 271 275 } __packed; 272 276 273 277 struct ar9300_BaseExtension_2 {
+2
drivers/net/wireless/ath/ath9k/ar9003_phy.h
··· 389 389 #define AR_PHY_DAG_CTRLCCK_RSSI_THR_S 10 390 390 391 391 #define AR_PHY_RIFS_INIT_DELAY 0x3ff0000 392 + #define AR_PHY_AGC_QUICK_DROP 0x03c00000 393 + #define AR_PHY_AGC_QUICK_DROP_S 22 392 394 #define AR_PHY_AGC_COARSE_LOW 0x00007F80 393 395 #define AR_PHY_AGC_COARSE_LOW_S 7 394 396 #define AR_PHY_AGC_COARSE_HIGH 0x003F8000
+58 -45
drivers/net/wireless/ath/ath9k/btcoex.c
··· 35 35 bool bt_hold_rx_clear; 36 36 }; 37 37 38 + static const u32 ar9003_wlan_weights[ATH_BTCOEX_STOMP_MAX] 39 + [AR9300_NUM_WLAN_WEIGHTS] = { 40 + { 0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0 }, /* STOMP_ALL */ 41 + { 0x88888880, 0x88888880, 0x88888880, 0x88888880 }, /* STOMP_LOW */ 42 + { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* STOMP_NONE */ 43 + }; 44 + 45 + static const u32 ar9462_wlan_weights[ATH_BTCOEX_STOMP_MAX] 46 + [AR9300_NUM_WLAN_WEIGHTS] = { 47 + { 0x01017d01, 0x41414101, 0x41414101, 0x41414141 }, /* STOMP_ALL */ 48 + { 0x01017d01, 0x3b3b3b01, 0x3b3b3b01, 0x3b3b3b3b }, /* STOMP_LOW */ 49 + { 0x01017d01, 0x01010101, 0x01010101, 0x01010101 }, /* STOMP_NONE */ 50 + { 0x01017d01, 0x013b0101, 0x3b3b0101, 0x3b3b013b }, /* STOMP_LOW_FTP */ 51 + }; 38 52 39 53 void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum) 40 54 { ··· 165 151 166 152 static void ath9k_hw_btcoex_enable_3wire(struct ath_hw *ah) 167 153 { 168 - struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 154 + struct ath_btcoex_hw *btcoex = &ah->btcoex_hw; 169 155 u32 val; 156 + int i; 170 157 171 158 /* 172 159 * Program coex mode and weight registers to 173 160 * enable coex 3-wire 174 161 */ 175 - REG_WRITE(ah, AR_BT_COEX_MODE, btcoex_hw->bt_coex_mode); 176 - REG_WRITE(ah, AR_BT_COEX_MODE2, btcoex_hw->bt_coex_mode2); 162 + REG_WRITE(ah, AR_BT_COEX_MODE, btcoex->bt_coex_mode); 163 + REG_WRITE(ah, AR_BT_COEX_MODE2, btcoex->bt_coex_mode2); 177 164 178 165 179 166 if (AR_SREV_9300_20_OR_LATER(ah)) { 180 - REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS0, ah->bt_coex_wlan_weight[0]); 181 - REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS1, ah->bt_coex_wlan_weight[1]); 182 - REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS0, ah->bt_coex_bt_weight[0]); 183 - REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS1, ah->bt_coex_bt_weight[1]); 184 - REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS2, ah->bt_coex_bt_weight[2]); 185 - REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS3, ah->bt_coex_bt_weight[3]); 186 - 167 + REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS0, btcoex->wlan_weight[0]); 168 + REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS1, btcoex->wlan_weight[1]); 169 + for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) 170 + REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS(i), 171 + btcoex->bt_weight[i]); 187 172 } else 188 - REG_WRITE(ah, AR_BT_COEX_WEIGHT, btcoex_hw->bt_coex_weights); 173 + REG_WRITE(ah, AR_BT_COEX_WEIGHT, btcoex->bt_coex_weights); 189 174 190 175 191 176 ··· 197 184 REG_RMW_FIELD(ah, AR_QUIET1, AR_QUIET1_QUIET_ACK_CTS_ENABLE, 1); 198 185 REG_RMW_FIELD(ah, AR_PCU_MISC, AR_PCU_BT_ANT_PREVENT_RX, 0); 199 186 200 - ath9k_hw_cfg_output(ah, btcoex_hw->wlanactive_gpio, 187 + ath9k_hw_cfg_output(ah, btcoex->wlanactive_gpio, 201 188 AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL); 189 + } 190 + 191 + static void ath9k_hw_btcoex_enable_mci(struct ath_hw *ah) 192 + { 193 + struct ath_btcoex_hw *btcoex = &ah->btcoex_hw; 194 + int i; 195 + 196 + for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) 197 + REG_WRITE(ah, AR_MCI_COEX_WL_WEIGHTS(i), 198 + btcoex->wlan_weight[i]); 199 + 200 + REG_RMW_FIELD(ah, AR_QUIET1, AR_QUIET1_QUIET_ACK_CTS_ENABLE, 1); 201 + btcoex->enabled = true; 202 202 } 203 203 204 204 void ath9k_hw_btcoex_enable(struct ath_hw *ah) ··· 227 201 case ATH_BTCOEX_CFG_3WIRE: 228 202 ath9k_hw_btcoex_enable_3wire(ah); 229 203 break; 204 + case ATH_BTCOEX_CFG_MCI: 205 + ath9k_hw_btcoex_enable_mci(ah); 206 + return; 230 207 } 231 208 232 209 REG_RMW(ah, AR_GPIO_PDPU, ··· 243 214 void ath9k_hw_btcoex_disable(struct ath_hw *ah) 244 215 { 245 216 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 217 + int i; 246 218 219 + btcoex_hw->enabled = false; 220 + if (btcoex_hw->scheme == ATH_BTCOEX_CFG_MCI) { 221 + ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); 222 + for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) 223 + REG_WRITE(ah, AR_MCI_COEX_WL_WEIGHTS(i), 224 + btcoex_hw->wlan_weight[i]); 225 + } 247 226 ath9k_hw_set_gpio(ah, btcoex_hw->wlanactive_gpio, 0); 248 227 249 228 ath9k_hw_cfg_output(ah, btcoex_hw->wlanactive_gpio, ··· 264 227 if (AR_SREV_9300_20_OR_LATER(ah)) { 265 228 REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS0, 0); 266 229 REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS1, 0); 267 - REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS0, 0); 268 - REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS1, 0); 269 - REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS2, 0); 270 - REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS3, 0); 230 + for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) 231 + REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS(i), 0); 271 232 } else 272 233 REG_WRITE(ah, AR_BT_COEX_WEIGHT, 0); 273 234 274 235 } 275 - 276 - ah->btcoex_hw.enabled = false; 277 236 } 278 237 EXPORT_SYMBOL(ath9k_hw_btcoex_disable); 279 238 280 239 static void ar9003_btcoex_bt_stomp(struct ath_hw *ah, 281 240 enum ath_stomp_type stomp_type) 282 241 { 283 - ah->bt_coex_bt_weight[0] = AR9300_BT_WGHT; 284 - ah->bt_coex_bt_weight[1] = AR9300_BT_WGHT; 285 - ah->bt_coex_bt_weight[2] = AR9300_BT_WGHT; 286 - ah->bt_coex_bt_weight[3] = AR9300_BT_WGHT; 242 + struct ath_btcoex_hw *btcoex = &ah->btcoex_hw; 243 + const u32 *weight = AR_SREV_9462(ah) ? ar9003_wlan_weights[stomp_type] : 244 + ar9462_wlan_weights[stomp_type]; 245 + int i; 287 246 288 - 289 - switch (stomp_type) { 290 - case ATH_BTCOEX_STOMP_ALL: 291 - ah->bt_coex_wlan_weight[0] = AR9300_STOMP_ALL_WLAN_WGHT0; 292 - ah->bt_coex_wlan_weight[1] = AR9300_STOMP_ALL_WLAN_WGHT1; 293 - break; 294 - case ATH_BTCOEX_STOMP_LOW: 295 - ah->bt_coex_wlan_weight[0] = AR9300_STOMP_LOW_WLAN_WGHT0; 296 - ah->bt_coex_wlan_weight[1] = AR9300_STOMP_LOW_WLAN_WGHT1; 297 - break; 298 - case ATH_BTCOEX_STOMP_NONE: 299 - ah->bt_coex_wlan_weight[0] = AR9300_STOMP_NONE_WLAN_WGHT0; 300 - ah->bt_coex_wlan_weight[1] = AR9300_STOMP_NONE_WLAN_WGHT1; 301 - break; 302 - 303 - default: 304 - ath_dbg(ath9k_hw_common(ah), ATH_DBG_BTCOEX, 305 - "Invalid Stomptype\n"); 306 - break; 247 + for (i = 0; i < AR9300_NUM_WLAN_WEIGHTS; i++) { 248 + btcoex->bt_weight[i] = AR9300_BT_WGHT; 249 + btcoex->wlan_weight[i] = weight[i]; 307 250 } 308 - 309 - ath9k_hw_btcoex_enable(ah); 310 251 } 311 252 312 253 /* ··· 316 301 "Invalid Stomptype\n"); 317 302 break; 318 303 } 319 - 320 - ath9k_hw_btcoex_enable(ah); 321 304 } 322 305 EXPORT_SYMBOL(ath9k_hw_btcoex_bt_stomp);
+8 -2
drivers/net/wireless/ath/ath9k/btcoex.h
··· 36 36 #define ATH_BT_CNT_THRESHOLD 3 37 37 #define ATH_BT_CNT_SCAN_THRESHOLD 15 38 38 39 + #define AR9300_NUM_BT_WEIGHTS 4 40 + #define AR9300_NUM_WLAN_WEIGHTS 4 39 41 /* Defines the BT AR_BT_COEX_WGHT used */ 40 42 enum ath_stomp_type { 41 - ATH_BTCOEX_NO_STOMP, 42 43 ATH_BTCOEX_STOMP_ALL, 43 44 ATH_BTCOEX_STOMP_LOW, 44 - ATH_BTCOEX_STOMP_NONE 45 + ATH_BTCOEX_STOMP_NONE, 46 + ATH_BTCOEX_STOMP_LOW_FTP, 47 + ATH_BTCOEX_STOMP_MAX 45 48 }; 46 49 47 50 enum ath_btcoex_scheme { 48 51 ATH_BTCOEX_CFG_NONE, 49 52 ATH_BTCOEX_CFG_2WIRE, 50 53 ATH_BTCOEX_CFG_3WIRE, 54 + ATH_BTCOEX_CFG_MCI, 51 55 }; 52 56 53 57 struct ath_btcoex_hw { ··· 63 59 u32 bt_coex_mode; /* Register setting for AR_BT_COEX_MODE */ 64 60 u32 bt_coex_weights; /* Register setting for AR_BT_COEX_WEIGHT */ 65 61 u32 bt_coex_mode2; /* Register setting for AR_BT_COEX_MODE2 */ 62 + u32 bt_weight[AR9300_NUM_BT_WEIGHTS]; 63 + u32 wlan_weight[AR9300_NUM_WLAN_WEIGHTS]; 66 64 }; 67 65 68 66 void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah);
+2 -1
drivers/net/wireless/ath/ath9k/eeprom.h
··· 249 249 EEP_ANT_DIV_CTL1, 250 250 EEP_CHAIN_MASK_REDUCE, 251 251 EEP_ANTENNA_GAIN_2G, 252 - EEP_ANTENNA_GAIN_5G 252 + EEP_ANTENNA_GAIN_5G, 253 + EEP_QUICK_DROP 253 254 }; 254 255 255 256 enum ar5416_rates {
+2
drivers/net/wireless/ath/ath9k/gpio.c
··· 198 198 ath9k_hw_btcoex_bt_stomp(ah, is_btscan ? ATH_BTCOEX_STOMP_ALL : 199 199 btcoex->bt_stomp_type); 200 200 201 + ath9k_hw_btcoex_enable(ah); 201 202 spin_unlock_bh(&btcoex->btcoex_lock); 202 203 203 204 if (btcoex->btcoex_period != btcoex->btcoex_no_stomp) { ··· 241 240 else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) 242 241 ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_LOW); 243 242 243 + ath9k_hw_btcoex_enable(ah); 244 244 spin_unlock_bh(&btcoex->btcoex_lock); 245 245 ath9k_ps_restore(sc); 246 246 }
+2
drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
··· 80 80 ath9k_hw_btcoex_bt_stomp(priv->ah, is_btscan ? ATH_BTCOEX_STOMP_ALL : 81 81 btcoex->bt_stomp_type); 82 82 83 + ath9k_hw_btcoex_enable(priv->ah); 83 84 timer_period = is_btscan ? btcoex->btscan_no_stomp : 84 85 btcoex->btcoex_no_stomp; 85 86 ieee80211_queue_delayed_work(priv->hw, &priv->duty_cycle_work, ··· 109 108 ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); 110 109 else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) 111 110 ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_LOW); 111 + ath9k_hw_btcoex_enable(priv->ah); 112 112 } 113 113 114 114 void ath_htc_init_btcoex_work(struct ath9k_htc_priv *priv)
-5
drivers/net/wireless/ath/ath9k/hw.h
··· 59 59 #define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa 60 60 #define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab 61 61 62 - #define AR9300_NUM_BT_WEIGHTS 4 63 - #define AR9300_NUM_WLAN_WEIGHTS 4 64 - 65 62 #define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1) 66 63 67 64 #define ATH_DEFAULT_NOISE_FLOOR -95 ··· 799 802 800 803 /* Bluetooth coexistance */ 801 804 struct ath_btcoex_hw btcoex_hw; 802 - u32 bt_coex_bt_weight[AR9300_NUM_BT_WEIGHTS]; 803 - u32 bt_coex_wlan_weight[AR9300_NUM_WLAN_WEIGHTS]; 804 805 805 806 u32 intr_txqs; 806 807 u8 txchainmask;
+3 -12
drivers/net/wireless/ath/ath9k/reg.h
··· 1752 1752 1753 1753 #define AR_BT_COEX_WL_WEIGHTS0 0x8174 1754 1754 #define AR_BT_COEX_WL_WEIGHTS1 0x81c4 1755 + #define AR_MCI_COEX_WL_WEIGHTS(_i) (0x18b0 + (_i << 2)) 1756 + #define AR_BT_COEX_BT_WEIGHTS(_i) (0x83ac + (_i << 2)) 1755 1757 1756 - #define AR_BT_COEX_BT_WEIGHTS0 0x83ac 1757 - #define AR_BT_COEX_BT_WEIGHTS1 0x83b0 1758 - #define AR_BT_COEX_BT_WEIGHTS2 0x83b4 1759 - #define AR_BT_COEX_BT_WEIGHTS3 0x83b8 1760 - 1761 - #define AR9300_BT_WGHT 0xcccc4444 1762 - #define AR9300_STOMP_ALL_WLAN_WGHT0 0xfffffff0 1763 - #define AR9300_STOMP_ALL_WLAN_WGHT1 0xfffffff0 1764 - #define AR9300_STOMP_LOW_WLAN_WGHT0 0x88888880 1765 - #define AR9300_STOMP_LOW_WLAN_WGHT1 0x88888880 1766 - #define AR9300_STOMP_NONE_WLAN_WGHT0 0x00000000 1767 - #define AR9300_STOMP_NONE_WLAN_WGHT1 0x00000000 1758 + #define AR9300_BT_WGHT 0xcccc4444 1768 1759 1769 1760 #define AR_BT_COEX_MODE2 0x817c 1770 1761 #define AR_BT_BCN_MISS_THRESH 0x000000ff
+31 -46
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
··· 687 687 return -EBADE; 688 688 } 689 689 690 - if (pendok && ((bus->ci->c_inf[1].id == PCMCIA_CORE_ID) 691 - && (bus->ci->c_inf[1].rev == 9))) { 692 - u32 dummy, retries; 693 - r_sdreg32(bus, &dummy, 694 - offsetof(struct sdpcmd_regs, clockctlstatus), 695 - &retries); 696 - } 697 - 698 690 /* Check current status */ 699 691 clkctl = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1, 700 692 SBSDIO_FUNC1_CHIPCLKCSR, &err); ··· 903 911 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 904 912 SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL); 905 913 906 - /* Force pad isolation off if possible 907 - (in case power never toggled) */ 908 - if ((bus->ci->c_inf[1].id == PCMCIA_CORE_ID) 909 - && (bus->ci->c_inf[1].rev >= 10)) 910 - brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 911 - SBSDIO_DEVICE_CTL, 0, NULL); 912 - 913 914 /* Make sure the controller has the bus up */ 914 915 brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); 915 916 ··· 1092 1107 return ret; 1093 1108 } 1094 1109 1110 + /* return total length of buffer chain */ 1111 + static uint brcmf_sdbrcm_glom_len(struct brcmf_bus *bus) 1112 + { 1113 + struct sk_buff *p; 1114 + uint total; 1115 + 1116 + total = 0; 1117 + skb_queue_walk(&bus->glom, p) 1118 + total += p->len; 1119 + return total; 1120 + } 1121 + 1122 + static void brcmf_sdbrcm_free_glom(struct brcmf_bus *bus) 1123 + { 1124 + struct sk_buff *cur, *next; 1125 + 1126 + skb_queue_walk_safe(&bus->glom, cur, next) { 1127 + skb_unlink(cur, &bus->glom); 1128 + brcmu_pkt_buf_free_skb(cur); 1129 + } 1130 + } 1131 + 1095 1132 static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq) 1096 1133 { 1097 1134 u16 dlen, totlen; ··· 1198 1191 } 1199 1192 pfirst = pnext = NULL; 1200 1193 } else { 1201 - if (!skb_queue_empty(&bus->glom)) 1202 - skb_queue_walk_safe(&bus->glom, pfirst, pnext) { 1203 - skb_unlink(pfirst, &bus->glom); 1204 - brcmu_pkt_buf_free_skb(pfirst); 1205 - } 1194 + brcmf_sdbrcm_free_glom(bus); 1206 1195 num = 0; 1207 1196 } 1208 1197 ··· 1221 1218 } 1222 1219 1223 1220 pfirst = skb_peek(&bus->glom); 1224 - dlen = (u16) brcmu_pkttotlen(pfirst); 1221 + dlen = (u16) brcmf_sdbrcm_glom_len(bus); 1225 1222 1226 1223 /* Do an SDIO read for the superframe. Configurable iovar to 1227 1224 * read directly into the chained packet, or allocate a large ··· 1265 1262 bus->glomerr = 0; 1266 1263 brcmf_sdbrcm_rxfail(bus, true, false); 1267 1264 bus->rxglomfail++; 1268 - skb_queue_walk_safe(&bus->glom, pfirst, pnext) { 1269 - skb_unlink(pfirst, &bus->glom); 1270 - brcmu_pkt_buf_free_skb(pfirst); 1271 - } 1265 + brcmf_sdbrcm_free_glom(bus); 1272 1266 } 1273 1267 return 0; 1274 1268 } ··· 1387 1387 bus->glomerr = 0; 1388 1388 brcmf_sdbrcm_rxfail(bus, true, false); 1389 1389 bus->rxglomfail++; 1390 - skb_queue_walk_safe(&bus->glom, pfirst, pnext) { 1391 - skb_unlink(pfirst, &bus->glom); 1392 - brcmu_pkt_buf_free_skb(pfirst); 1393 - } 1390 + brcmf_sdbrcm_free_glom(bus); 1394 1391 } 1395 1392 bus->nextlen = 0; 1396 1393 return 0; ··· 3095 3098 { 3096 3099 uint retries; 3097 3100 int bcmerror = 0; 3098 - u8 idx; 3099 3101 struct chip_info *ci = bus->ci; 3100 3102 3101 3103 /* To enter download state, disable ARM and reset SOCRAM. ··· 3103 3107 if (enter) { 3104 3108 bus->alp_only = true; 3105 3109 3106 - idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_ARM_CM3); 3107 - brcmf_sdio_chip_coredisable(bus->sdiodev, ci->c_inf[idx].base); 3110 + ci->coredisable(bus->sdiodev, ci, BCMA_CORE_ARM_CM3); 3108 3111 3109 - idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_INTERNAL_MEM); 3110 - brcmf_sdio_chip_resetcore(bus->sdiodev, ci->c_inf[idx].base); 3112 + ci->resetcore(bus->sdiodev, ci, BCMA_CORE_INTERNAL_MEM); 3111 3113 3112 3114 /* Clear the top bit of memory */ 3113 3115 if (bus->ramsize) { ··· 3114 3120 (u8 *)&zeros, 4); 3115 3121 } 3116 3122 } else { 3117 - idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_INTERNAL_MEM); 3118 - if (!brcmf_sdio_chip_iscoreup(bus->sdiodev, 3119 - ci->c_inf[idx].base)) { 3123 + if (!ci->iscoreup(bus->sdiodev, ci, BCMA_CORE_INTERNAL_MEM)) { 3120 3124 brcmf_dbg(ERROR, "SOCRAM core is down after reset?\n"); 3121 3125 bcmerror = -EBADE; 3122 3126 goto fail; ··· 3129 3137 w_sdreg32(bus, 0xFFFFFFFF, 3130 3138 offsetof(struct sdpcmd_regs, intstatus), &retries); 3131 3139 3132 - idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_ARM_CM3); 3133 - brcmf_sdio_chip_resetcore(bus->sdiodev, ci->c_inf[idx].base); 3140 + ci->resetcore(bus->sdiodev, ci, BCMA_CORE_ARM_CM3); 3134 3141 3135 3142 /* Allow HT Clock now that the ARM is running. */ 3136 3143 bus->alp_only = false; ··· 3354 3363 u8 saveclk; 3355 3364 uint retries; 3356 3365 int err; 3357 - struct sk_buff *cur; 3358 - struct sk_buff *next; 3359 3366 3360 3367 brcmf_dbg(TRACE, "Enter\n"); 3361 3368 ··· 3413 3424 /* Clear any held glomming stuff */ 3414 3425 if (bus->glomd) 3415 3426 brcmu_pkt_buf_free_skb(bus->glomd); 3416 - if (!skb_queue_empty(&bus->glom)) 3417 - skb_queue_walk_safe(&bus->glom, cur, next) { 3418 - skb_unlink(cur, &bus->glom); 3419 - brcmu_pkt_buf_free_skb(cur); 3420 - } 3427 + brcmf_sdbrcm_free_glom(bus); 3421 3428 3422 3429 /* Clear rx control and wake any waiters */ 3423 3430 bus->rxlen = 0;
+184 -50
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
··· 45 45 ((((sbidh) & SSB_IDHIGH_RCHI) >> SSB_IDHIGH_RCHI_SHIFT) | \ 46 46 ((sbidh) & SSB_IDHIGH_RCLO)) 47 47 48 + /* SOC Interconnect types (aka chip types) */ 49 + #define SOCI_SB 0 50 + #define SOCI_AI 1 51 + 52 + /* EROM CompIdentB */ 53 + #define CIB_REV_MASK 0xff000000 54 + #define CIB_REV_SHIFT 24 55 + 48 56 #define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu)) 49 57 /* SDIO Pad drive strength to select value mappings */ 50 58 struct sdiod_drive_str { ··· 104 96 } 105 97 106 98 static u32 107 - brcmf_sdio_chip_corerev(struct brcmf_sdio_dev *sdiodev, 108 - u32 corebase) 99 + brcmf_sdio_sb_corerev(struct brcmf_sdio_dev *sdiodev, 100 + struct chip_info *ci, u16 coreid) 109 101 { 110 102 u32 regdata; 103 + u8 idx; 104 + 105 + idx = brcmf_sdio_chip_getinfidx(ci, coreid); 111 106 112 107 regdata = brcmf_sdcard_reg_read(sdiodev, 113 - CORE_SB(corebase, sbidhigh), 4); 108 + CORE_SB(ci->c_inf[idx].base, sbidhigh), 4); 114 109 return SBCOREREV(regdata); 115 110 } 116 111 117 - bool 118 - brcmf_sdio_chip_iscoreup(struct brcmf_sdio_dev *sdiodev, 119 - u32 corebase) 112 + static u32 113 + brcmf_sdio_ai_corerev(struct brcmf_sdio_dev *sdiodev, 114 + struct chip_info *ci, u16 coreid) 115 + { 116 + u8 idx; 117 + 118 + idx = brcmf_sdio_chip_getinfidx(ci, coreid); 119 + 120 + return (ci->c_inf[idx].cib & CIB_REV_MASK) >> CIB_REV_SHIFT; 121 + } 122 + 123 + static bool 124 + brcmf_sdio_sb_iscoreup(struct brcmf_sdio_dev *sdiodev, 125 + struct chip_info *ci, u16 coreid) 120 126 { 121 127 u32 regdata; 128 + u8 idx; 129 + 130 + idx = brcmf_sdio_chip_getinfidx(ci, coreid); 122 131 123 132 regdata = brcmf_sdcard_reg_read(sdiodev, 124 - CORE_SB(corebase, sbtmstatelow), 4); 133 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4); 125 134 regdata &= (SSB_TMSLOW_RESET | SSB_TMSLOW_REJECT | 126 135 SSB_IMSTATE_REJECT | SSB_TMSLOW_CLOCK); 127 136 return (SSB_TMSLOW_CLOCK == regdata); 128 137 } 129 138 130 - void 131 - brcmf_sdio_chip_coredisable(struct brcmf_sdio_dev *sdiodev, u32 corebase) 139 + static bool 140 + brcmf_sdio_ai_iscoreup(struct brcmf_sdio_dev *sdiodev, 141 + struct chip_info *ci, u16 coreid) 132 142 { 133 143 u32 regdata; 144 + u8 idx; 145 + bool ret; 146 + 147 + idx = brcmf_sdio_chip_getinfidx(ci, coreid); 134 148 135 149 regdata = brcmf_sdcard_reg_read(sdiodev, 136 - CORE_SB(corebase, sbtmstatelow), 4); 150 + ci->c_inf[idx].wrapbase+BCMA_IOCTL, 4); 151 + ret = (regdata & (BCMA_IOCTL_FGC | BCMA_IOCTL_CLK)) == BCMA_IOCTL_CLK; 152 + 153 + regdata = brcmf_sdcard_reg_read(sdiodev, 154 + ci->c_inf[idx].wrapbase+BCMA_RESET_CTL, 155 + 4); 156 + ret = ret && ((regdata & BCMA_RESET_CTL_RESET) == 0); 157 + 158 + return ret; 159 + } 160 + 161 + static void 162 + brcmf_sdio_sb_coredisable(struct brcmf_sdio_dev *sdiodev, 163 + struct chip_info *ci, u16 coreid) 164 + { 165 + u32 regdata; 166 + u8 idx; 167 + 168 + idx = brcmf_sdio_chip_getinfidx(ci, coreid); 169 + 170 + regdata = brcmf_sdcard_reg_read(sdiodev, 171 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4); 137 172 if (regdata & SSB_TMSLOW_RESET) 138 173 return; 139 174 140 175 regdata = brcmf_sdcard_reg_read(sdiodev, 141 - CORE_SB(corebase, sbtmstatelow), 4); 176 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4); 142 177 if ((regdata & SSB_TMSLOW_CLOCK) != 0) { 143 178 /* 144 179 * set target reject and spin until busy is clear 145 180 * (preserve core-specific bits) 146 181 */ 147 182 regdata = brcmf_sdcard_reg_read(sdiodev, 148 - CORE_SB(corebase, sbtmstatelow), 4); 149 - brcmf_sdcard_reg_write(sdiodev, CORE_SB(corebase, sbtmstatelow), 150 - 4, regdata | SSB_TMSLOW_REJECT); 183 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4); 184 + brcmf_sdcard_reg_write(sdiodev, 185 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 186 + 4, regdata | SSB_TMSLOW_REJECT); 151 187 152 188 regdata = brcmf_sdcard_reg_read(sdiodev, 153 - CORE_SB(corebase, sbtmstatelow), 4); 189 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4); 154 190 udelay(1); 155 191 SPINWAIT((brcmf_sdcard_reg_read(sdiodev, 156 - CORE_SB(corebase, sbtmstatehigh), 4) & 192 + CORE_SB(ci->c_inf[idx].base, sbtmstatehigh), 4) & 157 193 SSB_TMSHIGH_BUSY), 100000); 158 194 159 195 regdata = brcmf_sdcard_reg_read(sdiodev, 160 - CORE_SB(corebase, sbtmstatehigh), 4); 196 + CORE_SB(ci->c_inf[idx].base, sbtmstatehigh), 4); 161 197 if (regdata & SSB_TMSHIGH_BUSY) 162 198 brcmf_dbg(ERROR, "core state still busy\n"); 163 199 164 200 regdata = brcmf_sdcard_reg_read(sdiodev, 165 - CORE_SB(corebase, sbidlow), 4); 201 + CORE_SB(ci->c_inf[idx].base, sbidlow), 4); 166 202 if (regdata & SSB_IDLOW_INITIATOR) { 167 203 regdata = brcmf_sdcard_reg_read(sdiodev, 168 - CORE_SB(corebase, sbimstate), 4) | 204 + CORE_SB(ci->c_inf[idx].base, sbimstate), 4) | 169 205 SSB_IMSTATE_REJECT; 170 206 brcmf_sdcard_reg_write(sdiodev, 171 - CORE_SB(corebase, sbimstate), 4, 207 + CORE_SB(ci->c_inf[idx].base, sbimstate), 4, 172 208 regdata); 173 209 regdata = brcmf_sdcard_reg_read(sdiodev, 174 - CORE_SB(corebase, sbimstate), 4); 210 + CORE_SB(ci->c_inf[idx].base, sbimstate), 4); 175 211 udelay(1); 176 212 SPINWAIT((brcmf_sdcard_reg_read(sdiodev, 177 - CORE_SB(corebase, sbimstate), 4) & 213 + CORE_SB(ci->c_inf[idx].base, sbimstate), 4) & 178 214 SSB_IMSTATE_BUSY), 100000); 179 215 } 180 216 181 217 /* set reset and reject while enabling the clocks */ 182 218 brcmf_sdcard_reg_write(sdiodev, 183 - CORE_SB(corebase, sbtmstatelow), 4, 219 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4, 184 220 (SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK | 185 221 SSB_TMSLOW_REJECT | SSB_TMSLOW_RESET)); 186 222 regdata = brcmf_sdcard_reg_read(sdiodev, 187 - CORE_SB(corebase, sbtmstatelow), 4); 223 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4); 188 224 udelay(10); 189 225 190 226 /* clear the initiator reject bit */ 191 227 regdata = brcmf_sdcard_reg_read(sdiodev, 192 - CORE_SB(corebase, sbidlow), 4); 228 + CORE_SB(ci->c_inf[idx].base, sbidlow), 4); 193 229 if (regdata & SSB_IDLOW_INITIATOR) { 194 230 regdata = brcmf_sdcard_reg_read(sdiodev, 195 - CORE_SB(corebase, sbimstate), 4) & 231 + CORE_SB(ci->c_inf[idx].base, sbimstate), 4) & 196 232 ~SSB_IMSTATE_REJECT; 197 233 brcmf_sdcard_reg_write(sdiodev, 198 - CORE_SB(corebase, sbimstate), 4, 234 + CORE_SB(ci->c_inf[idx].base, sbimstate), 4, 199 235 regdata); 200 236 } 201 237 } 202 238 203 239 /* leave reset and reject asserted */ 204 - brcmf_sdcard_reg_write(sdiodev, CORE_SB(corebase, sbtmstatelow), 4, 240 + brcmf_sdcard_reg_write(sdiodev, 241 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4, 205 242 (SSB_TMSLOW_REJECT | SSB_TMSLOW_RESET)); 206 243 udelay(1); 207 244 } 208 245 209 - void 210 - brcmf_sdio_chip_resetcore(struct brcmf_sdio_dev *sdiodev, u32 corebase) 246 + static void 247 + brcmf_sdio_ai_coredisable(struct brcmf_sdio_dev *sdiodev, 248 + struct chip_info *ci, u16 coreid) 249 + { 250 + u8 idx; 251 + u32 regdata; 252 + 253 + idx = brcmf_sdio_chip_getinfidx(ci, coreid); 254 + 255 + /* if core is already in reset, just return */ 256 + regdata = brcmf_sdcard_reg_read(sdiodev, 257 + ci->c_inf[idx].wrapbase+BCMA_RESET_CTL, 258 + 4); 259 + if ((regdata & BCMA_RESET_CTL_RESET) != 0) 260 + return; 261 + 262 + brcmf_sdcard_reg_write(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL, 263 + 4, 0); 264 + regdata = brcmf_sdcard_reg_read(sdiodev, 265 + ci->c_inf[idx].wrapbase+BCMA_IOCTL, 4); 266 + udelay(10); 267 + 268 + brcmf_sdcard_reg_write(sdiodev, ci->c_inf[idx].wrapbase+BCMA_RESET_CTL, 269 + 4, BCMA_RESET_CTL_RESET); 270 + udelay(1); 271 + } 272 + 273 + static void 274 + brcmf_sdio_sb_resetcore(struct brcmf_sdio_dev *sdiodev, 275 + struct chip_info *ci, u16 coreid) 211 276 { 212 277 u32 regdata; 278 + u8 idx; 279 + 280 + idx = brcmf_sdio_chip_getinfidx(ci, coreid); 213 281 214 282 /* 215 283 * Must do the disable sequence first to work for 216 284 * arbitrary current core state. 217 285 */ 218 - brcmf_sdio_chip_coredisable(sdiodev, corebase); 286 + brcmf_sdio_sb_coredisable(sdiodev, ci, coreid); 219 287 220 288 /* 221 289 * Now do the initialization sequence. 222 290 * set reset while enabling the clock and 223 291 * forcing them on throughout the core 224 292 */ 225 - brcmf_sdcard_reg_write(sdiodev, CORE_SB(corebase, sbtmstatelow), 4, 226 - SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK | SSB_TMSLOW_RESET); 293 + brcmf_sdcard_reg_write(sdiodev, 294 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4, 295 + SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK | SSB_TMSLOW_RESET); 296 + regdata = brcmf_sdcard_reg_read(sdiodev, 297 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4); 227 298 udelay(1); 228 299 300 + /* clear any serror */ 229 301 regdata = brcmf_sdcard_reg_read(sdiodev, 230 - CORE_SB(corebase, sbtmstatehigh), 4); 302 + CORE_SB(ci->c_inf[idx].base, sbtmstatehigh), 4); 231 303 if (regdata & SSB_TMSHIGH_SERR) 232 304 brcmf_sdcard_reg_write(sdiodev, 233 - CORE_SB(corebase, sbtmstatehigh), 4, 0); 305 + CORE_SB(ci->c_inf[idx].base, sbtmstatehigh), 4, 0); 234 306 235 307 regdata = brcmf_sdcard_reg_read(sdiodev, 236 - CORE_SB(corebase, sbimstate), 4); 308 + CORE_SB(ci->c_inf[idx].base, sbimstate), 4); 237 309 if (regdata & (SSB_IMSTATE_IBE | SSB_IMSTATE_TO)) 238 - brcmf_sdcard_reg_write(sdiodev, CORE_SB(corebase, sbimstate), 4, 310 + brcmf_sdcard_reg_write(sdiodev, 311 + CORE_SB(ci->c_inf[idx].base, sbimstate), 4, 239 312 regdata & ~(SSB_IMSTATE_IBE | SSB_IMSTATE_TO)); 240 313 241 314 /* clear reset and allow it to propagate throughout the core */ 242 - brcmf_sdcard_reg_write(sdiodev, CORE_SB(corebase, sbtmstatelow), 4, 315 + brcmf_sdcard_reg_write(sdiodev, 316 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4, 243 317 SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK); 318 + regdata = brcmf_sdcard_reg_read(sdiodev, 319 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4); 244 320 udelay(1); 245 321 246 322 /* leave clock enabled */ 247 - brcmf_sdcard_reg_write(sdiodev, CORE_SB(corebase, sbtmstatelow), 323 + brcmf_sdcard_reg_write(sdiodev, 324 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 248 325 4, SSB_TMSLOW_CLOCK); 326 + regdata = brcmf_sdcard_reg_read(sdiodev, 327 + CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4); 328 + udelay(1); 329 + } 330 + 331 + static void 332 + brcmf_sdio_ai_resetcore(struct brcmf_sdio_dev *sdiodev, 333 + struct chip_info *ci, u16 coreid) 334 + { 335 + u8 idx; 336 + u32 regdata; 337 + 338 + idx = brcmf_sdio_chip_getinfidx(ci, coreid); 339 + 340 + /* must disable first to work for arbitrary current core state */ 341 + brcmf_sdio_ai_coredisable(sdiodev, ci, coreid); 342 + 343 + /* now do initialization sequence */ 344 + brcmf_sdcard_reg_write(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL, 345 + 4, BCMA_IOCTL_FGC | BCMA_IOCTL_CLK); 346 + regdata = brcmf_sdcard_reg_read(sdiodev, 347 + ci->c_inf[idx].wrapbase+BCMA_IOCTL, 4); 348 + brcmf_sdcard_reg_write(sdiodev, ci->c_inf[idx].wrapbase+BCMA_RESET_CTL, 349 + 4, 0); 350 + udelay(1); 351 + 352 + brcmf_sdcard_reg_write(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL, 353 + 4, BCMA_IOCTL_CLK); 354 + regdata = brcmf_sdcard_reg_read(sdiodev, 355 + ci->c_inf[idx].wrapbase+BCMA_IOCTL, 4); 249 356 udelay(1); 250 357 } 251 358 ··· 381 258 CORE_CC_REG(ci->c_inf[0].base, chipid), 4); 382 259 ci->chip = regdata & CID_ID_MASK; 383 260 ci->chiprev = (regdata & CID_REV_MASK) >> CID_REV_SHIFT; 261 + ci->socitype = (regdata & CID_TYPE_MASK) >> CID_TYPE_SHIFT; 384 262 385 263 brcmf_dbg(INFO, "chipid=0x%x chiprev=%d\n", ci->chip, ci->chiprev); 386 264 ··· 398 274 break; 399 275 default: 400 276 brcmf_dbg(ERROR, "chipid 0x%x is not supported\n", ci->chip); 277 + return -ENODEV; 278 + } 279 + 280 + switch (ci->socitype) { 281 + case SOCI_SB: 282 + ci->iscoreup = brcmf_sdio_sb_iscoreup; 283 + ci->corerev = brcmf_sdio_sb_corerev; 284 + ci->coredisable = brcmf_sdio_sb_coredisable; 285 + ci->resetcore = brcmf_sdio_sb_resetcore; 286 + break; 287 + case SOCI_AI: 288 + ci->iscoreup = brcmf_sdio_ai_iscoreup; 289 + ci->corerev = brcmf_sdio_ai_corerev; 290 + ci->coredisable = brcmf_sdio_ai_coredisable; 291 + ci->resetcore = brcmf_sdio_ai_resetcore; 292 + break; 293 + default: 294 + brcmf_dbg(ERROR, "socitype %u not supported\n", ci->socitype); 401 295 return -ENODEV; 402 296 } 403 297 ··· 474 332 brcmf_sdio_chip_buscoresetup(struct brcmf_sdio_dev *sdiodev, 475 333 struct chip_info *ci) 476 334 { 477 - u32 regdata; 478 - u8 idx; 479 - 480 335 /* get chipcommon rev */ 481 - ci->c_inf[0].rev = 482 - brcmf_sdio_chip_corerev(sdiodev, ci->c_inf[0].base); 336 + ci->c_inf[0].rev = ci->corerev(sdiodev, ci, ci->c_inf[0].id); 483 337 484 338 /* get chipcommon capabilites */ 485 339 ci->c_inf[0].caps = ··· 489 351 ci->pmurev = ci->pmucaps & PCAP_REV_MASK; 490 352 } 491 353 492 - ci->c_inf[1].rev = brcmf_sdio_chip_corerev(sdiodev, ci->c_inf[1].base); 493 - regdata = brcmf_sdcard_reg_read(sdiodev, 494 - CORE_SB(ci->c_inf[1].base, sbidhigh), 4); 495 - ci->c_inf[1].id = (regdata & SSB_IDHIGH_CC) >> SSB_IDHIGH_CC_SHIFT; 354 + ci->c_inf[1].rev = ci->corerev(sdiodev, ci, ci->c_inf[1].id); 496 355 497 356 brcmf_dbg(INFO, "ccrev=%d, pmurev=%d, buscore rev/type=%d/0x%x\n", 498 357 ci->c_inf[0].rev, ci->pmurev, ··· 499 364 * Make sure any on-chip ARM is off (in case strapping is wrong), 500 365 * or downloaded code was already running. 501 366 */ 502 - idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_ARM_CM3); 503 - brcmf_sdio_chip_coredisable(sdiodev, ci->c_inf[idx].base); 367 + ci->coredisable(sdiodev, ci, BCMA_CORE_ARM_CM3); 504 368 } 505 369 506 370 int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev,
+11 -6
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h
··· 60 60 u32 base; 61 61 u32 wrapbase; 62 62 u32 caps; 63 + u32 cib; 63 64 }; 64 65 65 66 struct chip_info { 66 67 u32 chip; 67 68 u32 chiprev; 69 + u32 socitype; 68 70 /* core info */ 69 71 /* always put chipcommon core at 0, bus core at 1 */ 70 72 struct chip_core_info c_inf[BRCMF_MAX_CORENUM]; 71 73 u32 pmurev; 72 74 u32 pmucaps; 73 75 u32 ramsize; 76 + 77 + bool (*iscoreup)(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci, 78 + u16 coreid); 79 + u32 (*corerev)(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci, 80 + u16 coreid); 81 + void (*coredisable)(struct brcmf_sdio_dev *sdiodev, 82 + struct chip_info *ci, u16 coreid); 83 + void (*resetcore)(struct brcmf_sdio_dev *sdiodev, 84 + struct chip_info *ci, u16 coreid); 74 85 }; 75 86 76 87 struct sbconfig { ··· 124 113 u32 sbidhigh; /* identification */ 125 114 }; 126 115 127 - extern void brcmf_sdio_chip_resetcore(struct brcmf_sdio_dev *sdiodev, 128 - u32 corebase); 129 - extern bool brcmf_sdio_chip_iscoreup(struct brcmf_sdio_dev *sdiodev, 130 - u32 corebase); 131 - extern void brcmf_sdio_chip_coredisable(struct brcmf_sdio_dev *sdiodev, 132 - u32 corebase); 133 116 extern int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev, 134 117 struct chip_info **ci_ptr, u32 regs); 135 118 extern void brcmf_sdio_chip_detach(struct chip_info **ci_ptr);
+13 -5
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
··· 2049 2049 notify_timestamp, notify_capability, notify_interval, notify_ie, 2050 2050 notify_ielen, notify_signal, GFP_KERNEL); 2051 2051 2052 - if (!bss) { 2053 - WL_ERR("cfg80211_inform_bss_frame error\n"); 2054 - return -EINVAL; 2055 - } 2052 + if (!bss) 2053 + return -ENOMEM; 2054 + 2055 + cfg80211_put_bss(bss); 2056 2056 2057 2057 return err; 2058 2058 } ··· 2096 2096 struct ieee80211_channel *notify_channel; 2097 2097 struct brcmf_bss_info_le *bi = NULL; 2098 2098 struct ieee80211_supported_band *band; 2099 + struct cfg80211_bss *bss; 2099 2100 u8 *buf = NULL; 2100 2101 s32 err = 0; 2101 2102 u16 channel; ··· 2150 2149 WL_CONN("signal: %d\n", notify_signal); 2151 2150 WL_CONN("notify_timestamp: %#018llx\n", notify_timestamp); 2152 2151 2153 - cfg80211_inform_bss(wiphy, notify_channel, bssid, 2152 + bss = cfg80211_inform_bss(wiphy, notify_channel, bssid, 2154 2153 notify_timestamp, notify_capability, notify_interval, 2155 2154 notify_ie, notify_ielen, notify_signal, GFP_KERNEL); 2155 + 2156 + if (!bss) { 2157 + err = -ENOMEM; 2158 + goto CleanUp; 2159 + } 2160 + 2161 + cfg80211_put_bss(bss); 2156 2162 2157 2163 CleanUp: 2158 2164
+8 -6
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
··· 16 16 * File contents: support functions for PCI/PCIe 17 17 */ 18 18 19 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 20 + 19 21 #include <linux/delay.h> 20 22 #include <linux/pci.h> 21 23 ··· 351 349 #define PCI_FORCEHT(si) (PCIE(si) && (si->pub.chip == BCM4716_CHIP_ID)) 352 350 353 351 #ifdef BCMDBG 354 - #define SI_MSG(args) printk args 352 + #define SI_MSG(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) 355 353 #else 356 - #define SI_MSG(args) 354 + #define SI_MSG(fmt, ...) no_printk(fmt, ##__VA_ARGS__) 357 355 #endif /* BCMDBG */ 358 356 359 357 #define GOODCOREADDR(x, b) \ ··· 1075 1073 1076 1074 /* scan for cores */ 1077 1075 if (socitype == SOCI_AI) { 1078 - SI_MSG(("Found chip type AI (0x%08x)\n", w)); 1076 + SI_MSG("Found chip type AI (0x%08x)\n", w); 1079 1077 /* pass chipc address instead of original core base */ 1080 1078 ai_scan(&sii->pub, cc); 1081 1079 } else { ··· 1131 1129 * set chipControl register bit 15 1132 1130 */ 1133 1131 if (sih->chiprev == 0) { 1134 - SI_MSG(("Applying 43224A0 WARs\n")); 1132 + SI_MSG("Applying 43224A0 WARs\n"); 1135 1133 ai_corereg(sih, SI_CC_IDX, 1136 1134 offsetof(struct chipcregs, chipcontrol), 1137 1135 CCTRL43224_GPIO_TOGGLE, ··· 1140 1138 CCTRL_43224A0_12MA_LED_DRIVE); 1141 1139 } 1142 1140 if (sih->chiprev >= 1) { 1143 - SI_MSG(("Applying 43224B0+ WARs\n")); 1141 + SI_MSG("Applying 43224B0+ WARs\n"); 1144 1142 si_pmu_chipcontrol(sih, 0, CCTRL_43224B0_12MA_LED_DRIVE, 1145 1143 CCTRL_43224B0_12MA_LED_DRIVE); 1146 1144 } ··· 1151 1149 * enable 12 mA drive strenth for 4313 and 1152 1150 * set chipControl register bit 1 1153 1151 */ 1154 - SI_MSG(("Applying 4313 WARs\n")); 1152 + SI_MSG("Applying 4313 WARs\n"); 1155 1153 si_pmu_chipcontrol(sih, 0, CCTRL_4313_12MA_LED_DRIVE, 1156 1154 CCTRL_4313_12MA_LED_DRIVE); 1157 1155 }
+2 -4
drivers/net/wireless/brcm80211/brcmsmac/ampdu.c
··· 649 649 len = roundup(len, 4); 650 650 ampdu_len += (len + (ndelim + 1) * AMPDU_DELIMITER_LEN); 651 651 652 - dma_len += (u16) brcmu_pkttotlen(p); 652 + dma_len += (u16) p->len; 653 653 654 654 BCMMSG(wlc->wiphy, "wl%d: ampdu_len %d" 655 655 " seg_cnt %d null delim %d\n", ··· 741 741 if (p) { 742 742 if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && 743 743 ((u8) (p->priority) == tid)) { 744 - 745 - plen = brcmu_pkttotlen(p) + 746 - AMPDU_MAX_MPDU_OVERHEAD; 744 + plen = p->len + AMPDU_MAX_MPDU_OVERHEAD; 747 745 plen = max(scb_ampdu->min_len, plen); 748 746 749 747 if ((plen + ampdu_len) > max_ampdu_bytes) {
-118
drivers/net/wireless/brcm80211/brcmsmac/channel.c
··· 1153 1153 &txpwr); 1154 1154 } 1155 1155 1156 - #ifdef POWER_DBG 1157 - static void wlc_phy_txpower_limits_dump(struct txpwr_limits *txpwr) 1158 - { 1159 - int i; 1160 - char buf[80]; 1161 - char fraction[4][4] = { " ", ".25", ".5 ", ".75" }; 1162 - 1163 - sprintf(buf, "CCK "); 1164 - for (i = 0; i < BRCMS_NUM_RATES_CCK; i++) 1165 - sprintf(buf[strlen(buf)], " %2d%s", 1166 - txpwr->cck[i] / BRCMS_TXPWR_DB_FACTOR, 1167 - fraction[txpwr->cck[i] % BRCMS_TXPWR_DB_FACTOR]); 1168 - printk(KERN_DEBUG "%s\n", buf); 1169 - 1170 - sprintf(buf, "20 MHz OFDM SISO "); 1171 - for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) 1172 - sprintf(buf[strlen(buf)], " %2d%s", 1173 - txpwr->ofdm[i] / BRCMS_TXPWR_DB_FACTOR, 1174 - fraction[txpwr->ofdm[i] % BRCMS_TXPWR_DB_FACTOR]); 1175 - printk(KERN_DEBUG "%s\n", buf); 1176 - 1177 - sprintf(buf, "20 MHz OFDM CDD "); 1178 - for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) 1179 - sprintf(buf[strlen(buf)], " %2d%s", 1180 - txpwr->ofdm_cdd[i] / BRCMS_TXPWR_DB_FACTOR, 1181 - fraction[txpwr->ofdm_cdd[i] % BRCMS_TXPWR_DB_FACTOR]); 1182 - printk(KERN_DEBUG "%s\n", buf); 1183 - 1184 - sprintf(buf, "40 MHz OFDM SISO "); 1185 - for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) 1186 - sprintf(buf[strlen(buf)], " %2d%s", 1187 - txpwr->ofdm_40_siso[i] / BRCMS_TXPWR_DB_FACTOR, 1188 - fraction[txpwr->ofdm_40_siso[i] % 1189 - BRCMS_TXPWR_DB_FACTOR]); 1190 - printk(KERN_DEBUG "%s\n", buf); 1191 - 1192 - sprintf(buf, "40 MHz OFDM CDD "); 1193 - for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) 1194 - sprintf(buf[strlen(buf)], " %2d%s", 1195 - txpwr->ofdm_40_cdd[i] / BRCMS_TXPWR_DB_FACTOR, 1196 - fraction[txpwr->ofdm_40_cdd[i] % 1197 - BRCMS_TXPWR_DB_FACTOR]); 1198 - printk(KERN_DEBUG "%s\n", buf); 1199 - 1200 - sprintf(buf, "20 MHz MCS0-7 SISO "); 1201 - for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) 1202 - sprintf(buf[strlen(buf)], " %2d%s", 1203 - txpwr->mcs_20_siso[i] / BRCMS_TXPWR_DB_FACTOR, 1204 - fraction[txpwr->mcs_20_siso[i] % 1205 - BRCMS_TXPWR_DB_FACTOR]); 1206 - printk(KERN_DEBUG "%s\n", buf); 1207 - 1208 - sprintf(buf, "20 MHz MCS0-7 CDD "); 1209 - for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) 1210 - sprintf(buf[strlen(buf)], " %2d%s", 1211 - txpwr->mcs_20_cdd[i] / BRCMS_TXPWR_DB_FACTOR, 1212 - fraction[txpwr->mcs_20_cdd[i] % 1213 - BRCMS_TXPWR_DB_FACTOR]); 1214 - printk(KERN_DEBUG "%s\n", buf); 1215 - 1216 - sprintf(buf, "20 MHz MCS0-7 STBC "); 1217 - for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) 1218 - sprintf(buf[strlen(buf)], " %2d%s", 1219 - txpwr->mcs_20_stbc[i] / BRCMS_TXPWR_DB_FACTOR, 1220 - fraction[txpwr->mcs_20_stbc[i] % 1221 - BRCMS_TXPWR_DB_FACTOR]); 1222 - printk(KERN_DEBUG "%s\n", buf); 1223 - 1224 - sprintf(buf, "20 MHz MCS8-15 SDM "); 1225 - for (i = 0; i < BRCMS_NUM_RATES_MCS_2_STREAM; i++) 1226 - sprintf(buf[strlen(buf)], " %2d%s", 1227 - txpwr->mcs_20_mimo[i] / BRCMS_TXPWR_DB_FACTOR, 1228 - fraction[txpwr->mcs_20_mimo[i] % 1229 - BRCMS_TXPWR_DB_FACTOR]); 1230 - printk(KERN_DEBUG "%s\n", buf); 1231 - 1232 - sprintf(buf, "40 MHz MCS0-7 SISO "); 1233 - for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) 1234 - sprintf(buf[strlen(buf)], " %2d%s", 1235 - txpwr->mcs_40_siso[i] / BRCMS_TXPWR_DB_FACTOR, 1236 - fraction[txpwr->mcs_40_siso[i] % 1237 - BRCMS_TXPWR_DB_FACTOR]); 1238 - printk(KERN_DEBUG "%s\n", buf); 1239 - 1240 - sprintf(buf, "40 MHz MCS0-7 CDD "); 1241 - for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) 1242 - sprintf(buf[strlen(buf)], " %2d%s", 1243 - txpwr->mcs_40_cdd[i] / BRCMS_TXPWR_DB_FACTOR, 1244 - fraction[txpwr->mcs_40_cdd[i] % 1245 - BRCMS_TXPWR_DB_FACTOR]); 1246 - printk(KERN_DEBUG "%s\n", buf); 1247 - 1248 - sprintf(buf, "40 MHz MCS0-7 STBC "); 1249 - for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) 1250 - sprintf(buf[strlen(buf)], " %2d%s", 1251 - txpwr->mcs_40_stbc[i] / BRCMS_TXPWR_DB_FACTOR, 1252 - fraction[txpwr->mcs_40_stbc[i] % 1253 - BRCMS_TXPWR_DB_FACTOR]); 1254 - printk(KERN_DEBUG "%s\n", buf); 1255 - 1256 - sprintf(buf, "40 MHz MCS8-15 SDM "); 1257 - for (i = 0; i < BRCMS_NUM_RATES_MCS_2_STREAM; i++) 1258 - sprintf(buf[strlen(buf)], " %2d%s", 1259 - txpwr->mcs_40_mimo[i] / BRCMS_TXPWR_DB_FACTOR, 1260 - fraction[txpwr->mcs_40_mimo[i] % 1261 - BRCMS_TXPWR_DB_FACTOR]); 1262 - } 1263 - printk(KERN_DEBUG "%s\n", buf); 1264 - 1265 - printk(KERN_DEBUG "MCS32 %2d%s\n", 1266 - txpwr->mcs32 / BRCMS_TXPWR_DB_FACTOR, 1267 - fraction[txpwr->mcs32 % BRCMS_TXPWR_DB_FACTOR]); 1268 - } 1269 - #endif /* POWER_DBG */ 1270 - 1271 1156 void 1272 1157 brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec, 1273 1158 struct txpwr_limits *txpwr) ··· 1363 1478 txpwr->mcs_40_stbc[i] = txpwr->mcs_40_cdd[i]; 1364 1479 } 1365 1480 1366 - #ifdef POWER_DBG 1367 - wlc_phy_txpower_limits_dump(txpwr); 1368 - #endif 1369 1481 return; 1370 1482 } 1371 1483
+72 -73
drivers/net/wireless/brcm80211/brcmsmac/dma.c
··· 13 13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 15 */ 16 + 17 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 18 + 16 19 #include <linux/slab.h> 17 20 #include <linux/delay.h> 18 21 #include <linux/pci.h> ··· 171 168 172 169 /* debug/trace */ 173 170 #ifdef BCMDBG 174 - #define DMA_ERROR(args) \ 175 - do { \ 176 - if (!(*di->msg_level & 1)) \ 177 - ; \ 178 - else \ 179 - printk args; \ 180 - } while (0) 181 - #define DMA_TRACE(args) \ 182 - do { \ 183 - if (!(*di->msg_level & 2)) \ 184 - ; \ 185 - else \ 186 - printk args; \ 187 - } while (0) 171 + #define DMA_ERROR(fmt, ...) \ 172 + do { \ 173 + if (*di->msg_level & 1) \ 174 + pr_debug("%s: " fmt, __func__, ##__VA_ARGS__); \ 175 + } while (0) 176 + #define DMA_TRACE(fmt, ...) \ 177 + do { \ 178 + if (*di->msg_level & 2) \ 179 + pr_debug("%s: " fmt, __func__, ##__VA_ARGS__); \ 180 + } while (0) 188 181 #else 189 - #define DMA_ERROR(args) 190 - #define DMA_TRACE(args) 182 + #define DMA_ERROR(fmt, ...) \ 183 + no_printk(fmt, ##__VA_ARGS__) 184 + #define DMA_TRACE(fmt, ...) \ 185 + no_printk(fmt, ##__VA_ARGS__) 191 186 #endif /* BCMDBG */ 192 187 193 - #define DMA_NONE(args) 188 + #define DMA_NONE(fmt, ...) \ 189 + no_printk(fmt, ##__VA_ARGS__) 194 190 195 191 #define MAXNAMEL 8 /* 8 char names */ 196 192 ··· 363 361 uint dmactrlflags; 364 362 365 363 if (di == NULL) { 366 - DMA_ERROR(("_dma_ctrlflags: NULL dma handle\n")); 364 + DMA_ERROR("NULL dma handle\n"); 367 365 return 0; 368 366 } 369 367 ··· 414 412 /* not all tx or rx channel are available */ 415 413 if (di->d64txregs != NULL) { 416 414 if (!_dma64_addrext(di->d64txregs)) 417 - DMA_ERROR(("%s: _dma_isaddrext: DMA64 tx doesn't have " 418 - "AE set\n", di->name)); 415 + DMA_ERROR("%s: DMA64 tx doesn't have AE set\n", 416 + di->name); 419 417 return true; 420 418 } else if (di->d64rxregs != NULL) { 421 419 if (!_dma64_addrext(di->d64rxregs)) 422 - DMA_ERROR(("%s: _dma_isaddrext: DMA64 rx doesn't have " 423 - "AE set\n", di->name)); 420 + DMA_ERROR("%s: DMA64 rx doesn't have AE set\n", 421 + di->name); 424 422 return true; 425 423 } 426 424 ··· 521 519 va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits, 522 520 &alloced, &di->txdpaorig); 523 521 if (va == NULL) { 524 - DMA_ERROR(("%s: dma64_alloc: DMA_ALLOC_CONSISTENT(ntxd)" 525 - " failed\n", di->name)); 522 + DMA_ERROR("%s: DMA_ALLOC_CONSISTENT(ntxd) failed\n", 523 + di->name); 526 524 return false; 527 525 } 528 526 align = (1 << align_bits); ··· 535 533 va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits, 536 534 &alloced, &di->rxdpaorig); 537 535 if (va == NULL) { 538 - DMA_ERROR(("%s: dma64_alloc: DMA_ALLOC_CONSISTENT(nrxd)" 539 - " failed\n", di->name)); 536 + DMA_ERROR("%s: DMA_ALLOC_CONSISTENT(nrxd) failed\n", 537 + di->name); 540 538 return false; 541 539 } 542 540 align = (1 << align_bits); ··· 585 583 */ 586 584 _dma_ctrlflags(di, DMA_CTRL_ROC | DMA_CTRL_PEN, 0); 587 585 588 - DMA_TRACE(("%s: dma_attach: %s flags 0x%x ntxd %d nrxd %d " 589 - "rxbufsize %d rxextheadroom %d nrxpost %d rxoffset %d " 590 - "dmaregstx %p dmaregsrx %p\n", name, "DMA64", 591 - di->dma.dmactrlflags, ntxd, nrxd, rxbufsize, 592 - rxextheadroom, nrxpost, rxoffset, dmaregstx, dmaregsrx)); 586 + DMA_TRACE("%s: %s flags 0x%x ntxd %d nrxd %d rxbufsize %d rxextheadroom %d nrxpost %d rxoffset %d dmaregstx %p dmaregsrx %p\n", 587 + name, "DMA64", 588 + di->dma.dmactrlflags, ntxd, nrxd, rxbufsize, 589 + rxextheadroom, nrxpost, rxoffset, dmaregstx, dmaregsrx); 593 590 594 591 /* make a private copy of our callers name */ 595 592 strncpy(di->name, name, MAXNAMEL); ··· 646 645 di->dmadesc_align = 4; /* 16 byte alignment */ 647 646 } 648 647 649 - DMA_NONE(("DMA descriptor align_needed %d, align %d\n", 650 - di->aligndesc_4k, di->dmadesc_align)); 648 + DMA_NONE("DMA descriptor align_needed %d, align %d\n", 649 + di->aligndesc_4k, di->dmadesc_align); 651 650 652 651 /* allocate tx packet pointer vector */ 653 652 if (ntxd) { ··· 685 684 686 685 if ((di->ddoffsetlow != 0) && !di->addrext) { 687 686 if (di->txdpa > SI_PCI_DMA_SZ) { 688 - DMA_ERROR(("%s: dma_attach: txdpa 0x%x: addrext not " 689 - "supported\n", di->name, (u32)di->txdpa)); 687 + DMA_ERROR("%s: txdpa 0x%x: addrext not supported\n", 688 + di->name, (u32)di->txdpa); 690 689 goto fail; 691 690 } 692 691 if (di->rxdpa > SI_PCI_DMA_SZ) { 693 - DMA_ERROR(("%s: dma_attach: rxdpa 0x%x: addrext not " 694 - "supported\n", di->name, (u32)di->rxdpa)); 692 + DMA_ERROR("%s: rxdpa 0x%x: addrext not supported\n", 693 + di->name, (u32)di->rxdpa); 695 694 goto fail; 696 695 } 697 696 } 698 697 699 - DMA_TRACE(("ddoffsetlow 0x%x ddoffsethigh 0x%x dataoffsetlow 0x%x " 700 - "dataoffsethigh " "0x%x addrext %d\n", di->ddoffsetlow, 701 - di->ddoffsethigh, di->dataoffsetlow, di->dataoffsethigh, 702 - di->addrext)); 698 + DMA_TRACE("ddoffsetlow 0x%x ddoffsethigh 0x%x dataoffsetlow 0x%x dataoffsethigh 0x%x addrext %d\n", 699 + di->ddoffsetlow, di->ddoffsethigh, 700 + di->dataoffsetlow, di->dataoffsethigh, 701 + di->addrext); 703 702 704 703 return (struct dma_pub *) di; 705 704 ··· 745 744 { 746 745 struct dma_info *di = (struct dma_info *)pub; 747 746 748 - DMA_TRACE(("%s: dma_detach\n", di->name)); 747 + DMA_TRACE("%s:\n", di->name); 749 748 750 749 /* free dma descriptor rings */ 751 750 if (di->txd64) ··· 813 812 uint dmactrlflags = di->dma.dmactrlflags; 814 813 u32 control; 815 814 816 - DMA_TRACE(("%s: dma_rxenable\n", di->name)); 815 + DMA_TRACE("%s:\n", di->name); 817 816 818 817 control = 819 818 (R_REG(&di->d64rxregs->control) & D64_RC_AE) | ··· 833 832 { 834 833 struct dma_info *di = (struct dma_info *)pub; 835 834 836 - DMA_TRACE(("%s: dma_rxinit\n", di->name)); 835 + DMA_TRACE("%s:\n", di->name); 837 836 838 837 if (di->nrxd == 0) 839 838 return; ··· 927 926 return 0; 928 927 929 928 len = le16_to_cpu(*(__le16 *) (p->data)); 930 - DMA_TRACE(("%s: dma_rx len %d\n", di->name, len)); 929 + DMA_TRACE("%s: dma_rx len %d\n", di->name, len); 931 930 dma_spin_for_len(len, p); 932 931 933 932 /* set actual length */ ··· 954 953 D64_RS0_CD_MASK) - 955 954 di->rcvptrbase) & D64_RS0_CD_MASK, 956 955 struct dma64desc); 957 - DMA_ERROR(("dma_rx, rxin %d rxout %d, hw_curr %d\n", 958 - di->rxin, di->rxout, cur)); 956 + DMA_ERROR("rxin %d rxout %d, hw_curr %d\n", 957 + di->rxin, di->rxout, cur); 959 958 } 960 959 #endif /* BCMDBG */ 961 960 962 961 if ((di->dma.dmactrlflags & DMA_CTRL_RXMULTI) == 0) { 963 - DMA_ERROR(("%s: dma_rx: bad frame length (%d)\n", 964 - di->name, len)); 962 + DMA_ERROR("%s: bad frame length (%d)\n", 963 + di->name, len); 965 964 skb_queue_walk_safe(&dma_frames, p, next) { 966 965 skb_unlink(p, &dma_frames); 967 966 brcmu_pkt_buf_free_skb(p); ··· 978 977 979 978 static bool dma64_rxidle(struct dma_info *di) 980 979 { 981 - DMA_TRACE(("%s: dma_rxidle\n", di->name)); 980 + DMA_TRACE("%s:\n", di->name); 982 981 983 982 if (di->nrxd == 0) 984 983 return true; ··· 1018 1017 1019 1018 n = di->nrxpost - nrxdactive(di, rxin, rxout); 1020 1019 1021 - DMA_TRACE(("%s: dma_rxfill: post %d\n", di->name, n)); 1020 + DMA_TRACE("%s: post %d\n", di->name, n); 1022 1021 1023 1022 if (di->rxbufsize > BCMEXTRAHDROOM) 1024 1023 extra_offset = di->rxextrahdrroom; ··· 1031 1030 p = brcmu_pkt_buf_get_skb(di->rxbufsize + extra_offset); 1032 1031 1033 1032 if (p == NULL) { 1034 - DMA_ERROR(("%s: dma_rxfill: out of rxbufs\n", 1035 - di->name)); 1033 + DMA_ERROR("%s: out of rxbufs\n", di->name); 1036 1034 if (i == 0 && dma64_rxidle(di)) { 1037 - DMA_ERROR(("%s: rxfill64: ring is empty !\n", 1038 - di->name)); 1035 + DMA_ERROR("%s: ring is empty !\n", di->name); 1039 1036 ring_empty = true; 1040 1037 } 1041 1038 di->dma.rxnobuf++; ··· 1078 1079 struct dma_info *di = (struct dma_info *)pub; 1079 1080 struct sk_buff *p; 1080 1081 1081 - DMA_TRACE(("%s: dma_rxreclaim\n", di->name)); 1082 + DMA_TRACE("%s:\n", di->name); 1082 1083 1083 1084 while ((p = _dma_getnextrxp(di, true))) 1084 1085 brcmu_pkt_buf_free_skb(p); ··· 1109 1110 struct dma_info *di = (struct dma_info *)pub; 1110 1111 u32 control = D64_XC_XE; 1111 1112 1112 - DMA_TRACE(("%s: dma_txinit\n", di->name)); 1113 + DMA_TRACE("%s:\n", di->name); 1113 1114 1114 1115 if (di->ntxd == 0) 1115 1116 return; ··· 1141 1142 { 1142 1143 struct dma_info *di = (struct dma_info *)pub; 1143 1144 1144 - DMA_TRACE(("%s: dma_txsuspend\n", di->name)); 1145 + DMA_TRACE("%s:\n", di->name); 1145 1146 1146 1147 if (di->ntxd == 0) 1147 1148 return; ··· 1153 1154 { 1154 1155 struct dma_info *di = (struct dma_info *)pub; 1155 1156 1156 - DMA_TRACE(("%s: dma_txresume\n", di->name)); 1157 + DMA_TRACE("%s:\n", di->name); 1157 1158 1158 1159 if (di->ntxd == 0) 1159 1160 return; ··· 1175 1176 struct dma_info *di = (struct dma_info *)pub; 1176 1177 struct sk_buff *p; 1177 1178 1178 - DMA_TRACE(("%s: dma_txreclaim %s\n", di->name, 1179 - (range == DMA_RANGE_ALL) ? "all" : 1180 - ((range == 1181 - DMA_RANGE_TRANSMITTED) ? "transmitted" : 1182 - "transferred"))); 1179 + DMA_TRACE("%s: %s\n", 1180 + di->name, 1181 + range == DMA_RANGE_ALL ? "all" : 1182 + range == DMA_RANGE_TRANSMITTED ? "transmitted" : 1183 + "transferred"); 1183 1184 1184 1185 if (di->txin == di->txout) 1185 1186 return; ··· 1249 1250 u32 flags = 0; 1250 1251 dma_addr_t pa; 1251 1252 1252 - DMA_TRACE(("%s: dma_txfast\n", di->name)); 1253 + DMA_TRACE("%s:\n", di->name); 1253 1254 1254 1255 txout = di->txout; 1255 1256 ··· 1313 1314 return 0; 1314 1315 1315 1316 outoftxd: 1316 - DMA_ERROR(("%s: dma_txfast: out of txds !!!\n", di->name)); 1317 + DMA_ERROR("%s: out of txds !!!\n", di->name); 1317 1318 brcmu_pkt_buf_free_skb(p0); 1318 1319 di->dma.txavail = 0; 1319 1320 di->dma.txnobuf++; ··· 1337 1338 u16 active_desc; 1338 1339 struct sk_buff *txp; 1339 1340 1340 - DMA_TRACE(("%s: dma_getnexttxp %s\n", di->name, 1341 - (range == DMA_RANGE_ALL) ? "all" : 1342 - ((range == 1343 - DMA_RANGE_TRANSMITTED) ? "transmitted" : 1344 - "transferred"))); 1341 + DMA_TRACE("%s: %s\n", 1342 + di->name, 1343 + range == DMA_RANGE_ALL ? "all" : 1344 + range == DMA_RANGE_TRANSMITTED ? "transmitted" : 1345 + "transferred"); 1345 1346 1346 1347 if (di->ntxd == 0) 1347 1348 return NULL; ··· 1401 1402 return txp; 1402 1403 1403 1404 bogus: 1404 - DMA_NONE(("dma_getnexttxp: bogus curr: start %d end %d txout %d " 1405 - "force %d\n", start, end, di->txout, forceall)); 1405 + DMA_NONE("bogus curr: start %d end %d txout %d\n", 1406 + start, end, di->txout); 1406 1407 return NULL; 1407 1408 } 1408 1409
-7
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
··· 619 619 wl->pub->global_ampdu->scb = scb; 620 620 wl->pub->global_ampdu->max_pdu = 16; 621 621 622 - sta->ht_cap.ht_supported = true; 623 - sta->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; 624 - sta->ht_cap.ampdu_density = AMPDU_DEF_MPDU_DENSITY; 625 - sta->ht_cap.cap = IEEE80211_HT_CAP_GRN_FLD | 626 - IEEE80211_HT_CAP_SGI_20 | 627 - IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_40MHZ_INTOLERANT; 628 - 629 622 /* 630 623 * minstrel_ht initiates addBA on our behalf by calling 631 624 * ieee80211_start_tx_ba_session()
+40 -46
drivers/net/wireless/brcm80211/brcmsmac/main.c
··· 109 109 #define BPHY_PLCP_TIME 192 110 110 #define RIFS_11N_TIME 2 111 111 112 - #define AC_BE 0 113 - #define AC_BK 1 114 - #define AC_VI 2 115 - #define AC_VO 3 116 - 117 112 /* length of the BCN template area */ 118 113 #define BCN_TMPL_LEN 512 119 114 ··· 300 305 #endif /* BCMDBG */ 301 306 302 307 /* TX FIFO number to WME/802.1E Access Category */ 303 - static const u8 wme_fifo2ac[] = { AC_BK, AC_BE, AC_VI, AC_VO, AC_BE, AC_BE }; 308 + static const u8 wme_fifo2ac[] = { 309 + IEEE80211_AC_BK, 310 + IEEE80211_AC_BE, 311 + IEEE80211_AC_VI, 312 + IEEE80211_AC_VO, 313 + IEEE80211_AC_BE, 314 + IEEE80211_AC_BE 315 + }; 304 316 305 - /* WME/802.1E Access Category to TX FIFO number */ 306 - static const u8 wme_ac2fifo[] = { 1, 0, 2, 3 }; 317 + /* ieee80211 Access Category to TX FIFO number */ 318 + static const u8 wme_ac2fifo[] = { 319 + TX_AC_VO_FIFO, 320 + TX_AC_VI_FIFO, 321 + TX_AC_BE_FIFO, 322 + TX_AC_BK_FIFO 323 + }; 307 324 308 325 /* 802.1D Priority to precedence queue mapping */ 309 326 const u8 wlc_prio2prec_map[] = { ··· 900 893 lfbl, /* Long Frame Rate Fallback Limit */ 901 894 fbl; 902 895 903 - if (queue < AC_COUNT) { 896 + if (queue < IEEE80211_NUM_ACS) { 904 897 sfbl = GFIELD(wlc->wme_retries[wme_fifo2ac[queue]], 905 898 EDCF_SFB); 906 899 lfbl = GFIELD(wlc->wme_retries[wme_fifo2ac[queue]], ··· 949 942 tx_info->flags |= IEEE80211_TX_STAT_ACK; 950 943 } 951 944 952 - totlen = brcmu_pkttotlen(p); 945 + totlen = p->len; 953 946 free_pdu = true; 954 947 955 948 brcms_c_txfifo_complete(wlc, queue, 1); ··· 3583 3576 brcms_c_set_phy_chanspec(wlc, chanspec); 3584 3577 } 3585 3578 3586 - static void brcms_c_mac_bcn_promisc(struct brcms_c_info *wlc) 3579 + /* 3580 + * Set or clear maccontrol bits MCTL_PROMISC, MCTL_BCNS_PROMISC and 3581 + * MCTL_KEEPCONTROL 3582 + */ 3583 + static void brcms_c_mac_promisc(struct brcms_c_info *wlc) 3587 3584 { 3585 + u32 promisc_bits = 0; 3586 + 3588 3587 if (wlc->bcnmisc_monitor) 3589 - brcms_b_mctrl(wlc->hw, MCTL_BCNS_PROMISC, MCTL_BCNS_PROMISC); 3590 - else 3591 - brcms_b_mctrl(wlc->hw, MCTL_BCNS_PROMISC, 0); 3588 + promisc_bits |= MCTL_BCNS_PROMISC; 3589 + 3590 + if (wlc->monitor) 3591 + promisc_bits |= 3592 + MCTL_PROMISC | MCTL_BCNS_PROMISC | MCTL_KEEPCONTROL; 3593 + 3594 + brcms_b_mctrl(wlc->hw, 3595 + MCTL_PROMISC | MCTL_BCNS_PROMISC | MCTL_KEEPCONTROL, 3596 + promisc_bits); 3592 3597 } 3593 3598 3594 3599 void brcms_c_mac_bcn_promisc_change(struct brcms_c_info *wlc, bool promisc) 3595 3600 { 3596 3601 wlc->bcnmisc_monitor = promisc; 3597 - brcms_c_mac_bcn_promisc(wlc); 3598 - } 3599 - 3600 - /* set or clear maccontrol bits MCTL_PROMISC and MCTL_KEEPCONTROL */ 3601 - static void brcms_c_mac_promisc(struct brcms_c_info *wlc) 3602 - { 3603 - u32 promisc_bits = 0; 3604 - 3605 - /* 3606 - * promiscuous mode just sets MCTL_PROMISC 3607 - * Note: APs get all BSS traffic without the need to set 3608 - * the MCTL_PROMISC bit since all BSS data traffic is 3609 - * directed at the AP 3610 - */ 3611 - if (wlc->pub->promisc) 3612 - promisc_bits |= MCTL_PROMISC; 3613 - 3614 - /* monitor mode needs both MCTL_PROMISC and MCTL_KEEPCONTROL 3615 - * Note: monitor mode also needs MCTL_BCNS_PROMISC, but that is 3616 - * handled in brcms_c_mac_bcn_promisc() 3617 - */ 3618 - if (wlc->monitor) 3619 - promisc_bits |= MCTL_PROMISC | MCTL_KEEPCONTROL; 3620 - 3621 - brcms_b_mctrl(wlc->hw, MCTL_PROMISC | MCTL_KEEPCONTROL, promisc_bits); 3602 + brcms_c_mac_promisc(wlc); 3622 3603 } 3623 3604 3624 3605 /* ··· 3638 3643 } 3639 3644 3640 3645 /* update the various promisc bits */ 3641 - brcms_c_mac_bcn_promisc(wlc); 3642 3646 brcms_c_mac_promisc(wlc); 3643 3647 } 3644 3648 ··· 4119 4125 EDCF_TXOP2USEC(acp_shm.txop); 4120 4126 acp_shm.aifs = (params->aifs & EDCF_AIFSN_MASK); 4121 4127 4122 - if (aci == AC_VI && acp_shm.txop == 0 4128 + if (aci == IEEE80211_AC_VI && acp_shm.txop == 0 4123 4129 && acp_shm.aifs < EDCF_AIFSN_MAX) 4124 4130 acp_shm.aifs++; 4125 4131 ··· 4169 4175 }; /* ucode needs these parameters during its initialization */ 4170 4176 const struct edcf_acparam *edcf_acp = &default_edcf_acparams[0]; 4171 4177 4172 - for (i_ac = 0; i_ac < AC_COUNT; i_ac++, edcf_acp++) { 4178 + for (i_ac = 0; i_ac < IEEE80211_NUM_ACS; i_ac++, edcf_acp++) { 4173 4179 /* find out which ac this set of params applies to */ 4174 4180 aci = (edcf_acp->ACI & EDCF_ACI_MASK) >> EDCF_ACI_SHIFT; 4175 4181 ··· 5166 5172 if (!wlc->clk) 5167 5173 return; 5168 5174 5169 - for (ac = 0; ac < AC_COUNT; ac++) 5175 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) 5170 5176 brcms_b_write_shm(wlc->hw, M_AC_TXLMT_ADDR(ac), 5171 5177 wlc->wme_retries[ac]); 5172 5178 } ··· 5641 5647 5642 5648 brcms_b_retrylimit_upd(wlc->hw, wlc->SRL, wlc->LRL); 5643 5649 5644 - for (ac = 0; ac < AC_COUNT; ac++) { 5650 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { 5645 5651 wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], 5646 5652 EDCF_SHORT, wlc->SRL); 5647 5653 wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], ··· 6703 6709 qos = ieee80211_is_data_qos(h->frame_control); 6704 6710 6705 6711 /* compute length of frame in bytes for use in PLCP computations */ 6706 - len = brcmu_pkttotlen(p); 6712 + len = p->len; 6707 6713 phylen = len + FCS_LEN; 6708 6714 6709 6715 /* Get tx_info */ ··· 8352 8358 /* Uninitialized; read from HW */ 8353 8359 int ac; 8354 8360 8355 - for (ac = 0; ac < AC_COUNT; ac++) 8361 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) 8356 8362 wlc->wme_retries[ac] = 8357 8363 brcms_b_read_shm(wlc->hw, M_AC_TXLMT_ADDR(ac)); 8358 8364 }
+3 -5
drivers/net/wireless/brcm80211/brcmsmac/main.h
··· 44 44 /* transmit buffer max headroom for protocol headers */ 45 45 #define TXOFF (D11_TXH_LEN + D11_PHY_HDR_LEN) 46 46 47 - #define AC_COUNT 4 48 - 49 47 /* Macros for doing definition and get/set of bitfields 50 48 * Usage example, e.g. a three-bit field (bits 4-6): 51 49 * #define <NAME>_M BITFIELD_MASK(3) ··· 434 436 * bcn_li_dtim: beacon listen interval in # dtims. 435 437 * WDarmed: watchdog timer is armed. 436 438 * WDlast: last time wlc_watchdog() was called. 437 - * edcf_txop[AC_COUNT]: current txop for each ac. 439 + * edcf_txop[IEEE80211_NUM_ACS]: current txop for each ac. 438 440 * wme_retries: per-AC retry limits. 439 441 * tx_prec_map: Precedence map based on HW FIFO space. 440 442 * fifo2prec_map[NFIFO]: pointer to fifo2_prec map based on WME. ··· 533 535 u32 WDlast; 534 536 535 537 /* WME */ 536 - u16 edcf_txop[AC_COUNT]; 538 + u16 edcf_txop[IEEE80211_NUM_ACS]; 537 539 538 - u16 wme_retries[AC_COUNT]; 540 + u16 wme_retries[IEEE80211_NUM_ACS]; 539 541 u16 tx_prec_map; 540 542 u16 fifo2prec_map[NFIFO]; 541 543
-8
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
··· 190 190 data = R_REG(&pi->regs->radioregdata); 191 191 } else { 192 192 W_REG_FLUSH(&pi->regs->phy4waddr, addr); 193 - 194 - #ifdef __ARM_ARCH_4T__ 195 - __asm__(" .align 4 "); 196 - __asm__(" nop "); 197 193 data = R_REG(&pi->regs->phy4wdatalo); 198 - #else 199 - data = R_REG(&pi->regs->phy4wdatalo); 200 - #endif 201 - 202 194 } 203 195 pi->phy_wreg = 0; 204 196
-2
drivers/net/wireless/brcm80211/brcmsmac/pub.h
··· 248 248 }; 249 249 250 250 #define BRCMS_NUMRATES 16 /* max # of rates in a rateset */ 251 - #define D11_PHY_HDR_LEN 6 /* Phy header length - 6 bytes */ 252 251 253 252 /* phy types */ 254 253 #define PHY_TYPE_A 0 /* Phy type A */ ··· 381 382 uint _nbands; /* # bands supported */ 382 383 uint now; /* # elapsed seconds */ 383 384 384 - bool promisc; /* promiscuous destination address */ 385 385 bool delayed_down; /* down delayed */ 386 386 bool associated; /* true:part of [I]BSS, false: not */ 387 387 /* (union of stas_associated, aps_associated) */
+3 -1
drivers/net/wireless/brcm80211/brcmsmac/srom.c
··· 638 638 struct brcms_srom_list_head *entry; 639 639 enum brcms_srom_id id; 640 640 u16 w; 641 - u32 val; 641 + u32 val = 0; 642 642 const struct brcms_sromvar *srv; 643 643 uint width; 644 644 uint flags; ··· 835 835 */ 836 836 return -ENODATA; 837 837 838 + /* fixup the endianness so crc8 will pass */ 839 + cpu_to_le16_buf(buf, sz); 838 840 if (crc8(brcms_srom_crc8_table, (u8 *) buf, sz * 2, 839 841 CRC8_INIT_VALUE) != CRC8_GOOD_VALUE(brcms_srom_crc8_table)) 840 842 err = -EIO;
+43 -124
drivers/net/wireless/brcm80211/brcmutil/utils.c
··· 41 41 /* Free the driver packet. Free the tag if present */ 42 42 void brcmu_pkt_buf_free_skb(struct sk_buff *skb) 43 43 { 44 - struct sk_buff *nskb; 45 - int nest = 0; 46 - 47 - /* perversion: we use skb->next to chain multi-skb packets */ 48 - while (skb) { 49 - nskb = skb->next; 50 - skb->next = NULL; 51 - 52 - if (skb->destructor) 53 - /* cannot kfree_skb() on hard IRQ (net/core/skbuff.c) if 54 - * destructor exists 55 - */ 56 - dev_kfree_skb_any(skb); 57 - else 58 - /* can free immediately (even in_irq()) if destructor 59 - * does not exist 60 - */ 61 - dev_kfree_skb(skb); 62 - 63 - nest++; 64 - skb = nskb; 65 - } 44 + WARN_ON(skb->next); 45 + if (skb->destructor) 46 + /* cannot kfree_skb() on hard IRQ (net/core/skbuff.c) if 47 + * destructor exists 48 + */ 49 + dev_kfree_skb_any(skb); 50 + else 51 + /* can free immediately (even in_irq()) if destructor 52 + * does not exist 53 + */ 54 + dev_kfree_skb(skb); 66 55 } 67 56 EXPORT_SYMBOL(brcmu_pkt_buf_free_skb); 68 - 69 - 70 - /* return total length of buffer chain */ 71 - uint brcmu_pkttotlen(struct sk_buff *p) 72 - { 73 - uint total; 74 - 75 - total = 0; 76 - for (; p; p = p->next) 77 - total += p->len; 78 - return total; 79 - } 80 - EXPORT_SYMBOL(brcmu_pkttotlen); 81 57 82 58 /* 83 59 * osl multiple-precedence packet queue ··· 62 86 struct sk_buff *brcmu_pktq_penq(struct pktq *pq, int prec, 63 87 struct sk_buff *p) 64 88 { 65 - struct pktq_prec *q; 89 + struct sk_buff_head *q; 66 90 67 91 if (pktq_full(pq) || pktq_pfull(pq, prec)) 68 92 return NULL; 69 93 70 - q = &pq->q[prec]; 71 - 72 - if (q->head) 73 - q->tail->prev = p; 74 - else 75 - q->head = p; 76 - 77 - q->tail = p; 78 - q->len++; 79 - 94 + q = &pq->q[prec].skblist; 95 + skb_queue_tail(q, p); 80 96 pq->len++; 81 97 82 98 if (pq->hi_prec < prec) ··· 81 113 struct sk_buff *brcmu_pktq_penq_head(struct pktq *pq, int prec, 82 114 struct sk_buff *p) 83 115 { 84 - struct pktq_prec *q; 116 + struct sk_buff_head *q; 85 117 86 118 if (pktq_full(pq) || pktq_pfull(pq, prec)) 87 119 return NULL; 88 120 89 - q = &pq->q[prec]; 90 - 91 - if (q->head == NULL) 92 - q->tail = p; 93 - 94 - p->prev = q->head; 95 - q->head = p; 96 - q->len++; 97 - 121 + q = &pq->q[prec].skblist; 122 + skb_queue_head(q, p); 98 123 pq->len++; 99 124 100 125 if (pq->hi_prec < prec) ··· 99 138 100 139 struct sk_buff *brcmu_pktq_pdeq(struct pktq *pq, int prec) 101 140 { 102 - struct pktq_prec *q; 141 + struct sk_buff_head *q; 103 142 struct sk_buff *p; 104 143 105 - q = &pq->q[prec]; 106 - 107 - p = q->head; 144 + q = &pq->q[prec].skblist; 145 + p = skb_dequeue(q); 108 146 if (p == NULL) 109 147 return NULL; 110 148 111 - q->head = p->prev; 112 - if (q->head == NULL) 113 - q->tail = NULL; 114 - 115 - q->len--; 116 - 117 149 pq->len--; 118 - 119 - p->prev = NULL; 120 - 121 150 return p; 122 151 } 123 152 EXPORT_SYMBOL(brcmu_pktq_pdeq); 124 153 125 154 struct sk_buff *brcmu_pktq_pdeq_tail(struct pktq *pq, int prec) 126 155 { 127 - struct pktq_prec *q; 128 - struct sk_buff *p, *prev; 156 + struct sk_buff_head *q; 157 + struct sk_buff *p; 129 158 130 - q = &pq->q[prec]; 131 - 132 - p = q->head; 159 + q = &pq->q[prec].skblist; 160 + p = skb_dequeue_tail(q); 133 161 if (p == NULL) 134 162 return NULL; 135 163 136 - for (prev = NULL; p != q->tail; p = p->prev) 137 - prev = p; 138 - 139 - if (prev) 140 - prev->prev = NULL; 141 - else 142 - q->head = NULL; 143 - 144 - q->tail = prev; 145 - q->len--; 146 - 147 164 pq->len--; 148 - 149 165 return p; 150 166 } 151 167 EXPORT_SYMBOL(brcmu_pktq_pdeq_tail); ··· 131 193 brcmu_pktq_pflush(struct pktq *pq, int prec, bool dir, 132 194 bool (*fn)(struct sk_buff *, void *), void *arg) 133 195 { 134 - struct pktq_prec *q; 135 - struct sk_buff *p, *prev = NULL; 196 + struct sk_buff_head *q; 197 + struct sk_buff *p, *next; 136 198 137 - q = &pq->q[prec]; 138 - p = q->head; 139 - while (p) { 199 + q = &pq->q[prec].skblist; 200 + skb_queue_walk_safe(q, p, next) { 140 201 if (fn == NULL || (*fn) (p, arg)) { 141 - bool head = (p == q->head); 142 - if (head) 143 - q->head = p->prev; 144 - else 145 - prev->prev = p->prev; 146 - p->prev = NULL; 202 + skb_unlink(p, q); 147 203 brcmu_pkt_buf_free_skb(p); 148 - q->len--; 149 204 pq->len--; 150 - p = (head ? q->head : prev->prev); 151 - } else { 152 - prev = p; 153 - p = p->prev; 154 205 } 155 206 } 156 - 157 - if (q->head == NULL) 158 - q->tail = NULL; 159 207 } 160 208 EXPORT_SYMBOL(brcmu_pktq_pflush); 161 209 ··· 166 242 167 243 pq->max = (u16) max_len; 168 244 169 - for (prec = 0; prec < num_prec; prec++) 245 + for (prec = 0; prec < num_prec; prec++) { 170 246 pq->q[prec].max = pq->max; 247 + skb_queue_head_init(&pq->q[prec].skblist); 248 + } 171 249 } 172 250 EXPORT_SYMBOL(brcmu_pktq_init); 173 251 ··· 181 255 return NULL; 182 256 183 257 for (prec = 0; prec < pq->hi_prec; prec++) 184 - if (pq->q[prec].head) 258 + if (!skb_queue_empty(&pq->q[prec].skblist)) 185 259 break; 186 260 187 261 if (prec_out) 188 262 *prec_out = prec; 189 263 190 - return pq->q[prec].tail; 264 + return skb_peek_tail(&pq->q[prec].skblist); 191 265 } 192 266 EXPORT_SYMBOL(brcmu_pktq_peek_tail); 193 267 ··· 200 274 201 275 for (prec = 0; prec <= pq->hi_prec; prec++) 202 276 if (prec_bmp & (1 << prec)) 203 - len += pq->q[prec].len; 277 + len += pq->q[prec].skblist.qlen; 204 278 205 279 return len; 206 280 } ··· 210 284 struct sk_buff *brcmu_pktq_mdeq(struct pktq *pq, uint prec_bmp, 211 285 int *prec_out) 212 286 { 213 - struct pktq_prec *q; 287 + struct sk_buff_head *q; 214 288 struct sk_buff *p; 215 289 int prec; 216 290 217 291 if (pq->len == 0) 218 292 return NULL; 219 293 220 - while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL) 294 + while ((prec = pq->hi_prec) > 0 && 295 + skb_queue_empty(&pq->q[prec].skblist)) 221 296 pq->hi_prec--; 222 297 223 - while ((prec_bmp & (1 << prec)) == 0 || pq->q[prec].head == NULL) 298 + while ((prec_bmp & (1 << prec)) == 0 || 299 + skb_queue_empty(&pq->q[prec].skblist)) 224 300 if (prec-- == 0) 225 301 return NULL; 226 302 227 - q = &pq->q[prec]; 228 - 229 - p = q->head; 303 + q = &pq->q[prec].skblist; 304 + p = skb_dequeue(q); 230 305 if (p == NULL) 231 306 return NULL; 232 307 233 - q->head = p->prev; 234 - if (q->head == NULL) 235 - q->tail = NULL; 236 - 237 - q->len--; 308 + pq->len--; 238 309 239 310 if (prec_out) 240 311 *prec_out = prec; 241 - 242 - pq->len--; 243 - 244 - p->prev = NULL; 245 312 246 313 return p; 247 314 }
+7 -12
drivers/net/wireless/brcm80211/include/brcmu_utils.h
··· 65 65 #define ETHER_ADDR_STR_LEN 18 66 66 67 67 struct pktq_prec { 68 - struct sk_buff *head; /* first packet to dequeue */ 69 - struct sk_buff *tail; /* last packet to dequeue */ 70 - u16 len; /* number of queued packets */ 68 + struct sk_buff_head skblist; 71 69 u16 max; /* maximum number of queued packets */ 72 70 }; 73 71 ··· 86 88 87 89 static inline int pktq_plen(struct pktq *pq, int prec) 88 90 { 89 - return pq->q[prec].len; 91 + return pq->q[prec].skblist.qlen; 90 92 } 91 93 92 94 static inline int pktq_pavail(struct pktq *pq, int prec) 93 95 { 94 - return pq->q[prec].max - pq->q[prec].len; 96 + return pq->q[prec].max - pq->q[prec].skblist.qlen; 95 97 } 96 98 97 99 static inline bool pktq_pfull(struct pktq *pq, int prec) 98 100 { 99 - return pq->q[prec].len >= pq->q[prec].max; 101 + return pq->q[prec].skblist.qlen >= pq->q[prec].max; 100 102 } 101 103 102 104 static inline bool pktq_pempty(struct pktq *pq, int prec) 103 105 { 104 - return pq->q[prec].len == 0; 106 + return skb_queue_empty(&pq->q[prec].skblist); 105 107 } 106 108 107 109 static inline struct sk_buff *pktq_ppeek(struct pktq *pq, int prec) 108 110 { 109 - return pq->q[prec].head; 111 + return skb_peek(&pq->q[prec].skblist); 110 112 } 111 113 112 114 static inline struct sk_buff *pktq_ppeek_tail(struct pktq *pq, int prec) 113 115 { 114 - return pq->q[prec].tail; 116 + return skb_peek_tail(&pq->q[prec].skblist); 115 117 } 116 118 117 119 extern struct sk_buff *brcmu_pktq_penq(struct pktq *pq, int prec, ··· 170 172 bool (*fn)(struct sk_buff *, void *), void *arg); 171 173 172 174 /* externs */ 173 - /* packet */ 174 - extern uint brcmu_pkttotlen(struct sk_buff *p); 175 - 176 175 /* ip address */ 177 176 struct ipv4_addr; 178 177
+2 -2
drivers/net/wireless/hostap/hostap_ioctl.c
··· 3871 3871 iface = netdev_priv(dev); 3872 3872 local = iface->local; 3873 3873 3874 - strncpy(info->driver, "hostap", sizeof(info->driver) - 1); 3875 - snprintf(info->fw_version, sizeof(info->fw_version) - 1, 3874 + strlcpy(info->driver, "hostap", sizeof(info->driver)); 3875 + snprintf(info->fw_version, sizeof(info->fw_version), 3876 3876 "%d.%d.%d", (local->sta_fw_ver >> 16) & 0xff, 3877 3877 (local->sta_fw_ver >> 8) & 0xff, 3878 3878 local->sta_fw_ver & 0xff);
+4 -3
drivers/net/wireless/ipw2x00/ipw2100.c
··· 5981 5981 struct ipw2100_priv *priv = libipw_priv(dev); 5982 5982 char fw_ver[64], ucode_ver[64]; 5983 5983 5984 - strcpy(info->driver, DRV_NAME); 5985 - strcpy(info->version, DRV_VERSION); 5984 + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); 5985 + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); 5986 5986 5987 5987 ipw2100_get_fwversion(priv, fw_ver, sizeof(fw_ver)); 5988 5988 ipw2100_get_ucodeversion(priv, ucode_ver, sizeof(ucode_ver)); ··· 5990 5990 snprintf(info->fw_version, sizeof(info->fw_version), "%s:%d:%s", 5991 5991 fw_ver, priv->eeprom_version, ucode_ver); 5992 5992 5993 - strcpy(info->bus_info, pci_name(priv->pci_dev)); 5993 + strlcpy(info->bus_info, pci_name(priv->pci_dev), 5994 + sizeof(info->bus_info)); 5994 5995 } 5995 5996 5996 5997 static u32 ipw2100_ethtool_get_link(struct net_device *dev)
+12 -3
drivers/net/wireless/ipw2x00/ipw2200.c
··· 131 131 #define ipw2200_bg_rates (ipw2200_rates + 0) 132 132 #define ipw2200_num_bg_rates 12 133 133 134 + /* Ugly macro to convert literal channel numbers into their mhz equivalents 135 + * There are certianly some conditions that will break this (like feeding it '30') 136 + * but they shouldn't arise since nothing talks on channel 30. */ 137 + #define ieee80211chan2mhz(x) \ 138 + (((x) <= 14) ? \ 139 + (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \ 140 + ((x) + 1000) * 5) 141 + 134 142 #ifdef CONFIG_IPW2200_QOS 135 143 static int qos_enable = 0; 136 144 static int qos_burst_enable = 0; ··· 10548 10540 char date[32]; 10549 10541 u32 len; 10550 10542 10551 - strcpy(info->driver, DRV_NAME); 10552 - strcpy(info->version, DRV_VERSION); 10543 + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); 10544 + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); 10553 10545 10554 10546 len = sizeof(vers); 10555 10547 ipw_get_ordinal(p, IPW_ORD_STAT_FW_VERSION, vers, &len); ··· 10558 10550 10559 10551 snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)", 10560 10552 vers, date); 10561 - strcpy(info->bus_info, pci_name(p->pci_dev)); 10553 + strlcpy(info->bus_info, pci_name(p->pci_dev), 10554 + sizeof(info->bus_info)); 10562 10555 info->eedump_len = IPW_EEPROM_IMAGE_SIZE; 10563 10556 } 10564 10557
+1 -1
drivers/net/wireless/iwlwifi/Makefile
··· 1 1 # WIFI 2 2 obj-$(CONFIG_IWLWIFI) += iwlwifi.o 3 - iwlwifi-objs := iwl-agn.o iwl-agn-rs.o 3 + iwlwifi-objs := iwl-agn.o iwl-agn-rs.o iwl-mac80211.o 4 4 iwlwifi-objs += iwl-agn-ucode.o iwl-agn-tx.o 5 5 iwlwifi-objs += iwl-agn-lib.o iwl-agn-calib.o iwl-io.o 6 6 iwlwifi-objs += iwl-agn-tt.o iwl-agn-sta.o iwl-agn-rx.o
-20
drivers/net/wireless/iwlwifi/iwl-2000.c
··· 270 270 .ht_params = &iwl2000_ht_params, 271 271 }; 272 272 273 - struct iwl_cfg iwl2000_2bg_cfg = { 274 - .name = "2000 Series 2x2 BG", 275 - IWL_DEVICE_2000, 276 - }; 277 - 278 273 struct iwl_cfg iwl2000_2bgn_d_cfg = { 279 274 .name = "2000D Series 2x2 BGN", 280 275 IWL_DEVICE_2000, ··· 299 304 .ht_params = &iwl2000_ht_params, 300 305 }; 301 306 302 - struct iwl_cfg iwl2030_2bg_cfg = { 303 - .name = "2000 Series 2x2 BG/BT", 304 - IWL_DEVICE_2030, 305 - }; 306 - 307 307 #define IWL_DEVICE_105 \ 308 308 .fw_name_pre = IWL105_FW_PRE, \ 309 309 .ucode_api_max = IWL105_UCODE_API_MAX, \ ··· 315 325 .adv_pm = true, \ 316 326 .rx_with_siso_diversity = true, \ 317 327 .iq_invert = true \ 318 - 319 - struct iwl_cfg iwl105_bg_cfg = { 320 - .name = "105 Series 1x1 BG", 321 - IWL_DEVICE_105, 322 - }; 323 328 324 329 struct iwl_cfg iwl105_bgn_cfg = { 325 330 .name = "105 Series 1x1 BGN", ··· 345 360 .adv_pm = true, \ 346 361 .rx_with_siso_diversity = true, \ 347 362 .iq_invert = true \ 348 - 349 - struct iwl_cfg iwl135_bg_cfg = { 350 - .name = "135 Series 1x1 BG/BT", 351 - IWL_DEVICE_135, 352 - }; 353 363 354 364 struct iwl_cfg iwl135_bgn_cfg = { 355 365 .name = "135 Series 1x1 BGN/BT",
-10
drivers/net/wireless/iwlwifi/iwl-6000.c
··· 439 439 .ht_params = &iwl6000_ht_params, 440 440 }; 441 441 442 - struct iwl_cfg iwl6035_2abg_cfg = { 443 - .name = "6035 Series 2x2 ABG/BT", 444 - IWL_DEVICE_6030, 445 - }; 446 - 447 - struct iwl_cfg iwl6035_2bg_cfg = { 448 - .name = "6035 Series 2x2 BG/BT", 449 - IWL_DEVICE_6030, 450 - }; 451 - 452 442 struct iwl_cfg iwl1030_bgn_cfg = { 453 443 .name = "Intel(R) Centrino(R) Wireless-N 1030 BGN", 454 444 IWL_DEVICE_6030,
+358
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
··· 827 827 case IEEE80211_SMPS_STATIC: 828 828 case IEEE80211_SMPS_DYNAMIC: 829 829 return IWL_NUM_IDLE_CHAINS_SINGLE; 830 + case IEEE80211_SMPS_AUTOMATIC: 830 831 case IEEE80211_SMPS_OFF: 831 832 return active_cnt; 832 833 default: ··· 984 983 list_del(&wait_entry->list); 985 984 spin_unlock_bh(&priv->notif_wait_lock); 986 985 } 986 + 987 + #ifdef CONFIG_PM_SLEEP 988 + static void iwlagn_convert_p1k(u16 *p1k, __le16 *out) 989 + { 990 + int i; 991 + 992 + for (i = 0; i < IWLAGN_P1K_SIZE; i++) 993 + out[i] = cpu_to_le16(p1k[i]); 994 + } 995 + 996 + struct wowlan_key_data { 997 + struct iwl_rxon_context *ctx; 998 + struct iwlagn_wowlan_rsc_tsc_params_cmd *rsc_tsc; 999 + struct iwlagn_wowlan_tkip_params_cmd *tkip; 1000 + const u8 *bssid; 1001 + bool error, use_rsc_tsc, use_tkip; 1002 + }; 1003 + 1004 + 1005 + static void iwlagn_wowlan_program_keys(struct ieee80211_hw *hw, 1006 + struct ieee80211_vif *vif, 1007 + struct ieee80211_sta *sta, 1008 + struct ieee80211_key_conf *key, 1009 + void *_data) 1010 + { 1011 + struct iwl_priv *priv = hw->priv; 1012 + struct wowlan_key_data *data = _data; 1013 + struct iwl_rxon_context *ctx = data->ctx; 1014 + struct aes_sc *aes_sc, *aes_tx_sc = NULL; 1015 + struct tkip_sc *tkip_sc, *tkip_tx_sc = NULL; 1016 + struct iwlagn_p1k_cache *rx_p1ks; 1017 + u8 *rx_mic_key; 1018 + struct ieee80211_key_seq seq; 1019 + u32 cur_rx_iv32 = 0; 1020 + u16 p1k[IWLAGN_P1K_SIZE]; 1021 + int ret, i; 1022 + 1023 + mutex_lock(&priv->shrd->mutex); 1024 + 1025 + if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 || 1026 + key->cipher == WLAN_CIPHER_SUITE_WEP104) && 1027 + !sta && !ctx->key_mapping_keys) 1028 + ret = iwl_set_default_wep_key(priv, ctx, key); 1029 + else 1030 + ret = iwl_set_dynamic_key(priv, ctx, key, sta); 1031 + 1032 + if (ret) { 1033 + IWL_ERR(priv, "Error setting key during suspend!\n"); 1034 + data->error = true; 1035 + } 1036 + 1037 + switch (key->cipher) { 1038 + case WLAN_CIPHER_SUITE_TKIP: 1039 + if (sta) { 1040 + tkip_sc = data->rsc_tsc->all_tsc_rsc.tkip.unicast_rsc; 1041 + tkip_tx_sc = &data->rsc_tsc->all_tsc_rsc.tkip.tsc; 1042 + 1043 + rx_p1ks = data->tkip->rx_uni; 1044 + 1045 + ieee80211_get_key_tx_seq(key, &seq); 1046 + tkip_tx_sc->iv16 = cpu_to_le16(seq.tkip.iv16); 1047 + tkip_tx_sc->iv32 = cpu_to_le32(seq.tkip.iv32); 1048 + 1049 + ieee80211_get_tkip_p1k_iv(key, seq.tkip.iv32, p1k); 1050 + iwlagn_convert_p1k(p1k, data->tkip->tx.p1k); 1051 + 1052 + memcpy(data->tkip->mic_keys.tx, 1053 + &key->key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY], 1054 + IWLAGN_MIC_KEY_SIZE); 1055 + 1056 + rx_mic_key = data->tkip->mic_keys.rx_unicast; 1057 + } else { 1058 + tkip_sc = 1059 + data->rsc_tsc->all_tsc_rsc.tkip.multicast_rsc; 1060 + rx_p1ks = data->tkip->rx_multi; 1061 + rx_mic_key = data->tkip->mic_keys.rx_mcast; 1062 + } 1063 + 1064 + /* 1065 + * For non-QoS this relies on the fact that both the uCode and 1066 + * mac80211 use TID 0 (as they need to to avoid replay attacks) 1067 + * for checking the IV in the frames. 1068 + */ 1069 + for (i = 0; i < IWLAGN_NUM_RSC; i++) { 1070 + ieee80211_get_key_rx_seq(key, i, &seq); 1071 + tkip_sc[i].iv16 = cpu_to_le16(seq.tkip.iv16); 1072 + tkip_sc[i].iv32 = cpu_to_le32(seq.tkip.iv32); 1073 + /* wrapping isn't allowed, AP must rekey */ 1074 + if (seq.tkip.iv32 > cur_rx_iv32) 1075 + cur_rx_iv32 = seq.tkip.iv32; 1076 + } 1077 + 1078 + ieee80211_get_tkip_rx_p1k(key, data->bssid, cur_rx_iv32, p1k); 1079 + iwlagn_convert_p1k(p1k, rx_p1ks[0].p1k); 1080 + ieee80211_get_tkip_rx_p1k(key, data->bssid, 1081 + cur_rx_iv32 + 1, p1k); 1082 + iwlagn_convert_p1k(p1k, rx_p1ks[1].p1k); 1083 + 1084 + memcpy(rx_mic_key, 1085 + &key->key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY], 1086 + IWLAGN_MIC_KEY_SIZE); 1087 + 1088 + data->use_tkip = true; 1089 + data->use_rsc_tsc = true; 1090 + break; 1091 + case WLAN_CIPHER_SUITE_CCMP: 1092 + if (sta) { 1093 + u8 *pn = seq.ccmp.pn; 1094 + 1095 + aes_sc = data->rsc_tsc->all_tsc_rsc.aes.unicast_rsc; 1096 + aes_tx_sc = &data->rsc_tsc->all_tsc_rsc.aes.tsc; 1097 + 1098 + ieee80211_get_key_tx_seq(key, &seq); 1099 + aes_tx_sc->pn = cpu_to_le64( 1100 + (u64)pn[5] | 1101 + ((u64)pn[4] << 8) | 1102 + ((u64)pn[3] << 16) | 1103 + ((u64)pn[2] << 24) | 1104 + ((u64)pn[1] << 32) | 1105 + ((u64)pn[0] << 40)); 1106 + } else 1107 + aes_sc = data->rsc_tsc->all_tsc_rsc.aes.multicast_rsc; 1108 + 1109 + /* 1110 + * For non-QoS this relies on the fact that both the uCode and 1111 + * mac80211 use TID 0 for checking the IV in the frames. 1112 + */ 1113 + for (i = 0; i < IWLAGN_NUM_RSC; i++) { 1114 + u8 *pn = seq.ccmp.pn; 1115 + 1116 + ieee80211_get_key_rx_seq(key, i, &seq); 1117 + aes_sc->pn = cpu_to_le64( 1118 + (u64)pn[5] | 1119 + ((u64)pn[4] << 8) | 1120 + ((u64)pn[3] << 16) | 1121 + ((u64)pn[2] << 24) | 1122 + ((u64)pn[1] << 32) | 1123 + ((u64)pn[0] << 40)); 1124 + } 1125 + data->use_rsc_tsc = true; 1126 + break; 1127 + } 1128 + 1129 + mutex_unlock(&priv->shrd->mutex); 1130 + } 1131 + 1132 + int iwlagn_send_patterns(struct iwl_priv *priv, 1133 + struct cfg80211_wowlan *wowlan) 1134 + { 1135 + struct iwlagn_wowlan_patterns_cmd *pattern_cmd; 1136 + struct iwl_host_cmd cmd = { 1137 + .id = REPLY_WOWLAN_PATTERNS, 1138 + .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 1139 + .flags = CMD_SYNC, 1140 + }; 1141 + int i, err; 1142 + 1143 + if (!wowlan->n_patterns) 1144 + return 0; 1145 + 1146 + cmd.len[0] = sizeof(*pattern_cmd) + 1147 + wowlan->n_patterns * sizeof(struct iwlagn_wowlan_pattern); 1148 + 1149 + pattern_cmd = kmalloc(cmd.len[0], GFP_KERNEL); 1150 + if (!pattern_cmd) 1151 + return -ENOMEM; 1152 + 1153 + pattern_cmd->n_patterns = cpu_to_le32(wowlan->n_patterns); 1154 + 1155 + for (i = 0; i < wowlan->n_patterns; i++) { 1156 + int mask_len = DIV_ROUND_UP(wowlan->patterns[i].pattern_len, 8); 1157 + 1158 + memcpy(&pattern_cmd->patterns[i].mask, 1159 + wowlan->patterns[i].mask, mask_len); 1160 + memcpy(&pattern_cmd->patterns[i].pattern, 1161 + wowlan->patterns[i].pattern, 1162 + wowlan->patterns[i].pattern_len); 1163 + pattern_cmd->patterns[i].mask_size = mask_len; 1164 + pattern_cmd->patterns[i].pattern_size = 1165 + wowlan->patterns[i].pattern_len; 1166 + } 1167 + 1168 + cmd.data[0] = pattern_cmd; 1169 + err = iwl_trans_send_cmd(trans(priv), &cmd); 1170 + kfree(pattern_cmd); 1171 + return err; 1172 + } 1173 + 1174 + int iwlagn_suspend(struct iwl_priv *priv, 1175 + struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) 1176 + { 1177 + struct iwlagn_wowlan_wakeup_filter_cmd wakeup_filter_cmd; 1178 + struct iwl_rxon_cmd rxon; 1179 + struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1180 + struct iwlagn_wowlan_kek_kck_material_cmd kek_kck_cmd; 1181 + struct iwlagn_wowlan_tkip_params_cmd tkip_cmd = {}; 1182 + struct iwlagn_d3_config_cmd d3_cfg_cmd = {}; 1183 + struct wowlan_key_data key_data = { 1184 + .ctx = ctx, 1185 + .bssid = ctx->active.bssid_addr, 1186 + .use_rsc_tsc = false, 1187 + .tkip = &tkip_cmd, 1188 + .use_tkip = false, 1189 + }; 1190 + int ret, i; 1191 + u16 seq; 1192 + 1193 + key_data.rsc_tsc = kzalloc(sizeof(*key_data.rsc_tsc), GFP_KERNEL); 1194 + if (!key_data.rsc_tsc) 1195 + return -ENOMEM; 1196 + 1197 + memset(&wakeup_filter_cmd, 0, sizeof(wakeup_filter_cmd)); 1198 + 1199 + /* 1200 + * We know the last used seqno, and the uCode expects to know that 1201 + * one, it will increment before TX. 1202 + */ 1203 + seq = le16_to_cpu(priv->last_seq_ctl) & IEEE80211_SCTL_SEQ; 1204 + wakeup_filter_cmd.non_qos_seq = cpu_to_le16(seq); 1205 + 1206 + /* 1207 + * For QoS counters, we store the one to use next, so subtract 0x10 1208 + * since the uCode will add 0x10 before using the value. 1209 + */ 1210 + for (i = 0; i < 8; i++) { 1211 + seq = priv->shrd->tid_data[IWL_AP_ID][i].seq_number; 1212 + seq -= 0x10; 1213 + wakeup_filter_cmd.qos_seq[i] = cpu_to_le16(seq); 1214 + } 1215 + 1216 + if (wowlan->disconnect) 1217 + wakeup_filter_cmd.enabled |= 1218 + cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_BEACON_MISS | 1219 + IWLAGN_WOWLAN_WAKEUP_LINK_CHANGE); 1220 + if (wowlan->magic_pkt) 1221 + wakeup_filter_cmd.enabled |= 1222 + cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_MAGIC_PACKET); 1223 + if (wowlan->gtk_rekey_failure) 1224 + wakeup_filter_cmd.enabled |= 1225 + cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_GTK_REKEY_FAIL); 1226 + if (wowlan->eap_identity_req) 1227 + wakeup_filter_cmd.enabled |= 1228 + cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_EAP_IDENT_REQ); 1229 + if (wowlan->four_way_handshake) 1230 + wakeup_filter_cmd.enabled |= 1231 + cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_4WAY_HANDSHAKE); 1232 + if (wowlan->n_patterns) 1233 + wakeup_filter_cmd.enabled |= 1234 + cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_PATTERN_MATCH); 1235 + 1236 + if (wowlan->rfkill_release) 1237 + d3_cfg_cmd.wakeup_flags |= 1238 + cpu_to_le32(IWLAGN_D3_WAKEUP_RFKILL); 1239 + 1240 + iwl_scan_cancel_timeout(priv, 200); 1241 + 1242 + memcpy(&rxon, &ctx->active, sizeof(rxon)); 1243 + 1244 + iwl_trans_stop_device(trans(priv)); 1245 + 1246 + priv->shrd->wowlan = true; 1247 + 1248 + ret = iwlagn_load_ucode_wait_alive(priv, IWL_UCODE_WOWLAN); 1249 + if (ret) 1250 + goto out; 1251 + 1252 + /* now configure WoWLAN ucode */ 1253 + ret = iwl_alive_start(priv); 1254 + if (ret) 1255 + goto out; 1256 + 1257 + memcpy(&ctx->staging, &rxon, sizeof(rxon)); 1258 + ret = iwlagn_commit_rxon(priv, ctx); 1259 + if (ret) 1260 + goto out; 1261 + 1262 + ret = iwl_power_update_mode(priv, true); 1263 + if (ret) 1264 + goto out; 1265 + 1266 + if (!iwlagn_mod_params.sw_crypto) { 1267 + /* mark all keys clear */ 1268 + priv->ucode_key_table = 0; 1269 + ctx->key_mapping_keys = 0; 1270 + 1271 + /* 1272 + * This needs to be unlocked due to lock ordering 1273 + * constraints. Since we're in the suspend path 1274 + * that isn't really a problem though. 1275 + */ 1276 + mutex_unlock(&priv->shrd->mutex); 1277 + ieee80211_iter_keys(priv->hw, ctx->vif, 1278 + iwlagn_wowlan_program_keys, 1279 + &key_data); 1280 + mutex_lock(&priv->shrd->mutex); 1281 + if (key_data.error) { 1282 + ret = -EIO; 1283 + goto out; 1284 + } 1285 + 1286 + if (key_data.use_rsc_tsc) { 1287 + struct iwl_host_cmd rsc_tsc_cmd = { 1288 + .id = REPLY_WOWLAN_TSC_RSC_PARAMS, 1289 + .flags = CMD_SYNC, 1290 + .data[0] = key_data.rsc_tsc, 1291 + .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 1292 + .len[0] = sizeof(key_data.rsc_tsc), 1293 + }; 1294 + 1295 + ret = iwl_trans_send_cmd(trans(priv), &rsc_tsc_cmd); 1296 + if (ret) 1297 + goto out; 1298 + } 1299 + 1300 + if (key_data.use_tkip) { 1301 + ret = iwl_trans_send_cmd_pdu(trans(priv), 1302 + REPLY_WOWLAN_TKIP_PARAMS, 1303 + CMD_SYNC, sizeof(tkip_cmd), 1304 + &tkip_cmd); 1305 + if (ret) 1306 + goto out; 1307 + } 1308 + 1309 + if (priv->have_rekey_data) { 1310 + memset(&kek_kck_cmd, 0, sizeof(kek_kck_cmd)); 1311 + memcpy(kek_kck_cmd.kck, priv->kck, NL80211_KCK_LEN); 1312 + kek_kck_cmd.kck_len = cpu_to_le16(NL80211_KCK_LEN); 1313 + memcpy(kek_kck_cmd.kek, priv->kek, NL80211_KEK_LEN); 1314 + kek_kck_cmd.kek_len = cpu_to_le16(NL80211_KEK_LEN); 1315 + kek_kck_cmd.replay_ctr = priv->replay_ctr; 1316 + 1317 + ret = iwl_trans_send_cmd_pdu(trans(priv), 1318 + REPLY_WOWLAN_KEK_KCK_MATERIAL, 1319 + CMD_SYNC, sizeof(kek_kck_cmd), 1320 + &kek_kck_cmd); 1321 + if (ret) 1322 + goto out; 1323 + } 1324 + } 1325 + 1326 + ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_D3_CONFIG, CMD_SYNC, 1327 + sizeof(d3_cfg_cmd), &d3_cfg_cmd); 1328 + if (ret) 1329 + goto out; 1330 + 1331 + ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_WOWLAN_WAKEUP_FILTER, 1332 + CMD_SYNC, sizeof(wakeup_filter_cmd), 1333 + &wakeup_filter_cmd); 1334 + if (ret) 1335 + goto out; 1336 + 1337 + ret = iwlagn_send_patterns(priv, wowlan); 1338 + out: 1339 + kfree(key_data.rsc_tsc); 1340 + return ret; 1341 + } 1342 + #endif
+2 -6
drivers/net/wireless/iwlwifi/iwl-agn-rs.c
··· 1458 1458 break; 1459 1459 case IWL_BT_COEX_TRAFFIC_LOAD_LOW: 1460 1460 /* avoid antenna B unless MIMO */ 1461 - valid_tx_ant = 1462 - first_antenna(hw_params(priv).valid_tx_ant); 1463 1461 if (tbl->action == IWL_LEGACY_SWITCH_ANTENNA2) 1464 - tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; 1462 + tbl->action = IWL_LEGACY_SWITCH_SISO; 1465 1463 break; 1466 1464 case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: 1467 1465 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: ··· 1634 1636 break; 1635 1637 case IWL_BT_COEX_TRAFFIC_LOAD_LOW: 1636 1638 /* avoid antenna B unless MIMO */ 1637 - valid_tx_ant = 1638 - first_antenna(hw_params(priv).valid_tx_ant); 1639 1639 if (tbl->action == IWL_SISO_SWITCH_ANTENNA2) 1640 - tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1640 + tbl->action = IWL_SISO_SWITCH_MIMO2_AB; 1641 1641 break; 1642 1642 case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: 1643 1643 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
+48 -1
drivers/net/wireless/iwlwifi/iwl-agn-rx.c
··· 800 800 ctx->active.bssid_addr)) 801 801 continue; 802 802 ctx->last_tx_rejected = false; 803 - iwl_trans_wake_any_queue(trans(priv), ctx->ctxid); 803 + iwl_trans_wake_any_queue(trans(priv), ctx->ctxid, 804 + "channel got active"); 804 805 } 805 806 } 806 807 ··· 1033 1032 return 0; 1034 1033 } 1035 1034 1035 + static int iwlagn_rx_noa_notification(struct iwl_priv *priv, 1036 + struct iwl_rx_mem_buffer *rxb, 1037 + struct iwl_device_cmd *cmd) 1038 + { 1039 + struct iwl_wipan_noa_data *new_data, *old_data; 1040 + struct iwl_rx_packet *pkt = rxb_addr(rxb); 1041 + struct iwl_wipan_noa_notification *noa_notif = (void *)pkt->u.raw; 1042 + 1043 + /* no condition -- we're in softirq */ 1044 + old_data = rcu_dereference_protected(priv->noa_data, true); 1045 + 1046 + if (noa_notif->noa_active) { 1047 + u32 len = le16_to_cpu(noa_notif->noa_attribute.length); 1048 + u32 copylen = len; 1049 + 1050 + /* EID, len, OUI, subtype */ 1051 + len += 1 + 1 + 3 + 1; 1052 + /* P2P id, P2P length */ 1053 + len += 1 + 2; 1054 + copylen += 1 + 2; 1055 + 1056 + new_data = kmalloc(sizeof(*new_data) + len, GFP_ATOMIC); 1057 + if (new_data) { 1058 + new_data->length = len; 1059 + new_data->data[0] = WLAN_EID_VENDOR_SPECIFIC; 1060 + new_data->data[1] = len - 2; /* not counting EID, len */ 1061 + new_data->data[2] = (WLAN_OUI_WFA >> 16) & 0xff; 1062 + new_data->data[3] = (WLAN_OUI_WFA >> 8) & 0xff; 1063 + new_data->data[4] = (WLAN_OUI_WFA >> 0) & 0xff; 1064 + new_data->data[5] = WLAN_OUI_TYPE_WFA_P2P; 1065 + memcpy(&new_data->data[6], &noa_notif->noa_attribute, 1066 + copylen); 1067 + } 1068 + } else 1069 + new_data = NULL; 1070 + 1071 + rcu_assign_pointer(priv->noa_data, new_data); 1072 + 1073 + if (old_data) 1074 + kfree_rcu(old_data, rcu_head); 1075 + 1076 + return 0; 1077 + } 1078 + 1036 1079 /** 1037 1080 * iwl_setup_rx_handlers - Initialize Rx handler callbacks 1038 1081 * ··· 1099 1054 iwlagn_rx_pm_debug_statistics_notif; 1100 1055 handlers[BEACON_NOTIFICATION] = iwlagn_rx_beacon_notif; 1101 1056 handlers[REPLY_ADD_STA] = iwl_add_sta_callback; 1057 + 1058 + handlers[REPLY_WIPAN_NOA_NOTIFICATION] = iwlagn_rx_noa_notification; 1102 1059 1103 1060 /* 1104 1061 * The same handler is used for both the REPLY to a discrete
+9 -4
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
··· 45 45 send->filter_flags = old_filter; 46 46 47 47 if (ret) 48 - IWL_ERR(priv, "Error clearing ASSOC_MSK on BSS (%d)\n", ret); 48 + IWL_DEBUG_QUIET_RFKILL(priv, 49 + "Error clearing ASSOC_MSK on BSS (%d)\n", ret); 49 50 50 51 return ret; 51 52 } ··· 117 116 if (ctx->ht.enabled) 118 117 ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; 119 118 120 - IWL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n", 119 + IWL_DEBUG_INFO(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n", 121 120 ctx->qos_data.qos_active, 122 121 ctx->qos_data.def_qos_parm.qos_flags); 123 122 ··· 125 124 sizeof(struct iwl_qosparam_cmd), 126 125 &ctx->qos_data.def_qos_parm); 127 126 if (ret) 128 - IWL_ERR(priv, "Failed to update QoS\n"); 127 + IWL_DEBUG_QUIET_RFKILL(priv, "Failed to update QoS\n"); 129 128 } 130 129 131 130 static int iwlagn_update_beacon(struct iwl_priv *priv, ··· 542 541 543 542 mutex_lock(&priv->shrd->mutex); 544 543 544 + if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 545 + goto out; 546 + 545 547 if (unlikely(test_bit(STATUS_SCANNING, &priv->shrd->status))) { 546 548 IWL_DEBUG_MAC80211(priv, "leave - scanning\n"); 547 549 goto out; ··· 844 840 if (ctx->last_tx_rejected) { 845 841 ctx->last_tx_rejected = false; 846 842 iwl_trans_wake_any_queue(trans(priv), 847 - ctx->ctxid); 843 + ctx->ctxid, 844 + "Disassoc: flush queue"); 848 845 } 849 846 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 850 847
+7 -71
drivers/net/wireless/iwlwifi/iwl-agn-sta.c
··· 647 647 int ret; 648 648 struct iwl_addsta_cmd sta_cmd; 649 649 struct iwl_link_quality_cmd lq; 650 - bool active; 650 + bool active, have_lq = false; 651 651 652 652 spin_lock_irqsave(&priv->shrd->sta_lock, flags); 653 653 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { ··· 657 657 658 658 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd)); 659 659 sta_cmd.mode = 0; 660 - memcpy(&lq, priv->stations[sta_id].lq, sizeof(lq)); 660 + if (priv->stations[sta_id].lq) { 661 + memcpy(&lq, priv->stations[sta_id].lq, sizeof(lq)); 662 + have_lq = true; 663 + } 661 664 662 665 active = priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE; 663 666 priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; ··· 682 679 if (ret) 683 680 IWL_ERR(priv, "failed to re-add STA %pM (%d)\n", 684 681 priv->stations[sta_id].sta.sta.addr, ret); 685 - iwl_send_lq_cmd(priv, ctx, &lq, CMD_SYNC, true); 682 + if (have_lq) 683 + iwl_send_lq_cmd(priv, ctx, &lq, CMD_SYNC, true); 686 684 } 687 685 688 686 int iwl_get_free_ucode_key_offset(struct iwl_priv *priv) ··· 829 825 return ret; 830 826 } 831 827 832 - int iwlagn_mac_sta_remove(struct ieee80211_hw *hw, 833 - struct ieee80211_vif *vif, 834 - struct ieee80211_sta *sta) 835 - { 836 - struct iwl_priv *priv = hw->priv; 837 - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 838 - int ret; 839 - 840 - IWL_DEBUG_MAC80211(priv, "enter: received request to remove " 841 - "station %pM\n", sta->addr); 842 - mutex_lock(&priv->shrd->mutex); 843 - IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n", 844 - sta->addr); 845 - ret = iwl_remove_station(priv, sta_priv->sta_id, sta->addr); 846 - if (ret) 847 - IWL_ERR(priv, "Error removing station %pM\n", 848 - sta->addr); 849 - mutex_unlock(&priv->shrd->mutex); 850 - IWL_DEBUG_MAC80211(priv, "leave\n"); 851 - 852 - return ret; 853 - } 854 828 855 829 void iwl_sta_fill_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 856 830 u8 sta_id, struct iwl_link_quality_cmd *link_cmd) ··· 1446 1464 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 1447 1465 } 1448 1466 1449 - static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) 1450 - { 1451 - unsigned long flags; 1452 1467 1453 - spin_lock_irqsave(&priv->shrd->sta_lock, flags); 1454 - priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK; 1455 - priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK; 1456 - priv->stations[sta_id].sta.sta.modify_mask = 0; 1457 - priv->stations[sta_id].sta.sleep_tx_count = 0; 1458 - priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 1459 - iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 1460 - spin_unlock_irqrestore(&priv->shrd->sta_lock, flags); 1461 - 1462 - } 1463 1468 1464 1469 void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt) 1465 1470 { ··· 1462 1493 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 1463 1494 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags); 1464 1495 1465 - } 1466 - 1467 - void iwlagn_mac_sta_notify(struct ieee80211_hw *hw, 1468 - struct ieee80211_vif *vif, 1469 - enum sta_notify_cmd cmd, 1470 - struct ieee80211_sta *sta) 1471 - { 1472 - struct iwl_priv *priv = hw->priv; 1473 - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 1474 - int sta_id; 1475 - 1476 - IWL_DEBUG_MAC80211(priv, "enter\n"); 1477 - 1478 - switch (cmd) { 1479 - case STA_NOTIFY_SLEEP: 1480 - WARN_ON(!sta_priv->client); 1481 - sta_priv->asleep = true; 1482 - if (atomic_read(&sta_priv->pending_frames) > 0) 1483 - ieee80211_sta_block_awake(hw, sta, true); 1484 - break; 1485 - case STA_NOTIFY_AWAKE: 1486 - WARN_ON(!sta_priv->client); 1487 - if (!sta_priv->asleep) 1488 - break; 1489 - sta_priv->asleep = false; 1490 - sta_id = iwl_sta_id(sta); 1491 - if (sta_id != IWL_INVALID_STATION) 1492 - iwl_sta_modify_ps_wake(priv, sta_id); 1493 - break; 1494 - default: 1495 - break; 1496 - } 1497 - IWL_DEBUG_MAC80211(priv, "leave\n"); 1498 1496 }
+15 -1
drivers/net/wireless/iwlwifi/iwl-agn-tx.c
··· 283 283 IWL_DEBUG_TX(priv, "Sending REASSOC frame\n"); 284 284 #endif 285 285 286 + if (unlikely(ieee80211_is_probe_resp(fc))) { 287 + struct iwl_wipan_noa_data *noa_data = 288 + rcu_dereference(priv->noa_data); 289 + 290 + if (noa_data && 291 + pskb_expand_head(skb, 0, noa_data->length, 292 + GFP_ATOMIC) == 0) { 293 + memcpy(skb_put(skb, noa_data->length), 294 + noa_data->data, noa_data->length); 295 + hdr = (struct ieee80211_hdr *)skb->data; 296 + } 297 + } 298 + 286 299 hdr_len = ieee80211_hdrlen(fc); 287 300 288 301 /* For management frames use broadcast id to do not break aggregation */ ··· 813 800 iwl_is_associated_ctx(ctx) && ctx->vif && 814 801 ctx->vif->type == NL80211_IFTYPE_STATION) { 815 802 ctx->last_tx_rejected = true; 816 - iwl_trans_stop_queue(trans(priv), txq_id); 803 + iwl_trans_stop_queue(trans(priv), txq_id, 804 + "Tx on passive channel"); 817 805 818 806 IWL_DEBUG_TX_REPLY(priv, 819 807 "TXQ %d status %s (0x%08x) "
+116 -38
drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
··· 31 31 #include <linux/module.h> 32 32 #include <linux/init.h> 33 33 #include <linux/sched.h> 34 + #include <linux/dma-mapping.h> 34 35 35 36 #include "iwl-dev.h" 36 37 #include "iwl-core.h" ··· 73 72 {COEX_CU_RSRVD2_RP, COEX_CU_RSRVD2_WP, 0, COEX_RSRVD2_FLAGS} 74 73 }; 75 74 75 + /****************************************************************************** 76 + * 77 + * uCode download functions 78 + * 79 + ******************************************************************************/ 80 + 81 + static void iwl_free_fw_desc(struct iwl_bus *bus, struct fw_desc *desc) 82 + { 83 + if (desc->v_addr) 84 + dma_free_coherent(bus->dev, desc->len, 85 + desc->v_addr, desc->p_addr); 86 + desc->v_addr = NULL; 87 + desc->len = 0; 88 + } 89 + 90 + static void iwl_free_fw_img(struct iwl_bus *bus, struct fw_img *img) 91 + { 92 + iwl_free_fw_desc(bus, &img->code); 93 + iwl_free_fw_desc(bus, &img->data); 94 + } 95 + 96 + void iwl_dealloc_ucode(struct iwl_trans *trans) 97 + { 98 + iwl_free_fw_img(bus(trans), &trans->ucode_rt); 99 + iwl_free_fw_img(bus(trans), &trans->ucode_init); 100 + iwl_free_fw_img(bus(trans), &trans->ucode_wowlan); 101 + } 102 + 103 + int iwl_alloc_fw_desc(struct iwl_bus *bus, struct fw_desc *desc, 104 + const void *data, size_t len) 105 + { 106 + if (!len) { 107 + desc->v_addr = NULL; 108 + return -EINVAL; 109 + } 110 + 111 + desc->v_addr = dma_alloc_coherent(bus->dev, len, 112 + &desc->p_addr, GFP_KERNEL); 113 + if (!desc->v_addr) 114 + return -ENOMEM; 115 + 116 + desc->len = len; 117 + memcpy(desc->v_addr, data, len); 118 + return 0; 119 + } 120 + 76 121 /* 77 122 * ucode 78 123 */ 79 - static int iwlagn_load_section(struct iwl_priv *priv, const char *name, 124 + static int iwlagn_load_section(struct iwl_trans *trans, const char *name, 80 125 struct fw_desc *image, u32 dst_addr) 81 126 { 127 + struct iwl_bus *bus = bus(trans); 82 128 dma_addr_t phy_addr = image->p_addr; 83 129 u32 byte_cnt = image->len; 84 130 int ret; 85 131 86 - priv->ucode_write_complete = 0; 132 + trans->ucode_write_complete = 0; 87 133 88 - iwl_write_direct32(bus(priv), 134 + iwl_write_direct32(bus, 89 135 FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), 90 136 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE); 91 137 92 - iwl_write_direct32(bus(priv), 138 + iwl_write_direct32(bus, 93 139 FH_SRVC_CHNL_SRAM_ADDR_REG(FH_SRVC_CHNL), dst_addr); 94 140 95 - iwl_write_direct32(bus(priv), 141 + iwl_write_direct32(bus, 96 142 FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), 97 143 phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK); 98 144 99 - iwl_write_direct32(bus(priv), 145 + iwl_write_direct32(bus, 100 146 FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), 101 147 (iwl_get_dma_hi_addr(phy_addr) 102 148 << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt); 103 149 104 - iwl_write_direct32(bus(priv), 150 + iwl_write_direct32(bus, 105 151 FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL), 106 152 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM | 107 153 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX | 108 154 FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID); 109 155 110 - iwl_write_direct32(bus(priv), 156 + iwl_write_direct32(bus, 111 157 FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), 112 158 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | 113 159 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE | 114 160 FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD); 115 161 116 - IWL_DEBUG_FW(priv, "%s uCode section being loaded...\n", name); 117 - ret = wait_event_timeout(priv->shrd->wait_command_queue, 118 - priv->ucode_write_complete, 5 * HZ); 162 + IWL_DEBUG_FW(bus, "%s uCode section being loaded...\n", name); 163 + ret = wait_event_timeout(trans->shrd->wait_command_queue, 164 + trans->ucode_write_complete, 5 * HZ); 119 165 if (!ret) { 120 - IWL_ERR(priv, "Could not load the %s uCode section\n", 166 + IWL_ERR(trans, "Could not load the %s uCode section\n", 121 167 name); 122 168 return -ETIMEDOUT; 123 169 } ··· 172 124 return 0; 173 125 } 174 126 175 - static int iwlagn_load_given_ucode(struct iwl_priv *priv, 176 - struct fw_img *image) 127 + static inline struct fw_img *iwl_get_ucode_image(struct iwl_trans *trans, 128 + enum iwl_ucode_type ucode_type) 129 + { 130 + switch (ucode_type) { 131 + case IWL_UCODE_INIT: 132 + return &trans->ucode_init; 133 + case IWL_UCODE_WOWLAN: 134 + return &trans->ucode_wowlan; 135 + case IWL_UCODE_REGULAR: 136 + return &trans->ucode_rt; 137 + case IWL_UCODE_NONE: 138 + break; 139 + } 140 + return NULL; 141 + } 142 + 143 + static int iwlagn_load_given_ucode(struct iwl_trans *trans, 144 + enum iwl_ucode_type ucode_type) 177 145 { 178 146 int ret = 0; 147 + struct fw_img *image = iwl_get_ucode_image(trans, ucode_type); 179 148 180 - ret = iwlagn_load_section(priv, "INST", &image->code, 149 + 150 + if (!image) { 151 + IWL_ERR(trans, "Invalid ucode requested (%d)\n", 152 + ucode_type); 153 + return -EINVAL; 154 + } 155 + 156 + ret = iwlagn_load_section(trans, "INST", &image->code, 181 157 IWLAGN_RTC_INST_LOWER_BOUND); 182 158 if (ret) 183 159 return ret; 184 160 185 - return iwlagn_load_section(priv, "DATA", &image->data, 161 + return iwlagn_load_section(trans, "DATA", &image->data, 186 162 IWLAGN_RTC_DATA_LOWER_BOUND); 187 163 } 188 164 ··· 490 418 * using sample data 100 bytes apart. If these sample points are good, 491 419 * it's a pretty good bet that everything between them is good, too. 492 420 */ 493 - static int iwl_verify_inst_sparse(struct iwl_priv *priv, 421 + static int iwl_verify_inst_sparse(struct iwl_bus *bus, 494 422 struct fw_desc *fw_desc) 495 423 { 496 424 __le32 *image = (__le32 *)fw_desc->v_addr; ··· 498 426 u32 val; 499 427 u32 i; 500 428 501 - IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len); 429 + IWL_DEBUG_FW(bus, "ucode inst image size is %u\n", len); 502 430 503 431 for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { 504 432 /* read data comes through single port, auto-incr addr */ 505 433 /* NOTE: Use the debugless read so we don't flood kernel log 506 434 * if IWL_DL_IO is set */ 507 - iwl_write_direct32(bus(priv), HBUS_TARG_MEM_RADDR, 435 + iwl_write_direct32(bus, HBUS_TARG_MEM_RADDR, 508 436 i + IWLAGN_RTC_INST_LOWER_BOUND); 509 - val = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT); 437 + val = iwl_read32(bus, HBUS_TARG_MEM_RDAT); 510 438 if (val != le32_to_cpu(*image)) 511 439 return -EIO; 512 440 } ··· 514 442 return 0; 515 443 } 516 444 517 - static void iwl_print_mismatch_inst(struct iwl_priv *priv, 445 + static void iwl_print_mismatch_inst(struct iwl_bus *bus, 518 446 struct fw_desc *fw_desc) 519 447 { 520 448 __le32 *image = (__le32 *)fw_desc->v_addr; ··· 523 451 u32 offs; 524 452 int errors = 0; 525 453 526 - IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len); 454 + IWL_DEBUG_FW(bus, "ucode inst image size is %u\n", len); 527 455 528 - iwl_write_direct32(bus(priv), HBUS_TARG_MEM_RADDR, 456 + iwl_write_direct32(bus, HBUS_TARG_MEM_RADDR, 529 457 IWLAGN_RTC_INST_LOWER_BOUND); 530 458 531 459 for (offs = 0; 532 460 offs < len && errors < 20; 533 461 offs += sizeof(u32), image++) { 534 462 /* read data comes through single port, auto-incr addr */ 535 - val = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT); 463 + val = iwl_read32(bus, HBUS_TARG_MEM_RDAT); 536 464 if (val != le32_to_cpu(*image)) { 537 - IWL_ERR(priv, "uCode INST section at " 465 + IWL_ERR(bus, "uCode INST section at " 538 466 "offset 0x%x, is 0x%x, s/b 0x%x\n", 539 467 offs, val, le32_to_cpu(*image)); 540 468 errors++; ··· 546 474 * iwl_verify_ucode - determine which instruction image is in SRAM, 547 475 * and verify its contents 548 476 */ 549 - static int iwl_verify_ucode(struct iwl_priv *priv, struct fw_img *img) 477 + static int iwl_verify_ucode(struct iwl_trans *trans, 478 + enum iwl_ucode_type ucode_type) 550 479 { 551 - if (!iwl_verify_inst_sparse(priv, &img->code)) { 552 - IWL_DEBUG_FW(priv, "uCode is good in inst SRAM\n"); 480 + struct fw_img *img = iwl_get_ucode_image(trans, ucode_type); 481 + 482 + if (!img) { 483 + IWL_ERR(trans, "Invalid ucode requested (%d)\n", ucode_type); 484 + return -EINVAL; 485 + } 486 + 487 + if (!iwl_verify_inst_sparse(bus(trans), &img->code)) { 488 + IWL_DEBUG_FW(trans, "uCode is good in inst SRAM\n"); 553 489 return 0; 554 490 } 555 491 556 - IWL_ERR(priv, "UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n"); 492 + IWL_ERR(trans, "UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n"); 557 493 558 - iwl_print_mismatch_inst(priv, &img->code); 494 + iwl_print_mismatch_inst(bus(trans), &img->code); 559 495 return -EIO; 560 496 } 561 497 ··· 599 519 #define UCODE_CALIB_TIMEOUT (2*HZ) 600 520 601 521 int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, 602 - struct fw_img *image, 603 - enum iwlagn_ucode_type ucode_type) 522 + enum iwl_ucode_type ucode_type) 604 523 { 605 524 struct iwl_notification_wait alive_wait; 606 525 struct iwlagn_alive_data alive_data; 607 526 int ret; 608 - enum iwlagn_ucode_type old_type; 527 + enum iwl_ucode_type old_type; 609 528 610 529 ret = iwl_trans_start_device(trans(priv)); 611 530 if (ret) ··· 616 537 old_type = priv->ucode_type; 617 538 priv->ucode_type = ucode_type; 618 539 619 - ret = iwlagn_load_given_ucode(priv, image); 540 + ret = iwlagn_load_given_ucode(trans(priv), ucode_type); 620 541 if (ret) { 621 542 priv->ucode_type = old_type; 622 543 iwlagn_remove_notification(priv, &alive_wait); ··· 647 568 * skip it for WoWLAN. 648 569 */ 649 570 if (ucode_type != IWL_UCODE_WOWLAN) { 650 - ret = iwl_verify_ucode(priv, image); 571 + ret = iwl_verify_ucode(trans(priv), ucode_type); 651 572 if (ret) { 652 573 priv->ucode_type = old_type; 653 574 return ret; ··· 676 597 lockdep_assert_held(&priv->shrd->mutex); 677 598 678 599 /* No init ucode required? Curious, but maybe ok */ 679 - if (!priv->ucode_init.code.len) 600 + if (!trans(priv)->ucode_init.code.len) 680 601 return 0; 681 602 682 603 if (priv->ucode_type != IWL_UCODE_NONE) ··· 687 608 NULL, NULL); 688 609 689 610 /* Will also start the device */ 690 - ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init, 691 - IWL_UCODE_INIT); 611 + ret = iwlagn_load_ucode_wait_alive(priv, IWL_UCODE_INIT); 692 612 if (ret) 693 613 goto error; 694 614
+14 -1530
drivers/net/wireless/iwlwifi/iwl-agn.c
··· 30 30 #include <linux/module.h> 31 31 #include <linux/init.h> 32 32 #include <linux/slab.h> 33 - #include <linux/dma-mapping.h> 34 33 #include <linux/delay.h> 35 34 #include <linux/sched.h> 36 35 #include <linux/skbuff.h> ··· 451 452 iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL); 452 453 } 453 454 454 - /****************************************************************************** 455 - * 456 - * uCode download functions 457 - * 458 - ******************************************************************************/ 459 - 460 - static void iwl_free_fw_desc(struct iwl_priv *priv, struct fw_desc *desc) 461 - { 462 - if (desc->v_addr) 463 - dma_free_coherent(bus(priv)->dev, desc->len, 464 - desc->v_addr, desc->p_addr); 465 - desc->v_addr = NULL; 466 - desc->len = 0; 467 - } 468 - 469 - static void iwl_free_fw_img(struct iwl_priv *priv, struct fw_img *img) 470 - { 471 - iwl_free_fw_desc(priv, &img->code); 472 - iwl_free_fw_desc(priv, &img->data); 473 - } 474 - 475 - static void iwl_dealloc_ucode(struct iwl_priv *priv) 476 - { 477 - iwl_free_fw_img(priv, &priv->ucode_rt); 478 - iwl_free_fw_img(priv, &priv->ucode_init); 479 - iwl_free_fw_img(priv, &priv->ucode_wowlan); 480 - } 481 - 482 - static int iwl_alloc_fw_desc(struct iwl_priv *priv, struct fw_desc *desc, 483 - const void *data, size_t len) 484 - { 485 - if (!len) { 486 - desc->v_addr = NULL; 487 - return -EINVAL; 488 - } 489 - 490 - desc->v_addr = dma_alloc_coherent(bus(priv)->dev, len, 491 - &desc->p_addr, GFP_KERNEL); 492 - if (!desc->v_addr) 493 - return -ENOMEM; 494 - 495 - desc->len = len; 496 - memcpy(desc->v_addr, data, len); 497 - return 0; 498 - } 499 - 500 455 static void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags) 501 456 { 502 457 int i; ··· 508 555 BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); 509 556 } 510 557 511 - 512 - struct iwlagn_ucode_capabilities { 513 - u32 max_probe_length; 514 - u32 standard_phy_calibration_size; 515 - u32 flags; 516 - }; 517 - 518 558 static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); 519 - static int iwlagn_mac_setup_register(struct iwl_priv *priv, 520 - struct iwlagn_ucode_capabilities *capa); 521 559 522 560 #define UCODE_EXPERIMENTAL_INDEX 100 523 561 #define UCODE_EXPERIMENTAL_TAG "exp" ··· 984 1040 /* Runtime instructions and 2 copies of data: 985 1041 * 1) unmodified from disk 986 1042 * 2) backup cache for save/restore during power-downs */ 987 - if (iwl_alloc_fw_desc(priv, &priv->ucode_rt.code, 1043 + if (iwl_alloc_fw_desc(bus(priv), &trans(priv)->ucode_rt.code, 988 1044 pieces.inst, pieces.inst_size)) 989 1045 goto err_pci_alloc; 990 - if (iwl_alloc_fw_desc(priv, &priv->ucode_rt.data, 1046 + if (iwl_alloc_fw_desc(bus(priv), &trans(priv)->ucode_rt.data, 991 1047 pieces.data, pieces.data_size)) 992 1048 goto err_pci_alloc; 993 1049 994 1050 /* Initialization instructions and data */ 995 1051 if (pieces.init_size && pieces.init_data_size) { 996 - if (iwl_alloc_fw_desc(priv, &priv->ucode_init.code, 1052 + if (iwl_alloc_fw_desc(bus(priv), &trans(priv)->ucode_init.code, 997 1053 pieces.init, pieces.init_size)) 998 1054 goto err_pci_alloc; 999 - if (iwl_alloc_fw_desc(priv, &priv->ucode_init.data, 1055 + if (iwl_alloc_fw_desc(bus(priv), &trans(priv)->ucode_init.data, 1000 1056 pieces.init_data, pieces.init_data_size)) 1001 1057 goto err_pci_alloc; 1002 1058 } 1003 1059 1004 1060 /* WoWLAN instructions and data */ 1005 1061 if (pieces.wowlan_inst_size && pieces.wowlan_data_size) { 1006 - if (iwl_alloc_fw_desc(priv, &priv->ucode_wowlan.code, 1062 + if (iwl_alloc_fw_desc(bus(priv), 1063 + &trans(priv)->ucode_wowlan.code, 1007 1064 pieces.wowlan_inst, 1008 1065 pieces.wowlan_inst_size)) 1009 1066 goto err_pci_alloc; 1010 - if (iwl_alloc_fw_desc(priv, &priv->ucode_wowlan.data, 1067 + if (iwl_alloc_fw_desc(bus(priv), 1068 + &trans(priv)->ucode_wowlan.data, 1011 1069 pieces.wowlan_data, 1012 1070 pieces.wowlan_data_size)) 1013 1071 goto err_pci_alloc; ··· 1102 1156 1103 1157 err_pci_alloc: 1104 1158 IWL_ERR(priv, "failed to allocate pci memory\n"); 1105 - iwl_dealloc_ucode(priv); 1159 + iwl_dealloc_ucode(trans(priv)); 1106 1160 out_unbind: 1107 1161 complete(&priv->firmware_loading_complete); 1108 1162 device_release_driver(bus(priv)->dev); ··· 1298 1352 1299 1353 static void iwl_cancel_deferred_work(struct iwl_priv *priv); 1300 1354 1301 - static void __iwl_down(struct iwl_priv *priv) 1355 + void __iwl_down(struct iwl_priv *priv) 1302 1356 { 1303 1357 int exit_pending; 1304 1358 ··· 1361 1415 priv->beacon_skb = NULL; 1362 1416 } 1363 1417 1364 - static void iwl_down(struct iwl_priv *priv) 1418 + void iwl_down(struct iwl_priv *priv) 1365 1419 { 1366 1420 mutex_lock(&priv->shrd->mutex); 1367 1421 __iwl_down(priv); ··· 1369 1423 1370 1424 iwl_cancel_deferred_work(priv); 1371 1425 } 1372 - 1373 - #define MAX_HW_RESTARTS 5 1374 - 1375 - static int __iwl_up(struct iwl_priv *priv) 1376 - { 1377 - struct iwl_rxon_context *ctx; 1378 - int ret; 1379 - 1380 - lockdep_assert_held(&priv->shrd->mutex); 1381 - 1382 - if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) { 1383 - IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); 1384 - return -EIO; 1385 - } 1386 - 1387 - for_each_context(priv, ctx) { 1388 - ret = iwlagn_alloc_bcast_station(priv, ctx); 1389 - if (ret) { 1390 - iwl_dealloc_bcast_stations(priv); 1391 - return ret; 1392 - } 1393 - } 1394 - 1395 - ret = iwlagn_run_init_ucode(priv); 1396 - if (ret) { 1397 - IWL_ERR(priv, "Failed to run INIT ucode: %d\n", ret); 1398 - goto error; 1399 - } 1400 - 1401 - ret = iwlagn_load_ucode_wait_alive(priv, 1402 - &priv->ucode_rt, 1403 - IWL_UCODE_REGULAR); 1404 - if (ret) { 1405 - IWL_ERR(priv, "Failed to start RT ucode: %d\n", ret); 1406 - goto error; 1407 - } 1408 - 1409 - ret = iwl_alive_start(priv); 1410 - if (ret) 1411 - goto error; 1412 - return 0; 1413 - 1414 - error: 1415 - set_bit(STATUS_EXIT_PENDING, &priv->shrd->status); 1416 - __iwl_down(priv); 1417 - clear_bit(STATUS_EXIT_PENDING, &priv->shrd->status); 1418 - 1419 - IWL_ERR(priv, "Unable to initialize device.\n"); 1420 - return ret; 1421 - } 1422 - 1423 1426 1424 1427 /***************************************************************************** 1425 1428 * ··· 1397 1502 mutex_unlock(&priv->shrd->mutex); 1398 1503 } 1399 1504 1400 - static void iwlagn_prepare_restart(struct iwl_priv *priv) 1505 + void iwlagn_prepare_restart(struct iwl_priv *priv) 1401 1506 { 1402 1507 struct iwl_rxon_context *ctx; 1403 1508 bool bt_full_concurrent; ··· 1454 1559 } 1455 1560 } 1456 1561 1457 - /***************************************************************************** 1458 - * 1459 - * mac80211 entry point functions 1460 - * 1461 - *****************************************************************************/ 1462 1562 1463 - static const struct ieee80211_iface_limit iwlagn_sta_ap_limits[] = { 1464 - { 1465 - .max = 1, 1466 - .types = BIT(NL80211_IFTYPE_STATION), 1467 - }, 1468 - { 1469 - .max = 1, 1470 - .types = BIT(NL80211_IFTYPE_AP), 1471 - }, 1472 - }; 1473 1563 1474 - static const struct ieee80211_iface_limit iwlagn_2sta_limits[] = { 1475 - { 1476 - .max = 2, 1477 - .types = BIT(NL80211_IFTYPE_STATION), 1478 - }, 1479 - }; 1480 - 1481 - static const struct ieee80211_iface_limit iwlagn_p2p_sta_go_limits[] = { 1482 - { 1483 - .max = 1, 1484 - .types = BIT(NL80211_IFTYPE_STATION), 1485 - }, 1486 - { 1487 - .max = 1, 1488 - .types = BIT(NL80211_IFTYPE_P2P_GO) | 1489 - BIT(NL80211_IFTYPE_AP), 1490 - }, 1491 - }; 1492 - 1493 - static const struct ieee80211_iface_limit iwlagn_p2p_2sta_limits[] = { 1494 - { 1495 - .max = 2, 1496 - .types = BIT(NL80211_IFTYPE_STATION), 1497 - }, 1498 - { 1499 - .max = 1, 1500 - .types = BIT(NL80211_IFTYPE_P2P_CLIENT), 1501 - }, 1502 - }; 1503 - 1504 - static const struct ieee80211_iface_combination 1505 - iwlagn_iface_combinations_dualmode[] = { 1506 - { .num_different_channels = 1, 1507 - .max_interfaces = 2, 1508 - .beacon_int_infra_match = true, 1509 - .limits = iwlagn_sta_ap_limits, 1510 - .n_limits = ARRAY_SIZE(iwlagn_sta_ap_limits), 1511 - }, 1512 - { .num_different_channels = 1, 1513 - .max_interfaces = 2, 1514 - .limits = iwlagn_2sta_limits, 1515 - .n_limits = ARRAY_SIZE(iwlagn_2sta_limits), 1516 - }, 1517 - }; 1518 - 1519 - static const struct ieee80211_iface_combination 1520 - iwlagn_iface_combinations_p2p[] = { 1521 - { .num_different_channels = 1, 1522 - .max_interfaces = 2, 1523 - .beacon_int_infra_match = true, 1524 - .limits = iwlagn_p2p_sta_go_limits, 1525 - .n_limits = ARRAY_SIZE(iwlagn_p2p_sta_go_limits), 1526 - }, 1527 - { .num_different_channels = 1, 1528 - .max_interfaces = 2, 1529 - .limits = iwlagn_p2p_2sta_limits, 1530 - .n_limits = ARRAY_SIZE(iwlagn_p2p_2sta_limits), 1531 - }, 1532 - }; 1533 - 1534 - /* 1535 - * Not a mac80211 entry point function, but it fits in with all the 1536 - * other mac80211 functions grouped here. 1537 - */ 1538 - static int iwlagn_mac_setup_register(struct iwl_priv *priv, 1539 - struct iwlagn_ucode_capabilities *capa) 1540 - { 1541 - int ret; 1542 - struct ieee80211_hw *hw = priv->hw; 1543 - struct iwl_rxon_context *ctx; 1544 - 1545 - hw->rate_control_algorithm = "iwl-agn-rs"; 1546 - 1547 - /* Tell mac80211 our characteristics */ 1548 - hw->flags = IEEE80211_HW_SIGNAL_DBM | 1549 - IEEE80211_HW_AMPDU_AGGREGATION | 1550 - IEEE80211_HW_NEED_DTIM_PERIOD | 1551 - IEEE80211_HW_SPECTRUM_MGMT | 1552 - IEEE80211_HW_REPORTS_TX_ACK_STATUS; 1553 - 1554 - /* 1555 - * Including the following line will crash some AP's. This 1556 - * workaround removes the stimulus which causes the crash until 1557 - * the AP software can be fixed. 1558 - hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF; 1559 - */ 1560 - 1561 - hw->flags |= IEEE80211_HW_SUPPORTS_PS | 1562 - IEEE80211_HW_SUPPORTS_DYNAMIC_PS; 1563 - 1564 - if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE) 1565 - hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | 1566 - IEEE80211_HW_SUPPORTS_STATIC_SMPS; 1567 - 1568 - if (capa->flags & IWL_UCODE_TLV_FLAGS_MFP) 1569 - hw->flags |= IEEE80211_HW_MFP_CAPABLE; 1570 - 1571 - hw->sta_data_size = sizeof(struct iwl_station_priv); 1572 - hw->vif_data_size = sizeof(struct iwl_vif_priv); 1573 - 1574 - for_each_context(priv, ctx) { 1575 - hw->wiphy->interface_modes |= ctx->interface_modes; 1576 - hw->wiphy->interface_modes |= ctx->exclusive_interface_modes; 1577 - } 1578 - 1579 - BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); 1580 - 1581 - if (hw->wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) { 1582 - hw->wiphy->iface_combinations = iwlagn_iface_combinations_p2p; 1583 - hw->wiphy->n_iface_combinations = 1584 - ARRAY_SIZE(iwlagn_iface_combinations_p2p); 1585 - } else if (hw->wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) { 1586 - hw->wiphy->iface_combinations = iwlagn_iface_combinations_dualmode; 1587 - hw->wiphy->n_iface_combinations = 1588 - ARRAY_SIZE(iwlagn_iface_combinations_dualmode); 1589 - } 1590 - 1591 - hw->wiphy->max_remain_on_channel_duration = 1000; 1592 - 1593 - hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | 1594 - WIPHY_FLAG_DISABLE_BEACON_HINTS | 1595 - WIPHY_FLAG_IBSS_RSN; 1596 - 1597 - if (priv->ucode_wowlan.code.len && device_can_wakeup(bus(priv)->dev)) { 1598 - hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | 1599 - WIPHY_WOWLAN_DISCONNECT | 1600 - WIPHY_WOWLAN_EAP_IDENTITY_REQ | 1601 - WIPHY_WOWLAN_RFKILL_RELEASE; 1602 - if (!iwlagn_mod_params.sw_crypto) 1603 - hw->wiphy->wowlan.flags |= 1604 - WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | 1605 - WIPHY_WOWLAN_GTK_REKEY_FAILURE; 1606 - 1607 - hw->wiphy->wowlan.n_patterns = IWLAGN_WOWLAN_MAX_PATTERNS; 1608 - hw->wiphy->wowlan.pattern_min_len = 1609 - IWLAGN_WOWLAN_MIN_PATTERN_LEN; 1610 - hw->wiphy->wowlan.pattern_max_len = 1611 - IWLAGN_WOWLAN_MAX_PATTERN_LEN; 1612 - } 1613 - 1614 - if (iwlagn_mod_params.power_save) 1615 - hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; 1616 - else 1617 - hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; 1618 - 1619 - hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; 1620 - /* we create the 802.11 header and a zero-length SSID element */ 1621 - hw->wiphy->max_scan_ie_len = capa->max_probe_length - 24 - 2; 1622 - 1623 - /* Default value; 4 EDCA QOS priorities */ 1624 - hw->queues = 4; 1625 - 1626 - hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; 1627 - 1628 - if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) 1629 - priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = 1630 - &priv->bands[IEEE80211_BAND_2GHZ]; 1631 - if (priv->bands[IEEE80211_BAND_5GHZ].n_channels) 1632 - priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = 1633 - &priv->bands[IEEE80211_BAND_5GHZ]; 1634 - 1635 - iwl_leds_init(priv); 1636 - 1637 - ret = ieee80211_register_hw(priv->hw); 1638 - if (ret) { 1639 - IWL_ERR(priv, "Failed to register hw (error %d)\n", ret); 1640 - return ret; 1641 - } 1642 - priv->mac80211_registered = 1; 1643 - 1644 - return 0; 1645 - } 1646 - 1647 - 1648 - static int iwlagn_mac_start(struct ieee80211_hw *hw) 1649 - { 1650 - struct iwl_priv *priv = hw->priv; 1651 - int ret; 1652 - 1653 - IWL_DEBUG_MAC80211(priv, "enter\n"); 1654 - 1655 - /* we should be verifying the device is ready to be opened */ 1656 - mutex_lock(&priv->shrd->mutex); 1657 - ret = __iwl_up(priv); 1658 - mutex_unlock(&priv->shrd->mutex); 1659 - if (ret) 1660 - return ret; 1661 - 1662 - IWL_DEBUG_INFO(priv, "Start UP work done.\n"); 1663 - 1664 - /* Now we should be done, and the READY bit should be set. */ 1665 - if (WARN_ON(!test_bit(STATUS_READY, &priv->shrd->status))) 1666 - ret = -EIO; 1667 - 1668 - iwlagn_led_enable(priv); 1669 - 1670 - priv->is_open = 1; 1671 - IWL_DEBUG_MAC80211(priv, "leave\n"); 1672 - return 0; 1673 - } 1674 - 1675 - static void iwlagn_mac_stop(struct ieee80211_hw *hw) 1676 - { 1677 - struct iwl_priv *priv = hw->priv; 1678 - 1679 - IWL_DEBUG_MAC80211(priv, "enter\n"); 1680 - 1681 - if (!priv->is_open) 1682 - return; 1683 - 1684 - priv->is_open = 0; 1685 - 1686 - iwl_down(priv); 1687 - 1688 - flush_workqueue(priv->shrd->workqueue); 1689 - 1690 - /* User space software may expect getting rfkill changes 1691 - * even if interface is down */ 1692 - iwl_write32(bus(priv), CSR_INT, 0xFFFFFFFF); 1693 - iwl_enable_rfkill_int(priv); 1694 - 1695 - IWL_DEBUG_MAC80211(priv, "leave\n"); 1696 - } 1697 - 1698 - #ifdef CONFIG_PM_SLEEP 1699 - static int iwlagn_send_patterns(struct iwl_priv *priv, 1700 - struct cfg80211_wowlan *wowlan) 1701 - { 1702 - struct iwlagn_wowlan_patterns_cmd *pattern_cmd; 1703 - struct iwl_host_cmd cmd = { 1704 - .id = REPLY_WOWLAN_PATTERNS, 1705 - .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 1706 - .flags = CMD_SYNC, 1707 - }; 1708 - int i, err; 1709 - 1710 - if (!wowlan->n_patterns) 1711 - return 0; 1712 - 1713 - cmd.len[0] = sizeof(*pattern_cmd) + 1714 - wowlan->n_patterns * sizeof(struct iwlagn_wowlan_pattern); 1715 - 1716 - pattern_cmd = kmalloc(cmd.len[0], GFP_KERNEL); 1717 - if (!pattern_cmd) 1718 - return -ENOMEM; 1719 - 1720 - pattern_cmd->n_patterns = cpu_to_le32(wowlan->n_patterns); 1721 - 1722 - for (i = 0; i < wowlan->n_patterns; i++) { 1723 - int mask_len = DIV_ROUND_UP(wowlan->patterns[i].pattern_len, 8); 1724 - 1725 - memcpy(&pattern_cmd->patterns[i].mask, 1726 - wowlan->patterns[i].mask, mask_len); 1727 - memcpy(&pattern_cmd->patterns[i].pattern, 1728 - wowlan->patterns[i].pattern, 1729 - wowlan->patterns[i].pattern_len); 1730 - pattern_cmd->patterns[i].mask_size = mask_len; 1731 - pattern_cmd->patterns[i].pattern_size = 1732 - wowlan->patterns[i].pattern_len; 1733 - } 1734 - 1735 - cmd.data[0] = pattern_cmd; 1736 - err = iwl_trans_send_cmd(trans(priv), &cmd); 1737 - kfree(pattern_cmd); 1738 - return err; 1739 - } 1740 - #endif 1741 - 1742 - static void iwlagn_mac_set_rekey_data(struct ieee80211_hw *hw, 1743 - struct ieee80211_vif *vif, 1744 - struct cfg80211_gtk_rekey_data *data) 1745 - { 1746 - struct iwl_priv *priv = hw->priv; 1747 - 1748 - if (iwlagn_mod_params.sw_crypto) 1749 - return; 1750 - 1751 - IWL_DEBUG_MAC80211(priv, "enter\n"); 1752 - mutex_lock(&priv->shrd->mutex); 1753 - 1754 - if (priv->contexts[IWL_RXON_CTX_BSS].vif != vif) 1755 - goto out; 1756 - 1757 - memcpy(priv->kek, data->kek, NL80211_KEK_LEN); 1758 - memcpy(priv->kck, data->kck, NL80211_KCK_LEN); 1759 - priv->replay_ctr = cpu_to_le64(be64_to_cpup((__be64 *)&data->replay_ctr)); 1760 - priv->have_rekey_data = true; 1761 - 1762 - out: 1763 - mutex_unlock(&priv->shrd->mutex); 1764 - IWL_DEBUG_MAC80211(priv, "leave\n"); 1765 - } 1766 - 1767 - struct wowlan_key_data { 1768 - struct iwl_rxon_context *ctx; 1769 - struct iwlagn_wowlan_rsc_tsc_params_cmd *rsc_tsc; 1770 - struct iwlagn_wowlan_tkip_params_cmd *tkip; 1771 - const u8 *bssid; 1772 - bool error, use_rsc_tsc, use_tkip; 1773 - }; 1774 - 1775 - #ifdef CONFIG_PM_SLEEP 1776 - static void iwlagn_convert_p1k(u16 *p1k, __le16 *out) 1777 - { 1778 - int i; 1779 - 1780 - for (i = 0; i < IWLAGN_P1K_SIZE; i++) 1781 - out[i] = cpu_to_le16(p1k[i]); 1782 - } 1783 - 1784 - static void iwlagn_wowlan_program_keys(struct ieee80211_hw *hw, 1785 - struct ieee80211_vif *vif, 1786 - struct ieee80211_sta *sta, 1787 - struct ieee80211_key_conf *key, 1788 - void *_data) 1789 - { 1790 - struct iwl_priv *priv = hw->priv; 1791 - struct wowlan_key_data *data = _data; 1792 - struct iwl_rxon_context *ctx = data->ctx; 1793 - struct aes_sc *aes_sc, *aes_tx_sc = NULL; 1794 - struct tkip_sc *tkip_sc, *tkip_tx_sc = NULL; 1795 - struct iwlagn_p1k_cache *rx_p1ks; 1796 - u8 *rx_mic_key; 1797 - struct ieee80211_key_seq seq; 1798 - u32 cur_rx_iv32 = 0; 1799 - u16 p1k[IWLAGN_P1K_SIZE]; 1800 - int ret, i; 1801 - 1802 - mutex_lock(&priv->shrd->mutex); 1803 - 1804 - if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 || 1805 - key->cipher == WLAN_CIPHER_SUITE_WEP104) && 1806 - !sta && !ctx->key_mapping_keys) 1807 - ret = iwl_set_default_wep_key(priv, ctx, key); 1808 - else 1809 - ret = iwl_set_dynamic_key(priv, ctx, key, sta); 1810 - 1811 - if (ret) { 1812 - IWL_ERR(priv, "Error setting key during suspend!\n"); 1813 - data->error = true; 1814 - } 1815 - 1816 - switch (key->cipher) { 1817 - case WLAN_CIPHER_SUITE_TKIP: 1818 - if (sta) { 1819 - tkip_sc = data->rsc_tsc->all_tsc_rsc.tkip.unicast_rsc; 1820 - tkip_tx_sc = &data->rsc_tsc->all_tsc_rsc.tkip.tsc; 1821 - 1822 - rx_p1ks = data->tkip->rx_uni; 1823 - 1824 - ieee80211_get_key_tx_seq(key, &seq); 1825 - tkip_tx_sc->iv16 = cpu_to_le16(seq.tkip.iv16); 1826 - tkip_tx_sc->iv32 = cpu_to_le32(seq.tkip.iv32); 1827 - 1828 - ieee80211_get_tkip_p1k_iv(key, seq.tkip.iv32, p1k); 1829 - iwlagn_convert_p1k(p1k, data->tkip->tx.p1k); 1830 - 1831 - memcpy(data->tkip->mic_keys.tx, 1832 - &key->key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY], 1833 - IWLAGN_MIC_KEY_SIZE); 1834 - 1835 - rx_mic_key = data->tkip->mic_keys.rx_unicast; 1836 - } else { 1837 - tkip_sc = data->rsc_tsc->all_tsc_rsc.tkip.multicast_rsc; 1838 - rx_p1ks = data->tkip->rx_multi; 1839 - rx_mic_key = data->tkip->mic_keys.rx_mcast; 1840 - } 1841 - 1842 - /* 1843 - * For non-QoS this relies on the fact that both the uCode and 1844 - * mac80211 use TID 0 (as they need to to avoid replay attacks) 1845 - * for checking the IV in the frames. 1846 - */ 1847 - for (i = 0; i < IWLAGN_NUM_RSC; i++) { 1848 - ieee80211_get_key_rx_seq(key, i, &seq); 1849 - tkip_sc[i].iv16 = cpu_to_le16(seq.tkip.iv16); 1850 - tkip_sc[i].iv32 = cpu_to_le32(seq.tkip.iv32); 1851 - /* wrapping isn't allowed, AP must rekey */ 1852 - if (seq.tkip.iv32 > cur_rx_iv32) 1853 - cur_rx_iv32 = seq.tkip.iv32; 1854 - } 1855 - 1856 - ieee80211_get_tkip_rx_p1k(key, data->bssid, cur_rx_iv32, p1k); 1857 - iwlagn_convert_p1k(p1k, rx_p1ks[0].p1k); 1858 - ieee80211_get_tkip_rx_p1k(key, data->bssid, 1859 - cur_rx_iv32 + 1, p1k); 1860 - iwlagn_convert_p1k(p1k, rx_p1ks[1].p1k); 1861 - 1862 - memcpy(rx_mic_key, 1863 - &key->key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY], 1864 - IWLAGN_MIC_KEY_SIZE); 1865 - 1866 - data->use_tkip = true; 1867 - data->use_rsc_tsc = true; 1868 - break; 1869 - case WLAN_CIPHER_SUITE_CCMP: 1870 - if (sta) { 1871 - u8 *pn = seq.ccmp.pn; 1872 - 1873 - aes_sc = data->rsc_tsc->all_tsc_rsc.aes.unicast_rsc; 1874 - aes_tx_sc = &data->rsc_tsc->all_tsc_rsc.aes.tsc; 1875 - 1876 - ieee80211_get_key_tx_seq(key, &seq); 1877 - aes_tx_sc->pn = cpu_to_le64( 1878 - (u64)pn[5] | 1879 - ((u64)pn[4] << 8) | 1880 - ((u64)pn[3] << 16) | 1881 - ((u64)pn[2] << 24) | 1882 - ((u64)pn[1] << 32) | 1883 - ((u64)pn[0] << 40)); 1884 - } else 1885 - aes_sc = data->rsc_tsc->all_tsc_rsc.aes.multicast_rsc; 1886 - 1887 - /* 1888 - * For non-QoS this relies on the fact that both the uCode and 1889 - * mac80211 use TID 0 for checking the IV in the frames. 1890 - */ 1891 - for (i = 0; i < IWLAGN_NUM_RSC; i++) { 1892 - u8 *pn = seq.ccmp.pn; 1893 - 1894 - ieee80211_get_key_rx_seq(key, i, &seq); 1895 - aes_sc->pn = cpu_to_le64( 1896 - (u64)pn[5] | 1897 - ((u64)pn[4] << 8) | 1898 - ((u64)pn[3] << 16) | 1899 - ((u64)pn[2] << 24) | 1900 - ((u64)pn[1] << 32) | 1901 - ((u64)pn[0] << 40)); 1902 - } 1903 - data->use_rsc_tsc = true; 1904 - break; 1905 - } 1906 - 1907 - mutex_unlock(&priv->shrd->mutex); 1908 - } 1909 - 1910 - static int iwlagn_mac_suspend(struct ieee80211_hw *hw, 1911 - struct cfg80211_wowlan *wowlan) 1912 - { 1913 - struct iwl_priv *priv = hw->priv; 1914 - struct iwlagn_wowlan_wakeup_filter_cmd wakeup_filter_cmd; 1915 - struct iwl_rxon_cmd rxon; 1916 - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1917 - struct iwlagn_wowlan_kek_kck_material_cmd kek_kck_cmd; 1918 - struct iwlagn_wowlan_tkip_params_cmd tkip_cmd = {}; 1919 - struct wowlan_key_data key_data = { 1920 - .ctx = ctx, 1921 - .bssid = ctx->active.bssid_addr, 1922 - .use_rsc_tsc = false, 1923 - .tkip = &tkip_cmd, 1924 - .use_tkip = false, 1925 - }; 1926 - struct iwlagn_d3_config_cmd d3_cfg_cmd = {}; 1927 - int ret, i; 1928 - u16 seq; 1929 - 1930 - if (WARN_ON(!wowlan)) 1931 - return -EINVAL; 1932 - 1933 - IWL_DEBUG_MAC80211(priv, "enter\n"); 1934 - mutex_lock(&priv->shrd->mutex); 1935 - 1936 - /* Don't attempt WoWLAN when not associated, tear down instead. */ 1937 - if (!ctx->vif || ctx->vif->type != NL80211_IFTYPE_STATION || 1938 - !iwl_is_associated_ctx(ctx)) { 1939 - ret = 1; 1940 - goto out; 1941 - } 1942 - 1943 - key_data.rsc_tsc = kzalloc(sizeof(*key_data.rsc_tsc), GFP_KERNEL); 1944 - if (!key_data.rsc_tsc) { 1945 - ret = -ENOMEM; 1946 - goto out; 1947 - } 1948 - 1949 - memset(&wakeup_filter_cmd, 0, sizeof(wakeup_filter_cmd)); 1950 - 1951 - /* 1952 - * We know the last used seqno, and the uCode expects to know that 1953 - * one, it will increment before TX. 1954 - */ 1955 - seq = le16_to_cpu(priv->last_seq_ctl) & IEEE80211_SCTL_SEQ; 1956 - wakeup_filter_cmd.non_qos_seq = cpu_to_le16(seq); 1957 - 1958 - /* 1959 - * For QoS counters, we store the one to use next, so subtract 0x10 1960 - * since the uCode will add 0x10 before using the value. 1961 - */ 1962 - for (i = 0; i < 8; i++) { 1963 - seq = priv->shrd->tid_data[IWL_AP_ID][i].seq_number; 1964 - seq -= 0x10; 1965 - wakeup_filter_cmd.qos_seq[i] = cpu_to_le16(seq); 1966 - } 1967 - 1968 - if (wowlan->disconnect) 1969 - wakeup_filter_cmd.enabled |= 1970 - cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_BEACON_MISS | 1971 - IWLAGN_WOWLAN_WAKEUP_LINK_CHANGE); 1972 - if (wowlan->magic_pkt) 1973 - wakeup_filter_cmd.enabled |= 1974 - cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_MAGIC_PACKET); 1975 - if (wowlan->gtk_rekey_failure) 1976 - wakeup_filter_cmd.enabled |= 1977 - cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_GTK_REKEY_FAIL); 1978 - if (wowlan->eap_identity_req) 1979 - wakeup_filter_cmd.enabled |= 1980 - cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_EAP_IDENT_REQ); 1981 - if (wowlan->four_way_handshake) 1982 - wakeup_filter_cmd.enabled |= 1983 - cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_4WAY_HANDSHAKE); 1984 - if (wowlan->n_patterns) 1985 - wakeup_filter_cmd.enabled |= 1986 - cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_PATTERN_MATCH); 1987 - 1988 - if (wowlan->rfkill_release) 1989 - d3_cfg_cmd.wakeup_flags |= 1990 - cpu_to_le32(IWLAGN_D3_WAKEUP_RFKILL); 1991 - 1992 - iwl_scan_cancel_timeout(priv, 200); 1993 - 1994 - memcpy(&rxon, &ctx->active, sizeof(rxon)); 1995 - 1996 - iwl_trans_stop_device(trans(priv)); 1997 - 1998 - priv->shrd->wowlan = true; 1999 - 2000 - ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_wowlan, 2001 - IWL_UCODE_WOWLAN); 2002 - if (ret) 2003 - goto error; 2004 - 2005 - /* now configure WoWLAN ucode */ 2006 - ret = iwl_alive_start(priv); 2007 - if (ret) 2008 - goto error; 2009 - 2010 - memcpy(&ctx->staging, &rxon, sizeof(rxon)); 2011 - ret = iwlagn_commit_rxon(priv, ctx); 2012 - if (ret) 2013 - goto error; 2014 - 2015 - ret = iwl_power_update_mode(priv, true); 2016 - if (ret) 2017 - goto error; 2018 - 2019 - if (!iwlagn_mod_params.sw_crypto) { 2020 - /* mark all keys clear */ 2021 - priv->ucode_key_table = 0; 2022 - ctx->key_mapping_keys = 0; 2023 - 2024 - /* 2025 - * This needs to be unlocked due to lock ordering 2026 - * constraints. Since we're in the suspend path 2027 - * that isn't really a problem though. 2028 - */ 2029 - mutex_unlock(&priv->shrd->mutex); 2030 - ieee80211_iter_keys(priv->hw, ctx->vif, 2031 - iwlagn_wowlan_program_keys, 2032 - &key_data); 2033 - mutex_lock(&priv->shrd->mutex); 2034 - if (key_data.error) { 2035 - ret = -EIO; 2036 - goto error; 2037 - } 2038 - 2039 - if (key_data.use_rsc_tsc) { 2040 - struct iwl_host_cmd rsc_tsc_cmd = { 2041 - .id = REPLY_WOWLAN_TSC_RSC_PARAMS, 2042 - .flags = CMD_SYNC, 2043 - .data[0] = key_data.rsc_tsc, 2044 - .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 2045 - .len[0] = sizeof(*key_data.rsc_tsc), 2046 - }; 2047 - 2048 - ret = iwl_trans_send_cmd(trans(priv), &rsc_tsc_cmd); 2049 - if (ret) 2050 - goto error; 2051 - } 2052 - 2053 - if (key_data.use_tkip) { 2054 - ret = iwl_trans_send_cmd_pdu(trans(priv), 2055 - REPLY_WOWLAN_TKIP_PARAMS, 2056 - CMD_SYNC, sizeof(tkip_cmd), 2057 - &tkip_cmd); 2058 - if (ret) 2059 - goto error; 2060 - } 2061 - 2062 - if (priv->have_rekey_data) { 2063 - memset(&kek_kck_cmd, 0, sizeof(kek_kck_cmd)); 2064 - memcpy(kek_kck_cmd.kck, priv->kck, NL80211_KCK_LEN); 2065 - kek_kck_cmd.kck_len = cpu_to_le16(NL80211_KCK_LEN); 2066 - memcpy(kek_kck_cmd.kek, priv->kek, NL80211_KEK_LEN); 2067 - kek_kck_cmd.kek_len = cpu_to_le16(NL80211_KEK_LEN); 2068 - kek_kck_cmd.replay_ctr = priv->replay_ctr; 2069 - 2070 - ret = iwl_trans_send_cmd_pdu(trans(priv), 2071 - REPLY_WOWLAN_KEK_KCK_MATERIAL, 2072 - CMD_SYNC, sizeof(kek_kck_cmd), 2073 - &kek_kck_cmd); 2074 - if (ret) 2075 - goto error; 2076 - } 2077 - } 2078 - 2079 - ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_D3_CONFIG, CMD_SYNC, 2080 - sizeof(d3_cfg_cmd), &d3_cfg_cmd); 2081 - if (ret) 2082 - goto error; 2083 - 2084 - ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_WOWLAN_WAKEUP_FILTER, 2085 - CMD_SYNC, sizeof(wakeup_filter_cmd), 2086 - &wakeup_filter_cmd); 2087 - if (ret) 2088 - goto error; 2089 - 2090 - ret = iwlagn_send_patterns(priv, wowlan); 2091 - if (ret) 2092 - goto error; 2093 - 2094 - device_set_wakeup_enable(bus(priv)->dev, true); 2095 - 2096 - /* Now let the ucode operate on its own */ 2097 - iwl_write32(bus(priv), CSR_UCODE_DRV_GP1_SET, 2098 - CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE); 2099 - 2100 - goto out; 2101 - 2102 - error: 2103 - priv->shrd->wowlan = false; 2104 - iwlagn_prepare_restart(priv); 2105 - ieee80211_restart_hw(priv->hw); 2106 - out: 2107 - mutex_unlock(&priv->shrd->mutex); 2108 - kfree(key_data.rsc_tsc); 2109 - IWL_DEBUG_MAC80211(priv, "leave\n"); 2110 - 2111 - return ret; 2112 - } 2113 - 2114 - static int iwlagn_mac_resume(struct ieee80211_hw *hw) 2115 - { 2116 - struct iwl_priv *priv = hw->priv; 2117 - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2118 - struct ieee80211_vif *vif; 2119 - unsigned long flags; 2120 - u32 base, status = 0xffffffff; 2121 - int ret = -EIO; 2122 - 2123 - IWL_DEBUG_MAC80211(priv, "enter\n"); 2124 - mutex_lock(&priv->shrd->mutex); 2125 - 2126 - iwl_write32(bus(priv), CSR_UCODE_DRV_GP1_CLR, 2127 - CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE); 2128 - 2129 - base = priv->device_pointers.error_event_table; 2130 - if (iwlagn_hw_valid_rtc_data_addr(base)) { 2131 - spin_lock_irqsave(&bus(priv)->reg_lock, flags); 2132 - ret = iwl_grab_nic_access_silent(bus(priv)); 2133 - if (ret == 0) { 2134 - iwl_write32(bus(priv), HBUS_TARG_MEM_RADDR, base); 2135 - status = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT); 2136 - iwl_release_nic_access(bus(priv)); 2137 - } 2138 - spin_unlock_irqrestore(&bus(priv)->reg_lock, flags); 2139 - 2140 - #ifdef CONFIG_IWLWIFI_DEBUGFS 2141 - if (ret == 0) { 2142 - if (!priv->wowlan_sram) 2143 - priv->wowlan_sram = 2144 - kzalloc(priv->ucode_wowlan.data.len, 2145 - GFP_KERNEL); 2146 - 2147 - if (priv->wowlan_sram) 2148 - _iwl_read_targ_mem_words( 2149 - bus(priv), 0x800000, priv->wowlan_sram, 2150 - priv->ucode_wowlan.data.len / 4); 2151 - } 2152 - #endif 2153 - } 2154 - 2155 - /* we'll clear ctx->vif during iwlagn_prepare_restart() */ 2156 - vif = ctx->vif; 2157 - 2158 - priv->shrd->wowlan = false; 2159 - 2160 - device_set_wakeup_enable(bus(priv)->dev, false); 2161 - 2162 - iwlagn_prepare_restart(priv); 2163 - 2164 - memset((void *)&ctx->active, 0, sizeof(ctx->active)); 2165 - iwl_connection_init_rx_config(priv, ctx); 2166 - iwlagn_set_rxon_chain(priv, ctx); 2167 - 2168 - mutex_unlock(&priv->shrd->mutex); 2169 - IWL_DEBUG_MAC80211(priv, "leave\n"); 2170 - 2171 - ieee80211_resume_disconnect(vif); 2172 - 2173 - return 1; 2174 - } 2175 - #endif 2176 - 2177 - static void iwlagn_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 2178 - { 2179 - struct iwl_priv *priv = hw->priv; 2180 - 2181 - IWL_DEBUG_MACDUMP(priv, "enter\n"); 2182 - 2183 - IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 2184 - ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); 2185 - 2186 - if (iwlagn_tx_skb(priv, skb)) 2187 - dev_kfree_skb_any(skb); 2188 - 2189 - IWL_DEBUG_MACDUMP(priv, "leave\n"); 2190 - } 2191 - 2192 - static void iwlagn_mac_update_tkip_key(struct ieee80211_hw *hw, 2193 - struct ieee80211_vif *vif, 2194 - struct ieee80211_key_conf *keyconf, 2195 - struct ieee80211_sta *sta, 2196 - u32 iv32, u16 *phase1key) 2197 - { 2198 - struct iwl_priv *priv = hw->priv; 2199 - 2200 - iwl_update_tkip_key(priv, vif, keyconf, sta, iv32, phase1key); 2201 - } 2202 - 2203 - static int iwlagn_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 2204 - struct ieee80211_vif *vif, 2205 - struct ieee80211_sta *sta, 2206 - struct ieee80211_key_conf *key) 2207 - { 2208 - struct iwl_priv *priv = hw->priv; 2209 - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 2210 - struct iwl_rxon_context *ctx = vif_priv->ctx; 2211 - int ret; 2212 - bool is_default_wep_key = false; 2213 - 2214 - IWL_DEBUG_MAC80211(priv, "enter\n"); 2215 - 2216 - if (iwlagn_mod_params.sw_crypto) { 2217 - IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); 2218 - return -EOPNOTSUPP; 2219 - } 2220 - 2221 - /* 2222 - * We could program these keys into the hardware as well, but we 2223 - * don't expect much multicast traffic in IBSS and having keys 2224 - * for more stations is probably more useful. 2225 - * 2226 - * Mark key TX-only and return 0. 2227 - */ 2228 - if (vif->type == NL80211_IFTYPE_ADHOC && 2229 - !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { 2230 - key->hw_key_idx = WEP_INVALID_OFFSET; 2231 - return 0; 2232 - } 2233 - 2234 - /* If they key was TX-only, accept deletion */ 2235 - if (cmd == DISABLE_KEY && key->hw_key_idx == WEP_INVALID_OFFSET) 2236 - return 0; 2237 - 2238 - mutex_lock(&priv->shrd->mutex); 2239 - iwl_scan_cancel_timeout(priv, 100); 2240 - 2241 - BUILD_BUG_ON(WEP_INVALID_OFFSET == IWLAGN_HW_KEY_DEFAULT); 2242 - 2243 - /* 2244 - * If we are getting WEP group key and we didn't receive any key mapping 2245 - * so far, we are in legacy wep mode (group key only), otherwise we are 2246 - * in 1X mode. 2247 - * In legacy wep mode, we use another host command to the uCode. 2248 - */ 2249 - if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 || 2250 - key->cipher == WLAN_CIPHER_SUITE_WEP104) && !sta) { 2251 - if (cmd == SET_KEY) 2252 - is_default_wep_key = !ctx->key_mapping_keys; 2253 - else 2254 - is_default_wep_key = 2255 - key->hw_key_idx == IWLAGN_HW_KEY_DEFAULT; 2256 - } 2257 - 2258 - 2259 - switch (cmd) { 2260 - case SET_KEY: 2261 - if (is_default_wep_key) { 2262 - ret = iwl_set_default_wep_key(priv, vif_priv->ctx, key); 2263 - break; 2264 - } 2265 - ret = iwl_set_dynamic_key(priv, vif_priv->ctx, key, sta); 2266 - if (ret) { 2267 - /* 2268 - * can't add key for RX, but we don't need it 2269 - * in the device for TX so still return 0 2270 - */ 2271 - ret = 0; 2272 - key->hw_key_idx = WEP_INVALID_OFFSET; 2273 - } 2274 - 2275 - IWL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); 2276 - break; 2277 - case DISABLE_KEY: 2278 - if (is_default_wep_key) 2279 - ret = iwl_remove_default_wep_key(priv, ctx, key); 2280 - else 2281 - ret = iwl_remove_dynamic_key(priv, ctx, key, sta); 2282 - 2283 - IWL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); 2284 - break; 2285 - default: 2286 - ret = -EINVAL; 2287 - } 2288 - 2289 - mutex_unlock(&priv->shrd->mutex); 2290 - IWL_DEBUG_MAC80211(priv, "leave\n"); 2291 - 2292 - return ret; 2293 - } 2294 - 2295 - static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw, 2296 - struct ieee80211_vif *vif, 2297 - enum ieee80211_ampdu_mlme_action action, 2298 - struct ieee80211_sta *sta, u16 tid, u16 *ssn, 2299 - u8 buf_size) 2300 - { 2301 - struct iwl_priv *priv = hw->priv; 2302 - int ret = -EINVAL; 2303 - struct iwl_station_priv *sta_priv = (void *) sta->drv_priv; 2304 - struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 2305 - 2306 - IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", 2307 - sta->addr, tid); 2308 - 2309 - if (!(priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE)) 2310 - return -EACCES; 2311 - 2312 - IWL_DEBUG_MAC80211(priv, "enter\n"); 2313 - mutex_lock(&priv->shrd->mutex); 2314 - 2315 - switch (action) { 2316 - case IEEE80211_AMPDU_RX_START: 2317 - IWL_DEBUG_HT(priv, "start Rx\n"); 2318 - ret = iwl_sta_rx_agg_start(priv, sta, tid, *ssn); 2319 - break; 2320 - case IEEE80211_AMPDU_RX_STOP: 2321 - IWL_DEBUG_HT(priv, "stop Rx\n"); 2322 - ret = iwl_sta_rx_agg_stop(priv, sta, tid); 2323 - if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 2324 - ret = 0; 2325 - break; 2326 - case IEEE80211_AMPDU_TX_START: 2327 - IWL_DEBUG_HT(priv, "start Tx\n"); 2328 - ret = iwlagn_tx_agg_start(priv, vif, sta, tid, ssn); 2329 - break; 2330 - case IEEE80211_AMPDU_TX_STOP: 2331 - IWL_DEBUG_HT(priv, "stop Tx\n"); 2332 - ret = iwlagn_tx_agg_stop(priv, vif, sta, tid); 2333 - if ((ret == 0) && (priv->agg_tids_count > 0)) { 2334 - priv->agg_tids_count--; 2335 - IWL_DEBUG_HT(priv, "priv->agg_tids_count = %u\n", 2336 - priv->agg_tids_count); 2337 - } 2338 - if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 2339 - ret = 0; 2340 - if (!priv->agg_tids_count && priv->cfg->ht_params && 2341 - priv->cfg->ht_params->use_rts_for_aggregation) { 2342 - /* 2343 - * switch off RTS/CTS if it was previously enabled 2344 - */ 2345 - sta_priv->lq_sta.lq.general_params.flags &= 2346 - ~LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK; 2347 - iwl_send_lq_cmd(priv, iwl_rxon_ctx_from_vif(vif), 2348 - &sta_priv->lq_sta.lq, CMD_ASYNC, false); 2349 - } 2350 - break; 2351 - case IEEE80211_AMPDU_TX_OPERATIONAL: 2352 - buf_size = min_t(int, buf_size, LINK_QUAL_AGG_FRAME_LIMIT_DEF); 2353 - 2354 - iwl_trans_tx_agg_setup(trans(priv), ctx->ctxid, iwl_sta_id(sta), 2355 - tid, buf_size); 2356 - 2357 - /* 2358 - * If the limit is 0, then it wasn't initialised yet, 2359 - * use the default. We can do that since we take the 2360 - * minimum below, and we don't want to go above our 2361 - * default due to hardware restrictions. 2362 - */ 2363 - if (sta_priv->max_agg_bufsize == 0) 2364 - sta_priv->max_agg_bufsize = 2365 - LINK_QUAL_AGG_FRAME_LIMIT_DEF; 2366 - 2367 - /* 2368 - * Even though in theory the peer could have different 2369 - * aggregation reorder buffer sizes for different sessions, 2370 - * our ucode doesn't allow for that and has a global limit 2371 - * for each station. Therefore, use the minimum of all the 2372 - * aggregation sessions and our default value. 2373 - */ 2374 - sta_priv->max_agg_bufsize = 2375 - min(sta_priv->max_agg_bufsize, buf_size); 2376 - 2377 - if (priv->cfg->ht_params && 2378 - priv->cfg->ht_params->use_rts_for_aggregation) { 2379 - /* 2380 - * switch to RTS/CTS if it is the prefer protection 2381 - * method for HT traffic 2382 - */ 2383 - 2384 - sta_priv->lq_sta.lq.general_params.flags |= 2385 - LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK; 2386 - } 2387 - priv->agg_tids_count++; 2388 - IWL_DEBUG_HT(priv, "priv->agg_tids_count = %u\n", 2389 - priv->agg_tids_count); 2390 - 2391 - sta_priv->lq_sta.lq.agg_params.agg_frame_cnt_limit = 2392 - sta_priv->max_agg_bufsize; 2393 - 2394 - iwl_send_lq_cmd(priv, iwl_rxon_ctx_from_vif(vif), 2395 - &sta_priv->lq_sta.lq, CMD_ASYNC, false); 2396 - 2397 - IWL_INFO(priv, "Tx aggregation enabled on ra = %pM tid = %d\n", 2398 - sta->addr, tid); 2399 - ret = 0; 2400 - break; 2401 - } 2402 - mutex_unlock(&priv->shrd->mutex); 2403 - IWL_DEBUG_MAC80211(priv, "leave\n"); 2404 - return ret; 2405 - } 2406 - 2407 - static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, 2408 - struct ieee80211_vif *vif, 2409 - struct ieee80211_sta *sta) 2410 - { 2411 - struct iwl_priv *priv = hw->priv; 2412 - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 2413 - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 2414 - bool is_ap = vif->type == NL80211_IFTYPE_STATION; 2415 - int ret = 0; 2416 - u8 sta_id; 2417 - 2418 - IWL_DEBUG_MAC80211(priv, "received request to add station %pM\n", 2419 - sta->addr); 2420 - mutex_lock(&priv->shrd->mutex); 2421 - IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n", 2422 - sta->addr); 2423 - sta_priv->sta_id = IWL_INVALID_STATION; 2424 - 2425 - atomic_set(&sta_priv->pending_frames, 0); 2426 - if (vif->type == NL80211_IFTYPE_AP) 2427 - sta_priv->client = true; 2428 - 2429 - ret = iwl_add_station_common(priv, vif_priv->ctx, sta->addr, 2430 - is_ap, sta, &sta_id); 2431 - if (ret) { 2432 - IWL_ERR(priv, "Unable to add station %pM (%d)\n", 2433 - sta->addr, ret); 2434 - /* Should we return success if return code is EEXIST ? */ 2435 - goto out; 2436 - } 2437 - 2438 - sta_priv->sta_id = sta_id; 2439 - 2440 - /* Initialize rate scaling */ 2441 - IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", 2442 - sta->addr); 2443 - iwl_rs_rate_init(priv, sta, sta_id); 2444 - out: 2445 - mutex_unlock(&priv->shrd->mutex); 2446 - IWL_DEBUG_MAC80211(priv, "leave\n"); 2447 - 2448 - return ret; 2449 - } 2450 - 2451 - static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, 2452 - struct ieee80211_channel_switch *ch_switch) 2453 - { 2454 - struct iwl_priv *priv = hw->priv; 2455 - const struct iwl_channel_info *ch_info; 2456 - struct ieee80211_conf *conf = &hw->conf; 2457 - struct ieee80211_channel *channel = ch_switch->channel; 2458 - struct iwl_ht_config *ht_conf = &priv->current_ht_config; 2459 - /* 2460 - * MULTI-FIXME 2461 - * When we add support for multiple interfaces, we need to 2462 - * revisit this. The channel switch command in the device 2463 - * only affects the BSS context, but what does that really 2464 - * mean? And what if we get a CSA on the second interface? 2465 - * This needs a lot of work. 2466 - */ 2467 - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2468 - u16 ch; 2469 - 2470 - IWL_DEBUG_MAC80211(priv, "enter\n"); 2471 - 2472 - mutex_lock(&priv->shrd->mutex); 2473 - 2474 - if (iwl_is_rfkill(priv->shrd)) 2475 - goto out; 2476 - 2477 - if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) || 2478 - test_bit(STATUS_SCANNING, &priv->shrd->status) || 2479 - test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status)) 2480 - goto out; 2481 - 2482 - if (!iwl_is_associated_ctx(ctx)) 2483 - goto out; 2484 - 2485 - if (!priv->cfg->lib->set_channel_switch) 2486 - goto out; 2487 - 2488 - ch = channel->hw_value; 2489 - if (le16_to_cpu(ctx->active.channel) == ch) 2490 - goto out; 2491 - 2492 - ch_info = iwl_get_channel_info(priv, channel->band, ch); 2493 - if (!is_channel_valid(ch_info)) { 2494 - IWL_DEBUG_MAC80211(priv, "invalid channel\n"); 2495 - goto out; 2496 - } 2497 - 2498 - spin_lock_irq(&priv->shrd->lock); 2499 - 2500 - priv->current_ht_config.smps = conf->smps_mode; 2501 - 2502 - /* Configure HT40 channels */ 2503 - ctx->ht.enabled = conf_is_ht(conf); 2504 - if (ctx->ht.enabled) { 2505 - if (conf_is_ht40_minus(conf)) { 2506 - ctx->ht.extension_chan_offset = 2507 - IEEE80211_HT_PARAM_CHA_SEC_BELOW; 2508 - ctx->ht.is_40mhz = true; 2509 - } else if (conf_is_ht40_plus(conf)) { 2510 - ctx->ht.extension_chan_offset = 2511 - IEEE80211_HT_PARAM_CHA_SEC_ABOVE; 2512 - ctx->ht.is_40mhz = true; 2513 - } else { 2514 - ctx->ht.extension_chan_offset = 2515 - IEEE80211_HT_PARAM_CHA_SEC_NONE; 2516 - ctx->ht.is_40mhz = false; 2517 - } 2518 - } else 2519 - ctx->ht.is_40mhz = false; 2520 - 2521 - if ((le16_to_cpu(ctx->staging.channel) != ch)) 2522 - ctx->staging.flags = 0; 2523 - 2524 - iwl_set_rxon_channel(priv, channel, ctx); 2525 - iwl_set_rxon_ht(priv, ht_conf); 2526 - iwl_set_flags_for_band(priv, ctx, channel->band, ctx->vif); 2527 - 2528 - spin_unlock_irq(&priv->shrd->lock); 2529 - 2530 - iwl_set_rate(priv); 2531 - /* 2532 - * at this point, staging_rxon has the 2533 - * configuration for channel switch 2534 - */ 2535 - set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status); 2536 - priv->switch_channel = cpu_to_le16(ch); 2537 - if (priv->cfg->lib->set_channel_switch(priv, ch_switch)) { 2538 - clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status); 2539 - priv->switch_channel = 0; 2540 - ieee80211_chswitch_done(ctx->vif, false); 2541 - } 2542 - 2543 - out: 2544 - mutex_unlock(&priv->shrd->mutex); 2545 - IWL_DEBUG_MAC80211(priv, "leave\n"); 2546 - } 2547 - 2548 - static void iwlagn_configure_filter(struct ieee80211_hw *hw, 2549 - unsigned int changed_flags, 2550 - unsigned int *total_flags, 2551 - u64 multicast) 2552 - { 2553 - struct iwl_priv *priv = hw->priv; 2554 - __le32 filter_or = 0, filter_nand = 0; 2555 - struct iwl_rxon_context *ctx; 2556 - 2557 - #define CHK(test, flag) do { \ 2558 - if (*total_flags & (test)) \ 2559 - filter_or |= (flag); \ 2560 - else \ 2561 - filter_nand |= (flag); \ 2562 - } while (0) 2563 - 2564 - IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", 2565 - changed_flags, *total_flags); 2566 - 2567 - CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); 2568 - /* Setting _just_ RXON_FILTER_CTL2HOST_MSK causes FH errors */ 2569 - CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_PROMISC_MSK); 2570 - CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); 2571 - 2572 - #undef CHK 2573 - 2574 - mutex_lock(&priv->shrd->mutex); 2575 - 2576 - for_each_context(priv, ctx) { 2577 - ctx->staging.filter_flags &= ~filter_nand; 2578 - ctx->staging.filter_flags |= filter_or; 2579 - 2580 - /* 2581 - * Not committing directly because hardware can perform a scan, 2582 - * but we'll eventually commit the filter flags change anyway. 2583 - */ 2584 - } 2585 - 2586 - mutex_unlock(&priv->shrd->mutex); 2587 - 2588 - /* 2589 - * Receiving all multicast frames is always enabled by the 2590 - * default flags setup in iwl_connection_init_rx_config() 2591 - * since we currently do not support programming multicast 2592 - * filters into the device. 2593 - */ 2594 - *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | 2595 - FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; 2596 - } 2597 - 2598 - static void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop) 2599 - { 2600 - struct iwl_priv *priv = hw->priv; 2601 - 2602 - mutex_lock(&priv->shrd->mutex); 2603 - IWL_DEBUG_MAC80211(priv, "enter\n"); 2604 - 2605 - if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) { 2606 - IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n"); 2607 - goto done; 2608 - } 2609 - if (iwl_is_rfkill(priv->shrd)) { 2610 - IWL_DEBUG_TX(priv, "Aborting flush due to RF Kill\n"); 2611 - goto done; 2612 - } 2613 - 2614 - /* 2615 - * mac80211 will not push any more frames for transmit 2616 - * until the flush is completed 2617 - */ 2618 - if (drop) { 2619 - IWL_DEBUG_MAC80211(priv, "send flush command\n"); 2620 - if (iwlagn_txfifo_flush(priv, IWL_DROP_ALL)) { 2621 - IWL_ERR(priv, "flush request fail\n"); 2622 - goto done; 2623 - } 2624 - } 2625 - IWL_DEBUG_MAC80211(priv, "wait transmit/flush all frames\n"); 2626 - iwl_trans_wait_tx_queue_empty(trans(priv)); 2627 - done: 2628 - mutex_unlock(&priv->shrd->mutex); 2629 - IWL_DEBUG_MAC80211(priv, "leave\n"); 2630 - } 2631 1564 2632 1565 void iwlagn_disable_roc(struct iwl_priv *priv) 2633 1566 { ··· 1487 2764 mutex_lock(&priv->shrd->mutex); 1488 2765 iwlagn_disable_roc(priv); 1489 2766 mutex_unlock(&priv->shrd->mutex); 1490 - } 1491 - 1492 - static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw, 1493 - struct ieee80211_channel *channel, 1494 - enum nl80211_channel_type channel_type, 1495 - int duration) 1496 - { 1497 - struct iwl_priv *priv = hw->priv; 1498 - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_PAN]; 1499 - int err = 0; 1500 - 1501 - if (!(priv->shrd->valid_contexts & BIT(IWL_RXON_CTX_PAN))) 1502 - return -EOPNOTSUPP; 1503 - 1504 - if (!(ctx->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT))) 1505 - return -EOPNOTSUPP; 1506 - 1507 - IWL_DEBUG_MAC80211(priv, "enter\n"); 1508 - mutex_lock(&priv->shrd->mutex); 1509 - 1510 - if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) { 1511 - err = -EBUSY; 1512 - goto out; 1513 - } 1514 - 1515 - priv->hw_roc_channel = channel; 1516 - priv->hw_roc_chantype = channel_type; 1517 - priv->hw_roc_duration = duration; 1518 - priv->hw_roc_start_notified = false; 1519 - cancel_delayed_work(&priv->hw_roc_disable_work); 1520 - 1521 - if (!ctx->is_active) { 1522 - ctx->is_active = true; 1523 - ctx->staging.dev_type = RXON_DEV_TYPE_P2P; 1524 - memcpy(ctx->staging.node_addr, 1525 - priv->contexts[IWL_RXON_CTX_BSS].staging.node_addr, 1526 - ETH_ALEN); 1527 - memcpy(ctx->staging.bssid_addr, 1528 - priv->contexts[IWL_RXON_CTX_BSS].staging.node_addr, 1529 - ETH_ALEN); 1530 - err = iwlagn_commit_rxon(priv, ctx); 1531 - if (err) 1532 - goto out; 1533 - ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK | 1534 - RXON_FILTER_PROMISC_MSK | 1535 - RXON_FILTER_CTL2HOST_MSK; 1536 - 1537 - err = iwlagn_commit_rxon(priv, ctx); 1538 - if (err) { 1539 - iwlagn_disable_roc(priv); 1540 - goto out; 1541 - } 1542 - priv->hw_roc_setup = true; 1543 - } 1544 - 1545 - err = iwl_scan_initiate(priv, ctx->vif, IWL_SCAN_ROC, channel->band); 1546 - if (err) 1547 - iwlagn_disable_roc(priv); 1548 - 1549 - out: 1550 - mutex_unlock(&priv->shrd->mutex); 1551 - IWL_DEBUG_MAC80211(priv, "leave\n"); 1552 - 1553 - return err; 1554 - } 1555 - 1556 - static int iwlagn_mac_cancel_remain_on_channel(struct ieee80211_hw *hw) 1557 - { 1558 - struct iwl_priv *priv = hw->priv; 1559 - 1560 - if (!(priv->shrd->valid_contexts & BIT(IWL_RXON_CTX_PAN))) 1561 - return -EOPNOTSUPP; 1562 - 1563 - IWL_DEBUG_MAC80211(priv, "enter\n"); 1564 - mutex_lock(&priv->shrd->mutex); 1565 - iwl_scan_cancel_timeout(priv, priv->hw_roc_duration); 1566 - iwlagn_disable_roc(priv); 1567 - mutex_unlock(&priv->shrd->mutex); 1568 - IWL_DEBUG_MAC80211(priv, "leave\n"); 1569 - 1570 - return 0; 1571 - } 1572 - 1573 - static int iwlagn_mac_tx_sync(struct ieee80211_hw *hw, 1574 - struct ieee80211_vif *vif, 1575 - const u8 *bssid, 1576 - enum ieee80211_tx_sync_type type) 1577 - { 1578 - struct iwl_priv *priv = hw->priv; 1579 - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1580 - struct iwl_rxon_context *ctx = vif_priv->ctx; 1581 - int ret; 1582 - u8 sta_id; 1583 - 1584 - IWL_DEBUG_MAC80211(priv, "enter\n"); 1585 - mutex_lock(&priv->shrd->mutex); 1586 - 1587 - if (iwl_is_associated_ctx(ctx)) { 1588 - ret = 0; 1589 - goto out; 1590 - } 1591 - 1592 - if (ctx->preauth_bssid || test_bit(STATUS_SCAN_HW, &priv->shrd->status)) { 1593 - ret = -EBUSY; 1594 - goto out; 1595 - } 1596 - 1597 - ret = iwl_add_station_common(priv, ctx, bssid, true, NULL, &sta_id); 1598 - if (ret) 1599 - goto out; 1600 - 1601 - if (WARN_ON(sta_id != ctx->ap_sta_id)) { 1602 - ret = -EIO; 1603 - goto out_remove_sta; 1604 - } 1605 - 1606 - memcpy(ctx->bssid, bssid, ETH_ALEN); 1607 - ctx->preauth_bssid = true; 1608 - 1609 - ret = iwlagn_commit_rxon(priv, ctx); 1610 - 1611 - if (ret == 0) 1612 - goto out; 1613 - 1614 - out_remove_sta: 1615 - iwl_remove_station(priv, sta_id, bssid); 1616 - out: 1617 - mutex_unlock(&priv->shrd->mutex); 1618 - IWL_DEBUG_MAC80211(priv, "leave\n"); 1619 - 1620 - return ret; 1621 - } 1622 - 1623 - static void iwlagn_mac_finish_tx_sync(struct ieee80211_hw *hw, 1624 - struct ieee80211_vif *vif, 1625 - const u8 *bssid, 1626 - enum ieee80211_tx_sync_type type) 1627 - { 1628 - struct iwl_priv *priv = hw->priv; 1629 - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1630 - struct iwl_rxon_context *ctx = vif_priv->ctx; 1631 - 1632 - IWL_DEBUG_MAC80211(priv, "enter\n"); 1633 - mutex_lock(&priv->shrd->mutex); 1634 - 1635 - if (iwl_is_associated_ctx(ctx)) 1636 - goto out; 1637 - 1638 - iwl_remove_station(priv, ctx->ap_sta_id, bssid); 1639 - ctx->preauth_bssid = false; 1640 - /* no need to commit */ 1641 - out: 1642 - mutex_unlock(&priv->shrd->mutex); 1643 - IWL_DEBUG_MAC80211(priv, "leave\n"); 1644 2767 } 1645 2768 1646 2769 /***************************************************************************** ··· 1638 3069 kmem_cache_destroy(priv->tx_cmd_pool); 1639 3070 kfree(priv->scan_cmd); 1640 3071 kfree(priv->beacon_cmd); 3072 + kfree(rcu_dereference_raw(priv->noa_data)); 1641 3073 #ifdef CONFIG_IWLWIFI_DEBUGFS 1642 3074 kfree(priv->wowlan_sram); 1643 3075 #endif 1644 3076 } 1645 3077 1646 - static void iwlagn_mac_rssi_callback(struct ieee80211_hw *hw, 1647 - enum ieee80211_rssi_event rssi_event) 1648 - { 1649 - struct iwl_priv *priv = hw->priv; 1650 3078 1651 - IWL_DEBUG_MAC80211(priv, "enter\n"); 1652 - mutex_lock(&priv->shrd->mutex); 1653 - 1654 - if (priv->cfg->bt_params && 1655 - priv->cfg->bt_params->advanced_bt_coexist) { 1656 - if (rssi_event == RSSI_EVENT_LOW) 1657 - priv->bt_enable_pspoll = true; 1658 - else if (rssi_event == RSSI_EVENT_HIGH) 1659 - priv->bt_enable_pspoll = false; 1660 - 1661 - iwlagn_send_advance_bt_config(priv); 1662 - } else { 1663 - IWL_DEBUG_MAC80211(priv, "Advanced BT coex disabled," 1664 - "ignoring RSSI callback\n"); 1665 - } 1666 - 1667 - mutex_unlock(&priv->shrd->mutex); 1668 - IWL_DEBUG_MAC80211(priv, "leave\n"); 1669 - } 1670 - 1671 - static int iwlagn_mac_set_tim(struct ieee80211_hw *hw, 1672 - struct ieee80211_sta *sta, bool set) 1673 - { 1674 - struct iwl_priv *priv = hw->priv; 1675 - 1676 - queue_work(priv->shrd->workqueue, &priv->beacon_update); 1677 - 1678 - return 0; 1679 - } 1680 - 1681 - struct ieee80211_ops iwlagn_hw_ops = { 1682 - .tx = iwlagn_mac_tx, 1683 - .start = iwlagn_mac_start, 1684 - .stop = iwlagn_mac_stop, 1685 - #ifdef CONFIG_PM_SLEEP 1686 - .suspend = iwlagn_mac_suspend, 1687 - .resume = iwlagn_mac_resume, 1688 - #endif 1689 - .add_interface = iwlagn_mac_add_interface, 1690 - .remove_interface = iwlagn_mac_remove_interface, 1691 - .change_interface = iwlagn_mac_change_interface, 1692 - .config = iwlagn_mac_config, 1693 - .configure_filter = iwlagn_configure_filter, 1694 - .set_key = iwlagn_mac_set_key, 1695 - .update_tkip_key = iwlagn_mac_update_tkip_key, 1696 - .set_rekey_data = iwlagn_mac_set_rekey_data, 1697 - .conf_tx = iwlagn_mac_conf_tx, 1698 - .bss_info_changed = iwlagn_bss_info_changed, 1699 - .ampdu_action = iwlagn_mac_ampdu_action, 1700 - .hw_scan = iwlagn_mac_hw_scan, 1701 - .sta_notify = iwlagn_mac_sta_notify, 1702 - .sta_add = iwlagn_mac_sta_add, 1703 - .sta_remove = iwlagn_mac_sta_remove, 1704 - .channel_switch = iwlagn_mac_channel_switch, 1705 - .flush = iwlagn_mac_flush, 1706 - .tx_last_beacon = iwlagn_mac_tx_last_beacon, 1707 - .remain_on_channel = iwlagn_mac_remain_on_channel, 1708 - .cancel_remain_on_channel = iwlagn_mac_cancel_remain_on_channel, 1709 - .rssi_callback = iwlagn_mac_rssi_callback, 1710 - CFG80211_TESTMODE_CMD(iwlagn_mac_testmode_cmd) 1711 - CFG80211_TESTMODE_DUMP(iwlagn_mac_testmode_dump) 1712 - .tx_sync = iwlagn_mac_tx_sync, 1713 - .finish_tx_sync = iwlagn_mac_finish_tx_sync, 1714 - .set_tim = iwlagn_mac_set_tim, 1715 - }; 1716 3079 1717 3080 static u32 iwl_hw_detect(struct iwl_priv *priv) 1718 3081 { ··· 1678 3177 return priv->cfg->lib->set_hw_params(priv); 1679 3178 } 1680 3179 1681 - /* This function both allocates and initializes hw and priv. */ 1682 - static struct ieee80211_hw *iwl_alloc_all(void) 1683 - { 1684 - struct iwl_priv *priv; 1685 - /* mac80211 allocates memory for this device instance, including 1686 - * space for this driver's private structure */ 1687 - struct ieee80211_hw *hw; 1688 3180 1689 - hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), &iwlagn_hw_ops); 1690 - if (!hw) 1691 - goto out; 1692 - 1693 - priv = hw->priv; 1694 - priv->hw = hw; 1695 - 1696 - out: 1697 - return hw; 1698 - } 1699 3181 1700 3182 int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops, 1701 3183 struct iwl_cfg *cfg) ··· 1886 3402 /*This will stop the queues, move the device to low power state */ 1887 3403 iwl_trans_stop_device(trans(priv)); 1888 3404 1889 - iwl_dealloc_ucode(priv); 3405 + iwl_dealloc_ucode(trans(priv)); 1890 3406 1891 3407 iwl_eeprom_free(priv); 1892 3408
+22 -9
drivers/net/wireless/iwlwifi/iwl-agn.h
··· 65 65 66 66 #include "iwl-dev.h" 67 67 68 + struct iwlagn_ucode_capabilities { 69 + u32 max_probe_length; 70 + u32 standard_phy_calibration_size; 71 + u32 flags; 72 + }; 73 + 68 74 extern struct ieee80211_ops iwlagn_hw_ops; 69 75 70 76 int iwl_reset_ict(struct iwl_trans *trans); ··· 82 76 hdr->groups_num = 1; 83 77 hdr->data_valid = 1; 84 78 } 79 + 80 + void __iwl_down(struct iwl_priv *priv); 81 + void iwl_down(struct iwl_priv *priv); 82 + void iwlagn_prepare_restart(struct iwl_priv *priv); 83 + 84 + /* MAC80211 */ 85 + struct ieee80211_hw *iwl_alloc_all(void); 86 + int iwlagn_mac_setup_register(struct iwl_priv *priv, 87 + struct iwlagn_ucode_capabilities *capa); 85 88 86 89 /* RXON */ 87 90 int iwlagn_set_pan_params(struct iwl_priv *priv); ··· 110 95 void iwlagn_send_prio_tbl(struct iwl_priv *priv); 111 96 int iwlagn_run_init_ucode(struct iwl_priv *priv); 112 97 int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, 113 - struct fw_img *image, 114 - enum iwlagn_ucode_type ucode_type); 98 + enum iwl_ucode_type ucode_type); 115 99 116 100 /* lib */ 117 101 int iwlagn_send_tx_power(struct iwl_priv *priv); ··· 119 105 int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control); 120 106 void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control); 121 107 int iwlagn_send_beacon_cmd(struct iwl_priv *priv); 108 + #ifdef CONFIG_PM_SLEEP 109 + int iwlagn_send_patterns(struct iwl_priv *priv, 110 + struct cfg80211_wowlan *wowlan); 111 + int iwlagn_suspend(struct iwl_priv *priv, 112 + struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); 113 + #endif 122 114 123 115 /* rx */ 124 116 int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band); ··· 216 196 struct ieee80211_sta *sta, u8 *sta_id_r); 217 197 int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, 218 198 const u8 *addr); 219 - int iwlagn_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 220 - struct ieee80211_sta *sta); 221 - 222 199 u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 223 200 const u8 *addr, bool is_ap, struct ieee80211_sta *sta); 224 201 ··· 333 316 int iwl_update_bcast_station(struct iwl_priv *priv, 334 317 struct iwl_rxon_context *ctx); 335 318 int iwl_update_bcast_stations(struct iwl_priv *priv); 336 - void iwlagn_mac_sta_notify(struct ieee80211_hw *hw, 337 - struct ieee80211_vif *vif, 338 - enum sta_notify_cmd cmd, 339 - struct ieee80211_sta *sta); 340 319 341 320 /* rate */ 342 321 static inline u32 iwl_ant_idx_to_flags(u8 ant_idx)
-6
drivers/net/wireless/iwlwifi/iwl-cfg.h
··· 101 101 extern struct iwl_cfg iwl130_bgn_cfg; 102 102 extern struct iwl_cfg iwl130_bg_cfg; 103 103 extern struct iwl_cfg iwl2000_2bgn_cfg; 104 - extern struct iwl_cfg iwl2000_2bg_cfg; 105 104 extern struct iwl_cfg iwl2000_2bgn_d_cfg; 106 105 extern struct iwl_cfg iwl2030_2bgn_cfg; 107 - extern struct iwl_cfg iwl2030_2bg_cfg; 108 106 extern struct iwl_cfg iwl6035_2agn_cfg; 109 - extern struct iwl_cfg iwl6035_2abg_cfg; 110 - extern struct iwl_cfg iwl6035_2bg_cfg; 111 - extern struct iwl_cfg iwl105_bg_cfg; 112 107 extern struct iwl_cfg iwl105_bgn_cfg; 113 108 extern struct iwl_cfg iwl105_bgn_d_cfg; 114 - extern struct iwl_cfg iwl135_bg_cfg; 115 109 extern struct iwl_cfg iwl135_bgn_cfg; 116 110 117 111 #endif /* __iwl_pci_h__ */
+1 -306
drivers/net/wireless/iwlwifi/iwl-core.c
··· 1120 1120 &statistics_cmd); 1121 1121 } 1122 1122 1123 - int iwlagn_mac_conf_tx(struct ieee80211_hw *hw, 1124 - struct ieee80211_vif *vif, u16 queue, 1125 - const struct ieee80211_tx_queue_params *params) 1126 - { 1127 - struct iwl_priv *priv = hw->priv; 1128 - struct iwl_rxon_context *ctx; 1129 - unsigned long flags; 1130 - int q; 1131 1123 1132 - IWL_DEBUG_MAC80211(priv, "enter\n"); 1133 1124 1134 - if (!iwl_is_ready_rf(priv->shrd)) { 1135 - IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); 1136 - return -EIO; 1137 - } 1138 - 1139 - if (queue >= AC_NUM) { 1140 - IWL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue); 1141 - return 0; 1142 - } 1143 - 1144 - q = AC_NUM - 1 - queue; 1145 - 1146 - spin_lock_irqsave(&priv->shrd->lock, flags); 1147 - 1148 - /* 1149 - * MULTI-FIXME 1150 - * This may need to be done per interface in nl80211/cfg80211/mac80211. 1151 - */ 1152 - for_each_context(priv, ctx) { 1153 - ctx->qos_data.def_qos_parm.ac[q].cw_min = 1154 - cpu_to_le16(params->cw_min); 1155 - ctx->qos_data.def_qos_parm.ac[q].cw_max = 1156 - cpu_to_le16(params->cw_max); 1157 - ctx->qos_data.def_qos_parm.ac[q].aifsn = params->aifs; 1158 - ctx->qos_data.def_qos_parm.ac[q].edca_txop = 1159 - cpu_to_le16((params->txop * 32)); 1160 - 1161 - ctx->qos_data.def_qos_parm.ac[q].reserved1 = 0; 1162 - } 1163 - 1164 - spin_unlock_irqrestore(&priv->shrd->lock, flags); 1165 - 1166 - IWL_DEBUG_MAC80211(priv, "leave\n"); 1167 - return 0; 1168 - } 1169 - 1170 - int iwlagn_mac_tx_last_beacon(struct ieee80211_hw *hw) 1171 - { 1172 - struct iwl_priv *priv = hw->priv; 1173 - 1174 - return priv->ibss_manager == IWL_IBSS_MANAGER; 1175 - } 1176 - 1177 - static int iwl_set_mode(struct iwl_priv *priv, struct iwl_rxon_context *ctx) 1178 - { 1179 - iwl_connection_init_rx_config(priv, ctx); 1180 - 1181 - iwlagn_set_rxon_chain(priv, ctx); 1182 - 1183 - return iwlagn_commit_rxon(priv, ctx); 1184 - } 1185 - 1186 - static int iwl_setup_interface(struct iwl_priv *priv, 1187 - struct iwl_rxon_context *ctx) 1188 - { 1189 - struct ieee80211_vif *vif = ctx->vif; 1190 - int err; 1191 - 1192 - lockdep_assert_held(&priv->shrd->mutex); 1193 - 1194 - /* 1195 - * This variable will be correct only when there's just 1196 - * a single context, but all code using it is for hardware 1197 - * that supports only one context. 1198 - */ 1199 - priv->iw_mode = vif->type; 1200 - 1201 - ctx->is_active = true; 1202 - 1203 - err = iwl_set_mode(priv, ctx); 1204 - if (err) { 1205 - if (!ctx->always_active) 1206 - ctx->is_active = false; 1207 - return err; 1208 - } 1209 - 1210 - if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist && 1211 - vif->type == NL80211_IFTYPE_ADHOC) { 1212 - /* 1213 - * pretend to have high BT traffic as long as we 1214 - * are operating in IBSS mode, as this will cause 1215 - * the rate scaling etc. to behave as intended. 1216 - */ 1217 - priv->bt_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_HIGH; 1218 - } 1219 - 1220 - return 0; 1221 - } 1222 - 1223 - int iwlagn_mac_add_interface(struct ieee80211_hw *hw, 1224 - struct ieee80211_vif *vif) 1225 - { 1226 - struct iwl_priv *priv = hw->priv; 1227 - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1228 - struct iwl_rxon_context *tmp, *ctx = NULL; 1229 - int err; 1230 - enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); 1231 - 1232 - IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", 1233 - viftype, vif->addr); 1234 - 1235 - cancel_delayed_work_sync(&priv->hw_roc_disable_work); 1236 - 1237 - mutex_lock(&priv->shrd->mutex); 1238 - 1239 - iwlagn_disable_roc(priv); 1240 - 1241 - if (!iwl_is_ready_rf(priv->shrd)) { 1242 - IWL_WARN(priv, "Try to add interface when device not ready\n"); 1243 - err = -EINVAL; 1244 - goto out; 1245 - } 1246 - 1247 - for_each_context(priv, tmp) { 1248 - u32 possible_modes = 1249 - tmp->interface_modes | tmp->exclusive_interface_modes; 1250 - 1251 - if (tmp->vif) { 1252 - /* check if this busy context is exclusive */ 1253 - if (tmp->exclusive_interface_modes & 1254 - BIT(tmp->vif->type)) { 1255 - err = -EINVAL; 1256 - goto out; 1257 - } 1258 - continue; 1259 - } 1260 - 1261 - if (!(possible_modes & BIT(viftype))) 1262 - continue; 1263 - 1264 - /* have maybe usable context w/o interface */ 1265 - ctx = tmp; 1266 - break; 1267 - } 1268 - 1269 - if (!ctx) { 1270 - err = -EOPNOTSUPP; 1271 - goto out; 1272 - } 1273 - 1274 - vif_priv->ctx = ctx; 1275 - ctx->vif = vif; 1276 - 1277 - err = iwl_setup_interface(priv, ctx); 1278 - if (!err) 1279 - goto out; 1280 - 1281 - ctx->vif = NULL; 1282 - priv->iw_mode = NL80211_IFTYPE_STATION; 1283 - out: 1284 - mutex_unlock(&priv->shrd->mutex); 1285 - 1286 - IWL_DEBUG_MAC80211(priv, "leave\n"); 1287 - return err; 1288 - } 1289 - 1290 - static void iwl_teardown_interface(struct iwl_priv *priv, 1291 - struct ieee80211_vif *vif, 1292 - bool mode_change) 1293 - { 1294 - struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 1295 - 1296 - lockdep_assert_held(&priv->shrd->mutex); 1297 - 1298 - if (priv->scan_vif == vif) { 1299 - iwl_scan_cancel_timeout(priv, 200); 1300 - iwl_force_scan_end(priv); 1301 - } 1302 - 1303 - if (!mode_change) { 1304 - iwl_set_mode(priv, ctx); 1305 - if (!ctx->always_active) 1306 - ctx->is_active = false; 1307 - } 1308 - 1309 - /* 1310 - * When removing the IBSS interface, overwrite the 1311 - * BT traffic load with the stored one from the last 1312 - * notification, if any. If this is a device that 1313 - * doesn't implement this, this has no effect since 1314 - * both values are the same and zero. 1315 - */ 1316 - if (vif->type == NL80211_IFTYPE_ADHOC) 1317 - priv->bt_traffic_load = priv->last_bt_traffic_load; 1318 - } 1319 - 1320 - void iwlagn_mac_remove_interface(struct ieee80211_hw *hw, 1321 - struct ieee80211_vif *vif) 1322 - { 1323 - struct iwl_priv *priv = hw->priv; 1324 - struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 1325 - 1326 - IWL_DEBUG_MAC80211(priv, "enter\n"); 1327 - 1328 - mutex_lock(&priv->shrd->mutex); 1329 - 1330 - if (WARN_ON(ctx->vif != vif)) { 1331 - struct iwl_rxon_context *tmp; 1332 - IWL_ERR(priv, "ctx->vif = %p, vif = %p\n", ctx->vif, vif); 1333 - for_each_context(priv, tmp) 1334 - IWL_ERR(priv, "\tID = %d:\tctx = %p\tctx->vif = %p\n", 1335 - tmp->ctxid, tmp, tmp->vif); 1336 - } 1337 - ctx->vif = NULL; 1338 - 1339 - iwl_teardown_interface(priv, vif, false); 1340 - 1341 - mutex_unlock(&priv->shrd->mutex); 1342 - 1343 - IWL_DEBUG_MAC80211(priv, "leave\n"); 1344 - 1345 - } 1346 1125 1347 1126 #ifdef CONFIG_IWLWIFI_DEBUGFS 1348 1127 ··· 1428 1649 return 0; 1429 1650 } 1430 1651 1431 - int iwlagn_mac_change_interface(struct ieee80211_hw *hw, 1432 - struct ieee80211_vif *vif, 1433 - enum nl80211_iftype newtype, bool newp2p) 1434 - { 1435 - struct iwl_priv *priv = hw->priv; 1436 - struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 1437 - struct iwl_rxon_context *bss_ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1438 - struct iwl_rxon_context *tmp; 1439 - enum nl80211_iftype newviftype = newtype; 1440 - u32 interface_modes; 1441 - int err; 1442 - 1443 - IWL_DEBUG_MAC80211(priv, "enter\n"); 1444 - 1445 - newtype = ieee80211_iftype_p2p(newtype, newp2p); 1446 - 1447 - mutex_lock(&priv->shrd->mutex); 1448 - 1449 - if (!ctx->vif || !iwl_is_ready_rf(priv->shrd)) { 1450 - /* 1451 - * Huh? But wait ... this can maybe happen when 1452 - * we're in the middle of a firmware restart! 1453 - */ 1454 - err = -EBUSY; 1455 - goto out; 1456 - } 1457 - 1458 - interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes; 1459 - 1460 - if (!(interface_modes & BIT(newtype))) { 1461 - err = -EBUSY; 1462 - goto out; 1463 - } 1464 - 1465 - /* 1466 - * Refuse a change that should be done by moving from the PAN 1467 - * context to the BSS context instead, if the BSS context is 1468 - * available and can support the new interface type. 1469 - */ 1470 - if (ctx->ctxid == IWL_RXON_CTX_PAN && !bss_ctx->vif && 1471 - (bss_ctx->interface_modes & BIT(newtype) || 1472 - bss_ctx->exclusive_interface_modes & BIT(newtype))) { 1473 - BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); 1474 - err = -EBUSY; 1475 - goto out; 1476 - } 1477 - 1478 - if (ctx->exclusive_interface_modes & BIT(newtype)) { 1479 - for_each_context(priv, tmp) { 1480 - if (ctx == tmp) 1481 - continue; 1482 - 1483 - if (!tmp->vif) 1484 - continue; 1485 - 1486 - /* 1487 - * The current mode switch would be exclusive, but 1488 - * another context is active ... refuse the switch. 1489 - */ 1490 - err = -EBUSY; 1491 - goto out; 1492 - } 1493 - } 1494 - 1495 - /* success */ 1496 - iwl_teardown_interface(priv, vif, true); 1497 - vif->type = newviftype; 1498 - vif->p2p = newp2p; 1499 - err = iwl_setup_interface(priv, ctx); 1500 - WARN_ON(err); 1501 - /* 1502 - * We've switched internally, but submitting to the 1503 - * device may have failed for some reason. Mask this 1504 - * error, because otherwise mac80211 will not switch 1505 - * (and set the interface type back) and we'll be 1506 - * out of sync with it. 1507 - */ 1508 - err = 0; 1509 - 1510 - out: 1511 - mutex_unlock(&priv->shrd->mutex); 1512 - IWL_DEBUG_MAC80211(priv, "leave\n"); 1513 - 1514 - return err; 1515 - } 1516 1652 1517 1653 int iwl_cmd_echo_test(struct iwl_priv *priv) 1518 1654 { 1519 1655 int ret; 1520 1656 struct iwl_host_cmd cmd = { 1521 1657 .id = REPLY_ECHO, 1658 + .len = { 0 }, 1522 1659 .flags = CMD_SYNC, 1523 1660 }; 1524 1661
-14
drivers/net/wireless/iwlwifi/iwl-core.h
··· 237 237 * L i b * 238 238 ***************************/ 239 239 240 - int iwlagn_mac_conf_tx(struct ieee80211_hw *hw, 241 - struct ieee80211_vif *vif, u16 queue, 242 - const struct ieee80211_tx_queue_params *params); 243 - int iwlagn_mac_tx_last_beacon(struct ieee80211_hw *hw); 244 240 void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 245 241 int hw_decrypt); 246 242 int iwl_check_rxon_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx); ··· 256 260 void iwl_connection_init_rx_config(struct iwl_priv *priv, 257 261 struct iwl_rxon_context *ctx); 258 262 void iwl_set_rate(struct iwl_priv *priv); 259 - int iwlagn_mac_add_interface(struct ieee80211_hw *hw, 260 - struct ieee80211_vif *vif); 261 - void iwlagn_mac_remove_interface(struct ieee80211_hw *hw, 262 - struct ieee80211_vif *vif); 263 - int iwlagn_mac_change_interface(struct ieee80211_hw *hw, 264 - struct ieee80211_vif *vif, 265 - enum nl80211_iftype newtype, bool newp2p); 266 263 int iwl_cmd_echo_test(struct iwl_priv *priv); 267 264 #ifdef CONFIG_IWLWIFI_DEBUGFS 268 265 int iwl_alloc_traffic_mem(struct iwl_priv *priv); ··· 312 323 int iwl_scan_cancel(struct iwl_priv *priv); 313 324 void iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); 314 325 void iwl_force_scan_end(struct iwl_priv *priv); 315 - int iwlagn_mac_hw_scan(struct ieee80211_hw *hw, 316 - struct ieee80211_vif *vif, 317 - struct cfg80211_scan_request *req); 318 326 void iwl_internal_short_hw_scan(struct iwl_priv *priv); 319 327 int iwl_force_reset(struct iwl_priv *priv, int mode, bool external); 320 328 u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame,
+17 -2
drivers/net/wireless/iwlwifi/iwl-debug.h
··· 70 70 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ 71 71 } while (0) 72 72 73 + #define IWL_DEBUG_QUIET_RFKILL(p, fmt, args...) \ 74 + do { \ 75 + if (!iwl_is_rfkill(p->shrd)) \ 76 + dev_printk(KERN_ERR, bus(p)->dev, "%c %s " fmt, \ 77 + (in_interrupt() ? 'I' : 'U'), __func__ , ##args); \ 78 + else if (iwl_get_debug_level(p->shrd) & IWL_DL_RADIO) \ 79 + dev_printk(KERN_ERR, bus(p)->dev, "(RFKILL) %c %s " fmt, \ 80 + (in_interrupt() ? 'I' : 'U'), __func__ , ##args); \ 81 + } while (0) 82 + 73 83 #else 74 84 #define IWL_DEBUG(m, level, fmt, args...) 75 85 #define IWL_DEBUG_LIMIT(m, level, fmt, args...) 76 86 #define iwl_print_hex_dump(m, level, p, len) 87 + #define IWL_DEBUG_QUIET_RFKILL(p, fmt, args...) \ 88 + do { \ 89 + if (!iwl_is_rfkill(p->shrd)) \ 90 + IWL_ERR(p, fmt, ##args); \ 91 + } while (0) 77 92 #endif /* CONFIG_IWLWIFI_DEBUG */ 78 93 79 94 #ifdef CONFIG_IWLWIFI_DEBUGFS ··· 166 151 #define IWL_DL_11H (1 << 28) 167 152 #define IWL_DL_STATS (1 << 29) 168 153 #define IWL_DL_TX_REPLY (1 << 30) 169 - #define IWL_DL_QOS (1 << 31) 154 + #define IWL_DL_TX_QUEUES (1 << 31) 170 155 171 156 #define IWL_DEBUG_INFO(p, f, a...) IWL_DEBUG(p, IWL_DL_INFO, f, ## a) 172 157 #define IWL_DEBUG_MAC80211(p, f, a...) IWL_DEBUG(p, IWL_DL_MAC80211, f, ## a) ··· 203 188 #define IWL_DEBUG_TX_REPLY(p, f, a...) IWL_DEBUG(p, IWL_DL_TX_REPLY, f, ## a) 204 189 #define IWL_DEBUG_TX_REPLY_LIMIT(p, f, a...) \ 205 190 IWL_DEBUG_LIMIT(p, IWL_DL_TX_REPLY, f, ## a) 206 - #define IWL_DEBUG_QOS(p, f, a...) IWL_DEBUG(p, IWL_DL_QOS, f, ## a) 191 + #define IWL_DEBUG_TX_QUEUES(p, f, a...) IWL_DEBUG(p, IWL_DL_TX_QUEUES, f, ## a) 207 192 #define IWL_DEBUG_RADIO(p, f, a...) IWL_DEBUG(p, IWL_DL_RADIO, f, ## a) 208 193 #define IWL_DEBUG_POWER(p, f, a...) IWL_DEBUG(p, IWL_DL_POWER, f, ## a) 209 194 #define IWL_DEBUG_11H(p, f, a...) IWL_DEBUG(p, IWL_DL_11H, f, ## a)
+4 -4
drivers/net/wireless/iwlwifi/iwl-debugfs.c
··· 236 236 if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { 237 237 priv->dbgfs_sram_offset = 0x800000; 238 238 if (priv->ucode_type == IWL_UCODE_INIT) 239 - priv->dbgfs_sram_len = priv->ucode_init.data.len; 239 + priv->dbgfs_sram_len = trans(priv)->ucode_init.data.len; 240 240 else 241 - priv->dbgfs_sram_len = priv->ucode_rt.data.len; 241 + priv->dbgfs_sram_len = trans(priv)->ucode_rt.data.len; 242 242 } 243 243 len = priv->dbgfs_sram_len; 244 244 ··· 341 341 342 342 return simple_read_from_buffer(user_buf, count, ppos, 343 343 priv->wowlan_sram, 344 - priv->ucode_wowlan.data.len); 344 + trans(priv)->ucode_wowlan.data.len); 345 345 } 346 346 static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf, 347 347 size_t count, loff_t *ppos) ··· 430 430 eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); 431 431 pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, " 432 432 "version: 0x%x\n", 433 - (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) 433 + (trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP) 434 434 ? "OTP" : "EEPROM", eeprom_ver); 435 435 for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { 436 436 pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs);
+9 -25
drivers/net/wireless/iwlwifi/iwl-dev.h
··· 230 230 u8 ibss_bssid_sta_id; 231 231 }; 232 232 233 - /* one for each uCode image (inst/data, boot/init/runtime) */ 234 - struct fw_desc { 235 - void *v_addr; /* access by driver */ 236 - dma_addr_t p_addr; /* access by card's busmaster DMA */ 237 - u32 len; /* bytes */ 238 - }; 239 - 240 - struct fw_img { 241 - struct fw_desc code, data; 242 - }; 243 - 244 233 /* v1/v2 uCode file layout */ 245 234 struct iwl_ucode_header { 246 235 __le32 ver; /* major/minor/API/serial */ ··· 794 805 IWL_SCAN_ROC, 795 806 }; 796 807 797 - enum iwlagn_ucode_type { 798 - IWL_UCODE_NONE, 799 - IWL_UCODE_REGULAR, 800 - IWL_UCODE_INIT, 801 - IWL_UCODE_WOWLAN, 802 - }; 803 - 804 808 #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL 805 809 struct iwl_testmode_trace { 806 810 u32 buff_size; ··· 805 823 bool trace_enabled; 806 824 }; 807 825 #endif 826 + 827 + struct iwl_wipan_noa_data { 828 + struct rcu_head rcu_head; 829 + u32 length; 830 + u8 data[]; 831 + }; 808 832 809 833 struct iwl_priv { 810 834 ··· 871 883 /* init calibration results */ 872 884 struct iwl_calib_result calib_results[IWL_CALIB_MAX]; 873 885 886 + struct iwl_wipan_noa_data __rcu *noa_data; 887 + 874 888 /* Scan related variables */ 875 889 unsigned long scan_start; 876 890 unsigned long scan_start_tsf; ··· 897 907 u32 ucode_ver; /* version of ucode, copy of 898 908 iwl_ucode.ver */ 899 909 900 - struct fw_img ucode_rt; 901 - struct fw_img ucode_init; 902 - struct fw_img ucode_wowlan; 903 - 904 - enum iwlagn_ucode_type ucode_type; 905 - u8 ucode_write_complete; /* the image write is complete */ 910 + enum iwl_ucode_type ucode_type; 906 911 char firmware_name[25]; 907 912 908 913 struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; ··· 944 959 945 960 /* eeprom -- this is in the card's little endian byte order */ 946 961 u8 *eeprom; 947 - int nvm_device_type; 948 962 struct iwl_eeprom_calib_info *calib_info; 949 963 950 964 enum nl80211_iftype iw_mode;
+71 -71
drivers/net/wireless/iwlwifi/iwl-eeprom.c
··· 149 149 * EEPROM chip, not a single event, so even reads could conflict if they 150 150 * weren't arbitrated by the semaphore. 151 151 */ 152 - static int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv) 152 + static int iwl_eeprom_acquire_semaphore(struct iwl_bus *bus) 153 153 { 154 154 u16 count; 155 155 int ret; 156 156 157 157 for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) { 158 158 /* Request semaphore */ 159 - iwl_set_bit(bus(priv), CSR_HW_IF_CONFIG_REG, 159 + iwl_set_bit(bus, CSR_HW_IF_CONFIG_REG, 160 160 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); 161 161 162 162 /* See if we got it */ 163 - ret = iwl_poll_bit(bus(priv), CSR_HW_IF_CONFIG_REG, 163 + ret = iwl_poll_bit(bus, CSR_HW_IF_CONFIG_REG, 164 164 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, 165 165 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, 166 166 EEPROM_SEM_TIMEOUT); 167 167 if (ret >= 0) { 168 - IWL_DEBUG_EEPROM(priv, 168 + IWL_DEBUG_EEPROM(bus, 169 169 "Acquired semaphore after %d tries.\n", 170 170 count+1); 171 171 return ret; ··· 175 175 return ret; 176 176 } 177 177 178 - static void iwl_eeprom_release_semaphore(struct iwl_priv *priv) 178 + static void iwl_eeprom_release_semaphore(struct iwl_bus *bus) 179 179 { 180 - iwl_clear_bit(bus(priv), CSR_HW_IF_CONFIG_REG, 180 + iwl_clear_bit(bus, CSR_HW_IF_CONFIG_REG, 181 181 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); 182 182 183 183 } 184 184 185 - static int iwl_eeprom_verify_signature(struct iwl_priv *priv) 185 + static int iwl_eeprom_verify_signature(struct iwl_trans *trans) 186 186 { 187 - u32 gp = iwl_read32(bus(priv), CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK; 187 + u32 gp = iwl_read32(bus(trans), CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK; 188 188 int ret = 0; 189 189 190 - IWL_DEBUG_EEPROM(priv, "EEPROM signature=0x%08x\n", gp); 190 + IWL_DEBUG_EEPROM(trans, "EEPROM signature=0x%08x\n", gp); 191 191 switch (gp) { 192 192 case CSR_EEPROM_GP_BAD_SIG_EEP_GOOD_SIG_OTP: 193 - if (priv->nvm_device_type != NVM_DEVICE_TYPE_OTP) { 194 - IWL_ERR(priv, "EEPROM with bad signature: 0x%08x\n", 193 + if (trans->nvm_device_type != NVM_DEVICE_TYPE_OTP) { 194 + IWL_ERR(trans, "EEPROM with bad signature: 0x%08x\n", 195 195 gp); 196 196 ret = -ENOENT; 197 197 } 198 198 break; 199 199 case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K: 200 200 case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K: 201 - if (priv->nvm_device_type != NVM_DEVICE_TYPE_EEPROM) { 202 - IWL_ERR(priv, "OTP with bad signature: 0x%08x\n", gp); 201 + if (trans->nvm_device_type != NVM_DEVICE_TYPE_EEPROM) { 202 + IWL_ERR(trans, "OTP with bad signature: 0x%08x\n", gp); 203 203 ret = -ENOENT; 204 204 } 205 205 break; 206 206 case CSR_EEPROM_GP_BAD_SIGNATURE_BOTH_EEP_AND_OTP: 207 207 default: 208 - IWL_ERR(priv, "bad EEPROM/OTP signature, type=%s, " 208 + IWL_ERR(trans, "bad EEPROM/OTP signature, type=%s, " 209 209 "EEPROM_GP=0x%08x\n", 210 - (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) 210 + (trans->nvm_device_type == NVM_DEVICE_TYPE_OTP) 211 211 ? "OTP" : "EEPROM", gp); 212 212 ret = -ENOENT; 213 213 break; ··· 302 302 * 303 303 ******************************************************************************/ 304 304 305 - static void iwl_set_otp_access(struct iwl_priv *priv, enum iwl_access_mode mode) 305 + static void iwl_set_otp_access(struct iwl_bus *bus, enum iwl_access_mode mode) 306 306 { 307 - iwl_read32(bus(priv), CSR_OTP_GP_REG); 307 + iwl_read32(bus, CSR_OTP_GP_REG); 308 308 309 309 if (mode == IWL_OTP_ACCESS_ABSOLUTE) 310 - iwl_clear_bit(bus(priv), CSR_OTP_GP_REG, 310 + iwl_clear_bit(bus, CSR_OTP_GP_REG, 311 311 CSR_OTP_GP_REG_OTP_ACCESS_MODE); 312 312 else 313 - iwl_set_bit(bus(priv), CSR_OTP_GP_REG, 313 + iwl_set_bit(bus, CSR_OTP_GP_REG, 314 314 CSR_OTP_GP_REG_OTP_ACCESS_MODE); 315 315 } 316 316 317 - static int iwl_get_nvm_type(struct iwl_priv *priv, u32 hw_rev) 317 + static int iwl_get_nvm_type(struct iwl_bus *bus, u32 hw_rev) 318 318 { 319 319 u32 otpgp; 320 320 int nvm_type; ··· 322 322 /* OTP only valid for CP/PP and after */ 323 323 switch (hw_rev & CSR_HW_REV_TYPE_MSK) { 324 324 case CSR_HW_REV_TYPE_NONE: 325 - IWL_ERR(priv, "Unknown hardware type\n"); 325 + IWL_ERR(bus, "Unknown hardware type\n"); 326 326 return -ENOENT; 327 327 case CSR_HW_REV_TYPE_5300: 328 328 case CSR_HW_REV_TYPE_5350: ··· 331 331 nvm_type = NVM_DEVICE_TYPE_EEPROM; 332 332 break; 333 333 default: 334 - otpgp = iwl_read32(bus(priv), CSR_OTP_GP_REG); 334 + otpgp = iwl_read32(bus, CSR_OTP_GP_REG); 335 335 if (otpgp & CSR_OTP_GP_REG_DEVICE_SELECT) 336 336 nvm_type = NVM_DEVICE_TYPE_OTP; 337 337 else ··· 341 341 return nvm_type; 342 342 } 343 343 344 - static int iwl_init_otp_access(struct iwl_priv *priv) 344 + static int iwl_init_otp_access(struct iwl_bus *bus) 345 345 { 346 346 int ret; 347 347 348 348 /* Enable 40MHz radio clock */ 349 - iwl_write32(bus(priv), CSR_GP_CNTRL, 350 - iwl_read32(bus(priv), CSR_GP_CNTRL) | 349 + iwl_write32(bus, CSR_GP_CNTRL, 350 + iwl_read32(bus, CSR_GP_CNTRL) | 351 351 CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 352 352 353 353 /* wait for clock to be ready */ 354 - ret = iwl_poll_bit(bus(priv), CSR_GP_CNTRL, 354 + ret = iwl_poll_bit(bus, CSR_GP_CNTRL, 355 355 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 356 356 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 357 357 25000); 358 358 if (ret < 0) 359 - IWL_ERR(priv, "Time out access OTP\n"); 359 + IWL_ERR(bus, "Time out access OTP\n"); 360 360 else { 361 - iwl_set_bits_prph(bus(priv), APMG_PS_CTRL_REG, 361 + iwl_set_bits_prph(bus, APMG_PS_CTRL_REG, 362 362 APMG_PS_CTRL_VAL_RESET_REQ); 363 363 udelay(5); 364 - iwl_clear_bits_prph(bus(priv), APMG_PS_CTRL_REG, 364 + iwl_clear_bits_prph(bus, APMG_PS_CTRL_REG, 365 365 APMG_PS_CTRL_VAL_RESET_REQ); 366 366 367 367 /* 368 368 * CSR auto clock gate disable bit - 369 369 * this is only applicable for HW with OTP shadow RAM 370 370 */ 371 - if (priv->cfg->base_params->shadow_ram_support) 372 - iwl_set_bit(bus(priv), CSR_DBG_LINK_PWR_MGMT_REG, 371 + if (priv(bus)->cfg->base_params->shadow_ram_support) 372 + iwl_set_bit(bus, CSR_DBG_LINK_PWR_MGMT_REG, 373 373 CSR_RESET_LINK_PWR_MGMT_DISABLED); 374 374 } 375 375 return ret; 376 376 } 377 377 378 - static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, __le16 *eeprom_data) 378 + static int iwl_read_otp_word(struct iwl_bus *bus, u16 addr, __le16 *eeprom_data) 379 379 { 380 380 int ret = 0; 381 381 u32 r; 382 382 u32 otpgp; 383 383 384 - iwl_write32(bus(priv), CSR_EEPROM_REG, 384 + iwl_write32(bus, CSR_EEPROM_REG, 385 385 CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); 386 - ret = iwl_poll_bit(bus(priv), CSR_EEPROM_REG, 386 + ret = iwl_poll_bit(bus, CSR_EEPROM_REG, 387 387 CSR_EEPROM_REG_READ_VALID_MSK, 388 388 CSR_EEPROM_REG_READ_VALID_MSK, 389 389 IWL_EEPROM_ACCESS_TIMEOUT); 390 390 if (ret < 0) { 391 - IWL_ERR(priv, "Time out reading OTP[%d]\n", addr); 391 + IWL_ERR(bus, "Time out reading OTP[%d]\n", addr); 392 392 return ret; 393 393 } 394 - r = iwl_read32(bus(priv), CSR_EEPROM_REG); 394 + r = iwl_read32(bus, CSR_EEPROM_REG); 395 395 /* check for ECC errors: */ 396 - otpgp = iwl_read32(bus(priv), CSR_OTP_GP_REG); 396 + otpgp = iwl_read32(bus, CSR_OTP_GP_REG); 397 397 if (otpgp & CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK) { 398 398 /* stop in this case */ 399 399 /* set the uncorrectable OTP ECC bit for acknowledgement */ 400 - iwl_set_bit(bus(priv), CSR_OTP_GP_REG, 400 + iwl_set_bit(bus, CSR_OTP_GP_REG, 401 401 CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK); 402 - IWL_ERR(priv, "Uncorrectable OTP ECC error, abort OTP read\n"); 402 + IWL_ERR(bus, "Uncorrectable OTP ECC error, abort OTP read\n"); 403 403 return -EINVAL; 404 404 } 405 405 if (otpgp & CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK) { 406 406 /* continue in this case */ 407 407 /* set the correctable OTP ECC bit for acknowledgement */ 408 - iwl_set_bit(bus(priv), CSR_OTP_GP_REG, 408 + iwl_set_bit(bus, CSR_OTP_GP_REG, 409 409 CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK); 410 - IWL_ERR(priv, "Correctable OTP ECC error, continue read\n"); 410 + IWL_ERR(bus, "Correctable OTP ECC error, continue read\n"); 411 411 } 412 412 *eeprom_data = cpu_to_le16(r >> 16); 413 413 return 0; ··· 416 416 /* 417 417 * iwl_is_otp_empty: check for empty OTP 418 418 */ 419 - static bool iwl_is_otp_empty(struct iwl_priv *priv) 419 + static bool iwl_is_otp_empty(struct iwl_bus *bus) 420 420 { 421 421 u16 next_link_addr = 0; 422 422 __le16 link_value; 423 423 bool is_empty = false; 424 424 425 425 /* locate the beginning of OTP link list */ 426 - if (!iwl_read_otp_word(priv, next_link_addr, &link_value)) { 426 + if (!iwl_read_otp_word(bus, next_link_addr, &link_value)) { 427 427 if (!link_value) { 428 - IWL_ERR(priv, "OTP is empty\n"); 428 + IWL_ERR(bus, "OTP is empty\n"); 429 429 is_empty = true; 430 430 } 431 431 } else { 432 - IWL_ERR(priv, "Unable to read first block of OTP list.\n"); 432 + IWL_ERR(bus, "Unable to read first block of OTP list.\n"); 433 433 is_empty = true; 434 434 } 435 435 ··· 446 446 * we should read and used to configure the device. 447 447 * only perform this operation if shadow RAM is disabled 448 448 */ 449 - static int iwl_find_otp_image(struct iwl_priv *priv, 449 + static int iwl_find_otp_image(struct iwl_bus *bus, 450 450 u16 *validblockaddr) 451 451 { 452 452 u16 next_link_addr = 0, valid_addr; ··· 454 454 int usedblocks = 0; 455 455 456 456 /* set addressing mode to absolute to traverse the link list */ 457 - iwl_set_otp_access(priv, IWL_OTP_ACCESS_ABSOLUTE); 457 + iwl_set_otp_access(bus, IWL_OTP_ACCESS_ABSOLUTE); 458 458 459 459 /* checking for empty OTP or error */ 460 - if (iwl_is_otp_empty(priv)) 460 + if (iwl_is_otp_empty(bus)) 461 461 return -EINVAL; 462 462 463 463 /* ··· 471 471 */ 472 472 valid_addr = next_link_addr; 473 473 next_link_addr = le16_to_cpu(link_value) * sizeof(u16); 474 - IWL_DEBUG_EEPROM(priv, "OTP blocks %d addr 0x%x\n", 474 + IWL_DEBUG_EEPROM(bus, "OTP blocks %d addr 0x%x\n", 475 475 usedblocks, next_link_addr); 476 - if (iwl_read_otp_word(priv, next_link_addr, &link_value)) 476 + if (iwl_read_otp_word(bus, next_link_addr, &link_value)) 477 477 return -EINVAL; 478 478 if (!link_value) { 479 479 /* ··· 488 488 } 489 489 /* more in the link list, continue */ 490 490 usedblocks++; 491 - } while (usedblocks <= priv->cfg->base_params->max_ll_items); 491 + } while (usedblocks <= priv(bus)->cfg->base_params->max_ll_items); 492 492 493 493 /* OTP has no valid blocks */ 494 - IWL_DEBUG_EEPROM(priv, "OTP has no valid blocks\n"); 494 + IWL_DEBUG_EEPROM(bus, "OTP has no valid blocks\n"); 495 495 return -EINVAL; 496 496 } 497 497 ··· 504 504 * iwl_get_max_txpower_avg - get the highest tx power from all chains. 505 505 * find the highest tx power from all chains for the channel 506 506 */ 507 - static s8 iwl_get_max_txpower_avg(struct iwl_priv *priv, 507 + static s8 iwl_get_max_txpower_avg(struct iwl_cfg *cfg, 508 508 struct iwl_eeprom_enhanced_txpwr *enhanced_txpower, 509 509 int element, s8 *max_txpower_in_half_dbm) 510 510 { 511 511 s8 max_txpower_avg = 0; /* (dBm) */ 512 512 513 513 /* Take the highest tx power from any valid chains */ 514 - if ((priv->cfg->valid_tx_ant & ANT_A) && 514 + if ((cfg->valid_tx_ant & ANT_A) && 515 515 (enhanced_txpower[element].chain_a_max > max_txpower_avg)) 516 516 max_txpower_avg = enhanced_txpower[element].chain_a_max; 517 - if ((priv->cfg->valid_tx_ant & ANT_B) && 517 + if ((cfg->valid_tx_ant & ANT_B) && 518 518 (enhanced_txpower[element].chain_b_max > max_txpower_avg)) 519 519 max_txpower_avg = enhanced_txpower[element].chain_b_max; 520 - if ((priv->cfg->valid_tx_ant & ANT_C) && 520 + if ((cfg->valid_tx_ant & ANT_C) && 521 521 (enhanced_txpower[element].chain_c_max > max_txpower_avg)) 522 522 max_txpower_avg = enhanced_txpower[element].chain_c_max; 523 - if (((priv->cfg->valid_tx_ant == ANT_AB) | 524 - (priv->cfg->valid_tx_ant == ANT_BC) | 525 - (priv->cfg->valid_tx_ant == ANT_AC)) && 523 + if (((cfg->valid_tx_ant == ANT_AB) | 524 + (cfg->valid_tx_ant == ANT_BC) | 525 + (cfg->valid_tx_ant == ANT_AC)) && 526 526 (enhanced_txpower[element].mimo2_max > max_txpower_avg)) 527 527 max_txpower_avg = enhanced_txpower[element].mimo2_max; 528 - if ((priv->cfg->valid_tx_ant == ANT_ABC) && 528 + if ((cfg->valid_tx_ant == ANT_ABC) && 529 529 (enhanced_txpower[element].mimo3_max > max_txpower_avg)) 530 530 max_txpower_avg = enhanced_txpower[element].mimo3_max; 531 531 ··· 627 627 ((txp->delta_20_in_40 & 0xf0) >> 4), 628 628 (txp->delta_20_in_40 & 0x0f)); 629 629 630 - max_txp_avg = iwl_get_max_txpower_avg(priv, txp_array, idx, 630 + max_txp_avg = iwl_get_max_txpower_avg(priv->cfg, txp_array, idx, 631 631 &max_txp_avg_halfdbm); 632 632 633 633 /* ··· 660 660 u16 validblockaddr = 0; 661 661 u16 cache_addr = 0; 662 662 663 - priv->nvm_device_type = iwl_get_nvm_type(priv, hw_rev); 664 - if (priv->nvm_device_type == -ENOENT) 663 + trans(priv)->nvm_device_type = iwl_get_nvm_type(bus(priv), hw_rev); 664 + if (trans(priv)->nvm_device_type == -ENOENT) 665 665 return -ENOENT; 666 666 /* allocate eeprom */ 667 667 sz = priv->cfg->base_params->eeprom_size; ··· 675 675 676 676 iwl_apm_init(priv); 677 677 678 - ret = iwl_eeprom_verify_signature(priv); 678 + ret = iwl_eeprom_verify_signature(trans(priv)); 679 679 if (ret < 0) { 680 680 IWL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp); 681 681 ret = -ENOENT; ··· 683 683 } 684 684 685 685 /* Make sure driver (instead of uCode) is allowed to read EEPROM */ 686 - ret = iwl_eeprom_acquire_semaphore(priv); 686 + ret = iwl_eeprom_acquire_semaphore(bus(priv)); 687 687 if (ret < 0) { 688 688 IWL_ERR(priv, "Failed to acquire EEPROM semaphore.\n"); 689 689 ret = -ENOENT; 690 690 goto err; 691 691 } 692 692 693 - if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) { 693 + if (trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP) { 694 694 695 - ret = iwl_init_otp_access(priv); 695 + ret = iwl_init_otp_access(bus(priv)); 696 696 if (ret) { 697 697 IWL_ERR(priv, "Failed to initialize OTP access.\n"); 698 698 ret = -ENOENT; ··· 707 707 CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK); 708 708 /* traversing the linked list if no shadow ram supported */ 709 709 if (!priv->cfg->base_params->shadow_ram_support) { 710 - if (iwl_find_otp_image(priv, &validblockaddr)) { 710 + if (iwl_find_otp_image(bus(priv), &validblockaddr)) { 711 711 ret = -ENOENT; 712 712 goto done; 713 713 } ··· 716 716 addr += sizeof(u16)) { 717 717 __le16 eeprom_data; 718 718 719 - ret = iwl_read_otp_word(priv, addr, &eeprom_data); 719 + ret = iwl_read_otp_word(bus(priv), addr, &eeprom_data); 720 720 if (ret) 721 721 goto done; 722 722 e[cache_addr / 2] = eeprom_data; ··· 744 744 } 745 745 746 746 IWL_DEBUG_EEPROM(priv, "NVM Type: %s, version: 0x%x\n", 747 - (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) 747 + (trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP) 748 748 ? "OTP" : "EEPROM", 749 749 iwl_eeprom_query16(priv, EEPROM_VERSION)); 750 750 751 751 ret = 0; 752 752 done: 753 - iwl_eeprom_release_semaphore(priv); 753 + iwl_eeprom_release_semaphore(bus(priv)); 754 754 755 755 err: 756 756 if (ret)
+1632
drivers/net/wireless/iwlwifi/iwl-mac80211.c
··· 1 + /****************************************************************************** 2 + * 3 + * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 4 + * 5 + * Portions of this file are derived from the ipw3945 project, as well 6 + * as portions of the ieee80211 subsystem header files. 7 + * 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of version 2 of the GNU General Public License as 10 + * published by the Free Software Foundation. 11 + * 12 + * This program is distributed in the hope that it will be useful, but WITHOUT 13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 + * more details. 16 + * 17 + * You should have received a copy of the GNU General Public License along with 18 + * this program; if not, write to the Free Software Foundation, Inc., 19 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 20 + * 21 + * The full GNU General Public License is included in this distribution in the 22 + * file called LICENSE. 23 + * 24 + * Contact Information: 25 + * Intel Linux Wireless <ilw@linux.intel.com> 26 + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 27 + * 28 + *****************************************************************************/ 29 + #include <linux/kernel.h> 30 + #include <linux/module.h> 31 + #include <linux/init.h> 32 + #include <linux/slab.h> 33 + #include <linux/dma-mapping.h> 34 + #include <linux/delay.h> 35 + #include <linux/sched.h> 36 + #include <linux/skbuff.h> 37 + #include <linux/netdevice.h> 38 + #include <linux/firmware.h> 39 + #include <linux/etherdevice.h> 40 + #include <linux/if_arp.h> 41 + 42 + #include <net/mac80211.h> 43 + 44 + #include <asm/div64.h> 45 + 46 + #include "iwl-eeprom.h" 47 + #include "iwl-dev.h" 48 + #include "iwl-core.h" 49 + #include "iwl-io.h" 50 + #include "iwl-agn-calib.h" 51 + #include "iwl-agn.h" 52 + #include "iwl-shared.h" 53 + #include "iwl-bus.h" 54 + #include "iwl-trans.h" 55 + 56 + /***************************************************************************** 57 + * 58 + * mac80211 entry point functions 59 + * 60 + *****************************************************************************/ 61 + 62 + static const struct ieee80211_iface_limit iwlagn_sta_ap_limits[] = { 63 + { 64 + .max = 1, 65 + .types = BIT(NL80211_IFTYPE_STATION), 66 + }, 67 + { 68 + .max = 1, 69 + .types = BIT(NL80211_IFTYPE_AP), 70 + }, 71 + }; 72 + 73 + static const struct ieee80211_iface_limit iwlagn_2sta_limits[] = { 74 + { 75 + .max = 2, 76 + .types = BIT(NL80211_IFTYPE_STATION), 77 + }, 78 + }; 79 + 80 + static const struct ieee80211_iface_limit iwlagn_p2p_sta_go_limits[] = { 81 + { 82 + .max = 1, 83 + .types = BIT(NL80211_IFTYPE_STATION), 84 + }, 85 + { 86 + .max = 1, 87 + .types = BIT(NL80211_IFTYPE_P2P_GO) | 88 + BIT(NL80211_IFTYPE_AP), 89 + }, 90 + }; 91 + 92 + static const struct ieee80211_iface_limit iwlagn_p2p_2sta_limits[] = { 93 + { 94 + .max = 2, 95 + .types = BIT(NL80211_IFTYPE_STATION), 96 + }, 97 + { 98 + .max = 1, 99 + .types = BIT(NL80211_IFTYPE_P2P_CLIENT), 100 + }, 101 + }; 102 + 103 + static const struct ieee80211_iface_combination 104 + iwlagn_iface_combinations_dualmode[] = { 105 + { .num_different_channels = 1, 106 + .max_interfaces = 2, 107 + .beacon_int_infra_match = true, 108 + .limits = iwlagn_sta_ap_limits, 109 + .n_limits = ARRAY_SIZE(iwlagn_sta_ap_limits), 110 + }, 111 + { .num_different_channels = 1, 112 + .max_interfaces = 2, 113 + .limits = iwlagn_2sta_limits, 114 + .n_limits = ARRAY_SIZE(iwlagn_2sta_limits), 115 + }, 116 + }; 117 + 118 + static const struct ieee80211_iface_combination 119 + iwlagn_iface_combinations_p2p[] = { 120 + { .num_different_channels = 1, 121 + .max_interfaces = 2, 122 + .beacon_int_infra_match = true, 123 + .limits = iwlagn_p2p_sta_go_limits, 124 + .n_limits = ARRAY_SIZE(iwlagn_p2p_sta_go_limits), 125 + }, 126 + { .num_different_channels = 1, 127 + .max_interfaces = 2, 128 + .limits = iwlagn_p2p_2sta_limits, 129 + .n_limits = ARRAY_SIZE(iwlagn_p2p_2sta_limits), 130 + }, 131 + }; 132 + 133 + /* 134 + * Not a mac80211 entry point function, but it fits in with all the 135 + * other mac80211 functions grouped here. 136 + */ 137 + int iwlagn_mac_setup_register(struct iwl_priv *priv, 138 + struct iwlagn_ucode_capabilities *capa) 139 + { 140 + int ret; 141 + struct ieee80211_hw *hw = priv->hw; 142 + struct iwl_rxon_context *ctx; 143 + 144 + hw->rate_control_algorithm = "iwl-agn-rs"; 145 + 146 + /* Tell mac80211 our characteristics */ 147 + hw->flags = IEEE80211_HW_SIGNAL_DBM | 148 + IEEE80211_HW_AMPDU_AGGREGATION | 149 + IEEE80211_HW_NEED_DTIM_PERIOD | 150 + IEEE80211_HW_SPECTRUM_MGMT | 151 + IEEE80211_HW_REPORTS_TX_ACK_STATUS; 152 + 153 + /* 154 + * Including the following line will crash some AP's. This 155 + * workaround removes the stimulus which causes the crash until 156 + * the AP software can be fixed. 157 + hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF; 158 + */ 159 + 160 + hw->flags |= IEEE80211_HW_SUPPORTS_PS | 161 + IEEE80211_HW_SUPPORTS_DYNAMIC_PS; 162 + 163 + if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE) 164 + hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | 165 + IEEE80211_HW_SUPPORTS_STATIC_SMPS; 166 + 167 + if (capa->flags & IWL_UCODE_TLV_FLAGS_MFP) 168 + hw->flags |= IEEE80211_HW_MFP_CAPABLE; 169 + 170 + hw->sta_data_size = sizeof(struct iwl_station_priv); 171 + hw->vif_data_size = sizeof(struct iwl_vif_priv); 172 + 173 + for_each_context(priv, ctx) { 174 + hw->wiphy->interface_modes |= ctx->interface_modes; 175 + hw->wiphy->interface_modes |= ctx->exclusive_interface_modes; 176 + } 177 + 178 + BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); 179 + 180 + if (hw->wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) { 181 + hw->wiphy->iface_combinations = iwlagn_iface_combinations_p2p; 182 + hw->wiphy->n_iface_combinations = 183 + ARRAY_SIZE(iwlagn_iface_combinations_p2p); 184 + } else if (hw->wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) { 185 + hw->wiphy->iface_combinations = 186 + iwlagn_iface_combinations_dualmode; 187 + hw->wiphy->n_iface_combinations = 188 + ARRAY_SIZE(iwlagn_iface_combinations_dualmode); 189 + } 190 + 191 + hw->wiphy->max_remain_on_channel_duration = 1000; 192 + 193 + hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | 194 + WIPHY_FLAG_DISABLE_BEACON_HINTS | 195 + WIPHY_FLAG_IBSS_RSN; 196 + 197 + if (trans(priv)->ucode_wowlan.code.len && 198 + device_can_wakeup(bus(priv)->dev)) { 199 + hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | 200 + WIPHY_WOWLAN_DISCONNECT | 201 + WIPHY_WOWLAN_EAP_IDENTITY_REQ | 202 + WIPHY_WOWLAN_RFKILL_RELEASE; 203 + if (!iwlagn_mod_params.sw_crypto) 204 + hw->wiphy->wowlan.flags |= 205 + WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | 206 + WIPHY_WOWLAN_GTK_REKEY_FAILURE; 207 + 208 + hw->wiphy->wowlan.n_patterns = IWLAGN_WOWLAN_MAX_PATTERNS; 209 + hw->wiphy->wowlan.pattern_min_len = 210 + IWLAGN_WOWLAN_MIN_PATTERN_LEN; 211 + hw->wiphy->wowlan.pattern_max_len = 212 + IWLAGN_WOWLAN_MAX_PATTERN_LEN; 213 + } 214 + 215 + if (iwlagn_mod_params.power_save) 216 + hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; 217 + else 218 + hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; 219 + 220 + hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; 221 + /* we create the 802.11 header and a zero-length SSID element */ 222 + hw->wiphy->max_scan_ie_len = capa->max_probe_length - 24 - 2; 223 + 224 + /* Default value; 4 EDCA QOS priorities */ 225 + hw->queues = 4; 226 + 227 + hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; 228 + 229 + if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) 230 + priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = 231 + &priv->bands[IEEE80211_BAND_2GHZ]; 232 + if (priv->bands[IEEE80211_BAND_5GHZ].n_channels) 233 + priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = 234 + &priv->bands[IEEE80211_BAND_5GHZ]; 235 + 236 + iwl_leds_init(priv); 237 + 238 + ret = ieee80211_register_hw(priv->hw); 239 + if (ret) { 240 + IWL_ERR(priv, "Failed to register hw (error %d)\n", ret); 241 + return ret; 242 + } 243 + priv->mac80211_registered = 1; 244 + 245 + return 0; 246 + } 247 + 248 + static int __iwl_up(struct iwl_priv *priv) 249 + { 250 + struct iwl_rxon_context *ctx; 251 + int ret; 252 + 253 + lockdep_assert_held(&priv->shrd->mutex); 254 + 255 + if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) { 256 + IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); 257 + return -EIO; 258 + } 259 + 260 + for_each_context(priv, ctx) { 261 + ret = iwlagn_alloc_bcast_station(priv, ctx); 262 + if (ret) { 263 + iwl_dealloc_bcast_stations(priv); 264 + return ret; 265 + } 266 + } 267 + 268 + ret = iwlagn_run_init_ucode(priv); 269 + if (ret) { 270 + IWL_ERR(priv, "Failed to run INIT ucode: %d\n", ret); 271 + goto error; 272 + } 273 + 274 + ret = iwlagn_load_ucode_wait_alive(priv, IWL_UCODE_REGULAR); 275 + if (ret) { 276 + IWL_ERR(priv, "Failed to start RT ucode: %d\n", ret); 277 + goto error; 278 + } 279 + 280 + ret = iwl_alive_start(priv); 281 + if (ret) 282 + goto error; 283 + return 0; 284 + 285 + error: 286 + set_bit(STATUS_EXIT_PENDING, &priv->shrd->status); 287 + __iwl_down(priv); 288 + clear_bit(STATUS_EXIT_PENDING, &priv->shrd->status); 289 + 290 + IWL_ERR(priv, "Unable to initialize device.\n"); 291 + return ret; 292 + } 293 + 294 + static int iwlagn_mac_start(struct ieee80211_hw *hw) 295 + { 296 + struct iwl_priv *priv = hw->priv; 297 + int ret; 298 + 299 + IWL_DEBUG_MAC80211(priv, "enter\n"); 300 + 301 + /* we should be verifying the device is ready to be opened */ 302 + mutex_lock(&priv->shrd->mutex); 303 + ret = __iwl_up(priv); 304 + mutex_unlock(&priv->shrd->mutex); 305 + if (ret) 306 + return ret; 307 + 308 + IWL_DEBUG_INFO(priv, "Start UP work done.\n"); 309 + 310 + /* Now we should be done, and the READY bit should be set. */ 311 + if (WARN_ON(!test_bit(STATUS_READY, &priv->shrd->status))) 312 + ret = -EIO; 313 + 314 + iwlagn_led_enable(priv); 315 + 316 + priv->is_open = 1; 317 + IWL_DEBUG_MAC80211(priv, "leave\n"); 318 + return 0; 319 + } 320 + 321 + static void iwlagn_mac_stop(struct ieee80211_hw *hw) 322 + { 323 + struct iwl_priv *priv = hw->priv; 324 + 325 + IWL_DEBUG_MAC80211(priv, "enter\n"); 326 + 327 + if (!priv->is_open) 328 + return; 329 + 330 + priv->is_open = 0; 331 + 332 + iwl_down(priv); 333 + 334 + flush_workqueue(priv->shrd->workqueue); 335 + 336 + /* User space software may expect getting rfkill changes 337 + * even if interface is down */ 338 + iwl_write32(bus(priv), CSR_INT, 0xFFFFFFFF); 339 + iwl_enable_rfkill_int(priv); 340 + 341 + IWL_DEBUG_MAC80211(priv, "leave\n"); 342 + } 343 + 344 + static void iwlagn_mac_set_rekey_data(struct ieee80211_hw *hw, 345 + struct ieee80211_vif *vif, 346 + struct cfg80211_gtk_rekey_data *data) 347 + { 348 + struct iwl_priv *priv = hw->priv; 349 + 350 + if (iwlagn_mod_params.sw_crypto) 351 + return; 352 + 353 + IWL_DEBUG_MAC80211(priv, "enter\n"); 354 + mutex_lock(&priv->shrd->mutex); 355 + 356 + if (priv->contexts[IWL_RXON_CTX_BSS].vif != vif) 357 + goto out; 358 + 359 + memcpy(priv->kek, data->kek, NL80211_KEK_LEN); 360 + memcpy(priv->kck, data->kck, NL80211_KCK_LEN); 361 + priv->replay_ctr = 362 + cpu_to_le64(be64_to_cpup((__be64 *)&data->replay_ctr)); 363 + priv->have_rekey_data = true; 364 + 365 + out: 366 + mutex_unlock(&priv->shrd->mutex); 367 + IWL_DEBUG_MAC80211(priv, "leave\n"); 368 + } 369 + 370 + #ifdef CONFIG_PM_SLEEP 371 + 372 + static int iwlagn_mac_suspend(struct ieee80211_hw *hw, 373 + struct cfg80211_wowlan *wowlan) 374 + { 375 + struct iwl_priv *priv = hw->priv; 376 + struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 377 + int ret; 378 + 379 + if (WARN_ON(!wowlan)) 380 + return -EINVAL; 381 + 382 + IWL_DEBUG_MAC80211(priv, "enter\n"); 383 + mutex_lock(&priv->shrd->mutex); 384 + 385 + /* Don't attempt WoWLAN when not associated, tear down instead. */ 386 + if (!ctx->vif || ctx->vif->type != NL80211_IFTYPE_STATION || 387 + !iwl_is_associated_ctx(ctx)) { 388 + ret = 1; 389 + goto out; 390 + } 391 + 392 + ret = iwlagn_suspend(priv, hw, wowlan); 393 + if (ret) 394 + goto error; 395 + 396 + device_set_wakeup_enable(bus(priv)->dev, true); 397 + 398 + /* Now let the ucode operate on its own */ 399 + iwl_write32(bus(priv), CSR_UCODE_DRV_GP1_SET, 400 + CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE); 401 + 402 + goto out; 403 + 404 + error: 405 + priv->shrd->wowlan = false; 406 + iwlagn_prepare_restart(priv); 407 + ieee80211_restart_hw(priv->hw); 408 + out: 409 + mutex_unlock(&priv->shrd->mutex); 410 + IWL_DEBUG_MAC80211(priv, "leave\n"); 411 + 412 + return ret; 413 + } 414 + 415 + static int iwlagn_mac_resume(struct ieee80211_hw *hw) 416 + { 417 + struct iwl_priv *priv = hw->priv; 418 + struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 419 + struct ieee80211_vif *vif; 420 + unsigned long flags; 421 + u32 base, status = 0xffffffff; 422 + int ret = -EIO; 423 + 424 + IWL_DEBUG_MAC80211(priv, "enter\n"); 425 + mutex_lock(&priv->shrd->mutex); 426 + 427 + iwl_write32(bus(priv), CSR_UCODE_DRV_GP1_CLR, 428 + CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE); 429 + 430 + base = priv->device_pointers.error_event_table; 431 + if (iwlagn_hw_valid_rtc_data_addr(base)) { 432 + spin_lock_irqsave(&bus(priv)->reg_lock, flags); 433 + ret = iwl_grab_nic_access_silent(bus(priv)); 434 + if (ret == 0) { 435 + iwl_write32(bus(priv), HBUS_TARG_MEM_RADDR, base); 436 + status = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT); 437 + iwl_release_nic_access(bus(priv)); 438 + } 439 + spin_unlock_irqrestore(&bus(priv)->reg_lock, flags); 440 + 441 + #ifdef CONFIG_IWLWIFI_DEBUGFS 442 + if (ret == 0) { 443 + struct iwl_trans *trans = trans(priv); 444 + if (!priv->wowlan_sram) 445 + priv->wowlan_sram = 446 + kzalloc(trans->ucode_wowlan.data.len, 447 + GFP_KERNEL); 448 + 449 + if (priv->wowlan_sram) 450 + _iwl_read_targ_mem_words( 451 + bus(priv), 0x800000, priv->wowlan_sram, 452 + trans->ucode_wowlan.data.len / 4); 453 + } 454 + #endif 455 + } 456 + 457 + /* we'll clear ctx->vif during iwlagn_prepare_restart() */ 458 + vif = ctx->vif; 459 + 460 + priv->shrd->wowlan = false; 461 + 462 + device_set_wakeup_enable(bus(priv)->dev, false); 463 + 464 + iwlagn_prepare_restart(priv); 465 + 466 + memset((void *)&ctx->active, 0, sizeof(ctx->active)); 467 + iwl_connection_init_rx_config(priv, ctx); 468 + iwlagn_set_rxon_chain(priv, ctx); 469 + 470 + mutex_unlock(&priv->shrd->mutex); 471 + IWL_DEBUG_MAC80211(priv, "leave\n"); 472 + 473 + ieee80211_resume_disconnect(vif); 474 + 475 + return 1; 476 + } 477 + 478 + #endif 479 + 480 + static void iwlagn_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 481 + { 482 + struct iwl_priv *priv = hw->priv; 483 + 484 + IWL_DEBUG_MACDUMP(priv, "enter\n"); 485 + 486 + IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 487 + ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); 488 + 489 + if (iwlagn_tx_skb(priv, skb)) 490 + dev_kfree_skb_any(skb); 491 + 492 + IWL_DEBUG_MACDUMP(priv, "leave\n"); 493 + } 494 + 495 + static void iwlagn_mac_update_tkip_key(struct ieee80211_hw *hw, 496 + struct ieee80211_vif *vif, 497 + struct ieee80211_key_conf *keyconf, 498 + struct ieee80211_sta *sta, 499 + u32 iv32, u16 *phase1key) 500 + { 501 + struct iwl_priv *priv = hw->priv; 502 + 503 + iwl_update_tkip_key(priv, vif, keyconf, sta, iv32, phase1key); 504 + } 505 + 506 + static int iwlagn_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 507 + struct ieee80211_vif *vif, 508 + struct ieee80211_sta *sta, 509 + struct ieee80211_key_conf *key) 510 + { 511 + struct iwl_priv *priv = hw->priv; 512 + struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 513 + struct iwl_rxon_context *ctx = vif_priv->ctx; 514 + int ret; 515 + bool is_default_wep_key = false; 516 + 517 + IWL_DEBUG_MAC80211(priv, "enter\n"); 518 + 519 + if (iwlagn_mod_params.sw_crypto) { 520 + IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); 521 + return -EOPNOTSUPP; 522 + } 523 + 524 + /* 525 + * We could program these keys into the hardware as well, but we 526 + * don't expect much multicast traffic in IBSS and having keys 527 + * for more stations is probably more useful. 528 + * 529 + * Mark key TX-only and return 0. 530 + */ 531 + if (vif->type == NL80211_IFTYPE_ADHOC && 532 + !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { 533 + key->hw_key_idx = WEP_INVALID_OFFSET; 534 + return 0; 535 + } 536 + 537 + /* If they key was TX-only, accept deletion */ 538 + if (cmd == DISABLE_KEY && key->hw_key_idx == WEP_INVALID_OFFSET) 539 + return 0; 540 + 541 + mutex_lock(&priv->shrd->mutex); 542 + iwl_scan_cancel_timeout(priv, 100); 543 + 544 + BUILD_BUG_ON(WEP_INVALID_OFFSET == IWLAGN_HW_KEY_DEFAULT); 545 + 546 + /* 547 + * If we are getting WEP group key and we didn't receive any key mapping 548 + * so far, we are in legacy wep mode (group key only), otherwise we are 549 + * in 1X mode. 550 + * In legacy wep mode, we use another host command to the uCode. 551 + */ 552 + if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 || 553 + key->cipher == WLAN_CIPHER_SUITE_WEP104) && !sta) { 554 + if (cmd == SET_KEY) 555 + is_default_wep_key = !ctx->key_mapping_keys; 556 + else 557 + is_default_wep_key = 558 + key->hw_key_idx == IWLAGN_HW_KEY_DEFAULT; 559 + } 560 + 561 + 562 + switch (cmd) { 563 + case SET_KEY: 564 + if (is_default_wep_key) { 565 + ret = iwl_set_default_wep_key(priv, vif_priv->ctx, key); 566 + break; 567 + } 568 + ret = iwl_set_dynamic_key(priv, vif_priv->ctx, key, sta); 569 + if (ret) { 570 + /* 571 + * can't add key for RX, but we don't need it 572 + * in the device for TX so still return 0 573 + */ 574 + ret = 0; 575 + key->hw_key_idx = WEP_INVALID_OFFSET; 576 + } 577 + 578 + IWL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); 579 + break; 580 + case DISABLE_KEY: 581 + if (is_default_wep_key) 582 + ret = iwl_remove_default_wep_key(priv, ctx, key); 583 + else 584 + ret = iwl_remove_dynamic_key(priv, ctx, key, sta); 585 + 586 + IWL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); 587 + break; 588 + default: 589 + ret = -EINVAL; 590 + } 591 + 592 + mutex_unlock(&priv->shrd->mutex); 593 + IWL_DEBUG_MAC80211(priv, "leave\n"); 594 + 595 + return ret; 596 + } 597 + 598 + static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw, 599 + struct ieee80211_vif *vif, 600 + enum ieee80211_ampdu_mlme_action action, 601 + struct ieee80211_sta *sta, u16 tid, u16 *ssn, 602 + u8 buf_size) 603 + { 604 + struct iwl_priv *priv = hw->priv; 605 + int ret = -EINVAL; 606 + struct iwl_station_priv *sta_priv = (void *) sta->drv_priv; 607 + struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 608 + 609 + IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", 610 + sta->addr, tid); 611 + 612 + if (!(priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE)) 613 + return -EACCES; 614 + 615 + IWL_DEBUG_MAC80211(priv, "enter\n"); 616 + mutex_lock(&priv->shrd->mutex); 617 + 618 + switch (action) { 619 + case IEEE80211_AMPDU_RX_START: 620 + IWL_DEBUG_HT(priv, "start Rx\n"); 621 + ret = iwl_sta_rx_agg_start(priv, sta, tid, *ssn); 622 + break; 623 + case IEEE80211_AMPDU_RX_STOP: 624 + IWL_DEBUG_HT(priv, "stop Rx\n"); 625 + ret = iwl_sta_rx_agg_stop(priv, sta, tid); 626 + if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 627 + ret = 0; 628 + break; 629 + case IEEE80211_AMPDU_TX_START: 630 + IWL_DEBUG_HT(priv, "start Tx\n"); 631 + ret = iwlagn_tx_agg_start(priv, vif, sta, tid, ssn); 632 + break; 633 + case IEEE80211_AMPDU_TX_STOP: 634 + IWL_DEBUG_HT(priv, "stop Tx\n"); 635 + ret = iwlagn_tx_agg_stop(priv, vif, sta, tid); 636 + if ((ret == 0) && (priv->agg_tids_count > 0)) { 637 + priv->agg_tids_count--; 638 + IWL_DEBUG_HT(priv, "priv->agg_tids_count = %u\n", 639 + priv->agg_tids_count); 640 + } 641 + if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 642 + ret = 0; 643 + if (!priv->agg_tids_count && priv->cfg->ht_params && 644 + priv->cfg->ht_params->use_rts_for_aggregation) { 645 + /* 646 + * switch off RTS/CTS if it was previously enabled 647 + */ 648 + sta_priv->lq_sta.lq.general_params.flags &= 649 + ~LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK; 650 + iwl_send_lq_cmd(priv, iwl_rxon_ctx_from_vif(vif), 651 + &sta_priv->lq_sta.lq, CMD_ASYNC, false); 652 + } 653 + break; 654 + case IEEE80211_AMPDU_TX_OPERATIONAL: 655 + buf_size = min_t(int, buf_size, LINK_QUAL_AGG_FRAME_LIMIT_DEF); 656 + 657 + iwl_trans_tx_agg_setup(trans(priv), ctx->ctxid, iwl_sta_id(sta), 658 + tid, buf_size); 659 + 660 + /* 661 + * If the limit is 0, then it wasn't initialised yet, 662 + * use the default. We can do that since we take the 663 + * minimum below, and we don't want to go above our 664 + * default due to hardware restrictions. 665 + */ 666 + if (sta_priv->max_agg_bufsize == 0) 667 + sta_priv->max_agg_bufsize = 668 + LINK_QUAL_AGG_FRAME_LIMIT_DEF; 669 + 670 + /* 671 + * Even though in theory the peer could have different 672 + * aggregation reorder buffer sizes for different sessions, 673 + * our ucode doesn't allow for that and has a global limit 674 + * for each station. Therefore, use the minimum of all the 675 + * aggregation sessions and our default value. 676 + */ 677 + sta_priv->max_agg_bufsize = 678 + min(sta_priv->max_agg_bufsize, buf_size); 679 + 680 + if (priv->cfg->ht_params && 681 + priv->cfg->ht_params->use_rts_for_aggregation) { 682 + /* 683 + * switch to RTS/CTS if it is the prefer protection 684 + * method for HT traffic 685 + */ 686 + 687 + sta_priv->lq_sta.lq.general_params.flags |= 688 + LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK; 689 + } 690 + priv->agg_tids_count++; 691 + IWL_DEBUG_HT(priv, "priv->agg_tids_count = %u\n", 692 + priv->agg_tids_count); 693 + 694 + sta_priv->lq_sta.lq.agg_params.agg_frame_cnt_limit = 695 + sta_priv->max_agg_bufsize; 696 + 697 + iwl_send_lq_cmd(priv, iwl_rxon_ctx_from_vif(vif), 698 + &sta_priv->lq_sta.lq, CMD_ASYNC, false); 699 + 700 + IWL_INFO(priv, "Tx aggregation enabled on ra = %pM tid = %d\n", 701 + sta->addr, tid); 702 + ret = 0; 703 + break; 704 + } 705 + mutex_unlock(&priv->shrd->mutex); 706 + IWL_DEBUG_MAC80211(priv, "leave\n"); 707 + return ret; 708 + } 709 + 710 + static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, 711 + struct ieee80211_vif *vif, 712 + struct ieee80211_sta *sta) 713 + { 714 + struct iwl_priv *priv = hw->priv; 715 + struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 716 + struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 717 + bool is_ap = vif->type == NL80211_IFTYPE_STATION; 718 + int ret = 0; 719 + u8 sta_id; 720 + 721 + IWL_DEBUG_MAC80211(priv, "received request to add station %pM\n", 722 + sta->addr); 723 + mutex_lock(&priv->shrd->mutex); 724 + IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n", 725 + sta->addr); 726 + sta_priv->sta_id = IWL_INVALID_STATION; 727 + 728 + atomic_set(&sta_priv->pending_frames, 0); 729 + if (vif->type == NL80211_IFTYPE_AP) 730 + sta_priv->client = true; 731 + 732 + ret = iwl_add_station_common(priv, vif_priv->ctx, sta->addr, 733 + is_ap, sta, &sta_id); 734 + if (ret) { 735 + IWL_ERR(priv, "Unable to add station %pM (%d)\n", 736 + sta->addr, ret); 737 + /* Should we return success if return code is EEXIST ? */ 738 + goto out; 739 + } 740 + 741 + sta_priv->sta_id = sta_id; 742 + 743 + /* Initialize rate scaling */ 744 + IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", 745 + sta->addr); 746 + iwl_rs_rate_init(priv, sta, sta_id); 747 + out: 748 + mutex_unlock(&priv->shrd->mutex); 749 + IWL_DEBUG_MAC80211(priv, "leave\n"); 750 + 751 + return ret; 752 + } 753 + 754 + static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, 755 + struct ieee80211_channel_switch *ch_switch) 756 + { 757 + struct iwl_priv *priv = hw->priv; 758 + const struct iwl_channel_info *ch_info; 759 + struct ieee80211_conf *conf = &hw->conf; 760 + struct ieee80211_channel *channel = ch_switch->channel; 761 + struct iwl_ht_config *ht_conf = &priv->current_ht_config; 762 + /* 763 + * MULTI-FIXME 764 + * When we add support for multiple interfaces, we need to 765 + * revisit this. The channel switch command in the device 766 + * only affects the BSS context, but what does that really 767 + * mean? And what if we get a CSA on the second interface? 768 + * This needs a lot of work. 769 + */ 770 + struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 771 + u16 ch; 772 + 773 + IWL_DEBUG_MAC80211(priv, "enter\n"); 774 + 775 + mutex_lock(&priv->shrd->mutex); 776 + 777 + if (iwl_is_rfkill(priv->shrd)) 778 + goto out; 779 + 780 + if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) || 781 + test_bit(STATUS_SCANNING, &priv->shrd->status) || 782 + test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status)) 783 + goto out; 784 + 785 + if (!iwl_is_associated_ctx(ctx)) 786 + goto out; 787 + 788 + if (!priv->cfg->lib->set_channel_switch) 789 + goto out; 790 + 791 + ch = channel->hw_value; 792 + if (le16_to_cpu(ctx->active.channel) == ch) 793 + goto out; 794 + 795 + ch_info = iwl_get_channel_info(priv, channel->band, ch); 796 + if (!is_channel_valid(ch_info)) { 797 + IWL_DEBUG_MAC80211(priv, "invalid channel\n"); 798 + goto out; 799 + } 800 + 801 + spin_lock_irq(&priv->shrd->lock); 802 + 803 + priv->current_ht_config.smps = conf->smps_mode; 804 + 805 + /* Configure HT40 channels */ 806 + ctx->ht.enabled = conf_is_ht(conf); 807 + if (ctx->ht.enabled) { 808 + if (conf_is_ht40_minus(conf)) { 809 + ctx->ht.extension_chan_offset = 810 + IEEE80211_HT_PARAM_CHA_SEC_BELOW; 811 + ctx->ht.is_40mhz = true; 812 + } else if (conf_is_ht40_plus(conf)) { 813 + ctx->ht.extension_chan_offset = 814 + IEEE80211_HT_PARAM_CHA_SEC_ABOVE; 815 + ctx->ht.is_40mhz = true; 816 + } else { 817 + ctx->ht.extension_chan_offset = 818 + IEEE80211_HT_PARAM_CHA_SEC_NONE; 819 + ctx->ht.is_40mhz = false; 820 + } 821 + } else 822 + ctx->ht.is_40mhz = false; 823 + 824 + if ((le16_to_cpu(ctx->staging.channel) != ch)) 825 + ctx->staging.flags = 0; 826 + 827 + iwl_set_rxon_channel(priv, channel, ctx); 828 + iwl_set_rxon_ht(priv, ht_conf); 829 + iwl_set_flags_for_band(priv, ctx, channel->band, ctx->vif); 830 + 831 + spin_unlock_irq(&priv->shrd->lock); 832 + 833 + iwl_set_rate(priv); 834 + /* 835 + * at this point, staging_rxon has the 836 + * configuration for channel switch 837 + */ 838 + set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status); 839 + priv->switch_channel = cpu_to_le16(ch); 840 + if (priv->cfg->lib->set_channel_switch(priv, ch_switch)) { 841 + clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status); 842 + priv->switch_channel = 0; 843 + ieee80211_chswitch_done(ctx->vif, false); 844 + } 845 + 846 + out: 847 + mutex_unlock(&priv->shrd->mutex); 848 + IWL_DEBUG_MAC80211(priv, "leave\n"); 849 + } 850 + 851 + static void iwlagn_configure_filter(struct ieee80211_hw *hw, 852 + unsigned int changed_flags, 853 + unsigned int *total_flags, 854 + u64 multicast) 855 + { 856 + struct iwl_priv *priv = hw->priv; 857 + __le32 filter_or = 0, filter_nand = 0; 858 + struct iwl_rxon_context *ctx; 859 + 860 + #define CHK(test, flag) do { \ 861 + if (*total_flags & (test)) \ 862 + filter_or |= (flag); \ 863 + else \ 864 + filter_nand |= (flag); \ 865 + } while (0) 866 + 867 + IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", 868 + changed_flags, *total_flags); 869 + 870 + CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); 871 + /* Setting _just_ RXON_FILTER_CTL2HOST_MSK causes FH errors */ 872 + CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_PROMISC_MSK); 873 + CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); 874 + 875 + #undef CHK 876 + 877 + mutex_lock(&priv->shrd->mutex); 878 + 879 + for_each_context(priv, ctx) { 880 + ctx->staging.filter_flags &= ~filter_nand; 881 + ctx->staging.filter_flags |= filter_or; 882 + 883 + /* 884 + * Not committing directly because hardware can perform a scan, 885 + * but we'll eventually commit the filter flags change anyway. 886 + */ 887 + } 888 + 889 + mutex_unlock(&priv->shrd->mutex); 890 + 891 + /* 892 + * Receiving all multicast frames is always enabled by the 893 + * default flags setup in iwl_connection_init_rx_config() 894 + * since we currently do not support programming multicast 895 + * filters into the device. 896 + */ 897 + *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | 898 + FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; 899 + } 900 + 901 + static void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop) 902 + { 903 + struct iwl_priv *priv = hw->priv; 904 + 905 + mutex_lock(&priv->shrd->mutex); 906 + IWL_DEBUG_MAC80211(priv, "enter\n"); 907 + 908 + if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) { 909 + IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n"); 910 + goto done; 911 + } 912 + if (iwl_is_rfkill(priv->shrd)) { 913 + IWL_DEBUG_TX(priv, "Aborting flush due to RF Kill\n"); 914 + goto done; 915 + } 916 + 917 + /* 918 + * mac80211 will not push any more frames for transmit 919 + * until the flush is completed 920 + */ 921 + if (drop) { 922 + IWL_DEBUG_MAC80211(priv, "send flush command\n"); 923 + if (iwlagn_txfifo_flush(priv, IWL_DROP_ALL)) { 924 + IWL_ERR(priv, "flush request fail\n"); 925 + goto done; 926 + } 927 + } 928 + IWL_DEBUG_MAC80211(priv, "wait transmit/flush all frames\n"); 929 + iwl_trans_wait_tx_queue_empty(trans(priv)); 930 + done: 931 + mutex_unlock(&priv->shrd->mutex); 932 + IWL_DEBUG_MAC80211(priv, "leave\n"); 933 + } 934 + 935 + static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw, 936 + struct ieee80211_channel *channel, 937 + enum nl80211_channel_type channel_type, 938 + int duration) 939 + { 940 + struct iwl_priv *priv = hw->priv; 941 + struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_PAN]; 942 + int err = 0; 943 + 944 + if (!(priv->shrd->valid_contexts & BIT(IWL_RXON_CTX_PAN))) 945 + return -EOPNOTSUPP; 946 + 947 + if (!(ctx->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT))) 948 + return -EOPNOTSUPP; 949 + 950 + IWL_DEBUG_MAC80211(priv, "enter\n"); 951 + mutex_lock(&priv->shrd->mutex); 952 + 953 + if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) { 954 + err = -EBUSY; 955 + goto out; 956 + } 957 + 958 + priv->hw_roc_channel = channel; 959 + priv->hw_roc_chantype = channel_type; 960 + /* convert from ms to TU */ 961 + priv->hw_roc_duration = DIV_ROUND_UP(1000 * duration, 1024); 962 + priv->hw_roc_start_notified = false; 963 + cancel_delayed_work(&priv->hw_roc_disable_work); 964 + 965 + if (!ctx->is_active) { 966 + static const struct iwl_qos_info default_qos_data = { 967 + .def_qos_parm = { 968 + .ac[0] = { 969 + .cw_min = cpu_to_le16(3), 970 + .cw_max = cpu_to_le16(7), 971 + .aifsn = 2, 972 + .edca_txop = cpu_to_le16(1504), 973 + }, 974 + .ac[1] = { 975 + .cw_min = cpu_to_le16(7), 976 + .cw_max = cpu_to_le16(15), 977 + .aifsn = 2, 978 + .edca_txop = cpu_to_le16(3008), 979 + }, 980 + .ac[2] = { 981 + .cw_min = cpu_to_le16(15), 982 + .cw_max = cpu_to_le16(1023), 983 + .aifsn = 3, 984 + }, 985 + .ac[3] = { 986 + .cw_min = cpu_to_le16(15), 987 + .cw_max = cpu_to_le16(1023), 988 + .aifsn = 7, 989 + }, 990 + }, 991 + }; 992 + 993 + ctx->is_active = true; 994 + ctx->qos_data = default_qos_data; 995 + ctx->staging.dev_type = RXON_DEV_TYPE_P2P; 996 + memcpy(ctx->staging.node_addr, 997 + priv->contexts[IWL_RXON_CTX_BSS].staging.node_addr, 998 + ETH_ALEN); 999 + memcpy(ctx->staging.bssid_addr, 1000 + priv->contexts[IWL_RXON_CTX_BSS].staging.node_addr, 1001 + ETH_ALEN); 1002 + err = iwlagn_commit_rxon(priv, ctx); 1003 + if (err) 1004 + goto out; 1005 + ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK | 1006 + RXON_FILTER_PROMISC_MSK | 1007 + RXON_FILTER_CTL2HOST_MSK; 1008 + 1009 + err = iwlagn_commit_rxon(priv, ctx); 1010 + if (err) { 1011 + iwlagn_disable_roc(priv); 1012 + goto out; 1013 + } 1014 + priv->hw_roc_setup = true; 1015 + } 1016 + 1017 + err = iwl_scan_initiate(priv, ctx->vif, IWL_SCAN_ROC, channel->band); 1018 + if (err) 1019 + iwlagn_disable_roc(priv); 1020 + 1021 + out: 1022 + mutex_unlock(&priv->shrd->mutex); 1023 + IWL_DEBUG_MAC80211(priv, "leave\n"); 1024 + 1025 + return err; 1026 + } 1027 + 1028 + static int iwlagn_mac_cancel_remain_on_channel(struct ieee80211_hw *hw) 1029 + { 1030 + struct iwl_priv *priv = hw->priv; 1031 + 1032 + if (!(priv->shrd->valid_contexts & BIT(IWL_RXON_CTX_PAN))) 1033 + return -EOPNOTSUPP; 1034 + 1035 + IWL_DEBUG_MAC80211(priv, "enter\n"); 1036 + mutex_lock(&priv->shrd->mutex); 1037 + iwl_scan_cancel_timeout(priv, priv->hw_roc_duration); 1038 + iwlagn_disable_roc(priv); 1039 + mutex_unlock(&priv->shrd->mutex); 1040 + IWL_DEBUG_MAC80211(priv, "leave\n"); 1041 + 1042 + return 0; 1043 + } 1044 + 1045 + static int iwlagn_mac_tx_sync(struct ieee80211_hw *hw, 1046 + struct ieee80211_vif *vif, 1047 + const u8 *bssid, 1048 + enum ieee80211_tx_sync_type type) 1049 + { 1050 + struct iwl_priv *priv = hw->priv; 1051 + struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1052 + struct iwl_rxon_context *ctx = vif_priv->ctx; 1053 + int ret; 1054 + u8 sta_id; 1055 + 1056 + IWL_DEBUG_MAC80211(priv, "enter\n"); 1057 + mutex_lock(&priv->shrd->mutex); 1058 + 1059 + if (iwl_is_associated_ctx(ctx)) { 1060 + ret = 0; 1061 + goto out; 1062 + } 1063 + 1064 + if (ctx->preauth_bssid || test_bit(STATUS_SCAN_HW, 1065 + &priv->shrd->status)) { 1066 + ret = -EBUSY; 1067 + goto out; 1068 + } 1069 + 1070 + ret = iwl_add_station_common(priv, ctx, bssid, true, NULL, &sta_id); 1071 + if (ret) 1072 + goto out; 1073 + 1074 + if (WARN_ON(sta_id != ctx->ap_sta_id)) { 1075 + ret = -EIO; 1076 + goto out_remove_sta; 1077 + } 1078 + 1079 + memcpy(ctx->bssid, bssid, ETH_ALEN); 1080 + ctx->preauth_bssid = true; 1081 + 1082 + ret = iwlagn_commit_rxon(priv, ctx); 1083 + 1084 + if (ret == 0) 1085 + goto out; 1086 + 1087 + out_remove_sta: 1088 + iwl_remove_station(priv, sta_id, bssid); 1089 + out: 1090 + mutex_unlock(&priv->shrd->mutex); 1091 + IWL_DEBUG_MAC80211(priv, "leave\n"); 1092 + 1093 + return ret; 1094 + } 1095 + 1096 + static void iwlagn_mac_finish_tx_sync(struct ieee80211_hw *hw, 1097 + struct ieee80211_vif *vif, 1098 + const u8 *bssid, 1099 + enum ieee80211_tx_sync_type type) 1100 + { 1101 + struct iwl_priv *priv = hw->priv; 1102 + struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1103 + struct iwl_rxon_context *ctx = vif_priv->ctx; 1104 + 1105 + IWL_DEBUG_MAC80211(priv, "enter\n"); 1106 + mutex_lock(&priv->shrd->mutex); 1107 + 1108 + if (iwl_is_associated_ctx(ctx)) 1109 + goto out; 1110 + 1111 + iwl_remove_station(priv, ctx->ap_sta_id, bssid); 1112 + ctx->preauth_bssid = false; 1113 + /* no need to commit */ 1114 + out: 1115 + mutex_unlock(&priv->shrd->mutex); 1116 + IWL_DEBUG_MAC80211(priv, "leave\n"); 1117 + } 1118 + 1119 + static void iwlagn_mac_rssi_callback(struct ieee80211_hw *hw, 1120 + enum ieee80211_rssi_event rssi_event) 1121 + { 1122 + struct iwl_priv *priv = hw->priv; 1123 + 1124 + IWL_DEBUG_MAC80211(priv, "enter\n"); 1125 + mutex_lock(&priv->shrd->mutex); 1126 + 1127 + if (priv->cfg->bt_params && 1128 + priv->cfg->bt_params->advanced_bt_coexist) { 1129 + if (rssi_event == RSSI_EVENT_LOW) 1130 + priv->bt_enable_pspoll = true; 1131 + else if (rssi_event == RSSI_EVENT_HIGH) 1132 + priv->bt_enable_pspoll = false; 1133 + 1134 + iwlagn_send_advance_bt_config(priv); 1135 + } else { 1136 + IWL_DEBUG_MAC80211(priv, "Advanced BT coex disabled," 1137 + "ignoring RSSI callback\n"); 1138 + } 1139 + 1140 + mutex_unlock(&priv->shrd->mutex); 1141 + IWL_DEBUG_MAC80211(priv, "leave\n"); 1142 + } 1143 + 1144 + static int iwlagn_mac_set_tim(struct ieee80211_hw *hw, 1145 + struct ieee80211_sta *sta, bool set) 1146 + { 1147 + struct iwl_priv *priv = hw->priv; 1148 + 1149 + queue_work(priv->shrd->workqueue, &priv->beacon_update); 1150 + 1151 + return 0; 1152 + } 1153 + 1154 + static int iwlagn_mac_conf_tx(struct ieee80211_hw *hw, 1155 + struct ieee80211_vif *vif, u16 queue, 1156 + const struct ieee80211_tx_queue_params *params) 1157 + { 1158 + struct iwl_priv *priv = hw->priv; 1159 + struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1160 + struct iwl_rxon_context *ctx = vif_priv->ctx; 1161 + unsigned long flags; 1162 + int q; 1163 + 1164 + if (WARN_ON(!ctx)) 1165 + return -EINVAL; 1166 + 1167 + IWL_DEBUG_MAC80211(priv, "enter\n"); 1168 + 1169 + if (!iwl_is_ready_rf(priv->shrd)) { 1170 + IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); 1171 + return -EIO; 1172 + } 1173 + 1174 + if (queue >= AC_NUM) { 1175 + IWL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue); 1176 + return 0; 1177 + } 1178 + 1179 + q = AC_NUM - 1 - queue; 1180 + 1181 + spin_lock_irqsave(&priv->shrd->lock, flags); 1182 + 1183 + ctx->qos_data.def_qos_parm.ac[q].cw_min = 1184 + cpu_to_le16(params->cw_min); 1185 + ctx->qos_data.def_qos_parm.ac[q].cw_max = 1186 + cpu_to_le16(params->cw_max); 1187 + ctx->qos_data.def_qos_parm.ac[q].aifsn = params->aifs; 1188 + ctx->qos_data.def_qos_parm.ac[q].edca_txop = 1189 + cpu_to_le16((params->txop * 32)); 1190 + 1191 + ctx->qos_data.def_qos_parm.ac[q].reserved1 = 0; 1192 + 1193 + spin_unlock_irqrestore(&priv->shrd->lock, flags); 1194 + 1195 + IWL_DEBUG_MAC80211(priv, "leave\n"); 1196 + return 0; 1197 + } 1198 + 1199 + static int iwlagn_mac_tx_last_beacon(struct ieee80211_hw *hw) 1200 + { 1201 + struct iwl_priv *priv = hw->priv; 1202 + 1203 + return priv->ibss_manager == IWL_IBSS_MANAGER; 1204 + } 1205 + 1206 + static int iwl_set_mode(struct iwl_priv *priv, struct iwl_rxon_context *ctx) 1207 + { 1208 + iwl_connection_init_rx_config(priv, ctx); 1209 + 1210 + iwlagn_set_rxon_chain(priv, ctx); 1211 + 1212 + return iwlagn_commit_rxon(priv, ctx); 1213 + } 1214 + 1215 + static int iwl_setup_interface(struct iwl_priv *priv, 1216 + struct iwl_rxon_context *ctx) 1217 + { 1218 + struct ieee80211_vif *vif = ctx->vif; 1219 + int err; 1220 + 1221 + lockdep_assert_held(&priv->shrd->mutex); 1222 + 1223 + /* 1224 + * This variable will be correct only when there's just 1225 + * a single context, but all code using it is for hardware 1226 + * that supports only one context. 1227 + */ 1228 + priv->iw_mode = vif->type; 1229 + 1230 + ctx->is_active = true; 1231 + 1232 + err = iwl_set_mode(priv, ctx); 1233 + if (err) { 1234 + if (!ctx->always_active) 1235 + ctx->is_active = false; 1236 + return err; 1237 + } 1238 + 1239 + if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist && 1240 + vif->type == NL80211_IFTYPE_ADHOC) { 1241 + /* 1242 + * pretend to have high BT traffic as long as we 1243 + * are operating in IBSS mode, as this will cause 1244 + * the rate scaling etc. to behave as intended. 1245 + */ 1246 + priv->bt_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_HIGH; 1247 + } 1248 + 1249 + return 0; 1250 + } 1251 + 1252 + static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, 1253 + struct ieee80211_vif *vif) 1254 + { 1255 + struct iwl_priv *priv = hw->priv; 1256 + struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1257 + struct iwl_rxon_context *tmp, *ctx = NULL; 1258 + int err; 1259 + enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); 1260 + 1261 + IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", 1262 + viftype, vif->addr); 1263 + 1264 + cancel_delayed_work_sync(&priv->hw_roc_disable_work); 1265 + 1266 + mutex_lock(&priv->shrd->mutex); 1267 + 1268 + iwlagn_disable_roc(priv); 1269 + 1270 + if (!iwl_is_ready_rf(priv->shrd)) { 1271 + IWL_WARN(priv, "Try to add interface when device not ready\n"); 1272 + err = -EINVAL; 1273 + goto out; 1274 + } 1275 + 1276 + for_each_context(priv, tmp) { 1277 + u32 possible_modes = 1278 + tmp->interface_modes | tmp->exclusive_interface_modes; 1279 + 1280 + if (tmp->vif) { 1281 + /* check if this busy context is exclusive */ 1282 + if (tmp->exclusive_interface_modes & 1283 + BIT(tmp->vif->type)) { 1284 + err = -EINVAL; 1285 + goto out; 1286 + } 1287 + continue; 1288 + } 1289 + 1290 + if (!(possible_modes & BIT(viftype))) 1291 + continue; 1292 + 1293 + /* have maybe usable context w/o interface */ 1294 + ctx = tmp; 1295 + break; 1296 + } 1297 + 1298 + if (!ctx) { 1299 + err = -EOPNOTSUPP; 1300 + goto out; 1301 + } 1302 + 1303 + vif_priv->ctx = ctx; 1304 + ctx->vif = vif; 1305 + 1306 + err = iwl_setup_interface(priv, ctx); 1307 + if (!err) 1308 + goto out; 1309 + 1310 + ctx->vif = NULL; 1311 + priv->iw_mode = NL80211_IFTYPE_STATION; 1312 + out: 1313 + mutex_unlock(&priv->shrd->mutex); 1314 + 1315 + IWL_DEBUG_MAC80211(priv, "leave\n"); 1316 + return err; 1317 + } 1318 + 1319 + static void iwl_teardown_interface(struct iwl_priv *priv, 1320 + struct ieee80211_vif *vif, 1321 + bool mode_change) 1322 + { 1323 + struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 1324 + 1325 + lockdep_assert_held(&priv->shrd->mutex); 1326 + 1327 + if (priv->scan_vif == vif) { 1328 + iwl_scan_cancel_timeout(priv, 200); 1329 + iwl_force_scan_end(priv); 1330 + } 1331 + 1332 + if (!mode_change) { 1333 + iwl_set_mode(priv, ctx); 1334 + if (!ctx->always_active) 1335 + ctx->is_active = false; 1336 + } 1337 + 1338 + /* 1339 + * When removing the IBSS interface, overwrite the 1340 + * BT traffic load with the stored one from the last 1341 + * notification, if any. If this is a device that 1342 + * doesn't implement this, this has no effect since 1343 + * both values are the same and zero. 1344 + */ 1345 + if (vif->type == NL80211_IFTYPE_ADHOC) 1346 + priv->bt_traffic_load = priv->last_bt_traffic_load; 1347 + } 1348 + 1349 + static void iwlagn_mac_remove_interface(struct ieee80211_hw *hw, 1350 + struct ieee80211_vif *vif) 1351 + { 1352 + struct iwl_priv *priv = hw->priv; 1353 + struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 1354 + 1355 + IWL_DEBUG_MAC80211(priv, "enter\n"); 1356 + 1357 + mutex_lock(&priv->shrd->mutex); 1358 + 1359 + if (WARN_ON(ctx->vif != vif)) { 1360 + struct iwl_rxon_context *tmp; 1361 + IWL_ERR(priv, "ctx->vif = %p, vif = %p\n", ctx->vif, vif); 1362 + for_each_context(priv, tmp) 1363 + IWL_ERR(priv, "\tID = %d:\tctx = %p\tctx->vif = %p\n", 1364 + tmp->ctxid, tmp, tmp->vif); 1365 + } 1366 + ctx->vif = NULL; 1367 + 1368 + iwl_teardown_interface(priv, vif, false); 1369 + 1370 + mutex_unlock(&priv->shrd->mutex); 1371 + 1372 + IWL_DEBUG_MAC80211(priv, "leave\n"); 1373 + 1374 + } 1375 + 1376 + static int iwlagn_mac_change_interface(struct ieee80211_hw *hw, 1377 + struct ieee80211_vif *vif, 1378 + enum nl80211_iftype newtype, bool newp2p) 1379 + { 1380 + struct iwl_priv *priv = hw->priv; 1381 + struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 1382 + struct iwl_rxon_context *bss_ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1383 + struct iwl_rxon_context *tmp; 1384 + enum nl80211_iftype newviftype = newtype; 1385 + u32 interface_modes; 1386 + int err; 1387 + 1388 + IWL_DEBUG_MAC80211(priv, "enter\n"); 1389 + 1390 + newtype = ieee80211_iftype_p2p(newtype, newp2p); 1391 + 1392 + mutex_lock(&priv->shrd->mutex); 1393 + 1394 + if (!ctx->vif || !iwl_is_ready_rf(priv->shrd)) { 1395 + /* 1396 + * Huh? But wait ... this can maybe happen when 1397 + * we're in the middle of a firmware restart! 1398 + */ 1399 + err = -EBUSY; 1400 + goto out; 1401 + } 1402 + 1403 + interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes; 1404 + 1405 + if (!(interface_modes & BIT(newtype))) { 1406 + err = -EBUSY; 1407 + goto out; 1408 + } 1409 + 1410 + /* 1411 + * Refuse a change that should be done by moving from the PAN 1412 + * context to the BSS context instead, if the BSS context is 1413 + * available and can support the new interface type. 1414 + */ 1415 + if (ctx->ctxid == IWL_RXON_CTX_PAN && !bss_ctx->vif && 1416 + (bss_ctx->interface_modes & BIT(newtype) || 1417 + bss_ctx->exclusive_interface_modes & BIT(newtype))) { 1418 + BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); 1419 + err = -EBUSY; 1420 + goto out; 1421 + } 1422 + 1423 + if (ctx->exclusive_interface_modes & BIT(newtype)) { 1424 + for_each_context(priv, tmp) { 1425 + if (ctx == tmp) 1426 + continue; 1427 + 1428 + if (!tmp->vif) 1429 + continue; 1430 + 1431 + /* 1432 + * The current mode switch would be exclusive, but 1433 + * another context is active ... refuse the switch. 1434 + */ 1435 + err = -EBUSY; 1436 + goto out; 1437 + } 1438 + } 1439 + 1440 + /* success */ 1441 + iwl_teardown_interface(priv, vif, true); 1442 + vif->type = newviftype; 1443 + vif->p2p = newp2p; 1444 + err = iwl_setup_interface(priv, ctx); 1445 + WARN_ON(err); 1446 + /* 1447 + * We've switched internally, but submitting to the 1448 + * device may have failed for some reason. Mask this 1449 + * error, because otherwise mac80211 will not switch 1450 + * (and set the interface type back) and we'll be 1451 + * out of sync with it. 1452 + */ 1453 + err = 0; 1454 + 1455 + out: 1456 + mutex_unlock(&priv->shrd->mutex); 1457 + IWL_DEBUG_MAC80211(priv, "leave\n"); 1458 + 1459 + return err; 1460 + } 1461 + 1462 + static int iwlagn_mac_hw_scan(struct ieee80211_hw *hw, 1463 + struct ieee80211_vif *vif, 1464 + struct cfg80211_scan_request *req) 1465 + { 1466 + struct iwl_priv *priv = hw->priv; 1467 + int ret; 1468 + 1469 + IWL_DEBUG_MAC80211(priv, "enter\n"); 1470 + 1471 + if (req->n_channels == 0) 1472 + return -EINVAL; 1473 + 1474 + mutex_lock(&priv->shrd->mutex); 1475 + 1476 + /* 1477 + * If an internal scan is in progress, just set 1478 + * up the scan_request as per above. 1479 + */ 1480 + if (priv->scan_type != IWL_SCAN_NORMAL) { 1481 + IWL_DEBUG_SCAN(priv, 1482 + "SCAN request during internal scan - defer\n"); 1483 + priv->scan_request = req; 1484 + priv->scan_vif = vif; 1485 + ret = 0; 1486 + } else { 1487 + priv->scan_request = req; 1488 + priv->scan_vif = vif; 1489 + /* 1490 + * mac80211 will only ask for one band at a time 1491 + * so using channels[0] here is ok 1492 + */ 1493 + ret = iwl_scan_initiate(priv, vif, IWL_SCAN_NORMAL, 1494 + req->channels[0]->band); 1495 + if (ret) { 1496 + priv->scan_request = NULL; 1497 + priv->scan_vif = NULL; 1498 + } 1499 + } 1500 + 1501 + IWL_DEBUG_MAC80211(priv, "leave\n"); 1502 + 1503 + mutex_unlock(&priv->shrd->mutex); 1504 + 1505 + return ret; 1506 + } 1507 + 1508 + static int iwlagn_mac_sta_remove(struct ieee80211_hw *hw, 1509 + struct ieee80211_vif *vif, 1510 + struct ieee80211_sta *sta) 1511 + { 1512 + struct iwl_priv *priv = hw->priv; 1513 + struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 1514 + int ret; 1515 + 1516 + IWL_DEBUG_MAC80211(priv, "enter: received request to remove " 1517 + "station %pM\n", sta->addr); 1518 + mutex_lock(&priv->shrd->mutex); 1519 + IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n", 1520 + sta->addr); 1521 + ret = iwl_remove_station(priv, sta_priv->sta_id, sta->addr); 1522 + if (ret) 1523 + IWL_DEBUG_QUIET_RFKILL(priv, "Error removing station %pM\n", 1524 + sta->addr); 1525 + mutex_unlock(&priv->shrd->mutex); 1526 + IWL_DEBUG_MAC80211(priv, "leave\n"); 1527 + 1528 + return ret; 1529 + } 1530 + 1531 + static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) 1532 + { 1533 + unsigned long flags; 1534 + 1535 + spin_lock_irqsave(&priv->shrd->sta_lock, flags); 1536 + priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK; 1537 + priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK; 1538 + priv->stations[sta_id].sta.sta.modify_mask = 0; 1539 + priv->stations[sta_id].sta.sleep_tx_count = 0; 1540 + priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 1541 + iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 1542 + spin_unlock_irqrestore(&priv->shrd->sta_lock, flags); 1543 + 1544 + } 1545 + 1546 + static void iwlagn_mac_sta_notify(struct ieee80211_hw *hw, 1547 + struct ieee80211_vif *vif, 1548 + enum sta_notify_cmd cmd, 1549 + struct ieee80211_sta *sta) 1550 + { 1551 + struct iwl_priv *priv = hw->priv; 1552 + struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 1553 + int sta_id; 1554 + 1555 + IWL_DEBUG_MAC80211(priv, "enter\n"); 1556 + 1557 + switch (cmd) { 1558 + case STA_NOTIFY_SLEEP: 1559 + WARN_ON(!sta_priv->client); 1560 + sta_priv->asleep = true; 1561 + if (atomic_read(&sta_priv->pending_frames) > 0) 1562 + ieee80211_sta_block_awake(hw, sta, true); 1563 + break; 1564 + case STA_NOTIFY_AWAKE: 1565 + WARN_ON(!sta_priv->client); 1566 + if (!sta_priv->asleep) 1567 + break; 1568 + sta_priv->asleep = false; 1569 + sta_id = iwl_sta_id(sta); 1570 + if (sta_id != IWL_INVALID_STATION) 1571 + iwl_sta_modify_ps_wake(priv, sta_id); 1572 + break; 1573 + default: 1574 + break; 1575 + } 1576 + IWL_DEBUG_MAC80211(priv, "leave\n"); 1577 + } 1578 + 1579 + struct ieee80211_ops iwlagn_hw_ops = { 1580 + .tx = iwlagn_mac_tx, 1581 + .start = iwlagn_mac_start, 1582 + .stop = iwlagn_mac_stop, 1583 + #ifdef CONFIG_PM_SLEEP 1584 + .suspend = iwlagn_mac_suspend, 1585 + .resume = iwlagn_mac_resume, 1586 + #endif 1587 + .add_interface = iwlagn_mac_add_interface, 1588 + .remove_interface = iwlagn_mac_remove_interface, 1589 + .change_interface = iwlagn_mac_change_interface, 1590 + .config = iwlagn_mac_config, 1591 + .configure_filter = iwlagn_configure_filter, 1592 + .set_key = iwlagn_mac_set_key, 1593 + .update_tkip_key = iwlagn_mac_update_tkip_key, 1594 + .set_rekey_data = iwlagn_mac_set_rekey_data, 1595 + .conf_tx = iwlagn_mac_conf_tx, 1596 + .bss_info_changed = iwlagn_bss_info_changed, 1597 + .ampdu_action = iwlagn_mac_ampdu_action, 1598 + .hw_scan = iwlagn_mac_hw_scan, 1599 + .sta_notify = iwlagn_mac_sta_notify, 1600 + .sta_add = iwlagn_mac_sta_add, 1601 + .sta_remove = iwlagn_mac_sta_remove, 1602 + .channel_switch = iwlagn_mac_channel_switch, 1603 + .flush = iwlagn_mac_flush, 1604 + .tx_last_beacon = iwlagn_mac_tx_last_beacon, 1605 + .remain_on_channel = iwlagn_mac_remain_on_channel, 1606 + .cancel_remain_on_channel = iwlagn_mac_cancel_remain_on_channel, 1607 + .rssi_callback = iwlagn_mac_rssi_callback, 1608 + CFG80211_TESTMODE_CMD(iwlagn_mac_testmode_cmd) 1609 + CFG80211_TESTMODE_DUMP(iwlagn_mac_testmode_dump) 1610 + .tx_sync = iwlagn_mac_tx_sync, 1611 + .finish_tx_sync = iwlagn_mac_finish_tx_sync, 1612 + .set_tim = iwlagn_mac_set_tim, 1613 + }; 1614 + 1615 + /* This function both allocates and initializes hw and priv. */ 1616 + struct ieee80211_hw *iwl_alloc_all(void) 1617 + { 1618 + struct iwl_priv *priv; 1619 + /* mac80211 allocates memory for this device instance, including 1620 + * space for this driver's private structure */ 1621 + struct ieee80211_hw *hw; 1622 + 1623 + hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), &iwlagn_hw_ops); 1624 + if (!hw) 1625 + goto out; 1626 + 1627 + priv = hw->priv; 1628 + priv->hw = hw; 1629 + 1630 + out: 1631 + return hw; 1632 + }
+2 -18
drivers/net/wireless/iwlwifi/iwl-pci.c
··· 255 255 {IWL_PCI_DEVICE(0x0082, 0xC020, iwl6005_2agn_sff_cfg)}, 256 256 {IWL_PCI_DEVICE(0x0085, 0xC220, iwl6005_2agn_sff_cfg)}, 257 257 {IWL_PCI_DEVICE(0x0082, 0x1341, iwl6005_2agn_d_cfg)}, 258 + {IWL_PCI_DEVICE(0x0082, 0x1304, iwl6005_2agn_cfg)},/* low 5GHz active */ 259 + {IWL_PCI_DEVICE(0x0082, 0x1305, iwl6005_2agn_cfg)},/* high 5GHz active */ 258 260 259 261 /* 6x30 Series */ 260 262 {IWL_PCI_DEVICE(0x008A, 0x5305, iwl1030_bgn_cfg)}, ··· 326 324 {IWL_PCI_DEVICE(0x0890, 0x4022, iwl2000_2bgn_cfg)}, 327 325 {IWL_PCI_DEVICE(0x0891, 0x4222, iwl2000_2bgn_cfg)}, 328 326 {IWL_PCI_DEVICE(0x0890, 0x4422, iwl2000_2bgn_cfg)}, 329 - {IWL_PCI_DEVICE(0x0890, 0x4026, iwl2000_2bg_cfg)}, 330 - {IWL_PCI_DEVICE(0x0891, 0x4226, iwl2000_2bg_cfg)}, 331 - {IWL_PCI_DEVICE(0x0890, 0x4426, iwl2000_2bg_cfg)}, 332 327 {IWL_PCI_DEVICE(0x0890, 0x4822, iwl2000_2bgn_d_cfg)}, 333 328 334 329 /* 2x30 Series */ 335 330 {IWL_PCI_DEVICE(0x0887, 0x4062, iwl2030_2bgn_cfg)}, 336 331 {IWL_PCI_DEVICE(0x0888, 0x4262, iwl2030_2bgn_cfg)}, 337 332 {IWL_PCI_DEVICE(0x0887, 0x4462, iwl2030_2bgn_cfg)}, 338 - {IWL_PCI_DEVICE(0x0887, 0x4066, iwl2030_2bg_cfg)}, 339 - {IWL_PCI_DEVICE(0x0888, 0x4266, iwl2030_2bg_cfg)}, 340 - {IWL_PCI_DEVICE(0x0887, 0x4466, iwl2030_2bg_cfg)}, 341 333 342 334 /* 6x35 Series */ 343 335 {IWL_PCI_DEVICE(0x088E, 0x4060, iwl6035_2agn_cfg)}, 344 336 {IWL_PCI_DEVICE(0x088F, 0x4260, iwl6035_2agn_cfg)}, 345 337 {IWL_PCI_DEVICE(0x088E, 0x4460, iwl6035_2agn_cfg)}, 346 - {IWL_PCI_DEVICE(0x088E, 0x4064, iwl6035_2abg_cfg)}, 347 - {IWL_PCI_DEVICE(0x088F, 0x4264, iwl6035_2abg_cfg)}, 348 - {IWL_PCI_DEVICE(0x088E, 0x4464, iwl6035_2abg_cfg)}, 349 - {IWL_PCI_DEVICE(0x088E, 0x4066, iwl6035_2bg_cfg)}, 350 - {IWL_PCI_DEVICE(0x088F, 0x4266, iwl6035_2bg_cfg)}, 351 - {IWL_PCI_DEVICE(0x088E, 0x4466, iwl6035_2bg_cfg)}, 352 338 353 339 /* 105 Series */ 354 340 {IWL_PCI_DEVICE(0x0894, 0x0022, iwl105_bgn_cfg)}, 355 341 {IWL_PCI_DEVICE(0x0895, 0x0222, iwl105_bgn_cfg)}, 356 342 {IWL_PCI_DEVICE(0x0894, 0x0422, iwl105_bgn_cfg)}, 357 - {IWL_PCI_DEVICE(0x0894, 0x0026, iwl105_bg_cfg)}, 358 - {IWL_PCI_DEVICE(0x0895, 0x0226, iwl105_bg_cfg)}, 359 - {IWL_PCI_DEVICE(0x0894, 0x0426, iwl105_bg_cfg)}, 360 343 {IWL_PCI_DEVICE(0x0894, 0x0822, iwl105_bgn_d_cfg)}, 361 344 362 345 /* 135 Series */ 363 346 {IWL_PCI_DEVICE(0x0892, 0x0062, iwl135_bgn_cfg)}, 364 347 {IWL_PCI_DEVICE(0x0893, 0x0262, iwl135_bgn_cfg)}, 365 348 {IWL_PCI_DEVICE(0x0892, 0x0462, iwl135_bgn_cfg)}, 366 - {IWL_PCI_DEVICE(0x0892, 0x0066, iwl135_bg_cfg)}, 367 - {IWL_PCI_DEVICE(0x0893, 0x0266, iwl135_bg_cfg)}, 368 - {IWL_PCI_DEVICE(0x0892, 0x0466, iwl135_bg_cfg)}, 369 349 370 350 {0} 371 351 };
+2 -45
drivers/net/wireless/iwlwifi/iwl-scan.c
··· 416 416 417 417 if (!iwl_is_associated_ctx(ctx)) 418 418 continue; 419 + if (ctx->staging.dev_type == RXON_DEV_TYPE_P2P) 420 + continue; 419 421 value = ctx->beacon_int; 420 422 if (!value) 421 423 value = IWL_PASSIVE_DWELL_BASE; ··· 941 939 return 0; 942 940 } 943 941 944 - int iwlagn_mac_hw_scan(struct ieee80211_hw *hw, 945 - struct ieee80211_vif *vif, 946 - struct cfg80211_scan_request *req) 947 - { 948 - struct iwl_priv *priv = hw->priv; 949 - int ret; 950 - 951 - IWL_DEBUG_MAC80211(priv, "enter\n"); 952 - 953 - if (req->n_channels == 0) 954 - return -EINVAL; 955 - 956 - mutex_lock(&priv->shrd->mutex); 957 - 958 - /* 959 - * If an internal scan is in progress, just set 960 - * up the scan_request as per above. 961 - */ 962 - if (priv->scan_type != IWL_SCAN_NORMAL) { 963 - IWL_DEBUG_SCAN(priv, 964 - "SCAN request during internal scan - defer\n"); 965 - priv->scan_request = req; 966 - priv->scan_vif = vif; 967 - ret = 0; 968 - } else { 969 - priv->scan_request = req; 970 - priv->scan_vif = vif; 971 - /* 972 - * mac80211 will only ask for one band at a time 973 - * so using channels[0] here is ok 974 - */ 975 - ret = iwl_scan_initiate(priv, vif, IWL_SCAN_NORMAL, 976 - req->channels[0]->band); 977 - if (ret) { 978 - priv->scan_request = NULL; 979 - priv->scan_vif = NULL; 980 - } 981 - } 982 - 983 - IWL_DEBUG_MAC80211(priv, "leave\n"); 984 - 985 - mutex_unlock(&priv->shrd->mutex); 986 - 987 - return ret; 988 - } 989 942 990 943 /* 991 944 * internal short scan, this function should only been called while associated.
+2 -5
drivers/net/wireless/iwlwifi/iwl-sv-open.c
··· 396 396 break; 397 397 398 398 case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW: 399 - status = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init, 400 - IWL_UCODE_INIT); 399 + status = iwlagn_load_ucode_wait_alive(priv, IWL_UCODE_INIT); 401 400 if (status) 402 401 IWL_DEBUG_INFO(priv, 403 402 "Error loading init ucode: %d\n", status); ··· 408 409 break; 409 410 410 411 case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW: 411 - status = iwlagn_load_ucode_wait_alive(priv, 412 - &priv->ucode_rt, 413 - IWL_UCODE_REGULAR); 412 + status = iwlagn_load_ucode_wait_alive(priv, IWL_UCODE_REGULAR); 414 413 if (status) { 415 414 IWL_DEBUG_INFO(priv, 416 415 "Error loading runtime ucode: %d\n", status);
+29 -6
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
··· 355 355 } 356 356 357 357 static inline void iwl_wake_queue(struct iwl_trans *trans, 358 - struct iwl_tx_queue *txq) 358 + struct iwl_tx_queue *txq, const char *msg) 359 359 { 360 360 u8 queue = txq->swq_id; 361 361 u8 ac = queue & 3; ··· 363 363 struct iwl_trans_pcie *trans_pcie = 364 364 IWL_TRANS_GET_PCIE_TRANS(trans); 365 365 366 - if (test_and_clear_bit(hwq, trans_pcie->queue_stopped)) 367 - if (atomic_dec_return(&trans_pcie->queue_stop_count[ac]) <= 0) 366 + if (test_and_clear_bit(hwq, trans_pcie->queue_stopped)) { 367 + if (atomic_dec_return(&trans_pcie->queue_stop_count[ac]) <= 0) { 368 368 iwl_wake_sw_queue(priv(trans), ac); 369 + IWL_DEBUG_TX_QUEUES(trans, "Wake hwq %d ac %d. %s", 370 + hwq, ac, msg); 371 + } else { 372 + IWL_DEBUG_TX_QUEUES(trans, "Don't wake hwq %d ac %d" 373 + " stop count %d. %s", 374 + hwq, ac, atomic_read(&trans_pcie-> 375 + queue_stop_count[ac]), msg); 376 + } 377 + } 369 378 } 370 379 371 380 static inline void iwl_stop_queue(struct iwl_trans *trans, 372 - struct iwl_tx_queue *txq) 381 + struct iwl_tx_queue *txq, const char *msg) 373 382 { 374 383 u8 queue = txq->swq_id; 375 384 u8 ac = queue & 3; ··· 386 377 struct iwl_trans_pcie *trans_pcie = 387 378 IWL_TRANS_GET_PCIE_TRANS(trans); 388 379 389 - if (!test_and_set_bit(hwq, trans_pcie->queue_stopped)) 390 - if (atomic_inc_return(&trans_pcie->queue_stop_count[ac]) > 0) 380 + if (!test_and_set_bit(hwq, trans_pcie->queue_stopped)) { 381 + if (atomic_inc_return(&trans_pcie->queue_stop_count[ac]) > 0) { 391 382 iwl_stop_sw_queue(priv(trans), ac); 383 + IWL_DEBUG_TX_QUEUES(trans, "Stop hwq %d ac %d" 384 + " stop count %d. %s", 385 + hwq, ac, atomic_read(&trans_pcie-> 386 + queue_stop_count[ac]), msg); 387 + } else { 388 + IWL_DEBUG_TX_QUEUES(trans, "Don't stop hwq %d ac %d" 389 + " stop count %d. %s", 390 + hwq, ac, atomic_read(&trans_pcie-> 391 + queue_stop_count[ac]), msg); 392 + } 393 + } else { 394 + IWL_DEBUG_TX_QUEUES(trans, "stop hwq %d, but it is stopped/ %s", 395 + hwq, msg); 396 + } 392 397 } 393 398 394 399 #ifdef ieee80211_stop_queue
+1 -1
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
··· 1108 1108 isr_stats->tx++; 1109 1109 handled |= CSR_INT_BIT_FH_TX; 1110 1110 /* Wake up uCode load routine, now that load is complete */ 1111 - priv(trans)->ucode_write_complete = 1; 1111 + trans->ucode_write_complete = 1; 1112 1112 wake_up(&trans->shrd->wait_command_queue); 1113 1113 } 1114 1114
+29 -23
drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
··· 430 430 431 431 txq->sched_retry = scd_retry; 432 432 433 - IWL_DEBUG_INFO(trans, "%s %s Queue %d on FIFO %d\n", 433 + IWL_DEBUG_TX_QUEUES(trans, "%s %s Queue %d on FIFO %d\n", 434 434 active ? "Activate" : "Deactivate", 435 435 scd_retry ? "BA" : "AC/CMD", txq_id, tx_fifo_id); 436 436 } ··· 561 561 562 562 tid_data = &trans->shrd->tid_data[sta_id][tid]; 563 563 if (tid_data->tfds_in_queue == 0) { 564 - IWL_DEBUG_HT(trans, "HW queue is empty\n"); 564 + IWL_DEBUG_TX_QUEUES(trans, "HW queue is empty\n"); 565 565 tid_data->agg.state = IWL_AGG_ON; 566 566 iwl_start_tx_ba_trans_ready(priv(trans), ctx, sta_id, tid); 567 567 } else { 568 - IWL_DEBUG_HT(trans, "HW queue is NOT empty: %d packets in HW" 569 - "queue\n", tid_data->tfds_in_queue); 568 + IWL_DEBUG_TX_QUEUES(trans, 569 + "HW queue is NOT empty: %d packets in HW" 570 + " queue\n", tid_data->tfds_in_queue); 570 571 tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_ADDBA; 571 572 } 572 573 spin_unlock_irqrestore(&trans->shrd->sta_lock, flags); ··· 644 643 645 644 /* The queue is not empty */ 646 645 if (write_ptr != read_ptr) { 647 - IWL_DEBUG_HT(trans, "Stopping a non empty AGG HW QUEUE\n"); 646 + IWL_DEBUG_TX_QUEUES(trans, 647 + "Stopping a non empty AGG HW QUEUE\n"); 648 648 trans->shrd->tid_data[sta_id][tid].agg.state = 649 649 IWL_EMPTYING_HW_QUEUE_DELBA; 650 650 spin_unlock_irqrestore(&trans->shrd->sta_lock, flags); 651 651 return 0; 652 652 } 653 653 654 - IWL_DEBUG_HT(trans, "HW queue is empty\n"); 654 + IWL_DEBUG_TX_QUEUES(trans, "HW queue is empty\n"); 655 655 turn_off: 656 656 trans->shrd->tid_data[sta_id][tid].agg.state = IWL_AGG_OFF; 657 657 ··· 984 982 985 983 ret = iwl_enqueue_hcmd(trans, cmd); 986 984 if (ret < 0) { 987 - IWL_ERR(trans, "Error sending %s: enqueue_hcmd failed: %d\n", 985 + IWL_DEBUG_QUIET_RFKILL(trans, 986 + "Error sending %s: enqueue_hcmd failed: %d\n", 988 987 get_cmd_string(cmd->id), ret); 989 988 return ret; 990 989 } ··· 1003 1000 IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n", 1004 1001 get_cmd_string(cmd->id)); 1005 1002 1003 + if (test_bit(STATUS_EXIT_PENDING, &trans->shrd->status)) 1004 + return -EBUSY; 1005 + 1006 + 1007 + if (test_bit(STATUS_RF_KILL_HW, &trans->shrd->status)) { 1008 + IWL_ERR(trans, "Command %s aborted: RF KILL Switch\n", 1009 + get_cmd_string(cmd->id)); 1010 + return -ECANCELED; 1011 + } 1012 + if (test_bit(STATUS_FW_ERROR, &trans->shrd->status)) { 1013 + IWL_ERR(trans, "Command %s failed: FW Error\n", 1014 + get_cmd_string(cmd->id)); 1015 + return -EIO; 1016 + } 1006 1017 set_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status); 1007 1018 IWL_DEBUG_INFO(trans, "Setting HCMD_ACTIVE for command %s\n", 1008 1019 get_cmd_string(cmd->id)); ··· 1025 1008 if (cmd_idx < 0) { 1026 1009 ret = cmd_idx; 1027 1010 clear_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status); 1028 - IWL_ERR(trans, "Error sending %s: enqueue_hcmd failed: %d\n", 1011 + IWL_DEBUG_QUIET_RFKILL(trans, 1012 + "Error sending %s: enqueue_hcmd failed: %d\n", 1029 1013 get_cmd_string(cmd->id), ret); 1030 1014 return ret; 1031 1015 } ··· 1040 1022 &trans_pcie->txq[trans->shrd->cmd_queue]; 1041 1023 struct iwl_queue *q = &txq->q; 1042 1024 1043 - IWL_ERR(trans, 1025 + IWL_DEBUG_QUIET_RFKILL(trans, 1044 1026 "Error sending %s: time out after %dms.\n", 1045 1027 get_cmd_string(cmd->id), 1046 1028 jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); 1047 1029 1048 - IWL_ERR(trans, 1030 + IWL_DEBUG_QUIET_RFKILL(trans, 1049 1031 "Current CMD queue read_ptr %d write_ptr %d\n", 1050 1032 q->read_ptr, q->write_ptr); 1051 1033 ··· 1057 1039 } 1058 1040 } 1059 1041 1060 - if (test_bit(STATUS_RF_KILL_HW, &trans->shrd->status)) { 1061 - IWL_ERR(trans, "Command %s aborted: RF KILL Switch\n", 1062 - get_cmd_string(cmd->id)); 1063 - ret = -ECANCELED; 1064 - goto fail; 1065 - } 1066 - if (test_bit(STATUS_FW_ERROR, &trans->shrd->status)) { 1067 - IWL_ERR(trans, "Command %s failed: FW Error\n", 1068 - get_cmd_string(cmd->id)); 1069 - ret = -EIO; 1070 - goto fail; 1071 - } 1072 1042 if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_page) { 1073 1043 IWL_ERR(trans, "Error: Response NULL in '%s'\n", 1074 1044 get_cmd_string(cmd->id)); ··· 1077 1071 trans_pcie->txq[trans->shrd->cmd_queue].meta[cmd_idx].flags &= 1078 1072 ~CMD_WANT_SKB; 1079 1073 } 1080 - fail: 1074 + 1081 1075 if (cmd->reply_page) { 1082 1076 iwl_free_pages(trans->shrd, cmd->reply_page); 1083 1077 cmd->reply_page = 0;
+13 -10
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
··· 1231 1231 txq->need_update = 1; 1232 1232 iwl_txq_update_write_ptr(trans, txq); 1233 1233 } else { 1234 - iwl_stop_queue(trans, txq); 1234 + iwl_stop_queue(trans, txq, "Queue is full"); 1235 1235 } 1236 1236 } 1237 1237 return 0; ··· 1283 1283 /* aggregated HW queue */ 1284 1284 if ((txq_id == tid_data->agg.txq_id) && 1285 1285 (q->read_ptr == q->write_ptr)) { 1286 - IWL_DEBUG_HT(trans, 1286 + IWL_DEBUG_TX_QUEUES(trans, 1287 1287 "HW queue empty: continue DELBA flow\n"); 1288 1288 iwl_trans_pcie_txq_agg_disable(trans, txq_id); 1289 1289 tid_data->agg.state = IWL_AGG_OFF; 1290 1290 iwl_stop_tx_ba_trans_ready(priv(trans), 1291 1291 NUM_IWL_RXON_CTX, 1292 1292 sta_id, tid); 1293 - iwl_wake_queue(trans, &trans_pcie->txq[txq_id]); 1293 + iwl_wake_queue(trans, &trans_pcie->txq[txq_id], 1294 + "DELBA flow complete"); 1294 1295 } 1295 1296 break; 1296 1297 case IWL_EMPTYING_HW_QUEUE_ADDBA: 1297 1298 /* We are reclaiming the last packet of the queue */ 1298 1299 if (tid_data->tfds_in_queue == 0) { 1299 - IWL_DEBUG_HT(trans, 1300 + IWL_DEBUG_TX_QUEUES(trans, 1300 1301 "HW queue empty: continue ADDBA flow\n"); 1301 1302 tid_data->agg.state = IWL_AGG_ON; 1302 1303 iwl_start_tx_ba_trans_ready(priv(trans), ··· 1355 1354 ssn , tfd_num, txq_id, txq->swq_id); 1356 1355 freed = iwl_tx_queue_reclaim(trans, txq_id, tfd_num, skbs); 1357 1356 if (iwl_queue_space(&txq->q) > txq->q.low_mark && cond) 1358 - iwl_wake_queue(trans, txq); 1357 + iwl_wake_queue(trans, txq, "Packets reclaimed"); 1359 1358 } 1360 1359 1361 1360 iwl_free_tfds_in_queue(trans, sta_id, tid, freed); ··· 1419 1418 #endif /* CONFIG_PM_SLEEP */ 1420 1419 1421 1420 static void iwl_trans_pcie_wake_any_queue(struct iwl_trans *trans, 1422 - enum iwl_rxon_context_id ctx) 1421 + enum iwl_rxon_context_id ctx, 1422 + const char *msg) 1423 1423 { 1424 1424 u8 ac, txq_id; 1425 1425 struct iwl_trans_pcie *trans_pcie = ··· 1428 1426 1429 1427 for (ac = 0; ac < AC_NUM; ac++) { 1430 1428 txq_id = trans_pcie->ac_to_queue[ctx][ac]; 1431 - IWL_DEBUG_INFO(trans, "Queue Status: Q[%d] %s\n", 1429 + IWL_DEBUG_TX_QUEUES(trans, "Queue Status: Q[%d] %s\n", 1432 1430 ac, 1433 1431 (atomic_read(&trans_pcie->queue_stop_count[ac]) > 0) 1434 1432 ? "stopped" : "awake"); 1435 - iwl_wake_queue(trans, &trans_pcie->txq[txq_id]); 1433 + iwl_wake_queue(trans, &trans_pcie->txq[txq_id], msg); 1436 1434 } 1437 1435 } 1438 1436 ··· 1455 1453 return iwl_trans; 1456 1454 } 1457 1455 1458 - static void iwl_trans_pcie_stop_queue(struct iwl_trans *trans, int txq_id) 1456 + static void iwl_trans_pcie_stop_queue(struct iwl_trans *trans, int txq_id, 1457 + const char *msg) 1459 1458 { 1460 1459 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 1461 1460 1462 - iwl_stop_queue(trans, &trans_pcie->txq[txq_id]); 1461 + iwl_stop_queue(trans, &trans_pcie->txq[txq_id], msg); 1463 1462 } 1464 1463 1465 1464 #define IWL_FLUSH_WAIT_MS 2000
+44 -6
drivers/net/wireless/iwlwifi/iwl-trans.h
··· 171 171 void (*tx_start)(struct iwl_trans *trans); 172 172 173 173 void (*wake_any_queue)(struct iwl_trans *trans, 174 - enum iwl_rxon_context_id ctx); 174 + enum iwl_rxon_context_id ctx, 175 + const char *msg); 175 176 176 177 int (*send_cmd)(struct iwl_trans *trans, struct iwl_host_cmd *cmd); 177 178 ··· 197 196 198 197 void (*free)(struct iwl_trans *trans); 199 198 200 - void (*stop_queue)(struct iwl_trans *trans, int q); 199 + void (*stop_queue)(struct iwl_trans *trans, int q, const char *msg); 201 200 202 201 int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir); 203 202 int (*check_stuck_queue)(struct iwl_trans *trans, int q); ··· 208 207 #endif 209 208 }; 210 209 210 + /* one for each uCode image (inst/data, boot/init/runtime) */ 211 + struct fw_desc { 212 + dma_addr_t p_addr; /* hardware address */ 213 + void *v_addr; /* software address */ 214 + u32 len; /* size in bytes */ 215 + }; 216 + 217 + struct fw_img { 218 + struct fw_desc code; /* firmware code image */ 219 + struct fw_desc data; /* firmware data image */ 220 + }; 221 + 222 + enum iwl_ucode_type { 223 + IWL_UCODE_NONE, 224 + IWL_UCODE_REGULAR, 225 + IWL_UCODE_INIT, 226 + IWL_UCODE_WOWLAN, 227 + }; 228 + 211 229 /** 212 230 * struct iwl_trans - transport common data 213 231 * @ops - pointer to iwl_trans_ops 214 232 * @shrd - pointer to iwl_shared which holds shared data from the upper layer 215 233 * @hcmd_lock: protects HCMD 234 + * @ucode_write_complete: indicates that the ucode has been copied. 235 + * @ucode_rt: run time ucode image 236 + * @ucode_init: init ucode image 237 + * @ucode_wowlan: wake on wireless ucode image (optional) 216 238 */ 217 239 struct iwl_trans { 218 240 const struct iwl_trans_ops *ops; 219 241 struct iwl_shared *shrd; 220 242 spinlock_t hcmd_lock; 243 + 244 + u8 ucode_write_complete; /* the image write is complete */ 245 + struct fw_img ucode_rt; 246 + struct fw_img ucode_init; 247 + struct fw_img ucode_wowlan; 248 + 249 + /* eeprom related variables */ 250 + int nvm_device_type; 221 251 222 252 /* pointer to trans specific struct */ 223 253 /*Ensure that this pointer will always be aligned to sizeof pointer */ ··· 281 249 } 282 250 283 251 static inline void iwl_trans_wake_any_queue(struct iwl_trans *trans, 284 - enum iwl_rxon_context_id ctx) 252 + enum iwl_rxon_context_id ctx, 253 + const char *msg) 285 254 { 286 - trans->ops->wake_any_queue(trans, ctx); 255 + trans->ops->wake_any_queue(trans, ctx, msg); 287 256 } 288 257 289 258 ··· 344 311 trans->ops->free(trans); 345 312 } 346 313 347 - static inline void iwl_trans_stop_queue(struct iwl_trans *trans, int q) 314 + static inline void iwl_trans_stop_queue(struct iwl_trans *trans, int q, 315 + const char *msg) 348 316 { 349 - trans->ops->stop_queue(trans, q); 317 + trans->ops->stop_queue(trans, q, msg); 350 318 } 351 319 352 320 static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans) ··· 381 347 * Transport layers implementations 382 348 ******************************************************/ 383 349 extern const struct iwl_trans_ops trans_ops_pcie; 350 + 351 + int iwl_alloc_fw_desc(struct iwl_bus *bus, struct fw_desc *desc, 352 + const void *data, size_t len); 353 + void iwl_dealloc_ucode(struct iwl_trans *trans); 384 354 385 355 #endif /* __iwl_trans_h__ */
+15 -10
drivers/net/wireless/libertas/cfg.c
··· 485 485 static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy, 486 486 struct cmd_header *resp) 487 487 { 488 + struct cfg80211_bss *bss; 488 489 struct cmd_ds_802_11_scan_rsp *scanresp = (void *)resp; 489 490 int bsssize; 490 491 const u8 *pos; ··· 633 632 LBS_SCAN_RSSI_TO_MBM(rssi)/100); 634 633 635 634 if (channel && 636 - !(channel->flags & IEEE80211_CHAN_DISABLED)) 637 - cfg80211_inform_bss(wiphy, channel, 635 + !(channel->flags & IEEE80211_CHAN_DISABLED)) { 636 + bss = cfg80211_inform_bss(wiphy, channel, 638 637 bssid, le64_to_cpu(*(__le64 *)tsfdesc), 639 638 capa, intvl, ie, ielen, 640 639 LBS_SCAN_RSSI_TO_MBM(rssi), 641 640 GFP_KERNEL); 641 + cfg80211_put_bss(bss); 642 + } 642 643 } else 643 644 lbs_deb_scan("scan response: missing BSS channel IE\n"); 644 645 ··· 1723 1720 2 + 2 + /* atim */ 1724 1721 2 + 8]; /* extended rates */ 1725 1722 u8 *fake = fake_ie; 1723 + struct cfg80211_bss *bss; 1726 1724 1727 1725 lbs_deb_enter(LBS_DEB_CFG80211); 1728 1726 ··· 1767 1763 *fake++ = 0x6c; 1768 1764 lbs_deb_hex(LBS_DEB_CFG80211, "IE", fake_ie, fake - fake_ie); 1769 1765 1770 - cfg80211_inform_bss(priv->wdev->wiphy, 1771 - params->channel, 1772 - bssid, 1773 - 0, 1774 - capability, 1775 - params->beacon_interval, 1776 - fake_ie, fake - fake_ie, 1777 - 0, GFP_KERNEL); 1766 + bss = cfg80211_inform_bss(priv->wdev->wiphy, 1767 + params->channel, 1768 + bssid, 1769 + 0, 1770 + capability, 1771 + params->beacon_interval, 1772 + fake_ie, fake - fake_ie, 1773 + 0, GFP_KERNEL); 1774 + cfg80211_put_bss(bss); 1778 1775 1779 1776 memcpy(priv->wdev->ssid, params->ssid, params->ssid_len); 1780 1777 priv->wdev->ssid_len = params->ssid_len;
+4 -3
drivers/net/wireless/libertas/ethtool.c
··· 13 13 { 14 14 struct lbs_private *priv = dev->ml_priv; 15 15 16 - snprintf(info->fw_version, 32, "%u.%u.%u.p%u", 16 + snprintf(info->fw_version, sizeof(info->fw_version), 17 + "%u.%u.%u.p%u", 17 18 priv->fwrelease >> 24 & 0xff, 18 19 priv->fwrelease >> 16 & 0xff, 19 20 priv->fwrelease >> 8 & 0xff, 20 21 priv->fwrelease & 0xff); 21 - strcpy(info->driver, "libertas"); 22 - strcpy(info->version, lbs_driver_version); 22 + strlcpy(info->driver, "libertas", sizeof(info->driver)); 23 + strlcpy(info->version, lbs_driver_version, sizeof(info->version)); 23 24 } 24 25 25 26 /*
+6 -12
drivers/net/wireless/mwifiex/11n_rxreorder.c
··· 33 33 * Since the buffer is linear, the function uses rotation to simulate 34 34 * circular buffer. 35 35 */ 36 - static int 36 + static void 37 37 mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv, 38 38 struct mwifiex_rx_reorder_tbl 39 39 *rx_reor_tbl_ptr, int start_win) ··· 71 71 72 72 rx_reor_tbl_ptr->start_win = start_win; 73 73 spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); 74 - 75 - return 0; 76 74 } 77 75 78 76 /* ··· 81 83 * Since the buffer is linear, the function uses rotation to simulate 82 84 * circular buffer. 83 85 */ 84 - static int 86 + static void 85 87 mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv, 86 88 struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr) 87 89 { ··· 117 119 rx_reor_tbl_ptr->start_win = (rx_reor_tbl_ptr->start_win + i) 118 120 &(MAX_TID_VALUE - 1); 119 121 spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); 120 - return 0; 121 122 } 122 123 123 124 /* ··· 402 405 u8 *ta, u8 pkt_type, void *payload) 403 406 { 404 407 struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr; 405 - int start_win, end_win, win_size, ret; 408 + int start_win, end_win, win_size; 406 409 u16 pkt_index; 407 410 408 411 rx_reor_tbl_ptr = ··· 449 452 start_win = (end_win - win_size) + 1; 450 453 else 451 454 start_win = (MAX_TID_VALUE - (win_size - seq_num)) + 1; 452 - ret = mwifiex_11n_dispatch_pkt_until_start_win(priv, 455 + mwifiex_11n_dispatch_pkt_until_start_win(priv, 453 456 rx_reor_tbl_ptr, start_win); 454 - 455 - if (ret) 456 - return ret; 457 457 } 458 458 459 459 if (pkt_type != PKT_TYPE_BAR) { ··· 469 475 * Dispatch all packets sequentially from start_win until a 470 476 * hole is found and adjust the start_win appropriately 471 477 */ 472 - ret = mwifiex_11n_scan_and_dispatch(priv, rx_reor_tbl_ptr); 478 + mwifiex_11n_scan_and_dispatch(priv, rx_reor_tbl_ptr); 473 479 474 - return ret; 480 + return 0; 475 481 } 476 482 477 483 /*
+2 -2
drivers/net/wireless/mwifiex/Kconfig
··· 10 10 mwifiex. 11 11 12 12 config MWIFIEX_SDIO 13 - tristate "Marvell WiFi-Ex Driver for SD8787" 13 + tristate "Marvell WiFi-Ex Driver for SD8787/SD8797" 14 14 depends on MWIFIEX && MMC 15 15 select FW_LOADER 16 16 ---help--- 17 17 This adds support for wireless adapters based on Marvell 18 - 8787 chipset with SDIO interface. 18 + 8787/8797 chipsets with SDIO interface. 19 19 20 20 If you choose to build it as a module, it will be called 21 21 mwifiex_sdio.
+3 -1
drivers/net/wireless/mwifiex/cfg80211.c
··· 780 780 { 781 781 struct ieee80211_channel *chan; 782 782 struct mwifiex_bss_info bss_info; 783 + struct cfg80211_bss *bss; 783 784 int ie_len; 784 785 u8 ie_buf[IEEE80211_MAX_SSID_LEN + sizeof(struct ieee_types_header)]; 785 786 enum ieee80211_band band; ··· 801 800 ieee80211_channel_to_frequency(bss_info.bss_chan, 802 801 band)); 803 802 804 - cfg80211_inform_bss(priv->wdev->wiphy, chan, 803 + bss = cfg80211_inform_bss(priv->wdev->wiphy, chan, 805 804 bss_info.bssid, 0, WLAN_CAPABILITY_IBSS, 806 805 0, ie_buf, ie_len, 0, GFP_KERNEL); 806 + cfg80211_put_bss(bss); 807 807 memcpy(priv->cfg_bssid, bss_info.bssid, ETH_ALEN); 808 808 809 809 return 0;
+25 -11
drivers/net/wireless/mwifiex/cfp.c
··· 75 75 * This function maps an index in supported rates table into 76 76 * the corresponding data rate. 77 77 */ 78 - u32 mwifiex_index_to_data_rate(u8 index, u8 ht_info) 78 + u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv, u8 index, 79 + u8 ht_info) 79 80 { 80 - u16 mcs_rate[4][8] = { 81 - {0x1b, 0x36, 0x51, 0x6c, 0xa2, 0xd8, 0xf3, 0x10e} 82 - , /* LG 40M */ 83 - {0x1e, 0x3c, 0x5a, 0x78, 0xb4, 0xf0, 0x10e, 0x12c} 84 - , /* SG 40M */ 85 - {0x0d, 0x1a, 0x27, 0x34, 0x4e, 0x68, 0x75, 0x82} 86 - , /* LG 20M */ 87 - {0x0e, 0x1c, 0x2b, 0x39, 0x56, 0x73, 0x82, 0x90} 88 - }; /* SG 20M */ 81 + /* 82 + * For every mcs_rate line, the first 8 bytes are for stream 1x1, 83 + * and all 16 bytes are for stream 2x2. 84 + */ 85 + u16 mcs_rate[4][16] = { 86 + /* LGI 40M */ 87 + { 0x1b, 0x36, 0x51, 0x6c, 0xa2, 0xd8, 0xf3, 0x10e, 88 + 0x36, 0x6c, 0xa2, 0xd8, 0x144, 0x1b0, 0x1e6, 0x21c }, 89 89 90 + /* SGI 40M */ 91 + { 0x1e, 0x3c, 0x5a, 0x78, 0xb4, 0xf0, 0x10e, 0x12c, 92 + 0x3c, 0x78, 0xb4, 0xf0, 0x168, 0x1e0, 0x21c, 0x258 }, 93 + 94 + /* LGI 20M */ 95 + { 0x0d, 0x1a, 0x27, 0x34, 0x4e, 0x68, 0x75, 0x82, 96 + 0x1a, 0x34, 0x4e, 0x68, 0x9c, 0xd0, 0xea, 0x104 }, 97 + 98 + /* SGI 20M */ 99 + { 0x0e, 0x1c, 0x2b, 0x39, 0x56, 0x73, 0x82, 0x90, 100 + 0x1c, 0x39, 0x56, 0x73, 0xad, 0xe7, 0x104, 0x120 } 101 + }; 102 + u32 mcs_num_supp = 103 + (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2) ? 16 : 8; 90 104 u32 rate; 91 105 92 106 if (ht_info & BIT(0)) { ··· 109 95 rate = 0x0D; /* MCS 32 SGI rate */ 110 96 else 111 97 rate = 0x0C; /* MCS 32 LGI rate */ 112 - } else if (index < 8) { 98 + } else if (index < mcs_num_supp) { 113 99 if (ht_info & BIT(1)) { 114 100 if (ht_info & BIT(2)) 115 101 /* SGI, 40M */
+2 -1
drivers/net/wireless/mwifiex/fw.h
··· 165 165 166 166 #define GET_RXMCSSUPP(DevMCSSupported) (DevMCSSupported & 0x0f) 167 167 #define SETHT_MCS32(x) (x[4] |= 1) 168 + #define HT_STREAM_2X2 0x22 168 169 169 170 #define SET_SECONDARYCHAN(RadioType, SECCHAN) (RadioType |= (SECCHAN << 4)) 170 171 ··· 674 673 union ieee_types_phy_param_set phy_param_set; 675 674 u16 reserved1; 676 675 __le16 cap_info_bitmap; 677 - u8 DataRate[HOSTCMD_SUPPORTED_RATES]; 676 + u8 data_rate[HOSTCMD_SUPPORTED_RATES]; 678 677 } __packed; 679 678 680 679 struct host_cmd_ds_802_11_ad_hoc_result {
+2 -2
drivers/net/wireless/mwifiex/init.c
··· 187 187 struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = NULL; 188 188 189 189 skb_put(adapter->sleep_cfm, sizeof(struct mwifiex_opt_sleep_confirm)); 190 - sleep_cfm_buf = (struct mwifiex_opt_sleep_confirm *) 191 - (adapter->sleep_cfm->data); 192 190 193 191 adapter->cmd_sent = false; 194 192 ··· 252 254 mwifiex_wmm_init(adapter); 253 255 254 256 if (adapter->sleep_cfm) { 257 + sleep_cfm_buf = (struct mwifiex_opt_sleep_confirm *) 258 + adapter->sleep_cfm->data; 255 259 memset(sleep_cfm_buf, 0, adapter->sleep_cfm->len); 256 260 sleep_cfm_buf->command = 257 261 cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH);
+39 -55
drivers/net/wireless/mwifiex/join.c
··· 724 724 u32 cmd_append_size = 0; 725 725 u32 i; 726 726 u16 tmp_cap; 727 - uint16_t ht_cap_info; 728 727 struct mwifiex_ie_types_chan_list_param_set *chan_tlv; 728 + u8 radio_type; 729 729 730 730 struct mwifiex_ie_types_htcap *ht_cap; 731 731 struct mwifiex_ie_types_htinfo *ht_info; ··· 837 837 bss_desc->privacy = MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL; 838 838 } 839 839 840 - memset(adhoc_start->DataRate, 0, sizeof(adhoc_start->DataRate)); 841 - mwifiex_get_active_data_rates(priv, adhoc_start->DataRate); 840 + memset(adhoc_start->data_rate, 0, sizeof(adhoc_start->data_rate)); 841 + mwifiex_get_active_data_rates(priv, adhoc_start->data_rate); 842 842 if ((adapter->adhoc_start_band & BAND_G) && 843 843 (priv->curr_pkt_filter & HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON)) { 844 844 if (mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL, ··· 850 850 } 851 851 } 852 852 /* Find the last non zero */ 853 - for (i = 0; i < sizeof(adhoc_start->DataRate) && 854 - adhoc_start->DataRate[i]; 855 - i++) 856 - ; 853 + for (i = 0; i < sizeof(adhoc_start->data_rate); i++) 854 + if (!adhoc_start->data_rate[i]) 855 + break; 857 856 858 857 priv->curr_bss_params.num_of_rates = i; 859 858 860 859 /* Copy the ad-hoc creating rates into Current BSS rate structure */ 861 860 memcpy(&priv->curr_bss_params.data_rates, 862 - &adhoc_start->DataRate, priv->curr_bss_params.num_of_rates); 861 + &adhoc_start->data_rate, priv->curr_bss_params.num_of_rates); 863 862 864 863 dev_dbg(adapter->dev, "info: ADHOC_S_CMD: rates=%02x %02x %02x %02x\n", 865 - adhoc_start->DataRate[0], adhoc_start->DataRate[1], 866 - adhoc_start->DataRate[2], adhoc_start->DataRate[3]); 864 + adhoc_start->data_rate[0], adhoc_start->data_rate[1], 865 + adhoc_start->data_rate[2], adhoc_start->data_rate[3]); 867 866 868 867 dev_dbg(adapter->dev, "info: ADHOC_S_CMD: AD-HOC Start command is ready\n"); 869 868 ··· 913 914 } 914 915 915 916 if (adapter->adhoc_11n_enabled) { 916 - { 917 - ht_cap = (struct mwifiex_ie_types_htcap *) pos; 918 - memset(ht_cap, 0, 919 - sizeof(struct mwifiex_ie_types_htcap)); 920 - ht_cap->header.type = 921 - cpu_to_le16(WLAN_EID_HT_CAPABILITY); 922 - ht_cap->header.len = 923 - cpu_to_le16(sizeof(struct ieee80211_ht_cap)); 924 - ht_cap_info = le16_to_cpu(ht_cap->ht_cap.cap_info); 917 + /* Fill HT CAPABILITY */ 918 + ht_cap = (struct mwifiex_ie_types_htcap *) pos; 919 + memset(ht_cap, 0, sizeof(struct mwifiex_ie_types_htcap)); 920 + ht_cap->header.type = cpu_to_le16(WLAN_EID_HT_CAPABILITY); 921 + ht_cap->header.len = 922 + cpu_to_le16(sizeof(struct ieee80211_ht_cap)); 923 + radio_type = mwifiex_band_to_radio_type( 924 + priv->adapter->config_bands); 925 + mwifiex_fill_cap_info(priv, radio_type, ht_cap); 925 926 926 - ht_cap_info |= IEEE80211_HT_CAP_SGI_20; 927 - if (adapter->chan_offset) { 928 - ht_cap_info |= IEEE80211_HT_CAP_SGI_40; 929 - ht_cap_info |= IEEE80211_HT_CAP_DSSSCCK40; 930 - ht_cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; 931 - SETHT_MCS32(ht_cap->ht_cap.mcs.rx_mask); 932 - } 927 + pos += sizeof(struct mwifiex_ie_types_htcap); 928 + cmd_append_size += 929 + sizeof(struct mwifiex_ie_types_htcap); 933 930 934 - ht_cap->ht_cap.ampdu_params_info 935 - = IEEE80211_HT_MAX_AMPDU_64K; 936 - ht_cap->ht_cap.mcs.rx_mask[0] = 0xff; 937 - pos += sizeof(struct mwifiex_ie_types_htcap); 938 - cmd_append_size += 939 - sizeof(struct mwifiex_ie_types_htcap); 940 - } 941 - { 942 - ht_info = (struct mwifiex_ie_types_htinfo *) pos; 943 - memset(ht_info, 0, 944 - sizeof(struct mwifiex_ie_types_htinfo)); 945 - ht_info->header.type = 946 - cpu_to_le16(WLAN_EID_HT_INFORMATION); 947 - ht_info->header.len = 948 - cpu_to_le16(sizeof(struct ieee80211_ht_info)); 949 - ht_info->ht_info.control_chan = 950 - (u8) priv->curr_bss_params.bss_descriptor. 951 - channel; 952 - if (adapter->chan_offset) { 953 - ht_info->ht_info.ht_param = 954 - adapter->chan_offset; 955 - ht_info->ht_info.ht_param |= 931 + /* Fill HT INFORMATION */ 932 + ht_info = (struct mwifiex_ie_types_htinfo *) pos; 933 + memset(ht_info, 0, sizeof(struct mwifiex_ie_types_htinfo)); 934 + ht_info->header.type = cpu_to_le16(WLAN_EID_HT_INFORMATION); 935 + ht_info->header.len = 936 + cpu_to_le16(sizeof(struct ieee80211_ht_info)); 937 + 938 + ht_info->ht_info.control_chan = 939 + (u8) priv->curr_bss_params.bss_descriptor.channel; 940 + if (adapter->chan_offset) { 941 + ht_info->ht_info.ht_param = adapter->chan_offset; 942 + ht_info->ht_info.ht_param |= 956 943 IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; 957 - } 958 - ht_info->ht_info.operation_mode = 959 - cpu_to_le16(IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); 960 - ht_info->ht_info.basic_set[0] = 0xff; 961 - pos += sizeof(struct mwifiex_ie_types_htinfo); 962 - cmd_append_size += 963 - sizeof(struct mwifiex_ie_types_htinfo); 964 944 } 945 + ht_info->ht_info.operation_mode = 946 + cpu_to_le16(IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); 947 + ht_info->ht_info.basic_set[0] = 0xff; 948 + pos += sizeof(struct mwifiex_ie_types_htinfo); 949 + cmd_append_size += 950 + sizeof(struct mwifiex_ie_types_htinfo); 965 951 } 966 952 967 953 cmd->size = cpu_to_le16((u16)
+2 -1
drivers/net/wireless/mwifiex/main.h
··· 775 775 struct mwifiex_chan_freq_power *mwifiex_get_cfp_by_band_and_freq_from_cfg80211( 776 776 struct mwifiex_private *priv, 777 777 u8 band, u32 freq); 778 - u32 mwifiex_index_to_data_rate(u8 index, u8 ht_info); 778 + u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv, u8 index, 779 + u8 ht_info); 779 780 u32 mwifiex_find_freq_from_band_chan(u8, u8); 780 781 int mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv, u16 vsie_mask, 781 782 u8 **buffer);
+1 -6
drivers/net/wireless/mwifiex/scan.c
··· 1535 1535 return 0; 1536 1536 } 1537 1537 1538 - static void mwifiex_free_bss_priv(struct cfg80211_bss *bss) 1539 - { 1540 - kfree(bss->priv); 1541 - } 1542 - 1543 1538 /* 1544 1539 * This function handles the command response of scan. 1545 1540 * ··· 1760 1765 cap_info_bitmap, beacon_period, 1761 1766 ie_buf, ie_len, rssi, GFP_KERNEL); 1762 1767 *(u8 *)bss->priv = band; 1763 - bss->free_priv = mwifiex_free_bss_priv; 1768 + cfg80211_put_bss(bss); 1764 1769 1765 1770 if (priv->media_connected && !memcmp(bssid, 1766 1771 priv->curr_bss_params.bss_descriptor
+15 -2
drivers/net/wireless/mwifiex/sdio.c
··· 256 256 257 257 /* Device ID for SD8787 */ 258 258 #define SDIO_DEVICE_ID_MARVELL_8787 (0x9119) 259 + /* Device ID for SD8797 */ 260 + #define SDIO_DEVICE_ID_MARVELL_8797 (0x9129) 259 261 260 262 /* WLAN IDs */ 261 263 static const struct sdio_device_id mwifiex_ids[] = { 262 264 {SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, SDIO_DEVICE_ID_MARVELL_8787)}, 265 + {SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, SDIO_DEVICE_ID_MARVELL_8797)}, 263 266 {}, 264 267 }; 265 268 ··· 1576 1573 sdio_set_drvdata(func, card); 1577 1574 1578 1575 adapter->dev = &func->dev; 1579 - strcpy(adapter->fw_name, SD8787_DEFAULT_FW_NAME); 1576 + 1577 + switch (func->device) { 1578 + case SDIO_DEVICE_ID_MARVELL_8797: 1579 + strcpy(adapter->fw_name, SD8797_DEFAULT_FW_NAME); 1580 + break; 1581 + case SDIO_DEVICE_ID_MARVELL_8787: 1582 + default: 1583 + strcpy(adapter->fw_name, SD8787_DEFAULT_FW_NAME); 1584 + break; 1585 + } 1580 1586 1581 1587 return 0; 1582 1588 ··· 1786 1774 MODULE_DESCRIPTION("Marvell WiFi-Ex SDIO Driver version " SDIO_VERSION); 1787 1775 MODULE_VERSION(SDIO_VERSION); 1788 1776 MODULE_LICENSE("GPL v2"); 1789 - MODULE_FIRMWARE("mrvl/sd8787_uapsta.bin"); 1777 + MODULE_FIRMWARE(SD8787_DEFAULT_FW_NAME); 1778 + MODULE_FIRMWARE(SD8797_DEFAULT_FW_NAME);
+1
drivers/net/wireless/mwifiex/sdio.h
··· 29 29 #include "main.h" 30 30 31 31 #define SD8787_DEFAULT_FW_NAME "mrvl/sd8787_uapsta.bin" 32 + #define SD8797_DEFAULT_FW_NAME "mrvl/sd8797_uapsta.bin" 32 33 33 34 #define BLOCK_MODE 1 34 35 #define BYTE_MODE 0
+1 -1
drivers/net/wireless/mwifiex/sta_cmdresp.c
··· 508 508 priv->tx_htinfo = resp->params.tx_rate.ht_info; 509 509 if (!priv->is_data_rate_auto) 510 510 priv->data_rate = 511 - mwifiex_index_to_data_rate(priv->tx_rate, 511 + mwifiex_index_to_data_rate(priv, priv->tx_rate, 512 512 priv->tx_htinfo); 513 513 514 514 return 0;
+2 -2
drivers/net/wireless/mwifiex/sta_ioctl.c
··· 832 832 833 833 if (!ret) { 834 834 if (rate->is_rate_auto) 835 - rate->rate = mwifiex_index_to_data_rate(priv->tx_rate, 836 - priv->tx_htinfo); 835 + rate->rate = mwifiex_index_to_data_rate(priv, 836 + priv->tx_rate, priv->tx_htinfo); 837 837 else 838 838 rate->rate = priv->data_rate; 839 839 } else {
+7 -5
drivers/net/wireless/mwifiex/sta_rx.c
··· 126 126 u16 rx_pkt_type; 127 127 struct mwifiex_private *priv = adapter->priv[rx_info->bss_index]; 128 128 129 + if (!priv) 130 + return -1; 131 + 129 132 local_rx_pd = (struct rxpd *) (skb->data); 130 133 rx_pkt_type = local_rx_pd->rx_pkt_type; 131 134 ··· 192 189 (u8) local_rx_pd->rx_pkt_type, 193 190 skb); 194 191 195 - if (ret || (rx_pkt_type == PKT_TYPE_BAR)) { 196 - if (priv && (ret == -1)) 197 - priv->stats.rx_dropped++; 198 - 192 + if (ret || (rx_pkt_type == PKT_TYPE_BAR)) 199 193 dev_kfree_skb_any(skb); 200 - } 194 + 195 + if (ret) 196 + priv->stats.rx_dropped++; 201 197 202 198 return ret; 203 199 }
+1 -5
drivers/net/wireless/p54/p54spi.c
··· 581 581 struct p54s_priv *priv = dev->priv; 582 582 unsigned long flags; 583 583 584 - if (mutex_lock_interruptible(&priv->mutex)) { 585 - /* FIXME: how to handle this error? */ 586 - return; 587 - } 588 - 584 + mutex_lock(&priv->mutex); 589 585 WARN_ON(priv->fw_state != FW_STATE_READY); 590 586 591 587 cancel_work_sync(&priv->work);
+2 -2
drivers/net/wireless/prism54/islpci_dev.c
··· 793 793 static void islpci_ethtool_get_drvinfo(struct net_device *dev, 794 794 struct ethtool_drvinfo *info) 795 795 { 796 - strcpy(info->driver, DRV_NAME); 797 - strcpy(info->version, DRV_VERSION); 796 + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); 797 + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); 798 798 } 799 799 800 800 static const struct ethtool_ops islpci_ethtool_ops = {
+34
include/linux/nl80211.h
··· 1160 1160 * 1161 1161 * @NL80211_ATTR_FEATURE_FLAGS: This u32 attribute contains flags from 1162 1162 * &enum nl80211_feature_flags and is advertised in wiphy information. 1163 + * @NL80211_ATTR_PROBE_RESP_OFFLOAD: Indicates that the HW responds to probe 1164 + * 1165 + * requests while operating in AP-mode. 1166 + * This attribute holds a bitmap of the supported protocols for 1167 + * offloading (see &enum nl80211_probe_resp_offload_support_attr). 1168 + * 1169 + * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire 1170 + * probe-response frame. The DA field in the 802.11 header is zero-ed out, 1171 + * to be filled by the FW. 1163 1172 * 1164 1173 * @NL80211_ATTR_MAX: highest attribute number currently defined 1165 1174 * @__NL80211_ATTR_AFTER_LAST: internal use ··· 1403 1394 NL80211_ATTR_DONT_WAIT_FOR_ACK, 1404 1395 1405 1396 NL80211_ATTR_FEATURE_FLAGS, 1397 + 1398 + NL80211_ATTR_PROBE_RESP_OFFLOAD, 1399 + 1400 + NL80211_ATTR_PROBE_RESP, 1406 1401 1407 1402 /* add attributes here, update the policy in nl80211.c */ 1408 1403 ··· 2738 2725 */ 2739 2726 enum nl80211_feature_flags { 2740 2727 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 2728 + }; 2729 + 2730 + /** 2731 + * enum nl80211_probe_resp_offload_support_attr - optional supported 2732 + * protocols for probe-response offloading by the driver/FW. 2733 + * To be used with the %NL80211_ATTR_PROBE_RESP_OFFLOAD attribute. 2734 + * Each enum value represents a bit in the bitmap of supported 2735 + * protocols. Typically a subset of probe-requests belonging to a 2736 + * supported protocol will be excluded from offload and uploaded 2737 + * to the host. 2738 + * 2739 + * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS: Support for WPS ver. 1 2740 + * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2: Support for WPS ver. 2 2741 + * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P: Support for P2P 2742 + * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U: Support for 802.11u 2743 + */ 2744 + enum nl80211_probe_resp_offload_support_attr { 2745 + NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS = 1<<0, 2746 + NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 = 1<<1, 2747 + NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P = 1<<2, 2748 + NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U = 1<<3, 2741 2749 }; 2742 2750 2743 2751 #endif /* __LINUX_NL80211_H */
+19
include/net/cfg80211.h
··· 391 391 * @assocresp_ies: extra information element(s) to add into (Re)Association 392 392 * Response frames or %NULL 393 393 * @assocresp_ies_len: length of assocresp_ies in octets 394 + * @probe_resp_len: length of probe response template (@probe_resp) 395 + * @probe_resp: probe response template (AP mode only) 394 396 */ 395 397 struct beacon_parameters { 396 398 u8 *head, *tail; ··· 410 408 size_t proberesp_ies_len; 411 409 const u8 *assocresp_ies; 412 410 size_t assocresp_ies_len; 411 + int probe_resp_len; 412 + u8 *probe_resp; 413 413 }; 414 414 415 415 /** ··· 1346 1342 * doesn't verify much. Note, however, that the passed netdev may be 1347 1343 * %NULL as well if the user requested changing the channel for the 1348 1344 * device itself, or for a monitor interface. 1345 + * @get_channel: Get the current operating channel, should return %NULL if 1346 + * there's no single defined operating channel if for example the 1347 + * device implements channel hopping for multi-channel virtual interfaces. 1349 1348 * 1350 1349 * @scan: Request to do a scan. If returning zero, the scan request is given 1351 1350 * the driver, and will be valid until passed to cfg80211_scan_done(). ··· 1634 1627 1635 1628 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 1636 1629 const u8 *peer, u64 *cookie); 1630 + 1631 + struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy); 1637 1632 }; 1638 1633 1639 1634 /* ··· 1698 1689 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 1699 1690 * when there are virtual interfaces in AP mode by calling 1700 1691 * cfg80211_report_obss_beacon(). 1692 + * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 1693 + * responds to probe-requests in hardware. 1701 1694 */ 1702 1695 enum wiphy_flags { 1703 1696 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), ··· 1720 1709 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 1721 1710 WIPHY_FLAG_HAVE_AP_SME = BIT(17), 1722 1711 WIPHY_FLAG_REPORTS_OBSS = BIT(18), 1712 + WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 1723 1713 }; 1724 1714 1725 1715 /** ··· 1988 1976 1989 1977 u32 available_antennas_tx; 1990 1978 u32 available_antennas_rx; 1979 + 1980 + /* 1981 + * Bitmap of supported protocols for probe response offloading 1982 + * see &enum nl80211_probe_resp_offload_support_attr. Only valid 1983 + * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 1984 + */ 1985 + u32 probe_resp_offload; 1991 1986 1992 1987 /* If multiple wiphys are registered and you're handed e.g. 1993 1988 * a regular netdev with assigned ieee80211_ptr, you won't
-8
include/net/ieee80211_radiotap.h
··· 271 271 #define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10 272 272 273 273 274 - /* Ugly macro to convert literal channel numbers into their mhz equivalents 275 - * There are certianly some conditions that will break this (like feeding it '30') 276 - * but they shouldn't arise since nothing talks on channel 30. */ 277 - #define ieee80211chan2mhz(x) \ 278 - (((x) <= 14) ? \ 279 - (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \ 280 - ((x) + 1000) * 5) 281 - 282 274 /* helpers */ 283 275 static inline int ieee80211_get_radiotap_len(unsigned char *data) 284 276 {
+15
include/net/mac80211.h
··· 166 166 * that it is only ever disabled for station mode. 167 167 * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. 168 168 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode) 169 + * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) 169 170 */ 170 171 enum ieee80211_bss_change { 171 172 BSS_CHANGED_ASSOC = 1<<0, ··· 185 184 BSS_CHANGED_QOS = 1<<13, 186 185 BSS_CHANGED_IDLE = 1<<14, 187 186 BSS_CHANGED_SSID = 1<<15, 187 + BSS_CHANGED_AP_PROBE_RESP = 1<<16, 188 188 189 189 /* when adding here, make sure to change ieee80211_reconfig */ 190 190 }; ··· 2675 2673 { 2676 2674 return ieee80211_beacon_get_tim(hw, vif, NULL, NULL); 2677 2675 } 2676 + 2677 + /** 2678 + * ieee80211_proberesp_get - retrieve a Probe Response template 2679 + * @hw: pointer obtained from ieee80211_alloc_hw(). 2680 + * @vif: &struct ieee80211_vif pointer from the add_interface callback. 2681 + * 2682 + * Creates a Probe Response template which can, for example, be uploaded to 2683 + * hardware. The destination address should be set by the caller. 2684 + * 2685 + * Can only be called in AP mode. 2686 + */ 2687 + struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw, 2688 + struct ieee80211_vif *vif); 2678 2689 2679 2690 /** 2680 2691 * ieee80211_pspoll_get - retrieve a PS Poll template
+89 -82
include/net/nfc/nci.h
··· 34 34 #define NCI_MAX_NUM_CONN 10 35 35 36 36 /* NCI Status Codes */ 37 - #define NCI_STATUS_OK 0x00 38 - #define NCI_STATUS_REJECTED 0x01 39 - #define NCI_STATUS_MESSAGE_CORRUPTED 0x02 40 - #define NCI_STATUS_BUFFER_FULL 0x03 41 - #define NCI_STATUS_FAILED 0x04 42 - #define NCI_STATUS_NOT_INITIALIZED 0x05 43 - #define NCI_STATUS_SYNTAX_ERROR 0x06 44 - #define NCI_STATUS_SEMANTIC_ERROR 0x07 45 - #define NCI_STATUS_UNKNOWN_GID 0x08 46 - #define NCI_STATUS_UNKNOWN_OID 0x09 47 - #define NCI_STATUS_INVALID_PARAM 0x0a 48 - #define NCI_STATUS_MESSAGE_SIZE_EXCEEDED 0x0b 37 + #define NCI_STATUS_OK 0x00 38 + #define NCI_STATUS_REJECTED 0x01 39 + #define NCI_STATUS_RF_FRAME_CORRUPTED 0x02 40 + #define NCI_STATUS_FAILED 0x03 41 + #define NCI_STATUS_NOT_INITIALIZED 0x04 42 + #define NCI_STATUS_SYNTAX_ERROR 0x05 43 + #define NCI_STATUS_SEMANTIC_ERROR 0x06 44 + #define NCI_STATUS_UNKNOWN_GID 0x07 45 + #define NCI_STATUS_UNKNOWN_OID 0x08 46 + #define NCI_STATUS_INVALID_PARAM 0x09 47 + #define NCI_STATUS_MESSAGE_SIZE_EXCEEDED 0x0a 49 48 /* Discovery Specific Status Codes */ 50 - #define NCI_STATUS_DISCOVERY_ALREADY_STARTED 0xa0 51 - #define NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED 0xa1 49 + #define NCI_STATUS_DISCOVERY_ALREADY_STARTED 0xa0 50 + #define NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED 0xa1 51 + #define NCI_STATUS_DISCOVERY_TEAR_DOWN 0xa2 52 52 /* RF Interface Specific Status Codes */ 53 - #define NCI_STATUS_RF_TRANSMISSION_ERROR 0xb0 54 - #define NCI_STATUS_RF_PROTOCOL_ERROR 0xb1 55 - #define NCI_STATUS_RF_TIMEOUT_ERROR 0xb2 56 - #define NCI_STATUS_RF_LINK_LOSS_ERROR 0xb3 53 + #define NCI_STATUS_RF_TRANSMISSION_ERROR 0xb0 54 + #define NCI_STATUS_RF_PROTOCOL_ERROR 0xb1 55 + #define NCI_STATUS_RF_TIMEOUT_ERROR 0xb2 57 56 /* NFCEE Interface Specific Status Codes */ 58 - #define NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED 0xc0 59 - #define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED 0xc1 60 - #define NCI_STATUS_NFCEE_TRANSMISSION_ERROR 0xc2 61 - #define NCI_STATUS_NFCEE_PROTOCOL_ERROR 0xc3 57 + #define NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED 0xc0 58 + #define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED 0xc1 59 + #define NCI_STATUS_NFCEE_TRANSMISSION_ERROR 0xc2 60 + #define NCI_STATUS_NFCEE_PROTOCOL_ERROR 0xc3 62 61 #define NCI_STATUS_NFCEE_TIMEOUT_ERROR 0xc4 63 62 64 63 /* NCI RF Technology and Mode */ ··· 72 73 #define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83 73 74 #define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85 74 75 76 + /* NCI RF Technologies */ 77 + #define NCI_NFC_RF_TECHNOLOGY_A 0x00 78 + #define NCI_NFC_RF_TECHNOLOGY_B 0x01 79 + #define NCI_NFC_RF_TECHNOLOGY_F 0x02 80 + #define NCI_NFC_RF_TECHNOLOGY_15693 0x03 81 + 82 + /* NCI Bit Rates */ 83 + #define NCI_NFC_BIT_RATE_106 0x00 84 + #define NCI_NFC_BIT_RATE_212 0x01 85 + #define NCI_NFC_BIT_RATE_424 0x02 86 + #define NCI_NFC_BIT_RATE_848 0x03 87 + #define NCI_NFC_BIT_RATE_1696 0x04 88 + #define NCI_NFC_BIT_RATE_3392 0x05 89 + #define NCI_NFC_BIT_RATE_6784 0x06 90 + 75 91 /* NCI RF Protocols */ 76 92 #define NCI_RF_PROTOCOL_UNKNOWN 0x00 77 93 #define NCI_RF_PROTOCOL_T1T 0x01 ··· 96 82 #define NCI_RF_PROTOCOL_NFC_DEP 0x05 97 83 98 84 /* NCI RF Interfaces */ 99 - #define NCI_RF_INTERFACE_RFU 0x00 100 - #define NCI_RF_INTERFACE_FRAME 0x01 101 - #define NCI_RF_INTERFACE_ISO_DEP 0x02 102 - #define NCI_RF_INTERFACE_NFC_DEP 0x03 85 + #define NCI_RF_INTERFACE_NFCEE_DIRECT 0x00 86 + #define NCI_RF_INTERFACE_FRAME 0x01 87 + #define NCI_RF_INTERFACE_ISO_DEP 0x02 88 + #define NCI_RF_INTERFACE_NFC_DEP 0x03 89 + 90 + /* NCI Reset types */ 91 + #define NCI_RESET_TYPE_KEEP_CONFIG 0x00 92 + #define NCI_RESET_TYPE_RESET_CONFIG 0x01 93 + 94 + /* NCI Static RF connection ID */ 95 + #define NCI_STATIC_RF_CONN_ID 0x00 96 + 97 + /* NCI Data Flow Control */ 98 + #define NCI_DATA_FLOW_CONTROL_NOT_USED 0xff 103 99 104 100 /* NCI RF_DISCOVER_MAP_CMD modes */ 105 101 #define NCI_DISC_MAP_MODE_POLL 0x01 ··· 118 94 119 95 /* NCI Discovery Types */ 120 96 #define NCI_DISCOVERY_TYPE_POLL_A_PASSIVE 0x00 121 - #define NCI_DISCOVERY_TYPE_POLL_B_PASSIVE 0x01 122 - #define NCI_DISCOVERY_TYPE_POLL_F_PASSIVE 0x02 123 - #define NCI_DISCOVERY_TYPE_POLL_A_ACTIVE 0x03 124 - #define NCI_DISCOVERY_TYPE_POLL_F_ACTIVE 0x05 125 - #define NCI_DISCOVERY_TYPE_WAKEUP_A_PASSIVE 0x06 126 - #define NCI_DISCOVERY_TYPE_WAKEUP_B_PASSIVE 0x07 127 - #define NCI_DISCOVERY_TYPE_WAKEUP_A_ACTIVE 0x09 128 - #define NCI_DISCOVERY_TYPE_LISTEN_A_PASSIVE 0x80 129 - #define NCI_DISCOVERY_TYPE_LISTEN_B_PASSIVE 0x81 130 - #define NCI_DISCOVERY_TYPE_LISTEN_F_PASSIVE 0x82 131 - #define NCI_DISCOVERY_TYPE_LISTEN_A_ACTIVE 0x83 132 - #define NCI_DISCOVERY_TYPE_LISTEN_F_ACTIVE 0x85 97 + #define NCI_DISCOVERY_TYPE_POLL_B_PASSIVE 0x01 98 + #define NCI_DISCOVERY_TYPE_POLL_F_PASSIVE 0x02 99 + #define NCI_DISCOVERY_TYPE_POLL_A_ACTIVE 0x03 100 + #define NCI_DISCOVERY_TYPE_POLL_F_ACTIVE 0x05 101 + #define NCI_DISCOVERY_TYPE_WAKEUP_A_ACTIVE 0x09 102 + #define NCI_DISCOVERY_TYPE_LISTEN_A_PASSIVE 0x80 103 + #define NCI_DISCOVERY_TYPE_LISTEN_B_PASSIVE 0x81 104 + #define NCI_DISCOVERY_TYPE_LISTEN_F_PASSIVE 0x82 105 + #define NCI_DISCOVERY_TYPE_LISTEN_A_ACTIVE 0x83 106 + #define NCI_DISCOVERY_TYPE_LISTEN_F_ACTIVE 0x85 133 107 134 108 /* NCI Deactivation Type */ 135 - #define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00 136 - #define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01 137 - #define NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE 0x02 138 - #define NCI_DEACTIVATE_TYPE_RF_LINK_LOSS 0x03 139 - #define NCI_DEACTIVATE_TYPE_DISCOVERY_ERROR 0x04 109 + #define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00 110 + #define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01 111 + #define NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE 0x02 112 + #define NCI_DEACTIVATE_TYPE_DISCOVERY 0x03 140 113 141 114 /* Message Type (MT) */ 142 115 #define NCI_MT_DATA_PKT 0x00 ··· 165 144 #define nci_conn_id(hdr) (__u8)(((hdr)[0])&0x0f) 166 145 167 146 /* GID values */ 168 - #define NCI_GID_CORE 0x0 169 - #define NCI_GID_RF_MGMT 0x1 170 - #define NCI_GID_NFCEE_MGMT 0x2 171 - #define NCI_GID_PROPRIETARY 0xf 147 + #define NCI_GID_CORE 0x0 148 + #define NCI_GID_RF_MGMT 0x1 149 + #define NCI_GID_NFCEE_MGMT 0x2 150 + #define NCI_GID_PROPRIETARY 0xf 172 151 173 152 /* ---- NCI Packet structures ---- */ 174 153 #define NCI_CTRL_HDR_SIZE 3 ··· 190 169 /* ----- NCI Commands ---- */ 191 170 /* ------------------------ */ 192 171 #define NCI_OP_CORE_RESET_CMD nci_opcode_pack(NCI_GID_CORE, 0x00) 193 - 194 - #define NCI_OP_CORE_INIT_CMD nci_opcode_pack(NCI_GID_CORE, 0x01) 195 - 196 - #define NCI_OP_CORE_SET_CONFIG_CMD nci_opcode_pack(NCI_GID_CORE, 0x02) 197 - 198 - #define NCI_OP_CORE_CONN_CREATE_CMD nci_opcode_pack(NCI_GID_CORE, 0x04) 199 - struct nci_core_conn_create_cmd { 200 - __u8 target_handle; 201 - __u8 num_target_specific_params; 172 + struct nci_core_reset_cmd { 173 + __u8 reset_type; 202 174 } __packed; 203 175 204 - #define NCI_OP_CORE_CONN_CLOSE_CMD nci_opcode_pack(NCI_GID_CORE, 0x06) 176 + #define NCI_OP_CORE_INIT_CMD nci_opcode_pack(NCI_GID_CORE, 0x01) 205 177 206 178 #define NCI_OP_RF_DISCOVER_MAP_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) 207 179 struct disc_map_config { ··· 232 218 struct nci_core_reset_rsp { 233 219 __u8 status; 234 220 __u8 nci_ver; 221 + __u8 config_status; 235 222 } __packed; 236 223 237 224 #define NCI_OP_CORE_INIT_RSP nci_opcode_pack(NCI_GID_CORE, 0x01) ··· 247 232 struct nci_core_init_rsp_2 { 248 233 __u8 max_logical_connections; 249 234 __le16 max_routing_table_size; 250 - __u8 max_control_packet_payload_length; 251 - __le16 rf_sending_buffer_size; 252 - __le16 rf_receiving_buffer_size; 253 - __le16 manufacturer_id; 254 - } __packed; 255 - 256 - #define NCI_OP_CORE_SET_CONFIG_RSP nci_opcode_pack(NCI_GID_CORE, 0x02) 257 - 258 - #define NCI_OP_CORE_CONN_CREATE_RSP nci_opcode_pack(NCI_GID_CORE, 0x04) 259 - struct nci_core_conn_create_rsp { 260 - __u8 status; 261 - __u8 max_pkt_payload_size; 235 + __u8 max_ctrl_pkt_payload_len; 236 + __le16 max_size_for_large_params; 237 + __u8 max_data_pkt_payload_size; 262 238 __u8 initial_num_credits; 263 - __u8 conn_id; 239 + __u8 manufact_id; 240 + __le32 manufact_specific_info; 264 241 } __packed; 265 - 266 - #define NCI_OP_CORE_CONN_CLOSE_RSP nci_opcode_pack(NCI_GID_CORE, 0x06) 267 242 268 243 #define NCI_OP_RF_DISCOVER_MAP_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) 269 244 ··· 275 270 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN]; 276 271 } __packed; 277 272 278 - #define NCI_OP_RF_FIELD_INFO_NTF nci_opcode_pack(NCI_GID_CORE, 0x08) 279 - struct nci_rf_field_info_ntf { 280 - __u8 rf_field_status; 281 - } __packed; 282 - 283 - #define NCI_OP_RF_ACTIVATE_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05) 273 + #define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05) 284 274 struct rf_tech_specific_params_nfca_poll { 285 275 __u16 sens_res; 286 276 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ ··· 289 289 __u8 rats_res[20]; 290 290 }; 291 291 292 - struct nci_rf_activate_ntf { 293 - __u8 target_handle; 292 + struct nci_rf_intf_activated_ntf { 293 + __u8 rf_discovery_id; 294 + __u8 rf_interface_type; 294 295 __u8 rf_protocol; 295 - __u8 rf_tech_and_mode; 296 + __u8 activation_rf_tech_and_mode; 296 297 __u8 rf_tech_specific_params_len; 297 298 298 299 union { 299 300 struct rf_tech_specific_params_nfca_poll nfca_poll; 300 301 } rf_tech_specific_params; 301 302 302 - __u8 rf_interface_type; 303 + __u8 data_exch_rf_tech_and_mode; 304 + __u8 data_exch_tx_bit_rate; 305 + __u8 data_exch_rx_bit_rate; 303 306 __u8 activation_params_len; 304 307 305 308 union { ··· 312 309 } __packed; 313 310 314 311 #define NCI_OP_RF_DEACTIVATE_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 312 + struct nci_rf_deactivate_ntf { 313 + __u8 type; 314 + __u8 reason; 315 + } __packed; 315 316 316 317 #endif /* __NCI_H */
+5 -8
include/net/nfc/nci_core.h
··· 109 109 [NCI_MAX_SUPPORTED_RF_INTERFACES]; 110 110 __u8 max_logical_connections; 111 111 __u16 max_routing_table_size; 112 - __u8 max_control_packet_payload_length; 113 - __u16 rf_sending_buffer_size; 114 - __u16 rf_receiving_buffer_size; 115 - __u16 manufacturer_id; 116 - 117 - /* received during NCI_OP_CORE_CONN_CREATE_RSP for static conn 0 */ 118 - __u8 max_pkt_payload_size; 112 + __u8 max_ctrl_pkt_payload_len; 113 + __u16 max_size_for_large_params; 114 + __u8 max_data_pkt_payload_size; 119 115 __u8 initial_num_credits; 120 - __u8 conn_id; 116 + __u8 manufact_id; 117 + __u32 manufact_specific_info; 121 118 122 119 /* stored during nci_data_exchange */ 123 120 data_exchange_cb_t data_exchange_cb;
+59 -9
net/mac80211/cfg.c
··· 491 491 (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE); 492 492 } 493 493 494 + static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, 495 + u8 *resp, size_t resp_len) 496 + { 497 + struct sk_buff *new, *old; 498 + 499 + if (!resp || !resp_len) 500 + return -EINVAL; 501 + 502 + old = sdata->u.ap.probe_resp; 503 + 504 + new = dev_alloc_skb(resp_len); 505 + if (!new) 506 + return -ENOMEM; 507 + 508 + memcpy(skb_put(new, resp_len), resp, resp_len); 509 + 510 + rcu_assign_pointer(sdata->u.ap.probe_resp, new); 511 + synchronize_rcu(); 512 + 513 + if (old) 514 + dev_kfree_skb(old); 515 + 516 + return 0; 517 + } 518 + 494 519 /* 495 520 * This handles both adding a beacon and setting new beacon info 496 521 */ ··· 526 501 int new_head_len, new_tail_len; 527 502 int size; 528 503 int err = -EINVAL; 504 + u32 changed = 0; 529 505 530 506 old = rtnl_dereference(sdata->u.ap.beacon); 531 507 ··· 610 584 611 585 kfree(old); 612 586 613 - ieee80211_config_ap_ssid(sdata, params); 587 + err = ieee80211_set_probe_resp(sdata, params->probe_resp, 588 + params->probe_resp_len); 589 + if (!err) 590 + changed |= BSS_CHANGED_AP_PROBE_RESP; 614 591 615 - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED | 616 - BSS_CHANGED_BEACON | 617 - BSS_CHANGED_SSID); 592 + ieee80211_config_ap_ssid(sdata, params); 593 + changed |= BSS_CHANGED_BEACON_ENABLED | 594 + BSS_CHANGED_BEACON | 595 + BSS_CHANGED_SSID; 596 + 597 + ieee80211_bss_info_change_notify(sdata, changed); 618 598 return 0; 619 599 } 620 600 ··· 901 869 902 870 sta_apply_parameters(local, sta, params); 903 871 904 - rate_control_rate_init(sta); 872 + /* 873 + * for TDLS, rate control should be initialized only when supported 874 + * rates are known. 875 + */ 876 + if (!test_sta_flag(sta, WLAN_STA_TDLS_PEER)) 877 + rate_control_rate_init(sta); 905 878 906 879 layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN || 907 880 sdata->vif.type == NL80211_IFTYPE_AP; ··· 989 952 } 990 953 991 954 sta_apply_parameters(local, sta, params); 955 + 956 + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) && params->supported_rates) 957 + rate_control_rate_init(sta); 992 958 993 959 rcu_read_unlock(); 994 960 ··· 2570 2530 2571 2531 rcu_read_lock(); 2572 2532 sta = sta_info_get(sdata, peer); 2573 - if (sta) 2533 + if (sta) { 2574 2534 qos = test_sta_flag(sta, WLAN_STA_WME); 2575 - rcu_read_unlock(); 2576 - 2577 - if (!sta) 2535 + rcu_read_unlock(); 2536 + } else { 2537 + rcu_read_unlock(); 2578 2538 return -ENOLINK; 2539 + } 2579 2540 2580 2541 if (qos) { 2581 2542 fc = cpu_to_le16(IEEE80211_FTYPE_DATA | ··· 2621 2580 2622 2581 *cookie = (unsigned long) skb; 2623 2582 return 0; 2583 + } 2584 + 2585 + static struct ieee80211_channel * 2586 + ieee80211_wiphy_get_channel(struct wiphy *wiphy) 2587 + { 2588 + struct ieee80211_local *local = wiphy_priv(wiphy); 2589 + 2590 + return local->oper_channel; 2624 2591 } 2625 2592 2626 2593 struct cfg80211_ops mac80211_config_ops = { ··· 2697 2648 .tdls_oper = ieee80211_tdls_oper, 2698 2649 .tdls_mgmt = ieee80211_tdls_mgmt, 2699 2650 .probe_client = ieee80211_probe_client, 2651 + .get_channel = ieee80211_wiphy_get_channel, 2700 2652 };
+3
net/mac80211/ibss.c
··· 97 97 /* if merging, indicate to driver that we leave the old IBSS */ 98 98 if (sdata->vif.bss_conf.ibss_joined) { 99 99 sdata->vif.bss_conf.ibss_joined = false; 100 + netif_carrier_off(sdata->dev); 100 101 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IBSS); 101 102 } 102 103 ··· 208 207 bss = cfg80211_inform_bss_frame(local->hw.wiphy, local->hw.conf.channel, 209 208 mgmt, skb->len, 0, GFP_KERNEL); 210 209 cfg80211_put_bss(bss); 210 + netif_carrier_on(sdata->dev); 211 211 cfg80211_ibss_joined(sdata->dev, ifibss->bssid, GFP_KERNEL); 212 212 } 213 213 ··· 992 990 } 993 991 994 992 sta_info_flush(sdata->local, sdata); 993 + netif_carrier_off(sdata->dev); 995 994 996 995 /* remove beacon */ 997 996 kfree(sdata->u.ibss.ie);
+6 -6
net/mac80211/ieee80211_i.h
··· 232 232 233 233 struct ieee80211_if_ap { 234 234 struct beacon_data __rcu *beacon; 235 + struct sk_buff __rcu *probe_resp; 235 236 236 237 struct list_head vlans; 237 238 ··· 729 728 * operating channel 730 729 * @SCAN_SET_CHANNEL: Set the next channel to be scanned 731 730 * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses 732 - * @SCAN_LEAVE_OPER_CHANNEL: Leave the operating channel, notify the AP 733 - * about us leaving the channel and stop all associated STA interfaces 734 - * @SCAN_ENTER_OPER_CHANNEL: Enter the operating channel again, notify the 735 - * AP about us being back and restart all associated STA interfaces 731 + * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to 732 + * send out data 733 + * @SCAN_RESUME: Resume the scan and scan the next channel 736 734 */ 737 735 enum mac80211_scan_state { 738 736 SCAN_DECISION, 739 737 SCAN_SET_CHANNEL, 740 738 SCAN_SEND_PROBE, 741 - SCAN_LEAVE_OPER_CHANNEL, 742 - SCAN_ENTER_OPER_CHANNEL, 739 + SCAN_SUSPEND, 740 + SCAN_RESUME, 743 741 }; 744 742 745 743 struct ieee80211_local {
+7 -2
net/mac80211/iface.c
··· 293 293 changed |= ieee80211_reset_erp_info(sdata); 294 294 ieee80211_bss_info_change_notify(sdata, changed); 295 295 296 - if (sdata->vif.type == NL80211_IFTYPE_STATION) 296 + if (sdata->vif.type == NL80211_IFTYPE_STATION || 297 + sdata->vif.type == NL80211_IFTYPE_ADHOC) 297 298 netif_carrier_off(dev); 298 299 else 299 300 netif_carrier_on(dev); ··· 462 461 struct ieee80211_sub_if_data *vlan, *tmpsdata; 463 462 struct beacon_data *old_beacon = 464 463 rtnl_dereference(sdata->u.ap.beacon); 464 + struct sk_buff *old_probe_resp = 465 + rtnl_dereference(sdata->u.ap.probe_resp); 465 466 466 467 /* sdata_running will return false, so this will disable */ 467 468 ieee80211_bss_info_change_notify(sdata, 468 469 BSS_CHANGED_BEACON_ENABLED); 469 470 470 - /* remove beacon */ 471 + /* remove beacon and probe response */ 471 472 RCU_INIT_POINTER(sdata->u.ap.beacon, NULL); 473 + RCU_INIT_POINTER(sdata->u.ap.probe_resp, NULL); 472 474 synchronize_rcu(); 473 475 kfree(old_beacon); 476 + kfree_skb(old_probe_resp); 474 477 475 478 /* down all dependent devices, that is VLANs */ 476 479 list_for_each_entry_safe(vlan, tmpsdata, &sdata->u.ap.vlans,
+1
net/mac80211/mesh_hwmp.c
··· 871 871 if (mpath->flags & MESH_PATH_REQ_QUEUED) { 872 872 spin_unlock_bh(&mpath->state_lock); 873 873 spin_unlock_bh(&ifmsh->mesh_preq_queue_lock); 874 + kfree(preq_node); 874 875 return; 875 876 } 876 877
+9 -6
net/mac80211/mlme.c
··· 1357 1357 ieee80211_set_disassoc(sdata, true, true); 1358 1358 mutex_unlock(&ifmgd->mtx); 1359 1359 1360 - mutex_lock(&local->mtx); 1361 - ieee80211_recalc_idle(local); 1362 - mutex_unlock(&local->mtx); 1363 1360 /* 1364 1361 * must be outside lock due to cfg80211, 1365 1362 * but that's not a problem. ··· 1365 1368 IEEE80211_STYPE_DEAUTH, 1366 1369 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, 1367 1370 NULL, true); 1371 + 1372 + mutex_lock(&local->mtx); 1373 + ieee80211_recalc_idle(local); 1374 + mutex_unlock(&local->mtx); 1368 1375 } 1369 1376 1370 1377 void ieee80211_beacon_connection_loss_work(struct work_struct *work) ··· 2135 2134 2136 2135 ieee80211_set_disassoc(sdata, true, true); 2137 2136 mutex_unlock(&ifmgd->mtx); 2138 - mutex_lock(&local->mtx); 2139 - ieee80211_recalc_idle(local); 2140 - mutex_unlock(&local->mtx); 2141 2137 /* 2142 2138 * must be outside lock due to cfg80211, 2143 2139 * but that's not a problem. ··· 2142 2144 ieee80211_send_deauth_disassoc(sdata, bssid, 2143 2145 IEEE80211_STYPE_DEAUTH, reason, 2144 2146 NULL, true); 2147 + 2148 + mutex_lock(&local->mtx); 2149 + ieee80211_recalc_idle(local); 2150 + mutex_unlock(&local->mtx); 2151 + 2145 2152 mutex_lock(&ifmgd->mtx); 2146 2153 } 2147 2154
+2 -2
net/mac80211/offchannel.c
··· 211 211 return; 212 212 } 213 213 214 - ieee80211_recalc_idle(local); 215 - 216 214 if (local->hw_roc_skb) { 217 215 sdata = IEEE80211_DEV_TO_SUB_IF(local->hw_roc_dev); 218 216 ieee80211_tx_skb(sdata, local->hw_roc_skb); ··· 223 225 local->hw_roc_duration, 224 226 GFP_KERNEL); 225 227 } 228 + 229 + ieee80211_recalc_idle(local); 226 230 227 231 mutex_unlock(&local->mtx); 228 232 }
+3 -4
net/mac80211/rc80211_minstrel.c
··· 334 334 335 335 336 336 static void 337 - calc_rate_durations(struct minstrel_sta_info *mi, struct ieee80211_local *local, 338 - struct minstrel_rate *d, struct ieee80211_rate *rate) 337 + calc_rate_durations(struct ieee80211_local *local, struct minstrel_rate *d, 338 + struct ieee80211_rate *rate) 339 339 { 340 340 int erp = !!(rate->flags & IEEE80211_RATE_ERP_G); 341 341 ··· 402 402 403 403 mr->rix = i; 404 404 mr->bitrate = sband->bitrates[i].bitrate / 5; 405 - calc_rate_durations(mi, local, mr, 406 - &sband->bitrates[i]); 405 + calc_rate_durations(local, mr, &sband->bitrates[i]); 407 406 408 407 /* calculate maximum number of retransmissions before 409 408 * fallback (based on maximum segment size) */
+30 -32
net/mac80211/rc80211_minstrel_ht.c
··· 36 36 /* Transmit duration for the raw data part of an average sized packet */ 37 37 #define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps))) 38 38 39 + /* 40 + * Define group sort order: HT40 -> SGI -> #streams 41 + */ 42 + #define GROUP_IDX(_streams, _sgi, _ht40) \ 43 + MINSTREL_MAX_STREAMS * 2 * _ht40 + \ 44 + MINSTREL_MAX_STREAMS * _sgi + \ 45 + _streams - 1 46 + 39 47 /* MCS rate information for an MCS group */ 40 - #define MCS_GROUP(_streams, _sgi, _ht40) { \ 48 + #define MCS_GROUP(_streams, _sgi, _ht40) \ 49 + [GROUP_IDX(_streams, _sgi, _ht40)] = { \ 41 50 .streams = _streams, \ 42 51 .flags = \ 43 52 (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ ··· 67 58 * To enable sufficiently targeted rate sampling, MCS rates are divided into 68 59 * groups, based on the number of streams and flags (HT40, SGI) that they 69 60 * use. 61 + * 62 + * Sortorder has to be fixed for GROUP_IDX macro to be applicable: 63 + * HT40 -> SGI -> #streams 70 64 */ 71 65 const struct mcs_group minstrel_mcs_groups[] = { 72 66 MCS_GROUP(1, 0, 0), ··· 114 102 static int 115 103 minstrel_ht_get_group_idx(struct ieee80211_tx_rate *rate) 116 104 { 117 - int streams = (rate->idx / MCS_GROUP_RATES) + 1; 118 - u32 flags = IEEE80211_TX_RC_SHORT_GI | IEEE80211_TX_RC_40_MHZ_WIDTH; 119 - int i; 120 - 121 - for (i = 0; i < ARRAY_SIZE(minstrel_mcs_groups); i++) { 122 - if (minstrel_mcs_groups[i].streams != streams) 123 - continue; 124 - if (minstrel_mcs_groups[i].flags != (rate->flags & flags)) 125 - continue; 126 - 127 - return i; 128 - } 129 - 130 - WARN_ON(1); 131 - return 0; 105 + return GROUP_IDX((rate->idx / MCS_GROUP_RATES) + 1, 106 + !!(rate->flags & IEEE80211_TX_RC_SHORT_GI), 107 + !!(rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)); 132 108 } 133 109 134 110 static inline struct minstrel_rate_stats * ··· 130 130 * Recalculate success probabilities and counters for a rate using EWMA 131 131 */ 132 132 static void 133 - minstrel_calc_rate_ewma(struct minstrel_priv *mp, struct minstrel_rate_stats *mr) 133 + minstrel_calc_rate_ewma(struct minstrel_rate_stats *mr) 134 134 { 135 135 if (unlikely(mr->attempts > 0)) { 136 136 mr->sample_skipped = 0; ··· 156 156 * the expected number of retransmissions and their expected length 157 157 */ 158 158 static void 159 - minstrel_ht_calc_tp(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, 160 - int group, int rate) 159 + minstrel_ht_calc_tp(struct minstrel_ht_sta *mi, int group, int rate) 161 160 { 162 161 struct minstrel_rate_stats *mr; 163 162 unsigned int usecs; ··· 225 226 mr = &mg->rates[i]; 226 227 mr->retry_updated = false; 227 228 index = MCS_GROUP_RATES * group + i; 228 - minstrel_calc_rate_ewma(mp, mr); 229 - minstrel_ht_calc_tp(mp, mi, group, i); 229 + minstrel_calc_rate_ewma(mr); 230 + minstrel_ht_calc_tp(mi, group, i); 230 231 231 232 if (!mr->cur_tp) 232 233 continue; ··· 299 300 static bool 300 301 minstrel_ht_txstat_valid(struct ieee80211_tx_rate *rate) 301 302 { 302 - if (!rate->count) 303 + if (rate->idx < 0) 303 304 return false; 304 305 305 - if (rate->idx < 0) 306 + if (!rate->count) 306 307 return false; 307 308 308 309 return !!(rate->flags & IEEE80211_TX_RC_MCS); ··· 356 357 } 357 358 358 359 static void 359 - minstrel_aggr_check(struct minstrel_priv *mp, struct ieee80211_sta *pubsta, struct sk_buff *skb) 360 + minstrel_aggr_check(struct ieee80211_sta *pubsta, struct sk_buff *skb) 360 361 { 361 362 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 362 363 struct sta_info *sta = container_of(pubsta, struct sta_info, sta); ··· 454 455 if (time_after(jiffies, mi->stats_update + (mp->update_interval / 2 * HZ) / 1000)) { 455 456 minstrel_ht_update_stats(mp, mi); 456 457 if (!(info->flags & IEEE80211_TX_CTL_AMPDU)) 457 - minstrel_aggr_check(mp, sta, skb); 458 + minstrel_aggr_check(sta, skb); 458 459 } 459 460 } 460 461 ··· 514 515 static void 515 516 minstrel_ht_set_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, 516 517 struct ieee80211_tx_rate *rate, int index, 517 - struct ieee80211_tx_rate_control *txrc, 518 518 bool sample, bool rtscts) 519 519 { 520 520 const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; ··· 626 628 if (sample_idx >= 0) { 627 629 sample = true; 628 630 minstrel_ht_set_rate(mp, mi, &ar[0], sample_idx, 629 - txrc, true, false); 631 + true, false); 630 632 info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; 631 633 } else { 632 634 minstrel_ht_set_rate(mp, mi, &ar[0], mi->max_tp_rate, 633 - txrc, false, false); 635 + false, false); 634 636 } 635 637 636 638 if (mp->hw->max_rates >= 3) { ··· 641 643 */ 642 644 if (sample_idx >= 0) 643 645 minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate, 644 - txrc, false, false); 646 + false, false); 645 647 else 646 648 minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate2, 647 - txrc, false, true); 649 + false, true); 648 650 649 651 minstrel_ht_set_rate(mp, mi, &ar[2], mi->max_prob_rate, 650 - txrc, false, !sample); 652 + false, !sample); 651 653 652 654 ar[3].count = 0; 653 655 ar[3].idx = -1; ··· 658 660 * max_tp_rate -> max_prob_rate by default. 659 661 */ 660 662 minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_prob_rate, 661 - txrc, false, !sample); 663 + false, !sample); 662 664 663 665 ar[2].count = 0; 664 666 ar[2].idx = -1;
+78 -123
net/mac80211/scan.c
··· 212 212 if (bss) 213 213 ieee80211_rx_bss_put(sdata->local, bss); 214 214 215 - /* If we are on-operating-channel, and this packet is for the 216 - * current channel, pass the pkt on up the stack so that 217 - * the rest of the stack can make use of it. 218 - */ 219 - if (ieee80211_cfg_on_oper_channel(sdata->local) 220 - && (channel == sdata->local->oper_channel)) 215 + if (channel == sdata->local->oper_channel) 221 216 return RX_CONTINUE; 222 217 223 218 dev_kfree_skb(skb); ··· 258 263 bool was_hw_scan) 259 264 { 260 265 struct ieee80211_local *local = hw_to_local(hw); 261 - bool on_oper_chan; 262 - bool enable_beacons = false; 263 266 264 267 lockdep_assert_held(&local->mtx); 265 268 ··· 290 297 local->scanning = 0; 291 298 local->scan_channel = NULL; 292 299 293 - on_oper_chan = ieee80211_cfg_on_oper_channel(local); 294 - 295 - if (was_hw_scan || !on_oper_chan) 296 - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); 297 - else 298 - /* Set power back to normal operating levels. */ 299 - ieee80211_hw_config(local, 0); 300 + /* Set power back to normal operating levels. */ 301 + ieee80211_hw_config(local, 0); 300 302 301 303 if (!was_hw_scan) { 302 - bool on_oper_chan2; 303 304 ieee80211_configure_filter(local); 304 305 drv_sw_scan_complete(local); 305 - on_oper_chan2 = ieee80211_cfg_on_oper_channel(local); 306 - /* We should always be on-channel at this point. */ 307 - WARN_ON(!on_oper_chan2); 308 - if (on_oper_chan2 && (on_oper_chan != on_oper_chan2)) 309 - enable_beacons = true; 310 - 311 - ieee80211_offchannel_return(local, enable_beacons, true); 306 + ieee80211_offchannel_return(local, true, true); 312 307 } 313 308 314 309 ieee80211_recalc_idle(local); ··· 341 360 local->next_scan_state = SCAN_DECISION; 342 361 local->scan_channel_idx = 0; 343 362 344 - /* We always want to use off-channel PS, even if we 345 - * are not really leaving oper-channel. Don't 346 - * tell the AP though, as long as we are on-channel. 347 - */ 348 - ieee80211_offchannel_enable_all_ps(local, false); 363 + ieee80211_offchannel_stop_vifs(local, true); 349 364 350 365 ieee80211_configure_filter(local); 351 366 ··· 349 372 ieee80211_hw_config(local, 0); 350 373 351 374 ieee80211_queue_delayed_work(&local->hw, 352 - &local->scan_work, 353 - IEEE80211_CHANNEL_TIME); 375 + &local->scan_work, 0); 354 376 355 377 return 0; 356 378 } ··· 485 509 486 510 next_chan = local->scan_req->channels[local->scan_channel_idx]; 487 511 488 - if (ieee80211_cfg_on_oper_channel(local)) { 489 - /* We're currently on operating channel. */ 490 - if (next_chan == local->oper_channel) 491 - /* We don't need to move off of operating channel. */ 492 - local->next_scan_state = SCAN_SET_CHANNEL; 493 - else 494 - /* 495 - * We do need to leave operating channel, as next 496 - * scan is somewhere else. 497 - */ 498 - local->next_scan_state = SCAN_LEAVE_OPER_CHANNEL; 499 - } else { 500 - /* 501 - * we're currently scanning a different channel, let's 502 - * see if we can scan another channel without interfering 503 - * with the current traffic situation. 504 - * 505 - * Since we don't know if the AP has pending frames for us 506 - * we can only check for our tx queues and use the current 507 - * pm_qos requirements for rx. Hence, if no tx traffic occurs 508 - * at all we will scan as many channels in a row as the pm_qos 509 - * latency allows us to. Additionally we also check for the 510 - * currently negotiated listen interval to prevent losing 511 - * frames unnecessarily. 512 - * 513 - * Otherwise switch back to the operating channel. 514 - */ 512 + /* 513 + * we're currently scanning a different channel, let's 514 + * see if we can scan another channel without interfering 515 + * with the current traffic situation. 516 + * 517 + * Since we don't know if the AP has pending frames for us 518 + * we can only check for our tx queues and use the current 519 + * pm_qos requirements for rx. Hence, if no tx traffic occurs 520 + * at all we will scan as many channels in a row as the pm_qos 521 + * latency allows us to. Additionally we also check for the 522 + * currently negotiated listen interval to prevent losing 523 + * frames unnecessarily. 524 + * 525 + * Otherwise switch back to the operating channel. 526 + */ 515 527 516 - bad_latency = time_after(jiffies + 517 - ieee80211_scan_get_channel_time(next_chan), 518 - local->leave_oper_channel_time + 519 - usecs_to_jiffies(pm_qos_request(PM_QOS_NETWORK_LATENCY))); 528 + bad_latency = time_after(jiffies + 529 + ieee80211_scan_get_channel_time(next_chan), 530 + local->leave_oper_channel_time + 531 + usecs_to_jiffies(pm_qos_request(PM_QOS_NETWORK_LATENCY))); 520 532 521 - listen_int_exceeded = time_after(jiffies + 522 - ieee80211_scan_get_channel_time(next_chan), 523 - local->leave_oper_channel_time + 524 - usecs_to_jiffies(min_beacon_int * 1024) * 525 - local->hw.conf.listen_interval); 533 + listen_int_exceeded = time_after(jiffies + 534 + ieee80211_scan_get_channel_time(next_chan), 535 + local->leave_oper_channel_time + 536 + usecs_to_jiffies(min_beacon_int * 1024) * 537 + local->hw.conf.listen_interval); 526 538 527 - if (associated && ( !tx_empty || bad_latency || 528 - listen_int_exceeded)) 529 - local->next_scan_state = SCAN_ENTER_OPER_CHANNEL; 530 - else 531 - local->next_scan_state = SCAN_SET_CHANNEL; 532 - } 539 + if (associated && (!tx_empty || bad_latency || listen_int_exceeded)) 540 + local->next_scan_state = SCAN_SUSPEND; 541 + else 542 + local->next_scan_state = SCAN_SET_CHANNEL; 533 543 534 544 *next_delay = 0; 535 - } 536 - 537 - static void ieee80211_scan_state_leave_oper_channel(struct ieee80211_local *local, 538 - unsigned long *next_delay) 539 - { 540 - /* PS will already be in off-channel mode, 541 - * we do that once at the beginning of scanning. 542 - */ 543 - ieee80211_offchannel_stop_vifs(local, false); 544 - 545 - /* 546 - * What if the nullfunc frames didn't arrive? 547 - */ 548 - drv_flush(local, false); 549 - if (local->ops->flush) 550 - *next_delay = 0; 551 - else 552 - *next_delay = HZ / 10; 553 - 554 - /* remember when we left the operating channel */ 555 - local->leave_oper_channel_time = jiffies; 556 - 557 - /* advance to the next channel to be scanned */ 558 - local->next_scan_state = SCAN_SET_CHANNEL; 559 - } 560 - 561 - static void ieee80211_scan_state_enter_oper_channel(struct ieee80211_local *local, 562 - unsigned long *next_delay) 563 - { 564 - /* switch back to the operating channel */ 565 - local->scan_channel = NULL; 566 - if (!ieee80211_cfg_on_oper_channel(local)) 567 - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); 568 - 569 - /* 570 - * Re-enable vifs and beaconing. Leave PS 571 - * in off-channel state..will put that back 572 - * on-channel at the end of scanning. 573 - */ 574 - ieee80211_offchannel_return(local, true, false); 575 - 576 - *next_delay = HZ / 5; 577 - local->next_scan_state = SCAN_DECISION; 578 545 } 579 546 580 547 static void ieee80211_scan_state_set_channel(struct ieee80211_local *local, ··· 531 612 532 613 local->scan_channel = chan; 533 614 534 - /* Only call hw-config if we really need to change channels. */ 535 - if (chan != local->hw.conf.channel) 536 - if (ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL)) 537 - skip = 1; 615 + if (ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL)) 616 + skip = 1; 538 617 539 618 /* advance state machine to next channel/band */ 540 619 local->scan_channel_idx++; ··· 586 669 * on the channel. 587 670 */ 588 671 *next_delay = IEEE80211_CHANNEL_TIME; 672 + local->next_scan_state = SCAN_DECISION; 673 + } 674 + 675 + static void ieee80211_scan_state_suspend(struct ieee80211_local *local, 676 + unsigned long *next_delay) 677 + { 678 + /* switch back to the operating channel */ 679 + local->scan_channel = NULL; 680 + ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); 681 + 682 + /* 683 + * Re-enable vifs and beaconing. Leave PS 684 + * in off-channel state..will put that back 685 + * on-channel at the end of scanning. 686 + */ 687 + ieee80211_offchannel_return(local, true, false); 688 + 689 + *next_delay = HZ / 5; 690 + /* afterwards, resume scan & go to next channel */ 691 + local->next_scan_state = SCAN_RESUME; 692 + } 693 + 694 + static void ieee80211_scan_state_resume(struct ieee80211_local *local, 695 + unsigned long *next_delay) 696 + { 697 + /* PS already is in off-channel mode */ 698 + ieee80211_offchannel_stop_vifs(local, false); 699 + 700 + if (local->ops->flush) { 701 + drv_flush(local, false); 702 + *next_delay = 0; 703 + } else 704 + *next_delay = HZ / 10; 705 + 706 + /* remember when we left the operating channel */ 707 + local->leave_oper_channel_time = jiffies; 708 + 709 + /* advance to the next channel to be scanned */ 589 710 local->next_scan_state = SCAN_DECISION; 590 711 } 591 712 ··· 697 742 case SCAN_SEND_PROBE: 698 743 ieee80211_scan_state_send_probe(local, &next_delay); 699 744 break; 700 - case SCAN_LEAVE_OPER_CHANNEL: 701 - ieee80211_scan_state_leave_oper_channel(local, &next_delay); 745 + case SCAN_SUSPEND: 746 + ieee80211_scan_state_suspend(local, &next_delay); 702 747 break; 703 - case SCAN_ENTER_OPER_CHANNEL: 704 - ieee80211_scan_state_enter_oper_channel(local, &next_delay); 748 + case SCAN_RESUME: 749 + ieee80211_scan_state_resume(local, &next_delay); 705 750 break; 706 751 } 707 752 } while (next_delay == 0);
+31 -2
net/mac80211/tx.c
··· 571 571 switch (tx->key->conf.cipher) { 572 572 case WLAN_CIPHER_SUITE_WEP40: 573 573 case WLAN_CIPHER_SUITE_WEP104: 574 - if (ieee80211_is_auth(hdr->frame_control)) 575 - break; 576 574 case WLAN_CIPHER_SUITE_TKIP: 577 575 if (!ieee80211_is_data_present(hdr->frame_control)) 578 576 tx->key = NULL; ··· 2412 2414 return skb; 2413 2415 } 2414 2416 EXPORT_SYMBOL(ieee80211_beacon_get_tim); 2417 + 2418 + struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw, 2419 + struct ieee80211_vif *vif) 2420 + { 2421 + struct ieee80211_if_ap *ap = NULL; 2422 + struct sk_buff *presp = NULL, *skb = NULL; 2423 + struct ieee80211_hdr *hdr; 2424 + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 2425 + 2426 + if (sdata->vif.type != NL80211_IFTYPE_AP) 2427 + return NULL; 2428 + 2429 + rcu_read_lock(); 2430 + 2431 + ap = &sdata->u.ap; 2432 + presp = rcu_dereference(ap->probe_resp); 2433 + if (!presp) 2434 + goto out; 2435 + 2436 + skb = skb_copy(presp, GFP_ATOMIC); 2437 + if (!skb) 2438 + goto out; 2439 + 2440 + hdr = (struct ieee80211_hdr *) skb->data; 2441 + memset(hdr->addr1, 0, sizeof(hdr->addr1)); 2442 + 2443 + out: 2444 + rcu_read_unlock(); 2445 + return skb; 2446 + } 2447 + EXPORT_SYMBOL(ieee80211_proberesp_get); 2415 2448 2416 2449 struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw, 2417 2450 struct ieee80211_vif *vif)
+4 -1
net/mac80211/util.c
··· 1071 1071 changed |= BSS_CHANGED_IBSS; 1072 1072 /* fall through */ 1073 1073 case NL80211_IFTYPE_AP: 1074 - changed |= BSS_CHANGED_SSID; 1074 + changed |= BSS_CHANGED_SSID | 1075 + BSS_CHANGED_AP_PROBE_RESP; 1075 1076 /* fall through */ 1076 1077 case NL80211_IFTYPE_MESH_POINT: 1077 1078 changed |= BSS_CHANGED_BEACON | ··· 1093 1092 break; 1094 1093 } 1095 1094 } 1095 + 1096 + ieee80211_recalc_ps(local, -1); 1096 1097 1097 1098 /* 1098 1099 * Clear the WLAN_STA_BLOCK_BA flag so new aggregation
+2 -1
net/mac80211/wpa.c
··· 415 415 memmove(pos, pos + CCMP_HDR_LEN, hdrlen); 416 416 417 417 /* the HW only needs room for the IV, but not the actual IV */ 418 - if (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) 418 + if (info->control.hw_key && 419 + (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) 419 420 return 0; 420 421 421 422 hdr = (struct ieee80211_hdr *) pos;
+9 -9
net/nfc/nci/core.c
··· 125 125 126 126 static void nci_reset_req(struct nci_dev *ndev, unsigned long opt) 127 127 { 128 - nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 0, NULL); 128 + struct nci_core_reset_cmd cmd; 129 + 130 + cmd.reset_type = NCI_RESET_TYPE_RESET_CONFIG; 131 + nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 1, &cmd); 129 132 } 130 133 131 134 static void nci_init_req(struct nci_dev *ndev, unsigned long opt) ··· 138 135 139 136 static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt) 140 137 { 141 - struct nci_core_conn_create_cmd conn_cmd; 142 138 struct nci_rf_disc_map_cmd cmd; 143 139 struct disc_map_config *cfg = cmd.mapping_configs; 144 140 __u8 *num = &cmd.num_mapping_configs; 145 141 int i; 146 - 147 - /* create static rf connection */ 148 - conn_cmd.target_handle = 0; 149 - conn_cmd.num_target_specific_params = 0; 150 - nci_send_cmd(ndev, NCI_OP_CORE_CONN_CREATE_CMD, 2, &conn_cmd); 151 142 152 143 /* set rf mapping configurations */ 153 144 *num = 0; ··· 466 469 ndev->data_exchange_cb = cb; 467 470 ndev->data_exchange_cb_context = cb_context; 468 471 469 - rc = nci_send_data(ndev, ndev->conn_id, skb); 472 + rc = nci_send_data(ndev, NCI_STATIC_RF_CONN_ID, skb); 470 473 if (rc) 471 474 clear_bit(NCI_DATA_EXCHANGE, &ndev->flags); 472 475 ··· 722 725 if (!skb) 723 726 return; 724 727 725 - atomic_dec(&ndev->credits_cnt); 728 + /* Check if data flow control is used */ 729 + if (atomic_read(&ndev->credits_cnt) != 730 + NCI_DATA_FLOW_CONTROL_NOT_USED) 731 + atomic_dec(&ndev->credits_cnt); 726 732 727 733 nfc_dbg("NCI TX: MT=data, PBF=%d, conn_id=%d, plen=%d", 728 734 nci_pbf(skb->data),
+3 -2
net/nfc/nci/data.c
··· 95 95 __skb_queue_head_init(&frags_q); 96 96 97 97 while (total_len) { 98 - frag_len = min_t(int, total_len, ndev->max_pkt_payload_size); 98 + frag_len = 99 + min_t(int, total_len, ndev->max_data_pkt_payload_size); 99 100 100 101 skb_frag = nci_skb_alloc(ndev, 101 102 (NCI_DATA_HDR_SIZE + frag_len), ··· 152 151 nfc_dbg("entry, conn_id 0x%x, plen %d", conn_id, skb->len); 153 152 154 153 /* check if the packet need to be fragmented */ 155 - if (skb->len <= ndev->max_pkt_payload_size) { 154 + if (skb->len <= ndev->max_data_pkt_payload_size) { 156 155 /* no need to fragment packet */ 157 156 nci_push_data_hdr(ndev, conn_id, skb, NCI_PBF_LAST); 158 157
+1 -7
net/nfc/nci/lib.c
··· 42 42 case NCI_STATUS_REJECTED: 43 43 return -EBUSY; 44 44 45 - case NCI_STATUS_MESSAGE_CORRUPTED: 45 + case NCI_STATUS_RF_FRAME_CORRUPTED: 46 46 return -EBADMSG; 47 - 48 - case NCI_STATUS_BUFFER_FULL: 49 - return -ENOBUFS; 50 47 51 48 case NCI_STATUS_NOT_INITIALIZED: 52 49 return -EHOSTDOWN; ··· 76 79 case NCI_STATUS_RF_TIMEOUT_ERROR: 77 80 case NCI_STATUS_NFCEE_TIMEOUT_ERROR: 78 81 return -ETIMEDOUT; 79 - 80 - case NCI_STATUS_RF_LINK_LOSS_ERROR: 81 - return -ENOLINK; 82 82 83 83 case NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED: 84 84 return -EDQUOT;
+89 -61
net/nfc/nci/ntf.c
··· 54 54 ntf->conn_entries[i].conn_id, 55 55 ntf->conn_entries[i].credits); 56 56 57 - if (ntf->conn_entries[i].conn_id == ndev->conn_id) { 57 + if (ntf->conn_entries[i].conn_id == NCI_STATIC_RF_CONN_ID) { 58 58 /* found static rf connection */ 59 59 atomic_add(ntf->conn_entries[i].credits, 60 60 &ndev->credits_cnt); ··· 66 66 queue_work(ndev->tx_wq, &ndev->tx_work); 67 67 } 68 68 69 - static void nci_rf_field_info_ntf_packet(struct nci_dev *ndev, 70 - struct sk_buff *skb) 71 - { 72 - struct nci_rf_field_info_ntf *ntf = (void *) skb->data; 73 - 74 - nfc_dbg("entry, rf_field_status %d", ntf->rf_field_status); 75 - } 76 - 77 - static int nci_rf_activate_nfca_passive_poll(struct nci_dev *ndev, 78 - struct nci_rf_activate_ntf *ntf, __u8 *data) 69 + static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev, 70 + struct nci_rf_intf_activated_ntf *ntf, __u8 *data) 79 71 { 80 72 struct rf_tech_specific_params_nfca_poll *nfca_poll; 81 - struct activation_params_nfca_poll_iso_dep *nfca_poll_iso_dep; 82 73 83 74 nfca_poll = &ntf->rf_tech_specific_params.nfca_poll; 84 - nfca_poll_iso_dep = &ntf->activation_params.nfca_poll_iso_dep; 85 75 86 76 nfca_poll->sens_res = __le16_to_cpu(*((__u16 *)data)); 87 77 data += 2; ··· 90 100 if (nfca_poll->sel_res_len != 0) 91 101 nfca_poll->sel_res = *data++; 92 102 93 - ntf->rf_interface_type = *data++; 94 - ntf->activation_params_len = *data++; 95 - 96 - nfc_dbg("sel_res_len %d, sel_res 0x%x, rf_interface_type %d, activation_params_len %d", 103 + nfc_dbg("sel_res_len %d, sel_res 0x%x", 97 104 nfca_poll->sel_res_len, 98 - nfca_poll->sel_res, 99 - ntf->rf_interface_type, 100 - ntf->activation_params_len); 105 + nfca_poll->sel_res); 101 106 102 - switch (ntf->rf_interface_type) { 103 - case NCI_RF_INTERFACE_ISO_DEP: 104 - nfca_poll_iso_dep->rats_res_len = *data++; 105 - if (nfca_poll_iso_dep->rats_res_len > 0) { 106 - memcpy(nfca_poll_iso_dep->rats_res, 107 + return data; 108 + } 109 + 110 + static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev, 111 + struct nci_rf_intf_activated_ntf *ntf, __u8 *data) 112 + { 113 + struct activation_params_nfca_poll_iso_dep *nfca_poll; 114 + 115 + switch (ntf->activation_rf_tech_and_mode) { 116 + case NCI_NFC_A_PASSIVE_POLL_MODE: 117 + nfca_poll = &ntf->activation_params.nfca_poll_iso_dep; 118 + nfca_poll->rats_res_len = *data++; 119 + if (nfca_poll->rats_res_len > 0) { 120 + memcpy(nfca_poll->rats_res, 107 121 data, 108 - nfca_poll_iso_dep->rats_res_len); 122 + nfca_poll->rats_res_len); 109 123 } 110 124 break; 111 125 112 - case NCI_RF_INTERFACE_FRAME: 113 - /* no activation params */ 114 - break; 115 - 116 126 default: 117 - nfc_err("unsupported rf_interface_type 0x%x", 118 - ntf->rf_interface_type); 127 + nfc_err("unsupported activation_rf_tech_and_mode 0x%x", 128 + ntf->activation_rf_tech_and_mode); 119 129 return -EPROTO; 120 130 } 121 131 ··· 123 133 } 124 134 125 135 static void nci_target_found(struct nci_dev *ndev, 126 - struct nci_rf_activate_ntf *ntf) 136 + struct nci_rf_intf_activated_ntf *ntf) 127 137 { 128 138 struct nfc_target nfc_tgt; 129 139 ··· 131 141 nfc_tgt.supported_protocols = NFC_PROTO_MIFARE_MASK; 132 142 else if (ntf->rf_protocol == NCI_RF_PROTOCOL_ISO_DEP) /* 4A */ 133 143 nfc_tgt.supported_protocols = NFC_PROTO_ISO14443_MASK; 144 + else 145 + nfc_tgt.supported_protocols = 0; 134 146 135 147 nfc_tgt.sens_res = ntf->rf_tech_specific_params.nfca_poll.sens_res; 136 148 nfc_tgt.sel_res = ntf->rf_tech_specific_params.nfca_poll.sel_res; ··· 150 158 nfc_targets_found(ndev->nfc_dev, &nfc_tgt, 1); 151 159 } 152 160 153 - static void nci_rf_activate_ntf_packet(struct nci_dev *ndev, 154 - struct sk_buff *skb) 161 + static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev, 162 + struct sk_buff *skb) 155 163 { 156 - struct nci_rf_activate_ntf ntf; 164 + struct nci_rf_intf_activated_ntf ntf; 157 165 __u8 *data = skb->data; 158 - int rc = -1; 166 + int err = 0; 159 167 160 168 clear_bit(NCI_DISCOVERY, &ndev->flags); 161 169 set_bit(NCI_POLL_ACTIVE, &ndev->flags); 162 170 163 - ntf.target_handle = *data++; 171 + ntf.rf_discovery_id = *data++; 172 + ntf.rf_interface_type = *data++; 164 173 ntf.rf_protocol = *data++; 165 - ntf.rf_tech_and_mode = *data++; 174 + ntf.activation_rf_tech_and_mode = *data++; 166 175 ntf.rf_tech_specific_params_len = *data++; 167 176 168 - nfc_dbg("target_handle %d, rf_protocol 0x%x, rf_tech_and_mode 0x%x, rf_tech_specific_params_len %d", 169 - ntf.target_handle, 170 - ntf.rf_protocol, 171 - ntf.rf_tech_and_mode, 177 + nfc_dbg("rf_discovery_id %d", ntf.rf_discovery_id); 178 + nfc_dbg("rf_interface_type 0x%x", ntf.rf_interface_type); 179 + nfc_dbg("rf_protocol 0x%x", ntf.rf_protocol); 180 + nfc_dbg("activation_rf_tech_and_mode 0x%x", 181 + ntf.activation_rf_tech_and_mode); 182 + nfc_dbg("rf_tech_specific_params_len %d", 172 183 ntf.rf_tech_specific_params_len); 173 184 174 - switch (ntf.rf_tech_and_mode) { 175 - case NCI_NFC_A_PASSIVE_POLL_MODE: 176 - rc = nci_rf_activate_nfca_passive_poll(ndev, &ntf, 177 - data); 178 - break; 185 + if (ntf.rf_tech_specific_params_len > 0) { 186 + switch (ntf.activation_rf_tech_and_mode) { 187 + case NCI_NFC_A_PASSIVE_POLL_MODE: 188 + data = nci_extract_rf_params_nfca_passive_poll(ndev, 189 + &ntf, data); 190 + break; 179 191 180 - default: 181 - nfc_err("unsupported rf_tech_and_mode 0x%x", 182 - ntf.rf_tech_and_mode); 183 - return; 192 + default: 193 + nfc_err("unsupported activation_rf_tech_and_mode 0x%x", 194 + ntf.activation_rf_tech_and_mode); 195 + return; 196 + } 184 197 } 185 198 186 - if (!rc) 199 + ntf.data_exch_rf_tech_and_mode = *data++; 200 + ntf.data_exch_tx_bit_rate = *data++; 201 + ntf.data_exch_rx_bit_rate = *data++; 202 + ntf.activation_params_len = *data++; 203 + 204 + nfc_dbg("data_exch_rf_tech_and_mode 0x%x", 205 + ntf.data_exch_rf_tech_and_mode); 206 + nfc_dbg("data_exch_tx_bit_rate 0x%x", 207 + ntf.data_exch_tx_bit_rate); 208 + nfc_dbg("data_exch_rx_bit_rate 0x%x", 209 + ntf.data_exch_rx_bit_rate); 210 + nfc_dbg("activation_params_len %d", 211 + ntf.activation_params_len); 212 + 213 + if (ntf.activation_params_len > 0) { 214 + switch (ntf.rf_interface_type) { 215 + case NCI_RF_INTERFACE_ISO_DEP: 216 + err = nci_extract_activation_params_iso_dep(ndev, 217 + &ntf, data); 218 + break; 219 + 220 + case NCI_RF_INTERFACE_FRAME: 221 + /* no activation params */ 222 + break; 223 + 224 + default: 225 + nfc_err("unsupported rf_interface_type 0x%x", 226 + ntf.rf_interface_type); 227 + return; 228 + } 229 + } 230 + 231 + if (!err) 187 232 nci_target_found(ndev, &ntf); 188 233 } 189 234 190 235 static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev, 191 236 struct sk_buff *skb) 192 237 { 193 - __u8 type = skb->data[0]; 238 + struct nci_rf_deactivate_ntf *ntf = (void *) skb->data; 194 239 195 - nfc_dbg("entry, type 0x%x", type); 240 + nfc_dbg("entry, type 0x%x, reason 0x%x", ntf->type, ntf->reason); 196 241 197 242 clear_bit(NCI_POLL_ACTIVE, &ndev->flags); 198 243 ndev->target_active_prot = 0; ··· 242 213 kfree_skb(ndev->rx_data_reassembly); 243 214 ndev->rx_data_reassembly = 0; 244 215 } 216 + 217 + /* set the available credits to initial value */ 218 + atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); 245 219 246 220 /* complete the data exchange transaction, if exists */ 247 221 if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags)) ··· 269 237 nci_core_conn_credits_ntf_packet(ndev, skb); 270 238 break; 271 239 272 - case NCI_OP_RF_FIELD_INFO_NTF: 273 - nci_rf_field_info_ntf_packet(ndev, skb); 274 - break; 275 - 276 - case NCI_OP_RF_ACTIVATE_NTF: 277 - nci_rf_activate_ntf_packet(ndev, skb); 240 + case NCI_OP_RF_INTF_ACTIVATED_NTF: 241 + nci_rf_intf_activated_ntf_packet(ndev, skb); 278 242 break; 279 243 280 244 case NCI_OP_RF_DEACTIVATE_NTF:
+34 -47
net/nfc/nci/rsp.c
··· 42 42 43 43 nfc_dbg("entry, status 0x%x", rsp->status); 44 44 45 - if (rsp->status == NCI_STATUS_OK) 45 + if (rsp->status == NCI_STATUS_OK) { 46 46 ndev->nci_ver = rsp->nci_ver; 47 - 48 - nfc_dbg("nci_ver 0x%x", ndev->nci_ver); 47 + nfc_dbg("nci_ver 0x%x, config_status 0x%x", 48 + rsp->nci_ver, rsp->config_status); 49 + } 49 50 50 51 nci_req_complete(ndev, rsp->status); 51 52 } ··· 59 58 nfc_dbg("entry, status 0x%x", rsp_1->status); 60 59 61 60 if (rsp_1->status != NCI_STATUS_OK) 62 - return; 61 + goto exit; 63 62 64 63 ndev->nfcc_features = __le32_to_cpu(rsp_1->nfcc_features); 65 64 ndev->num_supported_rf_interfaces = rsp_1->num_supported_rf_interfaces; 66 65 67 66 if (ndev->num_supported_rf_interfaces > 68 - NCI_MAX_SUPPORTED_RF_INTERFACES) { 67 + NCI_MAX_SUPPORTED_RF_INTERFACES) { 69 68 ndev->num_supported_rf_interfaces = 70 69 NCI_MAX_SUPPORTED_RF_INTERFACES; 71 70 } ··· 74 73 rsp_1->supported_rf_interfaces, 75 74 ndev->num_supported_rf_interfaces); 76 75 77 - rsp_2 = (void *) (skb->data + 6 + ndev->num_supported_rf_interfaces); 76 + rsp_2 = (void *) (skb->data + 6 + rsp_1->num_supported_rf_interfaces); 78 77 79 78 ndev->max_logical_connections = 80 79 rsp_2->max_logical_connections; 81 80 ndev->max_routing_table_size = 82 81 __le16_to_cpu(rsp_2->max_routing_table_size); 83 - ndev->max_control_packet_payload_length = 84 - rsp_2->max_control_packet_payload_length; 85 - ndev->rf_sending_buffer_size = 86 - __le16_to_cpu(rsp_2->rf_sending_buffer_size); 87 - ndev->rf_receiving_buffer_size = 88 - __le16_to_cpu(rsp_2->rf_receiving_buffer_size); 89 - ndev->manufacturer_id = 90 - __le16_to_cpu(rsp_2->manufacturer_id); 82 + ndev->max_ctrl_pkt_payload_len = 83 + rsp_2->max_ctrl_pkt_payload_len; 84 + ndev->max_size_for_large_params = 85 + __le16_to_cpu(rsp_2->max_size_for_large_params); 86 + ndev->max_data_pkt_payload_size = 87 + rsp_2->max_data_pkt_payload_size; 88 + ndev->initial_num_credits = 89 + rsp_2->initial_num_credits; 90 + ndev->manufact_id = 91 + rsp_2->manufact_id; 92 + ndev->manufact_specific_info = 93 + __le32_to_cpu(rsp_2->manufact_specific_info); 94 + 95 + atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); 91 96 92 97 nfc_dbg("nfcc_features 0x%x", 93 98 ndev->nfcc_features); ··· 111 104 ndev->max_logical_connections); 112 105 nfc_dbg("max_routing_table_size %d", 113 106 ndev->max_routing_table_size); 114 - nfc_dbg("max_control_packet_payload_length %d", 115 - ndev->max_control_packet_payload_length); 116 - nfc_dbg("rf_sending_buffer_size %d", 117 - ndev->rf_sending_buffer_size); 118 - nfc_dbg("rf_receiving_buffer_size %d", 119 - ndev->rf_receiving_buffer_size); 120 - nfc_dbg("manufacturer_id 0x%x", 121 - ndev->manufacturer_id); 107 + nfc_dbg("max_ctrl_pkt_payload_len %d", 108 + ndev->max_ctrl_pkt_payload_len); 109 + nfc_dbg("max_size_for_large_params %d", 110 + ndev->max_size_for_large_params); 111 + nfc_dbg("max_data_pkt_payload_size %d", 112 + ndev->max_data_pkt_payload_size); 113 + nfc_dbg("initial_num_credits %d", 114 + ndev->initial_num_credits); 115 + nfc_dbg("manufact_id 0x%x", 116 + ndev->manufact_id); 117 + nfc_dbg("manufact_specific_info 0x%x", 118 + ndev->manufact_specific_info); 122 119 120 + exit: 123 121 nci_req_complete(ndev, rsp_1->status); 124 - } 125 - 126 - static void nci_core_conn_create_rsp_packet(struct nci_dev *ndev, 127 - struct sk_buff *skb) 128 - { 129 - struct nci_core_conn_create_rsp *rsp = (void *) skb->data; 130 - 131 - nfc_dbg("entry, status 0x%x", rsp->status); 132 - 133 - if (rsp->status != NCI_STATUS_OK) 134 - return; 135 - 136 - ndev->max_pkt_payload_size = rsp->max_pkt_payload_size; 137 - ndev->initial_num_credits = rsp->initial_num_credits; 138 - ndev->conn_id = rsp->conn_id; 139 - 140 - atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); 141 - 142 - nfc_dbg("max_pkt_payload_size %d", ndev->max_pkt_payload_size); 143 - nfc_dbg("initial_num_credits %d", ndev->initial_num_credits); 144 - nfc_dbg("conn_id %d", ndev->conn_id); 145 122 } 146 123 147 124 static void nci_rf_disc_map_rsp_packet(struct nci_dev *ndev, ··· 185 194 186 195 case NCI_OP_CORE_INIT_RSP: 187 196 nci_core_init_rsp_packet(ndev, skb); 188 - break; 189 - 190 - case NCI_OP_CORE_CONN_CREATE_RSP: 191 - nci_core_conn_create_rsp_packet(ndev, skb); 192 197 break; 193 198 194 199 case NCI_OP_RF_DISCOVER_MAP_RSP:
+14 -1
net/wireless/nl80211.c
··· 197 197 [NL80211_ATTR_TDLS_SUPPORT] = { .type = NLA_FLAG }, 198 198 [NL80211_ATTR_TDLS_EXTERNAL_SETUP] = { .type = NLA_FLAG }, 199 199 [NL80211_ATTR_DONT_WAIT_FOR_ACK] = { .type = NLA_FLAG }, 200 + [NL80211_ATTR_PROBE_RESP] = { .type = NLA_BINARY, 201 + .len = IEEE80211_MAX_DATA_LEN }, 200 202 }; 201 203 202 204 /* policy for the key attributes */ ··· 760 758 dev->wiphy.available_antennas_tx); 761 759 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, 762 760 dev->wiphy.available_antennas_rx); 761 + 762 + if (dev->wiphy.flags & WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD) 763 + NLA_PUT_U32(msg, NL80211_ATTR_PROBE_RESP_OFFLOAD, 764 + dev->wiphy.probe_resp_offload); 763 765 764 766 if ((dev->wiphy.available_antennas_tx || 765 767 dev->wiphy.available_antennas_rx) && dev->ops->get_antenna) { ··· 2171 2165 nla_data(info->attrs[NL80211_ATTR_IE_ASSOC_RESP]); 2172 2166 params.assocresp_ies_len = 2173 2167 nla_len(info->attrs[NL80211_ATTR_IE_ASSOC_RESP]); 2168 + } 2169 + 2170 + if (info->attrs[NL80211_ATTR_PROBE_RESP]) { 2171 + params.probe_resp = 2172 + nla_data(info->attrs[NL80211_ATTR_PROBE_RESP]); 2173 + params.probe_resp_len = 2174 + nla_len(info->attrs[NL80211_ATTR_PROBE_RESP]); 2174 2175 } 2175 2176 2176 2177 err = call(&rdev->wiphy, dev, &params); ··· 5296 5283 bool channel_type_valid = false; 5297 5284 u32 freq; 5298 5285 int err; 5299 - void *hdr; 5286 + void *hdr = NULL; 5300 5287 u64 cookie; 5301 5288 struct sk_buff *msg = NULL; 5302 5289 unsigned int wait = 0;
+114 -3
net/wireless/scan.c
··· 355 355 sizeof(struct ieee80211_meshconf_ie) - 2) == 0; 356 356 } 357 357 358 - static int cmp_bss(struct cfg80211_bss *a, 359 - struct cfg80211_bss *b) 358 + static int cmp_bss_core(struct cfg80211_bss *a, 359 + struct cfg80211_bss *b) 360 360 { 361 361 int r; 362 362 ··· 378 378 b->len_information_elements); 379 379 } 380 380 381 - r = memcmp(a->bssid, b->bssid, ETH_ALEN); 381 + return memcmp(a->bssid, b->bssid, ETH_ALEN); 382 + } 383 + 384 + static int cmp_bss(struct cfg80211_bss *a, 385 + struct cfg80211_bss *b) 386 + { 387 + int r; 388 + 389 + r = cmp_bss_core(a, b); 382 390 if (r) 383 391 return r; 384 392 ··· 395 387 a->len_information_elements, 396 388 b->information_elements, 397 389 b->len_information_elements); 390 + } 391 + 392 + static int cmp_hidden_bss(struct cfg80211_bss *a, 393 + struct cfg80211_bss *b) 394 + { 395 + const u8 *ie1; 396 + const u8 *ie2; 397 + int i; 398 + int r; 399 + 400 + r = cmp_bss_core(a, b); 401 + if (r) 402 + return r; 403 + 404 + ie1 = cfg80211_find_ie(WLAN_EID_SSID, 405 + a->information_elements, 406 + a->len_information_elements); 407 + ie2 = cfg80211_find_ie(WLAN_EID_SSID, 408 + b->information_elements, 409 + b->len_information_elements); 410 + 411 + /* Key comparator must use same algorithm in any rb-tree 412 + * search function (order is important), otherwise ordering 413 + * of items in the tree is broken and search gives incorrect 414 + * results. This code uses same order as cmp_ies() does. */ 415 + 416 + /* sort missing IE before (left of) present IE */ 417 + if (!ie1) 418 + return -1; 419 + if (!ie2) 420 + return 1; 421 + 422 + /* zero-size SSID is used as an indication of the hidden bss */ 423 + if (!ie2[1]) 424 + return 0; 425 + 426 + /* sort by length first, then by contents */ 427 + if (ie1[1] != ie2[1]) 428 + return ie2[1] - ie1[1]; 429 + 430 + /* zeroed SSID ie is another indication of a hidden bss */ 431 + for (i = 0; i < ie2[1]; i++) 432 + if (ie2[i + 2]) 433 + return -1; 434 + 435 + return 0; 398 436 } 399 437 400 438 struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, ··· 559 505 } 560 506 561 507 static struct cfg80211_internal_bss * 508 + rb_find_hidden_bss(struct cfg80211_registered_device *dev, 509 + struct cfg80211_internal_bss *res) 510 + { 511 + struct rb_node *n = dev->bss_tree.rb_node; 512 + struct cfg80211_internal_bss *bss; 513 + int r; 514 + 515 + while (n) { 516 + bss = rb_entry(n, struct cfg80211_internal_bss, rbn); 517 + r = cmp_hidden_bss(&res->pub, &bss->pub); 518 + 519 + if (r == 0) 520 + return bss; 521 + else if (r < 0) 522 + n = n->rb_left; 523 + else 524 + n = n->rb_right; 525 + } 526 + 527 + return NULL; 528 + } 529 + 530 + static void 531 + copy_hidden_ies(struct cfg80211_internal_bss *res, 532 + struct cfg80211_internal_bss *hidden) 533 + { 534 + if (unlikely(res->pub.beacon_ies)) 535 + return; 536 + if (WARN_ON(!hidden->pub.beacon_ies)) 537 + return; 538 + 539 + res->pub.beacon_ies = kmalloc(hidden->pub.len_beacon_ies, GFP_ATOMIC); 540 + if (unlikely(!res->pub.beacon_ies)) 541 + return; 542 + 543 + res->beacon_ies_allocated = true; 544 + res->pub.len_beacon_ies = hidden->pub.len_beacon_ies; 545 + memcpy(res->pub.beacon_ies, hidden->pub.beacon_ies, 546 + res->pub.len_beacon_ies); 547 + } 548 + 549 + static struct cfg80211_internal_bss * 562 550 cfg80211_bss_update(struct cfg80211_registered_device *dev, 563 551 struct cfg80211_internal_bss *res) 564 552 { ··· 703 607 704 608 kref_put(&res->ref, bss_release); 705 609 } else { 610 + struct cfg80211_internal_bss *hidden; 611 + 612 + /* First check if the beacon is a probe response from 613 + * a hidden bss. If so, copy beacon ies (with nullified 614 + * ssid) into the probe response bss entry (with real ssid). 615 + * It is required basically for PSM implementation 616 + * (probe responses do not contain tim ie) */ 617 + 618 + /* TODO: The code is not trying to update existing probe 619 + * response bss entries when beacon ies are 620 + * getting changed. */ 621 + hidden = rb_find_hidden_bss(dev, res); 622 + if (hidden) 623 + copy_hidden_ies(res, hidden); 624 + 706 625 /* this "consumes" the reference */ 707 626 list_add_tail(&res->list, &dev->bss_list); 708 627 rb_insert_bss(dev, res);
+12
net/wireless/wext-compat.c
··· 818 818 struct iw_freq *freq, char *extra) 819 819 { 820 820 struct wireless_dev *wdev = dev->ieee80211_ptr; 821 + struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); 822 + struct ieee80211_channel *chan; 821 823 822 824 switch (wdev->iftype) { 823 825 case NL80211_IFTYPE_STATION: 824 826 return cfg80211_mgd_wext_giwfreq(dev, info, freq, extra); 825 827 case NL80211_IFTYPE_ADHOC: 826 828 return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra); 829 + case NL80211_IFTYPE_MONITOR: 830 + if (!rdev->ops->get_channel) 831 + return -EINVAL; 832 + 833 + chan = rdev->ops->get_channel(wdev->wiphy); 834 + if (!chan) 835 + return -EINVAL; 836 + freq->m = chan->center_freq; 837 + freq->e = 6; 838 + return 0; 827 839 default: 828 840 if (!wdev->channel) 829 841 return -EINVAL;