提交 aa21c004 编写于 作者: D David Woodhouse 提交者: David S. Miller

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: NDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 f86a93e1
......@@ -432,8 +432,8 @@ u8 lbs_get_scan_type_11d(u8 chan,
void lbs_init_11d(struct lbs_private *priv)
{
priv->adapter->enable11d = 0;
memset(&(priv->adapter->parsed_region_chan), 0,
priv->enable11d = 0;
memset(&(priv->parsed_region_chan), 0,
sizeof(struct parsed_region_chan_11d));
return;
}
......@@ -447,7 +447,7 @@ static int set_domain_info_11d(struct lbs_private *priv)
{
int ret;
if (!priv->adapter->enable11d) {
if (!priv->enable11d) {
lbs_deb_11d("dnld domain Info with 11d disabled\n");
return 0;
}
......@@ -469,22 +469,21 @@ static int set_domain_info_11d(struct lbs_private *priv)
*/
int lbs_set_universaltable(struct lbs_private *priv, u8 band)
{
struct lbs_adapter *adapter = priv->adapter;
u16 size = sizeof(struct chan_freq_power);
u16 i = 0;
memset(adapter->universal_channel, 0,
sizeof(adapter->universal_channel));
memset(priv->universal_channel, 0,
sizeof(priv->universal_channel));
adapter->universal_channel[i].nrcfp =
priv->universal_channel[i].nrcfp =
sizeof(channel_freq_power_UN_BG) / size;
lbs_deb_11d("BG-band nrcfp %d\n",
adapter->universal_channel[i].nrcfp);
priv->universal_channel[i].nrcfp);
adapter->universal_channel[i].CFP = channel_freq_power_UN_BG;
adapter->universal_channel[i].valid = 1;
adapter->universal_channel[i].region = UNIVERSAL_REGION_CODE;
adapter->universal_channel[i].band = band;
priv->universal_channel[i].CFP = channel_freq_power_UN_BG;
priv->universal_channel[i].valid = 1;
priv->universal_channel[i].region = UNIVERSAL_REGION_CODE;
priv->universal_channel[i].band = band;
i++;
return 0;
......@@ -505,8 +504,7 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv,
struct cmd_ds_802_11d_domain_info *pdomaininfo =
&cmd->params.domaininfo;
struct mrvlietypes_domainparamset *domain = &pdomaininfo->domain;
struct lbs_adapter *adapter = priv->adapter;
u8 nr_subband = adapter->domainreg.nr_subband;
u8 nr_subband = priv->domainreg.nr_subband;
lbs_deb_enter(LBS_DEB_11D);
......@@ -523,7 +521,7 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv,
}
domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN);
memcpy(domain->countrycode, adapter->domainreg.countrycode,
memcpy(domain->countrycode, priv->domainreg.countrycode,
sizeof(domain->countrycode));
domain->header.len =
......@@ -531,7 +529,7 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv,
sizeof(domain->countrycode));
if (nr_subband) {
memcpy(domain->subband, adapter->domainreg.subband,
memcpy(domain->subband, priv->domainreg.subband,
nr_subband * sizeof(struct ieeetypes_subbandset));
cmd->size = cpu_to_le16(sizeof(pdomaininfo->action) +
......@@ -605,24 +603,23 @@ int lbs_parse_dnld_countryinfo_11d(struct lbs_private *priv,
struct bss_descriptor * bss)
{
int ret;
struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_11D);
if (priv->adapter->enable11d) {
memset(&adapter->parsed_region_chan, 0,
if (priv->enable11d) {
memset(&priv->parsed_region_chan, 0,
sizeof(struct parsed_region_chan_11d));
ret = parse_domain_info_11d(&bss->countryinfo, 0,
&adapter->parsed_region_chan);
&priv->parsed_region_chan);
if (ret == -1) {
lbs_deb_11d("error parsing domain_info from AP\n");
goto done;
}
memset(&adapter->domainreg, 0,
memset(&priv->domainreg, 0,
sizeof(struct lbs_802_11d_domain_reg));
generate_domain_info_11d(&adapter->parsed_region_chan,
&adapter->domainreg);
generate_domain_info_11d(&priv->parsed_region_chan,
&priv->domainreg);
ret = set_domain_info_11d(priv);
......@@ -646,18 +643,17 @@ int lbs_parse_dnld_countryinfo_11d(struct lbs_private *priv,
int lbs_create_dnld_countryinfo_11d(struct lbs_private *priv)
{
int ret;
struct lbs_adapter *adapter = priv->adapter;
struct region_channel *region_chan;
u8 j;
lbs_deb_enter(LBS_DEB_11D);
lbs_deb_11d("curbssparams.band %d\n", adapter->curbssparams.band);
lbs_deb_11d("curbssparams.band %d\n", priv->curbssparams.band);
if (priv->adapter->enable11d) {
if (priv->enable11d) {
/* update parsed_region_chan_11; dnld domaininf to FW */
for (j = 0; j < ARRAY_SIZE(adapter->region_channel); j++) {
region_chan = &adapter->region_channel[j];
for (j = 0; j < ARRAY_SIZE(priv->region_channel); j++) {
region_chan = &priv->region_channel[j];
lbs_deb_11d("%d region_chan->band %d\n", j,
region_chan->band);
......@@ -665,28 +661,28 @@ int lbs_create_dnld_countryinfo_11d(struct lbs_private *priv)
if (!region_chan || !region_chan->valid
|| !region_chan->CFP)
continue;
if (region_chan->band != adapter->curbssparams.band)
if (region_chan->band != priv->curbssparams.band)
continue;
break;
}
if (j >= ARRAY_SIZE(adapter->region_channel)) {
if (j >= ARRAY_SIZE(priv->region_channel)) {
lbs_deb_11d("region_chan not found, band %d\n",
adapter->curbssparams.band);
priv->curbssparams.band);
ret = -1;
goto done;
}
memset(&adapter->parsed_region_chan, 0,
memset(&priv->parsed_region_chan, 0,
sizeof(struct parsed_region_chan_11d));
lbs_generate_parsed_region_chan_11d(region_chan,
&adapter->
&priv->
parsed_region_chan);
memset(&adapter->domainreg, 0,
memset(&priv->domainreg, 0,
sizeof(struct lbs_802_11d_domain_reg));
generate_domain_info_11d(&adapter->parsed_region_chan,
&adapter->domainreg);
generate_domain_info_11d(&priv->parsed_region_chan,
&priv->domainreg);
ret = set_domain_info_11d(priv);
......
......@@ -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 @@ static int assoc_helper_channel(struct lbs_private *priv,
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 @@ static int assoc_helper_wep_keys(struct lbs_private *priv,
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 @@ static int assoc_helper_wpa_keys(struct lbs_private *priv,
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 @@ static int should_deauth_infrastructure(struct lbs_adapter *adapter,
}
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 @@ void lbs_association_worker(struct work_struct *work)
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 @@ void lbs_association_worker(struct work_struct *work)
/*
* 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);
......
......@@ -6,7 +6,7 @@
#include "dev.h"
void lbs_association_worker(struct work_struct *work);
struct assoc_request *lbs_get_association_request(struct lbs_adapter *adapter);
struct assoc_request *lbs_get_association_request(struct lbs_private *priv);
void lbs_sync_channel(struct work_struct *work);
#endif /* _LBS_ASSOC_H */
此差异已折叠。
......@@ -45,9 +45,9 @@ static ssize_t lbs_dev_info(struct file *file, char __user *userbuf,
ssize_t res;
pos += snprintf(buf+pos, len-pos, "state = %s\n",
szStates[priv->adapter->connect_status]);
szStates[priv->connect_status]);
pos += snprintf(buf+pos, len-pos, "region_code = %02x\n",
(u32) priv->adapter->regioncode);
(u32) priv->regioncode);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
......@@ -70,8 +70,8 @@ static ssize_t lbs_getscantable(struct file *file, char __user *userbuf,
pos += snprintf(buf+pos, len-pos,
"# | ch | rssi | bssid | cap | Qual | SSID \n");
mutex_lock(&priv->adapter->lock);
list_for_each_entry (iter_bss, &priv->adapter->network_list, list) {
mutex_lock(&priv->lock);
list_for_each_entry (iter_bss, &priv->network_list, list) {
u16 ibss = (iter_bss->capability & WLAN_CAPABILITY_IBSS);
u16 privacy = (iter_bss->capability & WLAN_CAPABILITY_PRIVACY);
u16 spectrum_mgmt = (iter_bss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT);
......@@ -90,7 +90,7 @@ static ssize_t lbs_getscantable(struct file *file, char __user *userbuf,
numscansdone++;
}
mutex_unlock(&priv->adapter->lock);
mutex_unlock(&priv->lock);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
......@@ -118,12 +118,12 @@ static ssize_t lbs_sleepparams_write(struct file *file,
res = -EFAULT;
goto out_unlock;
}
priv->adapter->sp.sp_error = p1;
priv->adapter->sp.sp_offset = p2;
priv->adapter->sp.sp_stabletime = p3;
priv->adapter->sp.sp_calcontrol = p4;
priv->adapter->sp.sp_extsleepclk = p5;
priv->adapter->sp.sp_reserved = p6;
priv->sp.sp_error = p1;
priv->sp.sp_offset = p2;
priv->sp.sp_stabletime = p3;
priv->sp.sp_calcontrol = p4;
priv->sp.sp_extsleepclk = p5;
priv->sp.sp_reserved = p6;
res = lbs_prepare_and_send_command(priv,
CMD_802_11_SLEEP_PARAMS,
......@@ -144,7 +144,6 @@ static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
struct lbs_private *priv = file->private_data;
struct lbs_adapter *adapter = priv->adapter;
ssize_t res;
size_t pos = 0;
unsigned long addr = get_zeroed_page(GFP_KERNEL);
......@@ -159,10 +158,10 @@ static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf,
goto out_unlock;
}
pos += snprintf(buf, len, "%d %d %d %d %d %d\n", adapter->sp.sp_error,
adapter->sp.sp_offset, adapter->sp.sp_stabletime,
adapter->sp.sp_calcontrol, adapter->sp.sp_extsleepclk,
adapter->sp.sp_reserved);
pos += snprintf(buf, len, "%d %d %d %d %d %d\n", priv->sp.sp_error,
priv->sp.sp_offset, priv->sp.sp_stabletime,
priv->sp.sp_calcontrol, priv->sp.sp_extsleepclk,
priv->sp.sp_reserved);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
......@@ -321,11 +320,11 @@ static ssize_t lbs_setuserscan(struct file *file,
lbs_parse_type(buf, count, scan_cfg);
lbs_scan_networks(priv, scan_cfg, 1);
wait_event_interruptible(priv->adapter->cmd_pending,
priv->adapter->surpriseremoved ||
(!priv->adapter->cur_cmd && list_empty(&priv->adapter->cmdpendingq)));
wait_event_interruptible(priv->cmd_pending,
priv->surpriseremoved ||
(!priv->cur_cmd && list_empty(&priv->cmdpendingq)));
if (priv->adapter->surpriseremoved)
if (priv->surpriseremoved)
goto out_scan_cfg;
memset(&wrqu, 0x00, sizeof(union iwreq_data));
......@@ -620,7 +619,6 @@ static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
struct lbs_private *priv = file->private_data;
struct lbs_adapter *adapter = priv->adapter;
struct lbs_offset_value offval;
ssize_t pos = 0;
int ret;
......@@ -635,7 +633,7 @@ static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf,
CMD_OPTION_WAITFORRSP, 0, &offval);
mdelay(10);
pos += snprintf(buf+pos, len-pos, "MAC[0x%x] = 0x%08x\n",
priv->mac_offset, adapter->offsetvalue.value);
priv->mac_offset, priv->offsetvalue.value);
ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
free_page(addr);
......@@ -703,7 +701,6 @@ static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
struct lbs_private *priv = file->private_data;
struct lbs_adapter *adapter = priv->adapter;
struct lbs_offset_value offval;
ssize_t pos = 0;
int ret;
......@@ -718,7 +715,7 @@ static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf,
CMD_OPTION_WAITFORRSP, 0, &offval);
mdelay(10);
pos += snprintf(buf+pos, len-pos, "BBP[0x%x] = 0x%08x\n",
priv->bbp_offset, adapter->offsetvalue.value);
priv->bbp_offset, priv->offsetvalue.value);
ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
free_page(addr);
......@@ -787,7 +784,6 @@ static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
struct lbs_private *priv = file->private_data;
struct lbs_adapter *adapter = priv->adapter;
struct lbs_offset_value offval;
ssize_t pos = 0;
int ret;
......@@ -802,7 +798,7 @@ static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf,
CMD_OPTION_WAITFORRSP, 0, &offval);
mdelay(10);
pos += snprintf(buf+pos, len-pos, "RF[0x%x] = 0x%08x\n",
priv->rf_offset, adapter->offsetvalue.value);
priv->rf_offset, priv->offsetvalue.value);
ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
free_page(addr);
......@@ -1009,8 +1005,8 @@ void lbs_debugfs_remove_one(struct lbs_private *priv)
#ifdef PROC_DEBUG
#define item_size(n) (FIELD_SIZEOF(struct lbs_adapter, n))
#define item_addr(n) (offsetof(struct lbs_adapter, n))
#define item_size(n) (FIELD_SIZEOF(struct lbs_private, n))
#define item_addr(n) (offsetof(struct lbs_private, n))
struct debug_data {
......@@ -1019,7 +1015,7 @@ struct debug_data {
size_t addr;
};
/* To debug any member of struct lbs_adapter, simply add one line here.
/* To debug any member of struct lbs_private, simply add one line here.
*/
static struct debug_data items[] = {
{"intcounter", item_size(intcounter), item_addr(intcounter)},
......@@ -1158,7 +1154,7 @@ static void lbs_debug_init(struct lbs_private *priv, struct net_device *dev)
return;
for (i = 0; i < num_of_items; i++)
items[i].addr += (size_t) priv->adapter;
items[i].addr += (size_t) priv;
priv->debugfs_debug = debugfs_create_file("debug", 0644,
priv->debugfs_dir, &items[0],
......
......@@ -12,7 +12,6 @@
/** Function Prototype Declaration */
struct lbs_private;
struct lbs_adapter;
struct sk_buff;
struct net_device;
struct cmd_ctrl_node;
......@@ -32,7 +31,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
u16 cmd_action,
u16 wait_option, u32 cmd_oid, void *pdata_buf);
void lbs_queue_cmd(struct lbs_adapter *adapter,
void lbs_queue_cmd(struct lbs_private *priv,
struct cmd_ctrl_node *cmdnode,
u8 addtail);
......@@ -43,7 +42,7 @@ void lbs_interrupt(struct net_device *);
int lbs_set_radio_control(struct lbs_private *priv);
u32 lbs_fw_index_to_data_rate(u8 index);
u8 lbs_data_rate_to_fw_index(u32 rate);
void lbs_get_fwversion(struct lbs_adapter *adapter,
void lbs_get_fwversion(struct lbs_private *priv,
char *fwversion,
int maxlen);
......@@ -66,7 +65,7 @@ void lbs_ps_wakeup(struct lbs_private *priv, int wait_option);
void lbs_tx_runqueue(struct lbs_private *priv);
struct chan_freq_power *lbs_find_cfp_by_band_and_channel(
struct lbs_adapter *adapter,
struct lbs_private *priv,
u8 band,
u16 channel);
......
/**
* This file contains definitions and data structures specific
* to Marvell 802.11 NIC. It contains the Device Information
* structure struct lbs_adapter.
* structure struct lbs_private..
*/
#ifndef _LBS_DEV_H_
#define _LBS_DEV_H_
......@@ -109,7 +109,6 @@ struct lbs_private {
char name[DEV_NAME_LEN];
void *card;
struct lbs_adapter *adapter;
struct net_device *dev;
struct net_device_stats stats;
......@@ -156,54 +155,10 @@ struct lbs_private {
int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
int (*hw_get_int_status) (struct lbs_private *priv, u8 *);
int (*hw_read_event_cause) (struct lbs_private *);
};
/** Association request
*
* Encapsulates all the options that describe a specific assocation request
* or configuration of the wireless card's radio, mode, and security settings.
*/
struct assoc_request {
#define ASSOC_FLAG_SSID 1
#define ASSOC_FLAG_CHANNEL 2
#define ASSOC_FLAG_BAND 3
#define ASSOC_FLAG_MODE 4
#define ASSOC_FLAG_BSSID 5
#define ASSOC_FLAG_WEP_KEYS 6
#define ASSOC_FLAG_WEP_TX_KEYIDX 7
#define ASSOC_FLAG_WPA_MCAST_KEY 8
#define ASSOC_FLAG_WPA_UCAST_KEY 9
#define ASSOC_FLAG_SECINFO 10
#define ASSOC_FLAG_WPA_IE 11
unsigned long flags;
u8 ssid[IW_ESSID_MAX_SIZE + 1];
u8 ssid_len;
u8 channel;
u8 band;
u8 mode;
u8 bssid[ETH_ALEN];
/** WEP keys */
struct enc_key wep_keys[4];
u16 wep_tx_keyidx;
/** WPA keys */
struct enc_key wpa_mcast_key;
struct enc_key wpa_unicast_key;
struct lbs_802_11_security secinfo;
/** WPA Information Elements*/
u8 wpa_ie[MAX_WPA_IE_LEN];
u8 wpa_ie_len;
/* BSS to associate with for infrastructure of Ad-Hoc join */
struct bss_descriptor bss;
};
/* was struct lbs_adapter from here... */
/** Wlan adapter data structure*/
struct lbs_adapter {
/** Wlan adapter data structure*/
/** STATUS variables */
u8 fwreleasenumber[4];
u32 fwcapinfo;
......@@ -229,7 +184,7 @@ struct lbs_adapter {
struct list_head cmdpendingq;
wait_queue_head_t cmd_pending;
/* command related variables protected by adapter->driver_lock */
/* command related variables protected by priv->driver_lock */
/** Async and Sync Event variables */
u32 intcounter;
......@@ -366,4 +321,48 @@ struct lbs_adapter {
u8 fw_ready;
};
/** Association request
*
* Encapsulates all the options that describe a specific assocation request
* or configuration of the wireless card's radio, mode, and security settings.
*/
struct assoc_request {
#define ASSOC_FLAG_SSID 1
#define ASSOC_FLAG_CHANNEL 2
#define ASSOC_FLAG_BAND 3
#define ASSOC_FLAG_MODE 4
#define ASSOC_FLAG_BSSID 5
#define ASSOC_FLAG_WEP_KEYS 6
#define ASSOC_FLAG_WEP_TX_KEYIDX 7
#define ASSOC_FLAG_WPA_MCAST_KEY 8
#define ASSOC_FLAG_WPA_UCAST_KEY 9
#define ASSOC_FLAG_SECINFO 10
#define ASSOC_FLAG_WPA_IE 11
unsigned long flags;
u8 ssid[IW_ESSID_MAX_SIZE + 1];
u8 ssid_len;
u8 channel;
u8 band;
u8 mode;
u8 bssid[ETH_ALEN];
/** WEP keys */
struct enc_key wep_keys[4];
u16 wep_tx_keyidx;
/** WPA keys */
struct enc_key wpa_mcast_key;
struct enc_key wpa_unicast_key;
struct lbs_802_11_security secinfo;
/** WPA Information Elements*/
u8 wpa_ie[MAX_WPA_IE_LEN];
u8 wpa_ie_len;
/* BSS to associate with for infrastructure of Ad-Hoc join */
struct bss_descriptor bss;
};
#endif
......@@ -25,7 +25,7 @@ static void lbs_ethtool_get_drvinfo(struct net_device *dev,
struct lbs_private *priv = (struct lbs_private *) dev->priv;
char fwver[32];
lbs_get_fwversion(priv->adapter, fwver, sizeof(fwver) - 1);
lbs_get_fwversion(priv, fwver, sizeof(fwver) - 1);
strcpy(info->driver, "libertas");
strcpy(info->version, lbs_driver_version);
......@@ -46,7 +46,6 @@ static int lbs_ethtool_get_eeprom(struct net_device *dev,
struct ethtool_eeprom *eeprom, u8 * bytes)
{
struct lbs_private *priv = (struct lbs_private *) dev->priv;
struct lbs_adapter *adapter = priv->adapter;
struct lbs_ioctl_regrdwr regctrl;
char *ptr;
int ret;
......@@ -60,10 +59,10 @@ static int lbs_ethtool_get_eeprom(struct net_device *dev,
// mutex_lock(&priv->mutex);
adapter->prdeeprom = kmalloc(eeprom->len+sizeof(regctrl), GFP_KERNEL);
if (!adapter->prdeeprom)
priv->prdeeprom = kmalloc(eeprom->len+sizeof(regctrl), GFP_KERNEL);
if (!priv->prdeeprom)
return -ENOMEM;
memcpy(adapter->prdeeprom, &regctrl, sizeof(regctrl));
memcpy(priv->prdeeprom, &regctrl, sizeof(regctrl));
/* +14 is for action, offset, and NOB in
* response */
......@@ -77,14 +76,14 @@ static int lbs_ethtool_get_eeprom(struct net_device *dev,
&regctrl);
if (ret) {
if (adapter->prdeeprom)
kfree(adapter->prdeeprom);
if (priv->prdeeprom)
kfree(priv->prdeeprom);
goto done;
}
mdelay(10);
ptr = (char *)adapter->prdeeprom;
ptr = (char *)priv->prdeeprom;
/* skip the command header, but include the "value" u32 variable */
ptr = ptr + sizeof(struct lbs_ioctl_regrdwr) - 4;
......@@ -94,8 +93,8 @@ static int lbs_ethtool_get_eeprom(struct net_device *dev,
*/
memcpy(bytes, ptr, eeprom->len);
if (adapter->prdeeprom)
kfree(adapter->prdeeprom);
if (priv->prdeeprom)
kfree(priv->prdeeprom);
// mutex_unlock(&priv->mutex);
ret = 0;
......
......@@ -255,7 +255,7 @@ static irqreturn_t if_cs_interrupt(int irq, void *data)
} else if (int_cause == 0xffff) {
/* Read in junk, the card has probably been removed */
card->priv->adapter->surpriseremoved = 1;
card->priv->surpriseremoved = 1;
} else {
if (int_cause & IF_CS_H_IC_TX_OVER)
......@@ -644,7 +644,6 @@ static int if_cs_host_to_card(struct lbs_private *priv,
static int if_cs_get_int_status(struct lbs_private *priv, u8 *ireg)
{
struct if_cs_card *card = (struct if_cs_card *)priv->card;
/* struct lbs_adapter *adapter = priv->adapter; */
int ret = 0;
u16 int_cause;
u8 *cmdbuf;
......@@ -652,7 +651,7 @@ static int if_cs_get_int_status(struct lbs_private *priv, u8 *ireg)
lbs_deb_enter(LBS_DEB_CS);
if (priv->adapter->surpriseremoved)
if (priv->surpriseremoved)
goto out;
int_cause = if_cs_read16(card, IF_CS_C_INT_CAUSE) & IF_CS_C_IC_MASK;
......@@ -678,22 +677,22 @@ static int if_cs_get_int_status(struct lbs_private *priv, u8 *ireg)
/* Card has a command result for us */
if (*ireg & IF_CS_C_S_CMD_UPLD_RDY) {
spin_lock(&priv->adapter->driver_lock);
if (!priv->adapter->cur_cmd) {
spin_lock(&priv->driver_lock);
if (!priv->cur_cmd) {
cmdbuf = priv->upld_buf;
priv->adapter->hisregcpy &= ~IF_CS_C_S_RX_UPLD_RDY;
priv->hisregcpy &= ~IF_CS_C_S_RX_UPLD_RDY;
} else {
cmdbuf = priv->adapter->cur_cmd->bufvirtualaddr;
cmdbuf = priv->cur_cmd->bufvirtualaddr;
}
ret = if_cs_receive_cmdres(priv, cmdbuf, &priv->upld_len);
spin_unlock(&priv->adapter->driver_lock);
spin_unlock(&priv->driver_lock);
if (ret < 0)
lbs_pr_err("could not receive cmd from card\n");
}
out:
lbs_deb_leave_args(LBS_DEB_CS, "ret %d, ireg 0x%x, hisregcpy 0x%x", ret, *ireg, priv->adapter->hisregcpy);
lbs_deb_leave_args(LBS_DEB_CS, "ret %d, ireg 0x%x, hisregcpy 0x%x", ret, *ireg, priv->hisregcpy);
return ret;
}
......@@ -702,7 +701,7 @@ static int if_cs_read_event_cause(struct lbs_private *priv)
{
lbs_deb_enter(LBS_DEB_CS);
priv->adapter->eventcause = (if_cs_read16(priv->card, IF_CS_C_STATUS) & IF_CS_C_S_STATUS_MASK) >> 5;
priv->eventcause = (if_cs_read16(priv->card, IF_CS_C_STATUS) & IF_CS_C_S_STATUS_MASK) >> 5;
if_cs_write16(priv->card, IF_CS_H_INT_CAUSE, IF_CS_H_IC_HOST_EVENT);
return 0;
......@@ -869,7 +868,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
priv->hw_get_int_status = if_cs_get_int_status;
priv->hw_read_event_cause = if_cs_read_event_cause;
priv->adapter->fw_ready = 1;
priv->fw_ready = 1;
/* Now actually get the IRQ */
ret = request_irq(p_dev->irq.AssignedIRQ, if_cs_interrupt,
......
......@@ -134,9 +134,9 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card,
lbs_deb_enter(LBS_DEB_SDIO);
spin_lock_irqsave(&card->priv->adapter->driver_lock, flags);
spin_lock_irqsave(&card->priv->driver_lock, flags);
if (!card->priv->adapter->cur_cmd) {
if (!card->priv->cur_cmd) {
lbs_deb_sdio("discarding spurious response\n");
ret = 0;
goto out;
......@@ -149,7 +149,7 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card,
goto out;
}
memcpy(card->priv->adapter->cur_cmd->bufvirtualaddr, buffer, size);
memcpy(card->priv->cur_cmd->bufvirtualaddr, buffer, size);
card->priv->upld_len = size;
card->int_cause |= MRVDRV_CMD_UPLD_RDY;
......@@ -159,7 +159,7 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card,
ret = 0;
out:
spin_unlock_irqrestore(&card->priv->adapter->driver_lock, flags);
spin_unlock_irqrestore(&card->priv->driver_lock, flags);
lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
......@@ -231,14 +231,14 @@ static int if_sdio_handle_event(struct if_sdio_card *card,
event <<= SBI_EVENT_CAUSE_SHIFT;
}
spin_lock_irqsave(&card->priv->adapter->driver_lock, flags);
spin_lock_irqsave(&card->priv->driver_lock, flags);
card->event = event;
card->int_cause |= MRVDRV_CARDEVENT;
lbs_interrupt(card->priv->dev);
spin_unlock_irqrestore(&card->priv->adapter->driver_lock, flags);
spin_unlock_irqrestore(&card->priv->driver_lock, flags);
ret = 0;
......@@ -800,7 +800,7 @@ static int if_sdio_read_event_cause(struct lbs_private *priv)
card = priv->card;
priv->adapter->eventcause = card->event;
priv->eventcause = card->event;
lbs_deb_leave(LBS_DEB_SDIO);
......@@ -962,7 +962,7 @@ static int if_sdio_probe(struct sdio_func *func,
priv->hw_get_int_status = if_sdio_get_int_status;
priv->hw_read_event_cause = if_sdio_read_event_cause;
priv->adapter->fw_ready = 1;
priv->fw_ready = 1;
/*
* Enable interrupts now that everything is set up
......@@ -985,7 +985,7 @@ static int if_sdio_probe(struct sdio_func *func,
err_activate_card:
flush_scheduled_work();
free_netdev(priv->dev);
kfree(priv->adapter);
kfree(priv);
reclaim:
sdio_claim_host(func);
release_int:
......@@ -1015,7 +1015,7 @@ static void if_sdio_remove(struct sdio_func *func)
card = sdio_get_drvdata(func);
card->priv->adapter->surpriseremoved = 1;
card->priv->surpriseremoved = 1;
lbs_deb_sdio("call remove card\n");
lbs_stop_card(card->priv);
......
......@@ -229,7 +229,7 @@ static int if_usb_probe(struct usb_interface *intf,
/* Delay 200 ms to waiting for the FW ready */
if_usb_submit_rx_urb(cardp);
msleep_interruptible(200);
priv->adapter->fw_ready = 1;
priv->fw_ready = 1;
if (lbs_start_card(priv))
goto err_start_card;
......@@ -270,9 +270,8 @@ static void if_usb_disconnect(struct usb_interface *intf)
cardp->surprise_removed = 1;
if (priv) {
struct lbs_adapter *adapter = priv->adapter;
adapter->surpriseremoved = 1;
priv->surpriseremoved = 1;
lbs_stop_card(priv);
lbs_remove_mesh(priv);
lbs_remove_card(priv);
......@@ -609,14 +608,14 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
if (!in_interrupt())
BUG();
spin_lock(&priv->adapter->driver_lock);
spin_lock(&priv->driver_lock);
/* take care of cur_cmd = NULL case by reading the
* data to clear the interrupt */
if (!priv->adapter->cur_cmd) {
if (!priv->cur_cmd) {
cmdbuf = priv->upld_buf;
priv->adapter->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY;
priv->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY;
} else
cmdbuf = priv->adapter->cur_cmd->bufvirtualaddr;
cmdbuf = priv->cur_cmd->bufvirtualaddr;
cardp->usb_int_cause |= MRVDRV_CMD_UPLD_RDY;
priv->upld_len = (recvlength - MESSAGE_HEADER_LEN);
......@@ -625,7 +624,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
kfree_skb(skb);
lbs_interrupt(priv->dev);
spin_unlock(&priv->adapter->driver_lock);
spin_unlock(&priv->driver_lock);
lbs_deb_usbd(&cardp->udev->dev,
"Wake up main thread to handle cmd response\n");
......@@ -685,20 +684,20 @@ static void if_usb_receive(struct urb *urb)
case CMD_TYPE_INDICATION:
/* Event cause handling */
spin_lock(&priv->adapter->driver_lock);
spin_lock(&priv->driver_lock);
cardp->usb_event_cause = le32_to_cpu(*(__le32 *) (recvbuff + MESSAGE_HEADER_LEN));
lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n",
cardp->usb_event_cause);
if (cardp->usb_event_cause & 0xffff0000) {
lbs_send_tx_feedback(priv);
spin_unlock(&priv->adapter->driver_lock);
spin_unlock(&priv->driver_lock);
break;
}
cardp->usb_event_cause <<= 3;
cardp->usb_int_cause |= MRVDRV_CARDEVENT;
kfree_skb(skb);
lbs_interrupt(priv->dev);
spin_unlock(&priv->adapter->driver_lock);
spin_unlock(&priv->driver_lock);
goto rx_exit;
default:
lbs_deb_usbd(&cardp->udev->dev, "Unknown command type 0x%X\n",
......@@ -750,7 +749,7 @@ static int if_usb_host_to_card(struct lbs_private *priv,
nb + MESSAGE_HEADER_LEN);
}
/* called with adapter->driver_lock held */
/* called with priv->driver_lock held */
static int if_usb_get_int_status(struct lbs_private *priv, u8 *ireg)
{
struct usb_card_rec *cardp = priv->card;
......@@ -767,7 +766,7 @@ static int if_usb_read_event_cause(struct lbs_private *priv)
{
struct usb_card_rec *cardp = priv->card;
priv->adapter->eventcause = cardp->usb_event_cause;
priv->eventcause = cardp->usb_event_cause;
/* Re-submit rx urb here to avoid event lost issue */
if_usb_submit_rx_urb(cardp);
return 0;
......@@ -942,7 +941,7 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
lbs_deb_enter(LBS_DEB_USB);
if (priv->adapter->psstate != PS_STATE_FULL_POWER)
if (priv->psstate != PS_STATE_FULL_POWER)
return -1;
if (priv->mesh_dev && !priv->mesh_autostart_enabled) {
......
......@@ -30,13 +30,13 @@
* NOTE: Setting the MSB of the basic rates need to be taken
* care, either before or after calling this function
*
* @param adapter A pointer to struct lbs_adapter structure
* @param priv A pointer to struct lbs_private structure
* @param rate1 the buffer which keeps input and output
* @param rate1_size the size of rate1 buffer; new size of buffer on return
*
* @return 0 or -1
*/
static int get_common_rates(struct lbs_adapter *adapter,
static int get_common_rates(struct lbs_private *priv,
u8 *rates,
u16 *rates_size)
{
......@@ -57,15 +57,15 @@ static int get_common_rates(struct lbs_adapter *adapter,
lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size);
lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates);
lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size);
lbs_deb_join("TX data rate 0x%02x\n", adapter->cur_rate);
lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate);
if (!adapter->auto_rate) {
if (!priv->auto_rate) {
for (i = 0; i < tmp_size; i++) {
if (tmp[i] == adapter->cur_rate)
if (tmp[i] == priv->cur_rate)
goto done;
}
lbs_pr_alert("Previously set fixed data rate %#x isn't "
"compatible with the network.\n", adapter->cur_rate);
"compatible with the network.\n", priv->cur_rate);
ret = -1;
goto done;
}
......@@ -125,7 +125,6 @@ void lbs_unset_basic_rate_flags(u8 *rates, size_t len)
*/
int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req)
{
struct lbs_adapter *adapter = priv->adapter;
int ret;
lbs_deb_enter(LBS_DEB_ASSOC);
......@@ -138,11 +137,11 @@ int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req)
goto done;
/* set preamble to firmware */
if ( (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
if ( (priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
&& (assoc_req->bss.capability & WLAN_CAPABILITY_SHORT_PREAMBLE))
adapter->preamble = CMD_TYPE_SHORT_PREAMBLE;
priv->preamble = CMD_TYPE_SHORT_PREAMBLE;
else
adapter->preamble = CMD_TYPE_LONG_PREAMBLE;
priv->preamble = CMD_TYPE_LONG_PREAMBLE;
lbs_set_radio_control(priv);
......@@ -164,17 +163,16 @@ int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req)
int lbs_start_adhoc_network(struct lbs_private *priv,
struct assoc_request *assoc_req)
{
struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
adapter->adhoccreate = 1;
priv->adhoccreate = 1;
if (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) {
if (priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) {
lbs_deb_join("AdhocStart: Short preamble\n");
adapter->preamble = CMD_TYPE_SHORT_PREAMBLE;
priv->preamble = CMD_TYPE_SHORT_PREAMBLE;
} else {
lbs_deb_join("AdhocStart: Long preamble\n");
adapter->preamble = CMD_TYPE_LONG_PREAMBLE;
priv->preamble = CMD_TYPE_LONG_PREAMBLE;
}
lbs_set_radio_control(priv);
......@@ -200,26 +198,25 @@ int lbs_start_adhoc_network(struct lbs_private *priv,
int lbs_join_adhoc_network(struct lbs_private *priv,
struct assoc_request *assoc_req)
{
struct lbs_adapter *adapter = priv->adapter;
struct bss_descriptor * bss = &assoc_req->bss;
int ret = 0;
lbs_deb_join("%s: Current SSID '%s', ssid length %u\n",
__func__,
escape_essid(adapter->curbssparams.ssid,
adapter->curbssparams.ssid_len),
adapter->curbssparams.ssid_len);
escape_essid(priv->curbssparams.ssid,
priv->curbssparams.ssid_len),
priv->curbssparams.ssid_len);
lbs_deb_join("%s: requested ssid '%s', ssid length %u\n",
__func__, escape_essid(bss->ssid, bss->ssid_len),
bss->ssid_len);
/* check if the requested SSID is already joined */
if ( adapter->curbssparams.ssid_len
&& !lbs_ssid_cmp(adapter->curbssparams.ssid,
adapter->curbssparams.ssid_len,
if ( priv->curbssparams.ssid_len
&& !lbs_ssid_cmp(priv->curbssparams.ssid,
priv->curbssparams.ssid_len,
bss->ssid, bss->ssid_len)
&& (adapter->mode == IW_MODE_ADHOC)
&& (adapter->connect_status == LBS_CONNECTED)) {
&& (priv->mode == IW_MODE_ADHOC)
&& (priv->connect_status == LBS_CONNECTED)) {
union iwreq_data wrqu;
lbs_deb_join("ADHOC_J_CMD: New ad-hoc SSID is the same as "
......@@ -229,7 +226,7 @@ int lbs_join_adhoc_network(struct lbs_private *priv,
* request really was successful, even if just a null-op.
*/
memset(&wrqu, 0, sizeof(wrqu));
memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid,
memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid,
ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
......@@ -239,12 +236,12 @@ int lbs_join_adhoc_network(struct lbs_private *priv,
/* Use shortpreamble only when both creator and card supports
short preamble */
if ( !(bss->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
|| !(adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) {
|| !(priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) {
lbs_deb_join("AdhocJoin: Long preamble\n");
adapter->preamble = CMD_TYPE_LONG_PREAMBLE;
priv->preamble = CMD_TYPE_LONG_PREAMBLE;
} else {
lbs_deb_join("AdhocJoin: Short preamble\n");
adapter->preamble = CMD_TYPE_SHORT_PREAMBLE;
priv->preamble = CMD_TYPE_SHORT_PREAMBLE;
}
lbs_set_radio_control(priv);
......@@ -252,7 +249,7 @@ int lbs_join_adhoc_network(struct lbs_private *priv,
lbs_deb_join("AdhocJoin: channel = %d\n", assoc_req->channel);
lbs_deb_join("AdhocJoin: band = %c\n", assoc_req->band);
adapter->adhoccreate = 0;
priv->adhoccreate = 0;
ret = lbs_prepare_and_send_command(priv, CMD_802_11_AD_HOC_JOIN,
0, CMD_OPTION_WAITFORRSP,
......@@ -293,7 +290,6 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv,
struct cmd_ds_command *cmd,
void *pdata_buf)
{
struct lbs_adapter *adapter = priv->adapter;
struct cmd_ds_802_11_authenticate *pauthenticate = &cmd->params.auth;
int ret = -1;
u8 *bssid = pdata_buf;
......@@ -306,7 +302,7 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv,
+ S_DS_GEN);
/* translate auth mode to 802.11 defined wire value */
switch (adapter->secinfo.auth_mode) {
switch (priv->secinfo.auth_mode) {
case IW_AUTH_ALG_OPEN_SYSTEM:
pauthenticate->authtype = 0x00;
break;
......@@ -318,7 +314,7 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv,
break;
default:
lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n",
adapter->secinfo.auth_mode);
priv->secinfo.auth_mode);
goto out;
}
......@@ -336,7 +332,6 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv,
int lbs_cmd_80211_deauthenticate(struct lbs_private *priv,
struct cmd_ds_command *cmd)
{
struct lbs_adapter *adapter = priv->adapter;
struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth;
lbs_deb_enter(LBS_DEB_JOIN);
......@@ -346,7 +341,7 @@ int lbs_cmd_80211_deauthenticate(struct lbs_private *priv,
S_DS_GEN);
/* set AP MAC address */
memmove(dauth->macaddr, adapter->curbssparams.bssid, ETH_ALEN);
memmove(dauth->macaddr, priv->curbssparams.bssid, ETH_ALEN);
/* Reason code 3 = Station is leaving */
#define REASON_CODE_STA_LEAVING 3
......@@ -359,7 +354,6 @@ int lbs_cmd_80211_deauthenticate(struct lbs_private *priv,
int lbs_cmd_80211_associate(struct lbs_private *priv,
struct cmd_ds_command *cmd, void *pdata_buf)
{
struct lbs_adapter *adapter = priv->adapter;
struct cmd_ds_802_11_associate *passo = &cmd->params.associate;
int ret = 0;
struct assoc_request * assoc_req = pdata_buf;
......@@ -376,7 +370,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
pos = (u8 *) passo;
if (!adapter) {
if (!priv) {
ret = -1;
goto done;
}
......@@ -420,7 +414,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
memcpy(&rates->rates, &bss->rates, MAX_RATES);
tmplen = MAX_RATES;
if (get_common_rates(adapter, rates->rates, &tmplen)) {
if (get_common_rates(priv, rates->rates, &tmplen)) {
ret = -1;
goto done;
}
......@@ -429,8 +423,8 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
lbs_deb_assoc("ASSOC_CMD: num rates %u\n", tmplen);
/* Copy the infra. association rates into Current BSS state structure */
memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates));
memcpy(&adapter->curbssparams.rates, &rates->rates, tmplen);
memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates));
memcpy(&priv->curbssparams.rates, &rates->rates, tmplen);
/* Set MSB on basic rates as the firmware requires, but _after_
* copying to current bss rates.
......@@ -450,7 +444,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
}
/* update curbssparams */
adapter->curbssparams.channel = bss->phyparamset.dsparamset.currentchan;
priv->curbssparams.channel = bss->phyparamset.dsparamset.currentchan;
if (lbs_parse_dnld_countryinfo_11d(priv, bss)) {
ret = -1;
......@@ -474,7 +468,6 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
struct cmd_ds_command *cmd, void *pdata_buf)
{
struct lbs_adapter *adapter = priv->adapter;
struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads;
int ret = 0;
int cmdappendsize = 0;
......@@ -484,7 +477,7 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
lbs_deb_enter(LBS_DEB_JOIN);
if (!adapter) {
if (!priv) {
ret = -1;
goto done;
}
......@@ -494,7 +487,7 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
/*
* Fill in the parameters for 2 data structures:
* 1. cmd_ds_802_11_ad_hoc_start command
* 2. adapter->scantable[i]
* 2. priv->scantable[i]
*
* Driver will fill up SSID, bsstype,IBSS param, Physical Param,
* probe delay, and cap info.
......@@ -512,10 +505,10 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
/* set the BSS type */
adhs->bsstype = CMD_BSS_TYPE_IBSS;
adapter->mode = IW_MODE_ADHOC;
if (adapter->beacon_period == 0)
adapter->beacon_period = MRVDRV_BEACON_INTERVAL;
adhs->beaconperiod = cpu_to_le16(adapter->beacon_period);
priv->mode = IW_MODE_ADHOC;
if (priv->beacon_period == 0)
priv->beacon_period = MRVDRV_BEACON_INTERVAL;
adhs->beaconperiod = cpu_to_le16(priv->beacon_period);
/* set Physical param set */
#define DS_PARA_IE_ID 3
......@@ -557,8 +550,8 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
memcpy(adhs->rates, lbs_bg_rates, ratesize);
/* Copy the ad-hoc creating rates into Current BSS state structure */
memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates));
memcpy(&adapter->curbssparams.rates, &adhs->rates, ratesize);
memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates));
memcpy(&priv->curbssparams.rates, &adhs->rates, ratesize);
/* Set MSB on basic rates as the firmware requires, but _after_
* copying to current bss rates.
......@@ -597,7 +590,6 @@ int lbs_cmd_80211_ad_hoc_stop(struct lbs_private *priv,
int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
struct cmd_ds_command *cmd, void *pdata_buf)
{
struct lbs_adapter *adapter = priv->adapter;
struct cmd_ds_802_11_ad_hoc_join *join_cmd = &cmd->params.adj;
struct assoc_request * assoc_req = pdata_buf;
struct bss_descriptor *bss = &assoc_req->bss;
......@@ -638,21 +630,21 @@ int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
/* probedelay */
join_cmd->probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME);
adapter->curbssparams.channel = bss->channel;
priv->curbssparams.channel = bss->channel;
/* Copy Data rates from the rates recorded in scan response */
memset(join_cmd->bss.rates, 0, sizeof(join_cmd->bss.rates));
ratesize = min_t(u16, sizeof(join_cmd->bss.rates), MAX_RATES);
memcpy(join_cmd->bss.rates, bss->rates, ratesize);
if (get_common_rates(adapter, join_cmd->bss.rates, &ratesize)) {
if (get_common_rates(priv, join_cmd->bss.rates, &ratesize)) {
lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n");
ret = -1;
goto done;
}
/* Copy the ad-hoc creating rates into Current BSS state structure */
memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates));
memcpy(&adapter->curbssparams.rates, join_cmd->bss.rates, ratesize);
memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates));
memcpy(&priv->curbssparams.rates, join_cmd->bss.rates, ratesize);
/* Set MSB on basic rates as the firmware requires, but _after_
* copying to current bss rates.
......@@ -668,7 +660,7 @@ int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
join_cmd->bss.capability = cpu_to_le16(tmp);
}
if (adapter->psmode == LBS802_11POWERMODEMAX_PSP) {
if (priv->psmode == LBS802_11POWERMODEMAX_PSP) {
/* wake up first */
__le32 Localpsmode;
......@@ -700,7 +692,6 @@ int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
int lbs_ret_80211_associate(struct lbs_private *priv,
struct cmd_ds_command *resp)
{
struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
union iwreq_data wrqu;
struct ieeetypes_assocrsp *passocrsp;
......@@ -709,12 +700,12 @@ int lbs_ret_80211_associate(struct lbs_private *priv,
lbs_deb_enter(LBS_DEB_ASSOC);
if (!adapter->in_progress_assoc_req) {
if (!priv->in_progress_assoc_req) {
lbs_deb_assoc("ASSOC_RESP: no in-progress assoc request\n");
ret = -1;
goto done;
}
bss = &adapter->in_progress_assoc_req->bss;
bss = &priv->in_progress_assoc_req->bss;
passocrsp = (struct ieeetypes_assocrsp *) & resp->params;
......@@ -771,29 +762,29 @@ int lbs_ret_80211_associate(struct lbs_private *priv,
le16_to_cpu(resp->size) - S_DS_GEN);
/* Send a Media Connected event, according to the Spec */
adapter->connect_status = LBS_CONNECTED;
priv->connect_status = LBS_CONNECTED;
/* Update current SSID and BSSID */
memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
adapter->curbssparams.ssid_len = bss->ssid_len;
memcpy(adapter->curbssparams.bssid, bss->bssid, ETH_ALEN);
memcpy(&priv->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
priv->curbssparams.ssid_len = bss->ssid_len;
memcpy(priv->curbssparams.bssid, bss->bssid, ETH_ALEN);
lbs_deb_assoc("ASSOC_RESP: currentpacketfilter is 0x%x\n",
adapter->currentpacketfilter);
priv->currentpacketfilter);
adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0;
adapter->NF[TYPE_RXPD][TYPE_AVG] = 0;
priv->SNR[TYPE_RXPD][TYPE_AVG] = 0;
priv->NF[TYPE_RXPD][TYPE_AVG] = 0;
memset(adapter->rawSNR, 0x00, sizeof(adapter->rawSNR));
memset(adapter->rawNF, 0x00, sizeof(adapter->rawNF));
adapter->nextSNRNF = 0;
adapter->numSNRNF = 0;
memset(priv->rawSNR, 0x00, sizeof(priv->rawSNR));
memset(priv->rawNF, 0x00, sizeof(priv->rawNF));
priv->nextSNRNF = 0;
priv->numSNRNF = 0;
netif_carrier_on(priv->dev);
netif_wake_queue(priv->dev);
memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
......@@ -816,7 +807,6 @@ int lbs_ret_80211_disassociate(struct lbs_private *priv,
int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
struct cmd_ds_command *resp)
{
struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
u16 command = le16_to_cpu(resp->command);
u16 result = le16_to_cpu(resp->result);
......@@ -833,19 +823,19 @@ int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
lbs_deb_join("ADHOC_RESP: command = %x\n", command);
lbs_deb_join("ADHOC_RESP: result = %x\n", result);
if (!adapter->in_progress_assoc_req) {
if (!priv->in_progress_assoc_req) {
lbs_deb_join("ADHOC_RESP: no in-progress association request\n");
ret = -1;
goto done;
}
bss = &adapter->in_progress_assoc_req->bss;
bss = &priv->in_progress_assoc_req->bss;
/*
* Join result code 0 --> SUCCESS
*/
if (result) {
lbs_deb_join("ADHOC_RESP: failed\n");
if (adapter->connect_status == LBS_CONNECTED) {
if (priv->connect_status == LBS_CONNECTED) {
lbs_mac_event_disconnected(priv);
}
ret = -1;
......@@ -860,7 +850,7 @@ int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
escape_essid(bss->ssid, bss->ssid_len));
/* Send a Media Connected event, according to the Spec */
adapter->connect_status = LBS_CONNECTED;
priv->connect_status = LBS_CONNECTED;
if (command == CMD_RET(CMD_802_11_AD_HOC_START)) {
/* Update the created network descriptor with the new BSSID */
......@@ -868,22 +858,22 @@ int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
}
/* Set the BSSID from the joined/started descriptor */
memcpy(&adapter->curbssparams.bssid, bss->bssid, ETH_ALEN);
memcpy(&priv->curbssparams.bssid, bss->bssid, ETH_ALEN);
/* Set the new SSID to current SSID */
memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
adapter->curbssparams.ssid_len = bss->ssid_len;
memcpy(&priv->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
priv->curbssparams.ssid_len = bss->ssid_len;
netif_carrier_on(priv->dev);
netif_wake_queue(priv->dev);
memset(&wrqu, 0, sizeof(wrqu));
memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
lbs_deb_join("ADHOC_RESP: - Joined/Started Ad Hoc\n");
lbs_deb_join("ADHOC_RESP: channel = %d\n", adapter->curbssparams.channel);
lbs_deb_join("ADHOC_RESP: channel = %d\n", priv->curbssparams.channel);
lbs_deb_join("ADHOC_RESP: BSSID = %s\n",
print_mac(mac, padhocresult->bssid));
......
......@@ -48,12 +48,11 @@ static u8 lbs_getavgsnr(struct lbs_private *priv)
{
u8 i;
u16 temp = 0;
struct lbs_adapter *adapter = priv->adapter;
if (adapter->numSNRNF == 0)
if (priv->numSNRNF == 0)
return 0;
for (i = 0; i < adapter->numSNRNF; i++)
temp += adapter->rawSNR[i];
return (u8) (temp / adapter->numSNRNF);
for (i = 0; i < priv->numSNRNF; i++)
temp += priv->rawSNR[i];
return (u8) (temp / priv->numSNRNF);
}
......@@ -67,12 +66,11 @@ static u8 lbs_getavgnf(struct lbs_private *priv)
{
u8 i;
u16 temp = 0;
struct lbs_adapter *adapter = priv->adapter;
if (adapter->numSNRNF == 0)
if (priv->numSNRNF == 0)
return 0;
for (i = 0; i < adapter->numSNRNF; i++)
temp += adapter->rawNF[i];
return (u8) (temp / adapter->numSNRNF);
for (i = 0; i < priv->numSNRNF; i++)
temp += priv->rawNF[i];
return (u8) (temp / priv->numSNRNF);
}
......@@ -85,14 +83,13 @@ static u8 lbs_getavgnf(struct lbs_private *priv)
*/
static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd)
{
struct lbs_adapter *adapter = priv->adapter;
if (adapter->numSNRNF < DEFAULT_DATA_AVG_FACTOR)
adapter->numSNRNF++;
adapter->rawSNR[adapter->nextSNRNF] = p_rx_pd->snr;
adapter->rawNF[adapter->nextSNRNF] = p_rx_pd->nf;
adapter->nextSNRNF++;
if (adapter->nextSNRNF >= DEFAULT_DATA_AVG_FACTOR)
adapter->nextSNRNF = 0;
if (priv->numSNRNF < DEFAULT_DATA_AVG_FACTOR)
priv->numSNRNF++;
priv->rawSNR[priv->nextSNRNF] = p_rx_pd->snr;
priv->rawNF[priv->nextSNRNF] = p_rx_pd->nf;
priv->nextSNRNF++;
if (priv->nextSNRNF >= DEFAULT_DATA_AVG_FACTOR)
priv->nextSNRNF = 0;
return;
}
......@@ -105,32 +102,31 @@ static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd)
*/
static void lbs_compute_rssi(struct lbs_private *priv, struct rxpd *p_rx_pd)
{
struct lbs_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_RX);
lbs_deb_rx("rxpd: SNR %d, NF %d\n", p_rx_pd->snr, p_rx_pd->nf);
lbs_deb_rx("before computing SNR: SNR-avg = %d, NF-avg = %d\n",
adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
adapter->SNR[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->snr;
adapter->NF[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->nf;
priv->SNR[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->snr;
priv->NF[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->nf;
lbs_save_rawSNRNF(priv, p_rx_pd);
adapter->SNR[TYPE_RXPD][TYPE_AVG] = lbs_getavgsnr(priv) * AVG_SCALE;
adapter->NF[TYPE_RXPD][TYPE_AVG] = lbs_getavgnf(priv) * AVG_SCALE;
priv->SNR[TYPE_RXPD][TYPE_AVG] = lbs_getavgsnr(priv) * AVG_SCALE;
priv->NF[TYPE_RXPD][TYPE_AVG] = lbs_getavgnf(priv) * AVG_SCALE;
lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n",
adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
adapter->RSSI[TYPE_RXPD][TYPE_NOAVG] =
CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_NOAVG],
adapter->NF[TYPE_RXPD][TYPE_NOAVG]);
priv->RSSI[TYPE_RXPD][TYPE_NOAVG] =
CAL_RSSI(priv->SNR[TYPE_RXPD][TYPE_NOAVG],
priv->NF[TYPE_RXPD][TYPE_NOAVG]);
adapter->RSSI[TYPE_RXPD][TYPE_AVG] =
CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
priv->RSSI[TYPE_RXPD][TYPE_AVG] =
CAL_RSSI(priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
lbs_deb_leave(LBS_DEB_RX);
}
......@@ -139,7 +135,7 @@ void lbs_upload_rx_packet(struct lbs_private *priv, struct sk_buff *skb)
{
lbs_deb_rx("skb->data %p\n", skb->data);
if (priv->adapter->monitormode != LBS_MONITOR_OFF) {
if (priv->monitormode != LBS_MONITOR_OFF) {
skb->protocol = eth_type_trans(skb, priv->rtap_net_dev);
} else {
if (priv->mesh_dev && IS_MESH_FRAME(skb))
......@@ -161,7 +157,6 @@ void lbs_upload_rx_packet(struct lbs_private *priv, struct sk_buff *skb)
*/
int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
{
struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
struct rxpackethdr *p_rx_pkt;
......@@ -174,7 +169,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
lbs_deb_enter(LBS_DEB_RX);
if (priv->adapter->monitormode != LBS_MONITOR_OFF)
if (priv->monitormode != LBS_MONITOR_OFF)
return process_rxed_802_11_packet(priv, skb);
p_rx_pkt = (struct rxpackethdr *) skb->data;
......@@ -258,8 +253,8 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
/* Take the data rate from the rxpd structure
* only if the rate is auto
*/
if (adapter->auto_rate)
adapter->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate);
if (priv->auto_rate)
priv->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate);
lbs_compute_rssi(priv, p_rx_pd);
......@@ -327,7 +322,6 @@ static u8 convert_mv_rate_to_radiotap(u8 rate)
static int process_rxed_802_11_packet(struct lbs_private *priv,
struct sk_buff *skb)
{
struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
struct rx80211packethdr *p_rx_pkt;
......@@ -361,7 +355,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
/* create the exported radio header */
if (priv->adapter->monitormode == LBS_MONITOR_OFF) {
if (priv->monitormode == LBS_MONITOR_OFF) {
/* no radio header */
/* chop the rxpd */
skb_pull(skb, sizeof(struct rxpd));
......@@ -410,8 +404,8 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
/* Take the data rate from the rxpd structure
* only if the rate is auto
*/
if (adapter->auto_rate)
adapter->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate);
if (priv->auto_rate)
priv->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate);
lbs_compute_rssi(priv, prxpd);
......
......@@ -10,8 +10,6 @@
#include <net/ieee80211.h>
#include "hostcmd.h"
struct lbs_adapter;
/**
* @brief Maximum number of channels that can be sent in a setuserscan ioctl
*
......@@ -168,11 +166,11 @@ struct bss_descriptor {
int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_adapter *adapter,
struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_private *priv,
u8 *ssid, u8 ssid_len, u8 *bssid, u8 mode,
int channel);
struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_adapter *adapter,
struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_private *priv,
u8 *bssid, u8 mode);
int lbs_find_best_network_ssid(struct lbs_private *priv, u8 *out_ssid,
......
......@@ -64,11 +64,11 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb)
u8 *p802x_hdr;
struct tx_radiotap_hdr *pradiotap_hdr;
u32 new_rate;
u8 *ptr = priv->adapter->tmptxbuf;
u8 *ptr = priv->tmptxbuf;
lbs_deb_enter(LBS_DEB_TX);
if (priv->adapter->surpriseremoved)
if (priv->surpriseremoved)
return -1;
if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) {
......@@ -86,7 +86,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb)
plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd));
p802x_hdr = skb->data;
if (priv->adapter->monitormode != LBS_MONITOR_OFF) {
if (priv->monitormode != LBS_MONITOR_OFF) {
/* locate radiotap header */
pradiotap_hdr = (struct tx_radiotap_hdr *)skb->data;
......@@ -106,7 +106,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb)
}
/* copy destination address from 802.3 or 802.11 header */
if (priv->adapter->monitormode != LBS_MONITOR_OFF)
if (priv->monitormode != LBS_MONITOR_OFF)
memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr + 4, ETH_ALEN);
else
memcpy(plocaltxpd->tx_dest_addr_high, p802x_hdr, ETH_ALEN);
......@@ -124,7 +124,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb)
lbs_deb_hex(LBS_DEB_TX, "Tx Data", (u8 *) p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length));
memcpy(ptr, p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length));
ret = priv->hw_host_to_card(priv, MVMS_DAT,
priv->adapter->tmptxbuf,
priv->tmptxbuf,
le16_to_cpu(plocaltxpd->tx_packet_length) +
sizeof(struct txpd));
......@@ -144,7 +144,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb)
priv->stats.tx_errors++;
}
if (!ret && priv->adapter->monitormode != LBS_MONITOR_OFF) {
if (!ret && priv->monitormode != LBS_MONITOR_OFF) {
/* Keep the skb to echo it back once Tx feedback is
received from FW */
skb_orphan(skb);
......@@ -154,7 +154,7 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb)
netif_stop_queue(priv->mesh_dev);
/* Keep the skb around for when we get feedback */
priv->adapter->currenttxskb = skb;
priv->currenttxskb = skb;
} else {
dev_kfree_skb_any(skb);
}
......@@ -166,29 +166,27 @@ static int SendSinglePacket(struct lbs_private *priv, struct sk_buff *skb)
void lbs_tx_runqueue(struct lbs_private *priv)
{
struct lbs_adapter *adapter = priv->adapter;
int i;
spin_lock(&adapter->txqueue_lock);
for (i = 0; i < adapter->tx_queue_idx; i++) {
struct sk_buff *skb = adapter->tx_queue_ps[i];
spin_unlock(&adapter->txqueue_lock);
spin_lock(&priv->txqueue_lock);
for (i = 0; i < priv->tx_queue_idx; i++) {
struct sk_buff *skb = priv->tx_queue_ps[i];
spin_unlock(&priv->txqueue_lock);
SendSinglePacket(priv, skb);
spin_lock(&adapter->txqueue_lock);
spin_lock(&priv->txqueue_lock);
}
adapter->tx_queue_idx = 0;
spin_unlock(&adapter->txqueue_lock);
priv->tx_queue_idx = 0;
spin_unlock(&priv->txqueue_lock);
}
static void lbs_tx_queue(struct lbs_private *priv, struct sk_buff *skb)
{
struct lbs_adapter *adapter = priv->adapter;
spin_lock(&adapter->txqueue_lock);
spin_lock(&priv->txqueue_lock);
WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE);
adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb;
if (adapter->tx_queue_idx == NR_TX_QUEUE) {
WARN_ON(priv->tx_queue_idx >= NR_TX_QUEUE);
priv->tx_queue_ps[priv->tx_queue_idx++] = skb;
if (priv->tx_queue_idx == NR_TX_QUEUE) {
netif_stop_queue(priv->dev);
if (priv->mesh_dev)
netif_stop_queue(priv->mesh_dev);
......@@ -198,7 +196,7 @@ static void lbs_tx_queue(struct lbs_private *priv, struct sk_buff *skb)
netif_start_queue(priv->mesh_dev);
}
spin_unlock(&adapter->txqueue_lock);
spin_unlock(&priv->txqueue_lock);
}
/**
......@@ -221,8 +219,8 @@ int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb)
goto done;
}
if ((priv->adapter->psstate == PS_STATE_SLEEP) ||
(priv->adapter->psstate == PS_STATE_PRE_SLEEP)) {
if ((priv->psstate == PS_STATE_SLEEP) ||
(priv->psstate == PS_STATE_PRE_SLEEP)) {
lbs_tx_queue(priv, skb);
return ret;
}
......@@ -244,17 +242,16 @@ int lbs_process_tx(struct lbs_private *priv, struct sk_buff *skb)
*/
void lbs_send_tx_feedback(struct lbs_private *priv)
{
struct lbs_adapter *adapter = priv->adapter;
struct tx_radiotap_hdr *radiotap_hdr;
u32 status = adapter->eventcause;
u32 status = priv->eventcause;
int txfail;
int try_count;
if (adapter->monitormode == LBS_MONITOR_OFF ||
adapter->currenttxskb == NULL)
if (priv->monitormode == LBS_MONITOR_OFF ||
priv->currenttxskb == NULL)
return;
radiotap_hdr = (struct tx_radiotap_hdr *)adapter->currenttxskb->data;
radiotap_hdr = (struct tx_radiotap_hdr *)priv->currenttxskb->data;
txfail = (status >> 24);
......@@ -267,14 +264,14 @@ void lbs_send_tx_feedback(struct lbs_private *priv)
#endif
try_count = (status >> 16) & 0xff;
radiotap_hdr->data_retries = (try_count) ?
(1 + adapter->txretrycount - try_count) : 0;
lbs_upload_rx_packet(priv, adapter->currenttxskb);
adapter->currenttxskb = NULL;
(1 + priv->txretrycount - try_count) : 0;
lbs_upload_rx_packet(priv, priv->currenttxskb);
priv->currenttxskb = NULL;
if (adapter->connect_status == LBS_CONNECTED)
if (priv->connect_status == LBS_CONNECTED)
netif_wake_queue(priv->dev);
if (priv->mesh_dev && (adapter->mesh_connect_status == LBS_CONNECTED))
if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED))
netif_wake_queue(priv->mesh_dev);
}
EXPORT_SYMBOL_GPL(lbs_send_tx_feedback);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册