]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Station airtime weight configuration
authorToke Høiland-Jørgensen <toke@toke.dk>
Wed, 20 Mar 2019 14:58:52 +0000 (15:58 +0100)
committerJouni Malinen <j@w1.fi>
Thu, 2 May 2019 10:28:17 +0000 (13:28 +0300)
This provides a mechanism for configuring per-STA airtime weight for
airtime policy configuration.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
src/ap/ap_drv_ops.c
src/ap/ap_drv_ops.h
src/drivers/driver.h
src/drivers/driver_nl80211.c

index 067cf863e84c7e6d69a1823f7e3ae6a688030f31..61390f93df431458625d3cb7aade6b106752739d 100644 (file)
@@ -583,6 +583,16 @@ int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
 }
 
 
+int hostapd_sta_set_airtime_weight(struct hostapd_data *hapd, const u8 *addr,
+                                  unsigned int weight)
+{
+       if (!hapd->driver || !hapd->driver->sta_set_airtime_weight)
+               return 0;
+       return hapd->driver->sta_set_airtime_weight(hapd->drv_priv, addr,
+                                                   weight);
+}
+
+
 int hostapd_set_country(struct hostapd_data *hapd, const char *country)
 {
        if (hapd->driver == NULL ||
index de40171e18dcbfcb4ea072eafefcd7e7efbd498f..5905be05376c8e9f1641ff540e44ba3b7f8cd37b 100644 (file)
@@ -67,6 +67,8 @@ int hostapd_set_rts(struct hostapd_data *hapd, int rts);
 int hostapd_set_frag(struct hostapd_data *hapd, int frag);
 int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
                          int total_flags, int flags_or, int flags_and);
+int hostapd_sta_set_airtime_weight(struct hostapd_data *hapd, const u8 *addr,
+                                  unsigned int weight);
 int hostapd_set_country(struct hostapd_data *hapd, const char *country);
 int hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
                                int cw_min, int cw_max, int burst_time);
index 351622afcdf74e2bc9c9175089c55c35223c59be..496bd522ec348a3fad70f26570748de6be3001a7 100644 (file)
@@ -2947,6 +2947,16 @@ struct wpa_driver_ops {
                             unsigned int total_flags, unsigned int flags_or,
                             unsigned int flags_and);
 
+       /**
+        * sta_set_airtime_weight - Set station airtime weight (AP only)
+        * @priv: Private driver interface data
+        * @addr: Station address
+        * @weight: New weight for station airtime assignment
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*sta_set_airtime_weight)(void *priv, const u8 *addr,
+                                     unsigned int weight);
+
        /**
         * set_tx_queue_params - Set TX queue parameters
         * @priv: Private driver interface data
index 090f74ecc30e515724a141222c42c7e12e86dd14..3556b6d695862556aabbe7629710679e1dbdfde4 100644 (file)
@@ -5183,6 +5183,28 @@ fail:
 }
 
 
+static int driver_nl80211_sta_set_airtime_weight(void *priv, const u8 *addr,
+                                                unsigned int weight)
+{
+       struct i802_bss *bss = priv;
+       struct nl_msg *msg;
+
+       wpa_printf(MSG_DEBUG,
+                  "nl80211: Set STA airtime weight - ifname=%s addr=" MACSTR
+                  " weight=%u", bss->ifname, MAC2STR(addr), weight);
+
+       if (!(msg = nl80211_bss_msg(bss, 0, NL80211_CMD_SET_STATION)) ||
+           nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) ||
+           nla_put_u16(msg, NL80211_ATTR_AIRTIME_WEIGHT, weight))
+               goto fail;
+
+       return send_and_recv_msgs(bss->drv, msg, NULL, NULL);
+fail:
+       nlmsg_free(msg);
+       return -ENOBUFS;
+}
+
+
 static int wpa_driver_nl80211_ap(struct wpa_driver_nl80211_data *drv,
                                 struct wpa_driver_associate_params *params)
 {