| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /****************************************************************************** |
|---|
| 2 | 3 | * |
|---|
| 3 | | - * GPL LICENSE SUMMARY |
|---|
| 4 | | - * |
|---|
| 5 | 4 | * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of version 2 of the GNU General Public License as |
|---|
| 9 | | - * published by the Free Software Foundation. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 12 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 14 | | - * General Public License for more details. |
|---|
| 15 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License |
|---|
| 17 | | - * along with this program; if not, write to the Free Software |
|---|
| 18 | | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
|---|
| 19 | | - * USA |
|---|
| 20 | | - * |
|---|
| 21 | | - * The full GNU General Public License is included in this distribution |
|---|
| 22 | | - * in the file called LICENSE.GPL. |
|---|
| 23 | 5 | * |
|---|
| 24 | 6 | * Contact Information: |
|---|
| 25 | 7 | * Intel Linux Wireless <ilw@linux.intel.com> |
|---|
| .. | .. |
|---|
| 703 | 685 | } |
|---|
| 704 | 686 | EXPORT_SYMBOL(il_eeprom_query16); |
|---|
| 705 | 687 | |
|---|
| 706 | | -/** |
|---|
| 688 | +/* |
|---|
| 707 | 689 | * il_eeprom_init - read EEPROM contents |
|---|
| 708 | 690 | * |
|---|
| 709 | 691 | * Load the EEPROM contents from adapter into il->eeprom |
|---|
| .. | .. |
|---|
| 854 | 836 | |
|---|
| 855 | 837 | #define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \ |
|---|
| 856 | 838 | ? # x " " : "") |
|---|
| 857 | | -/** |
|---|
| 839 | +/* |
|---|
| 858 | 840 | * il_mod_ht40_chan_info - Copy ht40 channel info into driver's il. |
|---|
| 859 | 841 | * |
|---|
| 860 | 842 | * Does not set up a command, or touch hardware. |
|---|
| .. | .. |
|---|
| 895 | 877 | #define CHECK_AND_PRINT_I(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \ |
|---|
| 896 | 878 | ? # x " " : "") |
|---|
| 897 | 879 | |
|---|
| 898 | | -/** |
|---|
| 880 | +/* |
|---|
| 899 | 881 | * il_init_channel_map - Set up driver's info for all possible channels |
|---|
| 900 | 882 | */ |
|---|
| 901 | 883 | int |
|---|
| .. | .. |
|---|
| 1042 | 1024 | } |
|---|
| 1043 | 1025 | EXPORT_SYMBOL(il_free_channel_map); |
|---|
| 1044 | 1026 | |
|---|
| 1045 | | -/** |
|---|
| 1027 | +/* |
|---|
| 1046 | 1028 | * il_get_channel_info - Find driver's ilate channel info |
|---|
| 1047 | 1029 | * |
|---|
| 1048 | 1030 | * Based on band and channel number. |
|---|
| .. | .. |
|---|
| 1090 | 1072 | static void |
|---|
| 1091 | 1073 | il_build_powertable_cmd(struct il_priv *il, struct il_powertable_cmd *cmd) |
|---|
| 1092 | 1074 | { |
|---|
| 1093 | | - const __le32 interval[3][IL_POWER_VEC_SIZE] = { |
|---|
| 1075 | + static const __le32 interval[3][IL_POWER_VEC_SIZE] = { |
|---|
| 1094 | 1076 | SLP_VEC(2, 2, 4, 6, 0xFF), |
|---|
| 1095 | 1077 | SLP_VEC(2, 4, 7, 10, 10), |
|---|
| 1096 | 1078 | SLP_VEC(4, 7, 10, 10, 0xFF) |
|---|
| .. | .. |
|---|
| 1361 | 1343 | D_SCAN("Successfully send scan abort\n"); |
|---|
| 1362 | 1344 | } |
|---|
| 1363 | 1345 | |
|---|
| 1364 | | -/** |
|---|
| 1346 | +/* |
|---|
| 1365 | 1347 | * il_scan_cancel - Cancel any currently executing HW scan |
|---|
| 1366 | 1348 | */ |
|---|
| 1367 | 1349 | int |
|---|
| .. | .. |
|---|
| 1373 | 1355 | } |
|---|
| 1374 | 1356 | EXPORT_SYMBOL(il_scan_cancel); |
|---|
| 1375 | 1357 | |
|---|
| 1376 | | -/** |
|---|
| 1358 | +/* |
|---|
| 1377 | 1359 | * il_scan_cancel_timeout - Cancel any currently executing HW scan |
|---|
| 1378 | 1360 | * @ms: amount of time to wait (in milliseconds) for scan to abort |
|---|
| 1379 | 1361 | * |
|---|
| .. | .. |
|---|
| 1625 | 1607 | mutex_unlock(&il->mutex); |
|---|
| 1626 | 1608 | } |
|---|
| 1627 | 1609 | |
|---|
| 1628 | | -/** |
|---|
| 1610 | +/* |
|---|
| 1629 | 1611 | * il_fill_probe_req - fill in all required fields and IE for probe request |
|---|
| 1630 | 1612 | */ |
|---|
| 1631 | | - |
|---|
| 1632 | 1613 | u16 |
|---|
| 1633 | 1614 | il_fill_probe_req(struct il_priv *il, struct ieee80211_mgmt *frame, |
|---|
| 1634 | 1615 | const u8 *ta, const u8 *ies, int ie_len, int left) |
|---|
| .. | .. |
|---|
| 1931 | 1912 | return; |
|---|
| 1932 | 1913 | } |
|---|
| 1933 | 1914 | |
|---|
| 1934 | | -/** |
|---|
| 1915 | +/* |
|---|
| 1935 | 1916 | * il_prep_station - Prepare station information for addition |
|---|
| 1936 | 1917 | * |
|---|
| 1937 | 1918 | * should be called with sta_lock held |
|---|
| .. | .. |
|---|
| 2018 | 1999 | |
|---|
| 2019 | 2000 | #define STA_WAIT_TIMEOUT (HZ/2) |
|---|
| 2020 | 2001 | |
|---|
| 2021 | | -/** |
|---|
| 2002 | +/* |
|---|
| 2022 | 2003 | * il_add_station_common - |
|---|
| 2023 | 2004 | */ |
|---|
| 2024 | 2005 | int |
|---|
| .. | .. |
|---|
| 2078 | 2059 | } |
|---|
| 2079 | 2060 | EXPORT_SYMBOL(il_add_station_common); |
|---|
| 2080 | 2061 | |
|---|
| 2081 | | -/** |
|---|
| 2062 | +/* |
|---|
| 2082 | 2063 | * il_sta_ucode_deactivate - deactivate ucode status for a station |
|---|
| 2083 | 2064 | * |
|---|
| 2084 | 2065 | * il->sta_lock must be held |
|---|
| .. | .. |
|---|
| 2154 | 2135 | return ret; |
|---|
| 2155 | 2136 | } |
|---|
| 2156 | 2137 | |
|---|
| 2157 | | -/** |
|---|
| 2138 | +/* |
|---|
| 2158 | 2139 | * il_remove_station - Remove driver's knowledge of station. |
|---|
| 2159 | 2140 | */ |
|---|
| 2160 | 2141 | int |
|---|
| .. | .. |
|---|
| 2210 | 2191 | } |
|---|
| 2211 | 2192 | EXPORT_SYMBOL_GPL(il_remove_station); |
|---|
| 2212 | 2193 | |
|---|
| 2213 | | -/** |
|---|
| 2194 | +/* |
|---|
| 2214 | 2195 | * il_clear_ucode_stations - clear ucode station table bits |
|---|
| 2215 | 2196 | * |
|---|
| 2216 | 2197 | * This function clears all the bits in the driver indicating |
|---|
| .. | .. |
|---|
| 2242 | 2223 | } |
|---|
| 2243 | 2224 | EXPORT_SYMBOL(il_clear_ucode_stations); |
|---|
| 2244 | 2225 | |
|---|
| 2245 | | -/** |
|---|
| 2226 | +/* |
|---|
| 2246 | 2227 | * il_restore_stations() - Restore driver known stations to device |
|---|
| 2247 | 2228 | * |
|---|
| 2248 | 2229 | * All stations considered active by driver, but not present in ucode, is |
|---|
| .. | .. |
|---|
| 2374 | 2355 | } |
|---|
| 2375 | 2356 | #endif |
|---|
| 2376 | 2357 | |
|---|
| 2377 | | -/** |
|---|
| 2358 | +/* |
|---|
| 2378 | 2359 | * il_is_lq_table_valid() - Test one aspect of LQ cmd for validity |
|---|
| 2379 | 2360 | * |
|---|
| 2380 | 2361 | * It sometimes happens when a HT rate has been in use and we |
|---|
| .. | .. |
|---|
| 2403 | 2384 | return true; |
|---|
| 2404 | 2385 | } |
|---|
| 2405 | 2386 | |
|---|
| 2406 | | -/** |
|---|
| 2387 | +/* |
|---|
| 2407 | 2388 | * il_send_lq_cmd() - Send link quality command |
|---|
| 2408 | 2389 | * @init: This command is sent as part of station initialization right |
|---|
| 2409 | 2390 | * after station has been added. |
|---|
| .. | .. |
|---|
| 2549 | 2530 | * |
|---|
| 2550 | 2531 | */ |
|---|
| 2551 | 2532 | |
|---|
| 2552 | | -/** |
|---|
| 2533 | +/* |
|---|
| 2553 | 2534 | * il_rx_queue_space - Return number of free slots available in queue. |
|---|
| 2554 | 2535 | */ |
|---|
| 2555 | 2536 | int |
|---|
| .. | .. |
|---|
| 2566 | 2547 | } |
|---|
| 2567 | 2548 | EXPORT_SYMBOL(il_rx_queue_space); |
|---|
| 2568 | 2549 | |
|---|
| 2569 | | -/** |
|---|
| 2550 | +/* |
|---|
| 2570 | 2551 | * il_rx_queue_update_write_ptr - Update the write pointer for the RX queue |
|---|
| 2571 | 2552 | */ |
|---|
| 2572 | 2553 | void |
|---|
| .. | .. |
|---|
| 2695 | 2676 | if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == |
|---|
| 2696 | 2677 | RX_RES_STATUS_BAD_KEY_TTAK) |
|---|
| 2697 | 2678 | break; |
|---|
| 2679 | + fallthrough; |
|---|
| 2698 | 2680 | |
|---|
| 2699 | 2681 | case RX_RES_STATUS_SEC_TYPE_WEP: |
|---|
| 2700 | 2682 | if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == |
|---|
| .. | .. |
|---|
| 2704 | 2686 | D_RX("Packet destroyed\n"); |
|---|
| 2705 | 2687 | return -1; |
|---|
| 2706 | 2688 | } |
|---|
| 2689 | + fallthrough; |
|---|
| 2707 | 2690 | case RX_RES_STATUS_SEC_TYPE_CCMP: |
|---|
| 2708 | 2691 | if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == |
|---|
| 2709 | 2692 | RX_RES_STATUS_DECRYPT_OK) { |
|---|
| .. | .. |
|---|
| 2719 | 2702 | } |
|---|
| 2720 | 2703 | EXPORT_SYMBOL(il_set_decrypted_flag); |
|---|
| 2721 | 2704 | |
|---|
| 2722 | | -/** |
|---|
| 2705 | +/* |
|---|
| 2723 | 2706 | * il_txq_update_write_ptr - Send new write idx to hardware |
|---|
| 2724 | 2707 | */ |
|---|
| 2725 | 2708 | void |
|---|
| .. | .. |
|---|
| 2759 | 2742 | } |
|---|
| 2760 | 2743 | EXPORT_SYMBOL(il_txq_update_write_ptr); |
|---|
| 2761 | 2744 | |
|---|
| 2762 | | -/** |
|---|
| 2745 | +/* |
|---|
| 2763 | 2746 | * il_tx_queue_unmap - Unmap any remaining DMA mappings and free skb's |
|---|
| 2764 | 2747 | */ |
|---|
| 2765 | 2748 | void |
|---|
| .. | .. |
|---|
| 2778 | 2761 | } |
|---|
| 2779 | 2762 | EXPORT_SYMBOL(il_tx_queue_unmap); |
|---|
| 2780 | 2763 | |
|---|
| 2781 | | -/** |
|---|
| 2764 | +/* |
|---|
| 2782 | 2765 | * il_tx_queue_free - Deallocate DMA queue. |
|---|
| 2783 | 2766 | * @txq: Transmit queue to deallocate. |
|---|
| 2784 | 2767 | * |
|---|
| .. | .. |
|---|
| 2821 | 2804 | } |
|---|
| 2822 | 2805 | EXPORT_SYMBOL(il_tx_queue_free); |
|---|
| 2823 | 2806 | |
|---|
| 2824 | | -/** |
|---|
| 2807 | +/* |
|---|
| 2825 | 2808 | * il_cmd_queue_unmap - Unmap any remaining DMA mappings from command queue |
|---|
| 2826 | 2809 | */ |
|---|
| 2827 | 2810 | void |
|---|
| .. | .. |
|---|
| 2859 | 2842 | } |
|---|
| 2860 | 2843 | EXPORT_SYMBOL(il_cmd_queue_unmap); |
|---|
| 2861 | 2844 | |
|---|
| 2862 | | -/** |
|---|
| 2845 | +/* |
|---|
| 2863 | 2846 | * il_cmd_queue_free - Deallocate DMA queue. |
|---|
| 2864 | | - * @txq: Transmit queue to deallocate. |
|---|
| 2865 | 2847 | * |
|---|
| 2866 | 2848 | * Empty queue by removing and destroying all BD's. |
|---|
| 2867 | 2849 | * Free all buffers. |
|---|
| .. | .. |
|---|
| 2940 | 2922 | EXPORT_SYMBOL(il_queue_space); |
|---|
| 2941 | 2923 | |
|---|
| 2942 | 2924 | |
|---|
| 2943 | | -/** |
|---|
| 2925 | +/* |
|---|
| 2944 | 2926 | * il_queue_init - Initialize queue's high/low-water and read/write idxes |
|---|
| 2945 | 2927 | */ |
|---|
| 2946 | 2928 | static int |
|---|
| .. | .. |
|---|
| 2974 | 2956 | return 0; |
|---|
| 2975 | 2957 | } |
|---|
| 2976 | 2958 | |
|---|
| 2977 | | -/** |
|---|
| 2959 | +/* |
|---|
| 2978 | 2960 | * il_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue |
|---|
| 2979 | 2961 | */ |
|---|
| 2980 | 2962 | static int |
|---|
| .. | .. |
|---|
| 3014 | 2996 | return -ENOMEM; |
|---|
| 3015 | 2997 | } |
|---|
| 3016 | 2998 | |
|---|
| 3017 | | -/** |
|---|
| 2999 | +/* |
|---|
| 3018 | 3000 | * il_tx_queue_init - Allocate and initialize one tx/cmd queue |
|---|
| 3019 | 3001 | */ |
|---|
| 3020 | 3002 | int |
|---|
| .. | .. |
|---|
| 3121 | 3103 | |
|---|
| 3122 | 3104 | /*************** HOST COMMAND QUEUE FUNCTIONS *****/ |
|---|
| 3123 | 3105 | |
|---|
| 3124 | | -/** |
|---|
| 3106 | +/* |
|---|
| 3125 | 3107 | * il_enqueue_hcmd - enqueue a uCode command |
|---|
| 3126 | 3108 | * @il: device ilate data point |
|---|
| 3127 | 3109 | * @cmd: a point to the ucode command structure |
|---|
| .. | .. |
|---|
| 3139 | 3121 | struct il_cmd_meta *out_meta; |
|---|
| 3140 | 3122 | dma_addr_t phys_addr; |
|---|
| 3141 | 3123 | unsigned long flags; |
|---|
| 3142 | | - int len; |
|---|
| 3143 | 3124 | u32 idx; |
|---|
| 3144 | 3125 | u16 fix_size; |
|---|
| 3145 | 3126 | |
|---|
| .. | .. |
|---|
| 3198 | 3179 | cpu_to_le16(QUEUE_TO_SEQ(il->cmd_queue) | IDX_TO_SEQ(q->write_ptr)); |
|---|
| 3199 | 3180 | if (cmd->flags & CMD_SIZE_HUGE) |
|---|
| 3200 | 3181 | out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; |
|---|
| 3201 | | - len = sizeof(struct il_device_cmd); |
|---|
| 3202 | | - if (idx == TFD_CMD_SLOTS) |
|---|
| 3203 | | - len = IL_MAX_CMD_SIZE; |
|---|
| 3204 | 3182 | |
|---|
| 3205 | 3183 | #ifdef CONFIG_IWLEGACY_DEBUG |
|---|
| 3206 | 3184 | switch (out_cmd->hdr.cmd) { |
|---|
| .. | .. |
|---|
| 3249 | 3227 | return idx; |
|---|
| 3250 | 3228 | } |
|---|
| 3251 | 3229 | |
|---|
| 3252 | | -/** |
|---|
| 3230 | +/* |
|---|
| 3253 | 3231 | * il_hcmd_queue_reclaim - Reclaim TX command queue entries already Tx'd |
|---|
| 3254 | 3232 | * |
|---|
| 3255 | 3233 | * When FW advances 'R' idx, all entries between old and new 'R' idx |
|---|
| .. | .. |
|---|
| 3282 | 3260 | } |
|---|
| 3283 | 3261 | } |
|---|
| 3284 | 3262 | |
|---|
| 3285 | | -/** |
|---|
| 3263 | +/* |
|---|
| 3286 | 3264 | * il_tx_cmd_complete - Pull unused buffers off the queue and reclaim them |
|---|
| 3287 | 3265 | * @rxb: Rx buffer to reclaim |
|---|
| 3288 | 3266 | * |
|---|
| .. | .. |
|---|
| 3433 | 3411 | } |
|---|
| 3434 | 3412 | } |
|---|
| 3435 | 3413 | |
|---|
| 3436 | | -/** |
|---|
| 3414 | +/* |
|---|
| 3437 | 3415 | * il_init_geos - Initialize mac80211's geo/channel info based from eeprom |
|---|
| 3438 | 3416 | */ |
|---|
| 3439 | 3417 | int |
|---|
| .. | .. |
|---|
| 3779 | 3757 | } |
|---|
| 3780 | 3758 | EXPORT_SYMBOL(il_check_rxon_cmd); |
|---|
| 3781 | 3759 | |
|---|
| 3782 | | -/** |
|---|
| 3760 | +/* |
|---|
| 3783 | 3761 | * il_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed |
|---|
| 3784 | 3762 | * @il: staging_rxon is compared to active_rxon |
|---|
| 3785 | 3763 | * |
|---|
| .. | .. |
|---|
| 3959 | 3937 | } |
|---|
| 3960 | 3938 | EXPORT_SYMBOL(il_get_single_channel_number); |
|---|
| 3961 | 3939 | |
|---|
| 3962 | | -/** |
|---|
| 3940 | +/* |
|---|
| 3963 | 3941 | * il_set_rxon_channel - Set the band and channel values in staging RXON |
|---|
| 3964 | 3942 | * @ch: requested channel as a pointer to struct ieee80211_channel |
|---|
| 3965 | 3943 | |
|---|
| .. | .. |
|---|
| 4162 | 4140 | } |
|---|
| 4163 | 4141 | EXPORT_SYMBOL(il_print_rx_config_cmd); |
|---|
| 4164 | 4142 | #endif |
|---|
| 4165 | | -/** |
|---|
| 4143 | +/* |
|---|
| 4166 | 4144 | * il_irq_handle_error - called for HW or SW error interrupt from card |
|---|
| 4167 | 4145 | */ |
|---|
| 4168 | 4146 | void |
|---|
| .. | .. |
|---|
| 4958 | 4936 | static int |
|---|
| 4959 | 4937 | il_pci_suspend(struct device *device) |
|---|
| 4960 | 4938 | { |
|---|
| 4961 | | - struct pci_dev *pdev = to_pci_dev(device); |
|---|
| 4962 | | - struct il_priv *il = pci_get_drvdata(pdev); |
|---|
| 4939 | + struct il_priv *il = dev_get_drvdata(device); |
|---|
| 4963 | 4940 | |
|---|
| 4964 | 4941 | /* |
|---|
| 4965 | 4942 | * This function is called when system goes into suspend state |
|---|
| .. | .. |
|---|
| 5028 | 5005 | &il->qos_data.def_qos_parm, NULL); |
|---|
| 5029 | 5006 | } |
|---|
| 5030 | 5007 | |
|---|
| 5031 | | -/** |
|---|
| 5008 | +/* |
|---|
| 5032 | 5009 | * il_mac_config - mac80211 config callback |
|---|
| 5033 | 5010 | */ |
|---|
| 5034 | 5011 | int |
|---|
| .. | .. |
|---|
| 5199 | 5176 | memset(&il->current_ht_config, 0, sizeof(struct il_ht_config)); |
|---|
| 5200 | 5177 | |
|---|
| 5201 | 5178 | /* new association get rid of ibss beacon skb */ |
|---|
| 5202 | | - if (il->beacon_skb) |
|---|
| 5203 | | - dev_kfree_skb(il->beacon_skb); |
|---|
| 5179 | + dev_consume_skb_irq(il->beacon_skb); |
|---|
| 5204 | 5180 | il->beacon_skb = NULL; |
|---|
| 5205 | 5181 | il->timestamp = 0; |
|---|
| 5206 | 5182 | |
|---|
| .. | .. |
|---|
| 5319 | 5295 | } |
|---|
| 5320 | 5296 | |
|---|
| 5321 | 5297 | spin_lock_irqsave(&il->lock, flags); |
|---|
| 5322 | | - |
|---|
| 5323 | | - if (il->beacon_skb) |
|---|
| 5324 | | - dev_kfree_skb(il->beacon_skb); |
|---|
| 5325 | | - |
|---|
| 5298 | + dev_consume_skb_irq(il->beacon_skb); |
|---|
| 5326 | 5299 | il->beacon_skb = skb; |
|---|
| 5327 | 5300 | |
|---|
| 5328 | 5301 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; |
|---|