]> www.infradead.org Git - users/hch/misc.git/commitdiff
mt76: fill boottime_ns in Rx path
authorRyder Lee <ryder.lee@mediatek.com>
Tue, 24 Aug 2021 20:35:16 +0000 (04:35 +0800)
committerFelix Fietkau <nbd@nbd.name>
Wed, 20 Oct 2021 08:36:39 +0000 (10:36 +0200)
Give a proper boottime_ns value for netlink RX to avoid scan
issues with Android.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mac80211.c

index a8695d3d359eda0bf5229ffe84f65a9e7e6f9819..bbe7ba64ccd275de6616944d96dc780378a20da8 100644 (file)
@@ -801,6 +801,7 @@ mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb,
                struct ieee80211_sta **sta)
 {
        struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
+       struct ieee80211_hdr *hdr = mt76_skb_get_hdr(skb);
        struct mt76_rx_status mstat;
 
        mstat = *((struct mt76_rx_status *)skb->cb);
@@ -823,6 +824,10 @@ mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb,
        status->device_timestamp = mstat.timestamp;
        status->mactime = mstat.timestamp;
 
+       if (ieee80211_is_beacon(hdr->frame_control) ||
+           ieee80211_is_probe_resp(hdr->frame_control))
+               status->boottime_ns = ktime_get_boottime_ns();
+
        BUILD_BUG_ON(sizeof(mstat) > sizeof(skb->cb));
        BUILD_BUG_ON(sizeof(status->chain_signal) !=
                     sizeof(mstat.chain_signal));