Commit 0dc5a290 authored by Dan Williams's avatar Dan Williams Committed by John W. Linville

[PATCH] libertas: remove WLAN_802_11_NETWORK_INFRASTRUCTURE enum

Use standard IW_MODE_* constants instead.
Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 889c05bd
...@@ -23,13 +23,13 @@ static int assoc_helper_essid(wlan_private *priv, ...@@ -23,13 +23,13 @@ static int assoc_helper_essid(wlan_private *priv,
ENTER(); ENTER();
lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid); lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid);
if (assoc_req->mode == wlan802_11infrastructure) { if (assoc_req->mode == IW_MODE_INFRA) {
if (adapter->prescan) { if (adapter->prescan) {
libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1); libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1);
} }
i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid,
NULL, wlan802_11infrastructure); NULL, IW_MODE_INFRA);
if (i >= 0) { if (i >= 0) {
lbs_pr_debug(1, lbs_pr_debug(1,
"SSID found in scan list ... associating...\n"); "SSID found in scan list ... associating...\n");
...@@ -44,7 +44,7 @@ static int assoc_helper_essid(wlan_private *priv, ...@@ -44,7 +44,7 @@ static int assoc_helper_essid(wlan_private *priv,
lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n", lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n",
assoc_req->ssid.ssid); assoc_req->ssid.ssid);
} }
} else if (assoc_req->mode == wlan802_11ibss) { } else if (assoc_req->mode == IW_MODE_ADHOC) {
/* Scan for the network, do not save previous results. Stale /* Scan for the network, do not save previous results. Stale
* scan data will cause us to join a non-existant adhoc network * scan data will cause us to join a non-existant adhoc network
*/ */
...@@ -52,7 +52,7 @@ static int assoc_helper_essid(wlan_private *priv, ...@@ -52,7 +52,7 @@ static int assoc_helper_essid(wlan_private *priv,
/* Search for the requested SSID in the scan table */ /* Search for the requested SSID in the scan table */
i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL, i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL,
wlan802_11ibss); IW_MODE_ADHOC);
if (i >= 0) { if (i >= 0) {
lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret); lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret);
libertas_join_adhoc_network(priv, &adapter->scantable[i]); libertas_join_adhoc_network(priv, &adapter->scantable[i]);
...@@ -90,10 +90,10 @@ static int assoc_helper_bssid(wlan_private *priv, ...@@ -90,10 +90,10 @@ static int assoc_helper_bssid(wlan_private *priv,
goto out; goto out;
} }
if (assoc_req->mode == wlan802_11infrastructure) { if (assoc_req->mode == IW_MODE_INFRA) {
ret = wlan_associate(priv, &adapter->scantable[i]); ret = wlan_associate(priv, &adapter->scantable[i]);
lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret); lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret);
} else if (assoc_req->mode == wlan802_11ibss) { } else if (assoc_req->mode == IW_MODE_ADHOC) {
libertas_join_adhoc_network(priv, &adapter->scantable[i]); libertas_join_adhoc_network(priv, &adapter->scantable[i]);
} }
memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid, memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid,
...@@ -142,23 +142,23 @@ static int assoc_helper_mode(wlan_private *priv, ...@@ -142,23 +142,23 @@ static int assoc_helper_mode(wlan_private *priv,
ENTER(); ENTER();
if (assoc_req->mode == adapter->inframode) { if (assoc_req->mode == adapter->mode) {
LEAVE(); LEAVE();
return 0; return 0;
} }
if (assoc_req->mode == wlan802_11infrastructure) { if (assoc_req->mode == IW_MODE_INFRA) {
if (adapter->psstate != PS_STATE_FULL_POWER) if (adapter->psstate != PS_STATE_FULL_POWER)
libertas_ps_wakeup(priv, cmd_option_waitforrsp); libertas_ps_wakeup(priv, cmd_option_waitforrsp);
adapter->psmode = wlan802_11powermodecam; adapter->psmode = wlan802_11powermodecam;
} }
adapter->inframode = assoc_req->mode; adapter->mode = assoc_req->mode;
ret = libertas_prepare_and_send_command(priv, ret = libertas_prepare_and_send_command(priv,
cmd_802_11_snmp_mib, cmd_802_11_snmp_mib,
0, cmd_option_waitforrsp, 0, cmd_option_waitforrsp,
OID_802_11_INFRASTRUCTURE_MODE, OID_802_11_INFRASTRUCTURE_MODE,
(void *) assoc_req->mode); (void *) (size_t) assoc_req->mode);
LEAVE(); LEAVE();
return ret; return ret;
...@@ -315,7 +315,7 @@ static int should_deauth_infrastructure(wlan_adapter *adapter, ...@@ -315,7 +315,7 @@ static int should_deauth_infrastructure(wlan_adapter *adapter,
/* FIXME: deal with 'auto' mode somehow */ /* FIXME: deal with 'auto' mode somehow */
if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
if (assoc_req->mode != wlan802_11infrastructure) if (assoc_req->mode != IW_MODE_INFRA)
return 1; return 1;
} }
...@@ -337,7 +337,7 @@ static int should_stop_adhoc(wlan_adapter *adapter, ...@@ -337,7 +337,7 @@ static int should_stop_adhoc(wlan_adapter *adapter,
/* FIXME: deal with 'auto' mode somehow */ /* FIXME: deal with 'auto' mode somehow */
if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
if (assoc_req->mode != wlan802_11ibss) if (assoc_req->mode != IW_MODE_ADHOC)
return 1; return 1;
} }
...@@ -381,7 +381,7 @@ void wlan_association_worker(struct work_struct *work) ...@@ -381,7 +381,7 @@ void wlan_association_worker(struct work_struct *work)
} }
if (find_any_ssid) { if (find_any_ssid) {
enum WLAN_802_11_NETWORK_INFRASTRUCTURE new_mode; u8 new_mode;
ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid, ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid,
assoc_req->mode, &new_mode); assoc_req->mode, &new_mode);
...@@ -392,7 +392,7 @@ void wlan_association_worker(struct work_struct *work) ...@@ -392,7 +392,7 @@ void wlan_association_worker(struct work_struct *work)
} }
/* Ensure we switch to the mode of the AP */ /* Ensure we switch to the mode of the AP */
if (assoc_req->mode == wlan802_11autounknown) { if (assoc_req->mode == IW_MODE_AUTO) {
set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); set_bit(ASSOC_FLAG_MODE, &assoc_req->flags);
assoc_req->mode = new_mode; assoc_req->mode = new_mode;
} }
...@@ -402,7 +402,7 @@ void wlan_association_worker(struct work_struct *work) ...@@ -402,7 +402,7 @@ void wlan_association_worker(struct work_struct *work)
* Check if the attributes being changing require deauthentication * Check if the attributes being changing require deauthentication
* from the currently associated infrastructure access point. * from the currently associated infrastructure access point.
*/ */
if (adapter->inframode == wlan802_11infrastructure) { if (adapter->mode == IW_MODE_INFRA) {
if (should_deauth_infrastructure(adapter, assoc_req)) { if (should_deauth_infrastructure(adapter, assoc_req)) {
ret = libertas_send_deauthentication(priv); ret = libertas_send_deauthentication(priv);
if (ret) { if (ret) {
...@@ -411,7 +411,7 @@ void wlan_association_worker(struct work_struct *work) ...@@ -411,7 +411,7 @@ void wlan_association_worker(struct work_struct *work)
ret); ret);
} }
} }
} else if (adapter->inframode == wlan802_11ibss) { } else if (adapter->mode == IW_MODE_ADHOC) {
if (should_stop_adhoc(adapter, assoc_req)) { if (should_stop_adhoc(adapter, assoc_req)) {
ret = libertas_stop_adhoc_network(priv); ret = libertas_stop_adhoc_network(priv);
if (ret) { if (ret) {
...@@ -542,7 +542,7 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter) ...@@ -542,7 +542,7 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
assoc_req->channel = adapter->curbssparams.channel; assoc_req->channel = adapter->curbssparams.channel;
if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags))
assoc_req->mode = adapter->inframode; assoc_req->mode = adapter->mode;
if (!test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { if (!test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
memcpy(&assoc_req->bssid, adapter->curbssparams.bssid, memcpy(&assoc_req->bssid, adapter->curbssparams.bssid,
......
...@@ -381,15 +381,16 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, ...@@ -381,15 +381,16 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
switch (cmd_oid) { switch (cmd_oid) {
case OID_802_11_INFRASTRUCTURE_MODE: case OID_802_11_INFRASTRUCTURE_MODE:
{ {
enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode = u8 mode = (u8) (size_t) pdata_buf;
(enum WLAN_802_11_NETWORK_INFRASTRUCTURE) pdata_buf;
pSNMPMIB->querytype = cpu_to_le16(cmd_act_set); pSNMPMIB->querytype = cpu_to_le16(cmd_act_set);
pSNMPMIB->oid = cpu_to_le16((u16) desired_bsstype_i); pSNMPMIB->oid = cpu_to_le16((u16) desired_bsstype_i);
pSNMPMIB->bufsize = sizeof(u8); pSNMPMIB->bufsize = sizeof(u8);
if (mode == wlan802_11infrastructure) if (mode == IW_MODE_ADHOC) {
ucTemp = SNMP_MIB_VALUE_INFRA;
else
ucTemp = SNMP_MIB_VALUE_ADHOC; ucTemp = SNMP_MIB_VALUE_ADHOC;
} else {
/* Infra and Auto modes */
ucTemp = SNMP_MIB_VALUE_INFRA;
}
memmove(pSNMPMIB->value, &ucTemp, sizeof(u8)); memmove(pSNMPMIB->value, &ucTemp, sizeof(u8));
......
...@@ -809,7 +809,7 @@ int libertas_process_rx_command(wlan_private * priv) ...@@ -809,7 +809,7 @@ int libertas_process_rx_command(wlan_private * priv)
if (result) { if (result) {
lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n", lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n",
resp->result); resp->result);
if (adapter->inframode == wlan802_11ibss) { if (adapter->mode == IW_MODE_ADHOC) {
/* /*
* We should not re-try enter-ps command in * We should not re-try enter-ps command in
* ad-hoc mode. It takes place in * ad-hoc mode. It takes place in
......
...@@ -267,15 +267,6 @@ enum mv_ms_type { ...@@ -267,15 +267,6 @@ enum mv_ms_type {
MVMS_EVENT MVMS_EVENT
}; };
/** WLAN_802_11_NETWORK_INFRASTRUCTURE */
enum WLAN_802_11_NETWORK_INFRASTRUCTURE {
wlan802_11ibss,
wlan802_11infrastructure,
wlan802_11autounknown,
/*defined as upper bound */
wlan802_11infrastructuremax
};
/** SNMP_MIB_INDEX_e */ /** SNMP_MIB_INDEX_e */
enum SNMP_MIB_INDEX_e { enum SNMP_MIB_INDEX_e {
desired_bsstype_i = 0, desired_bsstype_i = 0,
......
...@@ -183,7 +183,7 @@ struct assoc_request { ...@@ -183,7 +183,7 @@ struct assoc_request {
struct WLAN_802_11_SSID ssid; struct WLAN_802_11_SSID ssid;
u8 channel; u8 channel;
enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode; u8 mode;
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
/** WEP keys */ /** WEP keys */
...@@ -252,7 +252,8 @@ struct _wlan_adapter { ...@@ -252,7 +252,8 @@ struct _wlan_adapter {
/** current ssid/bssid related parameters*/ /** current ssid/bssid related parameters*/
struct current_bss_params curbssparams; struct current_bss_params curbssparams;
enum WLAN_802_11_NETWORK_INFRASTRUCTURE inframode; /* IW_MODE_* */
u8 mode;
struct bss_descriptor *pattemptedbssdesc; struct bss_descriptor *pattemptedbssdesc;
......
...@@ -200,7 +200,7 @@ static void wlan_init_adapter(wlan_private * priv) ...@@ -200,7 +200,7 @@ static void wlan_init_adapter(wlan_private * priv)
memset(&adapter->wep_keys[i], 0, sizeof(struct WLAN_802_11_KEY)); memset(&adapter->wep_keys[i], 0, sizeof(struct WLAN_802_11_KEY));
adapter->wep_tx_keyidx = 0; adapter->wep_tx_keyidx = 0;
adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
adapter->inframode = wlan802_11infrastructure; adapter->mode = IW_MODE_INFRA;
adapter->assoc_req = NULL; adapter->assoc_req = NULL;
......
...@@ -445,8 +445,8 @@ static int wlan_get_adhoc_status_ioctl(wlan_private * priv, struct iwreq *wrq) ...@@ -445,8 +445,8 @@ static int wlan_get_adhoc_status_ioctl(wlan_private * priv, struct iwreq *wrq)
memset(status, 0, sizeof(status)); memset(status, 0, sizeof(status));
switch (adapter->inframode) { switch (adapter->mode) {
case wlan802_11ibss: case IW_MODE_ADHOC:
if (adapter->connect_status == libertas_connected) { if (adapter->connect_status == libertas_connected) {
if (adapter->adhoccreate) if (adapter->adhoccreate)
memcpy(&status, "AdhocStarted", sizeof(status)); memcpy(&status, "AdhocStarted", sizeof(status));
...@@ -456,7 +456,7 @@ static int wlan_get_adhoc_status_ioctl(wlan_private * priv, struct iwreq *wrq) ...@@ -456,7 +456,7 @@ static int wlan_get_adhoc_status_ioctl(wlan_private * priv, struct iwreq *wrq)
memcpy(&status, "AdhocIdle", sizeof(status)); memcpy(&status, "AdhocIdle", sizeof(status));
} }
break; break;
case wlan802_11infrastructure: case IW_MODE_INFRA:
memcpy(&status, "Inframode", sizeof(status)); memcpy(&status, "Inframode", sizeof(status));
break; break;
default: default:
......
...@@ -87,7 +87,7 @@ int libertas_send_deauth(wlan_private * priv) ...@@ -87,7 +87,7 @@ int libertas_send_deauth(wlan_private * priv)
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
int ret = 0; int ret = 0;
if (adapter->inframode == wlan802_11infrastructure && if (adapter->mode == IW_MODE_INFRA &&
adapter->connect_status == libertas_connected) adapter->connect_status == libertas_connected)
ret = libertas_send_deauthentication(priv); ret = libertas_send_deauthentication(priv);
else else
...@@ -101,7 +101,7 @@ int libertas_do_adhocstop_ioctl(wlan_private * priv) ...@@ -101,7 +101,7 @@ int libertas_do_adhocstop_ioctl(wlan_private * priv)
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
int ret = 0; int ret = 0;
if (adapter->inframode == wlan802_11ibss && if (adapter->mode == IW_MODE_ADHOC &&
adapter->connect_status == libertas_connected) adapter->connect_status == libertas_connected)
ret = libertas_stop_adhoc_network(priv); ret = libertas_stop_adhoc_network(priv);
else else
...@@ -209,8 +209,7 @@ int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbs ...@@ -209,8 +209,7 @@ int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbs
/* check if the requested SSID is already joined */ /* check if the requested SSID is already joined */
if (adapter->curbssparams.ssid.ssidlength if (adapter->curbssparams.ssid.ssidlength
&& !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid) && !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid)
&& (adapter->curbssparams.bssdescriptor.inframode == && (adapter->mode == IW_MODE_ADHOC)) {
wlan802_11ibss)) {
lbs_pr_debug(1, lbs_pr_debug(1,
"ADHOC_J_CMD: New ad-hoc SSID is the same as current, " "ADHOC_J_CMD: New ad-hoc SSID is the same as current, "
...@@ -278,7 +277,7 @@ int libertas_idle_off(wlan_private * priv) ...@@ -278,7 +277,7 @@ int libertas_idle_off(wlan_private * priv)
ENTER(); ENTER();
if (adapter->connect_status == libertas_disconnected) { if (adapter->connect_status == libertas_disconnected) {
if (adapter->inframode == wlan802_11infrastructure) { if (adapter->mode == IW_MODE_INFRA) {
if (memcmp(adapter->previousbssid, zeromac, if (memcmp(adapter->previousbssid, zeromac,
sizeof(zeromac)) != 0) { sizeof(zeromac)) != 0) {
...@@ -296,7 +295,7 @@ int libertas_idle_off(wlan_private * priv) ...@@ -296,7 +295,7 @@ int libertas_idle_off(wlan_private * priv)
i = libertas_find_SSID_in_list(adapter, i = libertas_find_SSID_in_list(adapter,
&adapter->previousssid, &adapter->previousssid,
adapter->previousbssid, adapter->previousbssid,
adapter->inframode); adapter->mode);
if (i < 0) { if (i < 0) {
libertas_send_specific_BSSID_scan(priv, libertas_send_specific_BSSID_scan(priv,
...@@ -308,8 +307,7 @@ int libertas_idle_off(wlan_private * priv) ...@@ -308,8 +307,7 @@ int libertas_idle_off(wlan_private * priv)
previousssid, previousssid,
adapter-> adapter->
previousbssid, previousbssid,
adapter-> adapter->mode);
inframode);
} }
if (i < 0) { if (i < 0) {
...@@ -317,8 +315,7 @@ int libertas_idle_off(wlan_private * priv) ...@@ -317,8 +315,7 @@ int libertas_idle_off(wlan_private * priv)
i = libertas_find_SSID_in_list(adapter, i = libertas_find_SSID_in_list(adapter,
&adapter-> &adapter->
previousssid, NULL, previousssid, NULL,
adapter-> adapter->mode);
inframode);
} }
if (i < 0) { if (i < 0) {
...@@ -329,8 +326,7 @@ int libertas_idle_off(wlan_private * priv) ...@@ -329,8 +326,7 @@ int libertas_idle_off(wlan_private * priv)
i = libertas_find_SSID_in_list(adapter, i = libertas_find_SSID_in_list(adapter,
&adapter-> &adapter->
previousssid, NULL, previousssid, NULL,
adapter-> adapter->mode);
inframode);
} }
if (i >= 0) { if (i >= 0) {
...@@ -340,7 +336,7 @@ int libertas_idle_off(wlan_private * priv) ...@@ -340,7 +336,7 @@ int libertas_idle_off(wlan_private * priv)
scantable[i]); scantable[i]);
} }
} }
} else if (adapter->inframode == wlan802_11ibss) { } else if (adapter->mode == IW_MODE_ADHOC) {
ret = libertas_prepare_and_send_command(priv, ret = libertas_prepare_and_send_command(priv,
cmd_802_11_ad_hoc_start, cmd_802_11_ad_hoc_start,
0, 0,
...@@ -367,7 +363,7 @@ int libertas_idle_on(wlan_private * priv) ...@@ -367,7 +363,7 @@ int libertas_idle_on(wlan_private * priv)
int ret = 0; int ret = 0;
if (adapter->connect_status == libertas_connected) { if (adapter->connect_status == libertas_connected) {
if (adapter->inframode == wlan802_11infrastructure) { if (adapter->mode == IW_MODE_INFRA) {
lbs_pr_debug(1, "Previous SSID = %s\n", lbs_pr_debug(1, "Previous SSID = %s\n",
adapter->previousssid.ssid); adapter->previousssid.ssid);
memmove(&adapter->previousssid, memmove(&adapter->previousssid,
...@@ -375,7 +371,7 @@ int libertas_idle_on(wlan_private * priv) ...@@ -375,7 +371,7 @@ int libertas_idle_on(wlan_private * priv)
sizeof(struct WLAN_802_11_SSID)); sizeof(struct WLAN_802_11_SSID));
libertas_send_deauth(priv); libertas_send_deauth(priv);
} else if (adapter->inframode == wlan802_11ibss) { } else if (adapter->mode == IW_MODE_ADHOC) {
ret = libertas_stop_adhoc_network(priv); ret = libertas_stop_adhoc_network(priv);
} }
...@@ -569,7 +565,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, ...@@ -569,7 +565,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
lbs_pr_debug(1, "ASSOC_CMD: rates->header.len = %d\n", rates->header.len); lbs_pr_debug(1, "ASSOC_CMD: rates->header.len = %d\n", rates->header.len);
/* set IBSS field */ /* set IBSS field */
if (pbssdesc->inframode == wlan802_11infrastructure) { if (pbssdesc->mode == IW_MODE_INFRA) {
#define CAPINFO_ESS_MODE 1 #define CAPINFO_ESS_MODE 1
passo->capinfo.ess = CAPINFO_ESS_MODE; passo->capinfo.ess = CAPINFO_ESS_MODE;
} }
...@@ -643,7 +639,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, ...@@ -643,7 +639,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
/* set the BSS type */ /* set the BSS type */
adhs->bsstype = cmd_bss_type_ibss; adhs->bsstype = cmd_bss_type_ibss;
pbssdesc->inframode = wlan802_11ibss; pbssdesc->mode = IW_MODE_ADHOC;
adhs->beaconperiod = adapter->beaconperiod; adhs->beaconperiod = adapter->beaconperiod;
/* set Physical param set */ /* set Physical param set */
......
...@@ -84,11 +84,11 @@ ...@@ -84,11 +84,11 @@
* *
* @return Index in scantable, or error code if negative * @return Index in scantable, or error code if negative
*/ */
static int is_network_compatible(wlan_adapter * adapter, int index, int mode) static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
{ {
ENTER(); ENTER();
if (adapter->scantable[index].inframode == mode) { if (adapter->scantable[index].mode == mode) {
if ( !adapter->secinfo.wep_enabled if ( !adapter->secinfo.wep_enabled
&& !adapter->secinfo.WPAenabled && !adapter->secinfo.WPAenabled
&& !adapter->secinfo.WPA2enabled && !adapter->secinfo.WPA2enabled
...@@ -996,9 +996,9 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, ...@@ -996,9 +996,9 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
} }
if (pcap->ibss == 1) { if (pcap->ibss == 1) {
pBSSEntry->inframode = wlan802_11ibss; pBSSEntry->mode = IW_MODE_ADHOC;
} else { } else {
pBSSEntry->inframode = wlan802_11infrastructure; pBSSEntry->mode = IW_MODE_INFRA;
} }
/* process variable IE */ /* process variable IE */
...@@ -1196,7 +1196,7 @@ int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *s ...@@ -1196,7 +1196,7 @@ int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *s
* *
* @return index in BSSID list, or error return code (< 0) * @return index in BSSID list, or error return code (< 0)
*/ */
int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode) int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode)
{ {
int ret = -ENETUNREACH; int ret = -ENETUNREACH;
int i; int i;
...@@ -1216,8 +1216,8 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode) ...@@ -1216,8 +1216,8 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode)
for (i = 0; ret < 0 && i < adapter->numinscantable; i++) { for (i = 0; ret < 0 && i < adapter->numinscantable; i++) {
if (!memcmp(adapter->scantable[i].macaddress, bssid, ETH_ALEN)) { if (!memcmp(adapter->scantable[i].macaddress, bssid, ETH_ALEN)) {
switch (mode) { switch (mode) {
case wlan802_11infrastructure: case IW_MODE_INFRA:
case wlan802_11ibss: case IW_MODE_ADHOC:
ret = is_network_compatible(adapter, i, mode); ret = is_network_compatible(adapter, i, mode);
break; break;
default: default:
...@@ -1241,7 +1241,7 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode) ...@@ -1241,7 +1241,7 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode)
* @return index in BSSID list * @return index in BSSID list
*/ */
int libertas_find_SSID_in_list(wlan_adapter * adapter, int libertas_find_SSID_in_list(wlan_adapter * adapter,
struct WLAN_802_11_SSID *ssid, u8 * bssid, int mode) struct WLAN_802_11_SSID *ssid, u8 * bssid, u8 mode)
{ {
int net = -ENETUNREACH; int net = -ENETUNREACH;
u8 bestrssi = 0; u8 bestrssi = 0;
...@@ -1256,8 +1256,8 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter, ...@@ -1256,8 +1256,8 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
!memcmp(adapter->scantable[i]. !memcmp(adapter->scantable[i].
macaddress, bssid, ETH_ALEN))) { macaddress, bssid, ETH_ALEN))) {
switch (mode) { switch (mode) {
case wlan802_11infrastructure: case IW_MODE_INFRA:
case wlan802_11ibss: case IW_MODE_ADHOC:
j = is_network_compatible(adapter, i, mode); j = is_network_compatible(adapter, i, mode);
if (j >= 0) { if (j >= 0) {
...@@ -1280,7 +1280,7 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter, ...@@ -1280,7 +1280,7 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
} }
} }
break; break;
case wlan802_11autounknown: case IW_MODE_AUTO:
default: default:
if (SCAN_RSSI(adapter->scantable[i].rssi) if (SCAN_RSSI(adapter->scantable[i].rssi)
> bestrssi) { > bestrssi) {
...@@ -1307,8 +1307,7 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter, ...@@ -1307,8 +1307,7 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
* *
* @return index in BSSID list * @return index in BSSID list
*/ */
int libertas_find_best_SSID_in_list(wlan_adapter * adapter, int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode)
enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode)
{ {
int bestnet = -ENETUNREACH; int bestnet = -ENETUNREACH;
u8 bestrssi = 0; u8 bestrssi = 0;
...@@ -1320,8 +1319,8 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter, ...@@ -1320,8 +1319,8 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter,
for (i = 0; i < adapter->numinscantable; i++) { for (i = 0; i < adapter->numinscantable; i++) {
switch (mode) { switch (mode) {
case wlan802_11infrastructure: case IW_MODE_INFRA:
case wlan802_11ibss: case IW_MODE_ADHOC:
if (is_network_compatible(adapter, i, mode) >= 0) { if (is_network_compatible(adapter, i, mode) >= 0) {
if (SCAN_RSSI(adapter->scantable[i].rssi) > if (SCAN_RSSI(adapter->scantable[i].rssi) >
bestrssi) { bestrssi) {
...@@ -1332,7 +1331,7 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter, ...@@ -1332,7 +1331,7 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter,
} }
} }
break; break;
case wlan802_11autounknown: case IW_MODE_AUTO:
default: default:
if (SCAN_RSSI(adapter->scantable[i].rssi) > bestrssi) { if (SCAN_RSSI(adapter->scantable[i].rssi) > bestrssi) {
bestrssi = bestrssi =
...@@ -1357,8 +1356,7 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter, ...@@ -1357,8 +1356,7 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter,
*/ */
int libertas_find_best_network_SSID(wlan_private * priv, int libertas_find_best_network_SSID(wlan_private * priv,
struct WLAN_802_11_SSID *pSSID, struct WLAN_802_11_SSID *pSSID,
enum WLAN_802_11_NETWORK_INFRASTRUCTURE preferred_mode, u8 preferred_mode, u8 *out_mode)
enum WLAN_802_11_NETWORK_INFRASTRUCTURE *out_mode)
{ {
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
int ret = 0; int ret = 0;
...@@ -1383,7 +1381,7 @@ int libertas_find_best_network_SSID(wlan_private * priv, ...@@ -1383,7 +1381,7 @@ int libertas_find_best_network_SSID(wlan_private * priv,
preqbssid = &adapter->scantable[i]; preqbssid = &adapter->scantable[i];
memcpy(pSSID, &preqbssid->ssid, memcpy(pSSID, &preqbssid->ssid,
sizeof(struct WLAN_802_11_SSID)); sizeof(struct WLAN_802_11_SSID));
*out_mode = preqbssid->inframode; *out_mode = preqbssid->mode;
if (!pSSID->ssidlength) { if (!pSSID->ssidlength) {
ret = -1; ret = -1;
...@@ -1601,7 +1599,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, ...@@ -1601,7 +1599,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
//Add mode //Add mode
iwe.cmd = SIOCGIWMODE; iwe.cmd = SIOCGIWMODE;
iwe.u.mode = adapter->scantable[i].inframode + 1; iwe.u.mode = adapter->scantable[i].mode;
iwe.len = IW_EV_UINT_LEN; iwe.len = IW_EV_UINT_LEN;
current_ev = current_ev =
iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len); iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len);
...@@ -1635,7 +1633,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, ...@@ -1635,7 +1633,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
iwe.u.qual.noise = iwe.u.qual.noise =
CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
} }
if ((adapter->inframode == wlan802_11ibss) && if ((adapter->mode == IW_MODE_ADHOC) &&
!libertas_SSID_cmp(&adapter->curbssparams.ssid, !libertas_SSID_cmp(&adapter->curbssparams.ssid,
&adapter->scantable[i].ssid) &adapter->scantable[i].ssid)
&& adapter->adhoccreate) { && adapter->adhoccreate) {
...@@ -1700,7 +1698,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, ...@@ -1700,7 +1698,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
end_buf, &iwe, iwe.len); end_buf, &iwe, iwe.len);
} }
if ((adapter->scantable[i].inframode == wlan802_11ibss) if ((adapter->scantable[i].mode == IW_MODE_ADHOC)
&& !libertas_SSID_cmp(&adapter->curbssparams.ssid, && !libertas_SSID_cmp(&adapter->curbssparams.ssid,
&adapter->scantable[i].ssid) &adapter->scantable[i].ssid)
&& adapter->adhoccreate) { && adapter->adhoccreate) {
......
...@@ -153,7 +153,7 @@ struct bss_descriptor { ...@@ -153,7 +153,7 @@ struct bss_descriptor {
u32 atimwindow; u32 atimwindow;
enum WLAN_802_11_NETWORK_INFRASTRUCTURE inframode; u8 mode;
u8 libertas_supported_rates[WLAN_SUPPORTED_RATES]; u8 libertas_supported_rates[WLAN_SUPPORTED_RATES];
int extra_ie; int extra_ie;
...@@ -177,14 +177,13 @@ struct bss_descriptor { ...@@ -177,14 +177,13 @@ struct bss_descriptor {
extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1,
struct WLAN_802_11_SSID *ssid2); struct WLAN_802_11_SSID *ssid2);
extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid, extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid,
u8 * bssid, int mode); u8 * bssid, u8 mode);
int libertas_find_best_SSID_in_list(wlan_adapter * adapter, enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode); int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode);
extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode); extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode);
int libertas_find_best_network_SSID(wlan_private * priv, int libertas_find_best_network_SSID(wlan_private * priv,
struct WLAN_802_11_SSID *pSSID, struct WLAN_802_11_SSID *pSSID,
enum WLAN_802_11_NETWORK_INFRASTRUCTURE preferred_mode, u8 preferred_mode, u8 *out_mode);
enum WLAN_802_11_NETWORK_INFRASTRUCTURE *out_mode);
extern int libertas_send_specific_SSID_scan(wlan_private * priv, extern int libertas_send_specific_SSID_scan(wlan_private * priv,
struct WLAN_802_11_SSID *prequestedssid, struct WLAN_802_11_SSID *prequestedssid,
......
...@@ -233,7 +233,7 @@ static int changeadhocchannel(wlan_private * priv, int channel) ...@@ -233,7 +233,7 @@ static int changeadhocchannel(wlan_private * priv, int channel)
// find out the BSSID that matches the current SSID // find out the BSSID that matches the current SSID
i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL, i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL,
wlan802_11ibss); IW_MODE_ADHOC);
if (i >= 0) { if (i >= 0) {
lbs_pr_debug(1, "SSID found at %d in List," lbs_pr_debug(1, "SSID found at %d in List,"
...@@ -316,13 +316,11 @@ static int get_active_data_rates(wlan_adapter * adapter, ...@@ -316,13 +316,11 @@ static int get_active_data_rates(wlan_adapter * adapter,
ENTER(); ENTER();
if (adapter->connect_status != libertas_connected) { if (adapter->connect_status != libertas_connected) {
if (adapter->inframode == wlan802_11infrastructure) { if (adapter->mode == IW_MODE_INFRA) {
//Infra. mode
lbs_pr_debug(1, "Infra\n"); lbs_pr_debug(1, "Infra\n");
k = copyrates(rates, k, libertas_supported_rates, k = copyrates(rates, k, libertas_supported_rates,
sizeof(libertas_supported_rates)); sizeof(libertas_supported_rates));
} else { } else {
//ad-hoc mode
lbs_pr_debug(1, "Adhoc G\n"); lbs_pr_debug(1, "Adhoc G\n");
k = copyrates(rates, k, libertas_adhoc_rates_g, k = copyrates(rates, k, libertas_adhoc_rates_g,
sizeof(libertas_adhoc_rates_g)); sizeof(libertas_adhoc_rates_g));
...@@ -586,20 +584,7 @@ static int wlan_get_mode(struct net_device *dev, ...@@ -586,20 +584,7 @@ static int wlan_get_mode(struct net_device *dev,
ENTER(); ENTER();
switch (adapter->inframode) { *uwrq = adapter->mode;
case wlan802_11ibss:
*uwrq = IW_MODE_ADHOC;
break;
case wlan802_11infrastructure:
*uwrq = IW_MODE_INFRA;
break;
default:
case wlan802_11autounknown:
*uwrq = IW_MODE_AUTO;
break;
}
LEAVE(); LEAVE();
return 0; return 0;
...@@ -1417,7 +1402,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) ...@@ -1417,7 +1402,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
ENTER(); ENTER();
priv->wstats.status = adapter->inframode; priv->wstats.status = adapter->mode;
/* If we're not associated, all quality values are meaningless */ /* If we're not associated, all quality values are meaningless */
if (adapter->connect_status != libertas_connected) if (adapter->connect_status != libertas_connected)
...@@ -1551,7 +1536,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info, ...@@ -1551,7 +1536,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
if (!cfp) { if (!cfp) {
rc = -EINVAL; rc = -EINVAL;
} else { } else {
if (adapter->inframode == wlan802_11ibss) { if (adapter->mode == IW_MODE_ADHOC) {
rc = changeadhocchannel(priv, channel); rc = changeadhocchannel(priv, channel);
/* If station is WEP enabled, send the /* If station is WEP enabled, send the
* command to set WEP in firmware * command to set WEP in firmware
...@@ -1698,49 +1683,31 @@ static int wlan_set_mode(struct net_device *dev, ...@@ -1698,49 +1683,31 @@ static int wlan_set_mode(struct net_device *dev,
wlan_private *priv = dev->priv; wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
struct assoc_request * assoc_req; struct assoc_request * assoc_req;
enum WLAN_802_11_NETWORK_INFRASTRUCTURE new_mode;
ENTER(); ENTER();
switch (*uwrq) { if ( (*uwrq != IW_MODE_ADHOC)
case IW_MODE_ADHOC: && (*uwrq != IW_MODE_INFRA)
lbs_pr_debug(1, "Wanted mode is ad-hoc: current datarate=%#x\n", && (*uwrq != IW_MODE_AUTO)) {
adapter->datarate); lbs_pr_debug(1, "Invalid mode: 0x%x\n", *uwrq);
new_mode = wlan802_11ibss; ret = -EINVAL;
adapter->adhocchannel = DEFAULT_AD_HOC_CHANNEL; goto out;
break;
case IW_MODE_INFRA:
lbs_pr_debug(1, "Wanted mode is Infrastructure\n");
new_mode = wlan802_11infrastructure;
break;
case IW_MODE_AUTO:
lbs_pr_debug(1, "Wanted mode is Auto\n");
new_mode = wlan802_11autounknown;
break;
default:
lbs_pr_debug(1, "Wanted mode is Unknown: 0x%x\n", *uwrq);
return -EINVAL;
} }
mutex_lock(&adapter->lock); mutex_lock(&adapter->lock);
assoc_req = wlan_get_association_request(adapter); assoc_req = wlan_get_association_request(adapter);
if (!assoc_req) { if (!assoc_req) {
ret = -ENOMEM; ret = -ENOMEM;
wlan_cancel_association_work(priv);
} else { } else {
assoc_req->mode = new_mode; assoc_req->mode = *uwrq;
}
if (ret == 0) {
set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); set_bit(ASSOC_FLAG_MODE, &assoc_req->flags);
wlan_postpone_association_work(priv); wlan_postpone_association_work(priv);
} else { lbs_pr_debug(1, "Switching to mode: 0x%x\n", *uwrq);
wlan_cancel_association_work(priv);
} }
mutex_unlock(&adapter->lock); mutex_unlock(&adapter->lock);
out:
LEAVE(); LEAVE();
return ret; return ret;
} }
...@@ -2037,7 +2004,7 @@ static int wlan_get_encodeext(struct net_device *dev, ...@@ -2037,7 +2004,7 @@ static int wlan_get_encodeext(struct net_device *dev,
if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY && if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY &&
ext->alg != IW_ENCODE_ALG_WEP) { ext->alg != IW_ENCODE_ALG_WEP) {
if (index != 0 || adapter->inframode != wlan802_11infrastructure) if (index != 0 || adapter->mode != IW_MODE_INFRA)
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment