Skip to contentSkip to conversation

RRM start time changes

PATCH James Prestwood 1 participant 1 message Nov 21, 2019

lore
Share & tools
lore
#0 lore raw

Sending as attachments due to weird non-ascii character fix

From 03da71fc7c2a73ac1b6300b36c55f96c71057823 Mon Sep 17 00:00:00 2001
From: James Prestwood <[email protected]>
Date: Thu, 21 Nov 2019 12:07:00 -0800
Subject: [PATCH 1/4] rrm: fix non-ascii character in comment

---
 src/rrm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/rrm.c +1 -1
index 2b0a22fb..ddf8e395 100644
@@ -274,7 +274,7 @@ static size_t build_report_for_bss(struct rrm_beacon_req_info *beacon,
 	 * 802.11 9.4.2.22.7 Beacon report
 	 *
 	 * "The Parent TSF field contains the lower 4 octets of the measuring
-	 *  STA’s TSF timer value"
+	 *  STA's TSF timer value"
 	 */
 	l_put_le32((uint32_t)(bss->parent_tsf & 0xffffffff), to);
 	to += 4;
Signature · 1 line
2.17.1

From 87765d9fc452c72a911a2d20ebbfb12004109587 Mon Sep 17 00:00:00 2001
From: James Prestwood <[email protected]>
Date: Tue, 19 Nov 2019 14:10:23 -0800
Subject: [PATCH 2/4] scan: parse the scan start time

The kernel sends NL80211_ATTR_SCAN_START_TIME_TSF with CMD_TRIGGER and RRM requires this value for beacon measurement reports.

The start time is parsed during CMD_TRIGGER and set into the scan request. A getter was added to obtain this time value for an already triggered scan.

After making the change, the SCAN_ABORTED case was cleaned up a bit to remove the local scan_request usage in favor of the one used for all the other cases.

---
 src/scan.c | 41 ++++++++++++++++++++++++++++++++++-------
 src/scan.h |  2 ++
 2 files changed, 36 insertions(+), 7 deletions(-)
src/scan.c +34 -7

94 lines not on this page · raw message

src/scan.h +2 -0
index 8fc2aa56..b6c4e12d 100644
@@ -124,6 +124,8 @@ void scan_periodic_start(uint64_t wdev_id, scan_trigger_func_t trigger,
 				scan_notify_func_t func, void *userdata);
 bool scan_periodic_stop(uint64_t wdev_id);
 
+uint64_t scan_get_triggered_time(uint64_t wdev_id, uint32_t id);
+
 void scan_bss_free(struct scan_bss *bss);
 int scan_bss_rank_compare(const void *a, const void *b, void *user);
 
Signature · 1 line
2.17.1

From 1e37ba22fa67e4117c31a3ac2151afa4c59b17b3 Mon Sep 17 00:00:00 2001
From: James Prestwood <[email protected]>
Date: Wed, 20 Nov 2019 08:52:53 -0800
Subject: [PATCH 3/4] rrm: include actual scan start time in report

---
 src/rrm.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
src/rrm.c +9 -2
index ddf8e395..660565eb 100644
@@ -109,6 +109,7 @@ struct rrm_beacon_req_info {
 	char ssid[33];		/* Request filtered by SSID */
 	bool has_ssid;
 	uint32_t scan_id;
+	uint64_t scan_start_time;
 };
 
 /* Per-netdev state */
@@ -249,8 +250,7 @@ static size_t build_report_for_bss(struct rrm_beacon_req_info *beacon,
 
 	*to++ = beacon->oper_class;
 	*to++ = scan_freq_to_channel(bss->frequency, NULL);
-	/* skip start time */
-	memset(to, 0, 8);
+	l_put_le64(beacon->scan_start_time, to);
 	to += 8;
 	l_put_le16(beacon->duration, to);
 	to += 2;
@@ -390,11 +390,18 @@ static bool rrm_scan_results(int err, struct l_queue *bss_list, void *userdata)
 static void rrm_scan_triggered(int err, void *userdata)
 {
 	struct rrm_state *rrm = userdata;
+	struct rrm_beacon_req_info *beacon = l_container_of(rrm->pending,
+						struct rrm_beacon_req_info,
+						info);
 
 	if (err < 0) {
 		l_error("Could not start RRM scan");
 		rrm_reject_measurement_request(rrm, REPORT_REJECT_INCAPABLE);
+		return;
 	}
+
+	beacon->scan_start_time = scan_get_triggered_time(rrm->wdev_id,
+							beacon->scan_id);
 }
 
 static void rrm_handle_beacon_scan(struct rrm_state *rrm,
Signature · 1 line
2.17.1

From 8c9aea528163cb39e283cd0e5772578f4335b77d Mon Sep 17 00:00:00 2001
From: James Prestwood <[email protected]>
Date: Wed, 20 Nov 2019 09:11:07 -0800
Subject: [PATCH 4/4] rrm: add packed struct for beacon reports

build_report_for_bss was refactored to use this packed structure rather than l_put_* APIs.

---
 src/rrm.c | 66 ++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 41 insertions(+), 25 deletions(-)
src/rrm.c +41 -25

98 lines not on this page · raw message

Signature · 1 line
2.17.1