nl80211: Report guard interval and dual carrier modulation

Allows collecting and exposing more information about the station's
current connection from the kernel to the connection manager.

* Add an enum to represent guard interval settings to driver.h.
* Add fields for storing guard interval and dual carrier modulation
  information into the hostap_sta_driver_data struct.
* Add bitmask values indicating the presence of fields.
  * STA_DRV_DATA_TX_HE_DCM
  * STA_DRV_DATA_RX_HE_DCM
  * STA_DRV_DATA_TX_HE_GI
  * STA_DRV_DATA_RX_HE_GI
* Retrieve NL80211_RATE_INFO_HE_GI and NL80211_RATE_INFO_HE_DCM in
  get_sta_handler(), and set appropriate flags.

Signed-off-by: David Ruth <druth@chromium.org>
This commit is contained in:
David Ruth 2023-01-07 07:29:17 +00:00 committed by Jouni Malinen
parent edcad193ae
commit 870a5bdc07
2 changed files with 59 additions and 2 deletions

View file

@ -2317,6 +2317,13 @@ struct wpa_driver_capa {
struct hostapd_data;
enum guard_interval {
GUARD_INTERVAL_0_4 = 1,
GUARD_INTERVAL_0_8 = 2,
GUARD_INTERVAL_1_6 = 3,
GUARD_INTERVAL_3_2 = 4,
};
#define STA_DRV_DATA_TX_MCS BIT(0)
#define STA_DRV_DATA_RX_MCS BIT(1)
#define STA_DRV_DATA_TX_VHT_MCS BIT(2)
@ -2331,6 +2338,10 @@ struct hostapd_data;
#define STA_DRV_DATA_RX_HE_MCS BIT(11)
#define STA_DRV_DATA_TX_HE_NSS BIT(12)
#define STA_DRV_DATA_RX_HE_NSS BIT(13)
#define STA_DRV_DATA_TX_HE_DCM BIT(14)
#define STA_DRV_DATA_RX_HE_DCM BIT(15)
#define STA_DRV_DATA_TX_HE_GI BIT(16)
#define STA_DRV_DATA_RX_HE_GI BIT(17)
struct hostap_sta_driver_data {
unsigned long rx_packets, tx_packets;
@ -2368,6 +2379,8 @@ struct hostap_sta_driver_data {
s8 avg_signal; /* dBm */
s8 avg_beacon_signal; /* dBm */
s8 avg_ack_signal; /* dBm */
enum guard_interval rx_guard_interval, tx_guard_interval;
u8 rx_dcm, tx_dcm;
};
struct hostapd_sta_add_params {

View file

@ -7384,6 +7384,8 @@ static int get_sta_handler(struct nl_msg *msg, void *arg)
[NL80211_RATE_INFO_VHT_NSS] = { .type = NLA_U8 },
[NL80211_RATE_INFO_HE_MCS] = { .type = NLA_U8 },
[NL80211_RATE_INFO_HE_NSS] = { .type = NLA_U8 },
[NL80211_RATE_INFO_HE_GI] = { .type = NLA_U8 },
[NL80211_RATE_INFO_HE_DCM] = { .type = NLA_U8 },
};
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
@ -7507,8 +7509,10 @@ static int get_sta_handler(struct nl_msg *msg, void *arg)
nla_get_u8(rate[NL80211_RATE_INFO_VHT_MCS]);
data->flags |= STA_DRV_DATA_TX_VHT_MCS;
}
if (rate[NL80211_RATE_INFO_SHORT_GI])
if (rate[NL80211_RATE_INFO_SHORT_GI]) {
data->tx_guard_interval = GUARD_INTERVAL_0_4;
data->flags |= STA_DRV_DATA_TX_SHORT_GI;
}
if (rate[NL80211_RATE_INFO_VHT_NSS]) {
data->tx_vht_nss =
nla_get_u8(rate[NL80211_RATE_INFO_VHT_NSS]);
@ -7524,6 +7528,25 @@ static int get_sta_handler(struct nl_msg *msg, void *arg)
nla_get_u8(rate[NL80211_RATE_INFO_HE_NSS]);
data->flags |= STA_DRV_DATA_TX_HE_NSS;
}
if (rate[NL80211_RATE_INFO_HE_GI]) {
switch (nla_get_u8(rate[NL80211_RATE_INFO_HE_GI])) {
case NL80211_RATE_INFO_HE_GI_0_8:
data->tx_guard_interval = GUARD_INTERVAL_0_8;
break;
case NL80211_RATE_INFO_HE_GI_1_6:
data->tx_guard_interval = GUARD_INTERVAL_1_6;
break;
case NL80211_RATE_INFO_HE_GI_3_2:
data->tx_guard_interval = GUARD_INTERVAL_3_2;
break;
}
data->flags |= STA_DRV_DATA_TX_HE_GI;
}
if (rate[NL80211_RATE_INFO_HE_DCM]) {
data->tx_dcm =
nla_get_u8(rate[NL80211_RATE_INFO_HE_DCM]);
data->flags |= STA_DRV_DATA_TX_HE_DCM;
}
}
if (stats[NL80211_STA_INFO_RX_BITRATE] &&
@ -7550,8 +7573,10 @@ static int get_sta_handler(struct nl_msg *msg, void *arg)
nla_get_u8(rate[NL80211_RATE_INFO_VHT_MCS]);
data->flags |= STA_DRV_DATA_RX_VHT_MCS;
}
if (rate[NL80211_RATE_INFO_SHORT_GI])
if (rate[NL80211_RATE_INFO_SHORT_GI]) {
data->rx_guard_interval = GUARD_INTERVAL_0_4;
data->flags |= STA_DRV_DATA_RX_SHORT_GI;
}
if (rate[NL80211_RATE_INFO_VHT_NSS]) {
data->rx_vht_nss =
nla_get_u8(rate[NL80211_RATE_INFO_VHT_NSS]);
@ -7567,6 +7592,25 @@ static int get_sta_handler(struct nl_msg *msg, void *arg)
nla_get_u8(rate[NL80211_RATE_INFO_HE_NSS]);
data->flags |= STA_DRV_DATA_RX_HE_NSS;
}
if (rate[NL80211_RATE_INFO_HE_GI]) {
switch (nla_get_u8(rate[NL80211_RATE_INFO_HE_GI])) {
case NL80211_RATE_INFO_HE_GI_0_8:
data->rx_guard_interval = GUARD_INTERVAL_0_8;
break;
case NL80211_RATE_INFO_HE_GI_1_6:
data->rx_guard_interval = GUARD_INTERVAL_1_6;
break;
case NL80211_RATE_INFO_HE_GI_3_2:
data->rx_guard_interval = GUARD_INTERVAL_3_2;
break;
}
data->flags |= STA_DRV_DATA_RX_HE_GI;
}
if (rate[NL80211_RATE_INFO_HE_DCM]) {
data->rx_dcm =
nla_get_u8(rate[NL80211_RATE_INFO_HE_DCM]);
data->flags |= STA_DRV_DATA_RX_HE_DCM;
}
}
if (stats[NL80211_STA_INFO_TID_STATS])