summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayanraddi Masti <team.nmasti@gmail.com>2019-02-07 15:16:05 -0500
committerJohannes Berg <johannes.berg@intel.com>2019-04-08 07:58:10 -0400
commitab60633c7136c300f15a390f3469d7c4be15a055 (patch)
tree09d4892426871630afcbbac9ff4ea26a264c0ad5
parent1e1b11b6a1111cd9e8af1fd6ccda270a9fa3eacf (diff)
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: Narayanraddi Masti <team.nmasti@gmail.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/net/cfg80211.h3
-rw-r--r--include/uapi/linux/nl80211.h2
-rw-r--r--net/mac80211/mesh.h2
-rw-r--r--net/mac80211/mesh_hwmp.c4
-rw-r--r--net/mac80211/sta_info.c6
-rw-r--r--net/wireless/nl80211.c1
6 files changed, 16 insertions, 2 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index b13234a486e7..5859a5e02454 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1327,6 +1327,7 @@ struct cfg80211_tid_stats {
1327 * @fcs_err_count: number of packets (MPDUs) received from this station with 1327 * @fcs_err_count: number of packets (MPDUs) received from this station with
1328 * an FCS error. This counter should be incremented only when TA of the 1328 * an FCS error. This counter should be incremented only when TA of the
1329 * received packet with an FCS error matches the peer MAC address. 1329 * received packet with an FCS error matches the peer MAC address.
1330 * @airtime_link_metric: mesh airtime link metric.
1330 */ 1331 */
1331struct station_info { 1332struct station_info {
1332 u64 filled; 1333 u64 filled;
@@ -1381,6 +1382,8 @@ struct station_info {
1381 1382
1382 u32 rx_mpdu_count; 1383 u32 rx_mpdu_count;
1383 u32 fcs_err_count; 1384 u32 fcs_err_count;
1385
1386 u32 airtime_link_metric;
1384}; 1387};
1385 1388
1386#if IS_ENABLED(CONFIG_CFG80211) 1389#if IS_ENABLED(CONFIG_CFG80211)
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 4a9404958fbe..07457f4aea00 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -3139,6 +3139,7 @@ enum nl80211_sta_bss_param {
3139 * @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames 3139 * @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames
3140 * sent to the station (u64, usec) 3140 * sent to the station (u64, usec)
3141 * @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16) 3141 * @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16)
3142 * @NL80211_STA_INFO_AIRTIME_LINK_METRIC: airtime link metric for mesh station
3142 * @__NL80211_STA_INFO_AFTER_LAST: internal 3143 * @__NL80211_STA_INFO_AFTER_LAST: internal
3143 * @NL80211_STA_INFO_MAX: highest possible station info attribute 3144 * @NL80211_STA_INFO_MAX: highest possible station info attribute
3144 */ 3145 */
@@ -3184,6 +3185,7 @@ enum nl80211_sta_info {
3184 NL80211_STA_INFO_CONNECTED_TO_GATE, 3185 NL80211_STA_INFO_CONNECTED_TO_GATE,
3185 NL80211_STA_INFO_TX_DURATION, 3186 NL80211_STA_INFO_TX_DURATION,
3186 NL80211_STA_INFO_AIRTIME_WEIGHT, 3187 NL80211_STA_INFO_AIRTIME_WEIGHT,
3188 NL80211_STA_INFO_AIRTIME_LINK_METRIC,
3187 3189
3188 /* keep last */ 3190 /* keep last */
3189 __NL80211_STA_INFO_AFTER_LAST, 3191 __NL80211_STA_INFO_AFTER_LAST,
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 574c3891c4b2..88535a2e62bc 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -278,6 +278,8 @@ mesh_path_add(struct ieee80211_sub_if_data *sdata, const u8 *dst);
278int mesh_path_add_gate(struct mesh_path *mpath); 278int mesh_path_add_gate(struct mesh_path *mpath);
279int mesh_path_send_to_gates(struct mesh_path *mpath); 279int mesh_path_send_to_gates(struct mesh_path *mpath);
280int mesh_gate_num(struct ieee80211_sub_if_data *sdata); 280int mesh_gate_num(struct ieee80211_sub_if_data *sdata);
281u32 airtime_link_metric_get(struct ieee80211_local *local,
282 struct sta_info *sta);
281 283
282/* Mesh plinks */ 284/* Mesh plinks */
283void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata, 285void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index f7517668e77a..c694c0dd907e 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -318,8 +318,8 @@ void ieee80211s_update_metric(struct ieee80211_local *local,
318 cfg80211_calculate_bitrate(&rinfo)); 318 cfg80211_calculate_bitrate(&rinfo));
319} 319}
320 320
321static u32 airtime_link_metric_get(struct ieee80211_local *local, 321u32 airtime_link_metric_get(struct ieee80211_local *local,
322 struct sta_info *sta) 322 struct sta_info *sta)
323{ 323{
324 /* This should be adjusted for each device */ 324 /* This should be adjusted for each device */
325 int device_constant = 1 << ARITH_SHIFT; 325 int device_constant = 1 << ARITH_SHIFT;
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 11f058987a54..a81e1279a76d 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -2373,6 +2373,12 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
2373 sinfo->filled |= 2373 sinfo->filled |=
2374 BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG); 2374 BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG);
2375 } 2375 }
2376
2377 if (ieee80211_vif_is_mesh(&sdata->vif)) {
2378 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_LINK_METRIC);
2379 sinfo->airtime_link_metric =
2380 airtime_link_metric_get(local, sta);
2381 }
2376} 2382}
2377 2383
2378u32 sta_get_expected_throughput(struct sta_info *sta) 2384u32 sta_get_expected_throughput(struct sta_info *sta)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 62f96d6c02f0..7556c0479b3c 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4898,6 +4898,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
4898 PUT_SINFO(TX_RETRIES, tx_retries, u32); 4898 PUT_SINFO(TX_RETRIES, tx_retries, u32);
4899 PUT_SINFO(TX_FAILED, tx_failed, u32); 4899 PUT_SINFO(TX_FAILED, tx_failed, u32);
4900 PUT_SINFO(EXPECTED_THROUGHPUT, expected_throughput, u32); 4900 PUT_SINFO(EXPECTED_THROUGHPUT, expected_throughput, u32);
4901 PUT_SINFO(AIRTIME_LINK_METRIC, airtime_link_metric, u32);
4901 PUT_SINFO(BEACON_LOSS, beacon_loss_count, u32); 4902 PUT_SINFO(BEACON_LOSS, beacon_loss_count, u32);
4902 PUT_SINFO(LOCAL_PM, local_pm, u32); 4903 PUT_SINFO(LOCAL_PM, local_pm, u32);
4903 PUT_SINFO(PEER_PM, peer_pm, u32); 4904 PUT_SINFO(PEER_PM, peer_pm, u32);