From 72123a84cb004bf5f93dbaf86feb847636e99c22 Mon Sep 17 00:00:00 2001 From: Bhagavathi Perumal S Date: Tue, 6 Mar 2018 14:30:11 +0530 Subject: [PATCH] hostapd: Add last_ack_rssi into ctrl iface cmd STA This allows external application to get last ACK signal strength of the last transmitted frame if the driver makes this information (NL80211_STA_INFO_ACK_SIGNAL) available. Signed-off-by: Bhagavathi Perumal S Signed-off-by: Venkateswara Naralasetty --- src/ap/ctrl_iface_ap.c | 7 +++++++ src/drivers/driver.h | 4 ++-- src/drivers/driver_nl80211.c | 6 ++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c index 883b005b2..f230bd419 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -153,6 +153,13 @@ static int hostapd_get_sta_tx_rx(struct hostapd_data *hapd, supported_mcs_set); } + if (data.flags & STA_DRV_DATA_LAST_ACK_RSSI) { + ret = os_snprintf(buf + len, buflen - len, + "last_ack_signal=%d\n", data.last_ack_rssi); + if (!os_snprintf_error(buflen - len, ret)) + len += ret; + } + return len; } diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 92a58b2f2..01204bed2 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1694,6 +1694,7 @@ struct hostapd_data; #define STA_DRV_DATA_RX_VHT_NSS BIT(5) #define STA_DRV_DATA_TX_SHORT_GI BIT(6) #define STA_DRV_DATA_RX_SHORT_GI BIT(7) +#define STA_DRV_DATA_LAST_ACK_RSSI BIT(8) struct hostap_sta_driver_data { unsigned long rx_packets, tx_packets; @@ -1706,8 +1707,7 @@ struct hostap_sta_driver_data { unsigned long num_ps_buf_frames; unsigned long tx_retry_failed; unsigned long tx_retry_count; - int last_rssi; - int last_ack_rssi; + s8 last_ack_rssi; s8 signal; u8 rx_vhtmcs; u8 tx_vhtmcs; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 329be021b..f7421c4bf 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -6049,6 +6049,7 @@ static int get_sta_handler(struct nl_msg *msg, void *arg) [NL80211_STA_INFO_RX_BYTES64] = { .type = NLA_U64 }, [NL80211_STA_INFO_TX_BYTES64] = { .type = NLA_U64 }, [NL80211_STA_INFO_SIGNAL] = { .type = NLA_U8 }, + [NL80211_STA_INFO_ACK_SIGNAL] = { .type = NLA_U8 }, }; struct nlattr *rate[NL80211_RATE_INFO_MAX + 1]; static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = { @@ -6111,6 +6112,11 @@ static int get_sta_handler(struct nl_msg *msg, void *arg) nla_get_u32(stats[NL80211_STA_INFO_TX_FAILED]); if (stats[NL80211_STA_INFO_SIGNAL]) data->signal = nla_get_u8(stats[NL80211_STA_INFO_SIGNAL]); + if (stats[NL80211_STA_INFO_ACK_SIGNAL]) { + data->last_ack_rssi = + nla_get_u8(stats[NL80211_STA_INFO_ACK_SIGNAL]); + data->flags |= STA_DRV_DATA_LAST_ACK_RSSI; + } if (stats[NL80211_STA_INFO_TX_BITRATE] && nla_parse_nested(rate, NL80211_RATE_INFO_MAX,