wlcore: Set rx_status boottime_ns field on rx

Message ID 1532709023-1237-1-git-send-email-loic.poulain@linaro.org
State New
Headers show
Series
  • wlcore: Set rx_status boottime_ns field on rx
Related show

Commit Message

Loic Poulain July 27, 2018, 4:30 p.m.
When receiving a beacon or probe response, we should update the
boottime_ns field which is the timestamp the frame was received at.
(cf mac80211.h)

This fixes a scanning issue with Android since it relies on this
timestamp to determine when the AP has been seen for the last time
(via the nl80211 BSS_LAST_SEEN_BOOTTIME parameter).

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

---
 drivers/net/wireless/ti/wlcore/rx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

-- 
2.7.4

Comments

Kalle Valo July 31, 2018, 7:24 a.m. | #1
Loic Poulain <loic.poulain@linaro.org> wrote:

> When receiving a beacon or probe response, we should update the

> boottime_ns field which is the timestamp the frame was received at.

> (cf mac80211.h)

> 

> This fixes a scanning issue with Android since it relies on this

> timestamp to determine when the AP has been seen for the last time

> (via the nl80211 BSS_LAST_SEEN_BOOTTIME parameter).

> 

> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>


Patch applied to wireless-drivers-next.git, thanks.

37a634f60fd6 wlcore: Set rx_status boottime_ns field on rx

-- 
https://patchwork.kernel.org/patch/10547433/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

Patch

diff --git a/drivers/net/wireless/ti/wlcore/rx.c b/drivers/net/wireless/ti/wlcore/rx.c
index 0f15696..078a494 100644
--- a/drivers/net/wireless/ti/wlcore/rx.c
+++ b/drivers/net/wireless/ti/wlcore/rx.c
@@ -59,7 +59,7 @@  static u32 wlcore_rx_get_align_buf_size(struct wl1271 *wl, u32 pkt_len)
 static void wl1271_rx_status(struct wl1271 *wl,
 			     struct wl1271_rx_descriptor *desc,
 			     struct ieee80211_rx_status *status,
-			     u8 beacon)
+			     u8 beacon, u8 probe_rsp)
 {
 	memset(status, 0, sizeof(struct ieee80211_rx_status));
 
@@ -106,6 +106,9 @@  static void wl1271_rx_status(struct wl1271 *wl,
 		}
 	}
 
+	if (beacon || probe_rsp)
+		status->boottime_ns = ktime_get_boot_ns();
+
 	if (beacon)
 		wlcore_set_pending_regdomain_ch(wl, (u16)desc->channel,
 						status->band);
@@ -191,7 +194,8 @@  static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length,
 	if (ieee80211_is_data_present(hdr->frame_control))
 		is_data = 1;
 
-	wl1271_rx_status(wl, desc, IEEE80211_SKB_RXCB(skb), beacon);
+	wl1271_rx_status(wl, desc, IEEE80211_SKB_RXCB(skb), beacon,
+			 ieee80211_is_probe_resp(hdr->frame_control));
 	wlcore_hw_set_rx_csum(wl, desc, skb);
 
 	seq_num = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4;