Report the time since last beacon was received for each beaconing peer to userspace. In MLO, this information is reported per link and additionally, it is reported at the MLD level, the timestamp of the most recently received beacon across all affiliated links to give a unified view of beacon reception status. This allows applications to detect potential beacon misses and make informed decisions. Signed-off-by: Maharaja Kennadyrajan --- include/net/cfg80211.h | 9 +++++++++ include/uapi/linux/nl80211.h | 2 ++ net/wireless/nl80211.c | 3 +++ 3 files changed, 14 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 406626ff6cc8..58e0c07b0e31 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2094,6 +2094,9 @@ struct cfg80211_tid_stats { * an FCS error. This counter should be incremented only when TA of the * received packet with an FCS error matches the peer MAC address. * @addr: For MLO STA connection, filled with address of the link of station. + * @last_beacon_seen_msec_ago: Time (in milliseconds) since the last beacon + * was received from this link of station. This is useful for + * monitoring beacon reception status per link in MLO scenario. */ struct link_station_info { u64 filled; @@ -2137,6 +2140,8 @@ struct link_station_info { u32 fcs_err_count; u8 addr[ETH_ALEN] __aligned(2); + + u32 last_beacon_seen_msec_ago; }; /** @@ -2228,6 +2233,8 @@ struct link_station_info { * get_station() and dump_station() callbacks. * @links: reference to Link sta entries for MLO STA, all link specific * information is accessed through links[link_id]. + * @last_beacon_seen_msec_ago: Time since last beacon is received in + * milliseconds. */ struct station_info { u64 filled; @@ -2295,6 +2302,8 @@ struct station_info { u16 valid_links; struct link_station_info *links[IEEE80211_MLD_MAX_NUM_LINKS]; + + u32 last_beacon_seen_msec_ago; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index d1a14f2892d9..5ad31418b4a3 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -3975,6 +3975,7 @@ enum nl80211_sta_bss_param { * of STA's association * @NL80211_STA_INFO_CONNECTED_TO_AS: set to true if STA has a path to a * authentication server (u8, 0 or 1) + * @NL80211_STA_INFO_BEACON_SEEN_MSEC_AGO: time since last beacon is received (u32, msecs) * @__NL80211_STA_INFO_AFTER_LAST: internal * @NL80211_STA_INFO_MAX: highest possible station info attribute */ @@ -4023,6 +4024,7 @@ enum nl80211_sta_info { NL80211_STA_INFO_AIRTIME_LINK_METRIC, NL80211_STA_INFO_ASSOC_AT_BOOTTIME, NL80211_STA_INFO_CONNECTED_TO_AS, + NL80211_STA_INFO_BEACON_SEEN_MSEC_AGO, /* keep last */ __NL80211_STA_INFO_AFTER_LAST, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 89519aa52893..08102cf347c9 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6963,6 +6963,8 @@ static int nl80211_fill_link_station(struct sk_buff *msg, PUT_LINK_SINFO(TX_FAILED, tx_failed, u32); PUT_LINK_SINFO(EXPECTED_THROUGHPUT, expected_throughput, u32); PUT_LINK_SINFO(BEACON_LOSS, beacon_loss_count, u32); + PUT_LINK_SINFO(BEACON_SEEN_MSEC_AGO, last_beacon_seen_msec_ago, + u32); if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_BSS_PARAM)) { bss_param = nla_nest_start_noflag(msg, @@ -7161,6 +7163,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, PUT_SINFO(TX_FAILED, tx_failed, u32); PUT_SINFO(EXPECTED_THROUGHPUT, expected_throughput, u32); PUT_SINFO(BEACON_LOSS, beacon_loss_count, u32); + PUT_SINFO(BEACON_SEEN_MSEC_AGO, last_beacon_seen_msec_ago, u32); PUT_SINFO(LLID, llid, u16); PUT_SINFO(PLID, plid, u16); -- 2.17.1