Skip to content

Commit

Permalink
[PATCH] libertas: remove WLAN_802_11_NETWORK_INFRASTRUCTURE enum
Browse files Browse the repository at this point in the history
Use standard IW_MODE_* constants instead.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Dan Williams authored and John W. Linville committed May 11, 2007
1 parent 889c05b commit 0dc5a29
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 132 deletions.
34 changes: 17 additions & 17 deletions drivers/net/wireless/libertas/assoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ static int assoc_helper_essid(wlan_private *priv,
ENTER();

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) {
libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1);
}

i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid,
NULL, wlan802_11infrastructure);
NULL, IW_MODE_INFRA);
if (i >= 0) {
lbs_pr_debug(1,
"SSID found in scan list ... associating...\n");
Expand All @@ -44,15 +44,15 @@ static int assoc_helper_essid(wlan_private *priv,
lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n",
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 data will cause us to join a non-existant adhoc network
*/
libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 0);

/* Search for the requested SSID in the scan table */
i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL,
wlan802_11ibss);
IW_MODE_ADHOC);
if (i >= 0) {
lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret);
libertas_join_adhoc_network(priv, &adapter->scantable[i]);
Expand Down Expand Up @@ -90,10 +90,10 @@ static int assoc_helper_bssid(wlan_private *priv,
goto out;
}

if (assoc_req->mode == wlan802_11infrastructure) {
if (assoc_req->mode == IW_MODE_INFRA) {
ret = wlan_associate(priv, &adapter->scantable[i]);
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]);
}
memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid,
Expand Down Expand Up @@ -142,23 +142,23 @@ static int assoc_helper_mode(wlan_private *priv,

ENTER();

if (assoc_req->mode == adapter->inframode) {
if (assoc_req->mode == adapter->mode) {
LEAVE();
return 0;
}

if (assoc_req->mode == wlan802_11infrastructure) {
if (assoc_req->mode == IW_MODE_INFRA) {
if (adapter->psstate != PS_STATE_FULL_POWER)
libertas_ps_wakeup(priv, cmd_option_waitforrsp);
adapter->psmode = wlan802_11powermodecam;
}

adapter->inframode = assoc_req->mode;
adapter->mode = assoc_req->mode;
ret = libertas_prepare_and_send_command(priv,
cmd_802_11_snmp_mib,
0, cmd_option_waitforrsp,
OID_802_11_INFRASTRUCTURE_MODE,
(void *) assoc_req->mode);
(void *) (size_t) assoc_req->mode);

LEAVE();
return ret;
Expand Down Expand Up @@ -315,7 +315,7 @@ static int should_deauth_infrastructure(wlan_adapter *adapter,

/* FIXME: deal with 'auto' mode somehow */
if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
if (assoc_req->mode != wlan802_11infrastructure)
if (assoc_req->mode != IW_MODE_INFRA)
return 1;
}

Expand All @@ -337,7 +337,7 @@ static int should_stop_adhoc(wlan_adapter *adapter,

/* FIXME: deal with 'auto' mode somehow */
if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
if (assoc_req->mode != wlan802_11ibss)
if (assoc_req->mode != IW_MODE_ADHOC)
return 1;
}

Expand Down Expand Up @@ -381,7 +381,7 @@ void wlan_association_worker(struct work_struct *work)
}

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,
assoc_req->mode, &new_mode);
Expand All @@ -392,7 +392,7 @@ void wlan_association_worker(struct work_struct *work)
}

/* 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);
assoc_req->mode = new_mode;
}
Expand All @@ -402,7 +402,7 @@ void wlan_association_worker(struct work_struct *work)
* Check if the attributes being changing require deauthentication
* 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)) {
ret = libertas_send_deauthentication(priv);
if (ret) {
Expand All @@ -411,7 +411,7 @@ void wlan_association_worker(struct work_struct *work)
ret);
}
}
} else if (adapter->inframode == wlan802_11ibss) {
} else if (adapter->mode == IW_MODE_ADHOC) {
if (should_stop_adhoc(adapter, assoc_req)) {
ret = libertas_stop_adhoc_network(priv);
if (ret) {
Expand Down Expand Up @@ -542,7 +542,7 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
assoc_req->channel = adapter->curbssparams.channel;

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)) {
memcpy(&assoc_req->bssid, adapter->curbssparams.bssid,
Expand Down
11 changes: 6 additions & 5 deletions drivers/net/wireless/libertas/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,16 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
switch (cmd_oid) {
case OID_802_11_INFRASTRUCTURE_MODE:
{
enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode =
(enum WLAN_802_11_NETWORK_INFRASTRUCTURE) pdata_buf;
u8 mode = (u8) (size_t) pdata_buf;
pSNMPMIB->querytype = cpu_to_le16(cmd_act_set);
pSNMPMIB->oid = cpu_to_le16((u16) desired_bsstype_i);
pSNMPMIB->bufsize = sizeof(u8);
if (mode == wlan802_11infrastructure)
ucTemp = SNMP_MIB_VALUE_INFRA;
else
if (mode == IW_MODE_ADHOC) {
ucTemp = SNMP_MIB_VALUE_ADHOC;
} else {
/* Infra and Auto modes */
ucTemp = SNMP_MIB_VALUE_INFRA;
}

memmove(pSNMPMIB->value, &ucTemp, sizeof(u8));

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/libertas/cmdresp.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ int libertas_process_rx_command(wlan_private * priv)
if (result) {
lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n",
resp->result);
if (adapter->inframode == wlan802_11ibss) {
if (adapter->mode == IW_MODE_ADHOC) {
/*
* We should not re-try enter-ps command in
* ad-hoc mode. It takes place in
Expand Down
9 changes: 0 additions & 9 deletions drivers/net/wireless/libertas/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,6 @@ enum mv_ms_type {
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 */
enum SNMP_MIB_INDEX_e {
desired_bsstype_i = 0,
Expand Down
5 changes: 3 additions & 2 deletions drivers/net/wireless/libertas/dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ struct assoc_request {

struct WLAN_802_11_SSID ssid;
u8 channel;
enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode;
u8 mode;
u8 bssid[ETH_ALEN];

/** WEP keys */
Expand Down Expand Up @@ -252,7 +252,8 @@ struct _wlan_adapter {
/** current ssid/bssid related parameters*/
struct current_bss_params curbssparams;

enum WLAN_802_11_NETWORK_INFRASTRUCTURE inframode;
/* IW_MODE_* */
u8 mode;

struct bss_descriptor *pattemptedbssdesc;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/libertas/fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static void wlan_init_adapter(wlan_private * priv)
memset(&adapter->wep_keys[i], 0, sizeof(struct WLAN_802_11_KEY));
adapter->wep_tx_keyidx = 0;
adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
adapter->inframode = wlan802_11infrastructure;
adapter->mode = IW_MODE_INFRA;

adapter->assoc_req = NULL;

Expand Down
6 changes: 3 additions & 3 deletions drivers/net/wireless/libertas/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ static int wlan_get_adhoc_status_ioctl(wlan_private * priv, struct iwreq *wrq)

memset(status, 0, sizeof(status));

switch (adapter->inframode) {
case wlan802_11ibss:
switch (adapter->mode) {
case IW_MODE_ADHOC:
if (adapter->connect_status == libertas_connected) {
if (adapter->adhoccreate)
memcpy(&status, "AdhocStarted", sizeof(status));
Expand All @@ -456,7 +456,7 @@ static int wlan_get_adhoc_status_ioctl(wlan_private * priv, struct iwreq *wrq)
memcpy(&status, "AdhocIdle", sizeof(status));
}
break;
case wlan802_11infrastructure:
case IW_MODE_INFRA:
memcpy(&status, "Inframode", sizeof(status));
break;
default:
Expand Down
30 changes: 13 additions & 17 deletions drivers/net/wireless/libertas/join.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int libertas_send_deauth(wlan_private * priv)
wlan_adapter *adapter = priv->adapter;
int ret = 0;

if (adapter->inframode == wlan802_11infrastructure &&
if (adapter->mode == IW_MODE_INFRA &&
adapter->connect_status == libertas_connected)
ret = libertas_send_deauthentication(priv);
else
Expand All @@ -101,7 +101,7 @@ int libertas_do_adhocstop_ioctl(wlan_private * priv)
wlan_adapter *adapter = priv->adapter;
int ret = 0;

if (adapter->inframode == wlan802_11ibss &&
if (adapter->mode == IW_MODE_ADHOC &&
adapter->connect_status == libertas_connected)
ret = libertas_stop_adhoc_network(priv);
else
Expand Down Expand Up @@ -209,8 +209,7 @@ int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbs
/* check if the requested SSID is already joined */
if (adapter->curbssparams.ssid.ssidlength
&& !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid)
&& (adapter->curbssparams.bssdescriptor.inframode ==
wlan802_11ibss)) {
&& (adapter->mode == IW_MODE_ADHOC)) {

lbs_pr_debug(1,
"ADHOC_J_CMD: New ad-hoc SSID is the same as current, "
Expand Down Expand Up @@ -278,7 +277,7 @@ int libertas_idle_off(wlan_private * priv)
ENTER();

if (adapter->connect_status == libertas_disconnected) {
if (adapter->inframode == wlan802_11infrastructure) {
if (adapter->mode == IW_MODE_INFRA) {
if (memcmp(adapter->previousbssid, zeromac,
sizeof(zeromac)) != 0) {

Expand All @@ -296,7 +295,7 @@ int libertas_idle_off(wlan_private * priv)
i = libertas_find_SSID_in_list(adapter,
&adapter->previousssid,
adapter->previousbssid,
adapter->inframode);
adapter->mode);

if (i < 0) {
libertas_send_specific_BSSID_scan(priv,
Expand All @@ -308,17 +307,15 @@ int libertas_idle_off(wlan_private * priv)
previousssid,
adapter->
previousbssid,
adapter->
inframode);
adapter->mode);
}

if (i < 0) {
/* If the BSSID could not be found, try just the SSID */
i = libertas_find_SSID_in_list(adapter,
&adapter->
previousssid, NULL,
adapter->
inframode);
adapter->mode);
}

if (i < 0) {
Expand All @@ -329,8 +326,7 @@ int libertas_idle_off(wlan_private * priv)
i = libertas_find_SSID_in_list(adapter,
&adapter->
previousssid, NULL,
adapter->
inframode);
adapter->mode);
}

if (i >= 0) {
Expand All @@ -340,7 +336,7 @@ int libertas_idle_off(wlan_private * priv)
scantable[i]);
}
}
} else if (adapter->inframode == wlan802_11ibss) {
} else if (adapter->mode == IW_MODE_ADHOC) {
ret = libertas_prepare_and_send_command(priv,
cmd_802_11_ad_hoc_start,
0,
Expand All @@ -367,15 +363,15 @@ int libertas_idle_on(wlan_private * priv)
int ret = 0;

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",
adapter->previousssid.ssid);
memmove(&adapter->previousssid,
&adapter->curbssparams.ssid,
sizeof(struct WLAN_802_11_SSID));
libertas_send_deauth(priv);

} else if (adapter->inframode == wlan802_11ibss) {
} else if (adapter->mode == IW_MODE_ADHOC) {
ret = libertas_stop_adhoc_network(priv);
}

Expand Down Expand Up @@ -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);

/* set IBSS field */
if (pbssdesc->inframode == wlan802_11infrastructure) {
if (pbssdesc->mode == IW_MODE_INFRA) {
#define CAPINFO_ESS_MODE 1
passo->capinfo.ess = CAPINFO_ESS_MODE;
}
Expand Down Expand Up @@ -643,7 +639,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,

/* set the BSS type */
adhs->bsstype = cmd_bss_type_ibss;
pbssdesc->inframode = wlan802_11ibss;
pbssdesc->mode = IW_MODE_ADHOC;
adhs->beaconperiod = adapter->beaconperiod;

/* set Physical param set */
Expand Down
Loading

0 comments on commit 0dc5a29

Please sign in to comment.