cfg80211.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. /*
  2. * Copyright (c) 2012 Qualcomm Atheros, Inc.
  3. *
  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.
  7. *
  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.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/netdevice.h>
  18. #include <linux/sched.h>
  19. #include <linux/etherdevice.h>
  20. #include <linux/wireless.h>
  21. #include <linux/ieee80211.h>
  22. #include <linux/slab.h>
  23. #include <net/cfg80211.h>
  24. #include "wil6210.h"
  25. #include "wmi.h"
  26. #define CHAN60G(_channel, _flags) { \
  27. .band = IEEE80211_BAND_60GHZ, \
  28. .center_freq = 56160 + (2160 * (_channel)), \
  29. .hw_value = (_channel), \
  30. .flags = (_flags), \
  31. .max_antenna_gain = 0, \
  32. .max_power = 40, \
  33. }
  34. static struct ieee80211_channel wil_60ghz_channels[] = {
  35. CHAN60G(1, 0),
  36. CHAN60G(2, 0),
  37. CHAN60G(3, 0),
  38. /* channel 4 not supported yet */
  39. };
  40. static struct ieee80211_supported_band wil_band_60ghz = {
  41. .channels = wil_60ghz_channels,
  42. .n_channels = ARRAY_SIZE(wil_60ghz_channels),
  43. .ht_cap = {
  44. .ht_supported = true,
  45. .cap = 0, /* TODO */
  46. .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, /* TODO */
  47. .ampdu_density = IEEE80211_HT_MPDU_DENSITY_8, /* TODO */
  48. .mcs = {
  49. /* MCS 1..12 - SC PHY */
  50. .rx_mask = {0xfe, 0x1f}, /* 1..12 */
  51. .tx_params = IEEE80211_HT_MCS_TX_DEFINED, /* TODO */
  52. },
  53. },
  54. };
  55. static const struct ieee80211_txrx_stypes
  56. wil_mgmt_stypes[NUM_NL80211_IFTYPES] = {
  57. [NL80211_IFTYPE_STATION] = {
  58. .tx = BIT(IEEE80211_STYPE_ACTION >> 4) |
  59. BIT(IEEE80211_STYPE_PROBE_RESP >> 4),
  60. .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
  61. BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
  62. },
  63. [NL80211_IFTYPE_AP] = {
  64. .tx = BIT(IEEE80211_STYPE_ACTION >> 4) |
  65. BIT(IEEE80211_STYPE_PROBE_RESP >> 4),
  66. .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
  67. BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
  68. },
  69. [NL80211_IFTYPE_P2P_CLIENT] = {
  70. .tx = BIT(IEEE80211_STYPE_ACTION >> 4) |
  71. BIT(IEEE80211_STYPE_PROBE_RESP >> 4),
  72. .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
  73. BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
  74. },
  75. [NL80211_IFTYPE_P2P_GO] = {
  76. .tx = BIT(IEEE80211_STYPE_ACTION >> 4) |
  77. BIT(IEEE80211_STYPE_PROBE_RESP >> 4),
  78. .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
  79. BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
  80. },
  81. };
  82. static const u32 wil_cipher_suites[] = {
  83. WLAN_CIPHER_SUITE_GCMP,
  84. };
  85. int wil_iftype_nl2wmi(enum nl80211_iftype type)
  86. {
  87. static const struct {
  88. enum nl80211_iftype nl;
  89. enum wmi_network_type wmi;
  90. } __nl2wmi[] = {
  91. {NL80211_IFTYPE_ADHOC, WMI_NETTYPE_ADHOC},
  92. {NL80211_IFTYPE_STATION, WMI_NETTYPE_INFRA},
  93. {NL80211_IFTYPE_AP, WMI_NETTYPE_AP},
  94. {NL80211_IFTYPE_P2P_CLIENT, WMI_NETTYPE_P2P},
  95. {NL80211_IFTYPE_P2P_GO, WMI_NETTYPE_P2P},
  96. {NL80211_IFTYPE_MONITOR, WMI_NETTYPE_ADHOC}, /* FIXME */
  97. };
  98. uint i;
  99. for (i = 0; i < ARRAY_SIZE(__nl2wmi); i++) {
  100. if (__nl2wmi[i].nl == type)
  101. return __nl2wmi[i].wmi;
  102. }
  103. return -EOPNOTSUPP;
  104. }
  105. static int wil_cfg80211_get_station(struct wiphy *wiphy,
  106. struct net_device *ndev,
  107. u8 *mac, struct station_info *sinfo)
  108. {
  109. struct wil6210_priv *wil = wiphy_to_wil(wiphy);
  110. int rc;
  111. struct wmi_notify_req_cmd cmd = {
  112. .cid = 0,
  113. .interval_usec = 0,
  114. };
  115. if (memcmp(mac, wil->dst_addr[0], ETH_ALEN))
  116. return -ENOENT;
  117. /* WMI_NOTIFY_REQ_DONE_EVENTID handler fills wil->stats.bf_mcs */
  118. rc = wmi_call(wil, WMI_NOTIFY_REQ_CMDID, &cmd, sizeof(cmd),
  119. WMI_NOTIFY_REQ_DONE_EVENTID, NULL, 0, 20);
  120. if (rc)
  121. return rc;
  122. sinfo->generation = wil->sinfo_gen;
  123. sinfo->filled |= STATION_INFO_TX_BITRATE;
  124. sinfo->txrate.flags = RATE_INFO_FLAGS_MCS | RATE_INFO_FLAGS_60G;
  125. sinfo->txrate.mcs = wil->stats.bf_mcs;
  126. sinfo->filled |= STATION_INFO_RX_BITRATE;
  127. sinfo->rxrate.flags = RATE_INFO_FLAGS_MCS | RATE_INFO_FLAGS_60G;
  128. sinfo->rxrate.mcs = wil->stats.last_mcs_rx;
  129. if (test_bit(wil_status_fwconnected, &wil->status)) {
  130. sinfo->filled |= STATION_INFO_SIGNAL;
  131. sinfo->signal = 12; /* TODO: provide real value */
  132. }
  133. return 0;
  134. }
  135. static int wil_cfg80211_change_iface(struct wiphy *wiphy,
  136. struct net_device *ndev,
  137. enum nl80211_iftype type, u32 *flags,
  138. struct vif_params *params)
  139. {
  140. struct wil6210_priv *wil = wiphy_to_wil(wiphy);
  141. struct wireless_dev *wdev = wil->wdev;
  142. switch (type) {
  143. case NL80211_IFTYPE_STATION:
  144. case NL80211_IFTYPE_AP:
  145. case NL80211_IFTYPE_P2P_CLIENT:
  146. case NL80211_IFTYPE_P2P_GO:
  147. break;
  148. case NL80211_IFTYPE_MONITOR:
  149. if (flags)
  150. wil->monitor_flags = *flags;
  151. else
  152. wil->monitor_flags = 0;
  153. break;
  154. default:
  155. return -EOPNOTSUPP;
  156. }
  157. wdev->iftype = type;
  158. return 0;
  159. }
  160. static int wil_cfg80211_scan(struct wiphy *wiphy,
  161. struct cfg80211_scan_request *request)
  162. {
  163. struct wil6210_priv *wil = wiphy_to_wil(wiphy);
  164. struct wireless_dev *wdev = wil->wdev;
  165. struct {
  166. struct wmi_start_scan_cmd cmd;
  167. u16 chnl[4];
  168. } __packed cmd;
  169. uint i, n;
  170. if (wil->scan_request) {
  171. wil_err(wil, "Already scanning\n");
  172. return -EAGAIN;
  173. }
  174. /* check we are client side */
  175. switch (wdev->iftype) {
  176. case NL80211_IFTYPE_STATION:
  177. case NL80211_IFTYPE_P2P_CLIENT:
  178. break;
  179. default:
  180. return -EOPNOTSUPP;
  181. }
  182. /* FW don't support scan after connection attempt */
  183. if (test_bit(wil_status_dontscan, &wil->status)) {
  184. wil_err(wil, "Scan after connect attempt not supported\n");
  185. return -EBUSY;
  186. }
  187. wil->scan_request = request;
  188. memset(&cmd, 0, sizeof(cmd));
  189. cmd.cmd.num_channels = 0;
  190. n = min(request->n_channels, 4U);
  191. for (i = 0; i < n; i++) {
  192. int ch = request->channels[i]->hw_value;
  193. if (ch == 0) {
  194. wil_err(wil,
  195. "Scan requested for unknown frequency %dMhz\n",
  196. request->channels[i]->center_freq);
  197. continue;
  198. }
  199. /* 0-based channel indexes */
  200. cmd.cmd.channel_list[cmd.cmd.num_channels++].channel = ch - 1;
  201. wil_dbg_misc(wil, "Scan for ch %d : %d MHz\n", ch,
  202. request->channels[i]->center_freq);
  203. }
  204. return wmi_send(wil, WMI_START_SCAN_CMDID, &cmd, sizeof(cmd.cmd) +
  205. cmd.cmd.num_channels * sizeof(cmd.cmd.channel_list[0]));
  206. }
  207. static int wil_cfg80211_connect(struct wiphy *wiphy,
  208. struct net_device *ndev,
  209. struct cfg80211_connect_params *sme)
  210. {
  211. struct wil6210_priv *wil = wiphy_to_wil(wiphy);
  212. struct cfg80211_bss *bss;
  213. struct wmi_connect_cmd conn;
  214. const u8 *ssid_eid;
  215. const u8 *rsn_eid;
  216. int ch;
  217. int rc = 0;
  218. bss = cfg80211_get_bss(wiphy, sme->channel, sme->bssid,
  219. sme->ssid, sme->ssid_len,
  220. WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
  221. if (!bss) {
  222. wil_err(wil, "Unable to find BSS\n");
  223. return -ENOENT;
  224. }
  225. ssid_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SSID);
  226. if (!ssid_eid) {
  227. wil_err(wil, "No SSID\n");
  228. rc = -ENOENT;
  229. goto out;
  230. }
  231. rsn_eid = sme->ie ?
  232. cfg80211_find_ie(WLAN_EID_RSN, sme->ie, sme->ie_len) :
  233. NULL;
  234. if (rsn_eid) {
  235. if (sme->ie_len > WMI_MAX_IE_LEN) {
  236. rc = -ERANGE;
  237. wil_err(wil, "IE too large (%td bytes)\n",
  238. sme->ie_len);
  239. goto out;
  240. }
  241. /*
  242. * For secure assoc, send:
  243. * (1) WMI_DELETE_CIPHER_KEY_CMD
  244. * (2) WMI_SET_APPIE_CMD
  245. */
  246. rc = wmi_del_cipher_key(wil, 0, bss->bssid);
  247. if (rc) {
  248. wil_err(wil, "WMI_DELETE_CIPHER_KEY_CMD failed\n");
  249. goto out;
  250. }
  251. /* WMI_SET_APPIE_CMD */
  252. rc = wmi_set_ie(wil, WMI_FRAME_ASSOC_REQ, sme->ie_len, sme->ie);
  253. if (rc) {
  254. wil_err(wil, "WMI_SET_APPIE_CMD failed\n");
  255. goto out;
  256. }
  257. }
  258. /* WMI_CONNECT_CMD */
  259. memset(&conn, 0, sizeof(conn));
  260. switch (bss->capability & 0x03) {
  261. case WLAN_CAPABILITY_DMG_TYPE_AP:
  262. conn.network_type = WMI_NETTYPE_INFRA;
  263. break;
  264. case WLAN_CAPABILITY_DMG_TYPE_PBSS:
  265. conn.network_type = WMI_NETTYPE_P2P;
  266. break;
  267. default:
  268. wil_err(wil, "Unsupported BSS type, capability= 0x%04x\n",
  269. bss->capability);
  270. goto out;
  271. }
  272. if (rsn_eid) {
  273. conn.dot11_auth_mode = WMI_AUTH11_SHARED;
  274. conn.auth_mode = WMI_AUTH_WPA2_PSK;
  275. conn.pairwise_crypto_type = WMI_CRYPT_AES_GCMP;
  276. conn.pairwise_crypto_len = 16;
  277. } else {
  278. conn.dot11_auth_mode = WMI_AUTH11_OPEN;
  279. conn.auth_mode = WMI_AUTH_NONE;
  280. }
  281. conn.ssid_len = min_t(u8, ssid_eid[1], 32);
  282. memcpy(conn.ssid, ssid_eid+2, conn.ssid_len);
  283. ch = bss->channel->hw_value;
  284. if (ch == 0) {
  285. wil_err(wil, "BSS at unknown frequency %dMhz\n",
  286. bss->channel->center_freq);
  287. rc = -EOPNOTSUPP;
  288. goto out;
  289. }
  290. conn.channel = ch - 1;
  291. memcpy(conn.bssid, bss->bssid, 6);
  292. memcpy(conn.dst_mac, bss->bssid, 6);
  293. /*
  294. * FW don't support scan after connection attempt
  295. */
  296. set_bit(wil_status_dontscan, &wil->status);
  297. rc = wmi_send(wil, WMI_CONNECT_CMDID, &conn, sizeof(conn));
  298. if (rc == 0) {
  299. /* Connect can take lots of time */
  300. mod_timer(&wil->connect_timer,
  301. jiffies + msecs_to_jiffies(2000));
  302. }
  303. out:
  304. cfg80211_put_bss(wiphy, bss);
  305. return rc;
  306. }
  307. static int wil_cfg80211_disconnect(struct wiphy *wiphy,
  308. struct net_device *ndev,
  309. u16 reason_code)
  310. {
  311. int rc;
  312. struct wil6210_priv *wil = wiphy_to_wil(wiphy);
  313. rc = wmi_send(wil, WMI_DISCONNECT_CMDID, NULL, 0);
  314. return rc;
  315. }
  316. static int wil_cfg80211_set_channel(struct wiphy *wiphy,
  317. struct cfg80211_chan_def *chandef)
  318. {
  319. struct wil6210_priv *wil = wiphy_to_wil(wiphy);
  320. struct wireless_dev *wdev = wil->wdev;
  321. wdev->preset_chandef = *chandef;
  322. return 0;
  323. }
  324. static int wil_cfg80211_add_key(struct wiphy *wiphy,
  325. struct net_device *ndev,
  326. u8 key_index, bool pairwise,
  327. const u8 *mac_addr,
  328. struct key_params *params)
  329. {
  330. struct wil6210_priv *wil = wiphy_to_wil(wiphy);
  331. /* group key is not used */
  332. if (!pairwise)
  333. return 0;
  334. return wmi_add_cipher_key(wil, key_index, mac_addr,
  335. params->key_len, params->key);
  336. }
  337. static int wil_cfg80211_del_key(struct wiphy *wiphy,
  338. struct net_device *ndev,
  339. u8 key_index, bool pairwise,
  340. const u8 *mac_addr)
  341. {
  342. struct wil6210_priv *wil = wiphy_to_wil(wiphy);
  343. /* group key is not used */
  344. if (!pairwise)
  345. return 0;
  346. return wmi_del_cipher_key(wil, key_index, mac_addr);
  347. }
  348. /* Need to be present or wiphy_new() will WARN */
  349. static int wil_cfg80211_set_default_key(struct wiphy *wiphy,
  350. struct net_device *ndev,
  351. u8 key_index, bool unicast,
  352. bool multicast)
  353. {
  354. return 0;
  355. }
  356. static int wil_cfg80211_start_ap(struct wiphy *wiphy,
  357. struct net_device *ndev,
  358. struct cfg80211_ap_settings *info)
  359. {
  360. int rc = 0;
  361. struct wil6210_priv *wil = wiphy_to_wil(wiphy);
  362. struct wireless_dev *wdev = ndev->ieee80211_ptr;
  363. struct ieee80211_channel *channel = info->chandef.chan;
  364. struct cfg80211_beacon_data *bcon = &info->beacon;
  365. u8 wmi_nettype = wil_iftype_nl2wmi(wdev->iftype);
  366. if (!channel) {
  367. wil_err(wil, "AP: No channel???\n");
  368. return -EINVAL;
  369. }
  370. wil_dbg_misc(wil, "AP on Channel %d %d MHz, %s\n", channel->hw_value,
  371. channel->center_freq, info->privacy ? "secure" : "open");
  372. print_hex_dump_bytes("SSID ", DUMP_PREFIX_OFFSET,
  373. info->ssid, info->ssid_len);
  374. rc = wil_reset(wil);
  375. if (rc)
  376. return rc;
  377. rc = wmi_set_ssid(wil, info->ssid_len, info->ssid);
  378. if (rc)
  379. return rc;
  380. rc = wmi_set_channel(wil, channel->hw_value);
  381. if (rc)
  382. return rc;
  383. /* MAC address - pre-requisite for other commands */
  384. wmi_set_mac_address(wil, ndev->dev_addr);
  385. /* IE's */
  386. /* bcon 'head IE's are not relevant for 60g band */
  387. wmi_set_ie(wil, WMI_FRAME_BEACON, bcon->beacon_ies_len,
  388. bcon->beacon_ies);
  389. wmi_set_ie(wil, WMI_FRAME_PROBE_RESP, bcon->proberesp_ies_len,
  390. bcon->proberesp_ies);
  391. wmi_set_ie(wil, WMI_FRAME_ASSOC_RESP, bcon->assocresp_ies_len,
  392. bcon->assocresp_ies);
  393. wil->secure_pcp = info->privacy;
  394. rc = wmi_set_bcon(wil, info->beacon_interval, wmi_nettype);
  395. if (rc)
  396. return rc;
  397. /* Rx VRING. After MAC and beacon */
  398. rc = wil_rx_init(wil);
  399. netif_carrier_on(ndev);
  400. return rc;
  401. }
  402. static int wil_cfg80211_stop_ap(struct wiphy *wiphy,
  403. struct net_device *ndev)
  404. {
  405. int rc = 0;
  406. struct wil6210_priv *wil = wiphy_to_wil(wiphy);
  407. struct wireless_dev *wdev = ndev->ieee80211_ptr;
  408. u8 wmi_nettype = wil_iftype_nl2wmi(wdev->iftype);
  409. /* To stop beaconing, set BI to 0 */
  410. rc = wmi_set_bcon(wil, 0, wmi_nettype);
  411. return rc;
  412. }
  413. static struct cfg80211_ops wil_cfg80211_ops = {
  414. .scan = wil_cfg80211_scan,
  415. .connect = wil_cfg80211_connect,
  416. .disconnect = wil_cfg80211_disconnect,
  417. .change_virtual_intf = wil_cfg80211_change_iface,
  418. .get_station = wil_cfg80211_get_station,
  419. .set_monitor_channel = wil_cfg80211_set_channel,
  420. .add_key = wil_cfg80211_add_key,
  421. .del_key = wil_cfg80211_del_key,
  422. .set_default_key = wil_cfg80211_set_default_key,
  423. /* AP mode */
  424. .start_ap = wil_cfg80211_start_ap,
  425. .stop_ap = wil_cfg80211_stop_ap,
  426. };
  427. static void wil_wiphy_init(struct wiphy *wiphy)
  428. {
  429. /* TODO: set real value */
  430. wiphy->max_scan_ssids = 10;
  431. wiphy->max_num_pmkids = 0 /* TODO: */;
  432. wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  433. BIT(NL80211_IFTYPE_AP) |
  434. BIT(NL80211_IFTYPE_MONITOR);
  435. /* TODO: enable P2P when integrated with supplicant:
  436. * BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO)
  437. */
  438. wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
  439. WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
  440. dev_warn(wiphy_dev(wiphy), "%s : flags = 0x%08x\n",
  441. __func__, wiphy->flags);
  442. wiphy->probe_resp_offload =
  443. NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS |
  444. NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 |
  445. NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P;
  446. wiphy->bands[IEEE80211_BAND_60GHZ] = &wil_band_60ghz;
  447. /* TODO: figure this out */
  448. wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  449. wiphy->cipher_suites = wil_cipher_suites;
  450. wiphy->n_cipher_suites = ARRAY_SIZE(wil_cipher_suites);
  451. wiphy->mgmt_stypes = wil_mgmt_stypes;
  452. }
  453. struct wireless_dev *wil_cfg80211_init(struct device *dev)
  454. {
  455. int rc = 0;
  456. struct wireless_dev *wdev;
  457. wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
  458. if (!wdev)
  459. return ERR_PTR(-ENOMEM);
  460. wdev->wiphy = wiphy_new(&wil_cfg80211_ops,
  461. sizeof(struct wil6210_priv));
  462. if (!wdev->wiphy) {
  463. rc = -ENOMEM;
  464. goto out;
  465. }
  466. set_wiphy_dev(wdev->wiphy, dev);
  467. wil_wiphy_init(wdev->wiphy);
  468. rc = wiphy_register(wdev->wiphy);
  469. if (rc < 0)
  470. goto out_failed_reg;
  471. return wdev;
  472. out_failed_reg:
  473. wiphy_free(wdev->wiphy);
  474. out:
  475. kfree(wdev);
  476. return ERR_PTR(rc);
  477. }
  478. void wil_wdev_free(struct wil6210_priv *wil)
  479. {
  480. struct wireless_dev *wdev = wil_to_wdev(wil);
  481. if (!wdev)
  482. return;
  483. wiphy_unregister(wdev->wiphy);
  484. wiphy_free(wdev->wiphy);
  485. kfree(wdev);
  486. }