blob: b0792f78ac9637dcba46df9ba3f9a18a49b3320e [file] [log] [blame]
Karl Reltoncb3126e2010-06-03 23:04:06 +01001/* cfg80211 Interface for prism2_usb module */
2
3
4/* Prism2 channell/frequency/bitrate declarations */
5static const struct ieee80211_channel prism2_channels[] = {
6 { .center_freq = 2412 },
7 { .center_freq = 2417 },
8 { .center_freq = 2422 },
9 { .center_freq = 2427 },
10 { .center_freq = 2432 },
11 { .center_freq = 2437 },
12 { .center_freq = 2442 },
13 { .center_freq = 2447 },
14 { .center_freq = 2452 },
15 { .center_freq = 2457 },
16 { .center_freq = 2462 },
17 { .center_freq = 2467 },
18 { .center_freq = 2472 },
19 { .center_freq = 2484 },
20};
21
22static const struct ieee80211_rate prism2_rates[] = {
23 { .bitrate = 10 },
24 { .bitrate = 20 },
25 { .bitrate = 55 },
26 { .bitrate = 110 }
27};
28
29#define PRISM2_NUM_CIPHER_SUITES 2
30static const u32 prism2_cipher_suites[PRISM2_NUM_CIPHER_SUITES] = {
31 WLAN_CIPHER_SUITE_WEP40,
32 WLAN_CIPHER_SUITE_WEP104
33};
34
35
36/* prism2 device private data */
37struct prism2_wiphy_private {
38 wlandevice_t *wlandev;
39
40 struct ieee80211_supported_band band;
41 struct ieee80211_channel channels[ARRAY_SIZE(prism2_channels)];
42 struct ieee80211_rate rates[ARRAY_SIZE(prism2_rates)];
43
44 struct cfg80211_scan_request *scan_request;
45};
46
47static const void * const prism2_wiphy_privid = &prism2_wiphy_privid;
48
49
50/* Helper Functions */
51static int prism2_result2err(int prism2_result)
52{
53 int err = 0;
54
55 switch (prism2_result) {
56 case P80211ENUM_resultcode_invalid_parameters:
57 err = -EINVAL;
58 break;
59 case P80211ENUM_resultcode_implementation_failure:
60 err = -EIO;
61 break;
62 case P80211ENUM_resultcode_not_supported:
63 err = -EOPNOTSUPP;
64 break;
65 default:
66 err = 0;
67 break;
68 }
69
70 return err;
71}
72
73static int prism2_domibset_uint32(wlandevice_t *wlandev, u32 did, u32 data)
74{
75 p80211msg_dot11req_mibset_t msg;
76 p80211item_uint32_t *mibitem = (p80211item_uint32_t *) &msg.mibattribute.data;
77
78 msg.msgcode = DIDmsg_dot11req_mibset;
79 mibitem->did = did;
80 mibitem->data = data;
81
82 return p80211req_dorequest(wlandev, (u8 *) & msg);
83}
84
85static int prism2_domibset_pstr32(wlandevice_t *wlandev,
86 u32 did, u8 len, u8 *data)
87{
88 p80211msg_dot11req_mibset_t msg;
89 p80211item_pstr32_t *mibitem = (p80211item_pstr32_t *) &msg.mibattribute.data;
90
91 msg.msgcode = DIDmsg_dot11req_mibset;
92 mibitem->did = did;
93 mibitem->data.len = len;
94 memcpy(mibitem->data.data, data, len);
95
96 return p80211req_dorequest(wlandev, (u8 *) & msg);
97}
98
99
100/* The interface functions, called by the cfg80211 layer */
101int prism2_change_virtual_intf(struct wiphy *wiphy,
102 struct net_device *dev,
103 enum nl80211_iftype type, u32 *flags,
104 struct vif_params *params)
105{
106 wlandevice_t *wlandev = dev->ml_priv;
107 u32 data;
108 int result;
109 int err = 0;
110
111 switch (type) {
112 case NL80211_IFTYPE_ADHOC:
113 if (wlandev->macmode == WLAN_MACMODE_IBSS_STA) goto exit;
114 wlandev->macmode = WLAN_MACMODE_IBSS_STA;
115 data = 0;
116 break;
117 case NL80211_IFTYPE_STATION:
118 if (wlandev->macmode == WLAN_MACMODE_ESS_STA) goto exit;
119 wlandev->macmode = WLAN_MACMODE_ESS_STA;
120 data = 1;
121 break;
122 default:
123 printk(KERN_WARNING "Operation mode: %d not support\n", type);
124 return -EOPNOTSUPP;
125 }
126
127 /* Set Operation mode to the PORT TYPE RID */
128 result = prism2_domibset_uint32(wlandev, DIDmib_p2_p2Static_p2CnfPortType, data);
129
130 if (result)
131 err = -EFAULT;
132
133 dev->ieee80211_ptr->iftype = type;
134
135exit:
136 return err;
137}
138
139int prism2_add_key(struct wiphy *wiphy, struct net_device *dev,
140 u8 key_index, const u8 *mac_addr,
141 struct key_params *params) {
142 wlandevice_t *wlandev = dev->ml_priv;
143 u32 did;
144
145 int err = 0;
146 int result = 0;
147
148 switch (params->cipher) {
149 case WLAN_CIPHER_SUITE_WEP40:
150 case WLAN_CIPHER_SUITE_WEP104:
151 result = prism2_domibset_uint32(wlandev,
152 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
153 key_index);
154 if (result) goto exit;
155
156 /* send key to driver */
157 switch (key_index) {
158 case 0:
159 did =
160 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0;
161 break;
162
163 case 1:
164 did =
165 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1;
166 break;
167
168 case 2:
169 did =
170 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2;
171 break;
172
173 case 3:
174 did =
175 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3;
176 break;
177
178 default:
179 err = -EINVAL;
180 goto exit;
181 }
182
183 result = prism2_domibset_pstr32(wlandev, did, params->key_len, params->key);
184 if (result) goto exit;
185 break;
186
187 default:
188 pr_debug("Unsupported cipher suite\n");
189 result = 1;
190 }
191
192exit:
193 if (result) err = -EFAULT;
194
195 return err;
196}
197
198int prism2_get_key(struct wiphy *wiphy, struct net_device *dev,
199 u8 key_index, const u8 *mac_addr, void *cookie,
200 void (*callback)(void *cookie, struct key_params*)) {
201 wlandevice_t *wlandev = dev->ml_priv;
202 struct key_params params;
203 int len;
204
205 if(key_index >= NUM_WEPKEYS) return -EINVAL;
206
207 len = wlandev->wep_keylens[key_index];
208 memset(&params, 0, sizeof(params));
209
210 if (len == 13) {
211 params.cipher = WLAN_CIPHER_SUITE_WEP104;
212 } else if (len == 5) {
213 params.cipher = WLAN_CIPHER_SUITE_WEP104;
214 } else return -ENOENT;
215 params.key_len = len;
216 params.key = wlandev->wep_keys[key_index];
217
218 callback(cookie, &params);
219 return 0;
220}
221
222int prism2_del_key(struct wiphy *wiphy, struct net_device *dev,
223 u8 key_index, const u8 *mac_addr) {
224 wlandevice_t *wlandev = dev->ml_priv;
225 u32 did;
226 int err = 0;
227 int result = 0;
228
229 /* There is no direct way in the hardware (AFAIK) of removing
230 a key, so we will cheat by setting the key to a bogus value */
231 /* send key to driver */
232 switch (key_index) {
233 case 0:
234 did =
235 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0;
236 break;
237
238 case 1:
239 did =
240 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1;
241 break;
242
243 case 2:
244 did =
245 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2;
246 break;
247
248 case 3:
249 did =
250 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3;
251 break;
252
253 default:
254 err = -EINVAL;
255 goto exit;
256 }
257
258 result = prism2_domibset_pstr32(wlandev, did, 13, "0000000000000");
259
260exit:
261 if (result) err = -EFAULT;
262
263 return err;
264}
265
266int prism2_set_default_key(struct wiphy *wiphy, struct net_device *dev,
267 u8 key_index) {
268 wlandevice_t *wlandev = dev->ml_priv;
269
270 int err = 0;
271 int result = 0;
272
273 result = prism2_domibset_uint32(wlandev,
274 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
275 key_index);
276
277 if (result) err = -EFAULT;
278
279 return err;
280}
281
282
283int prism2_get_station(struct wiphy *wiphy, struct net_device *dev,
284 u8 *mac, struct station_info *sinfo) {
285 wlandevice_t *wlandev = dev->ml_priv;
286 p80211msg_lnxreq_commsquality_t quality;
287 int result;
288
289 memset(sinfo, 0, sizeof(*sinfo));
290
291 if ((wlandev == NULL) || (wlandev->msdstate != WLAN_MSD_RUNNING))
292 return -EOPNOTSUPP;
293
294 /* build request message */
295 quality.msgcode = DIDmsg_lnxreq_commsquality;
296 quality.dbm.data = P80211ENUM_truth_true;
297 quality.dbm.status = P80211ENUM_msgitem_status_data_ok;
298
299 /* send message to nsd */
300 if (wlandev->mlmerequest == NULL)
301 return -EOPNOTSUPP;
302
303 result = wlandev->mlmerequest(wlandev, (p80211msg_t *) & quality);
304
305
306 if (result == 0) {
307 sinfo->txrate.legacy = quality.txrate.data;
308 sinfo->filled |= STATION_INFO_TX_BITRATE;
309 sinfo->signal = quality.level.data;
310 sinfo->filled |= STATION_INFO_SIGNAL;
311 }
312
313 return result;
314}
315
316int prism2_scan(struct wiphy *wiphy, struct net_device *dev,
317 struct cfg80211_scan_request *request)
318{
319 struct prism2_wiphy_private *priv = wiphy_priv(wiphy);
320 wlandevice_t *wlandev = dev->ml_priv;
321 p80211msg_dot11req_scan_t msg1;
322 p80211msg_dot11req_scan_results_t msg2;
323 int result;
324 int err = 0;
325 int numbss = 0;
326 int i = 0;
327 u8 ie_buf[46];
328 int ie_len;
329
330 if (!request)
331 return -EINVAL;
332
333 if (priv->scan_request && priv->scan_request != request)
334 return -EBUSY;
335
336 if (wlandev->macmode == WLAN_MACMODE_ESS_AP) {
337 printk(KERN_ERR "Can't scan in AP mode\n");
338 return -EOPNOTSUPP;
339 }
340
341 priv->scan_request = request;
342
343 memset(&msg1, 0x00, sizeof(p80211msg_dot11req_scan_t));
344 msg1.msgcode = DIDmsg_dot11req_scan;
345 msg1.bsstype.data = P80211ENUM_bsstype_any;
346
347 memset(&(msg1.bssid.data), 0xFF, sizeof(p80211item_pstr6_t));
348 msg1.bssid.data.len = 6;
349
350 if (request->n_ssids > 0) {
351 msg1.scantype.data = P80211ENUM_scantype_active;
352 msg1.ssid.data.len = request->ssids->ssid_len;
353 memcpy(msg1.ssid.data.data, request->ssids->ssid, request->ssids->ssid_len);
354 } else {
355 msg1.scantype.data = 0;
356 }
357 msg1.probedelay.data = 0;
358
359 for (i = 0;
360 (i < request->n_channels) && i < ARRAY_SIZE(prism2_channels);
361 i++)
362 msg1.channellist.data.data[i] =
363 ieee80211_frequency_to_channel(request->channels[i]->center_freq);
364 msg1.channellist.data.len = request->n_channels;
365
366 msg1.maxchanneltime.data = 250;
367 msg1.minchanneltime.data = 200;
368
369 result = p80211req_dorequest(wlandev, (u8 *) &msg1);
370 if (result) {
371 err = prism2_result2err(msg1.resultcode.data);
372 goto exit;
373 }
374 /* Now retrieve scan results */
375 numbss = msg1.numbss.data;
376
377 for (i = 0; i < numbss; i++) {
378 memset(&msg2, 0, sizeof(msg2));
379 msg2.msgcode = DIDmsg_dot11req_scan_results;
380 msg2.bssindex.data = i;
381
382 result = p80211req_dorequest(wlandev, (u8 *) &msg2);
383 if ((result != 0) ||
384 (msg2.resultcode.data != P80211ENUM_resultcode_success)) {
385 break;
386 }
387
388 ie_buf[0] = WLAN_EID_SSID;
389 ie_buf[1] = msg2.ssid.data.len;
390 ie_len = ie_buf[1] + 2;
391 memcpy(&ie_buf[2], &(msg2.ssid.data.data), msg2.ssid.data.len);
392 cfg80211_inform_bss(wiphy,
393 ieee80211_get_channel(wiphy, ieee80211_dsss_chan_to_freq(msg2.dschannel.data)),
394 (const u8 *) &(msg2.bssid.data.data),
395 msg2.timestamp.data, msg2.capinfo.data,
396 msg2.beaconperiod.data,
397 ie_buf,
398 ie_len,
399 (msg2.signal.data - 65536) * 100, /* Conversion to signed type */
400 GFP_KERNEL
401 );
402 }
403
404 if (result) {
405 err = prism2_result2err(msg2.resultcode.data);
406 }
407
408exit:
409 cfg80211_scan_done(request, err ? 1 : 0);
410 priv->scan_request = NULL;
411 return err;
412}
413
414int prism2_set_wiphy_params(struct wiphy *wiphy, u32 changed) {
415 struct prism2_wiphy_private *priv = wiphy_priv(wiphy);
416 wlandevice_t *wlandev = priv->wlandev;
417 u32 data;
418 int result;
419 int err = 0;
420
421 if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
422 if (wiphy->rts_threshold == -1)
423 data = 2347;
424 else
425 data = wiphy->rts_threshold;
426
427 result =
428 prism2_domibset_uint32(wlandev,
429 DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold,
430 data);
431 if (result) {
432 err = -EFAULT;
433 goto exit;
434 }
435 }
436
437 if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
438
439 if (wiphy->frag_threshold == -1)
440 data = 2346;
441 else
442 data = wiphy->frag_threshold;
443
444 result =
445 prism2_domibset_uint32(wlandev,
446 DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold,
447 data);
448 if (result) {
449 err = -EFAULT;
450 goto exit;
451 }
452 }
453
454exit:
455 return err;
456}
457
458int prism2_connect(struct wiphy *wiphy, struct net_device *dev,
459 struct cfg80211_connect_params *sme) {
460 wlandevice_t *wlandev = dev->ml_priv;
461 struct ieee80211_channel *channel = sme->channel;
462 p80211msg_lnxreq_autojoin_t msg_join;
463 u32 did;
464 int length = sme->ssid_len;
465 int chan = -1;
466 int is_wep = (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP40) ||
467 (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104);
468 int result;
469 int err = 0;
470
471 /* Set the channel */
472 if (channel) {
473 chan = ieee80211_frequency_to_channel(channel->center_freq);
474
475 result =
476 prism2_domibset_uint32(wlandev,
477 DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel,
478 chan);
479
480 if (result) goto exit;
481 }
482
483 /* Set the authorisation */
484 if ((sme->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) ||
485 ((sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC) && !is_wep))
486 msg_join.authtype.data = P80211ENUM_authalg_opensystem;
487 else if ((sme->auth_type == NL80211_AUTHTYPE_SHARED_KEY) ||
488 ((sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC) && is_wep))
489 msg_join.authtype.data = P80211ENUM_authalg_sharedkey;
490 else printk(KERN_WARNING "Unhandled authorisation type for connect (%d)\n", sme->auth_type);
491
492 /* Set the encryption - we only support wep */
493 if (is_wep) {
494
495 if (sme->key) {
496 result = prism2_domibset_uint32(wlandev,
497 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
498 sme->key_idx);
499 if (result) goto exit;
500
501 /* send key to driver */
502 switch (sme->key_idx) {
503 case 0:
504 did =
505 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0;
506 break;
507
508 case 1:
509 did =
510 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1;
511 break;
512
513 case 2:
514 did =
515 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2;
516 break;
517
518 case 3:
519 did =
520 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3;
521 break;
522
523 default:
524 err = -EINVAL;
525 goto exit;
526 }
527
528 result = prism2_domibset_pstr32(wlandev, did, sme->key_len, (u8 *) sme->key);
529 if (result) goto exit;
530
531 }
532
533 /* Assume we should set privacy invoked and exclude unencrypted
534 We could possibly use sme->privacy here, but the assumption
535 seems reasonable anyway */
536 result = prism2_domibset_uint32(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
537 P80211ENUM_truth_true);
538 if (result) goto exit;
539 result = prism2_domibset_uint32(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted,
540 P80211ENUM_truth_true);
541 if (result) goto exit;
542
543 } else {
544 /* Assume we should unset privacy invoked and exclude unencrypted */
545 result = prism2_domibset_uint32(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
546 P80211ENUM_truth_false);
547 if (result) goto exit;
548 result = prism2_domibset_uint32(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted,
549 P80211ENUM_truth_false);
550 if (result) goto exit;
551
552 }
553
554 /* Now do the actual join. Note there is no way that I can
555 see to request a specific bssid */
556 msg_join.msgcode = DIDmsg_lnxreq_autojoin;
557
558 memcpy(msg_join.ssid.data.data, sme->ssid, length);
559 msg_join.ssid.data.len = length;
560
561 result = p80211req_dorequest(wlandev, (u8 *) & msg_join);
562
563exit:
564 if (result) err = -EFAULT;
565
566 return err;
567}
568
569int prism2_disconnect(struct wiphy *wiphy, struct net_device *dev,
570 u16 reason_code) {
571 wlandevice_t *wlandev = dev->ml_priv;
572 p80211msg_lnxreq_autojoin_t msg_join;
573 int result;
574 int err = 0;
575
576
577 /* Do a join, with a bogus ssid. Thats the only way I can think of */
578 msg_join.msgcode = DIDmsg_lnxreq_autojoin;
579
580 memcpy(msg_join.ssid.data.data, "---", 3);
581 msg_join.ssid.data.len = 3;
582
583 result = p80211req_dorequest(wlandev, (u8 *) & msg_join);
584
585 if (result) err = -EFAULT;
586
587 return err;
588}
589
590
591int prism2_join_ibss(struct wiphy *wiphy, struct net_device *dev,
592 struct cfg80211_ibss_params *params) {
593 return -EOPNOTSUPP;
594}
595
596int prism2_leave_ibss(struct wiphy *wiphy, struct net_device *dev) {
597 return -EOPNOTSUPP;
598}
599
600
601int prism2_set_tx_power(struct wiphy *wiphy,
602 enum tx_power_setting type, int dbm) {
603 struct prism2_wiphy_private *priv = wiphy_priv(wiphy);
604 wlandevice_t *wlandev = priv->wlandev;
605 u32 data;
606 int result;
607 int err = 0;
608
609 if (type == TX_POWER_AUTOMATIC)
610 data = 30;
611 else
612 data = dbm;
613
614 result = prism2_domibset_uint32(wlandev,
615 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel,
616 data);
617
618 if (result) {
619 err = -EFAULT;
620 goto exit;
621 }
622
623exit:
624 return err;
625}
626
627int prism2_get_tx_power(struct wiphy *wiphy, int *dbm) {
628 struct prism2_wiphy_private *priv = wiphy_priv(wiphy);
629 wlandevice_t *wlandev = priv->wlandev;
630 p80211msg_dot11req_mibget_t msg;
631 p80211item_uint32_t *mibitem = (p80211item_uint32_t *) &msg.mibattribute.data;
632 int result;
633 int err = 0;
634
635 msg.msgcode = DIDmsg_dot11req_mibget;
636 mibitem->did =
637 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel;
638
639 result = p80211req_dorequest(wlandev, (u8 *) & msg);
640
641 if (result) {
642 err = -EFAULT;
643 goto exit;
644 }
645
646 *dbm = mibitem->data;
647
648exit:
649 return err;
650}
651
652
653
654
655/* Interface callback functions, passing data back up to the cfg80211 layer */
656void prism2_connect_result(wlandevice_t *wlandev, u8 failed) {
657
658 cfg80211_connect_result(wlandev->netdev, wlandev->bssid,
659 NULL, 0, NULL, 0,
660 failed ? WLAN_STATUS_UNSPECIFIED_FAILURE : WLAN_STATUS_SUCCESS, GFP_KERNEL);
661}
662
663void prism2_disconnected(wlandevice_t *wlandev) {
664
665 cfg80211_disconnected(wlandev->netdev, 0, NULL,
666 0, GFP_KERNEL);
667}
668
669void prism2_roamed(wlandevice_t *wlandev) {
670
671 cfg80211_roamed(wlandev->netdev, wlandev->bssid,
672 NULL, 0, NULL, 0, GFP_KERNEL);
673}
674
675
676/* Structures for declaring wiphy interface */
677static const struct cfg80211_ops prism2_usb_cfg_ops = {
678 .change_virtual_intf = prism2_change_virtual_intf,
679 .add_key = prism2_add_key,
680 .get_key = prism2_get_key,
681 .del_key = prism2_del_key,
682 .set_default_key = prism2_set_default_key,
683 .get_station = prism2_get_station,
684 .scan = prism2_scan,
685 .set_wiphy_params = prism2_set_wiphy_params,
686 .connect = prism2_connect,
687 .disconnect = prism2_disconnect,
688 .join_ibss = prism2_join_ibss,
689 .leave_ibss = prism2_leave_ibss,
690 .set_tx_power = prism2_set_tx_power,
691 .get_tx_power = prism2_get_tx_power,
692};
693
694
695/* Functions to create/free wiphy interface */
696struct wiphy *wlan_create_wiphy(struct device *dev, wlandevice_t *wlandev)
697{
698 struct wiphy *wiphy;
699 struct prism2_wiphy_private *priv;
700 wiphy = wiphy_new(&prism2_usb_cfg_ops, sizeof(struct prism2_wiphy_private));
701 if (!wiphy)
702 return NULL;
703
704 priv = wiphy_priv(wiphy);
705 priv->wlandev = wlandev;
706 memcpy(priv->channels, prism2_channels, sizeof(prism2_channels));
707 memcpy(priv->rates, prism2_rates, sizeof(prism2_rates));
708 priv->band.channels = priv->channels;
709 priv->band.n_channels = ARRAY_SIZE(prism2_channels);
710 priv->band.bitrates = priv->rates;
711 priv->band.n_bitrates = ARRAY_SIZE(prism2_rates);
712 wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
713
714 set_wiphy_dev(wiphy, dev);
715 wiphy->privid = prism2_wiphy_privid;
716 wiphy->max_scan_ssids = 1;
717 wiphy->interface_modes =
718 BIT(NL80211_IFTYPE_STATION) |
719 BIT(NL80211_IFTYPE_ADHOC);
720 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
721 wiphy->n_cipher_suites = PRISM2_NUM_CIPHER_SUITES;
722 wiphy->cipher_suites = prism2_cipher_suites;
723
724 if (wiphy_register(wiphy) < 0)
725 return NULL;
726
727 return wiphy;
728}
729
730
731void wlan_free_wiphy(struct wiphy *wiphy)
732{
733 wiphy_unregister(wiphy);
734 wiphy_free(wiphy);
735}