diff options
author | John W. Linville <linville@tuxdriver.com> | 2010-05-17 13:57:43 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-17 13:57:43 -0400 |
commit | 6fe70aae0d128339febfabc073ba4c4a03de4f45 (patch) | |
tree | 711dff90df5ca4e07b5bddf11b2819e5cf2b7a93 /drivers | |
parent | 278554bd6579206921f5d8a523649a7a57f8850d (diff) | |
parent | 0c348d7c1422d59a86d6fb37b53d75788043e50b (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Diffstat (limited to 'drivers')
53 files changed, 1966 insertions, 1434 deletions
diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c index 8663660ea4c6..abd083a357f5 100644 --- a/drivers/net/wireless/ath/ar9170/usb.c +++ b/drivers/net/wireless/ath/ar9170/usb.c | |||
@@ -110,6 +110,8 @@ static struct usb_device_id ar9170_usb_ids[] = { | |||
110 | { USB_DEVICE(0x0409, 0x0249) }, | 110 | { USB_DEVICE(0x0409, 0x0249) }, |
111 | /* AVM FRITZ!WLAN USB Stick N 2.4 */ | 111 | /* AVM FRITZ!WLAN USB Stick N 2.4 */ |
112 | { USB_DEVICE(0x057C, 0x8402), .driver_info = AR9170_REQ_FW1_ONLY }, | 112 | { USB_DEVICE(0x057C, 0x8402), .driver_info = AR9170_REQ_FW1_ONLY }, |
113 | /* Qwest/Actiontec 802AIN Wireless N USB Network Adapter */ | ||
114 | { USB_DEVICE(0x1668, 0x1200) }, | ||
113 | 115 | ||
114 | /* terminate */ | 116 | /* terminate */ |
115 | {} | 117 | {} |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 7f5953fac434..5f04cf38a5bc 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -1932,12 +1932,6 @@ ath5k_tasklet_rx(unsigned long data) | |||
1932 | 1932 | ||
1933 | sc->stats.rx_all_count++; | 1933 | sc->stats.rx_all_count++; |
1934 | 1934 | ||
1935 | if (unlikely(rs.rs_more)) { | ||
1936 | ATH5K_WARN(sc, "unsupported jumbo\n"); | ||
1937 | sc->stats.rxerr_jumbo++; | ||
1938 | goto next; | ||
1939 | } | ||
1940 | |||
1941 | if (unlikely(rs.rs_status)) { | 1935 | if (unlikely(rs.rs_status)) { |
1942 | if (rs.rs_status & AR5K_RXERR_CRC) | 1936 | if (rs.rs_status & AR5K_RXERR_CRC) |
1943 | sc->stats.rxerr_crc++; | 1937 | sc->stats.rxerr_crc++; |
@@ -1977,6 +1971,12 @@ ath5k_tasklet_rx(unsigned long data) | |||
1977 | sc->opmode != NL80211_IFTYPE_MONITOR) | 1971 | sc->opmode != NL80211_IFTYPE_MONITOR) |
1978 | goto next; | 1972 | goto next; |
1979 | } | 1973 | } |
1974 | |||
1975 | if (unlikely(rs.rs_more)) { | ||
1976 | sc->stats.rxerr_jumbo++; | ||
1977 | goto next; | ||
1978 | |||
1979 | } | ||
1980 | accept: | 1980 | accept: |
1981 | next_skb = ath5k_rx_skb_alloc(sc, &next_skb_addr); | 1981 | next_skb = ath5k_rx_skb_alloc(sc, &next_skb_addr); |
1982 | 1982 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 8a79550dff71..23eb60ea5455 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -38,6 +38,9 @@ | |||
38 | #define AR_SWITCH_TABLE_ALL (0xfff) | 38 | #define AR_SWITCH_TABLE_ALL (0xfff) |
39 | #define AR_SWITCH_TABLE_ALL_S (0) | 39 | #define AR_SWITCH_TABLE_ALL_S (0) |
40 | 40 | ||
41 | #define LE16(x) __constant_cpu_to_le16(x) | ||
42 | #define LE32(x) __constant_cpu_to_le32(x) | ||
43 | |||
41 | static const struct ar9300_eeprom ar9300_default = { | 44 | static const struct ar9300_eeprom ar9300_default = { |
42 | .eepromVersion = 2, | 45 | .eepromVersion = 2, |
43 | .templateVersion = 2, | 46 | .templateVersion = 2, |
@@ -45,7 +48,7 @@ static const struct ar9300_eeprom ar9300_default = { | |||
45 | .custData = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 48 | .custData = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
46 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | 49 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, |
47 | .baseEepHeader = { | 50 | .baseEepHeader = { |
48 | .regDmn = {0, 0x1f}, | 51 | .regDmn = { LE16(0), LE16(0x1f) }, |
49 | .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */ | 52 | .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */ |
50 | .opCapFlags = { | 53 | .opCapFlags = { |
51 | .opFlags = AR9300_OPFLAGS_11G | AR9300_OPFLAGS_11A, | 54 | .opFlags = AR9300_OPFLAGS_11G | AR9300_OPFLAGS_11A, |
@@ -76,15 +79,15 @@ static const struct ar9300_eeprom ar9300_default = { | |||
76 | .modalHeader2G = { | 79 | .modalHeader2G = { |
77 | /* ar9300_modal_eep_header 2g */ | 80 | /* ar9300_modal_eep_header 2g */ |
78 | /* 4 idle,t1,t2,b(4 bits per setting) */ | 81 | /* 4 idle,t1,t2,b(4 bits per setting) */ |
79 | .antCtrlCommon = 0x110, | 82 | .antCtrlCommon = LE32(0x110), |
80 | /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */ | 83 | /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */ |
81 | .antCtrlCommon2 = 0x22222, | 84 | .antCtrlCommon2 = LE32(0x22222), |
82 | 85 | ||
83 | /* | 86 | /* |
84 | * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r, | 87 | * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r, |
85 | * rx1, rx12, b (2 bits each) | 88 | * rx1, rx12, b (2 bits each) |
86 | */ | 89 | */ |
87 | .antCtrlChain = {0x150, 0x150, 0x150}, | 90 | .antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) }, |
88 | 91 | ||
89 | /* | 92 | /* |
90 | * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db | 93 | * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db |
@@ -287,12 +290,12 @@ static const struct ar9300_eeprom ar9300_default = { | |||
287 | }, | 290 | }, |
288 | .modalHeader5G = { | 291 | .modalHeader5G = { |
289 | /* 4 idle,t1,t2,b (4 bits per setting) */ | 292 | /* 4 idle,t1,t2,b (4 bits per setting) */ |
290 | .antCtrlCommon = 0x110, | 293 | .antCtrlCommon = LE32(0x110), |
291 | /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */ | 294 | /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */ |
292 | .antCtrlCommon2 = 0x22222, | 295 | .antCtrlCommon2 = LE32(0x22222), |
293 | /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */ | 296 | /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */ |
294 | .antCtrlChain = { | 297 | .antCtrlChain = { |
295 | 0x000, 0x000, 0x000, | 298 | LE16(0x000), LE16(0x000), LE16(0x000), |
296 | }, | 299 | }, |
297 | /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */ | 300 | /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */ |
298 | .xatten1DB = {0, 0, 0}, | 301 | .xatten1DB = {0, 0, 0}, |
@@ -620,9 +623,9 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah, | |||
620 | case EEP_MAC_MSW: | 623 | case EEP_MAC_MSW: |
621 | return eep->macAddr[4] << 8 | eep->macAddr[5]; | 624 | return eep->macAddr[4] << 8 | eep->macAddr[5]; |
622 | case EEP_REG_0: | 625 | case EEP_REG_0: |
623 | return pBase->regDmn[0]; | 626 | return le16_to_cpu(pBase->regDmn[0]); |
624 | case EEP_REG_1: | 627 | case EEP_REG_1: |
625 | return pBase->regDmn[1]; | 628 | return le16_to_cpu(pBase->regDmn[1]); |
626 | case EEP_OP_CAP: | 629 | case EEP_OP_CAP: |
627 | return pBase->deviceCap; | 630 | return pBase->deviceCap; |
628 | case EEP_OP_MODE: | 631 | case EEP_OP_MODE: |
@@ -640,93 +643,80 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah, | |||
640 | /* Bit 4 is internal regulator flag */ | 643 | /* Bit 4 is internal regulator flag */ |
641 | return (pBase->featureEnable & 0x10) >> 4; | 644 | return (pBase->featureEnable & 0x10) >> 4; |
642 | case EEP_SWREG: | 645 | case EEP_SWREG: |
643 | return pBase->swreg; | 646 | return le32_to_cpu(pBase->swreg); |
644 | default: | 647 | default: |
645 | return 0; | 648 | return 0; |
646 | } | 649 | } |
647 | } | 650 | } |
648 | 651 | ||
649 | #ifdef __BIG_ENDIAN | 652 | static bool ar9300_eeprom_read_byte(struct ath_common *common, int address, |
650 | static void ar9300_swap_eeprom(struct ar9300_eeprom *eep) | 653 | u8 *buffer) |
651 | { | 654 | { |
652 | u32 dword; | 655 | u16 val; |
653 | u16 word; | ||
654 | int i; | ||
655 | |||
656 | word = swab16(eep->baseEepHeader.regDmn[0]); | ||
657 | eep->baseEepHeader.regDmn[0] = word; | ||
658 | |||
659 | word = swab16(eep->baseEepHeader.regDmn[1]); | ||
660 | eep->baseEepHeader.regDmn[1] = word; | ||
661 | |||
662 | dword = swab32(eep->baseEepHeader.swreg); | ||
663 | eep->baseEepHeader.swreg = dword; | ||
664 | 656 | ||
665 | dword = swab32(eep->modalHeader2G.antCtrlCommon); | 657 | if (unlikely(!ath9k_hw_nvram_read(common, address / 2, &val))) |
666 | eep->modalHeader2G.antCtrlCommon = dword; | 658 | return false; |
667 | 659 | ||
668 | dword = swab32(eep->modalHeader2G.antCtrlCommon2); | 660 | *buffer = (val >> (8 * (address % 2))) & 0xff; |
669 | eep->modalHeader2G.antCtrlCommon2 = dword; | 661 | return true; |
662 | } | ||
670 | 663 | ||
671 | dword = swab32(eep->modalHeader5G.antCtrlCommon); | 664 | static bool ar9300_eeprom_read_word(struct ath_common *common, int address, |
672 | eep->modalHeader5G.antCtrlCommon = dword; | 665 | u8 *buffer) |
666 | { | ||
667 | u16 val; | ||
673 | 668 | ||
674 | dword = swab32(eep->modalHeader5G.antCtrlCommon2); | 669 | if (unlikely(!ath9k_hw_nvram_read(common, address / 2, &val))) |
675 | eep->modalHeader5G.antCtrlCommon2 = dword; | 670 | return false; |
676 | 671 | ||
677 | for (i = 0; i < AR9300_MAX_CHAINS; i++) { | 672 | buffer[0] = val >> 8; |
678 | word = swab16(eep->modalHeader2G.antCtrlChain[i]); | 673 | buffer[1] = val & 0xff; |
679 | eep->modalHeader2G.antCtrlChain[i] = word; | ||
680 | 674 | ||
681 | word = swab16(eep->modalHeader5G.antCtrlChain[i]); | 675 | return true; |
682 | eep->modalHeader5G.antCtrlChain[i] = word; | ||
683 | } | ||
684 | } | 676 | } |
685 | #endif | ||
686 | 677 | ||
687 | static bool ar9300_hw_read_eeprom(struct ath_hw *ah, | 678 | static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer, |
688 | long address, u8 *buffer, int many) | 679 | int count) |
689 | { | 680 | { |
690 | int i; | ||
691 | u8 value[2]; | ||
692 | unsigned long eepAddr; | ||
693 | unsigned long byteAddr; | ||
694 | u16 *svalue; | ||
695 | struct ath_common *common = ath9k_hw_common(ah); | 681 | struct ath_common *common = ath9k_hw_common(ah); |
682 | int i; | ||
696 | 683 | ||
697 | if ((address < 0) || ((address + many) > AR9300_EEPROM_SIZE - 1)) { | 684 | if ((address < 0) || ((address + count) / 2 > AR9300_EEPROM_SIZE - 1)) { |
698 | ath_print(common, ATH_DBG_EEPROM, | 685 | ath_print(common, ATH_DBG_EEPROM, |
699 | "eeprom address not in range\n"); | 686 | "eeprom address not in range\n"); |
700 | return false; | 687 | return false; |
701 | } | 688 | } |
702 | 689 | ||
703 | for (i = 0; i < many; i++) { | 690 | /* |
704 | eepAddr = (u16) (address + i) / 2; | 691 | * Since we're reading the bytes in reverse order from a little-endian |
705 | byteAddr = (u16) (address + i) % 2; | 692 | * word stream, an even address means we only use the lower half of |
706 | svalue = (u16 *) value; | 693 | * the 16-bit word at that address |
707 | if (!ath9k_hw_nvram_read(common, eepAddr, svalue)) { | 694 | */ |
708 | ath_print(common, ATH_DBG_EEPROM, | 695 | if (address % 2 == 0) { |
709 | "unable to read eeprom region\n"); | 696 | if (!ar9300_eeprom_read_byte(common, address--, buffer++)) |
710 | return false; | 697 | goto error; |
711 | } | 698 | |
712 | *svalue = le16_to_cpu(*svalue); | 699 | count--; |
713 | buffer[i] = value[byteAddr]; | ||
714 | } | 700 | } |
715 | 701 | ||
716 | return true; | 702 | for (i = 0; i < count / 2; i++) { |
717 | } | 703 | if (!ar9300_eeprom_read_word(common, address, buffer)) |
704 | goto error; | ||
718 | 705 | ||
719 | static bool ar9300_read_eeprom(struct ath_hw *ah, | 706 | address -= 2; |
720 | int address, u8 *buffer, int many) | 707 | buffer += 2; |
721 | { | 708 | } |
722 | int it; | 709 | |
710 | if (count % 2) | ||
711 | if (!ar9300_eeprom_read_byte(common, address, buffer)) | ||
712 | goto error; | ||
723 | 713 | ||
724 | for (it = 0; it < many; it++) | ||
725 | if (!ar9300_hw_read_eeprom(ah, | ||
726 | (address - it), | ||
727 | (buffer + it), 1)) | ||
728 | return false; | ||
729 | return true; | 714 | return true; |
715 | |||
716 | error: | ||
717 | ath_print(common, ATH_DBG_EEPROM, | ||
718 | "unable to read eeprom region at offset %d\n", address); | ||
719 | return false; | ||
730 | } | 720 | } |
731 | 721 | ||
732 | static void ar9300_comp_hdr_unpack(u8 *best, int *code, int *reference, | 722 | static void ar9300_comp_hdr_unpack(u8 *best, int *code, int *reference, |
@@ -927,30 +917,13 @@ fail: | |||
927 | */ | 917 | */ |
928 | static bool ath9k_hw_ar9300_fill_eeprom(struct ath_hw *ah) | 918 | static bool ath9k_hw_ar9300_fill_eeprom(struct ath_hw *ah) |
929 | { | 919 | { |
930 | u8 *mptr = NULL; | 920 | u8 *mptr = (u8 *) &ah->eeprom.ar9300_eep; |
931 | int mdata_size; | ||
932 | 921 | ||
933 | mptr = (u8 *) &ah->eeprom.ar9300_eep; | 922 | if (ar9300_eeprom_restore_internal(ah, mptr, |
934 | mdata_size = sizeof(struct ar9300_eeprom); | 923 | sizeof(struct ar9300_eeprom)) < 0) |
924 | return false; | ||
935 | 925 | ||
936 | if (mptr && mdata_size > 0) { | 926 | return true; |
937 | /* At this point, mptr points to the eeprom data structure | ||
938 | * in it's "default" state. If this is big endian, swap the | ||
939 | * data structures back to "little endian" | ||
940 | */ | ||
941 | /* First swap, default to Little Endian */ | ||
942 | #ifdef __BIG_ENDIAN | ||
943 | ar9300_swap_eeprom((struct ar9300_eeprom *)mptr); | ||
944 | #endif | ||
945 | if (ar9300_eeprom_restore_internal(ah, mptr, mdata_size) >= 0) | ||
946 | return true; | ||
947 | |||
948 | /* Second Swap, back to Big Endian */ | ||
949 | #ifdef __BIG_ENDIAN | ||
950 | ar9300_swap_eeprom((struct ar9300_eeprom *)mptr); | ||
951 | #endif | ||
952 | } | ||
953 | return false; | ||
954 | } | 927 | } |
955 | 928 | ||
956 | /* XXX: review hardware docs */ | 929 | /* XXX: review hardware docs */ |
@@ -998,21 +971,25 @@ static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz) | |||
998 | static u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz) | 971 | static u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz) |
999 | { | 972 | { |
1000 | struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; | 973 | struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; |
974 | __le32 val; | ||
1001 | 975 | ||
1002 | if (is2ghz) | 976 | if (is2ghz) |
1003 | return eep->modalHeader2G.antCtrlCommon; | 977 | val = eep->modalHeader2G.antCtrlCommon; |
1004 | else | 978 | else |
1005 | return eep->modalHeader5G.antCtrlCommon; | 979 | val = eep->modalHeader5G.antCtrlCommon; |
980 | return le32_to_cpu(val); | ||
1006 | } | 981 | } |
1007 | 982 | ||
1008 | static u32 ar9003_hw_ant_ctrl_common_2_get(struct ath_hw *ah, bool is2ghz) | 983 | static u32 ar9003_hw_ant_ctrl_common_2_get(struct ath_hw *ah, bool is2ghz) |
1009 | { | 984 | { |
1010 | struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; | 985 | struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; |
986 | __le32 val; | ||
1011 | 987 | ||
1012 | if (is2ghz) | 988 | if (is2ghz) |
1013 | return eep->modalHeader2G.antCtrlCommon2; | 989 | val = eep->modalHeader2G.antCtrlCommon2; |
1014 | else | 990 | else |
1015 | return eep->modalHeader5G.antCtrlCommon2; | 991 | val = eep->modalHeader5G.antCtrlCommon2; |
992 | return le32_to_cpu(val); | ||
1016 | } | 993 | } |
1017 | 994 | ||
1018 | static u16 ar9003_hw_ant_ctrl_chain_get(struct ath_hw *ah, | 995 | static u16 ar9003_hw_ant_ctrl_chain_get(struct ath_hw *ah, |
@@ -1020,15 +997,16 @@ static u16 ar9003_hw_ant_ctrl_chain_get(struct ath_hw *ah, | |||
1020 | bool is2ghz) | 997 | bool is2ghz) |
1021 | { | 998 | { |
1022 | struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; | 999 | struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; |
1000 | __le16 val = 0; | ||
1023 | 1001 | ||
1024 | if (chain >= 0 && chain < AR9300_MAX_CHAINS) { | 1002 | if (chain >= 0 && chain < AR9300_MAX_CHAINS) { |
1025 | if (is2ghz) | 1003 | if (is2ghz) |
1026 | return eep->modalHeader2G.antCtrlChain[chain]; | 1004 | val = eep->modalHeader2G.antCtrlChain[chain]; |
1027 | else | 1005 | else |
1028 | return eep->modalHeader5G.antCtrlChain[chain]; | 1006 | val = eep->modalHeader5G.antCtrlChain[chain]; |
1029 | } | 1007 | } |
1030 | 1008 | ||
1031 | return 0; | 1009 | return le16_to_cpu(val); |
1032 | } | 1010 | } |
1033 | 1011 | ||
1034 | static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz) | 1012 | static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz) |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h index d8c0318f416f..23fb353c3bba 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h | |||
@@ -169,7 +169,7 @@ enum CompressAlgorithm { | |||
169 | }; | 169 | }; |
170 | 170 | ||
171 | struct ar9300_base_eep_hdr { | 171 | struct ar9300_base_eep_hdr { |
172 | u16 regDmn[2]; | 172 | __le16 regDmn[2]; |
173 | /* 4 bits tx and 4 bits rx */ | 173 | /* 4 bits tx and 4 bits rx */ |
174 | u8 txrxMask; | 174 | u8 txrxMask; |
175 | struct eepFlags opCapFlags; | 175 | struct eepFlags opCapFlags; |
@@ -199,16 +199,16 @@ struct ar9300_base_eep_hdr { | |||
199 | u8 rxBandSelectGpio; | 199 | u8 rxBandSelectGpio; |
200 | u8 txrxgain; | 200 | u8 txrxgain; |
201 | /* SW controlled internal regulator fields */ | 201 | /* SW controlled internal regulator fields */ |
202 | u32 swreg; | 202 | __le32 swreg; |
203 | } __packed; | 203 | } __packed; |
204 | 204 | ||
205 | struct ar9300_modal_eep_header { | 205 | struct ar9300_modal_eep_header { |
206 | /* 4 idle, t1, t2, b (4 bits per setting) */ | 206 | /* 4 idle, t1, t2, b (4 bits per setting) */ |
207 | u32 antCtrlCommon; | 207 | __le32 antCtrlCommon; |
208 | /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */ | 208 | /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */ |
209 | u32 antCtrlCommon2; | 209 | __le32 antCtrlCommon2; |
210 | /* 6 idle, t, r, rx1, rx12, b (2 bits each) */ | 210 | /* 6 idle, t, r, rx1, rx12, b (2 bits each) */ |
211 | u16 antCtrlChain[AR9300_MAX_CHAINS]; | 211 | __le16 antCtrlChain[AR9300_MAX_CHAINS]; |
212 | /* 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */ | 212 | /* 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */ |
213 | u8 xatten1DB[AR9300_MAX_CHAINS]; | 213 | u8 xatten1DB[AR9300_MAX_CHAINS]; |
214 | /* 3 xatten1_margin for merlin (0xa20c/b20c 16:12 */ | 214 | /* 3 xatten1_margin for merlin (0xa20c/b20c 16:12 */ |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_initvals.h index ef6116e13033..db019dd220b7 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_initvals.h | |||
@@ -25,8 +25,11 @@ static const u32 ar9300_2p0_radio_postamble[][5] = { | |||
25 | {0x000160ac, 0xa4653c00, 0xa4653c00, 0x24652800, 0x24652800}, | 25 | {0x000160ac, 0xa4653c00, 0xa4653c00, 0x24652800, 0x24652800}, |
26 | {0x000160b0, 0x03284f3e, 0x03284f3e, 0x05d08f20, 0x05d08f20}, | 26 | {0x000160b0, 0x03284f3e, 0x03284f3e, 0x05d08f20, 0x05d08f20}, |
27 | {0x0001610c, 0x08000000, 0x00000000, 0x00000000, 0x00000000}, | 27 | {0x0001610c, 0x08000000, 0x00000000, 0x00000000, 0x00000000}, |
28 | {0x00016140, 0x10804008, 0x10804008, 0x50804008, 0x50804008}, | ||
28 | {0x0001650c, 0x08000000, 0x00000000, 0x00000000, 0x00000000}, | 29 | {0x0001650c, 0x08000000, 0x00000000, 0x00000000, 0x00000000}, |
30 | {0x00016540, 0x10804008, 0x10804008, 0x50804008, 0x50804008}, | ||
29 | {0x0001690c, 0x08000000, 0x00000000, 0x00000000, 0x00000000}, | 31 | {0x0001690c, 0x08000000, 0x00000000, 0x00000000, 0x00000000}, |
32 | {0x00016940, 0x10804008, 0x10804008, 0x50804008, 0x50804008}, | ||
30 | }; | 33 | }; |
31 | 34 | ||
32 | static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p0[][5] = { | 35 | static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p0[][5] = { |
@@ -97,13 +100,13 @@ static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p0[][5] = { | |||
97 | {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | 100 | {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, |
98 | {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | 101 | {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, |
99 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 102 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
100 | {0x00016048, 0x60001a61, 0x60001a61, 0x60001a61, 0x60001a61}, | 103 | {0x00016048, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, |
101 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 104 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
102 | {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 105 | {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
103 | {0x00016448, 0x60001a61, 0x60001a61, 0x60001a61, 0x60001a61}, | 106 | {0x00016448, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, |
104 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 107 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
105 | {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 108 | {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
106 | {0x00016848, 0x60001a61, 0x60001a61, 0x60001a61, 0x60001a61}, | 109 | {0x00016848, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, |
107 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 110 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
108 | }; | 111 | }; |
109 | 112 | ||
@@ -129,7 +132,7 @@ static const u32 ar9300_2p0_radio_core[][2] = { | |||
129 | {0x00016040, 0x7f80fff8}, | 132 | {0x00016040, 0x7f80fff8}, |
130 | {0x0001604c, 0x76d005b5}, | 133 | {0x0001604c, 0x76d005b5}, |
131 | {0x00016050, 0x556cf031}, | 134 | {0x00016050, 0x556cf031}, |
132 | {0x00016054, 0x43449440}, | 135 | {0x00016054, 0x13449440}, |
133 | {0x00016058, 0x0c51c92c}, | 136 | {0x00016058, 0x0c51c92c}, |
134 | {0x0001605c, 0x3db7fffc}, | 137 | {0x0001605c, 0x3db7fffc}, |
135 | {0x00016060, 0xfffffffc}, | 138 | {0x00016060, 0xfffffffc}, |
@@ -152,12 +155,11 @@ static const u32 ar9300_2p0_radio_core[][2] = { | |||
152 | {0x00016100, 0x3fffbe01}, | 155 | {0x00016100, 0x3fffbe01}, |
153 | {0x00016104, 0xfff80000}, | 156 | {0x00016104, 0xfff80000}, |
154 | {0x00016108, 0x00080010}, | 157 | {0x00016108, 0x00080010}, |
155 | {0x00016140, 0x10804008}, | ||
156 | {0x00016144, 0x02084080}, | 158 | {0x00016144, 0x02084080}, |
157 | {0x00016148, 0x00000000}, | 159 | {0x00016148, 0x00000000}, |
158 | {0x00016280, 0x058a0001}, | 160 | {0x00016280, 0x058a0001}, |
159 | {0x00016284, 0x3d840208}, | 161 | {0x00016284, 0x3d840208}, |
160 | {0x00016288, 0x01a20408}, | 162 | {0x00016288, 0x05a20408}, |
161 | {0x0001628c, 0x00038c07}, | 163 | {0x0001628c, 0x00038c07}, |
162 | {0x00016290, 0x40000004}, | 164 | {0x00016290, 0x40000004}, |
163 | {0x00016294, 0x458aa14f}, | 165 | {0x00016294, 0x458aa14f}, |
@@ -190,7 +192,7 @@ static const u32 ar9300_2p0_radio_core[][2] = { | |||
190 | {0x00016440, 0x7f80fff8}, | 192 | {0x00016440, 0x7f80fff8}, |
191 | {0x0001644c, 0x76d005b5}, | 193 | {0x0001644c, 0x76d005b5}, |
192 | {0x00016450, 0x556cf031}, | 194 | {0x00016450, 0x556cf031}, |
193 | {0x00016454, 0x43449440}, | 195 | {0x00016454, 0x13449440}, |
194 | {0x00016458, 0x0c51c92c}, | 196 | {0x00016458, 0x0c51c92c}, |
195 | {0x0001645c, 0x3db7fffc}, | 197 | {0x0001645c, 0x3db7fffc}, |
196 | {0x00016460, 0xfffffffc}, | 198 | {0x00016460, 0xfffffffc}, |
@@ -199,7 +201,6 @@ static const u32 ar9300_2p0_radio_core[][2] = { | |||
199 | {0x00016500, 0x3fffbe01}, | 201 | {0x00016500, 0x3fffbe01}, |
200 | {0x00016504, 0xfff80000}, | 202 | {0x00016504, 0xfff80000}, |
201 | {0x00016508, 0x00080010}, | 203 | {0x00016508, 0x00080010}, |
202 | {0x00016540, 0x10804008}, | ||
203 | {0x00016544, 0x02084080}, | 204 | {0x00016544, 0x02084080}, |
204 | {0x00016548, 0x00000000}, | 205 | {0x00016548, 0x00000000}, |
205 | {0x00016780, 0x00000000}, | 206 | {0x00016780, 0x00000000}, |
@@ -231,7 +232,7 @@ static const u32 ar9300_2p0_radio_core[][2] = { | |||
231 | {0x00016840, 0x7f80fff8}, | 232 | {0x00016840, 0x7f80fff8}, |
232 | {0x0001684c, 0x76d005b5}, | 233 | {0x0001684c, 0x76d005b5}, |
233 | {0x00016850, 0x556cf031}, | 234 | {0x00016850, 0x556cf031}, |
234 | {0x00016854, 0x43449440}, | 235 | {0x00016854, 0x13449440}, |
235 | {0x00016858, 0x0c51c92c}, | 236 | {0x00016858, 0x0c51c92c}, |
236 | {0x0001685c, 0x3db7fffc}, | 237 | {0x0001685c, 0x3db7fffc}, |
237 | {0x00016860, 0xfffffffc}, | 238 | {0x00016860, 0xfffffffc}, |
@@ -240,7 +241,6 @@ static const u32 ar9300_2p0_radio_core[][2] = { | |||
240 | {0x00016900, 0x3fffbe01}, | 241 | {0x00016900, 0x3fffbe01}, |
241 | {0x00016904, 0xfff80000}, | 242 | {0x00016904, 0xfff80000}, |
242 | {0x00016908, 0x00080010}, | 243 | {0x00016908, 0x00080010}, |
243 | {0x00016940, 0x10804008}, | ||
244 | {0x00016944, 0x02084080}, | 244 | {0x00016944, 0x02084080}, |
245 | {0x00016948, 0x00000000}, | 245 | {0x00016948, 0x00000000}, |
246 | {0x00016b80, 0x00000000}, | 246 | {0x00016b80, 0x00000000}, |
@@ -588,12 +588,12 @@ static const u32 ar9200_merlin_2p0_radio_core[][2] = { | |||
588 | 588 | ||
589 | static const u32 ar9300_2p0_baseband_postamble[][5] = { | 589 | static const u32 ar9300_2p0_baseband_postamble[][5] = { |
590 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 590 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
591 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a800b}, | 591 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a8011}, |
592 | {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e}, | 592 | {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e}, |
593 | {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, | 593 | {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, |
594 | {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, | 594 | {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, |
595 | {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, | 595 | {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, |
596 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x00000b9c}, | 596 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, |
597 | {0x00009c00, 0x00000044, 0x000000c4, 0x000000c4, 0x00000044}, | 597 | {0x00009c00, 0x00000044, 0x000000c4, 0x000000c4, 0x00000044}, |
598 | {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, | 598 | {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, |
599 | {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, | 599 | {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, |
@@ -604,8 +604,8 @@ static const u32 ar9300_2p0_baseband_postamble[][5] = { | |||
604 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, | 604 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, |
605 | {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, | 605 | {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, |
606 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, | 606 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, |
607 | {0x00009e44, 0x02321e27, 0x02321e27, 0x02282324, 0x02282324}, | 607 | {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27}, |
608 | {0x00009e48, 0x5030201a, 0x5030201a, 0x50302010, 0x50302010}, | 608 | {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, |
609 | {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, | 609 | {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, |
610 | {0x0000a204, 0x000037c0, 0x000037c4, 0x000037c4, 0x000037c0}, | 610 | {0x0000a204, 0x000037c0, 0x000037c4, 0x000037c4, 0x000037c0}, |
611 | {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, | 611 | {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, |
@@ -674,7 +674,7 @@ static const u32 ar9300_2p0_baseband_core[][2] = { | |||
674 | {0x00009d10, 0x01834061}, | 674 | {0x00009d10, 0x01834061}, |
675 | {0x00009d14, 0x00c0040b}, | 675 | {0x00009d14, 0x00c0040b}, |
676 | {0x00009d18, 0x00000000}, | 676 | {0x00009d18, 0x00000000}, |
677 | {0x00009e08, 0x0038233c}, | 677 | {0x00009e08, 0x0038230c}, |
678 | {0x00009e24, 0x990bb515}, | 678 | {0x00009e24, 0x990bb515}, |
679 | {0x00009e28, 0x0c6f0000}, | 679 | {0x00009e28, 0x0c6f0000}, |
680 | {0x00009e30, 0x06336f77}, | 680 | {0x00009e30, 0x06336f77}, |
@@ -901,13 +901,13 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p0[][5] = { | |||
901 | {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, | 901 | {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
902 | {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, | 902 | {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
903 | {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, | 903 | {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, |
904 | {0x00016048, 0xae481a61, 0xae481a61, 0xae481a61, 0xae481a61}, | 904 | {0x00016048, 0xae480001, 0xae480001, 0xae480001, 0xae480001}, |
905 | {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, | 905 | {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, |
906 | {0x00016444, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, | 906 | {0x00016444, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, |
907 | {0x00016448, 0xae481a61, 0xae481a61, 0xae481a61, 0xae481a61}, | 907 | {0x00016448, 0xae480001, 0xae480001, 0xae480001, 0xae480001}, |
908 | {0x00016468, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, | 908 | {0x00016468, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, |
909 | {0x00016844, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, | 909 | {0x00016844, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, |
910 | {0x00016848, 0xae481a61, 0xae481a61, 0xae481a61, 0xae481a61}, | 910 | {0x00016848, 0xae480001, 0xae480001, 0xae480001, 0xae480001}, |
911 | {0x00016868, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, | 911 | {0x00016868, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, |
912 | }; | 912 | }; |
913 | 913 | ||
@@ -979,13 +979,13 @@ static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p0[][5] = { | |||
979 | {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, | 979 | {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
980 | {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, | 980 | {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
981 | {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, | 981 | {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, |
982 | {0x00016048, 0x8e481a61, 0x8e481a61, 0x8e481a61, 0x8e481a61}, | 982 | {0x00016048, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, |
983 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 983 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
984 | {0x00016444, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, | 984 | {0x00016444, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, |
985 | {0x00016448, 0x8e481a61, 0x8e481a61, 0x8e481a61, 0x8e481a61}, | 985 | {0x00016448, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, |
986 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 986 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
987 | {0x00016844, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, | 987 | {0x00016844, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, |
988 | {0x00016848, 0x8e481a61, 0x8e481a61, 0x8e481a61, 0x8e481a61}, | 988 | {0x00016848, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, |
989 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 989 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
990 | }; | 990 | }; |
991 | 991 | ||
@@ -995,22 +995,22 @@ static const u32 ar9300Common_rx_gain_table_2p0[][2] = { | |||
995 | {0x0000a004, 0x00030002}, | 995 | {0x0000a004, 0x00030002}, |
996 | {0x0000a008, 0x00050004}, | 996 | {0x0000a008, 0x00050004}, |
997 | {0x0000a00c, 0x00810080}, | 997 | {0x0000a00c, 0x00810080}, |
998 | {0x0000a010, 0x01800082}, | 998 | {0x0000a010, 0x00830082}, |
999 | {0x0000a014, 0x01820181}, | 999 | {0x0000a014, 0x01810180}, |
1000 | {0x0000a018, 0x01840183}, | 1000 | {0x0000a018, 0x01830182}, |
1001 | {0x0000a01c, 0x01880185}, | 1001 | {0x0000a01c, 0x01850184}, |
1002 | {0x0000a020, 0x018a0189}, | 1002 | {0x0000a020, 0x01890188}, |
1003 | {0x0000a024, 0x02850284}, | 1003 | {0x0000a024, 0x018b018a}, |
1004 | {0x0000a028, 0x02890288}, | 1004 | {0x0000a028, 0x018d018c}, |
1005 | {0x0000a02c, 0x028b028a}, | 1005 | {0x0000a02c, 0x01910190}, |
1006 | {0x0000a030, 0x028d028c}, | 1006 | {0x0000a030, 0x01930192}, |
1007 | {0x0000a034, 0x02910290}, | 1007 | {0x0000a034, 0x01950194}, |
1008 | {0x0000a038, 0x02930292}, | 1008 | {0x0000a038, 0x038a0196}, |
1009 | {0x0000a03c, 0x03910390}, | 1009 | {0x0000a03c, 0x038c038b}, |
1010 | {0x0000a040, 0x03930392}, | 1010 | {0x0000a040, 0x0390038d}, |
1011 | {0x0000a044, 0x03950394}, | 1011 | {0x0000a044, 0x03920391}, |
1012 | {0x0000a048, 0x00000396}, | 1012 | {0x0000a048, 0x03940393}, |
1013 | {0x0000a04c, 0x00000000}, | 1013 | {0x0000a04c, 0x03960395}, |
1014 | {0x0000a050, 0x00000000}, | 1014 | {0x0000a050, 0x00000000}, |
1015 | {0x0000a054, 0x00000000}, | 1015 | {0x0000a054, 0x00000000}, |
1016 | {0x0000a058, 0x00000000}, | 1016 | {0x0000a058, 0x00000000}, |
@@ -1023,14 +1023,14 @@ static const u32 ar9300Common_rx_gain_table_2p0[][2] = { | |||
1023 | {0x0000a074, 0x00000000}, | 1023 | {0x0000a074, 0x00000000}, |
1024 | {0x0000a078, 0x00000000}, | 1024 | {0x0000a078, 0x00000000}, |
1025 | {0x0000a07c, 0x00000000}, | 1025 | {0x0000a07c, 0x00000000}, |
1026 | {0x0000a080, 0x28282828}, | 1026 | {0x0000a080, 0x22222229}, |
1027 | {0x0000a084, 0x21212128}, | 1027 | {0x0000a084, 0x1d1d1d1d}, |
1028 | {0x0000a088, 0x21212121}, | 1028 | {0x0000a088, 0x1d1d1d1d}, |
1029 | {0x0000a08c, 0x1c1c1c21}, | 1029 | {0x0000a08c, 0x1d1d1d1d}, |
1030 | {0x0000a090, 0x1c1c1c1c}, | 1030 | {0x0000a090, 0x171d1d1d}, |
1031 | {0x0000a094, 0x17171c1c}, | 1031 | {0x0000a094, 0x11111717}, |
1032 | {0x0000a098, 0x02020212}, | 1032 | {0x0000a098, 0x00030311}, |
1033 | {0x0000a09c, 0x02020202}, | 1033 | {0x0000a09c, 0x00000000}, |
1034 | {0x0000a0a0, 0x00000000}, | 1034 | {0x0000a0a0, 0x00000000}, |
1035 | {0x0000a0a4, 0x00000000}, | 1035 | {0x0000a0a4, 0x00000000}, |
1036 | {0x0000a0a8, 0x00000000}, | 1036 | {0x0000a0a8, 0x00000000}, |
@@ -1040,26 +1040,26 @@ static const u32 ar9300Common_rx_gain_table_2p0[][2] = { | |||
1040 | {0x0000a0b8, 0x00000000}, | 1040 | {0x0000a0b8, 0x00000000}, |
1041 | {0x0000a0bc, 0x00000000}, | 1041 | {0x0000a0bc, 0x00000000}, |
1042 | {0x0000a0c0, 0x001f0000}, | 1042 | {0x0000a0c0, 0x001f0000}, |
1043 | {0x0000a0c4, 0x011f0100}, | 1043 | {0x0000a0c4, 0x01000101}, |
1044 | {0x0000a0c8, 0x011d011e}, | 1044 | {0x0000a0c8, 0x011e011f}, |
1045 | {0x0000a0cc, 0x011b011c}, | 1045 | {0x0000a0cc, 0x011c011d}, |
1046 | {0x0000a0d0, 0x02030204}, | 1046 | {0x0000a0d0, 0x02030204}, |
1047 | {0x0000a0d4, 0x02010202}, | 1047 | {0x0000a0d4, 0x02010202}, |
1048 | {0x0000a0d8, 0x021f0200}, | 1048 | {0x0000a0d8, 0x021f0200}, |
1049 | {0x0000a0dc, 0x021d021e}, | 1049 | {0x0000a0dc, 0x0302021e}, |
1050 | {0x0000a0e0, 0x03010302}, | 1050 | {0x0000a0e0, 0x03000301}, |
1051 | {0x0000a0e4, 0x031f0300}, | 1051 | {0x0000a0e4, 0x031e031f}, |
1052 | {0x0000a0e8, 0x0402031e}, | 1052 | {0x0000a0e8, 0x0402031d}, |
1053 | {0x0000a0ec, 0x04000401}, | 1053 | {0x0000a0ec, 0x04000401}, |
1054 | {0x0000a0f0, 0x041e041f}, | 1054 | {0x0000a0f0, 0x041e041f}, |
1055 | {0x0000a0f4, 0x05010502}, | 1055 | {0x0000a0f4, 0x0502041d}, |
1056 | {0x0000a0f8, 0x051f0500}, | 1056 | {0x0000a0f8, 0x05000501}, |
1057 | {0x0000a0fc, 0x0602051e}, | 1057 | {0x0000a0fc, 0x051e051f}, |
1058 | {0x0000a100, 0x06000601}, | 1058 | {0x0000a100, 0x06010602}, |
1059 | {0x0000a104, 0x061e061f}, | 1059 | {0x0000a104, 0x061f0600}, |
1060 | {0x0000a108, 0x0703061d}, | 1060 | {0x0000a108, 0x061d061e}, |
1061 | {0x0000a10c, 0x07010702}, | 1061 | {0x0000a10c, 0x07020703}, |
1062 | {0x0000a110, 0x00000700}, | 1062 | {0x0000a110, 0x07000701}, |
1063 | {0x0000a114, 0x00000000}, | 1063 | {0x0000a114, 0x00000000}, |
1064 | {0x0000a118, 0x00000000}, | 1064 | {0x0000a118, 0x00000000}, |
1065 | {0x0000a11c, 0x00000000}, | 1065 | {0x0000a11c, 0x00000000}, |
@@ -1072,26 +1072,26 @@ static const u32 ar9300Common_rx_gain_table_2p0[][2] = { | |||
1072 | {0x0000a138, 0x00000000}, | 1072 | {0x0000a138, 0x00000000}, |
1073 | {0x0000a13c, 0x00000000}, | 1073 | {0x0000a13c, 0x00000000}, |
1074 | {0x0000a140, 0x001f0000}, | 1074 | {0x0000a140, 0x001f0000}, |
1075 | {0x0000a144, 0x011f0100}, | 1075 | {0x0000a144, 0x01000101}, |
1076 | {0x0000a148, 0x011d011e}, | 1076 | {0x0000a148, 0x011e011f}, |
1077 | {0x0000a14c, 0x011b011c}, | 1077 | {0x0000a14c, 0x011c011d}, |
1078 | {0x0000a150, 0x02030204}, | 1078 | {0x0000a150, 0x02030204}, |
1079 | {0x0000a154, 0x02010202}, | 1079 | {0x0000a154, 0x02010202}, |
1080 | {0x0000a158, 0x021f0200}, | 1080 | {0x0000a158, 0x021f0200}, |
1081 | {0x0000a15c, 0x021d021e}, | 1081 | {0x0000a15c, 0x0302021e}, |
1082 | {0x0000a160, 0x03010302}, | 1082 | {0x0000a160, 0x03000301}, |
1083 | {0x0000a164, 0x031f0300}, | 1083 | {0x0000a164, 0x031e031f}, |
1084 | {0x0000a168, 0x0402031e}, | 1084 | {0x0000a168, 0x0402031d}, |
1085 | {0x0000a16c, 0x04000401}, | 1085 | {0x0000a16c, 0x04000401}, |
1086 | {0x0000a170, 0x041e041f}, | 1086 | {0x0000a170, 0x041e041f}, |
1087 | {0x0000a174, 0x05010502}, | 1087 | {0x0000a174, 0x0502041d}, |
1088 | {0x0000a178, 0x051f0500}, | 1088 | {0x0000a178, 0x05000501}, |
1089 | {0x0000a17c, 0x0602051e}, | 1089 | {0x0000a17c, 0x051e051f}, |
1090 | {0x0000a180, 0x06000601}, | 1090 | {0x0000a180, 0x06010602}, |
1091 | {0x0000a184, 0x061e061f}, | 1091 | {0x0000a184, 0x061f0600}, |
1092 | {0x0000a188, 0x0703061d}, | 1092 | {0x0000a188, 0x061d061e}, |
1093 | {0x0000a18c, 0x07010702}, | 1093 | {0x0000a18c, 0x07020703}, |
1094 | {0x0000a190, 0x00000700}, | 1094 | {0x0000a190, 0x07000701}, |
1095 | {0x0000a194, 0x00000000}, | 1095 | {0x0000a194, 0x00000000}, |
1096 | {0x0000a198, 0x00000000}, | 1096 | {0x0000a198, 0x00000000}, |
1097 | {0x0000a19c, 0x00000000}, | 1097 | {0x0000a19c, 0x00000000}, |
@@ -1317,13 +1317,13 @@ static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p0[][5] = { | |||
1317 | {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | 1317 | {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, |
1318 | {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, | 1318 | {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, |
1319 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 1319 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
1320 | {0x00016048, 0x64001a61, 0x64001a61, 0x64001a61, 0x64001a61}, | 1320 | {0x00016048, 0x64000001, 0x64000001, 0x64000001, 0x64000001}, |
1321 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 1321 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
1322 | {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 1322 | {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
1323 | {0x00016448, 0x64001a61, 0x64001a61, 0x64001a61, 0x64001a61}, | 1323 | {0x00016448, 0x64000001, 0x64000001, 0x64000001, 0x64000001}, |
1324 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 1324 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
1325 | {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 1325 | {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
1326 | {0x00016848, 0x64001a61, 0x64001a61, 0x64001a61, 0x64001a61}, | 1326 | {0x00016848, 0x64000001, 0x64000001, 0x64000001, 0x64000001}, |
1327 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 1327 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
1328 | }; | 1328 | }; |
1329 | 1329 | ||
@@ -1497,22 +1497,22 @@ static const u32 ar9300Common_wo_xlna_rx_gain_table_2p0[][2] = { | |||
1497 | {0x0000a004, 0x00030002}, | 1497 | {0x0000a004, 0x00030002}, |
1498 | {0x0000a008, 0x00050004}, | 1498 | {0x0000a008, 0x00050004}, |
1499 | {0x0000a00c, 0x00810080}, | 1499 | {0x0000a00c, 0x00810080}, |
1500 | {0x0000a010, 0x01800082}, | 1500 | {0x0000a010, 0x00830082}, |
1501 | {0x0000a014, 0x01820181}, | 1501 | {0x0000a014, 0x01810180}, |
1502 | {0x0000a018, 0x01840183}, | 1502 | {0x0000a018, 0x01830182}, |
1503 | {0x0000a01c, 0x01880185}, | 1503 | {0x0000a01c, 0x01850184}, |
1504 | {0x0000a020, 0x018a0189}, | 1504 | {0x0000a020, 0x01890188}, |
1505 | {0x0000a024, 0x02850284}, | 1505 | {0x0000a024, 0x018b018a}, |
1506 | {0x0000a028, 0x02890288}, | 1506 | {0x0000a028, 0x018d018c}, |
1507 | {0x0000a02c, 0x03850384}, | 1507 | {0x0000a02c, 0x03820190}, |
1508 | {0x0000a030, 0x03890388}, | 1508 | {0x0000a030, 0x03840383}, |
1509 | {0x0000a034, 0x038b038a}, | 1509 | {0x0000a034, 0x03880385}, |
1510 | {0x0000a038, 0x038d038c}, | 1510 | {0x0000a038, 0x038a0389}, |
1511 | {0x0000a03c, 0x03910390}, | 1511 | {0x0000a03c, 0x038c038b}, |
1512 | {0x0000a040, 0x03930392}, | 1512 | {0x0000a040, 0x0390038d}, |
1513 | {0x0000a044, 0x03950394}, | 1513 | {0x0000a044, 0x03920391}, |
1514 | {0x0000a048, 0x00000396}, | 1514 | {0x0000a048, 0x03940393}, |
1515 | {0x0000a04c, 0x00000000}, | 1515 | {0x0000a04c, 0x03960395}, |
1516 | {0x0000a050, 0x00000000}, | 1516 | {0x0000a050, 0x00000000}, |
1517 | {0x0000a054, 0x00000000}, | 1517 | {0x0000a054, 0x00000000}, |
1518 | {0x0000a058, 0x00000000}, | 1518 | {0x0000a058, 0x00000000}, |
@@ -1525,15 +1525,15 @@ static const u32 ar9300Common_wo_xlna_rx_gain_table_2p0[][2] = { | |||
1525 | {0x0000a074, 0x00000000}, | 1525 | {0x0000a074, 0x00000000}, |
1526 | {0x0000a078, 0x00000000}, | 1526 | {0x0000a078, 0x00000000}, |
1527 | {0x0000a07c, 0x00000000}, | 1527 | {0x0000a07c, 0x00000000}, |
1528 | {0x0000a080, 0x28282828}, | 1528 | {0x0000a080, 0x29292929}, |
1529 | {0x0000a084, 0x28282828}, | 1529 | {0x0000a084, 0x29292929}, |
1530 | {0x0000a088, 0x28282828}, | 1530 | {0x0000a088, 0x29292929}, |
1531 | {0x0000a08c, 0x28282828}, | 1531 | {0x0000a08c, 0x29292929}, |
1532 | {0x0000a090, 0x28282828}, | 1532 | {0x0000a090, 0x22292929}, |
1533 | {0x0000a094, 0x21212128}, | 1533 | {0x0000a094, 0x1d1d2222}, |
1534 | {0x0000a098, 0x171c1c1c}, | 1534 | {0x0000a098, 0x0c111117}, |
1535 | {0x0000a09c, 0x02020212}, | 1535 | {0x0000a09c, 0x00030303}, |
1536 | {0x0000a0a0, 0x00000202}, | 1536 | {0x0000a0a0, 0x00000000}, |
1537 | {0x0000a0a4, 0x00000000}, | 1537 | {0x0000a0a4, 0x00000000}, |
1538 | {0x0000a0a8, 0x00000000}, | 1538 | {0x0000a0a8, 0x00000000}, |
1539 | {0x0000a0ac, 0x00000000}, | 1539 | {0x0000a0ac, 0x00000000}, |
@@ -1542,26 +1542,26 @@ static const u32 ar9300Common_wo_xlna_rx_gain_table_2p0[][2] = { | |||
1542 | {0x0000a0b8, 0x00000000}, | 1542 | {0x0000a0b8, 0x00000000}, |
1543 | {0x0000a0bc, 0x00000000}, | 1543 | {0x0000a0bc, 0x00000000}, |
1544 | {0x0000a0c0, 0x001f0000}, | 1544 | {0x0000a0c0, 0x001f0000}, |
1545 | {0x0000a0c4, 0x011f0100}, | 1545 | {0x0000a0c4, 0x01000101}, |
1546 | {0x0000a0c8, 0x011d011e}, | 1546 | {0x0000a0c8, 0x011e011f}, |
1547 | {0x0000a0cc, 0x011b011c}, | 1547 | {0x0000a0cc, 0x011c011d}, |
1548 | {0x0000a0d0, 0x02030204}, | 1548 | {0x0000a0d0, 0x02030204}, |
1549 | {0x0000a0d4, 0x02010202}, | 1549 | {0x0000a0d4, 0x02010202}, |
1550 | {0x0000a0d8, 0x021f0200}, | 1550 | {0x0000a0d8, 0x021f0200}, |
1551 | {0x0000a0dc, 0x021d021e}, | 1551 | {0x0000a0dc, 0x0302021e}, |
1552 | {0x0000a0e0, 0x03010302}, | 1552 | {0x0000a0e0, 0x03000301}, |
1553 | {0x0000a0e4, 0x031f0300}, | 1553 | {0x0000a0e4, 0x031e031f}, |
1554 | {0x0000a0e8, 0x0402031e}, | 1554 | {0x0000a0e8, 0x0402031d}, |
1555 | {0x0000a0ec, 0x04000401}, | 1555 | {0x0000a0ec, 0x04000401}, |
1556 | {0x0000a0f0, 0x041e041f}, | 1556 | {0x0000a0f0, 0x041e041f}, |
1557 | {0x0000a0f4, 0x05010502}, | 1557 | {0x0000a0f4, 0x0502041d}, |
1558 | {0x0000a0f8, 0x051f0500}, | 1558 | {0x0000a0f8, 0x05000501}, |
1559 | {0x0000a0fc, 0x0602051e}, | 1559 | {0x0000a0fc, 0x051e051f}, |
1560 | {0x0000a100, 0x06000601}, | 1560 | {0x0000a100, 0x06010602}, |
1561 | {0x0000a104, 0x061e061f}, | 1561 | {0x0000a104, 0x061f0600}, |
1562 | {0x0000a108, 0x0703061d}, | 1562 | {0x0000a108, 0x061d061e}, |
1563 | {0x0000a10c, 0x07010702}, | 1563 | {0x0000a10c, 0x07020703}, |
1564 | {0x0000a110, 0x00000700}, | 1564 | {0x0000a110, 0x07000701}, |
1565 | {0x0000a114, 0x00000000}, | 1565 | {0x0000a114, 0x00000000}, |
1566 | {0x0000a118, 0x00000000}, | 1566 | {0x0000a118, 0x00000000}, |
1567 | {0x0000a11c, 0x00000000}, | 1567 | {0x0000a11c, 0x00000000}, |
@@ -1574,26 +1574,26 @@ static const u32 ar9300Common_wo_xlna_rx_gain_table_2p0[][2] = { | |||
1574 | {0x0000a138, 0x00000000}, | 1574 | {0x0000a138, 0x00000000}, |
1575 | {0x0000a13c, 0x00000000}, | 1575 | {0x0000a13c, 0x00000000}, |
1576 | {0x0000a140, 0x001f0000}, | 1576 | {0x0000a140, 0x001f0000}, |
1577 | {0x0000a144, 0x011f0100}, | 1577 | {0x0000a144, 0x01000101}, |
1578 | {0x0000a148, 0x011d011e}, | 1578 | {0x0000a148, 0x011e011f}, |
1579 | {0x0000a14c, 0x011b011c}, | 1579 | {0x0000a14c, 0x011c011d}, |
1580 | {0x0000a150, 0x02030204}, | 1580 | {0x0000a150, 0x02030204}, |
1581 | {0x0000a154, 0x02010202}, | 1581 | {0x0000a154, 0x02010202}, |
1582 | {0x0000a158, 0x021f0200}, | 1582 | {0x0000a158, 0x021f0200}, |
1583 | {0x0000a15c, 0x021d021e}, | 1583 | {0x0000a15c, 0x0302021e}, |
1584 | {0x0000a160, 0x03010302}, | 1584 | {0x0000a160, 0x03000301}, |
1585 | {0x0000a164, 0x031f0300}, | 1585 | {0x0000a164, 0x031e031f}, |
1586 | {0x0000a168, 0x0402031e}, | 1586 | {0x0000a168, 0x0402031d}, |
1587 | {0x0000a16c, 0x04000401}, | 1587 | {0x0000a16c, 0x04000401}, |
1588 | {0x0000a170, 0x041e041f}, | 1588 | {0x0000a170, 0x041e041f}, |
1589 | {0x0000a174, 0x05010502}, | 1589 | {0x0000a174, 0x0502041d}, |
1590 | {0x0000a178, 0x051f0500}, | 1590 | {0x0000a178, 0x05000501}, |
1591 | {0x0000a17c, 0x0602051e}, | 1591 | {0x0000a17c, 0x051e051f}, |
1592 | {0x0000a180, 0x06000601}, | 1592 | {0x0000a180, 0x06010602}, |
1593 | {0x0000a184, 0x061e061f}, | 1593 | {0x0000a184, 0x061f0600}, |
1594 | {0x0000a188, 0x0703061d}, | 1594 | {0x0000a188, 0x061d061e}, |
1595 | {0x0000a18c, 0x07010702}, | 1595 | {0x0000a18c, 0x07020703}, |
1596 | {0x0000a190, 0x00000700}, | 1596 | {0x0000a190, 0x07000701}, |
1597 | {0x0000a194, 0x00000000}, | 1597 | {0x0000a194, 0x00000000}, |
1598 | {0x0000a198, 0x00000000}, | 1598 | {0x0000a198, 0x00000000}, |
1599 | {0x0000a19c, 0x00000000}, | 1599 | {0x0000a19c, 0x00000000}, |
@@ -1620,7 +1620,7 @@ static const u32 ar9300Common_wo_xlna_rx_gain_table_2p0[][2] = { | |||
1620 | {0x0000a1f0, 0x00000396}, | 1620 | {0x0000a1f0, 0x00000396}, |
1621 | {0x0000a1f4, 0x00000396}, | 1621 | {0x0000a1f4, 0x00000396}, |
1622 | {0x0000a1f8, 0x00000396}, | 1622 | {0x0000a1f8, 0x00000396}, |
1623 | {0x0000a1fc, 0x00000296}, | 1623 | {0x0000a1fc, 0x00000196}, |
1624 | {0x0000b000, 0x00010000}, | 1624 | {0x0000b000, 0x00010000}, |
1625 | {0x0000b004, 0x00030002}, | 1625 | {0x0000b004, 0x00030002}, |
1626 | {0x0000b008, 0x00050004}, | 1626 | {0x0000b008, 0x00050004}, |
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 64e30cd45d05..29898f8d1893 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -78,6 +78,90 @@ static const struct file_operations fops_debug = { | |||
78 | 78 | ||
79 | #define DMA_BUF_LEN 1024 | 79 | #define DMA_BUF_LEN 1024 |
80 | 80 | ||
81 | static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf, | ||
82 | size_t count, loff_t *ppos) | ||
83 | { | ||
84 | struct ath_softc *sc = file->private_data; | ||
85 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
86 | char buf[32]; | ||
87 | unsigned int len; | ||
88 | |||
89 | len = snprintf(buf, sizeof(buf), "0x%08x\n", common->tx_chainmask); | ||
90 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
91 | } | ||
92 | |||
93 | static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf, | ||
94 | size_t count, loff_t *ppos) | ||
95 | { | ||
96 | struct ath_softc *sc = file->private_data; | ||
97 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
98 | unsigned long mask; | ||
99 | char buf[32]; | ||
100 | ssize_t len; | ||
101 | |||
102 | len = min(count, sizeof(buf) - 1); | ||
103 | if (copy_from_user(buf, user_buf, len)) | ||
104 | return -EINVAL; | ||
105 | |||
106 | buf[len] = '\0'; | ||
107 | if (strict_strtoul(buf, 0, &mask)) | ||
108 | return -EINVAL; | ||
109 | |||
110 | common->tx_chainmask = mask; | ||
111 | sc->sc_ah->caps.tx_chainmask = mask; | ||
112 | return count; | ||
113 | } | ||
114 | |||
115 | static const struct file_operations fops_tx_chainmask = { | ||
116 | .read = read_file_tx_chainmask, | ||
117 | .write = write_file_tx_chainmask, | ||
118 | .open = ath9k_debugfs_open, | ||
119 | .owner = THIS_MODULE | ||
120 | }; | ||
121 | |||
122 | |||
123 | static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf, | ||
124 | size_t count, loff_t *ppos) | ||
125 | { | ||
126 | struct ath_softc *sc = file->private_data; | ||
127 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
128 | char buf[32]; | ||
129 | unsigned int len; | ||
130 | |||
131 | len = snprintf(buf, sizeof(buf), "0x%08x\n", common->rx_chainmask); | ||
132 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
133 | } | ||
134 | |||
135 | static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf, | ||
136 | size_t count, loff_t *ppos) | ||
137 | { | ||
138 | struct ath_softc *sc = file->private_data; | ||
139 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
140 | unsigned long mask; | ||
141 | char buf[32]; | ||
142 | ssize_t len; | ||
143 | |||
144 | len = min(count, sizeof(buf) - 1); | ||
145 | if (copy_from_user(buf, user_buf, len)) | ||
146 | return -EINVAL; | ||
147 | |||
148 | buf[len] = '\0'; | ||
149 | if (strict_strtoul(buf, 0, &mask)) | ||
150 | return -EINVAL; | ||
151 | |||
152 | common->rx_chainmask = mask; | ||
153 | sc->sc_ah->caps.rx_chainmask = mask; | ||
154 | return count; | ||
155 | } | ||
156 | |||
157 | static const struct file_operations fops_rx_chainmask = { | ||
158 | .read = read_file_rx_chainmask, | ||
159 | .write = write_file_rx_chainmask, | ||
160 | .open = ath9k_debugfs_open, | ||
161 | .owner = THIS_MODULE | ||
162 | }; | ||
163 | |||
164 | |||
81 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, | 165 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, |
82 | size_t count, loff_t *ppos) | 166 | size_t count, loff_t *ppos) |
83 | { | 167 | { |
@@ -711,6 +795,86 @@ static const struct file_operations fops_recv = { | |||
711 | .owner = THIS_MODULE | 795 | .owner = THIS_MODULE |
712 | }; | 796 | }; |
713 | 797 | ||
798 | static ssize_t read_file_regidx(struct file *file, char __user *user_buf, | ||
799 | size_t count, loff_t *ppos) | ||
800 | { | ||
801 | struct ath_softc *sc = file->private_data; | ||
802 | char buf[32]; | ||
803 | unsigned int len; | ||
804 | |||
805 | len = snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.regidx); | ||
806 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
807 | } | ||
808 | |||
809 | static ssize_t write_file_regidx(struct file *file, const char __user *user_buf, | ||
810 | size_t count, loff_t *ppos) | ||
811 | { | ||
812 | struct ath_softc *sc = file->private_data; | ||
813 | unsigned long regidx; | ||
814 | char buf[32]; | ||
815 | ssize_t len; | ||
816 | |||
817 | len = min(count, sizeof(buf) - 1); | ||
818 | if (copy_from_user(buf, user_buf, len)) | ||
819 | return -EINVAL; | ||
820 | |||
821 | buf[len] = '\0'; | ||
822 | if (strict_strtoul(buf, 0, ®idx)) | ||
823 | return -EINVAL; | ||
824 | |||
825 | sc->debug.regidx = regidx; | ||
826 | return count; | ||
827 | } | ||
828 | |||
829 | static const struct file_operations fops_regidx = { | ||
830 | .read = read_file_regidx, | ||
831 | .write = write_file_regidx, | ||
832 | .open = ath9k_debugfs_open, | ||
833 | .owner = THIS_MODULE | ||
834 | }; | ||
835 | |||
836 | static ssize_t read_file_regval(struct file *file, char __user *user_buf, | ||
837 | size_t count, loff_t *ppos) | ||
838 | { | ||
839 | struct ath_softc *sc = file->private_data; | ||
840 | struct ath_hw *ah = sc->sc_ah; | ||
841 | char buf[32]; | ||
842 | unsigned int len; | ||
843 | u32 regval; | ||
844 | |||
845 | regval = REG_READ_D(ah, sc->debug.regidx); | ||
846 | len = snprintf(buf, sizeof(buf), "0x%08x\n", regval); | ||
847 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
848 | } | ||
849 | |||
850 | static ssize_t write_file_regval(struct file *file, const char __user *user_buf, | ||
851 | size_t count, loff_t *ppos) | ||
852 | { | ||
853 | struct ath_softc *sc = file->private_data; | ||
854 | struct ath_hw *ah = sc->sc_ah; | ||
855 | unsigned long regval; | ||
856 | char buf[32]; | ||
857 | ssize_t len; | ||
858 | |||
859 | len = min(count, sizeof(buf) - 1); | ||
860 | if (copy_from_user(buf, user_buf, len)) | ||
861 | return -EINVAL; | ||
862 | |||
863 | buf[len] = '\0'; | ||
864 | if (strict_strtoul(buf, 0, ®val)) | ||
865 | return -EINVAL; | ||
866 | |||
867 | REG_WRITE_D(ah, sc->debug.regidx, regval); | ||
868 | return count; | ||
869 | } | ||
870 | |||
871 | static const struct file_operations fops_regval = { | ||
872 | .read = read_file_regval, | ||
873 | .write = write_file_regval, | ||
874 | .open = ath9k_debugfs_open, | ||
875 | .owner = THIS_MODULE | ||
876 | }; | ||
877 | |||
714 | int ath9k_init_debug(struct ath_hw *ah) | 878 | int ath9k_init_debug(struct ath_hw *ah) |
715 | { | 879 | { |
716 | struct ath_common *common = ath9k_hw_common(ah); | 880 | struct ath_common *common = ath9k_hw_common(ah); |
@@ -722,54 +886,55 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
722 | sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy), | 886 | sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy), |
723 | ath9k_debugfs_root); | 887 | ath9k_debugfs_root); |
724 | if (!sc->debug.debugfs_phy) | 888 | if (!sc->debug.debugfs_phy) |
725 | goto err; | 889 | return -ENOMEM; |
726 | 890 | ||
727 | #ifdef CONFIG_ATH_DEBUG | 891 | #ifdef CONFIG_ATH_DEBUG |
728 | sc->debug.debugfs_debug = debugfs_create_file("debug", | 892 | if (!debugfs_create_file("debug", S_IRUSR | S_IWUSR, |
729 | S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_debug); | 893 | sc->debug.debugfs_phy, sc, &fops_debug)) |
730 | if (!sc->debug.debugfs_debug) | ||
731 | goto err; | 894 | goto err; |
732 | #endif | 895 | #endif |
733 | 896 | ||
734 | sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUSR, | 897 | if (!debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, |
735 | sc->debug.debugfs_phy, sc, &fops_dma); | 898 | sc, &fops_dma)) |
736 | if (!sc->debug.debugfs_dma) | 899 | goto err; |
900 | |||
901 | if (!debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, | ||
902 | sc, &fops_interrupt)) | ||
903 | goto err; | ||
904 | |||
905 | if (!debugfs_create_file("rcstat", S_IRUSR, sc->debug.debugfs_phy, | ||
906 | sc, &fops_rcstat)) | ||
907 | goto err; | ||
908 | |||
909 | if (!debugfs_create_file("wiphy", S_IRUSR | S_IWUSR, | ||
910 | sc->debug.debugfs_phy, sc, &fops_wiphy)) | ||
911 | goto err; | ||
912 | |||
913 | if (!debugfs_create_file("xmit", S_IRUSR, sc->debug.debugfs_phy, | ||
914 | sc, &fops_xmit)) | ||
737 | goto err; | 915 | goto err; |
738 | 916 | ||
739 | sc->debug.debugfs_interrupt = debugfs_create_file("interrupt", | 917 | if (!debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, |
740 | S_IRUSR, | 918 | sc, &fops_recv)) |
741 | sc->debug.debugfs_phy, | ||
742 | sc, &fops_interrupt); | ||
743 | if (!sc->debug.debugfs_interrupt) | ||
744 | goto err; | 919 | goto err; |
745 | 920 | ||
746 | sc->debug.debugfs_rcstat = debugfs_create_file("rcstat", | 921 | if (!debugfs_create_file("rx_chainmask", S_IRUSR | S_IWUSR, |
747 | S_IRUSR, | 922 | sc->debug.debugfs_phy, sc, &fops_rx_chainmask)) |
748 | sc->debug.debugfs_phy, | ||
749 | sc, &fops_rcstat); | ||
750 | if (!sc->debug.debugfs_rcstat) | ||
751 | goto err; | 923 | goto err; |
752 | 924 | ||
753 | sc->debug.debugfs_wiphy = debugfs_create_file( | 925 | if (!debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR, |
754 | "wiphy", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, | 926 | sc->debug.debugfs_phy, sc, &fops_tx_chainmask)) |
755 | &fops_wiphy); | ||
756 | if (!sc->debug.debugfs_wiphy) | ||
757 | goto err; | 927 | goto err; |
758 | 928 | ||
759 | sc->debug.debugfs_xmit = debugfs_create_file("xmit", | 929 | if (!debugfs_create_file("regidx", S_IRUSR | S_IWUSR, |
760 | S_IRUSR, | 930 | sc->debug.debugfs_phy, sc, &fops_regidx)) |
761 | sc->debug.debugfs_phy, | ||
762 | sc, &fops_xmit); | ||
763 | if (!sc->debug.debugfs_xmit) | ||
764 | goto err; | 931 | goto err; |
765 | 932 | ||
766 | sc->debug.debugfs_recv = debugfs_create_file("recv", | 933 | if (!debugfs_create_file("regval", S_IRUSR | S_IWUSR, |
767 | S_IRUSR, | 934 | sc->debug.debugfs_phy, sc, &fops_regval)) |
768 | sc->debug.debugfs_phy, | ||
769 | sc, &fops_recv); | ||
770 | if (!sc->debug.debugfs_recv) | ||
771 | goto err; | 935 | goto err; |
772 | 936 | ||
937 | sc->debug.regidx = 0; | ||
773 | return 0; | 938 | return 0; |
774 | err: | 939 | err: |
775 | ath9k_exit_debug(ah); | 940 | ath9k_exit_debug(ah); |
@@ -781,14 +946,7 @@ void ath9k_exit_debug(struct ath_hw *ah) | |||
781 | struct ath_common *common = ath9k_hw_common(ah); | 946 | struct ath_common *common = ath9k_hw_common(ah); |
782 | struct ath_softc *sc = (struct ath_softc *) common->priv; | 947 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
783 | 948 | ||
784 | debugfs_remove(sc->debug.debugfs_recv); | 949 | debugfs_remove_recursive(sc->debug.debugfs_phy); |
785 | debugfs_remove(sc->debug.debugfs_xmit); | ||
786 | debugfs_remove(sc->debug.debugfs_wiphy); | ||
787 | debugfs_remove(sc->debug.debugfs_rcstat); | ||
788 | debugfs_remove(sc->debug.debugfs_interrupt); | ||
789 | debugfs_remove(sc->debug.debugfs_dma); | ||
790 | debugfs_remove(sc->debug.debugfs_debug); | ||
791 | debugfs_remove(sc->debug.debugfs_phy); | ||
792 | } | 950 | } |
793 | 951 | ||
794 | int ath9k_debug_create_root(void) | 952 | int ath9k_debug_create_root(void) |
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h index c545960e7ec5..5147b8709e10 100644 --- a/drivers/net/wireless/ath/ath9k/debug.h +++ b/drivers/net/wireless/ath/ath9k/debug.h | |||
@@ -153,13 +153,7 @@ struct ath_stats { | |||
153 | 153 | ||
154 | struct ath9k_debug { | 154 | struct ath9k_debug { |
155 | struct dentry *debugfs_phy; | 155 | struct dentry *debugfs_phy; |
156 | struct dentry *debugfs_debug; | 156 | u32 regidx; |
157 | struct dentry *debugfs_dma; | ||
158 | struct dentry *debugfs_interrupt; | ||
159 | struct dentry *debugfs_rcstat; | ||
160 | struct dentry *debugfs_wiphy; | ||
161 | struct dentry *debugfs_xmit; | ||
162 | struct dentry *debugfs_recv; | ||
163 | struct ath_stats stats; | 157 | struct ath_stats stats; |
164 | }; | 158 | }; |
165 | 159 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 74872ca76f9a..46dc41a16faa 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -735,6 +735,14 @@ err: | |||
735 | return -ENOMEM; | 735 | return -ENOMEM; |
736 | } | 736 | } |
737 | 737 | ||
738 | static void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev) | ||
739 | { | ||
740 | usb_kill_anchored_urbs(&hif_dev->regout_submitted); | ||
741 | ath9k_hif_usb_dealloc_reg_in_urb(hif_dev); | ||
742 | ath9k_hif_usb_dealloc_tx_urbs(hif_dev); | ||
743 | ath9k_hif_usb_dealloc_rx_urbs(hif_dev); | ||
744 | } | ||
745 | |||
738 | static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev) | 746 | static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev) |
739 | { | 747 | { |
740 | int transfer, err; | 748 | int transfer, err; |
@@ -794,14 +802,6 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev, | |||
794 | goto err_fw_req; | 802 | goto err_fw_req; |
795 | } | 803 | } |
796 | 804 | ||
797 | /* Download firmware */ | ||
798 | ret = ath9k_hif_usb_download_fw(hif_dev); | ||
799 | if (ret) { | ||
800 | dev_err(&hif_dev->udev->dev, | ||
801 | "ath9k_htc: Firmware - %s download failed\n", fw_name); | ||
802 | goto err_fw_download; | ||
803 | } | ||
804 | |||
805 | /* Alloc URBs */ | 805 | /* Alloc URBs */ |
806 | ret = ath9k_hif_usb_alloc_urbs(hif_dev); | 806 | ret = ath9k_hif_usb_alloc_urbs(hif_dev); |
807 | if (ret) { | 807 | if (ret) { |
@@ -810,25 +810,25 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev, | |||
810 | goto err_urb; | 810 | goto err_urb; |
811 | } | 811 | } |
812 | 812 | ||
813 | /* Download firmware */ | ||
814 | ret = ath9k_hif_usb_download_fw(hif_dev); | ||
815 | if (ret) { | ||
816 | dev_err(&hif_dev->udev->dev, | ||
817 | "ath9k_htc: Firmware - %s download failed\n", fw_name); | ||
818 | goto err_fw_download; | ||
819 | } | ||
820 | |||
813 | return 0; | 821 | return 0; |
814 | 822 | ||
815 | err_urb: | ||
816 | /* Nothing */ | ||
817 | err_fw_download: | 823 | err_fw_download: |
824 | ath9k_hif_usb_dealloc_urbs(hif_dev); | ||
825 | err_urb: | ||
818 | release_firmware(hif_dev->firmware); | 826 | release_firmware(hif_dev->firmware); |
819 | err_fw_req: | 827 | err_fw_req: |
820 | hif_dev->firmware = NULL; | 828 | hif_dev->firmware = NULL; |
821 | return ret; | 829 | return ret; |
822 | } | 830 | } |
823 | 831 | ||
824 | static void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev) | ||
825 | { | ||
826 | usb_kill_anchored_urbs(&hif_dev->regout_submitted); | ||
827 | ath9k_hif_usb_dealloc_reg_in_urb(hif_dev); | ||
828 | ath9k_hif_usb_dealloc_tx_urbs(hif_dev); | ||
829 | ath9k_hif_usb_dealloc_rx_urbs(hif_dev); | ||
830 | } | ||
831 | |||
832 | static void ath9k_hif_usb_dev_deinit(struct hif_device_usb *hif_dev) | 832 | static void ath9k_hif_usb_dev_deinit(struct hif_device_usb *hif_dev) |
833 | { | 833 | { |
834 | ath9k_hif_usb_dealloc_urbs(hif_dev); | 834 | ath9k_hif_usb_dealloc_urbs(hif_dev); |
@@ -859,21 +859,21 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, | |||
859 | #endif | 859 | #endif |
860 | usb_set_intfdata(interface, hif_dev); | 860 | usb_set_intfdata(interface, hif_dev); |
861 | 861 | ||
862 | hif_dev->htc_handle = ath9k_htc_hw_alloc(hif_dev, &hif_usb, | ||
863 | &hif_dev->udev->dev); | ||
864 | if (hif_dev->htc_handle == NULL) { | ||
865 | ret = -ENOMEM; | ||
866 | goto err_htc_hw_alloc; | ||
867 | } | ||
868 | |||
862 | ret = ath9k_hif_usb_dev_init(hif_dev, fw_name); | 869 | ret = ath9k_hif_usb_dev_init(hif_dev, fw_name); |
863 | if (ret) { | 870 | if (ret) { |
864 | ret = -EINVAL; | 871 | ret = -EINVAL; |
865 | goto err_hif_init_usb; | 872 | goto err_hif_init_usb; |
866 | } | 873 | } |
867 | 874 | ||
868 | hif_dev->htc_handle = ath9k_htc_hw_alloc(hif_dev); | 875 | ret = ath9k_htc_hw_init(hif_dev->htc_handle, |
869 | if (hif_dev->htc_handle == NULL) { | 876 | &hif_dev->udev->dev, hif_dev->device_id); |
870 | ret = -ENOMEM; | ||
871 | goto err_htc_hw_alloc; | ||
872 | } | ||
873 | |||
874 | ret = ath9k_htc_hw_init(&hif_usb, hif_dev->htc_handle, hif_dev, | ||
875 | &hif_dev->udev->dev, hif_dev->device_id, | ||
876 | ATH9K_HIF_USB); | ||
877 | if (ret) { | 877 | if (ret) { |
878 | ret = -EINVAL; | 878 | ret = -EINVAL; |
879 | goto err_htc_hw_init; | 879 | goto err_htc_hw_init; |
@@ -884,10 +884,10 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, | |||
884 | return 0; | 884 | return 0; |
885 | 885 | ||
886 | err_htc_hw_init: | 886 | err_htc_hw_init: |
887 | ath9k_htc_hw_free(hif_dev->htc_handle); | ||
888 | err_htc_hw_alloc: | ||
889 | ath9k_hif_usb_dev_deinit(hif_dev); | 887 | ath9k_hif_usb_dev_deinit(hif_dev); |
890 | err_hif_init_usb: | 888 | err_hif_init_usb: |
889 | ath9k_htc_hw_free(hif_dev->htc_handle); | ||
890 | err_htc_hw_alloc: | ||
891 | usb_set_intfdata(interface, NULL); | 891 | usb_set_intfdata(interface, NULL); |
892 | kfree(hif_dev); | 892 | kfree(hif_dev); |
893 | usb_put_dev(udev); | 893 | usb_put_dev(udev); |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 17111fc1d2cc..dc015077a8d9 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
@@ -81,6 +81,11 @@ static int ath9k_htc_wait_for_target(struct ath9k_htc_priv *priv) | |||
81 | { | 81 | { |
82 | int time_left; | 82 | int time_left; |
83 | 83 | ||
84 | if (atomic_read(&priv->htc->tgt_ready) > 0) { | ||
85 | atomic_dec(&priv->htc->tgt_ready); | ||
86 | return 0; | ||
87 | } | ||
88 | |||
84 | /* Firmware can take up to 50ms to get ready, to be safe use 1 second */ | 89 | /* Firmware can take up to 50ms to get ready, to be safe use 1 second */ |
85 | time_left = wait_for_completion_timeout(&priv->htc->target_wait, HZ); | 90 | time_left = wait_for_completion_timeout(&priv->htc->target_wait, HZ); |
86 | if (!time_left) { | 91 | if (!time_left) { |
@@ -88,6 +93,8 @@ static int ath9k_htc_wait_for_target(struct ath9k_htc_priv *priv) | |||
88 | return -ETIMEDOUT; | 93 | return -ETIMEDOUT; |
89 | } | 94 | } |
90 | 95 | ||
96 | atomic_dec(&priv->htc->tgt_ready); | ||
97 | |||
91 | return 0; | 98 | return 0; |
92 | } | 99 | } |
93 | 100 | ||
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index 6c386dad1d40..9d371c18eb41 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -1452,6 +1452,8 @@ static void ath9k_htc_sta_notify(struct ieee80211_hw *hw, | |||
1452 | struct ath9k_htc_priv *priv = hw->priv; | 1452 | struct ath9k_htc_priv *priv = hw->priv; |
1453 | int ret; | 1453 | int ret; |
1454 | 1454 | ||
1455 | mutex_lock(&priv->mutex); | ||
1456 | |||
1455 | switch (cmd) { | 1457 | switch (cmd) { |
1456 | case STA_NOTIFY_ADD: | 1458 | case STA_NOTIFY_ADD: |
1457 | ret = ath9k_htc_add_station(priv, vif, sta); | 1459 | ret = ath9k_htc_add_station(priv, vif, sta); |
@@ -1464,6 +1466,8 @@ static void ath9k_htc_sta_notify(struct ieee80211_hw *hw, | |||
1464 | default: | 1466 | default: |
1465 | break; | 1467 | break; |
1466 | } | 1468 | } |
1469 | |||
1470 | mutex_unlock(&priv->mutex); | ||
1467 | } | 1471 | } |
1468 | 1472 | ||
1469 | static int ath9k_htc_conf_tx(struct ieee80211_hw *hw, u16 queue, | 1473 | static int ath9k_htc_conf_tx(struct ieee80211_hw *hw, u16 queue, |
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c index 7bf6ce1e7e2e..064397fd738e 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c | |||
@@ -39,7 +39,7 @@ static struct htc_endpoint *get_next_avail_ep(struct htc_endpoint *endpoint) | |||
39 | { | 39 | { |
40 | enum htc_endpoint_id avail_epid; | 40 | enum htc_endpoint_id avail_epid; |
41 | 41 | ||
42 | for (avail_epid = ENDPOINT_MAX; avail_epid > ENDPOINT0; avail_epid--) | 42 | for (avail_epid = (ENDPOINT_MAX - 1); avail_epid > ENDPOINT0; avail_epid--) |
43 | if (endpoint[avail_epid].service_id == 0) | 43 | if (endpoint[avail_epid].service_id == 0) |
44 | return &endpoint[avail_epid]; | 44 | return &endpoint[avail_epid]; |
45 | return NULL; | 45 | return NULL; |
@@ -95,6 +95,7 @@ static void htc_process_target_rdy(struct htc_target *target, | |||
95 | endpoint = &target->endpoint[ENDPOINT0]; | 95 | endpoint = &target->endpoint[ENDPOINT0]; |
96 | endpoint->service_id = HTC_CTRL_RSVD_SVC; | 96 | endpoint->service_id = HTC_CTRL_RSVD_SVC; |
97 | endpoint->max_msglen = HTC_MAX_CONTROL_MESSAGE_LENGTH; | 97 | endpoint->max_msglen = HTC_MAX_CONTROL_MESSAGE_LENGTH; |
98 | atomic_inc(&target->tgt_ready); | ||
98 | complete(&target->target_wait); | 99 | complete(&target->target_wait); |
99 | } | 100 | } |
100 | 101 | ||
@@ -116,7 +117,7 @@ static void htc_process_conn_rsp(struct htc_target *target, | |||
116 | max_msglen = be16_to_cpu(svc_rspmsg->max_msg_len); | 117 | max_msglen = be16_to_cpu(svc_rspmsg->max_msg_len); |
117 | endpoint = &target->endpoint[epid]; | 118 | endpoint = &target->endpoint[epid]; |
118 | 119 | ||
119 | for (tepid = ENDPOINT_MAX; tepid > ENDPOINT0; tepid--) { | 120 | for (tepid = (ENDPOINT_MAX - 1); tepid > ENDPOINT0; tepid--) { |
120 | tmp_endpoint = &target->endpoint[tepid]; | 121 | tmp_endpoint = &target->endpoint[tepid]; |
121 | if (tmp_endpoint->service_id == service_id) { | 122 | if (tmp_endpoint->service_id == service_id) { |
122 | tmp_endpoint->service_id = 0; | 123 | tmp_endpoint->service_id = 0; |
@@ -124,7 +125,7 @@ static void htc_process_conn_rsp(struct htc_target *target, | |||
124 | } | 125 | } |
125 | } | 126 | } |
126 | 127 | ||
127 | if (!tmp_endpoint) | 128 | if (tepid == ENDPOINT0) |
128 | return; | 129 | return; |
129 | 130 | ||
130 | endpoint->service_id = service_id; | 131 | endpoint->service_id = service_id; |
@@ -297,7 +298,7 @@ void htc_stop(struct htc_target *target) | |||
297 | enum htc_endpoint_id epid; | 298 | enum htc_endpoint_id epid; |
298 | struct htc_endpoint *endpoint; | 299 | struct htc_endpoint *endpoint; |
299 | 300 | ||
300 | for (epid = ENDPOINT0; epid <= ENDPOINT_MAX; epid++) { | 301 | for (epid = ENDPOINT0; epid < ENDPOINT_MAX; epid++) { |
301 | endpoint = &target->endpoint[epid]; | 302 | endpoint = &target->endpoint[epid]; |
302 | if (endpoint->service_id != 0) | 303 | if (endpoint->service_id != 0) |
303 | target->hif->stop(target->hif_dev, endpoint->ul_pipeid); | 304 | target->hif->stop(target->hif_dev, endpoint->ul_pipeid); |
@@ -309,7 +310,7 @@ void htc_start(struct htc_target *target) | |||
309 | enum htc_endpoint_id epid; | 310 | enum htc_endpoint_id epid; |
310 | struct htc_endpoint *endpoint; | 311 | struct htc_endpoint *endpoint; |
311 | 312 | ||
312 | for (epid = ENDPOINT0; epid <= ENDPOINT_MAX; epid++) { | 313 | for (epid = ENDPOINT0; epid < ENDPOINT_MAX; epid++) { |
313 | endpoint = &target->endpoint[epid]; | 314 | endpoint = &target->endpoint[epid]; |
314 | if (endpoint->service_id != 0) | 315 | if (endpoint->service_id != 0) |
315 | target->hif->start(target->hif_dev, | 316 | target->hif->start(target->hif_dev, |
@@ -425,29 +426,19 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle, | |||
425 | } | 426 | } |
426 | } | 427 | } |
427 | 428 | ||
428 | struct htc_target *ath9k_htc_hw_alloc(void *hif_handle) | 429 | struct htc_target *ath9k_htc_hw_alloc(void *hif_handle, |
430 | struct ath9k_htc_hif *hif, | ||
431 | struct device *dev) | ||
429 | { | 432 | { |
433 | struct htc_endpoint *endpoint; | ||
430 | struct htc_target *target; | 434 | struct htc_target *target; |
431 | 435 | ||
432 | target = kzalloc(sizeof(struct htc_target), GFP_KERNEL); | 436 | target = kzalloc(sizeof(struct htc_target), GFP_KERNEL); |
433 | if (!target) | 437 | if (!target) { |
434 | printk(KERN_ERR "Unable to allocate memory for" | 438 | printk(KERN_ERR "Unable to allocate memory for" |
435 | "target device\n"); | 439 | "target device\n"); |
436 | 440 | return NULL; | |
437 | return target; | 441 | } |
438 | } | ||
439 | |||
440 | void ath9k_htc_hw_free(struct htc_target *htc) | ||
441 | { | ||
442 | kfree(htc); | ||
443 | } | ||
444 | |||
445 | int ath9k_htc_hw_init(struct ath9k_htc_hif *hif, struct htc_target *target, | ||
446 | void *hif_handle, struct device *dev, u16 devid, | ||
447 | enum ath9k_hif_transports transport) | ||
448 | { | ||
449 | struct htc_endpoint *endpoint; | ||
450 | int err = 0; | ||
451 | 442 | ||
452 | init_completion(&target->target_wait); | 443 | init_completion(&target->target_wait); |
453 | init_completion(&target->cmd_wait); | 444 | init_completion(&target->cmd_wait); |
@@ -461,8 +452,20 @@ int ath9k_htc_hw_init(struct ath9k_htc_hif *hif, struct htc_target *target, | |||
461 | endpoint->ul_pipeid = hif->control_ul_pipe; | 452 | endpoint->ul_pipeid = hif->control_ul_pipe; |
462 | endpoint->dl_pipeid = hif->control_dl_pipe; | 453 | endpoint->dl_pipeid = hif->control_dl_pipe; |
463 | 454 | ||
464 | err = ath9k_htc_probe_device(target, dev, devid); | 455 | atomic_set(&target->tgt_ready, 0); |
465 | if (err) { | 456 | |
457 | return target; | ||
458 | } | ||
459 | |||
460 | void ath9k_htc_hw_free(struct htc_target *htc) | ||
461 | { | ||
462 | kfree(htc); | ||
463 | } | ||
464 | |||
465 | int ath9k_htc_hw_init(struct htc_target *target, | ||
466 | struct device *dev, u16 devid) | ||
467 | { | ||
468 | if (ath9k_htc_probe_device(target, dev, devid)) { | ||
466 | printk(KERN_ERR "Failed to initialize the device\n"); | 469 | printk(KERN_ERR "Failed to initialize the device\n"); |
467 | return -ENODEV; | 470 | return -ENODEV; |
468 | } | 471 | } |
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.h b/drivers/net/wireless/ath/ath9k/htc_hst.h index ea50ab032d20..faba6790328b 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.h +++ b/drivers/net/wireless/ath/ath9k/htc_hst.h | |||
@@ -123,9 +123,6 @@ struct htc_endpoint { | |||
123 | #define HTC_CONTROL_BUFFER_SIZE \ | 123 | #define HTC_CONTROL_BUFFER_SIZE \ |
124 | (HTC_MAX_CONTROL_MESSAGE_LENGTH + sizeof(struct htc_frame_hdr)) | 124 | (HTC_MAX_CONTROL_MESSAGE_LENGTH + sizeof(struct htc_frame_hdr)) |
125 | 125 | ||
126 | #define NUM_CONTROL_BUFFERS 8 | ||
127 | #define HST_ENDPOINT_MAX 8 | ||
128 | |||
129 | struct htc_control_buf { | 126 | struct htc_control_buf { |
130 | struct htc_packet htc_pkt; | 127 | struct htc_packet htc_pkt; |
131 | u8 buf[HTC_CONTROL_BUFFER_SIZE]; | 128 | u8 buf[HTC_CONTROL_BUFFER_SIZE]; |
@@ -139,7 +136,7 @@ struct htc_target { | |||
139 | struct ath9k_htc_priv *drv_priv; | 136 | struct ath9k_htc_priv *drv_priv; |
140 | struct device *dev; | 137 | struct device *dev; |
141 | struct ath9k_htc_hif *hif; | 138 | struct ath9k_htc_hif *hif; |
142 | struct htc_endpoint endpoint[HST_ENDPOINT_MAX]; | 139 | struct htc_endpoint endpoint[ENDPOINT_MAX]; |
143 | struct completion target_wait; | 140 | struct completion target_wait; |
144 | struct completion cmd_wait; | 141 | struct completion cmd_wait; |
145 | struct list_head list; | 142 | struct list_head list; |
@@ -147,6 +144,7 @@ struct htc_target { | |||
147 | u16 credits; | 144 | u16 credits; |
148 | u16 credit_size; | 145 | u16 credit_size; |
149 | u8 htc_flags; | 146 | u8 htc_flags; |
147 | atomic_t tgt_ready; | ||
150 | }; | 148 | }; |
151 | 149 | ||
152 | enum htc_msg_id { | 150 | enum htc_msg_id { |
@@ -236,11 +234,12 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle, | |||
236 | void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, | 234 | void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, |
237 | struct sk_buff *skb, bool txok); | 235 | struct sk_buff *skb, bool txok); |
238 | 236 | ||
239 | struct htc_target *ath9k_htc_hw_alloc(void *hif_handle); | 237 | struct htc_target *ath9k_htc_hw_alloc(void *hif_handle, |
238 | struct ath9k_htc_hif *hif, | ||
239 | struct device *dev); | ||
240 | void ath9k_htc_hw_free(struct htc_target *htc); | 240 | void ath9k_htc_hw_free(struct htc_target *htc); |
241 | int ath9k_htc_hw_init(struct ath9k_htc_hif *hif, struct htc_target *target, | 241 | int ath9k_htc_hw_init(struct htc_target *target, |
242 | void *hif_handle, struct device *dev, u16 devid, | 242 | struct device *dev, u16 devid); |
243 | enum ath9k_hif_transports transport); | ||
244 | void ath9k_htc_hw_deinit(struct htc_target *target, bool hot_unplug); | 243 | void ath9k_htc_hw_deinit(struct htc_target *target, bool hot_unplug); |
245 | 244 | ||
246 | #endif /* HTC_HST_H */ | 245 | #endif /* HTC_HST_H */ |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index ac60c4ee62d3..ba139132c85f 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -150,11 +150,9 @@ static bool ath_rx_edma_buf_link(struct ath_softc *sc, | |||
150 | static void ath_rx_addbuffer_edma(struct ath_softc *sc, | 150 | static void ath_rx_addbuffer_edma(struct ath_softc *sc, |
151 | enum ath9k_rx_qtype qtype, int size) | 151 | enum ath9k_rx_qtype qtype, int size) |
152 | { | 152 | { |
153 | struct ath_rx_edma *rx_edma; | ||
154 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 153 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
155 | u32 nbuf = 0; | 154 | u32 nbuf = 0; |
156 | 155 | ||
157 | rx_edma = &sc->rx.rx_edma[qtype]; | ||
158 | if (list_empty(&sc->rx.rxbuf)) { | 156 | if (list_empty(&sc->rx.rxbuf)) { |
159 | ath_print(common, ATH_DBG_QUEUE, "No free rx buf available\n"); | 157 | ath_print(common, ATH_DBG_QUEUE, "No free rx buf available\n"); |
160 | return; | 158 | return; |
@@ -718,6 +716,7 @@ static bool ath_edma_get_buffers(struct ath_softc *sc, | |||
718 | __skb_unlink(skb, &rx_edma->rx_fifo); | 716 | __skb_unlink(skb, &rx_edma->rx_fifo); |
719 | list_add_tail(&bf->list, &sc->rx.rxbuf); | 717 | list_add_tail(&bf->list, &sc->rx.rxbuf); |
720 | ath_rx_edma_buf_link(sc, qtype); | 718 | ath_rx_edma_buf_link(sc, qtype); |
719 | return true; | ||
721 | } | 720 | } |
722 | skb_queue_tail(&rx_edma->rx_buffers, skb); | 721 | skb_queue_tail(&rx_edma->rx_buffers, skb); |
723 | 722 | ||
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c index f4c56121d387..e0b3e8d406b3 100644 --- a/drivers/net/wireless/hostap/hostap_80211_rx.c +++ b/drivers/net/wireless/hostap/hostap_80211_rx.c | |||
@@ -355,8 +355,7 @@ static struct hostap_bss_info *__hostap_add_bss(local_info_t *local, u8 *bssid, | |||
355 | list_del(&bss->list); | 355 | list_del(&bss->list); |
356 | local->num_bss_info--; | 356 | local->num_bss_info--; |
357 | } else { | 357 | } else { |
358 | bss = (struct hostap_bss_info *) | 358 | bss = kmalloc(sizeof(*bss), GFP_ATOMIC); |
359 | kmalloc(sizeof(*bss), GFP_ATOMIC); | ||
360 | if (bss == NULL) | 359 | if (bss == NULL) |
361 | return NULL; | 360 | return NULL; |
362 | } | 361 | } |
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index 9a082308a9d4..a85e43a8d758 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c | |||
@@ -3039,8 +3039,7 @@ static int prism2_ioctl_priv_download(local_info_t *local, struct iw_point *p) | |||
3039 | p->length > 1024 || !p->pointer) | 3039 | p->length > 1024 || !p->pointer) |
3040 | return -EINVAL; | 3040 | return -EINVAL; |
3041 | 3041 | ||
3042 | param = (struct prism2_download_param *) | 3042 | param = kmalloc(p->length, GFP_KERNEL); |
3043 | kmalloc(p->length, GFP_KERNEL); | ||
3044 | if (param == NULL) | 3043 | if (param == NULL) |
3045 | return -ENOMEM; | 3044 | return -ENOMEM; |
3046 | 3045 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index fb59af2d41c6..6be2992f8f21 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -212,7 +212,7 @@ static struct iwl_lib_ops iwl1000_lib = { | |||
212 | .temperature = iwlagn_temperature, | 212 | .temperature = iwlagn_temperature, |
213 | .set_ct_kill = iwl1000_set_ct_threshold, | 213 | .set_ct_kill = iwl1000_set_ct_threshold, |
214 | }, | 214 | }, |
215 | .add_bcast_station = iwl_add_bcast_station, | 215 | .manage_ibss_station = iwlagn_manage_ibss_station, |
216 | .debugfs_ops = { | 216 | .debugfs_ops = { |
217 | .rx_stats_read = iwl_ucode_rx_stats_read, | 217 | .rx_stats_read = iwl_ucode_rx_stats_read, |
218 | .tx_stats_read = iwl_ucode_tx_stats_read, | 218 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -224,7 +224,6 @@ static struct iwl_lib_ops iwl1000_lib = { | |||
224 | }; | 224 | }; |
225 | 225 | ||
226 | static const struct iwl_ops iwl1000_ops = { | 226 | static const struct iwl_ops iwl1000_ops = { |
227 | .ucode = &iwlagn_ucode, | ||
228 | .lib = &iwl1000_lib, | 227 | .lib = &iwl1000_lib, |
229 | .hcmd = &iwlagn_hcmd, | 228 | .hcmd = &iwlagn_hcmd, |
230 | .utils = &iwlagn_hcmd_utils, | 229 | .utils = &iwlagn_hcmd_utils, |
@@ -260,6 +259,9 @@ struct iwl_cfg iwl1000_bgn_cfg = { | |||
260 | .chain_noise_scale = 1000, | 259 | .chain_noise_scale = 1000, |
261 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 260 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
262 | .max_event_log_size = 128, | 261 | .max_event_log_size = 128, |
262 | .ucode_tracing = true, | ||
263 | .sensitivity_calib_by_driver = true, | ||
264 | .chain_noise_calib_by_driver = true, | ||
263 | }; | 265 | }; |
264 | 266 | ||
265 | struct iwl_cfg iwl1000_bg_cfg = { | 267 | struct iwl_cfg iwl1000_bg_cfg = { |
@@ -289,6 +291,9 @@ struct iwl_cfg iwl1000_bg_cfg = { | |||
289 | .chain_noise_scale = 1000, | 291 | .chain_noise_scale = 1000, |
290 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 292 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
291 | .max_event_log_size = 128, | 293 | .max_event_log_size = 128, |
294 | .ucode_tracing = true, | ||
295 | .sensitivity_calib_by_driver = true, | ||
296 | .chain_noise_calib_by_driver = true, | ||
292 | }; | 297 | }; |
293 | 298 | ||
294 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); | 299 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 99b876a2feb9..068f7f8435c5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -391,6 +391,67 @@ static void iwl3945_accumulative_statistics(struct iwl_priv *priv, | |||
391 | } | 391 | } |
392 | #endif | 392 | #endif |
393 | 393 | ||
394 | /** | ||
395 | * iwl3945_good_plcp_health - checks for plcp error. | ||
396 | * | ||
397 | * When the plcp error is exceeding the thresholds, reset the radio | ||
398 | * to improve the throughput. | ||
399 | */ | ||
400 | static bool iwl3945_good_plcp_health(struct iwl_priv *priv, | ||
401 | struct iwl_rx_packet *pkt) | ||
402 | { | ||
403 | bool rc = true; | ||
404 | struct iwl3945_notif_statistics current_stat; | ||
405 | int combined_plcp_delta; | ||
406 | unsigned int plcp_msec; | ||
407 | unsigned long plcp_received_jiffies; | ||
408 | |||
409 | memcpy(¤t_stat, pkt->u.raw, sizeof(struct | ||
410 | iwl3945_notif_statistics)); | ||
411 | /* | ||
412 | * check for plcp_err and trigger radio reset if it exceeds | ||
413 | * the plcp error threshold plcp_delta. | ||
414 | */ | ||
415 | plcp_received_jiffies = jiffies; | ||
416 | plcp_msec = jiffies_to_msecs((long) plcp_received_jiffies - | ||
417 | (long) priv->plcp_jiffies); | ||
418 | priv->plcp_jiffies = plcp_received_jiffies; | ||
419 | /* | ||
420 | * check to make sure plcp_msec is not 0 to prevent division | ||
421 | * by zero. | ||
422 | */ | ||
423 | if (plcp_msec) { | ||
424 | combined_plcp_delta = | ||
425 | (le32_to_cpu(current_stat.rx.ofdm.plcp_err) - | ||
426 | le32_to_cpu(priv->_3945.statistics.rx.ofdm.plcp_err)); | ||
427 | |||
428 | if ((combined_plcp_delta > 0) && | ||
429 | ((combined_plcp_delta * 100) / plcp_msec) > | ||
430 | priv->cfg->plcp_delta_threshold) { | ||
431 | /* | ||
432 | * if plcp_err exceed the threshold, the following | ||
433 | * data is printed in csv format: | ||
434 | * Text: plcp_err exceeded %d, | ||
435 | * Received ofdm.plcp_err, | ||
436 | * Current ofdm.plcp_err, | ||
437 | * combined_plcp_delta, | ||
438 | * plcp_msec | ||
439 | */ | ||
440 | IWL_DEBUG_RADIO(priv, "plcp_err exceeded %u, " | ||
441 | "%u, %d, %u mSecs\n", | ||
442 | priv->cfg->plcp_delta_threshold, | ||
443 | le32_to_cpu(current_stat.rx.ofdm.plcp_err), | ||
444 | combined_plcp_delta, plcp_msec); | ||
445 | /* | ||
446 | * Reset the RF radio due to the high plcp | ||
447 | * error rate | ||
448 | */ | ||
449 | rc = false; | ||
450 | } | ||
451 | } | ||
452 | return rc; | ||
453 | } | ||
454 | |||
394 | void iwl3945_hw_rx_statistics(struct iwl_priv *priv, | 455 | void iwl3945_hw_rx_statistics(struct iwl_priv *priv, |
395 | struct iwl_rx_mem_buffer *rxb) | 456 | struct iwl_rx_mem_buffer *rxb) |
396 | { | 457 | { |
@@ -402,6 +463,7 @@ void iwl3945_hw_rx_statistics(struct iwl_priv *priv, | |||
402 | #ifdef CONFIG_IWLWIFI_DEBUG | 463 | #ifdef CONFIG_IWLWIFI_DEBUG |
403 | iwl3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw); | 464 | iwl3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw); |
404 | #endif | 465 | #endif |
466 | iwl_recover_from_statistics(priv, pkt); | ||
405 | 467 | ||
406 | memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); | 468 | memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); |
407 | } | 469 | } |
@@ -885,7 +947,8 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, | |||
885 | tx_cmd->supp_rates[1], tx_cmd->supp_rates[0]); | 947 | tx_cmd->supp_rates[1], tx_cmd->supp_rates[0]); |
886 | } | 948 | } |
887 | 949 | ||
888 | u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags) | 950 | static u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, |
951 | u16 tx_rate, u8 flags) | ||
889 | { | 952 | { |
890 | unsigned long flags_spin; | 953 | unsigned long flags_spin; |
891 | struct iwl_station_entry *station; | 954 | struct iwl_station_entry *station; |
@@ -1715,6 +1778,11 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl_priv *priv) | |||
1715 | int ref_temp; | 1778 | int ref_temp; |
1716 | int temperature = priv->temperature; | 1779 | int temperature = priv->temperature; |
1717 | 1780 | ||
1781 | if (priv->disable_tx_power_cal || | ||
1782 | test_bit(STATUS_SCANNING, &priv->status)) { | ||
1783 | /* do not perform tx power calibration */ | ||
1784 | return 0; | ||
1785 | } | ||
1718 | /* set up new Tx power info for each and every channel, 2.4 and 5.x */ | 1786 | /* set up new Tx power info for each and every channel, 2.4 and 5.x */ |
1719 | for (i = 0; i < priv->channel_count; i++) { | 1787 | for (i = 0; i < priv->channel_count; i++) { |
1720 | ch_info = &priv->channel_info[i]; | 1788 | ch_info = &priv->channel_info[i]; |
@@ -1925,7 +1993,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1925 | "configuration (%d).\n", rc); | 1993 | "configuration (%d).\n", rc); |
1926 | return rc; | 1994 | return rc; |
1927 | } | 1995 | } |
1928 | iwl_clear_ucode_stations(priv, false); | 1996 | iwl_clear_ucode_stations(priv); |
1929 | iwl_restore_stations(priv); | 1997 | iwl_restore_stations(priv); |
1930 | } | 1998 | } |
1931 | 1999 | ||
@@ -1958,7 +2026,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1958 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); | 2026 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); |
1959 | 2027 | ||
1960 | if (!new_assoc) { | 2028 | if (!new_assoc) { |
1961 | iwl_clear_ucode_stations(priv, false); | 2029 | iwl_clear_ucode_stations(priv); |
1962 | iwl_restore_stations(priv); | 2030 | iwl_restore_stations(priv); |
1963 | } | 2031 | } |
1964 | 2032 | ||
@@ -2391,6 +2459,30 @@ static u16 iwl3945_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data) | |||
2391 | return (u16)sizeof(struct iwl3945_addsta_cmd); | 2459 | return (u16)sizeof(struct iwl3945_addsta_cmd); |
2392 | } | 2460 | } |
2393 | 2461 | ||
2462 | static int iwl3945_manage_ibss_station(struct iwl_priv *priv, | ||
2463 | struct ieee80211_vif *vif, bool add) | ||
2464 | { | ||
2465 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | ||
2466 | int ret; | ||
2467 | |||
2468 | if (add) { | ||
2469 | ret = iwl_add_bssid_station(priv, vif->bss_conf.bssid, false, | ||
2470 | &vif_priv->ibss_bssid_sta_id); | ||
2471 | if (ret) | ||
2472 | return ret; | ||
2473 | |||
2474 | iwl3945_sync_sta(priv, vif_priv->ibss_bssid_sta_id, | ||
2475 | (priv->band == IEEE80211_BAND_5GHZ) ? | ||
2476 | IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP, | ||
2477 | CMD_ASYNC); | ||
2478 | iwl3945_rate_scale_init(priv->hw, vif_priv->ibss_bssid_sta_id); | ||
2479 | |||
2480 | return 0; | ||
2481 | } | ||
2482 | |||
2483 | return iwl_remove_station(priv, vif_priv->ibss_bssid_sta_id, | ||
2484 | vif->bss_conf.bssid); | ||
2485 | } | ||
2394 | 2486 | ||
2395 | /** | 2487 | /** |
2396 | * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table | 2488 | * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table |
@@ -2720,51 +2812,12 @@ static int iwl3945_load_bsm(struct iwl_priv *priv) | |||
2720 | return 0; | 2812 | return 0; |
2721 | } | 2813 | } |
2722 | 2814 | ||
2723 | #define IWL3945_UCODE_GET(item) \ | ||
2724 | static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode,\ | ||
2725 | u32 api_ver) \ | ||
2726 | { \ | ||
2727 | return le32_to_cpu(ucode->u.v1.item); \ | ||
2728 | } | ||
2729 | |||
2730 | static u32 iwl3945_ucode_get_header_size(u32 api_ver) | ||
2731 | { | ||
2732 | return UCODE_HEADER_SIZE(1); | ||
2733 | } | ||
2734 | static u32 iwl3945_ucode_get_build(const struct iwl_ucode_header *ucode, | ||
2735 | u32 api_ver) | ||
2736 | { | ||
2737 | return 0; | ||
2738 | } | ||
2739 | static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode, | ||
2740 | u32 api_ver) | ||
2741 | { | ||
2742 | return (u8 *) ucode->u.v1.data; | ||
2743 | } | ||
2744 | |||
2745 | IWL3945_UCODE_GET(inst_size); | ||
2746 | IWL3945_UCODE_GET(data_size); | ||
2747 | IWL3945_UCODE_GET(init_size); | ||
2748 | IWL3945_UCODE_GET(init_data_size); | ||
2749 | IWL3945_UCODE_GET(boot_size); | ||
2750 | |||
2751 | static struct iwl_hcmd_ops iwl3945_hcmd = { | 2815 | static struct iwl_hcmd_ops iwl3945_hcmd = { |
2752 | .rxon_assoc = iwl3945_send_rxon_assoc, | 2816 | .rxon_assoc = iwl3945_send_rxon_assoc, |
2753 | .commit_rxon = iwl3945_commit_rxon, | 2817 | .commit_rxon = iwl3945_commit_rxon, |
2754 | .send_bt_config = iwl_send_bt_config, | 2818 | .send_bt_config = iwl_send_bt_config, |
2755 | }; | 2819 | }; |
2756 | 2820 | ||
2757 | static struct iwl_ucode_ops iwl3945_ucode = { | ||
2758 | .get_header_size = iwl3945_ucode_get_header_size, | ||
2759 | .get_build = iwl3945_ucode_get_build, | ||
2760 | .get_inst_size = iwl3945_ucode_get_inst_size, | ||
2761 | .get_data_size = iwl3945_ucode_get_data_size, | ||
2762 | .get_init_size = iwl3945_ucode_get_init_size, | ||
2763 | .get_init_data_size = iwl3945_ucode_get_init_data_size, | ||
2764 | .get_boot_size = iwl3945_ucode_get_boot_size, | ||
2765 | .get_data = iwl3945_ucode_get_data, | ||
2766 | }; | ||
2767 | |||
2768 | static struct iwl_lib_ops iwl3945_lib = { | 2821 | static struct iwl_lib_ops iwl3945_lib = { |
2769 | .txq_attach_buf_to_tfd = iwl3945_hw_txq_attach_buf_to_tfd, | 2822 | .txq_attach_buf_to_tfd = iwl3945_hw_txq_attach_buf_to_tfd, |
2770 | .txq_free_tfd = iwl3945_hw_txq_free_tfd, | 2823 | .txq_free_tfd = iwl3945_hw_txq_free_tfd, |
@@ -2798,7 +2851,8 @@ static struct iwl_lib_ops iwl3945_lib = { | |||
2798 | .post_associate = iwl3945_post_associate, | 2851 | .post_associate = iwl3945_post_associate, |
2799 | .isr = iwl_isr_legacy, | 2852 | .isr = iwl_isr_legacy, |
2800 | .config_ap = iwl3945_config_ap, | 2853 | .config_ap = iwl3945_config_ap, |
2801 | .add_bcast_station = iwl3945_add_bcast_station, | 2854 | .manage_ibss_station = iwl3945_manage_ibss_station, |
2855 | .check_plcp_health = iwl3945_good_plcp_health, | ||
2802 | 2856 | ||
2803 | .debugfs_ops = { | 2857 | .debugfs_ops = { |
2804 | .rx_stats_read = iwl3945_ucode_rx_stats_read, | 2858 | .rx_stats_read = iwl3945_ucode_rx_stats_read, |
@@ -2815,7 +2869,6 @@ static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { | |||
2815 | }; | 2869 | }; |
2816 | 2870 | ||
2817 | static const struct iwl_ops iwl3945_ops = { | 2871 | static const struct iwl_ops iwl3945_ops = { |
2818 | .ucode = &iwl3945_ucode, | ||
2819 | .lib = &iwl3945_lib, | 2872 | .lib = &iwl3945_lib, |
2820 | .hcmd = &iwl3945_hcmd, | 2873 | .hcmd = &iwl3945_hcmd, |
2821 | .utils = &iwl3945_hcmd_utils, | 2874 | .utils = &iwl3945_hcmd_utils, |
@@ -2840,9 +2893,10 @@ static struct iwl_cfg iwl3945_bg_cfg = { | |||
2840 | .ht_greenfield_support = false, | 2893 | .ht_greenfield_support = false, |
2841 | .led_compensation = 64, | 2894 | .led_compensation = 64, |
2842 | .broken_powersave = true, | 2895 | .broken_powersave = true, |
2843 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 2896 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, |
2844 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 2897 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
2845 | .max_event_log_size = 512, | 2898 | .max_event_log_size = 512, |
2899 | .tx_power_by_driver = true, | ||
2846 | }; | 2900 | }; |
2847 | 2901 | ||
2848 | static struct iwl_cfg iwl3945_abg_cfg = { | 2902 | static struct iwl_cfg iwl3945_abg_cfg = { |
@@ -2860,9 +2914,10 @@ static struct iwl_cfg iwl3945_abg_cfg = { | |||
2860 | .ht_greenfield_support = false, | 2914 | .ht_greenfield_support = false, |
2861 | .led_compensation = 64, | 2915 | .led_compensation = 64, |
2862 | .broken_powersave = true, | 2916 | .broken_powersave = true, |
2863 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 2917 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, |
2864 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 2918 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
2865 | .max_event_log_size = 512, | 2919 | .max_event_log_size = 512, |
2920 | .tx_power_by_driver = true, | ||
2866 | }; | 2921 | }; |
2867 | 2922 | ||
2868 | DEFINE_PCI_DEVICE_TABLE(iwl3945_hw_card_ids) = { | 2923 | DEFINE_PCI_DEVICE_TABLE(iwl3945_hw_card_ids) = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index 643adb644bb8..bb2aeebf3652 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -106,7 +106,12 @@ struct iwl3945_rs_sta { | |||
106 | }; | 106 | }; |
107 | 107 | ||
108 | 108 | ||
109 | /* | ||
110 | * The common struct MUST be first because it is shared between | ||
111 | * 3945 and agn! | ||
112 | */ | ||
109 | struct iwl3945_sta_priv { | 113 | struct iwl3945_sta_priv { |
114 | struct iwl_station_priv_common common; | ||
110 | struct iwl3945_rs_sta rs_sta; | 115 | struct iwl3945_rs_sta rs_sta; |
111 | }; | 116 | }; |
112 | 117 | ||
@@ -211,13 +216,6 @@ extern int iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log, | |||
211 | char **buf, bool display); | 216 | char **buf, bool display); |
212 | extern void iwl3945_dump_nic_error_log(struct iwl_priv *priv); | 217 | extern void iwl3945_dump_nic_error_log(struct iwl_priv *priv); |
213 | 218 | ||
214 | /* | ||
215 | * Currently used by iwl-3945-rs... look at restructuring so that it doesn't | ||
216 | * call this... todo... fix that. | ||
217 | */ | ||
218 | extern u8 iwl3945_sync_station(struct iwl_priv *priv, int sta_id, | ||
219 | u16 tx_rate, u8 flags); | ||
220 | |||
221 | /****************************************************************************** | 219 | /****************************************************************************** |
222 | * | 220 | * |
223 | * Functions implemented in iwl-[34]*.c which are forward declared here | 221 | * Functions implemented in iwl-[34]*.c which are forward declared here |
@@ -268,8 +266,10 @@ void iwl3945_reply_statistics(struct iwl_priv *priv, | |||
268 | struct iwl_rx_mem_buffer *rxb); | 266 | struct iwl_rx_mem_buffer *rxb); |
269 | extern void iwl3945_disable_events(struct iwl_priv *priv); | 267 | extern void iwl3945_disable_events(struct iwl_priv *priv); |
270 | extern int iwl4965_get_temperature(const struct iwl_priv *priv); | 268 | extern int iwl4965_get_temperature(const struct iwl_priv *priv); |
271 | extern void iwl3945_post_associate(struct iwl_priv *priv); | 269 | extern void iwl3945_post_associate(struct iwl_priv *priv, |
272 | extern void iwl3945_config_ap(struct iwl_priv *priv); | 270 | struct ieee80211_vif *vif); |
271 | extern void iwl3945_config_ap(struct iwl_priv *priv, | ||
272 | struct ieee80211_vif *vif); | ||
273 | 273 | ||
274 | /** | 274 | /** |
275 | * iwl3945_hw_find_station - Find station id for a given BSSID | 275 | * iwl3945_hw_find_station - Find station id for a given BSSID |
@@ -288,8 +288,6 @@ extern __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv); | |||
288 | extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv); | 288 | extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv); |
289 | extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv); | 289 | extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv); |
290 | extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv); | 290 | extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv); |
291 | extern u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, | ||
292 | u16 tx_rate, u8 flags); | ||
293 | 291 | ||
294 | extern const struct iwl_channel_info *iwl3945_get_channel_info( | 292 | extern const struct iwl_channel_info *iwl3945_get_channel_info( |
295 | const struct iwl_priv *priv, enum ieee80211_band band, u16 channel); | 293 | const struct iwl_priv *priv, enum ieee80211_band band, u16 channel); |
@@ -297,7 +295,7 @@ extern const struct iwl_channel_info *iwl3945_get_channel_info( | |||
297 | extern int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate); | 295 | extern int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate); |
298 | 296 | ||
299 | /* scanning */ | 297 | /* scanning */ |
300 | void iwl3945_request_scan(struct iwl_priv *priv); | 298 | void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif); |
301 | 299 | ||
302 | /* Requires full declaration of iwl_priv before including */ | 300 | /* Requires full declaration of iwl_priv before including */ |
303 | #include "iwl-io.h" | 301 | #include "iwl-io.h" |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 136c29067489..d3afddae8d9f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -1953,6 +1953,60 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, | |||
1953 | return 0; | 1953 | return 0; |
1954 | } | 1954 | } |
1955 | 1955 | ||
1956 | static u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr) | ||
1957 | { | ||
1958 | int i; | ||
1959 | int start = 0; | ||
1960 | int ret = IWL_INVALID_STATION; | ||
1961 | unsigned long flags; | ||
1962 | |||
1963 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) || | ||
1964 | (priv->iw_mode == NL80211_IFTYPE_AP)) | ||
1965 | start = IWL_STA_ID; | ||
1966 | |||
1967 | if (is_broadcast_ether_addr(addr)) | ||
1968 | return priv->hw_params.bcast_sta_id; | ||
1969 | |||
1970 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
1971 | for (i = start; i < priv->hw_params.max_stations; i++) | ||
1972 | if (priv->stations[i].used && | ||
1973 | (!compare_ether_addr(priv->stations[i].sta.sta.addr, | ||
1974 | addr))) { | ||
1975 | ret = i; | ||
1976 | goto out; | ||
1977 | } | ||
1978 | |||
1979 | IWL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n", | ||
1980 | addr, priv->num_stations); | ||
1981 | |||
1982 | out: | ||
1983 | /* | ||
1984 | * It may be possible that more commands interacting with stations | ||
1985 | * arrive before we completed processing the adding of | ||
1986 | * station | ||
1987 | */ | ||
1988 | if (ret != IWL_INVALID_STATION && | ||
1989 | (!(priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) || | ||
1990 | ((priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) && | ||
1991 | (priv->stations[ret].used & IWL_STA_UCODE_INPROGRESS)))) { | ||
1992 | IWL_ERR(priv, "Requested station info for sta %d before ready.\n", | ||
1993 | ret); | ||
1994 | ret = IWL_INVALID_STATION; | ||
1995 | } | ||
1996 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
1997 | return ret; | ||
1998 | } | ||
1999 | |||
2000 | static int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | ||
2001 | { | ||
2002 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { | ||
2003 | return IWL_AP_ID; | ||
2004 | } else { | ||
2005 | u8 *da = ieee80211_get_DA(hdr); | ||
2006 | return iwl_find_station(priv, da); | ||
2007 | } | ||
2008 | } | ||
2009 | |||
1956 | /** | 2010 | /** |
1957 | * iwl4965_rx_reply_tx - Handle standard (non-aggregation) Tx response | 2011 | * iwl4965_rx_reply_tx - Handle standard (non-aggregation) Tx response |
1958 | */ | 2012 | */ |
@@ -2112,34 +2166,6 @@ static void iwl4965_cancel_deferred_work(struct iwl_priv *priv) | |||
2112 | cancel_work_sync(&priv->txpower_work); | 2166 | cancel_work_sync(&priv->txpower_work); |
2113 | } | 2167 | } |
2114 | 2168 | ||
2115 | #define IWL4965_UCODE_GET(item) \ | ||
2116 | static u32 iwl4965_ucode_get_##item(const struct iwl_ucode_header *ucode,\ | ||
2117 | u32 api_ver) \ | ||
2118 | { \ | ||
2119 | return le32_to_cpu(ucode->u.v1.item); \ | ||
2120 | } | ||
2121 | |||
2122 | static u32 iwl4965_ucode_get_header_size(u32 api_ver) | ||
2123 | { | ||
2124 | return UCODE_HEADER_SIZE(1); | ||
2125 | } | ||
2126 | static u32 iwl4965_ucode_get_build(const struct iwl_ucode_header *ucode, | ||
2127 | u32 api_ver) | ||
2128 | { | ||
2129 | return 0; | ||
2130 | } | ||
2131 | static u8 *iwl4965_ucode_get_data(const struct iwl_ucode_header *ucode, | ||
2132 | u32 api_ver) | ||
2133 | { | ||
2134 | return (u8 *) ucode->u.v1.data; | ||
2135 | } | ||
2136 | |||
2137 | IWL4965_UCODE_GET(inst_size); | ||
2138 | IWL4965_UCODE_GET(data_size); | ||
2139 | IWL4965_UCODE_GET(init_size); | ||
2140 | IWL4965_UCODE_GET(init_data_size); | ||
2141 | IWL4965_UCODE_GET(boot_size); | ||
2142 | |||
2143 | static struct iwl_hcmd_ops iwl4965_hcmd = { | 2169 | static struct iwl_hcmd_ops iwl4965_hcmd = { |
2144 | .rxon_assoc = iwl4965_send_rxon_assoc, | 2170 | .rxon_assoc = iwl4965_send_rxon_assoc, |
2145 | .commit_rxon = iwl_commit_rxon, | 2171 | .commit_rxon = iwl_commit_rxon, |
@@ -2147,16 +2173,6 @@ static struct iwl_hcmd_ops iwl4965_hcmd = { | |||
2147 | .send_bt_config = iwl_send_bt_config, | 2173 | .send_bt_config = iwl_send_bt_config, |
2148 | }; | 2174 | }; |
2149 | 2175 | ||
2150 | static struct iwl_ucode_ops iwl4965_ucode = { | ||
2151 | .get_header_size = iwl4965_ucode_get_header_size, | ||
2152 | .get_build = iwl4965_ucode_get_build, | ||
2153 | .get_inst_size = iwl4965_ucode_get_inst_size, | ||
2154 | .get_data_size = iwl4965_ucode_get_data_size, | ||
2155 | .get_init_size = iwl4965_ucode_get_init_size, | ||
2156 | .get_init_data_size = iwl4965_ucode_get_init_data_size, | ||
2157 | .get_boot_size = iwl4965_ucode_get_boot_size, | ||
2158 | .get_data = iwl4965_ucode_get_data, | ||
2159 | }; | ||
2160 | static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { | 2176 | static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { |
2161 | .get_hcmd_size = iwl4965_get_hcmd_size, | 2177 | .get_hcmd_size = iwl4965_get_hcmd_size, |
2162 | .build_addsta_hcmd = iwl4965_build_addsta_hcmd, | 2178 | .build_addsta_hcmd = iwl4965_build_addsta_hcmd, |
@@ -2218,7 +2234,7 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
2218 | .temperature = iwl4965_temperature_calib, | 2234 | .temperature = iwl4965_temperature_calib, |
2219 | .set_ct_kill = iwl4965_set_ct_threshold, | 2235 | .set_ct_kill = iwl4965_set_ct_threshold, |
2220 | }, | 2236 | }, |
2221 | .add_bcast_station = iwl_add_bcast_station, | 2237 | .manage_ibss_station = iwlagn_manage_ibss_station, |
2222 | .debugfs_ops = { | 2238 | .debugfs_ops = { |
2223 | .rx_stats_read = iwl_ucode_rx_stats_read, | 2239 | .rx_stats_read = iwl_ucode_rx_stats_read, |
2224 | .tx_stats_read = iwl_ucode_tx_stats_read, | 2240 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -2228,7 +2244,6 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
2228 | }; | 2244 | }; |
2229 | 2245 | ||
2230 | static const struct iwl_ops iwl4965_ops = { | 2246 | static const struct iwl_ops iwl4965_ops = { |
2231 | .ucode = &iwl4965_ucode, | ||
2232 | .lib = &iwl4965_lib, | 2247 | .lib = &iwl4965_lib, |
2233 | .hcmd = &iwl4965_hcmd, | 2248 | .hcmd = &iwl4965_hcmd, |
2234 | .utils = &iwl4965_hcmd_utils, | 2249 | .utils = &iwl4965_hcmd_utils, |
@@ -2262,7 +2277,10 @@ struct iwl_cfg iwl4965_agn_cfg = { | |||
2262 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 2277 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
2263 | .temperature_kelvin = true, | 2278 | .temperature_kelvin = true, |
2264 | .max_event_log_size = 512, | 2279 | .max_event_log_size = 512, |
2265 | 2280 | .tx_power_by_driver = true, | |
2281 | .ucode_tracing = true, | ||
2282 | .sensitivity_calib_by_driver = true, | ||
2283 | .chain_noise_calib_by_driver = true, | ||
2266 | /* | 2284 | /* |
2267 | * Force use of chains B and C for scan RX on 5 GHz band | 2285 | * Force use of chains B and C for scan RX on 5 GHz band |
2268 | * because the device has off-channel reception on chain A. | 2286 | * because the device has off-channel reception on chain A. |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 115d3ea1142f..a28af7eb67eb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -351,7 +351,7 @@ static struct iwl_lib_ops iwl5000_lib = { | |||
351 | .temperature = iwlagn_temperature, | 351 | .temperature = iwlagn_temperature, |
352 | .set_ct_kill = iwl5000_set_ct_threshold, | 352 | .set_ct_kill = iwl5000_set_ct_threshold, |
353 | }, | 353 | }, |
354 | .add_bcast_station = iwl_add_bcast_station, | 354 | .manage_ibss_station = iwlagn_manage_ibss_station, |
355 | .debugfs_ops = { | 355 | .debugfs_ops = { |
356 | .rx_stats_read = iwl_ucode_rx_stats_read, | 356 | .rx_stats_read = iwl_ucode_rx_stats_read, |
357 | .tx_stats_read = iwl_ucode_tx_stats_read, | 357 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -413,7 +413,7 @@ static struct iwl_lib_ops iwl5150_lib = { | |||
413 | .temperature = iwl5150_temperature, | 413 | .temperature = iwl5150_temperature, |
414 | .set_ct_kill = iwl5150_set_ct_threshold, | 414 | .set_ct_kill = iwl5150_set_ct_threshold, |
415 | }, | 415 | }, |
416 | .add_bcast_station = iwl_add_bcast_station, | 416 | .manage_ibss_station = iwlagn_manage_ibss_station, |
417 | .debugfs_ops = { | 417 | .debugfs_ops = { |
418 | .rx_stats_read = iwl_ucode_rx_stats_read, | 418 | .rx_stats_read = iwl_ucode_rx_stats_read, |
419 | .tx_stats_read = iwl_ucode_tx_stats_read, | 419 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -425,7 +425,6 @@ static struct iwl_lib_ops iwl5150_lib = { | |||
425 | }; | 425 | }; |
426 | 426 | ||
427 | static const struct iwl_ops iwl5000_ops = { | 427 | static const struct iwl_ops iwl5000_ops = { |
428 | .ucode = &iwlagn_ucode, | ||
429 | .lib = &iwl5000_lib, | 428 | .lib = &iwl5000_lib, |
430 | .hcmd = &iwlagn_hcmd, | 429 | .hcmd = &iwlagn_hcmd, |
431 | .utils = &iwlagn_hcmd_utils, | 430 | .utils = &iwlagn_hcmd_utils, |
@@ -433,7 +432,6 @@ static const struct iwl_ops iwl5000_ops = { | |||
433 | }; | 432 | }; |
434 | 433 | ||
435 | static const struct iwl_ops iwl5150_ops = { | 434 | static const struct iwl_ops iwl5150_ops = { |
436 | .ucode = &iwlagn_ucode, | ||
437 | .lib = &iwl5150_lib, | 435 | .lib = &iwl5150_lib, |
438 | .hcmd = &iwlagn_hcmd, | 436 | .hcmd = &iwlagn_hcmd, |
439 | .utils = &iwlagn_hcmd_utils, | 437 | .utils = &iwlagn_hcmd_utils, |
@@ -466,6 +464,9 @@ struct iwl_cfg iwl5300_agn_cfg = { | |||
466 | .chain_noise_scale = 1000, | 464 | .chain_noise_scale = 1000, |
467 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 465 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
468 | .max_event_log_size = 512, | 466 | .max_event_log_size = 512, |
467 | .ucode_tracing = true, | ||
468 | .sensitivity_calib_by_driver = true, | ||
469 | .chain_noise_calib_by_driver = true, | ||
469 | }; | 470 | }; |
470 | 471 | ||
471 | struct iwl_cfg iwl5100_bgn_cfg = { | 472 | struct iwl_cfg iwl5100_bgn_cfg = { |
@@ -494,6 +495,9 @@ struct iwl_cfg iwl5100_bgn_cfg = { | |||
494 | .chain_noise_scale = 1000, | 495 | .chain_noise_scale = 1000, |
495 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 496 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
496 | .max_event_log_size = 512, | 497 | .max_event_log_size = 512, |
498 | .ucode_tracing = true, | ||
499 | .sensitivity_calib_by_driver = true, | ||
500 | .chain_noise_calib_by_driver = true, | ||
497 | }; | 501 | }; |
498 | 502 | ||
499 | struct iwl_cfg iwl5100_abg_cfg = { | 503 | struct iwl_cfg iwl5100_abg_cfg = { |
@@ -520,6 +524,9 @@ struct iwl_cfg iwl5100_abg_cfg = { | |||
520 | .chain_noise_scale = 1000, | 524 | .chain_noise_scale = 1000, |
521 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 525 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
522 | .max_event_log_size = 512, | 526 | .max_event_log_size = 512, |
527 | .ucode_tracing = true, | ||
528 | .sensitivity_calib_by_driver = true, | ||
529 | .chain_noise_calib_by_driver = true, | ||
523 | }; | 530 | }; |
524 | 531 | ||
525 | struct iwl_cfg iwl5100_agn_cfg = { | 532 | struct iwl_cfg iwl5100_agn_cfg = { |
@@ -548,6 +555,9 @@ struct iwl_cfg iwl5100_agn_cfg = { | |||
548 | .chain_noise_scale = 1000, | 555 | .chain_noise_scale = 1000, |
549 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 556 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
550 | .max_event_log_size = 512, | 557 | .max_event_log_size = 512, |
558 | .ucode_tracing = true, | ||
559 | .sensitivity_calib_by_driver = true, | ||
560 | .chain_noise_calib_by_driver = true, | ||
551 | }; | 561 | }; |
552 | 562 | ||
553 | struct iwl_cfg iwl5350_agn_cfg = { | 563 | struct iwl_cfg iwl5350_agn_cfg = { |
@@ -576,6 +586,9 @@ struct iwl_cfg iwl5350_agn_cfg = { | |||
576 | .chain_noise_scale = 1000, | 586 | .chain_noise_scale = 1000, |
577 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 587 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
578 | .max_event_log_size = 512, | 588 | .max_event_log_size = 512, |
589 | .ucode_tracing = true, | ||
590 | .sensitivity_calib_by_driver = true, | ||
591 | .chain_noise_calib_by_driver = true, | ||
579 | }; | 592 | }; |
580 | 593 | ||
581 | struct iwl_cfg iwl5150_agn_cfg = { | 594 | struct iwl_cfg iwl5150_agn_cfg = { |
@@ -604,6 +617,9 @@ struct iwl_cfg iwl5150_agn_cfg = { | |||
604 | .chain_noise_scale = 1000, | 617 | .chain_noise_scale = 1000, |
605 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 618 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
606 | .max_event_log_size = 512, | 619 | .max_event_log_size = 512, |
620 | .ucode_tracing = true, | ||
621 | .sensitivity_calib_by_driver = true, | ||
622 | .chain_noise_calib_by_driver = true, | ||
607 | }; | 623 | }; |
608 | 624 | ||
609 | struct iwl_cfg iwl5150_abg_cfg = { | 625 | struct iwl_cfg iwl5150_abg_cfg = { |
@@ -630,6 +646,9 @@ struct iwl_cfg iwl5150_abg_cfg = { | |||
630 | .chain_noise_scale = 1000, | 646 | .chain_noise_scale = 1000, |
631 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 647 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
632 | .max_event_log_size = 512, | 648 | .max_event_log_size = 512, |
649 | .ucode_tracing = true, | ||
650 | .sensitivity_calib_by_driver = true, | ||
651 | .chain_noise_calib_by_driver = true, | ||
633 | }; | 652 | }; |
634 | 653 | ||
635 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); | 654 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 7acef703253a..9fbf54cd3e1a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -67,9 +67,10 @@ | |||
67 | #define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode" | 67 | #define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode" |
68 | #define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api) | 68 | #define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api) |
69 | 69 | ||
70 | #define IWL6000G2_FW_PRE "iwlwifi-6005-" | 70 | #define IWL6000G2A_FW_PRE "iwlwifi-6000g2a-" |
71 | #define _IWL6000G2_MODULE_FIRMWARE(api) IWL6000G2_FW_PRE #api ".ucode" | 71 | #define _IWL6000G2A_MODULE_FIRMWARE(api) IWL6000G2A_FW_PRE #api ".ucode" |
72 | #define IWL6000G2_MODULE_FIRMWARE(api) _IWL6000G2_MODULE_FIRMWARE(api) | 72 | #define IWL6000G2A_MODULE_FIRMWARE(api) _IWL6000G2A_MODULE_FIRMWARE(api) |
73 | |||
73 | 74 | ||
74 | static void iwl6000_set_ct_threshold(struct iwl_priv *priv) | 75 | static void iwl6000_set_ct_threshold(struct iwl_priv *priv) |
75 | { | 76 | { |
@@ -316,7 +317,7 @@ static struct iwl_lib_ops iwl6000_lib = { | |||
316 | .temperature = iwlagn_temperature, | 317 | .temperature = iwlagn_temperature, |
317 | .set_ct_kill = iwl6000_set_ct_threshold, | 318 | .set_ct_kill = iwl6000_set_ct_threshold, |
318 | }, | 319 | }, |
319 | .add_bcast_station = iwl_add_bcast_station, | 320 | .manage_ibss_station = iwlagn_manage_ibss_station, |
320 | .debugfs_ops = { | 321 | .debugfs_ops = { |
321 | .rx_stats_read = iwl_ucode_rx_stats_read, | 322 | .rx_stats_read = iwl_ucode_rx_stats_read, |
322 | .tx_stats_read = iwl_ucode_tx_stats_read, | 323 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -328,7 +329,6 @@ static struct iwl_lib_ops iwl6000_lib = { | |||
328 | }; | 329 | }; |
329 | 330 | ||
330 | static const struct iwl_ops iwl6000_ops = { | 331 | static const struct iwl_ops iwl6000_ops = { |
331 | .ucode = &iwlagn_ucode, | ||
332 | .lib = &iwl6000_lib, | 332 | .lib = &iwl6000_lib, |
333 | .hcmd = &iwlagn_hcmd, | 333 | .hcmd = &iwlagn_hcmd, |
334 | .utils = &iwlagn_hcmd_utils, | 334 | .utils = &iwlagn_hcmd_utils, |
@@ -389,7 +389,7 @@ static struct iwl_lib_ops iwl6050_lib = { | |||
389 | .set_ct_kill = iwl6000_set_ct_threshold, | 389 | .set_ct_kill = iwl6000_set_ct_threshold, |
390 | .set_calib_version = iwl6050_set_calib_version, | 390 | .set_calib_version = iwl6050_set_calib_version, |
391 | }, | 391 | }, |
392 | .add_bcast_station = iwl_add_bcast_station, | 392 | .manage_ibss_station = iwlagn_manage_ibss_station, |
393 | .debugfs_ops = { | 393 | .debugfs_ops = { |
394 | .rx_stats_read = iwl_ucode_rx_stats_read, | 394 | .rx_stats_read = iwl_ucode_rx_stats_read, |
395 | .tx_stats_read = iwl_ucode_tx_stats_read, | 395 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -401,19 +401,16 @@ static struct iwl_lib_ops iwl6050_lib = { | |||
401 | }; | 401 | }; |
402 | 402 | ||
403 | static const struct iwl_ops iwl6050_ops = { | 403 | static const struct iwl_ops iwl6050_ops = { |
404 | .ucode = &iwlagn_ucode, | ||
405 | .lib = &iwl6050_lib, | 404 | .lib = &iwl6050_lib, |
406 | .hcmd = &iwlagn_hcmd, | 405 | .hcmd = &iwlagn_hcmd, |
407 | .utils = &iwlagn_hcmd_utils, | 406 | .utils = &iwlagn_hcmd_utils, |
408 | .led = &iwlagn_led_ops, | 407 | .led = &iwlagn_led_ops, |
409 | }; | 408 | }; |
410 | 409 | ||
411 | /* | 410 | |
412 | * "i": Internal configuration, use internal Power Amplifier | 411 | struct iwl_cfg iwl6000g2a_2agn_cfg = { |
413 | */ | 412 | .name = "6000 Series 2x2 AGN Gen2a", |
414 | struct iwl_cfg iwl6000g2_2agn_cfg = { | 413 | .fw_name_pre = IWL6000G2A_FW_PRE, |
415 | .name = "6000 Series 2x2 AGN Gen2", | ||
416 | .fw_name_pre = IWL6000G2_FW_PRE, | ||
417 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, | 414 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, |
418 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, | 415 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, |
419 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, | 416 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, |
@@ -442,9 +439,15 @@ struct iwl_cfg iwl6000g2_2agn_cfg = { | |||
442 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 439 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
443 | .chain_noise_scale = 1000, | 440 | .chain_noise_scale = 1000, |
444 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 441 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
445 | .max_event_log_size = 1024, | 442 | .max_event_log_size = 512, |
443 | .ucode_tracing = true, | ||
444 | .sensitivity_calib_by_driver = true, | ||
445 | .chain_noise_calib_by_driver = true, | ||
446 | }; | 446 | }; |
447 | 447 | ||
448 | /* | ||
449 | * "i": Internal configuration, use internal Power Amplifier | ||
450 | */ | ||
448 | struct iwl_cfg iwl6000i_2agn_cfg = { | 451 | struct iwl_cfg iwl6000i_2agn_cfg = { |
449 | .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN", | 452 | .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN", |
450 | .fw_name_pre = IWL6000_FW_PRE, | 453 | .fw_name_pre = IWL6000_FW_PRE, |
@@ -477,6 +480,9 @@ struct iwl_cfg iwl6000i_2agn_cfg = { | |||
477 | .chain_noise_scale = 1000, | 480 | .chain_noise_scale = 1000, |
478 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 481 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
479 | .max_event_log_size = 1024, | 482 | .max_event_log_size = 1024, |
483 | .ucode_tracing = true, | ||
484 | .sensitivity_calib_by_driver = true, | ||
485 | .chain_noise_calib_by_driver = true, | ||
480 | }; | 486 | }; |
481 | 487 | ||
482 | struct iwl_cfg iwl6000i_2abg_cfg = { | 488 | struct iwl_cfg iwl6000i_2abg_cfg = { |
@@ -509,6 +515,9 @@ struct iwl_cfg iwl6000i_2abg_cfg = { | |||
509 | .chain_noise_scale = 1000, | 515 | .chain_noise_scale = 1000, |
510 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 516 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
511 | .max_event_log_size = 1024, | 517 | .max_event_log_size = 1024, |
518 | .ucode_tracing = true, | ||
519 | .sensitivity_calib_by_driver = true, | ||
520 | .chain_noise_calib_by_driver = true, | ||
512 | }; | 521 | }; |
513 | 522 | ||
514 | struct iwl_cfg iwl6000i_2bg_cfg = { | 523 | struct iwl_cfg iwl6000i_2bg_cfg = { |
@@ -541,6 +550,9 @@ struct iwl_cfg iwl6000i_2bg_cfg = { | |||
541 | .chain_noise_scale = 1000, | 550 | .chain_noise_scale = 1000, |
542 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 551 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
543 | .max_event_log_size = 1024, | 552 | .max_event_log_size = 1024, |
553 | .ucode_tracing = true, | ||
554 | .sensitivity_calib_by_driver = true, | ||
555 | .chain_noise_calib_by_driver = true, | ||
544 | }; | 556 | }; |
545 | 557 | ||
546 | struct iwl_cfg iwl6050_2agn_cfg = { | 558 | struct iwl_cfg iwl6050_2agn_cfg = { |
@@ -575,6 +587,9 @@ struct iwl_cfg iwl6050_2agn_cfg = { | |||
575 | .chain_noise_scale = 1500, | 587 | .chain_noise_scale = 1500, |
576 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 588 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
577 | .max_event_log_size = 1024, | 589 | .max_event_log_size = 1024, |
590 | .ucode_tracing = true, | ||
591 | .sensitivity_calib_by_driver = true, | ||
592 | .chain_noise_calib_by_driver = true, | ||
578 | }; | 593 | }; |
579 | 594 | ||
580 | struct iwl_cfg iwl6050_2abg_cfg = { | 595 | struct iwl_cfg iwl6050_2abg_cfg = { |
@@ -607,6 +622,9 @@ struct iwl_cfg iwl6050_2abg_cfg = { | |||
607 | .chain_noise_scale = 1500, | 622 | .chain_noise_scale = 1500, |
608 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 623 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
609 | .max_event_log_size = 1024, | 624 | .max_event_log_size = 1024, |
625 | .ucode_tracing = true, | ||
626 | .sensitivity_calib_by_driver = true, | ||
627 | .chain_noise_calib_by_driver = true, | ||
610 | }; | 628 | }; |
611 | 629 | ||
612 | struct iwl_cfg iwl6000_3agn_cfg = { | 630 | struct iwl_cfg iwl6000_3agn_cfg = { |
@@ -641,8 +659,11 @@ struct iwl_cfg iwl6000_3agn_cfg = { | |||
641 | .chain_noise_scale = 1000, | 659 | .chain_noise_scale = 1000, |
642 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 660 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
643 | .max_event_log_size = 1024, | 661 | .max_event_log_size = 1024, |
662 | .ucode_tracing = true, | ||
663 | .sensitivity_calib_by_driver = true, | ||
664 | .chain_noise_calib_by_driver = true, | ||
644 | }; | 665 | }; |
645 | 666 | ||
646 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); | 667 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); |
647 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); | 668 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); |
648 | MODULE_FIRMWARE(IWL6000G2_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | 669 | MODULE_FIRMWARE(IWL6000G2A_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c index f249b706bf17..48c023b4ca36 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c | |||
@@ -709,6 +709,22 @@ ssize_t iwl_ucode_tx_stats_read(struct file *file, | |||
709 | delta_tx->agg.rx_ba_rsp_cnt, | 709 | delta_tx->agg.rx_ba_rsp_cnt, |
710 | max_tx->agg.rx_ba_rsp_cnt); | 710 | max_tx->agg.rx_ba_rsp_cnt); |
711 | 711 | ||
712 | if (tx->tx_power.ant_a || tx->tx_power.ant_b || tx->tx_power.ant_c) { | ||
713 | pos += scnprintf(buf + pos, bufsz - pos, | ||
714 | "tx power: (1/2 dB step)\n"); | ||
715 | if ((priv->cfg->valid_tx_ant & ANT_A) && tx->tx_power.ant_a) | ||
716 | pos += scnprintf(buf + pos, bufsz - pos, | ||
717 | "\tantenna A: 0x%X\n", | ||
718 | tx->tx_power.ant_a); | ||
719 | if ((priv->cfg->valid_tx_ant & ANT_B) && tx->tx_power.ant_b) | ||
720 | pos += scnprintf(buf + pos, bufsz - pos, | ||
721 | "\tantenna B: 0x%X\n", | ||
722 | tx->tx_power.ant_b); | ||
723 | if ((priv->cfg->valid_tx_ant & ANT_C) && tx->tx_power.ant_c) | ||
724 | pos += scnprintf(buf + pos, bufsz - pos, | ||
725 | "\tantenna C: 0x%X\n", | ||
726 | tx->tx_power.ant_c); | ||
727 | } | ||
712 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 728 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
713 | kfree(buf); | 729 | kfree(buf); |
714 | return ret; | 730 | return ret; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index a27347425968..637d7b62fb56 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "iwl-helpers.h" | 38 | #include "iwl-helpers.h" |
39 | #include "iwl-agn-hw.h" | 39 | #include "iwl-agn-hw.h" |
40 | #include "iwl-agn.h" | 40 | #include "iwl-agn.h" |
41 | #include "iwl-sta.h" | ||
41 | 42 | ||
42 | static inline u32 iwlagn_get_scd_ssn(struct iwl5000_tx_resp *tx_resp) | 43 | static inline u32 iwlagn_get_scd_ssn(struct iwl5000_tx_resp *tx_resp) |
43 | { | 44 | { |
@@ -1113,8 +1114,9 @@ void iwlagn_rx_reply_rx_phy(struct iwl_priv *priv, | |||
1113 | } | 1114 | } |
1114 | 1115 | ||
1115 | static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, | 1116 | static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, |
1116 | enum ieee80211_band band, | 1117 | struct ieee80211_vif *vif, |
1117 | struct iwl_scan_channel *scan_ch) | 1118 | enum ieee80211_band band, |
1119 | struct iwl_scan_channel *scan_ch) | ||
1118 | { | 1120 | { |
1119 | const struct ieee80211_supported_band *sband; | 1121 | const struct ieee80211_supported_band *sband; |
1120 | const struct iwl_channel_info *ch_info; | 1122 | const struct iwl_channel_info *ch_info; |
@@ -1130,7 +1132,7 @@ static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, | |||
1130 | } | 1132 | } |
1131 | 1133 | ||
1132 | active_dwell = iwl_get_active_dwell_time(priv, band, 0); | 1134 | active_dwell = iwl_get_active_dwell_time(priv, band, 0); |
1133 | passive_dwell = iwl_get_passive_dwell_time(priv, band); | 1135 | passive_dwell = iwl_get_passive_dwell_time(priv, band, vif); |
1134 | 1136 | ||
1135 | if (passive_dwell <= active_dwell) | 1137 | if (passive_dwell <= active_dwell) |
1136 | passive_dwell = active_dwell + 1; | 1138 | passive_dwell = active_dwell + 1; |
@@ -1179,6 +1181,7 @@ static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, | |||
1179 | } | 1181 | } |
1180 | 1182 | ||
1181 | static int iwl_get_channels_for_scan(struct iwl_priv *priv, | 1183 | static int iwl_get_channels_for_scan(struct iwl_priv *priv, |
1184 | struct ieee80211_vif *vif, | ||
1182 | enum ieee80211_band band, | 1185 | enum ieee80211_band band, |
1183 | u8 is_active, u8 n_probes, | 1186 | u8 is_active, u8 n_probes, |
1184 | struct iwl_scan_channel *scan_ch) | 1187 | struct iwl_scan_channel *scan_ch) |
@@ -1196,7 +1199,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, | |||
1196 | return 0; | 1199 | return 0; |
1197 | 1200 | ||
1198 | active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); | 1201 | active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); |
1199 | passive_dwell = iwl_get_passive_dwell_time(priv, band); | 1202 | passive_dwell = iwl_get_passive_dwell_time(priv, band, vif); |
1200 | 1203 | ||
1201 | if (passive_dwell <= active_dwell) | 1204 | if (passive_dwell <= active_dwell) |
1202 | passive_dwell = active_dwell + 1; | 1205 | passive_dwell = active_dwell + 1; |
@@ -1256,7 +1259,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, | |||
1256 | return added; | 1259 | return added; |
1257 | } | 1260 | } |
1258 | 1261 | ||
1259 | void iwlagn_request_scan(struct iwl_priv *priv) | 1262 | void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) |
1260 | { | 1263 | { |
1261 | struct iwl_host_cmd cmd = { | 1264 | struct iwl_host_cmd cmd = { |
1262 | .id = REPLY_SCAN_CMD, | 1265 | .id = REPLY_SCAN_CMD, |
@@ -1342,7 +1345,7 @@ void iwlagn_request_scan(struct iwl_priv *priv) | |||
1342 | 1345 | ||
1343 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); | 1346 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); |
1344 | spin_lock_irqsave(&priv->lock, flags); | 1347 | spin_lock_irqsave(&priv->lock, flags); |
1345 | interval = priv->beacon_int; | 1348 | interval = vif ? vif->bss_conf.beacon_int : 0; |
1346 | spin_unlock_irqrestore(&priv->lock, flags); | 1349 | spin_unlock_irqrestore(&priv->lock, flags); |
1347 | 1350 | ||
1348 | scan->suspend_time = 0; | 1351 | scan->suspend_time = 0; |
@@ -1473,12 +1476,12 @@ void iwlagn_request_scan(struct iwl_priv *priv) | |||
1473 | 1476 | ||
1474 | if (priv->is_internal_short_scan) { | 1477 | if (priv->is_internal_short_scan) { |
1475 | scan->channel_count = | 1478 | scan->channel_count = |
1476 | iwl_get_single_channel_for_scan(priv, band, | 1479 | iwl_get_single_channel_for_scan(priv, vif, band, |
1477 | (void *)&scan->data[le16_to_cpu( | 1480 | (void *)&scan->data[le16_to_cpu( |
1478 | scan->tx_cmd.len)]); | 1481 | scan->tx_cmd.len)]); |
1479 | } else { | 1482 | } else { |
1480 | scan->channel_count = | 1483 | scan->channel_count = |
1481 | iwl_get_channels_for_scan(priv, band, | 1484 | iwl_get_channels_for_scan(priv, vif, band, |
1482 | is_active, n_probes, | 1485 | is_active, n_probes, |
1483 | (void *)&scan->data[le16_to_cpu( | 1486 | (void *)&scan->data[le16_to_cpu( |
1484 | scan->tx_cmd.len)]); | 1487 | scan->tx_cmd.len)]); |
@@ -1513,3 +1516,15 @@ void iwlagn_request_scan(struct iwl_priv *priv) | |||
1513 | /* inform mac80211 scan aborted */ | 1516 | /* inform mac80211 scan aborted */ |
1514 | queue_work(priv->workqueue, &priv->scan_completed); | 1517 | queue_work(priv->workqueue, &priv->scan_completed); |
1515 | } | 1518 | } |
1519 | |||
1520 | int iwlagn_manage_ibss_station(struct iwl_priv *priv, | ||
1521 | struct ieee80211_vif *vif, bool add) | ||
1522 | { | ||
1523 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | ||
1524 | |||
1525 | if (add) | ||
1526 | return iwl_add_bssid_station(priv, vif->bss_conf.bssid, true, | ||
1527 | &vif_priv->ibss_bssid_sta_id); | ||
1528 | return iwl_remove_station(priv, vif_priv->ibss_bssid_sta_id, | ||
1529 | vif->bss_conf.bssid); | ||
1530 | } | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c index c2a5c85542bf..c402bfc83f36 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c | |||
@@ -566,11 +566,11 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
566 | 566 | ||
567 | hdr_len = ieee80211_hdrlen(fc); | 567 | hdr_len = ieee80211_hdrlen(fc); |
568 | 568 | ||
569 | /* Find (or create) index into station table for destination station */ | 569 | /* Find index into station table for destination station */ |
570 | if (info->flags & IEEE80211_TX_CTL_INJECTED) | 570 | if (!info->control.sta) |
571 | sta_id = priv->hw_params.bcast_sta_id; | 571 | sta_id = priv->hw_params.bcast_sta_id; |
572 | else | 572 | else |
573 | sta_id = iwl_get_sta_id(priv, hdr); | 573 | sta_id = iwl_sta_id(info->control.sta); |
574 | if (sta_id == IWL_INVALID_STATION) { | 574 | if (sta_id == IWL_INVALID_STATION) { |
575 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", | 575 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", |
576 | hdr->addr1); | 576 | hdr->addr1); |
@@ -961,7 +961,8 @@ static int iwlagn_txq_ctx_activate_free(struct iwl_priv *priv) | |||
961 | return -1; | 961 | return -1; |
962 | } | 962 | } |
963 | 963 | ||
964 | int iwlagn_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) | 964 | int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, |
965 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) | ||
965 | { | 966 | { |
966 | int sta_id; | 967 | int sta_id; |
967 | int tx_fifo; | 968 | int tx_fifo; |
@@ -975,9 +976,9 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) | |||
975 | return tx_fifo; | 976 | return tx_fifo; |
976 | 977 | ||
977 | IWL_WARN(priv, "%s on ra = %pM tid = %d\n", | 978 | IWL_WARN(priv, "%s on ra = %pM tid = %d\n", |
978 | __func__, ra, tid); | 979 | __func__, sta->addr, tid); |
979 | 980 | ||
980 | sta_id = iwl_find_station(priv, ra); | 981 | sta_id = iwl_sta_id(sta); |
981 | if (sta_id == IWL_INVALID_STATION) { | 982 | if (sta_id == IWL_INVALID_STATION) { |
982 | IWL_ERR(priv, "Start AGG on invalid station\n"); | 983 | IWL_ERR(priv, "Start AGG on invalid station\n"); |
983 | return -ENXIO; | 984 | return -ENXIO; |
@@ -1011,7 +1012,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) | |||
1011 | if (tid_data->tfds_in_queue == 0) { | 1012 | if (tid_data->tfds_in_queue == 0) { |
1012 | IWL_DEBUG_HT(priv, "HW queue is empty\n"); | 1013 | IWL_DEBUG_HT(priv, "HW queue is empty\n"); |
1013 | tid_data->agg.state = IWL_AGG_ON; | 1014 | tid_data->agg.state = IWL_AGG_ON; |
1014 | ieee80211_start_tx_ba_cb_irqsafe(priv->vif, ra, tid); | 1015 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
1015 | } else { | 1016 | } else { |
1016 | IWL_DEBUG_HT(priv, "HW queue is NOT empty: %d packets in HW queue\n", | 1017 | IWL_DEBUG_HT(priv, "HW queue is NOT empty: %d packets in HW queue\n", |
1017 | tid_data->tfds_in_queue); | 1018 | tid_data->tfds_in_queue); |
@@ -1020,23 +1021,19 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) | |||
1020 | return ret; | 1021 | return ret; |
1021 | } | 1022 | } |
1022 | 1023 | ||
1023 | int iwlagn_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid) | 1024 | int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, |
1025 | struct ieee80211_sta *sta, u16 tid) | ||
1024 | { | 1026 | { |
1025 | int tx_fifo_id, txq_id, sta_id, ssn = -1; | 1027 | int tx_fifo_id, txq_id, sta_id, ssn = -1; |
1026 | struct iwl_tid_data *tid_data; | 1028 | struct iwl_tid_data *tid_data; |
1027 | int write_ptr, read_ptr; | 1029 | int write_ptr, read_ptr; |
1028 | unsigned long flags; | 1030 | unsigned long flags; |
1029 | 1031 | ||
1030 | if (!ra) { | ||
1031 | IWL_ERR(priv, "ra = NULL\n"); | ||
1032 | return -EINVAL; | ||
1033 | } | ||
1034 | |||
1035 | tx_fifo_id = get_fifo_from_tid(tid); | 1032 | tx_fifo_id = get_fifo_from_tid(tid); |
1036 | if (unlikely(tx_fifo_id < 0)) | 1033 | if (unlikely(tx_fifo_id < 0)) |
1037 | return tx_fifo_id; | 1034 | return tx_fifo_id; |
1038 | 1035 | ||
1039 | sta_id = iwl_find_station(priv, ra); | 1036 | sta_id = iwl_sta_id(sta); |
1040 | 1037 | ||
1041 | if (sta_id == IWL_INVALID_STATION) { | 1038 | if (sta_id == IWL_INVALID_STATION) { |
1042 | IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); | 1039 | IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); |
@@ -1046,7 +1043,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid) | |||
1046 | if (priv->stations[sta_id].tid[tid].agg.state == | 1043 | if (priv->stations[sta_id].tid[tid].agg.state == |
1047 | IWL_EMPTYING_HW_QUEUE_ADDBA) { | 1044 | IWL_EMPTYING_HW_QUEUE_ADDBA) { |
1048 | IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); | 1045 | IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); |
1049 | ieee80211_stop_tx_ba_cb_irqsafe(priv->vif, ra, tid); | 1046 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
1050 | priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF; | 1047 | priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF; |
1051 | return 0; | 1048 | return 0; |
1052 | } | 1049 | } |
@@ -1083,7 +1080,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid) | |||
1083 | tx_fifo_id); | 1080 | tx_fifo_id); |
1084 | spin_unlock_irqrestore(&priv->lock, flags); | 1081 | spin_unlock_irqrestore(&priv->lock, flags); |
1085 | 1082 | ||
1086 | ieee80211_stop_tx_ba_cb_irqsafe(priv->vif, ra, tid); | 1083 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
1087 | 1084 | ||
1088 | return 0; | 1085 | return 0; |
1089 | } | 1086 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c index ae476c234a7c..637286c396fe 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c | |||
@@ -52,6 +52,37 @@ static const s8 iwlagn_default_queue_to_tx_fifo[] = { | |||
52 | IWL_TX_FIFO_UNUSED, | 52 | IWL_TX_FIFO_UNUSED, |
53 | }; | 53 | }; |
54 | 54 | ||
55 | static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = { | ||
56 | {COEX_CU_UNASSOC_IDLE_RP, COEX_CU_UNASSOC_IDLE_WP, | ||
57 | 0, COEX_UNASSOC_IDLE_FLAGS}, | ||
58 | {COEX_CU_UNASSOC_MANUAL_SCAN_RP, COEX_CU_UNASSOC_MANUAL_SCAN_WP, | ||
59 | 0, COEX_UNASSOC_MANUAL_SCAN_FLAGS}, | ||
60 | {COEX_CU_UNASSOC_AUTO_SCAN_RP, COEX_CU_UNASSOC_AUTO_SCAN_WP, | ||
61 | 0, COEX_UNASSOC_AUTO_SCAN_FLAGS}, | ||
62 | {COEX_CU_CALIBRATION_RP, COEX_CU_CALIBRATION_WP, | ||
63 | 0, COEX_CALIBRATION_FLAGS}, | ||
64 | {COEX_CU_PERIODIC_CALIBRATION_RP, COEX_CU_PERIODIC_CALIBRATION_WP, | ||
65 | 0, COEX_PERIODIC_CALIBRATION_FLAGS}, | ||
66 | {COEX_CU_CONNECTION_ESTAB_RP, COEX_CU_CONNECTION_ESTAB_WP, | ||
67 | 0, COEX_CONNECTION_ESTAB_FLAGS}, | ||
68 | {COEX_CU_ASSOCIATED_IDLE_RP, COEX_CU_ASSOCIATED_IDLE_WP, | ||
69 | 0, COEX_ASSOCIATED_IDLE_FLAGS}, | ||
70 | {COEX_CU_ASSOC_MANUAL_SCAN_RP, COEX_CU_ASSOC_MANUAL_SCAN_WP, | ||
71 | 0, COEX_ASSOC_MANUAL_SCAN_FLAGS}, | ||
72 | {COEX_CU_ASSOC_AUTO_SCAN_RP, COEX_CU_ASSOC_AUTO_SCAN_WP, | ||
73 | 0, COEX_ASSOC_AUTO_SCAN_FLAGS}, | ||
74 | {COEX_CU_ASSOC_ACTIVE_LEVEL_RP, COEX_CU_ASSOC_ACTIVE_LEVEL_WP, | ||
75 | 0, COEX_ASSOC_ACTIVE_LEVEL_FLAGS}, | ||
76 | {COEX_CU_RF_ON_RP, COEX_CU_RF_ON_WP, 0, COEX_CU_RF_ON_FLAGS}, | ||
77 | {COEX_CU_RF_OFF_RP, COEX_CU_RF_OFF_WP, 0, COEX_RF_OFF_FLAGS}, | ||
78 | {COEX_CU_STAND_ALONE_DEBUG_RP, COEX_CU_STAND_ALONE_DEBUG_WP, | ||
79 | 0, COEX_STAND_ALONE_DEBUG_FLAGS}, | ||
80 | {COEX_CU_IPAN_ASSOC_LEVEL_RP, COEX_CU_IPAN_ASSOC_LEVEL_WP, | ||
81 | 0, COEX_IPAN_ASSOC_LEVEL_FLAGS}, | ||
82 | {COEX_CU_RSRVD1_RP, COEX_CU_RSRVD1_WP, 0, COEX_RSRVD1_FLAGS}, | ||
83 | {COEX_CU_RSRVD2_RP, COEX_CU_RSRVD2_WP, 0, COEX_RSRVD2_FLAGS} | ||
84 | }; | ||
85 | |||
55 | /* | 86 | /* |
56 | * ucode | 87 | * ucode |
57 | */ | 88 | */ |
@@ -151,55 +182,6 @@ int iwlagn_load_ucode(struct iwl_priv *priv) | |||
151 | return ret; | 182 | return ret; |
152 | } | 183 | } |
153 | 184 | ||
154 | #define IWL_UCODE_GET(item) \ | ||
155 | static u32 iwlagn_ucode_get_##item(const struct iwl_ucode_header *ucode,\ | ||
156 | u32 api_ver) \ | ||
157 | { \ | ||
158 | if (api_ver <= 2) \ | ||
159 | return le32_to_cpu(ucode->u.v1.item); \ | ||
160 | return le32_to_cpu(ucode->u.v2.item); \ | ||
161 | } | ||
162 | |||
163 | static u32 iwlagn_ucode_get_header_size(u32 api_ver) | ||
164 | { | ||
165 | if (api_ver <= 2) | ||
166 | return UCODE_HEADER_SIZE(1); | ||
167 | return UCODE_HEADER_SIZE(2); | ||
168 | } | ||
169 | |||
170 | static u32 iwlagn_ucode_get_build(const struct iwl_ucode_header *ucode, | ||
171 | u32 api_ver) | ||
172 | { | ||
173 | if (api_ver <= 2) | ||
174 | return 0; | ||
175 | return le32_to_cpu(ucode->u.v2.build); | ||
176 | } | ||
177 | |||
178 | static u8 *iwlagn_ucode_get_data(const struct iwl_ucode_header *ucode, | ||
179 | u32 api_ver) | ||
180 | { | ||
181 | if (api_ver <= 2) | ||
182 | return (u8 *) ucode->u.v1.data; | ||
183 | return (u8 *) ucode->u.v2.data; | ||
184 | } | ||
185 | |||
186 | IWL_UCODE_GET(inst_size); | ||
187 | IWL_UCODE_GET(data_size); | ||
188 | IWL_UCODE_GET(init_size); | ||
189 | IWL_UCODE_GET(init_data_size); | ||
190 | IWL_UCODE_GET(boot_size); | ||
191 | |||
192 | struct iwl_ucode_ops iwlagn_ucode = { | ||
193 | .get_header_size = iwlagn_ucode_get_header_size, | ||
194 | .get_build = iwlagn_ucode_get_build, | ||
195 | .get_inst_size = iwlagn_ucode_get_inst_size, | ||
196 | .get_data_size = iwlagn_ucode_get_data_size, | ||
197 | .get_init_size = iwlagn_ucode_get_init_size, | ||
198 | .get_init_data_size = iwlagn_ucode_get_init_data_size, | ||
199 | .get_boot_size = iwlagn_ucode_get_boot_size, | ||
200 | .get_data = iwlagn_ucode_get_data, | ||
201 | }; | ||
202 | |||
203 | /* | 185 | /* |
204 | * Calibration | 186 | * Calibration |
205 | */ | 187 | */ |
@@ -320,6 +302,33 @@ restart: | |||
320 | queue_work(priv->workqueue, &priv->restart); | 302 | queue_work(priv->workqueue, &priv->restart); |
321 | } | 303 | } |
322 | 304 | ||
305 | static int iwlagn_send_wimax_coex(struct iwl_priv *priv) | ||
306 | { | ||
307 | struct iwl_wimax_coex_cmd coex_cmd; | ||
308 | |||
309 | if (priv->cfg->support_wimax_coexist) { | ||
310 | /* UnMask wake up src at associated sleep */ | ||
311 | coex_cmd.flags = COEX_FLAGS_ASSOC_WA_UNMASK_MSK; | ||
312 | |||
313 | /* UnMask wake up src at unassociated sleep */ | ||
314 | coex_cmd.flags |= COEX_FLAGS_UNASSOC_WA_UNMASK_MSK; | ||
315 | memcpy(coex_cmd.sta_prio, cu_priorities, | ||
316 | sizeof(struct iwl_wimax_coex_event_entry) * | ||
317 | COEX_NUM_OF_EVENTS); | ||
318 | |||
319 | /* enabling the coexistence feature */ | ||
320 | coex_cmd.flags |= COEX_FLAGS_COEX_ENABLE_MSK; | ||
321 | |||
322 | /* enabling the priorities tables */ | ||
323 | coex_cmd.flags |= COEX_FLAGS_STA_TABLE_VALID_MSK; | ||
324 | } else { | ||
325 | /* coexistence is disabled */ | ||
326 | memset(&coex_cmd, 0, sizeof(coex_cmd)); | ||
327 | } | ||
328 | return iwl_send_cmd_pdu(priv, COEX_PRIORITY_TABLE_CMD, | ||
329 | sizeof(coex_cmd), &coex_cmd); | ||
330 | } | ||
331 | |||
323 | int iwlagn_alive_notify(struct iwl_priv *priv) | 332 | int iwlagn_alive_notify(struct iwl_priv *priv) |
324 | { | 333 | { |
325 | u32 a; | 334 | u32 a; |
@@ -407,7 +416,7 @@ int iwlagn_alive_notify(struct iwl_priv *priv) | |||
407 | 416 | ||
408 | spin_unlock_irqrestore(&priv->lock, flags); | 417 | spin_unlock_irqrestore(&priv->lock, flags); |
409 | 418 | ||
410 | iwl_send_wimax_coex(priv); | 419 | iwlagn_send_wimax_coex(priv); |
411 | 420 | ||
412 | iwlagn_set_Xtal_calib(priv); | 421 | iwlagn_set_Xtal_calib(priv); |
413 | iwl_send_calib_results(priv); | 422 | iwl_send_calib_results(priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index a672d3379cfd..dc747ad988b4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -157,7 +157,7 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
157 | IWL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret); | 157 | IWL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret); |
158 | return ret; | 158 | return ret; |
159 | } | 159 | } |
160 | iwl_clear_ucode_stations(priv, false); | 160 | iwl_clear_ucode_stations(priv); |
161 | iwl_restore_stations(priv); | 161 | iwl_restore_stations(priv); |
162 | ret = iwl_restore_default_wep_keys(priv); | 162 | ret = iwl_restore_default_wep_keys(priv); |
163 | if (ret) { | 163 | if (ret) { |
@@ -189,7 +189,7 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
189 | } | 189 | } |
190 | IWL_DEBUG_INFO(priv, "Return from !new_assoc RXON.\n"); | 190 | IWL_DEBUG_INFO(priv, "Return from !new_assoc RXON.\n"); |
191 | memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); | 191 | memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); |
192 | iwl_clear_ucode_stations(priv, false); | 192 | iwl_clear_ucode_stations(priv); |
193 | iwl_restore_stations(priv); | 193 | iwl_restore_stations(priv); |
194 | ret = iwl_restore_default_wep_keys(priv); | 194 | ret = iwl_restore_default_wep_keys(priv); |
195 | if (ret) { | 195 | if (ret) { |
@@ -1506,9 +1506,13 @@ static void iwl_nic_start(struct iwl_priv *priv) | |||
1506 | iwl_write32(priv, CSR_RESET, 0); | 1506 | iwl_write32(priv, CSR_RESET, 0); |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | struct iwlagn_ucode_capabilities { | ||
1510 | u32 max_probe_length; | ||
1511 | }; | ||
1509 | 1512 | ||
1510 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); | 1513 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); |
1511 | static int iwl_mac_setup_register(struct iwl_priv *priv); | 1514 | static int iwl_mac_setup_register(struct iwl_priv *priv, |
1515 | struct iwlagn_ucode_capabilities *capa); | ||
1512 | 1516 | ||
1513 | static int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first) | 1517 | static int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first) |
1514 | { | 1518 | { |
@@ -1535,6 +1539,199 @@ static int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first) | |||
1535 | iwl_ucode_callback); | 1539 | iwl_ucode_callback); |
1536 | } | 1540 | } |
1537 | 1541 | ||
1542 | struct iwlagn_firmware_pieces { | ||
1543 | const void *inst, *data, *init, *init_data, *boot; | ||
1544 | size_t inst_size, data_size, init_size, init_data_size, boot_size; | ||
1545 | |||
1546 | u32 build; | ||
1547 | }; | ||
1548 | |||
1549 | static int iwlagn_load_legacy_firmware(struct iwl_priv *priv, | ||
1550 | const struct firmware *ucode_raw, | ||
1551 | struct iwlagn_firmware_pieces *pieces) | ||
1552 | { | ||
1553 | struct iwl_ucode_header *ucode = (void *)ucode_raw->data; | ||
1554 | u32 api_ver, hdr_size; | ||
1555 | const u8 *src; | ||
1556 | |||
1557 | priv->ucode_ver = le32_to_cpu(ucode->ver); | ||
1558 | api_ver = IWL_UCODE_API(priv->ucode_ver); | ||
1559 | |||
1560 | switch (api_ver) { | ||
1561 | default: | ||
1562 | /* | ||
1563 | * 4965 doesn't revision the firmware file format | ||
1564 | * along with the API version, it always uses v1 | ||
1565 | * file format. | ||
1566 | */ | ||
1567 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != | ||
1568 | CSR_HW_REV_TYPE_4965) { | ||
1569 | hdr_size = 28; | ||
1570 | if (ucode_raw->size < hdr_size) { | ||
1571 | IWL_ERR(priv, "File size too small!\n"); | ||
1572 | return -EINVAL; | ||
1573 | } | ||
1574 | pieces->build = le32_to_cpu(ucode->u.v2.build); | ||
1575 | pieces->inst_size = le32_to_cpu(ucode->u.v2.inst_size); | ||
1576 | pieces->data_size = le32_to_cpu(ucode->u.v2.data_size); | ||
1577 | pieces->init_size = le32_to_cpu(ucode->u.v2.init_size); | ||
1578 | pieces->init_data_size = le32_to_cpu(ucode->u.v2.init_data_size); | ||
1579 | pieces->boot_size = le32_to_cpu(ucode->u.v2.boot_size); | ||
1580 | src = ucode->u.v2.data; | ||
1581 | break; | ||
1582 | } | ||
1583 | /* fall through for 4965 */ | ||
1584 | case 0: | ||
1585 | case 1: | ||
1586 | case 2: | ||
1587 | hdr_size = 24; | ||
1588 | if (ucode_raw->size < hdr_size) { | ||
1589 | IWL_ERR(priv, "File size too small!\n"); | ||
1590 | return -EINVAL; | ||
1591 | } | ||
1592 | pieces->build = 0; | ||
1593 | pieces->inst_size = le32_to_cpu(ucode->u.v1.inst_size); | ||
1594 | pieces->data_size = le32_to_cpu(ucode->u.v1.data_size); | ||
1595 | pieces->init_size = le32_to_cpu(ucode->u.v1.init_size); | ||
1596 | pieces->init_data_size = le32_to_cpu(ucode->u.v1.init_data_size); | ||
1597 | pieces->boot_size = le32_to_cpu(ucode->u.v1.boot_size); | ||
1598 | src = ucode->u.v1.data; | ||
1599 | break; | ||
1600 | } | ||
1601 | |||
1602 | /* Verify size of file vs. image size info in file's header */ | ||
1603 | if (ucode_raw->size != hdr_size + pieces->inst_size + | ||
1604 | pieces->data_size + pieces->init_size + | ||
1605 | pieces->init_data_size + pieces->boot_size) { | ||
1606 | |||
1607 | IWL_ERR(priv, | ||
1608 | "uCode file size %d does not match expected size\n", | ||
1609 | (int)ucode_raw->size); | ||
1610 | return -EINVAL; | ||
1611 | } | ||
1612 | |||
1613 | pieces->inst = src; | ||
1614 | src += pieces->inst_size; | ||
1615 | pieces->data = src; | ||
1616 | src += pieces->data_size; | ||
1617 | pieces->init = src; | ||
1618 | src += pieces->init_size; | ||
1619 | pieces->init_data = src; | ||
1620 | src += pieces->init_data_size; | ||
1621 | pieces->boot = src; | ||
1622 | src += pieces->boot_size; | ||
1623 | |||
1624 | return 0; | ||
1625 | } | ||
1626 | |||
1627 | static int iwlagn_wanted_ucode_alternative = 1; | ||
1628 | |||
1629 | static int iwlagn_load_firmware(struct iwl_priv *priv, | ||
1630 | const struct firmware *ucode_raw, | ||
1631 | struct iwlagn_firmware_pieces *pieces, | ||
1632 | struct iwlagn_ucode_capabilities *capa) | ||
1633 | { | ||
1634 | struct iwl_tlv_ucode_header *ucode = (void *)ucode_raw->data; | ||
1635 | struct iwl_ucode_tlv *tlv; | ||
1636 | size_t len = ucode_raw->size; | ||
1637 | const u8 *data; | ||
1638 | int wanted_alternative = iwlagn_wanted_ucode_alternative, tmp; | ||
1639 | u64 alternatives; | ||
1640 | |||
1641 | if (len < sizeof(*ucode)) | ||
1642 | return -EINVAL; | ||
1643 | |||
1644 | if (ucode->magic != cpu_to_le32(IWL_TLV_UCODE_MAGIC)) | ||
1645 | return -EINVAL; | ||
1646 | |||
1647 | /* | ||
1648 | * Check which alternatives are present, and "downgrade" | ||
1649 | * when the chosen alternative is not present, warning | ||
1650 | * the user when that happens. Some files may not have | ||
1651 | * any alternatives, so don't warn in that case. | ||
1652 | */ | ||
1653 | alternatives = le64_to_cpu(ucode->alternatives); | ||
1654 | tmp = wanted_alternative; | ||
1655 | if (wanted_alternative > 63) | ||
1656 | wanted_alternative = 63; | ||
1657 | while (wanted_alternative && !(alternatives & BIT(wanted_alternative))) | ||
1658 | wanted_alternative--; | ||
1659 | if (wanted_alternative && wanted_alternative != tmp) | ||
1660 | IWL_WARN(priv, | ||
1661 | "uCode alternative %d not available, choosing %d\n", | ||
1662 | tmp, wanted_alternative); | ||
1663 | |||
1664 | priv->ucode_ver = le32_to_cpu(ucode->ver); | ||
1665 | pieces->build = le32_to_cpu(ucode->build); | ||
1666 | data = ucode->data; | ||
1667 | |||
1668 | len -= sizeof(*ucode); | ||
1669 | |||
1670 | while (len >= sizeof(*tlv)) { | ||
1671 | u32 tlv_len; | ||
1672 | enum iwl_ucode_tlv_type tlv_type; | ||
1673 | u16 tlv_alt; | ||
1674 | const u8 *tlv_data; | ||
1675 | |||
1676 | len -= sizeof(*tlv); | ||
1677 | tlv = (void *)data; | ||
1678 | |||
1679 | tlv_len = le32_to_cpu(tlv->length); | ||
1680 | tlv_type = le16_to_cpu(tlv->type); | ||
1681 | tlv_alt = le16_to_cpu(tlv->alternative); | ||
1682 | tlv_data = tlv->data; | ||
1683 | |||
1684 | if (len < tlv_len) | ||
1685 | return -EINVAL; | ||
1686 | len -= ALIGN(tlv_len, 4); | ||
1687 | data += sizeof(*tlv) + ALIGN(tlv_len, 4); | ||
1688 | |||
1689 | /* | ||
1690 | * Alternative 0 is always valid. | ||
1691 | * | ||
1692 | * Skip alternative TLVs that are not selected. | ||
1693 | */ | ||
1694 | if (tlv_alt != 0 && tlv_alt != wanted_alternative) | ||
1695 | continue; | ||
1696 | |||
1697 | switch (tlv_type) { | ||
1698 | case IWL_UCODE_TLV_INST: | ||
1699 | pieces->inst = tlv_data; | ||
1700 | pieces->inst_size = tlv_len; | ||
1701 | break; | ||
1702 | case IWL_UCODE_TLV_DATA: | ||
1703 | pieces->data = tlv_data; | ||
1704 | pieces->data_size = tlv_len; | ||
1705 | break; | ||
1706 | case IWL_UCODE_TLV_INIT: | ||
1707 | pieces->init = tlv_data; | ||
1708 | pieces->init_size = tlv_len; | ||
1709 | break; | ||
1710 | case IWL_UCODE_TLV_INIT_DATA: | ||
1711 | pieces->init_data = tlv_data; | ||
1712 | pieces->init_data_size = tlv_len; | ||
1713 | break; | ||
1714 | case IWL_UCODE_TLV_BOOT: | ||
1715 | pieces->boot = tlv_data; | ||
1716 | pieces->boot_size = tlv_len; | ||
1717 | break; | ||
1718 | case IWL_UCODE_TLV_PROBE_MAX_LEN: | ||
1719 | if (tlv_len != 4) | ||
1720 | return -EINVAL; | ||
1721 | capa->max_probe_length = | ||
1722 | le32_to_cpup((__le32 *)tlv_data); | ||
1723 | break; | ||
1724 | default: | ||
1725 | break; | ||
1726 | } | ||
1727 | } | ||
1728 | |||
1729 | if (len) | ||
1730 | return -EINVAL; | ||
1731 | |||
1732 | return 0; | ||
1733 | } | ||
1734 | |||
1538 | /** | 1735 | /** |
1539 | * iwl_ucode_callback - callback when firmware was loaded | 1736 | * iwl_ucode_callback - callback when firmware was loaded |
1540 | * | 1737 | * |
@@ -1545,14 +1742,18 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1545 | { | 1742 | { |
1546 | struct iwl_priv *priv = context; | 1743 | struct iwl_priv *priv = context; |
1547 | struct iwl_ucode_header *ucode; | 1744 | struct iwl_ucode_header *ucode; |
1745 | int err; | ||
1746 | struct iwlagn_firmware_pieces pieces; | ||
1548 | const unsigned int api_max = priv->cfg->ucode_api_max; | 1747 | const unsigned int api_max = priv->cfg->ucode_api_max; |
1549 | const unsigned int api_min = priv->cfg->ucode_api_min; | 1748 | const unsigned int api_min = priv->cfg->ucode_api_min; |
1550 | u8 *src; | 1749 | u32 api_ver; |
1551 | size_t len; | 1750 | char buildstr[25]; |
1552 | u32 api_ver, build; | 1751 | u32 build; |
1553 | u32 inst_size, data_size, init_size, init_data_size, boot_size; | 1752 | struct iwlagn_ucode_capabilities ucode_capa = { |
1554 | int err; | 1753 | .max_probe_length = 200, |
1555 | u16 eeprom_ver; | 1754 | }; |
1755 | |||
1756 | memset(&pieces, 0, sizeof(pieces)); | ||
1556 | 1757 | ||
1557 | if (!ucode_raw) { | 1758 | if (!ucode_raw) { |
1558 | IWL_ERR(priv, "request for firmware file '%s' failed.\n", | 1759 | IWL_ERR(priv, "request for firmware file '%s' failed.\n", |
@@ -1563,8 +1764,8 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1563 | IWL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n", | 1764 | IWL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n", |
1564 | priv->firmware_name, ucode_raw->size); | 1765 | priv->firmware_name, ucode_raw->size); |
1565 | 1766 | ||
1566 | /* Make sure that we got at least the v1 header! */ | 1767 | /* Make sure that we got at least the API version number */ |
1567 | if (ucode_raw->size < priv->cfg->ops->ucode->get_header_size(1)) { | 1768 | if (ucode_raw->size < 4) { |
1568 | IWL_ERR(priv, "File size way too small!\n"); | 1769 | IWL_ERR(priv, "File size way too small!\n"); |
1569 | goto try_again; | 1770 | goto try_again; |
1570 | } | 1771 | } |
@@ -1572,21 +1773,23 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1572 | /* Data from ucode file: header followed by uCode images */ | 1773 | /* Data from ucode file: header followed by uCode images */ |
1573 | ucode = (struct iwl_ucode_header *)ucode_raw->data; | 1774 | ucode = (struct iwl_ucode_header *)ucode_raw->data; |
1574 | 1775 | ||
1575 | priv->ucode_ver = le32_to_cpu(ucode->ver); | 1776 | if (ucode->ver) |
1777 | err = iwlagn_load_legacy_firmware(priv, ucode_raw, &pieces); | ||
1778 | else | ||
1779 | err = iwlagn_load_firmware(priv, ucode_raw, &pieces, | ||
1780 | &ucode_capa); | ||
1781 | |||
1782 | if (err) | ||
1783 | goto try_again; | ||
1784 | |||
1576 | api_ver = IWL_UCODE_API(priv->ucode_ver); | 1785 | api_ver = IWL_UCODE_API(priv->ucode_ver); |
1577 | build = priv->cfg->ops->ucode->get_build(ucode, api_ver); | 1786 | build = pieces.build; |
1578 | inst_size = priv->cfg->ops->ucode->get_inst_size(ucode, api_ver); | ||
1579 | data_size = priv->cfg->ops->ucode->get_data_size(ucode, api_ver); | ||
1580 | init_size = priv->cfg->ops->ucode->get_init_size(ucode, api_ver); | ||
1581 | init_data_size = | ||
1582 | priv->cfg->ops->ucode->get_init_data_size(ucode, api_ver); | ||
1583 | boot_size = priv->cfg->ops->ucode->get_boot_size(ucode, api_ver); | ||
1584 | src = priv->cfg->ops->ucode->get_data(ucode, api_ver); | ||
1585 | |||
1586 | /* api_ver should match the api version forming part of the | ||
1587 | * firmware filename ... but we don't check for that and only rely | ||
1588 | * on the API version read from firmware header from here on forward */ | ||
1589 | 1787 | ||
1788 | /* | ||
1789 | * api_ver should match the api version forming part of the | ||
1790 | * firmware filename ... but we don't check for that and only rely | ||
1791 | * on the API version read from firmware header from here on forward | ||
1792 | */ | ||
1590 | if (api_ver < api_min || api_ver > api_max) { | 1793 | if (api_ver < api_min || api_ver > api_max) { |
1591 | IWL_ERR(priv, "Driver unable to support your firmware API. " | 1794 | IWL_ERR(priv, "Driver unable to support your firmware API. " |
1592 | "Driver supports v%u, firmware is v%u.\n", | 1795 | "Driver supports v%u, firmware is v%u.\n", |
@@ -1600,40 +1803,26 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1600 | "from http://www.intellinuxwireless.org.\n", | 1803 | "from http://www.intellinuxwireless.org.\n", |
1601 | api_max, api_ver); | 1804 | api_max, api_ver); |
1602 | 1805 | ||
1603 | IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n", | 1806 | if (build) |
1604 | IWL_UCODE_MAJOR(priv->ucode_ver), | 1807 | sprintf(buildstr, " build %u", build); |
1605 | IWL_UCODE_MINOR(priv->ucode_ver), | 1808 | else |
1606 | IWL_UCODE_API(priv->ucode_ver), | 1809 | buildstr[0] = '\0'; |
1607 | IWL_UCODE_SERIAL(priv->ucode_ver)); | 1810 | |
1811 | IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u%s\n", | ||
1812 | IWL_UCODE_MAJOR(priv->ucode_ver), | ||
1813 | IWL_UCODE_MINOR(priv->ucode_ver), | ||
1814 | IWL_UCODE_API(priv->ucode_ver), | ||
1815 | IWL_UCODE_SERIAL(priv->ucode_ver), | ||
1816 | buildstr); | ||
1608 | 1817 | ||
1609 | snprintf(priv->hw->wiphy->fw_version, | 1818 | snprintf(priv->hw->wiphy->fw_version, |
1610 | sizeof(priv->hw->wiphy->fw_version), | 1819 | sizeof(priv->hw->wiphy->fw_version), |
1611 | "%u.%u.%u.%u", | 1820 | "%u.%u.%u.%u%s", |
1612 | IWL_UCODE_MAJOR(priv->ucode_ver), | 1821 | IWL_UCODE_MAJOR(priv->ucode_ver), |
1613 | IWL_UCODE_MINOR(priv->ucode_ver), | 1822 | IWL_UCODE_MINOR(priv->ucode_ver), |
1614 | IWL_UCODE_API(priv->ucode_ver), | 1823 | IWL_UCODE_API(priv->ucode_ver), |
1615 | IWL_UCODE_SERIAL(priv->ucode_ver)); | 1824 | IWL_UCODE_SERIAL(priv->ucode_ver), |
1616 | 1825 | buildstr); | |
1617 | if (build) | ||
1618 | IWL_DEBUG_INFO(priv, "Build %u\n", build); | ||
1619 | |||
1620 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); | ||
1621 | IWL_DEBUG_INFO(priv, "NVM Type: %s, version: 0x%x\n", | ||
1622 | (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) | ||
1623 | ? "OTP" : "EEPROM", eeprom_ver); | ||
1624 | |||
1625 | IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", | ||
1626 | priv->ucode_ver); | ||
1627 | IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %u\n", | ||
1628 | inst_size); | ||
1629 | IWL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %u\n", | ||
1630 | data_size); | ||
1631 | IWL_DEBUG_INFO(priv, "f/w package hdr init inst size = %u\n", | ||
1632 | init_size); | ||
1633 | IWL_DEBUG_INFO(priv, "f/w package hdr init data size = %u\n", | ||
1634 | init_data_size); | ||
1635 | IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n", | ||
1636 | boot_size); | ||
1637 | 1826 | ||
1638 | /* | 1827 | /* |
1639 | * For any of the failures below (before allocating pci memory) | 1828 | * For any of the failures below (before allocating pci memory) |
@@ -1641,43 +1830,47 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1641 | * user just got a corrupted version of the latest API. | 1830 | * user just got a corrupted version of the latest API. |
1642 | */ | 1831 | */ |
1643 | 1832 | ||
1644 | /* Verify size of file vs. image size info in file's header */ | 1833 | IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", |
1645 | if (ucode_raw->size != | 1834 | priv->ucode_ver); |
1646 | priv->cfg->ops->ucode->get_header_size(api_ver) + | 1835 | IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %Zd\n", |
1647 | inst_size + data_size + init_size + | 1836 | pieces.inst_size); |
1648 | init_data_size + boot_size) { | 1837 | IWL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %Zd\n", |
1649 | 1838 | pieces.data_size); | |
1650 | IWL_DEBUG_INFO(priv, | 1839 | IWL_DEBUG_INFO(priv, "f/w package hdr init inst size = %Zd\n", |
1651 | "uCode file size %d does not match expected size\n", | 1840 | pieces.init_size); |
1652 | (int)ucode_raw->size); | 1841 | IWL_DEBUG_INFO(priv, "f/w package hdr init data size = %Zd\n", |
1653 | goto try_again; | 1842 | pieces.init_data_size); |
1654 | } | 1843 | IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %Zd\n", |
1844 | pieces.boot_size); | ||
1655 | 1845 | ||
1656 | /* Verify that uCode images will fit in card's SRAM */ | 1846 | /* Verify that uCode images will fit in card's SRAM */ |
1657 | if (inst_size > priv->hw_params.max_inst_size) { | 1847 | if (pieces.inst_size > priv->hw_params.max_inst_size) { |
1658 | IWL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n", | 1848 | IWL_ERR(priv, "uCode instr len %Zd too large to fit in\n", |
1659 | inst_size); | 1849 | pieces.inst_size); |
1660 | goto try_again; | 1850 | goto try_again; |
1661 | } | 1851 | } |
1662 | 1852 | ||
1663 | if (data_size > priv->hw_params.max_data_size) { | 1853 | if (pieces.data_size > priv->hw_params.max_data_size) { |
1664 | IWL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n", | 1854 | IWL_ERR(priv, "uCode data len %Zd too large to fit in\n", |
1665 | data_size); | 1855 | pieces.data_size); |
1666 | goto try_again; | 1856 | goto try_again; |
1667 | } | 1857 | } |
1668 | if (init_size > priv->hw_params.max_inst_size) { | 1858 | |
1669 | IWL_INFO(priv, "uCode init instr len %d too large to fit in\n", | 1859 | if (pieces.init_size > priv->hw_params.max_inst_size) { |
1670 | init_size); | 1860 | IWL_ERR(priv, "uCode init instr len %Zd too large to fit in\n", |
1861 | pieces.init_size); | ||
1671 | goto try_again; | 1862 | goto try_again; |
1672 | } | 1863 | } |
1673 | if (init_data_size > priv->hw_params.max_data_size) { | 1864 | |
1674 | IWL_INFO(priv, "uCode init data len %d too large to fit in\n", | 1865 | if (pieces.init_data_size > priv->hw_params.max_data_size) { |
1675 | init_data_size); | 1866 | IWL_ERR(priv, "uCode init data len %Zd too large to fit in\n", |
1867 | pieces.init_data_size); | ||
1676 | goto try_again; | 1868 | goto try_again; |
1677 | } | 1869 | } |
1678 | if (boot_size > priv->hw_params.max_bsm_size) { | 1870 | |
1679 | IWL_INFO(priv, "uCode boot instr len %d too large to fit in\n", | 1871 | if (pieces.boot_size > priv->hw_params.max_bsm_size) { |
1680 | boot_size); | 1872 | IWL_ERR(priv, "uCode boot instr len %Zd too large to fit in\n", |
1873 | pieces.boot_size); | ||
1681 | goto try_again; | 1874 | goto try_again; |
1682 | } | 1875 | } |
1683 | 1876 | ||
@@ -1686,13 +1879,13 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1686 | /* Runtime instructions and 2 copies of data: | 1879 | /* Runtime instructions and 2 copies of data: |
1687 | * 1) unmodified from disk | 1880 | * 1) unmodified from disk |
1688 | * 2) backup cache for save/restore during power-downs */ | 1881 | * 2) backup cache for save/restore during power-downs */ |
1689 | priv->ucode_code.len = inst_size; | 1882 | priv->ucode_code.len = pieces.inst_size; |
1690 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); | 1883 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); |
1691 | 1884 | ||
1692 | priv->ucode_data.len = data_size; | 1885 | priv->ucode_data.len = pieces.data_size; |
1693 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); | 1886 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); |
1694 | 1887 | ||
1695 | priv->ucode_data_backup.len = data_size; | 1888 | priv->ucode_data_backup.len = pieces.data_size; |
1696 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); | 1889 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); |
1697 | 1890 | ||
1698 | if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || | 1891 | if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || |
@@ -1700,11 +1893,11 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1700 | goto err_pci_alloc; | 1893 | goto err_pci_alloc; |
1701 | 1894 | ||
1702 | /* Initialization instructions and data */ | 1895 | /* Initialization instructions and data */ |
1703 | if (init_size && init_data_size) { | 1896 | if (pieces.init_size && pieces.init_data_size) { |
1704 | priv->ucode_init.len = init_size; | 1897 | priv->ucode_init.len = pieces.init_size; |
1705 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); | 1898 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); |
1706 | 1899 | ||
1707 | priv->ucode_init_data.len = init_data_size; | 1900 | priv->ucode_init_data.len = pieces.init_data_size; |
1708 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); | 1901 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); |
1709 | 1902 | ||
1710 | if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) | 1903 | if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) |
@@ -1712,8 +1905,8 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1712 | } | 1905 | } |
1713 | 1906 | ||
1714 | /* Bootstrap (instructions only, no data) */ | 1907 | /* Bootstrap (instructions only, no data) */ |
1715 | if (boot_size) { | 1908 | if (pieces.boot_size) { |
1716 | priv->ucode_boot.len = boot_size; | 1909 | priv->ucode_boot.len = pieces.boot_size; |
1717 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); | 1910 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); |
1718 | 1911 | ||
1719 | if (!priv->ucode_boot.v_addr) | 1912 | if (!priv->ucode_boot.v_addr) |
@@ -1723,51 +1916,48 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1723 | /* Copy images into buffers for card's bus-master reads ... */ | 1916 | /* Copy images into buffers for card's bus-master reads ... */ |
1724 | 1917 | ||
1725 | /* Runtime instructions (first block of data in file) */ | 1918 | /* Runtime instructions (first block of data in file) */ |
1726 | len = inst_size; | 1919 | IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %Zd\n", |
1727 | IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %Zd\n", len); | 1920 | pieces.inst_size); |
1728 | memcpy(priv->ucode_code.v_addr, src, len); | 1921 | memcpy(priv->ucode_code.v_addr, pieces.inst, pieces.inst_size); |
1729 | src += len; | ||
1730 | 1922 | ||
1731 | IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", | 1923 | IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", |
1732 | priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); | 1924 | priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); |
1733 | 1925 | ||
1734 | /* Runtime data (2nd block) | 1926 | /* |
1735 | * NOTE: Copy into backup buffer will be done in iwl_up() */ | 1927 | * Runtime data |
1736 | len = data_size; | 1928 | * NOTE: Copy into backup buffer will be done in iwl_up() |
1737 | IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n", len); | 1929 | */ |
1738 | memcpy(priv->ucode_data.v_addr, src, len); | 1930 | IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n", |
1739 | memcpy(priv->ucode_data_backup.v_addr, src, len); | 1931 | pieces.data_size); |
1740 | src += len; | 1932 | memcpy(priv->ucode_data.v_addr, pieces.data, pieces.data_size); |
1741 | 1933 | memcpy(priv->ucode_data_backup.v_addr, pieces.data, pieces.data_size); | |
1742 | /* Initialization instructions (3rd block) */ | 1934 | |
1743 | if (init_size) { | 1935 | /* Initialization instructions */ |
1744 | len = init_size; | 1936 | if (pieces.init_size) { |
1745 | IWL_DEBUG_INFO(priv, "Copying (but not loading) init instr len %Zd\n", | 1937 | IWL_DEBUG_INFO(priv, "Copying (but not loading) init instr len %Zd\n", |
1746 | len); | 1938 | pieces.init_size); |
1747 | memcpy(priv->ucode_init.v_addr, src, len); | 1939 | memcpy(priv->ucode_init.v_addr, pieces.init, pieces.init_size); |
1748 | src += len; | ||
1749 | } | 1940 | } |
1750 | 1941 | ||
1751 | /* Initialization data (4th block) */ | 1942 | /* Initialization data */ |
1752 | if (init_data_size) { | 1943 | if (pieces.init_data_size) { |
1753 | len = init_data_size; | ||
1754 | IWL_DEBUG_INFO(priv, "Copying (but not loading) init data len %Zd\n", | 1944 | IWL_DEBUG_INFO(priv, "Copying (but not loading) init data len %Zd\n", |
1755 | len); | 1945 | pieces.init_data_size); |
1756 | memcpy(priv->ucode_init_data.v_addr, src, len); | 1946 | memcpy(priv->ucode_init_data.v_addr, pieces.init_data, |
1757 | src += len; | 1947 | pieces.init_data_size); |
1758 | } | 1948 | } |
1759 | 1949 | ||
1760 | /* Bootstrap instructions (5th block) */ | 1950 | /* Bootstrap instructions */ |
1761 | len = boot_size; | 1951 | IWL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", |
1762 | IWL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", len); | 1952 | pieces.boot_size); |
1763 | memcpy(priv->ucode_boot.v_addr, src, len); | 1953 | memcpy(priv->ucode_boot.v_addr, pieces.boot, pieces.boot_size); |
1764 | 1954 | ||
1765 | /************************************************** | 1955 | /************************************************** |
1766 | * This is still part of probe() in a sense... | 1956 | * This is still part of probe() in a sense... |
1767 | * | 1957 | * |
1768 | * 9. Setup and register with mac80211 and debugfs | 1958 | * 9. Setup and register with mac80211 and debugfs |
1769 | **************************************************/ | 1959 | **************************************************/ |
1770 | err = iwl_mac_setup_register(priv); | 1960 | err = iwl_mac_setup_register(priv, &ucode_capa); |
1771 | if (err) | 1961 | if (err) |
1772 | goto out_unbind; | 1962 | goto out_unbind; |
1773 | 1963 | ||
@@ -1777,6 +1967,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1777 | 1967 | ||
1778 | /* We have our copies now, allow OS release its copies */ | 1968 | /* We have our copies now, allow OS release its copies */ |
1779 | release_firmware(ucode_raw); | 1969 | release_firmware(ucode_raw); |
1970 | complete(&priv->_agn.firmware_loading_complete); | ||
1780 | return; | 1971 | return; |
1781 | 1972 | ||
1782 | try_again: | 1973 | try_again: |
@@ -1790,6 +1981,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1790 | IWL_ERR(priv, "failed to allocate pci memory\n"); | 1981 | IWL_ERR(priv, "failed to allocate pci memory\n"); |
1791 | iwl_dealloc_ucode_pci(priv); | 1982 | iwl_dealloc_ucode_pci(priv); |
1792 | out_unbind: | 1983 | out_unbind: |
1984 | complete(&priv->_agn.firmware_loading_complete); | ||
1793 | device_release_driver(&priv->pci_dev->dev); | 1985 | device_release_driver(&priv->pci_dev->dev); |
1794 | release_firmware(ucode_raw); | 1986 | release_firmware(ucode_raw); |
1795 | } | 1987 | } |
@@ -2165,7 +2357,7 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
2165 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2357 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2166 | } else { | 2358 | } else { |
2167 | /* Initialize our rx_config data */ | 2359 | /* Initialize our rx_config data */ |
2168 | iwl_connection_init_rx_config(priv, priv->iw_mode); | 2360 | iwl_connection_init_rx_config(priv, NULL); |
2169 | 2361 | ||
2170 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2362 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
2171 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 2363 | priv->cfg->ops->hcmd->set_rxon_chain(priv); |
@@ -2212,7 +2404,9 @@ static void __iwl_down(struct iwl_priv *priv) | |||
2212 | if (!exit_pending) | 2404 | if (!exit_pending) |
2213 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 2405 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
2214 | 2406 | ||
2215 | iwl_clear_ucode_stations(priv, true); | 2407 | iwl_clear_ucode_stations(priv); |
2408 | iwl_dealloc_bcast_station(priv); | ||
2409 | iwl_clear_driver_stations(priv); | ||
2216 | 2410 | ||
2217 | /* Unblock any waiting calls */ | 2411 | /* Unblock any waiting calls */ |
2218 | wake_up_interruptible_all(&priv->wait_command_queue); | 2412 | wake_up_interruptible_all(&priv->wait_command_queue); |
@@ -2359,6 +2553,10 @@ static int __iwl_up(struct iwl_priv *priv) | |||
2359 | return -EIO; | 2553 | return -EIO; |
2360 | } | 2554 | } |
2361 | 2555 | ||
2556 | ret = iwl_alloc_bcast_station(priv, true); | ||
2557 | if (ret) | ||
2558 | return ret; | ||
2559 | |||
2362 | iwl_prepare_card_hw(priv); | 2560 | iwl_prepare_card_hw(priv); |
2363 | 2561 | ||
2364 | if (!priv->hw_ready) { | 2562 | if (!priv->hw_ready) { |
@@ -2538,12 +2736,15 @@ static void iwl_bg_rx_replenish(struct work_struct *data) | |||
2538 | 2736 | ||
2539 | #define IWL_DELAY_NEXT_SCAN (HZ*2) | 2737 | #define IWL_DELAY_NEXT_SCAN (HZ*2) |
2540 | 2738 | ||
2541 | void iwl_post_associate(struct iwl_priv *priv) | 2739 | void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) |
2542 | { | 2740 | { |
2543 | struct ieee80211_conf *conf = NULL; | 2741 | struct ieee80211_conf *conf = NULL; |
2544 | int ret = 0; | 2742 | int ret = 0; |
2545 | 2743 | ||
2546 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | 2744 | if (!vif || !priv->is_open) |
2745 | return; | ||
2746 | |||
2747 | if (vif->type == NL80211_IFTYPE_AP) { | ||
2547 | IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__); | 2748 | IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__); |
2548 | return; | 2749 | return; |
2549 | } | 2750 | } |
@@ -2551,10 +2752,6 @@ void iwl_post_associate(struct iwl_priv *priv) | |||
2551 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2752 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
2552 | return; | 2753 | return; |
2553 | 2754 | ||
2554 | |||
2555 | if (!priv->vif || !priv->is_open) | ||
2556 | return; | ||
2557 | |||
2558 | iwl_scan_cancel_timeout(priv, 200); | 2755 | iwl_scan_cancel_timeout(priv, 200); |
2559 | 2756 | ||
2560 | conf = ieee80211_get_hw_conf(priv->hw); | 2757 | conf = ieee80211_get_hw_conf(priv->hw); |
@@ -2562,7 +2759,7 @@ void iwl_post_associate(struct iwl_priv *priv) | |||
2562 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2759 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2563 | iwlcore_commit_rxon(priv); | 2760 | iwlcore_commit_rxon(priv); |
2564 | 2761 | ||
2565 | iwl_setup_rxon_timing(priv); | 2762 | iwl_setup_rxon_timing(priv, vif); |
2566 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 2763 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
2567 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 2764 | sizeof(priv->rxon_timing), &priv->rxon_timing); |
2568 | if (ret) | 2765 | if (ret) |
@@ -2576,49 +2773,41 @@ void iwl_post_associate(struct iwl_priv *priv) | |||
2576 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2773 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
2577 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 2774 | priv->cfg->ops->hcmd->set_rxon_chain(priv); |
2578 | 2775 | ||
2579 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); | 2776 | priv->staging_rxon.assoc_id = cpu_to_le16(vif->bss_conf.aid); |
2580 | 2777 | ||
2581 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", | 2778 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", |
2582 | priv->assoc_id, priv->beacon_int); | 2779 | vif->bss_conf.aid, vif->bss_conf.beacon_int); |
2583 | 2780 | ||
2584 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) | 2781 | if (vif->bss_conf.assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) |
2585 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 2782 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
2586 | else | 2783 | else |
2587 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; | 2784 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; |
2588 | 2785 | ||
2589 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { | 2786 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { |
2590 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) | 2787 | if (vif->bss_conf.assoc_capability & |
2788 | WLAN_CAPABILITY_SHORT_SLOT_TIME) | ||
2591 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 2789 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; |
2592 | else | 2790 | else |
2593 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 2791 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
2594 | 2792 | ||
2595 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) | 2793 | if (vif->type == NL80211_IFTYPE_ADHOC) |
2596 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 2794 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
2597 | |||
2598 | } | 2795 | } |
2599 | 2796 | ||
2600 | iwlcore_commit_rxon(priv); | 2797 | iwlcore_commit_rxon(priv); |
2601 | 2798 | ||
2602 | IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", | 2799 | IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", |
2603 | priv->assoc_id, priv->active_rxon.bssid_addr); | 2800 | vif->bss_conf.aid, priv->active_rxon.bssid_addr); |
2604 | 2801 | ||
2605 | switch (priv->iw_mode) { | 2802 | switch (vif->type) { |
2606 | case NL80211_IFTYPE_STATION: | 2803 | case NL80211_IFTYPE_STATION: |
2607 | break; | 2804 | break; |
2608 | |||
2609 | case NL80211_IFTYPE_ADHOC: | 2805 | case NL80211_IFTYPE_ADHOC: |
2610 | |||
2611 | /* assume default assoc id */ | ||
2612 | priv->assoc_id = 1; | ||
2613 | |||
2614 | iwl_add_local_station(priv, priv->bssid, true); | ||
2615 | iwl_send_beacon_cmd(priv); | 2806 | iwl_send_beacon_cmd(priv); |
2616 | |||
2617 | break; | 2807 | break; |
2618 | |||
2619 | default: | 2808 | default: |
2620 | IWL_ERR(priv, "%s Should not be called in %d mode\n", | 2809 | IWL_ERR(priv, "%s Should not be called in %d mode\n", |
2621 | __func__, priv->iw_mode); | 2810 | __func__, vif->type); |
2622 | break; | 2811 | break; |
2623 | } | 2812 | } |
2624 | 2813 | ||
@@ -2646,7 +2835,8 @@ void iwl_post_associate(struct iwl_priv *priv) | |||
2646 | * Not a mac80211 entry point function, but it fits in with all the | 2835 | * Not a mac80211 entry point function, but it fits in with all the |
2647 | * other mac80211 functions grouped here. | 2836 | * other mac80211 functions grouped here. |
2648 | */ | 2837 | */ |
2649 | static int iwl_mac_setup_register(struct iwl_priv *priv) | 2838 | static int iwl_mac_setup_register(struct iwl_priv *priv, |
2839 | struct iwlagn_ucode_capabilities *capa) | ||
2650 | { | 2840 | { |
2651 | int ret; | 2841 | int ret; |
2652 | struct ieee80211_hw *hw = priv->hw; | 2842 | struct ieee80211_hw *hw = priv->hw; |
@@ -2666,6 +2856,8 @@ static int iwl_mac_setup_register(struct iwl_priv *priv) | |||
2666 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; | 2856 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; |
2667 | 2857 | ||
2668 | hw->sta_data_size = sizeof(struct iwl_station_priv); | 2858 | hw->sta_data_size = sizeof(struct iwl_station_priv); |
2859 | hw->vif_data_size = sizeof(struct iwl_vif_priv); | ||
2860 | |||
2669 | hw->wiphy->interface_modes = | 2861 | hw->wiphy->interface_modes = |
2670 | BIT(NL80211_IFTYPE_STATION) | | 2862 | BIT(NL80211_IFTYPE_STATION) | |
2671 | BIT(NL80211_IFTYPE_ADHOC); | 2863 | BIT(NL80211_IFTYPE_ADHOC); |
@@ -2681,7 +2873,7 @@ static int iwl_mac_setup_register(struct iwl_priv *priv) | |||
2681 | 2873 | ||
2682 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; | 2874 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; |
2683 | /* we create the 802.11 header and a zero-length SSID element */ | 2875 | /* we create the 802.11 header and a zero-length SSID element */ |
2684 | hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; | 2876 | hw->wiphy->max_scan_ie_len = capa->max_probe_length - 24 - 2; |
2685 | 2877 | ||
2686 | /* Default value; 4 EDCA QOS priorities */ | 2878 | /* Default value; 4 EDCA QOS priorities */ |
2687 | hw->queues = 4; | 2879 | hw->queues = 4; |
@@ -2794,7 +2986,7 @@ static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2794 | return NETDEV_TX_OK; | 2986 | return NETDEV_TX_OK; |
2795 | } | 2987 | } |
2796 | 2988 | ||
2797 | void iwl_config_ap(struct iwl_priv *priv) | 2989 | void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) |
2798 | { | 2990 | { |
2799 | int ret = 0; | 2991 | int ret = 0; |
2800 | 2992 | ||
@@ -2809,7 +3001,7 @@ void iwl_config_ap(struct iwl_priv *priv) | |||
2809 | iwlcore_commit_rxon(priv); | 3001 | iwlcore_commit_rxon(priv); |
2810 | 3002 | ||
2811 | /* RXON Timing */ | 3003 | /* RXON Timing */ |
2812 | iwl_setup_rxon_timing(priv); | 3004 | iwl_setup_rxon_timing(priv, vif); |
2813 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 3005 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
2814 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 3006 | sizeof(priv->rxon_timing), &priv->rxon_timing); |
2815 | if (ret) | 3007 | if (ret) |
@@ -2823,9 +3015,10 @@ void iwl_config_ap(struct iwl_priv *priv) | |||
2823 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 3015 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
2824 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 3016 | priv->cfg->ops->hcmd->set_rxon_chain(priv); |
2825 | 3017 | ||
2826 | /* FIXME: what should be the assoc_id for AP? */ | 3018 | priv->staging_rxon.assoc_id = 0; |
2827 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); | 3019 | |
2828 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) | 3020 | if (vif->bss_conf.assoc_capability & |
3021 | WLAN_CAPABILITY_SHORT_PREAMBLE) | ||
2829 | priv->staging_rxon.flags |= | 3022 | priv->staging_rxon.flags |= |
2830 | RXON_FLG_SHORT_PREAMBLE_MSK; | 3023 | RXON_FLG_SHORT_PREAMBLE_MSK; |
2831 | else | 3024 | else |
@@ -2833,22 +3026,21 @@ void iwl_config_ap(struct iwl_priv *priv) | |||
2833 | ~RXON_FLG_SHORT_PREAMBLE_MSK; | 3026 | ~RXON_FLG_SHORT_PREAMBLE_MSK; |
2834 | 3027 | ||
2835 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { | 3028 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { |
2836 | if (priv->assoc_capability & | 3029 | if (vif->bss_conf.assoc_capability & |
2837 | WLAN_CAPABILITY_SHORT_SLOT_TIME) | 3030 | WLAN_CAPABILITY_SHORT_SLOT_TIME) |
2838 | priv->staging_rxon.flags |= | 3031 | priv->staging_rxon.flags |= |
2839 | RXON_FLG_SHORT_SLOT_MSK; | 3032 | RXON_FLG_SHORT_SLOT_MSK; |
2840 | else | 3033 | else |
2841 | priv->staging_rxon.flags &= | 3034 | priv->staging_rxon.flags &= |
2842 | ~RXON_FLG_SHORT_SLOT_MSK; | 3035 | ~RXON_FLG_SHORT_SLOT_MSK; |
2843 | 3036 | ||
2844 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) | 3037 | if (vif->type == NL80211_IFTYPE_ADHOC) |
2845 | priv->staging_rxon.flags &= | 3038 | priv->staging_rxon.flags &= |
2846 | ~RXON_FLG_SHORT_SLOT_MSK; | 3039 | ~RXON_FLG_SHORT_SLOT_MSK; |
2847 | } | 3040 | } |
2848 | /* restore RXON assoc */ | 3041 | /* restore RXON assoc */ |
2849 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 3042 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; |
2850 | iwlcore_commit_rxon(priv); | 3043 | iwlcore_commit_rxon(priv); |
2851 | iwl_add_bcast_station(priv); | ||
2852 | } | 3044 | } |
2853 | iwl_send_beacon_cmd(priv); | 3045 | iwl_send_beacon_cmd(priv); |
2854 | 3046 | ||
@@ -2867,8 +3059,7 @@ static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw, | |||
2867 | struct iwl_priv *priv = hw->priv; | 3059 | struct iwl_priv *priv = hw->priv; |
2868 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 3060 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
2869 | 3061 | ||
2870 | iwl_update_tkip_key(priv, keyconf, | 3062 | iwl_update_tkip_key(priv, keyconf, sta, |
2871 | sta ? sta->addr : iwl_bcast_addr, | ||
2872 | iv32, phase1key); | 3063 | iv32, phase1key); |
2873 | 3064 | ||
2874 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 3065 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
@@ -2880,7 +3071,6 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2880 | struct ieee80211_key_conf *key) | 3071 | struct ieee80211_key_conf *key) |
2881 | { | 3072 | { |
2882 | struct iwl_priv *priv = hw->priv; | 3073 | struct iwl_priv *priv = hw->priv; |
2883 | const u8 *addr; | ||
2884 | int ret; | 3074 | int ret; |
2885 | u8 sta_id; | 3075 | u8 sta_id; |
2886 | bool is_default_wep_key = false; | 3076 | bool is_default_wep_key = false; |
@@ -2891,13 +3081,17 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2891 | IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); | 3081 | IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); |
2892 | return -EOPNOTSUPP; | 3082 | return -EOPNOTSUPP; |
2893 | } | 3083 | } |
2894 | addr = sta ? sta->addr : iwl_bcast_addr; | ||
2895 | sta_id = iwl_find_station(priv, addr); | ||
2896 | if (sta_id == IWL_INVALID_STATION) { | ||
2897 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", | ||
2898 | addr); | ||
2899 | return -EINVAL; | ||
2900 | 3084 | ||
3085 | if (sta) { | ||
3086 | sta_id = iwl_sta_id(sta); | ||
3087 | |||
3088 | if (sta_id == IWL_INVALID_STATION) { | ||
3089 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", | ||
3090 | sta->addr); | ||
3091 | return -EINVAL; | ||
3092 | } | ||
3093 | } else { | ||
3094 | sta_id = priv->hw_params.bcast_sta_id; | ||
2901 | } | 3095 | } |
2902 | 3096 | ||
2903 | mutex_lock(&priv->mutex); | 3097 | mutex_lock(&priv->mutex); |
@@ -2946,8 +3140,8 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2946 | 3140 | ||
2947 | static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, | 3141 | static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, |
2948 | struct ieee80211_vif *vif, | 3142 | struct ieee80211_vif *vif, |
2949 | enum ieee80211_ampdu_mlme_action action, | 3143 | enum ieee80211_ampdu_mlme_action action, |
2950 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) | 3144 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) |
2951 | { | 3145 | { |
2952 | struct iwl_priv *priv = hw->priv; | 3146 | struct iwl_priv *priv = hw->priv; |
2953 | int ret; | 3147 | int ret; |
@@ -2961,17 +3155,17 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, | |||
2961 | switch (action) { | 3155 | switch (action) { |
2962 | case IEEE80211_AMPDU_RX_START: | 3156 | case IEEE80211_AMPDU_RX_START: |
2963 | IWL_DEBUG_HT(priv, "start Rx\n"); | 3157 | IWL_DEBUG_HT(priv, "start Rx\n"); |
2964 | return iwl_sta_rx_agg_start(priv, sta->addr, tid, *ssn); | 3158 | return iwl_sta_rx_agg_start(priv, sta, tid, *ssn); |
2965 | case IEEE80211_AMPDU_RX_STOP: | 3159 | case IEEE80211_AMPDU_RX_STOP: |
2966 | IWL_DEBUG_HT(priv, "stop Rx\n"); | 3160 | IWL_DEBUG_HT(priv, "stop Rx\n"); |
2967 | ret = iwl_sta_rx_agg_stop(priv, sta->addr, tid); | 3161 | ret = iwl_sta_rx_agg_stop(priv, sta, tid); |
2968 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 3162 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
2969 | return 0; | 3163 | return 0; |
2970 | else | 3164 | else |
2971 | return ret; | 3165 | return ret; |
2972 | case IEEE80211_AMPDU_TX_START: | 3166 | case IEEE80211_AMPDU_TX_START: |
2973 | IWL_DEBUG_HT(priv, "start Tx\n"); | 3167 | IWL_DEBUG_HT(priv, "start Tx\n"); |
2974 | ret = iwlagn_tx_agg_start(priv, sta->addr, tid, ssn); | 3168 | ret = iwlagn_tx_agg_start(priv, vif, sta, tid, ssn); |
2975 | if (ret == 0) { | 3169 | if (ret == 0) { |
2976 | priv->_agn.agg_tids_count++; | 3170 | priv->_agn.agg_tids_count++; |
2977 | IWL_DEBUG_HT(priv, "priv->_agn.agg_tids_count = %u\n", | 3171 | IWL_DEBUG_HT(priv, "priv->_agn.agg_tids_count = %u\n", |
@@ -2980,7 +3174,7 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, | |||
2980 | return ret; | 3174 | return ret; |
2981 | case IEEE80211_AMPDU_TX_STOP: | 3175 | case IEEE80211_AMPDU_TX_STOP: |
2982 | IWL_DEBUG_HT(priv, "stop Tx\n"); | 3176 | IWL_DEBUG_HT(priv, "stop Tx\n"); |
2983 | ret = iwlagn_tx_agg_stop(priv, sta->addr, tid); | 3177 | ret = iwlagn_tx_agg_stop(priv, vif, sta, tid); |
2984 | if ((ret == 0) && (priv->_agn.agg_tids_count > 0)) { | 3178 | if ((ret == 0) && (priv->_agn.agg_tids_count > 0)) { |
2985 | priv->_agn.agg_tids_count--; | 3179 | priv->_agn.agg_tids_count--; |
2986 | IWL_DEBUG_HT(priv, "priv->_agn.agg_tids_count = %u\n", | 3180 | IWL_DEBUG_HT(priv, "priv->_agn.agg_tids_count = %u\n", |
@@ -3022,7 +3216,7 @@ static void iwl_mac_sta_notify(struct ieee80211_hw *hw, | |||
3022 | if (!sta_priv->asleep) | 3216 | if (!sta_priv->asleep) |
3023 | break; | 3217 | break; |
3024 | sta_priv->asleep = false; | 3218 | sta_priv->asleep = false; |
3025 | sta_id = iwl_find_station(priv, sta->addr); | 3219 | sta_id = iwl_sta_id(sta); |
3026 | if (sta_id != IWL_INVALID_STATION) | 3220 | if (sta_id != IWL_INVALID_STATION) |
3027 | iwl_sta_modify_ps_wake(priv, sta_id); | 3221 | iwl_sta_modify_ps_wake(priv, sta_id); |
3028 | break; | 3222 | break; |
@@ -3037,10 +3231,12 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, | |||
3037 | { | 3231 | { |
3038 | struct iwl_priv *priv = hw->priv; | 3232 | struct iwl_priv *priv = hw->priv; |
3039 | struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; | 3233 | struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; |
3040 | bool is_ap = priv->iw_mode == NL80211_IFTYPE_STATION; | 3234 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; |
3041 | int ret; | 3235 | int ret; |
3042 | u8 sta_id; | 3236 | u8 sta_id; |
3043 | 3237 | ||
3238 | sta_priv->common.sta_id = IWL_INVALID_STATION; | ||
3239 | |||
3044 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", | 3240 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", |
3045 | sta->addr); | 3241 | sta->addr); |
3046 | 3242 | ||
@@ -3057,12 +3253,14 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, | |||
3057 | return ret; | 3253 | return ret; |
3058 | } | 3254 | } |
3059 | 3255 | ||
3256 | sta_priv->common.sta_id = sta_id; | ||
3257 | |||
3060 | /* Initialize rate scaling */ | 3258 | /* Initialize rate scaling */ |
3061 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", | 3259 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", |
3062 | sta->addr); | 3260 | sta->addr); |
3063 | iwl_rs_rate_init(priv, sta, sta_id); | 3261 | iwl_rs_rate_init(priv, sta, sta_id); |
3064 | 3262 | ||
3065 | return ret; | 3263 | return 0; |
3066 | } | 3264 | } |
3067 | 3265 | ||
3068 | /***************************************************************************** | 3266 | /***************************************************************************** |
@@ -3587,6 +3785,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3587 | iwl_power_initialize(priv); | 3785 | iwl_power_initialize(priv); |
3588 | iwl_tt_initialize(priv); | 3786 | iwl_tt_initialize(priv); |
3589 | 3787 | ||
3788 | init_completion(&priv->_agn.firmware_loading_complete); | ||
3789 | |||
3590 | err = iwl_request_firmware(priv, true); | 3790 | err = iwl_request_firmware(priv, true); |
3591 | if (err) | 3791 | if (err) |
3592 | goto out_remove_sysfs; | 3792 | goto out_remove_sysfs; |
@@ -3627,6 +3827,8 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev) | |||
3627 | if (!priv) | 3827 | if (!priv) |
3628 | return; | 3828 | return; |
3629 | 3829 | ||
3830 | wait_for_completion(&priv->_agn.firmware_loading_complete); | ||
3831 | |||
3630 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); | 3832 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); |
3631 | 3833 | ||
3632 | iwl_dbgfs_unregister(priv); | 3834 | iwl_dbgfs_unregister(priv); |
@@ -3784,11 +3986,10 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | |||
3784 | {IWL_PCI_DEVICE(0x4239, 0x1311, iwl6000i_2agn_cfg)}, | 3986 | {IWL_PCI_DEVICE(0x4239, 0x1311, iwl6000i_2agn_cfg)}, |
3785 | {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)}, | 3987 | {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)}, |
3786 | 3988 | ||
3787 | /* 6x00 Series Gen2 */ | 3989 | /* 6x00 Series Gen2a */ |
3788 | {IWL_PCI_DEVICE(0x0082, 0x1201, iwl6000g2_2agn_cfg)}, | 3990 | {IWL_PCI_DEVICE(0x0082, 0x1201, iwl6000g2a_2agn_cfg)}, |
3789 | {IWL_PCI_DEVICE(0x0082, 0x1301, iwl6000g2_2agn_cfg)}, | 3991 | {IWL_PCI_DEVICE(0x0085, 0x1211, iwl6000g2a_2agn_cfg)}, |
3790 | {IWL_PCI_DEVICE(0x0082, 0x1321, iwl6000g2_2agn_cfg)}, | 3992 | {IWL_PCI_DEVICE(0x0082, 0x1221, iwl6000g2a_2agn_cfg)}, |
3791 | {IWL_PCI_DEVICE(0x0085, 0x1311, iwl6000g2_2agn_cfg)}, | ||
3792 | 3993 | ||
3793 | /* 6x50 WiFi/WiMax Series */ | 3994 | /* 6x50 WiFi/WiMax Series */ |
3794 | {IWL_PCI_DEVICE(0x0087, 0x1301, iwl6050_2agn_cfg)}, | 3995 | {IWL_PCI_DEVICE(0x0087, 0x1301, iwl6050_2agn_cfg)}, |
@@ -3901,3 +4102,8 @@ MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); | |||
3901 | module_param_named( | 4102 | module_param_named( |
3902 | disable_hw_scan, iwlagn_mod_params.disable_hw_scan, int, S_IRUGO); | 4103 | disable_hw_scan, iwlagn_mod_params.disable_hw_scan, int, S_IRUGO); |
3903 | MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); | 4104 | MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); |
4105 | |||
4106 | module_param_named(ucode_alternative, iwlagn_wanted_ucode_alternative, int, | ||
4107 | S_IRUGO); | ||
4108 | MODULE_PARM_DESC(ucode_alternative, | ||
4109 | "specify ucode alternative to use from ucode file"); | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h index cfee9994383e..2d748053358e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h | |||
@@ -66,7 +66,6 @@ | |||
66 | #include "iwl-dev.h" | 66 | #include "iwl-dev.h" |
67 | 67 | ||
68 | extern struct iwl_mod_params iwlagn_mod_params; | 68 | extern struct iwl_mod_params iwlagn_mod_params; |
69 | extern struct iwl_ucode_ops iwlagn_ucode; | ||
70 | extern struct iwl_hcmd_ops iwlagn_hcmd; | 69 | extern struct iwl_hcmd_ops iwlagn_hcmd; |
71 | extern struct iwl_hcmd_utils_ops iwlagn_hcmd_utils; | 70 | extern struct iwl_hcmd_utils_ops iwlagn_hcmd_utils; |
72 | 71 | ||
@@ -136,9 +135,10 @@ void iwlagn_rx_reply_rx_phy(struct iwl_priv *priv, | |||
136 | void iwlagn_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, | 135 | void iwlagn_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, |
137 | struct ieee80211_tx_info *info); | 136 | struct ieee80211_tx_info *info); |
138 | int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb); | 137 | int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb); |
139 | int iwlagn_tx_agg_start(struct iwl_priv *priv, | 138 | int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, |
140 | const u8 *ra, u16 tid, u16 *ssn); | 139 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); |
141 | int iwlagn_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid); | 140 | int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, |
141 | struct ieee80211_sta *sta, u16 tid); | ||
142 | int iwlagn_txq_check_empty(struct iwl_priv *priv, | 142 | int iwlagn_txq_check_empty(struct iwl_priv *priv, |
143 | int sta_id, u8 tid, int txq_id); | 143 | int sta_id, u8 tid, int txq_id); |
144 | void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, | 144 | void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, |
@@ -172,6 +172,10 @@ static inline bool iwl_is_tx_success(u32 status) | |||
172 | } | 172 | } |
173 | 173 | ||
174 | /* scan */ | 174 | /* scan */ |
175 | void iwlagn_request_scan(struct iwl_priv *priv); | 175 | void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif); |
176 | |||
177 | /* station mgmt */ | ||
178 | int iwlagn_manage_ibss_station(struct iwl_priv *priv, | ||
179 | struct ieee80211_vif *vif, bool add); | ||
176 | 180 | ||
177 | #endif /* __iwl_agn_h__ */ | 181 | #endif /* __iwl_agn_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 0086019b7a15..9aab020c474b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -2668,7 +2668,6 @@ struct iwl_ssid_ie { | |||
2668 | #define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff) | 2668 | #define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff) |
2669 | #define IWL_MAX_SCAN_SIZE 1024 | 2669 | #define IWL_MAX_SCAN_SIZE 1024 |
2670 | #define IWL_MAX_CMD_SIZE 4096 | 2670 | #define IWL_MAX_CMD_SIZE 4096 |
2671 | #define IWL_MAX_PROBE_REQUEST 200 | ||
2672 | 2671 | ||
2673 | /* | 2672 | /* |
2674 | * REPLY_SCAN_CMD = 0x80 (command) | 2673 | * REPLY_SCAN_CMD = 0x80 (command) |
@@ -3128,6 +3127,11 @@ struct statistics_tx { | |||
3128 | __le32 cts_timeout_collision; | 3127 | __le32 cts_timeout_collision; |
3129 | __le32 ack_or_ba_timeout_collision; | 3128 | __le32 ack_or_ba_timeout_collision; |
3130 | struct statistics_tx_non_phy_agg agg; | 3129 | struct statistics_tx_non_phy_agg agg; |
3130 | /* | ||
3131 | * "tx_power" are optional parameters provided by uCode, | ||
3132 | * 6000 series is the only device provide the information, | ||
3133 | * Those are reserved fields for all the other devices | ||
3134 | */ | ||
3131 | struct statistics_tx_power tx_power; | 3135 | struct statistics_tx_power tx_power; |
3132 | __le32 reserved1; | 3136 | __le32 reserved1; |
3133 | } __attribute__ ((packed)); | 3137 | } __attribute__ ((packed)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 4cdf4d3a9ddb..e39086821077 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -68,37 +68,6 @@ static bool bt_coex_active = true; | |||
68 | module_param(bt_coex_active, bool, S_IRUGO); | 68 | module_param(bt_coex_active, bool, S_IRUGO); |
69 | MODULE_PARM_DESC(bt_coex_active, "enable wifi/bluetooth co-exist"); | 69 | MODULE_PARM_DESC(bt_coex_active, "enable wifi/bluetooth co-exist"); |
70 | 70 | ||
71 | static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = { | ||
72 | {COEX_CU_UNASSOC_IDLE_RP, COEX_CU_UNASSOC_IDLE_WP, | ||
73 | 0, COEX_UNASSOC_IDLE_FLAGS}, | ||
74 | {COEX_CU_UNASSOC_MANUAL_SCAN_RP, COEX_CU_UNASSOC_MANUAL_SCAN_WP, | ||
75 | 0, COEX_UNASSOC_MANUAL_SCAN_FLAGS}, | ||
76 | {COEX_CU_UNASSOC_AUTO_SCAN_RP, COEX_CU_UNASSOC_AUTO_SCAN_WP, | ||
77 | 0, COEX_UNASSOC_AUTO_SCAN_FLAGS}, | ||
78 | {COEX_CU_CALIBRATION_RP, COEX_CU_CALIBRATION_WP, | ||
79 | 0, COEX_CALIBRATION_FLAGS}, | ||
80 | {COEX_CU_PERIODIC_CALIBRATION_RP, COEX_CU_PERIODIC_CALIBRATION_WP, | ||
81 | 0, COEX_PERIODIC_CALIBRATION_FLAGS}, | ||
82 | {COEX_CU_CONNECTION_ESTAB_RP, COEX_CU_CONNECTION_ESTAB_WP, | ||
83 | 0, COEX_CONNECTION_ESTAB_FLAGS}, | ||
84 | {COEX_CU_ASSOCIATED_IDLE_RP, COEX_CU_ASSOCIATED_IDLE_WP, | ||
85 | 0, COEX_ASSOCIATED_IDLE_FLAGS}, | ||
86 | {COEX_CU_ASSOC_MANUAL_SCAN_RP, COEX_CU_ASSOC_MANUAL_SCAN_WP, | ||
87 | 0, COEX_ASSOC_MANUAL_SCAN_FLAGS}, | ||
88 | {COEX_CU_ASSOC_AUTO_SCAN_RP, COEX_CU_ASSOC_AUTO_SCAN_WP, | ||
89 | 0, COEX_ASSOC_AUTO_SCAN_FLAGS}, | ||
90 | {COEX_CU_ASSOC_ACTIVE_LEVEL_RP, COEX_CU_ASSOC_ACTIVE_LEVEL_WP, | ||
91 | 0, COEX_ASSOC_ACTIVE_LEVEL_FLAGS}, | ||
92 | {COEX_CU_RF_ON_RP, COEX_CU_RF_ON_WP, 0, COEX_CU_RF_ON_FLAGS}, | ||
93 | {COEX_CU_RF_OFF_RP, COEX_CU_RF_OFF_WP, 0, COEX_RF_OFF_FLAGS}, | ||
94 | {COEX_CU_STAND_ALONE_DEBUG_RP, COEX_CU_STAND_ALONE_DEBUG_WP, | ||
95 | 0, COEX_STAND_ALONE_DEBUG_FLAGS}, | ||
96 | {COEX_CU_IPAN_ASSOC_LEVEL_RP, COEX_CU_IPAN_ASSOC_LEVEL_WP, | ||
97 | 0, COEX_IPAN_ASSOC_LEVEL_FLAGS}, | ||
98 | {COEX_CU_RSRVD1_RP, COEX_CU_RSRVD1_WP, 0, COEX_RSRVD1_FLAGS}, | ||
99 | {COEX_CU_RSRVD2_RP, COEX_CU_RSRVD2_WP, 0, COEX_RSRVD2_FLAGS} | ||
100 | }; | ||
101 | |||
102 | #define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ | 71 | #define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ |
103 | [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ | 72 | [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ |
104 | IWL_RATE_SISO_##s##M_PLCP, \ | 73 | IWL_RATE_SISO_##s##M_PLCP, \ |
@@ -512,7 +481,7 @@ static u16 iwl_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) | |||
512 | return new_val; | 481 | return new_val; |
513 | } | 482 | } |
514 | 483 | ||
515 | void iwl_setup_rxon_timing(struct iwl_priv *priv) | 484 | void iwl_setup_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif) |
516 | { | 485 | { |
517 | u64 tsf; | 486 | u64 tsf; |
518 | s32 interval_tm, rem; | 487 | s32 interval_tm, rem; |
@@ -526,15 +495,14 @@ void iwl_setup_rxon_timing(struct iwl_priv *priv) | |||
526 | priv->rxon_timing.timestamp = cpu_to_le64(priv->timestamp); | 495 | priv->rxon_timing.timestamp = cpu_to_le64(priv->timestamp); |
527 | priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval); | 496 | priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval); |
528 | 497 | ||
529 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { | 498 | beacon_int = vif->bss_conf.beacon_int; |
530 | beacon_int = priv->beacon_int; | ||
531 | priv->rxon_timing.atim_window = 0; | ||
532 | } else { | ||
533 | beacon_int = priv->vif->bss_conf.beacon_int; | ||
534 | 499 | ||
500 | if (vif->type == NL80211_IFTYPE_ADHOC) { | ||
535 | /* TODO: we need to get atim_window from upper stack | 501 | /* TODO: we need to get atim_window from upper stack |
536 | * for now we set to 0 */ | 502 | * for now we set to 0 */ |
537 | priv->rxon_timing.atim_window = 0; | 503 | priv->rxon_timing.atim_window = 0; |
504 | } else { | ||
505 | priv->rxon_timing.atim_window = 0; | ||
538 | } | 506 | } |
539 | 507 | ||
540 | beacon_int = iwl_adjust_beacon_interval(beacon_int, | 508 | beacon_int = iwl_adjust_beacon_interval(beacon_int, |
@@ -926,8 +894,9 @@ int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch) | |||
926 | } | 894 | } |
927 | EXPORT_SYMBOL(iwl_set_rxon_channel); | 895 | EXPORT_SYMBOL(iwl_set_rxon_channel); |
928 | 896 | ||
929 | void iwl_set_flags_for_band(struct iwl_priv *priv, | 897 | static void iwl_set_flags_for_band(struct iwl_priv *priv, |
930 | enum ieee80211_band band) | 898 | enum ieee80211_band band, |
899 | struct ieee80211_vif *vif) | ||
931 | { | 900 | { |
932 | if (band == IEEE80211_BAND_5GHZ) { | 901 | if (band == IEEE80211_BAND_5GHZ) { |
933 | priv->staging_rxon.flags &= | 902 | priv->staging_rxon.flags &= |
@@ -936,12 +905,12 @@ void iwl_set_flags_for_band(struct iwl_priv *priv, | |||
936 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 905 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; |
937 | } else { | 906 | } else { |
938 | /* Copied from iwl_post_associate() */ | 907 | /* Copied from iwl_post_associate() */ |
939 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) | 908 | if (vif && vif->bss_conf.assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) |
940 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 909 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; |
941 | else | 910 | else |
942 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 911 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
943 | 912 | ||
944 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) | 913 | if (vif && vif->type == NL80211_IFTYPE_ADHOC) |
945 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 914 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
946 | 915 | ||
947 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; | 916 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; |
@@ -953,13 +922,18 @@ void iwl_set_flags_for_band(struct iwl_priv *priv, | |||
953 | /* | 922 | /* |
954 | * initialize rxon structure with default values from eeprom | 923 | * initialize rxon structure with default values from eeprom |
955 | */ | 924 | */ |
956 | void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode) | 925 | void iwl_connection_init_rx_config(struct iwl_priv *priv, |
926 | struct ieee80211_vif *vif) | ||
957 | { | 927 | { |
958 | const struct iwl_channel_info *ch_info; | 928 | const struct iwl_channel_info *ch_info; |
929 | enum nl80211_iftype type = NL80211_IFTYPE_STATION; | ||
930 | |||
931 | if (vif) | ||
932 | type = vif->type; | ||
959 | 933 | ||
960 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); | 934 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); |
961 | 935 | ||
962 | switch (mode) { | 936 | switch (type) { |
963 | case NL80211_IFTYPE_AP: | 937 | case NL80211_IFTYPE_AP: |
964 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; | 938 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; |
965 | break; | 939 | break; |
@@ -977,7 +951,7 @@ void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode) | |||
977 | break; | 951 | break; |
978 | 952 | ||
979 | default: | 953 | default: |
980 | IWL_ERR(priv, "Unsupported interface type %d\n", mode); | 954 | IWL_ERR(priv, "Unsupported interface type %d\n", type); |
981 | break; | 955 | break; |
982 | } | 956 | } |
983 | 957 | ||
@@ -999,7 +973,7 @@ void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode) | |||
999 | priv->staging_rxon.channel = cpu_to_le16(ch_info->channel); | 973 | priv->staging_rxon.channel = cpu_to_le16(ch_info->channel); |
1000 | priv->band = ch_info->band; | 974 | priv->band = ch_info->band; |
1001 | 975 | ||
1002 | iwl_set_flags_for_band(priv, priv->band); | 976 | iwl_set_flags_for_band(priv, priv->band, vif); |
1003 | 977 | ||
1004 | priv->staging_rxon.ofdm_basic_rates = | 978 | priv->staging_rxon.ofdm_basic_rates = |
1005 | (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; | 979 | (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; |
@@ -1100,6 +1074,9 @@ void iwl_irq_handle_error(struct iwl_priv *priv) | |||
1100 | /* Cancel currently queued command. */ | 1074 | /* Cancel currently queued command. */ |
1101 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); | 1075 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); |
1102 | 1076 | ||
1077 | IWL_ERR(priv, "Loaded firmware version: %s\n", | ||
1078 | priv->hw->wiphy->fw_version); | ||
1079 | |||
1103 | priv->cfg->ops->lib->dump_nic_error_log(priv); | 1080 | priv->cfg->ops->lib->dump_nic_error_log(priv); |
1104 | if (priv->cfg->ops->lib->dump_csr) | 1081 | if (priv->cfg->ops->lib->dump_csr) |
1105 | priv->cfg->ops->lib->dump_csr(priv); | 1082 | priv->cfg->ops->lib->dump_csr(priv); |
@@ -1286,41 +1263,33 @@ void iwl_configure_filter(struct ieee80211_hw *hw, | |||
1286 | u64 multicast) | 1263 | u64 multicast) |
1287 | { | 1264 | { |
1288 | struct iwl_priv *priv = hw->priv; | 1265 | struct iwl_priv *priv = hw->priv; |
1289 | __le32 *filter_flags = &priv->staging_rxon.filter_flags; | 1266 | __le32 filter_or = 0, filter_nand = 0; |
1267 | |||
1268 | #define CHK(test, flag) do { \ | ||
1269 | if (*total_flags & (test)) \ | ||
1270 | filter_or |= (flag); \ | ||
1271 | else \ | ||
1272 | filter_nand |= (flag); \ | ||
1273 | } while (0) | ||
1290 | 1274 | ||
1291 | IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", | 1275 | IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", |
1292 | changed_flags, *total_flags); | 1276 | changed_flags, *total_flags); |
1293 | 1277 | ||
1294 | if (changed_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) { | 1278 | CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); |
1295 | if (*total_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) | 1279 | CHK(FIF_ALLMULTI, RXON_FILTER_ACCEPT_GRP_MSK); |
1296 | *filter_flags |= RXON_FILTER_PROMISC_MSK; | 1280 | CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK); |
1297 | else | 1281 | CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); |
1298 | *filter_flags &= ~RXON_FILTER_PROMISC_MSK; | ||
1299 | } | ||
1300 | if (changed_flags & FIF_ALLMULTI) { | ||
1301 | if (*total_flags & FIF_ALLMULTI) | ||
1302 | *filter_flags |= RXON_FILTER_ACCEPT_GRP_MSK; | ||
1303 | else | ||
1304 | *filter_flags &= ~RXON_FILTER_ACCEPT_GRP_MSK; | ||
1305 | } | ||
1306 | if (changed_flags & FIF_CONTROL) { | ||
1307 | if (*total_flags & FIF_CONTROL) | ||
1308 | *filter_flags |= RXON_FILTER_CTL2HOST_MSK; | ||
1309 | else | ||
1310 | *filter_flags &= ~RXON_FILTER_CTL2HOST_MSK; | ||
1311 | } | ||
1312 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { | ||
1313 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) | ||
1314 | *filter_flags |= RXON_FILTER_BCON_AWARE_MSK; | ||
1315 | else | ||
1316 | *filter_flags &= ~RXON_FILTER_BCON_AWARE_MSK; | ||
1317 | } | ||
1318 | 1282 | ||
1319 | /* We avoid iwl_commit_rxon here to commit the new filter flags | 1283 | #undef CHK |
1320 | * since mac80211 will call ieee80211_hw_config immediately. | 1284 | |
1321 | * (mc_list is not supported at this time). Otherwise, we need to | 1285 | mutex_lock(&priv->mutex); |
1322 | * queue a background iwl_commit_rxon work. | 1286 | |
1323 | */ | 1287 | priv->staging_rxon.filter_flags &= ~filter_nand; |
1288 | priv->staging_rxon.filter_flags |= filter_or; | ||
1289 | |||
1290 | iwlcore_commit_rxon(priv); | ||
1291 | |||
1292 | mutex_unlock(&priv->mutex); | ||
1324 | 1293 | ||
1325 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | | 1294 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | |
1326 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; | 1295 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; |
@@ -1772,10 +1741,11 @@ int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
1772 | EXPORT_SYMBOL(iwl_mac_conf_tx); | 1741 | EXPORT_SYMBOL(iwl_mac_conf_tx); |
1773 | 1742 | ||
1774 | static void iwl_ht_conf(struct iwl_priv *priv, | 1743 | static void iwl_ht_conf(struct iwl_priv *priv, |
1775 | struct ieee80211_bss_conf *bss_conf) | 1744 | struct ieee80211_vif *vif) |
1776 | { | 1745 | { |
1777 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; | 1746 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; |
1778 | struct ieee80211_sta *sta; | 1747 | struct ieee80211_sta *sta; |
1748 | struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; | ||
1779 | 1749 | ||
1780 | IWL_DEBUG_MAC80211(priv, "enter:\n"); | 1750 | IWL_DEBUG_MAC80211(priv, "enter:\n"); |
1781 | 1751 | ||
@@ -1789,10 +1759,10 @@ static void iwl_ht_conf(struct iwl_priv *priv, | |||
1789 | 1759 | ||
1790 | ht_conf->single_chain_sufficient = false; | 1760 | ht_conf->single_chain_sufficient = false; |
1791 | 1761 | ||
1792 | switch (priv->iw_mode) { | 1762 | switch (vif->type) { |
1793 | case NL80211_IFTYPE_STATION: | 1763 | case NL80211_IFTYPE_STATION: |
1794 | rcu_read_lock(); | 1764 | rcu_read_lock(); |
1795 | sta = ieee80211_find_sta(priv->vif, priv->bssid); | 1765 | sta = ieee80211_find_sta(vif, bss_conf->bssid); |
1796 | if (sta) { | 1766 | if (sta) { |
1797 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; | 1767 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; |
1798 | int maxstreams; | 1768 | int maxstreams; |
@@ -1830,7 +1800,6 @@ static void iwl_ht_conf(struct iwl_priv *priv, | |||
1830 | 1800 | ||
1831 | static inline void iwl_set_no_assoc(struct iwl_priv *priv) | 1801 | static inline void iwl_set_no_assoc(struct iwl_priv *priv) |
1832 | { | 1802 | { |
1833 | priv->assoc_id = 0; | ||
1834 | iwl_led_disassociate(priv); | 1803 | iwl_led_disassociate(priv); |
1835 | /* | 1804 | /* |
1836 | * inform the ucode that there is no longer an | 1805 | * inform the ucode that there is no longer an |
@@ -1858,14 +1827,12 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1858 | 1827 | ||
1859 | mutex_lock(&priv->mutex); | 1828 | mutex_lock(&priv->mutex); |
1860 | 1829 | ||
1861 | if (changes & BSS_CHANGED_BEACON && | 1830 | if (changes & BSS_CHANGED_BEACON && vif->type == NL80211_IFTYPE_AP) { |
1862 | priv->iw_mode == NL80211_IFTYPE_AP) { | ||
1863 | dev_kfree_skb(priv->ibss_beacon); | 1831 | dev_kfree_skb(priv->ibss_beacon); |
1864 | priv->ibss_beacon = ieee80211_beacon_get(hw, vif); | 1832 | priv->ibss_beacon = ieee80211_beacon_get(hw, vif); |
1865 | } | 1833 | } |
1866 | 1834 | ||
1867 | if (changes & BSS_CHANGED_BEACON_INT) { | 1835 | if (changes & BSS_CHANGED_BEACON_INT) { |
1868 | priv->beacon_int = bss_conf->beacon_int; | ||
1869 | /* TODO: in AP mode, do something to make this take effect */ | 1836 | /* TODO: in AP mode, do something to make this take effect */ |
1870 | } | 1837 | } |
1871 | 1838 | ||
@@ -1885,8 +1852,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1885 | } | 1852 | } |
1886 | 1853 | ||
1887 | /* mac80211 only sets assoc when in STATION mode */ | 1854 | /* mac80211 only sets assoc when in STATION mode */ |
1888 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC || | 1855 | if (vif->type == NL80211_IFTYPE_ADHOC || bss_conf->assoc) { |
1889 | bss_conf->assoc) { | ||
1890 | memcpy(priv->staging_rxon.bssid_addr, | 1856 | memcpy(priv->staging_rxon.bssid_addr, |
1891 | bss_conf->bssid, ETH_ALEN); | 1857 | bss_conf->bssid, ETH_ALEN); |
1892 | 1858 | ||
@@ -1904,7 +1870,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1904 | * mac80211 decides to do both changes at once because | 1870 | * mac80211 decides to do both changes at once because |
1905 | * it will invoke post_associate. | 1871 | * it will invoke post_associate. |
1906 | */ | 1872 | */ |
1907 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && | 1873 | if (vif->type == NL80211_IFTYPE_ADHOC && |
1908 | changes & BSS_CHANGED_BEACON) { | 1874 | changes & BSS_CHANGED_BEACON) { |
1909 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | 1875 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); |
1910 | 1876 | ||
@@ -1947,7 +1913,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1947 | } | 1913 | } |
1948 | 1914 | ||
1949 | if (changes & BSS_CHANGED_HT) { | 1915 | if (changes & BSS_CHANGED_HT) { |
1950 | iwl_ht_conf(priv, bss_conf); | 1916 | iwl_ht_conf(priv, vif); |
1951 | 1917 | ||
1952 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 1918 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
1953 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 1919 | priv->cfg->ops->hcmd->set_rxon_chain(priv); |
@@ -1956,20 +1922,17 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1956 | if (changes & BSS_CHANGED_ASSOC) { | 1922 | if (changes & BSS_CHANGED_ASSOC) { |
1957 | IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); | 1923 | IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); |
1958 | if (bss_conf->assoc) { | 1924 | if (bss_conf->assoc) { |
1959 | priv->assoc_id = bss_conf->aid; | ||
1960 | priv->beacon_int = bss_conf->beacon_int; | ||
1961 | priv->timestamp = bss_conf->timestamp; | 1925 | priv->timestamp = bss_conf->timestamp; |
1962 | priv->assoc_capability = bss_conf->assoc_capability; | ||
1963 | 1926 | ||
1964 | iwl_led_associate(priv); | 1927 | iwl_led_associate(priv); |
1965 | 1928 | ||
1966 | if (!iwl_is_rfkill(priv)) | 1929 | if (!iwl_is_rfkill(priv)) |
1967 | priv->cfg->ops->lib->post_associate(priv); | 1930 | priv->cfg->ops->lib->post_associate(priv, vif); |
1968 | } else | 1931 | } else |
1969 | iwl_set_no_assoc(priv); | 1932 | iwl_set_no_assoc(priv); |
1970 | } | 1933 | } |
1971 | 1934 | ||
1972 | if (changes && iwl_is_associated(priv) && priv->assoc_id) { | 1935 | if (changes && iwl_is_associated(priv) && bss_conf->aid) { |
1973 | IWL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n", | 1936 | IWL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n", |
1974 | changes); | 1937 | changes); |
1975 | ret = iwl_send_rxon_assoc(priv); | 1938 | ret = iwl_send_rxon_assoc(priv); |
@@ -1986,11 +1949,20 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1986 | memcpy(priv->staging_rxon.bssid_addr, | 1949 | memcpy(priv->staging_rxon.bssid_addr, |
1987 | bss_conf->bssid, ETH_ALEN); | 1950 | bss_conf->bssid, ETH_ALEN); |
1988 | memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); | 1951 | memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); |
1989 | iwlcore_config_ap(priv); | 1952 | iwlcore_config_ap(priv, vif); |
1990 | } else | 1953 | } else |
1991 | iwl_set_no_assoc(priv); | 1954 | iwl_set_no_assoc(priv); |
1992 | } | 1955 | } |
1993 | 1956 | ||
1957 | if (changes & BSS_CHANGED_IBSS) { | ||
1958 | ret = priv->cfg->ops->lib->manage_ibss_station(priv, vif, | ||
1959 | bss_conf->ibss_joined); | ||
1960 | if (ret) | ||
1961 | IWL_ERR(priv, "failed to %s IBSS station %pM\n", | ||
1962 | bss_conf->ibss_joined ? "add" : "remove", | ||
1963 | bss_conf->bssid); | ||
1964 | } | ||
1965 | |||
1994 | mutex_unlock(&priv->mutex); | 1966 | mutex_unlock(&priv->mutex); |
1995 | 1967 | ||
1996 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 1968 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
@@ -2017,14 +1989,13 @@ int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2017 | 1989 | ||
2018 | priv->ibss_beacon = skb; | 1990 | priv->ibss_beacon = skb; |
2019 | 1991 | ||
2020 | priv->assoc_id = 0; | ||
2021 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; | 1992 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; |
2022 | priv->timestamp = le64_to_cpu(timestamp); | 1993 | priv->timestamp = le64_to_cpu(timestamp); |
2023 | 1994 | ||
2024 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 1995 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
2025 | spin_unlock_irqrestore(&priv->lock, flags); | 1996 | spin_unlock_irqrestore(&priv->lock, flags); |
2026 | 1997 | ||
2027 | priv->cfg->ops->lib->post_associate(priv); | 1998 | priv->cfg->ops->lib->post_associate(priv, priv->vif); |
2028 | 1999 | ||
2029 | return 0; | 2000 | return 0; |
2030 | } | 2001 | } |
@@ -2032,7 +2003,7 @@ EXPORT_SYMBOL(iwl_mac_beacon_update); | |||
2032 | 2003 | ||
2033 | static int iwl_set_mode(struct iwl_priv *priv, struct ieee80211_vif *vif) | 2004 | static int iwl_set_mode(struct iwl_priv *priv, struct ieee80211_vif *vif) |
2034 | { | 2005 | { |
2035 | iwl_connection_init_rx_config(priv, vif->type); | 2006 | iwl_connection_init_rx_config(priv, vif); |
2036 | 2007 | ||
2037 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2008 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
2038 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 2009 | priv->cfg->ops->hcmd->set_rxon_chain(priv); |
@@ -2072,9 +2043,6 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
2072 | if (err) | 2043 | if (err) |
2073 | goto out_err; | 2044 | goto out_err; |
2074 | 2045 | ||
2075 | /* Add the broadcast address so we can send broadcast frames */ | ||
2076 | priv->cfg->ops->lib->add_bcast_station(priv); | ||
2077 | |||
2078 | goto out; | 2046 | goto out; |
2079 | 2047 | ||
2080 | out_err: | 2048 | out_err: |
@@ -2097,8 +2065,6 @@ void iwl_mac_remove_interface(struct ieee80211_hw *hw, | |||
2097 | 2065 | ||
2098 | mutex_lock(&priv->mutex); | 2066 | mutex_lock(&priv->mutex); |
2099 | 2067 | ||
2100 | iwl_clear_ucode_stations(priv, true); | ||
2101 | |||
2102 | if (iwl_is_ready_rf(priv)) { | 2068 | if (iwl_is_ready_rf(priv)) { |
2103 | iwl_scan_cancel_timeout(priv, 100); | 2069 | iwl_scan_cancel_timeout(priv, 100); |
2104 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2070 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
@@ -2204,7 +2170,7 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
2204 | iwl_set_rxon_channel(priv, conf->channel); | 2170 | iwl_set_rxon_channel(priv, conf->channel); |
2205 | iwl_set_rxon_ht(priv, ht_conf); | 2171 | iwl_set_rxon_ht(priv, ht_conf); |
2206 | 2172 | ||
2207 | iwl_set_flags_for_band(priv, conf->channel->band); | 2173 | iwl_set_flags_for_band(priv, conf->channel->band, priv->vif); |
2208 | spin_unlock_irqrestore(&priv->lock, flags); | 2174 | spin_unlock_irqrestore(&priv->lock, flags); |
2209 | if (iwl_is_associated(priv) && | 2175 | if (iwl_is_associated(priv) && |
2210 | (le16_to_cpu(priv->active_rxon.channel) != ch) && | 2176 | (le16_to_cpu(priv->active_rxon.channel) != ch) && |
@@ -2287,8 +2253,6 @@ void iwl_mac_reset_tsf(struct ieee80211_hw *hw) | |||
2287 | spin_unlock_irqrestore(&priv->lock, flags); | 2253 | spin_unlock_irqrestore(&priv->lock, flags); |
2288 | 2254 | ||
2289 | spin_lock_irqsave(&priv->lock, flags); | 2255 | spin_lock_irqsave(&priv->lock, flags); |
2290 | priv->assoc_id = 0; | ||
2291 | priv->assoc_capability = 0; | ||
2292 | 2256 | ||
2293 | /* new association get rid of ibss beacon skb */ | 2257 | /* new association get rid of ibss beacon skb */ |
2294 | if (priv->ibss_beacon) | 2258 | if (priv->ibss_beacon) |
@@ -2296,7 +2260,6 @@ void iwl_mac_reset_tsf(struct ieee80211_hw *hw) | |||
2296 | 2260 | ||
2297 | priv->ibss_beacon = NULL; | 2261 | priv->ibss_beacon = NULL; |
2298 | 2262 | ||
2299 | priv->beacon_int = priv->vif->bss_conf.beacon_int; | ||
2300 | priv->timestamp = 0; | 2263 | priv->timestamp = 0; |
2301 | 2264 | ||
2302 | spin_unlock_irqrestore(&priv->lock, flags); | 2265 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -2343,34 +2306,6 @@ void iwl_free_txq_mem(struct iwl_priv *priv) | |||
2343 | } | 2306 | } |
2344 | EXPORT_SYMBOL(iwl_free_txq_mem); | 2307 | EXPORT_SYMBOL(iwl_free_txq_mem); |
2345 | 2308 | ||
2346 | int iwl_send_wimax_coex(struct iwl_priv *priv) | ||
2347 | { | ||
2348 | struct iwl_wimax_coex_cmd coex_cmd; | ||
2349 | |||
2350 | if (priv->cfg->support_wimax_coexist) { | ||
2351 | /* UnMask wake up src at associated sleep */ | ||
2352 | coex_cmd.flags = COEX_FLAGS_ASSOC_WA_UNMASK_MSK; | ||
2353 | |||
2354 | /* UnMask wake up src at unassociated sleep */ | ||
2355 | coex_cmd.flags |= COEX_FLAGS_UNASSOC_WA_UNMASK_MSK; | ||
2356 | memcpy(coex_cmd.sta_prio, cu_priorities, | ||
2357 | sizeof(struct iwl_wimax_coex_event_entry) * | ||
2358 | COEX_NUM_OF_EVENTS); | ||
2359 | |||
2360 | /* enabling the coexistence feature */ | ||
2361 | coex_cmd.flags |= COEX_FLAGS_COEX_ENABLE_MSK; | ||
2362 | |||
2363 | /* enabling the priorities tables */ | ||
2364 | coex_cmd.flags |= COEX_FLAGS_STA_TABLE_VALID_MSK; | ||
2365 | } else { | ||
2366 | /* coexistence is disabled */ | ||
2367 | memset(&coex_cmd, 0, sizeof(coex_cmd)); | ||
2368 | } | ||
2369 | return iwl_send_cmd_pdu(priv, COEX_PRIORITY_TABLE_CMD, | ||
2370 | sizeof(coex_cmd), &coex_cmd); | ||
2371 | } | ||
2372 | EXPORT_SYMBOL(iwl_send_wimax_coex); | ||
2373 | |||
2374 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 2309 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
2375 | 2310 | ||
2376 | #define IWL_TRAFFIC_DUMP_SIZE (IWL_TRAFFIC_ENTRY_SIZE * IWL_TRAFFIC_ENTRIES) | 2311 | #define IWL_TRAFFIC_DUMP_SIZE (IWL_TRAFFIC_ENTRY_SIZE * IWL_TRAFFIC_ENTRIES) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 727360944859..7e5a5ba41fd2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -106,7 +106,7 @@ struct iwl_hcmd_utils_ops { | |||
106 | __le32 *tx_flags); | 106 | __le32 *tx_flags); |
107 | int (*calc_rssi)(struct iwl_priv *priv, | 107 | int (*calc_rssi)(struct iwl_priv *priv, |
108 | struct iwl_rx_phy_res *rx_resp); | 108 | struct iwl_rx_phy_res *rx_resp); |
109 | void (*request_scan)(struct iwl_priv *priv); | 109 | void (*request_scan)(struct iwl_priv *priv, struct ieee80211_vif *vif); |
110 | }; | 110 | }; |
111 | 111 | ||
112 | struct iwl_apm_ops { | 112 | struct iwl_apm_ops { |
@@ -131,17 +131,6 @@ struct iwl_temp_ops { | |||
131 | void (*set_calib_version)(struct iwl_priv *priv); | 131 | void (*set_calib_version)(struct iwl_priv *priv); |
132 | }; | 132 | }; |
133 | 133 | ||
134 | struct iwl_ucode_ops { | ||
135 | u32 (*get_header_size)(u32); | ||
136 | u32 (*get_build)(const struct iwl_ucode_header *, u32); | ||
137 | u32 (*get_inst_size)(const struct iwl_ucode_header *, u32); | ||
138 | u32 (*get_data_size)(const struct iwl_ucode_header *, u32); | ||
139 | u32 (*get_init_size)(const struct iwl_ucode_header *, u32); | ||
140 | u32 (*get_init_data_size)(const struct iwl_ucode_header *, u32); | ||
141 | u32 (*get_boot_size)(const struct iwl_ucode_header *, u32); | ||
142 | u8 * (*get_data)(const struct iwl_ucode_header *, u32); | ||
143 | }; | ||
144 | |||
145 | struct iwl_lib_ops { | 134 | struct iwl_lib_ops { |
146 | /* set hw dependent parameters */ | 135 | /* set hw dependent parameters */ |
147 | int (*set_hw_params)(struct iwl_priv *priv); | 136 | int (*set_hw_params)(struct iwl_priv *priv); |
@@ -191,8 +180,9 @@ struct iwl_lib_ops { | |||
191 | /* power */ | 180 | /* power */ |
192 | int (*send_tx_power) (struct iwl_priv *priv); | 181 | int (*send_tx_power) (struct iwl_priv *priv); |
193 | void (*update_chain_flags)(struct iwl_priv *priv); | 182 | void (*update_chain_flags)(struct iwl_priv *priv); |
194 | void (*post_associate) (struct iwl_priv *priv); | 183 | void (*post_associate)(struct iwl_priv *priv, |
195 | void (*config_ap) (struct iwl_priv *priv); | 184 | struct ieee80211_vif *vif); |
185 | void (*config_ap)(struct iwl_priv *priv, struct ieee80211_vif *vif); | ||
196 | irqreturn_t (*isr) (int irq, void *data); | 186 | irqreturn_t (*isr) (int irq, void *data); |
197 | 187 | ||
198 | /* eeprom operations (as defined in iwl-eeprom.h) */ | 188 | /* eeprom operations (as defined in iwl-eeprom.h) */ |
@@ -201,7 +191,8 @@ struct iwl_lib_ops { | |||
201 | /* temperature */ | 191 | /* temperature */ |
202 | struct iwl_temp_ops temp_ops; | 192 | struct iwl_temp_ops temp_ops; |
203 | /* station management */ | 193 | /* station management */ |
204 | void (*add_bcast_station)(struct iwl_priv *priv); | 194 | int (*manage_ibss_station)(struct iwl_priv *priv, |
195 | struct ieee80211_vif *vif, bool add); | ||
205 | /* recover from tx queue stall */ | 196 | /* recover from tx queue stall */ |
206 | void (*recover_from_tx_stall)(unsigned long data); | 197 | void (*recover_from_tx_stall)(unsigned long data); |
207 | /* check for plcp health */ | 198 | /* check for plcp health */ |
@@ -220,7 +211,6 @@ struct iwl_led_ops { | |||
220 | }; | 211 | }; |
221 | 212 | ||
222 | struct iwl_ops { | 213 | struct iwl_ops { |
223 | const struct iwl_ucode_ops *ucode; | ||
224 | const struct iwl_lib_ops *lib; | 214 | const struct iwl_lib_ops *lib; |
225 | const struct iwl_hcmd_ops *hcmd; | 215 | const struct iwl_hcmd_ops *hcmd; |
226 | const struct iwl_hcmd_utils_ops *utils; | 216 | const struct iwl_hcmd_utils_ops *utils; |
@@ -257,6 +247,18 @@ struct iwl_mod_params { | |||
257 | * @support_wimax_coexist: support wimax/wifi co-exist | 247 | * @support_wimax_coexist: support wimax/wifi co-exist |
258 | * @plcp_delta_threshold: plcp error rate threshold used to trigger | 248 | * @plcp_delta_threshold: plcp error rate threshold used to trigger |
259 | * radio tuning when there is a high receiving plcp error rate | 249 | * radio tuning when there is a high receiving plcp error rate |
250 | * @chain_noise_scale: default chain noise scale used for gain computation | ||
251 | * @monitor_recover_period: default timer used to check stuck queues | ||
252 | * @temperature_kelvin: temperature report by uCode in kelvin | ||
253 | * @max_event_log_size: size of event log buffer size for ucode event logging | ||
254 | * @tx_power_by_driver: tx power calibration performed by driver | ||
255 | * instead of uCode | ||
256 | * @ucode_tracing: support ucode continuous tracing | ||
257 | * @sensitivity_calib_by_driver: driver has the capability to perform | ||
258 | * sensitivity calibration operation | ||
259 | * @chain_noise_calib_by_driver: driver has the capability to perform | ||
260 | * chain noise calibration operation | ||
261 | * @scan_antennas: available antenna for scan operation | ||
260 | * | 262 | * |
261 | * We enable the driver to be backward compatible wrt API version. The | 263 | * We enable the driver to be backward compatible wrt API version. The |
262 | * driver specifies which APIs it supports (with @ucode_api_max being the | 264 | * driver specifies which APIs it supports (with @ucode_api_max being the |
@@ -319,6 +321,10 @@ struct iwl_cfg { | |||
319 | u32 monitor_recover_period; | 321 | u32 monitor_recover_period; |
320 | bool temperature_kelvin; | 322 | bool temperature_kelvin; |
321 | u32 max_event_log_size; | 323 | u32 max_event_log_size; |
324 | const bool tx_power_by_driver; | ||
325 | const bool ucode_tracing; | ||
326 | const bool sensitivity_calib_by_driver; | ||
327 | const bool chain_noise_calib_by_driver; | ||
322 | u8 scan_antennas[IEEE80211_NUM_BANDS]; | 328 | u8 scan_antennas[IEEE80211_NUM_BANDS]; |
323 | }; | 329 | }; |
324 | 330 | ||
@@ -340,8 +346,8 @@ int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch); | |||
340 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); | 346 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); |
341 | u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv, | 347 | u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv, |
342 | struct ieee80211_sta_ht_cap *sta_ht_inf); | 348 | struct ieee80211_sta_ht_cap *sta_ht_inf); |
343 | void iwl_set_flags_for_band(struct iwl_priv *priv, enum ieee80211_band band); | 349 | void iwl_connection_init_rx_config(struct iwl_priv *priv, |
344 | void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode); | 350 | struct ieee80211_vif *vif); |
345 | int iwl_set_decrypted_flag(struct iwl_priv *priv, | 351 | int iwl_set_decrypted_flag(struct iwl_priv *priv, |
346 | struct ieee80211_hdr *hdr, | 352 | struct ieee80211_hdr *hdr, |
347 | u32 decrypt_res, | 353 | u32 decrypt_res, |
@@ -351,7 +357,7 @@ void iwl_configure_filter(struct ieee80211_hw *hw, | |||
351 | unsigned int changed_flags, | 357 | unsigned int changed_flags, |
352 | unsigned int *total_flags, u64 multicast); | 358 | unsigned int *total_flags, u64 multicast); |
353 | int iwl_set_hw_params(struct iwl_priv *priv); | 359 | int iwl_set_hw_params(struct iwl_priv *priv); |
354 | void iwl_post_associate(struct iwl_priv *priv); | 360 | void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif); |
355 | void iwl_bss_info_changed(struct ieee80211_hw *hw, | 361 | void iwl_bss_info_changed(struct ieee80211_hw *hw, |
356 | struct ieee80211_vif *vif, | 362 | struct ieee80211_vif *vif, |
357 | struct ieee80211_bss_conf *bss_conf, | 363 | struct ieee80211_bss_conf *bss_conf, |
@@ -363,13 +369,12 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, | |||
363 | void iwl_mac_remove_interface(struct ieee80211_hw *hw, | 369 | void iwl_mac_remove_interface(struct ieee80211_hw *hw, |
364 | struct ieee80211_vif *vif); | 370 | struct ieee80211_vif *vif); |
365 | int iwl_mac_config(struct ieee80211_hw *hw, u32 changed); | 371 | int iwl_mac_config(struct ieee80211_hw *hw, u32 changed); |
366 | void iwl_config_ap(struct iwl_priv *priv); | 372 | void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif); |
367 | void iwl_mac_reset_tsf(struct ieee80211_hw *hw); | 373 | void iwl_mac_reset_tsf(struct ieee80211_hw *hw); |
368 | int iwl_alloc_txq_mem(struct iwl_priv *priv); | 374 | int iwl_alloc_txq_mem(struct iwl_priv *priv); |
369 | void iwl_free_txq_mem(struct iwl_priv *priv); | 375 | void iwl_free_txq_mem(struct iwl_priv *priv); |
370 | void iwlcore_rts_tx_cmd_flag(struct ieee80211_tx_info *info, | 376 | void iwlcore_rts_tx_cmd_flag(struct ieee80211_tx_info *info, |
371 | __le32 *tx_flags); | 377 | __le32 *tx_flags); |
372 | int iwl_send_wimax_coex(struct iwl_priv *priv); | ||
373 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 378 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
374 | int iwl_alloc_traffic_mem(struct iwl_priv *priv); | 379 | int iwl_alloc_traffic_mem(struct iwl_priv *priv); |
375 | void iwl_free_traffic_mem(struct iwl_priv *priv); | 380 | void iwl_free_traffic_mem(struct iwl_priv *priv); |
@@ -448,6 +453,8 @@ bool iwl_good_plcp_health(struct iwl_priv *priv, | |||
448 | struct iwl_rx_packet *pkt); | 453 | struct iwl_rx_packet *pkt); |
449 | bool iwl_good_ack_health(struct iwl_priv *priv, | 454 | bool iwl_good_ack_health(struct iwl_priv *priv, |
450 | struct iwl_rx_packet *pkt); | 455 | struct iwl_rx_packet *pkt); |
456 | void iwl_recover_from_statistics(struct iwl_priv *priv, | ||
457 | struct iwl_rx_packet *pkt); | ||
451 | void iwl_rx_statistics(struct iwl_priv *priv, | 458 | void iwl_rx_statistics(struct iwl_priv *priv, |
452 | struct iwl_rx_mem_buffer *rxb); | 459 | struct iwl_rx_mem_buffer *rxb); |
453 | void iwl_reply_statistics(struct iwl_priv *priv, | 460 | void iwl_reply_statistics(struct iwl_priv *priv, |
@@ -515,6 +522,7 @@ int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); | |||
515 | int iwl_mac_hw_scan(struct ieee80211_hw *hw, | 522 | int iwl_mac_hw_scan(struct ieee80211_hw *hw, |
516 | struct ieee80211_vif *vif, | 523 | struct ieee80211_vif *vif, |
517 | struct cfg80211_scan_request *req); | 524 | struct cfg80211_scan_request *req); |
525 | void iwl_bg_start_internal_scan(struct work_struct *work); | ||
518 | void iwl_internal_short_hw_scan(struct iwl_priv *priv); | 526 | void iwl_internal_short_hw_scan(struct iwl_priv *priv); |
519 | int iwl_force_reset(struct iwl_priv *priv, int mode); | 527 | int iwl_force_reset(struct iwl_priv *priv, int mode); |
520 | u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, | 528 | u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, |
@@ -524,7 +532,8 @@ u16 iwl_get_active_dwell_time(struct iwl_priv *priv, | |||
524 | enum ieee80211_band band, | 532 | enum ieee80211_band band, |
525 | u8 n_probes); | 533 | u8 n_probes); |
526 | u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, | 534 | u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, |
527 | enum ieee80211_band band); | 535 | enum ieee80211_band band, |
536 | struct ieee80211_vif *vif); | ||
528 | void iwl_bg_scan_check(struct work_struct *data); | 537 | void iwl_bg_scan_check(struct work_struct *data); |
529 | void iwl_bg_abort_scan(struct work_struct *work); | 538 | void iwl_bg_abort_scan(struct work_struct *work); |
530 | void iwl_bg_scan_completed(struct work_struct *work); | 539 | void iwl_bg_scan_completed(struct work_struct *work); |
@@ -688,7 +697,7 @@ extern int iwl_send_lq_cmd(struct iwl_priv *priv, | |||
688 | void iwl_apm_stop(struct iwl_priv *priv); | 697 | void iwl_apm_stop(struct iwl_priv *priv); |
689 | int iwl_apm_init(struct iwl_priv *priv); | 698 | int iwl_apm_init(struct iwl_priv *priv); |
690 | 699 | ||
691 | void iwl_setup_rxon_timing(struct iwl_priv *priv); | 700 | void iwl_setup_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif); |
692 | static inline int iwl_send_rxon_assoc(struct iwl_priv *priv) | 701 | static inline int iwl_send_rxon_assoc(struct iwl_priv *priv) |
693 | { | 702 | { |
694 | return priv->cfg->ops->hcmd->rxon_assoc(priv); | 703 | return priv->cfg->ops->hcmd->rxon_assoc(priv); |
@@ -697,9 +706,10 @@ static inline int iwlcore_commit_rxon(struct iwl_priv *priv) | |||
697 | { | 706 | { |
698 | return priv->cfg->ops->hcmd->commit_rxon(priv); | 707 | return priv->cfg->ops->hcmd->commit_rxon(priv); |
699 | } | 708 | } |
700 | static inline void iwlcore_config_ap(struct iwl_priv *priv) | 709 | static inline void iwlcore_config_ap(struct iwl_priv *priv, |
710 | struct ieee80211_vif *vif) | ||
701 | { | 711 | { |
702 | priv->cfg->ops->lib->config_ap(priv); | 712 | priv->cfg->ops->lib->config_ap(priv, vif); |
703 | } | 713 | } |
704 | static inline const struct ieee80211_supported_band *iwl_get_hw_mode( | 714 | static inline const struct ieee80211_supported_band *iwl_get_hw_mode( |
705 | struct iwl_priv *priv, enum ieee80211_band band) | 715 | struct iwl_priv *priv, enum ieee80211_band band) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 4aabb542fcbe..9659c5d01df9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -1220,46 +1220,6 @@ static ssize_t iwl_dbgfs_chain_noise_read(struct file *file, | |||
1220 | return ret; | 1220 | return ret; |
1221 | } | 1221 | } |
1222 | 1222 | ||
1223 | static ssize_t iwl_dbgfs_tx_power_read(struct file *file, | ||
1224 | char __user *user_buf, | ||
1225 | size_t count, loff_t *ppos) { | ||
1226 | |||
1227 | struct iwl_priv *priv = file->private_data; | ||
1228 | char buf[128]; | ||
1229 | int pos = 0; | ||
1230 | const size_t bufsz = sizeof(buf); | ||
1231 | struct statistics_tx *tx; | ||
1232 | |||
1233 | if (!iwl_is_alive(priv)) | ||
1234 | pos += scnprintf(buf + pos, bufsz - pos, "N/A\n"); | ||
1235 | else { | ||
1236 | tx = &priv->statistics.tx; | ||
1237 | if (tx->tx_power.ant_a || | ||
1238 | tx->tx_power.ant_b || | ||
1239 | tx->tx_power.ant_c) { | ||
1240 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1241 | "tx power: (1/2 dB step)\n"); | ||
1242 | if ((priv->cfg->valid_tx_ant & ANT_A) && | ||
1243 | tx->tx_power.ant_a) | ||
1244 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1245 | "\tantenna A: 0x%X\n", | ||
1246 | tx->tx_power.ant_a); | ||
1247 | if ((priv->cfg->valid_tx_ant & ANT_B) && | ||
1248 | tx->tx_power.ant_b) | ||
1249 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1250 | "\tantenna B: 0x%X\n", | ||
1251 | tx->tx_power.ant_b); | ||
1252 | if ((priv->cfg->valid_tx_ant & ANT_C) && | ||
1253 | tx->tx_power.ant_c) | ||
1254 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1255 | "\tantenna C: 0x%X\n", | ||
1256 | tx->tx_power.ant_c); | ||
1257 | } else | ||
1258 | pos += scnprintf(buf + pos, bufsz - pos, "N/A\n"); | ||
1259 | } | ||
1260 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
1261 | } | ||
1262 | |||
1263 | static ssize_t iwl_dbgfs_power_save_status_read(struct file *file, | 1223 | static ssize_t iwl_dbgfs_power_save_status_read(struct file *file, |
1264 | char __user *user_buf, | 1224 | char __user *user_buf, |
1265 | size_t count, loff_t *ppos) | 1225 | size_t count, loff_t *ppos) |
@@ -1571,7 +1531,6 @@ DEBUGFS_READ_FILE_OPS(ucode_tx_stats); | |||
1571 | DEBUGFS_READ_FILE_OPS(ucode_general_stats); | 1531 | DEBUGFS_READ_FILE_OPS(ucode_general_stats); |
1572 | DEBUGFS_READ_FILE_OPS(sensitivity); | 1532 | DEBUGFS_READ_FILE_OPS(sensitivity); |
1573 | DEBUGFS_READ_FILE_OPS(chain_noise); | 1533 | DEBUGFS_READ_FILE_OPS(chain_noise); |
1574 | DEBUGFS_READ_FILE_OPS(tx_power); | ||
1575 | DEBUGFS_READ_FILE_OPS(power_save_status); | 1534 | DEBUGFS_READ_FILE_OPS(power_save_status); |
1576 | DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); | 1535 | DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); |
1577 | DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); | 1536 | DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); |
@@ -1618,8 +1577,11 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1618 | DEBUGFS_ADD_FILE(interrupt, dir_data, S_IWUSR | S_IRUSR); | 1577 | DEBUGFS_ADD_FILE(interrupt, dir_data, S_IWUSR | S_IRUSR); |
1619 | DEBUGFS_ADD_FILE(qos, dir_data, S_IRUSR); | 1578 | DEBUGFS_ADD_FILE(qos, dir_data, S_IRUSR); |
1620 | DEBUGFS_ADD_FILE(led, dir_data, S_IRUSR); | 1579 | DEBUGFS_ADD_FILE(led, dir_data, S_IRUSR); |
1621 | DEBUGFS_ADD_FILE(sleep_level_override, dir_data, S_IWUSR | S_IRUSR); | 1580 | if (!priv->cfg->broken_powersave) { |
1622 | DEBUGFS_ADD_FILE(current_sleep_command, dir_data, S_IRUSR); | 1581 | DEBUGFS_ADD_FILE(sleep_level_override, dir_data, |
1582 | S_IWUSR | S_IRUSR); | ||
1583 | DEBUGFS_ADD_FILE(current_sleep_command, dir_data, S_IRUSR); | ||
1584 | } | ||
1623 | DEBUGFS_ADD_FILE(thermal_throttling, dir_data, S_IRUSR); | 1585 | DEBUGFS_ADD_FILE(thermal_throttling, dir_data, S_IRUSR); |
1624 | DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); | 1586 | DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); |
1625 | DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR); | 1587 | DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR); |
@@ -1627,7 +1589,6 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1627 | DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR); | 1589 | DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR); |
1628 | DEBUGFS_ADD_FILE(rx_queue, dir_debug, S_IRUSR); | 1590 | DEBUGFS_ADD_FILE(rx_queue, dir_debug, S_IRUSR); |
1629 | DEBUGFS_ADD_FILE(tx_queue, dir_debug, S_IRUSR); | 1591 | DEBUGFS_ADD_FILE(tx_queue, dir_debug, S_IRUSR); |
1630 | DEBUGFS_ADD_FILE(tx_power, dir_debug, S_IRUSR); | ||
1631 | DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); | 1592 | DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); |
1632 | DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); | 1593 | DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); |
1633 | DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); | 1594 | DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); |
@@ -1640,18 +1601,21 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1640 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); | 1601 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); |
1641 | DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); | 1602 | DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); |
1642 | 1603 | ||
1643 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { | 1604 | if (priv->cfg->sensitivity_calib_by_driver) |
1644 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); | 1605 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); |
1606 | if (priv->cfg->chain_noise_calib_by_driver) | ||
1645 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); | 1607 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); |
1608 | if (priv->cfg->ucode_tracing) | ||
1646 | DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); | 1609 | DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); |
1647 | } | ||
1648 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); | 1610 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); |
1649 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); | 1611 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); |
1650 | DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, &priv->disable_sens_cal); | 1612 | if (priv->cfg->sensitivity_calib_by_driver) |
1651 | DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, | 1613 | DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, |
1652 | &priv->disable_chain_noise_cal); | 1614 | &priv->disable_sens_cal); |
1653 | if (((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965) || | 1615 | if (priv->cfg->chain_noise_calib_by_driver) |
1654 | ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_3945)) | 1616 | DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, |
1617 | &priv->disable_chain_noise_cal); | ||
1618 | if (priv->cfg->tx_power_by_driver) | ||
1655 | DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, | 1619 | DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, |
1656 | &priv->disable_tx_power_cal); | 1620 | &priv->disable_tx_power_cal); |
1657 | return 0; | 1621 | return 0; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 58c69a5798d4..f3f3473c5c7e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -57,8 +57,8 @@ extern struct iwl_cfg iwl5100_bgn_cfg; | |||
57 | extern struct iwl_cfg iwl5100_abg_cfg; | 57 | extern struct iwl_cfg iwl5100_abg_cfg; |
58 | extern struct iwl_cfg iwl5150_agn_cfg; | 58 | extern struct iwl_cfg iwl5150_agn_cfg; |
59 | extern struct iwl_cfg iwl5150_abg_cfg; | 59 | extern struct iwl_cfg iwl5150_abg_cfg; |
60 | extern struct iwl_cfg iwl6000g2a_2agn_cfg; | ||
60 | extern struct iwl_cfg iwl6000i_2agn_cfg; | 61 | extern struct iwl_cfg iwl6000i_2agn_cfg; |
61 | extern struct iwl_cfg iwl6000g2_2agn_cfg; | ||
62 | extern struct iwl_cfg iwl6000i_2abg_cfg; | 62 | extern struct iwl_cfg iwl6000i_2abg_cfg; |
63 | extern struct iwl_cfg iwl6000i_2bg_cfg; | 63 | extern struct iwl_cfg iwl6000i_2bg_cfg; |
64 | extern struct iwl_cfg iwl6000_3agn_cfg; | 64 | extern struct iwl_cfg iwl6000_3agn_cfg; |
@@ -497,20 +497,38 @@ struct iwl_station_entry { | |||
497 | struct iwl_link_quality_cmd *lq; | 497 | struct iwl_link_quality_cmd *lq; |
498 | }; | 498 | }; |
499 | 499 | ||
500 | struct iwl_station_priv_common { | ||
501 | u8 sta_id; | ||
502 | }; | ||
503 | |||
500 | /* | 504 | /* |
501 | * iwl_station_priv: Driver's private station information | 505 | * iwl_station_priv: Driver's private station information |
502 | * | 506 | * |
503 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) | 507 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) |
504 | * in the structure for use by driver. This structure is places in that | 508 | * in the structure for use by driver. This structure is places in that |
505 | * space. | 509 | * space. |
510 | * | ||
511 | * The common struct MUST be first because it is shared between | ||
512 | * 3945 and agn! | ||
506 | */ | 513 | */ |
507 | struct iwl_station_priv { | 514 | struct iwl_station_priv { |
515 | struct iwl_station_priv_common common; | ||
508 | struct iwl_lq_sta lq_sta; | 516 | struct iwl_lq_sta lq_sta; |
509 | atomic_t pending_frames; | 517 | atomic_t pending_frames; |
510 | bool client; | 518 | bool client; |
511 | bool asleep; | 519 | bool asleep; |
512 | }; | 520 | }; |
513 | 521 | ||
522 | /** | ||
523 | * struct iwl_vif_priv - driver's private per-interface information | ||
524 | * | ||
525 | * When mac80211 allocates a virtual interface, it can allocate | ||
526 | * space for us to put data into. | ||
527 | */ | ||
528 | struct iwl_vif_priv { | ||
529 | u8 ibss_bssid_sta_id; | ||
530 | }; | ||
531 | |||
514 | /* one for each uCode image (inst/data, boot/init/runtime) */ | 532 | /* one for each uCode image (inst/data, boot/init/runtime) */ |
515 | struct fw_desc { | 533 | struct fw_desc { |
516 | void *v_addr; /* access by driver */ | 534 | void *v_addr; /* access by driver */ |
@@ -518,7 +536,7 @@ struct fw_desc { | |||
518 | u32 len; /* bytes */ | 536 | u32 len; /* bytes */ |
519 | }; | 537 | }; |
520 | 538 | ||
521 | /* uCode file layout */ | 539 | /* v1/v2 uCode file layout */ |
522 | struct iwl_ucode_header { | 540 | struct iwl_ucode_header { |
523 | __le32 ver; /* major/minor/API/serial */ | 541 | __le32 ver; /* major/minor/API/serial */ |
524 | union { | 542 | union { |
@@ -541,7 +559,62 @@ struct iwl_ucode_header { | |||
541 | } v2; | 559 | } v2; |
542 | } u; | 560 | } u; |
543 | }; | 561 | }; |
544 | #define UCODE_HEADER_SIZE(ver) ((ver) == 1 ? 24 : 28) | 562 | |
563 | /* | ||
564 | * new TLV uCode file layout | ||
565 | * | ||
566 | * The new TLV file format contains TLVs, that each specify | ||
567 | * some piece of data. To facilitate "groups", for example | ||
568 | * different instruction image with different capabilities, | ||
569 | * bundled with the same init image, an alternative mechanism | ||
570 | * is provided: | ||
571 | * When the alternative field is 0, that means that the item | ||
572 | * is always valid. When it is non-zero, then it is only | ||
573 | * valid in conjunction with items of the same alternative, | ||
574 | * in which case the driver (user) selects one alternative | ||
575 | * to use. | ||
576 | */ | ||
577 | |||
578 | enum iwl_ucode_tlv_type { | ||
579 | IWL_UCODE_TLV_INVALID = 0, /* unused */ | ||
580 | IWL_UCODE_TLV_INST = 1, | ||
581 | IWL_UCODE_TLV_DATA = 2, | ||
582 | IWL_UCODE_TLV_INIT = 3, | ||
583 | IWL_UCODE_TLV_INIT_DATA = 4, | ||
584 | IWL_UCODE_TLV_BOOT = 5, | ||
585 | IWL_UCODE_TLV_PROBE_MAX_LEN = 6, /* a u32 value */ | ||
586 | }; | ||
587 | |||
588 | struct iwl_ucode_tlv { | ||
589 | __le16 type; /* see above */ | ||
590 | __le16 alternative; /* see comment */ | ||
591 | __le32 length; /* not including type/length fields */ | ||
592 | u8 data[0]; | ||
593 | } __attribute__ ((packed)); | ||
594 | |||
595 | #define IWL_TLV_UCODE_MAGIC 0x0a4c5749 | ||
596 | |||
597 | struct iwl_tlv_ucode_header { | ||
598 | /* | ||
599 | * The TLV style ucode header is distinguished from | ||
600 | * the v1/v2 style header by first four bytes being | ||
601 | * zero, as such is an invalid combination of | ||
602 | * major/minor/API/serial versions. | ||
603 | */ | ||
604 | __le32 zero; | ||
605 | __le32 magic; | ||
606 | u8 human_readable[64]; | ||
607 | __le32 ver; /* major/minor/API/serial */ | ||
608 | __le32 build; | ||
609 | __le64 alternatives; /* bitmask of valid alternatives */ | ||
610 | /* | ||
611 | * The data contained herein has a TLV layout, | ||
612 | * see above for the TLV header and types. | ||
613 | * Note that each TLV is padded to a length | ||
614 | * that is a multiple of 4 for alignment. | ||
615 | */ | ||
616 | u8 data[0]; | ||
617 | }; | ||
545 | 618 | ||
546 | struct iwl4965_ibss_seq { | 619 | struct iwl4965_ibss_seq { |
547 | u8 mac[ETH_ALEN]; | 620 | u8 mac[ETH_ALEN]; |
@@ -1155,8 +1228,7 @@ struct iwl_priv { | |||
1155 | #endif | 1228 | #endif |
1156 | 1229 | ||
1157 | /* context information */ | 1230 | /* context information */ |
1158 | u8 bssid[ETH_ALEN]; | 1231 | u8 bssid[ETH_ALEN]; /* used only on 3945 but filled by core */ |
1159 | u16 rts_threshold; | ||
1160 | u8 mac_addr[ETH_ALEN]; | 1232 | u8 mac_addr[ETH_ALEN]; |
1161 | 1233 | ||
1162 | /*station table variables */ | 1234 | /*station table variables */ |
@@ -1189,7 +1261,6 @@ struct iwl_priv { | |||
1189 | 1261 | ||
1190 | /* Last Rx'd beacon timestamp */ | 1262 | /* Last Rx'd beacon timestamp */ |
1191 | u64 timestamp; | 1263 | u64 timestamp; |
1192 | u16 beacon_int; | ||
1193 | struct ieee80211_vif *vif; | 1264 | struct ieee80211_vif *vif; |
1194 | 1265 | ||
1195 | union { | 1266 | union { |
@@ -1242,6 +1313,8 @@ struct iwl_priv { | |||
1242 | 1313 | ||
1243 | struct iwl_rx_phy_res last_phy_res; | 1314 | struct iwl_rx_phy_res last_phy_res; |
1244 | bool last_phy_res_valid; | 1315 | bool last_phy_res_valid; |
1316 | |||
1317 | struct completion firmware_loading_complete; | ||
1245 | } _agn; | 1318 | } _agn; |
1246 | #endif | 1319 | #endif |
1247 | }; | 1320 | }; |
@@ -1249,10 +1322,6 @@ struct iwl_priv { | |||
1249 | struct iwl_hw_params hw_params; | 1322 | struct iwl_hw_params hw_params; |
1250 | 1323 | ||
1251 | u32 inta_mask; | 1324 | u32 inta_mask; |
1252 | /* Current association information needed to configure the | ||
1253 | * hardware */ | ||
1254 | u16 assoc_id; | ||
1255 | u16 assoc_capability; | ||
1256 | 1325 | ||
1257 | struct iwl_qos_info qos_data; | 1326 | struct iwl_qos_info qos_data; |
1258 | 1327 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index fb5bb487f3bc..ee11452519e6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
@@ -590,9 +590,16 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
590 | e[addr / 2] = cpu_to_le16(r >> 16); | 590 | e[addr / 2] = cpu_to_le16(r >> 16); |
591 | } | 591 | } |
592 | } | 592 | } |
593 | |||
594 | IWL_DEBUG_INFO(priv, "NVM Type: %s, version: 0x%x\n", | ||
595 | (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) | ||
596 | ? "OTP" : "EEPROM", | ||
597 | iwl_eeprom_query16(priv, EEPROM_VERSION)); | ||
598 | |||
593 | ret = 0; | 599 | ret = 0; |
594 | done: | 600 | done: |
595 | priv->cfg->ops->lib->eeprom_ops.release_semaphore(priv); | 601 | priv->cfg->ops->lib->eeprom_ops.release_semaphore(priv); |
602 | |||
596 | err: | 603 | err: |
597 | if (ret) | 604 | if (ret) |
598 | iwl_eeprom_free(priv); | 605 | iwl_eeprom_free(priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index 581c683a8507..cda6a94d6cc9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
@@ -318,10 +318,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) | |||
318 | update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE || | 318 | update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE || |
319 | priv->chain_noise_data.state == IWL_CHAIN_NOISE_ALIVE; | 319 | priv->chain_noise_data.state == IWL_CHAIN_NOISE_ALIVE; |
320 | 320 | ||
321 | if (priv->vif) | 321 | dtimper = priv->hw->conf.ps_dtim_period ?: 1; |
322 | dtimper = priv->hw->conf.ps_dtim_period; | ||
323 | else | ||
324 | dtimper = 1; | ||
325 | 322 | ||
326 | if (priv->cfg->broken_powersave) | 323 | if (priv->cfg->broken_powersave) |
327 | iwl_power_sleep_cam_cmd(priv, &cmd); | 324 | iwl_power_sleep_cam_cmd(priv, &cmd); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 267eb8935902..0a5d7cf25196 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -398,7 +398,7 @@ bool iwl_good_plcp_health(struct iwl_priv *priv, | |||
398 | } | 398 | } |
399 | EXPORT_SYMBOL(iwl_good_plcp_health); | 399 | EXPORT_SYMBOL(iwl_good_plcp_health); |
400 | 400 | ||
401 | static void iwl_recover_from_statistics(struct iwl_priv *priv, | 401 | void iwl_recover_from_statistics(struct iwl_priv *priv, |
402 | struct iwl_rx_packet *pkt) | 402 | struct iwl_rx_packet *pkt) |
403 | { | 403 | { |
404 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 404 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
@@ -413,9 +413,11 @@ static void iwl_recover_from_statistics(struct iwl_priv *priv, | |||
413 | */ | 413 | */ |
414 | IWL_ERR(priv, "low ack count detected, " | 414 | IWL_ERR(priv, "low ack count detected, " |
415 | "restart firmware\n"); | 415 | "restart firmware\n"); |
416 | iwl_force_reset(priv, IWL_FW_RESET); | 416 | if (!iwl_force_reset(priv, IWL_FW_RESET)) |
417 | return; | ||
417 | } | 418 | } |
418 | } else if (priv->cfg->ops->lib->check_plcp_health) { | 419 | } |
420 | if (priv->cfg->ops->lib->check_plcp_health) { | ||
419 | if (!priv->cfg->ops->lib->check_plcp_health( | 421 | if (!priv->cfg->ops->lib->check_plcp_health( |
420 | priv, pkt)) { | 422 | priv, pkt)) { |
421 | /* | 423 | /* |
@@ -427,6 +429,7 @@ static void iwl_recover_from_statistics(struct iwl_priv *priv, | |||
427 | } | 429 | } |
428 | } | 430 | } |
429 | } | 431 | } |
432 | EXPORT_SYMBOL(iwl_recover_from_statistics); | ||
430 | 433 | ||
431 | void iwl_rx_statistics(struct iwl_priv *priv, | 434 | void iwl_rx_statistics(struct iwl_priv *priv, |
432 | struct iwl_rx_mem_buffer *rxb) | 435 | struct iwl_rx_mem_buffer *rxb) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index d12fd5553846..107e173112f6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -265,7 +265,8 @@ inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv, | |||
265 | EXPORT_SYMBOL(iwl_get_active_dwell_time); | 265 | EXPORT_SYMBOL(iwl_get_active_dwell_time); |
266 | 266 | ||
267 | u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, | 267 | u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, |
268 | enum ieee80211_band band) | 268 | enum ieee80211_band band, |
269 | struct ieee80211_vif *vif) | ||
269 | { | 270 | { |
270 | u16 passive = (band == IEEE80211_BAND_2GHZ) ? | 271 | u16 passive = (band == IEEE80211_BAND_2GHZ) ? |
271 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : | 272 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : |
@@ -275,7 +276,7 @@ u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, | |||
275 | /* If we're associated, we clamp the maximum passive | 276 | /* If we're associated, we clamp the maximum passive |
276 | * dwell time to be 98% of the beacon interval (minus | 277 | * dwell time to be 98% of the beacon interval (minus |
277 | * 2 * channel tune time) */ | 278 | * 2 * channel tune time) */ |
278 | passive = priv->beacon_int; | 279 | passive = vif ? vif->bss_conf.beacon_int : 0; |
279 | if ((passive > IWL_PASSIVE_DWELL_BASE) || !passive) | 280 | if ((passive > IWL_PASSIVE_DWELL_BASE) || !passive) |
280 | passive = IWL_PASSIVE_DWELL_BASE; | 281 | passive = IWL_PASSIVE_DWELL_BASE; |
281 | passive = (passive * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; | 282 | passive = (passive * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; |
@@ -295,7 +296,7 @@ void iwl_init_scan_params(struct iwl_priv *priv) | |||
295 | } | 296 | } |
296 | EXPORT_SYMBOL(iwl_init_scan_params); | 297 | EXPORT_SYMBOL(iwl_init_scan_params); |
297 | 298 | ||
298 | static int iwl_scan_initiate(struct iwl_priv *priv) | 299 | static int iwl_scan_initiate(struct iwl_priv *priv, struct ieee80211_vif *vif) |
299 | { | 300 | { |
300 | WARN_ON(!mutex_is_locked(&priv->mutex)); | 301 | WARN_ON(!mutex_is_locked(&priv->mutex)); |
301 | 302 | ||
@@ -307,7 +308,7 @@ static int iwl_scan_initiate(struct iwl_priv *priv) | |||
307 | if (WARN_ON(!priv->cfg->ops->utils->request_scan)) | 308 | if (WARN_ON(!priv->cfg->ops->utils->request_scan)) |
308 | return -EOPNOTSUPP; | 309 | return -EOPNOTSUPP; |
309 | 310 | ||
310 | priv->cfg->ops->utils->request_scan(priv); | 311 | priv->cfg->ops->utils->request_scan(priv, vif); |
311 | 312 | ||
312 | return 0; | 313 | return 0; |
313 | } | 314 | } |
@@ -348,7 +349,7 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw, | |||
348 | priv->scan_band = req->channels[0]->band; | 349 | priv->scan_band = req->channels[0]->band; |
349 | priv->scan_request = req; | 350 | priv->scan_request = req; |
350 | 351 | ||
351 | ret = iwl_scan_initiate(priv); | 352 | ret = iwl_scan_initiate(priv, vif); |
352 | 353 | ||
353 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 354 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
354 | 355 | ||
@@ -368,7 +369,7 @@ void iwl_internal_short_hw_scan(struct iwl_priv *priv) | |||
368 | queue_work(priv->workqueue, &priv->start_internal_scan); | 369 | queue_work(priv->workqueue, &priv->start_internal_scan); |
369 | } | 370 | } |
370 | 371 | ||
371 | static void iwl_bg_start_internal_scan(struct work_struct *work) | 372 | void iwl_bg_start_internal_scan(struct work_struct *work) |
372 | { | 373 | { |
373 | struct iwl_priv *priv = | 374 | struct iwl_priv *priv = |
374 | container_of(work, struct iwl_priv, start_internal_scan); | 375 | container_of(work, struct iwl_priv, start_internal_scan); |
@@ -399,10 +400,11 @@ static void iwl_bg_start_internal_scan(struct work_struct *work) | |||
399 | if (WARN_ON(!priv->cfg->ops->utils->request_scan)) | 400 | if (WARN_ON(!priv->cfg->ops->utils->request_scan)) |
400 | goto unlock; | 401 | goto unlock; |
401 | 402 | ||
402 | priv->cfg->ops->utils->request_scan(priv); | 403 | priv->cfg->ops->utils->request_scan(priv, NULL); |
403 | unlock: | 404 | unlock: |
404 | mutex_unlock(&priv->mutex); | 405 | mutex_unlock(&priv->mutex); |
405 | } | 406 | } |
407 | EXPORT_SYMBOL(iwl_bg_start_internal_scan); | ||
406 | 408 | ||
407 | void iwl_bg_scan_check(struct work_struct *data) | 409 | void iwl_bg_scan_check(struct work_struct *data) |
408 | { | 410 | { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index db934476b5e9..85ed235ac901 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -35,62 +35,6 @@ | |||
35 | #include "iwl-core.h" | 35 | #include "iwl-core.h" |
36 | #include "iwl-sta.h" | 36 | #include "iwl-sta.h" |
37 | 37 | ||
38 | u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr) | ||
39 | { | ||
40 | int i; | ||
41 | int start = 0; | ||
42 | int ret = IWL_INVALID_STATION; | ||
43 | unsigned long flags; | ||
44 | |||
45 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) || | ||
46 | (priv->iw_mode == NL80211_IFTYPE_AP)) | ||
47 | start = IWL_STA_ID; | ||
48 | |||
49 | if (is_broadcast_ether_addr(addr)) | ||
50 | return priv->hw_params.bcast_sta_id; | ||
51 | |||
52 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
53 | for (i = start; i < priv->hw_params.max_stations; i++) | ||
54 | if (priv->stations[i].used && | ||
55 | (!compare_ether_addr(priv->stations[i].sta.sta.addr, | ||
56 | addr))) { | ||
57 | ret = i; | ||
58 | goto out; | ||
59 | } | ||
60 | |||
61 | IWL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n", | ||
62 | addr, priv->num_stations); | ||
63 | |||
64 | out: | ||
65 | /* | ||
66 | * It may be possible that more commands interacting with stations | ||
67 | * arrive before we completed processing the adding of | ||
68 | * station | ||
69 | */ | ||
70 | if (ret != IWL_INVALID_STATION && | ||
71 | (!(priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) || | ||
72 | ((priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) && | ||
73 | (priv->stations[ret].used & IWL_STA_UCODE_INPROGRESS)))) { | ||
74 | IWL_ERR(priv, "Requested station info for sta %d before ready.\n", | ||
75 | ret); | ||
76 | ret = IWL_INVALID_STATION; | ||
77 | } | ||
78 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
79 | return ret; | ||
80 | } | ||
81 | EXPORT_SYMBOL(iwl_find_station); | ||
82 | |||
83 | int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | ||
84 | { | ||
85 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { | ||
86 | return IWL_AP_ID; | ||
87 | } else { | ||
88 | u8 *da = ieee80211_get_DA(hdr); | ||
89 | return iwl_find_station(priv, da); | ||
90 | } | ||
91 | } | ||
92 | EXPORT_SYMBOL(iwl_get_ra_sta_id); | ||
93 | |||
94 | /* priv->sta_lock must be held */ | 38 | /* priv->sta_lock must be held */ |
95 | static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) | 39 | static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) |
96 | { | 40 | { |
@@ -340,10 +284,12 @@ static u8 iwl_prep_station(struct iwl_priv *priv, const u8 *addr, | |||
340 | station->sta.sta.sta_id = sta_id; | 284 | station->sta.sta.sta_id = sta_id; |
341 | station->sta.station_flags = 0; | 285 | station->sta.station_flags = 0; |
342 | 286 | ||
343 | /* BCAST station and IBSS stations do not work in HT mode */ | 287 | /* |
344 | if (sta_id != priv->hw_params.bcast_sta_id && | 288 | * OK to call unconditionally, since local stations (IBSS BSSID |
345 | priv->iw_mode != NL80211_IFTYPE_ADHOC) | 289 | * STA and broadcast STA) pass in a NULL ht_info, and mac80211 |
346 | iwl_set_ht_add_station(priv, sta_id, ht_info); | 290 | * doesn't allow HT IBSS. |
291 | */ | ||
292 | iwl_set_ht_add_station(priv, sta_id, ht_info); | ||
347 | 293 | ||
348 | /* 3945 only */ | 294 | /* 3945 only */ |
349 | rate = (priv->band == IEEE80211_BAND_5GHZ) ? | 295 | rate = (priv->band == IEEE80211_BAND_5GHZ) ? |
@@ -418,20 +364,21 @@ int iwl_add_station_common(struct iwl_priv *priv, const u8 *addr, | |||
418 | } | 364 | } |
419 | EXPORT_SYMBOL(iwl_add_station_common); | 365 | EXPORT_SYMBOL(iwl_add_station_common); |
420 | 366 | ||
421 | static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, bool is_ap) | 367 | static struct iwl_link_quality_cmd *iwl_sta_alloc_lq(struct iwl_priv *priv, |
368 | u8 sta_id) | ||
422 | { | 369 | { |
423 | int i, r; | 370 | int i, r; |
424 | struct iwl_link_quality_cmd link_cmd = { | 371 | struct iwl_link_quality_cmd *link_cmd; |
425 | .reserved1 = 0, | ||
426 | }; | ||
427 | u32 rate_flags; | 372 | u32 rate_flags; |
428 | int ret = 0; | ||
429 | 373 | ||
374 | link_cmd = kzalloc(sizeof(struct iwl_link_quality_cmd), GFP_KERNEL); | ||
375 | if (!link_cmd) { | ||
376 | IWL_ERR(priv, "Unable to allocate memory for LQ cmd.\n"); | ||
377 | return NULL; | ||
378 | } | ||
430 | /* Set up the rate scaling to start at selected rate, fall back | 379 | /* Set up the rate scaling to start at selected rate, fall back |
431 | * all the way down to 1M in IEEE order, and then spin on 1M */ | 380 | * all the way down to 1M in IEEE order, and then spin on 1M */ |
432 | if (is_ap) | 381 | if (priv->band == IEEE80211_BAND_5GHZ) |
433 | r = IWL_RATE_54M_INDEX; | ||
434 | else if (priv->band == IEEE80211_BAND_5GHZ) | ||
435 | r = IWL_RATE_6M_INDEX; | 382 | r = IWL_RATE_6M_INDEX; |
436 | else | 383 | else |
437 | r = IWL_RATE_1M_INDEX; | 384 | r = IWL_RATE_1M_INDEX; |
@@ -444,49 +391,48 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, bool is_ap) | |||
444 | rate_flags |= first_antenna(priv->hw_params.valid_tx_ant) << | 391 | rate_flags |= first_antenna(priv->hw_params.valid_tx_ant) << |
445 | RATE_MCS_ANT_POS; | 392 | RATE_MCS_ANT_POS; |
446 | 393 | ||
447 | link_cmd.rs_table[i].rate_n_flags = | 394 | link_cmd->rs_table[i].rate_n_flags = |
448 | iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); | 395 | iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); |
449 | r = iwl_get_prev_ieee_rate(r); | 396 | r = iwl_get_prev_ieee_rate(r); |
450 | } | 397 | } |
451 | 398 | ||
452 | link_cmd.general_params.single_stream_ant_msk = | 399 | link_cmd->general_params.single_stream_ant_msk = |
453 | first_antenna(priv->hw_params.valid_tx_ant); | 400 | first_antenna(priv->hw_params.valid_tx_ant); |
454 | 401 | ||
455 | link_cmd.general_params.dual_stream_ant_msk = | 402 | link_cmd->general_params.dual_stream_ant_msk = |
456 | priv->hw_params.valid_tx_ant & | 403 | priv->hw_params.valid_tx_ant & |
457 | ~first_antenna(priv->hw_params.valid_tx_ant); | 404 | ~first_antenna(priv->hw_params.valid_tx_ant); |
458 | if (!link_cmd.general_params.dual_stream_ant_msk) { | 405 | if (!link_cmd->general_params.dual_stream_ant_msk) { |
459 | link_cmd.general_params.dual_stream_ant_msk = ANT_AB; | 406 | link_cmd->general_params.dual_stream_ant_msk = ANT_AB; |
460 | } else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) { | 407 | } else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) { |
461 | link_cmd.general_params.dual_stream_ant_msk = | 408 | link_cmd->general_params.dual_stream_ant_msk = |
462 | priv->hw_params.valid_tx_ant; | 409 | priv->hw_params.valid_tx_ant; |
463 | } | 410 | } |
464 | 411 | ||
465 | link_cmd.agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; | 412 | link_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; |
466 | link_cmd.agg_params.agg_time_limit = | 413 | link_cmd->agg_params.agg_time_limit = |
467 | cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF); | 414 | cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF); |
468 | 415 | ||
469 | /* Update the rate scaling for control frame Tx to AP */ | 416 | link_cmd->sta_id = sta_id; |
470 | link_cmd.sta_id = is_ap ? IWL_AP_ID : priv->hw_params.bcast_sta_id; | ||
471 | 417 | ||
472 | ret = iwl_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, | 418 | return link_cmd; |
473 | sizeof(link_cmd), &link_cmd); | ||
474 | if (ret) | ||
475 | IWL_ERR(priv, "REPLY_TX_LINK_QUALITY_CMD failed (%d)\n", ret); | ||
476 | } | 419 | } |
477 | 420 | ||
478 | /* | 421 | /* |
479 | * iwl_add_local_stations - Add stations not requested by mac80211 | 422 | * iwl_add_bssid_station - Add the special IBSS BSSID station |
480 | * | ||
481 | * This will be either the broadcast station or the bssid station needed by | ||
482 | * ad-hoc. | ||
483 | * | 423 | * |
484 | * Function sleeps. | 424 | * Function sleeps. |
485 | */ | 425 | */ |
486 | int iwl_add_local_station(struct iwl_priv *priv, const u8 *addr, bool init_rs) | 426 | int iwl_add_bssid_station(struct iwl_priv *priv, const u8 *addr, bool init_rs, |
427 | u8 *sta_id_r) | ||
487 | { | 428 | { |
488 | int ret; | 429 | int ret; |
489 | u8 sta_id; | 430 | u8 sta_id; |
431 | struct iwl_link_quality_cmd *link_cmd; | ||
432 | unsigned long flags; | ||
433 | |||
434 | if (*sta_id_r) | ||
435 | *sta_id_r = IWL_INVALID_STATION; | ||
490 | 436 | ||
491 | ret = iwl_add_station_common(priv, addr, 0, NULL, &sta_id); | 437 | ret = iwl_add_station_common(priv, addr, 0, NULL, &sta_id); |
492 | if (ret) { | 438 | if (ret) { |
@@ -494,12 +440,34 @@ int iwl_add_local_station(struct iwl_priv *priv, const u8 *addr, bool init_rs) | |||
494 | return ret; | 440 | return ret; |
495 | } | 441 | } |
496 | 442 | ||
497 | if (init_rs) | 443 | if (sta_id_r) |
444 | *sta_id_r = sta_id; | ||
445 | |||
446 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
447 | priv->stations[sta_id].used |= IWL_STA_LOCAL; | ||
448 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
449 | |||
450 | if (init_rs) { | ||
498 | /* Set up default rate scaling table in device's station table */ | 451 | /* Set up default rate scaling table in device's station table */ |
499 | iwl_sta_init_lq(priv, addr, false); | 452 | link_cmd = iwl_sta_alloc_lq(priv, sta_id); |
453 | if (!link_cmd) { | ||
454 | IWL_ERR(priv, "Unable to initialize rate scaling for station %pM.\n", | ||
455 | addr); | ||
456 | return -ENOMEM; | ||
457 | } | ||
458 | |||
459 | ret = iwl_send_lq_cmd(priv, link_cmd, CMD_SYNC, true); | ||
460 | if (ret) | ||
461 | IWL_ERR(priv, "Link quality command failed (%d)\n", ret); | ||
462 | |||
463 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
464 | priv->stations[sta_id].lq = link_cmd; | ||
465 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
466 | } | ||
467 | |||
500 | return 0; | 468 | return 0; |
501 | } | 469 | } |
502 | EXPORT_SYMBOL(iwl_add_local_station); | 470 | EXPORT_SYMBOL(iwl_add_bssid_station); |
503 | 471 | ||
504 | /** | 472 | /** |
505 | * iwl_sta_ucode_deactivate - deactivate ucode status for a station | 473 | * iwl_sta_ucode_deactivate - deactivate ucode status for a station |
@@ -509,7 +477,8 @@ EXPORT_SYMBOL(iwl_add_local_station); | |||
509 | static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, u8 sta_id) | 477 | static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, u8 sta_id) |
510 | { | 478 | { |
511 | /* Ucode must be active and driver must be non active */ | 479 | /* Ucode must be active and driver must be non active */ |
512 | if (priv->stations[sta_id].used != IWL_STA_UCODE_ACTIVE) | 480 | if ((priv->stations[sta_id].used & |
481 | (IWL_STA_UCODE_ACTIVE | IWL_STA_DRIVER_ACTIVE)) != IWL_STA_UCODE_ACTIVE) | ||
513 | IWL_ERR(priv, "removed non active STA %u\n", sta_id); | 482 | IWL_ERR(priv, "removed non active STA %u\n", sta_id); |
514 | 483 | ||
515 | priv->stations[sta_id].used &= ~IWL_STA_UCODE_ACTIVE; | 484 | priv->stations[sta_id].used &= ~IWL_STA_UCODE_ACTIVE; |
@@ -574,18 +543,16 @@ static int iwl_send_remove_station(struct iwl_priv *priv, | |||
574 | /** | 543 | /** |
575 | * iwl_remove_station - Remove driver's knowledge of station. | 544 | * iwl_remove_station - Remove driver's knowledge of station. |
576 | */ | 545 | */ |
577 | static int iwl_remove_station(struct iwl_priv *priv, struct ieee80211_sta *sta) | 546 | int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, |
547 | const u8 *addr) | ||
578 | { | 548 | { |
579 | int sta_id = IWL_INVALID_STATION; | ||
580 | int i, ret = -EINVAL; | ||
581 | unsigned long flags; | ||
582 | bool is_ap = priv->iw_mode == NL80211_IFTYPE_STATION; | ||
583 | struct iwl_station_entry *station; | 549 | struct iwl_station_entry *station; |
550 | unsigned long flags; | ||
584 | 551 | ||
585 | if (!iwl_is_ready(priv)) { | 552 | if (!iwl_is_ready(priv)) { |
586 | IWL_DEBUG_INFO(priv, | 553 | IWL_DEBUG_INFO(priv, |
587 | "Unable to remove station %pM, device not ready.\n", | 554 | "Unable to remove station %pM, device not ready.\n", |
588 | sta->addr); | 555 | addr); |
589 | /* | 556 | /* |
590 | * It is typical for stations to be removed when we are | 557 | * It is typical for stations to be removed when we are |
591 | * going down. Return success since device will be down | 558 | * going down. Return success since device will be down |
@@ -594,37 +561,30 @@ static int iwl_remove_station(struct iwl_priv *priv, struct ieee80211_sta *sta) | |||
594 | return 0; | 561 | return 0; |
595 | } | 562 | } |
596 | 563 | ||
597 | spin_lock_irqsave(&priv->sta_lock, flags); | 564 | IWL_DEBUG_ASSOC(priv, "Removing STA from driver:%d %pM\n", |
598 | 565 | sta_id, addr); | |
599 | if (is_ap) | ||
600 | sta_id = IWL_AP_ID; | ||
601 | else | ||
602 | for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++) | ||
603 | if (priv->stations[i].used && | ||
604 | !compare_ether_addr(priv->stations[i].sta.sta.addr, | ||
605 | sta->addr)) { | ||
606 | sta_id = i; | ||
607 | break; | ||
608 | } | ||
609 | 566 | ||
610 | if (unlikely(sta_id == IWL_INVALID_STATION)) | 567 | if (WARN_ON(sta_id == IWL_INVALID_STATION)) |
611 | goto out; | 568 | return -EINVAL; |
612 | 569 | ||
613 | IWL_DEBUG_ASSOC(priv, "Removing STA from driver:%d %pM\n", | 570 | spin_lock_irqsave(&priv->sta_lock, flags); |
614 | sta_id, sta->addr); | ||
615 | 571 | ||
616 | if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { | 572 | if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { |
617 | IWL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n", | 573 | IWL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n", |
618 | sta->addr); | 574 | addr); |
619 | goto out; | 575 | goto out_err; |
620 | } | 576 | } |
621 | 577 | ||
622 | if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { | 578 | if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { |
623 | IWL_DEBUG_INFO(priv, "Removing %pM but non UCODE active\n", | 579 | IWL_DEBUG_INFO(priv, "Removing %pM but non UCODE active\n", |
624 | sta->addr); | 580 | addr); |
625 | goto out; | 581 | goto out_err; |
626 | } | 582 | } |
627 | 583 | ||
584 | if (priv->stations[sta_id].used & IWL_STA_LOCAL) { | ||
585 | kfree(priv->stations[sta_id].lq); | ||
586 | priv->stations[sta_id].lq = NULL; | ||
587 | } | ||
628 | 588 | ||
629 | priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; | 589 | priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; |
630 | 590 | ||
@@ -635,56 +595,35 @@ static int iwl_remove_station(struct iwl_priv *priv, struct ieee80211_sta *sta) | |||
635 | station = &priv->stations[sta_id]; | 595 | station = &priv->stations[sta_id]; |
636 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 596 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
637 | 597 | ||
638 | ret = iwl_send_remove_station(priv, station); | 598 | return iwl_send_remove_station(priv, station); |
639 | return ret; | 599 | out_err: |
640 | out: | ||
641 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 600 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
642 | return ret; | 601 | return -EINVAL; |
643 | } | 602 | } |
603 | EXPORT_SYMBOL_GPL(iwl_remove_station); | ||
644 | 604 | ||
645 | /** | 605 | /** |
646 | * iwl_clear_ucode_stations() - clear entire station table driver and/or ucode | 606 | * iwl_clear_ucode_stations - clear ucode station table bits |
647 | * @priv: | 607 | * |
648 | * @force: If set then the uCode station table needs to be cleared here. If | 608 | * This function clears all the bits in the driver indicating |
649 | * not set then the uCode station table has already been cleared, | 609 | * which stations are active in the ucode. Call when something |
650 | * for example after sending it a RXON command without ASSOC bit | 610 | * other than explicit station management would cause this in |
651 | * set, and we just need to change driver state here. | 611 | * the ucode, e.g. unassociated RXON. |
652 | */ | 612 | */ |
653 | void iwl_clear_ucode_stations(struct iwl_priv *priv, bool force) | 613 | void iwl_clear_ucode_stations(struct iwl_priv *priv) |
654 | { | 614 | { |
655 | int i; | 615 | int i; |
656 | unsigned long flags_spin; | 616 | unsigned long flags_spin; |
657 | bool cleared = false; | 617 | bool cleared = false; |
658 | 618 | ||
659 | IWL_DEBUG_INFO(priv, "Clearing ucode stations in driver%s\n", | 619 | IWL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n"); |
660 | force ? " and ucode" : ""); | ||
661 | |||
662 | if (force) { | ||
663 | if (!iwl_is_ready(priv)) { | ||
664 | /* | ||
665 | * If device is not ready at this point the station | ||
666 | * table is likely already empty (uCode not ready | ||
667 | * to receive station requests) or will soon be | ||
668 | * due to interface going down. | ||
669 | */ | ||
670 | IWL_DEBUG_INFO(priv, "Unable to remove stations from device - device not ready\n"); | ||
671 | } else { | ||
672 | iwl_send_cmd_pdu_async(priv, REPLY_REMOVE_ALL_STA, 0, NULL, NULL); | ||
673 | } | ||
674 | } | ||
675 | 620 | ||
676 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 621 | spin_lock_irqsave(&priv->sta_lock, flags_spin); |
677 | if (force) { | 622 | for (i = 0; i < priv->hw_params.max_stations; i++) { |
678 | IWL_DEBUG_INFO(priv, "Clearing all station information in driver\n"); | 623 | if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) { |
679 | priv->num_stations = 0; | 624 | IWL_DEBUG_INFO(priv, "Clearing ucode active for station %d\n", i); |
680 | memset(priv->stations, 0, sizeof(priv->stations)); | 625 | priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; |
681 | } else { | 626 | cleared = true; |
682 | for (i = 0; i < priv->hw_params.max_stations; i++) { | ||
683 | if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) { | ||
684 | IWL_DEBUG_INFO(priv, "Clearing ucode active for station %d\n", i); | ||
685 | priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; | ||
686 | cleared = true; | ||
687 | } | ||
688 | } | 627 | } |
689 | } | 628 | } |
690 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 629 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); |
@@ -1027,18 +966,23 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv, | |||
1027 | 966 | ||
1028 | void iwl_update_tkip_key(struct iwl_priv *priv, | 967 | void iwl_update_tkip_key(struct iwl_priv *priv, |
1029 | struct ieee80211_key_conf *keyconf, | 968 | struct ieee80211_key_conf *keyconf, |
1030 | const u8 *addr, u32 iv32, u16 *phase1key) | 969 | struct ieee80211_sta *sta, u32 iv32, u16 *phase1key) |
1031 | { | 970 | { |
1032 | u8 sta_id = IWL_INVALID_STATION; | 971 | u8 sta_id; |
1033 | unsigned long flags; | 972 | unsigned long flags; |
1034 | int i; | 973 | int i; |
1035 | 974 | ||
1036 | sta_id = iwl_find_station(priv, addr); | 975 | if (sta) { |
1037 | if (sta_id == IWL_INVALID_STATION) { | 976 | sta_id = iwl_sta_id(sta); |
1038 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", | 977 | |
1039 | addr); | 978 | if (sta_id == IWL_INVALID_STATION) { |
1040 | return; | 979 | IWL_DEBUG_MAC80211(priv, "leave - %pM not initialised.\n", |
1041 | } | 980 | sta->addr); |
981 | return; | ||
982 | } | ||
983 | } else | ||
984 | sta_id = priv->hw_params.bcast_sta_id; | ||
985 | |||
1042 | 986 | ||
1043 | if (iwl_scan_cancel(priv)) { | 987 | if (iwl_scan_cancel(priv)) { |
1044 | /* cancel scan failed, just live w/ bad key and rely | 988 | /* cancel scan failed, just live w/ bad key and rely |
@@ -1178,6 +1122,39 @@ static inline void iwl_dump_lq_cmd(struct iwl_priv *priv, | |||
1178 | #endif | 1122 | #endif |
1179 | 1123 | ||
1180 | /** | 1124 | /** |
1125 | * is_lq_table_valid() - Test one aspect of LQ cmd for validity | ||
1126 | * | ||
1127 | * It sometimes happens when a HT rate has been in use and we | ||
1128 | * loose connectivity with AP then mac80211 will first tell us that the | ||
1129 | * current channel is not HT anymore before removing the station. In such a | ||
1130 | * scenario the RXON flags will be updated to indicate we are not | ||
1131 | * communicating HT anymore, but the LQ command may still contain HT rates. | ||
1132 | * Test for this to prevent driver from sending LQ command between the time | ||
1133 | * RXON flags are updated and when LQ command is updated. | ||
1134 | */ | ||
1135 | static bool is_lq_table_valid(struct iwl_priv *priv, | ||
1136 | struct iwl_link_quality_cmd *lq) | ||
1137 | { | ||
1138 | int i; | ||
1139 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; | ||
1140 | |||
1141 | if (ht_conf->is_ht) | ||
1142 | return true; | ||
1143 | |||
1144 | IWL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n", | ||
1145 | priv->active_rxon.channel); | ||
1146 | for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { | ||
1147 | if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & RATE_MCS_HT_MSK) { | ||
1148 | IWL_DEBUG_INFO(priv, | ||
1149 | "index %d of LQ expects HT channel\n", | ||
1150 | i); | ||
1151 | return false; | ||
1152 | } | ||
1153 | } | ||
1154 | return true; | ||
1155 | } | ||
1156 | |||
1157 | /** | ||
1181 | * iwl_send_lq_cmd() - Send link quality command | 1158 | * iwl_send_lq_cmd() - Send link quality command |
1182 | * @init: This command is sent as part of station initialization right | 1159 | * @init: This command is sent as part of station initialization right |
1183 | * after station has been added. | 1160 | * after station has been added. |
@@ -1206,8 +1183,12 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, | |||
1206 | iwl_dump_lq_cmd(priv, lq); | 1183 | iwl_dump_lq_cmd(priv, lq); |
1207 | BUG_ON(init && (cmd.flags & CMD_ASYNC)); | 1184 | BUG_ON(init && (cmd.flags & CMD_ASYNC)); |
1208 | 1185 | ||
1209 | ret = iwl_send_cmd(priv, &cmd); | 1186 | if (is_lq_table_valid(priv, lq)) |
1210 | if (ret || (cmd.flags & CMD_ASYNC)) | 1187 | ret = iwl_send_cmd(priv, &cmd); |
1188 | else | ||
1189 | ret = -EINVAL; | ||
1190 | |||
1191 | if (cmd.flags & CMD_ASYNC) | ||
1211 | return ret; | 1192 | return ret; |
1212 | 1193 | ||
1213 | if (init) { | 1194 | if (init) { |
@@ -1217,92 +1198,72 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, | |||
1217 | priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; | 1198 | priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; |
1218 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 1199 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); |
1219 | } | 1200 | } |
1220 | return 0; | 1201 | return ret; |
1221 | } | 1202 | } |
1222 | EXPORT_SYMBOL(iwl_send_lq_cmd); | 1203 | EXPORT_SYMBOL(iwl_send_lq_cmd); |
1223 | 1204 | ||
1224 | /** | 1205 | /** |
1225 | * iwl_add_bcast_station - add broadcast station into station table. | 1206 | * iwl_alloc_bcast_station - add broadcast station into driver's station table. |
1207 | * | ||
1208 | * This adds the broadcast station into the driver's station table | ||
1209 | * and marks it driver active, so that it will be restored to the | ||
1210 | * device at the next best time. | ||
1226 | */ | 1211 | */ |
1227 | void iwl_add_bcast_station(struct iwl_priv *priv) | 1212 | int iwl_alloc_bcast_station(struct iwl_priv *priv, bool init_lq) |
1228 | { | 1213 | { |
1229 | IWL_DEBUG_INFO(priv, "Adding broadcast station to station table\n"); | 1214 | struct iwl_link_quality_cmd *link_cmd; |
1230 | iwl_add_local_station(priv, iwl_bcast_addr, true); | 1215 | unsigned long flags; |
1231 | } | 1216 | u8 sta_id; |
1232 | EXPORT_SYMBOL(iwl_add_bcast_station); | ||
1233 | 1217 | ||
1234 | /** | 1218 | spin_lock_irqsave(&priv->sta_lock, flags); |
1235 | * iwl3945_add_bcast_station - add broadcast station into station table. | 1219 | sta_id = iwl_prep_station(priv, iwl_bcast_addr, false, NULL); |
1236 | */ | 1220 | if (sta_id == IWL_INVALID_STATION) { |
1237 | void iwl3945_add_bcast_station(struct iwl_priv *priv) | 1221 | IWL_ERR(priv, "Unable to prepare broadcast station\n"); |
1238 | { | 1222 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
1239 | IWL_DEBUG_INFO(priv, "Adding broadcast station to station table\n"); | ||
1240 | iwl_add_local_station(priv, iwl_bcast_addr, false); | ||
1241 | /* | ||
1242 | * It is assumed that when station is added more initialization | ||
1243 | * needs to be done, but for 3945 it is not the case and we can | ||
1244 | * just release station table access right here. | ||
1245 | */ | ||
1246 | priv->stations[priv->hw_params.bcast_sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; | ||
1247 | 1223 | ||
1248 | } | 1224 | return -EINVAL; |
1249 | EXPORT_SYMBOL(iwl3945_add_bcast_station); | 1225 | } |
1250 | 1226 | ||
1251 | /** | 1227 | priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; |
1252 | * iwl_get_sta_id - Find station's index within station table | 1228 | priv->stations[sta_id].used |= IWL_STA_BCAST; |
1253 | * | 1229 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
1254 | * If new IBSS station, create new entry in station table | ||
1255 | */ | ||
1256 | int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | ||
1257 | { | ||
1258 | int sta_id; | ||
1259 | __le16 fc = hdr->frame_control; | ||
1260 | 1230 | ||
1261 | /* If this frame is broadcast or management, use broadcast station id */ | 1231 | if (init_lq) { |
1262 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1)) | 1232 | link_cmd = iwl_sta_alloc_lq(priv, sta_id); |
1263 | return priv->hw_params.bcast_sta_id; | 1233 | if (!link_cmd) { |
1234 | IWL_ERR(priv, | ||
1235 | "Unable to initialize rate scaling for bcast station.\n"); | ||
1236 | return -ENOMEM; | ||
1237 | } | ||
1264 | 1238 | ||
1265 | switch (priv->iw_mode) { | 1239 | spin_lock_irqsave(&priv->sta_lock, flags); |
1240 | priv->stations[sta_id].lq = link_cmd; | ||
1241 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
1242 | } | ||
1266 | 1243 | ||
1267 | /* If we are a client station in a BSS network, use the special | 1244 | return 0; |
1268 | * AP station entry (that's the only station we communicate with) */ | 1245 | } |
1269 | case NL80211_IFTYPE_STATION: | 1246 | EXPORT_SYMBOL_GPL(iwl_alloc_bcast_station); |
1270 | /* | ||
1271 | * If addition of station not complete yet, which means | ||
1272 | * that rate scaling has not been initialized, then return | ||
1273 | * the broadcast station. | ||
1274 | */ | ||
1275 | if (!(priv->stations[IWL_AP_ID].used & IWL_STA_UCODE_ACTIVE)) | ||
1276 | return priv->hw_params.bcast_sta_id; | ||
1277 | return IWL_AP_ID; | ||
1278 | |||
1279 | /* If we are an AP, then find the station, or use BCAST */ | ||
1280 | case NL80211_IFTYPE_AP: | ||
1281 | sta_id = iwl_find_station(priv, hdr->addr1); | ||
1282 | if (sta_id != IWL_INVALID_STATION) | ||
1283 | return sta_id; | ||
1284 | return priv->hw_params.bcast_sta_id; | ||
1285 | |||
1286 | /* If this frame is going out to an IBSS network, find the station, | ||
1287 | * or create a new station table entry */ | ||
1288 | case NL80211_IFTYPE_ADHOC: | ||
1289 | sta_id = iwl_find_station(priv, hdr->addr1); | ||
1290 | if (sta_id != IWL_INVALID_STATION) | ||
1291 | return sta_id; | ||
1292 | |||
1293 | IWL_DEBUG_DROP(priv, "Station %pM not in station map. " | ||
1294 | "Defaulting to broadcast...\n", | ||
1295 | hdr->addr1); | ||
1296 | iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); | ||
1297 | return priv->hw_params.bcast_sta_id; | ||
1298 | 1247 | ||
1299 | default: | 1248 | void iwl_dealloc_bcast_station(struct iwl_priv *priv) |
1300 | IWL_WARN(priv, "Unknown mode of operation: %d\n", | 1249 | { |
1301 | priv->iw_mode); | 1250 | unsigned long flags; |
1302 | return priv->hw_params.bcast_sta_id; | 1251 | int i; |
1252 | |||
1253 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
1254 | for (i = 0; i < priv->hw_params.max_stations; i++) { | ||
1255 | if (!(priv->stations[i].used & IWL_STA_BCAST)) | ||
1256 | continue; | ||
1257 | |||
1258 | priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; | ||
1259 | priv->num_stations--; | ||
1260 | BUG_ON(priv->num_stations < 0); | ||
1261 | kfree(priv->stations[i].lq); | ||
1262 | priv->stations[i].lq = NULL; | ||
1303 | } | 1263 | } |
1264 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
1304 | } | 1265 | } |
1305 | EXPORT_SYMBOL(iwl_get_sta_id); | 1266 | EXPORT_SYMBOL_GPL(iwl_dealloc_bcast_station); |
1306 | 1267 | ||
1307 | /** | 1268 | /** |
1308 | * iwl_sta_tx_modify_enable_tid - Enable Tx for this TID in station table | 1269 | * iwl_sta_tx_modify_enable_tid - Enable Tx for this TID in station table |
@@ -1322,13 +1283,13 @@ void iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid) | |||
1322 | } | 1283 | } |
1323 | EXPORT_SYMBOL(iwl_sta_tx_modify_enable_tid); | 1284 | EXPORT_SYMBOL(iwl_sta_tx_modify_enable_tid); |
1324 | 1285 | ||
1325 | int iwl_sta_rx_agg_start(struct iwl_priv *priv, | 1286 | int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, |
1326 | const u8 *addr, int tid, u16 ssn) | 1287 | int tid, u16 ssn) |
1327 | { | 1288 | { |
1328 | unsigned long flags; | 1289 | unsigned long flags; |
1329 | int sta_id; | 1290 | int sta_id; |
1330 | 1291 | ||
1331 | sta_id = iwl_find_station(priv, addr); | 1292 | sta_id = iwl_sta_id(sta); |
1332 | if (sta_id == IWL_INVALID_STATION) | 1293 | if (sta_id == IWL_INVALID_STATION) |
1333 | return -ENXIO; | 1294 | return -ENXIO; |
1334 | 1295 | ||
@@ -1341,16 +1302,17 @@ int iwl_sta_rx_agg_start(struct iwl_priv *priv, | |||
1341 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 1302 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
1342 | 1303 | ||
1343 | return iwl_send_add_sta(priv, &priv->stations[sta_id].sta, | 1304 | return iwl_send_add_sta(priv, &priv->stations[sta_id].sta, |
1344 | CMD_ASYNC); | 1305 | CMD_ASYNC); |
1345 | } | 1306 | } |
1346 | EXPORT_SYMBOL(iwl_sta_rx_agg_start); | 1307 | EXPORT_SYMBOL(iwl_sta_rx_agg_start); |
1347 | 1308 | ||
1348 | int iwl_sta_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid) | 1309 | int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, |
1310 | int tid) | ||
1349 | { | 1311 | { |
1350 | unsigned long flags; | 1312 | unsigned long flags; |
1351 | int sta_id; | 1313 | int sta_id; |
1352 | 1314 | ||
1353 | sta_id = iwl_find_station(priv, addr); | 1315 | sta_id = iwl_sta_id(sta); |
1354 | if (sta_id == IWL_INVALID_STATION) { | 1316 | if (sta_id == IWL_INVALID_STATION) { |
1355 | IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); | 1317 | IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); |
1356 | return -ENXIO; | 1318 | return -ENXIO; |
@@ -1402,14 +1364,16 @@ void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt) | |||
1402 | EXPORT_SYMBOL(iwl_sta_modify_sleep_tx_count); | 1364 | EXPORT_SYMBOL(iwl_sta_modify_sleep_tx_count); |
1403 | 1365 | ||
1404 | int iwl_mac_sta_remove(struct ieee80211_hw *hw, | 1366 | int iwl_mac_sta_remove(struct ieee80211_hw *hw, |
1405 | struct ieee80211_vif *vif, | 1367 | struct ieee80211_vif *vif, |
1406 | struct ieee80211_sta *sta) | 1368 | struct ieee80211_sta *sta) |
1407 | { | 1369 | { |
1408 | int ret; | ||
1409 | struct iwl_priv *priv = hw->priv; | 1370 | struct iwl_priv *priv = hw->priv; |
1371 | struct iwl_station_priv_common *sta_common = (void *)sta->drv_priv; | ||
1372 | int ret; | ||
1373 | |||
1410 | IWL_DEBUG_INFO(priv, "received request to remove station %pM\n", | 1374 | IWL_DEBUG_INFO(priv, "received request to remove station %pM\n", |
1411 | sta->addr); | 1375 | sta->addr); |
1412 | ret = iwl_remove_station(priv, sta); | 1376 | ret = iwl_remove_station(priv, sta_common->sta_id, sta->addr); |
1413 | if (ret) | 1377 | if (ret) |
1414 | IWL_ERR(priv, "Error removing station %pM\n", | 1378 | IWL_ERR(priv, "Error removing station %pM\n", |
1415 | sta->addr); | 1379 | sta->addr); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.h b/drivers/net/wireless/iwlwifi/iwl-sta.h index 42cd2f4a01cd..c2a453a1a991 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.h +++ b/drivers/net/wireless/iwlwifi/iwl-sta.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #ifndef __iwl_sta_h__ | 29 | #ifndef __iwl_sta_h__ |
30 | #define __iwl_sta_h__ | 30 | #define __iwl_sta_h__ |
31 | 31 | ||
32 | #include "iwl-dev.h" | ||
33 | |||
32 | #define HW_KEY_DYNAMIC 0 | 34 | #define HW_KEY_DYNAMIC 0 |
33 | #define HW_KEY_DEFAULT 1 | 35 | #define HW_KEY_DEFAULT 1 |
34 | 36 | ||
@@ -36,14 +38,11 @@ | |||
36 | #define IWL_STA_UCODE_ACTIVE BIT(1) /* ucode entry is active */ | 38 | #define IWL_STA_UCODE_ACTIVE BIT(1) /* ucode entry is active */ |
37 | #define IWL_STA_UCODE_INPROGRESS BIT(2) /* ucode entry is in process of | 39 | #define IWL_STA_UCODE_INPROGRESS BIT(2) /* ucode entry is in process of |
38 | being activated */ | 40 | being activated */ |
41 | #define IWL_STA_LOCAL BIT(3) /* station state not directed by mac80211; | ||
42 | (this is for the IBSS BSSID stations) */ | ||
43 | #define IWL_STA_BCAST BIT(4) /* this station is the special bcast station */ | ||
39 | 44 | ||
40 | 45 | ||
41 | /** | ||
42 | * iwl_find_station - Find station id for a given BSSID | ||
43 | * @bssid: MAC address of station ID to find | ||
44 | */ | ||
45 | u8 iwl_find_station(struct iwl_priv *priv, const u8 *bssid); | ||
46 | |||
47 | int iwl_remove_default_wep_key(struct iwl_priv *priv, | 46 | int iwl_remove_default_wep_key(struct iwl_priv *priv, |
48 | struct ieee80211_key_conf *key); | 47 | struct ieee80211_key_conf *key); |
49 | int iwl_set_default_wep_key(struct iwl_priv *priv, | 48 | int iwl_set_default_wep_key(struct iwl_priv *priv, |
@@ -55,28 +54,57 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv, | |||
55 | struct ieee80211_key_conf *key, u8 sta_id); | 54 | struct ieee80211_key_conf *key, u8 sta_id); |
56 | void iwl_update_tkip_key(struct iwl_priv *priv, | 55 | void iwl_update_tkip_key(struct iwl_priv *priv, |
57 | struct ieee80211_key_conf *keyconf, | 56 | struct ieee80211_key_conf *keyconf, |
58 | const u8 *addr, u32 iv32, u16 *phase1key); | 57 | struct ieee80211_sta *sta, u32 iv32, u16 *phase1key); |
59 | 58 | ||
60 | void iwl_add_bcast_station(struct iwl_priv *priv); | ||
61 | void iwl3945_add_bcast_station(struct iwl_priv *priv); | ||
62 | void iwl_restore_stations(struct iwl_priv *priv); | 59 | void iwl_restore_stations(struct iwl_priv *priv); |
63 | void iwl_clear_ucode_stations(struct iwl_priv *priv, bool force); | 60 | void iwl_clear_ucode_stations(struct iwl_priv *priv); |
61 | int iwl_alloc_bcast_station(struct iwl_priv *priv, bool init_lq); | ||
62 | void iwl_dealloc_bcast_station(struct iwl_priv *priv); | ||
64 | int iwl_get_free_ucode_key_index(struct iwl_priv *priv); | 63 | int iwl_get_free_ucode_key_index(struct iwl_priv *priv); |
65 | int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); | ||
66 | int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); | ||
67 | int iwl_send_add_sta(struct iwl_priv *priv, | 64 | int iwl_send_add_sta(struct iwl_priv *priv, |
68 | struct iwl_addsta_cmd *sta, u8 flags); | 65 | struct iwl_addsta_cmd *sta, u8 flags); |
69 | int iwl_add_local_station(struct iwl_priv *priv, const u8 *addr, bool init_rs); | 66 | int iwl_add_bssid_station(struct iwl_priv *priv, const u8 *addr, bool init_rs, |
67 | u8 *sta_id_r); | ||
70 | int iwl_add_station_common(struct iwl_priv *priv, const u8 *addr, | 68 | int iwl_add_station_common(struct iwl_priv *priv, const u8 *addr, |
71 | bool is_ap, | 69 | bool is_ap, |
72 | struct ieee80211_sta_ht_cap *ht_info, | 70 | struct ieee80211_sta_ht_cap *ht_info, |
73 | u8 *sta_id_r); | 71 | u8 *sta_id_r); |
72 | int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, | ||
73 | const u8 *addr); | ||
74 | int iwl_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 74 | int iwl_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
75 | struct ieee80211_sta *sta); | 75 | struct ieee80211_sta *sta); |
76 | void iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid); | 76 | void iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid); |
77 | int iwl_sta_rx_agg_start(struct iwl_priv *priv, | 77 | int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, |
78 | const u8 *addr, int tid, u16 ssn); | 78 | int tid, u16 ssn); |
79 | int iwl_sta_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid); | 79 | int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, |
80 | int tid); | ||
80 | void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id); | 81 | void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id); |
81 | void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt); | 82 | void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt); |
83 | |||
84 | /** | ||
85 | * iwl_clear_driver_stations - clear knowledge of all stations from driver | ||
86 | * @priv: iwl priv struct | ||
87 | * | ||
88 | * This is called during iwl_down() to make sure that in the case | ||
89 | * we're coming there from a hardware restart mac80211 will be | ||
90 | * able to reconfigure stations -- if we're getting there in the | ||
91 | * normal down flow then the stations will already be cleared. | ||
92 | */ | ||
93 | static inline void iwl_clear_driver_stations(struct iwl_priv *priv) | ||
94 | { | ||
95 | unsigned long flags; | ||
96 | |||
97 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
98 | memset(priv->stations, 0, sizeof(priv->stations)); | ||
99 | priv->num_stations = 0; | ||
100 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
101 | } | ||
102 | |||
103 | static inline int iwl_sta_id(struct ieee80211_sta *sta) | ||
104 | { | ||
105 | if (WARN_ON(!sta)) | ||
106 | return IWL_INVALID_STATION; | ||
107 | |||
108 | return ((struct iwl_station_priv_common *)sta->drv_priv)->sta_id; | ||
109 | } | ||
82 | #endif /* __iwl_sta_h__ */ | 110 | #endif /* __iwl_sta_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index c7e1d7d09e02..935e64311d39 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -509,11 +509,11 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
509 | 509 | ||
510 | hdr_len = ieee80211_hdrlen(fc); | 510 | hdr_len = ieee80211_hdrlen(fc); |
511 | 511 | ||
512 | /* Find (or create) index into station table for destination station */ | 512 | /* Find index into station table for destination station */ |
513 | if (info->flags & IEEE80211_TX_CTL_INJECTED) | 513 | if (!info->control.sta) |
514 | sta_id = priv->hw_params.bcast_sta_id; | 514 | sta_id = priv->hw_params.bcast_sta_id; |
515 | else | 515 | else |
516 | sta_id = iwl_get_sta_id(priv, hdr); | 516 | sta_id = iwl_sta_id(info->control.sta); |
517 | if (sta_id == IWL_INVALID_STATION) { | 517 | if (sta_id == IWL_INVALID_STATION) { |
518 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", | 518 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", |
519 | hdr->addr1); | 519 | hdr->addr1); |
@@ -1848,7 +1848,8 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) | |||
1848 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, | 1848 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, |
1849 | enum ieee80211_band band, | 1849 | enum ieee80211_band band, |
1850 | u8 is_active, u8 n_probes, | 1850 | u8 is_active, u8 n_probes, |
1851 | struct iwl3945_scan_channel *scan_ch) | 1851 | struct iwl3945_scan_channel *scan_ch, |
1852 | struct ieee80211_vif *vif) | ||
1852 | { | 1853 | { |
1853 | struct ieee80211_channel *chan; | 1854 | struct ieee80211_channel *chan; |
1854 | const struct ieee80211_supported_band *sband; | 1855 | const struct ieee80211_supported_band *sband; |
@@ -1862,7 +1863,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, | |||
1862 | return 0; | 1863 | return 0; |
1863 | 1864 | ||
1864 | active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); | 1865 | active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); |
1865 | passive_dwell = iwl_get_passive_dwell_time(priv, band); | 1866 | passive_dwell = iwl_get_passive_dwell_time(priv, band, vif); |
1866 | 1867 | ||
1867 | if (passive_dwell <= active_dwell) | 1868 | if (passive_dwell <= active_dwell) |
1868 | passive_dwell = active_dwell + 1; | 1869 | passive_dwell = active_dwell + 1; |
@@ -2110,6 +2111,28 @@ static void iwl3945_nic_start(struct iwl_priv *priv) | |||
2110 | iwl_write32(priv, CSR_RESET, 0); | 2111 | iwl_write32(priv, CSR_RESET, 0); |
2111 | } | 2112 | } |
2112 | 2113 | ||
2114 | #define IWL3945_UCODE_GET(item) \ | ||
2115 | static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode)\ | ||
2116 | { \ | ||
2117 | return le32_to_cpu(ucode->u.v1.item); \ | ||
2118 | } | ||
2119 | |||
2120 | static u32 iwl3945_ucode_get_header_size(u32 api_ver) | ||
2121 | { | ||
2122 | return 24; | ||
2123 | } | ||
2124 | |||
2125 | static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode) | ||
2126 | { | ||
2127 | return (u8 *) ucode->u.v1.data; | ||
2128 | } | ||
2129 | |||
2130 | IWL3945_UCODE_GET(inst_size); | ||
2131 | IWL3945_UCODE_GET(data_size); | ||
2132 | IWL3945_UCODE_GET(init_size); | ||
2133 | IWL3945_UCODE_GET(init_data_size); | ||
2134 | IWL3945_UCODE_GET(boot_size); | ||
2135 | |||
2113 | /** | 2136 | /** |
2114 | * iwl3945_read_ucode - Read uCode images from disk file. | 2137 | * iwl3945_read_ucode - Read uCode images from disk file. |
2115 | * | 2138 | * |
@@ -2158,7 +2181,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) | |||
2158 | goto error; | 2181 | goto error; |
2159 | 2182 | ||
2160 | /* Make sure that we got at least our header! */ | 2183 | /* Make sure that we got at least our header! */ |
2161 | if (ucode_raw->size < priv->cfg->ops->ucode->get_header_size(1)) { | 2184 | if (ucode_raw->size < iwl3945_ucode_get_header_size(1)) { |
2162 | IWL_ERR(priv, "File size way too small!\n"); | 2185 | IWL_ERR(priv, "File size way too small!\n"); |
2163 | ret = -EINVAL; | 2186 | ret = -EINVAL; |
2164 | goto err_release; | 2187 | goto err_release; |
@@ -2169,13 +2192,12 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) | |||
2169 | 2192 | ||
2170 | priv->ucode_ver = le32_to_cpu(ucode->ver); | 2193 | priv->ucode_ver = le32_to_cpu(ucode->ver); |
2171 | api_ver = IWL_UCODE_API(priv->ucode_ver); | 2194 | api_ver = IWL_UCODE_API(priv->ucode_ver); |
2172 | inst_size = priv->cfg->ops->ucode->get_inst_size(ucode, api_ver); | 2195 | inst_size = iwl3945_ucode_get_inst_size(ucode); |
2173 | data_size = priv->cfg->ops->ucode->get_data_size(ucode, api_ver); | 2196 | data_size = iwl3945_ucode_get_data_size(ucode); |
2174 | init_size = priv->cfg->ops->ucode->get_init_size(ucode, api_ver); | 2197 | init_size = iwl3945_ucode_get_init_size(ucode); |
2175 | init_data_size = | 2198 | init_data_size = iwl3945_ucode_get_init_data_size(ucode); |
2176 | priv->cfg->ops->ucode->get_init_data_size(ucode, api_ver); | 2199 | boot_size = iwl3945_ucode_get_boot_size(ucode); |
2177 | boot_size = priv->cfg->ops->ucode->get_boot_size(ucode, api_ver); | 2200 | src = iwl3945_ucode_get_data(ucode); |
2178 | src = priv->cfg->ops->ucode->get_data(ucode, api_ver); | ||
2179 | 2201 | ||
2180 | /* api_ver should match the api version forming part of the | 2202 | /* api_ver should match the api version forming part of the |
2181 | * firmware filename ... but we don't check for that and only rely | 2203 | * firmware filename ... but we don't check for that and only rely |
@@ -2224,7 +2246,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) | |||
2224 | 2246 | ||
2225 | 2247 | ||
2226 | /* Verify size of file vs. image size info in file's header */ | 2248 | /* Verify size of file vs. image size info in file's header */ |
2227 | if (ucode_raw->size != priv->cfg->ops->ucode->get_header_size(api_ver) + | 2249 | if (ucode_raw->size != iwl3945_ucode_get_header_size(api_ver) + |
2228 | inst_size + data_size + init_size + | 2250 | inst_size + data_size + init_size + |
2229 | init_data_size + boot_size) { | 2251 | init_data_size + boot_size) { |
2230 | 2252 | ||
@@ -2523,7 +2545,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv) | |||
2523 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2545 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2524 | } else { | 2546 | } else { |
2525 | /* Initialize our rx_config data */ | 2547 | /* Initialize our rx_config data */ |
2526 | iwl_connection_init_rx_config(priv, priv->iw_mode); | 2548 | iwl_connection_init_rx_config(priv, NULL); |
2527 | } | 2549 | } |
2528 | 2550 | ||
2529 | /* Configure Bluetooth device coexistence support */ | 2551 | /* Configure Bluetooth device coexistence support */ |
@@ -2562,7 +2584,9 @@ static void __iwl3945_down(struct iwl_priv *priv) | |||
2562 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 2584 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
2563 | 2585 | ||
2564 | /* Station information will now be cleared in device */ | 2586 | /* Station information will now be cleared in device */ |
2565 | iwl_clear_ucode_stations(priv, true); | 2587 | iwl_clear_ucode_stations(priv); |
2588 | iwl_dealloc_bcast_station(priv); | ||
2589 | iwl_clear_driver_stations(priv); | ||
2566 | 2590 | ||
2567 | /* Unblock any waiting calls */ | 2591 | /* Unblock any waiting calls */ |
2568 | wake_up_interruptible_all(&priv->wait_command_queue); | 2592 | wake_up_interruptible_all(&priv->wait_command_queue); |
@@ -2643,6 +2667,10 @@ static int __iwl3945_up(struct iwl_priv *priv) | |||
2643 | { | 2667 | { |
2644 | int rc, i; | 2668 | int rc, i; |
2645 | 2669 | ||
2670 | rc = iwl_alloc_bcast_station(priv, false); | ||
2671 | if (rc) | ||
2672 | return rc; | ||
2673 | |||
2646 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { | 2674 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { |
2647 | IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); | 2675 | IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); |
2648 | return -EIO; | 2676 | return -EIO; |
@@ -2791,7 +2819,7 @@ static void iwl3945_rfkill_poll(struct work_struct *data) | |||
2791 | 2819 | ||
2792 | } | 2820 | } |
2793 | 2821 | ||
2794 | void iwl3945_request_scan(struct iwl_priv *priv) | 2822 | void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) |
2795 | { | 2823 | { |
2796 | struct iwl_host_cmd cmd = { | 2824 | struct iwl_host_cmd cmd = { |
2797 | .id = REPLY_SCAN_CMD, | 2825 | .id = REPLY_SCAN_CMD, |
@@ -2872,7 +2900,7 @@ void iwl3945_request_scan(struct iwl_priv *priv) | |||
2872 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); | 2900 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); |
2873 | 2901 | ||
2874 | spin_lock_irqsave(&priv->lock, flags); | 2902 | spin_lock_irqsave(&priv->lock, flags); |
2875 | interval = priv->beacon_int; | 2903 | interval = vif ? vif->bss_conf.beacon_int : 0; |
2876 | spin_unlock_irqrestore(&priv->lock, flags); | 2904 | spin_unlock_irqrestore(&priv->lock, flags); |
2877 | 2905 | ||
2878 | scan->suspend_time = 0; | 2906 | scan->suspend_time = 0; |
@@ -2967,7 +2995,7 @@ void iwl3945_request_scan(struct iwl_priv *priv) | |||
2967 | 2995 | ||
2968 | scan->channel_count = | 2996 | scan->channel_count = |
2969 | iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, | 2997 | iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, |
2970 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | 2998 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)], vif); |
2971 | 2999 | ||
2972 | if (scan->channel_count == 0) { | 3000 | if (scan->channel_count == 0) { |
2973 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); | 3001 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); |
@@ -3040,26 +3068,25 @@ static void iwl3945_bg_rx_replenish(struct work_struct *data) | |||
3040 | mutex_unlock(&priv->mutex); | 3068 | mutex_unlock(&priv->mutex); |
3041 | } | 3069 | } |
3042 | 3070 | ||
3043 | void iwl3945_post_associate(struct iwl_priv *priv) | 3071 | void iwl3945_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) |
3044 | { | 3072 | { |
3045 | int rc = 0; | 3073 | int rc = 0; |
3046 | struct ieee80211_conf *conf = NULL; | 3074 | struct ieee80211_conf *conf = NULL; |
3047 | 3075 | ||
3048 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | 3076 | if (!vif || !priv->is_open) |
3077 | return; | ||
3078 | |||
3079 | if (vif->type == NL80211_IFTYPE_AP) { | ||
3049 | IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__); | 3080 | IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__); |
3050 | return; | 3081 | return; |
3051 | } | 3082 | } |
3052 | 3083 | ||
3053 | |||
3054 | IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", | 3084 | IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", |
3055 | priv->assoc_id, priv->active_rxon.bssid_addr); | 3085 | vif->bss_conf.aid, priv->active_rxon.bssid_addr); |
3056 | 3086 | ||
3057 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 3087 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
3058 | return; | 3088 | return; |
3059 | 3089 | ||
3060 | if (!priv->vif || !priv->is_open) | ||
3061 | return; | ||
3062 | |||
3063 | iwl_scan_cancel_timeout(priv, 200); | 3090 | iwl_scan_cancel_timeout(priv, 200); |
3064 | 3091 | ||
3065 | conf = ieee80211_get_hw_conf(priv->hw); | 3092 | conf = ieee80211_get_hw_conf(priv->hw); |
@@ -3068,7 +3095,7 @@ void iwl3945_post_associate(struct iwl_priv *priv) | |||
3068 | iwlcore_commit_rxon(priv); | 3095 | iwlcore_commit_rxon(priv); |
3069 | 3096 | ||
3070 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); | 3097 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); |
3071 | iwl_setup_rxon_timing(priv); | 3098 | iwl_setup_rxon_timing(priv, vif); |
3072 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 3099 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
3073 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 3100 | sizeof(priv->rxon_timing), &priv->rxon_timing); |
3074 | if (rc) | 3101 | if (rc) |
@@ -3077,51 +3104,38 @@ void iwl3945_post_associate(struct iwl_priv *priv) | |||
3077 | 3104 | ||
3078 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 3105 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; |
3079 | 3106 | ||
3080 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); | 3107 | priv->staging_rxon.assoc_id = cpu_to_le16(vif->bss_conf.aid); |
3081 | 3108 | ||
3082 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", | 3109 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", |
3083 | priv->assoc_id, priv->beacon_int); | 3110 | vif->bss_conf.aid, vif->bss_conf.beacon_int); |
3084 | 3111 | ||
3085 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) | 3112 | if (vif->bss_conf.assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) |
3086 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 3113 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
3087 | else | 3114 | else |
3088 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; | 3115 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; |
3089 | 3116 | ||
3090 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { | 3117 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { |
3091 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) | 3118 | if (vif->bss_conf.assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) |
3092 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 3119 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; |
3093 | else | 3120 | else |
3094 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 3121 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
3095 | 3122 | ||
3096 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) | 3123 | if (vif->type == NL80211_IFTYPE_ADHOC) |
3097 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 3124 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
3098 | |||
3099 | } | 3125 | } |
3100 | 3126 | ||
3101 | iwlcore_commit_rxon(priv); | 3127 | iwlcore_commit_rxon(priv); |
3102 | 3128 | ||
3103 | switch (priv->iw_mode) { | 3129 | switch (vif->type) { |
3104 | case NL80211_IFTYPE_STATION: | 3130 | case NL80211_IFTYPE_STATION: |
3105 | iwl3945_rate_scale_init(priv->hw, IWL_AP_ID); | 3131 | iwl3945_rate_scale_init(priv->hw, IWL_AP_ID); |
3106 | break; | 3132 | break; |
3107 | |||
3108 | case NL80211_IFTYPE_ADHOC: | 3133 | case NL80211_IFTYPE_ADHOC: |
3109 | |||
3110 | priv->assoc_id = 1; | ||
3111 | iwl_add_local_station(priv, priv->bssid, false); | ||
3112 | iwl3945_sync_sta(priv, IWL_STA_ID, | ||
3113 | (priv->band == IEEE80211_BAND_5GHZ) ? | ||
3114 | IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP, | ||
3115 | CMD_ASYNC); | ||
3116 | iwl3945_rate_scale_init(priv->hw, IWL_STA_ID); | ||
3117 | |||
3118 | iwl3945_send_beacon_cmd(priv); | 3134 | iwl3945_send_beacon_cmd(priv); |
3119 | |||
3120 | break; | 3135 | break; |
3121 | |||
3122 | default: | 3136 | default: |
3123 | IWL_ERR(priv, "%s Should not be called in %d mode\n", | 3137 | IWL_ERR(priv, "%s Should not be called in %d mode\n", |
3124 | __func__, priv->iw_mode); | 3138 | __func__, vif->type); |
3125 | break; | 3139 | break; |
3126 | } | 3140 | } |
3127 | } | 3141 | } |
@@ -3245,7 +3259,7 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
3245 | return NETDEV_TX_OK; | 3259 | return NETDEV_TX_OK; |
3246 | } | 3260 | } |
3247 | 3261 | ||
3248 | void iwl3945_config_ap(struct iwl_priv *priv) | 3262 | void iwl3945_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) |
3249 | { | 3263 | { |
3250 | int rc = 0; | 3264 | int rc = 0; |
3251 | 3265 | ||
@@ -3261,7 +3275,7 @@ void iwl3945_config_ap(struct iwl_priv *priv) | |||
3261 | 3275 | ||
3262 | /* RXON Timing */ | 3276 | /* RXON Timing */ |
3263 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); | 3277 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); |
3264 | iwl_setup_rxon_timing(priv); | 3278 | iwl_setup_rxon_timing(priv, vif); |
3265 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 3279 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
3266 | sizeof(priv->rxon_timing), | 3280 | sizeof(priv->rxon_timing), |
3267 | &priv->rxon_timing); | 3281 | &priv->rxon_timing); |
@@ -3269,9 +3283,10 @@ void iwl3945_config_ap(struct iwl_priv *priv) | |||
3269 | IWL_WARN(priv, "REPLY_RXON_TIMING failed - " | 3283 | IWL_WARN(priv, "REPLY_RXON_TIMING failed - " |
3270 | "Attempting to continue.\n"); | 3284 | "Attempting to continue.\n"); |
3271 | 3285 | ||
3272 | /* FIXME: what should be the assoc_id for AP? */ | 3286 | priv->staging_rxon.assoc_id = 0; |
3273 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); | 3287 | |
3274 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) | 3288 | if (vif->bss_conf.assoc_capability & |
3289 | WLAN_CAPABILITY_SHORT_PREAMBLE) | ||
3275 | priv->staging_rxon.flags |= | 3290 | priv->staging_rxon.flags |= |
3276 | RXON_FLG_SHORT_PREAMBLE_MSK; | 3291 | RXON_FLG_SHORT_PREAMBLE_MSK; |
3277 | else | 3292 | else |
@@ -3279,22 +3294,21 @@ void iwl3945_config_ap(struct iwl_priv *priv) | |||
3279 | ~RXON_FLG_SHORT_PREAMBLE_MSK; | 3294 | ~RXON_FLG_SHORT_PREAMBLE_MSK; |
3280 | 3295 | ||
3281 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { | 3296 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { |
3282 | if (priv->assoc_capability & | 3297 | if (vif->bss_conf.assoc_capability & |
3283 | WLAN_CAPABILITY_SHORT_SLOT_TIME) | 3298 | WLAN_CAPABILITY_SHORT_SLOT_TIME) |
3284 | priv->staging_rxon.flags |= | 3299 | priv->staging_rxon.flags |= |
3285 | RXON_FLG_SHORT_SLOT_MSK; | 3300 | RXON_FLG_SHORT_SLOT_MSK; |
3286 | else | 3301 | else |
3287 | priv->staging_rxon.flags &= | 3302 | priv->staging_rxon.flags &= |
3288 | ~RXON_FLG_SHORT_SLOT_MSK; | 3303 | ~RXON_FLG_SHORT_SLOT_MSK; |
3289 | 3304 | ||
3290 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) | 3305 | if (vif->type == NL80211_IFTYPE_ADHOC) |
3291 | priv->staging_rxon.flags &= | 3306 | priv->staging_rxon.flags &= |
3292 | ~RXON_FLG_SHORT_SLOT_MSK; | 3307 | ~RXON_FLG_SHORT_SLOT_MSK; |
3293 | } | 3308 | } |
3294 | /* restore RXON assoc */ | 3309 | /* restore RXON assoc */ |
3295 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 3310 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; |
3296 | iwlcore_commit_rxon(priv); | 3311 | iwlcore_commit_rxon(priv); |
3297 | iwl_add_local_station(priv, iwl_bcast_addr, false); | ||
3298 | } | 3312 | } |
3299 | iwl3945_send_beacon_cmd(priv); | 3313 | iwl3945_send_beacon_cmd(priv); |
3300 | 3314 | ||
@@ -3309,7 +3323,6 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3309 | struct ieee80211_key_conf *key) | 3323 | struct ieee80211_key_conf *key) |
3310 | { | 3324 | { |
3311 | struct iwl_priv *priv = hw->priv; | 3325 | struct iwl_priv *priv = hw->priv; |
3312 | const u8 *addr; | ||
3313 | int ret = 0; | 3326 | int ret = 0; |
3314 | u8 sta_id = IWL_INVALID_STATION; | 3327 | u8 sta_id = IWL_INVALID_STATION; |
3315 | u8 static_key; | 3328 | u8 static_key; |
@@ -3321,15 +3334,19 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3321 | return -EOPNOTSUPP; | 3334 | return -EOPNOTSUPP; |
3322 | } | 3335 | } |
3323 | 3336 | ||
3324 | addr = sta ? sta->addr : iwl_bcast_addr; | ||
3325 | static_key = !iwl_is_associated(priv); | 3337 | static_key = !iwl_is_associated(priv); |
3326 | 3338 | ||
3327 | if (!static_key) { | 3339 | if (!static_key) { |
3328 | sta_id = iwl_find_station(priv, addr); | 3340 | if (!sta) { |
3329 | if (sta_id == IWL_INVALID_STATION) { | 3341 | sta_id = priv->hw_params.bcast_sta_id; |
3330 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", | 3342 | } else { |
3331 | addr); | 3343 | sta_id = iwl_sta_id(sta); |
3332 | return -EINVAL; | 3344 | if (sta_id == IWL_INVALID_STATION) { |
3345 | IWL_DEBUG_MAC80211(priv, | ||
3346 | "leave - %pM not in station map.\n", | ||
3347 | sta->addr); | ||
3348 | return -EINVAL; | ||
3349 | } | ||
3333 | } | 3350 | } |
3334 | } | 3351 | } |
3335 | 3352 | ||
@@ -3366,10 +3383,13 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, | |||
3366 | struct ieee80211_sta *sta) | 3383 | struct ieee80211_sta *sta) |
3367 | { | 3384 | { |
3368 | struct iwl_priv *priv = hw->priv; | 3385 | struct iwl_priv *priv = hw->priv; |
3386 | struct iwl3945_sta_priv *sta_priv = (void *)sta->drv_priv; | ||
3369 | int ret; | 3387 | int ret; |
3370 | bool is_ap = priv->iw_mode == NL80211_IFTYPE_STATION; | 3388 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; |
3371 | u8 sta_id; | 3389 | u8 sta_id; |
3372 | 3390 | ||
3391 | sta_priv->common.sta_id = IWL_INVALID_STATION; | ||
3392 | |||
3373 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", | 3393 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", |
3374 | sta->addr); | 3394 | sta->addr); |
3375 | 3395 | ||
@@ -3382,16 +3402,14 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, | |||
3382 | return ret; | 3402 | return ret; |
3383 | } | 3403 | } |
3384 | 3404 | ||
3405 | sta_priv->common.sta_id = sta_id; | ||
3406 | |||
3385 | /* Initialize rate scaling */ | 3407 | /* Initialize rate scaling */ |
3386 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", | 3408 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", |
3387 | sta->addr); | 3409 | sta->addr); |
3388 | iwl3945_rs_rate_init(priv, sta, sta_id); | 3410 | iwl3945_rs_rate_init(priv, sta, sta_id); |
3389 | 3411 | ||
3390 | return 0; | 3412 | return 0; |
3391 | |||
3392 | |||
3393 | |||
3394 | return ret; | ||
3395 | } | 3413 | } |
3396 | /***************************************************************************** | 3414 | /***************************************************************************** |
3397 | * | 3415 | * |
@@ -3740,6 +3758,7 @@ static void iwl3945_setup_deferred_work(struct iwl_priv *priv) | |||
3740 | INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll); | 3758 | INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll); |
3741 | INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); | 3759 | INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); |
3742 | INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); | 3760 | INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); |
3761 | INIT_WORK(&priv->start_internal_scan, iwl_bg_start_internal_scan); | ||
3743 | INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); | 3762 | INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); |
3744 | 3763 | ||
3745 | iwl3945_hw_setup_deferred_work(priv); | 3764 | iwl3945_hw_setup_deferred_work(priv); |
@@ -3762,6 +3781,7 @@ static void iwl3945_cancel_deferred_work(struct iwl_priv *priv) | |||
3762 | cancel_delayed_work_sync(&priv->init_alive_start); | 3781 | cancel_delayed_work_sync(&priv->init_alive_start); |
3763 | cancel_delayed_work(&priv->scan_check); | 3782 | cancel_delayed_work(&priv->scan_check); |
3764 | cancel_delayed_work(&priv->alive_start); | 3783 | cancel_delayed_work(&priv->alive_start); |
3784 | cancel_work_sync(&priv->start_internal_scan); | ||
3765 | cancel_work_sync(&priv->beacon_update); | 3785 | cancel_work_sync(&priv->beacon_update); |
3766 | if (priv->cfg->ops->lib->recover_from_tx_stall) | 3786 | if (priv->cfg->ops->lib->recover_from_tx_stall) |
3767 | del_timer_sync(&priv->monitor_recover); | 3787 | del_timer_sync(&priv->monitor_recover); |
@@ -3864,6 +3884,8 @@ err: | |||
3864 | return ret; | 3884 | return ret; |
3865 | } | 3885 | } |
3866 | 3886 | ||
3887 | #define IWL3945_MAX_PROBE_REQUEST 200 | ||
3888 | |||
3867 | static int iwl3945_setup_mac(struct iwl_priv *priv) | 3889 | static int iwl3945_setup_mac(struct iwl_priv *priv) |
3868 | { | 3890 | { |
3869 | int ret; | 3891 | int ret; |
@@ -3871,6 +3893,7 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) | |||
3871 | 3893 | ||
3872 | hw->rate_control_algorithm = "iwl-3945-rs"; | 3894 | hw->rate_control_algorithm = "iwl-3945-rs"; |
3873 | hw->sta_data_size = sizeof(struct iwl3945_sta_priv); | 3895 | hw->sta_data_size = sizeof(struct iwl3945_sta_priv); |
3896 | hw->vif_data_size = sizeof(struct iwl_vif_priv); | ||
3874 | 3897 | ||
3875 | /* Tell mac80211 our characteristics */ | 3898 | /* Tell mac80211 our characteristics */ |
3876 | hw->flags = IEEE80211_HW_SIGNAL_DBM | | 3899 | hw->flags = IEEE80211_HW_SIGNAL_DBM | |
@@ -3889,7 +3912,7 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) | |||
3889 | 3912 | ||
3890 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX_3945; | 3913 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX_3945; |
3891 | /* we create the 802.11 header and a zero-length SSID element */ | 3914 | /* we create the 802.11 header and a zero-length SSID element */ |
3892 | hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; | 3915 | hw->wiphy->max_scan_ie_len = IWL3945_MAX_PROBE_REQUEST - 24 - 2; |
3893 | 3916 | ||
3894 | /* Default value; 4 EDCA QOS priorities */ | 3917 | /* Default value; 4 EDCA QOS priorities */ |
3895 | hw->queues = 4; | 3918 | hw->queues = 4; |
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 6126c0ab5880..4ba7b038928f 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -1007,15 +1007,15 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1007 | { | 1007 | { |
1008 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1008 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
1009 | struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; | 1009 | struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; |
1010 | __le32 *txd = skbdesc->desc; | 1010 | __le32 *txd = entry_priv->desc; |
1011 | u32 word; | 1011 | u32 word; |
1012 | 1012 | ||
1013 | /* | 1013 | /* |
1014 | * Start writing the descriptor words. | 1014 | * Start writing the descriptor words. |
1015 | */ | 1015 | */ |
1016 | rt2x00_desc_read(entry_priv->desc, 1, &word); | 1016 | rt2x00_desc_read(txd, 1, &word); |
1017 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); | 1017 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); |
1018 | rt2x00_desc_write(entry_priv->desc, 1, word); | 1018 | rt2x00_desc_write(txd, 1, word); |
1019 | 1019 | ||
1020 | rt2x00_desc_read(txd, 2, &word); | 1020 | rt2x00_desc_read(txd, 2, &word); |
1021 | rt2x00_set_field32(&word, TXD_W2_BUFFER_LENGTH, txdesc->length); | 1021 | rt2x00_set_field32(&word, TXD_W2_BUFFER_LENGTH, txdesc->length); |
@@ -1040,6 +1040,11 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1040 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_HIGH_BUSY, 1); | 1040 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_HIGH_BUSY, 1); |
1041 | rt2x00_desc_write(txd, 4, word); | 1041 | rt2x00_desc_write(txd, 4, word); |
1042 | 1042 | ||
1043 | /* | ||
1044 | * Writing TXD word 0 must the last to prevent a race condition with | ||
1045 | * the device, whereby the device may take hold of the TXD before we | ||
1046 | * finished updating it. | ||
1047 | */ | ||
1043 | rt2x00_desc_read(txd, 0, &word); | 1048 | rt2x00_desc_read(txd, 0, &word); |
1044 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 1); | 1049 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 1); |
1045 | rt2x00_set_field32(&word, TXD_W0_VALID, 1); | 1050 | rt2x00_set_field32(&word, TXD_W0_VALID, 1); |
@@ -1055,6 +1060,12 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1055 | rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, | 1060 | rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, |
1056 | test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags)); | 1061 | test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags)); |
1057 | rt2x00_desc_write(txd, 0, word); | 1062 | rt2x00_desc_write(txd, 0, word); |
1063 | |||
1064 | /* | ||
1065 | * Register descriptor details in skb frame descriptor. | ||
1066 | */ | ||
1067 | skbdesc->desc = txd; | ||
1068 | skbdesc->desc_len = TXD_DESC_SIZE; | ||
1058 | } | 1069 | } |
1059 | 1070 | ||
1060 | /* | 1071 | /* |
@@ -1077,15 +1088,6 @@ static void rt2400pci_write_beacon(struct queue_entry *entry, | |||
1077 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); | 1088 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); |
1078 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | 1089 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); |
1079 | 1090 | ||
1080 | /* | ||
1081 | * Replace rt2x00lib allocated descriptor with the | ||
1082 | * pointer to the _real_ hardware descriptor. | ||
1083 | * After that, map the beacon to DMA and update the | ||
1084 | * descriptor. | ||
1085 | */ | ||
1086 | memcpy(entry_priv->desc, skbdesc->desc, skbdesc->desc_len); | ||
1087 | skbdesc->desc = entry_priv->desc; | ||
1088 | |||
1089 | rt2x00queue_map_txskb(rt2x00dev, entry->skb); | 1091 | rt2x00queue_map_txskb(rt2x00dev, entry->skb); |
1090 | 1092 | ||
1091 | rt2x00_desc_read(entry_priv->desc, 1, &word); | 1093 | rt2x00_desc_read(entry_priv->desc, 1, &word); |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 2e4f461406ae..89d132d4af12 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1165,15 +1165,15 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1165 | { | 1165 | { |
1166 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1166 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
1167 | struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; | 1167 | struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; |
1168 | __le32 *txd = skbdesc->desc; | 1168 | __le32 *txd = entry_priv->desc; |
1169 | u32 word; | 1169 | u32 word; |
1170 | 1170 | ||
1171 | /* | 1171 | /* |
1172 | * Start writing the descriptor words. | 1172 | * Start writing the descriptor words. |
1173 | */ | 1173 | */ |
1174 | rt2x00_desc_read(entry_priv->desc, 1, &word); | 1174 | rt2x00_desc_read(txd, 1, &word); |
1175 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); | 1175 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); |
1176 | rt2x00_desc_write(entry_priv->desc, 1, word); | 1176 | rt2x00_desc_write(txd, 1, word); |
1177 | 1177 | ||
1178 | rt2x00_desc_read(txd, 2, &word); | 1178 | rt2x00_desc_read(txd, 2, &word); |
1179 | rt2x00_set_field32(&word, TXD_W2_IV_OFFSET, IEEE80211_HEADER); | 1179 | rt2x00_set_field32(&word, TXD_W2_IV_OFFSET, IEEE80211_HEADER); |
@@ -1194,6 +1194,11 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1194 | test_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags)); | 1194 | test_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags)); |
1195 | rt2x00_desc_write(txd, 10, word); | 1195 | rt2x00_desc_write(txd, 10, word); |
1196 | 1196 | ||
1197 | /* | ||
1198 | * Writing TXD word 0 must the last to prevent a race condition with | ||
1199 | * the device, whereby the device may take hold of the TXD before we | ||
1200 | * finished updating it. | ||
1201 | */ | ||
1197 | rt2x00_desc_read(txd, 0, &word); | 1202 | rt2x00_desc_read(txd, 0, &word); |
1198 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 1); | 1203 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 1); |
1199 | rt2x00_set_field32(&word, TXD_W0_VALID, 1); | 1204 | rt2x00_set_field32(&word, TXD_W0_VALID, 1); |
@@ -1212,6 +1217,12 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1212 | rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, txdesc->length); | 1217 | rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, txdesc->length); |
1213 | rt2x00_set_field32(&word, TXD_W0_CIPHER_ALG, CIPHER_NONE); | 1218 | rt2x00_set_field32(&word, TXD_W0_CIPHER_ALG, CIPHER_NONE); |
1214 | rt2x00_desc_write(txd, 0, word); | 1219 | rt2x00_desc_write(txd, 0, word); |
1220 | |||
1221 | /* | ||
1222 | * Register descriptor details in skb frame descriptor. | ||
1223 | */ | ||
1224 | skbdesc->desc = txd; | ||
1225 | skbdesc->desc_len = TXD_DESC_SIZE; | ||
1215 | } | 1226 | } |
1216 | 1227 | ||
1217 | /* | 1228 | /* |
@@ -1234,15 +1245,6 @@ static void rt2500pci_write_beacon(struct queue_entry *entry, | |||
1234 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); | 1245 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); |
1235 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | 1246 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); |
1236 | 1247 | ||
1237 | /* | ||
1238 | * Replace rt2x00lib allocated descriptor with the | ||
1239 | * pointer to the _real_ hardware descriptor. | ||
1240 | * After that, map the beacon to DMA and update the | ||
1241 | * descriptor. | ||
1242 | */ | ||
1243 | memcpy(entry_priv->desc, skbdesc->desc, skbdesc->desc_len); | ||
1244 | skbdesc->desc = entry_priv->desc; | ||
1245 | |||
1246 | rt2x00queue_map_txskb(rt2x00dev, entry->skb); | 1248 | rt2x00queue_map_txskb(rt2x00dev, entry->skb); |
1247 | 1249 | ||
1248 | rt2x00_desc_read(entry_priv->desc, 1, &word); | 1250 | rt2x00_desc_read(entry_priv->desc, 1, &word); |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index e88d7033fbc9..9ae96a626e6d 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1034,12 +1034,30 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1034 | struct txentry_desc *txdesc) | 1034 | struct txentry_desc *txdesc) |
1035 | { | 1035 | { |
1036 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1036 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
1037 | __le32 *txd = skbdesc->desc; | 1037 | __le32 *txd = (__le32 *)(skb->data - TXD_DESC_SIZE); |
1038 | u32 word; | 1038 | u32 word; |
1039 | 1039 | ||
1040 | /* | 1040 | /* |
1041 | * Start writing the descriptor words. | 1041 | * Start writing the descriptor words. |
1042 | */ | 1042 | */ |
1043 | rt2x00_desc_read(txd, 0, &word); | ||
1044 | rt2x00_set_field32(&word, TXD_W0_RETRY_LIMIT, txdesc->retry_limit); | ||
1045 | rt2x00_set_field32(&word, TXD_W0_MORE_FRAG, | ||
1046 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | ||
1047 | rt2x00_set_field32(&word, TXD_W0_ACK, | ||
1048 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
1049 | rt2x00_set_field32(&word, TXD_W0_TIMESTAMP, | ||
1050 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
1051 | rt2x00_set_field32(&word, TXD_W0_OFDM, | ||
1052 | (txdesc->rate_mode == RATE_MODE_OFDM)); | ||
1053 | rt2x00_set_field32(&word, TXD_W0_NEW_SEQ, | ||
1054 | test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)); | ||
1055 | rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); | ||
1056 | rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, txdesc->length); | ||
1057 | rt2x00_set_field32(&word, TXD_W0_CIPHER, !!txdesc->cipher); | ||
1058 | rt2x00_set_field32(&word, TXD_W0_KEY_ID, txdesc->key_idx); | ||
1059 | rt2x00_desc_write(txd, 0, word); | ||
1060 | |||
1043 | rt2x00_desc_read(txd, 1, &word); | 1061 | rt2x00_desc_read(txd, 1, &word); |
1044 | rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, txdesc->iv_offset); | 1062 | rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, txdesc->iv_offset); |
1045 | rt2x00_set_field32(&word, TXD_W1_AIFS, txdesc->aifs); | 1063 | rt2x00_set_field32(&word, TXD_W1_AIFS, txdesc->aifs); |
@@ -1059,23 +1077,11 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1059 | _rt2x00_desc_write(txd, 4, skbdesc->iv[1]); | 1077 | _rt2x00_desc_write(txd, 4, skbdesc->iv[1]); |
1060 | } | 1078 | } |
1061 | 1079 | ||
1062 | rt2x00_desc_read(txd, 0, &word); | 1080 | /* |
1063 | rt2x00_set_field32(&word, TXD_W0_RETRY_LIMIT, txdesc->retry_limit); | 1081 | * Register descriptor details in skb frame descriptor. |
1064 | rt2x00_set_field32(&word, TXD_W0_MORE_FRAG, | 1082 | */ |
1065 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | 1083 | skbdesc->desc = txd; |
1066 | rt2x00_set_field32(&word, TXD_W0_ACK, | 1084 | skbdesc->desc_len = TXD_DESC_SIZE; |
1067 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
1068 | rt2x00_set_field32(&word, TXD_W0_TIMESTAMP, | ||
1069 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
1070 | rt2x00_set_field32(&word, TXD_W0_OFDM, | ||
1071 | (txdesc->rate_mode == RATE_MODE_OFDM)); | ||
1072 | rt2x00_set_field32(&word, TXD_W0_NEW_SEQ, | ||
1073 | test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)); | ||
1074 | rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); | ||
1075 | rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, txdesc->length); | ||
1076 | rt2x00_set_field32(&word, TXD_W0_CIPHER, !!txdesc->cipher); | ||
1077 | rt2x00_set_field32(&word, TXD_W0_KEY_ID, txdesc->key_idx); | ||
1078 | rt2x00_desc_write(txd, 0, word); | ||
1079 | } | 1085 | } |
1080 | 1086 | ||
1081 | /* | 1087 | /* |
@@ -1089,19 +1095,11 @@ static void rt2500usb_write_beacon(struct queue_entry *entry, | |||
1089 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1095 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1090 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); | 1096 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); |
1091 | struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data; | 1097 | struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data; |
1092 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | ||
1093 | int pipe = usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint); | 1098 | int pipe = usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint); |
1094 | int length; | 1099 | int length; |
1095 | u16 reg, reg0; | 1100 | u16 reg, reg0; |
1096 | 1101 | ||
1097 | /* | 1102 | /* |
1098 | * Add the descriptor in front of the skb. | ||
1099 | */ | ||
1100 | skb_push(entry->skb, entry->queue->desc_size); | ||
1101 | memcpy(entry->skb->data, skbdesc->desc, skbdesc->desc_len); | ||
1102 | skbdesc->desc = entry->skb->data; | ||
1103 | |||
1104 | /* | ||
1105 | * Disable beaconing while we are reloading the beacon data, | 1103 | * Disable beaconing while we are reloading the beacon data, |
1106 | * otherwise we might be sending out invalid data. | 1104 | * otherwise we might be sending out invalid data. |
1107 | */ | 1105 | */ |
@@ -1110,6 +1108,11 @@ static void rt2500usb_write_beacon(struct queue_entry *entry, | |||
1110 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | 1108 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); |
1111 | 1109 | ||
1112 | /* | 1110 | /* |
1111 | * Take the descriptor in front of the skb into account. | ||
1112 | */ | ||
1113 | skb_push(entry->skb, TXD_DESC_SIZE); | ||
1114 | |||
1115 | /* | ||
1113 | * USB devices cannot blindly pass the skb->len as the | 1116 | * USB devices cannot blindly pass the skb->len as the |
1114 | * length of the data to usb_fill_bulk_urb. Pass the skb | 1117 | * length of the data to usb_fill_bulk_urb. Pass the skb |
1115 | * to the driver to determine what the length should be. | 1118 | * to the driver to determine what the length should be. |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 7d4778d66e77..b2f23272c3aa 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -633,7 +633,8 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
633 | struct txentry_desc *txdesc) | 633 | struct txentry_desc *txdesc) |
634 | { | 634 | { |
635 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 635 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
636 | __le32 *txd = skbdesc->desc; | 636 | struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; |
637 | __le32 *txd = entry_priv->desc; | ||
637 | u32 word; | 638 | u32 word; |
638 | 639 | ||
639 | /* | 640 | /* |
@@ -657,15 +658,14 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
657 | !test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | 658 | !test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); |
658 | rt2x00_set_field32(&word, TXD_W1_BURST, | 659 | rt2x00_set_field32(&word, TXD_W1_BURST, |
659 | test_bit(ENTRY_TXD_BURST, &txdesc->flags)); | 660 | test_bit(ENTRY_TXD_BURST, &txdesc->flags)); |
660 | rt2x00_set_field32(&word, TXD_W1_SD_LEN0, | 661 | rt2x00_set_field32(&word, TXD_W1_SD_LEN0, TXWI_DESC_SIZE); |
661 | rt2x00dev->ops->extra_tx_headroom); | ||
662 | rt2x00_set_field32(&word, TXD_W1_LAST_SEC0, 0); | 662 | rt2x00_set_field32(&word, TXD_W1_LAST_SEC0, 0); |
663 | rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 0); | 663 | rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 0); |
664 | rt2x00_desc_write(txd, 1, word); | 664 | rt2x00_desc_write(txd, 1, word); |
665 | 665 | ||
666 | rt2x00_desc_read(txd, 2, &word); | 666 | rt2x00_desc_read(txd, 2, &word); |
667 | rt2x00_set_field32(&word, TXD_W2_SD_PTR1, | 667 | rt2x00_set_field32(&word, TXD_W2_SD_PTR1, |
668 | skbdesc->skb_dma + rt2x00dev->ops->extra_tx_headroom); | 668 | skbdesc->skb_dma + TXWI_DESC_SIZE); |
669 | rt2x00_desc_write(txd, 2, word); | 669 | rt2x00_desc_write(txd, 2, word); |
670 | 670 | ||
671 | rt2x00_desc_read(txd, 3, &word); | 671 | rt2x00_desc_read(txd, 3, &word); |
@@ -673,6 +673,12 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
673 | !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); | 673 | !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); |
674 | rt2x00_set_field32(&word, TXD_W3_QSEL, 2); | 674 | rt2x00_set_field32(&word, TXD_W3_QSEL, 2); |
675 | rt2x00_desc_write(txd, 3, word); | 675 | rt2x00_desc_write(txd, 3, word); |
676 | |||
677 | /* | ||
678 | * Register descriptor details in skb frame descriptor. | ||
679 | */ | ||
680 | skbdesc->desc = txd; | ||
681 | skbdesc->desc_len = TXD_DESC_SIZE; | ||
676 | } | 682 | } |
677 | 683 | ||
678 | /* | 684 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 8ad0669a1b99..0f8b84b7224c 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -400,7 +400,7 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
400 | struct txentry_desc *txdesc) | 400 | struct txentry_desc *txdesc) |
401 | { | 401 | { |
402 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 402 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
403 | __le32 *txi = skbdesc->desc; | 403 | __le32 *txi = (__le32 *)(skb->data - TXWI_DESC_SIZE - TXINFO_DESC_SIZE); |
404 | u32 word; | 404 | u32 word; |
405 | 405 | ||
406 | /* | 406 | /* |
@@ -422,6 +422,12 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
422 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_BURST, | 422 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_BURST, |
423 | test_bit(ENTRY_TXD_BURST, &txdesc->flags)); | 423 | test_bit(ENTRY_TXD_BURST, &txdesc->flags)); |
424 | rt2x00_desc_write(txi, 0, word); | 424 | rt2x00_desc_write(txi, 0, word); |
425 | |||
426 | /* | ||
427 | * Register descriptor details in skb frame descriptor. | ||
428 | */ | ||
429 | skbdesc->desc = txi; | ||
430 | skbdesc->desc_len = TXINFO_DESC_SIZE + TXWI_DESC_SIZE; | ||
425 | } | 431 | } |
426 | 432 | ||
427 | /* | 433 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c index 9569fb4e5bc5..47bbc09894b0 100644 --- a/drivers/net/wireless/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/rt2x00/rt2x00debug.c | |||
@@ -156,10 +156,11 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, | |||
156 | enum rt2x00_dump_type type, struct sk_buff *skb) | 156 | enum rt2x00_dump_type type, struct sk_buff *skb) |
157 | { | 157 | { |
158 | struct rt2x00debug_intf *intf = rt2x00dev->debugfs_intf; | 158 | struct rt2x00debug_intf *intf = rt2x00dev->debugfs_intf; |
159 | struct skb_frame_desc *desc = get_skb_frame_desc(skb); | 159 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
160 | struct sk_buff *skbcopy; | 160 | struct sk_buff *skbcopy; |
161 | struct rt2x00dump_hdr *dump_hdr; | 161 | struct rt2x00dump_hdr *dump_hdr; |
162 | struct timeval timestamp; | 162 | struct timeval timestamp; |
163 | u32 data_len; | ||
163 | 164 | ||
164 | do_gettimeofday(×tamp); | 165 | do_gettimeofday(×tamp); |
165 | 166 | ||
@@ -171,7 +172,11 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, | |||
171 | return; | 172 | return; |
172 | } | 173 | } |
173 | 174 | ||
174 | skbcopy = alloc_skb(sizeof(*dump_hdr) + desc->desc_len + skb->len, | 175 | data_len = skb->len; |
176 | if (skbdesc->flags & SKBDESC_DESC_IN_SKB) | ||
177 | data_len -= skbdesc->desc_len; | ||
178 | |||
179 | skbcopy = alloc_skb(sizeof(*dump_hdr) + skbdesc->desc_len + data_len, | ||
175 | GFP_ATOMIC); | 180 | GFP_ATOMIC); |
176 | if (!skbcopy) { | 181 | if (!skbcopy) { |
177 | DEBUG(rt2x00dev, "Failed to copy skb for dump.\n"); | 182 | DEBUG(rt2x00dev, "Failed to copy skb for dump.\n"); |
@@ -181,18 +186,20 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, | |||
181 | dump_hdr = (struct rt2x00dump_hdr *)skb_put(skbcopy, sizeof(*dump_hdr)); | 186 | dump_hdr = (struct rt2x00dump_hdr *)skb_put(skbcopy, sizeof(*dump_hdr)); |
182 | dump_hdr->version = cpu_to_le32(DUMP_HEADER_VERSION); | 187 | dump_hdr->version = cpu_to_le32(DUMP_HEADER_VERSION); |
183 | dump_hdr->header_length = cpu_to_le32(sizeof(*dump_hdr)); | 188 | dump_hdr->header_length = cpu_to_le32(sizeof(*dump_hdr)); |
184 | dump_hdr->desc_length = cpu_to_le32(desc->desc_len); | 189 | dump_hdr->desc_length = cpu_to_le32(skbdesc->desc_len); |
185 | dump_hdr->data_length = cpu_to_le32(skb->len); | 190 | dump_hdr->data_length = cpu_to_le32(data_len); |
186 | dump_hdr->chip_rt = cpu_to_le16(rt2x00dev->chip.rt); | 191 | dump_hdr->chip_rt = cpu_to_le16(rt2x00dev->chip.rt); |
187 | dump_hdr->chip_rf = cpu_to_le16(rt2x00dev->chip.rf); | 192 | dump_hdr->chip_rf = cpu_to_le16(rt2x00dev->chip.rf); |
188 | dump_hdr->chip_rev = cpu_to_le16(rt2x00dev->chip.rev); | 193 | dump_hdr->chip_rev = cpu_to_le16(rt2x00dev->chip.rev); |
189 | dump_hdr->type = cpu_to_le16(type); | 194 | dump_hdr->type = cpu_to_le16(type); |
190 | dump_hdr->queue_index = desc->entry->queue->qid; | 195 | dump_hdr->queue_index = skbdesc->entry->queue->qid; |
191 | dump_hdr->entry_index = desc->entry->entry_idx; | 196 | dump_hdr->entry_index = skbdesc->entry->entry_idx; |
192 | dump_hdr->timestamp_sec = cpu_to_le32(timestamp.tv_sec); | 197 | dump_hdr->timestamp_sec = cpu_to_le32(timestamp.tv_sec); |
193 | dump_hdr->timestamp_usec = cpu_to_le32(timestamp.tv_usec); | 198 | dump_hdr->timestamp_usec = cpu_to_le32(timestamp.tv_usec); |
194 | 199 | ||
195 | memcpy(skb_put(skbcopy, desc->desc_len), desc->desc, desc->desc_len); | 200 | if (!(skbdesc->flags & SKBDESC_DESC_IN_SKB)) |
201 | memcpy(skb_put(skbcopy, skbdesc->desc_len), skbdesc->desc, | ||
202 | skbdesc->desc_len); | ||
196 | memcpy(skb_put(skbcopy, skb->len), skb->data, skb->len); | 203 | memcpy(skb_put(skbcopy, skb->len), skb->data, skb->len); |
197 | 204 | ||
198 | skb_queue_tail(&intf->frame_dump_skbqueue, skbcopy); | 205 | skb_queue_tail(&intf->frame_dump_skbqueue, skbcopy); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dump.h b/drivers/net/wireless/rt2x00/rt2x00dump.h index 727019a748e7..ed303b423e41 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dump.h +++ b/drivers/net/wireless/rt2x00/rt2x00dump.h | |||
@@ -62,11 +62,14 @@ | |||
62 | * the tx event which has either succeeded or failed. A frame | 62 | * the tx event which has either succeeded or failed. A frame |
63 | * with this type should also have been reported with as a | 63 | * with this type should also have been reported with as a |
64 | * %DUMP_FRAME_TX frame. | 64 | * %DUMP_FRAME_TX frame. |
65 | * @DUMP_FRAME_BEACON: This beacon frame is queued for transmission to the | ||
66 | * hardware. | ||
65 | */ | 67 | */ |
66 | enum rt2x00_dump_type { | 68 | enum rt2x00_dump_type { |
67 | DUMP_FRAME_RXDONE = 1, | 69 | DUMP_FRAME_RXDONE = 1, |
68 | DUMP_FRAME_TX = 2, | 70 | DUMP_FRAME_TX = 2, |
69 | DUMP_FRAME_TXDONE = 3, | 71 | DUMP_FRAME_TXDONE = 3, |
72 | DUMP_FRAME_BEACON = 4, | ||
70 | }; | 73 | }; |
71 | 74 | ||
72 | /** | 75 | /** |
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index 4b941e9c794e..a016f7ccde29 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -67,8 +67,6 @@ int rt2x00pci_write_tx_data(struct queue_entry *entry, | |||
67 | struct txentry_desc *txdesc) | 67 | struct txentry_desc *txdesc) |
68 | { | 68 | { |
69 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 69 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
70 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | ||
71 | struct skb_frame_desc *skbdesc; | ||
72 | 70 | ||
73 | /* | 71 | /* |
74 | * This should not happen, we already checked the entry | 72 | * This should not happen, we already checked the entry |
@@ -83,13 +81,6 @@ int rt2x00pci_write_tx_data(struct queue_entry *entry, | |||
83 | return -EINVAL; | 81 | return -EINVAL; |
84 | } | 82 | } |
85 | 83 | ||
86 | /* | ||
87 | * Fill in skb descriptor | ||
88 | */ | ||
89 | skbdesc = get_skb_frame_desc(entry->skb); | ||
90 | skbdesc->desc = entry_priv->desc; | ||
91 | skbdesc->desc_len = entry->queue->desc_size; | ||
92 | |||
93 | return 0; | 84 | return 0; |
94 | } | 85 | } |
95 | EXPORT_SYMBOL_GPL(rt2x00pci_write_tx_data); | 86 | EXPORT_SYMBOL_GPL(rt2x00pci_write_tx_data); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 089a12c7b90f..20dbdd6fb904 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -421,6 +421,7 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry, | |||
421 | { | 421 | { |
422 | struct data_queue *queue = entry->queue; | 422 | struct data_queue *queue = entry->queue; |
423 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | 423 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; |
424 | enum rt2x00_dump_type dump_type; | ||
424 | 425 | ||
425 | rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, entry->skb, txdesc); | 426 | rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, entry->skb, txdesc); |
426 | 427 | ||
@@ -428,7 +429,9 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry, | |||
428 | * All processing on the frame has been completed, this means | 429 | * All processing on the frame has been completed, this means |
429 | * it is now ready to be dumped to userspace through debugfs. | 430 | * it is now ready to be dumped to userspace through debugfs. |
430 | */ | 431 | */ |
431 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TX, entry->skb); | 432 | dump_type = (txdesc->queue == QID_BEACON) ? |
433 | DUMP_FRAME_BEACON : DUMP_FRAME_TX; | ||
434 | rt2x00debug_dump_frame(rt2x00dev, dump_type, entry->skb); | ||
432 | } | 435 | } |
433 | 436 | ||
434 | static void rt2x00queue_kick_tx_queue(struct queue_entry *entry, | 437 | static void rt2x00queue_kick_tx_queue(struct queue_entry *entry, |
@@ -553,7 +556,6 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, | |||
553 | struct rt2x00_intf *intf = vif_to_intf(vif); | 556 | struct rt2x00_intf *intf = vif_to_intf(vif); |
554 | struct skb_frame_desc *skbdesc; | 557 | struct skb_frame_desc *skbdesc; |
555 | struct txentry_desc txdesc; | 558 | struct txentry_desc txdesc; |
556 | __le32 desc[16]; | ||
557 | 559 | ||
558 | if (unlikely(!intf->beacon)) | 560 | if (unlikely(!intf->beacon)) |
559 | return -ENOBUFS; | 561 | return -ENOBUFS; |
@@ -586,19 +588,10 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, | |||
586 | rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc); | 588 | rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc); |
587 | 589 | ||
588 | /* | 590 | /* |
589 | * For the descriptor we use a local array from where the | ||
590 | * driver can move it to the correct location required for | ||
591 | * the hardware. | ||
592 | */ | ||
593 | memset(desc, 0, sizeof(desc)); | ||
594 | |||
595 | /* | ||
596 | * Fill in skb descriptor | 591 | * Fill in skb descriptor |
597 | */ | 592 | */ |
598 | skbdesc = get_skb_frame_desc(intf->beacon->skb); | 593 | skbdesc = get_skb_frame_desc(intf->beacon->skb); |
599 | memset(skbdesc, 0, sizeof(*skbdesc)); | 594 | memset(skbdesc, 0, sizeof(*skbdesc)); |
600 | skbdesc->desc = desc; | ||
601 | skbdesc->desc_len = intf->beacon->queue->desc_size; | ||
602 | skbdesc->entry = intf->beacon; | 595 | skbdesc->entry = intf->beacon; |
603 | 596 | ||
604 | /* | 597 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h index 36a957adc1f9..f79170849add 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h | |||
@@ -94,12 +94,15 @@ enum data_queue_qid { | |||
94 | * mac80211 but was stripped for processing by the driver. | 94 | * mac80211 but was stripped for processing by the driver. |
95 | * @SKBDESC_NOT_MAC80211: Frame didn't originate from mac80211, | 95 | * @SKBDESC_NOT_MAC80211: Frame didn't originate from mac80211, |
96 | * don't try to pass it back. | 96 | * don't try to pass it back. |
97 | * @SKBDESC_DESC_IN_SKB: The descriptor is at the start of the | ||
98 | * skb, instead of in the desc field. | ||
97 | */ | 99 | */ |
98 | enum skb_frame_desc_flags { | 100 | enum skb_frame_desc_flags { |
99 | SKBDESC_DMA_MAPPED_RX = 1 << 0, | 101 | SKBDESC_DMA_MAPPED_RX = 1 << 0, |
100 | SKBDESC_DMA_MAPPED_TX = 1 << 1, | 102 | SKBDESC_DMA_MAPPED_TX = 1 << 1, |
101 | SKBDESC_IV_STRIPPED = 1 << 2, | 103 | SKBDESC_IV_STRIPPED = 1 << 2, |
102 | SKBDESC_NOT_MAC80211 = 1 << 3, | 104 | SKBDESC_NOT_MAC80211 = 1 << 3, |
105 | SKBDESC_DESC_IN_SKB = 1 << 4, | ||
103 | }; | 106 | }; |
104 | 107 | ||
105 | /** | 108 | /** |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index da111c0c2928..bd1546ba7ad2 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -222,7 +222,6 @@ int rt2x00usb_write_tx_data(struct queue_entry *entry, | |||
222 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 222 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
223 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); | 223 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); |
224 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; | 224 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; |
225 | struct skb_frame_desc *skbdesc; | ||
226 | u32 length; | 225 | u32 length; |
227 | 226 | ||
228 | /* | 227 | /* |
@@ -232,13 +231,6 @@ int rt2x00usb_write_tx_data(struct queue_entry *entry, | |||
232 | memset(entry->skb->data, 0, entry->queue->desc_size); | 231 | memset(entry->skb->data, 0, entry->queue->desc_size); |
233 | 232 | ||
234 | /* | 233 | /* |
235 | * Fill in skb descriptor | ||
236 | */ | ||
237 | skbdesc = get_skb_frame_desc(entry->skb); | ||
238 | skbdesc->desc = entry->skb->data; | ||
239 | skbdesc->desc_len = entry->queue->desc_size; | ||
240 | |||
241 | /* | ||
242 | * USB devices cannot blindly pass the skb->len as the | 234 | * USB devices cannot blindly pass the skb->len as the |
243 | * length of the data to usb_fill_bulk_urb. Pass the skb | 235 | * length of the data to usb_fill_bulk_urb. Pass the skb |
244 | * to the driver to determine what the length should be. | 236 | * to the driver to determine what the length should be. |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 86c75b9c3f25..2e3076f67535 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -1764,7 +1764,8 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1764 | struct txentry_desc *txdesc) | 1764 | struct txentry_desc *txdesc) |
1765 | { | 1765 | { |
1766 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1766 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
1767 | __le32 *txd = skbdesc->desc; | 1767 | struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; |
1768 | __le32 *txd = entry_priv->desc; | ||
1768 | u32 word; | 1769 | u32 word; |
1769 | 1770 | ||
1770 | /* | 1771 | /* |
@@ -1802,18 +1803,23 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1802 | rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); | 1803 | rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); |
1803 | rt2x00_desc_write(txd, 5, word); | 1804 | rt2x00_desc_write(txd, 5, word); |
1804 | 1805 | ||
1805 | rt2x00_desc_read(txd, 6, &word); | 1806 | if (txdesc->queue != QID_BEACON) { |
1806 | rt2x00_set_field32(&word, TXD_W6_BUFFER_PHYSICAL_ADDRESS, | 1807 | rt2x00_desc_read(txd, 6, &word); |
1807 | skbdesc->skb_dma); | 1808 | rt2x00_set_field32(&word, TXD_W6_BUFFER_PHYSICAL_ADDRESS, |
1808 | rt2x00_desc_write(txd, 6, word); | 1809 | skbdesc->skb_dma); |
1810 | rt2x00_desc_write(txd, 6, word); | ||
1809 | 1811 | ||
1810 | if (skbdesc->desc_len > TXINFO_SIZE) { | ||
1811 | rt2x00_desc_read(txd, 11, &word); | 1812 | rt2x00_desc_read(txd, 11, &word); |
1812 | rt2x00_set_field32(&word, TXD_W11_BUFFER_LENGTH0, | 1813 | rt2x00_set_field32(&word, TXD_W11_BUFFER_LENGTH0, |
1813 | txdesc->length); | 1814 | txdesc->length); |
1814 | rt2x00_desc_write(txd, 11, word); | 1815 | rt2x00_desc_write(txd, 11, word); |
1815 | } | 1816 | } |
1816 | 1817 | ||
1818 | /* | ||
1819 | * Writing TXD word 0 must the last to prevent a race condition with | ||
1820 | * the device, whereby the device may take hold of the TXD before we | ||
1821 | * finished updating it. | ||
1822 | */ | ||
1817 | rt2x00_desc_read(txd, 0, &word); | 1823 | rt2x00_desc_read(txd, 0, &word); |
1818 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 1); | 1824 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 1); |
1819 | rt2x00_set_field32(&word, TXD_W0_VALID, 1); | 1825 | rt2x00_set_field32(&word, TXD_W0_VALID, 1); |
@@ -1838,6 +1844,13 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1838 | test_bit(ENTRY_TXD_BURST, &txdesc->flags)); | 1844 | test_bit(ENTRY_TXD_BURST, &txdesc->flags)); |
1839 | rt2x00_set_field32(&word, TXD_W0_CIPHER_ALG, txdesc->cipher); | 1845 | rt2x00_set_field32(&word, TXD_W0_CIPHER_ALG, txdesc->cipher); |
1840 | rt2x00_desc_write(txd, 0, word); | 1846 | rt2x00_desc_write(txd, 0, word); |
1847 | |||
1848 | /* | ||
1849 | * Register descriptor details in skb frame descriptor. | ||
1850 | */ | ||
1851 | skbdesc->desc = txd; | ||
1852 | skbdesc->desc_len = | ||
1853 | (txdesc->queue == QID_BEACON) ? TXINFO_SIZE : TXD_DESC_SIZE; | ||
1841 | } | 1854 | } |
1842 | 1855 | ||
1843 | /* | 1856 | /* |
@@ -1847,7 +1860,7 @@ static void rt61pci_write_beacon(struct queue_entry *entry, | |||
1847 | struct txentry_desc *txdesc) | 1860 | struct txentry_desc *txdesc) |
1848 | { | 1861 | { |
1849 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1862 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1850 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | 1863 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
1851 | unsigned int beacon_base; | 1864 | unsigned int beacon_base; |
1852 | u32 reg; | 1865 | u32 reg; |
1853 | 1866 | ||
@@ -1863,11 +1876,9 @@ static void rt61pci_write_beacon(struct queue_entry *entry, | |||
1863 | * Write entire beacon with descriptor to register. | 1876 | * Write entire beacon with descriptor to register. |
1864 | */ | 1877 | */ |
1865 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | 1878 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); |
1866 | rt2x00pci_register_multiwrite(rt2x00dev, | 1879 | rt2x00pci_register_multiwrite(rt2x00dev, beacon_base, |
1867 | beacon_base, | 1880 | entry_priv->desc, TXINFO_SIZE); |
1868 | skbdesc->desc, skbdesc->desc_len); | 1881 | rt2x00pci_register_multiwrite(rt2x00dev, beacon_base + TXINFO_SIZE, |
1869 | rt2x00pci_register_multiwrite(rt2x00dev, | ||
1870 | beacon_base + skbdesc->desc_len, | ||
1871 | entry->skb->data, entry->skb->len); | 1882 | entry->skb->data, entry->skb->len); |
1872 | 1883 | ||
1873 | /* | 1884 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 11c130748206..e35bd19c3c5a 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1441,12 +1441,38 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1441 | struct txentry_desc *txdesc) | 1441 | struct txentry_desc *txdesc) |
1442 | { | 1442 | { |
1443 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1443 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
1444 | __le32 *txd = skbdesc->desc; | 1444 | __le32 *txd = (__le32 *)(skb->data - TXD_DESC_SIZE); |
1445 | u32 word; | 1445 | u32 word; |
1446 | 1446 | ||
1447 | /* | 1447 | /* |
1448 | * Start writing the descriptor words. | 1448 | * Start writing the descriptor words. |
1449 | */ | 1449 | */ |
1450 | rt2x00_desc_read(txd, 0, &word); | ||
1451 | rt2x00_set_field32(&word, TXD_W0_BURST, | ||
1452 | test_bit(ENTRY_TXD_BURST, &txdesc->flags)); | ||
1453 | rt2x00_set_field32(&word, TXD_W0_VALID, 1); | ||
1454 | rt2x00_set_field32(&word, TXD_W0_MORE_FRAG, | ||
1455 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | ||
1456 | rt2x00_set_field32(&word, TXD_W0_ACK, | ||
1457 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
1458 | rt2x00_set_field32(&word, TXD_W0_TIMESTAMP, | ||
1459 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
1460 | rt2x00_set_field32(&word, TXD_W0_OFDM, | ||
1461 | (txdesc->rate_mode == RATE_MODE_OFDM)); | ||
1462 | rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); | ||
1463 | rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, | ||
1464 | test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags)); | ||
1465 | rt2x00_set_field32(&word, TXD_W0_TKIP_MIC, | ||
1466 | test_bit(ENTRY_TXD_ENCRYPT_MMIC, &txdesc->flags)); | ||
1467 | rt2x00_set_field32(&word, TXD_W0_KEY_TABLE, | ||
1468 | test_bit(ENTRY_TXD_ENCRYPT_PAIRWISE, &txdesc->flags)); | ||
1469 | rt2x00_set_field32(&word, TXD_W0_KEY_INDEX, txdesc->key_idx); | ||
1470 | rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, txdesc->length); | ||
1471 | rt2x00_set_field32(&word, TXD_W0_BURST2, | ||
1472 | test_bit(ENTRY_TXD_BURST, &txdesc->flags)); | ||
1473 | rt2x00_set_field32(&word, TXD_W0_CIPHER_ALG, txdesc->cipher); | ||
1474 | rt2x00_desc_write(txd, 0, word); | ||
1475 | |||
1450 | rt2x00_desc_read(txd, 1, &word); | 1476 | rt2x00_desc_read(txd, 1, &word); |
1451 | rt2x00_set_field32(&word, TXD_W1_HOST_Q_ID, txdesc->queue); | 1477 | rt2x00_set_field32(&word, TXD_W1_HOST_Q_ID, txdesc->queue); |
1452 | rt2x00_set_field32(&word, TXD_W1_AIFSN, txdesc->aifs); | 1478 | rt2x00_set_field32(&word, TXD_W1_AIFSN, txdesc->aifs); |
@@ -1475,31 +1501,11 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1475 | rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); | 1501 | rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); |
1476 | rt2x00_desc_write(txd, 5, word); | 1502 | rt2x00_desc_write(txd, 5, word); |
1477 | 1503 | ||
1478 | rt2x00_desc_read(txd, 0, &word); | 1504 | /* |
1479 | rt2x00_set_field32(&word, TXD_W0_BURST, | 1505 | * Register descriptor details in skb frame descriptor. |
1480 | test_bit(ENTRY_TXD_BURST, &txdesc->flags)); | 1506 | */ |
1481 | rt2x00_set_field32(&word, TXD_W0_VALID, 1); | 1507 | skbdesc->desc = txd; |
1482 | rt2x00_set_field32(&word, TXD_W0_MORE_FRAG, | 1508 | skbdesc->desc_len = TXD_DESC_SIZE; |
1483 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | ||
1484 | rt2x00_set_field32(&word, TXD_W0_ACK, | ||
1485 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
1486 | rt2x00_set_field32(&word, TXD_W0_TIMESTAMP, | ||
1487 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
1488 | rt2x00_set_field32(&word, TXD_W0_OFDM, | ||
1489 | (txdesc->rate_mode == RATE_MODE_OFDM)); | ||
1490 | rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); | ||
1491 | rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, | ||
1492 | test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags)); | ||
1493 | rt2x00_set_field32(&word, TXD_W0_TKIP_MIC, | ||
1494 | test_bit(ENTRY_TXD_ENCRYPT_MMIC, &txdesc->flags)); | ||
1495 | rt2x00_set_field32(&word, TXD_W0_KEY_TABLE, | ||
1496 | test_bit(ENTRY_TXD_ENCRYPT_PAIRWISE, &txdesc->flags)); | ||
1497 | rt2x00_set_field32(&word, TXD_W0_KEY_INDEX, txdesc->key_idx); | ||
1498 | rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, txdesc->length); | ||
1499 | rt2x00_set_field32(&word, TXD_W0_BURST2, | ||
1500 | test_bit(ENTRY_TXD_BURST, &txdesc->flags)); | ||
1501 | rt2x00_set_field32(&word, TXD_W0_CIPHER_ALG, txdesc->cipher); | ||
1502 | rt2x00_desc_write(txd, 0, word); | ||
1503 | } | 1509 | } |
1504 | 1510 | ||
1505 | /* | 1511 | /* |
@@ -1509,18 +1515,10 @@ static void rt73usb_write_beacon(struct queue_entry *entry, | |||
1509 | struct txentry_desc *txdesc) | 1515 | struct txentry_desc *txdesc) |
1510 | { | 1516 | { |
1511 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1517 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1512 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | ||
1513 | unsigned int beacon_base; | 1518 | unsigned int beacon_base; |
1514 | u32 reg; | 1519 | u32 reg; |
1515 | 1520 | ||
1516 | /* | 1521 | /* |
1517 | * Add the descriptor in front of the skb. | ||
1518 | */ | ||
1519 | skb_push(entry->skb, entry->queue->desc_size); | ||
1520 | memcpy(entry->skb->data, skbdesc->desc, skbdesc->desc_len); | ||
1521 | skbdesc->desc = entry->skb->data; | ||
1522 | |||
1523 | /* | ||
1524 | * Disable beaconing while we are reloading the beacon data, | 1522 | * Disable beaconing while we are reloading the beacon data, |
1525 | * otherwise we might be sending out invalid data. | 1523 | * otherwise we might be sending out invalid data. |
1526 | */ | 1524 | */ |
@@ -1529,6 +1527,11 @@ static void rt73usb_write_beacon(struct queue_entry *entry, | |||
1529 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); | 1527 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); |
1530 | 1528 | ||
1531 | /* | 1529 | /* |
1530 | * Take the descriptor in front of the skb into account. | ||
1531 | */ | ||
1532 | skb_push(entry->skb, TXD_DESC_SIZE); | ||
1533 | |||
1534 | /* | ||
1532 | * Write entire beacon with descriptor to register. | 1535 | * Write entire beacon with descriptor to register. |
1533 | */ | 1536 | */ |
1534 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | 1537 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 5bb9e3fff961..b7d9137851ac 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -467,6 +467,7 @@ static void wl1271_irq_work(struct work_struct *work) | |||
467 | intr = le32_to_cpu(wl->fw_status->intr); | 467 | intr = le32_to_cpu(wl->fw_status->intr); |
468 | if (!intr) { | 468 | if (!intr) { |
469 | wl1271_debug(DEBUG_IRQ, "Zero interrupt received."); | 469 | wl1271_debug(DEBUG_IRQ, "Zero interrupt received."); |
470 | spin_lock_irqsave(&wl->wl_lock, flags); | ||
470 | continue; | 471 | continue; |
471 | } | 472 | } |
472 | 473 | ||
@@ -852,7 +853,7 @@ static int wl1271_dev_notify(struct notifier_block *me, unsigned long what, | |||
852 | if (wl == wl_temp) | 853 | if (wl == wl_temp) |
853 | break; | 854 | break; |
854 | } | 855 | } |
855 | if (wl == NULL) | 856 | if (wl != wl_temp) |
856 | return NOTIFY_DONE; | 857 | return NOTIFY_DONE; |
857 | 858 | ||
858 | /* Get the interface IP address for the device. "ifa" will become | 859 | /* Get the interface IP address for the device. "ifa" will become |
@@ -1558,8 +1559,6 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
1558 | default: | 1559 | default: |
1559 | wl1271_error("Unsupported key cmd 0x%x", cmd); | 1560 | wl1271_error("Unsupported key cmd 0x%x", cmd); |
1560 | ret = -EOPNOTSUPP; | 1561 | ret = -EOPNOTSUPP; |
1561 | goto out_sleep; | ||
1562 | |||
1563 | break; | 1562 | break; |
1564 | } | 1563 | } |
1565 | 1564 | ||