From 5674c531bbdaf429b48da35c9e02305ad4cced07 Mon Sep 17 00:00:00 2001
From: Javier Cardona <javier@cozybit.com>
Date: Thu, 25 Sep 2008 16:37:12 -0700
Subject: [PATCH] libertas: Do not schedule a scan when one is in progress.
wpa_supplicant will do a scan before associating. After reasonable period of
time, it will try to read the results via a get_scan_results ioctl
(SIOCGIWSCAN). If no results are available (for instance if the driver
returns -EAGAIN) the supplicant will request another scan via the set_scan
ioctl (SIOCSIWSCAN).
When receiving the -EAGAIN error the caller should just retry a SIOCGIWSCAN.
But wpa_supplicant does not check the return error and just re-issues a
SIOCSIWSCAN in all cases, which worsens the problem. So a better fix for this
problem would probably be in wpa_supplicant.
But for now we can address this problem in the driver by not scheduling new
scans when one is in progress.
Also, modify lbs_get_scan so that -EAGAIN errors show up in debug logs.
---
drivers/net/wireless/libertas/scan.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 69f94c9..18f2377 100644
|
a
|
b
|
|
| 1372 | 1372 | } |
| 1373 | 1373 | */ |
| 1374 | 1374 | |
| | 1375 | if (priv->last_scanned_channel) { |
| | 1376 | lbs_deb_scan("scan in progress: ignore scan req\n"); |
| | 1377 | goto out; |
| | 1378 | } |
| | 1379 | |
| 1375 | 1380 | if (!delayed_work_pending(&priv->scan_work)) |
| 1376 | 1381 | queue_delayed_work(priv->work_thread, &priv->scan_work, |
| 1377 | 1382 | msecs_to_jiffies(50)); |
| … |
… |
|
| 1381 | 1386 | if (priv->surpriseremoved) |
| 1382 | 1387 | return -EIO; |
| 1383 | 1388 | |
| | 1389 | out: |
| 1384 | 1390 | lbs_deb_leave(LBS_DEB_SCAN); |
| 1385 | 1391 | return 0; |
| 1386 | 1392 | } |
| … |
… |
|
| 1410 | 1416 | lbs_deb_enter(LBS_DEB_SCAN); |
| 1411 | 1417 | |
| 1412 | 1418 | /* iwlist should wait until the current scan is finished */ |
| 1413 | | if (priv->last_scanned_channel) |
| 1414 | | return -EAGAIN; |
| | 1419 | if (priv->last_scanned_channel) { |
| | 1420 | err = -EAGAIN; |
| | 1421 | goto out; |
| | 1422 | } |
| 1415 | 1423 | |
| 1416 | 1424 | /* Update RSSI if current BSS is a locally created ad-hoc BSS */ |
| 1417 | 1425 | if ((priv->mode == IW_MODE_ADHOC) && priv->adhoccreate) { |
| … |
… |
|
| 1453 | 1461 | dwrq->length = (ev - extra); |
| 1454 | 1462 | dwrq->flags = 0; |
| 1455 | 1463 | |
| | 1464 | out: |
| 1456 | 1465 | lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", err); |
| 1457 | 1466 | return err; |
| 1458 | 1467 | } |