svn commit: r282383 - head/sys/dev/wpi
Adrian Chadd
adrian at FreeBSD.org
Sun May 3 23:03:07 UTC 2015
Author: adrian
Date: Sun May 3 23:03:06 2015
New Revision: 282383
URL: https://svnweb.freebsd.org/changeset/base/282383
Log:
Fix pause scan time calculation (the remainder must be less than beacon interval).
PR: kern/197143
Submitted by: Andriy Voskoboinyk <s3erios at gmail.com>
Modified:
head/sys/dev/wpi/if_wpi.c
head/sys/dev/wpi/if_wpireg.h
Modified: head/sys/dev/wpi/if_wpi.c
==============================================================================
--- head/sys/dev/wpi/if_wpi.c Sun May 3 22:56:36 2015 (r282382)
+++ head/sys/dev/wpi/if_wpi.c Sun May 3 23:03:06 2015 (r282383)
@@ -228,6 +228,7 @@ static uint16_t wpi_get_active_dwell_tim
static uint16_t wpi_limit_dwell(struct wpi_softc *, uint16_t);
static uint16_t wpi_get_passive_dwell_time(struct wpi_softc *,
struct ieee80211_channel *);
+static uint32_t wpi_get_scan_pause_time(uint32_t, uint16_t);
static int wpi_scan(struct wpi_softc *, struct ieee80211_channel *);
static int wpi_auth(struct wpi_softc *, struct ieee80211vap *);
static int wpi_config_beacon(struct wpi_vap *);
@@ -3864,6 +3865,18 @@ wpi_get_passive_dwell_time(struct wpi_so
return (wpi_limit_dwell(sc, passive));
}
+static uint32_t
+wpi_get_scan_pause_time(uint32_t time, uint16_t bintval)
+{
+ uint32_t mod = (time % bintval) * IEEE80211_DUR_TU;
+ uint32_t nbeacons = time / bintval;
+
+ if (mod > WPI_PAUSE_MAX_TIME)
+ mod = WPI_PAUSE_MAX_TIME;
+
+ return WPI_PAUSE_SCAN(nbeacons, mod);
+}
+
/*
* Send a scan request to the firmware.
*/
@@ -3921,13 +3934,17 @@ wpi_scan(struct wpi_softc *sc, struct ie
*/
hdr->quiet_time = htole16(WPI_QUIET_TIME_DEFAULT);
hdr->quiet_threshold = htole16(1);
- /*
- * Max needs to be greater than active and passive and quiet!
- * It's also in microseconds!
- */
- hdr->max_svc = htole32(250 * IEEE80211_DUR_TU);
- hdr->pause_svc = htole32((4 << 24) |
- (100 * IEEE80211_DUR_TU)); /* Hardcode for now */
+
+ if (bgscan != 0) {
+ /*
+ * Max needs to be greater than active and passive and quiet!
+ * It's also in microseconds!
+ */
+ hdr->max_svc = htole32(250 * IEEE80211_DUR_TU);
+ hdr->pause_svc = htole32(wpi_get_scan_pause_time(100,
+ bintval));
+ }
+
hdr->filter = htole32(WPI_FILTER_MULTICAST | WPI_FILTER_BEACON);
tx = (struct wpi_cmd_data *)(hdr + 1);
Modified: head/sys/dev/wpi/if_wpireg.h
==============================================================================
--- head/sys/dev/wpi/if_wpireg.h Sun May 3 22:56:36 2015 (r282382)
+++ head/sys/dev/wpi/if_wpireg.h Sun May 3 23:03:06 2015 (r282383)
@@ -619,6 +619,9 @@ struct wpi_scan_hdr {
uint16_t reserved2;
uint32_t max_svc; /* background scans */
uint32_t pause_svc; /* background scans */
+#define WPI_PAUSE_MAX_TIME ((1 << 20) - 1)
+#define WPI_PAUSE_SCAN(nbeacons, time) ((nbeacons << 24) | time)
+
uint32_t flags;
uint32_t filter;
More information about the svn-src-head
mailing list