2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 #define CHAN60G(_channel, _flags) { \
21 .band = IEEE80211_BAND_60GHZ, \
22 .center_freq = 56160 + (2160 * (_channel)), \
23 .hw_value = (_channel), \
25 .max_antenna_gain = 0, \
29 static struct ieee80211_channel wil_60ghz_channels
[] = {
33 /* channel 4 not supported yet */
36 static struct ieee80211_supported_band wil_band_60ghz
= {
37 .channels
= wil_60ghz_channels
,
38 .n_channels
= ARRAY_SIZE(wil_60ghz_channels
),
42 .ampdu_factor
= IEEE80211_HT_MAX_AMPDU_64K
, /* TODO */
43 .ampdu_density
= IEEE80211_HT_MPDU_DENSITY_8
, /* TODO */
45 /* MCS 1..12 - SC PHY */
46 .rx_mask
= {0xfe, 0x1f}, /* 1..12 */
47 .tx_params
= IEEE80211_HT_MCS_TX_DEFINED
, /* TODO */
52 static const struct ieee80211_txrx_stypes
53 wil_mgmt_stypes
[NUM_NL80211_IFTYPES
] = {
54 [NL80211_IFTYPE_STATION
] = {
55 .tx
= BIT(IEEE80211_STYPE_ACTION
>> 4) |
56 BIT(IEEE80211_STYPE_PROBE_RESP
>> 4),
57 .rx
= BIT(IEEE80211_STYPE_ACTION
>> 4) |
58 BIT(IEEE80211_STYPE_PROBE_REQ
>> 4)
60 [NL80211_IFTYPE_AP
] = {
61 .tx
= BIT(IEEE80211_STYPE_ACTION
>> 4) |
62 BIT(IEEE80211_STYPE_PROBE_RESP
>> 4),
63 .rx
= BIT(IEEE80211_STYPE_ACTION
>> 4) |
64 BIT(IEEE80211_STYPE_PROBE_REQ
>> 4)
66 [NL80211_IFTYPE_P2P_CLIENT
] = {
67 .tx
= BIT(IEEE80211_STYPE_ACTION
>> 4) |
68 BIT(IEEE80211_STYPE_PROBE_RESP
>> 4),
69 .rx
= BIT(IEEE80211_STYPE_ACTION
>> 4) |
70 BIT(IEEE80211_STYPE_PROBE_REQ
>> 4)
72 [NL80211_IFTYPE_P2P_GO
] = {
73 .tx
= BIT(IEEE80211_STYPE_ACTION
>> 4) |
74 BIT(IEEE80211_STYPE_PROBE_RESP
>> 4),
75 .rx
= BIT(IEEE80211_STYPE_ACTION
>> 4) |
76 BIT(IEEE80211_STYPE_PROBE_REQ
>> 4)
80 static const u32 wil_cipher_suites
[] = {
81 WLAN_CIPHER_SUITE_GCMP
,
84 int wil_iftype_nl2wmi(enum nl80211_iftype type
)
87 enum nl80211_iftype nl
;
88 enum wmi_network_type wmi
;
90 {NL80211_IFTYPE_ADHOC
, WMI_NETTYPE_ADHOC
},
91 {NL80211_IFTYPE_STATION
, WMI_NETTYPE_INFRA
},
92 {NL80211_IFTYPE_AP
, WMI_NETTYPE_AP
},
93 {NL80211_IFTYPE_P2P_CLIENT
, WMI_NETTYPE_P2P
},
94 {NL80211_IFTYPE_P2P_GO
, WMI_NETTYPE_P2P
},
95 {NL80211_IFTYPE_MONITOR
, WMI_NETTYPE_ADHOC
}, /* FIXME */
99 for (i
= 0; i
< ARRAY_SIZE(__nl2wmi
); i
++) {
100 if (__nl2wmi
[i
].nl
== type
)
101 return __nl2wmi
[i
].wmi
;
107 static int wil_cid_fill_sinfo(struct wil6210_priv
*wil
, int cid
,
108 struct station_info
*sinfo
)
110 struct wmi_notify_req_cmd cmd
= {
115 struct wil6210_mbox_hdr_wmi wmi
;
116 struct wmi_notify_req_done_event evt
;
118 struct wil_net_stats
*stats
= &wil
->sta
[cid
].stats
;
121 rc
= wmi_call(wil
, WMI_NOTIFY_REQ_CMDID
, &cmd
, sizeof(cmd
),
122 WMI_NOTIFY_REQ_DONE_EVENTID
, &reply
, sizeof(reply
), 20);
126 wil_dbg_wmi(wil
, "Link status for CID %d: {\n"
127 " MCS %d TSF 0x%016llx\n"
128 " BF status 0x%08x SNR 0x%08x SQI %d%%\n"
129 " Tx Tpt %d goodput %d Rx goodput %d\n"
130 " Sectors(rx:tx) my %d:%d peer %d:%d\n""}\n",
131 cid
, le16_to_cpu(reply
.evt
.bf_mcs
),
132 le64_to_cpu(reply
.evt
.tsf
), reply
.evt
.status
,
133 le32_to_cpu(reply
.evt
.snr_val
),
135 le32_to_cpu(reply
.evt
.tx_tpt
),
136 le32_to_cpu(reply
.evt
.tx_goodput
),
137 le32_to_cpu(reply
.evt
.rx_goodput
),
138 le16_to_cpu(reply
.evt
.my_rx_sector
),
139 le16_to_cpu(reply
.evt
.my_tx_sector
),
140 le16_to_cpu(reply
.evt
.other_rx_sector
),
141 le16_to_cpu(reply
.evt
.other_tx_sector
));
143 sinfo
->generation
= wil
->sinfo_gen
;
145 sinfo
->filled
= STATION_INFO_RX_BYTES
|
146 STATION_INFO_TX_BYTES
|
147 STATION_INFO_RX_PACKETS
|
148 STATION_INFO_TX_PACKETS
|
149 STATION_INFO_RX_BITRATE
|
150 STATION_INFO_TX_BITRATE
|
151 STATION_INFO_RX_DROP_MISC
|
152 STATION_INFO_TX_FAILED
;
154 sinfo
->txrate
.flags
= RATE_INFO_FLAGS_MCS
| RATE_INFO_FLAGS_60G
;
155 sinfo
->txrate
.mcs
= le16_to_cpu(reply
.evt
.bf_mcs
);
156 sinfo
->rxrate
.flags
= RATE_INFO_FLAGS_MCS
| RATE_INFO_FLAGS_60G
;
157 sinfo
->rxrate
.mcs
= stats
->last_mcs_rx
;
158 sinfo
->rx_bytes
= stats
->rx_bytes
;
159 sinfo
->rx_packets
= stats
->rx_packets
;
160 sinfo
->rx_dropped_misc
= stats
->rx_dropped
;
161 sinfo
->tx_bytes
= stats
->tx_bytes
;
162 sinfo
->tx_packets
= stats
->tx_packets
;
163 sinfo
->tx_failed
= stats
->tx_errors
;
165 if (test_bit(wil_status_fwconnected
, &wil
->status
)) {
166 sinfo
->filled
|= STATION_INFO_SIGNAL
;
167 sinfo
->signal
= reply
.evt
.sqi
;
173 static int wil_cfg80211_get_station(struct wiphy
*wiphy
,
174 struct net_device
*ndev
,
175 u8
*mac
, struct station_info
*sinfo
)
177 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
180 int cid
= wil_find_cid(wil
, mac
);
182 wil_info(wil
, "%s(%pM) CID %d\n", __func__
, mac
, cid
);
186 rc
= wil_cid_fill_sinfo(wil
, cid
, sinfo
);
192 * Find @idx-th active STA for station dump.
194 static int wil_find_cid_by_idx(struct wil6210_priv
*wil
, int idx
)
198 for (i
= 0; i
< ARRAY_SIZE(wil
->sta
); i
++) {
199 if (wil
->sta
[i
].status
== wil_sta_unused
)
209 static int wil_cfg80211_dump_station(struct wiphy
*wiphy
,
210 struct net_device
*dev
, int idx
,
211 u8
*mac
, struct station_info
*sinfo
)
213 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
215 int cid
= wil_find_cid_by_idx(wil
, idx
);
220 memcpy(mac
, wil
->sta
[cid
].addr
, ETH_ALEN
);
221 wil_info(wil
, "%s(%pM) CID %d\n", __func__
, mac
, cid
);
223 rc
= wil_cid_fill_sinfo(wil
, cid
, sinfo
);
228 static int wil_cfg80211_change_iface(struct wiphy
*wiphy
,
229 struct net_device
*ndev
,
230 enum nl80211_iftype type
, u32
*flags
,
231 struct vif_params
*params
)
233 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
234 struct wireless_dev
*wdev
= wil
->wdev
;
237 case NL80211_IFTYPE_STATION
:
238 case NL80211_IFTYPE_AP
:
239 case NL80211_IFTYPE_P2P_CLIENT
:
240 case NL80211_IFTYPE_P2P_GO
:
242 case NL80211_IFTYPE_MONITOR
:
244 wil
->monitor_flags
= *flags
;
246 wil
->monitor_flags
= 0;
258 static int wil_cfg80211_scan(struct wiphy
*wiphy
,
259 struct cfg80211_scan_request
*request
)
261 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
262 struct wireless_dev
*wdev
= wil
->wdev
;
264 struct wmi_start_scan_cmd cmd
;
269 if (wil
->scan_request
) {
270 wil_err(wil
, "Already scanning\n");
274 /* check we are client side */
275 switch (wdev
->iftype
) {
276 case NL80211_IFTYPE_STATION
:
277 case NL80211_IFTYPE_P2P_CLIENT
:
283 /* FW don't support scan after connection attempt */
284 if (test_bit(wil_status_dontscan
, &wil
->status
)) {
285 wil_err(wil
, "Scan after connect attempt not supported\n");
289 wil
->scan_request
= request
;
291 memset(&cmd
, 0, sizeof(cmd
));
292 cmd
.cmd
.num_channels
= 0;
293 n
= min(request
->n_channels
, 4U);
294 for (i
= 0; i
< n
; i
++) {
295 int ch
= request
->channels
[i
]->hw_value
;
298 "Scan requested for unknown frequency %dMhz\n",
299 request
->channels
[i
]->center_freq
);
302 /* 0-based channel indexes */
303 cmd
.cmd
.channel_list
[cmd
.cmd
.num_channels
++].channel
= ch
- 1;
304 wil_dbg_misc(wil
, "Scan for ch %d : %d MHz\n", ch
,
305 request
->channels
[i
]->center_freq
);
308 return wmi_send(wil
, WMI_START_SCAN_CMDID
, &cmd
, sizeof(cmd
.cmd
) +
309 cmd
.cmd
.num_channels
* sizeof(cmd
.cmd
.channel_list
[0]));
312 static int wil_cfg80211_connect(struct wiphy
*wiphy
,
313 struct net_device
*ndev
,
314 struct cfg80211_connect_params
*sme
)
316 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
317 struct cfg80211_bss
*bss
;
318 struct wmi_connect_cmd conn
;
324 bss
= cfg80211_get_bss(wiphy
, sme
->channel
, sme
->bssid
,
325 sme
->ssid
, sme
->ssid_len
,
326 WLAN_CAPABILITY_ESS
, WLAN_CAPABILITY_ESS
);
328 wil_err(wil
, "Unable to find BSS\n");
332 ssid_eid
= ieee80211_bss_get_ie(bss
, WLAN_EID_SSID
);
334 wil_err(wil
, "No SSID\n");
340 cfg80211_find_ie(WLAN_EID_RSN
, sme
->ie
, sme
->ie_len
) :
343 if (sme
->ie_len
> WMI_MAX_IE_LEN
) {
345 wil_err(wil
, "IE too large (%td bytes)\n",
350 * For secure assoc, send:
351 * (1) WMI_DELETE_CIPHER_KEY_CMD
352 * (2) WMI_SET_APPIE_CMD
354 rc
= wmi_del_cipher_key(wil
, 0, bss
->bssid
);
356 wil_err(wil
, "WMI_DELETE_CIPHER_KEY_CMD failed\n");
359 /* WMI_SET_APPIE_CMD */
360 rc
= wmi_set_ie(wil
, WMI_FRAME_ASSOC_REQ
, sme
->ie_len
, sme
->ie
);
362 wil_err(wil
, "WMI_SET_APPIE_CMD failed\n");
367 /* WMI_CONNECT_CMD */
368 memset(&conn
, 0, sizeof(conn
));
369 switch (bss
->capability
& WLAN_CAPABILITY_DMG_TYPE_MASK
) {
370 case WLAN_CAPABILITY_DMG_TYPE_AP
:
371 conn
.network_type
= WMI_NETTYPE_INFRA
;
373 case WLAN_CAPABILITY_DMG_TYPE_PBSS
:
374 conn
.network_type
= WMI_NETTYPE_P2P
;
377 wil_err(wil
, "Unsupported BSS type, capability= 0x%04x\n",
382 conn
.dot11_auth_mode
= WMI_AUTH11_SHARED
;
383 conn
.auth_mode
= WMI_AUTH_WPA2_PSK
;
384 conn
.pairwise_crypto_type
= WMI_CRYPT_AES_GCMP
;
385 conn
.pairwise_crypto_len
= 16;
387 conn
.dot11_auth_mode
= WMI_AUTH11_OPEN
;
388 conn
.auth_mode
= WMI_AUTH_NONE
;
391 conn
.ssid_len
= min_t(u8
, ssid_eid
[1], 32);
392 memcpy(conn
.ssid
, ssid_eid
+2, conn
.ssid_len
);
394 ch
= bss
->channel
->hw_value
;
396 wil_err(wil
, "BSS at unknown frequency %dMhz\n",
397 bss
->channel
->center_freq
);
401 conn
.channel
= ch
- 1;
403 memcpy(conn
.bssid
, bss
->bssid
, ETH_ALEN
);
404 memcpy(conn
.dst_mac
, bss
->bssid
, ETH_ALEN
);
406 * FW don't support scan after connection attempt
408 set_bit(wil_status_dontscan
, &wil
->status
);
409 set_bit(wil_status_fwconnecting
, &wil
->status
);
411 rc
= wmi_send(wil
, WMI_CONNECT_CMDID
, &conn
, sizeof(conn
));
413 /* Connect can take lots of time */
414 mod_timer(&wil
->connect_timer
,
415 jiffies
+ msecs_to_jiffies(2000));
417 clear_bit(wil_status_dontscan
, &wil
->status
);
418 clear_bit(wil_status_fwconnecting
, &wil
->status
);
422 cfg80211_put_bss(wiphy
, bss
);
427 static int wil_cfg80211_disconnect(struct wiphy
*wiphy
,
428 struct net_device
*ndev
,
432 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
434 rc
= wmi_send(wil
, WMI_DISCONNECT_CMDID
, NULL
, 0);
439 static int wil_cfg80211_mgmt_tx(struct wiphy
*wiphy
,
440 struct wireless_dev
*wdev
,
441 struct cfg80211_mgmt_tx_params
*params
,
444 const u8
*buf
= params
->buf
;
445 size_t len
= params
->len
;
446 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
448 struct ieee80211_mgmt
*mgmt_frame
= (void *)buf
;
449 struct wmi_sw_tx_req_cmd
*cmd
;
451 struct wil6210_mbox_hdr_wmi wmi
;
452 struct wmi_sw_tx_complete_event evt
;
455 cmd
= kmalloc(sizeof(*cmd
) + len
, GFP_KERNEL
);
459 memcpy(cmd
->dst_mac
, mgmt_frame
->da
, WMI_MAC_LEN
);
460 cmd
->len
= cpu_to_le16(len
);
461 memcpy(cmd
->payload
, buf
, len
);
463 rc
= wmi_call(wil
, WMI_SW_TX_REQ_CMDID
, cmd
, sizeof(*cmd
) + len
,
464 WMI_SW_TX_COMPLETE_EVENTID
, &evt
, sizeof(evt
), 2000);
473 static int wil_cfg80211_set_channel(struct wiphy
*wiphy
,
474 struct cfg80211_chan_def
*chandef
)
476 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
477 struct wireless_dev
*wdev
= wil
->wdev
;
479 wdev
->preset_chandef
= *chandef
;
484 static int wil_cfg80211_add_key(struct wiphy
*wiphy
,
485 struct net_device
*ndev
,
486 u8 key_index
, bool pairwise
,
488 struct key_params
*params
)
490 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
492 /* group key is not used */
496 return wmi_add_cipher_key(wil
, key_index
, mac_addr
,
497 params
->key_len
, params
->key
);
500 static int wil_cfg80211_del_key(struct wiphy
*wiphy
,
501 struct net_device
*ndev
,
502 u8 key_index
, bool pairwise
,
505 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
507 /* group key is not used */
511 return wmi_del_cipher_key(wil
, key_index
, mac_addr
);
514 /* Need to be present or wiphy_new() will WARN */
515 static int wil_cfg80211_set_default_key(struct wiphy
*wiphy
,
516 struct net_device
*ndev
,
517 u8 key_index
, bool unicast
,
523 static int wil_remain_on_channel(struct wiphy
*wiphy
,
524 struct wireless_dev
*wdev
,
525 struct ieee80211_channel
*chan
,
526 unsigned int duration
,
529 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
532 /* TODO: handle duration */
533 wil_info(wil
, "%s(%d, %d ms)\n", __func__
, chan
->center_freq
, duration
);
535 rc
= wmi_set_channel(wil
, chan
->hw_value
);
539 rc
= wmi_rxon(wil
, true);
544 static int wil_cancel_remain_on_channel(struct wiphy
*wiphy
,
545 struct wireless_dev
*wdev
,
548 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
551 wil_info(wil
, "%s()\n", __func__
);
553 rc
= wmi_rxon(wil
, false);
558 static int wil_fix_bcon(struct wil6210_priv
*wil
,
559 struct cfg80211_beacon_data
*bcon
)
561 struct ieee80211_mgmt
*f
= (struct ieee80211_mgmt
*)bcon
->probe_resp
;
562 size_t hlen
= offsetof(struct ieee80211_mgmt
, u
.probe_resp
.variable
);
565 if (bcon
->probe_resp_len
<= hlen
)
568 if (!bcon
->proberesp_ies
) {
569 bcon
->proberesp_ies
= f
->u
.probe_resp
.variable
;
570 bcon
->proberesp_ies_len
= bcon
->probe_resp_len
- hlen
;
573 if (!bcon
->assocresp_ies
) {
574 bcon
->assocresp_ies
= f
->u
.probe_resp
.variable
;
575 bcon
->assocresp_ies_len
= bcon
->probe_resp_len
- hlen
;
582 static int wil_cfg80211_start_ap(struct wiphy
*wiphy
,
583 struct net_device
*ndev
,
584 struct cfg80211_ap_settings
*info
)
587 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
588 struct wireless_dev
*wdev
= ndev
->ieee80211_ptr
;
589 struct ieee80211_channel
*channel
= info
->chandef
.chan
;
590 struct cfg80211_beacon_data
*bcon
= &info
->beacon
;
591 u8 wmi_nettype
= wil_iftype_nl2wmi(wdev
->iftype
);
594 wil_err(wil
, "AP: No channel???\n");
598 wil_dbg_misc(wil
, "AP on Channel %d %d MHz, %s\n", channel
->hw_value
,
599 channel
->center_freq
, info
->privacy
? "secure" : "open");
600 print_hex_dump_bytes("SSID ", DUMP_PREFIX_OFFSET
,
601 info
->ssid
, info
->ssid_len
);
603 if (wil_fix_bcon(wil
, bcon
))
604 wil_dbg_misc(wil
, "Fixed bcon\n");
611 rc
= wil_rx_init(wil
);
615 rc
= wmi_set_ssid(wil
, info
->ssid_len
, info
->ssid
);
619 /* MAC address - pre-requisite for other commands */
620 wmi_set_mac_address(wil
, ndev
->dev_addr
);
623 /* bcon 'head IE's are not relevant for 60g band */
625 * FW do not form regular beacon, so bcon IE's are not set
626 * For the DMG bcon, when it will be supported, bcon IE's will
627 * be reused; add something like:
628 * wmi_set_ie(wil, WMI_FRAME_BEACON, bcon->beacon_ies_len,
631 wmi_set_ie(wil
, WMI_FRAME_PROBE_RESP
, bcon
->proberesp_ies_len
,
632 bcon
->proberesp_ies
);
633 wmi_set_ie(wil
, WMI_FRAME_ASSOC_RESP
, bcon
->assocresp_ies_len
,
634 bcon
->assocresp_ies
);
636 wil
->secure_pcp
= info
->privacy
;
638 rc
= wmi_pcp_start(wil
, info
->beacon_interval
, wmi_nettype
,
644 netif_carrier_on(ndev
);
649 static int wil_cfg80211_stop_ap(struct wiphy
*wiphy
,
650 struct net_device
*ndev
)
653 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
655 rc
= wmi_pcp_stop(wil
);
660 static int wil_cfg80211_del_station(struct wiphy
*wiphy
,
661 struct net_device
*dev
, u8
*mac
)
663 struct wil6210_priv
*wil
= wiphy_to_wil(wiphy
);
664 wil6210_disconnect(wil
, mac
);
668 static struct cfg80211_ops wil_cfg80211_ops
= {
669 .scan
= wil_cfg80211_scan
,
670 .connect
= wil_cfg80211_connect
,
671 .disconnect
= wil_cfg80211_disconnect
,
672 .change_virtual_intf
= wil_cfg80211_change_iface
,
673 .get_station
= wil_cfg80211_get_station
,
674 .dump_station
= wil_cfg80211_dump_station
,
675 .remain_on_channel
= wil_remain_on_channel
,
676 .cancel_remain_on_channel
= wil_cancel_remain_on_channel
,
677 .mgmt_tx
= wil_cfg80211_mgmt_tx
,
678 .set_monitor_channel
= wil_cfg80211_set_channel
,
679 .add_key
= wil_cfg80211_add_key
,
680 .del_key
= wil_cfg80211_del_key
,
681 .set_default_key
= wil_cfg80211_set_default_key
,
683 .start_ap
= wil_cfg80211_start_ap
,
684 .stop_ap
= wil_cfg80211_stop_ap
,
685 .del_station
= wil_cfg80211_del_station
,
688 static void wil_wiphy_init(struct wiphy
*wiphy
)
690 /* TODO: set real value */
691 wiphy
->max_scan_ssids
= 10;
692 wiphy
->max_num_pmkids
= 0 /* TODO: */;
693 wiphy
->interface_modes
= BIT(NL80211_IFTYPE_STATION
) |
694 BIT(NL80211_IFTYPE_AP
) |
695 BIT(NL80211_IFTYPE_MONITOR
);
696 /* TODO: enable P2P when integrated with supplicant:
697 * BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO)
699 wiphy
->flags
|= WIPHY_FLAG_HAVE_AP_SME
|
700 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD
;
701 dev_warn(wiphy_dev(wiphy
), "%s : flags = 0x%08x\n",
702 __func__
, wiphy
->flags
);
703 wiphy
->probe_resp_offload
=
704 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS
|
705 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2
|
706 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P
;
708 wiphy
->bands
[IEEE80211_BAND_60GHZ
] = &wil_band_60ghz
;
710 /* TODO: figure this out */
711 wiphy
->signal_type
= CFG80211_SIGNAL_TYPE_UNSPEC
;
713 wiphy
->cipher_suites
= wil_cipher_suites
;
714 wiphy
->n_cipher_suites
= ARRAY_SIZE(wil_cipher_suites
);
715 wiphy
->mgmt_stypes
= wil_mgmt_stypes
;
718 struct wireless_dev
*wil_cfg80211_init(struct device
*dev
)
721 struct wireless_dev
*wdev
;
723 wdev
= kzalloc(sizeof(struct wireless_dev
), GFP_KERNEL
);
725 return ERR_PTR(-ENOMEM
);
727 wdev
->wiphy
= wiphy_new(&wil_cfg80211_ops
,
728 sizeof(struct wil6210_priv
));
734 set_wiphy_dev(wdev
->wiphy
, dev
);
735 wil_wiphy_init(wdev
->wiphy
);
737 rc
= wiphy_register(wdev
->wiphy
);
744 wiphy_free(wdev
->wiphy
);
751 void wil_wdev_free(struct wil6210_priv
*wil
)
753 struct wireless_dev
*wdev
= wil_to_wdev(wil
);
758 wiphy_unregister(wdev
->wiphy
);
759 wiphy_free(wdev
->wiphy
);