summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/wext.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-08 20:04:36 +0000
committerDavid S. Miller <davem@davemloft.net>2008-01-28 15:06:19 -0800
commitaa21c004f80bdf943736c62dccf0c0398d7824f3 (patch)
tree6815328775d3b5ec46bb342c4c256cde0f223863 /drivers/net/wireless/libertas/wext.c
parentf86a93e1b2d05a7a38a48c91f8fb8fc7e8f1c734 (diff)
libertas: kill struct lbs_adapter
There seems to be no reason for a separate structure; move it all into struct lbs_private. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/wext.c')
-rw-r--r--drivers/net/wireless/libertas/wext.c372
1 files changed, 169 insertions, 203 deletions
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 1af140bbbcb..1e0b2245db5 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -23,7 +23,7 @@
static inline void lbs_postpone_association_work(struct lbs_private *priv)
{
- if (priv->adapter->surpriseremoved)
+ if (priv->surpriseremoved)
return;
cancel_delayed_work(&priv->assoc_work);
queue_delayed_work(priv->work_thread, &priv->assoc_work, HZ / 2);
@@ -32,21 +32,21 @@ static inline void lbs_postpone_association_work(struct lbs_private *priv)
static inline void lbs_cancel_association_work(struct lbs_private *priv)
{
cancel_delayed_work(&priv->assoc_work);
- kfree(priv->adapter->pending_assoc_req);
- priv->adapter->pending_assoc_req = NULL;
+ kfree(priv->pending_assoc_req);
+ priv->pending_assoc_req = NULL;
}
/**
* @brief Find the channel frequency power info with specific channel
*
- * @param adapter A pointer to struct lbs_adapter structure
+ * @param priv A pointer to struct lbs_private structure
* @param band it can be BAND_A, BAND_G or BAND_B
* @param channel the channel for looking
* @return A pointer to struct chan_freq_power structure or NULL if not find.
*/
struct chan_freq_power *lbs_find_cfp_by_band_and_channel(
- struct lbs_adapter *adapter,
+ struct lbs_private *priv,
u8 band,
u16 channel)
{
@@ -54,11 +54,11 @@ struct chan_freq_power *lbs_find_cfp_by_band_and_channel(
struct region_channel *rc;
int i, j;
- for (j = 0; !cfp && (j < ARRAY_SIZE(adapter->region_channel)); j++) {
- rc = &adapter->region_channel[j];
+ for (j = 0; !cfp && (j < ARRAY_SIZE(priv->region_channel)); j++) {
+ rc = &priv->region_channel[j];
- if (adapter->enable11d)
- rc = &adapter->universal_channel[j];
+ if (priv->enable11d)
+ rc = &priv->universal_channel[j];
if (!rc->valid || !rc->CFP)
continue;
if (rc->band != band)
@@ -81,13 +81,13 @@ struct chan_freq_power *lbs_find_cfp_by_band_and_channel(
/**
* @brief Find the channel frequency power info with specific frequency
*
- * @param adapter A pointer to struct lbs_adapter structure
+ * @param priv A pointer to struct lbs_private structure
* @param band it can be BAND_A, BAND_G or BAND_B
* @param freq the frequency for looking
* @return A pointer to struct chan_freq_power structure or NULL if not find.
*/
static struct chan_freq_power *find_cfp_by_band_and_freq(
- struct lbs_adapter *adapter,
+ struct lbs_private *priv,
u8 band,
u32 freq)
{
@@ -95,11 +95,11 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(
struct region_channel *rc;
int i, j;
- for (j = 0; !cfp && (j < ARRAY_SIZE(adapter->region_channel)); j++) {
- rc = &adapter->region_channel[j];
+ for (j = 0; !cfp && (j < ARRAY_SIZE(priv->region_channel)); j++) {
+ rc = &priv->region_channel[j];
- if (adapter->enable11d)
- rc = &adapter->universal_channel[j];
+ if (priv->enable11d)
+ rc = &priv->universal_channel[j];
if (!rc->valid || !rc->CFP)
continue;
if (rc->band != band)
@@ -130,13 +130,12 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(
static int lbs_radio_ioctl(struct lbs_private *priv, u8 option)
{
int ret = 0;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
- if (adapter->radioon != option) {
+ if (priv->radioon != option) {
lbs_deb_wext("switching radio %s\n", option ? "on" : "off");
- adapter->radioon = option;
+ priv->radioon = option;
ret = lbs_prepare_and_send_command(priv,
CMD_802_11_RADIO_CONTROL,
@@ -151,18 +150,18 @@ static int lbs_radio_ioctl(struct lbs_private *priv, u8 option)
/**
* @brief Copy active data rates based on adapter mode and status
*
- * @param adapter A pointer to struct lbs_adapter structure
+ * @param priv A pointer to struct lbs_private structure
* @param rate The buf to return the active rates
*/
-static void copy_active_data_rates(struct lbs_adapter *adapter, u8 *rates)
+static void copy_active_data_rates(struct lbs_private *priv, u8 *rates)
{
lbs_deb_enter(LBS_DEB_WEXT);
- if ((adapter->connect_status != LBS_CONNECTED) &&
- (adapter->mesh_connect_status != LBS_CONNECTED))
+ if ((priv->connect_status != LBS_CONNECTED) &&
+ (priv->mesh_connect_status != LBS_CONNECTED))
memcpy(rates, lbs_bg_rates, MAX_RATES);
else
- memcpy(rates, adapter->curbssparams.rates, MAX_RATES);
+ memcpy(rates, priv->curbssparams.rates, MAX_RATES);
lbs_deb_leave(LBS_DEB_WEXT);
}
@@ -184,18 +183,17 @@ static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info,
struct iw_freq *fwrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
struct chan_freq_power *cfp;
lbs_deb_enter(LBS_DEB_WEXT);
- cfp = lbs_find_cfp_by_band_and_channel(adapter, 0,
- adapter->curbssparams.channel);
+ cfp = lbs_find_cfp_by_band_and_channel(priv, 0,
+ priv->curbssparams.channel);
if (!cfp) {
- if (adapter->curbssparams.channel)
+ if (priv->curbssparams.channel)
lbs_deb_wext("invalid channel %d\n",
- adapter->curbssparams.channel);
+ priv->curbssparams.channel);
return -EINVAL;
}
@@ -211,12 +209,11 @@ static int lbs_get_wap(struct net_device *dev, struct iw_request_info *info,
struct sockaddr *awrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
- if (adapter->connect_status == LBS_CONNECTED) {
- memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN);
+ if (priv->connect_status == LBS_CONNECTED) {
+ memcpy(awrq->sa_data, priv->curbssparams.bssid, ETH_ALEN);
} else {
memset(awrq->sa_data, 0, ETH_ALEN);
}
@@ -230,7 +227,6 @@ static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info,
struct iw_point *dwrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
@@ -242,10 +238,10 @@ static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info,
return -E2BIG;
}
- mutex_lock(&adapter->lock);
- memset(adapter->nodename, 0, sizeof(adapter->nodename));
- memcpy(adapter->nodename, extra, dwrq->length);
- mutex_unlock(&adapter->lock);
+ mutex_lock(&priv->lock);
+ memset(priv->nodename, 0, sizeof(priv->nodename));
+ memcpy(priv->nodename, extra, dwrq->length);
+ mutex_unlock(&priv->lock);
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
@@ -255,12 +251,11 @@ static int lbs_get_nick(struct net_device *dev, struct iw_request_info *info,
struct iw_point *dwrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
- dwrq->length = strlen(adapter->nodename);
- memcpy(extra, adapter->nodename, dwrq->length);
+ dwrq->length = strlen(priv->nodename);
+ memcpy(extra, priv->nodename, dwrq->length);
extra[dwrq->length] = '\0';
dwrq->flags = 1; /* active */
@@ -273,13 +268,12 @@ static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info,
struct iw_point *dwrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
/* Use nickname to indicate that mesh is on */
- if (adapter->mesh_connect_status == LBS_CONNECTED) {
+ if (priv->mesh_connect_status == LBS_CONNECTED) {
strncpy(extra, "Mesh", 12);
extra[12] = '\0';
dwrq->length = strlen(extra);
@@ -299,17 +293,16 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info,
{
int ret = 0;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
u32 rthr = vwrq->value;
lbs_deb_enter(LBS_DEB_WEXT);
if (vwrq->disabled) {
- adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE;
+ priv->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE;
} else {
if (rthr < MRVDRV_RTS_MIN_VALUE || rthr > MRVDRV_RTS_MAX_VALUE)
return -EINVAL;
- adapter->rtsthsd = rthr;
+ priv->rtsthsd = rthr;
}
ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB,
@@ -325,18 +318,17 @@ static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info,
{
int ret = 0;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
- adapter->rtsthsd = 0;
+ priv->rtsthsd = 0;
ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB,
CMD_ACT_GET, CMD_OPTION_WAITFORRSP,
OID_802_11_RTS_THRESHOLD, NULL);
if (ret)
goto out;
- vwrq->value = adapter->rtsthsd;
+ vwrq->value = priv->rtsthsd;
vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE)
|| (vwrq->value > MRVDRV_RTS_MAX_VALUE));
vwrq->fixed = 1;
@@ -352,17 +344,16 @@ static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info,
int ret = 0;
u32 fthr = vwrq->value;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
if (vwrq->disabled) {
- adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE;
+ priv->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE;
} else {
if (fthr < MRVDRV_FRAG_MIN_VALUE
|| fthr > MRVDRV_FRAG_MAX_VALUE)
return -EINVAL;
- adapter->fragthsd = fthr;
+ priv->fragthsd = fthr;
}
ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB,
@@ -378,11 +369,10 @@ static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info,
{
int ret = 0;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
- adapter->fragthsd = 0;
+ priv->fragthsd = 0;
ret = lbs_prepare_and_send_command(priv,
CMD_802_11_SNMP_MIB,
CMD_ACT_GET, CMD_OPTION_WAITFORRSP,
@@ -390,7 +380,7 @@ static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info,
if (ret)
goto out;
- vwrq->value = adapter->fragthsd;
+ vwrq->value = priv->fragthsd;
vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE)
|| (vwrq->value > MRVDRV_FRAG_MAX_VALUE));
vwrq->fixed = 1;
@@ -404,11 +394,10 @@ static int lbs_get_mode(struct net_device *dev,
struct iw_request_info *info, u32 * uwrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
- *uwrq = adapter->mode;
+ *uwrq = priv->mode;
lbs_deb_leave(LBS_DEB_WEXT);
return 0;
@@ -432,7 +421,6 @@ static int lbs_get_txpow(struct net_device *dev,
{
int ret = 0;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
@@ -444,10 +432,10 @@ static int lbs_get_txpow(struct net_device *dev,
if (ret)
goto out;
- lbs_deb_wext("tx power level %d dbm\n", adapter->txpowerlevel);
- vwrq->value = adapter->txpowerlevel;
+ lbs_deb_wext("tx power level %d dbm\n", priv->txpowerlevel);
+ vwrq->value = priv->txpowerlevel;
vwrq->fixed = 1;
- if (adapter->radioon) {
+ if (priv->radioon) {
vwrq->disabled = 0;
vwrq->flags = IW_TXPOW_DBM;
} else {
@@ -464,7 +452,6 @@ static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info,
{
int ret = 0;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
@@ -477,7 +464,7 @@ static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info,
return -EINVAL;
/* Adding 1 to convert retry count to try count */
- adapter->txretrycount = vwrq->value + 1;
+ priv->txretrycount = vwrq->value + 1;
ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB,
CMD_ACT_SET,
@@ -499,12 +486,11 @@ static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info,
struct iw_param *vwrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
lbs_deb_enter(LBS_DEB_WEXT);
- adapter->txretrycount = 0;
+ priv->txretrycount = 0;
ret = lbs_prepare_and_send_command(priv,
CMD_802_11_SNMP_MIB,
CMD_ACT_GET, CMD_OPTION_WAITFORRSP,
@@ -516,7 +502,7 @@ static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info,
if (!vwrq->flags) {
vwrq->flags = IW_RETRY_LIMIT;
/* Subtract 1 to convert try count to retry count */
- vwrq->value = adapter->txretrycount - 1;
+ vwrq->value = priv->txretrycount - 1;
}
out:
@@ -568,7 +554,6 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
{
int i, j;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
struct iw_range *range = (struct iw_range *)extra;
struct chan_freq_power *cfp;
u8 rates[MAX_RATES + 1];
@@ -584,7 +569,7 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
range->max_nwid = 0;
memset(rates, 0, sizeof(rates));
- copy_active_data_rates(adapter, rates);
+ copy_active_data_rates(priv, rates);
range->num_bitrates = strnlen(rates, IW_MAX_BITRATES);
for (i = 0; i < range->num_bitrates; i++)
range->bitrate[i] = rates[i] * 500000;
@@ -593,14 +578,14 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
range->num_bitrates);
range->num_frequency = 0;
- if (priv->adapter->enable11d &&
- (adapter->connect_status == LBS_CONNECTED ||
- adapter->mesh_connect_status == LBS_CONNECTED)) {
+ if (priv->enable11d &&
+ (priv->connect_status == LBS_CONNECTED ||
+ priv->mesh_connect_status == LBS_CONNECTED)) {
u8 chan_no;
u8 band;
struct parsed_region_chan_11d *parsed_region_chan =
- &adapter->parsed_region_chan;
+ &priv->parsed_region_chan;
if (parsed_region_chan == NULL) {
lbs_deb_wext("11d: parsed_region_chan is NULL\n");
@@ -624,12 +609,12 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
}
if (!flag) {
for (j = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
- && (j < ARRAY_SIZE(adapter->region_channel)); j++) {
- cfp = adapter->region_channel[j].CFP;
+ && (j < ARRAY_SIZE(priv->region_channel)); j++) {
+ cfp = priv->region_channel[j].CFP;
for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
- && adapter->region_channel[j].valid
+ && priv->region_channel[j].valid
&& cfp
- && (i < adapter->region_channel[j].nrcfp); i++) {
+ && (i < priv->region_channel[j].nrcfp); i++) {
range->freq[range->num_frequency].i =
(long)cfp->channel;
range->freq[range->num_frequency].m =
@@ -729,7 +714,7 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
IW_EVENT_CAPA_MASK(SIOCGIWSCAN));
range->event_capa[1] = IW_EVENT_CAPA_K_1;
- if (adapter->fwcapinfo & FW_CAPINFO_WPA) {
+ if (priv->fwcapinfo & FW_CAPINFO_WPA) {
range->enc_capa = IW_ENC_CAPA_WPA
| IW_ENC_CAPA_WPA2
| IW_ENC_CAPA_CIPHER_TKIP
@@ -745,7 +730,6 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info,
struct iw_param *vwrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
@@ -754,8 +738,8 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info,
*/
if (vwrq->disabled) {
- adapter->psmode = LBS802_11POWERMODECAM;
- if (adapter->psstate != PS_STATE_FULL_POWER) {
+ priv->psmode = LBS802_11POWERMODECAM;
+ if (priv->psstate != PS_STATE_FULL_POWER) {
lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP);
}
@@ -771,13 +755,13 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info,
return -EINVAL;
}
- if (adapter->psmode != LBS802_11POWERMODECAM) {
+ if (priv->psmode != LBS802_11POWERMODECAM) {
return 0;
}
- adapter->psmode = LBS802_11POWERMODEMAX_PSP;
+ priv->psmode = LBS802_11POWERMODEMAX_PSP;
- if (adapter->connect_status == LBS_CONNECTED) {
+ if (priv->connect_status == LBS_CONNECTED) {
lbs_ps_sleep(priv, CMD_OPTION_WAITFORRSP);
}
@@ -789,15 +773,14 @@ static int lbs_get_power(struct net_device *dev, struct iw_request_info *info,
struct iw_param *vwrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
int mode;
lbs_deb_enter(LBS_DEB_WEXT);
- mode = adapter->psmode;
+ mode = priv->psmode;
if ((vwrq->disabled = (mode == LBS802_11POWERMODECAM))
- || adapter->connect_status == LBS_DISCONNECTED)
+ || priv->connect_status == LBS_DISCONNECTED)
{
goto out;
}
@@ -820,7 +803,6 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
PERFECT = 100
};
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
u32 rssi_qual;
u32 tx_qual;
u32 quality = 0;
@@ -830,23 +812,23 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
lbs_deb_enter(LBS_DEB_WEXT);
- priv->wstats.status = adapter->mode;
+ priv->wstats.status = priv->mode;
/* If we're not associated, all quality values are meaningless */
- if ((adapter->connect_status != LBS_CONNECTED) &&
- (adapter->mesh_connect_status != LBS_CONNECTED))
+ if ((priv->connect_status != LBS_CONNECTED) &&
+ (priv->mesh_connect_status != LBS_CONNECTED))
goto out;
/* Quality by RSSI */
priv->wstats.qual.level =
- CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG],
- adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
+ CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG],
+ priv->NF[TYPE_BEACON][TYPE_NOAVG]);
- if (adapter->NF[TYPE_BEACON][TYPE_NOAVG] == 0) {
+ if (priv->NF[TYPE_BEACON][TYPE_NOAVG] == 0) {
priv->wstats.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE;
} else {
priv->wstats.qual.noise =
- CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
+ CAL_NF(priv->NF[TYPE_BEACON][TYPE_NOAVG]);
}
lbs_deb_wext("signal level %#x\n", priv->wstats.qual.level);
@@ -870,7 +852,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
/* Quality by TX errors */
priv->wstats.discard.retries = priv->stats.tx_errors;
- tx_retries = le32_to_cpu(adapter->logmsg.retry);
+ tx_retries = le32_to_cpu(priv->logmsg.retry);
if (tx_retries > 75)
tx_qual = (90 - tx_retries) * POOR / 15;
@@ -886,10 +868,10 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
(PERFECT - VERY_GOOD) / 50 + VERY_GOOD;
quality = min(quality, tx_qual);
- priv->wstats.discard.code = le32_to_cpu(adapter->logmsg.wepundecryptable);
- priv->wstats.discard.fragment = le32_to_cpu(adapter->logmsg.rxfrag);
+ priv->wstats.discard.code = le32_to_cpu(priv->logmsg.wepundecryptable);
+ priv->wstats.discard.fragment = le32_to_cpu(priv->logmsg.rxfrag);
priv->wstats.discard.retries = tx_retries;
- priv->wstats.discard.misc = le32_to_cpu(adapter->logmsg.ackfailure);
+ priv->wstats.discard.misc = le32_to_cpu(priv->logmsg.ackfailure);
/* Calculate quality */
priv->wstats.qual.qual = min_t(u8, quality, 100);
@@ -924,14 +906,13 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info,
{
int ret = -EINVAL;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
struct chan_freq_power *cfp;
struct assoc_request * assoc_req;
lbs_deb_enter(LBS_DEB_WEXT);
- mutex_lock(&adapter->lock);
- assoc_req = lbs_get_association_request(adapter);
+ mutex_lock(&priv->lock);
+ assoc_req = lbs_get_association_request(priv);
if (!assoc_req) {
ret = -ENOMEM;
goto out;
@@ -941,7 +922,7 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info,
if (fwrq->e == 1) {
long f = fwrq->m / 100000;
- cfp = find_cfp_by_band_and_freq(adapter, 0, f);
+ cfp = find_cfp_by_band_and_freq(priv, 0, f);
if (!cfp) {
lbs_deb_wext("invalid freq %ld\n", f);
goto out;
@@ -956,7 +937,7 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info,
goto out;
}
- cfp = lbs_find_cfp_by_band_and_channel(adapter, 0, fwrq->m);
+ cfp = lbs_find_cfp_by_band_and_channel(priv, 0, fwrq->m);
if (!cfp) {
goto out;
}
@@ -971,7 +952,7 @@ out:
} else {
lbs_cancel_association_work(priv);
}
- mutex_unlock(&adapter->lock);
+ mutex_unlock(&priv->lock);
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
@@ -981,7 +962,6 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info,
struct iw_param *vwrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
u32 new_rate;
u16 action;
int ret = -EINVAL;
@@ -993,14 +973,14 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info,
/* Auto rate? */
if (vwrq->value == -1) {
action = CMD_ACT_SET_TX_AUTO;
- adapter->auto_rate = 1;
- adapter->cur_rate = 0;
+ priv->auto_rate = 1;
+ priv->cur_rate = 0;
} else {
if (vwrq->value % 100000)
goto out;
memset(rates, 0, sizeof(rates));
- copy_active_data_rates(adapter, rates);
+ copy_active_data_rates(priv, rates);
new_rate = vwrq->value / 500000;
if (!memchr(rates, new_rate, sizeof(rates))) {
lbs_pr_alert("fixed data rate 0x%X out of range\n",
@@ -1008,9 +988,9 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info,
goto out;
}
- adapter->cur_rate = new_rate;
+ priv->cur_rate = new_rate;
action = CMD_ACT_SET_TX_FIX_RATE;
- adapter->auto_rate = 0;
+ priv->auto_rate = 0;
}
ret = lbs_prepare_and_send_command(priv, CMD_802_11_DATA_RATE,
@@ -1025,14 +1005,13 @@ static int lbs_get_rate(struct net_device *dev, struct iw_request_info *info,
struct iw_param *vwrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
- if (adapter->connect_status == LBS_CONNECTED) {
- vwrq->value = adapter->cur_rate * 500000;
+ if (priv->connect_status == LBS_CONNECTED) {
+ vwrq->value = priv->cur_rate * 500000;
- if (adapter->auto_rate)
+ if (priv->auto_rate)
vwrq->fixed = 0;
else
vwrq->fixed = 1;
@@ -1051,7 +1030,6 @@ static int lbs_set_mode(struct net_device *dev,
{
int ret = 0;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
struct assoc_request * assoc_req;
lbs_deb_enter(LBS_DEB_WEXT);
@@ -1064,8 +1042,8 @@ static int lbs_set_mode(struct net_device *dev,
goto out;
}
- mutex_lock(&adapter->lock);
- assoc_req = lbs_get_association_request(adapter);
+ mutex_lock(&priv->lock);
+ assoc_req = lbs_get_association_request(priv);
if (!assoc_req) {
ret = -ENOMEM;
lbs_cancel_association_work(priv);
@@ -1075,7 +1053,7 @@ static int lbs_set_mode(struct net_device *dev,
lbs_postpone_association_work(priv);
lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq);
}
- mutex_unlock(&adapter->lock);
+ mutex_unlock(&priv->lock);
out:
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
@@ -1097,18 +1075,17 @@ static int lbs_get_encode(struct net_device *dev,
struct iw_point *dwrq, u8 * extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
lbs_deb_enter(LBS_DEB_WEXT);
lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n",
- dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx);
+ dwrq->flags, index, dwrq->length, priv->wep_tx_keyidx);
dwrq->flags = 0;
/* Authentication method */
- switch (adapter->secinfo.auth_mode) {
+ switch (priv->secinfo.auth_mode) {
case IW_AUTH_ALG_OPEN_SYSTEM:
dwrq->flags = IW_ENCODE_OPEN;
break;
@@ -1124,22 +1101,22 @@ static int lbs_get_encode(struct net_device *dev,
memset(extra, 0, 16);
- mutex_lock(&adapter->lock);
+ mutex_lock(&priv->lock);
/* Default to returning current transmit key */
if (index < 0)
- index = adapter->wep_tx_keyidx;
+ index = priv->wep_tx_keyidx;
- if ((adapter->wep_keys[index].len) && adapter->secinfo.wep_enabled) {
- memcpy(extra, adapter->wep_keys[index].key,
- adapter->wep_keys[index].len);
- dwrq->length = adapter->wep_keys[index].len;
+ if ((priv->wep_keys[index].len) && priv->secinfo.wep_enabled) {
+ memcpy(extra, priv->wep_keys[index].key,
+ priv->wep_keys[index].len);
+ dwrq->length = priv->wep_keys[index].len;
dwrq->flags |= (index + 1);
/* Return WEP enabled */
dwrq->flags &= ~IW_ENCODE_DISABLED;
- } else if ((adapter->secinfo.WPAenabled)
- || (adapter->secinfo.WPA2enabled)) {
+ } else if ((priv->secinfo.WPAenabled)
+ || (priv->secinfo.WPA2enabled)) {
/* return WPA enabled */
dwrq->flags &= ~IW_ENCODE_DISABLED;
dwrq->flags |= IW_ENCODE_NOKEY;
@@ -1147,7 +1124,7 @@ static int lbs_get_encode(struct net_device *dev,
dwrq->flags |= IW_ENCODE_DISABLED;
}
- mutex_unlock(&adapter->lock);
+ mutex_unlock(&priv->lock);
lbs_deb_wext("key: %02x:%02x:%02x:%02x:%02x:%02x, keylen %d\n",
extra[0], extra[1], extra[2],
@@ -1293,14 +1270,13 @@ static int lbs_set_encode(struct net_device *dev,
{
int ret = 0;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
struct assoc_request * assoc_req;
u16 is_default = 0, index = 0, set_tx_key = 0;
lbs_deb_enter(LBS_DEB_WEXT);
- mutex_lock(&adapter->lock);
- assoc_req = lbs_get_association_request(adapter);
+ mutex_lock(&priv->lock);
+ assoc_req = lbs_get_association_request(priv);
if (!assoc_req) {
ret = -ENOMEM;
goto out;
@@ -1348,7 +1324,7 @@ out:
} else {
lbs_cancel_association_work(priv);
}
- mutex_unlock(&adapter->lock);
+ mutex_unlock(&priv->lock);
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
@@ -1370,7 +1346,6 @@ static int lbs_get_encodeext(struct net_device *dev,
{
int ret = -EINVAL;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
int index, max_key_len;
@@ -1386,46 +1361,46 @@ static int lbs_get_encodeext(struct net_device *dev,
goto out;
index--;
} else {
- index = adapter->wep_tx_keyidx;
+ index = priv->wep_tx_keyidx;
}
if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) &&
ext->alg != IW_ENCODE_ALG_WEP) {
- if (index != 0 || adapter->mode != IW_MODE_INFRA)
+ if (index != 0 || priv->mode != IW_MODE_INFRA)
goto out;
}
dwrq->flags = index + 1;
memset(ext, 0, sizeof(*ext));
- if ( !adapter->secinfo.wep_enabled
- && !adapter->secinfo.WPAenabled
- && !adapter->secinfo.WPA2enabled) {
+ if ( !priv->secinfo.wep_enabled
+ && !priv->secinfo.WPAenabled
+ && !priv->secinfo.WPA2enabled) {
ext->alg = IW_ENCODE_ALG_NONE;
ext->key_len = 0;
dwrq->flags |= IW_ENCODE_DISABLED;
} else {
u8 *key = NULL;
- if ( adapter->secinfo.wep_enabled
- && !adapter->secinfo.WPAenabled
- && !adapter->secinfo.WPA2enabled) {
+ if ( priv->secinfo.wep_enabled
+ && !priv->secinfo.WPAenabled
+ && !priv->secinfo.WPA2enabled) {
/* WEP */
ext->alg = IW_ENCODE_ALG_WEP;
- ext->key_len = adapter->wep_keys[index].len;
- key = &adapter->wep_keys[index].key[0];
- } else if ( !adapter->secinfo.wep_enabled
- && (adapter->secinfo.WPAenabled ||
- adapter->secinfo.WPA2enabled)) {
+ ext->key_len = priv->wep_keys[index].len;
+ key = &priv->wep_keys[index].key[0];
+ } else if ( !priv->secinfo.wep_enabled
+ && (priv->secinfo.WPAenabled ||
+ priv->secinfo.WPA2enabled)) {
/* WPA */
struct enc_key * pkey = NULL;
- if ( adapter->wpa_mcast_key.len
- && (adapter->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED))
- pkey = &adapter->wpa_mcast_key;
- else if ( adapter->wpa_unicast_key.len
- && (adapter->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED))
- pkey = &adapter->wpa_unicast_key;
+ if ( priv->wpa_mcast_key.len
+ && (priv->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED))
+ pkey = &priv->wpa_mcast_key;
+ else if ( priv->wpa_unicast_key.len
+ && (priv->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED))
+ pkey = &priv->wpa_unicast_key;
if (pkey) {
if (pkey->type == KEY_TYPE_ID_AES) {
@@ -1477,15 +1452,14 @@ static int lbs_set_encodeext(struct net_device *dev,
{
int ret = 0;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
int alg = ext->alg;
struct assoc_request * assoc_req;
lbs_deb_enter(LBS_DEB_WEXT);
- mutex_lock(&adapter->lock);
- assoc_req = lbs_get_association_request(adapter);
+ mutex_lock(&priv->lock);
+ assoc_req = lbs_get_association_request(priv);
if (!assoc_req) {
ret = -ENOMEM;
goto out;
@@ -1589,7 +1563,7 @@ out:
} else {
lbs_cancel_association_work(priv);
}
- mutex_unlock(&adapter->lock);
+ mutex_unlock(&priv->lock);
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
@@ -1602,14 +1576,13 @@ static int lbs_set_genie(struct net_device *dev,
char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
struct assoc_request * assoc_req;
lbs_deb_enter(LBS_DEB_WEXT);
- mutex_lock(&adapter->lock);
- assoc_req = lbs_get_association_request(adapter);
+ mutex_lock(&priv->lock);
+ assoc_req = lbs_get_association_request(priv);
if (!assoc_req) {
ret = -ENOMEM;
goto out;
@@ -1625,7 +1598,7 @@ static int lbs_set_genie(struct net_device *dev,
memcpy(&assoc_req->wpa_ie[0], extra, dwrq->length);
assoc_req->wpa_ie_len = dwrq->length;
} else {
- memset(&assoc_req->wpa_ie[0], 0, sizeof(adapter->wpa_ie));
+ memset(&assoc_req->wpa_ie[0], 0, sizeof(priv->wpa_ie));
assoc_req->wpa_ie_len = 0;
}
@@ -1636,7 +1609,7 @@ out:
} else {
lbs_cancel_association_work(priv);
}
- mutex_unlock(&adapter->lock);
+ mutex_unlock(&priv->lock);
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
@@ -1649,22 +1622,21 @@ static int lbs_get_genie(struct net_device *dev,
{
int ret = 0;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
- if (adapter->wpa_ie_len == 0) {
+ if (priv->wpa_ie_len == 0) {
dwrq->length = 0;
goto out;
}
- if (dwrq->length < adapter->wpa_ie_len) {
+ if (dwrq->length < priv->wpa_ie_len) {
ret = -E2BIG;
goto out;
}
- dwrq->length = adapter->wpa_ie_len;
- memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len);
+ dwrq->length = priv->wpa_ie_len;
+ memcpy(extra, &priv->wpa_ie[0], priv->wpa_ie_len);
out:
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
@@ -1678,15 +1650,14 @@ static int lbs_set_auth(struct net_device *dev,
char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
struct assoc_request * assoc_req;
int ret = 0;
int updated = 0;
lbs_deb_enter(LBS_DEB_WEXT);
- mutex_lock(&adapter->lock);
- assoc_req = lbs_get_association_request(adapter);
+ mutex_lock(&priv->lock);
+ assoc_req = lbs_get_association_request(priv);
if (!assoc_req) {
ret = -ENOMEM;
goto out;
@@ -1765,7 +1736,7 @@ out:
} else if (ret != -EOPNOTSUPP) {
lbs_cancel_association_work(priv);
}
- mutex_unlock(&adapter->lock);
+ mutex_unlock(&priv->lock);
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
@@ -1778,27 +1749,26 @@ static int lbs_get_auth(struct net_device *dev,
{
int ret = 0;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
switch (dwrq->flags & IW_AUTH_INDEX) {
case IW_AUTH_WPA_VERSION:
dwrq->value = 0;
- if (adapter->secinfo.WPAenabled)
+ if (priv->secinfo.WPAenabled)
dwrq->value |= IW_AUTH_WPA_VERSION_WPA;
- if (adapter->secinfo.WPA2enabled)
+ if (priv->secinfo.WPA2enabled)
dwrq->value |= IW_AUTH_WPA_VERSION_WPA2;
if (!dwrq->value)
dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED;
break;
case IW_AUTH_80211_AUTH_ALG:
- dwrq->value = adapter->secinfo.auth_mode;
+ dwrq->value = priv->secinfo.auth_mode;
break;
case IW_AUTH_WPA_ENABLED:
- if (adapter->secinfo.WPAenabled && adapter->secinfo.WPA2enabled)
+ if (priv->secinfo.WPAenabled && priv->secinfo.WPA2enabled)
dwrq->value = 1;
break;
@@ -1816,7 +1786,6 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info,
{
int ret = 0;
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
u16 dbm;
@@ -1827,7 +1796,7 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info,
return 0;
}
- adapter->preamble = CMD_TYPE_AUTO_PREAMBLE;
+ priv->preamble = CMD_TYPE_AUTO_PREAMBLE;
lbs_radio_ioctl(priv, RADIO_ON);
@@ -1858,7 +1827,6 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info,
struct iw_point *dwrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_WEXT);
@@ -1870,19 +1838,19 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info,
/*
* Get the current SSID
*/
- if (adapter->connect_status == LBS_CONNECTED) {
- memcpy(extra, adapter->curbssparams.ssid,
- adapter->curbssparams.ssid_len);
- extra[adapter->curbssparams.ssid_len] = '\0';
+ if (priv->connect_status == LBS_CONNECTED) {
+ memcpy(extra, priv->curbssparams.ssid,
+ priv->curbssparams.ssid_len);
+ extra[priv->curbssparams.ssid_len] = '\0';
} else {
memset(extra, 0, 32);
- extra[adapter->curbssparams.ssid_len] = '\0';
+ extra[priv->curbssparams.ssid_len] = '\0';
}
/*
* If none, we may want to get the one that was set
*/
- dwrq->length = adapter->curbssparams.ssid_len;
+ dwrq->length = priv->curbssparams.ssid_len;
dwrq->flags = 1; /* active */
@@ -1894,7 +1862,6 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info,
struct iw_point *dwrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
u8 ssid[IW_ESSID_MAX_SIZE];
u8 ssid_len = 0;
@@ -1927,10 +1894,10 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info,
}
out:
- mutex_lock(&adapter->lock);
+ mutex_lock(&priv->lock);
if (ret == 0) {
/* Get or create the current association request */
- assoc_req = lbs_get_association_request(adapter);
+ assoc_req = lbs_get_association_request(priv);
if (!assoc_req) {
ret = -ENOMEM;
} else {
@@ -1947,7 +1914,7 @@ out:
lbs_cancel_association_work(priv);
}
- mutex_unlock(&adapter->lock);
+ mutex_unlock(&priv->lock);
lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
return ret;
@@ -1966,7 +1933,6 @@ static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info,
struct sockaddr *awrq, char *extra)
{
struct lbs_private *priv = dev->priv;
- struct lbs_adapter *adapter = priv->adapter;
struct assoc_request * assoc_req;
int ret = 0;
DECLARE_MAC_BUF(mac);
@@ -1978,10 +1944,10 @@ static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info,
lbs_deb_wext("ASSOC: WAP: sa_data %s\n", print_mac(mac, awrq->sa_data));
- mutex_lock(&adapter->lock);
+ mutex_lock(&priv->lock);
/* Get or create the current association request */
- assoc_req = lbs_get_association_request(adapter);
+ assoc_req = lbs_get_association_request(priv);
if (!assoc_req) {
lbs_cancel_association_work(priv);
ret = -ENOMEM;
@@ -1992,30 +1958,30 @@ static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info,
lbs_postpone_association_work(priv);
}
- mutex_unlock(&adapter->lock);
+ mutex_unlock(&priv->lock);
return ret;
}
-void lbs_get_fwversion(struct lbs_adapter *adapter, char *fwversion, int maxlen)
+void lbs_get_fwversion(struct lbs_private *priv, char *fwversion, int maxlen)
{
char fwver[32];
- mutex_lock(&adapter->lock);
+ mutex_lock(&priv->lock);
- if (adapter->fwreleasenumber[3] == 0)
+ if (priv->fwreleasenumber[3] == 0)
sprintf(fwver, "%u.%u.%u",
- adapter->fwreleasenumber[2],
- adapter->fwreleasenumber[1],
- adapter->fwreleasenumber[0]);
+ priv->fwreleasenumber[2],
+ priv->fwreleasenumber[1],
+ priv->fwreleasenumber[0]);
else
sprintf(fwver, "%u.%u.%u.p%u",
- adapter->fwreleasenumber[2],
- adapter->fwreleasenumber[1],
- adapter->fwreleasenumber[0],
- adapter->fwreleasenumber[3]);
+ priv->fwreleasenumber[2],
+ priv->fwreleasenumber[1],
+ priv->fwreleasenumber[0],
+ priv->fwreleasenumber[3]);
- mutex_unlock(&adapter->lock);
+ mutex_unlock(&priv->lock);
snprintf(fwversion, maxlen, fwver);
}