Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[sfrench/cifs-2.6.git] / drivers / net / wireless / virt_wifi.c
1 // SPDX-License-Identifier: GPL-2.0
2 /* drivers/net/wireless/virt_wifi.c
3  *
4  * A fake implementation of cfg80211_ops that can be tacked on to an ethernet
5  * net_device to make it appear as a wireless connection.
6  *
7  * Copyright (C) 2018 Google, Inc.
8  *
9  * Author: schuffelen@google.com
10  */
11
12 #include <net/cfg80211.h>
13 #include <net/rtnetlink.h>
14 #include <linux/etherdevice.h>
15 #include <linux/module.h>
16
17 #include <net/cfg80211.h>
18 #include <net/rtnetlink.h>
19 #include <linux/etherdevice.h>
20 #include <linux/module.h>
21
22 static struct wiphy *common_wiphy;
23
24 struct virt_wifi_wiphy_priv {
25         struct delayed_work scan_result;
26         struct cfg80211_scan_request *scan_request;
27         bool being_deleted;
28 };
29
30 static struct ieee80211_channel channel_2ghz = {
31         .band = NL80211_BAND_2GHZ,
32         .center_freq = 2432,
33         .hw_value = 2432,
34         .max_power = 20,
35 };
36
37 static struct ieee80211_rate bitrates_2ghz[] = {
38         { .bitrate = 10 },
39         { .bitrate = 20 },
40         { .bitrate = 55 },
41         { .bitrate = 110 },
42         { .bitrate = 60 },
43         { .bitrate = 120 },
44         { .bitrate = 240 },
45 };
46
47 static struct ieee80211_supported_band band_2ghz = {
48         .channels = &channel_2ghz,
49         .bitrates = bitrates_2ghz,
50         .band = NL80211_BAND_2GHZ,
51         .n_channels = 1,
52         .n_bitrates = ARRAY_SIZE(bitrates_2ghz),
53         .ht_cap = {
54                 .ht_supported = true,
55                 .cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
56                        IEEE80211_HT_CAP_GRN_FLD |
57                        IEEE80211_HT_CAP_SGI_20 |
58                        IEEE80211_HT_CAP_SGI_40 |
59                        IEEE80211_HT_CAP_DSSSCCK40,
60                 .ampdu_factor = 0x3,
61                 .ampdu_density = 0x6,
62                 .mcs = {
63                         .rx_mask = {0xff, 0xff},
64                         .tx_params = IEEE80211_HT_MCS_TX_DEFINED,
65                 },
66         },
67 };
68
69 static struct ieee80211_channel channel_5ghz = {
70         .band = NL80211_BAND_5GHZ,
71         .center_freq = 5240,
72         .hw_value = 5240,
73         .max_power = 20,
74 };
75
76 static struct ieee80211_rate bitrates_5ghz[] = {
77         { .bitrate = 60 },
78         { .bitrate = 120 },
79         { .bitrate = 240 },
80 };
81
82 #define RX_MCS_MAP (IEEE80211_VHT_MCS_SUPPORT_0_9 << 0 | \
83                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 2 | \
84                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 4 | \
85                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 6 | \
86                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 8 | \
87                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 10 | \
88                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 12 | \
89                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 14)
90
91 #define TX_MCS_MAP (IEEE80211_VHT_MCS_SUPPORT_0_9 << 0 | \
92                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 2 | \
93                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 4 | \
94                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 6 | \
95                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 8 | \
96                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 10 | \
97                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 12 | \
98                     IEEE80211_VHT_MCS_SUPPORT_0_9 << 14)
99
100 static struct ieee80211_supported_band band_5ghz = {
101         .channels = &channel_5ghz,
102         .bitrates = bitrates_5ghz,
103         .band = NL80211_BAND_5GHZ,
104         .n_channels = 1,
105         .n_bitrates = ARRAY_SIZE(bitrates_5ghz),
106         .ht_cap = {
107                 .ht_supported = true,
108                 .cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
109                        IEEE80211_HT_CAP_GRN_FLD |
110                        IEEE80211_HT_CAP_SGI_20 |
111                        IEEE80211_HT_CAP_SGI_40 |
112                        IEEE80211_HT_CAP_DSSSCCK40,
113                 .ampdu_factor = 0x3,
114                 .ampdu_density = 0x6,
115                 .mcs = {
116                         .rx_mask = {0xff, 0xff},
117                         .tx_params = IEEE80211_HT_MCS_TX_DEFINED,
118                 },
119         },
120         .vht_cap = {
121                 .vht_supported = true,
122                 .cap = IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
123                        IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ |
124                        IEEE80211_VHT_CAP_RXLDPC |
125                        IEEE80211_VHT_CAP_SHORT_GI_80 |
126                        IEEE80211_VHT_CAP_SHORT_GI_160 |
127                        IEEE80211_VHT_CAP_TXSTBC |
128                        IEEE80211_VHT_CAP_RXSTBC_1 |
129                        IEEE80211_VHT_CAP_RXSTBC_2 |
130                        IEEE80211_VHT_CAP_RXSTBC_3 |
131                        IEEE80211_VHT_CAP_RXSTBC_4 |
132                        IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK,
133                 .vht_mcs = {
134                         .rx_mcs_map = cpu_to_le16(RX_MCS_MAP),
135                         .tx_mcs_map = cpu_to_le16(TX_MCS_MAP),
136                 }
137         },
138 };
139
140 /* Assigned at module init. Guaranteed locally-administered and unicast. */
141 static u8 fake_router_bssid[ETH_ALEN] __ro_after_init = {};
142
143 /* Called with the rtnl lock held. */
144 static int virt_wifi_scan(struct wiphy *wiphy,
145                           struct cfg80211_scan_request *request)
146 {
147         struct virt_wifi_wiphy_priv *priv = wiphy_priv(wiphy);
148
149         wiphy_debug(wiphy, "scan\n");
150
151         if (priv->scan_request || priv->being_deleted)
152                 return -EBUSY;
153
154         priv->scan_request = request;
155         schedule_delayed_work(&priv->scan_result, HZ * 2);
156
157         return 0;
158 }
159
160 /* Acquires and releases the rdev BSS lock. */
161 static void virt_wifi_scan_result(struct work_struct *work)
162 {
163         struct {
164                 u8 tag;
165                 u8 len;
166                 u8 ssid[8];
167         } __packed ssid = {
168                 .tag = WLAN_EID_SSID, .len = 8, .ssid = "VirtWifi",
169         };
170         struct cfg80211_bss *informed_bss;
171         struct virt_wifi_wiphy_priv *priv =
172                 container_of(work, struct virt_wifi_wiphy_priv,
173                              scan_result.work);
174         struct wiphy *wiphy = priv_to_wiphy(priv);
175         struct cfg80211_scan_info scan_info = { .aborted = false };
176
177         informed_bss = cfg80211_inform_bss(wiphy, &channel_5ghz,
178                                            CFG80211_BSS_FTYPE_PRESP,
179                                            fake_router_bssid,
180                                            ktime_get_boot_ns(),
181                                            WLAN_CAPABILITY_ESS, 0,
182                                            (void *)&ssid, sizeof(ssid),
183                                            DBM_TO_MBM(-50), GFP_KERNEL);
184         cfg80211_put_bss(wiphy, informed_bss);
185
186         /* Schedules work which acquires and releases the rtnl lock. */
187         cfg80211_scan_done(priv->scan_request, &scan_info);
188         priv->scan_request = NULL;
189 }
190
191 /* May acquire and release the rdev BSS lock. */
192 static void virt_wifi_cancel_scan(struct wiphy *wiphy)
193 {
194         struct virt_wifi_wiphy_priv *priv = wiphy_priv(wiphy);
195
196         cancel_delayed_work_sync(&priv->scan_result);
197         /* Clean up dangling callbacks if necessary. */
198         if (priv->scan_request) {
199                 struct cfg80211_scan_info scan_info = { .aborted = true };
200                 /* Schedules work which acquires and releases the rtnl lock. */
201                 cfg80211_scan_done(priv->scan_request, &scan_info);
202                 priv->scan_request = NULL;
203         }
204 }
205
206 struct virt_wifi_netdev_priv {
207         struct delayed_work connect;
208         struct net_device *lowerdev;
209         struct net_device *upperdev;
210         u32 tx_packets;
211         u32 tx_failed;
212         u8 connect_requested_bss[ETH_ALEN];
213         bool is_up;
214         bool is_connected;
215         bool being_deleted;
216 };
217
218 /* Called with the rtnl lock held. */
219 static int virt_wifi_connect(struct wiphy *wiphy, struct net_device *netdev,
220                              struct cfg80211_connect_params *sme)
221 {
222         struct virt_wifi_netdev_priv *priv = netdev_priv(netdev);
223         bool could_schedule;
224
225         if (priv->being_deleted || !priv->is_up)
226                 return -EBUSY;
227
228         could_schedule = schedule_delayed_work(&priv->connect, HZ * 2);
229         if (!could_schedule)
230                 return -EBUSY;
231
232         if (sme->bssid)
233                 ether_addr_copy(priv->connect_requested_bss, sme->bssid);
234         else
235                 eth_zero_addr(priv->connect_requested_bss);
236
237         wiphy_debug(wiphy, "connect\n");
238
239         return 0;
240 }
241
242 /* Acquires and releases the rdev event lock. */
243 static void virt_wifi_connect_complete(struct work_struct *work)
244 {
245         struct virt_wifi_netdev_priv *priv =
246                 container_of(work, struct virt_wifi_netdev_priv, connect.work);
247         u8 *requested_bss = priv->connect_requested_bss;
248         bool has_addr = !is_zero_ether_addr(requested_bss);
249         bool right_addr = ether_addr_equal(requested_bss, fake_router_bssid);
250         u16 status = WLAN_STATUS_SUCCESS;
251
252         if (!priv->is_up || (has_addr && !right_addr))
253                 status = WLAN_STATUS_UNSPECIFIED_FAILURE;
254         else
255                 priv->is_connected = true;
256
257         /* Schedules an event that acquires the rtnl lock. */
258         cfg80211_connect_result(priv->upperdev, requested_bss, NULL, 0, NULL, 0,
259                                 status, GFP_KERNEL);
260         netif_carrier_on(priv->upperdev);
261 }
262
263 /* May acquire and release the rdev event lock. */
264 static void virt_wifi_cancel_connect(struct net_device *netdev)
265 {
266         struct virt_wifi_netdev_priv *priv = netdev_priv(netdev);
267
268         /* If there is work pending, clean up dangling callbacks. */
269         if (cancel_delayed_work_sync(&priv->connect)) {
270                 /* Schedules an event that acquires the rtnl lock. */
271                 cfg80211_connect_result(priv->upperdev,
272                                         priv->connect_requested_bss, NULL, 0,
273                                         NULL, 0,
274                                         WLAN_STATUS_UNSPECIFIED_FAILURE,
275                                         GFP_KERNEL);
276         }
277 }
278
279 /* Called with the rtnl lock held. Acquires the rdev event lock. */
280 static int virt_wifi_disconnect(struct wiphy *wiphy, struct net_device *netdev,
281                                 u16 reason_code)
282 {
283         struct virt_wifi_netdev_priv *priv = netdev_priv(netdev);
284
285         if (priv->being_deleted)
286                 return -EBUSY;
287
288         wiphy_debug(wiphy, "disconnect\n");
289         virt_wifi_cancel_connect(netdev);
290
291         cfg80211_disconnected(netdev, reason_code, NULL, 0, true, GFP_KERNEL);
292         priv->is_connected = false;
293         netif_carrier_off(netdev);
294
295         return 0;
296 }
297
298 /* Called with the rtnl lock held. */
299 static int virt_wifi_get_station(struct wiphy *wiphy, struct net_device *dev,
300                                  const u8 *mac, struct station_info *sinfo)
301 {
302         struct virt_wifi_netdev_priv *priv = netdev_priv(dev);
303
304         wiphy_debug(wiphy, "get_station\n");
305
306         if (!priv->is_connected || !ether_addr_equal(mac, fake_router_bssid))
307                 return -ENOENT;
308
309         sinfo->filled = BIT_ULL(NL80211_STA_INFO_TX_PACKETS) |
310                 BIT_ULL(NL80211_STA_INFO_TX_FAILED) |
311                 BIT_ULL(NL80211_STA_INFO_SIGNAL) |
312                 BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
313         sinfo->tx_packets = priv->tx_packets;
314         sinfo->tx_failed = priv->tx_failed;
315         /* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_ */
316         sinfo->signal = -50;
317         sinfo->txrate = (struct rate_info) {
318                 .legacy = 10, /* units are 100kbit/s */
319         };
320         return 0;
321 }
322
323 /* Called with the rtnl lock held. */
324 static int virt_wifi_dump_station(struct wiphy *wiphy, struct net_device *dev,
325                                   int idx, u8 *mac, struct station_info *sinfo)
326 {
327         struct virt_wifi_netdev_priv *priv = netdev_priv(dev);
328
329         wiphy_debug(wiphy, "dump_station\n");
330
331         if (idx != 0 || !priv->is_connected)
332                 return -ENOENT;
333
334         ether_addr_copy(mac, fake_router_bssid);
335         return virt_wifi_get_station(wiphy, dev, fake_router_bssid, sinfo);
336 }
337
338 static const struct cfg80211_ops virt_wifi_cfg80211_ops = {
339         .scan = virt_wifi_scan,
340
341         .connect = virt_wifi_connect,
342         .disconnect = virt_wifi_disconnect,
343
344         .get_station = virt_wifi_get_station,
345         .dump_station = virt_wifi_dump_station,
346 };
347
348 /* Acquires and releases the rtnl lock. */
349 static struct wiphy *virt_wifi_make_wiphy(void)
350 {
351         struct wiphy *wiphy;
352         struct virt_wifi_wiphy_priv *priv;
353         int err;
354
355         wiphy = wiphy_new(&virt_wifi_cfg80211_ops, sizeof(*priv));
356
357         if (!wiphy)
358                 return NULL;
359
360         wiphy->max_scan_ssids = 4;
361         wiphy->max_scan_ie_len = 1000;
362         wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
363
364         wiphy->bands[NL80211_BAND_2GHZ] = &band_2ghz;
365         wiphy->bands[NL80211_BAND_5GHZ] = &band_5ghz;
366         wiphy->bands[NL80211_BAND_60GHZ] = NULL;
367
368         wiphy->regulatory_flags = REGULATORY_WIPHY_SELF_MANAGED;
369         wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
370
371         priv = wiphy_priv(wiphy);
372         priv->being_deleted = false;
373         priv->scan_request = NULL;
374         INIT_DELAYED_WORK(&priv->scan_result, virt_wifi_scan_result);
375
376         err = wiphy_register(wiphy);
377         if (err < 0) {
378                 wiphy_free(wiphy);
379                 return NULL;
380         }
381
382         return wiphy;
383 }
384
385 /* Acquires and releases the rtnl lock. */
386 static void virt_wifi_destroy_wiphy(struct wiphy *wiphy)
387 {
388         struct virt_wifi_wiphy_priv *priv;
389
390         WARN(!wiphy, "%s called with null wiphy", __func__);
391         if (!wiphy)
392                 return;
393
394         priv = wiphy_priv(wiphy);
395         priv->being_deleted = true;
396         virt_wifi_cancel_scan(wiphy);
397
398         if (wiphy->registered)
399                 wiphy_unregister(wiphy);
400         wiphy_free(wiphy);
401 }
402
403 /* Enters and exits a RCU-bh critical section. */
404 static netdev_tx_t virt_wifi_start_xmit(struct sk_buff *skb,
405                                         struct net_device *dev)
406 {
407         struct virt_wifi_netdev_priv *priv = netdev_priv(dev);
408
409         priv->tx_packets++;
410         if (!priv->is_connected) {
411                 priv->tx_failed++;
412                 return NET_XMIT_DROP;
413         }
414
415         skb->dev = priv->lowerdev;
416         return dev_queue_xmit(skb);
417 }
418
419 /* Called with rtnl lock held. */
420 static int virt_wifi_net_device_open(struct net_device *dev)
421 {
422         struct virt_wifi_netdev_priv *priv = netdev_priv(dev);
423
424         priv->is_up = true;
425         return 0;
426 }
427
428 /* Called with rtnl lock held. */
429 static int virt_wifi_net_device_stop(struct net_device *dev)
430 {
431         struct virt_wifi_netdev_priv *n_priv = netdev_priv(dev);
432         struct virt_wifi_wiphy_priv *w_priv;
433
434         n_priv->is_up = false;
435
436         if (!dev->ieee80211_ptr)
437                 return 0;
438         w_priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
439
440         virt_wifi_cancel_scan(dev->ieee80211_ptr->wiphy);
441         virt_wifi_cancel_connect(dev);
442         netif_carrier_off(dev);
443
444         return 0;
445 }
446
447 static const struct net_device_ops virt_wifi_ops = {
448         .ndo_start_xmit = virt_wifi_start_xmit,
449         .ndo_open = virt_wifi_net_device_open,
450         .ndo_stop = virt_wifi_net_device_stop,
451 };
452
453 /* Invoked as part of rtnl lock release. */
454 static void virt_wifi_net_device_destructor(struct net_device *dev)
455 {
456         /* Delayed past dellink to allow nl80211 to react to the device being
457          * deleted.
458          */
459         kfree(dev->ieee80211_ptr);
460         dev->ieee80211_ptr = NULL;
461         free_netdev(dev);
462 }
463
464 /* No lock interaction. */
465 static void virt_wifi_setup(struct net_device *dev)
466 {
467         ether_setup(dev);
468         dev->netdev_ops = &virt_wifi_ops;
469         dev->priv_destructor = virt_wifi_net_device_destructor;
470 }
471
472 /* Called in a RCU read critical section from netif_receive_skb */
473 static rx_handler_result_t virt_wifi_rx_handler(struct sk_buff **pskb)
474 {
475         struct sk_buff *skb = *pskb;
476         struct virt_wifi_netdev_priv *priv =
477                 rcu_dereference(skb->dev->rx_handler_data);
478
479         if (!priv->is_connected)
480                 return RX_HANDLER_PASS;
481
482         /* GFP_ATOMIC because this is a packet interrupt handler. */
483         skb = skb_share_check(skb, GFP_ATOMIC);
484         if (!skb) {
485                 dev_err(&priv->upperdev->dev, "can't skb_share_check\n");
486                 return RX_HANDLER_CONSUMED;
487         }
488
489         *pskb = skb;
490         skb->dev = priv->upperdev;
491         skb->pkt_type = PACKET_HOST;
492         return RX_HANDLER_ANOTHER;
493 }
494
495 /* Called with rtnl lock held. */
496 static int virt_wifi_newlink(struct net *src_net, struct net_device *dev,
497                              struct nlattr *tb[], struct nlattr *data[],
498                              struct netlink_ext_ack *extack)
499 {
500         struct virt_wifi_netdev_priv *priv = netdev_priv(dev);
501         int err;
502
503         if (!tb[IFLA_LINK])
504                 return -EINVAL;
505
506         netif_carrier_off(dev);
507
508         priv->upperdev = dev;
509         priv->lowerdev = __dev_get_by_index(src_net,
510                                             nla_get_u32(tb[IFLA_LINK]));
511
512         if (!priv->lowerdev)
513                 return -ENODEV;
514         if (!tb[IFLA_MTU])
515                 dev->mtu = priv->lowerdev->mtu;
516         else if (dev->mtu > priv->lowerdev->mtu)
517                 return -EINVAL;
518
519         err = netdev_rx_handler_register(priv->lowerdev, virt_wifi_rx_handler,
520                                          priv);
521         if (err) {
522                 dev_err(&priv->lowerdev->dev,
523                         "can't netdev_rx_handler_register: %d\n", err);
524                 return err;
525         }
526
527         eth_hw_addr_inherit(dev, priv->lowerdev);
528         netif_stacked_transfer_operstate(priv->lowerdev, dev);
529
530         SET_NETDEV_DEV(dev, &priv->lowerdev->dev);
531         dev->ieee80211_ptr = kzalloc(sizeof(*dev->ieee80211_ptr), GFP_KERNEL);
532
533         if (!dev->ieee80211_ptr) {
534                 err = -ENOMEM;
535                 goto remove_handler;
536         }
537
538         dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION;
539         dev->ieee80211_ptr->wiphy = common_wiphy;
540
541         err = register_netdevice(dev);
542         if (err) {
543                 dev_err(&priv->lowerdev->dev, "can't register_netdevice: %d\n",
544                         err);
545                 goto free_wireless_dev;
546         }
547
548         err = netdev_upper_dev_link(priv->lowerdev, dev, extack);
549         if (err) {
550                 dev_err(&priv->lowerdev->dev, "can't netdev_upper_dev_link: %d\n",
551                         err);
552                 goto unregister_netdev;
553         }
554
555         priv->being_deleted = false;
556         priv->is_connected = false;
557         priv->is_up = false;
558         INIT_DELAYED_WORK(&priv->connect, virt_wifi_connect_complete);
559
560         return 0;
561 unregister_netdev:
562         unregister_netdevice(dev);
563 free_wireless_dev:
564         kfree(dev->ieee80211_ptr);
565         dev->ieee80211_ptr = NULL;
566 remove_handler:
567         netdev_rx_handler_unregister(priv->lowerdev);
568
569         return err;
570 }
571
572 /* Called with rtnl lock held. */
573 static void virt_wifi_dellink(struct net_device *dev,
574                               struct list_head *head)
575 {
576         struct virt_wifi_netdev_priv *priv = netdev_priv(dev);
577
578         if (dev->ieee80211_ptr)
579                 virt_wifi_cancel_scan(dev->ieee80211_ptr->wiphy);
580
581         priv->being_deleted = true;
582         virt_wifi_cancel_connect(dev);
583         netif_carrier_off(dev);
584
585         netdev_rx_handler_unregister(priv->lowerdev);
586         netdev_upper_dev_unlink(priv->lowerdev, dev);
587
588         unregister_netdevice_queue(dev, head);
589
590         /* Deleting the wiphy is handled in the module destructor. */
591 }
592
593 static struct rtnl_link_ops virt_wifi_link_ops = {
594         .kind           = "virt_wifi",
595         .setup          = virt_wifi_setup,
596         .newlink        = virt_wifi_newlink,
597         .dellink        = virt_wifi_dellink,
598         .priv_size      = sizeof(struct virt_wifi_netdev_priv),
599 };
600
601 /* Acquires and releases the rtnl lock. */
602 static int __init virt_wifi_init_module(void)
603 {
604         int err;
605
606         /* Guaranteed to be locallly-administered and not multicast. */
607         eth_random_addr(fake_router_bssid);
608
609         common_wiphy = virt_wifi_make_wiphy();
610         if (!common_wiphy)
611                 return -ENOMEM;
612
613         err = rtnl_link_register(&virt_wifi_link_ops);
614         if (err)
615                 virt_wifi_destroy_wiphy(common_wiphy);
616
617         return err;
618 }
619
620 /* Acquires and releases the rtnl lock. */
621 static void __exit virt_wifi_cleanup_module(void)
622 {
623         /* Will delete any devices that depend on the wiphy. */
624         rtnl_link_unregister(&virt_wifi_link_ops);
625         virt_wifi_destroy_wiphy(common_wiphy);
626 }
627
628 module_init(virt_wifi_init_module);
629 module_exit(virt_wifi_cleanup_module);
630
631 MODULE_LICENSE("GPL v2");
632 MODULE_AUTHOR("Cody Schuffelen <schuffelen@google.com>");
633 MODULE_DESCRIPTION("Driver for a wireless wrapper of ethernet devices");
634 MODULE_ALIAS_RTNL_LINK("virt_wifi");