^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright 2002-2005, Instant802 Networks, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright 2005-2006, Devicescape Software, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright 2013-2014 Intel Mobile Communications GmbH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (C) 2017 Intel Deutschland GmbH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Copyright (C) 2018 - 2019 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <net/mac80211.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/fips.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/skbuff.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/etherdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/if_arp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/rtnetlink.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/bitmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/inetdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <net/net_namespace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <net/cfg80211.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <net/addrconf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include "ieee80211_i.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include "driver-ops.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include "rate.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #include "mesh.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #include "wep.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #include "led.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #include "debugfs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) void ieee80211_configure_filter(struct ieee80211_local *local)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) u64 mc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) unsigned int changed_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) unsigned int new_flags = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) if (atomic_read(&local->iff_allmultis))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) new_flags |= FIF_ALLMULTI;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) if (local->monitors || test_bit(SCAN_SW_SCANNING, &local->scanning) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) test_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) new_flags |= FIF_BCN_PRBRESP_PROMISC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) if (local->fif_probe_req || local->probe_req_reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) new_flags |= FIF_PROBE_REQ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) if (local->fif_fcsfail)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) new_flags |= FIF_FCSFAIL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) if (local->fif_plcpfail)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) new_flags |= FIF_PLCPFAIL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) if (local->fif_control)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) new_flags |= FIF_CONTROL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) if (local->fif_other_bss)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) new_flags |= FIF_OTHER_BSS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) if (local->fif_pspoll)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) new_flags |= FIF_PSPOLL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) if (local->rx_mcast_action_reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) new_flags |= FIF_MCAST_ACTION;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) spin_lock_bh(&local->filter_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) changed_flags = local->filter_flags ^ new_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) mc = drv_prepare_multicast(local, &local->mc_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) spin_unlock_bh(&local->filter_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /* be a bit nasty */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) new_flags |= (1<<31);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) drv_configure_filter(local, changed_flags, &new_flags, mc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) WARN_ON(new_flags & (1<<31));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) local->filter_flags = new_flags & ~(1<<31);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) static void ieee80211_reconfig_filter(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) struct ieee80211_local *local =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) container_of(work, struct ieee80211_local, reconfig_filter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) ieee80211_configure_filter(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) struct ieee80211_sub_if_data *sdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) struct cfg80211_chan_def chandef = {};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) u32 changed = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) int power;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) u32 offchannel_flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) if (local->scan_chandef.chan) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) chandef = local->scan_chandef;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) } else if (local->tmp_channel) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) chandef.chan = local->tmp_channel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) chandef.center_freq1 = chandef.chan->center_freq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) chandef.freq1_offset = chandef.chan->freq_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) } else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) chandef = local->_oper_chandef;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) WARN(!cfg80211_chandef_valid(&chandef),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) "control:%d.%03d MHz width:%d center: %d.%03d/%d MHz",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) chandef.chan->center_freq, chandef.chan->freq_offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) chandef.width, chandef.center_freq1, chandef.freq1_offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) chandef.center_freq2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) if (!cfg80211_chandef_identical(&chandef, &local->_oper_chandef))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) if (offchannel_flag ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) !cfg80211_chandef_identical(&local->hw.conf.chandef,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) &local->_oper_chandef)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) local->hw.conf.chandef = chandef;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) changed |= IEEE80211_CONF_CHANGE_CHANNEL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) if (!conf_is_ht(&local->hw.conf)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * mac80211.h documents that this is only valid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * when the channel is set to an HT type, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * that otherwise STATIC is used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) local->hw.conf.smps_mode = IEEE80211_SMPS_STATIC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) } else if (local->hw.conf.smps_mode != local->smps_mode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) local->hw.conf.smps_mode = local->smps_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) changed |= IEEE80211_CONF_CHANGE_SMPS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) power = ieee80211_chandef_max_power(&chandef);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) rcu_read_lock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) list_for_each_entry_rcu(sdata, &local->interfaces, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) if (!rcu_access_pointer(sdata->vif.chanctx_conf))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) if (sdata->vif.bss_conf.txpower == INT_MIN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) power = min(power, sdata->vif.bss_conf.txpower);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) rcu_read_unlock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) if (local->hw.conf.power_level != power) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) changed |= IEEE80211_CONF_CHANGE_POWER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) local->hw.conf.power_level = power;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) return changed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) if (!local->use_chanctx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) changed |= ieee80211_hw_conf_chan(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) changed &= ~(IEEE80211_CONF_CHANGE_CHANNEL |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) IEEE80211_CONF_CHANGE_POWER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) if (changed && local->open_count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) ret = drv_config(local, changed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) * Goal:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * HW reconfiguration should never fail, the driver has told
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) * us what it can support so it should live up to that promise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) * Current status:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) * rfkill is not integrated with mac80211 and a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) * configuration command can thus fail if hardware rfkill
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) * is enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * FIXME: integrate rfkill with mac80211 and then add this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) * WARN_ON() back
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) /* WARN_ON(ret); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) u32 changed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) struct ieee80211_local *local = sdata->local;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) if (!changed || sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) drv_bss_info_changed(local, sdata, &sdata->vif.bss_conf, changed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) sdata->vif.bss_conf.use_cts_prot = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) sdata->vif.bss_conf.use_short_preamble = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) sdata->vif.bss_conf.use_short_slot = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) return BSS_CHANGED_ERP_CTS_PROT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) BSS_CHANGED_ERP_PREAMBLE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) BSS_CHANGED_ERP_SLOT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) static void ieee80211_tasklet_handler(unsigned long data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) struct ieee80211_local *local = (struct ieee80211_local *) data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) struct sk_buff *skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) while ((skb = skb_dequeue(&local->skb_queue)) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) (skb = skb_dequeue(&local->skb_queue_unreliable))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) switch (skb->pkt_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) case IEEE80211_RX_MSG:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) /* Clear skb->pkt_type in order to not confuse kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) * netstack. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) skb->pkt_type = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) ieee80211_rx(&local->hw, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) case IEEE80211_TX_STATUS_MSG:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) skb->pkt_type = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) ieee80211_tx_status(&local->hw, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) WARN(1, "mac80211: Packet is of unknown type %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) skb->pkt_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) dev_kfree_skb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) static void ieee80211_restart_work(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) struct ieee80211_local *local =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) container_of(work, struct ieee80211_local, restart_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) struct ieee80211_sub_if_data *sdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) /* wait for scan work complete */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) flush_workqueue(local->workqueue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) flush_work(&local->sched_scan_stopped_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) WARN(test_bit(SCAN_HW_SCANNING, &local->scanning),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) "%s called with hardware scan in progress\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) flush_work(&local->radar_detected_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) rtnl_lock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) list_for_each_entry(sdata, &local->interfaces, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) * XXX: there may be more work for other vif types and even
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) * for station mode: a good thing would be to run most of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) * the iface type's dependent _stop (ieee80211_mg_stop,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) * ieee80211_ibss_stop) etc...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) * For now, fix only the specific bug that was seen: race
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) * between csa_connection_drop_work and us.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) if (sdata->vif.type == NL80211_IFTYPE_STATION) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) * This worker is scheduled from the iface worker that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) * runs on mac80211's workqueue, so we can't be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) * scheduling this worker after the cancel right here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) * The exception is ieee80211_chswitch_done.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) * Then we can have a race...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) cancel_work_sync(&sdata->u.mgd.csa_connection_drop_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) flush_delayed_work(&sdata->dec_tailroom_needed_wk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) ieee80211_scan_cancel(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) /* make sure any new ROC will consider local->in_reconfig */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) flush_delayed_work(&local->roc_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) flush_work(&local->hw_roc_done);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) /* wait for all packet processing to be done */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) synchronize_net();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) ieee80211_reconfig(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) rtnl_unlock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) void ieee80211_restart_hw(struct ieee80211_hw *hw)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) struct ieee80211_local *local = hw_to_local(hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) trace_api_restart_hw(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) wiphy_info(hw->wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) "Hardware restart was requested\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) /* use this reason, ieee80211_reconfig will unblock it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) ieee80211_stop_queues_by_reason(hw, IEEE80211_MAX_QUEUE_MAP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) IEEE80211_QUEUE_STOP_REASON_SUSPEND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) * Stop all Rx during the reconfig. We don't want state changes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) * or driver callbacks while this is in progress.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) local->in_reconfig = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) barrier();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) queue_work(system_freezable_wq, &local->restart_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) EXPORT_SYMBOL(ieee80211_restart_hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) #ifdef CONFIG_INET
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) static int ieee80211_ifa_changed(struct notifier_block *nb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) unsigned long data, void *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) struct in_ifaddr *ifa = arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) struct ieee80211_local *local =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) container_of(nb, struct ieee80211_local,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) ifa_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) struct net_device *ndev = ifa->ifa_dev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) struct wireless_dev *wdev = ndev->ieee80211_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) struct in_device *idev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) struct ieee80211_sub_if_data *sdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) struct ieee80211_bss_conf *bss_conf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) struct ieee80211_if_managed *ifmgd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) int c = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) /* Make sure it's our interface that got changed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) if (!wdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) if (wdev->wiphy != local->hw.wiphy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) sdata = IEEE80211_DEV_TO_SUB_IF(ndev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) bss_conf = &sdata->vif.bss_conf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) /* ARP filtering is only supported in managed mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) if (sdata->vif.type != NL80211_IFTYPE_STATION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) idev = __in_dev_get_rtnl(sdata->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) if (!idev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) ifmgd = &sdata->u.mgd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) sdata_lock(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) /* Copy the addresses to the bss_conf list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) ifa = rtnl_dereference(idev->ifa_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) while (ifa) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) if (c < IEEE80211_BSS_ARP_ADDR_LIST_LEN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) bss_conf->arp_addr_list[c] = ifa->ifa_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) ifa = rtnl_dereference(ifa->ifa_next);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) c++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) bss_conf->arp_addr_cnt = c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) /* Configure driver only if associated (which also implies it is up) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) if (ifmgd->associated)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) ieee80211_bss_info_change_notify(sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) BSS_CHANGED_ARP_FILTER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) sdata_unlock(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) return NOTIFY_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) #if IS_ENABLED(CONFIG_IPV6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) static int ieee80211_ifa6_changed(struct notifier_block *nb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) unsigned long data, void *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) struct inet6_dev *idev = ifa->idev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) struct net_device *ndev = ifa->idev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) struct ieee80211_local *local =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) container_of(nb, struct ieee80211_local, ifa6_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) struct wireless_dev *wdev = ndev->ieee80211_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) struct ieee80211_sub_if_data *sdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) /* Make sure it's our interface that got changed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) if (!wdev || wdev->wiphy != local->hw.wiphy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) sdata = IEEE80211_DEV_TO_SUB_IF(ndev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) * For now only support station mode. This is mostly because
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) * doing AP would have to handle AP_VLAN in some way ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) if (sdata->vif.type != NL80211_IFTYPE_STATION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) drv_ipv6_addr_change(local, sdata, idev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) return NOTIFY_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) /* There isn't a lot of sense in it, but you can transmit anything you like */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) static const struct ieee80211_txrx_stypes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) [NL80211_IFTYPE_ADHOC] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) .tx = 0xffff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) BIT(IEEE80211_STYPE_AUTH >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) BIT(IEEE80211_STYPE_DEAUTH >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) BIT(IEEE80211_STYPE_PROBE_REQ >> 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) [NL80211_IFTYPE_STATION] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) .tx = 0xffff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) * To support Pre Association Security Negotiation (PASN) while
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) * already associated to one AP, allow user space to register to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) * Rx authentication frames, so that the user space logic would
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) * be able to receive/handle authentication frames from a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) * different AP as part of PASN.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) * It is expected that user space would intelligently register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) * for Rx authentication frames, i.e., only when PASN is used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) * and configure a match filter only for PASN authentication
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) * algorithm, as otherwise the MLME functionality of mac80211
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) * would be broken.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) BIT(IEEE80211_STYPE_AUTH >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) BIT(IEEE80211_STYPE_PROBE_REQ >> 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) [NL80211_IFTYPE_AP] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) .tx = 0xffff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) BIT(IEEE80211_STYPE_DISASSOC >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) BIT(IEEE80211_STYPE_AUTH >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) BIT(IEEE80211_STYPE_DEAUTH >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) BIT(IEEE80211_STYPE_ACTION >> 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) [NL80211_IFTYPE_AP_VLAN] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) /* copy AP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) .tx = 0xffff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) BIT(IEEE80211_STYPE_DISASSOC >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) BIT(IEEE80211_STYPE_AUTH >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) BIT(IEEE80211_STYPE_DEAUTH >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) BIT(IEEE80211_STYPE_ACTION >> 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) [NL80211_IFTYPE_P2P_CLIENT] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) .tx = 0xffff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) BIT(IEEE80211_STYPE_PROBE_REQ >> 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) [NL80211_IFTYPE_P2P_GO] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) .tx = 0xffff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) BIT(IEEE80211_STYPE_DISASSOC >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) BIT(IEEE80211_STYPE_AUTH >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) BIT(IEEE80211_STYPE_DEAUTH >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) BIT(IEEE80211_STYPE_ACTION >> 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) [NL80211_IFTYPE_MESH_POINT] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) .tx = 0xffff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) BIT(IEEE80211_STYPE_AUTH >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) BIT(IEEE80211_STYPE_DEAUTH >> 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) [NL80211_IFTYPE_P2P_DEVICE] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) .tx = 0xffff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) BIT(IEEE80211_STYPE_PROBE_REQ >> 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) static const struct ieee80211_ht_cap mac80211_ht_capa_mod_mask = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) .ampdu_params_info = IEEE80211_HT_AMPDU_PARM_FACTOR |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) IEEE80211_HT_AMPDU_PARM_DENSITY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) .cap_info = cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) IEEE80211_HT_CAP_MAX_AMSDU |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) IEEE80211_HT_CAP_SGI_20 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) IEEE80211_HT_CAP_SGI_40 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) IEEE80211_HT_CAP_TX_STBC |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) IEEE80211_HT_CAP_RX_STBC |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) IEEE80211_HT_CAP_LDPC_CODING |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) IEEE80211_HT_CAP_40MHZ_INTOLERANT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) .mcs = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) .rx_mask = { 0xff, 0xff, 0xff, 0xff, 0xff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 0xff, 0xff, 0xff, 0xff, 0xff, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) static const struct ieee80211_vht_cap mac80211_vht_capa_mod_mask = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) .vht_cap_info =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) cpu_to_le32(IEEE80211_VHT_CAP_RXLDPC |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) IEEE80211_VHT_CAP_SHORT_GI_80 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) IEEE80211_VHT_CAP_SHORT_GI_160 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) IEEE80211_VHT_CAP_RXSTBC_MASK |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) IEEE80211_VHT_CAP_TXSTBC |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) .supp_mcs = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) .rx_mcs_map = cpu_to_le16(~0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) .tx_mcs_map = cpu_to_le16(~0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) const struct ieee80211_ops *ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) const char *requested_name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) struct ieee80211_local *local;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) int priv_size, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) struct wiphy *wiphy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) bool use_chanctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) if (WARN_ON(!ops->tx || !ops->start || !ops->stop || !ops->config ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) !ops->add_interface || !ops->remove_interface ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) !ops->configure_filter))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) /* check all or no channel context operations exist */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) i = !!ops->add_chanctx + !!ops->remove_chanctx +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) !!ops->change_chanctx + !!ops->assign_vif_chanctx +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) !!ops->unassign_vif_chanctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) if (WARN_ON(i != 0 && i != 5))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) use_chanctx = i == 5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) /* Ensure 32-byte alignment of our private data and hw private data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) * We use the wiphy priv data for both our ieee80211_local and for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) * the driver's private data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) * In memory it'll be like this:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) * +-------------------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) * | struct wiphy |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) * +-------------------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) * | struct ieee80211_local |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) * +-------------------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) * | driver's private data |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) * +-------------------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) wiphy = wiphy_new_nm(&mac80211_config_ops, priv_size, requested_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) if (!wiphy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) wiphy->mgmt_stypes = ieee80211_default_mgmt_stypes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) wiphy->privid = mac80211_wiphy_privid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) wiphy->flags |= WIPHY_FLAG_NETNS_OK |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) WIPHY_FLAG_4ADDR_AP |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) WIPHY_FLAG_4ADDR_STATION |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) WIPHY_FLAG_REPORTS_OBSS |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) WIPHY_FLAG_OFFCHAN_TX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) if (!use_chanctx || ops->remain_on_channel)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) wiphy->features |= NL80211_FEATURE_SK_TX_STATUS |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) NL80211_FEATURE_SAE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) NL80211_FEATURE_HT_IBSS |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) NL80211_FEATURE_VIF_TXPOWER |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) NL80211_FEATURE_MAC_ON_CREATE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) NL80211_FEATURE_USERSPACE_MPM |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) NL80211_FEATURE_FULL_AP_CLIENT_STATE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_FILS_STA);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) wiphy_ext_feature_set(wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) wiphy_ext_feature_set(wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) wiphy_ext_feature_set(wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_TX_STATUS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) wiphy_ext_feature_set(wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) NL80211_EXT_FEATURE_SCAN_FREQ_KHZ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) if (!ops->hw_scan) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) NL80211_FEATURE_AP_SCAN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) * if the driver behaves correctly using the probe request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) * (template) from mac80211, then both of these should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) * supported even with hw scan - but let drivers opt in.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) wiphy_ext_feature_set(wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) NL80211_EXT_FEATURE_SCAN_RANDOM_SN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) wiphy_ext_feature_set(wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) if (!ops->set_key)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) if (ops->wake_tx_queue)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_TXQS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_RRM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) wiphy->bss_priv_size = sizeof(struct ieee80211_bss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) local = wiphy_priv(wiphy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) if (sta_info_init(local))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) goto err_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) local->hw.wiphy = wiphy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) local->ops = ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) local->use_chanctx = use_chanctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) * We need a bit of data queued to build aggregates properly, so
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) * instruct the TCP stack to allow more than a single ms of data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) * to be queued in the stack. The value is a bit-shift of 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) * second, so 7 is ~8ms of queued data. Only affects local TCP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) * sockets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) * This is the default, anyhow - drivers may need to override it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) * for local reasons (longer buffers, longer completion time, or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) * similar).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) local->hw.tx_sk_pacing_shift = 7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) /* set up some defaults */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) local->hw.queues = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) local->hw.max_rates = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) local->hw.max_report_rates = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) local->hw.max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) local->hw.max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) local->hw.offchannel_tx_hw_queue = IEEE80211_INVAL_HW_QUEUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) local->hw.radiotap_mcs_details = IEEE80211_RADIOTAP_MCS_HAVE_MCS |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) IEEE80211_RADIOTAP_MCS_HAVE_GI |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) IEEE80211_RADIOTAP_MCS_HAVE_BW;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) local->hw.max_mtu = IEEE80211_MAX_DATA_LEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) wiphy->vht_capa_mod_mask = &mac80211_vht_capa_mod_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) local->ext_capa[7] = WLAN_EXT_CAPA8_OPMODE_NOTIF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) wiphy->extended_capabilities = local->ext_capa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) wiphy->extended_capabilities_mask = local->ext_capa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) wiphy->extended_capabilities_len =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) ARRAY_SIZE(local->ext_capa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) INIT_LIST_HEAD(&local->interfaces);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) INIT_LIST_HEAD(&local->mon_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) __hw_addr_init(&local->mc_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) mutex_init(&local->iflist_mtx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) mutex_init(&local->mtx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) mutex_init(&local->key_mtx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) spin_lock_init(&local->filter_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) spin_lock_init(&local->rx_path_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) spin_lock_init(&local->queue_stop_reason_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) for (i = 0; i < IEEE80211_NUM_ACS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) INIT_LIST_HEAD(&local->active_txqs[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) spin_lock_init(&local->active_txq_lock[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) local->aql_txq_limit_high[i] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) local->aql_threshold = IEEE80211_AQL_THRESHOLD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) atomic_set(&local->aql_total_pending_airtime, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) INIT_LIST_HEAD(&local->chanctx_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) mutex_init(&local->chanctx_mtx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) INIT_WORK(&local->restart_work, ieee80211_restart_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) INIT_WORK(&local->radar_detected_work,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) ieee80211_dfs_radar_detected_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) INIT_WORK(&local->reconfig_filter, ieee80211_reconfig_filter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) local->smps_mode = IEEE80211_SMPS_OFF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) INIT_WORK(&local->dynamic_ps_enable_work,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) ieee80211_dynamic_ps_enable_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) INIT_WORK(&local->dynamic_ps_disable_work,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) ieee80211_dynamic_ps_disable_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) timer_setup(&local->dynamic_ps_timer, ieee80211_dynamic_ps_timer, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) INIT_WORK(&local->sched_scan_stopped_work,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) ieee80211_sched_scan_stopped_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) INIT_WORK(&local->tdls_chsw_work, ieee80211_tdls_chsw_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) spin_lock_init(&local->ack_status_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) idr_init(&local->ack_status_frames);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) for (i = 0; i < IEEE80211_MAX_QUEUES; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) skb_queue_head_init(&local->pending[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) atomic_set(&local->agg_queue_stop[i], 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) tasklet_init(&local->tx_pending_tasklet, ieee80211_tx_pending,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) (unsigned long)local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) if (ops->wake_tx_queue)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) tasklet_init(&local->wake_txqs_tasklet, ieee80211_wake_txqs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) (unsigned long)local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) tasklet_init(&local->tasklet,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) ieee80211_tasklet_handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) (unsigned long) local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) skb_queue_head_init(&local->skb_queue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) skb_queue_head_init(&local->skb_queue_unreliable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) skb_queue_head_init(&local->skb_queue_tdls_chsw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) ieee80211_alloc_led_names(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) ieee80211_roc_setup(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) local->hw.radiotap_timestamp.units_pos = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) local->hw.radiotap_timestamp.accuracy = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) return &local->hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) err_free:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) wiphy_free(wiphy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) EXPORT_SYMBOL(ieee80211_alloc_hw_nm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) static int ieee80211_init_cipher_suites(struct ieee80211_local *local)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) bool have_wep = !fips_enabled; /* FIPS does not permit the use of RC4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) bool have_mfp = ieee80211_hw_check(&local->hw, MFP_CAPABLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) int n_suites = 0, r = 0, w = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) u32 *suites;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) static const u32 cipher_suites[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) /* keep WEP first, it may be removed below */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) WLAN_CIPHER_SUITE_WEP40,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) WLAN_CIPHER_SUITE_WEP104,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) WLAN_CIPHER_SUITE_TKIP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) WLAN_CIPHER_SUITE_CCMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) WLAN_CIPHER_SUITE_CCMP_256,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) WLAN_CIPHER_SUITE_GCMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) WLAN_CIPHER_SUITE_GCMP_256,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) /* keep last -- depends on hw flags! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) WLAN_CIPHER_SUITE_AES_CMAC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) WLAN_CIPHER_SUITE_BIP_CMAC_256,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) WLAN_CIPHER_SUITE_BIP_GMAC_128,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) WLAN_CIPHER_SUITE_BIP_GMAC_256,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) if (ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) local->hw.wiphy->cipher_suites) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) /* If the driver advertises, or doesn't support SW crypto,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) * we only need to remove WEP if necessary.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) if (have_wep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796) /* well if it has _no_ ciphers ... fine */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797) if (!local->hw.wiphy->n_cipher_suites)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) /* Driver provides cipher suites, but we need to exclude WEP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) suites = kmemdup(local->hw.wiphy->cipher_suites,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802) sizeof(u32) * local->hw.wiphy->n_cipher_suites,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) if (!suites)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) for (r = 0; r < local->hw.wiphy->n_cipher_suites; r++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808) u32 suite = local->hw.wiphy->cipher_suites[r];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) if (suite == WLAN_CIPHER_SUITE_WEP40 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811) suite == WLAN_CIPHER_SUITE_WEP104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) suites[w++] = suite;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815) } else if (!local->hw.cipher_schemes) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816) /* If the driver doesn't have cipher schemes, there's nothing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) * else to do other than assign the (software supported and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) * perhaps offloaded) cipher suites.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) local->hw.wiphy->cipher_suites = cipher_suites;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) if (!have_mfp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) local->hw.wiphy->n_cipher_suites -= 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826) if (!have_wep) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) local->hw.wiphy->cipher_suites += 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) local->hw.wiphy->n_cipher_suites -= 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) /* not dynamically allocated, so just return */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) const struct ieee80211_cipher_scheme *cs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) cs = local->hw.cipher_schemes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) /* Driver specifies cipher schemes only (but not cipher suites
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) * including the schemes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) * We start counting ciphers defined by schemes, TKIP, CCMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) * CCMP-256, GCMP, and GCMP-256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844) n_suites = local->hw.n_cipher_schemes + 5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) /* check if we have WEP40 and WEP104 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847) if (have_wep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) n_suites += 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) /* check if we have AES_CMAC, BIP-CMAC-256, BIP-GMAC-128,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851) * BIP-GMAC-256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) if (have_mfp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) n_suites += 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856) suites = kmalloc_array(n_suites, sizeof(u32), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857) if (!suites)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860) suites[w++] = WLAN_CIPHER_SUITE_CCMP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861) suites[w++] = WLAN_CIPHER_SUITE_CCMP_256;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862) suites[w++] = WLAN_CIPHER_SUITE_TKIP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863) suites[w++] = WLAN_CIPHER_SUITE_GCMP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864) suites[w++] = WLAN_CIPHER_SUITE_GCMP_256;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 865)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 866) if (have_wep) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 867) suites[w++] = WLAN_CIPHER_SUITE_WEP40;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 868) suites[w++] = WLAN_CIPHER_SUITE_WEP104;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 869) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 870)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 871) if (have_mfp) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 872) suites[w++] = WLAN_CIPHER_SUITE_AES_CMAC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 873) suites[w++] = WLAN_CIPHER_SUITE_BIP_CMAC_256;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 874) suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_128;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 875) suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_256;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 876) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 877)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 878) for (r = 0; r < local->hw.n_cipher_schemes; r++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 879) suites[w++] = cs[r].cipher;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 880) if (WARN_ON(cs[r].pn_len > IEEE80211_MAX_PN_LEN)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 881) kfree(suites);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 882) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 883) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 884) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 885) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 886)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 887) local->hw.wiphy->cipher_suites = suites;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 888) local->hw.wiphy->n_cipher_suites = w;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 889) local->wiphy_ciphers_allocated = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 890)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 891) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 892) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 893)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 894) int ieee80211_register_hw(struct ieee80211_hw *hw)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 895) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 896) struct ieee80211_local *local = hw_to_local(hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 897) int result, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 898) enum nl80211_band band;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 899) int channels, max_bitrates;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 900) bool supp_ht, supp_vht, supp_he;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 901) struct cfg80211_chan_def dflt_chandef = {};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 902)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 903) if (ieee80211_hw_check(hw, QUEUE_CONTROL) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 904) (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 905) local->hw.offchannel_tx_hw_queue >= local->hw.queues))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 906) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 907)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 908) if ((hw->wiphy->features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 909) (!local->ops->tdls_channel_switch ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 910) !local->ops->tdls_cancel_channel_switch ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 911) !local->ops->tdls_recv_channel_switch))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 912) return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 913)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 914) if (WARN_ON(ieee80211_hw_check(hw, SUPPORTS_TX_FRAG) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 915) !local->ops->set_frag_threshold))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 916) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 917)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 918) if (WARN_ON(local->hw.wiphy->interface_modes &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 919) BIT(NL80211_IFTYPE_NAN) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 920) (!local->ops->start_nan || !local->ops->stop_nan)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 921) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 922)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 923) #ifdef CONFIG_PM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 924) if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 925) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 926) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 927)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 928) if (!local->use_chanctx) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 929) for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 930) const struct ieee80211_iface_combination *comb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 931)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 932) comb = &local->hw.wiphy->iface_combinations[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 933)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 934) if (comb->num_different_channels > 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 935) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 936) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 937) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 938) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 939) * WDS is currently prohibited when channel contexts are used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 940) * because there's no clear definition of which channel WDS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 941) * type interfaces use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 942) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 943) if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 944) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 945)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 946) /* DFS is not supported with multi-channel combinations yet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 947) for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 948) const struct ieee80211_iface_combination *comb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 949)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 950) comb = &local->hw.wiphy->iface_combinations[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 951)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 952) if (comb->radar_detect_widths &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 953) comb->num_different_channels > 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 954) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 955) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 956) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 957)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 958) /* Only HW csum features are currently compatible with mac80211 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 959) if (WARN_ON(hw->netdev_features & ~MAC80211_SUPPORTED_FEATURES))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 960) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 961)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 962) if (hw->max_report_rates == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 963) hw->max_report_rates = hw->max_rates;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 964)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 965) local->rx_chains = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 966)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 967) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 968) * generic code guarantees at least one band,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 969) * set this very early because much code assumes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 970) * that hw.conf.channel is assigned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 971) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 972) channels = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 973) max_bitrates = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 974) supp_ht = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 975) supp_vht = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 976) supp_he = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 977) for (band = 0; band < NUM_NL80211_BANDS; band++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 978) struct ieee80211_supported_band *sband;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 979)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 980) sband = local->hw.wiphy->bands[band];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 981) if (!sband)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 982) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 983)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 984) if (!dflt_chandef.chan) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 985) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 986) * Assign the first enabled channel to dflt_chandef
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 987) * from the list of channels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 988) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 989) for (i = 0; i < sband->n_channels; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 990) if (!(sband->channels[i].flags &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 991) IEEE80211_CHAN_DISABLED))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 992) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 993) /* if none found then use the first anyway */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 994) if (i == sband->n_channels)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 995) i = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 996) cfg80211_chandef_create(&dflt_chandef,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 997) &sband->channels[i],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 998) NL80211_CHAN_NO_HT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 999) /* init channel we're on */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) if (!local->use_chanctx && !local->_oper_chandef.chan) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001) local->hw.conf.chandef = dflt_chandef;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) local->_oper_chandef = dflt_chandef;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) local->monitor_chandef = dflt_chandef;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) channels += sband->n_channels;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) if (max_bitrates < sband->n_bitrates)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) max_bitrates = sband->n_bitrates;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) supp_ht = supp_ht || sband->ht_cap.ht_supported;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) supp_vht = supp_vht || sband->vht_cap.vht_supported;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) if (!supp_he)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) supp_he = !!ieee80211_get_he_sta_cap(sband);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) /* HT, VHT, HE require QoS, thus >= 4 queues */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) if (WARN_ON(local->hw.queues < IEEE80211_NUM_ACS &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) (supp_ht || supp_vht || supp_he)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) if (!sband->ht_cap.ht_supported)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) /* TODO: consider VHT for RX chains, hopefully it's the same */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) local->rx_chains =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) max(ieee80211_mcs_to_chains(&sband->ht_cap.mcs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) local->rx_chains);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030) /* no need to mask, SM_PS_DISABLED has all bits set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) sband->ht_cap.cap |= WLAN_HT_CAP_SM_PS_DISABLED <<
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032) IEEE80211_HT_CAP_SM_PS_SHIFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) /* if low-level driver supports AP, we also support VLAN.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) * drivers advertising SW_CRYPTO_CONTROL should enable AP_VLAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037) * based on their support to transmit SW encrypted packets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) !ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045) /* mac80211 always supports monitor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046) hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047) hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) /* mac80211 doesn't support more than one IBSS interface right now */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) for (i = 0; i < hw->wiphy->n_iface_combinations; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) const struct ieee80211_iface_combination *c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) int j;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) c = &hw->wiphy->iface_combinations[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) for (j = 0; j < c->n_limits; j++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) c->limits[j].max > 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) local->int_scan_req = kzalloc(sizeof(*local->int_scan_req) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) sizeof(void *) * channels, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064) if (!local->int_scan_req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) for (band = 0; band < NUM_NL80211_BANDS; band++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) if (!local->hw.wiphy->bands[band])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) local->int_scan_req->rates[band] = (u32) -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) #ifndef CONFIG_MAC80211_MESH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074) /* mesh depends on Kconfig, but drivers should set it if they want */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075) local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) /* if the underlying driver supports mesh, mac80211 will (at least)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) * provide routing of mesh authentication frames to userspace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080) if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_MESH_POINT))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) local->hw.wiphy->flags |= WIPHY_FLAG_MESH_AUTH;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) /* mac80211 supports control port protocol changing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087) local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) } else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090) if (hw->max_signal <= 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) result = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092) goto fail_workqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) /* Mac80211 and therefore all drivers using SW crypto only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097) * are able to handle PTK rekeys and Extended Key ID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099) if (!local->ops->set_key) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100) wiphy_ext_feature_set(local->hw.wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101) NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) wiphy_ext_feature_set(local->hw.wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103) NL80211_EXT_FEATURE_EXT_KEY_ID);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1106) if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_ADHOC))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1107) wiphy_ext_feature_set(local->hw.wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1108) NL80211_EXT_FEATURE_DEL_IBSS_STA);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1110) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1111) * Calculate scan IE length -- we need this to alloc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1112) * memory and to subtract from the driver limit. It
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1113) * includes the DS Params, (extended) supported rates, and HT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1114) * information -- SSID is the driver's responsibility.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1115) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1116) local->scan_ies_len = 4 + max_bitrates /* (ext) supp rates */ +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1117) 3 /* DS Params */;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1118) if (supp_ht)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1119) local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1121) if (supp_vht)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1122) local->scan_ies_len +=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1123) 2 + sizeof(struct ieee80211_vht_cap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1125) /* HE cap element is variable in size - set len to allow max size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1126) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1127) * TODO: 1 is added at the end of the calculation to accommodate for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1128) * the temporary placing of the HE capabilities IE under EXT.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1129) * Remove it once it is placed in the final place.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1130) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1131) if (supp_he)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1132) local->scan_ies_len +=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1133) 2 + sizeof(struct ieee80211_he_cap_elem) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1134) sizeof(struct ieee80211_he_mcs_nss_supp) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1135) IEEE80211_HE_PPE_THRES_MAX_LEN + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1137) if (!local->ops->hw_scan) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1138) /* For hw_scan, driver needs to set these up. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1139) local->hw.wiphy->max_scan_ssids = 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1140) local->hw.wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1141) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1143) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1144) * If the driver supports any scan IEs, then assume the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1145) * limit includes the IEs mac80211 will add, otherwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1146) * leave it at zero and let the driver sort it out; we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1147) * still pass our IEs to the driver but userspace will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1148) * not be allowed to in that case.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1149) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1150) if (local->hw.wiphy->max_scan_ie_len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1151) local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1153) if (WARN_ON(!ieee80211_cs_list_valid(local->hw.cipher_schemes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1154) local->hw.n_cipher_schemes))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1155) result = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1156) goto fail_workqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1157) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1159) result = ieee80211_init_cipher_suites(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1160) if (result < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1161) goto fail_workqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1163) if (!local->ops->remain_on_channel)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1164) local->hw.wiphy->max_remain_on_channel_duration = 5000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1166) /* mac80211 based drivers don't support internal TDLS setup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1167) if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1168) local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1170) /* mac80211 supports eCSA, if the driver supports STA CSA at all */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1171) if (ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1172) local->ext_capa[0] |= WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1174) /* mac80211 supports multi BSSID, if the driver supports it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1175) if (ieee80211_hw_check(&local->hw, SUPPORTS_MULTI_BSSID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1176) local->hw.wiphy->support_mbssid = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1177) if (ieee80211_hw_check(&local->hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1178) SUPPORTS_ONLY_HE_MULTI_BSSID))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1179) local->hw.wiphy->support_only_he_mbssid = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1180) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1181) local->ext_capa[2] |=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1182) WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1183) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1185) local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CNTDWN_COUNTERS_NUM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1187) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1188) * We use the number of queues for feature tests (QoS, HT) internally
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1189) * so restrict them appropriately.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1190) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1191) if (hw->queues > IEEE80211_MAX_QUEUES)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1192) hw->queues = IEEE80211_MAX_QUEUES;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1194) local->workqueue =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1195) alloc_ordered_workqueue("%s", 0, wiphy_name(local->hw.wiphy));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1196) if (!local->workqueue) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1197) result = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1198) goto fail_workqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1199) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1201) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1202) * The hardware needs headroom for sending the frame,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1203) * and we need some headroom for passing the frame to monitor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1204) * interfaces, but never both at the same time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1205) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1206) local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1207) IEEE80211_TX_STATUS_HEADROOM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1209) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1210) * if the driver doesn't specify a max listen interval we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1211) * use 5 which should be a safe default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1212) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1213) if (local->hw.max_listen_interval == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1214) local->hw.max_listen_interval = 5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1216) local->hw.conf.listen_interval = local->hw.max_listen_interval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1218) local->dynamic_ps_forced_timeout = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1220) if (!local->hw.max_nan_de_entries)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1221) local->hw.max_nan_de_entries = IEEE80211_MAX_NAN_INSTANCE_ID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1223) if (!local->hw.weight_multiplier)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1224) local->hw.weight_multiplier = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1226) ieee80211_wep_init(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1228) local->hw.conf.flags = IEEE80211_CONF_IDLE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1230) ieee80211_led_init(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1232) result = ieee80211_txq_setup_flows(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1233) if (result)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1234) goto fail_flows;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1236) rtnl_lock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1237) result = ieee80211_init_rate_ctrl_alg(local,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1238) hw->rate_control_algorithm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1239) rtnl_unlock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1240) if (result < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1241) wiphy_debug(local->hw.wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1242) "Failed to initialize rate control algorithm\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1243) goto fail_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1244) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1246) if (local->rate_ctrl) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1247) clear_bit(IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW, hw->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1248) if (local->rate_ctrl->ops->capa & RATE_CTRL_CAPA_VHT_EXT_NSS_BW)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1249) ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1250) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1252) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1253) * If the VHT capabilities don't have IEEE80211_VHT_EXT_NSS_BW_CAPABLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1254) * or have it when we don't, copy the sband structure and set/clear it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1255) * This is necessary because rate scaling algorithms could be switched
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1256) * and have different support values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1257) * Print a message so that in the common case the reallocation can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1258) * avoided.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1259) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1260) BUILD_BUG_ON(NUM_NL80211_BANDS > 8 * sizeof(local->sband_allocated));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1261) for (band = 0; band < NUM_NL80211_BANDS; band++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1262) struct ieee80211_supported_band *sband;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1263) bool local_cap, ie_cap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1265) local_cap = ieee80211_hw_check(hw, SUPPORTS_VHT_EXT_NSS_BW);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1267) sband = local->hw.wiphy->bands[band];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1268) if (!sband || !sband->vht_cap.vht_supported)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1269) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1271) ie_cap = !!(sband->vht_cap.vht_mcs.tx_highest &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1272) cpu_to_le16(IEEE80211_VHT_EXT_NSS_BW_CAPABLE));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1273)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1274) if (local_cap == ie_cap)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1275) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1277) sband = kmemdup(sband, sizeof(*sband), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1278) if (!sband) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1279) result = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1280) goto fail_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1281) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1282)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1283) wiphy_dbg(hw->wiphy, "copying sband (band %d) due to VHT EXT NSS BW flag\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1284) band);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1286) sband->vht_cap.vht_mcs.tx_highest ^=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1287) cpu_to_le16(IEEE80211_VHT_EXT_NSS_BW_CAPABLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1288)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1289) local->hw.wiphy->bands[band] = sband;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1290) local->sband_allocated |= BIT(band);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1291) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1292)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1293) result = wiphy_register(local->hw.wiphy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1294) if (result < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1295) goto fail_wiphy_register;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1296)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1297) debugfs_hw_add(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1298) rate_control_add_debugfs(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1299)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1300) rtnl_lock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1302) /* add one default STA interface if supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1303) if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1304) !ieee80211_hw_check(hw, NO_AUTO_VIF)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1305) struct vif_params params = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1306)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1307) result = ieee80211_if_add(local, "wlan%d", NET_NAME_ENUM, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1308) NL80211_IFTYPE_STATION, ¶ms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1309) if (result)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1310) wiphy_warn(local->hw.wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1311) "Failed to add default virtual iface\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1312) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1313)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1314) rtnl_unlock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1315)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1316) #ifdef CONFIG_INET
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1317) local->ifa_notifier.notifier_call = ieee80211_ifa_changed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1318) result = register_inetaddr_notifier(&local->ifa_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1319) if (result)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1320) goto fail_ifa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1321) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1322)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1323) #if IS_ENABLED(CONFIG_IPV6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1324) local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1325) result = register_inet6addr_notifier(&local->ifa6_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1326) if (result)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1327) goto fail_ifa6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1328) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1329)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1330) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1331)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1332) #if IS_ENABLED(CONFIG_IPV6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1333) fail_ifa6:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1334) #ifdef CONFIG_INET
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1335) unregister_inetaddr_notifier(&local->ifa_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1336) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1337) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1338) #if defined(CONFIG_INET) || defined(CONFIG_IPV6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1339) fail_ifa:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1340) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1341) wiphy_unregister(local->hw.wiphy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1342) fail_wiphy_register:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1343) rtnl_lock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1344) rate_control_deinitialize(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1345) ieee80211_remove_interfaces(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1346) rtnl_unlock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1347) fail_rate:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1348) fail_flows:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1349) ieee80211_led_exit(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1350) destroy_workqueue(local->workqueue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1351) fail_workqueue:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1352) if (local->wiphy_ciphers_allocated)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1353) kfree(local->hw.wiphy->cipher_suites);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1354) kfree(local->int_scan_req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1355) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1356) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1357) EXPORT_SYMBOL(ieee80211_register_hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1358)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1359) void ieee80211_unregister_hw(struct ieee80211_hw *hw)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1360) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1361) struct ieee80211_local *local = hw_to_local(hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1363) tasklet_kill(&local->tx_pending_tasklet);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1364) tasklet_kill(&local->tasklet);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1365)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1366) #ifdef CONFIG_INET
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1367) unregister_inetaddr_notifier(&local->ifa_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1368) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1369) #if IS_ENABLED(CONFIG_IPV6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1370) unregister_inet6addr_notifier(&local->ifa6_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1371) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1372)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1373) rtnl_lock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1374)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1375) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1376) * At this point, interface list manipulations are fine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1377) * because the driver cannot be handing us frames any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1378) * more and the tasklet is killed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1379) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1380) ieee80211_remove_interfaces(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1381)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1382) rtnl_unlock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1383)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1384) cancel_delayed_work_sync(&local->roc_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1385) cancel_work_sync(&local->restart_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1386) cancel_work_sync(&local->reconfig_filter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1387) cancel_work_sync(&local->tdls_chsw_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1388) flush_work(&local->sched_scan_stopped_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1389) flush_work(&local->radar_detected_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1390)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1391) ieee80211_clear_tx_pending(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1392) rate_control_deinitialize(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1393)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1394) if (skb_queue_len(&local->skb_queue) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1395) skb_queue_len(&local->skb_queue_unreliable))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1396) wiphy_warn(local->hw.wiphy, "skb_queue not empty\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1397) skb_queue_purge(&local->skb_queue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1398) skb_queue_purge(&local->skb_queue_unreliable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1399) skb_queue_purge(&local->skb_queue_tdls_chsw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1401) wiphy_unregister(local->hw.wiphy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1402) destroy_workqueue(local->workqueue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1403) ieee80211_led_exit(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1404) kfree(local->int_scan_req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1405) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1406) EXPORT_SYMBOL(ieee80211_unregister_hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1407)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1408) static int ieee80211_free_ack_frame(int id, void *p, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1409) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1410) WARN_ONCE(1, "Have pending ack frames!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1411) kfree_skb(p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1412) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1413) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1414)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1415) void ieee80211_free_hw(struct ieee80211_hw *hw)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1416) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1417) struct ieee80211_local *local = hw_to_local(hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1418) enum nl80211_band band;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1419)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1420) mutex_destroy(&local->iflist_mtx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1421) mutex_destroy(&local->mtx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1422)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1423) if (local->wiphy_ciphers_allocated)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1424) kfree(local->hw.wiphy->cipher_suites);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1425)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1426) idr_for_each(&local->ack_status_frames,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1427) ieee80211_free_ack_frame, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1428) idr_destroy(&local->ack_status_frames);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1429)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1430) sta_info_stop(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1431)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1432) ieee80211_free_led_names(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1433)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1434) for (band = 0; band < NUM_NL80211_BANDS; band++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1435) if (!(local->sband_allocated & BIT(band)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1436) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1437) kfree(local->hw.wiphy->bands[band]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1438) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1439)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1440) wiphy_free(local->hw.wiphy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1441) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1442) EXPORT_SYMBOL(ieee80211_free_hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1443)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1444) static int __init ieee80211_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1445) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1446) struct sk_buff *skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1447) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1448)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1449) BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1450) BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, driver_data) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1451) IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1452)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1453) ret = rc80211_minstrel_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1454) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1455) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1456)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1457) ret = ieee80211_iface_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1458) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1459) goto err_netdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1460)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1461) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1462) err_netdev:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1463) rc80211_minstrel_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1464)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1465) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1466) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1467)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1468) static void __exit ieee80211_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1469) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1470) rc80211_minstrel_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1471)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1472) ieee80211s_stop();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1473)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1474) ieee80211_iface_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1475)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1476) rcu_barrier();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1477) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1478)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1479)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1480) subsys_initcall(ieee80211_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1481) module_exit(ieee80211_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1483) MODULE_DESCRIPTION("IEEE 802.11 subsystem");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1484) MODULE_LICENSE("GPL");