aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco/cfg.c
diff options
context:
space:
mode:
authorDavid Kilroy <kilroyd@googlemail.com>2009-06-18 18:21:26 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:01:44 -0400
commitea60a6aaf55984a13a7150568cc103d006e86ab2 (patch)
tree1c6b80d7d6a2129fe33591508ac125b65100fa09 /drivers/net/wireless/orinoco/cfg.c
parent98e5f404485d5d11b15e8351535a0e064a37647c (diff)
orinoco: initiate cfg80211 conversion
Initialise and register a wiphy. Store the orinoco_private structure in the new wiphy, and use the net_device private area to store the wireless_dev. This results in a change to the way we navigate from a net_device to the driver private orinoco_private, which we encapsulate in the inline function ndev_priv. Most of the remaining calls to netdev_priv are thus replaced by ndev_priv. We can immediately rely on cfg80211 to handle SIOCGIWNAME, so orinoco_ioctl_getname is removed. Signed-off-by: David Kilroy <kilroyd@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco/cfg.c')
-rw-r--r--drivers/net/wireless/orinoco/cfg.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c
new file mode 100644
index 000000000000..9a616ddac091
--- /dev/null
+++ b/drivers/net/wireless/orinoco/cfg.c
@@ -0,0 +1,98 @@
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};