Commit ea60a6aa authored by David Kilroy's avatar David Kilroy Committed by John W. Linville

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: default avatarDavid Kilroy <kilroyd@googlemail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 98e5f404
config HERMES
tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)"
depends on (PPC_PMAC || PCI || PCMCIA) && WLAN_80211
depends on CFG80211
select WIRELESS_EXT
select FW_LOADER
select CRYPTO
......
#
# Makefile for the orinoco wireless device drivers.
#
orinoco-objs := main.o fw.o hw.o mic.o scan.o wext.o hermes_dld.o hermes.o
orinoco-objs := main.o fw.o hw.o mic.o scan.o wext.o hermes_dld.o hermes.o cfg.o
obj-$(CONFIG_HERMES) += orinoco.o
obj-$(CONFIG_PCMCIA_HERMES) += orinoco_cs.o
......
/* cfg80211 support
*
* See copyright notice in main.c
*/
#include <linux/ieee80211.h>
#include <net/cfg80211.h>
#include "hw.h"
#include "main.h"
#include "orinoco.h"
#include "cfg.h"
/* Supported bitrates. Must agree with hw.c */
static struct ieee80211_rate orinoco_rates[] = {
{ .bitrate = 10 },
{ .bitrate = 20 },
{ .bitrate = 55 },
{ .bitrate = 110 },
};
static const void * const orinoco_wiphy_privid = &orinoco_wiphy_privid;
/* Called after orinoco_private is allocated. */
void orinoco_wiphy_init(struct wiphy *wiphy)
{
struct orinoco_private *priv = wiphy_priv(wiphy);
wiphy->privid = orinoco_wiphy_privid;
set_wiphy_dev(wiphy, priv->dev);
}
/* Called after firmware is initialised */
int orinoco_wiphy_register(struct wiphy *wiphy)
{
struct orinoco_private *priv = wiphy_priv(wiphy);
int i, channels = 0;
if (priv->firmware_type == FIRMWARE_TYPE_AGERE)
wiphy->max_scan_ssids = 1;
else
wiphy->max_scan_ssids = 0;
wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
/* TODO: should we set if we only have demo ad-hoc?
* (priv->has_port3)
*/
if (priv->has_ibss)
wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
if (!priv->broken_monitor || force_monitor)
wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
priv->band.bitrates = orinoco_rates;
priv->band.n_bitrates = ARRAY_SIZE(orinoco_rates);
/* Only support channels allowed by the card EEPROM */
for (i = 0; i < NUM_CHANNELS; i++) {
if (priv->channel_mask & (1 << i)) {
priv->channels[i].center_freq =
ieee80211_dsss_chan_to_freq(i+1);
channels++;
}
}
priv->band.channels = priv->channels;
priv->band.n_channels = channels;
wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
i = 0;
if (priv->has_wep) {
priv->cipher_suites[i] = WLAN_CIPHER_SUITE_WEP40;
i++;
if (priv->has_big_wep) {
priv->cipher_suites[i] = WLAN_CIPHER_SUITE_WEP104;
i++;
}
}
if (priv->has_wpa) {
priv->cipher_suites[i] = WLAN_CIPHER_SUITE_TKIP;
i++;
}
wiphy->cipher_suites = priv->cipher_suites;
wiphy->n_cipher_suites = i;
wiphy->rts_threshold = priv->rts_thresh;
if (!priv->has_mwo)
wiphy->frag_threshold = priv->frag_thresh;
return wiphy_register(wiphy);
}
const struct cfg80211_ops orinoco_cfg_ops = {
};
/* cfg80211 support.
*
* See copyright notice in main.c
*/
#ifndef ORINOCO_CFG_H
#define ORINOCO_CFG_H
#include <net/cfg80211.h>
extern const struct cfg80211_ops orinoco_cfg_ops;
void orinoco_wiphy_init(struct wiphy *wiphy);
int orinoco_wiphy_register(struct wiphy *wiphy);
#endif /* ORINOCO_CFG_H */
This diff is collapsed.
......@@ -14,6 +14,7 @@
#include <linux/netdevice.h>
#include <linux/wireless.h>
#include <net/iw_handler.h>
#include <net/cfg80211.h>
#include "hermes.h"
......@@ -67,6 +68,10 @@ struct orinoco_private {
int (*hard_reset)(struct orinoco_private *);
int (*stop_fw)(struct orinoco_private *, int);
struct ieee80211_supported_band band;
struct ieee80211_channel channels[14];
u32 cipher_suites[3];
/* Synchronisation stuff */
spinlock_t lock;
int hw_unavailable;
......@@ -216,4 +221,10 @@ static inline void orinoco_unlock(struct orinoco_private *priv,
spin_unlock_irqrestore(&priv->lock, *flags);
}
/*** Navigate from net_device to orinoco_private ***/
static inline struct orinoco_private *ndev_priv(struct net_device *dev)
{
struct wireless_dev *wdev = netdev_priv(dev);
return wdev_priv(wdev);
}
#endif /* _ORINOCO_H */
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment