.. | .. |
---|
7 | 7 | * |
---|
8 | 8 | * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. |
---|
9 | 9 | * Copyright(c) 2015 Intel Mobile Communications GmbH |
---|
10 | | - * Copyright(c) 2018 Intel Corporation |
---|
| 10 | + * Copyright(c) 2018 - 2019 Intel Corporation |
---|
11 | 11 | * |
---|
12 | 12 | * This program is free software; you can redistribute it and/or modify |
---|
13 | 13 | * it under the terms of version 2 of the GNU General Public License as |
---|
.. | .. |
---|
17 | 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
19 | 19 | * General Public License for more details. |
---|
20 | | - * |
---|
21 | | - * You should have received a copy of the GNU General Public License |
---|
22 | | - * along with this program; |
---|
23 | 20 | * |
---|
24 | 21 | * The full GNU General Public License is included in this distribution |
---|
25 | 22 | * in the file called COPYING. |
---|
.. | .. |
---|
32 | 29 | * |
---|
33 | 30 | * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. |
---|
34 | 31 | * Copyright(c) 2015 Intel Mobile Communications GmbH |
---|
35 | | - * Copyright(c) 2018 Intel Corporation |
---|
| 32 | + * Copyright(c) 2018 - 2019 Intel Corporation |
---|
36 | 33 | * All rights reserved. |
---|
37 | 34 | * |
---|
38 | 35 | * Redistribution and use in source and binary forms, with or without |
---|
.. | .. |
---|
731 | 728 | #define MAX_BIT_RATE_40_MHZ 150 /* Mbps */ |
---|
732 | 729 | #define MAX_BIT_RATE_20_MHZ 72 /* Mbps */ |
---|
733 | 730 | |
---|
734 | | -void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg, |
---|
| 731 | +void iwl_init_ht_hw_capab(struct iwl_trans *trans, |
---|
735 | 732 | struct iwl_nvm_data *data, |
---|
736 | 733 | struct ieee80211_sta_ht_cap *ht_info, |
---|
737 | 734 | enum nl80211_band band, |
---|
738 | 735 | u8 tx_chains, u8 rx_chains) |
---|
739 | 736 | { |
---|
| 737 | + const struct iwl_cfg *cfg = trans->cfg; |
---|
740 | 738 | int max_bit_rate = 0; |
---|
741 | 739 | |
---|
742 | 740 | tx_chains = hweight8(tx_chains); |
---|
.. | .. |
---|
745 | 743 | else |
---|
746 | 744 | rx_chains = hweight8(rx_chains); |
---|
747 | 745 | |
---|
748 | | - if (!(data->sku_cap_11n_enable) || !cfg->ht_params) { |
---|
| 746 | + if (!(data->sku_cap_11n_enable) || |
---|
| 747 | + (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL) || |
---|
| 748 | + !cfg->ht_params) { |
---|
749 | 749 | ht_info->ht_supported = false; |
---|
750 | 750 | return; |
---|
751 | 751 | } |
---|
.. | .. |
---|
766 | 766 | if (cfg->ht_params->ldpc) |
---|
767 | 767 | ht_info->cap |= IEEE80211_HT_CAP_LDPC_CODING; |
---|
768 | 768 | |
---|
769 | | - if ((cfg->mq_rx_supported && |
---|
| 769 | + if ((trans->trans_cfg->mq_rx_supported && |
---|
770 | 770 | iwlwifi_mod_params.amsdu_size == IWL_AMSDU_DEF) || |
---|
771 | 771 | iwlwifi_mod_params.amsdu_size >= IWL_AMSDU_8K) |
---|
772 | 772 | ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU; |
---|
.. | .. |
---|
806 | 806 | } |
---|
807 | 807 | } |
---|
808 | 808 | |
---|
809 | | -static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg, |
---|
| 809 | +static void iwl_init_sbands(struct iwl_trans *trans, const struct iwl_cfg *cfg, |
---|
810 | 810 | struct iwl_nvm_data *data, |
---|
811 | 811 | const u8 *eeprom, size_t eeprom_size) |
---|
812 | 812 | { |
---|
| 813 | + struct device *dev = trans->dev; |
---|
813 | 814 | int n_channels = iwl_init_channel_map(dev, cfg, data, |
---|
814 | 815 | eeprom, eeprom_size); |
---|
815 | 816 | int n_used = 0; |
---|
.. | .. |
---|
821 | 822 | sband->n_bitrates = N_RATES_24; |
---|
822 | 823 | n_used += iwl_init_sband_channels(data, sband, n_channels, |
---|
823 | 824 | NL80211_BAND_2GHZ); |
---|
824 | | - iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, NL80211_BAND_2GHZ, |
---|
| 825 | + iwl_init_ht_hw_capab(trans, data, &sband->ht_cap, NL80211_BAND_2GHZ, |
---|
825 | 826 | data->valid_tx_ant, data->valid_rx_ant); |
---|
826 | 827 | |
---|
827 | 828 | sband = &data->bands[NL80211_BAND_5GHZ]; |
---|
.. | .. |
---|
830 | 831 | sband->n_bitrates = N_RATES_52; |
---|
831 | 832 | n_used += iwl_init_sband_channels(data, sband, n_channels, |
---|
832 | 833 | NL80211_BAND_5GHZ); |
---|
833 | | - iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, NL80211_BAND_5GHZ, |
---|
| 834 | + iwl_init_ht_hw_capab(trans, data, &sband->ht_cap, NL80211_BAND_5GHZ, |
---|
834 | 835 | data->valid_tx_ant, data->valid_rx_ant); |
---|
835 | 836 | |
---|
836 | 837 | if (n_channels != n_used) |
---|
.. | .. |
---|
841 | 842 | /* EEPROM data functions */ |
---|
842 | 843 | |
---|
843 | 844 | struct iwl_nvm_data * |
---|
844 | | -iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg, |
---|
| 845 | +iwl_parse_eeprom_data(struct iwl_trans *trans, const struct iwl_cfg *cfg, |
---|
845 | 846 | const u8 *eeprom, size_t eeprom_size) |
---|
846 | 847 | { |
---|
847 | 848 | struct iwl_nvm_data *data; |
---|
| 849 | + struct device *dev = trans->dev; |
---|
848 | 850 | const void *tmp; |
---|
849 | 851 | u16 radio_cfg, sku; |
---|
850 | 852 | |
---|
851 | 853 | if (WARN_ON(!cfg || !cfg->eeprom_params)) |
---|
852 | 854 | return NULL; |
---|
853 | 855 | |
---|
854 | | - data = kzalloc(sizeof(*data) + |
---|
855 | | - sizeof(struct ieee80211_channel) * IWL_NUM_CHANNELS, |
---|
| 856 | + data = kzalloc(struct_size(data, channels, IWL_NUM_CHANNELS), |
---|
856 | 857 | GFP_KERNEL); |
---|
857 | 858 | if (!data) |
---|
858 | 859 | return NULL; |
---|
.. | .. |
---|
920 | 921 | goto err_free; |
---|
921 | 922 | } |
---|
922 | 923 | |
---|
923 | | - iwl_init_sbands(dev, cfg, data, eeprom, eeprom_size); |
---|
| 924 | + iwl_init_sbands(trans, cfg, data, eeprom, eeprom_size); |
---|
924 | 925 | |
---|
925 | 926 | return data; |
---|
926 | 927 | err_free: |
---|