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

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem

+7678 -3197
+35
Documentation/devicetree/bindings/net/nfc/pn544.txt
··· 1 + * NXP Semiconductors PN544 NFC Controller 2 + 3 + Required properties: 4 + - compatible: Should be "nxp,pn544-i2c". 5 + - clock-frequency: I�C work frequency. 6 + - reg: address on the bus 7 + - interrupt-parent: phandle for the interrupt gpio controller 8 + - interrupts: GPIO interrupt to which the chip is connected 9 + - enable-gpios: Output GPIO pin used for enabling/disabling the PN544 10 + - firmware-gpios: Output GPIO pin used to enter firmware download mode 11 + 12 + Optional SoC Specific Properties: 13 + - pinctrl-names: Contains only one value - "default". 14 + - pintctrl-0: Specifies the pin control groups used for this controller. 15 + 16 + Example (for ARM-based BeagleBone with PN544 on I2C2): 17 + 18 + &i2c2 { 19 + 20 + status = "okay"; 21 + 22 + pn544: pn544@28 { 23 + 24 + compatible = "nxp,pn544-i2c"; 25 + 26 + reg = <0x28>; 27 + clock-frequency = <400000>; 28 + 29 + interrupt-parent = <&gpio1>; 30 + interrupts = <17 GPIO_ACTIVE_HIGH>; 31 + 32 + enable-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>; 33 + firmware-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>; 34 + }; 35 + };
+33
Documentation/devicetree/bindings/net/nfc/st21nfca.txt
··· 1 + * STMicroelectronics SAS. ST21NFCA NFC Controller 2 + 3 + Required properties: 4 + - compatible: Should be "st,st21nfca-i2c". 5 + - clock-frequency: I²C work frequency. 6 + - reg: address on the bus 7 + - interrupt-parent: phandle for the interrupt gpio controller 8 + - interrupts: GPIO interrupt to which the chip is connected 9 + - enable-gpios: Output GPIO pin used for enabling/disabling the ST21NFCA 10 + 11 + Optional SoC Specific Properties: 12 + - pinctrl-names: Contains only one value - "default". 13 + - pintctrl-0: Specifies the pin control groups used for this controller. 14 + 15 + Example (for ARM-based BeagleBoard xM with ST21NFCA on I2C2): 16 + 17 + &i2c2 { 18 + 19 + status = "okay"; 20 + 21 + st21nfca: st21nfca@1 { 22 + 23 + compatible = "st,st21nfca_i2c"; 24 + 25 + reg = <0x01>; 26 + clock-frequency = <400000>; 27 + 28 + interrupt-parent = <&gpio5>; 29 + interrupts = <2 IRQ_TYPE_LEVEL_LOW>; 30 + 31 + enable-gpios = <&gpio5 29 GPIO_ACTIVE_HIGH>; 32 + }; 33 + };
+2
Documentation/devicetree/bindings/net/nfc/trf7970a.txt
··· 12 12 Optional SoC Specific Properties: 13 13 - pinctrl-names: Contains only one value - "default". 14 14 - pintctrl-0: Specifies the pin control groups used for this controller. 15 + - autosuspend-delay: Specify autosuspend delay in milliseconds. 15 16 16 17 Example (for ARM-based BeagleBone with TRF7970A on SPI1): 17 18 ··· 30 29 ti,enable-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>, 31 30 <&gpio2 5 GPIO_ACTIVE_LOW>; 32 31 vin-supply = <&ldo3_reg>; 32 + autosuspend-delay = <30000>; 33 33 status = "okay"; 34 34 }; 35 35 };
+1 -3
arch/arm/mach-tegra/board-paz00.c
··· 23 23 #include "board.h" 24 24 25 25 static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = { 26 - .name = "wifi_rfkill", 27 - .reset_gpio = 25, /* PD1 */ 28 - .shutdown_gpio = 85, /* PK5 */ 26 + .name = "wifi_rfkill", 29 27 .type = RFKILL_TYPE_WLAN, 30 28 }; 31 29
+1
arch/mips/bcm47xx/sprom.c
··· 168 168 static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom, 169 169 const char *prefix, bool fallback) 170 170 { 171 + nvram_read_u16(prefix, NULL, "devid", &sprom->dev_id, 0, fallback); 171 172 nvram_read_u8(prefix, NULL, "ledbh0", &sprom->gpio0, 0xff, fallback); 172 173 nvram_read_u8(prefix, NULL, "ledbh1", &sprom->gpio1, 0xff, fallback); 173 174 nvram_read_u8(prefix, NULL, "ledbh2", &sprom->gpio2, 0xff, fallback);
+6 -12
drivers/mmc/host/mmc_spi.c
··· 448 448 { 449 449 struct scratch *data = host->data; 450 450 u8 *cp = data->status; 451 - u32 arg = cmd->arg; 452 451 int status; 453 452 struct spi_transfer *t; 454 453 ··· 464 465 * We init the whole buffer to all-ones, which is what we need 465 466 * to write while we're reading (later) response data. 466 467 */ 467 - memset(cp++, 0xff, sizeof(data->status)); 468 + memset(cp, 0xff, sizeof(data->status)); 468 469 469 - *cp++ = 0x40 | cmd->opcode; 470 - *cp++ = (u8)(arg >> 24); 471 - *cp++ = (u8)(arg >> 16); 472 - *cp++ = (u8)(arg >> 8); 473 - *cp++ = (u8)arg; 474 - *cp++ = (crc7(0, &data->status[1], 5) << 1) | 0x01; 470 + cp[1] = 0x40 | cmd->opcode; 471 + put_unaligned_be32(cmd->arg, cp+2); 472 + cp[6] = crc7_be(0, cp+1, 5) | 0x01; 473 + cp += 7; 475 474 476 475 /* Then, read up to 13 bytes (while writing all-ones): 477 476 * - N(CR) (== 1..8) bytes of all-ones ··· 708 711 * so we have to cope with this situation and check the response 709 712 * bit-by-bit. Arggh!!! 710 713 */ 711 - pattern = scratch->status[0] << 24; 712 - pattern |= scratch->status[1] << 16; 713 - pattern |= scratch->status[2] << 8; 714 - pattern |= scratch->status[3]; 714 + pattern = get_unaligned_be32(scratch->status); 715 715 716 716 /* First 3 bit of pattern are undefined */ 717 717 pattern |= 0xE0000000;
+4 -2
drivers/net/wireless/ath/ath10k/core.c
··· 680 680 681 681 switch (ar->state) { 682 682 case ATH10K_STATE_ON: 683 - ath10k_halt(ar); 684 683 ar->state = ATH10K_STATE_RESTARTING; 684 + ath10k_halt(ar); 685 685 ieee80211_restart_hw(ar->hw); 686 686 break; 687 687 case ATH10K_STATE_OFF: ··· 908 908 lockdep_assert_held(&ar->conf_mutex); 909 909 910 910 /* try to suspend target */ 911 - ath10k_wait_for_suspend(ar, WMI_PDEV_SUSPEND_AND_DISABLE_INTR); 911 + if (ar->state != ATH10K_STATE_RESTARTING) 912 + ath10k_wait_for_suspend(ar, WMI_PDEV_SUSPEND_AND_DISABLE_INTR); 913 + 912 914 ath10k_debug_stop(ar); 913 915 ath10k_htc_stop(&ar->htc); 914 916 ath10k_htt_detach(&ar->htt);
+16
drivers/net/wireless/ath/ath10k/mac.c
··· 2291 2291 */ 2292 2292 void ath10k_halt(struct ath10k *ar) 2293 2293 { 2294 + struct ath10k_vif *arvif; 2295 + 2294 2296 lockdep_assert_held(&ar->conf_mutex); 2295 2297 2296 2298 if (ath10k_monitor_is_enabled(ar)) { ··· 2314 2312 del_timer(&ar->scan.timeout); 2315 2313 ar->scan.in_progress = false; 2316 2314 ieee80211_scan_completed(ar->hw, true); 2315 + } 2316 + 2317 + list_for_each_entry(arvif, &ar->arvifs, list) { 2318 + if (!arvif->beacon) 2319 + continue; 2320 + 2321 + dma_unmap_single(arvif->ar->dev, 2322 + ATH10K_SKB_CB(arvif->beacon)->paddr, 2323 + arvif->beacon->len, DMA_TO_DEVICE); 2324 + dev_kfree_skb_any(arvif->beacon); 2325 + arvif->beacon = NULL; 2317 2326 } 2318 2327 spin_unlock_bh(&ar->data_lock); 2319 2328 } ··· 2784 2771 2785 2772 spin_lock_bh(&ar->data_lock); 2786 2773 if (arvif->beacon) { 2774 + dma_unmap_single(arvif->ar->dev, 2775 + ATH10K_SKB_CB(arvif->beacon)->paddr, 2776 + arvif->beacon->len, DMA_TO_DEVICE); 2787 2777 dev_kfree_skb_any(arvif->beacon); 2788 2778 arvif->beacon = NULL; 2789 2779 }
+17 -1
drivers/net/wireless/ath/ath10k/pci.c
··· 2452 2452 if (val == 0xffffffff) 2453 2453 continue; 2454 2454 2455 + /* the device has crashed so don't bother trying anymore */ 2456 + if (val & FW_IND_EVENT_PENDING) 2457 + break; 2458 + 2455 2459 if (val & FW_IND_INITIALIZED) 2456 2460 break; 2457 2461 ··· 2468 2464 mdelay(10); 2469 2465 } while (time_before(jiffies, timeout)); 2470 2466 2471 - if (val == 0xffffffff || !(val & FW_IND_INITIALIZED)) { 2467 + if (val == 0xffffffff) { 2468 + ath10k_err("failed to read device register, device is gone\n"); 2469 + ret = -EIO; 2470 + goto out; 2471 + } 2472 + 2473 + if (val & FW_IND_EVENT_PENDING) { 2474 + ath10k_warn("device has crashed during init\n"); 2475 + ret = -ECOMM; 2476 + goto out; 2477 + } 2478 + 2479 + if (!(val & FW_IND_INITIALIZED)) { 2472 2480 ath10k_err("failed to receive initialized event from target: %08x\n", 2473 2481 val); 2474 2482 ret = -ETIMEDOUT;
+2
drivers/net/wireless/ath/ath10k/wmi.c
··· 1431 1431 ATH10K_SKB_CB(arvif->beacon)->paddr, 1432 1432 arvif->beacon->len, DMA_TO_DEVICE); 1433 1433 dev_kfree_skb_any(arvif->beacon); 1434 + arvif->beacon = NULL; 1434 1435 } 1435 1436 1436 1437 ATH10K_SKB_CB(bcn)->paddr = dma_map_single(arvif->ar->dev, ··· 1441 1440 ATH10K_SKB_CB(bcn)->paddr); 1442 1441 if (ret) { 1443 1442 ath10k_warn("failed to map beacon: %d\n", ret); 1443 + dev_kfree_skb_any(bcn); 1444 1444 goto skip; 1445 1445 } 1446 1446
+4 -3
drivers/net/wireless/ath/ath6kl/cfg80211.c
··· 1759 1759 } 1760 1760 1761 1761 static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, 1762 - u8 *mac, struct station_info *sinfo) 1762 + const u8 *mac, struct station_info *sinfo) 1763 1763 { 1764 1764 struct ath6kl *ar = ath6kl_priv(dev); 1765 1765 struct ath6kl_vif *vif = netdev_priv(dev); ··· 2974 2974 static const u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 2975 2975 2976 2976 static int ath6kl_del_station(struct wiphy *wiphy, struct net_device *dev, 2977 - u8 *mac) 2977 + const u8 *mac) 2978 2978 { 2979 2979 struct ath6kl *ar = ath6kl_priv(dev); 2980 2980 struct ath6kl_vif *vif = netdev_priv(dev); ··· 2985 2985 } 2986 2986 2987 2987 static int ath6kl_change_station(struct wiphy *wiphy, struct net_device *dev, 2988 - u8 *mac, struct station_parameters *params) 2988 + const u8 *mac, 2989 + struct station_parameters *params) 2989 2990 { 2990 2991 struct ath6kl *ar = ath6kl_priv(dev); 2991 2992 struct ath6kl_vif *vif = netdev_priv(dev);
+1 -1
drivers/net/wireless/ath/ath6kl/wmi.c
··· 2320 2320 return ret; 2321 2321 } 2322 2322 2323 - int ath6kl_wmi_add_krk_cmd(struct wmi *wmi, u8 if_idx, u8 *krk) 2323 + int ath6kl_wmi_add_krk_cmd(struct wmi *wmi, u8 if_idx, const u8 *krk) 2324 2324 { 2325 2325 struct sk_buff *skb; 2326 2326 struct wmi_add_krk_cmd *cmd;
+1 -1
drivers/net/wireless/ath/ath6kl/wmi.h
··· 2616 2616 u8 *key_material, 2617 2617 u8 key_op_ctrl, u8 *mac_addr, 2618 2618 enum wmi_sync_flag sync_flag); 2619 - int ath6kl_wmi_add_krk_cmd(struct wmi *wmi, u8 if_idx, u8 *krk); 2619 + int ath6kl_wmi_add_krk_cmd(struct wmi *wmi, u8 if_idx, const u8 *krk); 2620 2620 int ath6kl_wmi_deletekey_cmd(struct wmi *wmi, u8 if_idx, u8 key_index); 2621 2621 int ath6kl_wmi_setpmkid_cmd(struct wmi *wmi, u8 if_idx, const u8 *bssid, 2622 2622 const u8 *pmkid, bool set);
+2 -1
drivers/net/wireless/ath/ath9k/Makefile
··· 53 53 obj-$(CONFIG_ATH9K_COMMON) += ath9k_common.o 54 54 ath9k_common-y:= common.o \ 55 55 common-init.o \ 56 - common-beacon.o 56 + common-beacon.o \ 57 + common-debug.o 57 58 58 59 ath9k_htc-y += htc_hst.o \ 59 60 hif_usb.o \
+2 -1
drivers/net/wireless/ath/ath9k/ath9k.h
··· 23 23 #include <linux/leds.h> 24 24 #include <linux/completion.h> 25 25 26 - #include "debug.h" 27 26 #include "common.h" 27 + #include "debug.h" 28 28 #include "mci.h" 29 29 #include "dfs.h" 30 30 #include "spectral.h" ··· 274 274 #ifdef CONFIG_ATH9K_STATION_STATISTICS 275 275 struct ath_rx_rate_stats rx_rate_stats; 276 276 #endif 277 + u8 key_idx[4]; 277 278 }; 278 279 279 280 struct ath_tx_control {
+3 -2
drivers/net/wireless/ath/ath9k/beacon.c
··· 537 537 cur_conf->dtim_period = bss_conf->dtim_period; 538 538 cur_conf->dtim_count = 1; 539 539 cur_conf->ibss_creator = bss_conf->ibss_creator; 540 - cur_conf->bmiss_timeout = 541 - ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval; 542 540 543 541 /* 544 542 * It looks like mac80211 may end up using beacon interval of zero in ··· 546 548 */ 547 549 if (cur_conf->beacon_interval == 0) 548 550 cur_conf->beacon_interval = 100; 551 + 552 + cur_conf->bmiss_timeout = 553 + ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval; 549 554 550 555 /* 551 556 * We don't parse dtim period from mac80211 during the driver
+253
drivers/net/wireless/ath/ath9k/common-debug.c
··· 1 + /* 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 + * 4 + * Permission to use, copy, modify, and/or distribute this software for any 5 + * purpose with or without fee is hereby granted, provided that the above 6 + * copyright notice and this permission notice appear in all copies. 7 + * 8 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 + */ 16 + 17 + #include "common.h" 18 + 19 + static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, 20 + size_t count, loff_t *ppos) 21 + { 22 + struct ath_hw *ah = file->private_data; 23 + u32 len = 0, size = 6000; 24 + char *buf; 25 + size_t retval; 26 + 27 + buf = kzalloc(size, GFP_KERNEL); 28 + if (buf == NULL) 29 + return -ENOMEM; 30 + 31 + len = ah->eep_ops->dump_eeprom(ah, false, buf, len, size); 32 + 33 + retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 34 + kfree(buf); 35 + 36 + return retval; 37 + } 38 + 39 + static const struct file_operations fops_modal_eeprom = { 40 + .read = read_file_modal_eeprom, 41 + .open = simple_open, 42 + .owner = THIS_MODULE, 43 + .llseek = default_llseek, 44 + }; 45 + 46 + 47 + void ath9k_cmn_debug_modal_eeprom(struct dentry *debugfs_phy, 48 + struct ath_hw *ah) 49 + { 50 + debugfs_create_file("modal_eeprom", S_IRUSR, debugfs_phy, ah, 51 + &fops_modal_eeprom); 52 + } 53 + EXPORT_SYMBOL(ath9k_cmn_debug_modal_eeprom); 54 + 55 + static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, 56 + size_t count, loff_t *ppos) 57 + { 58 + struct ath_hw *ah = file->private_data; 59 + u32 len = 0, size = 1500; 60 + ssize_t retval = 0; 61 + char *buf; 62 + 63 + buf = kzalloc(size, GFP_KERNEL); 64 + if (!buf) 65 + return -ENOMEM; 66 + 67 + len = ah->eep_ops->dump_eeprom(ah, true, buf, len, size); 68 + 69 + retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 70 + kfree(buf); 71 + 72 + return retval; 73 + } 74 + 75 + static const struct file_operations fops_base_eeprom = { 76 + .read = read_file_base_eeprom, 77 + .open = simple_open, 78 + .owner = THIS_MODULE, 79 + .llseek = default_llseek, 80 + }; 81 + 82 + void ath9k_cmn_debug_base_eeprom(struct dentry *debugfs_phy, 83 + struct ath_hw *ah) 84 + { 85 + debugfs_create_file("base_eeprom", S_IRUSR, debugfs_phy, ah, 86 + &fops_base_eeprom); 87 + } 88 + EXPORT_SYMBOL(ath9k_cmn_debug_base_eeprom); 89 + 90 + void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats, 91 + struct ath_rx_status *rs) 92 + { 93 + #define RX_PHY_ERR_INC(c) rxstats->phy_err_stats[c]++ 94 + #define RX_CMN_STAT_INC(c) (rxstats->c++) 95 + 96 + RX_CMN_STAT_INC(rx_pkts_all); 97 + rxstats->rx_bytes_all += rs->rs_datalen; 98 + 99 + if (rs->rs_status & ATH9K_RXERR_CRC) 100 + RX_CMN_STAT_INC(crc_err); 101 + if (rs->rs_status & ATH9K_RXERR_DECRYPT) 102 + RX_CMN_STAT_INC(decrypt_crc_err); 103 + if (rs->rs_status & ATH9K_RXERR_MIC) 104 + RX_CMN_STAT_INC(mic_err); 105 + if (rs->rs_status & ATH9K_RX_DELIM_CRC_PRE) 106 + RX_CMN_STAT_INC(pre_delim_crc_err); 107 + if (rs->rs_status & ATH9K_RX_DELIM_CRC_POST) 108 + RX_CMN_STAT_INC(post_delim_crc_err); 109 + if (rs->rs_status & ATH9K_RX_DECRYPT_BUSY) 110 + RX_CMN_STAT_INC(decrypt_busy_err); 111 + 112 + if (rs->rs_status & ATH9K_RXERR_PHY) { 113 + RX_CMN_STAT_INC(phy_err); 114 + if (rs->rs_phyerr < ATH9K_PHYERR_MAX) 115 + RX_PHY_ERR_INC(rs->rs_phyerr); 116 + } 117 + 118 + #undef RX_CMN_STAT_INC 119 + #undef RX_PHY_ERR_INC 120 + } 121 + EXPORT_SYMBOL(ath9k_cmn_debug_stat_rx); 122 + 123 + static ssize_t read_file_recv(struct file *file, char __user *user_buf, 124 + size_t count, loff_t *ppos) 125 + { 126 + #define RXS_ERR(s, e) \ 127 + do { \ 128 + len += scnprintf(buf + len, size - len, \ 129 + "%18s : %10u\n", s, \ 130 + rxstats->e); \ 131 + } while (0) 132 + 133 + struct ath_rx_stats *rxstats = file->private_data; 134 + char *buf; 135 + unsigned int len = 0, size = 1600; 136 + ssize_t retval = 0; 137 + 138 + buf = kzalloc(size, GFP_KERNEL); 139 + if (buf == NULL) 140 + return -ENOMEM; 141 + 142 + RXS_ERR("PKTS-ALL", rx_pkts_all); 143 + RXS_ERR("BYTES-ALL", rx_bytes_all); 144 + RXS_ERR("BEACONS", rx_beacons); 145 + RXS_ERR("FRAGS", rx_frags); 146 + RXS_ERR("SPECTRAL", rx_spectral); 147 + 148 + RXS_ERR("CRC ERR", crc_err); 149 + RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err); 150 + RXS_ERR("PHY ERR", phy_err); 151 + RXS_ERR("MIC ERR", mic_err); 152 + RXS_ERR("PRE-DELIM CRC ERR", pre_delim_crc_err); 153 + RXS_ERR("POST-DELIM CRC ERR", post_delim_crc_err); 154 + RXS_ERR("DECRYPT BUSY ERR", decrypt_busy_err); 155 + RXS_ERR("LENGTH-ERR", rx_len_err); 156 + RXS_ERR("OOM-ERR", rx_oom_err); 157 + RXS_ERR("RATE-ERR", rx_rate_err); 158 + RXS_ERR("TOO-MANY-FRAGS", rx_too_many_frags_err); 159 + 160 + if (len > size) 161 + len = size; 162 + 163 + retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 164 + kfree(buf); 165 + 166 + return retval; 167 + 168 + #undef RXS_ERR 169 + } 170 + 171 + static const struct file_operations fops_recv = { 172 + .read = read_file_recv, 173 + .open = simple_open, 174 + .owner = THIS_MODULE, 175 + .llseek = default_llseek, 176 + }; 177 + 178 + void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, 179 + struct ath_rx_stats *rxstats) 180 + { 181 + debugfs_create_file("recv", S_IRUSR, debugfs_phy, rxstats, 182 + &fops_recv); 183 + } 184 + EXPORT_SYMBOL(ath9k_cmn_debug_recv); 185 + 186 + static ssize_t read_file_phy_err(struct file *file, char __user *user_buf, 187 + size_t count, loff_t *ppos) 188 + { 189 + #define PHY_ERR(s, p) \ 190 + len += scnprintf(buf + len, size - len, "%22s : %10u\n", s, \ 191 + rxstats->phy_err_stats[p]); 192 + 193 + struct ath_rx_stats *rxstats = file->private_data; 194 + char *buf; 195 + unsigned int len = 0, size = 1600; 196 + ssize_t retval = 0; 197 + 198 + buf = kzalloc(size, GFP_KERNEL); 199 + if (buf == NULL) 200 + return -ENOMEM; 201 + 202 + PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN); 203 + PHY_ERR("TIMING ERR", ATH9K_PHYERR_TIMING); 204 + PHY_ERR("PARITY ERR", ATH9K_PHYERR_PARITY); 205 + PHY_ERR("RATE ERR", ATH9K_PHYERR_RATE); 206 + PHY_ERR("LENGTH ERR", ATH9K_PHYERR_LENGTH); 207 + PHY_ERR("RADAR ERR", ATH9K_PHYERR_RADAR); 208 + PHY_ERR("SERVICE ERR", ATH9K_PHYERR_SERVICE); 209 + PHY_ERR("TOR ERR", ATH9K_PHYERR_TOR); 210 + PHY_ERR("OFDM-TIMING ERR", ATH9K_PHYERR_OFDM_TIMING); 211 + PHY_ERR("OFDM-SIGNAL-PARITY ERR", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); 212 + PHY_ERR("OFDM-RATE ERR", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); 213 + PHY_ERR("OFDM-LENGTH ERR", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); 214 + PHY_ERR("OFDM-POWER-DROP ERR", ATH9K_PHYERR_OFDM_POWER_DROP); 215 + PHY_ERR("OFDM-SERVICE ERR", ATH9K_PHYERR_OFDM_SERVICE); 216 + PHY_ERR("OFDM-RESTART ERR", ATH9K_PHYERR_OFDM_RESTART); 217 + PHY_ERR("FALSE-RADAR-EXT ERR", ATH9K_PHYERR_FALSE_RADAR_EXT); 218 + PHY_ERR("CCK-TIMING ERR", ATH9K_PHYERR_CCK_TIMING); 219 + PHY_ERR("CCK-HEADER-CRC ERR", ATH9K_PHYERR_CCK_HEADER_CRC); 220 + PHY_ERR("CCK-RATE ERR", ATH9K_PHYERR_CCK_RATE_ILLEGAL); 221 + PHY_ERR("CCK-SERVICE ERR", ATH9K_PHYERR_CCK_SERVICE); 222 + PHY_ERR("CCK-RESTART ERR", ATH9K_PHYERR_CCK_RESTART); 223 + PHY_ERR("CCK-LENGTH ERR", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); 224 + PHY_ERR("CCK-POWER-DROP ERR", ATH9K_PHYERR_CCK_POWER_DROP); 225 + PHY_ERR("HT-CRC ERR", ATH9K_PHYERR_HT_CRC_ERROR); 226 + PHY_ERR("HT-LENGTH ERR", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); 227 + PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL); 228 + 229 + if (len > size) 230 + len = size; 231 + 232 + retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 233 + kfree(buf); 234 + 235 + return retval; 236 + 237 + #undef PHY_ERR 238 + } 239 + 240 + static const struct file_operations fops_phy_err = { 241 + .read = read_file_phy_err, 242 + .open = simple_open, 243 + .owner = THIS_MODULE, 244 + .llseek = default_llseek, 245 + }; 246 + 247 + void ath9k_cmn_debug_phy_err(struct dentry *debugfs_phy, 248 + struct ath_rx_stats *rxstats) 249 + { 250 + debugfs_create_file("phy_err", S_IRUSR, debugfs_phy, rxstats, 251 + &fops_phy_err); 252 + } 253 + EXPORT_SYMBOL(ath9k_cmn_debug_phy_err);
+72
drivers/net/wireless/ath/ath9k/common-debug.h
··· 1 + /* 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 + * 4 + * Permission to use, copy, modify, and/or distribute this software for any 5 + * purpose with or without fee is hereby granted, provided that the above 6 + * copyright notice and this permission notice appear in all copies. 7 + * 8 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 + */ 16 + 17 + 18 + 19 + /** 20 + * struct ath_rx_stats - RX Statistics 21 + * @rx_pkts_all: No. of total frames received, including ones that 22 + may have had errors. 23 + * @rx_bytes_all: No. of total bytes received, including ones that 24 + may have had errors. 25 + * @crc_err: No. of frames with incorrect CRC value 26 + * @decrypt_crc_err: No. of frames whose CRC check failed after 27 + decryption process completed 28 + * @phy_err: No. of frames whose reception failed because the PHY 29 + encountered an error 30 + * @mic_err: No. of frames with incorrect TKIP MIC verification failure 31 + * @pre_delim_crc_err: Pre-Frame delimiter CRC error detections 32 + * @post_delim_crc_err: Post-Frame delimiter CRC error detections 33 + * @decrypt_busy_err: Decryption interruptions counter 34 + * @phy_err_stats: Individual PHY error statistics 35 + * @rx_len_err: No. of frames discarded due to bad length. 36 + * @rx_oom_err: No. of frames dropped due to OOM issues. 37 + * @rx_rate_err: No. of frames dropped due to rate errors. 38 + * @rx_too_many_frags_err: Frames dropped due to too-many-frags received. 39 + * @rx_beacons: No. of beacons received. 40 + * @rx_frags: No. of rx-fragements received. 41 + * @rx_spectral: No of spectral packets received. 42 + */ 43 + struct ath_rx_stats { 44 + u32 rx_pkts_all; 45 + u32 rx_bytes_all; 46 + u32 crc_err; 47 + u32 decrypt_crc_err; 48 + u32 phy_err; 49 + u32 mic_err; 50 + u32 pre_delim_crc_err; 51 + u32 post_delim_crc_err; 52 + u32 decrypt_busy_err; 53 + u32 phy_err_stats[ATH9K_PHYERR_MAX]; 54 + u32 rx_len_err; 55 + u32 rx_oom_err; 56 + u32 rx_rate_err; 57 + u32 rx_too_many_frags_err; 58 + u32 rx_beacons; 59 + u32 rx_frags; 60 + u32 rx_spectral; 61 + }; 62 + 63 + void ath9k_cmn_debug_modal_eeprom(struct dentry *debugfs_phy, 64 + struct ath_hw *ah); 65 + void ath9k_cmn_debug_base_eeprom(struct dentry *debugfs_phy, 66 + struct ath_hw *ah); 67 + void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats, 68 + struct ath_rx_status *rs); 69 + void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, 70 + struct ath_rx_stats *rxstats); 71 + void ath9k_cmn_debug_phy_err(struct dentry *debugfs_phy, 72 + struct ath_rx_stats *rxstats);
+1
drivers/net/wireless/ath/ath9k/common.h
··· 23 23 24 24 #include "common-init.h" 25 25 #include "common-beacon.h" 26 + #include "common-debug.h" 26 27 27 28 /* Common header for Atheros 802.11n base driver cores */ 28 29
+9 -205
drivers/net/wireless/ath/ath9k/debug.c
··· 948 948 .llseek = default_llseek, 949 949 }; 950 950 951 - static ssize_t read_file_recv(struct file *file, char __user *user_buf, 952 - size_t count, loff_t *ppos) 953 - { 954 - #define RXS_ERR(s, e) \ 955 - do { \ 956 - len += scnprintf(buf + len, size - len, \ 957 - "%18s : %10u\n", s, \ 958 - sc->debug.stats.rxstats.e);\ 959 - } while (0) 960 - 961 - struct ath_softc *sc = file->private_data; 962 - char *buf; 963 - unsigned int len = 0, size = 1600; 964 - ssize_t retval = 0; 965 - 966 - buf = kzalloc(size, GFP_KERNEL); 967 - if (buf == NULL) 968 - return -ENOMEM; 969 - 970 - RXS_ERR("PKTS-ALL", rx_pkts_all); 971 - RXS_ERR("BYTES-ALL", rx_bytes_all); 972 - RXS_ERR("BEACONS", rx_beacons); 973 - RXS_ERR("FRAGS", rx_frags); 974 - RXS_ERR("SPECTRAL", rx_spectral); 975 - 976 - RXS_ERR("CRC ERR", crc_err); 977 - RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err); 978 - RXS_ERR("PHY ERR", phy_err); 979 - RXS_ERR("MIC ERR", mic_err); 980 - RXS_ERR("PRE-DELIM CRC ERR", pre_delim_crc_err); 981 - RXS_ERR("POST-DELIM CRC ERR", post_delim_crc_err); 982 - RXS_ERR("DECRYPT BUSY ERR", decrypt_busy_err); 983 - RXS_ERR("LENGTH-ERR", rx_len_err); 984 - RXS_ERR("OOM-ERR", rx_oom_err); 985 - RXS_ERR("RATE-ERR", rx_rate_err); 986 - RXS_ERR("TOO-MANY-FRAGS", rx_too_many_frags_err); 987 - 988 - if (len > size) 989 - len = size; 990 - 991 - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 992 - kfree(buf); 993 - 994 - return retval; 995 - 996 - #undef RXS_ERR 997 - } 998 - 999 951 void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) 1000 952 { 1001 - #define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++ 1002 - 1003 - RX_STAT_INC(rx_pkts_all); 1004 - sc->debug.stats.rxstats.rx_bytes_all += rs->rs_datalen; 1005 - 1006 - if (rs->rs_status & ATH9K_RXERR_CRC) 1007 - RX_STAT_INC(crc_err); 1008 - if (rs->rs_status & ATH9K_RXERR_DECRYPT) 1009 - RX_STAT_INC(decrypt_crc_err); 1010 - if (rs->rs_status & ATH9K_RXERR_MIC) 1011 - RX_STAT_INC(mic_err); 1012 - if (rs->rs_status & ATH9K_RX_DELIM_CRC_PRE) 1013 - RX_STAT_INC(pre_delim_crc_err); 1014 - if (rs->rs_status & ATH9K_RX_DELIM_CRC_POST) 1015 - RX_STAT_INC(post_delim_crc_err); 1016 - if (rs->rs_status & ATH9K_RX_DECRYPT_BUSY) 1017 - RX_STAT_INC(decrypt_busy_err); 1018 - 1019 - if (rs->rs_status & ATH9K_RXERR_PHY) { 1020 - RX_STAT_INC(phy_err); 1021 - if (rs->rs_phyerr < ATH9K_PHYERR_MAX) 1022 - RX_PHY_ERR_INC(rs->rs_phyerr); 1023 - } 1024 - 1025 - #undef RX_PHY_ERR_INC 953 + ath9k_cmn_debug_stat_rx(&sc->debug.stats.rxstats, rs); 1026 954 } 1027 - 1028 - static const struct file_operations fops_recv = { 1029 - .read = read_file_recv, 1030 - .open = simple_open, 1031 - .owner = THIS_MODULE, 1032 - .llseek = default_llseek, 1033 - }; 1034 - 1035 - static ssize_t read_file_phy_err(struct file *file, char __user *user_buf, 1036 - size_t count, loff_t *ppos) 1037 - { 1038 - #define PHY_ERR(s, p) \ 1039 - len += scnprintf(buf + len, size - len, "%22s : %10u\n", s, \ 1040 - sc->debug.stats.rxstats.phy_err_stats[p]); 1041 - 1042 - struct ath_softc *sc = file->private_data; 1043 - char *buf; 1044 - unsigned int len = 0, size = 1600; 1045 - ssize_t retval = 0; 1046 - 1047 - buf = kzalloc(size, GFP_KERNEL); 1048 - if (buf == NULL) 1049 - return -ENOMEM; 1050 - 1051 - PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN); 1052 - PHY_ERR("TIMING ERR", ATH9K_PHYERR_TIMING); 1053 - PHY_ERR("PARITY ERR", ATH9K_PHYERR_PARITY); 1054 - PHY_ERR("RATE ERR", ATH9K_PHYERR_RATE); 1055 - PHY_ERR("LENGTH ERR", ATH9K_PHYERR_LENGTH); 1056 - PHY_ERR("RADAR ERR", ATH9K_PHYERR_RADAR); 1057 - PHY_ERR("SERVICE ERR", ATH9K_PHYERR_SERVICE); 1058 - PHY_ERR("TOR ERR", ATH9K_PHYERR_TOR); 1059 - PHY_ERR("OFDM-TIMING ERR", ATH9K_PHYERR_OFDM_TIMING); 1060 - PHY_ERR("OFDM-SIGNAL-PARITY ERR", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); 1061 - PHY_ERR("OFDM-RATE ERR", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); 1062 - PHY_ERR("OFDM-LENGTH ERR", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); 1063 - PHY_ERR("OFDM-POWER-DROP ERR", ATH9K_PHYERR_OFDM_POWER_DROP); 1064 - PHY_ERR("OFDM-SERVICE ERR", ATH9K_PHYERR_OFDM_SERVICE); 1065 - PHY_ERR("OFDM-RESTART ERR", ATH9K_PHYERR_OFDM_RESTART); 1066 - PHY_ERR("FALSE-RADAR-EXT ERR", ATH9K_PHYERR_FALSE_RADAR_EXT); 1067 - PHY_ERR("CCK-TIMING ERR", ATH9K_PHYERR_CCK_TIMING); 1068 - PHY_ERR("CCK-HEADER-CRC ERR", ATH9K_PHYERR_CCK_HEADER_CRC); 1069 - PHY_ERR("CCK-RATE ERR", ATH9K_PHYERR_CCK_RATE_ILLEGAL); 1070 - PHY_ERR("CCK-SERVICE ERR", ATH9K_PHYERR_CCK_SERVICE); 1071 - PHY_ERR("CCK-RESTART ERR", ATH9K_PHYERR_CCK_RESTART); 1072 - PHY_ERR("CCK-LENGTH ERR", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); 1073 - PHY_ERR("CCK-POWER-DROP ERR", ATH9K_PHYERR_CCK_POWER_DROP); 1074 - PHY_ERR("HT-CRC ERR", ATH9K_PHYERR_HT_CRC_ERROR); 1075 - PHY_ERR("HT-LENGTH ERR", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); 1076 - PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL); 1077 - 1078 - if (len > size) 1079 - len = size; 1080 - 1081 - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 1082 - kfree(buf); 1083 - 1084 - return retval; 1085 - 1086 - #undef PHY_ERR 1087 - } 1088 - 1089 - static const struct file_operations fops_phy_err = { 1090 - .read = read_file_phy_err, 1091 - .open = simple_open, 1092 - .owner = THIS_MODULE, 1093 - .llseek = default_llseek, 1094 - }; 1095 955 1096 956 static ssize_t read_file_regidx(struct file *file, char __user *user_buf, 1097 957 size_t count, loff_t *ppos) ··· 1123 1263 1124 1264 static const struct file_operations fops_dump_nfcal = { 1125 1265 .read = read_file_dump_nfcal, 1126 - .open = simple_open, 1127 - .owner = THIS_MODULE, 1128 - .llseek = default_llseek, 1129 - }; 1130 - 1131 - static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, 1132 - size_t count, loff_t *ppos) 1133 - { 1134 - struct ath_softc *sc = file->private_data; 1135 - struct ath_hw *ah = sc->sc_ah; 1136 - u32 len = 0, size = 1500; 1137 - ssize_t retval = 0; 1138 - char *buf; 1139 - 1140 - buf = kzalloc(size, GFP_KERNEL); 1141 - if (!buf) 1142 - return -ENOMEM; 1143 - 1144 - len = ah->eep_ops->dump_eeprom(ah, true, buf, len, size); 1145 - 1146 - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 1147 - kfree(buf); 1148 - 1149 - return retval; 1150 - } 1151 - 1152 - static const struct file_operations fops_base_eeprom = { 1153 - .read = read_file_base_eeprom, 1154 - .open = simple_open, 1155 - .owner = THIS_MODULE, 1156 - .llseek = default_llseek, 1157 - }; 1158 - 1159 - static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, 1160 - size_t count, loff_t *ppos) 1161 - { 1162 - struct ath_softc *sc = file->private_data; 1163 - struct ath_hw *ah = sc->sc_ah; 1164 - u32 len = 0, size = 6000; 1165 - char *buf; 1166 - size_t retval; 1167 - 1168 - buf = kzalloc(size, GFP_KERNEL); 1169 - if (buf == NULL) 1170 - return -ENOMEM; 1171 - 1172 - len = ah->eep_ops->dump_eeprom(ah, false, buf, len, size); 1173 - 1174 - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 1175 - kfree(buf); 1176 - 1177 - return retval; 1178 - } 1179 - 1180 - static const struct file_operations fops_modal_eeprom = { 1181 - .read = read_file_modal_eeprom, 1182 1266 .open = simple_open, 1183 1267 .owner = THIS_MODULE, 1184 1268 .llseek = default_llseek, ··· 1328 1524 &fops_misc); 1329 1525 debugfs_create_file("reset", S_IRUSR, sc->debug.debugfs_phy, sc, 1330 1526 &fops_reset); 1331 - debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, sc, 1332 - &fops_recv); 1333 - debugfs_create_file("phy_err", S_IRUSR, sc->debug.debugfs_phy, sc, 1334 - &fops_phy_err); 1527 + 1528 + ath9k_cmn_debug_recv(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); 1529 + ath9k_cmn_debug_phy_err(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); 1530 + 1335 1531 debugfs_create_u8("rx_chainmask", S_IRUSR, sc->debug.debugfs_phy, 1336 1532 &ah->rxchainmask); 1337 1533 debugfs_create_u8("tx_chainmask", S_IRUSR, sc->debug.debugfs_phy, ··· 1351 1547 &fops_regdump); 1352 1548 debugfs_create_file("dump_nfcal", S_IRUSR, sc->debug.debugfs_phy, sc, 1353 1549 &fops_dump_nfcal); 1354 - debugfs_create_file("base_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, 1355 - &fops_base_eeprom); 1356 - debugfs_create_file("modal_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, 1357 - &fops_modal_eeprom); 1550 + 1551 + ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); 1552 + ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); 1553 + 1358 1554 debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, 1359 1555 sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); 1360 1556 debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR,
-44
drivers/net/wireless/ath/ath9k/debug.h
··· 221 221 } cck_stats[4]; 222 222 }; 223 223 224 - /** 225 - * struct ath_rx_stats - RX Statistics 226 - * @rx_pkts_all: No. of total frames received, including ones that 227 - may have had errors. 228 - * @rx_bytes_all: No. of total bytes received, including ones that 229 - may have had errors. 230 - * @crc_err: No. of frames with incorrect CRC value 231 - * @decrypt_crc_err: No. of frames whose CRC check failed after 232 - decryption process completed 233 - * @phy_err: No. of frames whose reception failed because the PHY 234 - encountered an error 235 - * @mic_err: No. of frames with incorrect TKIP MIC verification failure 236 - * @pre_delim_crc_err: Pre-Frame delimiter CRC error detections 237 - * @post_delim_crc_err: Post-Frame delimiter CRC error detections 238 - * @decrypt_busy_err: Decryption interruptions counter 239 - * @phy_err_stats: Individual PHY error statistics 240 - * @rx_len_err: No. of frames discarded due to bad length. 241 - * @rx_oom_err: No. of frames dropped due to OOM issues. 242 - * @rx_rate_err: No. of frames dropped due to rate errors. 243 - * @rx_too_many_frags_err: Frames dropped due to too-many-frags received. 244 - * @rx_beacons: No. of beacons received. 245 - * @rx_frags: No. of rx-fragements received. 246 - * @rx_spectral: No of spectral packets received. 247 - */ 248 - struct ath_rx_stats { 249 - u32 rx_pkts_all; 250 - u32 rx_bytes_all; 251 - u32 crc_err; 252 - u32 decrypt_crc_err; 253 - u32 phy_err; 254 - u32 mic_err; 255 - u32 pre_delim_crc_err; 256 - u32 post_delim_crc_err; 257 - u32 decrypt_busy_err; 258 - u32 phy_err_stats[ATH9K_PHYERR_MAX]; 259 - u32 rx_len_err; 260 - u32 rx_oom_err; 261 - u32 rx_rate_err; 262 - u32 rx_too_many_frags_err; 263 - u32 rx_beacons; 264 - u32 rx_frags; 265 - u32 rx_spectral; 266 - }; 267 - 268 224 #define ANT_MAIN 0 269 225 #define ANT_ALT 1 270 226
+5 -3
drivers/net/wireless/ath/ath9k/dfs.c
··· 178 178 pe.ts = mactime; 179 179 if (ath9k_postprocess_radar_event(sc, &ard, &pe)) { 180 180 struct dfs_pattern_detector *pd = sc->dfs_detector; 181 - static u64 last_ts; 181 + #ifdef CONFIG_ATH9K_DEBUGFS 182 182 ath_dbg(common, DFS, 183 183 "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, " 184 184 "width=%d, rssi=%d, delta_ts=%llu\n", 185 - pe.freq, pe.ts, pe.width, pe.rssi, pe.ts-last_ts); 186 - last_ts = pe.ts; 185 + pe.freq, pe.ts, pe.width, pe.rssi, 186 + pe.ts - sc->debug.stats.dfs_stats.last_ts); 187 + sc->debug.stats.dfs_stats.last_ts = pe.ts; 188 + #endif 187 189 DFS_STAT_INC(sc, pulses_processed); 188 190 if (pd != NULL && pd->add_pulse(pd, &pe)) { 189 191 DFS_STAT_INC(sc, radar_detected);
+1
drivers/net/wireless/ath/ath9k/dfs_debug.h
··· 51 51 /* pattern detection stats */ 52 52 u32 pulses_processed; 53 53 u32 radar_detected; 54 + u64 last_ts; 54 55 }; 55 56 56 57 #if defined(CONFIG_ATH9K_DFS_DEBUGFS)
+6 -13
drivers/net/wireless/ath/ath9k/htc.h
··· 325 325 326 326 #define TX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) 327 327 #define TX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) 328 - #define RX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.rx_stats.c++) 329 - #define RX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.rx_stats.c += a) 328 + #define RX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) 329 + #define RX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a) 330 330 #define CAB_STAT_INC priv->debug.tx_stats.cab_queued++ 331 331 332 332 #define TX_QSTAT_INC(q) (priv->debug.tx_stats.queue_stats[q]++) 333 333 334 334 void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, 335 - struct ath_htc_rx_status *rxs); 335 + struct ath_rx_status *rs); 336 336 337 337 struct ath_tx_stats { 338 338 u32 buf_queued; ··· 345 345 u32 queue_stats[IEEE80211_NUM_ACS]; 346 346 }; 347 347 348 - struct ath_rx_stats { 348 + struct ath_skbrx_stats { 349 349 u32 skb_allocated; 350 350 u32 skb_completed; 351 351 u32 skb_completed_bytes; 352 352 u32 skb_dropped; 353 - u32 err_crc; 354 - u32 err_decrypt_crc; 355 - u32 err_mic; 356 - u32 err_pre_delim; 357 - u32 err_post_delim; 358 - u32 err_decrypt_busy; 359 - u32 err_phy; 360 - u32 err_phy_stats[ATH9K_PHYERR_MAX]; 361 353 }; 362 354 363 355 struct ath9k_debug { 364 356 struct dentry *debugfs_phy; 365 357 struct ath_tx_stats tx_stats; 366 358 struct ath_rx_stats rx_stats; 359 + struct ath_skbrx_stats skbrx_stats; 367 360 }; 368 361 369 362 void ath9k_htc_get_et_strings(struct ieee80211_hw *hw, ··· 378 385 #define TX_QSTAT_INC(c) do { } while (0) 379 386 380 387 static inline void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, 381 - struct ath_htc_rx_status *rxs) 388 + struct ath_rx_status *rs) 382 389 { 383 390 } 384 391
+33 -522
drivers/net/wireless/ath/ath9k/htc_drv_debug.c
··· 243 243 }; 244 244 245 245 void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, 246 - struct ath_htc_rx_status *rxs) 246 + struct ath_rx_status *rs) 247 247 { 248 - #define RX_PHY_ERR_INC(c) priv->debug.rx_stats.err_phy_stats[c]++ 249 - 250 - if (rxs->rs_status & ATH9K_RXERR_CRC) 251 - priv->debug.rx_stats.err_crc++; 252 - if (rxs->rs_status & ATH9K_RXERR_DECRYPT) 253 - priv->debug.rx_stats.err_decrypt_crc++; 254 - if (rxs->rs_status & ATH9K_RXERR_MIC) 255 - priv->debug.rx_stats.err_mic++; 256 - if (rxs->rs_status & ATH9K_RX_DELIM_CRC_PRE) 257 - priv->debug.rx_stats.err_pre_delim++; 258 - if (rxs->rs_status & ATH9K_RX_DELIM_CRC_POST) 259 - priv->debug.rx_stats.err_post_delim++; 260 - if (rxs->rs_status & ATH9K_RX_DECRYPT_BUSY) 261 - priv->debug.rx_stats.err_decrypt_busy++; 262 - 263 - if (rxs->rs_status & ATH9K_RXERR_PHY) { 264 - priv->debug.rx_stats.err_phy++; 265 - if (rxs->rs_phyerr < ATH9K_PHYERR_MAX) 266 - RX_PHY_ERR_INC(rxs->rs_phyerr); 267 - } 268 - 269 - #undef RX_PHY_ERR_INC 248 + ath9k_cmn_debug_stat_rx(&priv->debug.rx_stats, rs); 270 249 } 271 250 272 - static ssize_t read_file_recv(struct file *file, char __user *user_buf, 251 + static ssize_t read_file_skb_rx(struct file *file, char __user *user_buf, 273 252 size_t count, loff_t *ppos) 274 253 { 275 - #define PHY_ERR(s, p) \ 276 - len += scnprintf(buf + len, size - len, "%20s : %10u\n", s, \ 277 - priv->debug.rx_stats.err_phy_stats[p]); 278 - 279 254 struct ath9k_htc_priv *priv = file->private_data; 280 255 char *buf; 281 256 unsigned int len = 0, size = 1500; ··· 262 287 263 288 len += scnprintf(buf + len, size - len, 264 289 "%20s : %10u\n", "SKBs allocated", 265 - priv->debug.rx_stats.skb_allocated); 290 + priv->debug.skbrx_stats.skb_allocated); 266 291 len += scnprintf(buf + len, size - len, 267 292 "%20s : %10u\n", "SKBs completed", 268 - priv->debug.rx_stats.skb_completed); 293 + priv->debug.skbrx_stats.skb_completed); 269 294 len += scnprintf(buf + len, size - len, 270 295 "%20s : %10u\n", "SKBs Dropped", 271 - priv->debug.rx_stats.skb_dropped); 272 - 273 - len += scnprintf(buf + len, size - len, 274 - "%20s : %10u\n", "CRC ERR", 275 - priv->debug.rx_stats.err_crc); 276 - len += scnprintf(buf + len, size - len, 277 - "%20s : %10u\n", "DECRYPT CRC ERR", 278 - priv->debug.rx_stats.err_decrypt_crc); 279 - len += scnprintf(buf + len, size - len, 280 - "%20s : %10u\n", "MIC ERR", 281 - priv->debug.rx_stats.err_mic); 282 - len += scnprintf(buf + len, size - len, 283 - "%20s : %10u\n", "PRE-DELIM CRC ERR", 284 - priv->debug.rx_stats.err_pre_delim); 285 - len += scnprintf(buf + len, size - len, 286 - "%20s : %10u\n", "POST-DELIM CRC ERR", 287 - priv->debug.rx_stats.err_post_delim); 288 - len += scnprintf(buf + len, size - len, 289 - "%20s : %10u\n", "DECRYPT BUSY ERR", 290 - priv->debug.rx_stats.err_decrypt_busy); 291 - len += scnprintf(buf + len, size - len, 292 - "%20s : %10u\n", "TOTAL PHY ERR", 293 - priv->debug.rx_stats.err_phy); 294 - 295 - 296 - PHY_ERR("UNDERRUN", ATH9K_PHYERR_UNDERRUN); 297 - PHY_ERR("TIMING", ATH9K_PHYERR_TIMING); 298 - PHY_ERR("PARITY", ATH9K_PHYERR_PARITY); 299 - PHY_ERR("RATE", ATH9K_PHYERR_RATE); 300 - PHY_ERR("LENGTH", ATH9K_PHYERR_LENGTH); 301 - PHY_ERR("RADAR", ATH9K_PHYERR_RADAR); 302 - PHY_ERR("SERVICE", ATH9K_PHYERR_SERVICE); 303 - PHY_ERR("TOR", ATH9K_PHYERR_TOR); 304 - PHY_ERR("OFDM-TIMING", ATH9K_PHYERR_OFDM_TIMING); 305 - PHY_ERR("OFDM-SIGNAL-PARITY", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); 306 - PHY_ERR("OFDM-RATE", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); 307 - PHY_ERR("OFDM-LENGTH", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); 308 - PHY_ERR("OFDM-POWER-DROP", ATH9K_PHYERR_OFDM_POWER_DROP); 309 - PHY_ERR("OFDM-SERVICE", ATH9K_PHYERR_OFDM_SERVICE); 310 - PHY_ERR("OFDM-RESTART", ATH9K_PHYERR_OFDM_RESTART); 311 - PHY_ERR("FALSE-RADAR-EXT", ATH9K_PHYERR_FALSE_RADAR_EXT); 312 - PHY_ERR("CCK-TIMING", ATH9K_PHYERR_CCK_TIMING); 313 - PHY_ERR("CCK-HEADER-CRC", ATH9K_PHYERR_CCK_HEADER_CRC); 314 - PHY_ERR("CCK-RATE", ATH9K_PHYERR_CCK_RATE_ILLEGAL); 315 - PHY_ERR("CCK-SERVICE", ATH9K_PHYERR_CCK_SERVICE); 316 - PHY_ERR("CCK-RESTART", ATH9K_PHYERR_CCK_RESTART); 317 - PHY_ERR("CCK-LENGTH", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); 318 - PHY_ERR("CCK-POWER-DROP", ATH9K_PHYERR_CCK_POWER_DROP); 319 - PHY_ERR("HT-CRC", ATH9K_PHYERR_HT_CRC_ERROR); 320 - PHY_ERR("HT-LENGTH", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); 321 - PHY_ERR("HT-RATE", ATH9K_PHYERR_HT_RATE_ILLEGAL); 296 + priv->debug.skbrx_stats.skb_dropped); 322 297 323 298 if (len > size) 324 299 len = size; ··· 277 352 kfree(buf); 278 353 279 354 return retval; 280 - 281 - #undef PHY_ERR 282 355 } 283 356 284 - static const struct file_operations fops_recv = { 285 - .read = read_file_recv, 357 + static const struct file_operations fops_skb_rx = { 358 + .read = read_file_skb_rx, 286 359 .open = simple_open, 287 360 .owner = THIS_MODULE, 288 361 .llseek = default_llseek, ··· 409 486 .llseek = default_llseek, 410 487 }; 411 488 412 - static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, 413 - size_t count, loff_t *ppos) 414 - { 415 - struct ath9k_htc_priv *priv = file->private_data; 416 - struct ath_common *common = ath9k_hw_common(priv->ah); 417 - struct base_eep_header *pBase = NULL; 418 - unsigned int len = 0, size = 1500; 419 - ssize_t retval = 0; 420 - char *buf; 421 - 422 - pBase = ath9k_htc_get_eeprom_base(priv); 423 - 424 - if (pBase == NULL) { 425 - ath_err(common, "Unknown EEPROM type\n"); 426 - return 0; 427 - } 428 - 429 - buf = kzalloc(size, GFP_KERNEL); 430 - if (buf == NULL) 431 - return -ENOMEM; 432 - 433 - len += scnprintf(buf + len, size - len, 434 - "%20s : %10d\n", "Major Version", 435 - pBase->version >> 12); 436 - len += scnprintf(buf + len, size - len, 437 - "%20s : %10d\n", "Minor Version", 438 - pBase->version & 0xFFF); 439 - len += scnprintf(buf + len, size - len, 440 - "%20s : %10d\n", "Checksum", 441 - pBase->checksum); 442 - len += scnprintf(buf + len, size - len, 443 - "%20s : %10d\n", "Length", 444 - pBase->length); 445 - len += scnprintf(buf + len, size - len, 446 - "%20s : %10d\n", "RegDomain1", 447 - pBase->regDmn[0]); 448 - len += scnprintf(buf + len, size - len, 449 - "%20s : %10d\n", "RegDomain2", 450 - pBase->regDmn[1]); 451 - len += scnprintf(buf + len, size - len, 452 - "%20s : %10d\n", 453 - "TX Mask", pBase->txMask); 454 - len += scnprintf(buf + len, size - len, 455 - "%20s : %10d\n", 456 - "RX Mask", pBase->rxMask); 457 - len += scnprintf(buf + len, size - len, 458 - "%20s : %10d\n", 459 - "Allow 5GHz", 460 - !!(pBase->opCapFlags & AR5416_OPFLAGS_11A)); 461 - len += scnprintf(buf + len, size - len, 462 - "%20s : %10d\n", 463 - "Allow 2GHz", 464 - !!(pBase->opCapFlags & AR5416_OPFLAGS_11G)); 465 - len += scnprintf(buf + len, size - len, 466 - "%20s : %10d\n", 467 - "Disable 2GHz HT20", 468 - !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT20)); 469 - len += scnprintf(buf + len, size - len, 470 - "%20s : %10d\n", 471 - "Disable 2GHz HT40", 472 - !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT40)); 473 - len += scnprintf(buf + len, size - len, 474 - "%20s : %10d\n", 475 - "Disable 5Ghz HT20", 476 - !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT20)); 477 - len += scnprintf(buf + len, size - len, 478 - "%20s : %10d\n", 479 - "Disable 5Ghz HT40", 480 - !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT40)); 481 - len += scnprintf(buf + len, size - len, 482 - "%20s : %10d\n", 483 - "Big Endian", 484 - !!(pBase->eepMisc & 0x01)); 485 - len += scnprintf(buf + len, size - len, 486 - "%20s : %10d\n", 487 - "Cal Bin Major Ver", 488 - (pBase->binBuildNumber >> 24) & 0xFF); 489 - len += scnprintf(buf + len, size - len, 490 - "%20s : %10d\n", 491 - "Cal Bin Minor Ver", 492 - (pBase->binBuildNumber >> 16) & 0xFF); 493 - len += scnprintf(buf + len, size - len, 494 - "%20s : %10d\n", 495 - "Cal Bin Build", 496 - (pBase->binBuildNumber >> 8) & 0xFF); 497 - 498 - /* 499 - * UB91 specific data. 500 - */ 501 - if (AR_SREV_9271(priv->ah)) { 502 - struct base_eep_header_4k *pBase4k = 503 - &priv->ah->eeprom.map4k.baseEepHeader; 504 - 505 - len += scnprintf(buf + len, size - len, 506 - "%20s : %10d\n", 507 - "TX Gain type", 508 - pBase4k->txGainType); 509 - } 510 - 511 - /* 512 - * UB95 specific data. 513 - */ 514 - if (priv->ah->hw_version.usbdev == AR9287_USB) { 515 - struct base_eep_ar9287_header *pBase9287 = 516 - &priv->ah->eeprom.map9287.baseEepHeader; 517 - 518 - len += scnprintf(buf + len, size - len, 519 - "%20s : %10ddB\n", 520 - "Power Table Offset", 521 - pBase9287->pwrTableOffset); 522 - 523 - len += scnprintf(buf + len, size - len, 524 - "%20s : %10d\n", 525 - "OpenLoop Power Ctrl", 526 - pBase9287->openLoopPwrCntl); 527 - } 528 - 529 - len += scnprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress", 530 - pBase->macAddr); 531 - if (len > size) 532 - len = size; 533 - 534 - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 535 - kfree(buf); 536 - 537 - return retval; 538 - } 539 - 540 - static const struct file_operations fops_base_eeprom = { 541 - .read = read_file_base_eeprom, 542 - .open = simple_open, 543 - .owner = THIS_MODULE, 544 - .llseek = default_llseek, 545 - }; 546 - 547 - static ssize_t read_4k_modal_eeprom(struct file *file, 548 - char __user *user_buf, 549 - size_t count, loff_t *ppos) 550 - { 551 - #define PR_EEP(_s, _val) \ 552 - do { \ 553 - len += scnprintf(buf + len, size - len, "%20s : %10d\n",\ 554 - _s, (_val)); \ 555 - } while (0) 556 - 557 - struct ath9k_htc_priv *priv = file->private_data; 558 - struct modal_eep_4k_header *pModal = &priv->ah->eeprom.map4k.modalHeader; 559 - unsigned int len = 0, size = 2048; 560 - ssize_t retval = 0; 561 - char *buf; 562 - 563 - buf = kzalloc(size, GFP_KERNEL); 564 - if (buf == NULL) 565 - return -ENOMEM; 566 - 567 - PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); 568 - PR_EEP("Ant. Common Control", pModal->antCtrlCommon); 569 - PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); 570 - PR_EEP("Switch Settle", pModal->switchSettling); 571 - PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); 572 - PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); 573 - PR_EEP("ADC Desired size", pModal->adcDesiredSize); 574 - PR_EEP("PGA Desired size", pModal->pgaDesiredSize); 575 - PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]); 576 - PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); 577 - PR_EEP("txEndToRxOn", pModal->txEndToRxOn); 578 - PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); 579 - PR_EEP("CCA Threshold)", pModal->thresh62); 580 - PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); 581 - PR_EEP("xpdGain", pModal->xpdGain); 582 - PR_EEP("External PD", pModal->xpd); 583 - PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); 584 - PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); 585 - PR_EEP("pdGainOverlap", pModal->pdGainOverlap); 586 - PR_EEP("O/D Bias Version", pModal->version); 587 - PR_EEP("CCK OutputBias", pModal->ob_0); 588 - PR_EEP("BPSK OutputBias", pModal->ob_1); 589 - PR_EEP("QPSK OutputBias", pModal->ob_2); 590 - PR_EEP("16QAM OutputBias", pModal->ob_3); 591 - PR_EEP("64QAM OutputBias", pModal->ob_4); 592 - PR_EEP("CCK Driver1_Bias", pModal->db1_0); 593 - PR_EEP("BPSK Driver1_Bias", pModal->db1_1); 594 - PR_EEP("QPSK Driver1_Bias", pModal->db1_2); 595 - PR_EEP("16QAM Driver1_Bias", pModal->db1_3); 596 - PR_EEP("64QAM Driver1_Bias", pModal->db1_4); 597 - PR_EEP("CCK Driver2_Bias", pModal->db2_0); 598 - PR_EEP("BPSK Driver2_Bias", pModal->db2_1); 599 - PR_EEP("QPSK Driver2_Bias", pModal->db2_2); 600 - PR_EEP("16QAM Driver2_Bias", pModal->db2_3); 601 - PR_EEP("64QAM Driver2_Bias", pModal->db2_4); 602 - PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); 603 - PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); 604 - PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); 605 - PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); 606 - PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); 607 - PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); 608 - PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); 609 - PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]); 610 - PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]); 611 - PR_EEP("Ant. Diversity ctl1", pModal->antdiv_ctl1); 612 - PR_EEP("Ant. Diversity ctl2", pModal->antdiv_ctl2); 613 - PR_EEP("TX Diversity", pModal->tx_diversity); 614 - 615 - if (len > size) 616 - len = size; 617 - 618 - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 619 - kfree(buf); 620 - 621 - return retval; 622 - 623 - #undef PR_EEP 624 - } 625 - 626 - static ssize_t read_def_modal_eeprom(struct file *file, 627 - char __user *user_buf, 628 - size_t count, loff_t *ppos) 629 - { 630 - #define PR_EEP(_s, _val) \ 631 - do { \ 632 - if (pBase->opCapFlags & AR5416_OPFLAGS_11G) { \ 633 - pModal = &priv->ah->eeprom.def.modalHeader[1]; \ 634 - len += scnprintf(buf + len, size - len, "%20s : %8d%7s", \ 635 - _s, (_val), "|"); \ 636 - } \ 637 - if (pBase->opCapFlags & AR5416_OPFLAGS_11A) { \ 638 - pModal = &priv->ah->eeprom.def.modalHeader[0]; \ 639 - len += scnprintf(buf + len, size - len, "%9d\n",\ 640 - (_val)); \ 641 - } \ 642 - } while (0) 643 - 644 - struct ath9k_htc_priv *priv = file->private_data; 645 - struct base_eep_header *pBase = &priv->ah->eeprom.def.baseEepHeader; 646 - struct modal_eep_header *pModal = NULL; 647 - unsigned int len = 0, size = 3500; 648 - ssize_t retval = 0; 649 - char *buf; 650 - 651 - buf = kzalloc(size, GFP_KERNEL); 652 - if (buf == NULL) 653 - return -ENOMEM; 654 - 655 - len += scnprintf(buf + len, size - len, 656 - "%31s %15s\n", "2G", "5G"); 657 - len += scnprintf(buf + len, size - len, 658 - "%32s %16s\n", "====", "====\n"); 659 - 660 - PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); 661 - PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]); 662 - PR_EEP("Chain2 Ant. Control", pModal->antCtrlChain[2]); 663 - PR_EEP("Ant. Common Control", pModal->antCtrlCommon); 664 - PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); 665 - PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]); 666 - PR_EEP("Chain2 Ant. Gain", pModal->antennaGainCh[2]); 667 - PR_EEP("Switch Settle", pModal->switchSettling); 668 - PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); 669 - PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]); 670 - PR_EEP("Chain2 TxRxAtten", pModal->txRxAttenCh[2]); 671 - PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); 672 - PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]); 673 - PR_EEP("Chain2 RxTxMargin", pModal->rxTxMarginCh[2]); 674 - PR_EEP("ADC Desired size", pModal->adcDesiredSize); 675 - PR_EEP("PGA Desired size", pModal->pgaDesiredSize); 676 - PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]); 677 - PR_EEP("Chain1 xlna Gain", pModal->xlnaGainCh[1]); 678 - PR_EEP("Chain2 xlna Gain", pModal->xlnaGainCh[2]); 679 - PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); 680 - PR_EEP("txEndToRxOn", pModal->txEndToRxOn); 681 - PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); 682 - PR_EEP("CCA Threshold)", pModal->thresh62); 683 - PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); 684 - PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]); 685 - PR_EEP("Chain2 NF Threshold", pModal->noiseFloorThreshCh[2]); 686 - PR_EEP("xpdGain", pModal->xpdGain); 687 - PR_EEP("External PD", pModal->xpd); 688 - PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); 689 - PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]); 690 - PR_EEP("Chain2 I Coefficient", pModal->iqCalICh[2]); 691 - PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); 692 - PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]); 693 - PR_EEP("Chain2 Q Coefficient", pModal->iqCalQCh[2]); 694 - PR_EEP("pdGainOverlap", pModal->pdGainOverlap); 695 - PR_EEP("Chain0 OutputBias", pModal->ob); 696 - PR_EEP("Chain0 DriverBias", pModal->db); 697 - PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); 698 - PR_EEP("2chain pwr decrease", pModal->pwrDecreaseFor2Chain); 699 - PR_EEP("3chain pwr decrease", pModal->pwrDecreaseFor3Chain); 700 - PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); 701 - PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); 702 - PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); 703 - PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); 704 - PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]); 705 - PR_EEP("Chain2 bswAtten", pModal->bswAtten[2]); 706 - PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); 707 - PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]); 708 - PR_EEP("Chain2 bswMargin", pModal->bswMargin[2]); 709 - PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); 710 - PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]); 711 - PR_EEP("Chain1 xatten2Db", pModal->xatten2Db[1]); 712 - PR_EEP("Chain2 xatten2Db", pModal->xatten2Db[2]); 713 - PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]); 714 - PR_EEP("Chain1 xatten2Margin", pModal->xatten2Margin[1]); 715 - PR_EEP("Chain2 xatten2Margin", pModal->xatten2Margin[2]); 716 - PR_EEP("Chain1 OutputBias", pModal->ob_ch1); 717 - PR_EEP("Chain1 DriverBias", pModal->db_ch1); 718 - PR_EEP("LNA Control", pModal->lna_ctl); 719 - PR_EEP("XPA Bias Freq0", pModal->xpaBiasLvlFreq[0]); 720 - PR_EEP("XPA Bias Freq1", pModal->xpaBiasLvlFreq[1]); 721 - PR_EEP("XPA Bias Freq2", pModal->xpaBiasLvlFreq[2]); 722 - 723 - if (len > size) 724 - len = size; 725 - 726 - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 727 - kfree(buf); 728 - 729 - return retval; 730 - 731 - #undef PR_EEP 732 - } 733 - 734 - static ssize_t read_9287_modal_eeprom(struct file *file, 735 - char __user *user_buf, 736 - size_t count, loff_t *ppos) 737 - { 738 - #define PR_EEP(_s, _val) \ 739 - do { \ 740 - len += scnprintf(buf + len, size - len, "%20s : %10d\n",\ 741 - _s, (_val)); \ 742 - } while (0) 743 - 744 - struct ath9k_htc_priv *priv = file->private_data; 745 - struct modal_eep_ar9287_header *pModal = &priv->ah->eeprom.map9287.modalHeader; 746 - unsigned int len = 0, size = 3000; 747 - ssize_t retval = 0; 748 - char *buf; 749 - 750 - buf = kzalloc(size, GFP_KERNEL); 751 - if (buf == NULL) 752 - return -ENOMEM; 753 - 754 - PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); 755 - PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]); 756 - PR_EEP("Ant. Common Control", pModal->antCtrlCommon); 757 - PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); 758 - PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]); 759 - PR_EEP("Switch Settle", pModal->switchSettling); 760 - PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); 761 - PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]); 762 - PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); 763 - PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]); 764 - PR_EEP("ADC Desired size", pModal->adcDesiredSize); 765 - PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); 766 - PR_EEP("txEndToRxOn", pModal->txEndToRxOn); 767 - PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); 768 - PR_EEP("CCA Threshold)", pModal->thresh62); 769 - PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); 770 - PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]); 771 - PR_EEP("xpdGain", pModal->xpdGain); 772 - PR_EEP("External PD", pModal->xpd); 773 - PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); 774 - PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]); 775 - PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); 776 - PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]); 777 - PR_EEP("pdGainOverlap", pModal->pdGainOverlap); 778 - PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); 779 - PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); 780 - PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); 781 - PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); 782 - PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); 783 - PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]); 784 - PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); 785 - PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]); 786 - PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); 787 - PR_EEP("AR92x7 Version", pModal->version); 788 - PR_EEP("DriverBias1", pModal->db1); 789 - PR_EEP("DriverBias2", pModal->db1); 790 - PR_EEP("CCK OutputBias", pModal->ob_cck); 791 - PR_EEP("PSK OutputBias", pModal->ob_psk); 792 - PR_EEP("QAM OutputBias", pModal->ob_qam); 793 - PR_EEP("PAL_OFF OutputBias", pModal->ob_pal_off); 794 - 795 - if (len > size) 796 - len = size; 797 - 798 - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 799 - kfree(buf); 800 - 801 - return retval; 802 - 803 - #undef PR_EEP 804 - } 805 - 806 - static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, 807 - size_t count, loff_t *ppos) 808 - { 809 - struct ath9k_htc_priv *priv = file->private_data; 810 - 811 - if (AR_SREV_9271(priv->ah)) 812 - return read_4k_modal_eeprom(file, user_buf, count, ppos); 813 - else if (priv->ah->hw_version.usbdev == AR9280_USB) 814 - return read_def_modal_eeprom(file, user_buf, count, ppos); 815 - else if (priv->ah->hw_version.usbdev == AR9287_USB) 816 - return read_9287_modal_eeprom(file, user_buf, count, ppos); 817 - 818 - return 0; 819 - } 820 - 821 - static const struct file_operations fops_modal_eeprom = { 822 - .read = read_file_modal_eeprom, 823 - .open = simple_open, 824 - .owner = THIS_MODULE, 825 - .llseek = default_llseek, 826 - }; 827 - 828 - 829 489 /* Ethtool support for get-stats */ 830 490 #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" 831 491 static const char ath9k_htc_gstrings_stats[][ETH_GSTRING_LEN] = { ··· 453 947 454 948 #define STXBASE priv->debug.tx_stats 455 949 #define SRXBASE priv->debug.rx_stats 950 + #define SKBTXBASE priv->debug.tx_stats 951 + #define SKBRXBASE priv->debug.skbrx_stats 456 952 #define ASTXQ(a) \ 457 953 data[i++] = STXBASE.a[IEEE80211_AC_BE]; \ 458 954 data[i++] = STXBASE.a[IEEE80211_AC_BK]; \ ··· 468 960 struct ath9k_htc_priv *priv = hw->priv; 469 961 int i = 0; 470 962 471 - data[i++] = STXBASE.skb_success; 472 - data[i++] = STXBASE.skb_success_bytes; 473 - data[i++] = SRXBASE.skb_completed; 474 - data[i++] = SRXBASE.skb_completed_bytes; 963 + data[i++] = SKBTXBASE.skb_success; 964 + data[i++] = SKBTXBASE.skb_success_bytes; 965 + data[i++] = SKBRXBASE.skb_completed; 966 + data[i++] = SKBRXBASE.skb_completed_bytes; 475 967 476 968 ASTXQ(queue_stats); 477 969 478 - data[i++] = SRXBASE.err_crc; 479 - data[i++] = SRXBASE.err_decrypt_crc; 480 - data[i++] = SRXBASE.err_phy; 481 - data[i++] = SRXBASE.err_mic; 482 - data[i++] = SRXBASE.err_pre_delim; 483 - data[i++] = SRXBASE.err_post_delim; 484 - data[i++] = SRXBASE.err_decrypt_busy; 970 + data[i++] = SRXBASE.crc_err; 971 + data[i++] = SRXBASE.decrypt_crc_err; 972 + data[i++] = SRXBASE.phy_err; 973 + data[i++] = SRXBASE.mic_err; 974 + data[i++] = SRXBASE.pre_delim_crc_err; 975 + data[i++] = SRXBASE.post_delim_crc_err; 976 + data[i++] = SRXBASE.decrypt_busy_err; 485 977 486 - data[i++] = SRXBASE.err_phy_stats[ATH9K_PHYERR_RADAR]; 487 - data[i++] = SRXBASE.err_phy_stats[ATH9K_PHYERR_OFDM_TIMING]; 488 - data[i++] = SRXBASE.err_phy_stats[ATH9K_PHYERR_CCK_TIMING]; 978 + data[i++] = SRXBASE.phy_err_stats[ATH9K_PHYERR_RADAR]; 979 + data[i++] = SRXBASE.phy_err_stats[ATH9K_PHYERR_OFDM_TIMING]; 980 + data[i++] = SRXBASE.phy_err_stats[ATH9K_PHYERR_CCK_TIMING]; 489 981 490 982 WARN_ON(i != ATH9K_HTC_SSTATS_LEN); 491 983 } ··· 509 1001 priv, &fops_tgt_rx_stats); 510 1002 debugfs_create_file("xmit", S_IRUSR, priv->debug.debugfs_phy, 511 1003 priv, &fops_xmit); 512 - debugfs_create_file("recv", S_IRUSR, priv->debug.debugfs_phy, 513 - priv, &fops_recv); 1004 + debugfs_create_file("skb_rx", S_IRUSR, priv->debug.debugfs_phy, 1005 + priv, &fops_skb_rx); 1006 + 1007 + ath9k_cmn_debug_recv(priv->debug.debugfs_phy, &priv->debug.rx_stats); 1008 + ath9k_cmn_debug_phy_err(priv->debug.debugfs_phy, &priv->debug.rx_stats); 1009 + 514 1010 debugfs_create_file("slot", S_IRUSR, priv->debug.debugfs_phy, 515 1011 priv, &fops_slot); 516 1012 debugfs_create_file("queue", S_IRUSR, priv->debug.debugfs_phy, 517 1013 priv, &fops_queue); 518 1014 debugfs_create_file("debug", S_IRUSR | S_IWUSR, priv->debug.debugfs_phy, 519 1015 priv, &fops_debug); 520 - debugfs_create_file("base_eeprom", S_IRUSR, priv->debug.debugfs_phy, 521 - priv, &fops_base_eeprom); 522 - debugfs_create_file("modal_eeprom", S_IRUSR, priv->debug.debugfs_phy, 523 - priv, &fops_modal_eeprom); 1016 + 1017 + ath9k_cmn_debug_base_eeprom(priv->debug.debugfs_phy, priv->ah); 1018 + ath9k_cmn_debug_modal_eeprom(priv->debug.debugfs_phy, priv->ah); 524 1019 525 1020 return 0; 526 1021 }
+1 -2
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
··· 996 996 goto rx_next; 997 997 } 998 998 999 - ath9k_htc_err_stat_rx(priv, rxstatus); 1000 - 1001 999 /* Get the RX status information */ 1002 1000 1003 1001 memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); ··· 1003 1005 /* Copy everything from ath_htc_rx_status (HTC_RX_FRAME_HEADER). 1004 1006 * After this, we can drop this part of skb. */ 1005 1007 rx_status_htc_to_ath(&rx_stats, rxstatus); 1008 + ath9k_htc_err_stat_rx(priv, &rx_stats); 1006 1009 rx_status->mactime = be64_to_cpu(rxstatus->rs_tstamp); 1007 1010 skb_pull(skb, HTC_RX_FRAME_HEADER_SIZE); 1008 1011
+2 -1
drivers/net/wireless/ath/ath9k/hw.c
··· 26 26 #include "ar9003_mac.h" 27 27 #include "ar9003_mci.h" 28 28 #include "ar9003_phy.h" 29 - #include "debug.h" 30 29 #include "ath9k.h" 31 30 32 31 static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type); ··· 245 246 return; 246 247 case AR9300_DEVID_AR953X: 247 248 ah->hw_version.macVersion = AR_SREV_VERSION_9531; 249 + if (ah->get_mac_revision) 250 + ah->hw_version.macRev = ah->get_mac_revision(); 248 251 return; 249 252 } 250 253
+3 -2
drivers/net/wireless/ath/ath9k/init.c
··· 508 508 sc->tx99_power = MAX_RATE_POWER + 1; 509 509 init_waitqueue_head(&sc->tx_wait); 510 510 511 - if (!pdata) { 511 + if (!pdata || pdata->use_eeprom) { 512 512 ah->ah_flags |= AH_USE_EEPROM; 513 513 sc->sc_ah->led_pin = -1; 514 514 } else { ··· 714 714 if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt) 715 715 hw->flags |= IEEE80211_HW_MFP_CAPABLE; 716 716 717 - hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR; 717 + hw->wiphy->features |= (NL80211_FEATURE_ACTIVE_MONITOR | 718 + NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE); 718 719 719 720 if (!config_enabled(CONFIG_ATH9K_TX99)) { 720 721 hw->wiphy->interface_modes =
+22
drivers/net/wireless/ath/ath9k/mac.c
··· 958 958 return; 959 959 } 960 960 EXPORT_SYMBOL(ath9k_hw_set_interrupts); 961 + 962 + #define ATH9K_HW_MAX_DCU 10 963 + #define ATH9K_HW_SLICE_PER_DCU 16 964 + #define ATH9K_HW_BIT_IN_SLICE 16 965 + void ath9k_hw_set_tx_filter(struct ath_hw *ah, u8 destidx, bool set) 966 + { 967 + int dcu_idx; 968 + u32 filter; 969 + 970 + for (dcu_idx = 0; dcu_idx < 10; dcu_idx++) { 971 + filter = SM(set, AR_D_TXBLK_WRITE_COMMAND); 972 + filter |= SM(dcu_idx, AR_D_TXBLK_WRITE_DCU); 973 + filter |= SM((destidx / ATH9K_HW_SLICE_PER_DCU), 974 + AR_D_TXBLK_WRITE_SLICE); 975 + filter |= BIT(destidx % ATH9K_HW_BIT_IN_SLICE); 976 + ath_dbg(ath9k_hw_common(ah), PS, 977 + "DCU%d staid %d set %d txfilter %08x\n", 978 + dcu_idx, destidx, set, filter); 979 + REG_WRITE(ah, AR_D_TXBLK_BASE, filter); 980 + } 981 + } 982 + EXPORT_SYMBOL(ath9k_hw_set_tx_filter);
+1
drivers/net/wireless/ath/ath9k/mac.h
··· 729 729 void ath9k_hw_abortpcurecv(struct ath_hw *ah); 730 730 bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset); 731 731 int ath9k_hw_beaconq_setup(struct ath_hw *ah); 732 + void ath9k_hw_set_tx_filter(struct ath_hw *ah, u8 destidx, bool set); 732 733 733 734 /* Interrupt Handling */ 734 735 bool ath9k_hw_intrpend(struct ath_hw *ah);
+44 -3
drivers/net/wireless/ath/ath9k/main.c
··· 421 421 an->sc = sc; 422 422 an->sta = sta; 423 423 an->vif = vif; 424 + memset(&an->key_idx, 0, sizeof(an->key_idx)); 424 425 425 426 ath_tx_node_init(sc, an); 426 427 } ··· 1462 1461 return 0; 1463 1462 1464 1463 key = ath_key_config(common, vif, sta, &ps_key); 1465 - if (key > 0) 1464 + if (key > 0) { 1466 1465 an->ps_key = key; 1466 + an->key_idx[0] = key; 1467 + } 1467 1468 1468 1469 return 0; 1469 1470 } ··· 1483 1480 1484 1481 ath_key_delete(common, &ps_key); 1485 1482 an->ps_key = 0; 1483 + an->key_idx[0] = 0; 1486 1484 } 1487 1485 1488 1486 static int ath9k_sta_remove(struct ieee80211_hw *hw, ··· 1498 1494 return 0; 1499 1495 } 1500 1496 1497 + static void ath9k_sta_set_tx_filter(struct ath_hw *ah, 1498 + struct ath_node *an, 1499 + bool set) 1500 + { 1501 + int i; 1502 + 1503 + for (i = 0; i < ARRAY_SIZE(an->key_idx); i++) { 1504 + if (!an->key_idx[i]) 1505 + continue; 1506 + ath9k_hw_set_tx_filter(ah, an->key_idx[i], set); 1507 + } 1508 + } 1509 + 1501 1510 static void ath9k_sta_notify(struct ieee80211_hw *hw, 1502 1511 struct ieee80211_vif *vif, 1503 1512 enum sta_notify_cmd cmd, ··· 1523 1506 case STA_NOTIFY_SLEEP: 1524 1507 an->sleeping = true; 1525 1508 ath_tx_aggr_sleep(sta, sc, an); 1509 + ath9k_sta_set_tx_filter(sc->sc_ah, an, true); 1526 1510 break; 1527 1511 case STA_NOTIFY_AWAKE: 1512 + ath9k_sta_set_tx_filter(sc->sc_ah, an, false); 1528 1513 an->sleeping = false; 1529 1514 ath_tx_aggr_wakeup(sc, an); 1530 1515 break; ··· 1582 1563 { 1583 1564 struct ath_softc *sc = hw->priv; 1584 1565 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1585 - int ret = 0; 1566 + struct ath_node *an = NULL; 1567 + int ret = 0, i; 1586 1568 1587 1569 if (ath9k_modparam_nohwcrypt) 1588 1570 return -ENOSPC; ··· 1605 1585 1606 1586 mutex_lock(&sc->mutex); 1607 1587 ath9k_ps_wakeup(sc); 1608 - ath_dbg(common, CONFIG, "Set HW Key\n"); 1588 + ath_dbg(common, CONFIG, "Set HW Key %d\n", cmd); 1589 + if (sta) 1590 + an = (struct ath_node *)sta->drv_priv; 1609 1591 1610 1592 switch (cmd) { 1611 1593 case SET_KEY: 1612 1594 if (sta) 1613 1595 ath9k_del_ps_key(sc, vif, sta); 1614 1596 1597 + key->hw_key_idx = 0; 1615 1598 ret = ath_key_config(common, vif, sta, key); 1616 1599 if (ret >= 0) { 1617 1600 key->hw_key_idx = ret; ··· 1627 1604 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; 1628 1605 ret = 0; 1629 1606 } 1607 + if (an && key->hw_key_idx) { 1608 + for (i = 0; i < ARRAY_SIZE(an->key_idx); i++) { 1609 + if (an->key_idx[i]) 1610 + continue; 1611 + an->key_idx[i] = key->hw_key_idx; 1612 + break; 1613 + } 1614 + WARN_ON(i == ARRAY_SIZE(an->key_idx)); 1615 + } 1630 1616 break; 1631 1617 case DISABLE_KEY: 1632 1618 ath_key_delete(common, key); 1619 + if (an) { 1620 + for (i = 0; i < ARRAY_SIZE(an->key_idx); i++) { 1621 + if (an->key_idx[i] != key->hw_key_idx) 1622 + continue; 1623 + an->key_idx[i] = 0; 1624 + break; 1625 + } 1626 + } 1627 + key->hw_key_idx = 0; 1633 1628 break; 1634 1629 default: 1635 1630 ret = -EINVAL;
+2 -1
drivers/net/wireless/ath/ath9k/pci.c
··· 686 686 struct ath_softc *sc = (struct ath_softc *) common->priv; 687 687 struct ath9k_platform_data *pdata = sc->dev->platform_data; 688 688 689 - if (pdata) { 689 + if (pdata && !pdata->use_eeprom) { 690 690 if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { 691 691 ath_err(common, 692 692 "%s: eeprom read failed, offset %08x is out of range\n", ··· 914 914 */ 915 915 ath9k_stop_btcoex(sc); 916 916 ath9k_hw_disable(sc->sc_ah); 917 + del_timer_sync(&sc->sleep_timer); 917 918 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP); 918 919 919 920 return 0;
+2 -2
drivers/net/wireless/ath/ath9k/recv.c
··· 538 538 sc->ps_flags &= ~PS_BEACON_SYNC; 539 539 ath_dbg(common, PS, 540 540 "Reconfigure beacon timers based on synchronized timestamp\n"); 541 - ath9k_set_beacon(sc); 542 - 541 + if (!(WARN_ON_ONCE(sc->cur_beacon_conf.beacon_interval == 0))) 542 + ath9k_set_beacon(sc); 543 543 if (sc->p2p_ps_vif) 544 544 ath9k_update_p2p_ps(sc, sc->p2p_ps_vif->vif); 545 545 }
-3
drivers/net/wireless/ath/ath9k/reg.h
··· 505 505 #define AR_D_QCUMASK 0x000003FF 506 506 #define AR_D_QCUMASK_RESV0 0xFFFFFC00 507 507 508 - #define AR_D_TXBLK_CMD 0x1038 509 - #define AR_D_TXBLK_DATA(i) (AR_D_TXBLK_CMD+(i)) 510 - 511 508 #define AR_D0_LCL_IFS 0x1040 512 509 #define AR_D1_LCL_IFS 0x1044 513 510 #define AR_D2_LCL_IFS 0x1048
+7 -1
drivers/net/wireless/ath/carl9170/usb.c
··· 1076 1076 1077 1077 carl9170_set_state(ar, CARL9170_STOPPED); 1078 1078 1079 - return request_firmware_nowait(THIS_MODULE, 1, CARL9170FW_NAME, 1079 + err = request_firmware_nowait(THIS_MODULE, 1, CARL9170FW_NAME, 1080 1080 &ar->udev->dev, GFP_KERNEL, ar, carl9170_usb_firmware_step2); 1081 + if (err) { 1082 + usb_put_dev(udev); 1083 + usb_put_dev(udev); 1084 + carl9170_free(ar); 1085 + } 1086 + return err; 1081 1087 } 1082 1088 1083 1089 static void carl9170_usb_disconnect(struct usb_interface *intf)
+44 -1
drivers/net/wireless/ath/dfs_pattern_detector.c
··· 73 73 .radar_types = etsi_radar_ref_types_v15, 74 74 }; 75 75 76 - /* for now, we support ETSI radar types, FCC and JP are TODO */ 76 + #define FCC_PATTERN(ID, WMIN, WMAX, PMIN, PMAX, PRF, PPB) \ 77 + { \ 78 + ID, WIDTH_LOWER(WMIN), WIDTH_UPPER(WMAX), \ 79 + PMIN - PRI_TOLERANCE, \ 80 + PMAX * PRF + PRI_TOLERANCE, PRF, PPB * PRF, \ 81 + PPB_THRESH(PPB), PRI_TOLERANCE, \ 82 + } 83 + 84 + static const struct radar_detector_specs fcc_radar_ref_types[] = { 85 + FCC_PATTERN(0, 0, 1, 1428, 1428, 1, 18), 86 + FCC_PATTERN(1, 0, 5, 150, 230, 1, 23), 87 + FCC_PATTERN(2, 6, 10, 200, 500, 1, 16), 88 + FCC_PATTERN(3, 11, 20, 200, 500, 1, 12), 89 + FCC_PATTERN(4, 50, 100, 1000, 2000, 20, 1), 90 + FCC_PATTERN(5, 0, 1, 333, 333, 1, 9), 91 + }; 92 + 93 + static const struct radar_types fcc_radar_types = { 94 + .region = NL80211_DFS_FCC, 95 + .num_radar_types = ARRAY_SIZE(fcc_radar_ref_types), 96 + .radar_types = fcc_radar_ref_types, 97 + }; 98 + 99 + #define JP_PATTERN FCC_PATTERN 100 + static const struct radar_detector_specs jp_radar_ref_types[] = { 101 + JP_PATTERN(0, 0, 1, 1428, 1428, 1, 18), 102 + JP_PATTERN(1, 2, 3, 3846, 3846, 1, 18), 103 + JP_PATTERN(2, 0, 1, 1388, 1388, 1, 18), 104 + JP_PATTERN(3, 1, 2, 4000, 4000, 1, 18), 105 + JP_PATTERN(4, 0, 5, 150, 230, 1, 23), 106 + JP_PATTERN(5, 6, 10, 200, 500, 1, 16), 107 + JP_PATTERN(6, 11, 20, 200, 500, 1, 12), 108 + JP_PATTERN(7, 50, 100, 1000, 2000, 20, 1), 109 + JP_PATTERN(5, 0, 1, 333, 333, 1, 9), 110 + }; 111 + 112 + static const struct radar_types jp_radar_types = { 113 + .region = NL80211_DFS_JP, 114 + .num_radar_types = ARRAY_SIZE(jp_radar_ref_types), 115 + .radar_types = jp_radar_ref_types, 116 + }; 117 + 77 118 static const struct radar_types *dfs_domains[] = { 78 119 &etsi_radar_types_v15, 120 + &fcc_radar_types, 121 + &jp_radar_types, 79 122 }; 80 123 81 124 /**
+2 -2
drivers/net/wireless/ath/wil6210/cfg80211.c
··· 172 172 173 173 static int wil_cfg80211_get_station(struct wiphy *wiphy, 174 174 struct net_device *ndev, 175 - u8 *mac, struct station_info *sinfo) 175 + const u8 *mac, struct station_info *sinfo) 176 176 { 177 177 struct wil6210_priv *wil = wiphy_to_wil(wiphy); 178 178 int rc; ··· 671 671 } 672 672 673 673 static int wil_cfg80211_del_station(struct wiphy *wiphy, 674 - struct net_device *dev, u8 *mac) 674 + struct net_device *dev, const u8 *mac) 675 675 { 676 676 struct wil6210_priv *wil = wiphy_to_wil(wiphy); 677 677
+2 -2
drivers/net/wireless/ath/wil6210/main.c
··· 81 81 memset(&sta->stats, 0, sizeof(sta->stats)); 82 82 } 83 83 84 - static void _wil6210_disconnect(struct wil6210_priv *wil, void *bssid) 84 + static void _wil6210_disconnect(struct wil6210_priv *wil, const u8 *bssid) 85 85 { 86 86 int cid = -ENOENT; 87 87 struct net_device *ndev = wil_to_ndev(wil); ··· 252 252 return 0; 253 253 } 254 254 255 - void wil6210_disconnect(struct wil6210_priv *wil, void *bssid) 255 + void wil6210_disconnect(struct wil6210_priv *wil, const u8 *bssid) 256 256 { 257 257 del_timer_sync(&wil->connect_timer); 258 258 _wil6210_disconnect(wil, bssid);
+1 -1
drivers/net/wireless/ath/wil6210/wil6210.h
··· 508 508 int wmi_set_mac_address(struct wil6210_priv *wil, void *addr); 509 509 int wmi_pcp_start(struct wil6210_priv *wil, int bi, u8 wmi_nettype, u8 chan); 510 510 int wmi_pcp_stop(struct wil6210_priv *wil); 511 - void wil6210_disconnect(struct wil6210_priv *wil, void *bssid); 511 + void wil6210_disconnect(struct wil6210_priv *wil, const u8 *bssid); 512 512 513 513 int wil_rx_init(struct wil6210_priv *wil); 514 514 void wil_rx_fini(struct wil6210_priv *wil);
+31 -11
drivers/net/wireless/b43/Kconfig
··· 1 1 config B43 2 2 tristate "Broadcom 43xx wireless support (mac80211 stack)" 3 - depends on SSB_POSSIBLE && MAC80211 && HAS_DMA 4 - select SSB 3 + depends on (BCMA_POSSIBLE || SSB_POSSIBLE) && MAC80211 && HAS_DMA 4 + select BCMA if B43_BCMA 5 + select SSB if B43_SSB 5 6 select FW_LOADER 6 7 ---help--- 7 8 b43 is a driver for the Broadcom 43xx series wireless devices. ··· 28 27 If unsure, say M. 29 28 30 29 config B43_BCMA 31 - bool "Support for BCMA bus" 32 - depends on B43 && (BCMA = y || BCMA = B43) 33 - default y 30 + bool 34 31 35 32 config B43_SSB 36 33 bool 37 - depends on B43 && (SSB = y || SSB = B43) 38 - default y 34 + 35 + choice 36 + prompt "Supported bus types" 37 + depends on B43 38 + default B43_BCMA_AND_SSB 39 + 40 + config B43_BUSES_BCMA_AND_SSB 41 + bool "BCMA and SSB" 42 + depends on BCMA_POSSIBLE && SSB_POSSIBLE 43 + select B43_BCMA 44 + select B43_SSB 45 + 46 + config B43_BUSES_BCMA 47 + bool "BCMA only" 48 + depends on BCMA_POSSIBLE 49 + select B43_BCMA 50 + 51 + config B43_BUSES_SSB 52 + bool "SSB only" 53 + depends on SSB_POSSIBLE 54 + select B43_SSB 55 + 56 + endchoice 39 57 40 58 # Auto-select SSB PCI-HOST support, if possible 41 59 config B43_PCI_AUTOSELECT ··· 73 53 74 54 config B43_PCMCIA 75 55 bool "Broadcom 43xx PCMCIA device support" 76 - depends on B43 && SSB_PCMCIAHOST_POSSIBLE 56 + depends on B43 && B43_SSB && SSB_PCMCIAHOST_POSSIBLE 77 57 select SSB_PCMCIAHOST 78 58 ---help--- 79 59 Broadcom 43xx PCMCIA device support. ··· 93 73 94 74 config B43_SDIO 95 75 bool "Broadcom 43xx SDIO device support" 96 - depends on B43 && SSB_SDIOHOST_POSSIBLE 76 + depends on B43 && B43_SSB && SSB_SDIOHOST_POSSIBLE 97 77 select SSB_SDIOHOST 98 78 ---help--- 99 79 Broadcom 43xx device support for Soft-MAC SDIO devices. ··· 118 98 119 99 config B43_PIO 120 100 bool 121 - depends on B43 101 + depends on B43 && B43_SSB 122 102 select SSB_BLOCKIO 123 103 default y 124 104 ··· 136 116 137 117 config B43_PHY_LP 138 118 bool "Support for low-power (LP-PHY) devices" 139 - depends on B43 119 + depends on B43 && B43_SSB 140 120 default y 141 121 ---help--- 142 122 Support for the LP-PHY.
+10
drivers/net/wireless/b43/bus.h
··· 5 5 #ifdef CONFIG_B43_BCMA 6 6 B43_BUS_BCMA, 7 7 #endif 8 + #ifdef CONFIG_B43_SSB 8 9 B43_BUS_SSB, 10 + #endif 9 11 }; 10 12 11 13 struct b43_bus_dev { ··· 54 52 55 53 static inline bool b43_bus_host_is_pcmcia(struct b43_bus_dev *dev) 56 54 { 55 + #ifdef CONFIG_B43_SSB 57 56 return (dev->bus_type == B43_BUS_SSB && 58 57 dev->sdev->bus->bustype == SSB_BUSTYPE_PCMCIA); 58 + #else 59 + return false; 60 + #endif 59 61 } 60 62 static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev) 61 63 { 64 + #ifdef CONFIG_B43_SSB 62 65 return (dev->bus_type == B43_BUS_SSB && 63 66 dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO); 67 + #else 68 + return false; 69 + #endif 64 70 } 65 71 66 72 struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core);
+210 -202
drivers/net/wireless/b43/main.c
··· 182 182 #define b43_g_ratetable (__b43_ratetable + 0) 183 183 #define b43_g_ratetable_size 12 184 184 185 - #define CHAN4G(_channel, _freq, _flags) { \ 185 + #define CHAN2G(_channel, _freq, _flags) { \ 186 186 .band = IEEE80211_BAND_2GHZ, \ 187 187 .center_freq = (_freq), \ 188 188 .hw_value = (_channel), \ ··· 191 191 .max_power = 30, \ 192 192 } 193 193 static struct ieee80211_channel b43_2ghz_chantable[] = { 194 - CHAN4G(1, 2412, 0), 195 - CHAN4G(2, 2417, 0), 196 - CHAN4G(3, 2422, 0), 197 - CHAN4G(4, 2427, 0), 198 - CHAN4G(5, 2432, 0), 199 - CHAN4G(6, 2437, 0), 200 - CHAN4G(7, 2442, 0), 201 - CHAN4G(8, 2447, 0), 202 - CHAN4G(9, 2452, 0), 203 - CHAN4G(10, 2457, 0), 204 - CHAN4G(11, 2462, 0), 205 - CHAN4G(12, 2467, 0), 206 - CHAN4G(13, 2472, 0), 207 - CHAN4G(14, 2484, 0), 194 + CHAN2G(1, 2412, 0), 195 + CHAN2G(2, 2417, 0), 196 + CHAN2G(3, 2422, 0), 197 + CHAN2G(4, 2427, 0), 198 + CHAN2G(5, 2432, 0), 199 + CHAN2G(6, 2437, 0), 200 + CHAN2G(7, 2442, 0), 201 + CHAN2G(8, 2447, 0), 202 + CHAN2G(9, 2452, 0), 203 + CHAN2G(10, 2457, 0), 204 + CHAN2G(11, 2462, 0), 205 + CHAN2G(12, 2467, 0), 206 + CHAN2G(13, 2472, 0), 207 + CHAN2G(14, 2484, 0), 208 208 }; 209 - #undef CHAN4G 209 + #undef CHAN2G 210 210 211 + #define CHAN4G(_channel, _flags) { \ 212 + .band = IEEE80211_BAND_5GHZ, \ 213 + .center_freq = 4000 + (5 * (_channel)), \ 214 + .hw_value = (_channel), \ 215 + .flags = (_flags), \ 216 + .max_antenna_gain = 0, \ 217 + .max_power = 30, \ 218 + } 211 219 #define CHAN5G(_channel, _flags) { \ 212 220 .band = IEEE80211_BAND_5GHZ, \ 213 221 .center_freq = 5000 + (5 * (_channel)), \ ··· 225 217 .max_power = 30, \ 226 218 } 227 219 static struct ieee80211_channel b43_5ghz_nphy_chantable[] = { 220 + CHAN4G(184, 0), CHAN4G(186, 0), 221 + CHAN4G(188, 0), CHAN4G(190, 0), 222 + CHAN4G(192, 0), CHAN4G(194, 0), 223 + CHAN4G(196, 0), CHAN4G(198, 0), 224 + CHAN4G(200, 0), CHAN4G(202, 0), 225 + CHAN4G(204, 0), CHAN4G(206, 0), 226 + CHAN4G(208, 0), CHAN4G(210, 0), 227 + CHAN4G(212, 0), CHAN4G(214, 0), 228 + CHAN4G(216, 0), CHAN4G(218, 0), 229 + CHAN4G(220, 0), CHAN4G(222, 0), 230 + CHAN4G(224, 0), CHAN4G(226, 0), 231 + CHAN4G(228, 0), 228 232 CHAN5G(32, 0), CHAN5G(34, 0), 229 233 CHAN5G(36, 0), CHAN5G(38, 0), 230 234 CHAN5G(40, 0), CHAN5G(42, 0), ··· 280 260 CHAN5G(170, 0), CHAN5G(172, 0), 281 261 CHAN5G(174, 0), CHAN5G(176, 0), 282 262 CHAN5G(178, 0), CHAN5G(180, 0), 283 - CHAN5G(182, 0), CHAN5G(184, 0), 284 - CHAN5G(186, 0), CHAN5G(188, 0), 285 - CHAN5G(190, 0), CHAN5G(192, 0), 286 - CHAN5G(194, 0), CHAN5G(196, 0), 287 - CHAN5G(198, 0), CHAN5G(200, 0), 288 - CHAN5G(202, 0), CHAN5G(204, 0), 289 - CHAN5G(206, 0), CHAN5G(208, 0), 290 - CHAN5G(210, 0), CHAN5G(212, 0), 291 - CHAN5G(214, 0), CHAN5G(216, 0), 292 - CHAN5G(218, 0), CHAN5G(220, 0), 293 - CHAN5G(222, 0), CHAN5G(224, 0), 294 - CHAN5G(226, 0), CHAN5G(228, 0), 263 + CHAN5G(182, 0), 295 264 }; 296 265 297 266 static struct ieee80211_channel b43_5ghz_aphy_chantable[] = { ··· 304 295 CHAN5G(208, 0), CHAN5G(212, 0), 305 296 CHAN5G(216, 0), 306 297 }; 298 + #undef CHAN4G 307 299 #undef CHAN5G 308 300 309 301 static struct ieee80211_supported_band b43_band_5GHz_nphy = { ··· 1185 1175 bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, flags); 1186 1176 udelay(2); 1187 1177 1188 - /* Take PHY out of reset */ 1189 - flags = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); 1190 - flags &= ~B43_BCMA_IOCTL_PHY_RESET; 1191 - flags |= BCMA_IOCTL_FGC; 1192 - bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, flags); 1193 - udelay(1); 1194 - 1195 - /* Do not force clock anymore */ 1196 - flags = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); 1197 - flags &= ~BCMA_IOCTL_FGC; 1198 - bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, flags); 1199 - udelay(1); 1178 + b43_phy_take_out_of_reset(dev); 1200 1179 } 1201 1180 1202 1181 static void b43_bcma_wireless_core_reset(struct b43_wldev *dev, bool gmode) ··· 1207 1208 } 1208 1209 #endif 1209 1210 1211 + #ifdef CONFIG_B43_SSB 1210 1212 static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, bool gmode) 1211 1213 { 1212 - struct ssb_device *sdev = dev->dev->sdev; 1213 - u32 tmslow; 1214 1214 u32 flags = 0; 1215 1215 1216 1216 if (gmode) ··· 1221 1223 b43_device_enable(dev, flags); 1222 1224 msleep(2); /* Wait for the PLL to turn on. */ 1223 1225 1224 - /* Now take the PHY out of Reset again */ 1225 - tmslow = ssb_read32(sdev, SSB_TMSLOW); 1226 - tmslow |= SSB_TMSLOW_FGC; 1227 - tmslow &= ~B43_TMSLOW_PHYRESET; 1228 - ssb_write32(sdev, SSB_TMSLOW, tmslow); 1229 - ssb_read32(sdev, SSB_TMSLOW); /* flush */ 1230 - msleep(1); 1231 - tmslow &= ~SSB_TMSLOW_FGC; 1232 - ssb_write32(sdev, SSB_TMSLOW, tmslow); 1233 - ssb_read32(sdev, SSB_TMSLOW); /* flush */ 1234 - msleep(1); 1226 + b43_phy_take_out_of_reset(dev); 1235 1227 } 1228 + #endif 1236 1229 1237 1230 void b43_wireless_core_reset(struct b43_wldev *dev, bool gmode) 1238 1231 { ··· 2698 2709 struct b43_firmware *fw = &dev->fw; 2699 2710 const struct b43_iv *ivals; 2700 2711 size_t count; 2701 - int err; 2702 2712 2703 2713 hdr = (const struct b43_fw_header *)(fw->initvals.data->data); 2704 2714 ivals = (const struct b43_iv *)(fw->initvals.data->data + hdr_len); 2705 2715 count = be32_to_cpu(hdr->size); 2706 - err = b43_write_initvals(dev, ivals, count, 2716 + return b43_write_initvals(dev, ivals, count, 2707 2717 fw->initvals.data->size - hdr_len); 2708 - if (err) 2709 - goto out; 2710 - if (fw->initvals_band.data) { 2711 - hdr = (const struct b43_fw_header *)(fw->initvals_band.data->data); 2712 - ivals = (const struct b43_iv *)(fw->initvals_band.data->data + hdr_len); 2713 - count = be32_to_cpu(hdr->size); 2714 - err = b43_write_initvals(dev, ivals, count, 2715 - fw->initvals_band.data->size - hdr_len); 2716 - if (err) 2717 - goto out; 2718 - } 2719 - out: 2718 + } 2720 2719 2721 - return err; 2720 + static int b43_upload_initvals_band(struct b43_wldev *dev) 2721 + { 2722 + const size_t hdr_len = sizeof(struct b43_fw_header); 2723 + const struct b43_fw_header *hdr; 2724 + struct b43_firmware *fw = &dev->fw; 2725 + const struct b43_iv *ivals; 2726 + size_t count; 2727 + 2728 + if (!fw->initvals_band.data) 2729 + return 0; 2730 + 2731 + hdr = (const struct b43_fw_header *)(fw->initvals_band.data->data); 2732 + ivals = (const struct b43_iv *)(fw->initvals_band.data->data + hdr_len); 2733 + count = be32_to_cpu(hdr->size); 2734 + return b43_write_initvals(dev, ivals, count, 2735 + fw->initvals_band.data->size - hdr_len); 2722 2736 } 2723 2737 2724 2738 /* Initialize the GPIOs 2725 2739 * http://bcm-specs.sipsolutions.net/GPIO 2726 2740 */ 2741 + 2742 + #ifdef CONFIG_B43_SSB 2727 2743 static struct ssb_device *b43_ssb_gpio_dev(struct b43_wldev *dev) 2728 2744 { 2729 2745 struct ssb_bus *bus = dev->dev->sdev->bus; ··· 2739 2745 return bus->chipco.dev; 2740 2746 #endif 2741 2747 } 2748 + #endif 2742 2749 2743 2750 static int b43_gpio_init(struct b43_wldev *dev) 2744 2751 { 2752 + #ifdef CONFIG_B43_SSB 2745 2753 struct ssb_device *gpiodev; 2754 + #endif 2746 2755 u32 mask, set; 2747 2756 2748 2757 b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_GPOUTSMSK, 0); ··· 2804 2807 /* Turn off all GPIO stuff. Call this on module unload, for example. */ 2805 2808 static void b43_gpio_cleanup(struct b43_wldev *dev) 2806 2809 { 2810 + #ifdef CONFIG_B43_SSB 2807 2811 struct ssb_device *gpiodev; 2812 + #endif 2808 2813 2809 2814 switch (dev->dev->bus_type) { 2810 2815 #ifdef CONFIG_B43_BCMA ··· 3087 3088 goto out; /* firmware is released later */ 3088 3089 3089 3090 err = b43_upload_initvals(dev); 3091 + if (err) 3092 + goto err_gpio_clean; 3093 + 3094 + err = b43_upload_initvals_band(dev); 3090 3095 if (err) 3091 3096 goto err_gpio_clean; 3092 3097 ··· 3693 3690 mutex_unlock(&wl->mutex); 3694 3691 } 3695 3692 3696 - static void b43_put_phy_into_reset(struct b43_wldev *dev) 3697 - { 3698 - u32 tmp; 3699 - 3700 - switch (dev->dev->bus_type) { 3701 - #ifdef CONFIG_B43_BCMA 3702 - case B43_BUS_BCMA: 3703 - b43err(dev->wl, 3704 - "Putting PHY into reset not supported on BCMA\n"); 3705 - break; 3706 - #endif 3707 - #ifdef CONFIG_B43_SSB 3708 - case B43_BUS_SSB: 3709 - tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); 3710 - tmp &= ~B43_TMSLOW_GMODE; 3711 - tmp |= B43_TMSLOW_PHYRESET; 3712 - tmp |= SSB_TMSLOW_FGC; 3713 - ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); 3714 - msleep(1); 3715 - 3716 - tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); 3717 - tmp &= ~SSB_TMSLOW_FGC; 3718 - tmp |= B43_TMSLOW_PHYRESET; 3719 - ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); 3720 - msleep(1); 3721 - 3722 - break; 3723 - #endif 3724 - } 3725 - } 3726 - 3727 3693 static const char *band_to_string(enum ieee80211_band band) 3728 3694 { 3729 3695 switch (band) { ··· 3708 3736 } 3709 3737 3710 3738 /* Expects wl->mutex locked */ 3711 - static int b43_switch_band(struct b43_wl *wl, struct ieee80211_channel *chan) 3739 + static int b43_switch_band(struct b43_wldev *dev, 3740 + struct ieee80211_channel *chan) 3712 3741 { 3713 - struct b43_wldev *up_dev = NULL; 3714 - struct b43_wldev *down_dev; 3715 - int err; 3716 - bool uninitialized_var(gmode); 3717 - int prev_status; 3742 + struct b43_phy *phy = &dev->phy; 3743 + bool gmode; 3744 + u32 tmp; 3718 3745 3719 - /* Find a device and PHY which supports the band. */ 3720 3746 switch (chan->band) { 3721 3747 case IEEE80211_BAND_5GHZ: 3722 - if (wl->current_dev->phy.supports_5ghz) { 3723 - up_dev = wl->current_dev; 3724 - gmode = false; 3725 - } 3748 + gmode = false; 3726 3749 break; 3727 3750 case IEEE80211_BAND_2GHZ: 3728 - if (wl->current_dev->phy.supports_2ghz) { 3729 - up_dev = wl->current_dev; 3730 - gmode = true; 3731 - } 3751 + gmode = true; 3732 3752 break; 3733 3753 default: 3734 3754 B43_WARN_ON(1); 3735 3755 return -EINVAL; 3736 3756 } 3737 3757 3738 - if (!up_dev) { 3739 - b43err(wl, "Could not find a device for %s-GHz band operation\n", 3758 + if (!((gmode && phy->supports_2ghz) || 3759 + (!gmode && phy->supports_5ghz))) { 3760 + b43err(dev->wl, "This device doesn't support %s-GHz band\n", 3740 3761 band_to_string(chan->band)); 3741 3762 return -ENODEV; 3742 3763 } 3743 - if (!!wl->current_dev->phy.gmode == !!gmode) { 3764 + 3765 + if (!!phy->gmode == !!gmode) { 3744 3766 /* This device is already running. */ 3745 3767 return 0; 3746 3768 } 3747 - b43dbg(wl, "Switching to %s-GHz band\n", 3769 + 3770 + b43dbg(dev->wl, "Switching to %s GHz band\n", 3748 3771 band_to_string(chan->band)); 3749 - down_dev = wl->current_dev; 3750 3772 3751 - prev_status = b43_status(down_dev); 3752 - /* Shutdown the currently running core. */ 3753 - if (prev_status >= B43_STAT_STARTED) 3754 - down_dev = b43_wireless_core_stop(down_dev); 3755 - if (prev_status >= B43_STAT_INITIALIZED) 3756 - b43_wireless_core_exit(down_dev); 3773 + b43_software_rfkill(dev, true); 3757 3774 3758 - if (down_dev != up_dev) { 3759 - /* We switch to a different core, so we put PHY into 3760 - * RESET on the old core. */ 3761 - b43_put_phy_into_reset(down_dev); 3775 + phy->gmode = gmode; 3776 + b43_phy_put_into_reset(dev); 3777 + switch (dev->dev->bus_type) { 3778 + #ifdef CONFIG_B43_BCMA 3779 + case B43_BUS_BCMA: 3780 + tmp = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); 3781 + if (gmode) 3782 + tmp |= B43_BCMA_IOCTL_GMODE; 3783 + else 3784 + tmp &= ~B43_BCMA_IOCTL_GMODE; 3785 + bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, tmp); 3786 + break; 3787 + #endif 3788 + #ifdef CONFIG_B43_SSB 3789 + case B43_BUS_SSB: 3790 + tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); 3791 + if (gmode) 3792 + tmp |= B43_TMSLOW_GMODE; 3793 + else 3794 + tmp &= ~B43_TMSLOW_GMODE; 3795 + ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); 3796 + break; 3797 + #endif 3762 3798 } 3799 + b43_phy_take_out_of_reset(dev); 3763 3800 3764 - /* Now start the new core. */ 3765 - up_dev->phy.gmode = gmode; 3766 - if (prev_status >= B43_STAT_INITIALIZED) { 3767 - err = b43_wireless_core_init(up_dev); 3768 - if (err) { 3769 - b43err(wl, "Fatal: Could not initialize device for " 3770 - "selected %s-GHz band\n", 3771 - band_to_string(chan->band)); 3772 - goto init_failure; 3773 - } 3774 - } 3775 - if (prev_status >= B43_STAT_STARTED) { 3776 - err = b43_wireless_core_start(up_dev); 3777 - if (err) { 3778 - b43err(wl, "Fatal: Could not start device for " 3779 - "selected %s-GHz band\n", 3780 - band_to_string(chan->band)); 3781 - b43_wireless_core_exit(up_dev); 3782 - goto init_failure; 3783 - } 3784 - } 3785 - B43_WARN_ON(b43_status(up_dev) != prev_status); 3801 + b43_upload_initvals_band(dev); 3786 3802 3787 - wl->current_dev = up_dev; 3803 + b43_phy_init(dev); 3788 3804 3789 3805 return 0; 3790 - init_failure: 3791 - /* Whoops, failed to init the new core. No core is operating now. */ 3792 - wl->current_dev = NULL; 3793 - return err; 3794 3806 } 3795 3807 3796 3808 /* Write the short and long frame retry limit values. */ ··· 3807 3851 3808 3852 dev = wl->current_dev; 3809 3853 3854 + b43_mac_suspend(dev); 3855 + 3810 3856 /* Switch the band (if necessary). This might change the active core. */ 3811 - err = b43_switch_band(wl, conf->chandef.chan); 3857 + err = b43_switch_band(dev, conf->chandef.chan); 3812 3858 if (err) 3813 3859 goto out_unlock_mutex; 3814 3860 ··· 3828 3870 (conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf)); 3829 3871 else 3830 3872 phy->is_40mhz = false; 3831 - 3832 - b43_mac_suspend(dev); 3833 3873 3834 3874 if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) 3835 3875 b43_set_retry_limits(dev, conf->short_frame_max_tx_count, ··· 4538 4582 struct ssb_bus *bus; 4539 4583 u32 tmp; 4540 4584 4585 + #ifdef CONFIG_B43_SSB 4541 4586 if (dev->dev->bus_type != B43_BUS_SSB) 4542 4587 return; 4588 + #else 4589 + return; 4590 + #endif 4543 4591 4544 4592 bus = dev->dev->sdev->bus; 4545 4593 ··· 4698 4738 } 4699 4739 if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW) 4700 4740 hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */ 4701 - #ifdef CONFIG_SSB_DRIVER_PCICORE 4741 + #if defined(CONFIG_B43_SSB) && defined(CONFIG_SSB_DRIVER_PCICORE) 4702 4742 if (dev->dev->bus_type == B43_BUS_SSB && 4703 4743 dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI && 4704 4744 dev->dev->sdev->bus->pcicore.dev->id.revision <= 10) ··· 5089 5129 b43_phy_free(dev); 5090 5130 } 5091 5131 5132 + static void b43_supported_bands(struct b43_wldev *dev, bool *have_2ghz_phy, 5133 + bool *have_5ghz_phy) 5134 + { 5135 + u16 dev_id = 0; 5136 + 5137 + #ifdef CONFIG_B43_BCMA 5138 + if (dev->dev->bus_type == B43_BUS_BCMA && 5139 + dev->dev->bdev->bus->hosttype == BCMA_HOSTTYPE_PCI) 5140 + dev_id = dev->dev->bdev->bus->host_pci->device; 5141 + #endif 5142 + #ifdef CONFIG_B43_SSB 5143 + if (dev->dev->bus_type == B43_BUS_SSB && 5144 + dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI) 5145 + dev_id = dev->dev->sdev->bus->host_pci->device; 5146 + #endif 5147 + /* Override with SPROM value if available */ 5148 + if (dev->dev->bus_sprom->dev_id) 5149 + dev_id = dev->dev->bus_sprom->dev_id; 5150 + 5151 + /* Note: below IDs can be "virtual" (not maching e.g. real PCI ID) */ 5152 + switch (dev_id) { 5153 + case 0x4324: /* BCM4306 */ 5154 + case 0x4312: /* BCM4311 */ 5155 + case 0x4319: /* BCM4318 */ 5156 + case 0x4328: /* BCM4321 */ 5157 + case 0x432b: /* BCM4322 */ 5158 + case 0x4350: /* BCM43222 */ 5159 + case 0x4353: /* BCM43224 */ 5160 + case 0x0576: /* BCM43224 */ 5161 + case 0x435f: /* BCM6362 */ 5162 + case 0x4331: /* BCM4331 */ 5163 + case 0x4359: /* BCM43228 */ 5164 + case 0x43a0: /* BCM4360 */ 5165 + case 0x43b1: /* BCM4352 */ 5166 + /* Dual band devices */ 5167 + *have_2ghz_phy = true; 5168 + *have_5ghz_phy = true; 5169 + return; 5170 + case 0x4321: /* BCM4306 */ 5171 + case 0x4313: /* BCM4311 */ 5172 + case 0x431a: /* BCM4318 */ 5173 + case 0x432a: /* BCM4321 */ 5174 + case 0x432d: /* BCM4322 */ 5175 + case 0x4352: /* BCM43222 */ 5176 + case 0x4333: /* BCM4331 */ 5177 + case 0x43a2: /* BCM4360 */ 5178 + case 0x43b3: /* BCM4352 */ 5179 + /* 5 GHz only devices */ 5180 + *have_2ghz_phy = false; 5181 + *have_5ghz_phy = true; 5182 + return; 5183 + } 5184 + 5185 + /* As a fallback, try to guess using PHY type */ 5186 + switch (dev->phy.type) { 5187 + case B43_PHYTYPE_A: 5188 + *have_2ghz_phy = false; 5189 + *have_5ghz_phy = true; 5190 + return; 5191 + case B43_PHYTYPE_G: 5192 + case B43_PHYTYPE_N: 5193 + case B43_PHYTYPE_LP: 5194 + case B43_PHYTYPE_HT: 5195 + case B43_PHYTYPE_LCN: 5196 + *have_2ghz_phy = true; 5197 + *have_5ghz_phy = false; 5198 + return; 5199 + } 5200 + 5201 + B43_WARN_ON(1); 5202 + } 5203 + 5092 5204 static int b43_wireless_core_attach(struct b43_wldev *dev) 5093 5205 { 5094 5206 struct b43_wl *wl = dev->wl; 5095 - struct pci_dev *pdev = NULL; 5096 5207 int err; 5097 5208 u32 tmp; 5098 5209 bool have_2ghz_phy = false, have_5ghz_phy = false; ··· 5175 5144 * that in core_init(), too. 5176 5145 */ 5177 5146 5178 - #ifdef CONFIG_B43_SSB 5179 - if (dev->dev->bus_type == B43_BUS_SSB && 5180 - dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI) 5181 - pdev = dev->dev->sdev->bus->host_pci; 5182 - #endif 5183 - 5184 5147 err = b43_bus_powerup(dev, 0); 5185 5148 if (err) { 5186 5149 b43err(wl, "Bus powerup failed\n"); 5187 5150 goto out; 5188 5151 } 5189 5152 5190 - /* Get the PHY type. */ 5153 + /* Try to guess supported bands for the first init needs */ 5191 5154 switch (dev->dev->bus_type) { 5192 5155 #ifdef CONFIG_B43_BCMA 5193 5156 case B43_BUS_BCMA: ··· 5205 5180 dev->phy.gmode = have_2ghz_phy; 5206 5181 b43_wireless_core_reset(dev, dev->phy.gmode); 5207 5182 5183 + /* Get the PHY type. */ 5208 5184 err = b43_phy_versioning(dev); 5209 5185 if (err) 5210 5186 goto err_powerdown; 5211 - /* Check if this device supports multiband. */ 5212 - if (!pdev || 5213 - (pdev->device != 0x4312 && 5214 - pdev->device != 0x4319 && pdev->device != 0x4324)) { 5215 - /* No multiband support. */ 5216 - have_2ghz_phy = false; 5187 + 5188 + /* Get real info about supported bands */ 5189 + b43_supported_bands(dev, &have_2ghz_phy, &have_5ghz_phy); 5190 + 5191 + /* We don't support 5 GHz on some PHYs yet */ 5192 + switch (dev->phy.type) { 5193 + case B43_PHYTYPE_A: 5194 + case B43_PHYTYPE_N: 5195 + case B43_PHYTYPE_LP: 5196 + case B43_PHYTYPE_HT: 5197 + b43warn(wl, "5 GHz band is unsupported on this PHY\n"); 5217 5198 have_5ghz_phy = false; 5218 - switch (dev->phy.type) { 5219 - case B43_PHYTYPE_A: 5220 - have_5ghz_phy = true; 5221 - break; 5222 - case B43_PHYTYPE_LP: //FIXME not always! 5223 - #if 0 //FIXME enabling 5GHz causes a NULL pointer dereference 5224 - have_5ghz_phy = 1; 5225 - #endif 5226 - case B43_PHYTYPE_G: 5227 - case B43_PHYTYPE_N: 5228 - case B43_PHYTYPE_HT: 5229 - case B43_PHYTYPE_LCN: 5230 - have_2ghz_phy = true; 5231 - break; 5232 - default: 5233 - B43_WARN_ON(1); 5234 - } 5235 5199 } 5236 - if (dev->phy.type == B43_PHYTYPE_A) { 5237 - /* FIXME */ 5238 - b43err(wl, "IEEE 802.11a devices are unsupported\n"); 5200 + 5201 + if (!have_2ghz_phy && !have_5ghz_phy) { 5202 + b43err(wl, "b43 can't support any band on this device\n"); 5239 5203 err = -EOPNOTSUPP; 5240 5204 goto err_powerdown; 5241 - } 5242 - if (1 /* disable A-PHY */) { 5243 - /* FIXME: For now we disable the A-PHY on multi-PHY devices. */ 5244 - if (dev->phy.type != B43_PHYTYPE_N && 5245 - dev->phy.type != B43_PHYTYPE_LP) { 5246 - have_2ghz_phy = true; 5247 - have_5ghz_phy = false; 5248 - } 5249 5205 } 5250 5206 5251 5207 err = b43_phy_allocate(dev); ··· 5316 5310 (pdev->subsystem_vendor == PCI_VENDOR_ID_##_subvendor) && \ 5317 5311 (pdev->subsystem_device == _subdevice) ) 5318 5312 5313 + #ifdef CONFIG_B43_SSB 5319 5314 static void b43_sprom_fixup(struct ssb_bus *bus) 5320 5315 { 5321 5316 struct pci_dev *pdev; ··· 5348 5341 ssb_set_devtypedata(dev->sdev, NULL); 5349 5342 ieee80211_free_hw(hw); 5350 5343 } 5344 + #endif 5351 5345 5352 5346 static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev) 5353 5347 {
+85
drivers/net/wireless/b43/phy_common.c
··· 96 96 97 97 phy->channel = ops->get_default_chan(dev); 98 98 99 + phy->ops->switch_analog(dev, true); 99 100 b43_software_rfkill(dev, false); 100 101 err = ops->init(dev); 101 102 if (err) { ··· 310 309 } else { 311 310 b43_phy_write(dev, offset, 312 311 (b43_phy_read(dev, offset) & mask) | set); 312 + } 313 + } 314 + 315 + void b43_phy_put_into_reset(struct b43_wldev *dev) 316 + { 317 + u32 tmp; 318 + 319 + switch (dev->dev->bus_type) { 320 + #ifdef CONFIG_B43_BCMA 321 + case B43_BUS_BCMA: 322 + tmp = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); 323 + tmp &= ~B43_BCMA_IOCTL_GMODE; 324 + tmp |= B43_BCMA_IOCTL_PHY_RESET; 325 + tmp |= BCMA_IOCTL_FGC; 326 + bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, tmp); 327 + udelay(1); 328 + 329 + tmp = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); 330 + tmp &= ~BCMA_IOCTL_FGC; 331 + bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, tmp); 332 + udelay(1); 333 + break; 334 + #endif 335 + #ifdef CONFIG_B43_SSB 336 + case B43_BUS_SSB: 337 + tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); 338 + tmp &= ~B43_TMSLOW_GMODE; 339 + tmp |= B43_TMSLOW_PHYRESET; 340 + tmp |= SSB_TMSLOW_FGC; 341 + ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); 342 + usleep_range(1000, 2000); 343 + 344 + tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); 345 + tmp &= ~SSB_TMSLOW_FGC; 346 + ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); 347 + usleep_range(1000, 2000); 348 + 349 + break; 350 + #endif 351 + } 352 + } 353 + 354 + void b43_phy_take_out_of_reset(struct b43_wldev *dev) 355 + { 356 + u32 tmp; 357 + 358 + switch (dev->dev->bus_type) { 359 + #ifdef CONFIG_B43_BCMA 360 + case B43_BUS_BCMA: 361 + /* Unset reset bit (with forcing clock) */ 362 + tmp = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); 363 + tmp &= ~B43_BCMA_IOCTL_PHY_RESET; 364 + tmp &= ~B43_BCMA_IOCTL_PHY_CLKEN; 365 + tmp |= BCMA_IOCTL_FGC; 366 + bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, tmp); 367 + udelay(1); 368 + 369 + /* Do not force clock anymore */ 370 + tmp = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); 371 + tmp &= ~BCMA_IOCTL_FGC; 372 + tmp |= B43_BCMA_IOCTL_PHY_CLKEN; 373 + bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, tmp); 374 + udelay(1); 375 + break; 376 + #endif 377 + #ifdef CONFIG_B43_SSB 378 + case B43_BUS_SSB: 379 + /* Unset reset bit (with forcing clock) */ 380 + tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); 381 + tmp &= ~B43_TMSLOW_PHYRESET; 382 + tmp &= ~B43_TMSLOW_PHYCLKEN; 383 + tmp |= SSB_TMSLOW_FGC; 384 + ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); 385 + ssb_read32(dev->dev->sdev, SSB_TMSLOW); /* flush */ 386 + usleep_range(1000, 2000); 387 + 388 + tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); 389 + tmp &= ~SSB_TMSLOW_FGC; 390 + tmp |= B43_TMSLOW_PHYCLKEN; 391 + ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); 392 + ssb_read32(dev->dev->sdev, SSB_TMSLOW); /* flush */ 393 + usleep_range(1000, 2000); 394 + break; 395 + #endif 313 396 } 314 397 } 315 398
+4 -1
drivers/net/wireless/b43/phy_common.h
··· 231 231 /* HT info */ 232 232 bool is_40mhz; 233 233 234 - /* GMODE bit enabled? */ 234 + /* Is GMODE (2 GHz mode) bit enabled? */ 235 235 bool gmode; 236 236 237 237 /* Analog Type */ ··· 389 389 * b43_phy_unlock - Unlock firmware PHY register access 390 390 */ 391 391 void b43_phy_unlock(struct b43_wldev *dev); 392 + 393 + void b43_phy_put_into_reset(struct b43_wldev *dev); 394 + void b43_phy_take_out_of_reset(struct b43_wldev *dev); 392 395 393 396 /** 394 397 * b43_switch_channel - Switch to another channel
+918
drivers/net/wireless/b43/radio_2056.c
··· 9058 9058 9059 9059 static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_radio_rev11[] = { 9060 9060 { 9061 + .freq = 4920, 9062 + RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x02, 9063 + 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 9064 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9065 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9066 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9067 + PHYREGS(0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216), 9068 + }, 9069 + { 9070 + .freq = 4930, 9071 + RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x02, 9072 + 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 9073 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9074 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9075 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9076 + PHYREGS(0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215), 9077 + }, 9078 + { 9079 + .freq = 4940, 9080 + RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x02, 9081 + 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 9082 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9083 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9084 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9085 + PHYREGS(0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214), 9086 + }, 9087 + { 9088 + .freq = 4950, 9089 + RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x02, 9090 + 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 9091 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9092 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9093 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9094 + PHYREGS(0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213), 9095 + }, 9096 + { 9097 + .freq = 4960, 9098 + RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x02, 9099 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9100 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9101 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9102 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9103 + PHYREGS(0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212), 9104 + }, 9105 + { 9106 + .freq = 4970, 9107 + RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x02, 9108 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9109 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9110 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9111 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9112 + PHYREGS(0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211), 9113 + }, 9114 + { 9115 + .freq = 4980, 9116 + RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x02, 9117 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9118 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9119 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9120 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9121 + PHYREGS(0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f), 9122 + }, 9123 + { 9124 + .freq = 4990, 9125 + RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x02, 9126 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9127 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9128 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9129 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9130 + PHYREGS(0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e), 9131 + }, 9132 + { 9133 + .freq = 5000, 9134 + RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x02, 9135 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9136 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9137 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9138 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9139 + PHYREGS(0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d), 9140 + }, 9141 + { 9142 + .freq = 5010, 9143 + RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x02, 9144 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9145 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9146 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9147 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9148 + PHYREGS(0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c), 9149 + }, 9150 + { 9151 + .freq = 5020, 9152 + RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x02, 9153 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9154 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9155 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9156 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9157 + PHYREGS(0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b), 9158 + }, 9159 + { 9160 + .freq = 5030, 9161 + RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x02, 9162 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9163 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9164 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9165 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9166 + PHYREGS(0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a), 9167 + }, 9168 + { 9169 + .freq = 5040, 9170 + RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x02, 9171 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9172 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9173 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9174 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9175 + PHYREGS(0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209), 9176 + }, 9177 + { 9178 + .freq = 5050, 9179 + RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x02, 9180 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9181 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9182 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9183 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9184 + PHYREGS(0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208), 9185 + }, 9186 + { 9187 + .freq = 5060, 9188 + RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x02, 9189 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9190 + 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9191 + 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 9192 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9193 + PHYREGS(0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207), 9194 + }, 9195 + { 9196 + .freq = 5070, 9197 + RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x02, 9198 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9199 + 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9200 + 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, 9201 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9202 + PHYREGS(0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206), 9203 + }, 9204 + { 9205 + .freq = 5080, 9206 + RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x02, 9207 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9208 + 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9209 + 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, 9210 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9211 + PHYREGS(0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205), 9212 + }, 9213 + { 9214 + .freq = 5090, 9215 + RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x02, 9216 + 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 9217 + 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, 9218 + 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, 9219 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9220 + PHYREGS(0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204), 9221 + }, 9222 + { 9223 + .freq = 5100, 9224 + RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x02, 9225 + 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 9226 + 0xff, 0xfd, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, 9227 + 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x08, 0x00, 0x77, 9228 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9229 + PHYREGS(0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203), 9230 + }, 9231 + { 9232 + .freq = 5110, 9233 + RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x02, 9234 + 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 9235 + 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, 9236 + 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, 9237 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9238 + PHYREGS(0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202), 9239 + }, 9240 + { 9241 + .freq = 5120, 9242 + RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x02, 9243 + 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 9244 + 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, 9245 + 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, 9246 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9247 + PHYREGS(0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201), 9248 + }, 9249 + { 9250 + .freq = 5130, 9251 + RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x02, 9252 + 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 9253 + 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, 9254 + 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, 9255 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9256 + PHYREGS(0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200), 9257 + }, 9258 + { 9259 + .freq = 5140, 9260 + RADIOREGS3(0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x02, 9261 + 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 9262 + 0xff, 0xfb, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, 9263 + 0x00, 0x6f, 0x00, 0xfb, 0x00, 0x08, 0x00, 0x77, 9264 + 0x00, 0x0f, 0x00, 0x6f, 0x00), 9265 + PHYREGS(0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff), 9266 + }, 9267 + { 9268 + .freq = 5160, 9269 + RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x02, 9270 + 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 9271 + 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, 9272 + 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, 9273 + 0x00, 0x0e, 0x00, 0x6f, 0x00), 9274 + PHYREGS(0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd), 9275 + }, 9276 + { 9277 + .freq = 5170, 9278 + RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x02, 9279 + 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 9280 + 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, 9281 + 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, 9282 + 0x00, 0x0e, 0x00, 0x6f, 0x00), 9283 + PHYREGS(0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc), 9284 + }, 9285 + { 9061 9286 .freq = 5180, 9062 9287 RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x02, 9063 9288 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, ··· 9290 9065 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, 9291 9066 0x00, 0x0e, 0x00, 0x6f, 0x00), 9292 9067 PHYREGS(0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb), 9068 + }, 9069 + { 9070 + .freq = 5190, 9071 + RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x02, 9072 + 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 9073 + 0xff, 0xf9, 0x00, 0x06, 0x00, 0x77, 0x00, 0x0d, 9074 + 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, 9075 + 0x00, 0x0d, 0x00, 0x6f, 0x00), 9076 + PHYREGS(0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa), 9293 9077 }, 9294 9078 { 9295 9079 .freq = 5200, ··· 9310 9076 PHYREGS(0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9), 9311 9077 }, 9312 9078 { 9079 + .freq = 5210, 9080 + RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x02, 9081 + 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 9082 + 0xff, 0xf9, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, 9083 + 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x05, 0x00, 0x77, 9084 + 0x00, 0x0d, 0x00, 0x6f, 0x00), 9085 + PHYREGS(0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8), 9086 + }, 9087 + { 9313 9088 .freq = 5220, 9314 9089 RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x02, 9315 9090 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, ··· 9326 9083 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, 9327 9084 0x00, 0x0d, 0x00, 0x6f, 0x00), 9328 9085 PHYREGS(0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7), 9086 + }, 9087 + { 9088 + .freq = 5230, 9089 + RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x02, 9090 + 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 9091 + 0xee, 0xd8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, 9092 + 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, 9093 + 0x00, 0x0d, 0x00, 0x6f, 0x00), 9094 + PHYREGS(0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6), 9095 + }, 9096 + { 9097 + .freq = 5240, 9098 + RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x02, 9099 + 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 9100 + 0xee, 0xc8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, 9101 + 0x00, 0x6f, 0x00, 0xc8, 0x00, 0x05, 0x00, 0x77, 9102 + 0x00, 0x0d, 0x00, 0x6f, 0x00), 9103 + PHYREGS(0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5), 9104 + }, 9105 + { 9106 + .freq = 5250, 9107 + RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x02, 9108 + 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 9109 + 0xed, 0xc7, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, 9110 + 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x05, 0x00, 0x77, 9111 + 0x00, 0x0d, 0x00, 0x6f, 0x00), 9112 + PHYREGS(0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4), 9113 + }, 9114 + { 9115 + .freq = 5260, 9116 + RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x02, 9117 + 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0e, 0x00, 9118 + 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0d, 9119 + 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, 9120 + 0x00, 0x0d, 0x00, 0x6f, 0x00), 9121 + PHYREGS(0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3), 9122 + }, 9123 + { 9124 + .freq = 5270, 9125 + RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x02, 9126 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8e, 0x0e, 0x00, 9127 + 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0c, 9128 + 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, 9129 + 0x00, 0x0c, 0x00, 0x6f, 0x00), 9130 + PHYREGS(0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2), 9131 + }, 9132 + { 9133 + .freq = 5280, 9134 + RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x02, 9135 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 9136 + 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, 9137 + 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 9138 + 0x00, 0x0c, 0x00, 0x6f, 0x00), 9139 + PHYREGS(0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1), 9140 + }, 9141 + { 9142 + .freq = 5290, 9143 + RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x02, 9144 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 9145 + 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, 9146 + 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 9147 + 0x00, 0x0c, 0x00, 0x6f, 0x00), 9148 + PHYREGS(0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0), 9149 + }, 9150 + { 9151 + .freq = 5300, 9152 + RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x02, 9153 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 9154 + 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, 9155 + 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 9156 + 0x00, 0x0c, 0x00, 0x6f, 0x00), 9157 + PHYREGS(0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0), 9158 + }, 9159 + { 9160 + .freq = 5310, 9161 + RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x02, 9162 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 9163 + 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, 9164 + 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 9165 + 0x00, 0x0c, 0x00, 0x6f, 0x00), 9166 + PHYREGS(0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef), 9167 + }, 9168 + { 9169 + .freq = 5320, 9170 + RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x02, 9171 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 9172 + 0xdb, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, 9173 + 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 9174 + 0x00, 0x0c, 0x00, 0x6f, 0x00), 9175 + PHYREGS(0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee), 9176 + }, 9177 + { 9178 + .freq = 5330, 9179 + RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x02, 9180 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 9181 + 0xcb, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, 9182 + 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, 9183 + 0x00, 0x0b, 0x00, 0x6f, 0x00), 9184 + PHYREGS(0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed), 9185 + }, 9186 + { 9187 + .freq = 5340, 9188 + RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x02, 9189 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 9190 + 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, 9191 + 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, 9192 + 0x00, 0x0b, 0x00, 0x6f, 0x00), 9193 + PHYREGS(0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec), 9194 + }, 9195 + { 9196 + .freq = 5350, 9197 + RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x02, 9198 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 9199 + 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, 9200 + 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, 9201 + 0x00, 0x0b, 0x00, 0x6f, 0x00), 9202 + PHYREGS(0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb), 9203 + }, 9204 + { 9205 + .freq = 5360, 9206 + RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x02, 9207 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 9208 + 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, 9209 + 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, 9210 + 0x00, 0x0a, 0x00, 0x6f, 0x00), 9211 + PHYREGS(0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea), 9212 + }, 9213 + { 9214 + .freq = 5370, 9215 + RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x02, 9216 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 9217 + 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, 9218 + 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, 9219 + 0x00, 0x0a, 0x00, 0x6f, 0x00), 9220 + PHYREGS(0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9), 9221 + }, 9222 + { 9223 + .freq = 5380, 9224 + RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x02, 9225 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 9226 + 0xb8, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, 9227 + 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, 9228 + 0x00, 0x0a, 0x00, 0x6f, 0x00), 9229 + PHYREGS(0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8), 9230 + }, 9231 + { 9232 + .freq = 5390, 9233 + RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x02, 9234 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 9235 + 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, 9236 + 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, 9237 + 0x00, 0x0a, 0x00, 0x6f, 0x00), 9238 + PHYREGS(0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7), 9239 + }, 9240 + { 9241 + .freq = 5400, 9242 + RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x02, 9243 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 9244 + 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, 9245 + 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, 9246 + 0x00, 0x0a, 0x00, 0x6f, 0x00), 9247 + PHYREGS(0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6), 9248 + }, 9249 + { 9250 + .freq = 5410, 9251 + RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x02, 9252 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 9253 + 0xb7, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, 9254 + 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 9255 + 0x00, 0x0a, 0x00, 0x6f, 0x00), 9256 + PHYREGS(0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5), 9257 + }, 9258 + { 9259 + .freq = 5420, 9260 + RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x02, 9261 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 9262 + 0xa7, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, 9263 + 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 9264 + 0x00, 0x0a, 0x00, 0x6f, 0x00), 9265 + PHYREGS(0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5), 9266 + }, 9267 + { 9268 + .freq = 5430, 9269 + RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x02, 9270 + 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0b, 0x00, 9271 + 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, 9272 + 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 9273 + 0x00, 0x0a, 0x00, 0x6f, 0x00), 9274 + PHYREGS(0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4), 9275 + }, 9276 + { 9277 + .freq = 5440, 9278 + RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x02, 9279 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 9280 + 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x09, 9281 + 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 9282 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9283 + PHYREGS(0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3), 9284 + }, 9285 + { 9286 + .freq = 5450, 9287 + RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x02, 9288 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 9289 + 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, 9290 + 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, 9291 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9292 + PHYREGS(0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2), 9293 + }, 9294 + { 9295 + .freq = 5460, 9296 + RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x02, 9297 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 9298 + 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, 9299 + 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, 9300 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9301 + PHYREGS(0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1), 9302 + }, 9303 + { 9304 + .freq = 5470, 9305 + RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x02, 9306 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 9307 + 0x94, 0x73, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, 9308 + 0x00, 0x6f, 0x00, 0x73, 0x00, 0x01, 0x00, 0x77, 9309 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9310 + PHYREGS(0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0), 9311 + }, 9312 + { 9313 + .freq = 5480, 9314 + RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x02, 9315 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 9316 + 0x84, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, 9317 + 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 9318 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9319 + PHYREGS(0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df), 9320 + }, 9321 + { 9322 + .freq = 5490, 9323 + RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x02, 9324 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 9325 + 0x83, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, 9326 + 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 9327 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9328 + PHYREGS(0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de), 9329 + }, 9330 + { 9331 + .freq = 5500, 9332 + RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x02, 9333 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 9334 + 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, 9335 + 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 9336 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9337 + PHYREGS(0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd), 9338 + }, 9339 + { 9340 + .freq = 5510, 9341 + RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x02, 9342 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 9343 + 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, 9344 + 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 9345 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9346 + PHYREGS(0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd), 9347 + }, 9348 + { 9349 + .freq = 5520, 9350 + RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x02, 9351 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 9352 + 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, 9353 + 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 9354 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9355 + PHYREGS(0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc), 9356 + }, 9357 + { 9358 + .freq = 5530, 9359 + RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x02, 9360 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, 9361 + 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, 9362 + 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 9363 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9364 + PHYREGS(0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db), 9365 + }, 9366 + { 9367 + .freq = 5540, 9368 + RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x02, 9369 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, 9370 + 0x71, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, 9371 + 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 9372 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9373 + PHYREGS(0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da), 9374 + }, 9375 + { 9376 + .freq = 5550, 9377 + RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x02, 9378 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 9379 + 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, 9380 + 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 9381 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9382 + PHYREGS(0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9), 9383 + }, 9384 + { 9385 + .freq = 5560, 9386 + RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x02, 9387 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 9388 + 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, 9389 + 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 9390 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9391 + PHYREGS(0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8), 9392 + }, 9393 + { 9394 + .freq = 5570, 9395 + RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x02, 9396 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 9397 + 0x61, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, 9398 + 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, 9399 + 0x00, 0x09, 0x00, 0x6f, 0x00), 9400 + PHYREGS(0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7), 9401 + }, 9402 + { 9403 + .freq = 5580, 9404 + RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x02, 9405 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, 9406 + 0x60, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, 9407 + 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, 9408 + 0x00, 0x08, 0x00, 0x6f, 0x00), 9409 + PHYREGS(0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7), 9410 + }, 9411 + { 9412 + .freq = 5590, 9413 + RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x02, 9414 + 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, 9415 + 0x50, 0x61, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, 9416 + 0x00, 0x6f, 0x00, 0x61, 0x00, 0x00, 0x00, 0x77, 9417 + 0x00, 0x08, 0x00, 0x6f, 0x00), 9418 + PHYREGS(0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6), 9419 + }, 9420 + { 9421 + .freq = 5600, 9422 + RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x02, 9423 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 9424 + 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, 9425 + 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, 9426 + 0x00, 0x08, 0x00, 0x6f, 0x00), 9427 + PHYREGS(0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5), 9428 + }, 9429 + { 9430 + .freq = 5610, 9431 + RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x02, 9432 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 9433 + 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, 9434 + 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, 9435 + 0x00, 0x08, 0x00, 0x6f, 0x00), 9436 + PHYREGS(0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4), 9437 + }, 9438 + { 9439 + .freq = 5620, 9440 + RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x02, 9441 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 9442 + 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, 9443 + 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, 9444 + 0x00, 0x07, 0x00, 0x6f, 0x00), 9445 + PHYREGS(0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3), 9446 + }, 9447 + { 9448 + .freq = 5630, 9449 + RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x02, 9450 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 9451 + 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, 9452 + 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, 9453 + 0x00, 0x07, 0x00, 0x6f, 0x00), 9454 + PHYREGS(0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2), 9455 + }, 9456 + { 9457 + .freq = 5640, 9458 + RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x02, 9459 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 9460 + 0x40, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, 9461 + 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, 9462 + 0x00, 0x07, 0x00, 0x6f, 0x00), 9463 + PHYREGS(0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2), 9464 + }, 9465 + { 9466 + .freq = 5650, 9467 + RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x02, 9468 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 9469 + 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, 9470 + 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, 9471 + 0x00, 0x07, 0x00, 0x6f, 0x00), 9472 + PHYREGS(0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1), 9473 + }, 9474 + { 9475 + .freq = 5660, 9476 + RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x02, 9477 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 9478 + 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, 9479 + 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, 9480 + 0x00, 0x06, 0x00, 0x6f, 0x00), 9481 + PHYREGS(0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0), 9482 + }, 9483 + { 9484 + .freq = 5670, 9485 + RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x02, 9486 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 9487 + 0x40, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, 9488 + 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 9489 + 0x00, 0x06, 0x00, 0x6f, 0x00), 9490 + PHYREGS(0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf), 9491 + }, 9492 + { 9493 + .freq = 5680, 9494 + RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x02, 9495 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 9496 + 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, 9497 + 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 9498 + 0x00, 0x06, 0x00, 0x6f, 0x00), 9499 + PHYREGS(0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce), 9500 + }, 9501 + { 9502 + .freq = 5690, 9503 + RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x02, 9504 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 9505 + 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, 9506 + 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 9507 + 0x00, 0x06, 0x00, 0x6f, 0x00), 9508 + PHYREGS(0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce), 9509 + }, 9510 + { 9511 + .freq = 5700, 9512 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x02, 9513 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 9514 + 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, 9515 + 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 9516 + 0x00, 0x06, 0x00, 0x6e, 0x00), 9517 + PHYREGS(0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd), 9518 + }, 9519 + { 9520 + .freq = 5710, 9521 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x02, 9522 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 9523 + 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, 9524 + 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 9525 + 0x00, 0x06, 0x00, 0x6e, 0x00), 9526 + PHYREGS(0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc), 9527 + }, 9528 + { 9529 + .freq = 5720, 9530 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x02, 9531 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 9532 + 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, 9533 + 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 9534 + 0x00, 0x06, 0x00, 0x6e, 0x00), 9535 + PHYREGS(0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb), 9536 + }, 9537 + { 9538 + .freq = 5725, 9539 + RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x79, 0x05, 0x05, 0x02, 9540 + 0x15, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 9541 + 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, 9542 + 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 9543 + 0x00, 0x06, 0x00, 0x6e, 0x00), 9544 + PHYREGS(0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb), 9545 + }, 9546 + { 9547 + .freq = 5730, 9548 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x02, 9549 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 9550 + 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, 9551 + 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 9552 + 0x00, 0x06, 0x00, 0x6e, 0x00), 9553 + PHYREGS(0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca), 9554 + }, 9555 + { 9556 + .freq = 5735, 9557 + RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x7b, 0x05, 0x05, 0x02, 9558 + 0x15, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 9559 + 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, 9560 + 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 9561 + 0x00, 0x06, 0x00, 0x6d, 0x00), 9562 + PHYREGS(0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca), 9563 + }, 9564 + { 9565 + .freq = 5740, 9566 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x02, 9567 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 9568 + 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, 9569 + 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 9570 + 0x00, 0x06, 0x00, 0x6d, 0x00), 9571 + PHYREGS(0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9), 9329 9572 }, 9330 9573 { 9331 9574 .freq = 5745, ··· 9823 9094 PHYREGS(0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9), 9824 9095 }, 9825 9096 { 9097 + .freq = 5750, 9098 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x02, 9099 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 9100 + 0x20, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, 9101 + 0x00, 0x6d, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, 9102 + 0x00, 0x05, 0x00, 0x6d, 0x00), 9103 + PHYREGS(0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9), 9104 + }, 9105 + { 9106 + .freq = 5755, 9107 + RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7f, 0x05, 0x05, 0x02, 9108 + 0x15, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 9109 + 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, 9110 + 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, 9111 + 0x00, 0x05, 0x00, 0x6c, 0x00), 9112 + PHYREGS(0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8), 9113 + }, 9114 + { 9115 + .freq = 5760, 9116 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x02, 9117 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, 9118 + 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, 9119 + 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, 9120 + 0x00, 0x05, 0x00, 0x6c, 0x00), 9121 + PHYREGS(0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8), 9122 + }, 9123 + { 9826 9124 .freq = 5765, 9827 9125 RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x81, 0x05, 0x05, 0x02, 9828 9126 0x15, 0x01, 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, ··· 9857 9101 0x00, 0x6c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 9858 9102 0x00, 0x05, 0x00, 0x6c, 0x00), 9859 9103 PHYREGS(0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8), 9104 + }, 9105 + { 9106 + .freq = 5770, 9107 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x02, 9108 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 9109 + 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, 9110 + 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 9111 + 0x00, 0x05, 0x00, 0x6b, 0x00), 9112 + PHYREGS(0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7), 9113 + }, 9114 + { 9115 + .freq = 5775, 9116 + RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x83, 0x05, 0x05, 0x02, 9117 + 0x15, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 9118 + 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, 9119 + 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 9120 + 0x00, 0x05, 0x00, 0x6b, 0x00), 9121 + PHYREGS(0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7), 9122 + }, 9123 + { 9124 + .freq = 5780, 9125 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x02, 9126 + 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 9127 + 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, 9128 + 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 9129 + 0x00, 0x05, 0x00, 0x6b, 0x00), 9130 + PHYREGS(0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6), 9860 9131 }, 9861 9132 { 9862 9133 .freq = 5785, ··· 9895 9112 PHYREGS(0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6), 9896 9113 }, 9897 9114 { 9115 + .freq = 5790, 9116 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x02, 9117 + 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 9118 + 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, 9119 + 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 9120 + 0x00, 0x05, 0x00, 0x6b, 0x00), 9121 + PHYREGS(0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6), 9122 + }, 9123 + { 9124 + .freq = 5795, 9125 + RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x87, 0x05, 0x05, 0x02, 9126 + 0x15, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 9127 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, 9128 + 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9129 + 0x00, 0x05, 0x00, 0x6b, 0x00), 9130 + PHYREGS(0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5), 9131 + }, 9132 + { 9133 + .freq = 5800, 9134 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x02, 9135 + 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 9136 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, 9137 + 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9138 + 0x00, 0x05, 0x00, 0x6b, 0x00), 9139 + PHYREGS(0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5), 9140 + }, 9141 + { 9898 9142 .freq = 5805, 9899 9143 RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x89, 0x05, 0x05, 0x02, 9900 9144 0x15, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, ··· 9931 9121 PHYREGS(0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4), 9932 9122 }, 9933 9123 { 9124 + .freq = 5810, 9125 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x02, 9126 + 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 9127 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, 9128 + 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9129 + 0x00, 0x05, 0x00, 0x6a, 0x00), 9130 + PHYREGS(0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4), 9131 + }, 9132 + { 9133 + .freq = 5815, 9134 + RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8b, 0x05, 0x05, 0x02, 9135 + 0x15, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 9136 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, 9137 + 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9138 + 0x00, 0x05, 0x00, 0x6a, 0x00), 9139 + PHYREGS(0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4), 9140 + }, 9141 + { 9142 + .freq = 5820, 9143 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x02, 9144 + 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 9145 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, 9146 + 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9147 + 0x00, 0x05, 0x00, 0x6a, 0x00), 9148 + PHYREGS(0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3), 9149 + }, 9150 + { 9934 9151 .freq = 5825, 9935 9152 RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8d, 0x05, 0x05, 0x02, 9936 9153 0x15, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, ··· 9965 9128 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9966 9129 0x00, 0x05, 0x00, 0x69, 0x00), 9967 9130 PHYREGS(0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3), 9131 + }, 9132 + { 9133 + .freq = 5830, 9134 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x02, 9135 + 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 9136 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, 9137 + 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9138 + 0x00, 0x05, 0x00, 0x69, 0x00), 9139 + PHYREGS(0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2), 9140 + }, 9141 + { 9142 + .freq = 5840, 9143 + RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x02, 9144 + 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 9145 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, 9146 + 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9147 + 0x00, 0x04, 0x00, 0x69, 0x00), 9148 + PHYREGS(0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2), 9149 + }, 9150 + { 9151 + .freq = 5850, 9152 + RADIOREGS3(0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x02, 9153 + 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 9154 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, 9155 + 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9156 + 0x00, 0x04, 0x00, 0x69, 0x00), 9157 + PHYREGS(0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1), 9158 + }, 9159 + { 9160 + .freq = 5860, 9161 + RADIOREGS3(0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x02, 9162 + 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 9163 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, 9164 + 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9165 + 0x00, 0x04, 0x00, 0x69, 0x00), 9166 + PHYREGS(0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0), 9167 + }, 9168 + { 9169 + .freq = 5870, 9170 + RADIOREGS3(0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x02, 9171 + 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 9172 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, 9173 + 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9174 + 0x00, 0x04, 0x00, 0x68, 0x00), 9175 + PHYREGS(0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf), 9176 + }, 9177 + { 9178 + .freq = 5880, 9179 + RADIOREGS3(0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x02, 9180 + 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 9181 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, 9182 + 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9183 + 0x00, 0x04, 0x00, 0x68, 0x00), 9184 + PHYREGS(0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf), 9185 + }, 9186 + { 9187 + .freq = 5890, 9188 + RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x02, 9189 + 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 9190 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, 9191 + 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9192 + 0x00, 0x04, 0x00, 0x68, 0x00), 9193 + PHYREGS(0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be), 9194 + }, 9195 + { 9196 + .freq = 5900, 9197 + RADIOREGS3(0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x02, 9198 + 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 9199 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, 9200 + 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9201 + 0x00, 0x04, 0x00, 0x68, 0x00), 9202 + PHYREGS(0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd), 9203 + }, 9204 + { 9205 + .freq = 5910, 9206 + RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x02, 9207 + 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 9208 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, 9209 + 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 9210 + 0x00, 0x04, 0x00, 0x68, 0x00), 9211 + PHYREGS(0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc), 9968 9212 }, 9969 9213 { 9970 9214 .freq = 2412,
+1 -1
drivers/net/wireless/b43/xmit.c
··· 408 408 mac_ctl |= B43_TXH_MAC_HWSEQ; 409 409 if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) 410 410 mac_ctl |= B43_TXH_MAC_STMSDU; 411 - if (phy->type == B43_PHYTYPE_A) 411 + if (!phy->gmode) 412 412 mac_ctl |= B43_TXH_MAC_5GHZ; 413 413 414 414 /* Overwrite rates[0].count to make the retry calculation
+1 -1
drivers/net/wireless/brcm80211/brcmfmac/dhd.h
··· 186 186 void brcmf_txflowblock_if(struct brcmf_if *ifp, 187 187 enum brcmf_netif_stop_reason reason, bool state); 188 188 u32 brcmf_get_chip_info(struct brcmf_if *ifp); 189 - void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, 189 + void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx, 190 190 bool success); 191 191 192 192 /* Sets dongle media info (drv_version, mac address). */
+1
drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
··· 99 99 unsigned long tx_realloc; 100 100 u32 chip; 101 101 u32 chiprev; 102 + bool always_use_fws_queue; 102 103 103 104 struct brcmf_bus_ops *ops; 104 105 };
+18
drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
··· 32 32 #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 33 33 #define BRCMF_DEFAULT_PACKET_FILTER "100 0 0 0 0x01 0x00" 34 34 35 + /* boost value for RSSI_DELTA in preferred join selection */ 36 + #define BRCMF_JOIN_PREF_RSSI_BOOST 8 37 + 35 38 36 39 bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, 37 40 struct sk_buff *pkt, int prec) ··· 249 246 { 250 247 s8 eventmask[BRCMF_EVENTING_MASK_LEN]; 251 248 u8 buf[BRCMF_DCMD_SMLEN]; 249 + struct brcmf_join_pref_params join_pref_params[2]; 252 250 char *ptr; 253 251 s32 err; 254 252 ··· 301 297 brcmf_err("roam_off error (%d)\n", err); 302 298 goto done; 303 299 } 300 + 301 + /* Setup join_pref to select target by RSSI(with boost on 5GHz) */ 302 + join_pref_params[0].type = BRCMF_JOIN_PREF_RSSI_DELTA; 303 + join_pref_params[0].len = 2; 304 + join_pref_params[0].rssi_gain = BRCMF_JOIN_PREF_RSSI_BOOST; 305 + join_pref_params[0].band = WLC_BAND_5G; 306 + join_pref_params[1].type = BRCMF_JOIN_PREF_RSSI; 307 + join_pref_params[1].len = 2; 308 + join_pref_params[1].rssi_gain = 0; 309 + join_pref_params[1].band = 0; 310 + err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params, 311 + sizeof(join_pref_params)); 312 + if (err) 313 + brcmf_err("Set join_pref error (%d)\n", err); 304 314 305 315 /* Setup event_msgs, enable E_IF */ 306 316 err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask,
+17 -15
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
··· 190 190 int ret; 191 191 struct brcmf_if *ifp = netdev_priv(ndev); 192 192 struct brcmf_pub *drvr = ifp->drvr; 193 - struct ethhdr *eh; 193 + struct ethhdr *eh = (struct ethhdr *)(skb->data); 194 194 195 195 brcmf_dbg(DATA, "Enter, idx=%d\n", ifp->bssidx); 196 196 ··· 235 235 dev_kfree_skb(skb); 236 236 goto done; 237 237 } 238 + 239 + if (eh->h_proto == htons(ETH_P_PAE)) 240 + atomic_inc(&ifp->pend_8021x_cnt); 238 241 239 242 ret = brcmf_fws_process_skb(ifp, skb); 240 243 ··· 541 538 brcmf_netif_rx(ifp, skb); 542 539 } 543 540 544 - void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, 541 + void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx, 545 542 bool success) 546 543 { 547 544 struct brcmf_if *ifp; 548 545 struct ethhdr *eh; 549 - u8 ifidx; 550 546 u16 type; 551 - int res; 552 - 553 - res = brcmf_proto_hdrpull(drvr, false, &ifidx, txp); 554 547 555 548 ifp = drvr->iflist[ifidx]; 556 549 if (!ifp) 557 550 goto done; 558 551 559 - if (res == 0) { 560 - eh = (struct ethhdr *)(txp->data); 561 - type = ntohs(eh->h_proto); 552 + eh = (struct ethhdr *)(txp->data); 553 + type = ntohs(eh->h_proto); 562 554 563 - if (type == ETH_P_PAE) { 564 - atomic_dec(&ifp->pend_8021x_cnt); 565 - if (waitqueue_active(&ifp->pend_8021x_wait)) 566 - wake_up(&ifp->pend_8021x_wait); 567 - } 555 + if (type == ETH_P_PAE) { 556 + atomic_dec(&ifp->pend_8021x_cnt); 557 + if (waitqueue_active(&ifp->pend_8021x_wait)) 558 + wake_up(&ifp->pend_8021x_wait); 568 559 } 560 + 569 561 if (!success) 570 562 ifp->stats.tx_errors++; 571 563 done: ··· 571 573 { 572 574 struct brcmf_bus *bus_if = dev_get_drvdata(dev); 573 575 struct brcmf_pub *drvr = bus_if->drvr; 576 + u8 ifidx; 574 577 575 578 /* await txstatus signal for firmware if active */ 576 579 if (brcmf_fws_fc_active(drvr->fws)) { 577 580 if (!success) 578 581 brcmf_fws_bustxfail(drvr->fws, txp); 579 582 } else { 580 - brcmf_txfinalize(drvr, txp, success); 583 + if (brcmf_proto_hdrpull(drvr, false, &ifidx, txp)) 584 + brcmu_pkt_buf_free_skb(txp); 585 + else 586 + brcmf_txfinalize(drvr, txp, ifidx, success); 581 587 } 582 588 } 583 589
+24
drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
··· 53 53 #define BRCMF_OBSS_COEX_OFF 0 54 54 #define BRCMF_OBSS_COEX_ON 1 55 55 56 + /* join preference types for join_pref iovar */ 57 + enum brcmf_join_pref_types { 58 + BRCMF_JOIN_PREF_RSSI = 1, 59 + BRCMF_JOIN_PREF_WPA, 60 + BRCMF_JOIN_PREF_BAND, 61 + BRCMF_JOIN_PREF_RSSI_DELTA, 62 + }; 63 + 56 64 enum brcmf_fil_p2p_if_types { 57 65 BRCMF_FIL_P2P_IF_CLIENT, 58 66 BRCMF_FIL_P2P_IF_GO, ··· 288 280 __le32 chanspec_num; 289 281 /* list of chanspecs */ 290 282 __le16 chanspec_list[1]; 283 + }; 284 + 285 + /** 286 + * struct join_pref params - parameters for preferred join selection. 287 + * 288 + * @type: preference type (see enum brcmf_join_pref_types). 289 + * @len: length of bytes following (currently always 2). 290 + * @rssi_gain: signal gain for selection (only when @type is RSSI_DELTA). 291 + * @band: band to which selection preference applies. 292 + * This is used if @type is BAND or RSSI_DELTA. 293 + */ 294 + struct brcmf_join_pref_params { 295 + u8 type; 296 + u8 len; 297 + u8 rssi_gain; 298 + u8 band; 291 299 }; 292 300 293 301 /* used for join with or without a specific bssid and channel list */
+43 -37
drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
··· 476 476 bool bus_flow_blocked; 477 477 bool creditmap_received; 478 478 u8 mode; 479 + bool avoid_queueing; 479 480 }; 480 481 481 482 /* ··· 1370 1369 } 1371 1370 1372 1371 static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo, 1373 - struct sk_buff *skb, u32 genbit, 1374 - u16 seq) 1372 + struct sk_buff *skb, u8 ifidx, 1373 + u32 genbit, u16 seq) 1375 1374 { 1376 1375 struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac; 1377 1376 u32 hslot; 1378 1377 int ret; 1379 - u8 ifidx; 1380 1378 1381 1379 hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); 1382 1380 ··· 1389 1389 1390 1390 entry->generation = genbit; 1391 1391 1392 - ret = brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb); 1393 - if (ret == 0) { 1394 - brcmf_skb_htod_tag_set_field(skb, GENERATION, genbit); 1395 - brcmf_skbcb(skb)->htod_seq = seq; 1396 - if (brcmf_skb_htod_seq_get_field(skb, FROMFW)) { 1397 - brcmf_skb_htod_seq_set_field(skb, FROMDRV, 1); 1398 - brcmf_skb_htod_seq_set_field(skb, FROMFW, 0); 1399 - } else { 1400 - brcmf_skb_htod_seq_set_field(skb, FROMDRV, 0); 1401 - } 1402 - ret = brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_SUPPRESSED, fifo, 1403 - skb); 1392 + brcmf_skb_htod_tag_set_field(skb, GENERATION, genbit); 1393 + brcmf_skbcb(skb)->htod_seq = seq; 1394 + if (brcmf_skb_htod_seq_get_field(skb, FROMFW)) { 1395 + brcmf_skb_htod_seq_set_field(skb, FROMDRV, 1); 1396 + brcmf_skb_htod_seq_set_field(skb, FROMFW, 0); 1397 + } else { 1398 + brcmf_skb_htod_seq_set_field(skb, FROMDRV, 0); 1404 1399 } 1400 + ret = brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_SUPPRESSED, fifo, skb); 1405 1401 1406 1402 if (ret != 0) { 1407 - /* suppress q is full or hdrpull failed, drop this packet */ 1408 - brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, 1409 - true); 1403 + /* suppress q is full drop this packet */ 1404 + brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, true); 1410 1405 } else { 1411 - /* 1412 - * Mark suppressed to avoid a double free during 1413 - * wlfc cleanup 1414 - */ 1406 + /* Mark suppressed to avoid a double free during wlfc cleanup */ 1415 1407 brcmf_fws_hanger_mark_suppressed(&fws->hanger, hslot); 1416 1408 } 1417 1409 ··· 1420 1428 struct sk_buff *skb; 1421 1429 struct brcmf_skbuff_cb *skcb; 1422 1430 struct brcmf_fws_mac_descriptor *entry = NULL; 1431 + u8 ifidx; 1423 1432 1424 1433 brcmf_dbg(DATA, "flags %d\n", flags); 1425 1434 ··· 1469 1476 } 1470 1477 brcmf_fws_macdesc_return_req_credit(skb); 1471 1478 1479 + if (brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb)) { 1480 + brcmu_pkt_buf_free_skb(skb); 1481 + return -EINVAL; 1482 + } 1472 1483 if (!remove_from_hanger) 1473 - ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, genbit, 1474 - seq); 1475 - 1484 + ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifidx, 1485 + genbit, seq); 1476 1486 if (remove_from_hanger || ret) 1477 - brcmf_txfinalize(fws->drvr, skb, true); 1487 + brcmf_txfinalize(fws->drvr, skb, ifidx, true); 1478 1488 1479 1489 return 0; 1480 1490 } ··· 1864 1868 struct ethhdr *eh = (struct ethhdr *)(skb->data); 1865 1869 int fifo = BRCMF_FWS_FIFO_BCMC; 1866 1870 bool multicast = is_multicast_ether_addr(eh->h_dest); 1867 - bool pae = eh->h_proto == htons(ETH_P_PAE); 1871 + int rc = 0; 1868 1872 1869 1873 brcmf_dbg(DATA, "tx proto=0x%X\n", ntohs(eh->h_proto)); 1870 1874 /* determine the priority */ ··· 1872 1876 skb->priority = cfg80211_classify8021d(skb, NULL); 1873 1877 1874 1878 drvr->tx_multicast += !!multicast; 1875 - if (pae) 1876 - atomic_inc(&ifp->pend_8021x_cnt); 1879 + 1880 + if (fws->avoid_queueing) { 1881 + rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb); 1882 + if (rc < 0) 1883 + brcmf_txfinalize(drvr, skb, ifp->ifidx, false); 1884 + return rc; 1885 + } 1877 1886 1878 1887 /* set control buffer information */ 1879 1888 skcb->if_flags = 0; ··· 1900 1899 brcmf_fws_schedule_deq(fws); 1901 1900 } else { 1902 1901 brcmf_err("drop skb: no hanger slot\n"); 1903 - if (pae) { 1904 - atomic_dec(&ifp->pend_8021x_cnt); 1905 - if (waitqueue_active(&ifp->pend_8021x_wait)) 1906 - wake_up(&ifp->pend_8021x_wait); 1907 - } 1908 - brcmu_pkt_buf_free_skb(skb); 1902 + brcmf_txfinalize(drvr, skb, ifp->ifidx, false); 1903 + rc = -ENOMEM; 1909 1904 } 1910 1905 brcmf_fws_unlock(fws); 1911 - return 0; 1906 + 1907 + return rc; 1912 1908 } 1913 1909 1914 1910 void brcmf_fws_reset_interface(struct brcmf_if *ifp) ··· 1980 1982 ret = brcmf_proto_txdata(drvr, ifidx, 0, skb); 1981 1983 brcmf_fws_lock(fws); 1982 1984 if (ret < 0) 1983 - brcmf_txfinalize(drvr, skb, false); 1985 + brcmf_txfinalize(drvr, skb, ifidx, 1986 + false); 1984 1987 if (fws->bus_flow_blocked) 1985 1988 break; 1986 1989 } ··· 2037 2038 /* set linkage back */ 2038 2039 fws->drvr = drvr; 2039 2040 fws->fcmode = fcmode; 2041 + 2042 + if ((drvr->bus_if->always_use_fws_queue == false) && 2043 + (fcmode == BRCMF_FWS_FCMODE_NONE)) { 2044 + fws->avoid_queueing = true; 2045 + brcmf_dbg(INFO, "FWS queueing will be avoided\n"); 2046 + return 0; 2047 + } 2040 2048 2041 2049 fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq"); 2042 2050 if (fws->fws_wq == NULL) {
+176 -44
drivers/net/wireless/brcm80211/brcmfmac/nvram.c
··· 18 18 #include <linux/slab.h> 19 19 #include <linux/firmware.h> 20 20 21 + #include "dhd_dbg.h" 21 22 #include "nvram.h" 22 23 23 - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a file 24 + enum nvram_parser_state { 25 + IDLE, 26 + KEY, 27 + VALUE, 28 + COMMENT, 29 + END 30 + }; 31 + 32 + /** 33 + * struct nvram_parser - internal info for parser. 34 + * 35 + * @state: current parser state. 36 + * @fwnv: input buffer being parsed. 37 + * @nvram: output buffer with parse result. 38 + * @nvram_len: lenght of parse result. 39 + * @line: current line. 40 + * @column: current column in line. 41 + * @pos: byte offset in input buffer. 42 + * @entry: start position of key,value entry. 43 + */ 44 + struct nvram_parser { 45 + enum nvram_parser_state state; 46 + const struct firmware *fwnv; 47 + u8 *nvram; 48 + u32 nvram_len; 49 + u32 line; 50 + u32 column; 51 + u32 pos; 52 + u32 entry; 53 + }; 54 + 55 + static bool is_nvram_char(char c) 56 + { 57 + /* comment marker excluded */ 58 + if (c == '#') 59 + return false; 60 + 61 + /* key and value may have any other readable character */ 62 + return (c > 0x20 && c < 0x7f); 63 + } 64 + 65 + static bool is_whitespace(char c) 66 + { 67 + return (c == ' ' || c == '\r' || c == '\n' || c == '\t'); 68 + } 69 + 70 + static enum nvram_parser_state brcmf_nvram_handle_idle(struct nvram_parser *nvp) 71 + { 72 + char c; 73 + 74 + c = nvp->fwnv->data[nvp->pos]; 75 + if (c == '\n') 76 + return COMMENT; 77 + if (is_whitespace(c)) 78 + goto proceed; 79 + if (c == '#') 80 + return COMMENT; 81 + if (is_nvram_char(c)) { 82 + nvp->entry = nvp->pos; 83 + return KEY; 84 + } 85 + brcmf_dbg(INFO, "warning: ln=%d:col=%d: ignoring invalid character\n", 86 + nvp->line, nvp->column); 87 + proceed: 88 + nvp->column++; 89 + nvp->pos++; 90 + return IDLE; 91 + } 92 + 93 + static enum nvram_parser_state brcmf_nvram_handle_key(struct nvram_parser *nvp) 94 + { 95 + enum nvram_parser_state st = nvp->state; 96 + char c; 97 + 98 + c = nvp->fwnv->data[nvp->pos]; 99 + if (c == '=') { 100 + st = VALUE; 101 + } else if (!is_nvram_char(c)) { 102 + brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n", 103 + nvp->line, nvp->column); 104 + return COMMENT; 105 + } 106 + 107 + nvp->column++; 108 + nvp->pos++; 109 + return st; 110 + } 111 + 112 + static enum nvram_parser_state 113 + brcmf_nvram_handle_value(struct nvram_parser *nvp) 114 + { 115 + char c; 116 + char *skv; 117 + char *ekv; 118 + u32 cplen; 119 + 120 + c = nvp->fwnv->data[nvp->pos]; 121 + if (!is_nvram_char(c)) { 122 + /* key,value pair complete */ 123 + ekv = (u8 *)&nvp->fwnv->data[nvp->pos]; 124 + skv = (u8 *)&nvp->fwnv->data[nvp->entry]; 125 + cplen = ekv - skv; 126 + /* copy to output buffer */ 127 + memcpy(&nvp->nvram[nvp->nvram_len], skv, cplen); 128 + nvp->nvram_len += cplen; 129 + nvp->nvram[nvp->nvram_len] = '\0'; 130 + nvp->nvram_len++; 131 + return IDLE; 132 + } 133 + nvp->pos++; 134 + nvp->column++; 135 + return VALUE; 136 + } 137 + 138 + static enum nvram_parser_state 139 + brcmf_nvram_handle_comment(struct nvram_parser *nvp) 140 + { 141 + char *eol, *sol; 142 + 143 + sol = (char *)&nvp->fwnv->data[nvp->pos]; 144 + eol = strchr(sol, '\n'); 145 + if (eol == NULL) 146 + return END; 147 + 148 + /* eat all moving to next line */ 149 + nvp->line++; 150 + nvp->column = 1; 151 + nvp->pos += (eol - sol) + 1; 152 + return IDLE; 153 + } 154 + 155 + static enum nvram_parser_state brcmf_nvram_handle_end(struct nvram_parser *nvp) 156 + { 157 + /* final state */ 158 + return END; 159 + } 160 + 161 + static enum nvram_parser_state 162 + (*nv_parser_states[])(struct nvram_parser *nvp) = { 163 + brcmf_nvram_handle_idle, 164 + brcmf_nvram_handle_key, 165 + brcmf_nvram_handle_value, 166 + brcmf_nvram_handle_comment, 167 + brcmf_nvram_handle_end 168 + }; 169 + 170 + static int brcmf_init_nvram_parser(struct nvram_parser *nvp, 171 + const struct firmware *nv) 172 + { 173 + memset(nvp, 0, sizeof(*nvp)); 174 + nvp->fwnv = nv; 175 + /* Alloc for extra 0 byte + roundup by 4 + length field */ 176 + nvp->nvram = kzalloc(nv->size + 1 + 3 + sizeof(u32), GFP_KERNEL); 177 + if (!nvp->nvram) 178 + return -ENOMEM; 179 + 180 + nvp->line = 1; 181 + nvp->column = 1; 182 + return 0; 183 + } 184 + 185 + /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil 24 186 * and ending in a NUL. Removes carriage returns, empty lines, comment lines, 25 187 * and converts newlines to NULs. Shortens buffer as needed and pads with NULs. 26 188 * End of buffer is completed with token identifying length of buffer. 27 189 */ 28 190 void *brcmf_nvram_strip(const struct firmware *nv, u32 *new_length) 29 191 { 30 - u8 *nvram; 31 - u32 i; 32 - u32 len; 33 - u32 column; 34 - u8 val; 35 - bool comment; 192 + struct nvram_parser nvp; 193 + u32 pad; 36 194 u32 token; 37 195 __le32 token_le; 38 196 39 - /* Alloc for extra 0 byte + roundup by 4 + length field */ 40 - nvram = kmalloc(nv->size + 1 + 3 + sizeof(token_le), GFP_KERNEL); 41 - if (!nvram) 197 + if (brcmf_init_nvram_parser(&nvp, nv) < 0) 42 198 return NULL; 43 199 44 - len = 0; 45 - column = 0; 46 - comment = false; 47 - for (i = 0; i < nv->size; i++) { 48 - val = nv->data[i]; 49 - if (val == 0) 200 + while (nvp.pos < nv->size) { 201 + nvp.state = nv_parser_states[nvp.state](&nvp); 202 + if (nvp.state == END) 50 203 break; 51 - if (val == '\r') 52 - continue; 53 - if (comment && (val != '\n')) 54 - continue; 55 - comment = false; 56 - if (val == '#') { 57 - comment = true; 58 - continue; 59 - } 60 - if (val == '\n') { 61 - if (column == 0) 62 - continue; 63 - nvram[len] = 0; 64 - len++; 65 - column = 0; 66 - continue; 67 - } 68 - nvram[len] = val; 69 - len++; 70 - column++; 71 204 } 72 - column = len; 73 - *new_length = roundup(len + 1, 4); 74 - while (column != *new_length) { 75 - nvram[column] = 0; 76 - column++; 205 + pad = nvp.nvram_len; 206 + *new_length = roundup(nvp.nvram_len + 1, 4); 207 + while (pad != *new_length) { 208 + nvp.nvram[pad] = 0; 209 + pad++; 77 210 } 78 211 79 212 token = *new_length / 4; 80 213 token = (~token << 16) | (token & 0x0000FFFF); 81 214 token_le = cpu_to_le32(token); 82 215 83 - memcpy(&nvram[*new_length], &token_le, sizeof(token_le)); 216 + memcpy(&nvp.nvram[*new_length], &token_le, sizeof(token_le)); 84 217 *new_length += sizeof(token_le); 85 218 86 - return nvram; 219 + return nvp.nvram; 87 220 } 88 221 89 222 void brcmf_nvram_free(void *nvram) 90 223 { 91 224 kfree(nvram); 92 225 } 93 - 94 226
+1
drivers/net/wireless/brcm80211/brcmfmac/usb.c
··· 1254 1254 bus->chip = bus_pub->devid; 1255 1255 bus->chiprev = bus_pub->chiprev; 1256 1256 bus->proto_type = BRCMF_PROTO_BCDC; 1257 + bus->always_use_fws_queue = true; 1257 1258 1258 1259 /* Attach to the common driver interface */ 1259 1260 ret = brcmf_attach(dev);
+146 -60
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
··· 221 221 */ 222 222 REG_RULE(2484-10, 2484+10, 20, 6, 20, 0), 223 223 /* IEEE 802.11a, channel 36..64 */ 224 - REG_RULE(5150-10, 5350+10, 40, 6, 20, 0), 224 + REG_RULE(5150-10, 5350+10, 80, 6, 20, 0), 225 225 /* IEEE 802.11a, channel 100..165 */ 226 - REG_RULE(5470-10, 5850+10, 40, 6, 20, 0), } 226 + REG_RULE(5470-10, 5850+10, 80, 6, 20, 0), } 227 227 }; 228 228 229 229 static const u32 __wl_cipher_suites[] = { ··· 339 339 qdbm += (u8) offset; 340 340 341 341 return qdbm; 342 + } 343 + 344 + u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, 345 + struct cfg80211_chan_def *ch) 346 + { 347 + struct brcmu_chan ch_inf; 348 + s32 primary_offset; 349 + 350 + brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n", 351 + ch->chan->center_freq, ch->center_freq1, ch->width); 352 + ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1); 353 + primary_offset = ch->center_freq1 - ch->chan->center_freq; 354 + switch (ch->width) { 355 + case NL80211_CHAN_WIDTH_20: 356 + ch_inf.bw = BRCMU_CHAN_BW_20; 357 + WARN_ON(primary_offset != 0); 358 + break; 359 + case NL80211_CHAN_WIDTH_40: 360 + ch_inf.bw = BRCMU_CHAN_BW_40; 361 + if (primary_offset < 0) 362 + ch_inf.sb = BRCMU_CHAN_SB_U; 363 + else 364 + ch_inf.sb = BRCMU_CHAN_SB_L; 365 + break; 366 + case NL80211_CHAN_WIDTH_80: 367 + ch_inf.bw = BRCMU_CHAN_BW_80; 368 + if (primary_offset < 0) { 369 + if (primary_offset < -CH_10MHZ_APART) 370 + ch_inf.sb = BRCMU_CHAN_SB_UU; 371 + else 372 + ch_inf.sb = BRCMU_CHAN_SB_UL; 373 + } else { 374 + if (primary_offset > CH_10MHZ_APART) 375 + ch_inf.sb = BRCMU_CHAN_SB_LL; 376 + else 377 + ch_inf.sb = BRCMU_CHAN_SB_LU; 378 + } 379 + break; 380 + default: 381 + WARN_ON_ONCE(1); 382 + } 383 + switch (ch->chan->band) { 384 + case IEEE80211_BAND_2GHZ: 385 + ch_inf.band = BRCMU_CHAN_BAND_2G; 386 + break; 387 + case IEEE80211_BAND_5GHZ: 388 + ch_inf.band = BRCMU_CHAN_BAND_5G; 389 + break; 390 + default: 391 + WARN_ON_ONCE(1); 392 + } 393 + d11inf->encchspec(&ch_inf); 394 + 395 + return ch_inf.chspec; 342 396 } 343 397 344 398 u16 channel_to_chanspec(struct brcmu_d11inf *d11inf, ··· 1290 1236 params->chandef.chan->center_freq); 1291 1237 if (params->channel_fixed) { 1292 1238 /* adding chanspec */ 1293 - chanspec = channel_to_chanspec(&cfg->d11inf, 1294 - params->chandef.chan); 1239 + chanspec = chandef_to_chanspec(&cfg->d11inf, 1240 + &params->chandef); 1295 1241 join_params.params_le.chanspec_list[0] = 1296 1242 cpu_to_le16(chanspec); 1297 1243 join_params.params_le.chanspec_num = cpu_to_le32(1); ··· 2236 2182 2237 2183 static s32 2238 2184 brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, 2239 - u8 *mac, struct station_info *sinfo) 2185 + const u8 *mac, struct station_info *sinfo) 2240 2186 { 2241 2187 struct brcmf_if *ifp = netdev_priv(ndev); 2242 2188 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; ··· 3788 3734 } 3789 3735 3790 3736 static s32 3791 - brcmf_cfg80211_set_channel(struct brcmf_cfg80211_info *cfg, 3792 - struct brcmf_if *ifp, 3793 - struct ieee80211_channel *channel) 3794 - { 3795 - u16 chanspec; 3796 - s32 err; 3797 - 3798 - brcmf_dbg(TRACE, "band=%d, center_freq=%d\n", channel->band, 3799 - channel->center_freq); 3800 - 3801 - chanspec = channel_to_chanspec(&cfg->d11inf, channel); 3802 - err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); 3803 - 3804 - return err; 3805 - } 3806 - 3807 - static s32 3808 3737 brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, 3809 3738 struct cfg80211_ap_settings *settings) 3810 3739 { ··· 3802 3765 struct brcmf_join_params join_params; 3803 3766 enum nl80211_iftype dev_role; 3804 3767 struct brcmf_fil_bss_enable_le bss_enable; 3768 + u16 chanspec; 3805 3769 3806 - brcmf_dbg(TRACE, "channel_type=%d, beacon_interval=%d, dtim_period=%d,\n", 3807 - cfg80211_get_chandef_type(&settings->chandef), 3808 - settings->beacon_interval, 3809 - settings->dtim_period); 3770 + brcmf_dbg(TRACE, "ctrlchn=%d, center=%d, bw=%d, beacon_interval=%d, dtim_period=%d,\n", 3771 + settings->chandef.chan->hw_value, 3772 + settings->chandef.center_freq1, settings->chandef.width, 3773 + settings->beacon_interval, settings->dtim_period); 3810 3774 brcmf_dbg(TRACE, "ssid=%s(%zu), auth_type=%d, inactivity_timeout=%d\n", 3811 3775 settings->ssid, settings->ssid_len, settings->auth_type, 3812 3776 settings->inactivity_timeout); ··· 3864 3826 3865 3827 brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); 3866 3828 3867 - err = brcmf_cfg80211_set_channel(cfg, ifp, settings->chandef.chan); 3829 + chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef); 3830 + err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); 3868 3831 if (err < 0) { 3869 - brcmf_err("Set Channel failed, %d\n", err); 3832 + brcmf_err("Set Channel failed: chspec=%d, %d\n", chanspec, err); 3870 3833 goto exit; 3871 3834 } 3872 3835 ··· 4014 3975 4015 3976 static int 4016 3977 brcmf_cfg80211_del_station(struct wiphy *wiphy, struct net_device *ndev, 4017 - u8 *mac) 3978 + const u8 *mac) 4018 3979 { 4019 3980 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 4020 3981 struct brcmf_scb_val_le scbval; ··· 4242 4203 } 4243 4204 4244 4205 static int brcmf_cfg80211_tdls_oper(struct wiphy *wiphy, 4245 - struct net_device *ndev, u8 *peer, 4206 + struct net_device *ndev, const u8 *peer, 4246 4207 enum nl80211_tdls_operation oper) 4247 4208 { 4248 4209 struct brcmf_if *ifp; ··· 4403 4364 WIPHY_FLAG_OFFCHAN_TX | 4404 4365 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | 4405 4366 WIPHY_FLAG_SUPPORTS_TDLS; 4367 + if (!brcmf_roamoff) 4368 + wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; 4406 4369 wiphy->mgmt_stypes = brcmf_txrx_stypes; 4407 4370 wiphy->max_remain_on_channel_duration = 5000; 4408 4371 brcmf_wiphy_pno_params(wiphy); ··· 4726 4685 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; 4727 4686 struct ieee80211_channel *chan; 4728 4687 s32 err = 0; 4729 - u16 reason; 4730 4688 4731 4689 if (brcmf_is_apmode(ifp->vif)) { 4732 4690 err = brcmf_notify_connect_status_ap(cfg, ndev, e, data); ··· 4746 4706 brcmf_dbg(CONN, "Linkdown\n"); 4747 4707 if (!brcmf_is_ibssmode(ifp->vif)) { 4748 4708 brcmf_bss_connect_done(cfg, ndev, e, false); 4749 - if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, 4750 - &ifp->vif->sme_state)) { 4751 - reason = 0; 4752 - if (((e->event_code == BRCMF_E_DEAUTH_IND) || 4753 - (e->event_code == BRCMF_E_DISASSOC_IND)) && 4754 - (e->reason != WLAN_REASON_UNSPECIFIED)) 4755 - reason = e->reason; 4756 - cfg80211_disconnected(ndev, reason, NULL, 0, 4757 - GFP_KERNEL); 4758 - } 4759 4709 } 4760 4710 brcmf_link_down(ifp->vif); 4761 4711 brcmf_init_prof(ndev_to_prof(ndev)); ··· 5245 5215 if (!(bw_cap[band] & WLC_BW_40MHZ_BIT) && 5246 5216 ch.bw == BRCMU_CHAN_BW_40) 5247 5217 continue; 5218 + if (!(bw_cap[band] & WLC_BW_80MHZ_BIT) && 5219 + ch.bw == BRCMU_CHAN_BW_80) 5220 + continue; 5248 5221 update = false; 5249 5222 for (j = 0; (j < *n_cnt && (*n_cnt < array_size)); j++) { 5250 5223 if (band_chan_arr[j].hw_value == ch.chnum) { ··· 5264 5231 ieee80211_channel_to_frequency(ch.chnum, band); 5265 5232 band_chan_arr[index].hw_value = ch.chnum; 5266 5233 5267 - if (ch.bw == BRCMU_CHAN_BW_40) { 5268 - /* assuming the order is HT20, HT40 Upper, 5269 - * HT40 lower from chanspecs 5270 - */ 5234 + /* assuming the chanspecs order is HT20, 5235 + * HT40 upper, HT40 lower, and VHT80. 5236 + */ 5237 + if (ch.bw == BRCMU_CHAN_BW_80) { 5238 + band_chan_arr[index].flags &= 5239 + ~IEEE80211_CHAN_NO_80MHZ; 5240 + } else if (ch.bw == BRCMU_CHAN_BW_40) { 5271 5241 ht40_flag = band_chan_arr[index].flags & 5272 5242 IEEE80211_CHAN_NO_HT40; 5273 5243 if (ch.sb == BRCMU_CHAN_SB_U) { ··· 5291 5255 IEEE80211_CHAN_NO_HT40MINUS; 5292 5256 } 5293 5257 } else { 5258 + /* disable other bandwidths for now as mentioned 5259 + * order assure they are enabled for subsequent 5260 + * chanspecs. 5261 + */ 5294 5262 band_chan_arr[index].flags = 5295 - IEEE80211_CHAN_NO_HT40; 5263 + IEEE80211_CHAN_NO_HT40 | 5264 + IEEE80211_CHAN_NO_80MHZ; 5296 5265 ch.bw = BRCMU_CHAN_BW_20; 5297 5266 cfg->d11inf.encchspec(&ch); 5298 5267 channel = ch.chspec; ··· 5364 5323 } 5365 5324 } 5366 5325 5326 + static void brcmf_update_ht_cap(struct ieee80211_supported_band *band, 5327 + u32 bw_cap[2], u32 nchain) 5328 + { 5329 + band->ht_cap.ht_supported = true; 5330 + if (bw_cap[band->band] & WLC_BW_40MHZ_BIT) { 5331 + band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40; 5332 + band->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; 5333 + } 5334 + band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20; 5335 + band->ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40; 5336 + band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; 5337 + band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16; 5338 + memset(band->ht_cap.mcs.rx_mask, 0xff, nchain); 5339 + band->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; 5340 + } 5341 + 5342 + static __le16 brcmf_get_mcs_map(u32 nchain, enum ieee80211_vht_mcs_support supp) 5343 + { 5344 + u16 mcs_map; 5345 + int i; 5346 + 5347 + for (i = 0, mcs_map = 0xFFFF; i < nchain; i++) 5348 + mcs_map = (mcs_map << 2) | supp; 5349 + 5350 + return cpu_to_le16(mcs_map); 5351 + } 5352 + 5353 + static void brcmf_update_vht_cap(struct ieee80211_supported_band *band, 5354 + u32 bw_cap[2], u32 nchain) 5355 + { 5356 + __le16 mcs_map; 5357 + 5358 + /* not allowed in 2.4G band */ 5359 + if (band->band == IEEE80211_BAND_2GHZ) 5360 + return; 5361 + 5362 + band->vht_cap.vht_supported = true; 5363 + /* 80MHz is mandatory */ 5364 + band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_80; 5365 + if (bw_cap[band->band] & WLC_BW_160MHZ_BIT) { 5366 + band->vht_cap.cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; 5367 + band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_160; 5368 + } 5369 + /* all support 256-QAM */ 5370 + mcs_map = brcmf_get_mcs_map(nchain, IEEE80211_VHT_MCS_SUPPORT_0_9); 5371 + band->vht_cap.vht_mcs.rx_mcs_map = mcs_map; 5372 + band->vht_cap.vht_mcs.tx_mcs_map = mcs_map; 5373 + } 5374 + 5367 5375 static s32 brcmf_update_wiphybands(struct brcmf_cfg80211_info *cfg) 5368 5376 { 5369 5377 struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); 5370 5378 struct wiphy *wiphy; 5371 5379 s32 phy_list; 5372 5380 u32 band_list[3]; 5373 - u32 nmode; 5381 + u32 nmode = 0; 5382 + u32 vhtmode = 0; 5374 5383 u32 bw_cap[2] = { 0, 0 }; 5375 5384 u32 rxchain; 5376 5385 u32 nchain; ··· 5451 5360 brcmf_dbg(INFO, "BRCMF_C_GET_BANDLIST reported: 0x%08x 0x%08x 0x%08x phy\n", 5452 5361 band_list[0], band_list[1], band_list[2]); 5453 5362 5363 + (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode); 5454 5364 err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode); 5455 5365 if (err) { 5456 5366 brcmf_err("nmode error (%d)\n", err); 5457 5367 } else { 5458 5368 brcmf_get_bwcap(ifp, bw_cap); 5459 5369 } 5460 - brcmf_dbg(INFO, "nmode=%d, bw_cap=(%d, %d)\n", nmode, 5461 - bw_cap[IEEE80211_BAND_2GHZ], bw_cap[IEEE80211_BAND_5GHZ]); 5370 + brcmf_dbg(INFO, "nmode=%d, vhtmode=%d, bw_cap=(%d, %d)\n", 5371 + nmode, vhtmode, bw_cap[IEEE80211_BAND_2GHZ], 5372 + bw_cap[IEEE80211_BAND_5GHZ]); 5462 5373 5463 5374 err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain); 5464 5375 if (err) { ··· 5491 5398 else 5492 5399 continue; 5493 5400 5494 - if (bw_cap[band->band] & WLC_BW_40MHZ_BIT) { 5495 - band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40; 5496 - band->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; 5497 - } 5498 - band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20; 5499 - band->ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40; 5500 - band->ht_cap.ht_supported = true; 5501 - band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; 5502 - band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16; 5503 - memset(band->ht_cap.mcs.rx_mask, 0xff, nchain); 5504 - band->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; 5401 + if (nmode) 5402 + brcmf_update_ht_cap(band, bw_cap, nchain); 5403 + if (vhtmode) 5404 + brcmf_update_vht_cap(band, bw_cap, nchain); 5505 5405 bands[band->band] = band; 5506 5406 } 5507 5407
+4 -9
drivers/net/wireless/brcm80211/brcmsmac/main.c
··· 4870 4870 /* 4871 4871 * low level detach 4872 4872 */ 4873 - static int brcms_b_detach(struct brcms_c_info *wlc) 4873 + static void brcms_b_detach(struct brcms_c_info *wlc) 4874 4874 { 4875 4875 uint i; 4876 4876 struct brcms_hw_band *band; 4877 4877 struct brcms_hardware *wlc_hw = wlc->hw; 4878 - int callbacks; 4879 - 4880 - callbacks = 0; 4881 4878 4882 4879 brcms_b_detach_dmapio(wlc_hw); 4883 4880 ··· 4897 4900 ai_detach(wlc_hw->sih); 4898 4901 wlc_hw->sih = NULL; 4899 4902 } 4900 - 4901 - return callbacks; 4902 - 4903 4903 } 4904 4904 4905 4905 /* ··· 4911 4917 */ 4912 4918 uint brcms_c_detach(struct brcms_c_info *wlc) 4913 4919 { 4914 - uint callbacks = 0; 4920 + uint callbacks; 4915 4921 4916 4922 if (wlc == NULL) 4917 4923 return 0; 4918 4924 4919 - callbacks += brcms_b_detach(wlc); 4925 + brcms_b_detach(wlc); 4920 4926 4921 4927 /* delete software timers */ 4928 + callbacks = 0; 4922 4929 if (!brcms_c_radio_monitor_stop(wlc)) 4923 4930 callbacks++; 4924 4931
+82 -23
drivers/net/wireless/brcm80211/brcmutil/d11.c
··· 21 21 #include <brcmu_wifi.h> 22 22 #include <brcmu_d11.h> 23 23 24 + static u16 d11n_sb(enum brcmu_chan_sb sb) 25 + { 26 + switch (sb) { 27 + case BRCMU_CHAN_SB_NONE: 28 + return BRCMU_CHSPEC_D11N_SB_N; 29 + case BRCMU_CHAN_SB_L: 30 + return BRCMU_CHSPEC_D11N_SB_L; 31 + case BRCMU_CHAN_SB_U: 32 + return BRCMU_CHSPEC_D11N_SB_U; 33 + default: 34 + WARN_ON(1); 35 + } 36 + return 0; 37 + } 38 + 39 + static u16 d11n_bw(enum brcmu_chan_bw bw) 40 + { 41 + switch (bw) { 42 + case BRCMU_CHAN_BW_20: 43 + return BRCMU_CHSPEC_D11N_BW_20; 44 + case BRCMU_CHAN_BW_40: 45 + return BRCMU_CHSPEC_D11N_BW_40; 46 + default: 47 + WARN_ON(1); 48 + } 49 + return 0; 50 + } 51 + 24 52 static void brcmu_d11n_encchspec(struct brcmu_chan *ch) 25 53 { 26 - ch->chspec = ch->chnum & BRCMU_CHSPEC_CH_MASK; 54 + if (ch->bw == BRCMU_CHAN_BW_20) 55 + ch->sb = BRCMU_CHAN_SB_NONE; 27 56 28 - switch (ch->bw) { 29 - case BRCMU_CHAN_BW_20: 30 - ch->chspec |= BRCMU_CHSPEC_D11N_BW_20 | BRCMU_CHSPEC_D11N_SB_N; 31 - break; 32 - case BRCMU_CHAN_BW_40: 33 - default: 34 - WARN_ON_ONCE(1); 35 - break; 36 - } 57 + brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_CH_MASK, 58 + BRCMU_CHSPEC_CH_SHIFT, ch->chnum); 59 + brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_D11N_SB_MASK, 60 + 0, d11n_sb(ch->sb)); 61 + brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_D11N_BW_MASK, 62 + 0, d11n_bw(ch->bw)); 37 63 64 + ch->chspec &= ~BRCMU_CHSPEC_D11N_BND_MASK; 38 65 if (ch->chnum <= CH_MAX_2G_CHANNEL) 39 66 ch->chspec |= BRCMU_CHSPEC_D11N_BND_2G; 40 67 else 41 68 ch->chspec |= BRCMU_CHSPEC_D11N_BND_5G; 42 69 } 43 70 71 + static u16 d11ac_bw(enum brcmu_chan_bw bw) 72 + { 73 + switch (bw) { 74 + case BRCMU_CHAN_BW_20: 75 + return BRCMU_CHSPEC_D11AC_BW_20; 76 + case BRCMU_CHAN_BW_40: 77 + return BRCMU_CHSPEC_D11AC_BW_40; 78 + case BRCMU_CHAN_BW_80: 79 + return BRCMU_CHSPEC_D11AC_BW_80; 80 + default: 81 + WARN_ON(1); 82 + } 83 + return 0; 84 + } 85 + 44 86 static void brcmu_d11ac_encchspec(struct brcmu_chan *ch) 45 87 { 46 - ch->chspec = ch->chnum & BRCMU_CHSPEC_CH_MASK; 88 + if (ch->bw == BRCMU_CHAN_BW_20 || ch->sb == BRCMU_CHAN_SB_NONE) 89 + ch->sb = BRCMU_CHAN_SB_L; 47 90 48 - switch (ch->bw) { 49 - case BRCMU_CHAN_BW_20: 50 - ch->chspec |= BRCMU_CHSPEC_D11AC_BW_20; 51 - break; 52 - case BRCMU_CHAN_BW_40: 53 - case BRCMU_CHAN_BW_80: 54 - case BRCMU_CHAN_BW_80P80: 55 - case BRCMU_CHAN_BW_160: 56 - default: 57 - WARN_ON_ONCE(1); 58 - break; 59 - } 91 + brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_CH_MASK, 92 + BRCMU_CHSPEC_CH_SHIFT, ch->chnum); 93 + brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_D11AC_SB_MASK, 94 + BRCMU_CHSPEC_D11AC_SB_SHIFT, ch->sb); 95 + brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_D11AC_BW_MASK, 96 + 0, d11ac_bw(ch->bw)); 60 97 98 + ch->chspec &= ~BRCMU_CHSPEC_D11AC_BND_MASK; 61 99 if (ch->chnum <= CH_MAX_2G_CHANNEL) 62 100 ch->chspec |= BRCMU_CHSPEC_D11AC_BND_2G; 63 101 else ··· 111 73 switch (ch->chspec & BRCMU_CHSPEC_D11N_BW_MASK) { 112 74 case BRCMU_CHSPEC_D11N_BW_20: 113 75 ch->bw = BRCMU_CHAN_BW_20; 76 + ch->sb = BRCMU_CHAN_SB_NONE; 114 77 break; 115 78 case BRCMU_CHSPEC_D11N_BW_40: 116 79 ch->bw = BRCMU_CHAN_BW_40; ··· 151 112 switch (ch->chspec & BRCMU_CHSPEC_D11AC_BW_MASK) { 152 113 case BRCMU_CHSPEC_D11AC_BW_20: 153 114 ch->bw = BRCMU_CHAN_BW_20; 115 + ch->sb = BRCMU_CHAN_SB_NONE; 154 116 break; 155 117 case BRCMU_CHSPEC_D11AC_BW_40: 156 118 ch->bw = BRCMU_CHAN_BW_40; ··· 168 128 break; 169 129 case BRCMU_CHSPEC_D11AC_BW_80: 170 130 ch->bw = BRCMU_CHAN_BW_80; 131 + ch->sb = brcmu_maskget16(ch->chspec, BRCMU_CHSPEC_D11AC_SB_MASK, 132 + BRCMU_CHSPEC_D11AC_SB_SHIFT); 133 + switch (ch->sb) { 134 + case BRCMU_CHAN_SB_LL: 135 + ch->chnum -= CH_30MHZ_APART; 136 + break; 137 + case BRCMU_CHAN_SB_LU: 138 + ch->chnum -= CH_10MHZ_APART; 139 + break; 140 + case BRCMU_CHAN_SB_UL: 141 + ch->chnum += CH_10MHZ_APART; 142 + break; 143 + case BRCMU_CHAN_SB_UU: 144 + ch->chnum += CH_30MHZ_APART; 145 + break; 146 + default: 147 + WARN_ON_ONCE(1); 148 + break; 149 + } 171 150 break; 172 151 case BRCMU_CHSPEC_D11AC_BW_8080: 173 152 case BRCMU_CHSPEC_D11AC_BW_160:
+7 -7
drivers/net/wireless/brcm80211/include/brcmu_d11.h
··· 108 108 }; 109 109 110 110 enum brcmu_chan_sb { 111 - BRCMU_CHAN_SB_NONE = 0, 112 - BRCMU_CHAN_SB_L, 113 - BRCMU_CHAN_SB_U, 114 - BRCMU_CHAN_SB_LL, 115 - BRCMU_CHAN_SB_LU, 116 - BRCMU_CHAN_SB_UL, 117 - BRCMU_CHAN_SB_UU, 111 + BRCMU_CHAN_SB_NONE = -1, 118 112 BRCMU_CHAN_SB_LLL, 119 113 BRCMU_CHAN_SB_LLU, 120 114 BRCMU_CHAN_SB_LUL, ··· 117 123 BRCMU_CHAN_SB_ULU, 118 124 BRCMU_CHAN_SB_UUL, 119 125 BRCMU_CHAN_SB_UUU, 126 + BRCMU_CHAN_SB_L = BRCMU_CHAN_SB_LLL, 127 + BRCMU_CHAN_SB_U = BRCMU_CHAN_SB_LLU, 128 + BRCMU_CHAN_SB_LL = BRCMU_CHAN_SB_LLL, 129 + BRCMU_CHAN_SB_LU = BRCMU_CHAN_SB_LLU, 130 + BRCMU_CHAN_SB_UL = BRCMU_CHAN_SB_LUL, 131 + BRCMU_CHAN_SB_UU = BRCMU_CHAN_SB_LUU, 120 132 }; 121 133 122 134 struct brcmu_chan {
+1
drivers/net/wireless/brcm80211/include/brcmu_wifi.h
··· 29 29 #define CH_UPPER_SB 0x01 30 30 #define CH_LOWER_SB 0x02 31 31 #define CH_EWA_VALID 0x04 32 + #define CH_30MHZ_APART 6 32 33 #define CH_20MHZ_APART 4 33 34 #define CH_10MHZ_APART 2 34 35 #define CH_5MHZ_APART 1 /* 2G band channels are 5 Mhz apart */
+8 -5
drivers/net/wireless/iwlwifi/Kconfig
··· 2 2 tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) " 3 3 depends on PCI && MAC80211 && HAS_IOMEM 4 4 select FW_LOADER 5 - select NEW_LEDS 6 - select LEDS_CLASS 7 - select LEDS_TRIGGERS 8 - select MAC80211_LEDS 9 5 ---help--- 10 6 Select to build the driver supporting the: 11 7 ··· 38 42 inserted in and removed from the running kernel whenever you want), 39 43 say M here and read <file:Documentation/kbuild/modules.txt>. The 40 44 module will be called iwlwifi. 45 + 46 + config IWLWIFI_LEDS 47 + bool 48 + depends on IWLWIFI 49 + depends on LEDS_CLASS=y || LEDS_CLASS=IWLWIFI 50 + select LEDS_TRIGGERS 51 + select MAC80211_LEDS 52 + default y 41 53 42 54 config IWLDVM 43 55 tristate "Intel Wireless WiFi DVM Firmware support" ··· 128 124 Enable use of experimental ucode for testing and debugging. 129 125 130 126 config IWLWIFI_DEVICE_TRACING 131 - 132 127 bool "iwlwifi device access tracing" 133 128 depends on IWLWIFI 134 129 depends on EVENT_TRACING
+2 -1
drivers/net/wireless/iwlwifi/dvm/Makefile
··· 4 4 iwldvm-objs += lib.o calib.o tt.o sta.o rx.o 5 5 6 6 iwldvm-objs += power.o 7 - iwldvm-objs += scan.o led.o 7 + iwldvm-objs += scan.o 8 8 iwldvm-objs += rxon.o devices.o 9 9 10 + iwldvm-$(CONFIG_IWLWIFI_LEDS) += led.o 10 11 iwldvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o 11 12 12 13 ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/../
-1
drivers/net/wireless/iwlwifi/dvm/calib.c
··· 94 94 { 95 95 struct iwl_host_cmd hcmd = { 96 96 .id = REPLY_PHY_CALIBRATION_CMD, 97 - .flags = CMD_SYNC, 98 97 }; 99 98 struct iwl_calib_result *res; 100 99
+3 -4
drivers/net/wireless/iwlwifi/dvm/debugfs.c
··· 1481 1481 1482 1482 /* make request to uCode to retrieve statistics information */ 1483 1483 mutex_lock(&priv->mutex); 1484 - ret = iwl_send_statistics_request(priv, CMD_SYNC, false); 1484 + ret = iwl_send_statistics_request(priv, 0, false); 1485 1485 mutex_unlock(&priv->mutex); 1486 1486 1487 1487 if (ret) ··· 1868 1868 1869 1869 /* make request to uCode to retrieve statistics information */ 1870 1870 mutex_lock(&priv->mutex); 1871 - iwl_send_statistics_request(priv, CMD_SYNC, true); 1871 + iwl_send_statistics_request(priv, 0, true); 1872 1872 mutex_unlock(&priv->mutex); 1873 1873 1874 1874 return count; ··· 2188 2188 struct iwl_host_cmd cmd = { 2189 2189 .id = REPLY_ECHO, 2190 2190 .len = { 0 }, 2191 - .flags = CMD_SYNC, 2192 2191 }; 2193 2192 2194 2193 ret = iwl_dvm_send_cmd(priv, &cmd); ··· 2319 2320 mutex_lock(&priv->mutex); 2320 2321 2321 2322 /* take the return value to make compiler happy - it will fail anyway */ 2322 - ret = iwl_dvm_send_cmd_pdu(priv, REPLY_ERROR, CMD_SYNC, 0, NULL); 2323 + ret = iwl_dvm_send_cmd_pdu(priv, REPLY_ERROR, 0, 0, NULL); 2323 2324 2324 2325 mutex_unlock(&priv->mutex); 2325 2326
+2
drivers/net/wireless/iwlwifi/dvm/dev.h
··· 888 888 889 889 struct iwl_event_log event_log; 890 890 891 + #ifdef CONFIG_IWLWIFI_LEDS 891 892 struct led_classdev led; 892 893 unsigned long blink_on, blink_off; 893 894 bool led_registered; 895 + #endif 894 896 895 897 /* WoWLAN GTK rekey data */ 896 898 u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN];
-2
drivers/net/wireless/iwlwifi/dvm/devices.c
··· 417 417 struct iwl_host_cmd hcmd = { 418 418 .id = REPLY_CHANNEL_SWITCH, 419 419 .len = { sizeof(cmd), }, 420 - .flags = CMD_SYNC, 421 420 .data = { &cmd, }, 422 421 }; 423 422 ··· 578 579 struct iwl_host_cmd hcmd = { 579 580 .id = REPLY_CHANNEL_SWITCH, 580 581 .len = { sizeof(*cmd), }, 581 - .flags = CMD_SYNC, 582 582 .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 583 583 }; 584 584 int err;
+12
drivers/net/wireless/iwlwifi/dvm/led.h
··· 36 36 #define IWL_LED_ACTIVITY (0<<1) 37 37 #define IWL_LED_LINK (1<<1) 38 38 39 + #ifdef CONFIG_IWLWIFI_LEDS 39 40 void iwlagn_led_enable(struct iwl_priv *priv); 40 41 void iwl_leds_init(struct iwl_priv *priv); 41 42 void iwl_leds_exit(struct iwl_priv *priv); 43 + #else 44 + static inline void iwlagn_led_enable(struct iwl_priv *priv) 45 + { 46 + } 47 + static inline void iwl_leds_init(struct iwl_priv *priv) 48 + { 49 + } 50 + static inline void iwl_leds_exit(struct iwl_priv *priv) 51 + { 52 + } 53 + #endif 42 54 43 55 #endif /* __iwl_leds_h__ */
+7 -10
drivers/net/wireless/iwlwifi/dvm/lib.c
··· 81 81 else 82 82 tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD; 83 83 84 - return iwl_dvm_send_cmd_pdu(priv, tx_ant_cfg_cmd, CMD_SYNC, 84 + return iwl_dvm_send_cmd_pdu(priv, tx_ant_cfg_cmd, 0, 85 85 sizeof(tx_power_cmd), &tx_power_cmd); 86 86 } 87 87 ··· 141 141 struct iwl_host_cmd cmd = { 142 142 .id = REPLY_TXFIFO_FLUSH, 143 143 .len = { sizeof(struct iwl_txfifo_flush_cmd), }, 144 - .flags = CMD_SYNC, 145 144 .data = { &flush_cmd, }, 146 145 }; 147 146 ··· 332 333 memcpy(&bt_cmd_v2.basic, &basic, 333 334 sizeof(basic)); 334 335 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, 335 - CMD_SYNC, sizeof(bt_cmd_v2), &bt_cmd_v2); 336 + 0, sizeof(bt_cmd_v2), &bt_cmd_v2); 336 337 } else { 337 338 memcpy(&bt_cmd_v1.basic, &basic, 338 339 sizeof(basic)); 339 340 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, 340 - CMD_SYNC, sizeof(bt_cmd_v1), &bt_cmd_v1); 341 + 0, sizeof(bt_cmd_v1), &bt_cmd_v1); 341 342 } 342 343 if (ret) 343 344 IWL_ERR(priv, "failed to send BT Coex Config\n"); ··· 1043 1044 struct iwl_host_cmd cmd = { 1044 1045 .id = REPLY_WOWLAN_PATTERNS, 1045 1046 .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 1046 - .flags = CMD_SYNC, 1047 1047 }; 1048 1048 int i, err; 1049 1049 ··· 1199 1201 if (key_data.use_rsc_tsc) { 1200 1202 struct iwl_host_cmd rsc_tsc_cmd = { 1201 1203 .id = REPLY_WOWLAN_TSC_RSC_PARAMS, 1202 - .flags = CMD_SYNC, 1203 1204 .data[0] = key_data.rsc_tsc, 1204 1205 .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 1205 1206 .len[0] = sizeof(*key_data.rsc_tsc), ··· 1212 1215 if (key_data.use_tkip) { 1213 1216 ret = iwl_dvm_send_cmd_pdu(priv, 1214 1217 REPLY_WOWLAN_TKIP_PARAMS, 1215 - CMD_SYNC, sizeof(tkip_cmd), 1218 + 0, sizeof(tkip_cmd), 1216 1219 &tkip_cmd); 1217 1220 if (ret) 1218 1221 goto out; ··· 1228 1231 1229 1232 ret = iwl_dvm_send_cmd_pdu(priv, 1230 1233 REPLY_WOWLAN_KEK_KCK_MATERIAL, 1231 - CMD_SYNC, sizeof(kek_kck_cmd), 1234 + 0, sizeof(kek_kck_cmd), 1232 1235 &kek_kck_cmd); 1233 1236 if (ret) 1234 1237 goto out; 1235 1238 } 1236 1239 } 1237 1240 1238 - ret = iwl_dvm_send_cmd_pdu(priv, REPLY_D3_CONFIG, CMD_SYNC, 1241 + ret = iwl_dvm_send_cmd_pdu(priv, REPLY_D3_CONFIG, 0, 1239 1242 sizeof(d3_cfg_cmd), &d3_cfg_cmd); 1240 1243 if (ret) 1241 1244 goto out; 1242 1245 1243 1246 ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WOWLAN_WAKEUP_FILTER, 1244 - CMD_SYNC, sizeof(wakeup_filter_cmd), 1247 + 0, sizeof(wakeup_filter_cmd), 1245 1248 &wakeup_filter_cmd); 1246 1249 if (ret) 1247 1250 goto out;
+11 -16
drivers/net/wireless/iwlwifi/dvm/main.c
··· 128 128 struct iwl_tx_beacon_cmd *tx_beacon_cmd; 129 129 struct iwl_host_cmd cmd = { 130 130 .id = REPLY_TX_BEACON, 131 - .flags = CMD_SYNC, 132 131 }; 133 132 struct ieee80211_tx_info *info; 134 133 u32 frame_size; ··· 310 311 sizeof(struct iwl_statistics_cmd), 311 312 &statistics_cmd); 312 313 else 313 - return iwl_dvm_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, 314 - CMD_SYNC, 314 + return iwl_dvm_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, 0, 315 315 sizeof(struct iwl_statistics_cmd), 316 316 &statistics_cmd); 317 317 } ··· 620 622 621 623 ret = iwl_dvm_send_cmd_pdu(priv, 622 624 REPLY_CT_KILL_CONFIG_CMD, 623 - CMD_SYNC, sizeof(adv_cmd), &adv_cmd); 625 + 0, sizeof(adv_cmd), &adv_cmd); 624 626 if (ret) 625 627 IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); 626 628 else ··· 635 637 636 638 ret = iwl_dvm_send_cmd_pdu(priv, 637 639 REPLY_CT_KILL_CONFIG_CMD, 638 - CMD_SYNC, sizeof(cmd), &cmd); 640 + 0, sizeof(cmd), &cmd); 639 641 if (ret) 640 642 IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); 641 643 else ··· 671 673 672 674 if (IWL_UCODE_API(priv->fw->ucode_ver) > 1) { 673 675 IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant); 674 - return iwl_dvm_send_cmd_pdu(priv, 675 - TX_ANT_CONFIGURATION_CMD, 676 - CMD_SYNC, 676 + return iwl_dvm_send_cmd_pdu(priv, TX_ANT_CONFIGURATION_CMD, 0, 677 677 sizeof(struct iwl_tx_ant_config_cmd), 678 678 &tx_ant_cmd); 679 679 } else { ··· 699 703 (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); 700 704 701 705 if (iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, 702 - CMD_SYNC, sizeof(struct iwl_bt_cmd), &bt_cmd)) 706 + 0, sizeof(struct iwl_bt_cmd), &bt_cmd)) 703 707 IWL_ERR(priv, "failed to send BT Coex Config\n"); 704 708 } 705 709 ··· 983 987 ieee80211_restart_hw(priv->hw); 984 988 else 985 989 IWL_ERR(priv, 986 - "Cannot request restart before registrating with mac80211"); 990 + "Cannot request restart before registrating with mac80211\n"); 987 991 } else { 988 992 WARN_ON(1); 989 993 } ··· 1123 1127 static int iwl_eeprom_init_hw_params(struct iwl_priv *priv) 1124 1128 { 1125 1129 struct iwl_nvm_data *data = priv->nvm_data; 1126 - char *debug_msg; 1127 1130 1128 1131 if (data->sku_cap_11n_enable && 1129 1132 !priv->cfg->ht_params) { ··· 1136 1141 return -EINVAL; 1137 1142 } 1138 1143 1139 - debug_msg = "Device SKU: 24GHz %s %s, 52GHz %s %s, 11.n %s %s\n"; 1140 - IWL_DEBUG_INFO(priv, debug_msg, 1144 + IWL_DEBUG_INFO(priv, 1145 + "Device SKU: 24GHz %s %s, 52GHz %s %s, 11.n %s %s\n", 1141 1146 data->sku_cap_band_24GHz_enable ? "" : "NOT", "enabled", 1142 1147 data->sku_cap_band_52GHz_enable ? "" : "NOT", "enabled", 1143 1148 data->sku_cap_11n_enable ? "" : "NOT", "enabled"); ··· 1345 1350 iwl_set_hw_params(priv); 1346 1351 1347 1352 if (!(priv->nvm_data->sku_cap_ipan_enable)) { 1348 - IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN"); 1353 + IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN\n"); 1349 1354 ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN; 1350 1355 /* 1351 1356 * if not PAN, then don't support P2P -- might be a uCode ··· 2014 2019 2015 2020 for (mq = 0; mq < IWLAGN_FIRST_AMPDU_QUEUE; mq++) { 2016 2021 if (!test_bit(mq, &priv->transport_queue_stop)) { 2017 - IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d", mq); 2022 + IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d\n", mq); 2018 2023 ieee80211_wake_queue(priv->hw, mq); 2019 2024 } else { 2020 - IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d", mq); 2025 + IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d\n", mq); 2021 2026 } 2022 2027 } 2023 2028
+2 -2
drivers/net/wireless/iwlwifi/dvm/power.c
··· 278 278 le32_to_cpu(cmd->sleep_interval[3]), 279 279 le32_to_cpu(cmd->sleep_interval[4])); 280 280 281 - return iwl_dvm_send_cmd_pdu(priv, POWER_TABLE_CMD, CMD_SYNC, 281 + return iwl_dvm_send_cmd_pdu(priv, POWER_TABLE_CMD, 0, 282 282 sizeof(struct iwl_powertable_cmd), cmd); 283 283 } 284 284 ··· 361 361 362 362 memcpy(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)); 363 363 } else 364 - IWL_ERR(priv, "set power fail, ret = %d", ret); 364 + IWL_ERR(priv, "set power fail, ret = %d\n", ret); 365 365 366 366 return ret; 367 367 }
+5 -5
drivers/net/wireless/iwlwifi/dvm/rs.c
··· 1453 1453 tbl->action = IWL_LEGACY_SWITCH_SISO; 1454 1454 break; 1455 1455 default: 1456 - IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); 1456 + IWL_ERR(priv, "Invalid BT load %d\n", priv->bt_traffic_load); 1457 1457 break; 1458 1458 } 1459 1459 ··· 1628 1628 tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1629 1629 break; 1630 1630 default: 1631 - IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); 1631 + IWL_ERR(priv, "Invalid BT load %d\n", priv->bt_traffic_load); 1632 1632 break; 1633 1633 } 1634 1634 ··· 1799 1799 tbl->action = IWL_MIMO2_SWITCH_SISO_A; 1800 1800 break; 1801 1801 default: 1802 - IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); 1802 + IWL_ERR(priv, "Invalid BT load %d\n", priv->bt_traffic_load); 1803 1803 break; 1804 1804 } 1805 1805 ··· 1969 1969 tbl->action = IWL_MIMO3_SWITCH_SISO_A; 1970 1970 break; 1971 1971 default: 1972 - IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); 1972 + IWL_ERR(priv, "Invalid BT load %d\n", priv->bt_traffic_load); 1973 1973 break; 1974 1974 } 1975 1975 ··· 2709 2709 rs_set_expected_tpt_table(lq_sta, tbl); 2710 2710 rs_fill_link_cmd(NULL, lq_sta, rate); 2711 2711 priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; 2712 - iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_SYNC, true); 2712 + iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, 0, true); 2713 2713 } 2714 2714 2715 2715 static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
+1 -1
drivers/net/wireless/iwlwifi/dvm/rx.c
··· 786 786 787 787 memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); 788 788 789 - ieee80211_rx_ni(priv->hw, skb); 789 + ieee80211_rx(priv->hw, skb); 790 790 } 791 791 792 792 static u32 iwlagn_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in)
+9 -9
drivers/net/wireless/iwlwifi/dvm/rxon.c
··· 104 104 105 105 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 106 106 ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, 107 - CMD_SYNC, sizeof(*send), send); 107 + 0, sizeof(*send), send); 108 108 109 109 send->filter_flags = old_filter; 110 110 ··· 134 134 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 135 135 send->dev_type = RXON_DEV_TYPE_P2P; 136 136 ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, 137 - CMD_SYNC, sizeof(*send), send); 137 + 0, sizeof(*send), send); 138 138 139 139 send->filter_flags = old_filter; 140 140 send->dev_type = old_dev_type; ··· 160 160 int ret; 161 161 162 162 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 163 - ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, CMD_SYNC, 163 + ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, 0, 164 164 sizeof(*send), send); 165 165 166 166 send->filter_flags = old_filter; ··· 189 189 ctx->qos_data.qos_active, 190 190 ctx->qos_data.def_qos_parm.qos_flags); 191 191 192 - ret = iwl_dvm_send_cmd_pdu(priv, ctx->qos_cmd, CMD_SYNC, 192 + ret = iwl_dvm_send_cmd_pdu(priv, ctx->qos_cmd, 0, 193 193 sizeof(struct iwl_qosparam_cmd), 194 194 &ctx->qos_data.def_qos_parm); 195 195 if (ret) ··· 353 353 le16_to_cpu(ctx->timing.atim_window)); 354 354 355 355 return iwl_dvm_send_cmd_pdu(priv, ctx->rxon_timing_cmd, 356 - CMD_SYNC, sizeof(ctx->timing), &ctx->timing); 356 + 0, sizeof(ctx->timing), &ctx->timing); 357 357 } 358 358 359 359 static int iwlagn_rxon_disconn(struct iwl_priv *priv, ··· 495 495 * Associated RXON doesn't clear the station table in uCode, 496 496 * so we don't need to restore stations etc. after this. 497 497 */ 498 - ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, CMD_SYNC, 498 + ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, 0, 499 499 sizeof(struct iwl_rxon_cmd), &ctx->staging); 500 500 if (ret) { 501 501 IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); ··· 610 610 cmd.slots[0].width = cpu_to_le16(slot0); 611 611 cmd.slots[1].width = cpu_to_le16(slot1); 612 612 613 - ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, CMD_SYNC, 613 + ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, 0, 614 614 sizeof(cmd), &cmd); 615 615 if (ret) 616 616 IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret); ··· 823 823 824 824 if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) 825 825 == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) { 826 - IWL_WARN(priv, "CCK and auto detect"); 826 + IWL_WARN(priv, "CCK and auto detect\n"); 827 827 errors |= BIT(8); 828 828 } 829 829 ··· 1395 1395 priv->phy_calib_chain_noise_reset_cmd); 1396 1396 ret = iwl_dvm_send_cmd_pdu(priv, 1397 1397 REPLY_PHY_CALIBRATION_CMD, 1398 - CMD_SYNC, sizeof(cmd), &cmd); 1398 + 0, sizeof(cmd), &cmd); 1399 1399 if (ret) 1400 1400 IWL_ERR(priv, 1401 1401 "Could not send REPLY_PHY_CALIBRATION_CMD\n");
+1 -2
drivers/net/wireless/iwlwifi/dvm/scan.c
··· 59 59 int ret; 60 60 struct iwl_host_cmd cmd = { 61 61 .id = REPLY_SCAN_ABORT_CMD, 62 - .flags = CMD_SYNC | CMD_WANT_SKB, 62 + .flags = CMD_WANT_SKB, 63 63 }; 64 64 __le32 *status; 65 65 ··· 639 639 struct iwl_host_cmd cmd = { 640 640 .id = REPLY_SCAN_CMD, 641 641 .len = { sizeof(struct iwl_scan_cmd), }, 642 - .flags = CMD_SYNC, 643 642 }; 644 643 struct iwl_scan_cmd *scan; 645 644 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
+13 -16
drivers/net/wireless/iwlwifi/dvm/sta.c
··· 39 39 lockdep_assert_held(&priv->sta_lock); 40 40 41 41 if (sta_id >= IWLAGN_STATION_COUNT) { 42 - IWL_ERR(priv, "invalid sta_id %u", sta_id); 42 + IWL_ERR(priv, "invalid sta_id %u\n", sta_id); 43 43 return -EINVAL; 44 44 } 45 45 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) ··· 165 165 iwl_free_resp(&cmd); 166 166 167 167 if (cmd.handler_status) 168 - IWL_ERR(priv, "%s - error in the CMD response %d", __func__, 168 + IWL_ERR(priv, "%s - error in the CMD response %d\n", __func__, 169 169 cmd.handler_status); 170 170 171 171 return cmd.handler_status; ··· 261 261 cmd.station_flags = flags; 262 262 cmd.sta.sta_id = sta_id; 263 263 264 - return iwl_send_add_sta(priv, &cmd, CMD_SYNC); 264 + return iwl_send_add_sta(priv, &cmd, 0); 265 265 } 266 266 267 267 static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, ··· 413 413 spin_unlock_bh(&priv->sta_lock); 414 414 415 415 /* Add station to device's station table */ 416 - ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 416 + ret = iwl_send_add_sta(priv, &sta_cmd, 0); 417 417 if (ret) { 418 418 spin_lock_bh(&priv->sta_lock); 419 419 IWL_ERR(priv, "Adding station %pM failed.\n", ··· 456 456 struct iwl_host_cmd cmd = { 457 457 .id = REPLY_REMOVE_STA, 458 458 .len = { sizeof(struct iwl_rem_sta_cmd), }, 459 - .flags = CMD_SYNC, 460 459 .data = { &rm_sta_cmd, }, 461 460 }; 462 461 ··· 739 740 send_lq = true; 740 741 } 741 742 spin_unlock_bh(&priv->sta_lock); 742 - ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 743 + ret = iwl_send_add_sta(priv, &sta_cmd, 0); 743 744 if (ret) { 744 745 spin_lock_bh(&priv->sta_lock); 745 746 IWL_ERR(priv, "Adding station %pM failed.\n", ··· 755 756 * current LQ command 756 757 */ 757 758 if (send_lq) 758 - iwl_send_lq_cmd(priv, ctx, &lq, 759 - CMD_SYNC, true); 759 + iwl_send_lq_cmd(priv, ctx, &lq, 0, true); 760 760 spin_lock_bh(&priv->sta_lock); 761 761 priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; 762 762 } ··· 966 968 return -ENOMEM; 967 969 } 968 970 969 - ret = iwl_send_lq_cmd(priv, ctx, link_cmd, CMD_SYNC, true); 971 + ret = iwl_send_lq_cmd(priv, ctx, link_cmd, 0, true); 970 972 if (ret) 971 973 IWL_ERR(priv, "Link quality command failed (%d)\n", ret); 972 974 ··· 997 999 struct iwl_host_cmd cmd = { 998 1000 .id = ctx->wep_key_cmd, 999 1001 .data = { wep_cmd, }, 1000 - .flags = CMD_SYNC, 1001 1002 }; 1002 1003 1003 1004 might_sleep(); ··· 1245 1248 sta_cmd.sta.modify_mask = STA_MODIFY_KEY_MASK; 1246 1249 sta_cmd.mode = STA_CONTROL_MODIFY_MSK; 1247 1250 1248 - return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 1251 + return iwl_send_add_sta(priv, &sta_cmd, 0); 1249 1252 } 1250 1253 1251 1254 int iwl_set_dynamic_key(struct iwl_priv *priv, ··· 1281 1284 ieee80211_get_key_rx_seq(keyconf, 0, &seq); 1282 1285 ieee80211_get_tkip_rx_p1k(keyconf, addr, seq.tkip.iv32, p1k); 1283 1286 ret = iwlagn_send_sta_key(priv, keyconf, sta_id, 1284 - seq.tkip.iv32, p1k, CMD_SYNC); 1287 + seq.tkip.iv32, p1k, 0); 1285 1288 break; 1286 1289 case WLAN_CIPHER_SUITE_CCMP: 1287 1290 case WLAN_CIPHER_SUITE_WEP40: 1288 1291 case WLAN_CIPHER_SUITE_WEP104: 1289 1292 ret = iwlagn_send_sta_key(priv, keyconf, sta_id, 1290 - 0, NULL, CMD_SYNC); 1293 + 0, NULL, 0); 1291 1294 break; 1292 1295 default: 1293 1296 IWL_ERR(priv, "Unknown cipher %x\n", keyconf->cipher); ··· 1406 1409 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); 1407 1410 spin_unlock_bh(&priv->sta_lock); 1408 1411 1409 - return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 1412 + return iwl_send_add_sta(priv, &sta_cmd, 0); 1410 1413 } 1411 1414 1412 1415 int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, ··· 1430 1433 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); 1431 1434 spin_unlock_bh(&priv->sta_lock); 1432 1435 1433 - return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 1436 + return iwl_send_add_sta(priv, &sta_cmd, 0); 1434 1437 } 1435 1438 1436 1439 int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, ··· 1455 1458 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); 1456 1459 spin_unlock_bh(&priv->sta_lock); 1457 1460 1458 - return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 1461 + return iwl_send_add_sta(priv, &sta_cmd, 0); 1459 1462 } 1460 1463 1461 1464
+1 -1
drivers/net/wireless/iwlwifi/dvm/tt.c
··· 236 236 { 237 237 IWL_DEBUG_TEMP(priv, "Prepare to enter IWL_TI_CT_KILL\n"); 238 238 /* make request to retrieve statistics information */ 239 - iwl_send_statistics_request(priv, CMD_SYNC, false); 239 + iwl_send_statistics_request(priv, 0, false); 240 240 /* Reschedule the ct_kill wait timer */ 241 241 mod_timer(&priv->thermal_throttle.ct_kill_waiting_tm, 242 242 jiffies + msecs_to_jiffies(CT_KILL_WAITING_DURATION));
+12 -12
drivers/net/wireless/iwlwifi/dvm/tx.c
··· 402 402 /* aggregation is on for this <sta,tid> */ 403 403 if (info->flags & IEEE80211_TX_CTL_AMPDU && 404 404 tid_data->agg.state != IWL_AGG_ON) { 405 - IWL_ERR(priv, "TX_CTL_AMPDU while not in AGG:" 406 - " Tx flags = 0x%08x, agg.state = %d", 405 + IWL_ERR(priv, 406 + "TX_CTL_AMPDU while not in AGG: Tx flags = 0x%08x, agg.state = %d\n", 407 407 info->flags, tid_data->agg.state); 408 - IWL_ERR(priv, "sta_id = %d, tid = %d seq_num = %d", 408 + IWL_ERR(priv, "sta_id = %d, tid = %d seq_num = %d\n", 409 409 sta_id, tid, 410 410 IEEE80211_SEQ_TO_SN(tid_data->seq_number)); 411 411 goto drop_unlock_sta; ··· 416 416 */ 417 417 if (WARN_ONCE(tid_data->agg.state != IWL_AGG_ON && 418 418 tid_data->agg.state != IWL_AGG_OFF, 419 - "Tx while agg.state = %d", tid_data->agg.state)) 419 + "Tx while agg.state = %d\n", tid_data->agg.state)) 420 420 goto drop_unlock_sta; 421 421 422 422 seq_number = tid_data->seq_number; ··· 778 778 /* There are no packets for this RA / TID in the HW any more */ 779 779 if (tid_data->agg.ssn == tid_data->next_reclaimed) { 780 780 IWL_DEBUG_TX_QUEUES(priv, 781 - "Can continue DELBA flow ssn = next_recl =" 782 - " %d", tid_data->next_reclaimed); 781 + "Can continue DELBA flow ssn = next_recl = %d\n", 782 + tid_data->next_reclaimed); 783 783 iwl_trans_txq_disable(priv->trans, 784 784 tid_data->agg.txq_id); 785 785 iwlagn_dealloc_agg_txq(priv, tid_data->agg.txq_id); ··· 791 791 /* There are no packets for this RA / TID in the HW any more */ 792 792 if (tid_data->agg.ssn == tid_data->next_reclaimed) { 793 793 IWL_DEBUG_TX_QUEUES(priv, 794 - "Can continue ADDBA flow ssn = next_recl =" 795 - " %d", tid_data->next_reclaimed); 794 + "Can continue ADDBA flow ssn = next_recl = %d\n", 795 + tid_data->next_reclaimed); 796 796 tid_data->agg.state = IWL_AGG_STARTING; 797 797 ieee80211_start_tx_ba_cb_irqsafe(vif, addr, tid); 798 798 } ··· 1216 1216 ctx->vif->type == NL80211_IFTYPE_STATION) { 1217 1217 /* block and stop all queues */ 1218 1218 priv->passive_no_rx = true; 1219 - IWL_DEBUG_TX_QUEUES(priv, "stop all queues: " 1220 - "passive channel"); 1219 + IWL_DEBUG_TX_QUEUES(priv, 1220 + "stop all queues: passive channel\n"); 1221 1221 ieee80211_stop_queues(priv->hw); 1222 1222 1223 1223 IWL_DEBUG_TX_REPLY(priv, ··· 1271 1271 1272 1272 while (!skb_queue_empty(&skbs)) { 1273 1273 skb = __skb_dequeue(&skbs); 1274 - ieee80211_tx_status_ni(priv->hw, skb); 1274 + ieee80211_tx_status(priv->hw, skb); 1275 1275 } 1276 1276 1277 1277 return 0; ··· 1411 1411 1412 1412 while (!skb_queue_empty(&reclaimed_skbs)) { 1413 1413 skb = __skb_dequeue(&reclaimed_skbs); 1414 - ieee80211_tx_status_ni(priv->hw, skb); 1414 + ieee80211_tx_status(priv->hw, skb); 1415 1415 } 1416 1416 1417 1417 return 0;
+3 -3
drivers/net/wireless/iwlwifi/dvm/ucode.c
··· 172 172 memset(&coex_cmd, 0, sizeof(coex_cmd)); 173 173 174 174 return iwl_dvm_send_cmd_pdu(priv, 175 - COEX_PRIORITY_TABLE_CMD, CMD_SYNC, 175 + COEX_PRIORITY_TABLE_CMD, 0, 176 176 sizeof(coex_cmd), &coex_cmd); 177 177 } 178 178 ··· 205 205 memcpy(prio_tbl_cmd.prio_tbl, iwl_bt_prio_tbl, 206 206 sizeof(iwl_bt_prio_tbl)); 207 207 if (iwl_dvm_send_cmd_pdu(priv, 208 - REPLY_BT_COEX_PRIO_TABLE, CMD_SYNC, 208 + REPLY_BT_COEX_PRIO_TABLE, 0, 209 209 sizeof(prio_tbl_cmd), &prio_tbl_cmd)) 210 210 IWL_ERR(priv, "failed to send BT prio tbl command\n"); 211 211 } ··· 218 218 env_cmd.action = action; 219 219 env_cmd.type = type; 220 220 ret = iwl_dvm_send_cmd_pdu(priv, 221 - REPLY_BT_COEX_PROT_ENV, CMD_SYNC, 221 + REPLY_BT_COEX_PROT_ENV, 0, 222 222 sizeof(env_cmd), &env_cmd); 223 223 if (ret) 224 224 IWL_ERR(priv, "failed to send BT env command\n");
+1 -1
drivers/net/wireless/iwlwifi/iwl-7000.c
··· 98 98 #define NVM_HW_SECTION_NUM_FAMILY_7000 0 99 99 100 100 static const struct iwl_base_params iwl7000_base_params = { 101 - .eeprom_size = OTP_LOW_IMAGE_SIZE, 101 + .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_7000, 102 102 .num_of_queues = IWLAGN_NUM_QUEUES, 103 103 .pll_cfg_val = 0, 104 104 .shadow_ram_support = true,
+4 -1
drivers/net/wireless/iwlwifi/iwl-8000.c
··· 83 83 #define IWL8000_MODULE_FIRMWARE(api) IWL8000_FW_PRE __stringify(api) ".ucode" 84 84 85 85 #define NVM_HW_SECTION_NUM_FAMILY_8000 10 86 + #define DEFAULT_NVM_FILE_FAMILY_8000 "iwl_nvm_8000.bin" 86 87 87 88 static const struct iwl_base_params iwl8000_base_params = { 88 - .eeprom_size = OTP_LOW_IMAGE_SIZE, 89 + .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_8000, 89 90 .num_of_queues = IWLAGN_NUM_QUEUES, 90 91 .pll_cfg_val = 0, 91 92 .shadow_ram_support = true, ··· 119 118 .ht_params = &iwl8000_ht_params, 120 119 .nvm_ver = IWL8000_NVM_VERSION, 121 120 .nvm_calib_ver = IWL8000_TX_POWER_VERSION, 121 + .default_nvm_file = DEFAULT_NVM_FILE_FAMILY_8000, 122 122 }; 123 123 124 124 const struct iwl_cfg iwl8260_n_cfg = { ··· 129 127 .ht_params = &iwl8000_ht_params, 130 128 .nvm_ver = IWL8000_NVM_VERSION, 131 129 .nvm_calib_ver = IWL8000_TX_POWER_VERSION, 130 + .default_nvm_file = DEFAULT_NVM_FILE_FAMILY_8000, 132 131 }; 133 132 134 133 MODULE_FIRMWARE(IWL8000_MODULE_FIRMWARE(IWL8000_UCODE_API_OK));
+1 -3
drivers/net/wireless/iwlwifi/iwl-agn-hw.h
··· 102 102 103 103 /* EEPROM */ 104 104 #define IWLAGN_EEPROM_IMG_SIZE 2048 105 - /* OTP */ 106 - /* lower blocks contain EEPROM image and calibration data */ 107 - #define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */ 105 + 108 106 /* high blocks contain PAPD data */ 109 107 #define OTP_HIGH_IMAGE_SIZE_6x00 (6 * 512 * sizeof(u16)) /* 6 KB */ 110 108 #define OTP_HIGH_IMAGE_SIZE_1000 (0x200 * sizeof(u16)) /* 1024 bytes */
+7
drivers/net/wireless/iwlwifi/iwl-config.h
··· 193 193 #define EEPROM_6000_REG_BAND_24_HT40_CHANNELS 0x80 194 194 #define EEPROM_REGULATORY_BAND_NO_HT40 0 195 195 196 + /* lower blocks contain EEPROM image and calibration data */ 197 + #define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */ 198 + #define OTP_LOW_IMAGE_SIZE_FAMILY_7000 (16 * 512 * sizeof(u16)) /* 16 KB */ 199 + #define OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(u16)) /* 32 KB */ 200 + 196 201 struct iwl_eeprom_params { 197 202 const u8 regulatory_bands[7]; 198 203 bool enhanced_txpower; ··· 274 269 u8 nvm_hw_section_num; 275 270 bool lp_xtal_workaround; 276 271 const struct iwl_pwr_tx_backoff *pwr_tx_backoffs; 272 + bool no_power_up_nic_in_init; 273 + const char *default_nvm_file; 277 274 }; 278 275 279 276 /*
+2 -4
drivers/net/wireless/iwlwifi/iwl-debug.c
··· 61 61 * 62 62 *****************************************************************************/ 63 63 64 - #define DEBUG 65 - 66 64 #include <linux/device.h> 67 65 #include <linux/interrupt.h> 68 66 #include <linux/export.h> ··· 126 128 #ifdef CONFIG_IWLWIFI_DEBUG 127 129 if (iwl_have_debug_level(level) && 128 130 (!limit || net_ratelimit())) 129 - dev_dbg(dev, "%c %s %pV", in_interrupt() ? 'I' : 'U', 130 - function, &vaf); 131 + dev_printk(KERN_DEBUG, dev, "%c %s %pV", 132 + in_interrupt() ? 'I' : 'U', function, &vaf); 131 133 #endif 132 134 trace_iwlwifi_dbg(level, in_interrupt(), function, &vaf); 133 135 va_end(args);
+33 -8
drivers/net/wireless/iwlwifi/iwl-debug.h
··· 47 47 void __iwl_info(struct device *dev, const char *fmt, ...) __printf(2, 3); 48 48 void __iwl_crit(struct device *dev, const char *fmt, ...) __printf(2, 3); 49 49 50 + /* not all compilers can evaluate strlen() at compile time, so use sizeof() */ 51 + #define CHECK_FOR_NEWLINE(f) BUILD_BUG_ON(f[sizeof(f) - 2] != '\n') 52 + 50 53 /* No matter what is m (priv, bus, trans), this will work */ 51 - #define IWL_ERR(m, f, a...) __iwl_err((m)->dev, false, false, f, ## a) 52 - #define IWL_ERR_DEV(d, f, a...) __iwl_err((d), false, false, f, ## a) 53 - #define IWL_WARN(m, f, a...) __iwl_warn((m)->dev, f, ## a) 54 - #define IWL_INFO(m, f, a...) __iwl_info((m)->dev, f, ## a) 55 - #define IWL_CRIT(m, f, a...) __iwl_crit((m)->dev, f, ## a) 54 + #define IWL_ERR_DEV(d, f, a...) \ 55 + do { \ 56 + CHECK_FOR_NEWLINE(f); \ 57 + __iwl_err((d), false, false, f, ## a); \ 58 + } while (0) 59 + #define IWL_ERR(m, f, a...) \ 60 + IWL_ERR_DEV((m)->dev, f, ## a) 61 + #define IWL_WARN(m, f, a...) \ 62 + do { \ 63 + CHECK_FOR_NEWLINE(f); \ 64 + __iwl_warn((m)->dev, f, ## a); \ 65 + } while (0) 66 + #define IWL_INFO(m, f, a...) \ 67 + do { \ 68 + CHECK_FOR_NEWLINE(f); \ 69 + __iwl_info((m)->dev, f, ## a); \ 70 + } while (0) 71 + #define IWL_CRIT(m, f, a...) \ 72 + do { \ 73 + CHECK_FOR_NEWLINE(f); \ 74 + __iwl_crit((m)->dev, f, ## a); \ 75 + } while (0) 56 76 57 77 #if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING) 58 78 void __iwl_dbg(struct device *dev, ··· 92 72 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ 93 73 } while (0) 94 74 75 + #define __IWL_DEBUG_DEV(dev, level, limit, fmt, args...) \ 76 + do { \ 77 + CHECK_FOR_NEWLINE(fmt); \ 78 + __iwl_dbg(dev, level, limit, __func__, fmt, ##args); \ 79 + } while (0) 95 80 #define IWL_DEBUG(m, level, fmt, args...) \ 96 - __iwl_dbg((m)->dev, level, false, __func__, fmt, ##args) 81 + __IWL_DEBUG_DEV((m)->dev, level, false, fmt, ##args) 97 82 #define IWL_DEBUG_DEV(dev, level, fmt, args...) \ 98 - __iwl_dbg((dev), level, false, __func__, fmt, ##args) 83 + __IWL_DEBUG_DEV(dev, level, false, fmt, ##args) 99 84 #define IWL_DEBUG_LIMIT(m, level, fmt, args...) \ 100 - __iwl_dbg((m)->dev, level, true, __func__, fmt, ##args) 85 + __IWL_DEBUG_DEV((m)->dev, level, true, fmt, ##args) 101 86 102 87 #ifdef CONFIG_IWLWIFI_DEBUG 103 88 #define iwl_print_hex_dump(m, level, p, len) \
+5
drivers/net/wireless/iwlwifi/iwl-drv.c
··· 1243 1243 .bt_coex_active = true, 1244 1244 .power_level = IWL_POWER_INDEX_1, 1245 1245 .wd_disable = true, 1246 + .uapsd_disable = false, 1246 1247 /* the rest are 0 by default */ 1247 1248 }; 1248 1249 IWL_EXPORT_SYMBOL(iwlwifi_mod_params); ··· 1356 1355 1357 1356 module_param_named(nvm_file, iwlwifi_mod_params.nvm_file, charp, S_IRUGO); 1358 1357 MODULE_PARM_DESC(nvm_file, "NVM file name"); 1358 + 1359 + module_param_named(uapsd_disable, iwlwifi_mod_params.uapsd_disable, 1360 + bool, S_IRUGO); 1361 + MODULE_PARM_DESC(uapsd_disable, "disable U-APSD functionality (default: N)"); 1359 1362 1360 1363 /* 1361 1364 * set bt_coex_active to true, uCode will do kill/defer
+9 -1
drivers/net/wireless/iwlwifi/iwl-fw.h
··· 74 74 * @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w). 75 75 * @IWL_UCODE_TLV_FLAGS_P2P: This uCode image supports P2P. 76 76 * @IWL_UCODE_TLV_FLAGS_DW_BC_TABLE: The SCD byte count table is in DWORDS 77 - * @IWL_UCODE_TLV_FLAGS_UAPSD: This uCode image supports uAPSD 77 + * @IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT: This uCode image supports uAPSD 78 78 * @IWL_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of black list instead of 64 in scan 79 79 * offload profile config command. 80 80 * @IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS: D3 image supports up to six ··· 107 107 IWL_UCODE_TLV_FLAGS_P2P_PM = BIT(21), 108 108 IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM = BIT(22), 109 109 IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_SCM = BIT(23), 110 + IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT = BIT(24), 110 111 IWL_UCODE_TLV_FLAGS_EBS_SUPPORT = BIT(25), 111 112 IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD = BIT(26), 112 113 IWL_UCODE_TLV_FLAGS_BCAST_FILTERING = BIT(29), ··· 117 116 /** 118 117 * enum iwl_ucode_tlv_api - ucode api 119 118 * @IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID: wowlan config includes tid field. 119 + * @IWL_UCODE_TLV_API_CSA_FLOW: ucode can do unbind-bind flow for CSA. 120 120 */ 121 121 enum iwl_ucode_tlv_api { 122 122 IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID = BIT(0), 123 + IWL_UCODE_TLV_API_CSA_FLOW = BIT(4), 123 124 }; 124 125 125 126 /** ··· 195 192 struct fw_desc sec[IWL_UCODE_SECTION_MAX]; 196 193 bool is_secure; 197 194 bool is_dual_cpus; 195 + }; 196 + 197 + struct iwl_sf_region { 198 + u32 addr; 199 + u32 size; 198 200 }; 199 201 200 202 /* uCode version contains 4 values: Major/Minor/API/Serial */
+18
drivers/net/wireless/iwlwifi/iwl-io.c
··· 33 33 #include "iwl-io.h" 34 34 #include "iwl-csr.h" 35 35 #include "iwl-debug.h" 36 + #include "iwl-prph.h" 36 37 #include "iwl-fh.h" 37 38 38 39 #define IWL_POLL_INTERVAL 10 /* microseconds */ ··· 183 182 } 184 183 } 185 184 IWL_EXPORT_SYMBOL(iwl_clear_bits_prph); 185 + 186 + void iwl_force_nmi(struct iwl_trans *trans) 187 + { 188 + /* 189 + * In HW previous to the 8000 HW family, and in the 8000 HW family 190 + * itself when the revision step==0, the DEVICE_SET_NMI_REG is used 191 + * to force an NMI. Otherwise, a different register - 192 + * DEVICE_SET_NMI_8000B_REG - is used. 193 + */ 194 + if ((trans->cfg->device_family != IWL_DEVICE_FAMILY_8000) || 195 + ((trans->hw_rev & 0xc) == 0x0)) 196 + iwl_write_prph(trans, DEVICE_SET_NMI_REG, DEVICE_SET_NMI_VAL); 197 + else 198 + iwl_write_prph(trans, DEVICE_SET_NMI_8000B_REG, 199 + DEVICE_SET_NMI_8000B_VAL); 200 + } 201 + IWL_EXPORT_SYMBOL(iwl_force_nmi); 186 202 187 203 static const char *get_fh_string(int cmd) 188 204 {
+1
drivers/net/wireless/iwlwifi/iwl-io.h
··· 80 80 void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, 81 81 u32 bits, u32 mask); 82 82 void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); 83 + void iwl_force_nmi(struct iwl_trans *trans); 83 84 84 85 /* Error handling */ 85 86 int iwl_dump_fh(struct iwl_trans *trans, char **buf);
+1
drivers/net/wireless/iwlwifi/iwl-modparams.h
··· 119 119 #endif 120 120 int ant_coupling; 121 121 char *nvm_file; 122 + bool uapsd_disable; 122 123 }; 123 124 124 125 #endif /* #__iwl_modparams_h__ */
+40 -10
drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
··· 62 62 #include <linux/types.h> 63 63 #include <linux/slab.h> 64 64 #include <linux/export.h> 65 + #include <linux/etherdevice.h> 65 66 #include "iwl-drv.h" 66 67 #include "iwl-modparams.h" 67 68 #include "iwl-nvm-parse.h" ··· 128 127 129 128 static const u8 iwl_nvm_channels_family_8000[] = { 130 129 /* 2.4 GHz */ 131 - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 130 + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 132 131 /* 5 GHz */ 133 132 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 134 133 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, ··· 138 137 #define IWL_NUM_CHANNELS ARRAY_SIZE(iwl_nvm_channels) 139 138 #define IWL_NUM_CHANNELS_FAMILY_8000 ARRAY_SIZE(iwl_nvm_channels_family_8000) 140 139 #define NUM_2GHZ_CHANNELS 14 141 - #define NUM_2GHZ_CHANNELS_FAMILY_8000 13 140 + #define NUM_2GHZ_CHANNELS_FAMILY_8000 14 142 141 #define FIRST_2GHZ_HT_MINUS 5 143 142 #define LAST_2GHZ_HT_PLUS 9 144 143 #define LAST_5GHZ_HT 161 ··· 451 450 struct iwl_nvm_data *data, 452 451 const __le16 *nvm_sec) 453 452 { 454 - u8 hw_addr[ETH_ALEN]; 455 - 456 - if (cfg->device_family != IWL_DEVICE_FAMILY_8000) 457 - memcpy(hw_addr, nvm_sec + HW_ADDR, ETH_ALEN); 458 - else 459 - memcpy(hw_addr, nvm_sec + MAC_ADDRESS_OVERRIDE_FAMILY_8000, 460 - ETH_ALEN); 453 + const u8 *hw_addr = (const u8 *)(nvm_sec + HW_ADDR); 461 454 462 455 /* The byte order is little endian 16 bit, meaning 214365 */ 463 456 data->hw_addr[0] = hw_addr[1]; ··· 460 465 data->hw_addr[3] = hw_addr[2]; 461 466 data->hw_addr[4] = hw_addr[5]; 462 467 data->hw_addr[5] = hw_addr[4]; 468 + } 469 + 470 + static void iwl_set_hw_address_family_8000(const struct iwl_cfg *cfg, 471 + struct iwl_nvm_data *data, 472 + const __le16 *mac_override, 473 + const __le16 *nvm_hw) 474 + { 475 + const u8 *hw_addr; 476 + 477 + if (mac_override) { 478 + hw_addr = (const u8 *)(mac_override + 479 + MAC_ADDRESS_OVERRIDE_FAMILY_8000); 480 + 481 + /* The byte order is little endian 16 bit, meaning 214365 */ 482 + data->hw_addr[0] = hw_addr[1]; 483 + data->hw_addr[1] = hw_addr[0]; 484 + data->hw_addr[2] = hw_addr[3]; 485 + data->hw_addr[3] = hw_addr[2]; 486 + data->hw_addr[4] = hw_addr[5]; 487 + data->hw_addr[5] = hw_addr[4]; 488 + 489 + if (is_valid_ether_addr(hw_addr)) 490 + return; 491 + } 492 + 493 + /* take the MAC address from the OTP */ 494 + hw_addr = (const u8 *)(nvm_hw + HW_ADDR0_FAMILY_8000); 495 + data->hw_addr[0] = hw_addr[3]; 496 + data->hw_addr[1] = hw_addr[2]; 497 + data->hw_addr[2] = hw_addr[1]; 498 + data->hw_addr[3] = hw_addr[0]; 499 + 500 + hw_addr = (const u8 *)(nvm_hw + HW_ADDR1_FAMILY_8000); 501 + data->hw_addr[4] = hw_addr[1]; 502 + data->hw_addr[5] = hw_addr[0]; 463 503 } 464 504 465 505 struct iwl_nvm_data * ··· 556 526 rx_chains); 557 527 } else { 558 528 /* MAC address in family 8000 */ 559 - iwl_set_hw_address(cfg, data, mac_override); 529 + iwl_set_hw_address_family_8000(cfg, data, mac_override, nvm_hw); 560 530 561 531 iwl_init_sbands(dev, cfg, data, regulatory, 562 532 sku & NVM_SKU_CAP_11AC_ENABLE, tx_chains,
+4 -5
drivers/net/wireless/iwlwifi/iwl-phy-db.c
··· 345 345 struct iwl_phy_db_cmd phy_db_cmd; 346 346 struct iwl_host_cmd cmd = { 347 347 .id = PHY_DB_CMD, 348 - .flags = CMD_SYNC, 349 348 }; 350 349 351 350 IWL_DEBUG_INFO(phy_db->trans, ··· 392 393 entry->data); 393 394 if (err) { 394 395 IWL_ERR(phy_db->trans, 395 - "Can't SEND phy_db section %d (%d), err %d", 396 + "Can't SEND phy_db section %d (%d), err %d\n", 396 397 type, i, err); 397 398 return err; 398 399 } 399 400 400 401 IWL_DEBUG_INFO(phy_db->trans, 401 - "Sent PHY_DB HCMD, type = %d num = %d", 402 + "Sent PHY_DB HCMD, type = %d num = %d\n", 402 403 type, i); 403 404 } 404 405 ··· 450 451 IWL_NUM_PAPD_CH_GROUPS); 451 452 if (err) { 452 453 IWL_ERR(phy_db->trans, 453 - "Cannot send channel specific PAPD groups"); 454 + "Cannot send channel specific PAPD groups\n"); 454 455 return err; 455 456 } 456 457 ··· 460 461 IWL_NUM_TXP_CH_GROUPS); 461 462 if (err) { 462 463 IWL_ERR(phy_db->trans, 463 - "Cannot send channel specific TX power groups"); 464 + "Cannot send channel specific TX power groups\n"); 464 465 return err; 465 466 } 466 467
+3
drivers/net/wireless/iwlwifi/iwl-prph.h
··· 105 105 106 106 /* Device NMI register */ 107 107 #define DEVICE_SET_NMI_REG 0x00a01c30 108 + #define DEVICE_SET_NMI_VAL 0x1 109 + #define DEVICE_SET_NMI_8000B_REG 0x00a01c24 110 + #define DEVICE_SET_NMI_8000B_VAL 0x1000000 108 111 109 112 /* Shared registers (0x0..0x3ff, via target indirect or periphery */ 110 113 #define SHR_BASE 0x00a10000
+40 -10
drivers/net/wireless/iwlwifi/iwl-trans.h
··· 189 189 /** 190 190 * enum CMD_MODE - how to send the host commands ? 191 191 * 192 - * @CMD_SYNC: The caller will be stalled until the fw responds to the command 193 192 * @CMD_ASYNC: Return right away and don't wait for the response 194 - * @CMD_WANT_SKB: valid only with CMD_SYNC. The caller needs the buffer of the 195 - * response. The caller needs to call iwl_free_resp when done. 193 + * @CMD_WANT_SKB: Not valid with CMD_ASYNC. The caller needs the buffer of 194 + * the response. The caller needs to call iwl_free_resp when done. 196 195 * @CMD_HIGH_PRIO: The command is high priority - it goes to the front of the 197 196 * command queue, but after other high priority commands. valid only 198 197 * with CMD_ASYNC. ··· 201 202 * (i.e. mark it as non-idle). 202 203 */ 203 204 enum CMD_MODE { 204 - CMD_SYNC = 0, 205 205 CMD_ASYNC = BIT(0), 206 206 CMD_WANT_SKB = BIT(1), 207 207 CMD_SEND_IN_RFKILL = BIT(2), ··· 425 427 * @send_cmd:send a host command. Must return -ERFKILL if RFkill is asserted. 426 428 * If RFkill is asserted in the middle of a SYNC host command, it must 427 429 * return -ERFKILL straight away. 428 - * May sleep only if CMD_SYNC is set 430 + * May sleep only if CMD_ASYNC is not set 429 431 * @tx: send an skb 430 432 * Must be atomic 431 433 * @reclaim: free packet until ssn. Returns a list of freed packets. ··· 461 463 * @unref: release a reference previously taken with @ref. Note that 462 464 * initially the reference count is 1, making an initial @unref 463 465 * necessary to allow low power states. 466 + * @dump_data: fill a data dump with debug data, maybe containing last 467 + * TX'ed commands and similar. When called with a NULL buffer and 468 + * zero buffer length, provide only the (estimated) required buffer 469 + * length. Return the used buffer length. 470 + * Note that the transport must fill in the proper file headers. 464 471 */ 465 472 struct iwl_trans_ops { 466 473 ··· 473 470 void (*op_mode_leave)(struct iwl_trans *iwl_trans); 474 471 int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw, 475 472 bool run_in_rfkill); 473 + int (*update_sf)(struct iwl_trans *trans, 474 + struct iwl_sf_region *st_fwrd_space); 476 475 void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr); 477 476 void (*stop_device)(struct iwl_trans *trans); 478 477 ··· 516 511 u32 value); 517 512 void (*ref)(struct iwl_trans *trans); 518 513 void (*unref)(struct iwl_trans *trans); 514 + 515 + #ifdef CONFIG_IWLWIFI_DEBUGFS 516 + u32 (*dump_data)(struct iwl_trans *trans, void *buf, u32 buflen); 517 + #endif 519 518 }; 520 519 521 520 /** ··· 638 629 return trans->ops->start_fw(trans, fw, run_in_rfkill); 639 630 } 640 631 632 + static inline int iwl_trans_update_sf(struct iwl_trans *trans, 633 + struct iwl_sf_region *st_fwrd_space) 634 + { 635 + might_sleep(); 636 + 637 + if (trans->ops->update_sf) 638 + return trans->ops->update_sf(trans, st_fwrd_space); 639 + 640 + return 0; 641 + } 642 + 641 643 static inline void iwl_trans_stop_device(struct iwl_trans *trans) 642 644 { 643 645 might_sleep(); ··· 684 664 trans->ops->unref(trans); 685 665 } 686 666 667 + #ifdef CONFIG_IWLWIFI_DEBUGFS 668 + static inline u32 iwl_trans_dump_data(struct iwl_trans *trans, 669 + void *buf, u32 buflen) 670 + { 671 + if (!trans->ops->dump_data) 672 + return 0; 673 + return trans->ops->dump_data(trans, buf, buflen); 674 + } 675 + #endif 676 + 687 677 static inline int iwl_trans_send_cmd(struct iwl_trans *trans, 688 678 struct iwl_host_cmd *cmd) 689 679 { ··· 707 677 return -EIO; 708 678 709 679 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) { 710 - IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); 680 + IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); 711 681 return -EIO; 712 682 } 713 683 ··· 749 719 return -EIO; 750 720 751 721 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) 752 - IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); 722 + IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); 753 723 754 724 return trans->ops->tx(trans, skb, dev_cmd, queue); 755 725 } ··· 758 728 int ssn, struct sk_buff_head *skbs) 759 729 { 760 730 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) 761 - IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); 731 + IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); 762 732 763 733 trans->ops->reclaim(trans, queue, ssn, skbs); 764 734 } ··· 775 745 might_sleep(); 776 746 777 747 if (unlikely((trans->state != IWL_TRANS_FW_ALIVE))) 778 - IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); 748 + IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); 779 749 780 750 trans->ops->txq_enable(trans, queue, fifo, sta_id, tid, 781 751 frame_limit, ssn); ··· 792 762 u32 txq_bm) 793 763 { 794 764 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) 795 - IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); 765 + IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); 796 766 797 767 return trans->ops->wait_tx_queue_empty(trans, txq_bm); 798 768 }
+2 -1
drivers/net/wireless/iwlwifi/mvm/Makefile
··· 3 3 iwlmvm-y += utils.o rx.o tx.o binding.o quota.o sta.o sf.o 4 4 iwlmvm-y += scan.o time-event.o rs.o 5 5 iwlmvm-y += power.o coex.o 6 - iwlmvm-y += led.o tt.o offloading.o 6 + iwlmvm-y += tt.o offloading.o 7 7 iwlmvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o debugfs-vif.o 8 + iwlmvm-$(CONFIG_IWLWIFI_LEDS) += led.o 8 9 iwlmvm-$(CONFIG_PM_SLEEP) += d3.o 9 10 10 11 ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/../
+34 -46
drivers/net/wireless/iwlwifi/mvm/coex.c
··· 106 106 107 107 static int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm) 108 108 { 109 - return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_PRIO_TABLE, CMD_SYNC, 109 + return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_PRIO_TABLE, 0, 110 110 sizeof(struct iwl_bt_coex_prio_tbl_cmd), 111 111 &iwl_bt_prio_tbl); 112 112 } ··· 124 124 }; 125 125 126 126 static const __le32 iwl_bt_prio_boost[BT_COEX_BOOST_SIZE] = { 127 - cpu_to_le32(0xf0f0f0f0), 128 - cpu_to_le32(0xc0c0c0c0), 129 - cpu_to_le32(0xfcfcfcfc), 130 - cpu_to_le32(0xff00ff00), 127 + cpu_to_le32(0xf0f0f0f0), /* 50% */ 128 + cpu_to_le32(0xc0c0c0c0), /* 25% */ 129 + cpu_to_le32(0xfcfcfcfc), /* 75% */ 130 + cpu_to_le32(0xfefefefe), /* 87.5% */ 131 131 }; 132 132 133 133 static const __le32 iwl_single_shared_ant[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = { ··· 300 300 }; 301 301 302 302 static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = { 303 - cpu_to_le32(0x22002200), 304 - cpu_to_le32(0x33113311), 303 + cpu_to_le32(0x28412201), 304 + cpu_to_le32(0x11118451), 305 305 }; 306 306 307 307 struct corunning_block_luts { ··· 565 565 .id = BT_CONFIG, 566 566 .len = { sizeof(*bt_cmd), }, 567 567 .dataflags = { IWL_HCMD_DFL_NOCOPY, }, 568 - .flags = CMD_SYNC, 569 568 }; 570 569 int ret; 571 570 u32 flags; ··· 662 663 .data[0] = &bt_cmd, 663 664 .len = { sizeof(*bt_cmd), }, 664 665 .dataflags = { IWL_HCMD_DFL_NOCOPY, }, 665 - .flags = CMD_SYNC, 666 666 }; 667 667 int ret = 0; 668 668 ··· 715 717 return ret; 716 718 } 717 719 718 - int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, bool enable) 720 + static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, 721 + bool enable) 719 722 { 720 723 struct iwl_bt_coex_cmd *bt_cmd; 721 724 /* Send ASYNC since this can be sent from an atomic context */ ··· 734 735 return 0; 735 736 736 737 /* nothing to do */ 737 - if (mvmsta->bt_reduced_txpower_dbg || 738 - mvmsta->bt_reduced_txpower == enable) 738 + if (mvmsta->bt_reduced_txpower == enable) 739 739 return 0; 740 740 741 741 bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_ATOMIC); ··· 801 803 802 804 switch (vif->type) { 803 805 case NL80211_IFTYPE_STATION: 806 + /* Count BSSes vifs */ 807 + data->num_bss_ifaces++; 804 808 /* default smps_mode for BSS / P2P client is AUTOMATIC */ 805 809 smps_mode = IEEE80211_SMPS_AUTOMATIC; 806 - data->num_bss_ifaces++; 807 - 808 - /* 809 - * Count unassoc BSSes, relax SMSP constraints 810 - * and disable reduced Tx Power 811 - */ 812 - if (!vif->bss_conf.assoc) { 813 - iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, 814 - smps_mode); 815 - if (iwl_mvm_bt_coex_reduced_txp(mvm, 816 - mvmvif->ap_sta_id, 817 - false)) 818 - IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); 819 - return; 820 - } 821 810 break; 822 811 case NL80211_IFTYPE_AP: 823 812 /* default smps_mode for AP / GO is OFF */ ··· 830 845 /* ... relax constraints and disable rssi events */ 831 846 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, 832 847 smps_mode); 833 - if (vif->type == NL80211_IFTYPE_STATION) 848 + data->reduced_tx_power = false; 849 + if (vif->type == NL80211_IFTYPE_STATION) { 850 + iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, 851 + false); 834 852 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); 853 + } 835 854 return; 836 855 } 837 856 ··· 846 857 smps_mode = vif->type == NL80211_IFTYPE_AP ? 847 858 IEEE80211_SMPS_OFF : 848 859 IEEE80211_SMPS_DYNAMIC; 860 + 861 + /* relax SMPS contraints for next association */ 862 + if (!vif->bss_conf.assoc) 863 + smps_mode = IEEE80211_SMPS_AUTOMATIC; 864 + 849 865 IWL_DEBUG_COEX(data->mvm, 850 866 "mac %d: bt_status %d bt_activity_grading %d smps_req %d\n", 851 867 mvmvif->id, data->notif->bt_status, bt_activity_grading, ··· 897 903 /* if secondary is not NULL, it might be a GO */ 898 904 data->secondary = chanctx_conf; 899 905 900 - /* don't reduce the Tx power if in loose scheme */ 906 + /* 907 + * don't reduce the Tx power if one of these is true: 908 + * we are in LOOSE 909 + * single share antenna product 910 + * BT is active 911 + * we are associated 912 + */ 901 913 if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT || 902 - mvm->cfg->bt_shared_single_ant) { 914 + mvm->cfg->bt_shared_single_ant || !vif->bss_conf.assoc || 915 + !data->notif->bt_status) { 903 916 data->reduced_tx_power = false; 904 - iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); 905 - return; 906 - } 907 - 908 - /* reduced Txpower only if BT is on, so ...*/ 909 - if (!data->notif->bt_status) { 910 - /* ... cancel reduced Tx power ... */ 911 - if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false)) 912 - IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); 913 - data->reduced_tx_power = false; 914 - 915 - /* ... and there is no need to get reports on RSSI any more. */ 917 + iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false); 916 918 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); 917 919 return; 918 920 } ··· 1012 1022 1013 1023 /* Don't spam the fw with the same command over and over */ 1014 1024 if (memcmp(&cmd, &mvm->last_bt_ci_cmd, sizeof(cmd))) { 1015 - if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, CMD_SYNC, 1025 + if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, 0, 1016 1026 sizeof(cmd), &cmd)) 1017 - IWL_ERR(mvm, "Failed to send BT_CI cmd"); 1027 + IWL_ERR(mvm, "Failed to send BT_CI cmd\n"); 1018 1028 memcpy(&mvm->last_bt_ci_cmd, &cmd, sizeof(cmd)); 1019 1029 } 1020 1030 ··· 1029 1039 IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n"); 1030 1040 } 1031 1041 1032 - /* upon association, the fw will send in BT Coex notification */ 1033 1042 int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, 1034 1043 struct iwl_rx_cmd_buffer *rxb, 1035 1044 struct iwl_device_cmd *dev_cmd) ··· 1267 1278 .id = BT_CONFIG, 1268 1279 .len = { sizeof(*bt_cmd), }, 1269 1280 .dataflags = { IWL_HCMD_DFL_NOCOPY, }, 1270 - .flags = CMD_SYNC, 1271 1281 }; 1272 1282 1273 1283 if (!IWL_MVM_BT_COEX_CORUNNING)
+14 -21
drivers/net/wireless/iwlwifi/mvm/d3.c
··· 193 193 wkc.wep_key.key_offset = data->wep_key_idx; 194 194 } 195 195 196 - ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, CMD_SYNC, 197 - sizeof(wkc), &wkc); 196 + ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, 0, sizeof(wkc), &wkc); 198 197 data->error = ret != 0; 199 198 200 199 mvm->ptk_ivlen = key->iv_len; ··· 340 341 struct iwl_host_cmd cmd = { 341 342 .id = WOWLAN_PATTERNS, 342 343 .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 343 - .flags = CMD_SYNC, 344 344 }; 345 345 int i, err; 346 346 ··· 516 518 .id = REMOTE_WAKE_CONFIG_CMD, 517 519 .len = { sizeof(*cfg), }, 518 520 .dataflags = { IWL_HCMD_DFL_NOCOPY, }, 519 - .flags = CMD_SYNC, 520 521 }; 521 522 int ret; 522 523 ··· 663 666 664 667 if (WARN_ON(!vif->bss_conf.assoc)) 665 668 return -EINVAL; 666 - /* hack */ 667 - vif->bss_conf.assoc = false; 669 + 668 670 ret = iwl_mvm_mac_ctxt_add(mvm, vif); 669 - vif->bss_conf.assoc = true; 670 671 if (ret) 671 672 return ret; 672 673 ··· 700 705 return ret; 701 706 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], ap_sta); 702 707 703 - ret = iwl_mvm_mac_ctxt_changed(mvm, vif); 708 + ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false); 704 709 if (ret) 705 710 return ret; 706 711 ··· 714 719 for (i = 1; i < MAX_BINDINGS; i++) 715 720 quota_cmd.quotas[i].id_and_color = cpu_to_le32(FW_CTXT_INVALID); 716 721 717 - ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC, 722 + ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, 0, 718 723 sizeof(quota_cmd), &quota_cmd); 719 724 if (ret) 720 725 IWL_ERR(mvm, "Failed to send quota: %d\n", ret); ··· 734 739 }; 735 740 struct iwl_host_cmd cmd = { 736 741 .id = NON_QOS_TX_COUNTER_CMD, 737 - .flags = CMD_SYNC | CMD_WANT_SKB, 742 + .flags = CMD_WANT_SKB, 738 743 }; 739 744 int err; 740 745 u32 size; ··· 776 781 777 782 mvmvif->seqno_valid = false; 778 783 779 - if (iwl_mvm_send_cmd_pdu(mvm, NON_QOS_TX_COUNTER_CMD, CMD_SYNC, 784 + if (iwl_mvm_send_cmd_pdu(mvm, NON_QOS_TX_COUNTER_CMD, 0, 780 785 sizeof(query_cmd), &query_cmd)) 781 786 IWL_ERR(mvm, "failed to set non-QoS seqno\n"); 782 787 } ··· 791 796 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID) 792 797 cmd_len = sizeof(*cmd); 793 798 794 - return iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, CMD_SYNC, 799 + return iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, 0, 795 800 cmd_len, cmd); 796 801 } 797 802 ··· 820 825 }; 821 826 struct iwl_host_cmd d3_cfg_cmd = { 822 827 .id = D3_CONFIG_CMD, 823 - .flags = CMD_SYNC | CMD_WANT_SKB, 828 + .flags = CMD_WANT_SKB, 824 829 .data[0] = &d3_cfg_cmd_data, 825 830 .len[0] = sizeof(d3_cfg_cmd_data), 826 831 }; ··· 970 975 if (key_data.use_rsc_tsc) { 971 976 struct iwl_host_cmd rsc_tsc_cmd = { 972 977 .id = WOWLAN_TSC_RSC_PARAM, 973 - .flags = CMD_SYNC, 974 978 .data[0] = key_data.rsc_tsc, 975 979 .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 976 980 .len[0] = sizeof(*key_data.rsc_tsc), ··· 983 989 if (key_data.use_tkip) { 984 990 ret = iwl_mvm_send_cmd_pdu(mvm, 985 991 WOWLAN_TKIP_PARAM, 986 - CMD_SYNC, sizeof(tkip_cmd), 992 + 0, sizeof(tkip_cmd), 987 993 &tkip_cmd); 988 994 if (ret) 989 995 goto out; ··· 1000 1006 kek_kck_cmd.replay_ctr = mvmvif->rekey_data.replay_ctr; 1001 1007 1002 1008 ret = iwl_mvm_send_cmd_pdu(mvm, 1003 - WOWLAN_KEK_KCK_MATERIAL, 1004 - CMD_SYNC, 1009 + WOWLAN_KEK_KCK_MATERIAL, 0, 1005 1010 sizeof(kek_kck_cmd), 1006 1011 &kek_kck_cmd); 1007 1012 if (ret) ··· 1016 1023 if (ret) 1017 1024 goto out; 1018 1025 1019 - ret = iwl_mvm_send_proto_offload(mvm, vif, false, CMD_SYNC); 1026 + ret = iwl_mvm_send_proto_offload(mvm, vif, false, 0); 1020 1027 if (ret) 1021 1028 goto out; 1022 1029 ··· 1028 1035 if (ret) 1029 1036 goto out; 1030 1037 1031 - ret = iwl_mvm_power_update_mac(mvm, vif); 1038 + ret = iwl_mvm_power_update_mac(mvm); 1032 1039 if (ret) 1033 1040 goto out; 1034 1041 ··· 1459 1466 } err_info; 1460 1467 struct iwl_host_cmd cmd = { 1461 1468 .id = WOWLAN_GET_STATUSES, 1462 - .flags = CMD_SYNC | CMD_WANT_SKB, 1469 + .flags = CMD_WANT_SKB, 1463 1470 }; 1464 1471 struct iwl_wowlan_status_data status; 1465 1472 struct iwl_wowlan_status *fw_status; ··· 1485 1492 } 1486 1493 1487 1494 /* only for tracing for now */ 1488 - ret = iwl_mvm_send_cmd_pdu(mvm, OFFLOADS_QUERY_CMD, CMD_SYNC, 0, NULL); 1495 + ret = iwl_mvm_send_cmd_pdu(mvm, OFFLOADS_QUERY_CMD, 0, 0, NULL); 1489 1496 if (ret) 1490 1497 IWL_ERR(mvm, "failed to query offload statistics (%d)\n", ret); 1491 1498
+5 -43
drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
··· 175 175 176 176 mutex_lock(&mvm->mutex); 177 177 iwl_dbgfs_update_pm(mvm, vif, param, val); 178 - ret = iwl_mvm_power_update_mac(mvm, vif); 178 + ret = iwl_mvm_power_update_mac(mvm); 179 179 mutex_unlock(&mvm->mutex); 180 180 181 181 return ret ?: count; ··· 262 262 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; 263 263 264 264 pos += scnprintf(buf+pos, bufsz-pos, 265 - "ap_sta_id %d - reduced Tx power %d force %d\n", 265 + "ap_sta_id %d - reduced Tx power %d\n", 266 266 ap_sta_id, 267 - mvm_sta->bt_reduced_txpower, 268 - mvm_sta->bt_reduced_txpower_dbg); 267 + mvm_sta->bt_reduced_txpower); 269 268 } 270 269 } 271 270 ··· 280 281 mutex_unlock(&mvm->mutex); 281 282 282 283 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 283 - } 284 - 285 - static ssize_t iwl_dbgfs_reduced_txp_write(struct ieee80211_vif *vif, 286 - char *buf, size_t count, 287 - loff_t *ppos) 288 - { 289 - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 290 - struct iwl_mvm *mvm = mvmvif->mvm; 291 - struct iwl_mvm_sta *mvmsta; 292 - bool reduced_tx_power; 293 - int ret; 294 - 295 - if (mvmvif->ap_sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id)) 296 - return -ENOTCONN; 297 - 298 - if (strtobool(buf, &reduced_tx_power) != 0) 299 - return -EINVAL; 300 - 301 - mutex_lock(&mvm->mutex); 302 - 303 - mvmsta = iwl_mvm_sta_from_staid_protected(mvm, mvmvif->ap_sta_id); 304 - if (IS_ERR_OR_NULL(mvmsta)) { 305 - mutex_unlock(&mvm->mutex); 306 - return -ENOTCONN; 307 - } 308 - 309 - mvmsta->bt_reduced_txpower_dbg = false; 310 - ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, 311 - reduced_tx_power); 312 - if (!ret) 313 - mvmsta->bt_reduced_txpower_dbg = true; 314 - 315 - mutex_unlock(&mvm->mutex); 316 - 317 - return ret ? : count; 318 284 } 319 285 320 286 static void iwl_dbgfs_update_bf(struct ieee80211_vif *vif, ··· 416 452 mutex_lock(&mvm->mutex); 417 453 iwl_dbgfs_update_bf(vif, param, value); 418 454 if (param == MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER && !value) 419 - ret = iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC); 455 + ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0); 420 456 else 421 - ret = iwl_mvm_enable_beacon_filter(mvm, vif, CMD_SYNC); 457 + ret = iwl_mvm_enable_beacon_filter(mvm, vif, 0); 422 458 mutex_unlock(&mvm->mutex); 423 459 424 460 return ret ?: count; ··· 522 558 MVM_DEBUGFS_READ_WRITE_FILE_OPS(pm_params, 32); 523 559 MVM_DEBUGFS_READ_WRITE_FILE_OPS(bf_params, 256); 524 560 MVM_DEBUGFS_READ_WRITE_FILE_OPS(low_latency, 10); 525 - MVM_DEBUGFS_WRITE_FILE_OPS(reduced_txp, 10); 526 561 527 562 void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 528 563 { ··· 553 590 S_IRUSR); 554 591 555 592 MVM_DEBUGFS_ADD_FILE_VIF(mac_params, mvmvif->dbgfs_dir, S_IRUSR); 556 - MVM_DEBUGFS_ADD_FILE_VIF(reduced_txp, mvmvif->dbgfs_dir, S_IWUSR); 557 593 MVM_DEBUGFS_ADD_FILE_VIF(low_latency, mvmvif->dbgfs_dir, 558 594 S_IRUSR | S_IWUSR); 559 595
+5 -6
drivers/net/wireless/iwlwifi/mvm/debugfs.c
··· 65 65 #include "mvm.h" 66 66 #include "sta.h" 67 67 #include "iwl-io.h" 68 - #include "iwl-prph.h" 69 68 #include "debugfs.h" 70 - #include "fw-error-dump.h" 69 + #include "iwl-fw-error-dump.h" 71 70 72 71 static ssize_t iwl_dbgfs_tx_flush_write(struct iwl_mvm *mvm, char *buf, 73 72 size_t count, loff_t *ppos) ··· 680 681 mvm->restart_fw++; 681 682 682 683 /* take the return value to make compiler happy - it will fail anyway */ 683 - ret = iwl_mvm_send_cmd_pdu(mvm, REPLY_ERROR, CMD_SYNC, 0, NULL); 684 + ret = iwl_mvm_send_cmd_pdu(mvm, REPLY_ERROR, 0, 0, NULL); 684 685 685 686 mutex_unlock(&mvm->mutex); 686 687 ··· 690 691 static ssize_t iwl_dbgfs_fw_nmi_write(struct iwl_mvm *mvm, char *buf, 691 692 size_t count, loff_t *ppos) 692 693 { 693 - iwl_write_prph(mvm->trans, DEVICE_SET_NMI_REG, 1); 694 + iwl_force_nmi(mvm->trans); 694 695 695 696 return count; 696 697 } ··· 837 838 /* send updated bcast filtering configuration */ 838 839 if (mvm->dbgfs_bcast_filtering.override && 839 840 iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) 840 - err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, CMD_SYNC, 841 + err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0, 841 842 sizeof(cmd), &cmd); 842 843 mutex_unlock(&mvm->mutex); 843 844 ··· 909 910 /* send updated bcast filtering configuration */ 910 911 if (mvm->dbgfs_bcast_filtering.override && 911 912 iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) 912 - err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, CMD_SYNC, 913 + err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0, 913 914 sizeof(cmd), &cmd); 914 915 mutex_unlock(&mvm->mutex); 915 916
+26
drivers/net/wireless/iwlwifi/mvm/fw-error-dump.h drivers/net/wireless/iwlwifi/iwl-fw-error-dump.h
··· 72 72 * @IWL_FW_ERROR_DUMP_SRAM: 73 73 * @IWL_FW_ERROR_DUMP_REG: 74 74 * @IWL_FW_ERROR_DUMP_RXF: 75 + * @IWL_FW_ERROR_DUMP_TXCMD: last TX command data, structured as 76 + * &struct iwl_fw_error_dump_txcmd packets 75 77 */ 76 78 enum iwl_fw_error_dump_type { 77 79 IWL_FW_ERROR_DUMP_SRAM = 0, 78 80 IWL_FW_ERROR_DUMP_REG = 1, 79 81 IWL_FW_ERROR_DUMP_RXF = 2, 82 + IWL_FW_ERROR_DUMP_TXCMD = 3, 80 83 81 84 IWL_FW_ERROR_DUMP_MAX, 82 85 }; ··· 107 104 __le32 file_len; 108 105 u8 data[0]; 109 106 } __packed; 107 + 108 + /** 109 + * struct iwl_fw_error_dump_txcmd - TX command data 110 + * @cmdlen: original length of command 111 + * @caplen: captured length of command (may be less) 112 + * @data: captured command data, @caplen bytes 113 + */ 114 + struct iwl_fw_error_dump_txcmd { 115 + __le32 cmdlen; 116 + __le32 caplen; 117 + u8 data[]; 118 + } __packed; 119 + 120 + /** 121 + * iwl_mvm_fw_error_next_data - advance fw error dump data pointer 122 + * @data: previous data block 123 + * Returns: next data block 124 + */ 125 + static inline struct iwl_fw_error_dump_data * 126 + iwl_mvm_fw_error_next_data(struct iwl_fw_error_dump_data *data) 127 + { 128 + return (void *)(data->data + le32_to_cpu(data->len)); 129 + } 110 130 111 131 #endif /* __fw_error_dump_h__ */
+15 -4
drivers/net/wireless/iwlwifi/mvm/fw.c
··· 99 99 }; 100 100 101 101 IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant); 102 - return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, CMD_SYNC, 102 + return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, 0, 103 103 sizeof(tx_ant_cmd), &tx_ant_cmd); 104 104 } 105 105 ··· 137 137 alive_data->scd_base_addr = le32_to_cpu(palive2->scd_base_ptr); 138 138 mvm->umac_error_event_table = 139 139 le32_to_cpu(palive2->error_info_addr); 140 + mvm->sf_space.addr = le32_to_cpu(palive2->st_fwrd_addr); 141 + mvm->sf_space.size = le32_to_cpu(palive2->st_fwrd_size); 140 142 141 143 alive_data->valid = le16_to_cpu(palive2->status) == 142 144 IWL_ALIVE_STATUS_OK; ··· 182 180 int ret, i; 183 181 enum iwl_ucode_type old_type = mvm->cur_ucode; 184 182 static const u8 alive_cmd[] = { MVM_ALIVE }; 183 + struct iwl_sf_region st_fwrd_space; 185 184 186 185 fw = iwl_get_ucode_image(mvm, ucode_type); 187 186 if (WARN_ON(!fw)) ··· 217 214 mvm->cur_ucode = old_type; 218 215 return -EIO; 219 216 } 217 + 218 + /* 219 + * update the sdio allocation according to the pointer we get in the 220 + * alive notification. 221 + */ 222 + st_fwrd_space.addr = mvm->sf_space.addr; 223 + st_fwrd_space.size = mvm->sf_space.size; 224 + ret = iwl_trans_update_sf(mvm->trans, &st_fwrd_space); 220 225 221 226 iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr); 222 227 ··· 267 256 IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n", 268 257 phy_cfg_cmd.phy_cfg); 269 258 270 - return iwl_mvm_send_cmd_pdu(mvm, PHY_CONFIGURATION_CMD, CMD_SYNC, 259 + return iwl_mvm_send_cmd_pdu(mvm, PHY_CONFIGURATION_CMD, 0, 271 260 sizeof(phy_cfg_cmd), &phy_cfg_cmd); 272 261 } 273 262 ··· 306 295 /* Read the NVM only at driver load time, no need to do this twice */ 307 296 if (read_nvm) { 308 297 /* Read nvm */ 309 - ret = iwl_nvm_init(mvm); 298 + ret = iwl_nvm_init(mvm, true); 310 299 if (ret) { 311 300 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); 312 301 goto error; ··· 314 303 } 315 304 316 305 /* In case we read the NVM from external file, load it to the NIC */ 317 - if (iwlwifi_mod_params.nvm_file) 306 + if (mvm->nvm_file_name) 318 307 iwl_mvm_load_nvm_to_nic(mvm); 319 308 320 309 ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans);
+50 -64
drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
··· 685 685 static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm, 686 686 struct iwl_mac_ctx_cmd *cmd) 687 687 { 688 - int ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, CMD_SYNC, 688 + int ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, 0, 689 689 sizeof(*cmd), cmd); 690 690 if (ret) 691 691 IWL_ERR(mvm, "Failed to send MAC context (action:%d): %d\n", ··· 693 693 return ret; 694 694 } 695 695 696 - /* 697 - * Fill the specific data for mac context of type station or p2p client 698 - */ 699 - static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm, 700 - struct ieee80211_vif *vif, 701 - struct iwl_mac_data_sta *ctxt_sta, 702 - bool force_assoc_off) 696 + static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm, 697 + struct ieee80211_vif *vif, 698 + u32 action, bool force_assoc_off) 703 699 { 700 + struct iwl_mac_ctx_cmd cmd = {}; 701 + struct iwl_mac_data_sta *ctxt_sta; 702 + 703 + WARN_ON(vif->type != NL80211_IFTYPE_STATION); 704 + 705 + /* Fill the common data for all mac context types */ 706 + iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); 707 + 708 + if (vif->p2p) { 709 + struct ieee80211_p2p_noa_attr *noa = 710 + &vif->bss_conf.p2p_noa_attr; 711 + 712 + cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow & 713 + IEEE80211_P2P_OPPPS_CTWINDOW_MASK); 714 + ctxt_sta = &cmd.p2p_sta.sta; 715 + } else { 716 + ctxt_sta = &cmd.sta; 717 + } 718 + 704 719 /* We need the dtim_period to set the MAC as associated */ 705 720 if (vif->bss_conf.assoc && vif->bss_conf.dtim_period && 706 721 !force_assoc_off) { 707 722 u32 dtim_offs; 723 + 724 + /* Allow beacons to pass through as long as we are not 725 + * associated, or we do not have dtim period information. 726 + */ 727 + cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON); 708 728 709 729 /* 710 730 * The DTIM count counts down, so when it is N that means N ··· 772 752 773 753 ctxt_sta->listen_interval = cpu_to_le32(mvm->hw->conf.listen_interval); 774 754 ctxt_sta->assoc_id = cpu_to_le32(vif->bss_conf.aid); 775 - } 776 - 777 - static int iwl_mvm_mac_ctxt_cmd_station(struct iwl_mvm *mvm, 778 - struct ieee80211_vif *vif, 779 - u32 action) 780 - { 781 - struct iwl_mac_ctx_cmd cmd = {}; 782 - 783 - WARN_ON(vif->type != NL80211_IFTYPE_STATION || vif->p2p); 784 - 785 - /* Fill the common data for all mac context types */ 786 - iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); 787 - 788 - /* Allow beacons to pass through as long as we are not associated,or we 789 - * do not have dtim period information */ 790 - if (!vif->bss_conf.assoc || !vif->bss_conf.dtim_period) 791 - cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON); 792 - else 793 - cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON); 794 - 795 - /* Fill the data specific for station mode */ 796 - iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta, 797 - action == FW_CTXT_ACTION_ADD); 798 - 799 - return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); 800 - } 801 - 802 - static int iwl_mvm_mac_ctxt_cmd_p2p_client(struct iwl_mvm *mvm, 803 - struct ieee80211_vif *vif, 804 - u32 action) 805 - { 806 - struct iwl_mac_ctx_cmd cmd = {}; 807 - struct ieee80211_p2p_noa_attr *noa = &vif->bss_conf.p2p_noa_attr; 808 - 809 - WARN_ON(vif->type != NL80211_IFTYPE_STATION || !vif->p2p); 810 - 811 - /* Fill the common data for all mac context types */ 812 - iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); 813 - 814 - /* Fill the data specific for station mode */ 815 - iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta, 816 - action == FW_CTXT_ACTION_ADD); 817 - 818 - cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow & 819 - IEEE80211_P2P_OPPPS_CTWINDOW_MASK); 820 755 821 756 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); 822 757 } ··· 1109 1134 } 1110 1135 1111 1136 static int iwl_mvm_mac_ctx_send(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 1112 - u32 action) 1137 + u32 action, bool force_assoc_off) 1113 1138 { 1114 1139 switch (vif->type) { 1115 1140 case NL80211_IFTYPE_STATION: 1116 - if (!vif->p2p) 1117 - return iwl_mvm_mac_ctxt_cmd_station(mvm, vif, 1118 - action); 1119 - else 1120 - return iwl_mvm_mac_ctxt_cmd_p2p_client(mvm, vif, 1121 - action); 1141 + return iwl_mvm_mac_ctxt_cmd_sta(mvm, vif, action, 1142 + force_assoc_off); 1122 1143 break; 1123 1144 case NL80211_IFTYPE_AP: 1124 1145 if (!vif->p2p) ··· 1144 1173 vif->addr, ieee80211_vif_type_p2p(vif))) 1145 1174 return -EIO; 1146 1175 1147 - ret = iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_ADD); 1176 + ret = iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_ADD, 1177 + true); 1148 1178 if (ret) 1149 1179 return ret; 1150 1180 ··· 1156 1184 return 0; 1157 1185 } 1158 1186 1159 - int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 1187 + int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 1188 + bool force_assoc_off) 1160 1189 { 1161 1190 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 1162 1191 ··· 1165 1192 vif->addr, ieee80211_vif_type_p2p(vif))) 1166 1193 return -EIO; 1167 1194 1168 - return iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_MODIFY); 1195 + return iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_MODIFY, 1196 + force_assoc_off); 1169 1197 } 1170 1198 1171 1199 int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif) ··· 1185 1211 mvmvif->color)); 1186 1212 cmd.action = cpu_to_le32(FW_CTXT_ACTION_REMOVE); 1187 1213 1188 - ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, CMD_SYNC, 1214 + ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, 0, 1189 1215 sizeof(cmd), &cmd); 1190 1216 if (ret) { 1191 1217 IWL_ERR(mvm, "Failed to remove MAC context: %d\n", ret); ··· 1211 1237 u32 rate __maybe_unused = 1212 1238 le32_to_cpu(beacon->beacon_notify_hdr.initial_rate); 1213 1239 1240 + lockdep_assert_held(&mvm->mutex); 1241 + 1214 1242 IWL_DEBUG_RX(mvm, "beacon status %#x retries:%d tsf:0x%16llX rate:%d\n", 1215 1243 status & TX_STATUS_MSK, 1216 1244 beacon->beacon_notify_hdr.failure_frame, 1217 1245 le64_to_cpu(beacon->tsf), 1218 1246 rate); 1247 + 1248 + if (unlikely(mvm->csa_vif && mvm->csa_vif->csa_active)) { 1249 + if (!ieee80211_csa_is_complete(mvm->csa_vif)) { 1250 + iwl_mvm_mac_ctxt_beacon_changed(mvm, mvm->csa_vif); 1251 + } else { 1252 + ieee80211_csa_finish(mvm->csa_vif); 1253 + mvm->csa_vif = NULL; 1254 + } 1255 + } 1256 + 1219 1257 return 0; 1220 1258 } 1221 1259
+130 -43
drivers/net/wireless/iwlwifi/mvm/mac80211.c
··· 276 276 IEEE80211_HW_AMPDU_AGGREGATION | 277 277 IEEE80211_HW_TIMING_BEACON_ONLY | 278 278 IEEE80211_HW_CONNECTION_MONITOR | 279 - IEEE80211_HW_SUPPORTS_UAPSD | 280 279 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | 281 280 IEEE80211_HW_SUPPORTS_STATIC_SMPS; 282 281 ··· 285 286 IEEE80211_RADIOTAP_MCS_HAVE_STBC; 286 287 hw->radiotap_vht_details |= IEEE80211_RADIOTAP_VHT_KNOWN_STBC; 287 288 hw->rate_control_algorithm = "iwl-mvm-rs"; 288 - hw->uapsd_queues = IWL_UAPSD_AC_INFO; 289 - hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; 290 289 291 290 /* 292 291 * Enable 11w if advertised by firmware and software crypto ··· 295 298 !iwlwifi_mod_params.sw_crypto) 296 299 hw->flags |= IEEE80211_HW_MFP_CAPABLE; 297 300 298 - /* Disable uAPSD due to firmware issues */ 299 - if (true) 300 - hw->flags &= ~IEEE80211_HW_SUPPORTS_UAPSD; 301 + if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT && 302 + IWL_UCODE_API(mvm->fw->ucode_ver) >= 9 && 303 + !iwlwifi_mod_params.uapsd_disable) { 304 + hw->flags |= IEEE80211_HW_SUPPORTS_UAPSD; 305 + hw->uapsd_queues = IWL_UAPSD_AC_INFO; 306 + hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; 307 + } 301 308 302 309 hw->sta_data_size = sizeof(struct iwl_mvm_sta); 303 310 hw->vif_data_size = sizeof(struct iwl_mvm_vif); ··· 320 319 321 320 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_GO_UAPSD) 322 321 hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; 322 + 323 + if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_CSA_FLOW) 324 + hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; 323 325 324 326 hw->wiphy->iface_combinations = iwl_mvm_iface_combinations; 325 327 hw->wiphy->n_iface_combinations = ··· 543 539 return -EACCES; 544 540 545 541 /* return from D0i3 before starting a new Tx aggregation */ 546 - if (action == IEEE80211_AMPDU_TX_START) { 542 + switch (action) { 543 + case IEEE80211_AMPDU_TX_START: 544 + case IEEE80211_AMPDU_TX_STOP_CONT: 545 + case IEEE80211_AMPDU_TX_STOP_FLUSH: 546 + case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: 547 + case IEEE80211_AMPDU_TX_OPERATIONAL: 547 548 iwl_mvm_ref(mvm, IWL_MVM_REF_TX_AGG); 548 549 tx_agg_ref = true; 549 550 550 551 /* 551 - * wait synchronously until D0i3 exit to get the correct 552 - * sequence number for the tid 552 + * for tx start, wait synchronously until D0i3 exit to 553 + * get the correct sequence number for the tid. 554 + * additionally, some other ampdu actions use direct 555 + * target access, which is not handled automatically 556 + * by the trans layer (unlike commands), so wait for 557 + * d0i3 exit in these cases as well. 553 558 */ 554 559 if (!wait_event_timeout(mvm->d0i3_exit_waitq, 555 560 !test_bit(IWL_MVM_STATUS_IN_D0I3, &mvm->status), HZ)) { ··· 566 553 iwl_mvm_unref(mvm, IWL_MVM_REF_TX_AGG); 567 554 return -EIO; 568 555 } 556 + break; 557 + default: 558 + break; 569 559 } 570 560 571 561 mutex_lock(&mvm->mutex); ··· 773 757 .pwr_restriction = cpu_to_le16(tx_power), 774 758 }; 775 759 776 - return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, CMD_SYNC, 760 + return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, 777 761 sizeof(reduce_txpwr_cmd), 778 762 &reduce_txpwr_cmd); 779 763 } ··· 832 816 if (ret) 833 817 goto out_release; 834 818 835 - ret = iwl_mvm_power_update_mac(mvm, vif); 819 + ret = iwl_mvm_power_update_mac(mvm); 836 820 if (ret) 837 821 goto out_release; 838 822 839 823 /* beacon filtering */ 840 - ret = iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC); 824 + ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0); 841 825 if (ret) 842 826 goto out_remove_mac; 843 827 ··· 983 967 if (mvm->vif_count && vif->type != NL80211_IFTYPE_P2P_DEVICE) 984 968 mvm->vif_count--; 985 969 986 - iwl_mvm_power_update_mac(mvm, vif); 970 + iwl_mvm_power_update_mac(mvm); 987 971 iwl_mvm_mac_ctxt_remove(mvm, vif); 988 972 989 973 out_release: ··· 1244 1228 if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) 1245 1229 return 0; 1246 1230 1247 - return iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, CMD_SYNC, 1231 + return iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0, 1248 1232 sizeof(cmd), &cmd); 1249 1233 } 1250 1234 #else ··· 1271 1255 if (changes & BSS_CHANGED_ASSOC && bss_conf->assoc) 1272 1256 iwl_mvm_mac_ctxt_recalc_tsf_id(mvm, vif); 1273 1257 1274 - ret = iwl_mvm_mac_ctxt_changed(mvm, vif); 1258 + ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false); 1275 1259 if (ret) 1276 1260 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); 1277 1261 ··· 1351 1335 iwl_mvm_remove_time_event(mvm, mvmvif, 1352 1336 &mvmvif->time_event_data); 1353 1337 iwl_mvm_sf_update(mvm, vif, false); 1354 - WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, CMD_SYNC)); 1338 + WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); 1355 1339 } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | 1356 1340 BSS_CHANGED_QOS)) { 1357 - ret = iwl_mvm_power_update_mac(mvm, vif); 1341 + ret = iwl_mvm_power_update_mac(mvm); 1358 1342 if (ret) 1359 1343 IWL_ERR(mvm, "failed to update power mode\n"); 1360 1344 } ··· 1365 1349 } 1366 1350 1367 1351 if (changes & BSS_CHANGED_CQM) { 1368 - IWL_DEBUG_MAC80211(mvm, "cqm info_changed"); 1352 + IWL_DEBUG_MAC80211(mvm, "cqm info_changed\n"); 1369 1353 /* reset cqm events tracking */ 1370 1354 mvmvif->bf_data.last_cqm_event = 0; 1371 - ret = iwl_mvm_update_beacon_filter(mvm, vif, false, CMD_SYNC); 1372 - if (ret) 1373 - IWL_ERR(mvm, "failed to update CQM thresholds\n"); 1355 + if (mvmvif->bf_data.bf_enabled) { 1356 + ret = iwl_mvm_enable_beacon_filter(mvm, vif, 0); 1357 + if (ret) 1358 + IWL_ERR(mvm, 1359 + "failed to update CQM thresholds\n"); 1360 + } 1374 1361 } 1375 1362 1376 1363 if (changes & BSS_CHANGED_ARP_FILTER) { 1377 - IWL_DEBUG_MAC80211(mvm, "arp filter changed"); 1364 + IWL_DEBUG_MAC80211(mvm, "arp filter changed\n"); 1378 1365 iwl_mvm_configure_bcast_filter(mvm, vif); 1379 1366 } 1380 1367 } ··· 1423 1404 mvmvif->ap_ibss_active = true; 1424 1405 1425 1406 /* power updated needs to be done before quotas */ 1426 - iwl_mvm_power_update_mac(mvm, vif); 1407 + iwl_mvm_power_update_mac(mvm); 1427 1408 1428 1409 ret = iwl_mvm_update_quotas(mvm, vif); 1429 1410 if (ret) ··· 1431 1412 1432 1413 /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */ 1433 1414 if (vif->p2p && mvm->p2p_device_vif) 1434 - iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif); 1415 + iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false); 1435 1416 1436 1417 iwl_mvm_ref(mvm, IWL_MVM_REF_AP_IBSS); 1437 1418 ··· 1441 1422 return 0; 1442 1423 1443 1424 out_quota_failed: 1444 - iwl_mvm_power_update_mac(mvm, vif); 1425 + iwl_mvm_power_update_mac(mvm); 1445 1426 mvmvif->ap_ibss_active = false; 1446 1427 iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta); 1447 1428 out_unbind: ··· 1471 1452 1472 1453 /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */ 1473 1454 if (vif->p2p && mvm->p2p_device_vif) 1474 - iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif); 1455 + iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false); 1475 1456 1476 1457 iwl_mvm_update_quotas(mvm, NULL); 1477 1458 iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta); 1478 1459 iwl_mvm_binding_remove_vif(mvm, vif); 1479 1460 1480 - iwl_mvm_power_update_mac(mvm, vif); 1461 + iwl_mvm_power_update_mac(mvm); 1481 1462 1482 1463 iwl_mvm_mac_ctxt_remove(mvm, vif); 1483 1464 ··· 1498 1479 1499 1480 if (changes & (BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_HT | 1500 1481 BSS_CHANGED_BANDWIDTH) && 1501 - iwl_mvm_mac_ctxt_changed(mvm, vif)) 1482 + iwl_mvm_mac_ctxt_changed(mvm, vif, false)) 1502 1483 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); 1503 1484 1504 1485 /* Need to send a new beacon template to the FW */ ··· 1515 1496 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 1516 1497 1517 1498 mutex_lock(&mvm->mutex); 1499 + 1500 + if (changes & BSS_CHANGED_IDLE && !bss_conf->idle) 1501 + iwl_mvm_sched_scan_stop(mvm, true); 1518 1502 1519 1503 switch (vif->type) { 1520 1504 case NL80211_IFTYPE_STATION: ··· 1549 1527 1550 1528 switch (mvm->scan_status) { 1551 1529 case IWL_MVM_SCAN_SCHED: 1552 - ret = iwl_mvm_sched_scan_stop(mvm); 1530 + ret = iwl_mvm_sched_scan_stop(mvm, true); 1553 1531 if (ret) { 1554 1532 ret = -EBUSY; 1555 1533 goto out; ··· 1737 1715 } else if (old_state == IEEE80211_STA_ASSOC && 1738 1716 new_state == IEEE80211_STA_AUTHORIZED) { 1739 1717 /* enable beacon filtering */ 1740 - if (vif->bss_conf.dtim_period) 1741 - WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 1742 - CMD_SYNC)); 1718 + WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); 1743 1719 ret = 0; 1744 1720 } else if (old_state == IEEE80211_STA_AUTHORIZED && 1745 1721 new_state == IEEE80211_STA_ASSOC) { 1746 1722 /* disable beacon filtering */ 1747 - WARN_ON(iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC)); 1723 + WARN_ON(iwl_mvm_disable_beacon_filter(mvm, vif, 0)); 1748 1724 ret = 0; 1749 1725 } else if (old_state == IEEE80211_STA_ASSOC && 1750 1726 new_state == IEEE80211_STA_AUTH) { ··· 1799 1779 int ret; 1800 1780 1801 1781 mutex_lock(&mvm->mutex); 1802 - ret = iwl_mvm_mac_ctxt_changed(mvm, vif); 1782 + ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false); 1803 1783 mutex_unlock(&mvm->mutex); 1804 1784 return ret; 1805 1785 } ··· 1892 1872 int ret; 1893 1873 1894 1874 mutex_lock(&mvm->mutex); 1895 - ret = iwl_mvm_sched_scan_stop(mvm); 1875 + ret = iwl_mvm_sched_scan_stop(mvm, false); 1896 1876 mutex_unlock(&mvm->mutex); 1897 1877 iwl_mvm_wait_for_async_handlers(mvm); 1898 1878 ··· 2188 2168 return; 2189 2169 2190 2170 mutex_lock(&mvm->mutex); 2171 + iwl_mvm_bt_coex_vif_change(mvm); 2191 2172 iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->min_def, 2192 2173 ctx->rx_chains_static, 2193 2174 ctx->rx_chains_dynamic); 2194 - iwl_mvm_bt_coex_vif_change(mvm); 2195 2175 mutex_unlock(&mvm->mutex); 2196 2176 } 2197 2177 ··· 2211 2191 2212 2192 switch (vif->type) { 2213 2193 case NL80211_IFTYPE_AP: 2194 + /* Unless it's a CSA flow we have nothing to do here */ 2195 + if (vif->csa_active) { 2196 + mvmvif->ap_ibss_active = true; 2197 + break; 2198 + } 2214 2199 case NL80211_IFTYPE_ADHOC: 2215 2200 /* 2216 2201 * The AP binding flow is handled as part of the start_ap flow ··· 2239 2214 * Power state must be updated before quotas, 2240 2215 * otherwise fw will complain. 2241 2216 */ 2242 - iwl_mvm_power_update_mac(mvm, vif); 2217 + iwl_mvm_power_update_mac(mvm); 2243 2218 2244 2219 /* Setting the quota at this stage is only required for monitor 2245 2220 * interfaces. For the other types, the bss_info changed flow ··· 2252 2227 goto out_remove_binding; 2253 2228 } 2254 2229 2230 + /* Handle binding during CSA */ 2231 + if (vif->type == NL80211_IFTYPE_AP) { 2232 + iwl_mvm_update_quotas(mvm, vif); 2233 + iwl_mvm_mac_ctxt_changed(mvm, vif, false); 2234 + } 2235 + 2255 2236 goto out_unlock; 2256 2237 2257 2238 out_remove_binding: 2258 2239 iwl_mvm_binding_remove_vif(mvm, vif); 2259 - iwl_mvm_power_update_mac(mvm, vif); 2240 + iwl_mvm_power_update_mac(mvm); 2260 2241 out_unlock: 2261 2242 mutex_unlock(&mvm->mutex); 2262 2243 if (ret) ··· 2282 2251 iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data); 2283 2252 2284 2253 switch (vif->type) { 2285 - case NL80211_IFTYPE_AP: 2286 2254 case NL80211_IFTYPE_ADHOC: 2287 2255 goto out_unlock; 2288 2256 case NL80211_IFTYPE_MONITOR: 2289 2257 mvmvif->monitor_active = false; 2290 2258 iwl_mvm_update_quotas(mvm, NULL); 2291 2259 break; 2260 + case NL80211_IFTYPE_AP: 2261 + /* This part is triggered only during CSA */ 2262 + if (!vif->csa_active || !mvmvif->ap_ibss_active) 2263 + goto out_unlock; 2264 + 2265 + mvmvif->ap_ibss_active = false; 2266 + iwl_mvm_update_quotas(mvm, NULL); 2267 + /*TODO: bt_coex notification here? */ 2292 2268 default: 2293 2269 break; 2294 2270 } 2295 2271 2296 2272 iwl_mvm_binding_remove_vif(mvm, vif); 2297 - iwl_mvm_power_update_mac(mvm, vif); 2298 2273 2299 2274 out_unlock: 2300 2275 mvmvif->phy_ctxt = NULL; 2276 + iwl_mvm_power_update_mac(mvm); 2301 2277 mutex_unlock(&mvm->mutex); 2302 2278 } 2303 2279 ··· 2368 2330 return -EINVAL; 2369 2331 2370 2332 if (nla_get_u32(tb[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE])) 2371 - return iwl_mvm_enable_beacon_filter(mvm, vif, 2372 - CMD_SYNC); 2373 - return iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC); 2333 + return iwl_mvm_enable_beacon_filter(mvm, vif, 0); 2334 + return iwl_mvm_disable_beacon_filter(mvm, vif, 0); 2374 2335 } 2375 2336 2376 2337 return -EOPNOTSUPP; ··· 2389 2352 return err; 2390 2353 } 2391 2354 #endif 2355 + 2356 + static void iwl_mvm_channel_switch_beacon(struct ieee80211_hw *hw, 2357 + struct ieee80211_vif *vif, 2358 + struct cfg80211_chan_def *chandef) 2359 + { 2360 + struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 2361 + 2362 + mutex_lock(&mvm->mutex); 2363 + if (WARN(mvm->csa_vif && mvm->csa_vif->csa_active, 2364 + "Another CSA is already in progress")) 2365 + goto out_unlock; 2366 + 2367 + IWL_DEBUG_MAC80211(mvm, "CSA started to freq %d\n", 2368 + chandef->center_freq1); 2369 + mvm->csa_vif = vif; 2370 + 2371 + out_unlock: 2372 + mutex_unlock(&mvm->mutex); 2373 + } 2374 + 2375 + static void iwl_mvm_mac_flush(struct ieee80211_hw *hw, 2376 + struct ieee80211_vif *vif, u32 queues, bool drop) 2377 + { 2378 + struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 2379 + struct iwl_mvm_vif *mvmvif; 2380 + struct iwl_mvm_sta *mvmsta; 2381 + 2382 + if (!vif || vif->type != NL80211_IFTYPE_STATION) 2383 + return; 2384 + 2385 + mutex_lock(&mvm->mutex); 2386 + mvmvif = iwl_mvm_vif_from_mac80211(vif); 2387 + mvmsta = iwl_mvm_sta_from_staid_protected(mvm, mvmvif->ap_sta_id); 2388 + 2389 + if (WARN_ON_ONCE(!mvmsta)) 2390 + goto done; 2391 + 2392 + if (drop) { 2393 + if (iwl_mvm_flush_tx_path(mvm, mvmsta->tfd_queue_msk, true)) 2394 + IWL_ERR(mvm, "flush request fail\n"); 2395 + } else { 2396 + iwl_trans_wait_tx_queue_empty(mvm->trans, 2397 + mvmsta->tfd_queue_msk); 2398 + } 2399 + done: 2400 + mutex_unlock(&mvm->mutex); 2401 + } 2392 2402 2393 2403 const struct ieee80211_ops iwl_mvm_hw_ops = { 2394 2404 .tx = iwl_mvm_mac_tx, ··· 2460 2376 .sta_rc_update = iwl_mvm_sta_rc_update, 2461 2377 .conf_tx = iwl_mvm_mac_conf_tx, 2462 2378 .mgd_prepare_tx = iwl_mvm_mac_mgd_prepare_tx, 2379 + .flush = iwl_mvm_mac_flush, 2463 2380 .sched_scan_start = iwl_mvm_mac_sched_scan_start, 2464 2381 .sched_scan_stop = iwl_mvm_mac_sched_scan_stop, 2465 2382 .set_key = iwl_mvm_mac_set_key, ··· 2479 2394 .leave_ibss = iwl_mvm_stop_ap_ibss, 2480 2395 2481 2396 .set_tim = iwl_mvm_set_tim, 2397 + 2398 + .channel_switch_beacon = iwl_mvm_channel_switch_beacon, 2482 2399 2483 2400 CFG80211_TESTMODE_CMD(iwl_mvm_mac_testmode_cmd) 2484 2401
+22 -12
drivers/net/wireless/iwlwifi/mvm/mvm.h
··· 490 490 u32 log_event_table; 491 491 u32 umac_error_event_table; 492 492 bool support_umac_log; 493 + struct iwl_sf_region sf_space; 493 494 494 495 u32 ampdu_ref; 495 496 ··· 502 501 u8 queue_to_mac80211[IWL_MAX_HW_QUEUES]; 503 502 atomic_t queue_stop_count[IWL_MAX_HW_QUEUES]; 504 503 504 + const char *nvm_file_name; 505 505 struct iwl_nvm_data *nvm_data; 506 506 /* NVM sections */ 507 507 struct iwl_nvm_section nvm_sections[NVM_MAX_NUM_SECTIONS]; ··· 591 589 u32 *fw_error_rxf; 592 590 u32 fw_error_rxf_len; 593 591 592 + #ifdef CONFIG_IWLWIFI_LEDS 594 593 struct led_classdev led; 594 + #endif 595 595 596 596 struct ieee80211_vif *p2p_device_vif; 597 597 ··· 646 642 647 643 /* Indicate if device power save is allowed */ 648 644 bool ps_disabled; 645 + 646 + struct ieee80211_vif *csa_vif; 649 647 }; 650 648 651 649 /* Extract MVM priv from op_mode and _hw */ ··· 763 757 struct iwl_device_cmd *cmd); 764 758 765 759 /* NVM */ 766 - int iwl_nvm_init(struct iwl_mvm *mvm); 760 + int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic); 767 761 int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm); 768 762 769 763 int iwl_mvm_up(struct iwl_mvm *mvm); ··· 814 808 int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 815 809 void iwl_mvm_mac_ctxt_release(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 816 810 int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 817 - int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 811 + int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 812 + bool force_assoc_off); 818 813 int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 819 814 u32 iwl_mvm_mac_get_queues_mask(struct iwl_mvm *mvm, 820 815 struct ieee80211_vif *vif); ··· 859 852 struct cfg80211_sched_scan_request *req); 860 853 int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, 861 854 struct cfg80211_sched_scan_request *req); 862 - int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm); 855 + int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm, bool notify); 863 856 int iwl_mvm_rx_sched_scan_results(struct iwl_mvm *mvm, 864 857 struct iwl_rx_cmd_buffer *rxb, 865 858 struct iwl_device_cmd *cmd); ··· 894 887 895 888 /* power management */ 896 889 int iwl_mvm_power_update_device(struct iwl_mvm *mvm); 897 - int iwl_mvm_power_update_mac(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 890 + int iwl_mvm_power_update_mac(struct iwl_mvm *mvm); 898 891 int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 899 892 char *buf, int bufsz); 900 893 ··· 903 896 struct iwl_rx_cmd_buffer *rxb, 904 897 struct iwl_device_cmd *cmd); 905 898 899 + #ifdef CONFIG_IWLWIFI_LEDS 906 900 int iwl_mvm_leds_init(struct iwl_mvm *mvm); 907 901 void iwl_mvm_leds_exit(struct iwl_mvm *mvm); 902 + #else 903 + static inline int iwl_mvm_leds_init(struct iwl_mvm *mvm) 904 + { 905 + return 0; 906 + } 907 + static inline void iwl_mvm_leds_exit(struct iwl_mvm *mvm) 908 + { 909 + } 910 + #endif 908 911 909 912 /* D3 (WoWLAN, NetDetect) */ 910 913 int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); ··· 967 950 enum ieee80211_band band); 968 951 u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, 969 952 struct ieee80211_tx_info *info, u8 ac); 970 - int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, bool enable); 971 953 972 954 enum iwl_bt_kill_msk { 973 955 BT_KILL_MSK_DEFAULT, ··· 997 981 int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm, 998 982 struct ieee80211_vif *vif, 999 983 u32 flags); 1000 - int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm, 1001 - struct ieee80211_vif *vif, bool enable); 1002 - int iwl_mvm_update_beacon_filter(struct iwl_mvm *mvm, 1003 - struct ieee80211_vif *vif, 1004 - bool force, 1005 - u32 flags); 1006 - 1007 984 /* SMPS */ 1008 985 void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 1009 986 enum iwl_mvm_smps_type_request req_type, 1010 987 enum ieee80211_smps_mode smps_request); 988 + bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm); 1011 989 1012 990 /* Low latency */ 1013 991 int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+56 -46
drivers/net/wireless/iwlwifi/mvm/nvm.c
··· 74 74 #define NVM_WRITE_OPCODE 1 75 75 #define NVM_READ_OPCODE 0 76 76 77 + /* load nvm chunk response */ 78 + enum { 79 + READ_NVM_CHUNK_SUCCEED = 0, 80 + READ_NVM_CHUNK_NOT_VALID_ADDRESS = 1 81 + }; 82 + 77 83 /* 78 84 * prepare the NVM host command w/ the pointers to the nvm buffer 79 85 * and send it to fw ··· 96 90 struct iwl_host_cmd cmd = { 97 91 .id = NVM_ACCESS_CMD, 98 92 .len = { sizeof(struct iwl_nvm_access_cmd), length }, 99 - .flags = CMD_SYNC | CMD_SEND_IN_RFKILL, 93 + .flags = CMD_SEND_IN_RFKILL, 100 94 .data = { &nvm_access_cmd, data }, 101 95 /* data may come from vmalloc, so use _DUP */ 102 96 .dataflags = { 0, IWL_HCMD_DFL_DUP }, ··· 118 112 struct iwl_rx_packet *pkt; 119 113 struct iwl_host_cmd cmd = { 120 114 .id = NVM_ACCESS_CMD, 121 - .flags = CMD_SYNC | CMD_WANT_SKB | CMD_SEND_IN_RFKILL, 115 + .flags = CMD_WANT_SKB | CMD_SEND_IN_RFKILL, 122 116 .data = { &nvm_access_cmd, }, 123 117 }; 124 118 int ret, bytes_read, offset_read; ··· 145 139 offset_read = le16_to_cpu(nvm_resp->offset); 146 140 resp_data = nvm_resp->data; 147 141 if (ret) { 148 - IWL_ERR(mvm, 149 - "NVM access command failed with status %d (device: %s)\n", 150 - ret, mvm->cfg->name); 151 - ret = -EINVAL; 142 + if ((offset != 0) && 143 + (ret == READ_NVM_CHUNK_NOT_VALID_ADDRESS)) { 144 + /* 145 + * meaning of NOT_VALID_ADDRESS: 146 + * driver try to read chunk from address that is 147 + * multiple of 2K and got an error since addr is empty. 148 + * meaning of (offset != 0): driver already 149 + * read valid data from another chunk so this case 150 + * is not an error. 151 + */ 152 + IWL_DEBUG_EEPROM(mvm->trans->dev, 153 + "NVM access command failed on offset 0x%x since that section size is multiple 2K\n", 154 + offset); 155 + ret = 0; 156 + } else { 157 + IWL_DEBUG_EEPROM(mvm->trans->dev, 158 + "NVM access command failed with status %d (device: %s)\n", 159 + ret, mvm->cfg->name); 160 + ret = -EIO; 161 + } 152 162 goto exit; 153 163 } 154 164 ··· 233 211 while (ret == length) { 234 212 ret = iwl_nvm_read_chunk(mvm, section, offset, length, data); 235 213 if (ret < 0) { 236 - IWL_ERR(mvm, 237 - "Cannot read NVM from section %d offset %d, length %d\n", 238 - section, offset, length); 214 + IWL_DEBUG_EEPROM(mvm->trans->dev, 215 + "Cannot read NVM from section %d offset %d, length %d\n", 216 + section, offset, length); 239 217 return ret; 240 218 } 241 219 offset += ret; ··· 260 238 return NULL; 261 239 } 262 240 } else { 241 + /* SW and REGULATORY sections are mandatory */ 263 242 if (!mvm->nvm_sections[NVM_SECTION_TYPE_SW].data || 264 - !mvm->nvm_sections[NVM_SECTION_TYPE_MAC_OVERRIDE].data || 265 243 !mvm->nvm_sections[NVM_SECTION_TYPE_REGULATORY].data) { 266 244 IWL_ERR(mvm, 267 245 "Can't parse empty family 8000 NVM sections\n"); 246 + return NULL; 247 + } 248 + /* MAC_OVERRIDE or at least HW section must exist */ 249 + if (!mvm->nvm_sections[mvm->cfg->nvm_hw_section_num].data && 250 + !mvm->nvm_sections[NVM_SECTION_TYPE_MAC_OVERRIDE].data) { 251 + IWL_ERR(mvm, 252 + "Can't parse mac_address, empty sections\n"); 268 253 return NULL; 269 254 } 270 255 } ··· 340 311 * get here after that we assume the NVM request can be satisfied 341 312 * synchronously. 342 313 */ 343 - ret = request_firmware(&fw_entry, iwlwifi_mod_params.nvm_file, 314 + ret = request_firmware(&fw_entry, mvm->nvm_file_name, 344 315 mvm->trans->dev); 345 316 if (ret) { 346 317 IWL_ERR(mvm, "ERROR: %s isn't available %d\n", 347 - iwlwifi_mod_params.nvm_file, ret); 318 + mvm->nvm_file_name, ret); 348 319 return ret; 349 320 } 350 321 351 322 IWL_INFO(mvm, "Loaded NVM file %s (%zu bytes)\n", 352 - iwlwifi_mod_params.nvm_file, fw_entry->size); 323 + mvm->nvm_file_name, fw_entry->size); 353 324 354 325 if (fw_entry->size < sizeof(*file_sec)) { 355 326 IWL_ERR(mvm, "NVM file too small\n"); ··· 456 427 return ret; 457 428 } 458 429 459 - int iwl_nvm_init(struct iwl_mvm *mvm) 430 + int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic) 460 431 { 461 - int ret, i, section; 432 + int ret, section; 462 433 u8 *nvm_buffer, *temp; 463 - int nvm_to_read[NVM_MAX_NUM_SECTIONS]; 464 - int num_of_sections_to_read; 465 434 466 435 if (WARN_ON_ONCE(mvm->cfg->nvm_hw_section_num >= NVM_MAX_NUM_SECTIONS)) 467 436 return -EINVAL; 468 437 469 - /* load external NVM if configured */ 470 - if (iwlwifi_mod_params.nvm_file) { 471 - /* move to External NVM flow */ 472 - ret = iwl_mvm_read_external_nvm(mvm); 473 - if (ret) 474 - return ret; 475 - } else { 476 - /* list of NVM sections we are allowed/need to read */ 477 - if (mvm->trans->cfg->device_family != IWL_DEVICE_FAMILY_8000) { 478 - nvm_to_read[0] = mvm->cfg->nvm_hw_section_num; 479 - nvm_to_read[1] = NVM_SECTION_TYPE_SW; 480 - nvm_to_read[2] = NVM_SECTION_TYPE_CALIBRATION; 481 - nvm_to_read[3] = NVM_SECTION_TYPE_PRODUCTION; 482 - num_of_sections_to_read = 4; 483 - } else { 484 - nvm_to_read[0] = NVM_SECTION_TYPE_SW; 485 - nvm_to_read[1] = NVM_SECTION_TYPE_CALIBRATION; 486 - nvm_to_read[2] = NVM_SECTION_TYPE_PRODUCTION; 487 - nvm_to_read[3] = NVM_SECTION_TYPE_REGULATORY; 488 - nvm_to_read[4] = NVM_SECTION_TYPE_MAC_OVERRIDE; 489 - num_of_sections_to_read = 5; 490 - } 491 - 438 + /* load NVM values from nic */ 439 + if (read_nvm_from_nic) { 492 440 /* Read From FW NVM */ 493 441 IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from NVM\n"); 494 442 495 - /* TODO: find correct NVM max size for a section */ 496 443 nvm_buffer = kmalloc(mvm->cfg->base_params->eeprom_size, 497 444 GFP_KERNEL); 498 445 if (!nvm_buffer) 499 446 return -ENOMEM; 500 - for (i = 0; i < num_of_sections_to_read; i++) { 501 - section = nvm_to_read[i]; 447 + for (section = 0; section < NVM_MAX_NUM_SECTIONS; section++) { 502 448 /* we override the constness for initial read */ 503 449 ret = iwl_nvm_read_section(mvm, section, nvm_buffer); 504 450 if (ret < 0) 505 - break; 451 + continue; 506 452 temp = kmemdup(nvm_buffer, ret, GFP_KERNEL); 507 453 if (!temp) { 508 454 ret = -ENOMEM; ··· 506 502 mvm->nvm_hw_blob.size = ret; 507 503 break; 508 504 } 509 - WARN(1, "section: %d", section); 510 505 } 511 506 #endif 512 507 } 513 508 kfree(nvm_buffer); 514 - if (ret < 0) 509 + } 510 + 511 + /* load external NVM if configured */ 512 + if (mvm->nvm_file_name) { 513 + /* move to External NVM flow */ 514 + ret = iwl_mvm_read_external_nvm(mvm); 515 + if (ret) 515 516 return ret; 516 517 } 517 518 519 + /* parse the relevant nvm sections */ 518 520 mvm->nvm_data = iwl_parse_nvm_sections(mvm); 519 521 if (!mvm->nvm_data) 520 522 return -ENODATA;
+34 -9
drivers/net/wireless/iwlwifi/mvm/ops.c
··· 79 79 #include "iwl-prph.h" 80 80 #include "rs.h" 81 81 #include "fw-api-scan.h" 82 - #include "fw-error-dump.h" 83 82 #include "time-event.h" 83 + #include "iwl-fw-error-dump.h" 84 84 85 85 /* 86 86 * module name, copyright, version, etc. ··· 220 220 RX_HANDLER(BA_NOTIF, iwl_mvm_rx_ba_notif, false), 221 221 222 222 RX_HANDLER(BT_PROFILE_NOTIFICATION, iwl_mvm_rx_bt_coex_notif, true), 223 - RX_HANDLER(BEACON_NOTIFICATION, iwl_mvm_rx_beacon_notif, false), 223 + RX_HANDLER(BEACON_NOTIFICATION, iwl_mvm_rx_beacon_notif, true), 224 224 RX_HANDLER(STATISTICS_NOTIFICATION, iwl_mvm_rx_statistics, true), 225 225 RX_HANDLER(ANTENNA_COUPLING_NOTIFICATION, 226 226 iwl_mvm_rx_ant_coupling_notif, true), ··· 466 466 467 467 min_backoff = calc_min_backoff(trans, cfg); 468 468 iwl_mvm_tt_initialize(mvm, min_backoff); 469 + /* set the nvm_file_name according to priority */ 470 + if (iwlwifi_mod_params.nvm_file) 471 + mvm->nvm_file_name = iwlwifi_mod_params.nvm_file; 472 + else 473 + mvm->nvm_file_name = mvm->cfg->default_nvm_file; 474 + 475 + if (WARN(cfg->no_power_up_nic_in_init && !mvm->nvm_file_name, 476 + "not allowing power-up and not having nvm_file\n")) 477 + goto out_free; 469 478 470 479 /* 471 - * If the NVM exists in an external file, 472 - * there is no need to unnecessarily power up the NIC at driver load 480 + * Even if nvm exists in the nvm_file driver should read agin the nvm 481 + * from the nic because there might be entries that exist in the OTP 482 + * and not in the file. 483 + * for nics with no_power_up_nic_in_init: rely completley on nvm_file 473 484 */ 474 - if (iwlwifi_mod_params.nvm_file) { 475 - err = iwl_nvm_init(mvm); 485 + if (cfg->no_power_up_nic_in_init && mvm->nvm_file_name) { 486 + err = iwl_nvm_init(mvm, false); 476 487 if (err) 477 488 goto out_free; 478 489 } else { ··· 530 519 out_free: 531 520 iwl_phy_db_free(mvm->phy_db); 532 521 kfree(mvm->scan_cmd); 533 - if (!iwlwifi_mod_params.nvm_file) 522 + if (!cfg->no_power_up_nic_in_init || !mvm->nvm_file_name) 534 523 iwl_trans_op_mode_leave(trans); 535 524 ieee80211_free_hw(mvm->hw); 536 525 return NULL; ··· 827 816 struct iwl_fw_error_dump_file *dump_file; 828 817 struct iwl_fw_error_dump_data *dump_data; 829 818 u32 file_len; 819 + u32 trans_len; 830 820 831 821 lockdep_assert_held(&mvm->mutex); 832 822 ··· 838 826 mvm->fw_error_rxf_len + 839 827 sizeof(*dump_file) + 840 828 sizeof(*dump_data) * 2; 829 + 830 + trans_len = iwl_trans_dump_data(mvm->trans, NULL, 0); 831 + if (trans_len) 832 + file_len += trans_len; 841 833 842 834 dump_file = vmalloc(file_len); 843 835 if (!dump_file) ··· 856 840 dump_data->len = cpu_to_le32(mvm->fw_error_rxf_len); 857 841 memcpy(dump_data->data, mvm->fw_error_rxf, mvm->fw_error_rxf_len); 858 842 859 - dump_data = (void *)((u8 *)dump_data->data + mvm->fw_error_rxf_len); 843 + dump_data = iwl_mvm_fw_error_next_data(dump_data); 860 844 dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_SRAM); 861 845 dump_data->len = cpu_to_le32(mvm->fw_error_sram_len); 862 846 ··· 874 858 kfree(mvm->fw_error_sram); 875 859 mvm->fw_error_sram = NULL; 876 860 mvm->fw_error_sram_len = 0; 861 + 862 + if (trans_len) { 863 + void *buf = iwl_mvm_fw_error_next_data(dump_data); 864 + u32 real_trans_len = iwl_trans_dump_data(mvm->trans, buf, 865 + trans_len); 866 + dump_data = (void *)((u8 *)buf + real_trans_len); 867 + dump_file->file_len = 868 + cpu_to_le32(file_len - trans_len + real_trans_len); 869 + } 877 870 } 878 871 #endif 879 872 ··· 1168 1143 struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, d0i3_exit_work); 1169 1144 struct iwl_host_cmd get_status_cmd = { 1170 1145 .id = WOWLAN_GET_STATUSES, 1171 - .flags = CMD_SYNC | CMD_HIGH_PRIO | CMD_WANT_SKB, 1146 + .flags = CMD_HIGH_PRIO | CMD_WANT_SKB, 1172 1147 }; 1173 1148 struct iwl_wowlan_status *status; 1174 1149 int ret;
+16 -7
drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c
··· 156 156 idle_cnt = chains_static; 157 157 active_cnt = chains_dynamic; 158 158 159 + /* In scenarios where we only ever use a single-stream rates, 160 + * i.e. legacy 11b/g/a associations, single-stream APs or even 161 + * static SMPS, enable both chains to get diversity, improving 162 + * the case where we're far enough from the AP that attenuation 163 + * between the two antennas is sufficiently different to impact 164 + * performance. 165 + */ 166 + if (active_cnt == 1 && iwl_mvm_rx_diversity_allowed(mvm)) { 167 + idle_cnt = 2; 168 + active_cnt = 2; 169 + } 170 + 159 171 cmd->rxchain_info = cpu_to_le32(mvm->fw->valid_rx_ant << 160 172 PHY_RX_CHAIN_VALID_POS); 161 173 cmd->rxchain_info |= cpu_to_le32(idle_cnt << PHY_RX_CHAIN_CNT_POS); ··· 199 187 iwl_mvm_phy_ctxt_cmd_data(mvm, &cmd, chandef, 200 188 chains_static, chains_dynamic); 201 189 202 - ret = iwl_mvm_send_cmd_pdu(mvm, PHY_CONTEXT_CMD, CMD_SYNC, 190 + ret = iwl_mvm_send_cmd_pdu(mvm, PHY_CONTEXT_CMD, 0, 203 191 sizeof(struct iwl_phy_context_cmd), 204 192 &cmd); 205 193 if (ret) ··· 214 202 struct cfg80211_chan_def *chandef, 215 203 u8 chains_static, u8 chains_dynamic) 216 204 { 217 - int ret; 218 - 219 205 WARN_ON(!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && 220 206 ctxt->ref); 221 207 lockdep_assert_held(&mvm->mutex); 222 208 223 209 ctxt->channel = chandef->chan; 224 - ret = iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, 225 - chains_static, chains_dynamic, 226 - FW_CTXT_ACTION_ADD, 0); 227 210 228 - return ret; 211 + return iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, 212 + chains_static, chains_dynamic, 213 + FW_CTXT_ACTION_ADD, 0); 229 214 } 230 215 231 216 /*
+109 -99
drivers/net/wireless/iwlwifi/mvm/power.c
··· 123 123 cmd->ba_enable_beacon_abort = cpu_to_le32(mvmvif->bf_data.ba_enabled); 124 124 } 125 125 126 - int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm, 127 - struct ieee80211_vif *vif, bool enable) 128 - { 129 - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 130 - struct iwl_beacon_filter_cmd cmd = { 131 - IWL_BF_CMD_CONFIG_DEFAULTS, 132 - .bf_enable_beacon_filter = cpu_to_le32(1), 133 - .ba_enable_beacon_abort = cpu_to_le32(enable), 134 - }; 135 - 136 - if (!mvmvif->bf_data.bf_enabled) 137 - return 0; 138 - 139 - if (mvm->cur_ucode == IWL_UCODE_WOWLAN) 140 - cmd.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_D3); 141 - 142 - mvmvif->bf_data.ba_enabled = enable; 143 - iwl_mvm_beacon_filter_set_cqm_params(mvm, vif, &cmd); 144 - iwl_mvm_beacon_filter_debugfs_parameters(vif, &cmd); 145 - return iwl_mvm_beacon_filter_send_cmd(mvm, &cmd, CMD_SYNC); 146 - } 147 - 148 126 static void iwl_mvm_power_log(struct iwl_mvm *mvm, 149 127 struct iwl_mac_power_cmd *cmd) 150 128 { ··· 246 268 IWL_MVM_PS_HEAVY_RX_THLD_PERCENT; 247 269 } 248 270 271 + static void iwl_mvm_binding_iterator(void *_data, u8 *mac, 272 + struct ieee80211_vif *vif) 273 + { 274 + unsigned long *data = _data; 275 + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 276 + 277 + if (!mvmvif->phy_ctxt) 278 + return; 279 + 280 + if (vif->type == NL80211_IFTYPE_STATION || 281 + vif->type == NL80211_IFTYPE_AP) 282 + __set_bit(mvmvif->phy_ctxt->id, data); 283 + } 284 + 249 285 static bool iwl_mvm_power_allow_uapsd(struct iwl_mvm *mvm, 250 286 struct ieee80211_vif *vif) 251 287 { 252 288 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 289 + unsigned long phy_ctxt_counter = 0; 290 + 291 + ieee80211_iterate_active_interfaces_atomic(mvm->hw, 292 + IEEE80211_IFACE_ITER_NORMAL, 293 + iwl_mvm_binding_iterator, 294 + &phy_ctxt_counter); 253 295 254 296 if (!memcmp(mvmvif->uapsd_misbehaving_bssid, vif->bss_conf.bssid, 255 297 ETH_ALEN)) ··· 285 287 if (vif->p2p && 286 288 (vif->bss_conf.p2p_noa_attr.oppps_ctwindow & 287 289 IEEE80211_P2P_OPPPS_ENABLE_BIT)) 290 + return false; 291 + 292 + /* 293 + * Avoid using uAPSD if client is in DCM - 294 + * low latency issue in Miracast 295 + */ 296 + if (hweight8(phy_ctxt_counter) >= 2) 288 297 return false; 289 298 290 299 return true; ··· 434 429 memcpy(&iwl_mvm_vif_from_mac80211(vif)->mac_pwr_cmd, &cmd, sizeof(cmd)); 435 430 #endif 436 431 437 - return iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, CMD_SYNC, 432 + return iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, 0, 438 433 sizeof(cmd), &cmd); 439 434 } 440 435 ··· 460 455 "Sending device power command with flags = 0x%X\n", 461 456 cmd.flags); 462 457 463 - return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_SYNC, sizeof(cmd), 458 + return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, 0, sizeof(cmd), 464 459 &cmd); 465 460 } 466 461 ··· 618 613 ap_same_channel = (bss_mvmvif->phy_ctxt->id == 619 614 ap_mvmvif->phy_ctxt->id); 620 615 621 - /* bss is not stand alone: enable PM if alone on its channel */ 622 - if (vifs->bss_active && !(client_same_channel || ap_same_channel) && 616 + /* clients are not stand alone: enable PM if DCM */ 617 + if (!(client_same_channel || ap_same_channel) && 623 618 (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM)) { 619 + if (vifs->bss_active) 624 620 bss_mvmvif->pm_enabled = true; 625 - return; 621 + if (vifs->p2p_active && 622 + (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PM)) 623 + p2p_mvmvif->pm_enabled = true; 624 + return; 626 625 } 627 626 628 627 /* ··· 640 631 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PM) 641 632 p2p_mvmvif->pm_enabled = true; 642 633 } 643 - } 644 - 645 - int iwl_mvm_power_update_mac(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 646 - { 647 - struct iwl_mvm_vif *mvmvif; 648 - struct iwl_power_vifs vifs = {}; 649 - bool ba_enable; 650 - int ret; 651 - 652 - lockdep_assert_held(&mvm->mutex); 653 - 654 - iwl_mvm_power_set_pm(mvm, &vifs); 655 - 656 - /* disable PS if CAM */ 657 - if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM) { 658 - mvm->ps_disabled = true; 659 - } else { 660 - /* don't update device power state unless we add / remove monitor */ 661 - if (vifs.monitor_vif) { 662 - if (vifs.monitor_active) 663 - mvm->ps_disabled = true; 664 - ret = iwl_mvm_power_update_device(mvm); 665 - if (ret) 666 - return ret; 667 - } 668 - } 669 - 670 - if (vifs.bss_vif) { 671 - ret = iwl_mvm_power_send_cmd(mvm, vifs.bss_vif); 672 - if (ret) 673 - return ret; 674 - } 675 - 676 - if (vifs.p2p_vif) { 677 - ret = iwl_mvm_power_send_cmd(mvm, vifs.p2p_vif); 678 - if (ret) 679 - return ret; 680 - } 681 - 682 - if (!vifs.bf_vif) 683 - return 0; 684 - 685 - vif = vifs.bf_vif; 686 - mvmvif = iwl_mvm_vif_from_mac80211(vif); 687 - 688 - ba_enable = !(!mvmvif->pm_enabled || mvm->ps_disabled || 689 - !vif->bss_conf.ps || iwl_mvm_vif_low_latency(mvmvif)); 690 - 691 - return iwl_mvm_update_beacon_abort(mvm, vifs.bf_vif, ba_enable); 692 634 } 693 635 694 636 #ifdef CONFIG_IWLWIFI_DEBUGFS ··· 761 801 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 762 802 int ret; 763 803 764 - if (mvmvif != mvm->bf_allowed_vif || 804 + if (mvmvif != mvm->bf_allowed_vif || !vif->bss_conf.dtim_period || 765 805 vif->type != NL80211_IFTYPE_STATION || vif->p2p) 766 806 return 0; 767 807 ··· 789 829 return _iwl_mvm_enable_beacon_filter(mvm, vif, &cmd, flags, false); 790 830 } 791 831 832 + static int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm, 833 + struct ieee80211_vif *vif, 834 + bool enable) 835 + { 836 + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 837 + struct iwl_beacon_filter_cmd cmd = { 838 + IWL_BF_CMD_CONFIG_DEFAULTS, 839 + .bf_enable_beacon_filter = cpu_to_le32(1), 840 + }; 841 + 842 + if (!mvmvif->bf_data.bf_enabled) 843 + return 0; 844 + 845 + if (mvm->cur_ucode == IWL_UCODE_WOWLAN) 846 + cmd.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_D3); 847 + 848 + mvmvif->bf_data.ba_enabled = enable; 849 + return _iwl_mvm_enable_beacon_filter(mvm, vif, &cmd, 0, false); 850 + } 851 + 792 852 int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm, 793 853 struct ieee80211_vif *vif, 794 854 u32 flags) ··· 826 846 mvmvif->bf_data.bf_enabled = false; 827 847 828 848 return ret; 849 + } 850 + 851 + int iwl_mvm_power_update_mac(struct iwl_mvm *mvm) 852 + { 853 + struct iwl_mvm_vif *mvmvif; 854 + struct iwl_power_vifs vifs = {}; 855 + bool ba_enable; 856 + int ret; 857 + 858 + lockdep_assert_held(&mvm->mutex); 859 + 860 + iwl_mvm_power_set_pm(mvm, &vifs); 861 + 862 + /* disable PS if CAM */ 863 + if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM) { 864 + mvm->ps_disabled = true; 865 + } else { 866 + /* don't update device power state unless we add / remove monitor */ 867 + if (vifs.monitor_vif) { 868 + if (vifs.monitor_active) 869 + mvm->ps_disabled = true; 870 + ret = iwl_mvm_power_update_device(mvm); 871 + if (ret) 872 + return ret; 873 + } 874 + } 875 + 876 + if (vifs.bss_vif) { 877 + ret = iwl_mvm_power_send_cmd(mvm, vifs.bss_vif); 878 + if (ret) 879 + return ret; 880 + } 881 + 882 + if (vifs.p2p_vif) { 883 + ret = iwl_mvm_power_send_cmd(mvm, vifs.p2p_vif); 884 + if (ret) 885 + return ret; 886 + } 887 + 888 + if (!vifs.bf_vif) 889 + return 0; 890 + 891 + mvmvif = iwl_mvm_vif_from_mac80211(vifs.bf_vif); 892 + 893 + ba_enable = !(!mvmvif->pm_enabled || mvm->ps_disabled || 894 + !vifs.bf_vif->bss_conf.ps || 895 + iwl_mvm_vif_low_latency(mvmvif)); 896 + 897 + return iwl_mvm_update_beacon_abort(mvm, vifs.bf_vif, ba_enable); 829 898 } 830 899 831 900 int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm, ··· 900 871 if (WARN_ON(!dtimper_msec)) 901 872 return 0; 902 873 903 - cmd.flags |= 904 - cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK); 905 874 cmd.skip_dtim_periods = 300 / dtimper_msec; 875 + if (cmd.skip_dtim_periods) 876 + cmd.flags |= 877 + cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK); 906 878 } 907 879 iwl_mvm_power_log(mvm, &cmd); 908 880 #ifdef CONFIG_IWLWIFI_DEBUGFS ··· 933 903 } 934 904 935 905 return ret; 936 - } 937 - 938 - int iwl_mvm_update_beacon_filter(struct iwl_mvm *mvm, 939 - struct ieee80211_vif *vif, 940 - bool force, 941 - u32 flags) 942 - { 943 - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 944 - 945 - if (mvmvif != mvm->bf_allowed_vif) 946 - return 0; 947 - 948 - if (!mvmvif->bf_data.bf_enabled) { 949 - /* disable beacon filtering explicitly if force is true */ 950 - if (force) 951 - return iwl_mvm_disable_beacon_filter(mvm, vif, flags); 952 - return 0; 953 - } 954 - 955 - return iwl_mvm_enable_beacon_filter(mvm, vif, flags); 956 906 }
+1 -1
drivers/net/wireless/iwlwifi/mvm/quota.c
··· 285 285 286 286 iwl_mvm_adjust_quota_for_noa(mvm, &cmd); 287 287 288 - ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC, 288 + ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, 0, 289 289 sizeof(cmd), &cmd); 290 290 if (ret) 291 291 IWL_ERR(mvm, "Failed to send quota: %d\n", ret);
+65 -122
drivers/net/wireless/iwlwifi/mvm/rs.c
··· 211 211 .next_columns = { 212 212 RS_COLUMN_LEGACY_ANT_B, 213 213 RS_COLUMN_SISO_ANT_A, 214 - RS_COLUMN_SISO_ANT_B, 214 + RS_COLUMN_MIMO2, 215 215 RS_COLUMN_INVALID, 216 216 RS_COLUMN_INVALID, 217 217 RS_COLUMN_INVALID, ··· 223 223 .ant = ANT_B, 224 224 .next_columns = { 225 225 RS_COLUMN_LEGACY_ANT_A, 226 - RS_COLUMN_SISO_ANT_A, 227 226 RS_COLUMN_SISO_ANT_B, 227 + RS_COLUMN_MIMO2, 228 228 RS_COLUMN_INVALID, 229 229 RS_COLUMN_INVALID, 230 230 RS_COLUMN_INVALID, ··· 238 238 RS_COLUMN_SISO_ANT_B, 239 239 RS_COLUMN_MIMO2, 240 240 RS_COLUMN_SISO_ANT_A_SGI, 241 - RS_COLUMN_SISO_ANT_B_SGI, 242 241 RS_COLUMN_LEGACY_ANT_A, 243 242 RS_COLUMN_LEGACY_ANT_B, 243 + RS_COLUMN_INVALID, 244 244 RS_COLUMN_INVALID, 245 245 }, 246 246 .checks = { ··· 254 254 RS_COLUMN_SISO_ANT_A, 255 255 RS_COLUMN_MIMO2, 256 256 RS_COLUMN_SISO_ANT_B_SGI, 257 - RS_COLUMN_SISO_ANT_A_SGI, 258 257 RS_COLUMN_LEGACY_ANT_A, 259 258 RS_COLUMN_LEGACY_ANT_B, 259 + RS_COLUMN_INVALID, 260 260 RS_COLUMN_INVALID, 261 261 }, 262 262 .checks = { ··· 271 271 RS_COLUMN_SISO_ANT_B_SGI, 272 272 RS_COLUMN_MIMO2_SGI, 273 273 RS_COLUMN_SISO_ANT_A, 274 - RS_COLUMN_SISO_ANT_B, 275 - RS_COLUMN_MIMO2, 276 274 RS_COLUMN_LEGACY_ANT_A, 277 275 RS_COLUMN_LEGACY_ANT_B, 276 + RS_COLUMN_INVALID, 277 + RS_COLUMN_INVALID, 278 278 }, 279 279 .checks = { 280 280 rs_siso_allow, ··· 289 289 RS_COLUMN_SISO_ANT_A_SGI, 290 290 RS_COLUMN_MIMO2_SGI, 291 291 RS_COLUMN_SISO_ANT_B, 292 - RS_COLUMN_SISO_ANT_A, 293 - RS_COLUMN_MIMO2, 294 292 RS_COLUMN_LEGACY_ANT_A, 295 293 RS_COLUMN_LEGACY_ANT_B, 294 + RS_COLUMN_INVALID, 295 + RS_COLUMN_INVALID, 296 296 }, 297 297 .checks = { 298 298 rs_siso_allow, ··· 304 304 .ant = ANT_AB, 305 305 .next_columns = { 306 306 RS_COLUMN_SISO_ANT_A, 307 - RS_COLUMN_SISO_ANT_B, 308 - RS_COLUMN_SISO_ANT_A_SGI, 309 - RS_COLUMN_SISO_ANT_B_SGI, 310 307 RS_COLUMN_MIMO2_SGI, 311 308 RS_COLUMN_LEGACY_ANT_A, 312 309 RS_COLUMN_LEGACY_ANT_B, 310 + RS_COLUMN_INVALID, 311 + RS_COLUMN_INVALID, 312 + RS_COLUMN_INVALID, 313 313 }, 314 314 .checks = { 315 315 rs_mimo_allow, ··· 321 321 .sgi = true, 322 322 .next_columns = { 323 323 RS_COLUMN_SISO_ANT_A_SGI, 324 - RS_COLUMN_SISO_ANT_B_SGI, 325 - RS_COLUMN_SISO_ANT_A, 326 - RS_COLUMN_SISO_ANT_B, 327 324 RS_COLUMN_MIMO2, 328 325 RS_COLUMN_LEGACY_ANT_A, 329 326 RS_COLUMN_LEGACY_ANT_B, 327 + RS_COLUMN_INVALID, 328 + RS_COLUMN_INVALID, 329 + RS_COLUMN_INVALID, 330 330 }, 331 331 .checks = { 332 332 rs_mimo_allow, ··· 1335 1335 tbl->expected_tpt = rs_get_expected_tpt_table(lq_sta, column, rate->bw); 1336 1336 } 1337 1337 1338 - /* 1339 - * Find starting rate for new "search" high-throughput mode of modulation. 1340 - * Goal is to find lowest expected rate (under perfect conditions) that is 1341 - * above the current measured throughput of "active" mode, to give new mode 1342 - * a fair chance to prove itself without too many challenges. 1343 - * 1344 - * This gets called when transitioning to more aggressive modulation 1345 - * (i.e. legacy to SISO or MIMO, or SISO to MIMO), as well as less aggressive 1346 - * (i.e. MIMO to SISO). When moving to MIMO, bit rate will typically need 1347 - * to decrease to match "active" throughput. When moving from MIMO to SISO, 1348 - * bit rate will typically need to increase, but not if performance was bad. 1349 - */ 1350 1338 static s32 rs_get_best_rate(struct iwl_mvm *mvm, 1351 1339 struct iwl_lq_sta *lq_sta, 1352 1340 struct iwl_scale_tbl_info *tbl, /* "search" */ 1353 - u16 rate_mask, s8 index) 1341 + unsigned long rate_mask, s8 index) 1354 1342 { 1355 - /* "active" values */ 1356 1343 struct iwl_scale_tbl_info *active_tbl = 1357 1344 &(lq_sta->lq_info[lq_sta->active_tbl]); 1358 - s32 active_sr = active_tbl->win[index].success_ratio; 1359 - s32 active_tpt = active_tbl->expected_tpt[index]; 1360 - /* expected "search" throughput */ 1345 + s32 success_ratio = active_tbl->win[index].success_ratio; 1346 + u16 expected_current_tpt = active_tbl->expected_tpt[index]; 1361 1347 const u16 *tpt_tbl = tbl->expected_tpt; 1362 - 1363 - s32 new_rate, high, low, start_hi; 1364 1348 u16 high_low; 1365 - s8 rate = index; 1349 + u32 target_tpt; 1350 + int rate_idx; 1366 1351 1367 - new_rate = high = low = start_hi = IWL_RATE_INVALID; 1368 - 1369 - while (1) { 1370 - high_low = rs_get_adjacent_rate(mvm, rate, rate_mask, 1371 - tbl->rate.type); 1372 - 1373 - low = high_low & 0xff; 1374 - high = (high_low >> 8) & 0xff; 1375 - 1376 - /* 1377 - * Lower the "search" bit rate, to give new "search" mode 1378 - * approximately the same throughput as "active" if: 1379 - * 1380 - * 1) "Active" mode has been working modestly well (but not 1381 - * great), and expected "search" throughput (under perfect 1382 - * conditions) at candidate rate is above the actual 1383 - * measured "active" throughput (but less than expected 1384 - * "active" throughput under perfect conditions). 1385 - * OR 1386 - * 2) "Active" mode has been working perfectly or very well 1387 - * and expected "search" throughput (under perfect 1388 - * conditions) at candidate rate is above expected 1389 - * "active" throughput (under perfect conditions). 1390 - */ 1391 - if ((((100 * tpt_tbl[rate]) > lq_sta->last_tpt) && 1392 - ((active_sr > RS_SR_FORCE_DECREASE) && 1393 - (active_sr <= IWL_RATE_HIGH_TH) && 1394 - (tpt_tbl[rate] <= active_tpt))) || 1395 - ((active_sr >= IWL_RATE_SCALE_SWITCH) && 1396 - (tpt_tbl[rate] > active_tpt))) { 1397 - /* (2nd or later pass) 1398 - * If we've already tried to raise the rate, and are 1399 - * now trying to lower it, use the higher rate. */ 1400 - if (start_hi != IWL_RATE_INVALID) { 1401 - new_rate = start_hi; 1402 - break; 1403 - } 1404 - 1405 - new_rate = rate; 1406 - 1407 - /* Loop again with lower rate */ 1408 - if (low != IWL_RATE_INVALID) 1409 - rate = low; 1410 - 1411 - /* Lower rate not available, use the original */ 1412 - else 1413 - break; 1414 - 1415 - /* Else try to raise the "search" rate to match "active" */ 1416 - } else { 1417 - /* (2nd or later pass) 1418 - * If we've already tried to lower the rate, and are 1419 - * now trying to raise it, use the lower rate. */ 1420 - if (new_rate != IWL_RATE_INVALID) 1421 - break; 1422 - 1423 - /* Loop again with higher rate */ 1424 - else if (high != IWL_RATE_INVALID) { 1425 - start_hi = high; 1426 - rate = high; 1427 - 1428 - /* Higher rate not available, use the original */ 1429 - } else { 1430 - new_rate = rate; 1431 - break; 1432 - } 1433 - } 1352 + if (success_ratio > RS_SR_NO_DECREASE) { 1353 + target_tpt = 100 * expected_current_tpt; 1354 + IWL_DEBUG_RATE(mvm, 1355 + "SR %d high. Find rate exceeding EXPECTED_CURRENT %d\n", 1356 + success_ratio, target_tpt); 1357 + } else { 1358 + target_tpt = lq_sta->last_tpt; 1359 + IWL_DEBUG_RATE(mvm, 1360 + "SR %d not thag good. Find rate exceeding ACTUAL_TPT %d\n", 1361 + success_ratio, target_tpt); 1434 1362 } 1435 1363 1436 - return new_rate; 1364 + rate_idx = find_first_bit(&rate_mask, BITS_PER_LONG); 1365 + 1366 + while (rate_idx != IWL_RATE_INVALID) { 1367 + if (target_tpt < (100 * tpt_tbl[rate_idx])) 1368 + break; 1369 + 1370 + high_low = rs_get_adjacent_rate(mvm, rate_idx, rate_mask, 1371 + tbl->rate.type); 1372 + 1373 + rate_idx = (high_low >> 8) & 0xff; 1374 + } 1375 + 1376 + IWL_DEBUG_RATE(mvm, "Best rate found %d target_tp %d expected_new %d\n", 1377 + rate_idx, target_tpt, 1378 + rate_idx != IWL_RATE_INVALID ? 1379 + 100 * tpt_tbl[rate_idx] : IWL_INVALID_VALUE); 1380 + 1381 + return rate_idx; 1437 1382 } 1438 1383 1439 1384 static u32 rs_bw_from_sta_bw(struct ieee80211_sta *sta) ··· 1553 1608 1554 1609 tpt = lq_sta->last_tpt / 100; 1555 1610 expected_tpt_tbl = rs_get_expected_tpt_table(lq_sta, next_col, 1556 - tbl->rate.bw); 1611 + rs_bw_from_sta_bw(sta)); 1557 1612 if (WARN_ON_ONCE(!expected_tpt_tbl)) 1558 1613 continue; 1559 1614 ··· 1594 1649 const struct rs_tx_column *curr_column = &rs_tx_columns[tbl->column]; 1595 1650 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1596 1651 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1597 - u16 rate_mask = 0; 1652 + unsigned long rate_mask = 0; 1598 1653 u32 rate_idx = 0; 1599 1654 1600 1655 memcpy(search_tbl, tbl, sz); ··· 1636 1691 !(BIT(rate_idx) & rate_mask)) { 1637 1692 IWL_DEBUG_RATE(mvm, 1638 1693 "can not switch with index %d" 1639 - " rate mask %x\n", 1694 + " rate mask %lx\n", 1640 1695 rate_idx, rate_mask); 1641 1696 1642 1697 goto err; ··· 1750 1805 *stronger = TPC_INVALID; 1751 1806 } 1752 1807 1753 - static bool rs_tpc_allowed(struct iwl_mvm *mvm, struct rs_rate *rate, 1754 - enum ieee80211_band band) 1808 + static bool rs_tpc_allowed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 1809 + struct rs_rate *rate, enum ieee80211_band band) 1755 1810 { 1756 1811 int index = rate->index; 1812 + bool cam = (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM); 1813 + bool sta_ps_disabled = (vif->type == NL80211_IFTYPE_STATION && 1814 + !vif->bss_conf.ps); 1757 1815 1816 + IWL_DEBUG_RATE(mvm, "cam: %d sta_ps_disabled %d\n", 1817 + cam, sta_ps_disabled); 1758 1818 /* 1759 1819 * allow tpc only if power management is enabled, or bt coex 1760 1820 * activity grade allows it and we are on 2.4Ghz. 1761 1821 */ 1762 - if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM && 1822 + if ((cam || sta_ps_disabled) && 1763 1823 !iwl_mvm_bt_coex_is_tpc_allowed(mvm, band)) 1764 1824 return false; 1765 1825 ··· 1866 1916 1867 1917 #ifdef CONFIG_MAC80211_DEBUGFS 1868 1918 if (lq_sta->dbg_fixed_txp_reduction <= TPC_MAX_REDUCTION) { 1869 - IWL_DEBUG_RATE(mvm, "fixed tpc: %d", 1919 + IWL_DEBUG_RATE(mvm, "fixed tpc: %d\n", 1870 1920 lq_sta->dbg_fixed_txp_reduction); 1871 1921 lq_sta->lq.reduced_tpc = lq_sta->dbg_fixed_txp_reduction; 1872 1922 return cur != lq_sta->dbg_fixed_txp_reduction; ··· 1881 1931 band = chanctx_conf->def.chan->band; 1882 1932 rcu_read_unlock(); 1883 1933 1884 - if (!rs_tpc_allowed(mvm, rate, band)) { 1934 + if (!rs_tpc_allowed(mvm, vif, rate, band)) { 1885 1935 IWL_DEBUG_RATE(mvm, 1886 - "tpc is not allowed. remove txp restrictions"); 1936 + "tpc is not allowed. remove txp restrictions\n"); 1887 1937 lq_sta->lq.reduced_tpc = TPC_NO_REDUCTION; 1888 1938 return cur != TPC_NO_REDUCTION; 1889 1939 } ··· 1909 1959 1910 1960 /* override actions if we are on the edge */ 1911 1961 if (weak == TPC_INVALID && action == TPC_ACTION_DECREASE) { 1912 - IWL_DEBUG_RATE(mvm, "already in lowest txp, stay"); 1962 + IWL_DEBUG_RATE(mvm, "already in lowest txp, stay\n"); 1913 1963 action = TPC_ACTION_STAY; 1914 1964 } else if (strong == TPC_INVALID && 1915 1965 (action == TPC_ACTION_INCREASE || 1916 1966 action == TPC_ACTION_NO_RESTIRCTION)) { 1917 - IWL_DEBUG_RATE(mvm, "already in highest txp, stay"); 1967 + IWL_DEBUG_RATE(mvm, "already in highest txp, stay\n"); 1918 1968 action = TPC_ACTION_STAY; 1919 1969 } 1920 1970 ··· 2185 2235 break; 2186 2236 case RS_ACTION_STAY: 2187 2237 /* No change */ 2188 - update_lq = rs_tpc_perform(mvm, sta, lq_sta, tbl); 2238 + if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) 2239 + update_lq = rs_tpc_perform(mvm, sta, lq_sta, tbl); 2189 2240 break; 2190 2241 default: 2191 2242 break; ··· 2440 2489 if (i == IWL_RATE_9M_INDEX) 2441 2490 continue; 2442 2491 2443 - /* Disable MCS9 as a workaround */ 2444 - if (i == IWL_RATE_MCS_9_INDEX) 2445 - continue; 2446 - 2447 2492 /* VHT MCS9 isn't valid for 20Mhz for NSS=1,2 */ 2448 2493 if (i == IWL_RATE_MCS_9_INDEX && 2449 2494 sta->bandwidth == IEEE80211_STA_RX_BW_20) ··· 2456 2509 if (highest_mcs >= IWL_RATE_MCS_0_INDEX) { 2457 2510 for (i = IWL_RATE_MCS_0_INDEX; i <= highest_mcs; i++) { 2458 2511 if (i == IWL_RATE_9M_INDEX) 2459 - continue; 2460 - 2461 - /* Disable MCS9 as a workaround */ 2462 - if (i == IWL_RATE_MCS_9_INDEX) 2463 2512 continue; 2464 2513 2465 2514 /* VHT MCS9 isn't valid for 20Mhz for NSS=1,2 */
+6 -7
drivers/net/wireless/iwlwifi/mvm/scan.c
··· 306 306 .id = SCAN_REQUEST_CMD, 307 307 .len = { 0, }, 308 308 .data = { mvm->scan_cmd, }, 309 - .flags = CMD_SYNC, 310 309 .dataflags = { IWL_HCMD_DFL_NOCOPY, }, 311 310 }; 312 311 struct iwl_scan_cmd *cmd = mvm->scan_cmd; ··· 516 517 ARRAY_SIZE(scan_abort_notif), 517 518 iwl_mvm_scan_abort_notif, NULL); 518 519 519 - ret = iwl_mvm_send_cmd_pdu(mvm, SCAN_ABORT_CMD, CMD_SYNC, 0, NULL); 520 + ret = iwl_mvm_send_cmd_pdu(mvm, SCAN_ABORT_CMD, 0, 0, NULL); 520 521 if (ret) { 521 522 IWL_ERR(mvm, "Couldn't send SCAN_ABORT_CMD: %d\n", ret); 522 523 /* mac80211's state will be cleaned in the nic_restart flow */ ··· 748 749 struct iwl_scan_offload_cfg *scan_cfg; 749 750 struct iwl_host_cmd cmd = { 750 751 .id = SCAN_OFFLOAD_CONFIG_CMD, 751 - .flags = CMD_SYNC, 752 752 }; 753 753 struct iwl_mvm_scan_params params = {}; 754 754 ··· 805 807 struct iwl_scan_offload_blacklist *blacklist; 806 808 struct iwl_host_cmd cmd = { 807 809 .id = SCAN_OFFLOAD_UPDATE_PROFILES_CMD, 808 - .flags = CMD_SYNC, 809 810 .len[1] = sizeof(*profile_cfg), 810 811 .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 811 812 .dataflags[1] = IWL_HCMD_DFL_NOCOPY, ··· 895 898 scan_req.flags |= 896 899 cpu_to_le16(IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE); 897 900 898 - return iwl_mvm_send_cmd_pdu(mvm, SCAN_OFFLOAD_REQUEST_CMD, CMD_SYNC, 901 + return iwl_mvm_send_cmd_pdu(mvm, SCAN_OFFLOAD_REQUEST_CMD, 0, 899 902 sizeof(scan_req), &scan_req); 900 903 } 901 904 ··· 904 907 int ret; 905 908 struct iwl_host_cmd cmd = { 906 909 .id = SCAN_OFFLOAD_ABORT_CMD, 907 - .flags = CMD_SYNC, 908 910 }; 909 911 u32 status; 910 912 ··· 932 936 return ret; 933 937 } 934 938 935 - int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm) 939 + int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm, bool notify) 936 940 { 937 941 int ret; 938 942 struct iwl_notification_wait wait_scan_done; ··· 969 973 * stopped from above. 970 974 */ 971 975 mvm->scan_status = IWL_MVM_SCAN_NONE; 976 + 977 + if (notify) 978 + ieee80211_sched_scan_stopped(mvm->hw); 972 979 973 980 return 0; 974 981 }
+9 -9
drivers/net/wireless/iwlwifi/mvm/sta.c
··· 327 327 return -EINVAL; 328 328 } 329 329 330 - ret = iwl_mvm_send_cmd_pdu(mvm, REMOVE_STA, CMD_SYNC, 330 + ret = iwl_mvm_send_cmd_pdu(mvm, REMOVE_STA, 0, 331 331 sizeof(rm_sta_cmd), &rm_sta_cmd); 332 332 if (ret) { 333 333 IWL_ERR(mvm, "Failed to remove station. Id=%d\n", sta_id); ··· 1053 1053 cmd.sta_id = sta_id; 1054 1054 1055 1055 status = ADD_STA_SUCCESS; 1056 - if (cmd_flags == CMD_SYNC) 1057 - ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA_KEY, sizeof(cmd), 1058 - &cmd, &status); 1059 - else 1056 + if (cmd_flags & CMD_ASYNC) 1060 1057 ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA_KEY, CMD_ASYNC, 1061 1058 sizeof(cmd), &cmd); 1059 + else 1060 + ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA_KEY, sizeof(cmd), 1061 + &cmd, &status); 1062 1062 1063 1063 switch (status) { 1064 1064 case ADD_STA_SUCCESS: ··· 1111 1111 remove_key ? "removing" : "installing", 1112 1112 igtk_cmd.sta_id); 1113 1113 1114 - return iwl_mvm_send_cmd_pdu(mvm, MGMT_MCAST_KEY, CMD_SYNC, 1114 + return iwl_mvm_send_cmd_pdu(mvm, MGMT_MCAST_KEY, 0, 1115 1115 sizeof(igtk_cmd), &igtk_cmd); 1116 1116 } 1117 1117 ··· 1198 1198 ieee80211_get_key_rx_seq(keyconf, 0, &seq); 1199 1199 ieee80211_get_tkip_rx_p1k(keyconf, addr, seq.tkip.iv32, p1k); 1200 1200 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, sta_id, 1201 - seq.tkip.iv32, p1k, CMD_SYNC); 1201 + seq.tkip.iv32, p1k, 0); 1202 1202 break; 1203 1203 case WLAN_CIPHER_SUITE_CCMP: 1204 1204 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, sta_id, 1205 - 0, NULL, CMD_SYNC); 1205 + 0, NULL, 0); 1206 1206 break; 1207 1207 default: 1208 1208 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, 1209 - sta_id, 0, NULL, CMD_SYNC); 1209 + sta_id, 0, NULL, 0); 1210 1210 } 1211 1211 1212 1212 if (ret)
-3
drivers/net/wireless/iwlwifi/mvm/sta.h
··· 287 287 * @tid_disable_agg: bitmap: if bit(tid) is set, the fw won't send ampdus for 288 288 * tid. 289 289 * @max_agg_bufsize: the maximal size of the AGG buffer for this station 290 - * @bt_reduced_txpower_dbg: debug mode in which %bt_reduced_txpower is forced 291 - * by debugfs. 292 290 * @bt_reduced_txpower: is reduced tx power enabled for this station 293 291 * @next_status_eosp: the next reclaimed packet is a PS-Poll response and 294 292 * we need to signal the EOSP ··· 307 309 u32 mac_id_n_color; 308 310 u16 tid_disable_agg; 309 311 u8 max_agg_bufsize; 310 - bool bt_reduced_txpower_dbg; 311 312 bool bt_reduced_txpower; 312 313 bool next_status_eosp; 313 314 spinlock_t lock;
+2 -2
drivers/net/wireless/iwlwifi/mvm/time-event.c
··· 312 312 ARRAY_SIZE(time_event_response), 313 313 iwl_mvm_time_event_response, te_data); 314 314 315 - ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC, 315 + ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0, 316 316 sizeof(*te_cmd), te_cmd); 317 317 if (ret) { 318 318 IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret); ··· 434 434 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); 435 435 436 436 IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id)); 437 - ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC, 437 + ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0, 438 438 sizeof(time_cmd), &time_cmd); 439 439 if (WARN_ON(ret)) 440 440 return;
-1
drivers/net/wireless/iwlwifi/mvm/tt.c
··· 409 409 .id = REPLY_THERMAL_MNG_BACKOFF, 410 410 .len = { sizeof(u32), }, 411 411 .data = { &backoff, }, 412 - .flags = CMD_SYNC, 413 412 }; 414 413 415 414 backoff = max(backoff, mvm->thermal_throttle.min_backoff);
+1 -1
drivers/net/wireless/iwlwifi/mvm/tx.c
··· 958 958 .flush_ctl = cpu_to_le16(DUMP_TX_FIFO_FLUSH), 959 959 }; 960 960 961 - u32 flags = sync ? CMD_SYNC : CMD_ASYNC; 961 + u32 flags = sync ? 0 : CMD_ASYNC; 962 962 963 963 ret = iwl_mvm_send_cmd_pdu(mvm, TXPATH_FLUSH, flags, 964 964 sizeof(flush_cmd), &flush_cmd);
+38 -3
drivers/net/wireless/iwlwifi/mvm/utils.c
··· 144 144 "cmd flags %x", cmd->flags)) 145 145 return -EINVAL; 146 146 147 - cmd->flags |= CMD_SYNC | CMD_WANT_SKB; 147 + cmd->flags |= CMD_WANT_SKB; 148 148 149 149 ret = iwl_trans_send_cmd(mvm->trans, cmd); 150 150 if (ret == -ERFKILL) { ··· 519 519 iwl_mvm_dump_umac_error_log(mvm); 520 520 } 521 521 522 + #ifdef CONFIG_IWLWIFI_DEBUGFS 522 523 void iwl_mvm_fw_error_sram_dump(struct iwl_mvm *mvm) 523 524 { 524 525 const struct fw_img *img; ··· 582 581 } 583 582 iwl_trans_release_nic_access(mvm->trans, &flags); 584 583 } 584 + #endif 585 585 586 586 /** 587 587 * iwl_mvm_send_lq_cmd() - Send link quality command ··· 599 597 struct iwl_host_cmd cmd = { 600 598 .id = LQ_CMD, 601 599 .len = { sizeof(struct iwl_lq_cmd), }, 602 - .flags = init ? CMD_SYNC : CMD_ASYNC, 600 + .flags = init ? 0 : CMD_ASYNC, 603 601 .data = { lq, }, 604 602 }; 605 603 ··· 650 648 ieee80211_request_smps(vif, smps_mode); 651 649 } 652 650 651 + static void iwl_mvm_diversity_iter(void *_data, u8 *mac, 652 + struct ieee80211_vif *vif) 653 + { 654 + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 655 + bool *result = _data; 656 + int i; 657 + 658 + for (i = 0; i < NUM_IWL_MVM_SMPS_REQ; i++) { 659 + if (mvmvif->smps_requests[i] == IEEE80211_SMPS_STATIC || 660 + mvmvif->smps_requests[i] == IEEE80211_SMPS_DYNAMIC) 661 + *result = false; 662 + } 663 + } 664 + 665 + bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm) 666 + { 667 + bool result = true; 668 + 669 + lockdep_assert_held(&mvm->mutex); 670 + 671 + if (num_of_ant(mvm->fw->valid_rx_ant) == 1) 672 + return false; 673 + 674 + if (!mvm->cfg->rx_with_siso_diversity) 675 + return false; 676 + 677 + ieee80211_iterate_active_interfaces_atomic( 678 + mvm->hw, IEEE80211_IFACE_ITER_NORMAL, 679 + iwl_mvm_diversity_iter, &result); 680 + 681 + return result; 682 + } 683 + 653 684 int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 654 685 bool value) 655 686 { ··· 702 667 703 668 iwl_mvm_bt_coex_vif_change(mvm); 704 669 705 - return iwl_mvm_power_update_mac(mvm, vif); 670 + return iwl_mvm_power_update_mac(mvm); 706 671 } 707 672 708 673 static void iwl_mvm_ll_iter(void *_data, u8 *mac, struct ieee80211_vif *vif)
+7 -7
drivers/net/wireless/iwlwifi/pcie/drv.c
··· 417 417 splx->package.count != 2 || 418 418 splx->package.elements[0].type != ACPI_TYPE_INTEGER || 419 419 splx->package.elements[0].integer.value != 0) { 420 - IWL_ERR(trans, "Unsupported splx structure"); 420 + IWL_ERR(trans, "Unsupported splx structure\n"); 421 421 return 0; 422 422 } 423 423 ··· 426 426 limits->package.count < 2 || 427 427 limits->package.elements[0].type != ACPI_TYPE_INTEGER || 428 428 limits->package.elements[1].type != ACPI_TYPE_INTEGER) { 429 - IWL_ERR(trans, "Invalid limits element"); 429 + IWL_ERR(trans, "Invalid limits element\n"); 430 430 return 0; 431 431 } 432 432 433 433 domain_type = &limits->package.elements[0]; 434 434 power_limit = &limits->package.elements[1]; 435 435 if (!(domain_type->integer.value & SPL_DOMAINTYPE_WIFI)) { 436 - IWL_DEBUG_INFO(trans, "WiFi power is not limited"); 436 + IWL_DEBUG_INFO(trans, "WiFi power is not limited\n"); 437 437 return 0; 438 438 } 439 439 ··· 450 450 pxsx_handle = ACPI_HANDLE(&pdev->dev); 451 451 if (!pxsx_handle) { 452 452 IWL_DEBUG_INFO(trans, 453 - "Could not retrieve root port ACPI handle"); 453 + "Could not retrieve root port ACPI handle\n"); 454 454 return; 455 455 } 456 456 457 457 /* Get the method's handle */ 458 458 status = acpi_get_handle(pxsx_handle, (acpi_string)SPL_METHOD, &handle); 459 459 if (ACPI_FAILURE(status)) { 460 - IWL_DEBUG_INFO(trans, "SPL method not found"); 460 + IWL_DEBUG_INFO(trans, "SPL method not found\n"); 461 461 return; 462 462 } 463 463 464 464 /* Call SPLC with no arguments */ 465 465 status = acpi_evaluate_object(handle, NULL, NULL, &splx); 466 466 if (ACPI_FAILURE(status)) { 467 - IWL_ERR(trans, "SPLC invocation failed (0x%x)", status); 467 + IWL_ERR(trans, "SPLC invocation failed (0x%x)\n", status); 468 468 return; 469 469 } 470 470 471 471 trans->dflt_pwr_limit = splx_get_pwr_limit(trans, splx.pointer); 472 - IWL_DEBUG_INFO(trans, "Default power limit set to %lld", 472 + IWL_DEBUG_INFO(trans, "Default power limit set to %lld\n", 473 473 trans->dflt_pwr_limit); 474 474 kfree(splx.pointer); 475 475 }
+14 -10
drivers/net/wireless/iwlwifi/pcie/internal.h
··· 117 117 /** 118 118 * iwl_queue_inc_wrap - increment queue index, wrap back to beginning 119 119 * @index -- current index 120 - * @n_bd -- total number of entries in queue (must be power of 2) 121 120 */ 122 - static inline int iwl_queue_inc_wrap(int index, int n_bd) 121 + static inline int iwl_queue_inc_wrap(int index) 123 122 { 124 - return ++index & (n_bd - 1); 123 + return ++index & (TFD_QUEUE_SIZE_MAX - 1); 125 124 } 126 125 127 126 /** 128 127 * iwl_queue_dec_wrap - decrement queue index, wrap back to end 129 128 * @index -- current index 130 - * @n_bd -- total number of entries in queue (must be power of 2) 131 129 */ 132 - static inline int iwl_queue_dec_wrap(int index, int n_bd) 130 + static inline int iwl_queue_dec_wrap(int index) 133 131 { 134 - return --index & (n_bd - 1); 132 + return --index & (TFD_QUEUE_SIZE_MAX - 1); 135 133 } 136 134 137 135 struct iwl_cmd_meta { ··· 143 145 * 144 146 * Contains common data for Rx and Tx queues. 145 147 * 146 - * Note the difference between n_bd and n_window: the hardware 147 - * always assumes 256 descriptors, so n_bd is always 256 (unless 148 + * Note the difference between TFD_QUEUE_SIZE_MAX and n_window: the hardware 149 + * always assumes 256 descriptors, so TFD_QUEUE_SIZE_MAX is always 256 (unless 148 150 * there might be HW changes in the future). For the normal TX 149 151 * queues, n_window, which is the size of the software queue data 150 152 * is also 256; however, for the command queue, n_window is only 151 153 * 32 since we don't need so many commands pending. Since the HW 152 - * still uses 256 BDs for DMA though, n_bd stays 256. As a result, 154 + * still uses 256 BDs for DMA though, TFD_QUEUE_SIZE_MAX stays 256. As a result, 153 155 * the software buffers (in the variables @meta, @txb in struct 154 156 * iwl_txq) only have 32 entries, while the HW buffers (@tfds in 155 157 * the same struct) have 256. ··· 160 162 * data is a window overlayed over the HW queue. 161 163 */ 162 164 struct iwl_queue { 163 - int n_bd; /* number of BDs in this queue */ 164 165 int write_ptr; /* 1-st empty entry (index) host_w*/ 165 166 int read_ptr; /* last used entry (index) host_r*/ 166 167 /* use for monitoring and recovering the stuck queue */ ··· 369 372 void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, 370 373 struct sk_buff_head *skbs); 371 374 void iwl_trans_pcie_tx_reset(struct iwl_trans *trans); 375 + 376 + static inline u16 iwl_pcie_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx) 377 + { 378 + struct iwl_tfd_tb *tb = &tfd->tbs[idx]; 379 + 380 + return le16_to_cpu(tb->hi_n_len) >> 4; 381 + } 372 382 373 383 /***************************************************** 374 384 * Error handling
+1 -1
drivers/net/wireless/iwlwifi/pcie/rx.c
··· 850 850 trans_pcie->ict_index, read); 851 851 trans_pcie->ict_tbl[trans_pcie->ict_index] = 0; 852 852 trans_pcie->ict_index = 853 - iwl_queue_inc_wrap(trans_pcie->ict_index, ICT_COUNT); 853 + ((trans_pcie->ict_index + 1) & (ICT_COUNT - 1)); 854 854 855 855 read = le32_to_cpu(trans_pcie->ict_tbl[trans_pcie->ict_index]); 856 856 trace_iwlwifi_dev_ict_read(trans->dev, trans_pcie->ict_index,
+78 -12
drivers/net/wireless/iwlwifi/pcie/trans.c
··· 73 73 #include "iwl-csr.h" 74 74 #include "iwl-prph.h" 75 75 #include "iwl-agn-hw.h" 76 + #include "iwl-fw-error-dump.h" 76 77 #include "internal.h" 77 78 78 79 static u32 iwl_trans_pcie_read_shr(struct iwl_trans *trans, u32 reg) ··· 454 453 { 455 454 int ret; 456 455 int t = 0; 456 + int iter; 457 457 458 458 IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n"); 459 459 ··· 463 461 if (ret >= 0) 464 462 return 0; 465 463 466 - /* If HW is not ready, prepare the conditions to check again */ 467 - iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, 468 - CSR_HW_IF_CONFIG_REG_PREPARE); 464 + for (iter = 0; iter < 10; iter++) { 465 + /* If HW is not ready, prepare the conditions to check again */ 466 + iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, 467 + CSR_HW_IF_CONFIG_REG_PREPARE); 469 468 470 - do { 471 - ret = iwl_pcie_set_hw_ready(trans); 472 - if (ret >= 0) 473 - return 0; 469 + do { 470 + ret = iwl_pcie_set_hw_ready(trans); 471 + if (ret >= 0) 472 + return 0; 474 473 475 - usleep_range(200, 1000); 476 - t += 200; 477 - } while (t < 150000); 474 + usleep_range(200, 1000); 475 + t += 200; 476 + } while (t < 150000); 477 + msleep(25); 478 + } 479 + 480 + IWL_DEBUG_INFO(trans, "got NIC after %d iterations\n", iter); 478 481 479 482 return ret; 480 483 } ··· 1344 1337 IWL_ERR(trans, 1345 1338 "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", 1346 1339 cnt, active ? "" : "in", fifo, tbl_dw, 1347 - iwl_read_prph(trans, 1348 - SCD_QUEUE_RDPTR(cnt)) & (txq->q.n_bd - 1), 1340 + iwl_read_prph(trans, SCD_QUEUE_RDPTR(cnt)) & 1341 + (TFD_QUEUE_SIZE_MAX - 1), 1349 1342 iwl_read_prph(trans, SCD_QUEUE_WRPTR(cnt))); 1350 1343 } 1351 1344 ··· 1676 1669 IWL_ERR(trans, "failed to create the trans debugfs entry\n"); 1677 1670 return -ENOMEM; 1678 1671 } 1672 + 1673 + static u32 iwl_trans_pcie_get_cmdlen(struct iwl_tfd *tfd) 1674 + { 1675 + u32 cmdlen = 0; 1676 + int i; 1677 + 1678 + for (i = 0; i < IWL_NUM_OF_TBS; i++) 1679 + cmdlen += iwl_pcie_tfd_tb_get_len(tfd, i); 1680 + 1681 + return cmdlen; 1682 + } 1683 + 1684 + static u32 iwl_trans_pcie_dump_data(struct iwl_trans *trans, 1685 + void *buf, u32 buflen) 1686 + { 1687 + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 1688 + struct iwl_fw_error_dump_data *data; 1689 + struct iwl_txq *cmdq = &trans_pcie->txq[trans_pcie->cmd_queue]; 1690 + struct iwl_fw_error_dump_txcmd *txcmd; 1691 + u32 len; 1692 + int i, ptr; 1693 + 1694 + if (!buf) 1695 + return sizeof(*data) + 1696 + cmdq->q.n_window * (sizeof(*txcmd) + 1697 + TFD_MAX_PAYLOAD_SIZE); 1698 + 1699 + len = 0; 1700 + data = buf; 1701 + data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_TXCMD); 1702 + txcmd = (void *)data->data; 1703 + spin_lock_bh(&cmdq->lock); 1704 + ptr = cmdq->q.write_ptr; 1705 + for (i = 0; i < cmdq->q.n_window; i++) { 1706 + u8 idx = get_cmd_index(&cmdq->q, ptr); 1707 + u32 caplen, cmdlen; 1708 + 1709 + cmdlen = iwl_trans_pcie_get_cmdlen(&cmdq->tfds[ptr]); 1710 + caplen = min_t(u32, TFD_MAX_PAYLOAD_SIZE, cmdlen); 1711 + 1712 + if (cmdlen) { 1713 + len += sizeof(*txcmd) + caplen; 1714 + txcmd->cmdlen = cpu_to_le32(cmdlen); 1715 + txcmd->caplen = cpu_to_le32(caplen); 1716 + memcpy(txcmd->data, cmdq->entries[idx].cmd, caplen); 1717 + txcmd = (void *)((u8 *)txcmd->data + caplen); 1718 + } 1719 + 1720 + ptr = iwl_queue_dec_wrap(ptr); 1721 + } 1722 + spin_unlock_bh(&cmdq->lock); 1723 + 1724 + data->len = cpu_to_le32(len); 1725 + return sizeof(*data) + len; 1726 + } 1679 1727 #else 1680 1728 static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, 1681 1729 struct dentry *dir) ··· 1773 1711 .grab_nic_access = iwl_trans_pcie_grab_nic_access, 1774 1712 .release_nic_access = iwl_trans_pcie_release_nic_access, 1775 1713 .set_bits_mask = iwl_trans_pcie_set_bits_mask, 1714 + 1715 + #ifdef CONFIG_IWLWIFI_DEBUGFS 1716 + .dump_data = iwl_trans_pcie_dump_data, 1717 + #endif 1776 1718 }; 1777 1719 1778 1720 struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
+70 -71
drivers/net/wireless/iwlwifi/pcie/tx.c
··· 70 70 71 71 /* 72 72 * To avoid ambiguity between empty and completely full queues, there 73 - * should always be less than q->n_bd elements in the queue. 74 - * If q->n_window is smaller than q->n_bd, there is no need to reserve 75 - * any queue entries for this purpose. 73 + * should always be less than TFD_QUEUE_SIZE_MAX elements in the queue. 74 + * If q->n_window is smaller than TFD_QUEUE_SIZE_MAX, there is no need 75 + * to reserve any queue entries for this purpose. 76 76 */ 77 - if (q->n_window < q->n_bd) 77 + if (q->n_window < TFD_QUEUE_SIZE_MAX) 78 78 max = q->n_window; 79 79 else 80 - max = q->n_bd - 1; 80 + max = TFD_QUEUE_SIZE_MAX - 1; 81 81 82 82 /* 83 - * q->n_bd is a power of 2, so the following is equivalent to modulo by 84 - * q->n_bd and is well defined for negative dividends. 83 + * TFD_QUEUE_SIZE_MAX is a power of 2, so the following is equivalent to 84 + * modulo by TFD_QUEUE_SIZE_MAX and is well defined. 85 85 */ 86 - used = (q->write_ptr - q->read_ptr) & (q->n_bd - 1); 86 + used = (q->write_ptr - q->read_ptr) & (TFD_QUEUE_SIZE_MAX - 1); 87 87 88 88 if (WARN_ON(used > max)) 89 89 return 0; ··· 94 94 /* 95 95 * iwl_queue_init - Initialize queue's high/low-water and read/write indexes 96 96 */ 97 - static int iwl_queue_init(struct iwl_queue *q, int count, int slots_num, u32 id) 97 + static int iwl_queue_init(struct iwl_queue *q, int slots_num, u32 id) 98 98 { 99 - q->n_bd = count; 100 99 q->n_window = slots_num; 101 100 q->id = id; 102 - 103 - /* count must be power-of-two size, otherwise iwl_queue_inc_wrap 104 - * and iwl_queue_dec_wrap are broken. */ 105 - if (WARN_ON(!is_power_of_2(count))) 106 - return -EINVAL; 107 101 108 102 /* slots_num must be power-of-two size, otherwise 109 103 * get_cmd_index is broken. */ ··· 191 197 IWL_ERR(trans, 192 198 "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", 193 199 i, active ? "" : "in", fifo, tbl_dw, 194 - iwl_read_prph(trans, 195 - SCD_QUEUE_RDPTR(i)) & (txq->q.n_bd - 1), 200 + iwl_read_prph(trans, SCD_QUEUE_RDPTR(i)) & 201 + (TFD_QUEUE_SIZE_MAX - 1), 196 202 iwl_read_prph(trans, SCD_QUEUE_WRPTR(i))); 197 203 } 198 204 199 205 for (i = q->read_ptr; i != q->write_ptr; 200 - i = iwl_queue_inc_wrap(i, q->n_bd)) 206 + i = iwl_queue_inc_wrap(i)) 201 207 IWL_ERR(trans, "scratch %d = 0x%08x\n", i, 202 208 le32_to_cpu(txq->scratchbufs[i].scratch)); 203 209 204 - iwl_write_prph(trans, DEVICE_SET_NMI_REG, 1); 210 + iwl_force_nmi(trans); 205 211 } 206 212 207 213 /* ··· 332 338 for (i = 0; i < trans->cfg->base_params->num_of_queues; i++) { 333 339 struct iwl_txq *txq = &trans_pcie->txq[i]; 334 340 335 - spin_lock(&txq->lock); 341 + spin_lock_bh(&txq->lock); 336 342 if (trans_pcie->txq[i].need_update) { 337 343 iwl_pcie_txq_inc_wr_ptr(trans, txq); 338 344 trans_pcie->txq[i].need_update = false; 339 345 } 340 - spin_unlock(&txq->lock); 346 + spin_unlock_bh(&txq->lock); 341 347 } 342 348 } 343 349 ··· 351 357 ((dma_addr_t)(le16_to_cpu(tb->hi_n_len) & 0xF) << 16) << 16; 352 358 353 359 return addr; 354 - } 355 - 356 - static inline u16 iwl_pcie_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx) 357 - { 358 - struct iwl_tfd_tb *tb = &tfd->tbs[idx]; 359 - 360 - return le16_to_cpu(tb->hi_n_len) >> 4; 361 360 } 362 361 363 362 static inline void iwl_pcie_tfd_set_tb(struct iwl_tfd *tfd, u8 idx, ··· 412 425 { 413 426 struct iwl_tfd *tfd_tmp = txq->tfds; 414 427 415 - /* rd_ptr is bounded by n_bd and idx is bounded by n_window */ 428 + /* rd_ptr is bounded by TFD_QUEUE_SIZE_MAX and 429 + * idx is bounded by n_window 430 + */ 416 431 int rd_ptr = txq->q.read_ptr; 417 432 int idx = get_cmd_index(&txq->q, rd_ptr); 418 433 419 434 lockdep_assert_held(&txq->lock); 420 435 421 - /* We have only q->n_window txq->entries, but we use q->n_bd tfds */ 436 + /* We have only q->n_window txq->entries, but we use 437 + * TFD_QUEUE_SIZE_MAX tfds 438 + */ 422 439 iwl_pcie_tfd_unmap(trans, &txq->entries[idx].meta, &tfd_tmp[rd_ptr]); 423 440 424 441 /* free SKB */ ··· 443 452 } 444 453 445 454 static int iwl_pcie_txq_build_tfd(struct iwl_trans *trans, struct iwl_txq *txq, 446 - dma_addr_t addr, u16 len, u8 reset) 455 + dma_addr_t addr, u16 len, bool reset) 447 456 { 448 457 struct iwl_queue *q; 449 458 struct iwl_tfd *tfd, *tfd_tmp; ··· 556 565 BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); 557 566 558 567 /* Initialize queue's high/low-water marks, and head/tail indexes */ 559 - ret = iwl_queue_init(&txq->q, TFD_QUEUE_SIZE_MAX, slots_num, 560 - txq_id); 568 + ret = iwl_queue_init(&txq->q, slots_num, txq_id); 561 569 if (ret) 562 570 return ret; 563 571 ··· 581 591 struct iwl_txq *txq = &trans_pcie->txq[txq_id]; 582 592 struct iwl_queue *q = &txq->q; 583 593 584 - if (!q->n_bd) 585 - return; 586 - 587 594 spin_lock_bh(&txq->lock); 588 595 while (q->write_ptr != q->read_ptr) { 589 596 IWL_DEBUG_TX_REPLY(trans, "Q %d Free %d\n", 590 597 txq_id, q->read_ptr); 591 598 iwl_pcie_txq_free_tfd(trans, txq); 592 - q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd); 599 + q->read_ptr = iwl_queue_inc_wrap(q->read_ptr); 593 600 } 594 601 txq->active = false; 595 602 spin_unlock_bh(&txq->lock); ··· 623 636 } 624 637 625 638 /* De-alloc circular buffer of TFDs */ 626 - if (txq->q.n_bd) { 627 - dma_free_coherent(dev, sizeof(struct iwl_tfd) * 628 - txq->q.n_bd, txq->tfds, txq->q.dma_addr); 639 + if (txq->tfds) { 640 + dma_free_coherent(dev, 641 + sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX, 642 + txq->tfds, txq->q.dma_addr); 629 643 txq->q.dma_addr = 0; 644 + txq->tfds = NULL; 630 645 631 646 dma_free_coherent(dev, 632 647 sizeof(*txq->scratchbufs) * txq->q.n_window, ··· 937 948 { 938 949 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 939 950 struct iwl_txq *txq = &trans_pcie->txq[txq_id]; 940 - /* n_bd is usually 256 => n_bd - 1 = 0xff */ 941 - int tfd_num = ssn & (txq->q.n_bd - 1); 951 + int tfd_num = ssn & (TFD_QUEUE_SIZE_MAX - 1); 942 952 struct iwl_queue *q = &txq->q; 943 953 int last_to_free; 944 954 ··· 961 973 962 974 /*Since we free until index _not_ inclusive, the one before index is 963 975 * the last we will free. This one must be used */ 964 - last_to_free = iwl_queue_dec_wrap(tfd_num, q->n_bd); 976 + last_to_free = iwl_queue_dec_wrap(tfd_num); 965 977 966 978 if (!iwl_queue_used(q, last_to_free)) { 967 979 IWL_ERR(trans, 968 980 "%s: Read index for DMA queue txq id (%d), last_to_free %d is out of range [0-%d] %d %d.\n", 969 - __func__, txq_id, last_to_free, q->n_bd, 981 + __func__, txq_id, last_to_free, TFD_QUEUE_SIZE_MAX, 970 982 q->write_ptr, q->read_ptr); 971 983 goto out; 972 984 } ··· 976 988 977 989 for (; 978 990 q->read_ptr != tfd_num; 979 - q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 991 + q->read_ptr = iwl_queue_inc_wrap(q->read_ptr)) { 980 992 981 993 if (WARN_ON_ONCE(txq->entries[txq->q.read_ptr].skb == NULL)) 982 994 continue; ··· 1015 1027 1016 1028 lockdep_assert_held(&txq->lock); 1017 1029 1018 - if ((idx >= q->n_bd) || (!iwl_queue_used(q, idx))) { 1030 + if ((idx >= TFD_QUEUE_SIZE_MAX) || (!iwl_queue_used(q, idx))) { 1019 1031 IWL_ERR(trans, 1020 1032 "%s: Read index for DMA queue txq id (%d), index %d is out of range [0-%d] %d %d.\n", 1021 - __func__, txq_id, idx, q->n_bd, 1033 + __func__, txq_id, idx, TFD_QUEUE_SIZE_MAX, 1022 1034 q->write_ptr, q->read_ptr); 1023 1035 return; 1024 1036 } 1025 1037 1026 - for (idx = iwl_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; 1027 - q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 1038 + for (idx = iwl_queue_inc_wrap(idx); q->read_ptr != idx; 1039 + q->read_ptr = iwl_queue_inc_wrap(q->read_ptr)) { 1028 1040 1029 1041 if (nfreed++ > 0) { 1030 1042 IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", 1031 1043 idx, q->write_ptr, q->read_ptr); 1032 - iwl_write_prph(trans, DEVICE_SET_NMI_REG, 1); 1044 + iwl_force_nmi(trans); 1033 1045 } 1034 1046 } 1035 1047 ··· 1315 1327 cmd_pos = offsetof(struct iwl_device_cmd, payload); 1316 1328 copy_size = sizeof(out_cmd->hdr); 1317 1329 for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { 1318 - int copy = 0; 1330 + int copy; 1319 1331 1320 1332 if (!cmd->len[i]) 1321 1333 continue; 1322 1334 1323 - /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ 1335 + /* copy everything if not nocopy/dup */ 1336 + if (!(cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | 1337 + IWL_HCMD_DFL_DUP))) { 1338 + copy = cmd->len[i]; 1339 + 1340 + memcpy((u8 *)out_cmd + cmd_pos, cmd->data[i], copy); 1341 + cmd_pos += copy; 1342 + copy_size += copy; 1343 + continue; 1344 + } 1345 + 1346 + /* 1347 + * Otherwise we need at least IWL_HCMD_SCRATCHBUF_SIZE copied 1348 + * in total (for the scratchbuf handling), but copy up to what 1349 + * we can fit into the payload for debug dump purposes. 1350 + */ 1351 + copy = min_t(int, TFD_MAX_PAYLOAD_SIZE - cmd_pos, cmd->len[i]); 1352 + 1353 + memcpy((u8 *)out_cmd + cmd_pos, cmd->data[i], copy); 1354 + cmd_pos += copy; 1355 + 1356 + /* However, treat copy_size the proper way, we need it below */ 1324 1357 if (copy_size < IWL_HCMD_SCRATCHBUF_SIZE) { 1325 1358 copy = IWL_HCMD_SCRATCHBUF_SIZE - copy_size; 1326 1359 1327 1360 if (copy > cmd->len[i]) 1328 1361 copy = cmd->len[i]; 1329 - } 1330 - 1331 - /* copy everything if not nocopy/dup */ 1332 - if (!(cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | 1333 - IWL_HCMD_DFL_DUP))) 1334 - copy = cmd->len[i]; 1335 - 1336 - if (copy) { 1337 - memcpy((u8 *)out_cmd + cmd_pos, cmd->data[i], copy); 1338 - cmd_pos += copy; 1339 1362 copy_size += copy; 1340 1363 } 1341 1364 } ··· 1362 1363 memcpy(&txq->scratchbufs[q->write_ptr], &out_cmd->hdr, scratch_size); 1363 1364 iwl_pcie_txq_build_tfd(trans, txq, 1364 1365 iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr), 1365 - scratch_size, 1); 1366 + scratch_size, true); 1366 1367 1367 1368 /* map first command fragment, if any remains */ 1368 1369 if (copy_size > scratch_size) { ··· 1378 1379 } 1379 1380 1380 1381 iwl_pcie_txq_build_tfd(trans, txq, phys_addr, 1381 - copy_size - scratch_size, 0); 1382 + copy_size - scratch_size, false); 1382 1383 } 1383 1384 1384 1385 /* map the remaining (adjusted) nocopy/dup fragments */ ··· 1401 1402 goto out; 1402 1403 } 1403 1404 1404 - iwl_pcie_txq_build_tfd(trans, txq, phys_addr, cmdlen[i], 0); 1405 + iwl_pcie_txq_build_tfd(trans, txq, phys_addr, cmdlen[i], false); 1405 1406 } 1406 1407 1407 1408 out_meta->flags = cmd->flags; ··· 1444 1445 } 1445 1446 1446 1447 /* Increment and update queue's write index */ 1447 - q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 1448 + q->write_ptr = iwl_queue_inc_wrap(q->write_ptr); 1448 1449 iwl_pcie_txq_inc_wr_ptr(trans, txq); 1449 1450 1450 1451 spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); ··· 1600 1601 get_cmd_string(trans_pcie, cmd->id)); 1601 1602 ret = -ETIMEDOUT; 1602 1603 1603 - iwl_write_prph(trans, DEVICE_SET_NMI_REG, 1); 1604 + iwl_force_nmi(trans); 1604 1605 iwl_trans_fw_error(trans); 1605 1606 1606 1607 goto cancel; ··· 1739 1740 memcpy(&txq->scratchbufs[q->write_ptr], &dev_cmd->hdr, 1740 1741 IWL_HCMD_SCRATCHBUF_SIZE); 1741 1742 iwl_pcie_txq_build_tfd(trans, txq, tb0_phys, 1742 - IWL_HCMD_SCRATCHBUF_SIZE, 1); 1743 + IWL_HCMD_SCRATCHBUF_SIZE, true); 1743 1744 1744 1745 /* there must be data left over for TB1 or this code must be changed */ 1745 1746 BUILD_BUG_ON(sizeof(struct iwl_tx_cmd) < IWL_HCMD_SCRATCHBUF_SIZE); ··· 1749 1750 tb1_phys = dma_map_single(trans->dev, tb1_addr, tb1_len, DMA_TO_DEVICE); 1750 1751 if (unlikely(dma_mapping_error(trans->dev, tb1_phys))) 1751 1752 goto out_err; 1752 - iwl_pcie_txq_build_tfd(trans, txq, tb1_phys, tb1_len, 0); 1753 + iwl_pcie_txq_build_tfd(trans, txq, tb1_phys, tb1_len, false); 1753 1754 1754 1755 /* 1755 1756 * Set up TFD's third entry to point directly to remainder ··· 1765 1766 &txq->tfds[q->write_ptr]); 1766 1767 goto out_err; 1767 1768 } 1768 - iwl_pcie_txq_build_tfd(trans, txq, tb2_phys, tb2_len, 0); 1769 + iwl_pcie_txq_build_tfd(trans, txq, tb2_phys, tb2_len, false); 1769 1770 } 1770 1771 1771 1772 /* Set up entry for this TFD in Tx byte-count array */ ··· 1787 1788 mod_timer(&txq->stuck_timer, jiffies + trans_pcie->wd_timeout); 1788 1789 1789 1790 /* Tell device the write index *just past* this latest filled TFD */ 1790 - q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 1791 + q->write_ptr = iwl_queue_inc_wrap(q->write_ptr); 1791 1792 if (!wait_write_ptr) 1792 1793 iwl_pcie_txq_inc_wr_ptr(trans, txq); 1793 1794
+3 -4
drivers/net/wireless/libertas/cfg.c
··· 1006 1006 } __packed; 1007 1007 1008 1008 static int lbs_set_key_material(struct lbs_private *priv, 1009 - int key_type, 1010 - int key_info, 1011 - u8 *key, u16 key_len) 1009 + int key_type, int key_info, 1010 + const u8 *key, u16 key_len) 1012 1011 { 1013 1012 struct cmd_key_material cmd; 1014 1013 int ret; ··· 1609 1610 */ 1610 1611 1611 1612 static int lbs_cfg_get_station(struct wiphy *wiphy, struct net_device *dev, 1612 - u8 *mac, struct station_info *sinfo) 1613 + const u8 *mac, struct station_info *sinfo) 1613 1614 { 1614 1615 struct lbs_private *priv = wiphy_priv(wiphy); 1615 1616 s8 signal, noise;
+2 -1
drivers/net/wireless/libertas/defs.h
··· 90 90 #define lbs_deb_cfg80211(fmt, args...) LBS_DEB_LL(LBS_DEB_CFG80211, " cfg80211", fmt, ##args) 91 91 92 92 #ifdef DEBUG 93 - static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len) 93 + static inline void lbs_deb_hex(unsigned int grp, const char *prompt, 94 + const u8 *buf, int len) 94 95 { 95 96 int i = 0; 96 97
+5 -3
drivers/net/wireless/libertas/rx.c
··· 71 71 72 72 skb->ip_summed = CHECKSUM_NONE; 73 73 74 - if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) 75 - return process_rxed_802_11_packet(priv, skb); 74 + if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) { 75 + ret = process_rxed_802_11_packet(priv, skb); 76 + goto done; 77 + } 76 78 77 79 p_rx_pd = (struct rxpd *) skb->data; 78 80 p_rx_pkt = (struct rxpackethdr *) ((u8 *)p_rx_pd + ··· 88 86 if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { 89 87 lbs_deb_rx("rx err: frame received with bad length\n"); 90 88 dev->stats.rx_length_errors++; 91 - ret = 0; 89 + ret = -EINVAL; 92 90 dev_kfree_skb(skb); 93 91 goto done; 94 92 }
+42
drivers/net/wireless/mwifiex/11n.c
··· 749 749 750 750 return; 751 751 } 752 + 753 + u8 mwifiex_get_sec_chan_offset(int chan) 754 + { 755 + u8 sec_offset; 756 + 757 + switch (chan) { 758 + case 36: 759 + case 44: 760 + case 52: 761 + case 60: 762 + case 100: 763 + case 108: 764 + case 116: 765 + case 124: 766 + case 132: 767 + case 140: 768 + case 149: 769 + case 157: 770 + sec_offset = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; 771 + break; 772 + case 40: 773 + case 48: 774 + case 56: 775 + case 64: 776 + case 104: 777 + case 112: 778 + case 120: 779 + case 128: 780 + case 136: 781 + case 144: 782 + case 153: 783 + case 161: 784 + sec_offset = IEEE80211_HT_PARAM_CHA_SEC_BELOW; 785 + break; 786 + case 165: 787 + default: 788 + sec_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; 789 + break; 790 + } 791 + 792 + return sec_offset; 793 + }
+2 -1
drivers/net/wireless/mwifiex/11n.h
··· 63 63 int cmd_action, 64 64 struct mwifiex_ds_11n_amsdu_aggr_ctrl *aa_ctrl); 65 65 void mwifiex_del_tx_ba_stream_tbl_by_ra(struct mwifiex_private *priv, u8 *ra); 66 + u8 mwifiex_get_sec_chan_offset(int chan); 66 67 67 68 static inline u8 68 69 mwifiex_is_station_ampdu_allowed(struct mwifiex_private *priv, ··· 200 199 } 201 200 202 201 static inline u8 203 - mwifiex_tdls_peer_11n_enabled(struct mwifiex_private *priv, u8 *ra) 202 + mwifiex_tdls_peer_11n_enabled(struct mwifiex_private *priv, const u8 *ra) 204 203 { 205 204 struct mwifiex_sta_node *node = mwifiex_get_sta_entry(priv, ra); 206 205 if (node)
+7
drivers/net/wireless/mwifiex/11n_aggr.c
··· 100 100 struct sk_buff *skb) 101 101 { 102 102 struct txpd *local_tx_pd; 103 + struct mwifiex_txinfo *tx_info = MWIFIEX_SKB_TXCB(skb); 103 104 104 105 skb_push(skb, sizeof(*local_tx_pd)); 105 106 ··· 118 117 local_tx_pd->tx_pkt_type = cpu_to_le16(PKT_TYPE_AMSDU); 119 118 local_tx_pd->tx_pkt_length = cpu_to_le16(skb->len - 120 119 sizeof(*local_tx_pd)); 120 + 121 + if (tx_info->flags & MWIFIEX_BUF_FLAG_TDLS_PKT) 122 + local_tx_pd->flags |= MWIFIEX_TXPD_FLAGS_TDLS_PACKET; 121 123 122 124 if (local_tx_pd->tx_control == 0) 123 125 /* TxCtrl set by user or default */ ··· 187 183 188 184 tx_info_aggr->bss_type = tx_info_src->bss_type; 189 185 tx_info_aggr->bss_num = tx_info_src->bss_num; 186 + 187 + if (tx_info_src->flags & MWIFIEX_BUF_FLAG_TDLS_PKT) 188 + tx_info_aggr->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT; 190 189 skb_aggr->priority = skb_src->priority; 191 190 192 191 do_gettimeofday(&tv);
+9 -10
drivers/net/wireless/mwifiex/cfg80211.c
··· 994 994 */ 995 995 static int 996 996 mwifiex_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, 997 - u8 *mac, struct station_info *sinfo) 997 + const u8 *mac, struct station_info *sinfo) 998 998 { 999 999 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 1000 1000 ··· 1270 1270 */ 1271 1271 static int 1272 1272 mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, 1273 - u8 *mac) 1273 + const u8 *mac) 1274 1274 { 1275 1275 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 1276 1276 struct mwifiex_sta_node *sta_node; ··· 2629 2629 */ 2630 2630 static int 2631 2631 mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, 2632 - u8 *peer, u8 action_code, u8 dialog_token, 2632 + const u8 *peer, u8 action_code, u8 dialog_token, 2633 2633 u16 status_code, u32 peer_capability, 2634 2634 const u8 *extra_ies, size_t extra_ies_len) 2635 2635 { ··· 2701 2701 2702 2702 static int 2703 2703 mwifiex_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, 2704 - u8 *peer, enum nl80211_tdls_operation action) 2704 + const u8 *peer, enum nl80211_tdls_operation action) 2705 2705 { 2706 2706 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 2707 2707 ··· 2748 2748 } 2749 2749 2750 2750 static int 2751 - mwifiex_cfg80211_add_station(struct wiphy *wiphy, 2752 - struct net_device *dev, 2753 - u8 *mac, struct station_parameters *params) 2751 + mwifiex_cfg80211_add_station(struct wiphy *wiphy, struct net_device *dev, 2752 + const u8 *mac, struct station_parameters *params) 2754 2753 { 2755 2754 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 2756 2755 ··· 2764 2765 } 2765 2766 2766 2767 static int 2767 - mwifiex_cfg80211_change_station(struct wiphy *wiphy, 2768 - struct net_device *dev, 2769 - u8 *mac, struct station_parameters *params) 2768 + mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, 2769 + const u8 *mac, 2770 + struct station_parameters *params) 2770 2771 { 2771 2772 int ret; 2772 2773 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
+22 -1
drivers/net/wireless/mwifiex/fw.h
··· 169 169 #define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 146) 170 170 #define TLV_TYPE_COALESCE_RULE (PROPRIETARY_TLV_BASE_ID + 154) 171 171 #define TLV_TYPE_KEY_PARAM_V2 (PROPRIETARY_TLV_BASE_ID + 156) 172 + #define TLV_TYPE_TDLS_IDLE_TIMEOUT (PROPRIETARY_TLV_BASE_ID + 194) 172 173 #define TLV_TYPE_FW_API_REV (PROPRIETARY_TLV_BASE_ID + 199) 173 174 174 175 #define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048 ··· 230 229 #define ISENABLED_40MHZ_INTOLERANT(Dot11nDevCap) (Dot11nDevCap & BIT(8)) 231 230 #define ISSUPP_RXLDPC(Dot11nDevCap) (Dot11nDevCap & BIT(22)) 232 231 #define ISSUPP_BEAMFORMING(Dot11nDevCap) (Dot11nDevCap & BIT(30)) 232 + #define ISALLOWED_CHANWIDTH40(ht_param) (ht_param & BIT(2)) 233 233 234 234 /* httxcfg bitmap 235 235 * 0 reserved ··· 489 487 #define EVENT_UAP_MIC_COUNTERMEASURES 0x0000004c 490 488 #define EVENT_HOSTWAKE_STAIE 0x0000004d 491 489 #define EVENT_CHANNEL_SWITCH_ANN 0x00000050 490 + #define EVENT_TDLS_GENERIC_EVENT 0x00000052 492 491 #define EVENT_EXT_SCAN_REPORT 0x00000058 493 492 #define EVENT_REMAIN_ON_CHAN_EXPIRED 0x0000005f 494 493 ··· 522 519 #define ACT_TDLS_DELETE 0x00 523 520 #define ACT_TDLS_CREATE 0x01 524 521 #define ACT_TDLS_CONFIG 0x02 522 + #define TDLS_EVENT_LINK_TEAR_DOWN 3 525 523 526 524 #define MWIFIEX_FW_V15 15 527 525 ··· 539 535 #define MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET 0x01 540 536 #define MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET 0x08 541 537 #define MWIFIEX_TXPD_FLAGS_TDLS_PACKET 0x10 538 + #define MWIFIEX_RXPD_FLAGS_TDLS_PACKET 0x01 542 539 543 540 struct txpd { 544 541 u8 bss_type; ··· 582 577 * [Bit 7] Reserved 583 578 */ 584 579 u8 ht_info; 585 - u8 reserved; 580 + u8 flags; 586 581 } __packed; 587 582 588 583 struct uap_txpd { ··· 712 707 struct mwifiex_ie_types_header header; 713 708 u8 ie[MWIFIEX_MAX_VSIE_LEN]; 714 709 }; 710 + 711 + #define MWIFIEX_TDLS_IDLE_TIMEOUT 60 712 + 713 + struct mwifiex_ie_types_tdls_idle_timeout { 714 + struct mwifiex_ie_types_header header; 715 + __le16 value; 716 + } __packed; 715 717 716 718 struct mwifiex_ie_types_rsn_param_set { 717 719 struct mwifiex_ie_types_header header; ··· 1755 1743 struct host_cmd_ds_802_11_subsc_evt { 1756 1744 __le16 action; 1757 1745 __le16 events; 1746 + } __packed; 1747 + 1748 + struct mwifiex_tdls_generic_event { 1749 + __le16 type; 1750 + u8 peer_mac[ETH_ALEN]; 1751 + union { 1752 + __le16 reason_code; 1753 + __le16 reserved; 1754 + } u; 1758 1755 } __packed; 1759 1756 1760 1757 struct mwifiex_ie {
+10 -12
drivers/net/wireless/mwifiex/main.h
··· 910 910 struct sk_buff *skb); 911 911 int mwifiex_process_sta_event(struct mwifiex_private *); 912 912 int mwifiex_process_uap_event(struct mwifiex_private *); 913 - struct mwifiex_sta_node * 914 - mwifiex_get_sta_entry(struct mwifiex_private *priv, u8 *mac); 915 913 void mwifiex_delete_all_station_list(struct mwifiex_private *priv); 916 914 void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb); 917 915 void *mwifiex_process_uap_txpd(struct mwifiex_private *, struct sk_buff *skb); ··· 1218 1220 extern const struct ethtool_ops mwifiex_ethtool_ops; 1219 1221 1220 1222 void mwifiex_del_all_sta_list(struct mwifiex_private *priv); 1221 - void mwifiex_del_sta_entry(struct mwifiex_private *priv, u8 *mac); 1223 + void mwifiex_del_sta_entry(struct mwifiex_private *priv, const u8 *mac); 1222 1224 void 1223 1225 mwifiex_set_sta_ht_cap(struct mwifiex_private *priv, const u8 *ies, 1224 1226 int ies_len, struct mwifiex_sta_node *node); 1225 1227 struct mwifiex_sta_node * 1226 - mwifiex_add_sta_entry(struct mwifiex_private *priv, u8 *mac); 1228 + mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac); 1227 1229 struct mwifiex_sta_node * 1228 - mwifiex_get_sta_entry(struct mwifiex_private *priv, u8 *mac); 1229 - int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, u8 *peer, 1230 + mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac); 1231 + int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer, 1230 1232 u8 action_code, u8 dialog_token, 1231 1233 u16 status_code, const u8 *extra_ies, 1232 1234 size_t extra_ies_len); 1233 - int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, 1234 - u8 *peer, u8 action_code, u8 dialog_token, 1235 - u16 status_code, const u8 *extra_ies, 1236 - size_t extra_ies_len); 1235 + int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer, 1236 + u8 action_code, u8 dialog_token, 1237 + u16 status_code, const u8 *extra_ies, 1238 + size_t extra_ies_len); 1237 1239 void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv, 1238 1240 u8 *buf, int len); 1239 - int mwifiex_tdls_oper(struct mwifiex_private *priv, u8 *peer, u8 action); 1240 - int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, u8 *mac); 1241 + int mwifiex_tdls_oper(struct mwifiex_private *priv, const u8 *peer, u8 action); 1242 + int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, const u8 *mac); 1241 1243 void mwifiex_disable_all_tdls_links(struct mwifiex_private *priv); 1242 1244 bool mwifiex_is_bss_in_11ac_mode(struct mwifiex_private *priv); 1243 1245 u8 mwifiex_get_center_freq_index(struct mwifiex_private *priv, u8 band,
+1
drivers/net/wireless/mwifiex/pcie.c
··· 1071 1071 * is mapped to PCI device memory. Tx ring pointers are advanced accordingly. 1072 1072 * Download ready interrupt to FW is deffered if Tx ring is not full and 1073 1073 * additional payload can be accomodated. 1074 + * Caller must ensure tx_param parameter to this function is not NULL. 1074 1075 */ 1075 1076 static int 1076 1077 mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb,
+5 -1
drivers/net/wireless/mwifiex/sdio.c
··· 1678 1678 if (ret) { 1679 1679 if (type == MWIFIEX_TYPE_CMD) 1680 1680 adapter->cmd_sent = false; 1681 - if (type == MWIFIEX_TYPE_DATA) 1681 + if (type == MWIFIEX_TYPE_DATA) { 1682 1682 adapter->data_sent = false; 1683 + /* restore curr_wr_port in error cases */ 1684 + card->curr_wr_port = port; 1685 + card->mp_wr_bitmap |= (u32)(1 << card->curr_wr_port); 1686 + } 1683 1687 } else { 1684 1688 if (type == MWIFIEX_TYPE_DATA) { 1685 1689 if (!(card->mp_wr_bitmap & (1 << card->curr_wr_port)))
+7
drivers/net/wireless/mwifiex/sta_cmd.c
··· 1546 1546 struct mwifiex_ie_types_extcap *extcap; 1547 1547 struct mwifiex_ie_types_vhtcap *vht_capab; 1548 1548 struct mwifiex_ie_types_aid *aid; 1549 + struct mwifiex_ie_types_tdls_idle_timeout *timeout; 1549 1550 u8 *pos, qos_info; 1550 1551 u16 config_len = 0; 1551 1552 struct station_parameters *params = priv->sta_params; ··· 1643 1642 aid->aid = cpu_to_le16(params->aid); 1644 1643 config_len += sizeof(struct mwifiex_ie_types_aid); 1645 1644 } 1645 + 1646 + timeout = (void *)(pos + config_len); 1647 + timeout->header.type = cpu_to_le16(TLV_TYPE_TDLS_IDLE_TIMEOUT); 1648 + timeout->header.len = cpu_to_le16(sizeof(timeout->value)); 1649 + timeout->value = cpu_to_le16(MWIFIEX_TDLS_IDLE_TIMEOUT); 1650 + config_len += sizeof(struct mwifiex_ie_types_tdls_idle_timeout); 1646 1651 1647 1652 break; 1648 1653 default:
+12 -6
drivers/net/wireless/mwifiex/sta_cmdresp.c
··· 865 865 866 866 switch (action) { 867 867 case ACT_TDLS_DELETE: 868 - if (reason) 869 - dev_err(priv->adapter->dev, 870 - "TDLS link delete for %pM failed: reason %d\n", 871 - cmd_tdls_oper->peer_mac, reason); 872 - else 868 + if (reason) { 869 + if (!node || reason == TDLS_ERR_LINK_NONEXISTENT) 870 + dev_dbg(priv->adapter->dev, 871 + "TDLS link delete for %pM failed: reason %d\n", 872 + cmd_tdls_oper->peer_mac, reason); 873 + else 874 + dev_err(priv->adapter->dev, 875 + "TDLS link delete for %pM failed: reason %d\n", 876 + cmd_tdls_oper->peer_mac, reason); 877 + } else { 873 878 dev_dbg(priv->adapter->dev, 874 - "TDLS link config for %pM successful\n", 879 + "TDLS link delete for %pM successful\n", 875 880 cmd_tdls_oper->peer_mac); 881 + } 876 882 break; 877 883 case ACT_TDLS_CREATE: 878 884 if (reason) {
+44
drivers/net/wireless/mwifiex/sta_event.c
··· 134 134 netif_carrier_off(priv->netdev); 135 135 } 136 136 137 + static int mwifiex_parse_tdls_event(struct mwifiex_private *priv, 138 + struct sk_buff *event_skb) 139 + { 140 + int ret = 0; 141 + struct mwifiex_adapter *adapter = priv->adapter; 142 + struct mwifiex_sta_node *sta_ptr; 143 + struct mwifiex_tdls_generic_event *tdls_evt = 144 + (void *)event_skb->data + sizeof(adapter->event_cause); 145 + 146 + /* reserved 2 bytes are not mandatory in tdls event */ 147 + if (event_skb->len < (sizeof(struct mwifiex_tdls_generic_event) - 148 + sizeof(u16) - sizeof(adapter->event_cause))) { 149 + dev_err(adapter->dev, "Invalid event length!\n"); 150 + return -1; 151 + } 152 + 153 + sta_ptr = mwifiex_get_sta_entry(priv, tdls_evt->peer_mac); 154 + if (!sta_ptr) { 155 + dev_err(adapter->dev, "cannot get sta entry!\n"); 156 + return -1; 157 + } 158 + 159 + switch (le16_to_cpu(tdls_evt->type)) { 160 + case TDLS_EVENT_LINK_TEAR_DOWN: 161 + cfg80211_tdls_oper_request(priv->netdev, 162 + tdls_evt->peer_mac, 163 + NL80211_TDLS_TEARDOWN, 164 + le16_to_cpu(tdls_evt->u.reason_code), 165 + GFP_KERNEL); 166 + ret = mwifiex_tdls_oper(priv, tdls_evt->peer_mac, 167 + MWIFIEX_TDLS_DISABLE_LINK); 168 + queue_work(adapter->workqueue, &adapter->main_work); 169 + break; 170 + default: 171 + break; 172 + } 173 + 174 + return ret; 175 + } 176 + 137 177 /* 138 178 * This function handles events generated by firmware. 139 179 * ··· 497 457 HostCmd_ACT_GEN_SET, 0, 498 458 priv->curr_bss_params.bss_descriptor.mac_address, 499 459 false); 460 + break; 461 + 462 + case EVENT_TDLS_GENERIC_EVENT: 463 + ret = mwifiex_parse_tdls_event(priv, adapter->event_skb); 500 464 break; 501 465 502 466 default:
+14 -2
drivers/net/wireless/mwifiex/sta_rx.c
··· 183 183 struct rx_packet_hdr *rx_pkt_hdr; 184 184 u8 ta[ETH_ALEN]; 185 185 u16 rx_pkt_type, rx_pkt_offset, rx_pkt_length, seq_num; 186 + struct mwifiex_sta_node *sta_ptr; 186 187 187 188 local_rx_pd = (struct rxpd *) (skb->data); 188 189 rx_pkt_type = le16_to_cpu(local_rx_pd->rx_pkt_type); ··· 214 213 * If the packet is not an unicast packet then send the packet 215 214 * directly to os. Don't pass thru rx reordering 216 215 */ 217 - if (!IS_11N_ENABLED(priv) || 216 + if ((!IS_11N_ENABLED(priv) && 217 + !(ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) && 218 + !(local_rx_pd->flags & MWIFIEX_RXPD_FLAGS_TDLS_PACKET))) || 218 219 !ether_addr_equal_unaligned(priv->curr_addr, rx_pkt_hdr->eth803_hdr.h_dest)) { 219 220 mwifiex_process_rx_packet(priv, skb); 220 221 return ret; 221 222 } 222 223 223 - if (mwifiex_queuing_ra_based(priv)) { 224 + if (mwifiex_queuing_ra_based(priv) || 225 + (ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) && 226 + local_rx_pd->flags & MWIFIEX_RXPD_FLAGS_TDLS_PACKET)) { 224 227 memcpy(ta, rx_pkt_hdr->eth803_hdr.h_source, ETH_ALEN); 228 + if (local_rx_pd->flags & MWIFIEX_RXPD_FLAGS_TDLS_PACKET && 229 + local_rx_pd->priority < MAX_NUM_TID) { 230 + sta_ptr = mwifiex_get_sta_entry(priv, ta); 231 + if (sta_ptr) 232 + sta_ptr->rx_seq[local_rx_pd->priority] = 233 + le16_to_cpu(local_rx_pd->seq_num); 234 + } 225 235 } else { 226 236 if (rx_pkt_type != PKT_TYPE_BAR) 227 237 priv->rx_seq[local_rx_pd->priority] = seq_num;
+3 -1
drivers/net/wireless/mwifiex/sta_tx.c
··· 128 128 { 129 129 struct mwifiex_adapter *adapter = priv->adapter; 130 130 struct txpd *local_tx_pd; 131 + struct mwifiex_tx_param tx_param; 131 132 /* sizeof(struct txpd) + Interface specific header */ 132 133 #define NULL_PACKET_HDR 64 133 134 u32 data_len = NULL_PACKET_HDR; ··· 169 168 skb, NULL); 170 169 } else { 171 170 skb_push(skb, INTF_HEADER_LEN); 171 + tx_param.next_pkt_len = 0; 172 172 ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, 173 - skb, NULL); 173 + skb, &tx_param); 174 174 } 175 175 switch (ret) { 176 176 case -EBUSY:
+77 -20
drivers/net/wireless/mwifiex/tdls.c
··· 25 25 #define TDLS_RESP_FIX_LEN 8 26 26 #define TDLS_CONFIRM_FIX_LEN 6 27 27 28 - static void 29 - mwifiex_restore_tdls_packets(struct mwifiex_private *priv, u8 *mac, u8 status) 28 + static void mwifiex_restore_tdls_packets(struct mwifiex_private *priv, 29 + const u8 *mac, u8 status) 30 30 { 31 31 struct mwifiex_ra_list_tbl *ra_list; 32 32 struct list_head *tid_list; ··· 84 84 return; 85 85 } 86 86 87 - static void mwifiex_hold_tdls_packets(struct mwifiex_private *priv, u8 *mac) 87 + static void mwifiex_hold_tdls_packets(struct mwifiex_private *priv, 88 + const u8 *mac) 88 89 { 89 90 struct mwifiex_ra_list_tbl *ra_list; 90 91 struct list_head *ra_list_head; ··· 186 185 return 0; 187 186 } 188 187 188 + static int 189 + mwifiex_tdls_add_ht_oper(struct mwifiex_private *priv, const u8 *mac, 190 + u8 vht_enabled, struct sk_buff *skb) 191 + { 192 + struct ieee80211_ht_operation *ht_oper; 193 + struct mwifiex_sta_node *sta_ptr; 194 + struct mwifiex_bssdescriptor *bss_desc = 195 + &priv->curr_bss_params.bss_descriptor; 196 + u8 *pos; 197 + 198 + sta_ptr = mwifiex_get_sta_entry(priv, mac); 199 + if (unlikely(!sta_ptr)) { 200 + dev_warn(priv->adapter->dev, 201 + "TDLS peer station not found in list\n"); 202 + return -1; 203 + } 204 + 205 + pos = (void *)skb_put(skb, sizeof(struct ieee80211_ht_operation) + 2); 206 + *pos++ = WLAN_EID_HT_OPERATION; 207 + *pos++ = sizeof(struct ieee80211_ht_operation); 208 + ht_oper = (void *)pos; 209 + 210 + ht_oper->primary_chan = bss_desc->channel; 211 + 212 + /* follow AP's channel bandwidth */ 213 + if (ISSUPP_CHANWIDTH40(priv->adapter->hw_dot_11n_dev_cap) && 214 + bss_desc->bcn_ht_cap && 215 + ISALLOWED_CHANWIDTH40(bss_desc->bcn_ht_oper->ht_param)) 216 + ht_oper->ht_param = bss_desc->bcn_ht_oper->ht_param; 217 + 218 + if (vht_enabled) { 219 + ht_oper->ht_param = 220 + mwifiex_get_sec_chan_offset(bss_desc->channel); 221 + ht_oper->ht_param |= BIT(2); 222 + } 223 + 224 + memcpy(&sta_ptr->tdls_cap.ht_oper, ht_oper, 225 + sizeof(struct ieee80211_ht_operation)); 226 + 227 + return 0; 228 + } 229 + 189 230 static int mwifiex_tdls_add_vht_oper(struct mwifiex_private *priv, 190 - u8 *mac, struct sk_buff *skb) 231 + const u8 *mac, struct sk_buff *skb) 191 232 { 192 233 struct mwifiex_bssdescriptor *bss_desc; 193 234 struct ieee80211_vht_operation *vht_oper; ··· 368 325 } 369 326 370 327 static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv, 371 - u8 *peer, u8 action_code, u8 dialog_token, 372 - u16 status_code, struct sk_buff *skb) 328 + const u8 *peer, u8 action_code, 329 + u8 dialog_token, 330 + u16 status_code, struct sk_buff *skb) 373 331 { 374 332 struct ieee80211_tdls_data *tf; 375 333 int ret; ··· 472 428 dev_kfree_skb_any(skb); 473 429 return ret; 474 430 } 431 + ret = mwifiex_tdls_add_ht_oper(priv, peer, 1, skb); 432 + if (ret) { 433 + dev_kfree_skb_any(skb); 434 + return ret; 435 + } 436 + } else { 437 + ret = mwifiex_tdls_add_ht_oper(priv, peer, 0, skb); 438 + if (ret) { 439 + dev_kfree_skb_any(skb); 440 + return ret; 441 + } 475 442 } 476 443 break; 477 444 ··· 508 453 } 509 454 510 455 static void 511 - mwifiex_tdls_add_link_ie(struct sk_buff *skb, u8 *src_addr, u8 *peer, u8 *bssid) 456 + mwifiex_tdls_add_link_ie(struct sk_buff *skb, const u8 *src_addr, 457 + const u8 *peer, const u8 *bssid) 512 458 { 513 459 struct ieee80211_tdls_lnkie *lnkid; 514 460 ··· 523 467 memcpy(lnkid->resp_sta, peer, ETH_ALEN); 524 468 } 525 469 526 - int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, 527 - u8 *peer, u8 action_code, u8 dialog_token, 470 + int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer, 471 + u8 action_code, u8 dialog_token, 528 472 u16 status_code, const u8 *extra_ies, 529 473 size_t extra_ies_len) 530 474 { ··· 616 560 } 617 561 618 562 static int 619 - mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv, u8 *peer, 563 + mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv, 564 + const u8 *peer, 620 565 u8 action_code, u8 dialog_token, 621 566 u16 status_code, struct sk_buff *skb) 622 567 { ··· 695 638 return 0; 696 639 } 697 640 698 - int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, 699 - u8 *peer, u8 action_code, u8 dialog_token, 700 - u16 status_code, const u8 *extra_ies, 701 - size_t extra_ies_len) 641 + int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer, 642 + u8 action_code, u8 dialog_token, 643 + u16 status_code, const u8 *extra_ies, 644 + size_t extra_ies_len) 702 645 { 703 646 struct sk_buff *skb; 704 647 struct mwifiex_txinfo *tx_info; ··· 905 848 } 906 849 907 850 static int 908 - mwifiex_tdls_process_config_link(struct mwifiex_private *priv, u8 *peer) 851 + mwifiex_tdls_process_config_link(struct mwifiex_private *priv, const u8 *peer) 909 852 { 910 853 struct mwifiex_sta_node *sta_ptr; 911 854 struct mwifiex_ds_tdls_oper tdls_oper; ··· 926 869 } 927 870 928 871 static int 929 - mwifiex_tdls_process_create_link(struct mwifiex_private *priv, u8 *peer) 872 + mwifiex_tdls_process_create_link(struct mwifiex_private *priv, const u8 *peer) 930 873 { 931 874 struct mwifiex_sta_node *sta_ptr; 932 875 struct mwifiex_ds_tdls_oper tdls_oper; ··· 953 896 } 954 897 955 898 static int 956 - mwifiex_tdls_process_disable_link(struct mwifiex_private *priv, u8 *peer) 899 + mwifiex_tdls_process_disable_link(struct mwifiex_private *priv, const u8 *peer) 957 900 { 958 901 struct mwifiex_sta_node *sta_ptr; 959 902 struct mwifiex_ds_tdls_oper tdls_oper; ··· 982 925 } 983 926 984 927 static int 985 - mwifiex_tdls_process_enable_link(struct mwifiex_private *priv, u8 *peer) 928 + mwifiex_tdls_process_enable_link(struct mwifiex_private *priv, const u8 *peer) 986 929 { 987 930 struct mwifiex_sta_node *sta_ptr; 988 931 struct ieee80211_mcs_info mcs; ··· 1039 982 return 0; 1040 983 } 1041 984 1042 - int mwifiex_tdls_oper(struct mwifiex_private *priv, u8 *peer, u8 action) 985 + int mwifiex_tdls_oper(struct mwifiex_private *priv, const u8 *peer, u8 action) 1043 986 { 1044 987 switch (action) { 1045 988 case MWIFIEX_TDLS_ENABLE_LINK: ··· 1054 997 return 0; 1055 998 } 1056 999 1057 - int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, u8 *mac) 1000 + int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, const u8 *mac) 1058 1001 { 1059 1002 struct mwifiex_sta_node *sta_ptr; 1060 1003
+3 -3
drivers/net/wireless/mwifiex/util.c
··· 259 259 * NULL is returned if station entry is not found in associated STA list. 260 260 */ 261 261 struct mwifiex_sta_node * 262 - mwifiex_get_sta_entry(struct mwifiex_private *priv, u8 *mac) 262 + mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac) 263 263 { 264 264 struct mwifiex_sta_node *node; 265 265 ··· 280 280 * If received mac address is NULL, NULL is returned. 281 281 */ 282 282 struct mwifiex_sta_node * 283 - mwifiex_add_sta_entry(struct mwifiex_private *priv, u8 *mac) 283 + mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac) 284 284 { 285 285 struct mwifiex_sta_node *node; 286 286 unsigned long flags; ··· 332 332 } 333 333 334 334 /* This function will delete a station entry from station list */ 335 - void mwifiex_del_sta_entry(struct mwifiex_private *priv, u8 *mac) 335 + void mwifiex_del_sta_entry(struct mwifiex_private *priv, const u8 *mac) 336 336 { 337 337 struct mwifiex_sta_node *node; 338 338 unsigned long flags;
+6 -6
drivers/net/wireless/mwifiex/wmm.c
··· 92 92 * The function also initializes the list with the provided RA. 93 93 */ 94 94 static struct mwifiex_ra_list_tbl * 95 - mwifiex_wmm_allocate_ralist_node(struct mwifiex_adapter *adapter, u8 *ra) 95 + mwifiex_wmm_allocate_ralist_node(struct mwifiex_adapter *adapter, const u8 *ra) 96 96 { 97 97 struct mwifiex_ra_list_tbl *ra_list; 98 98 ··· 139 139 * This function allocates and adds a RA list for all TIDs 140 140 * with the given RA. 141 141 */ 142 - void 143 - mwifiex_ralist_add(struct mwifiex_private *priv, u8 *ra) 142 + void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra) 144 143 { 145 144 int i; 146 145 struct mwifiex_ra_list_tbl *ra_list; ··· 565 566 */ 566 567 static struct mwifiex_ra_list_tbl * 567 568 mwifiex_wmm_get_ralist_node(struct mwifiex_private *priv, u8 tid, 568 - u8 *ra_addr) 569 + const u8 *ra_addr) 569 570 { 570 571 struct mwifiex_ra_list_tbl *ra_list; 571 572 ··· 586 587 * retrieved. 587 588 */ 588 589 struct mwifiex_ra_list_tbl * 589 - mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid, u8 *ra_addr) 590 + mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid, 591 + const u8 *ra_addr) 590 592 { 591 593 struct mwifiex_ra_list_tbl *ra_list; 592 594 ··· 648 648 if (ntohs(eth_hdr->h_proto) == ETH_P_TDLS) 649 649 dev_dbg(adapter->dev, 650 650 "TDLS setup packet for %pM. Don't block\n", ra); 651 - else 651 + else if (memcmp(priv->cfg_bssid, ra, ETH_ALEN)) 652 652 tdls_status = mwifiex_get_tdls_link_status(priv, ra); 653 653 } 654 654
+3 -2
drivers/net/wireless/mwifiex/wmm.h
··· 99 99 100 100 void mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv, 101 101 struct sk_buff *skb); 102 - void mwifiex_ralist_add(struct mwifiex_private *priv, u8 *ra); 102 + void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra); 103 103 void mwifiex_rotate_priolists(struct mwifiex_private *priv, 104 104 struct mwifiex_ra_list_tbl *ra, int tid); 105 105 ··· 123 123 int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv, 124 124 const struct host_cmd_ds_command *resp); 125 125 struct mwifiex_ra_list_tbl * 126 - mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid, u8 *ra_addr); 126 + mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid, 127 + const u8 *ra_addr); 127 128 u8 mwifiex_wmm_downgrade_tid(struct mwifiex_private *priv, u32 tid); 128 129 129 130 #endif /* !_MWIFIEX_WMM_H_ */
+2 -2
drivers/net/wireless/orinoco/hw.c
··· 988 988 * tsc must be NULL or up to 8 bytes 989 989 */ 990 990 int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, 991 - int set_tx, u8 *key, u8 *rsc, size_t rsc_len, 992 - u8 *tsc, size_t tsc_len) 991 + int set_tx, const u8 *key, const u8 *rsc, 992 + size_t rsc_len, const u8 *tsc, size_t tsc_len) 993 993 { 994 994 struct { 995 995 __le16 idx;
+2 -2
drivers/net/wireless/orinoco/hw.h
··· 38 38 int __orinoco_hw_setup_wepkeys(struct orinoco_private *priv); 39 39 int __orinoco_hw_setup_enc(struct orinoco_private *priv); 40 40 int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, 41 - int set_tx, u8 *key, u8 *rsc, size_t rsc_len, 42 - u8 *tsc, size_t tsc_len); 41 + int set_tx, const u8 *key, const u8 *rsc, 42 + size_t rsc_len, const u8 *tsc, size_t tsc_len); 43 43 int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx); 44 44 int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, 45 45 struct net_device *dev,
+1 -1
drivers/net/wireless/orinoco/orinoco_usb.c
··· 1687 1687 firmware.code = fw_entry->data; 1688 1688 } 1689 1689 if (firmware.size && firmware.code) { 1690 - if (ezusb_firmware_download(upriv, &firmware)) 1690 + if (ezusb_firmware_download(upriv, &firmware) < 0) 1691 1691 goto error; 1692 1692 } else { 1693 1693 err("No firmware to download");
+2 -2
drivers/net/wireless/orinoco/wext.c
··· 52 52 priv->keys[index].seq_len = seq_len; 53 53 54 54 if (key_len) 55 - memcpy(priv->keys[index].key, key, key_len); 55 + memcpy((void *)priv->keys[index].key, key, key_len); 56 56 if (seq_len) 57 - memcpy(priv->keys[index].seq, seq, seq_len); 57 + memcpy((void *)priv->keys[index].seq, seq, seq_len); 58 58 59 59 switch (alg) { 60 60 case ORINOCO_ALG_TKIP:
+2 -2
drivers/net/wireless/rndis_wlan.c
··· 517 517 u8 key_index, bool unicast, bool multicast); 518 518 519 519 static int rndis_get_station(struct wiphy *wiphy, struct net_device *dev, 520 - u8 *mac, struct station_info *sinfo); 520 + const u8 *mac, struct station_info *sinfo); 521 521 522 522 static int rndis_dump_station(struct wiphy *wiphy, struct net_device *dev, 523 523 int idx, u8 *mac, struct station_info *sinfo); ··· 2490 2490 } 2491 2491 2492 2492 static int rndis_get_station(struct wiphy *wiphy, struct net_device *dev, 2493 - u8 *mac, struct station_info *sinfo) 2493 + const u8 *mac, struct station_info *sinfo) 2494 2494 { 2495 2495 struct rndis_wlan_private *priv = wiphy_priv(wiphy); 2496 2496 struct usbnet *usbdev = priv->usbdev;
+1
drivers/net/wireless/rsi/rsi_91x_mac80211.c
··· 656 656 case IEEE80211_AMPDU_TX_START: 657 657 common->vif_info[ii].seq_start = seq_no; 658 658 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); 659 + status = 0; 659 660 break; 660 661 661 662 case IEEE80211_AMPDU_TX_STOP_CONT:
+6
drivers/net/wireless/rt2x00/rt2x00usb.c
··· 68 68 } 69 69 } 70 70 71 + /* If the port is powered down, we get a -EPROTO error, and this 72 + * leads to a endless loop. So just say that the device is gone. 73 + */ 74 + if (status == -EPROTO) 75 + clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); 76 + 71 77 rt2x00_err(rt2x00dev, 72 78 "Vendor Request 0x%02x failed for offset 0x%04x with error %d\n", 73 79 request, offset, status);
+12 -5
drivers/net/wireless/rtl818x/rtl8180/dev.c
··· 284 284 rx_status.band = dev->conf.chandef.chan->band; 285 285 rx_status.mactime = tsft; 286 286 rx_status.flag |= RX_FLAG_MACTIME_START; 287 + if (flags & RTL818X_RX_DESC_FLAG_SPLCP) 288 + rx_status.flag |= RX_FLAG_SHORTPRE; 287 289 if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) 288 290 rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; 289 291 ··· 463 461 RTL818X_TX_DESC_FLAG_NO_ENC; 464 462 465 463 rc_flags = info->control.rates[0].flags; 464 + 465 + /* HW will perform RTS-CTS when only RTS flags is set. 466 + * HW will perform CTS-to-self when both RTS and CTS flags are set. 467 + * RTS rate and RTS duration will be used also for CTS-to-self. 468 + */ 466 469 if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) { 467 470 tx_flags |= RTL818X_TX_DESC_FLAG_RTS; 468 471 tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; 472 + rts_duration = ieee80211_rts_duration(dev, priv->vif, 473 + skb->len, info); 469 474 } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { 470 - tx_flags |= RTL818X_TX_DESC_FLAG_CTS; 475 + tx_flags |= RTL818X_TX_DESC_FLAG_RTS | RTL818X_TX_DESC_FLAG_CTS; 471 476 tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; 477 + rts_duration = ieee80211_ctstoself_duration(dev, priv->vif, 478 + skb->len, info); 472 479 } 473 - 474 - if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) 475 - rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len, 476 - info); 477 480 478 481 if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8180) { 479 482 unsigned int remainder;
+10 -1
drivers/net/wireless/rtl818x/rtl8187/dev.c
··· 253 253 flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24; 254 254 if (ieee80211_has_morefrags(tx_hdr->frame_control)) 255 255 flags |= RTL818X_TX_DESC_FLAG_MOREFRAG; 256 + 257 + /* HW will perform RTS-CTS when only RTS flags is set. 258 + * HW will perform CTS-to-self when both RTS and CTS flags are set. 259 + * RTS rate and RTS duration will be used also for CTS-to-self. 260 + */ 256 261 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) { 257 262 flags |= RTL818X_TX_DESC_FLAG_RTS; 258 263 flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; 259 264 rts_dur = ieee80211_rts_duration(dev, priv->vif, 260 265 skb->len, info); 261 266 } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { 262 - flags |= RTL818X_TX_DESC_FLAG_CTS; 267 + flags |= RTL818X_TX_DESC_FLAG_RTS | RTL818X_TX_DESC_FLAG_CTS; 263 268 flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; 269 + rts_dur = ieee80211_ctstoself_duration(dev, priv->vif, 270 + skb->len, info); 264 271 } 265 272 266 273 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { ··· 388 381 rx_status.freq = dev->conf.chandef.chan->center_freq; 389 382 rx_status.band = dev->conf.chandef.chan->band; 390 383 rx_status.flag |= RX_FLAG_MACTIME_START; 384 + if (flags & RTL818X_RX_DESC_FLAG_SPLCP) 385 + rx_status.flag |= RX_FLAG_SHORTPRE; 391 386 if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) 392 387 rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; 393 388 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
-20
drivers/net/wireless/rtlwifi/rtl8188ee/hw.c
··· 2515 2515 void rtl88ee_resume(struct ieee80211_hw *hw) 2516 2516 { 2517 2517 } 2518 - 2519 - /* Turn on AAP (RCR:bit 0) for promicuous mode. */ 2520 - void rtl88ee_allow_all_destaddr(struct ieee80211_hw *hw, 2521 - bool allow_all_da, bool write_into_reg) 2522 - { 2523 - struct rtl_priv *rtlpriv = rtl_priv(hw); 2524 - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 2525 - 2526 - if (allow_all_da) /* Set BIT0 */ 2527 - rtlpci->receive_config |= RCR_AAP; 2528 - else /* Clear BIT0 */ 2529 - rtlpci->receive_config &= ~RCR_AAP; 2530 - 2531 - if (write_into_reg) 2532 - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); 2533 - 2534 - RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, 2535 - "receive_config = 0x%08X, write_into_reg =%d\n", 2536 - rtlpci->receive_config, write_into_reg); 2537 - }
-2
drivers/net/wireless/rtlwifi/rtl8188ee/hw.h
··· 61 61 void rtl8188ee_bt_hw_init(struct ieee80211_hw *hw); 62 62 void rtl88ee_suspend(struct ieee80211_hw *hw); 63 63 void rtl88ee_resume(struct ieee80211_hw *hw); 64 - void rtl88ee_allow_all_destaddr(struct ieee80211_hw *hw, 65 - bool allow_all_da, bool write_into_reg); 66 64 void rtl88ee_fw_clk_off_timer_callback(unsigned long data); 67 65 68 66 #endif
+4 -1
drivers/net/wireless/rtlwifi/rtl8188ee/sw.c
··· 93 93 u8 tid; 94 94 95 95 rtl8188ee_bt_reg_init(hw); 96 + rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; 96 97 97 98 rtlpriv->dm.dm_initialgain_enable = 1; 98 99 rtlpriv->dm.dm_flag = 0; ··· 255 254 .enable_hw_sec = rtl88ee_enable_hw_security_config, 256 255 .set_key = rtl88ee_set_key, 257 256 .init_sw_leds = rtl88ee_init_sw_leds, 258 - .allow_all_destaddr = rtl88ee_allow_all_destaddr, 259 257 .get_bbreg = rtl88e_phy_query_bb_reg, 260 258 .set_bbreg = rtl88e_phy_set_bb_reg, 261 259 .get_rfreg = rtl88e_phy_query_rf_reg, ··· 266 266 .inactiveps = true, 267 267 .swctrl_lps = false, 268 268 .fwctrl_lps = true, 269 + .msi_support = false, 269 270 .debug = DBG_EMERG, 270 271 }; 271 272 ··· 383 382 module_param_named(ips, rtl88ee_mod_params.inactiveps, bool, 0444); 384 383 module_param_named(swlps, rtl88ee_mod_params.swctrl_lps, bool, 0444); 385 384 module_param_named(fwlps, rtl88ee_mod_params.fwctrl_lps, bool, 0444); 385 + module_param_named(msi, rtl88ee_mod_params.msi_support, bool, 0444); 386 386 MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); 387 387 MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); 388 388 MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); 389 389 MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); 390 + MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 0)\n"); 390 391 MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); 391 392 392 393 static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
-21
drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
··· 2423 2423 void rtl92ce_resume(struct ieee80211_hw *hw) 2424 2424 { 2425 2425 } 2426 - 2427 - /* Turn on AAP (RCR:bit 0) for promicuous mode. */ 2428 - void rtl92ce_allow_all_destaddr(struct ieee80211_hw *hw, 2429 - bool allow_all_da, bool write_into_reg) 2430 - { 2431 - struct rtl_priv *rtlpriv = rtl_priv(hw); 2432 - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 2433 - 2434 - if (allow_all_da) {/* Set BIT0 */ 2435 - rtlpci->receive_config |= RCR_AAP; 2436 - } else {/* Clear BIT0 */ 2437 - rtlpci->receive_config &= ~RCR_AAP; 2438 - } 2439 - 2440 - if (write_into_reg) 2441 - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); 2442 - 2443 - RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, 2444 - "receive_config=0x%08X, write_into_reg=%d\n", 2445 - rtlpci->receive_config, write_into_reg); 2446 - }
-2
drivers/net/wireless/rtlwifi/rtl8192ce/hw.h
··· 76 76 void rtl8192ce_bt_hw_init(struct ieee80211_hw *hw); 77 77 void rtl92ce_suspend(struct ieee80211_hw *hw); 78 78 void rtl92ce_resume(struct ieee80211_hw *hw); 79 - void rtl92ce_allow_all_destaddr(struct ieee80211_hw *hw, 80 - bool allow_all_da, bool write_into_reg); 81 79 82 80 #endif
-1
drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
··· 229 229 .enable_hw_sec = rtl92ce_enable_hw_security_config, 230 230 .set_key = rtl92ce_set_key, 231 231 .init_sw_leds = rtl92ce_init_sw_leds, 232 - .allow_all_destaddr = rtl92ce_allow_all_destaddr, 233 232 .get_bbreg = rtl92c_phy_query_bb_reg, 234 233 .set_bbreg = rtl92c_phy_set_bb_reg, 235 234 .set_rfreg = rtl92ce_phy_set_rf_reg,
+1 -1
drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
··· 511 511 pr_info("MAC auto ON okay!\n"); 512 512 break; 513 513 } 514 - if (pollingCount++ > 100) { 514 + if (pollingCount++ > 1000) { 515 515 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, 516 516 "Failed to polling REG_APS_FSMCO[APFM_ONMAC] done!\n"); 517 517 return -ENODEV;
-20
drivers/net/wireless/rtlwifi/rtl8192se/hw.c
··· 2544 2544 pci_write_config_dword(rtlpci->pdev, 0x40, 2545 2545 val & 0xffff00ff); 2546 2546 } 2547 - 2548 - /* Turn on AAP (RCR:bit 0) for promicuous mode. */ 2549 - void rtl92se_allow_all_destaddr(struct ieee80211_hw *hw, 2550 - bool allow_all_da, bool write_into_reg) 2551 - { 2552 - struct rtl_priv *rtlpriv = rtl_priv(hw); 2553 - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 2554 - 2555 - if (allow_all_da) /* Set BIT0 */ 2556 - rtlpci->receive_config |= RCR_AAP; 2557 - else /* Clear BIT0 */ 2558 - rtlpci->receive_config &= ~RCR_AAP; 2559 - 2560 - if (write_into_reg) 2561 - rtl_write_dword(rtlpriv, RCR, rtlpci->receive_config); 2562 - 2563 - RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, 2564 - "receive_config=0x%08X, write_into_reg=%d\n", 2565 - rtlpci->receive_config, write_into_reg); 2566 - }
-2
drivers/net/wireless/rtlwifi/rtl8192se/hw.h
··· 74 74 u8 enc_algo, bool is_wepkey, bool clear_all); 75 75 void rtl92se_suspend(struct ieee80211_hw *hw); 76 76 void rtl92se_resume(struct ieee80211_hw *hw); 77 - void rtl92se_allow_all_destaddr(struct ieee80211_hw *hw, 78 - bool allow_all_da, bool write_into_reg); 79 77 80 78 #endif
-1
drivers/net/wireless/rtlwifi/rtl8192se/sw.c
··· 290 290 .enable_hw_sec = rtl92se_enable_hw_security_config, 291 291 .set_key = rtl92se_set_key, 292 292 .init_sw_leds = rtl92se_init_sw_leds, 293 - .allow_all_destaddr = rtl92se_allow_all_destaddr, 294 293 .get_bbreg = rtl92s_phy_query_bb_reg, 295 294 .set_bbreg = rtl92s_phy_set_bb_reg, 296 295 .get_rfreg = rtl92s_phy_query_rf_reg,
-21
drivers/net/wireless/rtlwifi/rtl8723ae/hw.c
··· 2383 2383 void rtl8723ae_resume(struct ieee80211_hw *hw) 2384 2384 { 2385 2385 } 2386 - 2387 - /* Turn on AAP (RCR:bit 0) for promicuous mode. */ 2388 - void rtl8723ae_allow_all_destaddr(struct ieee80211_hw *hw, 2389 - bool allow_all_da, bool write_into_reg) 2390 - { 2391 - struct rtl_priv *rtlpriv = rtl_priv(hw); 2392 - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 2393 - 2394 - if (allow_all_da) /* Set BIT0 */ 2395 - rtlpci->receive_config |= RCR_AAP; 2396 - else /* Clear BIT0 */ 2397 - rtlpci->receive_config &= ~RCR_AAP; 2398 - 2399 - if (write_into_reg) 2400 - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); 2401 - 2402 - 2403 - RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, 2404 - "receive_config=0x%08X, write_into_reg=%d\n", 2405 - rtlpci->receive_config, write_into_reg); 2406 - }
-2
drivers/net/wireless/rtlwifi/rtl8723ae/hw.h
··· 67 67 void rtl8723ae_bt_hw_init(struct ieee80211_hw *hw); 68 68 void rtl8723ae_suspend(struct ieee80211_hw *hw); 69 69 void rtl8723ae_resume(struct ieee80211_hw *hw); 70 - void rtl8723ae_allow_all_destaddr(struct ieee80211_hw *hw, 71 - bool allow_all_da, bool write_into_reg); 72 70 73 71 #endif
-1
drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
··· 238 238 .enable_hw_sec = rtl8723ae_enable_hw_security_config, 239 239 .set_key = rtl8723ae_set_key, 240 240 .init_sw_leds = rtl8723ae_init_sw_leds, 241 - .allow_all_destaddr = rtl8723ae_allow_all_destaddr, 242 241 .get_bbreg = rtl8723_phy_query_bb_reg, 243 242 .set_bbreg = rtl8723_phy_set_bb_reg, 244 243 .get_rfreg = rtl8723ae_phy_query_rf_reg,
-20
drivers/net/wireless/rtlwifi/rtl8723be/hw.c
··· 2501 2501 void rtl8723be_resume(struct ieee80211_hw *hw) 2502 2502 { 2503 2503 } 2504 - 2505 - /* Turn on AAP (RCR:bit 0) for promicuous mode. */ 2506 - void rtl8723be_allow_all_destaddr(struct ieee80211_hw *hw, bool allow_all_da, 2507 - bool write_into_reg) 2508 - { 2509 - struct rtl_priv *rtlpriv = rtl_priv(hw); 2510 - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 2511 - 2512 - if (allow_all_da) /* Set BIT0 */ 2513 - rtlpci->receive_config |= RCR_AAP; 2514 - else /* Clear BIT0 */ 2515 - rtlpci->receive_config &= ~RCR_AAP; 2516 - 2517 - if (write_into_reg) 2518 - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); 2519 - 2520 - RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, 2521 - "receive_config = 0x%08X, write_into_reg =%d\n", 2522 - rtlpci->receive_config, write_into_reg); 2523 - }
-2
drivers/net/wireless/rtlwifi/rtl8723be/hw.h
··· 59 59 void rtl8723be_bt_hw_init(struct ieee80211_hw *hw); 60 60 void rtl8723be_suspend(struct ieee80211_hw *hw); 61 61 void rtl8723be_resume(struct ieee80211_hw *hw); 62 - void rtl8723be_allow_all_destaddr(struct ieee80211_hw *hw, bool allow_all_da, 63 - bool write_into_reg); 64 62 #endif
+4 -1
drivers/net/wireless/rtlwifi/rtl8723be/sw.c
··· 92 92 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 93 93 94 94 rtl8723be_bt_reg_init(hw); 95 - rtlpci->msi_support = false; 95 + rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; 96 96 rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer(); 97 97 98 98 rtlpriv->dm.dm_initialgain_enable = 1; ··· 253 253 .inactiveps = true, 254 254 .swctrl_lps = false, 255 255 .fwctrl_lps = true, 256 + .msi_support = false, 256 257 .debug = DBG_EMERG, 257 258 }; 258 259 ··· 366 365 module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444); 367 366 module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444); 368 367 module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444); 368 + module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444); 369 369 MODULE_PARM_DESC(swenc, "using hardware crypto (default 0 [hardware])\n"); 370 370 MODULE_PARM_DESC(ips, "using no link power save (default 1 is open)\n"); 371 371 MODULE_PARM_DESC(fwlps, "using linked fw control power save (default 1 is open)\n"); 372 + MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 0)\n"); 372 373 MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); 373 374 374 375 static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
+4 -2
drivers/net/wireless/rtlwifi/wifi.h
··· 1960 1960 u32 regaddr, u32 bitmask); 1961 1961 void (*set_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath, 1962 1962 u32 regaddr, u32 bitmask, u32 data); 1963 - void (*allow_all_destaddr)(struct ieee80211_hw *hw, 1964 - bool allow_all_da, bool write_into_reg); 1965 1963 void (*linked_set_reg) (struct ieee80211_hw *hw); 1966 1964 void (*chk_switch_dmdp) (struct ieee80211_hw *hw); 1967 1965 void (*dualmac_easy_concurrent) (struct ieee80211_hw *hw); ··· 2028 2030 2029 2031 /* default: 1 = using linked fw power save */ 2030 2032 bool fwctrl_lps; 2033 + 2034 + /* default: 0 = not using MSI interrupts mode */ 2035 + /* submodules should set their own defalut value */ 2036 + bool msi_support; 2031 2037 }; 2032 2038 2033 2039 struct rtl_hal_usbint_cfg {
-1
drivers/net/wireless/ti/wl1251/acx.c
··· 2 2 3 3 #include <linux/module.h> 4 4 #include <linux/slab.h> 5 - #include <linux/crc7.h> 6 5 7 6 #include "wl1251.h" 8 7 #include "reg.h"
-1
drivers/net/wireless/ti/wl1251/cmd.c
··· 2 2 3 3 #include <linux/module.h> 4 4 #include <linux/slab.h> 5 - #include <linux/crc7.h> 6 5 #include <linux/etherdevice.h> 7 6 8 7 #include "wl1251.h"
+3 -2
drivers/net/wireless/ti/wl1251/event.c
··· 124 124 return ret; 125 125 } 126 126 127 - if (wl->vif && vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) { 127 + if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) { 128 128 wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT"); 129 129 130 130 /* indicate to the stack, that beacons have been lost */ 131 - ieee80211_beacon_loss(wl->vif); 131 + if (wl->vif && wl->vif->type == NL80211_IFTYPE_STATION) 132 + ieee80211_beacon_loss(wl->vif); 132 133 } 133 134 134 135 if (vector & REGAINED_BSS_EVENT_ID) {
+39 -29
drivers/net/wireless/ti/wl1251/main.c
··· 550 550 mutex_unlock(&wl->mutex); 551 551 } 552 552 553 + static int wl1251_build_null_data(struct wl1251 *wl) 554 + { 555 + struct sk_buff *skb = NULL; 556 + int size; 557 + void *ptr; 558 + int ret = -ENOMEM; 559 + 560 + if (wl->bss_type == BSS_TYPE_IBSS) { 561 + size = sizeof(struct wl12xx_null_data_template); 562 + ptr = NULL; 563 + } else { 564 + skb = ieee80211_nullfunc_get(wl->hw, wl->vif); 565 + if (!skb) 566 + goto out; 567 + size = skb->len; 568 + ptr = skb->data; 569 + } 570 + 571 + ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA, ptr, size); 572 + 573 + out: 574 + dev_kfree_skb(skb); 575 + if (ret) 576 + wl1251_warning("cmd buld null data failed: %d", ret); 577 + 578 + return ret; 579 + } 580 + 553 581 static int wl1251_build_qos_null_data(struct wl1251 *wl) 554 582 { 555 583 struct ieee80211_qos_hdr template; ··· 713 685 goto out_sleep; 714 686 715 687 wl->power_level = conf->power_level; 716 - } 717 - 718 - /* 719 - * Tell stack that connection is lost because hw encryption isn't 720 - * supported in monitor mode. 721 - * This requires temporary enabling of the hw connection monitor flag 722 - */ 723 - if ((changed & IEEE80211_CONF_CHANGE_MONITOR) && wl->vif) { 724 - wl->hw->flags |= IEEE80211_HW_CONNECTION_MONITOR; 725 - ieee80211_connection_loss(wl->vif); 726 688 } 727 689 728 690 out_sleep: ··· 1121 1103 wl->rssi_thold = bss_conf->cqm_rssi_thold; 1122 1104 } 1123 1105 1124 - if (changed & BSS_CHANGED_BSSID) { 1106 + if ((changed & BSS_CHANGED_BSSID) && 1107 + memcmp(wl->bssid, bss_conf->bssid, ETH_ALEN)) { 1125 1108 memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); 1126 1109 1127 - skb = ieee80211_nullfunc_get(wl->hw, wl->vif); 1128 - if (!skb) 1129 - goto out_sleep; 1110 + if (!is_zero_ether_addr(wl->bssid)) { 1111 + ret = wl1251_build_null_data(wl); 1112 + if (ret < 0) 1113 + goto out_sleep; 1130 1114 1131 - ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA, 1132 - skb->data, skb->len); 1133 - dev_kfree_skb(skb); 1134 - if (ret < 0) 1135 - goto out_sleep; 1115 + ret = wl1251_build_qos_null_data(wl); 1116 + if (ret < 0) 1117 + goto out_sleep; 1136 1118 1137 - ret = wl1251_build_qos_null_data(wl); 1138 - if (ret < 0) 1139 - goto out; 1140 - 1141 - if (wl->bss_type != BSS_TYPE_IBSS) { 1142 1119 ret = wl1251_join(wl, wl->bss_type, wl->channel, 1143 1120 wl->beacon_int, wl->dtim_period); 1144 1121 if (ret < 0) ··· 1142 1129 } 1143 1130 1144 1131 if (changed & BSS_CHANGED_ASSOC) { 1145 - /* Disable temporary enabled hw connection monitor flag */ 1146 - wl->hw->flags &= ~IEEE80211_HW_CONNECTION_MONITOR; 1147 - 1148 1132 if (bss_conf->assoc) { 1149 1133 wl->beacon_int = bss_conf->beacon_int; 1150 1134 ··· 1226 1216 if (ret < 0) 1227 1217 goto out_sleep; 1228 1218 1229 - ret = wl1251_join(wl, wl->bss_type, wl->beacon_int, 1230 - wl->channel, wl->dtim_period); 1219 + ret = wl1251_join(wl, wl->bss_type, wl->channel, 1220 + wl->beacon_int, wl->dtim_period); 1231 1221 1232 1222 if (ret < 0) 1233 1223 goto out_sleep;
+21 -23
drivers/net/wireless/ti/wl1251/spi.c
··· 23 23 #include <linux/irq.h> 24 24 #include <linux/module.h> 25 25 #include <linux/slab.h> 26 + #include <linux/swab.h> 26 27 #include <linux/crc7.h> 27 28 #include <linux/spi/spi.h> 28 29 #include <linux/wl12xx.h> ··· 84 83 85 84 static void wl1251_spi_wake(struct wl1251 *wl) 86 85 { 87 - u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd; 88 86 struct spi_transfer t; 89 87 struct spi_message m; 88 + u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); 90 89 91 - cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); 92 90 if (!cmd) { 93 91 wl1251_error("could not allocate cmd for spi init"); 94 92 return; 95 93 } 96 94 97 - memset(crc, 0, sizeof(crc)); 98 95 memset(&t, 0, sizeof(t)); 99 96 spi_message_init(&m); 100 97 101 98 /* Set WSPI_INIT_COMMAND 102 99 * the data is being send from the MSB to LSB 103 100 */ 104 - cmd[2] = 0xff; 105 - cmd[3] = 0xff; 106 - cmd[1] = WSPI_INIT_CMD_START | WSPI_INIT_CMD_TX; 107 - cmd[0] = 0; 108 - cmd[7] = 0; 109 - cmd[6] |= HW_ACCESS_WSPI_INIT_CMD_MASK << 3; 110 - cmd[6] |= HW_ACCESS_WSPI_FIXED_BUSY_LEN & WSPI_INIT_CMD_FIXEDBUSY_LEN; 101 + cmd[0] = 0xff; 102 + cmd[1] = 0xff; 103 + cmd[2] = WSPI_INIT_CMD_START | WSPI_INIT_CMD_TX; 104 + cmd[3] = 0; 105 + cmd[4] = 0; 106 + cmd[5] = HW_ACCESS_WSPI_INIT_CMD_MASK << 3; 107 + cmd[5] |= HW_ACCESS_WSPI_FIXED_BUSY_LEN & WSPI_INIT_CMD_FIXEDBUSY_LEN; 111 108 112 - if (HW_ACCESS_WSPI_FIXED_BUSY_LEN == 0) 113 - cmd[5] |= WSPI_INIT_CMD_DIS_FIXEDBUSY; 114 - else 115 - cmd[5] |= WSPI_INIT_CMD_EN_FIXEDBUSY; 116 - 117 - cmd[5] |= WSPI_INIT_CMD_IOD | WSPI_INIT_CMD_IP | WSPI_INIT_CMD_CS 109 + cmd[6] = WSPI_INIT_CMD_IOD | WSPI_INIT_CMD_IP | WSPI_INIT_CMD_CS 118 110 | WSPI_INIT_CMD_WSPI | WSPI_INIT_CMD_WS; 119 111 120 - crc[0] = cmd[1]; 121 - crc[1] = cmd[0]; 122 - crc[2] = cmd[7]; 123 - crc[3] = cmd[6]; 124 - crc[4] = cmd[5]; 112 + if (HW_ACCESS_WSPI_FIXED_BUSY_LEN == 0) 113 + cmd[6] |= WSPI_INIT_CMD_DIS_FIXEDBUSY; 114 + else 115 + cmd[6] |= WSPI_INIT_CMD_EN_FIXEDBUSY; 125 116 126 - cmd[4] |= crc7(0, crc, WSPI_INIT_CMD_CRC_LEN) << 1; 127 - cmd[4] |= WSPI_INIT_CMD_END; 117 + cmd[7] = crc7_be(0, cmd+2, WSPI_INIT_CMD_CRC_LEN) | WSPI_INIT_CMD_END; 118 + /* 119 + * The above is the logical order; it must actually be stored 120 + * in the buffer byte-swapped. 121 + */ 122 + __swab32s((u32 *)cmd); 123 + __swab32s((u32 *)cmd+1); 128 124 129 125 t.tx_buf = cmd; 130 126 t.len = WSPI_INIT_CMD_LEN;
+2 -2
drivers/net/wireless/ti/wlcore/debugfs.h
··· 57 57 wl, &name## _ops); \ 58 58 if (!entry || IS_ERR(entry)) \ 59 59 goto err; \ 60 - } while (0); 60 + } while (0) 61 61 62 62 63 63 #define DEBUGFS_ADD_PREFIX(prefix, name, parent) \ ··· 66 66 wl, &prefix## _## name## _ops); \ 67 67 if (!entry || IS_ERR(entry)) \ 68 68 goto err; \ 69 - } while (0); 69 + } while (0) 70 70 71 71 #define DEBUGFS_FWSTATS_FILE(sub, name, fmt, struct_type) \ 72 72 static ssize_t sub## _ ##name## _read(struct file *file, \
+1 -1
drivers/net/wireless/ti/wlcore/main.c
··· 1416 1416 1417 1417 int wl1271_rx_filter_alloc_field(struct wl12xx_rx_filter *filter, 1418 1418 u16 offset, u8 flags, 1419 - u8 *pattern, u8 len) 1419 + const u8 *pattern, u8 len) 1420 1420 { 1421 1421 struct wl12xx_rx_filter_field *field; 1422 1422
+22 -24
drivers/net/wireless/ti/wlcore/spi.c
··· 24 24 #include <linux/interrupt.h> 25 25 #include <linux/irq.h> 26 26 #include <linux/module.h> 27 + #include <linux/slab.h> 28 + #include <linux/swab.h> 27 29 #include <linux/crc7.h> 28 30 #include <linux/spi/spi.h> 29 31 #include <linux/wl12xx.h> 30 32 #include <linux/platform_device.h> 31 - #include <linux/slab.h> 32 33 33 34 #include "wlcore.h" 34 35 #include "wl12xx_80211.h" ··· 111 110 static void wl12xx_spi_init(struct device *child) 112 111 { 113 112 struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); 114 - u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd; 115 113 struct spi_transfer t; 116 114 struct spi_message m; 115 + u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); 117 116 118 - cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); 119 117 if (!cmd) { 120 118 dev_err(child->parent, 121 119 "could not allocate cmd for spi init\n"); 122 120 return; 123 121 } 124 122 125 - memset(crc, 0, sizeof(crc)); 126 123 memset(&t, 0, sizeof(t)); 127 124 spi_message_init(&m); 128 125 ··· 128 129 * Set WSPI_INIT_COMMAND 129 130 * the data is being send from the MSB to LSB 130 131 */ 131 - cmd[2] = 0xff; 132 - cmd[3] = 0xff; 133 - cmd[1] = WSPI_INIT_CMD_START | WSPI_INIT_CMD_TX; 134 - cmd[0] = 0; 135 - cmd[7] = 0; 136 - cmd[6] |= HW_ACCESS_WSPI_INIT_CMD_MASK << 3; 137 - cmd[6] |= HW_ACCESS_WSPI_FIXED_BUSY_LEN & WSPI_INIT_CMD_FIXEDBUSY_LEN; 132 + cmd[0] = 0xff; 133 + cmd[1] = 0xff; 134 + cmd[2] = WSPI_INIT_CMD_START | WSPI_INIT_CMD_TX; 135 + cmd[3] = 0; 136 + cmd[4] = 0; 137 + cmd[5] = HW_ACCESS_WSPI_INIT_CMD_MASK << 3; 138 + cmd[5] |= HW_ACCESS_WSPI_FIXED_BUSY_LEN & WSPI_INIT_CMD_FIXEDBUSY_LEN; 138 139 139 - if (HW_ACCESS_WSPI_FIXED_BUSY_LEN == 0) 140 - cmd[5] |= WSPI_INIT_CMD_DIS_FIXEDBUSY; 141 - else 142 - cmd[5] |= WSPI_INIT_CMD_EN_FIXEDBUSY; 143 - 144 - cmd[5] |= WSPI_INIT_CMD_IOD | WSPI_INIT_CMD_IP | WSPI_INIT_CMD_CS 140 + cmd[6] = WSPI_INIT_CMD_IOD | WSPI_INIT_CMD_IP | WSPI_INIT_CMD_CS 145 141 | WSPI_INIT_CMD_WSPI | WSPI_INIT_CMD_WS; 146 142 147 - crc[0] = cmd[1]; 148 - crc[1] = cmd[0]; 149 - crc[2] = cmd[7]; 150 - crc[3] = cmd[6]; 151 - crc[4] = cmd[5]; 143 + if (HW_ACCESS_WSPI_FIXED_BUSY_LEN == 0) 144 + cmd[6] |= WSPI_INIT_CMD_DIS_FIXEDBUSY; 145 + else 146 + cmd[6] |= WSPI_INIT_CMD_EN_FIXEDBUSY; 152 147 153 - cmd[4] |= crc7(0, crc, WSPI_INIT_CMD_CRC_LEN) << 1; 154 - cmd[4] |= WSPI_INIT_CMD_END; 148 + cmd[7] = crc7_be(0, cmd+2, WSPI_INIT_CMD_CRC_LEN) | WSPI_INIT_CMD_END; 149 + /* 150 + * The above is the logical order; it must actually be stored 151 + * in the buffer byte-swapped. 152 + */ 153 + __swab32s((u32 *)cmd); 154 + __swab32s((u32 *)cmd+1); 155 155 156 156 t.tx_buf = cmd; 157 157 t.len = WSPI_INIT_CMD_LEN;
+2 -2
drivers/net/wireless/ti/wlcore/wlcore_i.h
··· 512 512 void wl12xx_queue_recovery_work(struct wl1271 *wl); 513 513 size_t wl12xx_copy_fwlog(struct wl1271 *wl, u8 *memblock, size_t maxlen); 514 514 int wl1271_rx_filter_alloc_field(struct wl12xx_rx_filter *filter, 515 - u16 offset, u8 flags, 516 - u8 *pattern, u8 len); 515 + u16 offset, u8 flags, 516 + const u8 *pattern, u8 len); 517 517 void wl1271_rx_filter_free(struct wl12xx_rx_filter *filter); 518 518 struct wl12xx_rx_filter *wl1271_rx_filter_alloc(void); 519 519 int wl1271_rx_filter_get_fields_size(struct wl12xx_rx_filter *filter);
+1
drivers/nfc/Kconfig
··· 71 71 source "drivers/nfc/pn544/Kconfig" 72 72 source "drivers/nfc/microread/Kconfig" 73 73 source "drivers/nfc/nfcmrvl/Kconfig" 74 + source "drivers/nfc/st21nfca/Kconfig" 74 75 75 76 endmenu
+1
drivers/nfc/Makefile
··· 11 11 obj-$(CONFIG_NFC_PORT100) += port100.o 12 12 obj-$(CONFIG_NFC_MRVL) += nfcmrvl/ 13 13 obj-$(CONFIG_NFC_TRF7970A) += trf7970a.o 14 + obj-$(CONFIG_NFC_ST21NFCA) += st21nfca/ 14 15 15 16 ccflags-$(CONFIG_NFC_DEBUG) := -DDEBUG
+136 -18
drivers/nfc/pn544/i2c.c
··· 22 22 #include <linux/module.h> 23 23 #include <linux/i2c.h> 24 24 #include <linux/gpio.h> 25 + #include <linux/of_gpio.h> 26 + #include <linux/of_irq.h> 25 27 #include <linux/miscdevice.h> 26 28 #include <linux/interrupt.h> 27 29 #include <linux/delay.h> ··· 859 857 } 860 858 } 861 859 860 + #ifdef CONFIG_OF 861 + 862 + static int pn544_hci_i2c_of_request_resources(struct i2c_client *client) 863 + { 864 + struct pn544_i2c_phy *phy = i2c_get_clientdata(client); 865 + struct device_node *pp; 866 + int ret; 867 + 868 + pp = client->dev.of_node; 869 + if (!pp) { 870 + ret = -ENODEV; 871 + goto err_dt; 872 + } 873 + 874 + /* Obtention of EN GPIO from device tree */ 875 + ret = of_get_named_gpio(pp, "enable-gpios", 0); 876 + if (ret < 0) { 877 + if (ret != -EPROBE_DEFER) 878 + nfc_err(&client->dev, 879 + "Failed to get EN gpio, error: %d\n", ret); 880 + goto err_dt; 881 + } 882 + phy->gpio_en = ret; 883 + 884 + /* Configuration of EN GPIO */ 885 + ret = gpio_request(phy->gpio_en, "pn544_en"); 886 + if (ret) { 887 + nfc_err(&client->dev, "Fail EN pin\n"); 888 + goto err_dt; 889 + } 890 + ret = gpio_direction_output(phy->gpio_en, 0); 891 + if (ret) { 892 + nfc_err(&client->dev, "Fail EN pin direction\n"); 893 + goto err_gpio_en; 894 + } 895 + 896 + /* Obtention of FW GPIO from device tree */ 897 + ret = of_get_named_gpio(pp, "firmware-gpios", 0); 898 + if (ret < 0) { 899 + if (ret != -EPROBE_DEFER) 900 + nfc_err(&client->dev, 901 + "Failed to get FW gpio, error: %d\n", ret); 902 + goto err_gpio_en; 903 + } 904 + phy->gpio_fw = ret; 905 + 906 + /* Configuration of FW GPIO */ 907 + ret = gpio_request(phy->gpio_fw, "pn544_fw"); 908 + if (ret) { 909 + nfc_err(&client->dev, "Fail FW pin\n"); 910 + goto err_gpio_en; 911 + } 912 + ret = gpio_direction_output(phy->gpio_fw, 0); 913 + if (ret) { 914 + nfc_err(&client->dev, "Fail FW pin direction\n"); 915 + goto err_gpio_fw; 916 + } 917 + 918 + /* IRQ */ 919 + ret = irq_of_parse_and_map(pp, 0); 920 + if (ret < 0) { 921 + nfc_err(&client->dev, 922 + "Unable to get irq, error: %d\n", ret); 923 + goto err_gpio_fw; 924 + } 925 + client->irq = ret; 926 + 927 + return 0; 928 + 929 + err_gpio_fw: 930 + gpio_free(phy->gpio_fw); 931 + err_gpio_en: 932 + gpio_free(phy->gpio_en); 933 + err_dt: 934 + return ret; 935 + } 936 + 937 + #else 938 + 939 + static int pn544_hci_i2c_of_request_resources(struct i2c_client *client) 940 + { 941 + return -ENODEV; 942 + } 943 + 944 + #endif 945 + 862 946 static int pn544_hci_i2c_probe(struct i2c_client *client, 863 947 const struct i2c_device_id *id) 864 948 { ··· 975 887 i2c_set_clientdata(client, phy); 976 888 977 889 pdata = client->dev.platform_data; 978 - if (pdata == NULL) { 890 + 891 + /* No platform data, using device tree. */ 892 + if (!pdata && client->dev.of_node) { 893 + r = pn544_hci_i2c_of_request_resources(client); 894 + if (r) { 895 + nfc_err(&client->dev, "No DT data\n"); 896 + return r; 897 + } 898 + /* Using platform data. */ 899 + } else if (pdata) { 900 + 901 + if (pdata->request_resources == NULL) { 902 + nfc_err(&client->dev, "request_resources() missing\n"); 903 + return -EINVAL; 904 + } 905 + 906 + r = pdata->request_resources(client); 907 + if (r) { 908 + nfc_err(&client->dev, 909 + "Cannot get platform resources\n"); 910 + return r; 911 + } 912 + 913 + phy->gpio_en = pdata->get_gpio(NFC_GPIO_ENABLE); 914 + phy->gpio_fw = pdata->get_gpio(NFC_GPIO_FW_RESET); 915 + phy->gpio_irq = pdata->get_gpio(NFC_GPIO_IRQ); 916 + } else { 979 917 nfc_err(&client->dev, "No platform data\n"); 980 918 return -EINVAL; 981 919 } 982 - 983 - if (pdata->request_resources == NULL) { 984 - nfc_err(&client->dev, "request_resources() missing\n"); 985 - return -EINVAL; 986 - } 987 - 988 - r = pdata->request_resources(client); 989 - if (r) { 990 - nfc_err(&client->dev, "Cannot get platform resources\n"); 991 - return r; 992 - } 993 - 994 - phy->gpio_en = pdata->get_gpio(NFC_GPIO_ENABLE); 995 - phy->gpio_fw = pdata->get_gpio(NFC_GPIO_FW_RESET); 996 - phy->gpio_irq = pdata->get_gpio(NFC_GPIO_IRQ); 997 920 998 921 pn544_hci_i2c_platform_init(phy); 999 922 ··· 1029 930 free_irq(client->irq, phy); 1030 931 1031 932 err_rti: 1032 - if (pdata->free_resources != NULL) 933 + if (!pdata) { 934 + gpio_free(phy->gpio_en); 935 + gpio_free(phy->gpio_fw); 936 + } else if (pdata->free_resources) { 1033 937 pdata->free_resources(); 938 + } 1034 939 1035 940 return r; 1036 941 } ··· 1056 953 pn544_hci_i2c_disable(phy); 1057 954 1058 955 free_irq(client->irq, phy); 1059 - if (pdata->free_resources) 956 + 957 + /* No platform data, GPIOs have been requested by this driver */ 958 + if (!pdata) { 959 + gpio_free(phy->gpio_en); 960 + gpio_free(phy->gpio_fw); 961 + /* Using platform data */ 962 + } else if (pdata->free_resources) { 1060 963 pdata->free_resources(); 964 + } 1061 965 1062 966 return 0; 1063 967 } 1064 968 969 + static const struct of_device_id of_pn544_i2c_match[] = { 970 + { .compatible = "nxp,pn544-i2c", }, 971 + {}, 972 + }; 973 + MODULE_DEVICE_TABLE(of, of_pn544_i2c_match); 974 + 1065 975 static struct i2c_driver pn544_hci_i2c_driver = { 1066 976 .driver = { 1067 977 .name = PN544_HCI_I2C_DRIVER_NAME, 978 + .owner = THIS_MODULE, 979 + .of_match_table = of_match_ptr(of_pn544_i2c_match), 1068 980 }, 1069 981 .probe = pn544_hci_i2c_probe, 1070 982 .id_table = pn544_hci_i2c_id_table,
+23
drivers/nfc/st21nfca/Kconfig
··· 1 + config NFC_ST21NFCA 2 + tristate "STMicroelectronics ST21NFCA NFC driver" 3 + depends on NFC_HCI 4 + select CRC_CCITT 5 + default n 6 + ---help--- 7 + STMicroelectronics ST21NFCA core driver. It implements the chipset 8 + HCI logic and hooks into the NFC kernel APIs. Physical layers will 9 + register against it. 10 + 11 + To compile this driver as a module, choose m here. The module will 12 + be called st21nfca. 13 + Say N if unsure. 14 + 15 + config NFC_ST21NFCA_I2C 16 + tristate "NFC ST21NFCA i2c support" 17 + depends on NFC_ST21NFCA && I2C && NFC_SHDLC 18 + ---help--- 19 + This module adds support for the STMicroelectronics st21nfca i2c interface. 20 + Select this if your platform is using the i2c bus. 21 + 22 + If you choose to build a module, it'll be called st21nfca_i2c. 23 + Say N if unsure.
+8
drivers/nfc/st21nfca/Makefile
··· 1 + # 2 + # Makefile for ST21NFCA HCI based NFC driver 3 + # 4 + 5 + st21nfca_i2c-objs = i2c.o 6 + 7 + obj-$(CONFIG_NFC_ST21NFCA) += st21nfca.o 8 + obj-$(CONFIG_NFC_ST21NFCA_I2C) += st21nfca_i2c.o
+724
drivers/nfc/st21nfca/i2c.c
··· 1 + /* 2 + * I2C Link Layer for ST21NFCA HCI based Driver 3 + * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved. 4 + * 5 + * This program is free software; you can redistribute it and/or modify it 6 + * under the terms and conditions of the GNU General Public License, 7 + * version 2, as published by the Free Software Foundation. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + * 14 + * You should have received a copy of the GNU General Public License 15 + * along with this program; if not, see <http://www.gnu.org/licenses/>. 16 + */ 17 + 18 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 19 + 20 + #include <linux/crc-ccitt.h> 21 + #include <linux/module.h> 22 + #include <linux/i2c.h> 23 + #include <linux/gpio.h> 24 + #include <linux/of_irq.h> 25 + #include <linux/of_gpio.h> 26 + #include <linux/miscdevice.h> 27 + #include <linux/interrupt.h> 28 + #include <linux/delay.h> 29 + #include <linux/nfc.h> 30 + #include <linux/firmware.h> 31 + #include <linux/unaligned/access_ok.h> 32 + #include <linux/platform_data/st21nfca.h> 33 + 34 + #include <net/nfc/hci.h> 35 + #include <net/nfc/llc.h> 36 + #include <net/nfc/nfc.h> 37 + 38 + #include "st21nfca.h" 39 + 40 + /* 41 + * Every frame starts with ST21NFCA_SOF_EOF and ends with ST21NFCA_SOF_EOF. 42 + * Because ST21NFCA_SOF_EOF is a possible data value, there is a mecanism 43 + * called byte stuffing has been introduced. 44 + * 45 + * if byte == ST21NFCA_SOF_EOF or ST21NFCA_ESCAPE_BYTE_STUFFING 46 + * - insert ST21NFCA_ESCAPE_BYTE_STUFFING (escape byte) 47 + * - xor byte with ST21NFCA_BYTE_STUFFING_MASK 48 + */ 49 + #define ST21NFCA_SOF_EOF 0x7e 50 + #define ST21NFCA_BYTE_STUFFING_MASK 0x20 51 + #define ST21NFCA_ESCAPE_BYTE_STUFFING 0x7d 52 + 53 + /* SOF + 00 */ 54 + #define ST21NFCA_FRAME_HEADROOM 2 55 + 56 + /* 2 bytes crc + EOF */ 57 + #define ST21NFCA_FRAME_TAILROOM 3 58 + #define IS_START_OF_FRAME(buf) (buf[0] == ST21NFCA_SOF_EOF && \ 59 + buf[1] == 0) 60 + 61 + #define ST21NFCA_HCI_I2C_DRIVER_NAME "st21nfca_hci_i2c" 62 + 63 + static struct i2c_device_id st21nfca_hci_i2c_id_table[] = { 64 + {ST21NFCA_HCI_DRIVER_NAME, 0}, 65 + {} 66 + }; 67 + 68 + MODULE_DEVICE_TABLE(i2c, st21nfca_hci_i2c_id_table); 69 + 70 + struct st21nfca_i2c_phy { 71 + struct i2c_client *i2c_dev; 72 + struct nfc_hci_dev *hdev; 73 + 74 + unsigned int gpio_ena; 75 + unsigned int gpio_irq; 76 + unsigned int irq_polarity; 77 + 78 + struct sk_buff *pending_skb; 79 + int current_read_len; 80 + /* 81 + * crc might have fail because i2c macro 82 + * is disable due to other interface activity 83 + */ 84 + int crc_trials; 85 + 86 + int powered; 87 + int run_mode; 88 + 89 + /* 90 + * < 0 if hardware error occured (e.g. i2c err) 91 + * and prevents normal operation. 92 + */ 93 + int hard_fault; 94 + struct mutex phy_lock; 95 + }; 96 + static u8 len_seq[] = { 13, 24, 15, 29 }; 97 + static u16 wait_tab[] = { 2, 3, 5, 15, 20, 40}; 98 + 99 + #define I2C_DUMP_SKB(info, skb) \ 100 + do { \ 101 + pr_debug("%s:\n", info); \ 102 + print_hex_dump(KERN_DEBUG, "i2c: ", DUMP_PREFIX_OFFSET, \ 103 + 16, 1, (skb)->data, (skb)->len, 0); \ 104 + } while (0) 105 + 106 + /* 107 + * In order to get the CLF in a known state we generate an internal reboot 108 + * using a proprietary command. 109 + * Once the reboot is completed, we expect to receive a ST21NFCA_SOF_EOF 110 + * fill buffer. 111 + */ 112 + static int st21nfca_hci_platform_init(struct st21nfca_i2c_phy *phy) 113 + { 114 + u16 wait_reboot[] = { 50, 300, 1000 }; 115 + char reboot_cmd[] = { 0x7E, 0x66, 0x48, 0xF6, 0x7E }; 116 + u8 tmp[ST21NFCA_HCI_LLC_MAX_SIZE]; 117 + int i, r = -1; 118 + 119 + for (i = 0; i < ARRAY_SIZE(wait_reboot) && r < 0; i++) { 120 + r = i2c_master_send(phy->i2c_dev, reboot_cmd, 121 + sizeof(reboot_cmd)); 122 + if (r < 0) 123 + msleep(wait_reboot[i]); 124 + } 125 + if (r < 0) 126 + return r; 127 + 128 + /* CLF is spending about 20ms to do an internal reboot */ 129 + msleep(20); 130 + r = -1; 131 + for (i = 0; i < ARRAY_SIZE(wait_reboot) && r < 0; i++) { 132 + r = i2c_master_recv(phy->i2c_dev, tmp, 133 + ST21NFCA_HCI_LLC_MAX_SIZE); 134 + if (r < 0) 135 + msleep(wait_reboot[i]); 136 + } 137 + if (r < 0) 138 + return r; 139 + 140 + for (i = 0; i < ST21NFCA_HCI_LLC_MAX_SIZE && 141 + tmp[i] == ST21NFCA_SOF_EOF; i++) 142 + ; 143 + 144 + if (r != ST21NFCA_HCI_LLC_MAX_SIZE) 145 + return -ENODEV; 146 + 147 + usleep_range(1000, 1500); 148 + return 0; 149 + } 150 + 151 + static int st21nfca_hci_i2c_enable(void *phy_id) 152 + { 153 + struct st21nfca_i2c_phy *phy = phy_id; 154 + 155 + gpio_set_value(phy->gpio_ena, 1); 156 + phy->powered = 1; 157 + phy->run_mode = ST21NFCA_HCI_MODE; 158 + 159 + usleep_range(10000, 15000); 160 + 161 + return 0; 162 + } 163 + 164 + static void st21nfca_hci_i2c_disable(void *phy_id) 165 + { 166 + struct st21nfca_i2c_phy *phy = phy_id; 167 + 168 + pr_info("\n"); 169 + gpio_set_value(phy->gpio_ena, 0); 170 + 171 + phy->powered = 0; 172 + } 173 + 174 + static void st21nfca_hci_add_len_crc(struct sk_buff *skb) 175 + { 176 + u16 crc; 177 + u8 tmp; 178 + 179 + *skb_push(skb, 1) = 0; 180 + 181 + crc = crc_ccitt(0xffff, skb->data, skb->len); 182 + crc = ~crc; 183 + 184 + tmp = crc & 0x00ff; 185 + *skb_put(skb, 1) = tmp; 186 + 187 + tmp = (crc >> 8) & 0x00ff; 188 + *skb_put(skb, 1) = tmp; 189 + } 190 + 191 + static void st21nfca_hci_remove_len_crc(struct sk_buff *skb) 192 + { 193 + skb_pull(skb, ST21NFCA_FRAME_HEADROOM); 194 + skb_trim(skb, skb->len - ST21NFCA_FRAME_TAILROOM); 195 + } 196 + 197 + /* 198 + * Writing a frame must not return the number of written bytes. 199 + * It must return either zero for success, or <0 for error. 200 + * In addition, it must not alter the skb 201 + */ 202 + static int st21nfca_hci_i2c_write(void *phy_id, struct sk_buff *skb) 203 + { 204 + int r = -1, i, j; 205 + struct st21nfca_i2c_phy *phy = phy_id; 206 + struct i2c_client *client = phy->i2c_dev; 207 + u8 tmp[ST21NFCA_HCI_LLC_MAX_SIZE * 2]; 208 + 209 + I2C_DUMP_SKB("st21nfca_hci_i2c_write", skb); 210 + 211 + 212 + if (phy->hard_fault != 0) 213 + return phy->hard_fault; 214 + 215 + /* 216 + * Compute CRC before byte stuffing computation on frame 217 + * Note st21nfca_hci_add_len_crc is doing a byte stuffing 218 + * on its own value 219 + */ 220 + st21nfca_hci_add_len_crc(skb); 221 + 222 + /* add ST21NFCA_SOF_EOF on tail */ 223 + *skb_put(skb, 1) = ST21NFCA_SOF_EOF; 224 + /* add ST21NFCA_SOF_EOF on head */ 225 + *skb_push(skb, 1) = ST21NFCA_SOF_EOF; 226 + 227 + /* 228 + * Compute byte stuffing 229 + * if byte == ST21NFCA_SOF_EOF or ST21NFCA_ESCAPE_BYTE_STUFFING 230 + * insert ST21NFCA_ESCAPE_BYTE_STUFFING (escape byte) 231 + * xor byte with ST21NFCA_BYTE_STUFFING_MASK 232 + */ 233 + tmp[0] = skb->data[0]; 234 + for (i = 1, j = 1; i < skb->len - 1; i++, j++) { 235 + if (skb->data[i] == ST21NFCA_SOF_EOF 236 + || skb->data[i] == ST21NFCA_ESCAPE_BYTE_STUFFING) { 237 + tmp[j] = ST21NFCA_ESCAPE_BYTE_STUFFING; 238 + j++; 239 + tmp[j] = skb->data[i] ^ ST21NFCA_BYTE_STUFFING_MASK; 240 + } else { 241 + tmp[j] = skb->data[i]; 242 + } 243 + } 244 + tmp[j] = skb->data[i]; 245 + j++; 246 + 247 + /* 248 + * Manage sleep mode 249 + * Try 3 times to send data with delay between each 250 + */ 251 + mutex_lock(&phy->phy_lock); 252 + for (i = 0; i < ARRAY_SIZE(wait_tab) && r < 0; i++) { 253 + r = i2c_master_send(client, tmp, j); 254 + if (r < 0) 255 + msleep(wait_tab[i]); 256 + } 257 + mutex_unlock(&phy->phy_lock); 258 + 259 + if (r >= 0) { 260 + if (r != j) 261 + r = -EREMOTEIO; 262 + else 263 + r = 0; 264 + } 265 + 266 + st21nfca_hci_remove_len_crc(skb); 267 + 268 + return r; 269 + } 270 + 271 + static int get_frame_size(u8 *buf, int buflen) 272 + { 273 + int len = 0; 274 + if (buf[len + 1] == ST21NFCA_SOF_EOF) 275 + return 0; 276 + 277 + for (len = 1; len < buflen && buf[len] != ST21NFCA_SOF_EOF; len++) 278 + ; 279 + 280 + return len; 281 + } 282 + 283 + static int check_crc(u8 *buf, int buflen) 284 + { 285 + u16 crc; 286 + 287 + crc = crc_ccitt(0xffff, buf, buflen - 2); 288 + crc = ~crc; 289 + 290 + if (buf[buflen - 2] != (crc & 0xff) || buf[buflen - 1] != (crc >> 8)) { 291 + pr_err(ST21NFCA_HCI_DRIVER_NAME 292 + ": CRC error 0x%x != 0x%x 0x%x\n", crc, buf[buflen - 1], 293 + buf[buflen - 2]); 294 + 295 + pr_info(DRIVER_DESC ": %s : BAD CRC\n", __func__); 296 + print_hex_dump(KERN_DEBUG, "crc: ", DUMP_PREFIX_NONE, 297 + 16, 2, buf, buflen, false); 298 + return -EPERM; 299 + } 300 + return 0; 301 + } 302 + 303 + /* 304 + * Prepare received data for upper layer. 305 + * Received data include byte stuffing, crc and sof/eof 306 + * which is not usable by hci part. 307 + * returns: 308 + * frame size without sof/eof, header and byte stuffing 309 + * -EBADMSG : frame was incorrect and discarded 310 + */ 311 + static int st21nfca_hci_i2c_repack(struct sk_buff *skb) 312 + { 313 + int i, j, r, size; 314 + if (skb->len < 1 || (skb->len > 1 && skb->data[1] != 0)) 315 + return -EBADMSG; 316 + 317 + size = get_frame_size(skb->data, skb->len); 318 + if (size > 0) { 319 + skb_trim(skb, size); 320 + /* remove ST21NFCA byte stuffing for upper layer */ 321 + for (i = 1, j = 0; i < skb->len; i++) { 322 + if (skb->data[i + j] == 323 + (u8) ST21NFCA_ESCAPE_BYTE_STUFFING) { 324 + skb->data[i] = skb->data[i + j + 1] 325 + | ST21NFCA_BYTE_STUFFING_MASK; 326 + i++; 327 + j++; 328 + } 329 + skb->data[i] = skb->data[i + j]; 330 + } 331 + /* remove byte stuffing useless byte */ 332 + skb_trim(skb, i - j); 333 + /* remove ST21NFCA_SOF_EOF from head */ 334 + skb_pull(skb, 1); 335 + 336 + r = check_crc(skb->data, skb->len); 337 + if (r != 0) { 338 + i = 0; 339 + return -EBADMSG; 340 + } 341 + 342 + /* remove headbyte */ 343 + skb_pull(skb, 1); 344 + /* remove crc. Byte Stuffing is already removed here */ 345 + skb_trim(skb, skb->len - 2); 346 + return skb->len; 347 + } 348 + return 0; 349 + } 350 + 351 + /* 352 + * Reads an shdlc frame and returns it in a newly allocated sk_buff. Guarantees 353 + * that i2c bus will be flushed and that next read will start on a new frame. 354 + * returned skb contains only LLC header and payload. 355 + * returns: 356 + * frame size : if received frame is complete (find ST21NFCA_SOF_EOF at 357 + * end of read) 358 + * -EAGAIN : if received frame is incomplete (not find ST21NFCA_SOF_EOF 359 + * at end of read) 360 + * -EREMOTEIO : i2c read error (fatal) 361 + * -EBADMSG : frame was incorrect and discarded 362 + * (value returned from st21nfca_hci_i2c_repack) 363 + * -EIO : if no ST21NFCA_SOF_EOF is found after reaching 364 + * the read length end sequence 365 + */ 366 + static int st21nfca_hci_i2c_read(struct st21nfca_i2c_phy *phy, 367 + struct sk_buff *skb) 368 + { 369 + int r, i; 370 + u8 len; 371 + u8 buf[ST21NFCA_HCI_LLC_MAX_PAYLOAD]; 372 + struct i2c_client *client = phy->i2c_dev; 373 + 374 + if (phy->current_read_len < ARRAY_SIZE(len_seq)) { 375 + len = len_seq[phy->current_read_len]; 376 + 377 + /* 378 + * Add retry mecanism 379 + * Operation on I2C interface may fail in case of operation on 380 + * RF or SWP interface 381 + */ 382 + r = 0; 383 + mutex_lock(&phy->phy_lock); 384 + for (i = 0; i < ARRAY_SIZE(wait_tab) && r <= 0; i++) { 385 + r = i2c_master_recv(client, buf, len); 386 + if (r < 0) 387 + msleep(wait_tab[i]); 388 + } 389 + mutex_unlock(&phy->phy_lock); 390 + 391 + if (r != len) { 392 + phy->current_read_len = 0; 393 + return -EREMOTEIO; 394 + } 395 + 396 + /* 397 + * The first read sequence does not start with SOF. 398 + * Data is corrupeted so we drop it. 399 + */ 400 + if (!phy->current_read_len && buf[0] != ST21NFCA_SOF_EOF) { 401 + skb_trim(skb, 0); 402 + phy->current_read_len = 0; 403 + return -EIO; 404 + } else if (phy->current_read_len && 405 + IS_START_OF_FRAME(buf)) { 406 + /* 407 + * Previous frame transmission was interrupted and 408 + * the frame got repeated. 409 + * Received frame start with ST21NFCA_SOF_EOF + 00. 410 + */ 411 + skb_trim(skb, 0); 412 + phy->current_read_len = 0; 413 + } 414 + 415 + memcpy(skb_put(skb, len), buf, len); 416 + 417 + if (skb->data[skb->len - 1] == ST21NFCA_SOF_EOF) { 418 + phy->current_read_len = 0; 419 + return st21nfca_hci_i2c_repack(skb); 420 + } 421 + phy->current_read_len++; 422 + return -EAGAIN; 423 + } 424 + return -EIO; 425 + } 426 + 427 + /* 428 + * Reads an shdlc frame from the chip. This is not as straightforward as it 429 + * seems. The frame format is data-crc, and corruption can occur anywhere 430 + * while transiting on i2c bus, such that we could read an invalid data. 431 + * The tricky case is when we read a corrupted data or crc. We must detect 432 + * this here in order to determine that data can be transmitted to the hci 433 + * core. This is the reason why we check the crc here. 434 + * The CLF will repeat a frame until we send a RR on that frame. 435 + * 436 + * On ST21NFCA, IRQ goes in idle when read starts. As no size information are 437 + * available in the incoming data, other IRQ might come. Every IRQ will trigger 438 + * a read sequence with different length and will fill the current frame. 439 + * The reception is complete once we reach a ST21NFCA_SOF_EOF. 440 + */ 441 + static irqreturn_t st21nfca_hci_irq_thread_fn(int irq, void *phy_id) 442 + { 443 + struct st21nfca_i2c_phy *phy = phy_id; 444 + struct i2c_client *client; 445 + 446 + int r; 447 + 448 + if (!phy || irq != phy->i2c_dev->irq) { 449 + WARN_ON_ONCE(1); 450 + return IRQ_NONE; 451 + } 452 + 453 + client = phy->i2c_dev; 454 + dev_dbg(&client->dev, "IRQ\n"); 455 + 456 + if (phy->hard_fault != 0) 457 + return IRQ_HANDLED; 458 + 459 + r = st21nfca_hci_i2c_read(phy, phy->pending_skb); 460 + if (r == -EREMOTEIO) { 461 + phy->hard_fault = r; 462 + 463 + nfc_hci_recv_frame(phy->hdev, NULL); 464 + 465 + return IRQ_HANDLED; 466 + } else if (r == -EAGAIN || r == -EIO) { 467 + return IRQ_HANDLED; 468 + } else if (r == -EBADMSG && phy->crc_trials < ARRAY_SIZE(wait_tab)) { 469 + /* 470 + * With ST21NFCA, only one interface (I2C, RF or SWP) 471 + * may be active at a time. 472 + * Having incorrect crc is usually due to i2c macrocell 473 + * deactivation in the middle of a transmission. 474 + * It may generate corrupted data on i2c. 475 + * We give sometime to get i2c back. 476 + * The complete frame will be repeated. 477 + */ 478 + msleep(wait_tab[phy->crc_trials]); 479 + phy->crc_trials++; 480 + phy->current_read_len = 0; 481 + kfree_skb(phy->pending_skb); 482 + } else if (r > 0) { 483 + /* 484 + * We succeeded to read data from the CLF and 485 + * data is valid. 486 + * Reset counter. 487 + */ 488 + nfc_hci_recv_frame(phy->hdev, phy->pending_skb); 489 + phy->crc_trials = 0; 490 + } 491 + 492 + phy->pending_skb = alloc_skb(ST21NFCA_HCI_LLC_MAX_SIZE * 2, GFP_KERNEL); 493 + if (phy->pending_skb == NULL) { 494 + phy->hard_fault = -ENOMEM; 495 + nfc_hci_recv_frame(phy->hdev, NULL); 496 + } 497 + 498 + return IRQ_HANDLED; 499 + } 500 + 501 + static struct nfc_phy_ops i2c_phy_ops = { 502 + .write = st21nfca_hci_i2c_write, 503 + .enable = st21nfca_hci_i2c_enable, 504 + .disable = st21nfca_hci_i2c_disable, 505 + }; 506 + 507 + #ifdef CONFIG_OF 508 + static int st21nfca_hci_i2c_of_request_resources(struct i2c_client *client) 509 + { 510 + struct st21nfca_i2c_phy *phy = i2c_get_clientdata(client); 511 + struct device_node *pp; 512 + int gpio; 513 + int r; 514 + 515 + pp = client->dev.of_node; 516 + if (!pp) 517 + return -ENODEV; 518 + 519 + /* Get GPIO from device tree */ 520 + gpio = of_get_named_gpio(pp, "enable-gpios", 0); 521 + if (gpio < 0) { 522 + nfc_err(&client->dev, "Failed to retrieve enable-gpios from device tree\n"); 523 + return gpio; 524 + } 525 + 526 + /* GPIO request and configuration */ 527 + r = devm_gpio_request(&client->dev, gpio, "clf_enable"); 528 + if (r) { 529 + nfc_err(&client->dev, "Failed to request enable pin\n"); 530 + return -ENODEV; 531 + } 532 + 533 + r = gpio_direction_output(gpio, 1); 534 + if (r) { 535 + nfc_err(&client->dev, "Failed to set enable pin direction as output\n"); 536 + return -ENODEV; 537 + } 538 + phy->gpio_ena = gpio; 539 + 540 + /* IRQ */ 541 + r = irq_of_parse_and_map(pp, 0); 542 + if (r < 0) { 543 + nfc_err(&client->dev, 544 + "Unable to get irq, error: %d\n", r); 545 + return r; 546 + } 547 + 548 + phy->irq_polarity = irq_get_trigger_type(r); 549 + client->irq = r; 550 + 551 + return 0; 552 + } 553 + #else 554 + static int st21nfca_hci_i2c_of_request_resources(struct i2c_client *client) 555 + { 556 + return -ENODEV; 557 + } 558 + #endif 559 + 560 + static int st21nfca_hci_i2c_request_resources(struct i2c_client *client) 561 + { 562 + struct st21nfca_nfc_platform_data *pdata; 563 + struct st21nfca_i2c_phy *phy = i2c_get_clientdata(client); 564 + int r; 565 + int irq; 566 + 567 + pdata = client->dev.platform_data; 568 + if (pdata == NULL) { 569 + nfc_err(&client->dev, "No platform data\n"); 570 + return -EINVAL; 571 + } 572 + 573 + /* store for later use */ 574 + phy->gpio_irq = pdata->gpio_irq; 575 + phy->gpio_ena = pdata->gpio_ena; 576 + phy->irq_polarity = pdata->irq_polarity; 577 + 578 + r = devm_gpio_request(&client->dev, phy->gpio_irq, "wake_up"); 579 + if (r) { 580 + pr_err("%s : gpio_request failed\n", __FILE__); 581 + return -ENODEV; 582 + } 583 + 584 + r = gpio_direction_input(phy->gpio_irq); 585 + if (r) { 586 + pr_err("%s : gpio_direction_input failed\n", __FILE__); 587 + return -ENODEV; 588 + } 589 + 590 + if (phy->gpio_ena > 0) { 591 + r = devm_gpio_request(&client->dev, 592 + phy->gpio_ena, "clf_enable"); 593 + if (r) { 594 + pr_err("%s : ena gpio_request failed\n", __FILE__); 595 + return -ENODEV; 596 + } 597 + r = gpio_direction_output(phy->gpio_ena, 1); 598 + 599 + if (r) { 600 + pr_err("%s : ena gpio_direction_output failed\n", 601 + __FILE__); 602 + return -ENODEV; 603 + } 604 + } 605 + 606 + /* IRQ */ 607 + irq = gpio_to_irq(phy->gpio_irq); 608 + if (irq < 0) { 609 + nfc_err(&client->dev, 610 + "Unable to get irq number for GPIO %d error %d\n", 611 + phy->gpio_irq, r); 612 + return -ENODEV; 613 + } 614 + client->irq = irq; 615 + 616 + return 0; 617 + } 618 + 619 + static int st21nfca_hci_i2c_probe(struct i2c_client *client, 620 + const struct i2c_device_id *id) 621 + { 622 + struct st21nfca_i2c_phy *phy; 623 + struct st21nfca_nfc_platform_data *pdata; 624 + int r; 625 + 626 + dev_dbg(&client->dev, "%s\n", __func__); 627 + dev_dbg(&client->dev, "IRQ: %d\n", client->irq); 628 + 629 + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 630 + nfc_err(&client->dev, "Need I2C_FUNC_I2C\n"); 631 + return -ENODEV; 632 + } 633 + 634 + phy = devm_kzalloc(&client->dev, sizeof(struct st21nfca_i2c_phy), 635 + GFP_KERNEL); 636 + if (!phy) { 637 + nfc_err(&client->dev, 638 + "Cannot allocate memory for st21nfca i2c phy.\n"); 639 + return -ENOMEM; 640 + } 641 + 642 + phy->i2c_dev = client; 643 + phy->pending_skb = alloc_skb(ST21NFCA_HCI_LLC_MAX_SIZE * 2, GFP_KERNEL); 644 + if (phy->pending_skb == NULL) 645 + return -ENOMEM; 646 + 647 + phy->current_read_len = 0; 648 + phy->crc_trials = 0; 649 + mutex_init(&phy->phy_lock); 650 + i2c_set_clientdata(client, phy); 651 + 652 + pdata = client->dev.platform_data; 653 + if (!pdata && client->dev.of_node) { 654 + r = st21nfca_hci_i2c_of_request_resources(client); 655 + if (r) { 656 + nfc_err(&client->dev, "No platform data\n"); 657 + return r; 658 + } 659 + } else if (pdata) { 660 + r = st21nfca_hci_i2c_request_resources(client); 661 + if (r) { 662 + nfc_err(&client->dev, "Cannot get platform resources\n"); 663 + return r; 664 + } 665 + } else { 666 + nfc_err(&client->dev, "st21nfca platform resources not available\n"); 667 + return -ENODEV; 668 + } 669 + 670 + r = st21nfca_hci_platform_init(phy); 671 + if (r < 0) { 672 + nfc_err(&client->dev, "Unable to reboot st21nfca\n"); 673 + return -ENODEV; 674 + } 675 + 676 + r = devm_request_threaded_irq(&client->dev, client->irq, NULL, 677 + st21nfca_hci_irq_thread_fn, 678 + phy->irq_polarity | IRQF_ONESHOT, 679 + ST21NFCA_HCI_DRIVER_NAME, phy); 680 + if (r < 0) { 681 + nfc_err(&client->dev, "Unable to register IRQ handler\n"); 682 + return r; 683 + } 684 + 685 + return st21nfca_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME, 686 + ST21NFCA_FRAME_HEADROOM, ST21NFCA_FRAME_TAILROOM, 687 + ST21NFCA_HCI_LLC_MAX_PAYLOAD, &phy->hdev); 688 + } 689 + 690 + static int st21nfca_hci_i2c_remove(struct i2c_client *client) 691 + { 692 + struct st21nfca_i2c_phy *phy = i2c_get_clientdata(client); 693 + 694 + dev_dbg(&client->dev, "%s\n", __func__); 695 + 696 + st21nfca_hci_remove(phy->hdev); 697 + 698 + if (phy->powered) 699 + st21nfca_hci_i2c_disable(phy); 700 + 701 + return 0; 702 + } 703 + 704 + static const struct of_device_id of_st21nfca_i2c_match[] = { 705 + { .compatible = "st,st21nfca_i2c", }, 706 + {} 707 + }; 708 + 709 + static struct i2c_driver st21nfca_hci_i2c_driver = { 710 + .driver = { 711 + .owner = THIS_MODULE, 712 + .name = ST21NFCA_HCI_I2C_DRIVER_NAME, 713 + .owner = THIS_MODULE, 714 + .of_match_table = of_match_ptr(of_st21nfca_i2c_match), 715 + }, 716 + .probe = st21nfca_hci_i2c_probe, 717 + .id_table = st21nfca_hci_i2c_id_table, 718 + .remove = st21nfca_hci_i2c_remove, 719 + }; 720 + 721 + module_i2c_driver(st21nfca_hci_i2c_driver); 722 + 723 + MODULE_LICENSE("GPL"); 724 + MODULE_DESCRIPTION(DRIVER_DESC);
+698
drivers/nfc/st21nfca/st21nfca.c
··· 1 + /* 2 + * HCI based Driver for STMicroelectronics NFC Chip 3 + * 4 + * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms and conditions of the GNU General Public License, 8 + * version 2, as published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + * 15 + * You should have received a copy of the GNU General Public License 16 + * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 + */ 18 + 19 + #include <linux/module.h> 20 + #include <linux/nfc.h> 21 + #include <net/nfc/hci.h> 22 + #include <net/nfc/llc.h> 23 + 24 + #include "st21nfca.h" 25 + 26 + #define DRIVER_DESC "HCI NFC driver for ST21NFCA" 27 + 28 + #define FULL_VERSION_LEN 3 29 + 30 + /* Proprietary gates, events, commands and registers */ 31 + 32 + /* Commands that apply to all RF readers */ 33 + #define ST21NFCA_RF_READER_CMD_PRESENCE_CHECK 0x30 34 + 35 + #define ST21NFCA_RF_READER_ISO15693_GATE 0x12 36 + #define ST21NFCA_RF_READER_ISO15693_INVENTORY 0x01 37 + 38 + /* 39 + * Reader gate for communication with contact-less cards using Type A 40 + * protocol ISO14443-3 but not compliant with ISO14443-4 41 + */ 42 + #define ST21NFCA_RF_READER_14443_3_A_GATE 0x15 43 + #define ST21NFCA_RF_READER_14443_3_A_UID 0x02 44 + #define ST21NFCA_RF_READER_14443_3_A_ATQA 0x03 45 + #define ST21NFCA_RF_READER_14443_3_A_SAK 0x04 46 + 47 + #define ST21NFCA_DEVICE_MGNT_GATE 0x01 48 + #define ST21NFCA_DEVICE_MGNT_PIPE 0x02 49 + 50 + #define ST21NFCA_DM_GETINFO 0x13 51 + #define ST21NFCA_DM_GETINFO_PIPE_LIST 0x02 52 + #define ST21NFCA_DM_GETINFO_PIPE_INFO 0x01 53 + #define ST21NFCA_DM_PIPE_CREATED 0x02 54 + #define ST21NFCA_DM_PIPE_OPEN 0x04 55 + #define ST21NFCA_DM_RF_ACTIVE 0x80 56 + 57 + #define ST21NFCA_DM_IS_PIPE_OPEN(p) \ 58 + ((p & 0x0f) == (ST21NFCA_DM_PIPE_CREATED | ST21NFCA_DM_PIPE_OPEN)) 59 + 60 + #define ST21NFCA_NFC_MODE 0x03 /* NFC_MODE parameter*/ 61 + 62 + static DECLARE_BITMAP(dev_mask, ST21NFCA_NUM_DEVICES); 63 + 64 + static struct nfc_hci_gate st21nfca_gates[] = { 65 + {NFC_HCI_ADMIN_GATE, NFC_HCI_ADMIN_PIPE}, 66 + {NFC_HCI_LOOPBACK_GATE, NFC_HCI_INVALID_PIPE}, 67 + {NFC_HCI_ID_MGMT_GATE, NFC_HCI_INVALID_PIPE}, 68 + {NFC_HCI_LINK_MGMT_GATE, NFC_HCI_LINK_MGMT_PIPE}, 69 + {NFC_HCI_RF_READER_B_GATE, NFC_HCI_INVALID_PIPE}, 70 + {NFC_HCI_RF_READER_A_GATE, NFC_HCI_INVALID_PIPE}, 71 + {ST21NFCA_DEVICE_MGNT_GATE, ST21NFCA_DEVICE_MGNT_PIPE}, 72 + {ST21NFCA_RF_READER_F_GATE, NFC_HCI_INVALID_PIPE}, 73 + {ST21NFCA_RF_READER_14443_3_A_GATE, NFC_HCI_INVALID_PIPE}, 74 + {ST21NFCA_RF_READER_ISO15693_GATE, NFC_HCI_INVALID_PIPE}, 75 + }; 76 + 77 + struct st21nfca_pipe_info { 78 + u8 pipe_state; 79 + u8 src_host_id; 80 + u8 src_gate_id; 81 + u8 dst_host_id; 82 + u8 dst_gate_id; 83 + } __packed; 84 + 85 + /* Largest headroom needed for outgoing custom commands */ 86 + #define ST21NFCA_CMDS_HEADROOM 7 87 + 88 + static int st21nfca_hci_load_session(struct nfc_hci_dev *hdev) 89 + { 90 + int i, j, r; 91 + struct sk_buff *skb_pipe_list, *skb_pipe_info; 92 + struct st21nfca_pipe_info *info; 93 + 94 + u8 pipe_list[] = { ST21NFCA_DM_GETINFO_PIPE_LIST, 95 + NFC_HCI_TERMINAL_HOST_ID 96 + }; 97 + u8 pipe_info[] = { ST21NFCA_DM_GETINFO_PIPE_INFO, 98 + NFC_HCI_TERMINAL_HOST_ID, 0 99 + }; 100 + 101 + skb_pipe_list = alloc_skb(ST21NFCA_HCI_LLC_MAX_SIZE, GFP_KERNEL); 102 + if (!skb_pipe_list) { 103 + r = -ENOMEM; 104 + goto free_list; 105 + } 106 + 107 + skb_pipe_info = alloc_skb(ST21NFCA_HCI_LLC_MAX_SIZE, GFP_KERNEL); 108 + if (!skb_pipe_info) { 109 + r = -ENOMEM; 110 + goto free_info; 111 + } 112 + 113 + /* On ST21NFCA device pipes number are dynamics 114 + * A maximum of 16 pipes can be created at the same time 115 + * If pipes are already created, hci_dev_up will fail. 116 + * Doing a clear all pipe is a bad idea because: 117 + * - It does useless EEPROM cycling 118 + * - It might cause issue for secure elements support 119 + * (such as removing connectivity or APDU reader pipe) 120 + * A better approach on ST21NFCA is to: 121 + * - get a pipe list for each host. 122 + * (eg: NFC_HCI_HOST_CONTROLLER_ID for now). 123 + * (TODO Later on UICC HOST and eSE HOST) 124 + * - get pipe information 125 + * - match retrieved pipe list in st21nfca_gates 126 + * ST21NFCA_DEVICE_MGNT_GATE is a proprietary gate 127 + * with ST21NFCA_DEVICE_MGNT_PIPE. 128 + * Pipe can be closed and need to be open. 129 + */ 130 + r = nfc_hci_connect_gate(hdev, NFC_HCI_HOST_CONTROLLER_ID, 131 + ST21NFCA_DEVICE_MGNT_GATE, ST21NFCA_DEVICE_MGNT_PIPE); 132 + if (r < 0) 133 + goto free_info; 134 + 135 + /* Get pipe list */ 136 + r = nfc_hci_send_cmd(hdev, ST21NFCA_DEVICE_MGNT_GATE, 137 + ST21NFCA_DM_GETINFO, pipe_list, sizeof(pipe_list), 138 + &skb_pipe_list); 139 + if (r < 0) 140 + goto free_info; 141 + 142 + /* Complete the existing gate_pipe table */ 143 + for (i = 0; i < skb_pipe_list->len; i++) { 144 + pipe_info[2] = skb_pipe_list->data[i]; 145 + r = nfc_hci_send_cmd(hdev, ST21NFCA_DEVICE_MGNT_GATE, 146 + ST21NFCA_DM_GETINFO, pipe_info, 147 + sizeof(pipe_info), &skb_pipe_info); 148 + 149 + if (r) 150 + continue; 151 + 152 + /* 153 + * Match pipe ID and gate ID 154 + * Output format from ST21NFC_DM_GETINFO is: 155 + * - pipe state (1byte) 156 + * - source hid (1byte) 157 + * - source gid (1byte) 158 + * - destination hid (1byte) 159 + * - destination gid (1byte) 160 + */ 161 + info = (struct st21nfca_pipe_info *) skb_pipe_info->data; 162 + for (j = 0; (j < ARRAY_SIZE(st21nfca_gates)) && 163 + (st21nfca_gates[j].gate != info->dst_gate_id); 164 + j++) 165 + ; 166 + 167 + if (j < ARRAY_SIZE(st21nfca_gates) && 168 + st21nfca_gates[j].gate == info->dst_gate_id && 169 + ST21NFCA_DM_IS_PIPE_OPEN(info->pipe_state)) { 170 + st21nfca_gates[j].pipe = pipe_info[2]; 171 + hdev->gate2pipe[st21nfca_gates[j].gate] = 172 + st21nfca_gates[j].pipe; 173 + } 174 + } 175 + 176 + /* 177 + * 3 gates have a well known pipe ID. 178 + * They will never appear in the pipe list 179 + */ 180 + if (skb_pipe_list->len + 3 < ARRAY_SIZE(st21nfca_gates)) { 181 + for (i = skb_pipe_list->len + 3; 182 + i < ARRAY_SIZE(st21nfca_gates); i++) { 183 + r = nfc_hci_connect_gate(hdev, 184 + NFC_HCI_HOST_CONTROLLER_ID, 185 + st21nfca_gates[i].gate, 186 + st21nfca_gates[i].pipe); 187 + if (r < 0) 188 + goto free_info; 189 + } 190 + } 191 + 192 + memcpy(hdev->init_data.gates, st21nfca_gates, sizeof(st21nfca_gates)); 193 + free_info: 194 + kfree_skb(skb_pipe_info); 195 + free_list: 196 + kfree_skb(skb_pipe_list); 197 + return r; 198 + } 199 + 200 + static int st21nfca_hci_open(struct nfc_hci_dev *hdev) 201 + { 202 + struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); 203 + int r; 204 + 205 + mutex_lock(&info->info_lock); 206 + 207 + if (info->state != ST21NFCA_ST_COLD) { 208 + r = -EBUSY; 209 + goto out; 210 + } 211 + 212 + r = info->phy_ops->enable(info->phy_id); 213 + 214 + if (r == 0) 215 + info->state = ST21NFCA_ST_READY; 216 + 217 + out: 218 + mutex_unlock(&info->info_lock); 219 + return r; 220 + } 221 + 222 + static void st21nfca_hci_close(struct nfc_hci_dev *hdev) 223 + { 224 + struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); 225 + 226 + mutex_lock(&info->info_lock); 227 + 228 + if (info->state == ST21NFCA_ST_COLD) 229 + goto out; 230 + 231 + info->phy_ops->disable(info->phy_id); 232 + info->state = ST21NFCA_ST_COLD; 233 + 234 + out: 235 + mutex_unlock(&info->info_lock); 236 + } 237 + 238 + static int st21nfca_hci_ready(struct nfc_hci_dev *hdev) 239 + { 240 + struct sk_buff *skb; 241 + 242 + u8 param; 243 + int r; 244 + 245 + param = NFC_HCI_UICC_HOST_ID; 246 + r = nfc_hci_set_param(hdev, NFC_HCI_ADMIN_GATE, 247 + NFC_HCI_ADMIN_WHITELIST, &param, 1); 248 + if (r < 0) 249 + return r; 250 + 251 + /* Set NFC_MODE in device management gate to enable */ 252 + r = nfc_hci_get_param(hdev, ST21NFCA_DEVICE_MGNT_GATE, 253 + ST21NFCA_NFC_MODE, &skb); 254 + if (r < 0) 255 + return r; 256 + 257 + if (skb->data[0] == 0) { 258 + kfree_skb(skb); 259 + param = 1; 260 + 261 + r = nfc_hci_set_param(hdev, ST21NFCA_DEVICE_MGNT_GATE, 262 + ST21NFCA_NFC_MODE, &param, 1); 263 + if (r < 0) 264 + return r; 265 + } 266 + 267 + r = nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, 268 + NFC_HCI_EVT_END_OPERATION, NULL, 0); 269 + if (r < 0) 270 + return r; 271 + 272 + r = nfc_hci_get_param(hdev, NFC_HCI_ID_MGMT_GATE, 273 + NFC_HCI_ID_MGMT_VERSION_SW, &skb); 274 + if (r < 0) 275 + return r; 276 + 277 + if (skb->len != FULL_VERSION_LEN) { 278 + kfree_skb(skb); 279 + return -EINVAL; 280 + } 281 + 282 + print_hex_dump(KERN_DEBUG, "FULL VERSION SOFTWARE INFO: ", 283 + DUMP_PREFIX_NONE, 16, 1, 284 + skb->data, FULL_VERSION_LEN, false); 285 + 286 + kfree_skb(skb); 287 + 288 + return 0; 289 + } 290 + 291 + static int st21nfca_hci_xmit(struct nfc_hci_dev *hdev, struct sk_buff *skb) 292 + { 293 + struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); 294 + 295 + return info->phy_ops->write(info->phy_id, skb); 296 + } 297 + 298 + static int st21nfca_hci_start_poll(struct nfc_hci_dev *hdev, 299 + u32 im_protocols, u32 tm_protocols) 300 + { 301 + int r; 302 + 303 + pr_info(DRIVER_DESC ": %s protocols 0x%x 0x%x\n", 304 + __func__, im_protocols, tm_protocols); 305 + 306 + r = nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, 307 + NFC_HCI_EVT_END_OPERATION, NULL, 0); 308 + if (r < 0) 309 + return r; 310 + if (im_protocols) { 311 + /* 312 + * enable polling according to im_protocols & tm_protocols 313 + * - CLOSE pipe according to im_protocols & tm_protocols 314 + */ 315 + if ((NFC_HCI_RF_READER_B_GATE & im_protocols) == 0) { 316 + r = nfc_hci_disconnect_gate(hdev, 317 + NFC_HCI_RF_READER_B_GATE); 318 + if (r < 0) 319 + return r; 320 + } 321 + 322 + if ((NFC_HCI_RF_READER_A_GATE & im_protocols) == 0) { 323 + r = nfc_hci_disconnect_gate(hdev, 324 + NFC_HCI_RF_READER_A_GATE); 325 + if (r < 0) 326 + return r; 327 + } 328 + 329 + if ((ST21NFCA_RF_READER_F_GATE & im_protocols) == 0) { 330 + r = nfc_hci_disconnect_gate(hdev, 331 + ST21NFCA_RF_READER_F_GATE); 332 + if (r < 0) 333 + return r; 334 + } 335 + 336 + if ((ST21NFCA_RF_READER_14443_3_A_GATE & im_protocols) == 0) { 337 + r = nfc_hci_disconnect_gate(hdev, 338 + ST21NFCA_RF_READER_14443_3_A_GATE); 339 + if (r < 0) 340 + return r; 341 + } 342 + 343 + if ((ST21NFCA_RF_READER_ISO15693_GATE & im_protocols) == 0) { 344 + r = nfc_hci_disconnect_gate(hdev, 345 + ST21NFCA_RF_READER_ISO15693_GATE); 346 + if (r < 0) 347 + return r; 348 + } 349 + 350 + r = nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, 351 + NFC_HCI_EVT_READER_REQUESTED, NULL, 0); 352 + if (r < 0) 353 + nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, 354 + NFC_HCI_EVT_END_OPERATION, NULL, 0); 355 + } 356 + return r; 357 + } 358 + 359 + static int st21nfca_get_iso14443_3_atqa(struct nfc_hci_dev *hdev, u16 *atqa) 360 + { 361 + int r; 362 + struct sk_buff *atqa_skb = NULL; 363 + 364 + r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_14443_3_A_GATE, 365 + ST21NFCA_RF_READER_14443_3_A_ATQA, &atqa_skb); 366 + if (r < 0) 367 + goto exit; 368 + 369 + if (atqa_skb->len != 2) { 370 + r = -EPROTO; 371 + goto exit; 372 + } 373 + 374 + *atqa = be16_to_cpu(*(__be16 *) atqa_skb->data); 375 + 376 + exit: 377 + kfree_skb(atqa_skb); 378 + return r; 379 + } 380 + 381 + static int st21nfca_get_iso14443_3_sak(struct nfc_hci_dev *hdev, u8 *sak) 382 + { 383 + int r; 384 + struct sk_buff *sak_skb = NULL; 385 + 386 + r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_14443_3_A_GATE, 387 + ST21NFCA_RF_READER_14443_3_A_SAK, &sak_skb); 388 + if (r < 0) 389 + goto exit; 390 + 391 + if (sak_skb->len != 1) { 392 + r = -EPROTO; 393 + goto exit; 394 + } 395 + 396 + *sak = sak_skb->data[0]; 397 + 398 + exit: 399 + kfree_skb(sak_skb); 400 + return r; 401 + } 402 + 403 + static int st21nfca_get_iso14443_3_uid(struct nfc_hci_dev *hdev, u8 *gate, 404 + int *len) 405 + { 406 + int r; 407 + struct sk_buff *uid_skb = NULL; 408 + 409 + r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_14443_3_A_GATE, 410 + ST21NFCA_RF_READER_14443_3_A_UID, &uid_skb); 411 + if (r < 0) 412 + goto exit; 413 + 414 + if (uid_skb->len == 0 || uid_skb->len > NFC_NFCID1_MAXSIZE) { 415 + r = -EPROTO; 416 + goto exit; 417 + } 418 + 419 + gate = uid_skb->data; 420 + *len = uid_skb->len; 421 + exit: 422 + kfree_skb(uid_skb); 423 + return r; 424 + } 425 + 426 + static int st21nfca_get_iso15693_inventory(struct nfc_hci_dev *hdev, 427 + struct nfc_target *target) 428 + { 429 + int r; 430 + struct sk_buff *inventory_skb = NULL; 431 + 432 + r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_ISO15693_GATE, 433 + ST21NFCA_RF_READER_ISO15693_INVENTORY, 434 + &inventory_skb); 435 + if (r < 0) 436 + goto exit; 437 + 438 + skb_pull(inventory_skb, 2); 439 + 440 + if (inventory_skb->len == 0 || 441 + inventory_skb->len > NFC_ISO15693_UID_MAXSIZE) { 442 + r = -EPROTO; 443 + goto exit; 444 + } 445 + 446 + memcpy(target->iso15693_uid, inventory_skb->data, inventory_skb->len); 447 + target->iso15693_dsfid = inventory_skb->data[1]; 448 + target->is_iso15693 = 1; 449 + exit: 450 + kfree_skb(inventory_skb); 451 + return r; 452 + } 453 + 454 + static int st21nfca_hci_target_from_gate(struct nfc_hci_dev *hdev, u8 gate, 455 + struct nfc_target *target) 456 + { 457 + int r, len; 458 + u16 atqa; 459 + u8 sak; 460 + u8 uid[NFC_NFCID1_MAXSIZE]; 461 + 462 + switch (gate) { 463 + case ST21NFCA_RF_READER_F_GATE: 464 + target->supported_protocols = NFC_PROTO_FELICA_MASK; 465 + break; 466 + case ST21NFCA_RF_READER_14443_3_A_GATE: 467 + /* ISO14443-3 type 1 or 2 tags */ 468 + r = st21nfca_get_iso14443_3_atqa(hdev, &atqa); 469 + if (r < 0) 470 + return r; 471 + if (atqa == 0x000c) { 472 + target->supported_protocols = NFC_PROTO_JEWEL_MASK; 473 + target->sens_res = 0x0c00; 474 + } else { 475 + r = st21nfca_get_iso14443_3_sak(hdev, &sak); 476 + if (r < 0) 477 + return r; 478 + 479 + r = st21nfca_get_iso14443_3_uid(hdev, uid, &len); 480 + if (r < 0) 481 + return r; 482 + 483 + target->supported_protocols = 484 + nfc_hci_sak_to_protocol(sak); 485 + if (target->supported_protocols == 0xffffffff) 486 + return -EPROTO; 487 + 488 + target->sens_res = atqa; 489 + target->sel_res = sak; 490 + memcpy(target->nfcid1, uid, len); 491 + target->nfcid1_len = len; 492 + } 493 + 494 + break; 495 + case ST21NFCA_RF_READER_ISO15693_GATE: 496 + target->supported_protocols = NFC_PROTO_ISO15693_MASK; 497 + r = st21nfca_get_iso15693_inventory(hdev, target); 498 + if (r < 0) 499 + return r; 500 + break; 501 + default: 502 + return -EPROTO; 503 + } 504 + 505 + return 0; 506 + } 507 + 508 + #define ST21NFCA_CB_TYPE_READER_ISO15693 1 509 + static void st21nfca_hci_data_exchange_cb(void *context, struct sk_buff *skb, 510 + int err) 511 + { 512 + struct st21nfca_hci_info *info = context; 513 + 514 + switch (info->async_cb_type) { 515 + case ST21NFCA_CB_TYPE_READER_ISO15693: 516 + if (err == 0) 517 + skb_trim(skb, skb->len - 1); 518 + info->async_cb(info->async_cb_context, skb, err); 519 + break; 520 + default: 521 + if (err == 0) 522 + kfree_skb(skb); 523 + break; 524 + } 525 + } 526 + 527 + /* 528 + * Returns: 529 + * <= 0: driver handled the data exchange 530 + * 1: driver doesn't especially handle, please do standard processing 531 + */ 532 + static int st21nfca_hci_im_transceive(struct nfc_hci_dev *hdev, 533 + struct nfc_target *target, 534 + struct sk_buff *skb, 535 + data_exchange_cb_t cb, void *cb_context) 536 + { 537 + struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); 538 + 539 + pr_info(DRIVER_DESC ": %s for gate=%d len=%d\n", __func__, 540 + target->hci_reader_gate, skb->len); 541 + 542 + switch (target->hci_reader_gate) { 543 + case ST21NFCA_RF_READER_F_GATE: 544 + *skb_push(skb, 1) = 0x1a; 545 + return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate, 546 + ST21NFCA_WR_XCHG_DATA, skb->data, 547 + skb->len, cb, cb_context); 548 + case ST21NFCA_RF_READER_14443_3_A_GATE: 549 + *skb_push(skb, 1) = 0x1a; /* CTR, see spec:10.2.2.1 */ 550 + 551 + return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate, 552 + ST21NFCA_WR_XCHG_DATA, skb->data, 553 + skb->len, cb, cb_context); 554 + case ST21NFCA_RF_READER_ISO15693_GATE: 555 + info->async_cb_type = ST21NFCA_CB_TYPE_READER_ISO15693; 556 + info->async_cb = cb; 557 + info->async_cb_context = cb_context; 558 + 559 + *skb_push(skb, 1) = 0x17; 560 + 561 + return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate, 562 + ST21NFCA_WR_XCHG_DATA, skb->data, 563 + skb->len, 564 + st21nfca_hci_data_exchange_cb, 565 + info); 566 + break; 567 + default: 568 + return 1; 569 + } 570 + } 571 + 572 + static int st21nfca_hci_check_presence(struct nfc_hci_dev *hdev, 573 + struct nfc_target *target) 574 + { 575 + u8 fwi = 0x11; 576 + switch (target->hci_reader_gate) { 577 + case NFC_HCI_RF_READER_A_GATE: 578 + case NFC_HCI_RF_READER_B_GATE: 579 + /* 580 + * PRESENCE_CHECK on those gates is available 581 + * However, the answer to this command is taking 3 * fwi 582 + * if the card is no present. 583 + * Instead, we send an empty I-Frame with a very short 584 + * configurable fwi ~604µs. 585 + */ 586 + return nfc_hci_send_cmd(hdev, target->hci_reader_gate, 587 + ST21NFCA_WR_XCHG_DATA, &fwi, 1, NULL); 588 + case ST21NFCA_RF_READER_14443_3_A_GATE: 589 + return nfc_hci_send_cmd(hdev, target->hci_reader_gate, 590 + ST21NFCA_RF_READER_CMD_PRESENCE_CHECK, 591 + NULL, 0, NULL); 592 + default: 593 + return -EOPNOTSUPP; 594 + } 595 + } 596 + 597 + static struct nfc_hci_ops st21nfca_hci_ops = { 598 + .open = st21nfca_hci_open, 599 + .close = st21nfca_hci_close, 600 + .load_session = st21nfca_hci_load_session, 601 + .hci_ready = st21nfca_hci_ready, 602 + .xmit = st21nfca_hci_xmit, 603 + .start_poll = st21nfca_hci_start_poll, 604 + .target_from_gate = st21nfca_hci_target_from_gate, 605 + .im_transceive = st21nfca_hci_im_transceive, 606 + .check_presence = st21nfca_hci_check_presence, 607 + }; 608 + 609 + int st21nfca_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, 610 + char *llc_name, int phy_headroom, int phy_tailroom, 611 + int phy_payload, struct nfc_hci_dev **hdev) 612 + { 613 + struct st21nfca_hci_info *info; 614 + int r = 0; 615 + int dev_num; 616 + u32 protocols; 617 + struct nfc_hci_init_data init_data; 618 + unsigned long quirks = 0; 619 + 620 + info = kzalloc(sizeof(struct st21nfca_hci_info), GFP_KERNEL); 621 + if (!info) { 622 + r = -ENOMEM; 623 + goto err_alloc_hdev; 624 + } 625 + 626 + info->phy_ops = phy_ops; 627 + info->phy_id = phy_id; 628 + info->state = ST21NFCA_ST_COLD; 629 + mutex_init(&info->info_lock); 630 + 631 + init_data.gate_count = ARRAY_SIZE(st21nfca_gates); 632 + 633 + memcpy(init_data.gates, st21nfca_gates, sizeof(st21nfca_gates)); 634 + 635 + /* 636 + * Session id must include the driver name + i2c bus addr 637 + * persistent info to discriminate 2 identical chips 638 + */ 639 + dev_num = find_first_zero_bit(dev_mask, ST21NFCA_NUM_DEVICES); 640 + if (dev_num >= ST21NFCA_NUM_DEVICES) 641 + goto err_alloc_hdev; 642 + 643 + scnprintf(init_data.session_id, sizeof(init_data.session_id), "%s%2x", 644 + "ST21AH", dev_num); 645 + 646 + protocols = NFC_PROTO_JEWEL_MASK | 647 + NFC_PROTO_MIFARE_MASK | 648 + NFC_PROTO_FELICA_MASK | 649 + NFC_PROTO_ISO14443_MASK | 650 + NFC_PROTO_ISO14443_B_MASK | 651 + NFC_PROTO_ISO15693_MASK; 652 + 653 + set_bit(NFC_HCI_QUIRK_SHORT_CLEAR, &quirks); 654 + 655 + info->hdev = 656 + nfc_hci_allocate_device(&st21nfca_hci_ops, &init_data, quirks, 657 + protocols, llc_name, 658 + phy_headroom + ST21NFCA_CMDS_HEADROOM, 659 + phy_tailroom, phy_payload); 660 + 661 + if (!info->hdev) { 662 + pr_err("Cannot allocate nfc hdev.\n"); 663 + r = -ENOMEM; 664 + goto err_alloc_hdev; 665 + } 666 + 667 + nfc_hci_set_clientdata(info->hdev, info); 668 + 669 + r = nfc_hci_register_device(info->hdev); 670 + if (r) 671 + goto err_regdev; 672 + 673 + *hdev = info->hdev; 674 + 675 + return 0; 676 + 677 + err_regdev: 678 + nfc_hci_free_device(info->hdev); 679 + 680 + err_alloc_hdev: 681 + kfree(info); 682 + 683 + return r; 684 + } 685 + EXPORT_SYMBOL(st21nfca_hci_probe); 686 + 687 + void st21nfca_hci_remove(struct nfc_hci_dev *hdev) 688 + { 689 + struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); 690 + 691 + nfc_hci_unregister_device(hdev); 692 + nfc_hci_free_device(hdev); 693 + kfree(info); 694 + } 695 + EXPORT_SYMBOL(st21nfca_hci_remove); 696 + 697 + MODULE_LICENSE("GPL"); 698 + MODULE_DESCRIPTION(DRIVER_DESC);
+87
drivers/nfc/st21nfca/st21nfca.h
··· 1 + /* 2 + * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved. 3 + * 4 + * This program is free software; you can redistribute it and/or modify it 5 + * under the terms and conditions of the GNU General Public License, 6 + * version 2, as published by the Free Software Foundation. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + * 13 + * You should have received a copy of the GNU General Public License 14 + * along with this program; if not, see <http://www.gnu.org/licenses/>. 15 + */ 16 + 17 + #ifndef __LOCAL_ST21NFCA_H_ 18 + #define __LOCAL_ST21NFCA_H_ 19 + 20 + #include <net/nfc/hci.h> 21 + 22 + #define HCI_MODE 0 23 + 24 + /* framing in HCI mode */ 25 + #define ST21NFCA_SOF_EOF_LEN 2 26 + 27 + /* Almost every time value is 0 */ 28 + #define ST21NFCA_HCI_LLC_LEN 1 29 + 30 + /* Size in worst case : 31 + * In normal case CRC len = 2 but byte stuffing 32 + * may appear in case one CRC byte = ST21NFCA_SOF_EOF 33 + */ 34 + #define ST21NFCA_HCI_LLC_CRC 4 35 + 36 + #define ST21NFCA_HCI_LLC_LEN_CRC (ST21NFCA_SOF_EOF_LEN + \ 37 + ST21NFCA_HCI_LLC_LEN + \ 38 + ST21NFCA_HCI_LLC_CRC) 39 + #define ST21NFCA_HCI_LLC_MIN_SIZE (1 + ST21NFCA_HCI_LLC_LEN_CRC) 40 + 41 + /* Worst case when adding byte stuffing between each byte */ 42 + #define ST21NFCA_HCI_LLC_MAX_PAYLOAD 29 43 + #define ST21NFCA_HCI_LLC_MAX_SIZE (ST21NFCA_HCI_LLC_LEN_CRC + 1 + \ 44 + ST21NFCA_HCI_LLC_MAX_PAYLOAD) 45 + 46 + #define DRIVER_DESC "HCI NFC driver for ST21NFCA" 47 + 48 + #define ST21NFCA_HCI_MODE 0 49 + 50 + #define ST21NFCA_NUM_DEVICES 256 51 + 52 + int st21nfca_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, 53 + char *llc_name, int phy_headroom, int phy_tailroom, 54 + int phy_payload, struct nfc_hci_dev **hdev); 55 + void st21nfca_hci_remove(struct nfc_hci_dev *hdev); 56 + 57 + enum st21nfca_state { 58 + ST21NFCA_ST_COLD, 59 + ST21NFCA_ST_READY, 60 + }; 61 + 62 + struct st21nfca_hci_info { 63 + struct nfc_phy_ops *phy_ops; 64 + void *phy_id; 65 + 66 + struct nfc_hci_dev *hdev; 67 + 68 + enum st21nfca_state state; 69 + 70 + struct mutex info_lock; 71 + 72 + int async_cb_type; 73 + data_exchange_cb_t async_cb; 74 + void *async_cb_context; 75 + 76 + } __packed; 77 + 78 + /* Reader RF commands */ 79 + #define ST21NFCA_WR_XCHG_DATA 0x10 80 + 81 + #define ST21NFCA_RF_READER_F_GATE 0x14 82 + #define ST21NFCA_RF_READER_F_DATARATE 0x01 83 + #define ST21NFCA_RF_READER_F_DATARATE_106 0x01 84 + #define ST21NFCA_RF_READER_F_DATARATE_212 0x02 85 + #define ST21NFCA_RF_READER_F_DATARATE_424 0x04 86 + 87 + #endif /* __LOCAL_ST21NFCA_H_ */
+182 -70
drivers/nfc/trf7970a.c
··· 16 16 #include <linux/device.h> 17 17 #include <linux/netdevice.h> 18 18 #include <linux/interrupt.h> 19 + #include <linux/pm_runtime.h> 19 20 #include <linux/nfc.h> 20 21 #include <linux/skbuff.h> 21 22 #include <linux/delay.h> ··· 68 67 * only the SRX bit set, it means that all of the data has been received 69 68 * (once what's in the fifo has been read). However, depending on timing 70 69 * an interrupt status with only the SRX bit set may not be recived. In 71 - * those cases, the timeout mechanism is used to wait 5 ms in case more 72 - * data arrives. After 5 ms, it is assumed that all of the data has been 70 + * those cases, the timeout mechanism is used to wait 20 ms in case more 71 + * data arrives. After 20 ms, it is assumed that all of the data has been 73 72 * received and the accumulated rx data is sent upstream. The 74 73 * 'TRF7970A_ST_WAIT_FOR_RX_DATA_CONT' state is used for this purpose 75 74 * (i.e., it indicates that some data has been received but we're not sure 76 75 * if there is more coming so a timeout in this state means all data has 77 - * been received and there isn't an error). The delay is 5 ms since delays 78 - * over 2 ms have been observed during testing (a little extra just in case). 76 + * been received and there isn't an error). The delay is 20 ms since delays 77 + * of ~16 ms have been observed during testing. 79 78 * 80 79 * Type 2 write and sector select commands respond with a 4-bit ACK or NACK. 81 80 * Having only 4 bits in the FIFO won't normally generate an interrupt so ··· 105 104 106 105 #define TRF7970A_SUPPORTED_PROTOCOLS \ 107 106 (NFC_PROTO_MIFARE_MASK | NFC_PROTO_ISO14443_MASK | \ 108 - NFC_PROTO_ISO15693_MASK) 107 + NFC_PROTO_ISO14443_B_MASK | NFC_PROTO_ISO15693_MASK) 108 + 109 + #define TRF7970A_AUTOSUSPEND_DELAY 30000 /* 30 seconds */ 109 110 110 111 /* TX data must be prefixed with a FIFO reset cmd, a cmd that depends 111 112 * on what the current framing is, the address of the TX length byte 1 ··· 123 120 /* TX length is 3 nibbles long ==> 4KB - 1 bytes max */ 124 121 #define TRF7970A_TX_MAX (4096 - 1) 125 122 126 - #define TRF7970A_WAIT_FOR_RX_DATA_TIMEOUT 5 123 + #define TRF7970A_WAIT_FOR_RX_DATA_TIMEOUT 20 127 124 #define TRF7970A_WAIT_FOR_FIFO_DRAIN_TIMEOUT 3 128 125 #define TRF7970A_WAIT_TO_ISSUE_ISO15693_EOF 20 129 126 ··· 333 330 struct regulator *regulator; 334 331 struct nfc_digital_dev *ddev; 335 332 u32 quirks; 336 - bool powering_up; 337 333 bool aborting; 338 334 struct sk_buff *tx_skb; 339 335 struct sk_buff *rx_skb; 340 336 nfc_digital_cmd_complete_t cb; 341 337 void *cb_arg; 338 + u8 chip_status_ctrl; 342 339 u8 iso_ctrl; 340 + u8 iso_ctrl_tech; 341 + u8 modulator_sys_clk_ctrl; 343 342 u8 special_fcn_reg1; 344 343 int technology; 345 344 int framing; ··· 686 681 trf->ignore_timeout = 687 682 !cancel_delayed_work(&trf->timeout_work); 688 683 trf7970a_drain_fifo(trf, status); 689 - } else if (!(status & TRF7970A_IRQ_STATUS_TX)) { 684 + } else if (status == TRF7970A_IRQ_STATUS_TX) { 685 + trf7970a_cmd(trf, TRF7970A_CMD_FIFO_RESET); 686 + } else { 690 687 trf7970a_send_err_upstream(trf, -EIO); 691 688 } 692 689 break; ··· 764 757 if (ret) 765 758 goto err_out; 766 759 767 - ret = trf7970a_write(trf, TRF7970A_MODULATOR_SYS_CLK_CTRL, 768 - TRF7970A_MODULATOR_DEPTH_OOK); 760 + /* Must clear NFC Target Detection Level reg due to erratum */ 761 + ret = trf7970a_write(trf, TRF7970A_NFC_TARGET_LEVEL, 0); 769 762 if (ret) 770 763 goto err_out; 771 764 ··· 781 774 782 775 trf->special_fcn_reg1 = 0; 783 776 784 - ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL, 785 - TRF7970A_CHIP_STATUS_RF_ON | 786 - TRF7970A_CHIP_STATUS_VRS5_3); 787 - if (ret) 788 - goto err_out; 789 - 777 + trf->iso_ctrl = 0xff; 790 778 return 0; 791 779 792 780 err_out: ··· 793 791 { 794 792 dev_dbg(trf->dev, "Switching rf off\n"); 795 793 796 - gpio_set_value(trf->en_gpio, 0); 797 - gpio_set_value(trf->en2_gpio, 0); 794 + trf->chip_status_ctrl &= ~TRF7970A_CHIP_STATUS_RF_ON; 795 + 796 + trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL, trf->chip_status_ctrl); 798 797 799 798 trf->aborting = false; 800 799 trf->state = TRF7970A_ST_OFF; 800 + 801 + pm_runtime_mark_last_busy(trf->dev); 802 + pm_runtime_put_autosuspend(trf->dev); 801 803 } 802 804 803 - static int trf7970a_switch_rf_on(struct trf7970a *trf) 805 + static void trf7970a_switch_rf_on(struct trf7970a *trf) 804 806 { 805 - unsigned long delay; 806 - int ret; 807 - 808 807 dev_dbg(trf->dev, "Switching rf on\n"); 809 808 810 - if (trf->powering_up) 811 - usleep_range(5000, 6000); 809 + pm_runtime_get_sync(trf->dev); 812 810 813 - gpio_set_value(trf->en2_gpio, 1); 814 - usleep_range(1000, 2000); 815 - gpio_set_value(trf->en_gpio, 1); 816 - 817 - /* The delay between enabling the trf7970a and issuing the first 818 - * command is significantly longer the very first time after powering 819 - * up. Make sure the longer delay is only done the first time. 820 - */ 821 - if (trf->powering_up) { 822 - delay = 20000; 823 - trf->powering_up = false; 824 - } else { 825 - delay = 5000; 826 - } 827 - 828 - usleep_range(delay, delay + 1000); 829 - 830 - ret = trf7970a_init(trf); 831 - if (ret) 832 - trf7970a_switch_rf_off(trf); 833 - else 834 - trf->state = TRF7970A_ST_IDLE; 835 - 836 - return ret; 811 + trf->state = TRF7970A_ST_IDLE; 837 812 } 838 813 839 814 static int trf7970a_switch_rf(struct nfc_digital_dev *ddev, bool on) 840 815 { 841 816 struct trf7970a *trf = nfc_digital_get_drvdata(ddev); 842 - int ret = 0; 843 817 844 818 dev_dbg(trf->dev, "Switching RF - state: %d, on: %d\n", trf->state, on); 845 819 ··· 824 846 if (on) { 825 847 switch (trf->state) { 826 848 case TRF7970A_ST_OFF: 827 - ret = trf7970a_switch_rf_on(trf); 849 + trf7970a_switch_rf_on(trf); 828 850 break; 829 851 case TRF7970A_ST_IDLE: 830 852 case TRF7970A_ST_IDLE_RX_BLOCKED: ··· 849 871 } 850 872 851 873 mutex_unlock(&trf->lock); 852 - return ret; 874 + return 0; 853 875 } 854 876 855 877 static int trf7970a_config_rf_tech(struct trf7970a *trf, int tech) ··· 860 882 861 883 switch (tech) { 862 884 case NFC_DIGITAL_RF_TECH_106A: 863 - trf->iso_ctrl = TRF7970A_ISO_CTRL_14443A_106; 885 + trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_14443A_106; 886 + trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_OOK; 887 + break; 888 + case NFC_DIGITAL_RF_TECH_106B: 889 + trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_14443B_106; 890 + trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_ASK10; 864 891 break; 865 892 case NFC_DIGITAL_RF_TECH_ISO15693: 866 - trf->iso_ctrl = TRF7970A_ISO_CTRL_15693_SGL_1OF4_2648; 893 + trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_15693_SGL_1OF4_2648; 894 + trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_OOK; 867 895 break; 868 896 default: 869 897 dev_dbg(trf->dev, "Unsupported rf technology: %d\n", tech); ··· 883 899 884 900 static int trf7970a_config_framing(struct trf7970a *trf, int framing) 885 901 { 902 + u8 iso_ctrl = trf->iso_ctrl_tech; 903 + int ret; 904 + 886 905 dev_dbg(trf->dev, "framing: %d\n", framing); 887 906 888 907 switch (framing) { 889 908 case NFC_DIGITAL_FRAMING_NFCA_SHORT: 890 909 case NFC_DIGITAL_FRAMING_NFCA_STANDARD: 891 910 trf->tx_cmd = TRF7970A_CMD_TRANSMIT_NO_CRC; 892 - trf->iso_ctrl |= TRF7970A_ISO_CTRL_RX_CRC_N; 911 + iso_ctrl |= TRF7970A_ISO_CTRL_RX_CRC_N; 893 912 break; 894 913 case NFC_DIGITAL_FRAMING_NFCA_STANDARD_WITH_CRC_A: 895 914 case NFC_DIGITAL_FRAMING_NFCA_T4T: 915 + case NFC_DIGITAL_FRAMING_NFCB: 916 + case NFC_DIGITAL_FRAMING_NFCB_T4T: 896 917 case NFC_DIGITAL_FRAMING_ISO15693_INVENTORY: 897 918 case NFC_DIGITAL_FRAMING_ISO15693_T5T: 898 919 trf->tx_cmd = TRF7970A_CMD_TRANSMIT; 899 - trf->iso_ctrl &= ~TRF7970A_ISO_CTRL_RX_CRC_N; 920 + iso_ctrl &= ~TRF7970A_ISO_CTRL_RX_CRC_N; 900 921 break; 901 922 case NFC_DIGITAL_FRAMING_NFCA_T2T: 902 923 trf->tx_cmd = TRF7970A_CMD_TRANSMIT; 903 - trf->iso_ctrl |= TRF7970A_ISO_CTRL_RX_CRC_N; 924 + iso_ctrl |= TRF7970A_ISO_CTRL_RX_CRC_N; 904 925 break; 905 926 default: 906 927 dev_dbg(trf->dev, "Unsupported Framing: %d\n", framing); ··· 914 925 915 926 trf->framing = framing; 916 927 917 - return trf7970a_write(trf, TRF7970A_ISO_CTRL, trf->iso_ctrl); 928 + if (iso_ctrl != trf->iso_ctrl) { 929 + ret = trf7970a_write(trf, TRF7970A_ISO_CTRL, iso_ctrl); 930 + if (ret) 931 + return ret; 932 + 933 + trf->iso_ctrl = iso_ctrl; 934 + 935 + ret = trf7970a_write(trf, TRF7970A_MODULATOR_SYS_CLK_CTRL, 936 + trf->modulator_sys_clk_ctrl); 937 + if (ret) 938 + return ret; 939 + } 940 + 941 + if (!(trf->chip_status_ctrl & TRF7970A_CHIP_STATUS_RF_ON)) { 942 + ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL, 943 + trf->chip_status_ctrl | 944 + TRF7970A_CHIP_STATUS_RF_ON); 945 + if (ret) 946 + return ret; 947 + 948 + trf->chip_status_ctrl |= TRF7970A_CHIP_STATUS_RF_ON; 949 + 950 + usleep_range(5000, 6000); 951 + } 952 + 953 + return 0; 918 954 } 919 955 920 956 static int trf7970a_in_configure_hw(struct nfc_digital_dev *ddev, int type, 921 957 int param) 922 958 { 923 959 struct trf7970a *trf = nfc_digital_get_drvdata(ddev); 924 - int ret = 0; 960 + int ret; 925 961 926 962 dev_dbg(trf->dev, "Configure hw - type: %d, param: %d\n", type, param); 927 963 928 964 mutex_lock(&trf->lock); 929 965 930 - if (trf->state == TRF7970A_ST_OFF) { 931 - ret = trf7970a_switch_rf_on(trf); 932 - if (ret) 933 - goto err_out; 934 - } 966 + if (trf->state == TRF7970A_ST_OFF) 967 + trf7970a_switch_rf_on(trf); 935 968 936 969 switch (type) { 937 970 case NFC_DIGITAL_CONFIG_RF_TECH: ··· 967 956 ret = -EINVAL; 968 957 } 969 958 970 - err_out: 971 959 mutex_unlock(&trf->lock); 972 960 return ret; 973 961 } ··· 1201 1191 dev_dbg(trf->dev, "Abort process initiated\n"); 1202 1192 1203 1193 mutex_lock(&trf->lock); 1204 - trf->aborting = true; 1194 + 1195 + switch (trf->state) { 1196 + case TRF7970A_ST_WAIT_FOR_TX_FIFO: 1197 + case TRF7970A_ST_WAIT_FOR_RX_DATA: 1198 + case TRF7970A_ST_WAIT_FOR_RX_DATA_CONT: 1199 + case TRF7970A_ST_WAIT_TO_ISSUE_EOF: 1200 + trf->aborting = true; 1201 + break; 1202 + default: 1203 + break; 1204 + } 1205 + 1205 1206 mutex_unlock(&trf->lock); 1206 1207 } 1207 1208 ··· 1227 1206 .abort_cmd = trf7970a_abort_cmd, 1228 1207 }; 1229 1208 1209 + static int trf7970a_get_autosuspend_delay(struct device_node *np) 1210 + { 1211 + int autosuspend_delay, ret; 1212 + 1213 + ret = of_property_read_u32(np, "autosuspend-delay", &autosuspend_delay); 1214 + if (ret) 1215 + autosuspend_delay = TRF7970A_AUTOSUSPEND_DELAY; 1216 + 1217 + of_node_put(np); 1218 + 1219 + return autosuspend_delay; 1220 + } 1221 + 1230 1222 static int trf7970a_probe(struct spi_device *spi) 1231 1223 { 1232 1224 struct device_node *np = spi->dev.of_node; 1233 1225 const struct spi_device_id *id = spi_get_device_id(spi); 1234 1226 struct trf7970a *trf; 1235 - int ret; 1227 + int uvolts, autosuspend_delay, ret; 1236 1228 1237 1229 if (!np) { 1238 1230 dev_err(&spi->dev, "No Device Tree entry\n"); ··· 1315 1281 goto err_destroy_lock; 1316 1282 } 1317 1283 1318 - trf->powering_up = true; 1284 + uvolts = regulator_get_voltage(trf->regulator); 1285 + 1286 + if (uvolts > 4000000) 1287 + trf->chip_status_ctrl = TRF7970A_CHIP_STATUS_VRS5_3; 1319 1288 1320 1289 trf->ddev = nfc_digital_allocate_device(&trf7970a_nfc_ops, 1321 1290 TRF7970A_SUPPORTED_PROTOCOLS, ··· 1334 1297 nfc_digital_set_drvdata(trf->ddev, trf); 1335 1298 spi_set_drvdata(spi, trf); 1336 1299 1300 + autosuspend_delay = trf7970a_get_autosuspend_delay(np); 1301 + 1302 + pm_runtime_set_autosuspend_delay(trf->dev, autosuspend_delay); 1303 + pm_runtime_use_autosuspend(trf->dev); 1304 + pm_runtime_enable(trf->dev); 1305 + 1337 1306 ret = nfc_digital_register_device(trf->ddev); 1338 1307 if (ret) { 1339 1308 dev_err(trf->dev, "Can't register NFC digital device: %d\n", ··· 1350 1307 return 0; 1351 1308 1352 1309 err_free_ddev: 1310 + pm_runtime_disable(trf->dev); 1353 1311 nfc_digital_free_device(trf->ddev); 1354 1312 err_disable_regulator: 1355 1313 regulator_disable(trf->regulator); ··· 1365 1321 1366 1322 mutex_lock(&trf->lock); 1367 1323 1368 - trf7970a_switch_rf_off(trf); 1369 - trf7970a_init(trf); 1370 - 1371 1324 switch (trf->state) { 1372 1325 case TRF7970A_ST_WAIT_FOR_TX_FIFO: 1373 1326 case TRF7970A_ST_WAIT_FOR_RX_DATA: 1374 1327 case TRF7970A_ST_WAIT_FOR_RX_DATA_CONT: 1375 1328 case TRF7970A_ST_WAIT_TO_ISSUE_EOF: 1376 1329 trf7970a_send_err_upstream(trf, -ECANCELED); 1330 + /* FALLTHROUGH */ 1331 + case TRF7970A_ST_IDLE: 1332 + case TRF7970A_ST_IDLE_RX_BLOCKED: 1333 + pm_runtime_put_sync(trf->dev); 1377 1334 break; 1378 1335 default: 1379 1336 break; 1380 1337 } 1381 1338 1382 1339 mutex_unlock(&trf->lock); 1340 + 1341 + pm_runtime_disable(trf->dev); 1383 1342 1384 1343 nfc_digital_unregister_device(trf->ddev); 1385 1344 nfc_digital_free_device(trf->ddev); ··· 1393 1346 1394 1347 return 0; 1395 1348 } 1349 + 1350 + #ifdef CONFIG_PM_RUNTIME 1351 + static int trf7970a_pm_runtime_suspend(struct device *dev) 1352 + { 1353 + struct spi_device *spi = container_of(dev, struct spi_device, dev); 1354 + struct trf7970a *trf = spi_get_drvdata(spi); 1355 + int ret; 1356 + 1357 + dev_dbg(dev, "Runtime suspend\n"); 1358 + 1359 + if (trf->state != TRF7970A_ST_OFF) { 1360 + dev_dbg(dev, "Can't suspend - not in OFF state (%d)\n", 1361 + trf->state); 1362 + return -EBUSY; 1363 + } 1364 + 1365 + gpio_set_value(trf->en_gpio, 0); 1366 + gpio_set_value(trf->en2_gpio, 0); 1367 + 1368 + ret = regulator_disable(trf->regulator); 1369 + if (ret) 1370 + dev_err(dev, "%s - Can't disable VIN: %d\n", __func__, ret); 1371 + 1372 + return ret; 1373 + } 1374 + 1375 + static int trf7970a_pm_runtime_resume(struct device *dev) 1376 + { 1377 + struct spi_device *spi = container_of(dev, struct spi_device, dev); 1378 + struct trf7970a *trf = spi_get_drvdata(spi); 1379 + int ret; 1380 + 1381 + dev_dbg(dev, "Runtime resume\n"); 1382 + 1383 + ret = regulator_enable(trf->regulator); 1384 + if (ret) { 1385 + dev_err(dev, "%s - Can't enable VIN: %d\n", __func__, ret); 1386 + return ret; 1387 + } 1388 + 1389 + usleep_range(5000, 6000); 1390 + 1391 + gpio_set_value(trf->en2_gpio, 1); 1392 + usleep_range(1000, 2000); 1393 + gpio_set_value(trf->en_gpio, 1); 1394 + 1395 + usleep_range(20000, 21000); 1396 + 1397 + ret = trf7970a_init(trf); 1398 + if (ret) { 1399 + dev_err(dev, "%s - Can't initialize: %d\n", __func__, ret); 1400 + return ret; 1401 + } 1402 + 1403 + pm_runtime_mark_last_busy(dev); 1404 + 1405 + return 0; 1406 + } 1407 + #endif 1408 + 1409 + static const struct dev_pm_ops trf7970a_pm_ops = { 1410 + SET_RUNTIME_PM_OPS(trf7970a_pm_runtime_suspend, 1411 + trf7970a_pm_runtime_resume, NULL) 1412 + }; 1396 1413 1397 1414 static const struct spi_device_id trf7970a_id_table[] = { 1398 1415 { "trf7970a", TRF7970A_QUIRK_IRQ_STATUS_READ_ERRATA }, ··· 1471 1360 .driver = { 1472 1361 .name = "trf7970a", 1473 1362 .owner = THIS_MODULE, 1363 + .pm = &trf7970a_pm_ops, 1474 1364 }, 1475 1365 }; 1476 1366
+2 -2
drivers/staging/wlan-ng/cfg80211.c
··· 84 84 } 85 85 86 86 static int prism2_domibset_pstr32(wlandevice_t *wlandev, 87 - u32 did, u8 len, u8 *data) 87 + u32 did, u8 len, const u8 *data) 88 88 { 89 89 struct p80211msg_dot11req_mibset msg; 90 90 p80211item_pstr32_t *mibitem = ··· 298 298 299 299 300 300 static int prism2_get_station(struct wiphy *wiphy, struct net_device *dev, 301 - u8 *mac, struct station_info *sinfo) 301 + const u8 *mac, struct station_info *sinfo) 302 302 { 303 303 wlandevice_t *wlandev = dev->ml_priv; 304 304 struct p80211msg_lnxreq_commsquality quality;
+2
include/linux/ath9k_platform.h
··· 36 36 37 37 int (*get_mac_revision)(void); 38 38 int (*external_reset)(void); 39 + 40 + bool use_eeprom; 39 41 }; 40 42 41 43 #endif /* _LINUX_ATH9K_PLATFORM_H */
+4 -4
include/linux/crc7.h
··· 2 2 #define _LINUX_CRC7_H 3 3 #include <linux/types.h> 4 4 5 - extern const u8 crc7_syndrome_table[256]; 5 + extern const u8 crc7_be_syndrome_table[256]; 6 6 7 - static inline u8 crc7_byte(u8 crc, u8 data) 7 + static inline u8 crc7_be_byte(u8 crc, u8 data) 8 8 { 9 - return crc7_syndrome_table[(crc << 1) ^ data]; 9 + return crc7_be_syndrome_table[crc ^ data]; 10 10 } 11 11 12 - extern u8 crc7(u8 crc, const u8 *buffer, size_t len); 12 + extern u8 crc7_be(u8 crc, const u8 *buffer, size_t len); 13 13 14 14 #endif
+32
include/linux/platform_data/st21nfca.h
··· 1 + /* 2 + * Driver include for the ST21NFCA NFC chip. 3 + * 4 + * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms and conditions of the GNU General Public License, 8 + * version 2, as published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + * 15 + * You should have received a copy of the GNU General Public License 16 + * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 + */ 18 + 19 + #ifndef _ST21NFCA_HCI_H_ 20 + #define _ST21NFCA_HCI_H_ 21 + 22 + #include <linux/i2c.h> 23 + 24 + #define ST21NFCA_HCI_DRIVER_NAME "st21nfca_hci" 25 + 26 + struct st21nfca_nfc_platform_data { 27 + unsigned int gpio_irq; 28 + unsigned int gpio_ena; 29 + unsigned int irq_polarity; 30 + }; 31 + 32 + #endif /* _ST21NFCA_HCI_H_ */
-10
include/linux/rfkill-gpio.h
··· 27 27 * struct rfkill_gpio_platform_data - platform data for rfkill gpio device. 28 28 * for unused gpio's, the expected value is -1. 29 29 * @name: name for the gpio rf kill instance 30 - * @reset_gpio: GPIO which is used for reseting rfkill switch 31 - * @shutdown_gpio: GPIO which is used for shutdown of rfkill switch 32 - * @power_clk_name: [optional] name of clk to turn off while blocked 33 - * @gpio_runtime_close: clean up platform specific gpio configuration 34 - * @gpio_runtime_setup: set up platform specific gpio configuration 35 30 */ 36 31 37 32 struct rfkill_gpio_platform_data { 38 33 char *name; 39 - int reset_gpio; 40 - int shutdown_gpio; 41 - const char *power_clk_name; 42 34 enum rfkill_type type; 43 - void (*gpio_runtime_close)(struct platform_device *); 44 - int (*gpio_runtime_setup)(struct platform_device *); 45 35 }; 46 36 47 37 #endif /* __RFKILL_GPIO_H */
+1
include/linux/ssb/ssb.h
··· 33 33 u8 et1phyaddr; /* MII address for enet1 */ 34 34 u8 et0mdcport; /* MDIO for enet0 */ 35 35 u8 et1mdcport; /* MDIO for enet1 */ 36 + u16 dev_id; /* Device ID overriding e.g. PCI ID */ 36 37 u16 board_rev; /* Board revision number from SPROM. */ 37 38 u16 board_num; /* Board number from SPROM. */ 38 39 u16 board_type; /* Board type from SPROM. */
+133 -58
include/net/cfg80211.h
··· 341 341 * @seq_len: length of @seq. 342 342 */ 343 343 struct key_params { 344 - u8 *key; 345 - u8 *seq; 344 + const u8 *key; 345 + const u8 *seq; 346 346 int key_len; 347 347 int seq_len; 348 348 u32 cipher; ··· 458 458 */ 459 459 int cfg80211_chandef_dfs_required(struct wiphy *wiphy, 460 460 const struct cfg80211_chan_def *chandef, 461 - enum nl80211_iftype); 461 + enum nl80211_iftype iftype); 462 462 463 463 /** 464 464 * ieee80211_chandef_rate_flags - returns rate flags for a channel ··· 694 694 * 695 695 * @chandef: defines the channel to use after the switch 696 696 * @beacon_csa: beacon data while performing the switch 697 - * @counter_offset_beacon: offset for the counter within the beacon (tail) 698 - * @counter_offset_presp: offset for the counter within the probe response 697 + * @counter_offsets_beacon: offsets of the counters within the beacon (tail) 698 + * @counter_offsets_presp: offsets of the counters within the probe response 699 + * @n_counter_offsets_beacon: number of csa counters the beacon (tail) 700 + * @n_counter_offsets_presp: number of csa counters in the probe response 699 701 * @beacon_after: beacon data to be used on the new channel 700 702 * @radar_required: whether radar detection is required on the new channel 701 703 * @block_tx: whether transmissions should be blocked while changing ··· 706 704 struct cfg80211_csa_settings { 707 705 struct cfg80211_chan_def chandef; 708 706 struct cfg80211_beacon_data beacon_csa; 709 - u16 counter_offset_beacon, counter_offset_presp; 707 + const u16 *counter_offsets_beacon; 708 + const u16 *counter_offsets_presp; 709 + unsigned int n_counter_offsets_beacon; 710 + unsigned int n_counter_offsets_presp; 710 711 struct cfg80211_beacon_data beacon_after; 711 712 bool radar_required; 712 713 bool block_tx; ··· 873 868 * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled 874 869 * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled 875 870 * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled 871 + * @STATION_INFO_EXPECTED_THROUGHPUT: @expected_throughput filled 876 872 */ 877 873 enum station_info_flags { 878 - STATION_INFO_INACTIVE_TIME = 1<<0, 879 - STATION_INFO_RX_BYTES = 1<<1, 880 - STATION_INFO_TX_BYTES = 1<<2, 881 - STATION_INFO_LLID = 1<<3, 882 - STATION_INFO_PLID = 1<<4, 883 - STATION_INFO_PLINK_STATE = 1<<5, 884 - STATION_INFO_SIGNAL = 1<<6, 885 - STATION_INFO_TX_BITRATE = 1<<7, 886 - STATION_INFO_RX_PACKETS = 1<<8, 887 - STATION_INFO_TX_PACKETS = 1<<9, 888 - STATION_INFO_TX_RETRIES = 1<<10, 889 - STATION_INFO_TX_FAILED = 1<<11, 890 - STATION_INFO_RX_DROP_MISC = 1<<12, 891 - STATION_INFO_SIGNAL_AVG = 1<<13, 892 - STATION_INFO_RX_BITRATE = 1<<14, 893 - STATION_INFO_BSS_PARAM = 1<<15, 894 - STATION_INFO_CONNECTED_TIME = 1<<16, 895 - STATION_INFO_ASSOC_REQ_IES = 1<<17, 896 - STATION_INFO_STA_FLAGS = 1<<18, 897 - STATION_INFO_BEACON_LOSS_COUNT = 1<<19, 898 - STATION_INFO_T_OFFSET = 1<<20, 899 - STATION_INFO_LOCAL_PM = 1<<21, 900 - STATION_INFO_PEER_PM = 1<<22, 901 - STATION_INFO_NONPEER_PM = 1<<23, 902 - STATION_INFO_RX_BYTES64 = 1<<24, 903 - STATION_INFO_TX_BYTES64 = 1<<25, 904 - STATION_INFO_CHAIN_SIGNAL = 1<<26, 905 - STATION_INFO_CHAIN_SIGNAL_AVG = 1<<27, 874 + STATION_INFO_INACTIVE_TIME = BIT(0), 875 + STATION_INFO_RX_BYTES = BIT(1), 876 + STATION_INFO_TX_BYTES = BIT(2), 877 + STATION_INFO_LLID = BIT(3), 878 + STATION_INFO_PLID = BIT(4), 879 + STATION_INFO_PLINK_STATE = BIT(5), 880 + STATION_INFO_SIGNAL = BIT(6), 881 + STATION_INFO_TX_BITRATE = BIT(7), 882 + STATION_INFO_RX_PACKETS = BIT(8), 883 + STATION_INFO_TX_PACKETS = BIT(9), 884 + STATION_INFO_TX_RETRIES = BIT(10), 885 + STATION_INFO_TX_FAILED = BIT(11), 886 + STATION_INFO_RX_DROP_MISC = BIT(12), 887 + STATION_INFO_SIGNAL_AVG = BIT(13), 888 + STATION_INFO_RX_BITRATE = BIT(14), 889 + STATION_INFO_BSS_PARAM = BIT(15), 890 + STATION_INFO_CONNECTED_TIME = BIT(16), 891 + STATION_INFO_ASSOC_REQ_IES = BIT(17), 892 + STATION_INFO_STA_FLAGS = BIT(18), 893 + STATION_INFO_BEACON_LOSS_COUNT = BIT(19), 894 + STATION_INFO_T_OFFSET = BIT(20), 895 + STATION_INFO_LOCAL_PM = BIT(21), 896 + STATION_INFO_PEER_PM = BIT(22), 897 + STATION_INFO_NONPEER_PM = BIT(23), 898 + STATION_INFO_RX_BYTES64 = BIT(24), 899 + STATION_INFO_TX_BYTES64 = BIT(25), 900 + STATION_INFO_CHAIN_SIGNAL = BIT(26), 901 + STATION_INFO_CHAIN_SIGNAL_AVG = BIT(27), 902 + STATION_INFO_EXPECTED_THROUGHPUT = BIT(28), 906 903 }; 907 904 908 905 /** ··· 1026 1019 * @local_pm: local mesh STA power save mode 1027 1020 * @peer_pm: peer mesh STA power save mode 1028 1021 * @nonpeer_pm: non-peer mesh STA power save mode 1022 + * @expected_throughput: expected throughput in kbps (including 802.11 headers) 1023 + * towards this station. 1029 1024 */ 1030 1025 struct station_info { 1031 1026 u32 filled; ··· 1066 1057 enum nl80211_mesh_power_mode peer_pm; 1067 1058 enum nl80211_mesh_power_mode nonpeer_pm; 1068 1059 1060 + u32 expected_throughput; 1061 + 1069 1062 /* 1070 1063 * Note: Add a new enum station_info_flags value for each new field and 1071 1064 * use it to check which fields are initialized. 1072 1065 */ 1073 1066 }; 1067 + 1068 + /** 1069 + * cfg80211_get_station - retrieve information about a given station 1070 + * @dev: the device where the station is supposed to be connected to 1071 + * @mac_addr: the mac address of the station of interest 1072 + * @sinfo: pointer to the structure to fill with the information 1073 + * 1074 + * Returns 0 on success and sinfo is filled with the available information 1075 + * otherwise returns a negative error code and the content of sinfo has to be 1076 + * considered undefined. 1077 + */ 1078 + int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 1079 + struct station_info *sinfo); 1074 1080 1075 1081 /** 1076 1082 * enum monitor_flags - monitor flags ··· 1188 1164 int use_cts_prot; 1189 1165 int use_short_preamble; 1190 1166 int use_short_slot_time; 1191 - u8 *basic_rates; 1167 + const u8 *basic_rates; 1192 1168 u8 basic_rates_len; 1193 1169 int ap_isolate; 1194 1170 int ht_opmode; ··· 1718 1694 * @ht_capa_mask: The bits of ht_capa which are to be used. 1719 1695 */ 1720 1696 struct cfg80211_ibss_params { 1721 - u8 *ssid; 1722 - u8 *bssid; 1697 + const u8 *ssid; 1698 + const u8 *bssid; 1723 1699 struct cfg80211_chan_def chandef; 1724 - u8 *ie; 1700 + const u8 *ie; 1725 1701 u8 ssid_len, ie_len; 1726 1702 u16 beacon_interval; 1727 1703 u32 basic_rates; ··· 1830 1806 * @pmkid: The PMK material itself. 1831 1807 */ 1832 1808 struct cfg80211_pmksa { 1833 - u8 *bssid; 1834 - u8 *pmkid; 1809 + const u8 *bssid; 1810 + const u8 *pmkid; 1835 1811 }; 1836 1812 1837 1813 /** ··· 1846 1822 * memory, free @mask only! 1847 1823 */ 1848 1824 struct cfg80211_pkt_pattern { 1849 - u8 *mask, *pattern; 1825 + const u8 *mask, *pattern; 1850 1826 int pattern_len; 1851 1827 int pkt_offset; 1852 1828 }; ··· 2010 1986 * @len: buffer length 2011 1987 * @no_cck: don't use cck rates for this frame 2012 1988 * @dont_wait_for_ack: tells the low level not to wait for an ack 1989 + * @n_csa_offsets: length of csa_offsets array 1990 + * @csa_offsets: array of all the csa offsets in the frame 2013 1991 */ 2014 1992 struct cfg80211_mgmt_tx_params { 2015 1993 struct ieee80211_channel *chan; ··· 2021 1995 size_t len; 2022 1996 bool no_cck; 2023 1997 bool dont_wait_for_ack; 1998 + int n_csa_offsets; 1999 + const u16 *csa_offsets; 2024 2000 }; 2025 2001 2026 2002 /** ··· 2364 2336 2365 2337 2366 2338 int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 2367 - u8 *mac, struct station_parameters *params); 2339 + const u8 *mac, 2340 + struct station_parameters *params); 2368 2341 int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 2369 - u8 *mac); 2342 + const u8 *mac); 2370 2343 int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 2371 - u8 *mac, struct station_parameters *params); 2344 + const u8 *mac, 2345 + struct station_parameters *params); 2372 2346 int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 2373 - u8 *mac, struct station_info *sinfo); 2347 + const u8 *mac, struct station_info *sinfo); 2374 2348 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 2375 - int idx, u8 *mac, struct station_info *sinfo); 2349 + int idx, u8 *mac, struct station_info *sinfo); 2376 2350 2377 2351 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 2378 - u8 *dst, u8 *next_hop); 2352 + const u8 *dst, const u8 *next_hop); 2379 2353 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 2380 - u8 *dst); 2354 + const u8 *dst); 2381 2355 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 2382 - u8 *dst, u8 *next_hop); 2356 + const u8 *dst, const u8 *next_hop); 2383 2357 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 2384 - u8 *dst, u8 *next_hop, 2385 - struct mpath_info *pinfo); 2358 + u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 2386 2359 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 2387 - int idx, u8 *dst, u8 *next_hop, 2388 - struct mpath_info *pinfo); 2360 + int idx, u8 *dst, u8 *next_hop, 2361 + struct mpath_info *pinfo); 2389 2362 int (*get_mesh_config)(struct wiphy *wiphy, 2390 2363 struct net_device *dev, 2391 2364 struct mesh_config *conf); ··· 2516 2487 struct cfg80211_gtk_rekey_data *data); 2517 2488 2518 2489 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2519 - u8 *peer, u8 action_code, u8 dialog_token, 2490 + const u8 *peer, u8 action_code, u8 dialog_token, 2520 2491 u16 status_code, u32 peer_capability, 2521 2492 const u8 *buf, size_t len); 2522 2493 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 2523 - u8 *peer, enum nl80211_tdls_operation oper); 2494 + const u8 *peer, enum nl80211_tdls_operation oper); 2524 2495 2525 2496 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 2526 2497 const u8 *peer, u64 *cookie); ··· 2667 2638 * between infrastructure and AP types must match. This is required 2668 2639 * only in special cases. 2669 2640 * @radar_detect_widths: bitmap of channel widths supported for radar detection 2641 + * @radar_detect_regions: bitmap of regions supported for radar detection 2670 2642 * 2671 2643 * With this structure the driver can describe which interface 2672 2644 * combinations it supports concurrently. ··· 2725 2695 u8 n_limits; 2726 2696 bool beacon_int_infra_match; 2727 2697 u8 radar_detect_widths; 2698 + u8 radar_detect_regions; 2728 2699 }; 2729 2700 2730 2701 struct ieee80211_txrx_stypes { ··· 2956 2925 * (including P2P GO) or 0 to indicate no such limit is advertised. The 2957 2926 * driver is allowed to advertise a theoretical limit that it can reach in 2958 2927 * some cases, but may not always reach. 2928 + * 2929 + * @max_num_csa_counters: Number of supported csa_counters in beacons 2930 + * and probe responses. This value should be set if the driver 2931 + * wishes to limit the number of csa counters. Default (0) means 2932 + * infinite. 2933 + * @max_adj_channel_rssi_comp: max offset of between the channel on which the 2934 + * frame was sent and the channel on which the frame was heard for which 2935 + * the reported rssi is still valid. If a driver is able to compensate the 2936 + * low rssi when a frame is heard on different channel, then it should set 2937 + * this variable to the maximal offset for which it can compensate. 2938 + * This value should be set in MHz. 2959 2939 */ 2960 2940 struct wiphy { 2961 2941 /* assign these fields before you register the wiphy */ ··· 3083 3041 int n_vendor_commands, n_vendor_events; 3084 3042 3085 3043 u16 max_ap_assoc_sta; 3044 + 3045 + u8 max_num_csa_counters; 3046 + u8 max_adj_channel_rssi_comp; 3086 3047 3087 3048 char priv[0] __aligned(NETDEV_ALIGN); 3088 3049 }; ··· 3315 3270 struct cfg80211_ibss_params ibss; 3316 3271 struct cfg80211_connect_params connect; 3317 3272 struct cfg80211_cached_keys *keys; 3318 - u8 *ie; 3273 + const u8 *ie; 3319 3274 size_t ie_len; 3320 3275 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 3321 3276 u8 ssid[IEEE80211_MAX_SSID_LEN]; ··· 3556 3511 * Return: 0 on success, or a negative error code. 3557 3512 */ 3558 3513 int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 3559 - enum nl80211_iftype iftype, u8 *bssid, bool qos); 3514 + enum nl80211_iftype iftype, const u8 *bssid, 3515 + bool qos); 3560 3516 3561 3517 /** 3562 3518 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame ··· 4358 4312 * and not try to connect to any AP any more. 4359 4313 */ 4360 4314 void cfg80211_disconnected(struct net_device *dev, u16 reason, 4361 - u8 *ie, size_t ie_len, gfp_t gfp); 4315 + const u8 *ie, size_t ie_len, gfp_t gfp); 4362 4316 4363 4317 /** 4364 4318 * cfg80211_ready_on_channel - notification of remain_on_channel start ··· 4813 4767 void (*iter)(const struct ieee80211_iface_combination *c, 4814 4768 void *data), 4815 4769 void *data); 4770 + 4771 + /* 4772 + * cfg80211_stop_iface - trigger interface disconnection 4773 + * 4774 + * @wiphy: the wiphy 4775 + * @wdev: wireless device 4776 + * @gfp: context flags 4777 + * 4778 + * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 4779 + * disconnected. 4780 + * 4781 + * Note: This doesn't need any locks and is asynchronous. 4782 + */ 4783 + void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 4784 + gfp_t gfp); 4785 + 4786 + /** 4787 + * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 4788 + * @wiphy: the wiphy to shut down 4789 + * 4790 + * This function shuts down all interfaces belonging to this wiphy by 4791 + * calling dev_close() (and treating non-netdev interfaces as needed). 4792 + * It shouldn't really be used unless there are some fatal device errors 4793 + * that really can't be recovered in any other way. 4794 + * 4795 + * Callers must hold the RTNL and be able to deal with callbacks into 4796 + * the driver while the function is running. 4797 + */ 4798 + void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 4816 4799 4817 4800 /* Logging, debugging and troubleshooting/diagnostic helpers. */ 4818 4801
+70 -8
include/net/mac80211.h
··· 1113 1113 * @addr: address of this interface 1114 1114 * @p2p: indicates whether this AP or STA interface is a p2p 1115 1115 * interface, i.e. a GO or p2p-sta respectively 1116 - * @csa_active: marks whether a channel switch is going on 1116 + * @csa_active: marks whether a channel switch is going on. Internally it is 1117 + * write-protected by sdata_lock and local->mtx so holding either is fine 1118 + * for read access. 1117 1119 * @driver_flags: flags/capabilities the driver has for this interface, 1118 1120 * these need to be set (or cleared) when the interface is added 1119 1121 * or, if supported by the driver, the interface type is changed ··· 1376 1374 * the station moves to associated state. 1377 1375 * @smps_mode: current SMPS mode (off, static or dynamic) 1378 1376 * @rates: rate control selection table 1377 + * @tdls: indicates whether the STA is a TDLS peer 1379 1378 */ 1380 1379 struct ieee80211_sta { 1381 1380 u32 supp_rates[IEEE80211_NUM_BANDS]; ··· 1391 1388 enum ieee80211_sta_rx_bandwidth bandwidth; 1392 1389 enum ieee80211_smps_mode smps_mode; 1393 1390 struct ieee80211_sta_rates __rcu *rates; 1391 + bool tdls; 1394 1392 1395 1393 /* must be last */ 1396 1394 u8 drv_priv[0] __aligned(sizeof(void *)); ··· 2769 2765 * information in bss_conf is set up and the beacon can be retrieved. A 2770 2766 * channel context is bound before this is called. 2771 2767 * @leave_ibss: Leave the IBSS again. 2768 + * 2769 + * @get_expected_throughput: extract the expected throughput towards the 2770 + * specified station. The returned value is expressed in Kbps. It returns 0 2771 + * if the RC algorithm does not have proper data to provide. 2772 2772 */ 2773 2773 struct ieee80211_ops { 2774 2774 void (*tx)(struct ieee80211_hw *hw, ··· 2966 2958 2967 2959 int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 2968 2960 void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 2961 + u32 (*get_expected_throughput)(struct ieee80211_sta *sta); 2969 2962 }; 2970 2963 2971 2964 /** ··· 3416 3407 */ 3417 3408 void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets); 3418 3409 3410 + #define IEEE80211_MAX_CSA_COUNTERS_NUM 2 3411 + 3412 + /** 3413 + * struct ieee80211_mutable_offsets - mutable beacon offsets 3414 + * @tim_offset: position of TIM element 3415 + * @tim_length: size of TIM element 3416 + * @csa_counter_offs: array of IEEE80211_MAX_CSA_COUNTERS_NUM offsets 3417 + * to CSA counters. This array can contain zero values which 3418 + * should be ignored. 3419 + */ 3420 + struct ieee80211_mutable_offsets { 3421 + u16 tim_offset; 3422 + u16 tim_length; 3423 + 3424 + u16 csa_counter_offs[IEEE80211_MAX_CSA_COUNTERS_NUM]; 3425 + }; 3426 + 3427 + /** 3428 + * ieee80211_beacon_get_template - beacon template generation function 3429 + * @hw: pointer obtained from ieee80211_alloc_hw(). 3430 + * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3431 + * @offs: &struct ieee80211_mutable_offsets pointer to struct that will 3432 + * receive the offsets that may be updated by the driver. 3433 + * 3434 + * If the driver implements beaconing modes, it must use this function to 3435 + * obtain the beacon template. 3436 + * 3437 + * This function should be used if the beacon frames are generated by the 3438 + * device, and then the driver must use the returned beacon as the template 3439 + * The driver or the device are responsible to update the DTIM and, when 3440 + * applicable, the CSA count. 3441 + * 3442 + * The driver is responsible for freeing the returned skb. 3443 + * 3444 + * Return: The beacon template. %NULL on error. 3445 + */ 3446 + struct sk_buff * 3447 + ieee80211_beacon_get_template(struct ieee80211_hw *hw, 3448 + struct ieee80211_vif *vif, 3449 + struct ieee80211_mutable_offsets *offs); 3450 + 3419 3451 /** 3420 3452 * ieee80211_beacon_get_tim - beacon generation function 3421 3453 * @hw: pointer obtained from ieee80211_alloc_hw(). ··· 3468 3418 * Set to 0 if invalid (in non-AP modes). 3469 3419 * 3470 3420 * If the driver implements beaconing modes, it must use this function to 3471 - * obtain the beacon frame/template. 3421 + * obtain the beacon frame. 3472 3422 * 3473 3423 * If the beacon frames are generated by the host system (i.e., not in 3474 3424 * hardware/firmware), the driver uses this function to get each beacon 3475 - * frame from mac80211 -- it is responsible for calling this function 3476 - * before the beacon is needed (e.g. based on hardware interrupt). 3477 - * 3478 - * If the beacon frames are generated by the device, then the driver 3479 - * must use the returned beacon as the template and change the TIM IE 3480 - * according to the current DTIM parameters/TIM bitmap. 3425 + * frame from mac80211 -- it is responsible for calling this function exactly 3426 + * once before the beacon is needed (e.g. based on hardware interrupt). 3481 3427 * 3482 3428 * The driver is responsible for freeing the returned skb. 3483 3429 * ··· 3497 3451 { 3498 3452 return ieee80211_beacon_get_tim(hw, vif, NULL, NULL); 3499 3453 } 3454 + 3455 + /** 3456 + * ieee80211_csa_update_counter - request mac80211 to decrement the csa counter 3457 + * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3458 + * 3459 + * The csa counter should be updated after each beacon transmission. 3460 + * This function is called implicitly when 3461 + * ieee80211_beacon_get/ieee80211_beacon_get_tim are called, however if the 3462 + * beacon frames are generated by the device, the driver should call this 3463 + * function after each beacon transmission to sync mac80211's csa counters. 3464 + * 3465 + * Return: new csa counter value 3466 + */ 3467 + u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif); 3500 3468 3501 3469 /** 3502 3470 * ieee80211_csa_finish - notify mac80211 about channel switch ··· 4540 4480 void (*add_sta_debugfs)(void *priv, void *priv_sta, 4541 4481 struct dentry *dir); 4542 4482 void (*remove_sta_debugfs)(void *priv, void *priv_sta); 4483 + 4484 + u32 (*get_expected_throughput)(void *priv_sta); 4543 4485 }; 4544 4486 4545 4487 static inline int rate_supported(struct ieee80211_sta *sta,
+4
include/net/nfc/digital.h
··· 36 36 NFC_DIGITAL_RF_TECH_212F, 37 37 NFC_DIGITAL_RF_TECH_424F, 38 38 NFC_DIGITAL_RF_TECH_ISO15693, 39 + NFC_DIGITAL_RF_TECH_106B, 39 40 40 41 NFC_DIGITAL_RF_TECH_LAST, 41 42 }; ··· 62 61 63 62 NFC_DIGITAL_FRAMING_ISO15693_INVENTORY, 64 63 NFC_DIGITAL_FRAMING_ISO15693_T5T, 64 + 65 + NFC_DIGITAL_FRAMING_NFCB, 66 + NFC_DIGITAL_FRAMING_NFCB_T4T, 65 67 66 68 NFC_DIGITAL_FRAMING_LAST, 67 69 };
+1
include/net/nfc/hci.h
··· 27 27 struct nfc_hci_ops { 28 28 int (*open) (struct nfc_hci_dev *hdev); 29 29 void (*close) (struct nfc_hci_dev *hdev); 30 + int (*load_session) (struct nfc_hci_dev *hdev); 30 31 int (*hci_ready) (struct nfc_hci_dev *hdev); 31 32 /* 32 33 * xmit must always send the complete buffer before
+3
include/net/nfc/nfc.h
··· 264 264 int nfc_remove_se(struct nfc_dev *dev, u32 se_idx); 265 265 struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx); 266 266 267 + void nfc_send_to_raw_sock(struct nfc_dev *dev, struct sk_buff *skb, 268 + u8 payload_type, u8 direction); 269 + 267 270 #endif /* __NET_NFC_H */
+12 -4
include/uapi/linux/nfc.h
··· 273 273 * First byte is the adapter index 274 274 * Second byte contains flags 275 275 * - 0x01 - Direction (0=RX, 1=TX) 276 - * - 0x02-0x80 - Reserved 276 + * - 0x02-0x04 - Payload type (000=LLCP, 001=NCI, 010=HCI, 011=Digital, 277 + * 100=Proprietary) 278 + * - 0x05-0x80 - Reserved 277 279 **/ 278 - #define NFC_LLCP_RAW_HEADER_SIZE 2 279 - #define NFC_LLCP_DIRECTION_RX 0x00 280 - #define NFC_LLCP_DIRECTION_TX 0x01 280 + #define NFC_RAW_HEADER_SIZE 2 281 + #define NFC_DIRECTION_RX 0x00 282 + #define NFC_DIRECTION_TX 0x01 283 + 284 + #define RAW_PAYLOAD_LLCP 0 285 + #define RAW_PAYLOAD_NCI 1 286 + #define RAW_PAYLOAD_HCI 2 287 + #define RAW_PAYLOAD_DIGITAL 3 288 + #define RAW_PAYLOAD_PROPRIETARY 4 281 289 282 290 /* socket option names */ 283 291 #define NFC_LLCP_RW 0
+21 -4
include/uapi/linux/nl80211.h
··· 503 503 * TX status event pertaining to the TX request. 504 504 * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the 505 505 * management frames at CCK rate or not in 2GHz band. 506 + * %NL80211_ATTR_CSA_C_OFFSETS_TX is an array of offsets to CSA 507 + * counters which will be updated to the current value. This attribute 508 + * is used during CSA period. 506 509 * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this 507 510 * command may be used with the corresponding cookie to cancel the wait 508 511 * time if it is known that it is no longer necessary. ··· 1528 1525 * operation). 1529 1526 * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information 1530 1527 * for the time while performing a channel switch. 1531 - * @NL80211_ATTR_CSA_C_OFF_BEACON: Offset of the channel switch counter 1532 - * field in the beacons tail (%NL80211_ATTR_BEACON_TAIL). 1533 - * @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter 1534 - * field in the probe response (%NL80211_ATTR_PROBE_RESP). 1528 + * @NL80211_ATTR_CSA_C_OFF_BEACON: An array of offsets (u16) to the channel 1529 + * switch counters in the beacons tail (%NL80211_ATTR_BEACON_TAIL). 1530 + * @NL80211_ATTR_CSA_C_OFF_PRESP: An array of offsets (u16) to the channel 1531 + * switch counters in the probe response (%NL80211_ATTR_PROBE_RESP). 1535 1532 * 1536 1533 * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32. 1537 1534 * As specified in the &enum nl80211_rxmgmt_flags. ··· 1578 1575 * other concurrent operations may affect this), drivers are allowed to 1579 1576 * advertise values that cannot always be met. In such cases, an attempt 1580 1577 * to add a new station entry with @NL80211_CMD_NEW_STATION may fail. 1578 + * 1579 + * @NL80211_ATTR_CSA_C_OFFSETS_TX: An array of csa counter offsets (u16) which 1580 + * should be updated when the frame is transmitted. 1581 + * @NL80211_ATTR_MAX_CSA_COUNTERS: U8 attribute used to advertise the maximum 1582 + * supported number of csa counters. 1581 1583 * 1582 1584 * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32. 1583 1585 * As specified in the &enum nl80211_tdls_peer_capability. ··· 1928 1920 1929 1921 NL80211_ATTR_IFACE_SOCKET_OWNER, 1930 1922 1923 + NL80211_ATTR_CSA_C_OFFSETS_TX, 1924 + NL80211_ATTR_MAX_CSA_COUNTERS, 1925 + 1931 1926 /* add attributes here, update the policy in nl80211.c */ 1932 1927 1933 1928 __NL80211_ATTR_AFTER_LAST, ··· 2199 2188 * Contains a nested array of signal strength attributes (u8, dBm) 2200 2189 * @NL80211_STA_INFO_CHAIN_SIGNAL_AVG: per-chain signal strength average 2201 2190 * Same format as NL80211_STA_INFO_CHAIN_SIGNAL. 2191 + * @NL80211_STA_EXPECTED_THROUGHPUT: expected throughput considering also the 2192 + * 802.11 header (u32, kbps) 2202 2193 * @__NL80211_STA_INFO_AFTER_LAST: internal 2203 2194 * @NL80211_STA_INFO_MAX: highest possible station info attribute 2204 2195 */ ··· 2232 2219 NL80211_STA_INFO_TX_BYTES64, 2233 2220 NL80211_STA_INFO_CHAIN_SIGNAL, 2234 2221 NL80211_STA_INFO_CHAIN_SIGNAL_AVG, 2222 + NL80211_STA_INFO_EXPECTED_THROUGHPUT, 2235 2223 2236 2224 /* keep last */ 2237 2225 __NL80211_STA_INFO_AFTER_LAST, ··· 3702 3688 * different channels may be used within this group. 3703 3689 * @NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS: u32 attribute containing the bitmap 3704 3690 * of supported channel widths for radar detection. 3691 + * @NL80211_IFACE_COMB_RADAR_DETECT_REGIONS: u32 attribute containing the bitmap 3692 + * of supported regulatory regions for radar detection. 3705 3693 * @NUM_NL80211_IFACE_COMB: number of attributes 3706 3694 * @MAX_NL80211_IFACE_COMB: highest attribute number 3707 3695 * ··· 3737 3721 NL80211_IFACE_COMB_STA_AP_BI_MATCH, 3738 3722 NL80211_IFACE_COMB_NUM_CHANNELS, 3739 3723 NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS, 3724 + NL80211_IFACE_COMB_RADAR_DETECT_REGIONS, 3740 3725 3741 3726 /* keep last */ 3742 3727 NUM_NL80211_IFACE_COMB,
+46 -38
lib/crc7.c
··· 10 10 #include <linux/crc7.h> 11 11 12 12 13 - /* Table for CRC-7 (polynomial x^7 + x^3 + 1) */ 14 - const u8 crc7_syndrome_table[256] = { 15 - 0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f, 16 - 0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77, 17 - 0x19, 0x10, 0x0b, 0x02, 0x3d, 0x34, 0x2f, 0x26, 18 - 0x51, 0x58, 0x43, 0x4a, 0x75, 0x7c, 0x67, 0x6e, 19 - 0x32, 0x3b, 0x20, 0x29, 0x16, 0x1f, 0x04, 0x0d, 20 - 0x7a, 0x73, 0x68, 0x61, 0x5e, 0x57, 0x4c, 0x45, 21 - 0x2b, 0x22, 0x39, 0x30, 0x0f, 0x06, 0x1d, 0x14, 22 - 0x63, 0x6a, 0x71, 0x78, 0x47, 0x4e, 0x55, 0x5c, 23 - 0x64, 0x6d, 0x76, 0x7f, 0x40, 0x49, 0x52, 0x5b, 24 - 0x2c, 0x25, 0x3e, 0x37, 0x08, 0x01, 0x1a, 0x13, 25 - 0x7d, 0x74, 0x6f, 0x66, 0x59, 0x50, 0x4b, 0x42, 26 - 0x35, 0x3c, 0x27, 0x2e, 0x11, 0x18, 0x03, 0x0a, 27 - 0x56, 0x5f, 0x44, 0x4d, 0x72, 0x7b, 0x60, 0x69, 28 - 0x1e, 0x17, 0x0c, 0x05, 0x3a, 0x33, 0x28, 0x21, 29 - 0x4f, 0x46, 0x5d, 0x54, 0x6b, 0x62, 0x79, 0x70, 30 - 0x07, 0x0e, 0x15, 0x1c, 0x23, 0x2a, 0x31, 0x38, 31 - 0x41, 0x48, 0x53, 0x5a, 0x65, 0x6c, 0x77, 0x7e, 32 - 0x09, 0x00, 0x1b, 0x12, 0x2d, 0x24, 0x3f, 0x36, 33 - 0x58, 0x51, 0x4a, 0x43, 0x7c, 0x75, 0x6e, 0x67, 34 - 0x10, 0x19, 0x02, 0x0b, 0x34, 0x3d, 0x26, 0x2f, 35 - 0x73, 0x7a, 0x61, 0x68, 0x57, 0x5e, 0x45, 0x4c, 36 - 0x3b, 0x32, 0x29, 0x20, 0x1f, 0x16, 0x0d, 0x04, 37 - 0x6a, 0x63, 0x78, 0x71, 0x4e, 0x47, 0x5c, 0x55, 38 - 0x22, 0x2b, 0x30, 0x39, 0x06, 0x0f, 0x14, 0x1d, 39 - 0x25, 0x2c, 0x37, 0x3e, 0x01, 0x08, 0x13, 0x1a, 40 - 0x6d, 0x64, 0x7f, 0x76, 0x49, 0x40, 0x5b, 0x52, 41 - 0x3c, 0x35, 0x2e, 0x27, 0x18, 0x11, 0x0a, 0x03, 42 - 0x74, 0x7d, 0x66, 0x6f, 0x50, 0x59, 0x42, 0x4b, 43 - 0x17, 0x1e, 0x05, 0x0c, 0x33, 0x3a, 0x21, 0x28, 44 - 0x5f, 0x56, 0x4d, 0x44, 0x7b, 0x72, 0x69, 0x60, 45 - 0x0e, 0x07, 0x1c, 0x15, 0x2a, 0x23, 0x38, 0x31, 46 - 0x46, 0x4f, 0x54, 0x5d, 0x62, 0x6b, 0x70, 0x79 13 + /* 14 + * Table for CRC-7 (polynomial x^7 + x^3 + 1). 15 + * This is a big-endian CRC (msbit is highest power of x), 16 + * aligned so the msbit of the byte is the x^6 coefficient 17 + * and the lsbit is not used. 18 + */ 19 + const u8 crc7_be_syndrome_table[256] = { 20 + 0x00, 0x12, 0x24, 0x36, 0x48, 0x5a, 0x6c, 0x7e, 21 + 0x90, 0x82, 0xb4, 0xa6, 0xd8, 0xca, 0xfc, 0xee, 22 + 0x32, 0x20, 0x16, 0x04, 0x7a, 0x68, 0x5e, 0x4c, 23 + 0xa2, 0xb0, 0x86, 0x94, 0xea, 0xf8, 0xce, 0xdc, 24 + 0x64, 0x76, 0x40, 0x52, 0x2c, 0x3e, 0x08, 0x1a, 25 + 0xf4, 0xe6, 0xd0, 0xc2, 0xbc, 0xae, 0x98, 0x8a, 26 + 0x56, 0x44, 0x72, 0x60, 0x1e, 0x0c, 0x3a, 0x28, 27 + 0xc6, 0xd4, 0xe2, 0xf0, 0x8e, 0x9c, 0xaa, 0xb8, 28 + 0xc8, 0xda, 0xec, 0xfe, 0x80, 0x92, 0xa4, 0xb6, 29 + 0x58, 0x4a, 0x7c, 0x6e, 0x10, 0x02, 0x34, 0x26, 30 + 0xfa, 0xe8, 0xde, 0xcc, 0xb2, 0xa0, 0x96, 0x84, 31 + 0x6a, 0x78, 0x4e, 0x5c, 0x22, 0x30, 0x06, 0x14, 32 + 0xac, 0xbe, 0x88, 0x9a, 0xe4, 0xf6, 0xc0, 0xd2, 33 + 0x3c, 0x2e, 0x18, 0x0a, 0x74, 0x66, 0x50, 0x42, 34 + 0x9e, 0x8c, 0xba, 0xa8, 0xd6, 0xc4, 0xf2, 0xe0, 35 + 0x0e, 0x1c, 0x2a, 0x38, 0x46, 0x54, 0x62, 0x70, 36 + 0x82, 0x90, 0xa6, 0xb4, 0xca, 0xd8, 0xee, 0xfc, 37 + 0x12, 0x00, 0x36, 0x24, 0x5a, 0x48, 0x7e, 0x6c, 38 + 0xb0, 0xa2, 0x94, 0x86, 0xf8, 0xea, 0xdc, 0xce, 39 + 0x20, 0x32, 0x04, 0x16, 0x68, 0x7a, 0x4c, 0x5e, 40 + 0xe6, 0xf4, 0xc2, 0xd0, 0xae, 0xbc, 0x8a, 0x98, 41 + 0x76, 0x64, 0x52, 0x40, 0x3e, 0x2c, 0x1a, 0x08, 42 + 0xd4, 0xc6, 0xf0, 0xe2, 0x9c, 0x8e, 0xb8, 0xaa, 43 + 0x44, 0x56, 0x60, 0x72, 0x0c, 0x1e, 0x28, 0x3a, 44 + 0x4a, 0x58, 0x6e, 0x7c, 0x02, 0x10, 0x26, 0x34, 45 + 0xda, 0xc8, 0xfe, 0xec, 0x92, 0x80, 0xb6, 0xa4, 46 + 0x78, 0x6a, 0x5c, 0x4e, 0x30, 0x22, 0x14, 0x06, 47 + 0xe8, 0xfa, 0xcc, 0xde, 0xa0, 0xb2, 0x84, 0x96, 48 + 0x2e, 0x3c, 0x0a, 0x18, 0x66, 0x74, 0x42, 0x50, 49 + 0xbe, 0xac, 0x9a, 0x88, 0xf6, 0xe4, 0xd2, 0xc0, 50 + 0x1c, 0x0e, 0x38, 0x2a, 0x54, 0x46, 0x70, 0x62, 51 + 0x8c, 0x9e, 0xa8, 0xba, 0xc4, 0xd6, 0xe0, 0xf2 47 52 }; 48 - EXPORT_SYMBOL(crc7_syndrome_table); 53 + EXPORT_SYMBOL(crc7_be_syndrome_table); 49 54 50 55 /** 51 56 * crc7 - update the CRC7 for the data buffer ··· 60 55 * Context: any 61 56 * 62 57 * Returns the updated CRC7 value. 58 + * The CRC7 is left-aligned in the byte (the lsbit is always 0), as that 59 + * makes the computation easier, and all callers want it in that form. 60 + * 63 61 */ 64 - u8 crc7(u8 crc, const u8 *buffer, size_t len) 62 + u8 crc7_be(u8 crc, const u8 *buffer, size_t len) 65 63 { 66 64 while (len--) 67 - crc = crc7_byte(crc, *buffer++); 65 + crc = crc7_be_byte(crc, *buffer++); 68 66 return crc; 69 67 } 70 - EXPORT_SYMBOL(crc7); 68 + EXPORT_SYMBOL(crc7_be); 71 69 72 70 MODULE_DESCRIPTION("CRC7 calculations"); 73 71 MODULE_LICENSE("GPL");
+2 -2
net/bluetooth/l2cap_core.c
··· 7519 7519 l2cap_debugfs = debugfs_create_file("l2cap", 0444, bt_debugfs, 7520 7520 NULL, &l2cap_debugfs_fops); 7521 7521 7522 - debugfs_create_u16("l2cap_le_max_credits", 0466, bt_debugfs, 7522 + debugfs_create_u16("l2cap_le_max_credits", 0644, bt_debugfs, 7523 7523 &le_max_credits); 7524 - debugfs_create_u16("l2cap_le_default_mps", 0466, bt_debugfs, 7524 + debugfs_create_u16("l2cap_le_default_mps", 0644, bt_debugfs, 7525 7525 &le_default_mps); 7526 7526 7527 7527 bt_6lowpan_init();
+2 -1
net/mac80211/Makefile
··· 25 25 wme.o \ 26 26 event.o \ 27 27 chan.o \ 28 - trace.o mlme.o 28 + trace.o mlme.o \ 29 + tdls.o 29 30 30 31 mac80211-$(CONFIG_MAC80211_LEDS) += led.o 31 32 mac80211-$(CONFIG_MAC80211_DEBUGFS) += \
+174 -366
net/mac80211/cfg.c
··· 472 472 { 473 473 struct ieee80211_sub_if_data *sdata = sta->sdata; 474 474 struct ieee80211_local *local = sdata->local; 475 + struct rate_control_ref *ref = local->rate_ctrl; 475 476 struct timespec uptime; 476 477 u64 packets = 0; 478 + u32 thr = 0; 477 479 int i, ac; 478 480 479 481 sinfo->generation = sdata->local->sta_generation; ··· 589 587 sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED); 590 588 if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) 591 589 sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER); 590 + 591 + /* check if the driver has a SW RC implementation */ 592 + if (ref && ref->ops->get_expected_throughput) 593 + thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv); 594 + else 595 + thr = drv_get_expected_throughput(local, &sta->sta); 596 + 597 + if (thr != 0) { 598 + sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT; 599 + sinfo->expected_throughput = thr; 600 + } 592 601 } 593 602 594 603 static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = { ··· 790 777 } 791 778 792 779 static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, 793 - int idx, u8 *mac, struct station_info *sinfo) 780 + int idx, u8 *mac, struct station_info *sinfo) 794 781 { 795 782 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 796 783 struct ieee80211_local *local = sdata->local; ··· 820 807 } 821 808 822 809 static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev, 823 - u8 *mac, struct station_info *sinfo) 810 + const u8 *mac, struct station_info *sinfo) 824 811 { 825 812 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 826 813 struct ieee80211_local *local = sdata->local; ··· 1097 1084 return 0; 1098 1085 } 1099 1086 1087 + bool ieee80211_csa_needs_block_tx(struct ieee80211_local *local) 1088 + { 1089 + struct ieee80211_sub_if_data *sdata; 1090 + 1091 + lockdep_assert_held(&local->mtx); 1092 + 1093 + rcu_read_lock(); 1094 + list_for_each_entry_rcu(sdata, &local->interfaces, list) { 1095 + if (!ieee80211_sdata_running(sdata)) 1096 + continue; 1097 + 1098 + if (!sdata->vif.csa_active) 1099 + continue; 1100 + 1101 + if (!sdata->csa_block_tx) 1102 + continue; 1103 + 1104 + rcu_read_unlock(); 1105 + return true; 1106 + } 1107 + rcu_read_unlock(); 1108 + 1109 + return false; 1110 + } 1111 + 1100 1112 static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) 1101 1113 { 1102 1114 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); ··· 1139 1101 old_probe_resp = sdata_dereference(sdata->u.ap.probe_resp, sdata); 1140 1102 1141 1103 /* abort any running channel switch */ 1104 + mutex_lock(&local->mtx); 1142 1105 sdata->vif.csa_active = false; 1106 + if (!ieee80211_csa_needs_block_tx(local)) 1107 + ieee80211_wake_queues_by_reason(&local->hw, 1108 + IEEE80211_MAX_QUEUE_MAP, 1109 + IEEE80211_QUEUE_STOP_REASON_CSA); 1110 + mutex_unlock(&local->mtx); 1111 + 1143 1112 kfree(sdata->u.ap.next_beacon); 1144 1113 sdata->u.ap.next_beacon = NULL; 1145 1114 ··· 1470 1425 } 1471 1426 1472 1427 static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, 1473 - u8 *mac, struct station_parameters *params) 1428 + const u8 *mac, 1429 + struct station_parameters *params) 1474 1430 { 1475 1431 struct ieee80211_local *local = wiphy_priv(wiphy); 1476 1432 struct sta_info *sta; ··· 1505 1459 if (!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))) { 1506 1460 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); 1507 1461 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); 1462 + } else { 1463 + sta->sta.tdls = true; 1508 1464 } 1509 1465 1510 1466 err = sta_apply_parameters(local, sta, params); ··· 1540 1492 } 1541 1493 1542 1494 static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, 1543 - u8 *mac) 1495 + const u8 *mac) 1544 1496 { 1545 1497 struct ieee80211_sub_if_data *sdata; 1546 1498 ··· 1554 1506 } 1555 1507 1556 1508 static int ieee80211_change_station(struct wiphy *wiphy, 1557 - struct net_device *dev, u8 *mac, 1509 + struct net_device *dev, const u8 *mac, 1558 1510 struct station_parameters *params) 1559 1511 { 1560 1512 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); ··· 1679 1631 1680 1632 #ifdef CONFIG_MAC80211_MESH 1681 1633 static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, 1682 - u8 *dst, u8 *next_hop) 1634 + const u8 *dst, const u8 *next_hop) 1683 1635 { 1684 1636 struct ieee80211_sub_if_data *sdata; 1685 1637 struct mesh_path *mpath; ··· 1707 1659 } 1708 1660 1709 1661 static int ieee80211_del_mpath(struct wiphy *wiphy, struct net_device *dev, 1710 - u8 *dst) 1662 + const u8 *dst) 1711 1663 { 1712 1664 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1713 1665 ··· 1718 1670 return 0; 1719 1671 } 1720 1672 1721 - static int ieee80211_change_mpath(struct wiphy *wiphy, 1722 - struct net_device *dev, 1723 - u8 *dst, u8 *next_hop) 1673 + static int ieee80211_change_mpath(struct wiphy *wiphy, struct net_device *dev, 1674 + const u8 *dst, const u8 *next_hop) 1724 1675 { 1725 1676 struct ieee80211_sub_if_data *sdata; 1726 1677 struct mesh_path *mpath; ··· 1811 1764 } 1812 1765 1813 1766 static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev, 1814 - int idx, u8 *dst, u8 *next_hop, 1815 - struct mpath_info *pinfo) 1767 + int idx, u8 *dst, u8 *next_hop, 1768 + struct mpath_info *pinfo) 1816 1769 { 1817 1770 struct ieee80211_sub_if_data *sdata; 1818 1771 struct mesh_path *mpath; ··· 3066 3019 } 3067 3020 EXPORT_SYMBOL(ieee80211_csa_finish); 3068 3021 3069 - static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) 3022 + static int ieee80211_set_after_csa_beacon(struct ieee80211_sub_if_data *sdata, 3023 + u32 *changed) 3070 3024 { 3071 - struct ieee80211_local *local = sdata->local; 3072 - int err, changed = 0; 3025 + int err; 3073 3026 3074 - sdata_assert_lock(sdata); 3075 - 3076 - mutex_lock(&local->mtx); 3077 - sdata->radar_required = sdata->csa_radar_required; 3078 - err = ieee80211_vif_change_channel(sdata, &changed); 3079 - mutex_unlock(&local->mtx); 3080 - if (WARN_ON(err < 0)) 3081 - return; 3082 - 3083 - if (!local->use_chanctx) { 3084 - local->_oper_chandef = sdata->csa_chandef; 3085 - ieee80211_hw_config(local, 0); 3086 - } 3087 - 3088 - sdata->vif.csa_active = false; 3089 3027 switch (sdata->vif.type) { 3090 3028 case NL80211_IFTYPE_AP: 3091 3029 err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon); ··· 3078 3046 sdata->u.ap.next_beacon = NULL; 3079 3047 3080 3048 if (err < 0) 3081 - return; 3082 - changed |= err; 3049 + return err; 3050 + *changed |= err; 3083 3051 break; 3084 3052 case NL80211_IFTYPE_ADHOC: 3085 3053 err = ieee80211_ibss_finish_csa(sdata); 3086 3054 if (err < 0) 3087 - return; 3088 - changed |= err; 3055 + return err; 3056 + *changed |= err; 3089 3057 break; 3090 3058 #ifdef CONFIG_MAC80211_MESH 3091 3059 case NL80211_IFTYPE_MESH_POINT: 3092 3060 err = ieee80211_mesh_finish_csa(sdata); 3093 3061 if (err < 0) 3094 - return; 3095 - changed |= err; 3062 + return err; 3063 + *changed |= err; 3096 3064 break; 3097 3065 #endif 3098 3066 default: 3099 3067 WARN_ON(1); 3100 - return; 3068 + return -EINVAL; 3101 3069 } 3102 3070 3103 - ieee80211_bss_info_change_notify(sdata, changed); 3071 + return 0; 3072 + } 3104 3073 3105 - ieee80211_wake_queues_by_reason(&sdata->local->hw, 3074 + static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) 3075 + { 3076 + struct ieee80211_local *local = sdata->local; 3077 + u32 changed = 0; 3078 + int err; 3079 + 3080 + sdata_assert_lock(sdata); 3081 + lockdep_assert_held(&local->mtx); 3082 + 3083 + sdata->radar_required = sdata->csa_radar_required; 3084 + err = ieee80211_vif_change_channel(sdata, &changed); 3085 + if (err < 0) 3086 + return err; 3087 + 3088 + if (!local->use_chanctx) { 3089 + local->_oper_chandef = sdata->csa_chandef; 3090 + ieee80211_hw_config(local, 0); 3091 + } 3092 + 3093 + sdata->vif.csa_active = false; 3094 + 3095 + err = ieee80211_set_after_csa_beacon(sdata, &changed); 3096 + if (err) 3097 + return err; 3098 + 3099 + ieee80211_bss_info_change_notify(sdata, changed); 3100 + cfg80211_ch_switch_notify(sdata->dev, &sdata->csa_chandef); 3101 + 3102 + if (!ieee80211_csa_needs_block_tx(local)) 3103 + ieee80211_wake_queues_by_reason(&local->hw, 3106 3104 IEEE80211_MAX_QUEUE_MAP, 3107 3105 IEEE80211_QUEUE_STOP_REASON_CSA); 3108 3106 3109 - cfg80211_ch_switch_notify(sdata->dev, &sdata->csa_chandef); 3107 + return 0; 3108 + } 3109 + 3110 + static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) 3111 + { 3112 + if (__ieee80211_csa_finalize(sdata)) { 3113 + sdata_info(sdata, "failed to finalize CSA, disconnecting\n"); 3114 + cfg80211_stop_iface(sdata->local->hw.wiphy, &sdata->wdev, 3115 + GFP_KERNEL); 3116 + } 3110 3117 } 3111 3118 3112 3119 void ieee80211_csa_finalize_work(struct work_struct *work) ··· 3153 3082 struct ieee80211_sub_if_data *sdata = 3154 3083 container_of(work, struct ieee80211_sub_if_data, 3155 3084 csa_finalize_work); 3085 + struct ieee80211_local *local = sdata->local; 3156 3086 3157 3087 sdata_lock(sdata); 3088 + mutex_lock(&local->mtx); 3089 + 3158 3090 /* AP might have been stopped while waiting for the lock. */ 3159 3091 if (!sdata->vif.csa_active) 3160 3092 goto unlock; ··· 3168 3094 ieee80211_csa_finalize(sdata); 3169 3095 3170 3096 unlock: 3097 + mutex_unlock(&local->mtx); 3171 3098 sdata_unlock(sdata); 3172 3099 } 3173 3100 ··· 3204 3129 if (params->count <= 1) 3205 3130 break; 3206 3131 3207 - sdata->csa_counter_offset_beacon = 3208 - params->counter_offset_beacon; 3209 - sdata->csa_counter_offset_presp = params->counter_offset_presp; 3132 + if ((params->n_counter_offsets_beacon > 3133 + IEEE80211_MAX_CSA_COUNTERS_NUM) || 3134 + (params->n_counter_offsets_presp > 3135 + IEEE80211_MAX_CSA_COUNTERS_NUM)) 3136 + return -EINVAL; 3137 + 3138 + /* make sure we don't have garbage in other counters */ 3139 + memset(sdata->csa_counter_offset_beacon, 0, 3140 + sizeof(sdata->csa_counter_offset_beacon)); 3141 + memset(sdata->csa_counter_offset_presp, 0, 3142 + sizeof(sdata->csa_counter_offset_presp)); 3143 + 3144 + memcpy(sdata->csa_counter_offset_beacon, 3145 + params->counter_offsets_beacon, 3146 + params->n_counter_offsets_beacon * sizeof(u16)); 3147 + memcpy(sdata->csa_counter_offset_presp, 3148 + params->counter_offsets_presp, 3149 + params->n_counter_offsets_presp * sizeof(u16)); 3150 + 3210 3151 err = ieee80211_assign_beacon(sdata, &params->beacon_csa); 3211 3152 if (err < 0) { 3212 3153 kfree(sdata->u.ap.next_beacon); ··· 3311 3220 return 0; 3312 3221 } 3313 3222 3314 - int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, 3315 - struct cfg80211_csa_settings *params) 3223 + static int 3224 + __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, 3225 + struct cfg80211_csa_settings *params) 3316 3226 { 3317 3227 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 3318 3228 struct ieee80211_local *local = sdata->local; ··· 3322 3230 int err, num_chanctx, changed = 0; 3323 3231 3324 3232 sdata_assert_lock(sdata); 3233 + lockdep_assert_held(&local->mtx); 3325 3234 3326 3235 if (!list_empty(&local->roc_list) || local->scanning) 3327 3236 return -EBUSY; ··· 3365 3272 return err; 3366 3273 3367 3274 sdata->csa_radar_required = params->radar_required; 3368 - 3369 - if (params->block_tx) 3370 - ieee80211_stop_queues_by_reason(&local->hw, 3371 - IEEE80211_MAX_QUEUE_MAP, 3372 - IEEE80211_QUEUE_STOP_REASON_CSA); 3373 - 3374 3275 sdata->csa_chandef = params->chandef; 3276 + sdata->csa_block_tx = params->block_tx; 3277 + sdata->csa_current_counter = params->count; 3375 3278 sdata->vif.csa_active = true; 3279 + 3280 + if (sdata->csa_block_tx) 3281 + ieee80211_stop_queues_by_reason(&local->hw, 3282 + IEEE80211_MAX_QUEUE_MAP, 3283 + IEEE80211_QUEUE_STOP_REASON_CSA); 3376 3284 3377 3285 if (changed) { 3378 3286 ieee80211_bss_info_change_notify(sdata, changed); ··· 3384 3290 } 3385 3291 3386 3292 return 0; 3293 + } 3294 + 3295 + int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, 3296 + struct cfg80211_csa_settings *params) 3297 + { 3298 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 3299 + struct ieee80211_local *local = sdata->local; 3300 + int err; 3301 + 3302 + mutex_lock(&local->mtx); 3303 + err = __ieee80211_channel_switch(wiphy, dev, params); 3304 + mutex_unlock(&local->mtx); 3305 + 3306 + return err; 3387 3307 } 3388 3308 3389 3309 static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, ··· 3412 3304 bool need_offchan = false; 3413 3305 u32 flags; 3414 3306 int ret; 3307 + u8 *data; 3415 3308 3416 3309 if (params->dont_wait_for_ack) 3417 3310 flags = IEEE80211_TX_CTL_NO_ACK; ··· 3506 3397 } 3507 3398 skb_reserve(skb, local->hw.extra_tx_headroom); 3508 3399 3509 - memcpy(skb_put(skb, params->len), params->buf, params->len); 3400 + data = skb_put(skb, params->len); 3401 + memcpy(data, params->buf, params->len); 3402 + 3403 + /* Update CSA counters */ 3404 + if (sdata->vif.csa_active && 3405 + (sdata->vif.type == NL80211_IFTYPE_AP || 3406 + sdata->vif.type == NL80211_IFTYPE_ADHOC) && 3407 + params->n_csa_offsets) { 3408 + int i; 3409 + u8 c = sdata->csa_current_counter; 3410 + 3411 + for (i = 0; i < params->n_csa_offsets; i++) 3412 + data[params->csa_offsets[i]] = c; 3413 + } 3510 3414 3511 3415 IEEE80211_SKB_CB(skb)->flags = flags; 3512 3416 ··· 3624 3502 return -EOPNOTSUPP; 3625 3503 3626 3504 drv_set_rekey_data(local, sdata, data); 3627 - 3628 - return 0; 3629 - } 3630 - 3631 - static void ieee80211_tdls_add_ext_capab(struct sk_buff *skb) 3632 - { 3633 - u8 *pos = (void *)skb_put(skb, 7); 3634 - 3635 - *pos++ = WLAN_EID_EXT_CAPABILITY; 3636 - *pos++ = 5; /* len */ 3637 - *pos++ = 0x0; 3638 - *pos++ = 0x0; 3639 - *pos++ = 0x0; 3640 - *pos++ = 0x0; 3641 - *pos++ = WLAN_EXT_CAPA5_TDLS_ENABLED; 3642 - } 3643 - 3644 - static u16 ieee80211_get_tdls_sta_capab(struct ieee80211_sub_if_data *sdata) 3645 - { 3646 - struct ieee80211_local *local = sdata->local; 3647 - u16 capab; 3648 - 3649 - capab = 0; 3650 - if (ieee80211_get_sdata_band(sdata) != IEEE80211_BAND_2GHZ) 3651 - return capab; 3652 - 3653 - if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE)) 3654 - capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME; 3655 - if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE)) 3656 - capab |= WLAN_CAPABILITY_SHORT_PREAMBLE; 3657 - 3658 - return capab; 3659 - } 3660 - 3661 - static void ieee80211_tdls_add_link_ie(struct sk_buff *skb, u8 *src_addr, 3662 - u8 *peer, u8 *bssid) 3663 - { 3664 - struct ieee80211_tdls_lnkie *lnkid; 3665 - 3666 - lnkid = (void *)skb_put(skb, sizeof(struct ieee80211_tdls_lnkie)); 3667 - 3668 - lnkid->ie_type = WLAN_EID_LINK_ID; 3669 - lnkid->ie_len = sizeof(struct ieee80211_tdls_lnkie) - 2; 3670 - 3671 - memcpy(lnkid->bssid, bssid, ETH_ALEN); 3672 - memcpy(lnkid->init_sta, src_addr, ETH_ALEN); 3673 - memcpy(lnkid->resp_sta, peer, ETH_ALEN); 3674 - } 3675 - 3676 - static int 3677 - ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev, 3678 - u8 *peer, u8 action_code, u8 dialog_token, 3679 - u16 status_code, struct sk_buff *skb) 3680 - { 3681 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 3682 - enum ieee80211_band band = ieee80211_get_sdata_band(sdata); 3683 - struct ieee80211_tdls_data *tf; 3684 - 3685 - tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); 3686 - 3687 - memcpy(tf->da, peer, ETH_ALEN); 3688 - memcpy(tf->sa, sdata->vif.addr, ETH_ALEN); 3689 - tf->ether_type = cpu_to_be16(ETH_P_TDLS); 3690 - tf->payload_type = WLAN_TDLS_SNAP_RFTYPE; 3691 - 3692 - switch (action_code) { 3693 - case WLAN_TDLS_SETUP_REQUEST: 3694 - tf->category = WLAN_CATEGORY_TDLS; 3695 - tf->action_code = WLAN_TDLS_SETUP_REQUEST; 3696 - 3697 - skb_put(skb, sizeof(tf->u.setup_req)); 3698 - tf->u.setup_req.dialog_token = dialog_token; 3699 - tf->u.setup_req.capability = 3700 - cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 3701 - 3702 - ieee80211_add_srates_ie(sdata, skb, false, band); 3703 - ieee80211_add_ext_srates_ie(sdata, skb, false, band); 3704 - ieee80211_tdls_add_ext_capab(skb); 3705 - break; 3706 - case WLAN_TDLS_SETUP_RESPONSE: 3707 - tf->category = WLAN_CATEGORY_TDLS; 3708 - tf->action_code = WLAN_TDLS_SETUP_RESPONSE; 3709 - 3710 - skb_put(skb, sizeof(tf->u.setup_resp)); 3711 - tf->u.setup_resp.status_code = cpu_to_le16(status_code); 3712 - tf->u.setup_resp.dialog_token = dialog_token; 3713 - tf->u.setup_resp.capability = 3714 - cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 3715 - 3716 - ieee80211_add_srates_ie(sdata, skb, false, band); 3717 - ieee80211_add_ext_srates_ie(sdata, skb, false, band); 3718 - ieee80211_tdls_add_ext_capab(skb); 3719 - break; 3720 - case WLAN_TDLS_SETUP_CONFIRM: 3721 - tf->category = WLAN_CATEGORY_TDLS; 3722 - tf->action_code = WLAN_TDLS_SETUP_CONFIRM; 3723 - 3724 - skb_put(skb, sizeof(tf->u.setup_cfm)); 3725 - tf->u.setup_cfm.status_code = cpu_to_le16(status_code); 3726 - tf->u.setup_cfm.dialog_token = dialog_token; 3727 - break; 3728 - case WLAN_TDLS_TEARDOWN: 3729 - tf->category = WLAN_CATEGORY_TDLS; 3730 - tf->action_code = WLAN_TDLS_TEARDOWN; 3731 - 3732 - skb_put(skb, sizeof(tf->u.teardown)); 3733 - tf->u.teardown.reason_code = cpu_to_le16(status_code); 3734 - break; 3735 - case WLAN_TDLS_DISCOVERY_REQUEST: 3736 - tf->category = WLAN_CATEGORY_TDLS; 3737 - tf->action_code = WLAN_TDLS_DISCOVERY_REQUEST; 3738 - 3739 - skb_put(skb, sizeof(tf->u.discover_req)); 3740 - tf->u.discover_req.dialog_token = dialog_token; 3741 - break; 3742 - default: 3743 - return -EINVAL; 3744 - } 3745 - 3746 - return 0; 3747 - } 3748 - 3749 - static int 3750 - ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev, 3751 - u8 *peer, u8 action_code, u8 dialog_token, 3752 - u16 status_code, struct sk_buff *skb) 3753 - { 3754 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 3755 - enum ieee80211_band band = ieee80211_get_sdata_band(sdata); 3756 - struct ieee80211_mgmt *mgmt; 3757 - 3758 - mgmt = (void *)skb_put(skb, 24); 3759 - memset(mgmt, 0, 24); 3760 - memcpy(mgmt->da, peer, ETH_ALEN); 3761 - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); 3762 - memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); 3763 - 3764 - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | 3765 - IEEE80211_STYPE_ACTION); 3766 - 3767 - switch (action_code) { 3768 - case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: 3769 - skb_put(skb, 1 + sizeof(mgmt->u.action.u.tdls_discover_resp)); 3770 - mgmt->u.action.category = WLAN_CATEGORY_PUBLIC; 3771 - mgmt->u.action.u.tdls_discover_resp.action_code = 3772 - WLAN_PUB_ACTION_TDLS_DISCOVER_RES; 3773 - mgmt->u.action.u.tdls_discover_resp.dialog_token = 3774 - dialog_token; 3775 - mgmt->u.action.u.tdls_discover_resp.capability = 3776 - cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 3777 - 3778 - ieee80211_add_srates_ie(sdata, skb, false, band); 3779 - ieee80211_add_ext_srates_ie(sdata, skb, false, band); 3780 - ieee80211_tdls_add_ext_capab(skb); 3781 - break; 3782 - default: 3783 - return -EINVAL; 3784 - } 3785 - 3786 - return 0; 3787 - } 3788 - 3789 - static int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, 3790 - u8 *peer, u8 action_code, u8 dialog_token, 3791 - u16 status_code, u32 peer_capability, 3792 - const u8 *extra_ies, size_t extra_ies_len) 3793 - { 3794 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 3795 - struct ieee80211_local *local = sdata->local; 3796 - struct sk_buff *skb = NULL; 3797 - bool send_direct; 3798 - int ret; 3799 - 3800 - if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)) 3801 - return -ENOTSUPP; 3802 - 3803 - /* make sure we are in managed mode, and associated */ 3804 - if (sdata->vif.type != NL80211_IFTYPE_STATION || 3805 - !sdata->u.mgd.associated) 3806 - return -EINVAL; 3807 - 3808 - tdls_dbg(sdata, "TDLS mgmt action %d peer %pM\n", 3809 - action_code, peer); 3810 - 3811 - skb = dev_alloc_skb(local->hw.extra_tx_headroom + 3812 - max(sizeof(struct ieee80211_mgmt), 3813 - sizeof(struct ieee80211_tdls_data)) + 3814 - 50 + /* supported rates */ 3815 - 7 + /* ext capab */ 3816 - extra_ies_len + 3817 - sizeof(struct ieee80211_tdls_lnkie)); 3818 - if (!skb) 3819 - return -ENOMEM; 3820 - 3821 - skb_reserve(skb, local->hw.extra_tx_headroom); 3822 - 3823 - switch (action_code) { 3824 - case WLAN_TDLS_SETUP_REQUEST: 3825 - case WLAN_TDLS_SETUP_RESPONSE: 3826 - case WLAN_TDLS_SETUP_CONFIRM: 3827 - case WLAN_TDLS_TEARDOWN: 3828 - case WLAN_TDLS_DISCOVERY_REQUEST: 3829 - ret = ieee80211_prep_tdls_encap_data(wiphy, dev, peer, 3830 - action_code, dialog_token, 3831 - status_code, skb); 3832 - send_direct = false; 3833 - break; 3834 - case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: 3835 - ret = ieee80211_prep_tdls_direct(wiphy, dev, peer, action_code, 3836 - dialog_token, status_code, 3837 - skb); 3838 - send_direct = true; 3839 - break; 3840 - default: 3841 - ret = -ENOTSUPP; 3842 - break; 3843 - } 3844 - 3845 - if (ret < 0) 3846 - goto fail; 3847 - 3848 - if (extra_ies_len) 3849 - memcpy(skb_put(skb, extra_ies_len), extra_ies, extra_ies_len); 3850 - 3851 - /* the TDLS link IE is always added last */ 3852 - switch (action_code) { 3853 - case WLAN_TDLS_SETUP_REQUEST: 3854 - case WLAN_TDLS_SETUP_CONFIRM: 3855 - case WLAN_TDLS_TEARDOWN: 3856 - case WLAN_TDLS_DISCOVERY_REQUEST: 3857 - /* we are the initiator */ 3858 - ieee80211_tdls_add_link_ie(skb, sdata->vif.addr, peer, 3859 - sdata->u.mgd.bssid); 3860 - break; 3861 - case WLAN_TDLS_SETUP_RESPONSE: 3862 - case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: 3863 - /* we are the responder */ 3864 - ieee80211_tdls_add_link_ie(skb, peer, sdata->vif.addr, 3865 - sdata->u.mgd.bssid); 3866 - break; 3867 - default: 3868 - ret = -ENOTSUPP; 3869 - goto fail; 3870 - } 3871 - 3872 - if (send_direct) { 3873 - ieee80211_tx_skb(sdata, skb); 3874 - return 0; 3875 - } 3876 - 3877 - /* 3878 - * According to 802.11z: Setup req/resp are sent in AC_BK, otherwise 3879 - * we should default to AC_VI. 3880 - */ 3881 - switch (action_code) { 3882 - case WLAN_TDLS_SETUP_REQUEST: 3883 - case WLAN_TDLS_SETUP_RESPONSE: 3884 - skb_set_queue_mapping(skb, IEEE80211_AC_BK); 3885 - skb->priority = 2; 3886 - break; 3887 - default: 3888 - skb_set_queue_mapping(skb, IEEE80211_AC_VI); 3889 - skb->priority = 5; 3890 - break; 3891 - } 3892 - 3893 - /* disable bottom halves when entering the Tx path */ 3894 - local_bh_disable(); 3895 - ret = ieee80211_subif_start_xmit(skb, dev); 3896 - local_bh_enable(); 3897 - 3898 - return ret; 3899 - 3900 - fail: 3901 - dev_kfree_skb(skb); 3902 - return ret; 3903 - } 3904 - 3905 - static int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, 3906 - u8 *peer, enum nl80211_tdls_operation oper) 3907 - { 3908 - struct sta_info *sta; 3909 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 3910 - 3911 - if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)) 3912 - return -ENOTSUPP; 3913 - 3914 - if (sdata->vif.type != NL80211_IFTYPE_STATION) 3915 - return -EINVAL; 3916 - 3917 - tdls_dbg(sdata, "TDLS oper %d peer %pM\n", oper, peer); 3918 - 3919 - switch (oper) { 3920 - case NL80211_TDLS_ENABLE_LINK: 3921 - rcu_read_lock(); 3922 - sta = sta_info_get(sdata, peer); 3923 - if (!sta) { 3924 - rcu_read_unlock(); 3925 - return -ENOLINK; 3926 - } 3927 - 3928 - set_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH); 3929 - rcu_read_unlock(); 3930 - break; 3931 - case NL80211_TDLS_DISABLE_LINK: 3932 - return sta_info_destroy_addr(sdata, peer); 3933 - case NL80211_TDLS_TEARDOWN: 3934 - case NL80211_TDLS_SETUP: 3935 - case NL80211_TDLS_DISCOVERY_REQ: 3936 - /* We don't support in-driver setup/teardown/discovery */ 3937 - return -ENOTSUPP; 3938 - default: 3939 - return -ENOTSUPP; 3940 - } 3941 3505 3942 3506 return 0; 3943 3507 }
+2 -2
net/mac80211/chan.c
··· 855 855 __ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata, 856 856 bool clear) 857 857 { 858 - struct ieee80211_local *local = sdata->local; 858 + struct ieee80211_local *local __maybe_unused = sdata->local; 859 859 struct ieee80211_sub_if_data *vlan; 860 860 struct ieee80211_chanctx_conf *conf; 861 861 ··· 871 871 * to a channel context that has already been freed. 872 872 */ 873 873 conf = rcu_dereference_protected(sdata->vif.chanctx_conf, 874 - lockdep_is_held(&local->chanctx_mtx)); 874 + lockdep_is_held(&local->chanctx_mtx)); 875 875 WARN_ON(!conf); 876 876 877 877 if (clear)
+84 -37
net/mac80211/driver-ops.h
··· 5 5 #include "ieee80211_i.h" 6 6 #include "trace.h" 7 7 8 - static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata) 8 + static inline bool check_sdata_in_driver(struct ieee80211_sub_if_data *sdata) 9 9 { 10 - WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER), 11 - "%s: Failed check-sdata-in-driver check, flags: 0x%x\n", 12 - sdata->dev ? sdata->dev->name : sdata->name, sdata->flags); 10 + return !WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER), 11 + "%s: Failed check-sdata-in-driver check, flags: 0x%x\n", 12 + sdata->dev ? sdata->dev->name : sdata->name, sdata->flags); 13 13 } 14 14 15 15 static inline struct ieee80211_sub_if_data * ··· 168 168 169 169 might_sleep(); 170 170 171 - check_sdata_in_driver(sdata); 171 + if (!check_sdata_in_driver(sdata)) 172 + return -EIO; 172 173 173 174 trace_drv_change_interface(local, sdata, type, p2p); 174 175 ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p); ··· 182 181 { 183 182 might_sleep(); 184 183 185 - check_sdata_in_driver(sdata); 184 + if (!check_sdata_in_driver(sdata)) 185 + return; 186 186 187 187 trace_drv_remove_interface(local, sdata); 188 188 local->ops->remove_interface(&local->hw, &sdata->vif); ··· 221 219 sdata->vif.type == NL80211_IFTYPE_MONITOR)) 222 220 return; 223 221 224 - check_sdata_in_driver(sdata); 222 + if (!check_sdata_in_driver(sdata)) 223 + return; 225 224 226 225 trace_drv_bss_info_changed(local, sdata, info, changed); 227 226 if (local->ops->bss_info_changed) ··· 281 278 might_sleep(); 282 279 283 280 sdata = get_bss_sdata(sdata); 284 - check_sdata_in_driver(sdata); 281 + if (!check_sdata_in_driver(sdata)) 282 + return -EIO; 285 283 286 284 trace_drv_set_key(local, cmd, sdata, sta, key); 287 285 ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); ··· 302 298 ista = &sta->sta; 303 299 304 300 sdata = get_bss_sdata(sdata); 305 - check_sdata_in_driver(sdata); 301 + if (!check_sdata_in_driver(sdata)) 302 + return; 306 303 307 304 trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); 308 305 if (local->ops->update_tkip_key) ··· 320 315 321 316 might_sleep(); 322 317 323 - check_sdata_in_driver(sdata); 318 + if (!check_sdata_in_driver(sdata)) 319 + return -EIO; 324 320 325 321 trace_drv_hw_scan(local, sdata); 326 322 ret = local->ops->hw_scan(&local->hw, &sdata->vif, req); ··· 334 328 { 335 329 might_sleep(); 336 330 337 - check_sdata_in_driver(sdata); 331 + if (!check_sdata_in_driver(sdata)) 332 + return; 338 333 339 334 trace_drv_cancel_hw_scan(local, sdata); 340 335 local->ops->cancel_hw_scan(&local->hw, &sdata->vif); ··· 352 345 353 346 might_sleep(); 354 347 355 - check_sdata_in_driver(sdata); 348 + if (!check_sdata_in_driver(sdata)) 349 + return -EIO; 356 350 357 351 trace_drv_sched_scan_start(local, sdata); 358 352 ret = local->ops->sched_scan_start(&local->hw, &sdata->vif, ··· 369 361 370 362 might_sleep(); 371 363 372 - check_sdata_in_driver(sdata); 364 + if (!check_sdata_in_driver(sdata)) 365 + return -EIO; 373 366 374 367 trace_drv_sched_scan_stop(local, sdata); 375 368 ret = local->ops->sched_scan_stop(&local->hw, &sdata->vif); ··· 471 462 struct ieee80211_sta *sta) 472 463 { 473 464 sdata = get_bss_sdata(sdata); 474 - check_sdata_in_driver(sdata); 465 + if (!check_sdata_in_driver(sdata)) 466 + return; 475 467 476 468 trace_drv_sta_notify(local, sdata, cmd, sta); 477 469 if (local->ops->sta_notify) ··· 489 479 might_sleep(); 490 480 491 481 sdata = get_bss_sdata(sdata); 492 - check_sdata_in_driver(sdata); 482 + if (!check_sdata_in_driver(sdata)) 483 + return -EIO; 493 484 494 485 trace_drv_sta_add(local, sdata, sta); 495 486 if (local->ops->sta_add) ··· 508 497 might_sleep(); 509 498 510 499 sdata = get_bss_sdata(sdata); 511 - check_sdata_in_driver(sdata); 500 + if (!check_sdata_in_driver(sdata)) 501 + return; 512 502 513 503 trace_drv_sta_remove(local, sdata, sta); 514 504 if (local->ops->sta_remove) ··· 527 515 might_sleep(); 528 516 529 517 sdata = get_bss_sdata(sdata); 530 - check_sdata_in_driver(sdata); 518 + if (!check_sdata_in_driver(sdata)) 519 + return; 531 520 532 521 if (local->ops->sta_add_debugfs) 533 522 local->ops->sta_add_debugfs(&local->hw, &sdata->vif, ··· 558 545 might_sleep(); 559 546 560 547 sdata = get_bss_sdata(sdata); 561 - check_sdata_in_driver(sdata); 548 + if (!check_sdata_in_driver(sdata)) 549 + return; 562 550 563 551 trace_drv_sta_pre_rcu_remove(local, sdata, &sta->sta); 564 552 if (local->ops->sta_pre_rcu_remove) ··· 580 566 might_sleep(); 581 567 582 568 sdata = get_bss_sdata(sdata); 583 - check_sdata_in_driver(sdata); 569 + if (!check_sdata_in_driver(sdata)) 570 + return -EIO; 584 571 585 572 trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state); 586 573 if (local->ops->sta_state) { ··· 605 590 struct ieee80211_sta *sta, u32 changed) 606 591 { 607 592 sdata = get_bss_sdata(sdata); 608 - check_sdata_in_driver(sdata); 593 + if (!check_sdata_in_driver(sdata)) 594 + return; 609 595 610 596 WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED && 611 597 (sdata->vif.type != NL80211_IFTYPE_ADHOC && ··· 628 612 629 613 might_sleep(); 630 614 631 - check_sdata_in_driver(sdata); 615 + if (!check_sdata_in_driver(sdata)) 616 + return -EIO; 632 617 633 618 trace_drv_conf_tx(local, sdata, ac, params); 634 619 if (local->ops->conf_tx) ··· 646 629 647 630 might_sleep(); 648 631 649 - check_sdata_in_driver(sdata); 632 + if (!check_sdata_in_driver(sdata)) 633 + return ret; 650 634 651 635 trace_drv_get_tsf(local, sdata); 652 636 if (local->ops->get_tsf) ··· 662 644 { 663 645 might_sleep(); 664 646 665 - check_sdata_in_driver(sdata); 647 + if (!check_sdata_in_driver(sdata)) 648 + return; 666 649 667 650 trace_drv_set_tsf(local, sdata, tsf); 668 651 if (local->ops->set_tsf) ··· 676 657 { 677 658 might_sleep(); 678 659 679 - check_sdata_in_driver(sdata); 660 + if (!check_sdata_in_driver(sdata)) 661 + return; 680 662 681 663 trace_drv_reset_tsf(local, sdata); 682 664 if (local->ops->reset_tsf) ··· 709 689 might_sleep(); 710 690 711 691 sdata = get_bss_sdata(sdata); 712 - check_sdata_in_driver(sdata); 692 + if (!check_sdata_in_driver(sdata)) 693 + return -EIO; 713 694 714 695 trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size); 715 696 ··· 754 733 755 734 might_sleep(); 756 735 757 - if (sdata) 758 - check_sdata_in_driver(sdata); 736 + if (sdata && !check_sdata_in_driver(sdata)) 737 + return; 759 738 760 739 trace_drv_flush(local, queues, drop); 761 740 if (local->ops->flush) ··· 875 854 876 855 might_sleep(); 877 856 878 - check_sdata_in_driver(sdata); 857 + if (!check_sdata_in_driver(sdata)) 858 + return -EIO; 879 859 880 860 trace_drv_set_bitrate_mask(local, sdata, mask); 881 861 if (local->ops->set_bitrate_mask) ··· 891 869 struct ieee80211_sub_if_data *sdata, 892 870 struct cfg80211_gtk_rekey_data *data) 893 871 { 894 - check_sdata_in_driver(sdata); 872 + if (!check_sdata_in_driver(sdata)) 873 + return; 895 874 896 875 trace_drv_set_rekey_data(local, sdata, data); 897 876 if (local->ops->set_rekey_data) ··· 960 937 { 961 938 might_sleep(); 962 939 963 - check_sdata_in_driver(sdata); 940 + if (!check_sdata_in_driver(sdata)) 941 + return; 964 942 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION); 965 943 966 944 trace_drv_mgd_prepare_tx(local, sdata); ··· 988 964 static inline void drv_remove_chanctx(struct ieee80211_local *local, 989 965 struct ieee80211_chanctx *ctx) 990 966 { 967 + if (WARN_ON(!ctx->driver_present)) 968 + return; 969 + 991 970 trace_drv_remove_chanctx(local, ctx); 992 971 if (local->ops->remove_chanctx) 993 972 local->ops->remove_chanctx(&local->hw, &ctx->conf); ··· 1016 989 { 1017 990 int ret = 0; 1018 991 1019 - check_sdata_in_driver(sdata); 992 + if (!check_sdata_in_driver(sdata)) 993 + return -EIO; 1020 994 1021 995 trace_drv_assign_vif_chanctx(local, sdata, ctx); 1022 996 if (local->ops->assign_vif_chanctx) { ··· 1035 1007 struct ieee80211_sub_if_data *sdata, 1036 1008 struct ieee80211_chanctx *ctx) 1037 1009 { 1038 - check_sdata_in_driver(sdata); 1010 + if (!check_sdata_in_driver(sdata)) 1011 + return; 1039 1012 1040 1013 trace_drv_unassign_vif_chanctx(local, sdata, ctx); 1041 1014 if (local->ops->unassign_vif_chanctx) { ··· 1053 1024 { 1054 1025 int ret = 0; 1055 1026 1056 - check_sdata_in_driver(sdata); 1027 + if (!check_sdata_in_driver(sdata)) 1028 + return -EIO; 1057 1029 1058 1030 trace_drv_start_ap(local, sdata, &sdata->vif.bss_conf); 1059 1031 if (local->ops->start_ap) ··· 1066 1036 static inline void drv_stop_ap(struct ieee80211_local *local, 1067 1037 struct ieee80211_sub_if_data *sdata) 1068 1038 { 1069 - check_sdata_in_driver(sdata); 1039 + if (!check_sdata_in_driver(sdata)) 1040 + return; 1070 1041 1071 1042 trace_drv_stop_ap(local, sdata); 1072 1043 if (local->ops->stop_ap) ··· 1090 1059 struct ieee80211_sub_if_data *sdata, 1091 1060 int key_idx) 1092 1061 { 1093 - check_sdata_in_driver(sdata); 1062 + if (!check_sdata_in_driver(sdata)) 1063 + return; 1094 1064 1095 1065 WARN_ON_ONCE(key_idx < -1 || key_idx > 3); 1096 1066 ··· 1133 1101 int ret = 0; 1134 1102 1135 1103 might_sleep(); 1136 - check_sdata_in_driver(sdata); 1104 + if (!check_sdata_in_driver(sdata)) 1105 + return -EIO; 1137 1106 1138 1107 trace_drv_join_ibss(local, sdata, &sdata->vif.bss_conf); 1139 1108 if (local->ops->join_ibss) ··· 1147 1114 struct ieee80211_sub_if_data *sdata) 1148 1115 { 1149 1116 might_sleep(); 1150 - check_sdata_in_driver(sdata); 1117 + if (!check_sdata_in_driver(sdata)) 1118 + return; 1151 1119 1152 1120 trace_drv_leave_ibss(local, sdata); 1153 1121 if (local->ops->leave_ibss) 1154 1122 local->ops->leave_ibss(&local->hw, &sdata->vif); 1155 1123 trace_drv_return_void(local); 1124 + } 1125 + 1126 + static inline u32 drv_get_expected_throughput(struct ieee80211_local *local, 1127 + struct ieee80211_sta *sta) 1128 + { 1129 + u32 ret = 0; 1130 + 1131 + trace_drv_get_expected_throughput(sta); 1132 + if (local->ops->get_expected_throughput) 1133 + ret = local->ops->get_expected_throughput(sta); 1134 + trace_drv_return_u32(local, ret); 1135 + 1136 + return ret; 1156 1137 } 1157 1138 1158 1139 #endif /* __MAC80211_DRIVER_OPS */
+1 -1
net/mac80211/ibss.c
··· 143 143 *pos++ = csa_settings->block_tx ? 1 : 0; 144 144 *pos++ = ieee80211_frequency_to_channel( 145 145 csa_settings->chandef.chan->center_freq); 146 - sdata->csa_counter_offset_beacon = (pos - presp->head); 146 + sdata->csa_counter_offset_beacon[0] = (pos - presp->head); 147 147 *pos++ = csa_settings->count; 148 148 } 149 149
+15 -2
net/mac80211/ieee80211_i.h
··· 754 754 struct mac80211_qos_map __rcu *qos_map; 755 755 756 756 struct work_struct csa_finalize_work; 757 - int csa_counter_offset_beacon; 758 - int csa_counter_offset_presp; 757 + u16 csa_counter_offset_beacon[IEEE80211_MAX_CSA_COUNTERS_NUM]; 758 + u16 csa_counter_offset_presp[IEEE80211_MAX_CSA_COUNTERS_NUM]; 759 759 bool csa_radar_required; 760 + bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */ 760 761 struct cfg80211_chan_def csa_chandef; 761 762 762 763 struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */ ··· 767 766 struct ieee80211_chanctx *reserved_chanctx; 768 767 struct cfg80211_chan_def reserved_chandef; 769 768 bool reserved_radar_required; 769 + u8 csa_current_counter; 770 770 771 771 /* used to reconfigure hardware SM PS */ 772 772 struct work_struct recalc_smps; ··· 1461 1459 int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, 1462 1460 struct cfg80211_sched_scan_request *req); 1463 1461 int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata); 1462 + void ieee80211_sched_scan_end(struct ieee80211_local *local); 1464 1463 void ieee80211_sched_scan_stopped_work(struct work_struct *work); 1465 1464 1466 1465 /* off-channel helpers */ ··· 1476 1473 void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc); 1477 1474 1478 1475 /* channel switch handling */ 1476 + bool ieee80211_csa_needs_block_tx(struct ieee80211_local *local); 1479 1477 void ieee80211_csa_finalize_work(struct work_struct *work); 1480 1478 int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, 1481 1479 struct cfg80211_csa_settings *params); ··· 1837 1833 enum ieee80211_chanctx_mode chanmode, 1838 1834 u8 radar_detect); 1839 1835 int ieee80211_max_num_channels(struct ieee80211_local *local); 1836 + 1837 + /* TDLS */ 1838 + int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, 1839 + const u8 *peer, u8 action_code, u8 dialog_token, 1840 + u16 status_code, u32 peer_capability, 1841 + const u8 *extra_ies, size_t extra_ies_len); 1842 + int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, 1843 + const u8 *peer, enum nl80211_tdls_operation oper); 1844 + 1840 1845 1841 1846 #ifdef CONFIG_MAC80211_NOINLINE 1842 1847 #define debug_noinline noinline
+7
net/mac80211/iface.c
··· 838 838 839 839 cancel_work_sync(&sdata->recalc_smps); 840 840 sdata_lock(sdata); 841 + mutex_lock(&local->mtx); 841 842 sdata->vif.csa_active = false; 843 + if (!ieee80211_csa_needs_block_tx(local)) 844 + ieee80211_wake_queues_by_reason(&local->hw, 845 + IEEE80211_MAX_QUEUE_MAP, 846 + IEEE80211_QUEUE_STOP_REASON_CSA); 847 + mutex_unlock(&local->mtx); 842 848 sdata_unlock(sdata); 849 + 843 850 cancel_work_sync(&sdata->csa_finalize_work); 844 851 845 852 cancel_delayed_work_sync(&sdata->dfs_cac_timer_work);
+4 -3
net/mac80211/key.c
··· 325 325 struct ieee80211_key *key; 326 326 int i, j, err; 327 327 328 - BUG_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS); 328 + if (WARN_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS)) 329 + return ERR_PTR(-EINVAL); 329 330 330 331 key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL); 331 332 if (!key) ··· 482 481 int idx, ret; 483 482 bool pairwise; 484 483 485 - BUG_ON(!sdata); 486 - BUG_ON(!key); 484 + if (WARN_ON(!sdata || !key)) 485 + return -EINVAL; 487 486 488 487 pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; 489 488 idx = key->conf.keyidx;
+2
net/mac80211/main.c
··· 956 956 if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) 957 957 local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP; 958 958 959 + local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CSA_COUNTERS_NUM; 960 + 959 961 result = wiphy_register(local->hw.wiphy); 960 962 if (result < 0) 961 963 goto fail_wiphy_register;
+1 -1
net/mac80211/mesh.c
··· 679 679 *pos++ = 0x0; 680 680 *pos++ = ieee80211_frequency_to_channel( 681 681 csa->settings.chandef.chan->center_freq); 682 - sdata->csa_counter_offset_beacon = hdr_len + 6; 682 + sdata->csa_counter_offset_beacon[0] = hdr_len + 6; 683 683 *pos++ = csa->settings.count; 684 684 *pos++ = WLAN_EID_CHAN_SWITCH_PARAM; 685 685 *pos++ = 6;
+4 -2
net/mac80211/mesh_pathtbl.c
··· 287 287 struct sk_buff_head failq; 288 288 unsigned long flags; 289 289 290 - BUG_ON(gate_mpath == from_mpath); 291 - BUG_ON(!gate_mpath->next_hop); 290 + if (WARN_ON(gate_mpath == from_mpath)) 291 + return; 292 + if (WARN_ON(!gate_mpath->next_hop)) 293 + return; 292 294 293 295 __skb_queue_head_init(&failq); 294 296
+1 -1
net/mac80211/mesh_sync.c
··· 171 171 u8 cap; 172 172 173 173 WARN_ON(ifmsh->mesh_sp_id != IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET); 174 - BUG_ON(!rcu_read_lock_held()); 174 + WARN_ON(!rcu_read_lock_held()); 175 175 cap = beacon->meshconf->meshconf_cap; 176 176 177 177 spin_lock_bh(&ifmsh->sync_offset_lock);
+39 -11
net/mac80211/mlme.c
··· 975 975 /* XXX: shouldn't really modify cfg80211-owned data! */ 976 976 ifmgd->associated->channel = sdata->csa_chandef.chan; 977 977 978 - /* XXX: wait for a beacon first? */ 979 - ieee80211_wake_queues_by_reason(&local->hw, 980 - IEEE80211_MAX_QUEUE_MAP, 981 - IEEE80211_QUEUE_STOP_REASON_CSA); 982 - 983 978 ieee80211_bss_info_change_notify(sdata, changed); 984 979 985 - out: 980 + mutex_lock(&local->mtx); 986 981 sdata->vif.csa_active = false; 982 + /* XXX: wait for a beacon first? */ 983 + if (!ieee80211_csa_needs_block_tx(local)) 984 + ieee80211_wake_queues_by_reason(&local->hw, 985 + IEEE80211_MAX_QUEUE_MAP, 986 + IEEE80211_QUEUE_STOP_REASON_CSA); 987 + mutex_unlock(&local->mtx); 988 + 987 989 ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED; 990 + 991 + ieee80211_sta_reset_beacon_monitor(sdata); 992 + ieee80211_sta_reset_conn_monitor(sdata); 993 + 994 + out: 988 995 sdata_unlock(sdata); 989 996 } 990 997 ··· 1107 1100 mutex_unlock(&local->chanctx_mtx); 1108 1101 1109 1102 sdata->csa_chandef = csa_ie.chandef; 1110 - sdata->vif.csa_active = true; 1111 1103 1112 - if (csa_ie.mode) 1104 + mutex_lock(&local->mtx); 1105 + sdata->vif.csa_active = true; 1106 + sdata->csa_block_tx = csa_ie.mode; 1107 + 1108 + if (sdata->csa_block_tx) 1113 1109 ieee80211_stop_queues_by_reason(&local->hw, 1114 - IEEE80211_MAX_QUEUE_MAP, 1115 - IEEE80211_QUEUE_STOP_REASON_CSA); 1110 + IEEE80211_MAX_QUEUE_MAP, 1111 + IEEE80211_QUEUE_STOP_REASON_CSA); 1112 + mutex_unlock(&local->mtx); 1116 1113 1117 1114 if (local->ops->channel_switch) { 1118 1115 /* use driver's channel switch callback */ ··· 1828 1817 ifmgd->flags = 0; 1829 1818 mutex_lock(&local->mtx); 1830 1819 ieee80211_vif_release_channel(sdata); 1820 + 1821 + sdata->vif.csa_active = false; 1822 + if (!ieee80211_csa_needs_block_tx(local)) 1823 + ieee80211_wake_queues_by_reason(&local->hw, 1824 + IEEE80211_MAX_QUEUE_MAP, 1825 + IEEE80211_QUEUE_STOP_REASON_CSA); 1831 1826 mutex_unlock(&local->mtx); 1832 1827 1833 1828 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM; ··· 2062 2045 2063 2046 static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata) 2064 2047 { 2048 + struct ieee80211_local *local = sdata->local; 2065 2049 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 2066 2050 u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; 2067 2051 ··· 2076 2058 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, 2077 2059 true, frame_buf); 2078 2060 ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED; 2061 + 2062 + mutex_lock(&local->mtx); 2079 2063 sdata->vif.csa_active = false; 2080 - ieee80211_wake_queues_by_reason(&sdata->local->hw, 2064 + if (!ieee80211_csa_needs_block_tx(local)) 2065 + ieee80211_wake_queues_by_reason(&local->hw, 2081 2066 IEEE80211_MAX_QUEUE_MAP, 2082 2067 IEEE80211_QUEUE_STOP_REASON_CSA); 2068 + mutex_unlock(&local->mtx); 2083 2069 2084 2070 cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, 2085 2071 IEEE80211_DEAUTH_FRAME_LEN); ··· 3568 3546 if (local->quiescing) 3569 3547 return; 3570 3548 3549 + if (sdata->vif.csa_active) 3550 + return; 3551 + 3571 3552 sdata->u.mgd.connection_loss = false; 3572 3553 ieee80211_queue_work(&sdata->local->hw, 3573 3554 &sdata->u.mgd.beacon_connection_loss_work); ··· 3584 3559 struct ieee80211_local *local = sdata->local; 3585 3560 3586 3561 if (local->quiescing) 3562 + return; 3563 + 3564 + if (sdata->vif.csa_active) 3587 3565 return; 3588 3566 3589 3567 ieee80211_queue_work(&local->hw, &ifmgd->monitor_work);
+12
net/mac80211/rc80211_minstrel.c
··· 657 657 kfree(priv); 658 658 } 659 659 660 + static u32 minstrel_get_expected_throughput(void *priv_sta) 661 + { 662 + struct minstrel_sta_info *mi = priv_sta; 663 + int idx = mi->max_tp_rate[0]; 664 + 665 + /* convert pkt per sec in kbps (1200 is the average pkt size used for 666 + * computing cur_tp 667 + */ 668 + return MINSTREL_TRUNC(mi->r[idx].cur_tp) * 1200 * 8 / 1024; 669 + } 670 + 660 671 const struct rate_control_ops mac80211_minstrel = { 661 672 .name = "minstrel", 662 673 .tx_status = minstrel_tx_status, ··· 681 670 .add_sta_debugfs = minstrel_add_sta_debugfs, 682 671 .remove_sta_debugfs = minstrel_remove_sta_debugfs, 683 672 #endif 673 + .get_expected_throughput = minstrel_get_expected_throughput, 684 674 }; 685 675 686 676 int __init
+20 -2
net/mac80211/rc80211_minstrel_ht.c
··· 22 22 #define MCS_NBITS (AVG_PKT_SIZE << 3) 23 23 24 24 /* Number of symbols for a packet with (bps) bits per symbol */ 25 - #define MCS_NSYMS(bps) ((MCS_NBITS + (bps) - 1) / (bps)) 25 + #define MCS_NSYMS(bps) DIV_ROUND_UP(MCS_NBITS, (bps)) 26 26 27 27 /* Transmission time (nanoseconds) for a packet containing (syms) symbols */ 28 28 #define MCS_SYMBOL_TIME(sgi, syms) \ ··· 226 226 nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); 227 227 228 228 nsecs += minstrel_mcs_groups[group].duration[rate]; 229 - tp = 1000000 * ((prob * 1000) / nsecs); 230 229 230 + /* prob is scaled - see MINSTREL_FRAC above */ 231 + tp = 1000000 * ((prob * 1000) / nsecs); 231 232 mr->cur_tp = MINSTREL_TRUNC(tp); 232 233 } 233 234 ··· 1032 1031 mac80211_minstrel.free(priv); 1033 1032 } 1034 1033 1034 + static u32 minstrel_ht_get_expected_throughput(void *priv_sta) 1035 + { 1036 + struct minstrel_ht_sta_priv *msp = priv_sta; 1037 + struct minstrel_ht_sta *mi = &msp->ht; 1038 + int i, j; 1039 + 1040 + if (!msp->is_ht) 1041 + return mac80211_minstrel.get_expected_throughput(priv_sta); 1042 + 1043 + i = mi->max_tp_rate / MCS_GROUP_RATES; 1044 + j = mi->max_tp_rate % MCS_GROUP_RATES; 1045 + 1046 + /* convert cur_tp from pkt per second in kbps */ 1047 + return mi->groups[i].rates[j].cur_tp * AVG_PKT_SIZE * 8 / 1024; 1048 + } 1049 + 1035 1050 static const struct rate_control_ops mac80211_minstrel_ht = { 1036 1051 .name = "minstrel_ht", 1037 1052 .tx_status = minstrel_ht_tx_status, ··· 1062 1045 .add_sta_debugfs = minstrel_ht_add_sta_debugfs, 1063 1046 .remove_sta_debugfs = minstrel_ht_remove_sta_debugfs, 1064 1047 #endif 1048 + .get_expected_throughput = minstrel_ht_get_expected_throughput, 1065 1049 }; 1066 1050 1067 1051
+10 -5
net/mac80211/scan.c
··· 1076 1076 } 1077 1077 EXPORT_SYMBOL(ieee80211_sched_scan_results); 1078 1078 1079 - void ieee80211_sched_scan_stopped_work(struct work_struct *work) 1079 + void ieee80211_sched_scan_end(struct ieee80211_local *local) 1080 1080 { 1081 - struct ieee80211_local *local = 1082 - container_of(work, struct ieee80211_local, 1083 - sched_scan_stopped_work); 1084 - 1085 1081 mutex_lock(&local->mtx); 1086 1082 1087 1083 if (!rcu_access_pointer(local->sched_scan_sdata)) { ··· 1093 1097 mutex_unlock(&local->mtx); 1094 1098 1095 1099 cfg80211_sched_scan_stopped(local->hw.wiphy); 1100 + } 1101 + 1102 + void ieee80211_sched_scan_stopped_work(struct work_struct *work) 1103 + { 1104 + struct ieee80211_local *local = 1105 + container_of(work, struct ieee80211_local, 1106 + sched_scan_stopped_work); 1107 + 1108 + ieee80211_sched_scan_end(local); 1096 1109 } 1097 1110 1098 1111 void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw)
+325
net/mac80211/tdls.c
··· 1 + /* 2 + * mac80211 TDLS handling code 3 + * 4 + * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 5 + * Copyright 2014, Intel Corporation 6 + * 7 + * This file is GPLv2 as found in COPYING. 8 + */ 9 + 10 + #include <linux/ieee80211.h> 11 + #include "ieee80211_i.h" 12 + 13 + static void ieee80211_tdls_add_ext_capab(struct sk_buff *skb) 14 + { 15 + u8 *pos = (void *)skb_put(skb, 7); 16 + 17 + *pos++ = WLAN_EID_EXT_CAPABILITY; 18 + *pos++ = 5; /* len */ 19 + *pos++ = 0x0; 20 + *pos++ = 0x0; 21 + *pos++ = 0x0; 22 + *pos++ = 0x0; 23 + *pos++ = WLAN_EXT_CAPA5_TDLS_ENABLED; 24 + } 25 + 26 + static u16 ieee80211_get_tdls_sta_capab(struct ieee80211_sub_if_data *sdata) 27 + { 28 + struct ieee80211_local *local = sdata->local; 29 + u16 capab; 30 + 31 + capab = 0; 32 + if (ieee80211_get_sdata_band(sdata) != IEEE80211_BAND_2GHZ) 33 + return capab; 34 + 35 + if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE)) 36 + capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME; 37 + if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE)) 38 + capab |= WLAN_CAPABILITY_SHORT_PREAMBLE; 39 + 40 + return capab; 41 + } 42 + 43 + static void ieee80211_tdls_add_link_ie(struct sk_buff *skb, const u8 *src_addr, 44 + const u8 *peer, const u8 *bssid) 45 + { 46 + struct ieee80211_tdls_lnkie *lnkid; 47 + 48 + lnkid = (void *)skb_put(skb, sizeof(struct ieee80211_tdls_lnkie)); 49 + 50 + lnkid->ie_type = WLAN_EID_LINK_ID; 51 + lnkid->ie_len = sizeof(struct ieee80211_tdls_lnkie) - 2; 52 + 53 + memcpy(lnkid->bssid, bssid, ETH_ALEN); 54 + memcpy(lnkid->init_sta, src_addr, ETH_ALEN); 55 + memcpy(lnkid->resp_sta, peer, ETH_ALEN); 56 + } 57 + 58 + static int 59 + ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev, 60 + const u8 *peer, u8 action_code, u8 dialog_token, 61 + u16 status_code, struct sk_buff *skb) 62 + { 63 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 64 + enum ieee80211_band band = ieee80211_get_sdata_band(sdata); 65 + struct ieee80211_tdls_data *tf; 66 + 67 + tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); 68 + 69 + memcpy(tf->da, peer, ETH_ALEN); 70 + memcpy(tf->sa, sdata->vif.addr, ETH_ALEN); 71 + tf->ether_type = cpu_to_be16(ETH_P_TDLS); 72 + tf->payload_type = WLAN_TDLS_SNAP_RFTYPE; 73 + 74 + switch (action_code) { 75 + case WLAN_TDLS_SETUP_REQUEST: 76 + tf->category = WLAN_CATEGORY_TDLS; 77 + tf->action_code = WLAN_TDLS_SETUP_REQUEST; 78 + 79 + skb_put(skb, sizeof(tf->u.setup_req)); 80 + tf->u.setup_req.dialog_token = dialog_token; 81 + tf->u.setup_req.capability = 82 + cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 83 + 84 + ieee80211_add_srates_ie(sdata, skb, false, band); 85 + ieee80211_add_ext_srates_ie(sdata, skb, false, band); 86 + ieee80211_tdls_add_ext_capab(skb); 87 + break; 88 + case WLAN_TDLS_SETUP_RESPONSE: 89 + tf->category = WLAN_CATEGORY_TDLS; 90 + tf->action_code = WLAN_TDLS_SETUP_RESPONSE; 91 + 92 + skb_put(skb, sizeof(tf->u.setup_resp)); 93 + tf->u.setup_resp.status_code = cpu_to_le16(status_code); 94 + tf->u.setup_resp.dialog_token = dialog_token; 95 + tf->u.setup_resp.capability = 96 + cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 97 + 98 + ieee80211_add_srates_ie(sdata, skb, false, band); 99 + ieee80211_add_ext_srates_ie(sdata, skb, false, band); 100 + ieee80211_tdls_add_ext_capab(skb); 101 + break; 102 + case WLAN_TDLS_SETUP_CONFIRM: 103 + tf->category = WLAN_CATEGORY_TDLS; 104 + tf->action_code = WLAN_TDLS_SETUP_CONFIRM; 105 + 106 + skb_put(skb, sizeof(tf->u.setup_cfm)); 107 + tf->u.setup_cfm.status_code = cpu_to_le16(status_code); 108 + tf->u.setup_cfm.dialog_token = dialog_token; 109 + break; 110 + case WLAN_TDLS_TEARDOWN: 111 + tf->category = WLAN_CATEGORY_TDLS; 112 + tf->action_code = WLAN_TDLS_TEARDOWN; 113 + 114 + skb_put(skb, sizeof(tf->u.teardown)); 115 + tf->u.teardown.reason_code = cpu_to_le16(status_code); 116 + break; 117 + case WLAN_TDLS_DISCOVERY_REQUEST: 118 + tf->category = WLAN_CATEGORY_TDLS; 119 + tf->action_code = WLAN_TDLS_DISCOVERY_REQUEST; 120 + 121 + skb_put(skb, sizeof(tf->u.discover_req)); 122 + tf->u.discover_req.dialog_token = dialog_token; 123 + break; 124 + default: 125 + return -EINVAL; 126 + } 127 + 128 + return 0; 129 + } 130 + 131 + static int 132 + ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev, 133 + const u8 *peer, u8 action_code, u8 dialog_token, 134 + u16 status_code, struct sk_buff *skb) 135 + { 136 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 137 + enum ieee80211_band band = ieee80211_get_sdata_band(sdata); 138 + struct ieee80211_mgmt *mgmt; 139 + 140 + mgmt = (void *)skb_put(skb, 24); 141 + memset(mgmt, 0, 24); 142 + memcpy(mgmt->da, peer, ETH_ALEN); 143 + memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); 144 + memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); 145 + 146 + mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | 147 + IEEE80211_STYPE_ACTION); 148 + 149 + switch (action_code) { 150 + case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: 151 + skb_put(skb, 1 + sizeof(mgmt->u.action.u.tdls_discover_resp)); 152 + mgmt->u.action.category = WLAN_CATEGORY_PUBLIC; 153 + mgmt->u.action.u.tdls_discover_resp.action_code = 154 + WLAN_PUB_ACTION_TDLS_DISCOVER_RES; 155 + mgmt->u.action.u.tdls_discover_resp.dialog_token = 156 + dialog_token; 157 + mgmt->u.action.u.tdls_discover_resp.capability = 158 + cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 159 + 160 + ieee80211_add_srates_ie(sdata, skb, false, band); 161 + ieee80211_add_ext_srates_ie(sdata, skb, false, band); 162 + ieee80211_tdls_add_ext_capab(skb); 163 + break; 164 + default: 165 + return -EINVAL; 166 + } 167 + 168 + return 0; 169 + } 170 + 171 + int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, 172 + const u8 *peer, u8 action_code, u8 dialog_token, 173 + u16 status_code, u32 peer_capability, 174 + const u8 *extra_ies, size_t extra_ies_len) 175 + { 176 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 177 + struct ieee80211_local *local = sdata->local; 178 + struct sk_buff *skb = NULL; 179 + bool send_direct; 180 + int ret; 181 + 182 + if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)) 183 + return -ENOTSUPP; 184 + 185 + /* make sure we are in managed mode, and associated */ 186 + if (sdata->vif.type != NL80211_IFTYPE_STATION || 187 + !sdata->u.mgd.associated) 188 + return -EINVAL; 189 + 190 + tdls_dbg(sdata, "TDLS mgmt action %d peer %pM\n", 191 + action_code, peer); 192 + 193 + skb = dev_alloc_skb(local->hw.extra_tx_headroom + 194 + max(sizeof(struct ieee80211_mgmt), 195 + sizeof(struct ieee80211_tdls_data)) + 196 + 50 + /* supported rates */ 197 + 7 + /* ext capab */ 198 + extra_ies_len + 199 + sizeof(struct ieee80211_tdls_lnkie)); 200 + if (!skb) 201 + return -ENOMEM; 202 + 203 + skb_reserve(skb, local->hw.extra_tx_headroom); 204 + 205 + switch (action_code) { 206 + case WLAN_TDLS_SETUP_REQUEST: 207 + case WLAN_TDLS_SETUP_RESPONSE: 208 + case WLAN_TDLS_SETUP_CONFIRM: 209 + case WLAN_TDLS_TEARDOWN: 210 + case WLAN_TDLS_DISCOVERY_REQUEST: 211 + ret = ieee80211_prep_tdls_encap_data(wiphy, dev, peer, 212 + action_code, dialog_token, 213 + status_code, skb); 214 + send_direct = false; 215 + break; 216 + case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: 217 + ret = ieee80211_prep_tdls_direct(wiphy, dev, peer, action_code, 218 + dialog_token, status_code, 219 + skb); 220 + send_direct = true; 221 + break; 222 + default: 223 + ret = -ENOTSUPP; 224 + break; 225 + } 226 + 227 + if (ret < 0) 228 + goto fail; 229 + 230 + if (extra_ies_len) 231 + memcpy(skb_put(skb, extra_ies_len), extra_ies, extra_ies_len); 232 + 233 + /* the TDLS link IE is always added last */ 234 + switch (action_code) { 235 + case WLAN_TDLS_SETUP_REQUEST: 236 + case WLAN_TDLS_SETUP_CONFIRM: 237 + case WLAN_TDLS_TEARDOWN: 238 + case WLAN_TDLS_DISCOVERY_REQUEST: 239 + /* we are the initiator */ 240 + ieee80211_tdls_add_link_ie(skb, sdata->vif.addr, peer, 241 + sdata->u.mgd.bssid); 242 + break; 243 + case WLAN_TDLS_SETUP_RESPONSE: 244 + case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: 245 + /* we are the responder */ 246 + ieee80211_tdls_add_link_ie(skb, peer, sdata->vif.addr, 247 + sdata->u.mgd.bssid); 248 + break; 249 + default: 250 + ret = -ENOTSUPP; 251 + goto fail; 252 + } 253 + 254 + if (send_direct) { 255 + ieee80211_tx_skb(sdata, skb); 256 + return 0; 257 + } 258 + 259 + /* 260 + * According to 802.11z: Setup req/resp are sent in AC_BK, otherwise 261 + * we should default to AC_VI. 262 + */ 263 + switch (action_code) { 264 + case WLAN_TDLS_SETUP_REQUEST: 265 + case WLAN_TDLS_SETUP_RESPONSE: 266 + skb_set_queue_mapping(skb, IEEE80211_AC_BK); 267 + skb->priority = 2; 268 + break; 269 + default: 270 + skb_set_queue_mapping(skb, IEEE80211_AC_VI); 271 + skb->priority = 5; 272 + break; 273 + } 274 + 275 + /* disable bottom halves when entering the Tx path */ 276 + local_bh_disable(); 277 + ret = ieee80211_subif_start_xmit(skb, dev); 278 + local_bh_enable(); 279 + 280 + return ret; 281 + 282 + fail: 283 + dev_kfree_skb(skb); 284 + return ret; 285 + } 286 + 287 + int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, 288 + const u8 *peer, enum nl80211_tdls_operation oper) 289 + { 290 + struct sta_info *sta; 291 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 292 + 293 + if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)) 294 + return -ENOTSUPP; 295 + 296 + if (sdata->vif.type != NL80211_IFTYPE_STATION) 297 + return -EINVAL; 298 + 299 + tdls_dbg(sdata, "TDLS oper %d peer %pM\n", oper, peer); 300 + 301 + switch (oper) { 302 + case NL80211_TDLS_ENABLE_LINK: 303 + rcu_read_lock(); 304 + sta = sta_info_get(sdata, peer); 305 + if (!sta) { 306 + rcu_read_unlock(); 307 + return -ENOLINK; 308 + } 309 + 310 + set_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH); 311 + rcu_read_unlock(); 312 + break; 313 + case NL80211_TDLS_DISABLE_LINK: 314 + return sta_info_destroy_addr(sdata, peer); 315 + case NL80211_TDLS_TEARDOWN: 316 + case NL80211_TDLS_SETUP: 317 + case NL80211_TDLS_DISCOVERY_REQ: 318 + /* We don't support in-driver setup/teardown/discovery */ 319 + return -ENOTSUPP; 320 + default: 321 + return -ENOTSUPP; 322 + } 323 + 324 + return 0; 325 + }
+32
net/mac80211/trace.h
··· 184 184 "true" : "false") 185 185 ); 186 186 187 + TRACE_EVENT(drv_return_u32, 188 + TP_PROTO(struct ieee80211_local *local, u32 ret), 189 + TP_ARGS(local, ret), 190 + TP_STRUCT__entry( 191 + LOCAL_ENTRY 192 + __field(u32, ret) 193 + ), 194 + TP_fast_assign( 195 + LOCAL_ASSIGN; 196 + __entry->ret = ret; 197 + ), 198 + TP_printk(LOCAL_PR_FMT " - %u", LOCAL_PR_ARG, __entry->ret) 199 + ); 200 + 187 201 TRACE_EVENT(drv_return_u64, 188 202 TP_PROTO(struct ieee80211_local *local, u64 ret), 189 203 TP_ARGS(local, ret), ··· 1511 1497 TP_PROTO(struct ieee80211_local *local, 1512 1498 struct ieee80211_sub_if_data *sdata), 1513 1499 TP_ARGS(local, sdata) 1500 + ); 1501 + 1502 + TRACE_EVENT(drv_get_expected_throughput, 1503 + TP_PROTO(struct ieee80211_sta *sta), 1504 + 1505 + TP_ARGS(sta), 1506 + 1507 + TP_STRUCT__entry( 1508 + STA_ENTRY 1509 + ), 1510 + 1511 + TP_fast_assign( 1512 + STA_ASSIGN; 1513 + ), 1514 + 1515 + TP_printk( 1516 + STA_PR_FMT, STA_PR_ARG 1517 + ) 1514 1518 ); 1515 1519 1516 1520 /*
+140 -53
net/mac80211/tx.c
··· 2328 2328 /* functions for drivers to get certain frames */ 2329 2329 2330 2330 static void __ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, 2331 - struct ps_data *ps, struct sk_buff *skb) 2331 + struct ps_data *ps, struct sk_buff *skb, 2332 + bool is_template) 2332 2333 { 2333 2334 u8 *pos, *tim; 2334 2335 int aid0 = 0; ··· 2342 2341 * checking byte-for-byte */ 2343 2342 have_bits = !bitmap_empty((unsigned long *)ps->tim, 2344 2343 IEEE80211_MAX_AID+1); 2345 - 2346 - if (ps->dtim_count == 0) 2347 - ps->dtim_count = sdata->vif.bss_conf.dtim_period - 1; 2348 - else 2349 - ps->dtim_count--; 2344 + if (!is_template) { 2345 + if (ps->dtim_count == 0) 2346 + ps->dtim_count = sdata->vif.bss_conf.dtim_period - 1; 2347 + else 2348 + ps->dtim_count--; 2349 + } 2350 2350 2351 2351 tim = pos = (u8 *) skb_put(skb, 6); 2352 2352 *pos++ = WLAN_EID_TIM; ··· 2393 2391 } 2394 2392 2395 2393 static int ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, 2396 - struct ps_data *ps, struct sk_buff *skb) 2394 + struct ps_data *ps, struct sk_buff *skb, 2395 + bool is_template) 2397 2396 { 2398 2397 struct ieee80211_local *local = sdata->local; 2399 2398 ··· 2406 2403 * of the tim bitmap in mac80211 and the driver. 2407 2404 */ 2408 2405 if (local->tim_in_locked_section) { 2409 - __ieee80211_beacon_add_tim(sdata, ps, skb); 2406 + __ieee80211_beacon_add_tim(sdata, ps, skb, is_template); 2410 2407 } else { 2411 2408 spin_lock_bh(&local->tim_lock); 2412 - __ieee80211_beacon_add_tim(sdata, ps, skb); 2409 + __ieee80211_beacon_add_tim(sdata, ps, skb, is_template); 2413 2410 spin_unlock_bh(&local->tim_lock); 2414 2411 } 2415 2412 2416 2413 return 0; 2417 2414 } 2418 2415 2419 - static void ieee80211_update_csa(struct ieee80211_sub_if_data *sdata, 2420 - struct beacon_data *beacon) 2416 + static void ieee80211_set_csa(struct ieee80211_sub_if_data *sdata, 2417 + struct beacon_data *beacon) 2421 2418 { 2422 2419 struct probe_resp *resp; 2423 - int counter_offset_beacon = sdata->csa_counter_offset_beacon; 2424 - int counter_offset_presp = sdata->csa_counter_offset_presp; 2425 2420 u8 *beacon_data; 2426 2421 size_t beacon_data_len; 2422 + int i; 2423 + u8 count = sdata->csa_current_counter; 2427 2424 2428 2425 switch (sdata->vif.type) { 2429 2426 case NL80211_IFTYPE_AP: ··· 2441 2438 default: 2442 2439 return; 2443 2440 } 2444 - if (WARN_ON(counter_offset_beacon >= beacon_data_len)) 2445 - return; 2446 2441 2447 - /* Warn if the driver did not check for/react to csa 2448 - * completeness. A beacon with CSA counter set to 0 should 2449 - * never occur, because a counter of 1 means switch just 2450 - * before the next beacon. 2451 - */ 2452 - if (WARN_ON(beacon_data[counter_offset_beacon] == 1)) 2453 - return; 2442 + for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; ++i) { 2443 + u16 counter_offset_beacon = 2444 + sdata->csa_counter_offset_beacon[i]; 2445 + u16 counter_offset_presp = sdata->csa_counter_offset_presp[i]; 2454 2446 2455 - beacon_data[counter_offset_beacon]--; 2447 + if (counter_offset_beacon) { 2448 + if (WARN_ON(counter_offset_beacon >= beacon_data_len)) 2449 + return; 2456 2450 2457 - if (sdata->vif.type == NL80211_IFTYPE_AP && counter_offset_presp) { 2458 - rcu_read_lock(); 2459 - resp = rcu_dereference(sdata->u.ap.probe_resp); 2460 - 2461 - /* if nl80211 accepted the offset, this should not happen. */ 2462 - if (WARN_ON(!resp)) { 2463 - rcu_read_unlock(); 2464 - return; 2451 + beacon_data[counter_offset_beacon] = count; 2465 2452 } 2466 - resp->data[counter_offset_presp]--; 2467 - rcu_read_unlock(); 2453 + 2454 + if (sdata->vif.type == NL80211_IFTYPE_AP && 2455 + counter_offset_presp) { 2456 + rcu_read_lock(); 2457 + resp = rcu_dereference(sdata->u.ap.probe_resp); 2458 + 2459 + /* If nl80211 accepted the offset, this should 2460 + * not happen. 2461 + */ 2462 + if (WARN_ON(!resp)) { 2463 + rcu_read_unlock(); 2464 + return; 2465 + } 2466 + resp->data[counter_offset_presp] = count; 2467 + rcu_read_unlock(); 2468 + } 2468 2469 } 2469 2470 } 2471 + 2472 + u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif) 2473 + { 2474 + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 2475 + 2476 + sdata->csa_current_counter--; 2477 + 2478 + /* the counter should never reach 0 */ 2479 + WARN_ON(!sdata->csa_current_counter); 2480 + 2481 + return sdata->csa_current_counter; 2482 + } 2483 + EXPORT_SYMBOL(ieee80211_csa_update_counter); 2470 2484 2471 2485 bool ieee80211_csa_is_complete(struct ieee80211_vif *vif) 2472 2486 { ··· 2491 2471 struct beacon_data *beacon = NULL; 2492 2472 u8 *beacon_data; 2493 2473 size_t beacon_data_len; 2494 - int counter_beacon = sdata->csa_counter_offset_beacon; 2474 + int counter_beacon = sdata->csa_counter_offset_beacon[0]; 2495 2475 int ret = false; 2496 2476 2497 2477 if (!ieee80211_sdata_running(sdata)) ··· 2541 2521 } 2542 2522 EXPORT_SYMBOL(ieee80211_csa_is_complete); 2543 2523 2544 - struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, 2545 - struct ieee80211_vif *vif, 2546 - u16 *tim_offset, u16 *tim_length) 2524 + static struct sk_buff * 2525 + __ieee80211_beacon_get(struct ieee80211_hw *hw, 2526 + struct ieee80211_vif *vif, 2527 + struct ieee80211_mutable_offsets *offs, 2528 + bool is_template) 2547 2529 { 2548 2530 struct ieee80211_local *local = hw_to_local(hw); 2549 2531 struct sk_buff *skb = NULL; ··· 2554 2532 enum ieee80211_band band; 2555 2533 struct ieee80211_tx_rate_control txrc; 2556 2534 struct ieee80211_chanctx_conf *chanctx_conf; 2535 + int csa_off_base = 0; 2557 2536 2558 2537 rcu_read_lock(); 2559 2538 ··· 2564 2541 if (!ieee80211_sdata_running(sdata) || !chanctx_conf) 2565 2542 goto out; 2566 2543 2567 - if (tim_offset) 2568 - *tim_offset = 0; 2569 - if (tim_length) 2570 - *tim_length = 0; 2544 + if (offs) 2545 + memset(offs, 0, sizeof(*offs)); 2571 2546 2572 2547 if (sdata->vif.type == NL80211_IFTYPE_AP) { 2573 2548 struct ieee80211_if_ap *ap = &sdata->u.ap; 2574 2549 struct beacon_data *beacon = rcu_dereference(ap->beacon); 2575 2550 2576 2551 if (beacon) { 2577 - if (sdata->vif.csa_active) 2578 - ieee80211_update_csa(sdata, beacon); 2552 + if (sdata->vif.csa_active) { 2553 + if (!is_template) 2554 + ieee80211_csa_update_counter(vif); 2555 + 2556 + ieee80211_set_csa(sdata, beacon); 2557 + } 2579 2558 2580 2559 /* 2581 2560 * headroom, head length, ··· 2594 2569 memcpy(skb_put(skb, beacon->head_len), beacon->head, 2595 2570 beacon->head_len); 2596 2571 2597 - ieee80211_beacon_add_tim(sdata, &ap->ps, skb); 2572 + ieee80211_beacon_add_tim(sdata, &ap->ps, skb, 2573 + is_template); 2598 2574 2599 - if (tim_offset) 2600 - *tim_offset = beacon->head_len; 2601 - if (tim_length) 2602 - *tim_length = skb->len - beacon->head_len; 2575 + if (offs) { 2576 + offs->tim_offset = beacon->head_len; 2577 + offs->tim_length = skb->len - beacon->head_len; 2578 + 2579 + /* for AP the csa offsets are from tail */ 2580 + csa_off_base = skb->len; 2581 + } 2603 2582 2604 2583 if (beacon->tail) 2605 2584 memcpy(skb_put(skb, beacon->tail_len), ··· 2618 2589 if (!presp) 2619 2590 goto out; 2620 2591 2621 - if (sdata->vif.csa_active) 2622 - ieee80211_update_csa(sdata, presp); 2592 + if (sdata->vif.csa_active) { 2593 + if (!is_template) 2594 + ieee80211_csa_update_counter(vif); 2623 2595 2596 + ieee80211_set_csa(sdata, presp); 2597 + } 2624 2598 2625 2599 skb = dev_alloc_skb(local->tx_headroom + presp->head_len + 2626 2600 local->hw.extra_beacon_tailroom); ··· 2643 2611 if (!bcn) 2644 2612 goto out; 2645 2613 2646 - if (sdata->vif.csa_active) 2647 - ieee80211_update_csa(sdata, bcn); 2614 + if (sdata->vif.csa_active) { 2615 + if (!is_template) 2616 + /* TODO: For mesh csa_counter is in TU, so 2617 + * decrementing it by one isn't correct, but 2618 + * for now we leave it consistent with overall 2619 + * mac80211's behavior. 2620 + */ 2621 + ieee80211_csa_update_counter(vif); 2622 + 2623 + ieee80211_set_csa(sdata, bcn); 2624 + } 2648 2625 2649 2626 if (ifmsh->sync_ops) 2650 2627 ifmsh->sync_ops->adjust_tbtt(sdata, bcn); ··· 2667 2626 goto out; 2668 2627 skb_reserve(skb, local->tx_headroom); 2669 2628 memcpy(skb_put(skb, bcn->head_len), bcn->head, bcn->head_len); 2670 - ieee80211_beacon_add_tim(sdata, &ifmsh->ps, skb); 2629 + ieee80211_beacon_add_tim(sdata, &ifmsh->ps, skb, is_template); 2630 + 2631 + if (offs) { 2632 + offs->tim_offset = bcn->head_len; 2633 + offs->tim_length = skb->len - bcn->head_len; 2634 + } 2635 + 2671 2636 memcpy(skb_put(skb, bcn->tail_len), bcn->tail, bcn->tail_len); 2672 2637 } else { 2673 2638 WARN_ON(1); 2674 2639 goto out; 2640 + } 2641 + 2642 + /* CSA offsets */ 2643 + if (offs) { 2644 + int i; 2645 + 2646 + for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; i++) { 2647 + u16 csa_off = sdata->csa_counter_offset_beacon[i]; 2648 + 2649 + if (!csa_off) 2650 + continue; 2651 + 2652 + offs->csa_counter_offs[i] = csa_off_base + csa_off; 2653 + } 2675 2654 } 2676 2655 2677 2656 band = chanctx_conf->def.chan->band; ··· 2724 2663 out: 2725 2664 rcu_read_unlock(); 2726 2665 return skb; 2666 + 2667 + } 2668 + 2669 + struct sk_buff * 2670 + ieee80211_beacon_get_template(struct ieee80211_hw *hw, 2671 + struct ieee80211_vif *vif, 2672 + struct ieee80211_mutable_offsets *offs) 2673 + { 2674 + return __ieee80211_beacon_get(hw, vif, offs, true); 2675 + } 2676 + EXPORT_SYMBOL(ieee80211_beacon_get_template); 2677 + 2678 + struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, 2679 + struct ieee80211_vif *vif, 2680 + u16 *tim_offset, u16 *tim_length) 2681 + { 2682 + struct ieee80211_mutable_offsets offs = {}; 2683 + struct sk_buff *bcn = __ieee80211_beacon_get(hw, vif, &offs, false); 2684 + 2685 + if (tim_offset) 2686 + *tim_offset = offs.tim_offset; 2687 + 2688 + if (tim_length) 2689 + *tim_length = offs.tim_length; 2690 + 2691 + return bcn; 2727 2692 } 2728 2693 EXPORT_SYMBOL(ieee80211_beacon_get_tim); 2729 2694
+43 -3
net/mac80211/util.c
··· 1457 1457 drv_stop(local); 1458 1458 } 1459 1459 1460 + static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) 1461 + { 1462 + struct ieee80211_sub_if_data *sdata; 1463 + struct ieee80211_chanctx *ctx; 1464 + 1465 + /* 1466 + * We get here if during resume the device can't be restarted properly. 1467 + * We might also get here if this happens during HW reset, which is a 1468 + * slightly different situation and we need to drop all connections in 1469 + * the latter case. 1470 + * 1471 + * Ask cfg80211 to turn off all interfaces, this will result in more 1472 + * warnings but at least we'll then get into a clean stopped state. 1473 + */ 1474 + 1475 + local->resuming = false; 1476 + local->suspended = false; 1477 + local->started = false; 1478 + 1479 + /* scheduled scan clearly can't be running any more, but tell 1480 + * cfg80211 and clear local state 1481 + */ 1482 + ieee80211_sched_scan_end(local); 1483 + 1484 + list_for_each_entry(sdata, &local->interfaces, list) 1485 + sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; 1486 + 1487 + /* Mark channel contexts as not being in the driver any more to avoid 1488 + * removing them from the driver during the shutdown process... 1489 + */ 1490 + mutex_lock(&local->chanctx_mtx); 1491 + list_for_each_entry(ctx, &local->chanctx_list, list) 1492 + ctx->driver_present = false; 1493 + mutex_unlock(&local->chanctx_mtx); 1494 + 1495 + cfg80211_shutdown_all_interfaces(local->hw.wiphy); 1496 + } 1497 + 1460 1498 static void ieee80211_assign_chanctx(struct ieee80211_local *local, 1461 1499 struct ieee80211_sub_if_data *sdata) 1462 1500 { ··· 1558 1520 */ 1559 1521 res = drv_start(local); 1560 1522 if (res) { 1561 - WARN(local->suspended, "Hardware became unavailable " 1562 - "upon resume. This could be a software issue " 1563 - "prior to suspend or a hardware issue.\n"); 1523 + if (local->suspended) 1524 + WARN(1, "Hardware became unavailable upon resume. This could be a software issue prior to suspend or a hardware issue.\n"); 1525 + else 1526 + WARN(1, "Hardware became unavailable during restart.\n"); 1527 + ieee80211_handle_reconfig_failure(local); 1564 1528 return res; 1565 1529 } 1566 1530
+1
net/nfc/digital.h
··· 71 71 void digital_poll_next_tech(struct nfc_digital_dev *ddev); 72 72 73 73 int digital_in_send_sens_req(struct nfc_digital_dev *ddev, u8 rf_tech); 74 + int digital_in_send_sensb_req(struct nfc_digital_dev *ddev, u8 rf_tech); 74 75 int digital_in_send_sensf_req(struct nfc_digital_dev *ddev, u8 rf_tech); 75 76 int digital_in_send_iso15693_inv_req(struct nfc_digital_dev *ddev, u8 rf_tech); 76 77
+18 -2
net/nfc/digital_core.c
··· 22 22 #define DIGITAL_PROTO_NFCA_RF_TECH \ 23 23 (NFC_PROTO_JEWEL_MASK | NFC_PROTO_MIFARE_MASK | NFC_PROTO_NFC_DEP_MASK) 24 24 25 + #define DIGITAL_PROTO_NFCB_RF_TECH NFC_PROTO_ISO14443_B_MASK 26 + 25 27 #define DIGITAL_PROTO_NFCF_RF_TECH \ 26 28 (NFC_PROTO_FELICA_MASK | NFC_PROTO_NFC_DEP_MASK) 27 29 ··· 347 345 add_crc = digital_skb_add_crc_a; 348 346 break; 349 347 348 + case NFC_PROTO_ISO14443_B: 349 + framing = NFC_DIGITAL_FRAMING_NFCB_T4T; 350 + check_crc = digital_skb_check_crc_b; 351 + add_crc = digital_skb_add_crc_b; 352 + break; 353 + 350 354 default: 351 355 pr_err("Invalid protocol %d\n", protocol); 352 356 return -EINVAL; ··· 482 474 if (matching_im_protocols & DIGITAL_PROTO_NFCA_RF_TECH) 483 475 digital_add_poll_tech(ddev, NFC_DIGITAL_RF_TECH_106A, 484 476 digital_in_send_sens_req); 477 + 478 + if (matching_im_protocols & DIGITAL_PROTO_NFCB_RF_TECH) 479 + digital_add_poll_tech(ddev, NFC_DIGITAL_RF_TECH_106B, 480 + digital_in_send_sensb_req); 485 481 486 482 if (matching_im_protocols & DIGITAL_PROTO_NFCF_RF_TECH) { 487 483 digital_add_poll_tech(ddev, NFC_DIGITAL_RF_TECH_212F, ··· 647 635 goto done; 648 636 } 649 637 650 - if (ddev->curr_protocol == NFC_PROTO_ISO14443) { 638 + if ((ddev->curr_protocol == NFC_PROTO_ISO14443) || 639 + (ddev->curr_protocol == NFC_PROTO_ISO14443_B)) { 651 640 rc = digital_in_iso_dep_pull_sod(ddev, resp); 652 641 if (rc) 653 642 goto done; ··· 689 676 goto exit; 690 677 } 691 678 692 - if (ddev->curr_protocol == NFC_PROTO_ISO14443) { 679 + if ((ddev->curr_protocol == NFC_PROTO_ISO14443) || 680 + (ddev->curr_protocol == NFC_PROTO_ISO14443_B)) { 693 681 rc = digital_in_iso_dep_push_sod(ddev, skb); 694 682 if (rc) 695 683 goto exit; ··· 761 747 ddev->protocols |= NFC_PROTO_ISO15693_MASK; 762 748 if (supported_protocols & NFC_PROTO_ISO14443_MASK) 763 749 ddev->protocols |= NFC_PROTO_ISO14443_MASK; 750 + if (supported_protocols & NFC_PROTO_ISO14443_B_MASK) 751 + ddev->protocols |= NFC_PROTO_ISO14443_B_MASK; 764 752 765 753 ddev->tx_headroom = tx_headroom + DIGITAL_MAX_HEADER_LEN; 766 754 ddev->tx_tailroom = tx_tailroom + DIGITAL_CRC_LEN;
+228 -2
net/nfc/digital_technology.c
··· 41 41 #define DIGITAL_MIFARE_READ_RES_LEN 16 42 42 #define DIGITAL_MIFARE_ACK_RES 0x0A 43 43 44 + #define DIGITAL_CMD_SENSB_REQ 0x05 45 + #define DIGITAL_SENSB_ADVANCED BIT(5) 46 + #define DIGITAL_SENSB_EXTENDED BIT(4) 47 + #define DIGITAL_SENSB_ALLB_REQ BIT(3) 48 + #define DIGITAL_SENSB_N(n) ((n) & 0x7) 49 + 50 + #define DIGITAL_CMD_SENSB_RES 0x50 51 + 52 + #define DIGITAL_CMD_ATTRIB_REQ 0x1D 53 + #define DIGITAL_ATTRIB_P1_TR0_DEFAULT (0x0 << 6) 54 + #define DIGITAL_ATTRIB_P1_TR1_DEFAULT (0x0 << 4) 55 + #define DIGITAL_ATTRIB_P1_SUPRESS_EOS BIT(3) 56 + #define DIGITAL_ATTRIB_P1_SUPRESS_SOS BIT(2) 57 + #define DIGITAL_ATTRIB_P2_LISTEN_POLL_1 (0x0 << 6) 58 + #define DIGITAL_ATTRIB_P2_POLL_LISTEN_1 (0x0 << 4) 59 + #define DIGITAL_ATTRIB_P2_MAX_FRAME_256 0x8 60 + #define DIGITAL_ATTRIB_P4_DID(n) ((n) & 0xf) 61 + 44 62 #define DIGITAL_CMD_SENSF_REQ 0x00 45 63 #define DIGITAL_CMD_SENSF_RES 0x01 46 64 ··· 93 75 }; 94 76 95 77 #define DIGITAL_ATS_FSCI(t0) ((t0) & 0x0F) 78 + #define DIGITAL_SENSB_FSCI(pi2) (((pi2) & 0xF0) >> 4) 96 79 #define DIGITAL_ATS_MAX_FSC 256 97 80 98 81 #define DIGITAL_RATS_BYTE1 0xE0 ··· 109 90 u8 b2; 110 91 u8 nfcid1[4]; 111 92 u8 bcc; 93 + } __packed; 94 + 95 + struct digital_sensb_req { 96 + u8 cmd; 97 + u8 afi; 98 + u8 param; 99 + } __packed; 100 + 101 + struct digital_sensb_res { 102 + u8 cmd; 103 + u8 nfcid0[4]; 104 + u8 app_data[4]; 105 + u8 proto_info[3]; 106 + } __packed; 107 + 108 + struct digital_attrib_req { 109 + u8 cmd; 110 + u8 nfcid0[4]; 111 + u8 param1; 112 + u8 param2; 113 + u8 param3; 114 + u8 param4; 115 + } __packed; 116 + 117 + struct digital_attrib_res { 118 + u8 mbli_did; 112 119 } __packed; 113 120 114 121 struct digital_sensf_req { ··· 576 531 return -EIO; 577 532 } 578 533 534 + static void digital_in_recv_attrib_res(struct nfc_digital_dev *ddev, void *arg, 535 + struct sk_buff *resp) 536 + { 537 + struct nfc_target *target = arg; 538 + struct digital_attrib_res *attrib_res; 539 + int rc; 540 + 541 + if (IS_ERR(resp)) { 542 + rc = PTR_ERR(resp); 543 + resp = NULL; 544 + goto exit; 545 + } 546 + 547 + if (resp->len < sizeof(*attrib_res)) { 548 + PROTOCOL_ERR("12.6.2"); 549 + rc = -EIO; 550 + goto exit; 551 + } 552 + 553 + attrib_res = (struct digital_attrib_res *)resp->data; 554 + 555 + if (attrib_res->mbli_did & 0x0f) { 556 + PROTOCOL_ERR("12.6.2.1"); 557 + rc = -EIO; 558 + goto exit; 559 + } 560 + 561 + rc = digital_target_found(ddev, target, NFC_PROTO_ISO14443_B); 562 + 563 + exit: 564 + dev_kfree_skb(resp); 565 + kfree(target); 566 + 567 + if (rc) 568 + digital_poll_next_tech(ddev); 569 + } 570 + 571 + int digital_in_send_attrib_req(struct nfc_digital_dev *ddev, 572 + struct nfc_target *target, 573 + struct digital_sensb_res *sensb_res) 574 + { 575 + struct digital_attrib_req *attrib_req; 576 + struct sk_buff *skb; 577 + int rc; 578 + 579 + skb = digital_skb_alloc(ddev, sizeof(*attrib_req)); 580 + if (!skb) 581 + return -ENOMEM; 582 + 583 + attrib_req = (struct digital_attrib_req *)skb_put(skb, 584 + sizeof(*attrib_req)); 585 + 586 + attrib_req->cmd = DIGITAL_CMD_ATTRIB_REQ; 587 + memcpy(attrib_req->nfcid0, sensb_res->nfcid0, 588 + sizeof(attrib_req->nfcid0)); 589 + attrib_req->param1 = DIGITAL_ATTRIB_P1_TR0_DEFAULT | 590 + DIGITAL_ATTRIB_P1_TR1_DEFAULT; 591 + attrib_req->param2 = DIGITAL_ATTRIB_P2_LISTEN_POLL_1 | 592 + DIGITAL_ATTRIB_P2_POLL_LISTEN_1 | 593 + DIGITAL_ATTRIB_P2_MAX_FRAME_256; 594 + attrib_req->param3 = sensb_res->proto_info[1] & 0x07; 595 + attrib_req->param4 = DIGITAL_ATTRIB_P4_DID(0); 596 + 597 + rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_attrib_res, 598 + target); 599 + if (rc) 600 + kfree_skb(skb); 601 + 602 + return rc; 603 + } 604 + 605 + static void digital_in_recv_sensb_res(struct nfc_digital_dev *ddev, void *arg, 606 + struct sk_buff *resp) 607 + { 608 + struct nfc_target *target = NULL; 609 + struct digital_sensb_res *sensb_res; 610 + u8 fsci; 611 + int rc; 612 + 613 + if (IS_ERR(resp)) { 614 + rc = PTR_ERR(resp); 615 + resp = NULL; 616 + goto exit; 617 + } 618 + 619 + if (resp->len != sizeof(*sensb_res)) { 620 + PROTOCOL_ERR("5.6.2.1"); 621 + rc = -EIO; 622 + goto exit; 623 + } 624 + 625 + sensb_res = (struct digital_sensb_res *)resp->data; 626 + 627 + if (sensb_res->cmd != DIGITAL_CMD_SENSB_RES) { 628 + PROTOCOL_ERR("5.6.2"); 629 + rc = -EIO; 630 + goto exit; 631 + } 632 + 633 + if (!(sensb_res->proto_info[1] & BIT(0))) { 634 + PROTOCOL_ERR("5.6.2.12"); 635 + rc = -EIO; 636 + goto exit; 637 + } 638 + 639 + if (sensb_res->proto_info[1] & BIT(3)) { 640 + PROTOCOL_ERR("5.6.2.16"); 641 + rc = -EIO; 642 + goto exit; 643 + } 644 + 645 + fsci = DIGITAL_SENSB_FSCI(sensb_res->proto_info[1]); 646 + if (fsci >= 8) 647 + ddev->target_fsc = DIGITAL_ATS_MAX_FSC; 648 + else 649 + ddev->target_fsc = digital_ats_fsc[fsci]; 650 + 651 + target = kzalloc(sizeof(struct nfc_target), GFP_KERNEL); 652 + if (!target) { 653 + rc = -ENOMEM; 654 + goto exit; 655 + } 656 + 657 + rc = digital_in_send_attrib_req(ddev, target, sensb_res); 658 + 659 + exit: 660 + dev_kfree_skb(resp); 661 + 662 + if (rc) { 663 + kfree(target); 664 + digital_poll_next_tech(ddev); 665 + } 666 + } 667 + 668 + int digital_in_send_sensb_req(struct nfc_digital_dev *ddev, u8 rf_tech) 669 + { 670 + struct digital_sensb_req *sensb_req; 671 + struct sk_buff *skb; 672 + int rc; 673 + 674 + rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH, 675 + NFC_DIGITAL_RF_TECH_106B); 676 + if (rc) 677 + return rc; 678 + 679 + rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING, 680 + NFC_DIGITAL_FRAMING_NFCB); 681 + if (rc) 682 + return rc; 683 + 684 + skb = digital_skb_alloc(ddev, sizeof(*sensb_req)); 685 + if (!skb) 686 + return -ENOMEM; 687 + 688 + sensb_req = (struct digital_sensb_req *)skb_put(skb, 689 + sizeof(*sensb_req)); 690 + 691 + sensb_req->cmd = DIGITAL_CMD_SENSB_REQ; 692 + sensb_req->afi = 0x00; /* All families and sub-families */ 693 + sensb_req->param = DIGITAL_SENSB_N(0); 694 + 695 + rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sensb_res, 696 + NULL); 697 + if (rc) 698 + kfree_skb(skb); 699 + 700 + return rc; 701 + } 702 + 579 703 static void digital_in_recv_sensf_res(struct nfc_digital_dev *ddev, void *arg, 580 704 struct sk_buff *resp) 581 705 { ··· 1091 877 dev_kfree_skb(resp); 1092 878 } 1093 879 880 + static void digital_tg_recv_atr_or_sensf_req(struct nfc_digital_dev *ddev, 881 + void *arg, struct sk_buff *resp) 882 + { 883 + if (!IS_ERR(resp) && (resp->len >= 2) && 884 + (resp->data[1] == DIGITAL_CMD_SENSF_REQ)) 885 + digital_tg_recv_sensf_req(ddev, arg, resp); 886 + else 887 + digital_tg_recv_atr_req(ddev, arg, resp); 888 + 889 + return; 890 + } 891 + 1094 892 static int digital_tg_send_sensf_res(struct nfc_digital_dev *ddev, 1095 893 struct digital_sensf_req *sensf_req) 1096 894 { ··· 1113 887 1114 888 size = sizeof(struct digital_sensf_res); 1115 889 1116 - if (sensf_req->rc != DIGITAL_SENSF_REQ_RC_NONE) 890 + if (sensf_req->rc == DIGITAL_SENSF_REQ_RC_NONE) 1117 891 size -= sizeof(sensf_res->rd); 1118 892 1119 893 skb = digital_skb_alloc(ddev, size); ··· 1148 922 digital_skb_add_crc_f(skb); 1149 923 1150 924 rc = digital_tg_send_cmd(ddev, skb, 300, 1151 - digital_tg_recv_atr_req, NULL); 925 + digital_tg_recv_atr_or_sensf_req, NULL); 1152 926 if (rc) 1153 927 kfree_skb(skb); 1154 928
+4 -2
net/nfc/hci/command.c
··· 26 26 27 27 #include "hci.h" 28 28 29 + #define MAX_FWI 4949 30 + 29 31 static int nfc_hci_execute_cmd_async(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd, 30 32 const u8 *param, size_t param_len, 31 33 data_exchange_cb_t cb, void *cb_context) ··· 39 37 * for all commands? 40 38 */ 41 39 return nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_COMMAND, cmd, 42 - param, param_len, cb, cb_context, 3000); 40 + param, param_len, cb, cb_context, MAX_FWI); 43 41 } 44 42 45 43 /* ··· 84 82 NFC_HCI_HCP_COMMAND, cmd, 85 83 param, param_len, 86 84 nfc_hci_execute_cb, &hcp_ew, 87 - 3000); 85 + MAX_FWI); 88 86 if (hcp_ew.exec_result < 0) 89 87 return hcp_ew.exec_result; 90 88
+22 -25
net/nfc/hci/core.c
··· 225 225 goto exit; 226 226 } 227 227 228 - targets->sens_res = be16_to_cpu(*(u16 *)atqa_skb->data); 228 + targets->sens_res = be16_to_cpu(*(__be16 *)atqa_skb->data); 229 229 targets->sel_res = sak_skb->data[0]; 230 230 231 231 r = nfc_hci_get_param(hdev, NFC_HCI_RF_READER_A_GATE, ··· 380 380 if (r < 0) 381 381 goto disconnect_all; 382 382 383 - if (skb->len && skb->len == strlen(hdev->init_data.session_id)) 384 - if (memcmp(hdev->init_data.session_id, skb->data, 385 - skb->len) == 0) { 386 - /* TODO ELa: restore gate<->pipe table from 387 - * some TBD location. 388 - * note: it doesn't seem possible to get the chip 389 - * currently open gate/pipe table. 390 - * It is only possible to obtain the supported 391 - * gate list. 392 - */ 383 + if (skb->len && skb->len == strlen(hdev->init_data.session_id) && 384 + (memcmp(hdev->init_data.session_id, skb->data, 385 + skb->len) == 0) && hdev->ops->load_session) { 386 + /* Restore gate<->pipe table from some proprietary location. */ 393 387 394 - /* goto exit 395 - * For now, always do a full initialization */ 396 - } 388 + r = hdev->ops->load_session(hdev); 397 389 398 - r = nfc_hci_disconnect_all_gates(hdev); 399 - if (r < 0) 400 - goto exit; 390 + if (r < 0) 391 + goto disconnect_all; 392 + } else { 401 393 402 - r = hci_dev_connect_gates(hdev, hdev->init_data.gate_count, 403 - hdev->init_data.gates); 404 - if (r < 0) 405 - goto disconnect_all; 394 + r = nfc_hci_disconnect_all_gates(hdev); 395 + if (r < 0) 396 + goto exit; 406 397 407 - r = nfc_hci_set_param(hdev, NFC_HCI_ADMIN_GATE, 408 - NFC_HCI_ADMIN_SESSION_IDENTITY, 409 - hdev->init_data.session_id, 410 - strlen(hdev->init_data.session_id)); 398 + r = hci_dev_connect_gates(hdev, hdev->init_data.gate_count, 399 + hdev->init_data.gates); 400 + if (r < 0) 401 + goto disconnect_all; 402 + 403 + r = nfc_hci_set_param(hdev, NFC_HCI_ADMIN_GATE, 404 + NFC_HCI_ADMIN_SESSION_IDENTITY, 405 + hdev->init_data.session_id, 406 + strlen(hdev->init_data.session_id)); 407 + } 411 408 if (r == 0) 412 409 goto exit; 413 410
+1 -1
net/nfc/llcp_commands.c
··· 387 387 388 388 __net_timestamp(skb); 389 389 390 - nfc_llcp_send_to_raw_sock(local, skb, NFC_LLCP_DIRECTION_TX); 390 + nfc_llcp_send_to_raw_sock(local, skb, NFC_DIRECTION_TX); 391 391 392 392 return nfc_data_exchange(dev, local->target_idx, skb, 393 393 nfc_llcp_recv, local);
+6 -5
net/nfc/llcp_core.c
··· 680 680 continue; 681 681 682 682 if (skb_copy == NULL) { 683 - skb_copy = __pskb_copy(skb, NFC_LLCP_RAW_HEADER_SIZE, 683 + skb_copy = __pskb_copy(skb, NFC_RAW_HEADER_SIZE, 684 684 GFP_ATOMIC); 685 685 686 686 if (skb_copy == NULL) 687 687 continue; 688 688 689 - data = skb_push(skb_copy, NFC_LLCP_RAW_HEADER_SIZE); 689 + data = skb_push(skb_copy, NFC_RAW_HEADER_SIZE); 690 690 691 691 data[0] = local->dev ? local->dev->idx : 0xFF; 692 - data[1] = direction; 692 + data[1] = direction & 0x01; 693 + data[1] |= (RAW_PAYLOAD_LLCP << 1); 693 694 } 694 695 695 696 nskb = skb_clone(skb_copy, GFP_ATOMIC); ··· 748 747 __net_timestamp(skb); 749 748 750 749 nfc_llcp_send_to_raw_sock(local, skb, 751 - NFC_LLCP_DIRECTION_TX); 750 + NFC_DIRECTION_TX); 752 751 753 752 ret = nfc_data_exchange(local->dev, local->target_idx, 754 753 skb, nfc_llcp_recv, local); ··· 1477 1476 1478 1477 __net_timestamp(skb); 1479 1478 1480 - nfc_llcp_send_to_raw_sock(local, skb, NFC_LLCP_DIRECTION_RX); 1479 + nfc_llcp_send_to_raw_sock(local, skb, NFC_DIRECTION_RX); 1481 1480 1482 1481 nfc_llcp_rx_skb(local, skb); 1483 1482
+9
net/nfc/nci/core.c
··· 861 861 /* Get rid of skb owner, prior to sending to the driver. */ 862 862 skb_orphan(skb); 863 863 864 + /* Send copy to sniffer */ 865 + nfc_send_to_raw_sock(ndev->nfc_dev, skb, 866 + RAW_PAYLOAD_NCI, NFC_DIRECTION_TX); 867 + 864 868 return ndev->ops->send(ndev, skb); 865 869 } 866 870 ··· 939 935 struct sk_buff *skb; 940 936 941 937 while ((skb = skb_dequeue(&ndev->rx_q))) { 938 + 939 + /* Send copy to sniffer */ 940 + nfc_send_to_raw_sock(ndev->nfc_dev, skb, 941 + RAW_PAYLOAD_NCI, NFC_DIRECTION_RX); 942 + 942 943 /* Process frame */ 943 944 switch (nci_mt(skb->data)) { 944 945 case NCI_MT_RSP_PKT:
+2 -5
net/nfc/nci/ntf.c
··· 366 366 struct nci_rf_intf_activated_ntf *ntf, __u8 *data) 367 367 { 368 368 struct activation_params_poll_nfc_dep *poll; 369 - int i; 370 369 371 370 switch (ntf->activation_rf_tech_and_mode) { 372 371 case NCI_NFC_A_PASSIVE_POLL_MODE: ··· 373 374 poll = &ntf->activation_params.poll_nfc_dep; 374 375 poll->atr_res_len = min_t(__u8, *data++, 63); 375 376 pr_debug("atr_res_len %d\n", poll->atr_res_len); 376 - if (poll->atr_res_len > 0) { 377 - for (i = 0; i < poll->atr_res_len; i++) 378 - poll->atr_res[poll->atr_res_len-1-i] = data[i]; 379 - } 377 + if (poll->atr_res_len > 0) 378 + memcpy(poll->atr_res, data, poll->atr_res_len); 380 379 break; 381 380 382 381 default:
+6
net/nfc/nfc.h
··· 40 40 struct work_struct tx_work; 41 41 bool tx_work_scheduled; 42 42 }; 43 + 44 + struct nfc_sock_list { 45 + struct hlist_head head; 46 + rwlock_t lock; 47 + }; 48 + 43 49 #define nfc_rawsock(sk) ((struct nfc_rawsock *) sk) 44 50 #define to_rawsock_sk(_tx_work) \ 45 51 ((struct sock *) container_of(_tx_work, struct nfc_rawsock, tx_work))
+89 -5
net/nfc/rawsock.c
··· 27 27 28 28 #include "nfc.h" 29 29 30 + static struct nfc_sock_list raw_sk_list = { 31 + .lock = __RW_LOCK_UNLOCKED(raw_sk_list.lock) 32 + }; 33 + 34 + void nfc_sock_link(struct nfc_sock_list *l, struct sock *sk) 35 + { 36 + write_lock(&l->lock); 37 + sk_add_node(sk, &l->head); 38 + write_unlock(&l->lock); 39 + } 40 + 41 + void nfc_sock_unlink(struct nfc_sock_list *l, struct sock *sk) 42 + { 43 + write_lock(&l->lock); 44 + sk_del_node_init(sk); 45 + write_unlock(&l->lock); 46 + } 47 + 30 48 static void rawsock_write_queue_purge(struct sock *sk) 31 49 { 32 50 pr_debug("sk=%p\n", sk); ··· 74 56 75 57 if (!sk) 76 58 return 0; 59 + 60 + if (sock->type == SOCK_RAW) 61 + nfc_sock_unlink(&raw_sk_list, sk); 77 62 78 63 sock_orphan(sk); 79 64 sock_put(sk); ··· 296 275 .mmap = sock_no_mmap, 297 276 }; 298 277 278 + static const struct proto_ops rawsock_raw_ops = { 279 + .family = PF_NFC, 280 + .owner = THIS_MODULE, 281 + .release = rawsock_release, 282 + .bind = sock_no_bind, 283 + .connect = sock_no_connect, 284 + .socketpair = sock_no_socketpair, 285 + .accept = sock_no_accept, 286 + .getname = sock_no_getname, 287 + .poll = datagram_poll, 288 + .ioctl = sock_no_ioctl, 289 + .listen = sock_no_listen, 290 + .shutdown = sock_no_shutdown, 291 + .setsockopt = sock_no_setsockopt, 292 + .getsockopt = sock_no_getsockopt, 293 + .sendmsg = sock_no_sendmsg, 294 + .recvmsg = rawsock_recvmsg, 295 + .mmap = sock_no_mmap, 296 + }; 297 + 299 298 static void rawsock_destruct(struct sock *sk) 300 299 { 301 300 pr_debug("sk=%p\n", sk); ··· 341 300 342 301 pr_debug("sock=%p\n", sock); 343 302 344 - if (sock->type != SOCK_SEQPACKET) 303 + if ((sock->type != SOCK_SEQPACKET) && (sock->type != SOCK_RAW)) 345 304 return -ESOCKTNOSUPPORT; 346 305 347 - sock->ops = &rawsock_ops; 306 + if (sock->type == SOCK_RAW) 307 + sock->ops = &rawsock_raw_ops; 308 + else 309 + sock->ops = &rawsock_ops; 348 310 349 311 sk = sk_alloc(net, PF_NFC, GFP_ATOMIC, nfc_proto->proto); 350 312 if (!sk) ··· 357 313 sk->sk_protocol = nfc_proto->id; 358 314 sk->sk_destruct = rawsock_destruct; 359 315 sock->state = SS_UNCONNECTED; 360 - 361 - INIT_WORK(&nfc_rawsock(sk)->tx_work, rawsock_tx_work); 362 - nfc_rawsock(sk)->tx_work_scheduled = false; 316 + if (sock->type == SOCK_RAW) 317 + nfc_sock_link(&raw_sk_list, sk); 318 + else { 319 + INIT_WORK(&nfc_rawsock(sk)->tx_work, rawsock_tx_work); 320 + nfc_rawsock(sk)->tx_work_scheduled = false; 321 + } 363 322 364 323 return 0; 365 324 } 325 + 326 + void nfc_send_to_raw_sock(struct nfc_dev *dev, struct sk_buff *skb, 327 + u8 payload_type, u8 direction) 328 + { 329 + struct sk_buff *skb_copy = NULL, *nskb; 330 + struct sock *sk; 331 + u8 *data; 332 + 333 + read_lock(&raw_sk_list.lock); 334 + 335 + sk_for_each(sk, &raw_sk_list.head) { 336 + if (!skb_copy) { 337 + skb_copy = __pskb_copy(skb, NFC_RAW_HEADER_SIZE, 338 + GFP_ATOMIC); 339 + if (!skb_copy) 340 + continue; 341 + 342 + data = skb_push(skb_copy, NFC_RAW_HEADER_SIZE); 343 + 344 + data[0] = dev ? dev->idx : 0xFF; 345 + data[1] = direction & 0x01; 346 + data[1] |= (payload_type << 1); 347 + } 348 + 349 + nskb = skb_clone(skb_copy, GFP_ATOMIC); 350 + if (!nskb) 351 + continue; 352 + 353 + if (sock_queue_rcv_skb(sk, nskb)) 354 + kfree_skb(nskb); 355 + } 356 + 357 + read_unlock(&raw_sk_list.lock); 358 + 359 + kfree_skb(skb_copy); 360 + } 361 + EXPORT_SYMBOL(nfc_send_to_raw_sock); 366 362 367 363 static struct proto rawsock_proto = { 368 364 .name = "NFC_RAW",
+17 -42
net/rfkill/rfkill-gpio.c
··· 36 36 struct gpio_desc *shutdown_gpio; 37 37 38 38 struct rfkill *rfkill_dev; 39 - char *reset_name; 40 - char *shutdown_name; 41 39 struct clk *clk; 42 40 43 41 bool clk_enabled; ··· 45 47 { 46 48 struct rfkill_gpio_data *rfkill = data; 47 49 48 - if (blocked) { 49 - gpiod_set_value(rfkill->shutdown_gpio, 0); 50 - gpiod_set_value(rfkill->reset_gpio, 0); 51 - if (!IS_ERR(rfkill->clk) && rfkill->clk_enabled) 52 - clk_disable(rfkill->clk); 53 - } else { 54 - if (!IS_ERR(rfkill->clk) && !rfkill->clk_enabled) 55 - clk_enable(rfkill->clk); 56 - gpiod_set_value(rfkill->reset_gpio, 1); 57 - gpiod_set_value(rfkill->shutdown_gpio, 1); 58 - } 50 + if (!blocked && !IS_ERR(rfkill->clk) && !rfkill->clk_enabled) 51 + clk_enable(rfkill->clk); 52 + 53 + gpiod_set_value_cansleep(rfkill->shutdown_gpio, !blocked); 54 + gpiod_set_value_cansleep(rfkill->reset_gpio, !blocked); 55 + 56 + if (blocked && !IS_ERR(rfkill->clk) && rfkill->clk_enabled) 57 + clk_disable(rfkill->clk); 59 58 60 59 rfkill->clk_enabled = blocked; 61 60 ··· 82 87 { 83 88 struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data; 84 89 struct rfkill_gpio_data *rfkill; 85 - const char *clk_name = NULL; 86 90 struct gpio_desc *gpio; 87 91 int ret; 88 - int len; 89 92 90 93 rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL); 91 94 if (!rfkill) ··· 94 101 if (ret) 95 102 return ret; 96 103 } else if (pdata) { 97 - clk_name = pdata->power_clk_name; 98 104 rfkill->name = pdata->name; 99 105 rfkill->type = pdata->type; 100 106 } else { 101 107 return -ENODEV; 102 108 } 103 109 104 - len = strlen(rfkill->name); 105 - rfkill->reset_name = devm_kzalloc(&pdev->dev, len + 7, GFP_KERNEL); 106 - if (!rfkill->reset_name) 107 - return -ENOMEM; 110 + rfkill->clk = devm_clk_get(&pdev->dev, NULL); 108 111 109 - rfkill->shutdown_name = devm_kzalloc(&pdev->dev, len + 10, GFP_KERNEL); 110 - if (!rfkill->shutdown_name) 111 - return -ENOMEM; 112 - 113 - snprintf(rfkill->reset_name, len + 6 , "%s_reset", rfkill->name); 114 - snprintf(rfkill->shutdown_name, len + 9, "%s_shutdown", rfkill->name); 115 - 116 - rfkill->clk = devm_clk_get(&pdev->dev, clk_name); 117 - 118 - gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0); 112 + gpio = devm_gpiod_get_index(&pdev->dev, "reset", 0); 119 113 if (!IS_ERR(gpio)) { 120 114 ret = gpiod_direction_output(gpio, 0); 121 115 if (ret) ··· 110 130 rfkill->reset_gpio = gpio; 111 131 } 112 132 113 - gpio = devm_gpiod_get_index(&pdev->dev, rfkill->shutdown_name, 1); 133 + gpio = devm_gpiod_get_index(&pdev->dev, "shutdown", 1); 114 134 if (!IS_ERR(gpio)) { 115 135 ret = gpiod_direction_output(gpio, 0); 116 136 if (ret) ··· 124 144 if ((!rfkill->reset_gpio && !rfkill->shutdown_gpio) || !rfkill->name) { 125 145 dev_err(&pdev->dev, "invalid platform data\n"); 126 146 return -EINVAL; 127 - } 128 - 129 - if (pdata && pdata->gpio_runtime_setup) { 130 - ret = pdata->gpio_runtime_setup(pdev); 131 - if (ret) { 132 - dev_err(&pdev->dev, "can't set up gpio\n"); 133 - return ret; 134 - } 135 147 } 136 148 137 149 rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev, ··· 146 174 static int rfkill_gpio_remove(struct platform_device *pdev) 147 175 { 148 176 struct rfkill_gpio_data *rfkill = platform_get_drvdata(pdev); 149 - struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data; 150 177 151 - if (pdata && pdata->gpio_runtime_close) 152 - pdata->gpio_runtime_close(pdev); 153 178 rfkill_unregister(rfkill->rfkill_dev); 154 179 rfkill_destroy(rfkill->rfkill_dev); 155 180 156 181 return 0; 157 182 } 158 183 184 + #ifdef CONFIG_ACPI 159 185 static const struct acpi_device_id rfkill_acpi_match[] = { 186 + { "BCM2E1A", RFKILL_TYPE_BLUETOOTH }, 187 + { "BCM2E39", RFKILL_TYPE_BLUETOOTH }, 188 + { "BCM2E3D", RFKILL_TYPE_BLUETOOTH }, 160 189 { "BCM4752", RFKILL_TYPE_GPS }, 190 + { "LNV4752", RFKILL_TYPE_GPS }, 161 191 { }, 162 192 }; 193 + #endif 163 194 164 195 static struct platform_driver rfkill_gpio_driver = { 165 196 .probe = rfkill_gpio_probe,
+2 -2
net/wireless/ap.c
··· 6 6 #include "rdev-ops.h" 7 7 8 8 9 - static int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev, 10 - struct net_device *dev, bool notify) 9 + int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev, 10 + struct net_device *dev, bool notify) 11 11 { 12 12 struct wireless_dev *wdev = dev->ieee80211_ptr; 13 13 int err;
+2 -3
net/wireless/chan.c
··· 370 370 case NL80211_IFTYPE_AP_VLAN: 371 371 case NL80211_IFTYPE_WDS: 372 372 case NL80211_IFTYPE_P2P_DEVICE: 373 - case NL80211_IFTYPE_UNSPECIFIED: 374 373 break; 374 + case NL80211_IFTYPE_UNSPECIFIED: 375 375 case NUM_NL80211_IFTYPES: 376 376 WARN_ON(1); 377 377 } ··· 796 796 !cfg80211_go_permissive_chan(rdev, chandef->chan)) 797 797 prohibited_flags |= IEEE80211_CHAN_NO_IR; 798 798 799 - if (cfg80211_chandef_dfs_required(wiphy, chandef, 800 - NL80211_IFTYPE_UNSPECIFIED) > 0 && 799 + if (cfg80211_chandef_dfs_required(wiphy, chandef, iftype) > 0 && 801 800 cfg80211_chandef_dfs_available(wiphy, chandef)) { 802 801 /* We can skip IEEE80211_CHAN_NO_IR if chandef dfs available */ 803 802 prohibited_flags = IEEE80211_CHAN_DISABLED;
+53 -14
net/wireless/core.c
··· 210 210 } 211 211 } 212 212 213 - static int cfg80211_rfkill_set_block(void *data, bool blocked) 213 + void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy) 214 214 { 215 - struct cfg80211_registered_device *rdev = data; 215 + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); 216 216 struct wireless_dev *wdev; 217 217 218 - if (!blocked) 219 - return 0; 220 - 221 - rtnl_lock(); 218 + ASSERT_RTNL(); 222 219 223 220 list_for_each_entry(wdev, &rdev->wdev_list, list) { 224 221 if (wdev->netdev) { ··· 231 234 break; 232 235 } 233 236 } 237 + } 238 + EXPORT_SYMBOL_GPL(cfg80211_shutdown_all_interfaces); 234 239 240 + static int cfg80211_rfkill_set_block(void *data, bool blocked) 241 + { 242 + struct cfg80211_registered_device *rdev = data; 243 + 244 + if (!blocked) 245 + return 0; 246 + 247 + rtnl_lock(); 248 + cfg80211_shutdown_all_interfaces(&rdev->wiphy); 235 249 rtnl_unlock(); 236 250 237 251 return 0; ··· 401 393 rdev->wiphy.frag_threshold = (u32) -1; 402 394 rdev->wiphy.rts_threshold = (u32) -1; 403 395 rdev->wiphy.coverage_class = 0; 396 + 397 + rdev->wiphy.max_num_csa_counters = 1; 404 398 405 399 return &rdev->wiphy; 406 400 } ··· 700 690 rtnl_lock(); 701 691 rdev->wiphy.registered = false; 702 692 703 - BUG_ON(!list_empty(&rdev->wdev_list)); 693 + WARN_ON(!list_empty(&rdev->wdev_list)); 704 694 705 695 /* 706 696 * First remove the hardware from everywhere, this makes ··· 802 792 rdev->num_running_monitor_ifaces += num; 803 793 } 804 794 805 - void cfg80211_leave(struct cfg80211_registered_device *rdev, 806 - struct wireless_dev *wdev) 795 + void __cfg80211_leave(struct cfg80211_registered_device *rdev, 796 + struct wireless_dev *wdev) 807 797 { 808 798 struct net_device *dev = wdev->netdev; 809 799 810 800 ASSERT_RTNL(); 801 + ASSERT_WDEV_LOCK(wdev); 811 802 812 803 switch (wdev->iftype) { 813 804 case NL80211_IFTYPE_ADHOC: 814 - cfg80211_leave_ibss(rdev, dev, true); 805 + __cfg80211_leave_ibss(rdev, dev, true); 815 806 break; 816 807 case NL80211_IFTYPE_P2P_CLIENT: 817 808 case NL80211_IFTYPE_STATION: 818 809 if (rdev->sched_scan_req && dev == rdev->sched_scan_req->dev) 819 810 __cfg80211_stop_sched_scan(rdev, false); 820 811 821 - wdev_lock(wdev); 822 812 #ifdef CONFIG_CFG80211_WEXT 823 813 kfree(wdev->wext.ie); 824 814 wdev->wext.ie = NULL; ··· 827 817 #endif 828 818 cfg80211_disconnect(rdev, dev, 829 819 WLAN_REASON_DEAUTH_LEAVING, true); 830 - wdev_unlock(wdev); 831 820 break; 832 821 case NL80211_IFTYPE_MESH_POINT: 833 - cfg80211_leave_mesh(rdev, dev); 822 + __cfg80211_leave_mesh(rdev, dev); 834 823 break; 835 824 case NL80211_IFTYPE_AP: 836 825 case NL80211_IFTYPE_P2P_GO: 837 - cfg80211_stop_ap(rdev, dev, true); 826 + __cfg80211_stop_ap(rdev, dev, true); 838 827 break; 839 828 default: 840 829 break; 841 830 } 842 831 } 832 + 833 + void cfg80211_leave(struct cfg80211_registered_device *rdev, 834 + struct wireless_dev *wdev) 835 + { 836 + wdev_lock(wdev); 837 + __cfg80211_leave(rdev, wdev); 838 + wdev_unlock(wdev); 839 + } 840 + 841 + void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 842 + gfp_t gfp) 843 + { 844 + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); 845 + struct cfg80211_event *ev; 846 + unsigned long flags; 847 + 848 + trace_cfg80211_stop_iface(wiphy, wdev); 849 + 850 + ev = kzalloc(sizeof(*ev), gfp); 851 + if (!ev) 852 + return; 853 + 854 + ev->type = EVENT_STOPPED; 855 + 856 + spin_lock_irqsave(&wdev->event_lock, flags); 857 + list_add_tail(&ev->list, &wdev->event_list); 858 + spin_unlock_irqrestore(&wdev->event_lock, flags); 859 + queue_work(cfg80211_wq, &rdev->event_work); 860 + } 861 + EXPORT_SYMBOL(cfg80211_stop_iface); 843 862 844 863 static int cfg80211_netdev_notifier_call(struct notifier_block *nb, 845 864 unsigned long state, void *ptr)
+7
net/wireless/core.h
··· 185 185 EVENT_ROAMED, 186 186 EVENT_DISCONNECTED, 187 187 EVENT_IBSS_JOINED, 188 + EVENT_STOPPED, 188 189 }; 189 190 190 191 struct cfg80211_event { ··· 282 281 struct net_device *dev, 283 282 struct mesh_setup *setup, 284 283 const struct mesh_config *conf); 284 + int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, 285 + struct net_device *dev); 285 286 int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, 286 287 struct net_device *dev); 287 288 int cfg80211_set_mesh_channel(struct cfg80211_registered_device *rdev, ··· 291 288 struct cfg80211_chan_def *chandef); 292 289 293 290 /* AP */ 291 + int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev, 292 + struct net_device *dev, bool notify); 294 293 int cfg80211_stop_ap(struct cfg80211_registered_device *rdev, 295 294 struct net_device *dev, bool notify); 296 295 ··· 446 441 void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev, 447 442 enum nl80211_iftype iftype, int num); 448 443 444 + void __cfg80211_leave(struct cfg80211_registered_device *rdev, 445 + struct wireless_dev *wdev); 449 446 void cfg80211_leave(struct cfg80211_registered_device *rdev, 450 447 struct wireless_dev *wdev); 451 448
+1 -1
net/wireless/ibss.c
··· 420 420 if (len > 0 && ssid[len - 1] == '\0') 421 421 len--; 422 422 423 + memcpy(wdev->ssid, ssid, len); 423 424 wdev->wext.ibss.ssid = wdev->ssid; 424 - memcpy(wdev->wext.ibss.ssid, ssid, len); 425 425 wdev->wext.ibss.ssid_len = len; 426 426 427 427 wdev_lock(wdev);
+2 -2
net/wireless/mesh.c
··· 238 238 return 0; 239 239 } 240 240 241 - static int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, 242 - struct net_device *dev) 241 + int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, 242 + struct net_device *dev) 243 243 { 244 244 struct wireless_dev *wdev = dev->ieee80211_ptr; 245 245 int err;
+104 -36
net/wireless/nl80211.c
··· 371 371 [NL80211_ATTR_CH_SWITCH_COUNT] = { .type = NLA_U32 }, 372 372 [NL80211_ATTR_CH_SWITCH_BLOCK_TX] = { .type = NLA_FLAG }, 373 373 [NL80211_ATTR_CSA_IES] = { .type = NLA_NESTED }, 374 - [NL80211_ATTR_CSA_C_OFF_BEACON] = { .type = NLA_U16 }, 375 - [NL80211_ATTR_CSA_C_OFF_PRESP] = { .type = NLA_U16 }, 374 + [NL80211_ATTR_CSA_C_OFF_BEACON] = { .type = NLA_BINARY }, 375 + [NL80211_ATTR_CSA_C_OFF_PRESP] = { .type = NLA_BINARY }, 376 376 [NL80211_ATTR_STA_SUPPORTED_CHANNELS] = { .type = NLA_BINARY }, 377 377 [NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES] = { .type = NLA_BINARY }, 378 378 [NL80211_ATTR_HANDLE_DFS] = { .type = NLA_FLAG }, ··· 386 386 [NL80211_ATTR_WIPHY_FREQ_HINT] = { .type = NLA_U32 }, 387 387 [NL80211_ATTR_TDLS_PEER_CAPABILITY] = { .type = NLA_U32 }, 388 388 [NL80211_ATTR_IFACE_SOCKET_OWNER] = { .type = NLA_FLAG }, 389 + [NL80211_ATTR_CSA_C_OFFSETS_TX] = { .type = NLA_BINARY }, 389 390 }; 390 391 391 392 /* policy for the key attributes */ ··· 971 970 c->max_interfaces)) 972 971 goto nla_put_failure; 973 972 if (large && 974 - nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS, 975 - c->radar_detect_widths)) 973 + (nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS, 974 + c->radar_detect_widths) || 975 + nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS, 976 + c->radar_detect_regions))) 976 977 goto nla_put_failure; 977 978 978 979 nla_nest_end(msg, nl_combi); ··· 1670 1667 } 1671 1668 nla_nest_end(msg, nested); 1672 1669 } 1670 + state->split_start++; 1671 + break; 1672 + case 12: 1673 + if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH && 1674 + nla_put_u8(msg, NL80211_ATTR_MAX_CSA_COUNTERS, 1675 + rdev->wiphy.max_num_csa_counters)) 1676 + goto nla_put_failure; 1673 1677 1674 1678 /* done */ 1675 1679 state->split_start = 0; ··· 3649 3639 if ((sinfo->filled & STATION_INFO_TX_FAILED) && 3650 3640 nla_put_u32(msg, NL80211_STA_INFO_TX_FAILED, 3651 3641 sinfo->tx_failed)) 3642 + goto nla_put_failure; 3643 + if ((sinfo->filled & STATION_INFO_EXPECTED_THROUGHPUT) && 3644 + nla_put_u32(msg, NL80211_STA_INFO_EXPECTED_THROUGHPUT, 3645 + sinfo->expected_throughput)) 3652 3646 goto nla_put_failure; 3653 3647 if ((sinfo->filled & STATION_INFO_BEACON_LOSS_COUNT) && 3654 3648 nla_put_u32(msg, NL80211_STA_INFO_BEACON_LOSS, ··· 5834 5820 return -EBUSY; 5835 5821 5836 5822 err = cfg80211_chandef_dfs_required(wdev->wiphy, &chandef, 5837 - NL80211_IFTYPE_UNSPECIFIED); 5823 + wdev->iftype); 5838 5824 if (err < 0) 5839 5825 return err; 5840 5826 ··· 5875 5861 u8 radar_detect_width = 0; 5876 5862 int err; 5877 5863 bool need_new_beacon = false; 5864 + int len, i; 5878 5865 5879 5866 if (!rdev->ops->channel_switch || 5880 5867 !(rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH)) ··· 5934 5919 if (!csa_attrs[NL80211_ATTR_CSA_C_OFF_BEACON]) 5935 5920 return -EINVAL; 5936 5921 5937 - params.counter_offset_beacon = 5938 - nla_get_u16(csa_attrs[NL80211_ATTR_CSA_C_OFF_BEACON]); 5939 - if (params.counter_offset_beacon >= params.beacon_csa.tail_len) 5922 + len = nla_len(csa_attrs[NL80211_ATTR_CSA_C_OFF_BEACON]); 5923 + if (!len || (len % sizeof(u16))) 5940 5924 return -EINVAL; 5941 5925 5942 - /* sanity check - counters should be the same */ 5943 - if (params.beacon_csa.tail[params.counter_offset_beacon] != 5944 - params.count) 5926 + params.n_counter_offsets_beacon = len / sizeof(u16); 5927 + if (rdev->wiphy.max_num_csa_counters && 5928 + (params.n_counter_offsets_beacon > 5929 + rdev->wiphy.max_num_csa_counters)) 5945 5930 return -EINVAL; 5931 + 5932 + params.counter_offsets_beacon = 5933 + nla_data(csa_attrs[NL80211_ATTR_CSA_C_OFF_BEACON]); 5934 + 5935 + /* sanity checks - counters should fit and be the same */ 5936 + for (i = 0; i < params.n_counter_offsets_beacon; i++) { 5937 + u16 offset = params.counter_offsets_beacon[i]; 5938 + 5939 + if (offset >= params.beacon_csa.tail_len) 5940 + return -EINVAL; 5941 + 5942 + if (params.beacon_csa.tail[offset] != params.count) 5943 + return -EINVAL; 5944 + } 5946 5945 5947 5946 if (csa_attrs[NL80211_ATTR_CSA_C_OFF_PRESP]) { 5948 - params.counter_offset_presp = 5949 - nla_get_u16(csa_attrs[NL80211_ATTR_CSA_C_OFF_PRESP]); 5950 - if (params.counter_offset_presp >= 5951 - params.beacon_csa.probe_resp_len) 5947 + len = nla_len(csa_attrs[NL80211_ATTR_CSA_C_OFF_PRESP]); 5948 + if (!len || (len % sizeof(u16))) 5952 5949 return -EINVAL; 5953 5950 5954 - if (params.beacon_csa.probe_resp[params.counter_offset_presp] != 5955 - params.count) 5951 + params.n_counter_offsets_presp = len / sizeof(u16); 5952 + if (rdev->wiphy.max_num_csa_counters && 5953 + (params.n_counter_offsets_beacon > 5954 + rdev->wiphy.max_num_csa_counters)) 5956 5955 return -EINVAL; 5956 + 5957 + params.counter_offsets_presp = 5958 + nla_data(csa_attrs[NL80211_ATTR_CSA_C_OFF_PRESP]); 5959 + 5960 + /* sanity checks - counters should fit and be the same */ 5961 + for (i = 0; i < params.n_counter_offsets_presp; i++) { 5962 + u16 offset = params.counter_offsets_presp[i]; 5963 + 5964 + if (offset >= params.beacon_csa.probe_resp_len) 5965 + return -EINVAL; 5966 + 5967 + if (params.beacon_csa.probe_resp[offset] != 5968 + params.count) 5969 + return -EINVAL; 5970 + } 5957 5971 } 5958 5972 5959 5973 skip_beacons: ··· 7828 7784 if (!chandef.chan && params.offchan) 7829 7785 return -EINVAL; 7830 7786 7787 + params.buf = nla_data(info->attrs[NL80211_ATTR_FRAME]); 7788 + params.len = nla_len(info->attrs[NL80211_ATTR_FRAME]); 7789 + 7790 + if (info->attrs[NL80211_ATTR_CSA_C_OFFSETS_TX]) { 7791 + int len = nla_len(info->attrs[NL80211_ATTR_CSA_C_OFFSETS_TX]); 7792 + int i; 7793 + 7794 + if (len % sizeof(u16)) 7795 + return -EINVAL; 7796 + 7797 + params.n_csa_offsets = len / sizeof(u16); 7798 + params.csa_offsets = 7799 + nla_data(info->attrs[NL80211_ATTR_CSA_C_OFFSETS_TX]); 7800 + 7801 + /* check that all the offsets fit the frame */ 7802 + for (i = 0; i < params.n_csa_offsets; i++) { 7803 + if (params.csa_offsets[i] >= params.len) 7804 + return -EINVAL; 7805 + } 7806 + } 7807 + 7831 7808 if (!params.dont_wait_for_ack) { 7832 7809 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 7833 7810 if (!msg) ··· 7862 7797 } 7863 7798 } 7864 7799 7865 - params.buf = nla_data(info->attrs[NL80211_ATTR_FRAME]); 7866 - params.len = nla_len(info->attrs[NL80211_ATTR_FRAME]); 7867 7800 params.chan = chandef.chan; 7868 7801 err = cfg80211_mlme_mgmt_tx(rdev, wdev, &params, &cookie); 7869 7802 if (err) ··· 8558 8495 8559 8496 nla_for_each_nested(pat, tb[NL80211_WOWLAN_TRIG_PKT_PATTERN], 8560 8497 rem) { 8498 + u8 *mask_pat; 8499 + 8561 8500 nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat), 8562 8501 nla_len(pat), NULL); 8563 8502 err = -EINVAL; ··· 8583 8518 goto error; 8584 8519 new_triggers.patterns[i].pkt_offset = pkt_offset; 8585 8520 8586 - new_triggers.patterns[i].mask = 8587 - kmalloc(mask_len + pat_len, GFP_KERNEL); 8588 - if (!new_triggers.patterns[i].mask) { 8521 + mask_pat = kmalloc(mask_len + pat_len, GFP_KERNEL); 8522 + if (!mask_pat) { 8589 8523 err = -ENOMEM; 8590 8524 goto error; 8591 8525 } 8592 - new_triggers.patterns[i].pattern = 8593 - new_triggers.patterns[i].mask + mask_len; 8594 - memcpy(new_triggers.patterns[i].mask, 8595 - nla_data(pat_tb[NL80211_PKTPAT_MASK]), 8526 + new_triggers.patterns[i].mask = mask_pat; 8527 + memcpy(mask_pat, nla_data(pat_tb[NL80211_PKTPAT_MASK]), 8596 8528 mask_len); 8529 + mask_pat += mask_len; 8530 + new_triggers.patterns[i].pattern = mask_pat; 8597 8531 new_triggers.patterns[i].pattern_len = pat_len; 8598 - memcpy(new_triggers.patterns[i].pattern, 8532 + memcpy(mask_pat, 8599 8533 nla_data(pat_tb[NL80211_PKTPAT_PATTERN]), 8600 8534 pat_len); 8601 8535 i++; ··· 8786 8722 8787 8723 nla_for_each_nested(pat, tb[NL80211_ATTR_COALESCE_RULE_PKT_PATTERN], 8788 8724 rem) { 8725 + u8 *mask_pat; 8726 + 8789 8727 nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat), 8790 8728 nla_len(pat), NULL); 8791 8729 if (!pat_tb[NL80211_PKTPAT_MASK] || ··· 8809 8743 return -EINVAL; 8810 8744 new_rule->patterns[i].pkt_offset = pkt_offset; 8811 8745 8812 - new_rule->patterns[i].mask = 8813 - kmalloc(mask_len + pat_len, GFP_KERNEL); 8814 - if (!new_rule->patterns[i].mask) 8746 + mask_pat = kmalloc(mask_len + pat_len, GFP_KERNEL); 8747 + if (!mask_pat) 8815 8748 return -ENOMEM; 8816 - new_rule->patterns[i].pattern = 8817 - new_rule->patterns[i].mask + mask_len; 8818 - memcpy(new_rule->patterns[i].mask, 8819 - nla_data(pat_tb[NL80211_PKTPAT_MASK]), mask_len); 8749 + 8750 + new_rule->patterns[i].mask = mask_pat; 8751 + memcpy(mask_pat, nla_data(pat_tb[NL80211_PKTPAT_MASK]), 8752 + mask_len); 8753 + 8754 + mask_pat += mask_len; 8755 + new_rule->patterns[i].pattern = mask_pat; 8820 8756 new_rule->patterns[i].pattern_len = pat_len; 8821 - memcpy(new_rule->patterns[i].pattern, 8822 - nla_data(pat_tb[NL80211_PKTPAT_PATTERN]), pat_len); 8757 + memcpy(mask_pat, nla_data(pat_tb[NL80211_PKTPAT_PATTERN]), 8758 + pat_len); 8823 8759 i++; 8824 8760 } 8825 8761
+1 -1
net/wireless/rdev-ops.h
··· 199 199 } 200 200 201 201 static inline int rdev_get_station(struct cfg80211_registered_device *rdev, 202 - struct net_device *dev, u8 *mac, 202 + struct net_device *dev, const u8 *mac, 203 203 struct station_info *sinfo) 204 204 { 205 205 int ret;
+2 -1
net/wireless/reg.c
··· 1876 1876 case NL80211_REGDOM_SET_BY_USER: 1877 1877 treatment = reg_process_hint_user(reg_request); 1878 1878 if (treatment == REG_REQ_IGNORE || 1879 - treatment == REG_REQ_ALREADY_SET) 1879 + treatment == REG_REQ_ALREADY_SET || 1880 + treatment == REG_REQ_USER_HINT_HANDLED) 1880 1881 return; 1881 1882 queue_delayed_work(system_power_efficient_wq, 1882 1883 &reg_timeout, msecs_to_jiffies(3142));
+8 -4
net/wireless/scan.c
··· 891 891 struct cfg80211_bss_ies *ies; 892 892 struct ieee80211_channel *channel; 893 893 struct cfg80211_internal_bss tmp = {}, *res; 894 + bool signal_valid; 894 895 895 896 if (WARN_ON(!wiphy)) 896 897 return NULL; ··· 928 927 rcu_assign_pointer(tmp.pub.beacon_ies, ies); 929 928 rcu_assign_pointer(tmp.pub.ies, ies); 930 929 931 - res = cfg80211_bss_update(wiphy_to_rdev(wiphy), &tmp, 932 - rx_channel == channel); 930 + signal_valid = abs(rx_channel->center_freq - channel->center_freq) <= 931 + wiphy->max_adj_channel_rssi_comp; 932 + res = cfg80211_bss_update(wiphy_to_rdev(wiphy), &tmp, signal_valid); 933 933 if (!res) 934 934 return NULL; 935 935 ··· 954 952 struct cfg80211_internal_bss tmp = {}, *res; 955 953 struct cfg80211_bss_ies *ies; 956 954 struct ieee80211_channel *channel; 955 + bool signal_valid; 957 956 size_t ielen = len - offsetof(struct ieee80211_mgmt, 958 957 u.probe_resp.variable); 959 958 ··· 1002 999 tmp.pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int); 1003 1000 tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info); 1004 1001 1005 - res = cfg80211_bss_update(wiphy_to_rdev(wiphy), &tmp, 1006 - rx_channel == channel); 1002 + signal_valid = abs(rx_channel->center_freq - channel->center_freq) <= 1003 + wiphy->max_adj_channel_rssi_comp; 1004 + res = cfg80211_bss_update(wiphy_to_rdev(wiphy), &tmp, signal_valid); 1007 1005 if (!res) 1008 1006 return NULL; 1009 1007
+5 -3
net/wireless/sme.c
··· 149 149 case CFG80211_CONN_SCAN_AGAIN: 150 150 return cfg80211_conn_scan(wdev); 151 151 case CFG80211_CONN_AUTHENTICATE_NEXT: 152 - BUG_ON(!rdev->ops->auth); 152 + if (WARN_ON(!rdev->ops->auth)) 153 + return -EOPNOTSUPP; 153 154 wdev->conn->state = CFG80211_CONN_AUTHENTICATING; 154 155 return cfg80211_mlme_auth(rdev, wdev->netdev, 155 156 params->channel, params->auth_type, ··· 162 161 case CFG80211_CONN_AUTH_FAILED: 163 162 return -ENOTCONN; 164 163 case CFG80211_CONN_ASSOCIATE_NEXT: 165 - BUG_ON(!rdev->ops->assoc); 164 + if (WARN_ON(!rdev->ops->assoc)) 165 + return -EOPNOTSUPP; 166 166 wdev->conn->state = CFG80211_CONN_ASSOCIATING; 167 167 if (wdev->conn->prev_bssid_valid) 168 168 req.prev_bssid = wdev->conn->prev_bssid; ··· 879 877 } 880 878 881 879 void cfg80211_disconnected(struct net_device *dev, u16 reason, 882 - u8 *ie, size_t ie_len, gfp_t gfp) 880 + const u8 *ie, size_t ie_len, gfp_t gfp) 883 881 { 884 882 struct wireless_dev *wdev = dev->ieee80211_ptr; 885 883 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
+28 -9
net/wireless/trace.h
··· 1876 1876 WIPHY_ENTRY 1877 1877 NETDEV_ENTRY 1878 1878 CHAN_DEF_ENTRY 1879 - __field(u16, counter_offset_beacon) 1880 - __field(u16, counter_offset_presp) 1881 1879 __field(bool, radar_required) 1882 1880 __field(bool, block_tx) 1883 1881 __field(u8, count) 1882 + __dynamic_array(u16, bcn_ofs, params->n_counter_offsets_beacon) 1883 + __dynamic_array(u16, pres_ofs, params->n_counter_offsets_presp) 1884 1884 ), 1885 1885 TP_fast_assign( 1886 1886 WIPHY_ASSIGN; 1887 1887 NETDEV_ASSIGN; 1888 1888 CHAN_DEF_ASSIGN(&params->chandef); 1889 - __entry->counter_offset_beacon = params->counter_offset_beacon; 1890 - __entry->counter_offset_presp = params->counter_offset_presp; 1891 1889 __entry->radar_required = params->radar_required; 1892 1890 __entry->block_tx = params->block_tx; 1893 1891 __entry->count = params->count; 1892 + memcpy(__get_dynamic_array(bcn_ofs), 1893 + params->counter_offsets_beacon, 1894 + params->n_counter_offsets_beacon * sizeof(u16)); 1895 + 1896 + /* probe response offsets are optional */ 1897 + if (params->n_counter_offsets_presp) 1898 + memcpy(__get_dynamic_array(pres_ofs), 1899 + params->counter_offsets_presp, 1900 + params->n_counter_offsets_presp * sizeof(u16)); 1894 1901 ), 1895 1902 TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT 1896 - ", block_tx: %d, count: %u, radar_required: %d" 1897 - ", counter offsets (beacon/presp): %u/%u", 1903 + ", block_tx: %d, count: %u, radar_required: %d", 1898 1904 WIPHY_PR_ARG, NETDEV_PR_ARG, CHAN_DEF_PR_ARG, 1899 - __entry->block_tx, __entry->count, __entry->radar_required, 1900 - __entry->counter_offset_beacon, 1901 - __entry->counter_offset_presp) 1905 + __entry->block_tx, __entry->count, __entry->radar_required) 1902 1906 ); 1903 1907 1904 1908 TRACE_EVENT(rdev_set_qos_map, ··· 2638 2634 ), 2639 2635 TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", target_ap: " MAC_PR_FMT, 2640 2636 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(target_ap)) 2637 + ); 2638 + 2639 + TRACE_EVENT(cfg80211_stop_iface, 2640 + TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev), 2641 + TP_ARGS(wiphy, wdev), 2642 + TP_STRUCT__entry( 2643 + WIPHY_ENTRY 2644 + WDEV_ENTRY 2645 + ), 2646 + TP_fast_assign( 2647 + WIPHY_ASSIGN; 2648 + WDEV_ASSIGN; 2649 + ), 2650 + TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT, 2651 + WIPHY_PR_ARG, WDEV_PR_ARG) 2641 2652 ); 2642 2653 2643 2654 #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
+37 -1
net/wireless/util.c
··· 476 476 EXPORT_SYMBOL(ieee80211_data_to_8023); 477 477 478 478 int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 479 - enum nl80211_iftype iftype, u8 *bssid, bool qos) 479 + enum nl80211_iftype iftype, 480 + const u8 *bssid, bool qos) 480 481 { 481 482 struct ieee80211_hdr hdr; 482 483 u16 hdrlen, ethertype; ··· 839 838 case EVENT_IBSS_JOINED: 840 839 __cfg80211_ibss_joined(wdev->netdev, ev->ij.bssid, 841 840 ev->ij.channel); 841 + break; 842 + case EVENT_STOPPED: 843 + __cfg80211_leave(wiphy_to_rdev(wdev->wiphy), wdev); 842 844 break; 843 845 } 844 846 wdev_unlock(wdev); ··· 1275 1271 void *data), 1276 1272 void *data) 1277 1273 { 1274 + const struct ieee80211_regdomain *regdom; 1275 + enum nl80211_dfs_regions region = 0; 1278 1276 int i, j, iftype; 1279 1277 int num_interfaces = 0; 1280 1278 u32 used_iftypes = 0; 1279 + 1280 + if (radar_detect) { 1281 + rcu_read_lock(); 1282 + regdom = rcu_dereference(cfg80211_regdomain); 1283 + if (regdom) 1284 + region = regdom->dfs_region; 1285 + rcu_read_unlock(); 1286 + } 1281 1287 1282 1288 for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { 1283 1289 num_interfaces += iftype_num[iftype]; ··· 1327 1313 } 1328 1314 1329 1315 if (radar_detect != (c->radar_detect_widths & radar_detect)) 1316 + goto cont; 1317 + 1318 + if (radar_detect && c->radar_detect_regions && 1319 + !(c->radar_detect_regions & BIT(region))) 1330 1320 goto cont; 1331 1321 1332 1322 /* Finally check that all iftypes that we're currently ··· 1545 1527 return n_channels; 1546 1528 } 1547 1529 EXPORT_SYMBOL(ieee80211_get_num_supported_channels); 1530 + 1531 + int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 1532 + struct station_info *sinfo) 1533 + { 1534 + struct cfg80211_registered_device *rdev; 1535 + struct wireless_dev *wdev; 1536 + 1537 + wdev = dev->ieee80211_ptr; 1538 + if (!wdev) 1539 + return -EOPNOTSUPP; 1540 + 1541 + rdev = wiphy_to_rdev(wdev->wiphy); 1542 + if (!rdev->ops->get_station) 1543 + return -EOPNOTSUPP; 1544 + 1545 + return rdev_get_station(rdev, dev, mac_addr, sinfo); 1546 + } 1547 + EXPORT_SYMBOL(cfg80211_get_station); 1548 1548 1549 1549 /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ 1550 1550 /* Ethernet-II snap header (RFC1042 for most EtherTypes) */