1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#include "main.h"
21#include "fw.h"
22
23
24
25
26
27static void
28mwifiex_11h_process_infra_join(struct mwifiex_private *priv, u8 **buffer,
29 struct mwifiex_bssdescriptor *bss_desc)
30{
31 struct mwifiex_ie_types_header *ie_header;
32 struct mwifiex_ie_types_pwr_capability *cap;
33 struct mwifiex_ie_types_local_pwr_constraint *constraint;
34 struct ieee80211_supported_band *sband;
35 u8 radio_type;
36 int i;
37
38 if (!buffer || !(*buffer))
39 return;
40
41 radio_type = mwifiex_band_to_radio_type((u8) bss_desc->bss_band);
42 sband = priv->wdev->wiphy->bands[radio_type];
43
44 cap = (struct mwifiex_ie_types_pwr_capability *)*buffer;
45 cap->header.type = cpu_to_le16(WLAN_EID_PWR_CAPABILITY);
46 cap->header.len = cpu_to_le16(2);
47 cap->min_pwr = 0;
48 cap->max_pwr = 0;
49 *buffer += sizeof(*cap);
50
51 constraint = (struct mwifiex_ie_types_local_pwr_constraint *)*buffer;
52 constraint->header.type = cpu_to_le16(WLAN_EID_PWR_CONSTRAINT);
53 constraint->header.len = cpu_to_le16(2);
54 constraint->chan = bss_desc->channel;
55 constraint->constraint = bss_desc->local_constraint;
56 *buffer += sizeof(*constraint);
57
58 ie_header = (struct mwifiex_ie_types_header *)*buffer;
59 ie_header->type = cpu_to_le16(TLV_TYPE_PASSTHROUGH);
60 ie_header->len = cpu_to_le16(2 * sband->n_channels + 2);
61 *buffer += sizeof(*ie_header);
62 *(*buffer)++ = WLAN_EID_SUPPORTED_CHANNELS;
63 *(*buffer)++ = 2 * sband->n_channels;
64 for (i = 0; i < sband->n_channels; i++) {
65 *(*buffer)++ = ieee80211_frequency_to_channel(
66 sband->channels[i].center_freq);
67 *(*buffer)++ = 1;
68 }
69}
70
71
72static int mwifiex_11h_activate(struct mwifiex_private *priv, bool flag)
73{
74 u32 enable = flag;
75
76 return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
77 HostCmd_ACT_GEN_SET, DOT11H_I, &enable);
78}
79
80
81
82
83
84
85
86void mwifiex_11h_process_join(struct mwifiex_private *priv, u8 **buffer,
87 struct mwifiex_bssdescriptor *bss_desc)
88{
89 if (bss_desc->sensed_11h) {
90
91
92
93 mwifiex_11h_activate(priv, true);
94 bss_desc->cap_info_bitmap |= WLAN_CAPABILITY_SPECTRUM_MGMT;
95 mwifiex_11h_process_infra_join(priv, buffer, bss_desc);
96 } else {
97
98 mwifiex_11h_activate(priv, false);
99 bss_desc->cap_info_bitmap &= ~WLAN_CAPABILITY_SPECTRUM_MGMT;
100 }
101}
102