]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - drivers/net/wireless/orinoco/cfg.c
orinoco: provide generic commit function
[mirror_ubuntu-hirsute-kernel.git] / drivers / net / wireless / orinoco / cfg.c
CommitLineData
ea60a6aa
DK
1/* cfg80211 support
2 *
3 * See copyright notice in main.c
4 */
5#include <linux/ieee80211.h>
6#include <net/cfg80211.h>
7#include "hw.h"
8#include "main.h"
9#include "orinoco.h"
10
11#include "cfg.h"
12
13/* Supported bitrates. Must agree with hw.c */
14static struct ieee80211_rate orinoco_rates[] = {
15 { .bitrate = 10 },
16 { .bitrate = 20 },
17 { .bitrate = 55 },
18 { .bitrate = 110 },
19};
20
21static const void * const orinoco_wiphy_privid = &orinoco_wiphy_privid;
22
23/* Called after orinoco_private is allocated. */
24void orinoco_wiphy_init(struct wiphy *wiphy)
25{
26 struct orinoco_private *priv = wiphy_priv(wiphy);
27
28 wiphy->privid = orinoco_wiphy_privid;
29
30 set_wiphy_dev(wiphy, priv->dev);
31}
32
33/* Called after firmware is initialised */
34int orinoco_wiphy_register(struct wiphy *wiphy)
35{
36 struct orinoco_private *priv = wiphy_priv(wiphy);
37 int i, channels = 0;
38
39 if (priv->firmware_type == FIRMWARE_TYPE_AGERE)
40 wiphy->max_scan_ssids = 1;
41 else
42 wiphy->max_scan_ssids = 0;
43
44 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
45
46 /* TODO: should we set if we only have demo ad-hoc?
47 * (priv->has_port3)
48 */
49 if (priv->has_ibss)
50 wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
51
52 if (!priv->broken_monitor || force_monitor)
53 wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
54
55 priv->band.bitrates = orinoco_rates;
56 priv->band.n_bitrates = ARRAY_SIZE(orinoco_rates);
57
58 /* Only support channels allowed by the card EEPROM */
59 for (i = 0; i < NUM_CHANNELS; i++) {
60 if (priv->channel_mask & (1 << i)) {
61 priv->channels[i].center_freq =
62 ieee80211_dsss_chan_to_freq(i+1);
63 channels++;
64 }
65 }
66 priv->band.channels = priv->channels;
67 priv->band.n_channels = channels;
68
69 wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
70 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
71
72 i = 0;
73 if (priv->has_wep) {
74 priv->cipher_suites[i] = WLAN_CIPHER_SUITE_WEP40;
75 i++;
76
77 if (priv->has_big_wep) {
78 priv->cipher_suites[i] = WLAN_CIPHER_SUITE_WEP104;
79 i++;
80 }
81 }
82 if (priv->has_wpa) {
83 priv->cipher_suites[i] = WLAN_CIPHER_SUITE_TKIP;
84 i++;
85 }
86 wiphy->cipher_suites = priv->cipher_suites;
87 wiphy->n_cipher_suites = i;
88
89 wiphy->rts_threshold = priv->rts_thresh;
90 if (!priv->has_mwo)
91 wiphy->frag_threshold = priv->frag_thresh;
92
93 return wiphy_register(wiphy);
94}
95
96const struct cfg80211_ops orinoco_cfg_ops = {
97
98};