diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-12 17:27:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-12 17:27:40 -0400 |
commit | f9da455b93f6ba076935b4ef4589f61e529ae046 (patch) | |
tree | 3c4e69ce1ba1d6bf65915b97a76ca2172105b278 /drivers/net/wireless | |
parent | 0e04c641b199435f3779454055f6a7de258ecdfc (diff) | |
parent | e5eca6d41f53db48edd8cf88a3f59d2c30227f8e (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller:
1) Seccomp BPF filters can now be JIT'd, from Alexei Starovoitov.
2) Multiqueue support in xen-netback and xen-netfront, from Andrew J
Benniston.
3) Allow tweaking of aggregation settings in cdc_ncm driver, from Bjørn
Mork.
4) BPF now has a "random" opcode, from Chema Gonzalez.
5) Add more BPF documentation and improve test framework, from Daniel
Borkmann.
6) Support TCP fastopen over ipv6, from Daniel Lee.
7) Add software TSO helper functions and use them to support software
TSO in mvneta and mv643xx_eth drivers. From Ezequiel Garcia.
8) Support software TSO in fec driver too, from Nimrod Andy.
9) Add Broadcom SYSTEMPORT driver, from Florian Fainelli.
10) Handle broadcasts more gracefully over macvlan when there are large
numbers of interfaces configured, from Herbert Xu.
11) Allow more control over fwmark used for non-socket based responses,
from Lorenzo Colitti.
12) Do TCP congestion window limiting based upon measurements, from Neal
Cardwell.
13) Support busy polling in SCTP, from Neal Horman.
14) Allow RSS key to be configured via ethtool, from Venkata Duvvuru.
15) Bridge promisc mode handling improvements from Vlad Yasevich.
16) Don't use inetpeer entries to implement ID generation any more, it
performs poorly, from Eric Dumazet.
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1522 commits)
rtnetlink: fix userspace API breakage for iproute2 < v3.9.0
tcp: fixing TLP's FIN recovery
net: fec: Add software TSO support
net: fec: Add Scatter/gather support
net: fec: Increase buffer descriptor entry number
net: fec: Factorize feature setting
net: fec: Enable IP header hardware checksum
net: fec: Factorize the .xmit transmit function
bridge: fix compile error when compiling without IPv6 support
bridge: fix smatch warning / potential null pointer dereference
via-rhine: fix full-duplex with autoneg disable
bnx2x: Enlarge the dorq threshold for VFs
bnx2x: Check for UNDI in uncommon branch
bnx2x: Fix 1G-baseT link
bnx2x: Fix link for KR with swapped polarity lane
sctp: Fix sk_ack_backlog wrap-around problem
net/core: Add VF link state control policy
net/fsl: xgmac_mdio is dependent on OF_MDIO
net/fsl: Make xgmac_mdio read error message useful
net_sched: drr: warn when qdisc is not work conserving
...
Diffstat (limited to 'drivers/net/wireless')
282 files changed, 8669 insertions, 5481 deletions
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c index 99b3bfa717d5..d48776e4f343 100644 --- a/drivers/net/wireless/at76c50x-usb.c +++ b/drivers/net/wireless/at76c50x-usb.c | |||
@@ -365,15 +365,15 @@ static inline unsigned long at76_get_timeout(struct dfu_status *s) | |||
365 | static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size, | 365 | static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size, |
366 | int manifest_sync_timeout) | 366 | int manifest_sync_timeout) |
367 | { | 367 | { |
368 | u8 *block; | ||
369 | struct dfu_status dfu_stat_buf; | ||
370 | int ret = 0; | 368 | int ret = 0; |
371 | int need_dfu_state = 1; | 369 | int need_dfu_state = 1; |
372 | int is_done = 0; | 370 | int is_done = 0; |
373 | u8 dfu_state = 0; | ||
374 | u32 dfu_timeout = 0; | 371 | u32 dfu_timeout = 0; |
375 | int bsize = 0; | 372 | int bsize = 0; |
376 | int blockno = 0; | 373 | int blockno = 0; |
374 | struct dfu_status *dfu_stat_buf = NULL; | ||
375 | u8 *dfu_state = NULL; | ||
376 | u8 *block = NULL; | ||
377 | 377 | ||
378 | at76_dbg(DBG_DFU, "%s( %p, %u, %d)", __func__, buf, size, | 378 | at76_dbg(DBG_DFU, "%s( %p, %u, %d)", __func__, buf, size, |
379 | manifest_sync_timeout); | 379 | manifest_sync_timeout); |
@@ -383,13 +383,28 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size, | |||
383 | return -EINVAL; | 383 | return -EINVAL; |
384 | } | 384 | } |
385 | 385 | ||
386 | dfu_stat_buf = kmalloc(sizeof(struct dfu_status), GFP_KERNEL); | ||
387 | if (!dfu_stat_buf) { | ||
388 | ret = -ENOMEM; | ||
389 | goto exit; | ||
390 | } | ||
391 | |||
386 | block = kmalloc(FW_BLOCK_SIZE, GFP_KERNEL); | 392 | block = kmalloc(FW_BLOCK_SIZE, GFP_KERNEL); |
387 | if (!block) | 393 | if (!block) { |
388 | return -ENOMEM; | 394 | ret = -ENOMEM; |
395 | goto exit; | ||
396 | } | ||
397 | |||
398 | dfu_state = kmalloc(sizeof(u8), GFP_KERNEL); | ||
399 | if (!dfu_state) { | ||
400 | ret = -ENOMEM; | ||
401 | goto exit; | ||
402 | } | ||
403 | *dfu_state = 0; | ||
389 | 404 | ||
390 | do { | 405 | do { |
391 | if (need_dfu_state) { | 406 | if (need_dfu_state) { |
392 | ret = at76_dfu_get_state(udev, &dfu_state); | 407 | ret = at76_dfu_get_state(udev, dfu_state); |
393 | if (ret < 0) { | 408 | if (ret < 0) { |
394 | dev_err(&udev->dev, | 409 | dev_err(&udev->dev, |
395 | "cannot get DFU state: %d\n", ret); | 410 | "cannot get DFU state: %d\n", ret); |
@@ -398,13 +413,13 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size, | |||
398 | need_dfu_state = 0; | 413 | need_dfu_state = 0; |
399 | } | 414 | } |
400 | 415 | ||
401 | switch (dfu_state) { | 416 | switch (*dfu_state) { |
402 | case STATE_DFU_DOWNLOAD_SYNC: | 417 | case STATE_DFU_DOWNLOAD_SYNC: |
403 | at76_dbg(DBG_DFU, "STATE_DFU_DOWNLOAD_SYNC"); | 418 | at76_dbg(DBG_DFU, "STATE_DFU_DOWNLOAD_SYNC"); |
404 | ret = at76_dfu_get_status(udev, &dfu_stat_buf); | 419 | ret = at76_dfu_get_status(udev, dfu_stat_buf); |
405 | if (ret >= 0) { | 420 | if (ret >= 0) { |
406 | dfu_state = dfu_stat_buf.state; | 421 | *dfu_state = dfu_stat_buf->state; |
407 | dfu_timeout = at76_get_timeout(&dfu_stat_buf); | 422 | dfu_timeout = at76_get_timeout(dfu_stat_buf); |
408 | need_dfu_state = 0; | 423 | need_dfu_state = 0; |
409 | } else | 424 | } else |
410 | dev_err(&udev->dev, | 425 | dev_err(&udev->dev, |
@@ -447,12 +462,12 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size, | |||
447 | case STATE_DFU_MANIFEST_SYNC: | 462 | case STATE_DFU_MANIFEST_SYNC: |
448 | at76_dbg(DBG_DFU, "STATE_DFU_MANIFEST_SYNC"); | 463 | at76_dbg(DBG_DFU, "STATE_DFU_MANIFEST_SYNC"); |
449 | 464 | ||
450 | ret = at76_dfu_get_status(udev, &dfu_stat_buf); | 465 | ret = at76_dfu_get_status(udev, dfu_stat_buf); |
451 | if (ret < 0) | 466 | if (ret < 0) |
452 | break; | 467 | break; |
453 | 468 | ||
454 | dfu_state = dfu_stat_buf.state; | 469 | *dfu_state = dfu_stat_buf->state; |
455 | dfu_timeout = at76_get_timeout(&dfu_stat_buf); | 470 | dfu_timeout = at76_get_timeout(dfu_stat_buf); |
456 | need_dfu_state = 0; | 471 | need_dfu_state = 0; |
457 | 472 | ||
458 | /* override the timeout from the status response, | 473 | /* override the timeout from the status response, |
@@ -484,14 +499,17 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size, | |||
484 | break; | 499 | break; |
485 | 500 | ||
486 | default: | 501 | default: |
487 | at76_dbg(DBG_DFU, "DFU UNKNOWN STATE (%d)", dfu_state); | 502 | at76_dbg(DBG_DFU, "DFU UNKNOWN STATE (%d)", *dfu_state); |
488 | ret = -EINVAL; | 503 | ret = -EINVAL; |
489 | break; | 504 | break; |
490 | } | 505 | } |
491 | } while (!is_done && (ret >= 0)); | 506 | } while (!is_done && (ret >= 0)); |
492 | 507 | ||
493 | exit: | 508 | exit: |
509 | kfree(dfu_state); | ||
494 | kfree(block); | 510 | kfree(block); |
511 | kfree(dfu_stat_buf); | ||
512 | |||
495 | if (ret >= 0) | 513 | if (ret >= 0) |
496 | ret = 0; | 514 | ret = 0; |
497 | 515 | ||
@@ -1277,6 +1295,7 @@ static int at76_load_external_fw(struct usb_device *udev, struct fwentry *fwe) | |||
1277 | dev_err(&udev->dev, | 1295 | dev_err(&udev->dev, |
1278 | "loading %dth firmware block failed: %d\n", | 1296 | "loading %dth firmware block failed: %d\n", |
1279 | blockno, ret); | 1297 | blockno, ret); |
1298 | ret = -EIO; | ||
1280 | goto exit; | 1299 | goto exit; |
1281 | } | 1300 | } |
1282 | buf += bsize; | 1301 | buf += bsize; |
@@ -1410,6 +1429,8 @@ static int at76_startup_device(struct at76_priv *priv) | |||
1410 | /* remove BSSID from previous run */ | 1429 | /* remove BSSID from previous run */ |
1411 | memset(priv->bssid, 0, ETH_ALEN); | 1430 | memset(priv->bssid, 0, ETH_ALEN); |
1412 | 1431 | ||
1432 | priv->scanning = false; | ||
1433 | |||
1413 | if (at76_set_radio(priv, 1) == 1) | 1434 | if (at76_set_radio(priv, 1) == 1) |
1414 | at76_wait_completion(priv, CMD_RADIO_ON); | 1435 | at76_wait_completion(priv, CMD_RADIO_ON); |
1415 | 1436 | ||
@@ -1483,6 +1504,52 @@ static void at76_work_submit_rx(struct work_struct *work) | |||
1483 | mutex_unlock(&priv->mtx); | 1504 | mutex_unlock(&priv->mtx); |
1484 | } | 1505 | } |
1485 | 1506 | ||
1507 | /* This is a workaround to make scan working: | ||
1508 | * currently mac80211 does not process frames with no frequency | ||
1509 | * information. | ||
1510 | * However during scan the HW performs a sweep by itself, and we | ||
1511 | * are unable to know where the radio is actually tuned. | ||
1512 | * This function tries to do its best to guess this information.. | ||
1513 | * During scan, If the current frame is a beacon or a probe response, | ||
1514 | * the channel information is extracted from it. | ||
1515 | * When not scanning, for other frames, or if it happens that for | ||
1516 | * whatever reason we fail to parse beacons and probe responses, this | ||
1517 | * function returns the priv->channel information, that should be correct | ||
1518 | * at least when we are not scanning. | ||
1519 | */ | ||
1520 | static inline int at76_guess_freq(struct at76_priv *priv) | ||
1521 | { | ||
1522 | size_t el_off; | ||
1523 | const u8 *el; | ||
1524 | int channel = priv->channel; | ||
1525 | int len = priv->rx_skb->len; | ||
1526 | struct ieee80211_hdr *hdr = (void *)priv->rx_skb->data; | ||
1527 | |||
1528 | if (!priv->scanning) | ||
1529 | goto exit; | ||
1530 | |||
1531 | if (len < 24) | ||
1532 | goto exit; | ||
1533 | |||
1534 | if (ieee80211_is_probe_resp(hdr->frame_control)) { | ||
1535 | el_off = offsetof(struct ieee80211_mgmt, u.probe_resp.variable); | ||
1536 | el = ((struct ieee80211_mgmt *)hdr)->u.probe_resp.variable; | ||
1537 | } else if (ieee80211_is_beacon(hdr->frame_control)) { | ||
1538 | el_off = offsetof(struct ieee80211_mgmt, u.beacon.variable); | ||
1539 | el = ((struct ieee80211_mgmt *)hdr)->u.beacon.variable; | ||
1540 | } else { | ||
1541 | goto exit; | ||
1542 | } | ||
1543 | len -= el_off; | ||
1544 | |||
1545 | el = cfg80211_find_ie(WLAN_EID_DS_PARAMS, el, len); | ||
1546 | if (el && el[1] > 0) | ||
1547 | channel = el[2]; | ||
1548 | |||
1549 | exit: | ||
1550 | return ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); | ||
1551 | } | ||
1552 | |||
1486 | static void at76_rx_tasklet(unsigned long param) | 1553 | static void at76_rx_tasklet(unsigned long param) |
1487 | { | 1554 | { |
1488 | struct urb *urb = (struct urb *)param; | 1555 | struct urb *urb = (struct urb *)param; |
@@ -1523,6 +1590,8 @@ static void at76_rx_tasklet(unsigned long param) | |||
1523 | rx_status.signal = buf->rssi; | 1590 | rx_status.signal = buf->rssi; |
1524 | rx_status.flag |= RX_FLAG_DECRYPTED; | 1591 | rx_status.flag |= RX_FLAG_DECRYPTED; |
1525 | rx_status.flag |= RX_FLAG_IV_STRIPPED; | 1592 | rx_status.flag |= RX_FLAG_IV_STRIPPED; |
1593 | rx_status.band = IEEE80211_BAND_2GHZ; | ||
1594 | rx_status.freq = at76_guess_freq(priv); | ||
1526 | 1595 | ||
1527 | at76_dbg(DBG_MAC80211, "calling ieee80211_rx_irqsafe(): %d/%d", | 1596 | at76_dbg(DBG_MAC80211, "calling ieee80211_rx_irqsafe(): %d/%d", |
1528 | priv->rx_skb->len, priv->rx_skb->data_len); | 1597 | priv->rx_skb->len, priv->rx_skb->data_len); |
@@ -1875,6 +1944,8 @@ static void at76_dwork_hw_scan(struct work_struct *work) | |||
1875 | if (is_valid_ether_addr(priv->bssid)) | 1944 | if (is_valid_ether_addr(priv->bssid)) |
1876 | at76_join(priv); | 1945 | at76_join(priv); |
1877 | 1946 | ||
1947 | priv->scanning = false; | ||
1948 | |||
1878 | mutex_unlock(&priv->mtx); | 1949 | mutex_unlock(&priv->mtx); |
1879 | 1950 | ||
1880 | ieee80211_scan_completed(priv->hw, false); | 1951 | ieee80211_scan_completed(priv->hw, false); |
@@ -1929,6 +2000,7 @@ static int at76_hw_scan(struct ieee80211_hw *hw, | |||
1929 | goto exit; | 2000 | goto exit; |
1930 | } | 2001 | } |
1931 | 2002 | ||
2003 | priv->scanning = true; | ||
1932 | ieee80211_queue_delayed_work(priv->hw, &priv->dwork_hw_scan, | 2004 | ieee80211_queue_delayed_work(priv->hw, &priv->dwork_hw_scan, |
1933 | SCAN_POLL_INTERVAL); | 2005 | SCAN_POLL_INTERVAL); |
1934 | 2006 | ||
@@ -2020,6 +2092,44 @@ static void at76_configure_filter(struct ieee80211_hw *hw, | |||
2020 | ieee80211_queue_work(hw, &priv->work_set_promisc); | 2092 | ieee80211_queue_work(hw, &priv->work_set_promisc); |
2021 | } | 2093 | } |
2022 | 2094 | ||
2095 | static int at76_set_wep(struct at76_priv *priv) | ||
2096 | { | ||
2097 | int ret = 0; | ||
2098 | struct mib_mac_wep *mib_data = &priv->mib_buf.data.wep_mib; | ||
2099 | |||
2100 | priv->mib_buf.type = MIB_MAC_WEP; | ||
2101 | priv->mib_buf.size = sizeof(struct mib_mac_wep); | ||
2102 | priv->mib_buf.index = 0; | ||
2103 | |||
2104 | memset(mib_data, 0, sizeof(*mib_data)); | ||
2105 | |||
2106 | if (priv->wep_enabled) { | ||
2107 | if (priv->wep_keys_len[priv->wep_key_id] > WEP_SMALL_KEY_LEN) | ||
2108 | mib_data->encryption_level = 2; | ||
2109 | else | ||
2110 | mib_data->encryption_level = 1; | ||
2111 | |||
2112 | /* always exclude unencrypted if WEP is active */ | ||
2113 | mib_data->exclude_unencrypted = 1; | ||
2114 | } else { | ||
2115 | mib_data->exclude_unencrypted = 0; | ||
2116 | mib_data->encryption_level = 0; | ||
2117 | } | ||
2118 | |||
2119 | mib_data->privacy_invoked = priv->wep_enabled; | ||
2120 | mib_data->wep_default_key_id = priv->wep_key_id; | ||
2121 | memcpy(mib_data->wep_default_keyvalue, priv->wep_keys, | ||
2122 | sizeof(priv->wep_keys)); | ||
2123 | |||
2124 | ret = at76_set_mib(priv, &priv->mib_buf); | ||
2125 | |||
2126 | if (ret < 0) | ||
2127 | wiphy_err(priv->hw->wiphy, | ||
2128 | "set_mib (wep) failed: %d\n", ret); | ||
2129 | |||
2130 | return ret; | ||
2131 | } | ||
2132 | |||
2023 | static int at76_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 2133 | static int at76_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
2024 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, | 2134 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, |
2025 | struct ieee80211_key_conf *key) | 2135 | struct ieee80211_key_conf *key) |
@@ -2062,7 +2172,7 @@ static int at76_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2062 | priv->wep_enabled = 1; | 2172 | priv->wep_enabled = 1; |
2063 | } | 2173 | } |
2064 | 2174 | ||
2065 | at76_startup_device(priv); | 2175 | at76_set_wep(priv); |
2066 | 2176 | ||
2067 | mutex_unlock(&priv->mtx); | 2177 | mutex_unlock(&priv->mtx); |
2068 | 2178 | ||
@@ -2330,16 +2440,22 @@ static int at76_probe(struct usb_interface *interface, | |||
2330 | struct usb_device *udev; | 2440 | struct usb_device *udev; |
2331 | int op_mode; | 2441 | int op_mode; |
2332 | int need_ext_fw = 0; | 2442 | int need_ext_fw = 0; |
2333 | struct mib_fw_version fwv; | 2443 | struct mib_fw_version *fwv = NULL; |
2334 | int board_type = (int)id->driver_info; | 2444 | int board_type = (int)id->driver_info; |
2335 | 2445 | ||
2336 | udev = usb_get_dev(interface_to_usbdev(interface)); | 2446 | udev = usb_get_dev(interface_to_usbdev(interface)); |
2337 | 2447 | ||
2448 | fwv = kmalloc(sizeof(*fwv), GFP_KERNEL); | ||
2449 | if (!fwv) { | ||
2450 | ret = -ENOMEM; | ||
2451 | goto exit; | ||
2452 | } | ||
2453 | |||
2338 | /* Load firmware into kernel memory */ | 2454 | /* Load firmware into kernel memory */ |
2339 | fwe = at76_load_firmware(udev, board_type); | 2455 | fwe = at76_load_firmware(udev, board_type); |
2340 | if (!fwe) { | 2456 | if (!fwe) { |
2341 | ret = -ENOENT; | 2457 | ret = -ENOENT; |
2342 | goto error; | 2458 | goto exit; |
2343 | } | 2459 | } |
2344 | 2460 | ||
2345 | op_mode = at76_get_op_mode(udev); | 2461 | op_mode = at76_get_op_mode(udev); |
@@ -2353,7 +2469,7 @@ static int at76_probe(struct usb_interface *interface, | |||
2353 | dev_err(&interface->dev, | 2469 | dev_err(&interface->dev, |
2354 | "cannot handle a device in HW_CONFIG_MODE\n"); | 2470 | "cannot handle a device in HW_CONFIG_MODE\n"); |
2355 | ret = -EBUSY; | 2471 | ret = -EBUSY; |
2356 | goto error; | 2472 | goto exit; |
2357 | } | 2473 | } |
2358 | 2474 | ||
2359 | if (op_mode != OPMODE_NORMAL_NIC_WITH_FLASH | 2475 | if (op_mode != OPMODE_NORMAL_NIC_WITH_FLASH |
@@ -2366,10 +2482,10 @@ static int at76_probe(struct usb_interface *interface, | |||
2366 | dev_err(&interface->dev, | 2482 | dev_err(&interface->dev, |
2367 | "error %d downloading internal firmware\n", | 2483 | "error %d downloading internal firmware\n", |
2368 | ret); | 2484 | ret); |
2369 | goto error; | 2485 | goto exit; |
2370 | } | 2486 | } |
2371 | usb_put_dev(udev); | 2487 | usb_put_dev(udev); |
2372 | return ret; | 2488 | goto exit; |
2373 | } | 2489 | } |
2374 | 2490 | ||
2375 | /* Internal firmware already inside the device. Get firmware | 2491 | /* Internal firmware already inside the device. Get firmware |
@@ -2382,8 +2498,8 @@ static int at76_probe(struct usb_interface *interface, | |||
2382 | * query the device for the fw version */ | 2498 | * query the device for the fw version */ |
2383 | if ((fwe->fw_version.major > 0 || fwe->fw_version.minor >= 100) | 2499 | if ((fwe->fw_version.major > 0 || fwe->fw_version.minor >= 100) |
2384 | || (op_mode == OPMODE_NORMAL_NIC_WITH_FLASH)) { | 2500 | || (op_mode == OPMODE_NORMAL_NIC_WITH_FLASH)) { |
2385 | ret = at76_get_mib(udev, MIB_FW_VERSION, &fwv, sizeof(fwv)); | 2501 | ret = at76_get_mib(udev, MIB_FW_VERSION, fwv, sizeof(*fwv)); |
2386 | if (ret < 0 || (fwv.major | fwv.minor) == 0) | 2502 | if (ret < 0 || (fwv->major | fwv->minor) == 0) |
2387 | need_ext_fw = 1; | 2503 | need_ext_fw = 1; |
2388 | } else | 2504 | } else |
2389 | /* No way to check firmware version, reload to be sure */ | 2505 | /* No way to check firmware version, reload to be sure */ |
@@ -2394,37 +2510,37 @@ static int at76_probe(struct usb_interface *interface, | |||
2394 | "downloading external firmware\n"); | 2510 | "downloading external firmware\n"); |
2395 | 2511 | ||
2396 | ret = at76_load_external_fw(udev, fwe); | 2512 | ret = at76_load_external_fw(udev, fwe); |
2397 | if (ret) | 2513 | if (ret < 0) |
2398 | goto error; | 2514 | goto exit; |
2399 | 2515 | ||
2400 | /* Re-check firmware version */ | 2516 | /* Re-check firmware version */ |
2401 | ret = at76_get_mib(udev, MIB_FW_VERSION, &fwv, sizeof(fwv)); | 2517 | ret = at76_get_mib(udev, MIB_FW_VERSION, fwv, sizeof(*fwv)); |
2402 | if (ret < 0) { | 2518 | if (ret < 0) { |
2403 | dev_err(&interface->dev, | 2519 | dev_err(&interface->dev, |
2404 | "error %d getting firmware version\n", ret); | 2520 | "error %d getting firmware version\n", ret); |
2405 | goto error; | 2521 | goto exit; |
2406 | } | 2522 | } |
2407 | } | 2523 | } |
2408 | 2524 | ||
2409 | priv = at76_alloc_new_device(udev); | 2525 | priv = at76_alloc_new_device(udev); |
2410 | if (!priv) { | 2526 | if (!priv) { |
2411 | ret = -ENOMEM; | 2527 | ret = -ENOMEM; |
2412 | goto error; | 2528 | goto exit; |
2413 | } | 2529 | } |
2414 | 2530 | ||
2415 | usb_set_intfdata(interface, priv); | 2531 | usb_set_intfdata(interface, priv); |
2416 | 2532 | ||
2417 | memcpy(&priv->fw_version, &fwv, sizeof(struct mib_fw_version)); | 2533 | memcpy(&priv->fw_version, fwv, sizeof(struct mib_fw_version)); |
2418 | priv->board_type = board_type; | 2534 | priv->board_type = board_type; |
2419 | 2535 | ||
2420 | ret = at76_init_new_device(priv, interface); | 2536 | ret = at76_init_new_device(priv, interface); |
2421 | if (ret < 0) | 2537 | if (ret < 0) |
2422 | at76_delete_device(priv); | 2538 | at76_delete_device(priv); |
2423 | 2539 | ||
2424 | return ret; | 2540 | exit: |
2425 | 2541 | kfree(fwv); | |
2426 | error: | 2542 | if (ret < 0) |
2427 | usb_put_dev(udev); | 2543 | usb_put_dev(udev); |
2428 | return ret; | 2544 | return ret; |
2429 | } | 2545 | } |
2430 | 2546 | ||
diff --git a/drivers/net/wireless/at76c50x-usb.h b/drivers/net/wireless/at76c50x-usb.h index f14a65473fe8..55090a38ac95 100644 --- a/drivers/net/wireless/at76c50x-usb.h +++ b/drivers/net/wireless/at76c50x-usb.h | |||
@@ -219,18 +219,6 @@ struct at76_req_join { | |||
219 | u8 reserved; | 219 | u8 reserved; |
220 | } __packed; | 220 | } __packed; |
221 | 221 | ||
222 | struct set_mib_buffer { | ||
223 | u8 type; | ||
224 | u8 size; | ||
225 | u8 index; | ||
226 | u8 reserved; | ||
227 | union { | ||
228 | u8 byte; | ||
229 | __le16 word; | ||
230 | u8 addr[ETH_ALEN]; | ||
231 | } data; | ||
232 | } __packed; | ||
233 | |||
234 | struct mib_local { | 222 | struct mib_local { |
235 | u16 reserved0; | 223 | u16 reserved0; |
236 | u8 beacon_enable; | 224 | u8 beacon_enable; |
@@ -334,6 +322,19 @@ struct mib_mdomain { | |||
334 | u8 channel_list[14]; /* 0 for invalid channels */ | 322 | u8 channel_list[14]; /* 0 for invalid channels */ |
335 | } __packed; | 323 | } __packed; |
336 | 324 | ||
325 | struct set_mib_buffer { | ||
326 | u8 type; | ||
327 | u8 size; | ||
328 | u8 index; | ||
329 | u8 reserved; | ||
330 | union { | ||
331 | u8 byte; | ||
332 | __le16 word; | ||
333 | u8 addr[ETH_ALEN]; | ||
334 | struct mib_mac_wep wep_mib; | ||
335 | } data; | ||
336 | } __packed; | ||
337 | |||
337 | struct at76_fw_header { | 338 | struct at76_fw_header { |
338 | __le32 crc; /* CRC32 of the whole image */ | 339 | __le32 crc; /* CRC32 of the whole image */ |
339 | __le32 board_type; /* firmware compatibility code */ | 340 | __le32 board_type; /* firmware compatibility code */ |
@@ -417,6 +418,7 @@ struct at76_priv { | |||
417 | int scan_max_time; /* scan max channel time */ | 418 | int scan_max_time; /* scan max channel time */ |
418 | int scan_mode; /* SCAN_TYPE_ACTIVE, SCAN_TYPE_PASSIVE */ | 419 | int scan_mode; /* SCAN_TYPE_ACTIVE, SCAN_TYPE_PASSIVE */ |
419 | int scan_need_any; /* if set, need to scan for any ESSID */ | 420 | int scan_need_any; /* if set, need to scan for any ESSID */ |
421 | bool scanning; /* if set, the scan is running */ | ||
420 | 422 | ||
421 | u16 assoc_id; /* current association ID, if associated */ | 423 | u16 assoc_id; /* current association ID, if associated */ |
422 | 424 | ||
diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c index 507d9a9ee69a..f92050617ae6 100644 --- a/drivers/net/wireless/ath/ar5523/ar5523.c +++ b/drivers/net/wireless/ath/ar5523/ar5523.c | |||
@@ -1090,7 +1090,8 @@ static int ar5523_set_rts_threshold(struct ieee80211_hw *hw, u32 value) | |||
1090 | return ret; | 1090 | return ret; |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | static void ar5523_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 1093 | static void ar5523_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1094 | u32 queues, bool drop) | ||
1094 | { | 1095 | { |
1095 | struct ar5523 *ar = hw->priv; | 1096 | struct ar5523 *ar = hw->priv; |
1096 | 1097 | ||
diff --git a/drivers/net/wireless/ath/ath10k/bmi.c b/drivers/net/wireless/ath/ath10k/bmi.c index a1f099628850..17d221abd58c 100644 --- a/drivers/net/wireless/ath/ath10k/bmi.c +++ b/drivers/net/wireless/ath/ath10k/bmi.c | |||
@@ -175,7 +175,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar, | |||
175 | return 0; | 175 | return 0; |
176 | } | 176 | } |
177 | 177 | ||
178 | int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param) | 178 | int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 param, u32 *result) |
179 | { | 179 | { |
180 | struct bmi_cmd cmd; | 180 | struct bmi_cmd cmd; |
181 | union bmi_resp resp; | 181 | union bmi_resp resp; |
@@ -184,7 +184,7 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param) | |||
184 | int ret; | 184 | int ret; |
185 | 185 | ||
186 | ath10k_dbg(ATH10K_DBG_BMI, "bmi execute address 0x%x param 0x%x\n", | 186 | ath10k_dbg(ATH10K_DBG_BMI, "bmi execute address 0x%x param 0x%x\n", |
187 | address, *param); | 187 | address, param); |
188 | 188 | ||
189 | if (ar->bmi.done_sent) { | 189 | if (ar->bmi.done_sent) { |
190 | ath10k_warn("command disallowed\n"); | 190 | ath10k_warn("command disallowed\n"); |
@@ -193,7 +193,7 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param) | |||
193 | 193 | ||
194 | cmd.id = __cpu_to_le32(BMI_EXECUTE); | 194 | cmd.id = __cpu_to_le32(BMI_EXECUTE); |
195 | cmd.execute.addr = __cpu_to_le32(address); | 195 | cmd.execute.addr = __cpu_to_le32(address); |
196 | cmd.execute.param = __cpu_to_le32(*param); | 196 | cmd.execute.param = __cpu_to_le32(param); |
197 | 197 | ||
198 | ret = ath10k_hif_exchange_bmi_msg(ar, &cmd, cmdlen, &resp, &resplen); | 198 | ret = ath10k_hif_exchange_bmi_msg(ar, &cmd, cmdlen, &resp, &resplen); |
199 | if (ret) { | 199 | if (ret) { |
@@ -204,10 +204,13 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param) | |||
204 | if (resplen < sizeof(resp.execute)) { | 204 | if (resplen < sizeof(resp.execute)) { |
205 | ath10k_warn("invalid execute response length (%d)\n", | 205 | ath10k_warn("invalid execute response length (%d)\n", |
206 | resplen); | 206 | resplen); |
207 | return ret; | 207 | return -EIO; |
208 | } | 208 | } |
209 | 209 | ||
210 | *param = __le32_to_cpu(resp.execute.result); | 210 | *result = __le32_to_cpu(resp.execute.result); |
211 | |||
212 | ath10k_dbg(ATH10K_DBG_BMI, "bmi execute result 0x%x\n", *result); | ||
213 | |||
211 | return 0; | 214 | return 0; |
212 | } | 215 | } |
213 | 216 | ||
diff --git a/drivers/net/wireless/ath/ath10k/bmi.h b/drivers/net/wireless/ath/ath10k/bmi.h index 8d81ce1cec21..111ab701465c 100644 --- a/drivers/net/wireless/ath/ath10k/bmi.h +++ b/drivers/net/wireless/ath/ath10k/bmi.h | |||
@@ -201,7 +201,8 @@ int ath10k_bmi_write_memory(struct ath10k *ar, u32 address, | |||
201 | \ | 201 | \ |
202 | addr = host_interest_item_address(HI_ITEM(item)); \ | 202 | addr = host_interest_item_address(HI_ITEM(item)); \ |
203 | ret = ath10k_bmi_read_memory(ar, addr, (u8 *)&tmp, 4); \ | 203 | ret = ath10k_bmi_read_memory(ar, addr, (u8 *)&tmp, 4); \ |
204 | *val = __le32_to_cpu(tmp); \ | 204 | if (!ret) \ |
205 | *val = __le32_to_cpu(tmp); \ | ||
205 | ret; \ | 206 | ret; \ |
206 | }) | 207 | }) |
207 | 208 | ||
@@ -217,7 +218,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar, u32 address, | |||
217 | ret; \ | 218 | ret; \ |
218 | }) | 219 | }) |
219 | 220 | ||
220 | int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param); | 221 | int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 param, u32 *result); |
221 | int ath10k_bmi_lz_stream_start(struct ath10k *ar, u32 address); | 222 | int ath10k_bmi_lz_stream_start(struct ath10k *ar, u32 address); |
222 | int ath10k_bmi_lz_data(struct ath10k *ar, const void *buffer, u32 length); | 223 | int ath10k_bmi_lz_data(struct ath10k *ar, const void *buffer, u32 length); |
223 | int ath10k_bmi_fast_download(struct ath10k *ar, u32 address, | 224 | int ath10k_bmi_fast_download(struct ath10k *ar, u32 address, |
diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c index a79499c82350..d185dc0cd12b 100644 --- a/drivers/net/wireless/ath/ath10k/ce.c +++ b/drivers/net/wireless/ath/ath10k/ce.c | |||
@@ -329,6 +329,33 @@ exit: | |||
329 | return ret; | 329 | return ret; |
330 | } | 330 | } |
331 | 331 | ||
332 | void __ath10k_ce_send_revert(struct ath10k_ce_pipe *pipe) | ||
333 | { | ||
334 | struct ath10k *ar = pipe->ar; | ||
335 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | ||
336 | struct ath10k_ce_ring *src_ring = pipe->src_ring; | ||
337 | u32 ctrl_addr = pipe->ctrl_addr; | ||
338 | |||
339 | lockdep_assert_held(&ar_pci->ce_lock); | ||
340 | |||
341 | /* | ||
342 | * This function must be called only if there is an incomplete | ||
343 | * scatter-gather transfer (before index register is updated) | ||
344 | * that needs to be cleaned up. | ||
345 | */ | ||
346 | if (WARN_ON_ONCE(src_ring->write_index == src_ring->sw_index)) | ||
347 | return; | ||
348 | |||
349 | if (WARN_ON_ONCE(src_ring->write_index == | ||
350 | ath10k_ce_src_ring_write_index_get(ar, ctrl_addr))) | ||
351 | return; | ||
352 | |||
353 | src_ring->write_index--; | ||
354 | src_ring->write_index &= src_ring->nentries_mask; | ||
355 | |||
356 | src_ring->per_transfer_context[src_ring->write_index] = NULL; | ||
357 | } | ||
358 | |||
332 | int ath10k_ce_send(struct ath10k_ce_pipe *ce_state, | 359 | int ath10k_ce_send(struct ath10k_ce_pipe *ce_state, |
333 | void *per_transfer_context, | 360 | void *per_transfer_context, |
334 | u32 buffer, | 361 | u32 buffer, |
@@ -840,35 +867,17 @@ void ath10k_ce_recv_cb_register(struct ath10k_ce_pipe *ce_state, | |||
840 | 867 | ||
841 | static int ath10k_ce_init_src_ring(struct ath10k *ar, | 868 | static int ath10k_ce_init_src_ring(struct ath10k *ar, |
842 | unsigned int ce_id, | 869 | unsigned int ce_id, |
843 | struct ath10k_ce_pipe *ce_state, | ||
844 | const struct ce_attr *attr) | 870 | const struct ce_attr *attr) |
845 | { | 871 | { |
846 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | 872 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
847 | struct ath10k_ce_ring *src_ring; | 873 | struct ath10k_ce_pipe *ce_state = &ar_pci->ce_states[ce_id]; |
848 | unsigned int nentries = attr->src_nentries; | 874 | struct ath10k_ce_ring *src_ring = ce_state->src_ring; |
849 | unsigned int ce_nbytes; | 875 | u32 nentries, ctrl_addr = ath10k_ce_base_address(ce_id); |
850 | u32 ctrl_addr = ath10k_ce_base_address(ce_id); | ||
851 | dma_addr_t base_addr; | ||
852 | char *ptr; | ||
853 | |||
854 | nentries = roundup_pow_of_two(nentries); | ||
855 | |||
856 | if (ce_state->src_ring) { | ||
857 | WARN_ON(ce_state->src_ring->nentries != nentries); | ||
858 | return 0; | ||
859 | } | ||
860 | |||
861 | ce_nbytes = sizeof(struct ath10k_ce_ring) + (nentries * sizeof(void *)); | ||
862 | ptr = kzalloc(ce_nbytes, GFP_KERNEL); | ||
863 | if (ptr == NULL) | ||
864 | return -ENOMEM; | ||
865 | 876 | ||
866 | ce_state->src_ring = (struct ath10k_ce_ring *)ptr; | 877 | nentries = roundup_pow_of_two(attr->src_nentries); |
867 | src_ring = ce_state->src_ring; | ||
868 | 878 | ||
869 | ptr += sizeof(struct ath10k_ce_ring); | 879 | memset(src_ring->per_transfer_context, 0, |
870 | src_ring->nentries = nentries; | 880 | nentries * sizeof(*src_ring->per_transfer_context)); |
871 | src_ring->nentries_mask = nentries - 1; | ||
872 | 881 | ||
873 | src_ring->sw_index = ath10k_ce_src_ring_read_index_get(ar, ctrl_addr); | 882 | src_ring->sw_index = ath10k_ce_src_ring_read_index_get(ar, ctrl_addr); |
874 | src_ring->sw_index &= src_ring->nentries_mask; | 883 | src_ring->sw_index &= src_ring->nentries_mask; |
@@ -878,21 +887,87 @@ static int ath10k_ce_init_src_ring(struct ath10k *ar, | |||
878 | ath10k_ce_src_ring_write_index_get(ar, ctrl_addr); | 887 | ath10k_ce_src_ring_write_index_get(ar, ctrl_addr); |
879 | src_ring->write_index &= src_ring->nentries_mask; | 888 | src_ring->write_index &= src_ring->nentries_mask; |
880 | 889 | ||
881 | src_ring->per_transfer_context = (void **)ptr; | 890 | ath10k_ce_src_ring_base_addr_set(ar, ctrl_addr, |
891 | src_ring->base_addr_ce_space); | ||
892 | ath10k_ce_src_ring_size_set(ar, ctrl_addr, nentries); | ||
893 | ath10k_ce_src_ring_dmax_set(ar, ctrl_addr, attr->src_sz_max); | ||
894 | ath10k_ce_src_ring_byte_swap_set(ar, ctrl_addr, 0); | ||
895 | ath10k_ce_src_ring_lowmark_set(ar, ctrl_addr, 0); | ||
896 | ath10k_ce_src_ring_highmark_set(ar, ctrl_addr, nentries); | ||
897 | |||
898 | ath10k_dbg(ATH10K_DBG_BOOT, | ||
899 | "boot init ce src ring id %d entries %d base_addr %p\n", | ||
900 | ce_id, nentries, src_ring->base_addr_owner_space); | ||
901 | |||
902 | return 0; | ||
903 | } | ||
904 | |||
905 | static int ath10k_ce_init_dest_ring(struct ath10k *ar, | ||
906 | unsigned int ce_id, | ||
907 | const struct ce_attr *attr) | ||
908 | { | ||
909 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | ||
910 | struct ath10k_ce_pipe *ce_state = &ar_pci->ce_states[ce_id]; | ||
911 | struct ath10k_ce_ring *dest_ring = ce_state->dest_ring; | ||
912 | u32 nentries, ctrl_addr = ath10k_ce_base_address(ce_id); | ||
913 | |||
914 | nentries = roundup_pow_of_two(attr->dest_nentries); | ||
915 | |||
916 | memset(dest_ring->per_transfer_context, 0, | ||
917 | nentries * sizeof(*dest_ring->per_transfer_context)); | ||
918 | |||
919 | dest_ring->sw_index = ath10k_ce_dest_ring_read_index_get(ar, ctrl_addr); | ||
920 | dest_ring->sw_index &= dest_ring->nentries_mask; | ||
921 | dest_ring->write_index = | ||
922 | ath10k_ce_dest_ring_write_index_get(ar, ctrl_addr); | ||
923 | dest_ring->write_index &= dest_ring->nentries_mask; | ||
924 | |||
925 | ath10k_ce_dest_ring_base_addr_set(ar, ctrl_addr, | ||
926 | dest_ring->base_addr_ce_space); | ||
927 | ath10k_ce_dest_ring_size_set(ar, ctrl_addr, nentries); | ||
928 | ath10k_ce_dest_ring_byte_swap_set(ar, ctrl_addr, 0); | ||
929 | ath10k_ce_dest_ring_lowmark_set(ar, ctrl_addr, 0); | ||
930 | ath10k_ce_dest_ring_highmark_set(ar, ctrl_addr, nentries); | ||
931 | |||
932 | ath10k_dbg(ATH10K_DBG_BOOT, | ||
933 | "boot ce dest ring id %d entries %d base_addr %p\n", | ||
934 | ce_id, nentries, dest_ring->base_addr_owner_space); | ||
935 | |||
936 | return 0; | ||
937 | } | ||
938 | |||
939 | static struct ath10k_ce_ring * | ||
940 | ath10k_ce_alloc_src_ring(struct ath10k *ar, unsigned int ce_id, | ||
941 | const struct ce_attr *attr) | ||
942 | { | ||
943 | struct ath10k_ce_ring *src_ring; | ||
944 | u32 nentries = attr->src_nentries; | ||
945 | dma_addr_t base_addr; | ||
946 | |||
947 | nentries = roundup_pow_of_two(nentries); | ||
948 | |||
949 | src_ring = kzalloc(sizeof(*src_ring) + | ||
950 | (nentries * | ||
951 | sizeof(*src_ring->per_transfer_context)), | ||
952 | GFP_KERNEL); | ||
953 | if (src_ring == NULL) | ||
954 | return ERR_PTR(-ENOMEM); | ||
955 | |||
956 | src_ring->nentries = nentries; | ||
957 | src_ring->nentries_mask = nentries - 1; | ||
882 | 958 | ||
883 | /* | 959 | /* |
884 | * Legacy platforms that do not support cache | 960 | * Legacy platforms that do not support cache |
885 | * coherent DMA are unsupported | 961 | * coherent DMA are unsupported |
886 | */ | 962 | */ |
887 | src_ring->base_addr_owner_space_unaligned = | 963 | src_ring->base_addr_owner_space_unaligned = |
888 | pci_alloc_consistent(ar_pci->pdev, | 964 | dma_alloc_coherent(ar->dev, |
889 | (nentries * sizeof(struct ce_desc) + | 965 | (nentries * sizeof(struct ce_desc) + |
890 | CE_DESC_RING_ALIGN), | 966 | CE_DESC_RING_ALIGN), |
891 | &base_addr); | 967 | &base_addr, GFP_KERNEL); |
892 | if (!src_ring->base_addr_owner_space_unaligned) { | 968 | if (!src_ring->base_addr_owner_space_unaligned) { |
893 | kfree(ce_state->src_ring); | 969 | kfree(src_ring); |
894 | ce_state->src_ring = NULL; | 970 | return ERR_PTR(-ENOMEM); |
895 | return -ENOMEM; | ||
896 | } | 971 | } |
897 | 972 | ||
898 | src_ring->base_addr_ce_space_unaligned = base_addr; | 973 | src_ring->base_addr_ce_space_unaligned = base_addr; |
@@ -912,88 +987,54 @@ static int ath10k_ce_init_src_ring(struct ath10k *ar, | |||
912 | kmalloc((nentries * sizeof(struct ce_desc) + | 987 | kmalloc((nentries * sizeof(struct ce_desc) + |
913 | CE_DESC_RING_ALIGN), GFP_KERNEL); | 988 | CE_DESC_RING_ALIGN), GFP_KERNEL); |
914 | if (!src_ring->shadow_base_unaligned) { | 989 | if (!src_ring->shadow_base_unaligned) { |
915 | pci_free_consistent(ar_pci->pdev, | 990 | dma_free_coherent(ar->dev, |
916 | (nentries * sizeof(struct ce_desc) + | 991 | (nentries * sizeof(struct ce_desc) + |
917 | CE_DESC_RING_ALIGN), | 992 | CE_DESC_RING_ALIGN), |
918 | src_ring->base_addr_owner_space, | 993 | src_ring->base_addr_owner_space, |
919 | src_ring->base_addr_ce_space); | 994 | src_ring->base_addr_ce_space); |
920 | kfree(ce_state->src_ring); | 995 | kfree(src_ring); |
921 | ce_state->src_ring = NULL; | 996 | return ERR_PTR(-ENOMEM); |
922 | return -ENOMEM; | ||
923 | } | 997 | } |
924 | 998 | ||
925 | src_ring->shadow_base = PTR_ALIGN( | 999 | src_ring->shadow_base = PTR_ALIGN( |
926 | src_ring->shadow_base_unaligned, | 1000 | src_ring->shadow_base_unaligned, |
927 | CE_DESC_RING_ALIGN); | 1001 | CE_DESC_RING_ALIGN); |
928 | 1002 | ||
929 | ath10k_ce_src_ring_base_addr_set(ar, ctrl_addr, | 1003 | return src_ring; |
930 | src_ring->base_addr_ce_space); | ||
931 | ath10k_ce_src_ring_size_set(ar, ctrl_addr, nentries); | ||
932 | ath10k_ce_src_ring_dmax_set(ar, ctrl_addr, attr->src_sz_max); | ||
933 | ath10k_ce_src_ring_byte_swap_set(ar, ctrl_addr, 0); | ||
934 | ath10k_ce_src_ring_lowmark_set(ar, ctrl_addr, 0); | ||
935 | ath10k_ce_src_ring_highmark_set(ar, ctrl_addr, nentries); | ||
936 | |||
937 | ath10k_dbg(ATH10K_DBG_BOOT, | ||
938 | "boot ce src ring id %d entries %d base_addr %p\n", | ||
939 | ce_id, nentries, src_ring->base_addr_owner_space); | ||
940 | |||
941 | return 0; | ||
942 | } | 1004 | } |
943 | 1005 | ||
944 | static int ath10k_ce_init_dest_ring(struct ath10k *ar, | 1006 | static struct ath10k_ce_ring * |
945 | unsigned int ce_id, | 1007 | ath10k_ce_alloc_dest_ring(struct ath10k *ar, unsigned int ce_id, |
946 | struct ath10k_ce_pipe *ce_state, | 1008 | const struct ce_attr *attr) |
947 | const struct ce_attr *attr) | ||
948 | { | 1009 | { |
949 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | ||
950 | struct ath10k_ce_ring *dest_ring; | 1010 | struct ath10k_ce_ring *dest_ring; |
951 | unsigned int nentries = attr->dest_nentries; | 1011 | u32 nentries; |
952 | unsigned int ce_nbytes; | ||
953 | u32 ctrl_addr = ath10k_ce_base_address(ce_id); | ||
954 | dma_addr_t base_addr; | 1012 | dma_addr_t base_addr; |
955 | char *ptr; | ||
956 | 1013 | ||
957 | nentries = roundup_pow_of_two(nentries); | 1014 | nentries = roundup_pow_of_two(attr->dest_nentries); |
958 | 1015 | ||
959 | if (ce_state->dest_ring) { | 1016 | dest_ring = kzalloc(sizeof(*dest_ring) + |
960 | WARN_ON(ce_state->dest_ring->nentries != nentries); | 1017 | (nentries * |
961 | return 0; | 1018 | sizeof(*dest_ring->per_transfer_context)), |
962 | } | 1019 | GFP_KERNEL); |
963 | 1020 | if (dest_ring == NULL) | |
964 | ce_nbytes = sizeof(struct ath10k_ce_ring) + (nentries * sizeof(void *)); | 1021 | return ERR_PTR(-ENOMEM); |
965 | ptr = kzalloc(ce_nbytes, GFP_KERNEL); | ||
966 | if (ptr == NULL) | ||
967 | return -ENOMEM; | ||
968 | 1022 | ||
969 | ce_state->dest_ring = (struct ath10k_ce_ring *)ptr; | ||
970 | dest_ring = ce_state->dest_ring; | ||
971 | |||
972 | ptr += sizeof(struct ath10k_ce_ring); | ||
973 | dest_ring->nentries = nentries; | 1023 | dest_ring->nentries = nentries; |
974 | dest_ring->nentries_mask = nentries - 1; | 1024 | dest_ring->nentries_mask = nentries - 1; |
975 | 1025 | ||
976 | dest_ring->sw_index = ath10k_ce_dest_ring_read_index_get(ar, ctrl_addr); | ||
977 | dest_ring->sw_index &= dest_ring->nentries_mask; | ||
978 | dest_ring->write_index = | ||
979 | ath10k_ce_dest_ring_write_index_get(ar, ctrl_addr); | ||
980 | dest_ring->write_index &= dest_ring->nentries_mask; | ||
981 | |||
982 | dest_ring->per_transfer_context = (void **)ptr; | ||
983 | |||
984 | /* | 1026 | /* |
985 | * Legacy platforms that do not support cache | 1027 | * Legacy platforms that do not support cache |
986 | * coherent DMA are unsupported | 1028 | * coherent DMA are unsupported |
987 | */ | 1029 | */ |
988 | dest_ring->base_addr_owner_space_unaligned = | 1030 | dest_ring->base_addr_owner_space_unaligned = |
989 | pci_alloc_consistent(ar_pci->pdev, | 1031 | dma_alloc_coherent(ar->dev, |
990 | (nentries * sizeof(struct ce_desc) + | 1032 | (nentries * sizeof(struct ce_desc) + |
991 | CE_DESC_RING_ALIGN), | 1033 | CE_DESC_RING_ALIGN), |
992 | &base_addr); | 1034 | &base_addr, GFP_KERNEL); |
993 | if (!dest_ring->base_addr_owner_space_unaligned) { | 1035 | if (!dest_ring->base_addr_owner_space_unaligned) { |
994 | kfree(ce_state->dest_ring); | 1036 | kfree(dest_ring); |
995 | ce_state->dest_ring = NULL; | 1037 | return ERR_PTR(-ENOMEM); |
996 | return -ENOMEM; | ||
997 | } | 1038 | } |
998 | 1039 | ||
999 | dest_ring->base_addr_ce_space_unaligned = base_addr; | 1040 | dest_ring->base_addr_ce_space_unaligned = base_addr; |
@@ -1012,39 +1053,7 @@ static int ath10k_ce_init_dest_ring(struct ath10k *ar, | |||
1012 | dest_ring->base_addr_ce_space_unaligned, | 1053 | dest_ring->base_addr_ce_space_unaligned, |
1013 | CE_DESC_RING_ALIGN); | 1054 | CE_DESC_RING_ALIGN); |
1014 | 1055 | ||
1015 | ath10k_ce_dest_ring_base_addr_set(ar, ctrl_addr, | 1056 | return dest_ring; |
1016 | dest_ring->base_addr_ce_space); | ||
1017 | ath10k_ce_dest_ring_size_set(ar, ctrl_addr, nentries); | ||
1018 | ath10k_ce_dest_ring_byte_swap_set(ar, ctrl_addr, 0); | ||
1019 | ath10k_ce_dest_ring_lowmark_set(ar, ctrl_addr, 0); | ||
1020 | ath10k_ce_dest_ring_highmark_set(ar, ctrl_addr, nentries); | ||
1021 | |||
1022 | ath10k_dbg(ATH10K_DBG_BOOT, | ||
1023 | "boot ce dest ring id %d entries %d base_addr %p\n", | ||
1024 | ce_id, nentries, dest_ring->base_addr_owner_space); | ||
1025 | |||
1026 | return 0; | ||
1027 | } | ||
1028 | |||
1029 | static struct ath10k_ce_pipe *ath10k_ce_init_state(struct ath10k *ar, | ||
1030 | unsigned int ce_id, | ||
1031 | const struct ce_attr *attr) | ||
1032 | { | ||
1033 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | ||
1034 | struct ath10k_ce_pipe *ce_state = &ar_pci->ce_states[ce_id]; | ||
1035 | u32 ctrl_addr = ath10k_ce_base_address(ce_id); | ||
1036 | |||
1037 | spin_lock_bh(&ar_pci->ce_lock); | ||
1038 | |||
1039 | ce_state->ar = ar; | ||
1040 | ce_state->id = ce_id; | ||
1041 | ce_state->ctrl_addr = ctrl_addr; | ||
1042 | ce_state->attr_flags = attr->flags; | ||
1043 | ce_state->src_sz_max = attr->src_sz_max; | ||
1044 | |||
1045 | spin_unlock_bh(&ar_pci->ce_lock); | ||
1046 | |||
1047 | return ce_state; | ||
1048 | } | 1057 | } |
1049 | 1058 | ||
1050 | /* | 1059 | /* |
@@ -1054,11 +1063,11 @@ static struct ath10k_ce_pipe *ath10k_ce_init_state(struct ath10k *ar, | |||
1054 | * initialization. It may be that only one side or the other is | 1063 | * initialization. It may be that only one side or the other is |
1055 | * initialized by software/firmware. | 1064 | * initialized by software/firmware. |
1056 | */ | 1065 | */ |
1057 | struct ath10k_ce_pipe *ath10k_ce_init(struct ath10k *ar, | 1066 | int ath10k_ce_init_pipe(struct ath10k *ar, unsigned int ce_id, |
1058 | unsigned int ce_id, | 1067 | const struct ce_attr *attr) |
1059 | const struct ce_attr *attr) | ||
1060 | { | 1068 | { |
1061 | struct ath10k_ce_pipe *ce_state; | 1069 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
1070 | struct ath10k_ce_pipe *ce_state = &ar_pci->ce_states[ce_id]; | ||
1062 | int ret; | 1071 | int ret; |
1063 | 1072 | ||
1064 | /* | 1073 | /* |
@@ -1074,64 +1083,128 @@ struct ath10k_ce_pipe *ath10k_ce_init(struct ath10k *ar, | |||
1074 | 1083 | ||
1075 | ret = ath10k_pci_wake(ar); | 1084 | ret = ath10k_pci_wake(ar); |
1076 | if (ret) | 1085 | if (ret) |
1077 | return NULL; | 1086 | return ret; |
1078 | 1087 | ||
1079 | ce_state = ath10k_ce_init_state(ar, ce_id, attr); | 1088 | spin_lock_bh(&ar_pci->ce_lock); |
1080 | if (!ce_state) { | 1089 | ce_state->ar = ar; |
1081 | ath10k_err("Failed to initialize CE state for ID: %d\n", ce_id); | 1090 | ce_state->id = ce_id; |
1082 | goto out; | 1091 | ce_state->ctrl_addr = ath10k_ce_base_address(ce_id); |
1083 | } | 1092 | ce_state->attr_flags = attr->flags; |
1093 | ce_state->src_sz_max = attr->src_sz_max; | ||
1094 | spin_unlock_bh(&ar_pci->ce_lock); | ||
1084 | 1095 | ||
1085 | if (attr->src_nentries) { | 1096 | if (attr->src_nentries) { |
1086 | ret = ath10k_ce_init_src_ring(ar, ce_id, ce_state, attr); | 1097 | ret = ath10k_ce_init_src_ring(ar, ce_id, attr); |
1087 | if (ret) { | 1098 | if (ret) { |
1088 | ath10k_err("Failed to initialize CE src ring for ID: %d (%d)\n", | 1099 | ath10k_err("Failed to initialize CE src ring for ID: %d (%d)\n", |
1089 | ce_id, ret); | 1100 | ce_id, ret); |
1090 | ath10k_ce_deinit(ce_state); | ||
1091 | ce_state = NULL; | ||
1092 | goto out; | 1101 | goto out; |
1093 | } | 1102 | } |
1094 | } | 1103 | } |
1095 | 1104 | ||
1096 | if (attr->dest_nentries) { | 1105 | if (attr->dest_nentries) { |
1097 | ret = ath10k_ce_init_dest_ring(ar, ce_id, ce_state, attr); | 1106 | ret = ath10k_ce_init_dest_ring(ar, ce_id, attr); |
1098 | if (ret) { | 1107 | if (ret) { |
1099 | ath10k_err("Failed to initialize CE dest ring for ID: %d (%d)\n", | 1108 | ath10k_err("Failed to initialize CE dest ring for ID: %d (%d)\n", |
1100 | ce_id, ret); | 1109 | ce_id, ret); |
1101 | ath10k_ce_deinit(ce_state); | ||
1102 | ce_state = NULL; | ||
1103 | goto out; | 1110 | goto out; |
1104 | } | 1111 | } |
1105 | } | 1112 | } |
1106 | 1113 | ||
1107 | out: | 1114 | out: |
1108 | ath10k_pci_sleep(ar); | 1115 | ath10k_pci_sleep(ar); |
1109 | return ce_state; | 1116 | return ret; |
1110 | } | 1117 | } |
1111 | 1118 | ||
1112 | void ath10k_ce_deinit(struct ath10k_ce_pipe *ce_state) | 1119 | static void ath10k_ce_deinit_src_ring(struct ath10k *ar, unsigned int ce_id) |
1120 | { | ||
1121 | u32 ctrl_addr = ath10k_ce_base_address(ce_id); | ||
1122 | |||
1123 | ath10k_ce_src_ring_base_addr_set(ar, ctrl_addr, 0); | ||
1124 | ath10k_ce_src_ring_size_set(ar, ctrl_addr, 0); | ||
1125 | ath10k_ce_src_ring_dmax_set(ar, ctrl_addr, 0); | ||
1126 | ath10k_ce_src_ring_highmark_set(ar, ctrl_addr, 0); | ||
1127 | } | ||
1128 | |||
1129 | static void ath10k_ce_deinit_dest_ring(struct ath10k *ar, unsigned int ce_id) | ||
1130 | { | ||
1131 | u32 ctrl_addr = ath10k_ce_base_address(ce_id); | ||
1132 | |||
1133 | ath10k_ce_dest_ring_base_addr_set(ar, ctrl_addr, 0); | ||
1134 | ath10k_ce_dest_ring_size_set(ar, ctrl_addr, 0); | ||
1135 | ath10k_ce_dest_ring_highmark_set(ar, ctrl_addr, 0); | ||
1136 | } | ||
1137 | |||
1138 | void ath10k_ce_deinit_pipe(struct ath10k *ar, unsigned int ce_id) | ||
1139 | { | ||
1140 | int ret; | ||
1141 | |||
1142 | ret = ath10k_pci_wake(ar); | ||
1143 | if (ret) | ||
1144 | return; | ||
1145 | |||
1146 | ath10k_ce_deinit_src_ring(ar, ce_id); | ||
1147 | ath10k_ce_deinit_dest_ring(ar, ce_id); | ||
1148 | |||
1149 | ath10k_pci_sleep(ar); | ||
1150 | } | ||
1151 | |||
1152 | int ath10k_ce_alloc_pipe(struct ath10k *ar, int ce_id, | ||
1153 | const struct ce_attr *attr) | ||
1154 | { | ||
1155 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | ||
1156 | struct ath10k_ce_pipe *ce_state = &ar_pci->ce_states[ce_id]; | ||
1157 | int ret; | ||
1158 | |||
1159 | if (attr->src_nentries) { | ||
1160 | ce_state->src_ring = ath10k_ce_alloc_src_ring(ar, ce_id, attr); | ||
1161 | if (IS_ERR(ce_state->src_ring)) { | ||
1162 | ret = PTR_ERR(ce_state->src_ring); | ||
1163 | ath10k_err("failed to allocate copy engine source ring %d: %d\n", | ||
1164 | ce_id, ret); | ||
1165 | ce_state->src_ring = NULL; | ||
1166 | return ret; | ||
1167 | } | ||
1168 | } | ||
1169 | |||
1170 | if (attr->dest_nentries) { | ||
1171 | ce_state->dest_ring = ath10k_ce_alloc_dest_ring(ar, ce_id, | ||
1172 | attr); | ||
1173 | if (IS_ERR(ce_state->dest_ring)) { | ||
1174 | ret = PTR_ERR(ce_state->dest_ring); | ||
1175 | ath10k_err("failed to allocate copy engine destination ring %d: %d\n", | ||
1176 | ce_id, ret); | ||
1177 | ce_state->dest_ring = NULL; | ||
1178 | return ret; | ||
1179 | } | ||
1180 | } | ||
1181 | |||
1182 | return 0; | ||
1183 | } | ||
1184 | |||
1185 | void ath10k_ce_free_pipe(struct ath10k *ar, int ce_id) | ||
1113 | { | 1186 | { |
1114 | struct ath10k *ar = ce_state->ar; | ||
1115 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | 1187 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
1188 | struct ath10k_ce_pipe *ce_state = &ar_pci->ce_states[ce_id]; | ||
1116 | 1189 | ||
1117 | if (ce_state->src_ring) { | 1190 | if (ce_state->src_ring) { |
1118 | kfree(ce_state->src_ring->shadow_base_unaligned); | 1191 | kfree(ce_state->src_ring->shadow_base_unaligned); |
1119 | pci_free_consistent(ar_pci->pdev, | 1192 | dma_free_coherent(ar->dev, |
1120 | (ce_state->src_ring->nentries * | 1193 | (ce_state->src_ring->nentries * |
1121 | sizeof(struct ce_desc) + | 1194 | sizeof(struct ce_desc) + |
1122 | CE_DESC_RING_ALIGN), | 1195 | CE_DESC_RING_ALIGN), |
1123 | ce_state->src_ring->base_addr_owner_space, | 1196 | ce_state->src_ring->base_addr_owner_space, |
1124 | ce_state->src_ring->base_addr_ce_space); | 1197 | ce_state->src_ring->base_addr_ce_space); |
1125 | kfree(ce_state->src_ring); | 1198 | kfree(ce_state->src_ring); |
1126 | } | 1199 | } |
1127 | 1200 | ||
1128 | if (ce_state->dest_ring) { | 1201 | if (ce_state->dest_ring) { |
1129 | pci_free_consistent(ar_pci->pdev, | 1202 | dma_free_coherent(ar->dev, |
1130 | (ce_state->dest_ring->nentries * | 1203 | (ce_state->dest_ring->nentries * |
1131 | sizeof(struct ce_desc) + | 1204 | sizeof(struct ce_desc) + |
1132 | CE_DESC_RING_ALIGN), | 1205 | CE_DESC_RING_ALIGN), |
1133 | ce_state->dest_ring->base_addr_owner_space, | 1206 | ce_state->dest_ring->base_addr_owner_space, |
1134 | ce_state->dest_ring->base_addr_ce_space); | 1207 | ce_state->dest_ring->base_addr_ce_space); |
1135 | kfree(ce_state->dest_ring); | 1208 | kfree(ce_state->dest_ring); |
1136 | } | 1209 | } |
1137 | 1210 | ||
diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h index 8eb7f99ed992..7a5a36fc59c1 100644 --- a/drivers/net/wireless/ath/ath10k/ce.h +++ b/drivers/net/wireless/ath/ath10k/ce.h | |||
@@ -104,7 +104,8 @@ struct ath10k_ce_ring { | |||
104 | void *shadow_base_unaligned; | 104 | void *shadow_base_unaligned; |
105 | struct ce_desc *shadow_base; | 105 | struct ce_desc *shadow_base; |
106 | 106 | ||
107 | void **per_transfer_context; | 107 | /* keep last */ |
108 | void *per_transfer_context[0]; | ||
108 | }; | 109 | }; |
109 | 110 | ||
110 | struct ath10k_ce_pipe { | 111 | struct ath10k_ce_pipe { |
@@ -159,6 +160,8 @@ int ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state, | |||
159 | unsigned int transfer_id, | 160 | unsigned int transfer_id, |
160 | unsigned int flags); | 161 | unsigned int flags); |
161 | 162 | ||
163 | void __ath10k_ce_send_revert(struct ath10k_ce_pipe *pipe); | ||
164 | |||
162 | void ath10k_ce_send_cb_register(struct ath10k_ce_pipe *ce_state, | 165 | void ath10k_ce_send_cb_register(struct ath10k_ce_pipe *ce_state, |
163 | void (*send_cb)(struct ath10k_ce_pipe *), | 166 | void (*send_cb)(struct ath10k_ce_pipe *), |
164 | int disable_interrupts); | 167 | int disable_interrupts); |
@@ -210,10 +213,12 @@ int ath10k_ce_completed_send_next(struct ath10k_ce_pipe *ce_state, | |||
210 | 213 | ||
211 | /*==================CE Engine Initialization=======================*/ | 214 | /*==================CE Engine Initialization=======================*/ |
212 | 215 | ||
213 | /* Initialize an instance of a CE */ | 216 | int ath10k_ce_init_pipe(struct ath10k *ar, unsigned int ce_id, |
214 | struct ath10k_ce_pipe *ath10k_ce_init(struct ath10k *ar, | 217 | const struct ce_attr *attr); |
215 | unsigned int ce_id, | 218 | void ath10k_ce_deinit_pipe(struct ath10k *ar, unsigned int ce_id); |
216 | const struct ce_attr *attr); | 219 | int ath10k_ce_alloc_pipe(struct ath10k *ar, int ce_id, |
220 | const struct ce_attr *attr); | ||
221 | void ath10k_ce_free_pipe(struct ath10k *ar, int ce_id); | ||
217 | 222 | ||
218 | /*==================CE Engine Shutdown=======================*/ | 223 | /*==================CE Engine Shutdown=======================*/ |
219 | /* | 224 | /* |
@@ -236,8 +241,6 @@ int ath10k_ce_cancel_send_next(struct ath10k_ce_pipe *ce_state, | |||
236 | unsigned int *nbytesp, | 241 | unsigned int *nbytesp, |
237 | unsigned int *transfer_idp); | 242 | unsigned int *transfer_idp); |
238 | 243 | ||
239 | void ath10k_ce_deinit(struct ath10k_ce_pipe *ce_state); | ||
240 | |||
241 | /*==================CE Interrupt Handlers====================*/ | 244 | /*==================CE Interrupt Handlers====================*/ |
242 | void ath10k_ce_per_engine_service_any(struct ath10k *ar); | 245 | void ath10k_ce_per_engine_service_any(struct ath10k *ar); |
243 | void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id); | 246 | void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id); |
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index ebc5fc2ede75..82017f56e661 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c | |||
@@ -58,36 +58,6 @@ static void ath10k_send_suspend_complete(struct ath10k *ar) | |||
58 | complete(&ar->target_suspend); | 58 | complete(&ar->target_suspend); |
59 | } | 59 | } |
60 | 60 | ||
61 | static int ath10k_init_connect_htc(struct ath10k *ar) | ||
62 | { | ||
63 | int status; | ||
64 | |||
65 | status = ath10k_wmi_connect_htc_service(ar); | ||
66 | if (status) | ||
67 | goto conn_fail; | ||
68 | |||
69 | /* Start HTC */ | ||
70 | status = ath10k_htc_start(&ar->htc); | ||
71 | if (status) | ||
72 | goto conn_fail; | ||
73 | |||
74 | /* Wait for WMI event to be ready */ | ||
75 | status = ath10k_wmi_wait_for_service_ready(ar); | ||
76 | if (status <= 0) { | ||
77 | ath10k_warn("wmi service ready event not received"); | ||
78 | status = -ETIMEDOUT; | ||
79 | goto timeout; | ||
80 | } | ||
81 | |||
82 | ath10k_dbg(ATH10K_DBG_BOOT, "boot wmi ready\n"); | ||
83 | return 0; | ||
84 | |||
85 | timeout: | ||
86 | ath10k_htc_stop(&ar->htc); | ||
87 | conn_fail: | ||
88 | return status; | ||
89 | } | ||
90 | |||
91 | static int ath10k_init_configure_target(struct ath10k *ar) | 61 | static int ath10k_init_configure_target(struct ath10k *ar) |
92 | { | 62 | { |
93 | u32 param_host; | 63 | u32 param_host; |
@@ -249,30 +219,40 @@ exit: | |||
249 | 219 | ||
250 | static int ath10k_download_and_run_otp(struct ath10k *ar) | 220 | static int ath10k_download_and_run_otp(struct ath10k *ar) |
251 | { | 221 | { |
252 | u32 address = ar->hw_params.patch_load_addr; | 222 | u32 result, address = ar->hw_params.patch_load_addr; |
253 | u32 exec_param; | ||
254 | int ret; | 223 | int ret; |
255 | 224 | ||
256 | /* OTP is optional */ | 225 | /* OTP is optional */ |
257 | 226 | ||
258 | if (!ar->otp_data || !ar->otp_len) | 227 | if (!ar->otp_data || !ar->otp_len) { |
228 | ath10k_warn("Not running otp, calibration will be incorrect (otp-data %p otp_len %zd)!\n", | ||
229 | ar->otp_data, ar->otp_len); | ||
259 | return 0; | 230 | return 0; |
231 | } | ||
232 | |||
233 | ath10k_dbg(ATH10K_DBG_BOOT, "boot upload otp to 0x%x len %zd\n", | ||
234 | address, ar->otp_len); | ||
260 | 235 | ||
261 | ret = ath10k_bmi_fast_download(ar, address, ar->otp_data, ar->otp_len); | 236 | ret = ath10k_bmi_fast_download(ar, address, ar->otp_data, ar->otp_len); |
262 | if (ret) { | 237 | if (ret) { |
263 | ath10k_err("could not write otp (%d)\n", ret); | 238 | ath10k_err("could not write otp (%d)\n", ret); |
264 | goto exit; | 239 | return ret; |
265 | } | 240 | } |
266 | 241 | ||
267 | exec_param = 0; | 242 | ret = ath10k_bmi_execute(ar, address, 0, &result); |
268 | ret = ath10k_bmi_execute(ar, address, &exec_param); | ||
269 | if (ret) { | 243 | if (ret) { |
270 | ath10k_err("could not execute otp (%d)\n", ret); | 244 | ath10k_err("could not execute otp (%d)\n", ret); |
271 | goto exit; | 245 | return ret; |
272 | } | 246 | } |
273 | 247 | ||
274 | exit: | 248 | ath10k_dbg(ATH10K_DBG_BOOT, "boot otp execute result %d\n", result); |
275 | return ret; | 249 | |
250 | if (result != 0) { | ||
251 | ath10k_err("otp calibration failed: %d", result); | ||
252 | return -EINVAL; | ||
253 | } | ||
254 | |||
255 | return 0; | ||
276 | } | 256 | } |
277 | 257 | ||
278 | static int ath10k_download_fw(struct ath10k *ar) | 258 | static int ath10k_download_fw(struct ath10k *ar) |
@@ -389,8 +369,8 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) | |||
389 | /* first fetch the firmware file (firmware-*.bin) */ | 369 | /* first fetch the firmware file (firmware-*.bin) */ |
390 | ar->firmware = ath10k_fetch_fw_file(ar, ar->hw_params.fw.dir, name); | 370 | ar->firmware = ath10k_fetch_fw_file(ar, ar->hw_params.fw.dir, name); |
391 | if (IS_ERR(ar->firmware)) { | 371 | if (IS_ERR(ar->firmware)) { |
392 | ath10k_err("Could not fetch firmware file '%s': %ld\n", | 372 | ath10k_err("could not fetch firmware file '%s/%s': %ld\n", |
393 | name, PTR_ERR(ar->firmware)); | 373 | ar->hw_params.fw.dir, name, PTR_ERR(ar->firmware)); |
394 | return PTR_ERR(ar->firmware); | 374 | return PTR_ERR(ar->firmware); |
395 | } | 375 | } |
396 | 376 | ||
@@ -401,14 +381,14 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) | |||
401 | magic_len = strlen(ATH10K_FIRMWARE_MAGIC) + 1; | 381 | magic_len = strlen(ATH10K_FIRMWARE_MAGIC) + 1; |
402 | 382 | ||
403 | if (len < magic_len) { | 383 | if (len < magic_len) { |
404 | ath10k_err("firmware image too small to contain magic: %zu\n", | 384 | ath10k_err("firmware file '%s/%s' too small to contain magic: %zu\n", |
405 | len); | 385 | ar->hw_params.fw.dir, name, len); |
406 | ret = -EINVAL; | 386 | ret = -EINVAL; |
407 | goto err; | 387 | goto err; |
408 | } | 388 | } |
409 | 389 | ||
410 | if (memcmp(data, ATH10K_FIRMWARE_MAGIC, magic_len) != 0) { | 390 | if (memcmp(data, ATH10K_FIRMWARE_MAGIC, magic_len) != 0) { |
411 | ath10k_err("Invalid firmware magic\n"); | 391 | ath10k_err("invalid firmware magic\n"); |
412 | ret = -EINVAL; | 392 | ret = -EINVAL; |
413 | goto err; | 393 | goto err; |
414 | } | 394 | } |
@@ -430,7 +410,7 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) | |||
430 | data += sizeof(*hdr); | 410 | data += sizeof(*hdr); |
431 | 411 | ||
432 | if (len < ie_len) { | 412 | if (len < ie_len) { |
433 | ath10k_err("Invalid length for FW IE %d (%zu < %zu)\n", | 413 | ath10k_err("invalid length for FW IE %d (%zu < %zu)\n", |
434 | ie_id, len, ie_len); | 414 | ie_id, len, ie_len); |
435 | ret = -EINVAL; | 415 | ret = -EINVAL; |
436 | goto err; | 416 | goto err; |
@@ -513,8 +493,8 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) | |||
513 | } | 493 | } |
514 | 494 | ||
515 | if (!ar->firmware_data || !ar->firmware_len) { | 495 | if (!ar->firmware_data || !ar->firmware_len) { |
516 | ath10k_warn("No ATH10K_FW_IE_FW_IMAGE found from %s, skipping\n", | 496 | ath10k_warn("No ATH10K_FW_IE_FW_IMAGE found from '%s/%s', skipping\n", |
517 | name); | 497 | ar->hw_params.fw.dir, name); |
518 | ret = -ENOMEDIUM; | 498 | ret = -ENOMEDIUM; |
519 | goto err; | 499 | goto err; |
520 | } | 500 | } |
@@ -531,7 +511,9 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) | |||
531 | ar->hw_params.fw.board); | 511 | ar->hw_params.fw.board); |
532 | if (IS_ERR(ar->board)) { | 512 | if (IS_ERR(ar->board)) { |
533 | ret = PTR_ERR(ar->board); | 513 | ret = PTR_ERR(ar->board); |
534 | ath10k_err("could not fetch board data (%d)\n", ret); | 514 | ath10k_err("could not fetch board data '%s/%s' (%d)\n", |
515 | ar->hw_params.fw.dir, ar->hw_params.fw.board, | ||
516 | ret); | ||
535 | goto err; | 517 | goto err; |
536 | } | 518 | } |
537 | 519 | ||
@@ -549,19 +531,21 @@ static int ath10k_core_fetch_firmware_files(struct ath10k *ar) | |||
549 | { | 531 | { |
550 | int ret; | 532 | int ret; |
551 | 533 | ||
534 | ar->fw_api = 2; | ||
535 | ath10k_dbg(ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api); | ||
536 | |||
552 | ret = ath10k_core_fetch_firmware_api_n(ar, ATH10K_FW_API2_FILE); | 537 | ret = ath10k_core_fetch_firmware_api_n(ar, ATH10K_FW_API2_FILE); |
553 | if (ret == 0) { | 538 | if (ret == 0) |
554 | ar->fw_api = 2; | 539 | goto success; |
555 | goto out; | 540 | |
556 | } | 541 | ar->fw_api = 1; |
542 | ath10k_dbg(ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api); | ||
557 | 543 | ||
558 | ret = ath10k_core_fetch_firmware_api_1(ar); | 544 | ret = ath10k_core_fetch_firmware_api_1(ar); |
559 | if (ret) | 545 | if (ret) |
560 | return ret; | 546 | return ret; |
561 | 547 | ||
562 | ar->fw_api = 1; | 548 | success: |
563 | |||
564 | out: | ||
565 | ath10k_dbg(ATH10K_DBG_BOOT, "using fw api %d\n", ar->fw_api); | 549 | ath10k_dbg(ATH10K_DBG_BOOT, "using fw api %d\n", ar->fw_api); |
566 | 550 | ||
567 | return 0; | 551 | return 0; |
@@ -572,16 +556,22 @@ static int ath10k_init_download_firmware(struct ath10k *ar) | |||
572 | int ret; | 556 | int ret; |
573 | 557 | ||
574 | ret = ath10k_download_board_data(ar); | 558 | ret = ath10k_download_board_data(ar); |
575 | if (ret) | 559 | if (ret) { |
560 | ath10k_err("failed to download board data: %d\n", ret); | ||
576 | return ret; | 561 | return ret; |
562 | } | ||
577 | 563 | ||
578 | ret = ath10k_download_and_run_otp(ar); | 564 | ret = ath10k_download_and_run_otp(ar); |
579 | if (ret) | 565 | if (ret) { |
566 | ath10k_err("failed to run otp: %d\n", ret); | ||
580 | return ret; | 567 | return ret; |
568 | } | ||
581 | 569 | ||
582 | ret = ath10k_download_fw(ar); | 570 | ret = ath10k_download_fw(ar); |
583 | if (ret) | 571 | if (ret) { |
572 | ath10k_err("failed to download firmware: %d\n", ret); | ||
584 | return ret; | 573 | return ret; |
574 | } | ||
585 | 575 | ||
586 | return ret; | 576 | return ret; |
587 | } | 577 | } |
@@ -660,8 +650,9 @@ static void ath10k_core_restart(struct work_struct *work) | |||
660 | 650 | ||
661 | switch (ar->state) { | 651 | switch (ar->state) { |
662 | case ATH10K_STATE_ON: | 652 | case ATH10K_STATE_ON: |
663 | ath10k_halt(ar); | ||
664 | ar->state = ATH10K_STATE_RESTARTING; | 653 | ar->state = ATH10K_STATE_RESTARTING; |
654 | del_timer_sync(&ar->scan.timeout); | ||
655 | ath10k_reset_scan((unsigned long)ar); | ||
665 | ieee80211_restart_hw(ar->hw); | 656 | ieee80211_restart_hw(ar->hw); |
666 | break; | 657 | break; |
667 | case ATH10K_STATE_OFF: | 658 | case ATH10K_STATE_OFF: |
@@ -670,6 +661,8 @@ static void ath10k_core_restart(struct work_struct *work) | |||
670 | ath10k_warn("cannot restart a device that hasn't been started\n"); | 661 | ath10k_warn("cannot restart a device that hasn't been started\n"); |
671 | break; | 662 | break; |
672 | case ATH10K_STATE_RESTARTING: | 663 | case ATH10K_STATE_RESTARTING: |
664 | /* hw restart might be requested from multiple places */ | ||
665 | break; | ||
673 | case ATH10K_STATE_RESTARTED: | 666 | case ATH10K_STATE_RESTARTED: |
674 | ar->state = ATH10K_STATE_WEDGED; | 667 | ar->state = ATH10K_STATE_WEDGED; |
675 | /* fall through */ | 668 | /* fall through */ |
@@ -681,70 +674,6 @@ static void ath10k_core_restart(struct work_struct *work) | |||
681 | mutex_unlock(&ar->conf_mutex); | 674 | mutex_unlock(&ar->conf_mutex); |
682 | } | 675 | } |
683 | 676 | ||
684 | struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev, | ||
685 | const struct ath10k_hif_ops *hif_ops) | ||
686 | { | ||
687 | struct ath10k *ar; | ||
688 | |||
689 | ar = ath10k_mac_create(); | ||
690 | if (!ar) | ||
691 | return NULL; | ||
692 | |||
693 | ar->ath_common.priv = ar; | ||
694 | ar->ath_common.hw = ar->hw; | ||
695 | |||
696 | ar->p2p = !!ath10k_p2p; | ||
697 | ar->dev = dev; | ||
698 | |||
699 | ar->hif.priv = hif_priv; | ||
700 | ar->hif.ops = hif_ops; | ||
701 | |||
702 | init_completion(&ar->scan.started); | ||
703 | init_completion(&ar->scan.completed); | ||
704 | init_completion(&ar->scan.on_channel); | ||
705 | init_completion(&ar->target_suspend); | ||
706 | |||
707 | init_completion(&ar->install_key_done); | ||
708 | init_completion(&ar->vdev_setup_done); | ||
709 | |||
710 | setup_timer(&ar->scan.timeout, ath10k_reset_scan, (unsigned long)ar); | ||
711 | |||
712 | ar->workqueue = create_singlethread_workqueue("ath10k_wq"); | ||
713 | if (!ar->workqueue) | ||
714 | goto err_wq; | ||
715 | |||
716 | mutex_init(&ar->conf_mutex); | ||
717 | spin_lock_init(&ar->data_lock); | ||
718 | |||
719 | INIT_LIST_HEAD(&ar->peers); | ||
720 | init_waitqueue_head(&ar->peer_mapping_wq); | ||
721 | |||
722 | init_completion(&ar->offchan_tx_completed); | ||
723 | INIT_WORK(&ar->offchan_tx_work, ath10k_offchan_tx_work); | ||
724 | skb_queue_head_init(&ar->offchan_tx_queue); | ||
725 | |||
726 | INIT_WORK(&ar->wmi_mgmt_tx_work, ath10k_mgmt_over_wmi_tx_work); | ||
727 | skb_queue_head_init(&ar->wmi_mgmt_tx_queue); | ||
728 | |||
729 | INIT_WORK(&ar->restart_work, ath10k_core_restart); | ||
730 | |||
731 | return ar; | ||
732 | |||
733 | err_wq: | ||
734 | ath10k_mac_destroy(ar); | ||
735 | return NULL; | ||
736 | } | ||
737 | EXPORT_SYMBOL(ath10k_core_create); | ||
738 | |||
739 | void ath10k_core_destroy(struct ath10k *ar) | ||
740 | { | ||
741 | flush_workqueue(ar->workqueue); | ||
742 | destroy_workqueue(ar->workqueue); | ||
743 | |||
744 | ath10k_mac_destroy(ar); | ||
745 | } | ||
746 | EXPORT_SYMBOL(ath10k_core_destroy); | ||
747 | |||
748 | int ath10k_core_start(struct ath10k *ar) | 677 | int ath10k_core_start(struct ath10k *ar) |
749 | { | 678 | { |
750 | int status; | 679 | int status; |
@@ -785,10 +714,28 @@ int ath10k_core_start(struct ath10k *ar) | |||
785 | goto err; | 714 | goto err; |
786 | } | 715 | } |
787 | 716 | ||
717 | status = ath10k_htt_init(ar); | ||
718 | if (status) { | ||
719 | ath10k_err("failed to init htt: %d\n", status); | ||
720 | goto err_wmi_detach; | ||
721 | } | ||
722 | |||
723 | status = ath10k_htt_tx_alloc(&ar->htt); | ||
724 | if (status) { | ||
725 | ath10k_err("failed to alloc htt tx: %d\n", status); | ||
726 | goto err_wmi_detach; | ||
727 | } | ||
728 | |||
729 | status = ath10k_htt_rx_alloc(&ar->htt); | ||
730 | if (status) { | ||
731 | ath10k_err("failed to alloc htt rx: %d\n", status); | ||
732 | goto err_htt_tx_detach; | ||
733 | } | ||
734 | |||
788 | status = ath10k_hif_start(ar); | 735 | status = ath10k_hif_start(ar); |
789 | if (status) { | 736 | if (status) { |
790 | ath10k_err("could not start HIF: %d\n", status); | 737 | ath10k_err("could not start HIF: %d\n", status); |
791 | goto err_wmi_detach; | 738 | goto err_htt_rx_detach; |
792 | } | 739 | } |
793 | 740 | ||
794 | status = ath10k_htc_wait_target(&ar->htc); | 741 | status = ath10k_htc_wait_target(&ar->htc); |
@@ -797,15 +744,30 @@ int ath10k_core_start(struct ath10k *ar) | |||
797 | goto err_hif_stop; | 744 | goto err_hif_stop; |
798 | } | 745 | } |
799 | 746 | ||
800 | status = ath10k_htt_attach(ar); | 747 | status = ath10k_htt_connect(&ar->htt); |
801 | if (status) { | 748 | if (status) { |
802 | ath10k_err("could not attach htt (%d)\n", status); | 749 | ath10k_err("failed to connect htt (%d)\n", status); |
803 | goto err_hif_stop; | 750 | goto err_hif_stop; |
804 | } | 751 | } |
805 | 752 | ||
806 | status = ath10k_init_connect_htc(ar); | 753 | status = ath10k_wmi_connect(ar); |
807 | if (status) | 754 | if (status) { |
808 | goto err_htt_detach; | 755 | ath10k_err("could not connect wmi: %d\n", status); |
756 | goto err_hif_stop; | ||
757 | } | ||
758 | |||
759 | status = ath10k_htc_start(&ar->htc); | ||
760 | if (status) { | ||
761 | ath10k_err("failed to start htc: %d\n", status); | ||
762 | goto err_hif_stop; | ||
763 | } | ||
764 | |||
765 | status = ath10k_wmi_wait_for_service_ready(ar); | ||
766 | if (status <= 0) { | ||
767 | ath10k_warn("wmi service ready event not received"); | ||
768 | status = -ETIMEDOUT; | ||
769 | goto err_htc_stop; | ||
770 | } | ||
809 | 771 | ||
810 | ath10k_dbg(ATH10K_DBG_BOOT, "firmware %s booted\n", | 772 | ath10k_dbg(ATH10K_DBG_BOOT, "firmware %s booted\n", |
811 | ar->hw->wiphy->fw_version); | 773 | ar->hw->wiphy->fw_version); |
@@ -813,31 +775,36 @@ int ath10k_core_start(struct ath10k *ar) | |||
813 | status = ath10k_wmi_cmd_init(ar); | 775 | status = ath10k_wmi_cmd_init(ar); |
814 | if (status) { | 776 | if (status) { |
815 | ath10k_err("could not send WMI init command (%d)\n", status); | 777 | ath10k_err("could not send WMI init command (%d)\n", status); |
816 | goto err_disconnect_htc; | 778 | goto err_htc_stop; |
817 | } | 779 | } |
818 | 780 | ||
819 | status = ath10k_wmi_wait_for_unified_ready(ar); | 781 | status = ath10k_wmi_wait_for_unified_ready(ar); |
820 | if (status <= 0) { | 782 | if (status <= 0) { |
821 | ath10k_err("wmi unified ready event not received\n"); | 783 | ath10k_err("wmi unified ready event not received\n"); |
822 | status = -ETIMEDOUT; | 784 | status = -ETIMEDOUT; |
823 | goto err_disconnect_htc; | 785 | goto err_htc_stop; |
824 | } | 786 | } |
825 | 787 | ||
826 | status = ath10k_htt_attach_target(&ar->htt); | 788 | status = ath10k_htt_setup(&ar->htt); |
827 | if (status) | 789 | if (status) { |
828 | goto err_disconnect_htc; | 790 | ath10k_err("failed to setup htt: %d\n", status); |
791 | goto err_htc_stop; | ||
792 | } | ||
829 | 793 | ||
830 | status = ath10k_debug_start(ar); | 794 | status = ath10k_debug_start(ar); |
831 | if (status) | 795 | if (status) |
832 | goto err_disconnect_htc; | 796 | goto err_htc_stop; |
833 | 797 | ||
834 | ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1; | 798 | ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1; |
835 | INIT_LIST_HEAD(&ar->arvifs); | 799 | INIT_LIST_HEAD(&ar->arvifs); |
836 | 800 | ||
837 | if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags)) | 801 | if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags)) |
838 | ath10k_info("%s (0x%x) fw %s api %d htt %d.%d\n", | 802 | ath10k_info("%s (0x%08x, 0x%08x) fw %s api %d htt %d.%d\n", |
839 | ar->hw_params.name, ar->target_version, | 803 | ar->hw_params.name, |
840 | ar->hw->wiphy->fw_version, ar->fw_api, | 804 | ar->target_version, |
805 | ar->chip_id, | ||
806 | ar->hw->wiphy->fw_version, | ||
807 | ar->fw_api, | ||
841 | ar->htt.target_version_major, | 808 | ar->htt.target_version_major, |
842 | ar->htt.target_version_minor); | 809 | ar->htt.target_version_minor); |
843 | 810 | ||
@@ -845,12 +812,14 @@ int ath10k_core_start(struct ath10k *ar) | |||
845 | 812 | ||
846 | return 0; | 813 | return 0; |
847 | 814 | ||
848 | err_disconnect_htc: | 815 | err_htc_stop: |
849 | ath10k_htc_stop(&ar->htc); | 816 | ath10k_htc_stop(&ar->htc); |
850 | err_htt_detach: | ||
851 | ath10k_htt_detach(&ar->htt); | ||
852 | err_hif_stop: | 817 | err_hif_stop: |
853 | ath10k_hif_stop(ar); | 818 | ath10k_hif_stop(ar); |
819 | err_htt_rx_detach: | ||
820 | ath10k_htt_rx_free(&ar->htt); | ||
821 | err_htt_tx_detach: | ||
822 | ath10k_htt_tx_free(&ar->htt); | ||
854 | err_wmi_detach: | 823 | err_wmi_detach: |
855 | ath10k_wmi_detach(ar); | 824 | ath10k_wmi_detach(ar); |
856 | err: | 825 | err: |
@@ -885,10 +854,14 @@ void ath10k_core_stop(struct ath10k *ar) | |||
885 | lockdep_assert_held(&ar->conf_mutex); | 854 | lockdep_assert_held(&ar->conf_mutex); |
886 | 855 | ||
887 | /* try to suspend target */ | 856 | /* try to suspend target */ |
888 | ath10k_wait_for_suspend(ar, WMI_PDEV_SUSPEND_AND_DISABLE_INTR); | 857 | if (ar->state != ATH10K_STATE_RESTARTING) |
858 | ath10k_wait_for_suspend(ar, WMI_PDEV_SUSPEND_AND_DISABLE_INTR); | ||
859 | |||
889 | ath10k_debug_stop(ar); | 860 | ath10k_debug_stop(ar); |
890 | ath10k_htc_stop(&ar->htc); | 861 | ath10k_htc_stop(&ar->htc); |
891 | ath10k_htt_detach(&ar->htt); | 862 | ath10k_hif_stop(ar); |
863 | ath10k_htt_tx_free(&ar->htt); | ||
864 | ath10k_htt_rx_free(&ar->htt); | ||
892 | ath10k_wmi_detach(ar); | 865 | ath10k_wmi_detach(ar); |
893 | } | 866 | } |
894 | EXPORT_SYMBOL(ath10k_core_stop); | 867 | EXPORT_SYMBOL(ath10k_core_stop); |
@@ -980,22 +953,15 @@ static int ath10k_core_check_chip_id(struct ath10k *ar) | |||
980 | return 0; | 953 | return 0; |
981 | } | 954 | } |
982 | 955 | ||
983 | int ath10k_core_register(struct ath10k *ar, u32 chip_id) | 956 | static void ath10k_core_register_work(struct work_struct *work) |
984 | { | 957 | { |
958 | struct ath10k *ar = container_of(work, struct ath10k, register_work); | ||
985 | int status; | 959 | int status; |
986 | 960 | ||
987 | ar->chip_id = chip_id; | ||
988 | |||
989 | status = ath10k_core_check_chip_id(ar); | ||
990 | if (status) { | ||
991 | ath10k_err("Unsupported chip id 0x%08x\n", ar->chip_id); | ||
992 | return status; | ||
993 | } | ||
994 | |||
995 | status = ath10k_core_probe_fw(ar); | 961 | status = ath10k_core_probe_fw(ar); |
996 | if (status) { | 962 | if (status) { |
997 | ath10k_err("could not probe fw (%d)\n", status); | 963 | ath10k_err("could not probe fw (%d)\n", status); |
998 | return status; | 964 | goto err; |
999 | } | 965 | } |
1000 | 966 | ||
1001 | status = ath10k_mac_register(ar); | 967 | status = ath10k_mac_register(ar); |
@@ -1010,18 +976,43 @@ int ath10k_core_register(struct ath10k *ar, u32 chip_id) | |||
1010 | goto err_unregister_mac; | 976 | goto err_unregister_mac; |
1011 | } | 977 | } |
1012 | 978 | ||
1013 | return 0; | 979 | set_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags); |
980 | return; | ||
1014 | 981 | ||
1015 | err_unregister_mac: | 982 | err_unregister_mac: |
1016 | ath10k_mac_unregister(ar); | 983 | ath10k_mac_unregister(ar); |
1017 | err_release_fw: | 984 | err_release_fw: |
1018 | ath10k_core_free_firmware_files(ar); | 985 | ath10k_core_free_firmware_files(ar); |
1019 | return status; | 986 | err: |
987 | device_release_driver(ar->dev); | ||
988 | return; | ||
989 | } | ||
990 | |||
991 | int ath10k_core_register(struct ath10k *ar, u32 chip_id) | ||
992 | { | ||
993 | int status; | ||
994 | |||
995 | ar->chip_id = chip_id; | ||
996 | |||
997 | status = ath10k_core_check_chip_id(ar); | ||
998 | if (status) { | ||
999 | ath10k_err("Unsupported chip id 0x%08x\n", ar->chip_id); | ||
1000 | return status; | ||
1001 | } | ||
1002 | |||
1003 | queue_work(ar->workqueue, &ar->register_work); | ||
1004 | |||
1005 | return 0; | ||
1020 | } | 1006 | } |
1021 | EXPORT_SYMBOL(ath10k_core_register); | 1007 | EXPORT_SYMBOL(ath10k_core_register); |
1022 | 1008 | ||
1023 | void ath10k_core_unregister(struct ath10k *ar) | 1009 | void ath10k_core_unregister(struct ath10k *ar) |
1024 | { | 1010 | { |
1011 | cancel_work_sync(&ar->register_work); | ||
1012 | |||
1013 | if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) | ||
1014 | return; | ||
1015 | |||
1025 | /* We must unregister from mac80211 before we stop HTC and HIF. | 1016 | /* We must unregister from mac80211 before we stop HTC and HIF. |
1026 | * Otherwise we will fail to submit commands to FW and mac80211 will be | 1017 | * Otherwise we will fail to submit commands to FW and mac80211 will be |
1027 | * unhappy about callback failures. */ | 1018 | * unhappy about callback failures. */ |
@@ -1033,6 +1024,71 @@ void ath10k_core_unregister(struct ath10k *ar) | |||
1033 | } | 1024 | } |
1034 | EXPORT_SYMBOL(ath10k_core_unregister); | 1025 | EXPORT_SYMBOL(ath10k_core_unregister); |
1035 | 1026 | ||
1027 | struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev, | ||
1028 | const struct ath10k_hif_ops *hif_ops) | ||
1029 | { | ||
1030 | struct ath10k *ar; | ||
1031 | |||
1032 | ar = ath10k_mac_create(); | ||
1033 | if (!ar) | ||
1034 | return NULL; | ||
1035 | |||
1036 | ar->ath_common.priv = ar; | ||
1037 | ar->ath_common.hw = ar->hw; | ||
1038 | |||
1039 | ar->p2p = !!ath10k_p2p; | ||
1040 | ar->dev = dev; | ||
1041 | |||
1042 | ar->hif.priv = hif_priv; | ||
1043 | ar->hif.ops = hif_ops; | ||
1044 | |||
1045 | init_completion(&ar->scan.started); | ||
1046 | init_completion(&ar->scan.completed); | ||
1047 | init_completion(&ar->scan.on_channel); | ||
1048 | init_completion(&ar->target_suspend); | ||
1049 | |||
1050 | init_completion(&ar->install_key_done); | ||
1051 | init_completion(&ar->vdev_setup_done); | ||
1052 | |||
1053 | setup_timer(&ar->scan.timeout, ath10k_reset_scan, (unsigned long)ar); | ||
1054 | |||
1055 | ar->workqueue = create_singlethread_workqueue("ath10k_wq"); | ||
1056 | if (!ar->workqueue) | ||
1057 | goto err_wq; | ||
1058 | |||
1059 | mutex_init(&ar->conf_mutex); | ||
1060 | spin_lock_init(&ar->data_lock); | ||
1061 | |||
1062 | INIT_LIST_HEAD(&ar->peers); | ||
1063 | init_waitqueue_head(&ar->peer_mapping_wq); | ||
1064 | |||
1065 | init_completion(&ar->offchan_tx_completed); | ||
1066 | INIT_WORK(&ar->offchan_tx_work, ath10k_offchan_tx_work); | ||
1067 | skb_queue_head_init(&ar->offchan_tx_queue); | ||
1068 | |||
1069 | INIT_WORK(&ar->wmi_mgmt_tx_work, ath10k_mgmt_over_wmi_tx_work); | ||
1070 | skb_queue_head_init(&ar->wmi_mgmt_tx_queue); | ||
1071 | |||
1072 | INIT_WORK(&ar->register_work, ath10k_core_register_work); | ||
1073 | INIT_WORK(&ar->restart_work, ath10k_core_restart); | ||
1074 | |||
1075 | return ar; | ||
1076 | |||
1077 | err_wq: | ||
1078 | ath10k_mac_destroy(ar); | ||
1079 | return NULL; | ||
1080 | } | ||
1081 | EXPORT_SYMBOL(ath10k_core_create); | ||
1082 | |||
1083 | void ath10k_core_destroy(struct ath10k *ar) | ||
1084 | { | ||
1085 | flush_workqueue(ar->workqueue); | ||
1086 | destroy_workqueue(ar->workqueue); | ||
1087 | |||
1088 | ath10k_mac_destroy(ar); | ||
1089 | } | ||
1090 | EXPORT_SYMBOL(ath10k_core_destroy); | ||
1091 | |||
1036 | MODULE_AUTHOR("Qualcomm Atheros"); | 1092 | MODULE_AUTHOR("Qualcomm Atheros"); |
1037 | MODULE_DESCRIPTION("Core module for QCA988X PCIe devices."); | 1093 | MODULE_DESCRIPTION("Core module for QCA988X PCIe devices."); |
1038 | MODULE_LICENSE("Dual BSD/GPL"); | 1094 | MODULE_LICENSE("Dual BSD/GPL"); |
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 0e71979d837c..68ceef61933d 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h | |||
@@ -119,6 +119,7 @@ struct ath10k_peer_stat { | |||
119 | u8 peer_macaddr[ETH_ALEN]; | 119 | u8 peer_macaddr[ETH_ALEN]; |
120 | u32 peer_rssi; | 120 | u32 peer_rssi; |
121 | u32 peer_tx_rate; | 121 | u32 peer_tx_rate; |
122 | u32 peer_rx_rate; /* 10x only */ | ||
122 | }; | 123 | }; |
123 | 124 | ||
124 | struct ath10k_target_stats { | 125 | struct ath10k_target_stats { |
@@ -130,6 +131,12 @@ struct ath10k_target_stats { | |||
130 | u32 cycle_count; | 131 | u32 cycle_count; |
131 | u32 phy_err_count; | 132 | u32 phy_err_count; |
132 | u32 chan_tx_power; | 133 | u32 chan_tx_power; |
134 | u32 ack_rx_bad; | ||
135 | u32 rts_bad; | ||
136 | u32 rts_good; | ||
137 | u32 fcs_bad; | ||
138 | u32 no_beacons; | ||
139 | u32 mib_int_count; | ||
133 | 140 | ||
134 | /* PDEV TX stats */ | 141 | /* PDEV TX stats */ |
135 | s32 comp_queued; | 142 | s32 comp_queued; |
@@ -260,6 +267,8 @@ struct ath10k_vif { | |||
260 | u8 fixed_rate; | 267 | u8 fixed_rate; |
261 | u8 fixed_nss; | 268 | u8 fixed_nss; |
262 | u8 force_sgi; | 269 | u8 force_sgi; |
270 | bool use_cts_prot; | ||
271 | int num_legacy_stations; | ||
263 | }; | 272 | }; |
264 | 273 | ||
265 | struct ath10k_vif_iter { | 274 | struct ath10k_vif_iter { |
@@ -326,6 +335,7 @@ enum ath10k_dev_flags { | |||
326 | /* Indicates that ath10k device is during CAC phase of DFS */ | 335 | /* Indicates that ath10k device is during CAC phase of DFS */ |
327 | ATH10K_CAC_RUNNING, | 336 | ATH10K_CAC_RUNNING, |
328 | ATH10K_FLAG_FIRST_BOOT_DONE, | 337 | ATH10K_FLAG_FIRST_BOOT_DONE, |
338 | ATH10K_FLAG_CORE_REGISTERED, | ||
329 | }; | 339 | }; |
330 | 340 | ||
331 | struct ath10k { | 341 | struct ath10k { |
@@ -419,13 +429,24 @@ struct ath10k { | |||
419 | struct cfg80211_chan_def chandef; | 429 | struct cfg80211_chan_def chandef; |
420 | 430 | ||
421 | int free_vdev_map; | 431 | int free_vdev_map; |
432 | bool promisc; | ||
433 | bool monitor; | ||
422 | int monitor_vdev_id; | 434 | int monitor_vdev_id; |
423 | bool monitor_enabled; | 435 | bool monitor_started; |
424 | bool monitor_present; | ||
425 | unsigned int filter_flags; | 436 | unsigned int filter_flags; |
426 | unsigned long dev_flags; | 437 | unsigned long dev_flags; |
427 | u32 dfs_block_radar_events; | 438 | u32 dfs_block_radar_events; |
428 | 439 | ||
440 | /* protected by conf_mutex */ | ||
441 | bool radar_enabled; | ||
442 | int num_started_vdevs; | ||
443 | |||
444 | /* Protected by conf-mutex */ | ||
445 | u8 supp_tx_chainmask; | ||
446 | u8 supp_rx_chainmask; | ||
447 | u8 cfg_tx_chainmask; | ||
448 | u8 cfg_rx_chainmask; | ||
449 | |||
429 | struct wmi_pdev_set_wmm_params_arg wmm_params; | 450 | struct wmi_pdev_set_wmm_params_arg wmm_params; |
430 | struct completion install_key_done; | 451 | struct completion install_key_done; |
431 | 452 | ||
@@ -456,6 +477,7 @@ struct ath10k { | |||
456 | 477 | ||
457 | enum ath10k_state state; | 478 | enum ath10k_state state; |
458 | 479 | ||
480 | struct work_struct register_work; | ||
459 | struct work_struct restart_work; | 481 | struct work_struct restart_work; |
460 | 482 | ||
461 | /* cycle count is reported twice for each visited channel during scan. | 483 | /* cycle count is reported twice for each visited channel during scan. |
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 6debd281350a..1b7ff4ba122c 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c | |||
@@ -161,7 +161,7 @@ void ath10k_debug_read_target_stats(struct ath10k *ar, | |||
161 | u8 *tmp = ev->data; | 161 | u8 *tmp = ev->data; |
162 | struct ath10k_target_stats *stats; | 162 | struct ath10k_target_stats *stats; |
163 | int num_pdev_stats, num_vdev_stats, num_peer_stats; | 163 | int num_pdev_stats, num_vdev_stats, num_peer_stats; |
164 | struct wmi_pdev_stats *ps; | 164 | struct wmi_pdev_stats_10x *ps; |
165 | int i; | 165 | int i; |
166 | 166 | ||
167 | spin_lock_bh(&ar->data_lock); | 167 | spin_lock_bh(&ar->data_lock); |
@@ -173,7 +173,7 @@ void ath10k_debug_read_target_stats(struct ath10k *ar, | |||
173 | num_peer_stats = __le32_to_cpu(ev->num_peer_stats); /* 0 or max peers */ | 173 | num_peer_stats = __le32_to_cpu(ev->num_peer_stats); /* 0 or max peers */ |
174 | 174 | ||
175 | if (num_pdev_stats) { | 175 | if (num_pdev_stats) { |
176 | ps = (struct wmi_pdev_stats *)tmp; | 176 | ps = (struct wmi_pdev_stats_10x *)tmp; |
177 | 177 | ||
178 | stats->ch_noise_floor = __le32_to_cpu(ps->chan_nf); | 178 | stats->ch_noise_floor = __le32_to_cpu(ps->chan_nf); |
179 | stats->tx_frame_count = __le32_to_cpu(ps->tx_frame_count); | 179 | stats->tx_frame_count = __le32_to_cpu(ps->tx_frame_count); |
@@ -228,7 +228,18 @@ void ath10k_debug_read_target_stats(struct ath10k *ar, | |||
228 | stats->phy_err_drop = __le32_to_cpu(ps->wal.rx.phy_err_drop); | 228 | stats->phy_err_drop = __le32_to_cpu(ps->wal.rx.phy_err_drop); |
229 | stats->mpdu_errs = __le32_to_cpu(ps->wal.rx.mpdu_errs); | 229 | stats->mpdu_errs = __le32_to_cpu(ps->wal.rx.mpdu_errs); |
230 | 230 | ||
231 | tmp += sizeof(struct wmi_pdev_stats); | 231 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, |
232 | ar->fw_features)) { | ||
233 | stats->ack_rx_bad = __le32_to_cpu(ps->ack_rx_bad); | ||
234 | stats->rts_bad = __le32_to_cpu(ps->rts_bad); | ||
235 | stats->rts_good = __le32_to_cpu(ps->rts_good); | ||
236 | stats->fcs_bad = __le32_to_cpu(ps->fcs_bad); | ||
237 | stats->no_beacons = __le32_to_cpu(ps->no_beacons); | ||
238 | stats->mib_int_count = __le32_to_cpu(ps->mib_int_count); | ||
239 | tmp += sizeof(struct wmi_pdev_stats_10x); | ||
240 | } else { | ||
241 | tmp += sizeof(struct wmi_pdev_stats_old); | ||
242 | } | ||
232 | } | 243 | } |
233 | 244 | ||
234 | /* 0 or max vdevs */ | 245 | /* 0 or max vdevs */ |
@@ -243,22 +254,29 @@ void ath10k_debug_read_target_stats(struct ath10k *ar, | |||
243 | } | 254 | } |
244 | 255 | ||
245 | if (num_peer_stats) { | 256 | if (num_peer_stats) { |
246 | struct wmi_peer_stats *peer_stats; | 257 | struct wmi_peer_stats_10x *peer_stats; |
247 | struct ath10k_peer_stat *s; | 258 | struct ath10k_peer_stat *s; |
248 | 259 | ||
249 | stats->peers = num_peer_stats; | 260 | stats->peers = num_peer_stats; |
250 | 261 | ||
251 | for (i = 0; i < num_peer_stats; i++) { | 262 | for (i = 0; i < num_peer_stats; i++) { |
252 | peer_stats = (struct wmi_peer_stats *)tmp; | 263 | peer_stats = (struct wmi_peer_stats_10x *)tmp; |
253 | s = &stats->peer_stat[i]; | 264 | s = &stats->peer_stat[i]; |
254 | 265 | ||
255 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&peer_stats->peer_macaddr, | 266 | memcpy(s->peer_macaddr, &peer_stats->peer_macaddr.addr, |
256 | s->peer_macaddr); | 267 | ETH_ALEN); |
257 | s->peer_rssi = __le32_to_cpu(peer_stats->peer_rssi); | 268 | s->peer_rssi = __le32_to_cpu(peer_stats->peer_rssi); |
258 | s->peer_tx_rate = | 269 | s->peer_tx_rate = |
259 | __le32_to_cpu(peer_stats->peer_tx_rate); | 270 | __le32_to_cpu(peer_stats->peer_tx_rate); |
260 | 271 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, | |
261 | tmp += sizeof(struct wmi_peer_stats); | 272 | ar->fw_features)) { |
273 | s->peer_rx_rate = | ||
274 | __le32_to_cpu(peer_stats->peer_rx_rate); | ||
275 | tmp += sizeof(struct wmi_peer_stats_10x); | ||
276 | |||
277 | } else { | ||
278 | tmp += sizeof(struct wmi_peer_stats_old); | ||
279 | } | ||
262 | } | 280 | } |
263 | } | 281 | } |
264 | 282 | ||
@@ -272,7 +290,7 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf, | |||
272 | struct ath10k *ar = file->private_data; | 290 | struct ath10k *ar = file->private_data; |
273 | struct ath10k_target_stats *fw_stats; | 291 | struct ath10k_target_stats *fw_stats; |
274 | char *buf = NULL; | 292 | char *buf = NULL; |
275 | unsigned int len = 0, buf_len = 2500; | 293 | unsigned int len = 0, buf_len = 8000; |
276 | ssize_t ret_cnt = 0; | 294 | ssize_t ret_cnt = 0; |
277 | long left; | 295 | long left; |
278 | int i; | 296 | int i; |
@@ -320,6 +338,16 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf, | |||
320 | "Cycle count", fw_stats->cycle_count); | 338 | "Cycle count", fw_stats->cycle_count); |
321 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", | 339 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", |
322 | "PHY error count", fw_stats->phy_err_count); | 340 | "PHY error count", fw_stats->phy_err_count); |
341 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", | ||
342 | "RTS bad count", fw_stats->rts_bad); | ||
343 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", | ||
344 | "RTS good count", fw_stats->rts_good); | ||
345 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", | ||
346 | "FCS bad count", fw_stats->fcs_bad); | ||
347 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", | ||
348 | "No beacon count", fw_stats->no_beacons); | ||
349 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", | ||
350 | "MIB int count", fw_stats->mib_int_count); | ||
323 | 351 | ||
324 | len += scnprintf(buf + len, buf_len - len, "\n"); | 352 | len += scnprintf(buf + len, buf_len - len, "\n"); |
325 | len += scnprintf(buf + len, buf_len - len, "%30s\n", | 353 | len += scnprintf(buf + len, buf_len - len, "%30s\n", |
@@ -411,8 +439,8 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf, | |||
411 | "MPDU errors (FCS, MIC, ENC)", fw_stats->mpdu_errs); | 439 | "MPDU errors (FCS, MIC, ENC)", fw_stats->mpdu_errs); |
412 | 440 | ||
413 | len += scnprintf(buf + len, buf_len - len, "\n"); | 441 | len += scnprintf(buf + len, buf_len - len, "\n"); |
414 | len += scnprintf(buf + len, buf_len - len, "%30s\n", | 442 | len += scnprintf(buf + len, buf_len - len, "%30s (%d)\n", |
415 | "ath10k PEER stats"); | 443 | "ath10k PEER stats", fw_stats->peers); |
416 | len += scnprintf(buf + len, buf_len - len, "%30s\n\n", | 444 | len += scnprintf(buf + len, buf_len - len, "%30s\n\n", |
417 | "================="); | 445 | "================="); |
418 | 446 | ||
@@ -425,6 +453,9 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf, | |||
425 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", | 453 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", |
426 | "Peer TX rate", | 454 | "Peer TX rate", |
427 | fw_stats->peer_stat[i].peer_tx_rate); | 455 | fw_stats->peer_stat[i].peer_tx_rate); |
456 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", | ||
457 | "Peer RX rate", | ||
458 | fw_stats->peer_stat[i].peer_rx_rate); | ||
428 | len += scnprintf(buf + len, buf_len - len, "\n"); | 459 | len += scnprintf(buf + len, buf_len - len, "\n"); |
429 | } | 460 | } |
430 | spin_unlock_bh(&ar->data_lock); | 461 | spin_unlock_bh(&ar->data_lock); |
@@ -451,27 +482,37 @@ static ssize_t ath10k_read_simulate_fw_crash(struct file *file, | |||
451 | char __user *user_buf, | 482 | char __user *user_buf, |
452 | size_t count, loff_t *ppos) | 483 | size_t count, loff_t *ppos) |
453 | { | 484 | { |
454 | const char buf[] = "To simulate firmware crash write the keyword" | 485 | const char buf[] = "To simulate firmware crash write one of the" |
455 | " `crash` to this file.\nThis will force firmware" | 486 | " keywords to this file:\n `soft` - this will send" |
456 | " to report a crash to the host system.\n"; | 487 | " WMI_FORCE_FW_HANG_ASSERT to firmware if FW" |
488 | " supports that command.\n `hard` - this will send" | ||
489 | " to firmware command with illegal parameters" | ||
490 | " causing firmware crash.\n"; | ||
491 | |||
457 | return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); | 492 | return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); |
458 | } | 493 | } |
459 | 494 | ||
495 | /* Simulate firmware crash: | ||
496 | * 'soft': Call wmi command causing firmware hang. This firmware hang is | ||
497 | * recoverable by warm firmware reset. | ||
498 | * 'hard': Force firmware crash by setting any vdev parameter for not allowed | ||
499 | * vdev id. This is hard firmware crash because it is recoverable only by cold | ||
500 | * firmware reset. | ||
501 | */ | ||
460 | static ssize_t ath10k_write_simulate_fw_crash(struct file *file, | 502 | static ssize_t ath10k_write_simulate_fw_crash(struct file *file, |
461 | const char __user *user_buf, | 503 | const char __user *user_buf, |
462 | size_t count, loff_t *ppos) | 504 | size_t count, loff_t *ppos) |
463 | { | 505 | { |
464 | struct ath10k *ar = file->private_data; | 506 | struct ath10k *ar = file->private_data; |
465 | char buf[32] = {}; | 507 | char buf[32]; |
466 | int ret; | 508 | int ret; |
467 | 509 | ||
468 | mutex_lock(&ar->conf_mutex); | 510 | mutex_lock(&ar->conf_mutex); |
469 | 511 | ||
470 | simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); | 512 | simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); |
471 | if (strcmp(buf, "crash") && strcmp(buf, "crash\n")) { | 513 | |
472 | ret = -EINVAL; | 514 | /* make sure that buf is null terminated */ |
473 | goto exit; | 515 | buf[sizeof(buf) - 1] = 0; |
474 | } | ||
475 | 516 | ||
476 | if (ar->state != ATH10K_STATE_ON && | 517 | if (ar->state != ATH10K_STATE_ON && |
477 | ar->state != ATH10K_STATE_RESTARTED) { | 518 | ar->state != ATH10K_STATE_RESTARTED) { |
@@ -479,14 +520,30 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file, | |||
479 | goto exit; | 520 | goto exit; |
480 | } | 521 | } |
481 | 522 | ||
482 | ath10k_info("simulating firmware crash\n"); | 523 | /* drop the possible '\n' from the end */ |
524 | if (buf[count - 1] == '\n') { | ||
525 | buf[count - 1] = 0; | ||
526 | count--; | ||
527 | } | ||
483 | 528 | ||
484 | ret = ath10k_wmi_force_fw_hang(ar, WMI_FORCE_FW_HANG_ASSERT, 0); | 529 | if (!strcmp(buf, "soft")) { |
485 | if (ret) | 530 | ath10k_info("simulating soft firmware crash\n"); |
486 | ath10k_warn("failed to force fw hang (%d)\n", ret); | 531 | ret = ath10k_wmi_force_fw_hang(ar, WMI_FORCE_FW_HANG_ASSERT, 0); |
532 | } else if (!strcmp(buf, "hard")) { | ||
533 | ath10k_info("simulating hard firmware crash\n"); | ||
534 | ret = ath10k_wmi_vdev_set_param(ar, TARGET_NUM_VDEVS + 1, | ||
535 | ar->wmi.vdev_param->rts_threshold, 0); | ||
536 | } else { | ||
537 | ret = -EINVAL; | ||
538 | goto exit; | ||
539 | } | ||
540 | |||
541 | if (ret) { | ||
542 | ath10k_warn("failed to simulate firmware crash: %d\n", ret); | ||
543 | goto exit; | ||
544 | } | ||
487 | 545 | ||
488 | if (ret == 0) | 546 | ret = count; |
489 | ret = count; | ||
490 | 547 | ||
491 | exit: | 548 | exit: |
492 | mutex_unlock(&ar->conf_mutex); | 549 | mutex_unlock(&ar->conf_mutex); |
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c index 7f1bccd3597f..e493db4b4a41 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c | |||
@@ -157,6 +157,9 @@ int ath10k_htc_send(struct ath10k_htc *htc, | |||
157 | goto err_pull; | 157 | goto err_pull; |
158 | } | 158 | } |
159 | ep->tx_credits -= credits; | 159 | ep->tx_credits -= credits; |
160 | ath10k_dbg(ATH10K_DBG_HTC, | ||
161 | "htc ep %d consumed %d credits (total %d)\n", | ||
162 | eid, credits, ep->tx_credits); | ||
160 | spin_unlock_bh(&htc->tx_lock); | 163 | spin_unlock_bh(&htc->tx_lock); |
161 | } | 164 | } |
162 | 165 | ||
@@ -185,6 +188,9 @@ err_credits: | |||
185 | if (ep->tx_credit_flow_enabled) { | 188 | if (ep->tx_credit_flow_enabled) { |
186 | spin_lock_bh(&htc->tx_lock); | 189 | spin_lock_bh(&htc->tx_lock); |
187 | ep->tx_credits += credits; | 190 | ep->tx_credits += credits; |
191 | ath10k_dbg(ATH10K_DBG_HTC, | ||
192 | "htc ep %d reverted %d credits back (total %d)\n", | ||
193 | eid, credits, ep->tx_credits); | ||
188 | spin_unlock_bh(&htc->tx_lock); | 194 | spin_unlock_bh(&htc->tx_lock); |
189 | 195 | ||
190 | if (ep->ep_ops.ep_tx_credits) | 196 | if (ep->ep_ops.ep_tx_credits) |
@@ -234,12 +240,12 @@ ath10k_htc_process_credit_report(struct ath10k_htc *htc, | |||
234 | if (report->eid >= ATH10K_HTC_EP_COUNT) | 240 | if (report->eid >= ATH10K_HTC_EP_COUNT) |
235 | break; | 241 | break; |
236 | 242 | ||
237 | ath10k_dbg(ATH10K_DBG_HTC, "ep %d got %d credits\n", | ||
238 | report->eid, report->credits); | ||
239 | |||
240 | ep = &htc->endpoint[report->eid]; | 243 | ep = &htc->endpoint[report->eid]; |
241 | ep->tx_credits += report->credits; | 244 | ep->tx_credits += report->credits; |
242 | 245 | ||
246 | ath10k_dbg(ATH10K_DBG_HTC, "htc ep %d got %d credits (total %d)\n", | ||
247 | report->eid, report->credits, ep->tx_credits); | ||
248 | |||
243 | if (ep->ep_ops.ep_tx_credits) { | 249 | if (ep->ep_ops.ep_tx_credits) { |
244 | spin_unlock_bh(&htc->tx_lock); | 250 | spin_unlock_bh(&htc->tx_lock); |
245 | ep->ep_ops.ep_tx_credits(htc->ar); | 251 | ep->ep_ops.ep_tx_credits(htc->ar); |
@@ -824,17 +830,11 @@ int ath10k_htc_start(struct ath10k_htc *htc) | |||
824 | return 0; | 830 | return 0; |
825 | } | 831 | } |
826 | 832 | ||
827 | /* | ||
828 | * stop HTC communications, i.e. stop interrupt reception, and flush all | ||
829 | * queued buffers | ||
830 | */ | ||
831 | void ath10k_htc_stop(struct ath10k_htc *htc) | 833 | void ath10k_htc_stop(struct ath10k_htc *htc) |
832 | { | 834 | { |
833 | spin_lock_bh(&htc->tx_lock); | 835 | spin_lock_bh(&htc->tx_lock); |
834 | htc->stopped = true; | 836 | htc->stopped = true; |
835 | spin_unlock_bh(&htc->tx_lock); | 837 | spin_unlock_bh(&htc->tx_lock); |
836 | |||
837 | ath10k_hif_stop(htc->ar); | ||
838 | } | 838 | } |
839 | 839 | ||
840 | /* registered target arrival callback from the HIF layer */ | 840 | /* registered target arrival callback from the HIF layer */ |
diff --git a/drivers/net/wireless/ath/ath10k/htt.c b/drivers/net/wireless/ath/ath10k/htt.c index 69697af59ce0..19c12cc8d663 100644 --- a/drivers/net/wireless/ath/ath10k/htt.c +++ b/drivers/net/wireless/ath/ath10k/htt.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "core.h" | 22 | #include "core.h" |
23 | #include "debug.h" | 23 | #include "debug.h" |
24 | 24 | ||
25 | static int ath10k_htt_htc_attach(struct ath10k_htt *htt) | 25 | int ath10k_htt_connect(struct ath10k_htt *htt) |
26 | { | 26 | { |
27 | struct ath10k_htc_svc_conn_req conn_req; | 27 | struct ath10k_htc_svc_conn_req conn_req; |
28 | struct ath10k_htc_svc_conn_resp conn_resp; | 28 | struct ath10k_htc_svc_conn_resp conn_resp; |
@@ -48,39 +48,14 @@ static int ath10k_htt_htc_attach(struct ath10k_htt *htt) | |||
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | int ath10k_htt_attach(struct ath10k *ar) | 51 | int ath10k_htt_init(struct ath10k *ar) |
52 | { | 52 | { |
53 | struct ath10k_htt *htt = &ar->htt; | 53 | struct ath10k_htt *htt = &ar->htt; |
54 | int ret; | ||
55 | 54 | ||
56 | htt->ar = ar; | 55 | htt->ar = ar; |
57 | htt->max_throughput_mbps = 800; | 56 | htt->max_throughput_mbps = 800; |
58 | 57 | ||
59 | /* | 58 | /* |
60 | * Connect to HTC service. | ||
61 | * This has to be done before calling ath10k_htt_rx_attach, | ||
62 | * since ath10k_htt_rx_attach involves sending a rx ring configure | ||
63 | * message to the target. | ||
64 | */ | ||
65 | ret = ath10k_htt_htc_attach(htt); | ||
66 | if (ret) { | ||
67 | ath10k_err("could not attach htt htc (%d)\n", ret); | ||
68 | goto err_htc_attach; | ||
69 | } | ||
70 | |||
71 | ret = ath10k_htt_tx_attach(htt); | ||
72 | if (ret) { | ||
73 | ath10k_err("could not attach htt tx (%d)\n", ret); | ||
74 | goto err_htc_attach; | ||
75 | } | ||
76 | |||
77 | ret = ath10k_htt_rx_attach(htt); | ||
78 | if (ret) { | ||
79 | ath10k_err("could not attach htt rx (%d)\n", ret); | ||
80 | goto err_rx_attach; | ||
81 | } | ||
82 | |||
83 | /* | ||
84 | * Prefetch enough data to satisfy target | 59 | * Prefetch enough data to satisfy target |
85 | * classification engine. | 60 | * classification engine. |
86 | * This is for LL chips. HL chips will probably | 61 | * This is for LL chips. HL chips will probably |
@@ -93,11 +68,6 @@ int ath10k_htt_attach(struct ath10k *ar) | |||
93 | 2; /* ip4 dscp or ip6 priority */ | 68 | 2; /* ip4 dscp or ip6 priority */ |
94 | 69 | ||
95 | return 0; | 70 | return 0; |
96 | |||
97 | err_rx_attach: | ||
98 | ath10k_htt_tx_detach(htt); | ||
99 | err_htc_attach: | ||
100 | return ret; | ||
101 | } | 71 | } |
102 | 72 | ||
103 | #define HTT_TARGET_VERSION_TIMEOUT_HZ (3*HZ) | 73 | #define HTT_TARGET_VERSION_TIMEOUT_HZ (3*HZ) |
@@ -117,7 +87,7 @@ static int ath10k_htt_verify_version(struct ath10k_htt *htt) | |||
117 | return 0; | 87 | return 0; |
118 | } | 88 | } |
119 | 89 | ||
120 | int ath10k_htt_attach_target(struct ath10k_htt *htt) | 90 | int ath10k_htt_setup(struct ath10k_htt *htt) |
121 | { | 91 | { |
122 | int status; | 92 | int status; |
123 | 93 | ||
@@ -140,9 +110,3 @@ int ath10k_htt_attach_target(struct ath10k_htt *htt) | |||
140 | 110 | ||
141 | return ath10k_htt_send_rx_ring_cfg_ll(htt); | 111 | return ath10k_htt_send_rx_ring_cfg_ll(htt); |
142 | } | 112 | } |
143 | |||
144 | void ath10k_htt_detach(struct ath10k_htt *htt) | ||
145 | { | ||
146 | ath10k_htt_rx_detach(htt); | ||
147 | ath10k_htt_tx_detach(htt); | ||
148 | } | ||
diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h index 654867fc1ae7..9a263462c793 100644 --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/bug.h> | 21 | #include <linux/bug.h> |
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/dmapool.h> | 23 | #include <linux/dmapool.h> |
24 | #include <net/mac80211.h> | ||
24 | 25 | ||
25 | #include "htc.h" | 26 | #include "htc.h" |
26 | #include "rx_desc.h" | 27 | #include "rx_desc.h" |
@@ -1172,23 +1173,6 @@ struct htt_peer_unmap_event { | |||
1172 | u16 peer_id; | 1173 | u16 peer_id; |
1173 | }; | 1174 | }; |
1174 | 1175 | ||
1175 | struct htt_rx_info { | ||
1176 | struct sk_buff *skb; | ||
1177 | enum htt_rx_mpdu_status status; | ||
1178 | enum htt_rx_mpdu_encrypt_type encrypt_type; | ||
1179 | s8 signal; | ||
1180 | struct { | ||
1181 | u8 info0; | ||
1182 | u32 info1; | ||
1183 | u32 info2; | ||
1184 | } rate; | ||
1185 | |||
1186 | u32 tsf; | ||
1187 | bool fcs_err; | ||
1188 | bool amsdu_more; | ||
1189 | bool mic_err; | ||
1190 | }; | ||
1191 | |||
1192 | struct ath10k_htt_txbuf { | 1176 | struct ath10k_htt_txbuf { |
1193 | struct htt_data_tx_desc_frag frags[2]; | 1177 | struct htt_data_tx_desc_frag frags[2]; |
1194 | struct ath10k_htc_hdr htc_hdr; | 1178 | struct ath10k_htc_hdr htc_hdr; |
@@ -1289,6 +1273,9 @@ struct ath10k_htt { | |||
1289 | struct tasklet_struct txrx_compl_task; | 1273 | struct tasklet_struct txrx_compl_task; |
1290 | struct sk_buff_head tx_compl_q; | 1274 | struct sk_buff_head tx_compl_q; |
1291 | struct sk_buff_head rx_compl_q; | 1275 | struct sk_buff_head rx_compl_q; |
1276 | |||
1277 | /* rx_status template */ | ||
1278 | struct ieee80211_rx_status rx_status; | ||
1292 | }; | 1279 | }; |
1293 | 1280 | ||
1294 | #define RX_HTT_HDR_STATUS_LEN 64 | 1281 | #define RX_HTT_HDR_STATUS_LEN 64 |
@@ -1341,14 +1328,16 @@ struct htt_rx_desc { | |||
1341 | #define HTT_LOG2_MAX_CACHE_LINE_SIZE 7 /* 2^7 = 128 */ | 1328 | #define HTT_LOG2_MAX_CACHE_LINE_SIZE 7 /* 2^7 = 128 */ |
1342 | #define HTT_MAX_CACHE_LINE_SIZE_MASK ((1 << HTT_LOG2_MAX_CACHE_LINE_SIZE) - 1) | 1329 | #define HTT_MAX_CACHE_LINE_SIZE_MASK ((1 << HTT_LOG2_MAX_CACHE_LINE_SIZE) - 1) |
1343 | 1330 | ||
1344 | int ath10k_htt_attach(struct ath10k *ar); | 1331 | int ath10k_htt_connect(struct ath10k_htt *htt); |
1345 | int ath10k_htt_attach_target(struct ath10k_htt *htt); | 1332 | int ath10k_htt_init(struct ath10k *ar); |
1346 | void ath10k_htt_detach(struct ath10k_htt *htt); | 1333 | int ath10k_htt_setup(struct ath10k_htt *htt); |
1334 | |||
1335 | int ath10k_htt_tx_alloc(struct ath10k_htt *htt); | ||
1336 | void ath10k_htt_tx_free(struct ath10k_htt *htt); | ||
1337 | |||
1338 | int ath10k_htt_rx_alloc(struct ath10k_htt *htt); | ||
1339 | void ath10k_htt_rx_free(struct ath10k_htt *htt); | ||
1347 | 1340 | ||
1348 | int ath10k_htt_tx_attach(struct ath10k_htt *htt); | ||
1349 | void ath10k_htt_tx_detach(struct ath10k_htt *htt); | ||
1350 | int ath10k_htt_rx_attach(struct ath10k_htt *htt); | ||
1351 | void ath10k_htt_rx_detach(struct ath10k_htt *htt); | ||
1352 | void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb); | 1341 | void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb); |
1353 | void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb); | 1342 | void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb); |
1354 | int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt); | 1343 | int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt); |
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index cdcbe2de95f9..6c102b1312ff 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c | |||
@@ -225,10 +225,26 @@ static void ath10k_htt_rx_ring_refill_retry(unsigned long arg) | |||
225 | ath10k_htt_rx_msdu_buff_replenish(htt); | 225 | ath10k_htt_rx_msdu_buff_replenish(htt); |
226 | } | 226 | } |
227 | 227 | ||
228 | void ath10k_htt_rx_detach(struct ath10k_htt *htt) | 228 | static void ath10k_htt_rx_ring_clean_up(struct ath10k_htt *htt) |
229 | { | 229 | { |
230 | int sw_rd_idx = htt->rx_ring.sw_rd_idx.msdu_payld; | 230 | struct sk_buff *skb; |
231 | int i; | ||
232 | |||
233 | for (i = 0; i < htt->rx_ring.size; i++) { | ||
234 | skb = htt->rx_ring.netbufs_ring[i]; | ||
235 | if (!skb) | ||
236 | continue; | ||
231 | 237 | ||
238 | dma_unmap_single(htt->ar->dev, ATH10K_SKB_CB(skb)->paddr, | ||
239 | skb->len + skb_tailroom(skb), | ||
240 | DMA_FROM_DEVICE); | ||
241 | dev_kfree_skb_any(skb); | ||
242 | htt->rx_ring.netbufs_ring[i] = NULL; | ||
243 | } | ||
244 | } | ||
245 | |||
246 | void ath10k_htt_rx_free(struct ath10k_htt *htt) | ||
247 | { | ||
232 | del_timer_sync(&htt->rx_ring.refill_retry_timer); | 248 | del_timer_sync(&htt->rx_ring.refill_retry_timer); |
233 | tasklet_kill(&htt->rx_replenish_task); | 249 | tasklet_kill(&htt->rx_replenish_task); |
234 | tasklet_kill(&htt->txrx_compl_task); | 250 | tasklet_kill(&htt->txrx_compl_task); |
@@ -236,18 +252,7 @@ void ath10k_htt_rx_detach(struct ath10k_htt *htt) | |||
236 | skb_queue_purge(&htt->tx_compl_q); | 252 | skb_queue_purge(&htt->tx_compl_q); |
237 | skb_queue_purge(&htt->rx_compl_q); | 253 | skb_queue_purge(&htt->rx_compl_q); |
238 | 254 | ||
239 | while (sw_rd_idx != __le32_to_cpu(*(htt->rx_ring.alloc_idx.vaddr))) { | 255 | ath10k_htt_rx_ring_clean_up(htt); |
240 | struct sk_buff *skb = | ||
241 | htt->rx_ring.netbufs_ring[sw_rd_idx]; | ||
242 | struct ath10k_skb_cb *cb = ATH10K_SKB_CB(skb); | ||
243 | |||
244 | dma_unmap_single(htt->ar->dev, cb->paddr, | ||
245 | skb->len + skb_tailroom(skb), | ||
246 | DMA_FROM_DEVICE); | ||
247 | dev_kfree_skb_any(htt->rx_ring.netbufs_ring[sw_rd_idx]); | ||
248 | sw_rd_idx++; | ||
249 | sw_rd_idx &= htt->rx_ring.size_mask; | ||
250 | } | ||
251 | 256 | ||
252 | dma_free_coherent(htt->ar->dev, | 257 | dma_free_coherent(htt->ar->dev, |
253 | (htt->rx_ring.size * | 258 | (htt->rx_ring.size * |
@@ -277,6 +282,7 @@ static inline struct sk_buff *ath10k_htt_rx_netbuf_pop(struct ath10k_htt *htt) | |||
277 | 282 | ||
278 | idx = htt->rx_ring.sw_rd_idx.msdu_payld; | 283 | idx = htt->rx_ring.sw_rd_idx.msdu_payld; |
279 | msdu = htt->rx_ring.netbufs_ring[idx]; | 284 | msdu = htt->rx_ring.netbufs_ring[idx]; |
285 | htt->rx_ring.netbufs_ring[idx] = NULL; | ||
280 | 286 | ||
281 | idx++; | 287 | idx++; |
282 | idx &= htt->rx_ring.size_mask; | 288 | idx &= htt->rx_ring.size_mask; |
@@ -297,6 +303,7 @@ static void ath10k_htt_rx_free_msdu_chain(struct sk_buff *skb) | |||
297 | } | 303 | } |
298 | } | 304 | } |
299 | 305 | ||
306 | /* return: < 0 fatal error, 0 - non chained msdu, 1 chained msdu */ | ||
300 | static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | 307 | static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, |
301 | u8 **fw_desc, int *fw_desc_len, | 308 | u8 **fw_desc, int *fw_desc_len, |
302 | struct sk_buff **head_msdu, | 309 | struct sk_buff **head_msdu, |
@@ -305,12 +312,13 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | |||
305 | int msdu_len, msdu_chaining = 0; | 312 | int msdu_len, msdu_chaining = 0; |
306 | struct sk_buff *msdu; | 313 | struct sk_buff *msdu; |
307 | struct htt_rx_desc *rx_desc; | 314 | struct htt_rx_desc *rx_desc; |
315 | bool corrupted = false; | ||
308 | 316 | ||
309 | lockdep_assert_held(&htt->rx_ring.lock); | 317 | lockdep_assert_held(&htt->rx_ring.lock); |
310 | 318 | ||
311 | if (htt->rx_confused) { | 319 | if (htt->rx_confused) { |
312 | ath10k_warn("htt is confused. refusing rx\n"); | 320 | ath10k_warn("htt is confused. refusing rx\n"); |
313 | return 0; | 321 | return -1; |
314 | } | 322 | } |
315 | 323 | ||
316 | msdu = *head_msdu = ath10k_htt_rx_netbuf_pop(htt); | 324 | msdu = *head_msdu = ath10k_htt_rx_netbuf_pop(htt); |
@@ -398,7 +406,6 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | |||
398 | msdu_len = MS(__le32_to_cpu(rx_desc->msdu_start.info0), | 406 | msdu_len = MS(__le32_to_cpu(rx_desc->msdu_start.info0), |
399 | RX_MSDU_START_INFO0_MSDU_LENGTH); | 407 | RX_MSDU_START_INFO0_MSDU_LENGTH); |
400 | msdu_chained = rx_desc->frag_info.ring2_more_count; | 408 | msdu_chained = rx_desc->frag_info.ring2_more_count; |
401 | msdu_chaining = msdu_chained; | ||
402 | 409 | ||
403 | if (msdu_len_invalid) | 410 | if (msdu_len_invalid) |
404 | msdu_len = 0; | 411 | msdu_len = 0; |
@@ -426,11 +433,15 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | |||
426 | 433 | ||
427 | msdu->next = next; | 434 | msdu->next = next; |
428 | msdu = next; | 435 | msdu = next; |
436 | msdu_chaining = 1; | ||
429 | } | 437 | } |
430 | 438 | ||
431 | last_msdu = __le32_to_cpu(rx_desc->msdu_end.info0) & | 439 | last_msdu = __le32_to_cpu(rx_desc->msdu_end.info0) & |
432 | RX_MSDU_END_INFO0_LAST_MSDU; | 440 | RX_MSDU_END_INFO0_LAST_MSDU; |
433 | 441 | ||
442 | if (msdu_chaining && !last_msdu) | ||
443 | corrupted = true; | ||
444 | |||
434 | if (last_msdu) { | 445 | if (last_msdu) { |
435 | msdu->next = NULL; | 446 | msdu->next = NULL; |
436 | break; | 447 | break; |
@@ -442,6 +453,23 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | |||
442 | } | 453 | } |
443 | *tail_msdu = msdu; | 454 | *tail_msdu = msdu; |
444 | 455 | ||
456 | if (*head_msdu == NULL) | ||
457 | msdu_chaining = -1; | ||
458 | |||
459 | /* | ||
460 | * Apparently FW sometimes reports weird chained MSDU sequences with | ||
461 | * more than one rx descriptor. This seems like a bug but needs more | ||
462 | * analyzing. For the time being fix it by dropping such sequences to | ||
463 | * avoid blowing up the host system. | ||
464 | */ | ||
465 | if (corrupted) { | ||
466 | ath10k_warn("failed to pop chained msdus, dropping\n"); | ||
467 | ath10k_htt_rx_free_msdu_chain(*head_msdu); | ||
468 | *head_msdu = NULL; | ||
469 | *tail_msdu = NULL; | ||
470 | msdu_chaining = -EINVAL; | ||
471 | } | ||
472 | |||
445 | /* | 473 | /* |
446 | * Don't refill the ring yet. | 474 | * Don't refill the ring yet. |
447 | * | 475 | * |
@@ -464,7 +492,7 @@ static void ath10k_htt_rx_replenish_task(unsigned long ptr) | |||
464 | ath10k_htt_rx_msdu_buff_replenish(htt); | 492 | ath10k_htt_rx_msdu_buff_replenish(htt); |
465 | } | 493 | } |
466 | 494 | ||
467 | int ath10k_htt_rx_attach(struct ath10k_htt *htt) | 495 | int ath10k_htt_rx_alloc(struct ath10k_htt *htt) |
468 | { | 496 | { |
469 | dma_addr_t paddr; | 497 | dma_addr_t paddr; |
470 | void *vaddr; | 498 | void *vaddr; |
@@ -490,7 +518,7 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt) | |||
490 | htt->rx_ring.fill_level = ath10k_htt_rx_ring_fill_level(htt); | 518 | htt->rx_ring.fill_level = ath10k_htt_rx_ring_fill_level(htt); |
491 | 519 | ||
492 | htt->rx_ring.netbufs_ring = | 520 | htt->rx_ring.netbufs_ring = |
493 | kmalloc(htt->rx_ring.size * sizeof(struct sk_buff *), | 521 | kzalloc(htt->rx_ring.size * sizeof(struct sk_buff *), |
494 | GFP_KERNEL); | 522 | GFP_KERNEL); |
495 | if (!htt->rx_ring.netbufs_ring) | 523 | if (!htt->rx_ring.netbufs_ring) |
496 | goto err_netbuf; | 524 | goto err_netbuf; |
@@ -636,6 +664,203 @@ struct amsdu_subframe_hdr { | |||
636 | __be16 len; | 664 | __be16 len; |
637 | } __packed; | 665 | } __packed; |
638 | 666 | ||
667 | static const u8 rx_legacy_rate_idx[] = { | ||
668 | 3, /* 0x00 - 11Mbps */ | ||
669 | 2, /* 0x01 - 5.5Mbps */ | ||
670 | 1, /* 0x02 - 2Mbps */ | ||
671 | 0, /* 0x03 - 1Mbps */ | ||
672 | 3, /* 0x04 - 11Mbps */ | ||
673 | 2, /* 0x05 - 5.5Mbps */ | ||
674 | 1, /* 0x06 - 2Mbps */ | ||
675 | 0, /* 0x07 - 1Mbps */ | ||
676 | 10, /* 0x08 - 48Mbps */ | ||
677 | 8, /* 0x09 - 24Mbps */ | ||
678 | 6, /* 0x0A - 12Mbps */ | ||
679 | 4, /* 0x0B - 6Mbps */ | ||
680 | 11, /* 0x0C - 54Mbps */ | ||
681 | 9, /* 0x0D - 36Mbps */ | ||
682 | 7, /* 0x0E - 18Mbps */ | ||
683 | 5, /* 0x0F - 9Mbps */ | ||
684 | }; | ||
685 | |||
686 | static void ath10k_htt_rx_h_rates(struct ath10k *ar, | ||
687 | enum ieee80211_band band, | ||
688 | u8 info0, u32 info1, u32 info2, | ||
689 | struct ieee80211_rx_status *status) | ||
690 | { | ||
691 | u8 cck, rate, rate_idx, bw, sgi, mcs, nss; | ||
692 | u8 preamble = 0; | ||
693 | |||
694 | /* Check if valid fields */ | ||
695 | if (!(info0 & HTT_RX_INDICATION_INFO0_START_VALID)) | ||
696 | return; | ||
697 | |||
698 | preamble = MS(info1, HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE); | ||
699 | |||
700 | switch (preamble) { | ||
701 | case HTT_RX_LEGACY: | ||
702 | cck = info0 & HTT_RX_INDICATION_INFO0_LEGACY_RATE_CCK; | ||
703 | rate = MS(info0, HTT_RX_INDICATION_INFO0_LEGACY_RATE); | ||
704 | rate_idx = 0; | ||
705 | |||
706 | if (rate < 0x08 || rate > 0x0F) | ||
707 | break; | ||
708 | |||
709 | switch (band) { | ||
710 | case IEEE80211_BAND_2GHZ: | ||
711 | if (cck) | ||
712 | rate &= ~BIT(3); | ||
713 | rate_idx = rx_legacy_rate_idx[rate]; | ||
714 | break; | ||
715 | case IEEE80211_BAND_5GHZ: | ||
716 | rate_idx = rx_legacy_rate_idx[rate]; | ||
717 | /* We are using same rate table registering | ||
718 | HW - ath10k_rates[]. In case of 5GHz skip | ||
719 | CCK rates, so -4 here */ | ||
720 | rate_idx -= 4; | ||
721 | break; | ||
722 | default: | ||
723 | break; | ||
724 | } | ||
725 | |||
726 | status->rate_idx = rate_idx; | ||
727 | break; | ||
728 | case HTT_RX_HT: | ||
729 | case HTT_RX_HT_WITH_TXBF: | ||
730 | /* HT-SIG - Table 20-11 in info1 and info2 */ | ||
731 | mcs = info1 & 0x1F; | ||
732 | nss = mcs >> 3; | ||
733 | bw = (info1 >> 7) & 1; | ||
734 | sgi = (info2 >> 7) & 1; | ||
735 | |||
736 | status->rate_idx = mcs; | ||
737 | status->flag |= RX_FLAG_HT; | ||
738 | if (sgi) | ||
739 | status->flag |= RX_FLAG_SHORT_GI; | ||
740 | if (bw) | ||
741 | status->flag |= RX_FLAG_40MHZ; | ||
742 | break; | ||
743 | case HTT_RX_VHT: | ||
744 | case HTT_RX_VHT_WITH_TXBF: | ||
745 | /* VHT-SIG-A1 in info 1, VHT-SIG-A2 in info2 | ||
746 | TODO check this */ | ||
747 | mcs = (info2 >> 4) & 0x0F; | ||
748 | nss = ((info1 >> 10) & 0x07) + 1; | ||
749 | bw = info1 & 3; | ||
750 | sgi = info2 & 1; | ||
751 | |||
752 | status->rate_idx = mcs; | ||
753 | status->vht_nss = nss; | ||
754 | |||
755 | if (sgi) | ||
756 | status->flag |= RX_FLAG_SHORT_GI; | ||
757 | |||
758 | switch (bw) { | ||
759 | /* 20MHZ */ | ||
760 | case 0: | ||
761 | break; | ||
762 | /* 40MHZ */ | ||
763 | case 1: | ||
764 | status->flag |= RX_FLAG_40MHZ; | ||
765 | break; | ||
766 | /* 80MHZ */ | ||
767 | case 2: | ||
768 | status->vht_flag |= RX_VHT_FLAG_80MHZ; | ||
769 | } | ||
770 | |||
771 | status->flag |= RX_FLAG_VHT; | ||
772 | break; | ||
773 | default: | ||
774 | break; | ||
775 | } | ||
776 | } | ||
777 | |||
778 | static void ath10k_htt_rx_h_protected(struct ath10k_htt *htt, | ||
779 | struct ieee80211_rx_status *rx_status, | ||
780 | struct sk_buff *skb, | ||
781 | enum htt_rx_mpdu_encrypt_type enctype, | ||
782 | enum rx_msdu_decap_format fmt, | ||
783 | bool dot11frag) | ||
784 | { | ||
785 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
786 | |||
787 | rx_status->flag &= ~(RX_FLAG_DECRYPTED | | ||
788 | RX_FLAG_IV_STRIPPED | | ||
789 | RX_FLAG_MMIC_STRIPPED); | ||
790 | |||
791 | if (enctype == HTT_RX_MPDU_ENCRYPT_NONE) | ||
792 | return; | ||
793 | |||
794 | /* | ||
795 | * There's no explicit rx descriptor flag to indicate whether a given | ||
796 | * frame has been decrypted or not. We're forced to use the decap | ||
797 | * format as an implicit indication. However fragmentation rx is always | ||
798 | * raw and it probably never reports undecrypted raws. | ||
799 | * | ||
800 | * This makes sure sniffed frames are reported as-is without stripping | ||
801 | * the protected flag. | ||
802 | */ | ||
803 | if (fmt == RX_MSDU_DECAP_RAW && !dot11frag) | ||
804 | return; | ||
805 | |||
806 | rx_status->flag |= RX_FLAG_DECRYPTED | | ||
807 | RX_FLAG_IV_STRIPPED | | ||
808 | RX_FLAG_MMIC_STRIPPED; | ||
809 | hdr->frame_control = __cpu_to_le16(__le16_to_cpu(hdr->frame_control) & | ||
810 | ~IEEE80211_FCTL_PROTECTED); | ||
811 | } | ||
812 | |||
813 | static bool ath10k_htt_rx_h_channel(struct ath10k *ar, | ||
814 | struct ieee80211_rx_status *status) | ||
815 | { | ||
816 | struct ieee80211_channel *ch; | ||
817 | |||
818 | spin_lock_bh(&ar->data_lock); | ||
819 | ch = ar->scan_channel; | ||
820 | if (!ch) | ||
821 | ch = ar->rx_channel; | ||
822 | spin_unlock_bh(&ar->data_lock); | ||
823 | |||
824 | if (!ch) | ||
825 | return false; | ||
826 | |||
827 | status->band = ch->band; | ||
828 | status->freq = ch->center_freq; | ||
829 | |||
830 | return true; | ||
831 | } | ||
832 | |||
833 | static void ath10k_process_rx(struct ath10k *ar, | ||
834 | struct ieee80211_rx_status *rx_status, | ||
835 | struct sk_buff *skb) | ||
836 | { | ||
837 | struct ieee80211_rx_status *status; | ||
838 | |||
839 | status = IEEE80211_SKB_RXCB(skb); | ||
840 | *status = *rx_status; | ||
841 | |||
842 | ath10k_dbg(ATH10K_DBG_DATA, | ||
843 | "rx skb %p len %u %s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %imic-err %i\n", | ||
844 | skb, | ||
845 | skb->len, | ||
846 | status->flag == 0 ? "legacy" : "", | ||
847 | status->flag & RX_FLAG_HT ? "ht" : "", | ||
848 | status->flag & RX_FLAG_VHT ? "vht" : "", | ||
849 | status->flag & RX_FLAG_40MHZ ? "40" : "", | ||
850 | status->vht_flag & RX_VHT_FLAG_80MHZ ? "80" : "", | ||
851 | status->flag & RX_FLAG_SHORT_GI ? "sgi " : "", | ||
852 | status->rate_idx, | ||
853 | status->vht_nss, | ||
854 | status->freq, | ||
855 | status->band, status->flag, | ||
856 | !!(status->flag & RX_FLAG_FAILED_FCS_CRC), | ||
857 | !!(status->flag & RX_FLAG_MMIC_ERROR)); | ||
858 | ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "rx skb: ", | ||
859 | skb->data, skb->len); | ||
860 | |||
861 | ieee80211_rx(ar->hw, skb); | ||
862 | } | ||
863 | |||
639 | static int ath10k_htt_rx_nwifi_hdrlen(struct ieee80211_hdr *hdr) | 864 | static int ath10k_htt_rx_nwifi_hdrlen(struct ieee80211_hdr *hdr) |
640 | { | 865 | { |
641 | /* nwifi header is padded to 4 bytes. this fixes 4addr rx */ | 866 | /* nwifi header is padded to 4 bytes. this fixes 4addr rx */ |
@@ -643,11 +868,12 @@ static int ath10k_htt_rx_nwifi_hdrlen(struct ieee80211_hdr *hdr) | |||
643 | } | 868 | } |
644 | 869 | ||
645 | static void ath10k_htt_rx_amsdu(struct ath10k_htt *htt, | 870 | static void ath10k_htt_rx_amsdu(struct ath10k_htt *htt, |
646 | struct htt_rx_info *info) | 871 | struct ieee80211_rx_status *rx_status, |
872 | struct sk_buff *skb_in) | ||
647 | { | 873 | { |
648 | struct htt_rx_desc *rxd; | 874 | struct htt_rx_desc *rxd; |
875 | struct sk_buff *skb = skb_in; | ||
649 | struct sk_buff *first; | 876 | struct sk_buff *first; |
650 | struct sk_buff *skb = info->skb; | ||
651 | enum rx_msdu_decap_format fmt; | 877 | enum rx_msdu_decap_format fmt; |
652 | enum htt_rx_mpdu_encrypt_type enctype; | 878 | enum htt_rx_mpdu_encrypt_type enctype; |
653 | struct ieee80211_hdr *hdr; | 879 | struct ieee80211_hdr *hdr; |
@@ -728,24 +954,28 @@ static void ath10k_htt_rx_amsdu(struct ath10k_htt *htt, | |||
728 | break; | 954 | break; |
729 | } | 955 | } |
730 | 956 | ||
731 | info->skb = skb; | 957 | skb_in = skb; |
732 | info->encrypt_type = enctype; | 958 | ath10k_htt_rx_h_protected(htt, rx_status, skb_in, enctype, fmt, |
959 | false); | ||
733 | skb = skb->next; | 960 | skb = skb->next; |
734 | info->skb->next = NULL; | 961 | skb_in->next = NULL; |
735 | 962 | ||
736 | if (skb) | 963 | if (skb) |
737 | info->amsdu_more = true; | 964 | rx_status->flag |= RX_FLAG_AMSDU_MORE; |
965 | else | ||
966 | rx_status->flag &= ~RX_FLAG_AMSDU_MORE; | ||
738 | 967 | ||
739 | ath10k_process_rx(htt->ar, info); | 968 | ath10k_process_rx(htt->ar, rx_status, skb_in); |
740 | } | 969 | } |
741 | 970 | ||
742 | /* FIXME: It might be nice to re-assemble the A-MSDU when there's a | 971 | /* FIXME: It might be nice to re-assemble the A-MSDU when there's a |
743 | * monitor interface active for sniffing purposes. */ | 972 | * monitor interface active for sniffing purposes. */ |
744 | } | 973 | } |
745 | 974 | ||
746 | static void ath10k_htt_rx_msdu(struct ath10k_htt *htt, struct htt_rx_info *info) | 975 | static void ath10k_htt_rx_msdu(struct ath10k_htt *htt, |
976 | struct ieee80211_rx_status *rx_status, | ||
977 | struct sk_buff *skb) | ||
747 | { | 978 | { |
748 | struct sk_buff *skb = info->skb; | ||
749 | struct htt_rx_desc *rxd; | 979 | struct htt_rx_desc *rxd; |
750 | struct ieee80211_hdr *hdr; | 980 | struct ieee80211_hdr *hdr; |
751 | enum rx_msdu_decap_format fmt; | 981 | enum rx_msdu_decap_format fmt; |
@@ -808,66 +1038,9 @@ static void ath10k_htt_rx_msdu(struct ath10k_htt *htt, struct htt_rx_info *info) | |||
808 | break; | 1038 | break; |
809 | } | 1039 | } |
810 | 1040 | ||
811 | info->skb = skb; | 1041 | ath10k_htt_rx_h_protected(htt, rx_status, skb, enctype, fmt, false); |
812 | info->encrypt_type = enctype; | ||
813 | 1042 | ||
814 | ath10k_process_rx(htt->ar, info); | 1043 | ath10k_process_rx(htt->ar, rx_status, skb); |
815 | } | ||
816 | |||
817 | static bool ath10k_htt_rx_has_decrypt_err(struct sk_buff *skb) | ||
818 | { | ||
819 | struct htt_rx_desc *rxd; | ||
820 | u32 flags; | ||
821 | |||
822 | rxd = (void *)skb->data - sizeof(*rxd); | ||
823 | flags = __le32_to_cpu(rxd->attention.flags); | ||
824 | |||
825 | if (flags & RX_ATTENTION_FLAGS_DECRYPT_ERR) | ||
826 | return true; | ||
827 | |||
828 | return false; | ||
829 | } | ||
830 | |||
831 | static bool ath10k_htt_rx_has_fcs_err(struct sk_buff *skb) | ||
832 | { | ||
833 | struct htt_rx_desc *rxd; | ||
834 | u32 flags; | ||
835 | |||
836 | rxd = (void *)skb->data - sizeof(*rxd); | ||
837 | flags = __le32_to_cpu(rxd->attention.flags); | ||
838 | |||
839 | if (flags & RX_ATTENTION_FLAGS_FCS_ERR) | ||
840 | return true; | ||
841 | |||
842 | return false; | ||
843 | } | ||
844 | |||
845 | static bool ath10k_htt_rx_has_mic_err(struct sk_buff *skb) | ||
846 | { | ||
847 | struct htt_rx_desc *rxd; | ||
848 | u32 flags; | ||
849 | |||
850 | rxd = (void *)skb->data - sizeof(*rxd); | ||
851 | flags = __le32_to_cpu(rxd->attention.flags); | ||
852 | |||
853 | if (flags & RX_ATTENTION_FLAGS_TKIP_MIC_ERR) | ||
854 | return true; | ||
855 | |||
856 | return false; | ||
857 | } | ||
858 | |||
859 | static bool ath10k_htt_rx_is_mgmt(struct sk_buff *skb) | ||
860 | { | ||
861 | struct htt_rx_desc *rxd; | ||
862 | u32 flags; | ||
863 | |||
864 | rxd = (void *)skb->data - sizeof(*rxd); | ||
865 | flags = __le32_to_cpu(rxd->attention.flags); | ||
866 | |||
867 | if (flags & RX_ATTENTION_FLAGS_MGMT_TYPE) | ||
868 | return true; | ||
869 | |||
870 | return false; | ||
871 | } | 1044 | } |
872 | 1045 | ||
873 | static int ath10k_htt_rx_get_csum_state(struct sk_buff *skb) | 1046 | static int ath10k_htt_rx_get_csum_state(struct sk_buff *skb) |
@@ -952,21 +1125,73 @@ static int ath10k_unchain_msdu(struct sk_buff *msdu_head) | |||
952 | return 0; | 1125 | return 0; |
953 | } | 1126 | } |
954 | 1127 | ||
1128 | static bool ath10k_htt_rx_amsdu_allowed(struct ath10k_htt *htt, | ||
1129 | struct sk_buff *head, | ||
1130 | enum htt_rx_mpdu_status status, | ||
1131 | bool channel_set, | ||
1132 | u32 attention) | ||
1133 | { | ||
1134 | if (head->len == 0) { | ||
1135 | ath10k_dbg(ATH10K_DBG_HTT, | ||
1136 | "htt rx dropping due to zero-len\n"); | ||
1137 | return false; | ||
1138 | } | ||
1139 | |||
1140 | if (attention & RX_ATTENTION_FLAGS_DECRYPT_ERR) { | ||
1141 | ath10k_dbg(ATH10K_DBG_HTT, | ||
1142 | "htt rx dropping due to decrypt-err\n"); | ||
1143 | return false; | ||
1144 | } | ||
1145 | |||
1146 | if (!channel_set) { | ||
1147 | ath10k_warn("no channel configured; ignoring frame!\n"); | ||
1148 | return false; | ||
1149 | } | ||
1150 | |||
1151 | /* Skip mgmt frames while we handle this in WMI */ | ||
1152 | if (status == HTT_RX_IND_MPDU_STATUS_MGMT_CTRL || | ||
1153 | attention & RX_ATTENTION_FLAGS_MGMT_TYPE) { | ||
1154 | ath10k_dbg(ATH10K_DBG_HTT, "htt rx mgmt ctrl\n"); | ||
1155 | return false; | ||
1156 | } | ||
1157 | |||
1158 | if (status != HTT_RX_IND_MPDU_STATUS_OK && | ||
1159 | status != HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR && | ||
1160 | status != HTT_RX_IND_MPDU_STATUS_ERR_INV_PEER && | ||
1161 | !htt->ar->monitor_started) { | ||
1162 | ath10k_dbg(ATH10K_DBG_HTT, | ||
1163 | "htt rx ignoring frame w/ status %d\n", | ||
1164 | status); | ||
1165 | return false; | ||
1166 | } | ||
1167 | |||
1168 | if (test_bit(ATH10K_CAC_RUNNING, &htt->ar->dev_flags)) { | ||
1169 | ath10k_dbg(ATH10K_DBG_HTT, | ||
1170 | "htt rx CAC running\n"); | ||
1171 | return false; | ||
1172 | } | ||
1173 | |||
1174 | return true; | ||
1175 | } | ||
1176 | |||
955 | static void ath10k_htt_rx_handler(struct ath10k_htt *htt, | 1177 | static void ath10k_htt_rx_handler(struct ath10k_htt *htt, |
956 | struct htt_rx_indication *rx) | 1178 | struct htt_rx_indication *rx) |
957 | { | 1179 | { |
958 | struct htt_rx_info info; | 1180 | struct ieee80211_rx_status *rx_status = &htt->rx_status; |
959 | struct htt_rx_indication_mpdu_range *mpdu_ranges; | 1181 | struct htt_rx_indication_mpdu_range *mpdu_ranges; |
1182 | struct htt_rx_desc *rxd; | ||
1183 | enum htt_rx_mpdu_status status; | ||
960 | struct ieee80211_hdr *hdr; | 1184 | struct ieee80211_hdr *hdr; |
961 | int num_mpdu_ranges; | 1185 | int num_mpdu_ranges; |
1186 | u32 attention; | ||
962 | int fw_desc_len; | 1187 | int fw_desc_len; |
963 | u8 *fw_desc; | 1188 | u8 *fw_desc; |
1189 | bool channel_set; | ||
964 | int i, j; | 1190 | int i, j; |
1191 | int ret; | ||
965 | 1192 | ||
966 | lockdep_assert_held(&htt->rx_ring.lock); | 1193 | lockdep_assert_held(&htt->rx_ring.lock); |
967 | 1194 | ||
968 | memset(&info, 0, sizeof(info)); | ||
969 | |||
970 | fw_desc_len = __le16_to_cpu(rx->prefix.fw_rx_desc_bytes); | 1195 | fw_desc_len = __le16_to_cpu(rx->prefix.fw_rx_desc_bytes); |
971 | fw_desc = (u8 *)&rx->fw_desc; | 1196 | fw_desc = (u8 *)&rx->fw_desc; |
972 | 1197 | ||
@@ -974,106 +1199,90 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt, | |||
974 | HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES); | 1199 | HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES); |
975 | mpdu_ranges = htt_rx_ind_get_mpdu_ranges(rx); | 1200 | mpdu_ranges = htt_rx_ind_get_mpdu_ranges(rx); |
976 | 1201 | ||
1202 | /* Fill this once, while this is per-ppdu */ | ||
1203 | if (rx->ppdu.info0 & HTT_RX_INDICATION_INFO0_START_VALID) { | ||
1204 | memset(rx_status, 0, sizeof(*rx_status)); | ||
1205 | rx_status->signal = ATH10K_DEFAULT_NOISE_FLOOR + | ||
1206 | rx->ppdu.combined_rssi; | ||
1207 | } | ||
1208 | |||
1209 | if (rx->ppdu.info0 & HTT_RX_INDICATION_INFO0_END_VALID) { | ||
1210 | /* TSF available only in 32-bit */ | ||
1211 | rx_status->mactime = __le32_to_cpu(rx->ppdu.tsf) & 0xffffffff; | ||
1212 | rx_status->flag |= RX_FLAG_MACTIME_END; | ||
1213 | } | ||
1214 | |||
1215 | channel_set = ath10k_htt_rx_h_channel(htt->ar, rx_status); | ||
1216 | |||
1217 | if (channel_set) { | ||
1218 | ath10k_htt_rx_h_rates(htt->ar, rx_status->band, | ||
1219 | rx->ppdu.info0, | ||
1220 | __le32_to_cpu(rx->ppdu.info1), | ||
1221 | __le32_to_cpu(rx->ppdu.info2), | ||
1222 | rx_status); | ||
1223 | } | ||
1224 | |||
977 | ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt rx ind: ", | 1225 | ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt rx ind: ", |
978 | rx, sizeof(*rx) + | 1226 | rx, sizeof(*rx) + |
979 | (sizeof(struct htt_rx_indication_mpdu_range) * | 1227 | (sizeof(struct htt_rx_indication_mpdu_range) * |
980 | num_mpdu_ranges)); | 1228 | num_mpdu_ranges)); |
981 | 1229 | ||
982 | for (i = 0; i < num_mpdu_ranges; i++) { | 1230 | for (i = 0; i < num_mpdu_ranges; i++) { |
983 | info.status = mpdu_ranges[i].mpdu_range_status; | 1231 | status = mpdu_ranges[i].mpdu_range_status; |
984 | 1232 | ||
985 | for (j = 0; j < mpdu_ranges[i].mpdu_count; j++) { | 1233 | for (j = 0; j < mpdu_ranges[i].mpdu_count; j++) { |
986 | struct sk_buff *msdu_head, *msdu_tail; | 1234 | struct sk_buff *msdu_head, *msdu_tail; |
987 | enum htt_rx_mpdu_status status; | ||
988 | int msdu_chaining; | ||
989 | 1235 | ||
990 | msdu_head = NULL; | 1236 | msdu_head = NULL; |
991 | msdu_tail = NULL; | 1237 | msdu_tail = NULL; |
992 | msdu_chaining = ath10k_htt_rx_amsdu_pop(htt, | 1238 | ret = ath10k_htt_rx_amsdu_pop(htt, |
993 | &fw_desc, | 1239 | &fw_desc, |
994 | &fw_desc_len, | 1240 | &fw_desc_len, |
995 | &msdu_head, | 1241 | &msdu_head, |
996 | &msdu_tail); | 1242 | &msdu_tail); |
997 | 1243 | ||
998 | if (!msdu_head) { | 1244 | if (ret < 0) { |
999 | ath10k_warn("htt rx no data!\n"); | 1245 | ath10k_warn("failed to pop amsdu from htt rx ring %d\n", |
1000 | continue; | 1246 | ret); |
1001 | } | ||
1002 | |||
1003 | if (msdu_head->len == 0) { | ||
1004 | ath10k_dbg(ATH10K_DBG_HTT, | ||
1005 | "htt rx dropping due to zero-len\n"); | ||
1006 | ath10k_htt_rx_free_msdu_chain(msdu_head); | 1247 | ath10k_htt_rx_free_msdu_chain(msdu_head); |
1007 | continue; | 1248 | continue; |
1008 | } | 1249 | } |
1009 | 1250 | ||
1010 | if (ath10k_htt_rx_has_decrypt_err(msdu_head)) { | 1251 | rxd = container_of((void *)msdu_head->data, |
1011 | ath10k_dbg(ATH10K_DBG_HTT, | 1252 | struct htt_rx_desc, |
1012 | "htt rx dropping due to decrypt-err\n"); | 1253 | msdu_payload); |
1013 | ath10k_htt_rx_free_msdu_chain(msdu_head); | 1254 | attention = __le32_to_cpu(rxd->attention.flags); |
1014 | continue; | ||
1015 | } | ||
1016 | 1255 | ||
1017 | status = info.status; | 1256 | if (!ath10k_htt_rx_amsdu_allowed(htt, msdu_head, |
1018 | 1257 | status, | |
1019 | /* Skip mgmt frames while we handle this in WMI */ | 1258 | channel_set, |
1020 | if (status == HTT_RX_IND_MPDU_STATUS_MGMT_CTRL || | 1259 | attention)) { |
1021 | ath10k_htt_rx_is_mgmt(msdu_head)) { | ||
1022 | ath10k_dbg(ATH10K_DBG_HTT, "htt rx mgmt ctrl\n"); | ||
1023 | ath10k_htt_rx_free_msdu_chain(msdu_head); | 1260 | ath10k_htt_rx_free_msdu_chain(msdu_head); |
1024 | continue; | 1261 | continue; |
1025 | } | 1262 | } |
1026 | 1263 | ||
1027 | if (status != HTT_RX_IND_MPDU_STATUS_OK && | 1264 | if (ret > 0 && |
1028 | status != HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR && | 1265 | ath10k_unchain_msdu(msdu_head) < 0) { |
1029 | status != HTT_RX_IND_MPDU_STATUS_ERR_INV_PEER && | ||
1030 | !htt->ar->monitor_enabled) { | ||
1031 | ath10k_dbg(ATH10K_DBG_HTT, | ||
1032 | "htt rx ignoring frame w/ status %d\n", | ||
1033 | status); | ||
1034 | ath10k_htt_rx_free_msdu_chain(msdu_head); | 1266 | ath10k_htt_rx_free_msdu_chain(msdu_head); |
1035 | continue; | 1267 | continue; |
1036 | } | 1268 | } |
1037 | 1269 | ||
1038 | if (test_bit(ATH10K_CAC_RUNNING, &htt->ar->dev_flags)) { | 1270 | if (attention & RX_ATTENTION_FLAGS_FCS_ERR) |
1039 | ath10k_dbg(ATH10K_DBG_HTT, | 1271 | rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; |
1040 | "htt rx CAC running\n"); | 1272 | else |
1041 | ath10k_htt_rx_free_msdu_chain(msdu_head); | 1273 | rx_status->flag &= ~RX_FLAG_FAILED_FCS_CRC; |
1042 | continue; | ||
1043 | } | ||
1044 | |||
1045 | if (msdu_chaining && | ||
1046 | (ath10k_unchain_msdu(msdu_head) < 0)) { | ||
1047 | ath10k_htt_rx_free_msdu_chain(msdu_head); | ||
1048 | continue; | ||
1049 | } | ||
1050 | |||
1051 | info.skb = msdu_head; | ||
1052 | info.fcs_err = ath10k_htt_rx_has_fcs_err(msdu_head); | ||
1053 | info.mic_err = ath10k_htt_rx_has_mic_err(msdu_head); | ||
1054 | |||
1055 | if (info.fcs_err) | ||
1056 | ath10k_dbg(ATH10K_DBG_HTT, | ||
1057 | "htt rx has FCS err\n"); | ||
1058 | |||
1059 | if (info.mic_err) | ||
1060 | ath10k_dbg(ATH10K_DBG_HTT, | ||
1061 | "htt rx has MIC err\n"); | ||
1062 | |||
1063 | info.signal = ATH10K_DEFAULT_NOISE_FLOOR; | ||
1064 | info.signal += rx->ppdu.combined_rssi; | ||
1065 | 1274 | ||
1066 | info.rate.info0 = rx->ppdu.info0; | 1275 | if (attention & RX_ATTENTION_FLAGS_TKIP_MIC_ERR) |
1067 | info.rate.info1 = __le32_to_cpu(rx->ppdu.info1); | 1276 | rx_status->flag |= RX_FLAG_MMIC_ERROR; |
1068 | info.rate.info2 = __le32_to_cpu(rx->ppdu.info2); | 1277 | else |
1069 | info.tsf = __le32_to_cpu(rx->ppdu.tsf); | 1278 | rx_status->flag &= ~RX_FLAG_MMIC_ERROR; |
1070 | 1279 | ||
1071 | hdr = ath10k_htt_rx_skb_get_hdr(msdu_head); | 1280 | hdr = ath10k_htt_rx_skb_get_hdr(msdu_head); |
1072 | 1281 | ||
1073 | if (ath10k_htt_rx_hdr_is_amsdu(hdr)) | 1282 | if (ath10k_htt_rx_hdr_is_amsdu(hdr)) |
1074 | ath10k_htt_rx_amsdu(htt, &info); | 1283 | ath10k_htt_rx_amsdu(htt, rx_status, msdu_head); |
1075 | else | 1284 | else |
1076 | ath10k_htt_rx_msdu(htt, &info); | 1285 | ath10k_htt_rx_msdu(htt, rx_status, msdu_head); |
1077 | } | 1286 | } |
1078 | } | 1287 | } |
1079 | 1288 | ||
@@ -1084,11 +1293,12 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt, | |||
1084 | struct htt_rx_fragment_indication *frag) | 1293 | struct htt_rx_fragment_indication *frag) |
1085 | { | 1294 | { |
1086 | struct sk_buff *msdu_head, *msdu_tail; | 1295 | struct sk_buff *msdu_head, *msdu_tail; |
1296 | enum htt_rx_mpdu_encrypt_type enctype; | ||
1087 | struct htt_rx_desc *rxd; | 1297 | struct htt_rx_desc *rxd; |
1088 | enum rx_msdu_decap_format fmt; | 1298 | enum rx_msdu_decap_format fmt; |
1089 | struct htt_rx_info info = {}; | 1299 | struct ieee80211_rx_status *rx_status = &htt->rx_status; |
1090 | struct ieee80211_hdr *hdr; | 1300 | struct ieee80211_hdr *hdr; |
1091 | int msdu_chaining; | 1301 | int ret; |
1092 | bool tkip_mic_err; | 1302 | bool tkip_mic_err; |
1093 | bool decrypt_err; | 1303 | bool decrypt_err; |
1094 | u8 *fw_desc; | 1304 | u8 *fw_desc; |
@@ -1102,24 +1312,21 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt, | |||
1102 | msdu_tail = NULL; | 1312 | msdu_tail = NULL; |
1103 | 1313 | ||
1104 | spin_lock_bh(&htt->rx_ring.lock); | 1314 | spin_lock_bh(&htt->rx_ring.lock); |
1105 | msdu_chaining = ath10k_htt_rx_amsdu_pop(htt, &fw_desc, &fw_desc_len, | 1315 | ret = ath10k_htt_rx_amsdu_pop(htt, &fw_desc, &fw_desc_len, |
1106 | &msdu_head, &msdu_tail); | 1316 | &msdu_head, &msdu_tail); |
1107 | spin_unlock_bh(&htt->rx_ring.lock); | 1317 | spin_unlock_bh(&htt->rx_ring.lock); |
1108 | 1318 | ||
1109 | ath10k_dbg(ATH10K_DBG_HTT_DUMP, "htt rx frag ahead\n"); | 1319 | ath10k_dbg(ATH10K_DBG_HTT_DUMP, "htt rx frag ahead\n"); |
1110 | 1320 | ||
1111 | if (!msdu_head) { | 1321 | if (ret) { |
1112 | ath10k_warn("htt rx frag no data\n"); | 1322 | ath10k_warn("failed to pop amsdu from httr rx ring for fragmented rx %d\n", |
1113 | return; | 1323 | ret); |
1114 | } | ||
1115 | |||
1116 | if (msdu_chaining || msdu_head != msdu_tail) { | ||
1117 | ath10k_warn("aggregation with fragmentation?!\n"); | ||
1118 | ath10k_htt_rx_free_msdu_chain(msdu_head); | 1324 | ath10k_htt_rx_free_msdu_chain(msdu_head); |
1119 | return; | 1325 | return; |
1120 | } | 1326 | } |
1121 | 1327 | ||
1122 | /* FIXME: implement signal strength */ | 1328 | /* FIXME: implement signal strength */ |
1329 | rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL; | ||
1123 | 1330 | ||
1124 | hdr = (struct ieee80211_hdr *)msdu_head->data; | 1331 | hdr = (struct ieee80211_hdr *)msdu_head->data; |
1125 | rxd = (void *)msdu_head->data - sizeof(*rxd); | 1332 | rxd = (void *)msdu_head->data - sizeof(*rxd); |
@@ -1136,57 +1343,55 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt, | |||
1136 | goto end; | 1343 | goto end; |
1137 | } | 1344 | } |
1138 | 1345 | ||
1139 | info.skb = msdu_head; | 1346 | enctype = MS(__le32_to_cpu(rxd->mpdu_start.info0), |
1140 | info.status = HTT_RX_IND_MPDU_STATUS_OK; | 1347 | RX_MPDU_START_INFO0_ENCRYPT_TYPE); |
1141 | info.encrypt_type = MS(__le32_to_cpu(rxd->mpdu_start.info0), | 1348 | ath10k_htt_rx_h_protected(htt, rx_status, msdu_head, enctype, fmt, |
1142 | RX_MPDU_START_INFO0_ENCRYPT_TYPE); | 1349 | true); |
1143 | info.skb->ip_summed = ath10k_htt_rx_get_csum_state(info.skb); | 1350 | msdu_head->ip_summed = ath10k_htt_rx_get_csum_state(msdu_head); |
1144 | 1351 | ||
1145 | if (tkip_mic_err) { | 1352 | if (tkip_mic_err) |
1146 | ath10k_warn("tkip mic error\n"); | 1353 | ath10k_warn("tkip mic error\n"); |
1147 | info.status = HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR; | ||
1148 | } | ||
1149 | 1354 | ||
1150 | if (decrypt_err) { | 1355 | if (decrypt_err) { |
1151 | ath10k_warn("decryption err in fragmented rx\n"); | 1356 | ath10k_warn("decryption err in fragmented rx\n"); |
1152 | dev_kfree_skb_any(info.skb); | 1357 | dev_kfree_skb_any(msdu_head); |
1153 | goto end; | 1358 | goto end; |
1154 | } | 1359 | } |
1155 | 1360 | ||
1156 | if (info.encrypt_type != HTT_RX_MPDU_ENCRYPT_NONE) { | 1361 | if (enctype != HTT_RX_MPDU_ENCRYPT_NONE) { |
1157 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 1362 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
1158 | paramlen = ath10k_htt_rx_crypto_param_len(info.encrypt_type); | 1363 | paramlen = ath10k_htt_rx_crypto_param_len(enctype); |
1159 | 1364 | ||
1160 | /* It is more efficient to move the header than the payload */ | 1365 | /* It is more efficient to move the header than the payload */ |
1161 | memmove((void *)info.skb->data + paramlen, | 1366 | memmove((void *)msdu_head->data + paramlen, |
1162 | (void *)info.skb->data, | 1367 | (void *)msdu_head->data, |
1163 | hdrlen); | 1368 | hdrlen); |
1164 | skb_pull(info.skb, paramlen); | 1369 | skb_pull(msdu_head, paramlen); |
1165 | hdr = (struct ieee80211_hdr *)info.skb->data; | 1370 | hdr = (struct ieee80211_hdr *)msdu_head->data; |
1166 | } | 1371 | } |
1167 | 1372 | ||
1168 | /* remove trailing FCS */ | 1373 | /* remove trailing FCS */ |
1169 | trim = 4; | 1374 | trim = 4; |
1170 | 1375 | ||
1171 | /* remove crypto trailer */ | 1376 | /* remove crypto trailer */ |
1172 | trim += ath10k_htt_rx_crypto_tail_len(info.encrypt_type); | 1377 | trim += ath10k_htt_rx_crypto_tail_len(enctype); |
1173 | 1378 | ||
1174 | /* last fragment of TKIP frags has MIC */ | 1379 | /* last fragment of TKIP frags has MIC */ |
1175 | if (!ieee80211_has_morefrags(hdr->frame_control) && | 1380 | if (!ieee80211_has_morefrags(hdr->frame_control) && |
1176 | info.encrypt_type == HTT_RX_MPDU_ENCRYPT_TKIP_WPA) | 1381 | enctype == HTT_RX_MPDU_ENCRYPT_TKIP_WPA) |
1177 | trim += 8; | 1382 | trim += 8; |
1178 | 1383 | ||
1179 | if (trim > info.skb->len) { | 1384 | if (trim > msdu_head->len) { |
1180 | ath10k_warn("htt rx fragment: trailer longer than the frame itself? drop\n"); | 1385 | ath10k_warn("htt rx fragment: trailer longer than the frame itself? drop\n"); |
1181 | dev_kfree_skb_any(info.skb); | 1386 | dev_kfree_skb_any(msdu_head); |
1182 | goto end; | 1387 | goto end; |
1183 | } | 1388 | } |
1184 | 1389 | ||
1185 | skb_trim(info.skb, info.skb->len - trim); | 1390 | skb_trim(msdu_head, msdu_head->len - trim); |
1186 | 1391 | ||
1187 | ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt rx frag mpdu: ", | 1392 | ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt rx frag mpdu: ", |
1188 | info.skb->data, info.skb->len); | 1393 | msdu_head->data, msdu_head->len); |
1189 | ath10k_process_rx(htt->ar, &info); | 1394 | ath10k_process_rx(htt->ar, rx_status, msdu_head); |
1190 | 1395 | ||
1191 | end: | 1396 | end: |
1192 | if (fw_desc_len > 0) { | 1397 | if (fw_desc_len > 0) { |
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index 7a3e2e40dd5c..7064354d1f4f 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c | |||
@@ -83,7 +83,7 @@ void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id) | |||
83 | __clear_bit(msdu_id, htt->used_msdu_ids); | 83 | __clear_bit(msdu_id, htt->used_msdu_ids); |
84 | } | 84 | } |
85 | 85 | ||
86 | int ath10k_htt_tx_attach(struct ath10k_htt *htt) | 86 | int ath10k_htt_tx_alloc(struct ath10k_htt *htt) |
87 | { | 87 | { |
88 | spin_lock_init(&htt->tx_lock); | 88 | spin_lock_init(&htt->tx_lock); |
89 | init_waitqueue_head(&htt->empty_tx_wq); | 89 | init_waitqueue_head(&htt->empty_tx_wq); |
@@ -120,7 +120,7 @@ int ath10k_htt_tx_attach(struct ath10k_htt *htt) | |||
120 | return 0; | 120 | return 0; |
121 | } | 121 | } |
122 | 122 | ||
123 | static void ath10k_htt_tx_cleanup_pending(struct ath10k_htt *htt) | 123 | static void ath10k_htt_tx_free_pending(struct ath10k_htt *htt) |
124 | { | 124 | { |
125 | struct htt_tx_done tx_done = {0}; | 125 | struct htt_tx_done tx_done = {0}; |
126 | int msdu_id; | 126 | int msdu_id; |
@@ -141,9 +141,9 @@ static void ath10k_htt_tx_cleanup_pending(struct ath10k_htt *htt) | |||
141 | spin_unlock_bh(&htt->tx_lock); | 141 | spin_unlock_bh(&htt->tx_lock); |
142 | } | 142 | } |
143 | 143 | ||
144 | void ath10k_htt_tx_detach(struct ath10k_htt *htt) | 144 | void ath10k_htt_tx_free(struct ath10k_htt *htt) |
145 | { | 145 | { |
146 | ath10k_htt_tx_cleanup_pending(htt); | 146 | ath10k_htt_tx_free_pending(htt); |
147 | kfree(htt->pending_tx); | 147 | kfree(htt->pending_tx); |
148 | kfree(htt->used_msdu_ids); | 148 | kfree(htt->used_msdu_ids); |
149 | dma_pool_destroy(htt->tx_pool); | 149 | dma_pool_destroy(htt->tx_pool); |
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index 35fc44e281f5..007e855f4ba9 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #define QCA988X_HW_2_0_CHIP_ID_REV 0x2 | 28 | #define QCA988X_HW_2_0_CHIP_ID_REV 0x2 |
29 | #define QCA988X_HW_2_0_FW_DIR "ath10k/QCA988X/hw2.0" | 29 | #define QCA988X_HW_2_0_FW_DIR "ath10k/QCA988X/hw2.0" |
30 | #define QCA988X_HW_2_0_FW_FILE "firmware.bin" | 30 | #define QCA988X_HW_2_0_FW_FILE "firmware.bin" |
31 | #define QCA988X_HW_2_0_FW_2_FILE "firmware-2.bin" | ||
31 | #define QCA988X_HW_2_0_OTP_FILE "otp.bin" | 32 | #define QCA988X_HW_2_0_OTP_FILE "otp.bin" |
32 | #define QCA988X_HW_2_0_BOARD_DATA_FILE "board.bin" | 33 | #define QCA988X_HW_2_0_BOARD_DATA_FILE "board.bin" |
33 | #define QCA988X_HW_2_0_PATCH_LOAD_ADDR 0x1234 | 34 | #define QCA988X_HW_2_0_PATCH_LOAD_ADDR 0x1234 |
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 511a2f81e7af..a21080028c54 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c | |||
@@ -54,7 +54,10 @@ static int ath10k_send_key(struct ath10k_vif *arvif, | |||
54 | switch (key->cipher) { | 54 | switch (key->cipher) { |
55 | case WLAN_CIPHER_SUITE_CCMP: | 55 | case WLAN_CIPHER_SUITE_CCMP: |
56 | arg.key_cipher = WMI_CIPHER_AES_CCM; | 56 | arg.key_cipher = WMI_CIPHER_AES_CCM; |
57 | key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; | 57 | if (arvif->vdev_type == WMI_VDEV_TYPE_AP) |
58 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; | ||
59 | else | ||
60 | key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; | ||
58 | break; | 61 | break; |
59 | case WLAN_CIPHER_SUITE_TKIP: | 62 | case WLAN_CIPHER_SUITE_TKIP: |
60 | arg.key_cipher = WMI_CIPHER_TKIP; | 63 | arg.key_cipher = WMI_CIPHER_TKIP; |
@@ -165,7 +168,7 @@ static int ath10k_clear_peer_keys(struct ath10k_vif *arvif, | |||
165 | first_errno = ret; | 168 | first_errno = ret; |
166 | 169 | ||
167 | if (ret) | 170 | if (ret) |
168 | ath10k_warn("could not remove peer wep key %d (%d)\n", | 171 | ath10k_warn("failed to remove peer wep key %d: %d\n", |
169 | i, ret); | 172 | i, ret); |
170 | 173 | ||
171 | peer->keys[i] = NULL; | 174 | peer->keys[i] = NULL; |
@@ -213,7 +216,8 @@ static int ath10k_clear_vdev_key(struct ath10k_vif *arvif, | |||
213 | first_errno = ret; | 216 | first_errno = ret; |
214 | 217 | ||
215 | if (ret) | 218 | if (ret) |
216 | ath10k_warn("could not remove key for %pM\n", addr); | 219 | ath10k_warn("failed to remove key for %pM: %d\n", |
220 | addr, ret); | ||
217 | } | 221 | } |
218 | 222 | ||
219 | return first_errno; | 223 | return first_errno; |
@@ -323,14 +327,14 @@ static int ath10k_peer_create(struct ath10k *ar, u32 vdev_id, const u8 *addr) | |||
323 | 327 | ||
324 | ret = ath10k_wmi_peer_create(ar, vdev_id, addr); | 328 | ret = ath10k_wmi_peer_create(ar, vdev_id, addr); |
325 | if (ret) { | 329 | if (ret) { |
326 | ath10k_warn("Failed to create wmi peer %pM on vdev %i: %i\n", | 330 | ath10k_warn("failed to create wmi peer %pM on vdev %i: %i\n", |
327 | addr, vdev_id, ret); | 331 | addr, vdev_id, ret); |
328 | return ret; | 332 | return ret; |
329 | } | 333 | } |
330 | 334 | ||
331 | ret = ath10k_wait_for_peer_created(ar, vdev_id, addr); | 335 | ret = ath10k_wait_for_peer_created(ar, vdev_id, addr); |
332 | if (ret) { | 336 | if (ret) { |
333 | ath10k_warn("Failed to wait for created wmi peer %pM on vdev %i: %i\n", | 337 | ath10k_warn("failed to wait for created wmi peer %pM on vdev %i: %i\n", |
334 | addr, vdev_id, ret); | 338 | addr, vdev_id, ret); |
335 | return ret; | 339 | return ret; |
336 | } | 340 | } |
@@ -351,7 +355,7 @@ static int ath10k_mac_set_kickout(struct ath10k_vif *arvif) | |||
351 | ret = ath10k_wmi_pdev_set_param(ar, param, | 355 | ret = ath10k_wmi_pdev_set_param(ar, param, |
352 | ATH10K_KICKOUT_THRESHOLD); | 356 | ATH10K_KICKOUT_THRESHOLD); |
353 | if (ret) { | 357 | if (ret) { |
354 | ath10k_warn("Failed to set kickout threshold on vdev %i: %d\n", | 358 | ath10k_warn("failed to set kickout threshold on vdev %i: %d\n", |
355 | arvif->vdev_id, ret); | 359 | arvif->vdev_id, ret); |
356 | return ret; | 360 | return ret; |
357 | } | 361 | } |
@@ -360,7 +364,7 @@ static int ath10k_mac_set_kickout(struct ath10k_vif *arvif) | |||
360 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, | 364 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, |
361 | ATH10K_KEEPALIVE_MIN_IDLE); | 365 | ATH10K_KEEPALIVE_MIN_IDLE); |
362 | if (ret) { | 366 | if (ret) { |
363 | ath10k_warn("Failed to set keepalive minimum idle time on vdev %i : %d\n", | 367 | ath10k_warn("failed to set keepalive minimum idle time on vdev %i: %d\n", |
364 | arvif->vdev_id, ret); | 368 | arvif->vdev_id, ret); |
365 | return ret; | 369 | return ret; |
366 | } | 370 | } |
@@ -369,7 +373,7 @@ static int ath10k_mac_set_kickout(struct ath10k_vif *arvif) | |||
369 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, | 373 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, |
370 | ATH10K_KEEPALIVE_MAX_IDLE); | 374 | ATH10K_KEEPALIVE_MAX_IDLE); |
371 | if (ret) { | 375 | if (ret) { |
372 | ath10k_warn("Failed to set keepalive maximum idle time on vdev %i: %d\n", | 376 | ath10k_warn("failed to set keepalive maximum idle time on vdev %i: %d\n", |
373 | arvif->vdev_id, ret); | 377 | arvif->vdev_id, ret); |
374 | return ret; | 378 | return ret; |
375 | } | 379 | } |
@@ -378,7 +382,7 @@ static int ath10k_mac_set_kickout(struct ath10k_vif *arvif) | |||
378 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, | 382 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, |
379 | ATH10K_KEEPALIVE_MAX_UNRESPONSIVE); | 383 | ATH10K_KEEPALIVE_MAX_UNRESPONSIVE); |
380 | if (ret) { | 384 | if (ret) { |
381 | ath10k_warn("Failed to set keepalive maximum unresponsive time on vdev %i: %d\n", | 385 | ath10k_warn("failed to set keepalive maximum unresponsive time on vdev %i: %d\n", |
382 | arvif->vdev_id, ret); | 386 | arvif->vdev_id, ret); |
383 | return ret; | 387 | return ret; |
384 | } | 388 | } |
@@ -488,92 +492,20 @@ static inline int ath10k_vdev_setup_sync(struct ath10k *ar) | |||
488 | return 0; | 492 | return 0; |
489 | } | 493 | } |
490 | 494 | ||
491 | static int ath10k_vdev_start(struct ath10k_vif *arvif) | 495 | static bool ath10k_monitor_is_enabled(struct ath10k *ar) |
492 | { | 496 | { |
493 | struct ath10k *ar = arvif->ar; | ||
494 | struct cfg80211_chan_def *chandef = &ar->chandef; | ||
495 | struct wmi_vdev_start_request_arg arg = {}; | ||
496 | int ret = 0; | ||
497 | |||
498 | lockdep_assert_held(&ar->conf_mutex); | 497 | lockdep_assert_held(&ar->conf_mutex); |
499 | 498 | ||
500 | reinit_completion(&ar->vdev_setup_done); | ||
501 | |||
502 | arg.vdev_id = arvif->vdev_id; | ||
503 | arg.dtim_period = arvif->dtim_period; | ||
504 | arg.bcn_intval = arvif->beacon_interval; | ||
505 | |||
506 | arg.channel.freq = chandef->chan->center_freq; | ||
507 | arg.channel.band_center_freq1 = chandef->center_freq1; | ||
508 | arg.channel.mode = chan_to_phymode(chandef); | ||
509 | |||
510 | arg.channel.min_power = 0; | ||
511 | arg.channel.max_power = chandef->chan->max_power * 2; | ||
512 | arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; | ||
513 | arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2; | ||
514 | |||
515 | if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { | ||
516 | arg.ssid = arvif->u.ap.ssid; | ||
517 | arg.ssid_len = arvif->u.ap.ssid_len; | ||
518 | arg.hidden_ssid = arvif->u.ap.hidden_ssid; | ||
519 | |||
520 | /* For now allow DFS for AP mode */ | ||
521 | arg.channel.chan_radar = | ||
522 | !!(chandef->chan->flags & IEEE80211_CHAN_RADAR); | ||
523 | } else if (arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { | ||
524 | arg.ssid = arvif->vif->bss_conf.ssid; | ||
525 | arg.ssid_len = arvif->vif->bss_conf.ssid_len; | ||
526 | } | ||
527 | |||
528 | ath10k_dbg(ATH10K_DBG_MAC, | 499 | ath10k_dbg(ATH10K_DBG_MAC, |
529 | "mac vdev %d start center_freq %d phymode %s\n", | 500 | "mac monitor refs: promisc %d monitor %d cac %d\n", |
530 | arg.vdev_id, arg.channel.freq, | 501 | ar->promisc, ar->monitor, |
531 | ath10k_wmi_phymode_str(arg.channel.mode)); | 502 | test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags)); |
532 | 503 | ||
533 | ret = ath10k_wmi_vdev_start(ar, &arg); | 504 | return ar->promisc || ar->monitor || |
534 | if (ret) { | 505 | test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); |
535 | ath10k_warn("WMI vdev %i start failed: ret %d\n", | ||
536 | arg.vdev_id, ret); | ||
537 | return ret; | ||
538 | } | ||
539 | |||
540 | ret = ath10k_vdev_setup_sync(ar); | ||
541 | if (ret) { | ||
542 | ath10k_warn("vdev %i setup failed %d\n", | ||
543 | arg.vdev_id, ret); | ||
544 | return ret; | ||
545 | } | ||
546 | |||
547 | return ret; | ||
548 | } | 506 | } |
549 | 507 | ||
550 | static int ath10k_vdev_stop(struct ath10k_vif *arvif) | 508 | static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) |
551 | { | ||
552 | struct ath10k *ar = arvif->ar; | ||
553 | int ret; | ||
554 | |||
555 | lockdep_assert_held(&ar->conf_mutex); | ||
556 | |||
557 | reinit_completion(&ar->vdev_setup_done); | ||
558 | |||
559 | ret = ath10k_wmi_vdev_stop(ar, arvif->vdev_id); | ||
560 | if (ret) { | ||
561 | ath10k_warn("WMI vdev %i stop failed: ret %d\n", | ||
562 | arvif->vdev_id, ret); | ||
563 | return ret; | ||
564 | } | ||
565 | |||
566 | ret = ath10k_vdev_setup_sync(ar); | ||
567 | if (ret) { | ||
568 | ath10k_warn("vdev %i setup sync failed %d\n", | ||
569 | arvif->vdev_id, ret); | ||
570 | return ret; | ||
571 | } | ||
572 | |||
573 | return ret; | ||
574 | } | ||
575 | |||
576 | static int ath10k_monitor_start(struct ath10k *ar, int vdev_id) | ||
577 | { | 509 | { |
578 | struct cfg80211_chan_def *chandef = &ar->chandef; | 510 | struct cfg80211_chan_def *chandef = &ar->chandef; |
579 | struct ieee80211_channel *channel = chandef->chan; | 511 | struct ieee80211_channel *channel = chandef->chan; |
@@ -582,11 +514,6 @@ static int ath10k_monitor_start(struct ath10k *ar, int vdev_id) | |||
582 | 514 | ||
583 | lockdep_assert_held(&ar->conf_mutex); | 515 | lockdep_assert_held(&ar->conf_mutex); |
584 | 516 | ||
585 | if (!ar->monitor_present) { | ||
586 | ath10k_warn("mac montor stop -- monitor is not present\n"); | ||
587 | return -EINVAL; | ||
588 | } | ||
589 | |||
590 | arg.vdev_id = vdev_id; | 517 | arg.vdev_id = vdev_id; |
591 | arg.channel.freq = channel->center_freq; | 518 | arg.channel.freq = channel->center_freq; |
592 | arg.channel.band_center_freq1 = chandef->center_freq1; | 519 | arg.channel.band_center_freq1 = chandef->center_freq1; |
@@ -604,88 +531,75 @@ static int ath10k_monitor_start(struct ath10k *ar, int vdev_id) | |||
604 | 531 | ||
605 | ret = ath10k_wmi_vdev_start(ar, &arg); | 532 | ret = ath10k_wmi_vdev_start(ar, &arg); |
606 | if (ret) { | 533 | if (ret) { |
607 | ath10k_warn("Monitor vdev %i start failed: ret %d\n", | 534 | ath10k_warn("failed to request monitor vdev %i start: %d\n", |
608 | vdev_id, ret); | 535 | vdev_id, ret); |
609 | return ret; | 536 | return ret; |
610 | } | 537 | } |
611 | 538 | ||
612 | ret = ath10k_vdev_setup_sync(ar); | 539 | ret = ath10k_vdev_setup_sync(ar); |
613 | if (ret) { | 540 | if (ret) { |
614 | ath10k_warn("Monitor vdev %i setup failed %d\n", | 541 | ath10k_warn("failed to synchronize setup for monitor vdev %i: %d\n", |
615 | vdev_id, ret); | 542 | vdev_id, ret); |
616 | return ret; | 543 | return ret; |
617 | } | 544 | } |
618 | 545 | ||
619 | ret = ath10k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); | 546 | ret = ath10k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); |
620 | if (ret) { | 547 | if (ret) { |
621 | ath10k_warn("Monitor vdev %i up failed: %d\n", | 548 | ath10k_warn("failed to put up monitor vdev %i: %d\n", |
622 | vdev_id, ret); | 549 | vdev_id, ret); |
623 | goto vdev_stop; | 550 | goto vdev_stop; |
624 | } | 551 | } |
625 | 552 | ||
626 | ar->monitor_vdev_id = vdev_id; | 553 | ar->monitor_vdev_id = vdev_id; |
627 | ar->monitor_enabled = true; | ||
628 | 554 | ||
555 | ath10k_dbg(ATH10K_DBG_MAC, "mac monitor vdev %i started\n", | ||
556 | ar->monitor_vdev_id); | ||
629 | return 0; | 557 | return 0; |
630 | 558 | ||
631 | vdev_stop: | 559 | vdev_stop: |
632 | ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); | 560 | ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); |
633 | if (ret) | 561 | if (ret) |
634 | ath10k_warn("Monitor vdev %i stop failed: %d\n", | 562 | ath10k_warn("failed to stop monitor vdev %i after start failure: %d\n", |
635 | ar->monitor_vdev_id, ret); | 563 | ar->monitor_vdev_id, ret); |
636 | 564 | ||
637 | return ret; | 565 | return ret; |
638 | } | 566 | } |
639 | 567 | ||
640 | static int ath10k_monitor_stop(struct ath10k *ar) | 568 | static int ath10k_monitor_vdev_stop(struct ath10k *ar) |
641 | { | 569 | { |
642 | int ret = 0; | 570 | int ret = 0; |
643 | 571 | ||
644 | lockdep_assert_held(&ar->conf_mutex); | 572 | lockdep_assert_held(&ar->conf_mutex); |
645 | 573 | ||
646 | if (!ar->monitor_present) { | ||
647 | ath10k_warn("mac montor stop -- monitor is not present\n"); | ||
648 | return -EINVAL; | ||
649 | } | ||
650 | |||
651 | if (!ar->monitor_enabled) { | ||
652 | ath10k_warn("mac montor stop -- monitor is not enabled\n"); | ||
653 | return -EINVAL; | ||
654 | } | ||
655 | |||
656 | ret = ath10k_wmi_vdev_down(ar, ar->monitor_vdev_id); | 574 | ret = ath10k_wmi_vdev_down(ar, ar->monitor_vdev_id); |
657 | if (ret) | 575 | if (ret) |
658 | ath10k_warn("Monitor vdev %i down failed: %d\n", | 576 | ath10k_warn("failed to put down monitor vdev %i: %d\n", |
659 | ar->monitor_vdev_id, ret); | 577 | ar->monitor_vdev_id, ret); |
660 | 578 | ||
661 | ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); | 579 | ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); |
662 | if (ret) | 580 | if (ret) |
663 | ath10k_warn("Monitor vdev %i stop failed: %d\n", | 581 | ath10k_warn("failed to to request monitor vdev %i stop: %d\n", |
664 | ar->monitor_vdev_id, ret); | 582 | ar->monitor_vdev_id, ret); |
665 | 583 | ||
666 | ret = ath10k_vdev_setup_sync(ar); | 584 | ret = ath10k_vdev_setup_sync(ar); |
667 | if (ret) | 585 | if (ret) |
668 | ath10k_warn("Monitor_down sync failed, vdev %i: %d\n", | 586 | ath10k_warn("failed to synchronise monitor vdev %i: %d\n", |
669 | ar->monitor_vdev_id, ret); | 587 | ar->monitor_vdev_id, ret); |
670 | 588 | ||
671 | ar->monitor_enabled = false; | 589 | ath10k_dbg(ATH10K_DBG_MAC, "mac monitor vdev %i stopped\n", |
590 | ar->monitor_vdev_id); | ||
672 | return ret; | 591 | return ret; |
673 | } | 592 | } |
674 | 593 | ||
675 | static int ath10k_monitor_create(struct ath10k *ar) | 594 | static int ath10k_monitor_vdev_create(struct ath10k *ar) |
676 | { | 595 | { |
677 | int bit, ret = 0; | 596 | int bit, ret = 0; |
678 | 597 | ||
679 | lockdep_assert_held(&ar->conf_mutex); | 598 | lockdep_assert_held(&ar->conf_mutex); |
680 | 599 | ||
681 | if (ar->monitor_present) { | ||
682 | ath10k_warn("Monitor mode already enabled\n"); | ||
683 | return 0; | ||
684 | } | ||
685 | |||
686 | bit = ffs(ar->free_vdev_map); | 600 | bit = ffs(ar->free_vdev_map); |
687 | if (bit == 0) { | 601 | if (bit == 0) { |
688 | ath10k_warn("No free VDEV slots\n"); | 602 | ath10k_warn("failed to find free vdev id for monitor vdev\n"); |
689 | return -ENOMEM; | 603 | return -ENOMEM; |
690 | } | 604 | } |
691 | 605 | ||
@@ -696,7 +610,7 @@ static int ath10k_monitor_create(struct ath10k *ar) | |||
696 | WMI_VDEV_TYPE_MONITOR, | 610 | WMI_VDEV_TYPE_MONITOR, |
697 | 0, ar->mac_addr); | 611 | 0, ar->mac_addr); |
698 | if (ret) { | 612 | if (ret) { |
699 | ath10k_warn("WMI vdev %i monitor create failed: ret %d\n", | 613 | ath10k_warn("failed to request monitor vdev %i creation: %d\n", |
700 | ar->monitor_vdev_id, ret); | 614 | ar->monitor_vdev_id, ret); |
701 | goto vdev_fail; | 615 | goto vdev_fail; |
702 | } | 616 | } |
@@ -704,7 +618,6 @@ static int ath10k_monitor_create(struct ath10k *ar) | |||
704 | ath10k_dbg(ATH10K_DBG_MAC, "mac monitor vdev %d created\n", | 618 | ath10k_dbg(ATH10K_DBG_MAC, "mac monitor vdev %d created\n", |
705 | ar->monitor_vdev_id); | 619 | ar->monitor_vdev_id); |
706 | 620 | ||
707 | ar->monitor_present = true; | ||
708 | return 0; | 621 | return 0; |
709 | 622 | ||
710 | vdev_fail: | 623 | vdev_fail: |
@@ -715,48 +628,123 @@ vdev_fail: | |||
715 | return ret; | 628 | return ret; |
716 | } | 629 | } |
717 | 630 | ||
718 | static int ath10k_monitor_destroy(struct ath10k *ar) | 631 | static int ath10k_monitor_vdev_delete(struct ath10k *ar) |
719 | { | 632 | { |
720 | int ret = 0; | 633 | int ret = 0; |
721 | 634 | ||
722 | lockdep_assert_held(&ar->conf_mutex); | 635 | lockdep_assert_held(&ar->conf_mutex); |
723 | 636 | ||
724 | if (!ar->monitor_present) | ||
725 | return 0; | ||
726 | |||
727 | ret = ath10k_wmi_vdev_delete(ar, ar->monitor_vdev_id); | 637 | ret = ath10k_wmi_vdev_delete(ar, ar->monitor_vdev_id); |
728 | if (ret) { | 638 | if (ret) { |
729 | ath10k_warn("WMI vdev %i monitor delete failed: %d\n", | 639 | ath10k_warn("failed to request wmi monitor vdev %i removal: %d\n", |
730 | ar->monitor_vdev_id, ret); | 640 | ar->monitor_vdev_id, ret); |
731 | return ret; | 641 | return ret; |
732 | } | 642 | } |
733 | 643 | ||
734 | ar->free_vdev_map |= 1 << (ar->monitor_vdev_id); | 644 | ar->free_vdev_map |= 1 << (ar->monitor_vdev_id); |
735 | ar->monitor_present = false; | ||
736 | 645 | ||
737 | ath10k_dbg(ATH10K_DBG_MAC, "mac monitor vdev %d deleted\n", | 646 | ath10k_dbg(ATH10K_DBG_MAC, "mac monitor vdev %d deleted\n", |
738 | ar->monitor_vdev_id); | 647 | ar->monitor_vdev_id); |
739 | return ret; | 648 | return ret; |
740 | } | 649 | } |
741 | 650 | ||
742 | static int ath10k_start_cac(struct ath10k *ar) | 651 | static int ath10k_monitor_start(struct ath10k *ar) |
743 | { | 652 | { |
744 | int ret; | 653 | int ret; |
745 | 654 | ||
746 | lockdep_assert_held(&ar->conf_mutex); | 655 | lockdep_assert_held(&ar->conf_mutex); |
747 | 656 | ||
748 | set_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); | 657 | if (!ath10k_monitor_is_enabled(ar)) { |
658 | ath10k_warn("trying to start monitor with no references\n"); | ||
659 | return 0; | ||
660 | } | ||
661 | |||
662 | if (ar->monitor_started) { | ||
663 | ath10k_dbg(ATH10K_DBG_MAC, "mac monitor already started\n"); | ||
664 | return 0; | ||
665 | } | ||
749 | 666 | ||
750 | ret = ath10k_monitor_create(ar); | 667 | ret = ath10k_monitor_vdev_create(ar); |
751 | if (ret) { | 668 | if (ret) { |
752 | clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); | 669 | ath10k_warn("failed to create monitor vdev: %d\n", ret); |
753 | return ret; | 670 | return ret; |
754 | } | 671 | } |
755 | 672 | ||
756 | ret = ath10k_monitor_start(ar, ar->monitor_vdev_id); | 673 | ret = ath10k_monitor_vdev_start(ar, ar->monitor_vdev_id); |
674 | if (ret) { | ||
675 | ath10k_warn("failed to start monitor vdev: %d\n", ret); | ||
676 | ath10k_monitor_vdev_delete(ar); | ||
677 | return ret; | ||
678 | } | ||
679 | |||
680 | ar->monitor_started = true; | ||
681 | ath10k_dbg(ATH10K_DBG_MAC, "mac monitor started\n"); | ||
682 | |||
683 | return 0; | ||
684 | } | ||
685 | |||
686 | static void ath10k_monitor_stop(struct ath10k *ar) | ||
687 | { | ||
688 | int ret; | ||
689 | |||
690 | lockdep_assert_held(&ar->conf_mutex); | ||
691 | |||
692 | if (ath10k_monitor_is_enabled(ar)) { | ||
693 | ath10k_dbg(ATH10K_DBG_MAC, | ||
694 | "mac monitor will be stopped later\n"); | ||
695 | return; | ||
696 | } | ||
697 | |||
698 | if (!ar->monitor_started) { | ||
699 | ath10k_dbg(ATH10K_DBG_MAC, | ||
700 | "mac monitor probably failed to start earlier\n"); | ||
701 | return; | ||
702 | } | ||
703 | |||
704 | ret = ath10k_monitor_vdev_stop(ar); | ||
705 | if (ret) | ||
706 | ath10k_warn("failed to stop monitor vdev: %d\n", ret); | ||
707 | |||
708 | ret = ath10k_monitor_vdev_delete(ar); | ||
709 | if (ret) | ||
710 | ath10k_warn("failed to delete monitor vdev: %d\n", ret); | ||
711 | |||
712 | ar->monitor_started = false; | ||
713 | ath10k_dbg(ATH10K_DBG_MAC, "mac monitor stopped\n"); | ||
714 | } | ||
715 | |||
716 | static int ath10k_recalc_rtscts_prot(struct ath10k_vif *arvif) | ||
717 | { | ||
718 | struct ath10k *ar = arvif->ar; | ||
719 | u32 vdev_param, rts_cts = 0; | ||
720 | |||
721 | lockdep_assert_held(&ar->conf_mutex); | ||
722 | |||
723 | vdev_param = ar->wmi.vdev_param->enable_rtscts; | ||
724 | |||
725 | if (arvif->use_cts_prot || arvif->num_legacy_stations > 0) | ||
726 | rts_cts |= SM(WMI_RTSCTS_ENABLED, WMI_RTSCTS_SET); | ||
727 | |||
728 | if (arvif->num_legacy_stations > 0) | ||
729 | rts_cts |= SM(WMI_RTSCTS_ACROSS_SW_RETRIES, | ||
730 | WMI_RTSCTS_PROFILE); | ||
731 | |||
732 | return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, | ||
733 | rts_cts); | ||
734 | } | ||
735 | |||
736 | static int ath10k_start_cac(struct ath10k *ar) | ||
737 | { | ||
738 | int ret; | ||
739 | |||
740 | lockdep_assert_held(&ar->conf_mutex); | ||
741 | |||
742 | set_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); | ||
743 | |||
744 | ret = ath10k_monitor_start(ar); | ||
757 | if (ret) { | 745 | if (ret) { |
746 | ath10k_warn("failed to start monitor (cac): %d\n", ret); | ||
758 | clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); | 747 | clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); |
759 | ath10k_monitor_destroy(ar); | ||
760 | return ret; | 748 | return ret; |
761 | } | 749 | } |
762 | 750 | ||
@@ -774,58 +762,26 @@ static int ath10k_stop_cac(struct ath10k *ar) | |||
774 | if (!test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags)) | 762 | if (!test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags)) |
775 | return 0; | 763 | return 0; |
776 | 764 | ||
777 | ath10k_monitor_stop(ar); | ||
778 | ath10k_monitor_destroy(ar); | ||
779 | clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); | 765 | clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); |
766 | ath10k_monitor_stop(ar); | ||
780 | 767 | ||
781 | ath10k_dbg(ATH10K_DBG_MAC, "mac cac finished\n"); | 768 | ath10k_dbg(ATH10K_DBG_MAC, "mac cac finished\n"); |
782 | 769 | ||
783 | return 0; | 770 | return 0; |
784 | } | 771 | } |
785 | 772 | ||
786 | static const char *ath10k_dfs_state(enum nl80211_dfs_state dfs_state) | 773 | static void ath10k_recalc_radar_detection(struct ath10k *ar) |
787 | { | 774 | { |
788 | switch (dfs_state) { | ||
789 | case NL80211_DFS_USABLE: | ||
790 | return "USABLE"; | ||
791 | case NL80211_DFS_UNAVAILABLE: | ||
792 | return "UNAVAILABLE"; | ||
793 | case NL80211_DFS_AVAILABLE: | ||
794 | return "AVAILABLE"; | ||
795 | default: | ||
796 | WARN_ON(1); | ||
797 | return "bug"; | ||
798 | } | ||
799 | } | ||
800 | |||
801 | static void ath10k_config_radar_detection(struct ath10k *ar) | ||
802 | { | ||
803 | struct ieee80211_channel *chan = ar->hw->conf.chandef.chan; | ||
804 | bool radar = ar->hw->conf.radar_enabled; | ||
805 | bool chan_radar = !!(chan->flags & IEEE80211_CHAN_RADAR); | ||
806 | enum nl80211_dfs_state dfs_state = chan->dfs_state; | ||
807 | int ret; | 775 | int ret; |
808 | 776 | ||
809 | lockdep_assert_held(&ar->conf_mutex); | 777 | lockdep_assert_held(&ar->conf_mutex); |
810 | 778 | ||
811 | ath10k_dbg(ATH10K_DBG_MAC, | ||
812 | "mac radar config update: chan %dMHz radar %d chan radar %d chan state %s\n", | ||
813 | chan->center_freq, radar, chan_radar, | ||
814 | ath10k_dfs_state(dfs_state)); | ||
815 | |||
816 | /* | ||
817 | * It's safe to call it even if CAC is not started. | ||
818 | * This call here guarantees changing channel, etc. will stop CAC. | ||
819 | */ | ||
820 | ath10k_stop_cac(ar); | 779 | ath10k_stop_cac(ar); |
821 | 780 | ||
822 | if (!radar) | 781 | if (!ar->radar_enabled) |
823 | return; | ||
824 | |||
825 | if (!chan_radar) | ||
826 | return; | 782 | return; |
827 | 783 | ||
828 | if (dfs_state != NL80211_DFS_USABLE) | 784 | if (ar->num_started_vdevs > 0) |
829 | return; | 785 | return; |
830 | 786 | ||
831 | ret = ath10k_start_cac(ar); | 787 | ret = ath10k_start_cac(ar); |
@@ -835,11 +791,106 @@ static void ath10k_config_radar_detection(struct ath10k *ar) | |||
835 | * radiation is not allowed, make this channel DFS_UNAVAILABLE | 791 | * radiation is not allowed, make this channel DFS_UNAVAILABLE |
836 | * by indicating that radar was detected. | 792 | * by indicating that radar was detected. |
837 | */ | 793 | */ |
838 | ath10k_warn("failed to start CAC (%d)\n", ret); | 794 | ath10k_warn("failed to start CAC: %d\n", ret); |
839 | ieee80211_radar_detected(ar->hw); | 795 | ieee80211_radar_detected(ar->hw); |
840 | } | 796 | } |
841 | } | 797 | } |
842 | 798 | ||
799 | static int ath10k_vdev_start(struct ath10k_vif *arvif) | ||
800 | { | ||
801 | struct ath10k *ar = arvif->ar; | ||
802 | struct cfg80211_chan_def *chandef = &ar->chandef; | ||
803 | struct wmi_vdev_start_request_arg arg = {}; | ||
804 | int ret = 0; | ||
805 | |||
806 | lockdep_assert_held(&ar->conf_mutex); | ||
807 | |||
808 | reinit_completion(&ar->vdev_setup_done); | ||
809 | |||
810 | arg.vdev_id = arvif->vdev_id; | ||
811 | arg.dtim_period = arvif->dtim_period; | ||
812 | arg.bcn_intval = arvif->beacon_interval; | ||
813 | |||
814 | arg.channel.freq = chandef->chan->center_freq; | ||
815 | arg.channel.band_center_freq1 = chandef->center_freq1; | ||
816 | arg.channel.mode = chan_to_phymode(chandef); | ||
817 | |||
818 | arg.channel.min_power = 0; | ||
819 | arg.channel.max_power = chandef->chan->max_power * 2; | ||
820 | arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; | ||
821 | arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2; | ||
822 | |||
823 | if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { | ||
824 | arg.ssid = arvif->u.ap.ssid; | ||
825 | arg.ssid_len = arvif->u.ap.ssid_len; | ||
826 | arg.hidden_ssid = arvif->u.ap.hidden_ssid; | ||
827 | |||
828 | /* For now allow DFS for AP mode */ | ||
829 | arg.channel.chan_radar = | ||
830 | !!(chandef->chan->flags & IEEE80211_CHAN_RADAR); | ||
831 | } else if (arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { | ||
832 | arg.ssid = arvif->vif->bss_conf.ssid; | ||
833 | arg.ssid_len = arvif->vif->bss_conf.ssid_len; | ||
834 | } | ||
835 | |||
836 | ath10k_dbg(ATH10K_DBG_MAC, | ||
837 | "mac vdev %d start center_freq %d phymode %s\n", | ||
838 | arg.vdev_id, arg.channel.freq, | ||
839 | ath10k_wmi_phymode_str(arg.channel.mode)); | ||
840 | |||
841 | ret = ath10k_wmi_vdev_start(ar, &arg); | ||
842 | if (ret) { | ||
843 | ath10k_warn("failed to start WMI vdev %i: %d\n", | ||
844 | arg.vdev_id, ret); | ||
845 | return ret; | ||
846 | } | ||
847 | |||
848 | ret = ath10k_vdev_setup_sync(ar); | ||
849 | if (ret) { | ||
850 | ath10k_warn("failed to synchronise setup for vdev %i: %d\n", | ||
851 | arg.vdev_id, ret); | ||
852 | return ret; | ||
853 | } | ||
854 | |||
855 | ar->num_started_vdevs++; | ||
856 | ath10k_recalc_radar_detection(ar); | ||
857 | |||
858 | return ret; | ||
859 | } | ||
860 | |||
861 | static int ath10k_vdev_stop(struct ath10k_vif *arvif) | ||
862 | { | ||
863 | struct ath10k *ar = arvif->ar; | ||
864 | int ret; | ||
865 | |||
866 | lockdep_assert_held(&ar->conf_mutex); | ||
867 | |||
868 | reinit_completion(&ar->vdev_setup_done); | ||
869 | |||
870 | ret = ath10k_wmi_vdev_stop(ar, arvif->vdev_id); | ||
871 | if (ret) { | ||
872 | ath10k_warn("failed to stop WMI vdev %i: %d\n", | ||
873 | arvif->vdev_id, ret); | ||
874 | return ret; | ||
875 | } | ||
876 | |||
877 | ret = ath10k_vdev_setup_sync(ar); | ||
878 | if (ret) { | ||
879 | ath10k_warn("failed to syncronise setup for vdev %i: %d\n", | ||
880 | arvif->vdev_id, ret); | ||
881 | return ret; | ||
882 | } | ||
883 | |||
884 | WARN_ON(ar->num_started_vdevs == 0); | ||
885 | |||
886 | if (ar->num_started_vdevs != 0) { | ||
887 | ar->num_started_vdevs--; | ||
888 | ath10k_recalc_radar_detection(ar); | ||
889 | } | ||
890 | |||
891 | return ret; | ||
892 | } | ||
893 | |||
843 | static void ath10k_control_beaconing(struct ath10k_vif *arvif, | 894 | static void ath10k_control_beaconing(struct ath10k_vif *arvif, |
844 | struct ieee80211_bss_conf *info) | 895 | struct ieee80211_bss_conf *info) |
845 | { | 896 | { |
@@ -880,7 +931,7 @@ static void ath10k_control_beaconing(struct ath10k_vif *arvif, | |||
880 | ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, | 931 | ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, |
881 | arvif->bssid); | 932 | arvif->bssid); |
882 | if (ret) { | 933 | if (ret) { |
883 | ath10k_warn("Failed to bring up vdev %d: %i\n", | 934 | ath10k_warn("failed to bring up vdev %d: %i\n", |
884 | arvif->vdev_id, ret); | 935 | arvif->vdev_id, ret); |
885 | ath10k_vdev_stop(arvif); | 936 | ath10k_vdev_stop(arvif); |
886 | return; | 937 | return; |
@@ -904,7 +955,7 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif, | |||
904 | if (!info->ibss_joined) { | 955 | if (!info->ibss_joined) { |
905 | ret = ath10k_peer_delete(arvif->ar, arvif->vdev_id, self_peer); | 956 | ret = ath10k_peer_delete(arvif->ar, arvif->vdev_id, self_peer); |
906 | if (ret) | 957 | if (ret) |
907 | ath10k_warn("Failed to delete IBSS self peer:%pM for VDEV:%d ret:%d\n", | 958 | ath10k_warn("failed to delete IBSS self peer %pM for vdev %d: %d\n", |
908 | self_peer, arvif->vdev_id, ret); | 959 | self_peer, arvif->vdev_id, ret); |
909 | 960 | ||
910 | if (is_zero_ether_addr(arvif->bssid)) | 961 | if (is_zero_ether_addr(arvif->bssid)) |
@@ -913,7 +964,7 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif, | |||
913 | ret = ath10k_peer_delete(arvif->ar, arvif->vdev_id, | 964 | ret = ath10k_peer_delete(arvif->ar, arvif->vdev_id, |
914 | arvif->bssid); | 965 | arvif->bssid); |
915 | if (ret) { | 966 | if (ret) { |
916 | ath10k_warn("Failed to delete IBSS BSSID peer:%pM for VDEV:%d ret:%d\n", | 967 | ath10k_warn("failed to delete IBSS BSSID peer %pM for vdev %d: %d\n", |
917 | arvif->bssid, arvif->vdev_id, ret); | 968 | arvif->bssid, arvif->vdev_id, ret); |
918 | return; | 969 | return; |
919 | } | 970 | } |
@@ -925,7 +976,7 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif, | |||
925 | 976 | ||
926 | ret = ath10k_peer_create(arvif->ar, arvif->vdev_id, self_peer); | 977 | ret = ath10k_peer_create(arvif->ar, arvif->vdev_id, self_peer); |
927 | if (ret) { | 978 | if (ret) { |
928 | ath10k_warn("Failed to create IBSS self peer:%pM for VDEV:%d ret:%d\n", | 979 | ath10k_warn("failed to create IBSS self peer %pM for vdev %d: %d\n", |
929 | self_peer, arvif->vdev_id, ret); | 980 | self_peer, arvif->vdev_id, ret); |
930 | return; | 981 | return; |
931 | } | 982 | } |
@@ -934,7 +985,7 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif, | |||
934 | ret = ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id, vdev_param, | 985 | ret = ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id, vdev_param, |
935 | ATH10K_DEFAULT_ATIM); | 986 | ATH10K_DEFAULT_ATIM); |
936 | if (ret) | 987 | if (ret) |
937 | ath10k_warn("Failed to set IBSS ATIM for VDEV:%d ret:%d\n", | 988 | ath10k_warn("failed to set IBSS ATIM for vdev %d: %d\n", |
938 | arvif->vdev_id, ret); | 989 | arvif->vdev_id, ret); |
939 | } | 990 | } |
940 | 991 | ||
@@ -961,7 +1012,7 @@ static int ath10k_mac_vif_setup_ps(struct ath10k_vif *arvif) | |||
961 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, | 1012 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, |
962 | conf->dynamic_ps_timeout); | 1013 | conf->dynamic_ps_timeout); |
963 | if (ret) { | 1014 | if (ret) { |
964 | ath10k_warn("Failed to set inactivity time for vdev %d: %i\n", | 1015 | ath10k_warn("failed to set inactivity time for vdev %d: %i\n", |
965 | arvif->vdev_id, ret); | 1016 | arvif->vdev_id, ret); |
966 | return ret; | 1017 | return ret; |
967 | } | 1018 | } |
@@ -974,8 +1025,8 @@ static int ath10k_mac_vif_setup_ps(struct ath10k_vif *arvif) | |||
974 | 1025 | ||
975 | ret = ath10k_wmi_set_psmode(ar, arvif->vdev_id, psmode); | 1026 | ret = ath10k_wmi_set_psmode(ar, arvif->vdev_id, psmode); |
976 | if (ret) { | 1027 | if (ret) { |
977 | ath10k_warn("Failed to set PS Mode: %d for VDEV: %d\n", | 1028 | ath10k_warn("failed to set PS Mode %d for vdev %d: %d\n", |
978 | psmode, arvif->vdev_id); | 1029 | psmode, arvif->vdev_id, ret); |
979 | return ret; | 1030 | return ret; |
980 | } | 1031 | } |
981 | 1032 | ||
@@ -1429,7 +1480,7 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw, | |||
1429 | 1480 | ||
1430 | ap_sta = ieee80211_find_sta(vif, bss_conf->bssid); | 1481 | ap_sta = ieee80211_find_sta(vif, bss_conf->bssid); |
1431 | if (!ap_sta) { | 1482 | if (!ap_sta) { |
1432 | ath10k_warn("Failed to find station entry for %pM, vdev %i\n", | 1483 | ath10k_warn("failed to find station entry for bss %pM vdev %i\n", |
1433 | bss_conf->bssid, arvif->vdev_id); | 1484 | bss_conf->bssid, arvif->vdev_id); |
1434 | rcu_read_unlock(); | 1485 | rcu_read_unlock(); |
1435 | return; | 1486 | return; |
@@ -1442,7 +1493,7 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw, | |||
1442 | ret = ath10k_peer_assoc_prepare(ar, arvif, ap_sta, | 1493 | ret = ath10k_peer_assoc_prepare(ar, arvif, ap_sta, |
1443 | bss_conf, &peer_arg); | 1494 | bss_conf, &peer_arg); |
1444 | if (ret) { | 1495 | if (ret) { |
1445 | ath10k_warn("Peer assoc prepare failed for %pM vdev %i\n: %d", | 1496 | ath10k_warn("failed to prepare peer assoc for %pM vdev %i: %d\n", |
1446 | bss_conf->bssid, arvif->vdev_id, ret); | 1497 | bss_conf->bssid, arvif->vdev_id, ret); |
1447 | rcu_read_unlock(); | 1498 | rcu_read_unlock(); |
1448 | return; | 1499 | return; |
@@ -1452,7 +1503,7 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw, | |||
1452 | 1503 | ||
1453 | ret = ath10k_wmi_peer_assoc(ar, &peer_arg); | 1504 | ret = ath10k_wmi_peer_assoc(ar, &peer_arg); |
1454 | if (ret) { | 1505 | if (ret) { |
1455 | ath10k_warn("Peer assoc failed for %pM vdev %i\n: %d", | 1506 | ath10k_warn("failed to run peer assoc for %pM vdev %i: %d\n", |
1456 | bss_conf->bssid, arvif->vdev_id, ret); | 1507 | bss_conf->bssid, arvif->vdev_id, ret); |
1457 | return; | 1508 | return; |
1458 | } | 1509 | } |
@@ -1473,7 +1524,7 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw, | |||
1473 | 1524 | ||
1474 | ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid); | 1525 | ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid); |
1475 | if (ret) { | 1526 | if (ret) { |
1476 | ath10k_warn("VDEV: %d up failed: ret %d\n", | 1527 | ath10k_warn("failed to set vdev %d up: %d\n", |
1477 | arvif->vdev_id, ret); | 1528 | arvif->vdev_id, ret); |
1478 | return; | 1529 | return; |
1479 | } | 1530 | } |
@@ -1524,7 +1575,7 @@ static void ath10k_bss_disassoc(struct ieee80211_hw *hw, | |||
1524 | } | 1575 | } |
1525 | 1576 | ||
1526 | static int ath10k_station_assoc(struct ath10k *ar, struct ath10k_vif *arvif, | 1577 | static int ath10k_station_assoc(struct ath10k *ar, struct ath10k_vif *arvif, |
1527 | struct ieee80211_sta *sta) | 1578 | struct ieee80211_sta *sta, bool reassoc) |
1528 | { | 1579 | { |
1529 | struct wmi_peer_assoc_complete_arg peer_arg; | 1580 | struct wmi_peer_assoc_complete_arg peer_arg; |
1530 | int ret = 0; | 1581 | int ret = 0; |
@@ -1533,34 +1584,46 @@ static int ath10k_station_assoc(struct ath10k *ar, struct ath10k_vif *arvif, | |||
1533 | 1584 | ||
1534 | ret = ath10k_peer_assoc_prepare(ar, arvif, sta, NULL, &peer_arg); | 1585 | ret = ath10k_peer_assoc_prepare(ar, arvif, sta, NULL, &peer_arg); |
1535 | if (ret) { | 1586 | if (ret) { |
1536 | ath10k_warn("WMI peer assoc prepare failed for %pM vdev %i: %i\n", | 1587 | ath10k_warn("failed to prepare WMI peer assoc for %pM vdev %i: %i\n", |
1537 | sta->addr, arvif->vdev_id, ret); | 1588 | sta->addr, arvif->vdev_id, ret); |
1538 | return ret; | 1589 | return ret; |
1539 | } | 1590 | } |
1540 | 1591 | ||
1592 | peer_arg.peer_reassoc = reassoc; | ||
1541 | ret = ath10k_wmi_peer_assoc(ar, &peer_arg); | 1593 | ret = ath10k_wmi_peer_assoc(ar, &peer_arg); |
1542 | if (ret) { | 1594 | if (ret) { |
1543 | ath10k_warn("Peer assoc failed for STA %pM vdev %i: %d\n", | 1595 | ath10k_warn("failed to run peer assoc for STA %pM vdev %i: %d\n", |
1544 | sta->addr, arvif->vdev_id, ret); | 1596 | sta->addr, arvif->vdev_id, ret); |
1545 | return ret; | 1597 | return ret; |
1546 | } | 1598 | } |
1547 | 1599 | ||
1548 | ret = ath10k_setup_peer_smps(ar, arvif, sta->addr, &sta->ht_cap); | 1600 | ret = ath10k_setup_peer_smps(ar, arvif, sta->addr, &sta->ht_cap); |
1549 | if (ret) { | 1601 | if (ret) { |
1550 | ath10k_warn("failed to setup peer SMPS for vdev: %d\n", ret); | 1602 | ath10k_warn("failed to setup peer SMPS for vdev %d: %d\n", |
1603 | arvif->vdev_id, ret); | ||
1551 | return ret; | 1604 | return ret; |
1552 | } | 1605 | } |
1553 | 1606 | ||
1607 | if (!sta->wme) { | ||
1608 | arvif->num_legacy_stations++; | ||
1609 | ret = ath10k_recalc_rtscts_prot(arvif); | ||
1610 | if (ret) { | ||
1611 | ath10k_warn("failed to recalculate rts/cts prot for vdev %d: %d\n", | ||
1612 | arvif->vdev_id, ret); | ||
1613 | return ret; | ||
1614 | } | ||
1615 | } | ||
1616 | |||
1554 | ret = ath10k_install_peer_wep_keys(arvif, sta->addr); | 1617 | ret = ath10k_install_peer_wep_keys(arvif, sta->addr); |
1555 | if (ret) { | 1618 | if (ret) { |
1556 | ath10k_warn("could not install peer wep keys for vdev %i: %d\n", | 1619 | ath10k_warn("failed to install peer wep keys for vdev %i: %d\n", |
1557 | arvif->vdev_id, ret); | 1620 | arvif->vdev_id, ret); |
1558 | return ret; | 1621 | return ret; |
1559 | } | 1622 | } |
1560 | 1623 | ||
1561 | ret = ath10k_peer_assoc_qos_ap(ar, arvif, sta); | 1624 | ret = ath10k_peer_assoc_qos_ap(ar, arvif, sta); |
1562 | if (ret) { | 1625 | if (ret) { |
1563 | ath10k_warn("could not set qos params for STA %pM for vdev %i: %d\n", | 1626 | ath10k_warn("failed to set qos params for STA %pM for vdev %i: %d\n", |
1564 | sta->addr, arvif->vdev_id, ret); | 1627 | sta->addr, arvif->vdev_id, ret); |
1565 | return ret; | 1628 | return ret; |
1566 | } | 1629 | } |
@@ -1575,9 +1638,19 @@ static int ath10k_station_disassoc(struct ath10k *ar, struct ath10k_vif *arvif, | |||
1575 | 1638 | ||
1576 | lockdep_assert_held(&ar->conf_mutex); | 1639 | lockdep_assert_held(&ar->conf_mutex); |
1577 | 1640 | ||
1641 | if (!sta->wme) { | ||
1642 | arvif->num_legacy_stations--; | ||
1643 | ret = ath10k_recalc_rtscts_prot(arvif); | ||
1644 | if (ret) { | ||
1645 | ath10k_warn("failed to recalculate rts/cts prot for vdev %d: %d\n", | ||
1646 | arvif->vdev_id, ret); | ||
1647 | return ret; | ||
1648 | } | ||
1649 | } | ||
1650 | |||
1578 | ret = ath10k_clear_peer_keys(arvif, sta->addr); | 1651 | ret = ath10k_clear_peer_keys(arvif, sta->addr); |
1579 | if (ret) { | 1652 | if (ret) { |
1580 | ath10k_warn("could not clear all peer wep keys for vdev %i: %d\n", | 1653 | ath10k_warn("failed to clear all peer wep keys for vdev %i: %d\n", |
1581 | arvif->vdev_id, ret); | 1654 | arvif->vdev_id, ret); |
1582 | return ret; | 1655 | return ret; |
1583 | } | 1656 | } |
@@ -1685,19 +1758,44 @@ static int ath10k_update_channel_list(struct ath10k *ar) | |||
1685 | return ret; | 1758 | return ret; |
1686 | } | 1759 | } |
1687 | 1760 | ||
1761 | static enum wmi_dfs_region | ||
1762 | ath10k_mac_get_dfs_region(enum nl80211_dfs_regions dfs_region) | ||
1763 | { | ||
1764 | switch (dfs_region) { | ||
1765 | case NL80211_DFS_UNSET: | ||
1766 | return WMI_UNINIT_DFS_DOMAIN; | ||
1767 | case NL80211_DFS_FCC: | ||
1768 | return WMI_FCC_DFS_DOMAIN; | ||
1769 | case NL80211_DFS_ETSI: | ||
1770 | return WMI_ETSI_DFS_DOMAIN; | ||
1771 | case NL80211_DFS_JP: | ||
1772 | return WMI_MKK4_DFS_DOMAIN; | ||
1773 | } | ||
1774 | return WMI_UNINIT_DFS_DOMAIN; | ||
1775 | } | ||
1776 | |||
1688 | static void ath10k_regd_update(struct ath10k *ar) | 1777 | static void ath10k_regd_update(struct ath10k *ar) |
1689 | { | 1778 | { |
1690 | struct reg_dmn_pair_mapping *regpair; | 1779 | struct reg_dmn_pair_mapping *regpair; |
1691 | int ret; | 1780 | int ret; |
1781 | enum wmi_dfs_region wmi_dfs_reg; | ||
1782 | enum nl80211_dfs_regions nl_dfs_reg; | ||
1692 | 1783 | ||
1693 | lockdep_assert_held(&ar->conf_mutex); | 1784 | lockdep_assert_held(&ar->conf_mutex); |
1694 | 1785 | ||
1695 | ret = ath10k_update_channel_list(ar); | 1786 | ret = ath10k_update_channel_list(ar); |
1696 | if (ret) | 1787 | if (ret) |
1697 | ath10k_warn("could not update channel list (%d)\n", ret); | 1788 | ath10k_warn("failed to update channel list: %d\n", ret); |
1698 | 1789 | ||
1699 | regpair = ar->ath_common.regulatory.regpair; | 1790 | regpair = ar->ath_common.regulatory.regpair; |
1700 | 1791 | ||
1792 | if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { | ||
1793 | nl_dfs_reg = ar->dfs_detector->region; | ||
1794 | wmi_dfs_reg = ath10k_mac_get_dfs_region(nl_dfs_reg); | ||
1795 | } else { | ||
1796 | wmi_dfs_reg = WMI_UNINIT_DFS_DOMAIN; | ||
1797 | } | ||
1798 | |||
1701 | /* Target allows setting up per-band regdomain but ath_common provides | 1799 | /* Target allows setting up per-band regdomain but ath_common provides |
1702 | * a combined one only */ | 1800 | * a combined one only */ |
1703 | ret = ath10k_wmi_pdev_set_regdomain(ar, | 1801 | ret = ath10k_wmi_pdev_set_regdomain(ar, |
@@ -1705,9 +1803,10 @@ static void ath10k_regd_update(struct ath10k *ar) | |||
1705 | regpair->reg_domain, /* 2ghz */ | 1803 | regpair->reg_domain, /* 2ghz */ |
1706 | regpair->reg_domain, /* 5ghz */ | 1804 | regpair->reg_domain, /* 5ghz */ |
1707 | regpair->reg_2ghz_ctl, | 1805 | regpair->reg_2ghz_ctl, |
1708 | regpair->reg_5ghz_ctl); | 1806 | regpair->reg_5ghz_ctl, |
1807 | wmi_dfs_reg); | ||
1709 | if (ret) | 1808 | if (ret) |
1710 | ath10k_warn("could not set pdev regdomain (%d)\n", ret); | 1809 | ath10k_warn("failed to set pdev regdomain: %d\n", ret); |
1711 | } | 1810 | } |
1712 | 1811 | ||
1713 | static void ath10k_reg_notifier(struct wiphy *wiphy, | 1812 | static void ath10k_reg_notifier(struct wiphy *wiphy, |
@@ -1725,7 +1824,7 @@ static void ath10k_reg_notifier(struct wiphy *wiphy, | |||
1725 | result = ar->dfs_detector->set_dfs_domain(ar->dfs_detector, | 1824 | result = ar->dfs_detector->set_dfs_domain(ar->dfs_detector, |
1726 | request->dfs_region); | 1825 | request->dfs_region); |
1727 | if (!result) | 1826 | if (!result) |
1728 | ath10k_warn("dfs region 0x%X not supported, will trigger radar for every pulse\n", | 1827 | ath10k_warn("DFS region 0x%X not supported, will trigger radar for every pulse\n", |
1729 | request->dfs_region); | 1828 | request->dfs_region); |
1730 | } | 1829 | } |
1731 | 1830 | ||
@@ -1759,10 +1858,10 @@ static u8 ath10k_tx_h_get_vdev_id(struct ath10k *ar, | |||
1759 | if (info->control.vif) | 1858 | if (info->control.vif) |
1760 | return ath10k_vif_to_arvif(info->control.vif)->vdev_id; | 1859 | return ath10k_vif_to_arvif(info->control.vif)->vdev_id; |
1761 | 1860 | ||
1762 | if (ar->monitor_enabled) | 1861 | if (ar->monitor_started) |
1763 | return ar->monitor_vdev_id; | 1862 | return ar->monitor_vdev_id; |
1764 | 1863 | ||
1765 | ath10k_warn("could not resolve vdev id\n"); | 1864 | ath10k_warn("failed to resolve vdev id\n"); |
1766 | return 0; | 1865 | return 0; |
1767 | } | 1866 | } |
1768 | 1867 | ||
@@ -1792,8 +1891,13 @@ static void ath10k_tx_wep_key_work(struct work_struct *work) | |||
1792 | wep_key_work); | 1891 | wep_key_work); |
1793 | int ret, keyidx = arvif->def_wep_key_newidx; | 1892 | int ret, keyidx = arvif->def_wep_key_newidx; |
1794 | 1893 | ||
1894 | mutex_lock(&arvif->ar->conf_mutex); | ||
1895 | |||
1896 | if (arvif->ar->state != ATH10K_STATE_ON) | ||
1897 | goto unlock; | ||
1898 | |||
1795 | if (arvif->def_wep_key_idx == keyidx) | 1899 | if (arvif->def_wep_key_idx == keyidx) |
1796 | return; | 1900 | goto unlock; |
1797 | 1901 | ||
1798 | ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d set keyidx %d\n", | 1902 | ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d set keyidx %d\n", |
1799 | arvif->vdev_id, keyidx); | 1903 | arvif->vdev_id, keyidx); |
@@ -1803,11 +1907,16 @@ static void ath10k_tx_wep_key_work(struct work_struct *work) | |||
1803 | arvif->ar->wmi.vdev_param->def_keyid, | 1907 | arvif->ar->wmi.vdev_param->def_keyid, |
1804 | keyidx); | 1908 | keyidx); |
1805 | if (ret) { | 1909 | if (ret) { |
1806 | ath10k_warn("could not update wep keyidx (%d)\n", ret); | 1910 | ath10k_warn("failed to update wep key index for vdev %d: %d\n", |
1807 | return; | 1911 | arvif->vdev_id, |
1912 | ret); | ||
1913 | goto unlock; | ||
1808 | } | 1914 | } |
1809 | 1915 | ||
1810 | arvif->def_wep_key_idx = keyidx; | 1916 | arvif->def_wep_key_idx = keyidx; |
1917 | |||
1918 | unlock: | ||
1919 | mutex_unlock(&arvif->ar->conf_mutex); | ||
1811 | } | 1920 | } |
1812 | 1921 | ||
1813 | static void ath10k_tx_h_update_wep_key(struct sk_buff *skb) | 1922 | static void ath10k_tx_h_update_wep_key(struct sk_buff *skb) |
@@ -1879,7 +1988,7 @@ static void ath10k_tx_htt(struct ath10k *ar, struct sk_buff *skb) | |||
1879 | ar->fw_features)) { | 1988 | ar->fw_features)) { |
1880 | if (skb_queue_len(&ar->wmi_mgmt_tx_queue) >= | 1989 | if (skb_queue_len(&ar->wmi_mgmt_tx_queue) >= |
1881 | ATH10K_MAX_NUM_MGMT_PENDING) { | 1990 | ATH10K_MAX_NUM_MGMT_PENDING) { |
1882 | ath10k_warn("wmi mgmt_tx queue limit reached\n"); | 1991 | ath10k_warn("reached WMI management tranmist queue limit\n"); |
1883 | ret = -EBUSY; | 1992 | ret = -EBUSY; |
1884 | goto exit; | 1993 | goto exit; |
1885 | } | 1994 | } |
@@ -1903,7 +2012,7 @@ static void ath10k_tx_htt(struct ath10k *ar, struct sk_buff *skb) | |||
1903 | 2012 | ||
1904 | exit: | 2013 | exit: |
1905 | if (ret) { | 2014 | if (ret) { |
1906 | ath10k_warn("tx failed (%d). dropping packet.\n", ret); | 2015 | ath10k_warn("failed to transmit packet, dropping: %d\n", ret); |
1907 | ieee80211_free_txskb(ar->hw, skb); | 2016 | ieee80211_free_txskb(ar->hw, skb); |
1908 | } | 2017 | } |
1909 | } | 2018 | } |
@@ -1964,7 +2073,7 @@ void ath10k_offchan_tx_work(struct work_struct *work) | |||
1964 | if (!peer) { | 2073 | if (!peer) { |
1965 | ret = ath10k_peer_create(ar, vdev_id, peer_addr); | 2074 | ret = ath10k_peer_create(ar, vdev_id, peer_addr); |
1966 | if (ret) | 2075 | if (ret) |
1967 | ath10k_warn("peer %pM on vdev %d not created (%d)\n", | 2076 | ath10k_warn("failed to create peer %pM on vdev %d: %d\n", |
1968 | peer_addr, vdev_id, ret); | 2077 | peer_addr, vdev_id, ret); |
1969 | } | 2078 | } |
1970 | 2079 | ||
@@ -1984,7 +2093,7 @@ void ath10k_offchan_tx_work(struct work_struct *work) | |||
1984 | if (!peer) { | 2093 | if (!peer) { |
1985 | ret = ath10k_peer_delete(ar, vdev_id, peer_addr); | 2094 | ret = ath10k_peer_delete(ar, vdev_id, peer_addr); |
1986 | if (ret) | 2095 | if (ret) |
1987 | ath10k_warn("peer %pM on vdev %d not deleted (%d)\n", | 2096 | ath10k_warn("failed to delete peer %pM on vdev %d: %d\n", |
1988 | peer_addr, vdev_id, ret); | 2097 | peer_addr, vdev_id, ret); |
1989 | } | 2098 | } |
1990 | 2099 | ||
@@ -2018,7 +2127,8 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work) | |||
2018 | 2127 | ||
2019 | ret = ath10k_wmi_mgmt_tx(ar, skb); | 2128 | ret = ath10k_wmi_mgmt_tx(ar, skb); |
2020 | if (ret) { | 2129 | if (ret) { |
2021 | ath10k_warn("wmi mgmt_tx failed (%d)\n", ret); | 2130 | ath10k_warn("failed to transmit management frame via WMI: %d\n", |
2131 | ret); | ||
2022 | ieee80211_free_txskb(ar->hw, skb); | 2132 | ieee80211_free_txskb(ar->hw, skb); |
2023 | } | 2133 | } |
2024 | } | 2134 | } |
@@ -2043,7 +2153,7 @@ void ath10k_reset_scan(unsigned long ptr) | |||
2043 | return; | 2153 | return; |
2044 | } | 2154 | } |
2045 | 2155 | ||
2046 | ath10k_warn("scan timeout. resetting. fw issue?\n"); | 2156 | ath10k_warn("scan timed out, firmware problem?\n"); |
2047 | 2157 | ||
2048 | if (ar->scan.is_roc) | 2158 | if (ar->scan.is_roc) |
2049 | ieee80211_remain_on_channel_expired(ar->hw); | 2159 | ieee80211_remain_on_channel_expired(ar->hw); |
@@ -2079,7 +2189,7 @@ static int ath10k_abort_scan(struct ath10k *ar) | |||
2079 | 2189 | ||
2080 | ret = ath10k_wmi_stop_scan(ar, &arg); | 2190 | ret = ath10k_wmi_stop_scan(ar, &arg); |
2081 | if (ret) { | 2191 | if (ret) { |
2082 | ath10k_warn("could not submit wmi stop scan (%d)\n", ret); | 2192 | ath10k_warn("failed to stop wmi scan: %d\n", ret); |
2083 | spin_lock_bh(&ar->data_lock); | 2193 | spin_lock_bh(&ar->data_lock); |
2084 | ar->scan.in_progress = false; | 2194 | ar->scan.in_progress = false; |
2085 | ath10k_offchan_tx_purge(ar); | 2195 | ath10k_offchan_tx_purge(ar); |
@@ -2099,7 +2209,7 @@ static int ath10k_abort_scan(struct ath10k *ar) | |||
2099 | 2209 | ||
2100 | spin_lock_bh(&ar->data_lock); | 2210 | spin_lock_bh(&ar->data_lock); |
2101 | if (ar->scan.in_progress) { | 2211 | if (ar->scan.in_progress) { |
2102 | ath10k_warn("could not stop scan. its still in progress\n"); | 2212 | ath10k_warn("failed to stop scan, it's still in progress\n"); |
2103 | ar->scan.in_progress = false; | 2213 | ar->scan.in_progress = false; |
2104 | ath10k_offchan_tx_purge(ar); | 2214 | ath10k_offchan_tx_purge(ar); |
2105 | ret = -ETIMEDOUT; | 2215 | ret = -ETIMEDOUT; |
@@ -2187,72 +2297,171 @@ static void ath10k_tx(struct ieee80211_hw *hw, | |||
2187 | ath10k_tx_htt(ar, skb); | 2297 | ath10k_tx_htt(ar, skb); |
2188 | } | 2298 | } |
2189 | 2299 | ||
2190 | /* | 2300 | /* Must not be called with conf_mutex held as workers can use that also. */ |
2191 | * Initialize various parameters with default vaules. | 2301 | static void ath10k_drain_tx(struct ath10k *ar) |
2192 | */ | 2302 | { |
2303 | /* make sure rcu-protected mac80211 tx path itself is drained */ | ||
2304 | synchronize_net(); | ||
2305 | |||
2306 | ath10k_offchan_tx_purge(ar); | ||
2307 | ath10k_mgmt_over_wmi_tx_purge(ar); | ||
2308 | |||
2309 | cancel_work_sync(&ar->offchan_tx_work); | ||
2310 | cancel_work_sync(&ar->wmi_mgmt_tx_work); | ||
2311 | } | ||
2312 | |||
2193 | void ath10k_halt(struct ath10k *ar) | 2313 | void ath10k_halt(struct ath10k *ar) |
2194 | { | 2314 | { |
2315 | struct ath10k_vif *arvif; | ||
2316 | |||
2195 | lockdep_assert_held(&ar->conf_mutex); | 2317 | lockdep_assert_held(&ar->conf_mutex); |
2196 | 2318 | ||
2197 | ath10k_stop_cac(ar); | 2319 | if (ath10k_monitor_is_enabled(ar)) { |
2320 | clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); | ||
2321 | ar->promisc = false; | ||
2322 | ar->monitor = false; | ||
2323 | ath10k_monitor_stop(ar); | ||
2324 | } | ||
2325 | |||
2198 | del_timer_sync(&ar->scan.timeout); | 2326 | del_timer_sync(&ar->scan.timeout); |
2199 | ath10k_offchan_tx_purge(ar); | 2327 | ath10k_reset_scan((unsigned long)ar); |
2200 | ath10k_mgmt_over_wmi_tx_purge(ar); | ||
2201 | ath10k_peer_cleanup_all(ar); | 2328 | ath10k_peer_cleanup_all(ar); |
2202 | ath10k_core_stop(ar); | 2329 | ath10k_core_stop(ar); |
2203 | ath10k_hif_power_down(ar); | 2330 | ath10k_hif_power_down(ar); |
2204 | 2331 | ||
2205 | spin_lock_bh(&ar->data_lock); | 2332 | spin_lock_bh(&ar->data_lock); |
2206 | if (ar->scan.in_progress) { | 2333 | list_for_each_entry(arvif, &ar->arvifs, list) { |
2207 | del_timer(&ar->scan.timeout); | 2334 | if (!arvif->beacon) |
2208 | ar->scan.in_progress = false; | 2335 | continue; |
2209 | ieee80211_scan_completed(ar->hw, true); | 2336 | |
2337 | dma_unmap_single(arvif->ar->dev, | ||
2338 | ATH10K_SKB_CB(arvif->beacon)->paddr, | ||
2339 | arvif->beacon->len, DMA_TO_DEVICE); | ||
2340 | dev_kfree_skb_any(arvif->beacon); | ||
2341 | arvif->beacon = NULL; | ||
2210 | } | 2342 | } |
2211 | spin_unlock_bh(&ar->data_lock); | 2343 | spin_unlock_bh(&ar->data_lock); |
2212 | } | 2344 | } |
2213 | 2345 | ||
2346 | static int ath10k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) | ||
2347 | { | ||
2348 | struct ath10k *ar = hw->priv; | ||
2349 | |||
2350 | mutex_lock(&ar->conf_mutex); | ||
2351 | |||
2352 | if (ar->cfg_tx_chainmask) { | ||
2353 | *tx_ant = ar->cfg_tx_chainmask; | ||
2354 | *rx_ant = ar->cfg_rx_chainmask; | ||
2355 | } else { | ||
2356 | *tx_ant = ar->supp_tx_chainmask; | ||
2357 | *rx_ant = ar->supp_rx_chainmask; | ||
2358 | } | ||
2359 | |||
2360 | mutex_unlock(&ar->conf_mutex); | ||
2361 | |||
2362 | return 0; | ||
2363 | } | ||
2364 | |||
2365 | static int __ath10k_set_antenna(struct ath10k *ar, u32 tx_ant, u32 rx_ant) | ||
2366 | { | ||
2367 | int ret; | ||
2368 | |||
2369 | lockdep_assert_held(&ar->conf_mutex); | ||
2370 | |||
2371 | ar->cfg_tx_chainmask = tx_ant; | ||
2372 | ar->cfg_rx_chainmask = rx_ant; | ||
2373 | |||
2374 | if ((ar->state != ATH10K_STATE_ON) && | ||
2375 | (ar->state != ATH10K_STATE_RESTARTED)) | ||
2376 | return 0; | ||
2377 | |||
2378 | ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->tx_chain_mask, | ||
2379 | tx_ant); | ||
2380 | if (ret) { | ||
2381 | ath10k_warn("failed to set tx-chainmask: %d, req 0x%x\n", | ||
2382 | ret, tx_ant); | ||
2383 | return ret; | ||
2384 | } | ||
2385 | |||
2386 | ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->rx_chain_mask, | ||
2387 | rx_ant); | ||
2388 | if (ret) { | ||
2389 | ath10k_warn("failed to set rx-chainmask: %d, req 0x%x\n", | ||
2390 | ret, rx_ant); | ||
2391 | return ret; | ||
2392 | } | ||
2393 | |||
2394 | return 0; | ||
2395 | } | ||
2396 | |||
2397 | static int ath10k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) | ||
2398 | { | ||
2399 | struct ath10k *ar = hw->priv; | ||
2400 | int ret; | ||
2401 | |||
2402 | mutex_lock(&ar->conf_mutex); | ||
2403 | ret = __ath10k_set_antenna(ar, tx_ant, rx_ant); | ||
2404 | mutex_unlock(&ar->conf_mutex); | ||
2405 | return ret; | ||
2406 | } | ||
2407 | |||
2214 | static int ath10k_start(struct ieee80211_hw *hw) | 2408 | static int ath10k_start(struct ieee80211_hw *hw) |
2215 | { | 2409 | { |
2216 | struct ath10k *ar = hw->priv; | 2410 | struct ath10k *ar = hw->priv; |
2217 | int ret = 0; | 2411 | int ret = 0; |
2218 | 2412 | ||
2413 | /* | ||
2414 | * This makes sense only when restarting hw. It is harmless to call | ||
2415 | * uncoditionally. This is necessary to make sure no HTT/WMI tx | ||
2416 | * commands will be submitted while restarting. | ||
2417 | */ | ||
2418 | ath10k_drain_tx(ar); | ||
2419 | |||
2219 | mutex_lock(&ar->conf_mutex); | 2420 | mutex_lock(&ar->conf_mutex); |
2220 | 2421 | ||
2221 | if (ar->state != ATH10K_STATE_OFF && | 2422 | switch (ar->state) { |
2222 | ar->state != ATH10K_STATE_RESTARTING) { | 2423 | case ATH10K_STATE_OFF: |
2424 | ar->state = ATH10K_STATE_ON; | ||
2425 | break; | ||
2426 | case ATH10K_STATE_RESTARTING: | ||
2427 | ath10k_halt(ar); | ||
2428 | ar->state = ATH10K_STATE_RESTARTED; | ||
2429 | break; | ||
2430 | case ATH10K_STATE_ON: | ||
2431 | case ATH10K_STATE_RESTARTED: | ||
2432 | case ATH10K_STATE_WEDGED: | ||
2433 | WARN_ON(1); | ||
2223 | ret = -EINVAL; | 2434 | ret = -EINVAL; |
2224 | goto exit; | 2435 | goto err; |
2225 | } | 2436 | } |
2226 | 2437 | ||
2227 | ret = ath10k_hif_power_up(ar); | 2438 | ret = ath10k_hif_power_up(ar); |
2228 | if (ret) { | 2439 | if (ret) { |
2229 | ath10k_err("could not init hif (%d)\n", ret); | 2440 | ath10k_err("Could not init hif: %d\n", ret); |
2230 | ar->state = ATH10K_STATE_OFF; | 2441 | goto err_off; |
2231 | goto exit; | ||
2232 | } | 2442 | } |
2233 | 2443 | ||
2234 | ret = ath10k_core_start(ar); | 2444 | ret = ath10k_core_start(ar); |
2235 | if (ret) { | 2445 | if (ret) { |
2236 | ath10k_err("could not init core (%d)\n", ret); | 2446 | ath10k_err("Could not init core: %d\n", ret); |
2237 | ath10k_hif_power_down(ar); | 2447 | goto err_power_down; |
2238 | ar->state = ATH10K_STATE_OFF; | ||
2239 | goto exit; | ||
2240 | } | 2448 | } |
2241 | 2449 | ||
2242 | if (ar->state == ATH10K_STATE_OFF) | ||
2243 | ar->state = ATH10K_STATE_ON; | ||
2244 | else if (ar->state == ATH10K_STATE_RESTARTING) | ||
2245 | ar->state = ATH10K_STATE_RESTARTED; | ||
2246 | |||
2247 | ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->pmf_qos, 1); | 2450 | ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->pmf_qos, 1); |
2248 | if (ret) | 2451 | if (ret) { |
2249 | ath10k_warn("could not enable WMI_PDEV_PARAM_PMF_QOS (%d)\n", | 2452 | ath10k_warn("failed to enable PMF QOS: %d\n", ret); |
2250 | ret); | 2453 | goto err_core_stop; |
2454 | } | ||
2251 | 2455 | ||
2252 | ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->dynamic_bw, 1); | 2456 | ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->dynamic_bw, 1); |
2253 | if (ret) | 2457 | if (ret) { |
2254 | ath10k_warn("could not init WMI_PDEV_PARAM_DYNAMIC_BW (%d)\n", | 2458 | ath10k_warn("failed to enable dynamic BW: %d\n", ret); |
2255 | ret); | 2459 | goto err_core_stop; |
2460 | } | ||
2461 | |||
2462 | if (ar->cfg_tx_chainmask) | ||
2463 | __ath10k_set_antenna(ar, ar->cfg_tx_chainmask, | ||
2464 | ar->cfg_rx_chainmask); | ||
2256 | 2465 | ||
2257 | /* | 2466 | /* |
2258 | * By default FW set ARP frames ac to voice (6). In that case ARP | 2467 | * By default FW set ARP frames ac to voice (6). In that case ARP |
@@ -2266,15 +2475,27 @@ static int ath10k_start(struct ieee80211_hw *hw) | |||
2266 | ret = ath10k_wmi_pdev_set_param(ar, | 2475 | ret = ath10k_wmi_pdev_set_param(ar, |
2267 | ar->wmi.pdev_param->arp_ac_override, 0); | 2476 | ar->wmi.pdev_param->arp_ac_override, 0); |
2268 | if (ret) { | 2477 | if (ret) { |
2269 | ath10k_warn("could not set arp ac override parameter: %d\n", | 2478 | ath10k_warn("failed to set arp ac override parameter: %d\n", |
2270 | ret); | 2479 | ret); |
2271 | goto exit; | 2480 | goto err_core_stop; |
2272 | } | 2481 | } |
2273 | 2482 | ||
2483 | ar->num_started_vdevs = 0; | ||
2274 | ath10k_regd_update(ar); | 2484 | ath10k_regd_update(ar); |
2275 | ret = 0; | ||
2276 | 2485 | ||
2277 | exit: | 2486 | mutex_unlock(&ar->conf_mutex); |
2487 | return 0; | ||
2488 | |||
2489 | err_core_stop: | ||
2490 | ath10k_core_stop(ar); | ||
2491 | |||
2492 | err_power_down: | ||
2493 | ath10k_hif_power_down(ar); | ||
2494 | |||
2495 | err_off: | ||
2496 | ar->state = ATH10K_STATE_OFF; | ||
2497 | |||
2498 | err: | ||
2278 | mutex_unlock(&ar->conf_mutex); | 2499 | mutex_unlock(&ar->conf_mutex); |
2279 | return ret; | 2500 | return ret; |
2280 | } | 2501 | } |
@@ -2283,19 +2504,15 @@ static void ath10k_stop(struct ieee80211_hw *hw) | |||
2283 | { | 2504 | { |
2284 | struct ath10k *ar = hw->priv; | 2505 | struct ath10k *ar = hw->priv; |
2285 | 2506 | ||
2507 | ath10k_drain_tx(ar); | ||
2508 | |||
2286 | mutex_lock(&ar->conf_mutex); | 2509 | mutex_lock(&ar->conf_mutex); |
2287 | if (ar->state == ATH10K_STATE_ON || | 2510 | if (ar->state != ATH10K_STATE_OFF) { |
2288 | ar->state == ATH10K_STATE_RESTARTED || | ||
2289 | ar->state == ATH10K_STATE_WEDGED) | ||
2290 | ath10k_halt(ar); | 2511 | ath10k_halt(ar); |
2291 | 2512 | ar->state = ATH10K_STATE_OFF; | |
2292 | ar->state = ATH10K_STATE_OFF; | 2513 | } |
2293 | mutex_unlock(&ar->conf_mutex); | 2514 | mutex_unlock(&ar->conf_mutex); |
2294 | 2515 | ||
2295 | ath10k_mgmt_over_wmi_tx_purge(ar); | ||
2296 | |||
2297 | cancel_work_sync(&ar->offchan_tx_work); | ||
2298 | cancel_work_sync(&ar->wmi_mgmt_tx_work); | ||
2299 | cancel_work_sync(&ar->restart_work); | 2516 | cancel_work_sync(&ar->restart_work); |
2300 | } | 2517 | } |
2301 | 2518 | ||
@@ -2309,7 +2526,7 @@ static int ath10k_config_ps(struct ath10k *ar) | |||
2309 | list_for_each_entry(arvif, &ar->arvifs, list) { | 2526 | list_for_each_entry(arvif, &ar->arvifs, list) { |
2310 | ret = ath10k_mac_vif_setup_ps(arvif); | 2527 | ret = ath10k_mac_vif_setup_ps(arvif); |
2311 | if (ret) { | 2528 | if (ret) { |
2312 | ath10k_warn("could not setup powersave (%d)\n", ret); | 2529 | ath10k_warn("failed to setup powersave: %d\n", ret); |
2313 | break; | 2530 | break; |
2314 | } | 2531 | } |
2315 | } | 2532 | } |
@@ -2343,7 +2560,6 @@ static const char *chandef_get_width(enum nl80211_chan_width width) | |||
2343 | static void ath10k_config_chan(struct ath10k *ar) | 2560 | static void ath10k_config_chan(struct ath10k *ar) |
2344 | { | 2561 | { |
2345 | struct ath10k_vif *arvif; | 2562 | struct ath10k_vif *arvif; |
2346 | bool monitor_was_enabled; | ||
2347 | int ret; | 2563 | int ret; |
2348 | 2564 | ||
2349 | lockdep_assert_held(&ar->conf_mutex); | 2565 | lockdep_assert_held(&ar->conf_mutex); |
@@ -2357,10 +2573,8 @@ static void ath10k_config_chan(struct ath10k *ar) | |||
2357 | 2573 | ||
2358 | /* First stop monitor interface. Some FW versions crash if there's a | 2574 | /* First stop monitor interface. Some FW versions crash if there's a |
2359 | * lone monitor interface. */ | 2575 | * lone monitor interface. */ |
2360 | monitor_was_enabled = ar->monitor_enabled; | 2576 | if (ar->monitor_started) |
2361 | 2577 | ath10k_monitor_vdev_stop(ar); | |
2362 | if (ar->monitor_enabled) | ||
2363 | ath10k_monitor_stop(ar); | ||
2364 | 2578 | ||
2365 | list_for_each_entry(arvif, &ar->arvifs, list) { | 2579 | list_for_each_entry(arvif, &ar->arvifs, list) { |
2366 | if (!arvif->is_started) | 2580 | if (!arvif->is_started) |
@@ -2371,7 +2585,7 @@ static void ath10k_config_chan(struct ath10k *ar) | |||
2371 | 2585 | ||
2372 | ret = ath10k_vdev_stop(arvif); | 2586 | ret = ath10k_vdev_stop(arvif); |
2373 | if (ret) { | 2587 | if (ret) { |
2374 | ath10k_warn("could not stop vdev %d (%d)\n", | 2588 | ath10k_warn("failed to stop vdev %d: %d\n", |
2375 | arvif->vdev_id, ret); | 2589 | arvif->vdev_id, ret); |
2376 | continue; | 2590 | continue; |
2377 | } | 2591 | } |
@@ -2388,7 +2602,7 @@ static void ath10k_config_chan(struct ath10k *ar) | |||
2388 | 2602 | ||
2389 | ret = ath10k_vdev_start(arvif); | 2603 | ret = ath10k_vdev_start(arvif); |
2390 | if (ret) { | 2604 | if (ret) { |
2391 | ath10k_warn("could not start vdev %d (%d)\n", | 2605 | ath10k_warn("failed to start vdev %d: %d\n", |
2392 | arvif->vdev_id, ret); | 2606 | arvif->vdev_id, ret); |
2393 | continue; | 2607 | continue; |
2394 | } | 2608 | } |
@@ -2399,14 +2613,14 @@ static void ath10k_config_chan(struct ath10k *ar) | |||
2399 | ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, | 2613 | ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, |
2400 | arvif->bssid); | 2614 | arvif->bssid); |
2401 | if (ret) { | 2615 | if (ret) { |
2402 | ath10k_warn("could not bring vdev up %d (%d)\n", | 2616 | ath10k_warn("failed to bring vdev up %d: %d\n", |
2403 | arvif->vdev_id, ret); | 2617 | arvif->vdev_id, ret); |
2404 | continue; | 2618 | continue; |
2405 | } | 2619 | } |
2406 | } | 2620 | } |
2407 | 2621 | ||
2408 | if (monitor_was_enabled) | 2622 | if (ath10k_monitor_is_enabled(ar)) |
2409 | ath10k_monitor_start(ar, ar->monitor_vdev_id); | 2623 | ath10k_monitor_vdev_start(ar, ar->monitor_vdev_id); |
2410 | } | 2624 | } |
2411 | 2625 | ||
2412 | static int ath10k_config(struct ieee80211_hw *hw, u32 changed) | 2626 | static int ath10k_config(struct ieee80211_hw *hw, u32 changed) |
@@ -2420,15 +2634,17 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed) | |||
2420 | 2634 | ||
2421 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { | 2635 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { |
2422 | ath10k_dbg(ATH10K_DBG_MAC, | 2636 | ath10k_dbg(ATH10K_DBG_MAC, |
2423 | "mac config channel %d mhz flags 0x%x\n", | 2637 | "mac config channel %dMHz flags 0x%x radar %d\n", |
2424 | conf->chandef.chan->center_freq, | 2638 | conf->chandef.chan->center_freq, |
2425 | conf->chandef.chan->flags); | 2639 | conf->chandef.chan->flags, |
2640 | conf->radar_enabled); | ||
2426 | 2641 | ||
2427 | spin_lock_bh(&ar->data_lock); | 2642 | spin_lock_bh(&ar->data_lock); |
2428 | ar->rx_channel = conf->chandef.chan; | 2643 | ar->rx_channel = conf->chandef.chan; |
2429 | spin_unlock_bh(&ar->data_lock); | 2644 | spin_unlock_bh(&ar->data_lock); |
2430 | 2645 | ||
2431 | ath10k_config_radar_detection(ar); | 2646 | ar->radar_enabled = conf->radar_enabled; |
2647 | ath10k_recalc_radar_detection(ar); | ||
2432 | 2648 | ||
2433 | if (!cfg80211_chandef_identical(&ar->chandef, &conf->chandef)) { | 2649 | if (!cfg80211_chandef_identical(&ar->chandef, &conf->chandef)) { |
2434 | ar->chandef = conf->chandef; | 2650 | ar->chandef = conf->chandef; |
@@ -2444,14 +2660,14 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed) | |||
2444 | ret = ath10k_wmi_pdev_set_param(ar, param, | 2660 | ret = ath10k_wmi_pdev_set_param(ar, param, |
2445 | hw->conf.power_level * 2); | 2661 | hw->conf.power_level * 2); |
2446 | if (ret) | 2662 | if (ret) |
2447 | ath10k_warn("mac failed to set 2g txpower %d (%d)\n", | 2663 | ath10k_warn("failed to set 2g txpower %d: %d\n", |
2448 | hw->conf.power_level, ret); | 2664 | hw->conf.power_level, ret); |
2449 | 2665 | ||
2450 | param = ar->wmi.pdev_param->txpower_limit5g; | 2666 | param = ar->wmi.pdev_param->txpower_limit5g; |
2451 | ret = ath10k_wmi_pdev_set_param(ar, param, | 2667 | ret = ath10k_wmi_pdev_set_param(ar, param, |
2452 | hw->conf.power_level * 2); | 2668 | hw->conf.power_level * 2); |
2453 | if (ret) | 2669 | if (ret) |
2454 | ath10k_warn("mac failed to set 5g txpower %d (%d)\n", | 2670 | ath10k_warn("failed to set 5g txpower %d: %d\n", |
2455 | hw->conf.power_level, ret); | 2671 | hw->conf.power_level, ret); |
2456 | } | 2672 | } |
2457 | 2673 | ||
@@ -2459,10 +2675,19 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed) | |||
2459 | ath10k_config_ps(ar); | 2675 | ath10k_config_ps(ar); |
2460 | 2676 | ||
2461 | if (changed & IEEE80211_CONF_CHANGE_MONITOR) { | 2677 | if (changed & IEEE80211_CONF_CHANGE_MONITOR) { |
2462 | if (conf->flags & IEEE80211_CONF_MONITOR) | 2678 | if (conf->flags & IEEE80211_CONF_MONITOR && !ar->monitor) { |
2463 | ret = ath10k_monitor_create(ar); | 2679 | ar->monitor = true; |
2464 | else | 2680 | ret = ath10k_monitor_start(ar); |
2465 | ret = ath10k_monitor_destroy(ar); | 2681 | if (ret) { |
2682 | ath10k_warn("failed to start monitor (config): %d\n", | ||
2683 | ret); | ||
2684 | ar->monitor = false; | ||
2685 | } | ||
2686 | } else if (!(conf->flags & IEEE80211_CONF_MONITOR) && | ||
2687 | ar->monitor) { | ||
2688 | ar->monitor = false; | ||
2689 | ath10k_monitor_stop(ar); | ||
2690 | } | ||
2466 | } | 2691 | } |
2467 | 2692 | ||
2468 | mutex_unlock(&ar->conf_mutex); | 2693 | mutex_unlock(&ar->conf_mutex); |
@@ -2497,12 +2722,6 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, | |||
2497 | INIT_WORK(&arvif->wep_key_work, ath10k_tx_wep_key_work); | 2722 | INIT_WORK(&arvif->wep_key_work, ath10k_tx_wep_key_work); |
2498 | INIT_LIST_HEAD(&arvif->list); | 2723 | INIT_LIST_HEAD(&arvif->list); |
2499 | 2724 | ||
2500 | if ((vif->type == NL80211_IFTYPE_MONITOR) && ar->monitor_present) { | ||
2501 | ath10k_warn("Only one monitor interface allowed\n"); | ||
2502 | ret = -EBUSY; | ||
2503 | goto err; | ||
2504 | } | ||
2505 | |||
2506 | bit = ffs(ar->free_vdev_map); | 2725 | bit = ffs(ar->free_vdev_map); |
2507 | if (bit == 0) { | 2726 | if (bit == 0) { |
2508 | ret = -EBUSY; | 2727 | ret = -EBUSY; |
@@ -2545,7 +2764,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, | |||
2545 | ret = ath10k_wmi_vdev_create(ar, arvif->vdev_id, arvif->vdev_type, | 2764 | ret = ath10k_wmi_vdev_create(ar, arvif->vdev_id, arvif->vdev_type, |
2546 | arvif->vdev_subtype, vif->addr); | 2765 | arvif->vdev_subtype, vif->addr); |
2547 | if (ret) { | 2766 | if (ret) { |
2548 | ath10k_warn("WMI vdev %i create failed: ret %d\n", | 2767 | ath10k_warn("failed to create WMI vdev %i: %d\n", |
2549 | arvif->vdev_id, ret); | 2768 | arvif->vdev_id, ret); |
2550 | goto err; | 2769 | goto err; |
2551 | } | 2770 | } |
@@ -2557,7 +2776,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, | |||
2557 | ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param, | 2776 | ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param, |
2558 | arvif->def_wep_key_idx); | 2777 | arvif->def_wep_key_idx); |
2559 | if (ret) { | 2778 | if (ret) { |
2560 | ath10k_warn("Failed to set vdev %i default keyid: %d\n", | 2779 | ath10k_warn("failed to set vdev %i default key id: %d\n", |
2561 | arvif->vdev_id, ret); | 2780 | arvif->vdev_id, ret); |
2562 | goto err_vdev_delete; | 2781 | goto err_vdev_delete; |
2563 | } | 2782 | } |
@@ -2567,7 +2786,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, | |||
2567 | ATH10K_HW_TXRX_NATIVE_WIFI); | 2786 | ATH10K_HW_TXRX_NATIVE_WIFI); |
2568 | /* 10.X firmware does not support this VDEV parameter. Do not warn */ | 2787 | /* 10.X firmware does not support this VDEV parameter. Do not warn */ |
2569 | if (ret && ret != -EOPNOTSUPP) { | 2788 | if (ret && ret != -EOPNOTSUPP) { |
2570 | ath10k_warn("Failed to set vdev %i TX encap: %d\n", | 2789 | ath10k_warn("failed to set vdev %i TX encapsulation: %d\n", |
2571 | arvif->vdev_id, ret); | 2790 | arvif->vdev_id, ret); |
2572 | goto err_vdev_delete; | 2791 | goto err_vdev_delete; |
2573 | } | 2792 | } |
@@ -2575,14 +2794,14 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, | |||
2575 | if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { | 2794 | if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { |
2576 | ret = ath10k_peer_create(ar, arvif->vdev_id, vif->addr); | 2795 | ret = ath10k_peer_create(ar, arvif->vdev_id, vif->addr); |
2577 | if (ret) { | 2796 | if (ret) { |
2578 | ath10k_warn("Failed to create vdev %i peer for AP: %d\n", | 2797 | ath10k_warn("failed to create vdev %i peer for AP: %d\n", |
2579 | arvif->vdev_id, ret); | 2798 | arvif->vdev_id, ret); |
2580 | goto err_vdev_delete; | 2799 | goto err_vdev_delete; |
2581 | } | 2800 | } |
2582 | 2801 | ||
2583 | ret = ath10k_mac_set_kickout(arvif); | 2802 | ret = ath10k_mac_set_kickout(arvif); |
2584 | if (ret) { | 2803 | if (ret) { |
2585 | ath10k_warn("Failed to set vdev %i kickout parameters: %d\n", | 2804 | ath10k_warn("failed to set vdev %i kickout parameters: %d\n", |
2586 | arvif->vdev_id, ret); | 2805 | arvif->vdev_id, ret); |
2587 | goto err_peer_delete; | 2806 | goto err_peer_delete; |
2588 | } | 2807 | } |
@@ -2594,7 +2813,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, | |||
2594 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, | 2813 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, |
2595 | param, value); | 2814 | param, value); |
2596 | if (ret) { | 2815 | if (ret) { |
2597 | ath10k_warn("Failed to set vdev %i RX wake policy: %d\n", | 2816 | ath10k_warn("failed to set vdev %i RX wake policy: %d\n", |
2598 | arvif->vdev_id, ret); | 2817 | arvif->vdev_id, ret); |
2599 | goto err_peer_delete; | 2818 | goto err_peer_delete; |
2600 | } | 2819 | } |
@@ -2604,7 +2823,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, | |||
2604 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, | 2823 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, |
2605 | param, value); | 2824 | param, value); |
2606 | if (ret) { | 2825 | if (ret) { |
2607 | ath10k_warn("Failed to set vdev %i TX wake thresh: %d\n", | 2826 | ath10k_warn("failed to set vdev %i TX wake thresh: %d\n", |
2608 | arvif->vdev_id, ret); | 2827 | arvif->vdev_id, ret); |
2609 | goto err_peer_delete; | 2828 | goto err_peer_delete; |
2610 | } | 2829 | } |
@@ -2614,7 +2833,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, | |||
2614 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, | 2833 | ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, |
2615 | param, value); | 2834 | param, value); |
2616 | if (ret) { | 2835 | if (ret) { |
2617 | ath10k_warn("Failed to set vdev %i PSPOLL count: %d\n", | 2836 | ath10k_warn("failed to set vdev %i PSPOLL count: %d\n", |
2618 | arvif->vdev_id, ret); | 2837 | arvif->vdev_id, ret); |
2619 | goto err_peer_delete; | 2838 | goto err_peer_delete; |
2620 | } | 2839 | } |
@@ -2622,21 +2841,18 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, | |||
2622 | 2841 | ||
2623 | ret = ath10k_mac_set_rts(arvif, ar->hw->wiphy->rts_threshold); | 2842 | ret = ath10k_mac_set_rts(arvif, ar->hw->wiphy->rts_threshold); |
2624 | if (ret) { | 2843 | if (ret) { |
2625 | ath10k_warn("failed to set rts threshold for vdev %d (%d)\n", | 2844 | ath10k_warn("failed to set rts threshold for vdev %d: %d\n", |
2626 | arvif->vdev_id, ret); | 2845 | arvif->vdev_id, ret); |
2627 | goto err_peer_delete; | 2846 | goto err_peer_delete; |
2628 | } | 2847 | } |
2629 | 2848 | ||
2630 | ret = ath10k_mac_set_frag(arvif, ar->hw->wiphy->frag_threshold); | 2849 | ret = ath10k_mac_set_frag(arvif, ar->hw->wiphy->frag_threshold); |
2631 | if (ret) { | 2850 | if (ret) { |
2632 | ath10k_warn("failed to set frag threshold for vdev %d (%d)\n", | 2851 | ath10k_warn("failed to set frag threshold for vdev %d: %d\n", |
2633 | arvif->vdev_id, ret); | 2852 | arvif->vdev_id, ret); |
2634 | goto err_peer_delete; | 2853 | goto err_peer_delete; |
2635 | } | 2854 | } |
2636 | 2855 | ||
2637 | if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) | ||
2638 | ar->monitor_present = true; | ||
2639 | |||
2640 | mutex_unlock(&ar->conf_mutex); | 2856 | mutex_unlock(&ar->conf_mutex); |
2641 | return 0; | 2857 | return 0; |
2642 | 2858 | ||
@@ -2668,6 +2884,9 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw, | |||
2668 | 2884 | ||
2669 | spin_lock_bh(&ar->data_lock); | 2885 | spin_lock_bh(&ar->data_lock); |
2670 | if (arvif->beacon) { | 2886 | if (arvif->beacon) { |
2887 | dma_unmap_single(arvif->ar->dev, | ||
2888 | ATH10K_SKB_CB(arvif->beacon)->paddr, | ||
2889 | arvif->beacon->len, DMA_TO_DEVICE); | ||
2671 | dev_kfree_skb_any(arvif->beacon); | 2890 | dev_kfree_skb_any(arvif->beacon); |
2672 | arvif->beacon = NULL; | 2891 | arvif->beacon = NULL; |
2673 | } | 2892 | } |
@@ -2679,7 +2898,7 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw, | |||
2679 | if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { | 2898 | if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { |
2680 | ret = ath10k_peer_delete(arvif->ar, arvif->vdev_id, vif->addr); | 2899 | ret = ath10k_peer_delete(arvif->ar, arvif->vdev_id, vif->addr); |
2681 | if (ret) | 2900 | if (ret) |
2682 | ath10k_warn("Failed to remove peer for AP vdev %i: %d\n", | 2901 | ath10k_warn("failed to remove peer for AP vdev %i: %d\n", |
2683 | arvif->vdev_id, ret); | 2902 | arvif->vdev_id, ret); |
2684 | 2903 | ||
2685 | kfree(arvif->u.ap.noa_data); | 2904 | kfree(arvif->u.ap.noa_data); |
@@ -2690,12 +2909,9 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw, | |||
2690 | 2909 | ||
2691 | ret = ath10k_wmi_vdev_delete(ar, arvif->vdev_id); | 2910 | ret = ath10k_wmi_vdev_delete(ar, arvif->vdev_id); |
2692 | if (ret) | 2911 | if (ret) |
2693 | ath10k_warn("WMI vdev %i delete failed: %d\n", | 2912 | ath10k_warn("failed to delete WMI vdev %i: %d\n", |
2694 | arvif->vdev_id, ret); | 2913 | arvif->vdev_id, ret); |
2695 | 2914 | ||
2696 | if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) | ||
2697 | ar->monitor_present = false; | ||
2698 | |||
2699 | ath10k_peer_cleanup(ar, arvif->vdev_id); | 2915 | ath10k_peer_cleanup(ar, arvif->vdev_id); |
2700 | 2916 | ||
2701 | mutex_unlock(&ar->conf_mutex); | 2917 | mutex_unlock(&ar->conf_mutex); |
@@ -2728,28 +2944,17 @@ static void ath10k_configure_filter(struct ieee80211_hw *hw, | |||
2728 | *total_flags &= SUPPORTED_FILTERS; | 2944 | *total_flags &= SUPPORTED_FILTERS; |
2729 | ar->filter_flags = *total_flags; | 2945 | ar->filter_flags = *total_flags; |
2730 | 2946 | ||
2731 | /* Monitor must not be started if it wasn't created first. | 2947 | if (ar->filter_flags & FIF_PROMISC_IN_BSS && !ar->promisc) { |
2732 | * Promiscuous mode may be started on a non-monitor interface - in | 2948 | ar->promisc = true; |
2733 | * such case the monitor vdev is not created so starting the | 2949 | ret = ath10k_monitor_start(ar); |
2734 | * monitor makes no sense. Since ath10k uses no special RX filters | 2950 | if (ret) { |
2735 | * (only BSS filter in STA mode) there's no need for any special | 2951 | ath10k_warn("failed to start monitor (promisc): %d\n", |
2736 | * action here. */ | 2952 | ret); |
2737 | if ((ar->filter_flags & FIF_PROMISC_IN_BSS) && | 2953 | ar->promisc = false; |
2738 | !ar->monitor_enabled && ar->monitor_present) { | 2954 | } |
2739 | ath10k_dbg(ATH10K_DBG_MAC, "mac monitor %d start\n", | 2955 | } else if (!(ar->filter_flags & FIF_PROMISC_IN_BSS) && ar->promisc) { |
2740 | ar->monitor_vdev_id); | 2956 | ar->promisc = false; |
2741 | 2957 | ath10k_monitor_stop(ar); | |
2742 | ret = ath10k_monitor_start(ar, ar->monitor_vdev_id); | ||
2743 | if (ret) | ||
2744 | ath10k_warn("Unable to start monitor mode\n"); | ||
2745 | } else if (!(ar->filter_flags & FIF_PROMISC_IN_BSS) && | ||
2746 | ar->monitor_enabled && ar->monitor_present) { | ||
2747 | ath10k_dbg(ATH10K_DBG_MAC, "mac monitor %d stop\n", | ||
2748 | ar->monitor_vdev_id); | ||
2749 | |||
2750 | ret = ath10k_monitor_stop(ar); | ||
2751 | if (ret) | ||
2752 | ath10k_warn("Unable to stop monitor mode\n"); | ||
2753 | } | 2958 | } |
2754 | 2959 | ||
2755 | mutex_unlock(&ar->conf_mutex); | 2960 | mutex_unlock(&ar->conf_mutex); |
@@ -2780,7 +2985,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, | |||
2780 | arvif->vdev_id, arvif->beacon_interval); | 2985 | arvif->vdev_id, arvif->beacon_interval); |
2781 | 2986 | ||
2782 | if (ret) | 2987 | if (ret) |
2783 | ath10k_warn("Failed to set beacon interval for vdev %d: %i\n", | 2988 | ath10k_warn("failed to set beacon interval for vdev %d: %i\n", |
2784 | arvif->vdev_id, ret); | 2989 | arvif->vdev_id, ret); |
2785 | } | 2990 | } |
2786 | 2991 | ||
@@ -2793,7 +2998,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, | |||
2793 | ret = ath10k_wmi_pdev_set_param(ar, pdev_param, | 2998 | ret = ath10k_wmi_pdev_set_param(ar, pdev_param, |
2794 | WMI_BEACON_STAGGERED_MODE); | 2999 | WMI_BEACON_STAGGERED_MODE); |
2795 | if (ret) | 3000 | if (ret) |
2796 | ath10k_warn("Failed to set beacon mode for vdev %d: %i\n", | 3001 | ath10k_warn("failed to set beacon mode for vdev %d: %i\n", |
2797 | arvif->vdev_id, ret); | 3002 | arvif->vdev_id, ret); |
2798 | } | 3003 | } |
2799 | 3004 | ||
@@ -2808,7 +3013,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, | |||
2808 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, | 3013 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, |
2809 | arvif->dtim_period); | 3014 | arvif->dtim_period); |
2810 | if (ret) | 3015 | if (ret) |
2811 | ath10k_warn("Failed to set dtim period for vdev %d: %i\n", | 3016 | ath10k_warn("failed to set dtim period for vdev %d: %i\n", |
2812 | arvif->vdev_id, ret); | 3017 | arvif->vdev_id, ret); |
2813 | } | 3018 | } |
2814 | 3019 | ||
@@ -2820,7 +3025,12 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, | |||
2820 | arvif->u.ap.hidden_ssid = info->hidden_ssid; | 3025 | arvif->u.ap.hidden_ssid = info->hidden_ssid; |
2821 | } | 3026 | } |
2822 | 3027 | ||
2823 | if (changed & BSS_CHANGED_BSSID) { | 3028 | /* |
3029 | * Firmware manages AP self-peer internally so make sure to not create | ||
3030 | * it in driver. Otherwise AP self-peer deletion may timeout later. | ||
3031 | */ | ||
3032 | if (changed & BSS_CHANGED_BSSID && | ||
3033 | vif->type != NL80211_IFTYPE_AP) { | ||
2824 | if (!is_zero_ether_addr(info->bssid)) { | 3034 | if (!is_zero_ether_addr(info->bssid)) { |
2825 | ath10k_dbg(ATH10K_DBG_MAC, | 3035 | ath10k_dbg(ATH10K_DBG_MAC, |
2826 | "mac vdev %d create peer %pM\n", | 3036 | "mac vdev %d create peer %pM\n", |
@@ -2829,7 +3039,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, | |||
2829 | ret = ath10k_peer_create(ar, arvif->vdev_id, | 3039 | ret = ath10k_peer_create(ar, arvif->vdev_id, |
2830 | info->bssid); | 3040 | info->bssid); |
2831 | if (ret) | 3041 | if (ret) |
2832 | ath10k_warn("Failed to add peer %pM for vdev %d when changing bssid: %i\n", | 3042 | ath10k_warn("failed to add peer %pM for vdev %d when changing bssid: %i\n", |
2833 | info->bssid, arvif->vdev_id, ret); | 3043 | info->bssid, arvif->vdev_id, ret); |
2834 | 3044 | ||
2835 | if (vif->type == NL80211_IFTYPE_STATION) { | 3045 | if (vif->type == NL80211_IFTYPE_STATION) { |
@@ -2868,20 +3078,13 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, | |||
2868 | ath10k_control_beaconing(arvif, info); | 3078 | ath10k_control_beaconing(arvif, info); |
2869 | 3079 | ||
2870 | if (changed & BSS_CHANGED_ERP_CTS_PROT) { | 3080 | if (changed & BSS_CHANGED_ERP_CTS_PROT) { |
2871 | u32 cts_prot; | 3081 | arvif->use_cts_prot = info->use_cts_prot; |
2872 | if (info->use_cts_prot) | ||
2873 | cts_prot = 1; | ||
2874 | else | ||
2875 | cts_prot = 0; | ||
2876 | |||
2877 | ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d cts_prot %d\n", | 3082 | ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d cts_prot %d\n", |
2878 | arvif->vdev_id, cts_prot); | 3083 | arvif->vdev_id, info->use_cts_prot); |
2879 | 3084 | ||
2880 | vdev_param = ar->wmi.vdev_param->enable_rtscts; | 3085 | ret = ath10k_recalc_rtscts_prot(arvif); |
2881 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, | ||
2882 | cts_prot); | ||
2883 | if (ret) | 3086 | if (ret) |
2884 | ath10k_warn("Failed to set CTS prot for vdev %d: %d\n", | 3087 | ath10k_warn("failed to recalculate rts/cts prot for vdev %d: %d\n", |
2885 | arvif->vdev_id, ret); | 3088 | arvif->vdev_id, ret); |
2886 | } | 3089 | } |
2887 | 3090 | ||
@@ -2900,7 +3103,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, | |||
2900 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, | 3103 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, |
2901 | slottime); | 3104 | slottime); |
2902 | if (ret) | 3105 | if (ret) |
2903 | ath10k_warn("Failed to set erp slot for vdev %d: %i\n", | 3106 | ath10k_warn("failed to set erp slot for vdev %d: %i\n", |
2904 | arvif->vdev_id, ret); | 3107 | arvif->vdev_id, ret); |
2905 | } | 3108 | } |
2906 | 3109 | ||
@@ -2919,7 +3122,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, | |||
2919 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, | 3122 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, |
2920 | preamble); | 3123 | preamble); |
2921 | if (ret) | 3124 | if (ret) |
2922 | ath10k_warn("Failed to set preamble for vdev %d: %i\n", | 3125 | ath10k_warn("failed to set preamble for vdev %d: %i\n", |
2923 | arvif->vdev_id, ret); | 3126 | arvif->vdev_id, ret); |
2924 | } | 3127 | } |
2925 | 3128 | ||
@@ -2990,7 +3193,7 @@ static int ath10k_hw_scan(struct ieee80211_hw *hw, | |||
2990 | 3193 | ||
2991 | ret = ath10k_start_scan(ar, &arg); | 3194 | ret = ath10k_start_scan(ar, &arg); |
2992 | if (ret) { | 3195 | if (ret) { |
2993 | ath10k_warn("could not start hw scan (%d)\n", ret); | 3196 | ath10k_warn("failed to start hw scan: %d\n", ret); |
2994 | spin_lock_bh(&ar->data_lock); | 3197 | spin_lock_bh(&ar->data_lock); |
2995 | ar->scan.in_progress = false; | 3198 | ar->scan.in_progress = false; |
2996 | spin_unlock_bh(&ar->data_lock); | 3199 | spin_unlock_bh(&ar->data_lock); |
@@ -3010,8 +3213,7 @@ static void ath10k_cancel_hw_scan(struct ieee80211_hw *hw, | |||
3010 | mutex_lock(&ar->conf_mutex); | 3213 | mutex_lock(&ar->conf_mutex); |
3011 | ret = ath10k_abort_scan(ar); | 3214 | ret = ath10k_abort_scan(ar); |
3012 | if (ret) { | 3215 | if (ret) { |
3013 | ath10k_warn("couldn't abort scan (%d). forcefully sending scan completion to mac80211\n", | 3216 | ath10k_warn("failed to abort scan: %d\n", ret); |
3014 | ret); | ||
3015 | ieee80211_scan_completed(hw, 1 /* aborted */); | 3217 | ieee80211_scan_completed(hw, 1 /* aborted */); |
3016 | } | 3218 | } |
3017 | mutex_unlock(&ar->conf_mutex); | 3219 | mutex_unlock(&ar->conf_mutex); |
@@ -3089,7 +3291,7 @@ static int ath10k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3089 | 3291 | ||
3090 | if (!peer) { | 3292 | if (!peer) { |
3091 | if (cmd == SET_KEY) { | 3293 | if (cmd == SET_KEY) { |
3092 | ath10k_warn("cannot install key for non-existent peer %pM\n", | 3294 | ath10k_warn("failed to install key for non-existent peer %pM\n", |
3093 | peer_addr); | 3295 | peer_addr); |
3094 | ret = -EOPNOTSUPP; | 3296 | ret = -EOPNOTSUPP; |
3095 | goto exit; | 3297 | goto exit; |
@@ -3112,7 +3314,7 @@ static int ath10k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3112 | 3314 | ||
3113 | ret = ath10k_install_key(arvif, key, cmd, peer_addr); | 3315 | ret = ath10k_install_key(arvif, key, cmd, peer_addr); |
3114 | if (ret) { | 3316 | if (ret) { |
3115 | ath10k_warn("key installation failed for vdev %i peer %pM: %d\n", | 3317 | ath10k_warn("failed to install key for vdev %i peer %pM: %d\n", |
3116 | arvif->vdev_id, peer_addr, ret); | 3318 | arvif->vdev_id, peer_addr, ret); |
3117 | goto exit; | 3319 | goto exit; |
3118 | } | 3320 | } |
@@ -3127,7 +3329,7 @@ static int ath10k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3127 | peer->keys[key->keyidx] = NULL; | 3329 | peer->keys[key->keyidx] = NULL; |
3128 | else if (peer == NULL) | 3330 | else if (peer == NULL) |
3129 | /* impossible unless FW goes crazy */ | 3331 | /* impossible unless FW goes crazy */ |
3130 | ath10k_warn("peer %pM disappeared!\n", peer_addr); | 3332 | ath10k_warn("Peer %pM disappeared!\n", peer_addr); |
3131 | spin_unlock_bh(&ar->data_lock); | 3333 | spin_unlock_bh(&ar->data_lock); |
3132 | 3334 | ||
3133 | exit: | 3335 | exit: |
@@ -3195,6 +3397,16 @@ static void ath10k_sta_rc_update_wk(struct work_struct *wk) | |||
3195 | sta->addr, smps, err); | 3397 | sta->addr, smps, err); |
3196 | } | 3398 | } |
3197 | 3399 | ||
3400 | if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) { | ||
3401 | ath10k_dbg(ATH10K_DBG_MAC, "mac update sta %pM supp rates\n", | ||
3402 | sta->addr); | ||
3403 | |||
3404 | err = ath10k_station_assoc(ar, arvif, sta, true); | ||
3405 | if (err) | ||
3406 | ath10k_warn("failed to reassociate station: %pM\n", | ||
3407 | sta->addr); | ||
3408 | } | ||
3409 | |||
3198 | mutex_unlock(&ar->conf_mutex); | 3410 | mutex_unlock(&ar->conf_mutex); |
3199 | } | 3411 | } |
3200 | 3412 | ||
@@ -3236,7 +3448,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, | |||
3236 | max_num_peers = TARGET_NUM_PEERS; | 3448 | max_num_peers = TARGET_NUM_PEERS; |
3237 | 3449 | ||
3238 | if (ar->num_peers >= max_num_peers) { | 3450 | if (ar->num_peers >= max_num_peers) { |
3239 | ath10k_warn("Number of peers exceeded: peers number %d (max peers %d)\n", | 3451 | ath10k_warn("number of peers exceeded: peers number %d (max peers %d)\n", |
3240 | ar->num_peers, max_num_peers); | 3452 | ar->num_peers, max_num_peers); |
3241 | ret = -ENOBUFS; | 3453 | ret = -ENOBUFS; |
3242 | goto exit; | 3454 | goto exit; |
@@ -3248,7 +3460,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, | |||
3248 | 3460 | ||
3249 | ret = ath10k_peer_create(ar, arvif->vdev_id, sta->addr); | 3461 | ret = ath10k_peer_create(ar, arvif->vdev_id, sta->addr); |
3250 | if (ret) | 3462 | if (ret) |
3251 | ath10k_warn("Failed to add peer %pM for vdev %d when adding a new sta: %i\n", | 3463 | ath10k_warn("failed to add peer %pM for vdev %d when adding a new sta: %i\n", |
3252 | sta->addr, arvif->vdev_id, ret); | 3464 | sta->addr, arvif->vdev_id, ret); |
3253 | } else if ((old_state == IEEE80211_STA_NONE && | 3465 | } else if ((old_state == IEEE80211_STA_NONE && |
3254 | new_state == IEEE80211_STA_NOTEXIST)) { | 3466 | new_state == IEEE80211_STA_NOTEXIST)) { |
@@ -3260,7 +3472,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, | |||
3260 | arvif->vdev_id, sta->addr); | 3472 | arvif->vdev_id, sta->addr); |
3261 | ret = ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); | 3473 | ret = ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); |
3262 | if (ret) | 3474 | if (ret) |
3263 | ath10k_warn("Failed to delete peer %pM for vdev %d: %i\n", | 3475 | ath10k_warn("failed to delete peer %pM for vdev %d: %i\n", |
3264 | sta->addr, arvif->vdev_id, ret); | 3476 | sta->addr, arvif->vdev_id, ret); |
3265 | 3477 | ||
3266 | if (vif->type == NL80211_IFTYPE_STATION) | 3478 | if (vif->type == NL80211_IFTYPE_STATION) |
@@ -3275,9 +3487,9 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, | |||
3275 | ath10k_dbg(ATH10K_DBG_MAC, "mac sta %pM associated\n", | 3487 | ath10k_dbg(ATH10K_DBG_MAC, "mac sta %pM associated\n", |
3276 | sta->addr); | 3488 | sta->addr); |
3277 | 3489 | ||
3278 | ret = ath10k_station_assoc(ar, arvif, sta); | 3490 | ret = ath10k_station_assoc(ar, arvif, sta, false); |
3279 | if (ret) | 3491 | if (ret) |
3280 | ath10k_warn("Failed to associate station %pM for vdev %i: %i\n", | 3492 | ath10k_warn("failed to associate station %pM for vdev %i: %i\n", |
3281 | sta->addr, arvif->vdev_id, ret); | 3493 | sta->addr, arvif->vdev_id, ret); |
3282 | } else if (old_state == IEEE80211_STA_ASSOC && | 3494 | } else if (old_state == IEEE80211_STA_ASSOC && |
3283 | new_state == IEEE80211_STA_AUTH && | 3495 | new_state == IEEE80211_STA_AUTH && |
@@ -3291,7 +3503,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, | |||
3291 | 3503 | ||
3292 | ret = ath10k_station_disassoc(ar, arvif, sta); | 3504 | ret = ath10k_station_disassoc(ar, arvif, sta); |
3293 | if (ret) | 3505 | if (ret) |
3294 | ath10k_warn("Failed to disassociate station: %pM vdev %i ret %i\n", | 3506 | ath10k_warn("failed to disassociate station: %pM vdev %i: %i\n", |
3295 | sta->addr, arvif->vdev_id, ret); | 3507 | sta->addr, arvif->vdev_id, ret); |
3296 | } | 3508 | } |
3297 | exit: | 3509 | exit: |
@@ -3339,7 +3551,7 @@ static int ath10k_conf_tx_uapsd(struct ath10k *ar, struct ieee80211_vif *vif, | |||
3339 | WMI_STA_PS_PARAM_UAPSD, | 3551 | WMI_STA_PS_PARAM_UAPSD, |
3340 | arvif->u.sta.uapsd); | 3552 | arvif->u.sta.uapsd); |
3341 | if (ret) { | 3553 | if (ret) { |
3342 | ath10k_warn("could not set uapsd params %d\n", ret); | 3554 | ath10k_warn("failed to set uapsd params: %d\n", ret); |
3343 | goto exit; | 3555 | goto exit; |
3344 | } | 3556 | } |
3345 | 3557 | ||
@@ -3352,7 +3564,7 @@ static int ath10k_conf_tx_uapsd(struct ath10k *ar, struct ieee80211_vif *vif, | |||
3352 | WMI_STA_PS_PARAM_RX_WAKE_POLICY, | 3564 | WMI_STA_PS_PARAM_RX_WAKE_POLICY, |
3353 | value); | 3565 | value); |
3354 | if (ret) | 3566 | if (ret) |
3355 | ath10k_warn("could not set rx wake param %d\n", ret); | 3567 | ath10k_warn("failed to set rx wake param: %d\n", ret); |
3356 | 3568 | ||
3357 | exit: | 3569 | exit: |
3358 | return ret; | 3570 | return ret; |
@@ -3402,13 +3614,13 @@ static int ath10k_conf_tx(struct ieee80211_hw *hw, | |||
3402 | /* FIXME: FW accepts wmm params per hw, not per vif */ | 3614 | /* FIXME: FW accepts wmm params per hw, not per vif */ |
3403 | ret = ath10k_wmi_pdev_set_wmm_params(ar, &ar->wmm_params); | 3615 | ret = ath10k_wmi_pdev_set_wmm_params(ar, &ar->wmm_params); |
3404 | if (ret) { | 3616 | if (ret) { |
3405 | ath10k_warn("could not set wmm params %d\n", ret); | 3617 | ath10k_warn("failed to set wmm params: %d\n", ret); |
3406 | goto exit; | 3618 | goto exit; |
3407 | } | 3619 | } |
3408 | 3620 | ||
3409 | ret = ath10k_conf_tx_uapsd(ar, vif, ac, params->uapsd); | 3621 | ret = ath10k_conf_tx_uapsd(ar, vif, ac, params->uapsd); |
3410 | if (ret) | 3622 | if (ret) |
3411 | ath10k_warn("could not set sta uapsd %d\n", ret); | 3623 | ath10k_warn("failed to set sta uapsd: %d\n", ret); |
3412 | 3624 | ||
3413 | exit: | 3625 | exit: |
3414 | mutex_unlock(&ar->conf_mutex); | 3626 | mutex_unlock(&ar->conf_mutex); |
@@ -3461,7 +3673,7 @@ static int ath10k_remain_on_channel(struct ieee80211_hw *hw, | |||
3461 | 3673 | ||
3462 | ret = ath10k_start_scan(ar, &arg); | 3674 | ret = ath10k_start_scan(ar, &arg); |
3463 | if (ret) { | 3675 | if (ret) { |
3464 | ath10k_warn("could not start roc scan (%d)\n", ret); | 3676 | ath10k_warn("failed to start roc scan: %d\n", ret); |
3465 | spin_lock_bh(&ar->data_lock); | 3677 | spin_lock_bh(&ar->data_lock); |
3466 | ar->scan.in_progress = false; | 3678 | ar->scan.in_progress = false; |
3467 | spin_unlock_bh(&ar->data_lock); | 3679 | spin_unlock_bh(&ar->data_lock); |
@@ -3470,7 +3682,7 @@ static int ath10k_remain_on_channel(struct ieee80211_hw *hw, | |||
3470 | 3682 | ||
3471 | ret = wait_for_completion_timeout(&ar->scan.on_channel, 3*HZ); | 3683 | ret = wait_for_completion_timeout(&ar->scan.on_channel, 3*HZ); |
3472 | if (ret == 0) { | 3684 | if (ret == 0) { |
3473 | ath10k_warn("could not switch to channel for roc scan\n"); | 3685 | ath10k_warn("failed to switch to channel for roc scan\n"); |
3474 | ath10k_abort_scan(ar); | 3686 | ath10k_abort_scan(ar); |
3475 | ret = -ETIMEDOUT; | 3687 | ret = -ETIMEDOUT; |
3476 | goto exit; | 3688 | goto exit; |
@@ -3511,7 +3723,7 @@ static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value) | |||
3511 | 3723 | ||
3512 | ret = ath10k_mac_set_rts(arvif, value); | 3724 | ret = ath10k_mac_set_rts(arvif, value); |
3513 | if (ret) { | 3725 | if (ret) { |
3514 | ath10k_warn("could not set rts threshold for vdev %d (%d)\n", | 3726 | ath10k_warn("failed to set rts threshold for vdev %d: %d\n", |
3515 | arvif->vdev_id, ret); | 3727 | arvif->vdev_id, ret); |
3516 | break; | 3728 | break; |
3517 | } | 3729 | } |
@@ -3534,7 +3746,7 @@ static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value) | |||
3534 | 3746 | ||
3535 | ret = ath10k_mac_set_rts(arvif, value); | 3747 | ret = ath10k_mac_set_rts(arvif, value); |
3536 | if (ret) { | 3748 | if (ret) { |
3537 | ath10k_warn("could not set fragmentation threshold for vdev %d (%d)\n", | 3749 | ath10k_warn("failed to set fragmentation threshold for vdev %d: %d\n", |
3538 | arvif->vdev_id, ret); | 3750 | arvif->vdev_id, ret); |
3539 | break; | 3751 | break; |
3540 | } | 3752 | } |
@@ -3544,7 +3756,8 @@ static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value) | |||
3544 | return ret; | 3756 | return ret; |
3545 | } | 3757 | } |
3546 | 3758 | ||
3547 | static void ath10k_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 3759 | static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
3760 | u32 queues, bool drop) | ||
3548 | { | 3761 | { |
3549 | struct ath10k *ar = hw->priv; | 3762 | struct ath10k *ar = hw->priv; |
3550 | bool skip; | 3763 | bool skip; |
@@ -3573,7 +3786,7 @@ static void ath10k_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | |||
3573 | }), ATH10K_FLUSH_TIMEOUT_HZ); | 3786 | }), ATH10K_FLUSH_TIMEOUT_HZ); |
3574 | 3787 | ||
3575 | if (ret <= 0 || skip) | 3788 | if (ret <= 0 || skip) |
3576 | ath10k_warn("tx not flushed (skip %i ar-state %i): %i\n", | 3789 | ath10k_warn("failed to flush transmit queue (skip %i ar-state %i): %i\n", |
3577 | skip, ar->state, ret); | 3790 | skip, ar->state, ret); |
3578 | 3791 | ||
3579 | skip: | 3792 | skip: |
@@ -3608,7 +3821,7 @@ static int ath10k_suspend(struct ieee80211_hw *hw, | |||
3608 | 3821 | ||
3609 | ret = ath10k_hif_suspend(ar); | 3822 | ret = ath10k_hif_suspend(ar); |
3610 | if (ret) { | 3823 | if (ret) { |
3611 | ath10k_warn("could not suspend hif (%d)\n", ret); | 3824 | ath10k_warn("failed to suspend hif: %d\n", ret); |
3612 | goto resume; | 3825 | goto resume; |
3613 | } | 3826 | } |
3614 | 3827 | ||
@@ -3617,7 +3830,7 @@ static int ath10k_suspend(struct ieee80211_hw *hw, | |||
3617 | resume: | 3830 | resume: |
3618 | ret = ath10k_wmi_pdev_resume_target(ar); | 3831 | ret = ath10k_wmi_pdev_resume_target(ar); |
3619 | if (ret) | 3832 | if (ret) |
3620 | ath10k_warn("could not resume target (%d)\n", ret); | 3833 | ath10k_warn("failed to resume target: %d\n", ret); |
3621 | 3834 | ||
3622 | ret = 1; | 3835 | ret = 1; |
3623 | exit: | 3836 | exit: |
@@ -3634,14 +3847,14 @@ static int ath10k_resume(struct ieee80211_hw *hw) | |||
3634 | 3847 | ||
3635 | ret = ath10k_hif_resume(ar); | 3848 | ret = ath10k_hif_resume(ar); |
3636 | if (ret) { | 3849 | if (ret) { |
3637 | ath10k_warn("could not resume hif (%d)\n", ret); | 3850 | ath10k_warn("failed to resume hif: %d\n", ret); |
3638 | ret = 1; | 3851 | ret = 1; |
3639 | goto exit; | 3852 | goto exit; |
3640 | } | 3853 | } |
3641 | 3854 | ||
3642 | ret = ath10k_wmi_pdev_resume_target(ar); | 3855 | ret = ath10k_wmi_pdev_resume_target(ar); |
3643 | if (ret) { | 3856 | if (ret) { |
3644 | ath10k_warn("could not resume target (%d)\n", ret); | 3857 | ath10k_warn("failed to resume target: %d\n", ret); |
3645 | ret = 1; | 3858 | ret = 1; |
3646 | goto exit; | 3859 | goto exit; |
3647 | } | 3860 | } |
@@ -3964,7 +4177,7 @@ static int ath10k_set_fixed_rate_param(struct ath10k_vif *arvif, | |||
3964 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, | 4177 | ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, |
3965 | vdev_param, fixed_rate); | 4178 | vdev_param, fixed_rate); |
3966 | if (ret) { | 4179 | if (ret) { |
3967 | ath10k_warn("Could not set fixed_rate param 0x%02x: %d\n", | 4180 | ath10k_warn("failed to set fixed rate param 0x%02x: %d\n", |
3968 | fixed_rate, ret); | 4181 | fixed_rate, ret); |
3969 | ret = -EINVAL; | 4182 | ret = -EINVAL; |
3970 | goto exit; | 4183 | goto exit; |
@@ -3977,7 +4190,7 @@ static int ath10k_set_fixed_rate_param(struct ath10k_vif *arvif, | |||
3977 | vdev_param, fixed_nss); | 4190 | vdev_param, fixed_nss); |
3978 | 4191 | ||
3979 | if (ret) { | 4192 | if (ret) { |
3980 | ath10k_warn("Could not set fixed_nss param %d: %d\n", | 4193 | ath10k_warn("failed to set fixed nss param %d: %d\n", |
3981 | fixed_nss, ret); | 4194 | fixed_nss, ret); |
3982 | ret = -EINVAL; | 4195 | ret = -EINVAL; |
3983 | goto exit; | 4196 | goto exit; |
@@ -3990,7 +4203,7 @@ static int ath10k_set_fixed_rate_param(struct ath10k_vif *arvif, | |||
3990 | force_sgi); | 4203 | force_sgi); |
3991 | 4204 | ||
3992 | if (ret) { | 4205 | if (ret) { |
3993 | ath10k_warn("Could not set sgi param %d: %d\n", | 4206 | ath10k_warn("failed to set sgi param %d: %d\n", |
3994 | force_sgi, ret); | 4207 | force_sgi, ret); |
3995 | ret = -EINVAL; | 4208 | ret = -EINVAL; |
3996 | goto exit; | 4209 | goto exit; |
@@ -4026,7 +4239,7 @@ static int ath10k_set_bitrate_mask(struct ieee80211_hw *hw, | |||
4026 | } | 4239 | } |
4027 | 4240 | ||
4028 | if (fixed_rate == WMI_FIXED_RATE_NONE && force_sgi) { | 4241 | if (fixed_rate == WMI_FIXED_RATE_NONE && force_sgi) { |
4029 | ath10k_warn("Could not force SGI usage for default rate settings\n"); | 4242 | ath10k_warn("failed to force SGI usage for default rate settings\n"); |
4030 | return -EINVAL; | 4243 | return -EINVAL; |
4031 | } | 4244 | } |
4032 | 4245 | ||
@@ -4034,14 +4247,6 @@ static int ath10k_set_bitrate_mask(struct ieee80211_hw *hw, | |||
4034 | fixed_nss, force_sgi); | 4247 | fixed_nss, force_sgi); |
4035 | } | 4248 | } |
4036 | 4249 | ||
4037 | static void ath10k_channel_switch_beacon(struct ieee80211_hw *hw, | ||
4038 | struct ieee80211_vif *vif, | ||
4039 | struct cfg80211_chan_def *chandef) | ||
4040 | { | ||
4041 | /* there's no need to do anything here. vif->csa_active is enough */ | ||
4042 | return; | ||
4043 | } | ||
4044 | |||
4045 | static void ath10k_sta_rc_update(struct ieee80211_hw *hw, | 4250 | static void ath10k_sta_rc_update(struct ieee80211_hw *hw, |
4046 | struct ieee80211_vif *vif, | 4251 | struct ieee80211_vif *vif, |
4047 | struct ieee80211_sta *sta, | 4252 | struct ieee80211_sta *sta, |
@@ -4072,8 +4277,8 @@ static void ath10k_sta_rc_update(struct ieee80211_hw *hw, | |||
4072 | bw = WMI_PEER_CHWIDTH_80MHZ; | 4277 | bw = WMI_PEER_CHWIDTH_80MHZ; |
4073 | break; | 4278 | break; |
4074 | case IEEE80211_STA_RX_BW_160: | 4279 | case IEEE80211_STA_RX_BW_160: |
4075 | ath10k_warn("mac sta rc update for %pM: invalid bw %d\n", | 4280 | ath10k_warn("Invalid bandwith %d in rc update for %pM\n", |
4076 | sta->addr, sta->bandwidth); | 4281 | sta->bandwidth, sta->addr); |
4077 | bw = WMI_PEER_CHWIDTH_20MHZ; | 4282 | bw = WMI_PEER_CHWIDTH_20MHZ; |
4078 | break; | 4283 | break; |
4079 | } | 4284 | } |
@@ -4099,8 +4304,8 @@ static void ath10k_sta_rc_update(struct ieee80211_hw *hw, | |||
4099 | smps = WMI_PEER_SMPS_DYNAMIC; | 4304 | smps = WMI_PEER_SMPS_DYNAMIC; |
4100 | break; | 4305 | break; |
4101 | case IEEE80211_SMPS_NUM_MODES: | 4306 | case IEEE80211_SMPS_NUM_MODES: |
4102 | ath10k_warn("mac sta rc update for %pM: invalid smps: %d\n", | 4307 | ath10k_warn("Invalid smps %d in sta rc update for %pM\n", |
4103 | sta->addr, sta->smps_mode); | 4308 | sta->smps_mode, sta->addr); |
4104 | smps = WMI_PEER_SMPS_PS_NONE; | 4309 | smps = WMI_PEER_SMPS_PS_NONE; |
4105 | break; | 4310 | break; |
4106 | } | 4311 | } |
@@ -4108,15 +4313,6 @@ static void ath10k_sta_rc_update(struct ieee80211_hw *hw, | |||
4108 | arsta->smps = smps; | 4313 | arsta->smps = smps; |
4109 | } | 4314 | } |
4110 | 4315 | ||
4111 | if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) { | ||
4112 | /* FIXME: Not implemented. Probably the only way to do it would | ||
4113 | * be to re-assoc the peer. */ | ||
4114 | changed &= ~IEEE80211_RC_SUPP_RATES_CHANGED; | ||
4115 | ath10k_dbg(ATH10K_DBG_MAC, | ||
4116 | "mac sta rc update for %pM: changing supported rates not implemented\n", | ||
4117 | sta->addr); | ||
4118 | } | ||
4119 | |||
4120 | arsta->changed |= changed; | 4316 | arsta->changed |= changed; |
4121 | 4317 | ||
4122 | spin_unlock_bh(&ar->data_lock); | 4318 | spin_unlock_bh(&ar->data_lock); |
@@ -4154,10 +4350,11 @@ static const struct ieee80211_ops ath10k_ops = { | |||
4154 | .set_frag_threshold = ath10k_set_frag_threshold, | 4350 | .set_frag_threshold = ath10k_set_frag_threshold, |
4155 | .flush = ath10k_flush, | 4351 | .flush = ath10k_flush, |
4156 | .tx_last_beacon = ath10k_tx_last_beacon, | 4352 | .tx_last_beacon = ath10k_tx_last_beacon, |
4353 | .set_antenna = ath10k_set_antenna, | ||
4354 | .get_antenna = ath10k_get_antenna, | ||
4157 | .restart_complete = ath10k_restart_complete, | 4355 | .restart_complete = ath10k_restart_complete, |
4158 | .get_survey = ath10k_get_survey, | 4356 | .get_survey = ath10k_get_survey, |
4159 | .set_bitrate_mask = ath10k_set_bitrate_mask, | 4357 | .set_bitrate_mask = ath10k_set_bitrate_mask, |
4160 | .channel_switch_beacon = ath10k_channel_switch_beacon, | ||
4161 | .sta_rc_update = ath10k_sta_rc_update, | 4358 | .sta_rc_update = ath10k_sta_rc_update, |
4162 | .get_tsf = ath10k_get_tsf, | 4359 | .get_tsf = ath10k_get_tsf, |
4163 | #ifdef CONFIG_PM | 4360 | #ifdef CONFIG_PM |
@@ -4503,6 +4700,18 @@ int ath10k_mac_register(struct ath10k *ar) | |||
4503 | BIT(NL80211_IFTYPE_ADHOC) | | 4700 | BIT(NL80211_IFTYPE_ADHOC) | |
4504 | BIT(NL80211_IFTYPE_AP); | 4701 | BIT(NL80211_IFTYPE_AP); |
4505 | 4702 | ||
4703 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { | ||
4704 | /* TODO: Have to deal with 2x2 chips if/when the come out. */ | ||
4705 | ar->supp_tx_chainmask = TARGET_10X_TX_CHAIN_MASK; | ||
4706 | ar->supp_rx_chainmask = TARGET_10X_RX_CHAIN_MASK; | ||
4707 | } else { | ||
4708 | ar->supp_tx_chainmask = TARGET_TX_CHAIN_MASK; | ||
4709 | ar->supp_rx_chainmask = TARGET_RX_CHAIN_MASK; | ||
4710 | } | ||
4711 | |||
4712 | ar->hw->wiphy->available_antennas_rx = ar->supp_rx_chainmask; | ||
4713 | ar->hw->wiphy->available_antennas_tx = ar->supp_tx_chainmask; | ||
4714 | |||
4506 | if (!test_bit(ATH10K_FW_FEATURE_NO_P2P, ar->fw_features)) | 4715 | if (!test_bit(ATH10K_FW_FEATURE_NO_P2P, ar->fw_features)) |
4507 | ar->hw->wiphy->interface_modes |= | 4716 | ar->hw->wiphy->interface_modes |= |
4508 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | 4717 | BIT(NL80211_IFTYPE_P2P_CLIENT) | |
@@ -4516,7 +4725,6 @@ int ath10k_mac_register(struct ath10k *ar) | |||
4516 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | | 4725 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | |
4517 | IEEE80211_HW_HAS_RATE_CONTROL | | 4726 | IEEE80211_HW_HAS_RATE_CONTROL | |
4518 | IEEE80211_HW_SUPPORTS_STATIC_SMPS | | 4727 | IEEE80211_HW_SUPPORTS_STATIC_SMPS | |
4519 | IEEE80211_HW_WANT_MONITOR_VIF | | ||
4520 | IEEE80211_HW_AP_LINK_PS | | 4728 | IEEE80211_HW_AP_LINK_PS | |
4521 | IEEE80211_HW_SPECTRUM_MGMT; | 4729 | IEEE80211_HW_SPECTRUM_MGMT; |
4522 | 4730 | ||
@@ -4570,19 +4778,19 @@ int ath10k_mac_register(struct ath10k *ar) | |||
4570 | NL80211_DFS_UNSET); | 4778 | NL80211_DFS_UNSET); |
4571 | 4779 | ||
4572 | if (!ar->dfs_detector) | 4780 | if (!ar->dfs_detector) |
4573 | ath10k_warn("dfs pattern detector init failed\n"); | 4781 | ath10k_warn("failed to initialise DFS pattern detector\n"); |
4574 | } | 4782 | } |
4575 | 4783 | ||
4576 | ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy, | 4784 | ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy, |
4577 | ath10k_reg_notifier); | 4785 | ath10k_reg_notifier); |
4578 | if (ret) { | 4786 | if (ret) { |
4579 | ath10k_err("Regulatory initialization failed: %i\n", ret); | 4787 | ath10k_err("failed to initialise regulatory: %i\n", ret); |
4580 | goto err_free; | 4788 | goto err_free; |
4581 | } | 4789 | } |
4582 | 4790 | ||
4583 | ret = ieee80211_register_hw(ar->hw); | 4791 | ret = ieee80211_register_hw(ar->hw); |
4584 | if (ret) { | 4792 | if (ret) { |
4585 | ath10k_err("ieee80211 registration failed: %d\n", ret); | 4793 | ath10k_err("failed to register ieee80211: %d\n", ret); |
4586 | goto err_free; | 4794 | goto err_free; |
4587 | } | 4795 | } |
4588 | 4796 | ||
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 9d242d801d9d..d0004d59c97e 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c | |||
@@ -39,15 +39,28 @@ enum ath10k_pci_irq_mode { | |||
39 | ATH10K_PCI_IRQ_MSI = 2, | 39 | ATH10K_PCI_IRQ_MSI = 2, |
40 | }; | 40 | }; |
41 | 41 | ||
42 | static unsigned int ath10k_target_ps; | 42 | enum ath10k_pci_reset_mode { |
43 | ATH10K_PCI_RESET_AUTO = 0, | ||
44 | ATH10K_PCI_RESET_WARM_ONLY = 1, | ||
45 | }; | ||
46 | |||
47 | static unsigned int ath10k_pci_target_ps; | ||
43 | static unsigned int ath10k_pci_irq_mode = ATH10K_PCI_IRQ_AUTO; | 48 | static unsigned int ath10k_pci_irq_mode = ATH10K_PCI_IRQ_AUTO; |
49 | static unsigned int ath10k_pci_reset_mode = ATH10K_PCI_RESET_AUTO; | ||
44 | 50 | ||
45 | module_param(ath10k_target_ps, uint, 0644); | 51 | module_param_named(target_ps, ath10k_pci_target_ps, uint, 0644); |
46 | MODULE_PARM_DESC(ath10k_target_ps, "Enable ath10k Target (SoC) PS option"); | 52 | MODULE_PARM_DESC(target_ps, "Enable ath10k Target (SoC) PS option"); |
47 | 53 | ||
48 | module_param_named(irq_mode, ath10k_pci_irq_mode, uint, 0644); | 54 | module_param_named(irq_mode, ath10k_pci_irq_mode, uint, 0644); |
49 | MODULE_PARM_DESC(irq_mode, "0: auto, 1: legacy, 2: msi (default: 0)"); | 55 | MODULE_PARM_DESC(irq_mode, "0: auto, 1: legacy, 2: msi (default: 0)"); |
50 | 56 | ||
57 | module_param_named(reset_mode, ath10k_pci_reset_mode, uint, 0644); | ||
58 | MODULE_PARM_DESC(reset_mode, "0: auto, 1: warm only (default: 0)"); | ||
59 | |||
60 | /* how long wait to wait for target to initialise, in ms */ | ||
61 | #define ATH10K_PCI_TARGET_WAIT 3000 | ||
62 | #define ATH10K_PCI_NUM_WARM_RESET_ATTEMPTS 3 | ||
63 | |||
51 | #define QCA988X_2_0_DEVICE_ID (0x003c) | 64 | #define QCA988X_2_0_DEVICE_ID (0x003c) |
52 | 65 | ||
53 | static DEFINE_PCI_DEVICE_TABLE(ath10k_pci_id_table) = { | 66 | static DEFINE_PCI_DEVICE_TABLE(ath10k_pci_id_table) = { |
@@ -346,9 +359,10 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data, | |||
346 | * 2) Buffer in DMA-able space | 359 | * 2) Buffer in DMA-able space |
347 | */ | 360 | */ |
348 | orig_nbytes = nbytes; | 361 | orig_nbytes = nbytes; |
349 | data_buf = (unsigned char *)pci_alloc_consistent(ar_pci->pdev, | 362 | data_buf = (unsigned char *)dma_alloc_coherent(ar->dev, |
350 | orig_nbytes, | 363 | orig_nbytes, |
351 | &ce_data_base); | 364 | &ce_data_base, |
365 | GFP_ATOMIC); | ||
352 | 366 | ||
353 | if (!data_buf) { | 367 | if (!data_buf) { |
354 | ret = -ENOMEM; | 368 | ret = -ENOMEM; |
@@ -442,12 +456,12 @@ done: | |||
442 | __le32_to_cpu(((__le32 *)data_buf)[i]); | 456 | __le32_to_cpu(((__le32 *)data_buf)[i]); |
443 | } | 457 | } |
444 | } else | 458 | } else |
445 | ath10k_dbg(ATH10K_DBG_PCI, "%s failure (0x%x)\n", | 459 | ath10k_warn("failed to read diag value at 0x%x: %d\n", |
446 | __func__, address); | 460 | address, ret); |
447 | 461 | ||
448 | if (data_buf) | 462 | if (data_buf) |
449 | pci_free_consistent(ar_pci->pdev, orig_nbytes, | 463 | dma_free_coherent(ar->dev, orig_nbytes, data_buf, |
450 | data_buf, ce_data_base); | 464 | ce_data_base); |
451 | 465 | ||
452 | return ret; | 466 | return ret; |
453 | } | 467 | } |
@@ -490,9 +504,10 @@ static int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address, | |||
490 | * 2) Buffer in DMA-able space | 504 | * 2) Buffer in DMA-able space |
491 | */ | 505 | */ |
492 | orig_nbytes = nbytes; | 506 | orig_nbytes = nbytes; |
493 | data_buf = (unsigned char *)pci_alloc_consistent(ar_pci->pdev, | 507 | data_buf = (unsigned char *)dma_alloc_coherent(ar->dev, |
494 | orig_nbytes, | 508 | orig_nbytes, |
495 | &ce_data_base); | 509 | &ce_data_base, |
510 | GFP_ATOMIC); | ||
496 | if (!data_buf) { | 511 | if (!data_buf) { |
497 | ret = -ENOMEM; | 512 | ret = -ENOMEM; |
498 | goto done; | 513 | goto done; |
@@ -588,13 +603,13 @@ static int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address, | |||
588 | 603 | ||
589 | done: | 604 | done: |
590 | if (data_buf) { | 605 | if (data_buf) { |
591 | pci_free_consistent(ar_pci->pdev, orig_nbytes, data_buf, | 606 | dma_free_coherent(ar->dev, orig_nbytes, data_buf, |
592 | ce_data_base); | 607 | ce_data_base); |
593 | } | 608 | } |
594 | 609 | ||
595 | if (ret != 0) | 610 | if (ret != 0) |
596 | ath10k_dbg(ATH10K_DBG_PCI, "%s failure (0x%x)\n", __func__, | 611 | ath10k_warn("failed to write diag value at 0x%x: %d\n", |
597 | address); | 612 | address, ret); |
598 | 613 | ||
599 | return ret; | 614 | return ret; |
600 | } | 615 | } |
@@ -747,17 +762,21 @@ static int ath10k_pci_hif_tx_sg(struct ath10k *ar, u8 pipe_id, | |||
747 | struct ath10k_pci_pipe *pci_pipe = &ar_pci->pipe_info[pipe_id]; | 762 | struct ath10k_pci_pipe *pci_pipe = &ar_pci->pipe_info[pipe_id]; |
748 | struct ath10k_ce_pipe *ce_pipe = pci_pipe->ce_hdl; | 763 | struct ath10k_ce_pipe *ce_pipe = pci_pipe->ce_hdl; |
749 | struct ath10k_ce_ring *src_ring = ce_pipe->src_ring; | 764 | struct ath10k_ce_ring *src_ring = ce_pipe->src_ring; |
750 | unsigned int nentries_mask = src_ring->nentries_mask; | 765 | unsigned int nentries_mask; |
751 | unsigned int sw_index = src_ring->sw_index; | 766 | unsigned int sw_index; |
752 | unsigned int write_index = src_ring->write_index; | 767 | unsigned int write_index; |
753 | int err, i; | 768 | int err, i = 0; |
754 | 769 | ||
755 | spin_lock_bh(&ar_pci->ce_lock); | 770 | spin_lock_bh(&ar_pci->ce_lock); |
756 | 771 | ||
772 | nentries_mask = src_ring->nentries_mask; | ||
773 | sw_index = src_ring->sw_index; | ||
774 | write_index = src_ring->write_index; | ||
775 | |||
757 | if (unlikely(CE_RING_DELTA(nentries_mask, | 776 | if (unlikely(CE_RING_DELTA(nentries_mask, |
758 | write_index, sw_index - 1) < n_items)) { | 777 | write_index, sw_index - 1) < n_items)) { |
759 | err = -ENOBUFS; | 778 | err = -ENOBUFS; |
760 | goto unlock; | 779 | goto err; |
761 | } | 780 | } |
762 | 781 | ||
763 | for (i = 0; i < n_items - 1; i++) { | 782 | for (i = 0; i < n_items - 1; i++) { |
@@ -774,7 +793,7 @@ static int ath10k_pci_hif_tx_sg(struct ath10k *ar, u8 pipe_id, | |||
774 | items[i].transfer_id, | 793 | items[i].transfer_id, |
775 | CE_SEND_FLAG_GATHER); | 794 | CE_SEND_FLAG_GATHER); |
776 | if (err) | 795 | if (err) |
777 | goto unlock; | 796 | goto err; |
778 | } | 797 | } |
779 | 798 | ||
780 | /* `i` is equal to `n_items -1` after for() */ | 799 | /* `i` is equal to `n_items -1` after for() */ |
@@ -792,10 +811,15 @@ static int ath10k_pci_hif_tx_sg(struct ath10k *ar, u8 pipe_id, | |||
792 | items[i].transfer_id, | 811 | items[i].transfer_id, |
793 | 0); | 812 | 0); |
794 | if (err) | 813 | if (err) |
795 | goto unlock; | 814 | goto err; |
815 | |||
816 | spin_unlock_bh(&ar_pci->ce_lock); | ||
817 | return 0; | ||
818 | |||
819 | err: | ||
820 | for (; i > 0; i--) | ||
821 | __ath10k_ce_send_revert(ce_pipe); | ||
796 | 822 | ||
797 | err = 0; | ||
798 | unlock: | ||
799 | spin_unlock_bh(&ar_pci->ce_lock); | 823 | spin_unlock_bh(&ar_pci->ce_lock); |
800 | return err; | 824 | return err; |
801 | } | 825 | } |
@@ -803,6 +827,9 @@ unlock: | |||
803 | static u16 ath10k_pci_hif_get_free_queue_number(struct ath10k *ar, u8 pipe) | 827 | static u16 ath10k_pci_hif_get_free_queue_number(struct ath10k *ar, u8 pipe) |
804 | { | 828 | { |
805 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | 829 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
830 | |||
831 | ath10k_dbg(ATH10K_DBG_PCI, "pci hif get free queue number\n"); | ||
832 | |||
806 | return ath10k_ce_num_free_src_entries(ar_pci->pipe_info[pipe].ce_hdl); | 833 | return ath10k_ce_num_free_src_entries(ar_pci->pipe_info[pipe].ce_hdl); |
807 | } | 834 | } |
808 | 835 | ||
@@ -854,6 +881,8 @@ static void ath10k_pci_hif_dump_area(struct ath10k *ar) | |||
854 | static void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe, | 881 | static void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe, |
855 | int force) | 882 | int force) |
856 | { | 883 | { |
884 | ath10k_dbg(ATH10K_DBG_PCI, "pci hif send complete check\n"); | ||
885 | |||
857 | if (!force) { | 886 | if (!force) { |
858 | int resources; | 887 | int resources; |
859 | /* | 888 | /* |
@@ -880,7 +909,7 @@ static void ath10k_pci_hif_set_callbacks(struct ath10k *ar, | |||
880 | { | 909 | { |
881 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | 910 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
882 | 911 | ||
883 | ath10k_dbg(ATH10K_DBG_PCI, "%s\n", __func__); | 912 | ath10k_dbg(ATH10K_DBG_PCI, "pci hif set callbacks\n"); |
884 | 913 | ||
885 | memcpy(&ar_pci->msg_callbacks_current, callbacks, | 914 | memcpy(&ar_pci->msg_callbacks_current, callbacks, |
886 | sizeof(ar_pci->msg_callbacks_current)); | 915 | sizeof(ar_pci->msg_callbacks_current)); |
@@ -938,6 +967,8 @@ static int ath10k_pci_hif_map_service_to_pipe(struct ath10k *ar, | |||
938 | { | 967 | { |
939 | int ret = 0; | 968 | int ret = 0; |
940 | 969 | ||
970 | ath10k_dbg(ATH10K_DBG_PCI, "pci hif map service\n"); | ||
971 | |||
941 | /* polling for received messages not supported */ | 972 | /* polling for received messages not supported */ |
942 | *dl_is_polled = 0; | 973 | *dl_is_polled = 0; |
943 | 974 | ||
@@ -997,6 +1028,8 @@ static void ath10k_pci_hif_get_default_pipe(struct ath10k *ar, | |||
997 | { | 1028 | { |
998 | int ul_is_polled, dl_is_polled; | 1029 | int ul_is_polled, dl_is_polled; |
999 | 1030 | ||
1031 | ath10k_dbg(ATH10K_DBG_PCI, "pci hif get default pipe\n"); | ||
1032 | |||
1000 | (void)ath10k_pci_hif_map_service_to_pipe(ar, | 1033 | (void)ath10k_pci_hif_map_service_to_pipe(ar, |
1001 | ATH10K_HTC_SVC_ID_RSVD_CTRL, | 1034 | ATH10K_HTC_SVC_ID_RSVD_CTRL, |
1002 | ul_pipe, | 1035 | ul_pipe, |
@@ -1098,6 +1131,8 @@ static int ath10k_pci_hif_start(struct ath10k *ar) | |||
1098 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | 1131 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
1099 | int ret, ret_early; | 1132 | int ret, ret_early; |
1100 | 1133 | ||
1134 | ath10k_dbg(ATH10K_DBG_BOOT, "boot hif start\n"); | ||
1135 | |||
1101 | ath10k_pci_free_early_irq(ar); | 1136 | ath10k_pci_free_early_irq(ar); |
1102 | ath10k_pci_kill_tasklet(ar); | 1137 | ath10k_pci_kill_tasklet(ar); |
1103 | 1138 | ||
@@ -1233,18 +1268,10 @@ static void ath10k_pci_buffer_cleanup(struct ath10k *ar) | |||
1233 | 1268 | ||
1234 | static void ath10k_pci_ce_deinit(struct ath10k *ar) | 1269 | static void ath10k_pci_ce_deinit(struct ath10k *ar) |
1235 | { | 1270 | { |
1236 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | 1271 | int i; |
1237 | struct ath10k_pci_pipe *pipe_info; | ||
1238 | int pipe_num; | ||
1239 | 1272 | ||
1240 | for (pipe_num = 0; pipe_num < CE_COUNT; pipe_num++) { | 1273 | for (i = 0; i < CE_COUNT; i++) |
1241 | pipe_info = &ar_pci->pipe_info[pipe_num]; | 1274 | ath10k_ce_deinit_pipe(ar, i); |
1242 | if (pipe_info->ce_hdl) { | ||
1243 | ath10k_ce_deinit(pipe_info->ce_hdl); | ||
1244 | pipe_info->ce_hdl = NULL; | ||
1245 | pipe_info->buf_sz = 0; | ||
1246 | } | ||
1247 | } | ||
1248 | } | 1275 | } |
1249 | 1276 | ||
1250 | static void ath10k_pci_hif_stop(struct ath10k *ar) | 1277 | static void ath10k_pci_hif_stop(struct ath10k *ar) |
@@ -1252,7 +1279,10 @@ static void ath10k_pci_hif_stop(struct ath10k *ar) | |||
1252 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | 1279 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
1253 | int ret; | 1280 | int ret; |
1254 | 1281 | ||
1255 | ath10k_dbg(ATH10K_DBG_PCI, "%s\n", __func__); | 1282 | ath10k_dbg(ATH10K_DBG_BOOT, "boot hif stop\n"); |
1283 | |||
1284 | if (WARN_ON(!ar_pci->started)) | ||
1285 | return; | ||
1256 | 1286 | ||
1257 | ret = ath10k_ce_disable_interrupts(ar); | 1287 | ret = ath10k_ce_disable_interrupts(ar); |
1258 | if (ret) | 1288 | if (ret) |
@@ -1697,30 +1727,49 @@ static int ath10k_pci_init_config(struct ath10k *ar) | |||
1697 | return 0; | 1727 | return 0; |
1698 | } | 1728 | } |
1699 | 1729 | ||
1730 | static int ath10k_pci_alloc_ce(struct ath10k *ar) | ||
1731 | { | ||
1732 | int i, ret; | ||
1733 | |||
1734 | for (i = 0; i < CE_COUNT; i++) { | ||
1735 | ret = ath10k_ce_alloc_pipe(ar, i, &host_ce_config_wlan[i]); | ||
1736 | if (ret) { | ||
1737 | ath10k_err("failed to allocate copy engine pipe %d: %d\n", | ||
1738 | i, ret); | ||
1739 | return ret; | ||
1740 | } | ||
1741 | } | ||
1700 | 1742 | ||
1743 | return 0; | ||
1744 | } | ||
1745 | |||
1746 | static void ath10k_pci_free_ce(struct ath10k *ar) | ||
1747 | { | ||
1748 | int i; | ||
1749 | |||
1750 | for (i = 0; i < CE_COUNT; i++) | ||
1751 | ath10k_ce_free_pipe(ar, i); | ||
1752 | } | ||
1701 | 1753 | ||
1702 | static int ath10k_pci_ce_init(struct ath10k *ar) | 1754 | static int ath10k_pci_ce_init(struct ath10k *ar) |
1703 | { | 1755 | { |
1704 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | 1756 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
1705 | struct ath10k_pci_pipe *pipe_info; | 1757 | struct ath10k_pci_pipe *pipe_info; |
1706 | const struct ce_attr *attr; | 1758 | const struct ce_attr *attr; |
1707 | int pipe_num; | 1759 | int pipe_num, ret; |
1708 | 1760 | ||
1709 | for (pipe_num = 0; pipe_num < CE_COUNT; pipe_num++) { | 1761 | for (pipe_num = 0; pipe_num < CE_COUNT; pipe_num++) { |
1710 | pipe_info = &ar_pci->pipe_info[pipe_num]; | 1762 | pipe_info = &ar_pci->pipe_info[pipe_num]; |
1763 | pipe_info->ce_hdl = &ar_pci->ce_states[pipe_num]; | ||
1711 | pipe_info->pipe_num = pipe_num; | 1764 | pipe_info->pipe_num = pipe_num; |
1712 | pipe_info->hif_ce_state = ar; | 1765 | pipe_info->hif_ce_state = ar; |
1713 | attr = &host_ce_config_wlan[pipe_num]; | 1766 | attr = &host_ce_config_wlan[pipe_num]; |
1714 | 1767 | ||
1715 | pipe_info->ce_hdl = ath10k_ce_init(ar, pipe_num, attr); | 1768 | ret = ath10k_ce_init_pipe(ar, pipe_num, attr); |
1716 | if (pipe_info->ce_hdl == NULL) { | 1769 | if (ret) { |
1717 | ath10k_err("failed to initialize CE for pipe: %d\n", | 1770 | ath10k_err("failed to initialize copy engine pipe %d: %d\n", |
1718 | pipe_num); | 1771 | pipe_num, ret); |
1719 | 1772 | return ret; | |
1720 | /* It is safe to call it here. It checks if ce_hdl is | ||
1721 | * valid for each pipe */ | ||
1722 | ath10k_pci_ce_deinit(ar); | ||
1723 | return -1; | ||
1724 | } | 1773 | } |
1725 | 1774 | ||
1726 | if (pipe_num == CE_COUNT - 1) { | 1775 | if (pipe_num == CE_COUNT - 1) { |
@@ -1741,16 +1790,15 @@ static int ath10k_pci_ce_init(struct ath10k *ar) | |||
1741 | static void ath10k_pci_fw_interrupt_handler(struct ath10k *ar) | 1790 | static void ath10k_pci_fw_interrupt_handler(struct ath10k *ar) |
1742 | { | 1791 | { |
1743 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | 1792 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
1744 | u32 fw_indicator_address, fw_indicator; | 1793 | u32 fw_indicator; |
1745 | 1794 | ||
1746 | ath10k_pci_wake(ar); | 1795 | ath10k_pci_wake(ar); |
1747 | 1796 | ||
1748 | fw_indicator_address = ar_pci->fw_indicator_address; | 1797 | fw_indicator = ath10k_pci_read32(ar, FW_INDICATOR_ADDRESS); |
1749 | fw_indicator = ath10k_pci_read32(ar, fw_indicator_address); | ||
1750 | 1798 | ||
1751 | if (fw_indicator & FW_IND_EVENT_PENDING) { | 1799 | if (fw_indicator & FW_IND_EVENT_PENDING) { |
1752 | /* ACK: clear Target-side pending event */ | 1800 | /* ACK: clear Target-side pending event */ |
1753 | ath10k_pci_write32(ar, fw_indicator_address, | 1801 | ath10k_pci_write32(ar, FW_INDICATOR_ADDRESS, |
1754 | fw_indicator & ~FW_IND_EVENT_PENDING); | 1802 | fw_indicator & ~FW_IND_EVENT_PENDING); |
1755 | 1803 | ||
1756 | if (ar_pci->started) { | 1804 | if (ar_pci->started) { |
@@ -1767,13 +1815,32 @@ static void ath10k_pci_fw_interrupt_handler(struct ath10k *ar) | |||
1767 | ath10k_pci_sleep(ar); | 1815 | ath10k_pci_sleep(ar); |
1768 | } | 1816 | } |
1769 | 1817 | ||
1818 | /* this function effectively clears target memory controller assert line */ | ||
1819 | static void ath10k_pci_warm_reset_si0(struct ath10k *ar) | ||
1820 | { | ||
1821 | u32 val; | ||
1822 | |||
1823 | val = ath10k_pci_soc_read32(ar, SOC_RESET_CONTROL_ADDRESS); | ||
1824 | ath10k_pci_soc_write32(ar, SOC_RESET_CONTROL_ADDRESS, | ||
1825 | val | SOC_RESET_CONTROL_SI0_RST_MASK); | ||
1826 | val = ath10k_pci_soc_read32(ar, SOC_RESET_CONTROL_ADDRESS); | ||
1827 | |||
1828 | msleep(10); | ||
1829 | |||
1830 | val = ath10k_pci_soc_read32(ar, SOC_RESET_CONTROL_ADDRESS); | ||
1831 | ath10k_pci_soc_write32(ar, SOC_RESET_CONTROL_ADDRESS, | ||
1832 | val & ~SOC_RESET_CONTROL_SI0_RST_MASK); | ||
1833 | val = ath10k_pci_soc_read32(ar, SOC_RESET_CONTROL_ADDRESS); | ||
1834 | |||
1835 | msleep(10); | ||
1836 | } | ||
1837 | |||
1770 | static int ath10k_pci_warm_reset(struct ath10k *ar) | 1838 | static int ath10k_pci_warm_reset(struct ath10k *ar) |
1771 | { | 1839 | { |
1772 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | ||
1773 | int ret = 0; | 1840 | int ret = 0; |
1774 | u32 val; | 1841 | u32 val; |
1775 | 1842 | ||
1776 | ath10k_dbg(ATH10K_DBG_BOOT, "boot performing warm chip reset\n"); | 1843 | ath10k_dbg(ATH10K_DBG_BOOT, "boot warm reset\n"); |
1777 | 1844 | ||
1778 | ret = ath10k_do_pci_wake(ar); | 1845 | ret = ath10k_do_pci_wake(ar); |
1779 | if (ret) { | 1846 | if (ret) { |
@@ -1801,7 +1868,7 @@ static int ath10k_pci_warm_reset(struct ath10k *ar) | |||
1801 | msleep(100); | 1868 | msleep(100); |
1802 | 1869 | ||
1803 | /* clear fw indicator */ | 1870 | /* clear fw indicator */ |
1804 | ath10k_pci_write32(ar, ar_pci->fw_indicator_address, 0); | 1871 | ath10k_pci_write32(ar, FW_INDICATOR_ADDRESS, 0); |
1805 | 1872 | ||
1806 | /* clear target LF timer interrupts */ | 1873 | /* clear target LF timer interrupts */ |
1807 | val = ath10k_pci_read32(ar, RTC_SOC_BASE_ADDRESS + | 1874 | val = ath10k_pci_read32(ar, RTC_SOC_BASE_ADDRESS + |
@@ -1826,6 +1893,8 @@ static int ath10k_pci_warm_reset(struct ath10k *ar) | |||
1826 | SOC_RESET_CONTROL_ADDRESS); | 1893 | SOC_RESET_CONTROL_ADDRESS); |
1827 | msleep(10); | 1894 | msleep(10); |
1828 | 1895 | ||
1896 | ath10k_pci_warm_reset_si0(ar); | ||
1897 | |||
1829 | /* debug */ | 1898 | /* debug */ |
1830 | val = ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS + | 1899 | val = ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS + |
1831 | PCIE_INTR_CAUSE_ADDRESS); | 1900 | PCIE_INTR_CAUSE_ADDRESS); |
@@ -1934,7 +2003,9 @@ static int __ath10k_pci_hif_power_up(struct ath10k *ar, bool cold_reset) | |||
1934 | irq_mode = "legacy"; | 2003 | irq_mode = "legacy"; |
1935 | 2004 | ||
1936 | if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags)) | 2005 | if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags)) |
1937 | ath10k_info("pci irq %s\n", irq_mode); | 2006 | ath10k_info("pci irq %s irq_mode %d reset_mode %d\n", |
2007 | irq_mode, ath10k_pci_irq_mode, | ||
2008 | ath10k_pci_reset_mode); | ||
1938 | 2009 | ||
1939 | return 0; | 2010 | return 0; |
1940 | 2011 | ||
@@ -1952,23 +2023,52 @@ err: | |||
1952 | return ret; | 2023 | return ret; |
1953 | } | 2024 | } |
1954 | 2025 | ||
2026 | static int ath10k_pci_hif_power_up_warm(struct ath10k *ar) | ||
2027 | { | ||
2028 | int i, ret; | ||
2029 | |||
2030 | /* | ||
2031 | * Sometime warm reset succeeds after retries. | ||
2032 | * | ||
2033 | * FIXME: It might be possible to tune ath10k_pci_warm_reset() to work | ||
2034 | * at first try. | ||
2035 | */ | ||
2036 | for (i = 0; i < ATH10K_PCI_NUM_WARM_RESET_ATTEMPTS; i++) { | ||
2037 | ret = __ath10k_pci_hif_power_up(ar, false); | ||
2038 | if (ret == 0) | ||
2039 | break; | ||
2040 | |||
2041 | ath10k_warn("failed to warm reset (attempt %d out of %d): %d\n", | ||
2042 | i + 1, ATH10K_PCI_NUM_WARM_RESET_ATTEMPTS, ret); | ||
2043 | } | ||
2044 | |||
2045 | return ret; | ||
2046 | } | ||
2047 | |||
1955 | static int ath10k_pci_hif_power_up(struct ath10k *ar) | 2048 | static int ath10k_pci_hif_power_up(struct ath10k *ar) |
1956 | { | 2049 | { |
1957 | int ret; | 2050 | int ret; |
1958 | 2051 | ||
2052 | ath10k_dbg(ATH10K_DBG_BOOT, "boot hif power up\n"); | ||
2053 | |||
1959 | /* | 2054 | /* |
1960 | * Hardware CUS232 version 2 has some issues with cold reset and the | 2055 | * Hardware CUS232 version 2 has some issues with cold reset and the |
1961 | * preferred (and safer) way to perform a device reset is through a | 2056 | * preferred (and safer) way to perform a device reset is through a |
1962 | * warm reset. | 2057 | * warm reset. |
1963 | * | 2058 | * |
1964 | * Warm reset doesn't always work though (notably after a firmware | 2059 | * Warm reset doesn't always work though so fall back to cold reset may |
1965 | * crash) so fall back to cold reset if necessary. | 2060 | * be necessary. |
1966 | */ | 2061 | */ |
1967 | ret = __ath10k_pci_hif_power_up(ar, false); | 2062 | ret = ath10k_pci_hif_power_up_warm(ar); |
1968 | if (ret) { | 2063 | if (ret) { |
1969 | ath10k_warn("failed to power up target using warm reset (%d), trying cold reset\n", | 2064 | ath10k_warn("failed to power up target using warm reset: %d\n", |
1970 | ret); | 2065 | ret); |
1971 | 2066 | ||
2067 | if (ath10k_pci_reset_mode == ATH10K_PCI_RESET_WARM_ONLY) | ||
2068 | return ret; | ||
2069 | |||
2070 | ath10k_warn("trying cold reset\n"); | ||
2071 | |||
1972 | ret = __ath10k_pci_hif_power_up(ar, true); | 2072 | ret = __ath10k_pci_hif_power_up(ar, true); |
1973 | if (ret) { | 2073 | if (ret) { |
1974 | ath10k_err("failed to power up target using cold reset too (%d)\n", | 2074 | ath10k_err("failed to power up target using cold reset too (%d)\n", |
@@ -1984,12 +2084,14 @@ static void ath10k_pci_hif_power_down(struct ath10k *ar) | |||
1984 | { | 2084 | { |
1985 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | 2085 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
1986 | 2086 | ||
2087 | ath10k_dbg(ATH10K_DBG_BOOT, "boot hif power down\n"); | ||
2088 | |||
1987 | ath10k_pci_free_early_irq(ar); | 2089 | ath10k_pci_free_early_irq(ar); |
1988 | ath10k_pci_kill_tasklet(ar); | 2090 | ath10k_pci_kill_tasklet(ar); |
1989 | ath10k_pci_deinit_irq(ar); | 2091 | ath10k_pci_deinit_irq(ar); |
2092 | ath10k_pci_ce_deinit(ar); | ||
1990 | ath10k_pci_warm_reset(ar); | 2093 | ath10k_pci_warm_reset(ar); |
1991 | 2094 | ||
1992 | ath10k_pci_ce_deinit(ar); | ||
1993 | if (!test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features)) | 2095 | if (!test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features)) |
1994 | ath10k_do_pci_sleep(ar); | 2096 | ath10k_do_pci_sleep(ar); |
1995 | } | 2097 | } |
@@ -2137,7 +2239,6 @@ static irqreturn_t ath10k_pci_interrupt_handler(int irq, void *arg) | |||
2137 | static void ath10k_pci_early_irq_tasklet(unsigned long data) | 2239 | static void ath10k_pci_early_irq_tasklet(unsigned long data) |
2138 | { | 2240 | { |
2139 | struct ath10k *ar = (struct ath10k *)data; | 2241 | struct ath10k *ar = (struct ath10k *)data; |
2140 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | ||
2141 | u32 fw_ind; | 2242 | u32 fw_ind; |
2142 | int ret; | 2243 | int ret; |
2143 | 2244 | ||
@@ -2148,14 +2249,11 @@ static void ath10k_pci_early_irq_tasklet(unsigned long data) | |||
2148 | return; | 2249 | return; |
2149 | } | 2250 | } |
2150 | 2251 | ||
2151 | fw_ind = ath10k_pci_read32(ar, ar_pci->fw_indicator_address); | 2252 | fw_ind = ath10k_pci_read32(ar, FW_INDICATOR_ADDRESS); |
2152 | if (fw_ind & FW_IND_EVENT_PENDING) { | 2253 | if (fw_ind & FW_IND_EVENT_PENDING) { |
2153 | ath10k_pci_write32(ar, ar_pci->fw_indicator_address, | 2254 | ath10k_pci_write32(ar, FW_INDICATOR_ADDRESS, |
2154 | fw_ind & ~FW_IND_EVENT_PENDING); | 2255 | fw_ind & ~FW_IND_EVENT_PENDING); |
2155 | 2256 | ath10k_pci_hif_dump_area(ar); | |
2156 | /* Some structures are unavailable during early boot or at | ||
2157 | * driver teardown so just print that the device has crashed. */ | ||
2158 | ath10k_warn("device crashed - no diagnostics available\n"); | ||
2159 | } | 2257 | } |
2160 | 2258 | ||
2161 | ath10k_pci_sleep(ar); | 2259 | ath10k_pci_sleep(ar); |
@@ -2385,33 +2483,69 @@ static int ath10k_pci_deinit_irq(struct ath10k *ar) | |||
2385 | static int ath10k_pci_wait_for_target_init(struct ath10k *ar) | 2483 | static int ath10k_pci_wait_for_target_init(struct ath10k *ar) |
2386 | { | 2484 | { |
2387 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | 2485 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
2388 | int wait_limit = 300; /* 3 sec */ | 2486 | unsigned long timeout; |
2389 | int ret; | 2487 | int ret; |
2488 | u32 val; | ||
2489 | |||
2490 | ath10k_dbg(ATH10K_DBG_BOOT, "boot waiting target to initialise\n"); | ||
2390 | 2491 | ||
2391 | ret = ath10k_pci_wake(ar); | 2492 | ret = ath10k_pci_wake(ar); |
2392 | if (ret) { | 2493 | if (ret) { |
2393 | ath10k_err("failed to wake up target: %d\n", ret); | 2494 | ath10k_err("failed to wake up target for init: %d\n", ret); |
2394 | return ret; | 2495 | return ret; |
2395 | } | 2496 | } |
2396 | 2497 | ||
2397 | while (wait_limit-- && | 2498 | timeout = jiffies + msecs_to_jiffies(ATH10K_PCI_TARGET_WAIT); |
2398 | !(ioread32(ar_pci->mem + FW_INDICATOR_ADDRESS) & | 2499 | |
2399 | FW_IND_INITIALIZED)) { | 2500 | do { |
2501 | val = ath10k_pci_read32(ar, FW_INDICATOR_ADDRESS); | ||
2502 | |||
2503 | ath10k_dbg(ATH10K_DBG_BOOT, "boot target indicator %x\n", val); | ||
2504 | |||
2505 | /* target should never return this */ | ||
2506 | if (val == 0xffffffff) | ||
2507 | continue; | ||
2508 | |||
2509 | /* the device has crashed so don't bother trying anymore */ | ||
2510 | if (val & FW_IND_EVENT_PENDING) | ||
2511 | break; | ||
2512 | |||
2513 | if (val & FW_IND_INITIALIZED) | ||
2514 | break; | ||
2515 | |||
2400 | if (ar_pci->num_msi_intrs == 0) | 2516 | if (ar_pci->num_msi_intrs == 0) |
2401 | /* Fix potential race by repeating CORE_BASE writes */ | 2517 | /* Fix potential race by repeating CORE_BASE writes */ |
2402 | iowrite32(PCIE_INTR_FIRMWARE_MASK | | 2518 | ath10k_pci_soc_write32(ar, PCIE_INTR_ENABLE_ADDRESS, |
2403 | PCIE_INTR_CE_MASK_ALL, | 2519 | PCIE_INTR_FIRMWARE_MASK | |
2404 | ar_pci->mem + (SOC_CORE_BASE_ADDRESS | | 2520 | PCIE_INTR_CE_MASK_ALL); |
2405 | PCIE_INTR_ENABLE_ADDRESS)); | 2521 | |
2406 | mdelay(10); | 2522 | mdelay(10); |
2407 | } | 2523 | } while (time_before(jiffies, timeout)); |
2408 | 2524 | ||
2409 | if (wait_limit < 0) { | 2525 | if (val == 0xffffffff) { |
2410 | ath10k_err("target stalled\n"); | 2526 | ath10k_err("failed to read device register, device is gone\n"); |
2411 | ret = -EIO; | 2527 | ret = -EIO; |
2412 | goto out; | 2528 | goto out; |
2413 | } | 2529 | } |
2414 | 2530 | ||
2531 | if (val & FW_IND_EVENT_PENDING) { | ||
2532 | ath10k_warn("device has crashed during init\n"); | ||
2533 | ath10k_pci_write32(ar, FW_INDICATOR_ADDRESS, | ||
2534 | val & ~FW_IND_EVENT_PENDING); | ||
2535 | ath10k_pci_hif_dump_area(ar); | ||
2536 | ret = -ECOMM; | ||
2537 | goto out; | ||
2538 | } | ||
2539 | |||
2540 | if (!(val & FW_IND_INITIALIZED)) { | ||
2541 | ath10k_err("failed to receive initialized event from target: %08x\n", | ||
2542 | val); | ||
2543 | ret = -ETIMEDOUT; | ||
2544 | goto out; | ||
2545 | } | ||
2546 | |||
2547 | ath10k_dbg(ATH10K_DBG_BOOT, "boot target initialised\n"); | ||
2548 | |||
2415 | out: | 2549 | out: |
2416 | ath10k_pci_sleep(ar); | 2550 | ath10k_pci_sleep(ar); |
2417 | return ret; | 2551 | return ret; |
@@ -2422,6 +2556,8 @@ static int ath10k_pci_cold_reset(struct ath10k *ar) | |||
2422 | int i, ret; | 2556 | int i, ret; |
2423 | u32 val; | 2557 | u32 val; |
2424 | 2558 | ||
2559 | ath10k_dbg(ATH10K_DBG_BOOT, "boot cold reset\n"); | ||
2560 | |||
2425 | ret = ath10k_do_pci_wake(ar); | 2561 | ret = ath10k_do_pci_wake(ar); |
2426 | if (ret) { | 2562 | if (ret) { |
2427 | ath10k_err("failed to wake up target: %d\n", | 2563 | ath10k_err("failed to wake up target: %d\n", |
@@ -2453,6 +2589,9 @@ static int ath10k_pci_cold_reset(struct ath10k *ar) | |||
2453 | } | 2589 | } |
2454 | 2590 | ||
2455 | ath10k_do_pci_sleep(ar); | 2591 | ath10k_do_pci_sleep(ar); |
2592 | |||
2593 | ath10k_dbg(ATH10K_DBG_BOOT, "boot cold reset complete\n"); | ||
2594 | |||
2456 | return 0; | 2595 | return 0; |
2457 | } | 2596 | } |
2458 | 2597 | ||
@@ -2484,7 +2623,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev, | |||
2484 | struct ath10k_pci *ar_pci; | 2623 | struct ath10k_pci *ar_pci; |
2485 | u32 lcr_val, chip_id; | 2624 | u32 lcr_val, chip_id; |
2486 | 2625 | ||
2487 | ath10k_dbg(ATH10K_DBG_PCI, "%s\n", __func__); | 2626 | ath10k_dbg(ATH10K_DBG_PCI, "pci probe\n"); |
2488 | 2627 | ||
2489 | ar_pci = kzalloc(sizeof(*ar_pci), GFP_KERNEL); | 2628 | ar_pci = kzalloc(sizeof(*ar_pci), GFP_KERNEL); |
2490 | if (ar_pci == NULL) | 2629 | if (ar_pci == NULL) |
@@ -2503,7 +2642,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev, | |||
2503 | goto err_ar_pci; | 2642 | goto err_ar_pci; |
2504 | } | 2643 | } |
2505 | 2644 | ||
2506 | if (ath10k_target_ps) | 2645 | if (ath10k_pci_target_ps) |
2507 | set_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features); | 2646 | set_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features); |
2508 | 2647 | ||
2509 | ath10k_pci_dump_features(ar_pci); | 2648 | ath10k_pci_dump_features(ar_pci); |
@@ -2516,23 +2655,10 @@ static int ath10k_pci_probe(struct pci_dev *pdev, | |||
2516 | } | 2655 | } |
2517 | 2656 | ||
2518 | ar_pci->ar = ar; | 2657 | ar_pci->ar = ar; |
2519 | ar_pci->fw_indicator_address = FW_INDICATOR_ADDRESS; | ||
2520 | atomic_set(&ar_pci->keep_awake_count, 0); | 2658 | atomic_set(&ar_pci->keep_awake_count, 0); |
2521 | 2659 | ||
2522 | pci_set_drvdata(pdev, ar); | 2660 | pci_set_drvdata(pdev, ar); |
2523 | 2661 | ||
2524 | /* | ||
2525 | * Without any knowledge of the Host, the Target may have been reset or | ||
2526 | * power cycled and its Config Space may no longer reflect the PCI | ||
2527 | * address space that was assigned earlier by the PCI infrastructure. | ||
2528 | * Refresh it now. | ||
2529 | */ | ||
2530 | ret = pci_assign_resource(pdev, BAR_NUM); | ||
2531 | if (ret) { | ||
2532 | ath10k_err("failed to assign PCI space: %d\n", ret); | ||
2533 | goto err_ar; | ||
2534 | } | ||
2535 | |||
2536 | ret = pci_enable_device(pdev); | 2662 | ret = pci_enable_device(pdev); |
2537 | if (ret) { | 2663 | if (ret) { |
2538 | ath10k_err("failed to enable PCI device: %d\n", ret); | 2664 | ath10k_err("failed to enable PCI device: %d\n", ret); |
@@ -2594,16 +2720,24 @@ static int ath10k_pci_probe(struct pci_dev *pdev, | |||
2594 | 2720 | ||
2595 | ath10k_do_pci_sleep(ar); | 2721 | ath10k_do_pci_sleep(ar); |
2596 | 2722 | ||
2723 | ret = ath10k_pci_alloc_ce(ar); | ||
2724 | if (ret) { | ||
2725 | ath10k_err("failed to allocate copy engine pipes: %d\n", ret); | ||
2726 | goto err_iomap; | ||
2727 | } | ||
2728 | |||
2597 | ath10k_dbg(ATH10K_DBG_BOOT, "boot pci_mem 0x%p\n", ar_pci->mem); | 2729 | ath10k_dbg(ATH10K_DBG_BOOT, "boot pci_mem 0x%p\n", ar_pci->mem); |
2598 | 2730 | ||
2599 | ret = ath10k_core_register(ar, chip_id); | 2731 | ret = ath10k_core_register(ar, chip_id); |
2600 | if (ret) { | 2732 | if (ret) { |
2601 | ath10k_err("failed to register driver core: %d\n", ret); | 2733 | ath10k_err("failed to register driver core: %d\n", ret); |
2602 | goto err_iomap; | 2734 | goto err_free_ce; |
2603 | } | 2735 | } |
2604 | 2736 | ||
2605 | return 0; | 2737 | return 0; |
2606 | 2738 | ||
2739 | err_free_ce: | ||
2740 | ath10k_pci_free_ce(ar); | ||
2607 | err_iomap: | 2741 | err_iomap: |
2608 | pci_iounmap(pdev, mem); | 2742 | pci_iounmap(pdev, mem); |
2609 | err_master: | 2743 | err_master: |
@@ -2626,7 +2760,7 @@ static void ath10k_pci_remove(struct pci_dev *pdev) | |||
2626 | struct ath10k *ar = pci_get_drvdata(pdev); | 2760 | struct ath10k *ar = pci_get_drvdata(pdev); |
2627 | struct ath10k_pci *ar_pci; | 2761 | struct ath10k_pci *ar_pci; |
2628 | 2762 | ||
2629 | ath10k_dbg(ATH10K_DBG_PCI, "%s\n", __func__); | 2763 | ath10k_dbg(ATH10K_DBG_PCI, "pci remove\n"); |
2630 | 2764 | ||
2631 | if (!ar) | 2765 | if (!ar) |
2632 | return; | 2766 | return; |
@@ -2636,9 +2770,8 @@ static void ath10k_pci_remove(struct pci_dev *pdev) | |||
2636 | if (!ar_pci) | 2770 | if (!ar_pci) |
2637 | return; | 2771 | return; |
2638 | 2772 | ||
2639 | tasklet_kill(&ar_pci->msi_fw_err); | ||
2640 | |||
2641 | ath10k_core_unregister(ar); | 2773 | ath10k_core_unregister(ar); |
2774 | ath10k_pci_free_ce(ar); | ||
2642 | 2775 | ||
2643 | pci_iounmap(pdev, ar_pci->mem); | 2776 | pci_iounmap(pdev, ar_pci->mem); |
2644 | pci_release_region(pdev, BAR_NUM); | 2777 | pci_release_region(pdev, BAR_NUM); |
@@ -2680,6 +2813,5 @@ module_exit(ath10k_pci_exit); | |||
2680 | MODULE_AUTHOR("Qualcomm Atheros"); | 2813 | MODULE_AUTHOR("Qualcomm Atheros"); |
2681 | MODULE_DESCRIPTION("Driver support for Atheros QCA988X PCIe devices"); | 2814 | MODULE_DESCRIPTION("Driver support for Atheros QCA988X PCIe devices"); |
2682 | MODULE_LICENSE("Dual BSD/GPL"); | 2815 | MODULE_LICENSE("Dual BSD/GPL"); |
2683 | MODULE_FIRMWARE(QCA988X_HW_2_0_FW_DIR "/" QCA988X_HW_2_0_FW_FILE); | 2816 | MODULE_FIRMWARE(QCA988X_HW_2_0_FW_DIR "/" QCA988X_HW_2_0_FW_2_FILE); |
2684 | MODULE_FIRMWARE(QCA988X_HW_2_0_FW_DIR "/" QCA988X_HW_2_0_OTP_FILE); | ||
2685 | MODULE_FIRMWARE(QCA988X_HW_2_0_FW_DIR "/" QCA988X_HW_2_0_BOARD_DATA_FILE); | 2817 | MODULE_FIRMWARE(QCA988X_HW_2_0_FW_DIR "/" QCA988X_HW_2_0_BOARD_DATA_FILE); |
diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h index b43fdb4f7319..dfdebb4157aa 100644 --- a/drivers/net/wireless/ath/ath10k/pci.h +++ b/drivers/net/wireless/ath/ath10k/pci.h | |||
@@ -189,9 +189,6 @@ struct ath10k_pci { | |||
189 | 189 | ||
190 | struct ath10k_hif_cb msg_callbacks_current; | 190 | struct ath10k_hif_cb msg_callbacks_current; |
191 | 191 | ||
192 | /* Target address used to signal a pending firmware event */ | ||
193 | u32 fw_indicator_address; | ||
194 | |||
195 | /* Copy Engine used for Diagnostic Accesses */ | 192 | /* Copy Engine used for Diagnostic Accesses */ |
196 | struct ath10k_ce_pipe *ce_diag; | 193 | struct ath10k_ce_pipe *ce_diag; |
197 | 194 | ||
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c index 0541dd939ce9..82669a77e553 100644 --- a/drivers/net/wireless/ath/ath10k/txrx.c +++ b/drivers/net/wireless/ath/ath10k/txrx.c | |||
@@ -100,189 +100,6 @@ exit: | |||
100 | wake_up(&htt->empty_tx_wq); | 100 | wake_up(&htt->empty_tx_wq); |
101 | } | 101 | } |
102 | 102 | ||
103 | static const u8 rx_legacy_rate_idx[] = { | ||
104 | 3, /* 0x00 - 11Mbps */ | ||
105 | 2, /* 0x01 - 5.5Mbps */ | ||
106 | 1, /* 0x02 - 2Mbps */ | ||
107 | 0, /* 0x03 - 1Mbps */ | ||
108 | 3, /* 0x04 - 11Mbps */ | ||
109 | 2, /* 0x05 - 5.5Mbps */ | ||
110 | 1, /* 0x06 - 2Mbps */ | ||
111 | 0, /* 0x07 - 1Mbps */ | ||
112 | 10, /* 0x08 - 48Mbps */ | ||
113 | 8, /* 0x09 - 24Mbps */ | ||
114 | 6, /* 0x0A - 12Mbps */ | ||
115 | 4, /* 0x0B - 6Mbps */ | ||
116 | 11, /* 0x0C - 54Mbps */ | ||
117 | 9, /* 0x0D - 36Mbps */ | ||
118 | 7, /* 0x0E - 18Mbps */ | ||
119 | 5, /* 0x0F - 9Mbps */ | ||
120 | }; | ||
121 | |||
122 | static void process_rx_rates(struct ath10k *ar, struct htt_rx_info *info, | ||
123 | enum ieee80211_band band, | ||
124 | struct ieee80211_rx_status *status) | ||
125 | { | ||
126 | u8 cck, rate, rate_idx, bw, sgi, mcs, nss; | ||
127 | u8 info0 = info->rate.info0; | ||
128 | u32 info1 = info->rate.info1; | ||
129 | u32 info2 = info->rate.info2; | ||
130 | u8 preamble = 0; | ||
131 | |||
132 | /* Check if valid fields */ | ||
133 | if (!(info0 & HTT_RX_INDICATION_INFO0_START_VALID)) | ||
134 | return; | ||
135 | |||
136 | preamble = MS(info1, HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE); | ||
137 | |||
138 | switch (preamble) { | ||
139 | case HTT_RX_LEGACY: | ||
140 | cck = info0 & HTT_RX_INDICATION_INFO0_LEGACY_RATE_CCK; | ||
141 | rate = MS(info0, HTT_RX_INDICATION_INFO0_LEGACY_RATE); | ||
142 | rate_idx = 0; | ||
143 | |||
144 | if (rate < 0x08 || rate > 0x0F) | ||
145 | break; | ||
146 | |||
147 | switch (band) { | ||
148 | case IEEE80211_BAND_2GHZ: | ||
149 | if (cck) | ||
150 | rate &= ~BIT(3); | ||
151 | rate_idx = rx_legacy_rate_idx[rate]; | ||
152 | break; | ||
153 | case IEEE80211_BAND_5GHZ: | ||
154 | rate_idx = rx_legacy_rate_idx[rate]; | ||
155 | /* We are using same rate table registering | ||
156 | HW - ath10k_rates[]. In case of 5GHz skip | ||
157 | CCK rates, so -4 here */ | ||
158 | rate_idx -= 4; | ||
159 | break; | ||
160 | default: | ||
161 | break; | ||
162 | } | ||
163 | |||
164 | status->rate_idx = rate_idx; | ||
165 | break; | ||
166 | case HTT_RX_HT: | ||
167 | case HTT_RX_HT_WITH_TXBF: | ||
168 | /* HT-SIG - Table 20-11 in info1 and info2 */ | ||
169 | mcs = info1 & 0x1F; | ||
170 | nss = mcs >> 3; | ||
171 | bw = (info1 >> 7) & 1; | ||
172 | sgi = (info2 >> 7) & 1; | ||
173 | |||
174 | status->rate_idx = mcs; | ||
175 | status->flag |= RX_FLAG_HT; | ||
176 | if (sgi) | ||
177 | status->flag |= RX_FLAG_SHORT_GI; | ||
178 | if (bw) | ||
179 | status->flag |= RX_FLAG_40MHZ; | ||
180 | break; | ||
181 | case HTT_RX_VHT: | ||
182 | case HTT_RX_VHT_WITH_TXBF: | ||
183 | /* VHT-SIG-A1 in info 1, VHT-SIG-A2 in info2 | ||
184 | TODO check this */ | ||
185 | mcs = (info2 >> 4) & 0x0F; | ||
186 | nss = ((info1 >> 10) & 0x07) + 1; | ||
187 | bw = info1 & 3; | ||
188 | sgi = info2 & 1; | ||
189 | |||
190 | status->rate_idx = mcs; | ||
191 | status->vht_nss = nss; | ||
192 | |||
193 | if (sgi) | ||
194 | status->flag |= RX_FLAG_SHORT_GI; | ||
195 | |||
196 | switch (bw) { | ||
197 | /* 20MHZ */ | ||
198 | case 0: | ||
199 | break; | ||
200 | /* 40MHZ */ | ||
201 | case 1: | ||
202 | status->flag |= RX_FLAG_40MHZ; | ||
203 | break; | ||
204 | /* 80MHZ */ | ||
205 | case 2: | ||
206 | status->vht_flag |= RX_VHT_FLAG_80MHZ; | ||
207 | } | ||
208 | |||
209 | status->flag |= RX_FLAG_VHT; | ||
210 | break; | ||
211 | default: | ||
212 | break; | ||
213 | } | ||
214 | } | ||
215 | |||
216 | void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info) | ||
217 | { | ||
218 | struct ieee80211_rx_status *status; | ||
219 | struct ieee80211_channel *ch; | ||
220 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)info->skb->data; | ||
221 | |||
222 | status = IEEE80211_SKB_RXCB(info->skb); | ||
223 | memset(status, 0, sizeof(*status)); | ||
224 | |||
225 | if (info->encrypt_type != HTT_RX_MPDU_ENCRYPT_NONE) { | ||
226 | status->flag |= RX_FLAG_DECRYPTED | RX_FLAG_IV_STRIPPED | | ||
227 | RX_FLAG_MMIC_STRIPPED; | ||
228 | hdr->frame_control = __cpu_to_le16( | ||
229 | __le16_to_cpu(hdr->frame_control) & | ||
230 | ~IEEE80211_FCTL_PROTECTED); | ||
231 | } | ||
232 | |||
233 | if (info->mic_err) | ||
234 | status->flag |= RX_FLAG_MMIC_ERROR; | ||
235 | |||
236 | if (info->fcs_err) | ||
237 | status->flag |= RX_FLAG_FAILED_FCS_CRC; | ||
238 | |||
239 | if (info->amsdu_more) | ||
240 | status->flag |= RX_FLAG_AMSDU_MORE; | ||
241 | |||
242 | status->signal = info->signal; | ||
243 | |||
244 | spin_lock_bh(&ar->data_lock); | ||
245 | ch = ar->scan_channel; | ||
246 | if (!ch) | ||
247 | ch = ar->rx_channel; | ||
248 | spin_unlock_bh(&ar->data_lock); | ||
249 | |||
250 | if (!ch) { | ||
251 | ath10k_warn("no channel configured; ignoring frame!\n"); | ||
252 | dev_kfree_skb_any(info->skb); | ||
253 | return; | ||
254 | } | ||
255 | |||
256 | process_rx_rates(ar, info, ch->band, status); | ||
257 | status->band = ch->band; | ||
258 | status->freq = ch->center_freq; | ||
259 | |||
260 | if (info->rate.info0 & HTT_RX_INDICATION_INFO0_END_VALID) { | ||
261 | /* TSF available only in 32-bit */ | ||
262 | status->mactime = info->tsf & 0xffffffff; | ||
263 | status->flag |= RX_FLAG_MACTIME_END; | ||
264 | } | ||
265 | |||
266 | ath10k_dbg(ATH10K_DBG_DATA, | ||
267 | "rx skb %p len %u %s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i\n", | ||
268 | info->skb, | ||
269 | info->skb->len, | ||
270 | status->flag == 0 ? "legacy" : "", | ||
271 | status->flag & RX_FLAG_HT ? "ht" : "", | ||
272 | status->flag & RX_FLAG_VHT ? "vht" : "", | ||
273 | status->flag & RX_FLAG_40MHZ ? "40" : "", | ||
274 | status->vht_flag & RX_VHT_FLAG_80MHZ ? "80" : "", | ||
275 | status->flag & RX_FLAG_SHORT_GI ? "sgi " : "", | ||
276 | status->rate_idx, | ||
277 | status->vht_nss, | ||
278 | status->freq, | ||
279 | status->band, status->flag, info->fcs_err); | ||
280 | ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "rx skb: ", | ||
281 | info->skb->data, info->skb->len); | ||
282 | |||
283 | ieee80211_rx(ar->hw, info->skb); | ||
284 | } | ||
285 | |||
286 | struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id, | 103 | struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id, |
287 | const u8 *addr) | 104 | const u8 *addr) |
288 | { | 105 | { |
diff --git a/drivers/net/wireless/ath/ath10k/txrx.h b/drivers/net/wireless/ath/ath10k/txrx.h index 356dc9c04c9e..aee3e20058f8 100644 --- a/drivers/net/wireless/ath/ath10k/txrx.h +++ b/drivers/net/wireless/ath/ath10k/txrx.h | |||
@@ -21,7 +21,6 @@ | |||
21 | 21 | ||
22 | void ath10k_txrx_tx_unref(struct ath10k_htt *htt, | 22 | void ath10k_txrx_tx_unref(struct ath10k_htt *htt, |
23 | const struct htt_tx_done *tx_done); | 23 | const struct htt_tx_done *tx_done); |
24 | void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info); | ||
25 | 24 | ||
26 | struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id, | 25 | struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id, |
27 | const u8 *addr); | 26 | const u8 *addr); |
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index cb1f7b5bcf4c..4b7782a529ac 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c | |||
@@ -639,6 +639,7 @@ int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *skb) | |||
639 | struct sk_buff *wmi_skb; | 639 | struct sk_buff *wmi_skb; |
640 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 640 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
641 | int len; | 641 | int len; |
642 | u32 buf_len = skb->len; | ||
642 | u16 fc; | 643 | u16 fc; |
643 | 644 | ||
644 | hdr = (struct ieee80211_hdr *)skb->data; | 645 | hdr = (struct ieee80211_hdr *)skb->data; |
@@ -648,6 +649,15 @@ int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *skb) | |||
648 | return -EINVAL; | 649 | return -EINVAL; |
649 | 650 | ||
650 | len = sizeof(cmd->hdr) + skb->len; | 651 | len = sizeof(cmd->hdr) + skb->len; |
652 | |||
653 | if ((ieee80211_is_action(hdr->frame_control) || | ||
654 | ieee80211_is_deauth(hdr->frame_control) || | ||
655 | ieee80211_is_disassoc(hdr->frame_control)) && | ||
656 | ieee80211_has_protected(hdr->frame_control)) { | ||
657 | len += IEEE80211_CCMP_MIC_LEN; | ||
658 | buf_len += IEEE80211_CCMP_MIC_LEN; | ||
659 | } | ||
660 | |||
651 | len = round_up(len, 4); | 661 | len = round_up(len, 4); |
652 | 662 | ||
653 | wmi_skb = ath10k_wmi_alloc_skb(len); | 663 | wmi_skb = ath10k_wmi_alloc_skb(len); |
@@ -659,7 +669,7 @@ int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *skb) | |||
659 | cmd->hdr.vdev_id = __cpu_to_le32(ATH10K_SKB_CB(skb)->vdev_id); | 669 | cmd->hdr.vdev_id = __cpu_to_le32(ATH10K_SKB_CB(skb)->vdev_id); |
660 | cmd->hdr.tx_rate = 0; | 670 | cmd->hdr.tx_rate = 0; |
661 | cmd->hdr.tx_power = 0; | 671 | cmd->hdr.tx_power = 0; |
662 | cmd->hdr.buf_len = __cpu_to_le32((u32)(skb->len)); | 672 | cmd->hdr.buf_len = __cpu_to_le32(buf_len); |
663 | 673 | ||
664 | memcpy(cmd->hdr.peer_macaddr.addr, ieee80211_get_DA(hdr), ETH_ALEN); | 674 | memcpy(cmd->hdr.peer_macaddr.addr, ieee80211_get_DA(hdr), ETH_ALEN); |
665 | memcpy(cmd->buf, skb->data, skb->len); | 675 | memcpy(cmd->buf, skb->data, skb->len); |
@@ -957,10 +967,16 @@ static int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) | |||
957 | * frames with Protected Bit set. */ | 967 | * frames with Protected Bit set. */ |
958 | if (ieee80211_has_protected(hdr->frame_control) && | 968 | if (ieee80211_has_protected(hdr->frame_control) && |
959 | !ieee80211_is_auth(hdr->frame_control)) { | 969 | !ieee80211_is_auth(hdr->frame_control)) { |
960 | status->flag |= RX_FLAG_DECRYPTED | RX_FLAG_IV_STRIPPED | | 970 | status->flag |= RX_FLAG_DECRYPTED; |
961 | RX_FLAG_MMIC_STRIPPED; | 971 | |
962 | hdr->frame_control = __cpu_to_le16(fc & | 972 | if (!ieee80211_is_action(hdr->frame_control) && |
973 | !ieee80211_is_deauth(hdr->frame_control) && | ||
974 | !ieee80211_is_disassoc(hdr->frame_control)) { | ||
975 | status->flag |= RX_FLAG_IV_STRIPPED | | ||
976 | RX_FLAG_MMIC_STRIPPED; | ||
977 | hdr->frame_control = __cpu_to_le16(fc & | ||
963 | ~IEEE80211_FCTL_PROTECTED); | 978 | ~IEEE80211_FCTL_PROTECTED); |
979 | } | ||
964 | } | 980 | } |
965 | 981 | ||
966 | ath10k_dbg(ATH10K_DBG_MGMT, | 982 | ath10k_dbg(ATH10K_DBG_MGMT, |
@@ -1362,13 +1378,10 @@ static void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb) | |||
1362 | struct sk_buff *bcn; | 1378 | struct sk_buff *bcn; |
1363 | int ret, vdev_id = 0; | 1379 | int ret, vdev_id = 0; |
1364 | 1380 | ||
1365 | ath10k_dbg(ATH10K_DBG_MGMT, "WMI_HOST_SWBA_EVENTID\n"); | ||
1366 | |||
1367 | ev = (struct wmi_host_swba_event *)skb->data; | 1381 | ev = (struct wmi_host_swba_event *)skb->data; |
1368 | map = __le32_to_cpu(ev->vdev_map); | 1382 | map = __le32_to_cpu(ev->vdev_map); |
1369 | 1383 | ||
1370 | ath10k_dbg(ATH10K_DBG_MGMT, "host swba:\n" | 1384 | ath10k_dbg(ATH10K_DBG_MGMT, "mgmt swba vdev_map 0x%x\n", |
1371 | "-vdev map 0x%x\n", | ||
1372 | ev->vdev_map); | 1385 | ev->vdev_map); |
1373 | 1386 | ||
1374 | for (; map; map >>= 1, vdev_id++) { | 1387 | for (; map; map >>= 1, vdev_id++) { |
@@ -1385,12 +1398,7 @@ static void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb) | |||
1385 | bcn_info = &ev->bcn_info[i]; | 1398 | bcn_info = &ev->bcn_info[i]; |
1386 | 1399 | ||
1387 | ath10k_dbg(ATH10K_DBG_MGMT, | 1400 | ath10k_dbg(ATH10K_DBG_MGMT, |
1388 | "-bcn_info[%d]:\n" | 1401 | "mgmt event bcn_info %d tim_len %d mcast %d changed %d num_ps_pending %d bitmap 0x%08x%08x%08x%08x\n", |
1389 | "--tim_len %d\n" | ||
1390 | "--tim_mcast %d\n" | ||
1391 | "--tim_changed %d\n" | ||
1392 | "--tim_num_ps_pending %d\n" | ||
1393 | "--tim_bitmap 0x%08x%08x%08x%08x\n", | ||
1394 | i, | 1402 | i, |
1395 | __le32_to_cpu(bcn_info->tim_info.tim_len), | 1403 | __le32_to_cpu(bcn_info->tim_info.tim_len), |
1396 | __le32_to_cpu(bcn_info->tim_info.tim_mcast), | 1404 | __le32_to_cpu(bcn_info->tim_info.tim_mcast), |
@@ -1439,6 +1447,7 @@ static void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb) | |||
1439 | ATH10K_SKB_CB(arvif->beacon)->paddr, | 1447 | ATH10K_SKB_CB(arvif->beacon)->paddr, |
1440 | arvif->beacon->len, DMA_TO_DEVICE); | 1448 | arvif->beacon->len, DMA_TO_DEVICE); |
1441 | dev_kfree_skb_any(arvif->beacon); | 1449 | dev_kfree_skb_any(arvif->beacon); |
1450 | arvif->beacon = NULL; | ||
1442 | } | 1451 | } |
1443 | 1452 | ||
1444 | ATH10K_SKB_CB(bcn)->paddr = dma_map_single(arvif->ar->dev, | 1453 | ATH10K_SKB_CB(bcn)->paddr = dma_map_single(arvif->ar->dev, |
@@ -1448,6 +1457,7 @@ static void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb) | |||
1448 | ATH10K_SKB_CB(bcn)->paddr); | 1457 | ATH10K_SKB_CB(bcn)->paddr); |
1449 | if (ret) { | 1458 | if (ret) { |
1450 | ath10k_warn("failed to map beacon: %d\n", ret); | 1459 | ath10k_warn("failed to map beacon: %d\n", ret); |
1460 | dev_kfree_skb_any(bcn); | ||
1451 | goto skip; | 1461 | goto skip; |
1452 | } | 1462 | } |
1453 | 1463 | ||
@@ -2365,7 +2375,7 @@ void ath10k_wmi_detach(struct ath10k *ar) | |||
2365 | ar->wmi.num_mem_chunks = 0; | 2375 | ar->wmi.num_mem_chunks = 0; |
2366 | } | 2376 | } |
2367 | 2377 | ||
2368 | int ath10k_wmi_connect_htc_service(struct ath10k *ar) | 2378 | int ath10k_wmi_connect(struct ath10k *ar) |
2369 | { | 2379 | { |
2370 | int status; | 2380 | int status; |
2371 | struct ath10k_htc_svc_conn_req conn_req; | 2381 | struct ath10k_htc_svc_conn_req conn_req; |
@@ -2393,8 +2403,9 @@ int ath10k_wmi_connect_htc_service(struct ath10k *ar) | |||
2393 | return 0; | 2403 | return 0; |
2394 | } | 2404 | } |
2395 | 2405 | ||
2396 | int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g, | 2406 | static int ath10k_wmi_main_pdev_set_regdomain(struct ath10k *ar, u16 rd, |
2397 | u16 rd5g, u16 ctl2g, u16 ctl5g) | 2407 | u16 rd2g, u16 rd5g, u16 ctl2g, |
2408 | u16 ctl5g) | ||
2398 | { | 2409 | { |
2399 | struct wmi_pdev_set_regdomain_cmd *cmd; | 2410 | struct wmi_pdev_set_regdomain_cmd *cmd; |
2400 | struct sk_buff *skb; | 2411 | struct sk_buff *skb; |
@@ -2418,6 +2429,46 @@ int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g, | |||
2418 | ar->wmi.cmd->pdev_set_regdomain_cmdid); | 2429 | ar->wmi.cmd->pdev_set_regdomain_cmdid); |
2419 | } | 2430 | } |
2420 | 2431 | ||
2432 | static int ath10k_wmi_10x_pdev_set_regdomain(struct ath10k *ar, u16 rd, | ||
2433 | u16 rd2g, u16 rd5g, | ||
2434 | u16 ctl2g, u16 ctl5g, | ||
2435 | enum wmi_dfs_region dfs_reg) | ||
2436 | { | ||
2437 | struct wmi_pdev_set_regdomain_cmd_10x *cmd; | ||
2438 | struct sk_buff *skb; | ||
2439 | |||
2440 | skb = ath10k_wmi_alloc_skb(sizeof(*cmd)); | ||
2441 | if (!skb) | ||
2442 | return -ENOMEM; | ||
2443 | |||
2444 | cmd = (struct wmi_pdev_set_regdomain_cmd_10x *)skb->data; | ||
2445 | cmd->reg_domain = __cpu_to_le32(rd); | ||
2446 | cmd->reg_domain_2G = __cpu_to_le32(rd2g); | ||
2447 | cmd->reg_domain_5G = __cpu_to_le32(rd5g); | ||
2448 | cmd->conformance_test_limit_2G = __cpu_to_le32(ctl2g); | ||
2449 | cmd->conformance_test_limit_5G = __cpu_to_le32(ctl5g); | ||
2450 | cmd->dfs_domain = __cpu_to_le32(dfs_reg); | ||
2451 | |||
2452 | ath10k_dbg(ATH10K_DBG_WMI, | ||
2453 | "wmi pdev regdomain rd %x rd2g %x rd5g %x ctl2g %x ctl5g %x dfs_region %x\n", | ||
2454 | rd, rd2g, rd5g, ctl2g, ctl5g, dfs_reg); | ||
2455 | |||
2456 | return ath10k_wmi_cmd_send(ar, skb, | ||
2457 | ar->wmi.cmd->pdev_set_regdomain_cmdid); | ||
2458 | } | ||
2459 | |||
2460 | int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g, | ||
2461 | u16 rd5g, u16 ctl2g, u16 ctl5g, | ||
2462 | enum wmi_dfs_region dfs_reg) | ||
2463 | { | ||
2464 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) | ||
2465 | return ath10k_wmi_10x_pdev_set_regdomain(ar, rd, rd2g, rd5g, | ||
2466 | ctl2g, ctl5g, dfs_reg); | ||
2467 | else | ||
2468 | return ath10k_wmi_main_pdev_set_regdomain(ar, rd, rd2g, rd5g, | ||
2469 | ctl2g, ctl5g); | ||
2470 | } | ||
2471 | |||
2421 | int ath10k_wmi_pdev_set_channel(struct ath10k *ar, | 2472 | int ath10k_wmi_pdev_set_channel(struct ath10k *ar, |
2422 | const struct wmi_channel_arg *arg) | 2473 | const struct wmi_channel_arg *arg) |
2423 | { | 2474 | { |
@@ -3456,8 +3507,9 @@ int ath10k_wmi_peer_assoc(struct ath10k *ar, | |||
3456 | __cpu_to_le32(arg->peer_vht_rates.tx_mcs_set); | 3507 | __cpu_to_le32(arg->peer_vht_rates.tx_mcs_set); |
3457 | 3508 | ||
3458 | ath10k_dbg(ATH10K_DBG_WMI, | 3509 | ath10k_dbg(ATH10K_DBG_WMI, |
3459 | "wmi peer assoc vdev %d addr %pM\n", | 3510 | "wmi peer assoc vdev %d addr %pM (%s)\n", |
3460 | arg->vdev_id, arg->addr); | 3511 | arg->vdev_id, arg->addr, |
3512 | arg->peer_reassoc ? "reassociate" : "new"); | ||
3461 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_assoc_cmdid); | 3513 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_assoc_cmdid); |
3462 | } | 3514 | } |
3463 | 3515 | ||
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index f51d5ca0141f..e93df2c10413 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h | |||
@@ -198,16 +198,6 @@ struct wmi_mac_addr { | |||
198 | } __packed; | 198 | } __packed; |
199 | } __packed; | 199 | } __packed; |
200 | 200 | ||
201 | /* macro to convert MAC address from WMI word format to char array */ | ||
202 | #define WMI_MAC_ADDR_TO_CHAR_ARRAY(pwmi_mac_addr, c_macaddr) do { \ | ||
203 | (c_macaddr)[0] = ((pwmi_mac_addr)->word0) & 0xff; \ | ||
204 | (c_macaddr)[1] = (((pwmi_mac_addr)->word0) >> 8) & 0xff; \ | ||
205 | (c_macaddr)[2] = (((pwmi_mac_addr)->word0) >> 16) & 0xff; \ | ||
206 | (c_macaddr)[3] = (((pwmi_mac_addr)->word0) >> 24) & 0xff; \ | ||
207 | (c_macaddr)[4] = ((pwmi_mac_addr)->word1) & 0xff; \ | ||
208 | (c_macaddr)[5] = (((pwmi_mac_addr)->word1) >> 8) & 0xff; \ | ||
209 | } while (0) | ||
210 | |||
211 | struct wmi_cmd_map { | 201 | struct wmi_cmd_map { |
212 | u32 init_cmdid; | 202 | u32 init_cmdid; |
213 | u32 start_scan_cmdid; | 203 | u32 start_scan_cmdid; |
@@ -2185,6 +2175,31 @@ struct wmi_pdev_set_regdomain_cmd { | |||
2185 | __le32 conformance_test_limit_5G; | 2175 | __le32 conformance_test_limit_5G; |
2186 | } __packed; | 2176 | } __packed; |
2187 | 2177 | ||
2178 | enum wmi_dfs_region { | ||
2179 | /* Uninitialized dfs domain */ | ||
2180 | WMI_UNINIT_DFS_DOMAIN = 0, | ||
2181 | |||
2182 | /* FCC3 dfs domain */ | ||
2183 | WMI_FCC_DFS_DOMAIN = 1, | ||
2184 | |||
2185 | /* ETSI dfs domain */ | ||
2186 | WMI_ETSI_DFS_DOMAIN = 2, | ||
2187 | |||
2188 | /*Japan dfs domain */ | ||
2189 | WMI_MKK4_DFS_DOMAIN = 3, | ||
2190 | }; | ||
2191 | |||
2192 | struct wmi_pdev_set_regdomain_cmd_10x { | ||
2193 | __le32 reg_domain; | ||
2194 | __le32 reg_domain_2G; | ||
2195 | __le32 reg_domain_5G; | ||
2196 | __le32 conformance_test_limit_2G; | ||
2197 | __le32 conformance_test_limit_5G; | ||
2198 | |||
2199 | /* dfs domain from wmi_dfs_region */ | ||
2200 | __le32 dfs_domain; | ||
2201 | } __packed; | ||
2202 | |||
2188 | /* Command to set/unset chip in quiet mode */ | 2203 | /* Command to set/unset chip in quiet mode */ |
2189 | struct wmi_pdev_set_quiet_cmd { | 2204 | struct wmi_pdev_set_quiet_cmd { |
2190 | /* period in TUs */ | 2205 | /* period in TUs */ |
@@ -2210,6 +2225,19 @@ enum ath10k_protmode { | |||
2210 | ATH10K_PROT_RTSCTS = 2, /* RTS-CTS */ | 2225 | ATH10K_PROT_RTSCTS = 2, /* RTS-CTS */ |
2211 | }; | 2226 | }; |
2212 | 2227 | ||
2228 | enum wmi_rtscts_profile { | ||
2229 | WMI_RTSCTS_FOR_NO_RATESERIES = 0, | ||
2230 | WMI_RTSCTS_FOR_SECOND_RATESERIES, | ||
2231 | WMI_RTSCTS_ACROSS_SW_RETRIES | ||
2232 | }; | ||
2233 | |||
2234 | #define WMI_RTSCTS_ENABLED 1 | ||
2235 | #define WMI_RTSCTS_SET_MASK 0x0f | ||
2236 | #define WMI_RTSCTS_SET_LSB 0 | ||
2237 | |||
2238 | #define WMI_RTSCTS_PROFILE_MASK 0xf0 | ||
2239 | #define WMI_RTSCTS_PROFILE_LSB 4 | ||
2240 | |||
2213 | enum wmi_beacon_gen_mode { | 2241 | enum wmi_beacon_gen_mode { |
2214 | WMI_BEACON_STAGGERED_MODE = 0, | 2242 | WMI_BEACON_STAGGERED_MODE = 0, |
2215 | WMI_BEACON_BURST_MODE = 1 | 2243 | WMI_BEACON_BURST_MODE = 1 |
@@ -2295,9 +2323,9 @@ struct wmi_pdev_param_map { | |||
2295 | #define WMI_PDEV_PARAM_UNSUPPORTED 0 | 2323 | #define WMI_PDEV_PARAM_UNSUPPORTED 0 |
2296 | 2324 | ||
2297 | enum wmi_pdev_param { | 2325 | enum wmi_pdev_param { |
2298 | /* TX chian mask */ | 2326 | /* TX chain mask */ |
2299 | WMI_PDEV_PARAM_TX_CHAIN_MASK = 0x1, | 2327 | WMI_PDEV_PARAM_TX_CHAIN_MASK = 0x1, |
2300 | /* RX chian mask */ | 2328 | /* RX chain mask */ |
2301 | WMI_PDEV_PARAM_RX_CHAIN_MASK, | 2329 | WMI_PDEV_PARAM_RX_CHAIN_MASK, |
2302 | /* TX power limit for 2G Radio */ | 2330 | /* TX power limit for 2G Radio */ |
2303 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G, | 2331 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G, |
@@ -2682,6 +2710,9 @@ struct wal_dbg_tx_stats { | |||
2682 | /* wal pdev resets */ | 2710 | /* wal pdev resets */ |
2683 | __le32 pdev_resets; | 2711 | __le32 pdev_resets; |
2684 | 2712 | ||
2713 | /* frames dropped due to non-availability of stateless TIDs */ | ||
2714 | __le32 stateless_tid_alloc_failure; | ||
2715 | |||
2685 | __le32 phy_underrun; | 2716 | __le32 phy_underrun; |
2686 | 2717 | ||
2687 | /* MPDU is more than txop limit */ | 2718 | /* MPDU is more than txop limit */ |
@@ -2738,13 +2769,21 @@ enum wmi_stats_id { | |||
2738 | WMI_REQUEST_AP_STAT = 0x02 | 2769 | WMI_REQUEST_AP_STAT = 0x02 |
2739 | }; | 2770 | }; |
2740 | 2771 | ||
2772 | struct wlan_inst_rssi_args { | ||
2773 | __le16 cfg_retry_count; | ||
2774 | __le16 retry_count; | ||
2775 | }; | ||
2776 | |||
2741 | struct wmi_request_stats_cmd { | 2777 | struct wmi_request_stats_cmd { |
2742 | __le32 stats_id; | 2778 | __le32 stats_id; |
2743 | 2779 | ||
2744 | /* | 2780 | __le32 vdev_id; |
2745 | * Space to add parameters like | 2781 | |
2746 | * peer mac addr | 2782 | /* peer MAC address */ |
2747 | */ | 2783 | struct wmi_mac_addr peer_macaddr; |
2784 | |||
2785 | /* Instantaneous RSSI arguments */ | ||
2786 | struct wlan_inst_rssi_args inst_rssi_args; | ||
2748 | } __packed; | 2787 | } __packed; |
2749 | 2788 | ||
2750 | /* Suspend option */ | 2789 | /* Suspend option */ |
@@ -2795,7 +2834,18 @@ struct wmi_stats_event { | |||
2795 | * PDEV statistics | 2834 | * PDEV statistics |
2796 | * TODO: add all PDEV stats here | 2835 | * TODO: add all PDEV stats here |
2797 | */ | 2836 | */ |
2798 | struct wmi_pdev_stats { | 2837 | struct wmi_pdev_stats_old { |
2838 | __le32 chan_nf; /* Channel noise floor */ | ||
2839 | __le32 tx_frame_count; /* TX frame count */ | ||
2840 | __le32 rx_frame_count; /* RX frame count */ | ||
2841 | __le32 rx_clear_count; /* rx clear count */ | ||
2842 | __le32 cycle_count; /* cycle count */ | ||
2843 | __le32 phy_err_count; /* Phy error count */ | ||
2844 | __le32 chan_tx_pwr; /* channel tx power */ | ||
2845 | struct wal_dbg_stats wal; /* WAL dbg stats */ | ||
2846 | } __packed; | ||
2847 | |||
2848 | struct wmi_pdev_stats_10x { | ||
2799 | __le32 chan_nf; /* Channel noise floor */ | 2849 | __le32 chan_nf; /* Channel noise floor */ |
2800 | __le32 tx_frame_count; /* TX frame count */ | 2850 | __le32 tx_frame_count; /* TX frame count */ |
2801 | __le32 rx_frame_count; /* RX frame count */ | 2851 | __le32 rx_frame_count; /* RX frame count */ |
@@ -2804,6 +2854,12 @@ struct wmi_pdev_stats { | |||
2804 | __le32 phy_err_count; /* Phy error count */ | 2854 | __le32 phy_err_count; /* Phy error count */ |
2805 | __le32 chan_tx_pwr; /* channel tx power */ | 2855 | __le32 chan_tx_pwr; /* channel tx power */ |
2806 | struct wal_dbg_stats wal; /* WAL dbg stats */ | 2856 | struct wal_dbg_stats wal; /* WAL dbg stats */ |
2857 | __le32 ack_rx_bad; | ||
2858 | __le32 rts_bad; | ||
2859 | __le32 rts_good; | ||
2860 | __le32 fcs_bad; | ||
2861 | __le32 no_beacons; | ||
2862 | __le32 mib_int_count; | ||
2807 | } __packed; | 2863 | } __packed; |
2808 | 2864 | ||
2809 | /* | 2865 | /* |
@@ -2818,10 +2874,17 @@ struct wmi_vdev_stats { | |||
2818 | * peer statistics. | 2874 | * peer statistics. |
2819 | * TODO: add more stats | 2875 | * TODO: add more stats |
2820 | */ | 2876 | */ |
2821 | struct wmi_peer_stats { | 2877 | struct wmi_peer_stats_old { |
2878 | struct wmi_mac_addr peer_macaddr; | ||
2879 | __le32 peer_rssi; | ||
2880 | __le32 peer_tx_rate; | ||
2881 | } __packed; | ||
2882 | |||
2883 | struct wmi_peer_stats_10x { | ||
2822 | struct wmi_mac_addr peer_macaddr; | 2884 | struct wmi_mac_addr peer_macaddr; |
2823 | __le32 peer_rssi; | 2885 | __le32 peer_rssi; |
2824 | __le32 peer_tx_rate; | 2886 | __le32 peer_tx_rate; |
2887 | __le32 peer_rx_rate; | ||
2825 | } __packed; | 2888 | } __packed; |
2826 | 2889 | ||
2827 | struct wmi_vdev_create_cmd { | 2890 | struct wmi_vdev_create_cmd { |
@@ -4196,13 +4259,14 @@ void ath10k_wmi_detach(struct ath10k *ar); | |||
4196 | int ath10k_wmi_wait_for_service_ready(struct ath10k *ar); | 4259 | int ath10k_wmi_wait_for_service_ready(struct ath10k *ar); |
4197 | int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar); | 4260 | int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar); |
4198 | 4261 | ||
4199 | int ath10k_wmi_connect_htc_service(struct ath10k *ar); | 4262 | int ath10k_wmi_connect(struct ath10k *ar); |
4200 | int ath10k_wmi_pdev_set_channel(struct ath10k *ar, | 4263 | int ath10k_wmi_pdev_set_channel(struct ath10k *ar, |
4201 | const struct wmi_channel_arg *); | 4264 | const struct wmi_channel_arg *); |
4202 | int ath10k_wmi_pdev_suspend_target(struct ath10k *ar, u32 suspend_opt); | 4265 | int ath10k_wmi_pdev_suspend_target(struct ath10k *ar, u32 suspend_opt); |
4203 | int ath10k_wmi_pdev_resume_target(struct ath10k *ar); | 4266 | int ath10k_wmi_pdev_resume_target(struct ath10k *ar); |
4204 | int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g, | 4267 | int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g, |
4205 | u16 rd5g, u16 ctl2g, u16 ctl5g); | 4268 | u16 rd5g, u16 ctl2g, u16 ctl5g, |
4269 | enum wmi_dfs_region dfs_reg); | ||
4206 | int ath10k_wmi_pdev_set_param(struct ath10k *ar, u32 id, u32 value); | 4270 | int ath10k_wmi_pdev_set_param(struct ath10k *ar, u32 id, u32 value); |
4207 | int ath10k_wmi_cmd_init(struct ath10k *ar); | 4271 | int ath10k_wmi_cmd_init(struct ath10k *ar); |
4208 | int ath10k_wmi_start_scan(struct ath10k *ar, const struct wmi_start_scan_arg *); | 4272 | int ath10k_wmi_start_scan(struct ath10k *ar, const struct wmi_start_scan_arg *); |
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 1a2973b7acf2..0fce1c76638e 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
@@ -3709,8 +3709,8 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, | |||
3709 | AR5K_REG_MS(AR5K_TUNE_MAX_TXPOWER, AR5K_TPC_CHIRP), | 3709 | AR5K_REG_MS(AR5K_TUNE_MAX_TXPOWER, AR5K_TPC_CHIRP), |
3710 | AR5K_TPC); | 3710 | AR5K_TPC); |
3711 | } else { | 3711 | } else { |
3712 | ath5k_hw_reg_write(ah, AR5K_PHY_TXPOWER_RATE_MAX | | 3712 | ath5k_hw_reg_write(ah, AR5K_TUNE_MAX_TXPOWER, |
3713 | AR5K_TUNE_MAX_TXPOWER, AR5K_PHY_TXPOWER_RATE_MAX); | 3713 | AR5K_PHY_TXPOWER_RATE_MAX); |
3714 | } | 3714 | } |
3715 | 3715 | ||
3716 | return 0; | 3716 | return 0; |
diff --git a/drivers/net/wireless/ath/ath6kl/Kconfig b/drivers/net/wireless/ath/ath6kl/Kconfig index e39e5860a2e9..9c125ff083f7 100644 --- a/drivers/net/wireless/ath/ath6kl/Kconfig +++ b/drivers/net/wireless/ath/ath6kl/Kconfig | |||
@@ -1,11 +1,19 @@ | |||
1 | config ATH6KL | 1 | config ATH6KL |
2 | tristate "Atheros mobile chipsets support" | 2 | tristate "Atheros mobile chipsets support" |
3 | depends on CFG80211 | ||
4 | ---help--- | ||
5 | This module adds core support for wireless adapters based on | ||
6 | Atheros AR6003 and AR6004 chipsets. You still need separate | ||
7 | bus drivers for USB and SDIO to be able to use real devices. | ||
8 | |||
9 | If you choose to build it as a module, it will be called | ||
10 | ath6kl_core. Please note that AR6002 and AR6001 are not | ||
11 | supported by this driver. | ||
3 | 12 | ||
4 | config ATH6KL_SDIO | 13 | config ATH6KL_SDIO |
5 | tristate "Atheros ath6kl SDIO support" | 14 | tristate "Atheros ath6kl SDIO support" |
6 | depends on ATH6KL | 15 | depends on ATH6KL |
7 | depends on MMC | 16 | depends on MMC |
8 | depends on CFG80211 | ||
9 | ---help--- | 17 | ---help--- |
10 | This module adds support for wireless adapters based on | 18 | This module adds support for wireless adapters based on |
11 | Atheros AR6003 and AR6004 chipsets running over SDIO. If you | 19 | Atheros AR6003 and AR6004 chipsets running over SDIO. If you |
@@ -17,25 +25,31 @@ config ATH6KL_USB | |||
17 | tristate "Atheros ath6kl USB support" | 25 | tristate "Atheros ath6kl USB support" |
18 | depends on ATH6KL | 26 | depends on ATH6KL |
19 | depends on USB | 27 | depends on USB |
20 | depends on CFG80211 | ||
21 | ---help--- | 28 | ---help--- |
22 | This module adds support for wireless adapters based on | 29 | This module adds support for wireless adapters based on |
23 | Atheros AR6004 chipset running over USB. This is still under | 30 | Atheros AR6004 chipset and chipsets based on it running over |
24 | implementation and it isn't functional. If you choose to | 31 | USB. If you choose to build it as a module, it will be |
25 | build it as a module, it will be called ath6kl_usb. | 32 | called ath6kl_usb. |
26 | 33 | ||
27 | config ATH6KL_DEBUG | 34 | config ATH6KL_DEBUG |
28 | bool "Atheros ath6kl debugging" | 35 | bool "Atheros ath6kl debugging" |
29 | depends on ATH6KL | 36 | depends on ATH6KL |
30 | ---help--- | 37 | ---help--- |
31 | Enables debug support | 38 | Enables ath6kl debug support, including debug messages |
39 | enabled with debug_mask module parameter and debugfs | ||
40 | interface. | ||
41 | |||
42 | If unsure, say Y to make it easier to debug problems. | ||
32 | 43 | ||
33 | config ATH6KL_TRACING | 44 | config ATH6KL_TRACING |
34 | bool "Atheros ath6kl tracing support" | 45 | bool "Atheros ath6kl tracing support" |
35 | depends on ATH6KL | 46 | depends on ATH6KL |
36 | depends on EVENT_TRACING | 47 | depends on EVENT_TRACING |
37 | ---help--- | 48 | ---help--- |
38 | Select this to ath6kl use tracing infrastructure. | 49 | Select this to ath6kl use tracing infrastructure which, for |
50 | example, can be enabled with help of trace-cmd. All debug | ||
51 | messages and commands are delivered to using individually | ||
52 | enablable trace points. | ||
39 | 53 | ||
40 | If unsure, say Y to make it easier to debug problems. | 54 | If unsure, say Y to make it easier to debug problems. |
41 | 55 | ||
@@ -47,3 +61,5 @@ config ATH6KL_REGDOMAIN | |||
47 | Enabling this makes it possible to change the regdomain in | 61 | Enabling this makes it possible to change the regdomain in |
48 | the firmware. This can be only enabled if regulatory requirements | 62 | the firmware. This can be only enabled if regulatory requirements |
49 | are taken into account. | 63 | are taken into account. |
64 | |||
65 | If unsure, say N. | ||
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index c2c6f4604958..0e26f4a34fda 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c | |||
@@ -724,8 +724,9 @@ ath6kl_add_bss_if_needed(struct ath6kl_vif *vif, | |||
724 | ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, | 724 | ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, |
725 | "added bss %pM to cfg80211\n", bssid); | 725 | "added bss %pM to cfg80211\n", bssid); |
726 | kfree(ie); | 726 | kfree(ie); |
727 | } else | 727 | } else { |
728 | ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "cfg80211 already has a bss\n"); | 728 | ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "cfg80211 already has a bss\n"); |
729 | } | ||
729 | 730 | ||
730 | return bss; | 731 | return bss; |
731 | } | 732 | } |
@@ -970,7 +971,6 @@ static int ath6kl_set_probed_ssids(struct ath6kl *ar, | |||
970 | ssid_list[i].flag, | 971 | ssid_list[i].flag, |
971 | ssid_list[i].ssid.ssid_len, | 972 | ssid_list[i].ssid.ssid_len, |
972 | ssid_list[i].ssid.ssid); | 973 | ssid_list[i].ssid.ssid); |
973 | |||
974 | } | 974 | } |
975 | 975 | ||
976 | /* Make sure no old entries are left behind */ | 976 | /* Make sure no old entries are left behind */ |
@@ -1759,7 +1759,7 @@ static bool is_rate_ht40(s32 rate, u8 *mcs, bool *sgi) | |||
1759 | } | 1759 | } |
1760 | 1760 | ||
1761 | static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, | 1761 | static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, |
1762 | u8 *mac, struct station_info *sinfo) | 1762 | const u8 *mac, struct station_info *sinfo) |
1763 | { | 1763 | { |
1764 | struct ath6kl *ar = ath6kl_priv(dev); | 1764 | struct ath6kl *ar = ath6kl_priv(dev); |
1765 | struct ath6kl_vif *vif = netdev_priv(dev); | 1765 | struct ath6kl_vif *vif = netdev_priv(dev); |
@@ -1897,7 +1897,6 @@ static int ath6kl_wow_usr(struct ath6kl *ar, struct ath6kl_vif *vif, | |||
1897 | 1897 | ||
1898 | /* Configure the patterns that we received from the user. */ | 1898 | /* Configure the patterns that we received from the user. */ |
1899 | for (i = 0; i < wow->n_patterns; i++) { | 1899 | for (i = 0; i < wow->n_patterns; i++) { |
1900 | |||
1901 | /* | 1900 | /* |
1902 | * Convert given nl80211 specific mask value to equivalent | 1901 | * Convert given nl80211 specific mask value to equivalent |
1903 | * driver specific mask value and send it to the chip along | 1902 | * driver specific mask value and send it to the chip along |
@@ -2850,8 +2849,9 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev, | |||
2850 | if (p.prwise_crypto_type == 0) { | 2849 | if (p.prwise_crypto_type == 0) { |
2851 | p.prwise_crypto_type = NONE_CRYPT; | 2850 | p.prwise_crypto_type = NONE_CRYPT; |
2852 | ath6kl_set_cipher(vif, 0, true); | 2851 | ath6kl_set_cipher(vif, 0, true); |
2853 | } else if (info->crypto.n_ciphers_pairwise == 1) | 2852 | } else if (info->crypto.n_ciphers_pairwise == 1) { |
2854 | ath6kl_set_cipher(vif, info->crypto.ciphers_pairwise[0], true); | 2853 | ath6kl_set_cipher(vif, info->crypto.ciphers_pairwise[0], true); |
2854 | } | ||
2855 | 2855 | ||
2856 | switch (info->crypto.cipher_group) { | 2856 | switch (info->crypto.cipher_group) { |
2857 | case WLAN_CIPHER_SUITE_WEP40: | 2857 | case WLAN_CIPHER_SUITE_WEP40: |
@@ -2897,7 +2897,6 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev, | |||
2897 | } | 2897 | } |
2898 | 2898 | ||
2899 | if (info->inactivity_timeout) { | 2899 | if (info->inactivity_timeout) { |
2900 | |||
2901 | inactivity_timeout = info->inactivity_timeout; | 2900 | inactivity_timeout = info->inactivity_timeout; |
2902 | 2901 | ||
2903 | if (ar->hw.flags & ATH6KL_HW_AP_INACTIVITY_MINS) | 2902 | if (ar->hw.flags & ATH6KL_HW_AP_INACTIVITY_MINS) |
@@ -2975,7 +2974,7 @@ static int ath6kl_stop_ap(struct wiphy *wiphy, struct net_device *dev) | |||
2975 | static const u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | 2974 | static const u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
2976 | 2975 | ||
2977 | static int ath6kl_del_station(struct wiphy *wiphy, struct net_device *dev, | 2976 | static int ath6kl_del_station(struct wiphy *wiphy, struct net_device *dev, |
2978 | u8 *mac) | 2977 | const u8 *mac) |
2979 | { | 2978 | { |
2980 | struct ath6kl *ar = ath6kl_priv(dev); | 2979 | struct ath6kl *ar = ath6kl_priv(dev); |
2981 | struct ath6kl_vif *vif = netdev_priv(dev); | 2980 | struct ath6kl_vif *vif = netdev_priv(dev); |
@@ -2986,7 +2985,8 @@ static int ath6kl_del_station(struct wiphy *wiphy, struct net_device *dev, | |||
2986 | } | 2985 | } |
2987 | 2986 | ||
2988 | static int ath6kl_change_station(struct wiphy *wiphy, struct net_device *dev, | 2987 | static int ath6kl_change_station(struct wiphy *wiphy, struct net_device *dev, |
2989 | u8 *mac, struct station_parameters *params) | 2988 | const u8 *mac, |
2989 | struct station_parameters *params) | ||
2990 | { | 2990 | { |
2991 | struct ath6kl *ar = ath6kl_priv(dev); | 2991 | struct ath6kl *ar = ath6kl_priv(dev); |
2992 | struct ath6kl_vif *vif = netdev_priv(dev); | 2992 | struct ath6kl_vif *vif = netdev_priv(dev); |
diff --git a/drivers/net/wireless/ath/ath6kl/core.c b/drivers/net/wireless/ath/ath6kl/core.c index 4b46adbe8c92..b0b652042760 100644 --- a/drivers/net/wireless/ath/ath6kl/core.c +++ b/drivers/net/wireless/ath/ath6kl/core.c | |||
@@ -45,9 +45,9 @@ module_param(testmode, uint, 0644); | |||
45 | module_param(recovery_enable, uint, 0644); | 45 | module_param(recovery_enable, uint, 0644); |
46 | module_param(heart_beat_poll, uint, 0644); | 46 | module_param(heart_beat_poll, uint, 0644); |
47 | MODULE_PARM_DESC(recovery_enable, "Enable recovery from firmware error"); | 47 | MODULE_PARM_DESC(recovery_enable, "Enable recovery from firmware error"); |
48 | MODULE_PARM_DESC(heart_beat_poll, "Enable fw error detection periodic" \ | 48 | MODULE_PARM_DESC(heart_beat_poll, |
49 | "polling. This also specifies the polling interval in" \ | 49 | "Enable fw error detection periodic polling in msecs - Also set recovery_enable for this to be effective"); |
50 | "msecs. Set reocvery_enable for this to be effective"); | 50 | |
51 | 51 | ||
52 | void ath6kl_core_tx_complete(struct ath6kl *ar, struct sk_buff *skb) | 52 | void ath6kl_core_tx_complete(struct ath6kl *ar, struct sk_buff *skb) |
53 | { | 53 | { |
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index dbfd17d0a5fa..55c4064dd506 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c | |||
@@ -172,7 +172,6 @@ void ath6kl_dump_registers(struct ath6kl_device *dev, | |||
172 | struct ath6kl_irq_proc_registers *irq_proc_reg, | 172 | struct ath6kl_irq_proc_registers *irq_proc_reg, |
173 | struct ath6kl_irq_enable_reg *irq_enable_reg) | 173 | struct ath6kl_irq_enable_reg *irq_enable_reg) |
174 | { | 174 | { |
175 | |||
176 | ath6kl_dbg(ATH6KL_DBG_IRQ, ("<------- Register Table -------->\n")); | 175 | ath6kl_dbg(ATH6KL_DBG_IRQ, ("<------- Register Table -------->\n")); |
177 | 176 | ||
178 | if (irq_proc_reg != NULL) { | 177 | if (irq_proc_reg != NULL) { |
@@ -219,7 +218,6 @@ void ath6kl_dump_registers(struct ath6kl_device *dev, | |||
219 | "GMBOX lookahead alias 1: 0x%x\n", | 218 | "GMBOX lookahead alias 1: 0x%x\n", |
220 | irq_proc_reg->rx_gmbox_lkahd_alias[1]); | 219 | irq_proc_reg->rx_gmbox_lkahd_alias[1]); |
221 | } | 220 | } |
222 | |||
223 | } | 221 | } |
224 | 222 | ||
225 | if (irq_enable_reg != NULL) { | 223 | if (irq_enable_reg != NULL) { |
@@ -1396,7 +1394,6 @@ static ssize_t ath6kl_create_qos_write(struct file *file, | |||
1396 | const char __user *user_buf, | 1394 | const char __user *user_buf, |
1397 | size_t count, loff_t *ppos) | 1395 | size_t count, loff_t *ppos) |
1398 | { | 1396 | { |
1399 | |||
1400 | struct ath6kl *ar = file->private_data; | 1397 | struct ath6kl *ar = file->private_data; |
1401 | struct ath6kl_vif *vif; | 1398 | struct ath6kl_vif *vif; |
1402 | char buf[200]; | 1399 | char buf[200]; |
@@ -1575,7 +1572,6 @@ static ssize_t ath6kl_delete_qos_write(struct file *file, | |||
1575 | const char __user *user_buf, | 1572 | const char __user *user_buf, |
1576 | size_t count, loff_t *ppos) | 1573 | size_t count, loff_t *ppos) |
1577 | { | 1574 | { |
1578 | |||
1579 | struct ath6kl *ar = file->private_data; | 1575 | struct ath6kl *ar = file->private_data; |
1580 | struct ath6kl_vif *vif; | 1576 | struct ath6kl_vif *vif; |
1581 | char buf[100]; | 1577 | char buf[100]; |
diff --git a/drivers/net/wireless/ath/ath6kl/debug.h b/drivers/net/wireless/ath/ath6kl/debug.h index ca9ba005f287..e194c10d9f00 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.h +++ b/drivers/net/wireless/ath/ath6kl/debug.h | |||
@@ -97,8 +97,8 @@ static inline void ath6kl_dump_registers(struct ath6kl_device *dev, | |||
97 | struct ath6kl_irq_proc_registers *irq_proc_reg, | 97 | struct ath6kl_irq_proc_registers *irq_proc_reg, |
98 | struct ath6kl_irq_enable_reg *irq_en_reg) | 98 | struct ath6kl_irq_enable_reg *irq_en_reg) |
99 | { | 99 | { |
100 | |||
101 | } | 100 | } |
101 | |||
102 | static inline void dump_cred_dist_stats(struct htc_target *target) | 102 | static inline void dump_cred_dist_stats(struct htc_target *target) |
103 | { | 103 | { |
104 | } | 104 | } |
diff --git a/drivers/net/wireless/ath/ath6kl/hif.c b/drivers/net/wireless/ath/ath6kl/hif.c index fea7709b5dda..18c070850a09 100644 --- a/drivers/net/wireless/ath/ath6kl/hif.c +++ b/drivers/net/wireless/ath/ath6kl/hif.c | |||
@@ -37,7 +37,6 @@ static int ath6kl_hif_cp_scat_dma_buf(struct hif_scatter_req *req, | |||
37 | buf = req->virt_dma_buf; | 37 | buf = req->virt_dma_buf; |
38 | 38 | ||
39 | for (i = 0; i < req->scat_entries; i++) { | 39 | for (i = 0; i < req->scat_entries; i++) { |
40 | |||
41 | if (from_dma) | 40 | if (from_dma) |
42 | memcpy(req->scat_list[i].buf, buf, | 41 | memcpy(req->scat_list[i].buf, buf, |
43 | req->scat_list[i].len); | 42 | req->scat_list[i].len); |
@@ -116,7 +115,6 @@ static void ath6kl_hif_dump_fw_crash(struct ath6kl *ar) | |||
116 | le32_to_cpu(regdump_val[i + 2]), | 115 | le32_to_cpu(regdump_val[i + 2]), |
117 | le32_to_cpu(regdump_val[i + 3])); | 116 | le32_to_cpu(regdump_val[i + 3])); |
118 | } | 117 | } |
119 | |||
120 | } | 118 | } |
121 | 119 | ||
122 | static int ath6kl_hif_proc_dbg_intr(struct ath6kl_device *dev) | 120 | static int ath6kl_hif_proc_dbg_intr(struct ath6kl_device *dev) |
@@ -701,5 +699,4 @@ int ath6kl_hif_setup(struct ath6kl_device *dev) | |||
701 | 699 | ||
702 | fail_setup: | 700 | fail_setup: |
703 | return status; | 701 | return status; |
704 | |||
705 | } | 702 | } |
diff --git a/drivers/net/wireless/ath/ath6kl/hif.h b/drivers/net/wireless/ath/ath6kl/hif.h index 61f6b21fb0ae..dc6bd8cd9b83 100644 --- a/drivers/net/wireless/ath/ath6kl/hif.h +++ b/drivers/net/wireless/ath/ath6kl/hif.h | |||
@@ -197,9 +197,9 @@ struct hif_scatter_req { | |||
197 | /* bounce buffer for upper layers to copy to/from */ | 197 | /* bounce buffer for upper layers to copy to/from */ |
198 | u8 *virt_dma_buf; | 198 | u8 *virt_dma_buf; |
199 | 199 | ||
200 | struct hif_scatter_item scat_list[1]; | ||
201 | |||
202 | u32 scat_q_depth; | 200 | u32 scat_q_depth; |
201 | |||
202 | struct hif_scatter_item scat_list[0]; | ||
203 | }; | 203 | }; |
204 | 204 | ||
205 | struct ath6kl_irq_proc_registers { | 205 | struct ath6kl_irq_proc_registers { |
diff --git a/drivers/net/wireless/ath/ath6kl/htc_mbox.c b/drivers/net/wireless/ath/ath6kl/htc_mbox.c index 65e5b719093d..e481f14b9878 100644 --- a/drivers/net/wireless/ath/ath6kl/htc_mbox.c +++ b/drivers/net/wireless/ath/ath6kl/htc_mbox.c | |||
@@ -112,9 +112,9 @@ static void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_info, | |||
112 | if (cur_ep_dist->endpoint == ENDPOINT_0) | 112 | if (cur_ep_dist->endpoint == ENDPOINT_0) |
113 | continue; | 113 | continue; |
114 | 114 | ||
115 | if (cur_ep_dist->svc_id == WMI_CONTROL_SVC) | 115 | if (cur_ep_dist->svc_id == WMI_CONTROL_SVC) { |
116 | cur_ep_dist->cred_norm = cur_ep_dist->cred_per_msg; | 116 | cur_ep_dist->cred_norm = cur_ep_dist->cred_per_msg; |
117 | else { | 117 | } else { |
118 | /* | 118 | /* |
119 | * For the remaining data endpoints, we assume that | 119 | * For the remaining data endpoints, we assume that |
120 | * each cred_per_msg are the same. We use a simple | 120 | * each cred_per_msg are the same. We use a simple |
@@ -129,7 +129,6 @@ static void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_info, | |||
129 | count = (count * 3) >> 2; | 129 | count = (count * 3) >> 2; |
130 | count = max(count, cur_ep_dist->cred_per_msg); | 130 | count = max(count, cur_ep_dist->cred_per_msg); |
131 | cur_ep_dist->cred_norm = count; | 131 | cur_ep_dist->cred_norm = count; |
132 | |||
133 | } | 132 | } |
134 | 133 | ||
135 | ath6kl_dbg(ATH6KL_DBG_CREDIT, | 134 | ath6kl_dbg(ATH6KL_DBG_CREDIT, |
@@ -549,7 +548,6 @@ static int htc_check_credits(struct htc_target *target, | |||
549 | enum htc_endpoint_id eid, unsigned int len, | 548 | enum htc_endpoint_id eid, unsigned int len, |
550 | int *req_cred) | 549 | int *req_cred) |
551 | { | 550 | { |
552 | |||
553 | *req_cred = (len > target->tgt_cred_sz) ? | 551 | *req_cred = (len > target->tgt_cred_sz) ? |
554 | DIV_ROUND_UP(len, target->tgt_cred_sz) : 1; | 552 | DIV_ROUND_UP(len, target->tgt_cred_sz) : 1; |
555 | 553 | ||
@@ -608,7 +606,6 @@ static void ath6kl_htc_tx_pkts_get(struct htc_target *target, | |||
608 | unsigned int len; | 606 | unsigned int len; |
609 | 607 | ||
610 | while (true) { | 608 | while (true) { |
611 | |||
612 | flags = 0; | 609 | flags = 0; |
613 | 610 | ||
614 | if (list_empty(&endpoint->txq)) | 611 | if (list_empty(&endpoint->txq)) |
@@ -889,7 +886,6 @@ static void ath6kl_htc_tx_from_queue(struct htc_target *target, | |||
889 | ac = target->dev->ar->ep2ac_map[endpoint->eid]; | 886 | ac = target->dev->ar->ep2ac_map[endpoint->eid]; |
890 | 887 | ||
891 | while (true) { | 888 | while (true) { |
892 | |||
893 | if (list_empty(&endpoint->txq)) | 889 | if (list_empty(&endpoint->txq)) |
894 | break; | 890 | break; |
895 | 891 | ||
@@ -1190,7 +1186,6 @@ static void ath6kl_htc_mbox_flush_txep(struct htc_target *target, | |||
1190 | list_add_tail(&packet->list, &container); | 1186 | list_add_tail(&packet->list, &container); |
1191 | htc_tx_complete(endpoint, &container); | 1187 | htc_tx_complete(endpoint, &container); |
1192 | } | 1188 | } |
1193 | |||
1194 | } | 1189 | } |
1195 | 1190 | ||
1196 | static void ath6kl_htc_flush_txep_all(struct htc_target *target) | 1191 | static void ath6kl_htc_flush_txep_all(struct htc_target *target) |
@@ -1394,7 +1389,6 @@ static int ath6kl_htc_rx_setup(struct htc_target *target, | |||
1394 | 1389 | ||
1395 | ep_cb = ep->ep_cb; | 1390 | ep_cb = ep->ep_cb; |
1396 | for (j = 0; j < n_msg; j++) { | 1391 | for (j = 0; j < n_msg; j++) { |
1397 | |||
1398 | /* | 1392 | /* |
1399 | * Reset flag, any packets allocated using the | 1393 | * Reset flag, any packets allocated using the |
1400 | * rx_alloc() API cannot be recycled on | 1394 | * rx_alloc() API cannot be recycled on |
@@ -1424,9 +1418,9 @@ static int ath6kl_htc_rx_setup(struct htc_target *target, | |||
1424 | } | 1418 | } |
1425 | } | 1419 | } |
1426 | 1420 | ||
1427 | if (list_empty(&ep->rx_bufq)) | 1421 | if (list_empty(&ep->rx_bufq)) { |
1428 | packet = NULL; | 1422 | packet = NULL; |
1429 | else { | 1423 | } else { |
1430 | packet = list_first_entry(&ep->rx_bufq, | 1424 | packet = list_first_entry(&ep->rx_bufq, |
1431 | struct htc_packet, list); | 1425 | struct htc_packet, list); |
1432 | list_del(&packet->list); | 1426 | list_del(&packet->list); |
@@ -1487,7 +1481,6 @@ static int ath6kl_htc_rx_alloc(struct htc_target *target, | |||
1487 | spin_lock_bh(&target->rx_lock); | 1481 | spin_lock_bh(&target->rx_lock); |
1488 | 1482 | ||
1489 | for (i = 0; i < msg; i++) { | 1483 | for (i = 0; i < msg; i++) { |
1490 | |||
1491 | htc_hdr = (struct htc_frame_hdr *)&lk_ahds[i]; | 1484 | htc_hdr = (struct htc_frame_hdr *)&lk_ahds[i]; |
1492 | 1485 | ||
1493 | if (htc_hdr->eid >= ENDPOINT_MAX) { | 1486 | if (htc_hdr->eid >= ENDPOINT_MAX) { |
@@ -1708,7 +1701,6 @@ static int htc_parse_trailer(struct htc_target *target, | |||
1708 | lk_ahd = (struct htc_lookahead_report *) record_buf; | 1701 | lk_ahd = (struct htc_lookahead_report *) record_buf; |
1709 | if ((lk_ahd->pre_valid == ((~lk_ahd->post_valid) & 0xFF)) && | 1702 | if ((lk_ahd->pre_valid == ((~lk_ahd->post_valid) & 0xFF)) && |
1710 | next_lk_ahds) { | 1703 | next_lk_ahds) { |
1711 | |||
1712 | ath6kl_dbg(ATH6KL_DBG_HTC, | 1704 | ath6kl_dbg(ATH6KL_DBG_HTC, |
1713 | "htc rx lk_ahd found pre_valid 0x%x post_valid 0x%x\n", | 1705 | "htc rx lk_ahd found pre_valid 0x%x post_valid 0x%x\n", |
1714 | lk_ahd->pre_valid, lk_ahd->post_valid); | 1706 | lk_ahd->pre_valid, lk_ahd->post_valid); |
@@ -1755,7 +1747,6 @@ static int htc_parse_trailer(struct htc_target *target, | |||
1755 | } | 1747 | } |
1756 | 1748 | ||
1757 | return 0; | 1749 | return 0; |
1758 | |||
1759 | } | 1750 | } |
1760 | 1751 | ||
1761 | static int htc_proc_trailer(struct htc_target *target, | 1752 | static int htc_proc_trailer(struct htc_target *target, |
@@ -1776,7 +1767,6 @@ static int htc_proc_trailer(struct htc_target *target, | |||
1776 | status = 0; | 1767 | status = 0; |
1777 | 1768 | ||
1778 | while (len > 0) { | 1769 | while (len > 0) { |
1779 | |||
1780 | if (len < sizeof(struct htc_record_hdr)) { | 1770 | if (len < sizeof(struct htc_record_hdr)) { |
1781 | status = -ENOMEM; | 1771 | status = -ENOMEM; |
1782 | break; | 1772 | break; |
@@ -2098,7 +2088,6 @@ static int ath6kl_htc_rx_fetch(struct htc_target *target, | |||
2098 | } | 2088 | } |
2099 | 2089 | ||
2100 | if (!fetched_pkts) { | 2090 | if (!fetched_pkts) { |
2101 | |||
2102 | packet = list_first_entry(rx_pktq, struct htc_packet, | 2091 | packet = list_first_entry(rx_pktq, struct htc_packet, |
2103 | list); | 2092 | list); |
2104 | 2093 | ||
@@ -2173,7 +2162,6 @@ int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target, | |||
2173 | look_aheads[0] = msg_look_ahead; | 2162 | look_aheads[0] = msg_look_ahead; |
2174 | 2163 | ||
2175 | while (true) { | 2164 | while (true) { |
2176 | |||
2177 | /* | 2165 | /* |
2178 | * First lookahead sets the expected endpoint IDs for all | 2166 | * First lookahead sets the expected endpoint IDs for all |
2179 | * packets in a bundle. | 2167 | * packets in a bundle. |
@@ -2825,8 +2813,9 @@ static int ath6kl_htc_reset(struct htc_target *target) | |||
2825 | packet->buf = packet->buf_start; | 2813 | packet->buf = packet->buf_start; |
2826 | packet->endpoint = ENDPOINT_0; | 2814 | packet->endpoint = ENDPOINT_0; |
2827 | list_add_tail(&packet->list, &target->free_ctrl_rxbuf); | 2815 | list_add_tail(&packet->list, &target->free_ctrl_rxbuf); |
2828 | } else | 2816 | } else { |
2829 | list_add_tail(&packet->list, &target->free_ctrl_txbuf); | 2817 | list_add_tail(&packet->list, &target->free_ctrl_txbuf); |
2818 | } | ||
2830 | } | 2819 | } |
2831 | 2820 | ||
2832 | return 0; | 2821 | return 0; |
diff --git a/drivers/net/wireless/ath/ath6kl/htc_pipe.c b/drivers/net/wireless/ath/ath6kl/htc_pipe.c index 67aa924ed8b3..756fe52a12c8 100644 --- a/drivers/net/wireless/ath/ath6kl/htc_pipe.c +++ b/drivers/net/wireless/ath/ath6kl/htc_pipe.c | |||
@@ -137,7 +137,6 @@ static void get_htc_packet_credit_based(struct htc_target *target, | |||
137 | credits_required = 0; | 137 | credits_required = 0; |
138 | 138 | ||
139 | } else { | 139 | } else { |
140 | |||
141 | if (ep->cred_dist.credits < credits_required) | 140 | if (ep->cred_dist.credits < credits_required) |
142 | break; | 141 | break; |
143 | 142 | ||
@@ -169,7 +168,6 @@ static void get_htc_packet_credit_based(struct htc_target *target, | |||
169 | /* queue this packet into the caller's queue */ | 168 | /* queue this packet into the caller's queue */ |
170 | list_add_tail(&packet->list, queue); | 169 | list_add_tail(&packet->list, queue); |
171 | } | 170 | } |
172 | |||
173 | } | 171 | } |
174 | 172 | ||
175 | static void get_htc_packet(struct htc_target *target, | 173 | static void get_htc_packet(struct htc_target *target, |
@@ -279,7 +277,6 @@ static int htc_issue_packets(struct htc_target *target, | |||
279 | list_add(&packet->list, pkt_queue); | 277 | list_add(&packet->list, pkt_queue); |
280 | break; | 278 | break; |
281 | } | 279 | } |
282 | |||
283 | } | 280 | } |
284 | 281 | ||
285 | if (status != 0) { | 282 | if (status != 0) { |
@@ -385,7 +382,6 @@ static enum htc_send_queue_result htc_try_send(struct htc_target *target, | |||
385 | */ | 382 | */ |
386 | list_for_each_entry_safe(packet, tmp_pkt, | 383 | list_for_each_entry_safe(packet, tmp_pkt, |
387 | txq, list) { | 384 | txq, list) { |
388 | |||
389 | ath6kl_dbg(ATH6KL_DBG_HTC, | 385 | ath6kl_dbg(ATH6KL_DBG_HTC, |
390 | "%s: Indicat overflowed TX pkts: %p\n", | 386 | "%s: Indicat overflowed TX pkts: %p\n", |
391 | __func__, packet); | 387 | __func__, packet); |
@@ -403,7 +399,6 @@ static enum htc_send_queue_result htc_try_send(struct htc_target *target, | |||
403 | list_move_tail(&packet->list, | 399 | list_move_tail(&packet->list, |
404 | &send_queue); | 400 | &send_queue); |
405 | } | 401 | } |
406 | |||
407 | } | 402 | } |
408 | 403 | ||
409 | if (list_empty(&send_queue)) { | 404 | if (list_empty(&send_queue)) { |
@@ -454,7 +449,6 @@ static enum htc_send_queue_result htc_try_send(struct htc_target *target, | |||
454 | * enough transmit resources. | 449 | * enough transmit resources. |
455 | */ | 450 | */ |
456 | while (true) { | 451 | while (true) { |
457 | |||
458 | if (get_queue_depth(&ep->txq) == 0) | 452 | if (get_queue_depth(&ep->txq) == 0) |
459 | break; | 453 | break; |
460 | 454 | ||
@@ -495,8 +489,8 @@ static enum htc_send_queue_result htc_try_send(struct htc_target *target, | |||
495 | } | 489 | } |
496 | 490 | ||
497 | spin_lock_bh(&target->tx_lock); | 491 | spin_lock_bh(&target->tx_lock); |
498 | |||
499 | } | 492 | } |
493 | |||
500 | /* done with this endpoint, we can clear the count */ | 494 | /* done with this endpoint, we can clear the count */ |
501 | ep->tx_proc_cnt = 0; | 495 | ep->tx_proc_cnt = 0; |
502 | spin_unlock_bh(&target->tx_lock); | 496 | spin_unlock_bh(&target->tx_lock); |
@@ -1106,7 +1100,6 @@ free_skb: | |||
1106 | dev_kfree_skb(skb); | 1100 | dev_kfree_skb(skb); |
1107 | 1101 | ||
1108 | return status; | 1102 | return status; |
1109 | |||
1110 | } | 1103 | } |
1111 | 1104 | ||
1112 | static void htc_flush_rx_queue(struct htc_target *target, | 1105 | static void htc_flush_rx_queue(struct htc_target *target, |
@@ -1258,7 +1251,6 @@ static int ath6kl_htc_pipe_conn_service(struct htc_target *target, | |||
1258 | tx_alloc = 0; | 1251 | tx_alloc = 0; |
1259 | 1252 | ||
1260 | } else { | 1253 | } else { |
1261 | |||
1262 | tx_alloc = htc_get_credit_alloc(target, conn_req->svc_id); | 1254 | tx_alloc = htc_get_credit_alloc(target, conn_req->svc_id); |
1263 | if (tx_alloc == 0) { | 1255 | if (tx_alloc == 0) { |
1264 | status = -ENOMEM; | 1256 | status = -ENOMEM; |
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c index 4f316bdcbab5..d5ef211f261c 100644 --- a/drivers/net/wireless/ath/ath6kl/init.c +++ b/drivers/net/wireless/ath/ath6kl/init.c | |||
@@ -1192,7 +1192,6 @@ static int ath6kl_upload_board_file(struct ath6kl *ar) | |||
1192 | 1192 | ||
1193 | if (board_ext_address && | 1193 | if (board_ext_address && |
1194 | ar->fw_board_len == (board_data_size + board_ext_data_size)) { | 1194 | ar->fw_board_len == (board_data_size + board_ext_data_size)) { |
1195 | |||
1196 | /* write extended board data */ | 1195 | /* write extended board data */ |
1197 | ath6kl_dbg(ATH6KL_DBG_BOOT, | 1196 | ath6kl_dbg(ATH6KL_DBG_BOOT, |
1198 | "writing extended board data to 0x%x (%d B)\n", | 1197 | "writing extended board data to 0x%x (%d B)\n", |
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c index 5839fc23bdc7..d56554674da4 100644 --- a/drivers/net/wireless/ath/ath6kl/main.c +++ b/drivers/net/wireless/ath/ath6kl/main.c | |||
@@ -571,7 +571,6 @@ void ath6kl_scan_complete_evt(struct ath6kl_vif *vif, int status) | |||
571 | 571 | ||
572 | static int ath6kl_commit_ch_switch(struct ath6kl_vif *vif, u16 channel) | 572 | static int ath6kl_commit_ch_switch(struct ath6kl_vif *vif, u16 channel) |
573 | { | 573 | { |
574 | |||
575 | struct ath6kl *ar = vif->ar; | 574 | struct ath6kl *ar = vif->ar; |
576 | 575 | ||
577 | vif->profile.ch = cpu_to_le16(channel); | 576 | vif->profile.ch = cpu_to_le16(channel); |
@@ -600,7 +599,6 @@ static int ath6kl_commit_ch_switch(struct ath6kl_vif *vif, u16 channel) | |||
600 | 599 | ||
601 | static void ath6kl_check_ch_switch(struct ath6kl *ar, u16 channel) | 600 | static void ath6kl_check_ch_switch(struct ath6kl *ar, u16 channel) |
602 | { | 601 | { |
603 | |||
604 | struct ath6kl_vif *vif; | 602 | struct ath6kl_vif *vif; |
605 | int res = 0; | 603 | int res = 0; |
606 | 604 | ||
@@ -692,9 +690,9 @@ void ath6kl_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid, bool ismcast) | |||
692 | cfg80211_michael_mic_failure(vif->ndev, sta->mac, | 690 | cfg80211_michael_mic_failure(vif->ndev, sta->mac, |
693 | NL80211_KEYTYPE_PAIRWISE, keyid, | 691 | NL80211_KEYTYPE_PAIRWISE, keyid, |
694 | tsc, GFP_KERNEL); | 692 | tsc, GFP_KERNEL); |
695 | } else | 693 | } else { |
696 | ath6kl_cfg80211_tkip_micerr_event(vif, keyid, ismcast); | 694 | ath6kl_cfg80211_tkip_micerr_event(vif, keyid, ismcast); |
697 | 695 | } | |
698 | } | 696 | } |
699 | 697 | ||
700 | static void ath6kl_update_target_stats(struct ath6kl_vif *vif, u8 *ptr, u32 len) | 698 | static void ath6kl_update_target_stats(struct ath6kl_vif *vif, u8 *ptr, u32 len) |
@@ -1093,8 +1091,9 @@ static int ath6kl_open(struct net_device *dev) | |||
1093 | if (test_bit(CONNECTED, &vif->flags)) { | 1091 | if (test_bit(CONNECTED, &vif->flags)) { |
1094 | netif_carrier_on(dev); | 1092 | netif_carrier_on(dev); |
1095 | netif_wake_queue(dev); | 1093 | netif_wake_queue(dev); |
1096 | } else | 1094 | } else { |
1097 | netif_carrier_off(dev); | 1095 | netif_carrier_off(dev); |
1096 | } | ||
1098 | 1097 | ||
1099 | return 0; | 1098 | return 0; |
1100 | } | 1099 | } |
@@ -1146,7 +1145,6 @@ static int ath6kl_set_features(struct net_device *dev, | |||
1146 | dev->features = features | NETIF_F_RXCSUM; | 1145 | dev->features = features | NETIF_F_RXCSUM; |
1147 | return err; | 1146 | return err; |
1148 | } | 1147 | } |
1149 | |||
1150 | } | 1148 | } |
1151 | 1149 | ||
1152 | return err; | 1150 | return err; |
diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c index 7126bdd4236c..339d89f14d32 100644 --- a/drivers/net/wireless/ath/ath6kl/sdio.c +++ b/drivers/net/wireless/ath/ath6kl/sdio.c | |||
@@ -348,7 +348,7 @@ static int ath6kl_sdio_alloc_prep_scat_req(struct ath6kl_sdio *ar_sdio, | |||
348 | int i, scat_req_sz, scat_list_sz, size; | 348 | int i, scat_req_sz, scat_list_sz, size; |
349 | u8 *virt_buf; | 349 | u8 *virt_buf; |
350 | 350 | ||
351 | scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item); | 351 | scat_list_sz = n_scat_entry * sizeof(struct hif_scatter_item); |
352 | scat_req_sz = sizeof(*s_req) + scat_list_sz; | 352 | scat_req_sz = sizeof(*s_req) + scat_list_sz; |
353 | 353 | ||
354 | if (!virt_scat) | 354 | if (!virt_scat) |
@@ -425,8 +425,9 @@ static int ath6kl_sdio_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf, | |||
425 | memcpy(tbuf, buf, len); | 425 | memcpy(tbuf, buf, len); |
426 | 426 | ||
427 | bounced = true; | 427 | bounced = true; |
428 | } else | 428 | } else { |
429 | tbuf = buf; | 429 | tbuf = buf; |
430 | } | ||
430 | 431 | ||
431 | ret = ath6kl_sdio_io(ar_sdio->func, request, addr, tbuf, len); | 432 | ret = ath6kl_sdio_io(ar_sdio->func, request, addr, tbuf, len); |
432 | if ((request & HIF_READ) && bounced) | 433 | if ((request & HIF_READ) && bounced) |
@@ -441,9 +442,9 @@ static int ath6kl_sdio_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf, | |||
441 | static void __ath6kl_sdio_write_async(struct ath6kl_sdio *ar_sdio, | 442 | static void __ath6kl_sdio_write_async(struct ath6kl_sdio *ar_sdio, |
442 | struct bus_request *req) | 443 | struct bus_request *req) |
443 | { | 444 | { |
444 | if (req->scat_req) | 445 | if (req->scat_req) { |
445 | ath6kl_sdio_scat_rw(ar_sdio, req); | 446 | ath6kl_sdio_scat_rw(ar_sdio, req); |
446 | else { | 447 | } else { |
447 | void *context; | 448 | void *context; |
448 | int status; | 449 | int status; |
449 | 450 | ||
@@ -656,7 +657,6 @@ static void ath6kl_sdio_scatter_req_add(struct ath6kl *ar, | |||
656 | list_add_tail(&s_req->list, &ar_sdio->scat_req); | 657 | list_add_tail(&s_req->list, &ar_sdio->scat_req); |
657 | 658 | ||
658 | spin_unlock_bh(&ar_sdio->scat_lock); | 659 | spin_unlock_bh(&ar_sdio->scat_lock); |
659 | |||
660 | } | 660 | } |
661 | 661 | ||
662 | /* scatter gather read write request */ | 662 | /* scatter gather read write request */ |
@@ -674,9 +674,9 @@ static int ath6kl_sdio_async_rw_scatter(struct ath6kl *ar, | |||
674 | "hif-scatter: total len: %d scatter entries: %d\n", | 674 | "hif-scatter: total len: %d scatter entries: %d\n", |
675 | scat_req->len, scat_req->scat_entries); | 675 | scat_req->len, scat_req->scat_entries); |
676 | 676 | ||
677 | if (request & HIF_SYNCHRONOUS) | 677 | if (request & HIF_SYNCHRONOUS) { |
678 | status = ath6kl_sdio_scat_rw(ar_sdio, scat_req->busrequest); | 678 | status = ath6kl_sdio_scat_rw(ar_sdio, scat_req->busrequest); |
679 | else { | 679 | } else { |
680 | spin_lock_bh(&ar_sdio->wr_async_lock); | 680 | spin_lock_bh(&ar_sdio->wr_async_lock); |
681 | list_add_tail(&scat_req->busrequest->list, &ar_sdio->wr_asyncq); | 681 | list_add_tail(&scat_req->busrequest->list, &ar_sdio->wr_asyncq); |
682 | spin_unlock_bh(&ar_sdio->wr_async_lock); | 682 | spin_unlock_bh(&ar_sdio->wr_async_lock); |
@@ -856,7 +856,6 @@ static int ath6kl_sdio_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow) | |||
856 | 856 | ||
857 | if (ar->suspend_mode == WLAN_POWER_STATE_WOW || | 857 | if (ar->suspend_mode == WLAN_POWER_STATE_WOW || |
858 | (!ar->suspend_mode && wow)) { | 858 | (!ar->suspend_mode && wow)) { |
859 | |||
860 | ret = ath6kl_set_sdio_pm_caps(ar); | 859 | ret = ath6kl_set_sdio_pm_caps(ar); |
861 | if (ret) | 860 | if (ret) |
862 | goto cut_pwr; | 861 | goto cut_pwr; |
@@ -878,7 +877,6 @@ static int ath6kl_sdio_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow) | |||
878 | 877 | ||
879 | if (ar->suspend_mode == WLAN_POWER_STATE_DEEP_SLEEP || | 878 | if (ar->suspend_mode == WLAN_POWER_STATE_DEEP_SLEEP || |
880 | !ar->suspend_mode || try_deepsleep) { | 879 | !ar->suspend_mode || try_deepsleep) { |
881 | |||
882 | flags = sdio_get_host_pm_caps(func); | 880 | flags = sdio_get_host_pm_caps(func); |
883 | if (!(flags & MMC_PM_KEEP_POWER)) | 881 | if (!(flags & MMC_PM_KEEP_POWER)) |
884 | goto cut_pwr; | 882 | goto cut_pwr; |
@@ -1061,7 +1059,6 @@ static int ath6kl_sdio_bmi_credits(struct ath6kl *ar) | |||
1061 | 1059 | ||
1062 | timeout = jiffies + msecs_to_jiffies(BMI_COMMUNICATION_TIMEOUT); | 1060 | timeout = jiffies + msecs_to_jiffies(BMI_COMMUNICATION_TIMEOUT); |
1063 | while (time_before(jiffies, timeout) && !ar->bmi.cmd_credits) { | 1061 | while (time_before(jiffies, timeout) && !ar->bmi.cmd_credits) { |
1064 | |||
1065 | /* | 1062 | /* |
1066 | * Hit the credit counter with a 4-byte access, the first byte | 1063 | * Hit the credit counter with a 4-byte access, the first byte |
1067 | * read will hit the counter and cause a decrement, while the | 1064 | * read will hit the counter and cause a decrement, while the |
diff --git a/drivers/net/wireless/ath/ath6kl/target.h b/drivers/net/wireless/ath/ath6kl/target.h index a580a629a0da..d5eeeae7711b 100644 --- a/drivers/net/wireless/ath/ath6kl/target.h +++ b/drivers/net/wireless/ath/ath6kl/target.h | |||
@@ -289,7 +289,7 @@ struct host_interest { | |||
289 | u32 hi_hp_rx_traffic_ratio; /* 0xd8 */ | 289 | u32 hi_hp_rx_traffic_ratio; /* 0xd8 */ |
290 | 290 | ||
291 | /* test applications flags */ | 291 | /* test applications flags */ |
292 | u32 hi_test_apps_related ; /* 0xdc */ | 292 | u32 hi_test_apps_related; /* 0xdc */ |
293 | /* location of test script */ | 293 | /* location of test script */ |
294 | u32 hi_ota_testscript; /* 0xe0 */ | 294 | u32 hi_ota_testscript; /* 0xe0 */ |
295 | /* location of CAL data */ | 295 | /* location of CAL data */ |
diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c index ebb24045a8ae..40432fe7a5d2 100644 --- a/drivers/net/wireless/ath/ath6kl/txrx.c +++ b/drivers/net/wireless/ath/ath6kl/txrx.c | |||
@@ -125,8 +125,9 @@ static bool ath6kl_process_uapsdq(struct ath6kl_sta *conn, | |||
125 | *flags |= WMI_DATA_HDR_FLAGS_UAPSD; | 125 | *flags |= WMI_DATA_HDR_FLAGS_UAPSD; |
126 | spin_unlock_bh(&conn->psq_lock); | 126 | spin_unlock_bh(&conn->psq_lock); |
127 | return false; | 127 | return false; |
128 | } else if (!conn->apsd_info) | 128 | } else if (!conn->apsd_info) { |
129 | return false; | 129 | return false; |
130 | } | ||
130 | 131 | ||
131 | if (test_bit(WMM_ENABLED, &vif->flags)) { | 132 | if (test_bit(WMM_ENABLED, &vif->flags)) { |
132 | ether_type = be16_to_cpu(datap->h_proto); | 133 | ether_type = be16_to_cpu(datap->h_proto); |
@@ -316,8 +317,9 @@ int ath6kl_control_tx(void *devt, struct sk_buff *skb, | |||
316 | cookie = NULL; | 317 | cookie = NULL; |
317 | ath6kl_err("wmi ctrl ep full, dropping pkt : 0x%p, len:%d\n", | 318 | ath6kl_err("wmi ctrl ep full, dropping pkt : 0x%p, len:%d\n", |
318 | skb, skb->len); | 319 | skb, skb->len); |
319 | } else | 320 | } else { |
320 | cookie = ath6kl_alloc_cookie(ar); | 321 | cookie = ath6kl_alloc_cookie(ar); |
322 | } | ||
321 | 323 | ||
322 | if (cookie == NULL) { | 324 | if (cookie == NULL) { |
323 | spin_unlock_bh(&ar->lock); | 325 | spin_unlock_bh(&ar->lock); |
@@ -359,7 +361,7 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev) | |||
359 | struct ath6kl_vif *vif = netdev_priv(dev); | 361 | struct ath6kl_vif *vif = netdev_priv(dev); |
360 | u32 map_no = 0; | 362 | u32 map_no = 0; |
361 | u16 htc_tag = ATH6KL_DATA_PKT_TAG; | 363 | u16 htc_tag = ATH6KL_DATA_PKT_TAG; |
362 | u8 ac = 99 ; /* initialize to unmapped ac */ | 364 | u8 ac = 99; /* initialize to unmapped ac */ |
363 | bool chk_adhoc_ps_mapping = false; | 365 | bool chk_adhoc_ps_mapping = false; |
364 | int ret; | 366 | int ret; |
365 | struct wmi_tx_meta_v2 meta_v2; | 367 | struct wmi_tx_meta_v2 meta_v2; |
@@ -449,8 +451,9 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev) | |||
449 | if (ret) | 451 | if (ret) |
450 | goto fail_tx; | 452 | goto fail_tx; |
451 | } | 453 | } |
452 | } else | 454 | } else { |
453 | goto fail_tx; | 455 | goto fail_tx; |
456 | } | ||
454 | 457 | ||
455 | spin_lock_bh(&ar->lock); | 458 | spin_lock_bh(&ar->lock); |
456 | 459 | ||
@@ -702,7 +705,6 @@ void ath6kl_tx_complete(struct htc_target *target, | |||
702 | 705 | ||
703 | /* reap completed packets */ | 706 | /* reap completed packets */ |
704 | while (!list_empty(packet_queue)) { | 707 | while (!list_empty(packet_queue)) { |
705 | |||
706 | packet = list_first_entry(packet_queue, struct htc_packet, | 708 | packet = list_first_entry(packet_queue, struct htc_packet, |
707 | list); | 709 | list); |
708 | list_del(&packet->list); | 710 | list_del(&packet->list); |
@@ -1089,8 +1091,9 @@ static void aggr_deque_frms(struct aggr_info_conn *agg_conn, u8 tid, | |||
1089 | else | 1091 | else |
1090 | skb_queue_tail(&rxtid->q, node->skb); | 1092 | skb_queue_tail(&rxtid->q, node->skb); |
1091 | node->skb = NULL; | 1093 | node->skb = NULL; |
1092 | } else | 1094 | } else { |
1093 | stats->num_hole++; | 1095 | stats->num_hole++; |
1096 | } | ||
1094 | 1097 | ||
1095 | rxtid->seq_next = ATH6KL_NEXT_SEQ_NO(rxtid->seq_next); | 1098 | rxtid->seq_next = ATH6KL_NEXT_SEQ_NO(rxtid->seq_next); |
1096 | idx = AGGR_WIN_IDX(rxtid->seq_next, rxtid->hold_q_sz); | 1099 | idx = AGGR_WIN_IDX(rxtid->seq_next, rxtid->hold_q_sz); |
@@ -1211,7 +1214,7 @@ static bool aggr_process_recv_frm(struct aggr_info_conn *agg_conn, u8 tid, | |||
1211 | return is_queued; | 1214 | return is_queued; |
1212 | 1215 | ||
1213 | spin_lock_bh(&rxtid->lock); | 1216 | spin_lock_bh(&rxtid->lock); |
1214 | for (idx = 0 ; idx < rxtid->hold_q_sz; idx++) { | 1217 | for (idx = 0; idx < rxtid->hold_q_sz; idx++) { |
1215 | if (rxtid->hold_q[idx].skb) { | 1218 | if (rxtid->hold_q[idx].skb) { |
1216 | /* | 1219 | /* |
1217 | * There is a frame in the queue and no | 1220 | * There is a frame in the queue and no |
@@ -1265,7 +1268,6 @@ static void ath6kl_uapsd_trigger_frame_rx(struct ath6kl_vif *vif, | |||
1265 | is_apsdq_empty_at_start = is_apsdq_empty; | 1268 | is_apsdq_empty_at_start = is_apsdq_empty; |
1266 | 1269 | ||
1267 | while ((!is_apsdq_empty) && (num_frames_to_deliver)) { | 1270 | while ((!is_apsdq_empty) && (num_frames_to_deliver)) { |
1268 | |||
1269 | spin_lock_bh(&conn->psq_lock); | 1271 | spin_lock_bh(&conn->psq_lock); |
1270 | skb = skb_dequeue(&conn->apsdq); | 1272 | skb = skb_dequeue(&conn->apsdq); |
1271 | is_apsdq_empty = skb_queue_empty(&conn->apsdq); | 1273 | is_apsdq_empty = skb_queue_empty(&conn->apsdq); |
@@ -1606,16 +1608,18 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet) | |||
1606 | if (!conn) | 1608 | if (!conn) |
1607 | return; | 1609 | return; |
1608 | aggr_conn = conn->aggr_conn; | 1610 | aggr_conn = conn->aggr_conn; |
1609 | } else | 1611 | } else { |
1610 | aggr_conn = vif->aggr_cntxt->aggr_conn; | 1612 | aggr_conn = vif->aggr_cntxt->aggr_conn; |
1613 | } | ||
1611 | 1614 | ||
1612 | if (aggr_process_recv_frm(aggr_conn, tid, seq_no, | 1615 | if (aggr_process_recv_frm(aggr_conn, tid, seq_no, |
1613 | is_amsdu, skb)) { | 1616 | is_amsdu, skb)) { |
1614 | /* aggregation code will handle the skb */ | 1617 | /* aggregation code will handle the skb */ |
1615 | return; | 1618 | return; |
1616 | } | 1619 | } |
1617 | } else if (!is_broadcast_ether_addr(datap->h_dest)) | 1620 | } else if (!is_broadcast_ether_addr(datap->h_dest)) { |
1618 | vif->net_stats.multicast++; | 1621 | vif->net_stats.multicast++; |
1622 | } | ||
1619 | 1623 | ||
1620 | ath6kl_deliver_frames_to_nw_stack(vif->ndev, skb); | 1624 | ath6kl_deliver_frames_to_nw_stack(vif->ndev, skb); |
1621 | } | 1625 | } |
@@ -1710,8 +1714,9 @@ void aggr_recv_addba_req_evt(struct ath6kl_vif *vif, u8 tid_mux, u16 seq_no, | |||
1710 | sta = ath6kl_find_sta_by_aid(vif->ar, aid); | 1714 | sta = ath6kl_find_sta_by_aid(vif->ar, aid); |
1711 | if (sta) | 1715 | if (sta) |
1712 | aggr_conn = sta->aggr_conn; | 1716 | aggr_conn = sta->aggr_conn; |
1713 | } else | 1717 | } else { |
1714 | aggr_conn = vif->aggr_cntxt->aggr_conn; | 1718 | aggr_conn = vif->aggr_cntxt->aggr_conn; |
1719 | } | ||
1715 | 1720 | ||
1716 | if (!aggr_conn) | 1721 | if (!aggr_conn) |
1717 | return; | 1722 | return; |
@@ -1766,7 +1771,6 @@ void aggr_conn_init(struct ath6kl_vif *vif, struct aggr_info *aggr_info, | |||
1766 | skb_queue_head_init(&rxtid->q); | 1771 | skb_queue_head_init(&rxtid->q); |
1767 | spin_lock_init(&rxtid->lock); | 1772 | spin_lock_init(&rxtid->lock); |
1768 | } | 1773 | } |
1769 | |||
1770 | } | 1774 | } |
1771 | 1775 | ||
1772 | struct aggr_info *aggr_init(struct ath6kl_vif *vif) | 1776 | struct aggr_info *aggr_init(struct ath6kl_vif *vif) |
@@ -1806,8 +1810,9 @@ void aggr_recv_delba_req_evt(struct ath6kl_vif *vif, u8 tid_mux) | |||
1806 | sta = ath6kl_find_sta_by_aid(vif->ar, aid); | 1810 | sta = ath6kl_find_sta_by_aid(vif->ar, aid); |
1807 | if (sta) | 1811 | if (sta) |
1808 | aggr_conn = sta->aggr_conn; | 1812 | aggr_conn = sta->aggr_conn; |
1809 | } else | 1813 | } else { |
1810 | aggr_conn = vif->aggr_cntxt->aggr_conn; | 1814 | aggr_conn = vif->aggr_cntxt->aggr_conn; |
1815 | } | ||
1811 | 1816 | ||
1812 | if (!aggr_conn) | 1817 | if (!aggr_conn) |
1813 | return; | 1818 | return; |
diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c index 56c3fd5cef65..3afc5a463d06 100644 --- a/drivers/net/wireless/ath/ath6kl/usb.c +++ b/drivers/net/wireless/ath/ath6kl/usb.c | |||
@@ -236,7 +236,6 @@ static void ath6kl_usb_free_pipe_resources(struct ath6kl_usb_pipe *pipe) | |||
236 | break; | 236 | break; |
237 | kfree(urb_context); | 237 | kfree(urb_context); |
238 | } | 238 | } |
239 | |||
240 | } | 239 | } |
241 | 240 | ||
242 | static void ath6kl_usb_cleanup_pipe_resources(struct ath6kl_usb *ar_usb) | 241 | static void ath6kl_usb_cleanup_pipe_resources(struct ath6kl_usb *ar_usb) |
@@ -245,7 +244,6 @@ static void ath6kl_usb_cleanup_pipe_resources(struct ath6kl_usb *ar_usb) | |||
245 | 244 | ||
246 | for (i = 0; i < ATH6KL_USB_PIPE_MAX; i++) | 245 | for (i = 0; i < ATH6KL_USB_PIPE_MAX; i++) |
247 | ath6kl_usb_free_pipe_resources(&ar_usb->pipes[i]); | 246 | ath6kl_usb_free_pipe_resources(&ar_usb->pipes[i]); |
248 | |||
249 | } | 247 | } |
250 | 248 | ||
251 | static u8 ath6kl_usb_get_logical_pipe_num(struct ath6kl_usb *ar_usb, | 249 | static u8 ath6kl_usb_get_logical_pipe_num(struct ath6kl_usb *ar_usb, |
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index 8b4ce28e3ce8..4d7f9e4712e9 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c | |||
@@ -289,8 +289,9 @@ int ath6kl_wmi_implicit_create_pstream(struct wmi *wmi, u8 if_idx, | |||
289 | ath6kl_wmi_determine_user_priority(((u8 *) llc_hdr) + | 289 | ath6kl_wmi_determine_user_priority(((u8 *) llc_hdr) + |
290 | sizeof(struct ath6kl_llc_snap_hdr), | 290 | sizeof(struct ath6kl_llc_snap_hdr), |
291 | layer2_priority); | 291 | layer2_priority); |
292 | } else | 292 | } else { |
293 | usr_pri = layer2_priority & 0x7; | 293 | usr_pri = layer2_priority & 0x7; |
294 | } | ||
294 | 295 | ||
295 | /* | 296 | /* |
296 | * Queue the EAPOL frames in the same WMM_AC_VO queue | 297 | * Queue the EAPOL frames in the same WMM_AC_VO queue |
@@ -359,8 +360,9 @@ int ath6kl_wmi_dot11_hdr_remove(struct wmi *wmi, struct sk_buff *skb) | |||
359 | hdr_size = roundup(sizeof(struct ieee80211_qos_hdr), | 360 | hdr_size = roundup(sizeof(struct ieee80211_qos_hdr), |
360 | sizeof(u32)); | 361 | sizeof(u32)); |
361 | skb_pull(skb, hdr_size); | 362 | skb_pull(skb, hdr_size); |
362 | } else if (sub_type == cpu_to_le16(IEEE80211_STYPE_DATA)) | 363 | } else if (sub_type == cpu_to_le16(IEEE80211_STYPE_DATA)) { |
363 | skb_pull(skb, sizeof(struct ieee80211_hdr_3addr)); | 364 | skb_pull(skb, sizeof(struct ieee80211_hdr_3addr)); |
365 | } | ||
364 | 366 | ||
365 | datap = skb->data; | 367 | datap = skb->data; |
366 | llc_hdr = (struct ath6kl_llc_snap_hdr *)(datap); | 368 | llc_hdr = (struct ath6kl_llc_snap_hdr *)(datap); |
@@ -936,7 +938,6 @@ ath6kl_regd_find_country_by_rd(u16 regdmn) | |||
936 | 938 | ||
937 | static void ath6kl_wmi_regdomain_event(struct wmi *wmi, u8 *datap, int len) | 939 | static void ath6kl_wmi_regdomain_event(struct wmi *wmi, u8 *datap, int len) |
938 | { | 940 | { |
939 | |||
940 | struct ath6kl_wmi_regdomain *ev; | 941 | struct ath6kl_wmi_regdomain *ev; |
941 | struct country_code_to_enum_rd *country = NULL; | 942 | struct country_code_to_enum_rd *country = NULL; |
942 | struct reg_dmn_pair_mapping *regpair = NULL; | 943 | struct reg_dmn_pair_mapping *regpair = NULL; |
@@ -946,10 +947,9 @@ static void ath6kl_wmi_regdomain_event(struct wmi *wmi, u8 *datap, int len) | |||
946 | ev = (struct ath6kl_wmi_regdomain *) datap; | 947 | ev = (struct ath6kl_wmi_regdomain *) datap; |
947 | reg_code = le32_to_cpu(ev->reg_code); | 948 | reg_code = le32_to_cpu(ev->reg_code); |
948 | 949 | ||
949 | if ((reg_code >> ATH6KL_COUNTRY_RD_SHIFT) & COUNTRY_ERD_FLAG) | 950 | if ((reg_code >> ATH6KL_COUNTRY_RD_SHIFT) & COUNTRY_ERD_FLAG) { |
950 | country = ath6kl_regd_find_country((u16) reg_code); | 951 | country = ath6kl_regd_find_country((u16) reg_code); |
951 | else if (!(((u16) reg_code & WORLD_SKU_MASK) == WORLD_SKU_PREFIX)) { | 952 | } else if (!(((u16) reg_code & WORLD_SKU_MASK) == WORLD_SKU_PREFIX)) { |
952 | |||
953 | regpair = ath6kl_get_regpair((u16) reg_code); | 953 | regpair = ath6kl_get_regpair((u16) reg_code); |
954 | country = ath6kl_regd_find_country_by_rd((u16) reg_code); | 954 | country = ath6kl_regd_find_country_by_rd((u16) reg_code); |
955 | if (regpair) | 955 | if (regpair) |
@@ -1499,7 +1499,6 @@ static int ath6kl_wmi_cac_event_rx(struct wmi *wmi, u8 *datap, int len, | |||
1499 | 1499 | ||
1500 | if ((reply->cac_indication == CAC_INDICATION_ADMISSION_RESP) && | 1500 | if ((reply->cac_indication == CAC_INDICATION_ADMISSION_RESP) && |
1501 | (reply->status_code != IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED)) { | 1501 | (reply->status_code != IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED)) { |
1502 | |||
1503 | ts = (struct ieee80211_tspec_ie *) &(reply->tspec_suggestion); | 1502 | ts = (struct ieee80211_tspec_ie *) &(reply->tspec_suggestion); |
1504 | tsinfo = le16_to_cpu(ts->tsinfo); | 1503 | tsinfo = le16_to_cpu(ts->tsinfo); |
1505 | tsid = (tsinfo >> IEEE80211_WMM_IE_TSPEC_TID_SHIFT) & | 1504 | tsid = (tsinfo >> IEEE80211_WMM_IE_TSPEC_TID_SHIFT) & |
@@ -1530,7 +1529,6 @@ static int ath6kl_wmi_cac_event_rx(struct wmi *wmi, u8 *datap, int len, | |||
1530 | * for delete qos stream from AP | 1529 | * for delete qos stream from AP |
1531 | */ | 1530 | */ |
1532 | else if (reply->cac_indication == CAC_INDICATION_DELETE) { | 1531 | else if (reply->cac_indication == CAC_INDICATION_DELETE) { |
1533 | |||
1534 | ts = (struct ieee80211_tspec_ie *) &(reply->tspec_suggestion); | 1532 | ts = (struct ieee80211_tspec_ie *) &(reply->tspec_suggestion); |
1535 | tsinfo = le16_to_cpu(ts->tsinfo); | 1533 | tsinfo = le16_to_cpu(ts->tsinfo); |
1536 | ts_id = ((tsinfo >> IEEE80211_WMM_IE_TSPEC_TID_SHIFT) & | 1534 | ts_id = ((tsinfo >> IEEE80211_WMM_IE_TSPEC_TID_SHIFT) & |
@@ -2322,7 +2320,7 @@ int ath6kl_wmi_addkey_cmd(struct wmi *wmi, u8 if_idx, u8 key_index, | |||
2322 | return ret; | 2320 | return ret; |
2323 | } | 2321 | } |
2324 | 2322 | ||
2325 | int ath6kl_wmi_add_krk_cmd(struct wmi *wmi, u8 if_idx, u8 *krk) | 2323 | int ath6kl_wmi_add_krk_cmd(struct wmi *wmi, u8 if_idx, const u8 *krk) |
2326 | { | 2324 | { |
2327 | struct sk_buff *skb; | 2325 | struct sk_buff *skb; |
2328 | struct wmi_add_krk_cmd *cmd; | 2326 | struct wmi_add_krk_cmd *cmd; |
@@ -2479,7 +2477,6 @@ static int ath6kl_wmi_sync_point(struct wmi *wmi, u8 if_idx) | |||
2479 | goto free_data_skb; | 2477 | goto free_data_skb; |
2480 | 2478 | ||
2481 | for (index = 0; index < num_pri_streams; index++) { | 2479 | for (index = 0; index < num_pri_streams; index++) { |
2482 | |||
2483 | if (WARN_ON(!data_sync_bufs[index].skb)) | 2480 | if (WARN_ON(!data_sync_bufs[index].skb)) |
2484 | goto free_data_skb; | 2481 | goto free_data_skb; |
2485 | 2482 | ||
@@ -2704,7 +2701,6 @@ static void ath6kl_wmi_relinquish_implicit_pstream_credits(struct wmi *wmi) | |||
2704 | 2701 | ||
2705 | for (i = 0; i < WMM_NUM_AC; i++) { | 2702 | for (i = 0; i < WMM_NUM_AC; i++) { |
2706 | if (stream_exist & (1 << i)) { | 2703 | if (stream_exist & (1 << i)) { |
2707 | |||
2708 | /* | 2704 | /* |
2709 | * FIXME: Is this lock & unlock inside | 2705 | * FIXME: Is this lock & unlock inside |
2710 | * for loop correct? may need rework. | 2706 | * for loop correct? may need rework. |
@@ -2870,8 +2866,9 @@ int ath6kl_wmi_set_host_sleep_mode_cmd(struct wmi *wmi, u8 if_idx, | |||
2870 | if (host_mode == ATH6KL_HOST_MODE_ASLEEP) { | 2866 | if (host_mode == ATH6KL_HOST_MODE_ASLEEP) { |
2871 | ath6kl_wmi_relinquish_implicit_pstream_credits(wmi); | 2867 | ath6kl_wmi_relinquish_implicit_pstream_credits(wmi); |
2872 | cmd->asleep = cpu_to_le32(1); | 2868 | cmd->asleep = cpu_to_le32(1); |
2873 | } else | 2869 | } else { |
2874 | cmd->awake = cpu_to_le32(1); | 2870 | cmd->awake = cpu_to_le32(1); |
2871 | } | ||
2875 | 2872 | ||
2876 | ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, | 2873 | ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, |
2877 | WMI_SET_HOST_SLEEP_MODE_CMDID, | 2874 | WMI_SET_HOST_SLEEP_MODE_CMDID, |
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h index 5c702ae4d9f8..bb23fc00111d 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.h +++ b/drivers/net/wireless/ath/ath6kl/wmi.h | |||
@@ -898,7 +898,6 @@ struct wmi_start_scan_cmd { | |||
898 | * flags here | 898 | * flags here |
899 | */ | 899 | */ |
900 | enum wmi_scan_ctrl_flags_bits { | 900 | enum wmi_scan_ctrl_flags_bits { |
901 | |||
902 | /* set if can scan in the connect cmd */ | 901 | /* set if can scan in the connect cmd */ |
903 | CONNECT_SCAN_CTRL_FLAGS = 0x01, | 902 | CONNECT_SCAN_CTRL_FLAGS = 0x01, |
904 | 903 | ||
@@ -2617,7 +2616,7 @@ int ath6kl_wmi_addkey_cmd(struct wmi *wmi, u8 if_idx, u8 key_index, | |||
2617 | u8 *key_material, | 2616 | u8 *key_material, |
2618 | u8 key_op_ctrl, u8 *mac_addr, | 2617 | u8 key_op_ctrl, u8 *mac_addr, |
2619 | enum wmi_sync_flag sync_flag); | 2618 | enum wmi_sync_flag sync_flag); |
2620 | int ath6kl_wmi_add_krk_cmd(struct wmi *wmi, u8 if_idx, u8 *krk); | 2619 | int ath6kl_wmi_add_krk_cmd(struct wmi *wmi, u8 if_idx, const u8 *krk); |
2621 | int ath6kl_wmi_deletekey_cmd(struct wmi *wmi, u8 if_idx, u8 key_index); | 2620 | int ath6kl_wmi_deletekey_cmd(struct wmi *wmi, u8 if_idx, u8 key_index); |
2622 | int ath6kl_wmi_setpmkid_cmd(struct wmi *wmi, u8 if_idx, const u8 *bssid, | 2621 | int ath6kl_wmi_setpmkid_cmd(struct wmi *wmi, u8 if_idx, const u8 *bssid, |
2623 | const u8 *pmkid, bool set); | 2622 | const u8 *pmkid, bool set); |
diff --git a/drivers/net/wireless/ath/ath9k/Makefile b/drivers/net/wireless/ath/ath9k/Makefile index 8e1c7b0fe76c..8fcd586d1c39 100644 --- a/drivers/net/wireless/ath/ath9k/Makefile +++ b/drivers/net/wireless/ath/ath9k/Makefile | |||
@@ -53,7 +53,8 @@ obj-$(CONFIG_ATH9K_HW) += ath9k_hw.o | |||
53 | obj-$(CONFIG_ATH9K_COMMON) += ath9k_common.o | 53 | obj-$(CONFIG_ATH9K_COMMON) += ath9k_common.o |
54 | ath9k_common-y:= common.o \ | 54 | ath9k_common-y:= common.o \ |
55 | common-init.o \ | 55 | common-init.o \ |
56 | common-beacon.o | 56 | common-beacon.o \ |
57 | common-debug.o | ||
57 | 58 | ||
58 | ath9k_htc-y += htc_hst.o \ | 59 | ath9k_htc-y += htc_hst.o \ |
59 | hif_usb.o \ | 60 | hif_usb.o \ |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h index 0a6163e9248c..c38399bc9aa9 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h | |||
@@ -410,7 +410,7 @@ static const u32 ar9300_2p2_baseband_core[][2] = { | |||
410 | {0x00009e30, 0x06336f77}, | 410 | {0x00009e30, 0x06336f77}, |
411 | {0x00009e34, 0x6af6532f}, | 411 | {0x00009e34, 0x6af6532f}, |
412 | {0x00009e38, 0x0cc80c00}, | 412 | {0x00009e38, 0x0cc80c00}, |
413 | {0x00009e40, 0x0d261820}, | 413 | {0x00009e40, 0x0d261800}, |
414 | {0x00009e4c, 0x00001004}, | 414 | {0x00009e4c, 0x00001004}, |
415 | {0x00009e50, 0x00ff03f1}, | 415 | {0x00009e50, 0x00ff03f1}, |
416 | {0x00009e54, 0x00000000}, | 416 | {0x00009e54, 0x00000000}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h b/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h index f76139bbb74f..2c42ff05efa3 100644 --- a/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h | |||
@@ -592,7 +592,7 @@ static const u32 ar9331_1p1_baseband_core[][2] = { | |||
592 | {0x00009e30, 0x06336f77}, | 592 | {0x00009e30, 0x06336f77}, |
593 | {0x00009e34, 0x6af6532f}, | 593 | {0x00009e34, 0x6af6532f}, |
594 | {0x00009e38, 0x0cc80c00}, | 594 | {0x00009e38, 0x0cc80c00}, |
595 | {0x00009e40, 0x0d261820}, | 595 | {0x00009e40, 0x0d261800}, |
596 | {0x00009e4c, 0x00001004}, | 596 | {0x00009e4c, 0x00001004}, |
597 | {0x00009e50, 0x00ff03f1}, | 597 | {0x00009e50, 0x00ff03f1}, |
598 | {0x00009fc0, 0x803e4788}, | 598 | {0x00009fc0, 0x803e4788}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h index 0ac8be96097f..2154efcd3900 100644 --- a/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h | |||
@@ -231,7 +231,7 @@ static const u32 ar9331_1p2_baseband_core[][2] = { | |||
231 | {0x00009e30, 0x06336f77}, | 231 | {0x00009e30, 0x06336f77}, |
232 | {0x00009e34, 0x6af6532f}, | 232 | {0x00009e34, 0x6af6532f}, |
233 | {0x00009e38, 0x0cc80c00}, | 233 | {0x00009e38, 0x0cc80c00}, |
234 | {0x00009e40, 0x0d261820}, | 234 | {0x00009e40, 0x0d261800}, |
235 | {0x00009e4c, 0x00001004}, | 235 | {0x00009e4c, 0x00001004}, |
236 | {0x00009e50, 0x00ff03f1}, | 236 | {0x00009e50, 0x00ff03f1}, |
237 | {0x00009fc0, 0x803e4788}, | 237 | {0x00009fc0, 0x803e4788}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9340_initvals.h b/drivers/net/wireless/ath/ath9k/ar9340_initvals.h index a01f0edb6518..b995ffe88b33 100644 --- a/drivers/net/wireless/ath/ath9k/ar9340_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9340_initvals.h | |||
@@ -318,7 +318,7 @@ static const u32 ar9340_1p0_baseband_core[][2] = { | |||
318 | {0x00009e30, 0x06336f77}, | 318 | {0x00009e30, 0x06336f77}, |
319 | {0x00009e34, 0x6af6532f}, | 319 | {0x00009e34, 0x6af6532f}, |
320 | {0x00009e38, 0x0cc80c00}, | 320 | {0x00009e38, 0x0cc80c00}, |
321 | {0x00009e40, 0x0d261820}, | 321 | {0x00009e40, 0x0d261800}, |
322 | {0x00009e4c, 0x00001004}, | 322 | {0x00009e4c, 0x00001004}, |
323 | {0x00009e50, 0x00ff03f1}, | 323 | {0x00009e50, 0x00ff03f1}, |
324 | {0x00009e54, 0x00000000}, | 324 | {0x00009e54, 0x00000000}, |
@@ -348,9 +348,9 @@ static const u32 ar9340_1p0_baseband_core[][2] = { | |||
348 | {0x0000a370, 0x00000000}, | 348 | {0x0000a370, 0x00000000}, |
349 | {0x0000a390, 0x00000001}, | 349 | {0x0000a390, 0x00000001}, |
350 | {0x0000a394, 0x00000444}, | 350 | {0x0000a394, 0x00000444}, |
351 | {0x0000a398, 0x00000000}, | 351 | {0x0000a398, 0x001f0e0f}, |
352 | {0x0000a39c, 0x210d0401}, | 352 | {0x0000a39c, 0x0075393f}, |
353 | {0x0000a3a0, 0xab9a7144}, | 353 | {0x0000a3a0, 0xb79f6427}, |
354 | {0x0000a3a4, 0x00000000}, | 354 | {0x0000a3a4, 0x00000000}, |
355 | {0x0000a3a8, 0xaaaaaaaa}, | 355 | {0x0000a3a8, 0xaaaaaaaa}, |
356 | {0x0000a3ac, 0x3c466478}, | 356 | {0x0000a3ac, 0x3c466478}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h index 3c9113d9b1bc..8e5c3b9786e3 100644 --- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h | |||
@@ -257,9 +257,9 @@ static const u32 qca953x_1p0_baseband_core[][2] = { | |||
257 | {0x0000a370, 0x00000000}, | 257 | {0x0000a370, 0x00000000}, |
258 | {0x0000a390, 0x00000001}, | 258 | {0x0000a390, 0x00000001}, |
259 | {0x0000a394, 0x00000444}, | 259 | {0x0000a394, 0x00000444}, |
260 | {0x0000a398, 0x1f020503}, | 260 | {0x0000a398, 0x001f0e0f}, |
261 | {0x0000a39c, 0x29180c03}, | 261 | {0x0000a39c, 0x0075393f}, |
262 | {0x0000a3a0, 0x9a8b6844}, | 262 | {0x0000a3a0, 0xb79f6427}, |
263 | {0x0000a3a4, 0x000000ff}, | 263 | {0x0000a3a4, 0x000000ff}, |
264 | {0x0000a3a8, 0x6a6a6a6a}, | 264 | {0x0000a3a8, 0x6a6a6a6a}, |
265 | {0x0000a3ac, 0x6a6a6a6a}, | 265 | {0x0000a3ac, 0x6a6a6a6a}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h index e6aec2c0207f..a5ca65240af3 100644 --- a/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h | |||
@@ -90,7 +90,7 @@ static const u32 ar9580_1p0_baseband_core[][2] = { | |||
90 | {0x00009e30, 0x06336f77}, | 90 | {0x00009e30, 0x06336f77}, |
91 | {0x00009e34, 0x6af6532f}, | 91 | {0x00009e34, 0x6af6532f}, |
92 | {0x00009e38, 0x0cc80c00}, | 92 | {0x00009e38, 0x0cc80c00}, |
93 | {0x00009e40, 0x0d261820}, | 93 | {0x00009e40, 0x0d261800}, |
94 | {0x00009e4c, 0x00001004}, | 94 | {0x00009e4c, 0x00001004}, |
95 | {0x00009e50, 0x00ff03f1}, | 95 | {0x00009e50, 0x00ff03f1}, |
96 | {0x00009e54, 0x00000000}, | 96 | {0x00009e54, 0x00000000}, |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 3ba03dde4215..2ca8f7e06174 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -23,8 +23,8 @@ | |||
23 | #include <linux/leds.h> | 23 | #include <linux/leds.h> |
24 | #include <linux/completion.h> | 24 | #include <linux/completion.h> |
25 | 25 | ||
26 | #include "debug.h" | ||
27 | #include "common.h" | 26 | #include "common.h" |
27 | #include "debug.h" | ||
28 | #include "mci.h" | 28 | #include "mci.h" |
29 | #include "dfs.h" | 29 | #include "dfs.h" |
30 | #include "spectral.h" | 30 | #include "spectral.h" |
@@ -114,6 +114,9 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, | |||
114 | #define ATH_TXFIFO_DEPTH 8 | 114 | #define ATH_TXFIFO_DEPTH 8 |
115 | #define ATH_TX_ERROR 0x01 | 115 | #define ATH_TX_ERROR 0x01 |
116 | 116 | ||
117 | /* Stop tx traffic 1ms before the GO goes away */ | ||
118 | #define ATH_P2P_PS_STOP_TIME 1000 | ||
119 | |||
117 | #define IEEE80211_SEQ_SEQ_SHIFT 4 | 120 | #define IEEE80211_SEQ_SEQ_SHIFT 4 |
118 | #define IEEE80211_SEQ_MAX 4096 | 121 | #define IEEE80211_SEQ_MAX 4096 |
119 | #define IEEE80211_WEP_IVLEN 3 | 122 | #define IEEE80211_WEP_IVLEN 3 |
@@ -271,6 +274,7 @@ struct ath_node { | |||
271 | #ifdef CONFIG_ATH9K_STATION_STATISTICS | 274 | #ifdef CONFIG_ATH9K_STATION_STATISTICS |
272 | struct ath_rx_rate_stats rx_rate_stats; | 275 | struct ath_rx_rate_stats rx_rate_stats; |
273 | #endif | 276 | #endif |
277 | u8 key_idx[4]; | ||
274 | }; | 278 | }; |
275 | 279 | ||
276 | struct ath_tx_control { | 280 | struct ath_tx_control { |
@@ -366,11 +370,15 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw, | |||
366 | /********/ | 370 | /********/ |
367 | 371 | ||
368 | struct ath_vif { | 372 | struct ath_vif { |
373 | struct ieee80211_vif *vif; | ||
369 | struct ath_node mcast_node; | 374 | struct ath_node mcast_node; |
370 | int av_bslot; | 375 | int av_bslot; |
371 | bool primary_sta_vif; | 376 | bool primary_sta_vif; |
372 | __le64 tsf_adjust; /* TSF adjustment for staggered beacons */ | 377 | __le64 tsf_adjust; /* TSF adjustment for staggered beacons */ |
373 | struct ath_buf *av_bcbuf; | 378 | struct ath_buf *av_bcbuf; |
379 | |||
380 | /* P2P Client */ | ||
381 | struct ieee80211_noa_data noa; | ||
374 | }; | 382 | }; |
375 | 383 | ||
376 | struct ath9k_vif_iter_data { | 384 | struct ath9k_vif_iter_data { |
@@ -463,6 +471,8 @@ int ath_update_survey_stats(struct ath_softc *sc); | |||
463 | void ath_update_survey_nf(struct ath_softc *sc, int channel); | 471 | void ath_update_survey_nf(struct ath_softc *sc, int channel); |
464 | void ath9k_queue_reset(struct ath_softc *sc, enum ath_reset_type type); | 472 | void ath9k_queue_reset(struct ath_softc *sc, enum ath_reset_type type); |
465 | void ath_ps_full_sleep(unsigned long data); | 473 | void ath_ps_full_sleep(unsigned long data); |
474 | void ath9k_p2p_ps_timer(void *priv); | ||
475 | void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif); | ||
466 | 476 | ||
467 | /**********/ | 477 | /**********/ |
468 | /* BTCOEX */ | 478 | /* BTCOEX */ |
@@ -713,6 +723,9 @@ struct ath_softc { | |||
713 | struct completion paprd_complete; | 723 | struct completion paprd_complete; |
714 | wait_queue_head_t tx_wait; | 724 | wait_queue_head_t tx_wait; |
715 | 725 | ||
726 | struct ath_gen_timer *p2p_ps_timer; | ||
727 | struct ath_vif *p2p_ps_vif; | ||
728 | |||
716 | unsigned long driver_data; | 729 | unsigned long driver_data; |
717 | 730 | ||
718 | u8 gtt_cnt; | 731 | u8 gtt_cnt; |
@@ -757,6 +770,7 @@ struct ath_softc { | |||
757 | struct ath_ant_comb ant_comb; | 770 | struct ath_ant_comb ant_comb; |
758 | u8 ant_tx, ant_rx; | 771 | u8 ant_tx, ant_rx; |
759 | struct dfs_pattern_detector *dfs_detector; | 772 | struct dfs_pattern_detector *dfs_detector; |
773 | u64 dfs_prev_pulse_ts; | ||
760 | u32 wow_enabled; | 774 | u32 wow_enabled; |
761 | /* relay(fs) channel for spectral scan */ | 775 | /* relay(fs) channel for spectral scan */ |
762 | struct rchan *rfs_chan_spec_scan; | 776 | struct rchan *rfs_chan_spec_scan; |
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c index bd9e634879e6..e387f0b2954a 100644 --- a/drivers/net/wireless/ath/ath9k/beacon.c +++ b/drivers/net/wireless/ath/ath9k/beacon.c | |||
@@ -537,8 +537,6 @@ static void ath9k_cache_beacon_config(struct ath_softc *sc, | |||
537 | cur_conf->dtim_period = bss_conf->dtim_period; | 537 | cur_conf->dtim_period = bss_conf->dtim_period; |
538 | cur_conf->dtim_count = 1; | 538 | cur_conf->dtim_count = 1; |
539 | cur_conf->ibss_creator = bss_conf->ibss_creator; | 539 | cur_conf->ibss_creator = bss_conf->ibss_creator; |
540 | cur_conf->bmiss_timeout = | ||
541 | ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval; | ||
542 | 540 | ||
543 | /* | 541 | /* |
544 | * It looks like mac80211 may end up using beacon interval of zero in | 542 | * It looks like mac80211 may end up using beacon interval of zero in |
@@ -549,6 +547,9 @@ static void ath9k_cache_beacon_config(struct ath_softc *sc, | |||
549 | if (cur_conf->beacon_interval == 0) | 547 | if (cur_conf->beacon_interval == 0) |
550 | cur_conf->beacon_interval = 100; | 548 | cur_conf->beacon_interval = 100; |
551 | 549 | ||
550 | cur_conf->bmiss_timeout = | ||
551 | ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval; | ||
552 | |||
552 | /* | 553 | /* |
553 | * We don't parse dtim period from mac80211 during the driver | 554 | * We don't parse dtim period from mac80211 during the driver |
554 | * initialization as it breaks association with hidden-ssid | 555 | * initialization as it breaks association with hidden-ssid |
diff --git a/drivers/net/wireless/ath/ath9k/common-debug.c b/drivers/net/wireless/ath/ath9k/common-debug.c new file mode 100644 index 000000000000..3b289f933405 --- /dev/null +++ b/drivers/net/wireless/ath/ath9k/common-debug.c | |||
@@ -0,0 +1,253 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008-2011 Atheros Communications Inc. | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | #include "common.h" | ||
18 | |||
19 | static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, | ||
20 | size_t count, loff_t *ppos) | ||
21 | { | ||
22 | struct ath_hw *ah = file->private_data; | ||
23 | u32 len = 0, size = 6000; | ||
24 | char *buf; | ||
25 | size_t retval; | ||
26 | |||
27 | buf = kzalloc(size, GFP_KERNEL); | ||
28 | if (buf == NULL) | ||
29 | return -ENOMEM; | ||
30 | |||
31 | len = ah->eep_ops->dump_eeprom(ah, false, buf, len, size); | ||
32 | |||
33 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
34 | kfree(buf); | ||
35 | |||
36 | return retval; | ||
37 | } | ||
38 | |||
39 | static const struct file_operations fops_modal_eeprom = { | ||
40 | .read = read_file_modal_eeprom, | ||
41 | .open = simple_open, | ||
42 | .owner = THIS_MODULE, | ||
43 | .llseek = default_llseek, | ||
44 | }; | ||
45 | |||
46 | |||
47 | void ath9k_cmn_debug_modal_eeprom(struct dentry *debugfs_phy, | ||
48 | struct ath_hw *ah) | ||
49 | { | ||
50 | debugfs_create_file("modal_eeprom", S_IRUSR, debugfs_phy, ah, | ||
51 | &fops_modal_eeprom); | ||
52 | } | ||
53 | EXPORT_SYMBOL(ath9k_cmn_debug_modal_eeprom); | ||
54 | |||
55 | static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, | ||
56 | size_t count, loff_t *ppos) | ||
57 | { | ||
58 | struct ath_hw *ah = file->private_data; | ||
59 | u32 len = 0, size = 1500; | ||
60 | ssize_t retval = 0; | ||
61 | char *buf; | ||
62 | |||
63 | buf = kzalloc(size, GFP_KERNEL); | ||
64 | if (!buf) | ||
65 | return -ENOMEM; | ||
66 | |||
67 | len = ah->eep_ops->dump_eeprom(ah, true, buf, len, size); | ||
68 | |||
69 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
70 | kfree(buf); | ||
71 | |||
72 | return retval; | ||
73 | } | ||
74 | |||
75 | static const struct file_operations fops_base_eeprom = { | ||
76 | .read = read_file_base_eeprom, | ||
77 | .open = simple_open, | ||
78 | .owner = THIS_MODULE, | ||
79 | .llseek = default_llseek, | ||
80 | }; | ||
81 | |||
82 | void ath9k_cmn_debug_base_eeprom(struct dentry *debugfs_phy, | ||
83 | struct ath_hw *ah) | ||
84 | { | ||
85 | debugfs_create_file("base_eeprom", S_IRUSR, debugfs_phy, ah, | ||
86 | &fops_base_eeprom); | ||
87 | } | ||
88 | EXPORT_SYMBOL(ath9k_cmn_debug_base_eeprom); | ||
89 | |||
90 | void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats, | ||
91 | struct ath_rx_status *rs) | ||
92 | { | ||
93 | #define RX_PHY_ERR_INC(c) rxstats->phy_err_stats[c]++ | ||
94 | #define RX_CMN_STAT_INC(c) (rxstats->c++) | ||
95 | |||
96 | RX_CMN_STAT_INC(rx_pkts_all); | ||
97 | rxstats->rx_bytes_all += rs->rs_datalen; | ||
98 | |||
99 | if (rs->rs_status & ATH9K_RXERR_CRC) | ||
100 | RX_CMN_STAT_INC(crc_err); | ||
101 | if (rs->rs_status & ATH9K_RXERR_DECRYPT) | ||
102 | RX_CMN_STAT_INC(decrypt_crc_err); | ||
103 | if (rs->rs_status & ATH9K_RXERR_MIC) | ||
104 | RX_CMN_STAT_INC(mic_err); | ||
105 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_PRE) | ||
106 | RX_CMN_STAT_INC(pre_delim_crc_err); | ||
107 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_POST) | ||
108 | RX_CMN_STAT_INC(post_delim_crc_err); | ||
109 | if (rs->rs_status & ATH9K_RX_DECRYPT_BUSY) | ||
110 | RX_CMN_STAT_INC(decrypt_busy_err); | ||
111 | |||
112 | if (rs->rs_status & ATH9K_RXERR_PHY) { | ||
113 | RX_CMN_STAT_INC(phy_err); | ||
114 | if (rs->rs_phyerr < ATH9K_PHYERR_MAX) | ||
115 | RX_PHY_ERR_INC(rs->rs_phyerr); | ||
116 | } | ||
117 | |||
118 | #undef RX_CMN_STAT_INC | ||
119 | #undef RX_PHY_ERR_INC | ||
120 | } | ||
121 | EXPORT_SYMBOL(ath9k_cmn_debug_stat_rx); | ||
122 | |||
123 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, | ||
124 | size_t count, loff_t *ppos) | ||
125 | { | ||
126 | #define RXS_ERR(s, e) \ | ||
127 | do { \ | ||
128 | len += scnprintf(buf + len, size - len, \ | ||
129 | "%18s : %10u\n", s, \ | ||
130 | rxstats->e); \ | ||
131 | } while (0) | ||
132 | |||
133 | struct ath_rx_stats *rxstats = file->private_data; | ||
134 | char *buf; | ||
135 | unsigned int len = 0, size = 1600; | ||
136 | ssize_t retval = 0; | ||
137 | |||
138 | buf = kzalloc(size, GFP_KERNEL); | ||
139 | if (buf == NULL) | ||
140 | return -ENOMEM; | ||
141 | |||
142 | RXS_ERR("PKTS-ALL", rx_pkts_all); | ||
143 | RXS_ERR("BYTES-ALL", rx_bytes_all); | ||
144 | RXS_ERR("BEACONS", rx_beacons); | ||
145 | RXS_ERR("FRAGS", rx_frags); | ||
146 | RXS_ERR("SPECTRAL", rx_spectral); | ||
147 | |||
148 | RXS_ERR("CRC ERR", crc_err); | ||
149 | RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err); | ||
150 | RXS_ERR("PHY ERR", phy_err); | ||
151 | RXS_ERR("MIC ERR", mic_err); | ||
152 | RXS_ERR("PRE-DELIM CRC ERR", pre_delim_crc_err); | ||
153 | RXS_ERR("POST-DELIM CRC ERR", post_delim_crc_err); | ||
154 | RXS_ERR("DECRYPT BUSY ERR", decrypt_busy_err); | ||
155 | RXS_ERR("LENGTH-ERR", rx_len_err); | ||
156 | RXS_ERR("OOM-ERR", rx_oom_err); | ||
157 | RXS_ERR("RATE-ERR", rx_rate_err); | ||
158 | RXS_ERR("TOO-MANY-FRAGS", rx_too_many_frags_err); | ||
159 | |||
160 | if (len > size) | ||
161 | len = size; | ||
162 | |||
163 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
164 | kfree(buf); | ||
165 | |||
166 | return retval; | ||
167 | |||
168 | #undef RXS_ERR | ||
169 | } | ||
170 | |||
171 | static const struct file_operations fops_recv = { | ||
172 | .read = read_file_recv, | ||
173 | .open = simple_open, | ||
174 | .owner = THIS_MODULE, | ||
175 | .llseek = default_llseek, | ||
176 | }; | ||
177 | |||
178 | void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, | ||
179 | struct ath_rx_stats *rxstats) | ||
180 | { | ||
181 | debugfs_create_file("recv", S_IRUSR, debugfs_phy, rxstats, | ||
182 | &fops_recv); | ||
183 | } | ||
184 | EXPORT_SYMBOL(ath9k_cmn_debug_recv); | ||
185 | |||
186 | static ssize_t read_file_phy_err(struct file *file, char __user *user_buf, | ||
187 | size_t count, loff_t *ppos) | ||
188 | { | ||
189 | #define PHY_ERR(s, p) \ | ||
190 | len += scnprintf(buf + len, size - len, "%22s : %10u\n", s, \ | ||
191 | rxstats->phy_err_stats[p]); | ||
192 | |||
193 | struct ath_rx_stats *rxstats = file->private_data; | ||
194 | char *buf; | ||
195 | unsigned int len = 0, size = 1600; | ||
196 | ssize_t retval = 0; | ||
197 | |||
198 | buf = kzalloc(size, GFP_KERNEL); | ||
199 | if (buf == NULL) | ||
200 | return -ENOMEM; | ||
201 | |||
202 | PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN); | ||
203 | PHY_ERR("TIMING ERR", ATH9K_PHYERR_TIMING); | ||
204 | PHY_ERR("PARITY ERR", ATH9K_PHYERR_PARITY); | ||
205 | PHY_ERR("RATE ERR", ATH9K_PHYERR_RATE); | ||
206 | PHY_ERR("LENGTH ERR", ATH9K_PHYERR_LENGTH); | ||
207 | PHY_ERR("RADAR ERR", ATH9K_PHYERR_RADAR); | ||
208 | PHY_ERR("SERVICE ERR", ATH9K_PHYERR_SERVICE); | ||
209 | PHY_ERR("TOR ERR", ATH9K_PHYERR_TOR); | ||
210 | PHY_ERR("OFDM-TIMING ERR", ATH9K_PHYERR_OFDM_TIMING); | ||
211 | PHY_ERR("OFDM-SIGNAL-PARITY ERR", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); | ||
212 | PHY_ERR("OFDM-RATE ERR", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); | ||
213 | PHY_ERR("OFDM-LENGTH ERR", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); | ||
214 | PHY_ERR("OFDM-POWER-DROP ERR", ATH9K_PHYERR_OFDM_POWER_DROP); | ||
215 | PHY_ERR("OFDM-SERVICE ERR", ATH9K_PHYERR_OFDM_SERVICE); | ||
216 | PHY_ERR("OFDM-RESTART ERR", ATH9K_PHYERR_OFDM_RESTART); | ||
217 | PHY_ERR("FALSE-RADAR-EXT ERR", ATH9K_PHYERR_FALSE_RADAR_EXT); | ||
218 | PHY_ERR("CCK-TIMING ERR", ATH9K_PHYERR_CCK_TIMING); | ||
219 | PHY_ERR("CCK-HEADER-CRC ERR", ATH9K_PHYERR_CCK_HEADER_CRC); | ||
220 | PHY_ERR("CCK-RATE ERR", ATH9K_PHYERR_CCK_RATE_ILLEGAL); | ||
221 | PHY_ERR("CCK-SERVICE ERR", ATH9K_PHYERR_CCK_SERVICE); | ||
222 | PHY_ERR("CCK-RESTART ERR", ATH9K_PHYERR_CCK_RESTART); | ||
223 | PHY_ERR("CCK-LENGTH ERR", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); | ||
224 | PHY_ERR("CCK-POWER-DROP ERR", ATH9K_PHYERR_CCK_POWER_DROP); | ||
225 | PHY_ERR("HT-CRC ERR", ATH9K_PHYERR_HT_CRC_ERROR); | ||
226 | PHY_ERR("HT-LENGTH ERR", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); | ||
227 | PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL); | ||
228 | |||
229 | if (len > size) | ||
230 | len = size; | ||
231 | |||
232 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
233 | kfree(buf); | ||
234 | |||
235 | return retval; | ||
236 | |||
237 | #undef PHY_ERR | ||
238 | } | ||
239 | |||
240 | static const struct file_operations fops_phy_err = { | ||
241 | .read = read_file_phy_err, | ||
242 | .open = simple_open, | ||
243 | .owner = THIS_MODULE, | ||
244 | .llseek = default_llseek, | ||
245 | }; | ||
246 | |||
247 | void ath9k_cmn_debug_phy_err(struct dentry *debugfs_phy, | ||
248 | struct ath_rx_stats *rxstats) | ||
249 | { | ||
250 | debugfs_create_file("phy_err", S_IRUSR, debugfs_phy, rxstats, | ||
251 | &fops_phy_err); | ||
252 | } | ||
253 | EXPORT_SYMBOL(ath9k_cmn_debug_phy_err); | ||
diff --git a/drivers/net/wireless/ath/ath9k/common-debug.h b/drivers/net/wireless/ath/ath9k/common-debug.h new file mode 100644 index 000000000000..7c9788490f7f --- /dev/null +++ b/drivers/net/wireless/ath/ath9k/common-debug.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008-2011 Atheros Communications Inc. | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | |||
18 | |||
19 | /** | ||
20 | * struct ath_rx_stats - RX Statistics | ||
21 | * @rx_pkts_all: No. of total frames received, including ones that | ||
22 | may have had errors. | ||
23 | * @rx_bytes_all: No. of total bytes received, including ones that | ||
24 | may have had errors. | ||
25 | * @crc_err: No. of frames with incorrect CRC value | ||
26 | * @decrypt_crc_err: No. of frames whose CRC check failed after | ||
27 | decryption process completed | ||
28 | * @phy_err: No. of frames whose reception failed because the PHY | ||
29 | encountered an error | ||
30 | * @mic_err: No. of frames with incorrect TKIP MIC verification failure | ||
31 | * @pre_delim_crc_err: Pre-Frame delimiter CRC error detections | ||
32 | * @post_delim_crc_err: Post-Frame delimiter CRC error detections | ||
33 | * @decrypt_busy_err: Decryption interruptions counter | ||
34 | * @phy_err_stats: Individual PHY error statistics | ||
35 | * @rx_len_err: No. of frames discarded due to bad length. | ||
36 | * @rx_oom_err: No. of frames dropped due to OOM issues. | ||
37 | * @rx_rate_err: No. of frames dropped due to rate errors. | ||
38 | * @rx_too_many_frags_err: Frames dropped due to too-many-frags received. | ||
39 | * @rx_beacons: No. of beacons received. | ||
40 | * @rx_frags: No. of rx-fragements received. | ||
41 | * @rx_spectral: No of spectral packets received. | ||
42 | */ | ||
43 | struct ath_rx_stats { | ||
44 | u32 rx_pkts_all; | ||
45 | u32 rx_bytes_all; | ||
46 | u32 crc_err; | ||
47 | u32 decrypt_crc_err; | ||
48 | u32 phy_err; | ||
49 | u32 mic_err; | ||
50 | u32 pre_delim_crc_err; | ||
51 | u32 post_delim_crc_err; | ||
52 | u32 decrypt_busy_err; | ||
53 | u32 phy_err_stats[ATH9K_PHYERR_MAX]; | ||
54 | u32 rx_len_err; | ||
55 | u32 rx_oom_err; | ||
56 | u32 rx_rate_err; | ||
57 | u32 rx_too_many_frags_err; | ||
58 | u32 rx_beacons; | ||
59 | u32 rx_frags; | ||
60 | u32 rx_spectral; | ||
61 | }; | ||
62 | |||
63 | void ath9k_cmn_debug_modal_eeprom(struct dentry *debugfs_phy, | ||
64 | struct ath_hw *ah); | ||
65 | void ath9k_cmn_debug_base_eeprom(struct dentry *debugfs_phy, | ||
66 | struct ath_hw *ah); | ||
67 | void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats, | ||
68 | struct ath_rx_status *rs); | ||
69 | void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, | ||
70 | struct ath_rx_stats *rxstats); | ||
71 | void ath9k_cmn_debug_phy_err(struct dentry *debugfs_phy, | ||
72 | struct ath_rx_stats *rxstats); | ||
diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h index ca38116838f0..ffc454b18637 100644 --- a/drivers/net/wireless/ath/ath9k/common.h +++ b/drivers/net/wireless/ath/ath9k/common.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include "common-init.h" | 24 | #include "common-init.h" |
25 | #include "common-beacon.h" | 25 | #include "common-beacon.h" |
26 | #include "common-debug.h" | ||
26 | 27 | ||
27 | /* Common header for Atheros 802.11n base driver cores */ | 28 | /* Common header for Atheros 802.11n base driver cores */ |
28 | 29 | ||
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 780ff1bee6f6..6cc42be48d4e 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -948,151 +948,11 @@ static const struct file_operations fops_reset = { | |||
948 | .llseek = default_llseek, | 948 | .llseek = default_llseek, |
949 | }; | 949 | }; |
950 | 950 | ||
951 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, | ||
952 | size_t count, loff_t *ppos) | ||
953 | { | ||
954 | #define RXS_ERR(s, e) \ | ||
955 | do { \ | ||
956 | len += scnprintf(buf + len, size - len, \ | ||
957 | "%18s : %10u\n", s, \ | ||
958 | sc->debug.stats.rxstats.e);\ | ||
959 | } while (0) | ||
960 | |||
961 | struct ath_softc *sc = file->private_data; | ||
962 | char *buf; | ||
963 | unsigned int len = 0, size = 1600; | ||
964 | ssize_t retval = 0; | ||
965 | |||
966 | buf = kzalloc(size, GFP_KERNEL); | ||
967 | if (buf == NULL) | ||
968 | return -ENOMEM; | ||
969 | |||
970 | RXS_ERR("PKTS-ALL", rx_pkts_all); | ||
971 | RXS_ERR("BYTES-ALL", rx_bytes_all); | ||
972 | RXS_ERR("BEACONS", rx_beacons); | ||
973 | RXS_ERR("FRAGS", rx_frags); | ||
974 | RXS_ERR("SPECTRAL", rx_spectral); | ||
975 | |||
976 | RXS_ERR("CRC ERR", crc_err); | ||
977 | RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err); | ||
978 | RXS_ERR("PHY ERR", phy_err); | ||
979 | RXS_ERR("MIC ERR", mic_err); | ||
980 | RXS_ERR("PRE-DELIM CRC ERR", pre_delim_crc_err); | ||
981 | RXS_ERR("POST-DELIM CRC ERR", post_delim_crc_err); | ||
982 | RXS_ERR("DECRYPT BUSY ERR", decrypt_busy_err); | ||
983 | RXS_ERR("LENGTH-ERR", rx_len_err); | ||
984 | RXS_ERR("OOM-ERR", rx_oom_err); | ||
985 | RXS_ERR("RATE-ERR", rx_rate_err); | ||
986 | RXS_ERR("TOO-MANY-FRAGS", rx_too_many_frags_err); | ||
987 | |||
988 | if (len > size) | ||
989 | len = size; | ||
990 | |||
991 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
992 | kfree(buf); | ||
993 | |||
994 | return retval; | ||
995 | |||
996 | #undef RXS_ERR | ||
997 | } | ||
998 | |||
999 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) | 951 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) |
1000 | { | 952 | { |
1001 | #define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++ | 953 | ath9k_cmn_debug_stat_rx(&sc->debug.stats.rxstats, rs); |
1002 | |||
1003 | RX_STAT_INC(rx_pkts_all); | ||
1004 | sc->debug.stats.rxstats.rx_bytes_all += rs->rs_datalen; | ||
1005 | |||
1006 | if (rs->rs_status & ATH9K_RXERR_CRC) | ||
1007 | RX_STAT_INC(crc_err); | ||
1008 | if (rs->rs_status & ATH9K_RXERR_DECRYPT) | ||
1009 | RX_STAT_INC(decrypt_crc_err); | ||
1010 | if (rs->rs_status & ATH9K_RXERR_MIC) | ||
1011 | RX_STAT_INC(mic_err); | ||
1012 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_PRE) | ||
1013 | RX_STAT_INC(pre_delim_crc_err); | ||
1014 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_POST) | ||
1015 | RX_STAT_INC(post_delim_crc_err); | ||
1016 | if (rs->rs_status & ATH9K_RX_DECRYPT_BUSY) | ||
1017 | RX_STAT_INC(decrypt_busy_err); | ||
1018 | |||
1019 | if (rs->rs_status & ATH9K_RXERR_PHY) { | ||
1020 | RX_STAT_INC(phy_err); | ||
1021 | if (rs->rs_phyerr < ATH9K_PHYERR_MAX) | ||
1022 | RX_PHY_ERR_INC(rs->rs_phyerr); | ||
1023 | } | ||
1024 | |||
1025 | #undef RX_PHY_ERR_INC | ||
1026 | } | 954 | } |
1027 | 955 | ||
1028 | static const struct file_operations fops_recv = { | ||
1029 | .read = read_file_recv, | ||
1030 | .open = simple_open, | ||
1031 | .owner = THIS_MODULE, | ||
1032 | .llseek = default_llseek, | ||
1033 | }; | ||
1034 | |||
1035 | static ssize_t read_file_phy_err(struct file *file, char __user *user_buf, | ||
1036 | size_t count, loff_t *ppos) | ||
1037 | { | ||
1038 | #define PHY_ERR(s, p) \ | ||
1039 | len += scnprintf(buf + len, size - len, "%22s : %10u\n", s, \ | ||
1040 | sc->debug.stats.rxstats.phy_err_stats[p]); | ||
1041 | |||
1042 | struct ath_softc *sc = file->private_data; | ||
1043 | char *buf; | ||
1044 | unsigned int len = 0, size = 1600; | ||
1045 | ssize_t retval = 0; | ||
1046 | |||
1047 | buf = kzalloc(size, GFP_KERNEL); | ||
1048 | if (buf == NULL) | ||
1049 | return -ENOMEM; | ||
1050 | |||
1051 | PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN); | ||
1052 | PHY_ERR("TIMING ERR", ATH9K_PHYERR_TIMING); | ||
1053 | PHY_ERR("PARITY ERR", ATH9K_PHYERR_PARITY); | ||
1054 | PHY_ERR("RATE ERR", ATH9K_PHYERR_RATE); | ||
1055 | PHY_ERR("LENGTH ERR", ATH9K_PHYERR_LENGTH); | ||
1056 | PHY_ERR("RADAR ERR", ATH9K_PHYERR_RADAR); | ||
1057 | PHY_ERR("SERVICE ERR", ATH9K_PHYERR_SERVICE); | ||
1058 | PHY_ERR("TOR ERR", ATH9K_PHYERR_TOR); | ||
1059 | PHY_ERR("OFDM-TIMING ERR", ATH9K_PHYERR_OFDM_TIMING); | ||
1060 | PHY_ERR("OFDM-SIGNAL-PARITY ERR", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); | ||
1061 | PHY_ERR("OFDM-RATE ERR", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); | ||
1062 | PHY_ERR("OFDM-LENGTH ERR", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); | ||
1063 | PHY_ERR("OFDM-POWER-DROP ERR", ATH9K_PHYERR_OFDM_POWER_DROP); | ||
1064 | PHY_ERR("OFDM-SERVICE ERR", ATH9K_PHYERR_OFDM_SERVICE); | ||
1065 | PHY_ERR("OFDM-RESTART ERR", ATH9K_PHYERR_OFDM_RESTART); | ||
1066 | PHY_ERR("FALSE-RADAR-EXT ERR", ATH9K_PHYERR_FALSE_RADAR_EXT); | ||
1067 | PHY_ERR("CCK-TIMING ERR", ATH9K_PHYERR_CCK_TIMING); | ||
1068 | PHY_ERR("CCK-HEADER-CRC ERR", ATH9K_PHYERR_CCK_HEADER_CRC); | ||
1069 | PHY_ERR("CCK-RATE ERR", ATH9K_PHYERR_CCK_RATE_ILLEGAL); | ||
1070 | PHY_ERR("CCK-SERVICE ERR", ATH9K_PHYERR_CCK_SERVICE); | ||
1071 | PHY_ERR("CCK-RESTART ERR", ATH9K_PHYERR_CCK_RESTART); | ||
1072 | PHY_ERR("CCK-LENGTH ERR", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); | ||
1073 | PHY_ERR("CCK-POWER-DROP ERR", ATH9K_PHYERR_CCK_POWER_DROP); | ||
1074 | PHY_ERR("HT-CRC ERR", ATH9K_PHYERR_HT_CRC_ERROR); | ||
1075 | PHY_ERR("HT-LENGTH ERR", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); | ||
1076 | PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL); | ||
1077 | |||
1078 | if (len > size) | ||
1079 | len = size; | ||
1080 | |||
1081 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1082 | kfree(buf); | ||
1083 | |||
1084 | return retval; | ||
1085 | |||
1086 | #undef PHY_ERR | ||
1087 | } | ||
1088 | |||
1089 | static const struct file_operations fops_phy_err = { | ||
1090 | .read = read_file_phy_err, | ||
1091 | .open = simple_open, | ||
1092 | .owner = THIS_MODULE, | ||
1093 | .llseek = default_llseek, | ||
1094 | }; | ||
1095 | |||
1096 | static ssize_t read_file_regidx(struct file *file, char __user *user_buf, | 956 | static ssize_t read_file_regidx(struct file *file, char __user *user_buf, |
1097 | size_t count, loff_t *ppos) | 957 | size_t count, loff_t *ppos) |
1098 | { | 958 | { |
@@ -1268,62 +1128,6 @@ static const struct file_operations fops_dump_nfcal = { | |||
1268 | .llseek = default_llseek, | 1128 | .llseek = default_llseek, |
1269 | }; | 1129 | }; |
1270 | 1130 | ||
1271 | static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, | ||
1272 | size_t count, loff_t *ppos) | ||
1273 | { | ||
1274 | struct ath_softc *sc = file->private_data; | ||
1275 | struct ath_hw *ah = sc->sc_ah; | ||
1276 | u32 len = 0, size = 1500; | ||
1277 | ssize_t retval = 0; | ||
1278 | char *buf; | ||
1279 | |||
1280 | buf = kzalloc(size, GFP_KERNEL); | ||
1281 | if (!buf) | ||
1282 | return -ENOMEM; | ||
1283 | |||
1284 | len = ah->eep_ops->dump_eeprom(ah, true, buf, len, size); | ||
1285 | |||
1286 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1287 | kfree(buf); | ||
1288 | |||
1289 | return retval; | ||
1290 | } | ||
1291 | |||
1292 | static const struct file_operations fops_base_eeprom = { | ||
1293 | .read = read_file_base_eeprom, | ||
1294 | .open = simple_open, | ||
1295 | .owner = THIS_MODULE, | ||
1296 | .llseek = default_llseek, | ||
1297 | }; | ||
1298 | |||
1299 | static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, | ||
1300 | size_t count, loff_t *ppos) | ||
1301 | { | ||
1302 | struct ath_softc *sc = file->private_data; | ||
1303 | struct ath_hw *ah = sc->sc_ah; | ||
1304 | u32 len = 0, size = 6000; | ||
1305 | char *buf; | ||
1306 | size_t retval; | ||
1307 | |||
1308 | buf = kzalloc(size, GFP_KERNEL); | ||
1309 | if (buf == NULL) | ||
1310 | return -ENOMEM; | ||
1311 | |||
1312 | len = ah->eep_ops->dump_eeprom(ah, false, buf, len, size); | ||
1313 | |||
1314 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1315 | kfree(buf); | ||
1316 | |||
1317 | return retval; | ||
1318 | } | ||
1319 | |||
1320 | static const struct file_operations fops_modal_eeprom = { | ||
1321 | .read = read_file_modal_eeprom, | ||
1322 | .open = simple_open, | ||
1323 | .owner = THIS_MODULE, | ||
1324 | .llseek = default_llseek, | ||
1325 | }; | ||
1326 | |||
1327 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT | 1131 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
1328 | static ssize_t read_file_btcoex(struct file *file, char __user *user_buf, | 1132 | static ssize_t read_file_btcoex(struct file *file, char __user *user_buf, |
1329 | size_t count, loff_t *ppos) | 1133 | size_t count, loff_t *ppos) |
@@ -1524,10 +1328,10 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1524 | &fops_misc); | 1328 | &fops_misc); |
1525 | debugfs_create_file("reset", S_IRUSR, sc->debug.debugfs_phy, sc, | 1329 | debugfs_create_file("reset", S_IRUSR, sc->debug.debugfs_phy, sc, |
1526 | &fops_reset); | 1330 | &fops_reset); |
1527 | debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, sc, | 1331 | |
1528 | &fops_recv); | 1332 | ath9k_cmn_debug_recv(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); |
1529 | debugfs_create_file("phy_err", S_IRUSR, sc->debug.debugfs_phy, sc, | 1333 | ath9k_cmn_debug_phy_err(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); |
1530 | &fops_phy_err); | 1334 | |
1531 | debugfs_create_u8("rx_chainmask", S_IRUSR, sc->debug.debugfs_phy, | 1335 | debugfs_create_u8("rx_chainmask", S_IRUSR, sc->debug.debugfs_phy, |
1532 | &ah->rxchainmask); | 1336 | &ah->rxchainmask); |
1533 | debugfs_create_u8("tx_chainmask", S_IRUSR, sc->debug.debugfs_phy, | 1337 | debugfs_create_u8("tx_chainmask", S_IRUSR, sc->debug.debugfs_phy, |
@@ -1547,10 +1351,10 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1547 | &fops_regdump); | 1351 | &fops_regdump); |
1548 | debugfs_create_file("dump_nfcal", S_IRUSR, sc->debug.debugfs_phy, sc, | 1352 | debugfs_create_file("dump_nfcal", S_IRUSR, sc->debug.debugfs_phy, sc, |
1549 | &fops_dump_nfcal); | 1353 | &fops_dump_nfcal); |
1550 | debugfs_create_file("base_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, | 1354 | |
1551 | &fops_base_eeprom); | 1355 | ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); |
1552 | debugfs_create_file("modal_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, | 1356 | ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); |
1553 | &fops_modal_eeprom); | 1357 | |
1554 | debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, | 1358 | debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, |
1555 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); | 1359 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); |
1556 | debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, | 1360 | debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, |
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h index 559a68c2709c..53ae15bd0c9d 100644 --- a/drivers/net/wireless/ath/ath9k/debug.h +++ b/drivers/net/wireless/ath/ath9k/debug.h | |||
@@ -221,50 +221,6 @@ struct ath_rx_rate_stats { | |||
221 | } cck_stats[4]; | 221 | } cck_stats[4]; |
222 | }; | 222 | }; |
223 | 223 | ||
224 | /** | ||
225 | * struct ath_rx_stats - RX Statistics | ||
226 | * @rx_pkts_all: No. of total frames received, including ones that | ||
227 | may have had errors. | ||
228 | * @rx_bytes_all: No. of total bytes received, including ones that | ||
229 | may have had errors. | ||
230 | * @crc_err: No. of frames with incorrect CRC value | ||
231 | * @decrypt_crc_err: No. of frames whose CRC check failed after | ||
232 | decryption process completed | ||
233 | * @phy_err: No. of frames whose reception failed because the PHY | ||
234 | encountered an error | ||
235 | * @mic_err: No. of frames with incorrect TKIP MIC verification failure | ||
236 | * @pre_delim_crc_err: Pre-Frame delimiter CRC error detections | ||
237 | * @post_delim_crc_err: Post-Frame delimiter CRC error detections | ||
238 | * @decrypt_busy_err: Decryption interruptions counter | ||
239 | * @phy_err_stats: Individual PHY error statistics | ||
240 | * @rx_len_err: No. of frames discarded due to bad length. | ||
241 | * @rx_oom_err: No. of frames dropped due to OOM issues. | ||
242 | * @rx_rate_err: No. of frames dropped due to rate errors. | ||
243 | * @rx_too_many_frags_err: Frames dropped due to too-many-frags received. | ||
244 | * @rx_beacons: No. of beacons received. | ||
245 | * @rx_frags: No. of rx-fragements received. | ||
246 | * @rx_spectral: No of spectral packets received. | ||
247 | */ | ||
248 | struct ath_rx_stats { | ||
249 | u32 rx_pkts_all; | ||
250 | u32 rx_bytes_all; | ||
251 | u32 crc_err; | ||
252 | u32 decrypt_crc_err; | ||
253 | u32 phy_err; | ||
254 | u32 mic_err; | ||
255 | u32 pre_delim_crc_err; | ||
256 | u32 post_delim_crc_err; | ||
257 | u32 decrypt_busy_err; | ||
258 | u32 phy_err_stats[ATH9K_PHYERR_MAX]; | ||
259 | u32 rx_len_err; | ||
260 | u32 rx_oom_err; | ||
261 | u32 rx_rate_err; | ||
262 | u32 rx_too_many_frags_err; | ||
263 | u32 rx_beacons; | ||
264 | u32 rx_frags; | ||
265 | u32 rx_spectral; | ||
266 | }; | ||
267 | |||
268 | #define ANT_MAIN 0 | 224 | #define ANT_MAIN 0 |
269 | #define ANT_ALT 1 | 225 | #define ANT_ALT 1 |
270 | 226 | ||
diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c index 857bb28b3894..726271c7c330 100644 --- a/drivers/net/wireless/ath/ath9k/dfs.c +++ b/drivers/net/wireless/ath/ath9k/dfs.c | |||
@@ -178,12 +178,12 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data, | |||
178 | pe.ts = mactime; | 178 | pe.ts = mactime; |
179 | if (ath9k_postprocess_radar_event(sc, &ard, &pe)) { | 179 | if (ath9k_postprocess_radar_event(sc, &ard, &pe)) { |
180 | struct dfs_pattern_detector *pd = sc->dfs_detector; | 180 | struct dfs_pattern_detector *pd = sc->dfs_detector; |
181 | static u64 last_ts; | ||
182 | ath_dbg(common, DFS, | 181 | ath_dbg(common, DFS, |
183 | "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, " | 182 | "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, " |
184 | "width=%d, rssi=%d, delta_ts=%llu\n", | 183 | "width=%d, rssi=%d, delta_ts=%llu\n", |
185 | pe.freq, pe.ts, pe.width, pe.rssi, pe.ts-last_ts); | 184 | pe.freq, pe.ts, pe.width, pe.rssi, |
186 | last_ts = pe.ts; | 185 | pe.ts - sc->dfs_prev_pulse_ts); |
186 | sc->dfs_prev_pulse_ts = pe.ts; | ||
187 | DFS_STAT_INC(sc, pulses_processed); | 187 | DFS_STAT_INC(sc, pulses_processed); |
188 | if (pd != NULL && pd->add_pulse(pd, &pe)) { | 188 | if (pd != NULL && pd->add_pulse(pd, &pe)) { |
189 | DFS_STAT_INC(sc, radar_detected); | 189 | DFS_STAT_INC(sc, radar_detected); |
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index dab1f0cab993..09a5d72f3ff5 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h | |||
@@ -325,14 +325,14 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb) | |||
325 | 325 | ||
326 | #define TX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) | 326 | #define TX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) |
327 | #define TX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) | 327 | #define TX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) |
328 | #define RX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.rx_stats.c++) | 328 | #define RX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) |
329 | #define RX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.rx_stats.c += a) | 329 | #define RX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a) |
330 | #define CAB_STAT_INC priv->debug.tx_stats.cab_queued++ | 330 | #define CAB_STAT_INC priv->debug.tx_stats.cab_queued++ |
331 | 331 | ||
332 | #define TX_QSTAT_INC(q) (priv->debug.tx_stats.queue_stats[q]++) | 332 | #define TX_QSTAT_INC(q) (priv->debug.tx_stats.queue_stats[q]++) |
333 | 333 | ||
334 | void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, | 334 | void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, |
335 | struct ath_htc_rx_status *rxs); | 335 | struct ath_rx_status *rs); |
336 | 336 | ||
337 | struct ath_tx_stats { | 337 | struct ath_tx_stats { |
338 | u32 buf_queued; | 338 | u32 buf_queued; |
@@ -345,25 +345,18 @@ struct ath_tx_stats { | |||
345 | u32 queue_stats[IEEE80211_NUM_ACS]; | 345 | u32 queue_stats[IEEE80211_NUM_ACS]; |
346 | }; | 346 | }; |
347 | 347 | ||
348 | struct ath_rx_stats { | 348 | struct ath_skbrx_stats { |
349 | u32 skb_allocated; | 349 | u32 skb_allocated; |
350 | u32 skb_completed; | 350 | u32 skb_completed; |
351 | u32 skb_completed_bytes; | 351 | u32 skb_completed_bytes; |
352 | u32 skb_dropped; | 352 | u32 skb_dropped; |
353 | u32 err_crc; | ||
354 | u32 err_decrypt_crc; | ||
355 | u32 err_mic; | ||
356 | u32 err_pre_delim; | ||
357 | u32 err_post_delim; | ||
358 | u32 err_decrypt_busy; | ||
359 | u32 err_phy; | ||
360 | u32 err_phy_stats[ATH9K_PHYERR_MAX]; | ||
361 | }; | 353 | }; |
362 | 354 | ||
363 | struct ath9k_debug { | 355 | struct ath9k_debug { |
364 | struct dentry *debugfs_phy; | 356 | struct dentry *debugfs_phy; |
365 | struct ath_tx_stats tx_stats; | 357 | struct ath_tx_stats tx_stats; |
366 | struct ath_rx_stats rx_stats; | 358 | struct ath_rx_stats rx_stats; |
359 | struct ath_skbrx_stats skbrx_stats; | ||
367 | }; | 360 | }; |
368 | 361 | ||
369 | void ath9k_htc_get_et_strings(struct ieee80211_hw *hw, | 362 | void ath9k_htc_get_et_strings(struct ieee80211_hw *hw, |
@@ -385,7 +378,7 @@ void ath9k_htc_get_et_stats(struct ieee80211_hw *hw, | |||
385 | #define TX_QSTAT_INC(c) do { } while (0) | 378 | #define TX_QSTAT_INC(c) do { } while (0) |
386 | 379 | ||
387 | static inline void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, | 380 | static inline void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, |
388 | struct ath_htc_rx_status *rxs) | 381 | struct ath_rx_status *rs) |
389 | { | 382 | { |
390 | } | 383 | } |
391 | 384 | ||
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c index fb071ee4fcfb..8b529e4b8ac4 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c | |||
@@ -243,39 +243,14 @@ static const struct file_operations fops_xmit = { | |||
243 | }; | 243 | }; |
244 | 244 | ||
245 | void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, | 245 | void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, |
246 | struct ath_htc_rx_status *rxs) | 246 | struct ath_rx_status *rs) |
247 | { | 247 | { |
248 | #define RX_PHY_ERR_INC(c) priv->debug.rx_stats.err_phy_stats[c]++ | 248 | ath9k_cmn_debug_stat_rx(&priv->debug.rx_stats, rs); |
249 | |||
250 | if (rxs->rs_status & ATH9K_RXERR_CRC) | ||
251 | priv->debug.rx_stats.err_crc++; | ||
252 | if (rxs->rs_status & ATH9K_RXERR_DECRYPT) | ||
253 | priv->debug.rx_stats.err_decrypt_crc++; | ||
254 | if (rxs->rs_status & ATH9K_RXERR_MIC) | ||
255 | priv->debug.rx_stats.err_mic++; | ||
256 | if (rxs->rs_status & ATH9K_RX_DELIM_CRC_PRE) | ||
257 | priv->debug.rx_stats.err_pre_delim++; | ||
258 | if (rxs->rs_status & ATH9K_RX_DELIM_CRC_POST) | ||
259 | priv->debug.rx_stats.err_post_delim++; | ||
260 | if (rxs->rs_status & ATH9K_RX_DECRYPT_BUSY) | ||
261 | priv->debug.rx_stats.err_decrypt_busy++; | ||
262 | |||
263 | if (rxs->rs_status & ATH9K_RXERR_PHY) { | ||
264 | priv->debug.rx_stats.err_phy++; | ||
265 | if (rxs->rs_phyerr < ATH9K_PHYERR_MAX) | ||
266 | RX_PHY_ERR_INC(rxs->rs_phyerr); | ||
267 | } | ||
268 | |||
269 | #undef RX_PHY_ERR_INC | ||
270 | } | 249 | } |
271 | 250 | ||
272 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, | 251 | static ssize_t read_file_skb_rx(struct file *file, char __user *user_buf, |
273 | size_t count, loff_t *ppos) | 252 | size_t count, loff_t *ppos) |
274 | { | 253 | { |
275 | #define PHY_ERR(s, p) \ | ||
276 | len += scnprintf(buf + len, size - len, "%20s : %10u\n", s, \ | ||
277 | priv->debug.rx_stats.err_phy_stats[p]); | ||
278 | |||
279 | struct ath9k_htc_priv *priv = file->private_data; | 254 | struct ath9k_htc_priv *priv = file->private_data; |
280 | char *buf; | 255 | char *buf; |
281 | unsigned int len = 0, size = 1500; | 256 | unsigned int len = 0, size = 1500; |
@@ -287,63 +262,13 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, | |||
287 | 262 | ||
288 | len += scnprintf(buf + len, size - len, | 263 | len += scnprintf(buf + len, size - len, |
289 | "%20s : %10u\n", "SKBs allocated", | 264 | "%20s : %10u\n", "SKBs allocated", |
290 | priv->debug.rx_stats.skb_allocated); | 265 | priv->debug.skbrx_stats.skb_allocated); |
291 | len += scnprintf(buf + len, size - len, | 266 | len += scnprintf(buf + len, size - len, |
292 | "%20s : %10u\n", "SKBs completed", | 267 | "%20s : %10u\n", "SKBs completed", |
293 | priv->debug.rx_stats.skb_completed); | 268 | priv->debug.skbrx_stats.skb_completed); |
294 | len += scnprintf(buf + len, size - len, | 269 | len += scnprintf(buf + len, size - len, |
295 | "%20s : %10u\n", "SKBs Dropped", | 270 | "%20s : %10u\n", "SKBs Dropped", |
296 | priv->debug.rx_stats.skb_dropped); | 271 | priv->debug.skbrx_stats.skb_dropped); |
297 | |||
298 | len += scnprintf(buf + len, size - len, | ||
299 | "%20s : %10u\n", "CRC ERR", | ||
300 | priv->debug.rx_stats.err_crc); | ||
301 | len += scnprintf(buf + len, size - len, | ||
302 | "%20s : %10u\n", "DECRYPT CRC ERR", | ||
303 | priv->debug.rx_stats.err_decrypt_crc); | ||
304 | len += scnprintf(buf + len, size - len, | ||
305 | "%20s : %10u\n", "MIC ERR", | ||
306 | priv->debug.rx_stats.err_mic); | ||
307 | len += scnprintf(buf + len, size - len, | ||
308 | "%20s : %10u\n", "PRE-DELIM CRC ERR", | ||
309 | priv->debug.rx_stats.err_pre_delim); | ||
310 | len += scnprintf(buf + len, size - len, | ||
311 | "%20s : %10u\n", "POST-DELIM CRC ERR", | ||
312 | priv->debug.rx_stats.err_post_delim); | ||
313 | len += scnprintf(buf + len, size - len, | ||
314 | "%20s : %10u\n", "DECRYPT BUSY ERR", | ||
315 | priv->debug.rx_stats.err_decrypt_busy); | ||
316 | len += scnprintf(buf + len, size - len, | ||
317 | "%20s : %10u\n", "TOTAL PHY ERR", | ||
318 | priv->debug.rx_stats.err_phy); | ||
319 | |||
320 | |||
321 | PHY_ERR("UNDERRUN", ATH9K_PHYERR_UNDERRUN); | ||
322 | PHY_ERR("TIMING", ATH9K_PHYERR_TIMING); | ||
323 | PHY_ERR("PARITY", ATH9K_PHYERR_PARITY); | ||
324 | PHY_ERR("RATE", ATH9K_PHYERR_RATE); | ||
325 | PHY_ERR("LENGTH", ATH9K_PHYERR_LENGTH); | ||
326 | PHY_ERR("RADAR", ATH9K_PHYERR_RADAR); | ||
327 | PHY_ERR("SERVICE", ATH9K_PHYERR_SERVICE); | ||
328 | PHY_ERR("TOR", ATH9K_PHYERR_TOR); | ||
329 | PHY_ERR("OFDM-TIMING", ATH9K_PHYERR_OFDM_TIMING); | ||
330 | PHY_ERR("OFDM-SIGNAL-PARITY", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); | ||
331 | PHY_ERR("OFDM-RATE", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); | ||
332 | PHY_ERR("OFDM-LENGTH", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); | ||
333 | PHY_ERR("OFDM-POWER-DROP", ATH9K_PHYERR_OFDM_POWER_DROP); | ||
334 | PHY_ERR("OFDM-SERVICE", ATH9K_PHYERR_OFDM_SERVICE); | ||
335 | PHY_ERR("OFDM-RESTART", ATH9K_PHYERR_OFDM_RESTART); | ||
336 | PHY_ERR("FALSE-RADAR-EXT", ATH9K_PHYERR_FALSE_RADAR_EXT); | ||
337 | PHY_ERR("CCK-TIMING", ATH9K_PHYERR_CCK_TIMING); | ||
338 | PHY_ERR("CCK-HEADER-CRC", ATH9K_PHYERR_CCK_HEADER_CRC); | ||
339 | PHY_ERR("CCK-RATE", ATH9K_PHYERR_CCK_RATE_ILLEGAL); | ||
340 | PHY_ERR("CCK-SERVICE", ATH9K_PHYERR_CCK_SERVICE); | ||
341 | PHY_ERR("CCK-RESTART", ATH9K_PHYERR_CCK_RESTART); | ||
342 | PHY_ERR("CCK-LENGTH", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); | ||
343 | PHY_ERR("CCK-POWER-DROP", ATH9K_PHYERR_CCK_POWER_DROP); | ||
344 | PHY_ERR("HT-CRC", ATH9K_PHYERR_HT_CRC_ERROR); | ||
345 | PHY_ERR("HT-LENGTH", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); | ||
346 | PHY_ERR("HT-RATE", ATH9K_PHYERR_HT_RATE_ILLEGAL); | ||
347 | 272 | ||
348 | if (len > size) | 273 | if (len > size) |
349 | len = size; | 274 | len = size; |
@@ -352,12 +277,10 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, | |||
352 | kfree(buf); | 277 | kfree(buf); |
353 | 278 | ||
354 | return retval; | 279 | return retval; |
355 | |||
356 | #undef PHY_ERR | ||
357 | } | 280 | } |
358 | 281 | ||
359 | static const struct file_operations fops_recv = { | 282 | static const struct file_operations fops_skb_rx = { |
360 | .read = read_file_recv, | 283 | .read = read_file_skb_rx, |
361 | .open = simple_open, | 284 | .open = simple_open, |
362 | .owner = THIS_MODULE, | 285 | .owner = THIS_MODULE, |
363 | .llseek = default_llseek, | 286 | .llseek = default_llseek, |
@@ -486,423 +409,6 @@ static const struct file_operations fops_debug = { | |||
486 | .llseek = default_llseek, | 409 | .llseek = default_llseek, |
487 | }; | 410 | }; |
488 | 411 | ||
489 | static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, | ||
490 | size_t count, loff_t *ppos) | ||
491 | { | ||
492 | struct ath9k_htc_priv *priv = file->private_data; | ||
493 | struct ath_common *common = ath9k_hw_common(priv->ah); | ||
494 | struct base_eep_header *pBase = NULL; | ||
495 | unsigned int len = 0, size = 1500; | ||
496 | ssize_t retval = 0; | ||
497 | char *buf; | ||
498 | |||
499 | pBase = ath9k_htc_get_eeprom_base(priv); | ||
500 | |||
501 | if (pBase == NULL) { | ||
502 | ath_err(common, "Unknown EEPROM type\n"); | ||
503 | return 0; | ||
504 | } | ||
505 | |||
506 | buf = kzalloc(size, GFP_KERNEL); | ||
507 | if (buf == NULL) | ||
508 | return -ENOMEM; | ||
509 | |||
510 | len += scnprintf(buf + len, size - len, | ||
511 | "%20s : %10d\n", "Major Version", | ||
512 | pBase->version >> 12); | ||
513 | len += scnprintf(buf + len, size - len, | ||
514 | "%20s : %10d\n", "Minor Version", | ||
515 | pBase->version & 0xFFF); | ||
516 | len += scnprintf(buf + len, size - len, | ||
517 | "%20s : %10d\n", "Checksum", | ||
518 | pBase->checksum); | ||
519 | len += scnprintf(buf + len, size - len, | ||
520 | "%20s : %10d\n", "Length", | ||
521 | pBase->length); | ||
522 | len += scnprintf(buf + len, size - len, | ||
523 | "%20s : %10d\n", "RegDomain1", | ||
524 | pBase->regDmn[0]); | ||
525 | len += scnprintf(buf + len, size - len, | ||
526 | "%20s : %10d\n", "RegDomain2", | ||
527 | pBase->regDmn[1]); | ||
528 | len += scnprintf(buf + len, size - len, | ||
529 | "%20s : %10d\n", | ||
530 | "TX Mask", pBase->txMask); | ||
531 | len += scnprintf(buf + len, size - len, | ||
532 | "%20s : %10d\n", | ||
533 | "RX Mask", pBase->rxMask); | ||
534 | len += scnprintf(buf + len, size - len, | ||
535 | "%20s : %10d\n", | ||
536 | "Allow 5GHz", | ||
537 | !!(pBase->opCapFlags & AR5416_OPFLAGS_11A)); | ||
538 | len += scnprintf(buf + len, size - len, | ||
539 | "%20s : %10d\n", | ||
540 | "Allow 2GHz", | ||
541 | !!(pBase->opCapFlags & AR5416_OPFLAGS_11G)); | ||
542 | len += scnprintf(buf + len, size - len, | ||
543 | "%20s : %10d\n", | ||
544 | "Disable 2GHz HT20", | ||
545 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT20)); | ||
546 | len += scnprintf(buf + len, size - len, | ||
547 | "%20s : %10d\n", | ||
548 | "Disable 2GHz HT40", | ||
549 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT40)); | ||
550 | len += scnprintf(buf + len, size - len, | ||
551 | "%20s : %10d\n", | ||
552 | "Disable 5Ghz HT20", | ||
553 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT20)); | ||
554 | len += scnprintf(buf + len, size - len, | ||
555 | "%20s : %10d\n", | ||
556 | "Disable 5Ghz HT40", | ||
557 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT40)); | ||
558 | len += scnprintf(buf + len, size - len, | ||
559 | "%20s : %10d\n", | ||
560 | "Big Endian", | ||
561 | !!(pBase->eepMisc & 0x01)); | ||
562 | len += scnprintf(buf + len, size - len, | ||
563 | "%20s : %10d\n", | ||
564 | "Cal Bin Major Ver", | ||
565 | (pBase->binBuildNumber >> 24) & 0xFF); | ||
566 | len += scnprintf(buf + len, size - len, | ||
567 | "%20s : %10d\n", | ||
568 | "Cal Bin Minor Ver", | ||
569 | (pBase->binBuildNumber >> 16) & 0xFF); | ||
570 | len += scnprintf(buf + len, size - len, | ||
571 | "%20s : %10d\n", | ||
572 | "Cal Bin Build", | ||
573 | (pBase->binBuildNumber >> 8) & 0xFF); | ||
574 | |||
575 | /* | ||
576 | * UB91 specific data. | ||
577 | */ | ||
578 | if (AR_SREV_9271(priv->ah)) { | ||
579 | struct base_eep_header_4k *pBase4k = | ||
580 | &priv->ah->eeprom.map4k.baseEepHeader; | ||
581 | |||
582 | len += scnprintf(buf + len, size - len, | ||
583 | "%20s : %10d\n", | ||
584 | "TX Gain type", | ||
585 | pBase4k->txGainType); | ||
586 | } | ||
587 | |||
588 | /* | ||
589 | * UB95 specific data. | ||
590 | */ | ||
591 | if (priv->ah->hw_version.usbdev == AR9287_USB) { | ||
592 | struct base_eep_ar9287_header *pBase9287 = | ||
593 | &priv->ah->eeprom.map9287.baseEepHeader; | ||
594 | |||
595 | len += scnprintf(buf + len, size - len, | ||
596 | "%20s : %10ddB\n", | ||
597 | "Power Table Offset", | ||
598 | pBase9287->pwrTableOffset); | ||
599 | |||
600 | len += scnprintf(buf + len, size - len, | ||
601 | "%20s : %10d\n", | ||
602 | "OpenLoop Power Ctrl", | ||
603 | pBase9287->openLoopPwrCntl); | ||
604 | } | ||
605 | |||
606 | len += scnprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress", | ||
607 | pBase->macAddr); | ||
608 | if (len > size) | ||
609 | len = size; | ||
610 | |||
611 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
612 | kfree(buf); | ||
613 | |||
614 | return retval; | ||
615 | } | ||
616 | |||
617 | static const struct file_operations fops_base_eeprom = { | ||
618 | .read = read_file_base_eeprom, | ||
619 | .open = simple_open, | ||
620 | .owner = THIS_MODULE, | ||
621 | .llseek = default_llseek, | ||
622 | }; | ||
623 | |||
624 | static ssize_t read_4k_modal_eeprom(struct file *file, | ||
625 | char __user *user_buf, | ||
626 | size_t count, loff_t *ppos) | ||
627 | { | ||
628 | #define PR_EEP(_s, _val) \ | ||
629 | do { \ | ||
630 | len += scnprintf(buf + len, size - len, "%20s : %10d\n",\ | ||
631 | _s, (_val)); \ | ||
632 | } while (0) | ||
633 | |||
634 | struct ath9k_htc_priv *priv = file->private_data; | ||
635 | struct modal_eep_4k_header *pModal = &priv->ah->eeprom.map4k.modalHeader; | ||
636 | unsigned int len = 0, size = 2048; | ||
637 | ssize_t retval = 0; | ||
638 | char *buf; | ||
639 | |||
640 | buf = kzalloc(size, GFP_KERNEL); | ||
641 | if (buf == NULL) | ||
642 | return -ENOMEM; | ||
643 | |||
644 | PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); | ||
645 | PR_EEP("Ant. Common Control", pModal->antCtrlCommon); | ||
646 | PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); | ||
647 | PR_EEP("Switch Settle", pModal->switchSettling); | ||
648 | PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); | ||
649 | PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); | ||
650 | PR_EEP("ADC Desired size", pModal->adcDesiredSize); | ||
651 | PR_EEP("PGA Desired size", pModal->pgaDesiredSize); | ||
652 | PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]); | ||
653 | PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); | ||
654 | PR_EEP("txEndToRxOn", pModal->txEndToRxOn); | ||
655 | PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); | ||
656 | PR_EEP("CCA Threshold)", pModal->thresh62); | ||
657 | PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); | ||
658 | PR_EEP("xpdGain", pModal->xpdGain); | ||
659 | PR_EEP("External PD", pModal->xpd); | ||
660 | PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); | ||
661 | PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); | ||
662 | PR_EEP("pdGainOverlap", pModal->pdGainOverlap); | ||
663 | PR_EEP("O/D Bias Version", pModal->version); | ||
664 | PR_EEP("CCK OutputBias", pModal->ob_0); | ||
665 | PR_EEP("BPSK OutputBias", pModal->ob_1); | ||
666 | PR_EEP("QPSK OutputBias", pModal->ob_2); | ||
667 | PR_EEP("16QAM OutputBias", pModal->ob_3); | ||
668 | PR_EEP("64QAM OutputBias", pModal->ob_4); | ||
669 | PR_EEP("CCK Driver1_Bias", pModal->db1_0); | ||
670 | PR_EEP("BPSK Driver1_Bias", pModal->db1_1); | ||
671 | PR_EEP("QPSK Driver1_Bias", pModal->db1_2); | ||
672 | PR_EEP("16QAM Driver1_Bias", pModal->db1_3); | ||
673 | PR_EEP("64QAM Driver1_Bias", pModal->db1_4); | ||
674 | PR_EEP("CCK Driver2_Bias", pModal->db2_0); | ||
675 | PR_EEP("BPSK Driver2_Bias", pModal->db2_1); | ||
676 | PR_EEP("QPSK Driver2_Bias", pModal->db2_2); | ||
677 | PR_EEP("16QAM Driver2_Bias", pModal->db2_3); | ||
678 | PR_EEP("64QAM Driver2_Bias", pModal->db2_4); | ||
679 | PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); | ||
680 | PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); | ||
681 | PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); | ||
682 | PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); | ||
683 | PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); | ||
684 | PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); | ||
685 | PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); | ||
686 | PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]); | ||
687 | PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]); | ||
688 | PR_EEP("Ant. Diversity ctl1", pModal->antdiv_ctl1); | ||
689 | PR_EEP("Ant. Diversity ctl2", pModal->antdiv_ctl2); | ||
690 | PR_EEP("TX Diversity", pModal->tx_diversity); | ||
691 | |||
692 | if (len > size) | ||
693 | len = size; | ||
694 | |||
695 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
696 | kfree(buf); | ||
697 | |||
698 | return retval; | ||
699 | |||
700 | #undef PR_EEP | ||
701 | } | ||
702 | |||
703 | static ssize_t read_def_modal_eeprom(struct file *file, | ||
704 | char __user *user_buf, | ||
705 | size_t count, loff_t *ppos) | ||
706 | { | ||
707 | #define PR_EEP(_s, _val) \ | ||
708 | do { \ | ||
709 | if (pBase->opCapFlags & AR5416_OPFLAGS_11G) { \ | ||
710 | pModal = &priv->ah->eeprom.def.modalHeader[1]; \ | ||
711 | len += scnprintf(buf + len, size - len, "%20s : %8d%7s", \ | ||
712 | _s, (_val), "|"); \ | ||
713 | } \ | ||
714 | if (pBase->opCapFlags & AR5416_OPFLAGS_11A) { \ | ||
715 | pModal = &priv->ah->eeprom.def.modalHeader[0]; \ | ||
716 | len += scnprintf(buf + len, size - len, "%9d\n",\ | ||
717 | (_val)); \ | ||
718 | } \ | ||
719 | } while (0) | ||
720 | |||
721 | struct ath9k_htc_priv *priv = file->private_data; | ||
722 | struct base_eep_header *pBase = &priv->ah->eeprom.def.baseEepHeader; | ||
723 | struct modal_eep_header *pModal = NULL; | ||
724 | unsigned int len = 0, size = 3500; | ||
725 | ssize_t retval = 0; | ||
726 | char *buf; | ||
727 | |||
728 | buf = kzalloc(size, GFP_KERNEL); | ||
729 | if (buf == NULL) | ||
730 | return -ENOMEM; | ||
731 | |||
732 | len += scnprintf(buf + len, size - len, | ||
733 | "%31s %15s\n", "2G", "5G"); | ||
734 | len += scnprintf(buf + len, size - len, | ||
735 | "%32s %16s\n", "====", "====\n"); | ||
736 | |||
737 | PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); | ||
738 | PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]); | ||
739 | PR_EEP("Chain2 Ant. Control", pModal->antCtrlChain[2]); | ||
740 | PR_EEP("Ant. Common Control", pModal->antCtrlCommon); | ||
741 | PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); | ||
742 | PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]); | ||
743 | PR_EEP("Chain2 Ant. Gain", pModal->antennaGainCh[2]); | ||
744 | PR_EEP("Switch Settle", pModal->switchSettling); | ||
745 | PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); | ||
746 | PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]); | ||
747 | PR_EEP("Chain2 TxRxAtten", pModal->txRxAttenCh[2]); | ||
748 | PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); | ||
749 | PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]); | ||
750 | PR_EEP("Chain2 RxTxMargin", pModal->rxTxMarginCh[2]); | ||
751 | PR_EEP("ADC Desired size", pModal->adcDesiredSize); | ||
752 | PR_EEP("PGA Desired size", pModal->pgaDesiredSize); | ||
753 | PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]); | ||
754 | PR_EEP("Chain1 xlna Gain", pModal->xlnaGainCh[1]); | ||
755 | PR_EEP("Chain2 xlna Gain", pModal->xlnaGainCh[2]); | ||
756 | PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); | ||
757 | PR_EEP("txEndToRxOn", pModal->txEndToRxOn); | ||
758 | PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); | ||
759 | PR_EEP("CCA Threshold)", pModal->thresh62); | ||
760 | PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); | ||
761 | PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]); | ||
762 | PR_EEP("Chain2 NF Threshold", pModal->noiseFloorThreshCh[2]); | ||
763 | PR_EEP("xpdGain", pModal->xpdGain); | ||
764 | PR_EEP("External PD", pModal->xpd); | ||
765 | PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); | ||
766 | PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]); | ||
767 | PR_EEP("Chain2 I Coefficient", pModal->iqCalICh[2]); | ||
768 | PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); | ||
769 | PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]); | ||
770 | PR_EEP("Chain2 Q Coefficient", pModal->iqCalQCh[2]); | ||
771 | PR_EEP("pdGainOverlap", pModal->pdGainOverlap); | ||
772 | PR_EEP("Chain0 OutputBias", pModal->ob); | ||
773 | PR_EEP("Chain0 DriverBias", pModal->db); | ||
774 | PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); | ||
775 | PR_EEP("2chain pwr decrease", pModal->pwrDecreaseFor2Chain); | ||
776 | PR_EEP("3chain pwr decrease", pModal->pwrDecreaseFor3Chain); | ||
777 | PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); | ||
778 | PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); | ||
779 | PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); | ||
780 | PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); | ||
781 | PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]); | ||
782 | PR_EEP("Chain2 bswAtten", pModal->bswAtten[2]); | ||
783 | PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); | ||
784 | PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]); | ||
785 | PR_EEP("Chain2 bswMargin", pModal->bswMargin[2]); | ||
786 | PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); | ||
787 | PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]); | ||
788 | PR_EEP("Chain1 xatten2Db", pModal->xatten2Db[1]); | ||
789 | PR_EEP("Chain2 xatten2Db", pModal->xatten2Db[2]); | ||
790 | PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]); | ||
791 | PR_EEP("Chain1 xatten2Margin", pModal->xatten2Margin[1]); | ||
792 | PR_EEP("Chain2 xatten2Margin", pModal->xatten2Margin[2]); | ||
793 | PR_EEP("Chain1 OutputBias", pModal->ob_ch1); | ||
794 | PR_EEP("Chain1 DriverBias", pModal->db_ch1); | ||
795 | PR_EEP("LNA Control", pModal->lna_ctl); | ||
796 | PR_EEP("XPA Bias Freq0", pModal->xpaBiasLvlFreq[0]); | ||
797 | PR_EEP("XPA Bias Freq1", pModal->xpaBiasLvlFreq[1]); | ||
798 | PR_EEP("XPA Bias Freq2", pModal->xpaBiasLvlFreq[2]); | ||
799 | |||
800 | if (len > size) | ||
801 | len = size; | ||
802 | |||
803 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
804 | kfree(buf); | ||
805 | |||
806 | return retval; | ||
807 | |||
808 | #undef PR_EEP | ||
809 | } | ||
810 | |||
811 | static ssize_t read_9287_modal_eeprom(struct file *file, | ||
812 | char __user *user_buf, | ||
813 | size_t count, loff_t *ppos) | ||
814 | { | ||
815 | #define PR_EEP(_s, _val) \ | ||
816 | do { \ | ||
817 | len += scnprintf(buf + len, size - len, "%20s : %10d\n",\ | ||
818 | _s, (_val)); \ | ||
819 | } while (0) | ||
820 | |||
821 | struct ath9k_htc_priv *priv = file->private_data; | ||
822 | struct modal_eep_ar9287_header *pModal = &priv->ah->eeprom.map9287.modalHeader; | ||
823 | unsigned int len = 0, size = 3000; | ||
824 | ssize_t retval = 0; | ||
825 | char *buf; | ||
826 | |||
827 | buf = kzalloc(size, GFP_KERNEL); | ||
828 | if (buf == NULL) | ||
829 | return -ENOMEM; | ||
830 | |||
831 | PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); | ||
832 | PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]); | ||
833 | PR_EEP("Ant. Common Control", pModal->antCtrlCommon); | ||
834 | PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); | ||
835 | PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]); | ||
836 | PR_EEP("Switch Settle", pModal->switchSettling); | ||
837 | PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); | ||
838 | PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]); | ||
839 | PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); | ||
840 | PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]); | ||
841 | PR_EEP("ADC Desired size", pModal->adcDesiredSize); | ||
842 | PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); | ||
843 | PR_EEP("txEndToRxOn", pModal->txEndToRxOn); | ||
844 | PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); | ||
845 | PR_EEP("CCA Threshold)", pModal->thresh62); | ||
846 | PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); | ||
847 | PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]); | ||
848 | PR_EEP("xpdGain", pModal->xpdGain); | ||
849 | PR_EEP("External PD", pModal->xpd); | ||
850 | PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); | ||
851 | PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]); | ||
852 | PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); | ||
853 | PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]); | ||
854 | PR_EEP("pdGainOverlap", pModal->pdGainOverlap); | ||
855 | PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); | ||
856 | PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); | ||
857 | PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); | ||
858 | PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); | ||
859 | PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); | ||
860 | PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]); | ||
861 | PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); | ||
862 | PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]); | ||
863 | PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); | ||
864 | PR_EEP("AR92x7 Version", pModal->version); | ||
865 | PR_EEP("DriverBias1", pModal->db1); | ||
866 | PR_EEP("DriverBias2", pModal->db1); | ||
867 | PR_EEP("CCK OutputBias", pModal->ob_cck); | ||
868 | PR_EEP("PSK OutputBias", pModal->ob_psk); | ||
869 | PR_EEP("QAM OutputBias", pModal->ob_qam); | ||
870 | PR_EEP("PAL_OFF OutputBias", pModal->ob_pal_off); | ||
871 | |||
872 | if (len > size) | ||
873 | len = size; | ||
874 | |||
875 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
876 | kfree(buf); | ||
877 | |||
878 | return retval; | ||
879 | |||
880 | #undef PR_EEP | ||
881 | } | ||
882 | |||
883 | static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, | ||
884 | size_t count, loff_t *ppos) | ||
885 | { | ||
886 | struct ath9k_htc_priv *priv = file->private_data; | ||
887 | |||
888 | if (AR_SREV_9271(priv->ah)) | ||
889 | return read_4k_modal_eeprom(file, user_buf, count, ppos); | ||
890 | else if (priv->ah->hw_version.usbdev == AR9280_USB) | ||
891 | return read_def_modal_eeprom(file, user_buf, count, ppos); | ||
892 | else if (priv->ah->hw_version.usbdev == AR9287_USB) | ||
893 | return read_9287_modal_eeprom(file, user_buf, count, ppos); | ||
894 | |||
895 | return 0; | ||
896 | } | ||
897 | |||
898 | static const struct file_operations fops_modal_eeprom = { | ||
899 | .read = read_file_modal_eeprom, | ||
900 | .open = simple_open, | ||
901 | .owner = THIS_MODULE, | ||
902 | .llseek = default_llseek, | ||
903 | }; | ||
904 | |||
905 | |||
906 | /* Ethtool support for get-stats */ | 412 | /* Ethtool support for get-stats */ |
907 | #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" | 413 | #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" |
908 | static const char ath9k_htc_gstrings_stats[][ETH_GSTRING_LEN] = { | 414 | static const char ath9k_htc_gstrings_stats[][ETH_GSTRING_LEN] = { |
@@ -947,6 +453,8 @@ int ath9k_htc_get_et_sset_count(struct ieee80211_hw *hw, | |||
947 | 453 | ||
948 | #define STXBASE priv->debug.tx_stats | 454 | #define STXBASE priv->debug.tx_stats |
949 | #define SRXBASE priv->debug.rx_stats | 455 | #define SRXBASE priv->debug.rx_stats |
456 | #define SKBTXBASE priv->debug.tx_stats | ||
457 | #define SKBRXBASE priv->debug.skbrx_stats | ||
950 | #define ASTXQ(a) \ | 458 | #define ASTXQ(a) \ |
951 | data[i++] = STXBASE.a[IEEE80211_AC_BE]; \ | 459 | data[i++] = STXBASE.a[IEEE80211_AC_BE]; \ |
952 | data[i++] = STXBASE.a[IEEE80211_AC_BK]; \ | 460 | data[i++] = STXBASE.a[IEEE80211_AC_BK]; \ |
@@ -960,24 +468,24 @@ void ath9k_htc_get_et_stats(struct ieee80211_hw *hw, | |||
960 | struct ath9k_htc_priv *priv = hw->priv; | 468 | struct ath9k_htc_priv *priv = hw->priv; |
961 | int i = 0; | 469 | int i = 0; |
962 | 470 | ||
963 | data[i++] = STXBASE.skb_success; | 471 | data[i++] = SKBTXBASE.skb_success; |
964 | data[i++] = STXBASE.skb_success_bytes; | 472 | data[i++] = SKBTXBASE.skb_success_bytes; |
965 | data[i++] = SRXBASE.skb_completed; | 473 | data[i++] = SKBRXBASE.skb_completed; |
966 | data[i++] = SRXBASE.skb_completed_bytes; | 474 | data[i++] = SKBRXBASE.skb_completed_bytes; |
967 | 475 | ||
968 | ASTXQ(queue_stats); | 476 | ASTXQ(queue_stats); |
969 | 477 | ||
970 | data[i++] = SRXBASE.err_crc; | 478 | data[i++] = SRXBASE.crc_err; |
971 | data[i++] = SRXBASE.err_decrypt_crc; | 479 | data[i++] = SRXBASE.decrypt_crc_err; |
972 | data[i++] = SRXBASE.err_phy; | 480 | data[i++] = SRXBASE.phy_err; |
973 | data[i++] = SRXBASE.err_mic; | 481 | data[i++] = SRXBASE.mic_err; |
974 | data[i++] = SRXBASE.err_pre_delim; | 482 | data[i++] = SRXBASE.pre_delim_crc_err; |
975 | data[i++] = SRXBASE.err_post_delim; | 483 | data[i++] = SRXBASE.post_delim_crc_err; |
976 | data[i++] = SRXBASE.err_decrypt_busy; | 484 | data[i++] = SRXBASE.decrypt_busy_err; |
977 | 485 | ||
978 | data[i++] = SRXBASE.err_phy_stats[ATH9K_PHYERR_RADAR]; | 486 | data[i++] = SRXBASE.phy_err_stats[ATH9K_PHYERR_RADAR]; |
979 | data[i++] = SRXBASE.err_phy_stats[ATH9K_PHYERR_OFDM_TIMING]; | 487 | data[i++] = SRXBASE.phy_err_stats[ATH9K_PHYERR_OFDM_TIMING]; |
980 | data[i++] = SRXBASE.err_phy_stats[ATH9K_PHYERR_CCK_TIMING]; | 488 | data[i++] = SRXBASE.phy_err_stats[ATH9K_PHYERR_CCK_TIMING]; |
981 | 489 | ||
982 | WARN_ON(i != ATH9K_HTC_SSTATS_LEN); | 490 | WARN_ON(i != ATH9K_HTC_SSTATS_LEN); |
983 | } | 491 | } |
@@ -1001,18 +509,21 @@ int ath9k_htc_init_debug(struct ath_hw *ah) | |||
1001 | priv, &fops_tgt_rx_stats); | 509 | priv, &fops_tgt_rx_stats); |
1002 | debugfs_create_file("xmit", S_IRUSR, priv->debug.debugfs_phy, | 510 | debugfs_create_file("xmit", S_IRUSR, priv->debug.debugfs_phy, |
1003 | priv, &fops_xmit); | 511 | priv, &fops_xmit); |
1004 | debugfs_create_file("recv", S_IRUSR, priv->debug.debugfs_phy, | 512 | debugfs_create_file("skb_rx", S_IRUSR, priv->debug.debugfs_phy, |
1005 | priv, &fops_recv); | 513 | priv, &fops_skb_rx); |
514 | |||
515 | ath9k_cmn_debug_recv(priv->debug.debugfs_phy, &priv->debug.rx_stats); | ||
516 | ath9k_cmn_debug_phy_err(priv->debug.debugfs_phy, &priv->debug.rx_stats); | ||
517 | |||
1006 | debugfs_create_file("slot", S_IRUSR, priv->debug.debugfs_phy, | 518 | debugfs_create_file("slot", S_IRUSR, priv->debug.debugfs_phy, |
1007 | priv, &fops_slot); | 519 | priv, &fops_slot); |
1008 | debugfs_create_file("queue", S_IRUSR, priv->debug.debugfs_phy, | 520 | debugfs_create_file("queue", S_IRUSR, priv->debug.debugfs_phy, |
1009 | priv, &fops_queue); | 521 | priv, &fops_queue); |
1010 | debugfs_create_file("debug", S_IRUSR | S_IWUSR, priv->debug.debugfs_phy, | 522 | debugfs_create_file("debug", S_IRUSR | S_IWUSR, priv->debug.debugfs_phy, |
1011 | priv, &fops_debug); | 523 | priv, &fops_debug); |
1012 | debugfs_create_file("base_eeprom", S_IRUSR, priv->debug.debugfs_phy, | 524 | |
1013 | priv, &fops_base_eeprom); | 525 | ath9k_cmn_debug_base_eeprom(priv->debug.debugfs_phy, priv->ah); |
1014 | debugfs_create_file("modal_eeprom", S_IRUSR, priv->debug.debugfs_phy, | 526 | ath9k_cmn_debug_modal_eeprom(priv->debug.debugfs_phy, priv->ah); |
1015 | priv, &fops_modal_eeprom); | ||
1016 | 527 | ||
1017 | return 0; | 528 | return 0; |
1018 | } | 529 | } |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index 289f3d8924b5..bb86eb2ffc95 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | |||
@@ -996,8 +996,6 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, | |||
996 | goto rx_next; | 996 | goto rx_next; |
997 | } | 997 | } |
998 | 998 | ||
999 | ath9k_htc_err_stat_rx(priv, rxstatus); | ||
1000 | |||
1001 | /* Get the RX status information */ | 999 | /* Get the RX status information */ |
1002 | 1000 | ||
1003 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); | 1001 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); |
@@ -1005,6 +1003,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, | |||
1005 | /* Copy everything from ath_htc_rx_status (HTC_RX_FRAME_HEADER). | 1003 | /* Copy everything from ath_htc_rx_status (HTC_RX_FRAME_HEADER). |
1006 | * After this, we can drop this part of skb. */ | 1004 | * After this, we can drop this part of skb. */ |
1007 | rx_status_htc_to_ath(&rx_stats, rxstatus); | 1005 | rx_status_htc_to_ath(&rx_stats, rxstatus); |
1006 | ath9k_htc_err_stat_rx(priv, &rx_stats); | ||
1008 | rx_status->mactime = be64_to_cpu(rxstatus->rs_tstamp); | 1007 | rx_status->mactime = be64_to_cpu(rxstatus->rs_tstamp); |
1009 | skb_pull(skb, HTC_RX_FRAME_HEADER_SIZE); | 1008 | skb_pull(skb, HTC_RX_FRAME_HEADER_SIZE); |
1010 | 1009 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index c8a9dfab1fee..2a8ed8375ec0 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include "ar9003_mac.h" | 26 | #include "ar9003_mac.h" |
27 | #include "ar9003_mci.h" | 27 | #include "ar9003_mci.h" |
28 | #include "ar9003_phy.h" | 28 | #include "ar9003_phy.h" |
29 | #include "debug.h" | ||
30 | #include "ath9k.h" | 29 | #include "ath9k.h" |
31 | 30 | ||
32 | static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type); | 31 | static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type); |
@@ -246,6 +245,8 @@ static void ath9k_hw_read_revisions(struct ath_hw *ah) | |||
246 | return; | 245 | return; |
247 | case AR9300_DEVID_AR953X: | 246 | case AR9300_DEVID_AR953X: |
248 | ah->hw_version.macVersion = AR_SREV_VERSION_9531; | 247 | ah->hw_version.macVersion = AR_SREV_VERSION_9531; |
248 | if (ah->get_mac_revision) | ||
249 | ah->hw_version.macRev = ah->get_mac_revision(); | ||
249 | return; | 250 | return; |
250 | } | 251 | } |
251 | 252 | ||
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 36ae6490e554..0246b990fe87 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -61,6 +61,10 @@ static int ath9k_ps_enable; | |||
61 | module_param_named(ps_enable, ath9k_ps_enable, int, 0444); | 61 | module_param_named(ps_enable, ath9k_ps_enable, int, 0444); |
62 | MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave"); | 62 | MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave"); |
63 | 63 | ||
64 | static int ath9k_use_chanctx; | ||
65 | module_param_named(use_chanctx, ath9k_use_chanctx, int, 0444); | ||
66 | MODULE_PARM_DESC(use_chanctx, "Enable channel context for concurrency"); | ||
67 | |||
64 | bool is_ath9k_unloaded; | 68 | bool is_ath9k_unloaded; |
65 | 69 | ||
66 | #ifdef CONFIG_MAC80211_LEDS | 70 | #ifdef CONFIG_MAC80211_LEDS |
@@ -508,7 +512,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, | |||
508 | sc->tx99_power = MAX_RATE_POWER + 1; | 512 | sc->tx99_power = MAX_RATE_POWER + 1; |
509 | init_waitqueue_head(&sc->tx_wait); | 513 | init_waitqueue_head(&sc->tx_wait); |
510 | 514 | ||
511 | if (!pdata) { | 515 | if (!pdata || pdata->use_eeprom) { |
512 | ah->ah_flags |= AH_USE_EEPROM; | 516 | ah->ah_flags |= AH_USE_EEPROM; |
513 | sc->sc_ah->led_pin = -1; | 517 | sc->sc_ah->led_pin = -1; |
514 | } else { | 518 | } else { |
@@ -589,6 +593,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, | |||
589 | if (ret) | 593 | if (ret) |
590 | goto err_btcoex; | 594 | goto err_btcoex; |
591 | 595 | ||
596 | sc->p2p_ps_timer = ath_gen_timer_alloc(sc->sc_ah, ath9k_p2p_ps_timer, | ||
597 | NULL, sc, AR_FIRST_NDP_TIMER); | ||
598 | |||
592 | ath9k_cmn_init_crypto(sc->sc_ah); | 599 | ath9k_cmn_init_crypto(sc->sc_ah); |
593 | ath9k_init_misc(sc); | 600 | ath9k_init_misc(sc); |
594 | ath_fill_led_pin(sc); | 601 | ath_fill_led_pin(sc); |
@@ -643,17 +650,20 @@ static void ath9k_init_txpower_limits(struct ath_softc *sc) | |||
643 | } | 650 | } |
644 | 651 | ||
645 | static const struct ieee80211_iface_limit if_limits[] = { | 652 | static const struct ieee80211_iface_limit if_limits[] = { |
646 | { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) | | 653 | { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) }, |
647 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | ||
648 | BIT(NL80211_IFTYPE_WDS) }, | ||
649 | { .max = 8, .types = | 654 | { .max = 8, .types = |
650 | #ifdef CONFIG_MAC80211_MESH | 655 | #ifdef CONFIG_MAC80211_MESH |
651 | BIT(NL80211_IFTYPE_MESH_POINT) | | 656 | BIT(NL80211_IFTYPE_MESH_POINT) | |
652 | #endif | 657 | #endif |
653 | BIT(NL80211_IFTYPE_AP) | | 658 | BIT(NL80211_IFTYPE_AP) }, |
659 | { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | | ||
654 | BIT(NL80211_IFTYPE_P2P_GO) }, | 660 | BIT(NL80211_IFTYPE_P2P_GO) }, |
655 | }; | 661 | }; |
656 | 662 | ||
663 | static const struct ieee80211_iface_limit wds_limits[] = { | ||
664 | { .max = 2048, .types = BIT(NL80211_IFTYPE_WDS) }, | ||
665 | }; | ||
666 | |||
657 | static const struct ieee80211_iface_limit if_dfs_limits[] = { | 667 | static const struct ieee80211_iface_limit if_dfs_limits[] = { |
658 | { .max = 1, .types = BIT(NL80211_IFTYPE_AP) | | 668 | { .max = 1, .types = BIT(NL80211_IFTYPE_AP) | |
659 | #ifdef CONFIG_MAC80211_MESH | 669 | #ifdef CONFIG_MAC80211_MESH |
@@ -670,6 +680,13 @@ static const struct ieee80211_iface_combination if_comb[] = { | |||
670 | .num_different_channels = 1, | 680 | .num_different_channels = 1, |
671 | .beacon_int_infra_match = true, | 681 | .beacon_int_infra_match = true, |
672 | }, | 682 | }, |
683 | { | ||
684 | .limits = wds_limits, | ||
685 | .n_limits = ARRAY_SIZE(wds_limits), | ||
686 | .max_interfaces = 2048, | ||
687 | .num_different_channels = 1, | ||
688 | .beacon_int_infra_match = true, | ||
689 | }, | ||
673 | #ifdef CONFIG_ATH9K_DFS_CERTIFIED | 690 | #ifdef CONFIG_ATH9K_DFS_CERTIFIED |
674 | { | 691 | { |
675 | .limits = if_dfs_limits, | 692 | .limits = if_dfs_limits, |
@@ -711,19 +728,23 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
711 | if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt) | 728 | if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt) |
712 | hw->flags |= IEEE80211_HW_MFP_CAPABLE; | 729 | hw->flags |= IEEE80211_HW_MFP_CAPABLE; |
713 | 730 | ||
714 | hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR; | 731 | hw->wiphy->features |= (NL80211_FEATURE_ACTIVE_MONITOR | |
732 | NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE); | ||
715 | 733 | ||
716 | if (!config_enabled(CONFIG_ATH9K_TX99)) { | 734 | if (!config_enabled(CONFIG_ATH9K_TX99)) { |
717 | hw->wiphy->interface_modes = | 735 | hw->wiphy->interface_modes = |
718 | BIT(NL80211_IFTYPE_P2P_GO) | | 736 | BIT(NL80211_IFTYPE_P2P_GO) | |
719 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | 737 | BIT(NL80211_IFTYPE_P2P_CLIENT) | |
720 | BIT(NL80211_IFTYPE_AP) | | 738 | BIT(NL80211_IFTYPE_AP) | |
721 | BIT(NL80211_IFTYPE_WDS) | | ||
722 | BIT(NL80211_IFTYPE_STATION) | | 739 | BIT(NL80211_IFTYPE_STATION) | |
723 | BIT(NL80211_IFTYPE_ADHOC) | | 740 | BIT(NL80211_IFTYPE_ADHOC) | |
724 | BIT(NL80211_IFTYPE_MESH_POINT); | 741 | BIT(NL80211_IFTYPE_MESH_POINT); |
725 | hw->wiphy->iface_combinations = if_comb; | 742 | hw->wiphy->iface_combinations = if_comb; |
726 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); | 743 | if (!ath9k_use_chanctx) { |
744 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); | ||
745 | hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_WDS); | ||
746 | } else | ||
747 | hw->wiphy->n_iface_combinations = 1; | ||
727 | } | 748 | } |
728 | 749 | ||
729 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 750 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
@@ -855,6 +876,9 @@ static void ath9k_deinit_softc(struct ath_softc *sc) | |||
855 | { | 876 | { |
856 | int i = 0; | 877 | int i = 0; |
857 | 878 | ||
879 | if (sc->p2p_ps_timer) | ||
880 | ath_gen_timer_free(sc->sc_ah, sc->p2p_ps_timer); | ||
881 | |||
858 | ath9k_deinit_btcoex(sc); | 882 | ath9k_deinit_btcoex(sc); |
859 | 883 | ||
860 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) | 884 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) |
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 51ce36f108f9..275205ab5f15 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -958,3 +958,25 @@ void ath9k_hw_set_interrupts(struct ath_hw *ah) | |||
958 | return; | 958 | return; |
959 | } | 959 | } |
960 | EXPORT_SYMBOL(ath9k_hw_set_interrupts); | 960 | EXPORT_SYMBOL(ath9k_hw_set_interrupts); |
961 | |||
962 | #define ATH9K_HW_MAX_DCU 10 | ||
963 | #define ATH9K_HW_SLICE_PER_DCU 16 | ||
964 | #define ATH9K_HW_BIT_IN_SLICE 16 | ||
965 | void ath9k_hw_set_tx_filter(struct ath_hw *ah, u8 destidx, bool set) | ||
966 | { | ||
967 | int dcu_idx; | ||
968 | u32 filter; | ||
969 | |||
970 | for (dcu_idx = 0; dcu_idx < 10; dcu_idx++) { | ||
971 | filter = SM(set, AR_D_TXBLK_WRITE_COMMAND); | ||
972 | filter |= SM(dcu_idx, AR_D_TXBLK_WRITE_DCU); | ||
973 | filter |= SM((destidx / ATH9K_HW_SLICE_PER_DCU), | ||
974 | AR_D_TXBLK_WRITE_SLICE); | ||
975 | filter |= BIT(destidx % ATH9K_HW_BIT_IN_SLICE); | ||
976 | ath_dbg(ath9k_hw_common(ah), PS, | ||
977 | "DCU%d staid %d set %d txfilter %08x\n", | ||
978 | dcu_idx, destidx, set, filter); | ||
979 | REG_WRITE(ah, AR_D_TXBLK_BASE, filter); | ||
980 | } | ||
981 | } | ||
982 | EXPORT_SYMBOL(ath9k_hw_set_tx_filter); | ||
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h index 89df634e81f9..da7686757535 100644 --- a/drivers/net/wireless/ath/ath9k/mac.h +++ b/drivers/net/wireless/ath/ath9k/mac.h | |||
@@ -729,6 +729,7 @@ void ath9k_hw_startpcureceive(struct ath_hw *ah, bool is_scanning); | |||
729 | void ath9k_hw_abortpcurecv(struct ath_hw *ah); | 729 | void ath9k_hw_abortpcurecv(struct ath_hw *ah); |
730 | bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset); | 730 | bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset); |
731 | int ath9k_hw_beaconq_setup(struct ath_hw *ah); | 731 | int ath9k_hw_beaconq_setup(struct ath_hw *ah); |
732 | void ath9k_hw_set_tx_filter(struct ath_hw *ah, u8 destidx, bool set); | ||
732 | 733 | ||
733 | /* Interrupt Handling */ | 734 | /* Interrupt Handling */ |
734 | bool ath9k_hw_intrpend(struct ath_hw *ah); | 735 | bool ath9k_hw_intrpend(struct ath_hw *ah); |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index d69853b848ce..62ac95d6bb9d 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -261,6 +261,8 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start) | |||
261 | sc->gtt_cnt = 0; | 261 | sc->gtt_cnt = 0; |
262 | ieee80211_wake_queues(sc->hw); | 262 | ieee80211_wake_queues(sc->hw); |
263 | 263 | ||
264 | ath9k_p2p_ps_timer(sc); | ||
265 | |||
264 | return true; | 266 | return true; |
265 | } | 267 | } |
266 | 268 | ||
@@ -419,6 +421,7 @@ static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
419 | an->sc = sc; | 421 | an->sc = sc; |
420 | an->sta = sta; | 422 | an->sta = sta; |
421 | an->vif = vif; | 423 | an->vif = vif; |
424 | memset(&an->key_idx, 0, sizeof(an->key_idx)); | ||
422 | 425 | ||
423 | ath_tx_node_init(sc, an); | 426 | ath_tx_node_init(sc, an); |
424 | } | 427 | } |
@@ -1119,6 +1122,8 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, | |||
1119 | if (ath9k_uses_beacons(vif->type)) | 1122 | if (ath9k_uses_beacons(vif->type)) |
1120 | ath9k_beacon_assign_slot(sc, vif); | 1123 | ath9k_beacon_assign_slot(sc, vif); |
1121 | 1124 | ||
1125 | avp->vif = vif; | ||
1126 | |||
1122 | an->sc = sc; | 1127 | an->sc = sc; |
1123 | an->sta = NULL; | 1128 | an->sta = NULL; |
1124 | an->vif = vif; | 1129 | an->vif = vif; |
@@ -1163,6 +1168,29 @@ static int ath9k_change_interface(struct ieee80211_hw *hw, | |||
1163 | return 0; | 1168 | return 0; |
1164 | } | 1169 | } |
1165 | 1170 | ||
1171 | static void | ||
1172 | ath9k_update_p2p_ps_timer(struct ath_softc *sc, struct ath_vif *avp) | ||
1173 | { | ||
1174 | struct ath_hw *ah = sc->sc_ah; | ||
1175 | s32 tsf, target_tsf; | ||
1176 | |||
1177 | if (!avp || !avp->noa.has_next_tsf) | ||
1178 | return; | ||
1179 | |||
1180 | ath9k_hw_gen_timer_stop(ah, sc->p2p_ps_timer); | ||
1181 | |||
1182 | tsf = ath9k_hw_gettsf32(sc->sc_ah); | ||
1183 | |||
1184 | target_tsf = avp->noa.next_tsf; | ||
1185 | if (!avp->noa.absent) | ||
1186 | target_tsf -= ATH_P2P_PS_STOP_TIME; | ||
1187 | |||
1188 | if (target_tsf - tsf < ATH_P2P_PS_STOP_TIME) | ||
1189 | target_tsf = tsf + ATH_P2P_PS_STOP_TIME; | ||
1190 | |||
1191 | ath9k_hw_gen_timer_start(ah, sc->p2p_ps_timer, (u32) target_tsf, 1000000); | ||
1192 | } | ||
1193 | |||
1166 | static void ath9k_remove_interface(struct ieee80211_hw *hw, | 1194 | static void ath9k_remove_interface(struct ieee80211_hw *hw, |
1167 | struct ieee80211_vif *vif) | 1195 | struct ieee80211_vif *vif) |
1168 | { | 1196 | { |
@@ -1174,6 +1202,13 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
1174 | 1202 | ||
1175 | mutex_lock(&sc->mutex); | 1203 | mutex_lock(&sc->mutex); |
1176 | 1204 | ||
1205 | spin_lock_bh(&sc->sc_pcu_lock); | ||
1206 | if (avp == sc->p2p_ps_vif) { | ||
1207 | sc->p2p_ps_vif = NULL; | ||
1208 | ath9k_update_p2p_ps_timer(sc, NULL); | ||
1209 | } | ||
1210 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
1211 | |||
1177 | sc->nvifs--; | 1212 | sc->nvifs--; |
1178 | sc->tx99_vif = NULL; | 1213 | sc->tx99_vif = NULL; |
1179 | 1214 | ||
@@ -1427,8 +1462,10 @@ static int ath9k_sta_add(struct ieee80211_hw *hw, | |||
1427 | return 0; | 1462 | return 0; |
1428 | 1463 | ||
1429 | key = ath_key_config(common, vif, sta, &ps_key); | 1464 | key = ath_key_config(common, vif, sta, &ps_key); |
1430 | if (key > 0) | 1465 | if (key > 0) { |
1431 | an->ps_key = key; | 1466 | an->ps_key = key; |
1467 | an->key_idx[0] = key; | ||
1468 | } | ||
1432 | 1469 | ||
1433 | return 0; | 1470 | return 0; |
1434 | } | 1471 | } |
@@ -1446,6 +1483,7 @@ static void ath9k_del_ps_key(struct ath_softc *sc, | |||
1446 | 1483 | ||
1447 | ath_key_delete(common, &ps_key); | 1484 | ath_key_delete(common, &ps_key); |
1448 | an->ps_key = 0; | 1485 | an->ps_key = 0; |
1486 | an->key_idx[0] = 0; | ||
1449 | } | 1487 | } |
1450 | 1488 | ||
1451 | static int ath9k_sta_remove(struct ieee80211_hw *hw, | 1489 | static int ath9k_sta_remove(struct ieee80211_hw *hw, |
@@ -1460,6 +1498,19 @@ static int ath9k_sta_remove(struct ieee80211_hw *hw, | |||
1460 | return 0; | 1498 | return 0; |
1461 | } | 1499 | } |
1462 | 1500 | ||
1501 | static void ath9k_sta_set_tx_filter(struct ath_hw *ah, | ||
1502 | struct ath_node *an, | ||
1503 | bool set) | ||
1504 | { | ||
1505 | int i; | ||
1506 | |||
1507 | for (i = 0; i < ARRAY_SIZE(an->key_idx); i++) { | ||
1508 | if (!an->key_idx[i]) | ||
1509 | continue; | ||
1510 | ath9k_hw_set_tx_filter(ah, an->key_idx[i], set); | ||
1511 | } | ||
1512 | } | ||
1513 | |||
1463 | static void ath9k_sta_notify(struct ieee80211_hw *hw, | 1514 | static void ath9k_sta_notify(struct ieee80211_hw *hw, |
1464 | struct ieee80211_vif *vif, | 1515 | struct ieee80211_vif *vif, |
1465 | enum sta_notify_cmd cmd, | 1516 | enum sta_notify_cmd cmd, |
@@ -1472,8 +1523,10 @@ static void ath9k_sta_notify(struct ieee80211_hw *hw, | |||
1472 | case STA_NOTIFY_SLEEP: | 1523 | case STA_NOTIFY_SLEEP: |
1473 | an->sleeping = true; | 1524 | an->sleeping = true; |
1474 | ath_tx_aggr_sleep(sta, sc, an); | 1525 | ath_tx_aggr_sleep(sta, sc, an); |
1526 | ath9k_sta_set_tx_filter(sc->sc_ah, an, true); | ||
1475 | break; | 1527 | break; |
1476 | case STA_NOTIFY_AWAKE: | 1528 | case STA_NOTIFY_AWAKE: |
1529 | ath9k_sta_set_tx_filter(sc->sc_ah, an, false); | ||
1477 | an->sleeping = false; | 1530 | an->sleeping = false; |
1478 | ath_tx_aggr_wakeup(sc, an); | 1531 | ath_tx_aggr_wakeup(sc, an); |
1479 | break; | 1532 | break; |
@@ -1529,7 +1582,8 @@ static int ath9k_set_key(struct ieee80211_hw *hw, | |||
1529 | { | 1582 | { |
1530 | struct ath_softc *sc = hw->priv; | 1583 | struct ath_softc *sc = hw->priv; |
1531 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1584 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1532 | int ret = 0; | 1585 | struct ath_node *an = NULL; |
1586 | int ret = 0, i; | ||
1533 | 1587 | ||
1534 | if (ath9k_modparam_nohwcrypt) | 1588 | if (ath9k_modparam_nohwcrypt) |
1535 | return -ENOSPC; | 1589 | return -ENOSPC; |
@@ -1551,13 +1605,16 @@ static int ath9k_set_key(struct ieee80211_hw *hw, | |||
1551 | 1605 | ||
1552 | mutex_lock(&sc->mutex); | 1606 | mutex_lock(&sc->mutex); |
1553 | ath9k_ps_wakeup(sc); | 1607 | ath9k_ps_wakeup(sc); |
1554 | ath_dbg(common, CONFIG, "Set HW Key\n"); | 1608 | ath_dbg(common, CONFIG, "Set HW Key %d\n", cmd); |
1609 | if (sta) | ||
1610 | an = (struct ath_node *)sta->drv_priv; | ||
1555 | 1611 | ||
1556 | switch (cmd) { | 1612 | switch (cmd) { |
1557 | case SET_KEY: | 1613 | case SET_KEY: |
1558 | if (sta) | 1614 | if (sta) |
1559 | ath9k_del_ps_key(sc, vif, sta); | 1615 | ath9k_del_ps_key(sc, vif, sta); |
1560 | 1616 | ||
1617 | key->hw_key_idx = 0; | ||
1561 | ret = ath_key_config(common, vif, sta, key); | 1618 | ret = ath_key_config(common, vif, sta, key); |
1562 | if (ret >= 0) { | 1619 | if (ret >= 0) { |
1563 | key->hw_key_idx = ret; | 1620 | key->hw_key_idx = ret; |
@@ -1570,9 +1627,27 @@ static int ath9k_set_key(struct ieee80211_hw *hw, | |||
1570 | key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; | 1627 | key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; |
1571 | ret = 0; | 1628 | ret = 0; |
1572 | } | 1629 | } |
1630 | if (an && key->hw_key_idx) { | ||
1631 | for (i = 0; i < ARRAY_SIZE(an->key_idx); i++) { | ||
1632 | if (an->key_idx[i]) | ||
1633 | continue; | ||
1634 | an->key_idx[i] = key->hw_key_idx; | ||
1635 | break; | ||
1636 | } | ||
1637 | WARN_ON(i == ARRAY_SIZE(an->key_idx)); | ||
1638 | } | ||
1573 | break; | 1639 | break; |
1574 | case DISABLE_KEY: | 1640 | case DISABLE_KEY: |
1575 | ath_key_delete(common, key); | 1641 | ath_key_delete(common, key); |
1642 | if (an) { | ||
1643 | for (i = 0; i < ARRAY_SIZE(an->key_idx); i++) { | ||
1644 | if (an->key_idx[i] != key->hw_key_idx) | ||
1645 | continue; | ||
1646 | an->key_idx[i] = 0; | ||
1647 | break; | ||
1648 | } | ||
1649 | } | ||
1650 | key->hw_key_idx = 0; | ||
1576 | break; | 1651 | break; |
1577 | default: | 1652 | default: |
1578 | ret = -EINVAL; | 1653 | ret = -EINVAL; |
@@ -1636,6 +1711,66 @@ static void ath9k_bss_assoc_iter(void *data, u8 *mac, struct ieee80211_vif *vif) | |||
1636 | ath9k_set_assoc_state(sc, vif); | 1711 | ath9k_set_assoc_state(sc, vif); |
1637 | } | 1712 | } |
1638 | 1713 | ||
1714 | void ath9k_p2p_ps_timer(void *priv) | ||
1715 | { | ||
1716 | struct ath_softc *sc = priv; | ||
1717 | struct ath_vif *avp = sc->p2p_ps_vif; | ||
1718 | struct ieee80211_vif *vif; | ||
1719 | struct ieee80211_sta *sta; | ||
1720 | struct ath_node *an; | ||
1721 | u32 tsf; | ||
1722 | |||
1723 | if (!avp) | ||
1724 | return; | ||
1725 | |||
1726 | tsf = ath9k_hw_gettsf32(sc->sc_ah); | ||
1727 | if (!avp->noa.absent) | ||
1728 | tsf += ATH_P2P_PS_STOP_TIME; | ||
1729 | |||
1730 | if (!avp->noa.has_next_tsf || | ||
1731 | avp->noa.next_tsf - tsf > BIT(31)) | ||
1732 | ieee80211_update_p2p_noa(&avp->noa, tsf); | ||
1733 | |||
1734 | ath9k_update_p2p_ps_timer(sc, avp); | ||
1735 | |||
1736 | rcu_read_lock(); | ||
1737 | |||
1738 | vif = avp->vif; | ||
1739 | sta = ieee80211_find_sta(vif, vif->bss_conf.bssid); | ||
1740 | if (!sta) | ||
1741 | goto out; | ||
1742 | |||
1743 | an = (void *) sta->drv_priv; | ||
1744 | if (an->sleeping == !!avp->noa.absent) | ||
1745 | goto out; | ||
1746 | |||
1747 | an->sleeping = avp->noa.absent; | ||
1748 | if (an->sleeping) | ||
1749 | ath_tx_aggr_sleep(sta, sc, an); | ||
1750 | else | ||
1751 | ath_tx_aggr_wakeup(sc, an); | ||
1752 | |||
1753 | out: | ||
1754 | rcu_read_unlock(); | ||
1755 | } | ||
1756 | |||
1757 | void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif) | ||
1758 | { | ||
1759 | struct ath_vif *avp = (void *)vif->drv_priv; | ||
1760 | u32 tsf; | ||
1761 | |||
1762 | if (!sc->p2p_ps_timer) | ||
1763 | return; | ||
1764 | |||
1765 | if (vif->type != NL80211_IFTYPE_STATION || !vif->p2p) | ||
1766 | return; | ||
1767 | |||
1768 | sc->p2p_ps_vif = avp; | ||
1769 | tsf = ath9k_hw_gettsf32(sc->sc_ah); | ||
1770 | ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf); | ||
1771 | ath9k_update_p2p_ps_timer(sc, avp); | ||
1772 | } | ||
1773 | |||
1639 | static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | 1774 | static void ath9k_bss_info_changed(struct ieee80211_hw *hw, |
1640 | struct ieee80211_vif *vif, | 1775 | struct ieee80211_vif *vif, |
1641 | struct ieee80211_bss_conf *bss_conf, | 1776 | struct ieee80211_bss_conf *bss_conf, |
@@ -1650,6 +1785,7 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | |||
1650 | struct ath_hw *ah = sc->sc_ah; | 1785 | struct ath_hw *ah = sc->sc_ah; |
1651 | struct ath_common *common = ath9k_hw_common(ah); | 1786 | struct ath_common *common = ath9k_hw_common(ah); |
1652 | struct ath_vif *avp = (void *)vif->drv_priv; | 1787 | struct ath_vif *avp = (void *)vif->drv_priv; |
1788 | unsigned long flags; | ||
1653 | int slottime; | 1789 | int slottime; |
1654 | 1790 | ||
1655 | ath9k_ps_wakeup(sc); | 1791 | ath9k_ps_wakeup(sc); |
@@ -1710,6 +1846,15 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | |||
1710 | } | 1846 | } |
1711 | } | 1847 | } |
1712 | 1848 | ||
1849 | if (changed & BSS_CHANGED_P2P_PS) { | ||
1850 | spin_lock_bh(&sc->sc_pcu_lock); | ||
1851 | spin_lock_irqsave(&sc->sc_pm_lock, flags); | ||
1852 | if (!(sc->ps_flags & PS_BEACON_SYNC)) | ||
1853 | ath9k_update_p2p_ps(sc, vif); | ||
1854 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | ||
1855 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
1856 | } | ||
1857 | |||
1713 | if (changed & CHECK_ANI) | 1858 | if (changed & CHECK_ANI) |
1714 | ath_check_ani(sc); | 1859 | ath_check_ani(sc); |
1715 | 1860 | ||
@@ -1883,7 +2028,8 @@ static bool ath9k_has_tx_pending(struct ath_softc *sc) | |||
1883 | return !!npend; | 2028 | return !!npend; |
1884 | } | 2029 | } |
1885 | 2030 | ||
1886 | static void ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 2031 | static void ath9k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2032 | u32 queues, bool drop) | ||
1887 | { | 2033 | { |
1888 | struct ath_softc *sc = hw->priv; | 2034 | struct ath_softc *sc = hw->priv; |
1889 | struct ath_hw *ah = sc->sc_ah; | 2035 | struct ath_hw *ah = sc->sc_ah; |
@@ -2084,14 +2230,6 @@ static void ath9k_sw_scan_complete(struct ieee80211_hw *hw) | |||
2084 | clear_bit(ATH_OP_SCANNING, &common->op_flags); | 2230 | clear_bit(ATH_OP_SCANNING, &common->op_flags); |
2085 | } | 2231 | } |
2086 | 2232 | ||
2087 | static void ath9k_channel_switch_beacon(struct ieee80211_hw *hw, | ||
2088 | struct ieee80211_vif *vif, | ||
2089 | struct cfg80211_chan_def *chandef) | ||
2090 | { | ||
2091 | /* depend on vif->csa_active only */ | ||
2092 | return; | ||
2093 | } | ||
2094 | |||
2095 | struct ieee80211_ops ath9k_ops = { | 2233 | struct ieee80211_ops ath9k_ops = { |
2096 | .tx = ath9k_tx, | 2234 | .tx = ath9k_tx, |
2097 | .start = ath9k_start, | 2235 | .start = ath9k_start, |
@@ -2139,5 +2277,4 @@ struct ieee80211_ops ath9k_ops = { | |||
2139 | #endif | 2277 | #endif |
2140 | .sw_scan_start = ath9k_sw_scan_start, | 2278 | .sw_scan_start = ath9k_sw_scan_start, |
2141 | .sw_scan_complete = ath9k_sw_scan_complete, | 2279 | .sw_scan_complete = ath9k_sw_scan_complete, |
2142 | .channel_switch_beacon = ath9k_channel_switch_beacon, | ||
2143 | }; | 2280 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index 914dbc6b1720..4dec09e565ed 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c | |||
@@ -686,7 +686,7 @@ static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data) | |||
686 | struct ath_softc *sc = (struct ath_softc *) common->priv; | 686 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
687 | struct ath9k_platform_data *pdata = sc->dev->platform_data; | 687 | struct ath9k_platform_data *pdata = sc->dev->platform_data; |
688 | 688 | ||
689 | if (pdata) { | 689 | if (pdata && !pdata->use_eeprom) { |
690 | if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { | 690 | if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { |
691 | ath_err(common, | 691 | ath_err(common, |
692 | "%s: eeprom read failed, offset %08x is out of range\n", | 692 | "%s: eeprom read failed, offset %08x is out of range\n", |
@@ -914,6 +914,7 @@ static int ath_pci_suspend(struct device *device) | |||
914 | */ | 914 | */ |
915 | ath9k_stop_btcoex(sc); | 915 | ath9k_stop_btcoex(sc); |
916 | ath9k_hw_disable(sc->sc_ah); | 916 | ath9k_hw_disable(sc->sc_ah); |
917 | del_timer_sync(&sc->sleep_timer); | ||
917 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP); | 918 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP); |
918 | 919 | ||
919 | return 0; | 920 | return 0; |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 19df969ec909..9105a92364f7 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -34,7 +34,8 @@ static inline bool ath9k_check_auto_sleep(struct ath_softc *sc) | |||
34 | * buffer (or rx fifo). This can incorrectly acknowledge packets | 34 | * buffer (or rx fifo). This can incorrectly acknowledge packets |
35 | * to a sender if last desc is self-linked. | 35 | * to a sender if last desc is self-linked. |
36 | */ | 36 | */ |
37 | static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf) | 37 | static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf, |
38 | bool flush) | ||
38 | { | 39 | { |
39 | struct ath_hw *ah = sc->sc_ah; | 40 | struct ath_hw *ah = sc->sc_ah; |
40 | struct ath_common *common = ath9k_hw_common(ah); | 41 | struct ath_common *common = ath9k_hw_common(ah); |
@@ -59,18 +60,19 @@ static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf) | |||
59 | common->rx_bufsize, | 60 | common->rx_bufsize, |
60 | 0); | 61 | 0); |
61 | 62 | ||
62 | if (sc->rx.rxlink == NULL) | 63 | if (sc->rx.rxlink) |
63 | ath9k_hw_putrxbuf(ah, bf->bf_daddr); | ||
64 | else | ||
65 | *sc->rx.rxlink = bf->bf_daddr; | 64 | *sc->rx.rxlink = bf->bf_daddr; |
65 | else if (!flush) | ||
66 | ath9k_hw_putrxbuf(ah, bf->bf_daddr); | ||
66 | 67 | ||
67 | sc->rx.rxlink = &ds->ds_link; | 68 | sc->rx.rxlink = &ds->ds_link; |
68 | } | 69 | } |
69 | 70 | ||
70 | static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf) | 71 | static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf, |
72 | bool flush) | ||
71 | { | 73 | { |
72 | if (sc->rx.buf_hold) | 74 | if (sc->rx.buf_hold) |
73 | ath_rx_buf_link(sc, sc->rx.buf_hold); | 75 | ath_rx_buf_link(sc, sc->rx.buf_hold, flush); |
74 | 76 | ||
75 | sc->rx.buf_hold = bf; | 77 | sc->rx.buf_hold = bf; |
76 | } | 78 | } |
@@ -442,7 +444,7 @@ int ath_startrecv(struct ath_softc *sc) | |||
442 | sc->rx.buf_hold = NULL; | 444 | sc->rx.buf_hold = NULL; |
443 | sc->rx.rxlink = NULL; | 445 | sc->rx.rxlink = NULL; |
444 | list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) { | 446 | list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) { |
445 | ath_rx_buf_link(sc, bf); | 447 | ath_rx_buf_link(sc, bf, false); |
446 | } | 448 | } |
447 | 449 | ||
448 | /* We could have deleted elements so the list may be empty now */ | 450 | /* We could have deleted elements so the list may be empty now */ |
@@ -538,7 +540,10 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb) | |||
538 | sc->ps_flags &= ~PS_BEACON_SYNC; | 540 | sc->ps_flags &= ~PS_BEACON_SYNC; |
539 | ath_dbg(common, PS, | 541 | ath_dbg(common, PS, |
540 | "Reconfigure beacon timers based on synchronized timestamp\n"); | 542 | "Reconfigure beacon timers based on synchronized timestamp\n"); |
541 | ath9k_set_beacon(sc); | 543 | if (!(WARN_ON_ONCE(sc->cur_beacon_conf.beacon_interval == 0))) |
544 | ath9k_set_beacon(sc); | ||
545 | if (sc->p2p_ps_vif) | ||
546 | ath9k_update_p2p_ps(sc, sc->p2p_ps_vif->vif); | ||
542 | } | 547 | } |
543 | 548 | ||
544 | if (ath_beacon_dtim_pending_cab(skb)) { | 549 | if (ath_beacon_dtim_pending_cab(skb)) { |
@@ -1115,12 +1120,12 @@ requeue_drop_frag: | |||
1115 | requeue: | 1120 | requeue: |
1116 | list_add_tail(&bf->list, &sc->rx.rxbuf); | 1121 | list_add_tail(&bf->list, &sc->rx.rxbuf); |
1117 | 1122 | ||
1118 | if (edma) { | 1123 | if (!edma) { |
1119 | ath_rx_edma_buf_link(sc, qtype); | 1124 | ath_rx_buf_relink(sc, bf, flush); |
1120 | } else { | ||
1121 | ath_rx_buf_relink(sc, bf); | ||
1122 | if (!flush) | 1125 | if (!flush) |
1123 | ath9k_hw_rxena(ah); | 1126 | ath9k_hw_rxena(ah); |
1127 | } else if (!flush) { | ||
1128 | ath_rx_edma_buf_link(sc, qtype); | ||
1124 | } | 1129 | } |
1125 | 1130 | ||
1126 | if (!budget--) | 1131 | if (!budget--) |
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h index b1fd3fa84983..f1bbce3f7774 100644 --- a/drivers/net/wireless/ath/ath9k/reg.h +++ b/drivers/net/wireless/ath/ath9k/reg.h | |||
@@ -505,9 +505,6 @@ | |||
505 | #define AR_D_QCUMASK 0x000003FF | 505 | #define AR_D_QCUMASK 0x000003FF |
506 | #define AR_D_QCUMASK_RESV0 0xFFFFFC00 | 506 | #define AR_D_QCUMASK_RESV0 0xFFFFFC00 |
507 | 507 | ||
508 | #define AR_D_TXBLK_CMD 0x1038 | ||
509 | #define AR_D_TXBLK_DATA(i) (AR_D_TXBLK_CMD+(i)) | ||
510 | |||
511 | #define AR_D0_LCL_IFS 0x1040 | 508 | #define AR_D0_LCL_IFS 0x1040 |
512 | #define AR_D1_LCL_IFS 0x1044 | 509 | #define AR_D1_LCL_IFS 0x1044 |
513 | #define AR_D2_LCL_IFS 0x1048 | 510 | #define AR_D2_LCL_IFS 0x1048 |
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index 4c8cdb097b65..f8ded84b7be8 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c | |||
@@ -1707,7 +1707,9 @@ found: | |||
1707 | return 0; | 1707 | return 0; |
1708 | } | 1708 | } |
1709 | 1709 | ||
1710 | static void carl9170_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 1710 | static void carl9170_op_flush(struct ieee80211_hw *hw, |
1711 | struct ieee80211_vif *vif, | ||
1712 | u32 queues, bool drop) | ||
1711 | { | 1713 | { |
1712 | struct ar9170 *ar = hw->priv; | 1714 | struct ar9170 *ar = hw->priv; |
1713 | unsigned int vid; | 1715 | unsigned int vid; |
diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c index ca115f33746f..f35c7f30f9a6 100644 --- a/drivers/net/wireless/ath/carl9170/usb.c +++ b/drivers/net/wireless/ath/carl9170/usb.c | |||
@@ -1076,8 +1076,14 @@ static int carl9170_usb_probe(struct usb_interface *intf, | |||
1076 | 1076 | ||
1077 | carl9170_set_state(ar, CARL9170_STOPPED); | 1077 | carl9170_set_state(ar, CARL9170_STOPPED); |
1078 | 1078 | ||
1079 | return request_firmware_nowait(THIS_MODULE, 1, CARL9170FW_NAME, | 1079 | err = request_firmware_nowait(THIS_MODULE, 1, CARL9170FW_NAME, |
1080 | &ar->udev->dev, GFP_KERNEL, ar, carl9170_usb_firmware_step2); | 1080 | &ar->udev->dev, GFP_KERNEL, ar, carl9170_usb_firmware_step2); |
1081 | if (err) { | ||
1082 | usb_put_dev(udev); | ||
1083 | usb_put_dev(udev); | ||
1084 | carl9170_free(ar); | ||
1085 | } | ||
1086 | return err; | ||
1081 | } | 1087 | } |
1082 | 1088 | ||
1083 | static void carl9170_usb_disconnect(struct usb_interface *intf) | 1089 | static void carl9170_usb_disconnect(struct usb_interface *intf) |
diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c b/drivers/net/wireless/ath/dfs_pattern_detector.c index a1a69c5db409..650be79c7ac9 100644 --- a/drivers/net/wireless/ath/dfs_pattern_detector.c +++ b/drivers/net/wireless/ath/dfs_pattern_detector.c | |||
@@ -73,9 +73,52 @@ static const struct radar_types etsi_radar_types_v15 = { | |||
73 | .radar_types = etsi_radar_ref_types_v15, | 73 | .radar_types = etsi_radar_ref_types_v15, |
74 | }; | 74 | }; |
75 | 75 | ||
76 | /* for now, we support ETSI radar types, FCC and JP are TODO */ | 76 | #define FCC_PATTERN(ID, WMIN, WMAX, PMIN, PMAX, PRF, PPB) \ |
77 | { \ | ||
78 | ID, WIDTH_LOWER(WMIN), WIDTH_UPPER(WMAX), \ | ||
79 | PMIN - PRI_TOLERANCE, \ | ||
80 | PMAX * PRF + PRI_TOLERANCE, PRF, PPB * PRF, \ | ||
81 | PPB_THRESH(PPB), PRI_TOLERANCE, \ | ||
82 | } | ||
83 | |||
84 | static const struct radar_detector_specs fcc_radar_ref_types[] = { | ||
85 | FCC_PATTERN(0, 0, 1, 1428, 1428, 1, 18), | ||
86 | FCC_PATTERN(1, 0, 5, 150, 230, 1, 23), | ||
87 | FCC_PATTERN(2, 6, 10, 200, 500, 1, 16), | ||
88 | FCC_PATTERN(3, 11, 20, 200, 500, 1, 12), | ||
89 | FCC_PATTERN(4, 50, 100, 1000, 2000, 20, 1), | ||
90 | FCC_PATTERN(5, 0, 1, 333, 333, 1, 9), | ||
91 | }; | ||
92 | |||
93 | static const struct radar_types fcc_radar_types = { | ||
94 | .region = NL80211_DFS_FCC, | ||
95 | .num_radar_types = ARRAY_SIZE(fcc_radar_ref_types), | ||
96 | .radar_types = fcc_radar_ref_types, | ||
97 | }; | ||
98 | |||
99 | #define JP_PATTERN FCC_PATTERN | ||
100 | static const struct radar_detector_specs jp_radar_ref_types[] = { | ||
101 | JP_PATTERN(0, 0, 1, 1428, 1428, 1, 18), | ||
102 | JP_PATTERN(1, 2, 3, 3846, 3846, 1, 18), | ||
103 | JP_PATTERN(2, 0, 1, 1388, 1388, 1, 18), | ||
104 | JP_PATTERN(3, 1, 2, 4000, 4000, 1, 18), | ||
105 | JP_PATTERN(4, 0, 5, 150, 230, 1, 23), | ||
106 | JP_PATTERN(5, 6, 10, 200, 500, 1, 16), | ||
107 | JP_PATTERN(6, 11, 20, 200, 500, 1, 12), | ||
108 | JP_PATTERN(7, 50, 100, 1000, 2000, 20, 1), | ||
109 | JP_PATTERN(5, 0, 1, 333, 333, 1, 9), | ||
110 | }; | ||
111 | |||
112 | static const struct radar_types jp_radar_types = { | ||
113 | .region = NL80211_DFS_JP, | ||
114 | .num_radar_types = ARRAY_SIZE(jp_radar_ref_types), | ||
115 | .radar_types = jp_radar_ref_types, | ||
116 | }; | ||
117 | |||
77 | static const struct radar_types *dfs_domains[] = { | 118 | static const struct radar_types *dfs_domains[] = { |
78 | &etsi_radar_types_v15, | 119 | &etsi_radar_types_v15, |
120 | &fcc_radar_types, | ||
121 | &jp_radar_types, | ||
79 | }; | 122 | }; |
80 | 123 | ||
81 | /** | 124 | /** |
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 7bf0ef8a1f56..63986931829e 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c | |||
@@ -2068,7 +2068,7 @@ static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len) | |||
2068 | if (!msg_ind) | 2068 | if (!msg_ind) |
2069 | goto nomem; | 2069 | goto nomem; |
2070 | msg_ind->msg_len = len; | 2070 | msg_ind->msg_len = len; |
2071 | msg_ind->msg = kmalloc(len, GFP_KERNEL); | 2071 | msg_ind->msg = kmemdup(buf, len, GFP_KERNEL); |
2072 | if (!msg_ind->msg) { | 2072 | if (!msg_ind->msg) { |
2073 | kfree(msg_ind); | 2073 | kfree(msg_ind); |
2074 | nomem: | 2074 | nomem: |
@@ -2080,7 +2080,6 @@ nomem: | |||
2080 | msg_header->msg_type); | 2080 | msg_header->msg_type); |
2081 | break; | 2081 | break; |
2082 | } | 2082 | } |
2083 | memcpy(msg_ind->msg, buf, len); | ||
2084 | mutex_lock(&wcn->hal_ind_mutex); | 2083 | mutex_lock(&wcn->hal_ind_mutex); |
2085 | list_add_tail(&msg_ind->list, &wcn->hal_ind_queue); | 2084 | list_add_tail(&msg_ind->list, &wcn->hal_ind_queue); |
2086 | queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work); | 2085 | queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work); |
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index 4806a49cb61b..820d4ebd9322 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c | |||
@@ -172,7 +172,7 @@ static int wil_cid_fill_sinfo(struct wil6210_priv *wil, int cid, | |||
172 | 172 | ||
173 | static int wil_cfg80211_get_station(struct wiphy *wiphy, | 173 | static int wil_cfg80211_get_station(struct wiphy *wiphy, |
174 | struct net_device *ndev, | 174 | struct net_device *ndev, |
175 | u8 *mac, struct station_info *sinfo) | 175 | const u8 *mac, struct station_info *sinfo) |
176 | { | 176 | { |
177 | struct wil6210_priv *wil = wiphy_to_wil(wiphy); | 177 | struct wil6210_priv *wil = wiphy_to_wil(wiphy); |
178 | int rc; | 178 | int rc; |
@@ -288,6 +288,7 @@ static int wil_cfg80211_scan(struct wiphy *wiphy, | |||
288 | } | 288 | } |
289 | 289 | ||
290 | wil->scan_request = request; | 290 | wil->scan_request = request; |
291 | mod_timer(&wil->scan_timer, jiffies + WIL6210_SCAN_TO); | ||
291 | 292 | ||
292 | memset(&cmd, 0, sizeof(cmd)); | 293 | memset(&cmd, 0, sizeof(cmd)); |
293 | cmd.cmd.num_channels = 0; | 294 | cmd.cmd.num_channels = 0; |
@@ -671,7 +672,7 @@ static int wil_cfg80211_stop_ap(struct wiphy *wiphy, | |||
671 | } | 672 | } |
672 | 673 | ||
673 | static int wil_cfg80211_del_station(struct wiphy *wiphy, | 674 | static int wil_cfg80211_del_station(struct wiphy *wiphy, |
674 | struct net_device *dev, u8 *mac) | 675 | struct net_device *dev, const u8 *mac) |
675 | { | 676 | { |
676 | struct wil6210_priv *wil = wiphy_to_wil(wiphy); | 677 | struct wil6210_priv *wil = wiphy_to_wil(wiphy); |
677 | 678 | ||
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index ecdabe4adec3..8d4bc4bfb664 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c | |||
@@ -35,7 +35,7 @@ static void wil_print_vring(struct seq_file *s, struct wil6210_priv *wil, | |||
35 | void __iomem *x = wmi_addr(wil, vring->hwtail); | 35 | void __iomem *x = wmi_addr(wil, vring->hwtail); |
36 | 36 | ||
37 | seq_printf(s, "VRING %s = {\n", name); | 37 | seq_printf(s, "VRING %s = {\n", name); |
38 | seq_printf(s, " pa = 0x%016llx\n", (unsigned long long)vring->pa); | 38 | seq_printf(s, " pa = %pad\n", &vring->pa); |
39 | seq_printf(s, " va = 0x%p\n", vring->va); | 39 | seq_printf(s, " va = 0x%p\n", vring->va); |
40 | seq_printf(s, " size = %d\n", vring->size); | 40 | seq_printf(s, " size = %d\n", vring->size); |
41 | seq_printf(s, " swtail = %d\n", vring->swtail); | 41 | seq_printf(s, " swtail = %d\n", vring->swtail); |
@@ -473,7 +473,7 @@ static int wil_txdesc_debugfs_show(struct seq_file *s, void *data) | |||
473 | u[0], u[1], u[2], u[3]); | 473 | u[0], u[1], u[2], u[3]); |
474 | seq_printf(s, " DMA = 0x%08x 0x%08x 0x%08x 0x%08x\n", | 474 | seq_printf(s, " DMA = 0x%08x 0x%08x 0x%08x 0x%08x\n", |
475 | u[4], u[5], u[6], u[7]); | 475 | u[4], u[5], u[6], u[7]); |
476 | seq_printf(s, " SKB = %p\n", skb); | 476 | seq_printf(s, " SKB = 0x%p\n", skb); |
477 | 477 | ||
478 | if (skb) { | 478 | if (skb) { |
479 | skb_get(skb); | 479 | skb_get(skb); |
diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c index 5824cd41e4ba..73593aa3cd98 100644 --- a/drivers/net/wireless/ath/wil6210/interrupt.c +++ b/drivers/net/wireless/ath/wil6210/interrupt.c | |||
@@ -338,7 +338,7 @@ static irqreturn_t wil6210_irq_misc_thread(int irq, void *cookie) | |||
338 | } | 338 | } |
339 | 339 | ||
340 | if (isr) | 340 | if (isr) |
341 | wil_err(wil, "un-handled MISC ISR bits 0x%08x\n", isr); | 341 | wil_dbg_irq(wil, "un-handled MISC ISR bits 0x%08x\n", isr); |
342 | 342 | ||
343 | wil->isr_misc = 0; | 343 | wil->isr_misc = 0; |
344 | 344 | ||
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index 95f4efe9ef37..11e6d9d22eae 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c | |||
@@ -81,7 +81,7 @@ static void wil_disconnect_cid(struct wil6210_priv *wil, int cid) | |||
81 | memset(&sta->stats, 0, sizeof(sta->stats)); | 81 | memset(&sta->stats, 0, sizeof(sta->stats)); |
82 | } | 82 | } |
83 | 83 | ||
84 | static void _wil6210_disconnect(struct wil6210_priv *wil, void *bssid) | 84 | static void _wil6210_disconnect(struct wil6210_priv *wil, const u8 *bssid) |
85 | { | 85 | { |
86 | int cid = -ENOENT; | 86 | int cid = -ENOENT; |
87 | struct net_device *ndev = wil_to_ndev(wil); | 87 | struct net_device *ndev = wil_to_ndev(wil); |
@@ -150,6 +150,15 @@ static void wil_connect_timer_fn(ulong x) | |||
150 | schedule_work(&wil->disconnect_worker); | 150 | schedule_work(&wil->disconnect_worker); |
151 | } | 151 | } |
152 | 152 | ||
153 | static void wil_scan_timer_fn(ulong x) | ||
154 | { | ||
155 | struct wil6210_priv *wil = (void *)x; | ||
156 | |||
157 | clear_bit(wil_status_fwready, &wil->status); | ||
158 | wil_err(wil, "Scan timeout detected, start fw error recovery\n"); | ||
159 | schedule_work(&wil->fw_error_worker); | ||
160 | } | ||
161 | |||
153 | static void wil_fw_error_worker(struct work_struct *work) | 162 | static void wil_fw_error_worker(struct work_struct *work) |
154 | { | 163 | { |
155 | struct wil6210_priv *wil = container_of(work, | 164 | struct wil6210_priv *wil = container_of(work, |
@@ -161,12 +170,30 @@ static void wil_fw_error_worker(struct work_struct *work) | |||
161 | if (no_fw_recovery) | 170 | if (no_fw_recovery) |
162 | return; | 171 | return; |
163 | 172 | ||
173 | /* increment @recovery_count if less then WIL6210_FW_RECOVERY_TO | ||
174 | * passed since last recovery attempt | ||
175 | */ | ||
176 | if (time_is_after_jiffies(wil->last_fw_recovery + | ||
177 | WIL6210_FW_RECOVERY_TO)) | ||
178 | wil->recovery_count++; | ||
179 | else | ||
180 | wil->recovery_count = 1; /* fw was alive for a long time */ | ||
181 | |||
182 | if (wil->recovery_count > WIL6210_FW_RECOVERY_RETRIES) { | ||
183 | wil_err(wil, "too many recovery attempts (%d), giving up\n", | ||
184 | wil->recovery_count); | ||
185 | return; | ||
186 | } | ||
187 | |||
188 | wil->last_fw_recovery = jiffies; | ||
189 | |||
164 | mutex_lock(&wil->mutex); | 190 | mutex_lock(&wil->mutex); |
165 | switch (wdev->iftype) { | 191 | switch (wdev->iftype) { |
166 | case NL80211_IFTYPE_STATION: | 192 | case NL80211_IFTYPE_STATION: |
167 | case NL80211_IFTYPE_P2P_CLIENT: | 193 | case NL80211_IFTYPE_P2P_CLIENT: |
168 | case NL80211_IFTYPE_MONITOR: | 194 | case NL80211_IFTYPE_MONITOR: |
169 | wil_info(wil, "fw error recovery started...\n"); | 195 | wil_info(wil, "fw error recovery started (try %d)...\n", |
196 | wil->recovery_count); | ||
170 | wil_reset(wil); | 197 | wil_reset(wil); |
171 | 198 | ||
172 | /* need to re-allocate Rx ring after reset */ | 199 | /* need to re-allocate Rx ring after reset */ |
@@ -230,6 +257,7 @@ int wil_priv_init(struct wil6210_priv *wil) | |||
230 | 257 | ||
231 | wil->pending_connect_cid = -1; | 258 | wil->pending_connect_cid = -1; |
232 | setup_timer(&wil->connect_timer, wil_connect_timer_fn, (ulong)wil); | 259 | setup_timer(&wil->connect_timer, wil_connect_timer_fn, (ulong)wil); |
260 | setup_timer(&wil->scan_timer, wil_scan_timer_fn, (ulong)wil); | ||
233 | 261 | ||
234 | INIT_WORK(&wil->connect_worker, wil_connect_worker); | 262 | INIT_WORK(&wil->connect_worker, wil_connect_worker); |
235 | INIT_WORK(&wil->disconnect_worker, wil_disconnect_worker); | 263 | INIT_WORK(&wil->disconnect_worker, wil_disconnect_worker); |
@@ -249,10 +277,12 @@ int wil_priv_init(struct wil6210_priv *wil) | |||
249 | return -EAGAIN; | 277 | return -EAGAIN; |
250 | } | 278 | } |
251 | 279 | ||
280 | wil->last_fw_recovery = jiffies; | ||
281 | |||
252 | return 0; | 282 | return 0; |
253 | } | 283 | } |
254 | 284 | ||
255 | void wil6210_disconnect(struct wil6210_priv *wil, void *bssid) | 285 | void wil6210_disconnect(struct wil6210_priv *wil, const u8 *bssid) |
256 | { | 286 | { |
257 | del_timer_sync(&wil->connect_timer); | 287 | del_timer_sync(&wil->connect_timer); |
258 | _wil6210_disconnect(wil, bssid); | 288 | _wil6210_disconnect(wil, bssid); |
@@ -260,6 +290,7 @@ void wil6210_disconnect(struct wil6210_priv *wil, void *bssid) | |||
260 | 290 | ||
261 | void wil_priv_deinit(struct wil6210_priv *wil) | 291 | void wil_priv_deinit(struct wil6210_priv *wil) |
262 | { | 292 | { |
293 | del_timer_sync(&wil->scan_timer); | ||
263 | cancel_work_sync(&wil->disconnect_worker); | 294 | cancel_work_sync(&wil->disconnect_worker); |
264 | cancel_work_sync(&wil->fw_error_worker); | 295 | cancel_work_sync(&wil->fw_error_worker); |
265 | mutex_lock(&wil->mutex); | 296 | mutex_lock(&wil->mutex); |
@@ -363,8 +394,8 @@ static int wil_wait_for_fw_ready(struct wil6210_priv *wil) | |||
363 | wil_err(wil, "Firmware not ready\n"); | 394 | wil_err(wil, "Firmware not ready\n"); |
364 | return -ETIME; | 395 | return -ETIME; |
365 | } else { | 396 | } else { |
366 | wil_dbg_misc(wil, "FW ready after %d ms\n", | 397 | wil_info(wil, "FW ready after %d ms. HW version 0x%08x\n", |
367 | jiffies_to_msecs(to-left)); | 398 | jiffies_to_msecs(to-left), wil->hw_version); |
368 | } | 399 | } |
369 | return 0; | 400 | return 0; |
370 | } | 401 | } |
@@ -391,6 +422,7 @@ int wil_reset(struct wil6210_priv *wil) | |||
391 | if (wil->scan_request) { | 422 | if (wil->scan_request) { |
392 | wil_dbg_misc(wil, "Abort scan_request 0x%p\n", | 423 | wil_dbg_misc(wil, "Abort scan_request 0x%p\n", |
393 | wil->scan_request); | 424 | wil->scan_request); |
425 | del_timer_sync(&wil->scan_timer); | ||
394 | cfg80211_scan_done(wil->scan_request, true); | 426 | cfg80211_scan_done(wil->scan_request, true); |
395 | wil->scan_request = NULL; | 427 | wil->scan_request = NULL; |
396 | } | 428 | } |
@@ -520,6 +552,7 @@ static int __wil_down(struct wil6210_priv *wil) | |||
520 | napi_disable(&wil->napi_tx); | 552 | napi_disable(&wil->napi_tx); |
521 | 553 | ||
522 | if (wil->scan_request) { | 554 | if (wil->scan_request) { |
555 | del_timer_sync(&wil->scan_timer); | ||
523 | cfg80211_scan_done(wil->scan_request, true); | 556 | cfg80211_scan_done(wil->scan_request, true); |
524 | wil->scan_request = NULL; | 557 | wil->scan_request = NULL; |
525 | } | 558 | } |
diff --git a/drivers/net/wireless/ath/wil6210/netdev.c b/drivers/net/wireless/ath/wil6210/netdev.c index fdcaeb820e75..106b6dcb773a 100644 --- a/drivers/net/wireless/ath/wil6210/netdev.c +++ b/drivers/net/wireless/ath/wil6210/netdev.c | |||
@@ -32,12 +32,26 @@ static int wil_stop(struct net_device *ndev) | |||
32 | return wil_down(wil); | 32 | return wil_down(wil); |
33 | } | 33 | } |
34 | 34 | ||
35 | static int wil_change_mtu(struct net_device *ndev, int new_mtu) | ||
36 | { | ||
37 | struct wil6210_priv *wil = ndev_to_wil(ndev); | ||
38 | |||
39 | if (new_mtu < 68 || new_mtu > IEEE80211_MAX_DATA_LEN_DMG) | ||
40 | return -EINVAL; | ||
41 | |||
42 | wil_dbg_misc(wil, "change MTU %d -> %d\n", ndev->mtu, new_mtu); | ||
43 | ndev->mtu = new_mtu; | ||
44 | |||
45 | return 0; | ||
46 | } | ||
47 | |||
35 | static const struct net_device_ops wil_netdev_ops = { | 48 | static const struct net_device_ops wil_netdev_ops = { |
36 | .ndo_open = wil_open, | 49 | .ndo_open = wil_open, |
37 | .ndo_stop = wil_stop, | 50 | .ndo_stop = wil_stop, |
38 | .ndo_start_xmit = wil_start_xmit, | 51 | .ndo_start_xmit = wil_start_xmit, |
39 | .ndo_set_mac_address = eth_mac_addr, | 52 | .ndo_set_mac_address = eth_mac_addr, |
40 | .ndo_validate_addr = eth_validate_addr, | 53 | .ndo_validate_addr = eth_validate_addr, |
54 | .ndo_change_mtu = wil_change_mtu, | ||
41 | }; | 55 | }; |
42 | 56 | ||
43 | static int wil6210_netdev_poll_rx(struct napi_struct *napi, int budget) | 57 | static int wil6210_netdev_poll_rx(struct napi_struct *napi, int budget) |
diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c index f1e1bb338d68..1e2e07b9d13d 100644 --- a/drivers/net/wireless/ath/wil6210/pcie_bus.c +++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c | |||
@@ -74,8 +74,6 @@ static int wil_if_pcie_enable(struct wil6210_priv *wil) | |||
74 | if (rc) | 74 | if (rc) |
75 | goto release_irq; | 75 | goto release_irq; |
76 | 76 | ||
77 | wil_info(wil, "HW version: 0x%08x\n", wil->hw_version); | ||
78 | |||
79 | return 0; | 77 | return 0; |
80 | 78 | ||
81 | release_irq: | 79 | release_irq: |
@@ -140,7 +138,7 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
140 | goto err_release_reg; | 138 | goto err_release_reg; |
141 | } | 139 | } |
142 | /* rollback to err_iounmap */ | 140 | /* rollback to err_iounmap */ |
143 | dev_info(&pdev->dev, "CSR at %pR -> %p\n", &pdev->resource[0], csr); | 141 | dev_info(&pdev->dev, "CSR at %pR -> 0x%p\n", &pdev->resource[0], csr); |
144 | 142 | ||
145 | wil = wil_if_alloc(dev, csr); | 143 | wil = wil_if_alloc(dev, csr); |
146 | if (IS_ERR(wil)) { | 144 | if (IS_ERR(wil)) { |
diff --git a/drivers/net/wireless/ath/wil6210/rx_reorder.c b/drivers/net/wireless/ath/wil6210/rx_reorder.c index d04629fe053f..747ae1275877 100644 --- a/drivers/net/wireless/ath/wil6210/rx_reorder.c +++ b/drivers/net/wireless/ath/wil6210/rx_reorder.c | |||
@@ -49,10 +49,17 @@ static void wil_release_reorder_frames(struct wil6210_priv *wil, | |||
49 | { | 49 | { |
50 | int index; | 50 | int index; |
51 | 51 | ||
52 | while (seq_less(r->head_seq_num, hseq)) { | 52 | /* note: this function is never called with |
53 | * hseq preceding r->head_seq_num, i.e it is always true | ||
54 | * !seq_less(hseq, r->head_seq_num) | ||
55 | * and thus on loop exit it should be | ||
56 | * r->head_seq_num == hseq | ||
57 | */ | ||
58 | while (seq_less(r->head_seq_num, hseq) && r->stored_mpdu_num) { | ||
53 | index = reorder_index(r, r->head_seq_num); | 59 | index = reorder_index(r, r->head_seq_num); |
54 | wil_release_reorder_frame(wil, r, index); | 60 | wil_release_reorder_frame(wil, r, index); |
55 | } | 61 | } |
62 | r->head_seq_num = hseq; | ||
56 | } | 63 | } |
57 | 64 | ||
58 | static void wil_reorder_release(struct wil6210_priv *wil, | 65 | static void wil_reorder_release(struct wil6210_priv *wil, |
@@ -91,6 +98,22 @@ void wil_rx_reorder(struct wil6210_priv *wil, struct sk_buff *skb) | |||
91 | 98 | ||
92 | spin_lock(&r->reorder_lock); | 99 | spin_lock(&r->reorder_lock); |
93 | 100 | ||
101 | /** Due to the race between WMI events, where BACK establishment | ||
102 | * reported, and data Rx, few packets may be pass up before reorder | ||
103 | * buffer get allocated. Catch up by pretending SSN is what we | ||
104 | * see in the 1-st Rx packet | ||
105 | */ | ||
106 | if (r->first_time) { | ||
107 | r->first_time = false; | ||
108 | if (seq != r->head_seq_num) { | ||
109 | wil_err(wil, "Error: 1-st frame with wrong sequence" | ||
110 | " %d, should be %d. Fixing...\n", seq, | ||
111 | r->head_seq_num); | ||
112 | r->head_seq_num = seq; | ||
113 | r->ssn = seq; | ||
114 | } | ||
115 | } | ||
116 | |||
94 | /* frame with out of date sequence number */ | 117 | /* frame with out of date sequence number */ |
95 | if (seq_less(seq, r->head_seq_num)) { | 118 | if (seq_less(seq, r->head_seq_num)) { |
96 | dev_kfree_skb(skb); | 119 | dev_kfree_skb(skb); |
@@ -162,6 +185,7 @@ struct wil_tid_ampdu_rx *wil_tid_ampdu_rx_alloc(struct wil6210_priv *wil, | |||
162 | r->head_seq_num = ssn; | 185 | r->head_seq_num = ssn; |
163 | r->buf_size = size; | 186 | r->buf_size = size; |
164 | r->stored_mpdu_num = 0; | 187 | r->stored_mpdu_num = 0; |
188 | r->first_time = true; | ||
165 | return r; | 189 | return r; |
166 | } | 190 | } |
167 | 191 | ||
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c index c8c547457eb4..0784ef3d4ce2 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.c +++ b/drivers/net/wireless/ath/wil6210/txrx.c | |||
@@ -64,6 +64,22 @@ static inline int wil_vring_avail_tx(struct vring *vring) | |||
64 | return vring->size - used - 1; | 64 | return vring->size - used - 1; |
65 | } | 65 | } |
66 | 66 | ||
67 | /** | ||
68 | * wil_vring_wmark_low - low watermark for available descriptor space | ||
69 | */ | ||
70 | static inline int wil_vring_wmark_low(struct vring *vring) | ||
71 | { | ||
72 | return vring->size/8; | ||
73 | } | ||
74 | |||
75 | /** | ||
76 | * wil_vring_wmark_high - high watermark for available descriptor space | ||
77 | */ | ||
78 | static inline int wil_vring_wmark_high(struct vring *vring) | ||
79 | { | ||
80 | return vring->size/4; | ||
81 | } | ||
82 | |||
67 | static int wil_vring_alloc(struct wil6210_priv *wil, struct vring *vring) | 83 | static int wil_vring_alloc(struct wil6210_priv *wil, struct vring *vring) |
68 | { | 84 | { |
69 | struct device *dev = wil_to_dev(wil); | 85 | struct device *dev = wil_to_dev(wil); |
@@ -98,8 +114,8 @@ static int wil_vring_alloc(struct wil6210_priv *wil, struct vring *vring) | |||
98 | _d->dma.status = TX_DMA_STATUS_DU; | 114 | _d->dma.status = TX_DMA_STATUS_DU; |
99 | } | 115 | } |
100 | 116 | ||
101 | wil_dbg_misc(wil, "vring[%d] 0x%p:0x%016llx 0x%p\n", vring->size, | 117 | wil_dbg_misc(wil, "vring[%d] 0x%p:%pad 0x%p\n", vring->size, |
102 | vring->va, (unsigned long long)vring->pa, vring->ctx); | 118 | vring->va, &vring->pa, vring->ctx); |
103 | 119 | ||
104 | return 0; | 120 | return 0; |
105 | } | 121 | } |
@@ -880,8 +896,8 @@ static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring, | |||
880 | pa = dma_map_single(dev, skb->data, | 896 | pa = dma_map_single(dev, skb->data, |
881 | skb_headlen(skb), DMA_TO_DEVICE); | 897 | skb_headlen(skb), DMA_TO_DEVICE); |
882 | 898 | ||
883 | wil_dbg_txrx(wil, "Tx skb %d bytes %p -> %#08llx\n", skb_headlen(skb), | 899 | wil_dbg_txrx(wil, "Tx skb %d bytes 0x%p -> %pad\n", skb_headlen(skb), |
884 | skb->data, (unsigned long long)pa); | 900 | skb->data, &pa); |
885 | wil_hex_dump_txrx("Tx ", DUMP_PREFIX_OFFSET, 16, 1, | 901 | wil_hex_dump_txrx("Tx ", DUMP_PREFIX_OFFSET, 16, 1, |
886 | skb->data, skb_headlen(skb), false); | 902 | skb->data, skb_headlen(skb), false); |
887 | 903 | ||
@@ -1007,7 +1023,7 @@ netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
1007 | rc = wil_tx_vring(wil, vring, skb); | 1023 | rc = wil_tx_vring(wil, vring, skb); |
1008 | 1024 | ||
1009 | /* do we still have enough room in the vring? */ | 1025 | /* do we still have enough room in the vring? */ |
1010 | if (wil_vring_avail_tx(vring) < vring->size/8) | 1026 | if (wil_vring_avail_tx(vring) < wil_vring_wmark_low(vring)) |
1011 | netif_tx_stop_all_queues(wil_to_ndev(wil)); | 1027 | netif_tx_stop_all_queues(wil_to_ndev(wil)); |
1012 | 1028 | ||
1013 | switch (rc) { | 1029 | switch (rc) { |
@@ -1116,7 +1132,7 @@ int wil_tx_complete(struct wil6210_priv *wil, int ringid) | |||
1116 | done++; | 1132 | done++; |
1117 | } | 1133 | } |
1118 | } | 1134 | } |
1119 | if (wil_vring_avail_tx(vring) > vring->size/4) | 1135 | if (wil_vring_avail_tx(vring) > wil_vring_wmark_high(vring)) |
1120 | netif_tx_wake_all_queues(wil_to_ndev(wil)); | 1136 | netif_tx_wake_all_queues(wil_to_ndev(wil)); |
1121 | 1137 | ||
1122 | return done; | 1138 | return done; |
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h index 2a2dec75f026..e25edc52398f 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h | |||
@@ -35,11 +35,14 @@ static inline u32 WIL_GET_BITS(u32 x, int b0, int b1) | |||
35 | #define WIL6210_MEM_SIZE (2*1024*1024UL) | 35 | #define WIL6210_MEM_SIZE (2*1024*1024UL) |
36 | 36 | ||
37 | #define WIL6210_RX_RING_SIZE (128) | 37 | #define WIL6210_RX_RING_SIZE (128) |
38 | #define WIL6210_TX_RING_SIZE (128) | 38 | #define WIL6210_TX_RING_SIZE (512) |
39 | #define WIL6210_MAX_TX_RINGS (24) /* HW limit */ | 39 | #define WIL6210_MAX_TX_RINGS (24) /* HW limit */ |
40 | #define WIL6210_MAX_CID (8) /* HW limit */ | 40 | #define WIL6210_MAX_CID (8) /* HW limit */ |
41 | #define WIL6210_NAPI_BUDGET (16) /* arbitrary */ | 41 | #define WIL6210_NAPI_BUDGET (16) /* arbitrary */ |
42 | #define WIL6210_ITR_TRSH (10000) /* arbitrary - about 15 IRQs/msec */ | 42 | #define WIL6210_ITR_TRSH (10000) /* arbitrary - about 15 IRQs/msec */ |
43 | #define WIL6210_FW_RECOVERY_RETRIES (5) /* try to recover this many times */ | ||
44 | #define WIL6210_FW_RECOVERY_TO msecs_to_jiffies(5000) | ||
45 | #define WIL6210_SCAN_TO msecs_to_jiffies(10000) | ||
43 | 46 | ||
44 | /* Hardware definitions begin */ | 47 | /* Hardware definitions begin */ |
45 | 48 | ||
@@ -301,6 +304,7 @@ struct wil_tid_ampdu_rx { | |||
301 | u16 buf_size; | 304 | u16 buf_size; |
302 | u16 timeout; | 305 | u16 timeout; |
303 | u8 dialog_token; | 306 | u8 dialog_token; |
307 | bool first_time; /* is it 1-st time this buffer used? */ | ||
304 | }; | 308 | }; |
305 | 309 | ||
306 | struct wil6210_stats { | 310 | struct wil6210_stats { |
@@ -360,6 +364,8 @@ struct wil6210_priv { | |||
360 | u32 fw_version; | 364 | u32 fw_version; |
361 | u32 hw_version; | 365 | u32 hw_version; |
362 | u8 n_mids; /* number of additional MIDs as reported by FW */ | 366 | u8 n_mids; /* number of additional MIDs as reported by FW */ |
367 | int recovery_count; /* num of FW recovery attempts in a short time */ | ||
368 | unsigned long last_fw_recovery; /* jiffies of last fw recovery */ | ||
363 | /* profile */ | 369 | /* profile */ |
364 | u32 monitor_flags; | 370 | u32 monitor_flags; |
365 | u32 secure_pcp; /* create secure PCP? */ | 371 | u32 secure_pcp; /* create secure PCP? */ |
@@ -381,6 +387,7 @@ struct wil6210_priv { | |||
381 | struct work_struct disconnect_worker; | 387 | struct work_struct disconnect_worker; |
382 | struct work_struct fw_error_worker; /* for FW error recovery */ | 388 | struct work_struct fw_error_worker; /* for FW error recovery */ |
383 | struct timer_list connect_timer; | 389 | struct timer_list connect_timer; |
390 | struct timer_list scan_timer; /* detect scan timeout */ | ||
384 | int pending_connect_cid; | 391 | int pending_connect_cid; |
385 | struct list_head pending_wmi_ev; | 392 | struct list_head pending_wmi_ev; |
386 | /* | 393 | /* |
@@ -507,7 +514,7 @@ void wil_wdev_free(struct wil6210_priv *wil); | |||
507 | int wmi_set_mac_address(struct wil6210_priv *wil, void *addr); | 514 | int wmi_set_mac_address(struct wil6210_priv *wil, void *addr); |
508 | int wmi_pcp_start(struct wil6210_priv *wil, int bi, u8 wmi_nettype, u8 chan); | 515 | int wmi_pcp_start(struct wil6210_priv *wil, int bi, u8 wmi_nettype, u8 chan); |
509 | int wmi_pcp_stop(struct wil6210_priv *wil); | 516 | int wmi_pcp_stop(struct wil6210_priv *wil); |
510 | void wil6210_disconnect(struct wil6210_priv *wil, void *bssid); | 517 | void wil6210_disconnect(struct wil6210_priv *wil, const u8 *bssid); |
511 | 518 | ||
512 | int wil_rx_init(struct wil6210_priv *wil); | 519 | int wil_rx_init(struct wil6210_priv *wil); |
513 | void wil_rx_fini(struct wil6210_priv *wil); | 520 | void wil_rx_fini(struct wil6210_priv *wil); |
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index 2ba56eef0c45..6cc0e182cc70 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c | |||
@@ -192,7 +192,7 @@ static int __wmi_send(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len) | |||
192 | might_sleep(); | 192 | might_sleep(); |
193 | 193 | ||
194 | if (!test_bit(wil_status_fwready, &wil->status)) { | 194 | if (!test_bit(wil_status_fwready, &wil->status)) { |
195 | wil_err(wil, "FW not ready\n"); | 195 | wil_err(wil, "WMI: cannot send command while FW not ready\n"); |
196 | return -EAGAIN; | 196 | return -EAGAIN; |
197 | } | 197 | } |
198 | 198 | ||
@@ -276,8 +276,8 @@ static void wmi_evt_ready(struct wil6210_priv *wil, int id, void *d, int len) | |||
276 | wil->fw_version = le32_to_cpu(evt->sw_version); | 276 | wil->fw_version = le32_to_cpu(evt->sw_version); |
277 | wil->n_mids = evt->numof_additional_mids; | 277 | wil->n_mids = evt->numof_additional_mids; |
278 | 278 | ||
279 | wil_dbg_wmi(wil, "FW ver. %d; MAC %pM; %d MID's\n", wil->fw_version, | 279 | wil_info(wil, "FW ver. %d; MAC %pM; %d MID's\n", wil->fw_version, |
280 | evt->mac, wil->n_mids); | 280 | evt->mac, wil->n_mids); |
281 | 281 | ||
282 | if (!is_valid_ether_addr(ndev->dev_addr)) { | 282 | if (!is_valid_ether_addr(ndev->dev_addr)) { |
283 | memcpy(ndev->dev_addr, evt->mac, ETH_ALEN); | 283 | memcpy(ndev->dev_addr, evt->mac, ETH_ALEN); |
@@ -290,7 +290,7 @@ static void wmi_evt_ready(struct wil6210_priv *wil, int id, void *d, int len) | |||
290 | static void wmi_evt_fw_ready(struct wil6210_priv *wil, int id, void *d, | 290 | static void wmi_evt_fw_ready(struct wil6210_priv *wil, int id, void *d, |
291 | int len) | 291 | int len) |
292 | { | 292 | { |
293 | wil_dbg_wmi(wil, "WMI: FW ready\n"); | 293 | wil_dbg_wmi(wil, "WMI: got FW ready event\n"); |
294 | 294 | ||
295 | set_bit(wil_status_fwready, &wil->status); | 295 | set_bit(wil_status_fwready, &wil->status); |
296 | /* reuse wmi_ready for the firmware ready indication */ | 296 | /* reuse wmi_ready for the firmware ready indication */ |
@@ -348,9 +348,10 @@ static void wmi_evt_scan_complete(struct wil6210_priv *wil, int id, | |||
348 | { | 348 | { |
349 | if (wil->scan_request) { | 349 | if (wil->scan_request) { |
350 | struct wmi_scan_complete_event *data = d; | 350 | struct wmi_scan_complete_event *data = d; |
351 | bool aborted = (data->status != 0); | 351 | bool aborted = (data->status != WMI_SCAN_SUCCESS); |
352 | 352 | ||
353 | wil_dbg_wmi(wil, "SCAN_COMPLETE(0x%08x)\n", data->status); | 353 | wil_dbg_wmi(wil, "SCAN_COMPLETE(0x%08x)\n", data->status); |
354 | del_timer_sync(&wil->scan_timer); | ||
354 | cfg80211_scan_done(wil->scan_request, aborted); | 355 | cfg80211_scan_done(wil->scan_request, aborted); |
355 | wil->scan_request = NULL; | 356 | wil->scan_request = NULL; |
356 | } else { | 357 | } else { |
@@ -658,21 +659,27 @@ void wmi_recv_cmd(struct wil6210_priv *wil) | |||
658 | u8 *cmd; | 659 | u8 *cmd; |
659 | void __iomem *src; | 660 | void __iomem *src; |
660 | ulong flags; | 661 | ulong flags; |
662 | unsigned n; | ||
661 | 663 | ||
662 | if (!test_bit(wil_status_reset_done, &wil->status)) { | 664 | if (!test_bit(wil_status_reset_done, &wil->status)) { |
663 | wil_err(wil, "Reset not completed\n"); | 665 | wil_err(wil, "Reset not completed\n"); |
664 | return; | 666 | return; |
665 | } | 667 | } |
666 | 668 | ||
667 | for (;;) { | 669 | for (n = 0;; n++) { |
668 | u16 len; | 670 | u16 len; |
669 | 671 | ||
670 | r->head = ioread32(wil->csr + HOST_MBOX + | 672 | r->head = ioread32(wil->csr + HOST_MBOX + |
671 | offsetof(struct wil6210_mbox_ctl, rx.head)); | 673 | offsetof(struct wil6210_mbox_ctl, rx.head)); |
672 | if (r->tail == r->head) | 674 | if (r->tail == r->head) { |
675 | if (n == 0) | ||
676 | wil_dbg_wmi(wil, "No events?\n"); | ||
673 | return; | 677 | return; |
678 | } | ||
674 | 679 | ||
675 | /* read cmd from tail */ | 680 | wil_dbg_wmi(wil, "Mbox head %08x tail %08x\n", |
681 | r->head, r->tail); | ||
682 | /* read cmd descriptor from tail */ | ||
676 | wil_memcpy_fromio_32(&d_tail, wil->csr + HOSTADDR(r->tail), | 683 | wil_memcpy_fromio_32(&d_tail, wil->csr + HOSTADDR(r->tail), |
677 | sizeof(struct wil6210_mbox_ring_desc)); | 684 | sizeof(struct wil6210_mbox_ring_desc)); |
678 | if (d_tail.sync == 0) { | 685 | if (d_tail.sync == 0) { |
@@ -680,13 +687,18 @@ void wmi_recv_cmd(struct wil6210_priv *wil) | |||
680 | return; | 687 | return; |
681 | } | 688 | } |
682 | 689 | ||
690 | /* read cmd header from descriptor */ | ||
683 | if (0 != wmi_read_hdr(wil, d_tail.addr, &hdr)) { | 691 | if (0 != wmi_read_hdr(wil, d_tail.addr, &hdr)) { |
684 | wil_err(wil, "Mbox evt at 0x%08x?\n", | 692 | wil_err(wil, "Mbox evt at 0x%08x?\n", |
685 | le32_to_cpu(d_tail.addr)); | 693 | le32_to_cpu(d_tail.addr)); |
686 | return; | 694 | return; |
687 | } | 695 | } |
688 | |||
689 | len = le16_to_cpu(hdr.len); | 696 | len = le16_to_cpu(hdr.len); |
697 | wil_dbg_wmi(wil, "Mbox evt %04x %04x %04x %02x\n", | ||
698 | le16_to_cpu(hdr.seq), len, le16_to_cpu(hdr.type), | ||
699 | hdr.flags); | ||
700 | |||
701 | /* read cmd buffer from descriptor */ | ||
690 | src = wmi_buffer(wil, d_tail.addr) + | 702 | src = wmi_buffer(wil, d_tail.addr) + |
691 | sizeof(struct wil6210_mbox_hdr); | 703 | sizeof(struct wil6210_mbox_hdr); |
692 | evt = kmalloc(ALIGN(offsetof(struct pending_wmi_event, | 704 | evt = kmalloc(ALIGN(offsetof(struct pending_wmi_event, |
@@ -702,9 +714,6 @@ void wmi_recv_cmd(struct wil6210_priv *wil) | |||
702 | iowrite32(0, wil->csr + HOSTADDR(r->tail) + | 714 | iowrite32(0, wil->csr + HOSTADDR(r->tail) + |
703 | offsetof(struct wil6210_mbox_ring_desc, sync)); | 715 | offsetof(struct wil6210_mbox_ring_desc, sync)); |
704 | /* indicate */ | 716 | /* indicate */ |
705 | wil_dbg_wmi(wil, "Mbox evt %04x %04x %04x %02x\n", | ||
706 | le16_to_cpu(hdr.seq), len, le16_to_cpu(hdr.type), | ||
707 | hdr.flags); | ||
708 | if ((hdr.type == WIL_MBOX_HDR_TYPE_WMI) && | 717 | if ((hdr.type == WIL_MBOX_HDR_TYPE_WMI) && |
709 | (len >= sizeof(struct wil6210_mbox_hdr_wmi))) { | 718 | (len >= sizeof(struct wil6210_mbox_hdr_wmi))) { |
710 | struct wil6210_mbox_hdr_wmi *wmi = &evt->event.wmi; | 719 | struct wil6210_mbox_hdr_wmi *wmi = &evt->event.wmi; |
@@ -734,6 +743,8 @@ void wmi_recv_cmd(struct wil6210_priv *wil) | |||
734 | wil_dbg_wmi(wil, "queue_work -> %d\n", q); | 743 | wil_dbg_wmi(wil, "queue_work -> %d\n", q); |
735 | } | 744 | } |
736 | } | 745 | } |
746 | if (n > 1) | ||
747 | wil_dbg_wmi(wil, "%s -> %d events processed\n", __func__, n); | ||
737 | } | 748 | } |
738 | 749 | ||
739 | int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len, | 750 | int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len, |
@@ -802,6 +813,7 @@ int wmi_pcp_start(struct wil6210_priv *wil, int bi, u8 wmi_nettype, u8 chan) | |||
802 | .network_type = wmi_nettype, | 813 | .network_type = wmi_nettype, |
803 | .disable_sec_offload = 1, | 814 | .disable_sec_offload = 1, |
804 | .channel = chan - 1, | 815 | .channel = chan - 1, |
816 | .pcp_max_assoc_sta = WIL6210_MAX_CID, | ||
805 | }; | 817 | }; |
806 | struct { | 818 | struct { |
807 | struct wil6210_mbox_hdr_wmi wmi; | 819 | struct wil6210_mbox_hdr_wmi wmi; |
diff --git a/drivers/net/wireless/ath/wil6210/wmi.h b/drivers/net/wireless/ath/wil6210/wmi.h index 50b8528394f4..17334c852866 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.h +++ b/drivers/net/wireless/ath/wil6210/wmi.h | |||
@@ -28,7 +28,7 @@ | |||
28 | #define __WILOCITY_WMI_H__ | 28 | #define __WILOCITY_WMI_H__ |
29 | 29 | ||
30 | /* General */ | 30 | /* General */ |
31 | 31 | #define WILOCITY_MAX_ASSOC_STA (8) | |
32 | #define WMI_MAC_LEN (6) | 32 | #define WMI_MAC_LEN (6) |
33 | #define WMI_PROX_RANGE_NUM (3) | 33 | #define WMI_PROX_RANGE_NUM (3) |
34 | 34 | ||
@@ -219,15 +219,6 @@ struct wmi_disconnect_sta_cmd { | |||
219 | __le16 disconnect_reason; | 219 | __le16 disconnect_reason; |
220 | } __packed; | 220 | } __packed; |
221 | 221 | ||
222 | /* | ||
223 | * WMI_RECONNECT_CMDID | ||
224 | */ | ||
225 | struct wmi_reconnect_cmd { | ||
226 | u8 channel; /* hint */ | ||
227 | u8 reserved; | ||
228 | u8 bssid[WMI_MAC_LEN]; /* mandatory if set */ | ||
229 | } __packed; | ||
230 | |||
231 | 222 | ||
232 | /* | 223 | /* |
233 | * WMI_SET_PMK_CMDID | 224 | * WMI_SET_PMK_CMDID |
@@ -296,11 +287,13 @@ enum wmi_scan_type { | |||
296 | WMI_LONG_SCAN = 0, | 287 | WMI_LONG_SCAN = 0, |
297 | WMI_SHORT_SCAN = 1, | 288 | WMI_SHORT_SCAN = 1, |
298 | WMI_PBC_SCAN = 2, | 289 | WMI_PBC_SCAN = 2, |
290 | WMI_ACTIVE_SCAN = 3, | ||
291 | WMI_DIRECT_SCAN = 4, | ||
299 | }; | 292 | }; |
300 | 293 | ||
301 | struct wmi_start_scan_cmd { | 294 | struct wmi_start_scan_cmd { |
302 | u8 reserved[8]; | 295 | u8 direct_scan_mac_addr[6]; |
303 | 296 | u8 reserved[2]; | |
304 | __le32 home_dwell_time; /* Max duration in the home channel(ms) */ | 297 | __le32 home_dwell_time; /* Max duration in the home channel(ms) */ |
305 | __le32 force_scan_interval; /* Time interval between scans (ms)*/ | 298 | __le32 force_scan_interval; /* Time interval between scans (ms)*/ |
306 | u8 scan_type; /* wmi_scan_type */ | 299 | u8 scan_type; /* wmi_scan_type */ |
@@ -332,6 +325,7 @@ struct wmi_probed_ssid_cmd { | |||
332 | u8 ssid[WMI_MAX_SSID_LEN]; | 325 | u8 ssid[WMI_MAX_SSID_LEN]; |
333 | } __packed; | 326 | } __packed; |
334 | 327 | ||
328 | |||
335 | /* | 329 | /* |
336 | * WMI_SET_APPIE_CMDID | 330 | * WMI_SET_APPIE_CMDID |
337 | * Add Application specified IE to a management frame | 331 | * Add Application specified IE to a management frame |
@@ -427,7 +421,7 @@ struct wmi_bcon_ctrl_cmd { | |||
427 | __le16 frag_num; | 421 | __le16 frag_num; |
428 | __le64 ss_mask; | 422 | __le64 ss_mask; |
429 | u8 network_type; | 423 | u8 network_type; |
430 | u8 reserved; | 424 | u8 pcp_max_assoc_sta; |
431 | u8 disable_sec_offload; | 425 | u8 disable_sec_offload; |
432 | u8 disable_sec; | 426 | u8 disable_sec; |
433 | } __packed; | 427 | } __packed; |
@@ -450,7 +444,7 @@ enum wmi_port_role { | |||
450 | struct wmi_port_allocate_cmd { | 444 | struct wmi_port_allocate_cmd { |
451 | u8 mac[WMI_MAC_LEN]; | 445 | u8 mac[WMI_MAC_LEN]; |
452 | u8 port_role; | 446 | u8 port_role; |
453 | u8 midid; | 447 | u8 mid; |
454 | } __packed; | 448 | } __packed; |
455 | 449 | ||
456 | /* | 450 | /* |
@@ -467,6 +461,7 @@ struct wmi_delete_port_cmd { | |||
467 | enum wmi_discovery_mode { | 461 | enum wmi_discovery_mode { |
468 | WMI_DISCOVERY_MODE_NON_OFFLOAD = 0, | 462 | WMI_DISCOVERY_MODE_NON_OFFLOAD = 0, |
469 | WMI_DISCOVERY_MODE_OFFLOAD = 1, | 463 | WMI_DISCOVERY_MODE_OFFLOAD = 1, |
464 | WMI_DISCOVERY_MODE_PEER2PEER = 2, | ||
470 | }; | 465 | }; |
471 | 466 | ||
472 | struct wmi_p2p_cfg_cmd { | 467 | struct wmi_p2p_cfg_cmd { |
@@ -493,7 +488,8 @@ struct wmi_power_mgmt_cfg_cmd { | |||
493 | */ | 488 | */ |
494 | struct wmi_pcp_start_cmd { | 489 | struct wmi_pcp_start_cmd { |
495 | __le16 bcon_interval; | 490 | __le16 bcon_interval; |
496 | u8 reserved0[10]; | 491 | u8 pcp_max_assoc_sta; |
492 | u8 reserved0[9]; | ||
497 | u8 network_type; | 493 | u8 network_type; |
498 | u8 channel; | 494 | u8 channel; |
499 | u8 disable_sec_offload; | 495 | u8 disable_sec_offload; |
@@ -857,6 +853,7 @@ enum wmi_event_id { | |||
857 | WMI_RF_MGMT_STATUS_EVENTID = 0x1853, | 853 | WMI_RF_MGMT_STATUS_EVENTID = 0x1853, |
858 | WMI_BF_SM_MGMT_DONE_EVENTID = 0x1838, | 854 | WMI_BF_SM_MGMT_DONE_EVENTID = 0x1838, |
859 | WMI_RX_MGMT_PACKET_EVENTID = 0x1840, | 855 | WMI_RX_MGMT_PACKET_EVENTID = 0x1840, |
856 | WMI_TX_MGMT_PACKET_EVENTID = 0x1841, | ||
860 | 857 | ||
861 | /* Performance monitoring events */ | 858 | /* Performance monitoring events */ |
862 | WMI_DATA_PORT_OPEN_EVENTID = 0x1860, | 859 | WMI_DATA_PORT_OPEN_EVENTID = 0x1860, |
@@ -1040,16 +1037,23 @@ enum wmi_disconnect_reason { | |||
1040 | struct wmi_disconnect_event { | 1037 | struct wmi_disconnect_event { |
1041 | __le16 protocol_reason_status; /* reason code, see 802.11 spec. */ | 1038 | __le16 protocol_reason_status; /* reason code, see 802.11 spec. */ |
1042 | u8 bssid[WMI_MAC_LEN]; /* set if known */ | 1039 | u8 bssid[WMI_MAC_LEN]; /* set if known */ |
1043 | u8 disconnect_reason; /* see wmi_disconnect_reason_e */ | 1040 | u8 disconnect_reason; /* see wmi_disconnect_reason */ |
1044 | u8 assoc_resp_len; | 1041 | u8 assoc_resp_len; /* not in use */ |
1045 | u8 assoc_info[0]; | 1042 | u8 assoc_info[0]; /* not in use */ |
1046 | } __packed; | 1043 | } __packed; |
1047 | 1044 | ||
1048 | /* | 1045 | /* |
1049 | * WMI_SCAN_COMPLETE_EVENTID | 1046 | * WMI_SCAN_COMPLETE_EVENTID |
1050 | */ | 1047 | */ |
1048 | enum scan_status { | ||
1049 | WMI_SCAN_SUCCESS = 0, | ||
1050 | WMI_SCAN_FAILED = 1, | ||
1051 | WMI_SCAN_ABORTED = 2, | ||
1052 | WMI_SCAN_REJECTED = 3, | ||
1053 | }; | ||
1054 | |||
1051 | struct wmi_scan_complete_event { | 1055 | struct wmi_scan_complete_event { |
1052 | __le32 status; | 1056 | __le32 status; /* scan_status */ |
1053 | } __packed; | 1057 | } __packed; |
1054 | 1058 | ||
1055 | /* | 1059 | /* |
@@ -1256,6 +1260,14 @@ struct wmi_rx_mgmt_info { | |||
1256 | u8 channel; /* From Radio MNGR */ | 1260 | u8 channel; /* From Radio MNGR */ |
1257 | } __packed; | 1261 | } __packed; |
1258 | 1262 | ||
1263 | |||
1264 | /* | ||
1265 | * WMI_TX_MGMT_PACKET_EVENTID | ||
1266 | */ | ||
1267 | struct wmi_tx_mgmt_packet_event { | ||
1268 | u8 payload[0]; | ||
1269 | } __packed; | ||
1270 | |||
1259 | struct wmi_rx_mgmt_packet_event { | 1271 | struct wmi_rx_mgmt_packet_event { |
1260 | struct wmi_rx_mgmt_info info; | 1272 | struct wmi_rx_mgmt_info info; |
1261 | u8 payload[0]; | 1273 | u8 payload[0]; |
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig index 088d544ec63f..e3f67b8d3f80 100644 --- a/drivers/net/wireless/b43/Kconfig +++ b/drivers/net/wireless/b43/Kconfig | |||
@@ -1,7 +1,8 @@ | |||
1 | config B43 | 1 | config B43 |
2 | tristate "Broadcom 43xx wireless support (mac80211 stack)" | 2 | tristate "Broadcom 43xx wireless support (mac80211 stack)" |
3 | depends on SSB_POSSIBLE && MAC80211 && HAS_DMA | 3 | depends on (BCMA_POSSIBLE || SSB_POSSIBLE) && MAC80211 && HAS_DMA |
4 | select SSB | 4 | select BCMA if B43_BCMA |
5 | select SSB if B43_SSB | ||
5 | select FW_LOADER | 6 | select FW_LOADER |
6 | ---help--- | 7 | ---help--- |
7 | b43 is a driver for the Broadcom 43xx series wireless devices. | 8 | b43 is a driver for the Broadcom 43xx series wireless devices. |
@@ -27,14 +28,33 @@ config B43 | |||
27 | If unsure, say M. | 28 | If unsure, say M. |
28 | 29 | ||
29 | config B43_BCMA | 30 | config B43_BCMA |
30 | bool "Support for BCMA bus" | 31 | bool |
31 | depends on B43 && (BCMA = y || BCMA = B43) | ||
32 | default y | ||
33 | 32 | ||
34 | config B43_SSB | 33 | config B43_SSB |
35 | bool | 34 | bool |
36 | depends on B43 && (SSB = y || SSB = B43) | 35 | |
37 | default y | 36 | choice |
37 | prompt "Supported bus types" | ||
38 | depends on B43 | ||
39 | default B43_BCMA_AND_SSB | ||
40 | |||
41 | config B43_BUSES_BCMA_AND_SSB | ||
42 | bool "BCMA and SSB" | ||
43 | depends on BCMA_POSSIBLE && SSB_POSSIBLE | ||
44 | select B43_BCMA | ||
45 | select B43_SSB | ||
46 | |||
47 | config B43_BUSES_BCMA | ||
48 | bool "BCMA only" | ||
49 | depends on BCMA_POSSIBLE | ||
50 | select B43_BCMA | ||
51 | |||
52 | config B43_BUSES_SSB | ||
53 | bool "SSB only" | ||
54 | depends on SSB_POSSIBLE | ||
55 | select B43_SSB | ||
56 | |||
57 | endchoice | ||
38 | 58 | ||
39 | # Auto-select SSB PCI-HOST support, if possible | 59 | # Auto-select SSB PCI-HOST support, if possible |
40 | config B43_PCI_AUTOSELECT | 60 | config B43_PCI_AUTOSELECT |
@@ -53,7 +73,7 @@ config B43_PCICORE_AUTOSELECT | |||
53 | 73 | ||
54 | config B43_PCMCIA | 74 | config B43_PCMCIA |
55 | bool "Broadcom 43xx PCMCIA device support" | 75 | bool "Broadcom 43xx PCMCIA device support" |
56 | depends on B43 && SSB_PCMCIAHOST_POSSIBLE | 76 | depends on B43 && B43_SSB && SSB_PCMCIAHOST_POSSIBLE |
57 | select SSB_PCMCIAHOST | 77 | select SSB_PCMCIAHOST |
58 | ---help--- | 78 | ---help--- |
59 | Broadcom 43xx PCMCIA device support. | 79 | Broadcom 43xx PCMCIA device support. |
@@ -73,7 +93,7 @@ config B43_PCMCIA | |||
73 | 93 | ||
74 | config B43_SDIO | 94 | config B43_SDIO |
75 | bool "Broadcom 43xx SDIO device support" | 95 | bool "Broadcom 43xx SDIO device support" |
76 | depends on B43 && SSB_SDIOHOST_POSSIBLE | 96 | depends on B43 && B43_SSB && SSB_SDIOHOST_POSSIBLE |
77 | select SSB_SDIOHOST | 97 | select SSB_SDIOHOST |
78 | ---help--- | 98 | ---help--- |
79 | Broadcom 43xx device support for Soft-MAC SDIO devices. | 99 | Broadcom 43xx device support for Soft-MAC SDIO devices. |
@@ -98,7 +118,7 @@ config B43_BCMA_PIO | |||
98 | 118 | ||
99 | config B43_PIO | 119 | config B43_PIO |
100 | bool | 120 | bool |
101 | depends on B43 | 121 | depends on B43 && B43_SSB |
102 | select SSB_BLOCKIO | 122 | select SSB_BLOCKIO |
103 | default y | 123 | default y |
104 | 124 | ||
@@ -116,7 +136,7 @@ config B43_PHY_N | |||
116 | 136 | ||
117 | config B43_PHY_LP | 137 | config B43_PHY_LP |
118 | bool "Support for low-power (LP-PHY) devices" | 138 | bool "Support for low-power (LP-PHY) devices" |
119 | depends on B43 | 139 | depends on B43 && B43_SSB |
120 | default y | 140 | default y |
121 | ---help--- | 141 | ---help--- |
122 | Support for the LP-PHY. | 142 | Support for the LP-PHY. |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 54376fddfaf9..4113b6934764 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -915,10 +915,6 @@ struct b43_wl { | |||
915 | char rng_name[30 + 1]; | 915 | char rng_name[30 + 1]; |
916 | #endif /* CONFIG_B43_HWRNG */ | 916 | #endif /* CONFIG_B43_HWRNG */ |
917 | 917 | ||
918 | /* List of all wireless devices on this chip */ | ||
919 | struct list_head devlist; | ||
920 | u8 nr_devs; | ||
921 | |||
922 | bool radiotap_enabled; | 918 | bool radiotap_enabled; |
923 | bool radio_enabled; | 919 | bool radio_enabled; |
924 | 920 | ||
diff --git a/drivers/net/wireless/b43/bus.h b/drivers/net/wireless/b43/bus.h index 184c95659279..f3205c6988bc 100644 --- a/drivers/net/wireless/b43/bus.h +++ b/drivers/net/wireless/b43/bus.h | |||
@@ -5,7 +5,9 @@ enum b43_bus_type { | |||
5 | #ifdef CONFIG_B43_BCMA | 5 | #ifdef CONFIG_B43_BCMA |
6 | B43_BUS_BCMA, | 6 | B43_BUS_BCMA, |
7 | #endif | 7 | #endif |
8 | #ifdef CONFIG_B43_SSB | ||
8 | B43_BUS_SSB, | 9 | B43_BUS_SSB, |
10 | #endif | ||
9 | }; | 11 | }; |
10 | 12 | ||
11 | struct b43_bus_dev { | 13 | struct b43_bus_dev { |
@@ -52,13 +54,21 @@ struct b43_bus_dev { | |||
52 | 54 | ||
53 | static inline bool b43_bus_host_is_pcmcia(struct b43_bus_dev *dev) | 55 | static inline bool b43_bus_host_is_pcmcia(struct b43_bus_dev *dev) |
54 | { | 56 | { |
57 | #ifdef CONFIG_B43_SSB | ||
55 | return (dev->bus_type == B43_BUS_SSB && | 58 | return (dev->bus_type == B43_BUS_SSB && |
56 | dev->sdev->bus->bustype == SSB_BUSTYPE_PCMCIA); | 59 | dev->sdev->bus->bustype == SSB_BUSTYPE_PCMCIA); |
60 | #else | ||
61 | return false; | ||
62 | #endif | ||
57 | } | 63 | } |
58 | static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev) | 64 | static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev) |
59 | { | 65 | { |
66 | #ifdef CONFIG_B43_SSB | ||
60 | return (dev->bus_type == B43_BUS_SSB && | 67 | return (dev->bus_type == B43_BUS_SSB && |
61 | dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO); | 68 | dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO); |
69 | #else | ||
70 | return false; | ||
71 | #endif | ||
62 | } | 72 | } |
63 | 73 | ||
64 | struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core); | 74 | struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core); |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 69fc3d65531a..32538ac5f7e4 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -182,7 +182,7 @@ static struct ieee80211_rate __b43_ratetable[] = { | |||
182 | #define b43_g_ratetable (__b43_ratetable + 0) | 182 | #define b43_g_ratetable (__b43_ratetable + 0) |
183 | #define b43_g_ratetable_size 12 | 183 | #define b43_g_ratetable_size 12 |
184 | 184 | ||
185 | #define CHAN4G(_channel, _freq, _flags) { \ | 185 | #define CHAN2G(_channel, _freq, _flags) { \ |
186 | .band = IEEE80211_BAND_2GHZ, \ | 186 | .band = IEEE80211_BAND_2GHZ, \ |
187 | .center_freq = (_freq), \ | 187 | .center_freq = (_freq), \ |
188 | .hw_value = (_channel), \ | 188 | .hw_value = (_channel), \ |
@@ -191,23 +191,31 @@ static struct ieee80211_rate __b43_ratetable[] = { | |||
191 | .max_power = 30, \ | 191 | .max_power = 30, \ |
192 | } | 192 | } |
193 | static struct ieee80211_channel b43_2ghz_chantable[] = { | 193 | static struct ieee80211_channel b43_2ghz_chantable[] = { |
194 | CHAN4G(1, 2412, 0), | 194 | CHAN2G(1, 2412, 0), |
195 | CHAN4G(2, 2417, 0), | 195 | CHAN2G(2, 2417, 0), |
196 | CHAN4G(3, 2422, 0), | 196 | CHAN2G(3, 2422, 0), |
197 | CHAN4G(4, 2427, 0), | 197 | CHAN2G(4, 2427, 0), |
198 | CHAN4G(5, 2432, 0), | 198 | CHAN2G(5, 2432, 0), |
199 | CHAN4G(6, 2437, 0), | 199 | CHAN2G(6, 2437, 0), |
200 | CHAN4G(7, 2442, 0), | 200 | CHAN2G(7, 2442, 0), |
201 | CHAN4G(8, 2447, 0), | 201 | CHAN2G(8, 2447, 0), |
202 | CHAN4G(9, 2452, 0), | 202 | CHAN2G(9, 2452, 0), |
203 | CHAN4G(10, 2457, 0), | 203 | CHAN2G(10, 2457, 0), |
204 | CHAN4G(11, 2462, 0), | 204 | CHAN2G(11, 2462, 0), |
205 | CHAN4G(12, 2467, 0), | 205 | CHAN2G(12, 2467, 0), |
206 | CHAN4G(13, 2472, 0), | 206 | CHAN2G(13, 2472, 0), |
207 | CHAN4G(14, 2484, 0), | 207 | CHAN2G(14, 2484, 0), |
208 | }; | 208 | }; |
209 | #undef CHAN4G | 209 | #undef CHAN2G |
210 | 210 | ||
211 | #define CHAN4G(_channel, _flags) { \ | ||
212 | .band = IEEE80211_BAND_5GHZ, \ | ||
213 | .center_freq = 4000 + (5 * (_channel)), \ | ||
214 | .hw_value = (_channel), \ | ||
215 | .flags = (_flags), \ | ||
216 | .max_antenna_gain = 0, \ | ||
217 | .max_power = 30, \ | ||
218 | } | ||
211 | #define CHAN5G(_channel, _flags) { \ | 219 | #define CHAN5G(_channel, _flags) { \ |
212 | .band = IEEE80211_BAND_5GHZ, \ | 220 | .band = IEEE80211_BAND_5GHZ, \ |
213 | .center_freq = 5000 + (5 * (_channel)), \ | 221 | .center_freq = 5000 + (5 * (_channel)), \ |
@@ -217,6 +225,18 @@ static struct ieee80211_channel b43_2ghz_chantable[] = { | |||
217 | .max_power = 30, \ | 225 | .max_power = 30, \ |
218 | } | 226 | } |
219 | static struct ieee80211_channel b43_5ghz_nphy_chantable[] = { | 227 | static struct ieee80211_channel b43_5ghz_nphy_chantable[] = { |
228 | CHAN4G(184, 0), CHAN4G(186, 0), | ||
229 | CHAN4G(188, 0), CHAN4G(190, 0), | ||
230 | CHAN4G(192, 0), CHAN4G(194, 0), | ||
231 | CHAN4G(196, 0), CHAN4G(198, 0), | ||
232 | CHAN4G(200, 0), CHAN4G(202, 0), | ||
233 | CHAN4G(204, 0), CHAN4G(206, 0), | ||
234 | CHAN4G(208, 0), CHAN4G(210, 0), | ||
235 | CHAN4G(212, 0), CHAN4G(214, 0), | ||
236 | CHAN4G(216, 0), CHAN4G(218, 0), | ||
237 | CHAN4G(220, 0), CHAN4G(222, 0), | ||
238 | CHAN4G(224, 0), CHAN4G(226, 0), | ||
239 | CHAN4G(228, 0), | ||
220 | CHAN5G(32, 0), CHAN5G(34, 0), | 240 | CHAN5G(32, 0), CHAN5G(34, 0), |
221 | CHAN5G(36, 0), CHAN5G(38, 0), | 241 | CHAN5G(36, 0), CHAN5G(38, 0), |
222 | CHAN5G(40, 0), CHAN5G(42, 0), | 242 | CHAN5G(40, 0), CHAN5G(42, 0), |
@@ -260,18 +280,7 @@ static struct ieee80211_channel b43_5ghz_nphy_chantable[] = { | |||
260 | CHAN5G(170, 0), CHAN5G(172, 0), | 280 | CHAN5G(170, 0), CHAN5G(172, 0), |
261 | CHAN5G(174, 0), CHAN5G(176, 0), | 281 | CHAN5G(174, 0), CHAN5G(176, 0), |
262 | CHAN5G(178, 0), CHAN5G(180, 0), | 282 | CHAN5G(178, 0), CHAN5G(180, 0), |
263 | CHAN5G(182, 0), CHAN5G(184, 0), | 283 | CHAN5G(182, 0), |
264 | CHAN5G(186, 0), CHAN5G(188, 0), | ||
265 | CHAN5G(190, 0), CHAN5G(192, 0), | ||
266 | CHAN5G(194, 0), CHAN5G(196, 0), | ||
267 | CHAN5G(198, 0), CHAN5G(200, 0), | ||
268 | CHAN5G(202, 0), CHAN5G(204, 0), | ||
269 | CHAN5G(206, 0), CHAN5G(208, 0), | ||
270 | CHAN5G(210, 0), CHAN5G(212, 0), | ||
271 | CHAN5G(214, 0), CHAN5G(216, 0), | ||
272 | CHAN5G(218, 0), CHAN5G(220, 0), | ||
273 | CHAN5G(222, 0), CHAN5G(224, 0), | ||
274 | CHAN5G(226, 0), CHAN5G(228, 0), | ||
275 | }; | 284 | }; |
276 | 285 | ||
277 | static struct ieee80211_channel b43_5ghz_aphy_chantable[] = { | 286 | static struct ieee80211_channel b43_5ghz_aphy_chantable[] = { |
@@ -295,6 +304,7 @@ static struct ieee80211_channel b43_5ghz_aphy_chantable[] = { | |||
295 | CHAN5G(208, 0), CHAN5G(212, 0), | 304 | CHAN5G(208, 0), CHAN5G(212, 0), |
296 | CHAN5G(216, 0), | 305 | CHAN5G(216, 0), |
297 | }; | 306 | }; |
307 | #undef CHAN4G | ||
298 | #undef CHAN5G | 308 | #undef CHAN5G |
299 | 309 | ||
300 | static struct ieee80211_supported_band b43_band_5GHz_nphy = { | 310 | static struct ieee80211_supported_band b43_band_5GHz_nphy = { |
@@ -1175,18 +1185,7 @@ static void b43_bcma_phy_reset(struct b43_wldev *dev) | |||
1175 | bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, flags); | 1185 | bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, flags); |
1176 | udelay(2); | 1186 | udelay(2); |
1177 | 1187 | ||
1178 | /* Take PHY out of reset */ | 1188 | b43_phy_take_out_of_reset(dev); |
1179 | flags = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); | ||
1180 | flags &= ~B43_BCMA_IOCTL_PHY_RESET; | ||
1181 | flags |= BCMA_IOCTL_FGC; | ||
1182 | bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, flags); | ||
1183 | udelay(1); | ||
1184 | |||
1185 | /* Do not force clock anymore */ | ||
1186 | flags = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); | ||
1187 | flags &= ~BCMA_IOCTL_FGC; | ||
1188 | bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, flags); | ||
1189 | udelay(1); | ||
1190 | } | 1189 | } |
1191 | 1190 | ||
1192 | static void b43_bcma_wireless_core_reset(struct b43_wldev *dev, bool gmode) | 1191 | static void b43_bcma_wireless_core_reset(struct b43_wldev *dev, bool gmode) |
@@ -1195,18 +1194,22 @@ static void b43_bcma_wireless_core_reset(struct b43_wldev *dev, bool gmode) | |||
1195 | B43_BCMA_CLKCTLST_PHY_PLL_REQ; | 1194 | B43_BCMA_CLKCTLST_PHY_PLL_REQ; |
1196 | u32 status = B43_BCMA_CLKCTLST_80211_PLL_ST | | 1195 | u32 status = B43_BCMA_CLKCTLST_80211_PLL_ST | |
1197 | B43_BCMA_CLKCTLST_PHY_PLL_ST; | 1196 | B43_BCMA_CLKCTLST_PHY_PLL_ST; |
1197 | u32 flags; | ||
1198 | |||
1199 | flags = B43_BCMA_IOCTL_PHY_CLKEN; | ||
1200 | if (gmode) | ||
1201 | flags |= B43_BCMA_IOCTL_GMODE; | ||
1202 | b43_device_enable(dev, flags); | ||
1198 | 1203 | ||
1199 | b43_device_enable(dev, B43_BCMA_IOCTL_PHY_CLKEN); | ||
1200 | bcma_core_set_clockmode(dev->dev->bdev, BCMA_CLKMODE_FAST); | 1204 | bcma_core_set_clockmode(dev->dev->bdev, BCMA_CLKMODE_FAST); |
1201 | b43_bcma_phy_reset(dev); | 1205 | b43_bcma_phy_reset(dev); |
1202 | bcma_core_pll_ctl(dev->dev->bdev, req, status, true); | 1206 | bcma_core_pll_ctl(dev->dev->bdev, req, status, true); |
1203 | } | 1207 | } |
1204 | #endif | 1208 | #endif |
1205 | 1209 | ||
1210 | #ifdef CONFIG_B43_SSB | ||
1206 | static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, bool gmode) | 1211 | static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, bool gmode) |
1207 | { | 1212 | { |
1208 | struct ssb_device *sdev = dev->dev->sdev; | ||
1209 | u32 tmslow; | ||
1210 | u32 flags = 0; | 1213 | u32 flags = 0; |
1211 | 1214 | ||
1212 | if (gmode) | 1215 | if (gmode) |
@@ -1218,18 +1221,9 @@ static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, bool gmode) | |||
1218 | b43_device_enable(dev, flags); | 1221 | b43_device_enable(dev, flags); |
1219 | msleep(2); /* Wait for the PLL to turn on. */ | 1222 | msleep(2); /* Wait for the PLL to turn on. */ |
1220 | 1223 | ||
1221 | /* Now take the PHY out of Reset again */ | 1224 | b43_phy_take_out_of_reset(dev); |
1222 | tmslow = ssb_read32(sdev, SSB_TMSLOW); | ||
1223 | tmslow |= SSB_TMSLOW_FGC; | ||
1224 | tmslow &= ~B43_TMSLOW_PHYRESET; | ||
1225 | ssb_write32(sdev, SSB_TMSLOW, tmslow); | ||
1226 | ssb_read32(sdev, SSB_TMSLOW); /* flush */ | ||
1227 | msleep(1); | ||
1228 | tmslow &= ~SSB_TMSLOW_FGC; | ||
1229 | ssb_write32(sdev, SSB_TMSLOW, tmslow); | ||
1230 | ssb_read32(sdev, SSB_TMSLOW); /* flush */ | ||
1231 | msleep(1); | ||
1232 | } | 1225 | } |
1226 | #endif | ||
1233 | 1227 | ||
1234 | void b43_wireless_core_reset(struct b43_wldev *dev, bool gmode) | 1228 | void b43_wireless_core_reset(struct b43_wldev *dev, bool gmode) |
1235 | { | 1229 | { |
@@ -2704,32 +2698,37 @@ static int b43_upload_initvals(struct b43_wldev *dev) | |||
2704 | struct b43_firmware *fw = &dev->fw; | 2698 | struct b43_firmware *fw = &dev->fw; |
2705 | const struct b43_iv *ivals; | 2699 | const struct b43_iv *ivals; |
2706 | size_t count; | 2700 | size_t count; |
2707 | int err; | ||
2708 | 2701 | ||
2709 | hdr = (const struct b43_fw_header *)(fw->initvals.data->data); | 2702 | hdr = (const struct b43_fw_header *)(fw->initvals.data->data); |
2710 | ivals = (const struct b43_iv *)(fw->initvals.data->data + hdr_len); | 2703 | ivals = (const struct b43_iv *)(fw->initvals.data->data + hdr_len); |
2711 | count = be32_to_cpu(hdr->size); | 2704 | count = be32_to_cpu(hdr->size); |
2712 | err = b43_write_initvals(dev, ivals, count, | 2705 | return b43_write_initvals(dev, ivals, count, |
2713 | fw->initvals.data->size - hdr_len); | 2706 | fw->initvals.data->size - hdr_len); |
2714 | if (err) | 2707 | } |
2715 | goto out; | ||
2716 | if (fw->initvals_band.data) { | ||
2717 | hdr = (const struct b43_fw_header *)(fw->initvals_band.data->data); | ||
2718 | ivals = (const struct b43_iv *)(fw->initvals_band.data->data + hdr_len); | ||
2719 | count = be32_to_cpu(hdr->size); | ||
2720 | err = b43_write_initvals(dev, ivals, count, | ||
2721 | fw->initvals_band.data->size - hdr_len); | ||
2722 | if (err) | ||
2723 | goto out; | ||
2724 | } | ||
2725 | out: | ||
2726 | 2708 | ||
2727 | return err; | 2709 | static int b43_upload_initvals_band(struct b43_wldev *dev) |
2710 | { | ||
2711 | const size_t hdr_len = sizeof(struct b43_fw_header); | ||
2712 | const struct b43_fw_header *hdr; | ||
2713 | struct b43_firmware *fw = &dev->fw; | ||
2714 | const struct b43_iv *ivals; | ||
2715 | size_t count; | ||
2716 | |||
2717 | if (!fw->initvals_band.data) | ||
2718 | return 0; | ||
2719 | |||
2720 | hdr = (const struct b43_fw_header *)(fw->initvals_band.data->data); | ||
2721 | ivals = (const struct b43_iv *)(fw->initvals_band.data->data + hdr_len); | ||
2722 | count = be32_to_cpu(hdr->size); | ||
2723 | return b43_write_initvals(dev, ivals, count, | ||
2724 | fw->initvals_band.data->size - hdr_len); | ||
2728 | } | 2725 | } |
2729 | 2726 | ||
2730 | /* Initialize the GPIOs | 2727 | /* Initialize the GPIOs |
2731 | * http://bcm-specs.sipsolutions.net/GPIO | 2728 | * http://bcm-specs.sipsolutions.net/GPIO |
2732 | */ | 2729 | */ |
2730 | |||
2731 | #ifdef CONFIG_B43_SSB | ||
2733 | static struct ssb_device *b43_ssb_gpio_dev(struct b43_wldev *dev) | 2732 | static struct ssb_device *b43_ssb_gpio_dev(struct b43_wldev *dev) |
2734 | { | 2733 | { |
2735 | struct ssb_bus *bus = dev->dev->sdev->bus; | 2734 | struct ssb_bus *bus = dev->dev->sdev->bus; |
@@ -2740,10 +2739,13 @@ static struct ssb_device *b43_ssb_gpio_dev(struct b43_wldev *dev) | |||
2740 | return bus->chipco.dev; | 2739 | return bus->chipco.dev; |
2741 | #endif | 2740 | #endif |
2742 | } | 2741 | } |
2742 | #endif | ||
2743 | 2743 | ||
2744 | static int b43_gpio_init(struct b43_wldev *dev) | 2744 | static int b43_gpio_init(struct b43_wldev *dev) |
2745 | { | 2745 | { |
2746 | #ifdef CONFIG_B43_SSB | ||
2746 | struct ssb_device *gpiodev; | 2747 | struct ssb_device *gpiodev; |
2748 | #endif | ||
2747 | u32 mask, set; | 2749 | u32 mask, set; |
2748 | 2750 | ||
2749 | b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_GPOUTSMSK, 0); | 2751 | b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_GPOUTSMSK, 0); |
@@ -2802,7 +2804,9 @@ static int b43_gpio_init(struct b43_wldev *dev) | |||
2802 | /* Turn off all GPIO stuff. Call this on module unload, for example. */ | 2804 | /* Turn off all GPIO stuff. Call this on module unload, for example. */ |
2803 | static void b43_gpio_cleanup(struct b43_wldev *dev) | 2805 | static void b43_gpio_cleanup(struct b43_wldev *dev) |
2804 | { | 2806 | { |
2807 | #ifdef CONFIG_B43_SSB | ||
2805 | struct ssb_device *gpiodev; | 2808 | struct ssb_device *gpiodev; |
2809 | #endif | ||
2806 | 2810 | ||
2807 | switch (dev->dev->bus_type) { | 2811 | switch (dev->dev->bus_type) { |
2808 | #ifdef CONFIG_B43_BCMA | 2812 | #ifdef CONFIG_B43_BCMA |
@@ -3086,6 +3090,10 @@ static int b43_chip_init(struct b43_wldev *dev) | |||
3086 | if (err) | 3090 | if (err) |
3087 | goto err_gpio_clean; | 3091 | goto err_gpio_clean; |
3088 | 3092 | ||
3093 | err = b43_upload_initvals_band(dev); | ||
3094 | if (err) | ||
3095 | goto err_gpio_clean; | ||
3096 | |||
3089 | /* Turn the Analog on and initialize the PHY. */ | 3097 | /* Turn the Analog on and initialize the PHY. */ |
3090 | phy->ops->switch_analog(dev, 1); | 3098 | phy->ops->switch_analog(dev, 1); |
3091 | err = b43_phy_init(dev); | 3099 | err = b43_phy_init(dev); |
@@ -3685,37 +3693,6 @@ static void b43_op_set_tsf(struct ieee80211_hw *hw, | |||
3685 | mutex_unlock(&wl->mutex); | 3693 | mutex_unlock(&wl->mutex); |
3686 | } | 3694 | } |
3687 | 3695 | ||
3688 | static void b43_put_phy_into_reset(struct b43_wldev *dev) | ||
3689 | { | ||
3690 | u32 tmp; | ||
3691 | |||
3692 | switch (dev->dev->bus_type) { | ||
3693 | #ifdef CONFIG_B43_BCMA | ||
3694 | case B43_BUS_BCMA: | ||
3695 | b43err(dev->wl, | ||
3696 | "Putting PHY into reset not supported on BCMA\n"); | ||
3697 | break; | ||
3698 | #endif | ||
3699 | #ifdef CONFIG_B43_SSB | ||
3700 | case B43_BUS_SSB: | ||
3701 | tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); | ||
3702 | tmp &= ~B43_TMSLOW_GMODE; | ||
3703 | tmp |= B43_TMSLOW_PHYRESET; | ||
3704 | tmp |= SSB_TMSLOW_FGC; | ||
3705 | ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); | ||
3706 | msleep(1); | ||
3707 | |||
3708 | tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); | ||
3709 | tmp &= ~SSB_TMSLOW_FGC; | ||
3710 | tmp |= B43_TMSLOW_PHYRESET; | ||
3711 | ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); | ||
3712 | msleep(1); | ||
3713 | |||
3714 | break; | ||
3715 | #endif | ||
3716 | } | ||
3717 | } | ||
3718 | |||
3719 | static const char *band_to_string(enum ieee80211_band band) | 3696 | static const char *band_to_string(enum ieee80211_band band) |
3720 | { | 3697 | { |
3721 | switch (band) { | 3698 | switch (band) { |
@@ -3731,94 +3708,75 @@ static const char *band_to_string(enum ieee80211_band band) | |||
3731 | } | 3708 | } |
3732 | 3709 | ||
3733 | /* Expects wl->mutex locked */ | 3710 | /* Expects wl->mutex locked */ |
3734 | static int b43_switch_band(struct b43_wl *wl, struct ieee80211_channel *chan) | 3711 | static int b43_switch_band(struct b43_wldev *dev, |
3712 | struct ieee80211_channel *chan) | ||
3735 | { | 3713 | { |
3736 | struct b43_wldev *up_dev = NULL; | 3714 | struct b43_phy *phy = &dev->phy; |
3737 | struct b43_wldev *down_dev; | 3715 | bool gmode; |
3738 | struct b43_wldev *d; | 3716 | u32 tmp; |
3739 | int err; | ||
3740 | bool uninitialized_var(gmode); | ||
3741 | int prev_status; | ||
3742 | 3717 | ||
3743 | /* Find a device and PHY which supports the band. */ | 3718 | switch (chan->band) { |
3744 | list_for_each_entry(d, &wl->devlist, list) { | 3719 | case IEEE80211_BAND_5GHZ: |
3745 | switch (chan->band) { | 3720 | gmode = false; |
3746 | case IEEE80211_BAND_5GHZ: | 3721 | break; |
3747 | if (d->phy.supports_5ghz) { | 3722 | case IEEE80211_BAND_2GHZ: |
3748 | up_dev = d; | 3723 | gmode = true; |
3749 | gmode = false; | 3724 | break; |
3750 | } | 3725 | default: |
3751 | break; | 3726 | B43_WARN_ON(1); |
3752 | case IEEE80211_BAND_2GHZ: | 3727 | return -EINVAL; |
3753 | if (d->phy.supports_2ghz) { | ||
3754 | up_dev = d; | ||
3755 | gmode = true; | ||
3756 | } | ||
3757 | break; | ||
3758 | default: | ||
3759 | B43_WARN_ON(1); | ||
3760 | return -EINVAL; | ||
3761 | } | ||
3762 | if (up_dev) | ||
3763 | break; | ||
3764 | } | 3728 | } |
3765 | if (!up_dev) { | 3729 | |
3766 | b43err(wl, "Could not find a device for %s-GHz band operation\n", | 3730 | if (!((gmode && phy->supports_2ghz) || |
3731 | (!gmode && phy->supports_5ghz))) { | ||
3732 | b43err(dev->wl, "This device doesn't support %s-GHz band\n", | ||
3767 | band_to_string(chan->band)); | 3733 | band_to_string(chan->band)); |
3768 | return -ENODEV; | 3734 | return -ENODEV; |
3769 | } | 3735 | } |
3770 | if ((up_dev == wl->current_dev) && | 3736 | |
3771 | (!!wl->current_dev->phy.gmode == !!gmode)) { | 3737 | if (!!phy->gmode == !!gmode) { |
3772 | /* This device is already running. */ | 3738 | /* This device is already running. */ |
3773 | return 0; | 3739 | return 0; |
3774 | } | 3740 | } |
3775 | b43dbg(wl, "Switching to %s-GHz band\n", | 3741 | |
3742 | b43dbg(dev->wl, "Switching to %s GHz band\n", | ||
3776 | band_to_string(chan->band)); | 3743 | band_to_string(chan->band)); |
3777 | down_dev = wl->current_dev; | ||
3778 | 3744 | ||
3779 | prev_status = b43_status(down_dev); | 3745 | /* Some new devices don't need disabling radio for band switching */ |
3780 | /* Shutdown the currently running core. */ | 3746 | if (!(phy->type == B43_PHYTYPE_N && phy->rev >= 3)) |
3781 | if (prev_status >= B43_STAT_STARTED) | 3747 | b43_software_rfkill(dev, true); |
3782 | down_dev = b43_wireless_core_stop(down_dev); | ||
3783 | if (prev_status >= B43_STAT_INITIALIZED) | ||
3784 | b43_wireless_core_exit(down_dev); | ||
3785 | 3748 | ||
3786 | if (down_dev != up_dev) { | 3749 | phy->gmode = gmode; |
3787 | /* We switch to a different core, so we put PHY into | 3750 | b43_phy_put_into_reset(dev); |
3788 | * RESET on the old core. */ | 3751 | switch (dev->dev->bus_type) { |
3789 | b43_put_phy_into_reset(down_dev); | 3752 | #ifdef CONFIG_B43_BCMA |
3753 | case B43_BUS_BCMA: | ||
3754 | tmp = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); | ||
3755 | if (gmode) | ||
3756 | tmp |= B43_BCMA_IOCTL_GMODE; | ||
3757 | else | ||
3758 | tmp &= ~B43_BCMA_IOCTL_GMODE; | ||
3759 | bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, tmp); | ||
3760 | break; | ||
3761 | #endif | ||
3762 | #ifdef CONFIG_B43_SSB | ||
3763 | case B43_BUS_SSB: | ||
3764 | tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); | ||
3765 | if (gmode) | ||
3766 | tmp |= B43_TMSLOW_GMODE; | ||
3767 | else | ||
3768 | tmp &= ~B43_TMSLOW_GMODE; | ||
3769 | ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); | ||
3770 | break; | ||
3771 | #endif | ||
3790 | } | 3772 | } |
3773 | b43_phy_take_out_of_reset(dev); | ||
3791 | 3774 | ||
3792 | /* Now start the new core. */ | 3775 | b43_upload_initvals_band(dev); |
3793 | up_dev->phy.gmode = gmode; | ||
3794 | if (prev_status >= B43_STAT_INITIALIZED) { | ||
3795 | err = b43_wireless_core_init(up_dev); | ||
3796 | if (err) { | ||
3797 | b43err(wl, "Fatal: Could not initialize device for " | ||
3798 | "selected %s-GHz band\n", | ||
3799 | band_to_string(chan->band)); | ||
3800 | goto init_failure; | ||
3801 | } | ||
3802 | } | ||
3803 | if (prev_status >= B43_STAT_STARTED) { | ||
3804 | err = b43_wireless_core_start(up_dev); | ||
3805 | if (err) { | ||
3806 | b43err(wl, "Fatal: Could not start device for " | ||
3807 | "selected %s-GHz band\n", | ||
3808 | band_to_string(chan->band)); | ||
3809 | b43_wireless_core_exit(up_dev); | ||
3810 | goto init_failure; | ||
3811 | } | ||
3812 | } | ||
3813 | B43_WARN_ON(b43_status(up_dev) != prev_status); | ||
3814 | 3776 | ||
3815 | wl->current_dev = up_dev; | 3777 | b43_phy_init(dev); |
3816 | 3778 | ||
3817 | return 0; | 3779 | return 0; |
3818 | init_failure: | ||
3819 | /* Whoops, failed to init the new core. No core is operating now. */ | ||
3820 | wl->current_dev = NULL; | ||
3821 | return err; | ||
3822 | } | 3780 | } |
3823 | 3781 | ||
3824 | /* Write the short and long frame retry limit values. */ | 3782 | /* Write the short and long frame retry limit values. */ |
@@ -3851,8 +3809,10 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed) | |||
3851 | 3809 | ||
3852 | dev = wl->current_dev; | 3810 | dev = wl->current_dev; |
3853 | 3811 | ||
3812 | b43_mac_suspend(dev); | ||
3813 | |||
3854 | /* Switch the band (if necessary). This might change the active core. */ | 3814 | /* Switch the band (if necessary). This might change the active core. */ |
3855 | err = b43_switch_band(wl, conf->chandef.chan); | 3815 | err = b43_switch_band(dev, conf->chandef.chan); |
3856 | if (err) | 3816 | if (err) |
3857 | goto out_unlock_mutex; | 3817 | goto out_unlock_mutex; |
3858 | 3818 | ||
@@ -3871,8 +3831,6 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed) | |||
3871 | else | 3831 | else |
3872 | phy->is_40mhz = false; | 3832 | phy->is_40mhz = false; |
3873 | 3833 | ||
3874 | b43_mac_suspend(dev); | ||
3875 | |||
3876 | if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) | 3834 | if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) |
3877 | b43_set_retry_limits(dev, conf->short_frame_max_tx_count, | 3835 | b43_set_retry_limits(dev, conf->short_frame_max_tx_count, |
3878 | conf->long_frame_max_tx_count); | 3836 | conf->long_frame_max_tx_count); |
@@ -4582,8 +4540,12 @@ static void b43_imcfglo_timeouts_workaround(struct b43_wldev *dev) | |||
4582 | struct ssb_bus *bus; | 4540 | struct ssb_bus *bus; |
4583 | u32 tmp; | 4541 | u32 tmp; |
4584 | 4542 | ||
4543 | #ifdef CONFIG_B43_SSB | ||
4585 | if (dev->dev->bus_type != B43_BUS_SSB) | 4544 | if (dev->dev->bus_type != B43_BUS_SSB) |
4586 | return; | 4545 | return; |
4546 | #else | ||
4547 | return; | ||
4548 | #endif | ||
4587 | 4549 | ||
4588 | bus = dev->dev->sdev->bus; | 4550 | bus = dev->dev->sdev->bus; |
4589 | 4551 | ||
@@ -4738,7 +4700,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev) | |||
4738 | } | 4700 | } |
4739 | if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW) | 4701 | if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW) |
4740 | hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */ | 4702 | hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */ |
4741 | #ifdef CONFIG_SSB_DRIVER_PCICORE | 4703 | #if defined(CONFIG_B43_SSB) && defined(CONFIG_SSB_DRIVER_PCICORE) |
4742 | if (dev->dev->bus_type == B43_BUS_SSB && | 4704 | if (dev->dev->bus_type == B43_BUS_SSB && |
4743 | dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI && | 4705 | dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI && |
4744 | dev->dev->sdev->bus->pcicore.dev->id.revision <= 10) | 4706 | dev->dev->sdev->bus->pcicore.dev->id.revision <= 10) |
@@ -5129,10 +5091,82 @@ static void b43_wireless_core_detach(struct b43_wldev *dev) | |||
5129 | b43_phy_free(dev); | 5091 | b43_phy_free(dev); |
5130 | } | 5092 | } |
5131 | 5093 | ||
5094 | static void b43_supported_bands(struct b43_wldev *dev, bool *have_2ghz_phy, | ||
5095 | bool *have_5ghz_phy) | ||
5096 | { | ||
5097 | u16 dev_id = 0; | ||
5098 | |||
5099 | #ifdef CONFIG_B43_BCMA | ||
5100 | if (dev->dev->bus_type == B43_BUS_BCMA && | ||
5101 | dev->dev->bdev->bus->hosttype == BCMA_HOSTTYPE_PCI) | ||
5102 | dev_id = dev->dev->bdev->bus->host_pci->device; | ||
5103 | #endif | ||
5104 | #ifdef CONFIG_B43_SSB | ||
5105 | if (dev->dev->bus_type == B43_BUS_SSB && | ||
5106 | dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI) | ||
5107 | dev_id = dev->dev->sdev->bus->host_pci->device; | ||
5108 | #endif | ||
5109 | /* Override with SPROM value if available */ | ||
5110 | if (dev->dev->bus_sprom->dev_id) | ||
5111 | dev_id = dev->dev->bus_sprom->dev_id; | ||
5112 | |||
5113 | /* Note: below IDs can be "virtual" (not maching e.g. real PCI ID) */ | ||
5114 | switch (dev_id) { | ||
5115 | case 0x4324: /* BCM4306 */ | ||
5116 | case 0x4312: /* BCM4311 */ | ||
5117 | case 0x4319: /* BCM4318 */ | ||
5118 | case 0x4328: /* BCM4321 */ | ||
5119 | case 0x432b: /* BCM4322 */ | ||
5120 | case 0x4350: /* BCM43222 */ | ||
5121 | case 0x4353: /* BCM43224 */ | ||
5122 | case 0x0576: /* BCM43224 */ | ||
5123 | case 0x435f: /* BCM6362 */ | ||
5124 | case 0x4331: /* BCM4331 */ | ||
5125 | case 0x4359: /* BCM43228 */ | ||
5126 | case 0x43a0: /* BCM4360 */ | ||
5127 | case 0x43b1: /* BCM4352 */ | ||
5128 | /* Dual band devices */ | ||
5129 | *have_2ghz_phy = true; | ||
5130 | *have_5ghz_phy = true; | ||
5131 | return; | ||
5132 | case 0x4321: /* BCM4306 */ | ||
5133 | case 0x4313: /* BCM4311 */ | ||
5134 | case 0x431a: /* BCM4318 */ | ||
5135 | case 0x432a: /* BCM4321 */ | ||
5136 | case 0x432d: /* BCM4322 */ | ||
5137 | case 0x4352: /* BCM43222 */ | ||
5138 | case 0x4333: /* BCM4331 */ | ||
5139 | case 0x43a2: /* BCM4360 */ | ||
5140 | case 0x43b3: /* BCM4352 */ | ||
5141 | /* 5 GHz only devices */ | ||
5142 | *have_2ghz_phy = false; | ||
5143 | *have_5ghz_phy = true; | ||
5144 | return; | ||
5145 | } | ||
5146 | |||
5147 | /* As a fallback, try to guess using PHY type */ | ||
5148 | switch (dev->phy.type) { | ||
5149 | case B43_PHYTYPE_A: | ||
5150 | *have_2ghz_phy = false; | ||
5151 | *have_5ghz_phy = true; | ||
5152 | return; | ||
5153 | case B43_PHYTYPE_G: | ||
5154 | case B43_PHYTYPE_N: | ||
5155 | case B43_PHYTYPE_LP: | ||
5156 | case B43_PHYTYPE_HT: | ||
5157 | case B43_PHYTYPE_LCN: | ||
5158 | *have_2ghz_phy = true; | ||
5159 | *have_5ghz_phy = false; | ||
5160 | return; | ||
5161 | } | ||
5162 | |||
5163 | B43_WARN_ON(1); | ||
5164 | } | ||
5165 | |||
5132 | static int b43_wireless_core_attach(struct b43_wldev *dev) | 5166 | static int b43_wireless_core_attach(struct b43_wldev *dev) |
5133 | { | 5167 | { |
5134 | struct b43_wl *wl = dev->wl; | 5168 | struct b43_wl *wl = dev->wl; |
5135 | struct pci_dev *pdev = NULL; | 5169 | struct b43_phy *phy = &dev->phy; |
5136 | int err; | 5170 | int err; |
5137 | u32 tmp; | 5171 | u32 tmp; |
5138 | bool have_2ghz_phy = false, have_5ghz_phy = false; | 5172 | bool have_2ghz_phy = false, have_5ghz_phy = false; |
@@ -5144,19 +5178,15 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
5144 | * that in core_init(), too. | 5178 | * that in core_init(), too. |
5145 | */ | 5179 | */ |
5146 | 5180 | ||
5147 | #ifdef CONFIG_B43_SSB | ||
5148 | if (dev->dev->bus_type == B43_BUS_SSB && | ||
5149 | dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI) | ||
5150 | pdev = dev->dev->sdev->bus->host_pci; | ||
5151 | #endif | ||
5152 | |||
5153 | err = b43_bus_powerup(dev, 0); | 5181 | err = b43_bus_powerup(dev, 0); |
5154 | if (err) { | 5182 | if (err) { |
5155 | b43err(wl, "Bus powerup failed\n"); | 5183 | b43err(wl, "Bus powerup failed\n"); |
5156 | goto out; | 5184 | goto out; |
5157 | } | 5185 | } |
5158 | 5186 | ||
5159 | /* Get the PHY type. */ | 5187 | phy->do_full_init = true; |
5188 | |||
5189 | /* Try to guess supported bands for the first init needs */ | ||
5160 | switch (dev->dev->bus_type) { | 5190 | switch (dev->dev->bus_type) { |
5161 | #ifdef CONFIG_B43_BCMA | 5191 | #ifdef CONFIG_B43_BCMA |
5162 | case B43_BUS_BCMA: | 5192 | case B43_BUS_BCMA: |
@@ -5178,51 +5208,31 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
5178 | } | 5208 | } |
5179 | 5209 | ||
5180 | dev->phy.gmode = have_2ghz_phy; | 5210 | dev->phy.gmode = have_2ghz_phy; |
5181 | dev->phy.radio_on = true; | ||
5182 | b43_wireless_core_reset(dev, dev->phy.gmode); | 5211 | b43_wireless_core_reset(dev, dev->phy.gmode); |
5183 | 5212 | ||
5213 | /* Get the PHY type. */ | ||
5184 | err = b43_phy_versioning(dev); | 5214 | err = b43_phy_versioning(dev); |
5185 | if (err) | 5215 | if (err) |
5186 | goto err_powerdown; | 5216 | goto err_powerdown; |
5187 | /* Check if this device supports multiband. */ | 5217 | |
5188 | if (!pdev || | 5218 | /* Get real info about supported bands */ |
5189 | (pdev->device != 0x4312 && | 5219 | b43_supported_bands(dev, &have_2ghz_phy, &have_5ghz_phy); |
5190 | pdev->device != 0x4319 && pdev->device != 0x4324)) { | 5220 | |
5191 | /* No multiband support. */ | 5221 | /* We don't support 5 GHz on some PHYs yet */ |
5192 | have_2ghz_phy = false; | 5222 | switch (dev->phy.type) { |
5223 | case B43_PHYTYPE_A: | ||
5224 | case B43_PHYTYPE_N: | ||
5225 | case B43_PHYTYPE_LP: | ||
5226 | case B43_PHYTYPE_HT: | ||
5227 | b43warn(wl, "5 GHz band is unsupported on this PHY\n"); | ||
5193 | have_5ghz_phy = false; | 5228 | have_5ghz_phy = false; |
5194 | switch (dev->phy.type) { | ||
5195 | case B43_PHYTYPE_A: | ||
5196 | have_5ghz_phy = true; | ||
5197 | break; | ||
5198 | case B43_PHYTYPE_LP: //FIXME not always! | ||
5199 | #if 0 //FIXME enabling 5GHz causes a NULL pointer dereference | ||
5200 | have_5ghz_phy = 1; | ||
5201 | #endif | ||
5202 | case B43_PHYTYPE_G: | ||
5203 | case B43_PHYTYPE_N: | ||
5204 | case B43_PHYTYPE_HT: | ||
5205 | case B43_PHYTYPE_LCN: | ||
5206 | have_2ghz_phy = true; | ||
5207 | break; | ||
5208 | default: | ||
5209 | B43_WARN_ON(1); | ||
5210 | } | ||
5211 | } | 5229 | } |
5212 | if (dev->phy.type == B43_PHYTYPE_A) { | 5230 | |
5213 | /* FIXME */ | 5231 | if (!have_2ghz_phy && !have_5ghz_phy) { |
5214 | b43err(wl, "IEEE 802.11a devices are unsupported\n"); | 5232 | b43err(wl, "b43 can't support any band on this device\n"); |
5215 | err = -EOPNOTSUPP; | 5233 | err = -EOPNOTSUPP; |
5216 | goto err_powerdown; | 5234 | goto err_powerdown; |
5217 | } | 5235 | } |
5218 | if (1 /* disable A-PHY */) { | ||
5219 | /* FIXME: For now we disable the A-PHY on multi-PHY devices. */ | ||
5220 | if (dev->phy.type != B43_PHYTYPE_N && | ||
5221 | dev->phy.type != B43_PHYTYPE_LP) { | ||
5222 | have_2ghz_phy = true; | ||
5223 | have_5ghz_phy = false; | ||
5224 | } | ||
5225 | } | ||
5226 | 5236 | ||
5227 | err = b43_phy_allocate(dev); | 5237 | err = b43_phy_allocate(dev); |
5228 | if (err) | 5238 | if (err) |
@@ -5270,7 +5280,6 @@ static void b43_one_core_detach(struct b43_bus_dev *dev) | |||
5270 | b43_debugfs_remove_device(wldev); | 5280 | b43_debugfs_remove_device(wldev); |
5271 | b43_wireless_core_detach(wldev); | 5281 | b43_wireless_core_detach(wldev); |
5272 | list_del(&wldev->list); | 5282 | list_del(&wldev->list); |
5273 | wl->nr_devs--; | ||
5274 | b43_bus_set_wldev(dev, NULL); | 5283 | b43_bus_set_wldev(dev, NULL); |
5275 | kfree(wldev); | 5284 | kfree(wldev); |
5276 | } | 5285 | } |
@@ -5295,8 +5304,6 @@ static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl) | |||
5295 | if (err) | 5304 | if (err) |
5296 | goto err_kfree_wldev; | 5305 | goto err_kfree_wldev; |
5297 | 5306 | ||
5298 | list_add(&wldev->list, &wl->devlist); | ||
5299 | wl->nr_devs++; | ||
5300 | b43_bus_set_wldev(dev, wldev); | 5307 | b43_bus_set_wldev(dev, wldev); |
5301 | b43_debugfs_add_device(wldev); | 5308 | b43_debugfs_add_device(wldev); |
5302 | 5309 | ||
@@ -5314,6 +5321,7 @@ static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl) | |||
5314 | (pdev->subsystem_vendor == PCI_VENDOR_ID_##_subvendor) && \ | 5321 | (pdev->subsystem_vendor == PCI_VENDOR_ID_##_subvendor) && \ |
5315 | (pdev->subsystem_device == _subdevice) ) | 5322 | (pdev->subsystem_device == _subdevice) ) |
5316 | 5323 | ||
5324 | #ifdef CONFIG_B43_SSB | ||
5317 | static void b43_sprom_fixup(struct ssb_bus *bus) | 5325 | static void b43_sprom_fixup(struct ssb_bus *bus) |
5318 | { | 5326 | { |
5319 | struct pci_dev *pdev; | 5327 | struct pci_dev *pdev; |
@@ -5345,6 +5353,7 @@ static void b43_wireless_exit(struct b43_bus_dev *dev, struct b43_wl *wl) | |||
5345 | ssb_set_devtypedata(dev->sdev, NULL); | 5353 | ssb_set_devtypedata(dev->sdev, NULL); |
5346 | ieee80211_free_hw(hw); | 5354 | ieee80211_free_hw(hw); |
5347 | } | 5355 | } |
5356 | #endif | ||
5348 | 5357 | ||
5349 | static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev) | 5358 | static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev) |
5350 | { | 5359 | { |
@@ -5386,7 +5395,6 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev) | |||
5386 | wl->hw = hw; | 5395 | wl->hw = hw; |
5387 | mutex_init(&wl->mutex); | 5396 | mutex_init(&wl->mutex); |
5388 | spin_lock_init(&wl->hardirq_lock); | 5397 | spin_lock_init(&wl->hardirq_lock); |
5389 | INIT_LIST_HEAD(&wl->devlist); | ||
5390 | INIT_WORK(&wl->beacon_update_trigger, b43_beacon_update_trigger_work); | 5398 | INIT_WORK(&wl->beacon_update_trigger, b43_beacon_update_trigger_work); |
5391 | INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work); | 5399 | INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work); |
5392 | INIT_WORK(&wl->tx_work, b43_tx_work); | 5400 | INIT_WORK(&wl->tx_work, b43_tx_work); |
@@ -5486,39 +5494,42 @@ int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id) | |||
5486 | struct b43_bus_dev *dev; | 5494 | struct b43_bus_dev *dev; |
5487 | struct b43_wl *wl; | 5495 | struct b43_wl *wl; |
5488 | int err; | 5496 | int err; |
5489 | int first = 0; | ||
5490 | 5497 | ||
5491 | dev = b43_bus_dev_ssb_init(sdev); | 5498 | dev = b43_bus_dev_ssb_init(sdev); |
5492 | if (!dev) | 5499 | if (!dev) |
5493 | return -ENOMEM; | 5500 | return -ENOMEM; |
5494 | 5501 | ||
5495 | wl = ssb_get_devtypedata(sdev); | 5502 | wl = ssb_get_devtypedata(sdev); |
5496 | if (!wl) { | 5503 | if (wl) { |
5497 | /* Probing the first core. Must setup common struct b43_wl */ | 5504 | b43err(NULL, "Dual-core devices are not supported\n"); |
5498 | first = 1; | 5505 | err = -ENOTSUPP; |
5499 | b43_sprom_fixup(sdev->bus); | 5506 | goto err_ssb_kfree_dev; |
5500 | wl = b43_wireless_init(dev); | 5507 | } |
5501 | if (IS_ERR(wl)) { | 5508 | |
5502 | err = PTR_ERR(wl); | 5509 | b43_sprom_fixup(sdev->bus); |
5503 | goto out; | 5510 | |
5504 | } | 5511 | wl = b43_wireless_init(dev); |
5505 | ssb_set_devtypedata(sdev, wl); | 5512 | if (IS_ERR(wl)) { |
5506 | B43_WARN_ON(ssb_get_devtypedata(sdev) != wl); | 5513 | err = PTR_ERR(wl); |
5514 | goto err_ssb_kfree_dev; | ||
5507 | } | 5515 | } |
5516 | ssb_set_devtypedata(sdev, wl); | ||
5517 | B43_WARN_ON(ssb_get_devtypedata(sdev) != wl); | ||
5518 | |||
5508 | err = b43_one_core_attach(dev, wl); | 5519 | err = b43_one_core_attach(dev, wl); |
5509 | if (err) | 5520 | if (err) |
5510 | goto err_wireless_exit; | 5521 | goto err_ssb_wireless_exit; |
5511 | 5522 | ||
5512 | /* setup and start work to load firmware */ | 5523 | /* setup and start work to load firmware */ |
5513 | INIT_WORK(&wl->firmware_load, b43_request_firmware); | 5524 | INIT_WORK(&wl->firmware_load, b43_request_firmware); |
5514 | schedule_work(&wl->firmware_load); | 5525 | schedule_work(&wl->firmware_load); |
5515 | 5526 | ||
5516 | out: | ||
5517 | return err; | 5527 | return err; |
5518 | 5528 | ||
5519 | err_wireless_exit: | 5529 | err_ssb_wireless_exit: |
5520 | if (first) | 5530 | b43_wireless_exit(dev, wl); |
5521 | b43_wireless_exit(dev, wl); | 5531 | err_ssb_kfree_dev: |
5532 | kfree(dev); | ||
5522 | return err; | 5533 | return err; |
5523 | } | 5534 | } |
5524 | 5535 | ||
@@ -5546,13 +5557,8 @@ static void b43_ssb_remove(struct ssb_device *sdev) | |||
5546 | /* Unregister HW RNG driver */ | 5557 | /* Unregister HW RNG driver */ |
5547 | b43_rng_exit(wl); | 5558 | b43_rng_exit(wl); |
5548 | 5559 | ||
5549 | if (list_empty(&wl->devlist)) { | 5560 | b43_leds_unregister(wl); |
5550 | b43_leds_unregister(wl); | 5561 | b43_wireless_exit(dev, wl); |
5551 | /* Last core on the chip unregistered. | ||
5552 | * We can destroy common struct b43_wl. | ||
5553 | */ | ||
5554 | b43_wireless_exit(dev, wl); | ||
5555 | } | ||
5556 | } | 5562 | } |
5557 | 5563 | ||
5558 | static struct ssb_driver b43_ssb_driver = { | 5564 | static struct ssb_driver b43_ssb_driver = { |
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c index dbaa51890198..08244b3b327e 100644 --- a/drivers/net/wireless/b43/phy_common.c +++ b/drivers/net/wireless/b43/phy_common.c | |||
@@ -96,12 +96,16 @@ int b43_phy_init(struct b43_wldev *dev) | |||
96 | 96 | ||
97 | phy->channel = ops->get_default_chan(dev); | 97 | phy->channel = ops->get_default_chan(dev); |
98 | 98 | ||
99 | ops->software_rfkill(dev, false); | 99 | phy->ops->switch_analog(dev, true); |
100 | b43_software_rfkill(dev, false); | ||
101 | |||
100 | err = ops->init(dev); | 102 | err = ops->init(dev); |
101 | if (err) { | 103 | if (err) { |
102 | b43err(dev->wl, "PHY init failed\n"); | 104 | b43err(dev->wl, "PHY init failed\n"); |
103 | goto err_block_rf; | 105 | goto err_block_rf; |
104 | } | 106 | } |
107 | phy->do_full_init = false; | ||
108 | |||
105 | /* Make sure to switch hardware and firmware (SHM) to | 109 | /* Make sure to switch hardware and firmware (SHM) to |
106 | * the default channel. */ | 110 | * the default channel. */ |
107 | err = b43_switch_channel(dev, ops->get_default_chan(dev)); | 111 | err = b43_switch_channel(dev, ops->get_default_chan(dev)); |
@@ -113,10 +117,11 @@ int b43_phy_init(struct b43_wldev *dev) | |||
113 | return 0; | 117 | return 0; |
114 | 118 | ||
115 | err_phy_exit: | 119 | err_phy_exit: |
120 | phy->do_full_init = true; | ||
116 | if (ops->exit) | 121 | if (ops->exit) |
117 | ops->exit(dev); | 122 | ops->exit(dev); |
118 | err_block_rf: | 123 | err_block_rf: |
119 | ops->software_rfkill(dev, true); | 124 | b43_software_rfkill(dev, true); |
120 | 125 | ||
121 | return err; | 126 | return err; |
122 | } | 127 | } |
@@ -125,7 +130,8 @@ void b43_phy_exit(struct b43_wldev *dev) | |||
125 | { | 130 | { |
126 | const struct b43_phy_operations *ops = dev->phy.ops; | 131 | const struct b43_phy_operations *ops = dev->phy.ops; |
127 | 132 | ||
128 | ops->software_rfkill(dev, true); | 133 | b43_software_rfkill(dev, true); |
134 | dev->phy.do_full_init = true; | ||
129 | if (ops->exit) | 135 | if (ops->exit) |
130 | ops->exit(dev); | 136 | ops->exit(dev); |
131 | } | 137 | } |
@@ -312,6 +318,90 @@ void b43_phy_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set) | |||
312 | } | 318 | } |
313 | } | 319 | } |
314 | 320 | ||
321 | void b43_phy_put_into_reset(struct b43_wldev *dev) | ||
322 | { | ||
323 | u32 tmp; | ||
324 | |||
325 | switch (dev->dev->bus_type) { | ||
326 | #ifdef CONFIG_B43_BCMA | ||
327 | case B43_BUS_BCMA: | ||
328 | tmp = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); | ||
329 | tmp &= ~B43_BCMA_IOCTL_GMODE; | ||
330 | tmp |= B43_BCMA_IOCTL_PHY_RESET; | ||
331 | tmp |= BCMA_IOCTL_FGC; | ||
332 | bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, tmp); | ||
333 | udelay(1); | ||
334 | |||
335 | tmp = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); | ||
336 | tmp &= ~BCMA_IOCTL_FGC; | ||
337 | bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, tmp); | ||
338 | udelay(1); | ||
339 | break; | ||
340 | #endif | ||
341 | #ifdef CONFIG_B43_SSB | ||
342 | case B43_BUS_SSB: | ||
343 | tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); | ||
344 | tmp &= ~B43_TMSLOW_GMODE; | ||
345 | tmp |= B43_TMSLOW_PHYRESET; | ||
346 | tmp |= SSB_TMSLOW_FGC; | ||
347 | ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); | ||
348 | usleep_range(1000, 2000); | ||
349 | |||
350 | tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); | ||
351 | tmp &= ~SSB_TMSLOW_FGC; | ||
352 | ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); | ||
353 | usleep_range(1000, 2000); | ||
354 | |||
355 | break; | ||
356 | #endif | ||
357 | } | ||
358 | } | ||
359 | |||
360 | void b43_phy_take_out_of_reset(struct b43_wldev *dev) | ||
361 | { | ||
362 | u32 tmp; | ||
363 | |||
364 | switch (dev->dev->bus_type) { | ||
365 | #ifdef CONFIG_B43_BCMA | ||
366 | case B43_BUS_BCMA: | ||
367 | /* Unset reset bit (with forcing clock) */ | ||
368 | tmp = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); | ||
369 | tmp &= ~B43_BCMA_IOCTL_PHY_RESET; | ||
370 | tmp &= ~B43_BCMA_IOCTL_PHY_CLKEN; | ||
371 | tmp |= BCMA_IOCTL_FGC; | ||
372 | bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, tmp); | ||
373 | udelay(1); | ||
374 | |||
375 | /* Do not force clock anymore */ | ||
376 | tmp = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); | ||
377 | tmp &= ~BCMA_IOCTL_FGC; | ||
378 | tmp |= B43_BCMA_IOCTL_PHY_CLKEN; | ||
379 | bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, tmp); | ||
380 | udelay(1); | ||
381 | break; | ||
382 | #endif | ||
383 | #ifdef CONFIG_B43_SSB | ||
384 | case B43_BUS_SSB: | ||
385 | /* Unset reset bit (with forcing clock) */ | ||
386 | tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); | ||
387 | tmp &= ~B43_TMSLOW_PHYRESET; | ||
388 | tmp &= ~B43_TMSLOW_PHYCLKEN; | ||
389 | tmp |= SSB_TMSLOW_FGC; | ||
390 | ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); | ||
391 | ssb_read32(dev->dev->sdev, SSB_TMSLOW); /* flush */ | ||
392 | usleep_range(1000, 2000); | ||
393 | |||
394 | tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); | ||
395 | tmp &= ~SSB_TMSLOW_FGC; | ||
396 | tmp |= B43_TMSLOW_PHYCLKEN; | ||
397 | ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); | ||
398 | ssb_read32(dev->dev->sdev, SSB_TMSLOW); /* flush */ | ||
399 | usleep_range(1000, 2000); | ||
400 | break; | ||
401 | #endif | ||
402 | } | ||
403 | } | ||
404 | |||
315 | int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel) | 405 | int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel) |
316 | { | 406 | { |
317 | struct b43_phy *phy = &(dev->phy); | 407 | struct b43_phy *phy = &(dev->phy); |
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h index f1b999349876..4ad6240d9ff4 100644 --- a/drivers/net/wireless/b43/phy_common.h +++ b/drivers/net/wireless/b43/phy_common.h | |||
@@ -231,9 +231,12 @@ struct b43_phy { | |||
231 | /* HT info */ | 231 | /* HT info */ |
232 | bool is_40mhz; | 232 | bool is_40mhz; |
233 | 233 | ||
234 | /* GMODE bit enabled? */ | 234 | /* Is GMODE (2 GHz mode) bit enabled? */ |
235 | bool gmode; | 235 | bool gmode; |
236 | 236 | ||
237 | /* After power reset full init has to be performed */ | ||
238 | bool do_full_init; | ||
239 | |||
237 | /* Analog Type */ | 240 | /* Analog Type */ |
238 | u8 analog; | 241 | u8 analog; |
239 | /* B43_PHYTYPE_ */ | 242 | /* B43_PHYTYPE_ */ |
@@ -390,6 +393,9 @@ void b43_phy_lock(struct b43_wldev *dev); | |||
390 | */ | 393 | */ |
391 | void b43_phy_unlock(struct b43_wldev *dev); | 394 | void b43_phy_unlock(struct b43_wldev *dev); |
392 | 395 | ||
396 | void b43_phy_put_into_reset(struct b43_wldev *dev); | ||
397 | void b43_phy_take_out_of_reset(struct b43_wldev *dev); | ||
398 | |||
393 | /** | 399 | /** |
394 | * b43_switch_channel - Switch to another channel | 400 | * b43_switch_channel - Switch to another channel |
395 | */ | 401 | */ |
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c index 12f467b8d564..8f5c14bc10e6 100644 --- a/drivers/net/wireless/b43/phy_g.c +++ b/drivers/net/wireless/b43/phy_g.c | |||
@@ -1587,6 +1587,7 @@ static void b43_phy_initb5(struct b43_wldev *dev) | |||
1587 | b43_write16(dev, 0x03E4, (b43_read16(dev, 0x03E4) & 0xFFC0) | 0x0004); | 1587 | b43_write16(dev, 0x03E4, (b43_read16(dev, 0x03E4) & 0xFFC0) | 0x0004); |
1588 | } | 1588 | } |
1589 | 1589 | ||
1590 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/Init/B6 */ | ||
1590 | static void b43_phy_initb6(struct b43_wldev *dev) | 1591 | static void b43_phy_initb6(struct b43_wldev *dev) |
1591 | { | 1592 | { |
1592 | struct b43_phy *phy = &dev->phy; | 1593 | struct b43_phy *phy = &dev->phy; |
@@ -1670,7 +1671,7 @@ static void b43_phy_initb6(struct b43_wldev *dev) | |||
1670 | b43_radio_write16(dev, 0x50, 0x20); | 1671 | b43_radio_write16(dev, 0x50, 0x20); |
1671 | } | 1672 | } |
1672 | if (phy->radio_rev <= 2) { | 1673 | if (phy->radio_rev <= 2) { |
1673 | b43_radio_write16(dev, 0x7C, 0x20); | 1674 | b43_radio_write16(dev, 0x50, 0x20); |
1674 | b43_radio_write16(dev, 0x5A, 0x70); | 1675 | b43_radio_write16(dev, 0x5A, 0x70); |
1675 | b43_radio_write16(dev, 0x5B, 0x7B); | 1676 | b43_radio_write16(dev, 0x5B, 0x7B); |
1676 | b43_radio_write16(dev, 0x5C, 0xB0); | 1677 | b43_radio_write16(dev, 0x5C, 0xB0); |
@@ -1686,9 +1687,8 @@ static void b43_phy_initb6(struct b43_wldev *dev) | |||
1686 | b43_phy_write(dev, 0x2A, 0x8AC0); | 1687 | b43_phy_write(dev, 0x2A, 0x8AC0); |
1687 | b43_phy_write(dev, 0x0038, 0x0668); | 1688 | b43_phy_write(dev, 0x0038, 0x0668); |
1688 | b43_set_txpower_g(dev, &gphy->bbatt, &gphy->rfatt, gphy->tx_control); | 1689 | b43_set_txpower_g(dev, &gphy->bbatt, &gphy->rfatt, gphy->tx_control); |
1689 | if (phy->radio_rev <= 5) { | 1690 | if (phy->radio_rev == 4 || phy->radio_rev == 5) |
1690 | b43_phy_maskset(dev, 0x5D, 0xFF80, 0x0003); | 1691 | b43_phy_maskset(dev, 0x5D, 0xFF80, 0x0003); |
1691 | } | ||
1692 | if (phy->radio_rev <= 2) | 1692 | if (phy->radio_rev <= 2) |
1693 | b43_radio_write16(dev, 0x005D, 0x000D); | 1693 | b43_radio_write16(dev, 0x005D, 0x000D); |
1694 | 1694 | ||
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 24ccbe96e0c8..86569f6a8705 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -257,6 +257,72 @@ static void b43_nphy_rf_ctl_override(struct b43_wldev *dev, u16 field, | |||
257 | } | 257 | } |
258 | } | 258 | } |
259 | 259 | ||
260 | static void b43_nphy_rf_ctl_intc_override_rev7(struct b43_wldev *dev, | ||
261 | enum n_intc_override intc_override, | ||
262 | u16 value, u8 core_sel) | ||
263 | { | ||
264 | u16 reg, tmp, tmp2, val; | ||
265 | int core; | ||
266 | |||
267 | for (core = 0; core < 2; core++) { | ||
268 | if ((core_sel == 1 && core != 0) || | ||
269 | (core_sel == 2 && core != 1)) | ||
270 | continue; | ||
271 | |||
272 | reg = (core == 0) ? B43_NPHY_RFCTL_INTC1 : B43_NPHY_RFCTL_INTC2; | ||
273 | |||
274 | switch (intc_override) { | ||
275 | case N_INTC_OVERRIDE_OFF: | ||
276 | b43_phy_write(dev, reg, 0); | ||
277 | b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX); | ||
278 | break; | ||
279 | case N_INTC_OVERRIDE_TRSW: | ||
280 | b43_phy_maskset(dev, reg, ~0xC0, value << 6); | ||
281 | b43_phy_set(dev, reg, 0x400); | ||
282 | |||
283 | b43_phy_mask(dev, 0x2ff, ~0xC000 & 0xFFFF); | ||
284 | b43_phy_set(dev, 0x2ff, 0x2000); | ||
285 | b43_phy_set(dev, 0x2ff, 0x0001); | ||
286 | break; | ||
287 | case N_INTC_OVERRIDE_PA: | ||
288 | tmp = 0x0030; | ||
289 | if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) | ||
290 | val = value << 5; | ||
291 | else | ||
292 | val = value << 4; | ||
293 | b43_phy_maskset(dev, reg, ~tmp, val); | ||
294 | b43_phy_set(dev, reg, 0x1000); | ||
295 | break; | ||
296 | case N_INTC_OVERRIDE_EXT_LNA_PU: | ||
297 | if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { | ||
298 | tmp = 0x0001; | ||
299 | tmp2 = 0x0004; | ||
300 | val = value; | ||
301 | } else { | ||
302 | tmp = 0x0004; | ||
303 | tmp2 = 0x0001; | ||
304 | val = value << 2; | ||
305 | } | ||
306 | b43_phy_maskset(dev, reg, ~tmp, val); | ||
307 | b43_phy_mask(dev, reg, ~tmp2); | ||
308 | break; | ||
309 | case N_INTC_OVERRIDE_EXT_LNA_GAIN: | ||
310 | if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { | ||
311 | tmp = 0x0002; | ||
312 | tmp2 = 0x0008; | ||
313 | val = value << 1; | ||
314 | } else { | ||
315 | tmp = 0x0008; | ||
316 | tmp2 = 0x0002; | ||
317 | val = value << 3; | ||
318 | } | ||
319 | b43_phy_maskset(dev, reg, ~tmp, val); | ||
320 | b43_phy_mask(dev, reg, ~tmp2); | ||
321 | break; | ||
322 | } | ||
323 | } | ||
324 | } | ||
325 | |||
260 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlIntcOverride */ | 326 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlIntcOverride */ |
261 | static void b43_nphy_rf_ctl_intc_override(struct b43_wldev *dev, | 327 | static void b43_nphy_rf_ctl_intc_override(struct b43_wldev *dev, |
262 | enum n_intc_override intc_override, | 328 | enum n_intc_override intc_override, |
@@ -265,6 +331,12 @@ static void b43_nphy_rf_ctl_intc_override(struct b43_wldev *dev, | |||
265 | u8 i, j; | 331 | u8 i, j; |
266 | u16 reg, tmp, val; | 332 | u16 reg, tmp, val; |
267 | 333 | ||
334 | if (dev->phy.rev >= 7) { | ||
335 | b43_nphy_rf_ctl_intc_override_rev7(dev, intc_override, value, | ||
336 | core); | ||
337 | return; | ||
338 | } | ||
339 | |||
268 | B43_WARN_ON(dev->phy.rev < 3); | 340 | B43_WARN_ON(dev->phy.rev < 3); |
269 | 341 | ||
270 | for (i = 0; i < 2; i++) { | 342 | for (i = 0; i < 2; i++) { |
@@ -419,7 +491,8 @@ static void b43_nphy_stay_in_carrier_search(struct b43_wldev *dev, bool enable) | |||
419 | static const u16 clip[] = { 0xFFFF, 0xFFFF }; | 491 | static const u16 clip[] = { 0xFFFF, 0xFFFF }; |
420 | if (nphy->deaf_count++ == 0) { | 492 | if (nphy->deaf_count++ == 0) { |
421 | nphy->classifier_state = b43_nphy_classifier(dev, 0, 0); | 493 | nphy->classifier_state = b43_nphy_classifier(dev, 0, 0); |
422 | b43_nphy_classifier(dev, 0x7, 0); | 494 | b43_nphy_classifier(dev, 0x7, |
495 | B43_NPHY_CLASSCTL_WAITEDEN); | ||
423 | b43_nphy_read_clip_detection(dev, nphy->clip_state); | 496 | b43_nphy_read_clip_detection(dev, nphy->clip_state); |
424 | b43_nphy_write_clip_detection(dev, clip); | 497 | b43_nphy_write_clip_detection(dev, clip); |
425 | } | 498 | } |
@@ -627,13 +700,11 @@ static void b43_radio_2057_init_post(struct b43_wldev *dev) | |||
627 | b43_radio_mask(dev, R2057_RFPLL_MISC_CAL_RESETN, ~0x78); | 700 | b43_radio_mask(dev, R2057_RFPLL_MISC_CAL_RESETN, ~0x78); |
628 | b43_radio_mask(dev, R2057_XTAL_CONFIG2, ~0x80); | 701 | b43_radio_mask(dev, R2057_XTAL_CONFIG2, ~0x80); |
629 | 702 | ||
630 | if (dev->phy.n->init_por) { | 703 | if (dev->phy.do_full_init) { |
631 | b43_radio_2057_rcal(dev); | 704 | b43_radio_2057_rcal(dev); |
632 | b43_radio_2057_rccal(dev); | 705 | b43_radio_2057_rccal(dev); |
633 | } | 706 | } |
634 | b43_radio_mask(dev, R2057_RFPLL_MASTER, ~0x8); | 707 | b43_radio_mask(dev, R2057_RFPLL_MASTER, ~0x8); |
635 | |||
636 | dev->phy.n->init_por = false; | ||
637 | } | 708 | } |
638 | 709 | ||
639 | /* http://bcm-v4.sipsolutions.net/802.11/Radio/2057/Init */ | 710 | /* http://bcm-v4.sipsolutions.net/802.11/Radio/2057/Init */ |
@@ -734,9 +805,16 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
734 | u16 bias, cbias; | 805 | u16 bias, cbias; |
735 | u16 pag_boost, padg_boost, pgag_boost, mixg_boost; | 806 | u16 pag_boost, padg_boost, pgag_boost, mixg_boost; |
736 | u16 paa_boost, pada_boost, pgaa_boost, mixa_boost; | 807 | u16 paa_boost, pada_boost, pgaa_boost, mixa_boost; |
808 | bool is_pkg_fab_smic; | ||
737 | 809 | ||
738 | B43_WARN_ON(dev->phy.rev < 3); | 810 | B43_WARN_ON(dev->phy.rev < 3); |
739 | 811 | ||
812 | is_pkg_fab_smic = | ||
813 | ((dev->dev->chip_id == BCMA_CHIP_ID_BCM43224 || | ||
814 | dev->dev->chip_id == BCMA_CHIP_ID_BCM43225 || | ||
815 | dev->dev->chip_id == BCMA_CHIP_ID_BCM43421) && | ||
816 | dev->dev->chip_pkg == BCMA_PKG_ID_BCM43224_FAB_SMIC); | ||
817 | |||
740 | b43_chantab_radio_2056_upload(dev, e); | 818 | b43_chantab_radio_2056_upload(dev, e); |
741 | b2056_upload_syn_pll_cp2(dev, band == IEEE80211_BAND_5GHZ); | 819 | b2056_upload_syn_pll_cp2(dev, band == IEEE80211_BAND_5GHZ); |
742 | 820 | ||
@@ -744,7 +822,8 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
744 | b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | 822 | b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { |
745 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1F); | 823 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1F); |
746 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER2, 0x1F); | 824 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER2, 0x1F); |
747 | if (dev->dev->chip_id == 0x4716) { | 825 | if (dev->dev->chip_id == BCMA_CHIP_ID_BCM4716 || |
826 | dev->dev->chip_id == BCMA_CHIP_ID_BCM47162) { | ||
748 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER4, 0x14); | 827 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER4, 0x14); |
749 | b43_radio_write(dev, B2056_SYN_PLL_CP2, 0); | 828 | b43_radio_write(dev, B2056_SYN_PLL_CP2, 0); |
750 | } else { | 829 | } else { |
@@ -752,6 +831,13 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
752 | b43_radio_write(dev, B2056_SYN_PLL_CP2, 0x14); | 831 | b43_radio_write(dev, B2056_SYN_PLL_CP2, 0x14); |
753 | } | 832 | } |
754 | } | 833 | } |
834 | if (sprom->boardflags2_hi & B43_BFH2_GPLL_WAR2 && | ||
835 | b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | ||
836 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1f); | ||
837 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER2, 0x1f); | ||
838 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER4, 0x0b); | ||
839 | b43_radio_write(dev, B2056_SYN_PLL_CP2, 0x20); | ||
840 | } | ||
755 | if (sprom->boardflags2_lo & B43_BFL2_APLL_WAR && | 841 | if (sprom->boardflags2_lo & B43_BFL2_APLL_WAR && |
756 | b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { | 842 | b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { |
757 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1F); | 843 | b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1F); |
@@ -767,7 +853,8 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
767 | b43_radio_write(dev, | 853 | b43_radio_write(dev, |
768 | offset | B2056_TX_PADG_IDAC, 0xcc); | 854 | offset | B2056_TX_PADG_IDAC, 0xcc); |
769 | 855 | ||
770 | if (dev->dev->chip_id == 0x4716) { | 856 | if (dev->dev->chip_id == BCMA_CHIP_ID_BCM4716 || |
857 | dev->dev->chip_id == BCMA_CHIP_ID_BCM47162) { | ||
771 | bias = 0x40; | 858 | bias = 0x40; |
772 | cbias = 0x45; | 859 | cbias = 0x45; |
773 | pag_boost = 0x5; | 860 | pag_boost = 0x5; |
@@ -776,6 +863,10 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
776 | } else { | 863 | } else { |
777 | bias = 0x25; | 864 | bias = 0x25; |
778 | cbias = 0x20; | 865 | cbias = 0x20; |
866 | if (is_pkg_fab_smic) { | ||
867 | bias = 0x2a; | ||
868 | cbias = 0x38; | ||
869 | } | ||
779 | pag_boost = 0x4; | 870 | pag_boost = 0x4; |
780 | pgag_boost = 0x03; | 871 | pgag_boost = 0x03; |
781 | mixg_boost = 0x65; | 872 | mixg_boost = 0x65; |
@@ -844,6 +935,8 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
844 | mixa_boost = 0xF; | 935 | mixa_boost = 0xF; |
845 | } | 936 | } |
846 | 937 | ||
938 | cbias = is_pkg_fab_smic ? 0x35 : 0x30; | ||
939 | |||
847 | for (i = 0; i < 2; i++) { | 940 | for (i = 0; i < 2; i++) { |
848 | offset = i ? B2056_TX1 : B2056_TX0; | 941 | offset = i ? B2056_TX1 : B2056_TX0; |
849 | 942 | ||
@@ -862,11 +955,11 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
862 | b43_radio_write(dev, | 955 | b43_radio_write(dev, |
863 | offset | B2056_TX_PADA_CASCBIAS, 0x03); | 956 | offset | B2056_TX_PADA_CASCBIAS, 0x03); |
864 | b43_radio_write(dev, | 957 | b43_radio_write(dev, |
865 | offset | B2056_TX_INTPAA_IAUX_STAT, 0x50); | 958 | offset | B2056_TX_INTPAA_IAUX_STAT, 0x30); |
866 | b43_radio_write(dev, | 959 | b43_radio_write(dev, |
867 | offset | B2056_TX_INTPAA_IMAIN_STAT, 0x50); | 960 | offset | B2056_TX_INTPAA_IMAIN_STAT, 0x30); |
868 | b43_radio_write(dev, | 961 | b43_radio_write(dev, |
869 | offset | B2056_TX_INTPAA_CASCBIAS, 0x30); | 962 | offset | B2056_TX_INTPAA_CASCBIAS, cbias); |
870 | } | 963 | } |
871 | } | 964 | } |
872 | 965 | ||
@@ -933,7 +1026,7 @@ static void b43_radio_init2056_post(struct b43_wldev *dev) | |||
933 | b43_radio_mask(dev, B2056_SYN_COM_RESET, ~0x2); | 1026 | b43_radio_mask(dev, B2056_SYN_COM_RESET, ~0x2); |
934 | b43_radio_mask(dev, B2056_SYN_PLL_MAST2, ~0xFC); | 1027 | b43_radio_mask(dev, B2056_SYN_PLL_MAST2, ~0xFC); |
935 | b43_radio_mask(dev, B2056_SYN_RCCAL_CTRL0, ~0x1); | 1028 | b43_radio_mask(dev, B2056_SYN_RCCAL_CTRL0, ~0x1); |
936 | if (dev->phy.n->init_por) | 1029 | if (dev->phy.do_full_init) |
937 | b43_radio_2056_rcal(dev); | 1030 | b43_radio_2056_rcal(dev); |
938 | } | 1031 | } |
939 | 1032 | ||
@@ -946,8 +1039,6 @@ static void b43_radio_init2056(struct b43_wldev *dev) | |||
946 | b43_radio_init2056_pre(dev); | 1039 | b43_radio_init2056_pre(dev); |
947 | b2056_upload_inittabs(dev, 0, 0); | 1040 | b2056_upload_inittabs(dev, 0, 0); |
948 | b43_radio_init2056_post(dev); | 1041 | b43_radio_init2056_post(dev); |
949 | |||
950 | dev->phy.n->init_por = false; | ||
951 | } | 1042 | } |
952 | 1043 | ||
953 | /************************************************** | 1044 | /************************************************** |
@@ -1164,23 +1255,20 @@ static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops, | |||
1164 | u16 seq_mode; | 1255 | u16 seq_mode; |
1165 | u32 tmp; | 1256 | u32 tmp; |
1166 | 1257 | ||
1167 | if (nphy->hang_avoid) | 1258 | b43_nphy_stay_in_carrier_search(dev, true); |
1168 | b43_nphy_stay_in_carrier_search(dev, true); | ||
1169 | 1259 | ||
1170 | if ((nphy->bb_mult_save & 0x80000000) == 0) { | 1260 | if ((nphy->bb_mult_save & 0x80000000) == 0) { |
1171 | tmp = b43_ntab_read(dev, B43_NTAB16(15, 87)); | 1261 | tmp = b43_ntab_read(dev, B43_NTAB16(15, 87)); |
1172 | nphy->bb_mult_save = (tmp & 0xFFFF) | 0x80000000; | 1262 | nphy->bb_mult_save = (tmp & 0xFFFF) | 0x80000000; |
1173 | } | 1263 | } |
1174 | 1264 | ||
1265 | /* TODO: add modify_bbmult argument */ | ||
1175 | if (!dev->phy.is_40mhz) | 1266 | if (!dev->phy.is_40mhz) |
1176 | tmp = 0x6464; | 1267 | tmp = 0x6464; |
1177 | else | 1268 | else |
1178 | tmp = 0x4747; | 1269 | tmp = 0x4747; |
1179 | b43_ntab_write(dev, B43_NTAB16(15, 87), tmp); | 1270 | b43_ntab_write(dev, B43_NTAB16(15, 87), tmp); |
1180 | 1271 | ||
1181 | if (nphy->hang_avoid) | ||
1182 | b43_nphy_stay_in_carrier_search(dev, false); | ||
1183 | |||
1184 | b43_phy_write(dev, B43_NPHY_SAMP_DEPCNT, (samps - 1)); | 1272 | b43_phy_write(dev, B43_NPHY_SAMP_DEPCNT, (samps - 1)); |
1185 | 1273 | ||
1186 | if (loops != 0xFFFF) | 1274 | if (loops != 0xFFFF) |
@@ -1213,6 +1301,8 @@ static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops, | |||
1213 | b43err(dev->wl, "run samples timeout\n"); | 1301 | b43err(dev->wl, "run samples timeout\n"); |
1214 | 1302 | ||
1215 | b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode); | 1303 | b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode); |
1304 | |||
1305 | b43_nphy_stay_in_carrier_search(dev, false); | ||
1216 | } | 1306 | } |
1217 | 1307 | ||
1218 | /************************************************** | 1308 | /************************************************** |
@@ -1588,8 +1678,8 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) | |||
1588 | struct b43_phy_n *nphy = dev->phy.n; | 1678 | struct b43_phy_n *nphy = dev->phy.n; |
1589 | 1679 | ||
1590 | u16 saved_regs_phy_rfctl[2]; | 1680 | u16 saved_regs_phy_rfctl[2]; |
1591 | u16 saved_regs_phy[13]; | 1681 | u16 saved_regs_phy[22]; |
1592 | u16 regs_to_store[] = { | 1682 | u16 regs_to_store_rev3[] = { |
1593 | B43_NPHY_AFECTL_OVER1, B43_NPHY_AFECTL_OVER, | 1683 | B43_NPHY_AFECTL_OVER1, B43_NPHY_AFECTL_OVER, |
1594 | B43_NPHY_AFECTL_C1, B43_NPHY_AFECTL_C2, | 1684 | B43_NPHY_AFECTL_C1, B43_NPHY_AFECTL_C2, |
1595 | B43_NPHY_TXF_40CO_B1S1, B43_NPHY_RFCTL_OVER, | 1685 | B43_NPHY_TXF_40CO_B1S1, B43_NPHY_RFCTL_OVER, |
@@ -1598,6 +1688,20 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) | |||
1598 | B43_NPHY_RFCTL_LUT_TRSW_UP1, B43_NPHY_RFCTL_LUT_TRSW_UP2, | 1688 | B43_NPHY_RFCTL_LUT_TRSW_UP1, B43_NPHY_RFCTL_LUT_TRSW_UP2, |
1599 | B43_NPHY_RFCTL_RSSIO1, B43_NPHY_RFCTL_RSSIO2 | 1689 | B43_NPHY_RFCTL_RSSIO1, B43_NPHY_RFCTL_RSSIO2 |
1600 | }; | 1690 | }; |
1691 | u16 regs_to_store_rev7[] = { | ||
1692 | B43_NPHY_AFECTL_OVER1, B43_NPHY_AFECTL_OVER, | ||
1693 | B43_NPHY_AFECTL_C1, B43_NPHY_AFECTL_C2, | ||
1694 | B43_NPHY_TXF_40CO_B1S1, B43_NPHY_RFCTL_OVER, | ||
1695 | 0x342, 0x343, 0x346, 0x347, | ||
1696 | 0x2ff, | ||
1697 | B43_NPHY_TXF_40CO_B1S0, B43_NPHY_TXF_40CO_B32S1, | ||
1698 | B43_NPHY_RFCTL_CMD, | ||
1699 | B43_NPHY_RFCTL_LUT_TRSW_UP1, B43_NPHY_RFCTL_LUT_TRSW_UP2, | ||
1700 | 0x340, 0x341, 0x344, 0x345, | ||
1701 | B43_NPHY_RFCTL_RSSIO1, B43_NPHY_RFCTL_RSSIO2 | ||
1702 | }; | ||
1703 | u16 *regs_to_store; | ||
1704 | int regs_amount; | ||
1601 | 1705 | ||
1602 | u16 class; | 1706 | u16 class; |
1603 | 1707 | ||
@@ -1617,6 +1721,15 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) | |||
1617 | u8 rx_core_state; | 1721 | u8 rx_core_state; |
1618 | int core, i, j, vcm; | 1722 | int core, i, j, vcm; |
1619 | 1723 | ||
1724 | if (dev->phy.rev >= 7) { | ||
1725 | regs_to_store = regs_to_store_rev7; | ||
1726 | regs_amount = ARRAY_SIZE(regs_to_store_rev7); | ||
1727 | } else { | ||
1728 | regs_to_store = regs_to_store_rev3; | ||
1729 | regs_amount = ARRAY_SIZE(regs_to_store_rev3); | ||
1730 | } | ||
1731 | BUG_ON(regs_amount > ARRAY_SIZE(saved_regs_phy)); | ||
1732 | |||
1620 | class = b43_nphy_classifier(dev, 0, 0); | 1733 | class = b43_nphy_classifier(dev, 0, 0); |
1621 | b43_nphy_classifier(dev, 7, 4); | 1734 | b43_nphy_classifier(dev, 7, 4); |
1622 | b43_nphy_read_clip_detection(dev, clip_state); | 1735 | b43_nphy_read_clip_detection(dev, clip_state); |
@@ -1624,22 +1737,29 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) | |||
1624 | 1737 | ||
1625 | saved_regs_phy_rfctl[0] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1); | 1738 | saved_regs_phy_rfctl[0] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1); |
1626 | saved_regs_phy_rfctl[1] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2); | 1739 | saved_regs_phy_rfctl[1] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2); |
1627 | for (i = 0; i < ARRAY_SIZE(regs_to_store); i++) | 1740 | for (i = 0; i < regs_amount; i++) |
1628 | saved_regs_phy[i] = b43_phy_read(dev, regs_to_store[i]); | 1741 | saved_regs_phy[i] = b43_phy_read(dev, regs_to_store[i]); |
1629 | 1742 | ||
1630 | b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_OFF, 0, 7); | 1743 | b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_OFF, 0, 7); |
1631 | b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_TRSW, 1, 7); | 1744 | b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_TRSW, 1, 7); |
1632 | b43_nphy_rf_ctl_override(dev, 0x1, 0, 0, false); | 1745 | |
1633 | b43_nphy_rf_ctl_override(dev, 0x2, 1, 0, false); | 1746 | if (dev->phy.rev >= 7) { |
1634 | b43_nphy_rf_ctl_override(dev, 0x80, 1, 0, false); | 1747 | /* TODO */ |
1635 | b43_nphy_rf_ctl_override(dev, 0x40, 1, 0, false); | 1748 | if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { |
1636 | 1749 | } else { | |
1637 | if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { | 1750 | } |
1638 | b43_nphy_rf_ctl_override(dev, 0x20, 0, 0, false); | ||
1639 | b43_nphy_rf_ctl_override(dev, 0x10, 1, 0, false); | ||
1640 | } else { | 1751 | } else { |
1641 | b43_nphy_rf_ctl_override(dev, 0x10, 0, 0, false); | 1752 | b43_nphy_rf_ctl_override(dev, 0x1, 0, 0, false); |
1642 | b43_nphy_rf_ctl_override(dev, 0x20, 1, 0, false); | 1753 | b43_nphy_rf_ctl_override(dev, 0x2, 1, 0, false); |
1754 | b43_nphy_rf_ctl_override(dev, 0x80, 1, 0, false); | ||
1755 | b43_nphy_rf_ctl_override(dev, 0x40, 1, 0, false); | ||
1756 | if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { | ||
1757 | b43_nphy_rf_ctl_override(dev, 0x20, 0, 0, false); | ||
1758 | b43_nphy_rf_ctl_override(dev, 0x10, 1, 0, false); | ||
1759 | } else { | ||
1760 | b43_nphy_rf_ctl_override(dev, 0x10, 0, 0, false); | ||
1761 | b43_nphy_rf_ctl_override(dev, 0x20, 1, 0, false); | ||
1762 | } | ||
1643 | } | 1763 | } |
1644 | 1764 | ||
1645 | rx_core_state = b43_nphy_get_rx_core_state(dev); | 1765 | rx_core_state = b43_nphy_get_rx_core_state(dev); |
@@ -1654,8 +1774,11 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) | |||
1654 | 1774 | ||
1655 | /* Grab RSSI results for every possible VCM */ | 1775 | /* Grab RSSI results for every possible VCM */ |
1656 | for (vcm = 0; vcm < 8; vcm++) { | 1776 | for (vcm = 0; vcm < 8; vcm++) { |
1657 | b43_radio_maskset(dev, r | B2056_RX_RSSI_MISC, 0xE3, | 1777 | if (dev->phy.rev >= 7) |
1658 | vcm << 2); | 1778 | ; |
1779 | else | ||
1780 | b43_radio_maskset(dev, r | B2056_RX_RSSI_MISC, | ||
1781 | 0xE3, vcm << 2); | ||
1659 | b43_nphy_poll_rssi(dev, N_RSSI_NB, results[vcm], 8); | 1782 | b43_nphy_poll_rssi(dev, N_RSSI_NB, results[vcm], 8); |
1660 | } | 1783 | } |
1661 | 1784 | ||
@@ -1682,8 +1805,11 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) | |||
1682 | } | 1805 | } |
1683 | 1806 | ||
1684 | /* Select the best VCM */ | 1807 | /* Select the best VCM */ |
1685 | b43_radio_maskset(dev, r | B2056_RX_RSSI_MISC, 0xE3, | 1808 | if (dev->phy.rev >= 7) |
1686 | vcm_final << 2); | 1809 | ; |
1810 | else | ||
1811 | b43_radio_maskset(dev, r | B2056_RX_RSSI_MISC, | ||
1812 | 0xE3, vcm_final << 2); | ||
1687 | 1813 | ||
1688 | for (i = 0; i < 4; i++) { | 1814 | for (i = 0; i < 4; i++) { |
1689 | if (core != i / 2) | 1815 | if (core != i / 2) |
@@ -1736,9 +1862,9 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) | |||
1736 | 1862 | ||
1737 | b43_phy_set(dev, B43_NPHY_RFCTL_OVER, 0x1); | 1863 | b43_phy_set(dev, B43_NPHY_RFCTL_OVER, 0x1); |
1738 | b43_phy_set(dev, B43_NPHY_RFCTL_CMD, B43_NPHY_RFCTL_CMD_RXTX); | 1864 | b43_phy_set(dev, B43_NPHY_RFCTL_CMD, B43_NPHY_RFCTL_CMD_RXTX); |
1739 | b43_phy_mask(dev, B43_NPHY_TXF_40CO_B1S1, ~0x1); | 1865 | b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, ~0x1); |
1740 | 1866 | ||
1741 | for (i = 0; i < ARRAY_SIZE(regs_to_store); i++) | 1867 | for (i = 0; i < regs_amount; i++) |
1742 | b43_phy_write(dev, regs_to_store[i], saved_regs_phy[i]); | 1868 | b43_phy_write(dev, regs_to_store[i], saved_regs_phy[i]); |
1743 | 1869 | ||
1744 | /* Store for future configuration */ | 1870 | /* Store for future configuration */ |
@@ -2494,8 +2620,8 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev) | |||
2494 | struct ssb_sprom *sprom = dev->dev->bus_sprom; | 2620 | struct ssb_sprom *sprom = dev->dev->bus_sprom; |
2495 | 2621 | ||
2496 | /* TX to RX */ | 2622 | /* TX to RX */ |
2497 | u8 tx2rx_events[8] = { 0x4, 0x3, 0x6, 0x5, 0x2, 0x1, 0x8, 0x1F }; | 2623 | u8 tx2rx_events[7] = { 0x4, 0x3, 0x5, 0x2, 0x1, 0x8, 0x1F }; |
2498 | u8 tx2rx_delays[8] = { 8, 4, 2, 2, 4, 4, 6, 1 }; | 2624 | u8 tx2rx_delays[7] = { 8, 4, 4, 4, 4, 6, 1 }; |
2499 | /* RX to TX */ | 2625 | /* RX to TX */ |
2500 | u8 rx2tx_events_ipa[9] = { 0x0, 0x1, 0x2, 0x8, 0x5, 0x6, 0xF, 0x3, | 2626 | u8 rx2tx_events_ipa[9] = { 0x0, 0x1, 0x2, 0x8, 0x5, 0x6, 0xF, 0x3, |
2501 | 0x1F }; | 2627 | 0x1F }; |
@@ -2503,6 +2629,23 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev) | |||
2503 | u8 rx2tx_events[9] = { 0x0, 0x1, 0x2, 0x8, 0x5, 0x6, 0x3, 0x4, 0x1F }; | 2629 | u8 rx2tx_events[9] = { 0x0, 0x1, 0x2, 0x8, 0x5, 0x6, 0x3, 0x4, 0x1F }; |
2504 | u8 rx2tx_delays[9] = { 8, 6, 6, 4, 4, 18, 42, 1, 1 }; | 2630 | u8 rx2tx_delays[9] = { 8, 6, 6, 4, 4, 18, 42, 1, 1 }; |
2505 | 2631 | ||
2632 | u16 vmids[5][4] = { | ||
2633 | { 0xa2, 0xb4, 0xb4, 0x89, }, /* 0 */ | ||
2634 | { 0xb4, 0xb4, 0xb4, 0x24, }, /* 1 */ | ||
2635 | { 0xa2, 0xb4, 0xb4, 0x74, }, /* 2 */ | ||
2636 | { 0xa2, 0xb4, 0xb4, 0x270, }, /* 3 */ | ||
2637 | { 0xa2, 0xb4, 0xb4, 0x00, }, /* 4 and 5 */ | ||
2638 | }; | ||
2639 | u16 gains[5][4] = { | ||
2640 | { 0x02, 0x02, 0x02, 0x00, }, /* 0 */ | ||
2641 | { 0x02, 0x02, 0x02, 0x02, }, /* 1 */ | ||
2642 | { 0x02, 0x02, 0x02, 0x04, }, /* 2 */ | ||
2643 | { 0x02, 0x02, 0x02, 0x00, }, /* 3 */ | ||
2644 | { 0x02, 0x02, 0x02, 0x00, }, /* 4 and 5 */ | ||
2645 | }; | ||
2646 | u16 *vmid, *gain; | ||
2647 | |||
2648 | u8 pdet_range; | ||
2506 | u16 tmp16; | 2649 | u16 tmp16; |
2507 | u32 tmp32; | 2650 | u32 tmp32; |
2508 | 2651 | ||
@@ -2561,7 +2704,71 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev) | |||
2561 | b43_ntab_write(dev, B43_NTAB16(8, 0), 2); | 2704 | b43_ntab_write(dev, B43_NTAB16(8, 0), 2); |
2562 | b43_ntab_write(dev, B43_NTAB16(8, 16), 2); | 2705 | b43_ntab_write(dev, B43_NTAB16(8, 16), 2); |
2563 | 2706 | ||
2564 | /* TODO */ | 2707 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) |
2708 | pdet_range = sprom->fem.ghz2.pdet_range; | ||
2709 | else | ||
2710 | pdet_range = sprom->fem.ghz5.pdet_range; | ||
2711 | vmid = vmids[min_t(u16, pdet_range, 4)]; | ||
2712 | gain = gains[min_t(u16, pdet_range, 4)]; | ||
2713 | switch (pdet_range) { | ||
2714 | case 3: | ||
2715 | if (!(dev->phy.rev >= 4 && | ||
2716 | b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)) | ||
2717 | break; | ||
2718 | /* FALL THROUGH */ | ||
2719 | case 0: | ||
2720 | case 1: | ||
2721 | b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x08), 4, vmid); | ||
2722 | b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x18), 4, vmid); | ||
2723 | b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x0c), 4, gain); | ||
2724 | b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x1c), 4, gain); | ||
2725 | break; | ||
2726 | case 2: | ||
2727 | if (dev->phy.rev >= 6) { | ||
2728 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) | ||
2729 | vmid[3] = 0x94; | ||
2730 | else | ||
2731 | vmid[3] = 0x8e; | ||
2732 | gain[3] = 3; | ||
2733 | } else if (dev->phy.rev == 5) { | ||
2734 | vmid[3] = 0x84; | ||
2735 | gain[3] = 2; | ||
2736 | } | ||
2737 | b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x08), 4, vmid); | ||
2738 | b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x18), 4, vmid); | ||
2739 | b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x0c), 4, gain); | ||
2740 | b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x1c), 4, gain); | ||
2741 | break; | ||
2742 | case 4: | ||
2743 | case 5: | ||
2744 | if (b43_current_band(dev->wl) != IEEE80211_BAND_2GHZ) { | ||
2745 | if (pdet_range == 4) { | ||
2746 | vmid[3] = 0x8e; | ||
2747 | tmp16 = 0x96; | ||
2748 | gain[3] = 0x2; | ||
2749 | } else { | ||
2750 | vmid[3] = 0x89; | ||
2751 | tmp16 = 0x89; | ||
2752 | gain[3] = 0; | ||
2753 | } | ||
2754 | } else { | ||
2755 | if (pdet_range == 4) { | ||
2756 | vmid[3] = 0x89; | ||
2757 | tmp16 = 0x8b; | ||
2758 | gain[3] = 0x2; | ||
2759 | } else { | ||
2760 | vmid[3] = 0x74; | ||
2761 | tmp16 = 0x70; | ||
2762 | gain[3] = 0; | ||
2763 | } | ||
2764 | } | ||
2765 | b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x08), 4, vmid); | ||
2766 | b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x0c), 4, gain); | ||
2767 | vmid[3] = tmp16; | ||
2768 | b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x18), 4, vmid); | ||
2769 | b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x1c), 4, gain); | ||
2770 | break; | ||
2771 | } | ||
2565 | 2772 | ||
2566 | b43_radio_write(dev, B2056_RX0 | B2056_RX_MIXA_MAST_BIAS, 0x00); | 2773 | b43_radio_write(dev, B2056_RX0 | B2056_RX_MIXA_MAST_BIAS, 0x00); |
2567 | b43_radio_write(dev, B2056_RX1 | B2056_RX_MIXA_MAST_BIAS, 0x00); | 2774 | b43_radio_write(dev, B2056_RX1 | B2056_RX_MIXA_MAST_BIAS, 0x00); |
@@ -2600,7 +2807,7 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev) | |||
2600 | /* Dropped probably-always-true condition */ | 2807 | /* Dropped probably-always-true condition */ |
2601 | b43_phy_write(dev, B43_NPHY_ED_CRS40ASSERTTHRESH0, 0x03eb); | 2808 | b43_phy_write(dev, B43_NPHY_ED_CRS40ASSERTTHRESH0, 0x03eb); |
2602 | b43_phy_write(dev, B43_NPHY_ED_CRS40ASSERTTHRESH1, 0x03eb); | 2809 | b43_phy_write(dev, B43_NPHY_ED_CRS40ASSERTTHRESH1, 0x03eb); |
2603 | b43_phy_write(dev, B43_NPHY_ED_CRS40DEASSERTTHRESH1, 0x0341); | 2810 | b43_phy_write(dev, B43_NPHY_ED_CRS40DEASSERTTHRESH0, 0x0341); |
2604 | b43_phy_write(dev, B43_NPHY_ED_CRS40DEASSERTTHRESH1, 0x0341); | 2811 | b43_phy_write(dev, B43_NPHY_ED_CRS40DEASSERTTHRESH1, 0x0341); |
2605 | b43_phy_write(dev, B43_NPHY_ED_CRS20LASSERTTHRESH0, 0x042b); | 2812 | b43_phy_write(dev, B43_NPHY_ED_CRS20LASSERTTHRESH0, 0x042b); |
2606 | b43_phy_write(dev, B43_NPHY_ED_CRS20LASSERTTHRESH1, 0x042b); | 2813 | b43_phy_write(dev, B43_NPHY_ED_CRS20LASSERTTHRESH1, 0x042b); |
@@ -3211,6 +3418,20 @@ static void b43_nphy_tx_prepare_adjusted_power_table(struct b43_wldev *dev) | |||
3211 | u8 idx, delta; | 3418 | u8 idx, delta; |
3212 | u8 i, stf_mode; | 3419 | u8 i, stf_mode; |
3213 | 3420 | ||
3421 | /* Array adj_pwr_tbl corresponds to the hardware table. It consists of | ||
3422 | * 21 groups, each containing 4 entries. | ||
3423 | * | ||
3424 | * First group has entries for CCK modulation. | ||
3425 | * The rest of groups has 1 entry per modulation (SISO, CDD, STBC, SDM). | ||
3426 | * | ||
3427 | * Group 0 is for CCK | ||
3428 | * Groups 1..4 use BPSK (group per coding rate) | ||
3429 | * Groups 5..8 use QPSK (group per coding rate) | ||
3430 | * Groups 9..12 use 16-QAM (group per coding rate) | ||
3431 | * Groups 13..16 use 64-QAM (group per coding rate) | ||
3432 | * Groups 17..20 are unknown | ||
3433 | */ | ||
3434 | |||
3214 | for (i = 0; i < 4; i++) | 3435 | for (i = 0; i < 4; i++) |
3215 | nphy->adj_pwr_tbl[i] = nphy->tx_power_offset[i]; | 3436 | nphy->adj_pwr_tbl[i] = nphy->tx_power_offset[i]; |
3216 | 3437 | ||
@@ -3409,10 +3630,8 @@ static void b43_nphy_tx_power_ctl_setup(struct b43_wldev *dev) | |||
3409 | } | 3630 | } |
3410 | 3631 | ||
3411 | b43_nphy_tx_prepare_adjusted_power_table(dev); | 3632 | b43_nphy_tx_prepare_adjusted_power_table(dev); |
3412 | /* | ||
3413 | b43_ntab_write_bulk(dev, B43_NTAB16(26, 64), 84, nphy->adj_pwr_tbl); | 3633 | b43_ntab_write_bulk(dev, B43_NTAB16(26, 64), 84, nphy->adj_pwr_tbl); |
3414 | b43_ntab_write_bulk(dev, B43_NTAB16(27, 64), 84, nphy->adj_pwr_tbl); | 3634 | b43_ntab_write_bulk(dev, B43_NTAB16(27, 64), 84, nphy->adj_pwr_tbl); |
3415 | */ | ||
3416 | 3635 | ||
3417 | if (nphy->hang_avoid) | 3636 | if (nphy->hang_avoid) |
3418 | b43_nphy_stay_in_carrier_search(dev, false); | 3637 | b43_nphy_stay_in_carrier_search(dev, false); |
@@ -5124,7 +5343,7 @@ static int b43_phy_initn(struct b43_wldev *dev) | |||
5124 | b43_phy_write(dev, B43_NPHY_TXMACIF_HOLDOFF, 0x0015); | 5343 | b43_phy_write(dev, B43_NPHY_TXMACIF_HOLDOFF, 0x0015); |
5125 | b43_phy_write(dev, B43_NPHY_TXMACDELAY, 0x0320); | 5344 | b43_phy_write(dev, B43_NPHY_TXMACDELAY, 0x0320); |
5126 | if (phy->rev >= 3 && phy->rev <= 6) | 5345 | if (phy->rev >= 3 && phy->rev <= 6) |
5127 | b43_phy_write(dev, B43_NPHY_PLOAD_CSENSE_EXTLEN, 0x0014); | 5346 | b43_phy_write(dev, B43_NPHY_PLOAD_CSENSE_EXTLEN, 0x0032); |
5128 | b43_nphy_tx_lp_fbw(dev); | 5347 | b43_nphy_tx_lp_fbw(dev); |
5129 | if (phy->rev >= 3) | 5348 | if (phy->rev >= 3) |
5130 | b43_nphy_spur_workaround(dev); | 5349 | b43_nphy_spur_workaround(dev); |
@@ -5338,7 +5557,6 @@ static void b43_nphy_op_prepare_structs(struct b43_wldev *dev) | |||
5338 | nphy->hang_avoid = (phy->rev == 3 || phy->rev == 4); | 5557 | nphy->hang_avoid = (phy->rev == 3 || phy->rev == 4); |
5339 | nphy->spur_avoid = (phy->rev >= 3) ? | 5558 | nphy->spur_avoid = (phy->rev >= 3) ? |
5340 | B43_SPUR_AVOID_AUTO : B43_SPUR_AVOID_DISABLE; | 5559 | B43_SPUR_AVOID_AUTO : B43_SPUR_AVOID_DISABLE; |
5341 | nphy->init_por = true; | ||
5342 | nphy->gain_boost = true; /* this way we follow wl, assume it is true */ | 5560 | nphy->gain_boost = true; /* this way we follow wl, assume it is true */ |
5343 | nphy->txrx_chain = 2; /* sth different than 0 and 1 for now */ | 5561 | nphy->txrx_chain = 2; /* sth different than 0 and 1 for now */ |
5344 | nphy->phyrxchain = 3; /* to avoid b43_nphy_set_rx_core_state like wl */ | 5562 | nphy->phyrxchain = 3; /* to avoid b43_nphy_set_rx_core_state like wl */ |
@@ -5379,8 +5597,6 @@ static void b43_nphy_op_prepare_structs(struct b43_wldev *dev) | |||
5379 | nphy->ipa2g_on = sprom->fem.ghz2.extpa_gain == 2; | 5597 | nphy->ipa2g_on = sprom->fem.ghz2.extpa_gain == 2; |
5380 | nphy->ipa5g_on = sprom->fem.ghz5.extpa_gain == 2; | 5598 | nphy->ipa5g_on = sprom->fem.ghz5.extpa_gain == 2; |
5381 | } | 5599 | } |
5382 | |||
5383 | nphy->init_por = true; | ||
5384 | } | 5600 | } |
5385 | 5601 | ||
5386 | static void b43_nphy_op_free(struct b43_wldev *dev) | 5602 | static void b43_nphy_op_free(struct b43_wldev *dev) |
@@ -5441,8 +5657,11 @@ static u16 b43_nphy_op_radio_read(struct b43_wldev *dev, u16 reg) | |||
5441 | { | 5657 | { |
5442 | /* Register 1 is a 32-bit register. */ | 5658 | /* Register 1 is a 32-bit register. */ |
5443 | B43_WARN_ON(reg == 1); | 5659 | B43_WARN_ON(reg == 1); |
5444 | /* N-PHY needs 0x100 for read access */ | 5660 | |
5445 | reg |= 0x100; | 5661 | if (dev->phy.rev >= 7) |
5662 | reg |= 0x200; /* Radio 0x2057 */ | ||
5663 | else | ||
5664 | reg |= 0x100; | ||
5446 | 5665 | ||
5447 | b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg); | 5666 | b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg); |
5448 | return b43_read16(dev, B43_MMIO_RADIO_DATA_LOW); | 5667 | return b43_read16(dev, B43_MMIO_RADIO_DATA_LOW); |
@@ -5488,10 +5707,12 @@ static void b43_nphy_op_software_rfkill(struct b43_wldev *dev, | |||
5488 | } | 5707 | } |
5489 | } else { | 5708 | } else { |
5490 | if (dev->phy.rev >= 7) { | 5709 | if (dev->phy.rev >= 7) { |
5491 | b43_radio_2057_init(dev); | 5710 | if (!dev->phy.radio_on) |
5711 | b43_radio_2057_init(dev); | ||
5492 | b43_switch_channel(dev, dev->phy.channel); | 5712 | b43_switch_channel(dev, dev->phy.channel); |
5493 | } else if (dev->phy.rev >= 3) { | 5713 | } else if (dev->phy.rev >= 3) { |
5494 | b43_radio_init2056(dev); | 5714 | if (!dev->phy.radio_on) |
5715 | b43_radio_init2056(dev); | ||
5495 | b43_switch_channel(dev, dev->phy.channel); | 5716 | b43_switch_channel(dev, dev->phy.channel); |
5496 | } else { | 5717 | } else { |
5497 | b43_radio_init2055(dev); | 5718 | b43_radio_init2055(dev); |
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h index 9a5b6bc27d24..ecfbf66dbc3b 100644 --- a/drivers/net/wireless/b43/phy_n.h +++ b/drivers/net/wireless/b43/phy_n.h | |||
@@ -931,7 +931,6 @@ struct b43_phy_n { | |||
931 | u16 papd_epsilon_offset[2]; | 931 | u16 papd_epsilon_offset[2]; |
932 | s32 preamble_override; | 932 | s32 preamble_override; |
933 | u32 bb_mult_save; | 933 | u32 bb_mult_save; |
934 | bool init_por; | ||
935 | 934 | ||
936 | bool gain_boost; | 935 | bool gain_boost; |
937 | bool elna_gain_config; | 936 | bool elna_gain_config; |
diff --git a/drivers/net/wireless/b43/radio_2056.c b/drivers/net/wireless/b43/radio_2056.c index b4fd9345d673..2ce25607c60d 100644 --- a/drivers/net/wireless/b43/radio_2056.c +++ b/drivers/net/wireless/b43/radio_2056.c | |||
@@ -48,7 +48,7 @@ struct b2056_inittabs_pts { | |||
48 | unsigned int rx_length; | 48 | unsigned int rx_length; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static const struct b2056_inittab_entry b2056_inittab_rev3_syn[] = { | 51 | static const struct b2056_inittab_entry b2056_inittab_phy_rev3_syn[] = { |
52 | [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 52 | [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
53 | [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 53 | [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
54 | [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 54 | [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -232,7 +232,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev3_syn[] = { | |||
232 | [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 232 | [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
233 | }; | 233 | }; |
234 | 234 | ||
235 | static const struct b2056_inittab_entry b2056_inittab_rev3_tx[] = { | 235 | static const struct b2056_inittab_entry b2056_inittab_phy_rev3_tx[] = { |
236 | [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 236 | [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
237 | [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 237 | [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
238 | [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 238 | [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -380,7 +380,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev3_tx[] = { | |||
380 | [B2056_TX_STATUS_TXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 380 | [B2056_TX_STATUS_TXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
381 | }; | 381 | }; |
382 | 382 | ||
383 | static const struct b2056_inittab_entry b2056_inittab_rev3_rx[] = { | 383 | static const struct b2056_inittab_entry b2056_inittab_phy_rev3_rx[] = { |
384 | [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 384 | [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
385 | [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 385 | [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
386 | [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 386 | [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -530,7 +530,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev3_rx[] = { | |||
530 | [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 530 | [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
531 | }; | 531 | }; |
532 | 532 | ||
533 | static const struct b2056_inittab_entry b2056_inittab_rev4_syn[] = { | 533 | static const struct b2056_inittab_entry b2056_inittab_phy_rev4_syn[] = { |
534 | [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 534 | [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
535 | [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 535 | [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
536 | [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 536 | [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -714,7 +714,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev4_syn[] = { | |||
714 | [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 714 | [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
715 | }; | 715 | }; |
716 | 716 | ||
717 | static const struct b2056_inittab_entry b2056_inittab_rev4_tx[] = { | 717 | static const struct b2056_inittab_entry b2056_inittab_phy_rev4_tx[] = { |
718 | [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 718 | [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
719 | [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 719 | [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
720 | [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 720 | [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -862,7 +862,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev4_tx[] = { | |||
862 | [B2056_TX_STATUS_TXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 862 | [B2056_TX_STATUS_TXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
863 | }; | 863 | }; |
864 | 864 | ||
865 | static const struct b2056_inittab_entry b2056_inittab_rev4_rx[] = { | 865 | static const struct b2056_inittab_entry b2056_inittab_phy_rev4_rx[] = { |
866 | [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 866 | [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
867 | [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 867 | [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
868 | [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 868 | [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -1012,7 +1012,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev4_rx[] = { | |||
1012 | [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1012 | [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1013 | }; | 1013 | }; |
1014 | 1014 | ||
1015 | static const struct b2056_inittab_entry b2056_inittab_rev5_syn[] = { | 1015 | static const struct b2056_inittab_entry b2056_inittab_radio_rev5_syn[] = { |
1016 | [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1016 | [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1017 | [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1017 | [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1018 | [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1018 | [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -1196,7 +1196,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev5_syn[] = { | |||
1196 | [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1196 | [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1197 | }; | 1197 | }; |
1198 | 1198 | ||
1199 | static const struct b2056_inittab_entry b2056_inittab_rev5_tx[] = { | 1199 | static const struct b2056_inittab_entry b2056_inittab_radio_rev5_tx[] = { |
1200 | [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1200 | [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1201 | [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1201 | [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1202 | [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1202 | [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -1352,7 +1352,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev5_tx[] = { | |||
1352 | [B2056_TX_GMBB_IDAC7] = { .ghz5 = 0x0075, .ghz2 = 0x0075, UPLOAD, }, | 1352 | [B2056_TX_GMBB_IDAC7] = { .ghz5 = 0x0075, .ghz2 = 0x0075, UPLOAD, }, |
1353 | }; | 1353 | }; |
1354 | 1354 | ||
1355 | static const struct b2056_inittab_entry b2056_inittab_rev5_rx[] = { | 1355 | static const struct b2056_inittab_entry b2056_inittab_radio_rev5_rx[] = { |
1356 | [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1356 | [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1357 | [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1357 | [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1358 | [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1358 | [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -1502,7 +1502,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev5_rx[] = { | |||
1502 | [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1502 | [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1503 | }; | 1503 | }; |
1504 | 1504 | ||
1505 | static const struct b2056_inittab_entry b2056_inittab_rev6_syn[] = { | 1505 | static const struct b2056_inittab_entry b2056_inittab_radio_rev6_syn[] = { |
1506 | [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1506 | [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1507 | [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1507 | [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1508 | [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1508 | [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -1686,7 +1686,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev6_syn[] = { | |||
1686 | [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1686 | [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1687 | }; | 1687 | }; |
1688 | 1688 | ||
1689 | static const struct b2056_inittab_entry b2056_inittab_rev6_tx[] = { | 1689 | static const struct b2056_inittab_entry b2056_inittab_radio_rev6_tx[] = { |
1690 | [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1690 | [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1691 | [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1691 | [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1692 | [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1692 | [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -1842,7 +1842,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev6_tx[] = { | |||
1842 | [B2056_TX_GMBB_IDAC7] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, | 1842 | [B2056_TX_GMBB_IDAC7] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, |
1843 | }; | 1843 | }; |
1844 | 1844 | ||
1845 | static const struct b2056_inittab_entry b2056_inittab_rev6_rx[] = { | 1845 | static const struct b2056_inittab_entry b2056_inittab_radio_rev6_rx[] = { |
1846 | [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1846 | [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1847 | [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1847 | [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1848 | [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1848 | [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -1992,7 +1992,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev6_rx[] = { | |||
1992 | [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1992 | [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1993 | }; | 1993 | }; |
1994 | 1994 | ||
1995 | static const struct b2056_inittab_entry b2056_inittab_rev7_syn[] = { | 1995 | static const struct b2056_inittab_entry b2056_inittab_radio_rev7_9_syn[] = { |
1996 | [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1996 | [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1997 | [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1997 | [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
1998 | [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 1998 | [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -2176,7 +2176,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev7_syn[] = { | |||
2176 | [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2176 | [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2177 | }; | 2177 | }; |
2178 | 2178 | ||
2179 | static const struct b2056_inittab_entry b2056_inittab_rev7_tx[] = { | 2179 | static const struct b2056_inittab_entry b2056_inittab_radio_rev7_9_tx[] = { |
2180 | [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2180 | [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2181 | [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2181 | [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2182 | [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2182 | [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -2332,7 +2332,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev7_tx[] = { | |||
2332 | [B2056_TX_GMBB_IDAC7] = { .ghz5 = 0x0075, .ghz2 = 0x0075, UPLOAD, }, | 2332 | [B2056_TX_GMBB_IDAC7] = { .ghz5 = 0x0075, .ghz2 = 0x0075, UPLOAD, }, |
2333 | }; | 2333 | }; |
2334 | 2334 | ||
2335 | static const struct b2056_inittab_entry b2056_inittab_rev7_rx[] = { | 2335 | static const struct b2056_inittab_entry b2056_inittab_radio_rev7_9_rx[] = { |
2336 | [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2336 | [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2337 | [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2337 | [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2338 | [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2338 | [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -2482,7 +2482,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev7_rx[] = { | |||
2482 | [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2482 | [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2483 | }; | 2483 | }; |
2484 | 2484 | ||
2485 | static const struct b2056_inittab_entry b2056_inittab_rev8_syn[] = { | 2485 | static const struct b2056_inittab_entry b2056_inittab_radio_rev8_syn[] = { |
2486 | [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2486 | [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2487 | [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2487 | [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2488 | [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2488 | [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -2666,7 +2666,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev8_syn[] = { | |||
2666 | [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2666 | [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2667 | }; | 2667 | }; |
2668 | 2668 | ||
2669 | static const struct b2056_inittab_entry b2056_inittab_rev8_tx[] = { | 2669 | static const struct b2056_inittab_entry b2056_inittab_radio_rev8_tx[] = { |
2670 | [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2670 | [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2671 | [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2671 | [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2672 | [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2672 | [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -2822,7 +2822,7 @@ static const struct b2056_inittab_entry b2056_inittab_rev8_tx[] = { | |||
2822 | [B2056_TX_GMBB_IDAC7] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, | 2822 | [B2056_TX_GMBB_IDAC7] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, |
2823 | }; | 2823 | }; |
2824 | 2824 | ||
2825 | static const struct b2056_inittab_entry b2056_inittab_rev8_rx[] = { | 2825 | static const struct b2056_inittab_entry b2056_inittab_radio_rev8_rx[] = { |
2826 | [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2826 | [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2827 | [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2827 | [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2828 | [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2828 | [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
@@ -2972,24 +2972,69 @@ static const struct b2056_inittab_entry b2056_inittab_rev8_rx[] = { | |||
2972 | [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, | 2972 | [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, |
2973 | }; | 2973 | }; |
2974 | 2974 | ||
2975 | #define INITTABSPTS(prefix) \ | 2975 | static const struct b2056_inittab_entry b2056_inittab_radio_rev11_syn[] = { |
2976 | .syn = prefix##_syn, \ | 2976 | [B2056_SYN_PLL_PFD] = { .ghz5 = 0x0006, .ghz2 = 0x0006, UPLOAD, }, |
2977 | .syn_length = ARRAY_SIZE(prefix##_syn), \ | 2977 | [B2056_SYN_PLL_CP2] = { .ghz5 = 0x003f, .ghz2 = 0x003f, UPLOAD, }, |
2978 | .tx = prefix##_tx, \ | 2978 | [B2056_SYN_PLL_LOOPFILTER1] = { .ghz5 = 0x0006, .ghz2 = 0x0006, UPLOAD, }, |
2979 | .tx_length = ARRAY_SIZE(prefix##_tx), \ | 2979 | [B2056_SYN_PLL_LOOPFILTER2] = { .ghz5 = 0x0006, .ghz2 = 0x0006, UPLOAD, }, |
2980 | .rx = prefix##_rx, \ | 2980 | [B2056_SYN_PLL_LOOPFILTER4] = { .ghz5 = 0x002b, .ghz2 = 0x002b, UPLOAD, }, |
2981 | .rx_length = ARRAY_SIZE(prefix##_rx) | 2981 | [B2056_SYN_PLL_VCO2] = { .ghz5 = 0x00f7, .ghz2 = 0x00f7, UPLOAD, }, |
2982 | [B2056_SYN_PLL_VCOCAL12] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, | ||
2983 | [B2056_SYN_LOGENBUF2] = { .ghz5 = 0x008f, .ghz2 = 0x008f, UPLOAD, }, | ||
2984 | }; | ||
2982 | 2985 | ||
2983 | static const struct b2056_inittabs_pts b2056_inittabs[] = { | 2986 | static const struct b2056_inittab_entry b2056_inittab_radio_rev11_tx[] = { |
2984 | [3] = { INITTABSPTS(b2056_inittab_rev3) }, | 2987 | [B2056_TX_PA_SPARE2] = { .ghz5 = 0x00ee, .ghz2 = 0x00ee, UPLOAD, }, |
2985 | [4] = { INITTABSPTS(b2056_inittab_rev4) }, | 2988 | [B2056_TX_INTPAA_IAUX_STAT] = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, }, |
2986 | [5] = { INITTABSPTS(b2056_inittab_rev5) }, | 2989 | [B2056_TX_INTPAA_IMAIN_STAT] = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, }, |
2987 | [6] = { INITTABSPTS(b2056_inittab_rev6) }, | 2990 | [B2056_TX_INTPAA_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, |
2988 | [7] = { INITTABSPTS(b2056_inittab_rev7) }, | 2991 | [B2056_TX_INTPAG_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, |
2989 | [8] = { INITTABSPTS(b2056_inittab_rev8) }, | 2992 | [B2056_TX_PADA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, |
2990 | [9] = { INITTABSPTS(b2056_inittab_rev7) }, | 2993 | [B2056_TX_PADA_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, |
2994 | [B2056_TX_PADG_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, | ||
2995 | [B2056_TX_PGAA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, | ||
2996 | [B2056_TX_PGAA_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, | ||
2997 | [B2056_TX_PGAG_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, | ||
2998 | [B2056_TX_GMBB_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, | ||
2999 | [B2056_TX_TXSPARE1] = { .ghz5 = 0x0030, .ghz2 = 0x0030, UPLOAD, }, | ||
3000 | }; | ||
3001 | |||
3002 | static const struct b2056_inittab_entry b2056_inittab_radio_rev11_rx[] = { | ||
3003 | [B2056_RX_BIASPOLE_LNAA1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, | ||
3004 | [B2056_RX_LNAA2_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, | ||
3005 | [B2056_RX_BIASPOLE_LNAG1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, | ||
3006 | [B2056_RX_LNAG2_IDAC] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, | ||
3007 | [B2056_RX_MIXA_VCM] = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, }, | ||
3008 | [B2056_RX_MIXA_LOB_BIAS] = { .ghz5 = 0x0088, .ghz2 = 0x0088, UPLOAD, }, | ||
3009 | [B2056_RX_MIXA_BIAS_AUX] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, | ||
3010 | [B2056_RX_MIXG_VCM] = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, }, | ||
3011 | [B2056_RX_TIA_IOPAMP] = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, }, | ||
3012 | [B2056_RX_TIA_QOPAMP] = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, }, | ||
3013 | [B2056_RX_TIA_IMISC] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, | ||
3014 | [B2056_RX_TIA_QMISC] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, | ||
3015 | [B2056_RX_RXLPF_OUTVCM] = { .ghz5 = 0x0004, .ghz2 = 0x0004, UPLOAD, }, | ||
3016 | [B2056_RX_VGA_BIAS_DCCANCEL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, | ||
3017 | [B2056_RX_RXSPARE3] = { .ghz5 = 0x0005, .ghz2 = 0x0005, UPLOAD, }, | ||
2991 | }; | 3018 | }; |
2992 | 3019 | ||
3020 | #define INITTABSPTS(prefix) \ | ||
3021 | static const struct b2056_inittabs_pts prefix = { \ | ||
3022 | .syn = prefix##_syn, \ | ||
3023 | .syn_length = ARRAY_SIZE(prefix##_syn), \ | ||
3024 | .tx = prefix##_tx, \ | ||
3025 | .tx_length = ARRAY_SIZE(prefix##_tx), \ | ||
3026 | .rx = prefix##_rx, \ | ||
3027 | .rx_length = ARRAY_SIZE(prefix##_rx), \ | ||
3028 | } | ||
3029 | |||
3030 | INITTABSPTS(b2056_inittab_phy_rev3); | ||
3031 | INITTABSPTS(b2056_inittab_phy_rev4); | ||
3032 | INITTABSPTS(b2056_inittab_radio_rev5); | ||
3033 | INITTABSPTS(b2056_inittab_radio_rev6); | ||
3034 | INITTABSPTS(b2056_inittab_radio_rev7_9); | ||
3035 | INITTABSPTS(b2056_inittab_radio_rev8); | ||
3036 | INITTABSPTS(b2056_inittab_radio_rev11); | ||
3037 | |||
2993 | #define RADIOREGS3(r00, r01, r02, r03, r04, r05, r06, r07, r08, r09, \ | 3038 | #define RADIOREGS3(r00, r01, r02, r03, r04, r05, r06, r07, r08, r09, \ |
2994 | r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, \ | 3039 | r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, \ |
2995 | r20, r21, r22, r23, r24, r25, r26, r27, r28, r29, \ | 3040 | r20, r21, r22, r23, r24, r25, r26, r27, r28, r29, \ |
@@ -3041,7 +3086,7 @@ static const struct b2056_inittabs_pts b2056_inittabs[] = { | |||
3041 | .phy_regs.phy_bw6 = r5 | 3086 | .phy_regs.phy_bw6 = r5 |
3042 | 3087 | ||
3043 | /* http://bcm-v4.sipsolutions.net/802.11/Radio/2056/ChannelTable */ | 3088 | /* http://bcm-v4.sipsolutions.net/802.11/Radio/2056/ChannelTable */ |
3044 | static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev3[] = { | 3089 | static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_phy_rev3[] = { |
3045 | { .freq = 4920, | 3090 | { .freq = 4920, |
3046 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, | 3091 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, |
3047 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, | 3092 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, |
@@ -4036,7 +4081,7 @@ static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev3[] = | |||
4036 | }, | 4081 | }, |
4037 | }; | 4082 | }; |
4038 | 4083 | ||
4039 | static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev4[] = { | 4084 | static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_phy_rev4[] = { |
4040 | { .freq = 4920, | 4085 | { .freq = 4920, |
4041 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, | 4086 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, |
4042 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, | 4087 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, |
@@ -5031,7 +5076,7 @@ static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev4[] = | |||
5031 | }, | 5076 | }, |
5032 | }; | 5077 | }; |
5033 | 5078 | ||
5034 | static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev5[] = { | 5079 | static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_radio_rev5[] = { |
5035 | { .freq = 4920, | 5080 | { .freq = 4920, |
5036 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, | 5081 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, |
5037 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, | 5082 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, |
@@ -6026,7 +6071,7 @@ static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev5[] = | |||
6026 | }, | 6071 | }, |
6027 | }; | 6072 | }; |
6028 | 6073 | ||
6029 | static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev6[] = { | 6074 | static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_radio_rev6[] = { |
6030 | { .freq = 4920, | 6075 | { .freq = 4920, |
6031 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, | 6076 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, |
6032 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, | 6077 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, |
@@ -7021,7 +7066,7 @@ static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev6[] = | |||
7021 | }, | 7066 | }, |
7022 | }; | 7067 | }; |
7023 | 7068 | ||
7024 | static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev7_9[] = { | 7069 | static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_radio_rev7_9[] = { |
7025 | { .freq = 4920, | 7070 | { .freq = 4920, |
7026 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, | 7071 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, |
7027 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, | 7072 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, |
@@ -8016,7 +8061,7 @@ static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev7_9[] | |||
8016 | }, | 8061 | }, |
8017 | }; | 8062 | }; |
8018 | 8063 | ||
8019 | static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev8[] = { | 8064 | static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_radio_rev8[] = { |
8020 | { .freq = 4920, | 8065 | { .freq = 4920, |
8021 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, | 8066 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, |
8022 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, | 8067 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, |
@@ -9011,6 +9056,1154 @@ static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev8[] = | |||
9011 | }, | 9056 | }, |
9012 | }; | 9057 | }; |
9013 | 9058 | ||
9059 | static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_radio_rev11[] = { | ||
9060 | { | ||
9061 | .freq = 4920, | ||
9062 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x02, | ||
9063 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, | ||
9064 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9065 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9066 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9067 | PHYREGS(0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216), | ||
9068 | }, | ||
9069 | { | ||
9070 | .freq = 4930, | ||
9071 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x02, | ||
9072 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, | ||
9073 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9074 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9075 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9076 | PHYREGS(0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215), | ||
9077 | }, | ||
9078 | { | ||
9079 | .freq = 4940, | ||
9080 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x02, | ||
9081 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, | ||
9082 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9083 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9084 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9085 | PHYREGS(0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214), | ||
9086 | }, | ||
9087 | { | ||
9088 | .freq = 4950, | ||
9089 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x02, | ||
9090 | 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, | ||
9091 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9092 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9093 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9094 | PHYREGS(0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213), | ||
9095 | }, | ||
9096 | { | ||
9097 | .freq = 4960, | ||
9098 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x02, | ||
9099 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9100 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9101 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9102 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9103 | PHYREGS(0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212), | ||
9104 | }, | ||
9105 | { | ||
9106 | .freq = 4970, | ||
9107 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x02, | ||
9108 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9109 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9110 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9111 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9112 | PHYREGS(0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211), | ||
9113 | }, | ||
9114 | { | ||
9115 | .freq = 4980, | ||
9116 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x02, | ||
9117 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9118 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9119 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9120 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9121 | PHYREGS(0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f), | ||
9122 | }, | ||
9123 | { | ||
9124 | .freq = 4990, | ||
9125 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x02, | ||
9126 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9127 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9128 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9129 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9130 | PHYREGS(0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e), | ||
9131 | }, | ||
9132 | { | ||
9133 | .freq = 5000, | ||
9134 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x02, | ||
9135 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9136 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9137 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9138 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9139 | PHYREGS(0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d), | ||
9140 | }, | ||
9141 | { | ||
9142 | .freq = 5010, | ||
9143 | RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x02, | ||
9144 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9145 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9146 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9147 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9148 | PHYREGS(0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c), | ||
9149 | }, | ||
9150 | { | ||
9151 | .freq = 5020, | ||
9152 | RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x02, | ||
9153 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9154 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9155 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9156 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9157 | PHYREGS(0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b), | ||
9158 | }, | ||
9159 | { | ||
9160 | .freq = 5030, | ||
9161 | RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x02, | ||
9162 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9163 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9164 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9165 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9166 | PHYREGS(0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a), | ||
9167 | }, | ||
9168 | { | ||
9169 | .freq = 5040, | ||
9170 | RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x02, | ||
9171 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9172 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9173 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9174 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9175 | PHYREGS(0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209), | ||
9176 | }, | ||
9177 | { | ||
9178 | .freq = 5050, | ||
9179 | RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x02, | ||
9180 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9181 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9182 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9183 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9184 | PHYREGS(0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208), | ||
9185 | }, | ||
9186 | { | ||
9187 | .freq = 5060, | ||
9188 | RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x02, | ||
9189 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9190 | 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9191 | 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, | ||
9192 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9193 | PHYREGS(0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207), | ||
9194 | }, | ||
9195 | { | ||
9196 | .freq = 5070, | ||
9197 | RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x02, | ||
9198 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9199 | 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9200 | 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, | ||
9201 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9202 | PHYREGS(0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206), | ||
9203 | }, | ||
9204 | { | ||
9205 | .freq = 5080, | ||
9206 | RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x02, | ||
9207 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9208 | 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9209 | 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, | ||
9210 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9211 | PHYREGS(0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205), | ||
9212 | }, | ||
9213 | { | ||
9214 | .freq = 5090, | ||
9215 | RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x02, | ||
9216 | 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, | ||
9217 | 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, | ||
9218 | 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, | ||
9219 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9220 | PHYREGS(0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204), | ||
9221 | }, | ||
9222 | { | ||
9223 | .freq = 5100, | ||
9224 | RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x02, | ||
9225 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, | ||
9226 | 0xff, 0xfd, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, | ||
9227 | 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x08, 0x00, 0x77, | ||
9228 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9229 | PHYREGS(0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203), | ||
9230 | }, | ||
9231 | { | ||
9232 | .freq = 5110, | ||
9233 | RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x02, | ||
9234 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, | ||
9235 | 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, | ||
9236 | 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, | ||
9237 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9238 | PHYREGS(0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202), | ||
9239 | }, | ||
9240 | { | ||
9241 | .freq = 5120, | ||
9242 | RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x02, | ||
9243 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, | ||
9244 | 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, | ||
9245 | 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, | ||
9246 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9247 | PHYREGS(0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201), | ||
9248 | }, | ||
9249 | { | ||
9250 | .freq = 5130, | ||
9251 | RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x02, | ||
9252 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, | ||
9253 | 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, | ||
9254 | 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, | ||
9255 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9256 | PHYREGS(0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200), | ||
9257 | }, | ||
9258 | { | ||
9259 | .freq = 5140, | ||
9260 | RADIOREGS3(0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x02, | ||
9261 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, | ||
9262 | 0xff, 0xfb, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, | ||
9263 | 0x00, 0x6f, 0x00, 0xfb, 0x00, 0x08, 0x00, 0x77, | ||
9264 | 0x00, 0x0f, 0x00, 0x6f, 0x00), | ||
9265 | PHYREGS(0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff), | ||
9266 | }, | ||
9267 | { | ||
9268 | .freq = 5160, | ||
9269 | RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x02, | ||
9270 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, | ||
9271 | 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, | ||
9272 | 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, | ||
9273 | 0x00, 0x0e, 0x00, 0x6f, 0x00), | ||
9274 | PHYREGS(0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd), | ||
9275 | }, | ||
9276 | { | ||
9277 | .freq = 5170, | ||
9278 | RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x02, | ||
9279 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, | ||
9280 | 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, | ||
9281 | 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, | ||
9282 | 0x00, 0x0e, 0x00, 0x6f, 0x00), | ||
9283 | PHYREGS(0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc), | ||
9284 | }, | ||
9285 | { | ||
9286 | .freq = 5180, | ||
9287 | RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x02, | ||
9288 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, | ||
9289 | 0xff, 0xf9, 0x00, 0x06, 0x00, 0x77, 0x00, 0x0e, | ||
9290 | 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, | ||
9291 | 0x00, 0x0e, 0x00, 0x6f, 0x00), | ||
9292 | PHYREGS(0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb), | ||
9293 | }, | ||
9294 | { | ||
9295 | .freq = 5190, | ||
9296 | RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x02, | ||
9297 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, | ||
9298 | 0xff, 0xf9, 0x00, 0x06, 0x00, 0x77, 0x00, 0x0d, | ||
9299 | 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, | ||
9300 | 0x00, 0x0d, 0x00, 0x6f, 0x00), | ||
9301 | PHYREGS(0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa), | ||
9302 | }, | ||
9303 | { | ||
9304 | .freq = 5200, | ||
9305 | RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x02, | ||
9306 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, | ||
9307 | 0xff, 0xf9, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, | ||
9308 | 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x05, 0x00, 0x77, | ||
9309 | 0x00, 0x0d, 0x00, 0x6f, 0x00), | ||
9310 | PHYREGS(0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9), | ||
9311 | }, | ||
9312 | { | ||
9313 | .freq = 5210, | ||
9314 | RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x02, | ||
9315 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, | ||
9316 | 0xff, 0xf9, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, | ||
9317 | 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x05, 0x00, 0x77, | ||
9318 | 0x00, 0x0d, 0x00, 0x6f, 0x00), | ||
9319 | PHYREGS(0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8), | ||
9320 | }, | ||
9321 | { | ||
9322 | .freq = 5220, | ||
9323 | RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x02, | ||
9324 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, | ||
9325 | 0xfe, 0xd8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, | ||
9326 | 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, | ||
9327 | 0x00, 0x0d, 0x00, 0x6f, 0x00), | ||
9328 | PHYREGS(0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7), | ||
9329 | }, | ||
9330 | { | ||
9331 | .freq = 5230, | ||
9332 | RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x02, | ||
9333 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, | ||
9334 | 0xee, 0xd8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, | ||
9335 | 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, | ||
9336 | 0x00, 0x0d, 0x00, 0x6f, 0x00), | ||
9337 | PHYREGS(0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6), | ||
9338 | }, | ||
9339 | { | ||
9340 | .freq = 5240, | ||
9341 | RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x02, | ||
9342 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, | ||
9343 | 0xee, 0xc8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, | ||
9344 | 0x00, 0x6f, 0x00, 0xc8, 0x00, 0x05, 0x00, 0x77, | ||
9345 | 0x00, 0x0d, 0x00, 0x6f, 0x00), | ||
9346 | PHYREGS(0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5), | ||
9347 | }, | ||
9348 | { | ||
9349 | .freq = 5250, | ||
9350 | RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x02, | ||
9351 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, | ||
9352 | 0xed, 0xc7, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, | ||
9353 | 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x05, 0x00, 0x77, | ||
9354 | 0x00, 0x0d, 0x00, 0x6f, 0x00), | ||
9355 | PHYREGS(0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4), | ||
9356 | }, | ||
9357 | { | ||
9358 | .freq = 5260, | ||
9359 | RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x02, | ||
9360 | 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0e, 0x00, | ||
9361 | 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0d, | ||
9362 | 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, | ||
9363 | 0x00, 0x0d, 0x00, 0x6f, 0x00), | ||
9364 | PHYREGS(0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3), | ||
9365 | }, | ||
9366 | { | ||
9367 | .freq = 5270, | ||
9368 | RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x02, | ||
9369 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8e, 0x0e, 0x00, | ||
9370 | 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0c, | ||
9371 | 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, | ||
9372 | 0x00, 0x0c, 0x00, 0x6f, 0x00), | ||
9373 | PHYREGS(0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2), | ||
9374 | }, | ||
9375 | { | ||
9376 | .freq = 5280, | ||
9377 | RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x02, | ||
9378 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, | ||
9379 | 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, | ||
9380 | 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, | ||
9381 | 0x00, 0x0c, 0x00, 0x6f, 0x00), | ||
9382 | PHYREGS(0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1), | ||
9383 | }, | ||
9384 | { | ||
9385 | .freq = 5290, | ||
9386 | RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x02, | ||
9387 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, | ||
9388 | 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, | ||
9389 | 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, | ||
9390 | 0x00, 0x0c, 0x00, 0x6f, 0x00), | ||
9391 | PHYREGS(0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0), | ||
9392 | }, | ||
9393 | { | ||
9394 | .freq = 5300, | ||
9395 | RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x02, | ||
9396 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, | ||
9397 | 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, | ||
9398 | 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, | ||
9399 | 0x00, 0x0c, 0x00, 0x6f, 0x00), | ||
9400 | PHYREGS(0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0), | ||
9401 | }, | ||
9402 | { | ||
9403 | .freq = 5310, | ||
9404 | RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x02, | ||
9405 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, | ||
9406 | 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, | ||
9407 | 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, | ||
9408 | 0x00, 0x0c, 0x00, 0x6f, 0x00), | ||
9409 | PHYREGS(0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef), | ||
9410 | }, | ||
9411 | { | ||
9412 | .freq = 5320, | ||
9413 | RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x02, | ||
9414 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, | ||
9415 | 0xdb, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, | ||
9416 | 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, | ||
9417 | 0x00, 0x0c, 0x00, 0x6f, 0x00), | ||
9418 | PHYREGS(0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee), | ||
9419 | }, | ||
9420 | { | ||
9421 | .freq = 5330, | ||
9422 | RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x02, | ||
9423 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, | ||
9424 | 0xcb, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, | ||
9425 | 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, | ||
9426 | 0x00, 0x0b, 0x00, 0x6f, 0x00), | ||
9427 | PHYREGS(0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed), | ||
9428 | }, | ||
9429 | { | ||
9430 | .freq = 5340, | ||
9431 | RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x02, | ||
9432 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, | ||
9433 | 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, | ||
9434 | 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, | ||
9435 | 0x00, 0x0b, 0x00, 0x6f, 0x00), | ||
9436 | PHYREGS(0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec), | ||
9437 | }, | ||
9438 | { | ||
9439 | .freq = 5350, | ||
9440 | RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x02, | ||
9441 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, | ||
9442 | 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, | ||
9443 | 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, | ||
9444 | 0x00, 0x0b, 0x00, 0x6f, 0x00), | ||
9445 | PHYREGS(0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb), | ||
9446 | }, | ||
9447 | { | ||
9448 | .freq = 5360, | ||
9449 | RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x02, | ||
9450 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, | ||
9451 | 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, | ||
9452 | 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, | ||
9453 | 0x00, 0x0a, 0x00, 0x6f, 0x00), | ||
9454 | PHYREGS(0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea), | ||
9455 | }, | ||
9456 | { | ||
9457 | .freq = 5370, | ||
9458 | RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x02, | ||
9459 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, | ||
9460 | 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, | ||
9461 | 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, | ||
9462 | 0x00, 0x0a, 0x00, 0x6f, 0x00), | ||
9463 | PHYREGS(0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9), | ||
9464 | }, | ||
9465 | { | ||
9466 | .freq = 5380, | ||
9467 | RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x02, | ||
9468 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, | ||
9469 | 0xb8, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, | ||
9470 | 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, | ||
9471 | 0x00, 0x0a, 0x00, 0x6f, 0x00), | ||
9472 | PHYREGS(0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8), | ||
9473 | }, | ||
9474 | { | ||
9475 | .freq = 5390, | ||
9476 | RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x02, | ||
9477 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, | ||
9478 | 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, | ||
9479 | 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, | ||
9480 | 0x00, 0x0a, 0x00, 0x6f, 0x00), | ||
9481 | PHYREGS(0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7), | ||
9482 | }, | ||
9483 | { | ||
9484 | .freq = 5400, | ||
9485 | RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x02, | ||
9486 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, | ||
9487 | 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, | ||
9488 | 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, | ||
9489 | 0x00, 0x0a, 0x00, 0x6f, 0x00), | ||
9490 | PHYREGS(0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6), | ||
9491 | }, | ||
9492 | { | ||
9493 | .freq = 5410, | ||
9494 | RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x02, | ||
9495 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, | ||
9496 | 0xb7, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, | ||
9497 | 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, | ||
9498 | 0x00, 0x0a, 0x00, 0x6f, 0x00), | ||
9499 | PHYREGS(0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5), | ||
9500 | }, | ||
9501 | { | ||
9502 | .freq = 5420, | ||
9503 | RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x02, | ||
9504 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, | ||
9505 | 0xa7, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, | ||
9506 | 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, | ||
9507 | 0x00, 0x0a, 0x00, 0x6f, 0x00), | ||
9508 | PHYREGS(0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5), | ||
9509 | }, | ||
9510 | { | ||
9511 | .freq = 5430, | ||
9512 | RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x02, | ||
9513 | 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0b, 0x00, | ||
9514 | 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, | ||
9515 | 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, | ||
9516 | 0x00, 0x0a, 0x00, 0x6f, 0x00), | ||
9517 | PHYREGS(0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4), | ||
9518 | }, | ||
9519 | { | ||
9520 | .freq = 5440, | ||
9521 | RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x02, | ||
9522 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, | ||
9523 | 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x09, | ||
9524 | 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, | ||
9525 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9526 | PHYREGS(0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3), | ||
9527 | }, | ||
9528 | { | ||
9529 | .freq = 5450, | ||
9530 | RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x02, | ||
9531 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, | ||
9532 | 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, | ||
9533 | 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, | ||
9534 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9535 | PHYREGS(0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2), | ||
9536 | }, | ||
9537 | { | ||
9538 | .freq = 5460, | ||
9539 | RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x02, | ||
9540 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, | ||
9541 | 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, | ||
9542 | 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, | ||
9543 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9544 | PHYREGS(0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1), | ||
9545 | }, | ||
9546 | { | ||
9547 | .freq = 5470, | ||
9548 | RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x02, | ||
9549 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, | ||
9550 | 0x94, 0x73, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, | ||
9551 | 0x00, 0x6f, 0x00, 0x73, 0x00, 0x01, 0x00, 0x77, | ||
9552 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9553 | PHYREGS(0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0), | ||
9554 | }, | ||
9555 | { | ||
9556 | .freq = 5480, | ||
9557 | RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x02, | ||
9558 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, | ||
9559 | 0x84, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, | ||
9560 | 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, | ||
9561 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9562 | PHYREGS(0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df), | ||
9563 | }, | ||
9564 | { | ||
9565 | .freq = 5490, | ||
9566 | RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x02, | ||
9567 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, | ||
9568 | 0x83, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, | ||
9569 | 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, | ||
9570 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9571 | PHYREGS(0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de), | ||
9572 | }, | ||
9573 | { | ||
9574 | .freq = 5500, | ||
9575 | RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x02, | ||
9576 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, | ||
9577 | 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, | ||
9578 | 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, | ||
9579 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9580 | PHYREGS(0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd), | ||
9581 | }, | ||
9582 | { | ||
9583 | .freq = 5510, | ||
9584 | RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x02, | ||
9585 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, | ||
9586 | 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, | ||
9587 | 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, | ||
9588 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9589 | PHYREGS(0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd), | ||
9590 | }, | ||
9591 | { | ||
9592 | .freq = 5520, | ||
9593 | RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x02, | ||
9594 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, | ||
9595 | 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, | ||
9596 | 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, | ||
9597 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9598 | PHYREGS(0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc), | ||
9599 | }, | ||
9600 | { | ||
9601 | .freq = 5530, | ||
9602 | RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x02, | ||
9603 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, | ||
9604 | 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, | ||
9605 | 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, | ||
9606 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9607 | PHYREGS(0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db), | ||
9608 | }, | ||
9609 | { | ||
9610 | .freq = 5540, | ||
9611 | RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x02, | ||
9612 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, | ||
9613 | 0x71, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, | ||
9614 | 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, | ||
9615 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9616 | PHYREGS(0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da), | ||
9617 | }, | ||
9618 | { | ||
9619 | .freq = 5550, | ||
9620 | RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x02, | ||
9621 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, | ||
9622 | 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, | ||
9623 | 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, | ||
9624 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9625 | PHYREGS(0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9), | ||
9626 | }, | ||
9627 | { | ||
9628 | .freq = 5560, | ||
9629 | RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x02, | ||
9630 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, | ||
9631 | 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, | ||
9632 | 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, | ||
9633 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9634 | PHYREGS(0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8), | ||
9635 | }, | ||
9636 | { | ||
9637 | .freq = 5570, | ||
9638 | RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x02, | ||
9639 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, | ||
9640 | 0x61, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, | ||
9641 | 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, | ||
9642 | 0x00, 0x09, 0x00, 0x6f, 0x00), | ||
9643 | PHYREGS(0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7), | ||
9644 | }, | ||
9645 | { | ||
9646 | .freq = 5580, | ||
9647 | RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x02, | ||
9648 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, | ||
9649 | 0x60, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, | ||
9650 | 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, | ||
9651 | 0x00, 0x08, 0x00, 0x6f, 0x00), | ||
9652 | PHYREGS(0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7), | ||
9653 | }, | ||
9654 | { | ||
9655 | .freq = 5590, | ||
9656 | RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x02, | ||
9657 | 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, | ||
9658 | 0x50, 0x61, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, | ||
9659 | 0x00, 0x6f, 0x00, 0x61, 0x00, 0x00, 0x00, 0x77, | ||
9660 | 0x00, 0x08, 0x00, 0x6f, 0x00), | ||
9661 | PHYREGS(0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6), | ||
9662 | }, | ||
9663 | { | ||
9664 | .freq = 5600, | ||
9665 | RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x02, | ||
9666 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, | ||
9667 | 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, | ||
9668 | 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, | ||
9669 | 0x00, 0x08, 0x00, 0x6f, 0x00), | ||
9670 | PHYREGS(0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5), | ||
9671 | }, | ||
9672 | { | ||
9673 | .freq = 5610, | ||
9674 | RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x02, | ||
9675 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, | ||
9676 | 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, | ||
9677 | 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, | ||
9678 | 0x00, 0x08, 0x00, 0x6f, 0x00), | ||
9679 | PHYREGS(0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4), | ||
9680 | }, | ||
9681 | { | ||
9682 | .freq = 5620, | ||
9683 | RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x02, | ||
9684 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, | ||
9685 | 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, | ||
9686 | 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, | ||
9687 | 0x00, 0x07, 0x00, 0x6f, 0x00), | ||
9688 | PHYREGS(0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3), | ||
9689 | }, | ||
9690 | { | ||
9691 | .freq = 5630, | ||
9692 | RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x02, | ||
9693 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, | ||
9694 | 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, | ||
9695 | 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, | ||
9696 | 0x00, 0x07, 0x00, 0x6f, 0x00), | ||
9697 | PHYREGS(0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2), | ||
9698 | }, | ||
9699 | { | ||
9700 | .freq = 5640, | ||
9701 | RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x02, | ||
9702 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, | ||
9703 | 0x40, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, | ||
9704 | 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, | ||
9705 | 0x00, 0x07, 0x00, 0x6f, 0x00), | ||
9706 | PHYREGS(0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2), | ||
9707 | }, | ||
9708 | { | ||
9709 | .freq = 5650, | ||
9710 | RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x02, | ||
9711 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, | ||
9712 | 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, | ||
9713 | 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, | ||
9714 | 0x00, 0x07, 0x00, 0x6f, 0x00), | ||
9715 | PHYREGS(0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1), | ||
9716 | }, | ||
9717 | { | ||
9718 | .freq = 5660, | ||
9719 | RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x02, | ||
9720 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, | ||
9721 | 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, | ||
9722 | 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, | ||
9723 | 0x00, 0x06, 0x00, 0x6f, 0x00), | ||
9724 | PHYREGS(0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0), | ||
9725 | }, | ||
9726 | { | ||
9727 | .freq = 5670, | ||
9728 | RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x02, | ||
9729 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, | ||
9730 | 0x40, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, | ||
9731 | 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, | ||
9732 | 0x00, 0x06, 0x00, 0x6f, 0x00), | ||
9733 | PHYREGS(0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf), | ||
9734 | }, | ||
9735 | { | ||
9736 | .freq = 5680, | ||
9737 | RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x02, | ||
9738 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, | ||
9739 | 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, | ||
9740 | 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, | ||
9741 | 0x00, 0x06, 0x00, 0x6f, 0x00), | ||
9742 | PHYREGS(0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce), | ||
9743 | }, | ||
9744 | { | ||
9745 | .freq = 5690, | ||
9746 | RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x02, | ||
9747 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, | ||
9748 | 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, | ||
9749 | 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, | ||
9750 | 0x00, 0x06, 0x00, 0x6f, 0x00), | ||
9751 | PHYREGS(0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce), | ||
9752 | }, | ||
9753 | { | ||
9754 | .freq = 5700, | ||
9755 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x02, | ||
9756 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, | ||
9757 | 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, | ||
9758 | 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, | ||
9759 | 0x00, 0x06, 0x00, 0x6e, 0x00), | ||
9760 | PHYREGS(0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd), | ||
9761 | }, | ||
9762 | { | ||
9763 | .freq = 5710, | ||
9764 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x02, | ||
9765 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, | ||
9766 | 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, | ||
9767 | 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, | ||
9768 | 0x00, 0x06, 0x00, 0x6e, 0x00), | ||
9769 | PHYREGS(0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc), | ||
9770 | }, | ||
9771 | { | ||
9772 | .freq = 5720, | ||
9773 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x02, | ||
9774 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, | ||
9775 | 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, | ||
9776 | 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, | ||
9777 | 0x00, 0x06, 0x00, 0x6e, 0x00), | ||
9778 | PHYREGS(0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb), | ||
9779 | }, | ||
9780 | { | ||
9781 | .freq = 5725, | ||
9782 | RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x79, 0x05, 0x05, 0x02, | ||
9783 | 0x15, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, | ||
9784 | 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, | ||
9785 | 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, | ||
9786 | 0x00, 0x06, 0x00, 0x6e, 0x00), | ||
9787 | PHYREGS(0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb), | ||
9788 | }, | ||
9789 | { | ||
9790 | .freq = 5730, | ||
9791 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x02, | ||
9792 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, | ||
9793 | 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, | ||
9794 | 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, | ||
9795 | 0x00, 0x06, 0x00, 0x6e, 0x00), | ||
9796 | PHYREGS(0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca), | ||
9797 | }, | ||
9798 | { | ||
9799 | .freq = 5735, | ||
9800 | RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x7b, 0x05, 0x05, 0x02, | ||
9801 | 0x15, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, | ||
9802 | 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, | ||
9803 | 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, | ||
9804 | 0x00, 0x06, 0x00, 0x6d, 0x00), | ||
9805 | PHYREGS(0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca), | ||
9806 | }, | ||
9807 | { | ||
9808 | .freq = 5740, | ||
9809 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x02, | ||
9810 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, | ||
9811 | 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, | ||
9812 | 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, | ||
9813 | 0x00, 0x06, 0x00, 0x6d, 0x00), | ||
9814 | PHYREGS(0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9), | ||
9815 | }, | ||
9816 | { | ||
9817 | .freq = 5745, | ||
9818 | RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7d, 0x05, 0x05, 0x02, | ||
9819 | 0x15, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, | ||
9820 | 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, | ||
9821 | 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, | ||
9822 | 0x00, 0x06, 0x00, 0x6d, 0x00), | ||
9823 | PHYREGS(0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9), | ||
9824 | }, | ||
9825 | { | ||
9826 | .freq = 5750, | ||
9827 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x02, | ||
9828 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, | ||
9829 | 0x20, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9830 | 0x00, 0x6d, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, | ||
9831 | 0x00, 0x05, 0x00, 0x6d, 0x00), | ||
9832 | PHYREGS(0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9), | ||
9833 | }, | ||
9834 | { | ||
9835 | .freq = 5755, | ||
9836 | RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7f, 0x05, 0x05, 0x02, | ||
9837 | 0x15, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, | ||
9838 | 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9839 | 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, | ||
9840 | 0x00, 0x05, 0x00, 0x6c, 0x00), | ||
9841 | PHYREGS(0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8), | ||
9842 | }, | ||
9843 | { | ||
9844 | .freq = 5760, | ||
9845 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x02, | ||
9846 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, | ||
9847 | 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9848 | 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, | ||
9849 | 0x00, 0x05, 0x00, 0x6c, 0x00), | ||
9850 | PHYREGS(0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8), | ||
9851 | }, | ||
9852 | { | ||
9853 | .freq = 5765, | ||
9854 | RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x81, 0x05, 0x05, 0x02, | ||
9855 | 0x15, 0x01, 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, | ||
9856 | 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9857 | 0x00, 0x6c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, | ||
9858 | 0x00, 0x05, 0x00, 0x6c, 0x00), | ||
9859 | PHYREGS(0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8), | ||
9860 | }, | ||
9861 | { | ||
9862 | .freq = 5770, | ||
9863 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x02, | ||
9864 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, | ||
9865 | 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9866 | 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, | ||
9867 | 0x00, 0x05, 0x00, 0x6b, 0x00), | ||
9868 | PHYREGS(0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7), | ||
9869 | }, | ||
9870 | { | ||
9871 | .freq = 5775, | ||
9872 | RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x83, 0x05, 0x05, 0x02, | ||
9873 | 0x15, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, | ||
9874 | 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9875 | 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, | ||
9876 | 0x00, 0x05, 0x00, 0x6b, 0x00), | ||
9877 | PHYREGS(0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7), | ||
9878 | }, | ||
9879 | { | ||
9880 | .freq = 5780, | ||
9881 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x02, | ||
9882 | 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, | ||
9883 | 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9884 | 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, | ||
9885 | 0x00, 0x05, 0x00, 0x6b, 0x00), | ||
9886 | PHYREGS(0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6), | ||
9887 | }, | ||
9888 | { | ||
9889 | .freq = 5785, | ||
9890 | RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x85, 0x05, 0x05, 0x02, | ||
9891 | 0x15, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, | ||
9892 | 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9893 | 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, | ||
9894 | 0x00, 0x05, 0x00, 0x6b, 0x00), | ||
9895 | PHYREGS(0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6), | ||
9896 | }, | ||
9897 | { | ||
9898 | .freq = 5790, | ||
9899 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x02, | ||
9900 | 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, | ||
9901 | 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9902 | 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, | ||
9903 | 0x00, 0x05, 0x00, 0x6b, 0x00), | ||
9904 | PHYREGS(0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6), | ||
9905 | }, | ||
9906 | { | ||
9907 | .freq = 5795, | ||
9908 | RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x87, 0x05, 0x05, 0x02, | ||
9909 | 0x15, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, | ||
9910 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9911 | 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
9912 | 0x00, 0x05, 0x00, 0x6b, 0x00), | ||
9913 | PHYREGS(0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5), | ||
9914 | }, | ||
9915 | { | ||
9916 | .freq = 5800, | ||
9917 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x02, | ||
9918 | 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, | ||
9919 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9920 | 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
9921 | 0x00, 0x05, 0x00, 0x6b, 0x00), | ||
9922 | PHYREGS(0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5), | ||
9923 | }, | ||
9924 | { | ||
9925 | .freq = 5805, | ||
9926 | RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x89, 0x05, 0x05, 0x02, | ||
9927 | 0x15, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, | ||
9928 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9929 | 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
9930 | 0x00, 0x05, 0x00, 0x6a, 0x00), | ||
9931 | PHYREGS(0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4), | ||
9932 | }, | ||
9933 | { | ||
9934 | .freq = 5810, | ||
9935 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x02, | ||
9936 | 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, | ||
9937 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9938 | 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
9939 | 0x00, 0x05, 0x00, 0x6a, 0x00), | ||
9940 | PHYREGS(0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4), | ||
9941 | }, | ||
9942 | { | ||
9943 | .freq = 5815, | ||
9944 | RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8b, 0x05, 0x05, 0x02, | ||
9945 | 0x15, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, | ||
9946 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9947 | 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
9948 | 0x00, 0x05, 0x00, 0x6a, 0x00), | ||
9949 | PHYREGS(0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4), | ||
9950 | }, | ||
9951 | { | ||
9952 | .freq = 5820, | ||
9953 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x02, | ||
9954 | 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, | ||
9955 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9956 | 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
9957 | 0x00, 0x05, 0x00, 0x6a, 0x00), | ||
9958 | PHYREGS(0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3), | ||
9959 | }, | ||
9960 | { | ||
9961 | .freq = 5825, | ||
9962 | RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8d, 0x05, 0x05, 0x02, | ||
9963 | 0x15, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, | ||
9964 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9965 | 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
9966 | 0x00, 0x05, 0x00, 0x69, 0x00), | ||
9967 | PHYREGS(0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3), | ||
9968 | }, | ||
9969 | { | ||
9970 | .freq = 5830, | ||
9971 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x02, | ||
9972 | 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, | ||
9973 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, | ||
9974 | 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
9975 | 0x00, 0x05, 0x00, 0x69, 0x00), | ||
9976 | PHYREGS(0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2), | ||
9977 | }, | ||
9978 | { | ||
9979 | .freq = 5840, | ||
9980 | RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x02, | ||
9981 | 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, | ||
9982 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, | ||
9983 | 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
9984 | 0x00, 0x04, 0x00, 0x69, 0x00), | ||
9985 | PHYREGS(0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2), | ||
9986 | }, | ||
9987 | { | ||
9988 | .freq = 5850, | ||
9989 | RADIOREGS3(0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x02, | ||
9990 | 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, | ||
9991 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, | ||
9992 | 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
9993 | 0x00, 0x04, 0x00, 0x69, 0x00), | ||
9994 | PHYREGS(0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1), | ||
9995 | }, | ||
9996 | { | ||
9997 | .freq = 5860, | ||
9998 | RADIOREGS3(0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x02, | ||
9999 | 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, | ||
10000 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, | ||
10001 | 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
10002 | 0x00, 0x04, 0x00, 0x69, 0x00), | ||
10003 | PHYREGS(0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0), | ||
10004 | }, | ||
10005 | { | ||
10006 | .freq = 5870, | ||
10007 | RADIOREGS3(0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x02, | ||
10008 | 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, | ||
10009 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, | ||
10010 | 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
10011 | 0x00, 0x04, 0x00, 0x68, 0x00), | ||
10012 | PHYREGS(0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf), | ||
10013 | }, | ||
10014 | { | ||
10015 | .freq = 5880, | ||
10016 | RADIOREGS3(0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x02, | ||
10017 | 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, | ||
10018 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, | ||
10019 | 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
10020 | 0x00, 0x04, 0x00, 0x68, 0x00), | ||
10021 | PHYREGS(0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf), | ||
10022 | }, | ||
10023 | { | ||
10024 | .freq = 5890, | ||
10025 | RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x02, | ||
10026 | 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, | ||
10027 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, | ||
10028 | 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
10029 | 0x00, 0x04, 0x00, 0x68, 0x00), | ||
10030 | PHYREGS(0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be), | ||
10031 | }, | ||
10032 | { | ||
10033 | .freq = 5900, | ||
10034 | RADIOREGS3(0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x02, | ||
10035 | 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, | ||
10036 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, | ||
10037 | 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
10038 | 0x00, 0x04, 0x00, 0x68, 0x00), | ||
10039 | PHYREGS(0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd), | ||
10040 | }, | ||
10041 | { | ||
10042 | .freq = 5910, | ||
10043 | RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x02, | ||
10044 | 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, | ||
10045 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, | ||
10046 | 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, | ||
10047 | 0x00, 0x04, 0x00, 0x68, 0x00), | ||
10048 | PHYREGS(0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc), | ||
10049 | }, | ||
10050 | { | ||
10051 | .freq = 2412, | ||
10052 | RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x6c, 0x06, 0x06, 0x04, | ||
10053 | 0x2b, 0x01, 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, | ||
10054 | 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, 0x70, 0x00, | ||
10055 | 0x0b, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, | ||
10056 | 0x70, 0x00, 0x0b, 0x00, 0x0a), | ||
10057 | PHYREGS(0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443), | ||
10058 | }, | ||
10059 | { | ||
10060 | .freq = 2417, | ||
10061 | RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x71, 0x06, 0x06, 0x04, | ||
10062 | 0x2b, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, | ||
10063 | 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, 0x70, 0x00, | ||
10064 | 0x0b, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, | ||
10065 | 0x70, 0x00, 0x0b, 0x00, 0x0a), | ||
10066 | PHYREGS(0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441), | ||
10067 | }, | ||
10068 | { | ||
10069 | .freq = 2422, | ||
10070 | RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x76, 0x06, 0x06, 0x04, | ||
10071 | 0x2b, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, | ||
10072 | 0x00, 0x00, 0x67, 0x00, 0x03, 0x00, 0x70, 0x00, | ||
10073 | 0x0b, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, | ||
10074 | 0x70, 0x00, 0x0b, 0x00, 0x0a), | ||
10075 | PHYREGS(0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f), | ||
10076 | }, | ||
10077 | { | ||
10078 | .freq = 2427, | ||
10079 | RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x7b, 0x06, 0x06, 0x04, | ||
10080 | 0x2b, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, | ||
10081 | 0x00, 0x00, 0x57, 0x00, 0x03, 0x00, 0x70, 0x00, | ||
10082 | 0x0a, 0x00, 0x0a, 0x00, 0x78, 0x00, 0x03, 0x00, | ||
10083 | 0x70, 0x00, 0x0a, 0x00, 0x0a), | ||
10084 | PHYREGS(0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d), | ||
10085 | }, | ||
10086 | { | ||
10087 | .freq = 2432, | ||
10088 | RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x80, 0x06, 0x06, 0x04, | ||
10089 | 0x2b, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, | ||
10090 | 0x00, 0x00, 0x56, 0x00, 0x03, 0x00, 0x70, 0x00, | ||
10091 | 0x0a, 0x00, 0x0a, 0x00, 0x77, 0x00, 0x03, 0x00, | ||
10092 | 0x70, 0x00, 0x0a, 0x00, 0x0a), | ||
10093 | PHYREGS(0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a), | ||
10094 | }, | ||
10095 | { | ||
10096 | .freq = 2437, | ||
10097 | RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x85, 0x06, 0x06, 0x04, | ||
10098 | 0x2b, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, | ||
10099 | 0x00, 0x00, 0x46, 0x00, 0x03, 0x00, 0x70, 0x00, | ||
10100 | 0x0a, 0x00, 0x0a, 0x00, 0x76, 0x00, 0x03, 0x00, | ||
10101 | 0x70, 0x00, 0x0a, 0x00, 0x0a), | ||
10102 | PHYREGS(0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438), | ||
10103 | }, | ||
10104 | { | ||
10105 | .freq = 2442, | ||
10106 | RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8a, 0x06, 0x06, 0x04, | ||
10107 | 0x2b, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, | ||
10108 | 0x00, 0x00, 0x45, 0x00, 0x02, 0x00, 0x70, 0x00, | ||
10109 | 0x0a, 0x00, 0x0a, 0x00, 0x66, 0x00, 0x02, 0x00, | ||
10110 | 0x70, 0x00, 0x0a, 0x00, 0x0a), | ||
10111 | PHYREGS(0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436), | ||
10112 | }, | ||
10113 | { | ||
10114 | .freq = 2447, | ||
10115 | RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8f, 0x06, 0x06, 0x04, | ||
10116 | 0x2b, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, | ||
10117 | 0x00, 0x00, 0x34, 0x00, 0x02, 0x00, 0x70, 0x00, | ||
10118 | 0x0a, 0x00, 0x09, 0x00, 0x55, 0x00, 0x02, 0x00, | ||
10119 | 0x70, 0x00, 0x0a, 0x00, 0x09), | ||
10120 | PHYREGS(0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434), | ||
10121 | }, | ||
10122 | { | ||
10123 | .freq = 2452, | ||
10124 | RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x94, 0x06, 0x06, 0x04, | ||
10125 | 0x2b, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, | ||
10126 | 0x00, 0x00, 0x23, 0x00, 0x02, 0x00, 0x70, 0x00, | ||
10127 | 0x0a, 0x00, 0x09, 0x00, 0x45, 0x00, 0x02, 0x00, | ||
10128 | 0x70, 0x00, 0x0a, 0x00, 0x09), | ||
10129 | PHYREGS(0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431), | ||
10130 | }, | ||
10131 | { | ||
10132 | .freq = 2457, | ||
10133 | RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x99, 0x06, 0x06, 0x04, | ||
10134 | 0x2b, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, | ||
10135 | 0x00, 0x00, 0x12, 0x00, 0x02, 0x00, 0x70, 0x00, | ||
10136 | 0x0a, 0x00, 0x09, 0x00, 0x34, 0x00, 0x02, 0x00, | ||
10137 | 0x70, 0x00, 0x0a, 0x00, 0x09), | ||
10138 | PHYREGS(0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f), | ||
10139 | }, | ||
10140 | { | ||
10141 | .freq = 2462, | ||
10142 | RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x9e, 0x06, 0x06, 0x04, | ||
10143 | 0x2b, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, | ||
10144 | 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x70, 0x00, | ||
10145 | 0x09, 0x00, 0x09, 0x00, 0x33, 0x00, 0x02, 0x00, | ||
10146 | 0x70, 0x00, 0x09, 0x00, 0x09), | ||
10147 | PHYREGS(0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d), | ||
10148 | }, | ||
10149 | { | ||
10150 | .freq = 2467, | ||
10151 | RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa3, 0x06, 0x06, 0x04, | ||
10152 | 0x2b, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, | ||
10153 | 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x70, 0x00, | ||
10154 | 0x09, 0x00, 0x09, 0x00, 0x22, 0x00, 0x02, 0x00, | ||
10155 | 0x70, 0x00, 0x09, 0x00, 0x09), | ||
10156 | PHYREGS(0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b), | ||
10157 | }, | ||
10158 | { | ||
10159 | .freq = 2472, | ||
10160 | RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa8, 0x06, 0x06, 0x04, | ||
10161 | 0x2b, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, | ||
10162 | 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x70, 0x00, | ||
10163 | 0x09, 0x00, 0x09, 0x00, 0x11, 0x00, 0x02, 0x00, | ||
10164 | 0x70, 0x00, 0x09, 0x00, 0x09), | ||
10165 | PHYREGS(0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429), | ||
10166 | }, | ||
10167 | { | ||
10168 | .freq = 2484, | ||
10169 | RADIOREGS3(0xff, 0x01, 0x03, 0x09, 0xb4, 0x06, 0x06, 0x04, | ||
10170 | 0x2b, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x20, 0x00, | ||
10171 | 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x70, 0x00, | ||
10172 | 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, | ||
10173 | 0x70, 0x00, 0x09, 0x00, 0x09), | ||
10174 | PHYREGS(0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424), | ||
10175 | }, | ||
10176 | }; | ||
10177 | |||
10178 | static const struct b2056_inittabs_pts | ||
10179 | *b43_nphy_get_inittabs_rev3(struct b43_wldev *dev) | ||
10180 | { | ||
10181 | struct b43_phy *phy = &dev->phy; | ||
10182 | |||
10183 | switch (dev->phy.rev) { | ||
10184 | case 3: | ||
10185 | return &b2056_inittab_phy_rev3; | ||
10186 | case 4: | ||
10187 | return &b2056_inittab_phy_rev4; | ||
10188 | default: | ||
10189 | switch (phy->radio_rev) { | ||
10190 | case 5: | ||
10191 | return &b2056_inittab_radio_rev5; | ||
10192 | case 6: | ||
10193 | return &b2056_inittab_radio_rev6; | ||
10194 | case 7: | ||
10195 | case 9: | ||
10196 | return &b2056_inittab_radio_rev7_9; | ||
10197 | case 8: | ||
10198 | return &b2056_inittab_radio_rev8; | ||
10199 | case 11: | ||
10200 | return &b2056_inittab_radio_rev11; | ||
10201 | } | ||
10202 | } | ||
10203 | |||
10204 | return NULL; | ||
10205 | } | ||
10206 | |||
9014 | static void b2056_upload_inittab(struct b43_wldev *dev, bool ghz5, | 10207 | static void b2056_upload_inittab(struct b43_wldev *dev, bool ghz5, |
9015 | bool ignore_uploadflag, u16 routing, | 10208 | bool ignore_uploadflag, u16 routing, |
9016 | const struct b2056_inittab_entry *e, | 10209 | const struct b2056_inittab_entry *e, |
@@ -9037,11 +10230,11 @@ void b2056_upload_inittabs(struct b43_wldev *dev, | |||
9037 | { | 10230 | { |
9038 | const struct b2056_inittabs_pts *pts; | 10231 | const struct b2056_inittabs_pts *pts; |
9039 | 10232 | ||
9040 | if (dev->phy.rev >= ARRAY_SIZE(b2056_inittabs)) { | 10233 | pts = b43_nphy_get_inittabs_rev3(dev); |
10234 | if (!pts) { | ||
9041 | B43_WARN_ON(1); | 10235 | B43_WARN_ON(1); |
9042 | return; | 10236 | return; |
9043 | } | 10237 | } |
9044 | pts = &b2056_inittabs[dev->phy.rev]; | ||
9045 | 10238 | ||
9046 | b2056_upload_inittab(dev, ghz5, ignore_uploadflag, | 10239 | b2056_upload_inittab(dev, ghz5, ignore_uploadflag, |
9047 | B2056_SYN, pts->syn, pts->syn_length); | 10240 | B2056_SYN, pts->syn, pts->syn_length); |
@@ -9060,11 +10253,12 @@ void b2056_upload_syn_pll_cp2(struct b43_wldev *dev, bool ghz5) | |||
9060 | const struct b2056_inittabs_pts *pts; | 10253 | const struct b2056_inittabs_pts *pts; |
9061 | const struct b2056_inittab_entry *e; | 10254 | const struct b2056_inittab_entry *e; |
9062 | 10255 | ||
9063 | if (dev->phy.rev >= ARRAY_SIZE(b2056_inittabs)) { | 10256 | pts = b43_nphy_get_inittabs_rev3(dev); |
10257 | if (!pts) { | ||
9064 | B43_WARN_ON(1); | 10258 | B43_WARN_ON(1); |
9065 | return; | 10259 | return; |
9066 | } | 10260 | } |
9067 | pts = &b2056_inittabs[dev->phy.rev]; | 10261 | |
9068 | e = &pts->syn[B2056_SYN_PLL_CP2]; | 10262 | e = &pts->syn[B2056_SYN_PLL_CP2]; |
9069 | 10263 | ||
9070 | b43_radio_write(dev, B2056_SYN_PLL_CP2, ghz5 ? e->ghz5 : e->ghz2); | 10264 | b43_radio_write(dev, B2056_SYN_PLL_CP2, ghz5 ? e->ghz5 : e->ghz2); |
@@ -9073,38 +10267,46 @@ void b2056_upload_syn_pll_cp2(struct b43_wldev *dev, bool ghz5) | |||
9073 | const struct b43_nphy_channeltab_entry_rev3 * | 10267 | const struct b43_nphy_channeltab_entry_rev3 * |
9074 | b43_nphy_get_chantabent_rev3(struct b43_wldev *dev, u16 freq) | 10268 | b43_nphy_get_chantabent_rev3(struct b43_wldev *dev, u16 freq) |
9075 | { | 10269 | { |
10270 | struct b43_phy *phy = &dev->phy; | ||
9076 | const struct b43_nphy_channeltab_entry_rev3 *e; | 10271 | const struct b43_nphy_channeltab_entry_rev3 *e; |
9077 | unsigned int length, i; | 10272 | unsigned int length, i; |
9078 | 10273 | ||
9079 | switch (dev->phy.rev) { | 10274 | switch (phy->rev) { |
9080 | case 3: | 10275 | case 3: |
9081 | e = b43_nphy_channeltab_rev3; | 10276 | e = b43_nphy_channeltab_phy_rev3; |
9082 | length = ARRAY_SIZE(b43_nphy_channeltab_rev3); | 10277 | length = ARRAY_SIZE(b43_nphy_channeltab_phy_rev3); |
9083 | break; | 10278 | break; |
9084 | case 4: | 10279 | case 4: |
9085 | e = b43_nphy_channeltab_rev4; | 10280 | e = b43_nphy_channeltab_phy_rev4; |
9086 | length = ARRAY_SIZE(b43_nphy_channeltab_rev4); | 10281 | length = ARRAY_SIZE(b43_nphy_channeltab_phy_rev4); |
9087 | break; | ||
9088 | case 5: | ||
9089 | e = b43_nphy_channeltab_rev5; | ||
9090 | length = ARRAY_SIZE(b43_nphy_channeltab_rev5); | ||
9091 | break; | ||
9092 | case 6: | ||
9093 | e = b43_nphy_channeltab_rev6; | ||
9094 | length = ARRAY_SIZE(b43_nphy_channeltab_rev6); | ||
9095 | break; | ||
9096 | case 7: | ||
9097 | case 9: | ||
9098 | e = b43_nphy_channeltab_rev7_9; | ||
9099 | length = ARRAY_SIZE(b43_nphy_channeltab_rev7_9); | ||
9100 | break; | ||
9101 | case 8: | ||
9102 | e = b43_nphy_channeltab_rev8; | ||
9103 | length = ARRAY_SIZE(b43_nphy_channeltab_rev8); | ||
9104 | break; | 10282 | break; |
9105 | default: | 10283 | default: |
9106 | B43_WARN_ON(1); | 10284 | switch (phy->radio_rev) { |
9107 | return NULL; | 10285 | case 5: |
10286 | e = b43_nphy_channeltab_radio_rev5; | ||
10287 | length = ARRAY_SIZE(b43_nphy_channeltab_radio_rev5); | ||
10288 | break; | ||
10289 | case 6: | ||
10290 | e = b43_nphy_channeltab_radio_rev6; | ||
10291 | length = ARRAY_SIZE(b43_nphy_channeltab_radio_rev6); | ||
10292 | break; | ||
10293 | case 7: | ||
10294 | case 9: | ||
10295 | e = b43_nphy_channeltab_radio_rev7_9; | ||
10296 | length = ARRAY_SIZE(b43_nphy_channeltab_radio_rev7_9); | ||
10297 | break; | ||
10298 | case 8: | ||
10299 | e = b43_nphy_channeltab_radio_rev8; | ||
10300 | length = ARRAY_SIZE(b43_nphy_channeltab_radio_rev8); | ||
10301 | break; | ||
10302 | case 11: | ||
10303 | e = b43_nphy_channeltab_radio_rev11; | ||
10304 | length = ARRAY_SIZE(b43_nphy_channeltab_radio_rev11); | ||
10305 | break; | ||
10306 | default: | ||
10307 | B43_WARN_ON(1); | ||
10308 | return NULL; | ||
10309 | } | ||
9108 | } | 10310 | } |
9109 | 10311 | ||
9110 | for (i = 0; i < length; i++, e++) { | 10312 | for (i = 0; i < length; i++, e++) { |
diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c index 94c755fdda14..4047c05e3807 100644 --- a/drivers/net/wireless/b43/tables_nphy.c +++ b/drivers/net/wireless/b43/tables_nphy.c | |||
@@ -1627,74 +1627,7 @@ static const u32 b43_ntab_tdtrn_r3[] = { | |||
1627 | 0xfa58fc00, 0x0b64fc7e, 0x0800f7b6, 0x00f006be, | 1627 | 0xfa58fc00, 0x0b64fc7e, 0x0800f7b6, 0x00f006be, |
1628 | }; | 1628 | }; |
1629 | 1629 | ||
1630 | static const u32 b43_ntab_noisevar0_r3[] = { | 1630 | static const u32 b43_ntab_noisevar_r3[] = { |
1631 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1632 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1633 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1634 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1635 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1636 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1637 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1638 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1639 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1640 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1641 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1642 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1643 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1644 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1645 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1646 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1647 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1648 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1649 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1650 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1651 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1652 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1653 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1654 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1655 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1656 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1657 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1658 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1659 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1660 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1661 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1662 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1663 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1664 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1665 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1666 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1667 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1668 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1669 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1670 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1671 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1672 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1673 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1674 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1675 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1676 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1677 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1678 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1679 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1680 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1681 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1682 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1683 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1684 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1685 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1686 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1687 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1688 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1689 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1690 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1691 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1692 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1693 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1694 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | ||
1695 | }; | ||
1696 | |||
1697 | static const u32 b43_ntab_noisevar1_r3[] = { | ||
1698 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | 1631 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, |
1699 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | 1632 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, |
1700 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, | 1633 | 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, |
@@ -3109,31 +3042,32 @@ static void b43_nphy_tables_init_rev3(struct b43_wldev *dev) | |||
3109 | antswlut = sprom->fem.ghz2.antswlut; | 3042 | antswlut = sprom->fem.ghz2.antswlut; |
3110 | 3043 | ||
3111 | /* Static tables */ | 3044 | /* Static tables */ |
3112 | ntab_upload(dev, B43_NTAB_FRAMESTRUCT_R3, b43_ntab_framestruct_r3); | 3045 | if (dev->phy.do_full_init) { |
3113 | ntab_upload(dev, B43_NTAB_PILOT_R3, b43_ntab_pilot_r3); | 3046 | ntab_upload(dev, B43_NTAB_FRAMESTRUCT_R3, b43_ntab_framestruct_r3); |
3114 | ntab_upload(dev, B43_NTAB_TMAP_R3, b43_ntab_tmap_r3); | 3047 | ntab_upload(dev, B43_NTAB_PILOT_R3, b43_ntab_pilot_r3); |
3115 | ntab_upload(dev, B43_NTAB_INTLEVEL_R3, b43_ntab_intlevel_r3); | 3048 | ntab_upload(dev, B43_NTAB_TMAP_R3, b43_ntab_tmap_r3); |
3116 | ntab_upload(dev, B43_NTAB_TDTRN_R3, b43_ntab_tdtrn_r3); | 3049 | ntab_upload(dev, B43_NTAB_INTLEVEL_R3, b43_ntab_intlevel_r3); |
3117 | ntab_upload(dev, B43_NTAB_NOISEVAR0_R3, b43_ntab_noisevar0_r3); | 3050 | ntab_upload(dev, B43_NTAB_TDTRN_R3, b43_ntab_tdtrn_r3); |
3118 | ntab_upload(dev, B43_NTAB_NOISEVAR1_R3, b43_ntab_noisevar1_r3); | 3051 | ntab_upload(dev, B43_NTAB_NOISEVAR_R3, b43_ntab_noisevar_r3); |
3119 | ntab_upload(dev, B43_NTAB_MCS_R3, b43_ntab_mcs_r3); | 3052 | ntab_upload(dev, B43_NTAB_MCS_R3, b43_ntab_mcs_r3); |
3120 | ntab_upload(dev, B43_NTAB_TDI20A0_R3, b43_ntab_tdi20a0_r3); | 3053 | ntab_upload(dev, B43_NTAB_TDI20A0_R3, b43_ntab_tdi20a0_r3); |
3121 | ntab_upload(dev, B43_NTAB_TDI20A1_R3, b43_ntab_tdi20a1_r3); | 3054 | ntab_upload(dev, B43_NTAB_TDI20A1_R3, b43_ntab_tdi20a1_r3); |
3122 | ntab_upload(dev, B43_NTAB_TDI40A0_R3, b43_ntab_tdi40a0_r3); | 3055 | ntab_upload(dev, B43_NTAB_TDI40A0_R3, b43_ntab_tdi40a0_r3); |
3123 | ntab_upload(dev, B43_NTAB_TDI40A1_R3, b43_ntab_tdi40a1_r3); | 3056 | ntab_upload(dev, B43_NTAB_TDI40A1_R3, b43_ntab_tdi40a1_r3); |
3124 | ntab_upload(dev, B43_NTAB_PILOTLT_R3, b43_ntab_pilotlt_r3); | 3057 | ntab_upload(dev, B43_NTAB_PILOTLT_R3, b43_ntab_pilotlt_r3); |
3125 | ntab_upload(dev, B43_NTAB_CHANEST_R3, b43_ntab_channelest_r3); | 3058 | ntab_upload(dev, B43_NTAB_CHANEST_R3, b43_ntab_channelest_r3); |
3126 | ntab_upload(dev, B43_NTAB_FRAMELT_R3, b43_ntab_framelookup_r3); | 3059 | ntab_upload(dev, B43_NTAB_FRAMELT_R3, b43_ntab_framelookup_r3); |
3127 | ntab_upload(dev, B43_NTAB_C0_ESTPLT_R3, b43_ntab_estimatepowerlt0_r3); | 3060 | ntab_upload(dev, B43_NTAB_C0_ESTPLT_R3, b43_ntab_estimatepowerlt0_r3); |
3128 | ntab_upload(dev, B43_NTAB_C1_ESTPLT_R3, b43_ntab_estimatepowerlt1_r3); | 3061 | ntab_upload(dev, B43_NTAB_C1_ESTPLT_R3, b43_ntab_estimatepowerlt1_r3); |
3129 | ntab_upload(dev, B43_NTAB_C0_ADJPLT_R3, b43_ntab_adjustpower0_r3); | 3062 | ntab_upload(dev, B43_NTAB_C0_ADJPLT_R3, b43_ntab_adjustpower0_r3); |
3130 | ntab_upload(dev, B43_NTAB_C1_ADJPLT_R3, b43_ntab_adjustpower1_r3); | 3063 | ntab_upload(dev, B43_NTAB_C1_ADJPLT_R3, b43_ntab_adjustpower1_r3); |
3131 | ntab_upload(dev, B43_NTAB_C0_GAINCTL_R3, b43_ntab_gainctl0_r3); | 3064 | ntab_upload(dev, B43_NTAB_C0_GAINCTL_R3, b43_ntab_gainctl0_r3); |
3132 | ntab_upload(dev, B43_NTAB_C1_GAINCTL_R3, b43_ntab_gainctl1_r3); | 3065 | ntab_upload(dev, B43_NTAB_C1_GAINCTL_R3, b43_ntab_gainctl1_r3); |
3133 | ntab_upload(dev, B43_NTAB_C0_IQLT_R3, b43_ntab_iqlt0_r3); | 3066 | ntab_upload(dev, B43_NTAB_C0_IQLT_R3, b43_ntab_iqlt0_r3); |
3134 | ntab_upload(dev, B43_NTAB_C1_IQLT_R3, b43_ntab_iqlt1_r3); | 3067 | ntab_upload(dev, B43_NTAB_C1_IQLT_R3, b43_ntab_iqlt1_r3); |
3135 | ntab_upload(dev, B43_NTAB_C0_LOFEEDTH_R3, b43_ntab_loftlt0_r3); | 3068 | ntab_upload(dev, B43_NTAB_C0_LOFEEDTH_R3, b43_ntab_loftlt0_r3); |
3136 | ntab_upload(dev, B43_NTAB_C1_LOFEEDTH_R3, b43_ntab_loftlt1_r3); | 3069 | ntab_upload(dev, B43_NTAB_C1_LOFEEDTH_R3, b43_ntab_loftlt1_r3); |
3070 | } | ||
3137 | 3071 | ||
3138 | /* Volatile tables */ | 3072 | /* Volatile tables */ |
3139 | if (antswlut < ARRAY_SIZE(b43_ntab_antswctl_r3)) | 3073 | if (antswlut < ARRAY_SIZE(b43_ntab_antswctl_r3)) |
@@ -3146,20 +3080,22 @@ static void b43_nphy_tables_init_rev3(struct b43_wldev *dev) | |||
3146 | static void b43_nphy_tables_init_rev0(struct b43_wldev *dev) | 3080 | static void b43_nphy_tables_init_rev0(struct b43_wldev *dev) |
3147 | { | 3081 | { |
3148 | /* Static tables */ | 3082 | /* Static tables */ |
3149 | ntab_upload(dev, B43_NTAB_FRAMESTRUCT, b43_ntab_framestruct); | 3083 | if (dev->phy.do_full_init) { |
3150 | ntab_upload(dev, B43_NTAB_FRAMELT, b43_ntab_framelookup); | 3084 | ntab_upload(dev, B43_NTAB_FRAMESTRUCT, b43_ntab_framestruct); |
3151 | ntab_upload(dev, B43_NTAB_TMAP, b43_ntab_tmap); | 3085 | ntab_upload(dev, B43_NTAB_FRAMELT, b43_ntab_framelookup); |
3152 | ntab_upload(dev, B43_NTAB_TDTRN, b43_ntab_tdtrn); | 3086 | ntab_upload(dev, B43_NTAB_TMAP, b43_ntab_tmap); |
3153 | ntab_upload(dev, B43_NTAB_INTLEVEL, b43_ntab_intlevel); | 3087 | ntab_upload(dev, B43_NTAB_TDTRN, b43_ntab_tdtrn); |
3154 | ntab_upload(dev, B43_NTAB_PILOT, b43_ntab_pilot); | 3088 | ntab_upload(dev, B43_NTAB_INTLEVEL, b43_ntab_intlevel); |
3155 | ntab_upload(dev, B43_NTAB_TDI20A0, b43_ntab_tdi20a0); | 3089 | ntab_upload(dev, B43_NTAB_PILOT, b43_ntab_pilot); |
3156 | ntab_upload(dev, B43_NTAB_TDI20A1, b43_ntab_tdi20a1); | 3090 | ntab_upload(dev, B43_NTAB_TDI20A0, b43_ntab_tdi20a0); |
3157 | ntab_upload(dev, B43_NTAB_TDI40A0, b43_ntab_tdi40a0); | 3091 | ntab_upload(dev, B43_NTAB_TDI20A1, b43_ntab_tdi20a1); |
3158 | ntab_upload(dev, B43_NTAB_TDI40A1, b43_ntab_tdi40a1); | 3092 | ntab_upload(dev, B43_NTAB_TDI40A0, b43_ntab_tdi40a0); |
3159 | ntab_upload(dev, B43_NTAB_CHANEST, b43_ntab_channelest); | 3093 | ntab_upload(dev, B43_NTAB_TDI40A1, b43_ntab_tdi40a1); |
3160 | ntab_upload(dev, B43_NTAB_MCS, b43_ntab_mcs); | 3094 | ntab_upload(dev, B43_NTAB_CHANEST, b43_ntab_channelest); |
3161 | ntab_upload(dev, B43_NTAB_NOISEVAR10, b43_ntab_noisevar10); | 3095 | ntab_upload(dev, B43_NTAB_MCS, b43_ntab_mcs); |
3162 | ntab_upload(dev, B43_NTAB_NOISEVAR11, b43_ntab_noisevar11); | 3096 | ntab_upload(dev, B43_NTAB_NOISEVAR10, b43_ntab_noisevar10); |
3097 | ntab_upload(dev, B43_NTAB_NOISEVAR11, b43_ntab_noisevar11); | ||
3098 | } | ||
3163 | 3099 | ||
3164 | /* Volatile tables */ | 3100 | /* Volatile tables */ |
3165 | ntab_upload(dev, B43_NTAB_BDI, b43_ntab_bdi); | 3101 | ntab_upload(dev, B43_NTAB_BDI, b43_ntab_bdi); |
diff --git a/drivers/net/wireless/b43/tables_nphy.h b/drivers/net/wireless/b43/tables_nphy.h index 9ff33adcff89..3a58aee4c4cf 100644 --- a/drivers/net/wireless/b43/tables_nphy.h +++ b/drivers/net/wireless/b43/tables_nphy.h | |||
@@ -143,8 +143,7 @@ struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent( | |||
143 | #define B43_NTAB_TMAP_R3 B43_NTAB32(12, 0) /* TM AP */ | 143 | #define B43_NTAB_TMAP_R3 B43_NTAB32(12, 0) /* TM AP */ |
144 | #define B43_NTAB_INTLEVEL_R3 B43_NTAB32(13, 0) /* INT LV */ | 144 | #define B43_NTAB_INTLEVEL_R3 B43_NTAB32(13, 0) /* INT LV */ |
145 | #define B43_NTAB_TDTRN_R3 B43_NTAB32(14, 0) /* TD TRN */ | 145 | #define B43_NTAB_TDTRN_R3 B43_NTAB32(14, 0) /* TD TRN */ |
146 | #define B43_NTAB_NOISEVAR0_R3 B43_NTAB32(16, 0) /* noise variance 0 */ | 146 | #define B43_NTAB_NOISEVAR_R3 B43_NTAB32(16, 0) /* noise variance */ |
147 | #define B43_NTAB_NOISEVAR1_R3 B43_NTAB32(16, 128) /* noise variance 1 */ | ||
148 | #define B43_NTAB_MCS_R3 B43_NTAB16(18, 0) /* MCS */ | 147 | #define B43_NTAB_MCS_R3 B43_NTAB16(18, 0) /* MCS */ |
149 | #define B43_NTAB_TDI20A0_R3 B43_NTAB32(19, 128) /* TDI 20/0 */ | 148 | #define B43_NTAB_TDI20A0_R3 B43_NTAB32(19, 128) /* TDI 20/0 */ |
150 | #define B43_NTAB_TDI20A1_R3 B43_NTAB32(19, 256) /* TDI 20/1 */ | 149 | #define B43_NTAB_TDI20A1_R3 B43_NTAB32(19, 256) /* TDI 20/1 */ |
diff --git a/drivers/net/wireless/b43/wa.c b/drivers/net/wireless/b43/wa.c index 9b1a038be08b..c218c08fb2f5 100644 --- a/drivers/net/wireless/b43/wa.c +++ b/drivers/net/wireless/b43/wa.c | |||
@@ -441,7 +441,7 @@ static void b43_wa_altagc(struct b43_wldev *dev) | |||
441 | 441 | ||
442 | static void b43_wa_tr_ltov(struct b43_wldev *dev) /* TR Lookup Table Original Values */ | 442 | static void b43_wa_tr_ltov(struct b43_wldev *dev) /* TR Lookup Table Original Values */ |
443 | { | 443 | { |
444 | b43_gtab_write(dev, B43_GTAB_ORIGTR, 0, 0xC480); | 444 | b43_gtab_write(dev, B43_GTAB_ORIGTR, 0, 0x7654); |
445 | } | 445 | } |
446 | 446 | ||
447 | static void b43_wa_cpll_nonpilot(struct b43_wldev *dev) | 447 | static void b43_wa_cpll_nonpilot(struct b43_wldev *dev) |
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 31adb8cf0291..4f38f19b8e3d 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
@@ -408,7 +408,7 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
408 | mac_ctl |= B43_TXH_MAC_HWSEQ; | 408 | mac_ctl |= B43_TXH_MAC_HWSEQ; |
409 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) | 409 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) |
410 | mac_ctl |= B43_TXH_MAC_STMSDU; | 410 | mac_ctl |= B43_TXH_MAC_STMSDU; |
411 | if (phy->type == B43_PHYTYPE_A) | 411 | if (!phy->gmode) |
412 | mac_ctl |= B43_TXH_MAC_5GHZ; | 412 | mac_ctl |= B43_TXH_MAC_5GHZ; |
413 | 413 | ||
414 | /* Overwrite rates[0].count to make the retry calculation | 414 | /* Overwrite rates[0].count to make the retry calculation |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/Makefile b/drivers/net/wireless/brcm80211/brcmfmac/Makefile index 1d2ceac3a221..98e67c18f276 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile +++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile | |||
@@ -33,7 +33,7 @@ brcmfmac-objs += \ | |||
33 | bcdc.o \ | 33 | bcdc.o \ |
34 | dhd_common.o \ | 34 | dhd_common.o \ |
35 | dhd_linux.o \ | 35 | dhd_linux.o \ |
36 | nvram.o \ | 36 | firmware.o \ |
37 | btcoex.o | 37 | btcoex.o |
38 | brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \ | 38 | brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \ |
39 | dhd_sdio.o \ | 39 | dhd_sdio.o \ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h index 939d6b132922..16f9ab2568a8 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h | |||
@@ -186,7 +186,7 @@ void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx); | |||
186 | void brcmf_txflowblock_if(struct brcmf_if *ifp, | 186 | void brcmf_txflowblock_if(struct brcmf_if *ifp, |
187 | enum brcmf_netif_stop_reason reason, bool state); | 187 | enum brcmf_netif_stop_reason reason, bool state); |
188 | u32 brcmf_get_chip_info(struct brcmf_if *ifp); | 188 | u32 brcmf_get_chip_info(struct brcmf_if *ifp); |
189 | void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, | 189 | void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx, |
190 | bool success); | 190 | bool success); |
191 | 191 | ||
192 | /* Sets dongle media info (drv_version, mac address). */ | 192 | /* Sets dongle media info (drv_version, mac address). */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h index c4535616064e..7735328fff21 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h | |||
@@ -63,7 +63,6 @@ struct brcmf_bus_dcmd { | |||
63 | */ | 63 | */ |
64 | struct brcmf_bus_ops { | 64 | struct brcmf_bus_ops { |
65 | int (*preinit)(struct device *dev); | 65 | int (*preinit)(struct device *dev); |
66 | int (*init)(struct device *dev); | ||
67 | void (*stop)(struct device *dev); | 66 | void (*stop)(struct device *dev); |
68 | int (*txdata)(struct device *dev, struct sk_buff *skb); | 67 | int (*txdata)(struct device *dev, struct sk_buff *skb); |
69 | int (*txctl)(struct device *dev, unsigned char *msg, uint len); | 68 | int (*txctl)(struct device *dev, unsigned char *msg, uint len); |
@@ -99,6 +98,7 @@ struct brcmf_bus { | |||
99 | unsigned long tx_realloc; | 98 | unsigned long tx_realloc; |
100 | u32 chip; | 99 | u32 chip; |
101 | u32 chiprev; | 100 | u32 chiprev; |
101 | bool always_use_fws_queue; | ||
102 | 102 | ||
103 | struct brcmf_bus_ops *ops; | 103 | struct brcmf_bus_ops *ops; |
104 | }; | 104 | }; |
@@ -113,11 +113,6 @@ static inline int brcmf_bus_preinit(struct brcmf_bus *bus) | |||
113 | return bus->ops->preinit(bus->dev); | 113 | return bus->ops->preinit(bus->dev); |
114 | } | 114 | } |
115 | 115 | ||
116 | static inline int brcmf_bus_init(struct brcmf_bus *bus) | ||
117 | { | ||
118 | return bus->ops->init(bus->dev); | ||
119 | } | ||
120 | |||
121 | static inline void brcmf_bus_stop(struct brcmf_bus *bus) | 116 | static inline void brcmf_bus_stop(struct brcmf_bus *bus) |
122 | { | 117 | { |
123 | bus->ops->stop(bus->dev); | 118 | bus->ops->stop(bus->dev); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c index 6a8983a1fb9c..ed3e32ce8c23 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | |||
@@ -32,6 +32,9 @@ | |||
32 | #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 | 32 | #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 |
33 | #define BRCMF_DEFAULT_PACKET_FILTER "100 0 0 0 0x01 0x00" | 33 | #define BRCMF_DEFAULT_PACKET_FILTER "100 0 0 0 0x01 0x00" |
34 | 34 | ||
35 | /* boost value for RSSI_DELTA in preferred join selection */ | ||
36 | #define BRCMF_JOIN_PREF_RSSI_BOOST 8 | ||
37 | |||
35 | 38 | ||
36 | bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, | 39 | bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, |
37 | struct sk_buff *pkt, int prec) | 40 | struct sk_buff *pkt, int prec) |
@@ -246,6 +249,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) | |||
246 | { | 249 | { |
247 | s8 eventmask[BRCMF_EVENTING_MASK_LEN]; | 250 | s8 eventmask[BRCMF_EVENTING_MASK_LEN]; |
248 | u8 buf[BRCMF_DCMD_SMLEN]; | 251 | u8 buf[BRCMF_DCMD_SMLEN]; |
252 | struct brcmf_join_pref_params join_pref_params[2]; | ||
249 | char *ptr; | 253 | char *ptr; |
250 | s32 err; | 254 | s32 err; |
251 | 255 | ||
@@ -298,6 +302,20 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) | |||
298 | goto done; | 302 | goto done; |
299 | } | 303 | } |
300 | 304 | ||
305 | /* Setup join_pref to select target by RSSI(with boost on 5GHz) */ | ||
306 | join_pref_params[0].type = BRCMF_JOIN_PREF_RSSI_DELTA; | ||
307 | join_pref_params[0].len = 2; | ||
308 | join_pref_params[0].rssi_gain = BRCMF_JOIN_PREF_RSSI_BOOST; | ||
309 | join_pref_params[0].band = WLC_BAND_5G; | ||
310 | join_pref_params[1].type = BRCMF_JOIN_PREF_RSSI; | ||
311 | join_pref_params[1].len = 2; | ||
312 | join_pref_params[1].rssi_gain = 0; | ||
313 | join_pref_params[1].band = 0; | ||
314 | err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params, | ||
315 | sizeof(join_pref_params)); | ||
316 | if (err) | ||
317 | brcmf_err("Set join_pref error (%d)\n", err); | ||
318 | |||
301 | /* Setup event_msgs, enable E_IF */ | 319 | /* Setup event_msgs, enable E_IF */ |
302 | err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask, | 320 | err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask, |
303 | BRCMF_EVENTING_MASK_LEN); | 321 | BRCMF_EVENTING_MASK_LEN); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 7d28cd385092..09dd8c13d844 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | |||
@@ -190,7 +190,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, | |||
190 | int ret; | 190 | int ret; |
191 | struct brcmf_if *ifp = netdev_priv(ndev); | 191 | struct brcmf_if *ifp = netdev_priv(ndev); |
192 | struct brcmf_pub *drvr = ifp->drvr; | 192 | struct brcmf_pub *drvr = ifp->drvr; |
193 | struct ethhdr *eh; | 193 | struct ethhdr *eh = (struct ethhdr *)(skb->data); |
194 | 194 | ||
195 | brcmf_dbg(DATA, "Enter, idx=%d\n", ifp->bssidx); | 195 | brcmf_dbg(DATA, "Enter, idx=%d\n", ifp->bssidx); |
196 | 196 | ||
@@ -236,6 +236,9 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, | |||
236 | goto done; | 236 | goto done; |
237 | } | 237 | } |
238 | 238 | ||
239 | if (eh->h_proto == htons(ETH_P_PAE)) | ||
240 | atomic_inc(&ifp->pend_8021x_cnt); | ||
241 | |||
239 | ret = brcmf_fws_process_skb(ifp, skb); | 242 | ret = brcmf_fws_process_skb(ifp, skb); |
240 | 243 | ||
241 | done: | 244 | done: |
@@ -538,31 +541,26 @@ void brcmf_rx_frame(struct device *dev, struct sk_buff *skb) | |||
538 | brcmf_netif_rx(ifp, skb); | 541 | brcmf_netif_rx(ifp, skb); |
539 | } | 542 | } |
540 | 543 | ||
541 | void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, | 544 | void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx, |
542 | bool success) | 545 | bool success) |
543 | { | 546 | { |
544 | struct brcmf_if *ifp; | 547 | struct brcmf_if *ifp; |
545 | struct ethhdr *eh; | 548 | struct ethhdr *eh; |
546 | u8 ifidx; | ||
547 | u16 type; | 549 | u16 type; |
548 | int res; | ||
549 | |||
550 | res = brcmf_proto_hdrpull(drvr, false, &ifidx, txp); | ||
551 | 550 | ||
552 | ifp = drvr->iflist[ifidx]; | 551 | ifp = drvr->iflist[ifidx]; |
553 | if (!ifp) | 552 | if (!ifp) |
554 | goto done; | 553 | goto done; |
555 | 554 | ||
556 | if (res == 0) { | 555 | eh = (struct ethhdr *)(txp->data); |
557 | eh = (struct ethhdr *)(txp->data); | 556 | type = ntohs(eh->h_proto); |
558 | type = ntohs(eh->h_proto); | ||
559 | 557 | ||
560 | if (type == ETH_P_PAE) { | 558 | if (type == ETH_P_PAE) { |
561 | atomic_dec(&ifp->pend_8021x_cnt); | 559 | atomic_dec(&ifp->pend_8021x_cnt); |
562 | if (waitqueue_active(&ifp->pend_8021x_wait)) | 560 | if (waitqueue_active(&ifp->pend_8021x_wait)) |
563 | wake_up(&ifp->pend_8021x_wait); | 561 | wake_up(&ifp->pend_8021x_wait); |
564 | } | ||
565 | } | 562 | } |
563 | |||
566 | if (!success) | 564 | if (!success) |
567 | ifp->stats.tx_errors++; | 565 | ifp->stats.tx_errors++; |
568 | done: | 566 | done: |
@@ -573,13 +571,17 @@ void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success) | |||
573 | { | 571 | { |
574 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); | 572 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); |
575 | struct brcmf_pub *drvr = bus_if->drvr; | 573 | struct brcmf_pub *drvr = bus_if->drvr; |
574 | u8 ifidx; | ||
576 | 575 | ||
577 | /* await txstatus signal for firmware if active */ | 576 | /* await txstatus signal for firmware if active */ |
578 | if (brcmf_fws_fc_active(drvr->fws)) { | 577 | if (brcmf_fws_fc_active(drvr->fws)) { |
579 | if (!success) | 578 | if (!success) |
580 | brcmf_fws_bustxfail(drvr->fws, txp); | 579 | brcmf_fws_bustxfail(drvr->fws, txp); |
581 | } else { | 580 | } else { |
582 | brcmf_txfinalize(drvr, txp, success); | 581 | if (brcmf_proto_hdrpull(drvr, false, &ifidx, txp)) |
582 | brcmu_pkt_buf_free_skb(txp); | ||
583 | else | ||
584 | brcmf_txfinalize(drvr, txp, ifidx, success); | ||
583 | } | 585 | } |
584 | } | 586 | } |
585 | 587 | ||
@@ -914,13 +916,6 @@ int brcmf_bus_start(struct device *dev) | |||
914 | 916 | ||
915 | brcmf_dbg(TRACE, "\n"); | 917 | brcmf_dbg(TRACE, "\n"); |
916 | 918 | ||
917 | /* Bring up the bus */ | ||
918 | ret = brcmf_bus_init(bus_if); | ||
919 | if (ret != 0) { | ||
920 | brcmf_err("brcmf_sdbrcm_bus_init failed %d\n", ret); | ||
921 | return ret; | ||
922 | } | ||
923 | |||
924 | /* add primary networking interface */ | 919 | /* add primary networking interface */ |
925 | ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL); | 920 | ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL); |
926 | if (IS_ERR(ifp)) | 921 | if (IS_ERR(ifp)) |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 13c89a0c4ba7..8fa0dbbbda72 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include <soc.h> | 42 | #include <soc.h> |
43 | #include "sdio_host.h" | 43 | #include "sdio_host.h" |
44 | #include "chip.h" | 44 | #include "chip.h" |
45 | #include "nvram.h" | 45 | #include "firmware.h" |
46 | 46 | ||
47 | #define DCMD_RESP_TIMEOUT 2000 /* In milli second */ | 47 | #define DCMD_RESP_TIMEOUT 2000 /* In milli second */ |
48 | 48 | ||
@@ -632,43 +632,28 @@ static const struct brcmf_firmware_names brcmf_fwname_data[] = { | |||
632 | { BCM4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) } | 632 | { BCM4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) } |
633 | }; | 633 | }; |
634 | 634 | ||
635 | 635 | static const char *brcmf_sdio_get_fwname(struct brcmf_chip *ci, | |
636 | static const struct firmware *brcmf_sdio_get_fw(struct brcmf_sdio *bus, | 636 | enum brcmf_firmware_type type) |
637 | enum brcmf_firmware_type type) | ||
638 | { | 637 | { |
639 | const struct firmware *fw; | 638 | int i; |
640 | const char *name; | ||
641 | int err, i; | ||
642 | 639 | ||
643 | for (i = 0; i < ARRAY_SIZE(brcmf_fwname_data); i++) { | 640 | for (i = 0; i < ARRAY_SIZE(brcmf_fwname_data); i++) { |
644 | if (brcmf_fwname_data[i].chipid == bus->ci->chip && | 641 | if (brcmf_fwname_data[i].chipid == ci->chip && |
645 | brcmf_fwname_data[i].revmsk & BIT(bus->ci->chiprev)) { | 642 | brcmf_fwname_data[i].revmsk & BIT(ci->chiprev)) { |
646 | switch (type) { | 643 | switch (type) { |
647 | case BRCMF_FIRMWARE_BIN: | 644 | case BRCMF_FIRMWARE_BIN: |
648 | name = brcmf_fwname_data[i].bin; | 645 | return brcmf_fwname_data[i].bin; |
649 | break; | ||
650 | case BRCMF_FIRMWARE_NVRAM: | 646 | case BRCMF_FIRMWARE_NVRAM: |
651 | name = brcmf_fwname_data[i].nv; | 647 | return brcmf_fwname_data[i].nv; |
652 | break; | ||
653 | default: | 648 | default: |
654 | brcmf_err("invalid firmware type (%d)\n", type); | 649 | brcmf_err("invalid firmware type (%d)\n", type); |
655 | return NULL; | 650 | return NULL; |
656 | } | 651 | } |
657 | goto found; | ||
658 | } | 652 | } |
659 | } | 653 | } |
660 | brcmf_err("Unknown chipid %d [%d]\n", | 654 | brcmf_err("Unknown chipid %d [%d]\n", |
661 | bus->ci->chip, bus->ci->chiprev); | 655 | ci->chip, ci->chiprev); |
662 | return NULL; | 656 | return NULL; |
663 | |||
664 | found: | ||
665 | err = request_firmware(&fw, name, &bus->sdiodev->func[2]->dev); | ||
666 | if ((err) || (!fw)) { | ||
667 | brcmf_err("fail to request firmware %s (%d)\n", name, err); | ||
668 | return NULL; | ||
669 | } | ||
670 | |||
671 | return fw; | ||
672 | } | 657 | } |
673 | 658 | ||
674 | static void pkt_align(struct sk_buff *p, int len, int align) | 659 | static void pkt_align(struct sk_buff *p, int len, int align) |
@@ -3278,20 +3263,13 @@ static int brcmf_sdio_download_code_file(struct brcmf_sdio *bus, | |||
3278 | } | 3263 | } |
3279 | 3264 | ||
3280 | static int brcmf_sdio_download_nvram(struct brcmf_sdio *bus, | 3265 | static int brcmf_sdio_download_nvram(struct brcmf_sdio *bus, |
3281 | const struct firmware *nv) | 3266 | void *vars, u32 varsz) |
3282 | { | 3267 | { |
3283 | void *vars; | ||
3284 | u32 varsz; | ||
3285 | int address; | 3268 | int address; |
3286 | int err; | 3269 | int err; |
3287 | 3270 | ||
3288 | brcmf_dbg(TRACE, "Enter\n"); | 3271 | brcmf_dbg(TRACE, "Enter\n"); |
3289 | 3272 | ||
3290 | vars = brcmf_nvram_strip(nv, &varsz); | ||
3291 | |||
3292 | if (vars == NULL) | ||
3293 | return -EINVAL; | ||
3294 | |||
3295 | address = bus->ci->ramsize - varsz + bus->ci->rambase; | 3273 | address = bus->ci->ramsize - varsz + bus->ci->rambase; |
3296 | err = brcmf_sdiod_ramrw(bus->sdiodev, true, address, vars, varsz); | 3274 | err = brcmf_sdiod_ramrw(bus->sdiodev, true, address, vars, varsz); |
3297 | if (err) | 3275 | if (err) |
@@ -3300,15 +3278,14 @@ static int brcmf_sdio_download_nvram(struct brcmf_sdio *bus, | |||
3300 | else if (!brcmf_sdio_verifymemory(bus->sdiodev, address, vars, varsz)) | 3278 | else if (!brcmf_sdio_verifymemory(bus->sdiodev, address, vars, varsz)) |
3301 | err = -EIO; | 3279 | err = -EIO; |
3302 | 3280 | ||
3303 | brcmf_nvram_free(vars); | ||
3304 | |||
3305 | return err; | 3281 | return err; |
3306 | } | 3282 | } |
3307 | 3283 | ||
3308 | static int brcmf_sdio_download_firmware(struct brcmf_sdio *bus) | 3284 | static int brcmf_sdio_download_firmware(struct brcmf_sdio *bus, |
3285 | const struct firmware *fw, | ||
3286 | void *nvram, u32 nvlen) | ||
3309 | { | 3287 | { |
3310 | int bcmerror = -EFAULT; | 3288 | int bcmerror = -EFAULT; |
3311 | const struct firmware *fw; | ||
3312 | u32 rstvec; | 3289 | u32 rstvec; |
3313 | 3290 | ||
3314 | sdio_claim_host(bus->sdiodev->func[1]); | 3291 | sdio_claim_host(bus->sdiodev->func[1]); |
@@ -3317,12 +3294,6 @@ static int brcmf_sdio_download_firmware(struct brcmf_sdio *bus) | |||
3317 | /* Keep arm in reset */ | 3294 | /* Keep arm in reset */ |
3318 | brcmf_chip_enter_download(bus->ci); | 3295 | brcmf_chip_enter_download(bus->ci); |
3319 | 3296 | ||
3320 | fw = brcmf_sdio_get_fw(bus, BRCMF_FIRMWARE_BIN); | ||
3321 | if (fw == NULL) { | ||
3322 | bcmerror = -ENOENT; | ||
3323 | goto err; | ||
3324 | } | ||
3325 | |||
3326 | rstvec = get_unaligned_le32(fw->data); | 3297 | rstvec = get_unaligned_le32(fw->data); |
3327 | brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec); | 3298 | brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec); |
3328 | 3299 | ||
@@ -3330,17 +3301,12 @@ static int brcmf_sdio_download_firmware(struct brcmf_sdio *bus) | |||
3330 | release_firmware(fw); | 3301 | release_firmware(fw); |
3331 | if (bcmerror) { | 3302 | if (bcmerror) { |
3332 | brcmf_err("dongle image file download failed\n"); | 3303 | brcmf_err("dongle image file download failed\n"); |
3304 | brcmf_fw_nvram_free(nvram); | ||
3333 | goto err; | 3305 | goto err; |
3334 | } | 3306 | } |
3335 | 3307 | ||
3336 | fw = brcmf_sdio_get_fw(bus, BRCMF_FIRMWARE_NVRAM); | 3308 | bcmerror = brcmf_sdio_download_nvram(bus, nvram, nvlen); |
3337 | if (fw == NULL) { | 3309 | brcmf_fw_nvram_free(nvram); |
3338 | bcmerror = -ENOENT; | ||
3339 | goto err; | ||
3340 | } | ||
3341 | |||
3342 | bcmerror = brcmf_sdio_download_nvram(bus, fw); | ||
3343 | release_firmware(fw); | ||
3344 | if (bcmerror) { | 3310 | if (bcmerror) { |
3345 | brcmf_err("dongle nvram file download failed\n"); | 3311 | brcmf_err("dongle nvram file download failed\n"); |
3346 | goto err; | 3312 | goto err; |
@@ -3490,97 +3456,6 @@ done: | |||
3490 | return err; | 3456 | return err; |
3491 | } | 3457 | } |
3492 | 3458 | ||
3493 | static int brcmf_sdio_bus_init(struct device *dev) | ||
3494 | { | ||
3495 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); | ||
3496 | struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; | ||
3497 | struct brcmf_sdio *bus = sdiodev->bus; | ||
3498 | int err, ret = 0; | ||
3499 | u8 saveclk; | ||
3500 | |||
3501 | brcmf_dbg(TRACE, "Enter\n"); | ||
3502 | |||
3503 | /* try to download image and nvram to the dongle */ | ||
3504 | if (bus_if->state == BRCMF_BUS_DOWN) { | ||
3505 | bus->alp_only = true; | ||
3506 | err = brcmf_sdio_download_firmware(bus); | ||
3507 | if (err) | ||
3508 | return err; | ||
3509 | bus->alp_only = false; | ||
3510 | } | ||
3511 | |||
3512 | if (!bus->sdiodev->bus_if->drvr) | ||
3513 | return 0; | ||
3514 | |||
3515 | /* Start the watchdog timer */ | ||
3516 | bus->sdcnt.tickcnt = 0; | ||
3517 | brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS); | ||
3518 | |||
3519 | sdio_claim_host(bus->sdiodev->func[1]); | ||
3520 | |||
3521 | /* Make sure backplane clock is on, needed to generate F2 interrupt */ | ||
3522 | brcmf_sdio_clkctl(bus, CLK_AVAIL, false); | ||
3523 | if (bus->clkstate != CLK_AVAIL) | ||
3524 | goto exit; | ||
3525 | |||
3526 | /* Force clocks on backplane to be sure F2 interrupt propagates */ | ||
3527 | saveclk = brcmf_sdiod_regrb(bus->sdiodev, | ||
3528 | SBSDIO_FUNC1_CHIPCLKCSR, &err); | ||
3529 | if (!err) { | ||
3530 | brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, | ||
3531 | (saveclk | SBSDIO_FORCE_HT), &err); | ||
3532 | } | ||
3533 | if (err) { | ||
3534 | brcmf_err("Failed to force clock for F2: err %d\n", err); | ||
3535 | goto exit; | ||
3536 | } | ||
3537 | |||
3538 | /* Enable function 2 (frame transfers) */ | ||
3539 | w_sdreg32(bus, SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, | ||
3540 | offsetof(struct sdpcmd_regs, tosbmailboxdata)); | ||
3541 | err = sdio_enable_func(bus->sdiodev->func[SDIO_FUNC_2]); | ||
3542 | |||
3543 | |||
3544 | brcmf_dbg(INFO, "enable F2: err=%d\n", err); | ||
3545 | |||
3546 | /* If F2 successfully enabled, set core and enable interrupts */ | ||
3547 | if (!err) { | ||
3548 | /* Set up the interrupt mask and enable interrupts */ | ||
3549 | bus->hostintmask = HOSTINTMASK; | ||
3550 | w_sdreg32(bus, bus->hostintmask, | ||
3551 | offsetof(struct sdpcmd_regs, hostintmask)); | ||
3552 | |||
3553 | brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_WATERMARK, 8, &err); | ||
3554 | } else { | ||
3555 | /* Disable F2 again */ | ||
3556 | sdio_disable_func(bus->sdiodev->func[SDIO_FUNC_2]); | ||
3557 | ret = -ENODEV; | ||
3558 | } | ||
3559 | |||
3560 | if (brcmf_chip_sr_capable(bus->ci)) { | ||
3561 | brcmf_sdio_sr_init(bus); | ||
3562 | } else { | ||
3563 | /* Restore previous clock setting */ | ||
3564 | brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, | ||
3565 | saveclk, &err); | ||
3566 | } | ||
3567 | |||
3568 | if (ret == 0) { | ||
3569 | ret = brcmf_sdiod_intr_register(bus->sdiodev); | ||
3570 | if (ret != 0) | ||
3571 | brcmf_err("intr register failed:%d\n", ret); | ||
3572 | } | ||
3573 | |||
3574 | /* If we didn't come up, turn off backplane clock */ | ||
3575 | if (ret != 0) | ||
3576 | brcmf_sdio_clkctl(bus, CLK_NONE, false); | ||
3577 | |||
3578 | exit: | ||
3579 | sdio_release_host(bus->sdiodev->func[1]); | ||
3580 | |||
3581 | return ret; | ||
3582 | } | ||
3583 | |||
3584 | void brcmf_sdio_isr(struct brcmf_sdio *bus) | 3459 | void brcmf_sdio_isr(struct brcmf_sdio *bus) |
3585 | { | 3460 | { |
3586 | brcmf_dbg(TRACE, "Enter\n"); | 3461 | brcmf_dbg(TRACE, "Enter\n"); |
@@ -4020,13 +3895,114 @@ brcmf_sdio_watchdog(unsigned long data) | |||
4020 | static struct brcmf_bus_ops brcmf_sdio_bus_ops = { | 3895 | static struct brcmf_bus_ops brcmf_sdio_bus_ops = { |
4021 | .stop = brcmf_sdio_bus_stop, | 3896 | .stop = brcmf_sdio_bus_stop, |
4022 | .preinit = brcmf_sdio_bus_preinit, | 3897 | .preinit = brcmf_sdio_bus_preinit, |
4023 | .init = brcmf_sdio_bus_init, | ||
4024 | .txdata = brcmf_sdio_bus_txdata, | 3898 | .txdata = brcmf_sdio_bus_txdata, |
4025 | .txctl = brcmf_sdio_bus_txctl, | 3899 | .txctl = brcmf_sdio_bus_txctl, |
4026 | .rxctl = brcmf_sdio_bus_rxctl, | 3900 | .rxctl = brcmf_sdio_bus_rxctl, |
4027 | .gettxq = brcmf_sdio_bus_gettxq, | 3901 | .gettxq = brcmf_sdio_bus_gettxq, |
4028 | }; | 3902 | }; |
4029 | 3903 | ||
3904 | static void brcmf_sdio_firmware_callback(struct device *dev, | ||
3905 | const struct firmware *code, | ||
3906 | void *nvram, u32 nvram_len) | ||
3907 | { | ||
3908 | struct brcmf_bus *bus_if = dev_get_drvdata(dev); | ||
3909 | struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; | ||
3910 | struct brcmf_sdio *bus = sdiodev->bus; | ||
3911 | int err = 0; | ||
3912 | u8 saveclk; | ||
3913 | |||
3914 | brcmf_dbg(TRACE, "Enter: dev=%s\n", dev_name(dev)); | ||
3915 | |||
3916 | /* try to download image and nvram to the dongle */ | ||
3917 | if (bus_if->state == BRCMF_BUS_DOWN) { | ||
3918 | bus->alp_only = true; | ||
3919 | err = brcmf_sdio_download_firmware(bus, code, nvram, nvram_len); | ||
3920 | if (err) | ||
3921 | goto fail; | ||
3922 | bus->alp_only = false; | ||
3923 | } | ||
3924 | |||
3925 | if (!bus_if->drvr) | ||
3926 | return; | ||
3927 | |||
3928 | /* Start the watchdog timer */ | ||
3929 | bus->sdcnt.tickcnt = 0; | ||
3930 | brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS); | ||
3931 | |||
3932 | sdio_claim_host(sdiodev->func[1]); | ||
3933 | |||
3934 | /* Make sure backplane clock is on, needed to generate F2 interrupt */ | ||
3935 | brcmf_sdio_clkctl(bus, CLK_AVAIL, false); | ||
3936 | if (bus->clkstate != CLK_AVAIL) | ||
3937 | goto release; | ||
3938 | |||
3939 | /* Force clocks on backplane to be sure F2 interrupt propagates */ | ||
3940 | saveclk = brcmf_sdiod_regrb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, &err); | ||
3941 | if (!err) { | ||
3942 | brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, | ||
3943 | (saveclk | SBSDIO_FORCE_HT), &err); | ||
3944 | } | ||
3945 | if (err) { | ||
3946 | brcmf_err("Failed to force clock for F2: err %d\n", err); | ||
3947 | goto release; | ||
3948 | } | ||
3949 | |||
3950 | /* Enable function 2 (frame transfers) */ | ||
3951 | w_sdreg32(bus, SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, | ||
3952 | offsetof(struct sdpcmd_regs, tosbmailboxdata)); | ||
3953 | err = sdio_enable_func(sdiodev->func[SDIO_FUNC_2]); | ||
3954 | |||
3955 | |||
3956 | brcmf_dbg(INFO, "enable F2: err=%d\n", err); | ||
3957 | |||
3958 | /* If F2 successfully enabled, set core and enable interrupts */ | ||
3959 | if (!err) { | ||
3960 | /* Set up the interrupt mask and enable interrupts */ | ||
3961 | bus->hostintmask = HOSTINTMASK; | ||
3962 | w_sdreg32(bus, bus->hostintmask, | ||
3963 | offsetof(struct sdpcmd_regs, hostintmask)); | ||
3964 | |||
3965 | brcmf_sdiod_regwb(sdiodev, SBSDIO_WATERMARK, 8, &err); | ||
3966 | } else { | ||
3967 | /* Disable F2 again */ | ||
3968 | sdio_disable_func(sdiodev->func[SDIO_FUNC_2]); | ||
3969 | goto release; | ||
3970 | } | ||
3971 | |||
3972 | if (brcmf_chip_sr_capable(bus->ci)) { | ||
3973 | brcmf_sdio_sr_init(bus); | ||
3974 | } else { | ||
3975 | /* Restore previous clock setting */ | ||
3976 | brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, | ||
3977 | saveclk, &err); | ||
3978 | } | ||
3979 | |||
3980 | if (err == 0) { | ||
3981 | err = brcmf_sdiod_intr_register(sdiodev); | ||
3982 | if (err != 0) | ||
3983 | brcmf_err("intr register failed:%d\n", err); | ||
3984 | } | ||
3985 | |||
3986 | /* If we didn't come up, turn off backplane clock */ | ||
3987 | if (err != 0) | ||
3988 | brcmf_sdio_clkctl(bus, CLK_NONE, false); | ||
3989 | |||
3990 | sdio_release_host(sdiodev->func[1]); | ||
3991 | |||
3992 | err = brcmf_bus_start(dev); | ||
3993 | if (err != 0) { | ||
3994 | brcmf_err("dongle is not responding\n"); | ||
3995 | goto fail; | ||
3996 | } | ||
3997 | return; | ||
3998 | |||
3999 | release: | ||
4000 | sdio_release_host(sdiodev->func[1]); | ||
4001 | fail: | ||
4002 | brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err); | ||
4003 | device_release_driver(dev); | ||
4004 | } | ||
4005 | |||
4030 | struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) | 4006 | struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) |
4031 | { | 4007 | { |
4032 | int ret; | 4008 | int ret; |
@@ -4110,8 +4086,13 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) | |||
4110 | goto fail; | 4086 | goto fail; |
4111 | } | 4087 | } |
4112 | 4088 | ||
4089 | /* Query the F2 block size, set roundup accordingly */ | ||
4090 | bus->blocksize = bus->sdiodev->func[2]->cur_blksize; | ||
4091 | bus->roundup = min(max_roundup, bus->blocksize); | ||
4092 | |||
4113 | /* Allocate buffers */ | 4093 | /* Allocate buffers */ |
4114 | if (bus->sdiodev->bus_if->maxctl) { | 4094 | if (bus->sdiodev->bus_if->maxctl) { |
4095 | bus->sdiodev->bus_if->maxctl += bus->roundup; | ||
4115 | bus->rxblen = | 4096 | bus->rxblen = |
4116 | roundup((bus->sdiodev->bus_if->maxctl + SDPCM_HDRLEN), | 4097 | roundup((bus->sdiodev->bus_if->maxctl + SDPCM_HDRLEN), |
4117 | ALIGNMENT) + bus->head_align; | 4098 | ALIGNMENT) + bus->head_align; |
@@ -4139,10 +4120,6 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) | |||
4139 | bus->idletime = BRCMF_IDLE_INTERVAL; | 4120 | bus->idletime = BRCMF_IDLE_INTERVAL; |
4140 | bus->idleclock = BRCMF_IDLE_ACTIVE; | 4121 | bus->idleclock = BRCMF_IDLE_ACTIVE; |
4141 | 4122 | ||
4142 | /* Query the F2 block size, set roundup accordingly */ | ||
4143 | bus->blocksize = bus->sdiodev->func[2]->cur_blksize; | ||
4144 | bus->roundup = min(max_roundup, bus->blocksize); | ||
4145 | |||
4146 | /* SR state */ | 4123 | /* SR state */ |
4147 | bus->sleeping = false; | 4124 | bus->sleeping = false; |
4148 | bus->sr_enabled = false; | 4125 | bus->sr_enabled = false; |
@@ -4150,10 +4127,14 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) | |||
4150 | brcmf_sdio_debugfs_create(bus); | 4127 | brcmf_sdio_debugfs_create(bus); |
4151 | brcmf_dbg(INFO, "completed!!\n"); | 4128 | brcmf_dbg(INFO, "completed!!\n"); |
4152 | 4129 | ||
4153 | /* if firmware path present try to download and bring up bus */ | 4130 | ret = brcmf_fw_get_firmwares(sdiodev->dev, BRCMF_FW_REQUEST_NVRAM, |
4154 | ret = brcmf_bus_start(bus->sdiodev->dev); | 4131 | brcmf_sdio_get_fwname(bus->ci, |
4132 | BRCMF_FIRMWARE_BIN), | ||
4133 | brcmf_sdio_get_fwname(bus->ci, | ||
4134 | BRCMF_FIRMWARE_NVRAM), | ||
4135 | brcmf_sdio_firmware_callback); | ||
4155 | if (ret != 0) { | 4136 | if (ret != 0) { |
4156 | brcmf_err("dongle is not responding\n"); | 4137 | brcmf_err("async firmware request failed: %d\n", ret); |
4157 | goto fail; | 4138 | goto fail; |
4158 | } | 4139 | } |
4159 | 4140 | ||
@@ -4173,9 +4154,7 @@ void brcmf_sdio_remove(struct brcmf_sdio *bus) | |||
4173 | /* De-register interrupt handler */ | 4154 | /* De-register interrupt handler */ |
4174 | brcmf_sdiod_intr_unregister(bus->sdiodev); | 4155 | brcmf_sdiod_intr_unregister(bus->sdiodev); |
4175 | 4156 | ||
4176 | if (bus->sdiodev->bus_if->drvr) { | 4157 | brcmf_detach(bus->sdiodev->dev); |
4177 | brcmf_detach(bus->sdiodev->dev); | ||
4178 | } | ||
4179 | 4158 | ||
4180 | cancel_work_sync(&bus->datawork); | 4159 | cancel_work_sync(&bus->datawork); |
4181 | if (bus->brcmf_wq) | 4160 | if (bus->brcmf_wq) |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c new file mode 100644 index 000000000000..7b7d237c1ddb --- /dev/null +++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c | |||
@@ -0,0 +1,332 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 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 | */ | ||
16 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/device.h> | ||
20 | #include <linux/firmware.h> | ||
21 | |||
22 | #include "dhd_dbg.h" | ||
23 | #include "firmware.h" | ||
24 | |||
25 | enum nvram_parser_state { | ||
26 | IDLE, | ||
27 | KEY, | ||
28 | VALUE, | ||
29 | COMMENT, | ||
30 | END | ||
31 | }; | ||
32 | |||
33 | /** | ||
34 | * struct nvram_parser - internal info for parser. | ||
35 | * | ||
36 | * @state: current parser state. | ||
37 | * @fwnv: input buffer being parsed. | ||
38 | * @nvram: output buffer with parse result. | ||
39 | * @nvram_len: lenght of parse result. | ||
40 | * @line: current line. | ||
41 | * @column: current column in line. | ||
42 | * @pos: byte offset in input buffer. | ||
43 | * @entry: start position of key,value entry. | ||
44 | */ | ||
45 | struct nvram_parser { | ||
46 | enum nvram_parser_state state; | ||
47 | const struct firmware *fwnv; | ||
48 | u8 *nvram; | ||
49 | u32 nvram_len; | ||
50 | u32 line; | ||
51 | u32 column; | ||
52 | u32 pos; | ||
53 | u32 entry; | ||
54 | }; | ||
55 | |||
56 | static bool is_nvram_char(char c) | ||
57 | { | ||
58 | /* comment marker excluded */ | ||
59 | if (c == '#') | ||
60 | return false; | ||
61 | |||
62 | /* key and value may have any other readable character */ | ||
63 | return (c > 0x20 && c < 0x7f); | ||
64 | } | ||
65 | |||
66 | static bool is_whitespace(char c) | ||
67 | { | ||
68 | return (c == ' ' || c == '\r' || c == '\n' || c == '\t'); | ||
69 | } | ||
70 | |||
71 | static enum nvram_parser_state brcmf_nvram_handle_idle(struct nvram_parser *nvp) | ||
72 | { | ||
73 | char c; | ||
74 | |||
75 | c = nvp->fwnv->data[nvp->pos]; | ||
76 | if (c == '\n') | ||
77 | return COMMENT; | ||
78 | if (is_whitespace(c)) | ||
79 | goto proceed; | ||
80 | if (c == '#') | ||
81 | return COMMENT; | ||
82 | if (is_nvram_char(c)) { | ||
83 | nvp->entry = nvp->pos; | ||
84 | return KEY; | ||
85 | } | ||
86 | brcmf_dbg(INFO, "warning: ln=%d:col=%d: ignoring invalid character\n", | ||
87 | nvp->line, nvp->column); | ||
88 | proceed: | ||
89 | nvp->column++; | ||
90 | nvp->pos++; | ||
91 | return IDLE; | ||
92 | } | ||
93 | |||
94 | static enum nvram_parser_state brcmf_nvram_handle_key(struct nvram_parser *nvp) | ||
95 | { | ||
96 | enum nvram_parser_state st = nvp->state; | ||
97 | char c; | ||
98 | |||
99 | c = nvp->fwnv->data[nvp->pos]; | ||
100 | if (c == '=') { | ||
101 | st = VALUE; | ||
102 | } else if (!is_nvram_char(c)) { | ||
103 | brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n", | ||
104 | nvp->line, nvp->column); | ||
105 | return COMMENT; | ||
106 | } | ||
107 | |||
108 | nvp->column++; | ||
109 | nvp->pos++; | ||
110 | return st; | ||
111 | } | ||
112 | |||
113 | static enum nvram_parser_state | ||
114 | brcmf_nvram_handle_value(struct nvram_parser *nvp) | ||
115 | { | ||
116 | char c; | ||
117 | char *skv; | ||
118 | char *ekv; | ||
119 | u32 cplen; | ||
120 | |||
121 | c = nvp->fwnv->data[nvp->pos]; | ||
122 | if (!is_nvram_char(c)) { | ||
123 | /* key,value pair complete */ | ||
124 | ekv = (u8 *)&nvp->fwnv->data[nvp->pos]; | ||
125 | skv = (u8 *)&nvp->fwnv->data[nvp->entry]; | ||
126 | cplen = ekv - skv; | ||
127 | /* copy to output buffer */ | ||
128 | memcpy(&nvp->nvram[nvp->nvram_len], skv, cplen); | ||
129 | nvp->nvram_len += cplen; | ||
130 | nvp->nvram[nvp->nvram_len] = '\0'; | ||
131 | nvp->nvram_len++; | ||
132 | return IDLE; | ||
133 | } | ||
134 | nvp->pos++; | ||
135 | nvp->column++; | ||
136 | return VALUE; | ||
137 | } | ||
138 | |||
139 | static enum nvram_parser_state | ||
140 | brcmf_nvram_handle_comment(struct nvram_parser *nvp) | ||
141 | { | ||
142 | char *eol, *sol; | ||
143 | |||
144 | sol = (char *)&nvp->fwnv->data[nvp->pos]; | ||
145 | eol = strchr(sol, '\n'); | ||
146 | if (eol == NULL) | ||
147 | return END; | ||
148 | |||
149 | /* eat all moving to next line */ | ||
150 | nvp->line++; | ||
151 | nvp->column = 1; | ||
152 | nvp->pos += (eol - sol) + 1; | ||
153 | return IDLE; | ||
154 | } | ||
155 | |||
156 | static enum nvram_parser_state brcmf_nvram_handle_end(struct nvram_parser *nvp) | ||
157 | { | ||
158 | /* final state */ | ||
159 | return END; | ||
160 | } | ||
161 | |||
162 | static enum nvram_parser_state | ||
163 | (*nv_parser_states[])(struct nvram_parser *nvp) = { | ||
164 | brcmf_nvram_handle_idle, | ||
165 | brcmf_nvram_handle_key, | ||
166 | brcmf_nvram_handle_value, | ||
167 | brcmf_nvram_handle_comment, | ||
168 | brcmf_nvram_handle_end | ||
169 | }; | ||
170 | |||
171 | static int brcmf_init_nvram_parser(struct nvram_parser *nvp, | ||
172 | const struct firmware *nv) | ||
173 | { | ||
174 | memset(nvp, 0, sizeof(*nvp)); | ||
175 | nvp->fwnv = nv; | ||
176 | /* Alloc for extra 0 byte + roundup by 4 + length field */ | ||
177 | nvp->nvram = kzalloc(nv->size + 1 + 3 + sizeof(u32), GFP_KERNEL); | ||
178 | if (!nvp->nvram) | ||
179 | return -ENOMEM; | ||
180 | |||
181 | nvp->line = 1; | ||
182 | nvp->column = 1; | ||
183 | return 0; | ||
184 | } | ||
185 | |||
186 | /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil | ||
187 | * and ending in a NUL. Removes carriage returns, empty lines, comment lines, | ||
188 | * and converts newlines to NULs. Shortens buffer as needed and pads with NULs. | ||
189 | * End of buffer is completed with token identifying length of buffer. | ||
190 | */ | ||
191 | static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length) | ||
192 | { | ||
193 | struct nvram_parser nvp; | ||
194 | u32 pad; | ||
195 | u32 token; | ||
196 | __le32 token_le; | ||
197 | |||
198 | if (brcmf_init_nvram_parser(&nvp, nv) < 0) | ||
199 | return NULL; | ||
200 | |||
201 | while (nvp.pos < nv->size) { | ||
202 | nvp.state = nv_parser_states[nvp.state](&nvp); | ||
203 | if (nvp.state == END) | ||
204 | break; | ||
205 | } | ||
206 | pad = nvp.nvram_len; | ||
207 | *new_length = roundup(nvp.nvram_len + 1, 4); | ||
208 | while (pad != *new_length) { | ||
209 | nvp.nvram[pad] = 0; | ||
210 | pad++; | ||
211 | } | ||
212 | |||
213 | token = *new_length / 4; | ||
214 | token = (~token << 16) | (token & 0x0000FFFF); | ||
215 | token_le = cpu_to_le32(token); | ||
216 | |||
217 | memcpy(&nvp.nvram[*new_length], &token_le, sizeof(token_le)); | ||
218 | *new_length += sizeof(token_le); | ||
219 | |||
220 | return nvp.nvram; | ||
221 | } | ||
222 | |||
223 | void brcmf_fw_nvram_free(void *nvram) | ||
224 | { | ||
225 | kfree(nvram); | ||
226 | } | ||
227 | |||
228 | struct brcmf_fw { | ||
229 | struct device *dev; | ||
230 | u16 flags; | ||
231 | const struct firmware *code; | ||
232 | const char *nvram_name; | ||
233 | void (*done)(struct device *dev, const struct firmware *fw, | ||
234 | void *nvram_image, u32 nvram_len); | ||
235 | }; | ||
236 | |||
237 | static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) | ||
238 | { | ||
239 | struct brcmf_fw *fwctx = ctx; | ||
240 | u32 nvram_length = 0; | ||
241 | void *nvram = NULL; | ||
242 | |||
243 | brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev)); | ||
244 | if (!fw && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL)) | ||
245 | goto fail; | ||
246 | |||
247 | if (fw) { | ||
248 | nvram = brcmf_fw_nvram_strip(fw, &nvram_length); | ||
249 | release_firmware(fw); | ||
250 | if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL)) | ||
251 | goto fail; | ||
252 | } | ||
253 | |||
254 | fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length); | ||
255 | kfree(fwctx); | ||
256 | return; | ||
257 | |||
258 | fail: | ||
259 | brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); | ||
260 | if (fwctx->code) | ||
261 | release_firmware(fwctx->code); | ||
262 | device_release_driver(fwctx->dev); | ||
263 | kfree(fwctx); | ||
264 | } | ||
265 | |||
266 | static void brcmf_fw_request_code_done(const struct firmware *fw, void *ctx) | ||
267 | { | ||
268 | struct brcmf_fw *fwctx = ctx; | ||
269 | int ret; | ||
270 | |||
271 | brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev)); | ||
272 | if (!fw) | ||
273 | goto fail; | ||
274 | |||
275 | /* only requested code so done here */ | ||
276 | if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) { | ||
277 | fwctx->done(fwctx->dev, fw, NULL, 0); | ||
278 | kfree(fwctx); | ||
279 | return; | ||
280 | } | ||
281 | fwctx->code = fw; | ||
282 | ret = request_firmware_nowait(THIS_MODULE, true, fwctx->nvram_name, | ||
283 | fwctx->dev, GFP_KERNEL, fwctx, | ||
284 | brcmf_fw_request_nvram_done); | ||
285 | |||
286 | if (!ret) | ||
287 | return; | ||
288 | |||
289 | /* when nvram is optional call .done() callback here */ | ||
290 | if (fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL) { | ||
291 | fwctx->done(fwctx->dev, fw, NULL, 0); | ||
292 | kfree(fwctx); | ||
293 | return; | ||
294 | } | ||
295 | |||
296 | /* failed nvram request */ | ||
297 | release_firmware(fw); | ||
298 | fail: | ||
299 | brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); | ||
300 | device_release_driver(fwctx->dev); | ||
301 | kfree(fwctx); | ||
302 | } | ||
303 | |||
304 | int brcmf_fw_get_firmwares(struct device *dev, u16 flags, | ||
305 | const char *code, const char *nvram, | ||
306 | void (*fw_cb)(struct device *dev, | ||
307 | const struct firmware *fw, | ||
308 | void *nvram_image, u32 nvram_len)) | ||
309 | { | ||
310 | struct brcmf_fw *fwctx; | ||
311 | |||
312 | brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev)); | ||
313 | if (!fw_cb || !code) | ||
314 | return -EINVAL; | ||
315 | |||
316 | if ((flags & BRCMF_FW_REQUEST_NVRAM) && !nvram) | ||
317 | return -EINVAL; | ||
318 | |||
319 | fwctx = kzalloc(sizeof(*fwctx), GFP_KERNEL); | ||
320 | if (!fwctx) | ||
321 | return -ENOMEM; | ||
322 | |||
323 | fwctx->dev = dev; | ||
324 | fwctx->flags = flags; | ||
325 | fwctx->done = fw_cb; | ||
326 | if (flags & BRCMF_FW_REQUEST_NVRAM) | ||
327 | fwctx->nvram_name = nvram; | ||
328 | |||
329 | return request_firmware_nowait(THIS_MODULE, true, code, dev, | ||
330 | GFP_KERNEL, fwctx, | ||
331 | brcmf_fw_request_code_done); | ||
332 | } | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/nvram.h b/drivers/net/wireless/brcm80211/brcmfmac/firmware.h index d454580928c9..6431bfd7afff 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/nvram.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.h | |||
@@ -13,12 +13,24 @@ | |||
13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | 13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 15 | */ |
16 | #ifndef BRCMFMAC_NVRAM_H | 16 | #ifndef BRCMFMAC_FIRMWARE_H |
17 | #define BRCMFMAC_NVRAM_H | 17 | #define BRCMFMAC_FIRMWARE_H |
18 | 18 | ||
19 | #define BRCMF_FW_REQUEST 0x000F | ||
20 | #define BRCMF_FW_REQUEST_NVRAM 0x0001 | ||
21 | #define BRCMF_FW_REQ_FLAGS 0x00F0 | ||
22 | #define BRCMF_FW_REQ_NV_OPTIONAL 0x0010 | ||
19 | 23 | ||
20 | void *brcmf_nvram_strip(const struct firmware *nv, u32 *new_length); | 24 | void brcmf_fw_nvram_free(void *nvram); |
21 | void brcmf_nvram_free(void *nvram); | 25 | /* |
22 | 26 | * Request firmware(s) asynchronously. When the asynchronous request | |
27 | * fails it will not use the callback, but call device_release_driver() | ||
28 | * instead which will call the driver .remove() callback. | ||
29 | */ | ||
30 | int brcmf_fw_get_firmwares(struct device *dev, u16 flags, | ||
31 | const char *code, const char *nvram, | ||
32 | void (*fw_cb)(struct device *dev, | ||
33 | const struct firmware *fw, | ||
34 | void *nvram_image, u32 nvram_len)); | ||
23 | 35 | ||
24 | #endif /* BRCMFMAC_NVRAM_H */ | 36 | #endif /* BRCMFMAC_FIRMWARE_H */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h index 614e4888504f..2bc68a2137fc 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h | |||
@@ -53,6 +53,14 @@ | |||
53 | #define BRCMF_OBSS_COEX_OFF 0 | 53 | #define BRCMF_OBSS_COEX_OFF 0 |
54 | #define BRCMF_OBSS_COEX_ON 1 | 54 | #define BRCMF_OBSS_COEX_ON 1 |
55 | 55 | ||
56 | /* join preference types for join_pref iovar */ | ||
57 | enum brcmf_join_pref_types { | ||
58 | BRCMF_JOIN_PREF_RSSI = 1, | ||
59 | BRCMF_JOIN_PREF_WPA, | ||
60 | BRCMF_JOIN_PREF_BAND, | ||
61 | BRCMF_JOIN_PREF_RSSI_DELTA, | ||
62 | }; | ||
63 | |||
56 | enum brcmf_fil_p2p_if_types { | 64 | enum brcmf_fil_p2p_if_types { |
57 | BRCMF_FIL_P2P_IF_CLIENT, | 65 | BRCMF_FIL_P2P_IF_CLIENT, |
58 | BRCMF_FIL_P2P_IF_GO, | 66 | BRCMF_FIL_P2P_IF_GO, |
@@ -282,6 +290,22 @@ struct brcmf_assoc_params_le { | |||
282 | __le16 chanspec_list[1]; | 290 | __le16 chanspec_list[1]; |
283 | }; | 291 | }; |
284 | 292 | ||
293 | /** | ||
294 | * struct join_pref params - parameters for preferred join selection. | ||
295 | * | ||
296 | * @type: preference type (see enum brcmf_join_pref_types). | ||
297 | * @len: length of bytes following (currently always 2). | ||
298 | * @rssi_gain: signal gain for selection (only when @type is RSSI_DELTA). | ||
299 | * @band: band to which selection preference applies. | ||
300 | * This is used if @type is BAND or RSSI_DELTA. | ||
301 | */ | ||
302 | struct brcmf_join_pref_params { | ||
303 | u8 type; | ||
304 | u8 len; | ||
305 | u8 rssi_gain; | ||
306 | u8 band; | ||
307 | }; | ||
308 | |||
285 | /* used for join with or without a specific bssid and channel list */ | 309 | /* used for join with or without a specific bssid and channel list */ |
286 | struct brcmf_join_params { | 310 | struct brcmf_join_params { |
287 | struct brcmf_ssid_le ssid_le; | 311 | struct brcmf_ssid_le ssid_le; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c index c3e7d76dbf35..699908de314a 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | |||
@@ -476,6 +476,7 @@ struct brcmf_fws_info { | |||
476 | bool bus_flow_blocked; | 476 | bool bus_flow_blocked; |
477 | bool creditmap_received; | 477 | bool creditmap_received; |
478 | u8 mode; | 478 | u8 mode; |
479 | bool avoid_queueing; | ||
479 | }; | 480 | }; |
480 | 481 | ||
481 | /* | 482 | /* |
@@ -1369,13 +1370,12 @@ done: | |||
1369 | } | 1370 | } |
1370 | 1371 | ||
1371 | static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo, | 1372 | static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo, |
1372 | struct sk_buff *skb, u32 genbit, | 1373 | struct sk_buff *skb, u8 ifidx, |
1373 | u16 seq) | 1374 | u32 genbit, u16 seq) |
1374 | { | 1375 | { |
1375 | struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac; | 1376 | struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac; |
1376 | u32 hslot; | 1377 | u32 hslot; |
1377 | int ret; | 1378 | int ret; |
1378 | u8 ifidx; | ||
1379 | 1379 | ||
1380 | hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); | 1380 | hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); |
1381 | 1381 | ||
@@ -1389,29 +1389,21 @@ static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo, | |||
1389 | 1389 | ||
1390 | entry->generation = genbit; | 1390 | entry->generation = genbit; |
1391 | 1391 | ||
1392 | ret = brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb); | 1392 | brcmf_skb_htod_tag_set_field(skb, GENERATION, genbit); |
1393 | if (ret == 0) { | 1393 | brcmf_skbcb(skb)->htod_seq = seq; |
1394 | brcmf_skb_htod_tag_set_field(skb, GENERATION, genbit); | 1394 | if (brcmf_skb_htod_seq_get_field(skb, FROMFW)) { |
1395 | brcmf_skbcb(skb)->htod_seq = seq; | 1395 | brcmf_skb_htod_seq_set_field(skb, FROMDRV, 1); |
1396 | if (brcmf_skb_htod_seq_get_field(skb, FROMFW)) { | 1396 | brcmf_skb_htod_seq_set_field(skb, FROMFW, 0); |
1397 | brcmf_skb_htod_seq_set_field(skb, FROMDRV, 1); | 1397 | } else { |
1398 | brcmf_skb_htod_seq_set_field(skb, FROMFW, 0); | 1398 | brcmf_skb_htod_seq_set_field(skb, FROMDRV, 0); |
1399 | } else { | ||
1400 | brcmf_skb_htod_seq_set_field(skb, FROMDRV, 0); | ||
1401 | } | ||
1402 | ret = brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_SUPPRESSED, fifo, | ||
1403 | skb); | ||
1404 | } | 1399 | } |
1400 | ret = brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_SUPPRESSED, fifo, skb); | ||
1405 | 1401 | ||
1406 | if (ret != 0) { | 1402 | if (ret != 0) { |
1407 | /* suppress q is full or hdrpull failed, drop this packet */ | 1403 | /* suppress q is full drop this packet */ |
1408 | brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, | 1404 | brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, true); |
1409 | true); | ||
1410 | } else { | 1405 | } else { |
1411 | /* | 1406 | /* Mark suppressed to avoid a double free during wlfc cleanup */ |
1412 | * Mark suppressed to avoid a double free during | ||
1413 | * wlfc cleanup | ||
1414 | */ | ||
1415 | brcmf_fws_hanger_mark_suppressed(&fws->hanger, hslot); | 1407 | brcmf_fws_hanger_mark_suppressed(&fws->hanger, hslot); |
1416 | } | 1408 | } |
1417 | 1409 | ||
@@ -1428,6 +1420,7 @@ brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot, | |||
1428 | struct sk_buff *skb; | 1420 | struct sk_buff *skb; |
1429 | struct brcmf_skbuff_cb *skcb; | 1421 | struct brcmf_skbuff_cb *skcb; |
1430 | struct brcmf_fws_mac_descriptor *entry = NULL; | 1422 | struct brcmf_fws_mac_descriptor *entry = NULL; |
1423 | u8 ifidx; | ||
1431 | 1424 | ||
1432 | brcmf_dbg(DATA, "flags %d\n", flags); | 1425 | brcmf_dbg(DATA, "flags %d\n", flags); |
1433 | 1426 | ||
@@ -1476,12 +1469,15 @@ brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot, | |||
1476 | } | 1469 | } |
1477 | brcmf_fws_macdesc_return_req_credit(skb); | 1470 | brcmf_fws_macdesc_return_req_credit(skb); |
1478 | 1471 | ||
1472 | if (brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb)) { | ||
1473 | brcmu_pkt_buf_free_skb(skb); | ||
1474 | return -EINVAL; | ||
1475 | } | ||
1479 | if (!remove_from_hanger) | 1476 | if (!remove_from_hanger) |
1480 | ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, genbit, | 1477 | ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifidx, |
1481 | seq); | 1478 | genbit, seq); |
1482 | |||
1483 | if (remove_from_hanger || ret) | 1479 | if (remove_from_hanger || ret) |
1484 | brcmf_txfinalize(fws->drvr, skb, true); | 1480 | brcmf_txfinalize(fws->drvr, skb, ifidx, true); |
1485 | 1481 | ||
1486 | return 0; | 1482 | return 0; |
1487 | } | 1483 | } |
@@ -1868,7 +1864,7 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1868 | struct ethhdr *eh = (struct ethhdr *)(skb->data); | 1864 | struct ethhdr *eh = (struct ethhdr *)(skb->data); |
1869 | int fifo = BRCMF_FWS_FIFO_BCMC; | 1865 | int fifo = BRCMF_FWS_FIFO_BCMC; |
1870 | bool multicast = is_multicast_ether_addr(eh->h_dest); | 1866 | bool multicast = is_multicast_ether_addr(eh->h_dest); |
1871 | bool pae = eh->h_proto == htons(ETH_P_PAE); | 1867 | int rc = 0; |
1872 | 1868 | ||
1873 | brcmf_dbg(DATA, "tx proto=0x%X\n", ntohs(eh->h_proto)); | 1869 | brcmf_dbg(DATA, "tx proto=0x%X\n", ntohs(eh->h_proto)); |
1874 | /* determine the priority */ | 1870 | /* determine the priority */ |
@@ -1876,8 +1872,13 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1876 | skb->priority = cfg80211_classify8021d(skb, NULL); | 1872 | skb->priority = cfg80211_classify8021d(skb, NULL); |
1877 | 1873 | ||
1878 | drvr->tx_multicast += !!multicast; | 1874 | drvr->tx_multicast += !!multicast; |
1879 | if (pae) | 1875 | |
1880 | atomic_inc(&ifp->pend_8021x_cnt); | 1876 | if (fws->avoid_queueing) { |
1877 | rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb); | ||
1878 | if (rc < 0) | ||
1879 | brcmf_txfinalize(drvr, skb, ifp->ifidx, false); | ||
1880 | return rc; | ||
1881 | } | ||
1881 | 1882 | ||
1882 | /* set control buffer information */ | 1883 | /* set control buffer information */ |
1883 | skcb->if_flags = 0; | 1884 | skcb->if_flags = 0; |
@@ -1899,15 +1900,12 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1899 | brcmf_fws_schedule_deq(fws); | 1900 | brcmf_fws_schedule_deq(fws); |
1900 | } else { | 1901 | } else { |
1901 | brcmf_err("drop skb: no hanger slot\n"); | 1902 | brcmf_err("drop skb: no hanger slot\n"); |
1902 | if (pae) { | 1903 | brcmf_txfinalize(drvr, skb, ifp->ifidx, false); |
1903 | atomic_dec(&ifp->pend_8021x_cnt); | 1904 | rc = -ENOMEM; |
1904 | if (waitqueue_active(&ifp->pend_8021x_wait)) | ||
1905 | wake_up(&ifp->pend_8021x_wait); | ||
1906 | } | ||
1907 | brcmu_pkt_buf_free_skb(skb); | ||
1908 | } | 1905 | } |
1909 | brcmf_fws_unlock(fws); | 1906 | brcmf_fws_unlock(fws); |
1910 | return 0; | 1907 | |
1908 | return rc; | ||
1911 | } | 1909 | } |
1912 | 1910 | ||
1913 | void brcmf_fws_reset_interface(struct brcmf_if *ifp) | 1911 | void brcmf_fws_reset_interface(struct brcmf_if *ifp) |
@@ -1982,7 +1980,8 @@ static void brcmf_fws_dequeue_worker(struct work_struct *worker) | |||
1982 | ret = brcmf_proto_txdata(drvr, ifidx, 0, skb); | 1980 | ret = brcmf_proto_txdata(drvr, ifidx, 0, skb); |
1983 | brcmf_fws_lock(fws); | 1981 | brcmf_fws_lock(fws); |
1984 | if (ret < 0) | 1982 | if (ret < 0) |
1985 | brcmf_txfinalize(drvr, skb, false); | 1983 | brcmf_txfinalize(drvr, skb, ifidx, |
1984 | false); | ||
1986 | if (fws->bus_flow_blocked) | 1985 | if (fws->bus_flow_blocked) |
1987 | break; | 1986 | break; |
1988 | } | 1987 | } |
@@ -2039,6 +2038,13 @@ int brcmf_fws_init(struct brcmf_pub *drvr) | |||
2039 | fws->drvr = drvr; | 2038 | fws->drvr = drvr; |
2040 | fws->fcmode = fcmode; | 2039 | fws->fcmode = fcmode; |
2041 | 2040 | ||
2041 | if ((drvr->bus_if->always_use_fws_queue == false) && | ||
2042 | (fcmode == BRCMF_FWS_FCMODE_NONE)) { | ||
2043 | fws->avoid_queueing = true; | ||
2044 | brcmf_dbg(INFO, "FWS queueing will be avoided\n"); | ||
2045 | return 0; | ||
2046 | } | ||
2047 | |||
2042 | fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq"); | 2048 | fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq"); |
2043 | if (fws->fws_wq == NULL) { | 2049 | if (fws->fws_wq == NULL) { |
2044 | brcmf_err("workqueue creation failed\n"); | 2050 | brcmf_err("workqueue creation failed\n"); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/nvram.c b/drivers/net/wireless/brcm80211/brcmfmac/nvram.c deleted file mode 100644 index d5ef86db631b..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/nvram.c +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 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 | */ | ||
16 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/firmware.h> | ||
20 | |||
21 | #include "nvram.h" | ||
22 | |||
23 | /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a file | ||
24 | * and ending in a NUL. Removes carriage returns, empty lines, comment lines, | ||
25 | * and converts newlines to NULs. Shortens buffer as needed and pads with NULs. | ||
26 | * End of buffer is completed with token identifying length of buffer. | ||
27 | */ | ||
28 | void *brcmf_nvram_strip(const struct firmware *nv, u32 *new_length) | ||
29 | { | ||
30 | u8 *nvram; | ||
31 | u32 i; | ||
32 | u32 len; | ||
33 | u32 column; | ||
34 | u8 val; | ||
35 | bool comment; | ||
36 | u32 token; | ||
37 | __le32 token_le; | ||
38 | |||
39 | /* Alloc for extra 0 byte + roundup by 4 + length field */ | ||
40 | nvram = kmalloc(nv->size + 1 + 3 + sizeof(token_le), GFP_KERNEL); | ||
41 | if (!nvram) | ||
42 | return NULL; | ||
43 | |||
44 | len = 0; | ||
45 | column = 0; | ||
46 | comment = false; | ||
47 | for (i = 0; i < nv->size; i++) { | ||
48 | val = nv->data[i]; | ||
49 | if (val == 0) | ||
50 | break; | ||
51 | if (val == '\r') | ||
52 | continue; | ||
53 | if (comment && (val != '\n')) | ||
54 | continue; | ||
55 | comment = false; | ||
56 | if (val == '#') { | ||
57 | comment = true; | ||
58 | continue; | ||
59 | } | ||
60 | if (val == '\n') { | ||
61 | if (column == 0) | ||
62 | continue; | ||
63 | nvram[len] = 0; | ||
64 | len++; | ||
65 | column = 0; | ||
66 | continue; | ||
67 | } | ||
68 | nvram[len] = val; | ||
69 | len++; | ||
70 | column++; | ||
71 | } | ||
72 | column = len; | ||
73 | *new_length = roundup(len + 1, 4); | ||
74 | while (column != *new_length) { | ||
75 | nvram[column] = 0; | ||
76 | column++; | ||
77 | } | ||
78 | |||
79 | token = *new_length / 4; | ||
80 | token = (~token << 16) | (token & 0x0000FFFF); | ||
81 | token_le = cpu_to_le32(token); | ||
82 | |||
83 | memcpy(&nvram[*new_length], &token_le, sizeof(token_le)); | ||
84 | *new_length += sizeof(token_le); | ||
85 | |||
86 | return nvram; | ||
87 | } | ||
88 | |||
89 | void brcmf_nvram_free(void *nvram) | ||
90 | { | ||
91 | kfree(nvram); | ||
92 | } | ||
93 | |||
94 | |||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index 24f65cd53859..6db51a666f61 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <dhd_bus.h> | 25 | #include <dhd_bus.h> |
26 | #include <dhd_dbg.h> | 26 | #include <dhd_dbg.h> |
27 | 27 | ||
28 | #include "firmware.h" | ||
28 | #include "usb_rdl.h" | 29 | #include "usb_rdl.h" |
29 | #include "usb.h" | 30 | #include "usb.h" |
30 | 31 | ||
@@ -61,12 +62,6 @@ struct brcmf_usb_image { | |||
61 | u8 *image; | 62 | u8 *image; |
62 | int image_len; | 63 | int image_len; |
63 | }; | 64 | }; |
64 | static struct list_head fw_image_list; | ||
65 | |||
66 | struct intr_transfer_buf { | ||
67 | u32 notification; | ||
68 | u32 reserved; | ||
69 | }; | ||
70 | 65 | ||
71 | struct brcmf_usbdev_info { | 66 | struct brcmf_usbdev_info { |
72 | struct brcmf_usbdev bus_pub; /* MUST BE FIRST */ | 67 | struct brcmf_usbdev bus_pub; /* MUST BE FIRST */ |
@@ -75,7 +70,7 @@ struct brcmf_usbdev_info { | |||
75 | struct list_head rx_postq; | 70 | struct list_head rx_postq; |
76 | struct list_head tx_freeq; | 71 | struct list_head tx_freeq; |
77 | struct list_head tx_postq; | 72 | struct list_head tx_postq; |
78 | uint rx_pipe, tx_pipe, intr_pipe, rx_pipe2; | 73 | uint rx_pipe, tx_pipe, rx_pipe2; |
79 | 74 | ||
80 | int rx_low_watermark; | 75 | int rx_low_watermark; |
81 | int tx_low_watermark; | 76 | int tx_low_watermark; |
@@ -87,7 +82,7 @@ struct brcmf_usbdev_info { | |||
87 | struct brcmf_usbreq *tx_reqs; | 82 | struct brcmf_usbreq *tx_reqs; |
88 | struct brcmf_usbreq *rx_reqs; | 83 | struct brcmf_usbreq *rx_reqs; |
89 | 84 | ||
90 | u8 *image; /* buffer for combine fw and nvram */ | 85 | const u8 *image; /* buffer for combine fw and nvram */ |
91 | int image_len; | 86 | int image_len; |
92 | 87 | ||
93 | struct usb_device *usbdev; | 88 | struct usb_device *usbdev; |
@@ -104,10 +99,6 @@ struct brcmf_usbdev_info { | |||
104 | ulong ctl_op; | 99 | ulong ctl_op; |
105 | 100 | ||
106 | struct urb *bulk_urb; /* used for FW download */ | 101 | struct urb *bulk_urb; /* used for FW download */ |
107 | struct urb *intr_urb; /* URB for interrupt endpoint */ | ||
108 | int intr_size; /* Size of interrupt message */ | ||
109 | int interval; /* Interrupt polling interval */ | ||
110 | struct intr_transfer_buf intr; /* Data buffer for interrupt endpoint */ | ||
111 | }; | 102 | }; |
112 | 103 | ||
113 | static void brcmf_usb_rx_refill(struct brcmf_usbdev_info *devinfo, | 104 | static void brcmf_usb_rx_refill(struct brcmf_usbdev_info *devinfo, |
@@ -531,39 +522,6 @@ brcmf_usb_state_change(struct brcmf_usbdev_info *devinfo, int state) | |||
531 | } | 522 | } |
532 | } | 523 | } |
533 | 524 | ||
534 | static void | ||
535 | brcmf_usb_intr_complete(struct urb *urb) | ||
536 | { | ||
537 | struct brcmf_usbdev_info *devinfo = | ||
538 | (struct brcmf_usbdev_info *)urb->context; | ||
539 | int err; | ||
540 | |||
541 | brcmf_dbg(USB, "Enter, urb->status=%d\n", urb->status); | ||
542 | |||
543 | if (devinfo == NULL) | ||
544 | return; | ||
545 | |||
546 | if (unlikely(urb->status)) { | ||
547 | if (urb->status == -ENOENT || | ||
548 | urb->status == -ESHUTDOWN || | ||
549 | urb->status == -ENODEV) { | ||
550 | brcmf_usb_state_change(devinfo, | ||
551 | BRCMFMAC_USB_STATE_DOWN); | ||
552 | } | ||
553 | } | ||
554 | |||
555 | if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_DOWN) { | ||
556 | brcmf_err("intr cb when DBUS down, ignoring\n"); | ||
557 | return; | ||
558 | } | ||
559 | |||
560 | if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) { | ||
561 | err = usb_submit_urb(devinfo->intr_urb, GFP_ATOMIC); | ||
562 | if (err) | ||
563 | brcmf_err("usb_submit_urb, err=%d\n", err); | ||
564 | } | ||
565 | } | ||
566 | |||
567 | static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb) | 525 | static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb) |
568 | { | 526 | { |
569 | struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); | 527 | struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); |
@@ -619,7 +577,6 @@ static int brcmf_usb_up(struct device *dev) | |||
619 | { | 577 | { |
620 | struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); | 578 | struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); |
621 | u16 ifnum; | 579 | u16 ifnum; |
622 | int ret; | ||
623 | 580 | ||
624 | brcmf_dbg(USB, "Enter\n"); | 581 | brcmf_dbg(USB, "Enter\n"); |
625 | if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) | 582 | if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) |
@@ -628,23 +585,6 @@ static int brcmf_usb_up(struct device *dev) | |||
628 | /* Success, indicate devinfo is fully up */ | 585 | /* Success, indicate devinfo is fully up */ |
629 | brcmf_usb_state_change(devinfo, BRCMFMAC_USB_STATE_UP); | 586 | brcmf_usb_state_change(devinfo, BRCMFMAC_USB_STATE_UP); |
630 | 587 | ||
631 | if (devinfo->intr_urb) { | ||
632 | usb_fill_int_urb(devinfo->intr_urb, devinfo->usbdev, | ||
633 | devinfo->intr_pipe, | ||
634 | &devinfo->intr, | ||
635 | devinfo->intr_size, | ||
636 | (usb_complete_t)brcmf_usb_intr_complete, | ||
637 | devinfo, | ||
638 | devinfo->interval); | ||
639 | |||
640 | ret = usb_submit_urb(devinfo->intr_urb, GFP_ATOMIC); | ||
641 | if (ret) { | ||
642 | brcmf_err("USB_SUBMIT_URB failed with status %d\n", | ||
643 | ret); | ||
644 | return -EINVAL; | ||
645 | } | ||
646 | } | ||
647 | |||
648 | if (devinfo->ctl_urb) { | 588 | if (devinfo->ctl_urb) { |
649 | devinfo->ctl_in_pipe = usb_rcvctrlpipe(devinfo->usbdev, 0); | 589 | devinfo->ctl_in_pipe = usb_rcvctrlpipe(devinfo->usbdev, 0); |
650 | devinfo->ctl_out_pipe = usb_sndctrlpipe(devinfo->usbdev, 0); | 590 | devinfo->ctl_out_pipe = usb_sndctrlpipe(devinfo->usbdev, 0); |
@@ -681,8 +621,6 @@ static void brcmf_usb_down(struct device *dev) | |||
681 | return; | 621 | return; |
682 | 622 | ||
683 | brcmf_usb_state_change(devinfo, BRCMFMAC_USB_STATE_DOWN); | 623 | brcmf_usb_state_change(devinfo, BRCMFMAC_USB_STATE_DOWN); |
684 | if (devinfo->intr_urb) | ||
685 | usb_kill_urb(devinfo->intr_urb); | ||
686 | 624 | ||
687 | if (devinfo->ctl_urb) | 625 | if (devinfo->ctl_urb) |
688 | usb_kill_urb(devinfo->ctl_urb); | 626 | usb_kill_urb(devinfo->ctl_urb); |
@@ -1021,7 +959,7 @@ brcmf_usb_fw_download(struct brcmf_usbdev_info *devinfo) | |||
1021 | } | 959 | } |
1022 | 960 | ||
1023 | err = brcmf_usb_dlstart(devinfo, | 961 | err = brcmf_usb_dlstart(devinfo, |
1024 | devinfo->image, devinfo->image_len); | 962 | (u8 *)devinfo->image, devinfo->image_len); |
1025 | if (err == 0) | 963 | if (err == 0) |
1026 | err = brcmf_usb_dlrun(devinfo); | 964 | err = brcmf_usb_dlrun(devinfo); |
1027 | return err; | 965 | return err; |
@@ -1036,7 +974,6 @@ static void brcmf_usb_detach(struct brcmf_usbdev_info *devinfo) | |||
1036 | brcmf_usb_free_q(&devinfo->rx_freeq, false); | 974 | brcmf_usb_free_q(&devinfo->rx_freeq, false); |
1037 | brcmf_usb_free_q(&devinfo->tx_freeq, false); | 975 | brcmf_usb_free_q(&devinfo->tx_freeq, false); |
1038 | 976 | ||
1039 | usb_free_urb(devinfo->intr_urb); | ||
1040 | usb_free_urb(devinfo->ctl_urb); | 977 | usb_free_urb(devinfo->ctl_urb); |
1041 | usb_free_urb(devinfo->bulk_urb); | 978 | usb_free_urb(devinfo->bulk_urb); |
1042 | 979 | ||
@@ -1080,68 +1017,20 @@ static int check_file(const u8 *headers) | |||
1080 | return -1; | 1017 | return -1; |
1081 | } | 1018 | } |
1082 | 1019 | ||
1083 | static int brcmf_usb_get_fw(struct brcmf_usbdev_info *devinfo) | 1020 | static const char *brcmf_usb_get_fwname(struct brcmf_usbdev_info *devinfo) |
1084 | { | 1021 | { |
1085 | s8 *fwname; | ||
1086 | const struct firmware *fw; | ||
1087 | struct brcmf_usb_image *fw_image; | ||
1088 | int err; | ||
1089 | |||
1090 | brcmf_dbg(USB, "Enter\n"); | ||
1091 | switch (devinfo->bus_pub.devid) { | 1022 | switch (devinfo->bus_pub.devid) { |
1092 | case 43143: | 1023 | case 43143: |
1093 | fwname = BRCMF_USB_43143_FW_NAME; | 1024 | return BRCMF_USB_43143_FW_NAME; |
1094 | break; | ||
1095 | case 43235: | 1025 | case 43235: |
1096 | case 43236: | 1026 | case 43236: |
1097 | case 43238: | 1027 | case 43238: |
1098 | fwname = BRCMF_USB_43236_FW_NAME; | 1028 | return BRCMF_USB_43236_FW_NAME; |
1099 | break; | ||
1100 | case 43242: | 1029 | case 43242: |
1101 | fwname = BRCMF_USB_43242_FW_NAME; | 1030 | return BRCMF_USB_43242_FW_NAME; |
1102 | break; | ||
1103 | default: | 1031 | default: |
1104 | return -EINVAL; | 1032 | return NULL; |
1105 | break; | ||
1106 | } | ||
1107 | brcmf_dbg(USB, "Loading FW %s\n", fwname); | ||
1108 | list_for_each_entry(fw_image, &fw_image_list, list) { | ||
1109 | if (fw_image->fwname == fwname) { | ||
1110 | devinfo->image = fw_image->image; | ||
1111 | devinfo->image_len = fw_image->image_len; | ||
1112 | return 0; | ||
1113 | } | ||
1114 | } | ||
1115 | /* fw image not yet loaded. Load it now and add to list */ | ||
1116 | err = request_firmware(&fw, fwname, devinfo->dev); | ||
1117 | if (!fw) { | ||
1118 | brcmf_err("fail to request firmware %s\n", fwname); | ||
1119 | return err; | ||
1120 | } | ||
1121 | if (check_file(fw->data) < 0) { | ||
1122 | brcmf_err("invalid firmware %s\n", fwname); | ||
1123 | return -EINVAL; | ||
1124 | } | 1033 | } |
1125 | |||
1126 | fw_image = kzalloc(sizeof(*fw_image), GFP_ATOMIC); | ||
1127 | if (!fw_image) | ||
1128 | return -ENOMEM; | ||
1129 | INIT_LIST_HEAD(&fw_image->list); | ||
1130 | list_add_tail(&fw_image->list, &fw_image_list); | ||
1131 | fw_image->fwname = fwname; | ||
1132 | fw_image->image = vmalloc(fw->size); | ||
1133 | if (!fw_image->image) | ||
1134 | return -ENOMEM; | ||
1135 | |||
1136 | memcpy(fw_image->image, fw->data, fw->size); | ||
1137 | fw_image->image_len = fw->size; | ||
1138 | |||
1139 | release_firmware(fw); | ||
1140 | |||
1141 | devinfo->image = fw_image->image; | ||
1142 | devinfo->image_len = fw_image->image_len; | ||
1143 | |||
1144 | return 0; | ||
1145 | } | 1034 | } |
1146 | 1035 | ||
1147 | 1036 | ||
@@ -1186,11 +1075,6 @@ struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo, | |||
1186 | goto error; | 1075 | goto error; |
1187 | devinfo->tx_freecount = ntxq; | 1076 | devinfo->tx_freecount = ntxq; |
1188 | 1077 | ||
1189 | devinfo->intr_urb = usb_alloc_urb(0, GFP_ATOMIC); | ||
1190 | if (!devinfo->intr_urb) { | ||
1191 | brcmf_err("usb_alloc_urb (intr) failed\n"); | ||
1192 | goto error; | ||
1193 | } | ||
1194 | devinfo->ctl_urb = usb_alloc_urb(0, GFP_ATOMIC); | 1078 | devinfo->ctl_urb = usb_alloc_urb(0, GFP_ATOMIC); |
1195 | if (!devinfo->ctl_urb) { | 1079 | if (!devinfo->ctl_urb) { |
1196 | brcmf_err("usb_alloc_urb (ctl) failed\n"); | 1080 | brcmf_err("usb_alloc_urb (ctl) failed\n"); |
@@ -1202,16 +1086,6 @@ struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo, | |||
1202 | goto error; | 1086 | goto error; |
1203 | } | 1087 | } |
1204 | 1088 | ||
1205 | if (!brcmf_usb_dlneeded(devinfo)) | ||
1206 | return &devinfo->bus_pub; | ||
1207 | |||
1208 | brcmf_dbg(USB, "Start fw downloading\n"); | ||
1209 | if (brcmf_usb_get_fw(devinfo)) | ||
1210 | goto error; | ||
1211 | |||
1212 | if (brcmf_usb_fw_download(devinfo)) | ||
1213 | goto error; | ||
1214 | |||
1215 | return &devinfo->bus_pub; | 1089 | return &devinfo->bus_pub; |
1216 | 1090 | ||
1217 | error: | 1091 | error: |
@@ -1222,18 +1096,77 @@ error: | |||
1222 | 1096 | ||
1223 | static struct brcmf_bus_ops brcmf_usb_bus_ops = { | 1097 | static struct brcmf_bus_ops brcmf_usb_bus_ops = { |
1224 | .txdata = brcmf_usb_tx, | 1098 | .txdata = brcmf_usb_tx, |
1225 | .init = brcmf_usb_up, | ||
1226 | .stop = brcmf_usb_down, | 1099 | .stop = brcmf_usb_down, |
1227 | .txctl = brcmf_usb_tx_ctlpkt, | 1100 | .txctl = brcmf_usb_tx_ctlpkt, |
1228 | .rxctl = brcmf_usb_rx_ctlpkt, | 1101 | .rxctl = brcmf_usb_rx_ctlpkt, |
1229 | }; | 1102 | }; |
1230 | 1103 | ||
1104 | static int brcmf_usb_bus_setup(struct brcmf_usbdev_info *devinfo) | ||
1105 | { | ||
1106 | int ret; | ||
1107 | |||
1108 | /* Attach to the common driver interface */ | ||
1109 | ret = brcmf_attach(devinfo->dev); | ||
1110 | if (ret) { | ||
1111 | brcmf_err("brcmf_attach failed\n"); | ||
1112 | return ret; | ||
1113 | } | ||
1114 | |||
1115 | ret = brcmf_usb_up(devinfo->dev); | ||
1116 | if (ret) | ||
1117 | goto fail; | ||
1118 | |||
1119 | ret = brcmf_bus_start(devinfo->dev); | ||
1120 | if (ret) | ||
1121 | goto fail; | ||
1122 | |||
1123 | return 0; | ||
1124 | fail: | ||
1125 | brcmf_detach(devinfo->dev); | ||
1126 | return ret; | ||
1127 | } | ||
1128 | |||
1129 | static void brcmf_usb_probe_phase2(struct device *dev, | ||
1130 | const struct firmware *fw, | ||
1131 | void *nvram, u32 nvlen) | ||
1132 | { | ||
1133 | struct brcmf_bus *bus = dev_get_drvdata(dev); | ||
1134 | struct brcmf_usbdev_info *devinfo; | ||
1135 | int ret; | ||
1136 | |||
1137 | brcmf_dbg(USB, "Start fw downloading\n"); | ||
1138 | ret = check_file(fw->data); | ||
1139 | if (ret < 0) { | ||
1140 | brcmf_err("invalid firmware\n"); | ||
1141 | release_firmware(fw); | ||
1142 | goto error; | ||
1143 | } | ||
1144 | |||
1145 | devinfo = bus->bus_priv.usb->devinfo; | ||
1146 | devinfo->image = fw->data; | ||
1147 | devinfo->image_len = fw->size; | ||
1148 | |||
1149 | ret = brcmf_usb_fw_download(devinfo); | ||
1150 | release_firmware(fw); | ||
1151 | if (ret) | ||
1152 | goto error; | ||
1153 | |||
1154 | ret = brcmf_usb_bus_setup(devinfo); | ||
1155 | if (ret) | ||
1156 | goto error; | ||
1157 | |||
1158 | return; | ||
1159 | error: | ||
1160 | brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), ret); | ||
1161 | device_release_driver(dev); | ||
1162 | } | ||
1163 | |||
1231 | static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) | 1164 | static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) |
1232 | { | 1165 | { |
1233 | struct brcmf_bus *bus = NULL; | 1166 | struct brcmf_bus *bus = NULL; |
1234 | struct brcmf_usbdev *bus_pub = NULL; | 1167 | struct brcmf_usbdev *bus_pub = NULL; |
1235 | int ret; | ||
1236 | struct device *dev = devinfo->dev; | 1168 | struct device *dev = devinfo->dev; |
1169 | int ret; | ||
1237 | 1170 | ||
1238 | brcmf_dbg(USB, "Enter\n"); | 1171 | brcmf_dbg(USB, "Enter\n"); |
1239 | bus_pub = brcmf_usb_attach(devinfo, BRCMF_USB_NRXQ, BRCMF_USB_NTXQ); | 1172 | bus_pub = brcmf_usb_attach(devinfo, BRCMF_USB_NRXQ, BRCMF_USB_NTXQ); |
@@ -1254,22 +1187,18 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) | |||
1254 | bus->chip = bus_pub->devid; | 1187 | bus->chip = bus_pub->devid; |
1255 | bus->chiprev = bus_pub->chiprev; | 1188 | bus->chiprev = bus_pub->chiprev; |
1256 | bus->proto_type = BRCMF_PROTO_BCDC; | 1189 | bus->proto_type = BRCMF_PROTO_BCDC; |
1190 | bus->always_use_fws_queue = true; | ||
1257 | 1191 | ||
1258 | /* Attach to the common driver interface */ | 1192 | if (!brcmf_usb_dlneeded(devinfo)) { |
1259 | ret = brcmf_attach(dev); | 1193 | ret = brcmf_usb_bus_setup(devinfo); |
1260 | if (ret) { | 1194 | if (ret) |
1261 | brcmf_err("brcmf_attach failed\n"); | 1195 | goto fail; |
1262 | goto fail; | ||
1263 | } | ||
1264 | |||
1265 | ret = brcmf_bus_start(dev); | ||
1266 | if (ret) { | ||
1267 | brcmf_err("dongle is not responding\n"); | ||
1268 | brcmf_detach(dev); | ||
1269 | goto fail; | ||
1270 | } | 1196 | } |
1271 | 1197 | /* request firmware here */ | |
1198 | brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo), NULL, | ||
1199 | brcmf_usb_probe_phase2); | ||
1272 | return 0; | 1200 | return 0; |
1201 | |||
1273 | fail: | 1202 | fail: |
1274 | /* Release resources in reverse order */ | 1203 | /* Release resources in reverse order */ |
1275 | kfree(bus); | 1204 | kfree(bus); |
@@ -1357,9 +1286,6 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1357 | goto fail; | 1286 | goto fail; |
1358 | } | 1287 | } |
1359 | 1288 | ||
1360 | endpoint_num = endpoint->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | ||
1361 | devinfo->intr_pipe = usb_rcvintpipe(usb, endpoint_num); | ||
1362 | |||
1363 | devinfo->rx_pipe = 0; | 1289 | devinfo->rx_pipe = 0; |
1364 | devinfo->rx_pipe2 = 0; | 1290 | devinfo->rx_pipe2 = 0; |
1365 | devinfo->tx_pipe = 0; | 1291 | devinfo->tx_pipe = 0; |
@@ -1391,16 +1317,9 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1391 | } | 1317 | } |
1392 | } | 1318 | } |
1393 | 1319 | ||
1394 | /* Allocate interrupt URB and data buffer */ | 1320 | if (usb->speed == USB_SPEED_SUPER) |
1395 | /* RNDIS says 8-byte intr, our old drivers used 4-byte */ | 1321 | brcmf_dbg(USB, "Broadcom super speed USB wireless device detected\n"); |
1396 | if (IFEPDESC(usb, CONTROL_IF, 0).wMaxPacketSize == cpu_to_le16(16)) | 1322 | else if (usb->speed == USB_SPEED_HIGH) |
1397 | devinfo->intr_size = 8; | ||
1398 | else | ||
1399 | devinfo->intr_size = 4; | ||
1400 | |||
1401 | devinfo->interval = IFEPDESC(usb, CONTROL_IF, 0).bInterval; | ||
1402 | |||
1403 | if (usb->speed == USB_SPEED_HIGH) | ||
1404 | brcmf_dbg(USB, "Broadcom high speed USB wireless device detected\n"); | 1323 | brcmf_dbg(USB, "Broadcom high speed USB wireless device detected\n"); |
1405 | else | 1324 | else |
1406 | brcmf_dbg(USB, "Broadcom full speed USB wireless device detected\n"); | 1325 | brcmf_dbg(USB, "Broadcom full speed USB wireless device detected\n"); |
@@ -1455,23 +1374,18 @@ static int brcmf_usb_resume(struct usb_interface *intf) | |||
1455 | struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(&usb->dev); | 1374 | struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(&usb->dev); |
1456 | 1375 | ||
1457 | brcmf_dbg(USB, "Enter\n"); | 1376 | brcmf_dbg(USB, "Enter\n"); |
1458 | if (!brcmf_attach(devinfo->dev)) | 1377 | return brcmf_usb_bus_setup(devinfo); |
1459 | return brcmf_bus_start(&usb->dev); | ||
1460 | |||
1461 | return 0; | ||
1462 | } | 1378 | } |
1463 | 1379 | ||
1464 | static int brcmf_usb_reset_resume(struct usb_interface *intf) | 1380 | static int brcmf_usb_reset_resume(struct usb_interface *intf) |
1465 | { | 1381 | { |
1466 | struct usb_device *usb = interface_to_usbdev(intf); | 1382 | struct usb_device *usb = interface_to_usbdev(intf); |
1467 | struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(&usb->dev); | 1383 | struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(&usb->dev); |
1468 | |||
1469 | brcmf_dbg(USB, "Enter\n"); | 1384 | brcmf_dbg(USB, "Enter\n"); |
1470 | 1385 | ||
1471 | if (!brcmf_usb_fw_download(devinfo)) | 1386 | return brcmf_fw_get_firmwares(&usb->dev, 0, |
1472 | return brcmf_usb_resume(intf); | 1387 | brcmf_usb_get_fwname(devinfo), NULL, |
1473 | 1388 | brcmf_usb_probe_phase2); | |
1474 | return -EIO; | ||
1475 | } | 1389 | } |
1476 | 1390 | ||
1477 | #define BRCMF_USB_VENDOR_ID_BROADCOM 0x0a5c | 1391 | #define BRCMF_USB_VENDOR_ID_BROADCOM 0x0a5c |
@@ -1506,16 +1420,6 @@ static struct usb_driver brcmf_usbdrvr = { | |||
1506 | .disable_hub_initiated_lpm = 1, | 1420 | .disable_hub_initiated_lpm = 1, |
1507 | }; | 1421 | }; |
1508 | 1422 | ||
1509 | static void brcmf_release_fw(struct list_head *q) | ||
1510 | { | ||
1511 | struct brcmf_usb_image *fw_image, *next; | ||
1512 | |||
1513 | list_for_each_entry_safe(fw_image, next, q, list) { | ||
1514 | vfree(fw_image->image); | ||
1515 | list_del_init(&fw_image->list); | ||
1516 | } | ||
1517 | } | ||
1518 | |||
1519 | static int brcmf_usb_reset_device(struct device *dev, void *notused) | 1423 | static int brcmf_usb_reset_device(struct device *dev, void *notused) |
1520 | { | 1424 | { |
1521 | /* device past is the usb interface so we | 1425 | /* device past is the usb interface so we |
@@ -1534,12 +1438,10 @@ void brcmf_usb_exit(void) | |||
1534 | ret = driver_for_each_device(drv, NULL, NULL, | 1438 | ret = driver_for_each_device(drv, NULL, NULL, |
1535 | brcmf_usb_reset_device); | 1439 | brcmf_usb_reset_device); |
1536 | usb_deregister(&brcmf_usbdrvr); | 1440 | usb_deregister(&brcmf_usbdrvr); |
1537 | brcmf_release_fw(&fw_image_list); | ||
1538 | } | 1441 | } |
1539 | 1442 | ||
1540 | void brcmf_usb_register(void) | 1443 | void brcmf_usb_register(void) |
1541 | { | 1444 | { |
1542 | brcmf_dbg(USB, "Enter\n"); | 1445 | brcmf_dbg(USB, "Enter\n"); |
1543 | INIT_LIST_HEAD(&fw_image_list); | ||
1544 | usb_register(&brcmf_usbdrvr); | 1446 | usb_register(&brcmf_usbdrvr); |
1545 | } | 1447 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index be1985296bdc..d8fa276e368b 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -221,9 +221,9 @@ static const struct ieee80211_regdomain brcmf_regdom = { | |||
221 | */ | 221 | */ |
222 | REG_RULE(2484-10, 2484+10, 20, 6, 20, 0), | 222 | REG_RULE(2484-10, 2484+10, 20, 6, 20, 0), |
223 | /* IEEE 802.11a, channel 36..64 */ | 223 | /* IEEE 802.11a, channel 36..64 */ |
224 | REG_RULE(5150-10, 5350+10, 40, 6, 20, 0), | 224 | REG_RULE(5150-10, 5350+10, 80, 6, 20, 0), |
225 | /* IEEE 802.11a, channel 100..165 */ | 225 | /* IEEE 802.11a, channel 100..165 */ |
226 | REG_RULE(5470-10, 5850+10, 40, 6, 20, 0), } | 226 | REG_RULE(5470-10, 5850+10, 80, 6, 20, 0), } |
227 | }; | 227 | }; |
228 | 228 | ||
229 | static const u32 __wl_cipher_suites[] = { | 229 | static const u32 __wl_cipher_suites[] = { |
@@ -341,6 +341,60 @@ static u8 brcmf_mw_to_qdbm(u16 mw) | |||
341 | return qdbm; | 341 | return qdbm; |
342 | } | 342 | } |
343 | 343 | ||
344 | static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, | ||
345 | struct cfg80211_chan_def *ch) | ||
346 | { | ||
347 | struct brcmu_chan ch_inf; | ||
348 | s32 primary_offset; | ||
349 | |||
350 | brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n", | ||
351 | ch->chan->center_freq, ch->center_freq1, ch->width); | ||
352 | ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1); | ||
353 | primary_offset = ch->center_freq1 - ch->chan->center_freq; | ||
354 | switch (ch->width) { | ||
355 | case NL80211_CHAN_WIDTH_20: | ||
356 | ch_inf.bw = BRCMU_CHAN_BW_20; | ||
357 | WARN_ON(primary_offset != 0); | ||
358 | break; | ||
359 | case NL80211_CHAN_WIDTH_40: | ||
360 | ch_inf.bw = BRCMU_CHAN_BW_40; | ||
361 | if (primary_offset < 0) | ||
362 | ch_inf.sb = BRCMU_CHAN_SB_U; | ||
363 | else | ||
364 | ch_inf.sb = BRCMU_CHAN_SB_L; | ||
365 | break; | ||
366 | case NL80211_CHAN_WIDTH_80: | ||
367 | ch_inf.bw = BRCMU_CHAN_BW_80; | ||
368 | if (primary_offset < 0) { | ||
369 | if (primary_offset < -CH_10MHZ_APART) | ||
370 | ch_inf.sb = BRCMU_CHAN_SB_UU; | ||
371 | else | ||
372 | ch_inf.sb = BRCMU_CHAN_SB_UL; | ||
373 | } else { | ||
374 | if (primary_offset > CH_10MHZ_APART) | ||
375 | ch_inf.sb = BRCMU_CHAN_SB_LL; | ||
376 | else | ||
377 | ch_inf.sb = BRCMU_CHAN_SB_LU; | ||
378 | } | ||
379 | break; | ||
380 | default: | ||
381 | WARN_ON_ONCE(1); | ||
382 | } | ||
383 | switch (ch->chan->band) { | ||
384 | case IEEE80211_BAND_2GHZ: | ||
385 | ch_inf.band = BRCMU_CHAN_BAND_2G; | ||
386 | break; | ||
387 | case IEEE80211_BAND_5GHZ: | ||
388 | ch_inf.band = BRCMU_CHAN_BAND_5G; | ||
389 | break; | ||
390 | default: | ||
391 | WARN_ON_ONCE(1); | ||
392 | } | ||
393 | d11inf->encchspec(&ch_inf); | ||
394 | |||
395 | return ch_inf.chspec; | ||
396 | } | ||
397 | |||
344 | u16 channel_to_chanspec(struct brcmu_d11inf *d11inf, | 398 | u16 channel_to_chanspec(struct brcmu_d11inf *d11inf, |
345 | struct ieee80211_channel *ch) | 399 | struct ieee80211_channel *ch) |
346 | { | 400 | { |
@@ -586,6 +640,9 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, | |||
586 | if (err) | 640 | if (err) |
587 | brcmf_err("Scan abort failed\n"); | 641 | brcmf_err("Scan abort failed\n"); |
588 | } | 642 | } |
643 | |||
644 | brcmf_set_mpc(ifp, 1); | ||
645 | |||
589 | /* | 646 | /* |
590 | * e-scan can be initiated by scheduled scan | 647 | * e-scan can be initiated by scheduled scan |
591 | * which takes precedence. | 648 | * which takes precedence. |
@@ -595,12 +652,10 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, | |||
595 | cfg->sched_escan = false; | 652 | cfg->sched_escan = false; |
596 | if (!aborted) | 653 | if (!aborted) |
597 | cfg80211_sched_scan_results(cfg_to_wiphy(cfg)); | 654 | cfg80211_sched_scan_results(cfg_to_wiphy(cfg)); |
598 | brcmf_set_mpc(ifp, 1); | ||
599 | } else if (scan_request) { | 655 | } else if (scan_request) { |
600 | brcmf_dbg(SCAN, "ESCAN Completed scan: %s\n", | 656 | brcmf_dbg(SCAN, "ESCAN Completed scan: %s\n", |
601 | aborted ? "Aborted" : "Done"); | 657 | aborted ? "Aborted" : "Done"); |
602 | cfg80211_scan_done(scan_request, aborted); | 658 | cfg80211_scan_done(scan_request, aborted); |
603 | brcmf_set_mpc(ifp, 1); | ||
604 | } | 659 | } |
605 | if (!test_and_clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) | 660 | if (!test_and_clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) |
606 | brcmf_dbg(SCAN, "Scan complete, probably P2P scan\n"); | 661 | brcmf_dbg(SCAN, "Scan complete, probably P2P scan\n"); |
@@ -1236,8 +1291,8 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, | |||
1236 | params->chandef.chan->center_freq); | 1291 | params->chandef.chan->center_freq); |
1237 | if (params->channel_fixed) { | 1292 | if (params->channel_fixed) { |
1238 | /* adding chanspec */ | 1293 | /* adding chanspec */ |
1239 | chanspec = channel_to_chanspec(&cfg->d11inf, | 1294 | chanspec = chandef_to_chanspec(&cfg->d11inf, |
1240 | params->chandef.chan); | 1295 | ¶ms->chandef); |
1241 | join_params.params_le.chanspec_list[0] = | 1296 | join_params.params_le.chanspec_list[0] = |
1242 | cpu_to_le16(chanspec); | 1297 | cpu_to_le16(chanspec); |
1243 | join_params.params_le.chanspec_num = cpu_to_le32(1); | 1298 | join_params.params_le.chanspec_num = cpu_to_le32(1); |
@@ -2182,7 +2237,7 @@ brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, | |||
2182 | 2237 | ||
2183 | static s32 | 2238 | static s32 |
2184 | brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, | 2239 | brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, |
2185 | u8 *mac, struct station_info *sinfo) | 2240 | const u8 *mac, struct station_info *sinfo) |
2186 | { | 2241 | { |
2187 | struct brcmf_if *ifp = netdev_priv(ndev); | 2242 | struct brcmf_if *ifp = netdev_priv(ndev); |
2188 | struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; | 2243 | struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; |
@@ -3124,7 +3179,7 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy, | |||
3124 | } | 3179 | } |
3125 | 3180 | ||
3126 | if (!request->n_ssids || !request->n_match_sets) { | 3181 | if (!request->n_ssids || !request->n_match_sets) { |
3127 | brcmf_err("Invalid sched scan req!! n_ssids:%d\n", | 3182 | brcmf_dbg(SCAN, "Invalid sched scan req!! n_ssids:%d\n", |
3128 | request->n_ssids); | 3183 | request->n_ssids); |
3129 | return -EINVAL; | 3184 | return -EINVAL; |
3130 | } | 3185 | } |
@@ -3734,23 +3789,6 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif, | |||
3734 | } | 3789 | } |
3735 | 3790 | ||
3736 | static s32 | 3791 | static s32 |
3737 | brcmf_cfg80211_set_channel(struct brcmf_cfg80211_info *cfg, | ||
3738 | struct brcmf_if *ifp, | ||
3739 | struct ieee80211_channel *channel) | ||
3740 | { | ||
3741 | u16 chanspec; | ||
3742 | s32 err; | ||
3743 | |||
3744 | brcmf_dbg(TRACE, "band=%d, center_freq=%d\n", channel->band, | ||
3745 | channel->center_freq); | ||
3746 | |||
3747 | chanspec = channel_to_chanspec(&cfg->d11inf, channel); | ||
3748 | err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); | ||
3749 | |||
3750 | return err; | ||
3751 | } | ||
3752 | |||
3753 | static s32 | ||
3754 | brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | 3792 | brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, |
3755 | struct cfg80211_ap_settings *settings) | 3793 | struct cfg80211_ap_settings *settings) |
3756 | { | 3794 | { |
@@ -3765,11 +3803,12 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | |||
3765 | struct brcmf_join_params join_params; | 3803 | struct brcmf_join_params join_params; |
3766 | enum nl80211_iftype dev_role; | 3804 | enum nl80211_iftype dev_role; |
3767 | struct brcmf_fil_bss_enable_le bss_enable; | 3805 | struct brcmf_fil_bss_enable_le bss_enable; |
3806 | u16 chanspec; | ||
3768 | 3807 | ||
3769 | brcmf_dbg(TRACE, "channel_type=%d, beacon_interval=%d, dtim_period=%d,\n", | 3808 | brcmf_dbg(TRACE, "ctrlchn=%d, center=%d, bw=%d, beacon_interval=%d, dtim_period=%d,\n", |
3770 | cfg80211_get_chandef_type(&settings->chandef), | 3809 | settings->chandef.chan->hw_value, |
3771 | settings->beacon_interval, | 3810 | settings->chandef.center_freq1, settings->chandef.width, |
3772 | settings->dtim_period); | 3811 | settings->beacon_interval, settings->dtim_period); |
3773 | brcmf_dbg(TRACE, "ssid=%s(%zu), auth_type=%d, inactivity_timeout=%d\n", | 3812 | brcmf_dbg(TRACE, "ssid=%s(%zu), auth_type=%d, inactivity_timeout=%d\n", |
3774 | settings->ssid, settings->ssid_len, settings->auth_type, | 3813 | settings->ssid, settings->ssid_len, settings->auth_type, |
3775 | settings->inactivity_timeout); | 3814 | settings->inactivity_timeout); |
@@ -3826,9 +3865,10 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | |||
3826 | 3865 | ||
3827 | brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); | 3866 | brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); |
3828 | 3867 | ||
3829 | err = brcmf_cfg80211_set_channel(cfg, ifp, settings->chandef.chan); | 3868 | chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef); |
3869 | err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); | ||
3830 | if (err < 0) { | 3870 | if (err < 0) { |
3831 | brcmf_err("Set Channel failed, %d\n", err); | 3871 | brcmf_err("Set Channel failed: chspec=%d, %d\n", chanspec, err); |
3832 | goto exit; | 3872 | goto exit; |
3833 | } | 3873 | } |
3834 | 3874 | ||
@@ -3975,7 +4015,7 @@ brcmf_cfg80211_change_beacon(struct wiphy *wiphy, struct net_device *ndev, | |||
3975 | 4015 | ||
3976 | static int | 4016 | static int |
3977 | brcmf_cfg80211_del_station(struct wiphy *wiphy, struct net_device *ndev, | 4017 | brcmf_cfg80211_del_station(struct wiphy *wiphy, struct net_device *ndev, |
3978 | u8 *mac) | 4018 | const u8 *mac) |
3979 | { | 4019 | { |
3980 | struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); | 4020 | struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); |
3981 | struct brcmf_scb_val_le scbval; | 4021 | struct brcmf_scb_val_le scbval; |
@@ -4203,7 +4243,7 @@ static int brcmf_convert_nl80211_tdls_oper(enum nl80211_tdls_operation oper) | |||
4203 | } | 4243 | } |
4204 | 4244 | ||
4205 | static int brcmf_cfg80211_tdls_oper(struct wiphy *wiphy, | 4245 | static int brcmf_cfg80211_tdls_oper(struct wiphy *wiphy, |
4206 | struct net_device *ndev, u8 *peer, | 4246 | struct net_device *ndev, const u8 *peer, |
4207 | enum nl80211_tdls_operation oper) | 4247 | enum nl80211_tdls_operation oper) |
4208 | { | 4248 | { |
4209 | struct brcmf_if *ifp; | 4249 | struct brcmf_if *ifp; |
@@ -4364,6 +4404,8 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev) | |||
4364 | WIPHY_FLAG_OFFCHAN_TX | | 4404 | WIPHY_FLAG_OFFCHAN_TX | |
4365 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | | 4405 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | |
4366 | WIPHY_FLAG_SUPPORTS_TDLS; | 4406 | WIPHY_FLAG_SUPPORTS_TDLS; |
4407 | if (!brcmf_roamoff) | ||
4408 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; | ||
4367 | wiphy->mgmt_stypes = brcmf_txrx_stypes; | 4409 | wiphy->mgmt_stypes = brcmf_txrx_stypes; |
4368 | wiphy->max_remain_on_channel_duration = 5000; | 4410 | wiphy->max_remain_on_channel_duration = 5000; |
4369 | brcmf_wiphy_pno_params(wiphy); | 4411 | brcmf_wiphy_pno_params(wiphy); |
@@ -4685,7 +4727,6 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, | |||
4685 | struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; | 4727 | struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; |
4686 | struct ieee80211_channel *chan; | 4728 | struct ieee80211_channel *chan; |
4687 | s32 err = 0; | 4729 | s32 err = 0; |
4688 | u16 reason; | ||
4689 | 4730 | ||
4690 | if (brcmf_is_apmode(ifp->vif)) { | 4731 | if (brcmf_is_apmode(ifp->vif)) { |
4691 | err = brcmf_notify_connect_status_ap(cfg, ndev, e, data); | 4732 | err = brcmf_notify_connect_status_ap(cfg, ndev, e, data); |
@@ -4706,16 +4747,6 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, | |||
4706 | brcmf_dbg(CONN, "Linkdown\n"); | 4747 | brcmf_dbg(CONN, "Linkdown\n"); |
4707 | if (!brcmf_is_ibssmode(ifp->vif)) { | 4748 | if (!brcmf_is_ibssmode(ifp->vif)) { |
4708 | brcmf_bss_connect_done(cfg, ndev, e, false); | 4749 | brcmf_bss_connect_done(cfg, ndev, e, false); |
4709 | if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, | ||
4710 | &ifp->vif->sme_state)) { | ||
4711 | reason = 0; | ||
4712 | if (((e->event_code == BRCMF_E_DEAUTH_IND) || | ||
4713 | (e->event_code == BRCMF_E_DISASSOC_IND)) && | ||
4714 | (e->reason != WLAN_REASON_UNSPECIFIED)) | ||
4715 | reason = e->reason; | ||
4716 | cfg80211_disconnected(ndev, reason, NULL, 0, | ||
4717 | GFP_KERNEL); | ||
4718 | } | ||
4719 | } | 4750 | } |
4720 | brcmf_link_down(ifp->vif); | 4751 | brcmf_link_down(ifp->vif); |
4721 | brcmf_init_prof(ndev_to_prof(ndev)); | 4752 | brcmf_init_prof(ndev_to_prof(ndev)); |
@@ -5215,6 +5246,9 @@ static s32 brcmf_construct_reginfo(struct brcmf_cfg80211_info *cfg, | |||
5215 | if (!(bw_cap[band] & WLC_BW_40MHZ_BIT) && | 5246 | if (!(bw_cap[band] & WLC_BW_40MHZ_BIT) && |
5216 | ch.bw == BRCMU_CHAN_BW_40) | 5247 | ch.bw == BRCMU_CHAN_BW_40) |
5217 | continue; | 5248 | continue; |
5249 | if (!(bw_cap[band] & WLC_BW_80MHZ_BIT) && | ||
5250 | ch.bw == BRCMU_CHAN_BW_80) | ||
5251 | continue; | ||
5218 | update = false; | 5252 | update = false; |
5219 | for (j = 0; (j < *n_cnt && (*n_cnt < array_size)); j++) { | 5253 | for (j = 0; (j < *n_cnt && (*n_cnt < array_size)); j++) { |
5220 | if (band_chan_arr[j].hw_value == ch.chnum) { | 5254 | if (band_chan_arr[j].hw_value == ch.chnum) { |
@@ -5231,10 +5265,13 @@ static s32 brcmf_construct_reginfo(struct brcmf_cfg80211_info *cfg, | |||
5231 | ieee80211_channel_to_frequency(ch.chnum, band); | 5265 | ieee80211_channel_to_frequency(ch.chnum, band); |
5232 | band_chan_arr[index].hw_value = ch.chnum; | 5266 | band_chan_arr[index].hw_value = ch.chnum; |
5233 | 5267 | ||
5234 | if (ch.bw == BRCMU_CHAN_BW_40) { | 5268 | /* assuming the chanspecs order is HT20, |
5235 | /* assuming the order is HT20, HT40 Upper, | 5269 | * HT40 upper, HT40 lower, and VHT80. |
5236 | * HT40 lower from chanspecs | 5270 | */ |
5237 | */ | 5271 | if (ch.bw == BRCMU_CHAN_BW_80) { |
5272 | band_chan_arr[index].flags &= | ||
5273 | ~IEEE80211_CHAN_NO_80MHZ; | ||
5274 | } else if (ch.bw == BRCMU_CHAN_BW_40) { | ||
5238 | ht40_flag = band_chan_arr[index].flags & | 5275 | ht40_flag = band_chan_arr[index].flags & |
5239 | IEEE80211_CHAN_NO_HT40; | 5276 | IEEE80211_CHAN_NO_HT40; |
5240 | if (ch.sb == BRCMU_CHAN_SB_U) { | 5277 | if (ch.sb == BRCMU_CHAN_SB_U) { |
@@ -5255,8 +5292,13 @@ static s32 brcmf_construct_reginfo(struct brcmf_cfg80211_info *cfg, | |||
5255 | IEEE80211_CHAN_NO_HT40MINUS; | 5292 | IEEE80211_CHAN_NO_HT40MINUS; |
5256 | } | 5293 | } |
5257 | } else { | 5294 | } else { |
5295 | /* disable other bandwidths for now as mentioned | ||
5296 | * order assure they are enabled for subsequent | ||
5297 | * chanspecs. | ||
5298 | */ | ||
5258 | band_chan_arr[index].flags = | 5299 | band_chan_arr[index].flags = |
5259 | IEEE80211_CHAN_NO_HT40; | 5300 | IEEE80211_CHAN_NO_HT40 | |
5301 | IEEE80211_CHAN_NO_80MHZ; | ||
5260 | ch.bw = BRCMU_CHAN_BW_20; | 5302 | ch.bw = BRCMU_CHAN_BW_20; |
5261 | cfg->d11inf.encchspec(&ch); | 5303 | cfg->d11inf.encchspec(&ch); |
5262 | channel = ch.chspec; | 5304 | channel = ch.chspec; |
@@ -5323,13 +5365,63 @@ static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[]) | |||
5323 | } | 5365 | } |
5324 | } | 5366 | } |
5325 | 5367 | ||
5368 | static void brcmf_update_ht_cap(struct ieee80211_supported_band *band, | ||
5369 | u32 bw_cap[2], u32 nchain) | ||
5370 | { | ||
5371 | band->ht_cap.ht_supported = true; | ||
5372 | if (bw_cap[band->band] & WLC_BW_40MHZ_BIT) { | ||
5373 | band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40; | ||
5374 | band->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; | ||
5375 | } | ||
5376 | band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20; | ||
5377 | band->ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40; | ||
5378 | band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; | ||
5379 | band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16; | ||
5380 | memset(band->ht_cap.mcs.rx_mask, 0xff, nchain); | ||
5381 | band->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; | ||
5382 | } | ||
5383 | |||
5384 | static __le16 brcmf_get_mcs_map(u32 nchain, enum ieee80211_vht_mcs_support supp) | ||
5385 | { | ||
5386 | u16 mcs_map; | ||
5387 | int i; | ||
5388 | |||
5389 | for (i = 0, mcs_map = 0xFFFF; i < nchain; i++) | ||
5390 | mcs_map = (mcs_map << 2) | supp; | ||
5391 | |||
5392 | return cpu_to_le16(mcs_map); | ||
5393 | } | ||
5394 | |||
5395 | static void brcmf_update_vht_cap(struct ieee80211_supported_band *band, | ||
5396 | u32 bw_cap[2], u32 nchain) | ||
5397 | { | ||
5398 | __le16 mcs_map; | ||
5399 | |||
5400 | /* not allowed in 2.4G band */ | ||
5401 | if (band->band == IEEE80211_BAND_2GHZ) | ||
5402 | return; | ||
5403 | |||
5404 | band->vht_cap.vht_supported = true; | ||
5405 | /* 80MHz is mandatory */ | ||
5406 | band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_80; | ||
5407 | if (bw_cap[band->band] & WLC_BW_160MHZ_BIT) { | ||
5408 | band->vht_cap.cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; | ||
5409 | band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_160; | ||
5410 | } | ||
5411 | /* all support 256-QAM */ | ||
5412 | mcs_map = brcmf_get_mcs_map(nchain, IEEE80211_VHT_MCS_SUPPORT_0_9); | ||
5413 | band->vht_cap.vht_mcs.rx_mcs_map = mcs_map; | ||
5414 | band->vht_cap.vht_mcs.tx_mcs_map = mcs_map; | ||
5415 | } | ||
5416 | |||
5326 | static s32 brcmf_update_wiphybands(struct brcmf_cfg80211_info *cfg) | 5417 | static s32 brcmf_update_wiphybands(struct brcmf_cfg80211_info *cfg) |
5327 | { | 5418 | { |
5328 | struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); | 5419 | struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); |
5329 | struct wiphy *wiphy; | 5420 | struct wiphy *wiphy; |
5330 | s32 phy_list; | 5421 | s32 phy_list; |
5331 | u32 band_list[3]; | 5422 | u32 band_list[3]; |
5332 | u32 nmode; | 5423 | u32 nmode = 0; |
5424 | u32 vhtmode = 0; | ||
5333 | u32 bw_cap[2] = { 0, 0 }; | 5425 | u32 bw_cap[2] = { 0, 0 }; |
5334 | u32 rxchain; | 5426 | u32 rxchain; |
5335 | u32 nchain; | 5427 | u32 nchain; |
@@ -5360,14 +5452,16 @@ static s32 brcmf_update_wiphybands(struct brcmf_cfg80211_info *cfg) | |||
5360 | brcmf_dbg(INFO, "BRCMF_C_GET_BANDLIST reported: 0x%08x 0x%08x 0x%08x phy\n", | 5452 | brcmf_dbg(INFO, "BRCMF_C_GET_BANDLIST reported: 0x%08x 0x%08x 0x%08x phy\n", |
5361 | band_list[0], band_list[1], band_list[2]); | 5453 | band_list[0], band_list[1], band_list[2]); |
5362 | 5454 | ||
5455 | (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode); | ||
5363 | err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode); | 5456 | err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode); |
5364 | if (err) { | 5457 | if (err) { |
5365 | brcmf_err("nmode error (%d)\n", err); | 5458 | brcmf_err("nmode error (%d)\n", err); |
5366 | } else { | 5459 | } else { |
5367 | brcmf_get_bwcap(ifp, bw_cap); | 5460 | brcmf_get_bwcap(ifp, bw_cap); |
5368 | } | 5461 | } |
5369 | brcmf_dbg(INFO, "nmode=%d, bw_cap=(%d, %d)\n", nmode, | 5462 | brcmf_dbg(INFO, "nmode=%d, vhtmode=%d, bw_cap=(%d, %d)\n", |
5370 | bw_cap[IEEE80211_BAND_2GHZ], bw_cap[IEEE80211_BAND_5GHZ]); | 5463 | nmode, vhtmode, bw_cap[IEEE80211_BAND_2GHZ], |
5464 | bw_cap[IEEE80211_BAND_5GHZ]); | ||
5371 | 5465 | ||
5372 | err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain); | 5466 | err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain); |
5373 | if (err) { | 5467 | if (err) { |
@@ -5398,17 +5492,10 @@ static s32 brcmf_update_wiphybands(struct brcmf_cfg80211_info *cfg) | |||
5398 | else | 5492 | else |
5399 | continue; | 5493 | continue; |
5400 | 5494 | ||
5401 | if (bw_cap[band->band] & WLC_BW_40MHZ_BIT) { | 5495 | if (nmode) |
5402 | band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40; | 5496 | brcmf_update_ht_cap(band, bw_cap, nchain); |
5403 | band->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; | 5497 | if (vhtmode) |
5404 | } | 5498 | brcmf_update_vht_cap(band, bw_cap, nchain); |
5405 | band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20; | ||
5406 | band->ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40; | ||
5407 | band->ht_cap.ht_supported = true; | ||
5408 | band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; | ||
5409 | band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16; | ||
5410 | memset(band->ht_cap.mcs.rx_mask, 0xff, nchain); | ||
5411 | band->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; | ||
5412 | bands[band->band] = band; | 5499 | bands[band->band] = band; |
5413 | } | 5500 | } |
5414 | 5501 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c index 8c5fa4e58139..43c71bfaa474 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | |||
@@ -897,7 +897,8 @@ static bool brcms_tx_flush_completed(struct brcms_info *wl) | |||
897 | return result; | 897 | return result; |
898 | } | 898 | } |
899 | 899 | ||
900 | static void brcms_ops_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 900 | static void brcms_ops_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
901 | u32 queues, bool drop) | ||
901 | { | 902 | { |
902 | struct brcms_info *wl = hw->priv; | 903 | struct brcms_info *wl = hw->priv; |
903 | int ret; | 904 | int ret; |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c index 9417cb5a2553..af8ba64ace39 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c | |||
@@ -4870,14 +4870,11 @@ static void brcms_c_detach_module(struct brcms_c_info *wlc) | |||
4870 | /* | 4870 | /* |
4871 | * low level detach | 4871 | * low level detach |
4872 | */ | 4872 | */ |
4873 | static int brcms_b_detach(struct brcms_c_info *wlc) | 4873 | static void brcms_b_detach(struct brcms_c_info *wlc) |
4874 | { | 4874 | { |
4875 | uint i; | 4875 | uint i; |
4876 | struct brcms_hw_band *band; | 4876 | struct brcms_hw_band *band; |
4877 | struct brcms_hardware *wlc_hw = wlc->hw; | 4877 | struct brcms_hardware *wlc_hw = wlc->hw; |
4878 | int callbacks; | ||
4879 | |||
4880 | callbacks = 0; | ||
4881 | 4878 | ||
4882 | brcms_b_detach_dmapio(wlc_hw); | 4879 | brcms_b_detach_dmapio(wlc_hw); |
4883 | 4880 | ||
@@ -4900,9 +4897,6 @@ static int brcms_b_detach(struct brcms_c_info *wlc) | |||
4900 | ai_detach(wlc_hw->sih); | 4897 | ai_detach(wlc_hw->sih); |
4901 | wlc_hw->sih = NULL; | 4898 | wlc_hw->sih = NULL; |
4902 | } | 4899 | } |
4903 | |||
4904 | return callbacks; | ||
4905 | |||
4906 | } | 4900 | } |
4907 | 4901 | ||
4908 | /* | 4902 | /* |
@@ -4917,14 +4911,15 @@ static int brcms_b_detach(struct brcms_c_info *wlc) | |||
4917 | */ | 4911 | */ |
4918 | uint brcms_c_detach(struct brcms_c_info *wlc) | 4912 | uint brcms_c_detach(struct brcms_c_info *wlc) |
4919 | { | 4913 | { |
4920 | uint callbacks = 0; | 4914 | uint callbacks; |
4921 | 4915 | ||
4922 | if (wlc == NULL) | 4916 | if (wlc == NULL) |
4923 | return 0; | 4917 | return 0; |
4924 | 4918 | ||
4925 | callbacks += brcms_b_detach(wlc); | 4919 | brcms_b_detach(wlc); |
4926 | 4920 | ||
4927 | /* delete software timers */ | 4921 | /* delete software timers */ |
4922 | callbacks = 0; | ||
4928 | if (!brcms_c_radio_monitor_stop(wlc)) | 4923 | if (!brcms_c_radio_monitor_stop(wlc)) |
4929 | callbacks++; | 4924 | callbacks++; |
4930 | 4925 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmutil/d11.c b/drivers/net/wireless/brcm80211/brcmutil/d11.c index 30e54e2c6c9b..2b2522bdd8eb 100644 --- a/drivers/net/wireless/brcm80211/brcmutil/d11.c +++ b/drivers/net/wireless/brcm80211/brcmutil/d11.c | |||
@@ -21,19 +21,46 @@ | |||
21 | #include <brcmu_wifi.h> | 21 | #include <brcmu_wifi.h> |
22 | #include <brcmu_d11.h> | 22 | #include <brcmu_d11.h> |
23 | 23 | ||
24 | static void brcmu_d11n_encchspec(struct brcmu_chan *ch) | 24 | static u16 d11n_sb(enum brcmu_chan_sb sb) |
25 | { | 25 | { |
26 | ch->chspec = ch->chnum & BRCMU_CHSPEC_CH_MASK; | 26 | switch (sb) { |
27 | case BRCMU_CHAN_SB_NONE: | ||
28 | return BRCMU_CHSPEC_D11N_SB_N; | ||
29 | case BRCMU_CHAN_SB_L: | ||
30 | return BRCMU_CHSPEC_D11N_SB_L; | ||
31 | case BRCMU_CHAN_SB_U: | ||
32 | return BRCMU_CHSPEC_D11N_SB_U; | ||
33 | default: | ||
34 | WARN_ON(1); | ||
35 | } | ||
36 | return 0; | ||
37 | } | ||
27 | 38 | ||
28 | switch (ch->bw) { | 39 | static u16 d11n_bw(enum brcmu_chan_bw bw) |
40 | { | ||
41 | switch (bw) { | ||
29 | case BRCMU_CHAN_BW_20: | 42 | case BRCMU_CHAN_BW_20: |
30 | ch->chspec |= BRCMU_CHSPEC_D11N_BW_20 | BRCMU_CHSPEC_D11N_SB_N; | 43 | return BRCMU_CHSPEC_D11N_BW_20; |
31 | break; | ||
32 | case BRCMU_CHAN_BW_40: | 44 | case BRCMU_CHAN_BW_40: |
45 | return BRCMU_CHSPEC_D11N_BW_40; | ||
33 | default: | 46 | default: |
34 | WARN_ON_ONCE(1); | 47 | WARN_ON(1); |
35 | break; | ||
36 | } | 48 | } |
49 | return 0; | ||
50 | } | ||
51 | |||
52 | static void brcmu_d11n_encchspec(struct brcmu_chan *ch) | ||
53 | { | ||
54 | if (ch->bw == BRCMU_CHAN_BW_20) | ||
55 | ch->sb = BRCMU_CHAN_SB_NONE; | ||
56 | |||
57 | ch->chspec = 0; | ||
58 | brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_CH_MASK, | ||
59 | BRCMU_CHSPEC_CH_SHIFT, ch->chnum); | ||
60 | brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_D11N_SB_MASK, | ||
61 | 0, d11n_sb(ch->sb)); | ||
62 | brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_D11N_BW_MASK, | ||
63 | 0, d11n_bw(ch->bw)); | ||
37 | 64 | ||
38 | if (ch->chnum <= CH_MAX_2G_CHANNEL) | 65 | if (ch->chnum <= CH_MAX_2G_CHANNEL) |
39 | ch->chspec |= BRCMU_CHSPEC_D11N_BND_2G; | 66 | ch->chspec |= BRCMU_CHSPEC_D11N_BND_2G; |
@@ -41,23 +68,34 @@ static void brcmu_d11n_encchspec(struct brcmu_chan *ch) | |||
41 | ch->chspec |= BRCMU_CHSPEC_D11N_BND_5G; | 68 | ch->chspec |= BRCMU_CHSPEC_D11N_BND_5G; |
42 | } | 69 | } |
43 | 70 | ||
44 | static void brcmu_d11ac_encchspec(struct brcmu_chan *ch) | 71 | static u16 d11ac_bw(enum brcmu_chan_bw bw) |
45 | { | 72 | { |
46 | ch->chspec = ch->chnum & BRCMU_CHSPEC_CH_MASK; | 73 | switch (bw) { |
47 | |||
48 | switch (ch->bw) { | ||
49 | case BRCMU_CHAN_BW_20: | 74 | case BRCMU_CHAN_BW_20: |
50 | ch->chspec |= BRCMU_CHSPEC_D11AC_BW_20; | 75 | return BRCMU_CHSPEC_D11AC_BW_20; |
51 | break; | ||
52 | case BRCMU_CHAN_BW_40: | 76 | case BRCMU_CHAN_BW_40: |
77 | return BRCMU_CHSPEC_D11AC_BW_40; | ||
53 | case BRCMU_CHAN_BW_80: | 78 | case BRCMU_CHAN_BW_80: |
54 | case BRCMU_CHAN_BW_80P80: | 79 | return BRCMU_CHSPEC_D11AC_BW_80; |
55 | case BRCMU_CHAN_BW_160: | ||
56 | default: | 80 | default: |
57 | WARN_ON_ONCE(1); | 81 | WARN_ON(1); |
58 | break; | ||
59 | } | 82 | } |
83 | return 0; | ||
84 | } | ||
60 | 85 | ||
86 | static void brcmu_d11ac_encchspec(struct brcmu_chan *ch) | ||
87 | { | ||
88 | if (ch->bw == BRCMU_CHAN_BW_20 || ch->sb == BRCMU_CHAN_SB_NONE) | ||
89 | ch->sb = BRCMU_CHAN_SB_L; | ||
90 | |||
91 | brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_CH_MASK, | ||
92 | BRCMU_CHSPEC_CH_SHIFT, ch->chnum); | ||
93 | brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_D11AC_SB_MASK, | ||
94 | BRCMU_CHSPEC_D11AC_SB_SHIFT, ch->sb); | ||
95 | brcmu_maskset16(&ch->chspec, BRCMU_CHSPEC_D11AC_BW_MASK, | ||
96 | 0, d11ac_bw(ch->bw)); | ||
97 | |||
98 | ch->chspec &= ~BRCMU_CHSPEC_D11AC_BND_MASK; | ||
61 | if (ch->chnum <= CH_MAX_2G_CHANNEL) | 99 | if (ch->chnum <= CH_MAX_2G_CHANNEL) |
62 | ch->chspec |= BRCMU_CHSPEC_D11AC_BND_2G; | 100 | ch->chspec |= BRCMU_CHSPEC_D11AC_BND_2G; |
63 | else | 101 | else |
@@ -73,6 +111,7 @@ static void brcmu_d11n_decchspec(struct brcmu_chan *ch) | |||
73 | switch (ch->chspec & BRCMU_CHSPEC_D11N_BW_MASK) { | 111 | switch (ch->chspec & BRCMU_CHSPEC_D11N_BW_MASK) { |
74 | case BRCMU_CHSPEC_D11N_BW_20: | 112 | case BRCMU_CHSPEC_D11N_BW_20: |
75 | ch->bw = BRCMU_CHAN_BW_20; | 113 | ch->bw = BRCMU_CHAN_BW_20; |
114 | ch->sb = BRCMU_CHAN_SB_NONE; | ||
76 | break; | 115 | break; |
77 | case BRCMU_CHSPEC_D11N_BW_40: | 116 | case BRCMU_CHSPEC_D11N_BW_40: |
78 | ch->bw = BRCMU_CHAN_BW_40; | 117 | ch->bw = BRCMU_CHAN_BW_40; |
@@ -112,6 +151,7 @@ static void brcmu_d11ac_decchspec(struct brcmu_chan *ch) | |||
112 | switch (ch->chspec & BRCMU_CHSPEC_D11AC_BW_MASK) { | 151 | switch (ch->chspec & BRCMU_CHSPEC_D11AC_BW_MASK) { |
113 | case BRCMU_CHSPEC_D11AC_BW_20: | 152 | case BRCMU_CHSPEC_D11AC_BW_20: |
114 | ch->bw = BRCMU_CHAN_BW_20; | 153 | ch->bw = BRCMU_CHAN_BW_20; |
154 | ch->sb = BRCMU_CHAN_SB_NONE; | ||
115 | break; | 155 | break; |
116 | case BRCMU_CHSPEC_D11AC_BW_40: | 156 | case BRCMU_CHSPEC_D11AC_BW_40: |
117 | ch->bw = BRCMU_CHAN_BW_40; | 157 | ch->bw = BRCMU_CHAN_BW_40; |
@@ -128,6 +168,25 @@ static void brcmu_d11ac_decchspec(struct brcmu_chan *ch) | |||
128 | break; | 168 | break; |
129 | case BRCMU_CHSPEC_D11AC_BW_80: | 169 | case BRCMU_CHSPEC_D11AC_BW_80: |
130 | ch->bw = BRCMU_CHAN_BW_80; | 170 | ch->bw = BRCMU_CHAN_BW_80; |
171 | ch->sb = brcmu_maskget16(ch->chspec, BRCMU_CHSPEC_D11AC_SB_MASK, | ||
172 | BRCMU_CHSPEC_D11AC_SB_SHIFT); | ||
173 | switch (ch->sb) { | ||
174 | case BRCMU_CHAN_SB_LL: | ||
175 | ch->chnum -= CH_30MHZ_APART; | ||
176 | break; | ||
177 | case BRCMU_CHAN_SB_LU: | ||
178 | ch->chnum -= CH_10MHZ_APART; | ||
179 | break; | ||
180 | case BRCMU_CHAN_SB_UL: | ||
181 | ch->chnum += CH_10MHZ_APART; | ||
182 | break; | ||
183 | case BRCMU_CHAN_SB_UU: | ||
184 | ch->chnum += CH_30MHZ_APART; | ||
185 | break; | ||
186 | default: | ||
187 | WARN_ON_ONCE(1); | ||
188 | break; | ||
189 | } | ||
131 | break; | 190 | break; |
132 | case BRCMU_CHSPEC_D11AC_BW_8080: | 191 | case BRCMU_CHSPEC_D11AC_BW_8080: |
133 | case BRCMU_CHSPEC_D11AC_BW_160: | 192 | case BRCMU_CHSPEC_D11AC_BW_160: |
diff --git a/drivers/net/wireless/brcm80211/include/brcmu_d11.h b/drivers/net/wireless/brcm80211/include/brcmu_d11.h index 8660a2cba098..f9745ea8b3e0 100644 --- a/drivers/net/wireless/brcm80211/include/brcmu_d11.h +++ b/drivers/net/wireless/brcm80211/include/brcmu_d11.h | |||
@@ -108,13 +108,7 @@ enum brcmu_chan_bw { | |||
108 | }; | 108 | }; |
109 | 109 | ||
110 | enum brcmu_chan_sb { | 110 | enum brcmu_chan_sb { |
111 | BRCMU_CHAN_SB_NONE = 0, | 111 | BRCMU_CHAN_SB_NONE = -1, |
112 | BRCMU_CHAN_SB_L, | ||
113 | BRCMU_CHAN_SB_U, | ||
114 | BRCMU_CHAN_SB_LL, | ||
115 | BRCMU_CHAN_SB_LU, | ||
116 | BRCMU_CHAN_SB_UL, | ||
117 | BRCMU_CHAN_SB_UU, | ||
118 | BRCMU_CHAN_SB_LLL, | 112 | BRCMU_CHAN_SB_LLL, |
119 | BRCMU_CHAN_SB_LLU, | 113 | BRCMU_CHAN_SB_LLU, |
120 | BRCMU_CHAN_SB_LUL, | 114 | BRCMU_CHAN_SB_LUL, |
@@ -123,6 +117,12 @@ enum brcmu_chan_sb { | |||
123 | BRCMU_CHAN_SB_ULU, | 117 | BRCMU_CHAN_SB_ULU, |
124 | BRCMU_CHAN_SB_UUL, | 118 | BRCMU_CHAN_SB_UUL, |
125 | BRCMU_CHAN_SB_UUU, | 119 | BRCMU_CHAN_SB_UUU, |
120 | BRCMU_CHAN_SB_L = BRCMU_CHAN_SB_LLL, | ||
121 | BRCMU_CHAN_SB_U = BRCMU_CHAN_SB_LLU, | ||
122 | BRCMU_CHAN_SB_LL = BRCMU_CHAN_SB_LLL, | ||
123 | BRCMU_CHAN_SB_LU = BRCMU_CHAN_SB_LLU, | ||
124 | BRCMU_CHAN_SB_UL = BRCMU_CHAN_SB_LUL, | ||
125 | BRCMU_CHAN_SB_UU = BRCMU_CHAN_SB_LUU, | ||
126 | }; | 126 | }; |
127 | 127 | ||
128 | struct brcmu_chan { | 128 | struct brcmu_chan { |
diff --git a/drivers/net/wireless/brcm80211/include/brcmu_wifi.h b/drivers/net/wireless/brcm80211/include/brcmu_wifi.h index 74419d4bd123..76b5d3a86294 100644 --- a/drivers/net/wireless/brcm80211/include/brcmu_wifi.h +++ b/drivers/net/wireless/brcm80211/include/brcmu_wifi.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #define CH_UPPER_SB 0x01 | 29 | #define CH_UPPER_SB 0x01 |
30 | #define CH_LOWER_SB 0x02 | 30 | #define CH_LOWER_SB 0x02 |
31 | #define CH_EWA_VALID 0x04 | 31 | #define CH_EWA_VALID 0x04 |
32 | #define CH_30MHZ_APART 6 | ||
32 | #define CH_20MHZ_APART 4 | 33 | #define CH_20MHZ_APART 4 |
33 | #define CH_10MHZ_APART 2 | 34 | #define CH_10MHZ_APART 2 |
34 | #define CH_5MHZ_APART 1 /* 2G band channels are 5 Mhz apart */ | 35 | #define CH_5MHZ_APART 1 /* 2G band channels are 5 Mhz apart */ |
diff --git a/drivers/net/wireless/cw1200/sta.c b/drivers/net/wireless/cw1200/sta.c index 103f7bce8932..cd0cad7f7759 100644 --- a/drivers/net/wireless/cw1200/sta.c +++ b/drivers/net/wireless/cw1200/sta.c | |||
@@ -936,7 +936,8 @@ static int __cw1200_flush(struct cw1200_common *priv, bool drop) | |||
936 | return ret; | 936 | return ret; |
937 | } | 937 | } |
938 | 938 | ||
939 | void cw1200_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 939 | void cw1200_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
940 | u32 queues, bool drop) | ||
940 | { | 941 | { |
941 | struct cw1200_common *priv = hw->priv; | 942 | struct cw1200_common *priv = hw->priv; |
942 | 943 | ||
diff --git a/drivers/net/wireless/cw1200/sta.h b/drivers/net/wireless/cw1200/sta.h index 35babb62cc6a..b7e386b7662b 100644 --- a/drivers/net/wireless/cw1200/sta.h +++ b/drivers/net/wireless/cw1200/sta.h | |||
@@ -40,7 +40,8 @@ int cw1200_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd, | |||
40 | 40 | ||
41 | int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u32 value); | 41 | int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u32 value); |
42 | 42 | ||
43 | void cw1200_flush(struct ieee80211_hw *hw, u32 queues, bool drop); | 43 | void cw1200_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
44 | u32 queues, bool drop); | ||
44 | 45 | ||
45 | u64 cw1200_prepare_multicast(struct ieee80211_hw *hw, | 46 | u64 cw1200_prepare_multicast(struct ieee80211_hw *hw, |
46 | struct netdev_hw_addr_list *mc_list); | 47 | struct netdev_hw_addr_list *mc_list); |
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c index 67db34e56d7e..52919ad42726 100644 --- a/drivers/net/wireless/hostap/hostap_main.c +++ b/drivers/net/wireless/hostap/hostap_main.c | |||
@@ -882,7 +882,7 @@ void hostap_setup_dev(struct net_device *dev, local_info_t *local, | |||
882 | dev->mtu = local->mtu; | 882 | dev->mtu = local->mtu; |
883 | 883 | ||
884 | 884 | ||
885 | SET_ETHTOOL_OPS(dev, &prism2_ethtool_ops); | 885 | dev->ethtool_ops = &prism2_ethtool_ops; |
886 | 886 | ||
887 | } | 887 | } |
888 | 888 | ||
diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c index d37a6fd90d40..b598e2803500 100644 --- a/drivers/net/wireless/iwlegacy/3945.c +++ b/drivers/net/wireless/iwlegacy/3945.c | |||
@@ -573,7 +573,7 @@ il3945_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb) | |||
573 | rx_status.flag |= RX_FLAG_SHORTPRE; | 573 | rx_status.flag |= RX_FLAG_SHORTPRE; |
574 | 574 | ||
575 | if ((unlikely(rx_stats->phy_count > 20))) { | 575 | if ((unlikely(rx_stats->phy_count > 20))) { |
576 | D_DROP("dsp size out of range [0,20]: %d/n", | 576 | D_DROP("dsp size out of range [0,20]: %d\n", |
577 | rx_stats->phy_count); | 577 | rx_stats->phy_count); |
578 | return; | 578 | return; |
579 | } | 579 | } |
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index 888ad5c74639..c159c05db6ef 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
@@ -670,7 +670,7 @@ il4965_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb) | |||
670 | } | 670 | } |
671 | 671 | ||
672 | if ((unlikely(phy_res->cfg_phy_cnt > 20))) { | 672 | if ((unlikely(phy_res->cfg_phy_cnt > 20))) { |
673 | D_DROP("dsp size out of range [0,20]: %d/n", | 673 | D_DROP("dsp size out of range [0,20]: %d\n", |
674 | phy_res->cfg_phy_cnt); | 674 | phy_res->cfg_phy_cnt); |
675 | return; | 675 | return; |
676 | } | 676 | } |
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index 4f42174d9994..ecc674627e6e 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
@@ -4755,7 +4755,8 @@ out: | |||
4755 | } | 4755 | } |
4756 | EXPORT_SYMBOL(il_mac_change_interface); | 4756 | EXPORT_SYMBOL(il_mac_change_interface); |
4757 | 4757 | ||
4758 | void il_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 4758 | void il_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
4759 | u32 queues, bool drop) | ||
4759 | { | 4760 | { |
4760 | struct il_priv *il = hw->priv; | 4761 | struct il_priv *il = hw->priv; |
4761 | unsigned long timeout = jiffies + msecs_to_jiffies(500); | 4762 | unsigned long timeout = jiffies + msecs_to_jiffies(500); |
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h index dfb13c70efe8..ea5c0f863c4e 100644 --- a/drivers/net/wireless/iwlegacy/common.h +++ b/drivers/net/wireless/iwlegacy/common.h | |||
@@ -1723,7 +1723,8 @@ void il_mac_remove_interface(struct ieee80211_hw *hw, | |||
1723 | struct ieee80211_vif *vif); | 1723 | struct ieee80211_vif *vif); |
1724 | int il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 1724 | int il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1725 | enum nl80211_iftype newtype, bool newp2p); | 1725 | enum nl80211_iftype newtype, bool newp2p); |
1726 | void il_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop); | 1726 | void il_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1727 | u32 queues, bool drop); | ||
1727 | int il_alloc_txq_mem(struct il_priv *il); | 1728 | int il_alloc_txq_mem(struct il_priv *il); |
1728 | void il_free_txq_mem(struct il_priv *il); | 1729 | void il_free_txq_mem(struct il_priv *il); |
1729 | 1730 | ||
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig index 74b3b4de7bb7..7fd50428b934 100644 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ b/drivers/net/wireless/iwlwifi/Kconfig | |||
@@ -2,10 +2,6 @@ config IWLWIFI | |||
2 | tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) " | 2 | tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) " |
3 | depends on PCI && MAC80211 && HAS_IOMEM | 3 | depends on PCI && MAC80211 && HAS_IOMEM |
4 | select FW_LOADER | 4 | select FW_LOADER |
5 | select NEW_LEDS | ||
6 | select LEDS_CLASS | ||
7 | select LEDS_TRIGGERS | ||
8 | select MAC80211_LEDS | ||
9 | ---help--- | 5 | ---help--- |
10 | Select to build the driver supporting the: | 6 | Select to build the driver supporting the: |
11 | 7 | ||
@@ -43,6 +39,14 @@ config IWLWIFI | |||
43 | say M here and read <file:Documentation/kbuild/modules.txt>. The | 39 | say M here and read <file:Documentation/kbuild/modules.txt>. The |
44 | module will be called iwlwifi. | 40 | module will be called iwlwifi. |
45 | 41 | ||
42 | config IWLWIFI_LEDS | ||
43 | bool | ||
44 | depends on IWLWIFI | ||
45 | depends on LEDS_CLASS=y || LEDS_CLASS=IWLWIFI | ||
46 | select LEDS_TRIGGERS | ||
47 | select MAC80211_LEDS | ||
48 | default y | ||
49 | |||
46 | config IWLDVM | 50 | config IWLDVM |
47 | tristate "Intel Wireless WiFi DVM Firmware support" | 51 | tristate "Intel Wireless WiFi DVM Firmware support" |
48 | depends on IWLWIFI | 52 | depends on IWLWIFI |
@@ -124,7 +128,6 @@ config IWLWIFI_DEBUG_EXPERIMENTAL_UCODE | |||
124 | Enable use of experimental ucode for testing and debugging. | 128 | Enable use of experimental ucode for testing and debugging. |
125 | 129 | ||
126 | config IWLWIFI_DEVICE_TRACING | 130 | config IWLWIFI_DEVICE_TRACING |
127 | |||
128 | bool "iwlwifi device access tracing" | 131 | bool "iwlwifi device access tracing" |
129 | depends on IWLWIFI | 132 | depends on IWLWIFI |
130 | depends on EVENT_TRACING | 133 | depends on EVENT_TRACING |
diff --git a/drivers/net/wireless/iwlwifi/dvm/Makefile b/drivers/net/wireless/iwlwifi/dvm/Makefile index dce7ab2e0c4b..4d19685f31c3 100644 --- a/drivers/net/wireless/iwlwifi/dvm/Makefile +++ b/drivers/net/wireless/iwlwifi/dvm/Makefile | |||
@@ -4,9 +4,10 @@ iwldvm-objs += main.o rs.o mac80211.o ucode.o tx.o | |||
4 | iwldvm-objs += lib.o calib.o tt.o sta.o rx.o | 4 | iwldvm-objs += lib.o calib.o tt.o sta.o rx.o |
5 | 5 | ||
6 | iwldvm-objs += power.o | 6 | iwldvm-objs += power.o |
7 | iwldvm-objs += scan.o led.o | 7 | iwldvm-objs += scan.o |
8 | iwldvm-objs += rxon.o devices.o | 8 | iwldvm-objs += rxon.o devices.o |
9 | 9 | ||
10 | iwldvm-$(CONFIG_IWLWIFI_LEDS) += led.o | ||
10 | iwldvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o | 11 | iwldvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o |
11 | 12 | ||
12 | ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/../ | 13 | ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/../ |
diff --git a/drivers/net/wireless/iwlwifi/dvm/calib.c b/drivers/net/wireless/iwlwifi/dvm/calib.c index be1086c87157..20e6aa910700 100644 --- a/drivers/net/wireless/iwlwifi/dvm/calib.c +++ b/drivers/net/wireless/iwlwifi/dvm/calib.c | |||
@@ -94,7 +94,6 @@ int iwl_send_calib_results(struct iwl_priv *priv) | |||
94 | { | 94 | { |
95 | struct iwl_host_cmd hcmd = { | 95 | struct iwl_host_cmd hcmd = { |
96 | .id = REPLY_PHY_CALIBRATION_CMD, | 96 | .id = REPLY_PHY_CALIBRATION_CMD, |
97 | .flags = CMD_SYNC, | ||
98 | }; | 97 | }; |
99 | struct iwl_calib_result *res; | 98 | struct iwl_calib_result *res; |
100 | 99 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c index d2fe2596d54e..0ffb6ff1a255 100644 --- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c | |||
@@ -1481,7 +1481,7 @@ static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file, | |||
1481 | 1481 | ||
1482 | /* make request to uCode to retrieve statistics information */ | 1482 | /* make request to uCode to retrieve statistics information */ |
1483 | mutex_lock(&priv->mutex); | 1483 | mutex_lock(&priv->mutex); |
1484 | ret = iwl_send_statistics_request(priv, CMD_SYNC, false); | 1484 | ret = iwl_send_statistics_request(priv, 0, false); |
1485 | mutex_unlock(&priv->mutex); | 1485 | mutex_unlock(&priv->mutex); |
1486 | 1486 | ||
1487 | if (ret) | 1487 | if (ret) |
@@ -1868,7 +1868,7 @@ static ssize_t iwl_dbgfs_clear_ucode_statistics_write(struct file *file, | |||
1868 | 1868 | ||
1869 | /* make request to uCode to retrieve statistics information */ | 1869 | /* make request to uCode to retrieve statistics information */ |
1870 | mutex_lock(&priv->mutex); | 1870 | mutex_lock(&priv->mutex); |
1871 | iwl_send_statistics_request(priv, CMD_SYNC, true); | 1871 | iwl_send_statistics_request(priv, 0, true); |
1872 | mutex_unlock(&priv->mutex); | 1872 | mutex_unlock(&priv->mutex); |
1873 | 1873 | ||
1874 | return count; | 1874 | return count; |
@@ -2188,7 +2188,6 @@ static int iwl_cmd_echo_test(struct iwl_priv *priv) | |||
2188 | struct iwl_host_cmd cmd = { | 2188 | struct iwl_host_cmd cmd = { |
2189 | .id = REPLY_ECHO, | 2189 | .id = REPLY_ECHO, |
2190 | .len = { 0 }, | 2190 | .len = { 0 }, |
2191 | .flags = CMD_SYNC, | ||
2192 | }; | 2191 | }; |
2193 | 2192 | ||
2194 | ret = iwl_dvm_send_cmd(priv, &cmd); | 2193 | ret = iwl_dvm_send_cmd(priv, &cmd); |
@@ -2320,7 +2319,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct file *file, | |||
2320 | mutex_lock(&priv->mutex); | 2319 | mutex_lock(&priv->mutex); |
2321 | 2320 | ||
2322 | /* take the return value to make compiler happy - it will fail anyway */ | 2321 | /* take the return value to make compiler happy - it will fail anyway */ |
2323 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_ERROR, CMD_SYNC, 0, NULL); | 2322 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_ERROR, 0, 0, NULL); |
2324 | 2323 | ||
2325 | mutex_unlock(&priv->mutex); | 2324 | mutex_unlock(&priv->mutex); |
2326 | 2325 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h index 3441f70d0ff9..a6f22c32a279 100644 --- a/drivers/net/wireless/iwlwifi/dvm/dev.h +++ b/drivers/net/wireless/iwlwifi/dvm/dev.h | |||
@@ -888,9 +888,11 @@ struct iwl_priv { | |||
888 | 888 | ||
889 | struct iwl_event_log event_log; | 889 | struct iwl_event_log event_log; |
890 | 890 | ||
891 | #ifdef CONFIG_IWLWIFI_LEDS | ||
891 | struct led_classdev led; | 892 | struct led_classdev led; |
892 | unsigned long blink_on, blink_off; | 893 | unsigned long blink_on, blink_off; |
893 | bool led_registered; | 894 | bool led_registered; |
895 | #endif | ||
894 | 896 | ||
895 | /* WoWLAN GTK rekey data */ | 897 | /* WoWLAN GTK rekey data */ |
896 | u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN]; | 898 | u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN]; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/devices.c b/drivers/net/wireless/iwlwifi/dvm/devices.c index 758c54eeb206..34b41e5f7cfc 100644 --- a/drivers/net/wireless/iwlwifi/dvm/devices.c +++ b/drivers/net/wireless/iwlwifi/dvm/devices.c | |||
@@ -417,7 +417,6 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv, | |||
417 | struct iwl_host_cmd hcmd = { | 417 | struct iwl_host_cmd hcmd = { |
418 | .id = REPLY_CHANNEL_SWITCH, | 418 | .id = REPLY_CHANNEL_SWITCH, |
419 | .len = { sizeof(cmd), }, | 419 | .len = { sizeof(cmd), }, |
420 | .flags = CMD_SYNC, | ||
421 | .data = { &cmd, }, | 420 | .data = { &cmd, }, |
422 | }; | 421 | }; |
423 | 422 | ||
@@ -579,7 +578,6 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, | |||
579 | struct iwl_host_cmd hcmd = { | 578 | struct iwl_host_cmd hcmd = { |
580 | .id = REPLY_CHANNEL_SWITCH, | 579 | .id = REPLY_CHANNEL_SWITCH, |
581 | .len = { sizeof(*cmd), }, | 580 | .len = { sizeof(*cmd), }, |
582 | .flags = CMD_SYNC, | ||
583 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, | 581 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, |
584 | }; | 582 | }; |
585 | int err; | 583 | int err; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/led.h b/drivers/net/wireless/iwlwifi/dvm/led.h index 6a0817d9c4fa..1c6b2252d0f2 100644 --- a/drivers/net/wireless/iwlwifi/dvm/led.h +++ b/drivers/net/wireless/iwlwifi/dvm/led.h | |||
@@ -36,8 +36,20 @@ struct iwl_priv; | |||
36 | #define IWL_LED_ACTIVITY (0<<1) | 36 | #define IWL_LED_ACTIVITY (0<<1) |
37 | #define IWL_LED_LINK (1<<1) | 37 | #define IWL_LED_LINK (1<<1) |
38 | 38 | ||
39 | #ifdef CONFIG_IWLWIFI_LEDS | ||
39 | void iwlagn_led_enable(struct iwl_priv *priv); | 40 | void iwlagn_led_enable(struct iwl_priv *priv); |
40 | void iwl_leds_init(struct iwl_priv *priv); | 41 | void iwl_leds_init(struct iwl_priv *priv); |
41 | void iwl_leds_exit(struct iwl_priv *priv); | 42 | void iwl_leds_exit(struct iwl_priv *priv); |
43 | #else | ||
44 | static inline void iwlagn_led_enable(struct iwl_priv *priv) | ||
45 | { | ||
46 | } | ||
47 | static inline void iwl_leds_init(struct iwl_priv *priv) | ||
48 | { | ||
49 | } | ||
50 | static inline void iwl_leds_exit(struct iwl_priv *priv) | ||
51 | { | ||
52 | } | ||
53 | #endif | ||
42 | 54 | ||
43 | #endif /* __iwl_leds_h__ */ | 55 | #endif /* __iwl_leds_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c index 576f7ee38ca5..2191621d69c1 100644 --- a/drivers/net/wireless/iwlwifi/dvm/lib.c +++ b/drivers/net/wireless/iwlwifi/dvm/lib.c | |||
@@ -81,7 +81,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv) | |||
81 | else | 81 | else |
82 | tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD; | 82 | tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD; |
83 | 83 | ||
84 | return iwl_dvm_send_cmd_pdu(priv, tx_ant_cfg_cmd, CMD_SYNC, | 84 | return iwl_dvm_send_cmd_pdu(priv, tx_ant_cfg_cmd, 0, |
85 | sizeof(tx_power_cmd), &tx_power_cmd); | 85 | sizeof(tx_power_cmd), &tx_power_cmd); |
86 | } | 86 | } |
87 | 87 | ||
@@ -141,7 +141,6 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u32 scd_q_msk) | |||
141 | struct iwl_host_cmd cmd = { | 141 | struct iwl_host_cmd cmd = { |
142 | .id = REPLY_TXFIFO_FLUSH, | 142 | .id = REPLY_TXFIFO_FLUSH, |
143 | .len = { sizeof(struct iwl_txfifo_flush_cmd), }, | 143 | .len = { sizeof(struct iwl_txfifo_flush_cmd), }, |
144 | .flags = CMD_SYNC, | ||
145 | .data = { &flush_cmd, }, | 144 | .data = { &flush_cmd, }, |
146 | }; | 145 | }; |
147 | 146 | ||
@@ -180,7 +179,7 @@ void iwlagn_dev_txfifo_flush(struct iwl_priv *priv) | |||
180 | goto done; | 179 | goto done; |
181 | } | 180 | } |
182 | IWL_DEBUG_INFO(priv, "wait transmit/flush all frames\n"); | 181 | IWL_DEBUG_INFO(priv, "wait transmit/flush all frames\n"); |
183 | iwl_trans_wait_tx_queue_empty(priv->trans); | 182 | iwl_trans_wait_tx_queue_empty(priv->trans, 0xffffffff); |
184 | done: | 183 | done: |
185 | ieee80211_wake_queues(priv->hw); | 184 | ieee80211_wake_queues(priv->hw); |
186 | mutex_unlock(&priv->mutex); | 185 | mutex_unlock(&priv->mutex); |
@@ -333,12 +332,12 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv) | |||
333 | memcpy(&bt_cmd_v2.basic, &basic, | 332 | memcpy(&bt_cmd_v2.basic, &basic, |
334 | sizeof(basic)); | 333 | sizeof(basic)); |
335 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, | 334 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, |
336 | CMD_SYNC, sizeof(bt_cmd_v2), &bt_cmd_v2); | 335 | 0, sizeof(bt_cmd_v2), &bt_cmd_v2); |
337 | } else { | 336 | } else { |
338 | memcpy(&bt_cmd_v1.basic, &basic, | 337 | memcpy(&bt_cmd_v1.basic, &basic, |
339 | sizeof(basic)); | 338 | sizeof(basic)); |
340 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, | 339 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, |
341 | CMD_SYNC, sizeof(bt_cmd_v1), &bt_cmd_v1); | 340 | 0, sizeof(bt_cmd_v1), &bt_cmd_v1); |
342 | } | 341 | } |
343 | if (ret) | 342 | if (ret) |
344 | IWL_ERR(priv, "failed to send BT Coex Config\n"); | 343 | IWL_ERR(priv, "failed to send BT Coex Config\n"); |
@@ -1044,7 +1043,6 @@ int iwlagn_send_patterns(struct iwl_priv *priv, | |||
1044 | struct iwl_host_cmd cmd = { | 1043 | struct iwl_host_cmd cmd = { |
1045 | .id = REPLY_WOWLAN_PATTERNS, | 1044 | .id = REPLY_WOWLAN_PATTERNS, |
1046 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, | 1045 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, |
1047 | .flags = CMD_SYNC, | ||
1048 | }; | 1046 | }; |
1049 | int i, err; | 1047 | int i, err; |
1050 | 1048 | ||
@@ -1201,7 +1199,6 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan) | |||
1201 | if (key_data.use_rsc_tsc) { | 1199 | if (key_data.use_rsc_tsc) { |
1202 | struct iwl_host_cmd rsc_tsc_cmd = { | 1200 | struct iwl_host_cmd rsc_tsc_cmd = { |
1203 | .id = REPLY_WOWLAN_TSC_RSC_PARAMS, | 1201 | .id = REPLY_WOWLAN_TSC_RSC_PARAMS, |
1204 | .flags = CMD_SYNC, | ||
1205 | .data[0] = key_data.rsc_tsc, | 1202 | .data[0] = key_data.rsc_tsc, |
1206 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, | 1203 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, |
1207 | .len[0] = sizeof(*key_data.rsc_tsc), | 1204 | .len[0] = sizeof(*key_data.rsc_tsc), |
@@ -1215,7 +1212,7 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan) | |||
1215 | if (key_data.use_tkip) { | 1212 | if (key_data.use_tkip) { |
1216 | ret = iwl_dvm_send_cmd_pdu(priv, | 1213 | ret = iwl_dvm_send_cmd_pdu(priv, |
1217 | REPLY_WOWLAN_TKIP_PARAMS, | 1214 | REPLY_WOWLAN_TKIP_PARAMS, |
1218 | CMD_SYNC, sizeof(tkip_cmd), | 1215 | 0, sizeof(tkip_cmd), |
1219 | &tkip_cmd); | 1216 | &tkip_cmd); |
1220 | if (ret) | 1217 | if (ret) |
1221 | goto out; | 1218 | goto out; |
@@ -1231,20 +1228,20 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan) | |||
1231 | 1228 | ||
1232 | ret = iwl_dvm_send_cmd_pdu(priv, | 1229 | ret = iwl_dvm_send_cmd_pdu(priv, |
1233 | REPLY_WOWLAN_KEK_KCK_MATERIAL, | 1230 | REPLY_WOWLAN_KEK_KCK_MATERIAL, |
1234 | CMD_SYNC, sizeof(kek_kck_cmd), | 1231 | 0, sizeof(kek_kck_cmd), |
1235 | &kek_kck_cmd); | 1232 | &kek_kck_cmd); |
1236 | if (ret) | 1233 | if (ret) |
1237 | goto out; | 1234 | goto out; |
1238 | } | 1235 | } |
1239 | } | 1236 | } |
1240 | 1237 | ||
1241 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_D3_CONFIG, CMD_SYNC, | 1238 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_D3_CONFIG, 0, |
1242 | sizeof(d3_cfg_cmd), &d3_cfg_cmd); | 1239 | sizeof(d3_cfg_cmd), &d3_cfg_cmd); |
1243 | if (ret) | 1240 | if (ret) |
1244 | goto out; | 1241 | goto out; |
1245 | 1242 | ||
1246 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WOWLAN_WAKEUP_FILTER, | 1243 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WOWLAN_WAKEUP_FILTER, |
1247 | CMD_SYNC, sizeof(wakeup_filter_cmd), | 1244 | 0, sizeof(wakeup_filter_cmd), |
1248 | &wakeup_filter_cmd); | 1245 | &wakeup_filter_cmd); |
1249 | if (ret) | 1246 | if (ret) |
1250 | goto out; | 1247 | goto out; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c index dd55c9cf7ba8..29af7b51e370 100644 --- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c | |||
@@ -1091,7 +1091,8 @@ static void iwlagn_configure_filter(struct ieee80211_hw *hw, | |||
1091 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; | 1091 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; |
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | static void iwlagn_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 1094 | static void iwlagn_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1095 | u32 queues, bool drop) | ||
1095 | { | 1096 | { |
1096 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); | 1097 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); |
1097 | 1098 | ||
@@ -1119,7 +1120,7 @@ static void iwlagn_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | |||
1119 | } | 1120 | } |
1120 | } | 1121 | } |
1121 | IWL_DEBUG_MAC80211(priv, "wait transmit/flush all frames\n"); | 1122 | IWL_DEBUG_MAC80211(priv, "wait transmit/flush all frames\n"); |
1122 | iwl_trans_wait_tx_queue_empty(priv->trans); | 1123 | iwl_trans_wait_tx_queue_empty(priv->trans, 0xffffffff); |
1123 | done: | 1124 | done: |
1124 | mutex_unlock(&priv->mutex); | 1125 | mutex_unlock(&priv->mutex); |
1125 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 1126 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c index 6a6df71af1d7..0b7f46f0b079 100644 --- a/drivers/net/wireless/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/iwlwifi/dvm/main.c | |||
@@ -128,7 +128,6 @@ int iwlagn_send_beacon_cmd(struct iwl_priv *priv) | |||
128 | struct iwl_tx_beacon_cmd *tx_beacon_cmd; | 128 | struct iwl_tx_beacon_cmd *tx_beacon_cmd; |
129 | struct iwl_host_cmd cmd = { | 129 | struct iwl_host_cmd cmd = { |
130 | .id = REPLY_TX_BEACON, | 130 | .id = REPLY_TX_BEACON, |
131 | .flags = CMD_SYNC, | ||
132 | }; | 131 | }; |
133 | struct ieee80211_tx_info *info; | 132 | struct ieee80211_tx_info *info; |
134 | u32 frame_size; | 133 | u32 frame_size; |
@@ -311,8 +310,7 @@ int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags, bool clear) | |||
311 | sizeof(struct iwl_statistics_cmd), | 310 | sizeof(struct iwl_statistics_cmd), |
312 | &statistics_cmd); | 311 | &statistics_cmd); |
313 | else | 312 | else |
314 | return iwl_dvm_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, | 313 | return iwl_dvm_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, 0, |
315 | CMD_SYNC, | ||
316 | sizeof(struct iwl_statistics_cmd), | 314 | sizeof(struct iwl_statistics_cmd), |
317 | &statistics_cmd); | 315 | &statistics_cmd); |
318 | } | 316 | } |
@@ -622,7 +620,7 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv) | |||
622 | 620 | ||
623 | ret = iwl_dvm_send_cmd_pdu(priv, | 621 | ret = iwl_dvm_send_cmd_pdu(priv, |
624 | REPLY_CT_KILL_CONFIG_CMD, | 622 | REPLY_CT_KILL_CONFIG_CMD, |
625 | CMD_SYNC, sizeof(adv_cmd), &adv_cmd); | 623 | 0, sizeof(adv_cmd), &adv_cmd); |
626 | if (ret) | 624 | if (ret) |
627 | IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); | 625 | IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); |
628 | else | 626 | else |
@@ -637,7 +635,7 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv) | |||
637 | 635 | ||
638 | ret = iwl_dvm_send_cmd_pdu(priv, | 636 | ret = iwl_dvm_send_cmd_pdu(priv, |
639 | REPLY_CT_KILL_CONFIG_CMD, | 637 | REPLY_CT_KILL_CONFIG_CMD, |
640 | CMD_SYNC, sizeof(cmd), &cmd); | 638 | 0, sizeof(cmd), &cmd); |
641 | if (ret) | 639 | if (ret) |
642 | IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); | 640 | IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); |
643 | else | 641 | else |
@@ -673,9 +671,7 @@ static int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant) | |||
673 | 671 | ||
674 | if (IWL_UCODE_API(priv->fw->ucode_ver) > 1) { | 672 | if (IWL_UCODE_API(priv->fw->ucode_ver) > 1) { |
675 | IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant); | 673 | IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant); |
676 | return iwl_dvm_send_cmd_pdu(priv, | 674 | return iwl_dvm_send_cmd_pdu(priv, TX_ANT_CONFIGURATION_CMD, 0, |
677 | TX_ANT_CONFIGURATION_CMD, | ||
678 | CMD_SYNC, | ||
679 | sizeof(struct iwl_tx_ant_config_cmd), | 675 | sizeof(struct iwl_tx_ant_config_cmd), |
680 | &tx_ant_cmd); | 676 | &tx_ant_cmd); |
681 | } else { | 677 | } else { |
@@ -703,7 +699,7 @@ static void iwl_send_bt_config(struct iwl_priv *priv) | |||
703 | (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); | 699 | (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); |
704 | 700 | ||
705 | if (iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, | 701 | if (iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, |
706 | CMD_SYNC, sizeof(struct iwl_bt_cmd), &bt_cmd)) | 702 | 0, sizeof(struct iwl_bt_cmd), &bt_cmd)) |
707 | IWL_ERR(priv, "failed to send BT Coex Config\n"); | 703 | IWL_ERR(priv, "failed to send BT Coex Config\n"); |
708 | } | 704 | } |
709 | 705 | ||
@@ -987,7 +983,7 @@ static void iwl_bg_restart(struct work_struct *data) | |||
987 | ieee80211_restart_hw(priv->hw); | 983 | ieee80211_restart_hw(priv->hw); |
988 | else | 984 | else |
989 | IWL_ERR(priv, | 985 | IWL_ERR(priv, |
990 | "Cannot request restart before registrating with mac80211"); | 986 | "Cannot request restart before registrating with mac80211\n"); |
991 | } else { | 987 | } else { |
992 | WARN_ON(1); | 988 | WARN_ON(1); |
993 | } | 989 | } |
@@ -1127,7 +1123,6 @@ static void iwl_option_config(struct iwl_priv *priv) | |||
1127 | static int iwl_eeprom_init_hw_params(struct iwl_priv *priv) | 1123 | static int iwl_eeprom_init_hw_params(struct iwl_priv *priv) |
1128 | { | 1124 | { |
1129 | struct iwl_nvm_data *data = priv->nvm_data; | 1125 | struct iwl_nvm_data *data = priv->nvm_data; |
1130 | char *debug_msg; | ||
1131 | 1126 | ||
1132 | if (data->sku_cap_11n_enable && | 1127 | if (data->sku_cap_11n_enable && |
1133 | !priv->cfg->ht_params) { | 1128 | !priv->cfg->ht_params) { |
@@ -1141,8 +1136,8 @@ static int iwl_eeprom_init_hw_params(struct iwl_priv *priv) | |||
1141 | return -EINVAL; | 1136 | return -EINVAL; |
1142 | } | 1137 | } |
1143 | 1138 | ||
1144 | debug_msg = "Device SKU: 24GHz %s %s, 52GHz %s %s, 11.n %s %s\n"; | 1139 | IWL_DEBUG_INFO(priv, |
1145 | IWL_DEBUG_INFO(priv, debug_msg, | 1140 | "Device SKU: 24GHz %s %s, 52GHz %s %s, 11.n %s %s\n", |
1146 | data->sku_cap_band_24GHz_enable ? "" : "NOT", "enabled", | 1141 | data->sku_cap_band_24GHz_enable ? "" : "NOT", "enabled", |
1147 | data->sku_cap_band_52GHz_enable ? "" : "NOT", "enabled", | 1142 | data->sku_cap_band_52GHz_enable ? "" : "NOT", "enabled", |
1148 | data->sku_cap_11n_enable ? "" : "NOT", "enabled"); | 1143 | data->sku_cap_11n_enable ? "" : "NOT", "enabled"); |
@@ -1350,7 +1345,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1350 | iwl_set_hw_params(priv); | 1345 | iwl_set_hw_params(priv); |
1351 | 1346 | ||
1352 | if (!(priv->nvm_data->sku_cap_ipan_enable)) { | 1347 | if (!(priv->nvm_data->sku_cap_ipan_enable)) { |
1353 | IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN"); | 1348 | IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN\n"); |
1354 | ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN; | 1349 | ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN; |
1355 | /* | 1350 | /* |
1356 | * if not PAN, then don't support P2P -- might be a uCode | 1351 | * if not PAN, then don't support P2P -- might be a uCode |
@@ -2019,10 +2014,10 @@ void iwlagn_lift_passive_no_rx(struct iwl_priv *priv) | |||
2019 | 2014 | ||
2020 | for (mq = 0; mq < IWLAGN_FIRST_AMPDU_QUEUE; mq++) { | 2015 | for (mq = 0; mq < IWLAGN_FIRST_AMPDU_QUEUE; mq++) { |
2021 | if (!test_bit(mq, &priv->transport_queue_stop)) { | 2016 | if (!test_bit(mq, &priv->transport_queue_stop)) { |
2022 | IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d", mq); | 2017 | IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d\n", mq); |
2023 | ieee80211_wake_queue(priv->hw, mq); | 2018 | ieee80211_wake_queue(priv->hw, mq); |
2024 | } else { | 2019 | } else { |
2025 | IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d", mq); | 2020 | IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d\n", mq); |
2026 | } | 2021 | } |
2027 | } | 2022 | } |
2028 | 2023 | ||
@@ -2053,6 +2048,17 @@ static bool iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) | |||
2053 | return false; | 2048 | return false; |
2054 | } | 2049 | } |
2055 | 2050 | ||
2051 | static void iwl_napi_add(struct iwl_op_mode *op_mode, | ||
2052 | struct napi_struct *napi, | ||
2053 | struct net_device *napi_dev, | ||
2054 | int (*poll)(struct napi_struct *, int), | ||
2055 | int weight) | ||
2056 | { | ||
2057 | struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); | ||
2058 | |||
2059 | ieee80211_napi_add(priv->hw, napi, napi_dev, poll, weight); | ||
2060 | } | ||
2061 | |||
2056 | static const struct iwl_op_mode_ops iwl_dvm_ops = { | 2062 | static const struct iwl_op_mode_ops iwl_dvm_ops = { |
2057 | .start = iwl_op_mode_dvm_start, | 2063 | .start = iwl_op_mode_dvm_start, |
2058 | .stop = iwl_op_mode_dvm_stop, | 2064 | .stop = iwl_op_mode_dvm_stop, |
@@ -2065,6 +2071,7 @@ static const struct iwl_op_mode_ops iwl_dvm_ops = { | |||
2065 | .cmd_queue_full = iwl_cmd_queue_full, | 2071 | .cmd_queue_full = iwl_cmd_queue_full, |
2066 | .nic_config = iwl_nic_config, | 2072 | .nic_config = iwl_nic_config, |
2067 | .wimax_active = iwl_wimax_active, | 2073 | .wimax_active = iwl_wimax_active, |
2074 | .napi_add = iwl_napi_add, | ||
2068 | }; | 2075 | }; |
2069 | 2076 | ||
2070 | /***************************************************************************** | 2077 | /***************************************************************************** |
diff --git a/drivers/net/wireless/iwlwifi/dvm/power.c b/drivers/net/wireless/iwlwifi/dvm/power.c index b4e61417013a..f2c1439566b5 100644 --- a/drivers/net/wireless/iwlwifi/dvm/power.c +++ b/drivers/net/wireless/iwlwifi/dvm/power.c | |||
@@ -278,7 +278,7 @@ static int iwl_set_power(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd) | |||
278 | le32_to_cpu(cmd->sleep_interval[3]), | 278 | le32_to_cpu(cmd->sleep_interval[3]), |
279 | le32_to_cpu(cmd->sleep_interval[4])); | 279 | le32_to_cpu(cmd->sleep_interval[4])); |
280 | 280 | ||
281 | return iwl_dvm_send_cmd_pdu(priv, POWER_TABLE_CMD, CMD_SYNC, | 281 | return iwl_dvm_send_cmd_pdu(priv, POWER_TABLE_CMD, 0, |
282 | sizeof(struct iwl_powertable_cmd), cmd); | 282 | sizeof(struct iwl_powertable_cmd), cmd); |
283 | } | 283 | } |
284 | 284 | ||
@@ -361,7 +361,7 @@ int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, | |||
361 | 361 | ||
362 | memcpy(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)); | 362 | memcpy(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)); |
363 | } else | 363 | } else |
364 | IWL_ERR(priv, "set power fail, ret = %d", ret); | 364 | IWL_ERR(priv, "set power fail, ret = %d\n", ret); |
365 | 365 | ||
366 | return ret; | 366 | return ret; |
367 | } | 367 | } |
diff --git a/drivers/net/wireless/iwlwifi/dvm/rs.c b/drivers/net/wireless/iwlwifi/dvm/rs.c index aa773a2da4ab..32b78a66536d 100644 --- a/drivers/net/wireless/iwlwifi/dvm/rs.c +++ b/drivers/net/wireless/iwlwifi/dvm/rs.c | |||
@@ -1453,7 +1453,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv, | |||
1453 | tbl->action = IWL_LEGACY_SWITCH_SISO; | 1453 | tbl->action = IWL_LEGACY_SWITCH_SISO; |
1454 | break; | 1454 | break; |
1455 | default: | 1455 | default: |
1456 | IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); | 1456 | IWL_ERR(priv, "Invalid BT load %d\n", priv->bt_traffic_load); |
1457 | break; | 1457 | break; |
1458 | } | 1458 | } |
1459 | 1459 | ||
@@ -1628,7 +1628,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, | |||
1628 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; | 1628 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; |
1629 | break; | 1629 | break; |
1630 | default: | 1630 | default: |
1631 | IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); | 1631 | IWL_ERR(priv, "Invalid BT load %d\n", priv->bt_traffic_load); |
1632 | break; | 1632 | break; |
1633 | } | 1633 | } |
1634 | 1634 | ||
@@ -1799,7 +1799,7 @@ static int rs_move_mimo2_to_other(struct iwl_priv *priv, | |||
1799 | tbl->action = IWL_MIMO2_SWITCH_SISO_A; | 1799 | tbl->action = IWL_MIMO2_SWITCH_SISO_A; |
1800 | break; | 1800 | break; |
1801 | default: | 1801 | default: |
1802 | IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); | 1802 | IWL_ERR(priv, "Invalid BT load %d\n", priv->bt_traffic_load); |
1803 | break; | 1803 | break; |
1804 | } | 1804 | } |
1805 | 1805 | ||
@@ -1969,7 +1969,7 @@ static int rs_move_mimo3_to_other(struct iwl_priv *priv, | |||
1969 | tbl->action = IWL_MIMO3_SWITCH_SISO_A; | 1969 | tbl->action = IWL_MIMO3_SWITCH_SISO_A; |
1970 | break; | 1970 | break; |
1971 | default: | 1971 | default: |
1972 | IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); | 1972 | IWL_ERR(priv, "Invalid BT load %d\n", priv->bt_traffic_load); |
1973 | break; | 1973 | break; |
1974 | } | 1974 | } |
1975 | 1975 | ||
@@ -2709,7 +2709,7 @@ static void rs_initialize_lq(struct iwl_priv *priv, | |||
2709 | rs_set_expected_tpt_table(lq_sta, tbl); | 2709 | rs_set_expected_tpt_table(lq_sta, tbl); |
2710 | rs_fill_link_cmd(NULL, lq_sta, rate); | 2710 | rs_fill_link_cmd(NULL, lq_sta, rate); |
2711 | priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; | 2711 | priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; |
2712 | iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_SYNC, true); | 2712 | iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, 0, true); |
2713 | } | 2713 | } |
2714 | 2714 | ||
2715 | static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | 2715 | static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, |
diff --git a/drivers/net/wireless/iwlwifi/dvm/rx.c b/drivers/net/wireless/iwlwifi/dvm/rx.c index cd8377346aff..debec963c610 100644 --- a/drivers/net/wireless/iwlwifi/dvm/rx.c +++ b/drivers/net/wireless/iwlwifi/dvm/rx.c | |||
@@ -786,7 +786,7 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
786 | 786 | ||
787 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); | 787 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); |
788 | 788 | ||
789 | ieee80211_rx_ni(priv->hw, skb); | 789 | ieee80211_rx(priv->hw, skb); |
790 | } | 790 | } |
791 | 791 | ||
792 | static u32 iwlagn_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in) | 792 | static u32 iwlagn_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in) |
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c index 503a81e58185..ed50de6362ed 100644 --- a/drivers/net/wireless/iwlwifi/dvm/rxon.c +++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c | |||
@@ -104,7 +104,7 @@ static int iwlagn_disable_bss(struct iwl_priv *priv, | |||
104 | 104 | ||
105 | send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 105 | send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
106 | ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, | 106 | ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, |
107 | CMD_SYNC, sizeof(*send), send); | 107 | 0, sizeof(*send), send); |
108 | 108 | ||
109 | send->filter_flags = old_filter; | 109 | send->filter_flags = old_filter; |
110 | 110 | ||
@@ -134,7 +134,7 @@ static int iwlagn_disable_pan(struct iwl_priv *priv, | |||
134 | send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 134 | send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
135 | send->dev_type = RXON_DEV_TYPE_P2P; | 135 | send->dev_type = RXON_DEV_TYPE_P2P; |
136 | ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, | 136 | ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, |
137 | CMD_SYNC, sizeof(*send), send); | 137 | 0, sizeof(*send), send); |
138 | 138 | ||
139 | send->filter_flags = old_filter; | 139 | send->filter_flags = old_filter; |
140 | send->dev_type = old_dev_type; | 140 | send->dev_type = old_dev_type; |
@@ -160,7 +160,7 @@ static int iwlagn_disconn_pan(struct iwl_priv *priv, | |||
160 | int ret; | 160 | int ret; |
161 | 161 | ||
162 | send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 162 | send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
163 | ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, CMD_SYNC, | 163 | ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, 0, |
164 | sizeof(*send), send); | 164 | sizeof(*send), send); |
165 | 165 | ||
166 | send->filter_flags = old_filter; | 166 | send->filter_flags = old_filter; |
@@ -189,7 +189,7 @@ static void iwlagn_update_qos(struct iwl_priv *priv, | |||
189 | ctx->qos_data.qos_active, | 189 | ctx->qos_data.qos_active, |
190 | ctx->qos_data.def_qos_parm.qos_flags); | 190 | ctx->qos_data.def_qos_parm.qos_flags); |
191 | 191 | ||
192 | ret = iwl_dvm_send_cmd_pdu(priv, ctx->qos_cmd, CMD_SYNC, | 192 | ret = iwl_dvm_send_cmd_pdu(priv, ctx->qos_cmd, 0, |
193 | sizeof(struct iwl_qosparam_cmd), | 193 | sizeof(struct iwl_qosparam_cmd), |
194 | &ctx->qos_data.def_qos_parm); | 194 | &ctx->qos_data.def_qos_parm); |
195 | if (ret) | 195 | if (ret) |
@@ -353,7 +353,7 @@ static int iwl_send_rxon_timing(struct iwl_priv *priv, | |||
353 | le16_to_cpu(ctx->timing.atim_window)); | 353 | le16_to_cpu(ctx->timing.atim_window)); |
354 | 354 | ||
355 | return iwl_dvm_send_cmd_pdu(priv, ctx->rxon_timing_cmd, | 355 | return iwl_dvm_send_cmd_pdu(priv, ctx->rxon_timing_cmd, |
356 | CMD_SYNC, sizeof(ctx->timing), &ctx->timing); | 356 | 0, sizeof(ctx->timing), &ctx->timing); |
357 | } | 357 | } |
358 | 358 | ||
359 | static int iwlagn_rxon_disconn(struct iwl_priv *priv, | 359 | static int iwlagn_rxon_disconn(struct iwl_priv *priv, |
@@ -495,7 +495,7 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv, | |||
495 | * Associated RXON doesn't clear the station table in uCode, | 495 | * Associated RXON doesn't clear the station table in uCode, |
496 | * so we don't need to restore stations etc. after this. | 496 | * so we don't need to restore stations etc. after this. |
497 | */ | 497 | */ |
498 | ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, CMD_SYNC, | 498 | ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, 0, |
499 | sizeof(struct iwl_rxon_cmd), &ctx->staging); | 499 | sizeof(struct iwl_rxon_cmd), &ctx->staging); |
500 | if (ret) { | 500 | if (ret) { |
501 | IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); | 501 | IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); |
@@ -610,7 +610,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv) | |||
610 | cmd.slots[0].width = cpu_to_le16(slot0); | 610 | cmd.slots[0].width = cpu_to_le16(slot0); |
611 | cmd.slots[1].width = cpu_to_le16(slot1); | 611 | cmd.slots[1].width = cpu_to_le16(slot1); |
612 | 612 | ||
613 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, CMD_SYNC, | 613 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, 0, |
614 | sizeof(cmd), &cmd); | 614 | sizeof(cmd), &cmd); |
615 | if (ret) | 615 | if (ret) |
616 | IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret); | 616 | IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret); |
@@ -823,7 +823,7 @@ static int iwl_check_rxon_cmd(struct iwl_priv *priv, | |||
823 | 823 | ||
824 | if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) | 824 | if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) |
825 | == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) { | 825 | == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) { |
826 | IWL_WARN(priv, "CCK and auto detect"); | 826 | IWL_WARN(priv, "CCK and auto detect\n"); |
827 | errors |= BIT(8); | 827 | errors |= BIT(8); |
828 | } | 828 | } |
829 | 829 | ||
@@ -1395,7 +1395,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv) | |||
1395 | priv->phy_calib_chain_noise_reset_cmd); | 1395 | priv->phy_calib_chain_noise_reset_cmd); |
1396 | ret = iwl_dvm_send_cmd_pdu(priv, | 1396 | ret = iwl_dvm_send_cmd_pdu(priv, |
1397 | REPLY_PHY_CALIBRATION_CMD, | 1397 | REPLY_PHY_CALIBRATION_CMD, |
1398 | CMD_SYNC, sizeof(cmd), &cmd); | 1398 | 0, sizeof(cmd), &cmd); |
1399 | if (ret) | 1399 | if (ret) |
1400 | IWL_ERR(priv, | 1400 | IWL_ERR(priv, |
1401 | "Could not send REPLY_PHY_CALIBRATION_CMD\n"); | 1401 | "Could not send REPLY_PHY_CALIBRATION_CMD\n"); |
diff --git a/drivers/net/wireless/iwlwifi/dvm/scan.c b/drivers/net/wireless/iwlwifi/dvm/scan.c index be98b913ed58..43bef901e8f9 100644 --- a/drivers/net/wireless/iwlwifi/dvm/scan.c +++ b/drivers/net/wireless/iwlwifi/dvm/scan.c | |||
@@ -59,7 +59,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv) | |||
59 | int ret; | 59 | int ret; |
60 | struct iwl_host_cmd cmd = { | 60 | struct iwl_host_cmd cmd = { |
61 | .id = REPLY_SCAN_ABORT_CMD, | 61 | .id = REPLY_SCAN_ABORT_CMD, |
62 | .flags = CMD_SYNC | CMD_WANT_SKB, | 62 | .flags = CMD_WANT_SKB, |
63 | }; | 63 | }; |
64 | __le32 *status; | 64 | __le32 *status; |
65 | 65 | ||
@@ -639,7 +639,6 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
639 | struct iwl_host_cmd cmd = { | 639 | struct iwl_host_cmd cmd = { |
640 | .id = REPLY_SCAN_CMD, | 640 | .id = REPLY_SCAN_CMD, |
641 | .len = { sizeof(struct iwl_scan_cmd), }, | 641 | .len = { sizeof(struct iwl_scan_cmd), }, |
642 | .flags = CMD_SYNC, | ||
643 | }; | 642 | }; |
644 | struct iwl_scan_cmd *scan; | 643 | struct iwl_scan_cmd *scan; |
645 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | 644 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c index 9cdd91cdf661..6ec86adbe4a1 100644 --- a/drivers/net/wireless/iwlwifi/dvm/sta.c +++ b/drivers/net/wireless/iwlwifi/dvm/sta.c | |||
@@ -39,7 +39,7 @@ static int iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) | |||
39 | lockdep_assert_held(&priv->sta_lock); | 39 | lockdep_assert_held(&priv->sta_lock); |
40 | 40 | ||
41 | if (sta_id >= IWLAGN_STATION_COUNT) { | 41 | if (sta_id >= IWLAGN_STATION_COUNT) { |
42 | IWL_ERR(priv, "invalid sta_id %u", sta_id); | 42 | IWL_ERR(priv, "invalid sta_id %u\n", sta_id); |
43 | return -EINVAL; | 43 | return -EINVAL; |
44 | } | 44 | } |
45 | if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) | 45 | if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) |
@@ -165,7 +165,7 @@ int iwl_send_add_sta(struct iwl_priv *priv, | |||
165 | iwl_free_resp(&cmd); | 165 | iwl_free_resp(&cmd); |
166 | 166 | ||
167 | if (cmd.handler_status) | 167 | if (cmd.handler_status) |
168 | IWL_ERR(priv, "%s - error in the CMD response %d", __func__, | 168 | IWL_ERR(priv, "%s - error in the CMD response %d\n", __func__, |
169 | cmd.handler_status); | 169 | cmd.handler_status); |
170 | 170 | ||
171 | return cmd.handler_status; | 171 | return cmd.handler_status; |
@@ -261,7 +261,7 @@ int iwl_sta_update_ht(struct iwl_priv *priv, struct iwl_rxon_context *ctx, | |||
261 | cmd.station_flags = flags; | 261 | cmd.station_flags = flags; |
262 | cmd.sta.sta_id = sta_id; | 262 | cmd.sta.sta_id = sta_id; |
263 | 263 | ||
264 | return iwl_send_add_sta(priv, &cmd, CMD_SYNC); | 264 | return iwl_send_add_sta(priv, &cmd, 0); |
265 | } | 265 | } |
266 | 266 | ||
267 | static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, | 267 | static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, |
@@ -413,7 +413,7 @@ int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx, | |||
413 | spin_unlock_bh(&priv->sta_lock); | 413 | spin_unlock_bh(&priv->sta_lock); |
414 | 414 | ||
415 | /* Add station to device's station table */ | 415 | /* Add station to device's station table */ |
416 | ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 416 | ret = iwl_send_add_sta(priv, &sta_cmd, 0); |
417 | if (ret) { | 417 | if (ret) { |
418 | spin_lock_bh(&priv->sta_lock); | 418 | spin_lock_bh(&priv->sta_lock); |
419 | IWL_ERR(priv, "Adding station %pM failed.\n", | 419 | IWL_ERR(priv, "Adding station %pM failed.\n", |
@@ -456,7 +456,6 @@ static int iwl_send_remove_station(struct iwl_priv *priv, | |||
456 | struct iwl_host_cmd cmd = { | 456 | struct iwl_host_cmd cmd = { |
457 | .id = REPLY_REMOVE_STA, | 457 | .id = REPLY_REMOVE_STA, |
458 | .len = { sizeof(struct iwl_rem_sta_cmd), }, | 458 | .len = { sizeof(struct iwl_rem_sta_cmd), }, |
459 | .flags = CMD_SYNC, | ||
460 | .data = { &rm_sta_cmd, }, | 459 | .data = { &rm_sta_cmd, }, |
461 | }; | 460 | }; |
462 | 461 | ||
@@ -740,7 +739,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
740 | send_lq = true; | 739 | send_lq = true; |
741 | } | 740 | } |
742 | spin_unlock_bh(&priv->sta_lock); | 741 | spin_unlock_bh(&priv->sta_lock); |
743 | ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 742 | ret = iwl_send_add_sta(priv, &sta_cmd, 0); |
744 | if (ret) { | 743 | if (ret) { |
745 | spin_lock_bh(&priv->sta_lock); | 744 | spin_lock_bh(&priv->sta_lock); |
746 | IWL_ERR(priv, "Adding station %pM failed.\n", | 745 | IWL_ERR(priv, "Adding station %pM failed.\n", |
@@ -756,8 +755,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
756 | * current LQ command | 755 | * current LQ command |
757 | */ | 756 | */ |
758 | if (send_lq) | 757 | if (send_lq) |
759 | iwl_send_lq_cmd(priv, ctx, &lq, | 758 | iwl_send_lq_cmd(priv, ctx, &lq, 0, true); |
760 | CMD_SYNC, true); | ||
761 | spin_lock_bh(&priv->sta_lock); | 759 | spin_lock_bh(&priv->sta_lock); |
762 | priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; | 760 | priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; |
763 | } | 761 | } |
@@ -968,7 +966,7 @@ int iwlagn_add_bssid_station(struct iwl_priv *priv, | |||
968 | return -ENOMEM; | 966 | return -ENOMEM; |
969 | } | 967 | } |
970 | 968 | ||
971 | ret = iwl_send_lq_cmd(priv, ctx, link_cmd, CMD_SYNC, true); | 969 | ret = iwl_send_lq_cmd(priv, ctx, link_cmd, 0, true); |
972 | if (ret) | 970 | if (ret) |
973 | IWL_ERR(priv, "Link quality command failed (%d)\n", ret); | 971 | IWL_ERR(priv, "Link quality command failed (%d)\n", ret); |
974 | 972 | ||
@@ -999,7 +997,6 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, | |||
999 | struct iwl_host_cmd cmd = { | 997 | struct iwl_host_cmd cmd = { |
1000 | .id = ctx->wep_key_cmd, | 998 | .id = ctx->wep_key_cmd, |
1001 | .data = { wep_cmd, }, | 999 | .data = { wep_cmd, }, |
1002 | .flags = CMD_SYNC, | ||
1003 | }; | 1000 | }; |
1004 | 1001 | ||
1005 | might_sleep(); | 1002 | might_sleep(); |
@@ -1248,7 +1245,7 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv, | |||
1248 | sta_cmd.sta.modify_mask = STA_MODIFY_KEY_MASK; | 1245 | sta_cmd.sta.modify_mask = STA_MODIFY_KEY_MASK; |
1249 | sta_cmd.mode = STA_CONTROL_MODIFY_MSK; | 1246 | sta_cmd.mode = STA_CONTROL_MODIFY_MSK; |
1250 | 1247 | ||
1251 | return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 1248 | return iwl_send_add_sta(priv, &sta_cmd, 0); |
1252 | } | 1249 | } |
1253 | 1250 | ||
1254 | int iwl_set_dynamic_key(struct iwl_priv *priv, | 1251 | int iwl_set_dynamic_key(struct iwl_priv *priv, |
@@ -1284,13 +1281,13 @@ int iwl_set_dynamic_key(struct iwl_priv *priv, | |||
1284 | ieee80211_get_key_rx_seq(keyconf, 0, &seq); | 1281 | ieee80211_get_key_rx_seq(keyconf, 0, &seq); |
1285 | ieee80211_get_tkip_rx_p1k(keyconf, addr, seq.tkip.iv32, p1k); | 1282 | ieee80211_get_tkip_rx_p1k(keyconf, addr, seq.tkip.iv32, p1k); |
1286 | ret = iwlagn_send_sta_key(priv, keyconf, sta_id, | 1283 | ret = iwlagn_send_sta_key(priv, keyconf, sta_id, |
1287 | seq.tkip.iv32, p1k, CMD_SYNC); | 1284 | seq.tkip.iv32, p1k, 0); |
1288 | break; | 1285 | break; |
1289 | case WLAN_CIPHER_SUITE_CCMP: | 1286 | case WLAN_CIPHER_SUITE_CCMP: |
1290 | case WLAN_CIPHER_SUITE_WEP40: | 1287 | case WLAN_CIPHER_SUITE_WEP40: |
1291 | case WLAN_CIPHER_SUITE_WEP104: | 1288 | case WLAN_CIPHER_SUITE_WEP104: |
1292 | ret = iwlagn_send_sta_key(priv, keyconf, sta_id, | 1289 | ret = iwlagn_send_sta_key(priv, keyconf, sta_id, |
1293 | 0, NULL, CMD_SYNC); | 1290 | 0, NULL, 0); |
1294 | break; | 1291 | break; |
1295 | default: | 1292 | default: |
1296 | IWL_ERR(priv, "Unknown cipher %x\n", keyconf->cipher); | 1293 | IWL_ERR(priv, "Unknown cipher %x\n", keyconf->cipher); |
@@ -1409,7 +1406,7 @@ int iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid) | |||
1409 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); | 1406 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); |
1410 | spin_unlock_bh(&priv->sta_lock); | 1407 | spin_unlock_bh(&priv->sta_lock); |
1411 | 1408 | ||
1412 | return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 1409 | return iwl_send_add_sta(priv, &sta_cmd, 0); |
1413 | } | 1410 | } |
1414 | 1411 | ||
1415 | int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, | 1412 | int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, |
@@ -1433,7 +1430,7 @@ int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, | |||
1433 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); | 1430 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); |
1434 | spin_unlock_bh(&priv->sta_lock); | 1431 | spin_unlock_bh(&priv->sta_lock); |
1435 | 1432 | ||
1436 | return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 1433 | return iwl_send_add_sta(priv, &sta_cmd, 0); |
1437 | } | 1434 | } |
1438 | 1435 | ||
1439 | int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, | 1436 | int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, |
@@ -1458,7 +1455,7 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, | |||
1458 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); | 1455 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); |
1459 | spin_unlock_bh(&priv->sta_lock); | 1456 | spin_unlock_bh(&priv->sta_lock); |
1460 | 1457 | ||
1461 | return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 1458 | return iwl_send_add_sta(priv, &sta_cmd, 0); |
1462 | } | 1459 | } |
1463 | 1460 | ||
1464 | 1461 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/tt.c b/drivers/net/wireless/iwlwifi/dvm/tt.c index 058c5892c427..acb981a0a0aa 100644 --- a/drivers/net/wireless/iwlwifi/dvm/tt.c +++ b/drivers/net/wireless/iwlwifi/dvm/tt.c | |||
@@ -236,7 +236,7 @@ static void iwl_prepare_ct_kill_task(struct iwl_priv *priv) | |||
236 | { | 236 | { |
237 | IWL_DEBUG_TEMP(priv, "Prepare to enter IWL_TI_CT_KILL\n"); | 237 | IWL_DEBUG_TEMP(priv, "Prepare to enter IWL_TI_CT_KILL\n"); |
238 | /* make request to retrieve statistics information */ | 238 | /* make request to retrieve statistics information */ |
239 | iwl_send_statistics_request(priv, CMD_SYNC, false); | 239 | iwl_send_statistics_request(priv, 0, false); |
240 | /* Reschedule the ct_kill wait timer */ | 240 | /* Reschedule the ct_kill wait timer */ |
241 | mod_timer(&priv->thermal_throttle.ct_kill_waiting_tm, | 241 | mod_timer(&priv->thermal_throttle.ct_kill_waiting_tm, |
242 | jiffies + msecs_to_jiffies(CT_KILL_WAITING_DURATION)); | 242 | jiffies + msecs_to_jiffies(CT_KILL_WAITING_DURATION)); |
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c index 398dd096674c..3255a1723d17 100644 --- a/drivers/net/wireless/iwlwifi/dvm/tx.c +++ b/drivers/net/wireless/iwlwifi/dvm/tx.c | |||
@@ -402,10 +402,10 @@ int iwlagn_tx_skb(struct iwl_priv *priv, | |||
402 | /* aggregation is on for this <sta,tid> */ | 402 | /* aggregation is on for this <sta,tid> */ |
403 | if (info->flags & IEEE80211_TX_CTL_AMPDU && | 403 | if (info->flags & IEEE80211_TX_CTL_AMPDU && |
404 | tid_data->agg.state != IWL_AGG_ON) { | 404 | tid_data->agg.state != IWL_AGG_ON) { |
405 | IWL_ERR(priv, "TX_CTL_AMPDU while not in AGG:" | 405 | IWL_ERR(priv, |
406 | " Tx flags = 0x%08x, agg.state = %d", | 406 | "TX_CTL_AMPDU while not in AGG: Tx flags = 0x%08x, agg.state = %d\n", |
407 | info->flags, tid_data->agg.state); | 407 | info->flags, tid_data->agg.state); |
408 | IWL_ERR(priv, "sta_id = %d, tid = %d seq_num = %d", | 408 | IWL_ERR(priv, "sta_id = %d, tid = %d seq_num = %d\n", |
409 | sta_id, tid, | 409 | sta_id, tid, |
410 | IEEE80211_SEQ_TO_SN(tid_data->seq_number)); | 410 | IEEE80211_SEQ_TO_SN(tid_data->seq_number)); |
411 | goto drop_unlock_sta; | 411 | goto drop_unlock_sta; |
@@ -416,7 +416,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, | |||
416 | */ | 416 | */ |
417 | if (WARN_ONCE(tid_data->agg.state != IWL_AGG_ON && | 417 | if (WARN_ONCE(tid_data->agg.state != IWL_AGG_ON && |
418 | tid_data->agg.state != IWL_AGG_OFF, | 418 | tid_data->agg.state != IWL_AGG_OFF, |
419 | "Tx while agg.state = %d", tid_data->agg.state)) | 419 | "Tx while agg.state = %d\n", tid_data->agg.state)) |
420 | goto drop_unlock_sta; | 420 | goto drop_unlock_sta; |
421 | 421 | ||
422 | seq_number = tid_data->seq_number; | 422 | seq_number = tid_data->seq_number; |
@@ -778,8 +778,8 @@ static void iwlagn_check_ratid_empty(struct iwl_priv *priv, int sta_id, u8 tid) | |||
778 | /* There are no packets for this RA / TID in the HW any more */ | 778 | /* There are no packets for this RA / TID in the HW any more */ |
779 | if (tid_data->agg.ssn == tid_data->next_reclaimed) { | 779 | if (tid_data->agg.ssn == tid_data->next_reclaimed) { |
780 | IWL_DEBUG_TX_QUEUES(priv, | 780 | IWL_DEBUG_TX_QUEUES(priv, |
781 | "Can continue DELBA flow ssn = next_recl =" | 781 | "Can continue DELBA flow ssn = next_recl = %d\n", |
782 | " %d", tid_data->next_reclaimed); | 782 | tid_data->next_reclaimed); |
783 | iwl_trans_txq_disable(priv->trans, | 783 | iwl_trans_txq_disable(priv->trans, |
784 | tid_data->agg.txq_id); | 784 | tid_data->agg.txq_id); |
785 | iwlagn_dealloc_agg_txq(priv, tid_data->agg.txq_id); | 785 | iwlagn_dealloc_agg_txq(priv, tid_data->agg.txq_id); |
@@ -791,8 +791,8 @@ static void iwlagn_check_ratid_empty(struct iwl_priv *priv, int sta_id, u8 tid) | |||
791 | /* There are no packets for this RA / TID in the HW any more */ | 791 | /* There are no packets for this RA / TID in the HW any more */ |
792 | if (tid_data->agg.ssn == tid_data->next_reclaimed) { | 792 | if (tid_data->agg.ssn == tid_data->next_reclaimed) { |
793 | IWL_DEBUG_TX_QUEUES(priv, | 793 | IWL_DEBUG_TX_QUEUES(priv, |
794 | "Can continue ADDBA flow ssn = next_recl =" | 794 | "Can continue ADDBA flow ssn = next_recl = %d\n", |
795 | " %d", tid_data->next_reclaimed); | 795 | tid_data->next_reclaimed); |
796 | tid_data->agg.state = IWL_AGG_STARTING; | 796 | tid_data->agg.state = IWL_AGG_STARTING; |
797 | ieee80211_start_tx_ba_cb_irqsafe(vif, addr, tid); | 797 | ieee80211_start_tx_ba_cb_irqsafe(vif, addr, tid); |
798 | } | 798 | } |
@@ -1216,8 +1216,8 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, | |||
1216 | ctx->vif->type == NL80211_IFTYPE_STATION) { | 1216 | ctx->vif->type == NL80211_IFTYPE_STATION) { |
1217 | /* block and stop all queues */ | 1217 | /* block and stop all queues */ |
1218 | priv->passive_no_rx = true; | 1218 | priv->passive_no_rx = true; |
1219 | IWL_DEBUG_TX_QUEUES(priv, "stop all queues: " | 1219 | IWL_DEBUG_TX_QUEUES(priv, |
1220 | "passive channel"); | 1220 | "stop all queues: passive channel\n"); |
1221 | ieee80211_stop_queues(priv->hw); | 1221 | ieee80211_stop_queues(priv->hw); |
1222 | 1222 | ||
1223 | IWL_DEBUG_TX_REPLY(priv, | 1223 | IWL_DEBUG_TX_REPLY(priv, |
@@ -1271,7 +1271,7 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, | |||
1271 | 1271 | ||
1272 | while (!skb_queue_empty(&skbs)) { | 1272 | while (!skb_queue_empty(&skbs)) { |
1273 | skb = __skb_dequeue(&skbs); | 1273 | skb = __skb_dequeue(&skbs); |
1274 | ieee80211_tx_status_ni(priv->hw, skb); | 1274 | ieee80211_tx_status(priv->hw, skb); |
1275 | } | 1275 | } |
1276 | 1276 | ||
1277 | return 0; | 1277 | return 0; |
@@ -1411,7 +1411,7 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1411 | 1411 | ||
1412 | while (!skb_queue_empty(&reclaimed_skbs)) { | 1412 | while (!skb_queue_empty(&reclaimed_skbs)) { |
1413 | skb = __skb_dequeue(&reclaimed_skbs); | 1413 | skb = __skb_dequeue(&reclaimed_skbs); |
1414 | ieee80211_tx_status_ni(priv->hw, skb); | 1414 | ieee80211_tx_status(priv->hw, skb); |
1415 | } | 1415 | } |
1416 | 1416 | ||
1417 | return 0; | 1417 | return 0; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c index cf03ef5619d9..d5cee1530597 100644 --- a/drivers/net/wireless/iwlwifi/dvm/ucode.c +++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c | |||
@@ -172,7 +172,7 @@ static int iwl_send_wimax_coex(struct iwl_priv *priv) | |||
172 | memset(&coex_cmd, 0, sizeof(coex_cmd)); | 172 | memset(&coex_cmd, 0, sizeof(coex_cmd)); |
173 | 173 | ||
174 | return iwl_dvm_send_cmd_pdu(priv, | 174 | return iwl_dvm_send_cmd_pdu(priv, |
175 | COEX_PRIORITY_TABLE_CMD, CMD_SYNC, | 175 | COEX_PRIORITY_TABLE_CMD, 0, |
176 | sizeof(coex_cmd), &coex_cmd); | 176 | sizeof(coex_cmd), &coex_cmd); |
177 | } | 177 | } |
178 | 178 | ||
@@ -205,7 +205,7 @@ void iwl_send_prio_tbl(struct iwl_priv *priv) | |||
205 | memcpy(prio_tbl_cmd.prio_tbl, iwl_bt_prio_tbl, | 205 | memcpy(prio_tbl_cmd.prio_tbl, iwl_bt_prio_tbl, |
206 | sizeof(iwl_bt_prio_tbl)); | 206 | sizeof(iwl_bt_prio_tbl)); |
207 | if (iwl_dvm_send_cmd_pdu(priv, | 207 | if (iwl_dvm_send_cmd_pdu(priv, |
208 | REPLY_BT_COEX_PRIO_TABLE, CMD_SYNC, | 208 | REPLY_BT_COEX_PRIO_TABLE, 0, |
209 | sizeof(prio_tbl_cmd), &prio_tbl_cmd)) | 209 | sizeof(prio_tbl_cmd), &prio_tbl_cmd)) |
210 | IWL_ERR(priv, "failed to send BT prio tbl command\n"); | 210 | IWL_ERR(priv, "failed to send BT prio tbl command\n"); |
211 | } | 211 | } |
@@ -218,7 +218,7 @@ int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type) | |||
218 | env_cmd.action = action; | 218 | env_cmd.action = action; |
219 | env_cmd.type = type; | 219 | env_cmd.type = type; |
220 | ret = iwl_dvm_send_cmd_pdu(priv, | 220 | ret = iwl_dvm_send_cmd_pdu(priv, |
221 | REPLY_BT_COEX_PROT_ENV, CMD_SYNC, | 221 | REPLY_BT_COEX_PROT_ENV, 0, |
222 | sizeof(env_cmd), &env_cmd); | 222 | sizeof(env_cmd), &env_cmd); |
223 | if (ret) | 223 | if (ret) |
224 | IWL_ERR(priv, "failed to send BT env command\n"); | 224 | IWL_ERR(priv, "failed to send BT env command\n"); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index 854ba84ccb73..c3817fae16c0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -62,6 +62,7 @@ static const struct iwl_base_params iwl1000_base_params = { | |||
62 | .led_compensation = 51, | 62 | .led_compensation = 51, |
63 | .wd_timeout = IWL_WATCHDOG_DISABLED, | 63 | .wd_timeout = IWL_WATCHDOG_DISABLED, |
64 | .max_event_log_size = 128, | 64 | .max_event_log_size = 128, |
65 | .scd_chain_ext_wa = true, | ||
65 | }; | 66 | }; |
66 | 67 | ||
67 | static const struct iwl_ht_params iwl1000_ht_params = { | 68 | static const struct iwl_ht_params iwl1000_ht_params = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c index 3e63323637f3..21e5d0843a62 100644 --- a/drivers/net/wireless/iwlwifi/iwl-2000.c +++ b/drivers/net/wireless/iwlwifi/iwl-2000.c | |||
@@ -75,6 +75,7 @@ static const struct iwl_base_params iwl2000_base_params = { | |||
75 | .wd_timeout = IWL_DEF_WD_TIMEOUT, | 75 | .wd_timeout = IWL_DEF_WD_TIMEOUT, |
76 | .max_event_log_size = 512, | 76 | .max_event_log_size = 512, |
77 | .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ | 77 | .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ |
78 | .scd_chain_ext_wa = true, | ||
78 | }; | 79 | }; |
79 | 80 | ||
80 | 81 | ||
@@ -88,6 +89,7 @@ static const struct iwl_base_params iwl2030_base_params = { | |||
88 | .wd_timeout = IWL_LONG_WD_TIMEOUT, | 89 | .wd_timeout = IWL_LONG_WD_TIMEOUT, |
89 | .max_event_log_size = 512, | 90 | .max_event_log_size = 512, |
90 | .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ | 91 | .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ |
92 | .scd_chain_ext_wa = true, | ||
91 | }; | 93 | }; |
92 | 94 | ||
93 | static const struct iwl_ht_params iwl2000_ht_params = { | 95 | static const struct iwl_ht_params iwl2000_ht_params = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 6674f2c4541c..332bbede39e5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -61,6 +61,7 @@ static const struct iwl_base_params iwl5000_base_params = { | |||
61 | .led_compensation = 51, | 61 | .led_compensation = 51, |
62 | .wd_timeout = IWL_WATCHDOG_DISABLED, | 62 | .wd_timeout = IWL_WATCHDOG_DISABLED, |
63 | .max_event_log_size = 512, | 63 | .max_event_log_size = 512, |
64 | .scd_chain_ext_wa = true, | ||
64 | }; | 65 | }; |
65 | 66 | ||
66 | static const struct iwl_ht_params iwl5000_ht_params = { | 67 | static const struct iwl_ht_params iwl5000_ht_params = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 8048de90233f..8f2c3c8c6b84 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -85,6 +85,7 @@ static const struct iwl_base_params iwl6000_base_params = { | |||
85 | .wd_timeout = IWL_DEF_WD_TIMEOUT, | 85 | .wd_timeout = IWL_DEF_WD_TIMEOUT, |
86 | .max_event_log_size = 512, | 86 | .max_event_log_size = 512, |
87 | .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ | 87 | .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ |
88 | .scd_chain_ext_wa = true, | ||
88 | }; | 89 | }; |
89 | 90 | ||
90 | static const struct iwl_base_params iwl6050_base_params = { | 91 | static const struct iwl_base_params iwl6050_base_params = { |
@@ -97,6 +98,7 @@ static const struct iwl_base_params iwl6050_base_params = { | |||
97 | .wd_timeout = IWL_DEF_WD_TIMEOUT, | 98 | .wd_timeout = IWL_DEF_WD_TIMEOUT, |
98 | .max_event_log_size = 1024, | 99 | .max_event_log_size = 1024, |
99 | .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ | 100 | .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ |
101 | .scd_chain_ext_wa = true, | ||
100 | }; | 102 | }; |
101 | 103 | ||
102 | static const struct iwl_base_params iwl6000_g2_base_params = { | 104 | static const struct iwl_base_params iwl6000_g2_base_params = { |
@@ -109,6 +111,7 @@ static const struct iwl_base_params iwl6000_g2_base_params = { | |||
109 | .wd_timeout = IWL_LONG_WD_TIMEOUT, | 111 | .wd_timeout = IWL_LONG_WD_TIMEOUT, |
110 | .max_event_log_size = 512, | 112 | .max_event_log_size = 512, |
111 | .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ | 113 | .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ |
114 | .scd_chain_ext_wa = true, | ||
112 | }; | 115 | }; |
113 | 116 | ||
114 | static const struct iwl_ht_params iwl6000_ht_params = { | 117 | static const struct iwl_ht_params iwl6000_ht_params = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c index 4c2d4ef28b22..48730064da73 100644 --- a/drivers/net/wireless/iwlwifi/iwl-7000.c +++ b/drivers/net/wireless/iwlwifi/iwl-7000.c | |||
@@ -71,12 +71,12 @@ | |||
71 | #define IWL3160_UCODE_API_MAX 9 | 71 | #define IWL3160_UCODE_API_MAX 9 |
72 | 72 | ||
73 | /* Oldest version we won't warn about */ | 73 | /* Oldest version we won't warn about */ |
74 | #define IWL7260_UCODE_API_OK 8 | 74 | #define IWL7260_UCODE_API_OK 9 |
75 | #define IWL3160_UCODE_API_OK 8 | 75 | #define IWL3160_UCODE_API_OK 9 |
76 | 76 | ||
77 | /* Lowest firmware API version supported */ | 77 | /* Lowest firmware API version supported */ |
78 | #define IWL7260_UCODE_API_MIN 7 | 78 | #define IWL7260_UCODE_API_MIN 8 |
79 | #define IWL3160_UCODE_API_MIN 7 | 79 | #define IWL3160_UCODE_API_MIN 8 |
80 | 80 | ||
81 | /* NVM versions */ | 81 | /* NVM versions */ |
82 | #define IWL7260_NVM_VERSION 0x0a1d | 82 | #define IWL7260_NVM_VERSION 0x0a1d |
@@ -98,7 +98,7 @@ | |||
98 | #define NVM_HW_SECTION_NUM_FAMILY_7000 0 | 98 | #define NVM_HW_SECTION_NUM_FAMILY_7000 0 |
99 | 99 | ||
100 | static const struct iwl_base_params iwl7000_base_params = { | 100 | static const struct iwl_base_params iwl7000_base_params = { |
101 | .eeprom_size = OTP_LOW_IMAGE_SIZE, | 101 | .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_7000, |
102 | .num_of_queues = IWLAGN_NUM_QUEUES, | 102 | .num_of_queues = IWLAGN_NUM_QUEUES, |
103 | .pll_cfg_val = 0, | 103 | .pll_cfg_val = 0, |
104 | .shadow_ram_support = true, | 104 | .shadow_ram_support = true, |
@@ -107,6 +107,7 @@ static const struct iwl_base_params iwl7000_base_params = { | |||
107 | .max_event_log_size = 512, | 107 | .max_event_log_size = 512, |
108 | .shadow_reg_enable = true, | 108 | .shadow_reg_enable = true, |
109 | .pcie_l1_allowed = true, | 109 | .pcie_l1_allowed = true, |
110 | .apmg_wake_up_wa = true, | ||
110 | }; | 111 | }; |
111 | 112 | ||
112 | static const struct iwl_ht_params iwl7000_ht_params = { | 113 | static const struct iwl_ht_params iwl7000_ht_params = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-8000.c b/drivers/net/wireless/iwlwifi/iwl-8000.c index f5bd82b88592..51c41531d81d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-8000.c +++ b/drivers/net/wireless/iwlwifi/iwl-8000.c | |||
@@ -83,9 +83,10 @@ | |||
83 | #define IWL8000_MODULE_FIRMWARE(api) IWL8000_FW_PRE __stringify(api) ".ucode" | 83 | #define IWL8000_MODULE_FIRMWARE(api) IWL8000_FW_PRE __stringify(api) ".ucode" |
84 | 84 | ||
85 | #define NVM_HW_SECTION_NUM_FAMILY_8000 10 | 85 | #define NVM_HW_SECTION_NUM_FAMILY_8000 10 |
86 | #define DEFAULT_NVM_FILE_FAMILY_8000 "iwl_nvm_8000.bin" | ||
86 | 87 | ||
87 | static const struct iwl_base_params iwl8000_base_params = { | 88 | static const struct iwl_base_params iwl8000_base_params = { |
88 | .eeprom_size = OTP_LOW_IMAGE_SIZE, | 89 | .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_8000, |
89 | .num_of_queues = IWLAGN_NUM_QUEUES, | 90 | .num_of_queues = IWLAGN_NUM_QUEUES, |
90 | .pll_cfg_val = 0, | 91 | .pll_cfg_val = 0, |
91 | .shadow_ram_support = true, | 92 | .shadow_ram_support = true, |
@@ -118,6 +119,7 @@ const struct iwl_cfg iwl8260_2ac_cfg = { | |||
118 | .ht_params = &iwl8000_ht_params, | 119 | .ht_params = &iwl8000_ht_params, |
119 | .nvm_ver = IWL8000_NVM_VERSION, | 120 | .nvm_ver = IWL8000_NVM_VERSION, |
120 | .nvm_calib_ver = IWL8000_TX_POWER_VERSION, | 121 | .nvm_calib_ver = IWL8000_TX_POWER_VERSION, |
122 | .default_nvm_file = DEFAULT_NVM_FILE_FAMILY_8000, | ||
121 | }; | 123 | }; |
122 | 124 | ||
123 | const struct iwl_cfg iwl8260_n_cfg = { | 125 | const struct iwl_cfg iwl8260_n_cfg = { |
@@ -127,6 +129,7 @@ const struct iwl_cfg iwl8260_n_cfg = { | |||
127 | .ht_params = &iwl8000_ht_params, | 129 | .ht_params = &iwl8000_ht_params, |
128 | .nvm_ver = IWL8000_NVM_VERSION, | 130 | .nvm_ver = IWL8000_NVM_VERSION, |
129 | .nvm_calib_ver = IWL8000_TX_POWER_VERSION, | 131 | .nvm_calib_ver = IWL8000_TX_POWER_VERSION, |
132 | .default_nvm_file = DEFAULT_NVM_FILE_FAMILY_8000, | ||
130 | }; | 133 | }; |
131 | 134 | ||
132 | MODULE_FIRMWARE(IWL8000_MODULE_FIRMWARE(IWL8000_UCODE_API_OK)); | 135 | MODULE_FIRMWARE(IWL8000_MODULE_FIRMWARE(IWL8000_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hw.h b/drivers/net/wireless/iwlwifi/iwl-agn-hw.h index 7f37fb86837b..04a483d38659 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn-hw.h | |||
@@ -102,9 +102,7 @@ | |||
102 | 102 | ||
103 | /* EEPROM */ | 103 | /* EEPROM */ |
104 | #define IWLAGN_EEPROM_IMG_SIZE 2048 | 104 | #define IWLAGN_EEPROM_IMG_SIZE 2048 |
105 | /* OTP */ | 105 | |
106 | /* lower blocks contain EEPROM image and calibration data */ | ||
107 | #define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */ | ||
108 | /* high blocks contain PAPD data */ | 106 | /* high blocks contain PAPD data */ |
109 | #define OTP_HIGH_IMAGE_SIZE_6x00 (6 * 512 * sizeof(u16)) /* 6 KB */ | 107 | #define OTP_HIGH_IMAGE_SIZE_6x00 (6 * 512 * sizeof(u16)) /* 6 KB */ |
110 | #define OTP_HIGH_IMAGE_SIZE_1000 (0x200 * sizeof(u16)) /* 1024 bytes */ | 108 | #define OTP_HIGH_IMAGE_SIZE_1000 (0x200 * sizeof(u16)) /* 1024 bytes */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h index 3f17dc3f2c8a..b7047905f41a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-config.h +++ b/drivers/net/wireless/iwlwifi/iwl-config.h | |||
@@ -146,6 +146,9 @@ static inline u8 num_of_ant(u8 mask) | |||
146 | * @wd_timeout: TX queues watchdog timeout | 146 | * @wd_timeout: TX queues watchdog timeout |
147 | * @max_event_log_size: size of event log buffer size for ucode event logging | 147 | * @max_event_log_size: size of event log buffer size for ucode event logging |
148 | * @shadow_reg_enable: HW shadow register support | 148 | * @shadow_reg_enable: HW shadow register support |
149 | * @apmg_wake_up_wa: should the MAC access REQ be asserted when a command | ||
150 | * is in flight. This is due to a HW bug in 7260, 3160 and 7265. | ||
151 | * @scd_chain_ext_wa: should the chain extension feature in SCD be disabled. | ||
149 | */ | 152 | */ |
150 | struct iwl_base_params { | 153 | struct iwl_base_params { |
151 | int eeprom_size; | 154 | int eeprom_size; |
@@ -160,6 +163,8 @@ struct iwl_base_params { | |||
160 | u32 max_event_log_size; | 163 | u32 max_event_log_size; |
161 | const bool shadow_reg_enable; | 164 | const bool shadow_reg_enable; |
162 | const bool pcie_l1_allowed; | 165 | const bool pcie_l1_allowed; |
166 | const bool apmg_wake_up_wa; | ||
167 | const bool scd_chain_ext_wa; | ||
163 | }; | 168 | }; |
164 | 169 | ||
165 | /* | 170 | /* |
@@ -188,6 +193,11 @@ struct iwl_ht_params { | |||
188 | #define EEPROM_6000_REG_BAND_24_HT40_CHANNELS 0x80 | 193 | #define EEPROM_6000_REG_BAND_24_HT40_CHANNELS 0x80 |
189 | #define EEPROM_REGULATORY_BAND_NO_HT40 0 | 194 | #define EEPROM_REGULATORY_BAND_NO_HT40 0 |
190 | 195 | ||
196 | /* lower blocks contain EEPROM image and calibration data */ | ||
197 | #define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */ | ||
198 | #define OTP_LOW_IMAGE_SIZE_FAMILY_7000 (16 * 512 * sizeof(u16)) /* 16 KB */ | ||
199 | #define OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(u16)) /* 32 KB */ | ||
200 | |||
191 | struct iwl_eeprom_params { | 201 | struct iwl_eeprom_params { |
192 | const u8 regulatory_bands[7]; | 202 | const u8 regulatory_bands[7]; |
193 | bool enhanced_txpower; | 203 | bool enhanced_txpower; |
@@ -264,6 +274,8 @@ struct iwl_cfg { | |||
264 | u8 nvm_hw_section_num; | 274 | u8 nvm_hw_section_num; |
265 | bool lp_xtal_workaround; | 275 | bool lp_xtal_workaround; |
266 | const struct iwl_pwr_tx_backoff *pwr_tx_backoffs; | 276 | const struct iwl_pwr_tx_backoff *pwr_tx_backoffs; |
277 | bool no_power_up_nic_in_init; | ||
278 | const char *default_nvm_file; | ||
267 | }; | 279 | }; |
268 | 280 | ||
269 | /* | 281 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.c b/drivers/net/wireless/iwlwifi/iwl-debug.c index 8a44f594528d..09feff4fa226 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.c +++ b/drivers/net/wireless/iwlwifi/iwl-debug.c | |||
@@ -61,8 +61,6 @@ | |||
61 | * | 61 | * |
62 | *****************************************************************************/ | 62 | *****************************************************************************/ |
63 | 63 | ||
64 | #define DEBUG | ||
65 | |||
66 | #include <linux/device.h> | 64 | #include <linux/device.h> |
67 | #include <linux/interrupt.h> | 65 | #include <linux/interrupt.h> |
68 | #include <linux/export.h> | 66 | #include <linux/export.h> |
@@ -128,8 +126,8 @@ void __iwl_dbg(struct device *dev, | |||
128 | #ifdef CONFIG_IWLWIFI_DEBUG | 126 | #ifdef CONFIG_IWLWIFI_DEBUG |
129 | if (iwl_have_debug_level(level) && | 127 | if (iwl_have_debug_level(level) && |
130 | (!limit || net_ratelimit())) | 128 | (!limit || net_ratelimit())) |
131 | dev_dbg(dev, "%c %s %pV", in_interrupt() ? 'I' : 'U', | 129 | dev_printk(KERN_DEBUG, dev, "%c %s %pV", |
132 | function, &vaf); | 130 | in_interrupt() ? 'I' : 'U', function, &vaf); |
133 | #endif | 131 | #endif |
134 | trace_iwlwifi_dbg(level, in_interrupt(), function, &vaf); | 132 | trace_iwlwifi_dbg(level, in_interrupt(), function, &vaf); |
135 | va_end(args); | 133 | va_end(args); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h index c8cbdbe15924..295083510e72 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h | |||
@@ -47,12 +47,32 @@ void __iwl_warn(struct device *dev, const char *fmt, ...) __printf(2, 3); | |||
47 | void __iwl_info(struct device *dev, const char *fmt, ...) __printf(2, 3); | 47 | void __iwl_info(struct device *dev, const char *fmt, ...) __printf(2, 3); |
48 | void __iwl_crit(struct device *dev, const char *fmt, ...) __printf(2, 3); | 48 | void __iwl_crit(struct device *dev, const char *fmt, ...) __printf(2, 3); |
49 | 49 | ||
50 | /* not all compilers can evaluate strlen() at compile time, so use sizeof() */ | ||
51 | #define CHECK_FOR_NEWLINE(f) BUILD_BUG_ON(f[sizeof(f) - 2] != '\n') | ||
52 | |||
50 | /* No matter what is m (priv, bus, trans), this will work */ | 53 | /* No matter what is m (priv, bus, trans), this will work */ |
51 | #define IWL_ERR(m, f, a...) __iwl_err((m)->dev, false, false, f, ## a) | 54 | #define IWL_ERR_DEV(d, f, a...) \ |
52 | #define IWL_ERR_DEV(d, f, a...) __iwl_err((d), false, false, f, ## a) | 55 | do { \ |
53 | #define IWL_WARN(m, f, a...) __iwl_warn((m)->dev, f, ## a) | 56 | CHECK_FOR_NEWLINE(f); \ |
54 | #define IWL_INFO(m, f, a...) __iwl_info((m)->dev, f, ## a) | 57 | __iwl_err((d), false, false, f, ## a); \ |
55 | #define IWL_CRIT(m, f, a...) __iwl_crit((m)->dev, f, ## a) | 58 | } while (0) |
59 | #define IWL_ERR(m, f, a...) \ | ||
60 | IWL_ERR_DEV((m)->dev, f, ## a) | ||
61 | #define IWL_WARN(m, f, a...) \ | ||
62 | do { \ | ||
63 | CHECK_FOR_NEWLINE(f); \ | ||
64 | __iwl_warn((m)->dev, f, ## a); \ | ||
65 | } while (0) | ||
66 | #define IWL_INFO(m, f, a...) \ | ||
67 | do { \ | ||
68 | CHECK_FOR_NEWLINE(f); \ | ||
69 | __iwl_info((m)->dev, f, ## a); \ | ||
70 | } while (0) | ||
71 | #define IWL_CRIT(m, f, a...) \ | ||
72 | do { \ | ||
73 | CHECK_FOR_NEWLINE(f); \ | ||
74 | __iwl_crit((m)->dev, f, ## a); \ | ||
75 | } while (0) | ||
56 | 76 | ||
57 | #if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING) | 77 | #if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING) |
58 | void __iwl_dbg(struct device *dev, | 78 | void __iwl_dbg(struct device *dev, |
@@ -72,12 +92,17 @@ do { \ | |||
72 | DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ | 92 | DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ |
73 | } while (0) | 93 | } while (0) |
74 | 94 | ||
95 | #define __IWL_DEBUG_DEV(dev, level, limit, fmt, args...) \ | ||
96 | do { \ | ||
97 | CHECK_FOR_NEWLINE(fmt); \ | ||
98 | __iwl_dbg(dev, level, limit, __func__, fmt, ##args); \ | ||
99 | } while (0) | ||
75 | #define IWL_DEBUG(m, level, fmt, args...) \ | 100 | #define IWL_DEBUG(m, level, fmt, args...) \ |
76 | __iwl_dbg((m)->dev, level, false, __func__, fmt, ##args) | 101 | __IWL_DEBUG_DEV((m)->dev, level, false, fmt, ##args) |
77 | #define IWL_DEBUG_DEV(dev, level, fmt, args...) \ | 102 | #define IWL_DEBUG_DEV(dev, level, fmt, args...) \ |
78 | __iwl_dbg((dev), level, false, __func__, fmt, ##args) | 103 | __IWL_DEBUG_DEV(dev, level, false, fmt, ##args) |
79 | #define IWL_DEBUG_LIMIT(m, level, fmt, args...) \ | 104 | #define IWL_DEBUG_LIMIT(m, level, fmt, args...) \ |
80 | __iwl_dbg((m)->dev, level, true, __func__, fmt, ##args) | 105 | __IWL_DEBUG_DEV((m)->dev, level, true, fmt, ##args) |
81 | 106 | ||
82 | #ifdef CONFIG_IWLWIFI_DEBUG | 107 | #ifdef CONFIG_IWLWIFI_DEBUG |
83 | #define iwl_print_hex_dump(m, level, p, len) \ | 108 | #define iwl_print_hex_dump(m, level, p, len) \ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c index 0a3e841b44a9..f2a5c12269a3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/iwlwifi/iwl-drv.c | |||
@@ -1243,6 +1243,7 @@ struct iwl_mod_params iwlwifi_mod_params = { | |||
1243 | .bt_coex_active = true, | 1243 | .bt_coex_active = true, |
1244 | .power_level = IWL_POWER_INDEX_1, | 1244 | .power_level = IWL_POWER_INDEX_1, |
1245 | .wd_disable = true, | 1245 | .wd_disable = true, |
1246 | .uapsd_disable = false, | ||
1246 | /* the rest are 0 by default */ | 1247 | /* the rest are 0 by default */ |
1247 | }; | 1248 | }; |
1248 | IWL_EXPORT_SYMBOL(iwlwifi_mod_params); | 1249 | IWL_EXPORT_SYMBOL(iwlwifi_mod_params); |
@@ -1356,6 +1357,10 @@ MODULE_PARM_DESC(wd_disable, | |||
1356 | module_param_named(nvm_file, iwlwifi_mod_params.nvm_file, charp, S_IRUGO); | 1357 | module_param_named(nvm_file, iwlwifi_mod_params.nvm_file, charp, S_IRUGO); |
1357 | MODULE_PARM_DESC(nvm_file, "NVM file name"); | 1358 | MODULE_PARM_DESC(nvm_file, "NVM file name"); |
1358 | 1359 | ||
1360 | module_param_named(uapsd_disable, iwlwifi_mod_params.uapsd_disable, | ||
1361 | bool, S_IRUGO); | ||
1362 | MODULE_PARM_DESC(uapsd_disable, "disable U-APSD functionality (default: N)"); | ||
1363 | |||
1359 | /* | 1364 | /* |
1360 | * set bt_coex_active to true, uCode will do kill/defer | 1365 | * set bt_coex_active to true, uCode will do kill/defer |
1361 | * every time the priority line is asserted (BT is sending signals on the | 1366 | * every time the priority line is asserted (BT is sending signals on the |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-error-dump.h b/drivers/net/wireless/iwlwifi/iwl-fw-error-dump.h index 58c8941c0d95..2953ffceda38 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-error-dump.h +++ b/drivers/net/wireless/iwlwifi/iwl-fw-error-dump.h | |||
@@ -71,10 +71,15 @@ | |||
71 | * enum iwl_fw_error_dump_type - types of data in the dump file | 71 | * enum iwl_fw_error_dump_type - types of data in the dump file |
72 | * @IWL_FW_ERROR_DUMP_SRAM: | 72 | * @IWL_FW_ERROR_DUMP_SRAM: |
73 | * @IWL_FW_ERROR_DUMP_REG: | 73 | * @IWL_FW_ERROR_DUMP_REG: |
74 | * @IWL_FW_ERROR_DUMP_RXF: | ||
75 | * @IWL_FW_ERROR_DUMP_TXCMD: last TX command data, structured as | ||
76 | * &struct iwl_fw_error_dump_txcmd packets | ||
74 | */ | 77 | */ |
75 | enum iwl_fw_error_dump_type { | 78 | enum iwl_fw_error_dump_type { |
76 | IWL_FW_ERROR_DUMP_SRAM = 0, | 79 | IWL_FW_ERROR_DUMP_SRAM = 0, |
77 | IWL_FW_ERROR_DUMP_REG = 1, | 80 | IWL_FW_ERROR_DUMP_REG = 1, |
81 | IWL_FW_ERROR_DUMP_RXF = 2, | ||
82 | IWL_FW_ERROR_DUMP_TXCMD = 3, | ||
78 | 83 | ||
79 | IWL_FW_ERROR_DUMP_MAX, | 84 | IWL_FW_ERROR_DUMP_MAX, |
80 | }; | 85 | }; |
@@ -89,7 +94,7 @@ struct iwl_fw_error_dump_data { | |||
89 | __le32 type; | 94 | __le32 type; |
90 | __le32 len; | 95 | __le32 len; |
91 | __u8 data[]; | 96 | __u8 data[]; |
92 | } __packed __aligned(4); | 97 | } __packed; |
93 | 98 | ||
94 | /** | 99 | /** |
95 | * struct iwl_fw_error_dump_file - the layout of the header of the file | 100 | * struct iwl_fw_error_dump_file - the layout of the header of the file |
@@ -101,6 +106,29 @@ struct iwl_fw_error_dump_file { | |||
101 | __le32 barker; | 106 | __le32 barker; |
102 | __le32 file_len; | 107 | __le32 file_len; |
103 | u8 data[0]; | 108 | u8 data[0]; |
104 | } __packed __aligned(4); | 109 | } __packed; |
110 | |||
111 | /** | ||
112 | * struct iwl_fw_error_dump_txcmd - TX command data | ||
113 | * @cmdlen: original length of command | ||
114 | * @caplen: captured length of command (may be less) | ||
115 | * @data: captured command data, @caplen bytes | ||
116 | */ | ||
117 | struct iwl_fw_error_dump_txcmd { | ||
118 | __le32 cmdlen; | ||
119 | __le32 caplen; | ||
120 | u8 data[]; | ||
121 | } __packed; | ||
122 | |||
123 | /** | ||
124 | * iwl_mvm_fw_error_next_data - advance fw error dump data pointer | ||
125 | * @data: previous data block | ||
126 | * Returns: next data block | ||
127 | */ | ||
128 | static inline struct iwl_fw_error_dump_data * | ||
129 | iwl_mvm_fw_error_next_data(struct iwl_fw_error_dump_data *data) | ||
130 | { | ||
131 | return (void *)(data->data + le32_to_cpu(data->len)); | ||
132 | } | ||
105 | 133 | ||
106 | #endif /* __fw_error_dump_h__ */ | 134 | #endif /* __fw_error_dump_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw.h b/drivers/net/wireless/iwlwifi/iwl-fw.h index d14f19339d61..0aa7c0085c9f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fw.h +++ b/drivers/net/wireless/iwlwifi/iwl-fw.h | |||
@@ -74,29 +74,24 @@ | |||
74 | * @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w). | 74 | * @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w). |
75 | * @IWL_UCODE_TLV_FLAGS_P2P: This uCode image supports P2P. | 75 | * @IWL_UCODE_TLV_FLAGS_P2P: This uCode image supports P2P. |
76 | * @IWL_UCODE_TLV_FLAGS_DW_BC_TABLE: The SCD byte count table is in DWORDS | 76 | * @IWL_UCODE_TLV_FLAGS_DW_BC_TABLE: The SCD byte count table is in DWORDS |
77 | * @IWL_UCODE_TLV_FLAGS_UAPSD: This uCode image supports uAPSD | 77 | * @IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT: This uCode image supports uAPSD |
78 | * @IWL_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of black list instead of 64 in scan | 78 | * @IWL_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of black list instead of 64 in scan |
79 | * offload profile config command. | 79 | * offload profile config command. |
80 | * @IWL_UCODE_TLV_FLAGS_RX_ENERGY_API: supports rx signal strength api | ||
81 | * @IWL_UCODE_TLV_FLAGS_TIME_EVENT_API_V2: using the new time event API. | ||
82 | * @IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS: D3 image supports up to six | 80 | * @IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS: D3 image supports up to six |
83 | * (rather than two) IPv6 addresses | 81 | * (rather than two) IPv6 addresses |
84 | * @IWL_UCODE_TLV_FLAGS_BF_UPDATED: new beacon filtering API | ||
85 | * @IWL_UCODE_TLV_FLAGS_NO_BASIC_SSID: not sending a probe with the SSID element | 82 | * @IWL_UCODE_TLV_FLAGS_NO_BASIC_SSID: not sending a probe with the SSID element |
86 | * from the probe request template. | 83 | * from the probe request template. |
87 | * @IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API: modified D3 API to allow keeping | ||
88 | * connection when going back to D0 | ||
89 | * @IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL: new NS offload (small version) | 84 | * @IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL: new NS offload (small version) |
90 | * @IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE: new NS offload (large version) | 85 | * @IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE: new NS offload (large version) |
91 | * @IWL_UCODE_TLV_FLAGS_SCHED_SCAN: this uCode image supports scheduled scan. | 86 | * @IWL_UCODE_TLV_FLAGS_P2P_PM: P2P client supports PM as a stand alone MAC |
92 | * @IWL_UCODE_TLV_FLAGS_STA_KEY_CMD: new ADD_STA and ADD_STA_KEY command API | ||
93 | * @IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD: support device wide power command | ||
94 | * containing CAM (Continuous Active Mode) indication. | ||
95 | * @IWL_UCODE_TLV_FLAGS_P2P_BSS_PS_DCM: support power save on BSS station and | 87 | * @IWL_UCODE_TLV_FLAGS_P2P_BSS_PS_DCM: support power save on BSS station and |
96 | * P2P client interfaces simultaneously if they are in different bindings. | 88 | * P2P client interfaces simultaneously if they are in different bindings. |
89 | * @IWL_UCODE_TLV_FLAGS_P2P_BSS_PS_SCM: support power save on BSS station and | ||
90 | * P2P client interfaces simultaneously if they are in same bindings. | ||
97 | * @IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD: P2P client supports uAPSD power save | 91 | * @IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD: P2P client supports uAPSD power save |
98 | * @IWL_UCODE_TLV_FLAGS_BCAST_FILTERING: uCode supports broadcast filtering. | 92 | * @IWL_UCODE_TLV_FLAGS_BCAST_FILTERING: uCode supports broadcast filtering. |
99 | * @IWL_UCODE_TLV_FLAGS_GO_UAPSD: AP/GO interfaces support uAPSD clients | 93 | * @IWL_UCODE_TLV_FLAGS_GO_UAPSD: AP/GO interfaces support uAPSD clients |
94 | * @IWL_UCODE_TLV_FLAGS_EBS_SUPPORT: this uCode image supports EBS. | ||
100 | */ | 95 | */ |
101 | enum iwl_ucode_tlv_flag { | 96 | enum iwl_ucode_tlv_flag { |
102 | IWL_UCODE_TLV_FLAGS_PAN = BIT(0), | 97 | IWL_UCODE_TLV_FLAGS_PAN = BIT(0), |
@@ -104,22 +99,16 @@ enum iwl_ucode_tlv_flag { | |||
104 | IWL_UCODE_TLV_FLAGS_MFP = BIT(2), | 99 | IWL_UCODE_TLV_FLAGS_MFP = BIT(2), |
105 | IWL_UCODE_TLV_FLAGS_P2P = BIT(3), | 100 | IWL_UCODE_TLV_FLAGS_P2P = BIT(3), |
106 | IWL_UCODE_TLV_FLAGS_DW_BC_TABLE = BIT(4), | 101 | IWL_UCODE_TLV_FLAGS_DW_BC_TABLE = BIT(4), |
107 | IWL_UCODE_TLV_FLAGS_NEWBT_COEX = BIT(5), | ||
108 | IWL_UCODE_TLV_FLAGS_PM_CMD_SUPPORT = BIT(6), | ||
109 | IWL_UCODE_TLV_FLAGS_SHORT_BL = BIT(7), | 102 | IWL_UCODE_TLV_FLAGS_SHORT_BL = BIT(7), |
110 | IWL_UCODE_TLV_FLAGS_RX_ENERGY_API = BIT(8), | ||
111 | IWL_UCODE_TLV_FLAGS_TIME_EVENT_API_V2 = BIT(9), | ||
112 | IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS = BIT(10), | 103 | IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS = BIT(10), |
113 | IWL_UCODE_TLV_FLAGS_BF_UPDATED = BIT(11), | ||
114 | IWL_UCODE_TLV_FLAGS_NO_BASIC_SSID = BIT(12), | 104 | IWL_UCODE_TLV_FLAGS_NO_BASIC_SSID = BIT(12), |
115 | IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API = BIT(14), | ||
116 | IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL = BIT(15), | 105 | IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL = BIT(15), |
117 | IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE = BIT(16), | 106 | IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE = BIT(16), |
118 | IWL_UCODE_TLV_FLAGS_SCHED_SCAN = BIT(17), | 107 | IWL_UCODE_TLV_FLAGS_P2P_PM = BIT(21), |
119 | IWL_UCODE_TLV_FLAGS_STA_KEY_CMD = BIT(19), | ||
120 | IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD = BIT(20), | ||
121 | IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM = BIT(22), | 108 | IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM = BIT(22), |
109 | IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_SCM = BIT(23), | ||
122 | IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT = BIT(24), | 110 | IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT = BIT(24), |
111 | IWL_UCODE_TLV_FLAGS_EBS_SUPPORT = BIT(25), | ||
123 | IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD = BIT(26), | 112 | IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD = BIT(26), |
124 | IWL_UCODE_TLV_FLAGS_BCAST_FILTERING = BIT(29), | 113 | IWL_UCODE_TLV_FLAGS_BCAST_FILTERING = BIT(29), |
125 | IWL_UCODE_TLV_FLAGS_GO_UAPSD = BIT(30), | 114 | IWL_UCODE_TLV_FLAGS_GO_UAPSD = BIT(30), |
@@ -128,9 +117,11 @@ enum iwl_ucode_tlv_flag { | |||
128 | /** | 117 | /** |
129 | * enum iwl_ucode_tlv_api - ucode api | 118 | * enum iwl_ucode_tlv_api - ucode api |
130 | * @IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID: wowlan config includes tid field. | 119 | * @IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID: wowlan config includes tid field. |
120 | * @IWL_UCODE_TLV_API_CSA_FLOW: ucode can do unbind-bind flow for CSA. | ||
131 | */ | 121 | */ |
132 | enum iwl_ucode_tlv_api { | 122 | enum iwl_ucode_tlv_api { |
133 | IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID = BIT(0), | 123 | IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID = BIT(0), |
124 | IWL_UCODE_TLV_API_CSA_FLOW = BIT(4), | ||
134 | }; | 125 | }; |
135 | 126 | ||
136 | /** | 127 | /** |
@@ -183,6 +174,7 @@ enum iwl_ucode_sec { | |||
183 | #define IWL_UCODE_SECTION_MAX 12 | 174 | #define IWL_UCODE_SECTION_MAX 12 |
184 | #define IWL_API_ARRAY_SIZE 1 | 175 | #define IWL_API_ARRAY_SIZE 1 |
185 | #define IWL_CAPABILITIES_ARRAY_SIZE 1 | 176 | #define IWL_CAPABILITIES_ARRAY_SIZE 1 |
177 | #define CPU1_CPU2_SEPARATOR_SECTION 0xFFFFCCCC | ||
186 | 178 | ||
187 | struct iwl_ucode_capabilities { | 179 | struct iwl_ucode_capabilities { |
188 | u32 max_probe_length; | 180 | u32 max_probe_length; |
@@ -205,6 +197,11 @@ struct fw_img { | |||
205 | bool is_dual_cpus; | 197 | bool is_dual_cpus; |
206 | }; | 198 | }; |
207 | 199 | ||
200 | struct iwl_sf_region { | ||
201 | u32 addr; | ||
202 | u32 size; | ||
203 | }; | ||
204 | |||
208 | /* uCode version contains 4 values: Major/Minor/API/Serial */ | 205 | /* uCode version contains 4 values: Major/Minor/API/Serial */ |
209 | #define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) | 206 | #define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) |
210 | #define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) | 207 | #define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c index 44cc3cf45762..5eef4ae7333b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.c +++ b/drivers/net/wireless/iwlwifi/iwl-io.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "iwl-io.h" | 33 | #include "iwl-io.h" |
34 | #include "iwl-csr.h" | 34 | #include "iwl-csr.h" |
35 | #include "iwl-debug.h" | 35 | #include "iwl-debug.h" |
36 | #include "iwl-prph.h" | ||
36 | #include "iwl-fh.h" | 37 | #include "iwl-fh.h" |
37 | 38 | ||
38 | #define IWL_POLL_INTERVAL 10 /* microseconds */ | 39 | #define IWL_POLL_INTERVAL 10 /* microseconds */ |
@@ -183,6 +184,23 @@ void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask) | |||
183 | } | 184 | } |
184 | IWL_EXPORT_SYMBOL(iwl_clear_bits_prph); | 185 | IWL_EXPORT_SYMBOL(iwl_clear_bits_prph); |
185 | 186 | ||
187 | void iwl_force_nmi(struct iwl_trans *trans) | ||
188 | { | ||
189 | /* | ||
190 | * In HW previous to the 8000 HW family, and in the 8000 HW family | ||
191 | * itself when the revision step==0, the DEVICE_SET_NMI_REG is used | ||
192 | * to force an NMI. Otherwise, a different register - | ||
193 | * DEVICE_SET_NMI_8000B_REG - is used. | ||
194 | */ | ||
195 | if ((trans->cfg->device_family != IWL_DEVICE_FAMILY_8000) || | ||
196 | ((trans->hw_rev & 0xc) == 0x0)) | ||
197 | iwl_write_prph(trans, DEVICE_SET_NMI_REG, DEVICE_SET_NMI_VAL); | ||
198 | else | ||
199 | iwl_write_prph(trans, DEVICE_SET_NMI_8000B_REG, | ||
200 | DEVICE_SET_NMI_8000B_VAL); | ||
201 | } | ||
202 | IWL_EXPORT_SYMBOL(iwl_force_nmi); | ||
203 | |||
186 | static const char *get_fh_string(int cmd) | 204 | static const char *get_fh_string(int cmd) |
187 | { | 205 | { |
188 | #define IWL_CMD(x) case x: return #x | 206 | #define IWL_CMD(x) case x: return #x |
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h index 665ddd9dbbc4..705d12c079e8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-io.h | |||
@@ -80,6 +80,7 @@ void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); | |||
80 | void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, | 80 | void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, |
81 | u32 bits, u32 mask); | 81 | u32 bits, u32 mask); |
82 | void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); | 82 | void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); |
83 | void iwl_force_nmi(struct iwl_trans *trans); | ||
83 | 84 | ||
84 | /* Error handling */ | 85 | /* Error handling */ |
85 | int iwl_dump_fh(struct iwl_trans *trans, char **buf); | 86 | int iwl_dump_fh(struct iwl_trans *trans, char **buf); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-modparams.h b/drivers/net/wireless/iwlwifi/iwl-modparams.h index d994317db85b..d051857729ab 100644 --- a/drivers/net/wireless/iwlwifi/iwl-modparams.h +++ b/drivers/net/wireless/iwlwifi/iwl-modparams.h | |||
@@ -119,6 +119,7 @@ struct iwl_mod_params { | |||
119 | #endif | 119 | #endif |
120 | int ant_coupling; | 120 | int ant_coupling; |
121 | char *nvm_file; | 121 | char *nvm_file; |
122 | bool uapsd_disable; | ||
122 | }; | 123 | }; |
123 | 124 | ||
124 | #endif /* #__iwl_modparams_h__ */ | 125 | #endif /* #__iwl_modparams_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c index 6be30c698506..85eee79c495c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/types.h> | 62 | #include <linux/types.h> |
63 | #include <linux/slab.h> | 63 | #include <linux/slab.h> |
64 | #include <linux/export.h> | 64 | #include <linux/export.h> |
65 | #include <linux/etherdevice.h> | ||
65 | #include "iwl-drv.h" | 66 | #include "iwl-drv.h" |
66 | #include "iwl-modparams.h" | 67 | #include "iwl-modparams.h" |
67 | #include "iwl-nvm-parse.h" | 68 | #include "iwl-nvm-parse.h" |
@@ -127,19 +128,20 @@ static const u8 iwl_nvm_channels[] = { | |||
127 | 128 | ||
128 | static const u8 iwl_nvm_channels_family_8000[] = { | 129 | static const u8 iwl_nvm_channels_family_8000[] = { |
129 | /* 2.4 GHz */ | 130 | /* 2.4 GHz */ |
130 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, | 131 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
131 | /* 5 GHz */ | 132 | /* 5 GHz */ |
132 | 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, | 133 | 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, |
133 | 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, | 134 | 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, |
134 | 149, 153, 157, 161, 165, 169, 173, 177, 181 | 135 | 149, 153, 157, 161, 165, 169, 173, 177, 181 |
135 | }; | 136 | }; |
136 | 137 | ||
137 | #define IWL_NUM_CHANNELS ARRAY_SIZE(iwl_nvm_channels) | 138 | #define IWL_NUM_CHANNELS ARRAY_SIZE(iwl_nvm_channels) |
138 | #define IWL_NUM_CHANNELS_FAMILY_8000 ARRAY_SIZE(iwl_nvm_channels_family_8000) | 139 | #define IWL_NUM_CHANNELS_FAMILY_8000 ARRAY_SIZE(iwl_nvm_channels_family_8000) |
139 | #define NUM_2GHZ_CHANNELS 14 | 140 | #define NUM_2GHZ_CHANNELS 14 |
140 | #define FIRST_2GHZ_HT_MINUS 5 | 141 | #define NUM_2GHZ_CHANNELS_FAMILY_8000 14 |
141 | #define LAST_2GHZ_HT_PLUS 9 | 142 | #define FIRST_2GHZ_HT_MINUS 5 |
142 | #define LAST_5GHZ_HT 161 | 143 | #define LAST_2GHZ_HT_PLUS 9 |
144 | #define LAST_5GHZ_HT 161 | ||
143 | 145 | ||
144 | #define DEFAULT_MAX_TX_POWER 16 | 146 | #define DEFAULT_MAX_TX_POWER 16 |
145 | 147 | ||
@@ -202,21 +204,23 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, | |||
202 | struct ieee80211_channel *channel; | 204 | struct ieee80211_channel *channel; |
203 | u16 ch_flags; | 205 | u16 ch_flags; |
204 | bool is_5ghz; | 206 | bool is_5ghz; |
205 | int num_of_ch; | 207 | int num_of_ch, num_2ghz_channels; |
206 | const u8 *nvm_chan; | 208 | const u8 *nvm_chan; |
207 | 209 | ||
208 | if (cfg->device_family != IWL_DEVICE_FAMILY_8000) { | 210 | if (cfg->device_family != IWL_DEVICE_FAMILY_8000) { |
209 | num_of_ch = IWL_NUM_CHANNELS; | 211 | num_of_ch = IWL_NUM_CHANNELS; |
210 | nvm_chan = &iwl_nvm_channels[0]; | 212 | nvm_chan = &iwl_nvm_channels[0]; |
213 | num_2ghz_channels = NUM_2GHZ_CHANNELS; | ||
211 | } else { | 214 | } else { |
212 | num_of_ch = IWL_NUM_CHANNELS_FAMILY_8000; | 215 | num_of_ch = IWL_NUM_CHANNELS_FAMILY_8000; |
213 | nvm_chan = &iwl_nvm_channels_family_8000[0]; | 216 | nvm_chan = &iwl_nvm_channels_family_8000[0]; |
217 | num_2ghz_channels = NUM_2GHZ_CHANNELS_FAMILY_8000; | ||
214 | } | 218 | } |
215 | 219 | ||
216 | for (ch_idx = 0; ch_idx < num_of_ch; ch_idx++) { | 220 | for (ch_idx = 0; ch_idx < num_of_ch; ch_idx++) { |
217 | ch_flags = __le16_to_cpup(nvm_ch_flags + ch_idx); | 221 | ch_flags = __le16_to_cpup(nvm_ch_flags + ch_idx); |
218 | 222 | ||
219 | if (ch_idx >= NUM_2GHZ_CHANNELS && | 223 | if (ch_idx >= num_2ghz_channels && |
220 | !data->sku_cap_band_52GHz_enable) | 224 | !data->sku_cap_band_52GHz_enable) |
221 | ch_flags &= ~NVM_CHANNEL_VALID; | 225 | ch_flags &= ~NVM_CHANNEL_VALID; |
222 | 226 | ||
@@ -225,7 +229,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, | |||
225 | "Ch. %d Flags %x [%sGHz] - No traffic\n", | 229 | "Ch. %d Flags %x [%sGHz] - No traffic\n", |
226 | nvm_chan[ch_idx], | 230 | nvm_chan[ch_idx], |
227 | ch_flags, | 231 | ch_flags, |
228 | (ch_idx >= NUM_2GHZ_CHANNELS) ? | 232 | (ch_idx >= num_2ghz_channels) ? |
229 | "5.2" : "2.4"); | 233 | "5.2" : "2.4"); |
230 | continue; | 234 | continue; |
231 | } | 235 | } |
@@ -234,7 +238,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, | |||
234 | n_channels++; | 238 | n_channels++; |
235 | 239 | ||
236 | channel->hw_value = nvm_chan[ch_idx]; | 240 | channel->hw_value = nvm_chan[ch_idx]; |
237 | channel->band = (ch_idx < NUM_2GHZ_CHANNELS) ? | 241 | channel->band = (ch_idx < num_2ghz_channels) ? |
238 | IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; | 242 | IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; |
239 | channel->center_freq = | 243 | channel->center_freq = |
240 | ieee80211_channel_to_frequency( | 244 | ieee80211_channel_to_frequency( |
@@ -242,7 +246,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, | |||
242 | 246 | ||
243 | /* TODO: Need to be dependent to the NVM */ | 247 | /* TODO: Need to be dependent to the NVM */ |
244 | channel->flags = IEEE80211_CHAN_NO_HT40; | 248 | channel->flags = IEEE80211_CHAN_NO_HT40; |
245 | if (ch_idx < NUM_2GHZ_CHANNELS && | 249 | if (ch_idx < num_2ghz_channels && |
246 | (ch_flags & NVM_CHANNEL_40MHZ)) { | 250 | (ch_flags & NVM_CHANNEL_40MHZ)) { |
247 | if (nvm_chan[ch_idx] <= LAST_2GHZ_HT_PLUS) | 251 | if (nvm_chan[ch_idx] <= LAST_2GHZ_HT_PLUS) |
248 | channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS; | 252 | channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS; |
@@ -250,7 +254,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, | |||
250 | channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS; | 254 | channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS; |
251 | } else if (nvm_chan[ch_idx] <= LAST_5GHZ_HT && | 255 | } else if (nvm_chan[ch_idx] <= LAST_5GHZ_HT && |
252 | (ch_flags & NVM_CHANNEL_40MHZ)) { | 256 | (ch_flags & NVM_CHANNEL_40MHZ)) { |
253 | if ((ch_idx - NUM_2GHZ_CHANNELS) % 2 == 0) | 257 | if ((ch_idx - num_2ghz_channels) % 2 == 0) |
254 | channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS; | 258 | channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS; |
255 | else | 259 | else |
256 | channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS; | 260 | channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS; |
@@ -447,13 +451,7 @@ static void iwl_set_hw_address(const struct iwl_cfg *cfg, | |||
447 | struct iwl_nvm_data *data, | 451 | struct iwl_nvm_data *data, |
448 | const __le16 *nvm_sec) | 452 | const __le16 *nvm_sec) |
449 | { | 453 | { |
450 | u8 hw_addr[ETH_ALEN]; | 454 | const u8 *hw_addr = (const u8 *)(nvm_sec + HW_ADDR); |
451 | |||
452 | if (cfg->device_family != IWL_DEVICE_FAMILY_8000) | ||
453 | memcpy(hw_addr, nvm_sec + HW_ADDR, ETH_ALEN); | ||
454 | else | ||
455 | memcpy(hw_addr, nvm_sec + MAC_ADDRESS_OVERRIDE_FAMILY_8000, | ||
456 | ETH_ALEN); | ||
457 | 455 | ||
458 | /* The byte order is little endian 16 bit, meaning 214365 */ | 456 | /* The byte order is little endian 16 bit, meaning 214365 */ |
459 | data->hw_addr[0] = hw_addr[1]; | 457 | data->hw_addr[0] = hw_addr[1]; |
@@ -464,6 +462,41 @@ static void iwl_set_hw_address(const struct iwl_cfg *cfg, | |||
464 | data->hw_addr[5] = hw_addr[4]; | 462 | data->hw_addr[5] = hw_addr[4]; |
465 | } | 463 | } |
466 | 464 | ||
465 | static void iwl_set_hw_address_family_8000(const struct iwl_cfg *cfg, | ||
466 | struct iwl_nvm_data *data, | ||
467 | const __le16 *mac_override, | ||
468 | const __le16 *nvm_hw) | ||
469 | { | ||
470 | const u8 *hw_addr; | ||
471 | |||
472 | if (mac_override) { | ||
473 | hw_addr = (const u8 *)(mac_override + | ||
474 | MAC_ADDRESS_OVERRIDE_FAMILY_8000); | ||
475 | |||
476 | /* The byte order is little endian 16 bit, meaning 214365 */ | ||
477 | data->hw_addr[0] = hw_addr[1]; | ||
478 | data->hw_addr[1] = hw_addr[0]; | ||
479 | data->hw_addr[2] = hw_addr[3]; | ||
480 | data->hw_addr[3] = hw_addr[2]; | ||
481 | data->hw_addr[4] = hw_addr[5]; | ||
482 | data->hw_addr[5] = hw_addr[4]; | ||
483 | |||
484 | if (is_valid_ether_addr(hw_addr)) | ||
485 | return; | ||
486 | } | ||
487 | |||
488 | /* take the MAC address from the OTP */ | ||
489 | hw_addr = (const u8 *)(nvm_hw + HW_ADDR0_FAMILY_8000); | ||
490 | data->hw_addr[0] = hw_addr[3]; | ||
491 | data->hw_addr[1] = hw_addr[2]; | ||
492 | data->hw_addr[2] = hw_addr[1]; | ||
493 | data->hw_addr[3] = hw_addr[0]; | ||
494 | |||
495 | hw_addr = (const u8 *)(nvm_hw + HW_ADDR1_FAMILY_8000); | ||
496 | data->hw_addr[4] = hw_addr[1]; | ||
497 | data->hw_addr[5] = hw_addr[0]; | ||
498 | } | ||
499 | |||
467 | struct iwl_nvm_data * | 500 | struct iwl_nvm_data * |
468 | iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg, | 501 | iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg, |
469 | const __le16 *nvm_hw, const __le16 *nvm_sw, | 502 | const __le16 *nvm_hw, const __le16 *nvm_sw, |
@@ -523,7 +556,7 @@ iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg, | |||
523 | rx_chains); | 556 | rx_chains); |
524 | } else { | 557 | } else { |
525 | /* MAC address in family 8000 */ | 558 | /* MAC address in family 8000 */ |
526 | iwl_set_hw_address(cfg, data, mac_override); | 559 | iwl_set_hw_address_family_8000(cfg, data, mac_override, nvm_hw); |
527 | 560 | ||
528 | iwl_init_sbands(dev, cfg, data, regulatory, | 561 | iwl_init_sbands(dev, cfg, data, regulatory, |
529 | sku & NVM_SKU_CAP_11AC_ENABLE, tx_chains, | 562 | sku & NVM_SKU_CAP_11AC_ENABLE, tx_chains, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/iwlwifi/iwl-op-mode.h index ea29504ac617..99785c892f96 100644 --- a/drivers/net/wireless/iwlwifi/iwl-op-mode.h +++ b/drivers/net/wireless/iwlwifi/iwl-op-mode.h | |||
@@ -63,6 +63,7 @@ | |||
63 | #ifndef __iwl_op_mode_h__ | 63 | #ifndef __iwl_op_mode_h__ |
64 | #define __iwl_op_mode_h__ | 64 | #define __iwl_op_mode_h__ |
65 | 65 | ||
66 | #include <linux/netdevice.h> | ||
66 | #include <linux/debugfs.h> | 67 | #include <linux/debugfs.h> |
67 | 68 | ||
68 | struct iwl_op_mode; | 69 | struct iwl_op_mode; |
@@ -112,8 +113,11 @@ struct iwl_cfg; | |||
112 | * @stop: stop the op_mode. Must free all the memory allocated. | 113 | * @stop: stop the op_mode. Must free all the memory allocated. |
113 | * May sleep | 114 | * May sleep |
114 | * @rx: Rx notification to the op_mode. rxb is the Rx buffer itself. Cmd is the | 115 | * @rx: Rx notification to the op_mode. rxb is the Rx buffer itself. Cmd is the |
115 | * HCMD this Rx responds to. | 116 | * HCMD this Rx responds to. Can't sleep. |
116 | * This callback may sleep, it is called from a threaded IRQ handler. | 117 | * @napi_add: NAPI initialisation. The transport is fully responsible for NAPI, |
118 | * but the higher layers need to know about it (in particular mac80211 to | ||
119 | * to able to call the right NAPI RX functions); this function is needed | ||
120 | * to eventually call netif_napi_add() with higher layer involvement. | ||
117 | * @queue_full: notifies that a HW queue is full. | 121 | * @queue_full: notifies that a HW queue is full. |
118 | * Must be atomic and called with BH disabled. | 122 | * Must be atomic and called with BH disabled. |
119 | * @queue_not_full: notifies that a HW queue is not full any more. | 123 | * @queue_not_full: notifies that a HW queue is not full any more. |
@@ -143,6 +147,11 @@ struct iwl_op_mode_ops { | |||
143 | void (*stop)(struct iwl_op_mode *op_mode); | 147 | void (*stop)(struct iwl_op_mode *op_mode); |
144 | int (*rx)(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, | 148 | int (*rx)(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, |
145 | struct iwl_device_cmd *cmd); | 149 | struct iwl_device_cmd *cmd); |
150 | void (*napi_add)(struct iwl_op_mode *op_mode, | ||
151 | struct napi_struct *napi, | ||
152 | struct net_device *napi_dev, | ||
153 | int (*poll)(struct napi_struct *, int), | ||
154 | int weight); | ||
146 | void (*queue_full)(struct iwl_op_mode *op_mode, int queue); | 155 | void (*queue_full)(struct iwl_op_mode *op_mode, int queue); |
147 | void (*queue_not_full)(struct iwl_op_mode *op_mode, int queue); | 156 | void (*queue_not_full)(struct iwl_op_mode *op_mode, int queue); |
148 | bool (*hw_rf_kill)(struct iwl_op_mode *op_mode, bool state); | 157 | bool (*hw_rf_kill)(struct iwl_op_mode *op_mode, bool state); |
@@ -180,7 +189,6 @@ static inline int iwl_op_mode_rx(struct iwl_op_mode *op_mode, | |||
180 | struct iwl_rx_cmd_buffer *rxb, | 189 | struct iwl_rx_cmd_buffer *rxb, |
181 | struct iwl_device_cmd *cmd) | 190 | struct iwl_device_cmd *cmd) |
182 | { | 191 | { |
183 | might_sleep(); | ||
184 | return op_mode->ops->rx(op_mode, rxb, cmd); | 192 | return op_mode->ops->rx(op_mode, rxb, cmd); |
185 | } | 193 | } |
186 | 194 | ||
@@ -249,4 +257,15 @@ static inline int iwl_op_mode_exit_d0i3(struct iwl_op_mode *op_mode) | |||
249 | return op_mode->ops->exit_d0i3(op_mode); | 257 | return op_mode->ops->exit_d0i3(op_mode); |
250 | } | 258 | } |
251 | 259 | ||
260 | static inline void iwl_op_mode_napi_add(struct iwl_op_mode *op_mode, | ||
261 | struct napi_struct *napi, | ||
262 | struct net_device *napi_dev, | ||
263 | int (*poll)(struct napi_struct *, int), | ||
264 | int weight) | ||
265 | { | ||
266 | if (!op_mode->ops->napi_add) | ||
267 | return; | ||
268 | op_mode->ops->napi_add(op_mode, napi, napi_dev, poll, weight); | ||
269 | } | ||
270 | |||
252 | #endif /* __iwl_op_mode_h__ */ | 271 | #endif /* __iwl_op_mode_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-phy-db.c b/drivers/net/wireless/iwlwifi/iwl-phy-db.c index b761ac4822a3..d4fb5cad07ea 100644 --- a/drivers/net/wireless/iwlwifi/iwl-phy-db.c +++ b/drivers/net/wireless/iwlwifi/iwl-phy-db.c | |||
@@ -345,7 +345,6 @@ static int iwl_send_phy_db_cmd(struct iwl_phy_db *phy_db, u16 type, | |||
345 | struct iwl_phy_db_cmd phy_db_cmd; | 345 | struct iwl_phy_db_cmd phy_db_cmd; |
346 | struct iwl_host_cmd cmd = { | 346 | struct iwl_host_cmd cmd = { |
347 | .id = PHY_DB_CMD, | 347 | .id = PHY_DB_CMD, |
348 | .flags = CMD_SYNC, | ||
349 | }; | 348 | }; |
350 | 349 | ||
351 | IWL_DEBUG_INFO(phy_db->trans, | 350 | IWL_DEBUG_INFO(phy_db->trans, |
@@ -393,13 +392,13 @@ static int iwl_phy_db_send_all_channel_groups( | |||
393 | entry->data); | 392 | entry->data); |
394 | if (err) { | 393 | if (err) { |
395 | IWL_ERR(phy_db->trans, | 394 | IWL_ERR(phy_db->trans, |
396 | "Can't SEND phy_db section %d (%d), err %d", | 395 | "Can't SEND phy_db section %d (%d), err %d\n", |
397 | type, i, err); | 396 | type, i, err); |
398 | return err; | 397 | return err; |
399 | } | 398 | } |
400 | 399 | ||
401 | IWL_DEBUG_INFO(phy_db->trans, | 400 | IWL_DEBUG_INFO(phy_db->trans, |
402 | "Sent PHY_DB HCMD, type = %d num = %d", | 401 | "Sent PHY_DB HCMD, type = %d num = %d\n", |
403 | type, i); | 402 | type, i); |
404 | } | 403 | } |
405 | 404 | ||
@@ -451,7 +450,7 @@ int iwl_send_phy_db_data(struct iwl_phy_db *phy_db) | |||
451 | IWL_NUM_PAPD_CH_GROUPS); | 450 | IWL_NUM_PAPD_CH_GROUPS); |
452 | if (err) { | 451 | if (err) { |
453 | IWL_ERR(phy_db->trans, | 452 | IWL_ERR(phy_db->trans, |
454 | "Cannot send channel specific PAPD groups"); | 453 | "Cannot send channel specific PAPD groups\n"); |
455 | return err; | 454 | return err; |
456 | } | 455 | } |
457 | 456 | ||
@@ -461,7 +460,7 @@ int iwl_send_phy_db_data(struct iwl_phy_db *phy_db) | |||
461 | IWL_NUM_TXP_CH_GROUPS); | 460 | IWL_NUM_TXP_CH_GROUPS); |
462 | if (err) { | 461 | if (err) { |
463 | IWL_ERR(phy_db->trans, | 462 | IWL_ERR(phy_db->trans, |
464 | "Cannot send channel specific TX power groups"); | 463 | "Cannot send channel specific TX power groups\n"); |
465 | return err; | 464 | return err; |
466 | } | 465 | } |
467 | 466 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index 5f657c501406..4997e27672b3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h | |||
@@ -105,6 +105,9 @@ | |||
105 | 105 | ||
106 | /* Device NMI register */ | 106 | /* Device NMI register */ |
107 | #define DEVICE_SET_NMI_REG 0x00a01c30 | 107 | #define DEVICE_SET_NMI_REG 0x00a01c30 |
108 | #define DEVICE_SET_NMI_VAL 0x1 | ||
109 | #define DEVICE_SET_NMI_8000B_REG 0x00a01c24 | ||
110 | #define DEVICE_SET_NMI_8000B_VAL 0x1000000 | ||
108 | 111 | ||
109 | /* Shared registers (0x0..0x3ff, via target indirect or periphery */ | 112 | /* Shared registers (0x0..0x3ff, via target indirect or periphery */ |
110 | #define SHR_BASE 0x00a10000 | 113 | #define SHR_BASE 0x00a10000 |
@@ -348,4 +351,12 @@ enum secure_load_status_reg { | |||
348 | 351 | ||
349 | #define LMPM_SECURE_TIME_OUT (100) | 352 | #define LMPM_SECURE_TIME_OUT (100) |
350 | 353 | ||
354 | /* Rx FIFO */ | ||
355 | #define RXF_SIZE_ADDR (0xa00c88) | ||
356 | #define RXF_SIZE_BYTE_CND_POS (7) | ||
357 | #define RXF_SIZE_BYTE_CNT_MSK (0x3ff << RXF_SIZE_BYTE_CND_POS) | ||
358 | |||
359 | #define RXF_LD_FENCE_OFFSET_ADDR (0xa00c10) | ||
360 | #define RXF_FIFO_RD_FENCE_ADDR (0xa00c0c) | ||
361 | |||
351 | #endif /* __iwl_prph_h__ */ | 362 | #endif /* __iwl_prph_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index 8cdb0dd618a6..34d49e171fb4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -189,10 +189,9 @@ static inline u32 iwl_rx_packet_payload_len(const struct iwl_rx_packet *pkt) | |||
189 | /** | 189 | /** |
190 | * enum CMD_MODE - how to send the host commands ? | 190 | * enum CMD_MODE - how to send the host commands ? |
191 | * | 191 | * |
192 | * @CMD_SYNC: The caller will be stalled until the fw responds to the command | ||
193 | * @CMD_ASYNC: Return right away and don't wait for the response | 192 | * @CMD_ASYNC: Return right away and don't wait for the response |
194 | * @CMD_WANT_SKB: valid only with CMD_SYNC. The caller needs the buffer of the | 193 | * @CMD_WANT_SKB: Not valid with CMD_ASYNC. The caller needs the buffer of |
195 | * response. The caller needs to call iwl_free_resp when done. | 194 | * the response. The caller needs to call iwl_free_resp when done. |
196 | * @CMD_HIGH_PRIO: The command is high priority - it goes to the front of the | 195 | * @CMD_HIGH_PRIO: The command is high priority - it goes to the front of the |
197 | * command queue, but after other high priority commands. valid only | 196 | * command queue, but after other high priority commands. valid only |
198 | * with CMD_ASYNC. | 197 | * with CMD_ASYNC. |
@@ -202,7 +201,6 @@ static inline u32 iwl_rx_packet_payload_len(const struct iwl_rx_packet *pkt) | |||
202 | * (i.e. mark it as non-idle). | 201 | * (i.e. mark it as non-idle). |
203 | */ | 202 | */ |
204 | enum CMD_MODE { | 203 | enum CMD_MODE { |
205 | CMD_SYNC = 0, | ||
206 | CMD_ASYNC = BIT(0), | 204 | CMD_ASYNC = BIT(0), |
207 | CMD_WANT_SKB = BIT(1), | 205 | CMD_WANT_SKB = BIT(1), |
208 | CMD_SEND_IN_RFKILL = BIT(2), | 206 | CMD_SEND_IN_RFKILL = BIT(2), |
@@ -427,7 +425,7 @@ struct iwl_trans; | |||
427 | * @send_cmd:send a host command. Must return -ERFKILL if RFkill is asserted. | 425 | * @send_cmd:send a host command. Must return -ERFKILL if RFkill is asserted. |
428 | * If RFkill is asserted in the middle of a SYNC host command, it must | 426 | * If RFkill is asserted in the middle of a SYNC host command, it must |
429 | * return -ERFKILL straight away. | 427 | * return -ERFKILL straight away. |
430 | * May sleep only if CMD_SYNC is set | 428 | * May sleep only if CMD_ASYNC is not set |
431 | * @tx: send an skb | 429 | * @tx: send an skb |
432 | * Must be atomic | 430 | * Must be atomic |
433 | * @reclaim: free packet until ssn. Returns a list of freed packets. | 431 | * @reclaim: free packet until ssn. Returns a list of freed packets. |
@@ -437,8 +435,7 @@ struct iwl_trans; | |||
437 | * this one. The op_mode must not configure the HCMD queue. May sleep. | 435 | * this one. The op_mode must not configure the HCMD queue. May sleep. |
438 | * @txq_disable: de-configure a Tx queue to send AMPDUs | 436 | * @txq_disable: de-configure a Tx queue to send AMPDUs |
439 | * Must be atomic | 437 | * Must be atomic |
440 | * @wait_tx_queue_empty: wait until all tx queues are empty | 438 | * @wait_tx_queue_empty: wait until tx queues are empty. May sleep. |
441 | * May sleep | ||
442 | * @dbgfs_register: add the dbgfs files under this directory. Files will be | 439 | * @dbgfs_register: add the dbgfs files under this directory. Files will be |
443 | * automatically deleted. | 440 | * automatically deleted. |
444 | * @write8: write a u8 to a register at offset ofs from the BAR | 441 | * @write8: write a u8 to a register at offset ofs from the BAR |
@@ -464,6 +461,11 @@ struct iwl_trans; | |||
464 | * @unref: release a reference previously taken with @ref. Note that | 461 | * @unref: release a reference previously taken with @ref. Note that |
465 | * initially the reference count is 1, making an initial @unref | 462 | * initially the reference count is 1, making an initial @unref |
466 | * necessary to allow low power states. | 463 | * necessary to allow low power states. |
464 | * @dump_data: fill a data dump with debug data, maybe containing last | ||
465 | * TX'ed commands and similar. When called with a NULL buffer and | ||
466 | * zero buffer length, provide only the (estimated) required buffer | ||
467 | * length. Return the used buffer length. | ||
468 | * Note that the transport must fill in the proper file headers. | ||
467 | */ | 469 | */ |
468 | struct iwl_trans_ops { | 470 | struct iwl_trans_ops { |
469 | 471 | ||
@@ -471,6 +473,8 @@ struct iwl_trans_ops { | |||
471 | void (*op_mode_leave)(struct iwl_trans *iwl_trans); | 473 | void (*op_mode_leave)(struct iwl_trans *iwl_trans); |
472 | int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw, | 474 | int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw, |
473 | bool run_in_rfkill); | 475 | bool run_in_rfkill); |
476 | int (*update_sf)(struct iwl_trans *trans, | ||
477 | struct iwl_sf_region *st_fwrd_space); | ||
474 | void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr); | 478 | void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr); |
475 | void (*stop_device)(struct iwl_trans *trans); | 479 | void (*stop_device)(struct iwl_trans *trans); |
476 | 480 | ||
@@ -490,7 +494,7 @@ struct iwl_trans_ops { | |||
490 | void (*txq_disable)(struct iwl_trans *trans, int queue); | 494 | void (*txq_disable)(struct iwl_trans *trans, int queue); |
491 | 495 | ||
492 | int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir); | 496 | int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir); |
493 | int (*wait_tx_queue_empty)(struct iwl_trans *trans); | 497 | int (*wait_tx_queue_empty)(struct iwl_trans *trans, u32 txq_bm); |
494 | 498 | ||
495 | void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val); | 499 | void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val); |
496 | void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val); | 500 | void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val); |
@@ -512,6 +516,10 @@ struct iwl_trans_ops { | |||
512 | u32 value); | 516 | u32 value); |
513 | void (*ref)(struct iwl_trans *trans); | 517 | void (*ref)(struct iwl_trans *trans); |
514 | void (*unref)(struct iwl_trans *trans); | 518 | void (*unref)(struct iwl_trans *trans); |
519 | |||
520 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
521 | u32 (*dump_data)(struct iwl_trans *trans, void *buf, u32 buflen); | ||
522 | #endif | ||
515 | }; | 523 | }; |
516 | 524 | ||
517 | /** | 525 | /** |
@@ -630,6 +638,17 @@ static inline int iwl_trans_start_fw(struct iwl_trans *trans, | |||
630 | return trans->ops->start_fw(trans, fw, run_in_rfkill); | 638 | return trans->ops->start_fw(trans, fw, run_in_rfkill); |
631 | } | 639 | } |
632 | 640 | ||
641 | static inline int iwl_trans_update_sf(struct iwl_trans *trans, | ||
642 | struct iwl_sf_region *st_fwrd_space) | ||
643 | { | ||
644 | might_sleep(); | ||
645 | |||
646 | if (trans->ops->update_sf) | ||
647 | return trans->ops->update_sf(trans, st_fwrd_space); | ||
648 | |||
649 | return 0; | ||
650 | } | ||
651 | |||
633 | static inline void iwl_trans_stop_device(struct iwl_trans *trans) | 652 | static inline void iwl_trans_stop_device(struct iwl_trans *trans) |
634 | { | 653 | { |
635 | might_sleep(); | 654 | might_sleep(); |
@@ -665,6 +684,16 @@ static inline void iwl_trans_unref(struct iwl_trans *trans) | |||
665 | trans->ops->unref(trans); | 684 | trans->ops->unref(trans); |
666 | } | 685 | } |
667 | 686 | ||
687 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
688 | static inline u32 iwl_trans_dump_data(struct iwl_trans *trans, | ||
689 | void *buf, u32 buflen) | ||
690 | { | ||
691 | if (!trans->ops->dump_data) | ||
692 | return 0; | ||
693 | return trans->ops->dump_data(trans, buf, buflen); | ||
694 | } | ||
695 | #endif | ||
696 | |||
668 | static inline int iwl_trans_send_cmd(struct iwl_trans *trans, | 697 | static inline int iwl_trans_send_cmd(struct iwl_trans *trans, |
669 | struct iwl_host_cmd *cmd) | 698 | struct iwl_host_cmd *cmd) |
670 | { | 699 | { |
@@ -678,7 +707,7 @@ static inline int iwl_trans_send_cmd(struct iwl_trans *trans, | |||
678 | return -EIO; | 707 | return -EIO; |
679 | 708 | ||
680 | if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) { | 709 | if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) { |
681 | IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); | 710 | IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); |
682 | return -EIO; | 711 | return -EIO; |
683 | } | 712 | } |
684 | 713 | ||
@@ -720,7 +749,7 @@ static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
720 | return -EIO; | 749 | return -EIO; |
721 | 750 | ||
722 | if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) | 751 | if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) |
723 | IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); | 752 | IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); |
724 | 753 | ||
725 | return trans->ops->tx(trans, skb, dev_cmd, queue); | 754 | return trans->ops->tx(trans, skb, dev_cmd, queue); |
726 | } | 755 | } |
@@ -729,7 +758,7 @@ static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue, | |||
729 | int ssn, struct sk_buff_head *skbs) | 758 | int ssn, struct sk_buff_head *skbs) |
730 | { | 759 | { |
731 | if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) | 760 | if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) |
732 | IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); | 761 | IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); |
733 | 762 | ||
734 | trans->ops->reclaim(trans, queue, ssn, skbs); | 763 | trans->ops->reclaim(trans, queue, ssn, skbs); |
735 | } | 764 | } |
@@ -746,7 +775,7 @@ static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue, | |||
746 | might_sleep(); | 775 | might_sleep(); |
747 | 776 | ||
748 | if (unlikely((trans->state != IWL_TRANS_FW_ALIVE))) | 777 | if (unlikely((trans->state != IWL_TRANS_FW_ALIVE))) |
749 | IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); | 778 | IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); |
750 | 779 | ||
751 | trans->ops->txq_enable(trans, queue, fifo, sta_id, tid, | 780 | trans->ops->txq_enable(trans, queue, fifo, sta_id, tid, |
752 | frame_limit, ssn); | 781 | frame_limit, ssn); |
@@ -759,12 +788,13 @@ static inline void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue, | |||
759 | IWL_MAX_TID_COUNT, IWL_FRAME_LIMIT, 0); | 788 | IWL_MAX_TID_COUNT, IWL_FRAME_LIMIT, 0); |
760 | } | 789 | } |
761 | 790 | ||
762 | static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans) | 791 | static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans, |
792 | u32 txq_bm) | ||
763 | { | 793 | { |
764 | if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) | 794 | if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) |
765 | IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); | 795 | IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); |
766 | 796 | ||
767 | return trans->ops->wait_tx_queue_empty(trans); | 797 | return trans->ops->wait_tx_queue_empty(trans, txq_bm); |
768 | } | 798 | } |
769 | 799 | ||
770 | static inline int iwl_trans_dbgfs_register(struct iwl_trans *trans, | 800 | static inline int iwl_trans_dbgfs_register(struct iwl_trans *trans, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/Makefile b/drivers/net/wireless/iwlwifi/mvm/Makefile index ccdd3b7c4cce..c30d7f64ec1e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/Makefile +++ b/drivers/net/wireless/iwlwifi/mvm/Makefile | |||
@@ -3,8 +3,9 @@ iwlmvm-y += fw.o mac80211.o nvm.o ops.o phy-ctxt.o mac-ctxt.o | |||
3 | iwlmvm-y += utils.o rx.o tx.o binding.o quota.o sta.o sf.o | 3 | iwlmvm-y += utils.o rx.o tx.o binding.o quota.o sta.o sf.o |
4 | iwlmvm-y += scan.o time-event.o rs.o | 4 | iwlmvm-y += scan.o time-event.o rs.o |
5 | iwlmvm-y += power.o coex.o | 5 | iwlmvm-y += power.o coex.o |
6 | iwlmvm-y += led.o tt.o offloading.o | 6 | iwlmvm-y += tt.o offloading.o |
7 | iwlmvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o debugfs-vif.o | 7 | iwlmvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o debugfs-vif.o |
8 | iwlmvm-$(CONFIG_IWLWIFI_LEDS) += led.o | ||
8 | iwlmvm-$(CONFIG_PM_SLEEP) += d3.o | 9 | iwlmvm-$(CONFIG_PM_SLEEP) += d3.o |
9 | 10 | ||
10 | ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/../ | 11 | ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/../ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c index 0489314425cb..c8c3b38228f0 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex.c | |||
@@ -104,12 +104,9 @@ static const u8 iwl_bt_prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX] = { | |||
104 | #define BT_DISABLE_REDUCED_TXPOWER_THRESHOLD (-65) | 104 | #define BT_DISABLE_REDUCED_TXPOWER_THRESHOLD (-65) |
105 | #define BT_ANTENNA_COUPLING_THRESHOLD (30) | 105 | #define BT_ANTENNA_COUPLING_THRESHOLD (30) |
106 | 106 | ||
107 | int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm) | 107 | static int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm) |
108 | { | 108 | { |
109 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWBT_COEX)) | 109 | return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_PRIO_TABLE, 0, |
110 | return 0; | ||
111 | |||
112 | return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_PRIO_TABLE, CMD_SYNC, | ||
113 | sizeof(struct iwl_bt_coex_prio_tbl_cmd), | 110 | sizeof(struct iwl_bt_coex_prio_tbl_cmd), |
114 | &iwl_bt_prio_tbl); | 111 | &iwl_bt_prio_tbl); |
115 | } | 112 | } |
@@ -127,10 +124,10 @@ const u32 iwl_bt_cts_kill_msk[BT_KILL_MSK_MAX] = { | |||
127 | }; | 124 | }; |
128 | 125 | ||
129 | static const __le32 iwl_bt_prio_boost[BT_COEX_BOOST_SIZE] = { | 126 | static const __le32 iwl_bt_prio_boost[BT_COEX_BOOST_SIZE] = { |
130 | cpu_to_le32(0xf0f0f0f0), | 127 | cpu_to_le32(0xf0f0f0f0), /* 50% */ |
131 | cpu_to_le32(0xc0c0c0c0), | 128 | cpu_to_le32(0xc0c0c0c0), /* 25% */ |
132 | cpu_to_le32(0xfcfcfcfc), | 129 | cpu_to_le32(0xfcfcfcfc), /* 75% */ |
133 | cpu_to_le32(0xff00ff00), | 130 | cpu_to_le32(0xfefefefe), /* 87.5% */ |
134 | }; | 131 | }; |
135 | 132 | ||
136 | static const __le32 iwl_single_shared_ant[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = { | 133 | static const __le32 iwl_single_shared_ant[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = { |
@@ -303,8 +300,8 @@ static const __le64 iwl_ci_mask[][3] = { | |||
303 | }; | 300 | }; |
304 | 301 | ||
305 | static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = { | 302 | static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = { |
306 | cpu_to_le32(0x22002200), | 303 | cpu_to_le32(0x28412201), |
307 | cpu_to_le32(0x33113311), | 304 | cpu_to_le32(0x11118451), |
308 | }; | 305 | }; |
309 | 306 | ||
310 | struct corunning_block_luts { | 307 | struct corunning_block_luts { |
@@ -568,13 +565,13 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm) | |||
568 | .id = BT_CONFIG, | 565 | .id = BT_CONFIG, |
569 | .len = { sizeof(*bt_cmd), }, | 566 | .len = { sizeof(*bt_cmd), }, |
570 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, | 567 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, |
571 | .flags = CMD_SYNC, | ||
572 | }; | 568 | }; |
573 | int ret; | 569 | int ret; |
574 | u32 flags; | 570 | u32 flags; |
575 | 571 | ||
576 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWBT_COEX)) | 572 | ret = iwl_send_bt_prio_tbl(mvm); |
577 | return 0; | 573 | if (ret) |
574 | return ret; | ||
578 | 575 | ||
579 | bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_KERNEL); | 576 | bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_KERNEL); |
580 | if (!bt_cmd) | 577 | if (!bt_cmd) |
@@ -582,10 +579,12 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm) | |||
582 | cmd.data[0] = bt_cmd; | 579 | cmd.data[0] = bt_cmd; |
583 | 580 | ||
584 | bt_cmd->max_kill = 5; | 581 | bt_cmd->max_kill = 5; |
585 | bt_cmd->bt4_antenna_isolation_thr = BT_ANTENNA_COUPLING_THRESHOLD, | 582 | bt_cmd->bt4_antenna_isolation_thr = BT_ANTENNA_COUPLING_THRESHOLD; |
586 | bt_cmd->bt4_antenna_isolation = iwlwifi_mod_params.ant_coupling, | 583 | bt_cmd->bt4_antenna_isolation = iwlwifi_mod_params.ant_coupling; |
587 | bt_cmd->bt4_tx_tx_delta_freq_thr = 15, | 584 | bt_cmd->bt4_tx_tx_delta_freq_thr = 15; |
588 | bt_cmd->bt4_tx_rx_max_freq0 = 15, | 585 | bt_cmd->bt4_tx_rx_max_freq0 = 15; |
586 | bt_cmd->override_primary_lut = BT_COEX_INVALID_LUT; | ||
587 | bt_cmd->override_secondary_lut = BT_COEX_INVALID_LUT; | ||
589 | 588 | ||
590 | flags = iwlwifi_mod_params.bt_coex_active ? | 589 | flags = iwlwifi_mod_params.bt_coex_active ? |
591 | BT_COEX_NW : BT_COEX_DISABLE; | 590 | BT_COEX_NW : BT_COEX_DISABLE; |
@@ -663,7 +662,6 @@ static int iwl_mvm_bt_udpate_ctrl_kill_msk(struct iwl_mvm *mvm, | |||
663 | .data[0] = &bt_cmd, | 662 | .data[0] = &bt_cmd, |
664 | .len = { sizeof(*bt_cmd), }, | 663 | .len = { sizeof(*bt_cmd), }, |
665 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, | 664 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, |
666 | .flags = CMD_SYNC, | ||
667 | }; | 665 | }; |
668 | int ret = 0; | 666 | int ret = 0; |
669 | 667 | ||
@@ -717,7 +715,8 @@ static int iwl_mvm_bt_udpate_ctrl_kill_msk(struct iwl_mvm *mvm, | |||
717 | return ret; | 715 | return ret; |
718 | } | 716 | } |
719 | 717 | ||
720 | int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, bool enable) | 718 | static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, |
719 | bool enable) | ||
721 | { | 720 | { |
722 | struct iwl_bt_coex_cmd *bt_cmd; | 721 | struct iwl_bt_coex_cmd *bt_cmd; |
723 | /* Send ASYNC since this can be sent from an atomic context */ | 722 | /* Send ASYNC since this can be sent from an atomic context */ |
@@ -735,8 +734,7 @@ int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, bool enable) | |||
735 | return 0; | 734 | return 0; |
736 | 735 | ||
737 | /* nothing to do */ | 736 | /* nothing to do */ |
738 | if (mvmsta->bt_reduced_txpower_dbg || | 737 | if (mvmsta->bt_reduced_txpower == enable) |
739 | mvmsta->bt_reduced_txpower == enable) | ||
740 | return 0; | 738 | return 0; |
741 | 739 | ||
742 | bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_ATOMIC); | 740 | bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_ATOMIC); |
@@ -803,23 +801,10 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
803 | 801 | ||
804 | switch (vif->type) { | 802 | switch (vif->type) { |
805 | case NL80211_IFTYPE_STATION: | 803 | case NL80211_IFTYPE_STATION: |
804 | /* Count BSSes vifs */ | ||
805 | data->num_bss_ifaces++; | ||
806 | /* default smps_mode for BSS / P2P client is AUTOMATIC */ | 806 | /* default smps_mode for BSS / P2P client is AUTOMATIC */ |
807 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | 807 | smps_mode = IEEE80211_SMPS_AUTOMATIC; |
808 | data->num_bss_ifaces++; | ||
809 | |||
810 | /* | ||
811 | * Count unassoc BSSes, relax SMSP constraints | ||
812 | * and disable reduced Tx Power | ||
813 | */ | ||
814 | if (!vif->bss_conf.assoc) { | ||
815 | iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, | ||
816 | smps_mode); | ||
817 | if (iwl_mvm_bt_coex_reduced_txp(mvm, | ||
818 | mvmvif->ap_sta_id, | ||
819 | false)) | ||
820 | IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); | ||
821 | return; | ||
822 | } | ||
823 | break; | 808 | break; |
824 | case NL80211_IFTYPE_AP: | 809 | case NL80211_IFTYPE_AP: |
825 | /* default smps_mode for AP / GO is OFF */ | 810 | /* default smps_mode for AP / GO is OFF */ |
@@ -845,8 +830,12 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
845 | /* ... relax constraints and disable rssi events */ | 830 | /* ... relax constraints and disable rssi events */ |
846 | iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, | 831 | iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, |
847 | smps_mode); | 832 | smps_mode); |
848 | if (vif->type == NL80211_IFTYPE_STATION) | 833 | data->reduced_tx_power = false; |
834 | if (vif->type == NL80211_IFTYPE_STATION) { | ||
835 | iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, | ||
836 | false); | ||
849 | iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); | 837 | iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); |
838 | } | ||
850 | return; | 839 | return; |
851 | } | 840 | } |
852 | 841 | ||
@@ -857,6 +846,11 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
857 | smps_mode = vif->type == NL80211_IFTYPE_AP ? | 846 | smps_mode = vif->type == NL80211_IFTYPE_AP ? |
858 | IEEE80211_SMPS_OFF : | 847 | IEEE80211_SMPS_OFF : |
859 | IEEE80211_SMPS_DYNAMIC; | 848 | IEEE80211_SMPS_DYNAMIC; |
849 | |||
850 | /* relax SMPS contraints for next association */ | ||
851 | if (!vif->bss_conf.assoc) | ||
852 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | ||
853 | |||
860 | IWL_DEBUG_COEX(data->mvm, | 854 | IWL_DEBUG_COEX(data->mvm, |
861 | "mac %d: bt_status %d bt_activity_grading %d smps_req %d\n", | 855 | "mac %d: bt_status %d bt_activity_grading %d smps_req %d\n", |
862 | mvmvif->id, data->notif->bt_status, bt_activity_grading, | 856 | mvmvif->id, data->notif->bt_status, bt_activity_grading, |
@@ -903,22 +897,18 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
903 | /* if secondary is not NULL, it might be a GO */ | 897 | /* if secondary is not NULL, it might be a GO */ |
904 | data->secondary = chanctx_conf; | 898 | data->secondary = chanctx_conf; |
905 | 899 | ||
906 | /* don't reduce the Tx power if in loose scheme */ | 900 | /* |
901 | * don't reduce the Tx power if one of these is true: | ||
902 | * we are in LOOSE | ||
903 | * single share antenna product | ||
904 | * BT is active | ||
905 | * we are associated | ||
906 | */ | ||
907 | if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT || | 907 | if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT || |
908 | mvm->cfg->bt_shared_single_ant) { | 908 | mvm->cfg->bt_shared_single_ant || !vif->bss_conf.assoc || |
909 | data->reduced_tx_power = false; | 909 | !data->notif->bt_status) { |
910 | iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); | ||
911 | return; | ||
912 | } | ||
913 | |||
914 | /* reduced Txpower only if BT is on, so ...*/ | ||
915 | if (!data->notif->bt_status) { | ||
916 | /* ... cancel reduced Tx power ... */ | ||
917 | if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false)) | ||
918 | IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); | ||
919 | data->reduced_tx_power = false; | 910 | data->reduced_tx_power = false; |
920 | 911 | iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false); | |
921 | /* ... and there is no need to get reports on RSSI any more. */ | ||
922 | iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); | 912 | iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); |
923 | return; | 913 | return; |
924 | } | 914 | } |
@@ -1022,9 +1012,9 @@ static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm) | |||
1022 | 1012 | ||
1023 | /* Don't spam the fw with the same command over and over */ | 1013 | /* Don't spam the fw with the same command over and over */ |
1024 | if (memcmp(&cmd, &mvm->last_bt_ci_cmd, sizeof(cmd))) { | 1014 | if (memcmp(&cmd, &mvm->last_bt_ci_cmd, sizeof(cmd))) { |
1025 | if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, CMD_SYNC, | 1015 | if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, 0, |
1026 | sizeof(cmd), &cmd)) | 1016 | sizeof(cmd), &cmd)) |
1027 | IWL_ERR(mvm, "Failed to send BT_CI cmd"); | 1017 | IWL_ERR(mvm, "Failed to send BT_CI cmd\n"); |
1028 | memcpy(&mvm->last_bt_ci_cmd, &cmd, sizeof(cmd)); | 1018 | memcpy(&mvm->last_bt_ci_cmd, &cmd, sizeof(cmd)); |
1029 | } | 1019 | } |
1030 | 1020 | ||
@@ -1039,7 +1029,6 @@ static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm) | |||
1039 | IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n"); | 1029 | IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n"); |
1040 | } | 1030 | } |
1041 | 1031 | ||
1042 | /* upon association, the fw will send in BT Coex notification */ | ||
1043 | int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, | 1032 | int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, |
1044 | struct iwl_rx_cmd_buffer *rxb, | 1033 | struct iwl_rx_cmd_buffer *rxb, |
1045 | struct iwl_device_cmd *dev_cmd) | 1034 | struct iwl_device_cmd *dev_cmd) |
@@ -1215,6 +1204,17 @@ bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm, | |||
1215 | return iwl_get_coex_type(mvm, mvmsta->vif) == BT_COEX_TIGHT_LUT; | 1204 | return iwl_get_coex_type(mvm, mvmsta->vif) == BT_COEX_TIGHT_LUT; |
1216 | } | 1205 | } |
1217 | 1206 | ||
1207 | bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm, | ||
1208 | enum ieee80211_band band) | ||
1209 | { | ||
1210 | u32 bt_activity = le32_to_cpu(mvm->last_bt_notif.bt_activity_grading); | ||
1211 | |||
1212 | if (band != IEEE80211_BAND_2GHZ) | ||
1213 | return false; | ||
1214 | |||
1215 | return bt_activity >= BT_LOW_TRAFFIC; | ||
1216 | } | ||
1217 | |||
1218 | u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, | 1218 | u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, |
1219 | struct ieee80211_tx_info *info, u8 ac) | 1219 | struct ieee80211_tx_info *info, u8 ac) |
1220 | { | 1220 | { |
@@ -1249,9 +1249,6 @@ u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, | |||
1249 | 1249 | ||
1250 | void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm) | 1250 | void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm) |
1251 | { | 1251 | { |
1252 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWBT_COEX)) | ||
1253 | return; | ||
1254 | |||
1255 | iwl_mvm_bt_coex_notif_handle(mvm); | 1252 | iwl_mvm_bt_coex_notif_handle(mvm); |
1256 | } | 1253 | } |
1257 | 1254 | ||
@@ -1270,7 +1267,6 @@ int iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm, | |||
1270 | .id = BT_CONFIG, | 1267 | .id = BT_CONFIG, |
1271 | .len = { sizeof(*bt_cmd), }, | 1268 | .len = { sizeof(*bt_cmd), }, |
1272 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, | 1269 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, |
1273 | .flags = CMD_SYNC, | ||
1274 | }; | 1270 | }; |
1275 | 1271 | ||
1276 | if (!IWL_MVM_BT_COEX_CORUNNING) | 1272 | if (!IWL_MVM_BT_COEX_CORUNNING) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c index e56f5a0edf85..645b3cfc29a5 100644 --- a/drivers/net/wireless/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/iwlwifi/mvm/d3.c | |||
@@ -193,8 +193,7 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, | |||
193 | wkc.wep_key.key_offset = data->wep_key_idx; | 193 | wkc.wep_key.key_offset = data->wep_key_idx; |
194 | } | 194 | } |
195 | 195 | ||
196 | ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, CMD_SYNC, | 196 | ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, 0, sizeof(wkc), &wkc); |
197 | sizeof(wkc), &wkc); | ||
198 | data->error = ret != 0; | 197 | data->error = ret != 0; |
199 | 198 | ||
200 | mvm->ptk_ivlen = key->iv_len; | 199 | mvm->ptk_ivlen = key->iv_len; |
@@ -341,7 +340,6 @@ static int iwl_mvm_send_patterns(struct iwl_mvm *mvm, | |||
341 | struct iwl_host_cmd cmd = { | 340 | struct iwl_host_cmd cmd = { |
342 | .id = WOWLAN_PATTERNS, | 341 | .id = WOWLAN_PATTERNS, |
343 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, | 342 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, |
344 | .flags = CMD_SYNC, | ||
345 | }; | 343 | }; |
346 | int i, err; | 344 | int i, err; |
347 | 345 | ||
@@ -518,7 +516,6 @@ static int iwl_mvm_send_remote_wake_cfg(struct iwl_mvm *mvm, | |||
518 | .id = REMOTE_WAKE_CONFIG_CMD, | 516 | .id = REMOTE_WAKE_CONFIG_CMD, |
519 | .len = { sizeof(*cfg), }, | 517 | .len = { sizeof(*cfg), }, |
520 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, | 518 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, |
521 | .flags = CMD_SYNC, | ||
522 | }; | 519 | }; |
523 | int ret; | 520 | int ret; |
524 | 521 | ||
@@ -666,10 +663,8 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
666 | 663 | ||
667 | if (WARN_ON(!vif->bss_conf.assoc)) | 664 | if (WARN_ON(!vif->bss_conf.assoc)) |
668 | return -EINVAL; | 665 | return -EINVAL; |
669 | /* hack */ | 666 | |
670 | vif->bss_conf.assoc = false; | ||
671 | ret = iwl_mvm_mac_ctxt_add(mvm, vif); | 667 | ret = iwl_mvm_mac_ctxt_add(mvm, vif); |
672 | vif->bss_conf.assoc = true; | ||
673 | if (ret) | 668 | if (ret) |
674 | return ret; | 669 | return ret; |
675 | 670 | ||
@@ -705,7 +700,7 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
705 | return ret; | 700 | return ret; |
706 | rcu_assign_pointer(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], ap_sta); | 701 | rcu_assign_pointer(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], ap_sta); |
707 | 702 | ||
708 | ret = iwl_mvm_mac_ctxt_changed(mvm, vif); | 703 | ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false); |
709 | if (ret) | 704 | if (ret) |
710 | return ret; | 705 | return ret; |
711 | 706 | ||
@@ -719,7 +714,7 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
719 | for (i = 1; i < MAX_BINDINGS; i++) | 714 | for (i = 1; i < MAX_BINDINGS; i++) |
720 | quota_cmd.quotas[i].id_and_color = cpu_to_le32(FW_CTXT_INVALID); | 715 | quota_cmd.quotas[i].id_and_color = cpu_to_le32(FW_CTXT_INVALID); |
721 | 716 | ||
722 | ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC, | 717 | ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, 0, |
723 | sizeof(quota_cmd), "a_cmd); | 718 | sizeof(quota_cmd), "a_cmd); |
724 | if (ret) | 719 | if (ret) |
725 | IWL_ERR(mvm, "Failed to send quota: %d\n", ret); | 720 | IWL_ERR(mvm, "Failed to send quota: %d\n", ret); |
@@ -739,15 +734,13 @@ static int iwl_mvm_get_last_nonqos_seq(struct iwl_mvm *mvm, | |||
739 | }; | 734 | }; |
740 | struct iwl_host_cmd cmd = { | 735 | struct iwl_host_cmd cmd = { |
741 | .id = NON_QOS_TX_COUNTER_CMD, | 736 | .id = NON_QOS_TX_COUNTER_CMD, |
742 | .flags = CMD_SYNC | CMD_WANT_SKB, | 737 | .flags = CMD_WANT_SKB, |
743 | }; | 738 | }; |
744 | int err; | 739 | int err; |
745 | u32 size; | 740 | u32 size; |
746 | 741 | ||
747 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API) { | 742 | cmd.data[0] = &query_cmd; |
748 | cmd.data[0] = &query_cmd; | 743 | cmd.len[0] = sizeof(query_cmd); |
749 | cmd.len[0] = sizeof(query_cmd); | ||
750 | } | ||
751 | 744 | ||
752 | err = iwl_mvm_send_cmd(mvm, &cmd); | 745 | err = iwl_mvm_send_cmd(mvm, &cmd); |
753 | if (err) | 746 | if (err) |
@@ -758,10 +751,8 @@ static int iwl_mvm_get_last_nonqos_seq(struct iwl_mvm *mvm, | |||
758 | err = -EINVAL; | 751 | err = -EINVAL; |
759 | } else { | 752 | } else { |
760 | err = le16_to_cpup((__le16 *)cmd.resp_pkt->data); | 753 | err = le16_to_cpup((__le16 *)cmd.resp_pkt->data); |
761 | /* new API returns next, not last-used seqno */ | 754 | /* firmware returns next, not last-used seqno */ |
762 | if (mvm->fw->ucode_capa.flags & | 755 | err = (u16) (err - 0x10); |
763 | IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API) | ||
764 | err = (u16) (err - 0x10); | ||
765 | } | 756 | } |
766 | 757 | ||
767 | iwl_free_resp(&cmd); | 758 | iwl_free_resp(&cmd); |
@@ -785,11 +776,7 @@ void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
785 | 776 | ||
786 | mvmvif->seqno_valid = false; | 777 | mvmvif->seqno_valid = false; |
787 | 778 | ||
788 | if (!(mvm->fw->ucode_capa.flags & | 779 | if (iwl_mvm_send_cmd_pdu(mvm, NON_QOS_TX_COUNTER_CMD, 0, |
789 | IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API)) | ||
790 | return; | ||
791 | |||
792 | if (iwl_mvm_send_cmd_pdu(mvm, NON_QOS_TX_COUNTER_CMD, CMD_SYNC, | ||
793 | sizeof(query_cmd), &query_cmd)) | 780 | sizeof(query_cmd), &query_cmd)) |
794 | IWL_ERR(mvm, "failed to set non-QoS seqno\n"); | 781 | IWL_ERR(mvm, "failed to set non-QoS seqno\n"); |
795 | } | 782 | } |
@@ -804,7 +791,7 @@ iwl_mvm_send_wowlan_config_cmd(struct iwl_mvm *mvm, | |||
804 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID) | 791 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID) |
805 | cmd_len = sizeof(*cmd); | 792 | cmd_len = sizeof(*cmd); |
806 | 793 | ||
807 | return iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, CMD_SYNC, | 794 | return iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, 0, |
808 | cmd_len, cmd); | 795 | cmd_len, cmd); |
809 | } | 796 | } |
810 | 797 | ||
@@ -833,7 +820,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, | |||
833 | }; | 820 | }; |
834 | struct iwl_host_cmd d3_cfg_cmd = { | 821 | struct iwl_host_cmd d3_cfg_cmd = { |
835 | .id = D3_CONFIG_CMD, | 822 | .id = D3_CONFIG_CMD, |
836 | .flags = CMD_SYNC | CMD_WANT_SKB, | 823 | .flags = CMD_WANT_SKB, |
837 | .data[0] = &d3_cfg_cmd_data, | 824 | .data[0] = &d3_cfg_cmd_data, |
838 | .len[0] = sizeof(d3_cfg_cmd_data), | 825 | .len[0] = sizeof(d3_cfg_cmd_data), |
839 | }; | 826 | }; |
@@ -983,7 +970,6 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, | |||
983 | if (key_data.use_rsc_tsc) { | 970 | if (key_data.use_rsc_tsc) { |
984 | struct iwl_host_cmd rsc_tsc_cmd = { | 971 | struct iwl_host_cmd rsc_tsc_cmd = { |
985 | .id = WOWLAN_TSC_RSC_PARAM, | 972 | .id = WOWLAN_TSC_RSC_PARAM, |
986 | .flags = CMD_SYNC, | ||
987 | .data[0] = key_data.rsc_tsc, | 973 | .data[0] = key_data.rsc_tsc, |
988 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, | 974 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, |
989 | .len[0] = sizeof(*key_data.rsc_tsc), | 975 | .len[0] = sizeof(*key_data.rsc_tsc), |
@@ -997,7 +983,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, | |||
997 | if (key_data.use_tkip) { | 983 | if (key_data.use_tkip) { |
998 | ret = iwl_mvm_send_cmd_pdu(mvm, | 984 | ret = iwl_mvm_send_cmd_pdu(mvm, |
999 | WOWLAN_TKIP_PARAM, | 985 | WOWLAN_TKIP_PARAM, |
1000 | CMD_SYNC, sizeof(tkip_cmd), | 986 | 0, sizeof(tkip_cmd), |
1001 | &tkip_cmd); | 987 | &tkip_cmd); |
1002 | if (ret) | 988 | if (ret) |
1003 | goto out; | 989 | goto out; |
@@ -1014,8 +1000,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, | |||
1014 | kek_kck_cmd.replay_ctr = mvmvif->rekey_data.replay_ctr; | 1000 | kek_kck_cmd.replay_ctr = mvmvif->rekey_data.replay_ctr; |
1015 | 1001 | ||
1016 | ret = iwl_mvm_send_cmd_pdu(mvm, | 1002 | ret = iwl_mvm_send_cmd_pdu(mvm, |
1017 | WOWLAN_KEK_KCK_MATERIAL, | 1003 | WOWLAN_KEK_KCK_MATERIAL, 0, |
1018 | CMD_SYNC, | ||
1019 | sizeof(kek_kck_cmd), | 1004 | sizeof(kek_kck_cmd), |
1020 | &kek_kck_cmd); | 1005 | &kek_kck_cmd); |
1021 | if (ret) | 1006 | if (ret) |
@@ -1031,7 +1016,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, | |||
1031 | if (ret) | 1016 | if (ret) |
1032 | goto out; | 1017 | goto out; |
1033 | 1018 | ||
1034 | ret = iwl_mvm_send_proto_offload(mvm, vif, false, CMD_SYNC); | 1019 | ret = iwl_mvm_send_proto_offload(mvm, vif, false, 0); |
1035 | if (ret) | 1020 | if (ret) |
1036 | goto out; | 1021 | goto out; |
1037 | 1022 | ||
@@ -1043,7 +1028,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, | |||
1043 | if (ret) | 1028 | if (ret) |
1044 | goto out; | 1029 | goto out; |
1045 | 1030 | ||
1046 | ret = iwl_mvm_power_update_mac(mvm, vif); | 1031 | ret = iwl_mvm_power_update_mac(mvm); |
1047 | if (ret) | 1032 | if (ret) |
1048 | goto out; | 1033 | goto out; |
1049 | 1034 | ||
@@ -1082,6 +1067,15 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, | |||
1082 | 1067 | ||
1083 | int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) | 1068 | int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) |
1084 | { | 1069 | { |
1070 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | ||
1071 | |||
1072 | if (iwl_mvm_is_d0i3_supported(mvm)) { | ||
1073 | mutex_lock(&mvm->d0i3_suspend_mutex); | ||
1074 | __set_bit(D0I3_DEFER_WAKEUP, &mvm->d0i3_suspend_flags); | ||
1075 | mutex_unlock(&mvm->d0i3_suspend_mutex); | ||
1076 | return 0; | ||
1077 | } | ||
1078 | |||
1085 | return __iwl_mvm_suspend(hw, wowlan, false); | 1079 | return __iwl_mvm_suspend(hw, wowlan, false); |
1086 | } | 1080 | } |
1087 | 1081 | ||
@@ -1277,7 +1271,7 @@ static void iwl_mvm_set_tkip_rx_seq(struct tkip_sc *scs, | |||
1277 | } | 1271 | } |
1278 | 1272 | ||
1279 | static void iwl_mvm_set_key_rx_seq(struct ieee80211_key_conf *key, | 1273 | static void iwl_mvm_set_key_rx_seq(struct ieee80211_key_conf *key, |
1280 | struct iwl_wowlan_status_v6 *status) | 1274 | struct iwl_wowlan_status *status) |
1281 | { | 1275 | { |
1282 | union iwl_all_tsc_rsc *rsc = &status->gtk.rsc.all_tsc_rsc; | 1276 | union iwl_all_tsc_rsc *rsc = &status->gtk.rsc.all_tsc_rsc; |
1283 | 1277 | ||
@@ -1294,7 +1288,7 @@ static void iwl_mvm_set_key_rx_seq(struct ieee80211_key_conf *key, | |||
1294 | } | 1288 | } |
1295 | 1289 | ||
1296 | struct iwl_mvm_d3_gtk_iter_data { | 1290 | struct iwl_mvm_d3_gtk_iter_data { |
1297 | struct iwl_wowlan_status_v6 *status; | 1291 | struct iwl_wowlan_status *status; |
1298 | void *last_gtk; | 1292 | void *last_gtk; |
1299 | u32 cipher; | 1293 | u32 cipher; |
1300 | bool find_phase, unhandled_cipher; | 1294 | bool find_phase, unhandled_cipher; |
@@ -1370,7 +1364,7 @@ static void iwl_mvm_d3_update_gtks(struct ieee80211_hw *hw, | |||
1370 | 1364 | ||
1371 | static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm, | 1365 | static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm, |
1372 | struct ieee80211_vif *vif, | 1366 | struct ieee80211_vif *vif, |
1373 | struct iwl_wowlan_status_v6 *status) | 1367 | struct iwl_wowlan_status *status) |
1374 | { | 1368 | { |
1375 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 1369 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
1376 | struct iwl_mvm_d3_gtk_iter_data gtkdata = { | 1370 | struct iwl_mvm_d3_gtk_iter_data gtkdata = { |
@@ -1465,10 +1459,10 @@ static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, | |||
1465 | } err_info; | 1459 | } err_info; |
1466 | struct iwl_host_cmd cmd = { | 1460 | struct iwl_host_cmd cmd = { |
1467 | .id = WOWLAN_GET_STATUSES, | 1461 | .id = WOWLAN_GET_STATUSES, |
1468 | .flags = CMD_SYNC | CMD_WANT_SKB, | 1462 | .flags = CMD_WANT_SKB, |
1469 | }; | 1463 | }; |
1470 | struct iwl_wowlan_status_data status; | 1464 | struct iwl_wowlan_status_data status; |
1471 | struct iwl_wowlan_status_v6 *status_v6; | 1465 | struct iwl_wowlan_status *fw_status; |
1472 | int ret, len, status_size, i; | 1466 | int ret, len, status_size, i; |
1473 | bool keep; | 1467 | bool keep; |
1474 | struct ieee80211_sta *ap_sta; | 1468 | struct ieee80211_sta *ap_sta; |
@@ -1491,7 +1485,7 @@ static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, | |||
1491 | } | 1485 | } |
1492 | 1486 | ||
1493 | /* only for tracing for now */ | 1487 | /* only for tracing for now */ |
1494 | ret = iwl_mvm_send_cmd_pdu(mvm, OFFLOADS_QUERY_CMD, CMD_SYNC, 0, NULL); | 1488 | ret = iwl_mvm_send_cmd_pdu(mvm, OFFLOADS_QUERY_CMD, 0, 0, NULL); |
1495 | if (ret) | 1489 | if (ret) |
1496 | IWL_ERR(mvm, "failed to query offload statistics (%d)\n", ret); | 1490 | IWL_ERR(mvm, "failed to query offload statistics (%d)\n", ret); |
1497 | 1491 | ||
@@ -1505,10 +1499,7 @@ static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, | |||
1505 | if (!cmd.resp_pkt) | 1499 | if (!cmd.resp_pkt) |
1506 | goto out_unlock; | 1500 | goto out_unlock; |
1507 | 1501 | ||
1508 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API) | 1502 | status_size = sizeof(*fw_status); |
1509 | status_size = sizeof(struct iwl_wowlan_status_v6); | ||
1510 | else | ||
1511 | status_size = sizeof(struct iwl_wowlan_status_v4); | ||
1512 | 1503 | ||
1513 | len = iwl_rx_packet_payload_len(cmd.resp_pkt); | 1504 | len = iwl_rx_packet_payload_len(cmd.resp_pkt); |
1514 | if (len < status_size) { | 1505 | if (len < status_size) { |
@@ -1516,35 +1507,18 @@ static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, | |||
1516 | goto out_free_resp; | 1507 | goto out_free_resp; |
1517 | } | 1508 | } |
1518 | 1509 | ||
1519 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API) { | 1510 | fw_status = (void *)cmd.resp_pkt->data; |
1520 | status_v6 = (void *)cmd.resp_pkt->data; | 1511 | |
1521 | 1512 | status.pattern_number = le16_to_cpu(fw_status->pattern_number); | |
1522 | status.pattern_number = le16_to_cpu(status_v6->pattern_number); | 1513 | for (i = 0; i < 8; i++) |
1523 | for (i = 0; i < 8; i++) | 1514 | status.qos_seq_ctr[i] = |
1524 | status.qos_seq_ctr[i] = | 1515 | le16_to_cpu(fw_status->qos_seq_ctr[i]); |
1525 | le16_to_cpu(status_v6->qos_seq_ctr[i]); | 1516 | status.wakeup_reasons = le32_to_cpu(fw_status->wakeup_reasons); |
1526 | status.wakeup_reasons = le32_to_cpu(status_v6->wakeup_reasons); | 1517 | status.wake_packet_length = |
1527 | status.wake_packet_length = | 1518 | le32_to_cpu(fw_status->wake_packet_length); |
1528 | le32_to_cpu(status_v6->wake_packet_length); | 1519 | status.wake_packet_bufsize = |
1529 | status.wake_packet_bufsize = | 1520 | le32_to_cpu(fw_status->wake_packet_bufsize); |
1530 | le32_to_cpu(status_v6->wake_packet_bufsize); | 1521 | status.wake_packet = fw_status->wake_packet; |
1531 | status.wake_packet = status_v6->wake_packet; | ||
1532 | } else { | ||
1533 | struct iwl_wowlan_status_v4 *status_v4; | ||
1534 | status_v6 = NULL; | ||
1535 | status_v4 = (void *)cmd.resp_pkt->data; | ||
1536 | |||
1537 | status.pattern_number = le16_to_cpu(status_v4->pattern_number); | ||
1538 | for (i = 0; i < 8; i++) | ||
1539 | status.qos_seq_ctr[i] = | ||
1540 | le16_to_cpu(status_v4->qos_seq_ctr[i]); | ||
1541 | status.wakeup_reasons = le32_to_cpu(status_v4->wakeup_reasons); | ||
1542 | status.wake_packet_length = | ||
1543 | le32_to_cpu(status_v4->wake_packet_length); | ||
1544 | status.wake_packet_bufsize = | ||
1545 | le32_to_cpu(status_v4->wake_packet_bufsize); | ||
1546 | status.wake_packet = status_v4->wake_packet; | ||
1547 | } | ||
1548 | 1522 | ||
1549 | if (len != status_size + ALIGN(status.wake_packet_bufsize, 4)) { | 1523 | if (len != status_size + ALIGN(status.wake_packet_bufsize, 4)) { |
1550 | IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); | 1524 | IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); |
@@ -1571,7 +1545,7 @@ static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, | |||
1571 | 1545 | ||
1572 | iwl_mvm_report_wakeup_reasons(mvm, vif, &status); | 1546 | iwl_mvm_report_wakeup_reasons(mvm, vif, &status); |
1573 | 1547 | ||
1574 | keep = iwl_mvm_setup_connection_keep(mvm, vif, status_v6); | 1548 | keep = iwl_mvm_setup_connection_keep(mvm, vif, fw_status); |
1575 | 1549 | ||
1576 | iwl_free_resp(&cmd); | 1550 | iwl_free_resp(&cmd); |
1577 | return keep; | 1551 | return keep; |
@@ -1674,6 +1648,19 @@ int iwl_mvm_resume(struct ieee80211_hw *hw) | |||
1674 | { | 1648 | { |
1675 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | 1649 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); |
1676 | 1650 | ||
1651 | if (iwl_mvm_is_d0i3_supported(mvm)) { | ||
1652 | bool exit_now; | ||
1653 | |||
1654 | mutex_lock(&mvm->d0i3_suspend_mutex); | ||
1655 | __clear_bit(D0I3_DEFER_WAKEUP, &mvm->d0i3_suspend_flags); | ||
1656 | exit_now = __test_and_clear_bit(D0I3_PENDING_WAKEUP, | ||
1657 | &mvm->d0i3_suspend_flags); | ||
1658 | mutex_unlock(&mvm->d0i3_suspend_mutex); | ||
1659 | if (exit_now) | ||
1660 | _iwl_mvm_exit_d0i3(mvm); | ||
1661 | return 0; | ||
1662 | } | ||
1663 | |||
1677 | return __iwl_mvm_resume(mvm, false); | 1664 | return __iwl_mvm_resume(mvm, false); |
1678 | } | 1665 | } |
1679 | 1666 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c index 9b59e1d7ae71..2e90ff795c13 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c | |||
@@ -103,10 +103,6 @@ static void iwl_dbgfs_update_pm(struct iwl_mvm *mvm, | |||
103 | IWL_DEBUG_POWER(mvm, "tx_data_timeout=%d\n", val); | 103 | IWL_DEBUG_POWER(mvm, "tx_data_timeout=%d\n", val); |
104 | dbgfs_pm->tx_data_timeout = val; | 104 | dbgfs_pm->tx_data_timeout = val; |
105 | break; | 105 | break; |
106 | case MVM_DEBUGFS_PM_DISABLE_POWER_OFF: | ||
107 | IWL_DEBUG_POWER(mvm, "disable_power_off=%d\n", val); | ||
108 | dbgfs_pm->disable_power_off = val; | ||
109 | break; | ||
110 | case MVM_DEBUGFS_PM_LPRX_ENA: | 106 | case MVM_DEBUGFS_PM_LPRX_ENA: |
111 | IWL_DEBUG_POWER(mvm, "lprx %s\n", val ? "enabled" : "disabled"); | 107 | IWL_DEBUG_POWER(mvm, "lprx %s\n", val ? "enabled" : "disabled"); |
112 | dbgfs_pm->lprx_ena = val; | 108 | dbgfs_pm->lprx_ena = val; |
@@ -154,12 +150,6 @@ static ssize_t iwl_dbgfs_pm_params_write(struct ieee80211_vif *vif, char *buf, | |||
154 | if (sscanf(buf + 16, "%d", &val) != 1) | 150 | if (sscanf(buf + 16, "%d", &val) != 1) |
155 | return -EINVAL; | 151 | return -EINVAL; |
156 | param = MVM_DEBUGFS_PM_TX_DATA_TIMEOUT; | 152 | param = MVM_DEBUGFS_PM_TX_DATA_TIMEOUT; |
157 | } else if (!strncmp("disable_power_off=", buf, 18) && | ||
158 | !(mvm->fw->ucode_capa.flags & | ||
159 | IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD)) { | ||
160 | if (sscanf(buf + 18, "%d", &val) != 1) | ||
161 | return -EINVAL; | ||
162 | param = MVM_DEBUGFS_PM_DISABLE_POWER_OFF; | ||
163 | } else if (!strncmp("lprx=", buf, 5)) { | 153 | } else if (!strncmp("lprx=", buf, 5)) { |
164 | if (sscanf(buf + 5, "%d", &val) != 1) | 154 | if (sscanf(buf + 5, "%d", &val) != 1) |
165 | return -EINVAL; | 155 | return -EINVAL; |
@@ -185,7 +175,7 @@ static ssize_t iwl_dbgfs_pm_params_write(struct ieee80211_vif *vif, char *buf, | |||
185 | 175 | ||
186 | mutex_lock(&mvm->mutex); | 176 | mutex_lock(&mvm->mutex); |
187 | iwl_dbgfs_update_pm(mvm, vif, param, val); | 177 | iwl_dbgfs_update_pm(mvm, vif, param, val); |
188 | ret = iwl_mvm_power_update_mac(mvm, vif); | 178 | ret = iwl_mvm_power_update_mac(mvm); |
189 | mutex_unlock(&mvm->mutex); | 179 | mutex_unlock(&mvm->mutex); |
190 | 180 | ||
191 | return ret ?: count; | 181 | return ret ?: count; |
@@ -272,10 +262,9 @@ static ssize_t iwl_dbgfs_mac_params_read(struct file *file, | |||
272 | struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; | 262 | struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; |
273 | 263 | ||
274 | pos += scnprintf(buf+pos, bufsz-pos, | 264 | pos += scnprintf(buf+pos, bufsz-pos, |
275 | "ap_sta_id %d - reduced Tx power %d force %d\n", | 265 | "ap_sta_id %d - reduced Tx power %d\n", |
276 | ap_sta_id, | 266 | ap_sta_id, |
277 | mvm_sta->bt_reduced_txpower, | 267 | mvm_sta->bt_reduced_txpower); |
278 | mvm_sta->bt_reduced_txpower_dbg); | ||
279 | } | 268 | } |
280 | } | 269 | } |
281 | 270 | ||
@@ -293,41 +282,6 @@ static ssize_t iwl_dbgfs_mac_params_read(struct file *file, | |||
293 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 282 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
294 | } | 283 | } |
295 | 284 | ||
296 | static ssize_t iwl_dbgfs_reduced_txp_write(struct ieee80211_vif *vif, | ||
297 | char *buf, size_t count, | ||
298 | loff_t *ppos) | ||
299 | { | ||
300 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
301 | struct iwl_mvm *mvm = mvmvif->mvm; | ||
302 | struct iwl_mvm_sta *mvmsta; | ||
303 | bool reduced_tx_power; | ||
304 | int ret; | ||
305 | |||
306 | if (mvmvif->ap_sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id)) | ||
307 | return -ENOTCONN; | ||
308 | |||
309 | if (strtobool(buf, &reduced_tx_power) != 0) | ||
310 | return -EINVAL; | ||
311 | |||
312 | mutex_lock(&mvm->mutex); | ||
313 | |||
314 | mvmsta = iwl_mvm_sta_from_staid_protected(mvm, mvmvif->ap_sta_id); | ||
315 | if (IS_ERR_OR_NULL(mvmsta)) { | ||
316 | mutex_unlock(&mvm->mutex); | ||
317 | return -ENOTCONN; | ||
318 | } | ||
319 | |||
320 | mvmsta->bt_reduced_txpower_dbg = false; | ||
321 | ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, | ||
322 | reduced_tx_power); | ||
323 | if (!ret) | ||
324 | mvmsta->bt_reduced_txpower_dbg = true; | ||
325 | |||
326 | mutex_unlock(&mvm->mutex); | ||
327 | |||
328 | return ret ? : count; | ||
329 | } | ||
330 | |||
331 | static void iwl_dbgfs_update_bf(struct ieee80211_vif *vif, | 285 | static void iwl_dbgfs_update_bf(struct ieee80211_vif *vif, |
332 | enum iwl_dbgfs_bf_mask param, int value) | 286 | enum iwl_dbgfs_bf_mask param, int value) |
333 | { | 287 | { |
@@ -462,9 +416,9 @@ static ssize_t iwl_dbgfs_bf_params_write(struct ieee80211_vif *vif, char *buf, | |||
462 | mutex_lock(&mvm->mutex); | 416 | mutex_lock(&mvm->mutex); |
463 | iwl_dbgfs_update_bf(vif, param, value); | 417 | iwl_dbgfs_update_bf(vif, param, value); |
464 | if (param == MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER && !value) | 418 | if (param == MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER && !value) |
465 | ret = iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC); | 419 | ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0); |
466 | else | 420 | else |
467 | ret = iwl_mvm_enable_beacon_filter(mvm, vif, CMD_SYNC); | 421 | ret = iwl_mvm_enable_beacon_filter(mvm, vif, 0); |
468 | mutex_unlock(&mvm->mutex); | 422 | mutex_unlock(&mvm->mutex); |
469 | 423 | ||
470 | return ret ?: count; | 424 | return ret ?: count; |
@@ -568,7 +522,6 @@ MVM_DEBUGFS_READ_FILE_OPS(mac_params); | |||
568 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(pm_params, 32); | 522 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(pm_params, 32); |
569 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(bf_params, 256); | 523 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(bf_params, 256); |
570 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(low_latency, 10); | 524 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(low_latency, 10); |
571 | MVM_DEBUGFS_WRITE_FILE_OPS(reduced_txp, 10); | ||
572 | 525 | ||
573 | void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | 526 | void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
574 | { | 527 | { |
@@ -592,8 +545,7 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
592 | return; | 545 | return; |
593 | } | 546 | } |
594 | 547 | ||
595 | if ((mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PM_CMD_SUPPORT) && | 548 | if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM && |
596 | iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM && | ||
597 | ((vif->type == NL80211_IFTYPE_STATION && !vif->p2p) || | 549 | ((vif->type == NL80211_IFTYPE_STATION && !vif->p2p) || |
598 | (vif->type == NL80211_IFTYPE_STATION && vif->p2p && | 550 | (vif->type == NL80211_IFTYPE_STATION && vif->p2p && |
599 | mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM))) | 551 | mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM))) |
@@ -601,7 +553,6 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
601 | S_IRUSR); | 553 | S_IRUSR); |
602 | 554 | ||
603 | MVM_DEBUGFS_ADD_FILE_VIF(mac_params, mvmvif->dbgfs_dir, S_IRUSR); | 555 | MVM_DEBUGFS_ADD_FILE_VIF(mac_params, mvmvif->dbgfs_dir, S_IRUSR); |
604 | MVM_DEBUGFS_ADD_FILE_VIF(reduced_txp, mvmvif->dbgfs_dir, S_IWUSR); | ||
605 | MVM_DEBUGFS_ADD_FILE_VIF(low_latency, mvmvif->dbgfs_dir, | 556 | MVM_DEBUGFS_ADD_FILE_VIF(low_latency, mvmvif->dbgfs_dir, |
606 | S_IRUSR | S_IWUSR); | 557 | S_IRUSR | S_IWUSR); |
607 | 558 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c index 1b52deea6081..29ca72695eaa 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c | |||
@@ -65,9 +65,8 @@ | |||
65 | #include "mvm.h" | 65 | #include "mvm.h" |
66 | #include "sta.h" | 66 | #include "sta.h" |
67 | #include "iwl-io.h" | 67 | #include "iwl-io.h" |
68 | #include "iwl-prph.h" | ||
69 | #include "debugfs.h" | 68 | #include "debugfs.h" |
70 | #include "fw-error-dump.h" | 69 | #include "iwl-fw-error-dump.h" |
71 | 70 | ||
72 | static ssize_t iwl_dbgfs_tx_flush_write(struct iwl_mvm *mvm, char *buf, | 71 | static ssize_t iwl_dbgfs_tx_flush_write(struct iwl_mvm *mvm, char *buf, |
73 | size_t count, loff_t *ppos) | 72 | size_t count, loff_t *ppos) |
@@ -136,9 +135,6 @@ static int iwl_dbgfs_fw_error_dump_open(struct inode *inode, struct file *file) | |||
136 | 135 | ||
137 | file->private_data = mvm->fw_error_dump; | 136 | file->private_data = mvm->fw_error_dump; |
138 | mvm->fw_error_dump = NULL; | 137 | mvm->fw_error_dump = NULL; |
139 | kfree(mvm->fw_error_sram); | ||
140 | mvm->fw_error_sram = NULL; | ||
141 | mvm->fw_error_sram_len = 0; | ||
142 | ret = 0; | 138 | ret = 0; |
143 | 139 | ||
144 | out: | 140 | out: |
@@ -684,7 +680,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mvm *mvm, char *buf, | |||
684 | mvm->restart_fw++; | 680 | mvm->restart_fw++; |
685 | 681 | ||
686 | /* take the return value to make compiler happy - it will fail anyway */ | 682 | /* take the return value to make compiler happy - it will fail anyway */ |
687 | ret = iwl_mvm_send_cmd_pdu(mvm, REPLY_ERROR, CMD_SYNC, 0, NULL); | 683 | ret = iwl_mvm_send_cmd_pdu(mvm, REPLY_ERROR, 0, 0, NULL); |
688 | 684 | ||
689 | mutex_unlock(&mvm->mutex); | 685 | mutex_unlock(&mvm->mutex); |
690 | 686 | ||
@@ -694,7 +690,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mvm *mvm, char *buf, | |||
694 | static ssize_t iwl_dbgfs_fw_nmi_write(struct iwl_mvm *mvm, char *buf, | 690 | static ssize_t iwl_dbgfs_fw_nmi_write(struct iwl_mvm *mvm, char *buf, |
695 | size_t count, loff_t *ppos) | 691 | size_t count, loff_t *ppos) |
696 | { | 692 | { |
697 | iwl_write_prph(mvm->trans, DEVICE_SET_NMI_REG, 1); | 693 | iwl_force_nmi(mvm->trans); |
698 | 694 | ||
699 | return count; | 695 | return count; |
700 | } | 696 | } |
@@ -841,7 +837,7 @@ static ssize_t iwl_dbgfs_bcast_filters_write(struct iwl_mvm *mvm, char *buf, | |||
841 | /* send updated bcast filtering configuration */ | 837 | /* send updated bcast filtering configuration */ |
842 | if (mvm->dbgfs_bcast_filtering.override && | 838 | if (mvm->dbgfs_bcast_filtering.override && |
843 | iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) | 839 | iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) |
844 | err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, CMD_SYNC, | 840 | err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0, |
845 | sizeof(cmd), &cmd); | 841 | sizeof(cmd), &cmd); |
846 | mutex_unlock(&mvm->mutex); | 842 | mutex_unlock(&mvm->mutex); |
847 | 843 | ||
@@ -913,7 +909,7 @@ static ssize_t iwl_dbgfs_bcast_filters_macs_write(struct iwl_mvm *mvm, | |||
913 | /* send updated bcast filtering configuration */ | 909 | /* send updated bcast filtering configuration */ |
914 | if (mvm->dbgfs_bcast_filtering.override && | 910 | if (mvm->dbgfs_bcast_filtering.override && |
915 | iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) | 911 | iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) |
916 | err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, CMD_SYNC, | 912 | err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0, |
917 | sizeof(cmd), &cmd); | 913 | sizeof(cmd), &cmd); |
918 | mutex_unlock(&mvm->mutex); | 914 | mutex_unlock(&mvm->mutex); |
919 | 915 | ||
@@ -1004,6 +1000,7 @@ static ssize_t iwl_dbgfs_d0i3_refs_read(struct file *file, | |||
1004 | PRINT_MVM_REF(IWL_MVM_REF_P2P_CLIENT); | 1000 | PRINT_MVM_REF(IWL_MVM_REF_P2P_CLIENT); |
1005 | PRINT_MVM_REF(IWL_MVM_REF_AP_IBSS); | 1001 | PRINT_MVM_REF(IWL_MVM_REF_AP_IBSS); |
1006 | PRINT_MVM_REF(IWL_MVM_REF_USER); | 1002 | PRINT_MVM_REF(IWL_MVM_REF_USER); |
1003 | PRINT_MVM_REF(IWL_MVM_REF_EXIT_WORK); | ||
1007 | 1004 | ||
1008 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 1005 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
1009 | } | 1006 | } |
@@ -1108,9 +1105,9 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(scan_ant_rxchain, 8); | |||
1108 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(d0i3_refs, 8); | 1105 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(d0i3_refs, 8); |
1109 | 1106 | ||
1110 | static const struct file_operations iwl_dbgfs_fw_error_dump_ops = { | 1107 | static const struct file_operations iwl_dbgfs_fw_error_dump_ops = { |
1111 | .open = iwl_dbgfs_fw_error_dump_open, | 1108 | .open = iwl_dbgfs_fw_error_dump_open, |
1112 | .read = iwl_dbgfs_fw_error_dump_read, | 1109 | .read = iwl_dbgfs_fw_error_dump_read, |
1113 | .release = iwl_dbgfs_fw_error_dump_release, | 1110 | .release = iwl_dbgfs_fw_error_dump_release, |
1114 | }; | 1111 | }; |
1115 | 1112 | ||
1116 | #ifdef CONFIG_IWLWIFI_BCAST_FILTERING | 1113 | #ifdef CONFIG_IWLWIFI_BCAST_FILTERING |
@@ -1138,9 +1135,8 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir) | |||
1138 | MVM_DEBUGFS_ADD_FILE(fw_error_dump, dbgfs_dir, S_IRUSR); | 1135 | MVM_DEBUGFS_ADD_FILE(fw_error_dump, dbgfs_dir, S_IRUSR); |
1139 | MVM_DEBUGFS_ADD_FILE(bt_notif, dbgfs_dir, S_IRUSR); | 1136 | MVM_DEBUGFS_ADD_FILE(bt_notif, dbgfs_dir, S_IRUSR); |
1140 | MVM_DEBUGFS_ADD_FILE(bt_cmd, dbgfs_dir, S_IRUSR); | 1137 | MVM_DEBUGFS_ADD_FILE(bt_cmd, dbgfs_dir, S_IRUSR); |
1141 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD) | 1138 | MVM_DEBUGFS_ADD_FILE(disable_power_off, mvm->debugfs_dir, |
1142 | MVM_DEBUGFS_ADD_FILE(disable_power_off, mvm->debugfs_dir, | 1139 | S_IRUSR | S_IWUSR); |
1143 | S_IRUSR | S_IWUSR); | ||
1144 | MVM_DEBUGFS_ADD_FILE(fw_rx_stats, mvm->debugfs_dir, S_IRUSR); | 1140 | MVM_DEBUGFS_ADD_FILE(fw_rx_stats, mvm->debugfs_dir, S_IRUSR); |
1145 | MVM_DEBUGFS_ADD_FILE(drv_rx_stats, mvm->debugfs_dir, S_IRUSR); | 1141 | MVM_DEBUGFS_ADD_FILE(drv_rx_stats, mvm->debugfs_dir, S_IRUSR); |
1146 | MVM_DEBUGFS_ADD_FILE(fw_restart, mvm->debugfs_dir, S_IWUSR); | 1142 | MVM_DEBUGFS_ADD_FILE(fw_restart, mvm->debugfs_dir, S_IWUSR); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-coex.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-coex.h index 21877e5966a8..5fe82c29c8ad 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-coex.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-coex.h | |||
@@ -141,7 +141,8 @@ enum iwl_bt_coex_lut_type { | |||
141 | BT_COEX_TX_DIS_LUT, | 141 | BT_COEX_TX_DIS_LUT, |
142 | 142 | ||
143 | BT_COEX_MAX_LUT, | 143 | BT_COEX_MAX_LUT, |
144 | }; | 144 | BT_COEX_INVALID_LUT = 0xff, |
145 | }; /* BT_COEX_DECISION_LUT_INDEX_API_E_VER_1 */ | ||
145 | 146 | ||
146 | #define BT_COEX_LUT_SIZE (12) | 147 | #define BT_COEX_LUT_SIZE (12) |
147 | #define BT_COEX_CORUN_LUT_SIZE (32) | 148 | #define BT_COEX_CORUN_LUT_SIZE (32) |
@@ -154,19 +155,23 @@ enum iwl_bt_coex_lut_type { | |||
154 | * @flags:&enum iwl_bt_coex_flags | 155 | * @flags:&enum iwl_bt_coex_flags |
155 | * @max_kill: | 156 | * @max_kill: |
156 | * @bt_reduced_tx_power: enum %iwl_bt_reduced_tx_power | 157 | * @bt_reduced_tx_power: enum %iwl_bt_reduced_tx_power |
157 | * @bt4_antenna_isolation: | 158 | * @override_primary_lut: enum %iwl_bt_coex_lut_type: BT_COEX_INVALID_LUT |
158 | * @bt4_antenna_isolation_thr: | 159 | * should be set by default |
159 | * @bt4_tx_tx_delta_freq_thr: | 160 | * @override_secondary_lut: enum %iwl_bt_coex_lut_type: BT_COEX_INVALID_LUT |
160 | * @bt4_tx_rx_max_freq0: | 161 | * should be set by default |
161 | * @bt_prio_boost: | 162 | * @bt4_antenna_isolation: antenna isolation |
163 | * @bt4_antenna_isolation_thr: antenna threshold value | ||
164 | * @bt4_tx_tx_delta_freq_thr: TxTx delta frequency | ||
165 | * @bt4_tx_rx_max_freq0: TxRx max frequency | ||
166 | * @bt_prio_boost: BT priority boost registers | ||
162 | * @wifi_tx_prio_boost: SW boost of wifi tx priority | 167 | * @wifi_tx_prio_boost: SW boost of wifi tx priority |
163 | * @wifi_rx_prio_boost: SW boost of wifi rx priority | 168 | * @wifi_rx_prio_boost: SW boost of wifi rx priority |
164 | * @kill_ack_msk: | 169 | * @kill_ack_msk: kill ACK mask. 1 - Tx ACK, 0 - kill Tx of ACK. |
165 | * @kill_cts_msk: | 170 | * @kill_cts_msk: kill CTS mask. 1 - Tx CTS, 0 - kill Tx of CTS. |
166 | * @decision_lut: | 171 | * @decision_lut: PTA decision LUT, per Prio-Ch |
167 | * @bt4_multiprio_lut: | 172 | * @bt4_multiprio_lut: multi priority LUT configuration |
168 | * @bt4_corun_lut20: | 173 | * @bt4_corun_lut20: co-running 20 MHz LUT configuration |
169 | * @bt4_corun_lut40: | 174 | * @bt4_corun_lut40: co-running 40 MHz LUT configuration |
170 | * @valid_bit_msk: enum %iwl_bt_coex_valid_bit_msk | 175 | * @valid_bit_msk: enum %iwl_bt_coex_valid_bit_msk |
171 | * | 176 | * |
172 | * The structure is used for the BT_COEX command. | 177 | * The structure is used for the BT_COEX command. |
@@ -175,7 +180,8 @@ struct iwl_bt_coex_cmd { | |||
175 | __le32 flags; | 180 | __le32 flags; |
176 | u8 max_kill; | 181 | u8 max_kill; |
177 | u8 bt_reduced_tx_power; | 182 | u8 bt_reduced_tx_power; |
178 | u8 reserved[2]; | 183 | u8 override_primary_lut; |
184 | u8 override_secondary_lut; | ||
179 | 185 | ||
180 | u8 bt4_antenna_isolation; | 186 | u8 bt4_antenna_isolation; |
181 | u8 bt4_antenna_isolation_thr; | 187 | u8 bt4_antenna_isolation_thr; |
@@ -194,7 +200,7 @@ struct iwl_bt_coex_cmd { | |||
194 | __le32 bt4_corun_lut40[BT_COEX_CORUN_LUT_SIZE]; | 200 | __le32 bt4_corun_lut40[BT_COEX_CORUN_LUT_SIZE]; |
195 | 201 | ||
196 | __le32 valid_bit_msk; | 202 | __le32 valid_bit_msk; |
197 | } __packed; /* BT_COEX_CMD_API_S_VER_3 */ | 203 | } __packed; /* BT_COEX_CMD_API_S_VER_5 */ |
198 | 204 | ||
199 | /** | 205 | /** |
200 | * struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command | 206 | * struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command |
@@ -282,7 +288,7 @@ enum iwl_bt_activity_grading { | |||
282 | BT_ON_NO_CONNECTION = 1, | 288 | BT_ON_NO_CONNECTION = 1, |
283 | BT_LOW_TRAFFIC = 2, | 289 | BT_LOW_TRAFFIC = 2, |
284 | BT_HIGH_TRAFFIC = 3, | 290 | BT_HIGH_TRAFFIC = 3, |
285 | }; | 291 | }; /* BT_COEX_BT_ACTIVITY_GRADING_API_E_VER_1 */ |
286 | 292 | ||
287 | /** | 293 | /** |
288 | * struct iwl_bt_coex_profile_notif - notification about BT coex | 294 | * struct iwl_bt_coex_profile_notif - notification about BT coex |
@@ -310,7 +316,7 @@ struct iwl_bt_coex_profile_notif { | |||
310 | __le32 primary_ch_lut; | 316 | __le32 primary_ch_lut; |
311 | __le32 secondary_ch_lut; | 317 | __le32 secondary_ch_lut; |
312 | __le32 bt_activity_grading; | 318 | __le32 bt_activity_grading; |
313 | } __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_2 */ | 319 | } __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_3 */ |
314 | 320 | ||
315 | enum iwl_bt_coex_prio_table_event { | 321 | enum iwl_bt_coex_prio_table_event { |
316 | BT_COEX_PRIO_TBL_EVT_INIT_CALIB1 = 0, | 322 | BT_COEX_PRIO_TBL_EVT_INIT_CALIB1 = 0, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h index 10fcc1a79ebd..13696fe419b7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h | |||
@@ -345,21 +345,6 @@ enum iwl_wowlan_wakeup_reason { | |||
345 | IWL_WOWLAN_WAKEUP_BY_REM_WAKE_WAKEUP_PACKET = BIT(12), | 345 | IWL_WOWLAN_WAKEUP_BY_REM_WAKE_WAKEUP_PACKET = BIT(12), |
346 | }; /* WOWLAN_WAKE_UP_REASON_API_E_VER_2 */ | 346 | }; /* WOWLAN_WAKE_UP_REASON_API_E_VER_2 */ |
347 | 347 | ||
348 | struct iwl_wowlan_status_v4 { | ||
349 | __le64 replay_ctr; | ||
350 | __le16 pattern_number; | ||
351 | __le16 non_qos_seq_ctr; | ||
352 | __le16 qos_seq_ctr[8]; | ||
353 | __le32 wakeup_reasons; | ||
354 | __le32 rekey_status; | ||
355 | __le32 num_of_gtk_rekeys; | ||
356 | __le32 transmitted_ndps; | ||
357 | __le32 received_beacons; | ||
358 | __le32 wake_packet_length; | ||
359 | __le32 wake_packet_bufsize; | ||
360 | u8 wake_packet[]; /* can be truncated from _length to _bufsize */ | ||
361 | } __packed; /* WOWLAN_STATUSES_API_S_VER_4 */ | ||
362 | |||
363 | struct iwl_wowlan_gtk_status { | 348 | struct iwl_wowlan_gtk_status { |
364 | u8 key_index; | 349 | u8 key_index; |
365 | u8 reserved[3]; | 350 | u8 reserved[3]; |
@@ -368,7 +353,7 @@ struct iwl_wowlan_gtk_status { | |||
368 | struct iwl_wowlan_rsc_tsc_params_cmd rsc; | 353 | struct iwl_wowlan_rsc_tsc_params_cmd rsc; |
369 | } __packed; | 354 | } __packed; |
370 | 355 | ||
371 | struct iwl_wowlan_status_v6 { | 356 | struct iwl_wowlan_status { |
372 | struct iwl_wowlan_gtk_status gtk; | 357 | struct iwl_wowlan_gtk_status gtk; |
373 | __le64 replay_ctr; | 358 | __le64 replay_ctr; |
374 | __le16 pattern_number; | 359 | __le16 pattern_number; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h index 39148b5bb332..8bb5b94bf963 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h | |||
@@ -334,7 +334,7 @@ enum { | |||
334 | */ | 334 | */ |
335 | struct iwl_lq_cmd { | 335 | struct iwl_lq_cmd { |
336 | u8 sta_id; | 336 | u8 sta_id; |
337 | u8 reserved1; | 337 | u8 reduced_tpc; |
338 | u16 control; | 338 | u16 control; |
339 | /* LINK_QUAL_GENERAL_PARAMS_API_S_VER_1 */ | 339 | /* LINK_QUAL_GENERAL_PARAMS_API_S_VER_1 */ |
340 | u8 flags; | 340 | u8 flags; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h index d73a89ecd78a..6959fda3fe09 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h | |||
@@ -169,8 +169,12 @@ enum iwl_scan_type { | |||
169 | SCAN_TYPE_DISCOVERY_FORCED = 6, | 169 | SCAN_TYPE_DISCOVERY_FORCED = 6, |
170 | }; /* SCAN_ACTIVITY_TYPE_E_VER_1 */ | 170 | }; /* SCAN_ACTIVITY_TYPE_E_VER_1 */ |
171 | 171 | ||
172 | /* Maximal number of channels to scan */ | 172 | /** |
173 | #define MAX_NUM_SCAN_CHANNELS 0x24 | 173 | * Maximal number of channels to scan |
174 | * it should be equal to: | ||
175 | * max(IWL_NUM_CHANNELS, IWL_NUM_CHANNELS_FAMILY_8000) | ||
176 | */ | ||
177 | #define MAX_NUM_SCAN_CHANNELS 50 | ||
174 | 178 | ||
175 | /** | 179 | /** |
176 | * struct iwl_scan_cmd - scan request command | 180 | * struct iwl_scan_cmd - scan request command |
@@ -534,13 +538,16 @@ struct iwl_scan_offload_schedule { | |||
534 | * | 538 | * |
535 | * IWL_SCAN_OFFLOAD_FLAG_PASS_ALL: pass all results - no filtering. | 539 | * IWL_SCAN_OFFLOAD_FLAG_PASS_ALL: pass all results - no filtering. |
536 | * IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL: add cached channels to partial scan. | 540 | * IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL: add cached channels to partial scan. |
537 | * IWL_SCAN_OFFLOAD_FLAG_ENERGY_SCAN: use energy based scan before partial scan | 541 | * IWL_SCAN_OFFLOAD_FLAG_EBS_QUICK_MODE: EBS duration is 100mSec - typical |
538 | * on A band. | 542 | * beacon period. Finding channel activity in this mode is not guaranteed. |
543 | * IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE: EBS duration is 200mSec. | ||
544 | * Assuming beacon period is 100ms finding channel activity is guaranteed. | ||
539 | */ | 545 | */ |
540 | enum iwl_scan_offload_flags { | 546 | enum iwl_scan_offload_flags { |
541 | IWL_SCAN_OFFLOAD_FLAG_PASS_ALL = BIT(0), | 547 | IWL_SCAN_OFFLOAD_FLAG_PASS_ALL = BIT(0), |
542 | IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL = BIT(2), | 548 | IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL = BIT(2), |
543 | IWL_SCAN_OFFLOAD_FLAG_ENERGY_SCAN = BIT(3), | 549 | IWL_SCAN_OFFLOAD_FLAG_EBS_QUICK_MODE = BIT(5), |
550 | IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE = BIT(6), | ||
544 | }; | 551 | }; |
545 | 552 | ||
546 | /** | 553 | /** |
@@ -563,17 +570,24 @@ enum iwl_scan_offload_compleate_status { | |||
563 | IWL_SCAN_OFFLOAD_ABORTED = 2, | 570 | IWL_SCAN_OFFLOAD_ABORTED = 2, |
564 | }; | 571 | }; |
565 | 572 | ||
573 | enum iwl_scan_ebs_status { | ||
574 | IWL_SCAN_EBS_SUCCESS, | ||
575 | IWL_SCAN_EBS_FAILED, | ||
576 | IWL_SCAN_EBS_CHAN_NOT_FOUND, | ||
577 | }; | ||
578 | |||
566 | /** | 579 | /** |
567 | * iwl_scan_offload_complete - SCAN_OFFLOAD_COMPLETE_NTF_API_S_VER_1 | 580 | * iwl_scan_offload_complete - SCAN_OFFLOAD_COMPLETE_NTF_API_S_VER_1 |
568 | * @last_schedule_line: last schedule line executed (fast or regular) | 581 | * @last_schedule_line: last schedule line executed (fast or regular) |
569 | * @last_schedule_iteration: last scan iteration executed before scan abort | 582 | * @last_schedule_iteration: last scan iteration executed before scan abort |
570 | * @status: enum iwl_scan_offload_compleate_status | 583 | * @status: enum iwl_scan_offload_compleate_status |
584 | * @ebs_status: last EBS status, see IWL_SCAN_EBS_* | ||
571 | */ | 585 | */ |
572 | struct iwl_scan_offload_complete { | 586 | struct iwl_scan_offload_complete { |
573 | u8 last_schedule_line; | 587 | u8 last_schedule_line; |
574 | u8 last_schedule_iteration; | 588 | u8 last_schedule_iteration; |
575 | u8 status; | 589 | u8 status; |
576 | u8 reserved; | 590 | u8 ebs_status; |
577 | } __packed; | 591 | } __packed; |
578 | 592 | ||
579 | /** | 593 | /** |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h index d63647867262..39cebee8016f 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h | |||
@@ -255,22 +255,19 @@ struct iwl_mvm_keyinfo { | |||
255 | } __packed; | 255 | } __packed; |
256 | 256 | ||
257 | /** | 257 | /** |
258 | * struct iwl_mvm_add_sta_cmd_v5 - Add/modify a station in the fw's sta table. | 258 | * struct iwl_mvm_add_sta_cmd - Add/modify a station in the fw's sta table. |
259 | * ( REPLY_ADD_STA = 0x18 ) | 259 | * ( REPLY_ADD_STA = 0x18 ) |
260 | * @add_modify: 1: modify existing, 0: add new station | 260 | * @add_modify: 1: modify existing, 0: add new station |
261 | * @unicast_tx_key_id: unicast tx key id. Relevant only when unicast key sent | 261 | * @awake_acs: |
262 | * @multicast_tx_key_id: multicast tx key id. Relevant only when multicast key | 262 | * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable |
263 | * sent | 263 | * AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field. |
264 | * @mac_id_n_color: the Mac context this station belongs to | 264 | * @mac_id_n_color: the Mac context this station belongs to |
265 | * @addr[ETH_ALEN]: station's MAC address | 265 | * @addr[ETH_ALEN]: station's MAC address |
266 | * @sta_id: index of station in uCode's station table | 266 | * @sta_id: index of station in uCode's station table |
267 | * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave | 267 | * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave |
268 | * alone. 1 - modify, 0 - don't change. | 268 | * alone. 1 - modify, 0 - don't change. |
269 | * @key: look at %iwl_mvm_keyinfo | ||
270 | * @station_flags: look at %iwl_sta_flags | 269 | * @station_flags: look at %iwl_sta_flags |
271 | * @station_flags_msk: what of %station_flags have changed | 270 | * @station_flags_msk: what of %station_flags have changed |
272 | * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable | ||
273 | * AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field. | ||
274 | * @add_immediate_ba_tid: tid for which to add block-ack support (Rx) | 271 | * @add_immediate_ba_tid: tid for which to add block-ack support (Rx) |
275 | * Set %STA_MODIFY_ADD_BA_TID to use this field, and also set | 272 | * Set %STA_MODIFY_ADD_BA_TID to use this field, and also set |
276 | * add_immediate_ba_ssn. | 273 | * add_immediate_ba_ssn. |
@@ -294,40 +291,7 @@ struct iwl_mvm_keyinfo { | |||
294 | * ADD_STA sets up the table entry for one station, either creating a new | 291 | * ADD_STA sets up the table entry for one station, either creating a new |
295 | * entry, or modifying a pre-existing one. | 292 | * entry, or modifying a pre-existing one. |
296 | */ | 293 | */ |
297 | struct iwl_mvm_add_sta_cmd_v5 { | 294 | struct iwl_mvm_add_sta_cmd { |
298 | u8 add_modify; | ||
299 | u8 unicast_tx_key_id; | ||
300 | u8 multicast_tx_key_id; | ||
301 | u8 reserved1; | ||
302 | __le32 mac_id_n_color; | ||
303 | u8 addr[ETH_ALEN]; | ||
304 | __le16 reserved2; | ||
305 | u8 sta_id; | ||
306 | u8 modify_mask; | ||
307 | __le16 reserved3; | ||
308 | struct iwl_mvm_keyinfo key; | ||
309 | __le32 station_flags; | ||
310 | __le32 station_flags_msk; | ||
311 | __le16 tid_disable_tx; | ||
312 | __le16 reserved4; | ||
313 | u8 add_immediate_ba_tid; | ||
314 | u8 remove_immediate_ba_tid; | ||
315 | __le16 add_immediate_ba_ssn; | ||
316 | __le16 sleep_tx_count; | ||
317 | __le16 sleep_state_flags; | ||
318 | __le16 assoc_id; | ||
319 | __le16 beamform_flags; | ||
320 | __le32 tfd_queue_msk; | ||
321 | } __packed; /* ADD_STA_CMD_API_S_VER_5 */ | ||
322 | |||
323 | /** | ||
324 | * struct iwl_mvm_add_sta_cmd_v7 - Add / modify a station | ||
325 | * VER_7 of this command is quite similar to VER_5 except | ||
326 | * exclusion of all fields related to the security key installation. | ||
327 | * It only differs from VER_6 by the "awake_acs" field that is | ||
328 | * reserved and ignored in VER_6. | ||
329 | */ | ||
330 | struct iwl_mvm_add_sta_cmd_v7 { | ||
331 | u8 add_modify; | 295 | u8 add_modify; |
332 | u8 awake_acs; | 296 | u8 awake_acs; |
333 | __le16 tid_disable_tx; | 297 | __le16 tid_disable_tx; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h index 8e122f3a7a74..6cc5f52b807f 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h | |||
@@ -482,7 +482,8 @@ struct iwl_mvm_tx_resp { | |||
482 | u8 pa_integ_res_b[3]; | 482 | u8 pa_integ_res_b[3]; |
483 | u8 pa_integ_res_c[3]; | 483 | u8 pa_integ_res_c[3]; |
484 | __le16 measurement_req_id; | 484 | __le16 measurement_req_id; |
485 | __le16 reserved; | 485 | u8 reduced_tpc; |
486 | u8 reserved; | ||
486 | 487 | ||
487 | __le32 tfd_info; | 488 | __le32 tfd_info; |
488 | __le16 seq_ctl; | 489 | __le16 seq_ctl; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h index 6e75b52588de..309a9b9a94fe 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h | |||
@@ -71,6 +71,7 @@ | |||
71 | #include "fw-api-power.h" | 71 | #include "fw-api-power.h" |
72 | #include "fw-api-d3.h" | 72 | #include "fw-api-d3.h" |
73 | #include "fw-api-coex.h" | 73 | #include "fw-api-coex.h" |
74 | #include "fw-api-scan.h" | ||
74 | 75 | ||
75 | /* maximal number of Tx queues in any platform */ | 76 | /* maximal number of Tx queues in any platform */ |
76 | #define IWL_MVM_MAX_QUEUES 20 | 77 | #define IWL_MVM_MAX_QUEUES 20 |
@@ -604,52 +605,7 @@ enum { | |||
604 | TE_V1_NOTIF_INTERNAL_FRAG_END = BIT(7), | 605 | TE_V1_NOTIF_INTERNAL_FRAG_END = BIT(7), |
605 | }; /* MAC_EVENT_ACTION_API_E_VER_2 */ | 606 | }; /* MAC_EVENT_ACTION_API_E_VER_2 */ |
606 | 607 | ||
607 | 608 | /* Time event - defines for command API */ | |
608 | /** | ||
609 | * struct iwl_time_event_cmd_api_v1 - configuring Time Events | ||
610 | * with struct MAC_TIME_EVENT_DATA_API_S_VER_1 (see also | ||
611 | * with version 2. determined by IWL_UCODE_TLV_FLAGS) | ||
612 | * ( TIME_EVENT_CMD = 0x29 ) | ||
613 | * @id_and_color: ID and color of the relevant MAC | ||
614 | * @action: action to perform, one of FW_CTXT_ACTION_* | ||
615 | * @id: this field has two meanings, depending on the action: | ||
616 | * If the action is ADD, then it means the type of event to add. | ||
617 | * For all other actions it is the unique event ID assigned when the | ||
618 | * event was added by the FW. | ||
619 | * @apply_time: When to start the Time Event (in GP2) | ||
620 | * @max_delay: maximum delay to event's start (apply time), in TU | ||
621 | * @depends_on: the unique ID of the event we depend on (if any) | ||
622 | * @interval: interval between repetitions, in TU | ||
623 | * @interval_reciprocal: 2^32 / interval | ||
624 | * @duration: duration of event in TU | ||
625 | * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS | ||
626 | * @dep_policy: one of TE_V1_INDEPENDENT, TE_V1_DEP_OTHER, TE_V1_DEP_TSF | ||
627 | * and TE_V1_EVENT_SOCIOPATHIC | ||
628 | * @is_present: 0 or 1, are we present or absent during the Time Event | ||
629 | * @max_frags: maximal number of fragments the Time Event can be divided to | ||
630 | * @notify: notifications using TE_V1_NOTIF_* (whom to notify when) | ||
631 | */ | ||
632 | struct iwl_time_event_cmd_v1 { | ||
633 | /* COMMON_INDEX_HDR_API_S_VER_1 */ | ||
634 | __le32 id_and_color; | ||
635 | __le32 action; | ||
636 | __le32 id; | ||
637 | /* MAC_TIME_EVENT_DATA_API_S_VER_1 */ | ||
638 | __le32 apply_time; | ||
639 | __le32 max_delay; | ||
640 | __le32 dep_policy; | ||
641 | __le32 depends_on; | ||
642 | __le32 is_present; | ||
643 | __le32 max_frags; | ||
644 | __le32 interval; | ||
645 | __le32 interval_reciprocal; | ||
646 | __le32 duration; | ||
647 | __le32 repeat; | ||
648 | __le32 notify; | ||
649 | } __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_1 */ | ||
650 | |||
651 | |||
652 | /* Time event - defines for command API v2 */ | ||
653 | 609 | ||
654 | /* | 610 | /* |
655 | * @TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed. | 611 | * @TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed. |
@@ -680,7 +636,7 @@ enum { | |||
680 | #define TE_V2_PLACEMENT_POS 12 | 636 | #define TE_V2_PLACEMENT_POS 12 |
681 | #define TE_V2_ABSENCE_POS 15 | 637 | #define TE_V2_ABSENCE_POS 15 |
682 | 638 | ||
683 | /* Time event policy values (for time event cmd api v2) | 639 | /* Time event policy values |
684 | * A notification (both event and fragment) includes a status indicating weather | 640 | * A notification (both event and fragment) includes a status indicating weather |
685 | * the FW was able to schedule the event or not. For fragment start/end | 641 | * the FW was able to schedule the event or not. For fragment start/end |
686 | * notification the status is always success. There is no start/end fragment | 642 | * notification the status is always success. There is no start/end fragment |
@@ -727,7 +683,7 @@ enum { | |||
727 | }; | 683 | }; |
728 | 684 | ||
729 | /** | 685 | /** |
730 | * struct iwl_time_event_cmd_api_v2 - configuring Time Events | 686 | * struct iwl_time_event_cmd_api - configuring Time Events |
731 | * with struct MAC_TIME_EVENT_DATA_API_S_VER_2 (see also | 687 | * with struct MAC_TIME_EVENT_DATA_API_S_VER_2 (see also |
732 | * with version 1. determined by IWL_UCODE_TLV_FLAGS) | 688 | * with version 1. determined by IWL_UCODE_TLV_FLAGS) |
733 | * ( TIME_EVENT_CMD = 0x29 ) | 689 | * ( TIME_EVENT_CMD = 0x29 ) |
@@ -750,7 +706,7 @@ enum { | |||
750 | * TE_EVENT_SOCIOPATHIC | 706 | * TE_EVENT_SOCIOPATHIC |
751 | * using TE_ABSENCE and using TE_NOTIF_* | 707 | * using TE_ABSENCE and using TE_NOTIF_* |
752 | */ | 708 | */ |
753 | struct iwl_time_event_cmd_v2 { | 709 | struct iwl_time_event_cmd { |
754 | /* COMMON_INDEX_HDR_API_S_VER_1 */ | 710 | /* COMMON_INDEX_HDR_API_S_VER_1 */ |
755 | __le32 id_and_color; | 711 | __le32 id_and_color; |
756 | __le32 action; | 712 | __le32 action; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c index 7ce20062f32d..883e702152d5 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/iwlwifi/mvm/fw.c | |||
@@ -99,7 +99,7 @@ static int iwl_send_tx_ant_cfg(struct iwl_mvm *mvm, u8 valid_tx_ant) | |||
99 | }; | 99 | }; |
100 | 100 | ||
101 | IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant); | 101 | IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant); |
102 | return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, CMD_SYNC, | 102 | return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, 0, |
103 | sizeof(tx_ant_cmd), &tx_ant_cmd); | 103 | sizeof(tx_ant_cmd), &tx_ant_cmd); |
104 | } | 104 | } |
105 | 105 | ||
@@ -137,6 +137,8 @@ static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait, | |||
137 | alive_data->scd_base_addr = le32_to_cpu(palive2->scd_base_ptr); | 137 | alive_data->scd_base_addr = le32_to_cpu(palive2->scd_base_ptr); |
138 | mvm->umac_error_event_table = | 138 | mvm->umac_error_event_table = |
139 | le32_to_cpu(palive2->error_info_addr); | 139 | le32_to_cpu(palive2->error_info_addr); |
140 | mvm->sf_space.addr = le32_to_cpu(palive2->st_fwrd_addr); | ||
141 | mvm->sf_space.size = le32_to_cpu(palive2->st_fwrd_size); | ||
140 | 142 | ||
141 | alive_data->valid = le16_to_cpu(palive2->status) == | 143 | alive_data->valid = le16_to_cpu(palive2->status) == |
142 | IWL_ALIVE_STATUS_OK; | 144 | IWL_ALIVE_STATUS_OK; |
@@ -180,6 +182,7 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm, | |||
180 | int ret, i; | 182 | int ret, i; |
181 | enum iwl_ucode_type old_type = mvm->cur_ucode; | 183 | enum iwl_ucode_type old_type = mvm->cur_ucode; |
182 | static const u8 alive_cmd[] = { MVM_ALIVE }; | 184 | static const u8 alive_cmd[] = { MVM_ALIVE }; |
185 | struct iwl_sf_region st_fwrd_space; | ||
183 | 186 | ||
184 | fw = iwl_get_ucode_image(mvm, ucode_type); | 187 | fw = iwl_get_ucode_image(mvm, ucode_type); |
185 | if (WARN_ON(!fw)) | 188 | if (WARN_ON(!fw)) |
@@ -215,6 +218,14 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm, | |||
215 | return -EIO; | 218 | return -EIO; |
216 | } | 219 | } |
217 | 220 | ||
221 | /* | ||
222 | * update the sdio allocation according to the pointer we get in the | ||
223 | * alive notification. | ||
224 | */ | ||
225 | st_fwrd_space.addr = mvm->sf_space.addr; | ||
226 | st_fwrd_space.size = mvm->sf_space.size; | ||
227 | ret = iwl_trans_update_sf(mvm->trans, &st_fwrd_space); | ||
228 | |||
218 | iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr); | 229 | iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr); |
219 | 230 | ||
220 | /* | 231 | /* |
@@ -256,7 +267,7 @@ static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm) | |||
256 | IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n", | 267 | IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n", |
257 | phy_cfg_cmd.phy_cfg); | 268 | phy_cfg_cmd.phy_cfg); |
258 | 269 | ||
259 | return iwl_mvm_send_cmd_pdu(mvm, PHY_CONFIGURATION_CMD, CMD_SYNC, | 270 | return iwl_mvm_send_cmd_pdu(mvm, PHY_CONFIGURATION_CMD, 0, |
260 | sizeof(phy_cfg_cmd), &phy_cfg_cmd); | 271 | sizeof(phy_cfg_cmd), &phy_cfg_cmd); |
261 | } | 272 | } |
262 | 273 | ||
@@ -288,14 +299,14 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) | |||
288 | goto error; | 299 | goto error; |
289 | } | 300 | } |
290 | 301 | ||
291 | ret = iwl_send_bt_prio_tbl(mvm); | 302 | ret = iwl_send_bt_init_conf(mvm); |
292 | if (ret) | 303 | if (ret) |
293 | goto error; | 304 | goto error; |
294 | 305 | ||
295 | /* Read the NVM only at driver load time, no need to do this twice */ | 306 | /* Read the NVM only at driver load time, no need to do this twice */ |
296 | if (read_nvm) { | 307 | if (read_nvm) { |
297 | /* Read nvm */ | 308 | /* Read nvm */ |
298 | ret = iwl_nvm_init(mvm); | 309 | ret = iwl_nvm_init(mvm, true); |
299 | if (ret) { | 310 | if (ret) { |
300 | IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); | 311 | IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); |
301 | goto error; | 312 | goto error; |
@@ -303,7 +314,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) | |||
303 | } | 314 | } |
304 | 315 | ||
305 | /* In case we read the NVM from external file, load it to the NIC */ | 316 | /* In case we read the NVM from external file, load it to the NIC */ |
306 | if (iwlwifi_mod_params.nvm_file) | 317 | if (mvm->nvm_file_name) |
307 | iwl_mvm_load_nvm_to_nic(mvm); | 318 | iwl_mvm_load_nvm_to_nic(mvm); |
308 | 319 | ||
309 | ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans); | 320 | ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans); |
@@ -424,10 +435,6 @@ int iwl_mvm_up(struct iwl_mvm *mvm) | |||
424 | if (ret) | 435 | if (ret) |
425 | goto error; | 436 | goto error; |
426 | 437 | ||
427 | ret = iwl_send_bt_prio_tbl(mvm); | ||
428 | if (ret) | ||
429 | goto error; | ||
430 | |||
431 | ret = iwl_send_bt_init_conf(mvm); | 438 | ret = iwl_send_bt_init_conf(mvm); |
432 | if (ret) | 439 | if (ret) |
433 | goto error; | 440 | goto error; |
@@ -468,12 +475,6 @@ int iwl_mvm_up(struct iwl_mvm *mvm) | |||
468 | /* Initialize tx backoffs to the minimal possible */ | 475 | /* Initialize tx backoffs to the minimal possible */ |
469 | iwl_mvm_tt_tx_backoff(mvm, 0); | 476 | iwl_mvm_tt_tx_backoff(mvm, 0); |
470 | 477 | ||
471 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PM_CMD_SUPPORT)) { | ||
472 | ret = iwl_power_legacy_set_cam_mode(mvm); | ||
473 | if (ret) | ||
474 | goto error; | ||
475 | } | ||
476 | |||
477 | ret = iwl_mvm_power_update_device(mvm); | 478 | ret = iwl_mvm_power_update_device(mvm); |
478 | if (ret) | 479 | if (ret) |
479 | goto error; | 480 | goto error; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c index 9ccec10bba16..8b5302777632 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | |||
@@ -667,12 +667,9 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm, | |||
667 | if (vif->bss_conf.qos) | 667 | if (vif->bss_conf.qos) |
668 | cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA); | 668 | cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA); |
669 | 669 | ||
670 | /* Don't use cts to self as the fw doesn't support it currently. */ | ||
671 | if (vif->bss_conf.use_cts_prot) { | 670 | if (vif->bss_conf.use_cts_prot) { |
672 | cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_TGG_PROTECT); | 671 | cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_TGG_PROTECT); |
673 | if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 8) | 672 | cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_SELF_CTS_EN); |
674 | cmd->protection_flags |= | ||
675 | cpu_to_le32(MAC_PROT_FLG_SELF_CTS_EN); | ||
676 | } | 673 | } |
677 | IWL_DEBUG_RATE(mvm, "use_cts_prot %d, ht_operation_mode %d\n", | 674 | IWL_DEBUG_RATE(mvm, "use_cts_prot %d, ht_operation_mode %d\n", |
678 | vif->bss_conf.use_cts_prot, | 675 | vif->bss_conf.use_cts_prot, |
@@ -688,7 +685,7 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm, | |||
688 | static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm, | 685 | static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm, |
689 | struct iwl_mac_ctx_cmd *cmd) | 686 | struct iwl_mac_ctx_cmd *cmd) |
690 | { | 687 | { |
691 | int ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, CMD_SYNC, | 688 | int ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, 0, |
692 | sizeof(*cmd), cmd); | 689 | sizeof(*cmd), cmd); |
693 | if (ret) | 690 | if (ret) |
694 | IWL_ERR(mvm, "Failed to send MAC context (action:%d): %d\n", | 691 | IWL_ERR(mvm, "Failed to send MAC context (action:%d): %d\n", |
@@ -696,19 +693,39 @@ static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm, | |||
696 | return ret; | 693 | return ret; |
697 | } | 694 | } |
698 | 695 | ||
699 | /* | 696 | static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm, |
700 | * Fill the specific data for mac context of type station or p2p client | 697 | struct ieee80211_vif *vif, |
701 | */ | 698 | u32 action, bool force_assoc_off) |
702 | static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm, | ||
703 | struct ieee80211_vif *vif, | ||
704 | struct iwl_mac_data_sta *ctxt_sta, | ||
705 | bool force_assoc_off) | ||
706 | { | 699 | { |
700 | struct iwl_mac_ctx_cmd cmd = {}; | ||
701 | struct iwl_mac_data_sta *ctxt_sta; | ||
702 | |||
703 | WARN_ON(vif->type != NL80211_IFTYPE_STATION); | ||
704 | |||
705 | /* Fill the common data for all mac context types */ | ||
706 | iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); | ||
707 | |||
708 | if (vif->p2p) { | ||
709 | struct ieee80211_p2p_noa_attr *noa = | ||
710 | &vif->bss_conf.p2p_noa_attr; | ||
711 | |||
712 | cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow & | ||
713 | IEEE80211_P2P_OPPPS_CTWINDOW_MASK); | ||
714 | ctxt_sta = &cmd.p2p_sta.sta; | ||
715 | } else { | ||
716 | ctxt_sta = &cmd.sta; | ||
717 | } | ||
718 | |||
707 | /* We need the dtim_period to set the MAC as associated */ | 719 | /* We need the dtim_period to set the MAC as associated */ |
708 | if (vif->bss_conf.assoc && vif->bss_conf.dtim_period && | 720 | if (vif->bss_conf.assoc && vif->bss_conf.dtim_period && |
709 | !force_assoc_off) { | 721 | !force_assoc_off) { |
710 | u32 dtim_offs; | 722 | u32 dtim_offs; |
711 | 723 | ||
724 | /* Allow beacons to pass through as long as we are not | ||
725 | * associated, or we do not have dtim period information. | ||
726 | */ | ||
727 | cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON); | ||
728 | |||
712 | /* | 729 | /* |
713 | * The DTIM count counts down, so when it is N that means N | 730 | * The DTIM count counts down, so when it is N that means N |
714 | * more beacon intervals happen until the DTIM TBTT. Therefore | 731 | * more beacon intervals happen until the DTIM TBTT. Therefore |
@@ -755,51 +772,6 @@ static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm, | |||
755 | 772 | ||
756 | ctxt_sta->listen_interval = cpu_to_le32(mvm->hw->conf.listen_interval); | 773 | ctxt_sta->listen_interval = cpu_to_le32(mvm->hw->conf.listen_interval); |
757 | ctxt_sta->assoc_id = cpu_to_le32(vif->bss_conf.aid); | 774 | ctxt_sta->assoc_id = cpu_to_le32(vif->bss_conf.aid); |
758 | } | ||
759 | |||
760 | static int iwl_mvm_mac_ctxt_cmd_station(struct iwl_mvm *mvm, | ||
761 | struct ieee80211_vif *vif, | ||
762 | u32 action) | ||
763 | { | ||
764 | struct iwl_mac_ctx_cmd cmd = {}; | ||
765 | |||
766 | WARN_ON(vif->type != NL80211_IFTYPE_STATION || vif->p2p); | ||
767 | |||
768 | /* Fill the common data for all mac context types */ | ||
769 | iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); | ||
770 | |||
771 | /* Allow beacons to pass through as long as we are not associated,or we | ||
772 | * do not have dtim period information */ | ||
773 | if (!vif->bss_conf.assoc || !vif->bss_conf.dtim_period) | ||
774 | cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON); | ||
775 | else | ||
776 | cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON); | ||
777 | |||
778 | /* Fill the data specific for station mode */ | ||
779 | iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta, | ||
780 | action == FW_CTXT_ACTION_ADD); | ||
781 | |||
782 | return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); | ||
783 | } | ||
784 | |||
785 | static int iwl_mvm_mac_ctxt_cmd_p2p_client(struct iwl_mvm *mvm, | ||
786 | struct ieee80211_vif *vif, | ||
787 | u32 action) | ||
788 | { | ||
789 | struct iwl_mac_ctx_cmd cmd = {}; | ||
790 | struct ieee80211_p2p_noa_attr *noa = &vif->bss_conf.p2p_noa_attr; | ||
791 | |||
792 | WARN_ON(vif->type != NL80211_IFTYPE_STATION || !vif->p2p); | ||
793 | |||
794 | /* Fill the common data for all mac context types */ | ||
795 | iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); | ||
796 | |||
797 | /* Fill the data specific for station mode */ | ||
798 | iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta, | ||
799 | action == FW_CTXT_ACTION_ADD); | ||
800 | |||
801 | cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow & | ||
802 | IEEE80211_P2P_OPPPS_CTWINDOW_MASK); | ||
803 | 775 | ||
804 | return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); | 776 | return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); |
805 | } | 777 | } |
@@ -1137,16 +1109,12 @@ static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm, | |||
1137 | } | 1109 | } |
1138 | 1110 | ||
1139 | static int iwl_mvm_mac_ctx_send(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 1111 | static int iwl_mvm_mac_ctx_send(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1140 | u32 action) | 1112 | u32 action, bool force_assoc_off) |
1141 | { | 1113 | { |
1142 | switch (vif->type) { | 1114 | switch (vif->type) { |
1143 | case NL80211_IFTYPE_STATION: | 1115 | case NL80211_IFTYPE_STATION: |
1144 | if (!vif->p2p) | 1116 | return iwl_mvm_mac_ctxt_cmd_sta(mvm, vif, action, |
1145 | return iwl_mvm_mac_ctxt_cmd_station(mvm, vif, | 1117 | force_assoc_off); |
1146 | action); | ||
1147 | else | ||
1148 | return iwl_mvm_mac_ctxt_cmd_p2p_client(mvm, vif, | ||
1149 | action); | ||
1150 | break; | 1118 | break; |
1151 | case NL80211_IFTYPE_AP: | 1119 | case NL80211_IFTYPE_AP: |
1152 | if (!vif->p2p) | 1120 | if (!vif->p2p) |
@@ -1176,7 +1144,8 @@ int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
1176 | vif->addr, ieee80211_vif_type_p2p(vif))) | 1144 | vif->addr, ieee80211_vif_type_p2p(vif))) |
1177 | return -EIO; | 1145 | return -EIO; |
1178 | 1146 | ||
1179 | ret = iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_ADD); | 1147 | ret = iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_ADD, |
1148 | true); | ||
1180 | if (ret) | 1149 | if (ret) |
1181 | return ret; | 1150 | return ret; |
1182 | 1151 | ||
@@ -1187,7 +1156,8 @@ int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
1187 | return 0; | 1156 | return 0; |
1188 | } | 1157 | } |
1189 | 1158 | ||
1190 | int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | 1159 | int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1160 | bool force_assoc_off) | ||
1191 | { | 1161 | { |
1192 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 1162 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
1193 | 1163 | ||
@@ -1195,7 +1165,8 @@ int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
1195 | vif->addr, ieee80211_vif_type_p2p(vif))) | 1165 | vif->addr, ieee80211_vif_type_p2p(vif))) |
1196 | return -EIO; | 1166 | return -EIO; |
1197 | 1167 | ||
1198 | return iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_MODIFY); | 1168 | return iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_MODIFY, |
1169 | force_assoc_off); | ||
1199 | } | 1170 | } |
1200 | 1171 | ||
1201 | int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | 1172 | int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
@@ -1214,7 +1185,7 @@ int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
1214 | mvmvif->color)); | 1185 | mvmvif->color)); |
1215 | cmd.action = cpu_to_le32(FW_CTXT_ACTION_REMOVE); | 1186 | cmd.action = cpu_to_le32(FW_CTXT_ACTION_REMOVE); |
1216 | 1187 | ||
1217 | ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, CMD_SYNC, | 1188 | ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, 0, |
1218 | sizeof(cmd), &cmd); | 1189 | sizeof(cmd), &cmd); |
1219 | if (ret) { | 1190 | if (ret) { |
1220 | IWL_ERR(mvm, "Failed to remove MAC context: %d\n", ret); | 1191 | IWL_ERR(mvm, "Failed to remove MAC context: %d\n", ret); |
@@ -1240,11 +1211,23 @@ int iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm, | |||
1240 | u32 rate __maybe_unused = | 1211 | u32 rate __maybe_unused = |
1241 | le32_to_cpu(beacon->beacon_notify_hdr.initial_rate); | 1212 | le32_to_cpu(beacon->beacon_notify_hdr.initial_rate); |
1242 | 1213 | ||
1214 | lockdep_assert_held(&mvm->mutex); | ||
1215 | |||
1243 | IWL_DEBUG_RX(mvm, "beacon status %#x retries:%d tsf:0x%16llX rate:%d\n", | 1216 | IWL_DEBUG_RX(mvm, "beacon status %#x retries:%d tsf:0x%16llX rate:%d\n", |
1244 | status & TX_STATUS_MSK, | 1217 | status & TX_STATUS_MSK, |
1245 | beacon->beacon_notify_hdr.failure_frame, | 1218 | beacon->beacon_notify_hdr.failure_frame, |
1246 | le64_to_cpu(beacon->tsf), | 1219 | le64_to_cpu(beacon->tsf), |
1247 | rate); | 1220 | rate); |
1221 | |||
1222 | if (unlikely(mvm->csa_vif && mvm->csa_vif->csa_active)) { | ||
1223 | if (!ieee80211_csa_is_complete(mvm->csa_vif)) { | ||
1224 | iwl_mvm_mac_ctxt_beacon_changed(mvm, mvm->csa_vif); | ||
1225 | } else { | ||
1226 | ieee80211_csa_finish(mvm->csa_vif); | ||
1227 | mvm->csa_vif = NULL; | ||
1228 | } | ||
1229 | } | ||
1230 | |||
1248 | return 0; | 1231 | return 0; |
1249 | } | 1232 | } |
1250 | 1233 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 8735ef1f44ae..7215f5980186 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -295,7 +295,9 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
295 | !iwlwifi_mod_params.sw_crypto) | 295 | !iwlwifi_mod_params.sw_crypto) |
296 | hw->flags |= IEEE80211_HW_MFP_CAPABLE; | 296 | hw->flags |= IEEE80211_HW_MFP_CAPABLE; |
297 | 297 | ||
298 | if (0 && mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT) { | 298 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT && |
299 | IWL_UCODE_API(mvm->fw->ucode_ver) >= 9 && | ||
300 | !iwlwifi_mod_params.uapsd_disable) { | ||
299 | hw->flags |= IEEE80211_HW_SUPPORTS_UAPSD; | 301 | hw->flags |= IEEE80211_HW_SUPPORTS_UAPSD; |
300 | hw->uapsd_queues = IWL_UAPSD_AC_INFO; | 302 | hw->uapsd_queues = IWL_UAPSD_AC_INFO; |
301 | hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; | 303 | hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; |
@@ -309,11 +311,8 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
309 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | 311 | BIT(NL80211_IFTYPE_P2P_CLIENT) | |
310 | BIT(NL80211_IFTYPE_AP) | | 312 | BIT(NL80211_IFTYPE_AP) | |
311 | BIT(NL80211_IFTYPE_P2P_GO) | | 313 | BIT(NL80211_IFTYPE_P2P_GO) | |
312 | BIT(NL80211_IFTYPE_P2P_DEVICE); | 314 | BIT(NL80211_IFTYPE_P2P_DEVICE) | |
313 | 315 | BIT(NL80211_IFTYPE_ADHOC); | |
314 | /* IBSS has bugs in older versions */ | ||
315 | if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 8) | ||
316 | hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); | ||
317 | 316 | ||
318 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; | 317 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
319 | hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | | 318 | hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | |
@@ -322,6 +321,9 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
322 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_GO_UAPSD) | 321 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_GO_UAPSD) |
323 | hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; | 322 | hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; |
324 | 323 | ||
324 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_CSA_FLOW) | ||
325 | hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; | ||
326 | |||
325 | hw->wiphy->iface_combinations = iwl_mvm_iface_combinations; | 327 | hw->wiphy->iface_combinations = iwl_mvm_iface_combinations; |
326 | hw->wiphy->n_iface_combinations = | 328 | hw->wiphy->n_iface_combinations = |
327 | ARRAY_SIZE(iwl_mvm_iface_combinations); | 329 | ARRAY_SIZE(iwl_mvm_iface_combinations); |
@@ -365,14 +367,11 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
365 | else | 367 | else |
366 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 368 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
367 | 369 | ||
368 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_SCHED_SCAN) { | 370 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
369 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; | 371 | hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX; |
370 | hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX; | 372 | hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES; |
371 | hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES; | 373 | /* we create the 802.11 header and zero length SSID IE. */ |
372 | /* we create the 802.11 header and zero length SSID IE. */ | 374 | hw->wiphy->max_sched_scan_ie_len = SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2; |
373 | hw->wiphy->max_sched_scan_ie_len = | ||
374 | SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2; | ||
375 | } | ||
376 | 375 | ||
377 | hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | | 376 | hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | |
378 | NL80211_FEATURE_P2P_GO_OPPPS; | 377 | NL80211_FEATURE_P2P_GO_OPPPS; |
@@ -386,7 +385,11 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
386 | } | 385 | } |
387 | 386 | ||
388 | #ifdef CONFIG_PM_SLEEP | 387 | #ifdef CONFIG_PM_SLEEP |
389 | if (mvm->fw->img[IWL_UCODE_WOWLAN].sec[0].len && | 388 | if (iwl_mvm_is_d0i3_supported(mvm) && |
389 | device_can_wakeup(mvm->trans->dev)) { | ||
390 | mvm->wowlan.flags = WIPHY_WOWLAN_ANY; | ||
391 | hw->wiphy->wowlan = &mvm->wowlan; | ||
392 | } else if (mvm->fw->img[IWL_UCODE_WOWLAN].sec[0].len && | ||
390 | mvm->trans->ops->d3_suspend && | 393 | mvm->trans->ops->d3_suspend && |
391 | mvm->trans->ops->d3_resume && | 394 | mvm->trans->ops->d3_resume && |
392 | device_can_wakeup(mvm->trans->dev)) { | 395 | device_can_wakeup(mvm->trans->dev)) { |
@@ -540,13 +543,22 @@ static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw, | |||
540 | return -EACCES; | 543 | return -EACCES; |
541 | 544 | ||
542 | /* return from D0i3 before starting a new Tx aggregation */ | 545 | /* return from D0i3 before starting a new Tx aggregation */ |
543 | if (action == IEEE80211_AMPDU_TX_START) { | 546 | switch (action) { |
547 | case IEEE80211_AMPDU_TX_START: | ||
548 | case IEEE80211_AMPDU_TX_STOP_CONT: | ||
549 | case IEEE80211_AMPDU_TX_STOP_FLUSH: | ||
550 | case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: | ||
551 | case IEEE80211_AMPDU_TX_OPERATIONAL: | ||
544 | iwl_mvm_ref(mvm, IWL_MVM_REF_TX_AGG); | 552 | iwl_mvm_ref(mvm, IWL_MVM_REF_TX_AGG); |
545 | tx_agg_ref = true; | 553 | tx_agg_ref = true; |
546 | 554 | ||
547 | /* | 555 | /* |
548 | * wait synchronously until D0i3 exit to get the correct | 556 | * for tx start, wait synchronously until D0i3 exit to |
549 | * sequence number for the tid | 557 | * get the correct sequence number for the tid. |
558 | * additionally, some other ampdu actions use direct | ||
559 | * target access, which is not handled automatically | ||
560 | * by the trans layer (unlike commands), so wait for | ||
561 | * d0i3 exit in these cases as well. | ||
550 | */ | 562 | */ |
551 | if (!wait_event_timeout(mvm->d0i3_exit_waitq, | 563 | if (!wait_event_timeout(mvm->d0i3_exit_waitq, |
552 | !test_bit(IWL_MVM_STATUS_IN_D0I3, &mvm->status), HZ)) { | 564 | !test_bit(IWL_MVM_STATUS_IN_D0I3, &mvm->status), HZ)) { |
@@ -554,6 +566,9 @@ static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw, | |||
554 | iwl_mvm_unref(mvm, IWL_MVM_REF_TX_AGG); | 566 | iwl_mvm_unref(mvm, IWL_MVM_REF_TX_AGG); |
555 | return -EIO; | 567 | return -EIO; |
556 | } | 568 | } |
569 | break; | ||
570 | default: | ||
571 | break; | ||
557 | } | 572 | } |
558 | 573 | ||
559 | mutex_lock(&mvm->mutex); | 574 | mutex_lock(&mvm->mutex); |
@@ -758,7 +773,7 @@ static int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
758 | .pwr_restriction = cpu_to_le16(tx_power), | 773 | .pwr_restriction = cpu_to_le16(tx_power), |
759 | }; | 774 | }; |
760 | 775 | ||
761 | return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, CMD_SYNC, | 776 | return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, |
762 | sizeof(reduce_txpwr_cmd), | 777 | sizeof(reduce_txpwr_cmd), |
763 | &reduce_txpwr_cmd); | 778 | &reduce_txpwr_cmd); |
764 | } | 779 | } |
@@ -817,18 +832,17 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, | |||
817 | if (ret) | 832 | if (ret) |
818 | goto out_release; | 833 | goto out_release; |
819 | 834 | ||
820 | ret = iwl_mvm_power_update_mac(mvm, vif); | 835 | ret = iwl_mvm_power_update_mac(mvm); |
821 | if (ret) | 836 | if (ret) |
822 | goto out_release; | 837 | goto out_release; |
823 | 838 | ||
824 | /* beacon filtering */ | 839 | /* beacon filtering */ |
825 | ret = iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC); | 840 | ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0); |
826 | if (ret) | 841 | if (ret) |
827 | goto out_remove_mac; | 842 | goto out_remove_mac; |
828 | 843 | ||
829 | if (!mvm->bf_allowed_vif && false && | 844 | if (!mvm->bf_allowed_vif && |
830 | vif->type == NL80211_IFTYPE_STATION && !vif->p2p && | 845 | vif->type == NL80211_IFTYPE_STATION && !vif->p2p) { |
831 | mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BF_UPDATED){ | ||
832 | mvm->bf_allowed_vif = mvmvif; | 846 | mvm->bf_allowed_vif = mvmvif; |
833 | vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | | 847 | vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | |
834 | IEEE80211_VIF_SUPPORTS_CQM_RSSI; | 848 | IEEE80211_VIF_SUPPORTS_CQM_RSSI; |
@@ -969,7 +983,7 @@ static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw, | |||
969 | if (mvm->vif_count && vif->type != NL80211_IFTYPE_P2P_DEVICE) | 983 | if (mvm->vif_count && vif->type != NL80211_IFTYPE_P2P_DEVICE) |
970 | mvm->vif_count--; | 984 | mvm->vif_count--; |
971 | 985 | ||
972 | iwl_mvm_power_update_mac(mvm, vif); | 986 | iwl_mvm_power_update_mac(mvm); |
973 | iwl_mvm_mac_ctxt_remove(mvm, vif); | 987 | iwl_mvm_mac_ctxt_remove(mvm, vif); |
974 | 988 | ||
975 | out_release: | 989 | out_release: |
@@ -1223,10 +1237,14 @@ static int iwl_mvm_configure_bcast_filter(struct iwl_mvm *mvm, | |||
1223 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING)) | 1237 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING)) |
1224 | return 0; | 1238 | return 0; |
1225 | 1239 | ||
1240 | /* bcast filtering isn't supported for P2P client */ | ||
1241 | if (vif->p2p) | ||
1242 | return 0; | ||
1243 | |||
1226 | if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) | 1244 | if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) |
1227 | return 0; | 1245 | return 0; |
1228 | 1246 | ||
1229 | return iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, CMD_SYNC, | 1247 | return iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0, |
1230 | sizeof(cmd), &cmd); | 1248 | sizeof(cmd), &cmd); |
1231 | } | 1249 | } |
1232 | #else | 1250 | #else |
@@ -1253,7 +1271,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
1253 | if (changes & BSS_CHANGED_ASSOC && bss_conf->assoc) | 1271 | if (changes & BSS_CHANGED_ASSOC && bss_conf->assoc) |
1254 | iwl_mvm_mac_ctxt_recalc_tsf_id(mvm, vif); | 1272 | iwl_mvm_mac_ctxt_recalc_tsf_id(mvm, vif); |
1255 | 1273 | ||
1256 | ret = iwl_mvm_mac_ctxt_changed(mvm, vif); | 1274 | ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false); |
1257 | if (ret) | 1275 | if (ret) |
1258 | IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); | 1276 | IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); |
1259 | 1277 | ||
@@ -1333,10 +1351,10 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
1333 | iwl_mvm_remove_time_event(mvm, mvmvif, | 1351 | iwl_mvm_remove_time_event(mvm, mvmvif, |
1334 | &mvmvif->time_event_data); | 1352 | &mvmvif->time_event_data); |
1335 | iwl_mvm_sf_update(mvm, vif, false); | 1353 | iwl_mvm_sf_update(mvm, vif, false); |
1336 | WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, CMD_SYNC)); | 1354 | WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); |
1337 | } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | | 1355 | } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | |
1338 | BSS_CHANGED_QOS)) { | 1356 | BSS_CHANGED_QOS)) { |
1339 | ret = iwl_mvm_power_update_mac(mvm, vif); | 1357 | ret = iwl_mvm_power_update_mac(mvm); |
1340 | if (ret) | 1358 | if (ret) |
1341 | IWL_ERR(mvm, "failed to update power mode\n"); | 1359 | IWL_ERR(mvm, "failed to update power mode\n"); |
1342 | } | 1360 | } |
@@ -1347,16 +1365,19 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
1347 | } | 1365 | } |
1348 | 1366 | ||
1349 | if (changes & BSS_CHANGED_CQM) { | 1367 | if (changes & BSS_CHANGED_CQM) { |
1350 | IWL_DEBUG_MAC80211(mvm, "cqm info_changed"); | 1368 | IWL_DEBUG_MAC80211(mvm, "cqm info_changed\n"); |
1351 | /* reset cqm events tracking */ | 1369 | /* reset cqm events tracking */ |
1352 | mvmvif->bf_data.last_cqm_event = 0; | 1370 | mvmvif->bf_data.last_cqm_event = 0; |
1353 | ret = iwl_mvm_update_beacon_filter(mvm, vif, false, CMD_SYNC); | 1371 | if (mvmvif->bf_data.bf_enabled) { |
1354 | if (ret) | 1372 | ret = iwl_mvm_enable_beacon_filter(mvm, vif, 0); |
1355 | IWL_ERR(mvm, "failed to update CQM thresholds\n"); | 1373 | if (ret) |
1374 | IWL_ERR(mvm, | ||
1375 | "failed to update CQM thresholds\n"); | ||
1376 | } | ||
1356 | } | 1377 | } |
1357 | 1378 | ||
1358 | if (changes & BSS_CHANGED_ARP_FILTER) { | 1379 | if (changes & BSS_CHANGED_ARP_FILTER) { |
1359 | IWL_DEBUG_MAC80211(mvm, "arp filter changed"); | 1380 | IWL_DEBUG_MAC80211(mvm, "arp filter changed\n"); |
1360 | iwl_mvm_configure_bcast_filter(mvm, vif); | 1381 | iwl_mvm_configure_bcast_filter(mvm, vif); |
1361 | } | 1382 | } |
1362 | } | 1383 | } |
@@ -1402,7 +1423,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw, | |||
1402 | mvmvif->ap_ibss_active = true; | 1423 | mvmvif->ap_ibss_active = true; |
1403 | 1424 | ||
1404 | /* power updated needs to be done before quotas */ | 1425 | /* power updated needs to be done before quotas */ |
1405 | iwl_mvm_power_update_mac(mvm, vif); | 1426 | iwl_mvm_power_update_mac(mvm); |
1406 | 1427 | ||
1407 | ret = iwl_mvm_update_quotas(mvm, vif); | 1428 | ret = iwl_mvm_update_quotas(mvm, vif); |
1408 | if (ret) | 1429 | if (ret) |
@@ -1410,7 +1431,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw, | |||
1410 | 1431 | ||
1411 | /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */ | 1432 | /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */ |
1412 | if (vif->p2p && mvm->p2p_device_vif) | 1433 | if (vif->p2p && mvm->p2p_device_vif) |
1413 | iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif); | 1434 | iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false); |
1414 | 1435 | ||
1415 | iwl_mvm_ref(mvm, IWL_MVM_REF_AP_IBSS); | 1436 | iwl_mvm_ref(mvm, IWL_MVM_REF_AP_IBSS); |
1416 | 1437 | ||
@@ -1420,7 +1441,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw, | |||
1420 | return 0; | 1441 | return 0; |
1421 | 1442 | ||
1422 | out_quota_failed: | 1443 | out_quota_failed: |
1423 | iwl_mvm_power_update_mac(mvm, vif); | 1444 | iwl_mvm_power_update_mac(mvm); |
1424 | mvmvif->ap_ibss_active = false; | 1445 | mvmvif->ap_ibss_active = false; |
1425 | iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta); | 1446 | iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta); |
1426 | out_unbind: | 1447 | out_unbind: |
@@ -1450,13 +1471,13 @@ static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw, | |||
1450 | 1471 | ||
1451 | /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */ | 1472 | /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */ |
1452 | if (vif->p2p && mvm->p2p_device_vif) | 1473 | if (vif->p2p && mvm->p2p_device_vif) |
1453 | iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif); | 1474 | iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false); |
1454 | 1475 | ||
1455 | iwl_mvm_update_quotas(mvm, NULL); | 1476 | iwl_mvm_update_quotas(mvm, NULL); |
1456 | iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta); | 1477 | iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta); |
1457 | iwl_mvm_binding_remove_vif(mvm, vif); | 1478 | iwl_mvm_binding_remove_vif(mvm, vif); |
1458 | 1479 | ||
1459 | iwl_mvm_power_update_mac(mvm, vif); | 1480 | iwl_mvm_power_update_mac(mvm); |
1460 | 1481 | ||
1461 | iwl_mvm_mac_ctxt_remove(mvm, vif); | 1482 | iwl_mvm_mac_ctxt_remove(mvm, vif); |
1462 | 1483 | ||
@@ -1477,7 +1498,7 @@ iwl_mvm_bss_info_changed_ap_ibss(struct iwl_mvm *mvm, | |||
1477 | 1498 | ||
1478 | if (changes & (BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_HT | | 1499 | if (changes & (BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_HT | |
1479 | BSS_CHANGED_BANDWIDTH) && | 1500 | BSS_CHANGED_BANDWIDTH) && |
1480 | iwl_mvm_mac_ctxt_changed(mvm, vif)) | 1501 | iwl_mvm_mac_ctxt_changed(mvm, vif, false)) |
1481 | IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); | 1502 | IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); |
1482 | 1503 | ||
1483 | /* Need to send a new beacon template to the FW */ | 1504 | /* Need to send a new beacon template to the FW */ |
@@ -1495,6 +1516,9 @@ static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw, | |||
1495 | 1516 | ||
1496 | mutex_lock(&mvm->mutex); | 1517 | mutex_lock(&mvm->mutex); |
1497 | 1518 | ||
1519 | if (changes & BSS_CHANGED_IDLE && !bss_conf->idle) | ||
1520 | iwl_mvm_sched_scan_stop(mvm, true); | ||
1521 | |||
1498 | switch (vif->type) { | 1522 | switch (vif->type) { |
1499 | case NL80211_IFTYPE_STATION: | 1523 | case NL80211_IFTYPE_STATION: |
1500 | iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes); | 1524 | iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes); |
@@ -1525,7 +1549,7 @@ static int iwl_mvm_mac_hw_scan(struct ieee80211_hw *hw, | |||
1525 | 1549 | ||
1526 | switch (mvm->scan_status) { | 1550 | switch (mvm->scan_status) { |
1527 | case IWL_MVM_SCAN_SCHED: | 1551 | case IWL_MVM_SCAN_SCHED: |
1528 | ret = iwl_mvm_sched_scan_stop(mvm); | 1552 | ret = iwl_mvm_sched_scan_stop(mvm, true); |
1529 | if (ret) { | 1553 | if (ret) { |
1530 | ret = -EBUSY; | 1554 | ret = -EBUSY; |
1531 | goto out; | 1555 | goto out; |
@@ -1697,6 +1721,11 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, | |||
1697 | ret = iwl_mvm_add_sta(mvm, vif, sta); | 1721 | ret = iwl_mvm_add_sta(mvm, vif, sta); |
1698 | } else if (old_state == IEEE80211_STA_NONE && | 1722 | } else if (old_state == IEEE80211_STA_NONE && |
1699 | new_state == IEEE80211_STA_AUTH) { | 1723 | new_state == IEEE80211_STA_AUTH) { |
1724 | /* | ||
1725 | * EBS may be disabled due to previous failures reported by FW. | ||
1726 | * Reset EBS status here assuming environment has been changed. | ||
1727 | */ | ||
1728 | mvm->last_ebs_successful = true; | ||
1700 | ret = 0; | 1729 | ret = 0; |
1701 | } else if (old_state == IEEE80211_STA_AUTH && | 1730 | } else if (old_state == IEEE80211_STA_AUTH && |
1702 | new_state == IEEE80211_STA_ASSOC) { | 1731 | new_state == IEEE80211_STA_ASSOC) { |
@@ -1708,14 +1737,12 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, | |||
1708 | } else if (old_state == IEEE80211_STA_ASSOC && | 1737 | } else if (old_state == IEEE80211_STA_ASSOC && |
1709 | new_state == IEEE80211_STA_AUTHORIZED) { | 1738 | new_state == IEEE80211_STA_AUTHORIZED) { |
1710 | /* enable beacon filtering */ | 1739 | /* enable beacon filtering */ |
1711 | if (vif->bss_conf.dtim_period) | 1740 | WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); |
1712 | WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, | ||
1713 | CMD_SYNC)); | ||
1714 | ret = 0; | 1741 | ret = 0; |
1715 | } else if (old_state == IEEE80211_STA_AUTHORIZED && | 1742 | } else if (old_state == IEEE80211_STA_AUTHORIZED && |
1716 | new_state == IEEE80211_STA_ASSOC) { | 1743 | new_state == IEEE80211_STA_ASSOC) { |
1717 | /* disable beacon filtering */ | 1744 | /* disable beacon filtering */ |
1718 | WARN_ON(iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC)); | 1745 | WARN_ON(iwl_mvm_disable_beacon_filter(mvm, vif, 0)); |
1719 | ret = 0; | 1746 | ret = 0; |
1720 | } else if (old_state == IEEE80211_STA_ASSOC && | 1747 | } else if (old_state == IEEE80211_STA_ASSOC && |
1721 | new_state == IEEE80211_STA_AUTH) { | 1748 | new_state == IEEE80211_STA_AUTH) { |
@@ -1772,7 +1799,7 @@ static int iwl_mvm_mac_conf_tx(struct ieee80211_hw *hw, | |||
1772 | int ret; | 1799 | int ret; |
1773 | 1800 | ||
1774 | mutex_lock(&mvm->mutex); | 1801 | mutex_lock(&mvm->mutex); |
1775 | ret = iwl_mvm_mac_ctxt_changed(mvm, vif); | 1802 | ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false); |
1776 | mutex_unlock(&mvm->mutex); | 1803 | mutex_unlock(&mvm->mutex); |
1777 | return ret; | 1804 | return ret; |
1778 | } | 1805 | } |
@@ -1865,7 +1892,7 @@ static int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw, | |||
1865 | int ret; | 1892 | int ret; |
1866 | 1893 | ||
1867 | mutex_lock(&mvm->mutex); | 1894 | mutex_lock(&mvm->mutex); |
1868 | ret = iwl_mvm_sched_scan_stop(mvm); | 1895 | ret = iwl_mvm_sched_scan_stop(mvm, false); |
1869 | mutex_unlock(&mvm->mutex); | 1896 | mutex_unlock(&mvm->mutex); |
1870 | iwl_mvm_wait_for_async_handlers(mvm); | 1897 | iwl_mvm_wait_for_async_handlers(mvm); |
1871 | 1898 | ||
@@ -2161,10 +2188,10 @@ static void iwl_mvm_change_chanctx(struct ieee80211_hw *hw, | |||
2161 | return; | 2188 | return; |
2162 | 2189 | ||
2163 | mutex_lock(&mvm->mutex); | 2190 | mutex_lock(&mvm->mutex); |
2191 | iwl_mvm_bt_coex_vif_change(mvm); | ||
2164 | iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->min_def, | 2192 | iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->min_def, |
2165 | ctx->rx_chains_static, | 2193 | ctx->rx_chains_static, |
2166 | ctx->rx_chains_dynamic); | 2194 | ctx->rx_chains_dynamic); |
2167 | iwl_mvm_bt_coex_vif_change(mvm); | ||
2168 | mutex_unlock(&mvm->mutex); | 2195 | mutex_unlock(&mvm->mutex); |
2169 | } | 2196 | } |
2170 | 2197 | ||
@@ -2184,6 +2211,11 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw, | |||
2184 | 2211 | ||
2185 | switch (vif->type) { | 2212 | switch (vif->type) { |
2186 | case NL80211_IFTYPE_AP: | 2213 | case NL80211_IFTYPE_AP: |
2214 | /* Unless it's a CSA flow we have nothing to do here */ | ||
2215 | if (vif->csa_active) { | ||
2216 | mvmvif->ap_ibss_active = true; | ||
2217 | break; | ||
2218 | } | ||
2187 | case NL80211_IFTYPE_ADHOC: | 2219 | case NL80211_IFTYPE_ADHOC: |
2188 | /* | 2220 | /* |
2189 | * The AP binding flow is handled as part of the start_ap flow | 2221 | * The AP binding flow is handled as part of the start_ap flow |
@@ -2207,7 +2239,7 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw, | |||
2207 | * Power state must be updated before quotas, | 2239 | * Power state must be updated before quotas, |
2208 | * otherwise fw will complain. | 2240 | * otherwise fw will complain. |
2209 | */ | 2241 | */ |
2210 | iwl_mvm_power_update_mac(mvm, vif); | 2242 | iwl_mvm_power_update_mac(mvm); |
2211 | 2243 | ||
2212 | /* Setting the quota at this stage is only required for monitor | 2244 | /* Setting the quota at this stage is only required for monitor |
2213 | * interfaces. For the other types, the bss_info changed flow | 2245 | * interfaces. For the other types, the bss_info changed flow |
@@ -2220,11 +2252,17 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw, | |||
2220 | goto out_remove_binding; | 2252 | goto out_remove_binding; |
2221 | } | 2253 | } |
2222 | 2254 | ||
2255 | /* Handle binding during CSA */ | ||
2256 | if (vif->type == NL80211_IFTYPE_AP) { | ||
2257 | iwl_mvm_update_quotas(mvm, vif); | ||
2258 | iwl_mvm_mac_ctxt_changed(mvm, vif, false); | ||
2259 | } | ||
2260 | |||
2223 | goto out_unlock; | 2261 | goto out_unlock; |
2224 | 2262 | ||
2225 | out_remove_binding: | 2263 | out_remove_binding: |
2226 | iwl_mvm_binding_remove_vif(mvm, vif); | 2264 | iwl_mvm_binding_remove_vif(mvm, vif); |
2227 | iwl_mvm_power_update_mac(mvm, vif); | 2265 | iwl_mvm_power_update_mac(mvm); |
2228 | out_unlock: | 2266 | out_unlock: |
2229 | mutex_unlock(&mvm->mutex); | 2267 | mutex_unlock(&mvm->mutex); |
2230 | if (ret) | 2268 | if (ret) |
@@ -2244,22 +2282,29 @@ static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw, | |||
2244 | iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data); | 2282 | iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data); |
2245 | 2283 | ||
2246 | switch (vif->type) { | 2284 | switch (vif->type) { |
2247 | case NL80211_IFTYPE_AP: | ||
2248 | case NL80211_IFTYPE_ADHOC: | 2285 | case NL80211_IFTYPE_ADHOC: |
2249 | goto out_unlock; | 2286 | goto out_unlock; |
2250 | case NL80211_IFTYPE_MONITOR: | 2287 | case NL80211_IFTYPE_MONITOR: |
2251 | mvmvif->monitor_active = false; | 2288 | mvmvif->monitor_active = false; |
2252 | iwl_mvm_update_quotas(mvm, NULL); | 2289 | iwl_mvm_update_quotas(mvm, NULL); |
2253 | break; | 2290 | break; |
2291 | case NL80211_IFTYPE_AP: | ||
2292 | /* This part is triggered only during CSA */ | ||
2293 | if (!vif->csa_active || !mvmvif->ap_ibss_active) | ||
2294 | goto out_unlock; | ||
2295 | |||
2296 | mvmvif->ap_ibss_active = false; | ||
2297 | iwl_mvm_update_quotas(mvm, NULL); | ||
2298 | /*TODO: bt_coex notification here? */ | ||
2254 | default: | 2299 | default: |
2255 | break; | 2300 | break; |
2256 | } | 2301 | } |
2257 | 2302 | ||
2258 | iwl_mvm_binding_remove_vif(mvm, vif); | 2303 | iwl_mvm_binding_remove_vif(mvm, vif); |
2259 | iwl_mvm_power_update_mac(mvm, vif); | ||
2260 | 2304 | ||
2261 | out_unlock: | 2305 | out_unlock: |
2262 | mvmvif->phy_ctxt = NULL; | 2306 | mvmvif->phy_ctxt = NULL; |
2307 | iwl_mvm_power_update_mac(mvm); | ||
2263 | mutex_unlock(&mvm->mutex); | 2308 | mutex_unlock(&mvm->mutex); |
2264 | } | 2309 | } |
2265 | 2310 | ||
@@ -2323,9 +2368,8 @@ static int __iwl_mvm_mac_testmode_cmd(struct iwl_mvm *mvm, | |||
2323 | return -EINVAL; | 2368 | return -EINVAL; |
2324 | 2369 | ||
2325 | if (nla_get_u32(tb[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE])) | 2370 | if (nla_get_u32(tb[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE])) |
2326 | return iwl_mvm_enable_beacon_filter(mvm, vif, | 2371 | return iwl_mvm_enable_beacon_filter(mvm, vif, 0); |
2327 | CMD_SYNC); | 2372 | return iwl_mvm_disable_beacon_filter(mvm, vif, 0); |
2328 | return iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC); | ||
2329 | } | 2373 | } |
2330 | 2374 | ||
2331 | return -EOPNOTSUPP; | 2375 | return -EOPNOTSUPP; |
@@ -2346,6 +2390,53 @@ static int iwl_mvm_mac_testmode_cmd(struct ieee80211_hw *hw, | |||
2346 | } | 2390 | } |
2347 | #endif | 2391 | #endif |
2348 | 2392 | ||
2393 | static void iwl_mvm_channel_switch_beacon(struct ieee80211_hw *hw, | ||
2394 | struct ieee80211_vif *vif, | ||
2395 | struct cfg80211_chan_def *chandef) | ||
2396 | { | ||
2397 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | ||
2398 | |||
2399 | mutex_lock(&mvm->mutex); | ||
2400 | if (WARN(mvm->csa_vif && mvm->csa_vif->csa_active, | ||
2401 | "Another CSA is already in progress")) | ||
2402 | goto out_unlock; | ||
2403 | |||
2404 | IWL_DEBUG_MAC80211(mvm, "CSA started to freq %d\n", | ||
2405 | chandef->center_freq1); | ||
2406 | mvm->csa_vif = vif; | ||
2407 | |||
2408 | out_unlock: | ||
2409 | mutex_unlock(&mvm->mutex); | ||
2410 | } | ||
2411 | |||
2412 | static void iwl_mvm_mac_flush(struct ieee80211_hw *hw, | ||
2413 | struct ieee80211_vif *vif, u32 queues, bool drop) | ||
2414 | { | ||
2415 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | ||
2416 | struct iwl_mvm_vif *mvmvif; | ||
2417 | struct iwl_mvm_sta *mvmsta; | ||
2418 | |||
2419 | if (!vif || vif->type != NL80211_IFTYPE_STATION) | ||
2420 | return; | ||
2421 | |||
2422 | mutex_lock(&mvm->mutex); | ||
2423 | mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
2424 | mvmsta = iwl_mvm_sta_from_staid_protected(mvm, mvmvif->ap_sta_id); | ||
2425 | |||
2426 | if (WARN_ON_ONCE(!mvmsta)) | ||
2427 | goto done; | ||
2428 | |||
2429 | if (drop) { | ||
2430 | if (iwl_mvm_flush_tx_path(mvm, mvmsta->tfd_queue_msk, true)) | ||
2431 | IWL_ERR(mvm, "flush request fail\n"); | ||
2432 | } else { | ||
2433 | iwl_trans_wait_tx_queue_empty(mvm->trans, | ||
2434 | mvmsta->tfd_queue_msk); | ||
2435 | } | ||
2436 | done: | ||
2437 | mutex_unlock(&mvm->mutex); | ||
2438 | } | ||
2439 | |||
2349 | const struct ieee80211_ops iwl_mvm_hw_ops = { | 2440 | const struct ieee80211_ops iwl_mvm_hw_ops = { |
2350 | .tx = iwl_mvm_mac_tx, | 2441 | .tx = iwl_mvm_mac_tx, |
2351 | .ampdu_action = iwl_mvm_mac_ampdu_action, | 2442 | .ampdu_action = iwl_mvm_mac_ampdu_action, |
@@ -2369,6 +2460,7 @@ const struct ieee80211_ops iwl_mvm_hw_ops = { | |||
2369 | .sta_rc_update = iwl_mvm_sta_rc_update, | 2460 | .sta_rc_update = iwl_mvm_sta_rc_update, |
2370 | .conf_tx = iwl_mvm_mac_conf_tx, | 2461 | .conf_tx = iwl_mvm_mac_conf_tx, |
2371 | .mgd_prepare_tx = iwl_mvm_mac_mgd_prepare_tx, | 2462 | .mgd_prepare_tx = iwl_mvm_mac_mgd_prepare_tx, |
2463 | .flush = iwl_mvm_mac_flush, | ||
2372 | .sched_scan_start = iwl_mvm_mac_sched_scan_start, | 2464 | .sched_scan_start = iwl_mvm_mac_sched_scan_start, |
2373 | .sched_scan_stop = iwl_mvm_mac_sched_scan_stop, | 2465 | .sched_scan_stop = iwl_mvm_mac_sched_scan_stop, |
2374 | .set_key = iwl_mvm_mac_set_key, | 2466 | .set_key = iwl_mvm_mac_set_key, |
@@ -2388,6 +2480,8 @@ const struct ieee80211_ops iwl_mvm_hw_ops = { | |||
2388 | 2480 | ||
2389 | .set_tim = iwl_mvm_set_tim, | 2481 | .set_tim = iwl_mvm_set_tim, |
2390 | 2482 | ||
2483 | .channel_switch_beacon = iwl_mvm_channel_switch_beacon, | ||
2484 | |||
2391 | CFG80211_TESTMODE_CMD(iwl_mvm_mac_testmode_cmd) | 2485 | CFG80211_TESTMODE_CMD(iwl_mvm_mac_testmode_cmd) |
2392 | 2486 | ||
2393 | #ifdef CONFIG_PM_SLEEP | 2487 | #ifdef CONFIG_PM_SLEEP |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index f1ec0986c3c9..fcc6c29482d0 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -164,7 +164,6 @@ enum iwl_dbgfs_pm_mask { | |||
164 | MVM_DEBUGFS_PM_SKIP_DTIM_PERIODS = BIT(2), | 164 | MVM_DEBUGFS_PM_SKIP_DTIM_PERIODS = BIT(2), |
165 | MVM_DEBUGFS_PM_RX_DATA_TIMEOUT = BIT(3), | 165 | MVM_DEBUGFS_PM_RX_DATA_TIMEOUT = BIT(3), |
166 | MVM_DEBUGFS_PM_TX_DATA_TIMEOUT = BIT(4), | 166 | MVM_DEBUGFS_PM_TX_DATA_TIMEOUT = BIT(4), |
167 | MVM_DEBUGFS_PM_DISABLE_POWER_OFF = BIT(5), | ||
168 | MVM_DEBUGFS_PM_LPRX_ENA = BIT(6), | 167 | MVM_DEBUGFS_PM_LPRX_ENA = BIT(6), |
169 | MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD = BIT(7), | 168 | MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD = BIT(7), |
170 | MVM_DEBUGFS_PM_SNOOZE_ENABLE = BIT(8), | 169 | MVM_DEBUGFS_PM_SNOOZE_ENABLE = BIT(8), |
@@ -177,7 +176,6 @@ struct iwl_dbgfs_pm { | |||
177 | u32 tx_data_timeout; | 176 | u32 tx_data_timeout; |
178 | bool skip_over_dtim; | 177 | bool skip_over_dtim; |
179 | u8 skip_dtim_periods; | 178 | u8 skip_dtim_periods; |
180 | bool disable_power_off; | ||
181 | bool lprx_ena; | 179 | bool lprx_ena; |
182 | u32 lprx_rssi_threshold; | 180 | u32 lprx_rssi_threshold; |
183 | bool snooze_ena; | 181 | bool snooze_ena; |
@@ -232,6 +230,7 @@ enum iwl_mvm_ref_type { | |||
232 | IWL_MVM_REF_USER, | 230 | IWL_MVM_REF_USER, |
233 | IWL_MVM_REF_TX, | 231 | IWL_MVM_REF_TX, |
234 | IWL_MVM_REF_TX_AGG, | 232 | IWL_MVM_REF_TX_AGG, |
233 | IWL_MVM_REF_EXIT_WORK, | ||
235 | 234 | ||
236 | IWL_MVM_REF_COUNT, | 235 | IWL_MVM_REF_COUNT, |
237 | }; | 236 | }; |
@@ -265,6 +264,7 @@ struct iwl_mvm_vif_bf_data { | |||
265 | * @uploaded: indicates the MAC context has been added to the device | 264 | * @uploaded: indicates the MAC context has been added to the device |
266 | * @ap_ibss_active: indicates that AP/IBSS is configured and that the interface | 265 | * @ap_ibss_active: indicates that AP/IBSS is configured and that the interface |
267 | * should get quota etc. | 266 | * should get quota etc. |
267 | * @pm_enabled - Indicate if MAC power management is allowed | ||
268 | * @monitor_active: indicates that monitor context is configured, and that the | 268 | * @monitor_active: indicates that monitor context is configured, and that the |
269 | * interface should get quota etc. | 269 | * interface should get quota etc. |
270 | * @low_latency: indicates that this interface is in low-latency mode | 270 | * @low_latency: indicates that this interface is in low-latency mode |
@@ -283,6 +283,7 @@ struct iwl_mvm_vif { | |||
283 | 283 | ||
284 | bool uploaded; | 284 | bool uploaded; |
285 | bool ap_ibss_active; | 285 | bool ap_ibss_active; |
286 | bool pm_enabled; | ||
286 | bool monitor_active; | 287 | bool monitor_active; |
287 | bool low_latency; | 288 | bool low_latency; |
288 | struct iwl_mvm_vif_bf_data bf_data; | 289 | struct iwl_mvm_vif_bf_data bf_data; |
@@ -451,6 +452,11 @@ struct iwl_mvm_frame_stats { | |||
451 | int last_frame_idx; | 452 | int last_frame_idx; |
452 | }; | 453 | }; |
453 | 454 | ||
455 | enum { | ||
456 | D0I3_DEFER_WAKEUP, | ||
457 | D0I3_PENDING_WAKEUP, | ||
458 | }; | ||
459 | |||
454 | struct iwl_mvm { | 460 | struct iwl_mvm { |
455 | /* for logger access */ | 461 | /* for logger access */ |
456 | struct device *dev; | 462 | struct device *dev; |
@@ -484,6 +490,7 @@ struct iwl_mvm { | |||
484 | u32 log_event_table; | 490 | u32 log_event_table; |
485 | u32 umac_error_event_table; | 491 | u32 umac_error_event_table; |
486 | bool support_umac_log; | 492 | bool support_umac_log; |
493 | struct iwl_sf_region sf_space; | ||
487 | 494 | ||
488 | u32 ampdu_ref; | 495 | u32 ampdu_ref; |
489 | 496 | ||
@@ -495,6 +502,7 @@ struct iwl_mvm { | |||
495 | u8 queue_to_mac80211[IWL_MAX_HW_QUEUES]; | 502 | u8 queue_to_mac80211[IWL_MAX_HW_QUEUES]; |
496 | atomic_t queue_stop_count[IWL_MAX_HW_QUEUES]; | 503 | atomic_t queue_stop_count[IWL_MAX_HW_QUEUES]; |
497 | 504 | ||
505 | const char *nvm_file_name; | ||
498 | struct iwl_nvm_data *nvm_data; | 506 | struct iwl_nvm_data *nvm_data; |
499 | /* NVM sections */ | 507 | /* NVM sections */ |
500 | struct iwl_nvm_section nvm_sections[NVM_MAX_NUM_SECTIONS]; | 508 | struct iwl_nvm_section nvm_sections[NVM_MAX_NUM_SECTIONS]; |
@@ -535,6 +543,8 @@ struct iwl_mvm { | |||
535 | /* Internal station */ | 543 | /* Internal station */ |
536 | struct iwl_mvm_int_sta aux_sta; | 544 | struct iwl_mvm_int_sta aux_sta; |
537 | 545 | ||
546 | bool last_ebs_successful; | ||
547 | |||
538 | u8 scan_last_antenna_idx; /* to toggle TX between antennas */ | 548 | u8 scan_last_antenna_idx; /* to toggle TX between antennas */ |
539 | u8 mgmt_last_antenna_idx; | 549 | u8 mgmt_last_antenna_idx; |
540 | 550 | ||
@@ -578,8 +588,12 @@ struct iwl_mvm { | |||
578 | void *fw_error_dump; | 588 | void *fw_error_dump; |
579 | void *fw_error_sram; | 589 | void *fw_error_sram; |
580 | u32 fw_error_sram_len; | 590 | u32 fw_error_sram_len; |
591 | u32 *fw_error_rxf; | ||
592 | u32 fw_error_rxf_len; | ||
581 | 593 | ||
594 | #ifdef CONFIG_IWLWIFI_LEDS | ||
582 | struct led_classdev led; | 595 | struct led_classdev led; |
596 | #endif | ||
583 | 597 | ||
584 | struct ieee80211_vif *p2p_device_vif; | 598 | struct ieee80211_vif *p2p_device_vif; |
585 | 599 | ||
@@ -601,6 +615,9 @@ struct iwl_mvm { | |||
601 | bool d0i3_offloading; | 615 | bool d0i3_offloading; |
602 | struct work_struct d0i3_exit_work; | 616 | struct work_struct d0i3_exit_work; |
603 | struct sk_buff_head d0i3_tx; | 617 | struct sk_buff_head d0i3_tx; |
618 | /* protect d0i3_suspend_flags */ | ||
619 | struct mutex d0i3_suspend_mutex; | ||
620 | unsigned long d0i3_suspend_flags; | ||
604 | /* sync d0i3_tx queue and IWL_MVM_STATUS_IN_D0I3 status flag */ | 621 | /* sync d0i3_tx queue and IWL_MVM_STATUS_IN_D0I3 status flag */ |
605 | spinlock_t d0i3_tx_lock; | 622 | spinlock_t d0i3_tx_lock; |
606 | wait_queue_head_t d0i3_exit_waitq; | 623 | wait_queue_head_t d0i3_exit_waitq; |
@@ -629,8 +646,8 @@ struct iwl_mvm { | |||
629 | 646 | ||
630 | /* Indicate if device power save is allowed */ | 647 | /* Indicate if device power save is allowed */ |
631 | bool ps_disabled; | 648 | bool ps_disabled; |
632 | /* Indicate if device power management is allowed */ | 649 | |
633 | bool pm_disabled; | 650 | struct ieee80211_vif *csa_vif; |
634 | }; | 651 | }; |
635 | 652 | ||
636 | /* Extract MVM priv from op_mode and _hw */ | 653 | /* Extract MVM priv from op_mode and _hw */ |
@@ -705,6 +722,7 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm); | |||
705 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 722 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
706 | void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm); | 723 | void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm); |
707 | void iwl_mvm_fw_error_sram_dump(struct iwl_mvm *mvm); | 724 | void iwl_mvm_fw_error_sram_dump(struct iwl_mvm *mvm); |
725 | void iwl_mvm_fw_error_rxf_dump(struct iwl_mvm *mvm); | ||
708 | #endif | 726 | #endif |
709 | u8 first_antenna(u8 mask); | 727 | u8 first_antenna(u8 mask); |
710 | u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx); | 728 | u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx); |
@@ -745,7 +763,7 @@ int iwl_mvm_rx_statistics(struct iwl_mvm *mvm, | |||
745 | struct iwl_device_cmd *cmd); | 763 | struct iwl_device_cmd *cmd); |
746 | 764 | ||
747 | /* NVM */ | 765 | /* NVM */ |
748 | int iwl_nvm_init(struct iwl_mvm *mvm); | 766 | int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic); |
749 | int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm); | 767 | int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm); |
750 | 768 | ||
751 | int iwl_mvm_up(struct iwl_mvm *mvm); | 769 | int iwl_mvm_up(struct iwl_mvm *mvm); |
@@ -796,7 +814,8 @@ void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm, | |||
796 | int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif); | 814 | int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
797 | void iwl_mvm_mac_ctxt_release(struct iwl_mvm *mvm, struct ieee80211_vif *vif); | 815 | void iwl_mvm_mac_ctxt_release(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
798 | int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif); | 816 | int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
799 | int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif); | 817 | int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
818 | bool force_assoc_off); | ||
800 | int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif); | 819 | int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
801 | u32 iwl_mvm_mac_get_queues_mask(struct iwl_mvm *mvm, | 820 | u32 iwl_mvm_mac_get_queues_mask(struct iwl_mvm *mvm, |
802 | struct ieee80211_vif *vif); | 821 | struct ieee80211_vif *vif); |
@@ -840,7 +859,7 @@ int iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm, | |||
840 | struct cfg80211_sched_scan_request *req); | 859 | struct cfg80211_sched_scan_request *req); |
841 | int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, | 860 | int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, |
842 | struct cfg80211_sched_scan_request *req); | 861 | struct cfg80211_sched_scan_request *req); |
843 | int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm); | 862 | int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm, bool notify); |
844 | int iwl_mvm_rx_sched_scan_results(struct iwl_mvm *mvm, | 863 | int iwl_mvm_rx_sched_scan_results(struct iwl_mvm *mvm, |
845 | struct iwl_rx_cmd_buffer *rxb, | 864 | struct iwl_rx_cmd_buffer *rxb, |
846 | struct iwl_device_cmd *cmd); | 865 | struct iwl_device_cmd *cmd); |
@@ -874,10 +893,8 @@ void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, | |||
874 | int rs_pretty_print_rate(char *buf, const u32 rate); | 893 | int rs_pretty_print_rate(char *buf, const u32 rate); |
875 | 894 | ||
876 | /* power management */ | 895 | /* power management */ |
877 | int iwl_power_legacy_set_cam_mode(struct iwl_mvm *mvm); | ||
878 | |||
879 | int iwl_mvm_power_update_device(struct iwl_mvm *mvm); | 896 | int iwl_mvm_power_update_device(struct iwl_mvm *mvm); |
880 | int iwl_mvm_power_update_mac(struct iwl_mvm *mvm, struct ieee80211_vif *vif); | 897 | int iwl_mvm_power_update_mac(struct iwl_mvm *mvm); |
881 | int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 898 | int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
882 | char *buf, int bufsz); | 899 | char *buf, int bufsz); |
883 | 900 | ||
@@ -886,8 +903,18 @@ int iwl_mvm_power_uapsd_misbehaving_ap_notif(struct iwl_mvm *mvm, | |||
886 | struct iwl_rx_cmd_buffer *rxb, | 903 | struct iwl_rx_cmd_buffer *rxb, |
887 | struct iwl_device_cmd *cmd); | 904 | struct iwl_device_cmd *cmd); |
888 | 905 | ||
906 | #ifdef CONFIG_IWLWIFI_LEDS | ||
889 | int iwl_mvm_leds_init(struct iwl_mvm *mvm); | 907 | int iwl_mvm_leds_init(struct iwl_mvm *mvm); |
890 | void iwl_mvm_leds_exit(struct iwl_mvm *mvm); | 908 | void iwl_mvm_leds_exit(struct iwl_mvm *mvm); |
909 | #else | ||
910 | static inline int iwl_mvm_leds_init(struct iwl_mvm *mvm) | ||
911 | { | ||
912 | return 0; | ||
913 | } | ||
914 | static inline void iwl_mvm_leds_exit(struct iwl_mvm *mvm) | ||
915 | { | ||
916 | } | ||
917 | #endif | ||
891 | 918 | ||
892 | /* D3 (WoWLAN, NetDetect) */ | 919 | /* D3 (WoWLAN, NetDetect) */ |
893 | int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); | 920 | int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); |
@@ -922,9 +949,9 @@ int iwl_mvm_send_proto_offload(struct iwl_mvm *mvm, | |||
922 | void iwl_mvm_ref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type); | 949 | void iwl_mvm_ref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type); |
923 | void iwl_mvm_unref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type); | 950 | void iwl_mvm_unref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type); |
924 | void iwl_mvm_d0i3_enable_tx(struct iwl_mvm *mvm, __le16 *qos_seq); | 951 | void iwl_mvm_d0i3_enable_tx(struct iwl_mvm *mvm, __le16 *qos_seq); |
952 | int _iwl_mvm_exit_d0i3(struct iwl_mvm *mvm); | ||
925 | 953 | ||
926 | /* BT Coex */ | 954 | /* BT Coex */ |
927 | int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm); | ||
928 | int iwl_send_bt_init_conf(struct iwl_mvm *mvm); | 955 | int iwl_send_bt_init_conf(struct iwl_mvm *mvm); |
929 | int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, | 956 | int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, |
930 | struct iwl_rx_cmd_buffer *rxb, | 957 | struct iwl_rx_cmd_buffer *rxb, |
@@ -936,9 +963,10 @@ u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm, | |||
936 | struct ieee80211_sta *sta); | 963 | struct ieee80211_sta *sta); |
937 | bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm, | 964 | bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm, |
938 | struct ieee80211_sta *sta); | 965 | struct ieee80211_sta *sta); |
966 | bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm, | ||
967 | enum ieee80211_band band); | ||
939 | u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, | 968 | u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, |
940 | struct ieee80211_tx_info *info, u8 ac); | 969 | struct ieee80211_tx_info *info, u8 ac); |
941 | int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, bool enable); | ||
942 | 970 | ||
943 | enum iwl_bt_kill_msk { | 971 | enum iwl_bt_kill_msk { |
944 | BT_KILL_MSK_DEFAULT, | 972 | BT_KILL_MSK_DEFAULT, |
@@ -969,17 +997,11 @@ int iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm, | |||
969 | int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm, | 997 | int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm, |
970 | struct ieee80211_vif *vif, | 998 | struct ieee80211_vif *vif, |
971 | u32 flags); | 999 | u32 flags); |
972 | int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm, | ||
973 | struct ieee80211_vif *vif, bool enable); | ||
974 | int iwl_mvm_update_beacon_filter(struct iwl_mvm *mvm, | ||
975 | struct ieee80211_vif *vif, | ||
976 | bool force, | ||
977 | u32 flags); | ||
978 | |||
979 | /* SMPS */ | 1000 | /* SMPS */ |
980 | void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 1001 | void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
981 | enum iwl_mvm_smps_type_request req_type, | 1002 | enum iwl_mvm_smps_type_request req_type, |
982 | enum ieee80211_smps_mode smps_request); | 1003 | enum ieee80211_smps_mode smps_request); |
1004 | bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm); | ||
983 | 1005 | ||
984 | /* Low latency */ | 1006 | /* Low latency */ |
985 | int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 1007 | int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/nvm.c b/drivers/net/wireless/iwlwifi/mvm/nvm.c index cf2d09f53782..808f78f6fbf9 100644 --- a/drivers/net/wireless/iwlwifi/mvm/nvm.c +++ b/drivers/net/wireless/iwlwifi/mvm/nvm.c | |||
@@ -74,6 +74,12 @@ | |||
74 | #define NVM_WRITE_OPCODE 1 | 74 | #define NVM_WRITE_OPCODE 1 |
75 | #define NVM_READ_OPCODE 0 | 75 | #define NVM_READ_OPCODE 0 |
76 | 76 | ||
77 | /* load nvm chunk response */ | ||
78 | enum { | ||
79 | READ_NVM_CHUNK_SUCCEED = 0, | ||
80 | READ_NVM_CHUNK_NOT_VALID_ADDRESS = 1 | ||
81 | }; | ||
82 | |||
77 | /* | 83 | /* |
78 | * prepare the NVM host command w/ the pointers to the nvm buffer | 84 | * prepare the NVM host command w/ the pointers to the nvm buffer |
79 | * and send it to fw | 85 | * and send it to fw |
@@ -90,7 +96,7 @@ static int iwl_nvm_write_chunk(struct iwl_mvm *mvm, u16 section, | |||
90 | struct iwl_host_cmd cmd = { | 96 | struct iwl_host_cmd cmd = { |
91 | .id = NVM_ACCESS_CMD, | 97 | .id = NVM_ACCESS_CMD, |
92 | .len = { sizeof(struct iwl_nvm_access_cmd), length }, | 98 | .len = { sizeof(struct iwl_nvm_access_cmd), length }, |
93 | .flags = CMD_SYNC | CMD_SEND_IN_RFKILL, | 99 | .flags = CMD_SEND_IN_RFKILL, |
94 | .data = { &nvm_access_cmd, data }, | 100 | .data = { &nvm_access_cmd, data }, |
95 | /* data may come from vmalloc, so use _DUP */ | 101 | /* data may come from vmalloc, so use _DUP */ |
96 | .dataflags = { 0, IWL_HCMD_DFL_DUP }, | 102 | .dataflags = { 0, IWL_HCMD_DFL_DUP }, |
@@ -112,7 +118,7 @@ static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section, | |||
112 | struct iwl_rx_packet *pkt; | 118 | struct iwl_rx_packet *pkt; |
113 | struct iwl_host_cmd cmd = { | 119 | struct iwl_host_cmd cmd = { |
114 | .id = NVM_ACCESS_CMD, | 120 | .id = NVM_ACCESS_CMD, |
115 | .flags = CMD_SYNC | CMD_WANT_SKB | CMD_SEND_IN_RFKILL, | 121 | .flags = CMD_WANT_SKB | CMD_SEND_IN_RFKILL, |
116 | .data = { &nvm_access_cmd, }, | 122 | .data = { &nvm_access_cmd, }, |
117 | }; | 123 | }; |
118 | int ret, bytes_read, offset_read; | 124 | int ret, bytes_read, offset_read; |
@@ -139,10 +145,26 @@ static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section, | |||
139 | offset_read = le16_to_cpu(nvm_resp->offset); | 145 | offset_read = le16_to_cpu(nvm_resp->offset); |
140 | resp_data = nvm_resp->data; | 146 | resp_data = nvm_resp->data; |
141 | if (ret) { | 147 | if (ret) { |
142 | IWL_ERR(mvm, | 148 | if ((offset != 0) && |
143 | "NVM access command failed with status %d (device: %s)\n", | 149 | (ret == READ_NVM_CHUNK_NOT_VALID_ADDRESS)) { |
144 | ret, mvm->cfg->name); | 150 | /* |
145 | ret = -EINVAL; | 151 | * meaning of NOT_VALID_ADDRESS: |
152 | * driver try to read chunk from address that is | ||
153 | * multiple of 2K and got an error since addr is empty. | ||
154 | * meaning of (offset != 0): driver already | ||
155 | * read valid data from another chunk so this case | ||
156 | * is not an error. | ||
157 | */ | ||
158 | IWL_DEBUG_EEPROM(mvm->trans->dev, | ||
159 | "NVM access command failed on offset 0x%x since that section size is multiple 2K\n", | ||
160 | offset); | ||
161 | ret = 0; | ||
162 | } else { | ||
163 | IWL_DEBUG_EEPROM(mvm->trans->dev, | ||
164 | "NVM access command failed with status %d (device: %s)\n", | ||
165 | ret, mvm->cfg->name); | ||
166 | ret = -EIO; | ||
167 | } | ||
146 | goto exit; | 168 | goto exit; |
147 | } | 169 | } |
148 | 170 | ||
@@ -211,9 +233,9 @@ static int iwl_nvm_read_section(struct iwl_mvm *mvm, u16 section, | |||
211 | while (ret == length) { | 233 | while (ret == length) { |
212 | ret = iwl_nvm_read_chunk(mvm, section, offset, length, data); | 234 | ret = iwl_nvm_read_chunk(mvm, section, offset, length, data); |
213 | if (ret < 0) { | 235 | if (ret < 0) { |
214 | IWL_ERR(mvm, | 236 | IWL_DEBUG_EEPROM(mvm->trans->dev, |
215 | "Cannot read NVM from section %d offset %d, length %d\n", | 237 | "Cannot read NVM from section %d offset %d, length %d\n", |
216 | section, offset, length); | 238 | section, offset, length); |
217 | return ret; | 239 | return ret; |
218 | } | 240 | } |
219 | offset += ret; | 241 | offset += ret; |
@@ -238,13 +260,20 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm) | |||
238 | return NULL; | 260 | return NULL; |
239 | } | 261 | } |
240 | } else { | 262 | } else { |
263 | /* SW and REGULATORY sections are mandatory */ | ||
241 | if (!mvm->nvm_sections[NVM_SECTION_TYPE_SW].data || | 264 | if (!mvm->nvm_sections[NVM_SECTION_TYPE_SW].data || |
242 | !mvm->nvm_sections[NVM_SECTION_TYPE_MAC_OVERRIDE].data || | ||
243 | !mvm->nvm_sections[NVM_SECTION_TYPE_REGULATORY].data) { | 265 | !mvm->nvm_sections[NVM_SECTION_TYPE_REGULATORY].data) { |
244 | IWL_ERR(mvm, | 266 | IWL_ERR(mvm, |
245 | "Can't parse empty family 8000 NVM sections\n"); | 267 | "Can't parse empty family 8000 NVM sections\n"); |
246 | return NULL; | 268 | return NULL; |
247 | } | 269 | } |
270 | /* MAC_OVERRIDE or at least HW section must exist */ | ||
271 | if (!mvm->nvm_sections[mvm->cfg->nvm_hw_section_num].data && | ||
272 | !mvm->nvm_sections[NVM_SECTION_TYPE_MAC_OVERRIDE].data) { | ||
273 | IWL_ERR(mvm, | ||
274 | "Can't parse mac_address, empty sections\n"); | ||
275 | return NULL; | ||
276 | } | ||
248 | } | 277 | } |
249 | 278 | ||
250 | if (WARN_ON(!mvm->cfg)) | 279 | if (WARN_ON(!mvm->cfg)) |
@@ -311,16 +340,16 @@ static int iwl_mvm_read_external_nvm(struct iwl_mvm *mvm) | |||
311 | * get here after that we assume the NVM request can be satisfied | 340 | * get here after that we assume the NVM request can be satisfied |
312 | * synchronously. | 341 | * synchronously. |
313 | */ | 342 | */ |
314 | ret = request_firmware(&fw_entry, iwlwifi_mod_params.nvm_file, | 343 | ret = request_firmware(&fw_entry, mvm->nvm_file_name, |
315 | mvm->trans->dev); | 344 | mvm->trans->dev); |
316 | if (ret) { | 345 | if (ret) { |
317 | IWL_ERR(mvm, "ERROR: %s isn't available %d\n", | 346 | IWL_ERR(mvm, "ERROR: %s isn't available %d\n", |
318 | iwlwifi_mod_params.nvm_file, ret); | 347 | mvm->nvm_file_name, ret); |
319 | return ret; | 348 | return ret; |
320 | } | 349 | } |
321 | 350 | ||
322 | IWL_INFO(mvm, "Loaded NVM file %s (%zu bytes)\n", | 351 | IWL_INFO(mvm, "Loaded NVM file %s (%zu bytes)\n", |
323 | iwlwifi_mod_params.nvm_file, fw_entry->size); | 352 | mvm->nvm_file_name, fw_entry->size); |
324 | 353 | ||
325 | if (fw_entry->size < sizeof(*file_sec)) { | 354 | if (fw_entry->size < sizeof(*file_sec)) { |
326 | IWL_ERR(mvm, "NVM file too small\n"); | 355 | IWL_ERR(mvm, "NVM file too small\n"); |
@@ -427,53 +456,28 @@ int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm) | |||
427 | return ret; | 456 | return ret; |
428 | } | 457 | } |
429 | 458 | ||
430 | int iwl_nvm_init(struct iwl_mvm *mvm) | 459 | int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic) |
431 | { | 460 | { |
432 | int ret, i, section; | 461 | int ret, section; |
433 | u8 *nvm_buffer, *temp; | 462 | u8 *nvm_buffer, *temp; |
434 | int nvm_to_read[NVM_MAX_NUM_SECTIONS]; | ||
435 | int num_of_sections_to_read; | ||
436 | 463 | ||
437 | if (WARN_ON_ONCE(mvm->cfg->nvm_hw_section_num >= NVM_MAX_NUM_SECTIONS)) | 464 | if (WARN_ON_ONCE(mvm->cfg->nvm_hw_section_num >= NVM_MAX_NUM_SECTIONS)) |
438 | return -EINVAL; | 465 | return -EINVAL; |
439 | 466 | ||
440 | /* load external NVM if configured */ | 467 | /* load NVM values from nic */ |
441 | if (iwlwifi_mod_params.nvm_file) { | 468 | if (read_nvm_from_nic) { |
442 | /* move to External NVM flow */ | ||
443 | ret = iwl_mvm_read_external_nvm(mvm); | ||
444 | if (ret) | ||
445 | return ret; | ||
446 | } else { | ||
447 | /* list of NVM sections we are allowed/need to read */ | ||
448 | if (mvm->trans->cfg->device_family != IWL_DEVICE_FAMILY_8000) { | ||
449 | nvm_to_read[0] = mvm->cfg->nvm_hw_section_num; | ||
450 | nvm_to_read[1] = NVM_SECTION_TYPE_SW; | ||
451 | nvm_to_read[2] = NVM_SECTION_TYPE_CALIBRATION; | ||
452 | nvm_to_read[3] = NVM_SECTION_TYPE_PRODUCTION; | ||
453 | num_of_sections_to_read = 4; | ||
454 | } else { | ||
455 | nvm_to_read[0] = NVM_SECTION_TYPE_SW; | ||
456 | nvm_to_read[1] = NVM_SECTION_TYPE_CALIBRATION; | ||
457 | nvm_to_read[2] = NVM_SECTION_TYPE_PRODUCTION; | ||
458 | nvm_to_read[3] = NVM_SECTION_TYPE_REGULATORY; | ||
459 | nvm_to_read[4] = NVM_SECTION_TYPE_MAC_OVERRIDE; | ||
460 | num_of_sections_to_read = 5; | ||
461 | } | ||
462 | |||
463 | /* Read From FW NVM */ | 469 | /* Read From FW NVM */ |
464 | IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from NVM\n"); | 470 | IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from NVM\n"); |
465 | 471 | ||
466 | /* TODO: find correct NVM max size for a section */ | ||
467 | nvm_buffer = kmalloc(mvm->cfg->base_params->eeprom_size, | 472 | nvm_buffer = kmalloc(mvm->cfg->base_params->eeprom_size, |
468 | GFP_KERNEL); | 473 | GFP_KERNEL); |
469 | if (!nvm_buffer) | 474 | if (!nvm_buffer) |
470 | return -ENOMEM; | 475 | return -ENOMEM; |
471 | for (i = 0; i < num_of_sections_to_read; i++) { | 476 | for (section = 0; section < NVM_MAX_NUM_SECTIONS; section++) { |
472 | section = nvm_to_read[i]; | ||
473 | /* we override the constness for initial read */ | 477 | /* we override the constness for initial read */ |
474 | ret = iwl_nvm_read_section(mvm, section, nvm_buffer); | 478 | ret = iwl_nvm_read_section(mvm, section, nvm_buffer); |
475 | if (ret < 0) | 479 | if (ret < 0) |
476 | break; | 480 | continue; |
477 | temp = kmemdup(nvm_buffer, ret, GFP_KERNEL); | 481 | temp = kmemdup(nvm_buffer, ret, GFP_KERNEL); |
478 | if (!temp) { | 482 | if (!temp) { |
479 | ret = -ENOMEM; | 483 | ret = -ENOMEM; |
@@ -502,15 +506,21 @@ int iwl_nvm_init(struct iwl_mvm *mvm) | |||
502 | mvm->nvm_hw_blob.size = ret; | 506 | mvm->nvm_hw_blob.size = ret; |
503 | break; | 507 | break; |
504 | } | 508 | } |
505 | WARN(1, "section: %d", section); | ||
506 | } | 509 | } |
507 | #endif | 510 | #endif |
508 | } | 511 | } |
509 | kfree(nvm_buffer); | 512 | kfree(nvm_buffer); |
510 | if (ret < 0) | 513 | } |
514 | |||
515 | /* load external NVM if configured */ | ||
516 | if (mvm->nvm_file_name) { | ||
517 | /* move to External NVM flow */ | ||
518 | ret = iwl_mvm_read_external_nvm(mvm); | ||
519 | if (ret) | ||
511 | return ret; | 520 | return ret; |
512 | } | 521 | } |
513 | 522 | ||
523 | /* parse the relevant nvm sections */ | ||
514 | mvm->nvm_data = iwl_parse_nvm_sections(mvm); | 524 | mvm->nvm_data = iwl_parse_nvm_sections(mvm); |
515 | if (!mvm->nvm_data) | 525 | if (!mvm->nvm_data) |
516 | return -ENODATA; | 526 | return -ENODATA; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c index 9545d7fdd4bf..cc2f7de396de 100644 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c | |||
@@ -79,8 +79,8 @@ | |||
79 | #include "iwl-prph.h" | 79 | #include "iwl-prph.h" |
80 | #include "rs.h" | 80 | #include "rs.h" |
81 | #include "fw-api-scan.h" | 81 | #include "fw-api-scan.h" |
82 | #include "fw-error-dump.h" | ||
83 | #include "time-event.h" | 82 | #include "time-event.h" |
83 | #include "iwl-fw-error-dump.h" | ||
84 | 84 | ||
85 | /* | 85 | /* |
86 | * module name, copyright, version, etc. | 86 | * module name, copyright, version, etc. |
@@ -220,7 +220,7 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = { | |||
220 | RX_HANDLER(BA_NOTIF, iwl_mvm_rx_ba_notif, false), | 220 | RX_HANDLER(BA_NOTIF, iwl_mvm_rx_ba_notif, false), |
221 | 221 | ||
222 | RX_HANDLER(BT_PROFILE_NOTIFICATION, iwl_mvm_rx_bt_coex_notif, true), | 222 | RX_HANDLER(BT_PROFILE_NOTIFICATION, iwl_mvm_rx_bt_coex_notif, true), |
223 | RX_HANDLER(BEACON_NOTIFICATION, iwl_mvm_rx_beacon_notif, false), | 223 | RX_HANDLER(BEACON_NOTIFICATION, iwl_mvm_rx_beacon_notif, true), |
224 | RX_HANDLER(STATISTICS_NOTIFICATION, iwl_mvm_rx_statistics, true), | 224 | RX_HANDLER(STATISTICS_NOTIFICATION, iwl_mvm_rx_statistics, true), |
225 | RX_HANDLER(ANTENNA_COUPLING_NOTIFICATION, | 225 | RX_HANDLER(ANTENNA_COUPLING_NOTIFICATION, |
226 | iwl_mvm_rx_ant_coupling_notif, true), | 226 | iwl_mvm_rx_ant_coupling_notif, true), |
@@ -402,6 +402,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
402 | mvm->sf_state = SF_UNINIT; | 402 | mvm->sf_state = SF_UNINIT; |
403 | 403 | ||
404 | mutex_init(&mvm->mutex); | 404 | mutex_init(&mvm->mutex); |
405 | mutex_init(&mvm->d0i3_suspend_mutex); | ||
405 | spin_lock_init(&mvm->async_handlers_lock); | 406 | spin_lock_init(&mvm->async_handlers_lock); |
406 | INIT_LIST_HEAD(&mvm->time_event_list); | 407 | INIT_LIST_HEAD(&mvm->time_event_list); |
407 | INIT_LIST_HEAD(&mvm->async_handlers_list); | 408 | INIT_LIST_HEAD(&mvm->async_handlers_list); |
@@ -465,13 +466,24 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
465 | 466 | ||
466 | min_backoff = calc_min_backoff(trans, cfg); | 467 | min_backoff = calc_min_backoff(trans, cfg); |
467 | iwl_mvm_tt_initialize(mvm, min_backoff); | 468 | iwl_mvm_tt_initialize(mvm, min_backoff); |
469 | /* set the nvm_file_name according to priority */ | ||
470 | if (iwlwifi_mod_params.nvm_file) | ||
471 | mvm->nvm_file_name = iwlwifi_mod_params.nvm_file; | ||
472 | else | ||
473 | mvm->nvm_file_name = mvm->cfg->default_nvm_file; | ||
474 | |||
475 | if (WARN(cfg->no_power_up_nic_in_init && !mvm->nvm_file_name, | ||
476 | "not allowing power-up and not having nvm_file\n")) | ||
477 | goto out_free; | ||
468 | 478 | ||
469 | /* | 479 | /* |
470 | * If the NVM exists in an external file, | 480 | * Even if nvm exists in the nvm_file driver should read agin the nvm |
471 | * there is no need to unnecessarily power up the NIC at driver load | 481 | * from the nic because there might be entries that exist in the OTP |
482 | * and not in the file. | ||
483 | * for nics with no_power_up_nic_in_init: rely completley on nvm_file | ||
472 | */ | 484 | */ |
473 | if (iwlwifi_mod_params.nvm_file) { | 485 | if (cfg->no_power_up_nic_in_init && mvm->nvm_file_name) { |
474 | err = iwl_nvm_init(mvm); | 486 | err = iwl_nvm_init(mvm, false); |
475 | if (err) | 487 | if (err) |
476 | goto out_free; | 488 | goto out_free; |
477 | } else { | 489 | } else { |
@@ -518,7 +530,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
518 | out_free: | 530 | out_free: |
519 | iwl_phy_db_free(mvm->phy_db); | 531 | iwl_phy_db_free(mvm->phy_db); |
520 | kfree(mvm->scan_cmd); | 532 | kfree(mvm->scan_cmd); |
521 | if (!iwlwifi_mod_params.nvm_file) | 533 | if (!cfg->no_power_up_nic_in_init || !mvm->nvm_file_name) |
522 | iwl_trans_op_mode_leave(trans); | 534 | iwl_trans_op_mode_leave(trans); |
523 | ieee80211_free_hw(mvm->hw); | 535 | ieee80211_free_hw(mvm->hw); |
524 | return NULL; | 536 | return NULL; |
@@ -538,6 +550,7 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode) | |||
538 | kfree(mvm->scan_cmd); | 550 | kfree(mvm->scan_cmd); |
539 | vfree(mvm->fw_error_dump); | 551 | vfree(mvm->fw_error_dump); |
540 | kfree(mvm->fw_error_sram); | 552 | kfree(mvm->fw_error_sram); |
553 | kfree(mvm->fw_error_rxf); | ||
541 | kfree(mvm->mcast_filter_cmd); | 554 | kfree(mvm->mcast_filter_cmd); |
542 | mvm->mcast_filter_cmd = NULL; | 555 | mvm->mcast_filter_cmd = NULL; |
543 | 556 | ||
@@ -814,6 +827,7 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm) | |||
814 | struct iwl_fw_error_dump_file *dump_file; | 827 | struct iwl_fw_error_dump_file *dump_file; |
815 | struct iwl_fw_error_dump_data *dump_data; | 828 | struct iwl_fw_error_dump_data *dump_data; |
816 | u32 file_len; | 829 | u32 file_len; |
830 | u32 trans_len; | ||
817 | 831 | ||
818 | lockdep_assert_held(&mvm->mutex); | 832 | lockdep_assert_held(&mvm->mutex); |
819 | 833 | ||
@@ -821,8 +835,13 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm) | |||
821 | return; | 835 | return; |
822 | 836 | ||
823 | file_len = mvm->fw_error_sram_len + | 837 | file_len = mvm->fw_error_sram_len + |
838 | mvm->fw_error_rxf_len + | ||
824 | sizeof(*dump_file) + | 839 | sizeof(*dump_file) + |
825 | sizeof(*dump_data); | 840 | sizeof(*dump_data) * 2; |
841 | |||
842 | trans_len = iwl_trans_dump_data(mvm->trans, NULL, 0); | ||
843 | if (trans_len) | ||
844 | file_len += trans_len; | ||
826 | 845 | ||
827 | dump_file = vmalloc(file_len); | 846 | dump_file = vmalloc(file_len); |
828 | if (!dump_file) | 847 | if (!dump_file) |
@@ -833,7 +852,12 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm) | |||
833 | dump_file->barker = cpu_to_le32(IWL_FW_ERROR_DUMP_BARKER); | 852 | dump_file->barker = cpu_to_le32(IWL_FW_ERROR_DUMP_BARKER); |
834 | dump_file->file_len = cpu_to_le32(file_len); | 853 | dump_file->file_len = cpu_to_le32(file_len); |
835 | dump_data = (void *)dump_file->data; | 854 | dump_data = (void *)dump_file->data; |
836 | dump_data->type = IWL_FW_ERROR_DUMP_SRAM; | 855 | dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_RXF); |
856 | dump_data->len = cpu_to_le32(mvm->fw_error_rxf_len); | ||
857 | memcpy(dump_data->data, mvm->fw_error_rxf, mvm->fw_error_rxf_len); | ||
858 | |||
859 | dump_data = iwl_mvm_fw_error_next_data(dump_data); | ||
860 | dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_SRAM); | ||
837 | dump_data->len = cpu_to_le32(mvm->fw_error_sram_len); | 861 | dump_data->len = cpu_to_le32(mvm->fw_error_sram_len); |
838 | 862 | ||
839 | /* | 863 | /* |
@@ -842,6 +866,23 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm) | |||
842 | * mvm->fw_error_sram right now. | 866 | * mvm->fw_error_sram right now. |
843 | */ | 867 | */ |
844 | memcpy(dump_data->data, mvm->fw_error_sram, mvm->fw_error_sram_len); | 868 | memcpy(dump_data->data, mvm->fw_error_sram, mvm->fw_error_sram_len); |
869 | |||
870 | kfree(mvm->fw_error_rxf); | ||
871 | mvm->fw_error_rxf = NULL; | ||
872 | mvm->fw_error_rxf_len = 0; | ||
873 | |||
874 | kfree(mvm->fw_error_sram); | ||
875 | mvm->fw_error_sram = NULL; | ||
876 | mvm->fw_error_sram_len = 0; | ||
877 | |||
878 | if (trans_len) { | ||
879 | void *buf = iwl_mvm_fw_error_next_data(dump_data); | ||
880 | u32 real_trans_len = iwl_trans_dump_data(mvm->trans, buf, | ||
881 | trans_len); | ||
882 | dump_data = (void *)((u8 *)buf + real_trans_len); | ||
883 | dump_file->file_len = | ||
884 | cpu_to_le32(file_len - trans_len + real_trans_len); | ||
885 | } | ||
845 | } | 886 | } |
846 | #endif | 887 | #endif |
847 | 888 | ||
@@ -853,6 +894,7 @@ static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode) | |||
853 | 894 | ||
854 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 895 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
855 | iwl_mvm_fw_error_sram_dump(mvm); | 896 | iwl_mvm_fw_error_sram_dump(mvm); |
897 | iwl_mvm_fw_error_rxf_dump(mvm); | ||
856 | #endif | 898 | #endif |
857 | 899 | ||
858 | iwl_mvm_nic_restart(mvm); | 900 | iwl_mvm_nic_restart(mvm); |
@@ -1126,9 +1168,9 @@ static void iwl_mvm_d0i3_exit_work(struct work_struct *wk) | |||
1126 | struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, d0i3_exit_work); | 1168 | struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, d0i3_exit_work); |
1127 | struct iwl_host_cmd get_status_cmd = { | 1169 | struct iwl_host_cmd get_status_cmd = { |
1128 | .id = WOWLAN_GET_STATUSES, | 1170 | .id = WOWLAN_GET_STATUSES, |
1129 | .flags = CMD_SYNC | CMD_HIGH_PRIO | CMD_WANT_SKB, | 1171 | .flags = CMD_HIGH_PRIO | CMD_WANT_SKB, |
1130 | }; | 1172 | }; |
1131 | struct iwl_wowlan_status_v6 *status; | 1173 | struct iwl_wowlan_status *status; |
1132 | int ret; | 1174 | int ret; |
1133 | u32 disconnection_reasons, wakeup_reasons; | 1175 | u32 disconnection_reasons, wakeup_reasons; |
1134 | __le16 *qos_seq = NULL; | 1176 | __le16 *qos_seq = NULL; |
@@ -1158,18 +1200,27 @@ static void iwl_mvm_d0i3_exit_work(struct work_struct *wk) | |||
1158 | iwl_free_resp(&get_status_cmd); | 1200 | iwl_free_resp(&get_status_cmd); |
1159 | out: | 1201 | out: |
1160 | iwl_mvm_d0i3_enable_tx(mvm, qos_seq); | 1202 | iwl_mvm_d0i3_enable_tx(mvm, qos_seq); |
1203 | iwl_mvm_unref(mvm, IWL_MVM_REF_EXIT_WORK); | ||
1161 | mutex_unlock(&mvm->mutex); | 1204 | mutex_unlock(&mvm->mutex); |
1162 | } | 1205 | } |
1163 | 1206 | ||
1164 | static int iwl_mvm_exit_d0i3(struct iwl_op_mode *op_mode) | 1207 | int _iwl_mvm_exit_d0i3(struct iwl_mvm *mvm) |
1165 | { | 1208 | { |
1166 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | ||
1167 | u32 flags = CMD_ASYNC | CMD_HIGH_PRIO | CMD_SEND_IN_IDLE | | 1209 | u32 flags = CMD_ASYNC | CMD_HIGH_PRIO | CMD_SEND_IN_IDLE | |
1168 | CMD_WAKE_UP_TRANS; | 1210 | CMD_WAKE_UP_TRANS; |
1169 | int ret; | 1211 | int ret; |
1170 | 1212 | ||
1171 | IWL_DEBUG_RPM(mvm, "MVM exiting D0i3\n"); | 1213 | IWL_DEBUG_RPM(mvm, "MVM exiting D0i3\n"); |
1172 | 1214 | ||
1215 | mutex_lock(&mvm->d0i3_suspend_mutex); | ||
1216 | if (test_bit(D0I3_DEFER_WAKEUP, &mvm->d0i3_suspend_flags)) { | ||
1217 | IWL_DEBUG_RPM(mvm, "Deferring d0i3 exit until resume\n"); | ||
1218 | __set_bit(D0I3_PENDING_WAKEUP, &mvm->d0i3_suspend_flags); | ||
1219 | mutex_unlock(&mvm->d0i3_suspend_mutex); | ||
1220 | return 0; | ||
1221 | } | ||
1222 | mutex_unlock(&mvm->d0i3_suspend_mutex); | ||
1223 | |||
1173 | ret = iwl_mvm_send_cmd_pdu(mvm, D0I3_END_CMD, flags, 0, NULL); | 1224 | ret = iwl_mvm_send_cmd_pdu(mvm, D0I3_END_CMD, flags, 0, NULL); |
1174 | if (ret) | 1225 | if (ret) |
1175 | goto out; | 1226 | goto out; |
@@ -1183,6 +1234,25 @@ out: | |||
1183 | return ret; | 1234 | return ret; |
1184 | } | 1235 | } |
1185 | 1236 | ||
1237 | static int iwl_mvm_exit_d0i3(struct iwl_op_mode *op_mode) | ||
1238 | { | ||
1239 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | ||
1240 | |||
1241 | iwl_mvm_ref(mvm, IWL_MVM_REF_EXIT_WORK); | ||
1242 | return _iwl_mvm_exit_d0i3(mvm); | ||
1243 | } | ||
1244 | |||
1245 | static void iwl_mvm_napi_add(struct iwl_op_mode *op_mode, | ||
1246 | struct napi_struct *napi, | ||
1247 | struct net_device *napi_dev, | ||
1248 | int (*poll)(struct napi_struct *, int), | ||
1249 | int weight) | ||
1250 | { | ||
1251 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | ||
1252 | |||
1253 | ieee80211_napi_add(mvm->hw, napi, napi_dev, poll, weight); | ||
1254 | } | ||
1255 | |||
1186 | static const struct iwl_op_mode_ops iwl_mvm_ops = { | 1256 | static const struct iwl_op_mode_ops iwl_mvm_ops = { |
1187 | .start = iwl_op_mode_mvm_start, | 1257 | .start = iwl_op_mode_mvm_start, |
1188 | .stop = iwl_op_mode_mvm_stop, | 1258 | .stop = iwl_op_mode_mvm_stop, |
@@ -1196,4 +1266,5 @@ static const struct iwl_op_mode_ops iwl_mvm_ops = { | |||
1196 | .nic_config = iwl_mvm_nic_config, | 1266 | .nic_config = iwl_mvm_nic_config, |
1197 | .enter_d0i3 = iwl_mvm_enter_d0i3, | 1267 | .enter_d0i3 = iwl_mvm_enter_d0i3, |
1198 | .exit_d0i3 = iwl_mvm_exit_d0i3, | 1268 | .exit_d0i3 = iwl_mvm_exit_d0i3, |
1269 | .napi_add = iwl_mvm_napi_add, | ||
1199 | }; | 1270 | }; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c index 237efe0ac1c4..539f3a942d43 100644 --- a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c | |||
@@ -156,6 +156,18 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm, | |||
156 | idle_cnt = chains_static; | 156 | idle_cnt = chains_static; |
157 | active_cnt = chains_dynamic; | 157 | active_cnt = chains_dynamic; |
158 | 158 | ||
159 | /* In scenarios where we only ever use a single-stream rates, | ||
160 | * i.e. legacy 11b/g/a associations, single-stream APs or even | ||
161 | * static SMPS, enable both chains to get diversity, improving | ||
162 | * the case where we're far enough from the AP that attenuation | ||
163 | * between the two antennas is sufficiently different to impact | ||
164 | * performance. | ||
165 | */ | ||
166 | if (active_cnt == 1 && iwl_mvm_rx_diversity_allowed(mvm)) { | ||
167 | idle_cnt = 2; | ||
168 | active_cnt = 2; | ||
169 | } | ||
170 | |||
159 | cmd->rxchain_info = cpu_to_le32(mvm->fw->valid_rx_ant << | 171 | cmd->rxchain_info = cpu_to_le32(mvm->fw->valid_rx_ant << |
160 | PHY_RX_CHAIN_VALID_POS); | 172 | PHY_RX_CHAIN_VALID_POS); |
161 | cmd->rxchain_info |= cpu_to_le32(idle_cnt << PHY_RX_CHAIN_CNT_POS); | 173 | cmd->rxchain_info |= cpu_to_le32(idle_cnt << PHY_RX_CHAIN_CNT_POS); |
@@ -187,7 +199,7 @@ static int iwl_mvm_phy_ctxt_apply(struct iwl_mvm *mvm, | |||
187 | iwl_mvm_phy_ctxt_cmd_data(mvm, &cmd, chandef, | 199 | iwl_mvm_phy_ctxt_cmd_data(mvm, &cmd, chandef, |
188 | chains_static, chains_dynamic); | 200 | chains_static, chains_dynamic); |
189 | 201 | ||
190 | ret = iwl_mvm_send_cmd_pdu(mvm, PHY_CONTEXT_CMD, CMD_SYNC, | 202 | ret = iwl_mvm_send_cmd_pdu(mvm, PHY_CONTEXT_CMD, 0, |
191 | sizeof(struct iwl_phy_context_cmd), | 203 | sizeof(struct iwl_phy_context_cmd), |
192 | &cmd); | 204 | &cmd); |
193 | if (ret) | 205 | if (ret) |
@@ -202,18 +214,15 @@ int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, | |||
202 | struct cfg80211_chan_def *chandef, | 214 | struct cfg80211_chan_def *chandef, |
203 | u8 chains_static, u8 chains_dynamic) | 215 | u8 chains_static, u8 chains_dynamic) |
204 | { | 216 | { |
205 | int ret; | ||
206 | |||
207 | WARN_ON(!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && | 217 | WARN_ON(!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && |
208 | ctxt->ref); | 218 | ctxt->ref); |
209 | lockdep_assert_held(&mvm->mutex); | 219 | lockdep_assert_held(&mvm->mutex); |
210 | 220 | ||
211 | ctxt->channel = chandef->chan; | 221 | ctxt->channel = chandef->chan; |
212 | ret = iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, | ||
213 | chains_static, chains_dynamic, | ||
214 | FW_CTXT_ACTION_ADD, 0); | ||
215 | 222 | ||
216 | return ret; | 223 | return iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, |
224 | chains_static, chains_dynamic, | ||
225 | FW_CTXT_ACTION_ADD, 0); | ||
217 | } | 226 | } |
218 | 227 | ||
219 | /* | 228 | /* |
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c index 6b636eab3339..c182a8baf685 100644 --- a/drivers/net/wireless/iwlwifi/mvm/power.c +++ b/drivers/net/wireless/iwlwifi/mvm/power.c | |||
@@ -123,28 +123,6 @@ void iwl_mvm_beacon_filter_set_cqm_params(struct iwl_mvm *mvm, | |||
123 | cmd->ba_enable_beacon_abort = cpu_to_le32(mvmvif->bf_data.ba_enabled); | 123 | cmd->ba_enable_beacon_abort = cpu_to_le32(mvmvif->bf_data.ba_enabled); |
124 | } | 124 | } |
125 | 125 | ||
126 | int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm, | ||
127 | struct ieee80211_vif *vif, bool enable) | ||
128 | { | ||
129 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
130 | struct iwl_beacon_filter_cmd cmd = { | ||
131 | IWL_BF_CMD_CONFIG_DEFAULTS, | ||
132 | .bf_enable_beacon_filter = cpu_to_le32(1), | ||
133 | .ba_enable_beacon_abort = cpu_to_le32(enable), | ||
134 | }; | ||
135 | |||
136 | if (!mvmvif->bf_data.bf_enabled) | ||
137 | return 0; | ||
138 | |||
139 | if (mvm->cur_ucode == IWL_UCODE_WOWLAN) | ||
140 | cmd.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_D3); | ||
141 | |||
142 | mvmvif->bf_data.ba_enabled = enable; | ||
143 | iwl_mvm_beacon_filter_set_cqm_params(mvm, vif, &cmd); | ||
144 | iwl_mvm_beacon_filter_debugfs_parameters(vif, &cmd); | ||
145 | return iwl_mvm_beacon_filter_send_cmd(mvm, &cmd, CMD_SYNC); | ||
146 | } | ||
147 | |||
148 | static void iwl_mvm_power_log(struct iwl_mvm *mvm, | 126 | static void iwl_mvm_power_log(struct iwl_mvm *mvm, |
149 | struct iwl_mac_power_cmd *cmd) | 127 | struct iwl_mac_power_cmd *cmd) |
150 | { | 128 | { |
@@ -268,6 +246,57 @@ static void iwl_mvm_power_configure_uapsd(struct iwl_mvm *mvm, | |||
268 | IWL_MVM_PS_HEAVY_RX_THLD_PERCENT; | 246 | IWL_MVM_PS_HEAVY_RX_THLD_PERCENT; |
269 | } | 247 | } |
270 | 248 | ||
249 | static void iwl_mvm_binding_iterator(void *_data, u8 *mac, | ||
250 | struct ieee80211_vif *vif) | ||
251 | { | ||
252 | unsigned long *data = _data; | ||
253 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
254 | |||
255 | if (!mvmvif->phy_ctxt) | ||
256 | return; | ||
257 | |||
258 | if (vif->type == NL80211_IFTYPE_STATION || | ||
259 | vif->type == NL80211_IFTYPE_AP) | ||
260 | __set_bit(mvmvif->phy_ctxt->id, data); | ||
261 | } | ||
262 | |||
263 | static bool iwl_mvm_power_allow_uapsd(struct iwl_mvm *mvm, | ||
264 | struct ieee80211_vif *vif) | ||
265 | { | ||
266 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
267 | unsigned long phy_ctxt_counter = 0; | ||
268 | |||
269 | ieee80211_iterate_active_interfaces_atomic(mvm->hw, | ||
270 | IEEE80211_IFACE_ITER_NORMAL, | ||
271 | iwl_mvm_binding_iterator, | ||
272 | &phy_ctxt_counter); | ||
273 | |||
274 | if (!memcmp(mvmvif->uapsd_misbehaving_bssid, vif->bss_conf.bssid, | ||
275 | ETH_ALEN)) | ||
276 | return false; | ||
277 | |||
278 | if (vif->p2p && | ||
279 | !(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD)) | ||
280 | return false; | ||
281 | /* | ||
282 | * Avoid using uAPSD if P2P client is associated to GO that uses | ||
283 | * opportunistic power save. This is due to current FW limitation. | ||
284 | */ | ||
285 | if (vif->p2p && | ||
286 | (vif->bss_conf.p2p_noa_attr.oppps_ctwindow & | ||
287 | IEEE80211_P2P_OPPPS_ENABLE_BIT)) | ||
288 | return false; | ||
289 | |||
290 | /* | ||
291 | * Avoid using uAPSD if client is in DCM - | ||
292 | * low latency issue in Miracast | ||
293 | */ | ||
294 | if (hweight8(phy_ctxt_counter) >= 2) | ||
295 | return false; | ||
296 | |||
297 | return true; | ||
298 | } | ||
299 | |||
271 | static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, | 300 | static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, |
272 | struct ieee80211_vif *vif, | 301 | struct ieee80211_vif *vif, |
273 | struct iwl_mac_power_cmd *cmd) | 302 | struct iwl_mac_power_cmd *cmd) |
@@ -280,7 +309,6 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, | |||
280 | bool radar_detect = false; | 309 | bool radar_detect = false; |
281 | struct iwl_mvm_vif *mvmvif __maybe_unused = | 310 | struct iwl_mvm_vif *mvmvif __maybe_unused = |
282 | iwl_mvm_vif_from_mac80211(vif); | 311 | iwl_mvm_vif_from_mac80211(vif); |
283 | bool allow_uapsd = true; | ||
284 | 312 | ||
285 | cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, | 313 | cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, |
286 | mvmvif->color)); | 314 | mvmvif->color)); |
@@ -303,13 +331,8 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, | |||
303 | 331 | ||
304 | cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK); | 332 | cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK); |
305 | 333 | ||
306 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
307 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_DISABLE_POWER_OFF && | ||
308 | mvmvif->dbgfs_pm.disable_power_off) | ||
309 | cmd->flags &= cpu_to_le16(~POWER_FLAGS_POWER_SAVE_ENA_MSK); | ||
310 | #endif | ||
311 | if (!vif->bss_conf.ps || iwl_mvm_vif_low_latency(mvmvif) || | 334 | if (!vif->bss_conf.ps || iwl_mvm_vif_low_latency(mvmvif) || |
312 | mvm->pm_disabled) | 335 | !mvmvif->pm_enabled) |
313 | return; | 336 | return; |
314 | 337 | ||
315 | cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK); | 338 | cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK); |
@@ -351,23 +374,7 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, | |||
351 | cpu_to_le32(IWL_MVM_WOWLAN_PS_TX_DATA_TIMEOUT); | 374 | cpu_to_le32(IWL_MVM_WOWLAN_PS_TX_DATA_TIMEOUT); |
352 | } | 375 | } |
353 | 376 | ||
354 | if (!memcmp(mvmvif->uapsd_misbehaving_bssid, vif->bss_conf.bssid, | 377 | if (iwl_mvm_power_allow_uapsd(mvm, vif)) |
355 | ETH_ALEN)) | ||
356 | allow_uapsd = false; | ||
357 | |||
358 | if (vif->p2p && | ||
359 | !(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD)) | ||
360 | allow_uapsd = false; | ||
361 | /* | ||
362 | * Avoid using uAPSD if P2P client is associated to GO that uses | ||
363 | * opportunistic power save. This is due to current FW limitation. | ||
364 | */ | ||
365 | if (vif->p2p && | ||
366 | vif->bss_conf.p2p_noa_attr.oppps_ctwindow & | ||
367 | IEEE80211_P2P_OPPPS_ENABLE_BIT) | ||
368 | allow_uapsd = false; | ||
369 | |||
370 | if (allow_uapsd) | ||
371 | iwl_mvm_power_configure_uapsd(mvm, vif, cmd); | 378 | iwl_mvm_power_configure_uapsd(mvm, vif, cmd); |
372 | 379 | ||
373 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 380 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
@@ -421,20 +428,13 @@ static int iwl_mvm_power_send_cmd(struct iwl_mvm *mvm, | |||
421 | { | 428 | { |
422 | struct iwl_mac_power_cmd cmd = {}; | 429 | struct iwl_mac_power_cmd cmd = {}; |
423 | 430 | ||
424 | if (vif->type != NL80211_IFTYPE_STATION) | ||
425 | return 0; | ||
426 | |||
427 | if (vif->p2p && | ||
428 | !(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM)) | ||
429 | return 0; | ||
430 | |||
431 | iwl_mvm_power_build_cmd(mvm, vif, &cmd); | 431 | iwl_mvm_power_build_cmd(mvm, vif, &cmd); |
432 | iwl_mvm_power_log(mvm, &cmd); | 432 | iwl_mvm_power_log(mvm, &cmd); |
433 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 433 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
434 | memcpy(&iwl_mvm_vif_from_mac80211(vif)->mac_pwr_cmd, &cmd, sizeof(cmd)); | 434 | memcpy(&iwl_mvm_vif_from_mac80211(vif)->mac_pwr_cmd, &cmd, sizeof(cmd)); |
435 | #endif | 435 | #endif |
436 | 436 | ||
437 | return iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, CMD_SYNC, | 437 | return iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, 0, |
438 | sizeof(cmd), &cmd); | 438 | sizeof(cmd), &cmd); |
439 | } | 439 | } |
440 | 440 | ||
@@ -444,12 +444,6 @@ int iwl_mvm_power_update_device(struct iwl_mvm *mvm) | |||
444 | .flags = cpu_to_le16(DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK), | 444 | .flags = cpu_to_le16(DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK), |
445 | }; | 445 | }; |
446 | 446 | ||
447 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PM_CMD_SUPPORT)) | ||
448 | return 0; | ||
449 | |||
450 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD)) | ||
451 | return 0; | ||
452 | |||
453 | if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM) | 447 | if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM) |
454 | mvm->ps_disabled = true; | 448 | mvm->ps_disabled = true; |
455 | 449 | ||
@@ -466,7 +460,7 @@ int iwl_mvm_power_update_device(struct iwl_mvm *mvm) | |||
466 | "Sending device power command with flags = 0x%X\n", | 460 | "Sending device power command with flags = 0x%X\n", |
467 | cmd.flags); | 461 | cmd.flags); |
468 | 462 | ||
469 | return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_SYNC, sizeof(cmd), | 463 | return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, 0, sizeof(cmd), |
470 | &cmd); | 464 | &cmd); |
471 | } | 465 | } |
472 | 466 | ||
@@ -508,86 +502,69 @@ int iwl_mvm_power_uapsd_misbehaving_ap_notif(struct iwl_mvm *mvm, | |||
508 | return 0; | 502 | return 0; |
509 | } | 503 | } |
510 | 504 | ||
511 | struct iwl_power_constraint { | 505 | struct iwl_power_vifs { |
512 | struct ieee80211_vif *bf_vif; | 506 | struct ieee80211_vif *bf_vif; |
513 | struct ieee80211_vif *bss_vif; | 507 | struct ieee80211_vif *bss_vif; |
514 | struct ieee80211_vif *p2p_vif; | 508 | struct ieee80211_vif *p2p_vif; |
515 | u16 bss_phyctx_id; | 509 | struct ieee80211_vif *ap_vif; |
516 | u16 p2p_phyctx_id; | 510 | struct ieee80211_vif *monitor_vif; |
517 | bool pm_disabled; | 511 | bool p2p_active; |
518 | bool ps_disabled; | 512 | bool bss_active; |
519 | struct iwl_mvm *mvm; | 513 | bool ap_active; |
514 | bool monitor_active; | ||
520 | }; | 515 | }; |
521 | 516 | ||
522 | static void iwl_mvm_power_iterator(void *_data, u8 *mac, | 517 | static void iwl_mvm_power_iterator(void *_data, u8 *mac, |
523 | struct ieee80211_vif *vif) | 518 | struct ieee80211_vif *vif) |
524 | { | 519 | { |
525 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 520 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
526 | struct iwl_power_constraint *power_iterator = _data; | 521 | struct iwl_power_vifs *power_iterator = _data; |
527 | struct iwl_mvm *mvm = power_iterator->mvm; | ||
528 | 522 | ||
523 | mvmvif->pm_enabled = false; | ||
529 | switch (ieee80211_vif_type_p2p(vif)) { | 524 | switch (ieee80211_vif_type_p2p(vif)) { |
530 | case NL80211_IFTYPE_P2P_DEVICE: | 525 | case NL80211_IFTYPE_P2P_DEVICE: |
531 | break; | 526 | break; |
532 | 527 | ||
533 | case NL80211_IFTYPE_P2P_GO: | 528 | case NL80211_IFTYPE_P2P_GO: |
534 | case NL80211_IFTYPE_AP: | 529 | case NL80211_IFTYPE_AP: |
535 | /* no BSS power mgmt if we have an active AP */ | 530 | /* only a single MAC of the same type */ |
536 | if (mvmvif->ap_ibss_active) | 531 | WARN_ON(power_iterator->ap_vif); |
537 | power_iterator->pm_disabled = true; | 532 | power_iterator->ap_vif = vif; |
533 | if (mvmvif->phy_ctxt) | ||
534 | if (mvmvif->phy_ctxt->id < MAX_PHYS) | ||
535 | power_iterator->ap_active = true; | ||
538 | break; | 536 | break; |
539 | 537 | ||
540 | case NL80211_IFTYPE_MONITOR: | 538 | case NL80211_IFTYPE_MONITOR: |
541 | /* no BSS power mgmt and no device power save */ | 539 | /* only a single MAC of the same type */ |
542 | power_iterator->pm_disabled = true; | 540 | WARN_ON(power_iterator->monitor_vif); |
543 | power_iterator->ps_disabled = true; | 541 | power_iterator->monitor_vif = vif; |
542 | if (mvmvif->phy_ctxt) | ||
543 | if (mvmvif->phy_ctxt->id < MAX_PHYS) | ||
544 | power_iterator->monitor_active = true; | ||
544 | break; | 545 | break; |
545 | 546 | ||
546 | case NL80211_IFTYPE_P2P_CLIENT: | 547 | case NL80211_IFTYPE_P2P_CLIENT: |
547 | if (mvmvif->phy_ctxt) | 548 | /* only a single MAC of the same type */ |
548 | power_iterator->p2p_phyctx_id = mvmvif->phy_ctxt->id; | ||
549 | |||
550 | /* we should have only one P2P vif */ | ||
551 | WARN_ON(power_iterator->p2p_vif); | 549 | WARN_ON(power_iterator->p2p_vif); |
552 | power_iterator->p2p_vif = vif; | 550 | power_iterator->p2p_vif = vif; |
553 | 551 | if (mvmvif->phy_ctxt) | |
554 | IWL_DEBUG_POWER(mvm, "p2p: p2p_id=%d, bss_id=%d\n", | 552 | if (mvmvif->phy_ctxt->id < MAX_PHYS) |
555 | power_iterator->p2p_phyctx_id, | 553 | power_iterator->p2p_active = true; |
556 | power_iterator->bss_phyctx_id); | ||
557 | if (!(mvm->fw->ucode_capa.flags & | ||
558 | IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM)) { | ||
559 | /* no BSS power mgmt if we have a P2P client*/ | ||
560 | power_iterator->pm_disabled = true; | ||
561 | } else if (power_iterator->p2p_phyctx_id < MAX_PHYS && | ||
562 | power_iterator->bss_phyctx_id < MAX_PHYS && | ||
563 | power_iterator->p2p_phyctx_id == | ||
564 | power_iterator->bss_phyctx_id) { | ||
565 | power_iterator->pm_disabled = true; | ||
566 | } | ||
567 | break; | 554 | break; |
568 | 555 | ||
569 | case NL80211_IFTYPE_STATION: | 556 | case NL80211_IFTYPE_STATION: |
570 | if (mvmvif->phy_ctxt) | 557 | /* only a single MAC of the same type */ |
571 | power_iterator->bss_phyctx_id = mvmvif->phy_ctxt->id; | ||
572 | |||
573 | /* we should have only one BSS vif */ | ||
574 | WARN_ON(power_iterator->bss_vif); | 558 | WARN_ON(power_iterator->bss_vif); |
575 | power_iterator->bss_vif = vif; | 559 | power_iterator->bss_vif = vif; |
560 | if (mvmvif->phy_ctxt) | ||
561 | if (mvmvif->phy_ctxt->id < MAX_PHYS) | ||
562 | power_iterator->bss_active = true; | ||
576 | 563 | ||
577 | if (mvmvif->bf_data.bf_enabled && | 564 | if (mvmvif->bf_data.bf_enabled && |
578 | !WARN_ON(power_iterator->bf_vif)) | 565 | !WARN_ON(power_iterator->bf_vif)) |
579 | power_iterator->bf_vif = vif; | 566 | power_iterator->bf_vif = vif; |
580 | 567 | ||
581 | IWL_DEBUG_POWER(mvm, "bss: p2p_id=%d, bss_id=%d\n", | ||
582 | power_iterator->p2p_phyctx_id, | ||
583 | power_iterator->bss_phyctx_id); | ||
584 | if (mvm->fw->ucode_capa.flags & | ||
585 | IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM && | ||
586 | (power_iterator->p2p_phyctx_id < MAX_PHYS && | ||
587 | power_iterator->bss_phyctx_id < MAX_PHYS && | ||
588 | power_iterator->p2p_phyctx_id == | ||
589 | power_iterator->bss_phyctx_id)) | ||
590 | power_iterator->pm_disabled = true; | ||
591 | break; | 568 | break; |
592 | 569 | ||
593 | default: | 570 | default: |
@@ -596,70 +573,73 @@ static void iwl_mvm_power_iterator(void *_data, u8 *mac, | |||
596 | } | 573 | } |
597 | 574 | ||
598 | static void | 575 | static void |
599 | iwl_mvm_power_get_global_constraint(struct iwl_mvm *mvm, | 576 | iwl_mvm_power_set_pm(struct iwl_mvm *mvm, |
600 | struct iwl_power_constraint *constraint) | 577 | struct iwl_power_vifs *vifs) |
601 | { | 578 | { |
602 | lockdep_assert_held(&mvm->mutex); | 579 | struct iwl_mvm_vif *bss_mvmvif = NULL; |
580 | struct iwl_mvm_vif *p2p_mvmvif = NULL; | ||
581 | struct iwl_mvm_vif *ap_mvmvif = NULL; | ||
582 | bool client_same_channel = false; | ||
583 | bool ap_same_channel = false; | ||
603 | 584 | ||
604 | if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM) { | 585 | lockdep_assert_held(&mvm->mutex); |
605 | constraint->pm_disabled = true; | ||
606 | constraint->ps_disabled = true; | ||
607 | } | ||
608 | 586 | ||
587 | /* get vifs info + set pm_enable to false */ | ||
609 | ieee80211_iterate_active_interfaces_atomic(mvm->hw, | 588 | ieee80211_iterate_active_interfaces_atomic(mvm->hw, |
610 | IEEE80211_IFACE_ITER_NORMAL, | 589 | IEEE80211_IFACE_ITER_NORMAL, |
611 | iwl_mvm_power_iterator, constraint); | 590 | iwl_mvm_power_iterator, vifs); |
612 | } | ||
613 | |||
614 | int iwl_mvm_power_update_mac(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | ||
615 | { | ||
616 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
617 | struct iwl_power_constraint constraint = { | ||
618 | .p2p_phyctx_id = MAX_PHYS, | ||
619 | .bss_phyctx_id = MAX_PHYS, | ||
620 | .mvm = mvm, | ||
621 | }; | ||
622 | bool ba_enable; | ||
623 | int ret; | ||
624 | 591 | ||
625 | lockdep_assert_held(&mvm->mutex); | 592 | if (vifs->bss_vif) |
593 | bss_mvmvif = iwl_mvm_vif_from_mac80211(vifs->bss_vif); | ||
626 | 594 | ||
627 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PM_CMD_SUPPORT)) | 595 | if (vifs->p2p_vif) |
628 | return 0; | 596 | p2p_mvmvif = iwl_mvm_vif_from_mac80211(vifs->p2p_vif); |
629 | 597 | ||
630 | iwl_mvm_power_get_global_constraint(mvm, &constraint); | 598 | if (vifs->ap_vif) |
631 | mvm->ps_disabled = constraint.ps_disabled; | 599 | ap_mvmvif = iwl_mvm_vif_from_mac80211(vifs->ap_vif); |
632 | mvm->pm_disabled = constraint.pm_disabled; | ||
633 | 600 | ||
634 | /* don't update device power state unless we add / remove monitor */ | 601 | /* enable PM on bss if bss stand alone */ |
635 | if (vif->type == NL80211_IFTYPE_MONITOR) { | 602 | if (vifs->bss_active && !vifs->p2p_active && !vifs->ap_active) { |
636 | ret = iwl_mvm_power_update_device(mvm); | 603 | bss_mvmvif->pm_enabled = true; |
637 | if (ret) | 604 | return; |
638 | return ret; | ||
639 | } | 605 | } |
640 | 606 | ||
641 | if (constraint.bss_vif) { | 607 | /* enable PM on p2p if p2p stand alone */ |
642 | ret = iwl_mvm_power_send_cmd(mvm, constraint.bss_vif); | 608 | if (vifs->p2p_active && !vifs->bss_active && !vifs->ap_active) { |
643 | if (ret) | 609 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PM) |
644 | return ret; | 610 | p2p_mvmvif->pm_enabled = true; |
611 | return; | ||
645 | } | 612 | } |
646 | 613 | ||
647 | if (constraint.p2p_vif) { | 614 | if (vifs->bss_active && vifs->p2p_active) |
648 | ret = iwl_mvm_power_send_cmd(mvm, constraint.p2p_vif); | 615 | client_same_channel = (bss_mvmvif->phy_ctxt->id == |
649 | if (ret) | 616 | p2p_mvmvif->phy_ctxt->id); |
650 | return ret; | 617 | if (vifs->bss_active && vifs->ap_active) |
618 | ap_same_channel = (bss_mvmvif->phy_ctxt->id == | ||
619 | ap_mvmvif->phy_ctxt->id); | ||
620 | |||
621 | /* clients are not stand alone: enable PM if DCM */ | ||
622 | if (!(client_same_channel || ap_same_channel) && | ||
623 | (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM)) { | ||
624 | if (vifs->bss_active) | ||
625 | bss_mvmvif->pm_enabled = true; | ||
626 | if (vifs->p2p_active && | ||
627 | (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PM)) | ||
628 | p2p_mvmvif->pm_enabled = true; | ||
629 | return; | ||
651 | } | 630 | } |
652 | 631 | ||
653 | if (!constraint.bf_vif) | 632 | /* |
654 | return 0; | 633 | * There is only one channel in the system and there are only |
655 | 634 | * bss and p2p clients that share it | |
656 | vif = constraint.bf_vif; | 635 | */ |
657 | mvmvif = iwl_mvm_vif_from_mac80211(vif); | 636 | if (client_same_channel && !vifs->ap_active && |
658 | 637 | (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_SCM)) { | |
659 | ba_enable = !(constraint.pm_disabled || constraint.ps_disabled || | 638 | /* share same channel*/ |
660 | !vif->bss_conf.ps || iwl_mvm_vif_low_latency(mvmvif)); | 639 | bss_mvmvif->pm_enabled = true; |
661 | 640 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PM) | |
662 | return iwl_mvm_update_beacon_abort(mvm, constraint.bf_vif, ba_enable); | 641 | p2p_mvmvif->pm_enabled = true; |
642 | } | ||
663 | } | 643 | } |
664 | 644 | ||
665 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 645 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
@@ -671,19 +651,10 @@ int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, | |||
671 | struct iwl_mac_power_cmd cmd = {}; | 651 | struct iwl_mac_power_cmd cmd = {}; |
672 | int pos = 0; | 652 | int pos = 0; |
673 | 653 | ||
674 | if (WARN_ON(!(mvm->fw->ucode_capa.flags & | ||
675 | IWL_UCODE_TLV_FLAGS_PM_CMD_SUPPORT))) | ||
676 | return 0; | ||
677 | |||
678 | mutex_lock(&mvm->mutex); | 654 | mutex_lock(&mvm->mutex); |
679 | memcpy(&cmd, &mvmvif->mac_pwr_cmd, sizeof(cmd)); | 655 | memcpy(&cmd, &mvmvif->mac_pwr_cmd, sizeof(cmd)); |
680 | mutex_unlock(&mvm->mutex); | 656 | mutex_unlock(&mvm->mutex); |
681 | 657 | ||
682 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD)) | ||
683 | pos += scnprintf(buf+pos, bufsz-pos, "disable_power_off = %d\n", | ||
684 | (cmd.flags & | ||
685 | cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK)) ? | ||
686 | 0 : 1); | ||
687 | pos += scnprintf(buf+pos, bufsz-pos, "power_scheme = %d\n", | 658 | pos += scnprintf(buf+pos, bufsz-pos, "power_scheme = %d\n", |
688 | iwlmvm_mod_params.power_scheme); | 659 | iwlmvm_mod_params.power_scheme); |
689 | pos += scnprintf(buf+pos, bufsz-pos, "flags = 0x%x\n", | 660 | pos += scnprintf(buf+pos, bufsz-pos, "flags = 0x%x\n", |
@@ -790,7 +761,7 @@ static int _iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm, | |||
790 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 761 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
791 | int ret; | 762 | int ret; |
792 | 763 | ||
793 | if (mvmvif != mvm->bf_allowed_vif || | 764 | if (mvmvif != mvm->bf_allowed_vif || !vif->bss_conf.dtim_period || |
794 | vif->type != NL80211_IFTYPE_STATION || vif->p2p) | 765 | vif->type != NL80211_IFTYPE_STATION || vif->p2p) |
795 | return 0; | 766 | return 0; |
796 | 767 | ||
@@ -818,6 +789,26 @@ int iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm, | |||
818 | return _iwl_mvm_enable_beacon_filter(mvm, vif, &cmd, flags, false); | 789 | return _iwl_mvm_enable_beacon_filter(mvm, vif, &cmd, flags, false); |
819 | } | 790 | } |
820 | 791 | ||
792 | static int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm, | ||
793 | struct ieee80211_vif *vif, | ||
794 | bool enable) | ||
795 | { | ||
796 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
797 | struct iwl_beacon_filter_cmd cmd = { | ||
798 | IWL_BF_CMD_CONFIG_DEFAULTS, | ||
799 | .bf_enable_beacon_filter = cpu_to_le32(1), | ||
800 | }; | ||
801 | |||
802 | if (!mvmvif->bf_data.bf_enabled) | ||
803 | return 0; | ||
804 | |||
805 | if (mvm->cur_ucode == IWL_UCODE_WOWLAN) | ||
806 | cmd.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_D3); | ||
807 | |||
808 | mvmvif->bf_data.ba_enabled = enable; | ||
809 | return _iwl_mvm_enable_beacon_filter(mvm, vif, &cmd, 0, false); | ||
810 | } | ||
811 | |||
821 | int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm, | 812 | int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm, |
822 | struct ieee80211_vif *vif, | 813 | struct ieee80211_vif *vif, |
823 | u32 flags) | 814 | u32 flags) |
@@ -826,8 +817,7 @@ int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm, | |||
826 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 817 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
827 | int ret; | 818 | int ret; |
828 | 819 | ||
829 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BF_UPDATED) || | 820 | if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) |
830 | vif->type != NL80211_IFTYPE_STATION || vif->p2p) | ||
831 | return 0; | 821 | return 0; |
832 | 822 | ||
833 | ret = iwl_mvm_beacon_filter_send_cmd(mvm, &cmd, flags); | 823 | ret = iwl_mvm_beacon_filter_send_cmd(mvm, &cmd, flags); |
@@ -838,6 +828,55 @@ int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm, | |||
838 | return ret; | 828 | return ret; |
839 | } | 829 | } |
840 | 830 | ||
831 | int iwl_mvm_power_update_mac(struct iwl_mvm *mvm) | ||
832 | { | ||
833 | struct iwl_mvm_vif *mvmvif; | ||
834 | struct iwl_power_vifs vifs = {}; | ||
835 | bool ba_enable; | ||
836 | int ret; | ||
837 | |||
838 | lockdep_assert_held(&mvm->mutex); | ||
839 | |||
840 | iwl_mvm_power_set_pm(mvm, &vifs); | ||
841 | |||
842 | /* disable PS if CAM */ | ||
843 | if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM) { | ||
844 | mvm->ps_disabled = true; | ||
845 | } else { | ||
846 | /* don't update device power state unless we add / remove monitor */ | ||
847 | if (vifs.monitor_vif) { | ||
848 | if (vifs.monitor_active) | ||
849 | mvm->ps_disabled = true; | ||
850 | ret = iwl_mvm_power_update_device(mvm); | ||
851 | if (ret) | ||
852 | return ret; | ||
853 | } | ||
854 | } | ||
855 | |||
856 | if (vifs.bss_vif) { | ||
857 | ret = iwl_mvm_power_send_cmd(mvm, vifs.bss_vif); | ||
858 | if (ret) | ||
859 | return ret; | ||
860 | } | ||
861 | |||
862 | if (vifs.p2p_vif) { | ||
863 | ret = iwl_mvm_power_send_cmd(mvm, vifs.p2p_vif); | ||
864 | if (ret) | ||
865 | return ret; | ||
866 | } | ||
867 | |||
868 | if (!vifs.bf_vif) | ||
869 | return 0; | ||
870 | |||
871 | mvmvif = iwl_mvm_vif_from_mac80211(vifs.bf_vif); | ||
872 | |||
873 | ba_enable = !(!mvmvif->pm_enabled || mvm->ps_disabled || | ||
874 | !vifs.bf_vif->bss_conf.ps || | ||
875 | iwl_mvm_vif_low_latency(mvmvif)); | ||
876 | |||
877 | return iwl_mvm_update_beacon_abort(mvm, vifs.bf_vif, ba_enable); | ||
878 | } | ||
879 | |||
841 | int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm, | 880 | int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm, |
842 | struct ieee80211_vif *vif, | 881 | struct ieee80211_vif *vif, |
843 | bool enable, u32 flags) | 882 | bool enable, u32 flags) |
@@ -861,9 +900,10 @@ int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm, | |||
861 | if (WARN_ON(!dtimper_msec)) | 900 | if (WARN_ON(!dtimper_msec)) |
862 | return 0; | 901 | return 0; |
863 | 902 | ||
864 | cmd.flags |= | ||
865 | cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK); | ||
866 | cmd.skip_dtim_periods = 300 / dtimper_msec; | 903 | cmd.skip_dtim_periods = 300 / dtimper_msec; |
904 | if (cmd.skip_dtim_periods) | ||
905 | cmd.flags |= | ||
906 | cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK); | ||
867 | } | 907 | } |
868 | iwl_mvm_power_log(mvm, &cmd); | 908 | iwl_mvm_power_log(mvm, &cmd); |
869 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 909 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
@@ -894,33 +934,3 @@ int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm, | |||
894 | 934 | ||
895 | return ret; | 935 | return ret; |
896 | } | 936 | } |
897 | |||
898 | int iwl_mvm_update_beacon_filter(struct iwl_mvm *mvm, | ||
899 | struct ieee80211_vif *vif, | ||
900 | bool force, | ||
901 | u32 flags) | ||
902 | { | ||
903 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
904 | |||
905 | if (mvmvif != mvm->bf_allowed_vif) | ||
906 | return 0; | ||
907 | |||
908 | if (!mvmvif->bf_data.bf_enabled) { | ||
909 | /* disable beacon filtering explicitly if force is true */ | ||
910 | if (force) | ||
911 | return iwl_mvm_disable_beacon_filter(mvm, vif, flags); | ||
912 | return 0; | ||
913 | } | ||
914 | |||
915 | return iwl_mvm_enable_beacon_filter(mvm, vif, flags); | ||
916 | } | ||
917 | |||
918 | int iwl_power_legacy_set_cam_mode(struct iwl_mvm *mvm) | ||
919 | { | ||
920 | struct iwl_powertable_cmd cmd = { | ||
921 | .keep_alive_seconds = POWER_KEEP_ALIVE_PERIOD_SEC, | ||
922 | }; | ||
923 | |||
924 | return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_SYNC, | ||
925 | sizeof(cmd), &cmd); | ||
926 | } | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/quota.c b/drivers/net/wireless/iwlwifi/mvm/quota.c index 35e86e06dffd..ba68d7b84505 100644 --- a/drivers/net/wireless/iwlwifi/mvm/quota.c +++ b/drivers/net/wireless/iwlwifi/mvm/quota.c | |||
@@ -285,7 +285,7 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif) | |||
285 | 285 | ||
286 | iwl_mvm_adjust_quota_for_noa(mvm, &cmd); | 286 | iwl_mvm_adjust_quota_for_noa(mvm, &cmd); |
287 | 287 | ||
288 | ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC, | 288 | ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, 0, |
289 | sizeof(cmd), &cmd); | 289 | sizeof(cmd), &cmd); |
290 | if (ret) | 290 | if (ret) |
291 | IWL_ERR(mvm, "Failed to send quota: %d\n", ret); | 291 | IWL_ERR(mvm, "Failed to send quota: %d\n", ret); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c index e1c838899363..306a6caa4868 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/iwlwifi/mvm/rs.c | |||
@@ -211,7 +211,7 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
211 | .next_columns = { | 211 | .next_columns = { |
212 | RS_COLUMN_LEGACY_ANT_B, | 212 | RS_COLUMN_LEGACY_ANT_B, |
213 | RS_COLUMN_SISO_ANT_A, | 213 | RS_COLUMN_SISO_ANT_A, |
214 | RS_COLUMN_SISO_ANT_B, | 214 | RS_COLUMN_MIMO2, |
215 | RS_COLUMN_INVALID, | 215 | RS_COLUMN_INVALID, |
216 | RS_COLUMN_INVALID, | 216 | RS_COLUMN_INVALID, |
217 | RS_COLUMN_INVALID, | 217 | RS_COLUMN_INVALID, |
@@ -223,8 +223,8 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
223 | .ant = ANT_B, | 223 | .ant = ANT_B, |
224 | .next_columns = { | 224 | .next_columns = { |
225 | RS_COLUMN_LEGACY_ANT_A, | 225 | RS_COLUMN_LEGACY_ANT_A, |
226 | RS_COLUMN_SISO_ANT_A, | ||
227 | RS_COLUMN_SISO_ANT_B, | 226 | RS_COLUMN_SISO_ANT_B, |
227 | RS_COLUMN_MIMO2, | ||
228 | RS_COLUMN_INVALID, | 228 | RS_COLUMN_INVALID, |
229 | RS_COLUMN_INVALID, | 229 | RS_COLUMN_INVALID, |
230 | RS_COLUMN_INVALID, | 230 | RS_COLUMN_INVALID, |
@@ -238,10 +238,10 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
238 | RS_COLUMN_SISO_ANT_B, | 238 | RS_COLUMN_SISO_ANT_B, |
239 | RS_COLUMN_MIMO2, | 239 | RS_COLUMN_MIMO2, |
240 | RS_COLUMN_SISO_ANT_A_SGI, | 240 | RS_COLUMN_SISO_ANT_A_SGI, |
241 | RS_COLUMN_SISO_ANT_B_SGI, | ||
242 | RS_COLUMN_LEGACY_ANT_A, | 241 | RS_COLUMN_LEGACY_ANT_A, |
243 | RS_COLUMN_LEGACY_ANT_B, | 242 | RS_COLUMN_LEGACY_ANT_B, |
244 | RS_COLUMN_INVALID, | 243 | RS_COLUMN_INVALID, |
244 | RS_COLUMN_INVALID, | ||
245 | }, | 245 | }, |
246 | .checks = { | 246 | .checks = { |
247 | rs_siso_allow, | 247 | rs_siso_allow, |
@@ -254,10 +254,10 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
254 | RS_COLUMN_SISO_ANT_A, | 254 | RS_COLUMN_SISO_ANT_A, |
255 | RS_COLUMN_MIMO2, | 255 | RS_COLUMN_MIMO2, |
256 | RS_COLUMN_SISO_ANT_B_SGI, | 256 | RS_COLUMN_SISO_ANT_B_SGI, |
257 | RS_COLUMN_SISO_ANT_A_SGI, | ||
258 | RS_COLUMN_LEGACY_ANT_A, | 257 | RS_COLUMN_LEGACY_ANT_A, |
259 | RS_COLUMN_LEGACY_ANT_B, | 258 | RS_COLUMN_LEGACY_ANT_B, |
260 | RS_COLUMN_INVALID, | 259 | RS_COLUMN_INVALID, |
260 | RS_COLUMN_INVALID, | ||
261 | }, | 261 | }, |
262 | .checks = { | 262 | .checks = { |
263 | rs_siso_allow, | 263 | rs_siso_allow, |
@@ -271,10 +271,10 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
271 | RS_COLUMN_SISO_ANT_B_SGI, | 271 | RS_COLUMN_SISO_ANT_B_SGI, |
272 | RS_COLUMN_MIMO2_SGI, | 272 | RS_COLUMN_MIMO2_SGI, |
273 | RS_COLUMN_SISO_ANT_A, | 273 | RS_COLUMN_SISO_ANT_A, |
274 | RS_COLUMN_SISO_ANT_B, | ||
275 | RS_COLUMN_MIMO2, | ||
276 | RS_COLUMN_LEGACY_ANT_A, | 274 | RS_COLUMN_LEGACY_ANT_A, |
277 | RS_COLUMN_LEGACY_ANT_B, | 275 | RS_COLUMN_LEGACY_ANT_B, |
276 | RS_COLUMN_INVALID, | ||
277 | RS_COLUMN_INVALID, | ||
278 | }, | 278 | }, |
279 | .checks = { | 279 | .checks = { |
280 | rs_siso_allow, | 280 | rs_siso_allow, |
@@ -289,10 +289,10 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
289 | RS_COLUMN_SISO_ANT_A_SGI, | 289 | RS_COLUMN_SISO_ANT_A_SGI, |
290 | RS_COLUMN_MIMO2_SGI, | 290 | RS_COLUMN_MIMO2_SGI, |
291 | RS_COLUMN_SISO_ANT_B, | 291 | RS_COLUMN_SISO_ANT_B, |
292 | RS_COLUMN_SISO_ANT_A, | ||
293 | RS_COLUMN_MIMO2, | ||
294 | RS_COLUMN_LEGACY_ANT_A, | 292 | RS_COLUMN_LEGACY_ANT_A, |
295 | RS_COLUMN_LEGACY_ANT_B, | 293 | RS_COLUMN_LEGACY_ANT_B, |
294 | RS_COLUMN_INVALID, | ||
295 | RS_COLUMN_INVALID, | ||
296 | }, | 296 | }, |
297 | .checks = { | 297 | .checks = { |
298 | rs_siso_allow, | 298 | rs_siso_allow, |
@@ -304,12 +304,12 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
304 | .ant = ANT_AB, | 304 | .ant = ANT_AB, |
305 | .next_columns = { | 305 | .next_columns = { |
306 | RS_COLUMN_SISO_ANT_A, | 306 | RS_COLUMN_SISO_ANT_A, |
307 | RS_COLUMN_SISO_ANT_B, | ||
308 | RS_COLUMN_SISO_ANT_A_SGI, | ||
309 | RS_COLUMN_SISO_ANT_B_SGI, | ||
310 | RS_COLUMN_MIMO2_SGI, | 307 | RS_COLUMN_MIMO2_SGI, |
311 | RS_COLUMN_LEGACY_ANT_A, | 308 | RS_COLUMN_LEGACY_ANT_A, |
312 | RS_COLUMN_LEGACY_ANT_B, | 309 | RS_COLUMN_LEGACY_ANT_B, |
310 | RS_COLUMN_INVALID, | ||
311 | RS_COLUMN_INVALID, | ||
312 | RS_COLUMN_INVALID, | ||
313 | }, | 313 | }, |
314 | .checks = { | 314 | .checks = { |
315 | rs_mimo_allow, | 315 | rs_mimo_allow, |
@@ -321,12 +321,12 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
321 | .sgi = true, | 321 | .sgi = true, |
322 | .next_columns = { | 322 | .next_columns = { |
323 | RS_COLUMN_SISO_ANT_A_SGI, | 323 | RS_COLUMN_SISO_ANT_A_SGI, |
324 | RS_COLUMN_SISO_ANT_B_SGI, | ||
325 | RS_COLUMN_SISO_ANT_A, | ||
326 | RS_COLUMN_SISO_ANT_B, | ||
327 | RS_COLUMN_MIMO2, | 324 | RS_COLUMN_MIMO2, |
328 | RS_COLUMN_LEGACY_ANT_A, | 325 | RS_COLUMN_LEGACY_ANT_A, |
329 | RS_COLUMN_LEGACY_ANT_B, | 326 | RS_COLUMN_LEGACY_ANT_B, |
327 | RS_COLUMN_INVALID, | ||
328 | RS_COLUMN_INVALID, | ||
329 | RS_COLUMN_INVALID, | ||
330 | }, | 330 | }, |
331 | .checks = { | 331 | .checks = { |
332 | rs_mimo_allow, | 332 | rs_mimo_allow, |
@@ -527,6 +527,9 @@ static void rs_rate_scale_clear_tbl_windows(struct iwl_mvm *mvm, | |||
527 | IWL_DEBUG_RATE(mvm, "Clearing up window stats\n"); | 527 | IWL_DEBUG_RATE(mvm, "Clearing up window stats\n"); |
528 | for (i = 0; i < IWL_RATE_COUNT; i++) | 528 | for (i = 0; i < IWL_RATE_COUNT; i++) |
529 | rs_rate_scale_clear_window(&tbl->win[i]); | 529 | rs_rate_scale_clear_window(&tbl->win[i]); |
530 | |||
531 | for (i = 0; i < ARRAY_SIZE(tbl->tpc_win); i++) | ||
532 | rs_rate_scale_clear_window(&tbl->tpc_win[i]); | ||
530 | } | 533 | } |
531 | 534 | ||
532 | static inline u8 rs_is_valid_ant(u8 valid_antenna, u8 ant_type) | 535 | static inline u8 rs_is_valid_ant(u8 valid_antenna, u8 ant_type) |
@@ -656,17 +659,34 @@ static int _rs_collect_tx_data(struct iwl_scale_tbl_info *tbl, | |||
656 | return 0; | 659 | return 0; |
657 | } | 660 | } |
658 | 661 | ||
659 | static int rs_collect_tx_data(struct iwl_scale_tbl_info *tbl, | 662 | static int rs_collect_tx_data(struct iwl_lq_sta *lq_sta, |
660 | int scale_index, int attempts, int successes) | 663 | struct iwl_scale_tbl_info *tbl, |
664 | int scale_index, int attempts, int successes, | ||
665 | u8 reduced_txp) | ||
661 | { | 666 | { |
662 | struct iwl_rate_scale_data *window = NULL; | 667 | struct iwl_rate_scale_data *window = NULL; |
668 | int ret; | ||
663 | 669 | ||
664 | if (scale_index < 0 || scale_index >= IWL_RATE_COUNT) | 670 | if (scale_index < 0 || scale_index >= IWL_RATE_COUNT) |
665 | return -EINVAL; | 671 | return -EINVAL; |
666 | 672 | ||
673 | if (tbl->column != RS_COLUMN_INVALID) { | ||
674 | lq_sta->tx_stats[tbl->column][scale_index].total += attempts; | ||
675 | lq_sta->tx_stats[tbl->column][scale_index].success += successes; | ||
676 | } | ||
677 | |||
667 | /* Select window for current tx bit rate */ | 678 | /* Select window for current tx bit rate */ |
668 | window = &(tbl->win[scale_index]); | 679 | window = &(tbl->win[scale_index]); |
669 | 680 | ||
681 | ret = _rs_collect_tx_data(tbl, scale_index, attempts, successes, | ||
682 | window); | ||
683 | if (ret) | ||
684 | return ret; | ||
685 | |||
686 | if (WARN_ON_ONCE(reduced_txp > TPC_MAX_REDUCTION)) | ||
687 | return -EINVAL; | ||
688 | |||
689 | window = &tbl->tpc_win[reduced_txp]; | ||
670 | return _rs_collect_tx_data(tbl, scale_index, attempts, successes, | 690 | return _rs_collect_tx_data(tbl, scale_index, attempts, successes, |
671 | window); | 691 | window); |
672 | } | 692 | } |
@@ -1000,6 +1020,7 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband, | |||
1000 | u32 ucode_rate; | 1020 | u32 ucode_rate; |
1001 | struct rs_rate rate; | 1021 | struct rs_rate rate; |
1002 | struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; | 1022 | struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; |
1023 | u8 reduced_txp = (uintptr_t)info->status.status_driver_data[0]; | ||
1003 | 1024 | ||
1004 | /* Treat uninitialized rate scaling data same as non-existing. */ | 1025 | /* Treat uninitialized rate scaling data same as non-existing. */ |
1005 | if (!lq_sta) { | 1026 | if (!lq_sta) { |
@@ -1141,9 +1162,10 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband, | |||
1141 | if (info->flags & IEEE80211_TX_STAT_AMPDU) { | 1162 | if (info->flags & IEEE80211_TX_STAT_AMPDU) { |
1142 | ucode_rate = le32_to_cpu(table->rs_table[0]); | 1163 | ucode_rate = le32_to_cpu(table->rs_table[0]); |
1143 | rs_rate_from_ucode_rate(ucode_rate, info->band, &rate); | 1164 | rs_rate_from_ucode_rate(ucode_rate, info->band, &rate); |
1144 | rs_collect_tx_data(curr_tbl, rate.index, | 1165 | rs_collect_tx_data(lq_sta, curr_tbl, rate.index, |
1145 | info->status.ampdu_len, | 1166 | info->status.ampdu_len, |
1146 | info->status.ampdu_ack_len); | 1167 | info->status.ampdu_ack_len, |
1168 | reduced_txp); | ||
1147 | 1169 | ||
1148 | /* Update success/fail counts if not searching for new mode */ | 1170 | /* Update success/fail counts if not searching for new mode */ |
1149 | if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) { | 1171 | if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) { |
@@ -1176,8 +1198,9 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband, | |||
1176 | else | 1198 | else |
1177 | continue; | 1199 | continue; |
1178 | 1200 | ||
1179 | rs_collect_tx_data(tmp_tbl, rate.index, 1, | 1201 | rs_collect_tx_data(lq_sta, tmp_tbl, rate.index, 1, |
1180 | i < retries ? 0 : legacy_success); | 1202 | i < retries ? 0 : legacy_success, |
1203 | reduced_txp); | ||
1181 | } | 1204 | } |
1182 | 1205 | ||
1183 | /* Update success/fail counts if not searching for new mode */ | 1206 | /* Update success/fail counts if not searching for new mode */ |
@@ -1188,6 +1211,7 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband, | |||
1188 | } | 1211 | } |
1189 | /* The last TX rate is cached in lq_sta; it's set in if/else above */ | 1212 | /* The last TX rate is cached in lq_sta; it's set in if/else above */ |
1190 | lq_sta->last_rate_n_flags = ucode_rate; | 1213 | lq_sta->last_rate_n_flags = ucode_rate; |
1214 | IWL_DEBUG_RATE(mvm, "reduced txpower: %d\n", reduced_txp); | ||
1191 | done: | 1215 | done: |
1192 | /* See if there's a better rate or modulation mode to try. */ | 1216 | /* See if there's a better rate or modulation mode to try. */ |
1193 | if (sta && sta->supp_rates[sband->band]) | 1217 | if (sta && sta->supp_rates[sband->band]) |
@@ -1311,105 +1335,50 @@ static void rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta, | |||
1311 | tbl->expected_tpt = rs_get_expected_tpt_table(lq_sta, column, rate->bw); | 1335 | tbl->expected_tpt = rs_get_expected_tpt_table(lq_sta, column, rate->bw); |
1312 | } | 1336 | } |
1313 | 1337 | ||
1314 | /* | ||
1315 | * Find starting rate for new "search" high-throughput mode of modulation. | ||
1316 | * Goal is to find lowest expected rate (under perfect conditions) that is | ||
1317 | * above the current measured throughput of "active" mode, to give new mode | ||
1318 | * a fair chance to prove itself without too many challenges. | ||
1319 | * | ||
1320 | * This gets called when transitioning to more aggressive modulation | ||
1321 | * (i.e. legacy to SISO or MIMO, or SISO to MIMO), as well as less aggressive | ||
1322 | * (i.e. MIMO to SISO). When moving to MIMO, bit rate will typically need | ||
1323 | * to decrease to match "active" throughput. When moving from MIMO to SISO, | ||
1324 | * bit rate will typically need to increase, but not if performance was bad. | ||
1325 | */ | ||
1326 | static s32 rs_get_best_rate(struct iwl_mvm *mvm, | 1338 | static s32 rs_get_best_rate(struct iwl_mvm *mvm, |
1327 | struct iwl_lq_sta *lq_sta, | 1339 | struct iwl_lq_sta *lq_sta, |
1328 | struct iwl_scale_tbl_info *tbl, /* "search" */ | 1340 | struct iwl_scale_tbl_info *tbl, /* "search" */ |
1329 | u16 rate_mask, s8 index) | 1341 | unsigned long rate_mask, s8 index) |
1330 | { | 1342 | { |
1331 | /* "active" values */ | ||
1332 | struct iwl_scale_tbl_info *active_tbl = | 1343 | struct iwl_scale_tbl_info *active_tbl = |
1333 | &(lq_sta->lq_info[lq_sta->active_tbl]); | 1344 | &(lq_sta->lq_info[lq_sta->active_tbl]); |
1334 | s32 active_sr = active_tbl->win[index].success_ratio; | 1345 | s32 success_ratio = active_tbl->win[index].success_ratio; |
1335 | s32 active_tpt = active_tbl->expected_tpt[index]; | 1346 | u16 expected_current_tpt = active_tbl->expected_tpt[index]; |
1336 | /* expected "search" throughput */ | ||
1337 | const u16 *tpt_tbl = tbl->expected_tpt; | 1347 | const u16 *tpt_tbl = tbl->expected_tpt; |
1338 | |||
1339 | s32 new_rate, high, low, start_hi; | ||
1340 | u16 high_low; | 1348 | u16 high_low; |
1341 | s8 rate = index; | 1349 | u32 target_tpt; |
1342 | 1350 | int rate_idx; | |
1343 | new_rate = high = low = start_hi = IWL_RATE_INVALID; | ||
1344 | |||
1345 | while (1) { | ||
1346 | high_low = rs_get_adjacent_rate(mvm, rate, rate_mask, | ||
1347 | tbl->rate.type); | ||
1348 | |||
1349 | low = high_low & 0xff; | ||
1350 | high = (high_low >> 8) & 0xff; | ||
1351 | 1351 | ||
1352 | /* | 1352 | if (success_ratio > RS_SR_NO_DECREASE) { |
1353 | * Lower the "search" bit rate, to give new "search" mode | 1353 | target_tpt = 100 * expected_current_tpt; |
1354 | * approximately the same throughput as "active" if: | 1354 | IWL_DEBUG_RATE(mvm, |
1355 | * | 1355 | "SR %d high. Find rate exceeding EXPECTED_CURRENT %d\n", |
1356 | * 1) "Active" mode has been working modestly well (but not | 1356 | success_ratio, target_tpt); |
1357 | * great), and expected "search" throughput (under perfect | 1357 | } else { |
1358 | * conditions) at candidate rate is above the actual | 1358 | target_tpt = lq_sta->last_tpt; |
1359 | * measured "active" throughput (but less than expected | 1359 | IWL_DEBUG_RATE(mvm, |
1360 | * "active" throughput under perfect conditions). | 1360 | "SR %d not thag good. Find rate exceeding ACTUAL_TPT %d\n", |
1361 | * OR | 1361 | success_ratio, target_tpt); |
1362 | * 2) "Active" mode has been working perfectly or very well | 1362 | } |
1363 | * and expected "search" throughput (under perfect | ||
1364 | * conditions) at candidate rate is above expected | ||
1365 | * "active" throughput (under perfect conditions). | ||
1366 | */ | ||
1367 | if ((((100 * tpt_tbl[rate]) > lq_sta->last_tpt) && | ||
1368 | ((active_sr > RS_SR_FORCE_DECREASE) && | ||
1369 | (active_sr <= IWL_RATE_HIGH_TH) && | ||
1370 | (tpt_tbl[rate] <= active_tpt))) || | ||
1371 | ((active_sr >= IWL_RATE_SCALE_SWITCH) && | ||
1372 | (tpt_tbl[rate] > active_tpt))) { | ||
1373 | /* (2nd or later pass) | ||
1374 | * If we've already tried to raise the rate, and are | ||
1375 | * now trying to lower it, use the higher rate. */ | ||
1376 | if (start_hi != IWL_RATE_INVALID) { | ||
1377 | new_rate = start_hi; | ||
1378 | break; | ||
1379 | } | ||
1380 | |||
1381 | new_rate = rate; | ||
1382 | 1363 | ||
1383 | /* Loop again with lower rate */ | 1364 | rate_idx = find_first_bit(&rate_mask, BITS_PER_LONG); |
1384 | if (low != IWL_RATE_INVALID) | ||
1385 | rate = low; | ||
1386 | 1365 | ||
1387 | /* Lower rate not available, use the original */ | 1366 | while (rate_idx != IWL_RATE_INVALID) { |
1388 | else | 1367 | if (target_tpt < (100 * tpt_tbl[rate_idx])) |
1389 | break; | 1368 | break; |
1390 | |||
1391 | /* Else try to raise the "search" rate to match "active" */ | ||
1392 | } else { | ||
1393 | /* (2nd or later pass) | ||
1394 | * If we've already tried to lower the rate, and are | ||
1395 | * now trying to raise it, use the lower rate. */ | ||
1396 | if (new_rate != IWL_RATE_INVALID) | ||
1397 | break; | ||
1398 | 1369 | ||
1399 | /* Loop again with higher rate */ | 1370 | high_low = rs_get_adjacent_rate(mvm, rate_idx, rate_mask, |
1400 | else if (high != IWL_RATE_INVALID) { | 1371 | tbl->rate.type); |
1401 | start_hi = high; | ||
1402 | rate = high; | ||
1403 | 1372 | ||
1404 | /* Higher rate not available, use the original */ | 1373 | rate_idx = (high_low >> 8) & 0xff; |
1405 | } else { | ||
1406 | new_rate = rate; | ||
1407 | break; | ||
1408 | } | ||
1409 | } | ||
1410 | } | 1374 | } |
1411 | 1375 | ||
1412 | return new_rate; | 1376 | IWL_DEBUG_RATE(mvm, "Best rate found %d target_tp %d expected_new %d\n", |
1377 | rate_idx, target_tpt, | ||
1378 | rate_idx != IWL_RATE_INVALID ? | ||
1379 | 100 * tpt_tbl[rate_idx] : IWL_INVALID_VALUE); | ||
1380 | |||
1381 | return rate_idx; | ||
1413 | } | 1382 | } |
1414 | 1383 | ||
1415 | static u32 rs_bw_from_sta_bw(struct ieee80211_sta *sta) | 1384 | static u32 rs_bw_from_sta_bw(struct ieee80211_sta *sta) |
@@ -1584,7 +1553,7 @@ static enum rs_column rs_get_next_column(struct iwl_mvm *mvm, | |||
1584 | 1553 | ||
1585 | tpt = lq_sta->last_tpt / 100; | 1554 | tpt = lq_sta->last_tpt / 100; |
1586 | expected_tpt_tbl = rs_get_expected_tpt_table(lq_sta, next_col, | 1555 | expected_tpt_tbl = rs_get_expected_tpt_table(lq_sta, next_col, |
1587 | tbl->rate.bw); | 1556 | rs_bw_from_sta_bw(sta)); |
1588 | if (WARN_ON_ONCE(!expected_tpt_tbl)) | 1557 | if (WARN_ON_ONCE(!expected_tpt_tbl)) |
1589 | continue; | 1558 | continue; |
1590 | 1559 | ||
@@ -1625,7 +1594,7 @@ static int rs_switch_to_column(struct iwl_mvm *mvm, | |||
1625 | const struct rs_tx_column *curr_column = &rs_tx_columns[tbl->column]; | 1594 | const struct rs_tx_column *curr_column = &rs_tx_columns[tbl->column]; |
1626 | u32 sz = (sizeof(struct iwl_scale_tbl_info) - | 1595 | u32 sz = (sizeof(struct iwl_scale_tbl_info) - |
1627 | (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); | 1596 | (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); |
1628 | u16 rate_mask = 0; | 1597 | unsigned long rate_mask = 0; |
1629 | u32 rate_idx = 0; | 1598 | u32 rate_idx = 0; |
1630 | 1599 | ||
1631 | memcpy(search_tbl, tbl, sz); | 1600 | memcpy(search_tbl, tbl, sz); |
@@ -1667,7 +1636,7 @@ static int rs_switch_to_column(struct iwl_mvm *mvm, | |||
1667 | !(BIT(rate_idx) & rate_mask)) { | 1636 | !(BIT(rate_idx) & rate_mask)) { |
1668 | IWL_DEBUG_RATE(mvm, | 1637 | IWL_DEBUG_RATE(mvm, |
1669 | "can not switch with index %d" | 1638 | "can not switch with index %d" |
1670 | " rate mask %x\n", | 1639 | " rate mask %lx\n", |
1671 | rate_idx, rate_mask); | 1640 | rate_idx, rate_mask); |
1672 | 1641 | ||
1673 | goto err; | 1642 | goto err; |
@@ -1769,6 +1738,203 @@ out: | |||
1769 | return action; | 1738 | return action; |
1770 | } | 1739 | } |
1771 | 1740 | ||
1741 | static void rs_get_adjacent_txp(struct iwl_mvm *mvm, int index, | ||
1742 | int *weaker, int *stronger) | ||
1743 | { | ||
1744 | *weaker = index + TPC_TX_POWER_STEP; | ||
1745 | if (*weaker > TPC_MAX_REDUCTION) | ||
1746 | *weaker = TPC_INVALID; | ||
1747 | |||
1748 | *stronger = index - TPC_TX_POWER_STEP; | ||
1749 | if (*stronger < 0) | ||
1750 | *stronger = TPC_INVALID; | ||
1751 | } | ||
1752 | |||
1753 | static bool rs_tpc_allowed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | ||
1754 | struct rs_rate *rate, enum ieee80211_band band) | ||
1755 | { | ||
1756 | int index = rate->index; | ||
1757 | bool cam = (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM); | ||
1758 | bool sta_ps_disabled = (vif->type == NL80211_IFTYPE_STATION && | ||
1759 | !vif->bss_conf.ps); | ||
1760 | |||
1761 | IWL_DEBUG_RATE(mvm, "cam: %d sta_ps_disabled %d\n", | ||
1762 | cam, sta_ps_disabled); | ||
1763 | /* | ||
1764 | * allow tpc only if power management is enabled, or bt coex | ||
1765 | * activity grade allows it and we are on 2.4Ghz. | ||
1766 | */ | ||
1767 | if ((cam || sta_ps_disabled) && | ||
1768 | !iwl_mvm_bt_coex_is_tpc_allowed(mvm, band)) | ||
1769 | return false; | ||
1770 | |||
1771 | IWL_DEBUG_RATE(mvm, "check rate, table type: %d\n", rate->type); | ||
1772 | if (is_legacy(rate)) | ||
1773 | return index == IWL_RATE_54M_INDEX; | ||
1774 | if (is_ht(rate)) | ||
1775 | return index == IWL_RATE_MCS_7_INDEX; | ||
1776 | if (is_vht(rate)) | ||
1777 | return index == IWL_RATE_MCS_7_INDEX || | ||
1778 | index == IWL_RATE_MCS_8_INDEX || | ||
1779 | index == IWL_RATE_MCS_9_INDEX; | ||
1780 | |||
1781 | WARN_ON_ONCE(1); | ||
1782 | return false; | ||
1783 | } | ||
1784 | |||
1785 | enum tpc_action { | ||
1786 | TPC_ACTION_STAY, | ||
1787 | TPC_ACTION_DECREASE, | ||
1788 | TPC_ACTION_INCREASE, | ||
1789 | TPC_ACTION_NO_RESTIRCTION, | ||
1790 | }; | ||
1791 | |||
1792 | static enum tpc_action rs_get_tpc_action(struct iwl_mvm *mvm, | ||
1793 | s32 sr, int weak, int strong, | ||
1794 | int current_tpt, | ||
1795 | int weak_tpt, int strong_tpt) | ||
1796 | { | ||
1797 | /* stay until we have valid tpt */ | ||
1798 | if (current_tpt == IWL_INVALID_VALUE) { | ||
1799 | IWL_DEBUG_RATE(mvm, "no current tpt. stay.\n"); | ||
1800 | return TPC_ACTION_STAY; | ||
1801 | } | ||
1802 | |||
1803 | /* Too many failures, increase txp */ | ||
1804 | if (sr <= TPC_SR_FORCE_INCREASE || current_tpt == 0) { | ||
1805 | IWL_DEBUG_RATE(mvm, "increase txp because of weak SR\n"); | ||
1806 | return TPC_ACTION_NO_RESTIRCTION; | ||
1807 | } | ||
1808 | |||
1809 | /* try decreasing first if applicable */ | ||
1810 | if (weak != TPC_INVALID) { | ||
1811 | if (weak_tpt == IWL_INVALID_VALUE && | ||
1812 | (strong_tpt == IWL_INVALID_VALUE || | ||
1813 | current_tpt >= strong_tpt)) { | ||
1814 | IWL_DEBUG_RATE(mvm, | ||
1815 | "no weak txp measurement. decrease txp\n"); | ||
1816 | return TPC_ACTION_DECREASE; | ||
1817 | } | ||
1818 | |||
1819 | if (weak_tpt > current_tpt) { | ||
1820 | IWL_DEBUG_RATE(mvm, | ||
1821 | "lower txp has better tpt. decrease txp\n"); | ||
1822 | return TPC_ACTION_DECREASE; | ||
1823 | } | ||
1824 | } | ||
1825 | |||
1826 | /* next, increase if needed */ | ||
1827 | if (sr < TPC_SR_NO_INCREASE && strong != TPC_INVALID) { | ||
1828 | if (weak_tpt == IWL_INVALID_VALUE && | ||
1829 | strong_tpt != IWL_INVALID_VALUE && | ||
1830 | current_tpt < strong_tpt) { | ||
1831 | IWL_DEBUG_RATE(mvm, | ||
1832 | "higher txp has better tpt. increase txp\n"); | ||
1833 | return TPC_ACTION_INCREASE; | ||
1834 | } | ||
1835 | |||
1836 | if (weak_tpt < current_tpt && | ||
1837 | (strong_tpt == IWL_INVALID_VALUE || | ||
1838 | strong_tpt > current_tpt)) { | ||
1839 | IWL_DEBUG_RATE(mvm, | ||
1840 | "lower txp has worse tpt. increase txp\n"); | ||
1841 | return TPC_ACTION_INCREASE; | ||
1842 | } | ||
1843 | } | ||
1844 | |||
1845 | IWL_DEBUG_RATE(mvm, "no need to increase or decrease txp - stay\n"); | ||
1846 | return TPC_ACTION_STAY; | ||
1847 | } | ||
1848 | |||
1849 | static bool rs_tpc_perform(struct iwl_mvm *mvm, | ||
1850 | struct ieee80211_sta *sta, | ||
1851 | struct iwl_lq_sta *lq_sta, | ||
1852 | struct iwl_scale_tbl_info *tbl) | ||
1853 | { | ||
1854 | struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; | ||
1855 | struct ieee80211_vif *vif = mvm_sta->vif; | ||
1856 | struct ieee80211_chanctx_conf *chanctx_conf; | ||
1857 | enum ieee80211_band band; | ||
1858 | struct iwl_rate_scale_data *window; | ||
1859 | struct rs_rate *rate = &tbl->rate; | ||
1860 | enum tpc_action action; | ||
1861 | s32 sr; | ||
1862 | u8 cur = lq_sta->lq.reduced_tpc; | ||
1863 | int current_tpt; | ||
1864 | int weak, strong; | ||
1865 | int weak_tpt = IWL_INVALID_VALUE, strong_tpt = IWL_INVALID_VALUE; | ||
1866 | |||
1867 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
1868 | if (lq_sta->dbg_fixed_txp_reduction <= TPC_MAX_REDUCTION) { | ||
1869 | IWL_DEBUG_RATE(mvm, "fixed tpc: %d\n", | ||
1870 | lq_sta->dbg_fixed_txp_reduction); | ||
1871 | lq_sta->lq.reduced_tpc = lq_sta->dbg_fixed_txp_reduction; | ||
1872 | return cur != lq_sta->dbg_fixed_txp_reduction; | ||
1873 | } | ||
1874 | #endif | ||
1875 | |||
1876 | rcu_read_lock(); | ||
1877 | chanctx_conf = rcu_dereference(vif->chanctx_conf); | ||
1878 | if (WARN_ON(!chanctx_conf)) | ||
1879 | band = IEEE80211_NUM_BANDS; | ||
1880 | else | ||
1881 | band = chanctx_conf->def.chan->band; | ||
1882 | rcu_read_unlock(); | ||
1883 | |||
1884 | if (!rs_tpc_allowed(mvm, vif, rate, band)) { | ||
1885 | IWL_DEBUG_RATE(mvm, | ||
1886 | "tpc is not allowed. remove txp restrictions\n"); | ||
1887 | lq_sta->lq.reduced_tpc = TPC_NO_REDUCTION; | ||
1888 | return cur != TPC_NO_REDUCTION; | ||
1889 | } | ||
1890 | |||
1891 | rs_get_adjacent_txp(mvm, cur, &weak, &strong); | ||
1892 | |||
1893 | /* Collect measured throughputs for current and adjacent rates */ | ||
1894 | window = tbl->tpc_win; | ||
1895 | sr = window[cur].success_ratio; | ||
1896 | current_tpt = window[cur].average_tpt; | ||
1897 | if (weak != TPC_INVALID) | ||
1898 | weak_tpt = window[weak].average_tpt; | ||
1899 | if (strong != TPC_INVALID) | ||
1900 | strong_tpt = window[strong].average_tpt; | ||
1901 | |||
1902 | IWL_DEBUG_RATE(mvm, | ||
1903 | "(TPC: %d): cur_tpt %d SR %d weak %d strong %d weak_tpt %d strong_tpt %d\n", | ||
1904 | cur, current_tpt, sr, weak, strong, | ||
1905 | weak_tpt, strong_tpt); | ||
1906 | |||
1907 | action = rs_get_tpc_action(mvm, sr, weak, strong, | ||
1908 | current_tpt, weak_tpt, strong_tpt); | ||
1909 | |||
1910 | /* override actions if we are on the edge */ | ||
1911 | if (weak == TPC_INVALID && action == TPC_ACTION_DECREASE) { | ||
1912 | IWL_DEBUG_RATE(mvm, "already in lowest txp, stay\n"); | ||
1913 | action = TPC_ACTION_STAY; | ||
1914 | } else if (strong == TPC_INVALID && | ||
1915 | (action == TPC_ACTION_INCREASE || | ||
1916 | action == TPC_ACTION_NO_RESTIRCTION)) { | ||
1917 | IWL_DEBUG_RATE(mvm, "already in highest txp, stay\n"); | ||
1918 | action = TPC_ACTION_STAY; | ||
1919 | } | ||
1920 | |||
1921 | switch (action) { | ||
1922 | case TPC_ACTION_DECREASE: | ||
1923 | lq_sta->lq.reduced_tpc = weak; | ||
1924 | return true; | ||
1925 | case TPC_ACTION_INCREASE: | ||
1926 | lq_sta->lq.reduced_tpc = strong; | ||
1927 | return true; | ||
1928 | case TPC_ACTION_NO_RESTIRCTION: | ||
1929 | lq_sta->lq.reduced_tpc = TPC_NO_REDUCTION; | ||
1930 | return true; | ||
1931 | case TPC_ACTION_STAY: | ||
1932 | /* do nothing */ | ||
1933 | break; | ||
1934 | } | ||
1935 | return false; | ||
1936 | } | ||
1937 | |||
1772 | /* | 1938 | /* |
1773 | * Do rate scaling and search for new modulation mode. | 1939 | * Do rate scaling and search for new modulation mode. |
1774 | */ | 1940 | */ |
@@ -2019,6 +2185,9 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm, | |||
2019 | break; | 2185 | break; |
2020 | case RS_ACTION_STAY: | 2186 | case RS_ACTION_STAY: |
2021 | /* No change */ | 2187 | /* No change */ |
2188 | if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) | ||
2189 | update_lq = rs_tpc_perform(mvm, sta, lq_sta, tbl); | ||
2190 | break; | ||
2022 | default: | 2191 | default: |
2023 | break; | 2192 | break; |
2024 | } | 2193 | } |
@@ -2271,10 +2440,6 @@ static void rs_vht_set_enabled_rates(struct ieee80211_sta *sta, | |||
2271 | if (i == IWL_RATE_9M_INDEX) | 2440 | if (i == IWL_RATE_9M_INDEX) |
2272 | continue; | 2441 | continue; |
2273 | 2442 | ||
2274 | /* Disable MCS9 as a workaround */ | ||
2275 | if (i == IWL_RATE_MCS_9_INDEX) | ||
2276 | continue; | ||
2277 | |||
2278 | /* VHT MCS9 isn't valid for 20Mhz for NSS=1,2 */ | 2443 | /* VHT MCS9 isn't valid for 20Mhz for NSS=1,2 */ |
2279 | if (i == IWL_RATE_MCS_9_INDEX && | 2444 | if (i == IWL_RATE_MCS_9_INDEX && |
2280 | sta->bandwidth == IEEE80211_STA_RX_BW_20) | 2445 | sta->bandwidth == IEEE80211_STA_RX_BW_20) |
@@ -2293,10 +2458,6 @@ static void rs_vht_set_enabled_rates(struct ieee80211_sta *sta, | |||
2293 | if (i == IWL_RATE_9M_INDEX) | 2458 | if (i == IWL_RATE_9M_INDEX) |
2294 | continue; | 2459 | continue; |
2295 | 2460 | ||
2296 | /* Disable MCS9 as a workaround */ | ||
2297 | if (i == IWL_RATE_MCS_9_INDEX) | ||
2298 | continue; | ||
2299 | |||
2300 | /* VHT MCS9 isn't valid for 20Mhz for NSS=1,2 */ | 2461 | /* VHT MCS9 isn't valid for 20Mhz for NSS=1,2 */ |
2301 | if (i == IWL_RATE_MCS_9_INDEX && | 2462 | if (i == IWL_RATE_MCS_9_INDEX && |
2302 | sta->bandwidth == IEEE80211_STA_RX_BW_20) | 2463 | sta->bandwidth == IEEE80211_STA_RX_BW_20) |
@@ -2478,6 +2639,7 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
2478 | lq_sta->is_agg = 0; | 2639 | lq_sta->is_agg = 0; |
2479 | #ifdef CONFIG_MAC80211_DEBUGFS | 2640 | #ifdef CONFIG_MAC80211_DEBUGFS |
2480 | lq_sta->dbg_fixed_rate = 0; | 2641 | lq_sta->dbg_fixed_rate = 0; |
2642 | lq_sta->dbg_fixed_txp_reduction = TPC_INVALID; | ||
2481 | #endif | 2643 | #endif |
2482 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 2644 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
2483 | iwl_mvm_reset_frame_stats(mvm, &mvm->drv_rx_stats); | 2645 | iwl_mvm_reset_frame_stats(mvm, &mvm->drv_rx_stats); |
@@ -2653,6 +2815,7 @@ static void rs_fill_lq_cmd(struct iwl_mvm *mvm, | |||
2653 | rs_build_rates_table_from_fixed(mvm, lq_cmd, | 2815 | rs_build_rates_table_from_fixed(mvm, lq_cmd, |
2654 | lq_sta->band, | 2816 | lq_sta->band, |
2655 | lq_sta->dbg_fixed_rate); | 2817 | lq_sta->dbg_fixed_rate); |
2818 | lq_cmd->reduced_tpc = 0; | ||
2656 | ant = (lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK) >> | 2819 | ant = (lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK) >> |
2657 | RATE_MCS_ANT_POS; | 2820 | RATE_MCS_ANT_POS; |
2658 | } else | 2821 | } else |
@@ -2783,7 +2946,6 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, | |||
2783 | size_t buf_size; | 2946 | size_t buf_size; |
2784 | u32 parsed_rate; | 2947 | u32 parsed_rate; |
2785 | 2948 | ||
2786 | |||
2787 | mvm = lq_sta->drv; | 2949 | mvm = lq_sta->drv; |
2788 | memset(buf, 0, sizeof(buf)); | 2950 | memset(buf, 0, sizeof(buf)); |
2789 | buf_size = min(count, sizeof(buf) - 1); | 2951 | buf_size = min(count, sizeof(buf) - 1); |
@@ -2856,6 +3018,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, | |||
2856 | lq_sta->lq.agg_disable_start_th, | 3018 | lq_sta->lq.agg_disable_start_th, |
2857 | lq_sta->lq.agg_frame_cnt_limit); | 3019 | lq_sta->lq.agg_frame_cnt_limit); |
2858 | 3020 | ||
3021 | desc += sprintf(buff+desc, "reduced tpc=%d\n", lq_sta->lq.reduced_tpc); | ||
2859 | desc += sprintf(buff+desc, | 3022 | desc += sprintf(buff+desc, |
2860 | "Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x\n", | 3023 | "Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x\n", |
2861 | lq_sta->lq.initial_rate_index[0], | 3024 | lq_sta->lq.initial_rate_index[0], |
@@ -2928,6 +3091,94 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = { | |||
2928 | .llseek = default_llseek, | 3091 | .llseek = default_llseek, |
2929 | }; | 3092 | }; |
2930 | 3093 | ||
3094 | static ssize_t rs_sta_dbgfs_drv_tx_stats_read(struct file *file, | ||
3095 | char __user *user_buf, | ||
3096 | size_t count, loff_t *ppos) | ||
3097 | { | ||
3098 | static const char * const column_name[] = { | ||
3099 | [RS_COLUMN_LEGACY_ANT_A] = "LEGACY_ANT_A", | ||
3100 | [RS_COLUMN_LEGACY_ANT_B] = "LEGACY_ANT_B", | ||
3101 | [RS_COLUMN_SISO_ANT_A] = "SISO_ANT_A", | ||
3102 | [RS_COLUMN_SISO_ANT_B] = "SISO_ANT_B", | ||
3103 | [RS_COLUMN_SISO_ANT_A_SGI] = "SISO_ANT_A_SGI", | ||
3104 | [RS_COLUMN_SISO_ANT_B_SGI] = "SISO_ANT_B_SGI", | ||
3105 | [RS_COLUMN_MIMO2] = "MIMO2", | ||
3106 | [RS_COLUMN_MIMO2_SGI] = "MIMO2_SGI", | ||
3107 | }; | ||
3108 | |||
3109 | static const char * const rate_name[] = { | ||
3110 | [IWL_RATE_1M_INDEX] = "1M", | ||
3111 | [IWL_RATE_2M_INDEX] = "2M", | ||
3112 | [IWL_RATE_5M_INDEX] = "5.5M", | ||
3113 | [IWL_RATE_11M_INDEX] = "11M", | ||
3114 | [IWL_RATE_6M_INDEX] = "6M|MCS0", | ||
3115 | [IWL_RATE_9M_INDEX] = "9M", | ||
3116 | [IWL_RATE_12M_INDEX] = "12M|MCS1", | ||
3117 | [IWL_RATE_18M_INDEX] = "18M|MCS2", | ||
3118 | [IWL_RATE_24M_INDEX] = "24M|MCS3", | ||
3119 | [IWL_RATE_36M_INDEX] = "36M|MCS4", | ||
3120 | [IWL_RATE_48M_INDEX] = "48M|MCS5", | ||
3121 | [IWL_RATE_54M_INDEX] = "54M|MCS6", | ||
3122 | [IWL_RATE_MCS_7_INDEX] = "MCS7", | ||
3123 | [IWL_RATE_MCS_8_INDEX] = "MCS8", | ||
3124 | [IWL_RATE_MCS_9_INDEX] = "MCS9", | ||
3125 | }; | ||
3126 | |||
3127 | char *buff, *pos, *endpos; | ||
3128 | int col, rate; | ||
3129 | ssize_t ret; | ||
3130 | struct iwl_lq_sta *lq_sta = file->private_data; | ||
3131 | struct rs_rate_stats *stats; | ||
3132 | static const size_t bufsz = 1024; | ||
3133 | |||
3134 | buff = kmalloc(bufsz, GFP_KERNEL); | ||
3135 | if (!buff) | ||
3136 | return -ENOMEM; | ||
3137 | |||
3138 | pos = buff; | ||
3139 | endpos = pos + bufsz; | ||
3140 | |||
3141 | pos += scnprintf(pos, endpos - pos, "COLUMN,"); | ||
3142 | for (rate = 0; rate < IWL_RATE_COUNT; rate++) | ||
3143 | pos += scnprintf(pos, endpos - pos, "%s,", rate_name[rate]); | ||
3144 | pos += scnprintf(pos, endpos - pos, "\n"); | ||
3145 | |||
3146 | for (col = 0; col < RS_COLUMN_COUNT; col++) { | ||
3147 | pos += scnprintf(pos, endpos - pos, | ||
3148 | "%s,", column_name[col]); | ||
3149 | |||
3150 | for (rate = 0; rate < IWL_RATE_COUNT; rate++) { | ||
3151 | stats = &(lq_sta->tx_stats[col][rate]); | ||
3152 | pos += scnprintf(pos, endpos - pos, | ||
3153 | "%llu/%llu,", | ||
3154 | stats->success, | ||
3155 | stats->total); | ||
3156 | } | ||
3157 | pos += scnprintf(pos, endpos - pos, "\n"); | ||
3158 | } | ||
3159 | |||
3160 | ret = simple_read_from_buffer(user_buf, count, ppos, buff, pos - buff); | ||
3161 | kfree(buff); | ||
3162 | return ret; | ||
3163 | } | ||
3164 | |||
3165 | static ssize_t rs_sta_dbgfs_drv_tx_stats_write(struct file *file, | ||
3166 | const char __user *user_buf, | ||
3167 | size_t count, loff_t *ppos) | ||
3168 | { | ||
3169 | struct iwl_lq_sta *lq_sta = file->private_data; | ||
3170 | memset(lq_sta->tx_stats, 0, sizeof(lq_sta->tx_stats)); | ||
3171 | |||
3172 | return count; | ||
3173 | } | ||
3174 | |||
3175 | static const struct file_operations rs_sta_dbgfs_drv_tx_stats_ops = { | ||
3176 | .read = rs_sta_dbgfs_drv_tx_stats_read, | ||
3177 | .write = rs_sta_dbgfs_drv_tx_stats_write, | ||
3178 | .open = simple_open, | ||
3179 | .llseek = default_llseek, | ||
3180 | }; | ||
3181 | |||
2931 | static void rs_add_debugfs(void *mvm, void *mvm_sta, struct dentry *dir) | 3182 | static void rs_add_debugfs(void *mvm, void *mvm_sta, struct dentry *dir) |
2932 | { | 3183 | { |
2933 | struct iwl_lq_sta *lq_sta = mvm_sta; | 3184 | struct iwl_lq_sta *lq_sta = mvm_sta; |
@@ -2937,9 +3188,15 @@ static void rs_add_debugfs(void *mvm, void *mvm_sta, struct dentry *dir) | |||
2937 | lq_sta->rs_sta_dbgfs_stats_table_file = | 3188 | lq_sta->rs_sta_dbgfs_stats_table_file = |
2938 | debugfs_create_file("rate_stats_table", S_IRUSR, dir, | 3189 | debugfs_create_file("rate_stats_table", S_IRUSR, dir, |
2939 | lq_sta, &rs_sta_dbgfs_stats_table_ops); | 3190 | lq_sta, &rs_sta_dbgfs_stats_table_ops); |
3191 | lq_sta->rs_sta_dbgfs_drv_tx_stats_file = | ||
3192 | debugfs_create_file("drv_tx_stats", S_IRUSR | S_IWUSR, dir, | ||
3193 | lq_sta, &rs_sta_dbgfs_drv_tx_stats_ops); | ||
2940 | lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file = | 3194 | lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file = |
2941 | debugfs_create_u8("tx_agg_tid_enable", S_IRUSR | S_IWUSR, dir, | 3195 | debugfs_create_u8("tx_agg_tid_enable", S_IRUSR | S_IWUSR, dir, |
2942 | &lq_sta->tx_agg_tid_en); | 3196 | &lq_sta->tx_agg_tid_en); |
3197 | lq_sta->rs_sta_dbgfs_reduced_txp_file = | ||
3198 | debugfs_create_u8("reduced_tpc", S_IRUSR | S_IWUSR, dir, | ||
3199 | &lq_sta->dbg_fixed_txp_reduction); | ||
2943 | } | 3200 | } |
2944 | 3201 | ||
2945 | static void rs_remove_debugfs(void *mvm, void *mvm_sta) | 3202 | static void rs_remove_debugfs(void *mvm, void *mvm_sta) |
@@ -2947,7 +3204,9 @@ static void rs_remove_debugfs(void *mvm, void *mvm_sta) | |||
2947 | struct iwl_lq_sta *lq_sta = mvm_sta; | 3204 | struct iwl_lq_sta *lq_sta = mvm_sta; |
2948 | debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); | 3205 | debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); |
2949 | debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); | 3206 | debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); |
3207 | debugfs_remove(lq_sta->rs_sta_dbgfs_drv_tx_stats_file); | ||
2950 | debugfs_remove(lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file); | 3208 | debugfs_remove(lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file); |
3209 | debugfs_remove(lq_sta->rs_sta_dbgfs_reduced_txp_file); | ||
2951 | } | 3210 | } |
2952 | #endif | 3211 | #endif |
2953 | 3212 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.h b/drivers/net/wireless/iwlwifi/mvm/rs.h index 0acfac96a56c..374a83d7db25 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.h +++ b/drivers/net/wireless/iwlwifi/mvm/rs.h | |||
@@ -158,6 +158,13 @@ enum { | |||
158 | #define RS_SR_FORCE_DECREASE 1920 /* 15% */ | 158 | #define RS_SR_FORCE_DECREASE 1920 /* 15% */ |
159 | #define RS_SR_NO_DECREASE 10880 /* 85% */ | 159 | #define RS_SR_NO_DECREASE 10880 /* 85% */ |
160 | 160 | ||
161 | #define TPC_SR_FORCE_INCREASE 9600 /* 75% */ | ||
162 | #define TPC_SR_NO_INCREASE 10880 /* 85% */ | ||
163 | #define TPC_TX_POWER_STEP 3 | ||
164 | #define TPC_MAX_REDUCTION 15 | ||
165 | #define TPC_NO_REDUCTION 0 | ||
166 | #define TPC_INVALID 0xff | ||
167 | |||
161 | #define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ | 168 | #define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ |
162 | #define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000) | 169 | #define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000) |
163 | #define LINK_QUAL_AGG_TIME_LIMIT_MIN (100) | 170 | #define LINK_QUAL_AGG_TIME_LIMIT_MIN (100) |
@@ -266,9 +273,16 @@ enum rs_column { | |||
266 | RS_COLUMN_MIMO2_SGI, | 273 | RS_COLUMN_MIMO2_SGI, |
267 | 274 | ||
268 | RS_COLUMN_LAST = RS_COLUMN_MIMO2_SGI, | 275 | RS_COLUMN_LAST = RS_COLUMN_MIMO2_SGI, |
276 | RS_COLUMN_COUNT = RS_COLUMN_LAST + 1, | ||
269 | RS_COLUMN_INVALID, | 277 | RS_COLUMN_INVALID, |
270 | }; | 278 | }; |
271 | 279 | ||
280 | /* Packet stats per rate */ | ||
281 | struct rs_rate_stats { | ||
282 | u64 success; | ||
283 | u64 total; | ||
284 | }; | ||
285 | |||
272 | /** | 286 | /** |
273 | * struct iwl_scale_tbl_info -- tx params and success history for all rates | 287 | * struct iwl_scale_tbl_info -- tx params and success history for all rates |
274 | * | 288 | * |
@@ -280,6 +294,8 @@ struct iwl_scale_tbl_info { | |||
280 | enum rs_column column; | 294 | enum rs_column column; |
281 | const u16 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */ | 295 | const u16 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */ |
282 | struct iwl_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */ | 296 | struct iwl_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */ |
297 | /* per txpower-reduction history */ | ||
298 | struct iwl_rate_scale_data tpc_win[TPC_MAX_REDUCTION + 1]; | ||
283 | }; | 299 | }; |
284 | 300 | ||
285 | enum { | 301 | enum { |
@@ -315,6 +331,8 @@ struct iwl_lq_sta { | |||
315 | bool is_vht; | 331 | bool is_vht; |
316 | enum ieee80211_band band; | 332 | enum ieee80211_band band; |
317 | 333 | ||
334 | struct rs_rate_stats tx_stats[RS_COLUMN_COUNT][IWL_RATE_COUNT]; | ||
335 | |||
318 | /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ | 336 | /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ |
319 | unsigned long active_legacy_rate; | 337 | unsigned long active_legacy_rate; |
320 | unsigned long active_siso_rate; | 338 | unsigned long active_siso_rate; |
@@ -334,8 +352,11 @@ struct iwl_lq_sta { | |||
334 | #ifdef CONFIG_MAC80211_DEBUGFS | 352 | #ifdef CONFIG_MAC80211_DEBUGFS |
335 | struct dentry *rs_sta_dbgfs_scale_table_file; | 353 | struct dentry *rs_sta_dbgfs_scale_table_file; |
336 | struct dentry *rs_sta_dbgfs_stats_table_file; | 354 | struct dentry *rs_sta_dbgfs_stats_table_file; |
355 | struct dentry *rs_sta_dbgfs_drv_tx_stats_file; | ||
337 | struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file; | 356 | struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file; |
357 | struct dentry *rs_sta_dbgfs_reduced_txp_file; | ||
338 | u32 dbg_fixed_rate; | 358 | u32 dbg_fixed_rate; |
359 | u8 dbg_fixed_txp_reduction; | ||
339 | #endif | 360 | #endif |
340 | struct iwl_mvm *drv; | 361 | struct iwl_mvm *drv; |
341 | 362 | ||
@@ -345,6 +366,9 @@ struct iwl_lq_sta { | |||
345 | u32 last_rate_n_flags; | 366 | u32 last_rate_n_flags; |
346 | /* packets destined for this STA are aggregated */ | 367 | /* packets destined for this STA are aggregated */ |
347 | u8 is_agg; | 368 | u8 is_agg; |
369 | |||
370 | /* tx power reduce for this sta */ | ||
371 | int tpc_reduce; | ||
348 | }; | 372 | }; |
349 | 373 | ||
350 | /* Initialize station's rate scaling information after adding station */ | 374 | /* Initialize station's rate scaling information after adding station */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rx.c b/drivers/net/wireless/iwlwifi/mvm/rx.c index 6061553a5e44..cf7276967acd 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/iwlwifi/mvm/rx.c | |||
@@ -60,7 +60,6 @@ | |||
60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
61 | *****************************************************************************/ | 61 | *****************************************************************************/ |
62 | #include "iwl-trans.h" | 62 | #include "iwl-trans.h" |
63 | |||
64 | #include "mvm.h" | 63 | #include "mvm.h" |
65 | #include "fw-api.h" | 64 | #include "fw-api.h" |
66 | 65 | ||
@@ -130,42 +129,7 @@ static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm, | |||
130 | 129 | ||
131 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); | 130 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); |
132 | 131 | ||
133 | ieee80211_rx_ni(mvm->hw, skb); | 132 | ieee80211_rx(mvm->hw, skb); |
134 | } | ||
135 | |||
136 | static void iwl_mvm_calc_rssi(struct iwl_mvm *mvm, | ||
137 | struct iwl_rx_phy_info *phy_info, | ||
138 | struct ieee80211_rx_status *rx_status) | ||
139 | { | ||
140 | int rssi_a, rssi_b, rssi_a_dbm, rssi_b_dbm, max_rssi_dbm; | ||
141 | u32 agc_a, agc_b; | ||
142 | u32 val; | ||
143 | |||
144 | val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_AGC_IDX]); | ||
145 | agc_a = (val & IWL_OFDM_AGC_A_MSK) >> IWL_OFDM_AGC_A_POS; | ||
146 | agc_b = (val & IWL_OFDM_AGC_B_MSK) >> IWL_OFDM_AGC_B_POS; | ||
147 | |||
148 | val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_RSSI_AB_IDX]); | ||
149 | rssi_a = (val & IWL_OFDM_RSSI_INBAND_A_MSK) >> IWL_OFDM_RSSI_A_POS; | ||
150 | rssi_b = (val & IWL_OFDM_RSSI_INBAND_B_MSK) >> IWL_OFDM_RSSI_B_POS; | ||
151 | |||
152 | /* | ||
153 | * dBm = rssi dB - agc dB - constant. | ||
154 | * Higher AGC (higher radio gain) means lower signal. | ||
155 | */ | ||
156 | rssi_a_dbm = rssi_a - IWL_RSSI_OFFSET - agc_a; | ||
157 | rssi_b_dbm = rssi_b - IWL_RSSI_OFFSET - agc_b; | ||
158 | max_rssi_dbm = max_t(int, rssi_a_dbm, rssi_b_dbm); | ||
159 | |||
160 | IWL_DEBUG_STATS(mvm, "Rssi In A %d B %d Max %d AGCA %d AGCB %d\n", | ||
161 | rssi_a_dbm, rssi_b_dbm, max_rssi_dbm, agc_a, agc_b); | ||
162 | |||
163 | rx_status->signal = max_rssi_dbm; | ||
164 | rx_status->chains = (le16_to_cpu(phy_info->phy_flags) & | ||
165 | RX_RES_PHY_FLAGS_ANTENNA) | ||
166 | >> RX_RES_PHY_FLAGS_ANTENNA_POS; | ||
167 | rx_status->chain_signal[0] = rssi_a_dbm; | ||
168 | rx_status->chain_signal[1] = rssi_b_dbm; | ||
169 | } | 133 | } |
170 | 134 | ||
171 | /* | 135 | /* |
@@ -337,10 +301,7 @@ int iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, | |||
337 | */ | 301 | */ |
338 | /*rx_status.flag |= RX_FLAG_MACTIME_MPDU;*/ | 302 | /*rx_status.flag |= RX_FLAG_MACTIME_MPDU;*/ |
339 | 303 | ||
340 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_RX_ENERGY_API) | 304 | iwl_mvm_get_signal_strength(mvm, phy_info, &rx_status); |
341 | iwl_mvm_get_signal_strength(mvm, phy_info, &rx_status); | ||
342 | else | ||
343 | iwl_mvm_calc_rssi(mvm, phy_info, &rx_status); | ||
344 | 305 | ||
345 | IWL_DEBUG_STATS_LIMIT(mvm, "Rssi %d, TSF %llu\n", rx_status.signal, | 306 | IWL_DEBUG_STATS_LIMIT(mvm, "Rssi %d, TSF %llu\n", rx_status.signal, |
346 | (unsigned long long)rx_status.mactime); | 307 | (unsigned long long)rx_status.mactime); |
@@ -394,6 +355,8 @@ int iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, | |||
394 | rx_status.rate_idx = rate_n_flags & RATE_VHT_MCS_RATE_CODE_MSK; | 355 | rx_status.rate_idx = rate_n_flags & RATE_VHT_MCS_RATE_CODE_MSK; |
395 | rx_status.flag |= RX_FLAG_VHT; | 356 | rx_status.flag |= RX_FLAG_VHT; |
396 | rx_status.flag |= stbc << RX_FLAG_STBC_SHIFT; | 357 | rx_status.flag |= stbc << RX_FLAG_STBC_SHIFT; |
358 | if (rate_n_flags & RATE_MCS_BF_MSK) | ||
359 | rx_status.vht_flag |= RX_VHT_FLAG_BF; | ||
397 | } else { | 360 | } else { |
398 | rx_status.rate_idx = | 361 | rx_status.rate_idx = |
399 | iwl_mvm_legacy_rate_to_mac80211_idx(rate_n_flags, | 362 | iwl_mvm_legacy_rate_to_mac80211_idx(rate_n_flags, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index c28de54c75d4..4b6c7d4bd199 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
@@ -306,7 +306,6 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm, | |||
306 | .id = SCAN_REQUEST_CMD, | 306 | .id = SCAN_REQUEST_CMD, |
307 | .len = { 0, }, | 307 | .len = { 0, }, |
308 | .data = { mvm->scan_cmd, }, | 308 | .data = { mvm->scan_cmd, }, |
309 | .flags = CMD_SYNC, | ||
310 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, | 309 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, |
311 | }; | 310 | }; |
312 | struct iwl_scan_cmd *cmd = mvm->scan_cmd; | 311 | struct iwl_scan_cmd *cmd = mvm->scan_cmd; |
@@ -319,7 +318,10 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm, | |||
319 | struct iwl_mvm_scan_params params = {}; | 318 | struct iwl_mvm_scan_params params = {}; |
320 | 319 | ||
321 | lockdep_assert_held(&mvm->mutex); | 320 | lockdep_assert_held(&mvm->mutex); |
322 | BUG_ON(mvm->scan_cmd == NULL); | 321 | |
322 | /* we should have failed registration if scan_cmd was NULL */ | ||
323 | if (WARN_ON(mvm->scan_cmd == NULL)) | ||
324 | return -ENOMEM; | ||
323 | 325 | ||
324 | IWL_DEBUG_SCAN(mvm, "Handling mac80211 scan request\n"); | 326 | IWL_DEBUG_SCAN(mvm, "Handling mac80211 scan request\n"); |
325 | mvm->scan_status = IWL_MVM_SCAN_OS; | 327 | mvm->scan_status = IWL_MVM_SCAN_OS; |
@@ -514,7 +516,7 @@ int iwl_mvm_cancel_scan(struct iwl_mvm *mvm) | |||
514 | ARRAY_SIZE(scan_abort_notif), | 516 | ARRAY_SIZE(scan_abort_notif), |
515 | iwl_mvm_scan_abort_notif, NULL); | 517 | iwl_mvm_scan_abort_notif, NULL); |
516 | 518 | ||
517 | ret = iwl_mvm_send_cmd_pdu(mvm, SCAN_ABORT_CMD, CMD_SYNC, 0, NULL); | 519 | ret = iwl_mvm_send_cmd_pdu(mvm, SCAN_ABORT_CMD, 0, 0, NULL); |
518 | if (ret) { | 520 | if (ret) { |
519 | IWL_ERR(mvm, "Couldn't send SCAN_ABORT_CMD: %d\n", ret); | 521 | IWL_ERR(mvm, "Couldn't send SCAN_ABORT_CMD: %d\n", ret); |
520 | /* mac80211's state will be cleaned in the nic_restart flow */ | 522 | /* mac80211's state will be cleaned in the nic_restart flow */ |
@@ -538,9 +540,13 @@ int iwl_mvm_rx_scan_offload_complete_notif(struct iwl_mvm *mvm, | |||
538 | /* scan status must be locked for proper checking */ | 540 | /* scan status must be locked for proper checking */ |
539 | lockdep_assert_held(&mvm->mutex); | 541 | lockdep_assert_held(&mvm->mutex); |
540 | 542 | ||
541 | IWL_DEBUG_SCAN(mvm, "Scheduled scan completed, status %s\n", | 543 | IWL_DEBUG_SCAN(mvm, |
544 | "Scheduled scan completed, status %s EBS status %s:%d\n", | ||
542 | scan_notif->status == IWL_SCAN_OFFLOAD_COMPLETED ? | 545 | scan_notif->status == IWL_SCAN_OFFLOAD_COMPLETED ? |
543 | "completed" : "aborted"); | 546 | "completed" : "aborted", scan_notif->ebs_status == |
547 | IWL_SCAN_EBS_SUCCESS ? "success" : "failed", | ||
548 | scan_notif->ebs_status); | ||
549 | |||
544 | 550 | ||
545 | /* only call mac80211 completion if the stop was initiated by FW */ | 551 | /* only call mac80211 completion if the stop was initiated by FW */ |
546 | if (mvm->scan_status == IWL_MVM_SCAN_SCHED) { | 552 | if (mvm->scan_status == IWL_MVM_SCAN_SCHED) { |
@@ -548,6 +554,8 @@ int iwl_mvm_rx_scan_offload_complete_notif(struct iwl_mvm *mvm, | |||
548 | ieee80211_sched_scan_stopped(mvm->hw); | 554 | ieee80211_sched_scan_stopped(mvm->hw); |
549 | } | 555 | } |
550 | 556 | ||
557 | mvm->last_ebs_successful = !scan_notif->ebs_status; | ||
558 | |||
551 | return 0; | 559 | return 0; |
552 | } | 560 | } |
553 | 561 | ||
@@ -740,7 +748,6 @@ int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm, | |||
740 | struct iwl_scan_offload_cfg *scan_cfg; | 748 | struct iwl_scan_offload_cfg *scan_cfg; |
741 | struct iwl_host_cmd cmd = { | 749 | struct iwl_host_cmd cmd = { |
742 | .id = SCAN_OFFLOAD_CONFIG_CMD, | 750 | .id = SCAN_OFFLOAD_CONFIG_CMD, |
743 | .flags = CMD_SYNC, | ||
744 | }; | 751 | }; |
745 | struct iwl_mvm_scan_params params = {}; | 752 | struct iwl_mvm_scan_params params = {}; |
746 | 753 | ||
@@ -798,7 +805,6 @@ int iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm, | |||
798 | struct iwl_scan_offload_blacklist *blacklist; | 805 | struct iwl_scan_offload_blacklist *blacklist; |
799 | struct iwl_host_cmd cmd = { | 806 | struct iwl_host_cmd cmd = { |
800 | .id = SCAN_OFFLOAD_UPDATE_PROFILES_CMD, | 807 | .id = SCAN_OFFLOAD_UPDATE_PROFILES_CMD, |
801 | .flags = CMD_SYNC, | ||
802 | .len[1] = sizeof(*profile_cfg), | 808 | .len[1] = sizeof(*profile_cfg), |
803 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, | 809 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, |
804 | .dataflags[1] = IWL_HCMD_DFL_NOCOPY, | 810 | .dataflags[1] = IWL_HCMD_DFL_NOCOPY, |
@@ -884,7 +890,12 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, | |||
884 | scan_req.flags |= cpu_to_le16(IWL_SCAN_OFFLOAD_FLAG_PASS_ALL); | 890 | scan_req.flags |= cpu_to_le16(IWL_SCAN_OFFLOAD_FLAG_PASS_ALL); |
885 | } | 891 | } |
886 | 892 | ||
887 | return iwl_mvm_send_cmd_pdu(mvm, SCAN_OFFLOAD_REQUEST_CMD, CMD_SYNC, | 893 | if (mvm->last_ebs_successful && |
894 | mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_EBS_SUPPORT) | ||
895 | scan_req.flags |= | ||
896 | cpu_to_le16(IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE); | ||
897 | |||
898 | return iwl_mvm_send_cmd_pdu(mvm, SCAN_OFFLOAD_REQUEST_CMD, 0, | ||
888 | sizeof(scan_req), &scan_req); | 899 | sizeof(scan_req), &scan_req); |
889 | } | 900 | } |
890 | 901 | ||
@@ -893,7 +904,6 @@ static int iwl_mvm_send_sched_scan_abort(struct iwl_mvm *mvm) | |||
893 | int ret; | 904 | int ret; |
894 | struct iwl_host_cmd cmd = { | 905 | struct iwl_host_cmd cmd = { |
895 | .id = SCAN_OFFLOAD_ABORT_CMD, | 906 | .id = SCAN_OFFLOAD_ABORT_CMD, |
896 | .flags = CMD_SYNC, | ||
897 | }; | 907 | }; |
898 | u32 status; | 908 | u32 status; |
899 | 909 | ||
@@ -922,7 +932,7 @@ static int iwl_mvm_send_sched_scan_abort(struct iwl_mvm *mvm) | |||
922 | return ret; | 932 | return ret; |
923 | } | 933 | } |
924 | 934 | ||
925 | int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm) | 935 | int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm, bool notify) |
926 | { | 936 | { |
927 | int ret; | 937 | int ret; |
928 | struct iwl_notification_wait wait_scan_done; | 938 | struct iwl_notification_wait wait_scan_done; |
@@ -960,5 +970,8 @@ int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm) | |||
960 | */ | 970 | */ |
961 | mvm->scan_status = IWL_MVM_SCAN_NONE; | 971 | mvm->scan_status = IWL_MVM_SCAN_NONE; |
962 | 972 | ||
973 | if (notify) | ||
974 | ieee80211_sched_scan_stopped(mvm->hw); | ||
975 | |||
963 | return 0; | 976 | return 0; |
964 | } | 977 | } |
diff --git a/drivers/net/wireless/iwlwifi/mvm/sf.c b/drivers/net/wireless/iwlwifi/mvm/sf.c index 88809b2d1654..7edfd15efc9d 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sf.c +++ b/drivers/net/wireless/iwlwifi/mvm/sf.c | |||
@@ -237,9 +237,6 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *changed_vif, | |||
237 | .sta_vif_ap_sta_id = IWL_MVM_STATION_COUNT, | 237 | .sta_vif_ap_sta_id = IWL_MVM_STATION_COUNT, |
238 | }; | 238 | }; |
239 | 239 | ||
240 | if (IWL_UCODE_API(mvm->fw->ucode_ver) < 8) | ||
241 | return 0; | ||
242 | |||
243 | /* | 240 | /* |
244 | * Ignore the call if we are in HW Restart flow, or if the handled | 241 | * Ignore the call if we are in HW Restart flow, or if the handled |
245 | * vif is a p2p device. | 242 | * vif is a p2p device. |
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c index f339ef884250..1fb01ea2e704 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/iwlwifi/mvm/sta.c | |||
@@ -66,115 +66,6 @@ | |||
66 | #include "sta.h" | 66 | #include "sta.h" |
67 | #include "rs.h" | 67 | #include "rs.h" |
68 | 68 | ||
69 | static void iwl_mvm_add_sta_cmd_v7_to_v5(struct iwl_mvm_add_sta_cmd_v7 *cmd_v7, | ||
70 | struct iwl_mvm_add_sta_cmd_v5 *cmd_v5) | ||
71 | { | ||
72 | memset(cmd_v5, 0, sizeof(*cmd_v5)); | ||
73 | |||
74 | cmd_v5->add_modify = cmd_v7->add_modify; | ||
75 | cmd_v5->tid_disable_tx = cmd_v7->tid_disable_tx; | ||
76 | cmd_v5->mac_id_n_color = cmd_v7->mac_id_n_color; | ||
77 | memcpy(cmd_v5->addr, cmd_v7->addr, ETH_ALEN); | ||
78 | cmd_v5->sta_id = cmd_v7->sta_id; | ||
79 | cmd_v5->modify_mask = cmd_v7->modify_mask; | ||
80 | cmd_v5->station_flags = cmd_v7->station_flags; | ||
81 | cmd_v5->station_flags_msk = cmd_v7->station_flags_msk; | ||
82 | cmd_v5->add_immediate_ba_tid = cmd_v7->add_immediate_ba_tid; | ||
83 | cmd_v5->remove_immediate_ba_tid = cmd_v7->remove_immediate_ba_tid; | ||
84 | cmd_v5->add_immediate_ba_ssn = cmd_v7->add_immediate_ba_ssn; | ||
85 | cmd_v5->sleep_tx_count = cmd_v7->sleep_tx_count; | ||
86 | cmd_v5->sleep_state_flags = cmd_v7->sleep_state_flags; | ||
87 | cmd_v5->assoc_id = cmd_v7->assoc_id; | ||
88 | cmd_v5->beamform_flags = cmd_v7->beamform_flags; | ||
89 | cmd_v5->tfd_queue_msk = cmd_v7->tfd_queue_msk; | ||
90 | } | ||
91 | |||
92 | static void | ||
93 | iwl_mvm_add_sta_key_to_add_sta_cmd_v5(struct iwl_mvm_add_sta_key_cmd *key_cmd, | ||
94 | struct iwl_mvm_add_sta_cmd_v5 *sta_cmd, | ||
95 | u32 mac_id_n_color) | ||
96 | { | ||
97 | memset(sta_cmd, 0, sizeof(*sta_cmd)); | ||
98 | |||
99 | sta_cmd->sta_id = key_cmd->sta_id; | ||
100 | sta_cmd->add_modify = STA_MODE_MODIFY; | ||
101 | sta_cmd->modify_mask = STA_MODIFY_KEY; | ||
102 | sta_cmd->mac_id_n_color = cpu_to_le32(mac_id_n_color); | ||
103 | |||
104 | sta_cmd->key.key_offset = key_cmd->key_offset; | ||
105 | sta_cmd->key.key_flags = key_cmd->key_flags; | ||
106 | memcpy(sta_cmd->key.key, key_cmd->key, sizeof(sta_cmd->key.key)); | ||
107 | sta_cmd->key.tkip_rx_tsc_byte2 = key_cmd->tkip_rx_tsc_byte2; | ||
108 | memcpy(sta_cmd->key.tkip_rx_ttak, key_cmd->tkip_rx_ttak, | ||
109 | sizeof(sta_cmd->key.tkip_rx_ttak)); | ||
110 | } | ||
111 | |||
112 | static int iwl_mvm_send_add_sta_cmd_status(struct iwl_mvm *mvm, | ||
113 | struct iwl_mvm_add_sta_cmd_v7 *cmd, | ||
114 | int *status) | ||
115 | { | ||
116 | struct iwl_mvm_add_sta_cmd_v5 cmd_v5; | ||
117 | |||
118 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_STA_KEY_CMD) | ||
119 | return iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(*cmd), | ||
120 | cmd, status); | ||
121 | |||
122 | iwl_mvm_add_sta_cmd_v7_to_v5(cmd, &cmd_v5); | ||
123 | |||
124 | return iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd_v5), | ||
125 | &cmd_v5, status); | ||
126 | } | ||
127 | |||
128 | static int iwl_mvm_send_add_sta_cmd(struct iwl_mvm *mvm, u32 flags, | ||
129 | struct iwl_mvm_add_sta_cmd_v7 *cmd) | ||
130 | { | ||
131 | struct iwl_mvm_add_sta_cmd_v5 cmd_v5; | ||
132 | |||
133 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_STA_KEY_CMD) | ||
134 | return iwl_mvm_send_cmd_pdu(mvm, ADD_STA, flags, | ||
135 | sizeof(*cmd), cmd); | ||
136 | |||
137 | iwl_mvm_add_sta_cmd_v7_to_v5(cmd, &cmd_v5); | ||
138 | |||
139 | return iwl_mvm_send_cmd_pdu(mvm, ADD_STA, flags, sizeof(cmd_v5), | ||
140 | &cmd_v5); | ||
141 | } | ||
142 | |||
143 | static int | ||
144 | iwl_mvm_send_add_sta_key_cmd_status(struct iwl_mvm *mvm, | ||
145 | struct iwl_mvm_add_sta_key_cmd *cmd, | ||
146 | u32 mac_id_n_color, | ||
147 | int *status) | ||
148 | { | ||
149 | struct iwl_mvm_add_sta_cmd_v5 sta_cmd; | ||
150 | |||
151 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_STA_KEY_CMD) | ||
152 | return iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA_KEY, | ||
153 | sizeof(*cmd), cmd, status); | ||
154 | |||
155 | iwl_mvm_add_sta_key_to_add_sta_cmd_v5(cmd, &sta_cmd, mac_id_n_color); | ||
156 | |||
157 | return iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(sta_cmd), | ||
158 | &sta_cmd, status); | ||
159 | } | ||
160 | |||
161 | static int iwl_mvm_send_add_sta_key_cmd(struct iwl_mvm *mvm, | ||
162 | u32 flags, | ||
163 | struct iwl_mvm_add_sta_key_cmd *cmd, | ||
164 | u32 mac_id_n_color) | ||
165 | { | ||
166 | struct iwl_mvm_add_sta_cmd_v5 sta_cmd; | ||
167 | |||
168 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_STA_KEY_CMD) | ||
169 | return iwl_mvm_send_cmd_pdu(mvm, ADD_STA_KEY, flags, | ||
170 | sizeof(*cmd), cmd); | ||
171 | |||
172 | iwl_mvm_add_sta_key_to_add_sta_cmd_v5(cmd, &sta_cmd, mac_id_n_color); | ||
173 | |||
174 | return iwl_mvm_send_cmd_pdu(mvm, ADD_STA, flags, sizeof(sta_cmd), | ||
175 | &sta_cmd); | ||
176 | } | ||
177 | |||
178 | static int iwl_mvm_find_free_sta_id(struct iwl_mvm *mvm, | 69 | static int iwl_mvm_find_free_sta_id(struct iwl_mvm *mvm, |
179 | enum nl80211_iftype iftype) | 70 | enum nl80211_iftype iftype) |
180 | { | 71 | { |
@@ -207,7 +98,7 @@ int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
207 | bool update) | 98 | bool update) |
208 | { | 99 | { |
209 | struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; | 100 | struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; |
210 | struct iwl_mvm_add_sta_cmd_v7 add_sta_cmd; | 101 | struct iwl_mvm_add_sta_cmd add_sta_cmd; |
211 | int ret; | 102 | int ret; |
212 | u32 status; | 103 | u32 status; |
213 | u32 agg_size = 0, mpdu_dens = 0; | 104 | u32 agg_size = 0, mpdu_dens = 0; |
@@ -295,7 +186,8 @@ int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
295 | cpu_to_le32(mpdu_dens << STA_FLG_AGG_MPDU_DENS_SHIFT); | 186 | cpu_to_le32(mpdu_dens << STA_FLG_AGG_MPDU_DENS_SHIFT); |
296 | 187 | ||
297 | status = ADD_STA_SUCCESS; | 188 | status = ADD_STA_SUCCESS; |
298 | ret = iwl_mvm_send_add_sta_cmd_status(mvm, &add_sta_cmd, &status); | 189 | ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(add_sta_cmd), |
190 | &add_sta_cmd, &status); | ||
299 | if (ret) | 191 | if (ret) |
300 | return ret; | 192 | return ret; |
301 | 193 | ||
@@ -380,7 +272,7 @@ int iwl_mvm_update_sta(struct iwl_mvm *mvm, | |||
380 | int iwl_mvm_drain_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, | 272 | int iwl_mvm_drain_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, |
381 | bool drain) | 273 | bool drain) |
382 | { | 274 | { |
383 | struct iwl_mvm_add_sta_cmd_v7 cmd = {}; | 275 | struct iwl_mvm_add_sta_cmd cmd = {}; |
384 | int ret; | 276 | int ret; |
385 | u32 status; | 277 | u32 status; |
386 | 278 | ||
@@ -393,7 +285,8 @@ int iwl_mvm_drain_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, | |||
393 | cmd.station_flags_msk = cpu_to_le32(STA_FLG_DRAIN_FLOW); | 285 | cmd.station_flags_msk = cpu_to_le32(STA_FLG_DRAIN_FLOW); |
394 | 286 | ||
395 | status = ADD_STA_SUCCESS; | 287 | status = ADD_STA_SUCCESS; |
396 | ret = iwl_mvm_send_add_sta_cmd_status(mvm, &cmd, &status); | 288 | ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), |
289 | &cmd, &status); | ||
397 | if (ret) | 290 | if (ret) |
398 | return ret; | 291 | return ret; |
399 | 292 | ||
@@ -434,7 +327,7 @@ static int iwl_mvm_rm_sta_common(struct iwl_mvm *mvm, u8 sta_id) | |||
434 | return -EINVAL; | 327 | return -EINVAL; |
435 | } | 328 | } |
436 | 329 | ||
437 | ret = iwl_mvm_send_cmd_pdu(mvm, REMOVE_STA, CMD_SYNC, | 330 | ret = iwl_mvm_send_cmd_pdu(mvm, REMOVE_STA, 0, |
438 | sizeof(rm_sta_cmd), &rm_sta_cmd); | 331 | sizeof(rm_sta_cmd), &rm_sta_cmd); |
439 | if (ret) { | 332 | if (ret) { |
440 | IWL_ERR(mvm, "Failed to remove station. Id=%d\n", sta_id); | 333 | IWL_ERR(mvm, "Failed to remove station. Id=%d\n", sta_id); |
@@ -498,7 +391,7 @@ void iwl_mvm_sta_drained_wk(struct work_struct *wk) | |||
498 | sta_id); | 391 | sta_id); |
499 | continue; | 392 | continue; |
500 | } | 393 | } |
501 | rcu_assign_pointer(mvm->fw_id_to_mac_id[sta_id], NULL); | 394 | RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta_id], NULL); |
502 | clear_bit(sta_id, mvm->sta_drained); | 395 | clear_bit(sta_id, mvm->sta_drained); |
503 | } | 396 | } |
504 | 397 | ||
@@ -520,14 +413,6 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm, | |||
520 | /* flush its queues here since we are freeing mvm_sta */ | 413 | /* flush its queues here since we are freeing mvm_sta */ |
521 | ret = iwl_mvm_flush_tx_path(mvm, mvm_sta->tfd_queue_msk, true); | 414 | ret = iwl_mvm_flush_tx_path(mvm, mvm_sta->tfd_queue_msk, true); |
522 | 415 | ||
523 | /* | ||
524 | * Put a non-NULL since the fw station isn't removed. | ||
525 | * It will be removed after the MAC will be set as | ||
526 | * unassoc. | ||
527 | */ | ||
528 | rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], | ||
529 | ERR_PTR(-EINVAL)); | ||
530 | |||
531 | /* if we are associated - we can't remove the AP STA now */ | 416 | /* if we are associated - we can't remove the AP STA now */ |
532 | if (vif->bss_conf.assoc) | 417 | if (vif->bss_conf.assoc) |
533 | return ret; | 418 | return ret; |
@@ -557,7 +442,7 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm, | |||
557 | } else { | 442 | } else { |
558 | spin_unlock_bh(&mvm_sta->lock); | 443 | spin_unlock_bh(&mvm_sta->lock); |
559 | ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id); | 444 | ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id); |
560 | rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], NULL); | 445 | RCU_INIT_POINTER(mvm->fw_id_to_mac_id[mvm_sta->sta_id], NULL); |
561 | } | 446 | } |
562 | 447 | ||
563 | return ret; | 448 | return ret; |
@@ -571,7 +456,7 @@ int iwl_mvm_rm_sta_id(struct iwl_mvm *mvm, | |||
571 | 456 | ||
572 | lockdep_assert_held(&mvm->mutex); | 457 | lockdep_assert_held(&mvm->mutex); |
573 | 458 | ||
574 | rcu_assign_pointer(mvm->fw_id_to_mac_id[sta_id], NULL); | 459 | RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta_id], NULL); |
575 | return ret; | 460 | return ret; |
576 | } | 461 | } |
577 | 462 | ||
@@ -593,7 +478,7 @@ int iwl_mvm_allocate_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta, | |||
593 | 478 | ||
594 | void iwl_mvm_dealloc_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta) | 479 | void iwl_mvm_dealloc_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta) |
595 | { | 480 | { |
596 | rcu_assign_pointer(mvm->fw_id_to_mac_id[sta->sta_id], NULL); | 481 | RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta->sta_id], NULL); |
597 | memset(sta, 0, sizeof(struct iwl_mvm_int_sta)); | 482 | memset(sta, 0, sizeof(struct iwl_mvm_int_sta)); |
598 | sta->sta_id = IWL_MVM_STATION_COUNT; | 483 | sta->sta_id = IWL_MVM_STATION_COUNT; |
599 | } | 484 | } |
@@ -603,13 +488,13 @@ static int iwl_mvm_add_int_sta_common(struct iwl_mvm *mvm, | |||
603 | const u8 *addr, | 488 | const u8 *addr, |
604 | u16 mac_id, u16 color) | 489 | u16 mac_id, u16 color) |
605 | { | 490 | { |
606 | struct iwl_mvm_add_sta_cmd_v7 cmd; | 491 | struct iwl_mvm_add_sta_cmd cmd; |
607 | int ret; | 492 | int ret; |
608 | u32 status; | 493 | u32 status; |
609 | 494 | ||
610 | lockdep_assert_held(&mvm->mutex); | 495 | lockdep_assert_held(&mvm->mutex); |
611 | 496 | ||
612 | memset(&cmd, 0, sizeof(struct iwl_mvm_add_sta_cmd_v7)); | 497 | memset(&cmd, 0, sizeof(cmd)); |
613 | cmd.sta_id = sta->sta_id; | 498 | cmd.sta_id = sta->sta_id; |
614 | cmd.mac_id_n_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mac_id, | 499 | cmd.mac_id_n_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mac_id, |
615 | color)); | 500 | color)); |
@@ -619,7 +504,8 @@ static int iwl_mvm_add_int_sta_common(struct iwl_mvm *mvm, | |||
619 | if (addr) | 504 | if (addr) |
620 | memcpy(cmd.addr, addr, ETH_ALEN); | 505 | memcpy(cmd.addr, addr, ETH_ALEN); |
621 | 506 | ||
622 | ret = iwl_mvm_send_add_sta_cmd_status(mvm, &cmd, &status); | 507 | ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), |
508 | &cmd, &status); | ||
623 | if (ret) | 509 | if (ret) |
624 | return ret; | 510 | return ret; |
625 | 511 | ||
@@ -753,7 +639,7 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
753 | int tid, u16 ssn, bool start) | 639 | int tid, u16 ssn, bool start) |
754 | { | 640 | { |
755 | struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; | 641 | struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; |
756 | struct iwl_mvm_add_sta_cmd_v7 cmd = {}; | 642 | struct iwl_mvm_add_sta_cmd cmd = {}; |
757 | int ret; | 643 | int ret; |
758 | u32 status; | 644 | u32 status; |
759 | 645 | ||
@@ -777,7 +663,8 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
777 | STA_MODIFY_REMOVE_BA_TID; | 663 | STA_MODIFY_REMOVE_BA_TID; |
778 | 664 | ||
779 | status = ADD_STA_SUCCESS; | 665 | status = ADD_STA_SUCCESS; |
780 | ret = iwl_mvm_send_add_sta_cmd_status(mvm, &cmd, &status); | 666 | ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), |
667 | &cmd, &status); | ||
781 | if (ret) | 668 | if (ret) |
782 | return ret; | 669 | return ret; |
783 | 670 | ||
@@ -812,7 +699,7 @@ static int iwl_mvm_sta_tx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
812 | int tid, u8 queue, bool start) | 699 | int tid, u8 queue, bool start) |
813 | { | 700 | { |
814 | struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; | 701 | struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; |
815 | struct iwl_mvm_add_sta_cmd_v7 cmd = {}; | 702 | struct iwl_mvm_add_sta_cmd cmd = {}; |
816 | int ret; | 703 | int ret; |
817 | u32 status; | 704 | u32 status; |
818 | 705 | ||
@@ -834,7 +721,8 @@ static int iwl_mvm_sta_tx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
834 | cmd.tid_disable_tx = cpu_to_le16(mvm_sta->tid_disable_agg); | 721 | cmd.tid_disable_tx = cpu_to_le16(mvm_sta->tid_disable_agg); |
835 | 722 | ||
836 | status = ADD_STA_SUCCESS; | 723 | status = ADD_STA_SUCCESS; |
837 | ret = iwl_mvm_send_add_sta_cmd_status(mvm, &cmd, &status); | 724 | ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), |
725 | &cmd, &status); | ||
838 | if (ret) | 726 | if (ret) |
839 | return ret; | 727 | return ret; |
840 | 728 | ||
@@ -1129,12 +1017,11 @@ static int iwl_mvm_send_sta_key(struct iwl_mvm *mvm, | |||
1129 | u8 sta_id, u32 tkip_iv32, u16 *tkip_p1k, | 1017 | u8 sta_id, u32 tkip_iv32, u16 *tkip_p1k, |
1130 | u32 cmd_flags) | 1018 | u32 cmd_flags) |
1131 | { | 1019 | { |
1132 | __le16 key_flags; | ||
1133 | struct iwl_mvm_add_sta_key_cmd cmd = {}; | 1020 | struct iwl_mvm_add_sta_key_cmd cmd = {}; |
1021 | __le16 key_flags; | ||
1134 | int ret, status; | 1022 | int ret, status; |
1135 | u16 keyidx; | 1023 | u16 keyidx; |
1136 | int i; | 1024 | int i; |
1137 | u32 mac_id_n_color = mvm_sta->mac_id_n_color; | ||
1138 | 1025 | ||
1139 | keyidx = (keyconf->keyidx << STA_KEY_FLG_KEYID_POS) & | 1026 | keyidx = (keyconf->keyidx << STA_KEY_FLG_KEYID_POS) & |
1140 | STA_KEY_FLG_KEYID_MSK; | 1027 | STA_KEY_FLG_KEYID_MSK; |
@@ -1166,13 +1053,12 @@ static int iwl_mvm_send_sta_key(struct iwl_mvm *mvm, | |||
1166 | cmd.sta_id = sta_id; | 1053 | cmd.sta_id = sta_id; |
1167 | 1054 | ||
1168 | status = ADD_STA_SUCCESS; | 1055 | status = ADD_STA_SUCCESS; |
1169 | if (cmd_flags == CMD_SYNC) | 1056 | if (cmd_flags & CMD_ASYNC) |
1170 | ret = iwl_mvm_send_add_sta_key_cmd_status(mvm, &cmd, | 1057 | ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA_KEY, CMD_ASYNC, |
1171 | mac_id_n_color, | 1058 | sizeof(cmd), &cmd); |
1172 | &status); | ||
1173 | else | 1059 | else |
1174 | ret = iwl_mvm_send_add_sta_key_cmd(mvm, CMD_ASYNC, &cmd, | 1060 | ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA_KEY, sizeof(cmd), |
1175 | mac_id_n_color); | 1061 | &cmd, &status); |
1176 | 1062 | ||
1177 | switch (status) { | 1063 | switch (status) { |
1178 | case ADD_STA_SUCCESS: | 1064 | case ADD_STA_SUCCESS: |
@@ -1225,7 +1111,7 @@ static int iwl_mvm_send_sta_igtk(struct iwl_mvm *mvm, | |||
1225 | remove_key ? "removing" : "installing", | 1111 | remove_key ? "removing" : "installing", |
1226 | igtk_cmd.sta_id); | 1112 | igtk_cmd.sta_id); |
1227 | 1113 | ||
1228 | return iwl_mvm_send_cmd_pdu(mvm, MGMT_MCAST_KEY, CMD_SYNC, | 1114 | return iwl_mvm_send_cmd_pdu(mvm, MGMT_MCAST_KEY, 0, |
1229 | sizeof(igtk_cmd), &igtk_cmd); | 1115 | sizeof(igtk_cmd), &igtk_cmd); |
1230 | } | 1116 | } |
1231 | 1117 | ||
@@ -1312,15 +1198,15 @@ int iwl_mvm_set_sta_key(struct iwl_mvm *mvm, | |||
1312 | ieee80211_get_key_rx_seq(keyconf, 0, &seq); | 1198 | ieee80211_get_key_rx_seq(keyconf, 0, &seq); |
1313 | ieee80211_get_tkip_rx_p1k(keyconf, addr, seq.tkip.iv32, p1k); | 1199 | ieee80211_get_tkip_rx_p1k(keyconf, addr, seq.tkip.iv32, p1k); |
1314 | ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, sta_id, | 1200 | ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, sta_id, |
1315 | seq.tkip.iv32, p1k, CMD_SYNC); | 1201 | seq.tkip.iv32, p1k, 0); |
1316 | break; | 1202 | break; |
1317 | case WLAN_CIPHER_SUITE_CCMP: | 1203 | case WLAN_CIPHER_SUITE_CCMP: |
1318 | ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, sta_id, | 1204 | ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, sta_id, |
1319 | 0, NULL, CMD_SYNC); | 1205 | 0, NULL, 0); |
1320 | break; | 1206 | break; |
1321 | default: | 1207 | default: |
1322 | ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, | 1208 | ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, |
1323 | sta_id, 0, NULL, CMD_SYNC); | 1209 | sta_id, 0, NULL, 0); |
1324 | } | 1210 | } |
1325 | 1211 | ||
1326 | if (ret) | 1212 | if (ret) |
@@ -1399,9 +1285,8 @@ int iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, | |||
1399 | cmd.sta_id = sta_id; | 1285 | cmd.sta_id = sta_id; |
1400 | 1286 | ||
1401 | status = ADD_STA_SUCCESS; | 1287 | status = ADD_STA_SUCCESS; |
1402 | ret = iwl_mvm_send_add_sta_key_cmd_status(mvm, &cmd, | 1288 | ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA_KEY, sizeof(cmd), |
1403 | mvm_sta->mac_id_n_color, | 1289 | &cmd, &status); |
1404 | &status); | ||
1405 | 1290 | ||
1406 | switch (status) { | 1291 | switch (status) { |
1407 | case ADD_STA_SUCCESS: | 1292 | case ADD_STA_SUCCESS: |
@@ -1448,7 +1333,7 @@ void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm, | |||
1448 | struct ieee80211_sta *sta) | 1333 | struct ieee80211_sta *sta) |
1449 | { | 1334 | { |
1450 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | 1335 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
1451 | struct iwl_mvm_add_sta_cmd_v7 cmd = { | 1336 | struct iwl_mvm_add_sta_cmd cmd = { |
1452 | .add_modify = STA_MODE_MODIFY, | 1337 | .add_modify = STA_MODE_MODIFY, |
1453 | .sta_id = mvmsta->sta_id, | 1338 | .sta_id = mvmsta->sta_id, |
1454 | .station_flags_msk = cpu_to_le32(STA_FLG_PS), | 1339 | .station_flags_msk = cpu_to_le32(STA_FLG_PS), |
@@ -1456,7 +1341,7 @@ void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm, | |||
1456 | }; | 1341 | }; |
1457 | int ret; | 1342 | int ret; |
1458 | 1343 | ||
1459 | ret = iwl_mvm_send_add_sta_cmd(mvm, CMD_ASYNC, &cmd); | 1344 | ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, CMD_ASYNC, sizeof(cmd), &cmd); |
1460 | if (ret) | 1345 | if (ret) |
1461 | IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); | 1346 | IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); |
1462 | } | 1347 | } |
@@ -1468,7 +1353,7 @@ void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, | |||
1468 | bool agg) | 1353 | bool agg) |
1469 | { | 1354 | { |
1470 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | 1355 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
1471 | struct iwl_mvm_add_sta_cmd_v7 cmd = { | 1356 | struct iwl_mvm_add_sta_cmd cmd = { |
1472 | .add_modify = STA_MODE_MODIFY, | 1357 | .add_modify = STA_MODE_MODIFY, |
1473 | .sta_id = mvmsta->sta_id, | 1358 | .sta_id = mvmsta->sta_id, |
1474 | .modify_mask = STA_MODIFY_SLEEPING_STA_TX_COUNT, | 1359 | .modify_mask = STA_MODIFY_SLEEPING_STA_TX_COUNT, |
@@ -1538,7 +1423,7 @@ void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, | |||
1538 | cmd.sleep_state_flags |= cpu_to_le16(STA_SLEEP_STATE_UAPSD); | 1423 | cmd.sleep_state_flags |= cpu_to_le16(STA_SLEEP_STATE_UAPSD); |
1539 | } | 1424 | } |
1540 | 1425 | ||
1541 | ret = iwl_mvm_send_add_sta_cmd(mvm, CMD_ASYNC, &cmd); | 1426 | ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, CMD_ASYNC, sizeof(cmd), &cmd); |
1542 | if (ret) | 1427 | if (ret) |
1543 | IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); | 1428 | IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); |
1544 | } | 1429 | } |
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.h b/drivers/net/wireless/iwlwifi/mvm/sta.h index 2ed84c421481..d98e8a2142b8 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.h +++ b/drivers/net/wireless/iwlwifi/mvm/sta.h | |||
@@ -253,6 +253,8 @@ enum iwl_mvm_agg_state { | |||
253 | * This is basically (last acked packet++). | 253 | * This is basically (last acked packet++). |
254 | * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the | 254 | * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the |
255 | * Tx response (TX_CMD), and the block ack notification (COMPRESSED_BA). | 255 | * Tx response (TX_CMD), and the block ack notification (COMPRESSED_BA). |
256 | * @reduced_tpc: Reduced tx power. Holds the data between the | ||
257 | * Tx response (TX_CMD), and the block ack notification (COMPRESSED_BA). | ||
256 | * @state: state of the BA agreement establishment / tear down. | 258 | * @state: state of the BA agreement establishment / tear down. |
257 | * @txq_id: Tx queue used by the BA session | 259 | * @txq_id: Tx queue used by the BA session |
258 | * @ssn: the first packet to be sent in AGG HW queue in Tx AGG start flow, or | 260 | * @ssn: the first packet to be sent in AGG HW queue in Tx AGG start flow, or |
@@ -265,6 +267,7 @@ struct iwl_mvm_tid_data { | |||
265 | u16 next_reclaimed; | 267 | u16 next_reclaimed; |
266 | /* The rest is Tx AGG related */ | 268 | /* The rest is Tx AGG related */ |
267 | u32 rate_n_flags; | 269 | u32 rate_n_flags; |
270 | u8 reduced_tpc; | ||
268 | enum iwl_mvm_agg_state state; | 271 | enum iwl_mvm_agg_state state; |
269 | u16 txq_id; | 272 | u16 txq_id; |
270 | u16 ssn; | 273 | u16 ssn; |
@@ -284,8 +287,6 @@ static inline u16 iwl_mvm_tid_queued(struct iwl_mvm_tid_data *tid_data) | |||
284 | * @tid_disable_agg: bitmap: if bit(tid) is set, the fw won't send ampdus for | 287 | * @tid_disable_agg: bitmap: if bit(tid) is set, the fw won't send ampdus for |
285 | * tid. | 288 | * tid. |
286 | * @max_agg_bufsize: the maximal size of the AGG buffer for this station | 289 | * @max_agg_bufsize: the maximal size of the AGG buffer for this station |
287 | * @bt_reduced_txpower_dbg: debug mode in which %bt_reduced_txpower is forced | ||
288 | * by debugfs. | ||
289 | * @bt_reduced_txpower: is reduced tx power enabled for this station | 290 | * @bt_reduced_txpower: is reduced tx power enabled for this station |
290 | * @next_status_eosp: the next reclaimed packet is a PS-Poll response and | 291 | * @next_status_eosp: the next reclaimed packet is a PS-Poll response and |
291 | * we need to signal the EOSP | 292 | * we need to signal the EOSP |
@@ -306,7 +307,6 @@ struct iwl_mvm_sta { | |||
306 | u32 mac_id_n_color; | 307 | u32 mac_id_n_color; |
307 | u16 tid_disable_agg; | 308 | u16 tid_disable_agg; |
308 | u8 max_agg_bufsize; | 309 | u8 max_agg_bufsize; |
309 | bool bt_reduced_txpower_dbg; | ||
310 | bool bt_reduced_txpower; | 310 | bool bt_reduced_txpower; |
311 | bool next_status_eosp; | 311 | bool next_status_eosp; |
312 | spinlock_t lock; | 312 | spinlock_t lock; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.c b/drivers/net/wireless/iwlwifi/mvm/time-event.c index 61331245ad93..80100f6cc12a 100644 --- a/drivers/net/wireless/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/iwlwifi/mvm/time-event.c | |||
@@ -273,67 +273,10 @@ static bool iwl_mvm_time_event_response(struct iwl_notif_wait_data *notif_wait, | |||
273 | return true; | 273 | return true; |
274 | } | 274 | } |
275 | 275 | ||
276 | /* used to convert from time event API v2 to v1 */ | ||
277 | #define TE_V2_DEP_POLICY_MSK (TE_V2_DEP_OTHER | TE_V2_DEP_TSF |\ | ||
278 | TE_V2_EVENT_SOCIOPATHIC) | ||
279 | static inline u16 te_v2_get_notify(__le16 policy) | ||
280 | { | ||
281 | return le16_to_cpu(policy) & TE_V2_NOTIF_MSK; | ||
282 | } | ||
283 | |||
284 | static inline u16 te_v2_get_dep_policy(__le16 policy) | ||
285 | { | ||
286 | return (le16_to_cpu(policy) & TE_V2_DEP_POLICY_MSK) >> | ||
287 | TE_V2_PLACEMENT_POS; | ||
288 | } | ||
289 | |||
290 | static inline u16 te_v2_get_absence(__le16 policy) | ||
291 | { | ||
292 | return (le16_to_cpu(policy) & TE_V2_ABSENCE) >> TE_V2_ABSENCE_POS; | ||
293 | } | ||
294 | |||
295 | static void iwl_mvm_te_v2_to_v1(const struct iwl_time_event_cmd_v2 *cmd_v2, | ||
296 | struct iwl_time_event_cmd_v1 *cmd_v1) | ||
297 | { | ||
298 | cmd_v1->id_and_color = cmd_v2->id_and_color; | ||
299 | cmd_v1->action = cmd_v2->action; | ||
300 | cmd_v1->id = cmd_v2->id; | ||
301 | cmd_v1->apply_time = cmd_v2->apply_time; | ||
302 | cmd_v1->max_delay = cmd_v2->max_delay; | ||
303 | cmd_v1->depends_on = cmd_v2->depends_on; | ||
304 | cmd_v1->interval = cmd_v2->interval; | ||
305 | cmd_v1->duration = cmd_v2->duration; | ||
306 | if (cmd_v2->repeat == TE_V2_REPEAT_ENDLESS) | ||
307 | cmd_v1->repeat = cpu_to_le32(TE_V1_REPEAT_ENDLESS); | ||
308 | else | ||
309 | cmd_v1->repeat = cpu_to_le32(cmd_v2->repeat); | ||
310 | cmd_v1->max_frags = cpu_to_le32(cmd_v2->max_frags); | ||
311 | cmd_v1->interval_reciprocal = 0; /* unused */ | ||
312 | |||
313 | cmd_v1->dep_policy = cpu_to_le32(te_v2_get_dep_policy(cmd_v2->policy)); | ||
314 | cmd_v1->is_present = cpu_to_le32(!te_v2_get_absence(cmd_v2->policy)); | ||
315 | cmd_v1->notify = cpu_to_le32(te_v2_get_notify(cmd_v2->policy)); | ||
316 | } | ||
317 | |||
318 | static int iwl_mvm_send_time_event_cmd(struct iwl_mvm *mvm, | ||
319 | const struct iwl_time_event_cmd_v2 *cmd) | ||
320 | { | ||
321 | struct iwl_time_event_cmd_v1 cmd_v1; | ||
322 | |||
323 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_TIME_EVENT_API_V2) | ||
324 | return iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC, | ||
325 | sizeof(*cmd), cmd); | ||
326 | |||
327 | iwl_mvm_te_v2_to_v1(cmd, &cmd_v1); | ||
328 | return iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC, | ||
329 | sizeof(cmd_v1), &cmd_v1); | ||
330 | } | ||
331 | |||
332 | |||
333 | static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm, | 276 | static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm, |
334 | struct ieee80211_vif *vif, | 277 | struct ieee80211_vif *vif, |
335 | struct iwl_mvm_time_event_data *te_data, | 278 | struct iwl_mvm_time_event_data *te_data, |
336 | struct iwl_time_event_cmd_v2 *te_cmd) | 279 | struct iwl_time_event_cmd *te_cmd) |
337 | { | 280 | { |
338 | static const u8 time_event_response[] = { TIME_EVENT_CMD }; | 281 | static const u8 time_event_response[] = { TIME_EVENT_CMD }; |
339 | struct iwl_notification_wait wait_time_event; | 282 | struct iwl_notification_wait wait_time_event; |
@@ -369,7 +312,8 @@ static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm, | |||
369 | ARRAY_SIZE(time_event_response), | 312 | ARRAY_SIZE(time_event_response), |
370 | iwl_mvm_time_event_response, te_data); | 313 | iwl_mvm_time_event_response, te_data); |
371 | 314 | ||
372 | ret = iwl_mvm_send_time_event_cmd(mvm, te_cmd); | 315 | ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0, |
316 | sizeof(*te_cmd), te_cmd); | ||
373 | if (ret) { | 317 | if (ret) { |
374 | IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret); | 318 | IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret); |
375 | iwl_remove_notification(&mvm->notif_wait, &wait_time_event); | 319 | iwl_remove_notification(&mvm->notif_wait, &wait_time_event); |
@@ -397,7 +341,7 @@ void iwl_mvm_protect_session(struct iwl_mvm *mvm, | |||
397 | { | 341 | { |
398 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 342 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
399 | struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; | 343 | struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; |
400 | struct iwl_time_event_cmd_v2 time_cmd = {}; | 344 | struct iwl_time_event_cmd time_cmd = {}; |
401 | 345 | ||
402 | lockdep_assert_held(&mvm->mutex); | 346 | lockdep_assert_held(&mvm->mutex); |
403 | 347 | ||
@@ -453,7 +397,7 @@ void iwl_mvm_remove_time_event(struct iwl_mvm *mvm, | |||
453 | struct iwl_mvm_vif *mvmvif, | 397 | struct iwl_mvm_vif *mvmvif, |
454 | struct iwl_mvm_time_event_data *te_data) | 398 | struct iwl_mvm_time_event_data *te_data) |
455 | { | 399 | { |
456 | struct iwl_time_event_cmd_v2 time_cmd = {}; | 400 | struct iwl_time_event_cmd time_cmd = {}; |
457 | u32 id, uid; | 401 | u32 id, uid; |
458 | int ret; | 402 | int ret; |
459 | 403 | ||
@@ -490,7 +434,8 @@ void iwl_mvm_remove_time_event(struct iwl_mvm *mvm, | |||
490 | cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); | 434 | cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); |
491 | 435 | ||
492 | IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id)); | 436 | IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id)); |
493 | ret = iwl_mvm_send_time_event_cmd(mvm, &time_cmd); | 437 | ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0, |
438 | sizeof(time_cmd), &time_cmd); | ||
494 | if (WARN_ON(ret)) | 439 | if (WARN_ON(ret)) |
495 | return; | 440 | return; |
496 | } | 441 | } |
@@ -510,7 +455,7 @@ int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
510 | { | 455 | { |
511 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 456 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
512 | struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; | 457 | struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; |
513 | struct iwl_time_event_cmd_v2 time_cmd = {}; | 458 | struct iwl_time_event_cmd time_cmd = {}; |
514 | 459 | ||
515 | lockdep_assert_held(&mvm->mutex); | 460 | lockdep_assert_held(&mvm->mutex); |
516 | if (te_data->running) { | 461 | if (te_data->running) { |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tt.c b/drivers/net/wireless/iwlwifi/mvm/tt.c index 7a99fa361954..868561512783 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tt.c +++ b/drivers/net/wireless/iwlwifi/mvm/tt.c | |||
@@ -409,7 +409,6 @@ void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff) | |||
409 | .id = REPLY_THERMAL_MNG_BACKOFF, | 409 | .id = REPLY_THERMAL_MNG_BACKOFF, |
410 | .len = { sizeof(u32), }, | 410 | .len = { sizeof(u32), }, |
411 | .data = { &backoff, }, | 411 | .data = { &backoff, }, |
412 | .flags = CMD_SYNC, | ||
413 | }; | 412 | }; |
414 | 413 | ||
415 | backoff = max(backoff, mvm->thermal_throttle.min_backoff); | 414 | backoff = max(backoff, mvm->thermal_throttle.min_backoff); |
@@ -468,13 +467,14 @@ void iwl_mvm_tt_handler(struct iwl_mvm *mvm) | |||
468 | } | 467 | } |
469 | 468 | ||
470 | if (params->support_tx_backoff) { | 469 | if (params->support_tx_backoff) { |
471 | tx_backoff = 0; | 470 | tx_backoff = tt->min_backoff; |
472 | for (i = 0; i < TT_TX_BACKOFF_SIZE; i++) { | 471 | for (i = 0; i < TT_TX_BACKOFF_SIZE; i++) { |
473 | if (temperature < params->tx_backoff[i].temperature) | 472 | if (temperature < params->tx_backoff[i].temperature) |
474 | break; | 473 | break; |
475 | tx_backoff = params->tx_backoff[i].backoff; | 474 | tx_backoff = max(tt->min_backoff, |
475 | params->tx_backoff[i].backoff); | ||
476 | } | 476 | } |
477 | if (tx_backoff != 0) | 477 | if (tx_backoff != tt->min_backoff) |
478 | throttle_enable = true; | 478 | throttle_enable = true; |
479 | if (tt->tx_backoff != tx_backoff) | 479 | if (tt->tx_backoff != tx_backoff) |
480 | iwl_mvm_tt_tx_backoff(mvm, tx_backoff); | 480 | iwl_mvm_tt_tx_backoff(mvm, tx_backoff); |
@@ -484,7 +484,8 @@ void iwl_mvm_tt_handler(struct iwl_mvm *mvm) | |||
484 | IWL_WARN(mvm, | 484 | IWL_WARN(mvm, |
485 | "Due to high temperature thermal throttling initiated\n"); | 485 | "Due to high temperature thermal throttling initiated\n"); |
486 | tt->throttle = true; | 486 | tt->throttle = true; |
487 | } else if (tt->throttle && !tt->dynamic_smps && tt->tx_backoff == 0 && | 487 | } else if (tt->throttle && !tt->dynamic_smps && |
488 | tt->tx_backoff == tt->min_backoff && | ||
488 | temperature <= params->tx_protection_exit) { | 489 | temperature <= params->tx_protection_exit) { |
489 | IWL_WARN(mvm, | 490 | IWL_WARN(mvm, |
490 | "Temperature is back to normal thermal throttling stopped\n"); | 491 | "Temperature is back to normal thermal throttling stopped\n"); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index 879aeac46cc1..3846a6c41eb1 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -636,7 +636,11 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, | |||
636 | seq_ctl = le16_to_cpu(hdr->seq_ctrl); | 636 | seq_ctl = le16_to_cpu(hdr->seq_ctrl); |
637 | } | 637 | } |
638 | 638 | ||
639 | ieee80211_tx_status_ni(mvm->hw, skb); | 639 | BUILD_BUG_ON(ARRAY_SIZE(info->status.status_driver_data) < 1); |
640 | info->status.status_driver_data[0] = | ||
641 | (void *)(uintptr_t)tx_resp->reduced_tpc; | ||
642 | |||
643 | ieee80211_tx_status(mvm->hw, skb); | ||
640 | } | 644 | } |
641 | 645 | ||
642 | if (txq_id >= mvm->first_agg_queue) { | 646 | if (txq_id >= mvm->first_agg_queue) { |
@@ -815,6 +819,7 @@ static void iwl_mvm_rx_tx_cmd_agg(struct iwl_mvm *mvm, | |||
815 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | 819 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
816 | mvmsta->tid_data[tid].rate_n_flags = | 820 | mvmsta->tid_data[tid].rate_n_flags = |
817 | le32_to_cpu(tx_resp->initial_rate); | 821 | le32_to_cpu(tx_resp->initial_rate); |
822 | mvmsta->tid_data[tid].reduced_tpc = tx_resp->reduced_tpc; | ||
818 | } | 823 | } |
819 | 824 | ||
820 | rcu_read_unlock(); | 825 | rcu_read_unlock(); |
@@ -928,6 +933,8 @@ int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, | |||
928 | info->status.ampdu_len = ba_notif->txed; | 933 | info->status.ampdu_len = ba_notif->txed; |
929 | iwl_mvm_hwrate_to_tx_status(tid_data->rate_n_flags, | 934 | iwl_mvm_hwrate_to_tx_status(tid_data->rate_n_flags, |
930 | info); | 935 | info); |
936 | info->status.status_driver_data[0] = | ||
937 | (void *)(uintptr_t)tid_data->reduced_tpc; | ||
931 | } | 938 | } |
932 | } | 939 | } |
933 | 940 | ||
@@ -937,7 +944,7 @@ int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, | |||
937 | 944 | ||
938 | while (!skb_queue_empty(&reclaimed_skbs)) { | 945 | while (!skb_queue_empty(&reclaimed_skbs)) { |
939 | skb = __skb_dequeue(&reclaimed_skbs); | 946 | skb = __skb_dequeue(&reclaimed_skbs); |
940 | ieee80211_tx_status_ni(mvm->hw, skb); | 947 | ieee80211_tx_status(mvm->hw, skb); |
941 | } | 948 | } |
942 | 949 | ||
943 | return 0; | 950 | return 0; |
@@ -951,7 +958,7 @@ int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, bool sync) | |||
951 | .flush_ctl = cpu_to_le16(DUMP_TX_FIFO_FLUSH), | 958 | .flush_ctl = cpu_to_le16(DUMP_TX_FIFO_FLUSH), |
952 | }; | 959 | }; |
953 | 960 | ||
954 | u32 flags = sync ? CMD_SYNC : CMD_ASYNC; | 961 | u32 flags = sync ? 0 : CMD_ASYNC; |
955 | 962 | ||
956 | ret = iwl_mvm_send_cmd_pdu(mvm, TXPATH_FLUSH, flags, | 963 | ret = iwl_mvm_send_cmd_pdu(mvm, TXPATH_FLUSH, flags, |
957 | sizeof(flush_cmd), &flush_cmd); | 964 | sizeof(flush_cmd), &flush_cmd); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c b/drivers/net/wireless/iwlwifi/mvm/utils.c index 2180902266ae..aa9fc77e8413 100644 --- a/drivers/net/wireless/iwlwifi/mvm/utils.c +++ b/drivers/net/wireless/iwlwifi/mvm/utils.c | |||
@@ -64,6 +64,7 @@ | |||
64 | 64 | ||
65 | #include "iwl-debug.h" | 65 | #include "iwl-debug.h" |
66 | #include "iwl-io.h" | 66 | #include "iwl-io.h" |
67 | #include "iwl-prph.h" | ||
67 | 68 | ||
68 | #include "mvm.h" | 69 | #include "mvm.h" |
69 | #include "fw-api-rs.h" | 70 | #include "fw-api-rs.h" |
@@ -143,7 +144,7 @@ int iwl_mvm_send_cmd_status(struct iwl_mvm *mvm, struct iwl_host_cmd *cmd, | |||
143 | "cmd flags %x", cmd->flags)) | 144 | "cmd flags %x", cmd->flags)) |
144 | return -EINVAL; | 145 | return -EINVAL; |
145 | 146 | ||
146 | cmd->flags |= CMD_SYNC | CMD_WANT_SKB; | 147 | cmd->flags |= CMD_WANT_SKB; |
147 | 148 | ||
148 | ret = iwl_trans_send_cmd(mvm->trans, cmd); | 149 | ret = iwl_trans_send_cmd(mvm->trans, cmd); |
149 | if (ret == -ERFKILL) { | 150 | if (ret == -ERFKILL) { |
@@ -469,6 +470,8 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm) | |||
469 | mvm->status, table.valid); | 470 | mvm->status, table.valid); |
470 | } | 471 | } |
471 | 472 | ||
473 | /* Do not change this output - scripts rely on it */ | ||
474 | |||
472 | IWL_ERR(mvm, "Loaded firmware version: %s\n", mvm->fw->fw_version); | 475 | IWL_ERR(mvm, "Loaded firmware version: %s\n", mvm->fw->fw_version); |
473 | 476 | ||
474 | trace_iwlwifi_dev_ucode_error(trans->dev, table.error_id, table.tsf_low, | 477 | trace_iwlwifi_dev_ucode_error(trans->dev, table.error_id, table.tsf_low, |
@@ -516,13 +519,14 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm) | |||
516 | iwl_mvm_dump_umac_error_log(mvm); | 519 | iwl_mvm_dump_umac_error_log(mvm); |
517 | } | 520 | } |
518 | 521 | ||
522 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
519 | void iwl_mvm_fw_error_sram_dump(struct iwl_mvm *mvm) | 523 | void iwl_mvm_fw_error_sram_dump(struct iwl_mvm *mvm) |
520 | { | 524 | { |
521 | const struct fw_img *img; | 525 | const struct fw_img *img; |
522 | u32 ofs, sram_len; | 526 | u32 ofs, sram_len; |
523 | void *sram; | 527 | void *sram; |
524 | 528 | ||
525 | if (!mvm->ucode_loaded || mvm->fw_error_sram) | 529 | if (!mvm->ucode_loaded || mvm->fw_error_sram || mvm->fw_error_dump) |
526 | return; | 530 | return; |
527 | 531 | ||
528 | img = &mvm->fw->img[mvm->cur_ucode]; | 532 | img = &mvm->fw->img[mvm->cur_ucode]; |
@@ -538,6 +542,48 @@ void iwl_mvm_fw_error_sram_dump(struct iwl_mvm *mvm) | |||
538 | mvm->fw_error_sram_len = sram_len; | 542 | mvm->fw_error_sram_len = sram_len; |
539 | } | 543 | } |
540 | 544 | ||
545 | void iwl_mvm_fw_error_rxf_dump(struct iwl_mvm *mvm) | ||
546 | { | ||
547 | int i, reg_val; | ||
548 | unsigned long flags; | ||
549 | |||
550 | if (!mvm->ucode_loaded || mvm->fw_error_rxf || mvm->fw_error_dump) | ||
551 | return; | ||
552 | |||
553 | /* reading buffer size */ | ||
554 | reg_val = iwl_trans_read_prph(mvm->trans, RXF_SIZE_ADDR); | ||
555 | mvm->fw_error_rxf_len = | ||
556 | (reg_val & RXF_SIZE_BYTE_CNT_MSK) >> RXF_SIZE_BYTE_CND_POS; | ||
557 | |||
558 | /* the register holds the value divided by 128 */ | ||
559 | mvm->fw_error_rxf_len = mvm->fw_error_rxf_len << 7; | ||
560 | |||
561 | if (!mvm->fw_error_rxf_len) | ||
562 | return; | ||
563 | |||
564 | mvm->fw_error_rxf = kzalloc(mvm->fw_error_rxf_len, GFP_ATOMIC); | ||
565 | if (!mvm->fw_error_rxf) { | ||
566 | mvm->fw_error_rxf_len = 0; | ||
567 | return; | ||
568 | } | ||
569 | |||
570 | if (!iwl_trans_grab_nic_access(mvm->trans, false, &flags)) { | ||
571 | kfree(mvm->fw_error_rxf); | ||
572 | mvm->fw_error_rxf = NULL; | ||
573 | mvm->fw_error_rxf_len = 0; | ||
574 | return; | ||
575 | } | ||
576 | |||
577 | for (i = 0; i < (mvm->fw_error_rxf_len / sizeof(u32)); i++) { | ||
578 | iwl_trans_write_prph(mvm->trans, RXF_LD_FENCE_OFFSET_ADDR, | ||
579 | i * sizeof(u32)); | ||
580 | mvm->fw_error_rxf[i] = | ||
581 | iwl_trans_read_prph(mvm->trans, RXF_FIFO_RD_FENCE_ADDR); | ||
582 | } | ||
583 | iwl_trans_release_nic_access(mvm->trans, &flags); | ||
584 | } | ||
585 | #endif | ||
586 | |||
541 | /** | 587 | /** |
542 | * iwl_mvm_send_lq_cmd() - Send link quality command | 588 | * iwl_mvm_send_lq_cmd() - Send link quality command |
543 | * @init: This command is sent as part of station initialization right | 589 | * @init: This command is sent as part of station initialization right |
@@ -553,7 +599,7 @@ int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, bool init) | |||
553 | struct iwl_host_cmd cmd = { | 599 | struct iwl_host_cmd cmd = { |
554 | .id = LQ_CMD, | 600 | .id = LQ_CMD, |
555 | .len = { sizeof(struct iwl_lq_cmd), }, | 601 | .len = { sizeof(struct iwl_lq_cmd), }, |
556 | .flags = init ? CMD_SYNC : CMD_ASYNC, | 602 | .flags = init ? 0 : CMD_ASYNC, |
557 | .data = { lq, }, | 603 | .data = { lq, }, |
558 | }; | 604 | }; |
559 | 605 | ||
@@ -604,6 +650,39 @@ void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
604 | ieee80211_request_smps(vif, smps_mode); | 650 | ieee80211_request_smps(vif, smps_mode); |
605 | } | 651 | } |
606 | 652 | ||
653 | static void iwl_mvm_diversity_iter(void *_data, u8 *mac, | ||
654 | struct ieee80211_vif *vif) | ||
655 | { | ||
656 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
657 | bool *result = _data; | ||
658 | int i; | ||
659 | |||
660 | for (i = 0; i < NUM_IWL_MVM_SMPS_REQ; i++) { | ||
661 | if (mvmvif->smps_requests[i] == IEEE80211_SMPS_STATIC || | ||
662 | mvmvif->smps_requests[i] == IEEE80211_SMPS_DYNAMIC) | ||
663 | *result = false; | ||
664 | } | ||
665 | } | ||
666 | |||
667 | bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm) | ||
668 | { | ||
669 | bool result = true; | ||
670 | |||
671 | lockdep_assert_held(&mvm->mutex); | ||
672 | |||
673 | if (num_of_ant(mvm->fw->valid_rx_ant) == 1) | ||
674 | return false; | ||
675 | |||
676 | if (!mvm->cfg->rx_with_siso_diversity) | ||
677 | return false; | ||
678 | |||
679 | ieee80211_iterate_active_interfaces_atomic( | ||
680 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | ||
681 | iwl_mvm_diversity_iter, &result); | ||
682 | |||
683 | return result; | ||
684 | } | ||
685 | |||
607 | int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 686 | int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
608 | bool value) | 687 | bool value) |
609 | { | 688 | { |
@@ -623,7 +702,7 @@ int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
623 | 702 | ||
624 | iwl_mvm_bt_coex_vif_change(mvm); | 703 | iwl_mvm_bt_coex_vif_change(mvm); |
625 | 704 | ||
626 | return iwl_mvm_power_update_mac(mvm, vif); | 705 | return iwl_mvm_power_update_mac(mvm); |
627 | } | 706 | } |
628 | 707 | ||
629 | static void iwl_mvm_ll_iter(void *_data, u8 *mac, struct ieee80211_vif *vif) | 708 | static void iwl_mvm_ll_iter(void *_data, u8 *mac, struct ieee80211_vif *vif) |
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index 3d1d57f9f5bc..7091a18d5a72 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -417,7 +417,7 @@ static u64 splx_get_pwr_limit(struct iwl_trans *trans, union acpi_object *splx) | |||
417 | splx->package.count != 2 || | 417 | splx->package.count != 2 || |
418 | splx->package.elements[0].type != ACPI_TYPE_INTEGER || | 418 | splx->package.elements[0].type != ACPI_TYPE_INTEGER || |
419 | splx->package.elements[0].integer.value != 0) { | 419 | splx->package.elements[0].integer.value != 0) { |
420 | IWL_ERR(trans, "Unsupported splx structure"); | 420 | IWL_ERR(trans, "Unsupported splx structure\n"); |
421 | return 0; | 421 | return 0; |
422 | } | 422 | } |
423 | 423 | ||
@@ -426,14 +426,14 @@ static u64 splx_get_pwr_limit(struct iwl_trans *trans, union acpi_object *splx) | |||
426 | limits->package.count < 2 || | 426 | limits->package.count < 2 || |
427 | limits->package.elements[0].type != ACPI_TYPE_INTEGER || | 427 | limits->package.elements[0].type != ACPI_TYPE_INTEGER || |
428 | limits->package.elements[1].type != ACPI_TYPE_INTEGER) { | 428 | limits->package.elements[1].type != ACPI_TYPE_INTEGER) { |
429 | IWL_ERR(trans, "Invalid limits element"); | 429 | IWL_ERR(trans, "Invalid limits element\n"); |
430 | return 0; | 430 | return 0; |
431 | } | 431 | } |
432 | 432 | ||
433 | domain_type = &limits->package.elements[0]; | 433 | domain_type = &limits->package.elements[0]; |
434 | power_limit = &limits->package.elements[1]; | 434 | power_limit = &limits->package.elements[1]; |
435 | if (!(domain_type->integer.value & SPL_DOMAINTYPE_WIFI)) { | 435 | if (!(domain_type->integer.value & SPL_DOMAINTYPE_WIFI)) { |
436 | IWL_DEBUG_INFO(trans, "WiFi power is not limited"); | 436 | IWL_DEBUG_INFO(trans, "WiFi power is not limited\n"); |
437 | return 0; | 437 | return 0; |
438 | } | 438 | } |
439 | 439 | ||
@@ -450,26 +450,26 @@ static void set_dflt_pwr_limit(struct iwl_trans *trans, struct pci_dev *pdev) | |||
450 | pxsx_handle = ACPI_HANDLE(&pdev->dev); | 450 | pxsx_handle = ACPI_HANDLE(&pdev->dev); |
451 | if (!pxsx_handle) { | 451 | if (!pxsx_handle) { |
452 | IWL_DEBUG_INFO(trans, | 452 | IWL_DEBUG_INFO(trans, |
453 | "Could not retrieve root port ACPI handle"); | 453 | "Could not retrieve root port ACPI handle\n"); |
454 | return; | 454 | return; |
455 | } | 455 | } |
456 | 456 | ||
457 | /* Get the method's handle */ | 457 | /* Get the method's handle */ |
458 | status = acpi_get_handle(pxsx_handle, (acpi_string)SPL_METHOD, &handle); | 458 | status = acpi_get_handle(pxsx_handle, (acpi_string)SPL_METHOD, &handle); |
459 | if (ACPI_FAILURE(status)) { | 459 | if (ACPI_FAILURE(status)) { |
460 | IWL_DEBUG_INFO(trans, "SPL method not found"); | 460 | IWL_DEBUG_INFO(trans, "SPL method not found\n"); |
461 | return; | 461 | return; |
462 | } | 462 | } |
463 | 463 | ||
464 | /* Call SPLC with no arguments */ | 464 | /* Call SPLC with no arguments */ |
465 | status = acpi_evaluate_object(handle, NULL, NULL, &splx); | 465 | status = acpi_evaluate_object(handle, NULL, NULL, &splx); |
466 | if (ACPI_FAILURE(status)) { | 466 | if (ACPI_FAILURE(status)) { |
467 | IWL_ERR(trans, "SPLC invocation failed (0x%x)", status); | 467 | IWL_ERR(trans, "SPLC invocation failed (0x%x)\n", status); |
468 | return; | 468 | return; |
469 | } | 469 | } |
470 | 470 | ||
471 | trans->dflt_pwr_limit = splx_get_pwr_limit(trans, splx.pointer); | 471 | trans->dflt_pwr_limit = splx_get_pwr_limit(trans, splx.pointer); |
472 | IWL_DEBUG_INFO(trans, "Default power limit set to %lld", | 472 | IWL_DEBUG_INFO(trans, "Default power limit set to %lld\n", |
473 | trans->dflt_pwr_limit); | 473 | trans->dflt_pwr_limit); |
474 | kfree(splx.pointer); | 474 | kfree(splx.pointer); |
475 | } | 475 | } |
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h index 9091513ea738..6c22b23a2845 100644 --- a/drivers/net/wireless/iwlwifi/pcie/internal.h +++ b/drivers/net/wireless/iwlwifi/pcie/internal.h | |||
@@ -102,7 +102,7 @@ struct iwl_rxq { | |||
102 | u32 write_actual; | 102 | u32 write_actual; |
103 | struct list_head rx_free; | 103 | struct list_head rx_free; |
104 | struct list_head rx_used; | 104 | struct list_head rx_used; |
105 | int need_update; | 105 | bool need_update; |
106 | struct iwl_rb_status *rb_stts; | 106 | struct iwl_rb_status *rb_stts; |
107 | dma_addr_t rb_stts_dma; | 107 | dma_addr_t rb_stts_dma; |
108 | spinlock_t lock; | 108 | spinlock_t lock; |
@@ -117,21 +117,19 @@ struct iwl_dma_ptr { | |||
117 | /** | 117 | /** |
118 | * iwl_queue_inc_wrap - increment queue index, wrap back to beginning | 118 | * iwl_queue_inc_wrap - increment queue index, wrap back to beginning |
119 | * @index -- current index | 119 | * @index -- current index |
120 | * @n_bd -- total number of entries in queue (must be power of 2) | ||
121 | */ | 120 | */ |
122 | static inline int iwl_queue_inc_wrap(int index, int n_bd) | 121 | static inline int iwl_queue_inc_wrap(int index) |
123 | { | 122 | { |
124 | return ++index & (n_bd - 1); | 123 | return ++index & (TFD_QUEUE_SIZE_MAX - 1); |
125 | } | 124 | } |
126 | 125 | ||
127 | /** | 126 | /** |
128 | * iwl_queue_dec_wrap - decrement queue index, wrap back to end | 127 | * iwl_queue_dec_wrap - decrement queue index, wrap back to end |
129 | * @index -- current index | 128 | * @index -- current index |
130 | * @n_bd -- total number of entries in queue (must be power of 2) | ||
131 | */ | 129 | */ |
132 | static inline int iwl_queue_dec_wrap(int index, int n_bd) | 130 | static inline int iwl_queue_dec_wrap(int index) |
133 | { | 131 | { |
134 | return --index & (n_bd - 1); | 132 | return --index & (TFD_QUEUE_SIZE_MAX - 1); |
135 | } | 133 | } |
136 | 134 | ||
137 | struct iwl_cmd_meta { | 135 | struct iwl_cmd_meta { |
@@ -145,13 +143,13 @@ struct iwl_cmd_meta { | |||
145 | * | 143 | * |
146 | * Contains common data for Rx and Tx queues. | 144 | * Contains common data for Rx and Tx queues. |
147 | * | 145 | * |
148 | * Note the difference between n_bd and n_window: the hardware | 146 | * Note the difference between TFD_QUEUE_SIZE_MAX and n_window: the hardware |
149 | * always assumes 256 descriptors, so n_bd is always 256 (unless | 147 | * always assumes 256 descriptors, so TFD_QUEUE_SIZE_MAX is always 256 (unless |
150 | * there might be HW changes in the future). For the normal TX | 148 | * there might be HW changes in the future). For the normal TX |
151 | * queues, n_window, which is the size of the software queue data | 149 | * queues, n_window, which is the size of the software queue data |
152 | * is also 256; however, for the command queue, n_window is only | 150 | * is also 256; however, for the command queue, n_window is only |
153 | * 32 since we don't need so many commands pending. Since the HW | 151 | * 32 since we don't need so many commands pending. Since the HW |
154 | * still uses 256 BDs for DMA though, n_bd stays 256. As a result, | 152 | * still uses 256 BDs for DMA though, TFD_QUEUE_SIZE_MAX stays 256. As a result, |
155 | * the software buffers (in the variables @meta, @txb in struct | 153 | * the software buffers (in the variables @meta, @txb in struct |
156 | * iwl_txq) only have 32 entries, while the HW buffers (@tfds in | 154 | * iwl_txq) only have 32 entries, while the HW buffers (@tfds in |
157 | * the same struct) have 256. | 155 | * the same struct) have 256. |
@@ -162,7 +160,6 @@ struct iwl_cmd_meta { | |||
162 | * data is a window overlayed over the HW queue. | 160 | * data is a window overlayed over the HW queue. |
163 | */ | 161 | */ |
164 | struct iwl_queue { | 162 | struct iwl_queue { |
165 | int n_bd; /* number of BDs in this queue */ | ||
166 | int write_ptr; /* 1-st empty entry (index) host_w*/ | 163 | int write_ptr; /* 1-st empty entry (index) host_w*/ |
167 | int read_ptr; /* last used entry (index) host_r*/ | 164 | int read_ptr; /* last used entry (index) host_r*/ |
168 | /* use for monitoring and recovering the stuck queue */ | 165 | /* use for monitoring and recovering the stuck queue */ |
@@ -231,7 +228,7 @@ struct iwl_txq { | |||
231 | spinlock_t lock; | 228 | spinlock_t lock; |
232 | struct timer_list stuck_timer; | 229 | struct timer_list stuck_timer; |
233 | struct iwl_trans_pcie *trans_pcie; | 230 | struct iwl_trans_pcie *trans_pcie; |
234 | u8 need_update; | 231 | bool need_update; |
235 | u8 active; | 232 | u8 active; |
236 | bool ampdu; | 233 | bool ampdu; |
237 | }; | 234 | }; |
@@ -270,6 +267,9 @@ struct iwl_trans_pcie { | |||
270 | struct iwl_trans *trans; | 267 | struct iwl_trans *trans; |
271 | struct iwl_drv *drv; | 268 | struct iwl_drv *drv; |
272 | 269 | ||
270 | struct net_device napi_dev; | ||
271 | struct napi_struct napi; | ||
272 | |||
273 | /* INT ICT Table */ | 273 | /* INT ICT Table */ |
274 | __le32 *ict_tbl; | 274 | __le32 *ict_tbl; |
275 | dma_addr_t ict_tbl_dma; | 275 | dma_addr_t ict_tbl_dma; |
@@ -362,7 +362,7 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo, | |||
362 | void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int queue); | 362 | void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int queue); |
363 | int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | 363 | int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, |
364 | struct iwl_device_cmd *dev_cmd, int txq_id); | 364 | struct iwl_device_cmd *dev_cmd, int txq_id); |
365 | void iwl_pcie_txq_inc_wr_ptr(struct iwl_trans *trans, struct iwl_txq *txq); | 365 | void iwl_pcie_txq_check_wrptrs(struct iwl_trans *trans); |
366 | int iwl_trans_pcie_send_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd); | 366 | int iwl_trans_pcie_send_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd); |
367 | void iwl_pcie_hcmd_complete(struct iwl_trans *trans, | 367 | void iwl_pcie_hcmd_complete(struct iwl_trans *trans, |
368 | struct iwl_rx_cmd_buffer *rxb, int handler_status); | 368 | struct iwl_rx_cmd_buffer *rxb, int handler_status); |
@@ -370,6 +370,13 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, | |||
370 | struct sk_buff_head *skbs); | 370 | struct sk_buff_head *skbs); |
371 | void iwl_trans_pcie_tx_reset(struct iwl_trans *trans); | 371 | void iwl_trans_pcie_tx_reset(struct iwl_trans *trans); |
372 | 372 | ||
373 | static inline u16 iwl_pcie_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx) | ||
374 | { | ||
375 | struct iwl_tfd_tb *tb = &tfd->tbs[idx]; | ||
376 | |||
377 | return le16_to_cpu(tb->hi_n_len) >> 4; | ||
378 | } | ||
379 | |||
373 | /***************************************************** | 380 | /***************************************************** |
374 | * Error handling | 381 | * Error handling |
375 | ******************************************************/ | 382 | ******************************************************/ |
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c index fdfa3969cac9..a2698e5e062c 100644 --- a/drivers/net/wireless/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c | |||
@@ -145,15 +145,13 @@ int iwl_pcie_rx_stop(struct iwl_trans *trans) | |||
145 | /* | 145 | /* |
146 | * iwl_pcie_rxq_inc_wr_ptr - Update the write pointer for the RX queue | 146 | * iwl_pcie_rxq_inc_wr_ptr - Update the write pointer for the RX queue |
147 | */ | 147 | */ |
148 | static void iwl_pcie_rxq_inc_wr_ptr(struct iwl_trans *trans, | 148 | static void iwl_pcie_rxq_inc_wr_ptr(struct iwl_trans *trans) |
149 | struct iwl_rxq *rxq) | ||
150 | { | 149 | { |
150 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
151 | struct iwl_rxq *rxq = &trans_pcie->rxq; | ||
151 | u32 reg; | 152 | u32 reg; |
152 | 153 | ||
153 | spin_lock(&rxq->lock); | 154 | lockdep_assert_held(&rxq->lock); |
154 | |||
155 | if (rxq->need_update == 0) | ||
156 | goto exit_unlock; | ||
157 | 155 | ||
158 | /* | 156 | /* |
159 | * explicitly wake up the NIC if: | 157 | * explicitly wake up the NIC if: |
@@ -169,13 +167,27 @@ static void iwl_pcie_rxq_inc_wr_ptr(struct iwl_trans *trans, | |||
169 | reg); | 167 | reg); |
170 | iwl_set_bit(trans, CSR_GP_CNTRL, | 168 | iwl_set_bit(trans, CSR_GP_CNTRL, |
171 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 169 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
172 | goto exit_unlock; | 170 | rxq->need_update = true; |
171 | return; | ||
173 | } | 172 | } |
174 | } | 173 | } |
175 | 174 | ||
176 | rxq->write_actual = round_down(rxq->write, 8); | 175 | rxq->write_actual = round_down(rxq->write, 8); |
177 | iwl_write32(trans, FH_RSCSR_CHNL0_WPTR, rxq->write_actual); | 176 | iwl_write32(trans, FH_RSCSR_CHNL0_WPTR, rxq->write_actual); |
178 | rxq->need_update = 0; | 177 | } |
178 | |||
179 | static void iwl_pcie_rxq_check_wrptr(struct iwl_trans *trans) | ||
180 | { | ||
181 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
182 | struct iwl_rxq *rxq = &trans_pcie->rxq; | ||
183 | |||
184 | spin_lock(&rxq->lock); | ||
185 | |||
186 | if (!rxq->need_update) | ||
187 | goto exit_unlock; | ||
188 | |||
189 | iwl_pcie_rxq_inc_wr_ptr(trans); | ||
190 | rxq->need_update = false; | ||
179 | 191 | ||
180 | exit_unlock: | 192 | exit_unlock: |
181 | spin_unlock(&rxq->lock); | 193 | spin_unlock(&rxq->lock); |
@@ -236,9 +248,8 @@ static void iwl_pcie_rxq_restock(struct iwl_trans *trans) | |||
236 | * Increment device's write pointer in multiples of 8. */ | 248 | * Increment device's write pointer in multiples of 8. */ |
237 | if (rxq->write_actual != (rxq->write & ~0x7)) { | 249 | if (rxq->write_actual != (rxq->write & ~0x7)) { |
238 | spin_lock(&rxq->lock); | 250 | spin_lock(&rxq->lock); |
239 | rxq->need_update = 1; | 251 | iwl_pcie_rxq_inc_wr_ptr(trans); |
240 | spin_unlock(&rxq->lock); | 252 | spin_unlock(&rxq->lock); |
241 | iwl_pcie_rxq_inc_wr_ptr(trans, rxq); | ||
242 | } | 253 | } |
243 | } | 254 | } |
244 | 255 | ||
@@ -362,20 +373,9 @@ static void iwl_pcie_rxq_free_rbs(struct iwl_trans *trans) | |||
362 | * Also restock the Rx queue via iwl_pcie_rxq_restock. | 373 | * Also restock the Rx queue via iwl_pcie_rxq_restock. |
363 | * This is called as a scheduled work item (except for during initialization) | 374 | * This is called as a scheduled work item (except for during initialization) |
364 | */ | 375 | */ |
365 | static void iwl_pcie_rx_replenish(struct iwl_trans *trans) | 376 | static void iwl_pcie_rx_replenish(struct iwl_trans *trans, gfp_t gfp) |
366 | { | ||
367 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
368 | |||
369 | iwl_pcie_rxq_alloc_rbs(trans, GFP_KERNEL); | ||
370 | |||
371 | spin_lock(&trans_pcie->irq_lock); | ||
372 | iwl_pcie_rxq_restock(trans); | ||
373 | spin_unlock(&trans_pcie->irq_lock); | ||
374 | } | ||
375 | |||
376 | static void iwl_pcie_rx_replenish_now(struct iwl_trans *trans) | ||
377 | { | 377 | { |
378 | iwl_pcie_rxq_alloc_rbs(trans, GFP_ATOMIC); | 378 | iwl_pcie_rxq_alloc_rbs(trans, gfp); |
379 | 379 | ||
380 | iwl_pcie_rxq_restock(trans); | 380 | iwl_pcie_rxq_restock(trans); |
381 | } | 381 | } |
@@ -385,7 +385,7 @@ static void iwl_pcie_rx_replenish_work(struct work_struct *data) | |||
385 | struct iwl_trans_pcie *trans_pcie = | 385 | struct iwl_trans_pcie *trans_pcie = |
386 | container_of(data, struct iwl_trans_pcie, rx_replenish); | 386 | container_of(data, struct iwl_trans_pcie, rx_replenish); |
387 | 387 | ||
388 | iwl_pcie_rx_replenish(trans_pcie->trans); | 388 | iwl_pcie_rx_replenish(trans_pcie->trans, GFP_KERNEL); |
389 | } | 389 | } |
390 | 390 | ||
391 | static int iwl_pcie_rx_alloc(struct iwl_trans *trans) | 391 | static int iwl_pcie_rx_alloc(struct iwl_trans *trans) |
@@ -521,14 +521,13 @@ int iwl_pcie_rx_init(struct iwl_trans *trans) | |||
521 | memset(rxq->rb_stts, 0, sizeof(*rxq->rb_stts)); | 521 | memset(rxq->rb_stts, 0, sizeof(*rxq->rb_stts)); |
522 | spin_unlock(&rxq->lock); | 522 | spin_unlock(&rxq->lock); |
523 | 523 | ||
524 | iwl_pcie_rx_replenish(trans); | 524 | iwl_pcie_rx_replenish(trans, GFP_KERNEL); |
525 | 525 | ||
526 | iwl_pcie_rx_hw_init(trans, rxq); | 526 | iwl_pcie_rx_hw_init(trans, rxq); |
527 | 527 | ||
528 | spin_lock(&trans_pcie->irq_lock); | 528 | spin_lock(&rxq->lock); |
529 | rxq->need_update = 1; | 529 | iwl_pcie_rxq_inc_wr_ptr(trans); |
530 | iwl_pcie_rxq_inc_wr_ptr(trans, rxq); | 530 | spin_unlock(&rxq->lock); |
531 | spin_unlock(&trans_pcie->irq_lock); | ||
532 | 531 | ||
533 | return 0; | 532 | return 0; |
534 | } | 533 | } |
@@ -673,7 +672,6 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans, | |||
673 | /* Reuse the page if possible. For notification packets and | 672 | /* Reuse the page if possible. For notification packets and |
674 | * SKBs that fail to Rx correctly, add them back into the | 673 | * SKBs that fail to Rx correctly, add them back into the |
675 | * rx_free list for reuse later. */ | 674 | * rx_free list for reuse later. */ |
676 | spin_lock(&rxq->lock); | ||
677 | if (rxb->page != NULL) { | 675 | if (rxb->page != NULL) { |
678 | rxb->page_dma = | 676 | rxb->page_dma = |
679 | dma_map_page(trans->dev, rxb->page, 0, | 677 | dma_map_page(trans->dev, rxb->page, 0, |
@@ -694,7 +692,6 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans, | |||
694 | } | 692 | } |
695 | } else | 693 | } else |
696 | list_add_tail(&rxb->list, &rxq->rx_used); | 694 | list_add_tail(&rxb->list, &rxq->rx_used); |
697 | spin_unlock(&rxq->lock); | ||
698 | } | 695 | } |
699 | 696 | ||
700 | /* | 697 | /* |
@@ -709,6 +706,8 @@ static void iwl_pcie_rx_handle(struct iwl_trans *trans) | |||
709 | u32 count = 8; | 706 | u32 count = 8; |
710 | int total_empty; | 707 | int total_empty; |
711 | 708 | ||
709 | restart: | ||
710 | spin_lock(&rxq->lock); | ||
712 | /* uCode's read index (stored in shared DRAM) indicates the last Rx | 711 | /* uCode's read index (stored in shared DRAM) indicates the last Rx |
713 | * buffer that the driver may process (last buffer filled by ucode). */ | 712 | * buffer that the driver may process (last buffer filled by ucode). */ |
714 | r = le16_to_cpu(ACCESS_ONCE(rxq->rb_stts->closed_rb_num)) & 0x0FFF; | 713 | r = le16_to_cpu(ACCESS_ONCE(rxq->rb_stts->closed_rb_num)) & 0x0FFF; |
@@ -743,18 +742,25 @@ static void iwl_pcie_rx_handle(struct iwl_trans *trans) | |||
743 | count++; | 742 | count++; |
744 | if (count >= 8) { | 743 | if (count >= 8) { |
745 | rxq->read = i; | 744 | rxq->read = i; |
746 | iwl_pcie_rx_replenish_now(trans); | 745 | spin_unlock(&rxq->lock); |
746 | iwl_pcie_rx_replenish(trans, GFP_ATOMIC); | ||
747 | count = 0; | 747 | count = 0; |
748 | goto restart; | ||
748 | } | 749 | } |
749 | } | 750 | } |
750 | } | 751 | } |
751 | 752 | ||
752 | /* Backtrack one entry */ | 753 | /* Backtrack one entry */ |
753 | rxq->read = i; | 754 | rxq->read = i; |
755 | spin_unlock(&rxq->lock); | ||
756 | |||
754 | if (fill_rx) | 757 | if (fill_rx) |
755 | iwl_pcie_rx_replenish_now(trans); | 758 | iwl_pcie_rx_replenish(trans, GFP_ATOMIC); |
756 | else | 759 | else |
757 | iwl_pcie_rxq_restock(trans); | 760 | iwl_pcie_rxq_restock(trans); |
761 | |||
762 | if (trans_pcie->napi.poll) | ||
763 | napi_gro_flush(&trans_pcie->napi, false); | ||
758 | } | 764 | } |
759 | 765 | ||
760 | /* | 766 | /* |
@@ -844,7 +850,7 @@ static u32 iwl_pcie_int_cause_ict(struct iwl_trans *trans) | |||
844 | trans_pcie->ict_index, read); | 850 | trans_pcie->ict_index, read); |
845 | trans_pcie->ict_tbl[trans_pcie->ict_index] = 0; | 851 | trans_pcie->ict_tbl[trans_pcie->ict_index] = 0; |
846 | trans_pcie->ict_index = | 852 | trans_pcie->ict_index = |
847 | iwl_queue_inc_wrap(trans_pcie->ict_index, ICT_COUNT); | 853 | ((trans_pcie->ict_index + 1) & (ICT_COUNT - 1)); |
848 | 854 | ||
849 | read = le32_to_cpu(trans_pcie->ict_tbl[trans_pcie->ict_index]); | 855 | read = le32_to_cpu(trans_pcie->ict_tbl[trans_pcie->ict_index]); |
850 | trace_iwlwifi_dev_ict_read(trans->dev, trans_pcie->ict_index, | 856 | trace_iwlwifi_dev_ict_read(trans->dev, trans_pcie->ict_index, |
@@ -876,7 +882,6 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) | |||
876 | struct isr_statistics *isr_stats = &trans_pcie->isr_stats; | 882 | struct isr_statistics *isr_stats = &trans_pcie->isr_stats; |
877 | u32 inta = 0; | 883 | u32 inta = 0; |
878 | u32 handled = 0; | 884 | u32 handled = 0; |
879 | u32 i; | ||
880 | 885 | ||
881 | lock_map_acquire(&trans->sync_cmd_lockdep_map); | 886 | lock_map_acquire(&trans->sync_cmd_lockdep_map); |
882 | 887 | ||
@@ -1028,9 +1033,8 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) | |||
1028 | /* uCode wakes up after power-down sleep */ | 1033 | /* uCode wakes up after power-down sleep */ |
1029 | if (inta & CSR_INT_BIT_WAKEUP) { | 1034 | if (inta & CSR_INT_BIT_WAKEUP) { |
1030 | IWL_DEBUG_ISR(trans, "Wakeup interrupt\n"); | 1035 | IWL_DEBUG_ISR(trans, "Wakeup interrupt\n"); |
1031 | iwl_pcie_rxq_inc_wr_ptr(trans, &trans_pcie->rxq); | 1036 | iwl_pcie_rxq_check_wrptr(trans); |
1032 | for (i = 0; i < trans->cfg->base_params->num_of_queues; i++) | 1037 | iwl_pcie_txq_check_wrptrs(trans); |
1033 | iwl_pcie_txq_inc_wr_ptr(trans, &trans_pcie->txq[i]); | ||
1034 | 1038 | ||
1035 | isr_stats->wakeup++; | 1039 | isr_stats->wakeup++; |
1036 | 1040 | ||
@@ -1068,8 +1072,6 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) | |||
1068 | iwl_write8(trans, CSR_INT_PERIODIC_REG, | 1072 | iwl_write8(trans, CSR_INT_PERIODIC_REG, |
1069 | CSR_INT_PERIODIC_DIS); | 1073 | CSR_INT_PERIODIC_DIS); |
1070 | 1074 | ||
1071 | iwl_pcie_rx_handle(trans); | ||
1072 | |||
1073 | /* | 1075 | /* |
1074 | * Enable periodic interrupt in 8 msec only if we received | 1076 | * Enable periodic interrupt in 8 msec only if we received |
1075 | * real RX interrupt (instead of just periodic int), to catch | 1077 | * real RX interrupt (instead of just periodic int), to catch |
@@ -1082,6 +1084,10 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) | |||
1082 | CSR_INT_PERIODIC_ENA); | 1084 | CSR_INT_PERIODIC_ENA); |
1083 | 1085 | ||
1084 | isr_stats->rx++; | 1086 | isr_stats->rx++; |
1087 | |||
1088 | local_bh_disable(); | ||
1089 | iwl_pcie_rx_handle(trans); | ||
1090 | local_bh_enable(); | ||
1085 | } | 1091 | } |
1086 | 1092 | ||
1087 | /* This "Tx" DMA channel is used only for loading uCode */ | 1093 | /* This "Tx" DMA channel is used only for loading uCode */ |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 2365553f1ef7..788085bc65d7 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -73,6 +73,7 @@ | |||
73 | #include "iwl-csr.h" | 73 | #include "iwl-csr.h" |
74 | #include "iwl-prph.h" | 74 | #include "iwl-prph.h" |
75 | #include "iwl-agn-hw.h" | 75 | #include "iwl-agn-hw.h" |
76 | #include "iwl-fw-error-dump.h" | ||
76 | #include "internal.h" | 77 | #include "internal.h" |
77 | 78 | ||
78 | static u32 iwl_trans_pcie_read_shr(struct iwl_trans *trans, u32 reg) | 79 | static u32 iwl_trans_pcie_read_shr(struct iwl_trans *trans, u32 reg) |
@@ -103,7 +104,6 @@ static void iwl_pcie_set_pwr(struct iwl_trans *trans, bool vaux) | |||
103 | 104 | ||
104 | /* PCI registers */ | 105 | /* PCI registers */ |
105 | #define PCI_CFG_RETRY_TIMEOUT 0x041 | 106 | #define PCI_CFG_RETRY_TIMEOUT 0x041 |
106 | #define CPU1_CPU2_SEPARATOR_SECTION 0xFFFFCCCC | ||
107 | 107 | ||
108 | static void iwl_pcie_apm_config(struct iwl_trans *trans) | 108 | static void iwl_pcie_apm_config(struct iwl_trans *trans) |
109 | { | 109 | { |
@@ -454,6 +454,7 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) | |||
454 | { | 454 | { |
455 | int ret; | 455 | int ret; |
456 | int t = 0; | 456 | int t = 0; |
457 | int iter; | ||
457 | 458 | ||
458 | IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n"); | 459 | IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n"); |
459 | 460 | ||
@@ -462,18 +463,23 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) | |||
462 | if (ret >= 0) | 463 | if (ret >= 0) |
463 | return 0; | 464 | return 0; |
464 | 465 | ||
465 | /* If HW is not ready, prepare the conditions to check again */ | 466 | for (iter = 0; iter < 10; iter++) { |
466 | iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, | 467 | /* If HW is not ready, prepare the conditions to check again */ |
467 | CSR_HW_IF_CONFIG_REG_PREPARE); | 468 | iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, |
469 | CSR_HW_IF_CONFIG_REG_PREPARE); | ||
470 | |||
471 | do { | ||
472 | ret = iwl_pcie_set_hw_ready(trans); | ||
473 | if (ret >= 0) | ||
474 | return 0; | ||
468 | 475 | ||
469 | do { | 476 | usleep_range(200, 1000); |
470 | ret = iwl_pcie_set_hw_ready(trans); | 477 | t += 200; |
471 | if (ret >= 0) | 478 | } while (t < 150000); |
472 | return 0; | 479 | msleep(25); |
480 | } | ||
473 | 481 | ||
474 | usleep_range(200, 1000); | 482 | IWL_DEBUG_INFO(trans, "got NIC after %d iterations\n", iter); |
475 | t += 200; | ||
476 | } while (t < 150000); | ||
477 | 483 | ||
478 | return ret; | 484 | return ret; |
479 | } | 485 | } |
@@ -1053,6 +1059,12 @@ static void iwl_trans_pcie_write_prph(struct iwl_trans *trans, u32 addr, | |||
1053 | iwl_trans_pcie_write32(trans, HBUS_TARG_PRPH_WDAT, val); | 1059 | iwl_trans_pcie_write32(trans, HBUS_TARG_PRPH_WDAT, val); |
1054 | } | 1060 | } |
1055 | 1061 | ||
1062 | static int iwl_pcie_dummy_napi_poll(struct napi_struct *napi, int budget) | ||
1063 | { | ||
1064 | WARN_ON(1); | ||
1065 | return 0; | ||
1066 | } | ||
1067 | |||
1056 | static void iwl_trans_pcie_configure(struct iwl_trans *trans, | 1068 | static void iwl_trans_pcie_configure(struct iwl_trans *trans, |
1057 | const struct iwl_trans_config *trans_cfg) | 1069 | const struct iwl_trans_config *trans_cfg) |
1058 | { | 1070 | { |
@@ -1079,6 +1091,18 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans, | |||
1079 | 1091 | ||
1080 | trans_pcie->command_names = trans_cfg->command_names; | 1092 | trans_pcie->command_names = trans_cfg->command_names; |
1081 | trans_pcie->bc_table_dword = trans_cfg->bc_table_dword; | 1093 | trans_pcie->bc_table_dword = trans_cfg->bc_table_dword; |
1094 | |||
1095 | /* Initialize NAPI here - it should be before registering to mac80211 | ||
1096 | * in the opmode but after the HW struct is allocated. | ||
1097 | * As this function may be called again in some corner cases don't | ||
1098 | * do anything if NAPI was already initialized. | ||
1099 | */ | ||
1100 | if (!trans_pcie->napi.poll && trans->op_mode->ops->napi_add) { | ||
1101 | init_dummy_netdev(&trans_pcie->napi_dev); | ||
1102 | iwl_op_mode_napi_add(trans->op_mode, &trans_pcie->napi, | ||
1103 | &trans_pcie->napi_dev, | ||
1104 | iwl_pcie_dummy_napi_poll, 64); | ||
1105 | } | ||
1082 | } | 1106 | } |
1083 | 1107 | ||
1084 | void iwl_trans_pcie_free(struct iwl_trans *trans) | 1108 | void iwl_trans_pcie_free(struct iwl_trans *trans) |
@@ -1099,6 +1123,9 @@ void iwl_trans_pcie_free(struct iwl_trans *trans) | |||
1099 | pci_disable_device(trans_pcie->pci_dev); | 1123 | pci_disable_device(trans_pcie->pci_dev); |
1100 | kmem_cache_destroy(trans->dev_cmd_pool); | 1124 | kmem_cache_destroy(trans->dev_cmd_pool); |
1101 | 1125 | ||
1126 | if (trans_pcie->napi.poll) | ||
1127 | netif_napi_del(&trans_pcie->napi); | ||
1128 | |||
1102 | kfree(trans); | 1129 | kfree(trans); |
1103 | } | 1130 | } |
1104 | 1131 | ||
@@ -1237,7 +1264,7 @@ static int iwl_trans_pcie_write_mem(struct iwl_trans *trans, u32 addr, | |||
1237 | 1264 | ||
1238 | #define IWL_FLUSH_WAIT_MS 2000 | 1265 | #define IWL_FLUSH_WAIT_MS 2000 |
1239 | 1266 | ||
1240 | static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans) | 1267 | static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans, u32 txq_bm) |
1241 | { | 1268 | { |
1242 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 1269 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
1243 | struct iwl_txq *txq; | 1270 | struct iwl_txq *txq; |
@@ -1250,13 +1277,31 @@ static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans) | |||
1250 | 1277 | ||
1251 | /* waiting for all the tx frames complete might take a while */ | 1278 | /* waiting for all the tx frames complete might take a while */ |
1252 | for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) { | 1279 | for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) { |
1280 | u8 wr_ptr; | ||
1281 | |||
1253 | if (cnt == trans_pcie->cmd_queue) | 1282 | if (cnt == trans_pcie->cmd_queue) |
1254 | continue; | 1283 | continue; |
1284 | if (!test_bit(cnt, trans_pcie->queue_used)) | ||
1285 | continue; | ||
1286 | if (!(BIT(cnt) & txq_bm)) | ||
1287 | continue; | ||
1288 | |||
1289 | IWL_DEBUG_TX_QUEUES(trans, "Emptying queue %d...\n", cnt); | ||
1255 | txq = &trans_pcie->txq[cnt]; | 1290 | txq = &trans_pcie->txq[cnt]; |
1256 | q = &txq->q; | 1291 | q = &txq->q; |
1257 | while (q->read_ptr != q->write_ptr && !time_after(jiffies, | 1292 | wr_ptr = ACCESS_ONCE(q->write_ptr); |
1258 | now + msecs_to_jiffies(IWL_FLUSH_WAIT_MS))) | 1293 | |
1294 | while (q->read_ptr != ACCESS_ONCE(q->write_ptr) && | ||
1295 | !time_after(jiffies, | ||
1296 | now + msecs_to_jiffies(IWL_FLUSH_WAIT_MS))) { | ||
1297 | u8 write_ptr = ACCESS_ONCE(q->write_ptr); | ||
1298 | |||
1299 | if (WARN_ONCE(wr_ptr != write_ptr, | ||
1300 | "WR pointer moved while flushing %d -> %d\n", | ||
1301 | wr_ptr, write_ptr)) | ||
1302 | return -ETIMEDOUT; | ||
1259 | msleep(1); | 1303 | msleep(1); |
1304 | } | ||
1260 | 1305 | ||
1261 | if (q->read_ptr != q->write_ptr) { | 1306 | if (q->read_ptr != q->write_ptr) { |
1262 | IWL_ERR(trans, | 1307 | IWL_ERR(trans, |
@@ -1264,6 +1309,7 @@ static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans) | |||
1264 | ret = -ETIMEDOUT; | 1309 | ret = -ETIMEDOUT; |
1265 | break; | 1310 | break; |
1266 | } | 1311 | } |
1312 | IWL_DEBUG_TX_QUEUES(trans, "Queue %d is now empty.\n", cnt); | ||
1267 | } | 1313 | } |
1268 | 1314 | ||
1269 | if (!ret) | 1315 | if (!ret) |
@@ -1298,8 +1344,8 @@ static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans) | |||
1298 | IWL_ERR(trans, | 1344 | IWL_ERR(trans, |
1299 | "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", | 1345 | "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", |
1300 | cnt, active ? "" : "in", fifo, tbl_dw, | 1346 | cnt, active ? "" : "in", fifo, tbl_dw, |
1301 | iwl_read_prph(trans, | 1347 | iwl_read_prph(trans, SCD_QUEUE_RDPTR(cnt)) & |
1302 | SCD_QUEUE_RDPTR(cnt)) & (txq->q.n_bd - 1), | 1348 | (TFD_QUEUE_SIZE_MAX - 1), |
1303 | iwl_read_prph(trans, SCD_QUEUE_WRPTR(cnt))); | 1349 | iwl_read_prph(trans, SCD_QUEUE_WRPTR(cnt))); |
1304 | } | 1350 | } |
1305 | 1351 | ||
@@ -1630,6 +1676,61 @@ err: | |||
1630 | IWL_ERR(trans, "failed to create the trans debugfs entry\n"); | 1676 | IWL_ERR(trans, "failed to create the trans debugfs entry\n"); |
1631 | return -ENOMEM; | 1677 | return -ENOMEM; |
1632 | } | 1678 | } |
1679 | |||
1680 | static u32 iwl_trans_pcie_get_cmdlen(struct iwl_tfd *tfd) | ||
1681 | { | ||
1682 | u32 cmdlen = 0; | ||
1683 | int i; | ||
1684 | |||
1685 | for (i = 0; i < IWL_NUM_OF_TBS; i++) | ||
1686 | cmdlen += iwl_pcie_tfd_tb_get_len(tfd, i); | ||
1687 | |||
1688 | return cmdlen; | ||
1689 | } | ||
1690 | |||
1691 | static u32 iwl_trans_pcie_dump_data(struct iwl_trans *trans, | ||
1692 | void *buf, u32 buflen) | ||
1693 | { | ||
1694 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
1695 | struct iwl_fw_error_dump_data *data; | ||
1696 | struct iwl_txq *cmdq = &trans_pcie->txq[trans_pcie->cmd_queue]; | ||
1697 | struct iwl_fw_error_dump_txcmd *txcmd; | ||
1698 | u32 len; | ||
1699 | int i, ptr; | ||
1700 | |||
1701 | if (!buf) | ||
1702 | return sizeof(*data) + | ||
1703 | cmdq->q.n_window * (sizeof(*txcmd) + | ||
1704 | TFD_MAX_PAYLOAD_SIZE); | ||
1705 | |||
1706 | len = 0; | ||
1707 | data = buf; | ||
1708 | data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_TXCMD); | ||
1709 | txcmd = (void *)data->data; | ||
1710 | spin_lock_bh(&cmdq->lock); | ||
1711 | ptr = cmdq->q.write_ptr; | ||
1712 | for (i = 0; i < cmdq->q.n_window; i++) { | ||
1713 | u8 idx = get_cmd_index(&cmdq->q, ptr); | ||
1714 | u32 caplen, cmdlen; | ||
1715 | |||
1716 | cmdlen = iwl_trans_pcie_get_cmdlen(&cmdq->tfds[ptr]); | ||
1717 | caplen = min_t(u32, TFD_MAX_PAYLOAD_SIZE, cmdlen); | ||
1718 | |||
1719 | if (cmdlen) { | ||
1720 | len += sizeof(*txcmd) + caplen; | ||
1721 | txcmd->cmdlen = cpu_to_le32(cmdlen); | ||
1722 | txcmd->caplen = cpu_to_le32(caplen); | ||
1723 | memcpy(txcmd->data, cmdq->entries[idx].cmd, caplen); | ||
1724 | txcmd = (void *)((u8 *)txcmd->data + caplen); | ||
1725 | } | ||
1726 | |||
1727 | ptr = iwl_queue_dec_wrap(ptr); | ||
1728 | } | ||
1729 | spin_unlock_bh(&cmdq->lock); | ||
1730 | |||
1731 | data->len = cpu_to_le32(len); | ||
1732 | return sizeof(*data) + len; | ||
1733 | } | ||
1633 | #else | 1734 | #else |
1634 | static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, | 1735 | static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, |
1635 | struct dentry *dir) | 1736 | struct dentry *dir) |
@@ -1672,6 +1773,10 @@ static const struct iwl_trans_ops trans_ops_pcie = { | |||
1672 | .grab_nic_access = iwl_trans_pcie_grab_nic_access, | 1773 | .grab_nic_access = iwl_trans_pcie_grab_nic_access, |
1673 | .release_nic_access = iwl_trans_pcie_release_nic_access, | 1774 | .release_nic_access = iwl_trans_pcie_release_nic_access, |
1674 | .set_bits_mask = iwl_trans_pcie_set_bits_mask, | 1775 | .set_bits_mask = iwl_trans_pcie_set_bits_mask, |
1776 | |||
1777 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
1778 | .dump_data = iwl_trans_pcie_dump_data, | ||
1779 | #endif | ||
1675 | }; | 1780 | }; |
1676 | 1781 | ||
1677 | struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | 1782 | struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, |
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c index 3b0c72c10054..038940afbdc5 100644 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | |||
@@ -70,20 +70,20 @@ static int iwl_queue_space(const struct iwl_queue *q) | |||
70 | 70 | ||
71 | /* | 71 | /* |
72 | * To avoid ambiguity between empty and completely full queues, there | 72 | * To avoid ambiguity between empty and completely full queues, there |
73 | * should always be less than q->n_bd elements in the queue. | 73 | * should always be less than TFD_QUEUE_SIZE_MAX elements in the queue. |
74 | * If q->n_window is smaller than q->n_bd, there is no need to reserve | 74 | * If q->n_window is smaller than TFD_QUEUE_SIZE_MAX, there is no need |
75 | * any queue entries for this purpose. | 75 | * to reserve any queue entries for this purpose. |
76 | */ | 76 | */ |
77 | if (q->n_window < q->n_bd) | 77 | if (q->n_window < TFD_QUEUE_SIZE_MAX) |
78 | max = q->n_window; | 78 | max = q->n_window; |
79 | else | 79 | else |
80 | max = q->n_bd - 1; | 80 | max = TFD_QUEUE_SIZE_MAX - 1; |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * q->n_bd is a power of 2, so the following is equivalent to modulo by | 83 | * TFD_QUEUE_SIZE_MAX is a power of 2, so the following is equivalent to |
84 | * q->n_bd and is well defined for negative dividends. | 84 | * modulo by TFD_QUEUE_SIZE_MAX and is well defined. |
85 | */ | 85 | */ |
86 | used = (q->write_ptr - q->read_ptr) & (q->n_bd - 1); | 86 | used = (q->write_ptr - q->read_ptr) & (TFD_QUEUE_SIZE_MAX - 1); |
87 | 87 | ||
88 | if (WARN_ON(used > max)) | 88 | if (WARN_ON(used > max)) |
89 | return 0; | 89 | return 0; |
@@ -94,17 +94,11 @@ static int iwl_queue_space(const struct iwl_queue *q) | |||
94 | /* | 94 | /* |
95 | * iwl_queue_init - Initialize queue's high/low-water and read/write indexes | 95 | * iwl_queue_init - Initialize queue's high/low-water and read/write indexes |
96 | */ | 96 | */ |
97 | static int iwl_queue_init(struct iwl_queue *q, int count, int slots_num, u32 id) | 97 | static int iwl_queue_init(struct iwl_queue *q, int slots_num, u32 id) |
98 | { | 98 | { |
99 | q->n_bd = count; | ||
100 | q->n_window = slots_num; | 99 | q->n_window = slots_num; |
101 | q->id = id; | 100 | q->id = id; |
102 | 101 | ||
103 | /* count must be power-of-two size, otherwise iwl_queue_inc_wrap | ||
104 | * and iwl_queue_dec_wrap are broken. */ | ||
105 | if (WARN_ON(!is_power_of_2(count))) | ||
106 | return -EINVAL; | ||
107 | |||
108 | /* slots_num must be power-of-two size, otherwise | 102 | /* slots_num must be power-of-two size, otherwise |
109 | * get_cmd_index is broken. */ | 103 | * get_cmd_index is broken. */ |
110 | if (WARN_ON(!is_power_of_2(slots_num))) | 104 | if (WARN_ON(!is_power_of_2(slots_num))) |
@@ -197,17 +191,17 @@ static void iwl_pcie_txq_stuck_timer(unsigned long data) | |||
197 | IWL_ERR(trans, | 191 | IWL_ERR(trans, |
198 | "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", | 192 | "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", |
199 | i, active ? "" : "in", fifo, tbl_dw, | 193 | i, active ? "" : "in", fifo, tbl_dw, |
200 | iwl_read_prph(trans, | 194 | iwl_read_prph(trans, SCD_QUEUE_RDPTR(i)) & |
201 | SCD_QUEUE_RDPTR(i)) & (txq->q.n_bd - 1), | 195 | (TFD_QUEUE_SIZE_MAX - 1), |
202 | iwl_read_prph(trans, SCD_QUEUE_WRPTR(i))); | 196 | iwl_read_prph(trans, SCD_QUEUE_WRPTR(i))); |
203 | } | 197 | } |
204 | 198 | ||
205 | for (i = q->read_ptr; i != q->write_ptr; | 199 | for (i = q->read_ptr; i != q->write_ptr; |
206 | i = iwl_queue_inc_wrap(i, q->n_bd)) | 200 | i = iwl_queue_inc_wrap(i)) |
207 | IWL_ERR(trans, "scratch %d = 0x%08x\n", i, | 201 | IWL_ERR(trans, "scratch %d = 0x%08x\n", i, |
208 | le32_to_cpu(txq->scratchbufs[i].scratch)); | 202 | le32_to_cpu(txq->scratchbufs[i].scratch)); |
209 | 203 | ||
210 | iwl_write_prph(trans, DEVICE_SET_NMI_REG, 1); | 204 | iwl_force_nmi(trans); |
211 | } | 205 | } |
212 | 206 | ||
213 | /* | 207 | /* |
@@ -287,14 +281,14 @@ static void iwl_pcie_txq_inval_byte_cnt_tbl(struct iwl_trans *trans, | |||
287 | /* | 281 | /* |
288 | * iwl_pcie_txq_inc_wr_ptr - Send new write index to hardware | 282 | * iwl_pcie_txq_inc_wr_ptr - Send new write index to hardware |
289 | */ | 283 | */ |
290 | void iwl_pcie_txq_inc_wr_ptr(struct iwl_trans *trans, struct iwl_txq *txq) | 284 | static void iwl_pcie_txq_inc_wr_ptr(struct iwl_trans *trans, |
285 | struct iwl_txq *txq) | ||
291 | { | 286 | { |
292 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 287 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
293 | u32 reg = 0; | 288 | u32 reg = 0; |
294 | int txq_id = txq->q.id; | 289 | int txq_id = txq->q.id; |
295 | 290 | ||
296 | if (txq->need_update == 0) | 291 | lockdep_assert_held(&txq->lock); |
297 | return; | ||
298 | 292 | ||
299 | /* | 293 | /* |
300 | * explicitly wake up the NIC if: | 294 | * explicitly wake up the NIC if: |
@@ -317,6 +311,7 @@ void iwl_pcie_txq_inc_wr_ptr(struct iwl_trans *trans, struct iwl_txq *txq) | |||
317 | txq_id, reg); | 311 | txq_id, reg); |
318 | iwl_set_bit(trans, CSR_GP_CNTRL, | 312 | iwl_set_bit(trans, CSR_GP_CNTRL, |
319 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 313 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
314 | txq->need_update = true; | ||
320 | return; | 315 | return; |
321 | } | 316 | } |
322 | } | 317 | } |
@@ -327,8 +322,23 @@ void iwl_pcie_txq_inc_wr_ptr(struct iwl_trans *trans, struct iwl_txq *txq) | |||
327 | */ | 322 | */ |
328 | IWL_DEBUG_TX(trans, "Q:%d WR: 0x%x\n", txq_id, txq->q.write_ptr); | 323 | IWL_DEBUG_TX(trans, "Q:%d WR: 0x%x\n", txq_id, txq->q.write_ptr); |
329 | iwl_write32(trans, HBUS_TARG_WRPTR, txq->q.write_ptr | (txq_id << 8)); | 324 | iwl_write32(trans, HBUS_TARG_WRPTR, txq->q.write_ptr | (txq_id << 8)); |
325 | } | ||
326 | |||
327 | void iwl_pcie_txq_check_wrptrs(struct iwl_trans *trans) | ||
328 | { | ||
329 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
330 | int i; | ||
331 | |||
332 | for (i = 0; i < trans->cfg->base_params->num_of_queues; i++) { | ||
333 | struct iwl_txq *txq = &trans_pcie->txq[i]; | ||
330 | 334 | ||
331 | txq->need_update = 0; | 335 | spin_lock_bh(&txq->lock); |
336 | if (trans_pcie->txq[i].need_update) { | ||
337 | iwl_pcie_txq_inc_wr_ptr(trans, txq); | ||
338 | trans_pcie->txq[i].need_update = false; | ||
339 | } | ||
340 | spin_unlock_bh(&txq->lock); | ||
341 | } | ||
332 | } | 342 | } |
333 | 343 | ||
334 | static inline dma_addr_t iwl_pcie_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx) | 344 | static inline dma_addr_t iwl_pcie_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx) |
@@ -343,13 +353,6 @@ static inline dma_addr_t iwl_pcie_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx) | |||
343 | return addr; | 353 | return addr; |
344 | } | 354 | } |
345 | 355 | ||
346 | static inline u16 iwl_pcie_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx) | ||
347 | { | ||
348 | struct iwl_tfd_tb *tb = &tfd->tbs[idx]; | ||
349 | |||
350 | return le16_to_cpu(tb->hi_n_len) >> 4; | ||
351 | } | ||
352 | |||
353 | static inline void iwl_pcie_tfd_set_tb(struct iwl_tfd *tfd, u8 idx, | 356 | static inline void iwl_pcie_tfd_set_tb(struct iwl_tfd *tfd, u8 idx, |
354 | dma_addr_t addr, u16 len) | 357 | dma_addr_t addr, u16 len) |
355 | { | 358 | { |
@@ -409,13 +412,17 @@ static void iwl_pcie_txq_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq) | |||
409 | { | 412 | { |
410 | struct iwl_tfd *tfd_tmp = txq->tfds; | 413 | struct iwl_tfd *tfd_tmp = txq->tfds; |
411 | 414 | ||
412 | /* rd_ptr is bounded by n_bd and idx is bounded by n_window */ | 415 | /* rd_ptr is bounded by TFD_QUEUE_SIZE_MAX and |
416 | * idx is bounded by n_window | ||
417 | */ | ||
413 | int rd_ptr = txq->q.read_ptr; | 418 | int rd_ptr = txq->q.read_ptr; |
414 | int idx = get_cmd_index(&txq->q, rd_ptr); | 419 | int idx = get_cmd_index(&txq->q, rd_ptr); |
415 | 420 | ||
416 | lockdep_assert_held(&txq->lock); | 421 | lockdep_assert_held(&txq->lock); |
417 | 422 | ||
418 | /* We have only q->n_window txq->entries, but we use q->n_bd tfds */ | 423 | /* We have only q->n_window txq->entries, but we use |
424 | * TFD_QUEUE_SIZE_MAX tfds | ||
425 | */ | ||
419 | iwl_pcie_tfd_unmap(trans, &txq->entries[idx].meta, &tfd_tmp[rd_ptr]); | 426 | iwl_pcie_tfd_unmap(trans, &txq->entries[idx].meta, &tfd_tmp[rd_ptr]); |
420 | 427 | ||
421 | /* free SKB */ | 428 | /* free SKB */ |
@@ -436,7 +443,7 @@ static void iwl_pcie_txq_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq) | |||
436 | } | 443 | } |
437 | 444 | ||
438 | static int iwl_pcie_txq_build_tfd(struct iwl_trans *trans, struct iwl_txq *txq, | 445 | static int iwl_pcie_txq_build_tfd(struct iwl_trans *trans, struct iwl_txq *txq, |
439 | dma_addr_t addr, u16 len, u8 reset) | 446 | dma_addr_t addr, u16 len, bool reset) |
440 | { | 447 | { |
441 | struct iwl_queue *q; | 448 | struct iwl_queue *q; |
442 | struct iwl_tfd *tfd, *tfd_tmp; | 449 | struct iwl_tfd *tfd, *tfd_tmp; |
@@ -542,15 +549,14 @@ static int iwl_pcie_txq_init(struct iwl_trans *trans, struct iwl_txq *txq, | |||
542 | { | 549 | { |
543 | int ret; | 550 | int ret; |
544 | 551 | ||
545 | txq->need_update = 0; | 552 | txq->need_update = false; |
546 | 553 | ||
547 | /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise | 554 | /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise |
548 | * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */ | 555 | * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */ |
549 | BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); | 556 | BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); |
550 | 557 | ||
551 | /* Initialize queue's high/low-water marks, and head/tail indexes */ | 558 | /* Initialize queue's high/low-water marks, and head/tail indexes */ |
552 | ret = iwl_queue_init(&txq->q, TFD_QUEUE_SIZE_MAX, slots_num, | 559 | ret = iwl_queue_init(&txq->q, slots_num, txq_id); |
553 | txq_id); | ||
554 | if (ret) | 560 | if (ret) |
555 | return ret; | 561 | return ret; |
556 | 562 | ||
@@ -575,15 +581,12 @@ static void iwl_pcie_txq_unmap(struct iwl_trans *trans, int txq_id) | |||
575 | struct iwl_txq *txq = &trans_pcie->txq[txq_id]; | 581 | struct iwl_txq *txq = &trans_pcie->txq[txq_id]; |
576 | struct iwl_queue *q = &txq->q; | 582 | struct iwl_queue *q = &txq->q; |
577 | 583 | ||
578 | if (!q->n_bd) | ||
579 | return; | ||
580 | |||
581 | spin_lock_bh(&txq->lock); | 584 | spin_lock_bh(&txq->lock); |
582 | while (q->write_ptr != q->read_ptr) { | 585 | while (q->write_ptr != q->read_ptr) { |
583 | IWL_DEBUG_TX_REPLY(trans, "Q %d Free %d\n", | 586 | IWL_DEBUG_TX_REPLY(trans, "Q %d Free %d\n", |
584 | txq_id, q->read_ptr); | 587 | txq_id, q->read_ptr); |
585 | iwl_pcie_txq_free_tfd(trans, txq); | 588 | iwl_pcie_txq_free_tfd(trans, txq); |
586 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd); | 589 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr); |
587 | } | 590 | } |
588 | txq->active = false; | 591 | txq->active = false; |
589 | spin_unlock_bh(&txq->lock); | 592 | spin_unlock_bh(&txq->lock); |
@@ -620,10 +623,12 @@ static void iwl_pcie_txq_free(struct iwl_trans *trans, int txq_id) | |||
620 | } | 623 | } |
621 | 624 | ||
622 | /* De-alloc circular buffer of TFDs */ | 625 | /* De-alloc circular buffer of TFDs */ |
623 | if (txq->q.n_bd) { | 626 | if (txq->tfds) { |
624 | dma_free_coherent(dev, sizeof(struct iwl_tfd) * | 627 | dma_free_coherent(dev, |
625 | txq->q.n_bd, txq->tfds, txq->q.dma_addr); | 628 | sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX, |
629 | txq->tfds, txq->q.dma_addr); | ||
626 | txq->q.dma_addr = 0; | 630 | txq->q.dma_addr = 0; |
631 | txq->tfds = NULL; | ||
627 | 632 | ||
628 | dma_free_coherent(dev, | 633 | dma_free_coherent(dev, |
629 | sizeof(*txq->scratchbufs) * txq->q.n_window, | 634 | sizeof(*txq->scratchbufs) * txq->q.n_window, |
@@ -680,7 +685,8 @@ void iwl_pcie_tx_start(struct iwl_trans *trans, u32 scd_base_addr) | |||
680 | /* The chain extension of the SCD doesn't work well. This feature is | 685 | /* The chain extension of the SCD doesn't work well. This feature is |
681 | * enabled by default by the HW, so we need to disable it manually. | 686 | * enabled by default by the HW, so we need to disable it manually. |
682 | */ | 687 | */ |
683 | iwl_write_prph(trans, SCD_CHAINEXT_EN, 0); | 688 | if (trans->cfg->base_params->scd_chain_ext_wa) |
689 | iwl_write_prph(trans, SCD_CHAINEXT_EN, 0); | ||
684 | 690 | ||
685 | iwl_trans_ac_txq_enable(trans, trans_pcie->cmd_queue, | 691 | iwl_trans_ac_txq_enable(trans, trans_pcie->cmd_queue, |
686 | trans_pcie->cmd_fifo); | 692 | trans_pcie->cmd_fifo); |
@@ -931,8 +937,7 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, | |||
931 | { | 937 | { |
932 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 938 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
933 | struct iwl_txq *txq = &trans_pcie->txq[txq_id]; | 939 | struct iwl_txq *txq = &trans_pcie->txq[txq_id]; |
934 | /* n_bd is usually 256 => n_bd - 1 = 0xff */ | 940 | int tfd_num = ssn & (TFD_QUEUE_SIZE_MAX - 1); |
935 | int tfd_num = ssn & (txq->q.n_bd - 1); | ||
936 | struct iwl_queue *q = &txq->q; | 941 | struct iwl_queue *q = &txq->q; |
937 | int last_to_free; | 942 | int last_to_free; |
938 | 943 | ||
@@ -956,12 +961,12 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, | |||
956 | 961 | ||
957 | /*Since we free until index _not_ inclusive, the one before index is | 962 | /*Since we free until index _not_ inclusive, the one before index is |
958 | * the last we will free. This one must be used */ | 963 | * the last we will free. This one must be used */ |
959 | last_to_free = iwl_queue_dec_wrap(tfd_num, q->n_bd); | 964 | last_to_free = iwl_queue_dec_wrap(tfd_num); |
960 | 965 | ||
961 | if (!iwl_queue_used(q, last_to_free)) { | 966 | if (!iwl_queue_used(q, last_to_free)) { |
962 | IWL_ERR(trans, | 967 | IWL_ERR(trans, |
963 | "%s: Read index for DMA queue txq id (%d), last_to_free %d is out of range [0-%d] %d %d.\n", | 968 | "%s: Read index for DMA queue txq id (%d), last_to_free %d is out of range [0-%d] %d %d.\n", |
964 | __func__, txq_id, last_to_free, q->n_bd, | 969 | __func__, txq_id, last_to_free, TFD_QUEUE_SIZE_MAX, |
965 | q->write_ptr, q->read_ptr); | 970 | q->write_ptr, q->read_ptr); |
966 | goto out; | 971 | goto out; |
967 | } | 972 | } |
@@ -971,7 +976,7 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, | |||
971 | 976 | ||
972 | for (; | 977 | for (; |
973 | q->read_ptr != tfd_num; | 978 | q->read_ptr != tfd_num; |
974 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { | 979 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr)) { |
975 | 980 | ||
976 | if (WARN_ON_ONCE(txq->entries[txq->q.read_ptr].skb == NULL)) | 981 | if (WARN_ON_ONCE(txq->entries[txq->q.read_ptr].skb == NULL)) |
977 | continue; | 982 | continue; |
@@ -1010,25 +1015,26 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx) | |||
1010 | 1015 | ||
1011 | lockdep_assert_held(&txq->lock); | 1016 | lockdep_assert_held(&txq->lock); |
1012 | 1017 | ||
1013 | if ((idx >= q->n_bd) || (!iwl_queue_used(q, idx))) { | 1018 | if ((idx >= TFD_QUEUE_SIZE_MAX) || (!iwl_queue_used(q, idx))) { |
1014 | IWL_ERR(trans, | 1019 | IWL_ERR(trans, |
1015 | "%s: Read index for DMA queue txq id (%d), index %d is out of range [0-%d] %d %d.\n", | 1020 | "%s: Read index for DMA queue txq id (%d), index %d is out of range [0-%d] %d %d.\n", |
1016 | __func__, txq_id, idx, q->n_bd, | 1021 | __func__, txq_id, idx, TFD_QUEUE_SIZE_MAX, |
1017 | q->write_ptr, q->read_ptr); | 1022 | q->write_ptr, q->read_ptr); |
1018 | return; | 1023 | return; |
1019 | } | 1024 | } |
1020 | 1025 | ||
1021 | for (idx = iwl_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; | 1026 | for (idx = iwl_queue_inc_wrap(idx); q->read_ptr != idx; |
1022 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { | 1027 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr)) { |
1023 | 1028 | ||
1024 | if (nfreed++ > 0) { | 1029 | if (nfreed++ > 0) { |
1025 | IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", | 1030 | IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", |
1026 | idx, q->write_ptr, q->read_ptr); | 1031 | idx, q->write_ptr, q->read_ptr); |
1027 | iwl_write_prph(trans, DEVICE_SET_NMI_REG, 1); | 1032 | iwl_force_nmi(trans); |
1028 | } | 1033 | } |
1029 | } | 1034 | } |
1030 | 1035 | ||
1031 | if (q->read_ptr == q->write_ptr) { | 1036 | if (trans->cfg->base_params->apmg_wake_up_wa && |
1037 | q->read_ptr == q->write_ptr) { | ||
1032 | spin_lock_irqsave(&trans_pcie->reg_lock, flags); | 1038 | spin_lock_irqsave(&trans_pcie->reg_lock, flags); |
1033 | WARN_ON(!trans_pcie->cmd_in_flight); | 1039 | WARN_ON(!trans_pcie->cmd_in_flight); |
1034 | trans_pcie->cmd_in_flight = false; | 1040 | trans_pcie->cmd_in_flight = false; |
@@ -1309,28 +1315,39 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1309 | cmd_pos = offsetof(struct iwl_device_cmd, payload); | 1315 | cmd_pos = offsetof(struct iwl_device_cmd, payload); |
1310 | copy_size = sizeof(out_cmd->hdr); | 1316 | copy_size = sizeof(out_cmd->hdr); |
1311 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { | 1317 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { |
1312 | int copy = 0; | 1318 | int copy; |
1313 | 1319 | ||
1314 | if (!cmd->len[i]) | 1320 | if (!cmd->len[i]) |
1315 | continue; | 1321 | continue; |
1316 | 1322 | ||
1317 | /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ | ||
1318 | if (copy_size < IWL_HCMD_SCRATCHBUF_SIZE) { | ||
1319 | copy = IWL_HCMD_SCRATCHBUF_SIZE - copy_size; | ||
1320 | |||
1321 | if (copy > cmd->len[i]) | ||
1322 | copy = cmd->len[i]; | ||
1323 | } | ||
1324 | |||
1325 | /* copy everything if not nocopy/dup */ | 1323 | /* copy everything if not nocopy/dup */ |
1326 | if (!(cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | | 1324 | if (!(cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | |
1327 | IWL_HCMD_DFL_DUP))) | 1325 | IWL_HCMD_DFL_DUP))) { |
1328 | copy = cmd->len[i]; | 1326 | copy = cmd->len[i]; |
1329 | 1327 | ||
1330 | if (copy) { | ||
1331 | memcpy((u8 *)out_cmd + cmd_pos, cmd->data[i], copy); | 1328 | memcpy((u8 *)out_cmd + cmd_pos, cmd->data[i], copy); |
1332 | cmd_pos += copy; | 1329 | cmd_pos += copy; |
1333 | copy_size += copy; | 1330 | copy_size += copy; |
1331 | continue; | ||
1332 | } | ||
1333 | |||
1334 | /* | ||
1335 | * Otherwise we need at least IWL_HCMD_SCRATCHBUF_SIZE copied | ||
1336 | * in total (for the scratchbuf handling), but copy up to what | ||
1337 | * we can fit into the payload for debug dump purposes. | ||
1338 | */ | ||
1339 | copy = min_t(int, TFD_MAX_PAYLOAD_SIZE - cmd_pos, cmd->len[i]); | ||
1340 | |||
1341 | memcpy((u8 *)out_cmd + cmd_pos, cmd->data[i], copy); | ||
1342 | cmd_pos += copy; | ||
1343 | |||
1344 | /* However, treat copy_size the proper way, we need it below */ | ||
1345 | if (copy_size < IWL_HCMD_SCRATCHBUF_SIZE) { | ||
1346 | copy = IWL_HCMD_SCRATCHBUF_SIZE - copy_size; | ||
1347 | |||
1348 | if (copy > cmd->len[i]) | ||
1349 | copy = cmd->len[i]; | ||
1350 | copy_size += copy; | ||
1334 | } | 1351 | } |
1335 | } | 1352 | } |
1336 | 1353 | ||
@@ -1345,7 +1362,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1345 | memcpy(&txq->scratchbufs[q->write_ptr], &out_cmd->hdr, scratch_size); | 1362 | memcpy(&txq->scratchbufs[q->write_ptr], &out_cmd->hdr, scratch_size); |
1346 | iwl_pcie_txq_build_tfd(trans, txq, | 1363 | iwl_pcie_txq_build_tfd(trans, txq, |
1347 | iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr), | 1364 | iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr), |
1348 | scratch_size, 1); | 1365 | scratch_size, true); |
1349 | 1366 | ||
1350 | /* map first command fragment, if any remains */ | 1367 | /* map first command fragment, if any remains */ |
1351 | if (copy_size > scratch_size) { | 1368 | if (copy_size > scratch_size) { |
@@ -1361,7 +1378,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1361 | } | 1378 | } |
1362 | 1379 | ||
1363 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, | 1380 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, |
1364 | copy_size - scratch_size, 0); | 1381 | copy_size - scratch_size, false); |
1365 | } | 1382 | } |
1366 | 1383 | ||
1367 | /* map the remaining (adjusted) nocopy/dup fragments */ | 1384 | /* map the remaining (adjusted) nocopy/dup fragments */ |
@@ -1384,7 +1401,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1384 | goto out; | 1401 | goto out; |
1385 | } | 1402 | } |
1386 | 1403 | ||
1387 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, cmdlen[i], 0); | 1404 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, cmdlen[i], false); |
1388 | } | 1405 | } |
1389 | 1406 | ||
1390 | out_meta->flags = cmd->flags; | 1407 | out_meta->flags = cmd->flags; |
@@ -1392,8 +1409,6 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1392 | kfree(txq->entries[idx].free_buf); | 1409 | kfree(txq->entries[idx].free_buf); |
1393 | txq->entries[idx].free_buf = dup_buf; | 1410 | txq->entries[idx].free_buf = dup_buf; |
1394 | 1411 | ||
1395 | txq->need_update = 1; | ||
1396 | |||
1397 | trace_iwlwifi_dev_hcmd(trans->dev, cmd, cmd_size, &out_cmd->hdr); | 1412 | trace_iwlwifi_dev_hcmd(trans->dev, cmd, cmd_size, &out_cmd->hdr); |
1398 | 1413 | ||
1399 | /* start timer if queue currently empty */ | 1414 | /* start timer if queue currently empty */ |
@@ -1405,9 +1420,11 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1405 | /* | 1420 | /* |
1406 | * wake up the NIC to make sure that the firmware will see the host | 1421 | * wake up the NIC to make sure that the firmware will see the host |
1407 | * command - we will let the NIC sleep once all the host commands | 1422 | * command - we will let the NIC sleep once all the host commands |
1408 | * returned. | 1423 | * returned. This needs to be done only on NICs that have |
1424 | * apmg_wake_up_wa set. | ||
1409 | */ | 1425 | */ |
1410 | if (!trans_pcie->cmd_in_flight) { | 1426 | if (trans->cfg->base_params->apmg_wake_up_wa && |
1427 | !trans_pcie->cmd_in_flight) { | ||
1411 | trans_pcie->cmd_in_flight = true; | 1428 | trans_pcie->cmd_in_flight = true; |
1412 | __iwl_trans_pcie_set_bit(trans, CSR_GP_CNTRL, | 1429 | __iwl_trans_pcie_set_bit(trans, CSR_GP_CNTRL, |
1413 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 1430 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
@@ -1427,7 +1444,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1427 | } | 1444 | } |
1428 | 1445 | ||
1429 | /* Increment and update queue's write index */ | 1446 | /* Increment and update queue's write index */ |
1430 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); | 1447 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr); |
1431 | iwl_pcie_txq_inc_wr_ptr(trans, txq); | 1448 | iwl_pcie_txq_inc_wr_ptr(trans, txq); |
1432 | 1449 | ||
1433 | spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); | 1450 | spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); |
@@ -1583,7 +1600,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans, | |||
1583 | get_cmd_string(trans_pcie, cmd->id)); | 1600 | get_cmd_string(trans_pcie, cmd->id)); |
1584 | ret = -ETIMEDOUT; | 1601 | ret = -ETIMEDOUT; |
1585 | 1602 | ||
1586 | iwl_write_prph(trans, DEVICE_SET_NMI_REG, 1); | 1603 | iwl_force_nmi(trans); |
1587 | iwl_trans_fw_error(trans); | 1604 | iwl_trans_fw_error(trans); |
1588 | 1605 | ||
1589 | goto cancel; | 1606 | goto cancel; |
@@ -1661,7 +1678,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
1661 | dma_addr_t tb0_phys, tb1_phys, scratch_phys; | 1678 | dma_addr_t tb0_phys, tb1_phys, scratch_phys; |
1662 | void *tb1_addr; | 1679 | void *tb1_addr; |
1663 | u16 len, tb1_len, tb2_len; | 1680 | u16 len, tb1_len, tb2_len; |
1664 | u8 wait_write_ptr = 0; | 1681 | bool wait_write_ptr; |
1665 | __le16 fc = hdr->frame_control; | 1682 | __le16 fc = hdr->frame_control; |
1666 | u8 hdr_len = ieee80211_hdrlen(fc); | 1683 | u8 hdr_len = ieee80211_hdrlen(fc); |
1667 | u16 wifi_seq; | 1684 | u16 wifi_seq; |
@@ -1722,7 +1739,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
1722 | memcpy(&txq->scratchbufs[q->write_ptr], &dev_cmd->hdr, | 1739 | memcpy(&txq->scratchbufs[q->write_ptr], &dev_cmd->hdr, |
1723 | IWL_HCMD_SCRATCHBUF_SIZE); | 1740 | IWL_HCMD_SCRATCHBUF_SIZE); |
1724 | iwl_pcie_txq_build_tfd(trans, txq, tb0_phys, | 1741 | iwl_pcie_txq_build_tfd(trans, txq, tb0_phys, |
1725 | IWL_HCMD_SCRATCHBUF_SIZE, 1); | 1742 | IWL_HCMD_SCRATCHBUF_SIZE, true); |
1726 | 1743 | ||
1727 | /* there must be data left over for TB1 or this code must be changed */ | 1744 | /* there must be data left over for TB1 or this code must be changed */ |
1728 | BUILD_BUG_ON(sizeof(struct iwl_tx_cmd) < IWL_HCMD_SCRATCHBUF_SIZE); | 1745 | BUILD_BUG_ON(sizeof(struct iwl_tx_cmd) < IWL_HCMD_SCRATCHBUF_SIZE); |
@@ -1732,7 +1749,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
1732 | tb1_phys = dma_map_single(trans->dev, tb1_addr, tb1_len, DMA_TO_DEVICE); | 1749 | tb1_phys = dma_map_single(trans->dev, tb1_addr, tb1_len, DMA_TO_DEVICE); |
1733 | if (unlikely(dma_mapping_error(trans->dev, tb1_phys))) | 1750 | if (unlikely(dma_mapping_error(trans->dev, tb1_phys))) |
1734 | goto out_err; | 1751 | goto out_err; |
1735 | iwl_pcie_txq_build_tfd(trans, txq, tb1_phys, tb1_len, 0); | 1752 | iwl_pcie_txq_build_tfd(trans, txq, tb1_phys, tb1_len, false); |
1736 | 1753 | ||
1737 | /* | 1754 | /* |
1738 | * Set up TFD's third entry to point directly to remainder | 1755 | * Set up TFD's third entry to point directly to remainder |
@@ -1748,7 +1765,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
1748 | &txq->tfds[q->write_ptr]); | 1765 | &txq->tfds[q->write_ptr]); |
1749 | goto out_err; | 1766 | goto out_err; |
1750 | } | 1767 | } |
1751 | iwl_pcie_txq_build_tfd(trans, txq, tb2_phys, tb2_len, 0); | 1768 | iwl_pcie_txq_build_tfd(trans, txq, tb2_phys, tb2_len, false); |
1752 | } | 1769 | } |
1753 | 1770 | ||
1754 | /* Set up entry for this TFD in Tx byte-count array */ | 1771 | /* Set up entry for this TFD in Tx byte-count array */ |
@@ -1762,12 +1779,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
1762 | trace_iwlwifi_dev_tx_data(trans->dev, skb, | 1779 | trace_iwlwifi_dev_tx_data(trans->dev, skb, |
1763 | skb->data + hdr_len, tb2_len); | 1780 | skb->data + hdr_len, tb2_len); |
1764 | 1781 | ||
1765 | if (!ieee80211_has_morefrags(fc)) { | 1782 | wait_write_ptr = ieee80211_has_morefrags(fc); |
1766 | txq->need_update = 1; | ||
1767 | } else { | ||
1768 | wait_write_ptr = 1; | ||
1769 | txq->need_update = 0; | ||
1770 | } | ||
1771 | 1783 | ||
1772 | /* start timer if queue currently empty */ | 1784 | /* start timer if queue currently empty */ |
1773 | if (txq->need_update && q->read_ptr == q->write_ptr && | 1785 | if (txq->need_update && q->read_ptr == q->write_ptr && |
@@ -1775,22 +1787,19 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
1775 | mod_timer(&txq->stuck_timer, jiffies + trans_pcie->wd_timeout); | 1787 | mod_timer(&txq->stuck_timer, jiffies + trans_pcie->wd_timeout); |
1776 | 1788 | ||
1777 | /* Tell device the write index *just past* this latest filled TFD */ | 1789 | /* Tell device the write index *just past* this latest filled TFD */ |
1778 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); | 1790 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr); |
1779 | iwl_pcie_txq_inc_wr_ptr(trans, txq); | 1791 | if (!wait_write_ptr) |
1792 | iwl_pcie_txq_inc_wr_ptr(trans, txq); | ||
1780 | 1793 | ||
1781 | /* | 1794 | /* |
1782 | * At this point the frame is "transmitted" successfully | 1795 | * At this point the frame is "transmitted" successfully |
1783 | * and we will get a TX status notification eventually, | 1796 | * and we will get a TX status notification eventually. |
1784 | * regardless of the value of ret. "ret" only indicates | ||
1785 | * whether or not we should update the write pointer. | ||
1786 | */ | 1797 | */ |
1787 | if (iwl_queue_space(q) < q->high_mark) { | 1798 | if (iwl_queue_space(q) < q->high_mark) { |
1788 | if (wait_write_ptr) { | 1799 | if (wait_write_ptr) |
1789 | txq->need_update = 1; | ||
1790 | iwl_pcie_txq_inc_wr_ptr(trans, txq); | 1800 | iwl_pcie_txq_inc_wr_ptr(trans, txq); |
1791 | } else { | 1801 | else |
1792 | iwl_stop_queue(trans, txq); | 1802 | iwl_stop_queue(trans, txq); |
1793 | } | ||
1794 | } | 1803 | } |
1795 | spin_unlock(&txq->lock); | 1804 | spin_unlock(&txq->lock); |
1796 | return 0; | 1805 | return 0; |
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 54e344aed6e0..47a998d8f99e 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
@@ -1006,9 +1006,8 @@ struct cmd_key_material { | |||
1006 | } __packed; | 1006 | } __packed; |
1007 | 1007 | ||
1008 | static int lbs_set_key_material(struct lbs_private *priv, | 1008 | static int lbs_set_key_material(struct lbs_private *priv, |
1009 | int key_type, | 1009 | int key_type, int key_info, |
1010 | int key_info, | 1010 | const u8 *key, u16 key_len) |
1011 | u8 *key, u16 key_len) | ||
1012 | { | 1011 | { |
1013 | struct cmd_key_material cmd; | 1012 | struct cmd_key_material cmd; |
1014 | int ret; | 1013 | int ret; |
@@ -1610,7 +1609,7 @@ static int lbs_cfg_del_key(struct wiphy *wiphy, struct net_device *netdev, | |||
1610 | */ | 1609 | */ |
1611 | 1610 | ||
1612 | static int lbs_cfg_get_station(struct wiphy *wiphy, struct net_device *dev, | 1611 | static int lbs_cfg_get_station(struct wiphy *wiphy, struct net_device *dev, |
1613 | u8 *mac, struct station_info *sinfo) | 1612 | const u8 *mac, struct station_info *sinfo) |
1614 | { | 1613 | { |
1615 | struct lbs_private *priv = wiphy_priv(wiphy); | 1614 | struct lbs_private *priv = wiphy_priv(wiphy); |
1616 | s8 signal, noise; | 1615 | s8 signal, noise; |
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index ab966f08024a..407784aca627 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h | |||
@@ -90,7 +90,8 @@ do { if ((lbs_debug & (grp)) == (grp)) \ | |||
90 | #define lbs_deb_cfg80211(fmt, args...) LBS_DEB_LL(LBS_DEB_CFG80211, " cfg80211", fmt, ##args) | 90 | #define lbs_deb_cfg80211(fmt, args...) LBS_DEB_LL(LBS_DEB_CFG80211, " cfg80211", fmt, ##args) |
91 | 91 | ||
92 | #ifdef DEBUG | 92 | #ifdef DEBUG |
93 | static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len) | 93 | static inline void lbs_deb_hex(unsigned int grp, const char *prompt, |
94 | const u8 *buf, int len) | ||
94 | { | 95 | { |
95 | int i = 0; | 96 | int i = 0; |
96 | 97 | ||
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index c7366b07b568..e446fed7b345 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c | |||
@@ -71,8 +71,10 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) | |||
71 | 71 | ||
72 | skb->ip_summed = CHECKSUM_NONE; | 72 | skb->ip_summed = CHECKSUM_NONE; |
73 | 73 | ||
74 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) | 74 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) { |
75 | return process_rxed_802_11_packet(priv, skb); | 75 | ret = process_rxed_802_11_packet(priv, skb); |
76 | goto done; | ||
77 | } | ||
76 | 78 | ||
77 | p_rx_pd = (struct rxpd *) skb->data; | 79 | p_rx_pd = (struct rxpd *) skb->data; |
78 | p_rx_pkt = (struct rxpackethdr *) ((u8 *)p_rx_pd + | 80 | p_rx_pkt = (struct rxpackethdr *) ((u8 *)p_rx_pd + |
@@ -86,7 +88,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) | |||
86 | if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { | 88 | if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { |
87 | lbs_deb_rx("rx err: frame received with bad length\n"); | 89 | lbs_deb_rx("rx err: frame received with bad length\n"); |
88 | dev->stats.rx_length_errors++; | 90 | dev->stats.rx_length_errors++; |
89 | ret = 0; | 91 | ret = -EINVAL; |
90 | dev_kfree_skb(skb); | 92 | dev_kfree_skb(skb); |
91 | goto done; | 93 | goto done; |
92 | } | 94 | } |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 9d7a52f5a410..a312c653d116 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -1676,7 +1676,9 @@ static int mac80211_hwsim_ampdu_action(struct ieee80211_hw *hw, | |||
1676 | return 0; | 1676 | return 0; |
1677 | } | 1677 | } |
1678 | 1678 | ||
1679 | static void mac80211_hwsim_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 1679 | static void mac80211_hwsim_flush(struct ieee80211_hw *hw, |
1680 | struct ieee80211_vif *vif, | ||
1681 | u32 queues, bool drop) | ||
1680 | { | 1682 | { |
1681 | /* Not implemented, queues only on kernel side */ | 1683 | /* Not implemented, queues only on kernel side */ |
1682 | } | 1684 | } |
@@ -2056,6 +2058,7 @@ static int mac80211_hwsim_create_radio(int channels, const char *reg_alpha2, | |||
2056 | WIPHY_FLAG_AP_UAPSD | | 2058 | WIPHY_FLAG_AP_UAPSD | |
2057 | WIPHY_FLAG_HAS_CHANNEL_SWITCH; | 2059 | WIPHY_FLAG_HAS_CHANNEL_SWITCH; |
2058 | hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR; | 2060 | hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR; |
2061 | hw->wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE; | ||
2059 | 2062 | ||
2060 | /* ask mac80211 to reserve space for magic */ | 2063 | /* ask mac80211 to reserve space for magic */ |
2061 | hw->vif_data_size = sizeof(struct hwsim_vif_priv); | 2064 | hw->vif_data_size = sizeof(struct hwsim_vif_priv); |
diff --git a/drivers/net/wireless/mwifiex/11ac.c b/drivers/net/wireless/mwifiex/11ac.c index c92f27aa71ed..706831df1fa2 100644 --- a/drivers/net/wireless/mwifiex/11ac.c +++ b/drivers/net/wireless/mwifiex/11ac.c | |||
@@ -212,8 +212,7 @@ int mwifiex_cmd_append_11ac_tlv(struct mwifiex_private *priv, | |||
212 | sizeof(struct mwifiex_ie_types_header)); | 212 | sizeof(struct mwifiex_ie_types_header)); |
213 | memcpy((u8 *)vht_op + | 213 | memcpy((u8 *)vht_op + |
214 | sizeof(struct mwifiex_ie_types_header), | 214 | sizeof(struct mwifiex_ie_types_header), |
215 | (u8 *)bss_desc->bcn_vht_oper + | 215 | (u8 *)bss_desc->bcn_vht_oper, |
216 | sizeof(struct ieee_types_header), | ||
217 | le16_to_cpu(vht_op->header.len)); | 216 | le16_to_cpu(vht_op->header.len)); |
218 | 217 | ||
219 | /* negotiate the channel width and central freq | 218 | /* negotiate the channel width and central freq |
diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c index d14ead8beca8..e1c2f67ae85e 100644 --- a/drivers/net/wireless/mwifiex/11n.c +++ b/drivers/net/wireless/mwifiex/11n.c | |||
@@ -345,8 +345,7 @@ mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv, | |||
345 | 345 | ||
346 | memcpy((u8 *) ht_info + | 346 | memcpy((u8 *) ht_info + |
347 | sizeof(struct mwifiex_ie_types_header), | 347 | sizeof(struct mwifiex_ie_types_header), |
348 | (u8 *) bss_desc->bcn_ht_oper + | 348 | (u8 *)bss_desc->bcn_ht_oper, |
349 | sizeof(struct ieee_types_header), | ||
350 | le16_to_cpu(ht_info->header.len)); | 349 | le16_to_cpu(ht_info->header.len)); |
351 | 350 | ||
352 | if (!(sband->ht_cap.cap & | 351 | if (!(sband->ht_cap.cap & |
@@ -750,3 +749,45 @@ void mwifiex_set_ba_params(struct mwifiex_private *priv) | |||
750 | 749 | ||
751 | return; | 750 | return; |
752 | } | 751 | } |
752 | |||
753 | u8 mwifiex_get_sec_chan_offset(int chan) | ||
754 | { | ||
755 | u8 sec_offset; | ||
756 | |||
757 | switch (chan) { | ||
758 | case 36: | ||
759 | case 44: | ||
760 | case 52: | ||
761 | case 60: | ||
762 | case 100: | ||
763 | case 108: | ||
764 | case 116: | ||
765 | case 124: | ||
766 | case 132: | ||
767 | case 140: | ||
768 | case 149: | ||
769 | case 157: | ||
770 | sec_offset = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | ||
771 | break; | ||
772 | case 40: | ||
773 | case 48: | ||
774 | case 56: | ||
775 | case 64: | ||
776 | case 104: | ||
777 | case 112: | ||
778 | case 120: | ||
779 | case 128: | ||
780 | case 136: | ||
781 | case 144: | ||
782 | case 153: | ||
783 | case 161: | ||
784 | sec_offset = IEEE80211_HT_PARAM_CHA_SEC_BELOW; | ||
785 | break; | ||
786 | case 165: | ||
787 | default: | ||
788 | sec_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; | ||
789 | break; | ||
790 | } | ||
791 | |||
792 | return sec_offset; | ||
793 | } | ||
diff --git a/drivers/net/wireless/mwifiex/11n.h b/drivers/net/wireless/mwifiex/11n.h index 40b007a00f4b..0b73fa08f5d4 100644 --- a/drivers/net/wireless/mwifiex/11n.h +++ b/drivers/net/wireless/mwifiex/11n.h | |||
@@ -63,6 +63,7 @@ int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd, | |||
63 | int cmd_action, | 63 | int cmd_action, |
64 | struct mwifiex_ds_11n_amsdu_aggr_ctrl *aa_ctrl); | 64 | struct mwifiex_ds_11n_amsdu_aggr_ctrl *aa_ctrl); |
65 | void mwifiex_del_tx_ba_stream_tbl_by_ra(struct mwifiex_private *priv, u8 *ra); | 65 | void mwifiex_del_tx_ba_stream_tbl_by_ra(struct mwifiex_private *priv, u8 *ra); |
66 | u8 mwifiex_get_sec_chan_offset(int chan); | ||
66 | 67 | ||
67 | static inline u8 | 68 | static inline u8 |
68 | mwifiex_is_station_ampdu_allowed(struct mwifiex_private *priv, | 69 | mwifiex_is_station_ampdu_allowed(struct mwifiex_private *priv, |
@@ -199,7 +200,7 @@ static inline int mwifiex_is_sta_11n_enabled(struct mwifiex_private *priv, | |||
199 | } | 200 | } |
200 | 201 | ||
201 | static inline u8 | 202 | static inline u8 |
202 | mwifiex_tdls_peer_11n_enabled(struct mwifiex_private *priv, u8 *ra) | 203 | mwifiex_tdls_peer_11n_enabled(struct mwifiex_private *priv, const u8 *ra) |
203 | { | 204 | { |
204 | struct mwifiex_sta_node *node = mwifiex_get_sta_entry(priv, ra); | 205 | struct mwifiex_sta_node *node = mwifiex_get_sta_entry(priv, ra); |
205 | if (node) | 206 | if (node) |
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c index 63211707f939..5b32106182f8 100644 --- a/drivers/net/wireless/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/mwifiex/11n_aggr.c | |||
@@ -100,6 +100,7 @@ mwifiex_11n_form_amsdu_txpd(struct mwifiex_private *priv, | |||
100 | struct sk_buff *skb) | 100 | struct sk_buff *skb) |
101 | { | 101 | { |
102 | struct txpd *local_tx_pd; | 102 | struct txpd *local_tx_pd; |
103 | struct mwifiex_txinfo *tx_info = MWIFIEX_SKB_TXCB(skb); | ||
103 | 104 | ||
104 | skb_push(skb, sizeof(*local_tx_pd)); | 105 | skb_push(skb, sizeof(*local_tx_pd)); |
105 | 106 | ||
@@ -118,6 +119,9 @@ mwifiex_11n_form_amsdu_txpd(struct mwifiex_private *priv, | |||
118 | local_tx_pd->tx_pkt_length = cpu_to_le16(skb->len - | 119 | local_tx_pd->tx_pkt_length = cpu_to_le16(skb->len - |
119 | sizeof(*local_tx_pd)); | 120 | sizeof(*local_tx_pd)); |
120 | 121 | ||
122 | if (tx_info->flags & MWIFIEX_BUF_FLAG_TDLS_PKT) | ||
123 | local_tx_pd->flags |= MWIFIEX_TXPD_FLAGS_TDLS_PACKET; | ||
124 | |||
121 | if (local_tx_pd->tx_control == 0) | 125 | if (local_tx_pd->tx_control == 0) |
122 | /* TxCtrl set by user or default */ | 126 | /* TxCtrl set by user or default */ |
123 | local_tx_pd->tx_control = cpu_to_le32(priv->pkt_tx_ctrl); | 127 | local_tx_pd->tx_control = cpu_to_le32(priv->pkt_tx_ctrl); |
@@ -160,6 +164,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
160 | int pad = 0, ret; | 164 | int pad = 0, ret; |
161 | struct mwifiex_tx_param tx_param; | 165 | struct mwifiex_tx_param tx_param; |
162 | struct txpd *ptx_pd = NULL; | 166 | struct txpd *ptx_pd = NULL; |
167 | struct timeval tv; | ||
163 | int headroom = adapter->iface_type == MWIFIEX_USB ? 0 : INTF_HEADER_LEN; | 168 | int headroom = adapter->iface_type == MWIFIEX_USB ? 0 : INTF_HEADER_LEN; |
164 | 169 | ||
165 | skb_src = skb_peek(&pra_list->skb_head); | 170 | skb_src = skb_peek(&pra_list->skb_head); |
@@ -182,8 +187,14 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
182 | 187 | ||
183 | tx_info_aggr->bss_type = tx_info_src->bss_type; | 188 | tx_info_aggr->bss_type = tx_info_src->bss_type; |
184 | tx_info_aggr->bss_num = tx_info_src->bss_num; | 189 | tx_info_aggr->bss_num = tx_info_src->bss_num; |
190 | |||
191 | if (tx_info_src->flags & MWIFIEX_BUF_FLAG_TDLS_PKT) | ||
192 | tx_info_aggr->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT; | ||
185 | skb_aggr->priority = skb_src->priority; | 193 | skb_aggr->priority = skb_src->priority; |
186 | 194 | ||
195 | do_gettimeofday(&tv); | ||
196 | skb_aggr->tstamp = timeval_to_ktime(tv); | ||
197 | |||
187 | do { | 198 | do { |
188 | /* Check if AMSDU can accommodate this MSDU */ | 199 | /* Check if AMSDU can accommodate this MSDU */ |
189 | if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN)) | 200 | if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN)) |
@@ -236,18 +247,11 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
236 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA, | 247 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA, |
237 | skb_aggr, NULL); | 248 | skb_aggr, NULL); |
238 | } else { | 249 | } else { |
239 | /* | 250 | if (skb_src) |
240 | * Padding per MSDU will affect the length of next | 251 | tx_param.next_pkt_len = |
241 | * packet and hence the exact length of next packet | 252 | skb_src->len + sizeof(struct txpd); |
242 | * is uncertain here. | 253 | else |
243 | * | 254 | tx_param.next_pkt_len = 0; |
244 | * Also, aggregation of transmission buffer, while | ||
245 | * downloading the data to the card, wont gain much | ||
246 | * on the AMSDU packets as the AMSDU packets utilizes | ||
247 | * the transmission buffer space to the maximum | ||
248 | * (adapter->tx_buf_size). | ||
249 | */ | ||
250 | tx_param.next_pkt_len = 0; | ||
251 | 255 | ||
252 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, | 256 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, |
253 | skb_aggr, &tx_param); | 257 | skb_aggr, &tx_param); |
diff --git a/drivers/net/wireless/mwifiex/README b/drivers/net/wireless/mwifiex/README index b9242c3dca43..3b55ce5690a5 100644 --- a/drivers/net/wireless/mwifiex/README +++ b/drivers/net/wireless/mwifiex/README | |||
@@ -200,4 +200,11 @@ getlog | |||
200 | 200 | ||
201 | cat getlog | 201 | cat getlog |
202 | 202 | ||
203 | fw_dump | ||
204 | This command is used to dump firmware memory into files. | ||
205 | Separate file will be created for each memory segment. | ||
206 | Usage: | ||
207 | |||
208 | cat fw_dump | ||
209 | |||
203 | =============================================================================== | 210 | =============================================================================== |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 21ee27ab7b74..e95dec91a561 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -994,7 +994,7 @@ mwifiex_dump_station_info(struct mwifiex_private *priv, | |||
994 | */ | 994 | */ |
995 | static int | 995 | static int |
996 | mwifiex_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, | 996 | mwifiex_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
997 | u8 *mac, struct station_info *sinfo) | 997 | const u8 *mac, struct station_info *sinfo) |
998 | { | 998 | { |
999 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 999 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
1000 | 1000 | ||
@@ -1270,7 +1270,7 @@ static int mwifiex_cfg80211_change_beacon(struct wiphy *wiphy, | |||
1270 | */ | 1270 | */ |
1271 | static int | 1271 | static int |
1272 | mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, | 1272 | mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, |
1273 | u8 *mac) | 1273 | const u8 *mac) |
1274 | { | 1274 | { |
1275 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 1275 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
1276 | struct mwifiex_sta_node *sta_node; | 1276 | struct mwifiex_sta_node *sta_node; |
@@ -2629,7 +2629,7 @@ static int mwifiex_cfg80211_set_coalesce(struct wiphy *wiphy, | |||
2629 | */ | 2629 | */ |
2630 | static int | 2630 | static int |
2631 | mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, | 2631 | mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
2632 | u8 *peer, u8 action_code, u8 dialog_token, | 2632 | const u8 *peer, u8 action_code, u8 dialog_token, |
2633 | u16 status_code, u32 peer_capability, | 2633 | u16 status_code, u32 peer_capability, |
2634 | const u8 *extra_ies, size_t extra_ies_len) | 2634 | const u8 *extra_ies, size_t extra_ies_len) |
2635 | { | 2635 | { |
@@ -2701,7 +2701,7 @@ mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, | |||
2701 | 2701 | ||
2702 | static int | 2702 | static int |
2703 | mwifiex_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, | 2703 | mwifiex_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
2704 | u8 *peer, enum nl80211_tdls_operation action) | 2704 | const u8 *peer, enum nl80211_tdls_operation action) |
2705 | { | 2705 | { |
2706 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 2706 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
2707 | 2707 | ||
@@ -2748,9 +2748,8 @@ mwifiex_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, | |||
2748 | } | 2748 | } |
2749 | 2749 | ||
2750 | static int | 2750 | static int |
2751 | mwifiex_cfg80211_add_station(struct wiphy *wiphy, | 2751 | mwifiex_cfg80211_add_station(struct wiphy *wiphy, struct net_device *dev, |
2752 | struct net_device *dev, | 2752 | const u8 *mac, struct station_parameters *params) |
2753 | u8 *mac, struct station_parameters *params) | ||
2754 | { | 2753 | { |
2755 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 2754 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
2756 | 2755 | ||
@@ -2765,9 +2764,9 @@ mwifiex_cfg80211_add_station(struct wiphy *wiphy, | |||
2765 | } | 2764 | } |
2766 | 2765 | ||
2767 | static int | 2766 | static int |
2768 | mwifiex_cfg80211_change_station(struct wiphy *wiphy, | 2767 | mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, |
2769 | struct net_device *dev, | 2768 | const u8 *mac, |
2770 | u8 *mac, struct station_parameters *params) | 2769 | struct station_parameters *params) |
2771 | { | 2770 | { |
2772 | int ret; | 2771 | int ret; |
2773 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 2772 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 1062c918a7bf..8dee6c86f4f1 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
@@ -955,8 +955,6 @@ mwifiex_cmd_timeout_func(unsigned long function_context) | |||
955 | adapter->cmd_wait_q.status = -ETIMEDOUT; | 955 | adapter->cmd_wait_q.status = -ETIMEDOUT; |
956 | wake_up_interruptible(&adapter->cmd_wait_q.wait); | 956 | wake_up_interruptible(&adapter->cmd_wait_q.wait); |
957 | mwifiex_cancel_pending_ioctl(adapter); | 957 | mwifiex_cancel_pending_ioctl(adapter); |
958 | /* reset cmd_sent flag to unblock new commands */ | ||
959 | adapter->cmd_sent = false; | ||
960 | } | 958 | } |
961 | } | 959 | } |
962 | if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) | 960 | if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) |
diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c index b8a49aad12fd..7b419bbcd544 100644 --- a/drivers/net/wireless/mwifiex/debugfs.c +++ b/drivers/net/wireless/mwifiex/debugfs.c | |||
@@ -257,6 +257,29 @@ free_and_exit: | |||
257 | } | 257 | } |
258 | 258 | ||
259 | /* | 259 | /* |
260 | * Proc firmware dump read handler. | ||
261 | * | ||
262 | * This function is called when the 'fw_dump' file is opened for | ||
263 | * reading. | ||
264 | * This function dumps firmware memory in different files | ||
265 | * (ex. DTCM, ITCM, SQRAM etc.) based on the the segments for | ||
266 | * debugging. | ||
267 | */ | ||
268 | static ssize_t | ||
269 | mwifiex_fw_dump_read(struct file *file, char __user *ubuf, | ||
270 | size_t count, loff_t *ppos) | ||
271 | { | ||
272 | struct mwifiex_private *priv = file->private_data; | ||
273 | |||
274 | if (!priv->adapter->if_ops.fw_dump) | ||
275 | return -EIO; | ||
276 | |||
277 | priv->adapter->if_ops.fw_dump(priv->adapter); | ||
278 | |||
279 | return 0; | ||
280 | } | ||
281 | |||
282 | /* | ||
260 | * Proc getlog file read handler. | 283 | * Proc getlog file read handler. |
261 | * | 284 | * |
262 | * This function is called when the 'getlog' file is opened for reading | 285 | * This function is called when the 'getlog' file is opened for reading |
@@ -699,6 +722,7 @@ static const struct file_operations mwifiex_dfs_##name##_fops = { \ | |||
699 | MWIFIEX_DFS_FILE_READ_OPS(info); | 722 | MWIFIEX_DFS_FILE_READ_OPS(info); |
700 | MWIFIEX_DFS_FILE_READ_OPS(debug); | 723 | MWIFIEX_DFS_FILE_READ_OPS(debug); |
701 | MWIFIEX_DFS_FILE_READ_OPS(getlog); | 724 | MWIFIEX_DFS_FILE_READ_OPS(getlog); |
725 | MWIFIEX_DFS_FILE_READ_OPS(fw_dump); | ||
702 | MWIFIEX_DFS_FILE_OPS(regrdwr); | 726 | MWIFIEX_DFS_FILE_OPS(regrdwr); |
703 | MWIFIEX_DFS_FILE_OPS(rdeeprom); | 727 | MWIFIEX_DFS_FILE_OPS(rdeeprom); |
704 | 728 | ||
@@ -722,6 +746,7 @@ mwifiex_dev_debugfs_init(struct mwifiex_private *priv) | |||
722 | MWIFIEX_DFS_ADD_FILE(getlog); | 746 | MWIFIEX_DFS_ADD_FILE(getlog); |
723 | MWIFIEX_DFS_ADD_FILE(regrdwr); | 747 | MWIFIEX_DFS_ADD_FILE(regrdwr); |
724 | MWIFIEX_DFS_ADD_FILE(rdeeprom); | 748 | MWIFIEX_DFS_ADD_FILE(rdeeprom); |
749 | MWIFIEX_DFS_ADD_FILE(fw_dump); | ||
725 | } | 750 | } |
726 | 751 | ||
727 | /* | 752 | /* |
diff --git a/drivers/net/wireless/mwifiex/decl.h b/drivers/net/wireless/mwifiex/decl.h index e7b3e16e5d34..38da6ff6f416 100644 --- a/drivers/net/wireless/mwifiex/decl.h +++ b/drivers/net/wireless/mwifiex/decl.h | |||
@@ -42,12 +42,12 @@ | |||
42 | #define MWIFIEX_MAX_TX_BASTREAM_SUPPORTED 2 | 42 | #define MWIFIEX_MAX_TX_BASTREAM_SUPPORTED 2 |
43 | #define MWIFIEX_MAX_RX_BASTREAM_SUPPORTED 16 | 43 | #define MWIFIEX_MAX_RX_BASTREAM_SUPPORTED 16 |
44 | 44 | ||
45 | #define MWIFIEX_STA_AMPDU_DEF_TXWINSIZE 16 | 45 | #define MWIFIEX_STA_AMPDU_DEF_TXWINSIZE 64 |
46 | #define MWIFIEX_STA_AMPDU_DEF_RXWINSIZE 32 | 46 | #define MWIFIEX_STA_AMPDU_DEF_RXWINSIZE 64 |
47 | #define MWIFIEX_UAP_AMPDU_DEF_TXWINSIZE 32 | 47 | #define MWIFIEX_UAP_AMPDU_DEF_TXWINSIZE 32 |
48 | #define MWIFIEX_UAP_AMPDU_DEF_RXWINSIZE 16 | 48 | #define MWIFIEX_UAP_AMPDU_DEF_RXWINSIZE 16 |
49 | #define MWIFIEX_11AC_STA_AMPDU_DEF_TXWINSIZE 32 | 49 | #define MWIFIEX_11AC_STA_AMPDU_DEF_TXWINSIZE 64 |
50 | #define MWIFIEX_11AC_STA_AMPDU_DEF_RXWINSIZE 48 | 50 | #define MWIFIEX_11AC_STA_AMPDU_DEF_RXWINSIZE 64 |
51 | #define MWIFIEX_11AC_UAP_AMPDU_DEF_TXWINSIZE 48 | 51 | #define MWIFIEX_11AC_UAP_AMPDU_DEF_TXWINSIZE 48 |
52 | #define MWIFIEX_11AC_UAP_AMPDU_DEF_RXWINSIZE 32 | 52 | #define MWIFIEX_11AC_UAP_AMPDU_DEF_RXWINSIZE 32 |
53 | 53 | ||
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index b485dc1ae5eb..3175dd04834b 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h | |||
@@ -169,6 +169,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
169 | #define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 146) | 169 | #define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 146) |
170 | #define TLV_TYPE_COALESCE_RULE (PROPRIETARY_TLV_BASE_ID + 154) | 170 | #define TLV_TYPE_COALESCE_RULE (PROPRIETARY_TLV_BASE_ID + 154) |
171 | #define TLV_TYPE_KEY_PARAM_V2 (PROPRIETARY_TLV_BASE_ID + 156) | 171 | #define TLV_TYPE_KEY_PARAM_V2 (PROPRIETARY_TLV_BASE_ID + 156) |
172 | #define TLV_TYPE_TDLS_IDLE_TIMEOUT (PROPRIETARY_TLV_BASE_ID + 194) | ||
172 | #define TLV_TYPE_FW_API_REV (PROPRIETARY_TLV_BASE_ID + 199) | 173 | #define TLV_TYPE_FW_API_REV (PROPRIETARY_TLV_BASE_ID + 199) |
173 | 174 | ||
174 | #define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048 | 175 | #define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048 |
@@ -229,6 +230,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
229 | #define ISENABLED_40MHZ_INTOLERANT(Dot11nDevCap) (Dot11nDevCap & BIT(8)) | 230 | #define ISENABLED_40MHZ_INTOLERANT(Dot11nDevCap) (Dot11nDevCap & BIT(8)) |
230 | #define ISSUPP_RXLDPC(Dot11nDevCap) (Dot11nDevCap & BIT(22)) | 231 | #define ISSUPP_RXLDPC(Dot11nDevCap) (Dot11nDevCap & BIT(22)) |
231 | #define ISSUPP_BEAMFORMING(Dot11nDevCap) (Dot11nDevCap & BIT(30)) | 232 | #define ISSUPP_BEAMFORMING(Dot11nDevCap) (Dot11nDevCap & BIT(30)) |
233 | #define ISALLOWED_CHANWIDTH40(ht_param) (ht_param & BIT(2)) | ||
232 | 234 | ||
233 | /* httxcfg bitmap | 235 | /* httxcfg bitmap |
234 | * 0 reserved | 236 | * 0 reserved |
@@ -403,7 +405,7 @@ enum P2P_MODES { | |||
403 | #define HS_CFG_CANCEL 0xffffffff | 405 | #define HS_CFG_CANCEL 0xffffffff |
404 | #define HS_CFG_COND_DEF 0x00000000 | 406 | #define HS_CFG_COND_DEF 0x00000000 |
405 | #define HS_CFG_GPIO_DEF 0xff | 407 | #define HS_CFG_GPIO_DEF 0xff |
406 | #define HS_CFG_GAP_DEF 0 | 408 | #define HS_CFG_GAP_DEF 0xff |
407 | #define HS_CFG_COND_BROADCAST_DATA 0x00000001 | 409 | #define HS_CFG_COND_BROADCAST_DATA 0x00000001 |
408 | #define HS_CFG_COND_UNICAST_DATA 0x00000002 | 410 | #define HS_CFG_COND_UNICAST_DATA 0x00000002 |
409 | #define HS_CFG_COND_MAC_EVENT 0x00000004 | 411 | #define HS_CFG_COND_MAC_EVENT 0x00000004 |
@@ -487,6 +489,7 @@ enum P2P_MODES { | |||
487 | #define EVENT_UAP_MIC_COUNTERMEASURES 0x0000004c | 489 | #define EVENT_UAP_MIC_COUNTERMEASURES 0x0000004c |
488 | #define EVENT_HOSTWAKE_STAIE 0x0000004d | 490 | #define EVENT_HOSTWAKE_STAIE 0x0000004d |
489 | #define EVENT_CHANNEL_SWITCH_ANN 0x00000050 | 491 | #define EVENT_CHANNEL_SWITCH_ANN 0x00000050 |
492 | #define EVENT_TDLS_GENERIC_EVENT 0x00000052 | ||
490 | #define EVENT_EXT_SCAN_REPORT 0x00000058 | 493 | #define EVENT_EXT_SCAN_REPORT 0x00000058 |
491 | #define EVENT_REMAIN_ON_CHAN_EXPIRED 0x0000005f | 494 | #define EVENT_REMAIN_ON_CHAN_EXPIRED 0x0000005f |
492 | 495 | ||
@@ -519,6 +522,7 @@ enum P2P_MODES { | |||
519 | #define ACT_TDLS_DELETE 0x00 | 522 | #define ACT_TDLS_DELETE 0x00 |
520 | #define ACT_TDLS_CREATE 0x01 | 523 | #define ACT_TDLS_CREATE 0x01 |
521 | #define ACT_TDLS_CONFIG 0x02 | 524 | #define ACT_TDLS_CONFIG 0x02 |
525 | #define TDLS_EVENT_LINK_TEAR_DOWN 3 | ||
522 | 526 | ||
523 | #define MWIFIEX_FW_V15 15 | 527 | #define MWIFIEX_FW_V15 15 |
524 | 528 | ||
@@ -535,6 +539,7 @@ struct mwifiex_ie_types_data { | |||
535 | #define MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET 0x01 | 539 | #define MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET 0x01 |
536 | #define MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET 0x08 | 540 | #define MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET 0x08 |
537 | #define MWIFIEX_TXPD_FLAGS_TDLS_PACKET 0x10 | 541 | #define MWIFIEX_TXPD_FLAGS_TDLS_PACKET 0x10 |
542 | #define MWIFIEX_RXPD_FLAGS_TDLS_PACKET 0x01 | ||
538 | 543 | ||
539 | struct txpd { | 544 | struct txpd { |
540 | u8 bss_type; | 545 | u8 bss_type; |
@@ -577,7 +582,7 @@ struct rxpd { | |||
577 | * [Bit 7] Reserved | 582 | * [Bit 7] Reserved |
578 | */ | 583 | */ |
579 | u8 ht_info; | 584 | u8 ht_info; |
580 | u8 reserved; | 585 | u8 flags; |
581 | } __packed; | 586 | } __packed; |
582 | 587 | ||
583 | struct uap_txpd { | 588 | struct uap_txpd { |
@@ -708,6 +713,13 @@ struct mwifiex_ie_types_vendor_param_set { | |||
708 | u8 ie[MWIFIEX_MAX_VSIE_LEN]; | 713 | u8 ie[MWIFIEX_MAX_VSIE_LEN]; |
709 | }; | 714 | }; |
710 | 715 | ||
716 | #define MWIFIEX_TDLS_IDLE_TIMEOUT 60 | ||
717 | |||
718 | struct mwifiex_ie_types_tdls_idle_timeout { | ||
719 | struct mwifiex_ie_types_header header; | ||
720 | __le16 value; | ||
721 | } __packed; | ||
722 | |||
711 | struct mwifiex_ie_types_rsn_param_set { | 723 | struct mwifiex_ie_types_rsn_param_set { |
712 | struct mwifiex_ie_types_header header; | 724 | struct mwifiex_ie_types_header header; |
713 | u8 rsn_ie[1]; | 725 | u8 rsn_ie[1]; |
@@ -1745,6 +1757,15 @@ struct host_cmd_ds_802_11_subsc_evt { | |||
1745 | __le16 events; | 1757 | __le16 events; |
1746 | } __packed; | 1758 | } __packed; |
1747 | 1759 | ||
1760 | struct mwifiex_tdls_generic_event { | ||
1761 | __le16 type; | ||
1762 | u8 peer_mac[ETH_ALEN]; | ||
1763 | union { | ||
1764 | __le16 reason_code; | ||
1765 | __le16 reserved; | ||
1766 | } u; | ||
1767 | } __packed; | ||
1768 | |||
1748 | struct mwifiex_ie { | 1769 | struct mwifiex_ie { |
1749 | __le16 ie_index; | 1770 | __le16 ie_index; |
1750 | __le16 mgmt_subtype_mask; | 1771 | __le16 mgmt_subtype_mask; |
diff --git a/drivers/net/wireless/mwifiex/ioctl.h b/drivers/net/wireless/mwifiex/ioctl.h index ee494db54060..1b576722671d 100644 --- a/drivers/net/wireless/mwifiex/ioctl.h +++ b/drivers/net/wireless/mwifiex/ioctl.h | |||
@@ -303,7 +303,7 @@ struct mwifiex_ds_ant_cfg { | |||
303 | u32 rx_ant; | 303 | u32 rx_ant; |
304 | }; | 304 | }; |
305 | 305 | ||
306 | #define MWIFIEX_NUM_OF_CMD_BUFFER 20 | 306 | #define MWIFIEX_NUM_OF_CMD_BUFFER 50 |
307 | #define MWIFIEX_SIZE_OF_CMD_BUFFER 2048 | 307 | #define MWIFIEX_SIZE_OF_CMD_BUFFER 2048 |
308 | 308 | ||
309 | enum { | 309 | enum { |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 9c771b3e9918..cbabc12fbda3 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -521,7 +521,6 @@ done: | |||
521 | release_firmware(adapter->firmware); | 521 | release_firmware(adapter->firmware); |
522 | adapter->firmware = NULL; | 522 | adapter->firmware = NULL; |
523 | } | 523 | } |
524 | complete(&adapter->fw_load); | ||
525 | if (init_failed) | 524 | if (init_failed) |
526 | mwifiex_free_adapter(adapter); | 525 | mwifiex_free_adapter(adapter); |
527 | up(sem); | 526 | up(sem); |
@@ -535,7 +534,6 @@ static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter) | |||
535 | { | 534 | { |
536 | int ret; | 535 | int ret; |
537 | 536 | ||
538 | init_completion(&adapter->fw_load); | ||
539 | ret = request_firmware_nowait(THIS_MODULE, 1, adapter->fw_name, | 537 | ret = request_firmware_nowait(THIS_MODULE, 1, adapter->fw_name, |
540 | adapter->dev, GFP_KERNEL, adapter, | 538 | adapter->dev, GFP_KERNEL, adapter, |
541 | mwifiex_fw_dpc); | 539 | mwifiex_fw_dpc); |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index d53e1e8c9467..1398afa84064 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -672,6 +672,7 @@ struct mwifiex_if_ops { | |||
672 | int (*init_fw_port) (struct mwifiex_adapter *); | 672 | int (*init_fw_port) (struct mwifiex_adapter *); |
673 | int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *); | 673 | int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *); |
674 | void (*card_reset) (struct mwifiex_adapter *); | 674 | void (*card_reset) (struct mwifiex_adapter *); |
675 | void (*fw_dump)(struct mwifiex_adapter *); | ||
675 | int (*clean_pcie_ring) (struct mwifiex_adapter *adapter); | 676 | int (*clean_pcie_ring) (struct mwifiex_adapter *adapter); |
676 | }; | 677 | }; |
677 | 678 | ||
@@ -787,7 +788,6 @@ struct mwifiex_adapter { | |||
787 | struct mwifiex_wait_queue cmd_wait_q; | 788 | struct mwifiex_wait_queue cmd_wait_q; |
788 | u8 scan_wait_q_woken; | 789 | u8 scan_wait_q_woken; |
789 | spinlock_t queue_lock; /* lock for tx queues */ | 790 | spinlock_t queue_lock; /* lock for tx queues */ |
790 | struct completion fw_load; | ||
791 | u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; | 791 | u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; |
792 | u16 max_mgmt_ie_index; | 792 | u16 max_mgmt_ie_index; |
793 | u8 scan_delay_cnt; | 793 | u8 scan_delay_cnt; |
@@ -910,8 +910,6 @@ int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv, | |||
910 | struct sk_buff *skb); | 910 | struct sk_buff *skb); |
911 | int mwifiex_process_sta_event(struct mwifiex_private *); | 911 | int mwifiex_process_sta_event(struct mwifiex_private *); |
912 | int mwifiex_process_uap_event(struct mwifiex_private *); | 912 | int mwifiex_process_uap_event(struct mwifiex_private *); |
913 | struct mwifiex_sta_node * | ||
914 | mwifiex_get_sta_entry(struct mwifiex_private *priv, u8 *mac); | ||
915 | void mwifiex_delete_all_station_list(struct mwifiex_private *priv); | 913 | void mwifiex_delete_all_station_list(struct mwifiex_private *priv); |
916 | void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb); | 914 | void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb); |
917 | void *mwifiex_process_uap_txpd(struct mwifiex_private *, struct sk_buff *skb); | 915 | void *mwifiex_process_uap_txpd(struct mwifiex_private *, struct sk_buff *skb); |
@@ -1101,7 +1099,7 @@ mwifiex_11h_get_csa_closed_channel(struct mwifiex_private *priv) | |||
1101 | return 0; | 1099 | return 0; |
1102 | 1100 | ||
1103 | /* Clear csa channel, if DFS channel move time has passed */ | 1101 | /* Clear csa channel, if DFS channel move time has passed */ |
1104 | if (jiffies > priv->csa_expire_time) { | 1102 | if (time_after(jiffies, priv->csa_expire_time)) { |
1105 | priv->csa_chan = 0; | 1103 | priv->csa_chan = 0; |
1106 | priv->csa_expire_time = 0; | 1104 | priv->csa_expire_time = 0; |
1107 | } | 1105 | } |
@@ -1220,26 +1218,26 @@ void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv); | |||
1220 | extern const struct ethtool_ops mwifiex_ethtool_ops; | 1218 | extern const struct ethtool_ops mwifiex_ethtool_ops; |
1221 | 1219 | ||
1222 | void mwifiex_del_all_sta_list(struct mwifiex_private *priv); | 1220 | void mwifiex_del_all_sta_list(struct mwifiex_private *priv); |
1223 | void mwifiex_del_sta_entry(struct mwifiex_private *priv, u8 *mac); | 1221 | void mwifiex_del_sta_entry(struct mwifiex_private *priv, const u8 *mac); |
1224 | void | 1222 | void |
1225 | mwifiex_set_sta_ht_cap(struct mwifiex_private *priv, const u8 *ies, | 1223 | mwifiex_set_sta_ht_cap(struct mwifiex_private *priv, const u8 *ies, |
1226 | int ies_len, struct mwifiex_sta_node *node); | 1224 | int ies_len, struct mwifiex_sta_node *node); |
1227 | struct mwifiex_sta_node * | 1225 | struct mwifiex_sta_node * |
1228 | mwifiex_add_sta_entry(struct mwifiex_private *priv, u8 *mac); | 1226 | mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac); |
1229 | struct mwifiex_sta_node * | 1227 | struct mwifiex_sta_node * |
1230 | mwifiex_get_sta_entry(struct mwifiex_private *priv, u8 *mac); | 1228 | mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac); |
1231 | int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, u8 *peer, | 1229 | int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer, |
1232 | u8 action_code, u8 dialog_token, | 1230 | u8 action_code, u8 dialog_token, |
1233 | u16 status_code, const u8 *extra_ies, | 1231 | u16 status_code, const u8 *extra_ies, |
1234 | size_t extra_ies_len); | 1232 | size_t extra_ies_len); |
1235 | int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, | 1233 | int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer, |
1236 | u8 *peer, u8 action_code, u8 dialog_token, | 1234 | u8 action_code, u8 dialog_token, |
1237 | u16 status_code, const u8 *extra_ies, | 1235 | u16 status_code, const u8 *extra_ies, |
1238 | size_t extra_ies_len); | 1236 | size_t extra_ies_len); |
1239 | void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv, | 1237 | void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv, |
1240 | u8 *buf, int len); | 1238 | u8 *buf, int len); |
1241 | int mwifiex_tdls_oper(struct mwifiex_private *priv, u8 *peer, u8 action); | 1239 | int mwifiex_tdls_oper(struct mwifiex_private *priv, const u8 *peer, u8 action); |
1242 | int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, u8 *mac); | 1240 | int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, const u8 *mac); |
1243 | void mwifiex_disable_all_tdls_links(struct mwifiex_private *priv); | 1241 | void mwifiex_disable_all_tdls_links(struct mwifiex_private *priv); |
1244 | bool mwifiex_is_bss_in_11ac_mode(struct mwifiex_private *priv); | 1242 | bool mwifiex_is_bss_in_11ac_mode(struct mwifiex_private *priv); |
1245 | u8 mwifiex_get_center_freq_index(struct mwifiex_private *priv, u8 band, | 1243 | u8 mwifiex_get_center_freq_index(struct mwifiex_private *priv, u8 band, |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index a7e8b96b2d90..574d4b597468 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
@@ -221,9 +221,6 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev) | |||
221 | if (!adapter || !adapter->priv_num) | 221 | if (!adapter || !adapter->priv_num) |
222 | return; | 222 | return; |
223 | 223 | ||
224 | /* In case driver is removed when asynchronous FW load is in progress */ | ||
225 | wait_for_completion(&adapter->fw_load); | ||
226 | |||
227 | if (user_rmmod) { | 224 | if (user_rmmod) { |
228 | #ifdef CONFIG_PM_SLEEP | 225 | #ifdef CONFIG_PM_SLEEP |
229 | if (adapter->is_suspended) | 226 | if (adapter->is_suspended) |
@@ -1074,6 +1071,7 @@ static int mwifiex_pcie_send_data_complete(struct mwifiex_adapter *adapter) | |||
1074 | * is mapped to PCI device memory. Tx ring pointers are advanced accordingly. | 1071 | * is mapped to PCI device memory. Tx ring pointers are advanced accordingly. |
1075 | * Download ready interrupt to FW is deffered if Tx ring is not full and | 1072 | * Download ready interrupt to FW is deffered if Tx ring is not full and |
1076 | * additional payload can be accomodated. | 1073 | * additional payload can be accomodated. |
1074 | * Caller must ensure tx_param parameter to this function is not NULL. | ||
1077 | */ | 1075 | */ |
1078 | static int | 1076 | static int |
1079 | mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb, | 1077 | mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb, |
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index 7b3af3d29ded..45c5b3450cf5 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -29,9 +29,6 @@ | |||
29 | #define MWIFIEX_MAX_CHANNELS_PER_SPECIFIC_SCAN 14 | 29 | #define MWIFIEX_MAX_CHANNELS_PER_SPECIFIC_SCAN 14 |
30 | 30 | ||
31 | #define MWIFIEX_DEF_CHANNELS_PER_SCAN_CMD 4 | 31 | #define MWIFIEX_DEF_CHANNELS_PER_SCAN_CMD 4 |
32 | #define MWIFIEX_LIMIT_1_CHANNEL_PER_SCAN_CMD 15 | ||
33 | #define MWIFIEX_LIMIT_2_CHANNELS_PER_SCAN_CMD 27 | ||
34 | #define MWIFIEX_LIMIT_3_CHANNELS_PER_SCAN_CMD 35 | ||
35 | 32 | ||
36 | /* Memory needed to store a max sized Channel List TLV for a firmware scan */ | 33 | /* Memory needed to store a max sized Channel List TLV for a firmware scan */ |
37 | #define CHAN_TLV_MAX_SIZE (sizeof(struct mwifiex_ie_types_header) \ | 34 | #define CHAN_TLV_MAX_SIZE (sizeof(struct mwifiex_ie_types_header) \ |
@@ -1055,20 +1052,10 @@ mwifiex_config_scan(struct mwifiex_private *priv, | |||
1055 | 1052 | ||
1056 | /* | 1053 | /* |
1057 | * In associated state we will reduce the number of channels scanned per | 1054 | * In associated state we will reduce the number of channels scanned per |
1058 | * scan command to avoid any traffic delay/loss. This number is decided | 1055 | * scan command to 1 to avoid any traffic delay/loss. |
1059 | * based on total number of channels to be scanned due to constraints | ||
1060 | * of command buffers. | ||
1061 | */ | 1056 | */ |
1062 | if (priv->media_connected) { | 1057 | if (priv->media_connected) |
1063 | if (chan_num < MWIFIEX_LIMIT_1_CHANNEL_PER_SCAN_CMD) | ||
1064 | *max_chan_per_scan = 1; | 1058 | *max_chan_per_scan = 1; |
1065 | else if (chan_num < MWIFIEX_LIMIT_2_CHANNELS_PER_SCAN_CMD) | ||
1066 | *max_chan_per_scan = 2; | ||
1067 | else if (chan_num < MWIFIEX_LIMIT_3_CHANNELS_PER_SCAN_CMD) | ||
1068 | *max_chan_per_scan = 3; | ||
1069 | else | ||
1070 | *max_chan_per_scan = 4; | ||
1071 | } | ||
1072 | } | 1059 | } |
1073 | 1060 | ||
1074 | /* | 1061 | /* |
@@ -1353,23 +1340,17 @@ int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter, | |||
1353 | bss_entry->beacon_buf); | 1340 | bss_entry->beacon_buf); |
1354 | break; | 1341 | break; |
1355 | case WLAN_EID_BSS_COEX_2040: | 1342 | case WLAN_EID_BSS_COEX_2040: |
1356 | bss_entry->bcn_bss_co_2040 = current_ptr + | 1343 | bss_entry->bcn_bss_co_2040 = current_ptr; |
1357 | sizeof(struct ieee_types_header); | 1344 | bss_entry->bss_co_2040_offset = |
1358 | bss_entry->bss_co_2040_offset = (u16) (current_ptr + | 1345 | (u16) (current_ptr - bss_entry->beacon_buf); |
1359 | sizeof(struct ieee_types_header) - | ||
1360 | bss_entry->beacon_buf); | ||
1361 | break; | 1346 | break; |
1362 | case WLAN_EID_EXT_CAPABILITY: | 1347 | case WLAN_EID_EXT_CAPABILITY: |
1363 | bss_entry->bcn_ext_cap = current_ptr + | 1348 | bss_entry->bcn_ext_cap = current_ptr; |
1364 | sizeof(struct ieee_types_header); | 1349 | bss_entry->ext_cap_offset = |
1365 | bss_entry->ext_cap_offset = (u16) (current_ptr + | 1350 | (u16) (current_ptr - bss_entry->beacon_buf); |
1366 | sizeof(struct ieee_types_header) - | ||
1367 | bss_entry->beacon_buf); | ||
1368 | break; | 1351 | break; |
1369 | case WLAN_EID_OPMODE_NOTIF: | 1352 | case WLAN_EID_OPMODE_NOTIF: |
1370 | bss_entry->oper_mode = | 1353 | bss_entry->oper_mode = (void *)current_ptr; |
1371 | (void *)(current_ptr + | ||
1372 | sizeof(struct ieee_types_header)); | ||
1373 | bss_entry->oper_mode_offset = | 1354 | bss_entry->oper_mode_offset = |
1374 | (u16)((u8 *)bss_entry->oper_mode - | 1355 | (u16)((u8 *)bss_entry->oper_mode - |
1375 | bss_entry->beacon_buf); | 1356 | bss_entry->beacon_buf); |
@@ -1757,6 +1738,19 @@ mwifiex_parse_single_response_buf(struct mwifiex_private *priv, u8 **bss_info, | |||
1757 | return 0; | 1738 | return 0; |
1758 | } | 1739 | } |
1759 | 1740 | ||
1741 | static void mwifiex_complete_scan(struct mwifiex_private *priv) | ||
1742 | { | ||
1743 | struct mwifiex_adapter *adapter = priv->adapter; | ||
1744 | |||
1745 | if (adapter->curr_cmd->wait_q_enabled) { | ||
1746 | adapter->cmd_wait_q.status = 0; | ||
1747 | if (!priv->scan_request) { | ||
1748 | dev_dbg(adapter->dev, "complete internal scan\n"); | ||
1749 | mwifiex_complete_cmd(adapter, adapter->curr_cmd); | ||
1750 | } | ||
1751 | } | ||
1752 | } | ||
1753 | |||
1760 | static void mwifiex_check_next_scan_command(struct mwifiex_private *priv) | 1754 | static void mwifiex_check_next_scan_command(struct mwifiex_private *priv) |
1761 | { | 1755 | { |
1762 | struct mwifiex_adapter *adapter = priv->adapter; | 1756 | struct mwifiex_adapter *adapter = priv->adapter; |
@@ -1770,16 +1764,9 @@ static void mwifiex_check_next_scan_command(struct mwifiex_private *priv) | |||
1770 | adapter->scan_processing = false; | 1764 | adapter->scan_processing = false; |
1771 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); | 1765 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); |
1772 | 1766 | ||
1773 | /* Need to indicate IOCTL complete */ | 1767 | if (!adapter->ext_scan) |
1774 | if (adapter->curr_cmd->wait_q_enabled) { | 1768 | mwifiex_complete_scan(priv); |
1775 | adapter->cmd_wait_q.status = 0; | 1769 | |
1776 | if (!priv->scan_request) { | ||
1777 | dev_dbg(adapter->dev, | ||
1778 | "complete internal scan\n"); | ||
1779 | mwifiex_complete_cmd(adapter, | ||
1780 | adapter->curr_cmd); | ||
1781 | } | ||
1782 | } | ||
1783 | if (priv->report_scan_result) | 1770 | if (priv->report_scan_result) |
1784 | priv->report_scan_result = false; | 1771 | priv->report_scan_result = false; |
1785 | 1772 | ||
@@ -1984,6 +1971,9 @@ int mwifiex_cmd_802_11_scan_ext(struct mwifiex_private *priv, | |||
1984 | int mwifiex_ret_802_11_scan_ext(struct mwifiex_private *priv) | 1971 | int mwifiex_ret_802_11_scan_ext(struct mwifiex_private *priv) |
1985 | { | 1972 | { |
1986 | dev_dbg(priv->adapter->dev, "info: EXT scan returns successfully\n"); | 1973 | dev_dbg(priv->adapter->dev, "info: EXT scan returns successfully\n"); |
1974 | |||
1975 | mwifiex_complete_scan(priv); | ||
1976 | |||
1987 | return 0; | 1977 | return 0; |
1988 | } | 1978 | } |
1989 | 1979 | ||
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c index d206f04d4994..4ce3d7b33991 100644 --- a/drivers/net/wireless/mwifiex/sdio.c +++ b/drivers/net/wireless/mwifiex/sdio.c | |||
@@ -85,6 +85,8 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) | |||
85 | card->supports_sdio_new_mode = data->supports_sdio_new_mode; | 85 | card->supports_sdio_new_mode = data->supports_sdio_new_mode; |
86 | card->has_control_mask = data->has_control_mask; | 86 | card->has_control_mask = data->has_control_mask; |
87 | card->tx_buf_size = data->tx_buf_size; | 87 | card->tx_buf_size = data->tx_buf_size; |
88 | card->mp_tx_agg_buf_size = data->mp_tx_agg_buf_size; | ||
89 | card->mp_rx_agg_buf_size = data->mp_rx_agg_buf_size; | ||
88 | } | 90 | } |
89 | 91 | ||
90 | sdio_claim_host(func); | 92 | sdio_claim_host(func); |
@@ -177,9 +179,6 @@ mwifiex_sdio_remove(struct sdio_func *func) | |||
177 | if (!adapter || !adapter->priv_num) | 179 | if (!adapter || !adapter->priv_num) |
178 | return; | 180 | return; |
179 | 181 | ||
180 | /* In case driver is removed when asynchronous FW load is in progress */ | ||
181 | wait_for_completion(&adapter->fw_load); | ||
182 | |||
183 | if (user_rmmod) { | 182 | if (user_rmmod) { |
184 | if (adapter->is_suspended) | 183 | if (adapter->is_suspended) |
185 | mwifiex_sdio_resume(adapter->dev); | 184 | mwifiex_sdio_resume(adapter->dev); |
@@ -1679,8 +1678,12 @@ static int mwifiex_sdio_host_to_card(struct mwifiex_adapter *adapter, | |||
1679 | if (ret) { | 1678 | if (ret) { |
1680 | if (type == MWIFIEX_TYPE_CMD) | 1679 | if (type == MWIFIEX_TYPE_CMD) |
1681 | adapter->cmd_sent = false; | 1680 | adapter->cmd_sent = false; |
1682 | if (type == MWIFIEX_TYPE_DATA) | 1681 | if (type == MWIFIEX_TYPE_DATA) { |
1683 | adapter->data_sent = false; | 1682 | adapter->data_sent = false; |
1683 | /* restore curr_wr_port in error cases */ | ||
1684 | card->curr_wr_port = port; | ||
1685 | card->mp_wr_bitmap |= (u32)(1 << card->curr_wr_port); | ||
1686 | } | ||
1684 | } else { | 1687 | } else { |
1685 | if (type == MWIFIEX_TYPE_DATA) { | 1688 | if (type == MWIFIEX_TYPE_DATA) { |
1686 | if (!(card->mp_wr_bitmap & (1 << card->curr_wr_port))) | 1689 | if (!(card->mp_wr_bitmap & (1 << card->curr_wr_port))) |
@@ -1842,8 +1845,8 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter) | |||
1842 | card->mpa_rx.len_arr = kzalloc(sizeof(*card->mpa_rx.len_arr) * | 1845 | card->mpa_rx.len_arr = kzalloc(sizeof(*card->mpa_rx.len_arr) * |
1843 | card->mp_agg_pkt_limit, GFP_KERNEL); | 1846 | card->mp_agg_pkt_limit, GFP_KERNEL); |
1844 | ret = mwifiex_alloc_sdio_mpa_buffers(adapter, | 1847 | ret = mwifiex_alloc_sdio_mpa_buffers(adapter, |
1845 | SDIO_MP_TX_AGGR_DEF_BUF_SIZE, | 1848 | card->mp_tx_agg_buf_size, |
1846 | SDIO_MP_RX_AGGR_DEF_BUF_SIZE); | 1849 | card->mp_rx_agg_buf_size); |
1847 | if (ret) { | 1850 | if (ret) { |
1848 | dev_err(adapter->dev, "failed to alloc sdio mp-a buffers\n"); | 1851 | dev_err(adapter->dev, "failed to alloc sdio mp-a buffers\n"); |
1849 | kfree(card->mp_regs); | 1852 | kfree(card->mp_regs); |
diff --git a/drivers/net/wireless/mwifiex/sdio.h b/drivers/net/wireless/mwifiex/sdio.h index c71201b2e2a3..6eea30b43ed7 100644 --- a/drivers/net/wireless/mwifiex/sdio.h +++ b/drivers/net/wireless/mwifiex/sdio.h | |||
@@ -64,10 +64,8 @@ | |||
64 | #define UP_LD_CMD_PORT_HOST_INT_STATUS (0x40U) | 64 | #define UP_LD_CMD_PORT_HOST_INT_STATUS (0x40U) |
65 | #define DN_LD_CMD_PORT_HOST_INT_STATUS (0x80U) | 65 | #define DN_LD_CMD_PORT_HOST_INT_STATUS (0x80U) |
66 | 66 | ||
67 | #define SDIO_MP_TX_AGGR_DEF_BUF_SIZE (8192) /* 8K */ | 67 | #define MWIFIEX_MP_AGGR_BUF_SIZE_16K (16384) |
68 | 68 | #define MWIFIEX_MP_AGGR_BUF_SIZE_32K (32768) | |
69 | /* Multi port RX aggregation buffer size */ | ||
70 | #define SDIO_MP_RX_AGGR_DEF_BUF_SIZE (16384) /* 16K */ | ||
71 | 69 | ||
72 | /* Misc. Config Register : Auto Re-enable interrupts */ | 70 | /* Misc. Config Register : Auto Re-enable interrupts */ |
73 | #define AUTO_RE_ENABLE_INT BIT(4) | 71 | #define AUTO_RE_ENABLE_INT BIT(4) |
@@ -234,6 +232,8 @@ struct sdio_mmc_card { | |||
234 | bool supports_sdio_new_mode; | 232 | bool supports_sdio_new_mode; |
235 | bool has_control_mask; | 233 | bool has_control_mask; |
236 | u16 tx_buf_size; | 234 | u16 tx_buf_size; |
235 | u32 mp_tx_agg_buf_size; | ||
236 | u32 mp_rx_agg_buf_size; | ||
237 | 237 | ||
238 | u32 mp_rd_bitmap; | 238 | u32 mp_rd_bitmap; |
239 | u32 mp_wr_bitmap; | 239 | u32 mp_wr_bitmap; |
@@ -258,6 +258,8 @@ struct mwifiex_sdio_device { | |||
258 | bool supports_sdio_new_mode; | 258 | bool supports_sdio_new_mode; |
259 | bool has_control_mask; | 259 | bool has_control_mask; |
260 | u16 tx_buf_size; | 260 | u16 tx_buf_size; |
261 | u32 mp_tx_agg_buf_size; | ||
262 | u32 mp_rx_agg_buf_size; | ||
261 | }; | 263 | }; |
262 | 264 | ||
263 | static const struct mwifiex_sdio_card_reg mwifiex_reg_sd87xx = { | 265 | static const struct mwifiex_sdio_card_reg mwifiex_reg_sd87xx = { |
@@ -315,6 +317,8 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = { | |||
315 | .supports_sdio_new_mode = false, | 317 | .supports_sdio_new_mode = false, |
316 | .has_control_mask = true, | 318 | .has_control_mask = true, |
317 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, | 319 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, |
320 | .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, | ||
321 | .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, | ||
318 | }; | 322 | }; |
319 | 323 | ||
320 | static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = { | 324 | static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = { |
@@ -325,6 +329,8 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = { | |||
325 | .supports_sdio_new_mode = false, | 329 | .supports_sdio_new_mode = false, |
326 | .has_control_mask = true, | 330 | .has_control_mask = true, |
327 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, | 331 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, |
332 | .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, | ||
333 | .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, | ||
328 | }; | 334 | }; |
329 | 335 | ||
330 | static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = { | 336 | static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = { |
@@ -335,6 +341,8 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = { | |||
335 | .supports_sdio_new_mode = false, | 341 | .supports_sdio_new_mode = false, |
336 | .has_control_mask = true, | 342 | .has_control_mask = true, |
337 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, | 343 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, |
344 | .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, | ||
345 | .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, | ||
338 | }; | 346 | }; |
339 | 347 | ||
340 | static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = { | 348 | static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = { |
@@ -345,6 +353,8 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = { | |||
345 | .supports_sdio_new_mode = true, | 353 | .supports_sdio_new_mode = true, |
346 | .has_control_mask = false, | 354 | .has_control_mask = false, |
347 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K, | 355 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K, |
356 | .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K, | ||
357 | .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K, | ||
348 | }; | 358 | }; |
349 | 359 | ||
350 | /* | 360 | /* |
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c index e3cac1495cc7..88202ce0c139 100644 --- a/drivers/net/wireless/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/mwifiex/sta_cmd.c | |||
@@ -1546,6 +1546,7 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv, | |||
1546 | struct mwifiex_ie_types_extcap *extcap; | 1546 | struct mwifiex_ie_types_extcap *extcap; |
1547 | struct mwifiex_ie_types_vhtcap *vht_capab; | 1547 | struct mwifiex_ie_types_vhtcap *vht_capab; |
1548 | struct mwifiex_ie_types_aid *aid; | 1548 | struct mwifiex_ie_types_aid *aid; |
1549 | struct mwifiex_ie_types_tdls_idle_timeout *timeout; | ||
1549 | u8 *pos, qos_info; | 1550 | u8 *pos, qos_info; |
1550 | u16 config_len = 0; | 1551 | u16 config_len = 0; |
1551 | struct station_parameters *params = priv->sta_params; | 1552 | struct station_parameters *params = priv->sta_params; |
@@ -1643,6 +1644,12 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv, | |||
1643 | config_len += sizeof(struct mwifiex_ie_types_aid); | 1644 | config_len += sizeof(struct mwifiex_ie_types_aid); |
1644 | } | 1645 | } |
1645 | 1646 | ||
1647 | timeout = (void *)(pos + config_len); | ||
1648 | timeout->header.type = cpu_to_le16(TLV_TYPE_TDLS_IDLE_TIMEOUT); | ||
1649 | timeout->header.len = cpu_to_le16(sizeof(timeout->value)); | ||
1650 | timeout->value = cpu_to_le16(MWIFIEX_TDLS_IDLE_TIMEOUT); | ||
1651 | config_len += sizeof(struct mwifiex_ie_types_tdls_idle_timeout); | ||
1652 | |||
1646 | break; | 1653 | break; |
1647 | default: | 1654 | default: |
1648 | dev_err(priv->adapter->dev, "Unknown TDLS operation\n"); | 1655 | dev_err(priv->adapter->dev, "Unknown TDLS operation\n"); |
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c index bfebb0144df5..577f2979ed8f 100644 --- a/drivers/net/wireless/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c | |||
@@ -865,14 +865,20 @@ static int mwifiex_ret_tdls_oper(struct mwifiex_private *priv, | |||
865 | 865 | ||
866 | switch (action) { | 866 | switch (action) { |
867 | case ACT_TDLS_DELETE: | 867 | case ACT_TDLS_DELETE: |
868 | if (reason) | 868 | if (reason) { |
869 | dev_err(priv->adapter->dev, | 869 | if (!node || reason == TDLS_ERR_LINK_NONEXISTENT) |
870 | "TDLS link delete for %pM failed: reason %d\n", | 870 | dev_dbg(priv->adapter->dev, |
871 | cmd_tdls_oper->peer_mac, reason); | 871 | "TDLS link delete for %pM failed: reason %d\n", |
872 | else | 872 | cmd_tdls_oper->peer_mac, reason); |
873 | else | ||
874 | dev_err(priv->adapter->dev, | ||
875 | "TDLS link delete for %pM failed: reason %d\n", | ||
876 | cmd_tdls_oper->peer_mac, reason); | ||
877 | } else { | ||
873 | dev_dbg(priv->adapter->dev, | 878 | dev_dbg(priv->adapter->dev, |
874 | "TDLS link config for %pM successful\n", | 879 | "TDLS link delete for %pM successful\n", |
875 | cmd_tdls_oper->peer_mac); | 880 | cmd_tdls_oper->peer_mac); |
881 | } | ||
876 | break; | 882 | break; |
877 | case ACT_TDLS_CREATE: | 883 | case ACT_TDLS_CREATE: |
878 | if (reason) { | 884 | if (reason) { |
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c index 368450cc56c7..f6395ef11a72 100644 --- a/drivers/net/wireless/mwifiex/sta_event.c +++ b/drivers/net/wireless/mwifiex/sta_event.c | |||
@@ -134,6 +134,46 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code) | |||
134 | netif_carrier_off(priv->netdev); | 134 | netif_carrier_off(priv->netdev); |
135 | } | 135 | } |
136 | 136 | ||
137 | static int mwifiex_parse_tdls_event(struct mwifiex_private *priv, | ||
138 | struct sk_buff *event_skb) | ||
139 | { | ||
140 | int ret = 0; | ||
141 | struct mwifiex_adapter *adapter = priv->adapter; | ||
142 | struct mwifiex_sta_node *sta_ptr; | ||
143 | struct mwifiex_tdls_generic_event *tdls_evt = | ||
144 | (void *)event_skb->data + sizeof(adapter->event_cause); | ||
145 | |||
146 | /* reserved 2 bytes are not mandatory in tdls event */ | ||
147 | if (event_skb->len < (sizeof(struct mwifiex_tdls_generic_event) - | ||
148 | sizeof(u16) - sizeof(adapter->event_cause))) { | ||
149 | dev_err(adapter->dev, "Invalid event length!\n"); | ||
150 | return -1; | ||
151 | } | ||
152 | |||
153 | sta_ptr = mwifiex_get_sta_entry(priv, tdls_evt->peer_mac); | ||
154 | if (!sta_ptr) { | ||
155 | dev_err(adapter->dev, "cannot get sta entry!\n"); | ||
156 | return -1; | ||
157 | } | ||
158 | |||
159 | switch (le16_to_cpu(tdls_evt->type)) { | ||
160 | case TDLS_EVENT_LINK_TEAR_DOWN: | ||
161 | cfg80211_tdls_oper_request(priv->netdev, | ||
162 | tdls_evt->peer_mac, | ||
163 | NL80211_TDLS_TEARDOWN, | ||
164 | le16_to_cpu(tdls_evt->u.reason_code), | ||
165 | GFP_KERNEL); | ||
166 | ret = mwifiex_tdls_oper(priv, tdls_evt->peer_mac, | ||
167 | MWIFIEX_TDLS_DISABLE_LINK); | ||
168 | queue_work(adapter->workqueue, &adapter->main_work); | ||
169 | break; | ||
170 | default: | ||
171 | break; | ||
172 | } | ||
173 | |||
174 | return ret; | ||
175 | } | ||
176 | |||
137 | /* | 177 | /* |
138 | * This function handles events generated by firmware. | 178 | * This function handles events generated by firmware. |
139 | * | 179 | * |
@@ -459,6 +499,10 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
459 | false); | 499 | false); |
460 | break; | 500 | break; |
461 | 501 | ||
502 | case EVENT_TDLS_GENERIC_EVENT: | ||
503 | ret = mwifiex_parse_tdls_event(priv, adapter->event_skb); | ||
504 | break; | ||
505 | |||
462 | default: | 506 | default: |
463 | dev_dbg(adapter->dev, "event: unknown event id: %#x\n", | 507 | dev_dbg(adapter->dev, "event: unknown event id: %#x\n", |
464 | eventcause); | 508 | eventcause); |
diff --git a/drivers/net/wireless/mwifiex/sta_rx.c b/drivers/net/wireless/mwifiex/sta_rx.c index ed26387eccf5..8b639d7fe6df 100644 --- a/drivers/net/wireless/mwifiex/sta_rx.c +++ b/drivers/net/wireless/mwifiex/sta_rx.c | |||
@@ -183,6 +183,7 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_private *priv, | |||
183 | struct rx_packet_hdr *rx_pkt_hdr; | 183 | struct rx_packet_hdr *rx_pkt_hdr; |
184 | u8 ta[ETH_ALEN]; | 184 | u8 ta[ETH_ALEN]; |
185 | u16 rx_pkt_type, rx_pkt_offset, rx_pkt_length, seq_num; | 185 | u16 rx_pkt_type, rx_pkt_offset, rx_pkt_length, seq_num; |
186 | struct mwifiex_sta_node *sta_ptr; | ||
186 | 187 | ||
187 | local_rx_pd = (struct rxpd *) (skb->data); | 188 | local_rx_pd = (struct rxpd *) (skb->data); |
188 | rx_pkt_type = le16_to_cpu(local_rx_pd->rx_pkt_type); | 189 | rx_pkt_type = le16_to_cpu(local_rx_pd->rx_pkt_type); |
@@ -213,14 +214,25 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_private *priv, | |||
213 | * If the packet is not an unicast packet then send the packet | 214 | * If the packet is not an unicast packet then send the packet |
214 | * directly to os. Don't pass thru rx reordering | 215 | * directly to os. Don't pass thru rx reordering |
215 | */ | 216 | */ |
216 | if (!IS_11N_ENABLED(priv) || | 217 | if ((!IS_11N_ENABLED(priv) && |
218 | !(ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) && | ||
219 | !(local_rx_pd->flags & MWIFIEX_RXPD_FLAGS_TDLS_PACKET))) || | ||
217 | !ether_addr_equal_unaligned(priv->curr_addr, rx_pkt_hdr->eth803_hdr.h_dest)) { | 220 | !ether_addr_equal_unaligned(priv->curr_addr, rx_pkt_hdr->eth803_hdr.h_dest)) { |
218 | mwifiex_process_rx_packet(priv, skb); | 221 | mwifiex_process_rx_packet(priv, skb); |
219 | return ret; | 222 | return ret; |
220 | } | 223 | } |
221 | 224 | ||
222 | if (mwifiex_queuing_ra_based(priv)) { | 225 | if (mwifiex_queuing_ra_based(priv) || |
226 | (ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) && | ||
227 | local_rx_pd->flags & MWIFIEX_RXPD_FLAGS_TDLS_PACKET)) { | ||
223 | memcpy(ta, rx_pkt_hdr->eth803_hdr.h_source, ETH_ALEN); | 228 | memcpy(ta, rx_pkt_hdr->eth803_hdr.h_source, ETH_ALEN); |
229 | if (local_rx_pd->flags & MWIFIEX_RXPD_FLAGS_TDLS_PACKET && | ||
230 | local_rx_pd->priority < MAX_NUM_TID) { | ||
231 | sta_ptr = mwifiex_get_sta_entry(priv, ta); | ||
232 | if (sta_ptr) | ||
233 | sta_ptr->rx_seq[local_rx_pd->priority] = | ||
234 | le16_to_cpu(local_rx_pd->seq_num); | ||
235 | } | ||
224 | } else { | 236 | } else { |
225 | if (rx_pkt_type != PKT_TYPE_BAR) | 237 | if (rx_pkt_type != PKT_TYPE_BAR) |
226 | priv->rx_seq[local_rx_pd->priority] = seq_num; | 238 | priv->rx_seq[local_rx_pd->priority] = seq_num; |
diff --git a/drivers/net/wireless/mwifiex/sta_tx.c b/drivers/net/wireless/mwifiex/sta_tx.c index 1236a5de7bca..5fce7e78a36e 100644 --- a/drivers/net/wireless/mwifiex/sta_tx.c +++ b/drivers/net/wireless/mwifiex/sta_tx.c | |||
@@ -128,6 +128,7 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags) | |||
128 | { | 128 | { |
129 | struct mwifiex_adapter *adapter = priv->adapter; | 129 | struct mwifiex_adapter *adapter = priv->adapter; |
130 | struct txpd *local_tx_pd; | 130 | struct txpd *local_tx_pd; |
131 | struct mwifiex_tx_param tx_param; | ||
131 | /* sizeof(struct txpd) + Interface specific header */ | 132 | /* sizeof(struct txpd) + Interface specific header */ |
132 | #define NULL_PACKET_HDR 64 | 133 | #define NULL_PACKET_HDR 64 |
133 | u32 data_len = NULL_PACKET_HDR; | 134 | u32 data_len = NULL_PACKET_HDR; |
@@ -168,8 +169,9 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags) | |||
168 | skb, NULL); | 169 | skb, NULL); |
169 | } else { | 170 | } else { |
170 | skb_push(skb, INTF_HEADER_LEN); | 171 | skb_push(skb, INTF_HEADER_LEN); |
172 | tx_param.next_pkt_len = 0; | ||
171 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, | 173 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, |
172 | skb, NULL); | 174 | skb, &tx_param); |
173 | } | 175 | } |
174 | switch (ret) { | 176 | switch (ret) { |
175 | case -EBUSY: | 177 | case -EBUSY: |
diff --git a/drivers/net/wireless/mwifiex/tdls.c b/drivers/net/wireless/mwifiex/tdls.c index 97662a1ba58c..e73034fbbde9 100644 --- a/drivers/net/wireless/mwifiex/tdls.c +++ b/drivers/net/wireless/mwifiex/tdls.c | |||
@@ -25,8 +25,8 @@ | |||
25 | #define TDLS_RESP_FIX_LEN 8 | 25 | #define TDLS_RESP_FIX_LEN 8 |
26 | #define TDLS_CONFIRM_FIX_LEN 6 | 26 | #define TDLS_CONFIRM_FIX_LEN 6 |
27 | 27 | ||
28 | static void | 28 | static void mwifiex_restore_tdls_packets(struct mwifiex_private *priv, |
29 | mwifiex_restore_tdls_packets(struct mwifiex_private *priv, u8 *mac, u8 status) | 29 | const u8 *mac, u8 status) |
30 | { | 30 | { |
31 | struct mwifiex_ra_list_tbl *ra_list; | 31 | struct mwifiex_ra_list_tbl *ra_list; |
32 | struct list_head *tid_list; | 32 | struct list_head *tid_list; |
@@ -84,7 +84,8 @@ mwifiex_restore_tdls_packets(struct mwifiex_private *priv, u8 *mac, u8 status) | |||
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | 86 | ||
87 | static void mwifiex_hold_tdls_packets(struct mwifiex_private *priv, u8 *mac) | 87 | static void mwifiex_hold_tdls_packets(struct mwifiex_private *priv, |
88 | const u8 *mac) | ||
88 | { | 89 | { |
89 | struct mwifiex_ra_list_tbl *ra_list; | 90 | struct mwifiex_ra_list_tbl *ra_list; |
90 | struct list_head *ra_list_head; | 91 | struct list_head *ra_list_head; |
@@ -185,8 +186,50 @@ static int mwifiex_tdls_add_vht_capab(struct mwifiex_private *priv, | |||
185 | return 0; | 186 | return 0; |
186 | } | 187 | } |
187 | 188 | ||
189 | static int | ||
190 | mwifiex_tdls_add_ht_oper(struct mwifiex_private *priv, const u8 *mac, | ||
191 | u8 vht_enabled, struct sk_buff *skb) | ||
192 | { | ||
193 | struct ieee80211_ht_operation *ht_oper; | ||
194 | struct mwifiex_sta_node *sta_ptr; | ||
195 | struct mwifiex_bssdescriptor *bss_desc = | ||
196 | &priv->curr_bss_params.bss_descriptor; | ||
197 | u8 *pos; | ||
198 | |||
199 | sta_ptr = mwifiex_get_sta_entry(priv, mac); | ||
200 | if (unlikely(!sta_ptr)) { | ||
201 | dev_warn(priv->adapter->dev, | ||
202 | "TDLS peer station not found in list\n"); | ||
203 | return -1; | ||
204 | } | ||
205 | |||
206 | pos = (void *)skb_put(skb, sizeof(struct ieee80211_ht_operation) + 2); | ||
207 | *pos++ = WLAN_EID_HT_OPERATION; | ||
208 | *pos++ = sizeof(struct ieee80211_ht_operation); | ||
209 | ht_oper = (void *)pos; | ||
210 | |||
211 | ht_oper->primary_chan = bss_desc->channel; | ||
212 | |||
213 | /* follow AP's channel bandwidth */ | ||
214 | if (ISSUPP_CHANWIDTH40(priv->adapter->hw_dot_11n_dev_cap) && | ||
215 | bss_desc->bcn_ht_cap && | ||
216 | ISALLOWED_CHANWIDTH40(bss_desc->bcn_ht_oper->ht_param)) | ||
217 | ht_oper->ht_param = bss_desc->bcn_ht_oper->ht_param; | ||
218 | |||
219 | if (vht_enabled) { | ||
220 | ht_oper->ht_param = | ||
221 | mwifiex_get_sec_chan_offset(bss_desc->channel); | ||
222 | ht_oper->ht_param |= BIT(2); | ||
223 | } | ||
224 | |||
225 | memcpy(&sta_ptr->tdls_cap.ht_oper, ht_oper, | ||
226 | sizeof(struct ieee80211_ht_operation)); | ||
227 | |||
228 | return 0; | ||
229 | } | ||
230 | |||
188 | static int mwifiex_tdls_add_vht_oper(struct mwifiex_private *priv, | 231 | static int mwifiex_tdls_add_vht_oper(struct mwifiex_private *priv, |
189 | u8 *mac, struct sk_buff *skb) | 232 | const u8 *mac, struct sk_buff *skb) |
190 | { | 233 | { |
191 | struct mwifiex_bssdescriptor *bss_desc; | 234 | struct mwifiex_bssdescriptor *bss_desc; |
192 | struct ieee80211_vht_operation *vht_oper; | 235 | struct ieee80211_vht_operation *vht_oper; |
@@ -325,8 +368,9 @@ static void mwifiex_tdls_add_qos_capab(struct sk_buff *skb) | |||
325 | } | 368 | } |
326 | 369 | ||
327 | static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv, | 370 | static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv, |
328 | u8 *peer, u8 action_code, u8 dialog_token, | 371 | const u8 *peer, u8 action_code, |
329 | u16 status_code, struct sk_buff *skb) | 372 | u8 dialog_token, |
373 | u16 status_code, struct sk_buff *skb) | ||
330 | { | 374 | { |
331 | struct ieee80211_tdls_data *tf; | 375 | struct ieee80211_tdls_data *tf; |
332 | int ret; | 376 | int ret; |
@@ -428,6 +472,17 @@ static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv, | |||
428 | dev_kfree_skb_any(skb); | 472 | dev_kfree_skb_any(skb); |
429 | return ret; | 473 | return ret; |
430 | } | 474 | } |
475 | ret = mwifiex_tdls_add_ht_oper(priv, peer, 1, skb); | ||
476 | if (ret) { | ||
477 | dev_kfree_skb_any(skb); | ||
478 | return ret; | ||
479 | } | ||
480 | } else { | ||
481 | ret = mwifiex_tdls_add_ht_oper(priv, peer, 0, skb); | ||
482 | if (ret) { | ||
483 | dev_kfree_skb_any(skb); | ||
484 | return ret; | ||
485 | } | ||
431 | } | 486 | } |
432 | break; | 487 | break; |
433 | 488 | ||
@@ -453,7 +508,8 @@ static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv, | |||
453 | } | 508 | } |
454 | 509 | ||
455 | static void | 510 | static void |
456 | mwifiex_tdls_add_link_ie(struct sk_buff *skb, u8 *src_addr, u8 *peer, u8 *bssid) | 511 | mwifiex_tdls_add_link_ie(struct sk_buff *skb, const u8 *src_addr, |
512 | const u8 *peer, const u8 *bssid) | ||
457 | { | 513 | { |
458 | struct ieee80211_tdls_lnkie *lnkid; | 514 | struct ieee80211_tdls_lnkie *lnkid; |
459 | 515 | ||
@@ -467,8 +523,8 @@ mwifiex_tdls_add_link_ie(struct sk_buff *skb, u8 *src_addr, u8 *peer, u8 *bssid) | |||
467 | memcpy(lnkid->resp_sta, peer, ETH_ALEN); | 523 | memcpy(lnkid->resp_sta, peer, ETH_ALEN); |
468 | } | 524 | } |
469 | 525 | ||
470 | int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, | 526 | int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer, |
471 | u8 *peer, u8 action_code, u8 dialog_token, | 527 | u8 action_code, u8 dialog_token, |
472 | u16 status_code, const u8 *extra_ies, | 528 | u16 status_code, const u8 *extra_ies, |
473 | size_t extra_ies_len) | 529 | size_t extra_ies_len) |
474 | { | 530 | { |
@@ -560,7 +616,8 @@ int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, | |||
560 | } | 616 | } |
561 | 617 | ||
562 | static int | 618 | static int |
563 | mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv, u8 *peer, | 619 | mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv, |
620 | const u8 *peer, | ||
564 | u8 action_code, u8 dialog_token, | 621 | u8 action_code, u8 dialog_token, |
565 | u16 status_code, struct sk_buff *skb) | 622 | u16 status_code, struct sk_buff *skb) |
566 | { | 623 | { |
@@ -638,10 +695,10 @@ mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv, u8 *peer, | |||
638 | return 0; | 695 | return 0; |
639 | } | 696 | } |
640 | 697 | ||
641 | int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, | 698 | int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer, |
642 | u8 *peer, u8 action_code, u8 dialog_token, | 699 | u8 action_code, u8 dialog_token, |
643 | u16 status_code, const u8 *extra_ies, | 700 | u16 status_code, const u8 *extra_ies, |
644 | size_t extra_ies_len) | 701 | size_t extra_ies_len) |
645 | { | 702 | { |
646 | struct sk_buff *skb; | 703 | struct sk_buff *skb; |
647 | struct mwifiex_txinfo *tx_info; | 704 | struct mwifiex_txinfo *tx_info; |
@@ -848,7 +905,7 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv, | |||
848 | } | 905 | } |
849 | 906 | ||
850 | static int | 907 | static int |
851 | mwifiex_tdls_process_config_link(struct mwifiex_private *priv, u8 *peer) | 908 | mwifiex_tdls_process_config_link(struct mwifiex_private *priv, const u8 *peer) |
852 | { | 909 | { |
853 | struct mwifiex_sta_node *sta_ptr; | 910 | struct mwifiex_sta_node *sta_ptr; |
854 | struct mwifiex_ds_tdls_oper tdls_oper; | 911 | struct mwifiex_ds_tdls_oper tdls_oper; |
@@ -869,7 +926,7 @@ mwifiex_tdls_process_config_link(struct mwifiex_private *priv, u8 *peer) | |||
869 | } | 926 | } |
870 | 927 | ||
871 | static int | 928 | static int |
872 | mwifiex_tdls_process_create_link(struct mwifiex_private *priv, u8 *peer) | 929 | mwifiex_tdls_process_create_link(struct mwifiex_private *priv, const u8 *peer) |
873 | { | 930 | { |
874 | struct mwifiex_sta_node *sta_ptr; | 931 | struct mwifiex_sta_node *sta_ptr; |
875 | struct mwifiex_ds_tdls_oper tdls_oper; | 932 | struct mwifiex_ds_tdls_oper tdls_oper; |
@@ -896,7 +953,7 @@ mwifiex_tdls_process_create_link(struct mwifiex_private *priv, u8 *peer) | |||
896 | } | 953 | } |
897 | 954 | ||
898 | static int | 955 | static int |
899 | mwifiex_tdls_process_disable_link(struct mwifiex_private *priv, u8 *peer) | 956 | mwifiex_tdls_process_disable_link(struct mwifiex_private *priv, const u8 *peer) |
900 | { | 957 | { |
901 | struct mwifiex_sta_node *sta_ptr; | 958 | struct mwifiex_sta_node *sta_ptr; |
902 | struct mwifiex_ds_tdls_oper tdls_oper; | 959 | struct mwifiex_ds_tdls_oper tdls_oper; |
@@ -925,7 +982,7 @@ mwifiex_tdls_process_disable_link(struct mwifiex_private *priv, u8 *peer) | |||
925 | } | 982 | } |
926 | 983 | ||
927 | static int | 984 | static int |
928 | mwifiex_tdls_process_enable_link(struct mwifiex_private *priv, u8 *peer) | 985 | mwifiex_tdls_process_enable_link(struct mwifiex_private *priv, const u8 *peer) |
929 | { | 986 | { |
930 | struct mwifiex_sta_node *sta_ptr; | 987 | struct mwifiex_sta_node *sta_ptr; |
931 | struct ieee80211_mcs_info mcs; | 988 | struct ieee80211_mcs_info mcs; |
@@ -982,7 +1039,7 @@ mwifiex_tdls_process_enable_link(struct mwifiex_private *priv, u8 *peer) | |||
982 | return 0; | 1039 | return 0; |
983 | } | 1040 | } |
984 | 1041 | ||
985 | int mwifiex_tdls_oper(struct mwifiex_private *priv, u8 *peer, u8 action) | 1042 | int mwifiex_tdls_oper(struct mwifiex_private *priv, const u8 *peer, u8 action) |
986 | { | 1043 | { |
987 | switch (action) { | 1044 | switch (action) { |
988 | case MWIFIEX_TDLS_ENABLE_LINK: | 1045 | case MWIFIEX_TDLS_ENABLE_LINK: |
@@ -997,7 +1054,7 @@ int mwifiex_tdls_oper(struct mwifiex_private *priv, u8 *peer, u8 action) | |||
997 | return 0; | 1054 | return 0; |
998 | } | 1055 | } |
999 | 1056 | ||
1000 | int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, u8 *mac) | 1057 | int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, const u8 *mac) |
1001 | { | 1058 | { |
1002 | struct mwifiex_sta_node *sta_ptr; | 1059 | struct mwifiex_sta_node *sta_ptr; |
1003 | 1060 | ||
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c b/drivers/net/wireless/mwifiex/uap_cmd.c index 9be6544bdded..32643555dd2a 100644 --- a/drivers/net/wireless/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/mwifiex/uap_cmd.c | |||
@@ -175,17 +175,19 @@ mwifiex_set_ht_params(struct mwifiex_private *priv, | |||
175 | switch (GET_RXSTBC(cap_info)) { | 175 | switch (GET_RXSTBC(cap_info)) { |
176 | case MWIFIEX_RX_STBC1: | 176 | case MWIFIEX_RX_STBC1: |
177 | /* HT_CAP 1X1 mode */ | 177 | /* HT_CAP 1X1 mode */ |
178 | memset(&bss_cfg->ht_cap.mcs, 0xff, 1); | 178 | bss_cfg->ht_cap.mcs.rx_mask[0] = 0xff; |
179 | break; | 179 | break; |
180 | case MWIFIEX_RX_STBC12: /* fall through */ | 180 | case MWIFIEX_RX_STBC12: /* fall through */ |
181 | case MWIFIEX_RX_STBC123: | 181 | case MWIFIEX_RX_STBC123: |
182 | /* HT_CAP 2X2 mode */ | 182 | /* HT_CAP 2X2 mode */ |
183 | memset(&bss_cfg->ht_cap.mcs, 0xff, 2); | 183 | bss_cfg->ht_cap.mcs.rx_mask[0] = 0xff; |
184 | bss_cfg->ht_cap.mcs.rx_mask[1] = 0xff; | ||
184 | break; | 185 | break; |
185 | default: | 186 | default: |
186 | dev_warn(priv->adapter->dev, | 187 | dev_warn(priv->adapter->dev, |
187 | "Unsupported RX-STBC, default to 2x2\n"); | 188 | "Unsupported RX-STBC, default to 2x2\n"); |
188 | memset(&bss_cfg->ht_cap.mcs, 0xff, 2); | 189 | bss_cfg->ht_cap.mcs.rx_mask[0] = 0xff; |
190 | bss_cfg->ht_cap.mcs.rx_mask[1] = 0xff; | ||
189 | break; | 191 | break; |
190 | } | 192 | } |
191 | priv->ap_11n_enabled = 1; | 193 | priv->ap_11n_enabled = 1; |
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c index edbe4aff00d8..a8ce8130cfae 100644 --- a/drivers/net/wireless/mwifiex/usb.c +++ b/drivers/net/wireless/mwifiex/usb.c | |||
@@ -22,9 +22,9 @@ | |||
22 | 22 | ||
23 | #define USB_VERSION "1.0" | 23 | #define USB_VERSION "1.0" |
24 | 24 | ||
25 | static u8 user_rmmod; | ||
25 | static struct mwifiex_if_ops usb_ops; | 26 | static struct mwifiex_if_ops usb_ops; |
26 | static struct semaphore add_remove_card_sem; | 27 | static struct semaphore add_remove_card_sem; |
27 | static struct usb_card_rec *usb_card; | ||
28 | 28 | ||
29 | static struct usb_device_id mwifiex_usb_table[] = { | 29 | static struct usb_device_id mwifiex_usb_table[] = { |
30 | /* 8797 */ | 30 | /* 8797 */ |
@@ -532,28 +532,38 @@ static int mwifiex_usb_resume(struct usb_interface *intf) | |||
532 | static void mwifiex_usb_disconnect(struct usb_interface *intf) | 532 | static void mwifiex_usb_disconnect(struct usb_interface *intf) |
533 | { | 533 | { |
534 | struct usb_card_rec *card = usb_get_intfdata(intf); | 534 | struct usb_card_rec *card = usb_get_intfdata(intf); |
535 | struct mwifiex_adapter *adapter; | ||
535 | 536 | ||
536 | if (!card) { | 537 | if (!card || !card->adapter) { |
537 | pr_err("%s: card is NULL\n", __func__); | 538 | pr_err("%s: card or card->adapter is NULL\n", __func__); |
538 | return; | 539 | return; |
539 | } | 540 | } |
540 | 541 | ||
541 | mwifiex_usb_free(card); | 542 | adapter = card->adapter; |
543 | if (!adapter->priv_num) | ||
544 | return; | ||
542 | 545 | ||
543 | if (card->adapter) { | 546 | if (user_rmmod) { |
544 | struct mwifiex_adapter *adapter = card->adapter; | 547 | #ifdef CONFIG_PM |
548 | if (adapter->is_suspended) | ||
549 | mwifiex_usb_resume(intf); | ||
550 | #endif | ||
545 | 551 | ||
546 | if (!adapter->priv_num) | 552 | mwifiex_deauthenticate_all(adapter); |
547 | return; | ||
548 | 553 | ||
549 | dev_dbg(adapter->dev, "%s: removing card\n", __func__); | 554 | mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter, |
550 | mwifiex_remove_card(adapter, &add_remove_card_sem); | 555 | MWIFIEX_BSS_ROLE_ANY), |
556 | MWIFIEX_FUNC_SHUTDOWN); | ||
551 | } | 557 | } |
552 | 558 | ||
559 | mwifiex_usb_free(card); | ||
560 | |||
561 | dev_dbg(adapter->dev, "%s: removing card\n", __func__); | ||
562 | mwifiex_remove_card(adapter, &add_remove_card_sem); | ||
563 | |||
553 | usb_set_intfdata(intf, NULL); | 564 | usb_set_intfdata(intf, NULL); |
554 | usb_put_dev(interface_to_usbdev(intf)); | 565 | usb_put_dev(interface_to_usbdev(intf)); |
555 | kfree(card); | 566 | kfree(card); |
556 | usb_card = NULL; | ||
557 | 567 | ||
558 | return; | 568 | return; |
559 | } | 569 | } |
@@ -565,6 +575,7 @@ static struct usb_driver mwifiex_usb_driver = { | |||
565 | .id_table = mwifiex_usb_table, | 575 | .id_table = mwifiex_usb_table, |
566 | .suspend = mwifiex_usb_suspend, | 576 | .suspend = mwifiex_usb_suspend, |
567 | .resume = mwifiex_usb_resume, | 577 | .resume = mwifiex_usb_resume, |
578 | .soft_unbind = 1, | ||
568 | }; | 579 | }; |
569 | 580 | ||
570 | static int mwifiex_usb_tx_init(struct mwifiex_adapter *adapter) | 581 | static int mwifiex_usb_tx_init(struct mwifiex_adapter *adapter) |
@@ -762,7 +773,6 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) | |||
762 | 773 | ||
763 | card->adapter = adapter; | 774 | card->adapter = adapter; |
764 | adapter->dev = &card->udev->dev; | 775 | adapter->dev = &card->udev->dev; |
765 | usb_card = card; | ||
766 | 776 | ||
767 | switch (le16_to_cpu(card->udev->descriptor.idProduct)) { | 777 | switch (le16_to_cpu(card->udev->descriptor.idProduct)) { |
768 | case USB8897_PID_1: | 778 | case USB8897_PID_1: |
@@ -1025,25 +1035,8 @@ static void mwifiex_usb_cleanup_module(void) | |||
1025 | if (!down_interruptible(&add_remove_card_sem)) | 1035 | if (!down_interruptible(&add_remove_card_sem)) |
1026 | up(&add_remove_card_sem); | 1036 | up(&add_remove_card_sem); |
1027 | 1037 | ||
1028 | if (usb_card && usb_card->adapter) { | 1038 | /* set the flag as user is removing this module */ |
1029 | struct mwifiex_adapter *adapter = usb_card->adapter; | 1039 | user_rmmod = 1; |
1030 | |||
1031 | /* In case driver is removed when asynchronous FW downloading is | ||
1032 | * in progress | ||
1033 | */ | ||
1034 | wait_for_completion(&adapter->fw_load); | ||
1035 | |||
1036 | #ifdef CONFIG_PM | ||
1037 | if (adapter->is_suspended) | ||
1038 | mwifiex_usb_resume(usb_card->intf); | ||
1039 | #endif | ||
1040 | |||
1041 | mwifiex_deauthenticate_all(adapter); | ||
1042 | |||
1043 | mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter, | ||
1044 | MWIFIEX_BSS_ROLE_ANY), | ||
1045 | MWIFIEX_FUNC_SHUTDOWN); | ||
1046 | } | ||
1047 | 1040 | ||
1048 | usb_deregister(&mwifiex_usb_driver); | 1041 | usb_deregister(&mwifiex_usb_driver); |
1049 | } | 1042 | } |
diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c index c3824e37f3f2..6da5abf52e61 100644 --- a/drivers/net/wireless/mwifiex/util.c +++ b/drivers/net/wireless/mwifiex/util.c | |||
@@ -259,7 +259,7 @@ int mwifiex_complete_cmd(struct mwifiex_adapter *adapter, | |||
259 | * NULL is returned if station entry is not found in associated STA list. | 259 | * NULL is returned if station entry is not found in associated STA list. |
260 | */ | 260 | */ |
261 | struct mwifiex_sta_node * | 261 | struct mwifiex_sta_node * |
262 | mwifiex_get_sta_entry(struct mwifiex_private *priv, u8 *mac) | 262 | mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac) |
263 | { | 263 | { |
264 | struct mwifiex_sta_node *node; | 264 | struct mwifiex_sta_node *node; |
265 | 265 | ||
@@ -280,7 +280,7 @@ mwifiex_get_sta_entry(struct mwifiex_private *priv, u8 *mac) | |||
280 | * If received mac address is NULL, NULL is returned. | 280 | * If received mac address is NULL, NULL is returned. |
281 | */ | 281 | */ |
282 | struct mwifiex_sta_node * | 282 | struct mwifiex_sta_node * |
283 | mwifiex_add_sta_entry(struct mwifiex_private *priv, u8 *mac) | 283 | mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac) |
284 | { | 284 | { |
285 | struct mwifiex_sta_node *node; | 285 | struct mwifiex_sta_node *node; |
286 | unsigned long flags; | 286 | unsigned long flags; |
@@ -332,7 +332,7 @@ mwifiex_set_sta_ht_cap(struct mwifiex_private *priv, const u8 *ies, | |||
332 | } | 332 | } |
333 | 333 | ||
334 | /* This function will delete a station entry from station list */ | 334 | /* This function will delete a station entry from station list */ |
335 | void mwifiex_del_sta_entry(struct mwifiex_private *priv, u8 *mac) | 335 | void mwifiex_del_sta_entry(struct mwifiex_private *priv, const u8 *mac) |
336 | { | 336 | { |
337 | struct mwifiex_sta_node *node; | 337 | struct mwifiex_sta_node *node; |
338 | unsigned long flags; | 338 | unsigned long flags; |
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c index 0a7cc742aed7..d3671d009f6c 100644 --- a/drivers/net/wireless/mwifiex/wmm.c +++ b/drivers/net/wireless/mwifiex/wmm.c | |||
@@ -92,7 +92,7 @@ mwifiex_wmm_ac_debug_print(const struct ieee_types_wmm_ac_parameters *ac_param) | |||
92 | * The function also initializes the list with the provided RA. | 92 | * The function also initializes the list with the provided RA. |
93 | */ | 93 | */ |
94 | static struct mwifiex_ra_list_tbl * | 94 | static struct mwifiex_ra_list_tbl * |
95 | mwifiex_wmm_allocate_ralist_node(struct mwifiex_adapter *adapter, u8 *ra) | 95 | mwifiex_wmm_allocate_ralist_node(struct mwifiex_adapter *adapter, const u8 *ra) |
96 | { | 96 | { |
97 | struct mwifiex_ra_list_tbl *ra_list; | 97 | struct mwifiex_ra_list_tbl *ra_list; |
98 | 98 | ||
@@ -139,8 +139,7 @@ static u8 mwifiex_get_random_ba_threshold(void) | |||
139 | * This function allocates and adds a RA list for all TIDs | 139 | * This function allocates and adds a RA list for all TIDs |
140 | * with the given RA. | 140 | * with the given RA. |
141 | */ | 141 | */ |
142 | void | 142 | void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra) |
143 | mwifiex_ralist_add(struct mwifiex_private *priv, u8 *ra) | ||
144 | { | 143 | { |
145 | int i; | 144 | int i; |
146 | struct mwifiex_ra_list_tbl *ra_list; | 145 | struct mwifiex_ra_list_tbl *ra_list; |
@@ -164,6 +163,7 @@ mwifiex_ralist_add(struct mwifiex_private *priv, u8 *ra) | |||
164 | if (!mwifiex_queuing_ra_based(priv)) { | 163 | if (!mwifiex_queuing_ra_based(priv)) { |
165 | if (mwifiex_get_tdls_link_status(priv, ra) == | 164 | if (mwifiex_get_tdls_link_status(priv, ra) == |
166 | TDLS_SETUP_COMPLETE) { | 165 | TDLS_SETUP_COMPLETE) { |
166 | ra_list->tdls_link = true; | ||
167 | ra_list->is_11n_enabled = | 167 | ra_list->is_11n_enabled = |
168 | mwifiex_tdls_peer_11n_enabled(priv, ra); | 168 | mwifiex_tdls_peer_11n_enabled(priv, ra); |
169 | } else { | 169 | } else { |
@@ -426,15 +426,6 @@ mwifiex_wmm_init(struct mwifiex_adapter *adapter) | |||
426 | priv->tos_to_tid_inv[i]; | 426 | priv->tos_to_tid_inv[i]; |
427 | } | 427 | } |
428 | 428 | ||
429 | priv->aggr_prio_tbl[6].amsdu | ||
430 | = priv->aggr_prio_tbl[6].ampdu_ap | ||
431 | = priv->aggr_prio_tbl[6].ampdu_user | ||
432 | = BA_STREAM_NOT_ALLOWED; | ||
433 | |||
434 | priv->aggr_prio_tbl[7].amsdu = priv->aggr_prio_tbl[7].ampdu_ap | ||
435 | = priv->aggr_prio_tbl[7].ampdu_user | ||
436 | = BA_STREAM_NOT_ALLOWED; | ||
437 | |||
438 | mwifiex_set_ba_params(priv); | 429 | mwifiex_set_ba_params(priv); |
439 | mwifiex_reset_11n_rx_seq_num(priv); | 430 | mwifiex_reset_11n_rx_seq_num(priv); |
440 | 431 | ||
@@ -575,7 +566,7 @@ mwifiex_clean_txrx(struct mwifiex_private *priv) | |||
575 | */ | 566 | */ |
576 | static struct mwifiex_ra_list_tbl * | 567 | static struct mwifiex_ra_list_tbl * |
577 | mwifiex_wmm_get_ralist_node(struct mwifiex_private *priv, u8 tid, | 568 | mwifiex_wmm_get_ralist_node(struct mwifiex_private *priv, u8 tid, |
578 | u8 *ra_addr) | 569 | const u8 *ra_addr) |
579 | { | 570 | { |
580 | struct mwifiex_ra_list_tbl *ra_list; | 571 | struct mwifiex_ra_list_tbl *ra_list; |
581 | 572 | ||
@@ -596,7 +587,8 @@ mwifiex_wmm_get_ralist_node(struct mwifiex_private *priv, u8 tid, | |||
596 | * retrieved. | 587 | * retrieved. |
597 | */ | 588 | */ |
598 | struct mwifiex_ra_list_tbl * | 589 | struct mwifiex_ra_list_tbl * |
599 | mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid, u8 *ra_addr) | 590 | mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid, |
591 | const u8 *ra_addr) | ||
600 | { | 592 | { |
601 | struct mwifiex_ra_list_tbl *ra_list; | 593 | struct mwifiex_ra_list_tbl *ra_list; |
602 | 594 | ||
@@ -657,7 +649,7 @@ mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv, | |||
657 | if (ntohs(eth_hdr->h_proto) == ETH_P_TDLS) | 649 | if (ntohs(eth_hdr->h_proto) == ETH_P_TDLS) |
658 | dev_dbg(adapter->dev, | 650 | dev_dbg(adapter->dev, |
659 | "TDLS setup packet for %pM. Don't block\n", ra); | 651 | "TDLS setup packet for %pM. Don't block\n", ra); |
660 | else | 652 | else if (memcmp(priv->cfg_bssid, ra, ETH_ALEN)) |
661 | tdls_status = mwifiex_get_tdls_link_status(priv, ra); | 653 | tdls_status = mwifiex_get_tdls_link_status(priv, ra); |
662 | } | 654 | } |
663 | 655 | ||
diff --git a/drivers/net/wireless/mwifiex/wmm.h b/drivers/net/wireless/mwifiex/wmm.h index 83e42083ebff..eca56e371a57 100644 --- a/drivers/net/wireless/mwifiex/wmm.h +++ b/drivers/net/wireless/mwifiex/wmm.h | |||
@@ -99,7 +99,7 @@ mwifiex_wmm_is_ra_list_empty(struct list_head *ra_list_hhead) | |||
99 | 99 | ||
100 | void mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv, | 100 | void mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv, |
101 | struct sk_buff *skb); | 101 | struct sk_buff *skb); |
102 | void mwifiex_ralist_add(struct mwifiex_private *priv, u8 *ra); | 102 | void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra); |
103 | void mwifiex_rotate_priolists(struct mwifiex_private *priv, | 103 | void mwifiex_rotate_priolists(struct mwifiex_private *priv, |
104 | struct mwifiex_ra_list_tbl *ra, int tid); | 104 | struct mwifiex_ra_list_tbl *ra, int tid); |
105 | 105 | ||
@@ -123,7 +123,8 @@ void mwifiex_wmm_setup_ac_downgrade(struct mwifiex_private *priv); | |||
123 | int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv, | 123 | int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv, |
124 | const struct host_cmd_ds_command *resp); | 124 | const struct host_cmd_ds_command *resp); |
125 | struct mwifiex_ra_list_tbl * | 125 | struct mwifiex_ra_list_tbl * |
126 | mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid, u8 *ra_addr); | 126 | mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid, |
127 | const u8 *ra_addr); | ||
127 | u8 mwifiex_wmm_downgrade_tid(struct mwifiex_private *priv, u32 tid); | 128 | u8 mwifiex_wmm_downgrade_tid(struct mwifiex_private *priv, u32 tid); |
128 | 129 | ||
129 | #endif /* !_MWIFIEX_WMM_H_ */ | 130 | #endif /* !_MWIFIEX_WMM_H_ */ |
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c index 49300d04efdf..e27e32851f1e 100644 --- a/drivers/net/wireless/orinoco/hw.c +++ b/drivers/net/wireless/orinoco/hw.c | |||
@@ -988,8 +988,8 @@ int __orinoco_hw_setup_enc(struct orinoco_private *priv) | |||
988 | * tsc must be NULL or up to 8 bytes | 988 | * tsc must be NULL or up to 8 bytes |
989 | */ | 989 | */ |
990 | int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, | 990 | int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, |
991 | int set_tx, u8 *key, u8 *rsc, size_t rsc_len, | 991 | int set_tx, const u8 *key, const u8 *rsc, |
992 | u8 *tsc, size_t tsc_len) | 992 | size_t rsc_len, const u8 *tsc, size_t tsc_len) |
993 | { | 993 | { |
994 | struct { | 994 | struct { |
995 | __le16 idx; | 995 | __le16 idx; |
diff --git a/drivers/net/wireless/orinoco/hw.h b/drivers/net/wireless/orinoco/hw.h index 8f6831f4e328..466d1ede76f1 100644 --- a/drivers/net/wireless/orinoco/hw.h +++ b/drivers/net/wireless/orinoco/hw.h | |||
@@ -38,8 +38,8 @@ int __orinoco_hw_set_wap(struct orinoco_private *priv); | |||
38 | int __orinoco_hw_setup_wepkeys(struct orinoco_private *priv); | 38 | int __orinoco_hw_setup_wepkeys(struct orinoco_private *priv); |
39 | int __orinoco_hw_setup_enc(struct orinoco_private *priv); | 39 | int __orinoco_hw_setup_enc(struct orinoco_private *priv); |
40 | int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, | 40 | int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, |
41 | int set_tx, u8 *key, u8 *rsc, size_t rsc_len, | 41 | int set_tx, const u8 *key, const u8 *rsc, |
42 | u8 *tsc, size_t tsc_len); | 42 | size_t rsc_len, const u8 *tsc, size_t tsc_len); |
43 | int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx); | 43 | int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx); |
44 | int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, | 44 | int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, |
45 | struct net_device *dev, | 45 | struct net_device *dev, |
diff --git a/drivers/net/wireless/orinoco/orinoco_usb.c b/drivers/net/wireless/orinoco/orinoco_usb.c index 3ac71339d040..c90939ced0e4 100644 --- a/drivers/net/wireless/orinoco/orinoco_usb.c +++ b/drivers/net/wireless/orinoco/orinoco_usb.c | |||
@@ -1673,7 +1673,7 @@ static int ezusb_probe(struct usb_interface *interface, | |||
1673 | firmware.code = fw_entry->data; | 1673 | firmware.code = fw_entry->data; |
1674 | } | 1674 | } |
1675 | if (firmware.size && firmware.code) { | 1675 | if (firmware.size && firmware.code) { |
1676 | if (ezusb_firmware_download(upriv, &firmware)) | 1676 | if (ezusb_firmware_download(upriv, &firmware) < 0) |
1677 | goto error; | 1677 | goto error; |
1678 | } else { | 1678 | } else { |
1679 | err("No firmware to download"); | 1679 | err("No firmware to download"); |
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c index b7a867b50b94..6abdaf0aa052 100644 --- a/drivers/net/wireless/orinoco/wext.c +++ b/drivers/net/wireless/orinoco/wext.c | |||
@@ -52,9 +52,9 @@ static int orinoco_set_key(struct orinoco_private *priv, int index, | |||
52 | priv->keys[index].seq_len = seq_len; | 52 | priv->keys[index].seq_len = seq_len; |
53 | 53 | ||
54 | if (key_len) | 54 | if (key_len) |
55 | memcpy(priv->keys[index].key, key, key_len); | 55 | memcpy((void *)priv->keys[index].key, key, key_len); |
56 | if (seq_len) | 56 | if (seq_len) |
57 | memcpy(priv->keys[index].seq, seq, seq_len); | 57 | memcpy((void *)priv->keys[index].seq, seq, seq_len); |
58 | 58 | ||
59 | switch (alg) { | 59 | switch (alg) { |
60 | case ORINOCO_ALG_TKIP: | 60 | case ORINOCO_ALG_TKIP: |
diff --git a/drivers/net/wireless/p54/main.c b/drivers/net/wireless/p54/main.c index eede90b63f84..7be3a4839640 100644 --- a/drivers/net/wireless/p54/main.c +++ b/drivers/net/wireless/p54/main.c | |||
@@ -669,7 +669,8 @@ static unsigned int p54_flush_count(struct p54_common *priv) | |||
669 | return total; | 669 | return total; |
670 | } | 670 | } |
671 | 671 | ||
672 | static void p54_flush(struct ieee80211_hw *dev, u32 queues, bool drop) | 672 | static void p54_flush(struct ieee80211_hw *dev, struct ieee80211_vif *vif, |
673 | u32 queues, bool drop) | ||
673 | { | 674 | { |
674 | struct p54_common *priv = dev->priv; | 675 | struct p54_common *priv = dev->priv; |
675 | unsigned int total, i; | 676 | unsigned int total, i; |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index cbf0a589d32a..8330fa33e50b 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -343,7 +343,7 @@ static void ray_detach(struct pcmcia_device *link) | |||
343 | ray_release(link); | 343 | ray_release(link); |
344 | 344 | ||
345 | local = netdev_priv(dev); | 345 | local = netdev_priv(dev); |
346 | del_timer(&local->timer); | 346 | del_timer_sync(&local->timer); |
347 | 347 | ||
348 | if (link->priv) { | 348 | if (link->priv) { |
349 | unregister_netdev(dev); | 349 | unregister_netdev(dev); |
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 39d22a154341..d2a9a08210be 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -517,7 +517,7 @@ static int rndis_set_default_key(struct wiphy *wiphy, struct net_device *netdev, | |||
517 | u8 key_index, bool unicast, bool multicast); | 517 | u8 key_index, bool unicast, bool multicast); |
518 | 518 | ||
519 | static int rndis_get_station(struct wiphy *wiphy, struct net_device *dev, | 519 | static int rndis_get_station(struct wiphy *wiphy, struct net_device *dev, |
520 | u8 *mac, struct station_info *sinfo); | 520 | const u8 *mac, struct station_info *sinfo); |
521 | 521 | ||
522 | static int rndis_dump_station(struct wiphy *wiphy, struct net_device *dev, | 522 | static int rndis_dump_station(struct wiphy *wiphy, struct net_device *dev, |
523 | int idx, u8 *mac, struct station_info *sinfo); | 523 | int idx, u8 *mac, struct station_info *sinfo); |
@@ -2490,7 +2490,7 @@ static void rndis_fill_station_info(struct usbnet *usbdev, | |||
2490 | } | 2490 | } |
2491 | 2491 | ||
2492 | static int rndis_get_station(struct wiphy *wiphy, struct net_device *dev, | 2492 | static int rndis_get_station(struct wiphy *wiphy, struct net_device *dev, |
2493 | u8 *mac, struct station_info *sinfo) | 2493 | const u8 *mac, struct station_info *sinfo) |
2494 | { | 2494 | { |
2495 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); | 2495 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); |
2496 | struct usbnet *usbdev = priv->usbdev; | 2496 | struct usbnet *usbdev = priv->usbdev; |
diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c index 84164747ace0..54aaeb09debf 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c +++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c | |||
@@ -656,6 +656,7 @@ static int rsi_mac80211_ampdu_action(struct ieee80211_hw *hw, | |||
656 | case IEEE80211_AMPDU_TX_START: | 656 | case IEEE80211_AMPDU_TX_START: |
657 | common->vif_info[ii].seq_start = seq_no; | 657 | common->vif_info[ii].seq_start = seq_no; |
658 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 658 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
659 | status = 0; | ||
659 | break; | 660 | break; |
660 | 661 | ||
661 | case IEEE80211_AMPDU_TX_STOP_CONT: | 662 | case IEEE80211_AMPDU_TX_STOP_CONT: |
diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c index 1b28cda6ca88..2eefbf159bc0 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c +++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c | |||
@@ -1083,7 +1083,7 @@ void rsi_inform_bss_status(struct rsi_common *common, | |||
1083 | { | 1083 | { |
1084 | if (status) { | 1084 | if (status) { |
1085 | rsi_hal_send_sta_notify_frame(common, | 1085 | rsi_hal_send_sta_notify_frame(common, |
1086 | NL80211_IFTYPE_STATION, | 1086 | RSI_IFTYPE_STATION, |
1087 | STA_CONNECTED, | 1087 | STA_CONNECTED, |
1088 | bssid, | 1088 | bssid, |
1089 | qos_enable, | 1089 | qos_enable, |
@@ -1092,7 +1092,7 @@ void rsi_inform_bss_status(struct rsi_common *common, | |||
1092 | rsi_send_auto_rate_request(common); | 1092 | rsi_send_auto_rate_request(common); |
1093 | } else { | 1093 | } else { |
1094 | rsi_hal_send_sta_notify_frame(common, | 1094 | rsi_hal_send_sta_notify_frame(common, |
1095 | NL80211_IFTYPE_STATION, | 1095 | RSI_IFTYPE_STATION, |
1096 | STA_DISCONNECTED, | 1096 | STA_DISCONNECTED, |
1097 | bssid, | 1097 | bssid, |
1098 | qos_enable, | 1098 | qos_enable, |
diff --git a/drivers/net/wireless/rsi/rsi_common.h b/drivers/net/wireless/rsi/rsi_common.h index f2f70784d4ad..d3fbe33d2324 100644 --- a/drivers/net/wireless/rsi/rsi_common.h +++ b/drivers/net/wireless/rsi/rsi_common.h | |||
@@ -63,7 +63,7 @@ static inline int rsi_create_kthread(struct rsi_common *common, | |||
63 | u8 *name) | 63 | u8 *name) |
64 | { | 64 | { |
65 | init_completion(&thread->completion); | 65 | init_completion(&thread->completion); |
66 | thread->task = kthread_run(func_ptr, common, name); | 66 | thread->task = kthread_run(func_ptr, common, "%s", name); |
67 | if (IS_ERR(thread->task)) | 67 | if (IS_ERR(thread->task)) |
68 | return (int)PTR_ERR(thread->task); | 68 | return (int)PTR_ERR(thread->task); |
69 | 69 | ||
diff --git a/drivers/net/wireless/rsi/rsi_mgmt.h b/drivers/net/wireless/rsi/rsi_mgmt.h index ac67c4ad63c2..225215a3b8bb 100644 --- a/drivers/net/wireless/rsi/rsi_mgmt.h +++ b/drivers/net/wireless/rsi/rsi_mgmt.h | |||
@@ -73,6 +73,7 @@ | |||
73 | #define RX_BA_INDICATION 1 | 73 | #define RX_BA_INDICATION 1 |
74 | #define RSI_TBL_SZ 40 | 74 | #define RSI_TBL_SZ 40 |
75 | #define MAX_RETRIES 8 | 75 | #define MAX_RETRIES 8 |
76 | #define RSI_IFTYPE_STATION 0 | ||
76 | 77 | ||
77 | #define STD_RATE_MCS7 0x07 | 78 | #define STD_RATE_MCS7 0x07 |
78 | #define STD_RATE_MCS6 0x06 | 79 | #define STD_RATE_MCS6 0x06 |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 41d4a8167dc3..c17fcf272728 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -1005,10 +1005,9 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc) | |||
1005 | entry->skb->len + padding_len); | 1005 | entry->skb->len + padding_len); |
1006 | 1006 | ||
1007 | /* | 1007 | /* |
1008 | * Enable beaconing again. | 1008 | * Restore beaconing state. |
1009 | */ | 1009 | */ |
1010 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | 1010 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg); |
1011 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
1012 | 1011 | ||
1013 | /* | 1012 | /* |
1014 | * Clean up beacon skb. | 1013 | * Clean up beacon skb. |
@@ -1039,13 +1038,14 @@ static inline void rt2800_clear_beacon_register(struct rt2x00_dev *rt2x00dev, | |||
1039 | void rt2800_clear_beacon(struct queue_entry *entry) | 1038 | void rt2800_clear_beacon(struct queue_entry *entry) |
1040 | { | 1039 | { |
1041 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1040 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1042 | u32 reg; | 1041 | u32 orig_reg, reg; |
1043 | 1042 | ||
1044 | /* | 1043 | /* |
1045 | * Disable beaconing while we are reloading the beacon data, | 1044 | * Disable beaconing while we are reloading the beacon data, |
1046 | * otherwise we might be sending out invalid data. | 1045 | * otherwise we might be sending out invalid data. |
1047 | */ | 1046 | */ |
1048 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); | 1047 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, &orig_reg); |
1048 | reg = orig_reg; | ||
1049 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); | 1049 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); |
1050 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | 1050 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); |
1051 | 1051 | ||
@@ -1055,10 +1055,9 @@ void rt2800_clear_beacon(struct queue_entry *entry) | |||
1055 | rt2800_clear_beacon_register(rt2x00dev, entry->entry_idx); | 1055 | rt2800_clear_beacon_register(rt2x00dev, entry->entry_idx); |
1056 | 1056 | ||
1057 | /* | 1057 | /* |
1058 | * Enabled beaconing again. | 1058 | * Restore beaconing state. |
1059 | */ | 1059 | */ |
1060 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | 1060 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg); |
1061 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
1062 | } | 1061 | } |
1063 | EXPORT_SYMBOL_GPL(rt2800_clear_beacon); | 1062 | EXPORT_SYMBOL_GPL(rt2800_clear_beacon); |
1064 | 1063 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index e3b885d8f7db..010b76505243 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -1448,7 +1448,8 @@ int rt2x00mac_conf_tx(struct ieee80211_hw *hw, | |||
1448 | struct ieee80211_vif *vif, u16 queue, | 1448 | struct ieee80211_vif *vif, u16 queue, |
1449 | const struct ieee80211_tx_queue_params *params); | 1449 | const struct ieee80211_tx_queue_params *params); |
1450 | void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw); | 1450 | void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw); |
1451 | void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop); | 1451 | void rt2x00mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1452 | u32 queues, bool drop); | ||
1452 | int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); | 1453 | int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); |
1453 | int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); | 1454 | int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); |
1454 | void rt2x00mac_get_ringparam(struct ieee80211_hw *hw, | 1455 | void rt2x00mac_get_ringparam(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index a87ee9b6585a..212ac4842c16 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -749,7 +749,8 @@ void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw) | |||
749 | } | 749 | } |
750 | EXPORT_SYMBOL_GPL(rt2x00mac_rfkill_poll); | 750 | EXPORT_SYMBOL_GPL(rt2x00mac_rfkill_poll); |
751 | 751 | ||
752 | void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 752 | void rt2x00mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
753 | u32 queues, bool drop) | ||
753 | { | 754 | { |
754 | struct rt2x00_dev *rt2x00dev = hw->priv; | 755 | struct rt2x00_dev *rt2x00dev = hw->priv; |
755 | struct data_queue *queue; | 756 | struct data_queue *queue; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 10572452cc21..86c43d112a4b 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -68,6 +68,12 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev, | |||
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | /* If the port is powered down, we get a -EPROTO error, and this | ||
72 | * leads to a endless loop. So just say that the device is gone. | ||
73 | */ | ||
74 | if (status == -EPROTO) | ||
75 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | ||
76 | |||
71 | rt2x00_err(rt2x00dev, | 77 | rt2x00_err(rt2x00dev, |
72 | "Vendor Request 0x%02x failed for offset 0x%04x with error %d\n", | 78 | "Vendor Request 0x%02x failed for offset 0x%04x with error %d\n", |
73 | request, offset, status); | 79 | request, offset, status); |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 24402984ee57..9048a9cbe52c 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -2031,13 +2031,14 @@ static void rt61pci_write_beacon(struct queue_entry *entry, | |||
2031 | static void rt61pci_clear_beacon(struct queue_entry *entry) | 2031 | static void rt61pci_clear_beacon(struct queue_entry *entry) |
2032 | { | 2032 | { |
2033 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 2033 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
2034 | u32 reg; | 2034 | u32 orig_reg, reg; |
2035 | 2035 | ||
2036 | /* | 2036 | /* |
2037 | * Disable beaconing while we are reloading the beacon data, | 2037 | * Disable beaconing while we are reloading the beacon data, |
2038 | * otherwise we might be sending out invalid data. | 2038 | * otherwise we might be sending out invalid data. |
2039 | */ | 2039 | */ |
2040 | rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®); | 2040 | rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, &orig_reg); |
2041 | reg = orig_reg; | ||
2041 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); | 2042 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); |
2042 | rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg); | 2043 | rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg); |
2043 | 2044 | ||
@@ -2048,10 +2049,9 @@ static void rt61pci_clear_beacon(struct queue_entry *entry) | |||
2048 | HW_BEACON_OFFSET(entry->entry_idx), 0); | 2049 | HW_BEACON_OFFSET(entry->entry_idx), 0); |
2049 | 2050 | ||
2050 | /* | 2051 | /* |
2051 | * Enable beaconing again. | 2052 | * Restore global beaconing state. |
2052 | */ | 2053 | */ |
2053 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); | 2054 | rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, orig_reg); |
2054 | rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
2055 | } | 2055 | } |
2056 | 2056 | ||
2057 | /* | 2057 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index a140170b1eb3..95724ff9c726 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1597,13 +1597,14 @@ static void rt73usb_clear_beacon(struct queue_entry *entry) | |||
1597 | { | 1597 | { |
1598 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1598 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1599 | unsigned int beacon_base; | 1599 | unsigned int beacon_base; |
1600 | u32 reg; | 1600 | u32 orig_reg, reg; |
1601 | 1601 | ||
1602 | /* | 1602 | /* |
1603 | * Disable beaconing while we are reloading the beacon data, | 1603 | * Disable beaconing while we are reloading the beacon data, |
1604 | * otherwise we might be sending out invalid data. | 1604 | * otherwise we might be sending out invalid data. |
1605 | */ | 1605 | */ |
1606 | rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, ®); | 1606 | rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, &orig_reg); |
1607 | reg = orig_reg; | ||
1607 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); | 1608 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); |
1608 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); | 1609 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); |
1609 | 1610 | ||
@@ -1614,10 +1615,9 @@ static void rt73usb_clear_beacon(struct queue_entry *entry) | |||
1614 | rt2x00usb_register_write(rt2x00dev, beacon_base, 0); | 1615 | rt2x00usb_register_write(rt2x00dev, beacon_base, 0); |
1615 | 1616 | ||
1616 | /* | 1617 | /* |
1617 | * Enable beaconing again. | 1618 | * Restore beaconing state. |
1618 | */ | 1619 | */ |
1619 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); | 1620 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, orig_reg); |
1620 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1621 | } | 1621 | } |
1622 | 1622 | ||
1623 | static int rt73usb_get_tx_data_len(struct queue_entry *entry) | 1623 | static int rt73usb_get_tx_data_len(struct queue_entry *entry) |
diff --git a/drivers/net/wireless/rtl818x/rtl8180/Makefile b/drivers/net/wireless/rtl818x/rtl8180/Makefile index 08b056db4a3b..21005bd8b43c 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/Makefile +++ b/drivers/net/wireless/rtl818x/rtl8180/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | rtl8180-objs := dev.o rtl8225.o sa2400.o max2820.o grf5101.o rtl8225se.o | 1 | rtl818x_pci-objs := dev.o rtl8225.o sa2400.o max2820.o grf5101.o rtl8225se.o |
2 | 2 | ||
3 | obj-$(CONFIG_RTL8180) += rtl8180.o | 3 | obj-$(CONFIG_RTL8180) += rtl818x_pci.o |
4 | 4 | ||
5 | ccflags-y += -Idrivers/net/wireless/rtl818x | 5 | ccflags-y += -Idrivers/net/wireless/rtl818x |
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c index 98d8256f0377..2c1c02bafa10 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c | |||
@@ -284,6 +284,8 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
284 | rx_status.band = dev->conf.chandef.chan->band; | 284 | rx_status.band = dev->conf.chandef.chan->band; |
285 | rx_status.mactime = tsft; | 285 | rx_status.mactime = tsft; |
286 | rx_status.flag |= RX_FLAG_MACTIME_START; | 286 | rx_status.flag |= RX_FLAG_MACTIME_START; |
287 | if (flags & RTL818X_RX_DESC_FLAG_SPLCP) | ||
288 | rx_status.flag |= RX_FLAG_SHORTPRE; | ||
287 | if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) | 289 | if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) |
288 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; | 290 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; |
289 | 291 | ||
@@ -461,18 +463,23 @@ static void rtl8180_tx(struct ieee80211_hw *dev, | |||
461 | RTL818X_TX_DESC_FLAG_NO_ENC; | 463 | RTL818X_TX_DESC_FLAG_NO_ENC; |
462 | 464 | ||
463 | rc_flags = info->control.rates[0].flags; | 465 | rc_flags = info->control.rates[0].flags; |
466 | |||
467 | /* HW will perform RTS-CTS when only RTS flags is set. | ||
468 | * HW will perform CTS-to-self when both RTS and CTS flags are set. | ||
469 | * RTS rate and RTS duration will be used also for CTS-to-self. | ||
470 | */ | ||
464 | if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) { | 471 | if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) { |
465 | tx_flags |= RTL818X_TX_DESC_FLAG_RTS; | 472 | tx_flags |= RTL818X_TX_DESC_FLAG_RTS; |
466 | tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; | 473 | tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; |
474 | rts_duration = ieee80211_rts_duration(dev, priv->vif, | ||
475 | skb->len, info); | ||
467 | } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { | 476 | } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { |
468 | tx_flags |= RTL818X_TX_DESC_FLAG_CTS; | 477 | tx_flags |= RTL818X_TX_DESC_FLAG_RTS | RTL818X_TX_DESC_FLAG_CTS; |
469 | tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; | 478 | tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; |
479 | rts_duration = ieee80211_ctstoself_duration(dev, priv->vif, | ||
480 | skb->len, info); | ||
470 | } | 481 | } |
471 | 482 | ||
472 | if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) | ||
473 | rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len, | ||
474 | info); | ||
475 | |||
476 | if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8180) { | 483 | if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8180) { |
477 | unsigned int remainder; | 484 | unsigned int remainder; |
478 | 485 | ||
@@ -683,9 +690,8 @@ static void rtl8180_int_enable(struct ieee80211_hw *dev) | |||
683 | struct rtl8180_priv *priv = dev->priv; | 690 | struct rtl8180_priv *priv = dev->priv; |
684 | 691 | ||
685 | if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8187SE) { | 692 | if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8187SE) { |
686 | rtl818x_iowrite32(priv, &priv->map->IMR, IMR_TMGDOK | | 693 | rtl818x_iowrite32(priv, &priv->map->IMR, |
687 | IMR_TBDER | IMR_THPDER | | 694 | IMR_TBDER | IMR_TBDOK | |
688 | IMR_THPDER | IMR_THPDOK | | ||
689 | IMR_TVODER | IMR_TVODOK | | 695 | IMR_TVODER | IMR_TVODOK | |
690 | IMR_TVIDER | IMR_TVIDOK | | 696 | IMR_TVIDER | IMR_TVIDOK | |
691 | IMR_TBEDER | IMR_TBEDOK | | 697 | IMR_TBEDER | IMR_TBEDOK | |
@@ -911,7 +917,10 @@ static int rtl8180_init_hw(struct ieee80211_hw *dev) | |||
911 | reg32 &= 0x00ffff00; | 917 | reg32 &= 0x00ffff00; |
912 | reg32 |= 0xb8000054; | 918 | reg32 |= 0xb8000054; |
913 | rtl818x_iowrite32(priv, &priv->map->RF_PARA, reg32); | 919 | rtl818x_iowrite32(priv, &priv->map->RF_PARA, reg32); |
914 | } | 920 | } else |
921 | /* stop unused queus (no dma alloc) */ | ||
922 | rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, | ||
923 | (1<<1) | (1<<2)); | ||
915 | 924 | ||
916 | priv->rf->init(dev); | 925 | priv->rf->init(dev); |
917 | 926 | ||
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c index 0ca17cda48fa..629ad8cfa17b 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c | |||
@@ -253,14 +253,21 @@ static void rtl8187_tx(struct ieee80211_hw *dev, | |||
253 | flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24; | 253 | flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24; |
254 | if (ieee80211_has_morefrags(tx_hdr->frame_control)) | 254 | if (ieee80211_has_morefrags(tx_hdr->frame_control)) |
255 | flags |= RTL818X_TX_DESC_FLAG_MOREFRAG; | 255 | flags |= RTL818X_TX_DESC_FLAG_MOREFRAG; |
256 | |||
257 | /* HW will perform RTS-CTS when only RTS flags is set. | ||
258 | * HW will perform CTS-to-self when both RTS and CTS flags are set. | ||
259 | * RTS rate and RTS duration will be used also for CTS-to-self. | ||
260 | */ | ||
256 | if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) { | 261 | if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) { |
257 | flags |= RTL818X_TX_DESC_FLAG_RTS; | 262 | flags |= RTL818X_TX_DESC_FLAG_RTS; |
258 | flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; | 263 | flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; |
259 | rts_dur = ieee80211_rts_duration(dev, priv->vif, | 264 | rts_dur = ieee80211_rts_duration(dev, priv->vif, |
260 | skb->len, info); | 265 | skb->len, info); |
261 | } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { | 266 | } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { |
262 | flags |= RTL818X_TX_DESC_FLAG_CTS; | 267 | flags |= RTL818X_TX_DESC_FLAG_RTS | RTL818X_TX_DESC_FLAG_CTS; |
263 | flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; | 268 | flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; |
269 | rts_dur = ieee80211_ctstoself_duration(dev, priv->vif, | ||
270 | skb->len, info); | ||
264 | } | 271 | } |
265 | 272 | ||
266 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | 273 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { |
@@ -381,6 +388,8 @@ static void rtl8187_rx_cb(struct urb *urb) | |||
381 | rx_status.freq = dev->conf.chandef.chan->center_freq; | 388 | rx_status.freq = dev->conf.chandef.chan->center_freq; |
382 | rx_status.band = dev->conf.chandef.chan->band; | 389 | rx_status.band = dev->conf.chandef.chan->band; |
383 | rx_status.flag |= RX_FLAG_MACTIME_START; | 390 | rx_status.flag |= RX_FLAG_MACTIME_START; |
391 | if (flags & RTL818X_RX_DESC_FLAG_SPLCP) | ||
392 | rx_status.flag |= RX_FLAG_SHORTPRE; | ||
384 | if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) | 393 | if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) |
385 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; | 394 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; |
386 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); | 395 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); |
diff --git a/drivers/net/wireless/rtl818x/rtl818x.h b/drivers/net/wireless/rtl818x/rtl818x.h index 45ea4e1c4abe..7abef95d278b 100644 --- a/drivers/net/wireless/rtl818x/rtl818x.h +++ b/drivers/net/wireless/rtl818x/rtl818x.h | |||
@@ -334,9 +334,9 @@ struct rtl818x_csr { | |||
334 | * I don't like to introduce a ton of "reserved".. | 334 | * I don't like to introduce a ton of "reserved".. |
335 | * They are for RTL8187SE | 335 | * They are for RTL8187SE |
336 | */ | 336 | */ |
337 | #define REG_ADDR1(addr) ((u8 __iomem *)priv->map + addr) | 337 | #define REG_ADDR1(addr) ((u8 __iomem *)priv->map + (addr)) |
338 | #define REG_ADDR2(addr) ((__le16 __iomem *)priv->map + (addr >> 1)) | 338 | #define REG_ADDR2(addr) ((__le16 __iomem *)priv->map + ((addr) >> 1)) |
339 | #define REG_ADDR4(addr) ((__le32 __iomem *)priv->map + (addr >> 2)) | 339 | #define REG_ADDR4(addr) ((__le32 __iomem *)priv->map + ((addr) >> 2)) |
340 | 340 | ||
341 | #define FEMR_SE REG_ADDR2(0x1D4) | 341 | #define FEMR_SE REG_ADDR2(0x1D4) |
342 | #define ARFR REG_ADDR2(0x1E0) | 342 | #define ARFR REG_ADDR2(0x1E0) |
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c index 4ec424f26672..b1ed6d0796f6 100644 --- a/drivers/net/wireless/rtlwifi/core.c +++ b/drivers/net/wireless/rtlwifi/core.c | |||
@@ -1387,7 +1387,8 @@ static void rtl_op_rfkill_poll(struct ieee80211_hw *hw) | |||
1387 | * before switch channel or power save, or tx buffer packet | 1387 | * before switch channel or power save, or tx buffer packet |
1388 | * maybe send after offchannel or rf sleep, this may cause | 1388 | * maybe send after offchannel or rf sleep, this may cause |
1389 | * dis-association by AP */ | 1389 | * dis-association by AP */ |
1390 | static void rtl_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 1390 | static void rtl_op_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1391 | u32 queues, bool drop) | ||
1391 | { | 1392 | { |
1392 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1393 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1393 | 1394 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c index 94cd9df98381..b14cf5a10f44 100644 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | |||
@@ -2515,23 +2515,3 @@ void rtl88ee_suspend(struct ieee80211_hw *hw) | |||
2515 | void rtl88ee_resume(struct ieee80211_hw *hw) | 2515 | void rtl88ee_resume(struct ieee80211_hw *hw) |
2516 | { | 2516 | { |
2517 | } | 2517 | } |
2518 | |||
2519 | /* Turn on AAP (RCR:bit 0) for promicuous mode. */ | ||
2520 | void rtl88ee_allow_all_destaddr(struct ieee80211_hw *hw, | ||
2521 | bool allow_all_da, bool write_into_reg) | ||
2522 | { | ||
2523 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
2524 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | ||
2525 | |||
2526 | if (allow_all_da) /* Set BIT0 */ | ||
2527 | rtlpci->receive_config |= RCR_AAP; | ||
2528 | else /* Clear BIT0 */ | ||
2529 | rtlpci->receive_config &= ~RCR_AAP; | ||
2530 | |||
2531 | if (write_into_reg) | ||
2532 | rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); | ||
2533 | |||
2534 | RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, | ||
2535 | "receive_config = 0x%08X, write_into_reg =%d\n", | ||
2536 | rtlpci->receive_config, write_into_reg); | ||
2537 | } | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.h b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.h index b4460a41bd01..1850fde881b5 100644 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.h +++ b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.h | |||
@@ -61,8 +61,6 @@ void rtl8188ee_bt_reg_init(struct ieee80211_hw *hw); | |||
61 | void rtl8188ee_bt_hw_init(struct ieee80211_hw *hw); | 61 | void rtl8188ee_bt_hw_init(struct ieee80211_hw *hw); |
62 | void rtl88ee_suspend(struct ieee80211_hw *hw); | 62 | void rtl88ee_suspend(struct ieee80211_hw *hw); |
63 | void rtl88ee_resume(struct ieee80211_hw *hw); | 63 | void rtl88ee_resume(struct ieee80211_hw *hw); |
64 | void rtl88ee_allow_all_destaddr(struct ieee80211_hw *hw, | ||
65 | bool allow_all_da, bool write_into_reg); | ||
66 | void rtl88ee_fw_clk_off_timer_callback(unsigned long data); | 64 | void rtl88ee_fw_clk_off_timer_callback(unsigned long data); |
67 | 65 | ||
68 | #endif | 66 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c b/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c index 1b4101bf9974..842d69349a37 100644 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c | |||
@@ -93,7 +93,7 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw) | |||
93 | u8 tid; | 93 | u8 tid; |
94 | 94 | ||
95 | rtl8188ee_bt_reg_init(hw); | 95 | rtl8188ee_bt_reg_init(hw); |
96 | rtlpci->msi_support = true; | 96 | rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; |
97 | 97 | ||
98 | rtlpriv->dm.dm_initialgain_enable = 1; | 98 | rtlpriv->dm.dm_initialgain_enable = 1; |
99 | rtlpriv->dm.dm_flag = 0; | 99 | rtlpriv->dm.dm_flag = 0; |
@@ -255,7 +255,6 @@ static struct rtl_hal_ops rtl8188ee_hal_ops = { | |||
255 | .enable_hw_sec = rtl88ee_enable_hw_security_config, | 255 | .enable_hw_sec = rtl88ee_enable_hw_security_config, |
256 | .set_key = rtl88ee_set_key, | 256 | .set_key = rtl88ee_set_key, |
257 | .init_sw_leds = rtl88ee_init_sw_leds, | 257 | .init_sw_leds = rtl88ee_init_sw_leds, |
258 | .allow_all_destaddr = rtl88ee_allow_all_destaddr, | ||
259 | .get_bbreg = rtl88e_phy_query_bb_reg, | 258 | .get_bbreg = rtl88e_phy_query_bb_reg, |
260 | .set_bbreg = rtl88e_phy_set_bb_reg, | 259 | .set_bbreg = rtl88e_phy_set_bb_reg, |
261 | .get_rfreg = rtl88e_phy_query_rf_reg, | 260 | .get_rfreg = rtl88e_phy_query_rf_reg, |
@@ -267,6 +266,7 @@ static struct rtl_mod_params rtl88ee_mod_params = { | |||
267 | .inactiveps = true, | 266 | .inactiveps = true, |
268 | .swctrl_lps = false, | 267 | .swctrl_lps = false, |
269 | .fwctrl_lps = true, | 268 | .fwctrl_lps = true, |
269 | .msi_support = false, | ||
270 | .debug = DBG_EMERG, | 270 | .debug = DBG_EMERG, |
271 | }; | 271 | }; |
272 | 272 | ||
@@ -383,10 +383,12 @@ module_param_named(debug, rtl88ee_mod_params.debug, int, 0444); | |||
383 | module_param_named(ips, rtl88ee_mod_params.inactiveps, bool, 0444); | 383 | module_param_named(ips, rtl88ee_mod_params.inactiveps, bool, 0444); |
384 | module_param_named(swlps, rtl88ee_mod_params.swctrl_lps, bool, 0444); | 384 | module_param_named(swlps, rtl88ee_mod_params.swctrl_lps, bool, 0444); |
385 | module_param_named(fwlps, rtl88ee_mod_params.fwctrl_lps, bool, 0444); | 385 | module_param_named(fwlps, rtl88ee_mod_params.fwctrl_lps, bool, 0444); |
386 | module_param_named(msi, rtl88ee_mod_params.msi_support, bool, 0444); | ||
386 | MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); | 387 | MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); |
387 | MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); | 388 | MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); |
388 | MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); | 389 | MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); |
389 | MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); | 390 | MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); |
391 | MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 0)\n"); | ||
390 | MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); | 392 | MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); |
391 | 393 | ||
392 | static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); | 394 | static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c index 55adf043aef7..cdecb0fd4d8e 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | |||
@@ -2423,24 +2423,3 @@ void rtl92ce_suspend(struct ieee80211_hw *hw) | |||
2423 | void rtl92ce_resume(struct ieee80211_hw *hw) | 2423 | void rtl92ce_resume(struct ieee80211_hw *hw) |
2424 | { | 2424 | { |
2425 | } | 2425 | } |
2426 | |||
2427 | /* Turn on AAP (RCR:bit 0) for promicuous mode. */ | ||
2428 | void rtl92ce_allow_all_destaddr(struct ieee80211_hw *hw, | ||
2429 | bool allow_all_da, bool write_into_reg) | ||
2430 | { | ||
2431 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
2432 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | ||
2433 | |||
2434 | if (allow_all_da) {/* Set BIT0 */ | ||
2435 | rtlpci->receive_config |= RCR_AAP; | ||
2436 | } else {/* Clear BIT0 */ | ||
2437 | rtlpci->receive_config &= ~RCR_AAP; | ||
2438 | } | ||
2439 | |||
2440 | if (write_into_reg) | ||
2441 | rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); | ||
2442 | |||
2443 | RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, | ||
2444 | "receive_config=0x%08X, write_into_reg=%d\n", | ||
2445 | rtlpci->receive_config, write_into_reg); | ||
2446 | } | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h index 2d063b0c7760..5533070f266c 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h | |||
@@ -76,7 +76,5 @@ void rtl8192ce_bt_reg_init(struct ieee80211_hw *hw); | |||
76 | void rtl8192ce_bt_hw_init(struct ieee80211_hw *hw); | 76 | void rtl8192ce_bt_hw_init(struct ieee80211_hw *hw); |
77 | void rtl92ce_suspend(struct ieee80211_hw *hw); | 77 | void rtl92ce_suspend(struct ieee80211_hw *hw); |
78 | void rtl92ce_resume(struct ieee80211_hw *hw); | 78 | void rtl92ce_resume(struct ieee80211_hw *hw); |
79 | void rtl92ce_allow_all_destaddr(struct ieee80211_hw *hw, | ||
80 | bool allow_all_da, bool write_into_reg); | ||
81 | 79 | ||
82 | #endif | 80 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c index b790320d2030..12f21f4073e8 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c | |||
@@ -229,7 +229,6 @@ static struct rtl_hal_ops rtl8192ce_hal_ops = { | |||
229 | .enable_hw_sec = rtl92ce_enable_hw_security_config, | 229 | .enable_hw_sec = rtl92ce_enable_hw_security_config, |
230 | .set_key = rtl92ce_set_key, | 230 | .set_key = rtl92ce_set_key, |
231 | .init_sw_leds = rtl92ce_init_sw_leds, | 231 | .init_sw_leds = rtl92ce_init_sw_leds, |
232 | .allow_all_destaddr = rtl92ce_allow_all_destaddr, | ||
233 | .get_bbreg = rtl92c_phy_query_bb_reg, | 232 | .get_bbreg = rtl92c_phy_query_bb_reg, |
234 | .set_bbreg = rtl92c_phy_set_bb_reg, | 233 | .set_bbreg = rtl92c_phy_set_bb_reg, |
235 | .set_rfreg = rtl92ce_phy_set_rf_reg, | 234 | .set_rfreg = rtl92ce_phy_set_rf_reg, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index 07cb06da6729..a903c2671b4d 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | |||
@@ -511,7 +511,7 @@ static int _rtl92cu_init_power_on(struct ieee80211_hw *hw) | |||
511 | pr_info("MAC auto ON okay!\n"); | 511 | pr_info("MAC auto ON okay!\n"); |
512 | break; | 512 | break; |
513 | } | 513 | } |
514 | if (pollingCount++ > 100) { | 514 | if (pollingCount++ > 1000) { |
515 | RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, | 515 | RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, |
516 | "Failed to polling REG_APS_FSMCO[APFM_ONMAC] done!\n"); | 516 | "Failed to polling REG_APS_FSMCO[APFM_ONMAC] done!\n"); |
517 | return -ENODEV; | 517 | return -ENODEV; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c index c61311084d7e..361435f8608a 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | |||
@@ -395,9 +395,6 @@ static struct usb_driver rtl8192cu_driver = { | |||
395 | /* .resume = rtl_usb_resume, */ | 395 | /* .resume = rtl_usb_resume, */ |
396 | /* .reset_resume = rtl8192c_resume, */ | 396 | /* .reset_resume = rtl8192c_resume, */ |
397 | #endif /* CONFIG_PM */ | 397 | #endif /* CONFIG_PM */ |
398 | #ifdef CONFIG_AUTOSUSPEND | ||
399 | .supports_autosuspend = 1, | ||
400 | #endif | ||
401 | .disable_hub_initiated_lpm = 1, | 398 | .disable_hub_initiated_lpm = 1, |
402 | }; | 399 | }; |
403 | 400 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c index 9098558d916d..1c7101bcd790 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c | |||
@@ -2544,23 +2544,3 @@ void rtl92se_resume(struct ieee80211_hw *hw) | |||
2544 | pci_write_config_dword(rtlpci->pdev, 0x40, | 2544 | pci_write_config_dword(rtlpci->pdev, 0x40, |
2545 | val & 0xffff00ff); | 2545 | val & 0xffff00ff); |
2546 | } | 2546 | } |
2547 | |||
2548 | /* Turn on AAP (RCR:bit 0) for promicuous mode. */ | ||
2549 | void rtl92se_allow_all_destaddr(struct ieee80211_hw *hw, | ||
2550 | bool allow_all_da, bool write_into_reg) | ||
2551 | { | ||
2552 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
2553 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | ||
2554 | |||
2555 | if (allow_all_da) /* Set BIT0 */ | ||
2556 | rtlpci->receive_config |= RCR_AAP; | ||
2557 | else /* Clear BIT0 */ | ||
2558 | rtlpci->receive_config &= ~RCR_AAP; | ||
2559 | |||
2560 | if (write_into_reg) | ||
2561 | rtl_write_dword(rtlpriv, RCR, rtlpci->receive_config); | ||
2562 | |||
2563 | RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, | ||
2564 | "receive_config=0x%08X, write_into_reg=%d\n", | ||
2565 | rtlpci->receive_config, write_into_reg); | ||
2566 | } | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.h b/drivers/net/wireless/rtlwifi/rtl8192se/hw.h index da48aa8cbe6f..4cacee10f31e 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.h +++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.h | |||
@@ -74,7 +74,5 @@ void rtl92se_set_key(struct ieee80211_hw *hw, | |||
74 | u8 enc_algo, bool is_wepkey, bool clear_all); | 74 | u8 enc_algo, bool is_wepkey, bool clear_all); |
75 | void rtl92se_suspend(struct ieee80211_hw *hw); | 75 | void rtl92se_suspend(struct ieee80211_hw *hw); |
76 | void rtl92se_resume(struct ieee80211_hw *hw); | 76 | void rtl92se_resume(struct ieee80211_hw *hw); |
77 | void rtl92se_allow_all_destaddr(struct ieee80211_hw *hw, | ||
78 | bool allow_all_da, bool write_into_reg); | ||
79 | 77 | ||
80 | #endif | 78 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c index 2e8e6f8d2d51..1bff2a0f7600 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c | |||
@@ -290,7 +290,6 @@ static struct rtl_hal_ops rtl8192se_hal_ops = { | |||
290 | .enable_hw_sec = rtl92se_enable_hw_security_config, | 290 | .enable_hw_sec = rtl92se_enable_hw_security_config, |
291 | .set_key = rtl92se_set_key, | 291 | .set_key = rtl92se_set_key, |
292 | .init_sw_leds = rtl92se_init_sw_leds, | 292 | .init_sw_leds = rtl92se_init_sw_leds, |
293 | .allow_all_destaddr = rtl92se_allow_all_destaddr, | ||
294 | .get_bbreg = rtl92s_phy_query_bb_reg, | 293 | .get_bbreg = rtl92s_phy_query_bb_reg, |
295 | .set_bbreg = rtl92s_phy_set_bb_reg, | 294 | .set_bbreg = rtl92s_phy_set_bb_reg, |
296 | .get_rfreg = rtl92s_phy_query_rf_reg, | 295 | .get_rfreg = rtl92s_phy_query_rf_reg, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/hal_bt_coexist.c b/drivers/net/wireless/rtlwifi/rtl8723ae/hal_bt_coexist.c index 48fee1be78c2..5b4a714f3c8c 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/hal_bt_coexist.c +++ b/drivers/net/wireless/rtlwifi/rtl8723ae/hal_bt_coexist.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include "dm.h" | 32 | #include "dm.h" |
33 | #include "fw.h" | 33 | #include "fw.h" |
34 | #include "../rtl8723com/fw_common.h" | 34 | #include "../rtl8723com/fw_common.h" |
35 | #include "../rtl8723com/fw_common.h" | ||
36 | #include "phy.h" | 35 | #include "phy.h" |
37 | #include "reg.h" | 36 | #include "reg.h" |
38 | #include "hal_btc.h" | 37 | #include "hal_btc.h" |
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c index 65c9e80e1f78..87f69166a7ed 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c | |||
@@ -2383,24 +2383,3 @@ void rtl8723ae_suspend(struct ieee80211_hw *hw) | |||
2383 | void rtl8723ae_resume(struct ieee80211_hw *hw) | 2383 | void rtl8723ae_resume(struct ieee80211_hw *hw) |
2384 | { | 2384 | { |
2385 | } | 2385 | } |
2386 | |||
2387 | /* Turn on AAP (RCR:bit 0) for promicuous mode. */ | ||
2388 | void rtl8723ae_allow_all_destaddr(struct ieee80211_hw *hw, | ||
2389 | bool allow_all_da, bool write_into_reg) | ||
2390 | { | ||
2391 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
2392 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | ||
2393 | |||
2394 | if (allow_all_da) /* Set BIT0 */ | ||
2395 | rtlpci->receive_config |= RCR_AAP; | ||
2396 | else /* Clear BIT0 */ | ||
2397 | rtlpci->receive_config &= ~RCR_AAP; | ||
2398 | |||
2399 | if (write_into_reg) | ||
2400 | rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); | ||
2401 | |||
2402 | |||
2403 | RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, | ||
2404 | "receive_config=0x%08X, write_into_reg=%d\n", | ||
2405 | rtlpci->receive_config, write_into_reg); | ||
2406 | } | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.h b/drivers/net/wireless/rtlwifi/rtl8723ae/hw.h index 6fa24f79b1d7..d3bc39fb27a5 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.h +++ b/drivers/net/wireless/rtlwifi/rtl8723ae/hw.h | |||
@@ -67,7 +67,5 @@ void rtl8723ae_bt_reg_init(struct ieee80211_hw *hw); | |||
67 | void rtl8723ae_bt_hw_init(struct ieee80211_hw *hw); | 67 | void rtl8723ae_bt_hw_init(struct ieee80211_hw *hw); |
68 | void rtl8723ae_suspend(struct ieee80211_hw *hw); | 68 | void rtl8723ae_suspend(struct ieee80211_hw *hw); |
69 | void rtl8723ae_resume(struct ieee80211_hw *hw); | 69 | void rtl8723ae_resume(struct ieee80211_hw *hw); |
70 | void rtl8723ae_allow_all_destaddr(struct ieee80211_hw *hw, | ||
71 | bool allow_all_da, bool write_into_reg); | ||
72 | 70 | ||
73 | #endif | 71 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c index 1087a3bd07fa..73cba1eec8cf 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c | |||
@@ -238,7 +238,6 @@ static struct rtl_hal_ops rtl8723ae_hal_ops = { | |||
238 | .enable_hw_sec = rtl8723ae_enable_hw_security_config, | 238 | .enable_hw_sec = rtl8723ae_enable_hw_security_config, |
239 | .set_key = rtl8723ae_set_key, | 239 | .set_key = rtl8723ae_set_key, |
240 | .init_sw_leds = rtl8723ae_init_sw_leds, | 240 | .init_sw_leds = rtl8723ae_init_sw_leds, |
241 | .allow_all_destaddr = rtl8723ae_allow_all_destaddr, | ||
242 | .get_bbreg = rtl8723_phy_query_bb_reg, | 241 | .get_bbreg = rtl8723_phy_query_bb_reg, |
243 | .set_bbreg = rtl8723_phy_set_bb_reg, | 242 | .set_bbreg = rtl8723_phy_set_bb_reg, |
244 | .get_rfreg = rtl8723ae_phy_query_rf_reg, | 243 | .get_rfreg = rtl8723ae_phy_query_rf_reg, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/rtlwifi/rtl8723be/hw.c index 0fdf0909321f..3d555495b453 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723be/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8723be/hw.c | |||
@@ -2501,23 +2501,3 @@ void rtl8723be_suspend(struct ieee80211_hw *hw) | |||
2501 | void rtl8723be_resume(struct ieee80211_hw *hw) | 2501 | void rtl8723be_resume(struct ieee80211_hw *hw) |
2502 | { | 2502 | { |
2503 | } | 2503 | } |
2504 | |||
2505 | /* Turn on AAP (RCR:bit 0) for promicuous mode. */ | ||
2506 | void rtl8723be_allow_all_destaddr(struct ieee80211_hw *hw, bool allow_all_da, | ||
2507 | bool write_into_reg) | ||
2508 | { | ||
2509 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
2510 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | ||
2511 | |||
2512 | if (allow_all_da) /* Set BIT0 */ | ||
2513 | rtlpci->receive_config |= RCR_AAP; | ||
2514 | else /* Clear BIT0 */ | ||
2515 | rtlpci->receive_config &= ~RCR_AAP; | ||
2516 | |||
2517 | if (write_into_reg) | ||
2518 | rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); | ||
2519 | |||
2520 | RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, | ||
2521 | "receive_config = 0x%08X, write_into_reg =%d\n", | ||
2522 | rtlpci->receive_config, write_into_reg); | ||
2523 | } | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8723be/hw.h b/drivers/net/wireless/rtlwifi/rtl8723be/hw.h index b7449a9b57e4..64c7551af6b7 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723be/hw.h +++ b/drivers/net/wireless/rtlwifi/rtl8723be/hw.h | |||
@@ -59,6 +59,4 @@ void rtl8723be_bt_reg_init(struct ieee80211_hw *hw); | |||
59 | void rtl8723be_bt_hw_init(struct ieee80211_hw *hw); | 59 | void rtl8723be_bt_hw_init(struct ieee80211_hw *hw); |
60 | void rtl8723be_suspend(struct ieee80211_hw *hw); | 60 | void rtl8723be_suspend(struct ieee80211_hw *hw); |
61 | void rtl8723be_resume(struct ieee80211_hw *hw); | 61 | void rtl8723be_resume(struct ieee80211_hw *hw); |
62 | void rtl8723be_allow_all_destaddr(struct ieee80211_hw *hw, bool allow_all_da, | ||
63 | bool write_into_reg); | ||
64 | #endif | 62 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/rtlwifi/rtl8723be/sw.c index b4577ebc4bb0..ff12bf41644b 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723be/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8723be/sw.c | |||
@@ -92,7 +92,7 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw) | |||
92 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 92 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
93 | 93 | ||
94 | rtl8723be_bt_reg_init(hw); | 94 | rtl8723be_bt_reg_init(hw); |
95 | rtlpci->msi_support = true; | 95 | rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; |
96 | rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer(); | 96 | rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer(); |
97 | 97 | ||
98 | rtlpriv->dm.dm_initialgain_enable = 1; | 98 | rtlpriv->dm.dm_initialgain_enable = 1; |
@@ -253,6 +253,7 @@ static struct rtl_mod_params rtl8723be_mod_params = { | |||
253 | .inactiveps = true, | 253 | .inactiveps = true, |
254 | .swctrl_lps = false, | 254 | .swctrl_lps = false, |
255 | .fwctrl_lps = true, | 255 | .fwctrl_lps = true, |
256 | .msi_support = false, | ||
256 | .debug = DBG_EMERG, | 257 | .debug = DBG_EMERG, |
257 | }; | 258 | }; |
258 | 259 | ||
@@ -365,9 +366,11 @@ module_param_named(debug, rtl8723be_mod_params.debug, int, 0444); | |||
365 | module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444); | 366 | module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444); |
366 | module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444); | 367 | module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444); |
367 | module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444); | 368 | module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444); |
369 | module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444); | ||
368 | MODULE_PARM_DESC(swenc, "using hardware crypto (default 0 [hardware])\n"); | 370 | MODULE_PARM_DESC(swenc, "using hardware crypto (default 0 [hardware])\n"); |
369 | MODULE_PARM_DESC(ips, "using no link power save (default 1 is open)\n"); | 371 | MODULE_PARM_DESC(ips, "using no link power save (default 1 is open)\n"); |
370 | MODULE_PARM_DESC(fwlps, "using linked fw control power save (default 1 is open)\n"); | 372 | MODULE_PARM_DESC(fwlps, "using linked fw control power save (default 1 is open)\n"); |
373 | MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 0)\n"); | ||
371 | MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); | 374 | MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); |
372 | 375 | ||
373 | static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); | 376 | static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8723be/trx.c b/drivers/net/wireless/rtlwifi/rtl8723be/trx.c index e0a0d8c8fed5..969eaea5eddd 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723be/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8723be/trx.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include "trx.h" | 33 | #include "trx.h" |
34 | #include "led.h" | 34 | #include "led.h" |
35 | #include "dm.h" | 35 | #include "dm.h" |
36 | #include "phy.h" | ||
37 | 36 | ||
38 | static u8 _rtl8723be_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) | 37 | static u8 _rtl8723be_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) |
39 | { | 38 | { |
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h index 6965afdf572a..407a7936d364 100644 --- a/drivers/net/wireless/rtlwifi/wifi.h +++ b/drivers/net/wireless/rtlwifi/wifi.h | |||
@@ -1960,8 +1960,6 @@ struct rtl_hal_ops { | |||
1960 | u32 regaddr, u32 bitmask); | 1960 | u32 regaddr, u32 bitmask); |
1961 | void (*set_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath, | 1961 | void (*set_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath, |
1962 | u32 regaddr, u32 bitmask, u32 data); | 1962 | u32 regaddr, u32 bitmask, u32 data); |
1963 | void (*allow_all_destaddr)(struct ieee80211_hw *hw, | ||
1964 | bool allow_all_da, bool write_into_reg); | ||
1965 | void (*linked_set_reg) (struct ieee80211_hw *hw); | 1963 | void (*linked_set_reg) (struct ieee80211_hw *hw); |
1966 | void (*chk_switch_dmdp) (struct ieee80211_hw *hw); | 1964 | void (*chk_switch_dmdp) (struct ieee80211_hw *hw); |
1967 | void (*dualmac_easy_concurrent) (struct ieee80211_hw *hw); | 1965 | void (*dualmac_easy_concurrent) (struct ieee80211_hw *hw); |
@@ -2030,6 +2028,10 @@ struct rtl_mod_params { | |||
2030 | 2028 | ||
2031 | /* default: 1 = using linked fw power save */ | 2029 | /* default: 1 = using linked fw power save */ |
2032 | bool fwctrl_lps; | 2030 | bool fwctrl_lps; |
2031 | |||
2032 | /* default: 0 = not using MSI interrupts mode */ | ||
2033 | /* submodules should set their own defalut value */ | ||
2034 | bool msi_support; | ||
2033 | }; | 2035 | }; |
2034 | 2036 | ||
2035 | struct rtl_hal_usbint_cfg { | 2037 | struct rtl_hal_usbint_cfg { |
diff --git a/drivers/net/wireless/ti/wl1251/acx.c b/drivers/net/wireless/ti/wl1251/acx.c index 5a4ec56c83d0..5695628757ee 100644 --- a/drivers/net/wireless/ti/wl1251/acx.c +++ b/drivers/net/wireless/ti/wl1251/acx.c | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | #include <linux/module.h> | 3 | #include <linux/module.h> |
4 | #include <linux/slab.h> | 4 | #include <linux/slab.h> |
5 | #include <linux/crc7.h> | ||
6 | 5 | ||
7 | #include "wl1251.h" | 6 | #include "wl1251.h" |
8 | #include "reg.h" | 7 | #include "reg.h" |
diff --git a/drivers/net/wireless/ti/wl1251/cmd.c b/drivers/net/wireless/ti/wl1251/cmd.c index bf1fa18b9786..ede31f048ef9 100644 --- a/drivers/net/wireless/ti/wl1251/cmd.c +++ b/drivers/net/wireless/ti/wl1251/cmd.c | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | #include <linux/module.h> | 3 | #include <linux/module.h> |
4 | #include <linux/slab.h> | 4 | #include <linux/slab.h> |
5 | #include <linux/crc7.h> | ||
6 | #include <linux/etherdevice.h> | 5 | #include <linux/etherdevice.h> |
7 | 6 | ||
8 | #include "wl1251.h" | 7 | #include "wl1251.h" |
diff --git a/drivers/net/wireless/ti/wl1251/event.c b/drivers/net/wireless/ti/wl1251/event.c index db0105313745..c98630394a1a 100644 --- a/drivers/net/wireless/ti/wl1251/event.c +++ b/drivers/net/wireless/ti/wl1251/event.c | |||
@@ -124,11 +124,12 @@ static int wl1251_event_process(struct wl1251 *wl, struct event_mailbox *mbox) | |||
124 | return ret; | 124 | return ret; |
125 | } | 125 | } |
126 | 126 | ||
127 | if (wl->vif && vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) { | 127 | if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) { |
128 | wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT"); | 128 | wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT"); |
129 | 129 | ||
130 | /* indicate to the stack, that beacons have been lost */ | 130 | /* indicate to the stack, that beacons have been lost */ |
131 | ieee80211_beacon_loss(wl->vif); | 131 | if (wl->vif && wl->vif->type == NL80211_IFTYPE_STATION) |
132 | ieee80211_beacon_loss(wl->vif); | ||
132 | } | 133 | } |
133 | 134 | ||
134 | if (vector & REGAINED_BSS_EVENT_ID) { | 135 | if (vector & REGAINED_BSS_EVENT_ID) { |
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c index 757e25784a8a..4e782f18ae34 100644 --- a/drivers/net/wireless/ti/wl1251/main.c +++ b/drivers/net/wireless/ti/wl1251/main.c | |||
@@ -550,6 +550,34 @@ static void wl1251_op_remove_interface(struct ieee80211_hw *hw, | |||
550 | mutex_unlock(&wl->mutex); | 550 | mutex_unlock(&wl->mutex); |
551 | } | 551 | } |
552 | 552 | ||
553 | static int wl1251_build_null_data(struct wl1251 *wl) | ||
554 | { | ||
555 | struct sk_buff *skb = NULL; | ||
556 | int size; | ||
557 | void *ptr; | ||
558 | int ret = -ENOMEM; | ||
559 | |||
560 | if (wl->bss_type == BSS_TYPE_IBSS) { | ||
561 | size = sizeof(struct wl12xx_null_data_template); | ||
562 | ptr = NULL; | ||
563 | } else { | ||
564 | skb = ieee80211_nullfunc_get(wl->hw, wl->vif); | ||
565 | if (!skb) | ||
566 | goto out; | ||
567 | size = skb->len; | ||
568 | ptr = skb->data; | ||
569 | } | ||
570 | |||
571 | ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA, ptr, size); | ||
572 | |||
573 | out: | ||
574 | dev_kfree_skb(skb); | ||
575 | if (ret) | ||
576 | wl1251_warning("cmd buld null data failed: %d", ret); | ||
577 | |||
578 | return ret; | ||
579 | } | ||
580 | |||
553 | static int wl1251_build_qos_null_data(struct wl1251 *wl) | 581 | static int wl1251_build_qos_null_data(struct wl1251 *wl) |
554 | { | 582 | { |
555 | struct ieee80211_qos_hdr template; | 583 | struct ieee80211_qos_hdr template; |
@@ -687,16 +715,6 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed) | |||
687 | wl->power_level = conf->power_level; | 715 | wl->power_level = conf->power_level; |
688 | } | 716 | } |
689 | 717 | ||
690 | /* | ||
691 | * Tell stack that connection is lost because hw encryption isn't | ||
692 | * supported in monitor mode. | ||
693 | * This requires temporary enabling of the hw connection monitor flag | ||
694 | */ | ||
695 | if ((changed & IEEE80211_CONF_CHANGE_MONITOR) && wl->vif) { | ||
696 | wl->hw->flags |= IEEE80211_HW_CONNECTION_MONITOR; | ||
697 | ieee80211_connection_loss(wl->vif); | ||
698 | } | ||
699 | |||
700 | out_sleep: | 718 | out_sleep: |
701 | wl1251_ps_elp_sleep(wl); | 719 | wl1251_ps_elp_sleep(wl); |
702 | 720 | ||
@@ -1103,24 +1121,19 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1103 | wl->rssi_thold = bss_conf->cqm_rssi_thold; | 1121 | wl->rssi_thold = bss_conf->cqm_rssi_thold; |
1104 | } | 1122 | } |
1105 | 1123 | ||
1106 | if (changed & BSS_CHANGED_BSSID) { | 1124 | if ((changed & BSS_CHANGED_BSSID) && |
1125 | memcmp(wl->bssid, bss_conf->bssid, ETH_ALEN)) { | ||
1107 | memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); | 1126 | memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); |
1108 | 1127 | ||
1109 | skb = ieee80211_nullfunc_get(wl->hw, wl->vif); | 1128 | if (!is_zero_ether_addr(wl->bssid)) { |
1110 | if (!skb) | 1129 | ret = wl1251_build_null_data(wl); |
1111 | goto out_sleep; | 1130 | if (ret < 0) |
1112 | 1131 | goto out_sleep; | |
1113 | ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA, | ||
1114 | skb->data, skb->len); | ||
1115 | dev_kfree_skb(skb); | ||
1116 | if (ret < 0) | ||
1117 | goto out_sleep; | ||
1118 | 1132 | ||
1119 | ret = wl1251_build_qos_null_data(wl); | 1133 | ret = wl1251_build_qos_null_data(wl); |
1120 | if (ret < 0) | 1134 | if (ret < 0) |
1121 | goto out; | 1135 | goto out_sleep; |
1122 | 1136 | ||
1123 | if (wl->bss_type != BSS_TYPE_IBSS) { | ||
1124 | ret = wl1251_join(wl, wl->bss_type, wl->channel, | 1137 | ret = wl1251_join(wl, wl->bss_type, wl->channel, |
1125 | wl->beacon_int, wl->dtim_period); | 1138 | wl->beacon_int, wl->dtim_period); |
1126 | if (ret < 0) | 1139 | if (ret < 0) |
@@ -1129,9 +1142,6 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1129 | } | 1142 | } |
1130 | 1143 | ||
1131 | if (changed & BSS_CHANGED_ASSOC) { | 1144 | if (changed & BSS_CHANGED_ASSOC) { |
1132 | /* Disable temporary enabled hw connection monitor flag */ | ||
1133 | wl->hw->flags &= ~IEEE80211_HW_CONNECTION_MONITOR; | ||
1134 | |||
1135 | if (bss_conf->assoc) { | 1145 | if (bss_conf->assoc) { |
1136 | wl->beacon_int = bss_conf->beacon_int; | 1146 | wl->beacon_int = bss_conf->beacon_int; |
1137 | 1147 | ||
@@ -1216,8 +1226,8 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1216 | if (ret < 0) | 1226 | if (ret < 0) |
1217 | goto out_sleep; | 1227 | goto out_sleep; |
1218 | 1228 | ||
1219 | ret = wl1251_join(wl, wl->bss_type, wl->beacon_int, | 1229 | ret = wl1251_join(wl, wl->bss_type, wl->channel, |
1220 | wl->channel, wl->dtim_period); | 1230 | wl->beacon_int, wl->dtim_period); |
1221 | 1231 | ||
1222 | if (ret < 0) | 1232 | if (ret < 0) |
1223 | goto out_sleep; | 1233 | goto out_sleep; |
diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c index b06d36d99362..a0aa8fa72392 100644 --- a/drivers/net/wireless/ti/wl1251/spi.c +++ b/drivers/net/wireless/ti/wl1251/spi.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/swab.h> | ||
26 | #include <linux/crc7.h> | 27 | #include <linux/crc7.h> |
27 | #include <linux/spi/spi.h> | 28 | #include <linux/spi/spi.h> |
28 | #include <linux/wl12xx.h> | 29 | #include <linux/wl12xx.h> |
@@ -83,47 +84,44 @@ static void wl1251_spi_reset(struct wl1251 *wl) | |||
83 | 84 | ||
84 | static void wl1251_spi_wake(struct wl1251 *wl) | 85 | static void wl1251_spi_wake(struct wl1251 *wl) |
85 | { | 86 | { |
86 | u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd; | ||
87 | struct spi_transfer t; | 87 | struct spi_transfer t; |
88 | struct spi_message m; | 88 | struct spi_message m; |
89 | u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); | ||
89 | 90 | ||
90 | cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); | ||
91 | if (!cmd) { | 91 | if (!cmd) { |
92 | wl1251_error("could not allocate cmd for spi init"); | 92 | wl1251_error("could not allocate cmd for spi init"); |
93 | return; | 93 | return; |
94 | } | 94 | } |
95 | 95 | ||
96 | memset(crc, 0, sizeof(crc)); | ||
97 | memset(&t, 0, sizeof(t)); | 96 | memset(&t, 0, sizeof(t)); |
98 | spi_message_init(&m); | 97 | spi_message_init(&m); |
99 | 98 | ||
100 | /* Set WSPI_INIT_COMMAND | 99 | /* Set WSPI_INIT_COMMAND |
101 | * the data is being send from the MSB to LSB | 100 | * the data is being send from the MSB to LSB |
102 | */ | 101 | */ |
103 | cmd[2] = 0xff; | 102 | cmd[0] = 0xff; |
104 | cmd[3] = 0xff; | 103 | cmd[1] = 0xff; |
105 | cmd[1] = WSPI_INIT_CMD_START | WSPI_INIT_CMD_TX; | 104 | cmd[2] = WSPI_INIT_CMD_START | WSPI_INIT_CMD_TX; |
106 | cmd[0] = 0; | 105 | cmd[3] = 0; |
107 | cmd[7] = 0; | 106 | cmd[4] = 0; |
108 | cmd[6] |= HW_ACCESS_WSPI_INIT_CMD_MASK << 3; | 107 | cmd[5] = HW_ACCESS_WSPI_INIT_CMD_MASK << 3; |
109 | cmd[6] |= HW_ACCESS_WSPI_FIXED_BUSY_LEN & WSPI_INIT_CMD_FIXEDBUSY_LEN; | 108 | cmd[5] |= HW_ACCESS_WSPI_FIXED_BUSY_LEN & WSPI_INIT_CMD_FIXEDBUSY_LEN; |
109 | |||
110 | cmd[6] = WSPI_INIT_CMD_IOD | WSPI_INIT_CMD_IP | WSPI_INIT_CMD_CS | ||
111 | | WSPI_INIT_CMD_WSPI | WSPI_INIT_CMD_WS; | ||
110 | 112 | ||
111 | if (HW_ACCESS_WSPI_FIXED_BUSY_LEN == 0) | 113 | if (HW_ACCESS_WSPI_FIXED_BUSY_LEN == 0) |
112 | cmd[5] |= WSPI_INIT_CMD_DIS_FIXEDBUSY; | 114 | cmd[6] |= WSPI_INIT_CMD_DIS_FIXEDBUSY; |
113 | else | 115 | else |
114 | cmd[5] |= WSPI_INIT_CMD_EN_FIXEDBUSY; | 116 | cmd[6] |= WSPI_INIT_CMD_EN_FIXEDBUSY; |
115 | |||
116 | cmd[5] |= WSPI_INIT_CMD_IOD | WSPI_INIT_CMD_IP | WSPI_INIT_CMD_CS | ||
117 | | WSPI_INIT_CMD_WSPI | WSPI_INIT_CMD_WS; | ||
118 | |||
119 | crc[0] = cmd[1]; | ||
120 | crc[1] = cmd[0]; | ||
121 | crc[2] = cmd[7]; | ||
122 | crc[3] = cmd[6]; | ||
123 | crc[4] = cmd[5]; | ||
124 | 117 | ||
125 | cmd[4] |= crc7(0, crc, WSPI_INIT_CMD_CRC_LEN) << 1; | 118 | cmd[7] = crc7_be(0, cmd+2, WSPI_INIT_CMD_CRC_LEN) | WSPI_INIT_CMD_END; |
126 | cmd[4] |= WSPI_INIT_CMD_END; | 119 | /* |
120 | * The above is the logical order; it must actually be stored | ||
121 | * in the buffer byte-swapped. | ||
122 | */ | ||
123 | __swab32s((u32 *)cmd); | ||
124 | __swab32s((u32 *)cmd+1); | ||
127 | 125 | ||
128 | t.tx_buf = cmd; | 126 | t.tx_buf = cmd; |
129 | t.len = WSPI_INIT_CMD_LEN; | 127 | t.len = WSPI_INIT_CMD_LEN; |
diff --git a/drivers/net/wireless/ti/wlcore/debugfs.h b/drivers/net/wireless/ti/wlcore/debugfs.h index f7381dd69009..0f2cfb0d2a9e 100644 --- a/drivers/net/wireless/ti/wlcore/debugfs.h +++ b/drivers/net/wireless/ti/wlcore/debugfs.h | |||
@@ -57,7 +57,7 @@ static const struct file_operations name## _ops = { \ | |||
57 | wl, &name## _ops); \ | 57 | wl, &name## _ops); \ |
58 | if (!entry || IS_ERR(entry)) \ | 58 | if (!entry || IS_ERR(entry)) \ |
59 | goto err; \ | 59 | goto err; \ |
60 | } while (0); | 60 | } while (0) |
61 | 61 | ||
62 | 62 | ||
63 | #define DEBUGFS_ADD_PREFIX(prefix, name, parent) \ | 63 | #define DEBUGFS_ADD_PREFIX(prefix, name, parent) \ |
@@ -66,7 +66,7 @@ static const struct file_operations name## _ops = { \ | |||
66 | wl, &prefix## _## name## _ops); \ | 66 | wl, &prefix## _## name## _ops); \ |
67 | if (!entry || IS_ERR(entry)) \ | 67 | if (!entry || IS_ERR(entry)) \ |
68 | goto err; \ | 68 | goto err; \ |
69 | } while (0); | 69 | } while (0) |
70 | 70 | ||
71 | #define DEBUGFS_FWSTATS_FILE(sub, name, fmt, struct_type) \ | 71 | #define DEBUGFS_FWSTATS_FILE(sub, name, fmt, struct_type) \ |
72 | static ssize_t sub## _ ##name## _read(struct file *file, \ | 72 | static ssize_t sub## _ ##name## _read(struct file *file, \ |
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index e71eae353368..3d6028e62750 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c | |||
@@ -1416,7 +1416,7 @@ void wl1271_rx_filter_free(struct wl12xx_rx_filter *filter) | |||
1416 | 1416 | ||
1417 | int wl1271_rx_filter_alloc_field(struct wl12xx_rx_filter *filter, | 1417 | int wl1271_rx_filter_alloc_field(struct wl12xx_rx_filter *filter, |
1418 | u16 offset, u8 flags, | 1418 | u16 offset, u8 flags, |
1419 | u8 *pattern, u8 len) | 1419 | const u8 *pattern, u8 len) |
1420 | { | 1420 | { |
1421 | struct wl12xx_rx_filter_field *field; | 1421 | struct wl12xx_rx_filter_field *field; |
1422 | 1422 | ||
@@ -5184,7 +5184,8 @@ out: | |||
5184 | mutex_unlock(&wl->mutex); | 5184 | mutex_unlock(&wl->mutex); |
5185 | } | 5185 | } |
5186 | 5186 | ||
5187 | static void wlcore_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | 5187 | static void wlcore_op_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
5188 | u32 queues, bool drop) | ||
5188 | { | 5189 | { |
5189 | struct wl1271 *wl = hw->priv; | 5190 | struct wl1271 *wl = hw->priv; |
5190 | 5191 | ||
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 29ef2492951f..d3dd7bfdf3f1 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c | |||
@@ -217,7 +217,7 @@ static struct wl1271_if_operations sdio_ops = { | |||
217 | static int wl1271_probe(struct sdio_func *func, | 217 | static int wl1271_probe(struct sdio_func *func, |
218 | const struct sdio_device_id *id) | 218 | const struct sdio_device_id *id) |
219 | { | 219 | { |
220 | struct wlcore_platdev_data *pdev_data; | 220 | struct wlcore_platdev_data pdev_data; |
221 | struct wl12xx_sdio_glue *glue; | 221 | struct wl12xx_sdio_glue *glue; |
222 | struct resource res[1]; | 222 | struct resource res[1]; |
223 | mmc_pm_flag_t mmcflags; | 223 | mmc_pm_flag_t mmcflags; |
@@ -228,16 +228,13 @@ static int wl1271_probe(struct sdio_func *func, | |||
228 | if (func->num != 0x02) | 228 | if (func->num != 0x02) |
229 | return -ENODEV; | 229 | return -ENODEV; |
230 | 230 | ||
231 | pdev_data = kzalloc(sizeof(*pdev_data), GFP_KERNEL); | 231 | memset(&pdev_data, 0x00, sizeof(pdev_data)); |
232 | if (!pdev_data) | 232 | pdev_data.if_ops = &sdio_ops; |
233 | goto out; | ||
234 | |||
235 | pdev_data->if_ops = &sdio_ops; | ||
236 | 233 | ||
237 | glue = kzalloc(sizeof(*glue), GFP_KERNEL); | 234 | glue = kzalloc(sizeof(*glue), GFP_KERNEL); |
238 | if (!glue) { | 235 | if (!glue) { |
239 | dev_err(&func->dev, "can't allocate glue\n"); | 236 | dev_err(&func->dev, "can't allocate glue\n"); |
240 | goto out_free_pdev_data; | 237 | goto out; |
241 | } | 238 | } |
242 | 239 | ||
243 | glue->dev = &func->dev; | 240 | glue->dev = &func->dev; |
@@ -248,9 +245,9 @@ static int wl1271_probe(struct sdio_func *func, | |||
248 | /* Use block mode for transferring over one block size of data */ | 245 | /* Use block mode for transferring over one block size of data */ |
249 | func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; | 246 | func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; |
250 | 247 | ||
251 | pdev_data->pdata = wl12xx_get_platform_data(); | 248 | pdev_data.pdata = wl12xx_get_platform_data(); |
252 | if (IS_ERR(pdev_data->pdata)) { | 249 | if (IS_ERR(pdev_data.pdata)) { |
253 | ret = PTR_ERR(pdev_data->pdata); | 250 | ret = PTR_ERR(pdev_data.pdata); |
254 | dev_err(glue->dev, "missing wlan platform data: %d\n", ret); | 251 | dev_err(glue->dev, "missing wlan platform data: %d\n", ret); |
255 | goto out_free_glue; | 252 | goto out_free_glue; |
256 | } | 253 | } |
@@ -260,7 +257,7 @@ static int wl1271_probe(struct sdio_func *func, | |||
260 | dev_dbg(glue->dev, "sdio PM caps = 0x%x\n", mmcflags); | 257 | dev_dbg(glue->dev, "sdio PM caps = 0x%x\n", mmcflags); |
261 | 258 | ||
262 | if (mmcflags & MMC_PM_KEEP_POWER) | 259 | if (mmcflags & MMC_PM_KEEP_POWER) |
263 | pdev_data->pdata->pwr_in_suspend = true; | 260 | pdev_data.pdata->pwr_in_suspend = true; |
264 | 261 | ||
265 | sdio_set_drvdata(func, glue); | 262 | sdio_set_drvdata(func, glue); |
266 | 263 | ||
@@ -289,7 +286,7 @@ static int wl1271_probe(struct sdio_func *func, | |||
289 | 286 | ||
290 | memset(res, 0x00, sizeof(res)); | 287 | memset(res, 0x00, sizeof(res)); |
291 | 288 | ||
292 | res[0].start = pdev_data->pdata->irq; | 289 | res[0].start = pdev_data.pdata->irq; |
293 | res[0].flags = IORESOURCE_IRQ; | 290 | res[0].flags = IORESOURCE_IRQ; |
294 | res[0].name = "irq"; | 291 | res[0].name = "irq"; |
295 | 292 | ||
@@ -299,8 +296,8 @@ static int wl1271_probe(struct sdio_func *func, | |||
299 | goto out_dev_put; | 296 | goto out_dev_put; |
300 | } | 297 | } |
301 | 298 | ||
302 | ret = platform_device_add_data(glue->core, pdev_data, | 299 | ret = platform_device_add_data(glue->core, &pdev_data, |
303 | sizeof(*pdev_data)); | 300 | sizeof(pdev_data)); |
304 | if (ret) { | 301 | if (ret) { |
305 | dev_err(glue->dev, "can't add platform data\n"); | 302 | dev_err(glue->dev, "can't add platform data\n"); |
306 | goto out_dev_put; | 303 | goto out_dev_put; |
@@ -319,9 +316,6 @@ out_dev_put: | |||
319 | out_free_glue: | 316 | out_free_glue: |
320 | kfree(glue); | 317 | kfree(glue); |
321 | 318 | ||
322 | out_free_pdev_data: | ||
323 | kfree(pdev_data); | ||
324 | |||
325 | out: | 319 | out: |
326 | return ret; | 320 | return ret; |
327 | } | 321 | } |
diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index dbe826dd7c23..392c882b28f0 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c | |||
@@ -24,11 +24,12 @@ | |||
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/slab.h> | ||
28 | #include <linux/swab.h> | ||
27 | #include <linux/crc7.h> | 29 | #include <linux/crc7.h> |
28 | #include <linux/spi/spi.h> | 30 | #include <linux/spi/spi.h> |
29 | #include <linux/wl12xx.h> | 31 | #include <linux/wl12xx.h> |
30 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
31 | #include <linux/slab.h> | ||
32 | 33 | ||
33 | #include "wlcore.h" | 34 | #include "wlcore.h" |
34 | #include "wl12xx_80211.h" | 35 | #include "wl12xx_80211.h" |
@@ -110,18 +111,16 @@ static void wl12xx_spi_reset(struct device *child) | |||
110 | static void wl12xx_spi_init(struct device *child) | 111 | static void wl12xx_spi_init(struct device *child) |
111 | { | 112 | { |
112 | struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); | 113 | struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); |
113 | u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd; | ||
114 | struct spi_transfer t; | 114 | struct spi_transfer t; |
115 | struct spi_message m; | 115 | struct spi_message m; |
116 | u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); | ||
116 | 117 | ||
117 | cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); | ||
118 | if (!cmd) { | 118 | if (!cmd) { |
119 | dev_err(child->parent, | 119 | dev_err(child->parent, |
120 | "could not allocate cmd for spi init\n"); | 120 | "could not allocate cmd for spi init\n"); |
121 | return; | 121 | return; |
122 | } | 122 | } |
123 | 123 | ||
124 | memset(crc, 0, sizeof(crc)); | ||
125 | memset(&t, 0, sizeof(t)); | 124 | memset(&t, 0, sizeof(t)); |
126 | spi_message_init(&m); | 125 | spi_message_init(&m); |
127 | 126 | ||
@@ -129,30 +128,29 @@ static void wl12xx_spi_init(struct device *child) | |||
129 | * Set WSPI_INIT_COMMAND | 128 | * Set WSPI_INIT_COMMAND |
130 | * the data is being send from the MSB to LSB | 129 | * the data is being send from the MSB to LSB |
131 | */ | 130 | */ |
132 | cmd[2] = 0xff; | 131 | cmd[0] = 0xff; |
133 | cmd[3] = 0xff; | 132 | cmd[1] = 0xff; |
134 | cmd[1] = WSPI_INIT_CMD_START | WSPI_INIT_CMD_TX; | 133 | cmd[2] = WSPI_INIT_CMD_START | WSPI_INIT_CMD_TX; |
135 | cmd[0] = 0; | 134 | cmd[3] = 0; |
136 | cmd[7] = 0; | 135 | cmd[4] = 0; |
137 | cmd[6] |= HW_ACCESS_WSPI_INIT_CMD_MASK << 3; | 136 | cmd[5] = HW_ACCESS_WSPI_INIT_CMD_MASK << 3; |
138 | cmd[6] |= HW_ACCESS_WSPI_FIXED_BUSY_LEN & WSPI_INIT_CMD_FIXEDBUSY_LEN; | 137 | cmd[5] |= HW_ACCESS_WSPI_FIXED_BUSY_LEN & WSPI_INIT_CMD_FIXEDBUSY_LEN; |
138 | |||
139 | cmd[6] = WSPI_INIT_CMD_IOD | WSPI_INIT_CMD_IP | WSPI_INIT_CMD_CS | ||
140 | | WSPI_INIT_CMD_WSPI | WSPI_INIT_CMD_WS; | ||
139 | 141 | ||
140 | if (HW_ACCESS_WSPI_FIXED_BUSY_LEN == 0) | 142 | if (HW_ACCESS_WSPI_FIXED_BUSY_LEN == 0) |
141 | cmd[5] |= WSPI_INIT_CMD_DIS_FIXEDBUSY; | 143 | cmd[6] |= WSPI_INIT_CMD_DIS_FIXEDBUSY; |
142 | else | 144 | else |
143 | cmd[5] |= WSPI_INIT_CMD_EN_FIXEDBUSY; | 145 | cmd[6] |= WSPI_INIT_CMD_EN_FIXEDBUSY; |
144 | |||
145 | cmd[5] |= WSPI_INIT_CMD_IOD | WSPI_INIT_CMD_IP | WSPI_INIT_CMD_CS | ||
146 | | WSPI_INIT_CMD_WSPI | WSPI_INIT_CMD_WS; | ||
147 | |||
148 | crc[0] = cmd[1]; | ||
149 | crc[1] = cmd[0]; | ||
150 | crc[2] = cmd[7]; | ||
151 | crc[3] = cmd[6]; | ||
152 | crc[4] = cmd[5]; | ||
153 | 146 | ||
154 | cmd[4] |= crc7(0, crc, WSPI_INIT_CMD_CRC_LEN) << 1; | 147 | cmd[7] = crc7_be(0, cmd+2, WSPI_INIT_CMD_CRC_LEN) | WSPI_INIT_CMD_END; |
155 | cmd[4] |= WSPI_INIT_CMD_END; | 148 | /* |
149 | * The above is the logical order; it must actually be stored | ||
150 | * in the buffer byte-swapped. | ||
151 | */ | ||
152 | __swab32s((u32 *)cmd); | ||
153 | __swab32s((u32 *)cmd+1); | ||
156 | 154 | ||
157 | t.tx_buf = cmd; | 155 | t.tx_buf = cmd; |
158 | t.len = WSPI_INIT_CMD_LEN; | 156 | t.len = WSPI_INIT_CMD_LEN; |
@@ -327,27 +325,25 @@ static struct wl1271_if_operations spi_ops = { | |||
327 | static int wl1271_probe(struct spi_device *spi) | 325 | static int wl1271_probe(struct spi_device *spi) |
328 | { | 326 | { |
329 | struct wl12xx_spi_glue *glue; | 327 | struct wl12xx_spi_glue *glue; |
330 | struct wlcore_platdev_data *pdev_data; | 328 | struct wlcore_platdev_data pdev_data; |
331 | struct resource res[1]; | 329 | struct resource res[1]; |
332 | int ret = -ENOMEM; | 330 | int ret = -ENOMEM; |
333 | 331 | ||
334 | pdev_data = kzalloc(sizeof(*pdev_data), GFP_KERNEL); | 332 | memset(&pdev_data, 0x00, sizeof(pdev_data)); |
335 | if (!pdev_data) | ||
336 | goto out; | ||
337 | 333 | ||
338 | pdev_data->pdata = dev_get_platdata(&spi->dev); | 334 | pdev_data.pdata = dev_get_platdata(&spi->dev); |
339 | if (!pdev_data->pdata) { | 335 | if (!pdev_data.pdata) { |
340 | dev_err(&spi->dev, "no platform data\n"); | 336 | dev_err(&spi->dev, "no platform data\n"); |
341 | ret = -ENODEV; | 337 | ret = -ENODEV; |
342 | goto out_free_pdev_data; | 338 | goto out; |
343 | } | 339 | } |
344 | 340 | ||
345 | pdev_data->if_ops = &spi_ops; | 341 | pdev_data.if_ops = &spi_ops; |
346 | 342 | ||
347 | glue = kzalloc(sizeof(*glue), GFP_KERNEL); | 343 | glue = kzalloc(sizeof(*glue), GFP_KERNEL); |
348 | if (!glue) { | 344 | if (!glue) { |
349 | dev_err(&spi->dev, "can't allocate glue\n"); | 345 | dev_err(&spi->dev, "can't allocate glue\n"); |
350 | goto out_free_pdev_data; | 346 | goto out; |
351 | } | 347 | } |
352 | 348 | ||
353 | glue->dev = &spi->dev; | 349 | glue->dev = &spi->dev; |
@@ -385,8 +381,8 @@ static int wl1271_probe(struct spi_device *spi) | |||
385 | goto out_dev_put; | 381 | goto out_dev_put; |
386 | } | 382 | } |
387 | 383 | ||
388 | ret = platform_device_add_data(glue->core, pdev_data, | 384 | ret = platform_device_add_data(glue->core, &pdev_data, |
389 | sizeof(*pdev_data)); | 385 | sizeof(pdev_data)); |
390 | if (ret) { | 386 | if (ret) { |
391 | dev_err(glue->dev, "can't add platform data\n"); | 387 | dev_err(glue->dev, "can't add platform data\n"); |
392 | goto out_dev_put; | 388 | goto out_dev_put; |
@@ -406,9 +402,6 @@ out_dev_put: | |||
406 | out_free_glue: | 402 | out_free_glue: |
407 | kfree(glue); | 403 | kfree(glue); |
408 | 404 | ||
409 | out_free_pdev_data: | ||
410 | kfree(pdev_data); | ||
411 | |||
412 | out: | 405 | out: |
413 | return ret; | 406 | return ret; |
414 | } | 407 | } |
diff --git a/drivers/net/wireless/ti/wlcore/wlcore_i.h b/drivers/net/wireless/ti/wlcore/wlcore_i.h index 756e890bc5ee..c2c34a84ff3d 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore_i.h +++ b/drivers/net/wireless/ti/wlcore/wlcore_i.h | |||
@@ -512,8 +512,8 @@ int wl1271_recalc_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif); | |||
512 | void wl12xx_queue_recovery_work(struct wl1271 *wl); | 512 | void wl12xx_queue_recovery_work(struct wl1271 *wl); |
513 | size_t wl12xx_copy_fwlog(struct wl1271 *wl, u8 *memblock, size_t maxlen); | 513 | size_t wl12xx_copy_fwlog(struct wl1271 *wl, u8 *memblock, size_t maxlen); |
514 | int wl1271_rx_filter_alloc_field(struct wl12xx_rx_filter *filter, | 514 | int wl1271_rx_filter_alloc_field(struct wl12xx_rx_filter *filter, |
515 | u16 offset, u8 flags, | 515 | u16 offset, u8 flags, |
516 | u8 *pattern, u8 len); | 516 | const u8 *pattern, u8 len); |
517 | void wl1271_rx_filter_free(struct wl12xx_rx_filter *filter); | 517 | void wl1271_rx_filter_free(struct wl12xx_rx_filter *filter); |
518 | struct wl12xx_rx_filter *wl1271_rx_filter_alloc(void); | 518 | struct wl12xx_rx_filter *wl1271_rx_filter_alloc(void); |
519 | int wl1271_rx_filter_get_fields_size(struct wl12xx_rx_filter *filter); | 519 | int wl1271_rx_filter_get_fields_size(struct wl12xx_rx_filter *filter); |