12 #include <linux/module.h>
14 #include <linux/netdevice.h>
15 #include <linux/types.h>
16 #include <linux/slab.h>
19 #include <linux/if_arp.h>
20 #include <linux/rtnetlink.h>
21 #include <linux/bitmap.h>
41 unsigned int changed_flags;
42 unsigned int new_flags = 0;
75 mc = drv_prepare_multicast(local, &local->
mc_list);
81 drv_configure_filter(local, changed_flags, &new_flags, mc);
132 if (offchannel_flag || chan != local->
hw.conf.channel ||
133 channel_type != local->
hw.conf.channel_type) {
134 local->
hw.conf.channel = chan;
139 if (!conf_is_ht(&local->
hw.conf)) {
146 }
else if (local->
hw.conf.smps_mode != local->
smps_mode) {
162 if (local->
hw.conf.power_level != power) {
164 local->
hw.conf.power_level = power;
168 ret = drv_config(local, changed);
199 sdata->
vif.bss_conf.bssid = sdata->
u.
mgd.bssid;
201 sdata->
vif.bss_conf.bssid = sdata->
u.
ibss.bssid;
203 sdata->
vif.bss_conf.bssid = sdata->
vif.addr;
205 sdata->
vif.bss_conf.bssid =
NULL;
206 else if (ieee80211_vif_is_mesh(&sdata->
vif)) {
207 sdata->
vif.bss_conf.bssid =
zero;
209 sdata->
vif.bss_conf.bssid = sdata->
vif.addr;
211 "P2P Device BSS changed %#x", changed);
217 switch (sdata->
vif.type) {
232 if (local->
quiescing || !ieee80211_sdata_running(sdata) ||
234 sdata->
vif.bss_conf.enable_beacon =
false;
240 switch (sdata->
vif.type) {
242 sdata->
vif.bss_conf.enable_beacon =
243 !!sdata->
u.
ap.beacon;
246 sdata->
vif.bss_conf.enable_beacon =
247 !!sdata->
u.
ibss.presp;
249 #ifdef CONFIG_MAC80211_MESH
251 sdata->
vif.bss_conf.enable_beacon =
252 !!sdata->
u.
mesh.mesh_id_len;
263 drv_bss_info_changed(local, sdata, &sdata->
vif.bss_conf, changed);
268 sdata->
vif.bss_conf.use_cts_prot =
false;
269 sdata->
vif.bss_conf.use_short_preamble =
false;
270 sdata->
vif.bss_conf.use_short_slot =
false;
276 static void ieee80211_tasklet_handler(
unsigned long data)
297 eosp_data = (
void *)skb->cb;
309 WARN(1,
"mac80211: Packet is of unknown type %d\n",
328 lockdep_is_held(&local->
mtx)),
329 "%s called with hardware scan in progress\n", __func__);
342 trace_api_restart_hw(local);
345 "Hardware restart was requested\n");
362 static void ieee80211_recalc_smps_work(
struct work_struct *work)
372 unsigned long data,
void *
arg)
374 struct in_ifaddr *ifa =
arg;
380 struct in_device *
idev;
390 if (wdev->
wiphy != local->
hw.wiphy)
393 sdata = IEEE80211_DEV_TO_SUB_IF(ndev);
394 bss_conf = &sdata->
vif.bss_conf;
400 idev = __in_dev_get_rtnl(sdata->
dev);
404 ifmgd = &sdata->
u.
mgd;
408 ifa = idev->ifa_list;
442 return local->
ops->napi_poll(&local->
hw, budget);
449 napi_schedule(&local->
napi);
532 .rx_mask = { 0xff, 0xff, 0xff, 0xff, 0xff,
533 0xff, 0xff, 0xff, 0xff, 0xff, },
574 wiphy->
mgmt_stypes = ieee80211_default_mgmt_stypes;
595 local = wiphy_priv(wiphy);
597 local->
hw.wiphy = wiphy;
604 local->
hw.queues = 1;
605 local->
hw.max_rates = 1;
606 local->
hw.max_report_rates = 0;
610 local->
hw.conf.long_frame_max_tx_count = wiphy->
retry_long;
611 local->
hw.conf.short_frame_max_tx_count = wiphy->
retry_short;
637 &ieee80211_rx_skb_queue_class);
654 INIT_WORK(&local->sched_scan_stopped_work,
658 idr_init(&local->ack_status_frames);
665 skb_queue_head_init(&local->pending[i]);
669 (
unsigned long)local);
672 ieee80211_tasklet_handler,
673 (
unsigned long) local);
675 skb_queue_head_init(&local->skb_queue);
676 skb_queue_head_init(&local->skb_queue_unreliable);
695 bool supp_ht, supp_vht;
697 static const u32 cipher_suites[] = {
710 local->
hw.offchannel_tx_hw_queue >= local->
hw.queues))
714 if ((hw->
wiphy->wowlan.flags || hw->
wiphy->wowlan.n_patterns) &&
715 (!local->
ops->suspend || !local->
ops->resume))
743 sband = local->
hw.wiphy->bands[
band];
748 local->
hw.conf.channel =
756 supp_ht = supp_ht || sband->
ht_cap.ht_supported;
757 supp_vht = supp_vht || sband->
vht_cap.vht_supported;
766 if (!local->
hw.wiphy->bands[band])
785 for (i = 0; i < hw->
wiphy->n_iface_combinations; i++) {
789 c = &hw->
wiphy->iface_combinations[
i];
800 #ifndef CONFIG_MAC80211_MESH
820 "U-APSD not supported with HW_PS_NULLFUNC_STACK\n");
837 if (!local->
ops->hw_scan) {
839 local->
hw.wiphy->max_scan_ssids = 4;
850 if (local->
hw.wiphy->max_scan_ie_len)
854 if (!local->
hw.wiphy->cipher_suites) {
855 local->
hw.wiphy->cipher_suites = cipher_suites;
856 local->
hw.wiphy->n_cipher_suites =
ARRAY_SIZE(cipher_suites);
858 local->
hw.wiphy->n_cipher_suites--;
861 if (local->
hw.wiphy->cipher_suites == cipher_suites) {
862 local->
hw.wiphy->cipher_suites += 2;
863 local->
hw.wiphy->n_cipher_suites -= 2;
871 local->
hw.wiphy->cipher_suites,
872 sizeof(
u32) * local->
hw.wiphy->n_cipher_suites,
876 goto fail_wiphy_register;
878 for (r = 0; r < local->
hw.wiphy->n_cipher_suites; r++) {
879 u32 suite = local->
hw.wiphy->cipher_suites[
r];
885 local->
hw.wiphy->cipher_suites = suites;
886 local->
hw.wiphy->n_cipher_suites =
w;
891 if (!local->
ops->remain_on_channel)
892 local->
hw.wiphy->max_remain_on_channel_duration = 5000;
894 if (local->
ops->sched_scan_start)
903 goto fail_wiphy_register;
933 if (local->
hw.max_listen_interval == 0)
934 local->
hw.max_listen_interval = 5;
936 local->
hw.conf.listen_interval = local->
hw.max_listen_interval;
942 wiphy_debug(local->
hw.wiphy,
"Failed to initialize wep: %d\n",
953 "Failed to initialize rate control algorithm\n");
963 "Failed to add default virtual iface\n");
978 local->
ifa_notifier.notifier_call = ieee80211_ifa_changed;
985 local->
hw.napi_weight);
1005 fail_wiphy_register:
1007 kfree(local->
hw.wiphy->cipher_suites);
1059 static int ieee80211_free_ack_frame(
int id,
void *
p,
void *data)
1061 WARN_ONCE(1,
"Have pending ack frames!\n");
1074 kfree(local->
hw.wiphy->cipher_suites);
1077 ieee80211_free_ack_frame,
NULL);
1084 static int __init ieee80211_init(
void)
1120 static void __exit ieee80211_exit(
void)