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

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

+1818 -974
+1
drivers/bcma/host_pci.c
··· 171 171 } 172 172 173 173 static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = { 174 + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x0576) }, 174 175 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) }, 175 176 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) }, 176 177 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
+11 -22
drivers/net/wireless/airo.c
··· 4501 4501 struct proc_dir_entry *entry; 4502 4502 /* First setup the device directory */ 4503 4503 strcpy(apriv->proc_name,dev->name); 4504 - apriv->proc_entry = create_proc_entry(apriv->proc_name, 4505 - S_IFDIR|airo_perm, 4506 - airo_entry); 4504 + apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm, 4505 + airo_entry); 4507 4506 if (!apriv->proc_entry) 4508 4507 goto fail; 4509 4508 apriv->proc_entry->uid = proc_uid; 4510 4509 apriv->proc_entry->gid = proc_gid; 4511 4510 4512 4511 /* Setup the StatsDelta */ 4513 - entry = proc_create_data("StatsDelta", 4514 - S_IFREG | (S_IRUGO&proc_perm), 4512 + entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm, 4515 4513 apriv->proc_entry, &proc_statsdelta_ops, dev); 4516 4514 if (!entry) 4517 4515 goto fail_stats_delta; ··· 4517 4519 entry->gid = proc_gid; 4518 4520 4519 4521 /* Setup the Stats */ 4520 - entry = proc_create_data("Stats", 4521 - S_IFREG | (S_IRUGO&proc_perm), 4522 + entry = proc_create_data("Stats", S_IRUGO & proc_perm, 4522 4523 apriv->proc_entry, &proc_stats_ops, dev); 4523 4524 if (!entry) 4524 4525 goto fail_stats; ··· 4525 4528 entry->gid = proc_gid; 4526 4529 4527 4530 /* Setup the Status */ 4528 - entry = proc_create_data("Status", 4529 - S_IFREG | (S_IRUGO&proc_perm), 4531 + entry = proc_create_data("Status", S_IRUGO & proc_perm, 4530 4532 apriv->proc_entry, &proc_status_ops, dev); 4531 4533 if (!entry) 4532 4534 goto fail_status; ··· 4533 4537 entry->gid = proc_gid; 4534 4538 4535 4539 /* Setup the Config */ 4536 - entry = proc_create_data("Config", 4537 - S_IFREG | proc_perm, 4540 + entry = proc_create_data("Config", proc_perm, 4538 4541 apriv->proc_entry, &proc_config_ops, dev); 4539 4542 if (!entry) 4540 4543 goto fail_config; ··· 4541 4546 entry->gid = proc_gid; 4542 4547 4543 4548 /* Setup the SSID */ 4544 - entry = proc_create_data("SSID", 4545 - S_IFREG | proc_perm, 4549 + entry = proc_create_data("SSID", proc_perm, 4546 4550 apriv->proc_entry, &proc_SSID_ops, dev); 4547 4551 if (!entry) 4548 4552 goto fail_ssid; ··· 4549 4555 entry->gid = proc_gid; 4550 4556 4551 4557 /* Setup the APList */ 4552 - entry = proc_create_data("APList", 4553 - S_IFREG | proc_perm, 4558 + entry = proc_create_data("APList", proc_perm, 4554 4559 apriv->proc_entry, &proc_APList_ops, dev); 4555 4560 if (!entry) 4556 4561 goto fail_aplist; ··· 4557 4564 entry->gid = proc_gid; 4558 4565 4559 4566 /* Setup the BSSList */ 4560 - entry = proc_create_data("BSSList", 4561 - S_IFREG | proc_perm, 4567 + entry = proc_create_data("BSSList", proc_perm, 4562 4568 apriv->proc_entry, &proc_BSSList_ops, dev); 4563 4569 if (!entry) 4564 4570 goto fail_bsslist; ··· 4565 4573 entry->gid = proc_gid; 4566 4574 4567 4575 /* Setup the WepKey */ 4568 - entry = proc_create_data("WepKey", 4569 - S_IFREG | proc_perm, 4576 + entry = proc_create_data("WepKey", proc_perm, 4570 4577 apriv->proc_entry, &proc_wepkey_ops, dev); 4571 4578 if (!entry) 4572 4579 goto fail_wepkey; ··· 5697 5706 { 5698 5707 int i; 5699 5708 5700 - airo_entry = create_proc_entry("driver/aironet", 5701 - S_IFDIR | airo_perm, 5702 - NULL); 5709 + airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL); 5703 5710 5704 5711 if (airo_entry) { 5705 5712 airo_entry->uid = proc_uid;
+1 -1
drivers/net/wireless/ath/ath9k/ahb.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org> 4 4 * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org> 5 5 *
+1 -1
drivers/net/wireless/ath/ath9k/ani.c
··· 1 1 /* 2 - * Copyright (c) 2008-2010 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ani.h
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar5008_initvals.h
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar5008_phy.c
··· 1 1 /* 2 - * Copyright (c) 2008-2010 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9001_initvals.h
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9002_calib.c
··· 1 1 /* 2 - * Copyright (c) 2008-2010 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9002_hw.c
··· 1 1 /* 2 - * Copyright (c) 2008-2010 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9002_initvals.h
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9002_mac.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9002_phy.c
··· 1 1 /* 2 - * Copyright (c) 2008-2010 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9002_phy.h
··· 1 1 /* 2 - * Copyright (c) 2008-2010 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9003_calib.c
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+16
drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
··· 1 + /* 2 + * Copyright (c) 2010-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 + 1 17 #ifndef AR9003_EEPROM_H 2 18 #define AR9003_EEPROM_H 3 19
+1 -1
drivers/net/wireless/ath/ath9k/ar9003_hw.c
··· 1 1 /* 2 - * Copyright (c) 2008-2010 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9003_mac.c
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9003_mac.h
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9003_paprd.c
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9003_phy.c
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9003_phy.h
··· 1 1 /* 2 - * Copyright (c) 2002-2010 Atheros Communications, Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications, Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/ar9485_initvals.h
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+4 -1
drivers/net/wireless/ath/ath9k/ath9k.h
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above ··· 397 397 struct ath_descdma bdma; 398 398 struct ath_txq *cabq; 399 399 struct list_head bbuf; 400 + 401 + bool tx_processed; 402 + bool tx_last; 400 403 }; 401 404 402 405 void ath_beacon_tasklet(unsigned long data);
+34 -14
drivers/net/wireless/ath/ath9k/beacon.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above ··· 17 17 #include "ath9k.h" 18 18 19 19 #define FUDGE 2 20 + 21 + static void ath9k_reset_beacon_status(struct ath_softc *sc) 22 + { 23 + sc->beacon.tx_processed = false; 24 + sc->beacon.tx_last = false; 25 + } 20 26 21 27 /* 22 28 * This function will modify certain transmit queue properties depending on ··· 77 71 int flags, ctsrate = 0, ctsduration = 0; 78 72 struct ieee80211_supported_band *sband; 79 73 u8 rate = 0; 74 + 75 + ath9k_reset_beacon_status(sc); 80 76 81 77 ds = bf->bf_desc; 82 78 flags = ATH9K_TXDESC_NOACK; ··· 141 133 struct ath_txq *cabq; 142 134 struct ieee80211_tx_info *info; 143 135 int cabq_depth; 136 + 137 + ath9k_reset_beacon_status(sc); 144 138 145 139 avp = (void *)vif->drv_priv; 146 140 cabq = sc->beacon.cabq; ··· 361 351 struct ath_buf *bf = NULL; 362 352 struct ieee80211_vif *vif; 363 353 int slot; 364 - u32 bfaddr, bc = 0, tsftu; 365 - u64 tsf; 366 - u16 intval; 354 + u32 bfaddr, bc = 0; 367 355 368 356 /* 369 357 * Check if the previous beacon has gone out. If ··· 396 388 * on the tsf to safeguard against missing an swba. 397 389 */ 398 390 399 - intval = cur_conf->beacon_interval ? : ATH_DEFAULT_BINTVAL; 400 391 401 - tsf = ath9k_hw_gettsf64(ah); 402 - tsf += TU_TO_USEC(ah->config.sw_beacon_response_time); 403 - tsftu = TSF_TO_TU((tsf * ATH_BCBUF) >>32, tsf * ATH_BCBUF); 404 - slot = (tsftu % (intval * ATH_BCBUF)) / intval; 405 - vif = sc->beacon.bslot[slot]; 392 + if (ah->opmode == NL80211_IFTYPE_AP) { 393 + u16 intval; 394 + u32 tsftu; 395 + u64 tsf; 406 396 407 - ath_dbg(common, ATH_DBG_BEACON, 408 - "slot %d [tsf %llu tsftu %u intval %u] vif %p\n", 409 - slot, tsf, tsftu / ATH_BCBUF, intval, vif); 397 + intval = cur_conf->beacon_interval ? : ATH_DEFAULT_BINTVAL; 398 + tsf = ath9k_hw_gettsf64(ah); 399 + tsf += TU_TO_USEC(ah->config.sw_beacon_response_time); 400 + tsftu = TSF_TO_TU((tsf * ATH_BCBUF) >>32, tsf * ATH_BCBUF); 401 + slot = (tsftu % (intval * ATH_BCBUF)) / intval; 402 + vif = sc->beacon.bslot[slot]; 403 + 404 + ath_dbg(common, ATH_DBG_BEACON, 405 + "slot %d [tsf %llu tsftu %u intval %u] vif %p\n", 406 + slot, tsf, tsftu / ATH_BCBUF, intval, vif); 407 + } else { 408 + slot = 0; 409 + vif = sc->beacon.bslot[slot]; 410 + } 411 + 410 412 411 413 bfaddr = 0; 412 414 if (vif) { ··· 654 636 struct ath_common *common = ath9k_hw_common(ah); 655 637 u32 tsf, delta, intval, nexttbtt; 656 638 639 + ath9k_reset_beacon_status(sc); 640 + 657 641 tsf = ath9k_hw_gettsf32(ah) + TU_TO_USEC(FUDGE); 658 642 intval = TU_TO_USEC(conf->beacon_interval & ATH9K_BEACON_PERIOD); 659 643 ··· 666 646 delta = (tsf - sc->beacon.bc_tstamp); 667 647 else 668 648 delta = (tsf + 1 + (~0U - sc->beacon.bc_tstamp)); 669 - nexttbtt = tsf + roundup(delta, intval); 649 + nexttbtt = tsf + intval - (delta % intval); 670 650 } 671 651 672 652 ath_dbg(common, ATH_DBG_BEACON,
+1 -1
drivers/net/wireless/ath/ath9k/btcoex.c
··· 1 1 /* 2 - * Copyright (c) 2009 Atheros Communications Inc. 2 + * Copyright (c) 2009-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/btcoex.h
··· 1 1 /* 2 - * Copyright (c) 2009 Atheros Communications Inc. 2 + * Copyright (c) 2009-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/calib.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/calib.h
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/common.c
··· 1 1 /* 2 - * Copyright (c) 2009 Atheros Communications Inc. 2 + * Copyright (c) 2009-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/common.h
··· 1 1 /* 2 - * Copyright (c) 2009 Atheros Communications Inc. 2 + * Copyright (c) 2009-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+9 -1
drivers/net/wireless/ath/ath9k/debug.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above ··· 435 435 conf->channel_type, 436 436 channel_type_str(conf->channel_type)); 437 437 438 + ath9k_ps_wakeup(sc); 438 439 put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_STA_ID0), addr); 439 440 put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_STA_ID1) & 0xffff, addr + 4); 440 441 len += snprintf(buf + len, sizeof(buf) - len, ··· 445 444 len += snprintf(buf + len, sizeof(buf) - len, 446 445 "addrmask: %pM\n", addr); 447 446 tmp = ath9k_hw_getrxfilter(sc->sc_ah); 447 + ath9k_ps_restore(sc); 448 448 len += snprintf(buf + len, sizeof(buf) - len, 449 449 "rfilt: 0x%x", tmp); 450 450 if (tmp & ATH9K_RX_FILTER_UCAST) ··· 727 725 break; 728 726 } 729 727 728 + ath9k_ps_wakeup(sc); 730 729 len += snprintf(buf + len, size - len, 731 730 "curbssid: %pM\n" 732 731 "OP-Mode: %s(%i)\n" ··· 737 734 REG_READ(ah, AR_BEACON_PERIOD)); 738 735 739 736 reg = REG_READ(ah, AR_TIMER_MODE); 737 + ath9k_ps_restore(sc); 740 738 len += snprintf(buf + len, size - len, "Timer-Mode-Register: 0x%x (", 741 739 reg); 742 740 if (reg & AR_TBTT_TIMER_EN) ··· 1054 1050 unsigned int len; 1055 1051 u32 regval; 1056 1052 1053 + ath9k_ps_wakeup(sc); 1057 1054 regval = REG_READ_D(ah, sc->debug.regidx); 1055 + ath9k_ps_restore(sc); 1058 1056 len = sprintf(buf, "0x%08x\n", regval); 1059 1057 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 1060 1058 } ··· 1078 1072 if (strict_strtoul(buf, 0, &regval)) 1079 1073 return -EINVAL; 1080 1074 1075 + ath9k_ps_wakeup(sc); 1081 1076 REG_WRITE_D(ah, sc->debug.regidx, regval); 1077 + ath9k_ps_restore(sc); 1082 1078 return count; 1083 1079 } 1084 1080
+1 -1
drivers/net/wireless/ath/ath9k/debug.h
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/eeprom.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/eeprom.h
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/eeprom_4k.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/eeprom_9287.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/eeprom_def.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/gpio.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/hif_usb.c
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+2 -2
drivers/net/wireless/ath/ath9k/hif_usb.h
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above ··· 18 18 #define HTC_USB_H 19 19 20 20 #define MAJOR_VERSION_REQ 1 21 - #define MINOR_VERSION_REQ 2 21 + #define MINOR_VERSION_REQ 3 22 22 23 23 #define IS_AR7010_DEVICE(_v) (((_v) == AR9280_USB) || ((_v) == AR9287_USB)) 24 24
+7 -18
drivers/net/wireless/ath/ath9k/htc.h
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above ··· 46 46 extern int htc_modparam_nohwcrypt; 47 47 48 48 enum htc_phymode { 49 - HTC_MODE_AUTO = 0, 50 - HTC_MODE_11A = 1, 51 - HTC_MODE_11B = 2, 52 - HTC_MODE_11G = 3, 53 - HTC_MODE_FH = 4, 54 - HTC_MODE_TURBO_A = 5, 55 - HTC_MODE_TURBO_G = 6, 56 - HTC_MODE_11NA = 7, 57 - HTC_MODE_11NG = 8 49 + HTC_MODE_11NA = 0, 50 + HTC_MODE_11NG = 1 58 51 }; 59 52 60 53 enum htc_opmode { ··· 116 123 u8 pad; 117 124 } __packed; 118 125 119 - #define ATH_HTC_STA_AUTH 0x0001 120 - #define ATH_HTC_STA_QOS 0x0002 121 - #define ATH_HTC_STA_ERP 0x0004 122 - #define ATH_HTC_STA_HT 0x0008 123 - 124 126 struct ath9k_htc_target_sta { 125 127 u8 macaddr[ETH_ALEN]; 126 128 u8 bssid[ETH_ALEN]; 127 129 u8 sta_index; 128 130 u8 vif_index; 129 131 u8 is_vif_sta; 130 - __be16 flags; /* ATH_HTC_STA_* */ 132 + __be16 flags; 131 133 __be16 htcap; 132 134 __be16 maxampdu; 133 135 u8 pad; ··· 273 285 }; 274 286 275 287 #define ATH9K_HTC_TX_CLEANUP_INTERVAL 50 /* ms */ 276 - #define ATH9K_HTC_TX_TIMEOUT_INTERVAL 2500 /* ms */ 288 + #define ATH9K_HTC_TX_TIMEOUT_INTERVAL 3000 /* ms */ 277 289 #define ATH9K_HTC_TX_RESERVE 10 278 - #define ATH9K_HTC_TX_TIMEOUT_COUNT 20 290 + #define ATH9K_HTC_TX_TIMEOUT_COUNT 40 279 291 #define ATH9K_HTC_TX_THRESHOLD (MAX_TX_BUF_NUM - ATH9K_HTC_TX_RESERVE) 280 292 281 293 #define ATH9K_HTC_OP_TX_QUEUES_STOP BIT(0) ··· 438 450 u8 vif_sta_pos[ATH9K_HTC_MAX_VIF]; 439 451 u8 num_ibss_vif; 440 452 u8 num_sta_vif; 453 + u8 num_sta_assoc_vif; 441 454 u8 num_ap_vif; 442 455 443 456 u16 op_flags;
+1 -1
drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+2 -7
drivers/net/wireless/ath/ath9k/htc_drv_init.c
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above ··· 258 258 */ 259 259 260 260 if (IS_AR7010_DEVICE(drv_info)) 261 - priv->htc->credits = 48; 261 + priv->htc->credits = 45; 262 262 else 263 263 priv->htc->credits = 33; 264 264 ··· 768 768 hw->queues = 4; 769 769 hw->channel_change_time = 5000; 770 770 hw->max_listen_interval = 10; 771 - 772 - if (AR_SREV_9271(priv->ah)) 773 - hw->max_tx_aggregation_subframes = MAX_TX_AMPDU_SUBFRAMES_9271; 774 - else 775 - hw->max_tx_aggregation_subframes = MAX_TX_AMPDU_SUBFRAMES_7010; 776 771 777 772 hw->vif_data_size = sizeof(struct ath9k_htc_vif); 778 773 hw->sta_data_size = sizeof(struct ath9k_htc_sta);
+50 -29
drivers/net/wireless/ath/ath9k/htc_drv_main.c
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above ··· 26 26 { 27 27 enum htc_phymode mode; 28 28 29 - mode = HTC_MODE_AUTO; 29 + mode = -EINVAL; 30 30 31 31 switch (ichan->chanmode) { 32 32 case CHANNEL_G: ··· 44 44 default: 45 45 break; 46 46 } 47 + 48 + WARN_ON(mode < 0); 47 49 48 50 return mode; 49 51 } ··· 502 500 tsta.maxampdu = cpu_to_be16(maxampdu); 503 501 } 504 502 505 - if (sta && sta->ht_cap.ht_supported) 506 - tsta.flags = cpu_to_be16(ATH_HTC_STA_HT); 507 - 508 503 WMI_CMD_BUF(WMI_NODE_CREATE_CMDID, &tsta); 509 504 if (ret) { 510 505 if (sta) ··· 581 582 memset(&tcap, 0, sizeof(struct ath9k_htc_cap_target)); 582 583 583 584 tcap.ampdu_limit = cpu_to_be32(0xffff); 584 - tcap.ampdu_subframes = priv->hw->max_tx_aggregation_subframes; 585 + tcap.ampdu_subframes = 0xff; 585 586 tcap.enable_coex = enable_coex; 586 587 tcap.tx_chainmask = priv->ah->caps.tx_chainmask; 587 588 ··· 1164 1165 1165 1166 ath9k_htc_set_opmode(priv); 1166 1167 1168 + ath9k_htc_set_bssid_mask(priv, vif); 1169 + 1167 1170 /* 1168 1171 * Stop ANI only if there are no associated station interfaces. 1169 1172 */ ··· 1436 1435 return ret; 1437 1436 } 1438 1437 1438 + static void ath9k_htc_set_bssid(struct ath9k_htc_priv *priv) 1439 + { 1440 + struct ath_common *common = ath9k_hw_common(priv->ah); 1441 + 1442 + ath9k_hw_write_associd(priv->ah); 1443 + ath_dbg(common, ATH_DBG_CONFIG, 1444 + "BSSID: %pM aid: 0x%x\n", 1445 + common->curbssid, common->curaid); 1446 + } 1447 + 1448 + static void ath9k_htc_bss_iter(void *data, u8 *mac, struct ieee80211_vif *vif) 1449 + { 1450 + struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data; 1451 + struct ath_common *common = ath9k_hw_common(priv->ah); 1452 + struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; 1453 + 1454 + if ((vif->type == NL80211_IFTYPE_STATION) && bss_conf->assoc) { 1455 + common->curaid = bss_conf->aid; 1456 + memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); 1457 + } 1458 + } 1459 + 1460 + static void ath9k_htc_choose_set_bssid(struct ath9k_htc_priv *priv) 1461 + { 1462 + if (priv->num_sta_assoc_vif == 1) { 1463 + ieee80211_iterate_active_interfaces_atomic(priv->hw, 1464 + ath9k_htc_bss_iter, priv); 1465 + ath9k_htc_set_bssid(priv); 1466 + } 1467 + } 1468 + 1439 1469 static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw, 1440 1470 struct ieee80211_vif *vif, 1441 1471 struct ieee80211_bss_conf *bss_conf, ··· 1475 1443 struct ath9k_htc_priv *priv = hw->priv; 1476 1444 struct ath_hw *ah = priv->ah; 1477 1445 struct ath_common *common = ath9k_hw_common(ah); 1478 - bool set_assoc; 1479 1446 1480 1447 mutex_lock(&priv->mutex); 1481 1448 ath9k_htc_ps_wakeup(priv); 1482 1449 1483 - /* 1484 - * Set the HW AID/BSSID only for the first station interface 1485 - * or in IBSS mode. 1486 - */ 1487 - set_assoc = !!((priv->ah->opmode == NL80211_IFTYPE_ADHOC) || 1488 - ((priv->ah->opmode == NL80211_IFTYPE_STATION) && 1489 - (priv->num_sta_vif == 1))); 1490 - 1491 - 1492 1450 if (changed & BSS_CHANGED_ASSOC) { 1493 - if (set_assoc) { 1494 - ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n", 1495 - bss_conf->assoc); 1451 + ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n", 1452 + bss_conf->assoc); 1496 1453 1497 - common->curaid = bss_conf->assoc ? 1498 - bss_conf->aid : 0; 1454 + bss_conf->assoc ? 1455 + priv->num_sta_assoc_vif++ : priv->num_sta_assoc_vif--; 1499 1456 1500 - if (bss_conf->assoc) 1457 + if (priv->ah->opmode == NL80211_IFTYPE_STATION) { 1458 + if (bss_conf->assoc && (priv->num_sta_assoc_vif == 1)) 1501 1459 ath9k_htc_start_ani(priv); 1502 - else 1460 + else if (priv->num_sta_assoc_vif == 0) 1503 1461 ath9k_htc_stop_ani(priv); 1504 1462 } 1505 1463 } 1506 1464 1507 1465 if (changed & BSS_CHANGED_BSSID) { 1508 - if (set_assoc) { 1466 + if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) { 1467 + common->curaid = bss_conf->aid; 1509 1468 memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); 1510 - ath9k_hw_write_associd(ah); 1511 - 1512 - ath_dbg(common, ATH_DBG_CONFIG, 1513 - "BSSID: %pM aid: 0x%x\n", 1514 - common->curbssid, common->curaid); 1469 + ath9k_htc_set_bssid(priv); 1470 + } else if (priv->ah->opmode == NL80211_IFTYPE_STATION) { 1471 + ath9k_htc_choose_set_bssid(priv); 1515 1472 } 1516 1473 } 1517 1474
+5 -1
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above ··· 875 875 rfilt |= ATH9K_RX_FILTER_CONTROL; 876 876 877 877 if ((ah->opmode == NL80211_IFTYPE_STATION) && 878 + (priv->nvifs <= 1) && 878 879 !(priv->rxfilter & FIF_BCN_PRBRESP_PROMISC)) 879 880 rfilt |= ATH9K_RX_FILTER_MYBEACON; 880 881 else ··· 888 887 889 888 if (priv->rxfilter & FIF_PSPOLL) 890 889 rfilt |= ATH9K_RX_FILTER_PSPOLL; 890 + 891 + if (priv->nvifs > 1) 892 + rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL; 891 893 892 894 return rfilt; 893 895
+1 -1
drivers/net/wireless/ath/ath9k/htc_hst.c
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/htc_hst.h
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/hw-ops.h
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/hw.c
··· 1 1 /* 2 - * Copyright (c) 2008-2010 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/hw.h
··· 1 1 /* 2 - * Copyright (c) 2008-2010 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/init.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/mac.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/mac.h
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+41 -1
drivers/net/wireless/ath/ath9k/main.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above ··· 2332 2332 return false; 2333 2333 } 2334 2334 2335 + int ath9k_tx_last_beacon(struct ieee80211_hw *hw) 2336 + { 2337 + struct ath_softc *sc = hw->priv; 2338 + struct ath_hw *ah = sc->sc_ah; 2339 + struct ieee80211_vif *vif; 2340 + struct ath_vif *avp; 2341 + struct ath_buf *bf; 2342 + struct ath_tx_status ts; 2343 + int status; 2344 + 2345 + vif = sc->beacon.bslot[0]; 2346 + if (!vif) 2347 + return 0; 2348 + 2349 + avp = (void *)vif->drv_priv; 2350 + if (!avp->is_bslot_active) 2351 + return 0; 2352 + 2353 + if (!sc->beacon.tx_processed) { 2354 + tasklet_disable(&sc->bcon_tasklet); 2355 + 2356 + bf = avp->av_bcbuf; 2357 + if (!bf || !bf->bf_mpdu) 2358 + goto skip; 2359 + 2360 + status = ath9k_hw_txprocdesc(ah, bf->bf_desc, &ts); 2361 + if (status == -EINPROGRESS) 2362 + goto skip; 2363 + 2364 + sc->beacon.tx_processed = true; 2365 + sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK); 2366 + 2367 + skip: 2368 + tasklet_enable(&sc->bcon_tasklet); 2369 + } 2370 + 2371 + return sc->beacon.tx_last; 2372 + } 2373 + 2335 2374 struct ieee80211_ops ath9k_ops = { 2336 2375 .tx = ath9k_tx, 2337 2376 .start = ath9k_start, ··· 2395 2356 .set_coverage_class = ath9k_set_coverage_class, 2396 2357 .flush = ath9k_flush, 2397 2358 .tx_frames_pending = ath9k_tx_frames_pending, 2359 + .tx_last_beacon = ath9k_tx_last_beacon, 2398 2360 };
+1 -1
drivers/net/wireless/ath/ath9k/pci.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/phy.h
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/rc.c
··· 1 1 /* 2 2 * Copyright (c) 2004 Video54 Technologies, Inc. 3 - * Copyright (c) 2004-2009 Atheros Communications, Inc. 3 + * Copyright (c) 2004-2011 Atheros Communications, Inc. 4 4 * 5 5 * Permission to use, copy, modify, and/or distribute this software for any 6 6 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/rc.h
··· 1 1 /* 2 2 * Copyright (c) 2004 Sam Leffler, Errno Consulting 3 3 * Copyright (c) 2004 Video54 Technologies, Inc. 4 - * Copyright (c) 2008-2009 Atheros Communications Inc. 4 + * Copyright (c) 2008-2011 Atheros Communications Inc. 5 5 * 6 6 * Permission to use, copy, modify, and/or distribute this software for any 7 7 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/recv.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/reg.h
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/wmi.c
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/wmi.h
··· 1 1 /* 2 - * Copyright (c) 2010 Atheros Communications Inc. 2 + * Copyright (c) 2010-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+1 -1
drivers/net/wireless/ath/ath9k/xmit.c
··· 1 1 /* 2 - * Copyright (c) 2008-2009 Atheros Communications Inc. 2 + * Copyright (c) 2008-2011 Atheros Communications Inc. 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above
+4
drivers/net/wireless/ath/carl9170/carl9170.h
··· 286 286 unsigned int tx_seq_table; 287 287 } fw; 288 288 289 + /* interface configuration combinations */ 290 + struct ieee80211_iface_limit if_comb_limits[1]; 291 + struct ieee80211_iface_combination if_combs[1]; 292 + 289 293 /* reset / stuck frames/queue detection */ 290 294 struct work_struct restart_work; 291 295 struct work_struct ping_work;
+18 -1
drivers/net/wireless/ath/carl9170/fw.c
··· 151 151 const struct carl9170fw_chk_desc *chk_desc; 152 152 const struct carl9170fw_last_desc *last_desc; 153 153 const struct carl9170fw_txsq_desc *txsq_desc; 154 + u16 if_comb_types; 154 155 155 156 last_desc = carl9170_fw_find_desc(ar, LAST_MAGIC, 156 157 sizeof(*last_desc), CARL9170FW_LAST_DESC_CUR_VER); ··· 269 268 if (SUPP(CARL9170FW_WOL)) 270 269 device_set_wakeup_enable(&ar->udev->dev, true); 271 270 271 + if_comb_types = BIT(NL80211_IFTYPE_STATION) | 272 + BIT(NL80211_IFTYPE_P2P_CLIENT); 273 + 272 274 ar->fw.vif_num = otus_desc->vif_num; 273 275 ar->fw.cmd_bufs = otus_desc->cmd_bufs; 274 276 ar->fw.address = le32_to_cpu(otus_desc->fw_address); ··· 298 294 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); 299 295 300 296 if (SUPP(CARL9170FW_WLANTX_CAB)) { 301 - ar->hw->wiphy->interface_modes |= 297 + if_comb_types |= 302 298 BIT(NL80211_IFTYPE_AP) | 303 299 BIT(NL80211_IFTYPE_P2P_GO); 304 300 } 305 301 } 302 + 303 + ar->if_comb_limits[0].max = ar->fw.vif_num; 304 + ar->if_comb_limits[0].types = if_comb_types; 305 + 306 + ar->if_combs[0].num_different_channels = 1; 307 + ar->if_combs[0].max_interfaces = ar->fw.vif_num; 308 + ar->if_combs[0].limits = ar->if_comb_limits; 309 + ar->if_combs[0].n_limits = ARRAY_SIZE(ar->if_comb_limits); 310 + 311 + ar->hw->wiphy->iface_combinations = ar->if_combs; 312 + ar->hw->wiphy->n_iface_combinations = ARRAY_SIZE(ar->if_combs); 313 + 314 + ar->hw->wiphy->interface_modes |= if_comb_types; 306 315 307 316 txsq_desc = carl9170_fw_find_desc(ar, TXSQ_MAGIC, 308 317 sizeof(*txsq_desc), CARL9170FW_TXSQ_DESC_CUR_VER);
+2 -8
drivers/net/wireless/ath/carl9170/main.c
··· 1570 1570 INIT_LIST_HEAD(&ar->vif_list); 1571 1571 init_completion(&ar->tx_flush); 1572 1572 1573 - /* 1574 - * Note: 1575 - * IBSS/ADHOC and AP mode are only enabled, if the firmware 1576 - * supports these modes. The code which will add the 1577 - * additional interface_modes is in fw.c. 1578 - */ 1579 - hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | 1580 - BIT(NL80211_IFTYPE_P2P_CLIENT); 1573 + /* firmware decides which modes we support */ 1574 + hw->wiphy->interface_modes = 0; 1581 1575 1582 1576 hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS | 1583 1577 IEEE80211_HW_REPORTS_TX_ACK_STATUS |
+4 -6
drivers/net/wireless/ath/hw.c
··· 43 43 * set of ~ ( MAC XOR BSSID ) for all bssids we handle. 44 44 * 45 45 * When you do this you are essentially computing the common bits of all your 46 - * BSSes. Later it is assumed the harware will "and" (&) the BSSID mask with 46 + * BSSes. Later it is assumed the hardware will "and" (&) the BSSID mask with 47 47 * the MAC address to obtain the relevant bits and compare the result with 48 48 * (frame's BSSID & mask) to see if they match. 49 49 * ··· 71 71 * On loop iteration for BSSID-02: 72 72 * bssid_mask &= ~(0001 ^ 1001) 73 73 * bssid_mask = (1010) & ~(0001 ^ 1001) 74 - * bssid_mask = (1010) & ~(1001) 75 - * bssid_mask = (1010) & (0110) 74 + * bssid_mask = (1010) & ~(1000) 75 + * bssid_mask = (1010) & (0111) 76 76 * bssid_mask = 0010 77 77 * 78 78 * A bssid_mask of 0010 means "only pay attention to the second least ··· 102 102 * 103 103 * IFRAME-02: 0001 (we should allow) 104 104 * 105 - * allow = (0001 & 1010) == 1010 106 - * 107 105 * allow = (IFRAME-02 & bssid_mask) == (bssid_mask & MAC) ? 1 : 0; 108 106 * --> allow = (0001 & 0010) == (0010 & 0001) ? 1 :0; 109 - * --> allow = (0010) == (0010) 107 + * --> allow = (0000) == (0000) 110 108 * --> allow = 1 111 109 * 112 110 * Other examples:
+19 -5
drivers/net/wireless/b43/b43.h
··· 567 567 struct b43_dmaring *tx_ring_mcast; /* Multicast */ 568 568 569 569 struct b43_dmaring *rx_ring; 570 + 571 + u32 translation; /* Routing bits */ 570 572 }; 571 573 572 574 struct b43_pio_txqueue; ··· 707 705 708 706 /* Data structure for one wireless device (802.11 core) */ 709 707 struct b43_wldev { 710 - struct ssb_device *dev; 708 + struct ssb_device *sdev; 711 709 struct b43_wl *wl; 712 710 713 711 /* The device initialization status. ··· 881 879 882 880 static inline u16 b43_read16(struct b43_wldev *dev, u16 offset) 883 881 { 884 - return ssb_read16(dev->dev, offset); 882 + return ssb_read16(dev->sdev, offset); 885 883 } 886 884 887 885 static inline void b43_write16(struct b43_wldev *dev, u16 offset, u16 value) 888 886 { 889 - ssb_write16(dev->dev, offset, value); 887 + ssb_write16(dev->sdev, offset, value); 890 888 } 891 889 892 890 static inline u32 b43_read32(struct b43_wldev *dev, u16 offset) 893 891 { 894 - return ssb_read32(dev->dev, offset); 892 + return ssb_read32(dev->sdev, offset); 895 893 } 896 894 897 895 static inline void b43_write32(struct b43_wldev *dev, u16 offset, u32 value) 898 896 { 899 - ssb_write32(dev->dev, offset, value); 897 + ssb_write32(dev->sdev, offset, value); 898 + } 899 + 900 + static inline void b43_block_read(struct b43_wldev *dev, void *buffer, 901 + size_t count, u16 offset, u8 reg_width) 902 + { 903 + ssb_block_read(dev->sdev, buffer, count, offset, reg_width); 904 + } 905 + 906 + static inline void b43_block_write(struct b43_wldev *dev, const void *buffer, 907 + size_t count, u16 offset, u8 reg_width) 908 + { 909 + ssb_block_write(dev->sdev, buffer, count, offset, reg_width); 900 910 } 901 911 902 912 static inline bool b43_using_pio_transfers(struct b43_wldev *dev)
+19 -18
drivers/net/wireless/b43/dma.c
··· 80 80 addr = (u32) (dmaaddr & ~SSB_DMA_TRANSLATION_MASK); 81 81 addrext = (u32) (dmaaddr & SSB_DMA_TRANSLATION_MASK) 82 82 >> SSB_DMA_TRANSLATION_SHIFT; 83 - addr |= ssb_dma_translation(ring->dev->dev); 83 + addr |= ring->dev->dma.translation; 84 84 ctl = bufsize & B43_DMA32_DCTL_BYTECNT; 85 85 if (slot == ring->nr_slots - 1) 86 86 ctl |= B43_DMA32_DCTL_DTABLEEND; ··· 174 174 addrhi = (((u64) dmaaddr >> 32) & ~SSB_DMA_TRANSLATION_MASK); 175 175 addrext = (((u64) dmaaddr >> 32) & SSB_DMA_TRANSLATION_MASK) 176 176 >> SSB_DMA_TRANSLATION_SHIFT; 177 - addrhi |= (ssb_dma_translation(ring->dev->dev) << 1); 177 + addrhi |= (ring->dev->dma.translation << 1); 178 178 if (slot == ring->nr_slots - 1) 179 179 ctl0 |= B43_DMA64_DCTL0_DTABLEEND; 180 180 if (start) ··· 333 333 dma_addr_t dmaaddr; 334 334 335 335 if (tx) { 336 - dmaaddr = dma_map_single(ring->dev->dev->dma_dev, 336 + dmaaddr = dma_map_single(ring->dev->sdev->dma_dev, 337 337 buf, len, DMA_TO_DEVICE); 338 338 } else { 339 - dmaaddr = dma_map_single(ring->dev->dev->dma_dev, 339 + dmaaddr = dma_map_single(ring->dev->sdev->dma_dev, 340 340 buf, len, DMA_FROM_DEVICE); 341 341 } 342 342 ··· 348 348 dma_addr_t addr, size_t len, int tx) 349 349 { 350 350 if (tx) { 351 - dma_unmap_single(ring->dev->dev->dma_dev, 351 + dma_unmap_single(ring->dev->sdev->dma_dev, 352 352 addr, len, DMA_TO_DEVICE); 353 353 } else { 354 - dma_unmap_single(ring->dev->dev->dma_dev, 354 + dma_unmap_single(ring->dev->sdev->dma_dev, 355 355 addr, len, DMA_FROM_DEVICE); 356 356 } 357 357 } ··· 361 361 dma_addr_t addr, size_t len) 362 362 { 363 363 B43_WARN_ON(ring->tx); 364 - dma_sync_single_for_cpu(ring->dev->dev->dma_dev, 364 + dma_sync_single_for_cpu(ring->dev->sdev->dma_dev, 365 365 addr, len, DMA_FROM_DEVICE); 366 366 } 367 367 ··· 370 370 dma_addr_t addr, size_t len) 371 371 { 372 372 B43_WARN_ON(ring->tx); 373 - dma_sync_single_for_device(ring->dev->dev->dma_dev, 373 + dma_sync_single_for_device(ring->dev->sdev->dma_dev, 374 374 addr, len, DMA_FROM_DEVICE); 375 375 } 376 376 ··· 401 401 */ 402 402 if (ring->type == B43_DMA_64BIT) 403 403 flags |= GFP_DMA; 404 - ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev, 404 + ring->descbase = dma_alloc_coherent(ring->dev->sdev->dma_dev, 405 405 B43_DMA_RINGMEMSIZE, 406 406 &(ring->dmabase), flags); 407 407 if (!ring->descbase) { ··· 415 415 416 416 static void free_ringmemory(struct b43_dmaring *ring) 417 417 { 418 - dma_free_coherent(ring->dev->dev->dma_dev, B43_DMA_RINGMEMSIZE, 418 + dma_free_coherent(ring->dev->sdev->dma_dev, B43_DMA_RINGMEMSIZE, 419 419 ring->descbase, ring->dmabase); 420 420 } 421 421 ··· 523 523 dma_addr_t addr, 524 524 size_t buffersize, bool dma_to_device) 525 525 { 526 - if (unlikely(dma_mapping_error(ring->dev->dev->dma_dev, addr))) 526 + if (unlikely(dma_mapping_error(ring->dev->sdev->dma_dev, addr))) 527 527 return 1; 528 528 529 529 switch (ring->type) { ··· 658 658 int err = 0; 659 659 u32 value; 660 660 u32 addrext; 661 - u32 trans = ssb_dma_translation(ring->dev->dev); 661 + u32 trans = ring->dev->dma.translation; 662 662 663 663 if (ring->tx) { 664 664 if (ring->type == B43_DMA_64BIT) { ··· 869 869 goto err_kfree_meta; 870 870 871 871 /* test for ability to dma to txhdr_cache */ 872 - dma_test = dma_map_single(dev->dev->dma_dev, 872 + dma_test = dma_map_single(dev->sdev->dma_dev, 873 873 ring->txhdr_cache, 874 874 b43_txhdr_size(dev), 875 875 DMA_TO_DEVICE); ··· 884 884 if (!ring->txhdr_cache) 885 885 goto err_kfree_meta; 886 886 887 - dma_test = dma_map_single(dev->dev->dma_dev, 887 + dma_test = dma_map_single(dev->sdev->dma_dev, 888 888 ring->txhdr_cache, 889 889 b43_txhdr_size(dev), 890 890 DMA_TO_DEVICE); ··· 898 898 } 899 899 } 900 900 901 - dma_unmap_single(dev->dev->dma_dev, 901 + dma_unmap_single(dev->sdev->dma_dev, 902 902 dma_test, b43_txhdr_size(dev), 903 903 DMA_TO_DEVICE); 904 904 } ··· 1013 1013 /* Try to set the DMA mask. If it fails, try falling back to a 1014 1014 * lower mask, as we can always also support a lower one. */ 1015 1015 while (1) { 1016 - err = dma_set_mask(dev->dev->dma_dev, mask); 1016 + err = dma_set_mask(dev->sdev->dma_dev, mask); 1017 1017 if (!err) { 1018 - err = dma_set_coherent_mask(dev->dev->dma_dev, mask); 1018 + err = dma_set_coherent_mask(dev->sdev->dma_dev, mask); 1019 1019 if (!err) 1020 1020 break; 1021 1021 } ··· 1055 1055 err = b43_dma_set_mask(dev, dmamask); 1056 1056 if (err) 1057 1057 return err; 1058 + dma->translation = ssb_dma_translation(dev->sdev); 1058 1059 1059 1060 err = -ENOMEM; 1060 1061 /* setup TX DMA channels. */ ··· 1085 1084 goto err_destroy_mcast; 1086 1085 1087 1086 /* No support for the TX status DMA ring. */ 1088 - B43_WARN_ON(dev->dev->id.revision < 5); 1087 + B43_WARN_ON(dev->sdev->id.revision < 5); 1089 1088 1090 1089 b43dbg(dev->wl, "%u-bit DMA initialized\n", 1091 1090 (unsigned int)type);
+2 -2
drivers/net/wireless/b43/leds.c
··· 138 138 led->led_dev.default_trigger = default_trigger; 139 139 led->led_dev.brightness_set = b43_led_brightness_set; 140 140 141 - err = led_classdev_register(dev->dev->dev, &led->led_dev); 141 + err = led_classdev_register(dev->sdev->dev, &led->led_dev); 142 142 if (err) { 143 143 b43warn(dev->wl, "LEDs: Failed to register %s\n", name); 144 144 led->wl = NULL; ··· 215 215 enum b43_led_behaviour *behaviour, 216 216 bool *activelow) 217 217 { 218 - struct ssb_bus *bus = dev->dev->bus; 218 + struct ssb_bus *bus = dev->sdev->bus; 219 219 u8 sprom[4]; 220 220 221 221 sprom[0] = bus->sprom.gpio0;
+2 -2
drivers/net/wireless/b43/lo.c
··· 98 98 rfover |= pga; 99 99 rfover |= lna; 100 100 rfover |= trsw_rx; 101 - if ((dev->dev->bus->sprom.boardflags_lo & B43_BFL_EXTLNA) 101 + if ((dev->sdev->bus->sprom.boardflags_lo & B43_BFL_EXTLNA) 102 102 && phy->rev > 6) 103 103 rfover |= B43_PHY_RFOVERVAL_EXTLNA; 104 104 ··· 387 387 static void lo_measure_setup(struct b43_wldev *dev, 388 388 struct lo_g_saved_values *sav) 389 389 { 390 - struct ssb_sprom *sprom = &dev->dev->bus->sprom; 390 + struct ssb_sprom *sprom = &dev->sdev->bus->sprom; 391 391 struct b43_phy *phy = &dev->phy; 392 392 struct b43_phy_g *gphy = phy->g; 393 393 struct b43_txpower_lo_control *lo = gphy->lo_control;
+100 -94
drivers/net/wireless/b43/main.c
··· 548 548 { 549 549 u32 low, high; 550 550 551 - B43_WARN_ON(dev->dev->id.revision < 3); 551 + B43_WARN_ON(dev->sdev->id.revision < 3); 552 552 553 553 /* The hardware guarantees us an atomic read, if we 554 554 * read the low register first. */ ··· 586 586 { 587 587 u32 low, high; 588 588 589 - B43_WARN_ON(dev->dev->id.revision < 3); 589 + B43_WARN_ON(dev->sdev->id.revision < 3); 590 590 591 591 low = tsf; 592 592 high = (tsf >> 32); ··· 714 714 b43_ram_write(dev, i * 4, buffer[i]); 715 715 716 716 b43_write16(dev, 0x0568, 0x0000); 717 - if (dev->dev->id.revision < 11) 717 + if (dev->sdev->id.revision < 11) 718 718 b43_write16(dev, 0x07C0, 0x0000); 719 719 else 720 720 b43_write16(dev, 0x07C0, 0x0100); ··· 1132 1132 b43_write32(dev, B43_MMIO_MACCTL, macctl); 1133 1133 /* Commit write */ 1134 1134 b43_read32(dev, B43_MMIO_MACCTL); 1135 - if (awake && dev->dev->id.revision >= 5) { 1135 + if (awake && dev->sdev->id.revision >= 5) { 1136 1136 /* Wait for the microcode to wake up. */ 1137 1137 for (i = 0; i < 100; i++) { 1138 1138 ucstat = b43_shm_read16(dev, B43_SHM_SHARED, ··· 1144 1144 } 1145 1145 } 1146 1146 1147 - void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags) 1147 + static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, u32 flags) 1148 1148 { 1149 1149 u32 tmslow; 1150 - u32 macctl; 1151 1150 1152 1151 flags |= B43_TMSLOW_PHYCLKEN; 1153 1152 flags |= B43_TMSLOW_PHYRESET; 1154 1153 if (dev->phy.type == B43_PHYTYPE_N) 1155 1154 flags |= B43_TMSLOW_PHY_BANDWIDTH_20MHZ; /* Make 20 MHz def */ 1156 - ssb_device_enable(dev->dev, flags); 1155 + ssb_device_enable(dev->sdev, flags); 1157 1156 msleep(2); /* Wait for the PLL to turn on. */ 1158 1157 1159 1158 /* Now take the PHY out of Reset again */ 1160 - tmslow = ssb_read32(dev->dev, SSB_TMSLOW); 1159 + tmslow = ssb_read32(dev->sdev, SSB_TMSLOW); 1161 1160 tmslow |= SSB_TMSLOW_FGC; 1162 1161 tmslow &= ~B43_TMSLOW_PHYRESET; 1163 - ssb_write32(dev->dev, SSB_TMSLOW, tmslow); 1164 - ssb_read32(dev->dev, SSB_TMSLOW); /* flush */ 1162 + ssb_write32(dev->sdev, SSB_TMSLOW, tmslow); 1163 + ssb_read32(dev->sdev, SSB_TMSLOW); /* flush */ 1165 1164 msleep(1); 1166 1165 tmslow &= ~SSB_TMSLOW_FGC; 1167 - ssb_write32(dev->dev, SSB_TMSLOW, tmslow); 1168 - ssb_read32(dev->dev, SSB_TMSLOW); /* flush */ 1166 + ssb_write32(dev->sdev, SSB_TMSLOW, tmslow); 1167 + ssb_read32(dev->sdev, SSB_TMSLOW); /* flush */ 1169 1168 msleep(1); 1169 + } 1170 + 1171 + void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags) 1172 + { 1173 + u32 macctl; 1174 + 1175 + b43_ssb_wireless_core_reset(dev, flags); 1170 1176 1171 1177 /* Turn Analog ON, but only if we already know the PHY-type. 1172 1178 * This protects against very early setup where we don't know the ··· 1221 1215 { 1222 1216 u32 dummy; 1223 1217 1224 - if (dev->dev->id.revision < 5) 1218 + if (dev->sdev->id.revision < 5) 1225 1219 return; 1226 1220 /* Read all entries from the microcode TXstatus FIFO 1227 1221 * and throw them away. ··· 1427 1421 1428 1422 /* Get the mask of available antennas. */ 1429 1423 if (dev->phy.gmode) 1430 - antenna_mask = dev->dev->bus->sprom.ant_available_bg; 1424 + antenna_mask = dev->sdev->bus->sprom.ant_available_bg; 1431 1425 else 1432 - antenna_mask = dev->dev->bus->sprom.ant_available_a; 1426 + antenna_mask = dev->sdev->bus->sprom.ant_available_a; 1433 1427 1434 1428 if (!(antenna_mask & (1 << (antenna_nr - 1)))) { 1435 1429 /* This antenna is not available. Fall back to default. */ ··· 1644 1638 mutex_lock(&wl->mutex); 1645 1639 dev = wl->current_dev; 1646 1640 if (likely(dev && (b43_status(dev) >= B43_STAT_INITIALIZED))) { 1647 - if (dev->dev->bus->bustype == SSB_BUSTYPE_SDIO) { 1641 + if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) { 1648 1642 /* wl->mutex is enough. */ 1649 1643 b43_do_beacon_update_trigger_work(dev); 1650 1644 mmiowb(); ··· 1689 1683 static void b43_set_beacon_int(struct b43_wldev *dev, u16 beacon_int) 1690 1684 { 1691 1685 b43_time_lock(dev); 1692 - if (dev->dev->id.revision >= 3) { 1686 + if (dev->sdev->id.revision >= 3) { 1693 1687 b43_write32(dev, B43_MMIO_TSF_CFP_REP, (beacon_int << 16)); 1694 1688 b43_write32(dev, B43_MMIO_TSF_CFP_START, (beacon_int << 10)); 1695 1689 } else { ··· 2063 2057 B43_WARN_ON(1); 2064 2058 return -ENOSYS; 2065 2059 } 2066 - err = request_firmware(&blob, ctx->fwname, ctx->dev->dev->dev); 2060 + err = request_firmware(&blob, ctx->fwname, ctx->dev->sdev->dev); 2067 2061 if (err == -ENOENT) { 2068 2062 snprintf(ctx->errors[ctx->req_type], 2069 2063 sizeof(ctx->errors[ctx->req_type]), ··· 2113 2107 { 2114 2108 struct b43_wldev *dev = ctx->dev; 2115 2109 struct b43_firmware *fw = &ctx->dev->fw; 2116 - const u8 rev = ctx->dev->dev->id.revision; 2110 + const u8 rev = ctx->dev->sdev->id.revision; 2117 2111 const char *filename; 2118 2112 u32 tmshigh; 2119 2113 int err; 2120 2114 2121 2115 /* Get microcode */ 2122 - tmshigh = ssb_read32(dev->dev, SSB_TMSHIGH); 2123 2116 if ((rev >= 5) && (rev <= 10)) 2124 2117 filename = "ucode5"; 2125 2118 else if ((rev >= 11) && (rev <= 12)) ··· 2157 2152 switch (dev->phy.type) { 2158 2153 case B43_PHYTYPE_A: 2159 2154 if ((rev >= 5) && (rev <= 10)) { 2155 + tmshigh = ssb_read32(dev->sdev, SSB_TMSHIGH); 2160 2156 if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY) 2161 2157 filename = "a0g1initvals5"; 2162 2158 else ··· 2202 2196 switch (dev->phy.type) { 2203 2197 case B43_PHYTYPE_A: 2204 2198 if ((rev >= 5) && (rev <= 10)) { 2199 + tmshigh = ssb_read32(dev->sdev, SSB_TMSHIGH); 2205 2200 if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY) 2206 2201 filename = "a0g1bsinitvals5"; 2207 2202 else ··· 2448 2441 2449 2442 snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), "%u.%u", 2450 2443 dev->fw.rev, dev->fw.patch); 2451 - wiphy->hw_version = dev->dev->id.coreid; 2444 + wiphy->hw_version = dev->sdev->id.coreid; 2452 2445 2453 2446 if (b43_is_old_txhdr_format(dev)) { 2454 2447 /* We're over the deadline, but we keep support for old fw ··· 2564 2557 /* Initialize the GPIOs 2565 2558 * http://bcm-specs.sipsolutions.net/GPIO 2566 2559 */ 2560 + static struct ssb_device *b43_ssb_gpio_dev(struct b43_wldev *dev) 2561 + { 2562 + struct ssb_bus *bus = dev->sdev->bus; 2563 + 2564 + #ifdef CONFIG_SSB_DRIVER_PCICORE 2565 + return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev); 2566 + #else 2567 + return bus->chipco.dev; 2568 + #endif 2569 + } 2570 + 2567 2571 static int b43_gpio_init(struct b43_wldev *dev) 2568 2572 { 2569 - struct ssb_bus *bus = dev->dev->bus; 2570 - struct ssb_device *gpiodev, *pcidev = NULL; 2573 + struct ssb_device *gpiodev; 2571 2574 u32 mask, set; 2572 2575 2573 2576 b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) ··· 2588 2571 2589 2572 mask = 0x0000001F; 2590 2573 set = 0x0000000F; 2591 - if (dev->dev->bus->chip_id == 0x4301) { 2574 + if (dev->sdev->bus->chip_id == 0x4301) { 2592 2575 mask |= 0x0060; 2593 2576 set |= 0x0060; 2594 2577 } ··· 2599 2582 mask |= 0x0180; 2600 2583 set |= 0x0180; 2601 2584 } 2602 - if (dev->dev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) { 2585 + if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) { 2603 2586 b43_write16(dev, B43_MMIO_GPIO_MASK, 2604 2587 b43_read16(dev, B43_MMIO_GPIO_MASK) 2605 2588 | 0x0200); 2606 2589 mask |= 0x0200; 2607 2590 set |= 0x0200; 2608 2591 } 2609 - if (dev->dev->id.revision >= 2) 2592 + if (dev->sdev->id.revision >= 2) 2610 2593 mask |= 0x0010; /* FIXME: This is redundant. */ 2611 2594 2612 - #ifdef CONFIG_SSB_DRIVER_PCICORE 2613 - pcidev = bus->pcicore.dev; 2614 - #endif 2615 - gpiodev = bus->chipco.dev ? : pcidev; 2616 - if (!gpiodev) 2617 - return 0; 2618 - ssb_write32(gpiodev, B43_GPIO_CONTROL, 2619 - (ssb_read32(gpiodev, B43_GPIO_CONTROL) 2620 - & mask) | set); 2595 + gpiodev = b43_ssb_gpio_dev(dev); 2596 + if (gpiodev) 2597 + ssb_write32(gpiodev, B43_GPIO_CONTROL, 2598 + (ssb_read32(gpiodev, B43_GPIO_CONTROL) 2599 + & mask) | set); 2621 2600 2622 2601 return 0; 2623 2602 } ··· 2621 2608 /* Turn off all GPIO stuff. Call this on module unload, for example. */ 2622 2609 static void b43_gpio_cleanup(struct b43_wldev *dev) 2623 2610 { 2624 - struct ssb_bus *bus = dev->dev->bus; 2625 - struct ssb_device *gpiodev, *pcidev = NULL; 2611 + struct ssb_device *gpiodev; 2626 2612 2627 - #ifdef CONFIG_SSB_DRIVER_PCICORE 2628 - pcidev = bus->pcicore.dev; 2629 - #endif 2630 - gpiodev = bus->chipco.dev ? : pcidev; 2631 - if (!gpiodev) 2632 - return; 2633 - ssb_write32(gpiodev, B43_GPIO_CONTROL, 0); 2613 + gpiodev = b43_ssb_gpio_dev(dev); 2614 + if (gpiodev) 2615 + ssb_write32(gpiodev, B43_GPIO_CONTROL, 0); 2634 2616 } 2635 2617 2636 2618 /* http://bcm-specs.sipsolutions.net/EnableMac */ ··· 2697 2689 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/MacPhyClkSet */ 2698 2690 void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on) 2699 2691 { 2700 - u32 tmslow = ssb_read32(dev->dev, SSB_TMSLOW); 2692 + u32 tmslow = ssb_read32(dev->sdev, SSB_TMSLOW); 2701 2693 if (on) 2702 2694 tmslow |= B43_TMSLOW_MACPHYCLKEN; 2703 2695 else 2704 2696 tmslow &= ~B43_TMSLOW_MACPHYCLKEN; 2705 - ssb_write32(dev->dev, SSB_TMSLOW, tmslow); 2697 + ssb_write32(dev->sdev, SSB_TMSLOW, tmslow); 2706 2698 } 2707 2699 2708 2700 static void b43_adjust_opmode(struct b43_wldev *dev) ··· 2741 2733 /* Workaround: On old hardware the HW-MAC-address-filter 2742 2734 * doesn't work properly, so always run promisc in filter 2743 2735 * it in software. */ 2744 - if (dev->dev->id.revision <= 4) 2736 + if (dev->sdev->id.revision <= 4) 2745 2737 ctl |= B43_MACCTL_PROMISC; 2746 2738 2747 2739 b43_write32(dev, B43_MMIO_MACCTL, ctl); 2748 2740 2749 2741 cfp_pretbtt = 2; 2750 2742 if ((ctl & B43_MACCTL_INFRA) && !(ctl & B43_MACCTL_AP)) { 2751 - if (dev->dev->bus->chip_id == 0x4306 && 2752 - dev->dev->bus->chip_rev == 3) 2743 + if (dev->sdev->bus->chip_id == 0x4306 && 2744 + dev->sdev->bus->chip_rev == 3) 2753 2745 cfp_pretbtt = 100; 2754 2746 else 2755 2747 cfp_pretbtt = 50; ··· 2907 2899 b43_write16(dev, 0x005E, value16); 2908 2900 } 2909 2901 b43_write32(dev, 0x0100, 0x01000000); 2910 - if (dev->dev->id.revision < 5) 2902 + if (dev->sdev->id.revision < 5) 2911 2903 b43_write32(dev, 0x010C, 0x01000000); 2912 2904 2913 2905 b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) ··· 2922 2914 /* Initially set the wireless operation mode. */ 2923 2915 b43_adjust_opmode(dev); 2924 2916 2925 - if (dev->dev->id.revision < 3) { 2917 + if (dev->sdev->id.revision < 3) { 2926 2918 b43_write16(dev, 0x060E, 0x0000); 2927 2919 b43_write16(dev, 0x0610, 0x8000); 2928 2920 b43_write16(dev, 0x0604, 0x0000); ··· 2942 2934 b43_mac_phy_clock_set(dev, true); 2943 2935 2944 2936 b43_write16(dev, B43_MMIO_POWERUP_DELAY, 2945 - dev->dev->bus->chipco.fast_pwrup_delay); 2937 + dev->sdev->bus->chipco.fast_pwrup_delay); 2946 2938 2947 2939 err = 0; 2948 2940 b43dbg(dev->wl, "Chip initialized\n"); ··· 3105 3097 b43_shm_write32(dev, B43_SHM_SHARED, 0, backup0); 3106 3098 b43_shm_write32(dev, B43_SHM_SHARED, 4, backup4); 3107 3099 3108 - if ((dev->dev->id.revision >= 3) && (dev->dev->id.revision <= 10)) { 3100 + if ((dev->sdev->id.revision >= 3) && (dev->sdev->id.revision <= 10)) { 3109 3101 /* The 32bit register shadows the two 16bit registers 3110 3102 * with update sideeffects. Validate this. */ 3111 3103 b43_write16(dev, B43_MMIO_TSF_CFP_START, 0xAAAA); ··· 3458 3450 3459 3451 static void b43_put_phy_into_reset(struct b43_wldev *dev) 3460 3452 { 3461 - struct ssb_device *sdev = dev->dev; 3453 + struct ssb_device *sdev = dev->sdev; 3462 3454 u32 tmslow; 3463 3455 3464 3456 tmslow = ssb_read32(sdev, SSB_TMSLOW); ··· 3954 3946 3955 3947 /* Disable interrupts on the device. */ 3956 3948 b43_set_status(dev, B43_STAT_INITIALIZED); 3957 - if (dev->dev->bus->bustype == SSB_BUSTYPE_SDIO) { 3949 + if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) { 3958 3950 /* wl->mutex is locked. That is enough. */ 3959 3951 b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, 0); 3960 3952 b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* Flush */ ··· 3967 3959 /* Synchronize and free the interrupt handlers. Unlock to avoid deadlocks. */ 3968 3960 orig_dev = dev; 3969 3961 mutex_unlock(&wl->mutex); 3970 - if (dev->dev->bus->bustype == SSB_BUSTYPE_SDIO) { 3962 + if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) { 3971 3963 b43_sdio_free_irq(dev); 3972 3964 } else { 3973 - synchronize_irq(dev->dev->irq); 3974 - free_irq(dev->dev->irq, dev); 3965 + synchronize_irq(dev->sdev->irq); 3966 + free_irq(dev->sdev->irq, dev); 3975 3967 } 3976 3968 mutex_lock(&wl->mutex); 3977 3969 dev = wl->current_dev; ··· 4004 3996 B43_WARN_ON(b43_status(dev) != B43_STAT_INITIALIZED); 4005 3997 4006 3998 drain_txstatus_queue(dev); 4007 - if (dev->dev->bus->bustype == SSB_BUSTYPE_SDIO) { 3999 + if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) { 4008 4000 err = b43_sdio_request_irq(dev, b43_sdio_interrupt_handler); 4009 4001 if (err) { 4010 4002 b43err(dev->wl, "Cannot request SDIO IRQ\n"); 4011 4003 goto out; 4012 4004 } 4013 4005 } else { 4014 - err = request_threaded_irq(dev->dev->irq, b43_interrupt_handler, 4006 + err = request_threaded_irq(dev->sdev->irq, b43_interrupt_handler, 4015 4007 b43_interrupt_thread_handler, 4016 4008 IRQF_SHARED, KBUILD_MODNAME, dev); 4017 4009 if (err) { 4018 - b43err(dev->wl, "Cannot request IRQ-%d\n", dev->dev->irq); 4010 + b43err(dev->wl, "Cannot request IRQ-%d\n", 4011 + dev->sdev->irq); 4019 4012 goto out; 4020 4013 } 4021 4014 } ··· 4096 4087 analog_type, phy_type, phy_rev); 4097 4088 4098 4089 /* Get RADIO versioning */ 4099 - if (dev->dev->bus->chip_id == 0x4317) { 4100 - if (dev->dev->bus->chip_rev == 0) 4090 + if (dev->sdev->bus->chip_id == 0x4317) { 4091 + if (dev->sdev->bus->chip_rev == 0) 4101 4092 tmp = 0x3205017F; 4102 - else if (dev->dev->bus->chip_rev == 1) 4093 + else if (dev->sdev->bus->chip_rev == 1) 4103 4094 tmp = 0x4205017F; 4104 4095 else 4105 4096 tmp = 0x5205017F; ··· 4204 4195 4205 4196 static void b43_bluetooth_coext_enable(struct b43_wldev *dev) 4206 4197 { 4207 - struct ssb_sprom *sprom = &dev->dev->bus->sprom; 4198 + struct ssb_sprom *sprom = &dev->sdev->bus->sprom; 4208 4199 u64 hf; 4209 4200 4210 4201 if (!modparam_btcoex) ··· 4231 4222 4232 4223 static void b43_imcfglo_timeouts_workaround(struct b43_wldev *dev) 4233 4224 { 4234 - struct ssb_bus *bus = dev->dev->bus; 4225 + struct ssb_bus *bus = dev->sdev->bus; 4235 4226 u32 tmp; 4236 4227 4237 4228 if ((bus->chip_id == 0x4311 && bus->chip_rev == 2) || 4238 4229 (bus->chip_id == 0x4312)) { 4239 - tmp = ssb_read32(dev->dev, SSB_IMCFGLO); 4230 + tmp = ssb_read32(dev->sdev, SSB_IMCFGLO); 4240 4231 tmp &= ~SSB_IMCFGLO_REQTO; 4241 4232 tmp &= ~SSB_IMCFGLO_SERTO; 4242 4233 tmp |= 0x3; 4243 - ssb_write32(dev->dev, SSB_IMCFGLO, tmp); 4234 + ssb_write32(dev->sdev, SSB_IMCFGLO, tmp); 4244 4235 ssb_commit_settings(bus); 4245 4236 } 4246 4237 } ··· 4310 4301 dev->wl->current_beacon = NULL; 4311 4302 } 4312 4303 4313 - ssb_device_disable(dev->dev, 0); 4314 - ssb_bus_may_powerdown(dev->dev->bus); 4304 + ssb_device_disable(dev->sdev, 0); 4305 + ssb_bus_may_powerdown(dev->sdev->bus); 4315 4306 } 4316 4307 4317 4308 /* Initialize a wireless core */ 4318 4309 static int b43_wireless_core_init(struct b43_wldev *dev) 4319 4310 { 4320 - struct ssb_bus *bus = dev->dev->bus; 4311 + struct ssb_bus *bus = dev->sdev->bus; 4321 4312 struct ssb_sprom *sprom = &bus->sprom; 4322 4313 struct b43_phy *phy = &dev->phy; 4323 4314 int err; ··· 4329 4320 err = ssb_bus_powerup(bus, 0); 4330 4321 if (err) 4331 4322 goto out; 4332 - if (!ssb_device_is_enabled(dev->dev)) { 4323 + if (!ssb_device_is_enabled(dev->sdev)) { 4333 4324 tmp = phy->gmode ? B43_TMSLOW_GMODE : 0; 4334 4325 b43_wireless_core_reset(dev, tmp); 4335 4326 } ··· 4339 4330 phy->ops->prepare_structs(dev); 4340 4331 4341 4332 /* Enable IRQ routing to this device. */ 4342 - ssb_pcicore_dev_irqvecs_enable(&bus->pcicore, dev->dev); 4333 + ssb_pcicore_dev_irqvecs_enable(&bus->pcicore, dev->sdev); 4343 4334 4344 4335 b43_imcfglo_timeouts_workaround(dev); 4345 4336 b43_bluetooth_coext_disable(dev); ··· 4352 4343 if (err) 4353 4344 goto err_busdown; 4354 4345 b43_shm_write16(dev, B43_SHM_SHARED, 4355 - B43_SHM_SH_WLCOREREV, dev->dev->id.revision); 4346 + B43_SHM_SH_WLCOREREV, dev->sdev->id.revision); 4356 4347 hf = b43_hf_read(dev); 4357 4348 if (phy->type == B43_PHYTYPE_G) { 4358 4349 hf |= B43_HF_SYMW; ··· 4399 4390 /* Maximum Contention Window */ 4400 4391 b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_MAXCONT, 0x3FF); 4401 4392 4402 - if ((dev->dev->bus->bustype == SSB_BUSTYPE_PCMCIA) || 4403 - (dev->dev->bus->bustype == SSB_BUSTYPE_SDIO) || 4393 + if ((dev->sdev->bus->bustype == SSB_BUSTYPE_PCMCIA) || 4394 + (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) || 4404 4395 dev->use_pio) { 4405 4396 dev->__using_pio_transfers = 1; 4406 4397 err = b43_pio_init(dev); ··· 4737 4728 static int b43_wireless_core_attach(struct b43_wldev *dev) 4738 4729 { 4739 4730 struct b43_wl *wl = dev->wl; 4740 - struct ssb_bus *bus = dev->dev->bus; 4731 + struct ssb_bus *bus = dev->sdev->bus; 4741 4732 struct pci_dev *pdev = (bus->bustype == SSB_BUSTYPE_PCI) ? bus->host_pci : NULL; 4742 4733 int err; 4743 4734 bool have_2ghz_phy = 0, have_5ghz_phy = 0; ··· 4756 4747 goto out; 4757 4748 } 4758 4749 /* Get the PHY type. */ 4759 - if (dev->dev->id.revision >= 5) { 4750 + if (dev->sdev->id.revision >= 5) { 4760 4751 u32 tmshigh; 4761 4752 4762 - tmshigh = ssb_read32(dev->dev, SSB_TMSHIGH); 4753 + tmshigh = ssb_read32(dev->sdev, SSB_TMSHIGH); 4763 4754 have_2ghz_phy = !!(tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY); 4764 4755 have_5ghz_phy = !!(tmshigh & B43_TMSHIGH_HAVE_5GHZ_PHY); 4765 4756 } else ··· 4832 4823 INIT_WORK(&dev->restart_work, b43_chip_reset); 4833 4824 4834 4825 dev->phy.ops->switch_analog(dev, 0); 4835 - ssb_device_disable(dev->dev, 0); 4826 + ssb_device_disable(dev->sdev, 0); 4836 4827 ssb_bus_may_powerdown(bus); 4837 4828 4838 4829 out: ··· 4873 4864 goto out; 4874 4865 4875 4866 wldev->use_pio = b43_modparam_pio; 4876 - wldev->dev = dev; 4867 + wldev->sdev = dev; 4877 4868 wldev->wl = wl; 4878 4869 b43_set_status(wldev, B43_STAT_UNINIT); 4879 4870 wldev->bad_frames_preempt = modparam_bad_frames_preempt; ··· 4934 4925 ieee80211_free_hw(hw); 4935 4926 } 4936 4927 4937 - static int b43_wireless_init(struct ssb_device *dev) 4928 + static struct b43_wl *b43_wireless_init(struct ssb_device *dev) 4938 4929 { 4939 4930 struct ssb_sprom *sprom = &dev->bus->sprom; 4940 4931 struct ieee80211_hw *hw; 4941 4932 struct b43_wl *wl; 4942 - int err = -ENOMEM; 4943 - 4944 - b43_sprom_fixup(dev->bus); 4945 4933 4946 4934 hw = ieee80211_alloc_hw(sizeof(*wl), &b43_hw_ops); 4947 4935 if (!hw) { 4948 4936 b43err(NULL, "Could not allocate ieee80211 device\n"); 4949 - goto out; 4937 + return ERR_PTR(-ENOMEM); 4950 4938 } 4951 4939 wl = hw_to_b43_wl(hw); 4952 4940 ··· 4977 4971 INIT_WORK(&wl->tx_work, b43_tx_work); 4978 4972 skb_queue_head_init(&wl->tx_queue); 4979 4973 4980 - ssb_set_devtypedata(dev, wl); 4981 4974 b43info(wl, "Broadcom %04X WLAN found (core revision %u)\n", 4982 4975 dev->bus->chip_id, dev->id.revision); 4983 - err = 0; 4984 - out: 4985 - return err; 4976 + return wl; 4986 4977 } 4987 4978 4988 4979 static int b43_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id) ··· 4992 4989 if (!wl) { 4993 4990 /* Probing the first core. Must setup common struct b43_wl */ 4994 4991 first = 1; 4995 - err = b43_wireless_init(dev); 4996 - if (err) 4992 + b43_sprom_fixup(dev->bus); 4993 + wl = b43_wireless_init(dev); 4994 + if (IS_ERR(wl)) { 4995 + err = PTR_ERR(wl); 4997 4996 goto out; 4998 - wl = ssb_get_devtypedata(dev); 4999 - B43_WARN_ON(!wl); 4997 + } 4998 + ssb_set_devtypedata(dev, wl); 4999 + B43_WARN_ON(ssb_get_devtypedata(dev) != wl); 5000 5000 } 5001 5001 err = b43_one_core_attach(dev, wl); 5002 5002 if (err)
+8 -8
drivers/net/wireless/b43/phy_a.c
··· 265 265 266 266 void b43_phy_inita(struct b43_wldev *dev) 267 267 { 268 - struct ssb_bus *bus = dev->dev->bus; 268 + struct ssb_bus *bus = dev->sdev->bus; 269 269 struct b43_phy *phy = &dev->phy; 270 270 271 271 /* This lowlevel A-PHY init is also called from G-PHY init. ··· 311 311 } 312 312 313 313 if ((phy->type == B43_PHYTYPE_G) && 314 - (dev->dev->bus->sprom.boardflags_lo & B43_BFL_PACTRL)) { 314 + (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL)) { 315 315 b43_phy_maskset(dev, B43_PHY_OFDM(0x6E), 0xE000, 0x3CF); 316 316 } 317 317 } ··· 323 323 struct b43_phy_a *aphy = phy->a; 324 324 s16 pab0, pab1, pab2; 325 325 326 - pab0 = (s16) (dev->dev->bus->sprom.pa1b0); 327 - pab1 = (s16) (dev->dev->bus->sprom.pa1b1); 328 - pab2 = (s16) (dev->dev->bus->sprom.pa1b2); 326 + pab0 = (s16) (dev->sdev->bus->sprom.pa1b0); 327 + pab1 = (s16) (dev->sdev->bus->sprom.pa1b1); 328 + pab2 = (s16) (dev->sdev->bus->sprom.pa1b2); 329 329 330 330 if (pab0 != 0 && pab1 != 0 && pab2 != 0 && 331 331 pab0 != -1 && pab1 != -1 && pab2 != -1) { 332 332 /* The pabX values are set in SPROM. Use them. */ 333 - if ((s8) dev->dev->bus->sprom.itssi_a != 0 && 334 - (s8) dev->dev->bus->sprom.itssi_a != -1) 333 + if ((s8) dev->sdev->bus->sprom.itssi_a != 0 && 334 + (s8) dev->sdev->bus->sprom.itssi_a != -1) 335 335 aphy->tgt_idle_tssi = 336 - (s8) (dev->dev->bus->sprom.itssi_a); 336 + (s8) (dev->sdev->bus->sprom.itssi_a); 337 337 else 338 338 aphy->tgt_idle_tssi = 62; 339 339 aphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0,
+4 -4
drivers/net/wireless/b43/phy_common.c
··· 168 168 B43_WARN_ON(dev->phy.phy_locked); 169 169 dev->phy.phy_locked = 1; 170 170 #endif 171 - B43_WARN_ON(dev->dev->id.revision < 3); 171 + B43_WARN_ON(dev->sdev->id.revision < 3); 172 172 173 173 if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) 174 174 b43_power_saving_ctl_bits(dev, B43_PS_AWAKE); ··· 180 180 B43_WARN_ON(!dev->phy.phy_locked); 181 181 dev->phy.phy_locked = 0; 182 182 #endif 183 - B43_WARN_ON(dev->dev->id.revision < 3); 183 + B43_WARN_ON(dev->sdev->id.revision < 3); 184 184 185 185 if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) 186 186 b43_power_saving_ctl_bits(dev, 0); ··· 368 368 /* The next check will be needed in two seconds, or later. */ 369 369 phy->next_txpwr_check_time = round_jiffies(now + (HZ * 2)); 370 370 371 - if ((dev->dev->bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM) && 372 - (dev->dev->bus->boardinfo.type == SSB_BOARD_BU4306)) 371 + if ((dev->sdev->bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM) && 372 + (dev->sdev->bus->boardinfo.type == SSB_BOARD_BU4306)) 373 373 return; /* No software txpower adjustment needed */ 374 374 375 375 result = phy->ops->recalc_txpower(dev, !!(flags & B43_TXPWR_IGNORE_TSSI));
+24 -24
drivers/net/wireless/b43/phy_g.c
··· 718 718 B43_WARN_ON(phy->type != B43_PHYTYPE_G); 719 719 720 720 if (!phy->gmode || 721 - !(dev->dev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) { 721 + !(dev->sdev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) { 722 722 tmp16 = b43_nrssi_hw_read(dev, 0x20); 723 723 if (tmp16 >= 0x20) 724 724 tmp16 -= 0x40; ··· 1114 1114 { 1115 1115 struct b43_phy *phy = &dev->phy; 1116 1116 struct b43_phy_g *gphy = phy->g; 1117 - struct ssb_sprom *sprom = &(dev->dev->bus->sprom); 1117 + struct ssb_sprom *sprom = &(dev->sdev->bus->sprom); 1118 1118 1119 1119 if (!phy->gmode) 1120 1120 return 0; ··· 1491 1491 1492 1492 static void b43_phy_initb5(struct b43_wldev *dev) 1493 1493 { 1494 - struct ssb_bus *bus = dev->dev->bus; 1494 + struct ssb_bus *bus = dev->sdev->bus; 1495 1495 struct b43_phy *phy = &dev->phy; 1496 1496 struct b43_phy_g *gphy = phy->g; 1497 1497 u16 offset, value; ··· 1620 1620 b43_radio_write16(dev, 0x5A, 0x88); 1621 1621 b43_radio_write16(dev, 0x5B, 0x6B); 1622 1622 b43_radio_write16(dev, 0x5C, 0x0F); 1623 - if (dev->dev->bus->sprom.boardflags_lo & B43_BFL_ALTIQ) { 1623 + if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_ALTIQ) { 1624 1624 b43_radio_write16(dev, 0x5D, 0xFA); 1625 1625 b43_radio_write16(dev, 0x5E, 0xD8); 1626 1626 } else { ··· 1787 1787 b43_phy_set(dev, B43_PHY_RFOVER, 0x0100); 1788 1788 b43_phy_mask(dev, B43_PHY_RFOVERVAL, 0xCFFF); 1789 1789 1790 - if (dev->dev->bus->sprom.boardflags_lo & B43_BFL_EXTLNA) { 1790 + if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_EXTLNA) { 1791 1791 if (phy->rev >= 7) { 1792 1792 b43_phy_set(dev, B43_PHY_RFOVER, 0x0800); 1793 1793 b43_phy_set(dev, B43_PHY_RFOVERVAL, 0x8000); ··· 1922 1922 /* Initialize B/G PHY power control */ 1923 1923 static void b43_phy_init_pctl(struct b43_wldev *dev) 1924 1924 { 1925 - struct ssb_bus *bus = dev->dev->bus; 1925 + struct ssb_bus *bus = dev->sdev->bus; 1926 1926 struct b43_phy *phy = &dev->phy; 1927 1927 struct b43_phy_g *gphy = phy->g; 1928 1928 struct b43_rfatt old_rfatt; ··· 2053 2053 if (phy->rev >= 6) { 2054 2054 b43_phy_maskset(dev, B43_PHY_CCK(0x36), 0x0FFF, (gphy->lo_control->tx_bias << 12)); 2055 2055 } 2056 - if (dev->dev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) 2056 + if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) 2057 2057 b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x8075); 2058 2058 else 2059 2059 b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x807F); ··· 2066 2066 b43_phy_write(dev, B43_PHY_LO_MASK, 0x8078); 2067 2067 } 2068 2068 2069 - if (!(dev->dev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) { 2069 + if (!(dev->sdev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) { 2070 2070 /* The specs state to update the NRSSI LT with 2071 2071 * the value 0x7FFFFFFF here. I think that is some weird 2072 2072 * compiler optimization in the original driver. ··· 2088 2088 /* FIXME: The spec says in the following if, the 0 should be replaced 2089 2089 'if OFDM may not be used in the current locale' 2090 2090 but OFDM is legal everywhere */ 2091 - if ((dev->dev->bus->chip_id == 0x4306 2092 - && dev->dev->bus->chip_package == 2) || 0) { 2091 + if ((dev->sdev->bus->chip_id == 0x4306 2092 + && dev->sdev->bus->chip_package == 2) || 0) { 2093 2093 b43_phy_mask(dev, B43_PHY_CRS0, 0xBFFF); 2094 2094 b43_phy_mask(dev, B43_PHY_OFDM(0xC3), 0x7FFF); 2095 2095 } ··· 2105 2105 b43_write16(dev, B43_MMIO_CHANNEL, channel2freq_bg(channel)); 2106 2106 2107 2107 if (channel == 14) { 2108 - if (dev->dev->bus->sprom.country_code == 2108 + if (dev->sdev->bus->sprom.country_code == 2109 2109 SSB_SPROM1CCODE_JAPAN) 2110 2110 b43_hf_write(dev, 2111 2111 b43_hf_read(dev) & ~B43_HF_ACPR); ··· 2136 2136 static void default_radio_attenuation(struct b43_wldev *dev, 2137 2137 struct b43_rfatt *rf) 2138 2138 { 2139 - struct ssb_bus *bus = dev->dev->bus; 2139 + struct ssb_bus *bus = dev->sdev->bus; 2140 2140 struct b43_phy *phy = &dev->phy; 2141 2141 2142 2142 rf->with_padmix = 0; ··· 2384 2384 struct b43_phy_g *gphy = phy->g; 2385 2385 s16 pab0, pab1, pab2; 2386 2386 2387 - pab0 = (s16) (dev->dev->bus->sprom.pa0b0); 2388 - pab1 = (s16) (dev->dev->bus->sprom.pa0b1); 2389 - pab2 = (s16) (dev->dev->bus->sprom.pa0b2); 2387 + pab0 = (s16) (dev->sdev->bus->sprom.pa0b0); 2388 + pab1 = (s16) (dev->sdev->bus->sprom.pa0b1); 2389 + pab2 = (s16) (dev->sdev->bus->sprom.pa0b2); 2390 2390 2391 - B43_WARN_ON((dev->dev->bus->chip_id == 0x4301) && 2391 + B43_WARN_ON((dev->sdev->bus->chip_id == 0x4301) && 2392 2392 (phy->radio_ver != 0x2050)); /* Not supported anymore */ 2393 2393 2394 2394 gphy->dyn_tssi_tbl = 0; ··· 2396 2396 if (pab0 != 0 && pab1 != 0 && pab2 != 0 && 2397 2397 pab0 != -1 && pab1 != -1 && pab2 != -1) { 2398 2398 /* The pabX values are set in SPROM. Use them. */ 2399 - if ((s8) dev->dev->bus->sprom.itssi_bg != 0 && 2400 - (s8) dev->dev->bus->sprom.itssi_bg != -1) { 2399 + if ((s8) dev->sdev->bus->sprom.itssi_bg != 0 && 2400 + (s8) dev->sdev->bus->sprom.itssi_bg != -1) { 2401 2401 gphy->tgt_idle_tssi = 2402 - (s8) (dev->dev->bus->sprom.itssi_bg); 2402 + (s8) (dev->sdev->bus->sprom.itssi_bg); 2403 2403 } else 2404 2404 gphy->tgt_idle_tssi = 62; 2405 2405 gphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0, ··· 2840 2840 B43_TXCTL_TXMIX; 2841 2841 rfatt += 2; 2842 2842 bbatt += 2; 2843 - } else if (dev->dev->bus->sprom. 2843 + } else if (dev->sdev->bus->sprom. 2844 2844 boardflags_lo & 2845 2845 B43_BFL_PACTRL) { 2846 2846 bbatt += 4 * (rfatt - 2); ··· 2914 2914 estimated_pwr = b43_gphy_estimate_power_out(dev, average_tssi); 2915 2915 2916 2916 B43_WARN_ON(phy->type != B43_PHYTYPE_G); 2917 - max_pwr = dev->dev->bus->sprom.maxpwr_bg; 2918 - if (dev->dev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) 2917 + max_pwr = dev->sdev->bus->sprom.maxpwr_bg; 2918 + if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) 2919 2919 max_pwr -= 3; /* minus 0.75 */ 2920 2920 if (unlikely(max_pwr >= INT_TO_Q52(30/*dBm*/))) { 2921 2921 b43warn(dev->wl, 2922 2922 "Invalid max-TX-power value in SPROM.\n"); 2923 2923 max_pwr = INT_TO_Q52(20); /* fake it */ 2924 - dev->dev->bus->sprom.maxpwr_bg = max_pwr; 2924 + dev->sdev->bus->sprom.maxpwr_bg = max_pwr; 2925 2925 } 2926 2926 2927 2927 /* Get desired power (in Q5.2) */ ··· 3014 3014 { 3015 3015 struct b43_phy *phy = &dev->phy; 3016 3016 3017 - if (!(dev->dev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) 3017 + if (!(dev->sdev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) 3018 3018 return; 3019 3019 3020 3020 b43_mac_suspend(dev);
+11 -11
drivers/net/wireless/b43/phy_lp.c
··· 86 86 static void lpphy_read_band_sprom(struct b43_wldev *dev) 87 87 { 88 88 struct b43_phy_lp *lpphy = dev->phy.lp; 89 - struct ssb_bus *bus = dev->dev->bus; 89 + struct ssb_bus *bus = dev->sdev->bus; 90 90 u16 cckpo, maxpwr; 91 91 u32 ofdmpo; 92 92 int i; ··· 214 214 215 215 static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev) 216 216 { 217 - struct ssb_bus *bus = dev->dev->bus; 217 + struct ssb_bus *bus = dev->sdev->bus; 218 218 struct b43_phy_lp *lpphy = dev->phy.lp; 219 219 u16 tmp, tmp2; 220 220 ··· 412 412 413 413 static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) 414 414 { 415 - struct ssb_bus *bus = dev->dev->bus; 415 + struct ssb_bus *bus = dev->sdev->bus; 416 416 struct b43_phy_lp *lpphy = dev->phy.lp; 417 417 418 418 b43_phy_write(dev, B43_LPPHY_AFE_DAC_CTL, 0x50); ··· 519 519 static void lpphy_2062_init(struct b43_wldev *dev) 520 520 { 521 521 struct b43_phy_lp *lpphy = dev->phy.lp; 522 - struct ssb_bus *bus = dev->dev->bus; 522 + struct ssb_bus *bus = dev->sdev->bus; 523 523 u32 crystalfreq, tmp, ref; 524 524 unsigned int i; 525 525 const struct b2062_freqdata *fd = NULL; ··· 697 697 lpphy_sync_stx(dev); 698 698 b43_phy_write(dev, B43_PHY_OFDM(0xF0), 0x5F80); 699 699 b43_phy_write(dev, B43_PHY_OFDM(0xF1), 0); 700 - if (dev->dev->bus->chip_id == 0x4325) { 700 + if (dev->sdev->bus->chip_id == 0x4325) { 701 701 // TODO SSB PMU recalibration 702 702 } 703 703 } ··· 1289 1289 1290 1290 static void lpphy_rev2plus_rc_calib(struct b43_wldev *dev) 1291 1291 { 1292 - struct ssb_bus *bus = dev->dev->bus; 1292 + struct ssb_bus *bus = dev->sdev->bus; 1293 1293 u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; 1294 1294 u8 tmp = b43_radio_read(dev, B2063_RX_BB_SP8) & 0xFF; 1295 1295 int i; ··· 1840 1840 static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) 1841 1841 { 1842 1842 struct b43_phy_lp *lpphy = dev->phy.lp; 1843 - struct ssb_bus *bus = dev->dev->bus; 1843 + struct ssb_bus *bus = dev->sdev->bus; 1844 1844 struct lpphy_tx_gains gains, oldgains; 1845 1845 int old_txpctl, old_afe_ovr, old_rf, old_bbmult; 1846 1846 ··· 1870 1870 bool rx, bool pa, struct lpphy_tx_gains *gains) 1871 1871 { 1872 1872 struct b43_phy_lp *lpphy = dev->phy.lp; 1873 - struct ssb_bus *bus = dev->dev->bus; 1873 + struct ssb_bus *bus = dev->sdev->bus; 1874 1874 const struct lpphy_rx_iq_comp *iqcomp = NULL; 1875 1875 struct lpphy_tx_gains nogains, oldgains; 1876 1876 u16 tmp; ··· 2408 2408 2409 2409 static void lpphy_b2062_reset_pll_bias(struct b43_wldev *dev) 2410 2410 { 2411 - struct ssb_bus *bus = dev->dev->bus; 2411 + struct ssb_bus *bus = dev->sdev->bus; 2412 2412 2413 2413 b43_radio_write(dev, B2062_S_RFPLL_CTL2, 0xFF); 2414 2414 udelay(20); ··· 2432 2432 unsigned int channel) 2433 2433 { 2434 2434 struct b43_phy_lp *lpphy = dev->phy.lp; 2435 - struct ssb_bus *bus = dev->dev->bus; 2435 + struct ssb_bus *bus = dev->sdev->bus; 2436 2436 const struct b206x_channel *chandata = NULL; 2437 2437 u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; 2438 2438 u32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9; ··· 2522 2522 static int lpphy_b2063_tune(struct b43_wldev *dev, 2523 2523 unsigned int channel) 2524 2524 { 2525 - struct ssb_bus *bus = dev->dev->bus; 2525 + struct ssb_bus *bus = dev->sdev->bus; 2526 2526 2527 2527 static const struct b206x_channel *chandata = NULL; 2528 2528 u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000;
+12 -12
drivers/net/wireless/b43/phy_n.c
··· 299 299 static void b43_nphy_tx_power_fix(struct b43_wldev *dev) 300 300 { 301 301 struct b43_phy_n *nphy = dev->phy.n; 302 - struct ssb_sprom *sprom = &(dev->dev->bus->sprom); 302 + struct ssb_sprom *sprom = &(dev->sdev->bus->sprom); 303 303 304 304 u8 txpi[2], bbmult, i; 305 305 u16 tmp, radio_gain, dac_gain; ··· 423 423 static void b43_radio_init2055_post(struct b43_wldev *dev) 424 424 { 425 425 struct b43_phy_n *nphy = dev->phy.n; 426 - struct ssb_sprom *sprom = &(dev->dev->bus->sprom); 427 - struct ssb_boardinfo *binfo = &(dev->dev->bus->boardinfo); 426 + struct ssb_sprom *sprom = &(dev->sdev->bus->sprom); 427 + struct ssb_boardinfo *binfo = &(dev->sdev->bus->boardinfo); 428 428 int i; 429 429 u16 val; 430 430 bool workaround = false; ··· 609 609 if (dev->phy.type != B43_PHYTYPE_N) 610 610 return; 611 611 612 - tmslow = ssb_read32(dev->dev, SSB_TMSLOW); 612 + tmslow = ssb_read32(dev->sdev, SSB_TMSLOW); 613 613 if (force) 614 614 tmslow |= SSB_TMSLOW_FGC; 615 615 else 616 616 tmslow &= ~SSB_TMSLOW_FGC; 617 - ssb_write32(dev->dev, SSB_TMSLOW, tmslow); 617 + ssb_write32(dev->sdev, SSB_TMSLOW, tmslow); 618 618 } 619 619 620 620 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CCA */ ··· 959 959 b43_phy_write(dev, B43_NPHY_GPIO_LOOEN, 0); 960 960 b43_phy_write(dev, B43_NPHY_GPIO_HIOEN, 0); 961 961 962 - ssb_chipco_gpio_control(&dev->dev->bus->chipco, 0xFC00, 962 + ssb_chipco_gpio_control(&dev->sdev->bus->chipco, 0xFC00, 963 963 0xFC00); 964 964 b43_write32(dev, B43_MMIO_MACCTL, 965 965 b43_read32(dev, B43_MMIO_MACCTL) & ··· 983 983 { 984 984 u16 tmp; 985 985 986 - if (dev->dev->id.revision == 16) 986 + if (dev->sdev->id.revision == 16) 987 987 b43_mac_suspend(dev); 988 988 989 989 tmp = b43_phy_read(dev, B43_NPHY_CLASSCTL); ··· 993 993 tmp |= (val & mask); 994 994 b43_phy_maskset(dev, B43_NPHY_CLASSCTL, 0xFFF8, tmp); 995 995 996 - if (dev->dev->id.revision == 16) 996 + if (dev->sdev->id.revision == 16) 997 997 b43_mac_enable(dev); 998 998 999 999 return tmp; ··· 1168 1168 static void b43_nphy_gain_ctrl_workarounds(struct b43_wldev *dev) 1169 1169 { 1170 1170 struct b43_phy_n *nphy = dev->phy.n; 1171 - struct ssb_sprom *sprom = &(dev->dev->bus->sprom); 1171 + struct ssb_sprom *sprom = &(dev->sdev->bus->sprom); 1172 1172 1173 1173 /* PHY rev 0, 1, 2 */ 1174 1174 u8 i, j; ··· 1373 1373 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Workarounds */ 1374 1374 static void b43_nphy_workarounds(struct b43_wldev *dev) 1375 1375 { 1376 - struct ssb_bus *bus = dev->dev->bus; 1376 + struct ssb_bus *bus = dev->sdev->bus; 1377 1377 struct b43_phy *phy = &dev->phy; 1378 1378 struct b43_phy_n *nphy = phy->n; 1379 1379 ··· 3586 3586 */ 3587 3587 int b43_phy_initn(struct b43_wldev *dev) 3588 3588 { 3589 - struct ssb_bus *bus = dev->dev->bus; 3589 + struct ssb_bus *bus = dev->sdev->bus; 3590 3590 struct b43_phy *phy = &dev->phy; 3591 3591 struct b43_phy_n *nphy = phy->n; 3592 3592 u8 tx_pwr_state; ··· 3601 3601 if ((dev->phy.rev >= 3) && 3602 3602 (bus->sprom.boardflags_lo & B43_BFL_EXTLNA) && 3603 3603 (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)) { 3604 - chipco_set32(&dev->dev->bus->chipco, SSB_CHIPCO_CHIPCTL, 0x40); 3604 + chipco_set32(&dev->sdev->bus->chipco, SSB_CHIPCO_CHIPCTL, 0x40); 3605 3605 } 3606 3606 nphy->deaf_count = 0; 3607 3607 b43_nphy_tables_init(dev);
+15 -15
drivers/net/wireless/b43/pio.c
··· 111 111 B43_MMIO_PIO11_BASE5, 112 112 }; 113 113 114 - if (dev->dev->id.revision >= 11) { 114 + if (dev->sdev->id.revision >= 11) { 115 115 B43_WARN_ON(index >= ARRAY_SIZE(bases_rev11)); 116 116 return bases_rev11[index]; 117 117 } ··· 121 121 122 122 static u16 pio_txqueue_offset(struct b43_wldev *dev) 123 123 { 124 - if (dev->dev->id.revision >= 11) 124 + if (dev->sdev->id.revision >= 11) 125 125 return 0x18; 126 126 return 0; 127 127 } 128 128 129 129 static u16 pio_rxqueue_offset(struct b43_wldev *dev) 130 130 { 131 - if (dev->dev->id.revision >= 11) 131 + if (dev->sdev->id.revision >= 11) 132 132 return 0x38; 133 133 return 8; 134 134 } ··· 144 144 if (!q) 145 145 return NULL; 146 146 q->dev = dev; 147 - q->rev = dev->dev->id.revision; 147 + q->rev = dev->sdev->id.revision; 148 148 q->mmio_base = index_to_pioqueue_base(dev, index) + 149 149 pio_txqueue_offset(dev); 150 150 q->index = index; ··· 178 178 if (!q) 179 179 return NULL; 180 180 q->dev = dev; 181 - q->rev = dev->dev->id.revision; 181 + q->rev = dev->sdev->id.revision; 182 182 q->mmio_base = index_to_pioqueue_base(dev, index) + 183 183 pio_rxqueue_offset(dev); 184 184 ··· 339 339 ctl |= B43_PIO_TXCTL_WRITELO | B43_PIO_TXCTL_WRITEHI; 340 340 b43_piotx_write16(q, B43_PIO_TXCTL, ctl); 341 341 342 - ssb_block_write(dev->dev, data, (data_len & ~1), 342 + b43_block_write(dev, data, (data_len & ~1), 343 343 q->mmio_base + B43_PIO_TXDATA, 344 344 sizeof(u16)); 345 345 if (data_len & 1) { ··· 351 351 b43_piotx_write16(q, B43_PIO_TXCTL, ctl); 352 352 tail[0] = data[data_len - 1]; 353 353 tail[1] = 0; 354 - ssb_block_write(dev->dev, tail, 2, 354 + b43_block_write(dev, tail, 2, 355 355 q->mmio_base + B43_PIO_TXDATA, 356 356 sizeof(u16)); 357 357 } ··· 393 393 B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_24_31; 394 394 b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); 395 395 396 - ssb_block_write(dev->dev, data, (data_len & ~3), 396 + b43_block_write(dev, data, (data_len & ~3), 397 397 q->mmio_base + B43_PIO8_TXDATA, 398 398 sizeof(u32)); 399 399 if (data_len & 3) { ··· 421 421 break; 422 422 } 423 423 b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); 424 - ssb_block_write(dev->dev, tail, 4, 424 + b43_block_write(dev, tail, 4, 425 425 q->mmio_base + B43_PIO8_TXDATA, 426 426 sizeof(u32)); 427 427 } ··· 657 657 658 658 /* Get the preamble (RX header) */ 659 659 if (q->rev >= 8) { 660 - ssb_block_read(dev->dev, rxhdr, sizeof(*rxhdr), 660 + b43_block_read(dev, rxhdr, sizeof(*rxhdr), 661 661 q->mmio_base + B43_PIO8_RXDATA, 662 662 sizeof(u32)); 663 663 } else { 664 - ssb_block_read(dev->dev, rxhdr, sizeof(*rxhdr), 664 + b43_block_read(dev, rxhdr, sizeof(*rxhdr), 665 665 q->mmio_base + B43_PIO_RXDATA, 666 666 sizeof(u16)); 667 667 } ··· 697 697 skb_reserve(skb, 2); 698 698 skb_put(skb, len + padding); 699 699 if (q->rev >= 8) { 700 - ssb_block_read(dev->dev, skb->data + padding, (len & ~3), 700 + b43_block_read(dev, skb->data + padding, (len & ~3), 701 701 q->mmio_base + B43_PIO8_RXDATA, 702 702 sizeof(u32)); 703 703 if (len & 3) { ··· 705 705 BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 4); 706 706 707 707 /* Read the last few bytes. */ 708 - ssb_block_read(dev->dev, tail, 4, 708 + b43_block_read(dev, tail, 4, 709 709 q->mmio_base + B43_PIO8_RXDATA, 710 710 sizeof(u32)); 711 711 switch (len & 3) { ··· 724 724 } 725 725 } 726 726 } else { 727 - ssb_block_read(dev->dev, skb->data + padding, (len & ~1), 727 + b43_block_read(dev, skb->data + padding, (len & ~1), 728 728 q->mmio_base + B43_PIO_RXDATA, 729 729 sizeof(u16)); 730 730 if (len & 1) { ··· 732 732 BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 2); 733 733 734 734 /* Read the last byte. */ 735 - ssb_block_read(dev->dev, tail, 2, 735 + b43_block_read(dev, tail, 2, 736 736 q->mmio_base + B43_PIO_RXDATA, 737 737 sizeof(u16)); 738 738 skb->data[len + padding - 1] = tail[0];
+3 -3
drivers/net/wireless/b43/rfkill.c
··· 37 37 { 38 38 struct b43_wl *wl = hw_to_b43_wl(hw); 39 39 struct b43_wldev *dev = wl->current_dev; 40 - struct ssb_bus *bus = dev->dev->bus; 40 + struct ssb_bus *bus = dev->sdev->bus; 41 41 bool enabled; 42 42 bool brought_up = false; 43 43 ··· 47 47 mutex_unlock(&wl->mutex); 48 48 return; 49 49 } 50 - ssb_device_enable(dev->dev, 0); 50 + ssb_device_enable(dev->sdev, 0); 51 51 brought_up = true; 52 52 } 53 53 ··· 63 63 } 64 64 65 65 if (brought_up) { 66 - ssb_device_disable(dev->dev, 0); 66 + ssb_device_disable(dev->sdev, 0); 67 67 ssb_bus_may_powerdown(bus); 68 68 } 69 69
+2 -2
drivers/net/wireless/b43/sdio.c
··· 66 66 int b43_sdio_request_irq(struct b43_wldev *dev, 67 67 void (*handler)(struct b43_wldev *dev)) 68 68 { 69 - struct ssb_bus *bus = dev->dev->bus; 69 + struct ssb_bus *bus = dev->sdev->bus; 70 70 struct sdio_func *func = bus->host_sdio; 71 71 struct b43_sdio *sdio = sdio_get_drvdata(func); 72 72 int err; ··· 82 82 83 83 void b43_sdio_free_irq(struct b43_wldev *dev) 84 84 { 85 - struct ssb_bus *bus = dev->dev->bus; 85 + struct ssb_bus *bus = dev->sdev->bus; 86 86 struct sdio_func *func = bus->host_sdio; 87 87 struct b43_sdio *sdio = sdio_get_drvdata(func); 88 88
+2 -2
drivers/net/wireless/b43/sysfs.c
··· 140 140 141 141 int b43_sysfs_register(struct b43_wldev *wldev) 142 142 { 143 - struct device *dev = wldev->dev->dev; 143 + struct device *dev = wldev->sdev->dev; 144 144 145 145 B43_WARN_ON(b43_status(wldev) != B43_STAT_INITIALIZED); 146 146 ··· 149 149 150 150 void b43_sysfs_unregister(struct b43_wldev *wldev) 151 151 { 152 - struct device *dev = wldev->dev->dev; 152 + struct device *dev = wldev->sdev->dev; 153 153 154 154 device_remove_file(dev, &dev_attr_interference); 155 155 }
+2 -2
drivers/net/wireless/b43/tables_lpphy.c
··· 2304 2304 2305 2305 void lpphy_rev2plus_table_init(struct b43_wldev *dev) 2306 2306 { 2307 - struct ssb_bus *bus = dev->dev->bus; 2307 + struct ssb_bus *bus = dev->sdev->bus; 2308 2308 int i; 2309 2309 2310 2310 B43_WARN_ON(dev->phy.rev < 2); ··· 2416 2416 2417 2417 void lpphy_init_tx_gain_table(struct b43_wldev *dev) 2418 2418 { 2419 - struct ssb_bus *bus = dev->dev->bus; 2419 + struct ssb_bus *bus = dev->sdev->bus; 2420 2420 2421 2421 switch (dev->phy.rev) { 2422 2422 case 0:
+2 -2
drivers/net/wireless/b43/wa.c
··· 458 458 459 459 static void b43_wa_boards_a(struct b43_wldev *dev) 460 460 { 461 - struct ssb_bus *bus = dev->dev->bus; 461 + struct ssb_bus *bus = dev->sdev->bus; 462 462 463 463 if (bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM && 464 464 bus->boardinfo.type == SSB_BOARD_BU4306 && ··· 486 486 487 487 static void b43_wa_boards_g(struct b43_wldev *dev) 488 488 { 489 - struct ssb_bus *bus = dev->dev->bus; 489 + struct ssb_bus *bus = dev->sdev->bus; 490 490 struct b43_phy *phy = &dev->phy; 491 491 492 492 if (bus->boardinfo.vendor != SSB_BOARDVENDOR_BCM ||
+1 -1
drivers/net/wireless/b43/xmit.c
··· 547 547 else 548 548 tmp -= 3; 549 549 } else { 550 - if (dev->dev->bus->sprom. 550 + if (dev->sdev->bus->sprom. 551 551 boardflags_lo & B43_BFL_RSSI) { 552 552 if (in_rssi > 63) 553 553 in_rssi = 63;
-4
drivers/net/wireless/iwlwifi/iwl-1000.c
··· 171 171 172 172 static struct iwl_lib_ops iwl1000_lib = { 173 173 .set_hw_params = iwl1000_hw_set_hw_params, 174 - .txq_set_sched = iwlagn_txq_set_sched, 175 - .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd, 176 - .txq_free_tfd = iwl_hw_txq_free_tfd, 177 - .txq_init = iwl_hw_tx_queue_init, 178 174 .rx_handler_setup = iwlagn_rx_handler_setup, 179 175 .setup_deferred_work = iwlagn_setup_deferred_work, 180 176 .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
+2 -6
drivers/net/wireless/iwlwifi/iwl-2000.c
··· 195 195 struct ieee80211_vif *vif = ctx->vif; 196 196 struct iwl_host_cmd hcmd = { 197 197 .id = REPLY_CHANNEL_SWITCH, 198 - .len = sizeof(cmd), 198 + .len = { sizeof(cmd), }, 199 199 .flags = CMD_SYNC, 200 - .data = &cmd, 200 + .data = { &cmd, }, 201 201 }; 202 202 203 203 cmd.band = priv->band == IEEE80211_BAND_2GHZ; ··· 252 252 253 253 static struct iwl_lib_ops iwl2000_lib = { 254 254 .set_hw_params = iwl2000_hw_set_hw_params, 255 - .txq_set_sched = iwlagn_txq_set_sched, 256 - .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd, 257 - .txq_free_tfd = iwl_hw_txq_free_tfd, 258 - .txq_init = iwl_hw_tx_queue_init, 259 255 .rx_handler_setup = iwlagn_rx_handler_setup, 260 256 .setup_deferred_work = iwlagn_bt_setup_deferred_work, 261 257 .cancel_deferred_work = iwlagn_bt_cancel_deferred_work,
+2 -10
drivers/net/wireless/iwlwifi/iwl-5000.c
··· 282 282 struct ieee80211_vif *vif = ctx->vif; 283 283 struct iwl_host_cmd hcmd = { 284 284 .id = REPLY_CHANNEL_SWITCH, 285 - .len = sizeof(cmd), 285 + .len = { sizeof(cmd), }, 286 286 .flags = CMD_SYNC, 287 - .data = &cmd, 287 + .data = { &cmd, }, 288 288 }; 289 289 290 290 cmd.band = priv->band == IEEE80211_BAND_2GHZ; ··· 339 339 340 340 static struct iwl_lib_ops iwl5000_lib = { 341 341 .set_hw_params = iwl5000_hw_set_hw_params, 342 - .txq_set_sched = iwlagn_txq_set_sched, 343 - .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd, 344 - .txq_free_tfd = iwl_hw_txq_free_tfd, 345 - .txq_init = iwl_hw_tx_queue_init, 346 342 .rx_handler_setup = iwlagn_rx_handler_setup, 347 343 .setup_deferred_work = iwlagn_setup_deferred_work, 348 344 .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr, ··· 370 374 371 375 static struct iwl_lib_ops iwl5150_lib = { 372 376 .set_hw_params = iwl5150_hw_set_hw_params, 373 - .txq_set_sched = iwlagn_txq_set_sched, 374 - .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd, 375 - .txq_free_tfd = iwl_hw_txq_free_tfd, 376 - .txq_init = iwl_hw_tx_queue_init, 377 377 .rx_handler_setup = iwlagn_rx_handler_setup, 378 378 .setup_deferred_work = iwlagn_setup_deferred_work, 379 379 .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
+2 -10
drivers/net/wireless/iwlwifi/iwl-6000.c
··· 221 221 struct ieee80211_vif *vif = ctx->vif; 222 222 struct iwl_host_cmd hcmd = { 223 223 .id = REPLY_CHANNEL_SWITCH, 224 - .len = sizeof(cmd), 224 + .len = { sizeof(cmd), }, 225 225 .flags = CMD_SYNC, 226 - .data = &cmd, 226 + .data = { &cmd, }, 227 227 }; 228 228 229 229 cmd.band = priv->band == IEEE80211_BAND_2GHZ; ··· 278 278 279 279 static struct iwl_lib_ops iwl6000_lib = { 280 280 .set_hw_params = iwl6000_hw_set_hw_params, 281 - .txq_set_sched = iwlagn_txq_set_sched, 282 - .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd, 283 - .txq_free_tfd = iwl_hw_txq_free_tfd, 284 - .txq_init = iwl_hw_tx_queue_init, 285 281 .rx_handler_setup = iwlagn_rx_handler_setup, 286 282 .setup_deferred_work = iwlagn_setup_deferred_work, 287 283 .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr, ··· 310 314 311 315 static struct iwl_lib_ops iwl6030_lib = { 312 316 .set_hw_params = iwl6000_hw_set_hw_params, 313 - .txq_set_sched = iwlagn_txq_set_sched, 314 - .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd, 315 - .txq_free_tfd = iwl_hw_txq_free_tfd, 316 - .txq_init = iwl_hw_tx_queue_init, 317 317 .rx_handler_setup = iwlagn_bt_rx_handler_setup, 318 318 .setup_deferred_work = iwlagn_bt_setup_deferred_work, 319 319 .cancel_deferred_work = iwlagn_bt_cancel_deferred_work,
+7 -7
drivers/net/wireless/iwlwifi/iwl-agn-calib.c
··· 87 87 88 88 struct iwl_host_cmd hcmd = { 89 89 .id = REPLY_PHY_CALIBRATION_CMD, 90 - .flags = CMD_SIZE_HUGE, 91 90 }; 92 91 93 92 for (i = 0; i < IWL_CALIB_MAX; i++) { 94 93 if ((BIT(i) & priv->hw_params.calib_init_cfg) && 95 94 priv->calib_results[i].buf) { 96 - hcmd.len = priv->calib_results[i].buf_len; 97 - hcmd.data = priv->calib_results[i].buf; 95 + hcmd.len[0] = priv->calib_results[i].buf_len; 96 + hcmd.data[0] = priv->calib_results[i].buf; 97 + hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY; 98 98 ret = iwl_send_cmd_sync(priv, &hcmd); 99 99 if (ret) { 100 100 IWL_ERR(priv, "Error %d iteration %d\n", ··· 456 456 struct iwl_sensitivity_data *data = NULL; 457 457 struct iwl_host_cmd cmd_out = { 458 458 .id = SENSITIVITY_CMD, 459 - .len = sizeof(struct iwl_sensitivity_cmd), 459 + .len = { sizeof(struct iwl_sensitivity_cmd), }, 460 460 .flags = CMD_ASYNC, 461 - .data = &cmd, 461 + .data = { &cmd, }, 462 462 }; 463 463 464 464 data = &(priv->sensitivity_data); ··· 491 491 struct iwl_sensitivity_data *data = NULL; 492 492 struct iwl_host_cmd cmd_out = { 493 493 .id = SENSITIVITY_CMD, 494 - .len = sizeof(struct iwl_enhance_sensitivity_cmd), 494 + .len = { sizeof(struct iwl_enhance_sensitivity_cmd), }, 495 495 .flags = CMD_ASYNC, 496 - .data = &cmd, 496 + .data = { &cmd, }, 497 497 }; 498 498 499 499 data = &(priv->sensitivity_data);
+7 -7
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
··· 1140 1140 { 1141 1141 struct iwl_host_cmd cmd = { 1142 1142 .id = REPLY_SCAN_CMD, 1143 - .len = sizeof(struct iwl_scan_cmd), 1144 - .flags = CMD_SIZE_HUGE, 1143 + .len = { sizeof(struct iwl_scan_cmd), }, 1145 1144 }; 1146 1145 struct iwl_scan_cmd *scan; 1147 1146 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; ··· 1424 1425 return -EIO; 1425 1426 } 1426 1427 1427 - cmd.len += le16_to_cpu(scan->tx_cmd.len) + 1428 + cmd.len[0] += le16_to_cpu(scan->tx_cmd.len) + 1428 1429 scan->channel_count * sizeof(struct iwl_scan_channel); 1429 - cmd.data = scan; 1430 - scan->len = cpu_to_le16(cmd.len); 1430 + cmd.data[0] = scan; 1431 + cmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY; 1432 + scan->len = cpu_to_le16(cmd.len[0]); 1431 1433 1432 1434 /* set scan bit here for PAN params */ 1433 1435 set_bit(STATUS_SCAN_HW, &priv->status); ··· 1520 1520 struct iwl_txfifo_flush_cmd flush_cmd; 1521 1521 struct iwl_host_cmd cmd = { 1522 1522 .id = REPLY_TXFIFO_FLUSH, 1523 - .len = sizeof(struct iwl_txfifo_flush_cmd), 1523 + .len = { sizeof(struct iwl_txfifo_flush_cmd), }, 1524 1524 .flags = CMD_SYNC, 1525 - .data = &flush_cmd, 1525 + .data = { &flush_cmd, }, 1526 1526 }; 1527 1527 1528 1528 might_sleep();
+47 -39
drivers/net/wireless/iwlwifi/iwl-agn-rs.c
··· 335 335 return tid; 336 336 } 337 337 338 + #ifdef CONFIG_MAC80211_DEBUGFS 339 + static void rs_program_fix_rate(struct iwl_priv *priv, 340 + struct iwl_lq_sta *lq_sta) 341 + { 342 + struct iwl_station_priv *sta_priv = 343 + container_of(lq_sta, struct iwl_station_priv, lq_sta); 344 + struct iwl_rxon_context *ctx = sta_priv->common.ctx; 345 + 346 + lq_sta->active_legacy_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */ 347 + lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ 348 + lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ 349 + lq_sta->active_mimo3_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ 350 + 351 + lq_sta->dbg_fixed_rate = priv->dbg_fixed_rate; 352 + 353 + IWL_DEBUG_RATE(priv, "sta_id %d rate 0x%X\n", 354 + lq_sta->lq.sta_id, priv->dbg_fixed_rate); 355 + 356 + if (priv->dbg_fixed_rate) { 357 + rs_fill_link_cmd(NULL, lq_sta, priv->dbg_fixed_rate); 358 + iwl_send_lq_cmd(lq_sta->drv, ctx, &lq_sta->lq, CMD_ASYNC, 359 + false); 360 + } 361 + } 362 + #endif 363 + 338 364 /* 339 365 get the traffic load value for tid 340 366 */ ··· 1072 1046 /* See if there's a better rate or modulation mode to try. */ 1073 1047 if (sta && sta->supp_rates[sband->band]) 1074 1048 rs_rate_scale_perform(priv, skb, sta, lq_sta); 1075 - 1049 + #ifdef CONFIG_MAC80211_DEBUGFS 1050 + if (priv->dbg_fixed_rate != lq_sta->dbg_fixed_rate) 1051 + rs_program_fix_rate(priv, lq_sta); 1052 + #endif 1076 1053 if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist) 1077 1054 rs_bt_update_lq(priv, ctx, lq_sta); 1078 1055 } ··· 2199 2170 * setup rate table in uCode 2200 2171 * return rate_n_flags as used in the table 2201 2172 */ 2202 - static u32 rs_update_rate_tbl(struct iwl_priv *priv, 2203 - struct iwl_rxon_context *ctx, 2204 - struct iwl_lq_sta *lq_sta, 2205 - struct iwl_scale_tbl_info *tbl, 2206 - int index, u8 is_green) 2173 + static void rs_update_rate_tbl(struct iwl_priv *priv, 2174 + struct iwl_rxon_context *ctx, 2175 + struct iwl_lq_sta *lq_sta, 2176 + struct iwl_scale_tbl_info *tbl, 2177 + int index, u8 is_green) 2207 2178 { 2208 2179 u32 rate; 2209 2180 ··· 2211 2182 rate = rate_n_flags_from_tbl(priv, tbl, index, is_green); 2212 2183 rs_fill_link_cmd(priv, lq_sta, rate); 2213 2184 iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); 2214 - 2215 - return rate; 2216 2185 } 2217 2186 2218 2187 /* ··· 2239 2212 u8 update_lq = 0; 2240 2213 struct iwl_scale_tbl_info *tbl, *tbl1; 2241 2214 u16 rate_scale_index_msk = 0; 2242 - u32 rate; 2243 2215 u8 is_green = 0; 2244 2216 u8 active_tbl = 0; 2245 2217 u8 done_search = 0; ··· 2325 2299 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 2326 2300 /* get "active" rate info */ 2327 2301 index = iwl_hwrate_to_plcp_idx(tbl->current_rate); 2328 - rate = rs_update_rate_tbl(priv, ctx, lq_sta, 2329 - tbl, index, is_green); 2302 + rs_update_rate_tbl(priv, ctx, lq_sta, tbl, 2303 + index, is_green); 2330 2304 } 2331 2305 return; 2332 2306 } ··· 2567 2541 lq_update: 2568 2542 /* Replace uCode's rate table for the destination station. */ 2569 2543 if (update_lq) 2570 - rate = rs_update_rate_tbl(priv, ctx, lq_sta, 2571 - tbl, index, is_green); 2544 + rs_update_rate_tbl(priv, ctx, lq_sta, tbl, index, is_green); 2572 2545 2573 2546 if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_MULTI) { 2574 2547 /* Should we stay with this modulation mode, ··· 2896 2871 lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; 2897 2872 lq_sta->is_agg = 0; 2898 2873 2874 + priv->dbg_fixed_rate = 0; 2899 2875 #ifdef CONFIG_MAC80211_DEBUGFS 2900 2876 lq_sta->dbg_fixed_rate = 0; 2901 2877 #endif ··· 3071 3045 IWL_DEBUG_RATE(priv, "leave\n"); 3072 3046 } 3073 3047 3074 - 3075 3048 #ifdef CONFIG_MAC80211_DEBUGFS 3076 3049 static int open_file_generic(struct inode *inode, struct file *file) 3077 3050 { ··· 3095 3070 IWL_DEBUG_RATE(priv, "Fixed rate ON\n"); 3096 3071 } else { 3097 3072 lq_sta->dbg_fixed_rate = 0; 3073 + priv->dbg_fixed_rate = 0; 3098 3074 IWL_ERR(priv, 3099 3075 "Invalid antenna selection 0x%X, Valid is 0x%X\n", 3100 3076 ant_sel_tx, valid_tx_ant); ··· 3114 3088 char buf[64]; 3115 3089 size_t buf_size; 3116 3090 u32 parsed_rate; 3117 - struct iwl_station_priv *sta_priv = 3118 - container_of(lq_sta, struct iwl_station_priv, lq_sta); 3119 - struct iwl_rxon_context *ctx = sta_priv->common.ctx; 3091 + 3120 3092 3121 3093 priv = lq_sta->drv; 3122 3094 memset(buf, 0, sizeof(buf)); ··· 3123 3099 return -EFAULT; 3124 3100 3125 3101 if (sscanf(buf, "%x", &parsed_rate) == 1) 3126 - lq_sta->dbg_fixed_rate = parsed_rate; 3102 + priv->dbg_fixed_rate = lq_sta->dbg_fixed_rate = parsed_rate; 3127 3103 else 3128 - lq_sta->dbg_fixed_rate = 0; 3104 + priv->dbg_fixed_rate = lq_sta->dbg_fixed_rate = 0; 3129 3105 3130 - lq_sta->active_legacy_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */ 3131 - lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ 3132 - lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ 3133 - lq_sta->active_mimo3_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ 3134 - 3135 - IWL_DEBUG_RATE(priv, "sta_id %d rate 0x%X\n", 3136 - lq_sta->lq.sta_id, lq_sta->dbg_fixed_rate); 3137 - 3138 - if (lq_sta->dbg_fixed_rate) { 3139 - rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); 3140 - iwl_send_lq_cmd(lq_sta->drv, ctx, &lq_sta->lq, CMD_ASYNC, 3141 - false); 3142 - } 3106 + rs_program_fix_rate(priv, lq_sta); 3143 3107 3144 3108 return count; 3145 3109 } ··· 3155 3143 lq_sta->total_failed, lq_sta->total_success, 3156 3144 lq_sta->active_legacy_rate); 3157 3145 desc += sprintf(buff+desc, "fixed rate 0x%X\n", 3158 - lq_sta->dbg_fixed_rate); 3146 + priv->dbg_fixed_rate); 3159 3147 desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n", 3160 3148 (priv->hw_params.valid_tx_ant & ANT_A) ? "ANT_A," : "", 3161 3149 (priv->hw_params.valid_tx_ant & ANT_B) ? "ANT_B," : "", ··· 3266 3254 static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file, 3267 3255 char __user *user_buf, size_t count, loff_t *ppos) 3268 3256 { 3257 + struct iwl_lq_sta *lq_sta = file->private_data; 3258 + struct iwl_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; 3269 3259 char buff[120]; 3270 3260 int desc = 0; 3271 - 3272 - struct iwl_lq_sta *lq_sta = file->private_data; 3273 - struct iwl_priv *priv; 3274 - struct iwl_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; 3275 - 3276 - priv = lq_sta->drv; 3277 3261 3278 3262 if (is_Ht(tbl->lq_type)) 3279 3263 desc += sprintf(buff+desc,
+3 -6
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
··· 289 289 /* cast away the const for active_rxon in this function */ 290 290 struct iwl_rxon_cmd *active = (void *)&ctx->active; 291 291 bool new_assoc = !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK); 292 - bool old_assoc = !!(ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK); 293 292 int ret; 294 293 295 294 lockdep_assert_held(&priv->mutex); ··· 388 389 * AP station must be done after the BSSID is set to correctly 389 390 * set up filters in the device. 390 391 */ 391 - if ((old_assoc && new_assoc) || !new_assoc) { 392 - ret = iwlagn_rxon_disconn(priv, ctx); 393 - if (ret) 394 - return ret; 395 - } 392 + ret = iwlagn_rxon_disconn(priv, ctx); 393 + if (ret) 394 + return ret; 396 395 397 396 if (new_assoc) 398 397 return iwlagn_rxon_connect(priv, ctx);
+2 -2
drivers/net/wireless/iwlwifi/iwl-agn-sta.c
··· 144 144 size_t cmd_size = sizeof(struct iwl_wep_cmd); 145 145 struct iwl_host_cmd cmd = { 146 146 .id = ctx->wep_key_cmd, 147 - .data = wep_cmd, 147 + .data = { wep_cmd, }, 148 148 .flags = CMD_SYNC, 149 149 }; 150 150 ··· 172 172 173 173 cmd_size += sizeof(struct iwl_wep_key) * WEP_KEYS_MAX; 174 174 175 - cmd.len = cmd_size; 175 + cmd.len[0] = cmd_size; 176 176 177 177 if (not_empty || send_if_empty) 178 178 return iwl_send_cmd(priv, &cmd);
+7 -9
drivers/net/wireless/iwlwifi/iwl-agn-tx.c
··· 755 755 spin_unlock(&priv->sta_lock); 756 756 757 757 /* Attach buffers to TFD */ 758 - priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, 759 - txcmd_phys, firstlen, 1, 0); 758 + iwlagn_txq_attach_buf_to_tfd(priv, txq, txcmd_phys, firstlen, 1); 760 759 if (secondlen > 0) 761 - priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, 762 - phys_addr, secondlen, 763 - 0, 0); 760 + iwlagn_txq_attach_buf_to_tfd(priv, txq, phys_addr, 761 + secondlen, 0); 764 762 765 763 scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + 766 764 offsetof(struct iwl_tx_cmd, scratch); ··· 914 916 spin_lock_irqsave(&priv->lock, flags); 915 917 916 918 /* Turn off all Tx DMA fifos */ 917 - priv->cfg->ops->lib->txq_set_sched(priv, 0); 919 + iwlagn_txq_set_sched(priv, 0); 918 920 919 921 /* Tell NIC where to find the "keep warm" buffer */ 920 922 iwl_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4); ··· 952 954 spin_lock_irqsave(&priv->lock, flags); 953 955 954 956 /* Turn off all Tx DMA fifos */ 955 - priv->cfg->ops->lib->txq_set_sched(priv, 0); 957 + iwlagn_txq_set_sched(priv, 0); 956 958 957 959 /* Tell NIC where to find the "keep warm" buffer */ 958 960 iwl_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4); ··· 978 980 /* Turn off all Tx DMA fifos */ 979 981 spin_lock_irqsave(&priv->lock, flags); 980 982 981 - priv->cfg->ops->lib->txq_set_sched(priv, 0); 983 + iwlagn_txq_set_sched(priv, 0); 982 984 983 985 /* Stop each Tx DMA channel, and wait for it to be idle */ 984 986 for (ch = 0; ch < priv->hw_params.dma_chnl_num; ch++) { ··· 1261 1263 1262 1264 iwlagn_txq_inval_byte_cnt_tbl(priv, txq); 1263 1265 1264 - priv->cfg->ops->lib->txq_free_tfd(priv, txq); 1266 + iwlagn_txq_free_tfd(priv, txq); 1265 1267 } 1266 1268 return nfreed; 1267 1269 }
+3 -3
drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
··· 217 217 struct iwl_calib_cfg_cmd calib_cfg_cmd; 218 218 struct iwl_host_cmd cmd = { 219 219 .id = CALIBRATION_CFG_CMD, 220 - .len = sizeof(struct iwl_calib_cfg_cmd), 221 - .data = &calib_cfg_cmd, 220 + .len = { sizeof(struct iwl_calib_cfg_cmd), }, 221 + .data = { &calib_cfg_cmd, }, 222 222 }; 223 223 224 224 memset(&calib_cfg_cmd, 0, sizeof(calib_cfg_cmd)); ··· 440 440 IWL_MASK(0, priv->hw_params.max_txq_num)); 441 441 442 442 /* Activate all Tx DMA/FIFO channels */ 443 - priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 7)); 443 + iwlagn_txq_set_sched(priv, IWL_MASK(0, 7)); 444 444 445 445 /* map queues to FIFOs */ 446 446 if (priv->valid_contexts != BIT(IWL_RXON_CTX_BSS))
+46 -198
drivers/net/wireless/iwlwifi/iwl-agn.c
··· 134 134 struct iwl_tx_beacon_cmd *tx_beacon_cmd; 135 135 struct iwl_host_cmd cmd = { 136 136 .id = REPLY_TX_BEACON, 137 - .flags = CMD_SIZE_HUGE, 138 137 }; 139 138 u32 frame_size; 140 139 u32 rate_flags; 141 140 u32 rate; 142 - int err; 143 141 144 142 /* 145 143 * We have to set up the TX command, the TX Beacon command, and the ··· 154 156 if (WARN_ON(!priv->beacon_skb)) 155 157 return -EINVAL; 156 158 157 - /* Allocate beacon memory */ 158 - tx_beacon_cmd = kzalloc(sizeof(*tx_beacon_cmd) + priv->beacon_skb->len, 159 - GFP_KERNEL); 159 + /* Allocate beacon command */ 160 + if (!priv->beacon_cmd) 161 + priv->beacon_cmd = kzalloc(sizeof(*tx_beacon_cmd), GFP_KERNEL); 162 + tx_beacon_cmd = priv->beacon_cmd; 160 163 if (!tx_beacon_cmd) 161 164 return -ENOMEM; 162 165 163 166 frame_size = priv->beacon_skb->len; 164 - 165 - /* Set up TX beacon contents */ 166 - memcpy(tx_beacon_cmd->frame, priv->beacon_skb->data, frame_size); 167 167 168 168 /* Set up TX command fields */ 169 169 tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); ··· 171 175 TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK; 172 176 173 177 /* Set up TX beacon command fields */ 174 - iwl_set_beacon_tim(priv, tx_beacon_cmd, (u8 *)tx_beacon_cmd->frame, 178 + iwl_set_beacon_tim(priv, tx_beacon_cmd, priv->beacon_skb->data, 175 179 frame_size); 176 180 177 181 /* Set up packet rate and flags */ ··· 185 189 rate_flags); 186 190 187 191 /* Submit command */ 188 - cmd.len = sizeof(*tx_beacon_cmd) + frame_size; 189 - cmd.data = tx_beacon_cmd; 192 + cmd.len[0] = sizeof(*tx_beacon_cmd); 193 + cmd.data[0] = tx_beacon_cmd; 194 + cmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY; 195 + cmd.len[1] = frame_size; 196 + cmd.data[1] = priv->beacon_skb->data; 197 + cmd.dataflags[1] = IWL_HCMD_DFL_NOCOPY; 190 198 191 - err = iwl_send_cmd_sync(priv, &cmd); 192 - 193 - /* Free temporary storage */ 194 - kfree(tx_beacon_cmd); 195 - 196 - return err; 197 - } 198 - 199 - static inline dma_addr_t iwl_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx) 200 - { 201 - struct iwl_tfd_tb *tb = &tfd->tbs[idx]; 202 - 203 - dma_addr_t addr = get_unaligned_le32(&tb->lo); 204 - if (sizeof(dma_addr_t) > sizeof(u32)) 205 - addr |= 206 - ((dma_addr_t)(le16_to_cpu(tb->hi_n_len) & 0xF) << 16) << 16; 207 - 208 - return addr; 209 - } 210 - 211 - static inline u16 iwl_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx) 212 - { 213 - struct iwl_tfd_tb *tb = &tfd->tbs[idx]; 214 - 215 - return le16_to_cpu(tb->hi_n_len) >> 4; 216 - } 217 - 218 - static inline void iwl_tfd_set_tb(struct iwl_tfd *tfd, u8 idx, 219 - dma_addr_t addr, u16 len) 220 - { 221 - struct iwl_tfd_tb *tb = &tfd->tbs[idx]; 222 - u16 hi_n_len = len << 4; 223 - 224 - put_unaligned_le32(addr, &tb->lo); 225 - if (sizeof(dma_addr_t) > sizeof(u32)) 226 - hi_n_len |= ((addr >> 16) >> 16) & 0xF; 227 - 228 - tb->hi_n_len = cpu_to_le16(hi_n_len); 229 - 230 - tfd->num_tbs = idx + 1; 231 - } 232 - 233 - static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd) 234 - { 235 - return tfd->num_tbs & 0x1f; 236 - } 237 - 238 - /** 239 - * iwl_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] 240 - * @priv - driver private data 241 - * @txq - tx queue 242 - * 243 - * Does NOT advance any TFD circular buffer read/write indexes 244 - * Does NOT free the TFD itself (which is within circular buffer) 245 - */ 246 - void iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) 247 - { 248 - struct iwl_tfd *tfd_tmp = (struct iwl_tfd *)txq->tfds; 249 - struct iwl_tfd *tfd; 250 - struct pci_dev *dev = priv->pci_dev; 251 - int index = txq->q.read_ptr; 252 - int i; 253 - int num_tbs; 254 - 255 - tfd = &tfd_tmp[index]; 256 - 257 - /* Sanity check on number of chunks */ 258 - num_tbs = iwl_tfd_get_num_tbs(tfd); 259 - 260 - if (num_tbs >= IWL_NUM_OF_TBS) { 261 - IWL_ERR(priv, "Too many chunks: %i\n", num_tbs); 262 - /* @todo issue fatal error, it is quite serious situation */ 263 - return; 264 - } 265 - 266 - /* Unmap tx_cmd */ 267 - if (num_tbs) 268 - pci_unmap_single(dev, 269 - dma_unmap_addr(&txq->meta[index], mapping), 270 - dma_unmap_len(&txq->meta[index], len), 271 - PCI_DMA_BIDIRECTIONAL); 272 - 273 - /* Unmap chunks, if any. */ 274 - for (i = 1; i < num_tbs; i++) 275 - pci_unmap_single(dev, iwl_tfd_tb_get_addr(tfd, i), 276 - iwl_tfd_tb_get_len(tfd, i), PCI_DMA_TODEVICE); 277 - 278 - /* free SKB */ 279 - if (txq->txb) { 280 - struct sk_buff *skb; 281 - 282 - skb = txq->txb[txq->q.read_ptr].skb; 283 - 284 - /* can be called from irqs-disabled context */ 285 - if (skb) { 286 - dev_kfree_skb_any(skb); 287 - txq->txb[txq->q.read_ptr].skb = NULL; 288 - } 289 - } 290 - } 291 - 292 - int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, 293 - struct iwl_tx_queue *txq, 294 - dma_addr_t addr, u16 len, 295 - u8 reset, u8 pad) 296 - { 297 - struct iwl_queue *q; 298 - struct iwl_tfd *tfd, *tfd_tmp; 299 - u32 num_tbs; 300 - 301 - q = &txq->q; 302 - tfd_tmp = (struct iwl_tfd *)txq->tfds; 303 - tfd = &tfd_tmp[q->write_ptr]; 304 - 305 - if (reset) 306 - memset(tfd, 0, sizeof(*tfd)); 307 - 308 - num_tbs = iwl_tfd_get_num_tbs(tfd); 309 - 310 - /* Each TFD can point to a maximum 20 Tx buffers */ 311 - if (num_tbs >= IWL_NUM_OF_TBS) { 312 - IWL_ERR(priv, "Error can not send more than %d chunks\n", 313 - IWL_NUM_OF_TBS); 314 - return -EINVAL; 315 - } 316 - 317 - if (WARN_ON(addr & ~DMA_BIT_MASK(36))) 318 - return -EINVAL; 319 - 320 - if (unlikely(addr & ~IWL_TX_DMA_MASK)) 321 - IWL_ERR(priv, "Unaligned address = %llx\n", 322 - (unsigned long long)addr); 323 - 324 - iwl_tfd_set_tb(tfd, num_tbs, addr, len); 325 - 326 - return 0; 327 - } 328 - 329 - /* 330 - * Tell nic where to find circular buffer of Tx Frame Descriptors for 331 - * given Tx queue, and enable the DMA channel used for that queue. 332 - * 333 - * supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA 334 - * channels supported in hardware. 335 - */ 336 - int iwl_hw_tx_queue_init(struct iwl_priv *priv, 337 - struct iwl_tx_queue *txq) 338 - { 339 - int txq_id = txq->q.id; 340 - 341 - /* Circular buffer (TFD queue in DRAM) physical base address */ 342 - iwl_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), 343 - txq->q.dma_addr >> 8); 344 - 345 - return 0; 199 + return iwl_send_cmd_sync(priv, &cmd); 346 200 } 347 201 348 202 static void iwl_bg_beacon_update(struct work_struct *work) ··· 1622 1776 1623 1777 void iwl_dump_nic_error_log(struct iwl_priv *priv) 1624 1778 { 1625 - u32 data2, line; 1626 - u32 desc, time, count, base, data1; 1627 - u32 blink1, blink2, ilink1, ilink2; 1628 - u32 pc, hcmd; 1779 + u32 base; 1629 1780 struct iwl_error_event_table table; 1630 1781 1631 1782 base = priv->device_pointers.error_event_table; ··· 1645 1802 1646 1803 iwl_read_targ_mem_words(priv, base, &table, sizeof(table)); 1647 1804 1648 - count = table.valid; 1649 - 1650 - if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { 1805 + if (ERROR_START_OFFSET <= table.valid * ERROR_ELEM_SIZE) { 1651 1806 IWL_ERR(priv, "Start IWL Error Log Dump:\n"); 1652 1807 IWL_ERR(priv, "Status: 0x%08lX, count: %d\n", 1653 - priv->status, count); 1808 + priv->status, table.valid); 1654 1809 } 1655 1810 1656 - desc = table.error_id; 1657 - priv->isr_stats.err_code = desc; 1658 - pc = table.pc; 1659 - blink1 = table.blink1; 1660 - blink2 = table.blink2; 1661 - ilink1 = table.ilink1; 1662 - ilink2 = table.ilink2; 1663 - data1 = table.data1; 1664 - data2 = table.data2; 1665 - line = table.line; 1666 - time = table.tsf_low; 1667 - hcmd = table.hcmd; 1811 + priv->isr_stats.err_code = table.error_id; 1668 1812 1669 - trace_iwlwifi_dev_ucode_error(priv, desc, time, data1, data2, line, 1670 - blink1, blink2, ilink1, ilink2); 1671 - 1672 - IWL_ERR(priv, "Desc Time " 1673 - "data1 data2 line\n"); 1674 - IWL_ERR(priv, "%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n", 1675 - desc_lookup(desc), desc, time, data1, data2, line); 1676 - IWL_ERR(priv, "pc blink1 blink2 ilink1 ilink2 hcmd\n"); 1677 - IWL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n", 1678 - pc, blink1, blink2, ilink1, ilink2, hcmd); 1813 + trace_iwlwifi_dev_ucode_error(priv, table.error_id, table.tsf_low, 1814 + table.data1, table.data2, table.line, 1815 + table.blink1, table.blink2, table.ilink1, 1816 + table.ilink2, table.bcon_time, table.gp1, 1817 + table.gp2, table.gp3, table.ucode_ver, 1818 + table.hw_ver, table.brd_ver); 1819 + IWL_ERR(priv, "0x%08X | %-28s\n", table.error_id, 1820 + desc_lookup(table.error_id)); 1821 + IWL_ERR(priv, "0x%08X | uPc\n", table.pc); 1822 + IWL_ERR(priv, "0x%08X | branchlink1\n", table.blink1); 1823 + IWL_ERR(priv, "0x%08X | branchlink2\n", table.blink2); 1824 + IWL_ERR(priv, "0x%08X | interruptlink1\n", table.ilink1); 1825 + IWL_ERR(priv, "0x%08X | interruptlink2\n", table.ilink2); 1826 + IWL_ERR(priv, "0x%08X | data1\n", table.data1); 1827 + IWL_ERR(priv, "0x%08X | data2\n", table.data2); 1828 + IWL_ERR(priv, "0x%08X | line\n", table.line); 1829 + IWL_ERR(priv, "0x%08X | beacon time\n", table.bcon_time); 1830 + IWL_ERR(priv, "0x%08X | tsf low\n", table.tsf_low); 1831 + IWL_ERR(priv, "0x%08X | tsf hi\n", table.tsf_hi); 1832 + IWL_ERR(priv, "0x%08X | time gp1\n", table.gp1); 1833 + IWL_ERR(priv, "0x%08X | time gp2\n", table.gp2); 1834 + IWL_ERR(priv, "0x%08X | time gp3\n", table.gp3); 1835 + IWL_ERR(priv, "0x%08X | uCode version\n", table.ucode_ver); 1836 + IWL_ERR(priv, "0x%08X | hw version\n", table.hw_ver); 1837 + IWL_ERR(priv, "0x%08X | board version\n", table.brd_ver); 1838 + IWL_ERR(priv, "0x%08X | hcmd\n", table.hcmd); 1679 1839 } 1680 1840 1681 1841 #define EVENT_START_OFFSET (4 * sizeof(u32)) ··· 1960 2114 struct iwl_calib_cfg_cmd calib_cfg_cmd; 1961 2115 struct iwl_host_cmd cmd = { 1962 2116 .id = CALIBRATION_CFG_CMD, 1963 - .len = sizeof(struct iwl_calib_cfg_cmd), 1964 - .data = &calib_cfg_cmd, 2117 + .len = { sizeof(struct iwl_calib_cfg_cmd), }, 2118 + .data = { &calib_cfg_cmd, }, 1965 2119 }; 1966 2120 1967 2121 memset(&calib_cfg_cmd, 0, sizeof(calib_cfg_cmd)); ··· 3241 3395 iwlcore_free_geos(priv); 3242 3396 iwl_free_channel_map(priv); 3243 3397 kfree(priv->scan_cmd); 3398 + kfree(priv->beacon_cmd); 3244 3399 } 3245 3400 3246 3401 struct ieee80211_ops iwlagn_hw_ops = { ··· 3659 3812 */ 3660 3813 set_bit(STATUS_EXIT_PENDING, &priv->status); 3661 3814 3815 + iwl_testmode_cleanup(priv); 3662 3816 iwl_leds_exit(priv); 3663 3817 3664 3818 if (priv->mac80211_registered) {
+8 -5
drivers/net/wireless/iwlwifi/iwl-agn.h
··· 191 191 void iwl_setup_rx_handlers(struct iwl_priv *priv); 192 192 193 193 /* tx */ 194 - void iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); 195 - int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, 194 + void iwlagn_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); 195 + int iwlagn_txq_attach_buf_to_tfd(struct iwl_priv *priv, 196 196 struct iwl_tx_queue *txq, 197 - dma_addr_t addr, u16 len, u8 reset, u8 pad); 198 - int iwl_hw_tx_queue_init(struct iwl_priv *priv, 199 - struct iwl_tx_queue *txq); 197 + dma_addr_t addr, u16 len, u8 reset); 200 198 void iwlagn_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, 201 199 struct ieee80211_tx_info *info); 202 200 int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb); ··· 343 345 #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL 344 346 extern int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len); 345 347 extern void iwl_testmode_init(struct iwl_priv *priv); 348 + extern void iwl_testmode_cleanup(struct iwl_priv *priv); 346 349 #else 347 350 static inline 348 351 int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len) ··· 352 353 } 353 354 static inline 354 355 void iwl_testmode_init(struct iwl_priv *priv) 356 + { 357 + } 358 + static inline 359 + void iwl_testmode_cleanup(struct iwl_priv *priv) 355 360 { 356 361 } 357 362 #endif
+1 -4
drivers/net/wireless/iwlwifi/iwl-commands.h
··· 205 205 #define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8) 206 206 #define SEQ_TO_INDEX(s) ((s) & 0xff) 207 207 #define INDEX_TO_SEQ(i) ((i) & 0xff) 208 - #define SEQ_HUGE_FRAME cpu_to_le16(0x4000) 209 208 #define SEQ_RX_FRAME cpu_to_le16(0x8000) 210 209 211 210 /** ··· 233 234 * 234 235 * 0:7 tfd index - position within TX queue 235 236 * 8:12 TX queue id 236 - * 13 reserved 237 - * 14 huge - driver sets this to indicate command is in the 238 - * 'huge' storage at the end of the command buffers 237 + * 13:14 reserved 239 238 * 15 unsolicited RX or uCode-originated notification 240 239 */ 241 240 __le16 sequence;
-10
drivers/net/wireless/iwlwifi/iwl-core.h
··· 127 127 struct iwl_lib_ops { 128 128 /* set hw dependent parameters */ 129 129 int (*set_hw_params)(struct iwl_priv *priv); 130 - /* Handling TX */ 131 - void (*txq_set_sched)(struct iwl_priv *priv, u32 mask); 132 - int (*txq_attach_buf_to_tfd)(struct iwl_priv *priv, 133 - struct iwl_tx_queue *txq, 134 - dma_addr_t addr, 135 - u16 len, u8 reset, u8 pad); 136 - void (*txq_free_tfd)(struct iwl_priv *priv, 137 - struct iwl_tx_queue *txq); 138 - int (*txq_init)(struct iwl_priv *priv, 139 - struct iwl_tx_queue *txq); 140 130 /* setup Rx handler */ 141 131 void (*rx_handler_setup)(struct iwl_priv *priv); 142 132 /* setup deferred work */
+44 -22
drivers/net/wireless/iwlwifi/iwl-dev.h
··· 48 48 #include "iwl-agn-rs.h" 49 49 #include "iwl-agn-tt.h" 50 50 51 - #define U32_PAD(n) ((4-(n))&0x3) 52 - 53 51 struct iwl_tx_queue; 54 52 55 53 /* CT-KILL constants */ ··· 81 83 #define MAX_RTS_THRESHOLD 2347U 82 84 #define MAX_MSDU_SIZE 2304U 83 85 #define MAX_MPDU_SIZE 2346U 84 - #define DEFAULT_BEACON_INTERVAL 100U 86 + #define DEFAULT_BEACON_INTERVAL 200U 85 87 #define DEFAULT_SHORT_RETRY_LIMIT 7U 86 88 #define DEFAULT_LONG_RETRY_LIMIT 4U 87 89 ··· 110 112 struct iwl_device_cmd *cmd, 111 113 struct iwl_rx_packet *pkt); 112 114 113 - /* The CMD_SIZE_HUGE flag bit indicates that the command 114 - * structure is stored at the end of the shared queue memory. */ 115 115 u32 flags; 116 116 117 117 DEFINE_DMA_UNMAP_ADDR(mapping); ··· 119 123 /* 120 124 * Generic queue structure 121 125 * 122 - * Contains common data for Rx and Tx queues 126 + * Contains common data for Rx and Tx queues. 127 + * 128 + * Note the difference between n_bd and n_window: the hardware 129 + * always assumes 256 descriptors, so n_bd is always 256 (unless 130 + * there might be HW changes in the future). For the normal TX 131 + * queues, n_window, which is the size of the software queue data 132 + * is also 256; however, for the command queue, n_window is only 133 + * 32 since we don't need so many commands pending. Since the HW 134 + * still uses 256 BDs for DMA though, n_bd stays 256. As a result, 135 + * the software buffers (in the variables @meta, @txb in struct 136 + * iwl_tx_queue) only have 32 entries, while the HW buffers (@tfds 137 + * in the same struct) have 256. 138 + * This means that we end up with the following: 139 + * HW entries: | 0 | ... | N * 32 | ... | N * 32 + 31 | ... | 255 | 140 + * SW entries: | 0 | ... | 31 | 141 + * where N is a number between 0 and 7. This means that the SW 142 + * data is a window overlayed over the HW queue. 123 143 */ 124 144 struct iwl_queue { 125 145 int n_bd; /* number of BDs in this queue */ ··· 177 165 178 166 struct iwl_tx_queue { 179 167 struct iwl_queue q; 180 - void *tfds; 168 + struct iwl_tfd *tfds; 181 169 struct iwl_device_cmd **cmd; 182 170 struct iwl_cmd_meta *meta; 183 171 struct iwl_tx_info *txb; ··· 259 247 CMD_SYNC = 0, 260 248 CMD_SIZE_NORMAL = 0, 261 249 CMD_NO_SKB = 0, 262 - CMD_SIZE_HUGE = (1 << 0), 263 250 CMD_ASYNC = (1 << 1), 264 251 CMD_WANT_SKB = (1 << 2), 265 252 CMD_MAPPED = (1 << 3), ··· 270 259 * struct iwl_device_cmd 271 260 * 272 261 * For allocation of the command and tx queues, this establishes the overall 273 - * size of the largest command we send to uCode, except for a scan command 274 - * (which is relatively huge; space is allocated separately). 262 + * size of the largest command we send to uCode, except for commands that 263 + * aren't fully copied and use other TFD space. 275 264 */ 276 265 struct iwl_device_cmd { 277 266 struct iwl_cmd_header hdr; /* uCode API */ ··· 288 277 289 278 #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd)) 290 279 280 + #define IWL_MAX_CMD_TFDS 2 281 + 282 + enum iwl_hcmd_dataflag { 283 + IWL_HCMD_DFL_NOCOPY = BIT(0), 284 + }; 291 285 292 286 struct iwl_host_cmd { 293 - const void *data; 287 + const void *data[IWL_MAX_CMD_TFDS]; 294 288 unsigned long reply_page; 295 289 void (*callback)(struct iwl_priv *priv, 296 290 struct iwl_device_cmd *cmd, 297 291 struct iwl_rx_packet *pkt); 298 292 u32 flags; 299 - u16 len; 293 + u16 len[IWL_MAX_CMD_TFDS]; 294 + u8 dataflags[IWL_MAX_CMD_TFDS]; 300 295 u8 id; 301 296 }; 302 297 ··· 705 688 } 706 689 707 690 708 - static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) 691 + static inline u8 get_cmd_index(struct iwl_queue *q, u32 index) 709 692 { 710 - /* 711 - * This is for init calibration result and scan command which 712 - * required buffer > TFD_MAX_PAYLOAD_SIZE, 713 - * the big buffer at end of command array 714 - */ 715 - if (is_huge) 716 - return q->n_window; /* must be power of 2 */ 717 - 718 - /* Otherwise, use normal size buffers */ 719 693 return index & (q->n_window - 1); 720 694 } 721 695 ··· 1179 1171 IWL_SCAN_OFFCH_TX, 1180 1172 }; 1181 1173 1174 + #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL 1175 + struct iwl_testmode_trace { 1176 + u8 *cpu_addr; 1177 + u8 *trace_addr; 1178 + dma_addr_t dma_addr; 1179 + bool trace_enabled; 1180 + }; 1181 + #endif 1182 1182 struct iwl_priv { 1183 1183 1184 1184 /* ieee device used by generic ieee processing code */ ··· 1468 1452 struct work_struct beacon_update; 1469 1453 struct iwl_rxon_context *beacon_ctx; 1470 1454 struct sk_buff *beacon_skb; 1455 + void *beacon_cmd; 1471 1456 1472 1457 struct work_struct tt_work; 1473 1458 struct work_struct ct_enter; ··· 1518 1501 struct led_classdev led; 1519 1502 unsigned long blink_on, blink_off; 1520 1503 bool led_registered; 1504 + #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL 1505 + struct iwl_testmode_trace testmode_trace; 1506 + #endif 1507 + u32 dbg_fixed_rate; 1508 + 1521 1509 }; /*iwl_priv */ 1522 1510 1523 1511 static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id)
+44 -14
drivers/net/wireless/iwlwifi/iwl-devtrace.h
··· 137 137 #define TRACE_SYSTEM iwlwifi 138 138 139 139 TRACE_EVENT(iwlwifi_dev_hcmd, 140 - TP_PROTO(struct iwl_priv *priv, void *hcmd, size_t len, u32 flags), 141 - TP_ARGS(priv, hcmd, len, flags), 140 + TP_PROTO(struct iwl_priv *priv, u32 flags, 141 + const void *hcmd0, size_t len0, 142 + const void *hcmd1, size_t len1, 143 + const void *hcmd2, size_t len2), 144 + TP_ARGS(priv, flags, hcmd0, len0, hcmd1, len1, hcmd2, len2), 142 145 TP_STRUCT__entry( 143 146 PRIV_ENTRY 144 - __dynamic_array(u8, hcmd, len) 147 + __dynamic_array(u8, hcmd0, len0) 148 + __dynamic_array(u8, hcmd1, len1) 149 + __dynamic_array(u8, hcmd2, len2) 145 150 __field(u32, flags) 146 151 ), 147 152 TP_fast_assign( 148 153 PRIV_ASSIGN; 149 - memcpy(__get_dynamic_array(hcmd), hcmd, len); 154 + memcpy(__get_dynamic_array(hcmd0), hcmd0, len0); 155 + memcpy(__get_dynamic_array(hcmd1), hcmd1, len1); 156 + memcpy(__get_dynamic_array(hcmd2), hcmd2, len2); 150 157 __entry->flags = flags; 151 158 ), 152 159 TP_printk("[%p] hcmd %#.2x (%ssync)", 153 - __entry->priv, ((u8 *)__get_dynamic_array(hcmd))[0], 160 + __entry->priv, ((u8 *)__get_dynamic_array(hcmd0))[0], 154 161 __entry->flags & CMD_ASYNC ? "a" : "") 155 162 ); 156 163 ··· 209 202 ); 210 203 211 204 TRACE_EVENT(iwlwifi_dev_ucode_error, 212 - TP_PROTO(struct iwl_priv *priv, u32 desc, u32 time, 205 + TP_PROTO(struct iwl_priv *priv, u32 desc, u32 tsf_low, 213 206 u32 data1, u32 data2, u32 line, u32 blink1, 214 - u32 blink2, u32 ilink1, u32 ilink2), 215 - TP_ARGS(priv, desc, time, data1, data2, line, 216 - blink1, blink2, ilink1, ilink2), 207 + u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time, 208 + u32 gp1, u32 gp2, u32 gp3, u32 ucode_ver, u32 hw_ver, 209 + u32 brd_ver), 210 + TP_ARGS(priv, desc, tsf_low, data1, data2, line, 211 + blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2, 212 + gp3, ucode_ver, hw_ver, brd_ver), 217 213 TP_STRUCT__entry( 218 214 PRIV_ENTRY 219 215 __field(u32, desc) 220 - __field(u32, time) 216 + __field(u32, tsf_low) 221 217 __field(u32, data1) 222 218 __field(u32, data2) 223 219 __field(u32, line) ··· 228 218 __field(u32, blink2) 229 219 __field(u32, ilink1) 230 220 __field(u32, ilink2) 221 + __field(u32, bcon_time) 222 + __field(u32, gp1) 223 + __field(u32, gp2) 224 + __field(u32, gp3) 225 + __field(u32, ucode_ver) 226 + __field(u32, hw_ver) 227 + __field(u32, brd_ver) 231 228 ), 232 229 TP_fast_assign( 233 230 PRIV_ASSIGN; 234 231 __entry->desc = desc; 235 - __entry->time = time; 232 + __entry->tsf_low = tsf_low; 236 233 __entry->data1 = data1; 237 234 __entry->data2 = data2; 238 235 __entry->line = line; ··· 247 230 __entry->blink2 = blink2; 248 231 __entry->ilink1 = ilink1; 249 232 __entry->ilink2 = ilink2; 233 + __entry->bcon_time = bcon_time; 234 + __entry->gp1 = gp1; 235 + __entry->gp2 = gp2; 236 + __entry->gp3 = gp3; 237 + __entry->ucode_ver = ucode_ver; 238 + __entry->hw_ver = hw_ver; 239 + __entry->brd_ver = brd_ver; 250 240 ), 251 241 TP_printk("[%p] #%02d %010u data 0x%08X 0x%08X line %u, " 252 - "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X", 253 - __entry->priv, __entry->desc, __entry->time, __entry->data1, 242 + "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X " 243 + "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X uCode 0x%08X " 244 + "hw 0x%08X brd 0x%08X", 245 + __entry->priv, __entry->desc, __entry->tsf_low, 246 + __entry->data1, 254 247 __entry->data2, __entry->line, __entry->blink1, 255 - __entry->blink2, __entry->ilink1, __entry->ilink2) 248 + __entry->blink2, __entry->ilink1, __entry->ilink2, 249 + __entry->bcon_time, __entry->gp1, __entry->gp2, 250 + __entry->gp3, __entry->ucode_ver, __entry->hw_ver, 251 + __entry->brd_ver) 256 252 ); 257 253 258 254 TRACE_EVENT(iwlwifi_dev_ucode_event,
+3 -4
drivers/net/wireless/iwlwifi/iwl-eeprom.c
··· 216 216 217 217 static void iwl_set_otp_access(struct iwl_priv *priv, enum iwl_access_mode mode) 218 218 { 219 - u32 otpgp; 219 + iwl_read32(priv, CSR_OTP_GP_REG); 220 220 221 - otpgp = iwl_read32(priv, CSR_OTP_GP_REG); 222 221 if (mode == IWL_OTP_ACCESS_ABSOLUTE) 223 222 iwl_clear_bit(priv, CSR_OTP_GP_REG, 224 - CSR_OTP_GP_REG_OTP_ACCESS_MODE); 223 + CSR_OTP_GP_REG_OTP_ACCESS_MODE); 225 224 else 226 225 iwl_set_bit(priv, CSR_OTP_GP_REG, 227 - CSR_OTP_GP_REG_OTP_ACCESS_MODE); 226 + CSR_OTP_GP_REG_OTP_ACCESS_MODE); 228 227 } 229 228 230 229 static int iwlcore_get_nvm_type(struct iwl_priv *priv, u32 hw_rev)
+5 -4
drivers/net/wireless/iwlwifi/iwl-hcmd.c
··· 188 188 cmd_idx = iwl_enqueue_hcmd(priv, cmd); 189 189 if (cmd_idx < 0) { 190 190 ret = cmd_idx; 191 + clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 191 192 IWL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n", 192 193 get_cmd_string(cmd->id), ret); 193 194 return ret; ··· 265 264 { 266 265 struct iwl_host_cmd cmd = { 267 266 .id = id, 268 - .len = len, 269 - .data = data, 267 + .len = { len, }, 268 + .data = { data, }, 270 269 }; 271 270 272 271 return iwl_send_cmd_sync(priv, &cmd); ··· 280 279 { 281 280 struct iwl_host_cmd cmd = { 282 281 .id = id, 283 - .len = len, 284 - .data = data, 282 + .len = { len, }, 283 + .data = { data, }, 285 284 }; 286 285 287 286 cmd.flags |= CMD_ASYNC;
+2 -2
drivers/net/wireless/iwlwifi/iwl-led.c
··· 107 107 { 108 108 struct iwl_host_cmd cmd = { 109 109 .id = REPLY_LEDS_CMD, 110 - .len = sizeof(struct iwl_led_cmd), 111 - .data = led_cmd, 110 + .len = { sizeof(struct iwl_led_cmd), }, 111 + .data = { led_cmd, }, 112 112 .flags = CMD_ASYNC, 113 113 .callback = NULL, 114 114 };
+6 -6
drivers/net/wireless/iwlwifi/iwl-sta.c
··· 141 141 struct iwl_host_cmd cmd = { 142 142 .id = REPLY_ADD_STA, 143 143 .flags = flags, 144 - .data = data, 144 + .data = { data, }, 145 145 }; 146 146 u8 sta_id __maybe_unused = sta->sta.sta_id; 147 147 ··· 155 155 might_sleep(); 156 156 } 157 157 158 - cmd.len = priv->cfg->ops->utils->build_addsta_hcmd(sta, data); 158 + cmd.len[0] = priv->cfg->ops->utils->build_addsta_hcmd(sta, data); 159 159 ret = iwl_send_cmd(priv, &cmd); 160 160 161 161 if (ret || (flags & CMD_ASYNC)) ··· 401 401 402 402 struct iwl_host_cmd cmd = { 403 403 .id = REPLY_REMOVE_STA, 404 - .len = sizeof(struct iwl_rem_sta_cmd), 404 + .len = { sizeof(struct iwl_rem_sta_cmd), }, 405 405 .flags = CMD_SYNC, 406 - .data = &rm_sta_cmd, 406 + .data = { &rm_sta_cmd, }, 407 407 }; 408 408 409 409 memset(&rm_sta_cmd, 0, sizeof(rm_sta_cmd)); ··· 760 760 761 761 struct iwl_host_cmd cmd = { 762 762 .id = REPLY_TX_LINK_QUALITY_CMD, 763 - .len = sizeof(struct iwl_link_quality_cmd), 763 + .len = { sizeof(struct iwl_link_quality_cmd), }, 764 764 .flags = flags, 765 - .data = lq, 765 + .data = { lq, }, 766 766 }; 767 767 768 768 if (WARN_ON(lq->sta_id == IWL_INVALID_STATION))
+174 -3
drivers/net/wireless/iwlwifi/iwl-sv-open.c
··· 97 97 98 98 [IWL_TM_ATTR_SYNC_RSP] = { .type = NLA_UNSPEC, }, 99 99 [IWL_TM_ATTR_UCODE_RX_PKT] = { .type = NLA_UNSPEC, }, 100 + 101 + [IWL_TM_ATTR_EEPROM] = { .type = NLA_UNSPEC, }, 102 + 103 + [IWL_TM_ATTR_TRACE_ADDR] = { .type = NLA_UNSPEC, }, 104 + [IWL_TM_ATTR_TRACE_DATA] = { .type = NLA_UNSPEC, }, 105 + 106 + [IWL_TM_ATTR_FIXRATE] = { .type = NLA_U32, }, 100 107 }; 101 108 102 109 /* ··· 174 167 void iwl_testmode_init(struct iwl_priv *priv) 175 168 { 176 169 priv->pre_rx_handler = iwl_testmode_ucode_rx_pkt; 170 + priv->testmode_trace.trace_enabled = false; 171 + } 172 + 173 + static void iwl_trace_cleanup(struct iwl_priv *priv) 174 + { 175 + struct device *dev = &priv->pci_dev->dev; 176 + 177 + if (priv->testmode_trace.trace_enabled) { 178 + if (priv->testmode_trace.cpu_addr && 179 + priv->testmode_trace.dma_addr) 180 + dma_free_coherent(dev, 181 + TRACE_TOTAL_SIZE, 182 + priv->testmode_trace.cpu_addr, 183 + priv->testmode_trace.dma_addr); 184 + priv->testmode_trace.trace_enabled = false; 185 + priv->testmode_trace.cpu_addr = NULL; 186 + priv->testmode_trace.trace_addr = NULL; 187 + priv->testmode_trace.dma_addr = 0; 188 + } 189 + } 190 + 191 + 192 + void iwl_testmode_cleanup(struct iwl_priv *priv) 193 + { 194 + iwl_trace_cleanup(priv); 177 195 } 178 196 179 197 /* ··· 230 198 } 231 199 232 200 cmd.id = nla_get_u8(tb[IWL_TM_ATTR_UCODE_CMD_ID]); 233 - cmd.data = nla_data(tb[IWL_TM_ATTR_UCODE_CMD_DATA]); 234 - cmd.len = nla_len(tb[IWL_TM_ATTR_UCODE_CMD_DATA]); 201 + cmd.data[0] = nla_data(tb[IWL_TM_ATTR_UCODE_CMD_DATA]); 202 + cmd.len[0] = nla_len(tb[IWL_TM_ATTR_UCODE_CMD_DATA]); 203 + cmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY; 235 204 IWL_INFO(priv, "testmode ucode command ID 0x%x, flags 0x%x," 236 - " len %d\n", cmd.id, cmd.flags, cmd.len); 205 + " len %d\n", cmd.id, cmd.flags, cmd.len[0]); 237 206 /* ok, let's submit the command to ucode */ 238 207 return iwl_send_cmd(priv, &cmd); 239 208 } ··· 421 388 "Error starting the device: %d\n", status); 422 389 break; 423 390 391 + case IWL_TM_CMD_APP2DEV_GET_EEPROM: 392 + if (priv->eeprom) { 393 + skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 394 + priv->cfg->base_params->eeprom_size + 20); 395 + if (!skb) { 396 + IWL_DEBUG_INFO(priv, 397 + "Error allocating memory\n"); 398 + return -ENOMEM; 399 + } 400 + NLA_PUT_U32(skb, IWL_TM_ATTR_COMMAND, 401 + IWL_TM_CMD_DEV2APP_EEPROM_RSP); 402 + NLA_PUT(skb, IWL_TM_ATTR_EEPROM, 403 + priv->cfg->base_params->eeprom_size, 404 + priv->eeprom); 405 + status = cfg80211_testmode_reply(skb); 406 + if (status < 0) 407 + IWL_DEBUG_INFO(priv, 408 + "Error sending msg : %d\n", 409 + status); 410 + } else 411 + return -EFAULT; 412 + break; 413 + 414 + case IWL_TM_CMD_APP2DEV_FIXRATE_REQ: 415 + if (!tb[IWL_TM_ATTR_FIXRATE]) { 416 + IWL_DEBUG_INFO(priv, 417 + "Error finding fixrate setting\n"); 418 + return -ENOMSG; 419 + } 420 + priv->dbg_fixed_rate = nla_get_u32(tb[IWL_TM_ATTR_FIXRATE]); 421 + break; 422 + 424 423 default: 425 424 IWL_DEBUG_INFO(priv, "Unknown testmode driver command ID\n"); 426 425 return -ENOSYS; ··· 461 396 462 397 nla_put_failure: 463 398 kfree_skb(skb); 399 + return -EMSGSIZE; 400 + } 401 + 402 + 403 + /* 404 + * This function handles the user application commands for uCode trace 405 + * 406 + * It retrieves command ID carried with IWL_TM_ATTR_COMMAND and calls to the 407 + * handlers respectively. 408 + * 409 + * If it's an unknown commdn ID, -ENOSYS is replied; otherwise, the returned 410 + * value of the actual command execution is replied to the user application. 411 + * 412 + * @hw: ieee80211_hw object that represents the device 413 + * @tb: gnl message fields from the user space 414 + */ 415 + static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb) 416 + { 417 + struct iwl_priv *priv = hw->priv; 418 + struct sk_buff *skb; 419 + int status = 0; 420 + struct device *dev = &priv->pci_dev->dev; 421 + 422 + switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { 423 + case IWL_TM_CMD_APP2DEV_BEGIN_TRACE: 424 + if (priv->testmode_trace.trace_enabled) 425 + return -EBUSY; 426 + 427 + priv->testmode_trace.cpu_addr = 428 + dma_alloc_coherent(dev, 429 + TRACE_TOTAL_SIZE, 430 + &priv->testmode_trace.dma_addr, 431 + GFP_KERNEL); 432 + if (!priv->testmode_trace.cpu_addr) 433 + return -ENOMEM; 434 + priv->testmode_trace.trace_enabled = true; 435 + priv->testmode_trace.trace_addr = (u8 *)PTR_ALIGN( 436 + priv->testmode_trace.cpu_addr, 0x100); 437 + memset(priv->testmode_trace.trace_addr, 0x03B, 438 + TRACE_BUFF_SIZE); 439 + skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 440 + sizeof(priv->testmode_trace.dma_addr) + 20); 441 + if (!skb) { 442 + IWL_DEBUG_INFO(priv, 443 + "Error allocating memory\n"); 444 + iwl_trace_cleanup(priv); 445 + return -ENOMEM; 446 + } 447 + NLA_PUT(skb, IWL_TM_ATTR_TRACE_ADDR, 448 + sizeof(priv->testmode_trace.dma_addr), 449 + (u64 *)&priv->testmode_trace.dma_addr); 450 + status = cfg80211_testmode_reply(skb); 451 + if (status < 0) { 452 + IWL_DEBUG_INFO(priv, 453 + "Error sending msg : %d\n", 454 + status); 455 + } 456 + break; 457 + 458 + case IWL_TM_CMD_APP2DEV_END_TRACE: 459 + iwl_trace_cleanup(priv); 460 + break; 461 + 462 + case IWL_TM_CMD_APP2DEV_READ_TRACE: 463 + if (priv->testmode_trace.trace_enabled && 464 + priv->testmode_trace.trace_addr) { 465 + skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 466 + 20 + TRACE_BUFF_SIZE); 467 + if (skb == NULL) { 468 + IWL_DEBUG_INFO(priv, 469 + "Error allocating memory\n"); 470 + return -ENOMEM; 471 + } 472 + NLA_PUT(skb, IWL_TM_ATTR_TRACE_DATA, 473 + TRACE_BUFF_SIZE, 474 + priv->testmode_trace.trace_addr); 475 + status = cfg80211_testmode_reply(skb); 476 + if (status < 0) { 477 + IWL_DEBUG_INFO(priv, 478 + "Error sending msg : %d\n", status); 479 + } 480 + } else 481 + return -EFAULT; 482 + break; 483 + 484 + default: 485 + IWL_DEBUG_INFO(priv, "Unknown testmode mem command ID\n"); 486 + return -ENOSYS; 487 + } 488 + return status; 489 + 490 + nla_put_failure: 491 + kfree_skb(skb); 492 + if (nla_get_u32(tb[IWL_TM_ATTR_COMMAND]) == 493 + IWL_TM_CMD_APP2DEV_BEGIN_TRACE) 494 + iwl_trace_cleanup(priv); 464 495 return -EMSGSIZE; 465 496 } 466 497 ··· 616 455 case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW: 617 456 case IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB: 618 457 case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW: 458 + case IWL_TM_CMD_APP2DEV_GET_EEPROM: 459 + case IWL_TM_CMD_APP2DEV_FIXRATE_REQ: 619 460 IWL_DEBUG_INFO(priv, "testmode cmd to driver\n"); 620 461 result = iwl_testmode_driver(hw, tb); 621 462 break; 463 + 464 + case IWL_TM_CMD_APP2DEV_BEGIN_TRACE: 465 + case IWL_TM_CMD_APP2DEV_END_TRACE: 466 + case IWL_TM_CMD_APP2DEV_READ_TRACE: 467 + IWL_DEBUG_INFO(priv, "testmode uCode trace cmd to driver\n"); 468 + result = iwl_testmode_trace(hw, tb); 469 + break; 470 + 622 471 default: 623 472 IWL_DEBUG_INFO(priv, "Unknown testmode command\n"); 624 473 result = -ENOSYS;
+34
drivers/net/wireless/iwlwifi/iwl-testmode.h
··· 88 88 IWL_TM_CMD_APP2DEV_LOAD_INIT_FW, 89 89 IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB, 90 90 IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW, 91 + IWL_TM_CMD_APP2DEV_GET_EEPROM, 92 + IWL_TM_CMD_APP2DEV_FIXRATE_REQ, 91 93 /* if there is other new command for the driver layer operation, 92 94 * append them here */ 93 95 96 + /* commands fom user space for uCode trace operations */ 97 + IWL_TM_CMD_APP2DEV_BEGIN_TRACE, 98 + IWL_TM_CMD_APP2DEV_END_TRACE, 99 + IWL_TM_CMD_APP2DEV_READ_TRACE, 94 100 95 101 /* commands from kernel space to carry the synchronous response 96 102 * to user application */ ··· 105 99 /* commands from kernel space to multicast the spontaneous messages 106 100 * to user application */ 107 101 IWL_TM_CMD_DEV2APP_UCODE_RX_PKT, 102 + 103 + /* commands from kernel space to carry the eeprom response 104 + * to user application */ 105 + IWL_TM_CMD_DEV2APP_EEPROM_RSP, 106 + 108 107 IWL_TM_CMD_MAX, 109 108 }; 110 109 ··· 155 144 * application */ 156 145 IWL_TM_ATTR_UCODE_RX_PKT, 157 146 147 + /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_EEPROM, 148 + * The mandatory fields are: 149 + * IWL_TM_ATTR_EEPROM for the data content responging to the user 150 + * application */ 151 + IWL_TM_ATTR_EEPROM, 152 + 153 + /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_XXX_TRACE, 154 + * The mandatory fields are: 155 + * IWL_TM_ATTR_MEM_TRACE_ADDR for the trace address 156 + */ 157 + IWL_TM_ATTR_TRACE_ADDR, 158 + IWL_TM_ATTR_TRACE_DATA, 159 + 160 + /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_FIXRATE_REQ, 161 + * The mandatory fields are: 162 + * IWL_TM_ATTR_FIXRATE for the fixed rate 163 + */ 164 + IWL_TM_ATTR_FIXRATE, 165 + 158 166 IWL_TM_ATTR_MAX, 159 167 }; 160 168 169 + /* uCode trace buffer */ 170 + #define TRACE_BUFF_SIZE 0x20000 171 + #define TRACE_BUFF_PADD 0x2000 172 + #define TRACE_TOTAL_SIZE (TRACE_BUFF_SIZE + TRACE_BUFF_PADD) 161 173 162 174 #endif
+265 -97
drivers/net/wireless/iwlwifi/iwl-tx.c
··· 32 32 #include <linux/slab.h> 33 33 #include <net/mac80211.h> 34 34 #include "iwl-eeprom.h" 35 + #include "iwl-agn.h" 35 36 #include "iwl-dev.h" 36 37 #include "iwl-core.h" 37 38 #include "iwl-sta.h" ··· 86 85 txq->need_update = 0; 87 86 } 88 87 88 + static inline dma_addr_t iwl_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx) 89 + { 90 + struct iwl_tfd_tb *tb = &tfd->tbs[idx]; 91 + 92 + dma_addr_t addr = get_unaligned_le32(&tb->lo); 93 + if (sizeof(dma_addr_t) > sizeof(u32)) 94 + addr |= 95 + ((dma_addr_t)(le16_to_cpu(tb->hi_n_len) & 0xF) << 16) << 16; 96 + 97 + return addr; 98 + } 99 + 100 + static inline u16 iwl_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx) 101 + { 102 + struct iwl_tfd_tb *tb = &tfd->tbs[idx]; 103 + 104 + return le16_to_cpu(tb->hi_n_len) >> 4; 105 + } 106 + 107 + static inline void iwl_tfd_set_tb(struct iwl_tfd *tfd, u8 idx, 108 + dma_addr_t addr, u16 len) 109 + { 110 + struct iwl_tfd_tb *tb = &tfd->tbs[idx]; 111 + u16 hi_n_len = len << 4; 112 + 113 + put_unaligned_le32(addr, &tb->lo); 114 + if (sizeof(dma_addr_t) > sizeof(u32)) 115 + hi_n_len |= ((addr >> 16) >> 16) & 0xF; 116 + 117 + tb->hi_n_len = cpu_to_le16(hi_n_len); 118 + 119 + tfd->num_tbs = idx + 1; 120 + } 121 + 122 + static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd) 123 + { 124 + return tfd->num_tbs & 0x1f; 125 + } 126 + 127 + static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta, 128 + struct iwl_tfd *tfd) 129 + { 130 + struct pci_dev *dev = priv->pci_dev; 131 + int i; 132 + int num_tbs; 133 + 134 + /* Sanity check on number of chunks */ 135 + num_tbs = iwl_tfd_get_num_tbs(tfd); 136 + 137 + if (num_tbs >= IWL_NUM_OF_TBS) { 138 + IWL_ERR(priv, "Too many chunks: %i\n", num_tbs); 139 + /* @todo issue fatal error, it is quite serious situation */ 140 + return; 141 + } 142 + 143 + /* Unmap tx_cmd */ 144 + if (num_tbs) 145 + pci_unmap_single(dev, 146 + dma_unmap_addr(meta, mapping), 147 + dma_unmap_len(meta, len), 148 + PCI_DMA_BIDIRECTIONAL); 149 + 150 + /* Unmap chunks, if any. */ 151 + for (i = 1; i < num_tbs; i++) 152 + pci_unmap_single(dev, iwl_tfd_tb_get_addr(tfd, i), 153 + iwl_tfd_tb_get_len(tfd, i), PCI_DMA_TODEVICE); 154 + } 155 + 156 + /** 157 + * iwlagn_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] 158 + * @priv - driver private data 159 + * @txq - tx queue 160 + * 161 + * Does NOT advance any TFD circular buffer read/write indexes 162 + * Does NOT free the TFD itself (which is within circular buffer) 163 + */ 164 + void iwlagn_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) 165 + { 166 + struct iwl_tfd *tfd_tmp = txq->tfds; 167 + int index = txq->q.read_ptr; 168 + 169 + iwlagn_unmap_tfd(priv, &txq->meta[index], &tfd_tmp[index]); 170 + 171 + /* free SKB */ 172 + if (txq->txb) { 173 + struct sk_buff *skb; 174 + 175 + skb = txq->txb[txq->q.read_ptr].skb; 176 + 177 + /* can be called from irqs-disabled context */ 178 + if (skb) { 179 + dev_kfree_skb_any(skb); 180 + txq->txb[txq->q.read_ptr].skb = NULL; 181 + } 182 + } 183 + } 184 + 185 + int iwlagn_txq_attach_buf_to_tfd(struct iwl_priv *priv, 186 + struct iwl_tx_queue *txq, 187 + dma_addr_t addr, u16 len, 188 + u8 reset) 189 + { 190 + struct iwl_queue *q; 191 + struct iwl_tfd *tfd, *tfd_tmp; 192 + u32 num_tbs; 193 + 194 + q = &txq->q; 195 + tfd_tmp = txq->tfds; 196 + tfd = &tfd_tmp[q->write_ptr]; 197 + 198 + if (reset) 199 + memset(tfd, 0, sizeof(*tfd)); 200 + 201 + num_tbs = iwl_tfd_get_num_tbs(tfd); 202 + 203 + /* Each TFD can point to a maximum 20 Tx buffers */ 204 + if (num_tbs >= IWL_NUM_OF_TBS) { 205 + IWL_ERR(priv, "Error can not send more than %d chunks\n", 206 + IWL_NUM_OF_TBS); 207 + return -EINVAL; 208 + } 209 + 210 + if (WARN_ON(addr & ~DMA_BIT_MASK(36))) 211 + return -EINVAL; 212 + 213 + if (unlikely(addr & ~IWL_TX_DMA_MASK)) 214 + IWL_ERR(priv, "Unaligned address = %llx\n", 215 + (unsigned long long)addr); 216 + 217 + iwl_tfd_set_tb(tfd, num_tbs, addr, len); 218 + 219 + return 0; 220 + } 221 + 222 + /* 223 + * Tell nic where to find circular buffer of Tx Frame Descriptors for 224 + * given Tx queue, and enable the DMA channel used for that queue. 225 + * 226 + * supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA 227 + * channels supported in hardware. 228 + */ 229 + static int iwlagn_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq) 230 + { 231 + int txq_id = txq->q.id; 232 + 233 + /* Circular buffer (TFD queue in DRAM) physical base address */ 234 + iwl_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), 235 + txq->q.dma_addr >> 8); 236 + 237 + return 0; 238 + } 239 + 89 240 /** 90 241 * iwl_tx_queue_unmap - Unmap any remaining DMA mappings and free skb's 91 242 */ ··· 250 97 return; 251 98 252 99 while (q->write_ptr != q->read_ptr) { 253 - priv->cfg->ops->lib->txq_free_tfd(priv, txq); 100 + iwlagn_txq_free_tfd(priv, txq); 254 101 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd); 255 102 } 256 103 } ··· 307 154 return; 308 155 309 156 while (q->read_ptr != q->write_ptr) { 310 - i = get_cmd_index(q, q->read_ptr, 0); 157 + i = get_cmd_index(q, q->read_ptr); 311 158 312 159 if (txq->meta[i].flags & CMD_MAPPED) { 313 160 pci_unmap_single(priv->pci_dev, ··· 318 165 } 319 166 320 167 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd); 321 - } 322 - 323 - i = q->n_window; 324 - if (txq->meta[i].flags & CMD_MAPPED) { 325 - pci_unmap_single(priv->pci_dev, 326 - dma_unmap_addr(&txq->meta[i], mapping), 327 - dma_unmap_len(&txq->meta[i], len), 328 - PCI_DMA_BIDIRECTIONAL); 329 - txq->meta[i].flags = 0; 330 168 } 331 169 } 332 170 ··· 338 194 iwl_cmd_queue_unmap(priv); 339 195 340 196 /* De-alloc array of command/tx buffers */ 341 - for (i = 0; i <= TFD_CMD_SLOTS; i++) 197 + for (i = 0; i < TFD_CMD_SLOTS; i++) 342 198 kfree(txq->cmd[i]); 343 199 344 200 /* De-alloc circular buffer of TFDs */ ··· 478 334 { 479 335 int i, len; 480 336 int ret; 481 - int actual_slots = slots_num; 482 337 483 - /* 484 - * Alloc buffer array for commands (Tx or other types of commands). 485 - * For the command queue (#4/#9), allocate command space + one big 486 - * command for scan, since scan command is very huge; the system will 487 - * not have two scans at the same time, so only one is needed. 488 - * For normal Tx queues (all other queues), no super-size command 489 - * space is needed. 490 - */ 491 - if (txq_id == priv->cmd_queue) 492 - actual_slots++; 493 - 494 - txq->meta = kzalloc(sizeof(struct iwl_cmd_meta) * actual_slots, 338 + txq->meta = kzalloc(sizeof(struct iwl_cmd_meta) * slots_num, 495 339 GFP_KERNEL); 496 - txq->cmd = kzalloc(sizeof(struct iwl_device_cmd *) * actual_slots, 340 + txq->cmd = kzalloc(sizeof(struct iwl_device_cmd *) * slots_num, 497 341 GFP_KERNEL); 498 342 499 343 if (!txq->meta || !txq->cmd) 500 344 goto out_free_arrays; 501 345 502 346 len = sizeof(struct iwl_device_cmd); 503 - for (i = 0; i < actual_slots; i++) { 504 - /* only happens for cmd queue */ 505 - if (i == slots_num) 506 - len = IWL_MAX_CMD_SIZE; 507 - 347 + for (i = 0; i < slots_num; i++) { 508 348 txq->cmd[i] = kmalloc(len, GFP_KERNEL); 509 349 if (!txq->cmd[i]) 510 350 goto err; ··· 519 391 return ret; 520 392 521 393 /* Tell device where to find queue */ 522 - priv->cfg->ops->lib->txq_init(priv, txq); 394 + iwlagn_tx_queue_init(priv, txq); 523 395 524 396 return 0; 525 397 err: 526 - for (i = 0; i < actual_slots; i++) 398 + for (i = 0; i < slots_num; i++) 527 399 kfree(txq->cmd[i]); 528 400 out_free_arrays: 529 401 kfree(txq->meta); ··· 548 420 iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id); 549 421 550 422 /* Tell device where to find queue */ 551 - priv->cfg->ops->lib->txq_init(priv, txq); 423 + iwlagn_tx_queue_init(priv, txq); 552 424 } 553 425 554 426 /*************** HOST COMMAND QUEUE FUNCTIONS *****/ ··· 571 443 dma_addr_t phys_addr; 572 444 unsigned long flags; 573 445 u32 idx; 574 - u16 fix_size; 446 + u16 copy_size, cmd_size; 575 447 bool is_ct_kill = false; 448 + bool had_nocopy = false; 449 + int i; 450 + u8 *cmd_dest; 451 + #ifdef CONFIG_IWLWIFI_DEVICE_TRACING 452 + const void *trace_bufs[IWL_MAX_CMD_TFDS + 1] = {}; 453 + int trace_lens[IWL_MAX_CMD_TFDS + 1] = {}; 454 + int trace_idx; 455 + #endif 576 456 577 - fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); 457 + if (test_bit(STATUS_FW_ERROR, &priv->status)) { 458 + IWL_WARN(priv, "fw recovery, no hcmd send\n"); 459 + return -EIO; 460 + } 461 + 462 + copy_size = sizeof(out_cmd->hdr); 463 + cmd_size = sizeof(out_cmd->hdr); 464 + 465 + /* need one for the header if the first is NOCOPY */ 466 + BUILD_BUG_ON(IWL_MAX_CMD_TFDS > IWL_NUM_OF_TBS - 1); 467 + 468 + for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { 469 + if (!cmd->len[i]) 470 + continue; 471 + if (cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY) { 472 + had_nocopy = true; 473 + } else { 474 + /* NOCOPY must not be followed by normal! */ 475 + if (WARN_ON(had_nocopy)) 476 + return -EINVAL; 477 + copy_size += cmd->len[i]; 478 + } 479 + cmd_size += cmd->len[i]; 480 + } 578 481 579 482 /* 580 483 * If any of the command structures end up being larger than 581 - * the TFD_MAX_PAYLOAD_SIZE, and it sent as a 'small' command then 582 - * we will need to increase the size of the TFD entries 583 - * Also, check to see if command buffer should not exceed the size 584 - * of device_cmd and max_cmd_size. 484 + * the TFD_MAX_PAYLOAD_SIZE and they aren't dynamically 485 + * allocated into separate TFDs, then we will need to 486 + * increase the size of the buffers. 585 487 */ 586 - if (WARN_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && 587 - !(cmd->flags & CMD_SIZE_HUGE))) 588 - return -EINVAL; 589 - 590 - if (WARN_ON(fix_size > IWL_MAX_CMD_SIZE)) 488 + if (WARN_ON(copy_size > TFD_MAX_PAYLOAD_SIZE)) 591 489 return -EINVAL; 592 490 593 491 if (iwl_is_rfkill(priv) || iwl_is_ctkill(priv)) { ··· 621 467 iwl_is_rfkill(priv) ? "RF" : "CT"); 622 468 return -EIO; 623 469 } 624 - 625 - /* 626 - * As we only have a single huge buffer, check that the command 627 - * is synchronous (otherwise buffers could end up being reused). 628 - */ 629 - 630 - if (WARN_ON((cmd->flags & CMD_ASYNC) && (cmd->flags & CMD_SIZE_HUGE))) 631 - return -EINVAL; 632 470 633 471 spin_lock_irqsave(&priv->hcmd_lock, flags); 634 472 ··· 636 490 return -ENOSPC; 637 491 } 638 492 639 - idx = get_cmd_index(q, q->write_ptr, cmd->flags & CMD_SIZE_HUGE); 493 + idx = get_cmd_index(q, q->write_ptr); 640 494 out_cmd = txq->cmd[idx]; 641 495 out_meta = &txq->meta[idx]; 642 496 ··· 651 505 if (cmd->flags & CMD_ASYNC) 652 506 out_meta->callback = cmd->callback; 653 507 508 + /* set up the header */ 509 + 654 510 out_cmd->hdr.cmd = cmd->id; 655 - memcpy(&out_cmd->cmd.payload, cmd->data, cmd->len); 656 - 657 - /* At this point, the out_cmd now has all of the incoming cmd 658 - * information */ 659 - 660 511 out_cmd->hdr.flags = 0; 661 512 out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(priv->cmd_queue) | 662 - INDEX_TO_SEQ(q->write_ptr)); 663 - if (cmd->flags & CMD_SIZE_HUGE) 664 - out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; 513 + INDEX_TO_SEQ(q->write_ptr)); 665 514 666 - #ifdef CONFIG_IWLWIFI_DEBUG 667 - switch (out_cmd->hdr.cmd) { 668 - case REPLY_TX_LINK_QUALITY_CMD: 669 - case SENSITIVITY_CMD: 670 - IWL_DEBUG_HC_DUMP(priv, "Sending command %s (#%x), seq: 0x%04X, " 671 - "%d bytes at %d[%d]:%d\n", 672 - get_cmd_string(out_cmd->hdr.cmd), 673 - out_cmd->hdr.cmd, 674 - le16_to_cpu(out_cmd->hdr.sequence), fix_size, 675 - q->write_ptr, idx, priv->cmd_queue); 676 - break; 677 - default: 678 - IWL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, " 679 - "%d bytes at %d[%d]:%d\n", 680 - get_cmd_string(out_cmd->hdr.cmd), 681 - out_cmd->hdr.cmd, 682 - le16_to_cpu(out_cmd->hdr.sequence), fix_size, 683 - q->write_ptr, idx, priv->cmd_queue); 515 + /* and copy the data that needs to be copied */ 516 + 517 + cmd_dest = &out_cmd->cmd.payload[0]; 518 + for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { 519 + if (!cmd->len[i]) 520 + continue; 521 + if (cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY) 522 + break; 523 + memcpy(cmd_dest, cmd->data[i], cmd->len[i]); 524 + cmd_dest += cmd->len[i]; 684 525 } 685 - #endif 526 + 527 + IWL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, " 528 + "%d bytes at %d[%d]:%d\n", 529 + get_cmd_string(out_cmd->hdr.cmd), 530 + out_cmd->hdr.cmd, 531 + le16_to_cpu(out_cmd->hdr.sequence), cmd_size, 532 + q->write_ptr, idx, priv->cmd_queue); 533 + 686 534 phys_addr = pci_map_single(priv->pci_dev, &out_cmd->hdr, 687 - fix_size, PCI_DMA_BIDIRECTIONAL); 535 + copy_size, PCI_DMA_BIDIRECTIONAL); 688 536 if (unlikely(pci_dma_mapping_error(priv->pci_dev, phys_addr))) { 689 537 idx = -ENOMEM; 690 538 goto out; 691 539 } 692 540 693 541 dma_unmap_addr_set(out_meta, mapping, phys_addr); 694 - dma_unmap_len_set(out_meta, len, fix_size); 542 + dma_unmap_len_set(out_meta, len, copy_size); 543 + 544 + iwlagn_txq_attach_buf_to_tfd(priv, txq, phys_addr, copy_size, 1); 545 + #ifdef CONFIG_IWLWIFI_DEVICE_TRACING 546 + trace_bufs[0] = &out_cmd->hdr; 547 + trace_lens[0] = copy_size; 548 + trace_idx = 1; 549 + #endif 550 + 551 + for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { 552 + if (!cmd->len[i]) 553 + continue; 554 + if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)) 555 + continue; 556 + phys_addr = pci_map_single(priv->pci_dev, (void *)cmd->data[i], 557 + cmd->len[i], PCI_DMA_TODEVICE); 558 + if (pci_dma_mapping_error(priv->pci_dev, phys_addr)) { 559 + iwlagn_unmap_tfd(priv, out_meta, 560 + &txq->tfds[q->write_ptr]); 561 + idx = -ENOMEM; 562 + goto out; 563 + } 564 + 565 + iwlagn_txq_attach_buf_to_tfd(priv, txq, phys_addr, 566 + cmd->len[i], 0); 567 + #ifdef CONFIG_IWLWIFI_DEVICE_TRACING 568 + trace_bufs[trace_idx] = cmd->data[i]; 569 + trace_lens[trace_idx] = cmd->len[i]; 570 + trace_idx++; 571 + #endif 572 + } 695 573 696 574 out_meta->flags = cmd->flags | CMD_MAPPED; 697 575 698 576 txq->need_update = 1; 699 577 700 - trace_iwlwifi_dev_hcmd(priv, &out_cmd->hdr, fix_size, cmd->flags); 701 - 702 - priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, 703 - phys_addr, fix_size, 1, 704 - U32_PAD(cmd->len)); 578 + /* check that tracing gets all possible blocks */ 579 + BUILD_BUG_ON(IWL_MAX_CMD_TFDS + 1 != 3); 580 + #ifdef CONFIG_IWLWIFI_DEVICE_TRACING 581 + trace_iwlwifi_dev_hcmd(priv, cmd->flags, 582 + trace_bufs[0], trace_lens[0], 583 + trace_bufs[1], trace_lens[1], 584 + trace_bufs[2], trace_lens[2]); 585 + #endif 705 586 706 587 /* Increment and update queue's write index */ 707 588 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); ··· 746 573 * need to be reclaimed. As result, some free space forms. If there is 747 574 * enough free space (> low mark), wake the stack that feeds us. 748 575 */ 749 - static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, 750 - int idx, int cmd_idx) 576 + static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int idx) 751 577 { 752 578 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 753 579 struct iwl_queue *q = &txq->q; ··· 786 614 int txq_id = SEQ_TO_QUEUE(sequence); 787 615 int index = SEQ_TO_INDEX(sequence); 788 616 int cmd_index; 789 - bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME); 790 617 struct iwl_device_cmd *cmd; 791 618 struct iwl_cmd_meta *meta; 792 619 struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; ··· 803 632 return; 804 633 } 805 634 806 - cmd_index = get_cmd_index(&txq->q, index, huge); 635 + cmd_index = get_cmd_index(&txq->q, index); 807 636 cmd = txq->cmd[cmd_index]; 808 637 meta = &txq->meta[cmd_index]; 809 638 810 - pci_unmap_single(priv->pci_dev, 811 - dma_unmap_addr(meta, mapping), 812 - dma_unmap_len(meta, len), 813 - PCI_DMA_BIDIRECTIONAL); 639 + iwlagn_unmap_tfd(priv, meta, &txq->tfds[index]); 814 640 815 641 /* Input error checking is done when commands are added to queue. */ 816 642 if (meta->flags & CMD_WANT_SKB) { ··· 818 650 819 651 spin_lock_irqsave(&priv->hcmd_lock, flags); 820 652 821 - iwl_hcmd_queue_reclaim(priv, txq_id, index, cmd_index); 653 + iwl_hcmd_queue_reclaim(priv, txq_id, index); 822 654 823 655 if (!(meta->flags & CMD_ASYNC)) { 824 656 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
+2 -2
drivers/net/wireless/iwmc3200wifi/rx.c
··· 565 565 if (!test_and_clear_bit(IWM_STATUS_SME_CONNECTING, &iwm->status) 566 566 && iwm->conf.mode == UMAC_MODE_BSS) { 567 567 cancel_delayed_work(&iwm->disconnect); 568 - cfg80211_roamed(iwm_to_ndev(iwm), 568 + cfg80211_roamed(iwm_to_ndev(iwm), NULL, 569 569 complete->bssid, 570 570 iwm->req_ie, iwm->req_ie_len, 571 571 iwm->resp_ie, iwm->resp_ie_len, ··· 586 586 WLAN_STATUS_SUCCESS, 587 587 GFP_KERNEL); 588 588 else 589 - cfg80211_roamed(iwm_to_ndev(iwm), 589 + cfg80211_roamed(iwm_to_ndev(iwm), NULL, 590 590 complete->bssid, 591 591 iwm->req_ie, iwm->req_ie_len, 592 592 iwm->resp_ie, iwm->resp_ie_len,
+4
drivers/net/wireless/mwifiex/11n_aggr.c
··· 196 196 if (skb_src) 197 197 pra_list->total_pkts_size -= skb_src->len; 198 198 199 + atomic_dec(&priv->wmm.tx_pkts_queued); 200 + 199 201 spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, 200 202 ra_list_flags); 201 203 mwifiex_11n_form_amsdu_pkt(skb_aggr, skb_src, &pad); ··· 258 256 skb_queue_tail(&pra_list->skb_head, skb_aggr); 259 257 260 258 pra_list->total_pkts_size += skb_aggr->len; 259 + 260 + atomic_inc(&priv->wmm.tx_pkts_queued); 261 261 262 262 tx_info_aggr->flags |= MWIFIEX_BUF_FLAG_REQUEUED_PKT; 263 263 spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock,
+7 -2
drivers/net/wireless/mwifiex/main.h
··· 69 69 #define MWIFIEX_TIMER_10S 10000 70 70 #define MWIFIEX_TIMER_1S 1000 71 71 72 - #define MAX_TX_PENDING 60 72 + #define MAX_TX_PENDING 100 73 + #define LOW_TX_PENDING 80 73 74 74 75 #define MWIFIEX_UPLD_SIZE (2312) 75 76 ··· 203 202 #define WMM_HIGHEST_PRIORITY 7 204 203 #define HIGH_PRIO_TID 7 205 204 #define LOW_PRIO_TID 0 205 + #define NO_PKT_PRIO_TID (-1) 206 206 207 207 struct mwifiex_wmm_desc { 208 208 struct mwifiex_tid_tbl tid_tbl_ptr[MAX_NUM_TID]; ··· 215 213 u32 drv_pkt_delay_max; 216 214 u8 queue_priority[IEEE80211_MAX_QUEUES]; 217 215 u32 user_pri_pkt_tx_ctrl[WMM_HIGHEST_PRIORITY + 1]; /* UP: 0 to 7 */ 218 - 216 + /* Number of transmit packets queued */ 217 + atomic_t tx_pkts_queued; 218 + /* Tracks highest priority with a packet queued */ 219 + atomic_t highest_queued_prio; 219 220 }; 220 221 221 222 struct mwifiex_802_11_security {
+3 -1
drivers/net/wireless/mwifiex/txrx.c
··· 140 140 } else { 141 141 priv->stats.tx_errors++; 142 142 } 143 - atomic_dec(&adapter->tx_pending); 143 + 144 + if (atomic_dec_return(&adapter->tx_pending) >= LOW_TX_PENDING) 145 + goto done; 144 146 145 147 for (i = 0; i < adapter->priv_num; i++) { 146 148
+47 -14
drivers/net/wireless/mwifiex/wmm.c
··· 177 177 * This function map ACs to TIDs. 178 178 */ 179 179 static void 180 - mwifiex_wmm_queue_priorities_tid(u8 queue_priority[]) 180 + mwifiex_wmm_queue_priorities_tid(struct mwifiex_wmm_desc *wmm) 181 181 { 182 + u8 *queue_priority = wmm->queue_priority; 182 183 int i; 183 184 184 185 for (i = 0; i < 4; ++i) { 185 186 tos_to_tid[7 - (i * 2)] = ac_to_tid[queue_priority[i]][1]; 186 187 tos_to_tid[6 - (i * 2)] = ac_to_tid[queue_priority[i]][0]; 187 188 } 189 + 190 + for (i = 0; i < MAX_NUM_TID; ++i) 191 + tos_to_tid_inv[tos_to_tid[i]] = (u8)i; 192 + 193 + atomic_set(&wmm->highest_queued_prio, HIGH_PRIO_TID); 188 194 } 189 195 190 196 /* ··· 252 246 } 253 247 } 254 248 255 - mwifiex_wmm_queue_priorities_tid(priv->wmm.queue_priority); 249 + mwifiex_wmm_queue_priorities_tid(&priv->wmm); 256 250 } 257 251 258 252 /* ··· 405 399 priv->add_ba_param.timeout = MWIFIEX_DEFAULT_BLOCK_ACK_TIMEOUT; 406 400 priv->add_ba_param.tx_win_size = MWIFIEX_AMPDU_DEF_TXWINSIZE; 407 401 priv->add_ba_param.rx_win_size = MWIFIEX_AMPDU_DEF_RXWINSIZE; 402 + 403 + atomic_set(&priv->wmm.tx_pkts_queued, 0); 404 + atomic_set(&priv->wmm.highest_queued_prio, HIGH_PRIO_TID); 408 405 } 409 406 } 410 407 ··· 417 408 int 418 409 mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter) 419 410 { 420 - int i, j; 411 + int i; 421 412 struct mwifiex_private *priv; 422 413 423 - for (j = 0; j < adapter->priv_num; ++j) { 424 - priv = adapter->priv[j]; 425 - if (priv) { 426 - for (i = 0; i < MAX_NUM_TID; i++) 427 - if (!mwifiex_wmm_is_ra_list_empty( 428 - &priv->wmm.tid_tbl_ptr[i].ra_list)) 429 - return false; 430 - } 414 + for (i = 0; i < adapter->priv_num; ++i) { 415 + priv = adapter->priv[i]; 416 + if (priv && atomic_read(&priv->wmm.tx_pkts_queued)) 417 + return false; 431 418 } 432 419 433 420 return true; ··· 473 468 for (i = 0; i < MAX_NUM_TID; i++) 474 469 mwifiex_wmm_del_pkts_in_ralist(priv, &priv->wmm.tid_tbl_ptr[i]. 475 470 ra_list); 471 + 472 + atomic_set(&priv->wmm.tx_pkts_queued, 0); 473 + atomic_set(&priv->wmm.highest_queued_prio, HIGH_PRIO_TID); 476 474 } 477 475 478 476 /* ··· 645 637 skb_queue_tail(&ra_list->skb_head, skb); 646 638 647 639 ra_list->total_pkts_size += skb->len; 640 + 641 + atomic_inc(&priv->wmm.tx_pkts_queued); 642 + 643 + if (atomic_read(&priv->wmm.highest_queued_prio) < 644 + tos_to_tid_inv[tid_down]) 645 + atomic_set(&priv->wmm.highest_queued_prio, 646 + tos_to_tid_inv[tid_down]); 648 647 649 648 spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags); 650 649 } ··· 878 863 } 879 864 880 865 do { 881 - priv_tmp = bssprio_node->priv; 866 + atomic_t *hqp; 867 + spinlock_t *lock; 882 868 883 - for (i = HIGH_PRIO_TID; i >= LOW_PRIO_TID; --i) { 869 + priv_tmp = bssprio_node->priv; 870 + hqp = &priv_tmp->wmm.highest_queued_prio; 871 + lock = &priv_tmp->wmm.ra_list_spinlock; 872 + 873 + for (i = atomic_read(hqp); i >= LOW_PRIO_TID; --i) { 884 874 885 875 tid_ptr = &(priv_tmp)->wmm. 886 876 tid_tbl_ptr[tos_to_tid[i]]; ··· 923 903 is_list_empty = 924 904 skb_queue_empty(&ptr->skb_head); 925 905 if (!is_list_empty) { 906 + spin_lock_irqsave(lock, flags); 907 + if (atomic_read(hqp) > i) 908 + atomic_set(hqp, i); 909 + spin_unlock_irqrestore(lock, 910 + flags); 926 911 *priv = priv_tmp; 927 912 *tid = tos_to_tid[i]; 928 913 return ptr; ··· 945 920 list); 946 921 } while (ptr != head); 947 922 } 923 + 924 + /* No packet at any TID for this priv. Mark as such 925 + * to skip checking TIDs for this priv (until pkt is 926 + * added). 927 + */ 928 + atomic_set(hqp, NO_PKT_PRIO_TID); 948 929 949 930 /* Get next bss priority node */ 950 931 bssprio_node = list_first_entry(&bssprio_node->list, ··· 1059 1028 .bss_prio_cur->list, 1060 1029 struct mwifiex_bss_prio_node, 1061 1030 list); 1031 + atomic_dec(&priv->wmm.tx_pkts_queued); 1062 1032 spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, 1063 1033 ra_list_flags); 1064 1034 } ··· 1166 1134 .bss_prio_cur->list, 1167 1135 struct mwifiex_bss_prio_node, 1168 1136 list); 1137 + atomic_dec(&priv->wmm.tx_pkts_queued); 1169 1138 spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, 1170 1139 ra_list_flags); 1171 1140 } ··· 1260 1227 1261 1228 if (mwifiex_dequeue_tx_packet(adapter)) 1262 1229 break; 1263 - } while (true); 1230 + } while (!mwifiex_wmm_lists_empty(adapter)); 1264 1231 }
+1
drivers/net/wireless/p54/p54usb.c
··· 82 82 {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ 83 83 {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ 84 84 {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ 85 + {USB_DEVICE(0x083a, 0xc501)}, /* Zoom Wireless-G 4410 */ 85 86 {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */ 86 87 {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */ 87 88 {USB_DEVICE(0x0915, 0x2000)}, /* Cohiba Proto board */
+2 -1
drivers/net/wireless/rndis_wlan.c
··· 2830 2830 req_ie_len, resp_ie, 2831 2831 resp_ie_len, 0, GFP_KERNEL); 2832 2832 else 2833 - cfg80211_roamed(usbdev->net, bssid, req_ie, req_ie_len, 2833 + cfg80211_roamed(usbdev->net, NULL, bssid, 2834 + req_ie, req_ie_len, 2834 2835 resp_ie, resp_ie_len, GFP_KERNEL); 2835 2836 } else if (priv->infra_mode == NDIS_80211_INFRA_ADHOC) 2836 2837 cfg80211_ibss_joined(usbdev->net, bssid, GFP_KERNEL);
+1 -1
drivers/net/wireless/rtlwifi/ps.c
··· 190 190 191 191 ppsc->swrf_processing = true; 192 192 193 - if (ppsc->inactive_pwrstate == ERFOFF && 193 + if (ppsc->inactive_pwrstate == ERFON && 194 194 rtlhal->interface == INTF_PCI) { 195 195 if ((ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM) && 196 196 RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM) &&
+1 -1
drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
··· 728 728 return; 729 729 rtlphy->set_bwmode_inprogress = true; 730 730 if ((!is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { 731 - rtlphy->set_bwmode_inprogress = false; 731 + rtlpriv->cfg->ops->phy_set_bw_mode_callback(hw); 732 732 } else { 733 733 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 734 734 ("FALSE driver sleep or unload\n"));
+69
drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
··· 366 366 return true; 367 367 } 368 368 369 + void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw) 370 + { 371 + struct rtl_priv *rtlpriv = rtl_priv(hw); 372 + struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 373 + struct rtl_phy *rtlphy = &(rtlpriv->phy); 374 + struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 375 + u8 reg_bw_opmode; 376 + u8 reg_prsr_rsc; 377 + 378 + RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, 379 + ("Switch to %s bandwidth\n", 380 + rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? 381 + "20MHz" : "40MHz")) 382 + 383 + if (is_hal_stop(rtlhal)) { 384 + rtlphy->set_bwmode_inprogress = false; 385 + return; 386 + } 387 + 388 + reg_bw_opmode = rtl_read_byte(rtlpriv, REG_BWOPMODE); 389 + reg_prsr_rsc = rtl_read_byte(rtlpriv, REG_RRSR + 2); 390 + 391 + switch (rtlphy->current_chan_bw) { 392 + case HT_CHANNEL_WIDTH_20: 393 + reg_bw_opmode |= BW_OPMODE_20MHZ; 394 + rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); 395 + break; 396 + case HT_CHANNEL_WIDTH_20_40: 397 + reg_bw_opmode &= ~BW_OPMODE_20MHZ; 398 + rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); 399 + reg_prsr_rsc = 400 + (reg_prsr_rsc & 0x90) | (mac->cur_40_prime_sc << 5); 401 + rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_prsr_rsc); 402 + break; 403 + default: 404 + RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 405 + ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); 406 + break; 407 + } 408 + 409 + switch (rtlphy->current_chan_bw) { 410 + case HT_CHANNEL_WIDTH_20: 411 + rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x0); 412 + rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x0); 413 + rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 1); 414 + break; 415 + case HT_CHANNEL_WIDTH_20_40: 416 + rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x1); 417 + rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x1); 418 + 419 + rtl_set_bbreg(hw, RCCK0_SYSTEM, BCCK_SIDEBAND, 420 + (mac->cur_40_prime_sc >> 1)); 421 + rtl_set_bbreg(hw, ROFDM1_LSTF, 0xC00, mac->cur_40_prime_sc); 422 + rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 0); 423 + 424 + rtl_set_bbreg(hw, 0x818, (BIT(26) | BIT(27)), 425 + (mac->cur_40_prime_sc == 426 + HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1); 427 + break; 428 + default: 429 + RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 430 + ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); 431 + break; 432 + } 433 + rtl92ce_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); 434 + rtlphy->set_bwmode_inprogress = false; 435 + RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); 436 + } 437 + 369 438 void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) 370 439 { 371 440 u8 tmpreg;
+1
drivers/net/wireless/rtlwifi/rtl8192ce/phy.h
··· 257 257 u8 configtype); 258 258 bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, 259 259 u8 configtype); 260 + void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw); 260 261 261 262 #endif
+1
drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
··· 232 232 .config_bb_with_headerfile = _rtl92ce_phy_config_bb_with_headerfile, 233 233 .config_bb_with_pgheaderfile = _rtl92ce_phy_config_bb_with_pgheaderfile, 234 234 .phy_lc_calibrate = _rtl92ce_phy_lc_calibrate, 235 + .phy_set_bw_mode_callback = rtl92ce_phy_set_bw_mode_callback, 235 236 .dm_dynamic_txpower = rtl92ce_dm_dynamic_txpower, 236 237 }; 237 238
+1 -1
drivers/staging/ath6kl/os/linux/cfg80211.c
··· 570 570 WLAN_STATUS_SUCCESS, GFP_KERNEL); 571 571 } else { 572 572 /* inform roam event to cfg80211 */ 573 - cfg80211_roamed(ar->arNetDev, bssid, 573 + cfg80211_roamed(ar->arNetDev, ibss_channel, bssid, 574 574 assocReqIe, assocReqLen, 575 575 assocRespIe, assocRespLen, 576 576 GFP_KERNEL);
+2 -2
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
··· 2630 2630 wl_get_assoc_ies(wl); 2631 2631 memcpy(&wl->bssid, &e->addr, ETH_ALEN); 2632 2632 wl_update_bss_info(wl); 2633 - cfg80211_roamed(ndev, 2633 + cfg80211_roamed(ndev, NULL, 2634 2634 (u8 *)&wl->bssid, 2635 2635 conn_info->req_ie, conn_info->req_ie_len, 2636 2636 conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); ··· 2663 2663 WL_DBG("Report connect result - connection %s\n", 2664 2664 completed ? "succeeded" : "failed"); 2665 2665 } else { 2666 - cfg80211_roamed(ndev, 2666 + cfg80211_roamed(ndev, NULL, 2667 2667 (u8 *)&wl->bssid, 2668 2668 conn_info->req_ie, conn_info->req_ie_len, 2669 2669 conn_info->resp_ie, conn_info->resp_ie_len,
+1 -1
drivers/staging/wlan-ng/cfg80211.c
··· 695 695 696 696 void prism2_roamed(wlandevice_t *wlandev) 697 697 { 698 - cfg80211_roamed(wlandev->netdev, wlandev->bssid, 698 + cfg80211_roamed(wlandev->netdev, NULL, wlandev->bssid, 699 699 NULL, 0, NULL, 0, GFP_KERNEL); 700 700 } 701 701
+1
fs/proc/generic.c
··· 674 674 } 675 675 return ent; 676 676 } 677 + EXPORT_SYMBOL(proc_mkdir_mode); 677 678 678 679 struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, 679 680 struct proc_dir_entry *parent)
+43
include/linux/rfkill-gpio.h
··· 1 + /* 2 + * Copyright (c) 2011, NVIDIA Corporation. 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + * This program is distributed in the hope that it will be useful, but WITHOUT 10 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 + * more details. 13 + * 14 + * You should have received a copy of the GNU General Public License along 15 + * with this program; if not, write to the Free Software Foundation, Inc., 16 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 + */ 18 + 19 + 20 + #ifndef __RFKILL_GPIO_H 21 + #define __RFKILL_GPIO_H 22 + 23 + #include <linux/types.h> 24 + #include <linux/rfkill.h> 25 + 26 + /** 27 + * struct rfkill_gpio_platform_data - platform data for rfkill gpio device. 28 + * for unused gpio's, the expected value is -1. 29 + * @name: name for the gpio rf kill instance 30 + * @reset_gpio: GPIO which is used for reseting rfkill switch 31 + * @shutdown_gpio: GPIO which is used for shutdown of rfkill switch 32 + * @power_clk_name: [optional] name of clk to turn off while blocked 33 + */ 34 + 35 + struct rfkill_gpio_platform_data { 36 + char *name; 37 + int reset_gpio; 38 + int shutdown_gpio; 39 + const char *power_clk_name; 40 + enum rfkill_type type; 41 + }; 42 + 43 + #endif /* __RFKILL_GPIO_H */
+6 -2
include/net/cfg80211.h
··· 531 531 * @tx_retries: cumulative retry counts 532 532 * @tx_failed: number of failed transmissions (retries exceeded, no ACK) 533 533 * @rx_dropped_misc: Dropped for un-specified reason. 534 + * @bss_param: current BSS parameters 534 535 * @generation: generation number for nl80211 dumps. 535 536 * This number should increase every time the list of stations 536 537 * changes, i.e. when a station is added or removed, so that ··· 1538 1537 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 1539 1538 * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 1540 1539 * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 1541 - * @WIPHY_FLAG_SCHED_SCAN: The device supports scheduled scans. 1540 + * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans. 1542 1541 */ 1543 1542 enum wiphy_flags { 1544 1543 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), ··· 2879 2878 * cfg80211_roamed - notify cfg80211 of roaming 2880 2879 * 2881 2880 * @dev: network device 2881 + * @channel: the channel of the new AP 2882 2882 * @bssid: the BSSID of the new AP 2883 2883 * @req_ie: association request IEs (maybe be %NULL) 2884 2884 * @req_ie_len: association request IEs length ··· 2890 2888 * It should be called by the underlying driver whenever it roamed 2891 2889 * from one AP to another while connected. 2892 2890 */ 2893 - void cfg80211_roamed(struct net_device *dev, const u8 *bssid, 2891 + void cfg80211_roamed(struct net_device *dev, 2892 + struct ieee80211_channel *channel, 2893 + const u8 *bssid, 2894 2894 const u8 *req_ie, size_t req_ie_len, 2895 2895 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 2896 2896
+2 -2
net/mac80211/iface.c
··· 384 384 int i; 385 385 enum nl80211_channel_type orig_ct; 386 386 387 + clear_bit(SDATA_STATE_RUNNING, &sdata->state); 388 + 387 389 if (local->scan_sdata == sdata) 388 390 ieee80211_scan_cancel(local); 389 - 390 - clear_bit(SDATA_STATE_RUNNING, &sdata->state); 391 391 392 392 /* 393 393 * Stop TX on this interface first.
+19 -3
net/mac80211/main.c
··· 752 752 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); 753 753 hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR); 754 754 755 - /* mac80211 doesn't support more than 1 channel */ 756 - for (i = 0; i < hw->wiphy->n_iface_combinations; i++) 757 - if (hw->wiphy->iface_combinations[i].num_different_channels > 1) 755 + /* 756 + * mac80211 doesn't support more than 1 channel, and also not more 757 + * than one IBSS interface 758 + */ 759 + for (i = 0; i < hw->wiphy->n_iface_combinations; i++) { 760 + const struct ieee80211_iface_combination *c; 761 + int j; 762 + 763 + c = &hw->wiphy->iface_combinations[i]; 764 + 765 + if (c->num_different_channels > 1) 758 766 return -EINVAL; 767 + 768 + for (j = 0; j < c->n_limits; j++) 769 + if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) && 770 + c->limits[j].max > 1) 771 + return -EINVAL; 772 + } 759 773 760 774 #ifndef CONFIG_MAC80211_MESH 761 775 /* mesh depends on Kconfig, but drivers should set it if they want */ ··· 1090 1076 ieee80211s_stop(); 1091 1077 1092 1078 ieee80211_iface_exit(); 1079 + 1080 + rcu_barrier(); 1093 1081 } 1094 1082 1095 1083
+3 -4
net/mac80211/mesh.h
··· 120 120 * buckets 121 121 * @mean_chain_len: maximum average length for the hash buckets' list, if it is 122 122 * reached, the table will grow 123 + * rcu_head: RCU head to free the table 123 124 */ 124 125 struct mesh_table { 125 126 /* Number of buckets will be 2^N */ ··· 133 132 int (*copy_node) (struct hlist_node *p, struct mesh_table *newtbl); 134 133 int size_order; 135 134 int mean_chain_len; 135 + 136 + struct rcu_head rcu_head; 136 137 }; 137 138 138 139 /* Recent multicast cache */ ··· 288 285 { 289 286 return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP; 290 287 } 291 - 292 - #define for_each_mesh_entry(x, p, node, i) \ 293 - for (i = 0; i <= x->hash_mask; i++) \ 294 - hlist_for_each_entry_rcu(node, p, &x->hash_buckets[i], list) 295 288 296 289 void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local); 297 290
+129 -77
net/mac80211/mesh_pathtbl.c
··· 36 36 struct mesh_path *mpath; 37 37 }; 38 38 39 - static struct mesh_table *mesh_paths; 40 - static struct mesh_table *mpp_paths; /* Store paths for MPP&MAP */ 39 + static struct mesh_table __rcu *mesh_paths; 40 + static struct mesh_table __rcu *mpp_paths; /* Store paths for MPP&MAP */ 41 41 42 42 int mesh_paths_generation; 43 43 ··· 48 48 static DEFINE_RWLOCK(pathtbl_resize_lock); 49 49 50 50 51 + static inline struct mesh_table *resize_dereference_mesh_paths(void) 52 + { 53 + return rcu_dereference_protected(mesh_paths, 54 + lockdep_is_held(&pathtbl_resize_lock)); 55 + } 56 + 57 + static inline struct mesh_table *resize_dereference_mpp_paths(void) 58 + { 59 + return rcu_dereference_protected(mpp_paths, 60 + lockdep_is_held(&pathtbl_resize_lock)); 61 + } 62 + 63 + /* 64 + * CAREFUL -- "tbl" must not be an expression, 65 + * in particular not an rcu_dereference(), since 66 + * it's used twice. So it is illegal to do 67 + * for_each_mesh_entry(rcu_dereference(...), ...) 68 + */ 69 + #define for_each_mesh_entry(tbl, p, node, i) \ 70 + for (i = 0; i <= tbl->hash_mask; i++) \ 71 + hlist_for_each_entry_rcu(node, p, &tbl->hash_buckets[i], list) 72 + 73 + 51 74 static struct mesh_table *mesh_table_alloc(int size_order) 52 75 { 53 76 int i; 54 77 struct mesh_table *newtbl; 55 78 56 - newtbl = kmalloc(sizeof(struct mesh_table), GFP_KERNEL); 79 + newtbl = kmalloc(sizeof(struct mesh_table), GFP_ATOMIC); 57 80 if (!newtbl) 58 81 return NULL; 59 82 60 83 newtbl->hash_buckets = kzalloc(sizeof(struct hlist_head) * 61 - (1 << size_order), GFP_KERNEL); 84 + (1 << size_order), GFP_ATOMIC); 62 85 63 86 if (!newtbl->hash_buckets) { 64 87 kfree(newtbl); ··· 89 66 } 90 67 91 68 newtbl->hashwlock = kmalloc(sizeof(spinlock_t) * 92 - (1 << size_order), GFP_KERNEL); 69 + (1 << size_order), GFP_ATOMIC); 93 70 if (!newtbl->hashwlock) { 94 71 kfree(newtbl->hash_buckets); 95 72 kfree(newtbl); ··· 281 258 */ 282 259 struct mesh_path *mesh_path_lookup_by_idx(int idx, struct ieee80211_sub_if_data *sdata) 283 260 { 261 + struct mesh_table *tbl = rcu_dereference(mesh_paths); 284 262 struct mpath_node *node; 285 263 struct hlist_node *p; 286 264 int i; 287 265 int j = 0; 288 266 289 - for_each_mesh_entry(mesh_paths, p, node, i) { 267 + for_each_mesh_entry(tbl, p, node, i) { 290 268 if (sdata && node->mpath->sdata != sdata) 291 269 continue; 292 270 if (j++ == idx) { ··· 317 293 { 318 294 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 319 295 struct ieee80211_local *local = sdata->local; 296 + struct mesh_table *tbl; 320 297 struct mesh_path *mpath, *new_mpath; 321 298 struct mpath_node *node, *new_node; 322 299 struct hlist_head *bucket; ··· 357 332 spin_lock_init(&new_mpath->state_lock); 358 333 init_timer(&new_mpath->timer); 359 334 360 - hash_idx = mesh_table_hash(dst, sdata, mesh_paths); 361 - bucket = &mesh_paths->hash_buckets[hash_idx]; 335 + tbl = resize_dereference_mesh_paths(); 362 336 363 - spin_lock_bh(&mesh_paths->hashwlock[hash_idx]); 337 + hash_idx = mesh_table_hash(dst, sdata, tbl); 338 + bucket = &tbl->hash_buckets[hash_idx]; 339 + 340 + spin_lock_bh(&tbl->hashwlock[hash_idx]); 364 341 365 342 err = -EEXIST; 366 343 hlist_for_each_entry(node, n, bucket, list) { ··· 372 345 } 373 346 374 347 hlist_add_head_rcu(&new_node->list, bucket); 375 - if (atomic_inc_return(&mesh_paths->entries) >= 376 - mesh_paths->mean_chain_len * (mesh_paths->hash_mask + 1)) 348 + if (atomic_inc_return(&tbl->entries) >= 349 + tbl->mean_chain_len * (tbl->hash_mask + 1)) 377 350 grow = 1; 378 351 379 352 mesh_paths_generation++; 380 353 381 - spin_unlock_bh(&mesh_paths->hashwlock[hash_idx]); 354 + spin_unlock_bh(&tbl->hashwlock[hash_idx]); 382 355 read_unlock_bh(&pathtbl_resize_lock); 383 356 if (grow) { 384 357 set_bit(MESH_WORK_GROW_MPATH_TABLE, &ifmsh->wrkq_flags); ··· 387 360 return 0; 388 361 389 362 err_exists: 390 - spin_unlock_bh(&mesh_paths->hashwlock[hash_idx]); 363 + spin_unlock_bh(&tbl->hashwlock[hash_idx]); 391 364 read_unlock_bh(&pathtbl_resize_lock); 392 365 kfree(new_node); 393 366 err_node_alloc: ··· 397 370 return err; 398 371 } 399 372 373 + static void mesh_table_free_rcu(struct rcu_head *rcu) 374 + { 375 + struct mesh_table *tbl = container_of(rcu, struct mesh_table, rcu_head); 376 + 377 + mesh_table_free(tbl, false); 378 + } 379 + 400 380 void mesh_mpath_table_grow(void) 401 381 { 402 382 struct mesh_table *oldtbl, *newtbl; 403 383 404 - rcu_read_lock(); 405 - newtbl = mesh_table_alloc(rcu_dereference(mesh_paths)->size_order + 1); 406 - if (!newtbl) 407 - return; 408 384 write_lock_bh(&pathtbl_resize_lock); 409 - oldtbl = mesh_paths; 410 - if (mesh_table_grow(mesh_paths, newtbl) < 0) { 411 - rcu_read_unlock(); 385 + oldtbl = resize_dereference_mesh_paths(); 386 + newtbl = mesh_table_alloc(oldtbl->size_order + 1); 387 + if (!newtbl) 388 + goto out; 389 + if (mesh_table_grow(oldtbl, newtbl) < 0) { 412 390 __mesh_table_free(newtbl); 413 - write_unlock_bh(&pathtbl_resize_lock); 414 - return; 391 + goto out; 415 392 } 416 - rcu_read_unlock(); 417 393 rcu_assign_pointer(mesh_paths, newtbl); 418 - write_unlock_bh(&pathtbl_resize_lock); 419 394 420 - synchronize_rcu(); 421 - mesh_table_free(oldtbl, false); 395 + call_rcu(&oldtbl->rcu_head, mesh_table_free_rcu); 396 + 397 + out: 398 + write_unlock_bh(&pathtbl_resize_lock); 422 399 } 423 400 424 401 void mesh_mpp_table_grow(void) 425 402 { 426 403 struct mesh_table *oldtbl, *newtbl; 427 404 428 - rcu_read_lock(); 429 - newtbl = mesh_table_alloc(rcu_dereference(mpp_paths)->size_order + 1); 430 - if (!newtbl) 431 - return; 432 405 write_lock_bh(&pathtbl_resize_lock); 433 - oldtbl = mpp_paths; 434 - if (mesh_table_grow(mpp_paths, newtbl) < 0) { 435 - rcu_read_unlock(); 406 + oldtbl = resize_dereference_mpp_paths(); 407 + newtbl = mesh_table_alloc(oldtbl->size_order + 1); 408 + if (!newtbl) 409 + goto out; 410 + if (mesh_table_grow(oldtbl, newtbl) < 0) { 436 411 __mesh_table_free(newtbl); 437 - write_unlock_bh(&pathtbl_resize_lock); 438 - return; 412 + goto out; 439 413 } 440 - rcu_read_unlock(); 441 414 rcu_assign_pointer(mpp_paths, newtbl); 442 - write_unlock_bh(&pathtbl_resize_lock); 415 + call_rcu(&oldtbl->rcu_head, mesh_table_free_rcu); 443 416 444 - synchronize_rcu(); 445 - mesh_table_free(oldtbl, false); 417 + out: 418 + write_unlock_bh(&pathtbl_resize_lock); 446 419 } 447 420 448 421 int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata) 449 422 { 450 423 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 451 424 struct ieee80211_local *local = sdata->local; 425 + struct mesh_table *tbl; 452 426 struct mesh_path *mpath, *new_mpath; 453 427 struct mpath_node *node, *new_node; 454 428 struct hlist_head *bucket; ··· 484 456 new_mpath->exp_time = jiffies; 485 457 spin_lock_init(&new_mpath->state_lock); 486 458 487 - hash_idx = mesh_table_hash(dst, sdata, mpp_paths); 488 - bucket = &mpp_paths->hash_buckets[hash_idx]; 459 + tbl = resize_dereference_mpp_paths(); 489 460 490 - spin_lock_bh(&mpp_paths->hashwlock[hash_idx]); 461 + hash_idx = mesh_table_hash(dst, sdata, tbl); 462 + bucket = &tbl->hash_buckets[hash_idx]; 463 + 464 + spin_lock_bh(&tbl->hashwlock[hash_idx]); 491 465 492 466 err = -EEXIST; 493 467 hlist_for_each_entry(node, n, bucket, list) { ··· 499 469 } 500 470 501 471 hlist_add_head_rcu(&new_node->list, bucket); 502 - if (atomic_inc_return(&mpp_paths->entries) >= 503 - mpp_paths->mean_chain_len * (mpp_paths->hash_mask + 1)) 472 + if (atomic_inc_return(&tbl->entries) >= 473 + tbl->mean_chain_len * (tbl->hash_mask + 1)) 504 474 grow = 1; 505 475 506 - spin_unlock_bh(&mpp_paths->hashwlock[hash_idx]); 476 + spin_unlock_bh(&tbl->hashwlock[hash_idx]); 507 477 read_unlock_bh(&pathtbl_resize_lock); 508 478 if (grow) { 509 479 set_bit(MESH_WORK_GROW_MPP_TABLE, &ifmsh->wrkq_flags); ··· 512 482 return 0; 513 483 514 484 err_exists: 515 - spin_unlock_bh(&mpp_paths->hashwlock[hash_idx]); 485 + spin_unlock_bh(&tbl->hashwlock[hash_idx]); 516 486 read_unlock_bh(&pathtbl_resize_lock); 517 487 kfree(new_node); 518 488 err_node_alloc: ··· 532 502 */ 533 503 void mesh_plink_broken(struct sta_info *sta) 534 504 { 505 + struct mesh_table *tbl; 535 506 static const u8 bcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 536 507 struct mesh_path *mpath; 537 508 struct mpath_node *node; ··· 541 510 int i; 542 511 543 512 rcu_read_lock(); 544 - for_each_mesh_entry(mesh_paths, p, node, i) { 513 + tbl = rcu_dereference(mesh_paths); 514 + for_each_mesh_entry(tbl, p, node, i) { 545 515 mpath = node->mpath; 546 516 spin_lock_bh(&mpath->state_lock); 547 - if (mpath->next_hop == sta && 517 + if (rcu_dereference(mpath->next_hop) == sta && 548 518 mpath->flags & MESH_PATH_ACTIVE && 549 519 !(mpath->flags & MESH_PATH_FIXED)) { 550 520 mpath->flags &= ~MESH_PATH_ACTIVE; ··· 574 542 */ 575 543 void mesh_path_flush_by_nexthop(struct sta_info *sta) 576 544 { 545 + struct mesh_table *tbl; 577 546 struct mesh_path *mpath; 578 547 struct mpath_node *node; 579 548 struct hlist_node *p; 580 549 int i; 581 550 582 - for_each_mesh_entry(mesh_paths, p, node, i) { 551 + rcu_read_lock(); 552 + tbl = rcu_dereference(mesh_paths); 553 + for_each_mesh_entry(tbl, p, node, i) { 583 554 mpath = node->mpath; 584 - if (mpath->next_hop == sta) 555 + if (rcu_dereference(mpath->next_hop) == sta) 585 556 mesh_path_del(mpath->dst, mpath->sdata); 586 557 } 558 + rcu_read_unlock(); 587 559 } 588 560 589 561 void mesh_path_flush(struct ieee80211_sub_if_data *sdata) 590 562 { 563 + struct mesh_table *tbl; 591 564 struct mesh_path *mpath; 592 565 struct mpath_node *node; 593 566 struct hlist_node *p; 594 567 int i; 595 568 596 - for_each_mesh_entry(mesh_paths, p, node, i) { 569 + rcu_read_lock(); 570 + tbl = rcu_dereference(mesh_paths); 571 + for_each_mesh_entry(tbl, p, node, i) { 597 572 mpath = node->mpath; 598 573 if (mpath->sdata == sdata) 599 574 mesh_path_del(mpath->dst, mpath->sdata); 600 575 } 576 + rcu_read_unlock(); 601 577 } 602 578 603 579 static void mesh_path_node_reclaim(struct rcu_head *rp) ··· 629 589 */ 630 590 int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata) 631 591 { 592 + struct mesh_table *tbl; 632 593 struct mesh_path *mpath; 633 594 struct mpath_node *node; 634 595 struct hlist_head *bucket; ··· 638 597 int err = 0; 639 598 640 599 read_lock_bh(&pathtbl_resize_lock); 641 - hash_idx = mesh_table_hash(addr, sdata, mesh_paths); 642 - bucket = &mesh_paths->hash_buckets[hash_idx]; 600 + tbl = resize_dereference_mesh_paths(); 601 + hash_idx = mesh_table_hash(addr, sdata, tbl); 602 + bucket = &tbl->hash_buckets[hash_idx]; 643 603 644 - spin_lock_bh(&mesh_paths->hashwlock[hash_idx]); 604 + spin_lock_bh(&tbl->hashwlock[hash_idx]); 645 605 hlist_for_each_entry(node, n, bucket, list) { 646 606 mpath = node->mpath; 647 607 if (mpath->sdata == sdata && 648 - memcmp(addr, mpath->dst, ETH_ALEN) == 0) { 608 + memcmp(addr, mpath->dst, ETH_ALEN) == 0) { 649 609 spin_lock_bh(&mpath->state_lock); 650 610 mpath->flags |= MESH_PATH_RESOLVING; 651 611 hlist_del_rcu(&node->list); 652 612 call_rcu(&node->rcu, mesh_path_node_reclaim); 653 - atomic_dec(&mesh_paths->entries); 613 + atomic_dec(&tbl->entries); 654 614 spin_unlock_bh(&mpath->state_lock); 655 615 goto enddel; 656 616 } ··· 660 618 err = -ENXIO; 661 619 enddel: 662 620 mesh_paths_generation++; 663 - spin_unlock_bh(&mesh_paths->hashwlock[hash_idx]); 621 + spin_unlock_bh(&tbl->hashwlock[hash_idx]); 664 622 read_unlock_bh(&pathtbl_resize_lock); 665 623 return err; 666 624 } ··· 761 719 struct mpath_node *node = hlist_entry(p, struct mpath_node, list); 762 720 mpath = node->mpath; 763 721 hlist_del_rcu(p); 764 - if (free_leafs) 722 + if (free_leafs) { 723 + del_timer_sync(&mpath->timer); 765 724 kfree(mpath); 725 + } 766 726 kfree(node); 767 727 } 768 728 ··· 789 745 790 746 int mesh_pathtbl_init(void) 791 747 { 792 - mesh_paths = mesh_table_alloc(INIT_PATHS_SIZE_ORDER); 793 - if (!mesh_paths) 794 - return -ENOMEM; 795 - mesh_paths->free_node = &mesh_path_node_free; 796 - mesh_paths->copy_node = &mesh_path_node_copy; 797 - mesh_paths->mean_chain_len = MEAN_CHAIN_LEN; 748 + struct mesh_table *tbl_path, *tbl_mpp; 798 749 799 - mpp_paths = mesh_table_alloc(INIT_PATHS_SIZE_ORDER); 800 - if (!mpp_paths) { 801 - mesh_table_free(mesh_paths, true); 750 + tbl_path = mesh_table_alloc(INIT_PATHS_SIZE_ORDER); 751 + if (!tbl_path) 752 + return -ENOMEM; 753 + tbl_path->free_node = &mesh_path_node_free; 754 + tbl_path->copy_node = &mesh_path_node_copy; 755 + tbl_path->mean_chain_len = MEAN_CHAIN_LEN; 756 + 757 + tbl_mpp = mesh_table_alloc(INIT_PATHS_SIZE_ORDER); 758 + if (!tbl_mpp) { 759 + mesh_table_free(tbl_path, true); 802 760 return -ENOMEM; 803 761 } 804 - mpp_paths->free_node = &mesh_path_node_free; 805 - mpp_paths->copy_node = &mesh_path_node_copy; 806 - mpp_paths->mean_chain_len = MEAN_CHAIN_LEN; 762 + tbl_mpp->free_node = &mesh_path_node_free; 763 + tbl_mpp->copy_node = &mesh_path_node_copy; 764 + tbl_mpp->mean_chain_len = MEAN_CHAIN_LEN; 765 + 766 + /* Need no locking since this is during init */ 767 + RCU_INIT_POINTER(mesh_paths, tbl_path); 768 + RCU_INIT_POINTER(mpp_paths, tbl_mpp); 807 769 808 770 return 0; 809 771 } 810 772 811 773 void mesh_path_expire(struct ieee80211_sub_if_data *sdata) 812 774 { 775 + struct mesh_table *tbl; 813 776 struct mesh_path *mpath; 814 777 struct mpath_node *node; 815 778 struct hlist_node *p; 816 779 int i; 817 780 818 - read_lock_bh(&pathtbl_resize_lock); 819 - for_each_mesh_entry(mesh_paths, p, node, i) { 781 + rcu_read_lock(); 782 + tbl = rcu_dereference(mesh_paths); 783 + for_each_mesh_entry(tbl, p, node, i) { 820 784 if (node->mpath->sdata != sdata) 821 785 continue; 822 786 mpath = node->mpath; 823 787 spin_lock_bh(&mpath->state_lock); 824 788 if ((!(mpath->flags & MESH_PATH_RESOLVING)) && 825 789 (!(mpath->flags & MESH_PATH_FIXED)) && 826 - time_after(jiffies, 827 - mpath->exp_time + MESH_PATH_EXPIRE)) { 790 + time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE)) { 828 791 spin_unlock_bh(&mpath->state_lock); 829 792 mesh_path_del(mpath->dst, mpath->sdata); 830 793 } else 831 794 spin_unlock_bh(&mpath->state_lock); 832 795 } 833 - read_unlock_bh(&pathtbl_resize_lock); 796 + rcu_read_unlock(); 834 797 } 835 798 836 799 void mesh_pathtbl_unregister(void) 837 800 { 838 - mesh_table_free(mesh_paths, true); 839 - mesh_table_free(mpp_paths, true); 801 + /* no need for locking during exit path */ 802 + mesh_table_free(rcu_dereference_raw(mesh_paths), true); 803 + mesh_table_free(rcu_dereference_raw(mpp_paths), true); 840 804 }
+5
net/mac80211/scan.c
··· 719 719 * without scheduling a new work 720 720 */ 721 721 do { 722 + if (!ieee80211_sdata_running(sdata)) { 723 + aborted = true; 724 + goto out_complete; 725 + } 726 + 722 727 switch (local->next_scan_state) { 723 728 case SCAN_DECISION: 724 729 /* if no more bands/channels left, complete scan */
+9
net/rfkill/Kconfig
··· 33 33 34 34 To compile this driver as a module, choose M here: the module will 35 35 be called rfkill-regulator. 36 + 37 + config RFKILL_GPIO 38 + tristate "GPIO RFKILL driver" 39 + depends on RFKILL && GPIOLIB && HAVE_CLK 40 + default n 41 + help 42 + If you say yes here you get support of a generic gpio RFKILL 43 + driver. The platform should fill in the appropriate fields in the 44 + rfkill_gpio_platform_data structure and pass that to the driver.
+1
net/rfkill/Makefile
··· 6 6 rfkill-$(CONFIG_RFKILL_INPUT) += input.o 7 7 obj-$(CONFIG_RFKILL) += rfkill.o 8 8 obj-$(CONFIG_RFKILL_REGULATOR) += rfkill-regulator.o 9 + obj-$(CONFIG_RFKILL_GPIO) += rfkill-gpio.o
+227
net/rfkill/rfkill-gpio.c
··· 1 + /* 2 + * Copyright (c) 2011, NVIDIA Corporation. 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + * This program is distributed in the hope that it will be useful, but WITHOUT 10 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 + * more details. 13 + * 14 + * You should have received a copy of the GNU General Public License along 15 + * with this program; if not, write to the Free Software Foundation, Inc., 16 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 + */ 18 + 19 + #include <linux/gpio.h> 20 + #include <linux/init.h> 21 + #include <linux/kernel.h> 22 + #include <linux/module.h> 23 + #include <linux/rfkill.h> 24 + #include <linux/platform_device.h> 25 + #include <linux/clk.h> 26 + #include <linux/slab.h> 27 + 28 + #include <linux/rfkill-gpio.h> 29 + 30 + enum rfkill_gpio_clk_state { 31 + UNSPECIFIED = 0, 32 + PWR_ENABLED, 33 + PWR_DISABLED 34 + }; 35 + 36 + #define PWR_CLK_SET(_RF, _EN) \ 37 + ((_RF)->pwr_clk_enabled = (!(_EN) ? PWR_ENABLED : PWR_DISABLED)) 38 + #define PWR_CLK_ENABLED(_RF) ((_RF)->pwr_clk_enabled == PWR_ENABLED) 39 + #define PWR_CLK_DISABLED(_RF) ((_RF)->pwr_clk_enabled != PWR_ENABLED) 40 + 41 + struct rfkill_gpio_data { 42 + struct rfkill_gpio_platform_data *pdata; 43 + struct rfkill *rfkill_dev; 44 + char *reset_name; 45 + char *shutdown_name; 46 + enum rfkill_gpio_clk_state pwr_clk_enabled; 47 + struct clk *pwr_clk; 48 + }; 49 + 50 + static int rfkill_gpio_set_power(void *data, bool blocked) 51 + { 52 + struct rfkill_gpio_data *rfkill = data; 53 + 54 + if (blocked) { 55 + if (gpio_is_valid(rfkill->pdata->shutdown_gpio)) 56 + gpio_direction_output(rfkill->pdata->shutdown_gpio, 0); 57 + if (gpio_is_valid(rfkill->pdata->reset_gpio)) 58 + gpio_direction_output(rfkill->pdata->reset_gpio, 0); 59 + if (rfkill->pwr_clk && PWR_CLK_ENABLED(rfkill)) 60 + clk_disable(rfkill->pwr_clk); 61 + } else { 62 + if (rfkill->pwr_clk && PWR_CLK_DISABLED(rfkill)) 63 + clk_enable(rfkill->pwr_clk); 64 + if (gpio_is_valid(rfkill->pdata->reset_gpio)) 65 + gpio_direction_output(rfkill->pdata->reset_gpio, 1); 66 + if (gpio_is_valid(rfkill->pdata->shutdown_gpio)) 67 + gpio_direction_output(rfkill->pdata->shutdown_gpio, 1); 68 + } 69 + 70 + if (rfkill->pwr_clk) 71 + PWR_CLK_SET(rfkill, blocked); 72 + 73 + return 0; 74 + } 75 + 76 + static const struct rfkill_ops rfkill_gpio_ops = { 77 + .set_block = rfkill_gpio_set_power, 78 + }; 79 + 80 + static int rfkill_gpio_probe(struct platform_device *pdev) 81 + { 82 + struct rfkill_gpio_data *rfkill; 83 + struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data; 84 + int ret = 0; 85 + int len = 0; 86 + 87 + if (!pdata) { 88 + pr_warn("%s: No platform data specified\n", __func__); 89 + return -EINVAL; 90 + } 91 + 92 + /* make sure at-least one of the GPIO is defined and that 93 + * a name is specified for this instance */ 94 + if (!pdata->name || (!gpio_is_valid(pdata->reset_gpio) && 95 + !gpio_is_valid(pdata->shutdown_gpio))) { 96 + pr_warn("%s: invalid platform data\n", __func__); 97 + return -EINVAL; 98 + } 99 + 100 + rfkill = kzalloc(sizeof(*rfkill), GFP_KERNEL); 101 + if (!rfkill) 102 + return -ENOMEM; 103 + 104 + rfkill->pdata = pdata; 105 + 106 + len = strlen(pdata->name); 107 + rfkill->reset_name = kzalloc(len + 7, GFP_KERNEL); 108 + if (!rfkill->reset_name) { 109 + ret = -ENOMEM; 110 + goto fail_alloc; 111 + } 112 + 113 + rfkill->shutdown_name = kzalloc(len + 10, GFP_KERNEL); 114 + if (!rfkill->shutdown_name) { 115 + ret = -ENOMEM; 116 + goto fail_reset_name; 117 + } 118 + 119 + snprintf(rfkill->reset_name, len + 6 , "%s_reset", pdata->name); 120 + snprintf(rfkill->shutdown_name, len + 9, "%s_shutdown", pdata->name); 121 + 122 + if (pdata->power_clk_name) { 123 + rfkill->pwr_clk = clk_get(&pdev->dev, pdata->power_clk_name); 124 + if (IS_ERR(rfkill->pwr_clk)) { 125 + pr_warn("%s: can't find pwr_clk.\n", __func__); 126 + goto fail_shutdown_name; 127 + } 128 + } 129 + 130 + if (gpio_is_valid(pdata->reset_gpio)) { 131 + ret = gpio_request(pdata->reset_gpio, rfkill->reset_name); 132 + if (ret) { 133 + pr_warn("%s: failed to get reset gpio.\n", __func__); 134 + goto fail_clock; 135 + } 136 + } 137 + 138 + if (gpio_is_valid(pdata->shutdown_gpio)) { 139 + ret = gpio_request(pdata->shutdown_gpio, rfkill->shutdown_name); 140 + if (ret) { 141 + pr_warn("%s: failed to get shutdown gpio.\n", __func__); 142 + goto fail_reset; 143 + } 144 + } 145 + 146 + rfkill->rfkill_dev = rfkill_alloc(pdata->name, &pdev->dev, pdata->type, 147 + &rfkill_gpio_ops, rfkill); 148 + if (!rfkill->rfkill_dev) 149 + goto fail_shutdown; 150 + 151 + ret = rfkill_register(rfkill->rfkill_dev); 152 + if (ret < 0) 153 + goto fail_rfkill; 154 + 155 + platform_set_drvdata(pdev, rfkill); 156 + 157 + dev_info(&pdev->dev, "%s device registered.\n", pdata->name); 158 + 159 + return 0; 160 + 161 + fail_rfkill: 162 + rfkill_destroy(rfkill->rfkill_dev); 163 + fail_shutdown: 164 + if (gpio_is_valid(pdata->shutdown_gpio)) 165 + gpio_free(pdata->shutdown_gpio); 166 + fail_reset: 167 + if (gpio_is_valid(pdata->reset_gpio)) 168 + gpio_free(pdata->reset_gpio); 169 + fail_clock: 170 + if (rfkill->pwr_clk) 171 + clk_put(rfkill->pwr_clk); 172 + fail_shutdown_name: 173 + kfree(rfkill->shutdown_name); 174 + fail_reset_name: 175 + kfree(rfkill->reset_name); 176 + fail_alloc: 177 + kfree(rfkill); 178 + 179 + return ret; 180 + } 181 + 182 + static int rfkill_gpio_remove(struct platform_device *pdev) 183 + { 184 + struct rfkill_gpio_data *rfkill = platform_get_drvdata(pdev); 185 + 186 + rfkill_unregister(rfkill->rfkill_dev); 187 + rfkill_destroy(rfkill->rfkill_dev); 188 + if (gpio_is_valid(rfkill->pdata->shutdown_gpio)) 189 + gpio_free(rfkill->pdata->shutdown_gpio); 190 + if (gpio_is_valid(rfkill->pdata->reset_gpio)) 191 + gpio_free(rfkill->pdata->reset_gpio); 192 + if (rfkill->pwr_clk && PWR_CLK_ENABLED(rfkill)) 193 + clk_disable(rfkill->pwr_clk); 194 + if (rfkill->pwr_clk) 195 + clk_put(rfkill->pwr_clk); 196 + kfree(rfkill->shutdown_name); 197 + kfree(rfkill->reset_name); 198 + kfree(rfkill); 199 + 200 + return 0; 201 + } 202 + 203 + static struct platform_driver rfkill_gpio_driver = { 204 + .probe = rfkill_gpio_probe, 205 + .remove = __devexit_p(rfkill_gpio_remove), 206 + .driver = { 207 + .name = "rfkill_gpio", 208 + .owner = THIS_MODULE, 209 + }, 210 + }; 211 + 212 + static int __init rfkill_gpio_init(void) 213 + { 214 + return platform_driver_register(&rfkill_gpio_driver); 215 + } 216 + 217 + static void __exit rfkill_gpio_exit(void) 218 + { 219 + platform_driver_unregister(&rfkill_gpio_driver); 220 + } 221 + 222 + module_init(rfkill_gpio_init); 223 + module_exit(rfkill_gpio_exit); 224 + 225 + MODULE_DESCRIPTION("gpio rfkill"); 226 + MODULE_AUTHOR("NVIDIA"); 227 + MODULE_LICENSE("GPL");
+4 -1
net/wireless/core.h
··· 245 245 u16 status; 246 246 } cr; 247 247 struct { 248 + struct ieee80211_channel *channel; 248 249 u8 bssid[ETH_ALEN]; 249 250 const u8 *req_ie; 250 251 const u8 *resp_ie; ··· 393 392 int cfg80211_disconnect(struct cfg80211_registered_device *rdev, 394 393 struct net_device *dev, u16 reason, 395 394 bool wextev); 396 - void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid, 395 + void __cfg80211_roamed(struct wireless_dev *wdev, 396 + struct ieee80211_channel *channel, 397 + const u8 *bssid, 397 398 const u8 *req_ie, size_t req_ie_len, 398 399 const u8 *resp_ie, size_t resp_ie_len); 399 400 int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
+4 -8
net/wireless/nl80211.c
··· 3294 3294 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 3295 3295 struct net_device *dev = info->user_ptr[1]; 3296 3296 struct cfg80211_scan_request *request; 3297 - struct cfg80211_ssid *ssid; 3298 - struct ieee80211_channel *channel; 3299 3297 struct nlattr *attr; 3300 3298 struct wiphy *wiphy; 3301 3299 int err, tmp, n_ssids = 0, n_channels, i; ··· 3340 3342 return -EINVAL; 3341 3343 3342 3344 request = kzalloc(sizeof(*request) 3343 - + sizeof(*ssid) * n_ssids 3344 - + sizeof(channel) * n_channels 3345 + + sizeof(*request->ssids) * n_ssids 3346 + + sizeof(*request->channels) * n_channels 3345 3347 + ie_len, GFP_KERNEL); 3346 3348 if (!request) 3347 3349 return -ENOMEM; ··· 3447 3449 struct cfg80211_sched_scan_request *request; 3448 3450 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 3449 3451 struct net_device *dev = info->user_ptr[1]; 3450 - struct cfg80211_ssid *ssid; 3451 - struct ieee80211_channel *channel; 3452 3452 struct nlattr *attr; 3453 3453 struct wiphy *wiphy; 3454 3454 int err, tmp, n_ssids = 0, n_channels, i; ··· 3503 3507 return -EINVAL; 3504 3508 3505 3509 request = kzalloc(sizeof(*request) 3506 - + sizeof(*ssid) * n_ssids 3507 - + sizeof(channel) * n_channels 3510 + + sizeof(*request->ssids) * n_ssids 3511 + + sizeof(*request->channels) * n_channels 3508 3512 + ie_len, GFP_KERNEL); 3509 3513 if (!request) 3510 3514 return -ENOMEM;
+14 -5
net/wireless/sme.c
··· 250 250 if (wdev->conn->params.privacy) 251 251 capa |= WLAN_CAPABILITY_PRIVACY; 252 252 253 - bss = cfg80211_get_bss(wdev->wiphy, NULL, wdev->conn->params.bssid, 253 + bss = cfg80211_get_bss(wdev->wiphy, wdev->conn->params.channel, 254 + wdev->conn->params.bssid, 254 255 wdev->conn->params.ssid, 255 256 wdev->conn->params.ssid_len, 256 257 WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_PRIVACY, ··· 471 470 } 472 471 473 472 if (!bss) 474 - bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid, 473 + bss = cfg80211_get_bss(wdev->wiphy, 474 + wdev->conn ? wdev->conn->params.channel : 475 + NULL, 476 + bssid, 475 477 wdev->ssid, wdev->ssid_len, 476 478 WLAN_CAPABILITY_ESS, 477 479 WLAN_CAPABILITY_ESS); ··· 542 538 } 543 539 EXPORT_SYMBOL(cfg80211_connect_result); 544 540 545 - void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid, 541 + void __cfg80211_roamed(struct wireless_dev *wdev, 542 + struct ieee80211_channel *channel, 543 + const u8 *bssid, 546 544 const u8 *req_ie, size_t req_ie_len, 547 545 const u8 *resp_ie, size_t resp_ie_len) 548 546 { ··· 571 565 cfg80211_put_bss(&wdev->current_bss->pub); 572 566 wdev->current_bss = NULL; 573 567 574 - bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid, 568 + bss = cfg80211_get_bss(wdev->wiphy, channel, bssid, 575 569 wdev->ssid, wdev->ssid_len, 576 570 WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); 577 571 ··· 609 603 #endif 610 604 } 611 605 612 - void cfg80211_roamed(struct net_device *dev, const u8 *bssid, 606 + void cfg80211_roamed(struct net_device *dev, 607 + struct ieee80211_channel *channel, 608 + const u8 *bssid, 613 609 const u8 *req_ie, size_t req_ie_len, 614 610 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp) 615 611 { ··· 627 619 return; 628 620 629 621 ev->type = EVENT_ROAMED; 622 + ev->rm.channel = channel; 630 623 memcpy(ev->rm.bssid, bssid, ETH_ALEN); 631 624 ev->rm.req_ie = ((u8 *)ev) + sizeof(*ev); 632 625 ev->rm.req_ie_len = req_ie_len;
+1 -1
net/wireless/util.c
··· 746 746 NULL); 747 747 break; 748 748 case EVENT_ROAMED: 749 - __cfg80211_roamed(wdev, ev->rm.bssid, 749 + __cfg80211_roamed(wdev, ev->rm.channel, ev->rm.bssid, 750 750 ev->rm.req_ie, ev->rm.req_ie_len, 751 751 ev->rm.resp_ie, ev->rm.resp_ie_len); 752 752 break;