Lines Matching defs:wl

155 static int b43legacy_ratelimit(struct b43legacy_wl *wl)
157 if (!wl || !wl->current_dev)
159 if (b43legacy_status(wl->current_dev) < B43legacy_STAT_STARTED)
166 void b43legacyinfo(struct b43legacy_wl *wl, const char *fmt, ...)
171 if (!b43legacy_ratelimit(wl))
180 (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
185 void b43legacyerr(struct b43legacy_wl *wl, const char *fmt, ...)
190 if (!b43legacy_ratelimit(wl))
199 (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
204 void b43legacywarn(struct b43legacy_wl *wl, const char *fmt, ...)
209 if (!b43legacy_ratelimit(wl))
218 (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
224 void b43legacydbg(struct b43legacy_wl *wl, const char *fmt, ...)
235 (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
527 const u8 *mac = dev->wl->mac_addr;
528 const u8 *bssid = dev->wl->bssid;
559 dev->wl->mac_addr);
857 if (b43legacy_is_mode(dev->wl, NL80211_IFTYPE_AP)) {
863 if (b43legacy_is_mode(dev->wl, NL80211_IFTYPE_ADHOC))
950 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(dev->wl->current_beacon);
952 bcn = (const struct ieee80211_mgmt *)(dev->wl->current_beacon->data);
953 len = min_t(size_t, dev->wl->current_beacon->len,
955 rate = ieee80211_get_tx_rate(dev->wl->hw, info)->hw_value;
1012 b43legacywarn(dev->wl, "Did not find a valid TIM IE in the "
1016 b43legacydbg(dev->wl, "Updated beacon template\n");
1029 dur = ieee80211_generic_frame_duration(dev->wl->hw,
1030 dev->wl->vif,
1061 src_size = dev->wl->current_beacon->len;
1062 src_data = (const u8 *)dev->wl->current_beacon->data;
1095 dur = ieee80211_generic_frame_duration(dev->wl->hw,
1096 dev->wl->vif,
1113 size = dev->wl->current_beacon->len;
1140 struct b43legacy_wl *wl = dev->wl;
1142 if (wl->beacon0_uploaded)
1149 wl->beacon0_uploaded = true;
1154 struct b43legacy_wl *wl = dev->wl;
1156 if (wl->beacon1_uploaded)
1159 wl->beacon1_uploaded = true;
1164 struct b43legacy_wl *wl = dev->wl;
1167 if (!b43legacy_is_mode(wl, NL80211_IFTYPE_AP))
1186 if (unlikely(wl->beacon_templates_virgin)) {
1189 wl->beacon_templates_virgin = false;
1212 struct b43legacy_wl *wl = container_of(work, struct b43legacy_wl,
1216 mutex_lock(&wl->mutex);
1217 dev = wl->current_dev;
1219 spin_lock_irq(&wl->irq_lock);
1225 spin_unlock_irq(&wl->irq_lock);
1227 mutex_unlock(&wl->mutex);
1231 * Locking: Requires wl->irq_lock to be locked. */
1232 static void b43legacy_update_templates(struct b43legacy_wl *wl)
1244 beacon = ieee80211_beacon_get(wl->hw, wl->vif, 0);
1248 if (wl->current_beacon)
1249 dev_kfree_skb_any(wl->current_beacon);
1250 wl->current_beacon = beacon;
1251 wl->beacon0_uploaded = false;
1252 wl->beacon1_uploaded = false;
1253 ieee80211_queue_work(wl->hw, &wl->beacon_update_trigger);
1270 b43legacydbg(dev->wl, "Set beacon interval to %u\n", beacon_int);
1287 spin_lock_irqsave(&dev->wl->irq_lock, flags);
1299 b43legacyerr(dev->wl, "MAC transmission error\n");
1302 b43legacyerr(dev->wl, "PHY transmission error\n");
1305 b43legacyerr(dev->wl, "Too many PHY TX errors, "
1314 b43legacyerr(dev->wl, "Fatal DMA error: "
1321 spin_unlock_irqrestore(&dev->wl->irq_lock, flags);
1325 b43legacyerr(dev->wl, "DMA error: "
1371 spin_unlock_irqrestore(&dev->wl->irq_lock, flags);
1423 spin_lock(&dev->wl->irq_lock);
1462 spin_unlock(&dev->wl->irq_lock);
1479 static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl)
1481 b43legacyerr(wl, "You must go to https://wireless.wiki.kernel.org/en/"
1509 b43legacyinfo(dev->wl, "Loading firmware %s\n", path);
1516 b43legacyerr(dev->wl, "Unable to load firmware\n");
1528 b43legacyerr(dev->wl, "Firmware file \"%s\" not found "
1553 b43legacyerr(dev->wl, "Firmware file \"%s\" format error.\n", path);
1558 struct b43legacy_wl *wl);
1563 struct b43legacy_wl *wl = container_of(work,
1565 struct b43legacy_wldev *dev = wl->current_dev;
1629 err = ieee80211_register_hw(wl->hw);
1639 b43legacy_print_fw_helptext(dev->wl);
1644 b43legacyerr(dev->wl, "No Initial Values firmware file for PHY %u, "
1655 struct wiphy *wiphy = dev->wl->hw->wiphy;
1723 b43legacyerr(dev->wl, "Microcode not responding\n");
1724 b43legacy_print_fw_helptext(dev->wl);
1748 b43legacyerr(dev->wl, "YOU ARE TRYING TO LOAD V4 FIRMWARE."
1752 b43legacy_print_fw_helptext(dev->wl);
1756 b43legacyinfo(dev->wl, "Loading firmware version 0x%X, patch level %u "
1835 b43legacyerr(dev->wl, "Initial Values Firmware file-format error.\n");
1836 b43legacy_print_fw_helptext(dev->wl);
1957 spin_lock_irq(&dev->wl->irq_lock);
1960 spin_unlock_irq(&dev->wl->irq_lock);
1977 spin_lock_irq(&dev->wl->irq_lock);
1979 spin_unlock_irq(&dev->wl->irq_lock);
1995 b43legacyerr(dev->wl, "MAC suspend failed\n");
2003 struct b43legacy_wl *wl = dev->wl;
2017 if (b43legacy_is_mode(wl, NL80211_IFTYPE_AP))
2019 else if (b43legacy_is_mode(wl, NL80211_IFTYPE_ADHOC))
2022 if (wl->filter_flags & FIF_CONTROL)
2024 if (wl->filter_flags & FIF_FCSFAIL)
2026 if (wl->filter_flags & FIF_PLCPFAIL)
2028 if (wl->filter_flags & FIF_BCN_PRBRESP_PROMISC)
2248 b43legacydbg(dev->wl, "Chip initialized\n");
2311 * wl->mutex. If another lock is needed somewhere in the
2318 struct b43legacy_wl *wl = dev->wl;
2321 mutex_lock(&wl->mutex);
2336 ieee80211_queue_delayed_work(wl->hw, &dev->periodic_work, delay);
2338 mutex_unlock(&wl->mutex);
2347 ieee80211_queue_delayed_work(dev->wl->hw, work, 0);
2378 b43legacyerr(dev->wl, "Failed to validate the chipaccess\n");
2401 struct b43legacy_wl *wl = (struct b43legacy_wl *)rng->priv;
2404 /* Don't take wl->mutex here, as it could deadlock with
2406 * wl->mutex here, anyway. */
2408 spin_lock_irqsave(&wl->irq_lock, flags);
2409 *data = b43legacy_read16(wl->current_dev, B43legacy_MMIO_RNG);
2410 spin_unlock_irqrestore(&wl->irq_lock, flags);
2416 static void b43legacy_rng_exit(struct b43legacy_wl *wl)
2419 if (wl->rng_initialized)
2420 hwrng_unregister(&wl->rng);
2424 static int b43legacy_rng_init(struct b43legacy_wl *wl)
2429 snprintf(wl->rng_name, ARRAY_SIZE(wl->rng_name),
2430 "%s_%s", KBUILD_MODNAME, wiphy_name(wl->hw->wiphy));
2431 wl->rng.name = wl->rng_name;
2432 wl->rng.data_read = b43legacy_rng_read;
2433 wl->rng.priv = (unsigned long)wl;
2434 wl->rng_initialized = 1;
2435 err = hwrng_register(&wl->rng);
2437 wl->rng_initialized = 0;
2438 b43legacyerr(wl, "Failed to register the random "
2448 struct b43legacy_wl *wl = container_of(work, struct b43legacy_wl,
2455 mutex_lock(&wl->mutex);
2456 dev = wl->current_dev;
2458 mutex_unlock(&wl->mutex);
2463 while (skb_queue_len(&wl->tx_queue[queue_num])) {
2464 skb = skb_dequeue(&wl->tx_queue[queue_num]);
2470 wl->tx_queue_stopped[queue_num] = 1;
2471 ieee80211_stop_queue(wl->hw, queue_num);
2472 skb_queue_head(&wl->tx_queue[queue_num], skb);
2481 wl->tx_queue_stopped[queue_num] = 0;
2484 mutex_unlock(&wl->mutex);
2491 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
2500 skb_queue_tail(&wl->tx_queue[skb->queue_mapping], skb);
2501 if (!wl->tx_queue_stopped[skb->queue_mapping])
2502 ieee80211_queue_work(wl->hw, &wl->tx_work);
2504 ieee80211_stop_queue(wl->hw, skb->queue_mapping);
2518 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
2521 spin_lock_irqsave(&wl->irq_lock, flags);
2522 memcpy(stats, &wl->ieee_stats, sizeof(*stats));
2523 spin_unlock_irqrestore(&wl->irq_lock, flags);
2541 static int find_wldev_for_phymode(struct b43legacy_wl *wl,
2548 list_for_each_entry(d, &wl->devlist, list) {
2581 /* Expects wl->mutex locked */
2582 static int b43legacy_switch_phymode(struct b43legacy_wl *wl,
2591 err = find_wldev_for_phymode(wl, new_mode, &up_dev, &gmode);
2593 b43legacyerr(wl, "Could not find a device for %s-PHY mode\n",
2597 if ((up_dev == wl->current_dev) &&
2598 (!!wl->current_dev->phy.gmode == !!gmode))
2601 b43legacydbg(wl, "Reconfiguring PHYmode to %s-PHY\n",
2603 down_dev = wl->current_dev;
2622 b43legacyerr(wl, "Fatal: Could not initialize device"
2631 b43legacyerr(wl, "Fatal: Could not start device for "
2642 wl->current_dev = up_dev;
2647 wl->current_dev = NULL;
2668 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
2679 mutex_lock(&wl->mutex);
2680 dev = wl->current_dev;
2702 err = b43legacy_switch_phymode(wl, new_phymode);
2709 spin_lock_irqsave(&wl->irq_lock, flags);
2711 spin_unlock_irqrestore(&wl->irq_lock, flags);
2715 spin_unlock_irqrestore(&wl->irq_lock, flags);
2724 dev->wl->radiotap_enabled = !!(conf->flags & IEEE80211_CONF_MONITOR);
2737 if (wl->radio_enabled != phy->radio_on) {
2738 if (wl->radio_enabled) {
2740 b43legacyinfo(dev->wl, "Radio turned on by software\n");
2742 b43legacyinfo(dev->wl, "The hardware RF-kill"
2748 b43legacyinfo(dev->wl, "Radio turned off by"
2753 spin_lock_irqsave(&wl->irq_lock, flags);
2755 spin_unlock_irqrestore(&wl->irq_lock, flags);
2757 mutex_unlock(&wl->mutex);
2765 dev->wl->hw->wiphy->bands[NL80211_BAND_2GHZ];
2812 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
2816 mutex_lock(&wl->mutex);
2817 B43legacy_WARN_ON(wl->vif != vif);
2819 dev = wl->current_dev;
2824 spin_lock_irqsave(&wl->irq_lock, flags);
2826 spin_unlock_irqrestore(&wl->irq_lock, flags);
2835 memcpy(wl->bssid, conf->bssid, ETH_ALEN);
2837 eth_zero_addr(wl->bssid);
2842 (b43legacy_is_mode(wl, NL80211_IFTYPE_AP) ||
2843 b43legacy_is_mode(wl, NL80211_IFTYPE_ADHOC)))
2844 b43legacy_update_templates(wl);
2849 spin_unlock_irqrestore(&wl->irq_lock, flags);
2854 (b43legacy_is_mode(wl, NL80211_IFTYPE_AP) ||
2855 b43legacy_is_mode(wl, NL80211_IFTYPE_ADHOC)))
2870 spin_lock_irqsave(&wl->irq_lock, flags);
2873 spin_unlock_irqrestore(&wl->irq_lock, flags);
2875 mutex_unlock(&wl->mutex);
2882 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
2883 struct b43legacy_wldev *dev = wl->current_dev;
2891 spin_lock_irqsave(&wl->irq_lock, flags);
2906 wl->filter_flags = *fflags;
2910 spin_unlock_irqrestore(&wl->irq_lock, flags);
2913 /* Locking: wl->mutex */
2916 struct b43legacy_wl *wl = dev->wl;
2926 spin_lock_irqsave(&wl->irq_lock, flags);
2929 spin_unlock_irqrestore(&wl->irq_lock, flags);
2934 mutex_unlock(&wl->mutex);
2938 cancel_work_sync(&wl->tx_work);
2939 mutex_lock(&wl->mutex);
2943 while (skb_queue_len(&wl->tx_queue[queue_num]))
2944 dev_kfree_skb(skb_dequeue(&wl->tx_queue[queue_num]));
2949 b43legacydbg(wl, "Wireless interface stopped\n");
2952 /* Locking: wl->mutex */
2963 b43legacyerr(dev->wl, "Cannot request IRQ-%d\n",
2968 ieee80211_wake_queues(dev->wl->hw);
2978 b43legacydbg(dev->wl, "Wireless interface started\n");
3016 b43legacyerr(dev->wl, "FOUND UNSUPPORTED PHY "
3021 b43legacydbg(dev->wl, "Found PHY: Analog %u, Type %u, Revision %u\n",
3058 b43legacyerr(dev->wl, "FOUND UNSUPPORTED RADIO "
3063 b43legacydbg(dev->wl, "Found Radio: Manuf 0x%X, Version 0x%X,"
3148 if (b43legacy_is_mode(dev->wl, NL80211_IFTYPE_ADHOC) || idle)
3163 if (b43legacy_is_mode(dev->wl, NL80211_IFTYPE_ADHOC))
3173 /* Locking: wl->mutex */
3191 b43legacy_rng_exit(dev->wl);
3201 if (dev->wl->current_beacon) {
3202 dev_kfree_skb_any(dev->wl->current_beacon);
3203 dev->wl->current_beacon = NULL;
3252 struct b43legacy_wl *wl = dev->wl;
3355 b43legacy_rng_init(wl);
3357 ieee80211_wake_queues(dev->wl->hw);
3380 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
3392 mutex_lock(&wl->mutex);
3393 if (wl->operating)
3396 b43legacydbg(wl, "Adding Interface type %d\n", vif->type);
3398 dev = wl->current_dev;
3399 wl->operating = true;
3400 wl->vif = vif;
3401 wl->if_type = vif->type;
3402 memcpy(wl->mac_addr, vif->addr, ETH_ALEN);
3404 spin_lock_irqsave(&wl->irq_lock, flags);
3409 spin_unlock_irqrestore(&wl->irq_lock, flags);
3413 mutex_unlock(&wl->mutex);
3421 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
3422 struct b43legacy_wldev *dev = wl->current_dev;
3425 b43legacydbg(wl, "Removing Interface type %d\n", vif->type);
3427 mutex_lock(&wl->mutex);
3429 B43legacy_WARN_ON(!wl->operating);
3430 B43legacy_WARN_ON(wl->vif != vif);
3431 wl->vif = NULL;
3433 wl->operating = false;
3435 spin_lock_irqsave(&wl->irq_lock, flags);
3437 eth_zero_addr(wl->mac_addr);
3439 spin_unlock_irqrestore(&wl->irq_lock, flags);
3441 mutex_unlock(&wl->mutex);
3446 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
3447 struct b43legacy_wldev *dev = wl->current_dev;
3454 eth_zero_addr(wl->bssid);
3455 eth_zero_addr(wl->mac_addr);
3456 wl->filter_flags = 0;
3457 wl->beacon0_uploaded = false;
3458 wl->beacon1_uploaded = false;
3459 wl->beacon_templates_virgin = true;
3460 wl->radio_enabled = true;
3462 mutex_lock(&wl->mutex);
3483 mutex_unlock(&wl->mutex);
3490 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
3491 struct b43legacy_wldev *dev = wl->current_dev;
3493 cancel_work_sync(&(wl->beacon_update_trigger));
3495 mutex_lock(&wl->mutex);
3499 wl->radio_enabled = false;
3500 mutex_unlock(&wl->mutex);
3506 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
3509 spin_lock_irqsave(&wl->irq_lock, flags);
3510 b43legacy_update_templates(wl);
3511 spin_unlock_irqrestore(&wl->irq_lock, flags);
3519 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
3520 struct b43legacy_wldev *dev = wl->current_dev;
3561 struct b43legacy_wl *wl = dev->wl;
3565 mutex_lock(&wl->mutex);
3589 wl->current_dev = NULL; /* Failed to init the dev. */
3590 mutex_unlock(&wl->mutex);
3592 b43legacyerr(wl, "Controller restart FAILED\n");
3594 b43legacyinfo(wl, "Controller restarted\n");
3601 struct ieee80211_hw *hw = dev->wl->hw;
3629 struct b43legacy_wl *wl = dev->wl;
3646 b43legacyerr(wl, "Bus powerup failed\n");
3701 if (!wl->current_dev)
3702 wl->current_dev = dev;
3721 struct b43legacy_wl *wl;
3727 wl = wldev->wl;
3731 wl->nr_devs--;
3737 struct b43legacy_wl *wl)
3747 wldev->wl = wl;
3759 list_add(&wldev->list, &wl->devlist);
3760 wl->nr_devs++;
3781 struct b43legacy_wl *wl)
3783 struct ieee80211_hw *hw = wl->hw;
3793 struct b43legacy_wl *wl;
3799 hw = ieee80211_alloc_hw(sizeof(*wl), &b43legacy_hw_ops);
3825 wl = hw_to_b43legacy_wl(hw);
3826 memset(wl, 0, sizeof(*wl));
3827 wl->hw = hw;
3828 spin_lock_init(&wl->irq_lock);
3829 spin_lock_init(&wl->leds_lock);
3830 mutex_init(&wl->mutex);
3831 INIT_LIST_HEAD(&wl->devlist);
3832 INIT_WORK(&wl->beacon_update_trigger, b43legacy_beacon_update_trigger_work);
3833 INIT_WORK(&wl->tx_work, b43legacy_tx_work);
3837 skb_queue_head_init(&wl->tx_queue[queue_num]);
3838 wl->tx_queue_stopped[queue_num] = 0;
3841 ssb_set_devtypedata(dev, wl);
3842 b43legacyinfo(wl, "Broadcom %04X WLAN found (core revision %u)\n",
3852 struct b43legacy_wl *wl;
3856 wl = ssb_get_devtypedata(dev);
3857 if (!wl) {
3863 wl = ssb_get_devtypedata(dev);
3864 B43legacy_WARN_ON(!wl);
3866 err = b43legacy_one_core_attach(dev, wl);
3871 INIT_WORK(&wl->firmware_load, b43legacy_request_firmware);
3872 schedule_work(&wl->firmware_load);
3879 b43legacy_wireless_exit(dev, wl);
3885 struct b43legacy_wl *wl = ssb_get_devtypedata(dev);
3891 cancel_work_sync(&wl->firmware_load);
3894 B43legacy_WARN_ON(!wl);
3897 if (wl->current_dev == wldev)
3898 ieee80211_unregister_hw(wl->hw);
3902 if (list_empty(&wl->devlist))
3906 b43legacy_wireless_exit(dev, wl);
3916 b43legacyinfo(dev->wl, "Controller RESET (%s) ...\n", reason);
3917 ieee80211_queue_work(dev->wl->hw, &dev->restart_work);
3925 struct b43legacy_wl *wl = wldev->wl;
3927 b43legacydbg(wl, "Suspending...\n");
3929 mutex_lock(&wl->mutex);
3935 mutex_unlock(&wl->mutex);
3937 b43legacydbg(wl, "Device suspended.\n");
3945 struct b43legacy_wl *wl = wldev->wl;
3948 b43legacydbg(wl, "Resuming...\n");
3950 mutex_lock(&wl->mutex);
3954 b43legacyerr(wl, "Resume failed at core init\n");
3962 b43legacyerr(wl, "Resume failed at core start\n");
3967 b43legacydbg(wl, "Device resumed.\n");
3969 mutex_unlock(&wl->mutex);