Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 66497
b: refs/heads/master
c: 2afc0c5
h: refs/heads/master
i:
  66495: 0cef835
v: v3
  • Loading branch information
Dan Williams authored and David S. Miller committed Oct 10, 2007
1 parent f952243 commit acb7287
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 66 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: b031ac10264fa9b805d84b4a440407ac950390cf
refs/heads/master: 2afc0c5d71a3dec6d35f3a234ed986d635ef41ad
2 changes: 1 addition & 1 deletion trunk/drivers/net/wireless/libertas/assoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static inline void wlan_postpone_association_work(wlan_private *priv)
if (priv->adapter->surpriseremoved)
return;
cancel_delayed_work(&priv->assoc_work);
queue_delayed_work(priv->assoc_thread, &priv->assoc_work, ASSOC_DELAY);
queue_delayed_work(priv->work_thread, &priv->assoc_work, ASSOC_DELAY);
}

static inline void wlan_cancel_association_work(wlan_private *priv)
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/net/wireless/libertas/dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ struct _wlan_private {
/** thread to service interrupts */
struct task_struct *main_thread;
wait_queue_head_t waitq;
struct workqueue_struct *work_thread;

struct delayed_work scan_work;
struct delayed_work assoc_work;
struct workqueue_struct *assoc_thread;
struct work_struct sync_channel;

/** Hardware access */
Expand Down
10 changes: 6 additions & 4 deletions trunk/drivers/net/wireless/libertas/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1269,9 +1269,10 @@ int libertas_activate_card(wlan_private *priv)
goto done;
}

priv->assoc_thread =
create_singlethread_workqueue("libertas_assoc");
priv->work_thread = create_singlethread_workqueue("libertas_worker");
INIT_DELAYED_WORK(&priv->assoc_work, libertas_association_worker);
INIT_DELAYED_WORK(&priv->scan_work, libertas_scan_worker);

INIT_WORK(&priv->sync_channel, libertas_sync_channel);

/*
Expand Down Expand Up @@ -1305,7 +1306,7 @@ int libertas_activate_card(wlan_private *priv)
err_init_fw:
priv->hw_unregister_dev(priv);
err_registerdev:
destroy_workqueue(priv->assoc_thread);
destroy_workqueue(priv->work_thread);
/* Stop the thread servicing the interrupts */
wake_up_interruptible(&priv->waitq);
kthread_stop(priv->main_thread);
Expand Down Expand Up @@ -1426,8 +1427,9 @@ int libertas_remove_card(wlan_private *priv)

unregister_netdev(dev);

cancel_delayed_work(&priv->scan_work);
cancel_delayed_work(&priv->assoc_work);
destroy_workqueue(priv->assoc_thread);
destroy_workqueue(priv->work_thread);

if (adapter->psmode == WLAN802_11POWERMODEMAX_PSP) {
adapter->psmode = WLAN802_11POWERMODECAM;
Expand Down
139 changes: 80 additions & 59 deletions trunk/drivers/net/wireless/libertas/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,16 @@ static void wlan_scan_create_channel_list(wlan_private * priv,
}
}


/* Delayed partial scan worker */
void libertas_scan_worker(struct work_struct *work)
{
wlan_private *priv = container_of(work, wlan_private, scan_work.work);

wlan_scan_networks(priv, NULL, 0);
}


/**
* @brief Construct a wlan_scan_cmd_config structure to use in issue scan cmds
*
Expand Down Expand Up @@ -408,7 +418,6 @@ wlan_scan_setup_scan_config(wlan_private * priv,
*pscancurrentonly = 0;

if (puserscanin) {

/* Set the bss type scan filter, use adapter setting if unset */
pscancfgout->bsstype =
puserscanin->bsstype ? puserscanin->bsstype : CMD_BSS_TYPE_ANY;
Expand Down Expand Up @@ -468,59 +477,57 @@ wlan_scan_setup_scan_config(wlan_private * priv,
*/
*ppchantlvout = (struct mrvlietypes_chanlistparamset *) ptlvpos;

if (puserscanin && puserscanin->chanlist[0].channumber) {
if (!puserscanin || !puserscanin->chanlist[0].channumber) {
/* Create a default channel scan list */
lbs_deb_scan("Scan: Creating full region channel list\n");
wlan_scan_create_channel_list(priv, pscanchanlist,
*pfilteredscan);
goto out;
}

lbs_deb_scan("Scan: Using supplied channel list\n");
lbs_deb_scan("Scan: Using supplied channel list\n");
for (chanidx = 0;
chanidx < WLAN_IOCTL_USER_SCAN_CHAN_MAX
&& puserscanin->chanlist[chanidx].channumber; chanidx++) {

for (chanidx = 0;
chanidx < WLAN_IOCTL_USER_SCAN_CHAN_MAX
&& puserscanin->chanlist[chanidx].channumber; chanidx++) {
channel = puserscanin->chanlist[chanidx].channumber;
(pscanchanlist + chanidx)->channumber = channel;

channel = puserscanin->chanlist[chanidx].channumber;
(pscanchanlist + chanidx)->channumber = channel;
radiotype = puserscanin->chanlist[chanidx].radiotype;
(pscanchanlist + chanidx)->radiotype = radiotype;

radiotype = puserscanin->chanlist[chanidx].radiotype;
(pscanchanlist + chanidx)->radiotype = radiotype;
scantype = puserscanin->chanlist[chanidx].scantype;

scantype = puserscanin->chanlist[chanidx].scantype;
if (scantype == CMD_SCAN_TYPE_PASSIVE) {
(pscanchanlist +
chanidx)->chanscanmode.passivescan = 1;
} else {
(pscanchanlist +
chanidx)->chanscanmode.passivescan = 0;
}

if (puserscanin->chanlist[chanidx].scantime) {
scandur = puserscanin->chanlist[chanidx].scantime;
} else {
if (scantype == CMD_SCAN_TYPE_PASSIVE) {
(pscanchanlist +
chanidx)->chanscanmode.passivescan = 1;
} else {
(pscanchanlist +
chanidx)->chanscanmode.passivescan = 0;
}

if (puserscanin->chanlist[chanidx].scantime) {
scandur =
puserscanin->chanlist[chanidx].scantime;
scandur = MRVDRV_PASSIVE_SCAN_CHAN_TIME;
} else {
if (scantype == CMD_SCAN_TYPE_PASSIVE) {
scandur = MRVDRV_PASSIVE_SCAN_CHAN_TIME;
} else {
scandur = MRVDRV_ACTIVE_SCAN_CHAN_TIME;
}
scandur = MRVDRV_ACTIVE_SCAN_CHAN_TIME;
}

(pscanchanlist + chanidx)->minscantime =
cpu_to_le16(scandur);
(pscanchanlist + chanidx)->maxscantime =
cpu_to_le16(scandur);
}

/* Check if we are only scanning the current channel */
if ((chanidx == 1) && (puserscanin->chanlist[0].channumber
==
priv->adapter->curbssparams.channel)) {
*pscancurrentonly = 1;
lbs_deb_scan("Scan: Scanning current channel only");
}
(pscanchanlist + chanidx)->minscantime =
cpu_to_le16(scandur);
(pscanchanlist + chanidx)->maxscantime =
cpu_to_le16(scandur);
}

} else {
lbs_deb_scan("Scan: Creating full region channel list\n");
wlan_scan_create_channel_list(priv, pscanchanlist,
*pfilteredscan);
/* Check if we are only scanning the current channel */
if ((chanidx == 1) &&
(puserscanin->chanlist[0].channumber ==
priv->adapter->curbssparams.channel)) {
*pscancurrentonly = 1;
lbs_deb_scan("Scan: Scanning current channel only");
}

out:
Expand Down Expand Up @@ -604,12 +611,12 @@ static int wlan_scan_channel_list(wlan_private * priv,
while (tlvidx < maxchanperscan && ptmpchan->channumber
&& !doneearly && scanned < 2) {

lbs_deb_scan(
"Scan: Chan(%3d), Radio(%d), mode(%d,%d), Dur(%d)\n",
ptmpchan->channumber, ptmpchan->radiotype,
ptmpchan->chanscanmode.passivescan,
ptmpchan->chanscanmode.disablechanfilt,
ptmpchan->maxscantime);
lbs_deb_scan("Scan: Chan(%3d), Radio(%d), mode(%d,%d), "
"Dur(%d)\n",
ptmpchan->channumber, ptmpchan->radiotype,
ptmpchan->chanscanmode.passivescan,
ptmpchan->chanscanmode.disablechanfilt,
ptmpchan->maxscantime);

/* Copy the current channel TLV to the command being prepared */
memcpy(pchantlvout->chanscanparam + tlvidx,
Expand Down Expand Up @@ -678,9 +685,18 @@ static int wlan_scan_channel_list(wlan_private * priv,
done:
priv->adapter->last_scanned_channel = ptmpchan->channumber;

/* Tell userspace the scan table has been updated */
memset(&wrqu, 0, sizeof(union iwreq_data));
wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
if (priv->adapter->last_scanned_channel) {
/* Schedule the next part of the partial scan */
if (!full_scan && !priv->adapter->surpriseremoved) {
cancel_delayed_work(&priv->scan_work);
queue_delayed_work(priv->work_thread, &priv->scan_work,
msecs_to_jiffies(300));
}
} else {
/* All done, tell userspace the scan table has been updated */
memset(&wrqu, 0, sizeof(union iwreq_data));
wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
}

lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
return ret;
Expand Down Expand Up @@ -747,8 +763,8 @@ clear_selected_scan_list_entries(wlan_adapter * adapter,
* @return 0 or < 0 if error
*/
int wlan_scan_networks(wlan_private * priv,
const struct wlan_ioctl_user_scan_cfg * puserscanin,
int full_scan)
const struct wlan_ioctl_user_scan_cfg * puserscanin,
int full_scan)
{
wlan_adapter * adapter = priv->adapter;
struct mrvlietypes_chanlistparamset *pchantlvout;
Expand All @@ -763,7 +779,13 @@ int wlan_scan_networks(wlan_private * priv,
int i = 0;
#endif

lbs_deb_enter(LBS_DEB_ASSOC);
lbs_deb_enter(LBS_DEB_SCAN);

/* Cancel any partial outstanding partial scans if this scan
* is a full scan.
*/
if (full_scan && delayed_work_pending(&priv->scan_work))
cancel_delayed_work(&priv->scan_work);

scan_chan_list = kzalloc(sizeof(struct chanscanparamset) *
WLAN_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL);
Expand Down Expand Up @@ -1289,7 +1311,10 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,

lbs_deb_enter(LBS_DEB_SCAN);

wlan_scan_networks(priv, NULL, 0);
if (!delayed_work_pending(&priv->scan_work)) {
queue_delayed_work(priv->work_thread, &priv->scan_work,
msecs_to_jiffies(50));
}

if (adapter->surpriseremoved)
return -1;
Expand Down Expand Up @@ -1508,10 +1533,6 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,

lbs_deb_enter(LBS_DEB_ASSOC);

/* If we've got an uncompleted scan, schedule the next part */
if (!adapter->nr_cmd_pending && adapter->last_scanned_channel)
wlan_scan_networks(priv, NULL, 0);

/* Update RSSI if current BSS is a locally created ad-hoc BSS */
if ((adapter->mode == IW_MODE_ADHOC) && adapter->adhoccreate) {
libertas_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/net/wireless/libertas/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,6 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
struct iw_param *vwrq, char *extra);

void libertas_scan_worker(struct work_struct *work);

#endif /* _WLAN_SCAN_H */

0 comments on commit acb7287

Please sign in to comment.