aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/wireless/orinoco/orinoco.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/orinoco/orinoco.c')
-rw-r--r--drivers/net/wireless/orinoco/orinoco.c63
1 files changed, 34 insertions, 29 deletions
diff --git a/drivers/net/wireless/orinoco/orinoco.c b/drivers/net/wireless/orinoco/orinoco.c
index 45a04faa781..6514e4611b9 100644
--- a/drivers/net/wireless/orinoco/orinoco.c
+++ b/drivers/net/wireless/orinoco/orinoco.c
@@ -178,12 +178,7 @@ static const struct ethtool_ops orinoco_ethtool_ops;
/* Data tables */
/********************************************************************/
-/* The frequency of each channel in MHz */
-static const long channel_frequency[] = {
- 2412, 2417, 2422, 2427, 2432, 2437, 2442,
- 2447, 2452, 2457, 2462, 2467, 2472, 2484
-};
-#define NUM_CHANNELS ARRAY_SIZE(channel_frequency)
+#define NUM_CHANNELS 14
/* This tables gives the actual meanings of the bitrate IDs returned
* by the firmware. */
@@ -240,6 +235,12 @@ struct hermes_rx_descriptor {
__le16 data_len;
} __attribute__ ((packed));
+struct orinoco_rx_data {
+ struct hermes_rx_descriptor *desc;
+ struct sk_buff *skb;
+ struct list_head list;
+};
+
/********************************************************************/
/* Function prototypes */
/********************************************************************/
@@ -3582,6 +3583,17 @@ static int orinoco_init(struct net_device *dev)
return err;
}
+static const struct net_device_ops orinoco_netdev_ops = {
+ .ndo_init = orinoco_init,
+ .ndo_open = orinoco_open,
+ .ndo_stop = orinoco_stop,
+ .ndo_start_xmit = orinoco_xmit,
+ .ndo_set_multicast_list = orinoco_set_multicast_list,
+ .ndo_change_mtu = orinoco_change_mtu,
+ .ndo_tx_timeout = orinoco_tx_timeout,
+ .ndo_get_stats = orinoco_get_stats,
+};
+
struct net_device
*alloc_orinocodev(int sizeof_card,
struct device *device,
@@ -3592,7 +3604,7 @@ struct net_device
struct orinoco_private *priv;
dev = alloc_etherdev(sizeof(struct orinoco_private) + sizeof_card);
- if (! dev)
+ if (!dev)
return NULL;
priv = netdev_priv(dev);
priv->ndev = dev;
@@ -3604,27 +3616,20 @@ struct net_device
priv->dev = device;
/* Setup / override net_device fields */
- dev->init = orinoco_init;
- dev->hard_start_xmit = orinoco_xmit;
- dev->tx_timeout = orinoco_tx_timeout;
+ dev->netdev_ops = &orinoco_netdev_ops;
dev->watchdog_timeo = HZ; /* 1 second timeout */
- dev->get_stats = orinoco_get_stats;
dev->ethtool_ops = &orinoco_ethtool_ops;
- dev->wireless_handlers = (struct iw_handler_def *)&orinoco_handler_def;
+ dev->wireless_handlers = &orinoco_handler_def;
#ifdef WIRELESS_SPY
priv->wireless_data.spy_data = &priv->spy_data;
dev->wireless_data = &priv->wireless_data;
#endif
- dev->change_mtu = orinoco_change_mtu;
- dev->set_multicast_list = orinoco_set_multicast_list;
/* we use the default eth_mac_addr for setting the MAC addr */
/* Reserve space in skb for the SNAP header */
dev->hard_header_len += ENCAPS_OVERHEAD;
/* Set up default callbacks */
- dev->open = orinoco_open;
- dev->stop = orinoco_stop;
priv->hard_reset = hard_reset;
priv->stop_fw = stop_fw;
@@ -3742,13 +3747,13 @@ static int orinoco_hw_get_essid(struct orinoco_private *priv, int *active,
return err;
}
-static long orinoco_hw_get_freq(struct orinoco_private *priv)
+static int orinoco_hw_get_freq(struct orinoco_private *priv)
{
hermes_t *hw = &priv->hw;
int err = 0;
u16 channel;
- long freq = 0;
+ int freq = 0;
unsigned long flags;
if (orinoco_lock(priv, &flags) != 0)
@@ -3771,7 +3776,7 @@ static long orinoco_hw_get_freq(struct orinoco_private *priv)
goto out;
}
- freq = channel_frequency[channel-1] * 100000;
+ freq = ieee80211_dsss_chan_to_freq(channel);
out:
orinoco_unlock(priv, &flags);
@@ -3998,7 +4003,8 @@ static int orinoco_ioctl_getiwrange(struct net_device *dev,
for (i = 0; i < NUM_CHANNELS; i++) {
if (priv->channel_mask & (1 << i)) {
range->freq[k].i = i + 1;
- range->freq[k].m = channel_frequency[i] * 100000;
+ range->freq[k].m = (ieee80211_dsss_chan_to_freq(i + 1) *
+ 100000);
range->freq[k].e = 1;
k++;
}
@@ -4346,16 +4352,15 @@ static int orinoco_ioctl_setfreq(struct net_device *dev,
/* Setting by channel number */
chan = frq->m;
} else {
- /* Setting by frequency - search the table */
- int mult = 1;
+ /* Setting by frequency */
+ int denom = 1;
int i;
+ /* Calculate denominator to rescale to MHz */
for (i = 0; i < (6 - frq->e); i++)
- mult *= 10;
+ denom *= 10;
- for (i = 0; i < NUM_CHANNELS; i++)
- if (frq->m == (channel_frequency[i] * mult))
- chan = i+1;
+ chan = ieee80211_freq_to_dsss_chan(frq->m / denom);
}
if ( (chan < 1) || (chan > NUM_CHANNELS) ||
@@ -4392,7 +4397,7 @@ static int orinoco_ioctl_getfreq(struct net_device *dev,
return tmp;
}
- frq->m = tmp;
+ frq->m = tmp * 100000;
frq->e = 1;
return 0;
@@ -5609,7 +5614,7 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
&iwe, IW_EV_FREQ_LEN);
- iwe.u.freq.m = channel_frequency[channel-1] * 100000;
+ iwe.u.freq.m = ieee80211_dsss_chan_to_freq(channel) * 100000;
iwe.u.freq.e = 1;
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
&iwe, IW_EV_FREQ_LEN);
@@ -5760,7 +5765,7 @@ static inline char *orinoco_translate_ext_scan(struct net_device *dev,
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
&iwe, IW_EV_FREQ_LEN);
- iwe.u.freq.m = channel_frequency[channel-1] * 100000;
+ iwe.u.freq.m = ieee80211_dsss_chan_to_freq(channel) * 100000;
iwe.u.freq.e = 1;
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
&iwe, IW_EV_FREQ_LEN);