diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 0acc0958a..fdf9d197b 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1768,6 +1768,8 @@ struct hostap_sta_driver_data { unsigned long tx_retry_failed; unsigned long tx_retry_count; s8 last_ack_rssi; + unsigned long backlog_packets; + unsigned long backlog_bytes; s8 signal; u8 rx_vhtmcs; u8 tx_vhtmcs; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index ef37c8bcd..ff97720b2 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -6262,6 +6262,36 @@ static int i802_flush(void *priv) } +static void get_sta_tid_stats(struct hostap_sta_driver_data *data, + struct nlattr *attr) +{ + struct nlattr *tid_stats[NL80211_TID_STATS_MAX + 1], *tidattr; + struct nlattr *txq_stats[NL80211_TXQ_STATS_MAX + 1]; + static struct nla_policy txq_stats_policy[NL80211_TXQ_STATS_MAX + 1] = { + [NL80211_TXQ_STATS_BACKLOG_BYTES] = { .type = NLA_U32 }, + [NL80211_TXQ_STATS_BACKLOG_PACKETS] = { .type = NLA_U32 }, + }; + int rem; + + nla_for_each_nested(tidattr, attr, rem) { + if (nla_parse_nested(tid_stats, NL80211_TID_STATS_MAX, + tidattr, NULL) != 0 || + !tid_stats[NL80211_TID_STATS_TXQ_STATS] || + nla_parse_nested(txq_stats, NL80211_TXQ_STATS_MAX, + tid_stats[NL80211_TID_STATS_TXQ_STATS], + txq_stats_policy) != 0) + continue; + /* sum the backlogs over all TIDs for station */ + if (txq_stats[NL80211_TXQ_STATS_BACKLOG_BYTES]) + data->backlog_bytes += nla_get_u32( + txq_stats[NL80211_TXQ_STATS_BACKLOG_BYTES]); + if (txq_stats[NL80211_TXQ_STATS_BACKLOG_PACKETS]) + data->backlog_bytes += nla_get_u32( + txq_stats[NL80211_TXQ_STATS_BACKLOG_PACKETS]); + } +} + + static int get_sta_handler(struct nl_msg *msg, void *arg) { struct nlattr *tb[NL80211_ATTR_MAX + 1]; @@ -6406,6 +6436,9 @@ static int get_sta_handler(struct nl_msg *msg, void *arg) } } + if (stats[NL80211_STA_INFO_TID_STATS]) + get_sta_tid_stats(data, stats[NL80211_STA_INFO_TID_STATS]); + return NL_SKIP; } @@ -10904,6 +10937,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = { .sta_remove = driver_nl80211_sta_remove, .hapd_send_eapol = wpa_driver_nl80211_hapd_send_eapol, .sta_set_flags = wpa_driver_nl80211_sta_set_flags, + .sta_set_airtime_weight = driver_nl80211_sta_set_airtime_weight, .hapd_init = i802_init, .hapd_deinit = i802_deinit, .set_wds_sta = i802_set_wds_sta,