]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
mac80211: Add support for NL80211_STA_INFO_AIRTIME_LINK_METRIC
authorNarayanraddi Masti <team.nmasti@gmail.com>
Thu, 7 Feb 2019 20:16:05 +0000 (12:16 -0800)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 8 Apr 2019 11:58:10 +0000 (13:58 +0200)
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>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/mac80211/mesh.h
net/mac80211/mesh_hwmp.c
net/mac80211/sta_info.c
net/wireless/nl80211.c

index b13234a486e77d4553f94c9d33306183f82193b6..5859a5e024549752e230b4f88102c181b79e64e5 100644 (file)
@@ -1327,6 +1327,7 @@ struct cfg80211_tid_stats {
  * @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
  *     received packet with an FCS error matches the peer MAC address.
+ * @airtime_link_metric: mesh airtime link metric.
  */
 struct station_info {
        u64 filled;
@@ -1381,6 +1382,8 @@ struct station_info {
 
        u32 rx_mpdu_count;
        u32 fcs_err_count;
+
+       u32 airtime_link_metric;
 };
 
 #if IS_ENABLED(CONFIG_CFG80211)
index 4a9404958fbe8529d7abc867fd163498f7c7d2de..07457f4aea001319d64a3489b48737d37bd881c1 100644 (file)
@@ -3139,6 +3139,7 @@ enum nl80211_sta_bss_param {
  * @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames
  *     sent to the station (u64, usec)
  * @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_MAX: highest possible station info attribute
  */
@@ -3184,6 +3185,7 @@ enum nl80211_sta_info {
        NL80211_STA_INFO_CONNECTED_TO_GATE,
        NL80211_STA_INFO_TX_DURATION,
        NL80211_STA_INFO_AIRTIME_WEIGHT,
+       NL80211_STA_INFO_AIRTIME_LINK_METRIC,
 
        /* keep last */
        __NL80211_STA_INFO_AFTER_LAST,
index 574c3891c4b2e8b6d7c6031811acdb50b94355be..88535a2e62bcfcd754eb02ba6d76a3eb8fc65241 100644 (file)
@@ -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_send_to_gates(struct mesh_path *mpath);
 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 */
 void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata,
index f7517668e77a0fdfd74003af482371ac6fc14f04..c694c0dd907e40877248338f5da9336b4d2e908d 100644 (file)
@@ -318,8 +318,8 @@ void ieee80211s_update_metric(struct ieee80211_local *local,
                                  cfg80211_calculate_bitrate(&rinfo));
 }
 
-static u32 airtime_link_metric_get(struct ieee80211_local *local,
-                                  struct sta_info *sta)
+u32 airtime_link_metric_get(struct ieee80211_local *local,
+                           struct sta_info *sta)
 {
        /* This should be adjusted for each device */
        int device_constant = 1 << ARITH_SHIFT;
index 11f058987a54393edd87b7e04f88c74084bd70de..a81e1279a76d7afd0b179fdb8984cd08a42fc999 100644 (file)
@@ -2373,6 +2373,12 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
                sinfo->filled |=
                        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)
index 62f96d6c02f02cc1bfd435571f3b2917c7ab1f64..7556c0479b3c6859591c1b964c093047c1068b7c 100644 (file)
@@ -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_FAILED, tx_failed, 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(LOCAL_PM, local_pm, u32);
        PUT_SINFO(PEER_PM, peer_pm, u32);