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

+2867 -1435
+1 -2
MAINTAINERS
··· 1674 1674 1675 1675 BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER 1676 1676 M: Brett Rudley <brudley@broadcom.com> 1677 - M: Roland Vossen <rvossen@broadcom.com> 1678 1677 M: Arend van Spriel <arend@broadcom.com> 1679 1678 M: Franky (Zhenhui) Lin <frankyl@broadcom.com> 1680 - M: Kan Yan <kanyan@broadcom.com> 1679 + M: Hante Meuleman <meuleman@broadcom.com> 1681 1680 L: linux-wireless@vger.kernel.org 1682 1681 L: brcm80211-dev-list@broadcom.com 1683 1682 S: Supported
+2
drivers/bcma/bcma_private.h
··· 84 84 /* driver_pci.c */ 85 85 u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address); 86 86 87 + extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc); 88 + 87 89 #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE 88 90 bool __devinit bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc); 89 91 void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc);
+109 -5
drivers/bcma/driver_chipcommon.c
··· 4 4 * 5 5 * Copyright 2005, Broadcom Corporation 6 6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch> 7 + * Copyright 2012, Hauke Mehrtens <hauke@hauke-m.de> 7 8 * 8 9 * Licensed under the GNU/GPL. See COPYING for details. 9 10 */ 10 11 11 12 #include "bcma_private.h" 13 + #include <linux/bcm47xx_wdt.h> 12 14 #include <linux/export.h> 15 + #include <linux/platform_device.h> 13 16 #include <linux/bcma/bcma.h> 14 17 15 18 static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset, ··· 23 20 bcma_cc_write32(cc, offset, value); 24 21 25 22 return value; 23 + } 24 + 25 + static u32 bcma_chipco_alp_clock(struct bcma_drv_cc *cc) 26 + { 27 + if (cc->capabilities & BCMA_CC_CAP_PMU) 28 + return bcma_pmu_alp_clock(cc); 29 + 30 + return 20000000; 31 + } 32 + 33 + static u32 bcma_chipco_watchdog_get_max_timer(struct bcma_drv_cc *cc) 34 + { 35 + struct bcma_bus *bus = cc->core->bus; 36 + u32 nb; 37 + 38 + if (cc->capabilities & BCMA_CC_CAP_PMU) { 39 + if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) 40 + nb = 32; 41 + else if (cc->core->id.rev < 26) 42 + nb = 16; 43 + else 44 + nb = (cc->core->id.rev >= 37) ? 32 : 24; 45 + } else { 46 + nb = 28; 47 + } 48 + if (nb == 32) 49 + return 0xffffffff; 50 + else 51 + return (1 << nb) - 1; 52 + } 53 + 54 + static u32 bcma_chipco_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, 55 + u32 ticks) 56 + { 57 + struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt); 58 + 59 + return bcma_chipco_watchdog_timer_set(cc, ticks); 60 + } 61 + 62 + static u32 bcma_chipco_watchdog_timer_set_ms_wdt(struct bcm47xx_wdt *wdt, 63 + u32 ms) 64 + { 65 + struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt); 66 + u32 ticks; 67 + 68 + ticks = bcma_chipco_watchdog_timer_set(cc, cc->ticks_per_ms * ms); 69 + return ticks / cc->ticks_per_ms; 70 + } 71 + 72 + static int bcma_chipco_watchdog_ticks_per_ms(struct bcma_drv_cc *cc) 73 + { 74 + struct bcma_bus *bus = cc->core->bus; 75 + 76 + if (cc->capabilities & BCMA_CC_CAP_PMU) { 77 + if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) 78 + /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP clock */ 79 + return bcma_chipco_alp_clock(cc) / 4000; 80 + else 81 + /* based on 32KHz ILP clock */ 82 + return 32; 83 + } else { 84 + return bcma_chipco_alp_clock(cc) / 1000; 85 + } 86 + } 87 + 88 + int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc) 89 + { 90 + struct bcm47xx_wdt wdt = {}; 91 + struct platform_device *pdev; 92 + 93 + wdt.driver_data = cc; 94 + wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt; 95 + wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt; 96 + wdt.max_timer_ms = bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms; 97 + 98 + pdev = platform_device_register_data(NULL, "bcm47xx-wdt", 99 + cc->core->bus->num, &wdt, 100 + sizeof(wdt)); 101 + if (IS_ERR(pdev)) 102 + return PTR_ERR(pdev); 103 + 104 + cc->watchdog = pdev; 105 + 106 + return 0; 26 107 } 27 108 28 109 void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc) ··· 156 69 ((leddc_on << BCMA_CC_GPIOTIMER_ONTIME_SHIFT) | 157 70 (leddc_off << BCMA_CC_GPIOTIMER_OFFTIME_SHIFT))); 158 71 } 72 + cc->ticks_per_ms = bcma_chipco_watchdog_ticks_per_ms(cc); 159 73 160 74 cc->setup_done = true; 161 75 } 162 76 163 77 /* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */ 164 - void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) 78 + u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) 165 79 { 166 - /* instant NMI */ 167 - bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks); 80 + u32 maxt; 81 + enum bcma_clkmode clkmode; 82 + 83 + maxt = bcma_chipco_watchdog_get_max_timer(cc); 84 + if (cc->capabilities & BCMA_CC_CAP_PMU) { 85 + if (ticks == 1) 86 + ticks = 2; 87 + else if (ticks > maxt) 88 + ticks = maxt; 89 + bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks); 90 + } else { 91 + clkmode = ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC; 92 + bcma_core_set_clockmode(cc->core, clkmode); 93 + if (ticks > maxt) 94 + ticks = maxt; 95 + /* instant NMI */ 96 + bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks); 97 + } 98 + return ticks; 168 99 } 169 100 170 101 void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value) ··· 236 131 struct bcma_serial_port *ports = cc->serial_ports; 237 132 238 133 if (ccrev >= 11 && ccrev != 15) { 239 - /* Fixed ALP clock */ 240 - baud_base = bcma_pmu_alp_clock(cc); 134 + baud_base = bcma_chipco_alp_clock(cc); 241 135 if (ccrev >= 21) { 242 136 /* Turn off UART clock before switching clocksource. */ 243 137 bcma_cc_write32(cc, BCMA_CC_CORECTL,
+7 -3
drivers/bcma/driver_pci_host.c
··· 538 538 static void bcma_core_pci_fixup_addresses(struct pci_dev *dev) 539 539 { 540 540 struct resource *res; 541 - int pos; 541 + int pos, err; 542 542 543 543 if (dev->bus->ops->read != bcma_core_pci_hostmode_read_config) { 544 544 /* This is not a device on the PCI-core bridge. */ ··· 551 551 552 552 for (pos = 0; pos < 6; pos++) { 553 553 res = &dev->resource[pos]; 554 - if (res->flags & (IORESOURCE_IO | IORESOURCE_MEM)) 555 - pci_assign_resource(dev, pos); 554 + if (res->flags & (IORESOURCE_IO | IORESOURCE_MEM)) { 555 + err = pci_assign_resource(dev, pos); 556 + if (err) 557 + pr_err("PCI: Problem fixing up the addresses on %s\n", 558 + pci_name(dev)); 559 + } 556 560 } 557 561 } 558 562 DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, bcma_core_pci_fixup_addresses);
+8
drivers/bcma/main.c
··· 165 165 } 166 166 #endif 167 167 168 + if (bus->hosttype == BCMA_HOSTTYPE_SOC) { 169 + err = bcma_chipco_watchdog_register(&bus->drv_cc); 170 + if (err) 171 + bcma_err(bus, "Error registering watchdog driver\n"); 172 + } 173 + 168 174 return 0; 169 175 } 170 176 ··· 183 177 if (core->dev_registered) 184 178 device_unregister(&core->dev); 185 179 } 180 + if (bus->hosttype == BCMA_HOSTTYPE_SOC) 181 + platform_device_unregister(bus->drv_cc.watchdog); 186 182 } 187 183 188 184 int __devinit bcma_bus_register(struct bcma_bus *bus)
+3 -3
drivers/net/wireless/adm8211.c
··· 1761 1761 .get_tsf = adm8211_get_tsft 1762 1762 }; 1763 1763 1764 - static int __devinit adm8211_probe(struct pci_dev *pdev, 1764 + static int adm8211_probe(struct pci_dev *pdev, 1765 1765 const struct pci_device_id *id) 1766 1766 { 1767 1767 struct ieee80211_hw *dev; ··· 1935 1935 } 1936 1936 1937 1937 1938 - static void __devexit adm8211_remove(struct pci_dev *pdev) 1938 + static void adm8211_remove(struct pci_dev *pdev) 1939 1939 { 1940 1940 struct ieee80211_hw *dev = pci_get_drvdata(pdev); 1941 1941 struct adm8211_priv *priv; ··· 1985 1985 .name = "adm8211", 1986 1986 .id_table = adm8211_pci_id_table, 1987 1987 .probe = adm8211_probe, 1988 - .remove = __devexit_p(adm8211_remove), 1988 + .remove = adm8211_remove, 1989 1989 #ifdef CONFIG_PM 1990 1990 .suspend = adm8211_suspend, 1991 1991 .resume = adm8211_resume,
+3 -3
drivers/net/wireless/airo.c
··· 78 78 .name = DRV_NAME, 79 79 .id_table = card_ids, 80 80 .probe = airo_pci_probe, 81 - .remove = __devexit_p(airo_pci_remove), 81 + .remove = airo_pci_remove, 82 82 .suspend = airo_pci_suspend, 83 83 .resume = airo_pci_resume, 84 84 }; ··· 5584 5584 } 5585 5585 5586 5586 #ifdef CONFIG_PCI 5587 - static int __devinit airo_pci_probe(struct pci_dev *pdev, 5587 + static int airo_pci_probe(struct pci_dev *pdev, 5588 5588 const struct pci_device_id *pent) 5589 5589 { 5590 5590 struct net_device *dev; ··· 5606 5606 return 0; 5607 5607 } 5608 5608 5609 - static void __devexit airo_pci_remove(struct pci_dev *pdev) 5609 + static void airo_pci_remove(struct pci_dev *pdev) 5610 5610 { 5611 5611 struct net_device *dev = pci_get_drvdata(pdev); 5612 5612
+5 -2
drivers/net/wireless/ath/Kconfig
··· 1 - menuconfig ATH_COMMON 1 + config ATH_COMMON 2 + tristate 3 + 4 + menuconfig ATH_CARDS 2 5 tristate "Atheros Wireless Cards" 3 6 depends on CFG80211 && (!UML || BROKEN) 4 7 ---help--- ··· 17 14 18 15 http://wireless.kernel.org/en/users/Drivers/Atheros 19 16 20 - if ATH_COMMON 17 + if ATH_CARDS 21 18 22 19 config ATH_DEBUG 23 20 bool "Atheros wireless debugging"
+1
drivers/net/wireless/ath/ar5523/Kconfig
··· 1 1 config AR5523 2 2 tristate "Atheros AR5523 wireless driver support" 3 3 depends on MAC80211 && USB 4 + select ATH_COMMON 4 5 select FW_LOADER 5 6 ---help--- 6 7 This module add support for AR5523 based USB dongles such as D-Link
+1
drivers/net/wireless/ath/ath5k/Kconfig
··· 1 1 config ATH5K 2 2 tristate "Atheros 5xxx wireless cards support" 3 3 depends on (PCI || ATHEROS_AR231X) && MAC80211 4 + select ATH_COMMON 4 5 select MAC80211_LEDS 5 6 select LEDS_CLASS 6 7 select NEW_LEDS
+2 -2
drivers/net/wireless/ath/ath5k/base.c
··· 2435 2435 .num_different_channels = 1, 2436 2436 }; 2437 2437 2438 - int __devinit 2438 + int 2439 2439 ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops) 2440 2440 { 2441 2441 struct ieee80211_hw *hw = ah->hw; ··· 2861 2861 mutex_unlock(&ah->lock); 2862 2862 } 2863 2863 2864 - static int __devinit 2864 + static int 2865 2865 ath5k_init(struct ieee80211_hw *hw) 2866 2866 { 2867 2867
+1 -1
drivers/net/wireless/ath/ath5k/led.c
··· 158 158 ath5k_unregister_led(&ah->tx_led); 159 159 } 160 160 161 - int __devinit ath5k_init_leds(struct ath5k_hw *ah) 161 + int ath5k_init_leds(struct ath5k_hw *ah) 162 162 { 163 163 int ret = 0; 164 164 struct ieee80211_hw *hw = ah->hw;
+3 -3
drivers/net/wireless/ath/ath5k/pci.c
··· 155 155 * PCI Initialization * 156 156 \********************/ 157 157 158 - static int __devinit 158 + static int 159 159 ath5k_pci_probe(struct pci_dev *pdev, 160 160 const struct pci_device_id *id) 161 161 { ··· 285 285 return ret; 286 286 } 287 287 288 - static void __devexit 288 + static void 289 289 ath5k_pci_remove(struct pci_dev *pdev) 290 290 { 291 291 struct ieee80211_hw *hw = pci_get_drvdata(pdev); ··· 336 336 .name = KBUILD_MODNAME, 337 337 .id_table = ath5k_pci_id_table, 338 338 .probe = ath5k_pci_probe, 339 - .remove = __devexit_p(ath5k_pci_remove), 339 + .remove = ath5k_pci_remove, 340 340 .driver.pm = ATH5K_PM_OPS, 341 341 }; 342 342
+1
drivers/net/wireless/ath/ath9k/Kconfig
··· 17 17 config ATH9K 18 18 tristate "Atheros 802.11n wireless cards support" 19 19 depends on MAC80211 20 + select ATH_COMMON 20 21 select ATH9K_HW 21 22 select MAC80211_LEDS 22 23 select LEDS_CLASS
+6 -1
drivers/net/wireless/ath/ath9k/ath9k.h
··· 259 259 }; 260 260 261 261 struct ath_node { 262 + struct ath_softc *sc; 262 263 struct ieee80211_sta *sta; /* station struct we're part of */ 263 264 struct ieee80211_vif *vif; /* interface with which we're associated */ 264 - struct ath_atx_tid tid[WME_NUM_TID]; 265 + struct ath_atx_tid tid[IEEE80211_NUM_TIDS]; 265 266 struct ath_atx_ac ac[IEEE80211_NUM_ACS]; 266 267 int ps_key; 267 268 ··· 270 269 u8 mpdudensity; 271 270 272 271 bool sleeping; 272 + 273 + #if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS) 274 + struct dentry *node_stat; 275 + #endif 273 276 }; 274 277 275 278 #define AGGR_CLEANUP BIT(1)
-1
drivers/net/wireless/ath/ath9k/common.h
··· 23 23 24 24 /* Common header for Atheros 802.11n base driver cores */ 25 25 26 - #define WME_NUM_TID 16 27 26 #define WME_BA_BMP_SIZE 64 28 27 #define WME_MAX_BA WME_BA_BMP_SIZE 29 28 #define ATH_TID_MAX_BUFS (2 * WME_MAX_BA)
+209
drivers/net/wireless/ath/ath9k/debug.c
··· 1509 1509 }; 1510 1510 #endif 1511 1511 1512 + static ssize_t read_file_node_stat(struct file *file, char __user *user_buf, 1513 + size_t count, loff_t *ppos) 1514 + { 1515 + struct ath_node *an = file->private_data; 1516 + struct ath_softc *sc = an->sc; 1517 + struct ath_atx_tid *tid; 1518 + struct ath_atx_ac *ac; 1519 + struct ath_txq *txq; 1520 + u32 len = 0, size = 4096; 1521 + char *buf; 1522 + size_t retval; 1523 + int tidno, acno; 1524 + 1525 + buf = kzalloc(size, GFP_KERNEL); 1526 + if (buf == NULL) 1527 + return -ENOMEM; 1528 + 1529 + if (!an->sta->ht_cap.ht_supported) { 1530 + len = snprintf(buf, size, "%s\n", 1531 + "HT not supported"); 1532 + goto exit; 1533 + } 1534 + 1535 + len = snprintf(buf, size, "Max-AMPDU: %d\n", 1536 + an->maxampdu); 1537 + len += snprintf(buf + len, size - len, "MPDU Density: %d\n\n", 1538 + an->mpdudensity); 1539 + 1540 + len += snprintf(buf + len, size - len, 1541 + "%2s%7s\n", "AC", "SCHED"); 1542 + 1543 + for (acno = 0, ac = &an->ac[acno]; 1544 + acno < IEEE80211_NUM_ACS; acno++, ac++) { 1545 + txq = ac->txq; 1546 + ath_txq_lock(sc, txq); 1547 + len += snprintf(buf + len, size - len, 1548 + "%2d%7d\n", 1549 + acno, ac->sched); 1550 + ath_txq_unlock(sc, txq); 1551 + } 1552 + 1553 + len += snprintf(buf + len, size - len, 1554 + "\n%3s%11s%10s%10s%10s%10s%9s%6s%8s\n", 1555 + "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE", 1556 + "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED"); 1557 + 1558 + for (tidno = 0, tid = &an->tid[tidno]; 1559 + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { 1560 + txq = tid->ac->txq; 1561 + ath_txq_lock(sc, txq); 1562 + len += snprintf(buf + len, size - len, 1563 + "%3d%11d%10d%10d%10d%10d%9d%6d%8d\n", 1564 + tid->tidno, tid->seq_start, tid->seq_next, 1565 + tid->baw_size, tid->baw_head, tid->baw_tail, 1566 + tid->bar_index, tid->sched, tid->paused); 1567 + ath_txq_unlock(sc, txq); 1568 + } 1569 + exit: 1570 + retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 1571 + kfree(buf); 1572 + 1573 + return retval; 1574 + } 1575 + 1576 + static const struct file_operations fops_node_stat = { 1577 + .read = read_file_node_stat, 1578 + .open = simple_open, 1579 + .owner = THIS_MODULE, 1580 + .llseek = default_llseek, 1581 + }; 1582 + 1583 + void ath9k_sta_add_debugfs(struct ieee80211_hw *hw, 1584 + struct ieee80211_vif *vif, 1585 + struct ieee80211_sta *sta, 1586 + struct dentry *dir) 1587 + { 1588 + struct ath_node *an = (struct ath_node *)sta->drv_priv; 1589 + an->node_stat = debugfs_create_file("node_stat", S_IRUGO, 1590 + dir, an, &fops_node_stat); 1591 + } 1592 + 1593 + void ath9k_sta_remove_debugfs(struct ieee80211_hw *hw, 1594 + struct ieee80211_vif *vif, 1595 + struct ieee80211_sta *sta, 1596 + struct dentry *dir) 1597 + { 1598 + struct ath_node *an = (struct ath_node *)sta->drv_priv; 1599 + debugfs_remove(an->node_stat); 1600 + } 1601 + 1602 + /* Ethtool support for get-stats */ 1603 + 1604 + #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" 1605 + static const char ath9k_gstrings_stats[][ETH_GSTRING_LEN] = { 1606 + "tx_pkts_nic", 1607 + "tx_bytes_nic", 1608 + "rx_pkts_nic", 1609 + "rx_bytes_nic", 1610 + AMKSTR(d_tx_pkts), 1611 + AMKSTR(d_tx_bytes), 1612 + AMKSTR(d_tx_mpdus_queued), 1613 + AMKSTR(d_tx_mpdus_completed), 1614 + AMKSTR(d_tx_mpdu_xretries), 1615 + AMKSTR(d_tx_aggregates), 1616 + AMKSTR(d_tx_ampdus_queued_hw), 1617 + AMKSTR(d_tx_ampdus_queued_sw), 1618 + AMKSTR(d_tx_ampdus_completed), 1619 + AMKSTR(d_tx_ampdu_retries), 1620 + AMKSTR(d_tx_ampdu_xretries), 1621 + AMKSTR(d_tx_fifo_underrun), 1622 + AMKSTR(d_tx_op_exceeded), 1623 + AMKSTR(d_tx_timer_expiry), 1624 + AMKSTR(d_tx_desc_cfg_err), 1625 + AMKSTR(d_tx_data_underrun), 1626 + AMKSTR(d_tx_delim_underrun), 1627 + "d_rx_decrypt_crc_err", 1628 + "d_rx_phy_err", 1629 + "d_rx_mic_err", 1630 + "d_rx_pre_delim_crc_err", 1631 + "d_rx_post_delim_crc_err", 1632 + "d_rx_decrypt_busy_err", 1633 + 1634 + "d_rx_phyerr_radar", 1635 + "d_rx_phyerr_ofdm_timing", 1636 + "d_rx_phyerr_cck_timing", 1637 + 1638 + }; 1639 + #define ATH9K_SSTATS_LEN ARRAY_SIZE(ath9k_gstrings_stats) 1640 + 1641 + void ath9k_get_et_strings(struct ieee80211_hw *hw, 1642 + struct ieee80211_vif *vif, 1643 + u32 sset, u8 *data) 1644 + { 1645 + if (sset == ETH_SS_STATS) 1646 + memcpy(data, *ath9k_gstrings_stats, 1647 + sizeof(ath9k_gstrings_stats)); 1648 + } 1649 + 1650 + int ath9k_get_et_sset_count(struct ieee80211_hw *hw, 1651 + struct ieee80211_vif *vif, int sset) 1652 + { 1653 + if (sset == ETH_SS_STATS) 1654 + return ATH9K_SSTATS_LEN; 1655 + return 0; 1656 + } 1657 + 1658 + #define AWDATA(elem) \ 1659 + do { \ 1660 + data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].elem; \ 1661 + data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].elem; \ 1662 + data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].elem; \ 1663 + data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].elem; \ 1664 + } while (0) 1665 + 1666 + #define AWDATA_RX(elem) \ 1667 + do { \ 1668 + data[i++] = sc->debug.stats.rxstats.elem; \ 1669 + } while (0) 1670 + 1671 + void ath9k_get_et_stats(struct ieee80211_hw *hw, 1672 + struct ieee80211_vif *vif, 1673 + struct ethtool_stats *stats, u64 *data) 1674 + { 1675 + struct ath_softc *sc = hw->priv; 1676 + int i = 0; 1677 + 1678 + data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_pkts_all + 1679 + sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_pkts_all + 1680 + sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_pkts_all + 1681 + sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_pkts_all); 1682 + data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_bytes_all + 1683 + sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_bytes_all + 1684 + sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_bytes_all + 1685 + sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_bytes_all); 1686 + AWDATA_RX(rx_pkts_all); 1687 + AWDATA_RX(rx_bytes_all); 1688 + 1689 + AWDATA(tx_pkts_all); 1690 + AWDATA(tx_bytes_all); 1691 + AWDATA(queued); 1692 + AWDATA(completed); 1693 + AWDATA(xretries); 1694 + AWDATA(a_aggr); 1695 + AWDATA(a_queued_hw); 1696 + AWDATA(a_queued_sw); 1697 + AWDATA(a_completed); 1698 + AWDATA(a_retries); 1699 + AWDATA(a_xretries); 1700 + AWDATA(fifo_underrun); 1701 + AWDATA(xtxop); 1702 + AWDATA(timer_exp); 1703 + AWDATA(desc_cfg_err); 1704 + AWDATA(data_underrun); 1705 + AWDATA(delim_underrun); 1706 + 1707 + AWDATA_RX(decrypt_crc_err); 1708 + AWDATA_RX(phy_err); 1709 + AWDATA_RX(mic_err); 1710 + AWDATA_RX(pre_delim_crc_err); 1711 + AWDATA_RX(post_delim_crc_err); 1712 + AWDATA_RX(decrypt_busy_err); 1713 + 1714 + AWDATA_RX(phy_err_stats[ATH9K_PHYERR_RADAR]); 1715 + AWDATA_RX(phy_err_stats[ATH9K_PHYERR_OFDM_TIMING]); 1716 + AWDATA_RX(phy_err_stats[ATH9K_PHYERR_CCK_TIMING]); 1717 + 1718 + WARN_ON(i != ATH9K_SSTATS_LEN); 1719 + } 1720 + 1512 1721 int ath9k_init_debug(struct ath_hw *ah) 1513 1722 { 1514 1723 struct ath_common *common = ath9k_hw_common(ah);
+16 -1
drivers/net/wireless/ath/ath9k/debug.h
··· 307 307 struct ath_tx_status *ts, struct ath_txq *txq, 308 308 unsigned int flags); 309 309 void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs); 310 - 310 + int ath9k_get_et_sset_count(struct ieee80211_hw *hw, 311 + struct ieee80211_vif *vif, int sset); 312 + void ath9k_get_et_stats(struct ieee80211_hw *hw, 313 + struct ieee80211_vif *vif, 314 + struct ethtool_stats *stats, u64 *data); 315 + void ath9k_get_et_strings(struct ieee80211_hw *hw, 316 + struct ieee80211_vif *vif, 317 + u32 sset, u8 *data); 318 + void ath9k_sta_add_debugfs(struct ieee80211_hw *hw, 319 + struct ieee80211_vif *vif, 320 + struct ieee80211_sta *sta, 321 + struct dentry *dir); 322 + void ath9k_sta_remove_debugfs(struct ieee80211_hw *hw, 323 + struct ieee80211_vif *vif, 324 + struct ieee80211_sta *sta, 325 + struct dentry *dir); 311 326 #else 312 327 313 328 #define RX_STAT_INC(c) /* NOP */
+8 -129
drivers/net/wireless/ath/ath9k/main.c
··· 331 331 u8 density; 332 332 an = (struct ath_node *)sta->drv_priv; 333 333 334 + an->sc = sc; 334 335 an->sta = sta; 335 336 an->vif = vif; 336 337 ··· 1883 1882 return 0; 1884 1883 } 1885 1884 1886 - #ifdef CONFIG_ATH9K_DEBUGFS 1887 - 1888 - /* Ethtool support for get-stats */ 1889 - 1890 - #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" 1891 - static const char ath9k_gstrings_stats[][ETH_GSTRING_LEN] = { 1892 - "tx_pkts_nic", 1893 - "tx_bytes_nic", 1894 - "rx_pkts_nic", 1895 - "rx_bytes_nic", 1896 - AMKSTR(d_tx_pkts), 1897 - AMKSTR(d_tx_bytes), 1898 - AMKSTR(d_tx_mpdus_queued), 1899 - AMKSTR(d_tx_mpdus_completed), 1900 - AMKSTR(d_tx_mpdu_xretries), 1901 - AMKSTR(d_tx_aggregates), 1902 - AMKSTR(d_tx_ampdus_queued_hw), 1903 - AMKSTR(d_tx_ampdus_queued_sw), 1904 - AMKSTR(d_tx_ampdus_completed), 1905 - AMKSTR(d_tx_ampdu_retries), 1906 - AMKSTR(d_tx_ampdu_xretries), 1907 - AMKSTR(d_tx_fifo_underrun), 1908 - AMKSTR(d_tx_op_exceeded), 1909 - AMKSTR(d_tx_timer_expiry), 1910 - AMKSTR(d_tx_desc_cfg_err), 1911 - AMKSTR(d_tx_data_underrun), 1912 - AMKSTR(d_tx_delim_underrun), 1913 - 1914 - "d_rx_decrypt_crc_err", 1915 - "d_rx_phy_err", 1916 - "d_rx_mic_err", 1917 - "d_rx_pre_delim_crc_err", 1918 - "d_rx_post_delim_crc_err", 1919 - "d_rx_decrypt_busy_err", 1920 - 1921 - "d_rx_phyerr_radar", 1922 - "d_rx_phyerr_ofdm_timing", 1923 - "d_rx_phyerr_cck_timing", 1924 - 1925 - }; 1926 - #define ATH9K_SSTATS_LEN ARRAY_SIZE(ath9k_gstrings_stats) 1927 - 1928 - static void ath9k_get_et_strings(struct ieee80211_hw *hw, 1929 - struct ieee80211_vif *vif, 1930 - u32 sset, u8 *data) 1931 - { 1932 - if (sset == ETH_SS_STATS) 1933 - memcpy(data, *ath9k_gstrings_stats, 1934 - sizeof(ath9k_gstrings_stats)); 1935 - } 1936 - 1937 - static int ath9k_get_et_sset_count(struct ieee80211_hw *hw, 1938 - struct ieee80211_vif *vif, int sset) 1939 - { 1940 - if (sset == ETH_SS_STATS) 1941 - return ATH9K_SSTATS_LEN; 1942 - return 0; 1943 - } 1944 - 1945 - #define AWDATA(elem) \ 1946 - do { \ 1947 - data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].elem; \ 1948 - data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].elem; \ 1949 - data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].elem; \ 1950 - data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].elem; \ 1951 - } while (0) 1952 - 1953 - #define AWDATA_RX(elem) \ 1954 - do { \ 1955 - data[i++] = sc->debug.stats.rxstats.elem; \ 1956 - } while (0) 1957 - 1958 - static void ath9k_get_et_stats(struct ieee80211_hw *hw, 1959 - struct ieee80211_vif *vif, 1960 - struct ethtool_stats *stats, u64 *data) 1961 - { 1962 - struct ath_softc *sc = hw->priv; 1963 - int i = 0; 1964 - 1965 - data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_pkts_all + 1966 - sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_pkts_all + 1967 - sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_pkts_all + 1968 - sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_pkts_all); 1969 - data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_bytes_all + 1970 - sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_bytes_all + 1971 - sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_bytes_all + 1972 - sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_bytes_all); 1973 - AWDATA_RX(rx_pkts_all); 1974 - AWDATA_RX(rx_bytes_all); 1975 - 1976 - AWDATA(tx_pkts_all); 1977 - AWDATA(tx_bytes_all); 1978 - AWDATA(queued); 1979 - AWDATA(completed); 1980 - AWDATA(xretries); 1981 - AWDATA(a_aggr); 1982 - AWDATA(a_queued_hw); 1983 - AWDATA(a_queued_sw); 1984 - AWDATA(a_completed); 1985 - AWDATA(a_retries); 1986 - AWDATA(a_xretries); 1987 - AWDATA(fifo_underrun); 1988 - AWDATA(xtxop); 1989 - AWDATA(timer_exp); 1990 - AWDATA(desc_cfg_err); 1991 - AWDATA(data_underrun); 1992 - AWDATA(delim_underrun); 1993 - 1994 - AWDATA_RX(decrypt_crc_err); 1995 - AWDATA_RX(phy_err); 1996 - AWDATA_RX(mic_err); 1997 - AWDATA_RX(pre_delim_crc_err); 1998 - AWDATA_RX(post_delim_crc_err); 1999 - AWDATA_RX(decrypt_busy_err); 2000 - 2001 - AWDATA_RX(phy_err_stats[ATH9K_PHYERR_RADAR]); 2002 - AWDATA_RX(phy_err_stats[ATH9K_PHYERR_OFDM_TIMING]); 2003 - AWDATA_RX(phy_err_stats[ATH9K_PHYERR_CCK_TIMING]); 2004 - 2005 - WARN_ON(i != ATH9K_SSTATS_LEN); 2006 - } 2007 - 2008 - /* End of ethtool get-stats functions */ 2009 - 2010 - #endif 2011 - 2012 - 2013 1885 #ifdef CONFIG_PM_SLEEP 2014 1886 2015 1887 static void ath9k_wow_map_triggers(struct ath_softc *sc, ··· 2276 2402 2277 2403 #ifdef CONFIG_ATH9K_DEBUGFS 2278 2404 .get_et_sset_count = ath9k_get_et_sset_count, 2279 - .get_et_stats = ath9k_get_et_stats, 2280 - .get_et_strings = ath9k_get_et_strings, 2405 + .get_et_stats = ath9k_get_et_stats, 2406 + .get_et_strings = ath9k_get_et_strings, 2407 + #endif 2408 + 2409 + #if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS) 2410 + .sta_add_debugfs = ath9k_sta_add_debugfs, 2411 + .sta_remove_debugfs = ath9k_sta_remove_debugfs, 2281 2412 #endif 2282 2413 };
+2 -1
drivers/net/wireless/ath/ath9k/mci.c
··· 257 257 { 258 258 struct ath_btcoex *btcoex = &sc->btcoex; 259 259 struct ath_mci_profile *mci = &btcoex->mci; 260 - u8 stomp_txprio[] = { 0, 0, 0, 0 }; /* all, low, none, low_ftp */ 260 + u8 stomp_txprio[ATH_BTCOEX_STOMP_MAX]; 261 261 262 + memset(stomp_txprio, 0, sizeof(stomp_txprio)); 262 263 if (mci->num_mgmt) { 263 264 stomp_txprio[ATH_BTCOEX_STOMP_ALL] = ATH_MCI_INQUIRY_PRIO; 264 265 if (!mci->num_pan && !mci->num_other_acl)
+4 -11
drivers/net/wireless/ath/ath9k/pci.c
··· 287 287 pci_release_region(pdev, 0); 288 288 } 289 289 290 - #ifdef CONFIG_PM 290 + #ifdef CONFIG_PM_SLEEP 291 291 292 292 static int ath_pci_suspend(struct device *device) 293 293 { ··· 333 333 return 0; 334 334 } 335 335 336 - static const struct dev_pm_ops ath9k_pm_ops = { 337 - .suspend = ath_pci_suspend, 338 - .resume = ath_pci_resume, 339 - .freeze = ath_pci_suspend, 340 - .thaw = ath_pci_resume, 341 - .poweroff = ath_pci_suspend, 342 - .restore = ath_pci_resume, 343 - }; 336 + static SIMPLE_DEV_PM_OPS(ath9k_pm_ops, ath_pci_suspend, ath_pci_resume); 344 337 345 338 #define ATH9K_PM_OPS (&ath9k_pm_ops) 346 339 347 - #else /* !CONFIG_PM */ 340 + #else /* !CONFIG_PM_SLEEP */ 348 341 349 342 #define ATH9K_PM_OPS NULL 350 343 351 - #endif /* !CONFIG_PM */ 344 + #endif /* !CONFIG_PM_SLEEP */ 352 345 353 346 354 347 MODULE_DEVICE_TABLE(pci, ath_pci_id_table);
+4 -5
drivers/net/wireless/ath/ath9k/xmit.c
··· 312 312 } 313 313 314 314 bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list); 315 - bf->bf_next = NULL; 316 315 list_del(&bf->list); 317 316 318 317 spin_unlock_bh(&sc->tx.txbuflock); ··· 1262 1263 int tidno; 1263 1264 1264 1265 for (tidno = 0, tid = &an->tid[tidno]; 1265 - tidno < WME_NUM_TID; tidno++, tid++) { 1266 + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { 1266 1267 1267 1268 if (!tid->sched) 1268 1269 continue; ··· 1296 1297 int tidno; 1297 1298 1298 1299 for (tidno = 0, tid = &an->tid[tidno]; 1299 - tidno < WME_NUM_TID; tidno++, tid++) { 1300 + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { 1300 1301 1301 1302 ac = tid->ac; 1302 1303 txq = ac->txq; ··· 2447 2448 int tidno, acno; 2448 2449 2449 2450 for (tidno = 0, tid = &an->tid[tidno]; 2450 - tidno < WME_NUM_TID; 2451 + tidno < IEEE80211_NUM_TIDS; 2451 2452 tidno++, tid++) { 2452 2453 tid->an = an; 2453 2454 tid->tidno = tidno; ··· 2480 2481 int tidno; 2481 2482 2482 2483 for (tidno = 0, tid = &an->tid[tidno]; 2483 - tidno < WME_NUM_TID; tidno++, tid++) { 2484 + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { 2484 2485 2485 2486 ac = tid->ac; 2486 2487 txq = ac->txq;
+1
drivers/net/wireless/ath/carl9170/Kconfig
··· 1 1 config CARL9170 2 2 tristate "Linux Community AR9170 802.11n USB support" 3 3 depends on USB && MAC80211 && EXPERIMENTAL 4 + select ATH_COMMON 4 5 select FW_LOADER 5 6 select CRC32 6 7 help
+2
drivers/net/wireless/ath/carl9170/rx.c
··· 814 814 815 815 if (phy) 816 816 carl9170_rx_phy_status(ar, phy, &status); 817 + else 818 + status.flag |= RX_FLAG_NO_SIGNAL_VAL; 817 819 818 820 if (carl9170_handle_mpdu(ar, buf, mpdu_len, &status)) 819 821 goto drop;
+7
drivers/net/wireless/ath/carl9170/tx.c
··· 1485 1485 } 1486 1486 1487 1487 if (info->flags & IEEE80211_TX_CTL_AMPDU) { 1488 + /* to static code analyzers and reviewers: 1489 + * mac80211 guarantees that a valid "sta" 1490 + * reference is present, if a frame is to 1491 + * be part of an ampdu. Hence any extra 1492 + * sta == NULL checks are redundant in this 1493 + * special case. 1494 + */ 1488 1495 run = carl9170_tx_ampdu_queue(ar, sta, skb); 1489 1496 if (run) 1490 1497 carl9170_tx_ampdu(ar);
+3 -3
drivers/net/wireless/atmel_pci.c
··· 45 45 .name = "atmel", 46 46 .id_table = card_ids, 47 47 .probe = atmel_pci_probe, 48 - .remove = __devexit_p(atmel_pci_remove), 48 + .remove = atmel_pci_remove, 49 49 }; 50 50 51 51 52 - static int __devinit atmel_pci_probe(struct pci_dev *pdev, 52 + static int atmel_pci_probe(struct pci_dev *pdev, 53 53 const struct pci_device_id *pent) 54 54 { 55 55 struct net_device *dev; ··· 69 69 return 0; 70 70 } 71 71 72 - static void __devexit atmel_pci_remove(struct pci_dev *pdev) 72 + static void atmel_pci_remove(struct pci_dev *pdev) 73 73 { 74 74 stop_atmel_card(pci_get_drvdata(pdev)); 75 75 }
+3 -3
drivers/net/wireless/b43/pcmcia.c
··· 60 60 # define b43_pcmcia_resume NULL 61 61 #endif /* CONFIG_PM */ 62 62 63 - static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) 63 + static int b43_pcmcia_probe(struct pcmcia_device *dev) 64 64 { 65 65 struct ssb_bus *ssb; 66 66 int err = -ENOMEM; ··· 110 110 return err; 111 111 } 112 112 113 - static void __devexit b43_pcmcia_remove(struct pcmcia_device *dev) 113 + static void b43_pcmcia_remove(struct pcmcia_device *dev) 114 114 { 115 115 struct ssb_bus *ssb = dev->priv; 116 116 ··· 125 125 .name = "b43-pcmcia", 126 126 .id_table = b43_pcmcia_tbl, 127 127 .probe = b43_pcmcia_probe, 128 - .remove = __devexit_p(b43_pcmcia_remove), 128 + .remove = b43_pcmcia_remove, 129 129 .suspend = b43_pcmcia_suspend, 130 130 .resume = b43_pcmcia_resume, 131 131 };
+3 -3
drivers/net/wireless/b43/sdio.c
··· 93 93 sdio->irq_handler = NULL; 94 94 } 95 95 96 - static int __devinit b43_sdio_probe(struct sdio_func *func, 96 + static int b43_sdio_probe(struct sdio_func *func, 97 97 const struct sdio_device_id *id) 98 98 { 99 99 struct b43_sdio *sdio; ··· 171 171 return error; 172 172 } 173 173 174 - static void __devexit b43_sdio_remove(struct sdio_func *func) 174 + static void b43_sdio_remove(struct sdio_func *func) 175 175 { 176 176 struct b43_sdio *sdio = sdio_get_drvdata(func); 177 177 ··· 193 193 .name = "b43-sdio", 194 194 .id_table = b43_sdio_ids, 195 195 .probe = b43_sdio_probe, 196 - .remove = __devexit_p(b43_sdio_remove), 196 + .remove = b43_sdio_remove, 197 197 }; 198 198 199 199 int b43_sdio_init(void)
+2 -2
drivers/net/wireless/brcm80211/brcmfmac/fweh.c
··· 314 314 while ((event = brcmf_fweh_dequeue_event(fweh))) { 315 315 ifp = drvr->iflist[event->ifidx]; 316 316 317 - brcmf_dbg(EVENT, "event %s (%u) ifidx %u bsscfg %u addr %pM:\n", 317 + brcmf_dbg(EVENT, "event %s (%u) ifidx %u bsscfg %u addr %pM\n", 318 318 brcmf_fweh_event_name(event->code), event->code, 319 319 event->emsg.ifidx, event->emsg.bsscfgidx, 320 320 event->emsg.addr); ··· 337 337 emsg.version, emsg.flags, emsg.status, emsg.reason); 338 338 brcmf_dbg_hex_dump(BRCMF_EVENT_ON(), event->data, 339 339 min_t(u32, emsg.datalen, 64), 340 - "appended:"); 340 + "event payload, len=%d\n", emsg.datalen); 341 341 342 342 /* special handling of interface event */ 343 343 if (event->code == BRCMF_E_IF) {
+1 -1
drivers/net/wireless/brcm80211/brcmfmac/fweh.h
··· 158 158 */ 159 159 struct brcmf_fweh_info { 160 160 struct work_struct event_work; 161 - struct spinlock evt_q_lock; 161 + spinlock_t evt_q_lock; 162 162 struct list_head event_q; 163 163 int (*evt_handler[BRCMF_E_LAST])(struct brcmf_if *ifp, 164 164 const struct brcmf_event_msg *evtmsg,
+56 -83
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
··· 447 447 struct vif_params *params) 448 448 { 449 449 struct brcmf_if *ifp = netdev_priv(ndev); 450 - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 450 + struct brcmf_cfg80211_vif *vif = ifp->vif; 451 451 s32 infra = 0; 452 452 s32 ap = 0; 453 453 s32 err = 0; ··· 461 461 type); 462 462 return -EOPNOTSUPP; 463 463 case NL80211_IFTYPE_ADHOC: 464 - cfg->conf->mode = WL_MODE_IBSS; 464 + vif->mode = WL_MODE_IBSS; 465 465 infra = 0; 466 466 break; 467 467 case NL80211_IFTYPE_STATION: 468 - cfg->conf->mode = WL_MODE_BSS; 468 + vif->mode = WL_MODE_BSS; 469 469 infra = 1; 470 470 break; 471 471 case NL80211_IFTYPE_AP: 472 - cfg->conf->mode = WL_MODE_AP; 472 + vif->mode = WL_MODE_AP; 473 473 ap = 1; 474 474 break; 475 475 default: ··· 478 478 } 479 479 480 480 if (ap) { 481 - set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); 481 + set_bit(BRCMF_VIF_STATUS_AP_CREATING, &vif->sme_state); 482 482 WL_INFO("IF Type = AP\n"); 483 483 } else { 484 - err = brcmf_fil_cmd_int_set(netdev_priv(ndev), 485 - BRCMF_C_SET_INFRA, infra); 484 + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra); 486 485 if (err) { 487 486 WL_ERR("WLC_SET_INFRA error (%d)\n", err); 488 487 err = -EAGAIN; 489 488 goto done; 490 489 } 491 - WL_INFO("IF Type = %s\n", 492 - (cfg->conf->mode == WL_MODE_IBSS) ? 490 + WL_INFO("IF Type = %s\n", (vif->mode == WL_MODE_IBSS) ? 493 491 "Adhoc" : "Infra"); 494 492 } 495 493 ndev->ieee80211_ptr->iftype = type; ··· 961 963 } 962 964 } 963 965 964 - static void brcmf_link_down(struct brcmf_cfg80211_info *cfg) 966 + static void brcmf_link_down(struct brcmf_cfg80211_vif *vif) 965 967 { 966 - struct net_device *ndev = NULL; 967 968 s32 err = 0; 968 969 969 970 WL_TRACE("Enter\n"); 970 971 971 - if (cfg->link_up) { 972 - ndev = cfg_to_ndev(cfg); 972 + if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state)) { 973 973 WL_INFO("Call WLC_DISASSOC to stop excess roaming\n "); 974 - err = brcmf_fil_cmd_data_set(netdev_priv(ndev), 974 + err = brcmf_fil_cmd_data_set(vif->ifp, 975 975 BRCMF_C_DISASSOC, NULL, 0); 976 976 if (err) 977 977 WL_ERR("WLC_DISASSOC failed (%d)\n", err); 978 - cfg->link_up = false; 978 + clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state); 979 979 } 980 + clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state); 980 981 WL_TRACE("Exit\n"); 981 982 } 982 983 ··· 1127 1130 static s32 1128 1131 brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) 1129 1132 { 1130 - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 1131 1133 struct brcmf_if *ifp = netdev_priv(ndev); 1132 1134 s32 err = 0; 1133 1135 ··· 1134 1138 if (!check_vif_up(ifp->vif)) 1135 1139 return -EIO; 1136 1140 1137 - brcmf_link_down(cfg); 1141 + brcmf_link_down(ifp->vif); 1138 1142 1139 1143 WL_TRACE("Exit\n"); 1140 1144 ··· 1492 1496 brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev, 1493 1497 u16 reason_code) 1494 1498 { 1495 - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 1496 1499 struct brcmf_if *ifp = netdev_priv(ndev); 1497 1500 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; 1498 1501 struct brcmf_scb_val_le scbval; ··· 1509 1514 &scbval, sizeof(scbval)); 1510 1515 if (err) 1511 1516 WL_ERR("error (%d)\n", err); 1512 - 1513 - cfg->link_up = false; 1514 1517 1515 1518 WL_TRACE("Exit\n"); 1516 1519 return err; ··· 1709 1716 u8 key_idx, bool pairwise, const u8 *mac_addr, 1710 1717 struct key_params *params) 1711 1718 { 1712 - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 1713 1719 struct brcmf_if *ifp = netdev_priv(ndev); 1714 1720 struct brcmf_wsec_key key; 1715 1721 s32 val; ··· 1750 1758 WL_CONN("WLAN_CIPHER_SUITE_WEP104\n"); 1751 1759 break; 1752 1760 case WLAN_CIPHER_SUITE_TKIP: 1753 - if (cfg->conf->mode != WL_MODE_AP) { 1761 + if (ifp->vif->mode != WL_MODE_AP) { 1754 1762 WL_CONN("Swapping key\n"); 1755 1763 memcpy(keybuf, &key.data[24], sizeof(keybuf)); 1756 1764 memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); ··· 1900 1908 brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, 1901 1909 u8 *mac, struct station_info *sinfo) 1902 1910 { 1903 - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 1904 1911 struct brcmf_if *ifp = netdev_priv(ndev); 1905 1912 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; 1906 1913 struct brcmf_scb_val_le scb_val; ··· 1913 1922 if (!check_vif_up(ifp->vif)) 1914 1923 return -EIO; 1915 1924 1916 - if (cfg->conf->mode == WL_MODE_AP) { 1925 + if (ifp->vif->mode == WL_MODE_AP) { 1917 1926 memcpy(&sta_info_le, mac, ETH_ALEN); 1918 1927 err = brcmf_fil_iovar_data_get(ifp, "sta_info", 1919 1928 &sta_info_le, ··· 1930 1939 } 1931 1940 WL_TRACE("STA idle time : %d ms, connected time :%d sec\n", 1932 1941 sinfo->inactive_time, sinfo->connected_time); 1933 - } else if (cfg->conf->mode == WL_MODE_BSS) { 1942 + } else if (ifp->vif->mode == WL_MODE_BSS) { 1934 1943 if (memcmp(mac, bssid, ETH_ALEN)) { 1935 1944 WL_ERR("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n", 1936 1945 mac, bssid); ··· 2240 2249 return err; 2241 2250 } 2242 2251 2243 - static bool brcmf_is_ibssmode(struct brcmf_cfg80211_info *cfg) 2252 + static bool brcmf_is_ibssmode(struct brcmf_cfg80211_vif *vif) 2244 2253 { 2245 - return cfg->conf->mode == WL_MODE_IBSS; 2254 + return vif->mode == WL_MODE_IBSS; 2246 2255 } 2247 2256 2248 2257 /* ··· 2327 2336 s32 err = 0; 2328 2337 2329 2338 WL_TRACE("Enter\n"); 2330 - if (brcmf_is_ibssmode(cfg)) 2339 + if (brcmf_is_ibssmode(ifp->vif)) 2331 2340 return err; 2332 2341 2333 2342 ssid = &profile->ssid; ··· 2587 2596 * While going to suspend if associated with AP disassociate 2588 2597 * from AP to save power while system is in suspended state 2589 2598 */ 2590 - if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state) || 2591 - test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) { 2592 - WL_INFO("Disassociating from AP before suspend\n"); 2593 - brcmf_link_down(cfg); 2599 + brcmf_link_down(vif); 2594 2600 2595 - /* Make sure WPA_Supplicant receives all the event 2596 - * generated due to DISASSOC call to the fw to keep 2597 - * the state fw and WPA_Supplicant state consistent 2598 - */ 2599 - brcmf_delay(500); 2600 - } 2601 + /* Make sure WPA_Supplicant receives all the event 2602 + * generated due to DISASSOC call to the fw to keep 2603 + * the state fw and WPA_Supplicant state consistent 2604 + */ 2605 + brcmf_delay(500); 2601 2606 } 2602 2607 2603 2608 /* end any scanning */ ··· 3293 3306 if (vndr_ies->count >= MAX_VNDR_IE_NUMBER) 3294 3307 break; 3295 3308 next: 3296 - remaining_len -= ie->len; 3297 - if (remaining_len <= 2) 3309 + remaining_len -= (ie->len + TLV_HDR_LEN); 3310 + if (remaining_len <= TLV_HDR_LEN) 3298 3311 ie = NULL; 3299 3312 else 3300 - ie = (struct brcmf_tlv *)(((u8 *)ie) + ie->len); 3313 + ie = (struct brcmf_tlv *)(((u8 *)ie) + ie->len + 3314 + TLV_HDR_LEN); 3301 3315 } 3302 3316 return err; 3303 3317 } ··· 3397 3409 } 3398 3410 } 3399 3411 3400 - if (mgmt_ie_buf != NULL) { 3412 + if (mgmt_ie_buf && *mgmt_ie_len) { 3401 3413 if (parsed_ie_buf_len && (parsed_ie_buf_len == *mgmt_ie_len) && 3402 3414 (memcmp(mgmt_ie_buf, curr_ie_buf, 3403 3415 parsed_ie_buf_len) == 0)) { 3404 - WL_TRACE("Previous mgmt IE is equals to current IE"); 3416 + WL_TRACE("Previous mgmt IE equals to current IE\n"); 3405 3417 goto exit; 3406 3418 } 3407 3419 ··· 3439 3451 for (i = 0; i < new_vndr_ies.count; i++) { 3440 3452 vndrie_info = &new_vndr_ies.ie_info[i]; 3441 3453 3454 + /* verify remained buf size before copy data */ 3455 + if (remained_buf_len < (vndrie_info->vndrie.len + 3456 + VNDR_IE_VSIE_OFFSET)) { 3457 + WL_ERR("no space in mgmt_ie_buf: len left %d", 3458 + remained_buf_len); 3459 + break; 3460 + } 3461 + remained_buf_len -= (vndrie_info->ie_len + 3462 + VNDR_IE_VSIE_OFFSET); 3463 + 3442 3464 WL_TRACE("ADDED ID : %d, Len: %d, OUI:%02x:%02x:%02x\n", 3443 3465 vndrie_info->vndrie.id, 3444 3466 vndrie_info->vndrie.len, ··· 3460 3462 vndrie_info->ie_ptr, 3461 3463 vndrie_info->ie_len, 3462 3464 "add"); 3463 - /* verify remained buf size before copy data */ 3464 - remained_buf_len -= vndrie_info->ie_len; 3465 - if (remained_buf_len < 0) { 3466 - WL_ERR("no space in mgmt_ie_buf: len left %d", 3467 - remained_buf_len); 3468 - break; 3469 - } 3470 3465 3471 3466 /* save the parsed IE in wl struct */ 3472 3467 memcpy(ptr + (*mgmt_ie_len), vndrie_info->ie_ptr, ··· 3634 3643 static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) 3635 3644 { 3636 3645 struct brcmf_if *ifp = netdev_priv(ndev); 3637 - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 3638 3646 s32 err = -EPERM; 3639 3647 3640 3648 WL_TRACE("Enter\n"); 3641 3649 3642 - if (cfg->conf->mode == WL_MODE_AP) { 3650 + if (ifp->vif->mode == WL_MODE_AP) { 3643 3651 /* Due to most likely deauths outstanding we sleep */ 3644 3652 /* first to make sure they get processed by fw. */ 3645 3653 msleep(400); 3646 - err = brcmf_fil_cmd_int_set(netdev_priv(ndev), 3647 - BRCMF_C_SET_AP, 0); 3654 + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); 3648 3655 if (err < 0) { 3649 3656 WL_ERR("setting AP mode failed %d\n", err); 3650 3657 goto exit; 3651 3658 } 3652 - err = brcmf_fil_cmd_int_set(netdev_priv(ndev), BRCMF_C_UP, 0); 3659 + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 0); 3653 3660 if (err < 0) { 3654 3661 WL_ERR("BRCMF_C_UP error %d\n", err); 3655 3662 goto exit; ··· 3838 3849 } 3839 3850 } 3840 3851 3841 - static bool brcmf_is_linkup(struct brcmf_cfg80211_info *cfg, 3842 - const struct brcmf_event_msg *e) 3852 + static bool brcmf_is_linkup(const struct brcmf_event_msg *e) 3843 3853 { 3844 3854 u32 event = e->event_code; 3845 3855 u32 status = e->status; 3846 3856 3847 3857 if (event == BRCMF_E_SET_SSID && status == BRCMF_E_STATUS_SUCCESS) { 3848 3858 WL_CONN("Processing set ssid\n"); 3849 - cfg->link_up = true; 3850 3859 return true; 3851 3860 } 3852 3861 3853 3862 return false; 3854 3863 } 3855 3864 3856 - static bool brcmf_is_linkdown(struct brcmf_cfg80211_info *cfg, 3857 - const struct brcmf_event_msg *e) 3865 + static bool brcmf_is_linkdown(const struct brcmf_event_msg *e) 3858 3866 { 3859 3867 u32 event = e->event_code; 3860 3868 u16 flags = e->flags; ··· 4101 4115 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; 4102 4116 s32 err = 0; 4103 4117 4104 - if (cfg->conf->mode == WL_MODE_AP) { 4118 + if (ifp->vif->mode == WL_MODE_AP) { 4105 4119 err = brcmf_notify_connect_status_ap(cfg, ndev, e, data); 4106 - } else if (brcmf_is_linkup(cfg, e)) { 4120 + } else if (brcmf_is_linkup(e)) { 4107 4121 WL_CONN("Linkup\n"); 4108 - if (brcmf_is_ibssmode(cfg)) { 4122 + if (brcmf_is_ibssmode(ifp->vif)) { 4109 4123 memcpy(profile->bssid, e->addr, ETH_ALEN); 4110 4124 wl_inform_ibss(cfg, ndev, e->addr); 4111 4125 cfg80211_ibss_joined(ndev, e->addr, GFP_KERNEL); ··· 4115 4129 &ifp->vif->sme_state); 4116 4130 } else 4117 4131 brcmf_bss_connect_done(cfg, ndev, e, true); 4118 - } else if (brcmf_is_linkdown(cfg, e)) { 4132 + } else if (brcmf_is_linkdown(e)) { 4119 4133 WL_CONN("Linkdown\n"); 4120 - if (brcmf_is_ibssmode(cfg)) { 4121 - clear_bit(BRCMF_VIF_STATUS_CONNECTING, 4122 - &ifp->vif->sme_state); 4123 - if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, 4124 - &ifp->vif->sme_state)) 4125 - brcmf_link_down(cfg); 4126 - } else { 4134 + if (!brcmf_is_ibssmode(ifp->vif)) { 4127 4135 brcmf_bss_connect_done(cfg, ndev, e, false); 4128 4136 if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, 4129 - &ifp->vif->sme_state)) { 4137 + &ifp->vif->sme_state)) 4130 4138 cfg80211_disconnected(ndev, 0, NULL, 0, 4131 4139 GFP_KERNEL); 4132 - brcmf_link_down(cfg); 4133 - } 4134 4140 } 4141 + brcmf_link_down(ifp->vif); 4135 4142 brcmf_init_prof(ndev_to_prof(ndev)); 4136 4143 } else if (brcmf_is_nonetwork(cfg, e)) { 4137 - if (brcmf_is_ibssmode(cfg)) 4144 + if (brcmf_is_ibssmode(ifp->vif)) 4138 4145 clear_bit(BRCMF_VIF_STATUS_CONNECTING, 4139 4146 &ifp->vif->sme_state); 4140 4147 else ··· 4176 4197 4177 4198 static void brcmf_init_conf(struct brcmf_cfg80211_conf *conf) 4178 4199 { 4179 - conf->mode = (u32)-1; 4180 4200 conf->frag_threshold = (u32)-1; 4181 4201 conf->rts_threshold = (u32)-1; 4182 4202 conf->retry_short = (u32)-1; ··· 4260 4282 mutex_init(&cfg->usr_sync); 4261 4283 brcmf_init_escan(cfg); 4262 4284 brcmf_init_conf(cfg->conf); 4263 - brcmf_link_down(cfg); 4264 4285 4265 4286 return err; 4266 4287 } ··· 4267 4290 static void wl_deinit_priv(struct brcmf_cfg80211_info *cfg) 4268 4291 { 4269 4292 cfg->dongle_up = false; /* dongle down */ 4270 - brcmf_link_down(cfg); 4271 4293 brcmf_abort_scanning(cfg); 4272 4294 brcmf_deinit_priv_mem(cfg); 4273 4295 } ··· 4513 4537 * While going down, if associated with AP disassociate 4514 4538 * from AP to save power 4515 4539 */ 4516 - if ((test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state) || 4517 - test_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) && 4518 - check_vif_up(ifp->vif)) { 4519 - WL_INFO("Disassociating from AP"); 4520 - brcmf_link_down(cfg); 4540 + if (check_vif_up(ifp->vif)) { 4541 + brcmf_link_down(ifp->vif); 4521 4542 4522 4543 /* Make sure WPA_Supplicant receives all the event 4523 4544 generated due to DISASSOC call to the fw to keep
-3
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
··· 128 128 129 129 /* dongle configuration */ 130 130 struct brcmf_cfg80211_conf { 131 - u32 mode; /* adhoc , infrastructure or ap */ 132 131 u32 frag_threshold; 133 132 u32 rts_threshold; 134 133 u32 retry_short; ··· 358 359 * @active_scan: current scan mode. 359 360 * @sched_escan: e-scan for scheduled scan support running. 360 361 * @ibss_starter: indicates this sta is ibss starter. 361 - * @link_up: link/connection up flag. 362 362 * @pwr_save: indicate whether dongle to support power save mode. 363 363 * @dongle_up: indicate whether dongle up or not. 364 364 * @roam_on: on/off switch for dongle self-roaming. ··· 389 391 bool active_scan; 390 392 bool sched_escan; 391 393 bool ibss_starter; 392 - bool link_up; 393 394 bool pwr_save; 394 395 bool dongle_up; 395 396 bool roam_on;
+112
drivers/net/wireless/brcm80211/brcmsmac/debug.c
··· 1 + /* 2 + * Copyright (c) 2012 Broadcom Corporation 3 + * Copyright (c) 2012 Canonical Ltd. 4 + * 5 + * Permission to use, copy, modify, and/or distribute this software for any 6 + * purpose with or without fee is hereby granted, provided that the above 7 + * copyright notice and this permission notice appear in all copies. 8 + * 9 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 12 + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 14 + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 15 + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 + */ 17 + #include <linux/debugfs.h> 18 + #include <linux/if_ether.h> 19 + #include <linux/if.h> 1 20 #include <linux/net.h> 21 + #include <linux/netdevice.h> 22 + #include <linux/ieee80211.h> 23 + #include <linux/module.h> 24 + #include <net/mac80211.h> 25 + 26 + #include <defs.h> 27 + #include <brcmu_wifi.h> 28 + #include <brcmu_utils.h> 2 29 #include "types.h" 30 + #include "main.h" 3 31 #include "debug.h" 4 32 #include "brcms_trace_events.h" 33 + 34 + static struct dentry *root_folder; 35 + 36 + void brcms_debugfs_init(void) 37 + { 38 + root_folder = debugfs_create_dir(KBUILD_MODNAME, NULL); 39 + if (IS_ERR(root_folder)) 40 + root_folder = NULL; 41 + } 42 + 43 + void brcms_debugfs_exit(void) 44 + { 45 + if (!root_folder) 46 + return; 47 + 48 + debugfs_remove_recursive(root_folder); 49 + root_folder = NULL; 50 + } 51 + 52 + int brcms_debugfs_attach(struct brcms_pub *drvr) 53 + { 54 + if (!root_folder) 55 + return -ENODEV; 56 + 57 + drvr->dbgfs_dir = debugfs_create_dir( 58 + dev_name(&drvr->wlc->hw->d11core->dev), root_folder); 59 + return PTR_RET(drvr->dbgfs_dir); 60 + } 61 + 62 + void brcms_debugfs_detach(struct brcms_pub *drvr) 63 + { 64 + if (!IS_ERR_OR_NULL(drvr->dbgfs_dir)) 65 + debugfs_remove_recursive(drvr->dbgfs_dir); 66 + } 67 + 68 + struct dentry *brcms_debugfs_get_devdir(struct brcms_pub *drvr) 69 + { 70 + return drvr->dbgfs_dir; 71 + } 72 + 73 + static 74 + ssize_t brcms_debugfs_hardware_read(struct file *f, char __user *data, 75 + size_t count, loff_t *ppos) 76 + { 77 + char buf[128]; 78 + int res; 79 + struct brcms_pub *drvr = f->private_data; 80 + 81 + /* only allow read from start */ 82 + if (*ppos > 0) 83 + return 0; 84 + 85 + res = scnprintf(buf, sizeof(buf), 86 + "board vendor: %x\n" 87 + "board type: %x\n" 88 + "board revision: %x\n" 89 + "board flags: %x\n" 90 + "board flags2: %x\n" 91 + "firmware revision: %x\n", 92 + drvr->wlc->hw->d11core->bus->boardinfo.vendor, 93 + drvr->wlc->hw->d11core->bus->boardinfo.type, 94 + drvr->wlc->hw->boardrev, 95 + drvr->wlc->hw->boardflags, 96 + drvr->wlc->hw->boardflags2, 97 + drvr->wlc->ucode_rev 98 + ); 99 + 100 + return simple_read_from_buffer(data, count, ppos, buf, res); 101 + } 102 + 103 + static const struct file_operations brcms_debugfs_hardware_ops = { 104 + .owner = THIS_MODULE, 105 + .open = simple_open, 106 + .read = brcms_debugfs_hardware_read 107 + }; 108 + 109 + void brcms_debugfs_create_files(struct brcms_pub *drvr) 110 + { 111 + struct dentry *dentry = drvr->dbgfs_dir; 112 + 113 + if (!IS_ERR_OR_NULL(dentry)) 114 + debugfs_create_file("hardware", S_IRUGO, dentry, 115 + drvr, &brcms_debugfs_hardware_ops); 116 + } 5 117 6 118 #define __brcms_fn(fn) \ 7 119 void __brcms_ ##fn(struct device *dev, const char *fmt, ...) \
+23
drivers/net/wireless/brcm80211/brcmsmac/debug.h
··· 1 + /* 2 + * Copyright (c) 2012 Broadcom Corporation 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 ANY 11 + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 + */ 1 16 #ifndef _BRCMS_DEBUG_H_ 2 17 #define _BRCMS_DEBUG_H_ 3 18 ··· 63 48 #define brcms_dbg_int(core, f, a...) brcms_dbg(core, BRCM_DL_INT, f, ##a) 64 49 #define brcms_dbg_dma(core, f, a...) brcms_dbg(core, BRCM_DL_DMA, f, ##a) 65 50 #define brcms_dbg_ht(core, f, a...) brcms_dbg(core, BRCM_DL_HT, f, ##a) 51 + 52 + struct brcms_pub; 53 + void brcms_debugfs_init(void); 54 + void brcms_debugfs_exit(void); 55 + int brcms_debugfs_attach(struct brcms_pub *drvr); 56 + void brcms_debugfs_detach(struct brcms_pub *drvr); 57 + struct dentry *brcms_debugfs_get_devdir(struct brcms_pub *drvr); 58 + void brcms_debugfs_create_files(struct brcms_pub *drvr); 66 59 67 60 #endif /* _BRCMS_DEBUG_H_ */
+1 -3
drivers/net/wireless/brcm80211/brcmsmac/dma.c
··· 349 349 { 350 350 uint dmactrlflags; 351 351 352 - if (di == NULL) { 353 - brcms_dbg_dma(di->core, "NULL dma handle\n"); 352 + if (di == NULL) 354 353 return 0; 355 - } 356 354 357 355 dmactrlflags = di->dma.dmactrlflags; 358 356 dmactrlflags &= ~mask;
+17 -16
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
··· 285 285 kfree_skb(skb); 286 286 goto done; 287 287 } 288 - brcms_c_sendpkt_mac80211(wl->wlc, skb, hw); 289 - tx_info->rate_driver_data[0] = control->sta; 288 + if (brcms_c_sendpkt_mac80211(wl->wlc, skb, hw)) 289 + tx_info->rate_driver_data[0] = control->sta; 290 290 done: 291 291 spin_unlock_bh(&wl->lock); 292 292 } ··· 846 846 /* kill dpc */ 847 847 tasklet_kill(&wl->tasklet); 848 848 849 - if (wl->pub) 849 + if (wl->pub) { 850 + brcms_debugfs_detach(wl->pub); 850 851 brcms_c_module_unregister(wl->pub, "linux", wl); 852 + } 851 853 852 854 /* free common resources */ 853 855 if (wl->wlc) { ··· 898 896 static irqreturn_t brcms_isr(int irq, void *dev_id) 899 897 { 900 898 struct brcms_info *wl; 901 - bool ours, wantdpc; 899 + irqreturn_t ret = IRQ_NONE; 902 900 903 901 wl = (struct brcms_info *) dev_id; 904 902 905 903 spin_lock(&wl->isr_lock); 906 904 907 905 /* call common first level interrupt handler */ 908 - ours = brcms_c_isr(wl->wlc, &wantdpc); 909 - if (ours) { 910 - /* if more to do... */ 911 - if (wantdpc) { 912 - 913 - /* ...and call the second level interrupt handler */ 914 - /* schedule dpc */ 915 - tasklet_schedule(&wl->tasklet); 916 - } 906 + if (brcms_c_isr(wl->wlc)) { 907 + /* schedule second level handler */ 908 + tasklet_schedule(&wl->tasklet); 909 + ret = IRQ_HANDLED; 917 910 } 918 911 919 912 spin_unlock(&wl->isr_lock); 920 913 921 - return IRQ_RETVAL(ours); 914 + return ret; 922 915 } 923 916 924 917 /* ··· 1079 1082 regulatory_hint(wl->wiphy, wl->pub->srom_ccode)) 1080 1083 wiphy_err(wl->wiphy, "%s: regulatory hint failed\n", __func__); 1081 1084 1085 + brcms_debugfs_attach(wl->pub); 1086 + brcms_debugfs_create_files(wl->pub); 1082 1087 n_adapters_found++; 1083 1088 return wl; 1084 1089 ··· 1099 1100 * 1100 1101 * Perimeter lock is initialized in the course of this function. 1101 1102 */ 1102 - static int __devinit brcms_bcma_probe(struct bcma_device *pdev) 1103 + static int brcms_bcma_probe(struct bcma_device *pdev) 1103 1104 { 1104 1105 struct brcms_info *wl; 1105 1106 struct ieee80211_hw *hw; ··· 1165 1166 .probe = brcms_bcma_probe, 1166 1167 .suspend = brcms_suspend, 1167 1168 .resume = brcms_resume, 1168 - .remove = __devexit_p(brcms_remove), 1169 + .remove = brcms_remove, 1169 1170 .id_table = brcms_coreid_table, 1170 1171 }; 1171 1172 ··· 1189 1190 1190 1191 static int __init brcms_module_init(void) 1191 1192 { 1193 + brcms_debugfs_init(); 1192 1194 if (!schedule_work(&brcms_driver_work)) 1193 1195 return -EBUSY; 1194 1196 ··· 1207 1207 { 1208 1208 cancel_work_sync(&brcms_driver_work); 1209 1209 bcma_driver_unregister(&brcms_bcma_driver); 1210 + brcms_debugfs_exit(); 1210 1211 } 1211 1212 1212 1213 module_init(brcms_module_init);
+31 -30
drivers/net/wireless/brcm80211/brcmsmac/main.c
··· 1044 1044 s1 = bcma_read32(core, D11REGOFFS(frmtxstatus)); 1045 1045 while (!(*fatal) 1046 1046 && (s1 & TXS_V)) { 1047 + /* !give others some time to run! */ 1048 + if (n >= max_tx_num) { 1049 + morepending = true; 1050 + break; 1051 + } 1047 1052 1048 1053 if (s1 == 0xffffffff) { 1049 1054 brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, 1050 1055 __func__); 1051 - return morepending; 1056 + *fatal = true; 1057 + return false; 1052 1058 } 1053 1059 s2 = bcma_read32(core, D11REGOFFS(frmtxstatus2)); 1054 1060 ··· 1066 1060 1067 1061 *fatal = brcms_c_dotxstatus(wlc_hw->wlc, txs); 1068 1062 1069 - /* !give others some time to run! */ 1070 - if (++n >= max_tx_num) 1071 - break; 1072 1063 s1 = bcma_read32(core, D11REGOFFS(frmtxstatus)); 1064 + n++; 1073 1065 } 1074 1066 1075 1067 if (*fatal) 1076 - return 0; 1077 - 1078 - if (n >= max_tx_num) 1079 - morepending = true; 1068 + return false; 1080 1069 1081 1070 return morepending; 1082 1071 } ··· 2547 2546 if (macintstatus == 0) 2548 2547 return 0; 2549 2548 2550 - /* interrupts are already turned off for CFE build 2551 - * Caution: For CFE Turning off the interrupts again has some undesired 2552 - * consequences 2553 - */ 2554 2549 /* turn off the interrupts */ 2555 2550 bcma_write32(core, D11REGOFFS(macintmask), 0); 2556 2551 (void)bcma_read32(core, D11REGOFFS(macintmask)); ··· 2589 2592 2590 2593 /* 2591 2594 * First-level interrupt processing. 2592 - * Return true if this was our interrupt, false otherwise. 2593 - * *wantdpc will be set to true if further brcms_c_dpc() processing is required, 2595 + * Return true if this was our interrupt 2596 + * and if further brcms_c_dpc() processing is required, 2594 2597 * false otherwise. 2595 2598 */ 2596 - bool brcms_c_isr(struct brcms_c_info *wlc, bool *wantdpc) 2599 + bool brcms_c_isr(struct brcms_c_info *wlc) 2597 2600 { 2598 2601 struct brcms_hardware *wlc_hw = wlc->hw; 2599 2602 u32 macintstatus; 2600 - 2601 - *wantdpc = false; 2602 2603 2603 2604 if (!wlc_hw->up || !wlc->macintmask) 2604 2605 return false; ··· 2604 2609 /* read and clear macintstatus and intstatus registers */ 2605 2610 macintstatus = wlc_intstatus(wlc, true); 2606 2611 2607 - if (macintstatus == 0xffffffff) 2612 + if (macintstatus == 0xffffffff) { 2608 2613 brcms_err(wlc_hw->d11core, 2609 2614 "DEVICEREMOVED detected in the ISR code path\n"); 2615 + return false; 2616 + } 2610 2617 2611 2618 /* it is not for us */ 2612 2619 if (macintstatus == 0) 2613 2620 return false; 2614 - 2615 - *wantdpc = true; 2616 2621 2617 2622 /* save interrupt status bits */ 2618 2623 wlc->macintstatus = macintstatus; ··· 6923 6928 return ret; 6924 6929 } 6925 6930 6926 - void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu, 6931 + bool brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu, 6927 6932 struct ieee80211_hw *hw) 6928 6933 { 6929 6934 uint fifo; 6930 6935 struct scb *scb = &wlc->pri_scb; 6931 6936 6932 6937 fifo = brcms_ac_to_fifo(skb_get_queue_mapping(sdu)); 6933 - if (brcms_c_d11hdrs_mac80211(wlc, hw, sdu, scb, 0, 1, fifo, 0)) 6934 - return; 6935 - if (brcms_c_tx(wlc, sdu)) 6936 - dev_kfree_skb_any(sdu); 6938 + brcms_c_d11hdrs_mac80211(wlc, hw, sdu, scb, 0, 1, fifo, 0); 6939 + if (!brcms_c_tx(wlc, sdu)) 6940 + return true; 6941 + 6942 + /* packet discarded */ 6943 + dev_kfree_skb_any(sdu); 6944 + return false; 6937 6945 } 6938 6946 6939 6947 int ··· 7632 7634 7633 7635 uint n = 0; 7634 7636 uint bound_limit = bound ? RXBND : -1; 7637 + bool morepending; 7635 7638 7636 7639 skb_queue_head_init(&recv_frames); 7637 7640 7638 7641 /* gather received frames */ 7639 - while (dma_rx(wlc_hw->di[fifo], &recv_frames)) { 7640 - 7642 + do { 7641 7643 /* !give others some time to run! */ 7642 - if (++n >= bound_limit) 7644 + if (n >= bound_limit) 7643 7645 break; 7644 - } 7646 + 7647 + morepending = dma_rx(wlc_hw->di[fifo], &recv_frames); 7648 + n++; 7649 + } while (morepending); 7645 7650 7646 7651 /* post more rbufs */ 7647 7652 dma_rxfill(wlc_hw->di[fifo]); ··· 7674 7673 brcms_c_recv(wlc_hw->wlc, p); 7675 7674 } 7676 7675 7677 - return n >= bound_limit; 7676 + return morepending; 7678 7677 } 7679 7678 7680 7679 /* second-level interrupt processing
+302 -191
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
··· 1137 1137 gain0_15 = ((biq1 & 0xf) << 12) | 1138 1138 ((tia & 0xf) << 8) | 1139 1139 ((lna2 & 0x3) << 6) | 1140 - ((lna2 & 1141 - 0x3) << 4) | ((lna1 & 0x3) << 2) | ((lna1 & 0x3) << 0); 1140 + ((lna2 & 0x3) << 4) | 1141 + ((lna1 & 0x3) << 2) | 1142 + ((lna1 & 0x3) << 0); 1142 1143 1143 1144 mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); 1144 1145 mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); ··· 1157 1156 } 1158 1157 1159 1158 mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0); 1159 + mod_phy_reg(pi, 0x4b1, (0x3 << 11), lna1 << 11); 1160 + mod_phy_reg(pi, 0x4e6, (0x3 << 3), lna1 << 3); 1160 1161 1161 1162 } 1162 1163 ··· 1331 1328 return (iq_est.i_pwr + iq_est.q_pwr) / nsamples; 1332 1329 } 1333 1330 1331 + static bool wlc_lcnphy_rx_iq_cal_gain(struct brcms_phy *pi, u16 biq1_gain, 1332 + u16 tia_gain, u16 lna2_gain) 1333 + { 1334 + u32 i_thresh_l, q_thresh_l; 1335 + u32 i_thresh_h, q_thresh_h; 1336 + struct lcnphy_iq_est iq_est_h, iq_est_l; 1337 + 1338 + wlc_lcnphy_set_rx_gain_by_distribution(pi, 0, 0, 0, biq1_gain, tia_gain, 1339 + lna2_gain, 0); 1340 + 1341 + wlc_lcnphy_rx_gain_override_enable(pi, true); 1342 + wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0); 1343 + usleep_range(500, 500); 1344 + write_radio_reg(pi, RADIO_2064_REG112, 0); 1345 + if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l)) 1346 + return false; 1347 + 1348 + wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0); 1349 + usleep_range(500, 500); 1350 + write_radio_reg(pi, RADIO_2064_REG112, 0); 1351 + if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h)) 1352 + return false; 1353 + 1354 + i_thresh_l = (iq_est_l.i_pwr << 1); 1355 + i_thresh_h = (iq_est_l.i_pwr << 2) + iq_est_l.i_pwr; 1356 + 1357 + q_thresh_l = (iq_est_l.q_pwr << 1); 1358 + q_thresh_h = (iq_est_l.q_pwr << 2) + iq_est_l.q_pwr; 1359 + if ((iq_est_h.i_pwr > i_thresh_l) && 1360 + (iq_est_h.i_pwr < i_thresh_h) && 1361 + (iq_est_h.q_pwr > q_thresh_l) && 1362 + (iq_est_h.q_pwr < q_thresh_h)) 1363 + return true; 1364 + 1365 + return false; 1366 + } 1367 + 1334 1368 static bool 1335 1369 wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, 1336 1370 const struct lcnphy_rx_iqcomp *iqcomp, ··· 1382 1342 RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, 1383 1343 rfoverride3_old, rfoverride3val_old, rfoverride4_old, 1384 1344 rfoverride4val_old, afectrlovr_old, afectrlovrval_old; 1385 - int tia_gain; 1386 - u32 received_power, rx_pwr_threshold; 1345 + int tia_gain, lna2_gain, biq1_gain; 1346 + bool set_gain; 1387 1347 u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl; 1388 1348 u16 values_to_save[11]; 1389 1349 s16 *ptr; ··· 1408 1368 goto cal_done; 1409 1369 } 1410 1370 1411 - if (module == 1) { 1371 + WARN_ON(module != 1); 1372 + tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); 1373 + wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); 1412 1374 1413 - tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); 1414 - wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); 1375 + for (i = 0; i < 11; i++) 1376 + values_to_save[i] = 1377 + read_radio_reg(pi, rxiq_cal_rf_reg[i]); 1378 + Core1TxControl_old = read_phy_reg(pi, 0x631); 1415 1379 1416 - for (i = 0; i < 11; i++) 1417 - values_to_save[i] = 1418 - read_radio_reg(pi, rxiq_cal_rf_reg[i]); 1419 - Core1TxControl_old = read_phy_reg(pi, 0x631); 1380 + or_phy_reg(pi, 0x631, 0x0015); 1420 1381 1421 - or_phy_reg(pi, 0x631, 0x0015); 1382 + RFOverride0_old = read_phy_reg(pi, 0x44c); 1383 + RFOverrideVal0_old = read_phy_reg(pi, 0x44d); 1384 + rfoverride2_old = read_phy_reg(pi, 0x4b0); 1385 + rfoverride2val_old = read_phy_reg(pi, 0x4b1); 1386 + rfoverride3_old = read_phy_reg(pi, 0x4f9); 1387 + rfoverride3val_old = read_phy_reg(pi, 0x4fa); 1388 + rfoverride4_old = read_phy_reg(pi, 0x938); 1389 + rfoverride4val_old = read_phy_reg(pi, 0x939); 1390 + afectrlovr_old = read_phy_reg(pi, 0x43b); 1391 + afectrlovrval_old = read_phy_reg(pi, 0x43c); 1392 + old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); 1393 + old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); 1422 1394 1423 - RFOverride0_old = read_phy_reg(pi, 0x44c); 1424 - RFOverrideVal0_old = read_phy_reg(pi, 0x44d); 1425 - rfoverride2_old = read_phy_reg(pi, 0x4b0); 1426 - rfoverride2val_old = read_phy_reg(pi, 0x4b1); 1427 - rfoverride3_old = read_phy_reg(pi, 0x4f9); 1428 - rfoverride3val_old = read_phy_reg(pi, 0x4fa); 1429 - rfoverride4_old = read_phy_reg(pi, 0x938); 1430 - rfoverride4val_old = read_phy_reg(pi, 0x939); 1431 - afectrlovr_old = read_phy_reg(pi, 0x43b); 1432 - afectrlovrval_old = read_phy_reg(pi, 0x43c); 1433 - old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); 1434 - old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); 1435 - 1436 - tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); 1437 - if (tx_gain_override_old) { 1438 - wlc_lcnphy_get_tx_gain(pi, &old_gains); 1439 - tx_gain_index_old = pi_lcn->lcnphy_current_index; 1440 - } 1441 - 1442 - wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx); 1443 - 1444 - mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); 1445 - mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); 1446 - 1447 - mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); 1448 - mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); 1449 - 1450 - write_radio_reg(pi, RADIO_2064_REG116, 0x06); 1451 - write_radio_reg(pi, RADIO_2064_REG12C, 0x07); 1452 - write_radio_reg(pi, RADIO_2064_REG06A, 0xd3); 1453 - write_radio_reg(pi, RADIO_2064_REG098, 0x03); 1454 - write_radio_reg(pi, RADIO_2064_REG00B, 0x7); 1455 - mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4); 1456 - write_radio_reg(pi, RADIO_2064_REG01D, 0x01); 1457 - write_radio_reg(pi, RADIO_2064_REG114, 0x01); 1458 - write_radio_reg(pi, RADIO_2064_REG02E, 0x10); 1459 - write_radio_reg(pi, RADIO_2064_REG12A, 0x08); 1460 - 1461 - mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0); 1462 - mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0); 1463 - mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1); 1464 - mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1); 1465 - mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2); 1466 - mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2); 1467 - mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3); 1468 - mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3); 1469 - mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5); 1470 - mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5); 1471 - 1472 - mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); 1473 - mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); 1474 - 1475 - wlc_lcnphy_start_tx_tone(pi, 2000, 120, 0); 1476 - write_phy_reg(pi, 0x6da, 0xffff); 1477 - or_phy_reg(pi, 0x6db, 0x3); 1478 - wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); 1479 - wlc_lcnphy_rx_gain_override_enable(pi, true); 1480 - 1481 - tia_gain = 8; 1482 - rx_pwr_threshold = 950; 1483 - while (tia_gain > 0) { 1484 - tia_gain -= 1; 1485 - wlc_lcnphy_set_rx_gain_by_distribution(pi, 1486 - 0, 0, 2, 2, 1487 - (u16) 1488 - tia_gain, 1, 0); 1489 - udelay(500); 1490 - 1491 - received_power = 1492 - wlc_lcnphy_measure_digital_power(pi, 2000); 1493 - if (received_power < rx_pwr_threshold) 1494 - break; 1495 - } 1496 - result = wlc_lcnphy_calc_rx_iq_comp(pi, 0xffff); 1497 - 1498 - wlc_lcnphy_stop_tx_tone(pi); 1499 - 1500 - write_phy_reg(pi, 0x631, Core1TxControl_old); 1501 - 1502 - write_phy_reg(pi, 0x44c, RFOverrideVal0_old); 1503 - write_phy_reg(pi, 0x44d, RFOverrideVal0_old); 1504 - write_phy_reg(pi, 0x4b0, rfoverride2_old); 1505 - write_phy_reg(pi, 0x4b1, rfoverride2val_old); 1506 - write_phy_reg(pi, 0x4f9, rfoverride3_old); 1507 - write_phy_reg(pi, 0x4fa, rfoverride3val_old); 1508 - write_phy_reg(pi, 0x938, rfoverride4_old); 1509 - write_phy_reg(pi, 0x939, rfoverride4val_old); 1510 - write_phy_reg(pi, 0x43b, afectrlovr_old); 1511 - write_phy_reg(pi, 0x43c, afectrlovrval_old); 1512 - write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); 1513 - write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl); 1514 - 1515 - wlc_lcnphy_clear_trsw_override(pi); 1516 - 1517 - mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); 1518 - 1519 - for (i = 0; i < 11; i++) 1520 - write_radio_reg(pi, rxiq_cal_rf_reg[i], 1521 - values_to_save[i]); 1522 - 1523 - if (tx_gain_override_old) 1524 - wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); 1525 - else 1526 - wlc_lcnphy_disable_tx_gain_override(pi); 1527 - 1528 - wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); 1529 - wlc_lcnphy_rx_gain_override_enable(pi, false); 1395 + tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); 1396 + if (tx_gain_override_old) { 1397 + wlc_lcnphy_get_tx_gain(pi, &old_gains); 1398 + tx_gain_index_old = pi_lcn->lcnphy_current_index; 1530 1399 } 1400 + 1401 + wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx); 1402 + 1403 + mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); 1404 + mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); 1405 + 1406 + mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); 1407 + mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); 1408 + 1409 + write_radio_reg(pi, RADIO_2064_REG116, 0x06); 1410 + write_radio_reg(pi, RADIO_2064_REG12C, 0x07); 1411 + write_radio_reg(pi, RADIO_2064_REG06A, 0xd3); 1412 + write_radio_reg(pi, RADIO_2064_REG098, 0x03); 1413 + write_radio_reg(pi, RADIO_2064_REG00B, 0x7); 1414 + mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4); 1415 + write_radio_reg(pi, RADIO_2064_REG01D, 0x01); 1416 + write_radio_reg(pi, RADIO_2064_REG114, 0x01); 1417 + write_radio_reg(pi, RADIO_2064_REG02E, 0x10); 1418 + write_radio_reg(pi, RADIO_2064_REG12A, 0x08); 1419 + 1420 + mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0); 1421 + mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0); 1422 + mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1); 1423 + mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1); 1424 + mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2); 1425 + mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2); 1426 + mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3); 1427 + mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3); 1428 + mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5); 1429 + mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5); 1430 + 1431 + mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); 1432 + mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); 1433 + 1434 + write_phy_reg(pi, 0x6da, 0xffff); 1435 + or_phy_reg(pi, 0x6db, 0x3); 1436 + 1437 + wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); 1438 + set_gain = false; 1439 + 1440 + lna2_gain = 3; 1441 + while ((lna2_gain >= 0) && !set_gain) { 1442 + tia_gain = 4; 1443 + 1444 + while ((tia_gain >= 0) && !set_gain) { 1445 + biq1_gain = 6; 1446 + 1447 + while ((biq1_gain >= 0) && !set_gain) { 1448 + set_gain = wlc_lcnphy_rx_iq_cal_gain(pi, 1449 + (u16) 1450 + biq1_gain, 1451 + (u16) 1452 + tia_gain, 1453 + (u16) 1454 + lna2_gain); 1455 + biq1_gain -= 1; 1456 + } 1457 + tia_gain -= 1; 1458 + } 1459 + lna2_gain -= 1; 1460 + } 1461 + 1462 + if (set_gain) 1463 + result = wlc_lcnphy_calc_rx_iq_comp(pi, 1024); 1464 + else 1465 + result = false; 1466 + 1467 + wlc_lcnphy_stop_tx_tone(pi); 1468 + 1469 + write_phy_reg(pi, 0x631, Core1TxControl_old); 1470 + 1471 + write_phy_reg(pi, 0x44c, RFOverrideVal0_old); 1472 + write_phy_reg(pi, 0x44d, RFOverrideVal0_old); 1473 + write_phy_reg(pi, 0x4b0, rfoverride2_old); 1474 + write_phy_reg(pi, 0x4b1, rfoverride2val_old); 1475 + write_phy_reg(pi, 0x4f9, rfoverride3_old); 1476 + write_phy_reg(pi, 0x4fa, rfoverride3val_old); 1477 + write_phy_reg(pi, 0x938, rfoverride4_old); 1478 + write_phy_reg(pi, 0x939, rfoverride4val_old); 1479 + write_phy_reg(pi, 0x43b, afectrlovr_old); 1480 + write_phy_reg(pi, 0x43c, afectrlovrval_old); 1481 + write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); 1482 + write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl); 1483 + 1484 + wlc_lcnphy_clear_trsw_override(pi); 1485 + 1486 + mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); 1487 + 1488 + for (i = 0; i < 11; i++) 1489 + write_radio_reg(pi, rxiq_cal_rf_reg[i], 1490 + values_to_save[i]); 1491 + 1492 + if (tx_gain_override_old) 1493 + wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); 1494 + else 1495 + wlc_lcnphy_disable_tx_gain_override(pi); 1496 + 1497 + wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); 1498 + wlc_lcnphy_rx_gain_override_enable(pi, false); 1531 1499 1532 1500 cal_done: 1533 1501 kfree(ptr); ··· 1829 1781 write_radio_reg(pi, RADIO_2064_REG038, 3); 1830 1782 write_radio_reg(pi, RADIO_2064_REG091, 7); 1831 1783 } 1784 + 1785 + if (!(pi->sh->boardflags & BFL_FEM)) { 1786 + u8 reg038[14] = {0xd, 0xe, 0xd, 0xd, 0xd, 0xc, 1787 + 0xa, 0xb, 0xb, 0x3, 0x3, 0x2, 0x0, 0x0}; 1788 + 1789 + write_radio_reg(pi, RADIO_2064_REG02A, 0xf); 1790 + write_radio_reg(pi, RADIO_2064_REG091, 0x3); 1791 + write_radio_reg(pi, RADIO_2064_REG038, 0x3); 1792 + 1793 + write_radio_reg(pi, RADIO_2064_REG038, reg038[channel - 1]); 1794 + } 1832 1795 } 1833 1796 1834 1797 static int ··· 1919 1860 return (filt_index != -1) ? 0 : -1; 1920 1861 } 1921 1862 1922 - void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, u16 chanspec) 1923 - { 1924 - u8 channel = CHSPEC_CHANNEL(chanspec); 1925 - 1926 - wlc_phy_chanspec_radio_set((struct brcms_phy_pub *) pi, chanspec); 1927 - 1928 - wlc_lcnphy_set_chanspec_tweaks(pi, pi->radio_chanspec); 1929 - 1930 - or_phy_reg(pi, 0x44a, 0x44); 1931 - write_phy_reg(pi, 0x44a, 0x80); 1932 - 1933 - wlc_lcnphy_radio_2064_channel_tune_4313(pi, channel); 1934 - udelay(1000); 1935 - 1936 - wlc_lcnphy_toggle_afe_pwdn(pi); 1937 - 1938 - write_phy_reg(pi, 0x657, lcnphy_sfo_cfg[channel - 1].ptcentreTs20); 1939 - write_phy_reg(pi, 0x658, lcnphy_sfo_cfg[channel - 1].ptcentreFactor); 1940 - 1941 - if (CHSPEC_CHANNEL(pi->radio_chanspec) == 14) { 1942 - mod_phy_reg(pi, 0x448, (0x3 << 8), (2) << 8); 1943 - 1944 - wlc_lcnphy_load_tx_iir_filter(pi, false, 3); 1945 - } else { 1946 - mod_phy_reg(pi, 0x448, (0x3 << 8), (1) << 8); 1947 - 1948 - wlc_lcnphy_load_tx_iir_filter(pi, false, 2); 1949 - } 1950 - 1951 - wlc_lcnphy_load_tx_iir_filter(pi, true, 0); 1952 - 1953 - mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); 1954 - 1955 - } 1956 - 1957 1863 static u16 wlc_lcnphy_get_pa_gain(struct brcms_phy *pi) 1958 1864 { 1959 1865 u16 pa_gain; ··· 1958 1934 wlc_lcnphy_set_dac_gain(pi, target_gains->dac_gain); 1959 1935 1960 1936 wlc_lcnphy_enable_tx_gain_override(pi); 1937 + } 1938 + 1939 + static u8 wlc_lcnphy_get_bbmult(struct brcms_phy *pi) 1940 + { 1941 + u16 m0m1; 1942 + struct phytbl_info tab; 1943 + 1944 + tab.tbl_ptr = &m0m1; 1945 + tab.tbl_len = 1; 1946 + tab.tbl_id = LCNPHY_TBL_ID_IQLOCAL; 1947 + tab.tbl_offset = 87; 1948 + tab.tbl_width = 16; 1949 + wlc_lcnphy_read_table(pi, &tab); 1950 + 1951 + return (u8) ((m0m1 & 0xff00) >> 8); 1961 1952 } 1962 1953 1963 1954 static void wlc_lcnphy_set_bbmult(struct brcms_phy *pi, u8 m0) ··· 2034 1995 } else { 2035 1996 mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1); 2036 1997 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); 1998 + mod_radio_reg(pi, RADIO_2064_REG028, 0x1, 0x0); 1999 + mod_radio_reg(pi, RADIO_2064_REG11A, 0x4, 1<<2); 2000 + mod_radio_reg(pi, RADIO_2064_REG036, 0x10, 0x0); 2001 + mod_radio_reg(pi, RADIO_2064_REG11A, 0x10, 1<<4); 2002 + mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0); 2003 + mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x77); 2004 + mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, 0xe<<1); 2005 + mod_radio_reg(pi, RADIO_2064_REG112, 0x80, 1<<7); 2006 + mod_radio_reg(pi, RADIO_2064_REG005, 0x7, 1<<1); 2007 + mod_radio_reg(pi, RADIO_2064_REG029, 0xf0, 0<<4); 2037 2008 } 2038 2009 } else { 2039 2010 mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2); ··· 2130 2081 (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); 2131 2082 2132 2083 mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5)); 2084 + mod_radio_reg(pi, RADIO_2064_REG07C, (1 << 0), (1 << 0)); 2133 2085 } 2134 2086 2135 2087 static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) 2136 2088 { 2137 2089 struct phytbl_info tab; 2138 2090 u32 rfseq, ind; 2091 + u8 tssi_sel; 2139 2092 2140 2093 tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; 2141 2094 tab.tbl_width = 32; ··· 2159 2108 2160 2109 mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4); 2161 2110 2162 - wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT); 2111 + if (pi->sh->boardflags & BFL_FEM) { 2112 + tssi_sel = 0x1; 2113 + wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT); 2114 + } else { 2115 + tssi_sel = 0xe; 2116 + wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_POST_PA); 2117 + } 2163 2118 mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); 2164 2119 2165 2120 mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15); ··· 2201 2144 mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0); 2202 2145 2203 2146 if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { 2204 - mod_radio_reg(pi, RADIO_2064_REG028, 0xf, 0xe); 2147 + mod_radio_reg(pi, RADIO_2064_REG028, 0xf, tssi_sel); 2205 2148 mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); 2206 2149 } else { 2150 + mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, tssi_sel << 1); 2207 2151 mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); 2208 2152 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3); 2209 2153 } ··· 2250 2192 mod_phy_reg(pi, 0x4d7, (0x1 << 2), (1) << 2); 2251 2193 2252 2194 mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8); 2195 + 2196 + mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x0); 2197 + mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0); 2198 + mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); 2253 2199 2254 2200 wlc_lcnphy_pwrctrl_rssiparams(pi); 2255 2201 } ··· 2873 2811 read_radio_reg(pi, RADIO_2064_REG007) & 1; 2874 2812 u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10; 2875 2813 u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4; 2814 + u8 SAVE_bbmult = wlc_lcnphy_get_bbmult(pi); 2815 + 2876 2816 idleTssi = read_phy_reg(pi, 0x4ab); 2877 2817 suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & 2878 2818 MCTL_EN_MAC)); ··· 2892 2828 mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4); 2893 2829 mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2); 2894 2830 wlc_lcnphy_tssi_setup(pi); 2831 + 2832 + mod_phy_reg(pi, 0x4d7, (0x1 << 0), (1 << 0)); 2833 + mod_phy_reg(pi, 0x4d7, (0x1 << 6), (1 << 6)); 2834 + 2835 + wlc_lcnphy_set_bbmult(pi, 0x0); 2836 + 2895 2837 wlc_phy_do_dummy_tx(pi, true, OFF); 2896 2838 idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) 2897 2839 >> 0); ··· 2919 2849 2920 2850 mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12); 2921 2851 2852 + wlc_lcnphy_set_bbmult(pi, SAVE_bbmult); 2922 2853 wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old); 2923 2854 wlc_lcnphy_set_tx_gain(pi, &old_gains); 2924 2855 wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); ··· 3133 3062 wlc_lcnphy_write_table(pi, &tab); 3134 3063 tab.tbl_offset++; 3135 3064 } 3065 + mod_phy_reg(pi, 0x4d0, (0x1 << 0), (0) << 0); 3066 + mod_phy_reg(pi, 0x4d3, (0xff << 0), (0) << 0); 3067 + mod_phy_reg(pi, 0x4d3, (0xff << 8), (0) << 8); 3068 + mod_phy_reg(pi, 0x4d0, (0x1 << 4), (0) << 4); 3069 + mod_phy_reg(pi, 0x4d0, (0x1 << 2), (0) << 2); 3136 3070 3137 3071 mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7); 3138 3072 ··· 3149 3073 } 3150 3074 if (!suspend) 3151 3075 wlapi_enable_mac(pi->sh->physhim); 3152 - } 3153 - 3154 - static u8 wlc_lcnphy_get_bbmult(struct brcms_phy *pi) 3155 - { 3156 - u16 m0m1; 3157 - struct phytbl_info tab; 3158 - 3159 - tab.tbl_ptr = &m0m1; 3160 - tab.tbl_len = 1; 3161 - tab.tbl_id = LCNPHY_TBL_ID_IQLOCAL; 3162 - tab.tbl_offset = 87; 3163 - tab.tbl_width = 16; 3164 - wlc_lcnphy_read_table(pi, &tab); 3165 - 3166 - return (u8) ((m0m1 & 0xff00) >> 8); 3167 3076 } 3168 3077 3169 3078 static void wlc_lcnphy_set_pa_gain(struct brcms_phy *pi, u16 gain) ··· 3939 3878 target_gains.pad_gain = 21; 3940 3879 target_gains.dac_gain = 0; 3941 3880 wlc_lcnphy_set_tx_gain(pi, &target_gains); 3942 - wlc_lcnphy_set_tx_pwr_by_index(pi, 16); 3943 3881 3944 3882 if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) { 3945 3883 ··· 3949 3889 lcnphy_recal ? LCNPHY_CAL_RECAL : 3950 3890 LCNPHY_CAL_FULL), false); 3951 3891 } else { 3892 + wlc_lcnphy_set_tx_pwr_by_index(pi, 16); 3952 3893 wlc_lcnphy_tx_iqlo_soft_cal_full(pi); 3953 3894 } 3954 3895 ··· 4374 4313 if (CHSPEC_IS5G(pi->radio_chanspec)) 4375 4314 pa_gain = 0x70; 4376 4315 else 4377 - pa_gain = 0x70; 4316 + pa_gain = 0x60; 4378 4317 4379 4318 if (pi->sh->boardflags & BFL_FEM) 4380 4319 pa_gain = 0x10; 4320 + 4381 4321 tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; 4382 4322 tab.tbl_width = 32; 4383 4323 tab.tbl_len = 1; 4384 4324 tab.tbl_ptr = &val; 4385 4325 4386 4326 for (j = 0; j < 128; j++) { 4387 - gm_gain = gain_table[j].gm; 4327 + if (pi->sh->boardflags & BFL_FEM) 4328 + gm_gain = gain_table[j].gm; 4329 + else 4330 + gm_gain = 15; 4331 + 4388 4332 val = (((u32) pa_gain << 24) | 4389 4333 (gain_table[j].pad << 16) | 4390 4334 (gain_table[j].pga << 8) | gm_gain); ··· 4600 4534 4601 4535 write_phy_reg(pi, 0x4ea, 0x4688); 4602 4536 4603 - mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0); 4537 + if (pi->sh->boardflags & BFL_FEM) 4538 + mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0); 4539 + else 4540 + mod_phy_reg(pi, 0x4eb, (0x7 << 0), 3 << 0); 4604 4541 4605 4542 mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6); 4606 4543 ··· 4614 4545 wlc_lcnphy_rcal(pi); 4615 4546 4616 4547 wlc_lcnphy_rc_cal(pi); 4548 + 4549 + if (!(pi->sh->boardflags & BFL_FEM)) { 4550 + write_radio_reg(pi, RADIO_2064_REG032, 0x6f); 4551 + write_radio_reg(pi, RADIO_2064_REG033, 0x19); 4552 + write_radio_reg(pi, RADIO_2064_REG039, 0xe); 4553 + } 4554 + 4617 4555 } 4618 4556 4619 4557 static void wlc_lcnphy_radio_init(struct brcms_phy *pi) ··· 4650 4574 wlc_lcnphy_write_table(pi, &tab); 4651 4575 } 4652 4576 4653 - tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; 4654 - tab.tbl_width = 16; 4655 - tab.tbl_ptr = &val; 4656 - tab.tbl_len = 1; 4577 + if (!(pi->sh->boardflags & BFL_FEM)) { 4578 + tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; 4579 + tab.tbl_width = 16; 4580 + tab.tbl_ptr = &val; 4581 + tab.tbl_len = 1; 4657 4582 4658 - val = 114; 4659 - tab.tbl_offset = 0; 4660 - wlc_lcnphy_write_table(pi, &tab); 4583 + val = 150; 4584 + tab.tbl_offset = 0; 4585 + wlc_lcnphy_write_table(pi, &tab); 4661 4586 4662 - val = 130; 4663 - tab.tbl_offset = 1; 4664 - wlc_lcnphy_write_table(pi, &tab); 4665 - 4666 - val = 6; 4667 - tab.tbl_offset = 8; 4668 - wlc_lcnphy_write_table(pi, &tab); 4587 + val = 220; 4588 + tab.tbl_offset = 1; 4589 + wlc_lcnphy_write_table(pi, &tab); 4590 + } 4669 4591 4670 4592 if (CHSPEC_IS2G(pi->radio_chanspec)) { 4671 4593 if (pi->sh->boardflags & BFL_FEM) ··· 5020 4946 } 5021 4947 } 5022 4948 4949 + void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, u16 chanspec) 4950 + { 4951 + u8 channel = CHSPEC_CHANNEL(chanspec); 4952 + 4953 + wlc_phy_chanspec_radio_set((struct brcms_phy_pub *)pi, chanspec); 4954 + 4955 + wlc_lcnphy_set_chanspec_tweaks(pi, pi->radio_chanspec); 4956 + 4957 + or_phy_reg(pi, 0x44a, 0x44); 4958 + write_phy_reg(pi, 0x44a, 0x80); 4959 + 4960 + wlc_lcnphy_radio_2064_channel_tune_4313(pi, channel); 4961 + udelay(1000); 4962 + 4963 + wlc_lcnphy_toggle_afe_pwdn(pi); 4964 + 4965 + write_phy_reg(pi, 0x657, lcnphy_sfo_cfg[channel - 1].ptcentreTs20); 4966 + write_phy_reg(pi, 0x658, lcnphy_sfo_cfg[channel - 1].ptcentreFactor); 4967 + 4968 + if (CHSPEC_CHANNEL(pi->radio_chanspec) == 14) { 4969 + mod_phy_reg(pi, 0x448, (0x3 << 8), (2) << 8); 4970 + 4971 + wlc_lcnphy_load_tx_iir_filter(pi, false, 3); 4972 + } else { 4973 + mod_phy_reg(pi, 0x448, (0x3 << 8), (1) << 8); 4974 + 4975 + wlc_lcnphy_load_tx_iir_filter(pi, false, 2); 4976 + } 4977 + 4978 + if (pi->sh->boardflags & BFL_FEM) 4979 + wlc_lcnphy_load_tx_iir_filter(pi, true, 0); 4980 + else 4981 + wlc_lcnphy_load_tx_iir_filter(pi, true, 3); 4982 + 4983 + mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); 4984 + wlc_lcnphy_tssi_setup(pi); 4985 + } 4986 + 5023 4987 void wlc_phy_detach_lcnphy(struct brcms_phy *pi) 5024 4988 { 5025 4989 kfree(pi->u.pi_lcnphy); ··· 5094 4982 if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) 5095 4983 return false; 5096 4984 5097 - if ((pi->sh->boardflags & BFL_FEM) && 5098 - (LCNREV_IS(pi->pubpi.phy_rev, 1))) { 4985 + if (LCNREV_IS(pi->pubpi.phy_rev, 1)) { 5099 4986 if (pi_lcn->lcnphy_tempsense_option == 3) { 5100 4987 pi->hwpwrctrl = true; 5101 4988 pi->hwpwrctrl_capable = true;
+33 -33
drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c
··· 1992 1992 }; 1993 1993 1994 1994 static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = { 1995 - 0x000a, 1996 1995 0x0009, 1997 - 0x0006, 1998 - 0x0005, 1999 1996 0x000a, 2000 - 0x0009, 2001 - 0x0006, 2002 1997 0x0005, 1998 + 0x0006, 1999 + 0x0009, 2003 2000 0x000a, 2004 - 0x0009, 2005 - 0x0006, 2006 2001 0x0005, 2002 + 0x0006, 2003 + 0x0009, 2007 2004 0x000a, 2008 - 0x0009, 2009 - 0x0006, 2010 2005 0x0005, 2006 + 0x0006, 2007 + 0x0009, 2011 2008 0x000a, 2012 - 0x0009, 2013 - 0x0006, 2014 2009 0x0005, 2010 + 0x0006, 2011 + 0x0009, 2015 2012 0x000a, 2016 - 0x0009, 2017 - 0x0006, 2018 2013 0x0005, 2014 + 0x0006, 2015 + 0x0009, 2019 2016 0x000a, 2020 - 0x0009, 2021 - 0x0006, 2022 2017 0x0005, 2018 + 0x0006, 2019 + 0x0009, 2023 2020 0x000a, 2024 - 0x0009, 2025 - 0x0006, 2026 2021 0x0005, 2022 + 0x0006, 2023 + 0x0009, 2027 2024 0x000a, 2028 - 0x0009, 2029 - 0x0006, 2030 2025 0x0005, 2026 + 0x0006, 2027 + 0x0009, 2031 2028 0x000a, 2032 - 0x0009, 2033 - 0x0006, 2034 2029 0x0005, 2030 + 0x0006, 2031 + 0x0009, 2035 2032 0x000a, 2036 - 0x0009, 2037 - 0x0006, 2038 2033 0x0005, 2034 + 0x0006, 2035 + 0x0009, 2039 2036 0x000a, 2040 - 0x0009, 2041 - 0x0006, 2042 2037 0x0005, 2038 + 0x0006, 2039 + 0x0009, 2043 2040 0x000a, 2044 - 0x0009, 2045 - 0x0006, 2046 2041 0x0005, 2042 + 0x0006, 2043 + 0x0009, 2047 2044 0x000a, 2048 - 0x0009, 2049 - 0x0006, 2050 2045 0x0005, 2046 + 0x0006, 2047 + 0x0009, 2051 2048 0x000a, 2052 - 0x0009, 2053 - 0x0006, 2054 2049 0x0005, 2050 + 0x0006, 2051 + 0x0009, 2055 2052 0x000a, 2056 - 0x0009, 2057 - 0x0006, 2058 2053 0x0005, 2054 + 0x0006, 2055 + 0x0009, 2056 + 0x000a, 2057 + 0x0005, 2058 + 0x0006, 2059 2059 }; 2060 2060 2061 2061 static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = {
+3 -2
drivers/net/wireless/brcm80211/brcmsmac/pub.h
··· 176 176 bool phy_11ncapable; /* the PHY/HW is capable of 802.11N */ 177 177 178 178 struct wl_cnt *_cnt; /* low-level counters in driver */ 179 + struct dentry *dbgfs_dir; 179 180 }; 180 181 181 182 enum wlc_par_id { ··· 283 282 extern u32 brcms_c_intrsoff(struct brcms_c_info *wlc); 284 283 extern void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask); 285 284 extern bool brcms_c_intrsupd(struct brcms_c_info *wlc); 286 - extern bool brcms_c_isr(struct brcms_c_info *wlc, bool *wantdpc); 285 + extern bool brcms_c_isr(struct brcms_c_info *wlc); 287 286 extern bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded); 288 - extern void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, 287 + extern bool brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, 289 288 struct sk_buff *sdu, 290 289 struct ieee80211_hw *hw); 291 290 extern bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid);
+2 -2
drivers/net/wireless/ipw2x00/ipw2100.c
··· 6410 6410 goto out; 6411 6411 } 6412 6412 6413 - static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev) 6413 + static void ipw2100_pci_remove_one(struct pci_dev *pci_dev) 6414 6414 { 6415 6415 struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); 6416 6416 struct net_device *dev = priv->net_dev; ··· 6606 6606 .name = DRV_NAME, 6607 6607 .id_table = ipw2100_pci_id_table, 6608 6608 .probe = ipw2100_pci_init_one, 6609 - .remove = __devexit_p(ipw2100_pci_remove_one), 6609 + .remove = ipw2100_pci_remove_one, 6610 6610 #ifdef CONFIG_PM 6611 6611 .suspend = ipw2100_suspend, 6612 6612 .resume = ipw2100_resume,
+5 -7
drivers/net/wireless/ipw2x00/ipw2200.c
··· 6812 6812 struct libipw_device *ieee = priv->ieee; 6813 6813 struct lib80211_crypt_data *crypt; 6814 6814 struct iw_param *param = &wrqu->param; 6815 - int ret = 0; 6816 6815 6817 6816 switch (param->flags & IW_AUTH_INDEX) { 6818 6817 case IW_AUTH_WPA_VERSION: ··· 6821 6822 /* 6822 6823 * wpa_supplicant will control these internally 6823 6824 */ 6824 - ret = -EOPNOTSUPP; 6825 - break; 6825 + return -EOPNOTSUPP; 6826 6826 6827 6827 case IW_AUTH_TKIP_COUNTERMEASURES: 6828 6828 crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx]; ··· 10772 10774 mutex_unlock(&priv->mutex); 10773 10775 } 10774 10776 10775 - static int __devinit ipw_setup_deferred_work(struct ipw_priv *priv) 10777 + static int ipw_setup_deferred_work(struct ipw_priv *priv) 10776 10778 { 10777 10779 int ret = 0; 10778 10780 ··· 11726 11728 .ndo_validate_addr = eth_validate_addr, 11727 11729 }; 11728 11730 11729 - static int __devinit ipw_pci_probe(struct pci_dev *pdev, 11731 + static int ipw_pci_probe(struct pci_dev *pdev, 11730 11732 const struct pci_device_id *ent) 11731 11733 { 11732 11734 int err = 0; ··· 11899 11901 return err; 11900 11902 } 11901 11903 11902 - static void __devexit ipw_pci_remove(struct pci_dev *pdev) 11904 + static void ipw_pci_remove(struct pci_dev *pdev) 11903 11905 { 11904 11906 struct ipw_priv *priv = pci_get_drvdata(pdev); 11905 11907 struct list_head *p, *q; ··· 12061 12063 .name = DRV_NAME, 12062 12064 .id_table = card_ids, 12063 12065 .probe = ipw_pci_probe, 12064 - .remove = __devexit_p(ipw_pci_remove), 12066 + .remove = ipw_pci_remove, 12065 12067 #ifdef CONFIG_PM 12066 12068 .suspend = ipw_pci_suspend, 12067 12069 .resume = ipw_pci_resume,
+2 -2
drivers/net/wireless/iwlegacy/3945-mac.c
··· 3794 3794 return err; 3795 3795 } 3796 3796 3797 - static void __devexit 3797 + static void 3798 3798 il3945_pci_remove(struct pci_dev *pdev) 3799 3799 { 3800 3800 struct il_priv *il = pci_get_drvdata(pdev); ··· 3884 3884 .name = DRV_NAME, 3885 3885 .id_table = il3945_hw_card_ids, 3886 3886 .probe = il3945_pci_probe, 3887 - .remove = __devexit_p(il3945_pci_remove), 3887 + .remove = il3945_pci_remove, 3888 3888 .driver.pm = IL_LEGACY_PM_OPS, 3889 3889 }; 3890 3890
+2 -2
drivers/net/wireless/iwlegacy/4965-mac.c
··· 6664 6664 return err; 6665 6665 } 6666 6666 6667 - static void __devexit 6667 + static void 6668 6668 il4965_pci_remove(struct pci_dev *pdev) 6669 6669 { 6670 6670 struct il_priv *il = pci_get_drvdata(pdev); ··· 6772 6772 .name = DRV_NAME, 6773 6773 .id_table = il4965_hw_card_ids, 6774 6774 .probe = il4965_pci_probe, 6775 - .remove = __devexit_p(il4965_pci_remove), 6775 + .remove = il4965_pci_remove, 6776 6776 .driver.pm = IL_LEGACY_PM_OPS, 6777 6777 }; 6778 6778
+6 -6
drivers/net/wireless/iwlwifi/dvm/rxon.c
··· 1012 1012 * As a consequence, it's not as complicated as it sounds, just add 1013 1013 * any lower rates to the ACK rate bitmap. 1014 1014 */ 1015 - if (IWL_RATE_11M_INDEX < lowest_present_ofdm) 1016 - ofdm |= IWL_RATE_11M_MASK >> IWL_FIRST_CCK_RATE; 1017 - if (IWL_RATE_5M_INDEX < lowest_present_ofdm) 1018 - ofdm |= IWL_RATE_5M_MASK >> IWL_FIRST_CCK_RATE; 1019 - if (IWL_RATE_2M_INDEX < lowest_present_ofdm) 1020 - ofdm |= IWL_RATE_2M_MASK >> IWL_FIRST_CCK_RATE; 1015 + if (IWL_RATE_11M_INDEX < lowest_present_cck) 1016 + cck |= IWL_RATE_11M_MASK >> IWL_FIRST_CCK_RATE; 1017 + if (IWL_RATE_5M_INDEX < lowest_present_cck) 1018 + cck |= IWL_RATE_5M_MASK >> IWL_FIRST_CCK_RATE; 1019 + if (IWL_RATE_2M_INDEX < lowest_present_cck) 1020 + cck |= IWL_RATE_2M_MASK >> IWL_FIRST_CCK_RATE; 1021 1021 /* 1M already there or needed so always add */ 1022 1022 cck |= IWL_RATE_1M_MASK >> IWL_FIRST_CCK_RATE; 1023 1023
+2 -2
drivers/net/wireless/iwlwifi/pcie/drv.c
··· 293 293 return -EFAULT; 294 294 } 295 295 296 - static void __devexit iwl_pci_remove(struct pci_dev *pdev) 296 + static void iwl_pci_remove(struct pci_dev *pdev) 297 297 { 298 298 struct iwl_trans *trans = pci_get_drvdata(pdev); 299 299 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); ··· 352 352 .name = DRV_NAME, 353 353 .id_table = iwl_hw_card_ids, 354 354 .probe = iwl_pci_probe, 355 - .remove = __devexit_p(iwl_pci_remove), 355 + .remove = iwl_pci_remove, 356 356 .driver.pm = IWL_PM_OPS, 357 357 }; 358 358
+8 -1
drivers/net/wireless/libertas/cfg.c
··· 298 298 const u8 *rates_eid, *ext_rates_eid; 299 299 int n = 0; 300 300 301 + rcu_read_lock(); 301 302 rates_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SUPP_RATES); 302 303 ext_rates_eid = ieee80211_bss_get_ie(bss, WLAN_EID_EXT_SUPP_RATES); 303 304 ··· 326 325 *tlv++ = 0x96; 327 326 n = 4; 328 327 } 328 + rcu_read_unlock(); 329 329 330 330 rate_tlv->header.len = cpu_to_le16(n); 331 331 return sizeof(rate_tlv->header) + n; ··· 1142 1140 cmd->capability = cpu_to_le16(bss->capability); 1143 1141 1144 1142 /* add SSID TLV */ 1143 + rcu_read_lock(); 1145 1144 ssid_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SSID); 1146 1145 if (ssid_eid) 1147 1146 pos += lbs_add_ssid_tlv(pos, ssid_eid + 2, ssid_eid[1]); 1148 1147 else 1149 1148 lbs_deb_assoc("no SSID\n"); 1149 + rcu_read_unlock(); 1150 1150 1151 1151 /* add DS param TLV */ 1152 1152 if (bss->channel) ··· 1786 1782 struct cfg80211_ibss_params *params, 1787 1783 struct cfg80211_bss *bss) 1788 1784 { 1789 - const u8 *rates_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SUPP_RATES); 1785 + const u8 *rates_eid; 1790 1786 struct cmd_ds_802_11_ad_hoc_join cmd; 1791 1787 u8 preamble = RADIO_PREAMBLE_SHORT; 1792 1788 int ret = 0; ··· 1845 1841 1846 1842 /* set rates to the intersection of our rates and the rates in the 1847 1843 bss */ 1844 + rcu_read_lock(); 1845 + rates_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SUPP_RATES); 1848 1846 if (!rates_eid) { 1849 1847 lbs_add_rates(cmd.bss.rates); 1850 1848 } else { ··· 1866 1860 } 1867 1861 } 1868 1862 } 1863 + rcu_read_unlock(); 1869 1864 1870 1865 /* Only v8 and below support setting this */ 1871 1866 if (MRVL_FW_MAJOR_REV(priv->fwrelease) <= 8) {
+3 -3
drivers/net/wireless/libertas/if_spi.c
··· 1124 1124 } 1125 1125 } 1126 1126 1127 - static int __devinit if_spi_probe(struct spi_device *spi) 1127 + static int if_spi_probe(struct spi_device *spi) 1128 1128 { 1129 1129 struct if_spi_card *card; 1130 1130 struct lbs_private *priv = NULL; ··· 1226 1226 return err; 1227 1227 } 1228 1228 1229 - static int __devexit libertas_spi_remove(struct spi_device *spi) 1229 + static int libertas_spi_remove(struct spi_device *spi) 1230 1230 { 1231 1231 struct if_spi_card *card = spi_get_drvdata(spi); 1232 1232 struct lbs_private *priv = card->priv; ··· 1285 1285 1286 1286 static struct spi_driver libertas_spi_driver = { 1287 1287 .probe = if_spi_probe, 1288 - .remove = __devexit_p(libertas_spi_remove), 1288 + .remove = libertas_spi_remove, 1289 1289 .driver = { 1290 1290 .name = "libertas_spi", 1291 1291 .owner = THIS_MODULE,
+6 -1
drivers/net/wireless/mac80211_hwsim.c
··· 1347 1347 hwsim->hw_scan_vif, 1348 1348 req->ssids[i].ssid, 1349 1349 req->ssids[i].ssid_len, 1350 - req->ie, req->ie_len); 1350 + req->ie_len); 1351 1351 if (!probe) 1352 1352 continue; 1353 + 1354 + if (req->ie_len) 1355 + memcpy(skb_put(probe, req->ie_len), req->ie, 1356 + req->ie_len); 1357 + 1353 1358 local_bh_disable(); 1354 1359 mac80211_hwsim_tx_frame(hwsim->hw, probe, 1355 1360 hwsim->tmp_chan);
+15
drivers/net/wireless/mwifiex/cfg80211.c
··· 1948 1948 else 1949 1949 ht_info->cap &= ~IEEE80211_HT_CAP_TX_STBC; 1950 1950 1951 + if (ISSUPP_GREENFIELD(adapter->hw_dot_11n_dev_cap)) 1952 + ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; 1953 + else 1954 + ht_info->cap &= ~IEEE80211_HT_CAP_GRN_FLD; 1955 + 1956 + if (ISENABLED_40MHZ_INTOLERANT(adapter->hw_dot_11n_dev_cap)) 1957 + ht_info->cap |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; 1958 + else 1959 + ht_info->cap &= ~IEEE80211_HT_CAP_40MHZ_INTOLERANT; 1960 + 1961 + if (ISSUPP_RXLDPC(adapter->hw_dot_11n_dev_cap)) 1962 + ht_info->cap |= IEEE80211_HT_CAP_LDPC_CODING; 1963 + else 1964 + ht_info->cap &= ~IEEE80211_HT_CAP_LDPC_CODING; 1965 + 1951 1966 ht_info->cap &= ~IEEE80211_HT_CAP_MAX_AMSDU; 1952 1967 ht_info->cap |= IEEE80211_HT_CAP_SM_PS; 1953 1968
+2
drivers/net/wireless/mwifiex/fw.h
··· 194 194 #define ISSUPP_TXSTBC(Dot11nDevCap) (Dot11nDevCap & BIT(25)) 195 195 #define ISSUPP_RXSTBC(Dot11nDevCap) (Dot11nDevCap & BIT(26)) 196 196 #define ISSUPP_GREENFIELD(Dot11nDevCap) (Dot11nDevCap & BIT(29)) 197 + #define ISENABLED_40MHZ_INTOLERANT(Dot11nDevCap) (Dot11nDevCap & BIT(8)) 198 + #define ISSUPP_RXLDPC(Dot11nDevCap) (Dot11nDevCap & BIT(22)) 197 199 198 200 /* httxcfg bitmap 199 201 * 0 reserved
+27 -9
drivers/net/wireless/mwifiex/sta_ioctl.c
··· 160 160 { 161 161 int ret; 162 162 u8 *beacon_ie; 163 + size_t beacon_ie_len; 163 164 struct mwifiex_bss_priv *bss_priv = (void *)bss->priv; 165 + const struct cfg80211_bss_ies *ies; 164 166 165 - beacon_ie = kmemdup(bss->information_elements, bss->len_beacon_ies, 166 - GFP_KERNEL); 167 + rcu_read_lock(); 168 + ies = rcu_dereference(bss->ies); 169 + if (WARN_ON(!ies)) { 170 + /* should never happen */ 171 + rcu_read_unlock(); 172 + return -EINVAL; 173 + } 174 + beacon_ie = kmemdup(ies->data, ies->len, GFP_ATOMIC); 175 + beacon_ie_len = ies->len; 176 + rcu_read_unlock(); 177 + 167 178 if (!beacon_ie) { 168 179 dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n"); 169 180 return -ENOMEM; ··· 183 172 memcpy(bss_desc->mac_address, bss->bssid, ETH_ALEN); 184 173 bss_desc->rssi = bss->signal; 185 174 bss_desc->beacon_buf = beacon_ie; 186 - bss_desc->beacon_buf_size = bss->len_beacon_ies; 175 + bss_desc->beacon_buf_size = beacon_ie_len; 187 176 bss_desc->beacon_period = bss->beacon_interval; 188 177 bss_desc->cap_info_bitmap = bss->capability; 189 178 bss_desc->bss_band = bss_priv->band; ··· 209 198 static int mwifiex_process_country_ie(struct mwifiex_private *priv, 210 199 struct cfg80211_bss *bss) 211 200 { 212 - u8 *country_ie, country_ie_len; 201 + const u8 *country_ie; 202 + u8 country_ie_len; 213 203 struct mwifiex_802_11d_domain_reg *domain_info = 214 204 &priv->adapter->domain_reg; 215 205 216 - country_ie = (u8 *)ieee80211_bss_get_ie(bss, WLAN_EID_COUNTRY); 217 - 218 - if (!country_ie) 206 + rcu_read_lock(); 207 + country_ie = ieee80211_bss_get_ie(bss, WLAN_EID_COUNTRY); 208 + if (!country_ie) { 209 + rcu_read_unlock(); 219 210 return 0; 211 + } 220 212 221 213 country_ie_len = country_ie[1]; 222 - if (country_ie_len < IEEE80211_COUNTRY_IE_MIN_LEN) 214 + if (country_ie_len < IEEE80211_COUNTRY_IE_MIN_LEN) { 215 + rcu_read_unlock(); 223 216 return 0; 217 + } 224 218 225 219 domain_info->country_code[0] = country_ie[2]; 226 220 domain_info->country_code[1] = country_ie[3]; ··· 238 222 239 223 memcpy((u8 *)domain_info->triplet, 240 224 &country_ie[2] + IEEE80211_COUNTRY_STRING_LEN, country_ie_len); 225 + 226 + rcu_read_unlock(); 241 227 242 228 if (mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11D_DOMAIN_INFO, 243 229 HostCmd_ACT_GEN_SET, 0, NULL)) { ··· 479 461 } 480 462 481 463 if (adapter->hs_activated) { 482 - dev_dbg(adapter->dev, "cmd: HS Already actived\n"); 464 + dev_dbg(adapter->dev, "cmd: HS Already activated\n"); 483 465 return true; 484 466 } 485 467
+1 -1
drivers/net/wireless/mwifiex/usb.c
··· 351 351 card->udev = udev; 352 352 card->intf = intf; 353 353 354 - pr_debug("info: bcdUSB=%#x Device Class=%#x SubClass=%#x Protocl=%#x\n", 354 + pr_debug("info: bcdUSB=%#x Device Class=%#x SubClass=%#x Protocol=%#x\n", 355 355 udev->descriptor.bcdUSB, udev->descriptor.bDeviceClass, 356 356 udev->descriptor.bDeviceSubClass, 357 357 udev->descriptor.bDeviceProtocol);
+4 -10
drivers/net/wireless/mwl8k.c
··· 5258 5258 #define _MWL8K_8366_AP_FW(api) "mwl8k/fmimage_8366_ap-" #api ".fw" 5259 5259 #define MWL8K_8366_AP_FW(api) _MWL8K_8366_AP_FW(api) 5260 5260 5261 - static struct mwl8k_device_info mwl8k_info_tbl[] __devinitdata = { 5261 + static struct mwl8k_device_info mwl8k_info_tbl[] = { 5262 5262 [MWL8363] = { 5263 5263 .part_name = "88w8363", 5264 5264 .helper_image = "mwl8k/helper_8363.fw", ··· 5756 5756 5757 5757 return rc; 5758 5758 } 5759 - static int __devinit mwl8k_probe(struct pci_dev *pdev, 5759 + static int mwl8k_probe(struct pci_dev *pdev, 5760 5760 const struct pci_device_id *id) 5761 5761 { 5762 5762 static int printed_version; ··· 5873 5873 return rc; 5874 5874 } 5875 5875 5876 - static void __devexit mwl8k_shutdown(struct pci_dev *pdev) 5877 - { 5878 - printk(KERN_ERR "===>%s(%u)\n", __func__, __LINE__); 5879 - } 5880 - 5881 - static void __devexit mwl8k_remove(struct pci_dev *pdev) 5876 + static void mwl8k_remove(struct pci_dev *pdev) 5882 5877 { 5883 5878 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 5884 5879 struct mwl8k_priv *priv; ··· 5925 5930 .name = MWL8K_NAME, 5926 5931 .id_table = mwl8k_pci_id_table, 5927 5932 .probe = mwl8k_probe, 5928 - .remove = __devexit_p(mwl8k_remove), 5929 - .shutdown = __devexit_p(mwl8k_shutdown), 5933 + .remove = mwl8k_remove, 5930 5934 }; 5931 5935 5932 5936 module_pci_driver(mwl8k_driver);
+2 -2
drivers/net/wireless/orinoco/orinoco_nortel.c
··· 255 255 return err; 256 256 } 257 257 258 - static void __devexit orinoco_nortel_remove_one(struct pci_dev *pdev) 258 + static void orinoco_nortel_remove_one(struct pci_dev *pdev) 259 259 { 260 260 struct orinoco_private *priv = pci_get_drvdata(pdev); 261 261 struct orinoco_pci_card *card = priv->card; ··· 288 288 .name = DRIVER_NAME, 289 289 .id_table = orinoco_nortel_id_table, 290 290 .probe = orinoco_nortel_init_one, 291 - .remove = __devexit_p(orinoco_nortel_remove_one), 291 + .remove = orinoco_nortel_remove_one, 292 292 .suspend = orinoco_pci_suspend, 293 293 .resume = orinoco_pci_resume, 294 294 };
+2 -2
drivers/net/wireless/orinoco/orinoco_pci.c
··· 199 199 return err; 200 200 } 201 201 202 - static void __devexit orinoco_pci_remove_one(struct pci_dev *pdev) 202 + static void orinoco_pci_remove_one(struct pci_dev *pdev) 203 203 { 204 204 struct orinoco_private *priv = pci_get_drvdata(pdev); 205 205 ··· 228 228 .name = DRIVER_NAME, 229 229 .id_table = orinoco_pci_id_table, 230 230 .probe = orinoco_pci_init_one, 231 - .remove = __devexit_p(orinoco_pci_remove_one), 231 + .remove = orinoco_pci_remove_one, 232 232 .suspend = orinoco_pci_suspend, 233 233 .resume = orinoco_pci_resume, 234 234 };
+2 -2
drivers/net/wireless/orinoco/orinoco_plx.c
··· 294 294 return err; 295 295 } 296 296 297 - static void __devexit orinoco_plx_remove_one(struct pci_dev *pdev) 297 + static void orinoco_plx_remove_one(struct pci_dev *pdev) 298 298 { 299 299 struct orinoco_private *priv = pci_get_drvdata(pdev); 300 300 struct orinoco_pci_card *card = priv->card; ··· 334 334 .name = DRIVER_NAME, 335 335 .id_table = orinoco_plx_id_table, 336 336 .probe = orinoco_plx_init_one, 337 - .remove = __devexit_p(orinoco_plx_remove_one), 337 + .remove = orinoco_plx_remove_one, 338 338 .suspend = orinoco_pci_suspend, 339 339 .resume = orinoco_pci_resume, 340 340 };
+2 -2
drivers/net/wireless/orinoco/orinoco_tmd.c
··· 188 188 return err; 189 189 } 190 190 191 - static void __devexit orinoco_tmd_remove_one(struct pci_dev *pdev) 191 + static void orinoco_tmd_remove_one(struct pci_dev *pdev) 192 192 { 193 193 struct orinoco_private *priv = pci_get_drvdata(pdev); 194 194 struct orinoco_pci_card *card = priv->card; ··· 214 214 .name = DRIVER_NAME, 215 215 .id_table = orinoco_tmd_id_table, 216 216 .probe = orinoco_tmd_init_one, 217 - .remove = __devexit_p(orinoco_tmd_remove_one), 217 + .remove = orinoco_tmd_remove_one, 218 218 .suspend = orinoco_pci_suspend, 219 219 .resume = orinoco_pci_resume, 220 220 };
+3 -2
drivers/net/wireless/p54/eeprom.c
··· 541 541 entries = (len - offset) / 542 542 sizeof(struct pda_rssi_cal_ext_entry); 543 543 544 - if ((len - offset) % sizeof(struct pda_rssi_cal_ext_entry) || 545 - entries <= 0) { 544 + if (len < offset || 545 + (len - offset) % sizeof(struct pda_rssi_cal_ext_entry) || 546 + entries == 0) { 546 547 wiphy_err(dev->wiphy, "invalid rssi database.\n"); 547 548 goto err_data; 548 549 }
+6 -13
drivers/net/wireless/p54/p54pci.c
··· 540 540 pci_dev_put(pdev); 541 541 } 542 542 543 - static int __devinit p54p_probe(struct pci_dev *pdev, 543 + static int p54p_probe(struct pci_dev *pdev, 544 544 const struct pci_device_id *id) 545 545 { 546 546 struct p54p_priv *priv; ··· 639 639 return err; 640 640 } 641 641 642 - static void __devexit p54p_remove(struct pci_dev *pdev) 642 + static void p54p_remove(struct pci_dev *pdev) 643 643 { 644 644 struct ieee80211_hw *dev = pci_get_drvdata(pdev); 645 645 struct p54p_priv *priv; ··· 659 659 p54_free_common(dev); 660 660 } 661 661 662 - #ifdef CONFIG_PM 662 + #ifdef CONFIG_PM_SLEEP 663 663 static int p54p_suspend(struct device *device) 664 664 { 665 665 struct pci_dev *pdev = to_pci_dev(device); ··· 681 681 return pci_set_power_state(pdev, PCI_D0); 682 682 } 683 683 684 - static const struct dev_pm_ops p54pci_pm_ops = { 685 - .suspend = p54p_suspend, 686 - .resume = p54p_resume, 687 - .freeze = p54p_suspend, 688 - .thaw = p54p_resume, 689 - .poweroff = p54p_suspend, 690 - .restore = p54p_resume, 691 - }; 684 + static SIMPLE_DEV_PM_OPS(p54pci_pm_ops, p54p_suspend, p54p_resume); 692 685 693 686 #define P54P_PM_OPS (&p54pci_pm_ops) 694 687 #else 695 688 #define P54P_PM_OPS (NULL) 696 - #endif /* CONFIG_PM */ 689 + #endif /* CONFIG_PM_SLEEP */ 697 690 698 691 static struct pci_driver p54p_driver = { 699 692 .name = "p54pci", 700 693 .id_table = p54p_table, 701 694 .probe = p54p_probe, 702 - .remove = __devexit_p(p54p_remove), 695 + .remove = p54p_remove, 703 696 .driver.pm = P54P_PM_OPS, 704 697 }; 705 698
+3 -3
drivers/net/wireless/p54/p54spi.c
··· 595 595 cancel_work_sync(&priv->work); 596 596 } 597 597 598 - static int __devinit p54spi_probe(struct spi_device *spi) 598 + static int p54spi_probe(struct spi_device *spi) 599 599 { 600 600 struct p54s_priv *priv = NULL; 601 601 struct ieee80211_hw *hw; ··· 683 683 return ret; 684 684 } 685 685 686 - static int __devexit p54spi_remove(struct spi_device *spi) 686 + static int p54spi_remove(struct spi_device *spi) 687 687 { 688 688 struct p54s_priv *priv = dev_get_drvdata(&spi->dev); 689 689 ··· 710 710 }, 711 711 712 712 .probe = p54spi_probe, 713 - .remove = __devexit_p(p54spi_remove), 713 + .remove = p54spi_remove, 714 714 }; 715 715 716 716 static int __init p54spi_init(void)
+3 -3
drivers/net/wireless/p54/p54usb.c
··· 986 986 return err; 987 987 } 988 988 989 - static int __devinit p54u_probe(struct usb_interface *intf, 989 + static int p54u_probe(struct usb_interface *intf, 990 990 const struct usb_device_id *id) 991 991 { 992 992 struct usb_device *udev = interface_to_usbdev(intf); ··· 1057 1057 return err; 1058 1058 } 1059 1059 1060 - static void __devexit p54u_disconnect(struct usb_interface *intf) 1060 + static void p54u_disconnect(struct usb_interface *intf) 1061 1061 { 1062 1062 struct ieee80211_hw *dev = usb_get_intfdata(intf); 1063 1063 struct p54u_priv *priv; ··· 1131 1131 .name = "p54usb", 1132 1132 .id_table = p54u_table, 1133 1133 .probe = p54u_probe, 1134 - .disconnect = __devexit_p(p54u_disconnect), 1134 + .disconnect = p54u_disconnect, 1135 1135 .pre_reset = p54u_pre_reset, 1136 1136 .post_reset = p54u_post_reset, 1137 1137 #ifdef CONFIG_PM
+1 -1
drivers/net/wireless/rt2x00/rt2400pci.c
··· 1831 1831 .name = KBUILD_MODNAME, 1832 1832 .id_table = rt2400pci_device_table, 1833 1833 .probe = rt2400pci_probe, 1834 - .remove = __devexit_p(rt2x00pci_remove), 1834 + .remove = rt2x00pci_remove, 1835 1835 .suspend = rt2x00pci_suspend, 1836 1836 .resume = rt2x00pci_resume, 1837 1837 };
+1 -1
drivers/net/wireless/rt2x00/rt2500pci.c
··· 2122 2122 .name = KBUILD_MODNAME, 2123 2123 .id_table = rt2500pci_device_table, 2124 2124 .probe = rt2500pci_probe, 2125 - .remove = __devexit_p(rt2x00pci_remove), 2125 + .remove = rt2x00pci_remove, 2126 2126 .suspend = rt2x00pci_suspend, 2127 2127 .resume = rt2x00pci_resume, 2128 2128 };
+4 -2
drivers/net/wireless/rt2x00/rt2800.h
··· 1993 1993 */ 1994 1994 #define RFCSR3_K FIELD8(0x0f) 1995 1995 /* Bits [7-4] for RF3320 (RT3370/RT3390), on other chipsets reserved */ 1996 - #define RFCSR3_PA1_BIAS_CCK FIELD8(0x70); 1997 - #define RFCSR3_PA2_CASCODE_BIAS_CCKK FIELD8(0x80); 1996 + #define RFCSR3_PA1_BIAS_CCK FIELD8(0x70) 1997 + #define RFCSR3_PA2_CASCODE_BIAS_CCKK FIELD8(0x80) 1998 + /* Bits for RF3290/RF5360/RF5370/RF5372/RF5390/RF5392 */ 1999 + #define RFCSR3_VCOCAL_EN FIELD8(0x80) 1998 2000 1999 2001 /* 2000 2002 * FRCSR 5:
+71 -71
drivers/net/wireless/rt2x00/rt2800lib.c
··· 2173 2173 rt2800_rfcsr_write(rt2x00dev, 59, 2174 2174 r59_nonbt_rev[idx]); 2175 2175 } else if (rt2x00_rt(rt2x00dev, RT5390) || 2176 - rt2x00_rt(rt2x00dev, RT5392)) { 2176 + rt2x00_rt(rt2x00dev, RT5392)) { 2177 2177 static const char r59_non_bt[] = {0x8f, 0x8f, 2178 2178 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d, 2179 2179 0x8a, 0x88, 0x88, 0x87, 0x87, 0x86}; ··· 2243 2243 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); 2244 2244 2245 2245 rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr); 2246 - rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1); 2246 + rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1); 2247 2247 rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); 2248 2248 } 2249 2249 ··· 2264 2264 2265 2265 if (rf->channel <= 14) { 2266 2266 if (!rt2x00_rt(rt2x00dev, RT5390) && 2267 - !rt2x00_rt(rt2x00dev, RT5392)) { 2267 + !rt2x00_rt(rt2x00dev, RT5392)) { 2268 2268 if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, 2269 2269 &rt2x00dev->cap_flags)) { 2270 2270 rt2800_bbp_write(rt2x00dev, 82, 0x62); ··· 2804 2804 case RF5390: 2805 2805 case RF5392: 2806 2806 rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr); 2807 - rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1); 2807 + rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1); 2808 2808 rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); 2809 2809 break; 2810 2810 default: ··· 3592 3592 if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860D)) 3593 3593 rt2800_bbp_write(rt2x00dev, 84, 0x19); 3594 3594 else if (rt2x00_rt(rt2x00dev, RT3290) || 3595 - rt2x00_rt(rt2x00dev, RT5390) || 3596 - rt2x00_rt(rt2x00dev, RT5392)) 3595 + rt2x00_rt(rt2x00dev, RT5390) || 3596 + rt2x00_rt(rt2x00dev, RT5392)) 3597 3597 rt2800_bbp_write(rt2x00dev, 84, 0x9a); 3598 3598 else 3599 3599 rt2800_bbp_write(rt2x00dev, 84, 0x99); ··· 3652 3652 else if (rt2x00_rt(rt2x00dev, RT3352)) 3653 3653 rt2800_bbp_write(rt2x00dev, 105, 0x34); 3654 3654 else if (rt2x00_rt(rt2x00dev, RT5390) || 3655 - rt2x00_rt(rt2x00dev, RT5392)) 3655 + rt2x00_rt(rt2x00dev, RT5392)) 3656 3656 rt2800_bbp_write(rt2x00dev, 105, 0x3c); 3657 3657 else 3658 3658 rt2800_bbp_write(rt2x00dev, 105, 0x05); ··· 3746 3746 } 3747 3747 3748 3748 if (rt2x00_rt(rt2x00dev, RT5390) || 3749 - rt2x00_rt(rt2x00dev, RT5392)) { 3749 + rt2x00_rt(rt2x00dev, RT5392)) { 3750 3750 int ant, div_mode; 3751 3751 3752 3752 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); ··· 4220 4220 rt2800_rfcsr_write(rt2x00dev, 61, 0xdd); 4221 4221 rt2800_rfcsr_write(rt2x00dev, 62, 0x00); 4222 4222 rt2800_rfcsr_write(rt2x00dev, 63, 0x00); 4223 - } else if (rt2x00_rt(rt2x00dev, RT5392)) { 4224 - rt2800_rfcsr_write(rt2x00dev, 1, 0x17); 4225 - rt2800_rfcsr_write(rt2x00dev, 2, 0x80); 4226 - rt2800_rfcsr_write(rt2x00dev, 3, 0x88); 4227 - rt2800_rfcsr_write(rt2x00dev, 5, 0x10); 4228 - rt2800_rfcsr_write(rt2x00dev, 6, 0xe0); 4229 - rt2800_rfcsr_write(rt2x00dev, 7, 0x00); 4230 - rt2800_rfcsr_write(rt2x00dev, 10, 0x53); 4231 - rt2800_rfcsr_write(rt2x00dev, 11, 0x4a); 4232 - rt2800_rfcsr_write(rt2x00dev, 12, 0x46); 4233 - rt2800_rfcsr_write(rt2x00dev, 13, 0x9f); 4234 - rt2800_rfcsr_write(rt2x00dev, 14, 0x00); 4235 - rt2800_rfcsr_write(rt2x00dev, 15, 0x00); 4236 - rt2800_rfcsr_write(rt2x00dev, 16, 0x00); 4237 - rt2800_rfcsr_write(rt2x00dev, 18, 0x03); 4238 - rt2800_rfcsr_write(rt2x00dev, 19, 0x4d); 4239 - rt2800_rfcsr_write(rt2x00dev, 20, 0x00); 4240 - rt2800_rfcsr_write(rt2x00dev, 21, 0x8d); 4241 - rt2800_rfcsr_write(rt2x00dev, 22, 0x20); 4242 - rt2800_rfcsr_write(rt2x00dev, 23, 0x0b); 4243 - rt2800_rfcsr_write(rt2x00dev, 24, 0x44); 4244 - rt2800_rfcsr_write(rt2x00dev, 25, 0x80); 4245 - rt2800_rfcsr_write(rt2x00dev, 26, 0x82); 4246 - rt2800_rfcsr_write(rt2x00dev, 27, 0x09); 4247 - rt2800_rfcsr_write(rt2x00dev, 28, 0x00); 4248 - rt2800_rfcsr_write(rt2x00dev, 29, 0x10); 4249 - rt2800_rfcsr_write(rt2x00dev, 30, 0x10); 4250 - rt2800_rfcsr_write(rt2x00dev, 31, 0x80); 4251 - rt2800_rfcsr_write(rt2x00dev, 32, 0x20); 4252 - rt2800_rfcsr_write(rt2x00dev, 33, 0xC0); 4253 - rt2800_rfcsr_write(rt2x00dev, 34, 0x07); 4254 - rt2800_rfcsr_write(rt2x00dev, 35, 0x12); 4255 - rt2800_rfcsr_write(rt2x00dev, 36, 0x00); 4256 - rt2800_rfcsr_write(rt2x00dev, 37, 0x08); 4257 - rt2800_rfcsr_write(rt2x00dev, 38, 0x89); 4258 - rt2800_rfcsr_write(rt2x00dev, 39, 0x1b); 4259 - rt2800_rfcsr_write(rt2x00dev, 40, 0x0f); 4260 - rt2800_rfcsr_write(rt2x00dev, 41, 0xbb); 4261 - rt2800_rfcsr_write(rt2x00dev, 42, 0xd5); 4262 - rt2800_rfcsr_write(rt2x00dev, 43, 0x9b); 4263 - rt2800_rfcsr_write(rt2x00dev, 44, 0x0e); 4264 - rt2800_rfcsr_write(rt2x00dev, 45, 0xa2); 4265 - rt2800_rfcsr_write(rt2x00dev, 46, 0x73); 4266 - rt2800_rfcsr_write(rt2x00dev, 47, 0x0c); 4267 - rt2800_rfcsr_write(rt2x00dev, 48, 0x10); 4268 - rt2800_rfcsr_write(rt2x00dev, 49, 0x94); 4269 - rt2800_rfcsr_write(rt2x00dev, 50, 0x94); 4270 - rt2800_rfcsr_write(rt2x00dev, 51, 0x3a); 4271 - rt2800_rfcsr_write(rt2x00dev, 52, 0x48); 4272 - rt2800_rfcsr_write(rt2x00dev, 53, 0x44); 4273 - rt2800_rfcsr_write(rt2x00dev, 54, 0x38); 4274 - rt2800_rfcsr_write(rt2x00dev, 55, 0x43); 4275 - rt2800_rfcsr_write(rt2x00dev, 56, 0xa1); 4276 - rt2800_rfcsr_write(rt2x00dev, 57, 0x00); 4277 - rt2800_rfcsr_write(rt2x00dev, 58, 0x39); 4278 - rt2800_rfcsr_write(rt2x00dev, 59, 0x07); 4279 - rt2800_rfcsr_write(rt2x00dev, 60, 0x45); 4280 - rt2800_rfcsr_write(rt2x00dev, 61, 0x91); 4281 - rt2800_rfcsr_write(rt2x00dev, 62, 0x39); 4282 - rt2800_rfcsr_write(rt2x00dev, 63, 0x07); 4223 + } else if (rt2x00_rt(rt2x00dev, RT5392)) { 4224 + rt2800_rfcsr_write(rt2x00dev, 1, 0x17); 4225 + rt2800_rfcsr_write(rt2x00dev, 2, 0x80); 4226 + rt2800_rfcsr_write(rt2x00dev, 3, 0x88); 4227 + rt2800_rfcsr_write(rt2x00dev, 5, 0x10); 4228 + rt2800_rfcsr_write(rt2x00dev, 6, 0xe0); 4229 + rt2800_rfcsr_write(rt2x00dev, 7, 0x00); 4230 + rt2800_rfcsr_write(rt2x00dev, 10, 0x53); 4231 + rt2800_rfcsr_write(rt2x00dev, 11, 0x4a); 4232 + rt2800_rfcsr_write(rt2x00dev, 12, 0x46); 4233 + rt2800_rfcsr_write(rt2x00dev, 13, 0x9f); 4234 + rt2800_rfcsr_write(rt2x00dev, 14, 0x00); 4235 + rt2800_rfcsr_write(rt2x00dev, 15, 0x00); 4236 + rt2800_rfcsr_write(rt2x00dev, 16, 0x00); 4237 + rt2800_rfcsr_write(rt2x00dev, 18, 0x03); 4238 + rt2800_rfcsr_write(rt2x00dev, 19, 0x4d); 4239 + rt2800_rfcsr_write(rt2x00dev, 20, 0x00); 4240 + rt2800_rfcsr_write(rt2x00dev, 21, 0x8d); 4241 + rt2800_rfcsr_write(rt2x00dev, 22, 0x20); 4242 + rt2800_rfcsr_write(rt2x00dev, 23, 0x0b); 4243 + rt2800_rfcsr_write(rt2x00dev, 24, 0x44); 4244 + rt2800_rfcsr_write(rt2x00dev, 25, 0x80); 4245 + rt2800_rfcsr_write(rt2x00dev, 26, 0x82); 4246 + rt2800_rfcsr_write(rt2x00dev, 27, 0x09); 4247 + rt2800_rfcsr_write(rt2x00dev, 28, 0x00); 4248 + rt2800_rfcsr_write(rt2x00dev, 29, 0x10); 4249 + rt2800_rfcsr_write(rt2x00dev, 30, 0x10); 4250 + rt2800_rfcsr_write(rt2x00dev, 31, 0x80); 4251 + rt2800_rfcsr_write(rt2x00dev, 32, 0x20); 4252 + rt2800_rfcsr_write(rt2x00dev, 33, 0xC0); 4253 + rt2800_rfcsr_write(rt2x00dev, 34, 0x07); 4254 + rt2800_rfcsr_write(rt2x00dev, 35, 0x12); 4255 + rt2800_rfcsr_write(rt2x00dev, 36, 0x00); 4256 + rt2800_rfcsr_write(rt2x00dev, 37, 0x08); 4257 + rt2800_rfcsr_write(rt2x00dev, 38, 0x89); 4258 + rt2800_rfcsr_write(rt2x00dev, 39, 0x1b); 4259 + rt2800_rfcsr_write(rt2x00dev, 40, 0x0f); 4260 + rt2800_rfcsr_write(rt2x00dev, 41, 0xbb); 4261 + rt2800_rfcsr_write(rt2x00dev, 42, 0xd5); 4262 + rt2800_rfcsr_write(rt2x00dev, 43, 0x9b); 4263 + rt2800_rfcsr_write(rt2x00dev, 44, 0x0e); 4264 + rt2800_rfcsr_write(rt2x00dev, 45, 0xa2); 4265 + rt2800_rfcsr_write(rt2x00dev, 46, 0x73); 4266 + rt2800_rfcsr_write(rt2x00dev, 47, 0x0c); 4267 + rt2800_rfcsr_write(rt2x00dev, 48, 0x10); 4268 + rt2800_rfcsr_write(rt2x00dev, 49, 0x94); 4269 + rt2800_rfcsr_write(rt2x00dev, 50, 0x94); 4270 + rt2800_rfcsr_write(rt2x00dev, 51, 0x3a); 4271 + rt2800_rfcsr_write(rt2x00dev, 52, 0x48); 4272 + rt2800_rfcsr_write(rt2x00dev, 53, 0x44); 4273 + rt2800_rfcsr_write(rt2x00dev, 54, 0x38); 4274 + rt2800_rfcsr_write(rt2x00dev, 55, 0x43); 4275 + rt2800_rfcsr_write(rt2x00dev, 56, 0xa1); 4276 + rt2800_rfcsr_write(rt2x00dev, 57, 0x00); 4277 + rt2800_rfcsr_write(rt2x00dev, 58, 0x39); 4278 + rt2800_rfcsr_write(rt2x00dev, 59, 0x07); 4279 + rt2800_rfcsr_write(rt2x00dev, 60, 0x45); 4280 + rt2800_rfcsr_write(rt2x00dev, 61, 0x91); 4281 + rt2800_rfcsr_write(rt2x00dev, 62, 0x39); 4282 + rt2800_rfcsr_write(rt2x00dev, 63, 0x07); 4283 4283 } 4284 4284 4285 4285 if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) { ··· 4356 4356 rt2800_bbp_read(rt2x00dev, 26, &drv_data->bbp26); 4357 4357 4358 4358 if (!rt2x00_rt(rt2x00dev, RT5390) && 4359 - !rt2x00_rt(rt2x00dev, RT5392)) { 4359 + !rt2x00_rt(rt2x00dev, RT5392)) { 4360 4360 /* 4361 4361 * Set back to initial state 4362 4362 */ ··· 4385 4385 rt2800_register_write(rt2x00dev, OPT_14_CSR, reg); 4386 4386 4387 4387 if (!rt2x00_rt(rt2x00dev, RT5390) && 4388 - !rt2x00_rt(rt2x00dev, RT5392)) { 4388 + !rt2x00_rt(rt2x00dev, RT5392)) { 4389 4389 rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); 4390 4390 rt2x00_set_field8(&rfcsr, RFCSR17_TX_LO1_EN, 0); 4391 4391 if (rt2x00_rt(rt2x00dev, RT3070) || ··· 4457 4457 } 4458 4458 4459 4459 if (rt2x00_rt(rt2x00dev, RT5390) || 4460 - rt2x00_rt(rt2x00dev, RT5392)) { 4460 + rt2x00_rt(rt2x00dev, RT5392)) { 4461 4461 rt2800_rfcsr_read(rt2x00dev, 38, &rfcsr); 4462 4462 rt2x00_set_field8(&rfcsr, RFCSR38_RX_LO1_EN, 0); 4463 4463 rt2800_rfcsr_write(rt2x00dev, 38, rfcsr);
+2 -2
drivers/net/wireless/rt2x00/rt2800pci.c
··· 1176 1176 .mod_name = KBUILD_MODNAME, 1177 1177 }, 1178 1178 .probe = rt2800soc_probe, 1179 - .remove = __devexit_p(rt2x00soc_remove), 1179 + .remove = rt2x00soc_remove, 1180 1180 .suspend = rt2x00soc_suspend, 1181 1181 .resume = rt2x00soc_resume, 1182 1182 }; ··· 1193 1193 .name = KBUILD_MODNAME, 1194 1194 .id_table = rt2800pci_device_table, 1195 1195 .probe = rt2800pci_probe, 1196 - .remove = __devexit_p(rt2x00pci_remove), 1196 + .remove = rt2x00pci_remove, 1197 1197 .suspend = rt2x00pci_suspend, 1198 1198 .resume = rt2x00pci_resume, 1199 1199 };
+10
drivers/net/wireless/rt2x00/rt2x00dev.c
··· 1124 1124 struct ieee80211_iface_limit *if_limit; 1125 1125 struct ieee80211_iface_combination *if_combination; 1126 1126 1127 + if (rt2x00dev->ops->max_ap_intf < 2) 1128 + return; 1129 + 1127 1130 /* 1128 1131 * Build up AP interface limits structure. 1129 1132 */ ··· 1184 1181 * structure ieee80211_vif. 1185 1182 */ 1186 1183 rt2x00dev->hw->vif_data_size = sizeof(struct rt2x00_intf); 1184 + 1185 + /* 1186 + * rt2x00 devices can only use the last n bits of the MAC address 1187 + * for virtual interfaces. 1188 + */ 1189 + rt2x00dev->hw->wiphy->addr_mask[ETH_ALEN - 1] = 1190 + (rt2x00dev->ops->max_ap_intf - 1); 1187 1191 1188 1192 /* 1189 1193 * Determine which operating modes are supported, all modes
+1 -1
drivers/net/wireless/rt2x00/rt61pci.c
··· 3094 3094 .name = KBUILD_MODNAME, 3095 3095 .id_table = rt61pci_device_table, 3096 3096 .probe = rt61pci_probe, 3097 - .remove = __devexit_p(rt2x00pci_remove), 3097 + .remove = rt2x00pci_remove, 3098 3098 .suspend = rt2x00pci_suspend, 3099 3099 .resume = rt2x00pci_resume, 3100 3100 };
+3 -3
drivers/net/wireless/rtl818x/rtl8180/dev.c
··· 901 901 udelay(10); 902 902 } 903 903 904 - static int __devinit rtl8180_probe(struct pci_dev *pdev, 904 + static int rtl8180_probe(struct pci_dev *pdev, 905 905 const struct pci_device_id *id) 906 906 { 907 907 struct ieee80211_hw *dev; ··· 1131 1131 return err; 1132 1132 } 1133 1133 1134 - static void __devexit rtl8180_remove(struct pci_dev *pdev) 1134 + static void rtl8180_remove(struct pci_dev *pdev) 1135 1135 { 1136 1136 struct ieee80211_hw *dev = pci_get_drvdata(pdev); 1137 1137 struct rtl8180_priv *priv; ··· 1170 1170 .name = KBUILD_MODNAME, 1171 1171 .id_table = rtl8180_table, 1172 1172 .probe = rtl8180_probe, 1173 - .remove = __devexit_p(rtl8180_remove), 1173 + .remove = rtl8180_remove, 1174 1174 #ifdef CONFIG_PM 1175 1175 .suspend = rtl8180_suspend, 1176 1176 .resume = rtl8180_resume,
+3 -3
drivers/net/wireless/rtl818x/rtl8187/dev.c
··· 1411 1411 udelay(10); 1412 1412 } 1413 1413 1414 - static int __devinit rtl8187_probe(struct usb_interface *intf, 1414 + static int rtl8187_probe(struct usb_interface *intf, 1415 1415 const struct usb_device_id *id) 1416 1416 { 1417 1417 struct usb_device *udev = interface_to_usbdev(intf); ··· 1639 1639 return err; 1640 1640 } 1641 1641 1642 - static void __devexit rtl8187_disconnect(struct usb_interface *intf) 1642 + static void rtl8187_disconnect(struct usb_interface *intf) 1643 1643 { 1644 1644 struct ieee80211_hw *dev = usb_get_intfdata(intf); 1645 1645 struct rtl8187_priv *priv; ··· 1664 1664 .name = KBUILD_MODNAME, 1665 1665 .id_table = rtl8187_table, 1666 1666 .probe = rtl8187_probe, 1667 - .disconnect = __devexit_p(rtl8187_disconnect), 1667 + .disconnect = rtl8187_disconnect, 1668 1668 .disable_hub_initiated_lpm = 1, 1669 1669 }; 1670 1670
+3 -1
drivers/net/wireless/rtlwifi/pci.c
··· 1756 1756 return true; 1757 1757 } 1758 1758 1759 - int __devinit rtl_pci_probe(struct pci_dev *pdev, 1759 + int rtl_pci_probe(struct pci_dev *pdev, 1760 1760 const struct pci_device_id *id) 1761 1761 { 1762 1762 struct ieee80211_hw *hw = NULL; ··· 1982 1982 } 1983 1983 EXPORT_SYMBOL(rtl_pci_disconnect); 1984 1984 1985 + #ifdef CONFIG_PM_SLEEP 1985 1986 /*************************************** 1986 1987 kernel pci power state define: 1987 1988 PCI_D0 ((pci_power_t __force) 0) ··· 2022 2021 return 0; 2023 2022 } 2024 2023 EXPORT_SYMBOL(rtl_pci_resume); 2024 + #endif /* CONFIG_PM_SLEEP */ 2025 2025 2026 2026 struct rtl_intf_ops rtl_pci_ops = { 2027 2027 .read_efuse_byte = read_efuse_byte,
+3 -1
drivers/net/wireless/rtlwifi/pci.h
··· 236 236 237 237 extern struct rtl_intf_ops rtl_pci_ops; 238 238 239 - int __devinit rtl_pci_probe(struct pci_dev *pdev, 239 + int rtl_pci_probe(struct pci_dev *pdev, 240 240 const struct pci_device_id *id); 241 241 void rtl_pci_disconnect(struct pci_dev *pdev); 242 + #ifdef CONFIG_PM_SLEEP 242 243 int rtl_pci_suspend(struct device *dev); 243 244 int rtl_pci_resume(struct device *dev); 245 + #endif /* CONFIG_PM_SLEEP */ 244 246 static inline u8 pci_read8_sync(struct rtl_priv *rtlpriv, u32 addr) 245 247 { 246 248 return readb((u8 __iomem *) rtlpriv->io.pci_mem_start + addr);
+1 -8
drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
··· 372 372 MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); 373 373 MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); 374 374 375 - static const struct dev_pm_ops rtlwifi_pm_ops = { 376 - .suspend = rtl_pci_suspend, 377 - .resume = rtl_pci_resume, 378 - .freeze = rtl_pci_suspend, 379 - .thaw = rtl_pci_resume, 380 - .poweroff = rtl_pci_suspend, 381 - .restore = rtl_pci_resume, 382 - }; 375 + static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); 383 376 384 377 static struct pci_driver rtl92ce_driver = { 385 378 .name = KBUILD_MODNAME,
+2 -9
drivers/net/wireless/rtlwifi/rtl8192de/sw.c
··· 352 352 .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, 353 353 }; 354 354 355 - static struct pci_device_id rtl92de_pci_ids[] __devinitdata = { 355 + static struct pci_device_id rtl92de_pci_ids[] = { 356 356 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8193, rtl92de_hal_cfg)}, 357 357 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x002B, rtl92de_hal_cfg)}, 358 358 {}, ··· 378 378 MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); 379 379 MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); 380 380 381 - static const struct dev_pm_ops rtlwifi_pm_ops = { 382 - .suspend = rtl_pci_suspend, 383 - .resume = rtl_pci_resume, 384 - .freeze = rtl_pci_suspend, 385 - .thaw = rtl_pci_resume, 386 - .poweroff = rtl_pci_suspend, 387 - .restore = rtl_pci_resume, 388 - }; 381 + static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); 389 382 390 383 static struct pci_driver rtl92de_driver = { 391 384 .name = KBUILD_MODNAME,
+1 -2
drivers/net/wireless/rtlwifi/rtl8192se/def.h
··· 522 522 FW_CMD_IQK_ENABLE = 30, 523 523 }; 524 524 525 - /* 526 - * Driver info contain PHY status 525 + /* Driver info contain PHY status 527 526 * and other variabel size info 528 527 * PHY Status content as below 529 528 */
+10 -10
drivers/net/wireless/rtlwifi/rtl8192se/dm.c
··· 465 465 digtable->cur_igvalue = 466 466 digtable->rx_gain_range_min; 467 467 else 468 - digtable->cur_igvalue = digtable->rssi_val + 10 - 469 - digtable->back_val; 468 + digtable->cur_igvalue = digtable->rssi_val + 10 469 + - digtable->back_val; 470 470 471 471 if (falsealm_cnt->cnt_all > 10000) 472 472 digtable->cur_igvalue = ··· 518 518 static void _rtl92s_dm_ctrl_initgain_bytwoport(struct ieee80211_hw *hw) 519 519 { 520 520 struct rtl_priv *rtlpriv = rtl_priv(hw); 521 - struct dig_t *digtable = &rtlpriv->dm_digtable; 521 + struct dig_t *dig = &rtlpriv->dm_digtable; 522 522 523 523 if (rtlpriv->mac80211.act_scanning) 524 524 return; ··· 526 526 /* Decide the current status and if modify initial gain or not */ 527 527 if (rtlpriv->mac80211.link_state >= MAC80211_LINKED || 528 528 rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC) 529 - digtable->cur_sta_cstate = DIG_STA_CONNECT; 529 + dig->cur_sta_cstate = DIG_STA_CONNECT; 530 530 else 531 - digtable->cur_sta_cstate = DIG_STA_DISCONNECT; 531 + dig->cur_sta_cstate = DIG_STA_DISCONNECT; 532 532 533 - digtable->rssi_val = rtlpriv->dm.undec_sm_pwdb; 533 + dig->rssi_val = rtlpriv->dm.undec_sm_pwdb; 534 534 535 535 /* Change dig mode to rssi */ 536 - if (digtable->cur_sta_cstate != DIG_STA_DISCONNECT) { 537 - if (digtable->dig_twoport_algorithm == 536 + if (dig->cur_sta_cstate != DIG_STA_DISCONNECT) { 537 + if (dig->dig_twoport_algorithm == 538 538 DIG_TWO_PORT_ALGO_FALSE_ALARM) { 539 - digtable->dig_twoport_algorithm = DIG_TWO_PORT_ALGO_RSSI; 539 + dig->dig_twoport_algorithm = DIG_TWO_PORT_ALGO_RSSI; 540 540 rtl92s_phy_set_fw_cmd(hw, FW_CMD_DIG_MODE_SS); 541 541 } 542 542 } ··· 544 544 _rtl92s_dm_false_alarm_counter_statistics(hw); 545 545 _rtl92s_dm_initial_gain_sta_beforeconnect(hw); 546 546 547 - digtable->pre_sta_cstate = digtable->cur_sta_cstate; 547 + dig->pre_sta_cstate = dig->cur_sta_cstate; 548 548 } 549 549 550 550 static void _rtl92s_dm_ctrl_initgain_byrssi(struct ieee80211_hw *hw)
+2 -1
drivers/net/wireless/rtlwifi/rtl8192se/hw.c
··· 1089 1089 return err; 1090 1090 } 1091 1091 1092 - void rtl92se_set_mac_addr(struct rtl_io *io, const u8 * addr) 1092 + void rtl92se_set_mac_addr(struct rtl_io *io, const u8 *addr) 1093 1093 { 1094 + /* This is a stub. */ 1094 1095 } 1095 1096 1096 1097 void rtl92se_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid)
+1 -1
drivers/net/wireless/rtlwifi/rtl8192se/hw.h
··· 54 54 int rtl92se_set_network_type(struct ieee80211_hw *hw, 55 55 enum nl80211_iftype type); 56 56 void rtl92se_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); 57 - void rtl92se_set_mac_addr(struct rtl_io *io, const u8 * addr); 57 + void rtl92se_set_mac_addr(struct rtl_io *io, const u8 *addr); 58 58 void rtl92se_set_qos(struct ieee80211_hw *hw, int aci); 59 59 void rtl92se_set_beacon_related_registers(struct ieee80211_hw *hw); 60 60 void rtl92se_set_beacon_interval(struct ieee80211_hw *hw);
+5 -15
drivers/net/wireless/rtlwifi/rtl8192se/sw.c
··· 50 50 /*close ASPM for AMD defaultly */ 51 51 rtlpci->const_amdpci_aspm = 0; 52 52 53 - /* 54 - * ASPM PS mode. 53 + /* ASPM PS mode. 55 54 * 0 - Disable ASPM, 56 55 * 1 - Enable ASPM without Clock Req, 57 56 * 2 - Enable ASPM with Clock Req, ··· 66 67 /*Setting for PCI-E bridge */ 67 68 rtlpci->const_hostpci_aspm_setting = 0x02; 68 69 69 - /* 70 - * In Hw/Sw Radio Off situation. 70 + /* In Hw/Sw Radio Off situation. 71 71 * 0 - Default, 72 72 * 1 - From ASPM setting without low Mac Pwr, 73 73 * 2 - From ASPM setting with low Mac Pwr, ··· 75 77 */ 76 78 rtlpci->const_hwsw_rfoff_d3 = 2; 77 79 78 - /* 79 - * This setting works for those device with 80 + /* This setting works for those device with 80 81 * backdoor ASPM setting such as EPHY setting. 81 82 * 0 - Not support ASPM, 82 83 * 1 - Support ASPM, ··· 400 403 .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, 401 404 }; 402 405 403 - static struct pci_device_id rtl92se_pci_ids[] __devinitdata = { 406 + static struct pci_device_id rtl92se_pci_ids[] = { 404 407 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8192, rtl92se_hal_cfg)}, 405 408 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8171, rtl92se_hal_cfg)}, 406 409 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8172, rtl92se_hal_cfg)}, ··· 429 432 MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); 430 433 MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); 431 434 432 - static const struct dev_pm_ops rtlwifi_pm_ops = { 433 - .suspend = rtl_pci_suspend, 434 - .resume = rtl_pci_resume, 435 - .freeze = rtl_pci_suspend, 436 - .thaw = rtl_pci_resume, 437 - .poweroff = rtl_pci_suspend, 438 - .restore = rtl_pci_resume, 439 - }; 435 + static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); 440 436 441 437 static struct pci_driver rtl92se_driver = { 442 438 .name = KBUILD_MODNAME,
+1 -8
drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
··· 367 367 MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); 368 368 MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); 369 369 370 - static const struct dev_pm_ops rtlwifi_pm_ops = { 371 - .suspend = rtl_pci_suspend, 372 - .resume = rtl_pci_resume, 373 - .freeze = rtl_pci_suspend, 374 - .thaw = rtl_pci_resume, 375 - .poweroff = rtl_pci_suspend, 376 - .restore = rtl_pci_resume, 377 - }; 370 + static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); 378 371 379 372 static struct pci_driver rtl8723ae_driver = { 380 373 .name = KBUILD_MODNAME,
+1 -1
drivers/net/wireless/rtlwifi/usb.c
··· 940 940 .waitq_insert = rtl_usb_tx_chk_waitq_insert, 941 941 }; 942 942 943 - int __devinit rtl_usb_probe(struct usb_interface *intf, 943 + int rtl_usb_probe(struct usb_interface *intf, 944 944 const struct usb_device_id *id) 945 945 { 946 946 int err;
+1 -1
drivers/net/wireless/rtlwifi/usb.h
··· 156 156 157 157 158 158 159 - int __devinit rtl_usb_probe(struct usb_interface *intf, 159 + int rtl_usb_probe(struct usb_interface *intf, 160 160 const struct usb_device_id *id); 161 161 void rtl_usb_disconnect(struct usb_interface *intf); 162 162 int rtl_usb_suspend(struct usb_interface *pusb_intf, pm_message_t message);
+3 -1
drivers/net/wireless/ti/wl1251/main.c
··· 896 896 goto out; 897 897 898 898 skb = ieee80211_probereq_get(wl->hw, wl->vif, ssid, ssid_len, 899 - req->ie, req->ie_len); 899 + req->ie_len); 900 900 if (!skb) { 901 901 ret = -ENOMEM; 902 902 goto out; 903 903 } 904 + if (req->ie_len) 905 + memcpy(skb_put(skb, req->ie_len), req->ie, req->ie_len); 904 906 905 907 ret = wl1251_cmd_template_set(wl, CMD_PROBE_REQ, skb->data, 906 908 skb->len);
+2 -2
drivers/net/wireless/ti/wl1251/sdio.c
··· 305 305 return ret; 306 306 } 307 307 308 - static void __devexit wl1251_sdio_remove(struct sdio_func *func) 308 + static void wl1251_sdio_remove(struct sdio_func *func) 309 309 { 310 310 struct wl1251 *wl = sdio_get_drvdata(func); 311 311 struct wl1251_sdio *wl_sdio = wl->if_priv; ··· 347 347 .name = "wl1251_sdio", 348 348 .id_table = wl1251_devices, 349 349 .probe = wl1251_sdio_probe, 350 - .remove = __devexit_p(wl1251_sdio_remove), 350 + .remove = wl1251_sdio_remove, 351 351 .drv.pm = &wl1251_sdio_pm_ops, 352 352 }; 353 353
+3 -3
drivers/net/wireless/ti/wl1251/spi.c
··· 237 237 .power = wl1251_spi_set_power, 238 238 }; 239 239 240 - static int __devinit wl1251_spi_probe(struct spi_device *spi) 240 + static int wl1251_spi_probe(struct spi_device *spi) 241 241 { 242 242 struct wl12xx_platform_data *pdata; 243 243 struct ieee80211_hw *hw; ··· 309 309 return ret; 310 310 } 311 311 312 - static int __devexit wl1251_spi_remove(struct spi_device *spi) 312 + static int wl1251_spi_remove(struct spi_device *spi) 313 313 { 314 314 struct wl1251 *wl = dev_get_drvdata(&spi->dev); 315 315 ··· 326 326 }, 327 327 328 328 .probe = wl1251_spi_probe, 329 - .remove = __devexit_p(wl1251_spi_remove), 329 + .remove = wl1251_spi_remove, 330 330 }; 331 331 332 332 static int __init wl1251_spi_init(void)
+3 -3
drivers/net/wireless/ti/wl12xx/main.c
··· 1696 1696 return 0; 1697 1697 } 1698 1698 1699 - static int __devinit wl12xx_probe(struct platform_device *pdev) 1699 + static int wl12xx_probe(struct platform_device *pdev) 1700 1700 { 1701 1701 struct wl1271 *wl; 1702 1702 struct ieee80211_hw *hw; ··· 1725 1725 return ret; 1726 1726 } 1727 1727 1728 - static const struct platform_device_id wl12xx_id_table[] __devinitconst = { 1728 + static const struct platform_device_id wl12xx_id_table[] = { 1729 1729 { "wl12xx", 0 }, 1730 1730 { } /* Terminating Entry */ 1731 1731 }; ··· 1733 1733 1734 1734 static struct platform_driver wl12xx_driver = { 1735 1735 .probe = wl12xx_probe, 1736 - .remove = __devexit_p(wlcore_remove), 1736 + .remove = wlcore_remove, 1737 1737 .id_table = wl12xx_id_table, 1738 1738 .driver = { 1739 1739 .name = "wl12xx_driver",
+3 -3
drivers/net/wireless/ti/wl18xx/main.c
··· 1499 1499 return 0; 1500 1500 } 1501 1501 1502 - static int __devinit wl18xx_probe(struct platform_device *pdev) 1502 + static int wl18xx_probe(struct platform_device *pdev) 1503 1503 { 1504 1504 struct wl1271 *wl; 1505 1505 struct ieee80211_hw *hw; ··· 1528 1528 return ret; 1529 1529 } 1530 1530 1531 - static const struct platform_device_id wl18xx_id_table[] __devinitconst = { 1531 + static const struct platform_device_id wl18xx_id_table[] = { 1532 1532 { "wl18xx", 0 }, 1533 1533 { } /* Terminating Entry */ 1534 1534 }; ··· 1536 1536 1537 1537 static struct platform_driver wl18xx_driver = { 1538 1538 .probe = wl18xx_probe, 1539 - .remove = __devexit_p(wlcore_remove), 1539 + .remove = wlcore_remove, 1540 1540 .id_table = wl18xx_id_table, 1541 1541 .driver = { 1542 1542 .name = "wl18xx_driver",
+3 -1
drivers/net/wireless/ti/wlcore/cmd.c
··· 1038 1038 u16 template_id_5 = CMD_TEMPL_CFG_PROBE_REQ_5; 1039 1039 1040 1040 skb = ieee80211_probereq_get(wl->hw, vif, ssid, ssid_len, 1041 - ie, ie_len); 1041 + ie_len); 1042 1042 if (!skb) { 1043 1043 ret = -ENOMEM; 1044 1044 goto out; 1045 1045 } 1046 + if (ie_len) 1047 + memcpy(skb_put(skb, ie_len), ie, ie_len); 1046 1048 1047 1049 wl1271_dump(DEBUG_SCAN, "PROBE REQ: ", skb->data, skb->len); 1048 1050
+2 -2
drivers/net/wireless/ti/wlcore/main.c
··· 5660 5660 complete_all(&wl->nvs_loading_complete); 5661 5661 } 5662 5662 5663 - int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev) 5663 + int wlcore_probe(struct wl1271 *wl, struct platform_device *pdev) 5664 5664 { 5665 5665 int ret; 5666 5666 ··· 5683 5683 } 5684 5684 EXPORT_SYMBOL_GPL(wlcore_probe); 5685 5685 5686 - int __devexit wlcore_remove(struct platform_device *pdev) 5686 + int wlcore_remove(struct platform_device *pdev) 5687 5687 { 5688 5688 struct wl1271 *wl = platform_get_drvdata(pdev); 5689 5689
+4 -4
drivers/net/wireless/ti/wlcore/sdio.c
··· 54 54 struct platform_device *core; 55 55 }; 56 56 57 - static const struct sdio_device_id wl1271_devices[] __devinitconst = { 57 + static const struct sdio_device_id wl1271_devices[] = { 58 58 { SDIO_DEVICE(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271) }, 59 59 {} 60 60 }; ··· 214 214 .set_block_size = wl1271_sdio_set_block_size, 215 215 }; 216 216 217 - static int __devinit wl1271_probe(struct sdio_func *func, 217 + static int wl1271_probe(struct sdio_func *func, 218 218 const struct sdio_device_id *id) 219 219 { 220 220 struct wl12xx_platform_data *wlan_data; ··· 319 319 return ret; 320 320 } 321 321 322 - static void __devexit wl1271_remove(struct sdio_func *func) 322 + static void wl1271_remove(struct sdio_func *func) 323 323 { 324 324 struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func); 325 325 ··· 384 384 .name = "wl1271_sdio", 385 385 .id_table = wl1271_devices, 386 386 .probe = wl1271_probe, 387 - .remove = __devexit_p(wl1271_remove), 387 + .remove = wl1271_remove, 388 388 #ifdef CONFIG_PM 389 389 .drv = { 390 390 .pm = &wl1271_sdio_pm_ops,
+3 -3
drivers/net/wireless/ti/wlcore/spi.c
··· 324 324 .set_block_size = NULL, 325 325 }; 326 326 327 - static int __devinit wl1271_probe(struct spi_device *spi) 327 + static int wl1271_probe(struct spi_device *spi) 328 328 { 329 329 struct wl12xx_spi_glue *glue; 330 330 struct wl12xx_platform_data *pdata; ··· 403 403 return ret; 404 404 } 405 405 406 - static int __devexit wl1271_remove(struct spi_device *spi) 406 + static int wl1271_remove(struct spi_device *spi) 407 407 { 408 408 struct wl12xx_spi_glue *glue = spi_get_drvdata(spi); 409 409 ··· 422 422 }, 423 423 424 424 .probe = wl1271_probe, 425 - .remove = __devexit_p(wl1271_remove), 425 + .remove = wl1271_remove, 426 426 }; 427 427 428 428 static int __init wl1271_init(void)
+2 -2
drivers/net/wireless/ti/wlcore/wlcore.h
··· 414 414 struct completion nvs_loading_complete; 415 415 }; 416 416 417 - int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev); 418 - int __devexit wlcore_remove(struct platform_device *pdev); 417 + int wlcore_probe(struct wl1271 *wl, struct platform_device *pdev); 418 + int wlcore_remove(struct platform_device *pdev); 419 419 struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size); 420 420 int wlcore_free_hw(struct wl1271 *wl); 421 421 int wlcore_set_key(struct wl1271 *wl, enum set_key_cmd cmd,
+91 -9
drivers/ssb/driver_chipcommon.c
··· 4 4 * 5 5 * Copyright 2005, Broadcom Corporation 6 6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch> 7 + * Copyright 2012, Hauke Mehrtens <hauke@hauke-m.de> 7 8 * 8 9 * Licensed under the GNU/GPL. See COPYING for details. 9 10 */ ··· 13 12 #include <linux/ssb/ssb_regs.h> 14 13 #include <linux/export.h> 15 14 #include <linux/pci.h> 15 + #include <linux/bcm47xx_wdt.h> 16 16 17 17 #include "ssb_private.h" 18 18 ··· 282 280 cc->fast_pwrup_delay = tmp; 283 281 } 284 282 283 + static u32 ssb_chipco_alp_clock(struct ssb_chipcommon *cc) 284 + { 285 + if (cc->capabilities & SSB_CHIPCO_CAP_PMU) 286 + return ssb_pmu_get_alp_clock(cc); 287 + 288 + return 20000000; 289 + } 290 + 291 + static u32 ssb_chipco_watchdog_get_max_timer(struct ssb_chipcommon *cc) 292 + { 293 + u32 nb; 294 + 295 + if (cc->capabilities & SSB_CHIPCO_CAP_PMU) { 296 + if (cc->dev->id.revision < 26) 297 + nb = 16; 298 + else 299 + nb = (cc->dev->id.revision >= 37) ? 32 : 24; 300 + } else { 301 + nb = 28; 302 + } 303 + if (nb == 32) 304 + return 0xffffffff; 305 + else 306 + return (1 << nb) - 1; 307 + } 308 + 309 + u32 ssb_chipco_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks) 310 + { 311 + struct ssb_chipcommon *cc = bcm47xx_wdt_get_drvdata(wdt); 312 + 313 + if (cc->dev->bus->bustype != SSB_BUSTYPE_SSB) 314 + return 0; 315 + 316 + return ssb_chipco_watchdog_timer_set(cc, ticks); 317 + } 318 + 319 + u32 ssb_chipco_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms) 320 + { 321 + struct ssb_chipcommon *cc = bcm47xx_wdt_get_drvdata(wdt); 322 + u32 ticks; 323 + 324 + if (cc->dev->bus->bustype != SSB_BUSTYPE_SSB) 325 + return 0; 326 + 327 + ticks = ssb_chipco_watchdog_timer_set(cc, cc->ticks_per_ms * ms); 328 + return ticks / cc->ticks_per_ms; 329 + } 330 + 331 + static int ssb_chipco_watchdog_ticks_per_ms(struct ssb_chipcommon *cc) 332 + { 333 + struct ssb_bus *bus = cc->dev->bus; 334 + 335 + if (cc->capabilities & SSB_CHIPCO_CAP_PMU) { 336 + /* based on 32KHz ILP clock */ 337 + return 32; 338 + } else { 339 + if (cc->dev->id.revision < 18) 340 + return ssb_clockspeed(bus) / 1000; 341 + else 342 + return ssb_chipco_alp_clock(cc) / 1000; 343 + } 344 + } 345 + 285 346 void ssb_chipcommon_init(struct ssb_chipcommon *cc) 286 347 { 287 348 if (!cc->dev) ··· 362 297 chipco_powercontrol_init(cc); 363 298 ssb_chipco_set_clockmode(cc, SSB_CLKMODE_FAST); 364 299 calc_fast_powerup_delay(cc); 300 + 301 + if (cc->dev->bus->bustype == SSB_BUSTYPE_SSB) { 302 + cc->ticks_per_ms = ssb_chipco_watchdog_ticks_per_ms(cc); 303 + cc->max_timer_ms = ssb_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms; 304 + } 365 305 } 366 306 367 307 void ssb_chipco_suspend(struct ssb_chipcommon *cc) ··· 465 395 } 466 396 467 397 /* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */ 468 - void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, u32 ticks) 398 + u32 ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, u32 ticks) 469 399 { 470 - /* instant NMI */ 471 - chipco_write32(cc, SSB_CHIPCO_WATCHDOG, ticks); 400 + u32 maxt; 401 + enum ssb_clkmode clkmode; 402 + 403 + maxt = ssb_chipco_watchdog_get_max_timer(cc); 404 + if (cc->capabilities & SSB_CHIPCO_CAP_PMU) { 405 + if (ticks == 1) 406 + ticks = 2; 407 + else if (ticks > maxt) 408 + ticks = maxt; 409 + chipco_write32(cc, SSB_CHIPCO_PMU_WATCHDOG, ticks); 410 + } else { 411 + clkmode = ticks ? SSB_CLKMODE_FAST : SSB_CLKMODE_DYNAMIC; 412 + ssb_chipco_set_clockmode(cc, clkmode); 413 + if (ticks > maxt) 414 + ticks = maxt; 415 + /* instant NMI */ 416 + chipco_write32(cc, SSB_CHIPCO_WATCHDOG, ticks); 417 + } 418 + return ticks; 472 419 } 473 420 474 421 void ssb_chipco_irq_mask(struct ssb_chipcommon *cc, u32 mask, u32 value) ··· 560 473 chipco_read32(cc, SSB_CHIPCO_CORECTL) 561 474 | SSB_CHIPCO_CORECTL_UARTCLK0); 562 475 } else if ((ccrev >= 11) && (ccrev != 15)) { 563 - /* Fixed ALP clock */ 564 - baud_base = 20000000; 565 - if (cc->capabilities & SSB_CHIPCO_CAP_PMU) { 566 - /* FIXME: baud_base is different for devices with a PMU */ 567 - SSB_WARN_ON(1); 568 - } 476 + baud_base = ssb_chipco_alp_clock(cc); 569 477 div = 1; 570 478 if (ccrev >= 21) { 571 479 /* Turn off UART clock before switching clocksource. */
+27
drivers/ssb/driver_chipcommon_pmu.c
··· 618 618 EXPORT_SYMBOL(ssb_pmu_set_ldo_voltage); 619 619 EXPORT_SYMBOL(ssb_pmu_set_ldo_paref); 620 620 621 + static u32 ssb_pmu_get_alp_clock_clk0(struct ssb_chipcommon *cc) 622 + { 623 + u32 crystalfreq; 624 + const struct pmu0_plltab_entry *e = NULL; 625 + 626 + crystalfreq = chipco_read32(cc, SSB_CHIPCO_PMU_CTL) & 627 + SSB_CHIPCO_PMU_CTL_XTALFREQ >> SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT; 628 + e = pmu0_plltab_find_entry(crystalfreq); 629 + BUG_ON(!e); 630 + return e->freq * 1000; 631 + } 632 + 633 + u32 ssb_pmu_get_alp_clock(struct ssb_chipcommon *cc) 634 + { 635 + struct ssb_bus *bus = cc->dev->bus; 636 + 637 + switch (bus->chip_id) { 638 + case 0x5354: 639 + ssb_pmu_get_alp_clock_clk0(cc); 640 + default: 641 + ssb_printk(KERN_ERR PFX 642 + "ERROR: PMU alp clock unknown for device %04X\n", 643 + bus->chip_id); 644 + return 0; 645 + } 646 + } 647 + 621 648 u32 ssb_pmu_get_cpu_clock(struct ssb_chipcommon *cc) 622 649 { 623 650 struct ssb_bus *bus = cc->dev->bus;
+22 -2
drivers/ssb/driver_extif.c
··· 112 112 *m = extif_read32(extif, SSB_EXTIF_CLOCK_SB); 113 113 } 114 114 115 - void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, 116 - u32 ticks) 115 + u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks) 117 116 { 117 + struct ssb_extif *extif = bcm47xx_wdt_get_drvdata(wdt); 118 + 119 + return ssb_extif_watchdog_timer_set(extif, ticks); 120 + } 121 + 122 + u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms) 123 + { 124 + struct ssb_extif *extif = bcm47xx_wdt_get_drvdata(wdt); 125 + u32 ticks = (SSB_EXTIF_WATCHDOG_CLK / 1000) * ms; 126 + 127 + ticks = ssb_extif_watchdog_timer_set(extif, ticks); 128 + 129 + return (ticks * 1000) / SSB_EXTIF_WATCHDOG_CLK; 130 + } 131 + 132 + u32 ssb_extif_watchdog_timer_set(struct ssb_extif *extif, u32 ticks) 133 + { 134 + if (ticks > SSB_EXTIF_WATCHDOG_MAX_TIMER) 135 + ticks = SSB_EXTIF_WATCHDOG_MAX_TIMER; 118 136 extif_write32(extif, SSB_EXTIF_WATCHDOG, ticks); 137 + 138 + return ticks; 119 139 } 120 140 121 141 u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask)
+7 -7
drivers/ssb/driver_mipscore.c
··· 178 178 { 179 179 struct ssb_bus *bus = mcore->dev->bus; 180 180 181 - if (bus->extif.dev) 181 + if (ssb_extif_available(&bus->extif)) 182 182 mcore->nr_serial_ports = ssb_extif_serial_init(&bus->extif, mcore->serial_ports); 183 - else if (bus->chipco.dev) 183 + else if (ssb_chipco_available(&bus->chipco)) 184 184 mcore->nr_serial_ports = ssb_chipco_serial_init(&bus->chipco, mcore->serial_ports); 185 185 else 186 186 mcore->nr_serial_ports = 0; ··· 191 191 struct ssb_bus *bus = mcore->dev->bus; 192 192 193 193 /* When there is no chipcommon on the bus there is 4MB flash */ 194 - if (!bus->chipco.dev) { 194 + if (!ssb_chipco_available(&bus->chipco)) { 195 195 mcore->pflash.present = true; 196 196 mcore->pflash.buswidth = 2; 197 197 mcore->pflash.window = SSB_FLASH1; ··· 227 227 if (bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU) 228 228 return ssb_pmu_get_cpu_clock(&bus->chipco); 229 229 230 - if (bus->extif.dev) { 230 + if (ssb_extif_available(&bus->extif)) { 231 231 ssb_extif_get_clockcontrol(&bus->extif, &pll_type, &n, &m); 232 - } else if (bus->chipco.dev) { 232 + } else if (ssb_chipco_available(&bus->chipco)) { 233 233 ssb_chipco_get_clockcpu(&bus->chipco, &pll_type, &n, &m); 234 234 } else 235 235 return 0; ··· 265 265 hz = 100000000; 266 266 ns = 1000000000 / hz; 267 267 268 - if (bus->extif.dev) 268 + if (ssb_extif_available(&bus->extif)) 269 269 ssb_extif_timing_init(&bus->extif, ns); 270 - else if (bus->chipco.dev) 270 + else if (ssb_chipco_available(&bus->chipco)) 271 271 ssb_chipco_timing_init(&bus->chipco, ns); 272 272 273 273 /* Assign IRQs to all cores on the bus, start with irq line 2, because serial usually takes 1 */
+35
drivers/ssb/embedded.c
··· 4 4 * 5 5 * Copyright 2005-2008, Broadcom Corporation 6 6 * Copyright 2006-2008, Michael Buesch <m@bues.ch> 7 + * Copyright 2012, Hauke Mehrtens <hauke@hauke-m.de> 7 8 * 8 9 * Licensed under the GNU/GPL. See COPYING for details. 9 10 */ 10 11 11 12 #include <linux/export.h> 13 + #include <linux/platform_device.h> 12 14 #include <linux/ssb/ssb.h> 13 15 #include <linux/ssb/ssb_embedded.h> 14 16 #include <linux/ssb/ssb_driver_pci.h> ··· 33 31 return -ENODEV; 34 32 } 35 33 EXPORT_SYMBOL(ssb_watchdog_timer_set); 34 + 35 + int ssb_watchdog_register(struct ssb_bus *bus) 36 + { 37 + struct bcm47xx_wdt wdt = {}; 38 + struct platform_device *pdev; 39 + 40 + if (ssb_chipco_available(&bus->chipco)) { 41 + wdt.driver_data = &bus->chipco; 42 + wdt.timer_set = ssb_chipco_watchdog_timer_set_wdt; 43 + wdt.timer_set_ms = ssb_chipco_watchdog_timer_set_ms; 44 + wdt.max_timer_ms = bus->chipco.max_timer_ms; 45 + } else if (ssb_extif_available(&bus->extif)) { 46 + wdt.driver_data = &bus->extif; 47 + wdt.timer_set = ssb_extif_watchdog_timer_set_wdt; 48 + wdt.timer_set_ms = ssb_extif_watchdog_timer_set_ms; 49 + wdt.max_timer_ms = SSB_EXTIF_WATCHDOG_MAX_TIMER_MS; 50 + } else { 51 + return -ENODEV; 52 + } 53 + 54 + pdev = platform_device_register_data(NULL, "bcm47xx-wdt", 55 + bus->busnumber, &wdt, 56 + sizeof(wdt)); 57 + if (IS_ERR(pdev)) { 58 + ssb_dprintk(KERN_INFO PFX 59 + "can not register watchdog device, err: %li\n", 60 + PTR_ERR(pdev)); 61 + return PTR_ERR(pdev); 62 + } 63 + 64 + bus->watchdog = pdev; 65 + return 0; 66 + } 36 67 37 68 u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask) 38 69 {
+8
drivers/ssb/main.c
··· 13 13 #include <linux/delay.h> 14 14 #include <linux/io.h> 15 15 #include <linux/module.h> 16 + #include <linux/platform_device.h> 16 17 #include <linux/ssb/ssb.h> 17 18 #include <linux/ssb/ssb_regs.h> 18 19 #include <linux/ssb/ssb_driver_gige.h> ··· 434 433 if (sdev->dev) 435 434 device_unregister(sdev->dev); 436 435 } 436 + 437 + #ifdef CONFIG_SSB_EMBEDDED 438 + if (bus->bustype == SSB_BUSTYPE_SSB) 439 + platform_device_unregister(bus->watchdog); 440 + #endif 437 441 } 438 442 439 443 void ssb_bus_unregister(struct ssb_bus *bus) ··· 567 561 if (err) 568 562 goto error; 569 563 ssb_pcicore_init(&bus->pcicore); 564 + if (bus->bustype == SSB_BUSTYPE_SSB) 565 + ssb_watchdog_register(bus); 570 566 ssb_bus_may_powerdown(bus); 571 567 572 568 err = ssb_devices_register(bus);
+31
drivers/ssb/ssb_private.h
··· 3 3 4 4 #include <linux/ssb/ssb.h> 5 5 #include <linux/types.h> 6 + #include <linux/bcm47xx_wdt.h> 6 7 7 8 8 9 #define PFX "ssb: " ··· 211 210 /* driver_chipcommon_pmu.c */ 212 211 extern u32 ssb_pmu_get_cpu_clock(struct ssb_chipcommon *cc); 213 212 extern u32 ssb_pmu_get_controlclock(struct ssb_chipcommon *cc); 213 + extern u32 ssb_pmu_get_alp_clock(struct ssb_chipcommon *cc); 214 + 215 + extern u32 ssb_chipco_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, 216 + u32 ticks); 217 + extern u32 ssb_chipco_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms); 218 + 219 + #ifdef CONFIG_SSB_DRIVER_EXTIF 220 + extern u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks); 221 + extern u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms); 222 + #else 223 + static inline u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, 224 + u32 ticks) 225 + { 226 + return 0; 227 + } 228 + static inline u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, 229 + u32 ms) 230 + { 231 + return 0; 232 + } 233 + #endif 234 + 235 + #ifdef CONFIG_SSB_EMBEDDED 236 + extern int ssb_watchdog_register(struct ssb_bus *bus); 237 + #else /* CONFIG_SSB_EMBEDDED */ 238 + static inline int ssb_watchdog_register(struct ssb_bus *bus) 239 + { 240 + return 0; 241 + } 242 + #endif /* CONFIG_SSB_EMBEDDED */ 214 243 215 244 #endif /* LINUX_SSB_PRIVATE_H_ */
+19
include/linux/bcm47xx_wdt.h
··· 1 + #ifndef LINUX_BCM47XX_WDT_H_ 2 + #define LINUX_BCM47XX_WDT_H_ 3 + 4 + #include <linux/types.h> 5 + 6 + 7 + struct bcm47xx_wdt { 8 + u32 (*timer_set)(struct bcm47xx_wdt *, u32); 9 + u32 (*timer_set_ms)(struct bcm47xx_wdt *, u32); 10 + u32 max_timer_ms; 11 + 12 + void *driver_data; 13 + }; 14 + 15 + static inline void *bcm47xx_wdt_get_drvdata(struct bcm47xx_wdt *wdt) 16 + { 17 + return wdt->driver_data; 18 + } 19 + #endif /* LINUX_BCM47XX_WDT_H_ */
+5 -2
include/linux/bcma/bcma_driver_chipcommon.h
··· 1 1 #ifndef LINUX_BCMA_DRIVER_CC_H_ 2 2 #define LINUX_BCMA_DRIVER_CC_H_ 3 3 4 + #include <linux/platform_device.h> 5 + 4 6 /** ChipCommon core registers. **/ 5 7 #define BCMA_CC_ID 0x0000 6 8 #define BCMA_CC_ID_ID 0x0000FFFF ··· 572 570 int nr_serial_ports; 573 571 struct bcma_serial_port serial_ports[4]; 574 572 #endif /* CONFIG_BCMA_DRIVER_MIPS */ 573 + u32 ticks_per_ms; 574 + struct platform_device *watchdog; 575 575 }; 576 576 577 577 /* Register access */ ··· 597 593 598 594 void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); 599 595 600 - extern void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, 601 - u32 ticks); 596 + extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); 602 597 603 598 void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value); 604 599
+15
include/linux/ieee80211.h
··· 1213 1213 } __packed; 1214 1214 1215 1215 /** 1216 + * enum ieee80211_vht_chanwidth - VHT channel width 1217 + * @IEEE80211_VHT_CHANWIDTH_USE_HT: use the HT operation IE to 1218 + * determine the channel width (20 or 40 MHz) 1219 + * @IEEE80211_VHT_CHANWIDTH_80MHZ: 80 MHz bandwidth 1220 + * @IEEE80211_VHT_CHANWIDTH_160MHZ: 160 MHz bandwidth 1221 + * @IEEE80211_VHT_CHANWIDTH_80P80MHZ: 80+80 MHz bandwidth 1222 + */ 1223 + enum ieee80211_vht_chanwidth { 1224 + IEEE80211_VHT_CHANWIDTH_USE_HT = 0, 1225 + IEEE80211_VHT_CHANWIDTH_80MHZ = 1, 1226 + IEEE80211_VHT_CHANWIDTH_160MHZ = 2, 1227 + IEEE80211_VHT_CHANWIDTH_80P80MHZ = 3, 1228 + }; 1229 + 1230 + /** 1216 1231 * struct ieee80211_vht_operation - VHT operation IE 1217 1232 * 1218 1233 * This structure is the "VHT operation element" as
+2
include/linux/ssb/ssb.h
··· 8 8 #include <linux/pci.h> 9 9 #include <linux/mod_devicetable.h> 10 10 #include <linux/dma-mapping.h> 11 + #include <linux/platform_device.h> 11 12 12 13 #include <linux/ssb/ssb_regs.h> 13 14 ··· 433 432 #ifdef CONFIG_SSB_EMBEDDED 434 433 /* Lock for GPIO register access. */ 435 434 spinlock_t gpio_lock; 435 + struct platform_device *watchdog; 436 436 #endif /* EMBEDDED */ 437 437 438 438 /* Internal-only stuff follows. Do not touch. */
+3 -2
include/linux/ssb/ssb_driver_chipcommon.h
··· 591 591 /* Fast Powerup Delay constant */ 592 592 u16 fast_pwrup_delay; 593 593 struct ssb_chipcommon_pmu pmu; 594 + u32 ticks_per_ms; 595 + u32 max_timer_ms; 594 596 }; 595 597 596 598 static inline bool ssb_chipco_available(struct ssb_chipcommon *cc) ··· 632 630 extern void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc, 633 631 enum ssb_clkmode mode); 634 632 635 - extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, 636 - u32 ticks); 633 + extern u32 ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, u32 ticks); 637 634 638 635 void ssb_chipco_irq_mask(struct ssb_chipcommon *cc, u32 mask, u32 value); 639 636
+48 -4
include/linux/ssb/ssb_driver_extif.h
··· 152 152 /* watchdog */ 153 153 #define SSB_EXTIF_WATCHDOG_CLK 48000000 /* Hz */ 154 154 155 + #define SSB_EXTIF_WATCHDOG_MAX_TIMER ((1 << 28) - 1) 156 + #define SSB_EXTIF_WATCHDOG_MAX_TIMER_MS (SSB_EXTIF_WATCHDOG_MAX_TIMER \ 157 + / (SSB_EXTIF_WATCHDOG_CLK / 1000)) 155 158 156 159 157 160 #ifdef CONFIG_SSB_DRIVER_EXTIF ··· 174 171 extern void ssb_extif_timing_init(struct ssb_extif *extif, 175 172 unsigned long ns); 176 173 177 - extern void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, 178 - u32 ticks); 174 + extern u32 ssb_extif_watchdog_timer_set(struct ssb_extif *extif, u32 ticks); 179 175 180 176 /* Extif GPIO pin access */ 181 177 u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask); ··· 207 205 } 208 206 209 207 static inline 210 - void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, 211 - u32 ticks) 208 + void ssb_extif_timing_init(struct ssb_extif *extif, unsigned long ns) 212 209 { 213 210 } 211 + 212 + static inline 213 + u32 ssb_extif_watchdog_timer_set(struct ssb_extif *extif, u32 ticks) 214 + { 215 + return 0; 216 + } 217 + 218 + static inline u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask) 219 + { 220 + return 0; 221 + } 222 + 223 + static inline u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, 224 + u32 value) 225 + { 226 + return 0; 227 + } 228 + 229 + static inline u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, 230 + u32 value) 231 + { 232 + return 0; 233 + } 234 + 235 + static inline u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, 236 + u32 value) 237 + { 238 + return 0; 239 + } 240 + 241 + static inline u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, 242 + u32 value) 243 + { 244 + return 0; 245 + } 246 + 247 + #ifdef CONFIG_SSB_SERIAL 248 + static inline int ssb_extif_serial_init(struct ssb_extif *extif, 249 + struct ssb_serial_port *ports) 250 + { 251 + return 0; 252 + } 253 + #endif /* CONFIG_SSB_SERIAL */ 214 254 215 255 #endif /* CONFIG_SSB_DRIVER_EXTIF */ 216 256 #endif /* LINUX_SSB_EXTIFCORE_H_ */
+25 -6
include/net/bluetooth/hci_core.h
··· 376 376 extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, 377 377 u16 flags); 378 378 379 - extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 379 + extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags); 380 380 extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status); 381 381 extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); 382 382 extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); ··· 577 577 int hci_conn_del(struct hci_conn *conn); 578 578 void hci_conn_hash_flush(struct hci_dev *hdev); 579 579 void hci_conn_check_pending(struct hci_dev *hdev); 580 + void hci_conn_accept(struct hci_conn *conn, int mask); 580 581 581 582 struct hci_chan *hci_chan_create(struct hci_conn *conn); 582 583 void hci_chan_del(struct hci_chan *chan); ··· 767 766 #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) 768 767 #define lmp_pause_enc_capable(dev) ((dev)->features[5] & LMP_PAUSE_ENC) 769 768 #define lmp_ext_inq_capable(dev) ((dev)->features[6] & LMP_EXT_INQ) 770 - #define lmp_le_br_capable(dev) ((dev)->features[6] & LMP_SIMUL_LE_BR) 769 + #define lmp_le_br_capable(dev) !!((dev)->features[6] & LMP_SIMUL_LE_BR) 771 770 #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) 772 771 #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) 773 772 #define lmp_lsto_capable(dev) ((dev)->features[7] & LMP_LSTO) ··· 776 775 777 776 /* ----- Extended LMP capabilities ----- */ 778 777 #define lmp_host_ssp_capable(dev) ((dev)->host_features[0] & LMP_HOST_SSP) 779 - #define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE) 780 - #define lmp_host_le_br_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE_BREDR) 778 + #define lmp_host_le_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE) 779 + #define lmp_host_le_br_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE_BREDR) 780 + 781 + /* returns true if at least one AMP active */ 782 + static inline bool hci_amp_capable(void) 783 + { 784 + struct hci_dev *hdev; 785 + bool ret = false; 786 + 787 + read_lock(&hci_dev_list_lock); 788 + list_for_each_entry(hdev, &hci_dev_list, list) 789 + if (hdev->amp_type == HCI_AMP && 790 + test_bit(HCI_UP, &hdev->flags)) 791 + ret = true; 792 + read_unlock(&hci_dev_list_lock); 793 + 794 + return ret; 795 + } 781 796 782 797 /* ----- HCI protocols ----- */ 798 + #define HCI_PROTO_DEFER 0x01 799 + 783 800 static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, 784 - __u8 type) 801 + __u8 type, __u8 *flags) 785 802 { 786 803 switch (type) { 787 804 case ACL_LINK: ··· 807 788 808 789 case SCO_LINK: 809 790 case ESCO_LINK: 810 - return sco_connect_ind(hdev, bdaddr); 791 + return sco_connect_ind(hdev, bdaddr, flags); 811 792 812 793 default: 813 794 BT_ERR("unknown link type %d", type);
+1 -1
include/net/bluetooth/l2cap.h
··· 611 611 CONF_MTU_DONE, 612 612 CONF_MODE_DONE, 613 613 CONF_CONNECT_PEND, 614 - CONF_NO_FCS_RECV, 614 + CONF_RECV_NO_FCS, 615 615 CONF_STATE2_DEVICE, 616 616 CONF_EWS_RECV, 617 617 CONF_LOC_CONF_PEND,
+53 -18
include/net/cfg80211.h
··· 58 58 * structures here describe these capabilities in detail. 59 59 */ 60 60 61 + struct wiphy; 62 + 61 63 /* 62 64 * wireless hardware capability structures 63 65 */ ··· 390 388 const struct cfg80211_chan_def *chandef2); 391 389 392 390 /** 391 + * cfg80211_chandef_valid - check if a channel definition is valid 392 + * @chandef: the channel definition to check 393 + */ 394 + bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef); 395 + 396 + /** 397 + * cfg80211_chandef_usable - check if secondary channels can be used 398 + * @wiphy: the wiphy to validate against 399 + * @chandef: the channel definition to check 400 + * @prohibited_flags: the regulatory chanenl flags that must not be set 401 + */ 402 + bool cfg80211_chandef_usable(struct wiphy *wiphy, 403 + const struct cfg80211_chan_def *chandef, 404 + u32 prohibited_flags); 405 + 406 + /** 393 407 * enum survey_info_flags - survey information flags 394 408 * 395 409 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in ··· 538 520 * @privacy: the BSS uses privacy 539 521 * @auth_type: Authentication type (algorithm) 540 522 * @inactivity_timeout: time in seconds to determine station's inactivity. 523 + * @p2p_ctwindow: P2P CT Window 524 + * @p2p_opp_ps: P2P opportunistic PS 541 525 */ 542 526 struct cfg80211_ap_settings { 543 527 struct cfg80211_chan_def chandef; ··· 554 534 bool privacy; 555 535 enum nl80211_auth_type auth_type; 556 536 int inactivity_timeout; 537 + u8 p2p_ctwindow; 538 + bool p2p_opp_ps; 557 539 }; 558 540 559 541 /** ··· 917 895 * @ap_isolate: do not forward packets between connected stations 918 896 * @ht_opmode: HT Operation mode 919 897 * (u16 = opmode, -1 = do not change) 898 + * @p2p_ctwindow: P2P CT Window (-1 = no change) 899 + * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 920 900 */ 921 901 struct bss_parameters { 922 902 int use_cts_prot; ··· 928 904 u8 basic_rates_len; 929 905 int ap_isolate; 930 906 int ht_opmode; 907 + s8 p2p_ctwindow, p2p_opp_ps; 931 908 }; 932 909 933 910 /** ··· 1070 1045 u8 aifs; 1071 1046 }; 1072 1047 1073 - /* from net/wireless.h */ 1074 - struct wiphy; 1075 - 1076 1048 /** 1077 1049 * DOC: Scanning and BSS list handling 1078 1050 * ··· 1206 1184 }; 1207 1185 1208 1186 /** 1187 + * struct cfg80211_bss_ie_data - BSS entry IE data 1188 + * @rcu_head: internal use, for freeing 1189 + * @len: length of the IEs 1190 + * @data: IE data 1191 + */ 1192 + struct cfg80211_bss_ies { 1193 + struct rcu_head rcu_head; 1194 + int len; 1195 + u8 data[]; 1196 + }; 1197 + 1198 + /** 1209 1199 * struct cfg80211_bss - BSS description 1210 1200 * 1211 1201 * This structure describes a BSS (which may also be a mesh network) ··· 1228 1194 * @tsf: timestamp of last received update 1229 1195 * @beacon_interval: the beacon interval as from the frame 1230 1196 * @capability: the capability field in host byte order 1231 - * @information_elements: the information elements (Note that there 1197 + * @ies: the information elements (Note that there 1232 1198 * is no guarantee that these are well-formed!); this is a pointer to 1233 1199 * either the beacon_ies or proberesp_ies depending on whether Probe 1234 1200 * Response frame has been received 1235 - * @len_information_elements: total length of the information elements 1236 1201 * @beacon_ies: the information elements from the last Beacon frame 1237 - * @len_beacon_ies: total length of the beacon_ies 1238 1202 * @proberesp_ies: the information elements from the last Probe Response frame 1239 - * @len_proberesp_ies: total length of the proberesp_ies 1240 1203 * @signal: signal strength value (type depends on the wiphy's signal_type) 1241 1204 * @free_priv: function pointer to free private data 1242 1205 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 1243 1206 */ 1244 1207 struct cfg80211_bss { 1208 + u64 tsf; 1209 + 1245 1210 struct ieee80211_channel *channel; 1246 1211 1247 - u8 bssid[ETH_ALEN]; 1248 - u64 tsf; 1249 - u16 beacon_interval; 1250 - u16 capability; 1251 - u8 *information_elements; 1252 - size_t len_information_elements; 1253 - u8 *beacon_ies; 1254 - size_t len_beacon_ies; 1255 - u8 *proberesp_ies; 1256 - size_t len_proberesp_ies; 1212 + const struct cfg80211_bss_ies __rcu *ies; 1213 + const struct cfg80211_bss_ies __rcu *beacon_ies; 1214 + const struct cfg80211_bss_ies __rcu *proberesp_ies; 1215 + 1216 + void (*free_priv)(struct cfg80211_bss *bss); 1257 1217 1258 1218 s32 signal; 1259 1219 1260 - void (*free_priv)(struct cfg80211_bss *bss); 1220 + u16 beacon_interval; 1221 + u16 capability; 1222 + 1223 + u8 bssid[ETH_ALEN]; 1224 + 1261 1225 u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); 1262 1226 }; 1263 1227 ··· 1263 1231 * ieee80211_bss_get_ie - find IE with given ID 1264 1232 * @bss: the bss to search 1265 1233 * @ie: the IE ID 1234 + * 1235 + * Note that the return value is an RCU-protected pointer, so 1236 + * rcu_read_lock() must be held when calling this function. 1266 1237 * Returns %NULL if not found. 1267 1238 */ 1268 1239 const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
+24
include/net/ieee80211_radiotap.h
··· 186 186 * IEEE80211_RADIOTAP_AMPDU_STATUS u32, u16, u8, u8 unitless 187 187 * 188 188 * Contains the AMPDU information for the subframe. 189 + * 190 + * IEEE80211_RADIOTAP_VHT u16, u8, u8, u8[4], u8, u8, u16 191 + * 192 + * Contains VHT information about this frame. 189 193 */ 190 194 enum ieee80211_radiotap_type { 191 195 IEEE80211_RADIOTAP_TSFT = 0, ··· 213 209 214 210 IEEE80211_RADIOTAP_MCS = 19, 215 211 IEEE80211_RADIOTAP_AMPDU_STATUS = 20, 212 + IEEE80211_RADIOTAP_VHT = 21, 216 213 217 214 /* valid in every it_present bitmap, even vendor namespaces */ 218 215 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, ··· 286 281 #define IEEE80211_RADIOTAP_AMPDU_IS_LAST 0x0008 287 282 #define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR 0x0010 288 283 #define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN 0x0020 284 + 285 + /* For IEEE80211_RADIOTAP_VHT */ 286 + #define IEEE80211_RADIOTAP_VHT_KNOWN_STBC 0x0001 287 + #define IEEE80211_RADIOTAP_VHT_KNOWN_TXOP_PS_NA 0x0002 288 + #define IEEE80211_RADIOTAP_VHT_KNOWN_GI 0x0004 289 + #define IEEE80211_RADIOTAP_VHT_KNOWN_SGI_NSYM_DIS 0x0008 290 + #define IEEE80211_RADIOTAP_VHT_KNOWN_LDPC_EXTRA_OFDM_SYM 0x0010 291 + #define IEEE80211_RADIOTAP_VHT_KNOWN_BEAMFORMED 0x0020 292 + #define IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH 0x0040 293 + #define IEEE80211_RADIOTAP_VHT_KNOWN_GROUP_ID 0x0080 294 + #define IEEE80211_RADIOTAP_VHT_KNOWN_PARTIAL_AID 0x0100 295 + 296 + #define IEEE80211_RADIOTAP_VHT_FLAG_STBC 0x01 297 + #define IEEE80211_RADIOTAP_VHT_FLAG_TXOP_PS_NA 0x02 298 + #define IEEE80211_RADIOTAP_VHT_FLAG_SGI 0x04 299 + #define IEEE80211_RADIOTAP_VHT_FLAG_SGI_NSYM_M10_9 0x08 300 + #define IEEE80211_RADIOTAP_VHT_FLAG_LDPC_EXTRA_OFDM_SYM 0x10 301 + #define IEEE80211_RADIOTAP_VHT_FLAG_BEAMFORMED 0x20 302 + 289 303 290 304 /* helpers */ 291 305 static inline int ieee80211_get_radiotap_len(unsigned char *data)
+8 -4
include/net/mac80211.h
··· 164 164 * active on the channel to receive MIMO transmissions 165 165 * @rx_chains_dynamic: The number of RX chains that must be enabled 166 166 * after RTS/CTS handshake to receive SMPS MIMO transmissions; 167 - * this will always be >= @rx_chains_always. 167 + * this will always be >= @rx_chains_static. 168 168 * @drv_priv: data area for driver use, will always be aligned to 169 169 * sizeof(void *), size is determined in hw information. 170 170 */ ··· 1473 1473 * include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_* values, only 1474 1474 * adding _BW is supported today. 1475 1475 * 1476 + * @radiotap_vht_details: lists which VHT MCS information the HW reports, 1477 + * the default is _GI | _BANDWIDTH. 1478 + * Use the %IEEE80211_RADIOTAP_VHT_KNOWN_* values. 1479 + * 1476 1480 * @netdev_features: netdev features to be set in each netdev created 1477 1481 * from this HW. Note only HW checksum features are currently 1478 1482 * compatible with mac80211. Other feature bits will be rejected. ··· 1503 1499 u8 max_tx_aggregation_subframes; 1504 1500 u8 offchannel_tx_hw_queue; 1505 1501 u8 radiotap_mcs_details; 1502 + u16 radiotap_vht_details; 1506 1503 netdev_features_t netdev_features; 1507 1504 }; 1508 1505 ··· 3144 3139 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3145 3140 * @ssid: SSID buffer 3146 3141 * @ssid_len: length of SSID 3147 - * @ie: buffer containing all IEs except SSID for the template 3148 - * @ie_len: length of the IE buffer 3142 + * @tailroom: tailroom to reserve at end of SKB for IEs 3149 3143 * 3150 3144 * Creates a Probe Request template which can, for example, be uploaded to 3151 3145 * hardware. ··· 3152 3148 struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, 3153 3149 struct ieee80211_vif *vif, 3154 3150 const u8 *ssid, size_t ssid_len, 3155 - const u8 *ie, size_t ie_len); 3151 + size_t tailroom); 3156 3152 3157 3153 /** 3158 3154 * ieee80211_rts_get - RTS frame generation function
+16
include/uapi/linux/nl80211.h
··· 1303 1303 * 1304 1304 * @NL80211_ATTR_SCAN_FLAGS: scan request control flags (u32) 1305 1305 * 1306 + * @NL80211_ATTR_P2P_CTWINDOW: P2P GO Client Traffic Window (u8), used with 1307 + * the START_AP and SET_BSS commands 1308 + * @NL80211_ATTR_P2P_OPPPS: P2P GO opportunistic PS (u8), used with the 1309 + * START_AP and SET_BSS commands. This can have the values 0 or 1; 1310 + * if not given in START_AP 0 is assumed, if not given in SET_BSS 1311 + * no change is made. 1312 + * 1306 1313 * @NL80211_ATTR_MAX: highest attribute number currently defined 1307 1314 * @__NL80211_ATTR_AFTER_LAST: internal use 1308 1315 */ ··· 1576 1569 NL80211_ATTR_CHANNEL_WIDTH, 1577 1570 NL80211_ATTR_CENTER_FREQ1, 1578 1571 NL80211_ATTR_CENTER_FREQ2, 1572 + 1573 + NL80211_ATTR_P2P_CTWINDOW, 1574 + NL80211_ATTR_P2P_OPPPS, 1579 1575 1580 1576 /* add attributes here, update the policy in nl80211.c */ 1581 1577 ··· 3136 3126 * @NL80211_FEATURE_NEED_OBSS_SCAN: The driver expects userspace to perform 3137 3127 * OBSS scans and generate 20/40 BSS coex reports. This flag is used only 3138 3128 * for drivers implementing the CONNECT API, for AUTH/ASSOC it is implied. 3129 + * @NL80211_FEATURE_P2P_GO_CTWIN: P2P GO implementation supports CT Window 3130 + * setting 3131 + * @NL80211_FEATURE_P2P_GO_OPPPS: P2P GO implementation supports opportunistic 3132 + * powersave 3139 3133 */ 3140 3134 enum nl80211_feature_flags { 3141 3135 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, ··· 3153 3139 NL80211_FEATURE_AP_SCAN = 1 << 8, 3154 3140 NL80211_FEATURE_VIF_TXPOWER = 1 << 9, 3155 3141 NL80211_FEATURE_NEED_OBSS_SCAN = 1 << 10, 3142 + NL80211_FEATURE_P2P_GO_CTWIN = 1 << 11, 3143 + NL80211_FEATURE_P2P_GO_OPPPS = 1 << 12, 3156 3144 }; 3157 3145 3158 3146 /**
+5
net/bluetooth/hci_core.c
··· 861 861 /* Clear flags */ 862 862 hdev->flags = 0; 863 863 864 + /* Controller radio is available but is currently powered down */ 865 + hdev->amp_status = 0; 866 + 864 867 memset(hdev->eir, 0, sizeof(hdev->eir)); 865 868 memset(hdev->dev_class, 0, sizeof(hdev->dev_class)); 866 869 ··· 1856 1853 1857 1854 for (i = 0; i < NUM_REASSEMBLY; i++) 1858 1855 kfree_skb(hdev->reassembly[i]); 1856 + 1857 + cancel_work_sync(&hdev->power_on); 1859 1858 1860 1859 if (!test_bit(HCI_INIT, &hdev->flags) && 1861 1860 !test_bit(HCI_SETUP, &hdev->dev_flags)) {
+50 -6
net/bluetooth/hci_event.c
··· 794 794 795 795 if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) { 796 796 cp.le = 1; 797 - cp.simul = !!lmp_le_br_capable(hdev); 797 + cp.simul = lmp_le_br_capable(hdev); 798 798 } 799 799 800 - if (cp.le != !!lmp_host_le_capable(hdev)) 800 + if (cp.le != lmp_host_le_capable(hdev)) 801 801 hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(cp), 802 802 &cp); 803 803 } ··· 2047 2047 hci_conn_check_pending(hdev); 2048 2048 } 2049 2049 2050 + void hci_conn_accept(struct hci_conn *conn, int mask) 2051 + { 2052 + struct hci_dev *hdev = conn->hdev; 2053 + 2054 + BT_DBG("conn %p", conn); 2055 + 2056 + conn->state = BT_CONFIG; 2057 + 2058 + if (!lmp_esco_capable(hdev)) { 2059 + struct hci_cp_accept_conn_req cp; 2060 + 2061 + bacpy(&cp.bdaddr, &conn->dst); 2062 + 2063 + if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER)) 2064 + cp.role = 0x00; /* Become master */ 2065 + else 2066 + cp.role = 0x01; /* Remain slave */ 2067 + 2068 + hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), &cp); 2069 + } else /* lmp_esco_capable(hdev)) */ { 2070 + struct hci_cp_accept_sync_conn_req cp; 2071 + 2072 + bacpy(&cp.bdaddr, &conn->dst); 2073 + cp.pkt_type = cpu_to_le16(conn->pkt_type); 2074 + 2075 + cp.tx_bandwidth = __constant_cpu_to_le32(0x00001f40); 2076 + cp.rx_bandwidth = __constant_cpu_to_le32(0x00001f40); 2077 + cp.max_latency = __constant_cpu_to_le16(0xffff); 2078 + cp.content_format = cpu_to_le16(hdev->voice_setting); 2079 + cp.retrans_effort = 0xff; 2080 + 2081 + hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, 2082 + sizeof(cp), &cp); 2083 + } 2084 + } 2085 + 2050 2086 static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) 2051 2087 { 2052 2088 struct hci_ev_conn_request *ev = (void *) skb->data; 2053 2089 int mask = hdev->link_mode; 2090 + __u8 flags = 0; 2054 2091 2055 2092 BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr, 2056 2093 ev->link_type); 2057 2094 2058 - mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type); 2095 + mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type, 2096 + &flags); 2059 2097 2060 2098 if ((mask & HCI_LM_ACCEPT) && 2061 2099 !hci_blacklist_lookup(hdev, &ev->bdaddr)) { ··· 2119 2081 } 2120 2082 2121 2083 memcpy(conn->dev_class, ev->dev_class, 3); 2122 - conn->state = BT_CONNECT; 2123 2084 2124 2085 hci_dev_unlock(hdev); 2125 2086 2126 - if (ev->link_type == ACL_LINK || !lmp_esco_capable(hdev)) { 2087 + if (ev->link_type == ACL_LINK || 2088 + (!(flags & HCI_PROTO_DEFER) && !lmp_esco_capable(hdev))) { 2127 2089 struct hci_cp_accept_conn_req cp; 2090 + conn->state = BT_CONNECT; 2128 2091 2129 2092 bacpy(&cp.bdaddr, &ev->bdaddr); 2130 2093 ··· 2136 2097 2137 2098 hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), 2138 2099 &cp); 2139 - } else { 2100 + } else if (!(flags & HCI_PROTO_DEFER)) { 2140 2101 struct hci_cp_accept_sync_conn_req cp; 2102 + conn->state = BT_CONNECT; 2141 2103 2142 2104 bacpy(&cp.bdaddr, &ev->bdaddr); 2143 2105 cp.pkt_type = cpu_to_le16(conn->pkt_type); ··· 2151 2111 2152 2112 hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, 2153 2113 sizeof(cp), &cp); 2114 + } else { 2115 + conn->state = BT_CONNECT2; 2116 + hci_proto_connect_cfm(conn, 0); 2117 + hci_conn_put(conn); 2154 2118 } 2155 2119 } else { 2156 2120 /* Connection rejected */
+51 -49
net/bluetooth/l2cap_core.c
··· 53 53 static void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, 54 54 void *data); 55 55 static int l2cap_build_conf_req(struct l2cap_chan *chan, void *data); 56 - static void l2cap_send_disconn_req(struct l2cap_conn *conn, 57 - struct l2cap_chan *chan, int err); 56 + static void l2cap_send_disconn_req(struct l2cap_chan *chan, int err); 58 57 59 58 static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control, 60 59 struct sk_buff_head *skbs, u8 event); ··· 631 632 if (chan->chan_type == L2CAP_CHAN_CONN_ORIENTED && 632 633 conn->hcon->type == ACL_LINK) { 633 634 __set_chan_timer(chan, sk->sk_sndtimeo); 634 - l2cap_send_disconn_req(conn, chan, reason); 635 + l2cap_send_disconn_req(chan, reason); 635 636 } else 636 637 l2cap_chan_del(chan, reason); 637 638 break; ··· 1013 1014 struct l2cap_conn *conn = chan->conn; 1014 1015 1015 1016 if (enable_hs && 1017 + hci_amp_capable() && 1016 1018 chan->chan_policy == BT_CHANNEL_POLICY_AMP_PREFERRED && 1017 1019 conn->fixed_chan_mask & L2CAP_FC_A2MP) 1018 1020 return true; ··· 1180 1180 } 1181 1181 } 1182 1182 1183 - static void l2cap_send_disconn_req(struct l2cap_conn *conn, 1184 - struct l2cap_chan *chan, int err) 1183 + static void l2cap_send_disconn_req(struct l2cap_chan *chan, int err) 1185 1184 { 1186 1185 struct sock *sk = chan->sk; 1186 + struct l2cap_conn *conn = chan->conn; 1187 1187 struct l2cap_disconn_req req; 1188 1188 1189 1189 if (!conn) ··· 1960 1960 if (chan->max_tx != 0 && 1961 1961 bt_cb(skb)->control.retries > chan->max_tx) { 1962 1962 BT_DBG("Retry limit exceeded (%d)", chan->max_tx); 1963 - l2cap_send_disconn_req(chan->conn, chan, ECONNRESET); 1963 + l2cap_send_disconn_req(chan, ECONNRESET); 1964 1964 l2cap_seq_list_clear(&chan->retrans_list); 1965 1965 break; 1966 1966 } ··· 2666 2666 __set_monitor_timer(chan); 2667 2667 chan->retry_count++; 2668 2668 } else { 2669 - l2cap_send_disconn_req(chan->conn, chan, ECONNABORTED); 2669 + l2cap_send_disconn_req(chan, ECONNABORTED); 2670 2670 } 2671 2671 break; 2672 2672 default: ··· 3106 3106 if (test_bit(FLAG_EFS_ENABLE, &chan->flags)) 3107 3107 l2cap_add_opt_efs(&ptr, chan); 3108 3108 3109 - if (!(chan->conn->feat_mask & L2CAP_FEAT_FCS)) 3110 - break; 3111 - 3112 - if (chan->fcs == L2CAP_FCS_NONE || 3113 - test_bit(CONF_NO_FCS_RECV, &chan->conf_state)) { 3114 - chan->fcs = L2CAP_FCS_NONE; 3115 - l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, chan->fcs); 3116 - } 3117 - 3118 3109 if (test_bit(FLAG_EXT_CTRL, &chan->flags)) 3119 3110 l2cap_add_conf_opt(&ptr, L2CAP_CONF_EWS, 2, 3120 3111 chan->tx_win); 3112 + 3113 + if (chan->conn->feat_mask & L2CAP_FEAT_FCS) 3114 + if (chan->fcs == L2CAP_FCS_NONE || 3115 + test_bit(CONF_RECV_NO_FCS, &chan->conf_state)) { 3116 + chan->fcs = L2CAP_FCS_NONE; 3117 + l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, 3118 + chan->fcs); 3119 + } 3121 3120 break; 3122 3121 3123 3122 case L2CAP_MODE_STREAMING: ··· 3138 3139 if (test_bit(FLAG_EFS_ENABLE, &chan->flags)) 3139 3140 l2cap_add_opt_efs(&ptr, chan); 3140 3141 3141 - if (!(chan->conn->feat_mask & L2CAP_FEAT_FCS)) 3142 - break; 3143 - 3144 - if (chan->fcs == L2CAP_FCS_NONE || 3145 - test_bit(CONF_NO_FCS_RECV, &chan->conf_state)) { 3146 - chan->fcs = L2CAP_FCS_NONE; 3147 - l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, chan->fcs); 3148 - } 3142 + if (chan->conn->feat_mask & L2CAP_FEAT_FCS) 3143 + if (chan->fcs == L2CAP_FCS_NONE || 3144 + test_bit(CONF_RECV_NO_FCS, &chan->conf_state)) { 3145 + chan->fcs = L2CAP_FCS_NONE; 3146 + l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, 3147 + chan->fcs); 3148 + } 3149 3149 break; 3150 3150 } 3151 3151 ··· 3196 3198 3197 3199 case L2CAP_CONF_FCS: 3198 3200 if (val == L2CAP_FCS_NONE) 3199 - set_bit(CONF_NO_FCS_RECV, &chan->conf_state); 3201 + set_bit(CONF_RECV_NO_FCS, &chan->conf_state); 3200 3202 break; 3201 3203 3202 3204 case L2CAP_CONF_EFS: ··· 3430 3432 3431 3433 l2cap_add_conf_opt(&ptr, L2CAP_CONF_EFS, sizeof(efs), 3432 3434 (unsigned long) &efs); 3435 + break; 3436 + 3437 + case L2CAP_CONF_FCS: 3438 + if (*result == L2CAP_CONF_PENDING) 3439 + if (val == L2CAP_FCS_NONE) 3440 + set_bit(CONF_RECV_NO_FCS, 3441 + &chan->conf_state); 3433 3442 break; 3434 3443 } 3435 3444 } ··· 3807 3802 */ 3808 3803 if (chan->mode != L2CAP_MODE_ERTM && chan->mode != L2CAP_MODE_STREAMING) 3809 3804 chan->fcs = L2CAP_FCS_NONE; 3810 - else if (!test_bit(CONF_NO_FCS_RECV, &chan->conf_state)) 3805 + else if (!test_bit(CONF_RECV_NO_FCS, &chan->conf_state)) 3811 3806 chan->fcs = L2CAP_FCS_CRC16; 3812 3807 } 3813 3808 ··· 3882 3877 /* Complete config. */ 3883 3878 len = l2cap_parse_conf_req(chan, rsp); 3884 3879 if (len < 0) { 3885 - l2cap_send_disconn_req(conn, chan, ECONNRESET); 3880 + l2cap_send_disconn_req(chan, ECONNRESET); 3886 3881 goto unlock; 3887 3882 } 3888 3883 ··· 3904 3899 err = l2cap_ertm_init(chan); 3905 3900 3906 3901 if (err < 0) 3907 - l2cap_send_disconn_req(chan->conn, chan, -err); 3902 + l2cap_send_disconn_req(chan, -err); 3908 3903 else 3909 3904 l2cap_chan_ready(chan); 3910 3905 ··· 3972 3967 len = l2cap_parse_conf_rsp(chan, rsp->data, len, 3973 3968 buf, &result); 3974 3969 if (len < 0) { 3975 - l2cap_send_disconn_req(conn, chan, ECONNRESET); 3970 + l2cap_send_disconn_req(chan, ECONNRESET); 3976 3971 goto done; 3977 3972 } 3978 3973 ··· 3993 3988 char req[64]; 3994 3989 3995 3990 if (len > sizeof(req) - sizeof(struct l2cap_conf_req)) { 3996 - l2cap_send_disconn_req(conn, chan, ECONNRESET); 3991 + l2cap_send_disconn_req(chan, ECONNRESET); 3997 3992 goto done; 3998 3993 } 3999 3994 ··· 4002 3997 len = l2cap_parse_conf_rsp(chan, rsp->data, len, 4003 3998 req, &result); 4004 3999 if (len < 0) { 4005 - l2cap_send_disconn_req(conn, chan, ECONNRESET); 4000 + l2cap_send_disconn_req(chan, ECONNRESET); 4006 4001 goto done; 4007 4002 } 4008 4003 ··· 4018 4013 l2cap_chan_set_err(chan, ECONNRESET); 4019 4014 4020 4015 __set_chan_timer(chan, L2CAP_DISC_REJ_TIMEOUT); 4021 - l2cap_send_disconn_req(conn, chan, ECONNRESET); 4016 + l2cap_send_disconn_req(chan, ECONNRESET); 4022 4017 goto done; 4023 4018 } 4024 4019 ··· 4035 4030 err = l2cap_ertm_init(chan); 4036 4031 4037 4032 if (err < 0) 4038 - l2cap_send_disconn_req(chan->conn, chan, -err); 4033 + l2cap_send_disconn_req(chan, -err); 4039 4034 else 4040 4035 l2cap_chan_ready(chan); 4041 4036 } ··· 4397 4392 /* Logical link setup failed */ 4398 4393 if (chan->state != BT_CONNECTED) { 4399 4394 /* Create channel failure, disconnect */ 4400 - l2cap_send_disconn_req(chan->conn, chan, ECONNRESET); 4395 + l2cap_send_disconn_req(chan, ECONNRESET); 4401 4396 return; 4402 4397 } 4403 4398 ··· 4440 4435 4441 4436 err = l2cap_ertm_init(chan); 4442 4437 if (err < 0) 4443 - l2cap_send_disconn_req(chan->conn, chan, -err); 4438 + l2cap_send_disconn_req(chan, -err); 4444 4439 else 4445 4440 l2cap_chan_ready(chan); 4446 4441 } ··· 5405 5400 5406 5401 if (control->reqseq == chan->next_tx_seq) { 5407 5402 BT_DBG("Invalid reqseq %d, disconnecting", control->reqseq); 5408 - l2cap_send_disconn_req(chan->conn, chan, ECONNRESET); 5403 + l2cap_send_disconn_req(chan, ECONNRESET); 5409 5404 return; 5410 5405 } 5411 5406 ··· 5419 5414 5420 5415 if (chan->max_tx != 0 && bt_cb(skb)->control.retries >= chan->max_tx) { 5421 5416 BT_DBG("Retry limit exceeded (%d)", chan->max_tx); 5422 - l2cap_send_disconn_req(chan->conn, chan, ECONNRESET); 5417 + l2cap_send_disconn_req(chan, ECONNRESET); 5423 5418 return; 5424 5419 } 5425 5420 ··· 5463 5458 5464 5459 if (control->reqseq == chan->next_tx_seq) { 5465 5460 BT_DBG("Invalid reqseq %d, disconnecting", control->reqseq); 5466 - l2cap_send_disconn_req(chan->conn, chan, ECONNRESET); 5461 + l2cap_send_disconn_req(chan, ECONNRESET); 5467 5462 return; 5468 5463 } 5469 5464 ··· 5472 5467 if (chan->max_tx && skb && 5473 5468 bt_cb(skb)->control.retries >= chan->max_tx) { 5474 5469 BT_DBG("Retry limit exceeded (%d)", chan->max_tx); 5475 - l2cap_send_disconn_req(chan->conn, chan, ECONNRESET); 5470 + l2cap_send_disconn_req(chan, ECONNRESET); 5476 5471 return; 5477 5472 } 5478 5473 ··· 5656 5651 break; 5657 5652 case L2CAP_TXSEQ_INVALID: 5658 5653 default: 5659 - l2cap_send_disconn_req(chan->conn, chan, 5660 - ECONNRESET); 5654 + l2cap_send_disconn_req(chan, ECONNRESET); 5661 5655 break; 5662 5656 } 5663 5657 break; ··· 5789 5785 break; 5790 5786 case L2CAP_TXSEQ_INVALID: 5791 5787 default: 5792 - l2cap_send_disconn_req(chan->conn, chan, 5793 - ECONNRESET); 5788 + l2cap_send_disconn_req(chan, ECONNRESET); 5794 5789 break; 5795 5790 } 5796 5791 break; ··· 5984 5981 BT_DBG("Invalid reqseq %d (next_tx_seq %d, expected_ack_seq %d", 5985 5982 control->reqseq, chan->next_tx_seq, 5986 5983 chan->expected_ack_seq); 5987 - l2cap_send_disconn_req(chan->conn, chan, ECONNRESET); 5984 + l2cap_send_disconn_req(chan, ECONNRESET); 5988 5985 } 5989 5986 5990 5987 return err; ··· 6053 6050 len -= L2CAP_FCS_SIZE; 6054 6051 6055 6052 if (len > chan->mps) { 6056 - l2cap_send_disconn_req(chan->conn, chan, ECONNRESET); 6053 + l2cap_send_disconn_req(chan, ECONNRESET); 6057 6054 goto drop; 6058 6055 } 6059 6056 ··· 6078 6075 } 6079 6076 6080 6077 if (err) 6081 - l2cap_send_disconn_req(chan->conn, chan, 6082 - ECONNRESET); 6078 + l2cap_send_disconn_req(chan, ECONNRESET); 6083 6079 } else { 6084 6080 const u8 rx_func_to_event[4] = { 6085 6081 L2CAP_EV_RECV_RR, L2CAP_EV_RECV_REJ, ··· 6095 6093 6096 6094 if (len != 0) { 6097 6095 BT_ERR("Trailing bytes: %d in sframe", len); 6098 - l2cap_send_disconn_req(chan->conn, chan, ECONNRESET); 6096 + l2cap_send_disconn_req(chan, ECONNRESET); 6099 6097 goto drop; 6100 6098 } 6101 6099 ··· 6106 6104 6107 6105 event = rx_func_to_event[control->super]; 6108 6106 if (l2cap_rx(chan, control, skb, event)) 6109 - l2cap_send_disconn_req(chan->conn, chan, ECONNRESET); 6107 + l2cap_send_disconn_req(chan, ECONNRESET); 6110 6108 } 6111 6109 6112 6110 return 0;
+5 -5
net/bluetooth/mgmt.c
··· 1226 1226 } 1227 1227 1228 1228 val = !!cp->val; 1229 - enabled = !!lmp_host_le_capable(hdev); 1229 + enabled = lmp_host_le_capable(hdev); 1230 1230 1231 1231 if (!hdev_is_powered(hdev) || val == enabled) { 1232 1232 bool changed = false; ··· 1262 1262 1263 1263 if (val) { 1264 1264 hci_cp.le = val; 1265 - hci_cp.simul = !!lmp_le_br_capable(hdev); 1265 + hci_cp.simul = lmp_le_br_capable(hdev); 1266 1266 } 1267 1267 1268 1268 err = hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(hci_cp), ··· 2926 2926 struct hci_cp_write_le_host_supported cp; 2927 2927 2928 2928 cp.le = 1; 2929 - cp.simul = !!lmp_le_br_capable(hdev); 2929 + cp.simul = lmp_le_br_capable(hdev); 2930 2930 2931 2931 /* Check first if we already have the right 2932 2932 * host state (host features set) 2933 2933 */ 2934 - if (cp.le != !!lmp_host_le_capable(hdev) || 2935 - cp.simul != !!lmp_host_le_br_capable(hdev)) 2934 + if (cp.le != lmp_host_le_capable(hdev) || 2935 + cp.simul != lmp_host_le_br_capable(hdev)) 2936 2936 hci_send_cmd(hdev, 2937 2937 HCI_OP_WRITE_LE_HOST_SUPPORTED, 2938 2938 sizeof(cp), &cp);
+2 -2
net/bluetooth/rfcomm/sock.c
··· 467 467 long timeo; 468 468 int err = 0; 469 469 470 - lock_sock(sk); 470 + lock_sock_nested(sk, SINGLE_DEPTH_NESTING); 471 471 472 472 if (sk->sk_type != SOCK_STREAM) { 473 473 err = -EINVAL; ··· 504 504 505 505 release_sock(sk); 506 506 timeo = schedule_timeout(timeo); 507 - lock_sock(sk); 507 + lock_sock_nested(sk, SINGLE_DEPTH_NESTING); 508 508 } 509 509 __set_current_state(TASK_RUNNING); 510 510 remove_wait_queue(sk_sleep(sk), &wait);
+74 -12
net/bluetooth/sco.c
··· 131 131 sco_sock_clear_timer(sk); 132 132 sco_chan_del(sk, err); 133 133 bh_unlock_sock(sk); 134 - 135 - sco_conn_lock(conn); 136 - conn->sk = NULL; 137 - sco_pi(sk)->conn = NULL; 138 - sco_conn_unlock(conn); 139 - 140 - if (conn->hcon) 141 - hci_conn_put(conn->hcon); 142 - 143 134 sco_sock_kill(sk); 144 135 } 145 136 ··· 388 397 389 398 if (parent) { 390 399 sk->sk_type = parent->sk_type; 400 + bt_sk(sk)->flags = bt_sk(parent)->flags; 391 401 security_sk_clone(parent, sk); 392 402 } 393 403 } ··· 654 662 return err; 655 663 } 656 664 665 + static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock, 666 + struct msghdr *msg, size_t len, int flags) 667 + { 668 + struct sock *sk = sock->sk; 669 + struct sco_pinfo *pi = sco_pi(sk); 670 + 671 + lock_sock(sk); 672 + 673 + if (sk->sk_state == BT_CONNECT2 && 674 + test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) { 675 + hci_conn_accept(pi->conn->hcon, 0); 676 + sk->sk_state = BT_CONFIG; 677 + 678 + release_sock(sk); 679 + return 0; 680 + } 681 + 682 + release_sock(sk); 683 + 684 + return bt_sock_recvmsg(iocb, sock, msg, len, flags); 685 + } 686 + 657 687 static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) 658 688 { 659 689 struct sock *sk = sock->sk; 660 690 int err = 0; 691 + u32 opt; 661 692 662 693 BT_DBG("sk %p", sk); 663 694 664 695 lock_sock(sk); 665 696 666 697 switch (optname) { 698 + 699 + case BT_DEFER_SETUP: 700 + if (sk->sk_state != BT_BOUND && sk->sk_state != BT_LISTEN) { 701 + err = -EINVAL; 702 + break; 703 + } 704 + 705 + if (get_user(opt, (u32 __user *) optval)) { 706 + err = -EFAULT; 707 + break; 708 + } 709 + 710 + if (opt) 711 + set_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags); 712 + else 713 + clear_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags); 714 + break; 715 + 667 716 default: 668 717 err = -ENOPROTOOPT; 669 718 break; ··· 786 753 lock_sock(sk); 787 754 788 755 switch (optname) { 756 + 757 + case BT_DEFER_SETUP: 758 + if (sk->sk_state != BT_BOUND && sk->sk_state != BT_LISTEN) { 759 + err = -EINVAL; 760 + break; 761 + } 762 + 763 + if (put_user(test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags), 764 + (u32 __user *) optval)) 765 + err = -EFAULT; 766 + 767 + break; 768 + 789 769 default: 790 770 err = -ENOPROTOOPT; 791 771 break; ··· 876 830 877 831 BT_DBG("sk %p, conn %p, err %d", sk, conn, err); 878 832 833 + if (conn) { 834 + sco_conn_lock(conn); 835 + conn->sk = NULL; 836 + sco_pi(sk)->conn = NULL; 837 + sco_conn_unlock(conn); 838 + 839 + if (conn->hcon) 840 + hci_conn_put(conn->hcon); 841 + } 842 + 879 843 sk->sk_state = BT_CLOSED; 880 844 sk->sk_err = err; 881 845 sk->sk_state_change(sk); ··· 930 874 hci_conn_hold(conn->hcon); 931 875 __sco_chan_add(conn, sk, parent); 932 876 933 - sk->sk_state = BT_CONNECTED; 877 + if (test_bit(BT_SK_DEFER_SETUP, &bt_sk(parent)->flags)) 878 + sk->sk_state = BT_CONNECT2; 879 + else 880 + sk->sk_state = BT_CONNECTED; 934 881 935 882 /* Wake up parent */ 936 883 parent->sk_data_ready(parent, 1); ··· 946 887 } 947 888 948 889 /* ----- SCO interface with lower layer (HCI) ----- */ 949 - int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr) 890 + int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags) 950 891 { 951 892 struct sock *sk; 952 893 struct hlist_node *node; ··· 963 904 if (!bacmp(&bt_sk(sk)->src, &hdev->bdaddr) || 964 905 !bacmp(&bt_sk(sk)->src, BDADDR_ANY)) { 965 906 lm |= HCI_LM_ACCEPT; 907 + 908 + if (test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) 909 + *flags |= HCI_PROTO_DEFER; 966 910 break; 967 911 } 968 912 } ··· 1054 992 .accept = sco_sock_accept, 1055 993 .getname = sco_sock_getname, 1056 994 .sendmsg = sco_sock_sendmsg, 1057 - .recvmsg = bt_sock_recvmsg, 995 + .recvmsg = sco_sock_recvmsg, 1058 996 .poll = bt_sock_poll, 1059 997 .ioctl = bt_sock_ioctl, 1060 998 .mmap = sock_no_mmap,
+48 -29
net/mac80211/cfg.c
··· 398 398 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; 399 399 } 400 400 401 + void sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo) 402 + { 403 + rinfo->flags = 0; 404 + 405 + if (sta->last_rx_rate_flag & RX_FLAG_HT) { 406 + rinfo->flags |= RATE_INFO_FLAGS_MCS; 407 + rinfo->mcs = sta->last_rx_rate_idx; 408 + } else if (sta->last_rx_rate_flag & RX_FLAG_VHT) { 409 + rinfo->flags |= RATE_INFO_FLAGS_VHT_MCS; 410 + rinfo->nss = sta->last_rx_rate_vht_nss; 411 + rinfo->mcs = sta->last_rx_rate_idx; 412 + } else { 413 + struct ieee80211_supported_band *sband; 414 + 415 + sband = sta->local->hw.wiphy->bands[ 416 + ieee80211_get_sdata_band(sta->sdata)]; 417 + rinfo->legacy = 418 + sband->bitrates[sta->last_rx_rate_idx].bitrate; 419 + } 420 + 421 + if (sta->last_rx_rate_flag & RX_FLAG_40MHZ) 422 + rinfo->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 423 + if (sta->last_rx_rate_flag & RX_FLAG_SHORT_GI) 424 + rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; 425 + if (sta->last_rx_rate_flag & RX_FLAG_80MHZ) 426 + rinfo->flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; 427 + if (sta->last_rx_rate_flag & RX_FLAG_80P80MHZ) 428 + rinfo->flags |= RATE_INFO_FLAGS_80P80_MHZ_WIDTH; 429 + if (sta->last_rx_rate_flag & RX_FLAG_160MHZ) 430 + rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; 431 + } 432 + 401 433 static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) 402 434 { 403 435 struct ieee80211_sub_if_data *sdata = sta->sdata; ··· 476 444 } 477 445 478 446 sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate); 479 - 480 - sinfo->rxrate.flags = 0; 481 - if (sta->last_rx_rate_flag & RX_FLAG_HT) { 482 - sinfo->rxrate.flags |= RATE_INFO_FLAGS_MCS; 483 - sinfo->rxrate.mcs = sta->last_rx_rate_idx; 484 - } else if (sta->last_rx_rate_flag & RX_FLAG_VHT) { 485 - sinfo->rxrate.flags |= RATE_INFO_FLAGS_VHT_MCS; 486 - sinfo->rxrate.nss = sta->last_rx_rate_vht_nss; 487 - sinfo->rxrate.mcs = sta->last_rx_rate_idx; 488 - } else { 489 - struct ieee80211_supported_band *sband; 490 - 491 - sband = sta->local->hw.wiphy->bands[ 492 - ieee80211_get_sdata_band(sta->sdata)]; 493 - sinfo->rxrate.legacy = 494 - sband->bitrates[sta->last_rx_rate_idx].bitrate; 495 - } 496 - 497 - if (sta->last_rx_rate_flag & RX_FLAG_40MHZ) 498 - sinfo->rxrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 499 - if (sta->last_rx_rate_flag & RX_FLAG_SHORT_GI) 500 - sinfo->rxrate.flags |= RATE_INFO_FLAGS_SHORT_GI; 501 - if (sta->last_rx_rate_flag & RX_FLAG_80MHZ) 502 - sinfo->rxrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; 503 - if (sta->last_rx_rate_flag & RX_FLAG_80P80MHZ) 504 - sinfo->rxrate.flags |= RATE_INFO_FLAGS_80P80_MHZ_WIDTH; 505 - if (sta->last_rx_rate_flag & RX_FLAG_160MHZ) 506 - sinfo->rxrate.flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; 447 + sta_set_rate_info_rx(sta, &sinfo->rxrate); 507 448 508 449 if (ieee80211_vif_is_mesh(&sdata->vif)) { 509 450 #ifdef CONFIG_MAC80211_MESH ··· 898 893 u32 changed = BSS_CHANGED_BEACON_INT | 899 894 BSS_CHANGED_BEACON_ENABLED | 900 895 BSS_CHANGED_BEACON | 901 - BSS_CHANGED_SSID; 896 + BSS_CHANGED_SSID | 897 + BSS_CHANGED_P2P_PS; 902 898 int err; 903 899 904 900 old = rtnl_dereference(sdata->u.ap.beacon); ··· 937 931 params->ssid_len); 938 932 sdata->vif.bss_conf.hidden_ssid = 939 933 (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE); 934 + 935 + sdata->vif.bss_conf.p2p_ctwindow = params->p2p_ctwindow; 936 + sdata->vif.bss_conf.p2p_oppps = params->p2p_opp_ps; 940 937 941 938 err = ieee80211_assign_beacon(sdata, &params->beacon); 942 939 if (err < 0) ··· 1814 1805 sdata->vif.bss_conf.ht_operation_mode = 1815 1806 (u16) params->ht_opmode; 1816 1807 changed |= BSS_CHANGED_HT; 1808 + } 1809 + 1810 + if (params->p2p_ctwindow >= 0) { 1811 + sdata->vif.bss_conf.p2p_ctwindow = params->p2p_ctwindow; 1812 + changed |= BSS_CHANGED_P2P_PS; 1813 + } 1814 + 1815 + if (params->p2p_opp_ps >= 0) { 1816 + sdata->vif.bss_conf.p2p_oppps = params->p2p_opp_ps; 1817 + changed |= BSS_CHANGED_P2P_PS; 1817 1818 } 1818 1819 1819 1820 ieee80211_bss_info_change_notify(sdata, changed);
+36
net/mac80211/debugfs_sta.c
··· 53 53 STA_FILE(aid, sta.aid, D); 54 54 STA_FILE(dev, sdata->name, S); 55 55 STA_FILE(last_signal, last_signal, D); 56 + STA_FILE(last_ack_signal, last_ack_signal, D); 56 57 57 58 static ssize_t sta_flags_read(struct file *file, char __user *userbuf, 58 59 size_t count, loff_t *ppos) ··· 322 321 } 323 322 STA_OPS(ht_capa); 324 323 324 + static ssize_t sta_current_tx_rate_read(struct file *file, char __user *userbuf, 325 + size_t count, loff_t *ppos) 326 + { 327 + struct sta_info *sta = file->private_data; 328 + struct rate_info rinfo; 329 + u16 rate; 330 + sta_set_rate_info_tx(sta, &sta->last_tx_rate, &rinfo); 331 + rate = cfg80211_calculate_bitrate(&rinfo); 332 + 333 + return mac80211_format_buffer(userbuf, count, ppos, 334 + "%d.%d MBit/s\n", 335 + rate/10, rate%10); 336 + } 337 + STA_OPS(current_tx_rate); 338 + 339 + static ssize_t sta_last_rx_rate_read(struct file *file, char __user *userbuf, 340 + size_t count, loff_t *ppos) 341 + { 342 + struct sta_info *sta = file->private_data; 343 + struct rate_info rinfo; 344 + u16 rate; 345 + 346 + sta_set_rate_info_rx(sta, &rinfo); 347 + 348 + rate = cfg80211_calculate_bitrate(&rinfo); 349 + 350 + return mac80211_format_buffer(userbuf, count, ppos, 351 + "%d.%d MBit/s\n", 352 + rate/10, rate%10); 353 + } 354 + STA_OPS(last_rx_rate); 355 + 325 356 #define DEBUGFS_ADD(name) \ 326 357 debugfs_create_file(#name, 0400, \ 327 358 sta->debugfs.dir, sta, &sta_ ##name## _ops); ··· 402 369 DEBUGFS_ADD(dev); 403 370 DEBUGFS_ADD(last_signal); 404 371 DEBUGFS_ADD(ht_capa); 372 + DEBUGFS_ADD(last_ack_signal); 373 + DEBUGFS_ADD(current_tx_rate); 374 + DEBUGFS_ADD(last_rx_rate); 405 375 406 376 DEBUGFS_ADD_COUNTER(rx_packets, rx_packets); 407 377 DEBUGFS_ADD_COUNTER(tx_packets, tx_packets);
+4 -1
net/mac80211/ieee80211_i.h
··· 371 371 IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9), 372 372 IEEE80211_STA_DISABLE_40MHZ = BIT(10), 373 373 IEEE80211_STA_DISABLE_VHT = BIT(11), 374 + IEEE80211_STA_DISABLE_80P80MHZ = BIT(12), 375 + IEEE80211_STA_DISABLE_160MHZ = BIT(13), 374 376 }; 375 377 376 378 struct ieee80211_mgd_auth_data { ··· 1034 1032 enum ieee80211_band hw_scan_band; 1035 1033 int scan_channel_idx; 1036 1034 int scan_ies_len; 1035 + int hw_scan_ies_bufsize; 1037 1036 1038 1037 struct work_struct sched_scan_stopped_work; 1039 1038 struct ieee80211_sub_if_data __rcu *sched_scan_sdata; ··· 1576 1573 const u8 *bssid, u16 stype, u16 reason, 1577 1574 bool send_frame, u8 *frame_buf); 1578 1575 int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, 1579 - const u8 *ie, size_t ie_len, 1576 + size_t buffer_len, const u8 *ie, size_t ie_len, 1580 1577 enum ieee80211_band band, u32 rate_mask, 1581 1578 u8 channel); 1582 1579 struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
+45
net/mac80211/iface.c
··· 223 223 return 0; 224 224 } 225 225 226 + static int ieee80211_verify_mac(struct ieee80211_local *local, u8 *addr) 227 + { 228 + struct ieee80211_sub_if_data *sdata; 229 + u64 new, mask, tmp; 230 + u8 *m; 231 + int ret = 0; 232 + 233 + if (is_zero_ether_addr(local->hw.wiphy->addr_mask)) 234 + return 0; 235 + 236 + m = addr; 237 + new = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | 238 + ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | 239 + ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); 240 + 241 + m = local->hw.wiphy->addr_mask; 242 + mask = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | 243 + ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | 244 + ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); 245 + 246 + 247 + mutex_lock(&local->iflist_mtx); 248 + list_for_each_entry(sdata, &local->interfaces, list) { 249 + if (sdata->vif.type == NL80211_IFTYPE_MONITOR) 250 + continue; 251 + 252 + m = sdata->vif.addr; 253 + tmp = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | 254 + ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | 255 + ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); 256 + 257 + if ((new & ~mask) != (tmp & ~mask)) { 258 + ret = -EINVAL; 259 + break; 260 + } 261 + } 262 + mutex_unlock(&local->iflist_mtx); 263 + 264 + return ret; 265 + } 266 + 226 267 static int ieee80211_change_mac(struct net_device *dev, void *addr) 227 268 { 228 269 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); ··· 272 231 273 232 if (ieee80211_sdata_running(sdata)) 274 233 return -EBUSY; 234 + 235 + ret = ieee80211_verify_mac(sdata->local, sa->sa_data); 236 + if (ret) 237 + return ret; 275 238 276 239 ret = eth_mac_addr(dev, sa); 277 240
+4 -1
net/mac80211/main.c
··· 474 474 .tx = 0xffff, 475 475 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | 476 476 BIT(IEEE80211_STYPE_AUTH >> 4) | 477 - BIT(IEEE80211_STYPE_DEAUTH >> 4), 477 + BIT(IEEE80211_STYPE_DEAUTH >> 4) | 478 + BIT(IEEE80211_STYPE_PROBE_REQ >> 4), 478 479 }, 479 480 [NL80211_IFTYPE_STATION] = { 480 481 .tx = 0xffff, ··· 639 638 local->hw.radiotap_mcs_details = IEEE80211_RADIOTAP_MCS_HAVE_MCS | 640 639 IEEE80211_RADIOTAP_MCS_HAVE_GI | 641 640 IEEE80211_RADIOTAP_MCS_HAVE_BW; 641 + local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | 642 + IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; 642 643 local->user_power_level = IEEE80211_UNSET_POWER_LEVEL; 643 644 wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask; 644 645
+2 -1
net/mac80211/mesh_plink.c
··· 391 391 sta->ch_width = chandef.width; 392 392 } 393 393 394 - rate_control_rate_init(sta); 394 + if (insert) 395 + rate_control_rate_init(sta); 395 396 spin_unlock_bh(&sta->lock); 396 397 397 398 if (insert && sta_info_insert(sta))
+4
net/mac80211/mesh_sync.c
··· 195 195 ifmsh->sync_offset_clockdrift_max); 196 196 set_bit(MESH_WORK_DRIFT_ADJUST, 197 197 &ifmsh->wrkq_flags); 198 + 199 + ifmsh->adjusting_tbtt = true; 198 200 } else { 199 201 msync_dbg(sdata, 200 202 "TBTT : max clockdrift=%lld; too small to adjust\n", 201 203 (long long)ifmsh->sync_offset_clockdrift_max); 202 204 ifmsh->sync_offset_clockdrift_max = 0; 205 + 206 + ifmsh->adjusting_tbtt = false; 203 207 } 204 208 spin_unlock_bh(&ifmsh->sync_offset_lock); 205 209 }
+336 -93
net/mac80211/mlme.c
··· 354 354 /* determine capability flags */ 355 355 cap = vht_cap.cap; 356 356 357 + if (sdata->u.mgd.flags & IEEE80211_STA_DISABLE_80P80MHZ) { 358 + cap &= ~IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; 359 + cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; 360 + } 361 + 362 + if (sdata->u.mgd.flags & IEEE80211_STA_DISABLE_160MHZ) { 363 + cap &= ~IEEE80211_VHT_CAP_SHORT_GI_160; 364 + cap &= ~IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; 365 + } 366 + 357 367 /* reserve and fill IE */ 358 368 pos = skb_put(skb, sizeof(struct ieee80211_vht_cap) + 2); 359 369 ieee80211_ie_build_vht_cap(pos, &vht_cap, cap); ··· 552 542 memcpy(pos, assoc_data->ie + offset, noffset - offset); 553 543 offset = noffset; 554 544 } 545 + 546 + if (WARN_ON_ONCE((ifmgd->flags & IEEE80211_STA_DISABLE_HT) && 547 + !(ifmgd->flags & IEEE80211_STA_DISABLE_VHT))) 548 + ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; 555 549 556 550 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) 557 551 ieee80211_add_ht_ie(sdata, skb, assoc_data->ap_ht_param, ··· 789 775 "not handling channel switch with channel contexts\n"); 790 776 ieee80211_queue_work(&sdata->local->hw, 791 777 &ifmgd->csa_connection_drop_work); 778 + return; 792 779 } 793 780 794 781 mutex_lock(&sdata->local->chanctx_mtx); ··· 1383 1368 sdata->u.mgd.flags |= IEEE80211_STA_RESET_SIGNAL_AVE; 1384 1369 1385 1370 if (sdata->vif.p2p) { 1386 - u8 noa[2]; 1387 - int ret; 1371 + const struct cfg80211_bss_ies *ies; 1388 1372 1389 - ret = cfg80211_get_p2p_attr(cbss->information_elements, 1390 - cbss->len_information_elements, 1391 - IEEE80211_P2P_ATTR_ABSENCE_NOTICE, 1392 - noa, sizeof(noa)); 1393 - if (ret >= 2) { 1394 - bss_conf->p2p_oppps = noa[1] & 0x80; 1395 - bss_conf->p2p_ctwindow = noa[1] & 0x7f; 1396 - bss_info_changed |= BSS_CHANGED_P2P_PS; 1397 - sdata->u.mgd.p2p_noa_index = noa[0]; 1373 + rcu_read_lock(); 1374 + ies = rcu_dereference(cbss->ies); 1375 + if (ies) { 1376 + u8 noa[2]; 1377 + int ret; 1378 + 1379 + ret = cfg80211_get_p2p_attr( 1380 + ies->data, ies->len, 1381 + IEEE80211_P2P_ATTR_ABSENCE_NOTICE, 1382 + noa, sizeof(noa)); 1383 + if (ret >= 2) { 1384 + bss_conf->p2p_oppps = noa[1] & 0x80; 1385 + bss_conf->p2p_ctwindow = noa[1] & 0x7f; 1386 + bss_info_changed |= BSS_CHANGED_P2P_PS; 1387 + sdata->u.mgd.p2p_noa_index = noa[0]; 1388 + } 1398 1389 } 1390 + rcu_read_unlock(); 1399 1391 } 1400 1392 1401 1393 /* just to be sure */ ··· 1667 1645 } else { 1668 1646 int ssid_len; 1669 1647 1648 + rcu_read_lock(); 1670 1649 ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); 1671 1650 if (WARN_ON_ONCE(ssid == NULL)) 1672 1651 ssid_len = 0; ··· 1677 1654 ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid_len, NULL, 1678 1655 0, (u32) -1, true, false, 1679 1656 ifmgd->associated->channel, false); 1657 + rcu_read_unlock(); 1680 1658 } 1681 1659 1682 1660 ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); ··· 1773 1749 else 1774 1750 return NULL; 1775 1751 1752 + rcu_read_lock(); 1776 1753 ssid = ieee80211_bss_get_ie(cbss, WLAN_EID_SSID); 1777 1754 if (WARN_ON_ONCE(ssid == NULL)) 1778 1755 ssid_len = 0; ··· 1784 1759 (u32) -1, cbss->channel, 1785 1760 ssid + 2, ssid_len, 1786 1761 NULL, 0, true); 1762 + rcu_read_unlock(); 1787 1763 1788 1764 return skb; 1789 1765 } ··· 2870 2844 auth_data->bss->bssid, auth_data->tries, 2871 2845 IEEE80211_AUTH_MAX_TRIES); 2872 2846 2847 + rcu_read_lock(); 2873 2848 ssidie = ieee80211_bss_get_ie(auth_data->bss, WLAN_EID_SSID); 2874 - if (!ssidie) 2849 + if (!ssidie) { 2850 + rcu_read_unlock(); 2875 2851 return -EINVAL; 2852 + } 2876 2853 /* 2877 2854 * Direct probe is sent to broadcast address as some APs 2878 2855 * will not answer to direct packet in unassociated state. ··· 2883 2854 ieee80211_send_probe_req(sdata, NULL, ssidie + 2, ssidie[1], 2884 2855 NULL, 0, (u32) -1, true, false, 2885 2856 auth_data->bss->channel, false); 2857 + rcu_read_unlock(); 2886 2858 } 2887 2859 2888 2860 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; ··· 3213 3183 return 0; 3214 3184 } 3215 3185 3186 + static u32 chandef_downgrade(struct cfg80211_chan_def *c) 3187 + { 3188 + u32 ret; 3189 + int tmp; 3190 + 3191 + switch (c->width) { 3192 + case NL80211_CHAN_WIDTH_20: 3193 + c->width = NL80211_CHAN_WIDTH_20_NOHT; 3194 + ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_VHT; 3195 + break; 3196 + case NL80211_CHAN_WIDTH_40: 3197 + c->width = NL80211_CHAN_WIDTH_20; 3198 + c->center_freq1 = c->chan->center_freq; 3199 + ret = IEEE80211_STA_DISABLE_40MHZ | 3200 + IEEE80211_STA_DISABLE_VHT; 3201 + break; 3202 + case NL80211_CHAN_WIDTH_80: 3203 + tmp = (30 + c->chan->center_freq - c->center_freq1)/20; 3204 + /* n_P40 */ 3205 + tmp /= 2; 3206 + /* freq_P40 */ 3207 + c->center_freq1 = c->center_freq1 - 20 + 40 * tmp; 3208 + c->width = NL80211_CHAN_WIDTH_40; 3209 + ret = IEEE80211_STA_DISABLE_VHT; 3210 + break; 3211 + case NL80211_CHAN_WIDTH_80P80: 3212 + c->center_freq2 = 0; 3213 + c->width = NL80211_CHAN_WIDTH_80; 3214 + ret = IEEE80211_STA_DISABLE_80P80MHZ | 3215 + IEEE80211_STA_DISABLE_160MHZ; 3216 + break; 3217 + case NL80211_CHAN_WIDTH_160: 3218 + /* n_P20 */ 3219 + tmp = (70 + c->chan->center_freq - c->center_freq1)/20; 3220 + /* n_P80 */ 3221 + tmp /= 4; 3222 + c->center_freq1 = c->center_freq1 - 40 + 80 * tmp; 3223 + c->width = NL80211_CHAN_WIDTH_80; 3224 + ret = IEEE80211_STA_DISABLE_80P80MHZ | 3225 + IEEE80211_STA_DISABLE_160MHZ; 3226 + break; 3227 + default: 3228 + case NL80211_CHAN_WIDTH_20_NOHT: 3229 + WARN_ON_ONCE(1); 3230 + c->width = NL80211_CHAN_WIDTH_20_NOHT; 3231 + ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_VHT; 3232 + break; 3233 + } 3234 + 3235 + WARN_ON_ONCE(!cfg80211_chandef_valid(c)); 3236 + 3237 + return ret; 3238 + } 3239 + 3240 + static u32 3241 + ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, 3242 + struct ieee80211_supported_band *sband, 3243 + struct ieee80211_channel *channel, 3244 + const struct ieee80211_ht_operation *ht_oper, 3245 + const struct ieee80211_vht_operation *vht_oper, 3246 + struct cfg80211_chan_def *chandef) 3247 + { 3248 + struct cfg80211_chan_def vht_chandef; 3249 + u32 ht_cfreq, ret; 3250 + 3251 + chandef->chan = channel; 3252 + chandef->width = NL80211_CHAN_WIDTH_20_NOHT; 3253 + chandef->center_freq1 = channel->center_freq; 3254 + chandef->center_freq2 = 0; 3255 + 3256 + if (!ht_oper || !sband->ht_cap.ht_supported) { 3257 + ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_VHT; 3258 + goto out; 3259 + } 3260 + 3261 + chandef->width = NL80211_CHAN_WIDTH_20; 3262 + 3263 + ht_cfreq = ieee80211_channel_to_frequency(ht_oper->primary_chan, 3264 + channel->band); 3265 + /* check that channel matches the right operating channel */ 3266 + if (channel->center_freq != ht_cfreq) { 3267 + /* 3268 + * It's possible that some APs are confused here; 3269 + * Netgear WNDR3700 sometimes reports 4 higher than 3270 + * the actual channel in association responses, but 3271 + * since we look at probe response/beacon data here 3272 + * it should be OK. 3273 + */ 3274 + sdata_info(sdata, 3275 + "Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n", 3276 + channel->center_freq, ht_cfreq, 3277 + ht_oper->primary_chan, channel->band); 3278 + ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_VHT; 3279 + goto out; 3280 + } 3281 + 3282 + /* check 40 MHz support, if we have it */ 3283 + if (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) { 3284 + switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { 3285 + case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: 3286 + chandef->width = NL80211_CHAN_WIDTH_40; 3287 + chandef->center_freq1 += 10; 3288 + break; 3289 + case IEEE80211_HT_PARAM_CHA_SEC_BELOW: 3290 + chandef->width = NL80211_CHAN_WIDTH_40; 3291 + chandef->center_freq1 -= 10; 3292 + break; 3293 + } 3294 + } else { 3295 + /* 40 MHz (and 80 MHz) must be supported for VHT */ 3296 + ret = IEEE80211_STA_DISABLE_VHT; 3297 + goto out; 3298 + } 3299 + 3300 + if (!vht_oper || !sband->vht_cap.vht_supported) { 3301 + ret = IEEE80211_STA_DISABLE_VHT; 3302 + goto out; 3303 + } 3304 + 3305 + vht_chandef.chan = channel; 3306 + vht_chandef.center_freq1 = 3307 + ieee80211_channel_to_frequency(vht_oper->center_freq_seg1_idx, 3308 + channel->band); 3309 + vht_chandef.center_freq2 = 0; 3310 + 3311 + if (vht_oper->center_freq_seg2_idx) 3312 + vht_chandef.center_freq2 = 3313 + ieee80211_channel_to_frequency( 3314 + vht_oper->center_freq_seg2_idx, 3315 + channel->band); 3316 + 3317 + switch (vht_oper->chan_width) { 3318 + case IEEE80211_VHT_CHANWIDTH_USE_HT: 3319 + vht_chandef.width = chandef->width; 3320 + break; 3321 + case IEEE80211_VHT_CHANWIDTH_80MHZ: 3322 + vht_chandef.width = NL80211_CHAN_WIDTH_80; 3323 + break; 3324 + case IEEE80211_VHT_CHANWIDTH_160MHZ: 3325 + vht_chandef.width = NL80211_CHAN_WIDTH_160; 3326 + break; 3327 + case IEEE80211_VHT_CHANWIDTH_80P80MHZ: 3328 + vht_chandef.width = NL80211_CHAN_WIDTH_80P80; 3329 + break; 3330 + default: 3331 + sdata_info(sdata, 3332 + "AP VHT operation IE has invalid channel width (%d), disable VHT\n", 3333 + vht_oper->chan_width); 3334 + ret = IEEE80211_STA_DISABLE_VHT; 3335 + goto out; 3336 + } 3337 + 3338 + if (!cfg80211_chandef_valid(&vht_chandef)) { 3339 + sdata_info(sdata, 3340 + "AP VHT information is invalid, disable VHT\n"); 3341 + ret = IEEE80211_STA_DISABLE_VHT; 3342 + goto out; 3343 + } 3344 + 3345 + if (cfg80211_chandef_identical(chandef, &vht_chandef)) { 3346 + ret = 0; 3347 + goto out; 3348 + } 3349 + 3350 + if (!cfg80211_chandef_compatible(chandef, &vht_chandef)) { 3351 + sdata_info(sdata, 3352 + "AP VHT information doesn't match HT, disable VHT\n"); 3353 + ret = IEEE80211_STA_DISABLE_VHT; 3354 + goto out; 3355 + } 3356 + 3357 + *chandef = vht_chandef; 3358 + 3359 + ret = 0; 3360 + 3361 + while (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef, 3362 + IEEE80211_CHAN_DISABLED)) { 3363 + if (WARN_ON(chandef->width == NL80211_CHAN_WIDTH_20_NOHT)) { 3364 + ret = IEEE80211_STA_DISABLE_HT | 3365 + IEEE80211_STA_DISABLE_VHT; 3366 + goto out; 3367 + } 3368 + 3369 + ret = chandef_downgrade(chandef); 3370 + } 3371 + 3372 + if (chandef->width != vht_chandef.width) 3373 + sdata_info(sdata, 3374 + "local regulatory prevented using AP HT/VHT configuration, downgraded\n"); 3375 + 3376 + out: 3377 + WARN_ON_ONCE(!cfg80211_chandef_valid(chandef)); 3378 + return ret; 3379 + } 3380 + 3381 + static u8 ieee80211_ht_vht_rx_chains(struct ieee80211_sub_if_data *sdata, 3382 + struct cfg80211_bss *cbss) 3383 + { 3384 + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 3385 + const u8 *ht_cap_ie, *vht_cap_ie; 3386 + const struct ieee80211_ht_cap *ht_cap; 3387 + const struct ieee80211_vht_cap *vht_cap; 3388 + u8 chains = 1; 3389 + 3390 + if (ifmgd->flags & IEEE80211_STA_DISABLE_HT) 3391 + return chains; 3392 + 3393 + ht_cap_ie = ieee80211_bss_get_ie(cbss, WLAN_EID_HT_CAPABILITY); 3394 + if (ht_cap_ie && ht_cap_ie[1] >= sizeof(*ht_cap)) { 3395 + ht_cap = (void *)(ht_cap_ie + 2); 3396 + chains = ieee80211_mcs_to_chains(&ht_cap->mcs); 3397 + /* 3398 + * TODO: use "Tx Maximum Number Spatial Streams Supported" and 3399 + * "Tx Unequal Modulation Supported" fields. 3400 + */ 3401 + } 3402 + 3403 + if (ifmgd->flags & IEEE80211_STA_DISABLE_VHT) 3404 + return chains; 3405 + 3406 + vht_cap_ie = ieee80211_bss_get_ie(cbss, WLAN_EID_VHT_CAPABILITY); 3407 + if (vht_cap_ie && vht_cap_ie[1] >= sizeof(*vht_cap)) { 3408 + u8 nss; 3409 + u16 tx_mcs_map; 3410 + 3411 + vht_cap = (void *)(vht_cap_ie + 2); 3412 + tx_mcs_map = le16_to_cpu(vht_cap->supp_mcs.tx_mcs_map); 3413 + for (nss = 8; nss > 0; nss--) { 3414 + if (((tx_mcs_map >> (2 * (nss - 1))) & 3) != 3415 + IEEE80211_VHT_MCS_NOT_SUPPORTED) 3416 + break; 3417 + } 3418 + /* TODO: use "Tx Highest Supported Long GI Data Rate" field? */ 3419 + chains = max(chains, nss); 3420 + } 3421 + 3422 + return chains; 3423 + } 3424 + 3216 3425 static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, 3217 3426 struct cfg80211_bss *cbss) 3218 3427 { 3219 3428 struct ieee80211_local *local = sdata->local; 3220 3429 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 3221 - int ht_cfreq; 3222 - enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; 3223 - const u8 *ht_oper_ie; 3224 3430 const struct ieee80211_ht_operation *ht_oper = NULL; 3431 + const struct ieee80211_vht_operation *vht_oper = NULL; 3225 3432 struct ieee80211_supported_band *sband; 3226 3433 struct cfg80211_chan_def chandef; 3434 + int ret; 3227 3435 3228 3436 sband = local->hw.wiphy->bands[cbss->channel->band]; 3229 3437 3230 - ifmgd->flags &= ~IEEE80211_STA_DISABLE_40MHZ; 3438 + ifmgd->flags &= ~(IEEE80211_STA_DISABLE_40MHZ | 3439 + IEEE80211_STA_DISABLE_80P80MHZ | 3440 + IEEE80211_STA_DISABLE_160MHZ); 3231 3441 3232 - if (sband->ht_cap.ht_supported) { 3233 - ht_oper_ie = cfg80211_find_ie(WLAN_EID_HT_OPERATION, 3234 - cbss->information_elements, 3235 - cbss->len_information_elements); 3442 + rcu_read_lock(); 3443 + 3444 + if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT) && 3445 + sband->ht_cap.ht_supported) { 3446 + const u8 *ht_oper_ie; 3447 + 3448 + ht_oper_ie = ieee80211_bss_get_ie(cbss, WLAN_EID_HT_OPERATION); 3236 3449 if (ht_oper_ie && ht_oper_ie[1] >= sizeof(*ht_oper)) 3237 3450 ht_oper = (void *)(ht_oper_ie + 2); 3238 3451 } 3239 3452 3240 - if (ht_oper) { 3241 - ht_cfreq = ieee80211_channel_to_frequency(ht_oper->primary_chan, 3242 - cbss->channel->band); 3243 - /* check that channel matches the right operating channel */ 3244 - if (cbss->channel->center_freq != ht_cfreq) { 3245 - /* 3246 - * It's possible that some APs are confused here; 3247 - * Netgear WNDR3700 sometimes reports 4 higher than 3248 - * the actual channel in association responses, but 3249 - * since we look at probe response/beacon data here 3250 - * it should be OK. 3251 - */ 3453 + if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT) && 3454 + sband->vht_cap.vht_supported) { 3455 + const u8 *vht_oper_ie; 3456 + 3457 + vht_oper_ie = ieee80211_bss_get_ie(cbss, 3458 + WLAN_EID_VHT_OPERATION); 3459 + if (vht_oper_ie && vht_oper_ie[1] >= sizeof(*vht_oper)) 3460 + vht_oper = (void *)(vht_oper_ie + 2); 3461 + if (vht_oper && !ht_oper) { 3462 + vht_oper = NULL; 3252 3463 sdata_info(sdata, 3253 - "Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n", 3254 - cbss->channel->center_freq, 3255 - ht_cfreq, ht_oper->primary_chan, 3256 - cbss->channel->band); 3257 - ht_oper = NULL; 3464 + "AP advertised VHT without HT, disabling both\n"); 3465 + sdata->flags |= IEEE80211_STA_DISABLE_HT; 3466 + sdata->flags |= IEEE80211_STA_DISABLE_VHT; 3258 3467 } 3259 3468 } 3260 3469 3261 - if (ht_oper) { 3262 - /* 3263 - * cfg80211 already verified that the channel itself can 3264 - * be used, but it didn't check that we can do the right 3265 - * HT type, so do that here as well. If HT40 isn't allowed 3266 - * on this channel, disable 40 MHz operation. 3267 - */ 3268 - const u8 *ht_cap_ie; 3269 - const struct ieee80211_ht_cap *ht_cap; 3270 - u8 chains = 1; 3470 + ifmgd->flags |= ieee80211_determine_chantype(sdata, sband, 3471 + cbss->channel, 3472 + ht_oper, vht_oper, 3473 + &chandef); 3271 3474 3272 - channel_type = NL80211_CHAN_HT20; 3475 + sdata->needed_rx_chains = min(ieee80211_ht_vht_rx_chains(sdata, cbss), 3476 + local->rx_chains); 3273 3477 3274 - if (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) { 3275 - switch (ht_oper->ht_param & 3276 - IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { 3277 - case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: 3278 - if (cbss->channel->flags & 3279 - IEEE80211_CHAN_NO_HT40PLUS) 3280 - ifmgd->flags |= 3281 - IEEE80211_STA_DISABLE_40MHZ; 3282 - else 3283 - channel_type = NL80211_CHAN_HT40PLUS; 3284 - break; 3285 - case IEEE80211_HT_PARAM_CHA_SEC_BELOW: 3286 - if (cbss->channel->flags & 3287 - IEEE80211_CHAN_NO_HT40MINUS) 3288 - ifmgd->flags |= 3289 - IEEE80211_STA_DISABLE_40MHZ; 3290 - else 3291 - channel_type = NL80211_CHAN_HT40MINUS; 3292 - break; 3293 - } 3294 - } 3295 - 3296 - ht_cap_ie = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, 3297 - cbss->information_elements, 3298 - cbss->len_information_elements); 3299 - if (ht_cap_ie && ht_cap_ie[1] >= sizeof(*ht_cap)) { 3300 - ht_cap = (void *)(ht_cap_ie + 2); 3301 - chains = ieee80211_mcs_to_chains(&ht_cap->mcs); 3302 - } 3303 - sdata->needed_rx_chains = min(chains, local->rx_chains); 3304 - } else { 3305 - sdata->needed_rx_chains = 1; 3306 - sdata->u.mgd.flags |= IEEE80211_STA_DISABLE_HT; 3307 - } 3478 + rcu_read_unlock(); 3308 3479 3309 3480 /* will change later if needed */ 3310 3481 sdata->smps_mode = IEEE80211_SMPS_OFF; 3311 3482 3312 - ieee80211_vif_release_channel(sdata); 3313 - cfg80211_chandef_create(&chandef, cbss->channel, channel_type); 3314 - return ieee80211_vif_use_channel(sdata, &chandef, 3315 - IEEE80211_CHANCTX_SHARED); 3483 + /* 3484 + * If this fails (possibly due to channel context sharing 3485 + * on incompatible channels, e.g. 80+80 and 160 sharing the 3486 + * same control channel) try to use a smaller bandwidth. 3487 + */ 3488 + ret = ieee80211_vif_use_channel(sdata, &chandef, 3489 + IEEE80211_CHANCTX_SHARED); 3490 + while (ret && chandef.width != NL80211_CHAN_WIDTH_20_NOHT) 3491 + ifmgd->flags |= chandef_downgrade(&chandef); 3492 + return ret; 3316 3493 } 3317 3494 3318 3495 static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, ··· 3747 3510 const u8 *ssidie, *ht_ie; 3748 3511 int i, err; 3749 3512 3750 - ssidie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID); 3751 - if (!ssidie) 3752 - return -EINVAL; 3753 - 3754 3513 assoc_data = kzalloc(sizeof(*assoc_data) + req->ie_len, GFP_KERNEL); 3755 3514 if (!assoc_data) 3756 3515 return -ENOMEM; 3516 + 3517 + rcu_read_lock(); 3518 + ssidie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID); 3519 + if (!ssidie) { 3520 + rcu_read_unlock(); 3521 + kfree(assoc_data); 3522 + return -EINVAL; 3523 + } 3524 + memcpy(assoc_data->ssid, ssidie + 2, ssidie[1]); 3525 + assoc_data->ssid_len = ssidie[1]; 3526 + rcu_read_unlock(); 3757 3527 3758 3528 mutex_lock(&ifmgd->mtx); 3759 3529 ··· 3856 3612 assoc_data->supp_rates = bss->supp_rates; 3857 3613 assoc_data->supp_rates_len = bss->supp_rates_len; 3858 3614 3615 + rcu_read_lock(); 3859 3616 ht_ie = ieee80211_bss_get_ie(req->bss, WLAN_EID_HT_OPERATION); 3860 3617 if (ht_ie && ht_ie[1] >= sizeof(struct ieee80211_ht_operation)) 3861 3618 assoc_data->ap_ht_param = 3862 3619 ((struct ieee80211_ht_operation *)(ht_ie + 2))->ht_param; 3863 3620 else 3864 3621 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; 3622 + rcu_read_unlock(); 3865 3623 3866 3624 if (bss->wmm_used && bss->uapsd_supported && 3867 3625 (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD)) { ··· 3873 3627 assoc_data->uapsd = false; 3874 3628 ifmgd->flags &= ~IEEE80211_STA_UAPSD_ENABLED; 3875 3629 } 3876 - 3877 - memcpy(assoc_data->ssid, ssidie + 2, ssidie[1]); 3878 - assoc_data->ssid_len = ssidie[1]; 3879 3630 3880 3631 if (req->prev_bssid) 3881 3632 memcpy(assoc_data->prev_bssid, req->prev_bssid, ETH_ALEN);
-2
net/mac80211/offchannel.c
··· 462 462 list_move_tail(&roc->list, &tmp_list); 463 463 roc->abort = true; 464 464 } 465 - 466 - ieee80211_start_next_roc(local); 467 465 mutex_unlock(&local->mtx); 468 466 469 467 list_for_each_entry_safe(roc, tmp, &tmp_list, list) {
+3 -5
net/mac80211/rc80211_minstrel_ht.c
··· 389 389 struct ieee80211_tx_rate *ar = info->status.rates; 390 390 struct minstrel_rate_stats *rate, *rate2; 391 391 struct minstrel_priv *mp = priv; 392 - bool last = false; 392 + bool last; 393 393 int group; 394 - int i = 0; 394 + int i; 395 395 396 396 if (!msp->is_ht) 397 397 return mac80211_minstrel.tx_status(priv, sband, sta, &msp->legacy, skb); ··· 419 419 if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) 420 420 mi->sample_packets += info->status.ampdu_len; 421 421 422 + last = !minstrel_ht_txstat_valid(&ar[0]); 422 423 for (i = 0; !last; i++) { 423 424 last = (i == IEEE80211_TX_MAX_RATES - 1) || 424 425 !minstrel_ht_txstat_valid(&ar[i + 1]); 425 - 426 - if (!minstrel_ht_txstat_valid(&ar[i])) 427 - break; 428 426 429 427 group = minstrel_ht_get_group_idx(&ar[i]); 430 428 rate = &mi->groups[group].rates[ar[i].idx % 8];
+41 -1
net/mac80211/rx.c
··· 49 49 /* driver bug */ 50 50 WARN_ON(1); 51 51 dev_kfree_skb(skb); 52 - skb = NULL; 52 + return NULL; 53 53 } 54 54 } 55 55 ··· 109 109 if (status->flag & RX_FLAG_AMPDU_DETAILS) { 110 110 len = ALIGN(len, 4); 111 111 len += 8; 112 + } 113 + 114 + if (status->flag & RX_FLAG_VHT) { 115 + len = ALIGN(len, 2); 116 + len += 12; 112 117 } 113 118 114 119 if (status->vendor_radiotap_len) { ··· 300 295 else 301 296 *pos++ = 0; 302 297 *pos++ = 0; 298 + } 299 + 300 + if (status->flag & RX_FLAG_VHT) { 301 + u16 known = local->hw.radiotap_vht_details; 302 + 303 + rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_VHT); 304 + /* known field - how to handle 80+80? */ 305 + if (status->flag & RX_FLAG_80P80MHZ) 306 + known &= ~IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; 307 + put_unaligned_le16(known, pos); 308 + pos += 2; 309 + /* flags */ 310 + if (status->flag & RX_FLAG_SHORT_GI) 311 + *pos |= IEEE80211_RADIOTAP_VHT_FLAG_SGI; 312 + pos++; 313 + /* bandwidth */ 314 + if (status->flag & RX_FLAG_80MHZ) 315 + *pos++ = 4; 316 + else if (status->flag & RX_FLAG_80P80MHZ) 317 + *pos++ = 0; /* marked not known above */ 318 + else if (status->flag & RX_FLAG_160MHZ) 319 + *pos++ = 11; 320 + else if (status->flag & RX_FLAG_40MHZ) 321 + *pos++ = 1; 322 + else /* 20 MHz */ 323 + *pos++ = 0; 324 + /* MCS/NSS */ 325 + *pos = (status->rate_idx << 4) | status->vht_nss; 326 + pos += 4; 327 + /* coding field */ 328 + pos++; 329 + /* group ID */ 330 + pos++; 331 + /* partial_aid */ 332 + pos += 2; 303 333 } 304 334 305 335 if (status->vendor_radiotap_len) {
+12 -9
net/mac80211/scan.c
··· 247 247 local->hw_scan_req->n_channels = n_chans; 248 248 249 249 ielen = ieee80211_build_preq_ies(local, (u8 *)local->hw_scan_req->ie, 250 + local->hw_scan_ies_bufsize, 250 251 req->ie, req->ie_len, band, 251 252 req->rates[band], 0); 252 253 local->hw_scan_req->ie_len = ielen; ··· 446 445 if (local->ops->hw_scan) { 447 446 u8 *ies; 448 447 448 + local->hw_scan_ies_bufsize = 2 + IEEE80211_MAX_SSID_LEN + 449 + local->scan_ies_len + 450 + req->ie_len; 449 451 local->hw_scan_req = kmalloc( 450 452 sizeof(*local->hw_scan_req) + 451 453 req->n_channels * sizeof(req->channels[0]) + 452 - 2 + IEEE80211_MAX_SSID_LEN + local->scan_ies_len + 453 - req->ie_len, GFP_KERNEL); 454 + local->hw_scan_ies_bufsize, GFP_KERNEL); 454 455 if (!local->hw_scan_req) 455 456 return -ENOMEM; 456 457 ··· 931 928 { 932 929 struct ieee80211_local *local = sdata->local; 933 930 struct ieee80211_sched_scan_ies sched_scan_ies = {}; 934 - int ret, i; 931 + int ret, i, iebufsz; 932 + 933 + iebufsz = 2 + IEEE80211_MAX_SSID_LEN + 934 + local->scan_ies_len + req->ie_len; 935 935 936 936 mutex_lock(&local->mtx); 937 937 ··· 952 946 if (!local->hw.wiphy->bands[i]) 953 947 continue; 954 948 955 - sched_scan_ies.ie[i] = kzalloc(2 + IEEE80211_MAX_SSID_LEN + 956 - local->scan_ies_len + 957 - req->ie_len, 958 - GFP_KERNEL); 949 + sched_scan_ies.ie[i] = kzalloc(iebufsz, GFP_KERNEL); 959 950 if (!sched_scan_ies.ie[i]) { 960 951 ret = -ENOMEM; 961 952 goto out_free; ··· 960 957 961 958 sched_scan_ies.len[i] = 962 959 ieee80211_build_preq_ies(local, sched_scan_ies.ie[i], 963 - req->ie, req->ie_len, i, 964 - (u32) -1, 0); 960 + iebufsz, req->ie, req->ie_len, 961 + i, (u32) -1, 0); 965 962 } 966 963 967 964 ret = drv_sched_scan_start(local, sdata, req, &sched_scan_ies);
+4
net/mac80211/sta_info.h
··· 250 250 * @rx_dropped: number of dropped MPDUs from this STA 251 251 * @last_signal: signal of last received frame from this STA 252 252 * @avg_signal: moving average of signal of received frames from this STA 253 + * @last_ack_signal: signal of last received Ack frame from this STA 253 254 * @last_seq_ctrl: last received seq/frag number from this STA (per RX queue) 254 255 * @tx_filtered_count: number of frames the hardware filtered for this STA 255 256 * @tx_retry_failed: number of frames that failed retry ··· 330 329 unsigned long rx_dropped; 331 330 int last_signal; 332 331 struct ewma avg_signal; 332 + int last_ack_signal; 333 333 /* Plus 1 for non-QoS frames */ 334 334 __le16 last_seq_ctrl[IEEE80211_NUM_TIDS + 1]; 335 335 ··· 553 551 struct ieee80211_sub_if_data *sdata); 554 552 void sta_set_rate_info_tx(struct sta_info *sta, 555 553 const struct ieee80211_tx_rate *rate, 554 + struct rate_info *rinfo); 555 + void sta_set_rate_info_rx(struct sta_info *sta, 556 556 struct rate_info *rinfo); 557 557 void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, 558 558 unsigned long exp_time);
+3
net/mac80211/status.c
··· 539 539 sta->lost_packets = 0; 540 540 } 541 541 } 542 + 543 + if (acked) 544 + sta->last_ack_signal = info->status.ack_signal; 542 545 } 543 546 544 547 rcu_read_unlock();
+2 -7
net/mac80211/tx.c
··· 2623 2623 struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, 2624 2624 struct ieee80211_vif *vif, 2625 2625 const u8 *ssid, size_t ssid_len, 2626 - const u8 *ie, size_t ie_len) 2626 + size_t tailroom) 2627 2627 { 2628 2628 struct ieee80211_sub_if_data *sdata; 2629 2629 struct ieee80211_local *local; ··· 2637 2637 ie_ssid_len = 2 + ssid_len; 2638 2638 2639 2639 skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*hdr) + 2640 - ie_ssid_len + ie_len); 2640 + ie_ssid_len + tailroom); 2641 2641 if (!skb) 2642 2642 return NULL; 2643 2643 ··· 2657 2657 if (ssid_len) 2658 2658 memcpy(pos, ssid, ssid_len); 2659 2659 pos += ssid_len; 2660 - 2661 - if (ie) { 2662 - pos = skb_put(skb, ie_len); 2663 - memcpy(pos, ie, ie_len); 2664 - } 2665 2660 2666 2661 return skb; 2667 2662 }
+35 -23
net/mac80211/util.c
··· 1107 1107 } 1108 1108 1109 1109 int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, 1110 - const u8 *ie, size_t ie_len, 1110 + size_t buffer_len, const u8 *ie, size_t ie_len, 1111 1111 enum ieee80211_band band, u32 rate_mask, 1112 1112 u8 channel) 1113 1113 { 1114 1114 struct ieee80211_supported_band *sband; 1115 - u8 *pos; 1115 + u8 *pos = buffer, *end = buffer + buffer_len; 1116 1116 size_t offset = 0, noffset; 1117 1117 int supp_rates_len, i; 1118 1118 u8 rates[32]; ··· 1123 1123 if (WARN_ON_ONCE(!sband)) 1124 1124 return 0; 1125 1125 1126 - pos = buffer; 1127 - 1128 1126 num_rates = 0; 1129 1127 for (i = 0; i < sband->n_bitrates; i++) { 1130 1128 if ((BIT(i) & rate_mask) == 0) ··· 1132 1134 1133 1135 supp_rates_len = min_t(int, num_rates, 8); 1134 1136 1137 + if (end - pos < 2 + supp_rates_len) 1138 + goto out_err; 1135 1139 *pos++ = WLAN_EID_SUPP_RATES; 1136 1140 *pos++ = supp_rates_len; 1137 1141 memcpy(pos, rates, supp_rates_len); ··· 1150 1150 before_extrates, 1151 1151 ARRAY_SIZE(before_extrates), 1152 1152 offset); 1153 + if (end - pos < noffset - offset) 1154 + goto out_err; 1153 1155 memcpy(pos, ie + offset, noffset - offset); 1154 1156 pos += noffset - offset; 1155 1157 offset = noffset; ··· 1159 1157 1160 1158 ext_rates_len = num_rates - supp_rates_len; 1161 1159 if (ext_rates_len > 0) { 1160 + if (end - pos < 2 + ext_rates_len) 1161 + goto out_err; 1162 1162 *pos++ = WLAN_EID_EXT_SUPP_RATES; 1163 1163 *pos++ = ext_rates_len; 1164 1164 memcpy(pos, rates + supp_rates_len, ext_rates_len); ··· 1168 1164 } 1169 1165 1170 1166 if (channel && sband->band == IEEE80211_BAND_2GHZ) { 1167 + if (end - pos < 3) 1168 + goto out_err; 1171 1169 *pos++ = WLAN_EID_DS_PARAMS; 1172 1170 *pos++ = 1; 1173 1171 *pos++ = channel; ··· 1188 1182 noffset = ieee80211_ie_split(ie, ie_len, 1189 1183 before_ht, ARRAY_SIZE(before_ht), 1190 1184 offset); 1185 + if (end - pos < noffset - offset) 1186 + goto out_err; 1191 1187 memcpy(pos, ie + offset, noffset - offset); 1192 1188 pos += noffset - offset; 1193 1189 offset = noffset; 1194 1190 } 1195 1191 1196 - if (sband->ht_cap.ht_supported) 1192 + if (sband->ht_cap.ht_supported) { 1193 + if (end - pos < 2 + sizeof(struct ieee80211_ht_cap)) 1194 + goto out_err; 1197 1195 pos = ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, 1198 1196 sband->ht_cap.cap); 1197 + } 1199 1198 1200 1199 /* 1201 1200 * If adding more here, adjust code in main.c ··· 1210 1199 /* add any remaining custom IEs */ 1211 1200 if (ie && ie_len) { 1212 1201 noffset = ie_len; 1202 + if (end - pos < noffset - offset) 1203 + goto out_err; 1213 1204 memcpy(pos, ie + offset, noffset - offset); 1214 1205 pos += noffset - offset; 1215 1206 } 1216 1207 1217 - if (sband->vht_cap.vht_supported) 1208 + if (sband->vht_cap.vht_supported) { 1209 + if (end - pos < 2 + sizeof(struct ieee80211_vht_cap)) 1210 + goto out_err; 1218 1211 pos = ieee80211_ie_build_vht_cap(pos, &sband->vht_cap, 1219 1212 sband->vht_cap.cap); 1213 + } 1220 1214 1215 + return pos - buffer; 1216 + out_err: 1217 + WARN_ONCE(1, "not enough space for preq IEs\n"); 1221 1218 return pos - buffer; 1222 1219 } 1223 1220 ··· 1239 1220 struct ieee80211_local *local = sdata->local; 1240 1221 struct sk_buff *skb; 1241 1222 struct ieee80211_mgmt *mgmt; 1242 - size_t buf_len; 1243 - u8 *buf; 1244 1223 u8 chan_no; 1245 - 1246 - /* FIXME: come up with a proper value */ 1247 - buf = kmalloc(200 + ie_len, GFP_KERNEL); 1248 - if (!buf) 1249 - return NULL; 1224 + int ies_len; 1250 1225 1251 1226 /* 1252 1227 * Do not send DS Channel parameter for directed probe requests ··· 1252 1239 else 1253 1240 chan_no = ieee80211_frequency_to_channel(chan->center_freq); 1254 1241 1255 - buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len, chan->band, 1256 - ratemask, chan_no); 1257 - 1258 1242 skb = ieee80211_probereq_get(&local->hw, &sdata->vif, 1259 - ssid, ssid_len, 1260 - buf, buf_len); 1243 + ssid, ssid_len, 100 + ie_len); 1261 1244 if (!skb) 1262 - goto out; 1245 + return NULL; 1246 + 1247 + ies_len = ieee80211_build_preq_ies(local, skb_tail_pointer(skb), 1248 + skb_tailroom(skb), 1249 + ie, ie_len, chan->band, 1250 + ratemask, chan_no); 1251 + skb_put(skb, ies_len); 1263 1252 1264 1253 if (dst) { 1265 1254 mgmt = (struct ieee80211_mgmt *) skb->data; ··· 1270 1255 } 1271 1256 1272 1257 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; 1273 - 1274 - out: 1275 - kfree(buf); 1276 1258 1277 1259 return skb; 1278 1260 } ··· 1539 1527 changed |= BSS_CHANGED_IBSS; 1540 1528 /* fall through */ 1541 1529 case NL80211_IFTYPE_AP: 1542 - changed |= BSS_CHANGED_SSID; 1530 + changed |= BSS_CHANGED_SSID | BSS_CHANGED_P2P_PS; 1543 1531 1544 1532 if (sdata->vif.type == NL80211_IFTYPE_AP) { 1545 1533 changed |= BSS_CHANGED_AP_PROBE_RESP;
+4 -1
net/nfc/llcp/llcp.c
··· 985 985 /* Remove skbs from the pending queue */ 986 986 if (llcp_sock->send_ack_n != nr) { 987 987 struct sk_buff *s, *tmp; 988 + u8 n; 988 989 989 990 llcp_sock->send_ack_n = nr; 990 991 991 992 /* Remove and free all skbs until ns == nr */ 992 993 skb_queue_walk_safe(&llcp_sock->tx_pending_queue, s, tmp) { 994 + n = nfc_llcp_ns(s); 995 + 993 996 skb_unlink(s, &llcp_sock->tx_pending_queue); 994 997 kfree_skb(s); 995 998 996 - if (nfc_llcp_ns(s) == nr) 999 + if (n == nr) 997 1000 break; 998 1001 } 999 1002
+1 -1
net/rfkill/rfkill-gpio.c
··· 213 213 214 214 static struct platform_driver rfkill_gpio_driver = { 215 215 .probe = rfkill_gpio_probe, 216 - .remove = __devexit_p(rfkill_gpio_remove), 216 + .remove = rfkill_gpio_remove, 217 217 .driver = { 218 218 .name = "rfkill_gpio", 219 219 .owner = THIS_MODULE,
+3 -3
net/rfkill/rfkill-regulator.c
··· 55 55 .set_block = rfkill_regulator_set_block, 56 56 }; 57 57 58 - static int __devinit rfkill_regulator_probe(struct platform_device *pdev) 58 + static int rfkill_regulator_probe(struct platform_device *pdev) 59 59 { 60 60 struct rfkill_regulator_platform_data *pdata = pdev->dev.platform_data; 61 61 struct rfkill_regulator_data *rfkill_data; ··· 122 122 return ret; 123 123 } 124 124 125 - static int __devexit rfkill_regulator_remove(struct platform_device *pdev) 125 + static int rfkill_regulator_remove(struct platform_device *pdev) 126 126 { 127 127 struct rfkill_regulator_data *rfkill_data = platform_get_drvdata(pdev); 128 128 struct rfkill *rf_kill = rfkill_data->rf_kill; ··· 137 137 138 138 static struct platform_driver rfkill_regulator_driver = { 139 139 .probe = rfkill_regulator_probe, 140 - .remove = __devexit_p(rfkill_regulator_remove), 140 + .remove = rfkill_regulator_remove, 141 141 .driver = { 142 142 .name = "rfkill-regulator", 143 143 .owner = THIS_MODULE,
+64 -30
net/wireless/chan.c
··· 44 44 } 45 45 EXPORT_SYMBOL(cfg80211_chandef_create); 46 46 47 - bool cfg80211_chan_def_valid(const struct cfg80211_chan_def *chandef) 47 + bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef) 48 48 { 49 49 u32 control_freq; 50 50 ··· 105 105 106 106 return true; 107 107 } 108 + EXPORT_SYMBOL(cfg80211_chandef_valid); 108 109 109 110 static void chandef_primary_freqs(const struct cfg80211_chan_def *c, 110 111 int *pri40, int *pri80) ··· 188 187 } 189 188 EXPORT_SYMBOL(cfg80211_chandef_compatible); 190 189 191 - bool cfg80211_secondary_chans_ok(struct wiphy *wiphy, 192 - u32 center_freq, u32 bandwidth, 193 - u32 prohibited_flags) 190 + static bool cfg80211_secondary_chans_ok(struct wiphy *wiphy, 191 + u32 center_freq, u32 bandwidth, 192 + u32 prohibited_flags) 194 193 { 195 194 struct ieee80211_channel *c; 196 195 u32 freq; ··· 206 205 return true; 207 206 } 208 207 209 - static bool cfg80211_check_beacon_chans(struct wiphy *wiphy, 210 - u32 center_freq, u32 bw) 208 + bool cfg80211_chandef_usable(struct wiphy *wiphy, 209 + const struct cfg80211_chan_def *chandef, 210 + u32 prohibited_flags) 211 211 { 212 - return cfg80211_secondary_chans_ok(wiphy, center_freq, bw, 213 - IEEE80211_CHAN_DISABLED | 214 - IEEE80211_CHAN_PASSIVE_SCAN | 215 - IEEE80211_CHAN_NO_IBSS | 216 - IEEE80211_CHAN_RADAR); 217 - } 212 + struct ieee80211_sta_ht_cap *ht_cap; 213 + struct ieee80211_sta_vht_cap *vht_cap; 214 + u32 width, control_freq; 218 215 219 - bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 220 - struct cfg80211_chan_def *chandef) 221 - { 222 - u32 width; 223 - bool res; 224 - 225 - trace_cfg80211_reg_can_beacon(wiphy, chandef); 226 - 227 - if (WARN_ON(!cfg80211_chan_def_valid(chandef))) { 228 - trace_cfg80211_return_bool(false); 216 + if (WARN_ON(!cfg80211_chandef_valid(chandef))) 229 217 return false; 230 - } 218 + 219 + ht_cap = &wiphy->bands[chandef->chan->band]->ht_cap; 220 + vht_cap = &wiphy->bands[chandef->chan->band]->vht_cap; 221 + 222 + control_freq = chandef->chan->center_freq; 231 223 232 224 switch (chandef->width) { 233 - case NL80211_CHAN_WIDTH_20_NOHT: 234 225 case NL80211_CHAN_WIDTH_20: 226 + if (!ht_cap->ht_supported) 227 + return false; 228 + case NL80211_CHAN_WIDTH_20_NOHT: 235 229 width = 20; 236 230 break; 237 231 case NL80211_CHAN_WIDTH_40: 238 232 width = 40; 233 + if (!ht_cap->ht_supported) 234 + return false; 235 + if (!(ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) || 236 + ht_cap->cap & IEEE80211_HT_CAP_40MHZ_INTOLERANT) 237 + return false; 238 + if (chandef->center_freq1 < control_freq && 239 + chandef->chan->flags & IEEE80211_CHAN_NO_HT40MINUS) 240 + return false; 241 + if (chandef->center_freq1 > control_freq && 242 + chandef->chan->flags & IEEE80211_CHAN_NO_HT40PLUS) 243 + return false; 239 244 break; 240 - case NL80211_CHAN_WIDTH_80: 241 245 case NL80211_CHAN_WIDTH_80P80: 246 + if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)) 247 + return false; 248 + case NL80211_CHAN_WIDTH_80: 249 + if (!vht_cap->vht_supported) 250 + return false; 242 251 width = 80; 243 252 break; 244 253 case NL80211_CHAN_WIDTH_160: 254 + if (!vht_cap->vht_supported) 255 + return false; 256 + if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ)) 257 + return false; 245 258 width = 160; 246 259 break; 247 260 default: 248 261 WARN_ON_ONCE(1); 249 - trace_cfg80211_return_bool(false); 250 262 return false; 251 263 } 252 264 253 - res = cfg80211_check_beacon_chans(wiphy, chandef->center_freq1, width); 265 + /* TODO: missing regulatory check on 80/160 bandwidth */ 254 266 255 - if (res && chandef->center_freq2) 256 - res = cfg80211_check_beacon_chans(wiphy, chandef->center_freq2, 257 - width); 267 + if (!cfg80211_secondary_chans_ok(wiphy, chandef->center_freq1, 268 + width, prohibited_flags)) 269 + return false; 270 + 271 + if (!chandef->center_freq2) 272 + return true; 273 + return cfg80211_secondary_chans_ok(wiphy, chandef->center_freq2, 274 + width, prohibited_flags); 275 + } 276 + EXPORT_SYMBOL(cfg80211_chandef_usable); 277 + 278 + bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 279 + struct cfg80211_chan_def *chandef) 280 + { 281 + bool res; 282 + 283 + trace_cfg80211_reg_can_beacon(wiphy, chandef); 284 + 285 + res = cfg80211_chandef_usable(wiphy, chandef, 286 + IEEE80211_CHAN_DISABLED | 287 + IEEE80211_CHAN_PASSIVE_SCAN | 288 + IEEE80211_CHAN_NO_IBSS | 289 + IEEE80211_CHAN_RADAR); 258 290 259 291 trace_cfg80211_return_bool(res); 260 292 return res;
-8
net/wireless/core.h
··· 138 138 unsigned long ts; 139 139 struct kref ref; 140 140 atomic_t hold; 141 - bool beacon_ies_allocated; 142 - bool proberesp_ies_allocated; 143 141 144 142 /* must be last because of priv member */ 145 143 struct cfg80211_bss pub; ··· 480 482 481 483 void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev, 482 484 enum nl80211_iftype iftype, int num); 483 - 484 - bool cfg80211_chan_def_valid(const struct cfg80211_chan_def *chandef); 485 - 486 - bool cfg80211_secondary_chans_ok(struct wiphy *wiphy, 487 - u32 center_freq, u32 bandwidth, 488 - u32 prohibited_flags); 489 485 490 486 #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10 491 487
+2 -1
net/wireless/mesh.c
··· 146 146 if (!setup->chandef.chan) 147 147 return -EINVAL; 148 148 149 - setup->chandef.width = NL80211_CHAN_WIDTH_20_NOHT;; 149 + setup->chandef.width = NL80211_CHAN_WIDTH_20_NOHT; 150 + setup->chandef.center_freq1 = setup->chandef.chan->center_freq; 150 151 } 151 152 152 153 if (!cfg80211_reg_can_beacon(&rdev->wiphy, &setup->chandef))
+82 -73
net/wireless/nl80211.c
··· 363 363 [NL80211_ATTR_SAE_DATA] = { .type = NLA_BINARY, }, 364 364 [NL80211_ATTR_VHT_CAPABILITY] = { .len = NL80211_VHT_CAPABILITY_LEN }, 365 365 [NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 }, 366 + [NL80211_ATTR_P2P_CTWINDOW] = { .type = NLA_U8 }, 367 + [NL80211_ATTR_P2P_OPPPS] = { .type = NLA_U8 }, 366 368 }; 367 369 368 370 /* policy for the key attributes */ ··· 1371 1369 struct genl_info *info, 1372 1370 struct cfg80211_chan_def *chandef) 1373 1371 { 1374 - struct ieee80211_sta_ht_cap *ht_cap; 1375 - struct ieee80211_sta_vht_cap *vht_cap; 1376 - u32 control_freq, width; 1372 + u32 control_freq; 1377 1373 1378 1374 if (!info->attrs[NL80211_ATTR_WIPHY_FREQ]) 1379 1375 return -EINVAL; ··· 1417 1417 info->attrs[NL80211_ATTR_CENTER_FREQ2]); 1418 1418 } 1419 1419 1420 - ht_cap = &rdev->wiphy.bands[chandef->chan->band]->ht_cap; 1421 - vht_cap = &rdev->wiphy.bands[chandef->chan->band]->vht_cap; 1422 - 1423 - if (!cfg80211_chan_def_valid(chandef)) 1420 + if (!cfg80211_chandef_valid(chandef)) 1424 1421 return -EINVAL; 1425 1422 1426 - switch (chandef->width) { 1427 - case NL80211_CHAN_WIDTH_20: 1428 - if (!ht_cap->ht_supported) 1429 - return -EINVAL; 1430 - case NL80211_CHAN_WIDTH_20_NOHT: 1431 - width = 20; 1432 - break; 1433 - case NL80211_CHAN_WIDTH_40: 1434 - width = 40; 1435 - /* quick early regulatory check */ 1436 - if (chandef->center_freq1 < control_freq && 1437 - chandef->chan->flags & IEEE80211_CHAN_NO_HT40MINUS) 1438 - return -EINVAL; 1439 - if (chandef->center_freq1 > control_freq && 1440 - chandef->chan->flags & IEEE80211_CHAN_NO_HT40PLUS) 1441 - return -EINVAL; 1442 - if (!ht_cap->ht_supported) 1443 - return -EINVAL; 1444 - if (!(ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) || 1445 - ht_cap->cap & IEEE80211_HT_CAP_40MHZ_INTOLERANT) 1446 - return -EINVAL; 1447 - break; 1448 - case NL80211_CHAN_WIDTH_80: 1449 - width = 80; 1450 - if (!vht_cap->vht_supported) 1451 - return -EINVAL; 1452 - break; 1453 - case NL80211_CHAN_WIDTH_80P80: 1454 - width = 80; 1455 - if (!vht_cap->vht_supported) 1456 - return -EINVAL; 1457 - if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)) 1458 - return -EINVAL; 1459 - break; 1460 - case NL80211_CHAN_WIDTH_160: 1461 - width = 160; 1462 - if (!vht_cap->vht_supported) 1463 - return -EINVAL; 1464 - if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ)) 1465 - return -EINVAL; 1466 - break; 1467 - default: 1423 + if (!cfg80211_chandef_usable(&rdev->wiphy, chandef, 1424 + IEEE80211_CHAN_DISABLED)) 1468 1425 return -EINVAL; 1469 - } 1470 - 1471 - if (!cfg80211_secondary_chans_ok(&rdev->wiphy, chandef->center_freq1, 1472 - width, IEEE80211_CHAN_DISABLED)) 1473 - return -EINVAL; 1474 - if (chandef->center_freq2 && 1475 - !cfg80211_secondary_chans_ok(&rdev->wiphy, chandef->center_freq2, 1476 - width, IEEE80211_CHAN_DISABLED)) 1477 - return -EINVAL; 1478 - 1479 - /* TODO: missing regulatory check on bandwidth */ 1480 1426 1481 1427 return 0; 1482 1428 } ··· 1787 1841 static int nl80211_send_chandef(struct sk_buff *msg, 1788 1842 struct cfg80211_chan_def *chandef) 1789 1843 { 1790 - WARN_ON(!cfg80211_chan_def_valid(chandef)); 1844 + WARN_ON(!cfg80211_chandef_valid(chandef)); 1791 1845 1792 1846 if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, 1793 1847 chandef->chan->center_freq)) ··· 2676 2730 return -EOPNOTSUPP; 2677 2731 params.inactivity_timeout = nla_get_u16( 2678 2732 info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]); 2733 + } 2734 + 2735 + if (info->attrs[NL80211_ATTR_P2P_CTWINDOW]) { 2736 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) 2737 + return -EINVAL; 2738 + params.p2p_ctwindow = 2739 + nla_get_u8(info->attrs[NL80211_ATTR_P2P_CTWINDOW]); 2740 + if (params.p2p_ctwindow > 127) 2741 + return -EINVAL; 2742 + if (params.p2p_ctwindow != 0 && 2743 + !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN)) 2744 + return -EINVAL; 2745 + } 2746 + 2747 + if (info->attrs[NL80211_ATTR_P2P_OPPPS]) { 2748 + u8 tmp; 2749 + 2750 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) 2751 + return -EINVAL; 2752 + tmp = nla_get_u8(info->attrs[NL80211_ATTR_P2P_OPPPS]); 2753 + if (tmp > 1) 2754 + return -EINVAL; 2755 + params.p2p_opp_ps = tmp; 2756 + if (params.p2p_opp_ps != 0 && 2757 + !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS)) 2758 + return -EINVAL; 2679 2759 } 2680 2760 2681 2761 if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { ··· 3670 3698 params.use_short_slot_time = -1; 3671 3699 params.ap_isolate = -1; 3672 3700 params.ht_opmode = -1; 3701 + params.p2p_ctwindow = -1; 3702 + params.p2p_opp_ps = -1; 3673 3703 3674 3704 if (info->attrs[NL80211_ATTR_BSS_CTS_PROT]) 3675 3705 params.use_cts_prot = ··· 3693 3719 if (info->attrs[NL80211_ATTR_BSS_HT_OPMODE]) 3694 3720 params.ht_opmode = 3695 3721 nla_get_u16(info->attrs[NL80211_ATTR_BSS_HT_OPMODE]); 3722 + 3723 + if (info->attrs[NL80211_ATTR_P2P_CTWINDOW]) { 3724 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) 3725 + return -EINVAL; 3726 + params.p2p_ctwindow = 3727 + nla_get_s8(info->attrs[NL80211_ATTR_P2P_CTWINDOW]); 3728 + if (params.p2p_ctwindow < 0) 3729 + return -EINVAL; 3730 + if (params.p2p_ctwindow != 0 && 3731 + !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN)) 3732 + return -EINVAL; 3733 + } 3734 + 3735 + if (info->attrs[NL80211_ATTR_P2P_OPPPS]) { 3736 + u8 tmp; 3737 + 3738 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) 3739 + return -EINVAL; 3740 + tmp = nla_get_u8(info->attrs[NL80211_ATTR_P2P_OPPPS]); 3741 + if (tmp > 1) 3742 + return -EINVAL; 3743 + params.p2p_opp_ps = tmp; 3744 + if (params.p2p_opp_ps && 3745 + !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS)) 3746 + return -EINVAL; 3747 + } 3696 3748 3697 3749 if (!rdev->ops->change_bss) 3698 3750 return -EOPNOTSUPP; ··· 4808 4808 struct cfg80211_internal_bss *intbss) 4809 4809 { 4810 4810 struct cfg80211_bss *res = &intbss->pub; 4811 + const struct cfg80211_bss_ies *ies; 4811 4812 void *hdr; 4812 4813 struct nlattr *bss; 4813 4814 ··· 4829 4828 if (!bss) 4830 4829 goto nla_put_failure; 4831 4830 if ((!is_zero_ether_addr(res->bssid) && 4832 - nla_put(msg, NL80211_BSS_BSSID, ETH_ALEN, res->bssid)) || 4833 - (res->information_elements && res->len_information_elements && 4834 - nla_put(msg, NL80211_BSS_INFORMATION_ELEMENTS, 4835 - res->len_information_elements, 4836 - res->information_elements)) || 4837 - (res->beacon_ies && res->len_beacon_ies && 4838 - res->beacon_ies != res->information_elements && 4839 - nla_put(msg, NL80211_BSS_BEACON_IES, 4840 - res->len_beacon_ies, res->beacon_ies))) 4831 + nla_put(msg, NL80211_BSS_BSSID, ETH_ALEN, res->bssid))) 4841 4832 goto nla_put_failure; 4833 + 4834 + rcu_read_lock(); 4835 + ies = rcu_dereference(res->ies); 4836 + if (ies && ies->len && nla_put(msg, NL80211_BSS_INFORMATION_ELEMENTS, 4837 + ies->len, ies->data)) { 4838 + rcu_read_unlock(); 4839 + goto nla_put_failure; 4840 + } 4841 + ies = rcu_dereference(res->beacon_ies); 4842 + if (ies && ies->len && nla_put(msg, NL80211_BSS_BEACON_IES, 4843 + ies->len, ies->data)) { 4844 + rcu_read_unlock(); 4845 + goto nla_put_failure; 4846 + } 4847 + rcu_read_unlock(); 4848 + 4842 4849 if (res->tsf && 4843 4850 nla_put_u64(msg, NL80211_BSS_TSF, res->tsf)) 4844 4851 goto nla_put_failure; ··· 5511 5502 return -EINVAL; 5512 5503 if (ibss.chandef.width != NL80211_CHAN_WIDTH_20_NOHT && 5513 5504 !(rdev->wiphy.features & NL80211_FEATURE_HT_IBSS)) 5505 + return -EINVAL; 5514 5506 5515 5507 ibss.channel_fixed = !!info->attrs[NL80211_ATTR_FREQ_FIXED]; 5516 5508 ibss.privacy = !!info->attrs[NL80211_ATTR_PRIVACY]; ··· 6539 6529 }; 6540 6530 6541 6531 static int nl80211_set_cqm_txe(struct genl_info *info, 6542 - u32 rate, u32 pkts, u32 intvl) 6532 + u32 rate, u32 pkts, u32 intvl) 6543 6533 { 6544 6534 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 6545 6535 struct wireless_dev *wdev; 6546 6536 struct net_device *dev = info->user_ptr[1]; 6547 6537 6548 - if ((rate < 0 || rate > 100) || 6549 - (intvl < 0 || intvl > NL80211_CQM_TXE_MAX_INTVL)) 6538 + if (rate > 100 || intvl > NL80211_CQM_TXE_MAX_INTVL) 6550 6539 return -EINVAL; 6551 6540 6552 6541 wdev = dev->ieee80211_ptr;
+1 -1
net/wireless/reg.c
··· 1796 1796 */ 1797 1797 void regulatory_hint_11d(struct wiphy *wiphy, 1798 1798 enum ieee80211_band band, 1799 - u8 *country_ie, 1799 + const u8 *country_ie, 1800 1800 u8 country_ie_len) 1801 1801 { 1802 1802 char alpha2[2];
+1 -1
net/wireless/reg.h
··· 81 81 */ 82 82 void regulatory_hint_11d(struct wiphy *wiphy, 83 83 enum ieee80211_band band, 84 - u8 *country_ie, 84 + const u8 *country_ie, 85 85 u8 country_ie_len); 86 86 87 87 /**
+221 -221
net/wireless/scan.c
··· 23 23 24 24 static void bss_release(struct kref *ref) 25 25 { 26 + struct cfg80211_bss_ies *ies; 26 27 struct cfg80211_internal_bss *bss; 27 28 28 29 bss = container_of(ref, struct cfg80211_internal_bss, ref); 30 + 31 + if (WARN_ON(atomic_read(&bss->hold))) 32 + return; 33 + 29 34 if (bss->pub.free_priv) 30 35 bss->pub.free_priv(&bss->pub); 31 36 32 - if (bss->beacon_ies_allocated) 33 - kfree(bss->pub.beacon_ies); 34 - if (bss->proberesp_ies_allocated) 35 - kfree(bss->pub.proberesp_ies); 36 - 37 - BUG_ON(atomic_read(&bss->hold)); 37 + ies = (void *)rcu_access_pointer(bss->pub.beacon_ies); 38 + if (ies) 39 + kfree_rcu(ies, rcu_head); 40 + ies = (void *)rcu_access_pointer(bss->pub.proberesp_ies); 41 + if (ies) 42 + kfree_rcu(ies, rcu_head); 38 43 39 44 kfree(bss); 40 45 } ··· 241 236 struct cfg80211_internal_bss *bss; 242 237 unsigned long age_jiffies = msecs_to_jiffies(age_secs * MSEC_PER_SEC); 243 238 244 - list_for_each_entry(bss, &dev->bss_list, list) { 239 + list_for_each_entry(bss, &dev->bss_list, list) 245 240 bss->ts -= age_jiffies; 246 - } 247 241 } 248 242 249 243 void cfg80211_bss_expire(struct cfg80211_registered_device *dev) ··· 291 287 } 292 288 EXPORT_SYMBOL(cfg80211_find_vendor_ie); 293 289 294 - static int cmp_ies(u8 num, u8 *ies1, size_t len1, u8 *ies2, size_t len2) 290 + static int cmp_ies(u8 num, const u8 *ies1, int len1, const u8 *ies2, int len2) 295 291 { 296 292 const u8 *ie1 = cfg80211_find_ie(num, ies1, len1); 297 293 const u8 *ie2 = cfg80211_find_ie(num, ies2, len2); ··· 311 307 return memcmp(ie1 + 2, ie2 + 2, ie1[1]); 312 308 } 313 309 314 - static bool is_bss(struct cfg80211_bss *a, 315 - const u8 *bssid, 310 + static bool is_bss(struct cfg80211_bss *a, const u8 *bssid, 316 311 const u8 *ssid, size_t ssid_len) 317 312 { 313 + const struct cfg80211_bss_ies *ies; 318 314 const u8 *ssidie; 319 315 320 316 if (bssid && !ether_addr_equal(a->bssid, bssid)) ··· 323 319 if (!ssid) 324 320 return true; 325 321 326 - ssidie = cfg80211_find_ie(WLAN_EID_SSID, 327 - a->information_elements, 328 - a->len_information_elements); 322 + ies = rcu_access_pointer(a->ies); 323 + if (!ies) 324 + return false; 325 + ssidie = cfg80211_find_ie(WLAN_EID_SSID, ies->data, ies->len); 329 326 if (!ssidie) 330 327 return false; 331 328 if (ssidie[1] != ssid_len) ··· 336 331 337 332 static bool is_mesh_bss(struct cfg80211_bss *a) 338 333 { 334 + const struct cfg80211_bss_ies *ies; 339 335 const u8 *ie; 340 336 341 337 if (!WLAN_CAPABILITY_IS_STA_BSS(a->capability)) 342 338 return false; 343 339 344 - ie = cfg80211_find_ie(WLAN_EID_MESH_ID, 345 - a->information_elements, 346 - a->len_information_elements); 340 + ies = rcu_access_pointer(a->ies); 341 + if (!ies) 342 + return false; 343 + 344 + ie = cfg80211_find_ie(WLAN_EID_MESH_ID, ies->data, ies->len); 347 345 if (!ie) 348 346 return false; 349 347 350 - ie = cfg80211_find_ie(WLAN_EID_MESH_CONFIG, 351 - a->information_elements, 352 - a->len_information_elements); 348 + ie = cfg80211_find_ie(WLAN_EID_MESH_CONFIG, ies->data, ies->len); 353 349 if (!ie) 354 350 return false; 355 351 ··· 361 355 const u8 *meshid, size_t meshidlen, 362 356 const u8 *meshcfg) 363 357 { 358 + const struct cfg80211_bss_ies *ies; 364 359 const u8 *ie; 365 360 366 361 if (!WLAN_CAPABILITY_IS_STA_BSS(a->capability)) 367 362 return false; 368 363 369 - ie = cfg80211_find_ie(WLAN_EID_MESH_ID, 370 - a->information_elements, 371 - a->len_information_elements); 364 + ies = rcu_access_pointer(a->ies); 365 + if (!ies) 366 + return false; 367 + 368 + ie = cfg80211_find_ie(WLAN_EID_MESH_ID, ies->data, ies->len); 372 369 if (!ie) 373 370 return false; 374 371 if (ie[1] != meshidlen) ··· 379 370 if (memcmp(ie + 2, meshid, meshidlen)) 380 371 return false; 381 372 382 - ie = cfg80211_find_ie(WLAN_EID_MESH_CONFIG, 383 - a->information_elements, 384 - a->len_information_elements); 373 + ie = cfg80211_find_ie(WLAN_EID_MESH_CONFIG, ies->data, ies->len); 385 374 if (!ie) 386 375 return false; 387 376 if (ie[1] != sizeof(struct ieee80211_meshconf_ie)) ··· 391 384 * part in the same mesh. 392 385 */ 393 386 return memcmp(ie + 2, meshcfg, 394 - sizeof(struct ieee80211_meshconf_ie) - 2) == 0; 387 + sizeof(struct ieee80211_meshconf_ie) - 2) == 0; 395 388 } 396 389 397 - static int cmp_bss_core(struct cfg80211_bss *a, 398 - struct cfg80211_bss *b) 390 + static int cmp_bss_core(struct cfg80211_bss *a, struct cfg80211_bss *b) 399 391 { 392 + const struct cfg80211_bss_ies *a_ies, *b_ies; 400 393 int r; 401 394 402 395 if (a->channel != b->channel) 403 396 return b->channel->center_freq - a->channel->center_freq; 404 397 405 398 if (is_mesh_bss(a) && is_mesh_bss(b)) { 399 + a_ies = rcu_access_pointer(a->ies); 400 + if (!a_ies) 401 + return -1; 402 + b_ies = rcu_access_pointer(b->ies); 403 + if (!b_ies) 404 + return 1; 405 + 406 406 r = cmp_ies(WLAN_EID_MESH_ID, 407 - a->information_elements, 408 - a->len_information_elements, 409 - b->information_elements, 410 - b->len_information_elements); 407 + a_ies->data, a_ies->len, 408 + b_ies->data, b_ies->len); 411 409 if (r) 412 410 return r; 413 411 return cmp_ies(WLAN_EID_MESH_CONFIG, 414 - a->information_elements, 415 - a->len_information_elements, 416 - b->information_elements, 417 - b->len_information_elements); 412 + a_ies->data, a_ies->len, 413 + b_ies->data, b_ies->len); 418 414 } 419 415 420 416 /* ··· 430 420 static int cmp_bss(struct cfg80211_bss *a, 431 421 struct cfg80211_bss *b) 432 422 { 423 + const struct cfg80211_bss_ies *a_ies, *b_ies; 433 424 int r; 434 425 435 426 r = cmp_bss_core(a, b); 436 427 if (r) 437 428 return r; 438 429 430 + a_ies = rcu_access_pointer(a->ies); 431 + if (!a_ies) 432 + return -1; 433 + b_ies = rcu_access_pointer(b->ies); 434 + if (!b_ies) 435 + return 1; 436 + 439 437 return cmp_ies(WLAN_EID_SSID, 440 - a->information_elements, 441 - a->len_information_elements, 442 - b->information_elements, 443 - b->len_information_elements); 438 + a_ies->data, a_ies->len, 439 + b_ies->data, b_ies->len); 444 440 } 445 441 446 - static int cmp_hidden_bss(struct cfg80211_bss *a, 447 - struct cfg80211_bss *b) 442 + static int cmp_hidden_bss(struct cfg80211_bss *a, struct cfg80211_bss *b) 448 443 { 444 + const struct cfg80211_bss_ies *a_ies, *b_ies; 449 445 const u8 *ie1; 450 446 const u8 *ie2; 451 447 int i; ··· 461 445 if (r) 462 446 return r; 463 447 464 - ie1 = cfg80211_find_ie(WLAN_EID_SSID, 465 - a->information_elements, 466 - a->len_information_elements); 467 - ie2 = cfg80211_find_ie(WLAN_EID_SSID, 468 - b->information_elements, 469 - b->len_information_elements); 448 + a_ies = rcu_access_pointer(a->ies); 449 + if (!a_ies) 450 + return -1; 451 + b_ies = rcu_access_pointer(b->ies); 452 + if (!b_ies) 453 + return 1; 470 454 471 - /* Key comparator must use same algorithm in any rb-tree 455 + ie1 = cfg80211_find_ie(WLAN_EID_SSID, a_ies->data, a_ies->len); 456 + ie2 = cfg80211_find_ie(WLAN_EID_SSID, b_ies->data, b_ies->len); 457 + 458 + /* 459 + * Key comparator must use same algorithm in any rb-tree 472 460 * search function (order is important), otherwise ordering 473 461 * of items in the tree is broken and search gives incorrect 474 - * results. This code uses same order as cmp_ies() does. */ 462 + * results. This code uses same order as cmp_ies() does. 463 + * 464 + * Note that due to the differring behaviour with hidden SSIDs 465 + * this function only works when "b" is the tree element and 466 + * "a" is the key we're looking for. 467 + */ 475 468 476 469 /* sort missing IE before (left of) present IE */ 477 470 if (!ie1) ··· 496 471 if (ie1[1] != ie2[1]) 497 472 return ie2[1] - ie1[1]; 498 473 499 - /* zeroed SSID ie is another indication of a hidden bss */ 474 + /* 475 + * zeroed SSID ie is another indication of a hidden bss; 476 + * if it isn't zeroed just return the regular sort value 477 + * to find the next candidate 478 + */ 500 479 for (i = 0; i < ie2[1]; i++) 501 480 if (ie2[i + 2]) 502 - return -1; 481 + return memcmp(ie1 + 2, ie2 + 2, ie1[1]); 503 482 504 483 return 0; 505 484 } ··· 629 600 630 601 static struct cfg80211_internal_bss * 631 602 rb_find_hidden_bss(struct cfg80211_registered_device *dev, 632 - struct cfg80211_internal_bss *res) 603 + struct cfg80211_internal_bss *res) 633 604 { 634 605 struct rb_node *n = dev->bss_tree.rb_node; 635 606 struct cfg80211_internal_bss *bss; ··· 652 623 653 624 static void 654 625 copy_hidden_ies(struct cfg80211_internal_bss *res, 655 - struct cfg80211_internal_bss *hidden) 626 + struct cfg80211_internal_bss *hidden) 656 627 { 657 - if (unlikely(res->pub.beacon_ies)) 658 - return; 659 - if (WARN_ON(!hidden->pub.beacon_ies)) 628 + const struct cfg80211_bss_ies *ies; 629 + 630 + if (rcu_access_pointer(res->pub.beacon_ies)) 660 631 return; 661 632 662 - res->pub.beacon_ies = kmalloc(hidden->pub.len_beacon_ies, GFP_ATOMIC); 663 - if (unlikely(!res->pub.beacon_ies)) 633 + ies = rcu_access_pointer(hidden->pub.beacon_ies); 634 + if (WARN_ON(!ies)) 664 635 return; 665 636 666 - res->beacon_ies_allocated = true; 667 - res->pub.len_beacon_ies = hidden->pub.len_beacon_ies; 668 - memcpy(res->pub.beacon_ies, hidden->pub.beacon_ies, 669 - res->pub.len_beacon_ies); 637 + ies = kmemdup(ies, sizeof(*ies) + ies->len, GFP_ATOMIC); 638 + if (unlikely(!ies)) 639 + return; 640 + rcu_assign_pointer(res->pub.beacon_ies, ies); 670 641 } 671 642 672 643 static struct cfg80211_internal_bss * 673 644 cfg80211_bss_update(struct cfg80211_registered_device *dev, 674 - struct cfg80211_internal_bss *res) 645 + struct cfg80211_internal_bss *tmp) 675 646 { 676 647 struct cfg80211_internal_bss *found = NULL; 677 648 678 - /* 679 - * The reference to "res" is donated to this function. 680 - */ 681 - 682 - if (WARN_ON(!res->pub.channel)) { 683 - kref_put(&res->ref, bss_release); 649 + if (WARN_ON(!tmp->pub.channel)) 684 650 return NULL; 685 - } 686 651 687 - res->ts = jiffies; 652 + tmp->ts = jiffies; 688 653 689 654 spin_lock_bh(&dev->bss_lock); 690 655 691 - found = rb_find_bss(dev, res); 656 + if (WARN_ON(!rcu_access_pointer(tmp->pub.ies))) { 657 + spin_unlock_bh(&dev->bss_lock); 658 + return NULL; 659 + } 660 + 661 + found = rb_find_bss(dev, tmp); 692 662 693 663 if (found) { 694 - found->pub.beacon_interval = res->pub.beacon_interval; 695 - found->pub.tsf = res->pub.tsf; 696 - found->pub.signal = res->pub.signal; 697 - found->pub.capability = res->pub.capability; 698 - found->ts = res->ts; 664 + found->pub.beacon_interval = tmp->pub.beacon_interval; 665 + found->pub.tsf = tmp->pub.tsf; 666 + found->pub.signal = tmp->pub.signal; 667 + found->pub.capability = tmp->pub.capability; 668 + found->ts = tmp->ts; 699 669 700 670 /* Update IEs */ 701 - if (res->pub.proberesp_ies) { 702 - size_t used = dev->wiphy.bss_priv_size + sizeof(*res); 703 - size_t ielen = res->pub.len_proberesp_ies; 671 + if (rcu_access_pointer(tmp->pub.proberesp_ies)) { 672 + const struct cfg80211_bss_ies *old; 704 673 705 - if (found->pub.proberesp_ies && 706 - !found->proberesp_ies_allocated && 707 - ksize(found) >= used + ielen) { 708 - memcpy(found->pub.proberesp_ies, 709 - res->pub.proberesp_ies, ielen); 710 - found->pub.len_proberesp_ies = ielen; 711 - } else { 712 - u8 *ies = found->pub.proberesp_ies; 674 + old = rcu_access_pointer(found->pub.proberesp_ies); 713 675 714 - if (found->proberesp_ies_allocated) 715 - ies = krealloc(ies, ielen, GFP_ATOMIC); 716 - else 717 - ies = kmalloc(ielen, GFP_ATOMIC); 718 - 719 - if (ies) { 720 - memcpy(ies, res->pub.proberesp_ies, 721 - ielen); 722 - found->proberesp_ies_allocated = true; 723 - found->pub.proberesp_ies = ies; 724 - found->pub.len_proberesp_ies = ielen; 725 - } 726 - } 727 - 676 + rcu_assign_pointer(found->pub.proberesp_ies, 677 + tmp->pub.proberesp_ies); 728 678 /* Override possible earlier Beacon frame IEs */ 729 - found->pub.information_elements = 730 - found->pub.proberesp_ies; 731 - found->pub.len_information_elements = 732 - found->pub.len_proberesp_ies; 733 - } 734 - if (res->pub.beacon_ies) { 735 - size_t used = dev->wiphy.bss_priv_size + sizeof(*res); 736 - size_t ielen = res->pub.len_beacon_ies; 737 - bool information_elements_is_beacon_ies = 738 - (found->pub.information_elements == 739 - found->pub.beacon_ies); 679 + rcu_assign_pointer(found->pub.ies, 680 + tmp->pub.proberesp_ies); 681 + if (old) 682 + kfree_rcu((struct cfg80211_bss_ies *)old, 683 + rcu_head); 684 + } else if (rcu_access_pointer(tmp->pub.beacon_ies)) { 685 + const struct cfg80211_bss_ies *old, *ies; 740 686 741 - if (found->pub.beacon_ies && 742 - !found->beacon_ies_allocated && 743 - ksize(found) >= used + ielen) { 744 - memcpy(found->pub.beacon_ies, 745 - res->pub.beacon_ies, ielen); 746 - found->pub.len_beacon_ies = ielen; 747 - } else { 748 - u8 *ies = found->pub.beacon_ies; 687 + old = rcu_access_pointer(found->pub.beacon_ies); 688 + ies = rcu_access_pointer(found->pub.ies); 749 689 750 - if (found->beacon_ies_allocated) 751 - ies = krealloc(ies, ielen, GFP_ATOMIC); 752 - else 753 - ies = kmalloc(ielen, GFP_ATOMIC); 754 - 755 - if (ies) { 756 - memcpy(ies, res->pub.beacon_ies, 757 - ielen); 758 - found->beacon_ies_allocated = true; 759 - found->pub.beacon_ies = ies; 760 - found->pub.len_beacon_ies = ielen; 761 - } 762 - } 690 + rcu_assign_pointer(found->pub.beacon_ies, 691 + tmp->pub.beacon_ies); 763 692 764 693 /* Override IEs if they were from a beacon before */ 765 - if (information_elements_is_beacon_ies) { 766 - found->pub.information_elements = 767 - found->pub.beacon_ies; 768 - found->pub.len_information_elements = 769 - found->pub.len_beacon_ies; 770 - } 771 - } 694 + if (old == ies) 695 + rcu_assign_pointer(found->pub.ies, 696 + tmp->pub.beacon_ies); 772 697 773 - kref_put(&res->ref, bss_release); 698 + if (old) 699 + kfree_rcu((struct cfg80211_bss_ies *)old, 700 + rcu_head); 701 + } 774 702 } else { 703 + struct cfg80211_internal_bss *new; 775 704 struct cfg80211_internal_bss *hidden; 705 + struct cfg80211_bss_ies *ies; 776 706 777 707 /* First check if the beacon is a probe response from 778 708 * a hidden bss. If so, copy beacon ies (with nullified ··· 742 754 /* TODO: The code is not trying to update existing probe 743 755 * response bss entries when beacon ies are 744 756 * getting changed. */ 745 - hidden = rb_find_hidden_bss(dev, res); 757 + hidden = rb_find_hidden_bss(dev, tmp); 746 758 if (hidden) 747 - copy_hidden_ies(res, hidden); 759 + copy_hidden_ies(tmp, hidden); 748 760 749 - /* this "consumes" the reference */ 750 - list_add_tail(&res->list, &dev->bss_list); 751 - rb_insert_bss(dev, res); 752 - found = res; 761 + /* 762 + * create a copy -- the "res" variable that is passed in 763 + * is allocated on the stack since it's not needed in the 764 + * more common case of an update 765 + */ 766 + new = kzalloc(sizeof(*new) + dev->wiphy.bss_priv_size, 767 + GFP_ATOMIC); 768 + if (!new) { 769 + ies = (void *)rcu_dereference(tmp->pub.beacon_ies); 770 + if (ies) 771 + kfree_rcu(ies, rcu_head); 772 + ies = (void *)rcu_dereference(tmp->pub.proberesp_ies); 773 + if (ies) 774 + kfree_rcu(ies, rcu_head); 775 + spin_unlock_bh(&dev->bss_lock); 776 + return NULL; 777 + } 778 + memcpy(new, tmp, sizeof(*new)); 779 + kref_init(&new->ref); 780 + list_add_tail(&new->list, &dev->bss_list); 781 + rb_insert_bss(dev, new); 782 + found = new; 753 783 } 754 784 755 785 dev->bss_generation++; ··· 816 810 u16 beacon_interval, const u8 *ie, size_t ielen, 817 811 s32 signal, gfp_t gfp) 818 812 { 819 - struct cfg80211_internal_bss *res; 820 - size_t privsz; 813 + struct cfg80211_bss_ies *ies; 814 + struct cfg80211_internal_bss tmp = {}, *res; 821 815 822 816 if (WARN_ON(!wiphy)) 823 817 return NULL; 824 - 825 - privsz = wiphy->bss_priv_size; 826 818 827 819 if (WARN_ON(wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC && 828 820 (signal < 0 || signal > 100))) ··· 830 826 if (!channel) 831 827 return NULL; 832 828 833 - res = kzalloc(sizeof(*res) + privsz + ielen, gfp); 834 - if (!res) 835 - return NULL; 836 - 837 - memcpy(res->pub.bssid, bssid, ETH_ALEN); 838 - res->pub.channel = channel; 839 - res->pub.signal = signal; 840 - res->pub.tsf = tsf; 841 - res->pub.beacon_interval = beacon_interval; 842 - res->pub.capability = capability; 829 + memcpy(tmp.pub.bssid, bssid, ETH_ALEN); 830 + tmp.pub.channel = channel; 831 + tmp.pub.signal = signal; 832 + tmp.pub.tsf = tsf; 833 + tmp.pub.beacon_interval = beacon_interval; 834 + tmp.pub.capability = capability; 843 835 /* 844 836 * Since we do not know here whether the IEs are from a Beacon or Probe 845 837 * Response frame, we need to pick one of the options and only use it 846 838 * with the driver that does not provide the full Beacon/Probe Response 847 839 * frame. Use Beacon frame pointer to avoid indicating that this should 848 - * override the information_elements pointer should we have received an 849 - * earlier indication of Probe Response data. 840 + * override the iies pointer should we have received an earlier 841 + * indication of Probe Response data. 850 842 * 851 843 * The initial buffer for the IEs is allocated with the BSS entry and 852 844 * is located after the private area. 853 845 */ 854 - res->pub.beacon_ies = (u8 *)res + sizeof(*res) + privsz; 855 - memcpy(res->pub.beacon_ies, ie, ielen); 856 - res->pub.len_beacon_ies = ielen; 857 - res->pub.information_elements = res->pub.beacon_ies; 858 - res->pub.len_information_elements = res->pub.len_beacon_ies; 846 + ies = kmalloc(sizeof(*ies) + ielen, gfp); 847 + if (!ies) 848 + return NULL; 849 + ies->len = ielen; 850 + memcpy(ies->data, ie, ielen); 859 851 860 - kref_init(&res->ref); 852 + rcu_assign_pointer(tmp.pub.beacon_ies, ies); 853 + rcu_assign_pointer(tmp.pub.ies, ies); 861 854 862 - res = cfg80211_bss_update(wiphy_to_dev(wiphy), res); 855 + res = cfg80211_bss_update(wiphy_to_dev(wiphy), &tmp); 863 856 if (!res) 864 857 return NULL; 865 858 ··· 875 874 struct ieee80211_mgmt *mgmt, size_t len, 876 875 s32 signal, gfp_t gfp) 877 876 { 878 - struct cfg80211_internal_bss *res; 877 + struct cfg80211_internal_bss tmp = {}, *res; 878 + struct cfg80211_bss_ies *ies; 879 879 size_t ielen = len - offsetof(struct ieee80211_mgmt, 880 880 u.probe_resp.variable); 881 - size_t privsz; 882 881 883 882 BUILD_BUG_ON(offsetof(struct ieee80211_mgmt, u.probe_resp.variable) != 884 883 offsetof(struct ieee80211_mgmt, u.beacon.variable)); ··· 898 897 if (WARN_ON(len < offsetof(struct ieee80211_mgmt, u.probe_resp.variable))) 899 898 return NULL; 900 899 901 - privsz = wiphy->bss_priv_size; 902 - 903 900 channel = cfg80211_get_bss_channel(wiphy, mgmt->u.beacon.variable, 904 901 ielen, channel); 905 902 if (!channel) 906 903 return NULL; 907 904 908 - res = kzalloc(sizeof(*res) + privsz + ielen, gfp); 909 - if (!res) 905 + ies = kmalloc(sizeof(*ies) + ielen, gfp); 906 + if (!ies) 910 907 return NULL; 908 + ies->len = ielen; 909 + memcpy(ies->data, mgmt->u.probe_resp.variable, ielen); 911 910 912 - memcpy(res->pub.bssid, mgmt->bssid, ETH_ALEN); 913 - res->pub.channel = channel; 914 - res->pub.signal = signal; 915 - res->pub.tsf = le64_to_cpu(mgmt->u.probe_resp.timestamp); 916 - res->pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int); 917 - res->pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info); 918 - /* 919 - * The initial buffer for the IEs is allocated with the BSS entry and 920 - * is located after the private area. 921 - */ 922 - if (ieee80211_is_probe_resp(mgmt->frame_control)) { 923 - res->pub.proberesp_ies = (u8 *) res + sizeof(*res) + privsz; 924 - memcpy(res->pub.proberesp_ies, mgmt->u.probe_resp.variable, 925 - ielen); 926 - res->pub.len_proberesp_ies = ielen; 927 - res->pub.information_elements = res->pub.proberesp_ies; 928 - res->pub.len_information_elements = res->pub.len_proberesp_ies; 929 - } else { 930 - res->pub.beacon_ies = (u8 *) res + sizeof(*res) + privsz; 931 - memcpy(res->pub.beacon_ies, mgmt->u.beacon.variable, ielen); 932 - res->pub.len_beacon_ies = ielen; 933 - res->pub.information_elements = res->pub.beacon_ies; 934 - res->pub.len_information_elements = res->pub.len_beacon_ies; 935 - } 911 + if (ieee80211_is_probe_resp(mgmt->frame_control)) 912 + rcu_assign_pointer(tmp.pub.proberesp_ies, ies); 913 + else 914 + rcu_assign_pointer(tmp.pub.beacon_ies, ies); 915 + rcu_assign_pointer(tmp.pub.ies, ies); 916 + 917 + memcpy(tmp.pub.bssid, mgmt->bssid, ETH_ALEN); 918 + tmp.pub.channel = channel; 919 + tmp.pub.signal = signal; 920 + tmp.pub.tsf = le64_to_cpu(mgmt->u.probe_resp.timestamp); 921 + tmp.pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int); 922 + tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info); 936 923 937 - kref_init(&res->ref); 938 - 939 - res = cfg80211_bss_update(wiphy_to_dev(wiphy), res); 924 + res = cfg80211_bss_update(wiphy_to_dev(wiphy), &tmp); 940 925 if (!res) 941 926 return NULL; 942 927 ··· 1114 1127 EXPORT_SYMBOL_GPL(cfg80211_wext_siwscan); 1115 1128 1116 1129 static void ieee80211_scan_add_ies(struct iw_request_info *info, 1117 - struct cfg80211_bss *bss, 1130 + const struct cfg80211_bss_ies *ies, 1118 1131 char **current_ev, char *end_buf) 1119 1132 { 1120 - u8 *pos, *end, *next; 1133 + const u8 *pos, *end, *next; 1121 1134 struct iw_event iwe; 1122 1135 1123 - if (!bss->information_elements || 1124 - !bss->len_information_elements) 1136 + if (!ies) 1125 1137 return; 1126 1138 1127 1139 /* 1128 1140 * If needed, fragment the IEs buffer (at IE boundaries) into short 1129 1141 * enough fragments to fit into IW_GENERIC_IE_MAX octet messages. 1130 1142 */ 1131 - pos = bss->information_elements; 1132 - end = pos + bss->len_information_elements; 1143 + pos = ies->data; 1144 + end = pos + ies->len; 1133 1145 1134 1146 while (end - pos > IW_GENERIC_IE_MAX) { 1135 1147 next = pos + 2 + pos[1]; ··· 1139 1153 iwe.cmd = IWEVGENIE; 1140 1154 iwe.u.data.length = next - pos; 1141 1155 *current_ev = iwe_stream_add_point(info, *current_ev, 1142 - end_buf, &iwe, pos); 1156 + end_buf, &iwe, 1157 + (void *)pos); 1143 1158 1144 1159 pos = next; 1145 1160 } ··· 1150 1163 iwe.cmd = IWEVGENIE; 1151 1164 iwe.u.data.length = end - pos; 1152 1165 *current_ev = iwe_stream_add_point(info, *current_ev, 1153 - end_buf, &iwe, pos); 1166 + end_buf, &iwe, 1167 + (void *)pos); 1154 1168 } 1155 1169 } 1156 1170 ··· 1170 1182 struct cfg80211_internal_bss *bss, char *current_ev, 1171 1183 char *end_buf) 1172 1184 { 1185 + const struct cfg80211_bss_ies *ies; 1173 1186 struct iw_event iwe; 1187 + const u8 *ie; 1174 1188 u8 *buf, *cfg, *p; 1175 - u8 *ie = bss->pub.information_elements; 1176 - int rem = bss->pub.len_information_elements, i, sig; 1189 + int rem, i, sig; 1177 1190 bool ismesh = false; 1178 1191 1179 1192 memset(&iwe, 0, sizeof(iwe)); ··· 1239 1250 current_ev = iwe_stream_add_point(info, current_ev, end_buf, 1240 1251 &iwe, ""); 1241 1252 1242 - while (rem >= 2) { 1253 + rcu_read_lock(); 1254 + ies = rcu_dereference(bss->pub.ies); 1255 + if (ies) { 1256 + rem = ies->len; 1257 + ie = ies->data; 1258 + } else { 1259 + rem = 0; 1260 + ie = NULL; 1261 + } 1262 + 1263 + while (ies && rem >= 2) { 1243 1264 /* invalid data */ 1244 1265 if (ie[1] > rem - 2) 1245 1266 break; ··· 1261 1262 iwe.u.data.length = ie[1]; 1262 1263 iwe.u.data.flags = 1; 1263 1264 current_ev = iwe_stream_add_point(info, current_ev, end_buf, 1264 - &iwe, ie + 2); 1265 + &iwe, (u8 *)ie + 2); 1265 1266 break; 1266 1267 case WLAN_EID_MESH_ID: 1267 1268 memset(&iwe, 0, sizeof(iwe)); ··· 1269 1270 iwe.u.data.length = ie[1]; 1270 1271 iwe.u.data.flags = 1; 1271 1272 current_ev = iwe_stream_add_point(info, current_ev, end_buf, 1272 - &iwe, ie + 2); 1273 + &iwe, (u8 *)ie + 2); 1273 1274 break; 1274 1275 case WLAN_EID_MESH_CONFIG: 1275 1276 ismesh = true; ··· 1278 1279 buf = kmalloc(50, GFP_ATOMIC); 1279 1280 if (!buf) 1280 1281 break; 1281 - cfg = ie + 2; 1282 + cfg = (u8 *)ie + 2; 1282 1283 memset(&iwe, 0, sizeof(iwe)); 1283 1284 iwe.cmd = IWEVCUSTOM; 1284 1285 sprintf(buf, "Mesh Network Path Selection Protocol ID: " ··· 1376 1377 kfree(buf); 1377 1378 } 1378 1379 1379 - ieee80211_scan_add_ies(info, &bss->pub, &current_ev, end_buf); 1380 + ieee80211_scan_add_ies(info, ies, &current_ev, end_buf); 1381 + rcu_read_unlock(); 1380 1382 1381 1383 return current_ev; 1382 1384 }
+11 -2
net/wireless/sme.c
··· 417 417 struct cfg80211_bss *bss) 418 418 { 419 419 struct wireless_dev *wdev = dev->ieee80211_ptr; 420 - u8 *country_ie; 420 + const u8 *country_ie; 421 421 #ifdef CONFIG_CFG80211_WEXT 422 422 union iwreq_data wrqu; 423 423 #endif ··· 501 501 wdev->sme_state = CFG80211_SME_CONNECTED; 502 502 cfg80211_upload_connect_keys(wdev); 503 503 504 - country_ie = (u8 *) ieee80211_bss_get_ie(bss, WLAN_EID_COUNTRY); 504 + rcu_read_lock(); 505 + country_ie = ieee80211_bss_get_ie(bss, WLAN_EID_COUNTRY); 506 + if (!country_ie) { 507 + rcu_read_unlock(); 508 + return; 509 + } 510 + 511 + country_ie = kmemdup(country_ie, 2 + country_ie[1], GFP_ATOMIC); 512 + rcu_read_unlock(); 505 513 506 514 if (!country_ie) 507 515 return; ··· 523 515 bss->channel->band, 524 516 country_ie + 2, 525 517 country_ie[1]); 518 + kfree(country_ie); 526 519 } 527 520 528 521 void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
+6 -3
net/wireless/util.c
··· 688 688 689 689 const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie) 690 690 { 691 - if (bss->information_elements == NULL) 691 + const struct cfg80211_bss_ies *ies; 692 + 693 + ies = rcu_dereference(bss->ies); 694 + if (!ies) 692 695 return NULL; 693 - return cfg80211_find_ie(ie, bss->information_elements, 694 - bss->len_information_elements); 696 + 697 + return cfg80211_find_ie(ie, ies->data, ies->len); 695 698 } 696 699 EXPORT_SYMBOL(ieee80211_bss_get_ie); 697 700
+6 -2
net/wireless/wext-sme.c
··· 242 242 243 243 wdev_lock(wdev); 244 244 if (wdev->current_bss) { 245 - const u8 *ie = ieee80211_bss_get_ie(&wdev->current_bss->pub, 246 - WLAN_EID_SSID); 245 + const u8 *ie; 246 + 247 + rcu_read_lock(); 248 + ie = ieee80211_bss_get_ie(&wdev->current_bss->pub, 249 + WLAN_EID_SSID); 247 250 if (ie) { 248 251 data->flags = 1; 249 252 data->length = ie[1]; 250 253 memcpy(ssid, ie + 2, data->length); 251 254 } 255 + rcu_read_unlock(); 252 256 } else if (wdev->wext.connect.ssid && wdev->wext.connect.ssid_len) { 253 257 data->flags = 1; 254 258 data->length = wdev->wext.connect.ssid_len;