Commit ab60633c authored by Narayanraddi Masti's avatar Narayanraddi Masti Committed by Johannes Berg

mac80211: Add support for NL80211_STA_INFO_AIRTIME_LINK_METRIC

Add support for mesh airtime link metric attribute
NL80211_STA_INFO_AIRTIME_LINK_METRIC.
Signed-off-by: default avatarNarayanraddi Masti <team.nmasti@gmail.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 1e1b11b6
...@@ -1327,6 +1327,7 @@ struct cfg80211_tid_stats { ...@@ -1327,6 +1327,7 @@ struct cfg80211_tid_stats {
* @fcs_err_count: number of packets (MPDUs) received from this station with * @fcs_err_count: number of packets (MPDUs) received from this station with
* an FCS error. This counter should be incremented only when TA of the * an FCS error. This counter should be incremented only when TA of the
* received packet with an FCS error matches the peer MAC address. * received packet with an FCS error matches the peer MAC address.
* @airtime_link_metric: mesh airtime link metric.
*/ */
struct station_info { struct station_info {
u64 filled; u64 filled;
...@@ -1381,6 +1382,8 @@ struct station_info { ...@@ -1381,6 +1382,8 @@ struct station_info {
u32 rx_mpdu_count; u32 rx_mpdu_count;
u32 fcs_err_count; u32 fcs_err_count;
u32 airtime_link_metric;
}; };
#if IS_ENABLED(CONFIG_CFG80211) #if IS_ENABLED(CONFIG_CFG80211)
......
...@@ -3139,6 +3139,7 @@ enum nl80211_sta_bss_param { ...@@ -3139,6 +3139,7 @@ enum nl80211_sta_bss_param {
* @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames * @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames
* sent to the station (u64, usec) * sent to the station (u64, usec)
* @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16) * @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16)
* @NL80211_STA_INFO_AIRTIME_LINK_METRIC: airtime link metric for mesh station
* @__NL80211_STA_INFO_AFTER_LAST: internal * @__NL80211_STA_INFO_AFTER_LAST: internal
* @NL80211_STA_INFO_MAX: highest possible station info attribute * @NL80211_STA_INFO_MAX: highest possible station info attribute
*/ */
...@@ -3184,6 +3185,7 @@ enum nl80211_sta_info { ...@@ -3184,6 +3185,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_CONNECTED_TO_GATE, NL80211_STA_INFO_CONNECTED_TO_GATE,
NL80211_STA_INFO_TX_DURATION, NL80211_STA_INFO_TX_DURATION,
NL80211_STA_INFO_AIRTIME_WEIGHT, NL80211_STA_INFO_AIRTIME_WEIGHT,
NL80211_STA_INFO_AIRTIME_LINK_METRIC,
/* keep last */ /* keep last */
__NL80211_STA_INFO_AFTER_LAST, __NL80211_STA_INFO_AFTER_LAST,
......
...@@ -278,6 +278,8 @@ mesh_path_add(struct ieee80211_sub_if_data *sdata, const u8 *dst); ...@@ -278,6 +278,8 @@ mesh_path_add(struct ieee80211_sub_if_data *sdata, const u8 *dst);
int mesh_path_add_gate(struct mesh_path *mpath); int mesh_path_add_gate(struct mesh_path *mpath);
int mesh_path_send_to_gates(struct mesh_path *mpath); int mesh_path_send_to_gates(struct mesh_path *mpath);
int mesh_gate_num(struct ieee80211_sub_if_data *sdata); int mesh_gate_num(struct ieee80211_sub_if_data *sdata);
u32 airtime_link_metric_get(struct ieee80211_local *local,
struct sta_info *sta);
/* Mesh plinks */ /* Mesh plinks */
void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata, void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata,
......
...@@ -318,8 +318,8 @@ void ieee80211s_update_metric(struct ieee80211_local *local, ...@@ -318,8 +318,8 @@ void ieee80211s_update_metric(struct ieee80211_local *local,
cfg80211_calculate_bitrate(&rinfo)); cfg80211_calculate_bitrate(&rinfo));
} }
static u32 airtime_link_metric_get(struct ieee80211_local *local, u32 airtime_link_metric_get(struct ieee80211_local *local,
struct sta_info *sta) struct sta_info *sta)
{ {
/* This should be adjusted for each device */ /* This should be adjusted for each device */
int device_constant = 1 << ARITH_SHIFT; int device_constant = 1 << ARITH_SHIFT;
......
...@@ -2373,6 +2373,12 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, ...@@ -2373,6 +2373,12 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
sinfo->filled |= sinfo->filled |=
BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG); BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG);
} }
if (ieee80211_vif_is_mesh(&sdata->vif)) {
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_LINK_METRIC);
sinfo->airtime_link_metric =
airtime_link_metric_get(local, sta);
}
} }
u32 sta_get_expected_throughput(struct sta_info *sta) u32 sta_get_expected_throughput(struct sta_info *sta)
......
...@@ -4898,6 +4898,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, ...@@ -4898,6 +4898,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
PUT_SINFO(TX_RETRIES, tx_retries, u32); PUT_SINFO(TX_RETRIES, tx_retries, u32);
PUT_SINFO(TX_FAILED, tx_failed, u32); PUT_SINFO(TX_FAILED, tx_failed, u32);
PUT_SINFO(EXPECTED_THROUGHPUT, expected_throughput, u32); PUT_SINFO(EXPECTED_THROUGHPUT, expected_throughput, u32);
PUT_SINFO(AIRTIME_LINK_METRIC, airtime_link_metric, u32);
PUT_SINFO(BEACON_LOSS, beacon_loss_count, u32); PUT_SINFO(BEACON_LOSS, beacon_loss_count, u32);
PUT_SINFO(LOCAL_PM, local_pm, u32); PUT_SINFO(LOCAL_PM, local_pm, u32);
PUT_SINFO(PEER_PM, peer_pm, u32); PUT_SINFO(PEER_PM, peer_pm, u32);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment