Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 57654
b: refs/heads/master
c: fcdb53d
h: refs/heads/master
v: v3
  • Loading branch information
Dan Williams authored and John W. Linville committed Jun 11, 2007
1 parent 9c732a8 commit 1638e9d
Show file tree
Hide file tree
Showing 9 changed files with 649 additions and 766 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 90e8eafc93ed159846bb7126af8502f2a8570a11
refs/heads/master: fcdb53dbc743f288bf72e485fefb3a967b733686
40 changes: 18 additions & 22 deletions trunk/drivers/net/wireless/libertas/assoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ static int assoc_helper_essid(wlan_private *priv,
{
wlan_adapter *adapter = priv->adapter;
int ret = 0;
int i;
struct bss_descriptor * bss;

lbs_deb_enter(LBS_DEB_ASSOC);

Expand All @@ -28,17 +28,13 @@ static int assoc_helper_essid(wlan_private *priv,
libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1);
}

i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid,
bss = libertas_find_SSID_in_list(adapter, &assoc_req->ssid,
NULL, IW_MODE_INFRA);
if (i >= 0) {
lbs_deb_assoc(
"SSID found in scan list ... associating...\n");

ret = wlan_associate(priv, &adapter->scantable[i]);
if (bss != NULL) {
lbs_deb_assoc("SSID found in scan list, associating\n");
ret = wlan_associate(priv, bss);
if (ret == 0) {
memcpy(&assoc_req->bssid,
&adapter->scantable[i].bssid,
ETH_ALEN);
memcpy(&assoc_req->bssid, bss->bssid, ETH_ALEN);
}
} else {
lbs_deb_assoc("SSID '%s' not found; cannot associate\n",
Expand All @@ -51,11 +47,11 @@ static int assoc_helper_essid(wlan_private *priv,
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,
bss = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL,
IW_MODE_ADHOC);
if (i >= 0) {
lbs_deb_assoc("SSID found at %d in List, so join\n", ret);
libertas_join_adhoc_network(priv, &adapter->scantable[i]);
if (bss != NULL) {
lbs_deb_assoc("SSID found joining\n");
libertas_join_adhoc_network(priv, bss);
} else {
/* else send START command */
lbs_deb_assoc("SSID not found in list, so creating adhoc"
Expand All @@ -74,28 +70,28 @@ static int assoc_helper_bssid(wlan_private *priv,
struct assoc_request * assoc_req)
{
wlan_adapter *adapter = priv->adapter;
int i, ret = 0;
int ret = 0;
struct bss_descriptor * bss;

lbs_deb_enter_args(LBS_DEB_ASSOC, "BSSID" MAC_FMT "\n",
MAC_ARG(assoc_req->bssid));

/* Search for index position in list for requested MAC */
i = libertas_find_BSSID_in_list(adapter, assoc_req->bssid,
bss = libertas_find_BSSID_in_list(adapter, assoc_req->bssid,
assoc_req->mode);
if (i < 0) {
if (bss == NULL) {
lbs_deb_assoc("ASSOC: WAP: BSSID " MAC_FMT " not found, "
"cannot associate.\n", MAC_ARG(assoc_req->bssid));
goto out;
}

if (assoc_req->mode == IW_MODE_INFRA) {
ret = wlan_associate(priv, &adapter->scantable[i]);
lbs_deb_assoc("ASSOC: return from wlan_associate(bssd) was %d\n", ret);
ret = wlan_associate(priv, bss);
lbs_deb_assoc("ASSOC: wlan_associate(bssid) returned %d\n", ret);
} else if (assoc_req->mode == IW_MODE_ADHOC) {
libertas_join_adhoc_network(priv, &adapter->scantable[i]);
libertas_join_adhoc_network(priv, bss);
}
memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid,
sizeof(struct WLAN_802_11_SSID));
memcpy(&assoc_req->ssid, &bss->ssid, sizeof(struct WLAN_802_11_SSID));

out:
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
Expand Down
31 changes: 15 additions & 16 deletions trunk/drivers/net/wireless/libertas/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,35 +63,34 @@ static ssize_t libertas_getscantable(struct file *file, char __user *userbuf,
int numscansdone = 0, res;
unsigned long addr = get_zeroed_page(GFP_KERNEL);
char *buf = (char *)addr;
struct bss_descriptor * iter_bss;

pos += snprintf(buf+pos, len-pos,
"# | ch | ss | bssid | cap | TSF | Qual | SSID \n");

while (numscansdone < priv->adapter->numinscantable) {
struct bss_descriptor *pbssinfo;
mutex_lock(&priv->adapter->lock);
list_for_each_entry (iter_bss, &priv->adapter->network_list, list) {
u16 cap;

pbssinfo = &priv->adapter->scantable[numscansdone];
memcpy(&cap, &pbssinfo->cap, sizeof(cap));
memcpy(&cap, &iter_bss->cap, sizeof(cap));
pos += snprintf(buf+pos, len-pos,
"%02u| %03d | %03ld | %02x:%02x:%02x:%02x:%02x:%02x |",
numscansdone, pbssinfo->channel, pbssinfo->rssi,
pbssinfo->bssid[0], pbssinfo->bssid[1],
pbssinfo->bssid[2], pbssinfo->bssid[3],
pbssinfo->bssid[4], pbssinfo->bssid[5]);
numscansdone, iter_bss->channel, iter_bss->rssi,
iter_bss->bssid[0], iter_bss->bssid[1],
iter_bss->bssid[2], iter_bss->bssid[3],
iter_bss->bssid[4], iter_bss->bssid[5]);
pos += snprintf(buf+pos, len-pos, " %04x-", cap);
pos += snprintf(buf+pos, len-pos, "%c%c%c |",
pbssinfo->cap.ibss ? 'A' : 'I',
pbssinfo->cap.privacy ? 'P' : ' ',
pbssinfo->cap.spectrummgmt ? 'S' : ' ');
pos += snprintf(buf+pos, len-pos, " %08llx |", pbssinfo->networktsf);
pos += snprintf(buf+pos, len-pos, " %d |",
SCAN_RSSI(priv->adapter->scantable[numscansdone].rssi));

pos += snprintf(buf+pos, len-pos, " %s\n", pbssinfo->ssid.ssid);
iter_bss->cap.ibss ? 'A' : 'I',
iter_bss->cap.privacy ? 'P' : ' ',
iter_bss->cap.spectrummgmt ? 'S' : ' ');
pos += snprintf(buf+pos, len-pos, " %08llx |", iter_bss->networktsf);
pos += snprintf(buf+pos, len-pos, " %d |", SCAN_RSSI(iter_bss->rssi));
pos += snprintf(buf+pos, len-pos, " %s\n", iter_bss->ssid.ssid);

numscansdone++;
}
mutex_unlock(&priv->adapter->lock);

res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);

Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/net/wireless/libertas/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
#define MRVDRV_NUM_OF_CMD_BUFFER 10
#define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024)
#define MRVDRV_MAX_CHANNEL_SIZE 14
#define MRVDRV_MAX_BSSID_LIST 64
#define MRVDRV_ASSOCIATION_TIME_OUT 255
#define MRVDRV_SNAP_HEADER_LEN 8

Expand Down
6 changes: 4 additions & 2 deletions trunk/drivers/net/wireless/libertas/dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ struct _wlan_adapter {
struct WLAN_802_11_SSID previousssid;
u8 previousbssid[ETH_ALEN];

struct bss_descriptor *scantable;
u32 numinscantable;
/* Scan results list */
struct list_head network_list;
struct list_head network_free_list;
struct bss_descriptor *networks;

u8 scantype;
u32 scanmode;
Expand Down
30 changes: 17 additions & 13 deletions trunk/drivers/net/wireless/libertas/fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,17 @@ static int wlan_setup_station_hw(wlan_private * priv, char *fw_name)

static int wlan_allocate_adapter(wlan_private * priv)
{
u32 ulbufsize;
size_t bufsize;
wlan_adapter *adapter = priv->adapter;

struct bss_descriptor *ptempscantable;

/* Allocate buffer to store the BSSID list */
ulbufsize = sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST;
if (!(ptempscantable = kzalloc(ulbufsize, GFP_KERNEL))) {
bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
adapter->networks = kzalloc(bufsize, GFP_KERNEL);
if (!adapter->networks) {
lbs_pr_err("Out of memory allocating beacons\n");
libertas_free_adapter(priv);
return -1;
return -ENOMEM;
}
adapter->scantable = ptempscantable;

/* Allocate the command buffers */
libertas_allocate_cmd_buffer(priv);
Expand Down Expand Up @@ -188,7 +187,14 @@ static void wlan_init_adapter(wlan_private * priv)

adapter->assoc_req = NULL;

adapter->numinscantable = 0;
/* Initialize scan result lists */
INIT_LIST_HEAD(&adapter->network_free_list);
INIT_LIST_HEAD(&adapter->network_list);
for (i = 0; i < MAX_NETWORK_COUNT; i++) {
list_add_tail(&adapter->networks[i].list,
&adapter->network_free_list);
}

adapter->pattemptedbssdesc = NULL;
mutex_init(&adapter->lock);

Expand Down Expand Up @@ -291,11 +297,9 @@ void libertas_free_adapter(wlan_private * priv)
lbs_deb_fw("free command_timer\n");
del_timer(&adapter->command_timer);

lbs_deb_fw("free scantable\n");
if (adapter->scantable) {
kfree(adapter->scantable);
adapter->scantable = NULL;
}
lbs_deb_fw("free scan results table\n");
kfree(adapter->networks);
adapter->networks = NULL;

/* Free the adapter object itself */
lbs_deb_fw("free adapter\n");
Expand Down
Loading

0 comments on commit 1638e9d

Please sign in to comment.