summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/libertas/assoc.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-08 20:04:36 (GMT)
committerDavid S. Miller <davem@davemloft.net>2008-01-28 23:06:19 (GMT)
commitaa21c004f80bdf943736c62dccf0c0398d7824f3 (patch)
tree6815328775d3b5ec46bb342c4c256cde0f223863 /drivers/net/wireless/libertas/assoc.c
parentf86a93e1b2d05a7a38a48c91f8fb8fc7e8f1c734 (diff)
downloadlinux-fsl-qoriq-aa21c004f80bdf943736c62dccf0c0398d7824f3.tar.xz
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/assoc.c')
-rw-r--r--drivers/net/wireless/libertas/assoc.c136
1 files changed, 64 insertions, 72 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index 88da68e..63bd692 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -18,7 +18,6 @@ static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static int assoc_helper_essid(struct lbs_private *priv,
struct assoc_request * assoc_req)
{
- struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
struct bss_descriptor * bss;
int channel = -1;
@@ -38,7 +37,7 @@ static int assoc_helper_essid(struct lbs_private *priv,
lbs_send_specific_ssid_scan(priv, assoc_req->ssid,
assoc_req->ssid_len, 0);
- bss = lbs_find_ssid_in_list(adapter, assoc_req->ssid,
+ bss = lbs_find_ssid_in_list(priv, assoc_req->ssid,
assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel);
if (bss != NULL) {
memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
@@ -54,7 +53,7 @@ static int assoc_helper_essid(struct lbs_private *priv,
assoc_req->ssid_len, 1);
/* Search for the requested SSID in the scan table */
- bss = lbs_find_ssid_in_list(adapter, assoc_req->ssid,
+ bss = lbs_find_ssid_in_list(priv, assoc_req->ssid,
assoc_req->ssid_len, NULL, IW_MODE_ADHOC, channel);
if (bss != NULL) {
lbs_deb_assoc("SSID found, will join\n");
@@ -78,7 +77,6 @@ static int assoc_helper_essid(struct lbs_private *priv,
static int assoc_helper_bssid(struct lbs_private *priv,
struct assoc_request * assoc_req)
{
- struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
struct bss_descriptor * bss;
DECLARE_MAC_BUF(mac);
@@ -87,7 +85,7 @@ static int assoc_helper_bssid(struct lbs_private *priv,
print_mac(mac, assoc_req->bssid));
/* Search for index position in list for requested MAC */
- bss = lbs_find_bssid_in_list(adapter, assoc_req->bssid,
+ bss = lbs_find_bssid_in_list(priv, assoc_req->bssid,
assoc_req->mode);
if (bss == NULL) {
lbs_deb_assoc("ASSOC: WAP: BSSID %s not found, "
@@ -138,21 +136,20 @@ static int assoc_helper_associate(struct lbs_private *priv,
static int assoc_helper_mode(struct lbs_private *priv,
struct assoc_request * assoc_req)
{
- struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
lbs_deb_enter(LBS_DEB_ASSOC);
- if (assoc_req->mode == adapter->mode)
+ if (assoc_req->mode == priv->mode)
goto done;
if (assoc_req->mode == IW_MODE_INFRA) {
- if (adapter->psstate != PS_STATE_FULL_POWER)
+ if (priv->psstate != PS_STATE_FULL_POWER)
lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP);
- adapter->psmode = LBS802_11POWERMODECAM;
+ priv->psmode = LBS802_11POWERMODECAM;
}
- adapter->mode = assoc_req->mode;
+ priv->mode = assoc_req->mode;
ret = lbs_prepare_and_send_command(priv,
CMD_802_11_SNMP_MIB,
0, CMD_OPTION_WAITFORRSP,
@@ -191,7 +188,6 @@ void lbs_sync_channel(struct work_struct *work)
static int assoc_helper_channel(struct lbs_private *priv,
struct assoc_request * assoc_req)
{
- struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
lbs_deb_enter(LBS_DEB_ASSOC);
@@ -201,11 +197,11 @@ static int assoc_helper_channel(struct lbs_private *priv,
lbs_deb_assoc("ASSOC: channel: error getting channel.");
}
- if (assoc_req->channel == adapter->curbssparams.channel)
+ if (assoc_req->channel == priv->curbssparams.channel)
goto done;
lbs_deb_assoc("ASSOC: channel: %d -> %d\n",
- adapter->curbssparams.channel, assoc_req->channel);
+ priv->curbssparams.channel, assoc_req->channel);
ret = lbs_prepare_and_send_command(priv, CMD_802_11_RF_CHANNEL,
CMD_OPT_802_11_RF_CHANNEL_SET,
@@ -219,7 +215,7 @@ static int assoc_helper_channel(struct lbs_private *priv,
lbs_deb_assoc("ASSOC: channel: error getting channel.");
}
- if (assoc_req->channel != adapter->curbssparams.channel) {
+ if (assoc_req->channel != priv->curbssparams.channel) {
lbs_deb_assoc("ASSOC: channel: failed to update channel to %d",
assoc_req->channel);
goto done;
@@ -246,7 +242,6 @@ done:
static int assoc_helper_wep_keys(struct lbs_private *priv,
struct assoc_request * assoc_req)
{
- struct lbs_adapter *adapter = priv->adapter;
int i;
int ret = 0;
@@ -275,23 +270,23 @@ static int assoc_helper_wep_keys(struct lbs_private *priv,
/* enable/disable the MAC's WEP packet filter */
if (assoc_req->secinfo.wep_enabled)
- adapter->currentpacketfilter |= CMD_ACT_MAC_WEP_ENABLE;
+ priv->currentpacketfilter |= CMD_ACT_MAC_WEP_ENABLE;
else
- adapter->currentpacketfilter &= ~CMD_ACT_MAC_WEP_ENABLE;
+ priv->currentpacketfilter &= ~CMD_ACT_MAC_WEP_ENABLE;
ret = lbs_set_mac_packet_filter(priv);
if (ret)
goto out;
- mutex_lock(&adapter->lock);
+ mutex_lock(&priv->lock);
- /* Copy WEP keys into adapter wep key fields */
+ /* Copy WEP keys into priv wep key fields */
for (i = 0; i < 4; i++) {
- memcpy(&adapter->wep_keys[i], &assoc_req->wep_keys[i],
+ memcpy(&priv->wep_keys[i], &assoc_req->wep_keys[i],
sizeof(struct enc_key));
}
- adapter->wep_tx_keyidx = assoc_req->wep_tx_keyidx;
+ priv->wep_tx_keyidx = assoc_req->wep_tx_keyidx;
- mutex_unlock(&adapter->lock);
+ mutex_unlock(&priv->lock);
out:
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
@@ -301,14 +296,13 @@ out:
static int assoc_helper_secinfo(struct lbs_private *priv,
struct assoc_request * assoc_req)
{
- struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
u32 do_wpa;
u32 rsn = 0;
lbs_deb_enter(LBS_DEB_ASSOC);
- memcpy(&adapter->secinfo, &assoc_req->secinfo,
+ memcpy(&priv->secinfo, &assoc_req->secinfo,
sizeof(struct lbs_802_11_security));
ret = lbs_set_mac_packet_filter(priv);
@@ -396,17 +390,16 @@ out:
static int assoc_helper_wpa_ie(struct lbs_private *priv,
struct assoc_request * assoc_req)
{
- struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
lbs_deb_enter(LBS_DEB_ASSOC);
if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
- memcpy(&adapter->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len);
- adapter->wpa_ie_len = assoc_req->wpa_ie_len;
+ memcpy(&priv->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len);
+ priv->wpa_ie_len = assoc_req->wpa_ie_len;
} else {
- memset(&adapter->wpa_ie, 0, MAX_WPA_IE_LEN);
- adapter->wpa_ie_len = 0;
+ memset(&priv->wpa_ie, 0, MAX_WPA_IE_LEN);
+ priv->wpa_ie_len = 0;
}
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
@@ -414,14 +407,14 @@ static int assoc_helper_wpa_ie(struct lbs_private *priv,
}
-static int should_deauth_infrastructure(struct lbs_adapter *adapter,
+static int should_deauth_infrastructure(struct lbs_private *priv,
struct assoc_request * assoc_req)
{
int ret = 0;
lbs_deb_enter(LBS_DEB_ASSOC);
- if (adapter->connect_status != LBS_CONNECTED)
+ if (priv->connect_status != LBS_CONNECTED)
return 0;
if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
@@ -431,7 +424,7 @@ static int should_deauth_infrastructure(struct lbs_adapter *adapter,
}
if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
- if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) {
+ if (priv->secinfo.auth_mode != assoc_req->secinfo.auth_mode) {
lbs_deb_assoc("Deauthenticating due to new security\n");
ret = 1;
goto out;
@@ -466,16 +459,16 @@ out:
}
-static int should_stop_adhoc(struct lbs_adapter *adapter,
+static int should_stop_adhoc(struct lbs_private *priv,
struct assoc_request * assoc_req)
{
lbs_deb_enter(LBS_DEB_ASSOC);
- if (adapter->connect_status != LBS_CONNECTED)
+ if (priv->connect_status != LBS_CONNECTED)
return 0;
- if (lbs_ssid_cmp(adapter->curbssparams.ssid,
- adapter->curbssparams.ssid_len,
+ if (lbs_ssid_cmp(priv->curbssparams.ssid,
+ priv->curbssparams.ssid_len,
assoc_req->ssid, assoc_req->ssid_len) != 0)
return 1;
@@ -486,7 +479,7 @@ static int should_stop_adhoc(struct lbs_adapter *adapter,
}
if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) {
- if (assoc_req->channel != adapter->curbssparams.channel)
+ if (assoc_req->channel != priv->curbssparams.channel)
return 1;
}
@@ -499,7 +492,6 @@ void lbs_association_worker(struct work_struct *work)
{
struct lbs_private *priv = container_of(work, struct lbs_private,
assoc_work.work);
- struct lbs_adapter *adapter = priv->adapter;
struct assoc_request * assoc_req = NULL;
int ret = 0;
int find_any_ssid = 0;
@@ -507,11 +499,11 @@ void lbs_association_worker(struct work_struct *work)
lbs_deb_enter(LBS_DEB_ASSOC);
- mutex_lock(&adapter->lock);
- assoc_req = adapter->pending_assoc_req;
- adapter->pending_assoc_req = NULL;
- adapter->in_progress_assoc_req = assoc_req;
- mutex_unlock(&adapter->lock);
+ mutex_lock(&priv->lock);
+ assoc_req = priv->pending_assoc_req;
+ priv->pending_assoc_req = NULL;
+ priv->in_progress_assoc_req = assoc_req;
+ mutex_unlock(&priv->lock);
if (!assoc_req)
goto done;
@@ -569,8 +561,8 @@ void lbs_association_worker(struct work_struct *work)
* Check if the attributes being changing require deauthentication
* from the currently associated infrastructure access point.
*/
- if (adapter->mode == IW_MODE_INFRA) {
- if (should_deauth_infrastructure(adapter, assoc_req)) {
+ if (priv->mode == IW_MODE_INFRA) {
+ if (should_deauth_infrastructure(priv, assoc_req)) {
ret = lbs_send_deauthentication(priv);
if (ret) {
lbs_deb_assoc("Deauthentication due to new "
@@ -578,8 +570,8 @@ void lbs_association_worker(struct work_struct *work)
ret);
}
}
- } else if (adapter->mode == IW_MODE_ADHOC) {
- if (should_stop_adhoc(adapter, assoc_req)) {
+ } else if (priv->mode == IW_MODE_ADHOC) {
+ if (should_stop_adhoc(priv, assoc_req)) {
ret = lbs_stop_adhoc_network(priv);
if (ret) {
lbs_deb_assoc("Teardown of AdHoc network due to "
@@ -643,7 +635,7 @@ void lbs_association_worker(struct work_struct *work)
success = 0;
}
- if (adapter->connect_status != LBS_CONNECTED) {
+ if (priv->connect_status != LBS_CONNECTED) {
lbs_deb_assoc("ASSOC: association unsuccessful, "
"not connected\n");
success = 0;
@@ -651,9 +643,9 @@ void lbs_association_worker(struct work_struct *work)
if (success) {
lbs_deb_assoc("ASSOC: associated to '%s', %s\n",
- escape_essid(adapter->curbssparams.ssid,
- adapter->curbssparams.ssid_len),
- print_mac(mac, adapter->curbssparams.bssid));
+ escape_essid(priv->curbssparams.ssid,
+ priv->curbssparams.ssid_len),
+ print_mac(mac, priv->curbssparams.bssid));
lbs_prepare_and_send_command(priv,
CMD_802_11_RSSI,
0, CMD_OPTION_WAITFORRSP, 0, NULL);
@@ -672,9 +664,9 @@ out:
ret);
}
- mutex_lock(&adapter->lock);
- adapter->in_progress_assoc_req = NULL;
- mutex_unlock(&adapter->lock);
+ mutex_lock(&priv->lock);
+ priv->in_progress_assoc_req = NULL;
+ mutex_unlock(&priv->lock);
kfree(assoc_req);
done:
@@ -685,15 +677,15 @@ done:
/*
* Caller MUST hold any necessary locks
*/
-struct assoc_request *lbs_get_association_request(struct lbs_adapter *adapter)
+struct assoc_request *lbs_get_association_request(struct lbs_private *priv)
{
struct assoc_request * assoc_req;
lbs_deb_enter(LBS_DEB_ASSOC);
- if (!adapter->pending_assoc_req) {
- adapter->pending_assoc_req = kzalloc(sizeof(struct assoc_request),
+ if (!priv->pending_assoc_req) {
+ priv->pending_assoc_req = kzalloc(sizeof(struct assoc_request),
GFP_KERNEL);
- if (!adapter->pending_assoc_req) {
+ if (!priv->pending_assoc_req) {
lbs_pr_info("Not enough memory to allocate association"
" request!\n");
return NULL;
@@ -703,57 +695,57 @@ struct assoc_request *lbs_get_association_request(struct lbs_adapter *adapter)
/* Copy current configuration attributes to the association request,
* but don't overwrite any that are already set.
*/
- assoc_req = adapter->pending_assoc_req;
+ assoc_req = priv->pending_assoc_req;
if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
- memcpy(&assoc_req->ssid, &adapter->curbssparams.ssid,
+ memcpy(&assoc_req->ssid, &priv->curbssparams.ssid,
IW_ESSID_MAX_SIZE);
- assoc_req->ssid_len = adapter->curbssparams.ssid_len;
+ assoc_req->ssid_len = priv->curbssparams.ssid_len;
}
if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags))
- assoc_req->channel = adapter->curbssparams.channel;
+ assoc_req->channel = priv->curbssparams.channel;
if (!test_bit(ASSOC_FLAG_BAND, &assoc_req->flags))
- assoc_req->band = adapter->curbssparams.band;
+ assoc_req->band = priv->curbssparams.band;
if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags))
- assoc_req->mode = adapter->mode;
+ assoc_req->mode = priv->mode;
if (!test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
- memcpy(&assoc_req->bssid, adapter->curbssparams.bssid,
+ memcpy(&assoc_req->bssid, priv->curbssparams.bssid,
ETH_ALEN);
}
if (!test_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags)) {
int i;
for (i = 0; i < 4; i++) {
- memcpy(&assoc_req->wep_keys[i], &adapter->wep_keys[i],
+ memcpy(&assoc_req->wep_keys[i], &priv->wep_keys[i],
sizeof(struct enc_key));
}
}
if (!test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags))
- assoc_req->wep_tx_keyidx = adapter->wep_tx_keyidx;
+ assoc_req->wep_tx_keyidx = priv->wep_tx_keyidx;
if (!test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)) {
- memcpy(&assoc_req->wpa_mcast_key, &adapter->wpa_mcast_key,
+ memcpy(&assoc_req->wpa_mcast_key, &priv->wpa_mcast_key,
sizeof(struct enc_key));
}
if (!test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) {
- memcpy(&assoc_req->wpa_unicast_key, &adapter->wpa_unicast_key,
+ memcpy(&assoc_req->wpa_unicast_key, &priv->wpa_unicast_key,
sizeof(struct enc_key));
}
if (!test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
- memcpy(&assoc_req->secinfo, &adapter->secinfo,
+ memcpy(&assoc_req->secinfo, &priv->secinfo,
sizeof(struct lbs_802_11_security));
}
if (!test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) {
- memcpy(&assoc_req->wpa_ie, &adapter->wpa_ie,
+ memcpy(&assoc_req->wpa_ie, &priv->wpa_ie,
MAX_WPA_IE_LEN);
- assoc_req->wpa_ie_len = adapter->wpa_ie_len;
+ assoc_req->wpa_ie_len = priv->wpa_ie_len;
}
lbs_deb_leave(LBS_DEB_ASSOC);