
Options: --debug enable netlink debugging --version show version (3.4) Commands: help [command] Print usage for all or a specific command, e.g. "help wowlan" or "help wowlan enable". event [-t] [-r] [-f] Monitor events from the kernel. -t - print timestamp -r - print relative timstamp -f - print full frame for auth/assoc etc. phy list List all wireless devices and their capabilities. phy <phyname> info Show capabilities for the specified wireless device. dev List all network interfaces for wireless hardware. dev <devname> info Show information for this interface. dev <devname> del Remove this virtual interface dev <devname> interface add <name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] phy <phyname> interface add <name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] Add a new virtual interface with the given configuration. Valid interface types are: managed, ibss, monitor, mesh, wds. The flags are only used for monitor interfaces, valid flags are: none: no special flags fcsfail: show frames with FCS errors control: show control frames otherbss: show frames from other BSSes cook: use cooked mode The mesh_id is used only for mesh mode. dev <devname> ibss join <SSID> <freq in MHz> [HT20|HT40+|HT40-|NOHT] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>] [basic-rates <rate in Mbps,rate2,...>] [mcast-rate <rate in Mbps>] [key d:0:abcde] Join the IBSS cell with the given SSID, if it doesn't exist create it on the given frequency. When fixed frequency is requested, don't join/create a cell on a different frequency. When a fixed BSSID is requested use that BSSID and do not adopt another cell's BSSID even if it has higher TSF and the same SSID. If an IBSS is created, create it with the specified basic-rates, multicast-rate and beacon-interval. dev <devname> ibss leave Leave the current IBSS cell. dev <devname> station dump List all stations known, e.g. the AP on managed interfaces dev <devname> station set <MAC address> vlan <ifindex> Set an AP VLAN for this station. dev <devname> station set <MAC address> plink_action <open|block> Set mesh peer link action for this station (peer). dev <devname> station del <MAC address> Remove the given station entry (use with caution!) dev <devname> station get <MAC address> Get information for a specific station. dev <devname> survey dump List all gathered channel survey data dev <devname> mesh leave Leave a mesh. dev <devname> mesh join <mesh ID> [mcast-rate <rate in Mbps>] [<param>=<value>]* Join a mesh with the given mesh ID with mcast-rate and mesh parameters. dev <devname> mpath dump List known mesh paths. dev <devname> mpath set <destination MAC address> next_hop <next hop MAC address> Set an existing mesh path's next hop. dev <devname> mpath new <destination MAC address> next_hop <next hop MAC address> Create a new mesh path (instead of relying on automatic discovery). dev <devname> mpath del <MAC address> Remove the mesh path to the given node. dev <devname> mpath get <MAC address> Get information on mesh path to the given node. dev <devname> scan [-u] [freq <freq>*] [ies <hex as 00:11:..>] [ssid <ssid>*|passive] Scan on the given frequencies and probe for the given SSIDs (or wildcard if not given) unless passive scanning is requested. If -u is specified print unknown data in the scan results. Specified (vendor) IEs must be well-formed. dev <devname> scan trigger [freq <freq>*] [ies <hex as 00:11:..>] [ssid <ssid>*|passive] Trigger a scan on the given frequencies with probing for the given SSIDs (or wildcard if not given) unless passive scanning is requested. dev <devname> scan dump [-u] Dump the current scan results. If -u is specified, print unknown data in scan results. reg get Print out the kernel's current regulatory domain information. reg set <ISO/IEC 3166-1 alpha2> Notify the kernel about the current regulatory domain. dev <devname> connect [-w] <SSID> [<freq in MHz>] [<bssid>] [key 0:abcde d:1:6162636465] Join the network with the given SSID (and frequency, BSSID). With -w, wait for the connect to finish or fail. dev <devname> disconnect Disconnect from the current network. dev <devname> link Print information about the current link, if any. dev <devname> offchannel <freq> <duration> Leave operating channel and go to the given channel for a while. dev <devname> cqm rssi <threshold|off> [<hysteresis>] Set connection quality monitor RSSI threshold. phy <phyname> wowlan show Show WoWLAN status. phy <phyname> wowlan disable Disable WoWLAN. phy <phyname> wowlan enable [any] [disconnect] [magic-packet] [gtk-rekey-failure] [eap-identity-request] [4way-handshake] [rfkill-release] [patterns <pattern>*] Enable WoWLAN with the given triggers. Each pattern is given as a bytestring with '-' in places where any byte may be present, e.g. 00:11:22:-:44 will match 00:11:22:33:44 and 00:11:22:33:ff:44 etc. dev <devname> roc start <freq> <time> phy <phyname> set antenna <bitmap> | all | <tx bitmap> <rx bitmap> Set a bitmap of allowed antennas to use for TX and RX. The driver may reject antenna configurations it cannot support. dev <devname> set txpower <auto|fixed|limit> [<tx power in mBm>] Specify transmit power level and setting type. phy <phyname> set txpower <auto|fixed|limit> [<tx power in mBm>] Specify transmit power level and setting type. phy <phyname> set distance <distance> Set appropriate coverage class for given link distance in meters. Valid values: 0 - 114750 phy <phyname> set coverage <coverage class> Set coverage class (1 for every 3 usec of air propagation time). Valid values: 0 - 255. phy <phyname> set netns <pid> Put this wireless device into a different network namespace phy <phyname> set rts <rts threshold|off> Set rts threshold. phy <phyname> set frag <fragmentation threshold|off> Set fragmentation threshold. dev <devname> set channel <channel> [HT20|HT40+|HT40-] phy <phyname> set channel <channel> [HT20|HT40+|HT40-] dev <devname> set freq <freq> [HT20|HT40+|HT40-] phy <phyname> set freq <freq> [HT20|HT40+|HT40-] Set frequency/channel the hardware is using, including HT configuration. phy <phyname> set name <new name> Rename this wireless device. dev <devname> set peer <MAC address> Set interface WDS peer. dev <devname> set noack_map <map> Set the NoAck map for the TIDs. (0x0009 = BE, 0x0006 = BK, 0x0030 = VI, 0x00C0 = VO) dev <devname> set 4addr <on|off> Set interface 4addr (WDS) mode. dev <devname> set type <type> Set interface type/mode. Valid interface types are: managed, ibss, monitor, mesh, wds. dev <devname> set meshid <meshid> dev <devname> set monitor <flag>* Set monitor flags. Valid flags are: none: no special flags fcsfail: show frames with FCS errors control: show control frames otherbss: show frames from other BSSes cook: use cooked mode dev <devname> set mesh_param <param>=<value> [<param>=<value>]* Set mesh parameter (run command without any to see available ones). dev <devname> set power_save <on|off> Set power save state to on or off. dev <devname> set bitrates [legacy-<2.4|5> <legacy rate in Mbps>*] [mcs-<2.4|5> <MCS index>*] Sets up the specified rate masks. Not passing any arguments would clear the existing mask (if any). dev <devname> get mesh_param [<param>] Retrieve mesh parameter (run command without any to see available ones). dev <devname> get power_save <param> Retrieve power save state. You can omit the 'phy' or 'dev' if the identification is unique, e.g. "iw wlan0 info" or "iw phy0 info". (Don't when scripting.) Do NOT screenscrape this tool, we don't consider its output stable.
203 lines
6.9 KiB
Diff
203 lines
6.9 KiB
Diff
From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
|
|
Date: Tue, 18 Dec 2018 17:02:07 -0800
|
|
Subject: [PATCH] cfg80211: Add airtime statistics and settings
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
This adds TX airtime statistics to the cfg80211 station dump (to go along
|
|
with the RX info already present), and adds a new parameter to set the
|
|
airtime weight of each station. The latter allows userspace to implement
|
|
policies for different stations by varying their weights.
|
|
|
|
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
|
|
[rmanohar@codeaurora.org: fixed checkpatch warnings]
|
|
Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
|
|
[move airtime weight != 0 check into policy]
|
|
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
|
---
|
|
|
|
--- a/include/net/cfg80211.h
|
|
+++ b/include/net/cfg80211.h
|
|
@@ -988,6 +988,7 @@ enum station_parameters_apply_mask {
|
|
* @support_p2p_ps: information if station supports P2P PS mechanism
|
|
* @he_capa: HE capabilities of station
|
|
* @he_capa_len: the length of the HE capabilities
|
|
+ * @airtime_weight: airtime scheduler weight for this station
|
|
*/
|
|
struct station_parameters {
|
|
const u8 *supported_rates;
|
|
@@ -1017,6 +1018,7 @@ struct station_parameters {
|
|
int support_p2p_ps;
|
|
const struct ieee80211_he_cap_elem *he_capa;
|
|
u8 he_capa_len;
|
|
+ u16 airtime_weight;
|
|
};
|
|
|
|
/**
|
|
@@ -1284,6 +1286,8 @@ struct cfg80211_tid_stats {
|
|
* @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
|
|
* from this peer
|
|
* @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
|
|
+ * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
|
|
+ * @airtime_weight: current airtime scheduling weight
|
|
* @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
|
|
* (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
|
|
* Note that this doesn't use the @filled bit, but is used if non-NULL.
|
|
@@ -1330,12 +1334,15 @@ struct station_info {
|
|
|
|
u32 expected_throughput;
|
|
|
|
- u64 rx_beacon;
|
|
+ u64 tx_duration;
|
|
u64 rx_duration;
|
|
+ u64 rx_beacon;
|
|
u8 rx_beacon_signal_avg;
|
|
struct cfg80211_tid_stats *pertid;
|
|
s8 ack_signal;
|
|
s8 avg_ack_signal;
|
|
+
|
|
+ u16 airtime_weight;
|
|
};
|
|
|
|
#if IS_ENABLED(CPTCFG_CFG80211)
|
|
@@ -2361,6 +2368,8 @@ enum wiphy_params_flags {
|
|
WIPHY_PARAM_TXQ_QUANTUM = 1 << 8,
|
|
};
|
|
|
|
+#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256
|
|
+
|
|
/**
|
|
* struct cfg80211_pmksa - PMK Security Association
|
|
*
|
|
--- a/include/uapi/linux/nl80211.h
|
|
+++ b/include/uapi/linux/nl80211.h
|
|
@@ -2241,6 +2241,9 @@ enum nl80211_commands {
|
|
* association request when used with NL80211_CMD_NEW_STATION). Can be set
|
|
* only if %NL80211_STA_FLAG_WME is set.
|
|
*
|
|
+ * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
|
|
+ * scheduler.
|
|
+ *
|
|
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
|
|
* @NL80211_ATTR_MAX: highest attribute number currently defined
|
|
* @__NL80211_ATTR_AFTER_LAST: internal use
|
|
@@ -2682,6 +2685,14 @@ enum nl80211_attrs {
|
|
|
|
NL80211_ATTR_HE_CAPABILITY,
|
|
|
|
+ /* not backported yet */
|
|
+ NL80211_ATTR_FTM_RESPONDER,
|
|
+ NL80211_ATTR_FTM_RESPONDER_STATS,
|
|
+ NL80211_ATTR_TIMEOUT,
|
|
+ NL80211_ATTR_PEER_MEASUREMENTS,
|
|
+
|
|
+ NL80211_ATTR_AIRTIME_WEIGHT,
|
|
+
|
|
/* add attributes here, update the policy in nl80211.c */
|
|
|
|
__NL80211_ATTR_AFTER_LAST,
|
|
@@ -3052,6 +3063,9 @@ enum nl80211_sta_bss_param {
|
|
* @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm)
|
|
* @NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG: avg signal strength of (data)
|
|
* ACK frame (s8, dBm)
|
|
+ * @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_AFTER_LAST: internal
|
|
* @NL80211_STA_INFO_MAX: highest possible station info attribute
|
|
*/
|
|
@@ -3093,6 +3107,14 @@ enum nl80211_sta_info {
|
|
NL80211_STA_INFO_ACK_SIGNAL,
|
|
NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG,
|
|
|
|
+ /* not backported yet */
|
|
+ NL80211_STA_INFO_RX_MPDUS,
|
|
+ NL80211_STA_INFO_FCS_ERROR_COUNT,
|
|
+ NL80211_STA_INFO_CONNECTED_TO_GATE,
|
|
+
|
|
+ NL80211_STA_INFO_TX_DURATION,
|
|
+ NL80211_STA_INFO_AIRTIME_WEIGHT,
|
|
+
|
|
/* keep last */
|
|
__NL80211_STA_INFO_AFTER_LAST,
|
|
NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1
|
|
@@ -5224,6 +5246,10 @@ enum nl80211_feature_flags {
|
|
* except for supported rates from the probe request content if requested
|
|
* by the %NL80211_SCAN_FLAG_MIN_PREQ_CONTENT flag.
|
|
*
|
|
+ * @NL80211_EXT_FEATURE_AIRTIME_FAIRNESS: Driver supports getting airtime
|
|
+ * fairness for transmitted packets and has enabled airtime fairness
|
|
+ * scheduling.
|
|
+ *
|
|
* @NUM_NL80211_EXT_FEATURES: number of extended features.
|
|
* @MAX_NL80211_EXT_FEATURES: highest extended feature index.
|
|
*/
|
|
@@ -5260,6 +5286,12 @@ enum nl80211_ext_feature_index {
|
|
NL80211_EXT_FEATURE_SCAN_RANDOM_SN,
|
|
NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT,
|
|
|
|
+ /* --- not backported yet --- */
|
|
+ NL80211_EXT_FEATURE_CAN_REPLACE_PTK0,
|
|
+ NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER,
|
|
+
|
|
+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS,
|
|
+
|
|
/* add new features before the definition below */
|
|
NUM_NL80211_EXT_FEATURES,
|
|
MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
|
|
--- a/net/wireless/nl80211.c
|
|
+++ b/net/wireless/nl80211.c
|
|
@@ -430,6 +430,7 @@ static const struct nla_policy nl80211_p
|
|
[NL80211_ATTR_TXQ_QUANTUM] = { .type = NLA_U32 },
|
|
[NL80211_ATTR_HE_CAPABILITY] = { .type = NLA_BINARY,
|
|
.len = NL80211_HE_MAX_CAPABILITY_LEN },
|
|
+ [NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1),
|
|
};
|
|
|
|
/* policy for the key attributes */
|
|
@@ -4658,6 +4659,11 @@ static int nl80211_send_station(struct s
|
|
PUT_SINFO(PLID, plid, u16);
|
|
PUT_SINFO(PLINK_STATE, plink_state, u8);
|
|
PUT_SINFO_U64(RX_DURATION, rx_duration);
|
|
+ PUT_SINFO_U64(TX_DURATION, tx_duration);
|
|
+
|
|
+ if (wiphy_ext_feature_isset(&rdev->wiphy,
|
|
+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
|
|
+ PUT_SINFO(AIRTIME_WEIGHT, airtime_weight, u16);
|
|
|
|
switch (rdev->wiphy.signal_type) {
|
|
case CFG80211_SIGNAL_TYPE_MBM:
|
|
@@ -5294,6 +5300,15 @@ static int nl80211_set_station(struct sk
|
|
nla_get_u8(info->attrs[NL80211_ATTR_OPMODE_NOTIF]);
|
|
}
|
|
|
|
+ if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT])
|
|
+ params.airtime_weight =
|
|
+ nla_get_u16(info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]);
|
|
+
|
|
+ if (params.airtime_weight &&
|
|
+ !wiphy_ext_feature_isset(&rdev->wiphy,
|
|
+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
|
|
+ return -EOPNOTSUPP;
|
|
+
|
|
/* Include parameters for TDLS peer (will check later) */
|
|
err = nl80211_set_station_tdls(info, ¶ms);
|
|
if (err)
|
|
@@ -5432,6 +5447,15 @@ static int nl80211_new_station(struct sk
|
|
return -EINVAL;
|
|
}
|
|
|
|
+ if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT])
|
|
+ params.airtime_weight =
|
|
+ nla_get_u16(info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]);
|
|
+
|
|
+ if (params.airtime_weight &&
|
|
+ !wiphy_ext_feature_isset(&rdev->wiphy,
|
|
+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
|
|
+ return -EOPNOTSUPP;
|
|
+
|
|
err = nl80211_parse_sta_channel_info(info, ¶ms);
|
|
if (err)
|
|
return err;
|