hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/mac80211/sta_info.h
....@@ -1,12 +1,9 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright 2002-2005, Devicescape Software, Inc.
34 * Copyright 2013-2014 Intel Mobile Communications GmbH
45 * Copyright(c) 2015-2017 Intel Deutschland GmbH
56 * Copyright(c) 2020-2021 Intel Corporation
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
107 */
118
129 #ifndef STA_INFO_H
....@@ -72,6 +69,8 @@
7269 * @WLAN_STA_MPSP_RECIPIENT: local STA is recipient of a MPSP.
7370 * @WLAN_STA_PS_DELIVER: station woke up, but we're still blocking TX
7471 * until pending frames are delivered
72
+ * @WLAN_STA_USES_ENCRYPTION: This station was configured for encryption,
73
+ * so drop all packets without a key later.
7574 *
7675 * @NUM_WLAN_STA_FLAGS: number of defined flags
7776 */
....@@ -120,6 +119,7 @@
120119 #define HT_AGG_STATE_WANT_STOP 5
121120 #define HT_AGG_STATE_START_CB 6
122121 #define HT_AGG_STATE_STOP_CB 7
122
+#define HT_AGG_STATE_SENT_ADDBA 8
123123
124124 DECLARE_EWMA(avg_signal, 10, 8)
125125 enum ieee80211_agg_stop_reason {
....@@ -128,6 +128,23 @@
128128 AGG_STOP_PEER_REQUEST,
129129 AGG_STOP_DESTROY_STA,
130130 };
131
+
132
+/* Debugfs flags to enable/disable use of RX/TX airtime in scheduler */
133
+#define AIRTIME_USE_TX BIT(0)
134
+#define AIRTIME_USE_RX BIT(1)
135
+
136
+struct airtime_info {
137
+ u64 rx_airtime;
138
+ u64 tx_airtime;
139
+ s64 deficit;
140
+ atomic_t aql_tx_pending; /* Estimated airtime for frames pending */
141
+ u32 aql_limit_low;
142
+ u32 aql_limit_high;
143
+};
144
+
145
+void ieee80211_sta_update_pending_airtime(struct ieee80211_local *local,
146
+ struct sta_info *sta, u8 ac,
147
+ u16 tx_airtime, bool tx_completed);
131148
132149 struct sta_info;
133150
....@@ -173,6 +190,7 @@
173190 u8 stop_initiator;
174191 bool tx_stop;
175192 u16 buf_size;
193
+ u16 ssn;
176194
177195 u16 failed_bar_ssn;
178196 bool bar_pending;
....@@ -319,7 +337,6 @@
319337 * @expected_ds_bits: from/to DS bits expected
320338 * @icv_len: length of the MIC if present
321339 * @key: bool indicating encryption is expected (key is set)
322
- * @sta_notify: notify the MLME code (once)
323340 * @internal_forward: forward froms internally on AP/VLAN type interfaces
324341 * @uses_rss: copy of USES_RSS hw flag
325342 * @da_offs: offset of the DA in the header (for header conversion)
....@@ -335,7 +352,6 @@
335352 __le16 expected_ds_bits;
336353 u8 icv_len;
337354 u8 key:1,
338
- sta_notify:1,
339355 internal_forward:1,
340356 uses_rss:1;
341357 u8 da_offs, sa_offs;
....@@ -345,6 +361,7 @@
345361
346362 /* we use only values in the range 0-100, so pick a large precision */
347363 DECLARE_EWMA(mesh_fail_avg, 20, 8)
364
+DECLARE_EWMA(mesh_tx_rate_avg, 8, 16)
348365
349366 /**
350367 * struct mesh_sta - mesh STA information
....@@ -366,7 +383,10 @@
366383 * @nonpeer_pm: STA power save mode towards non-peer neighbors
367384 * @processed_beacon: set to true after peer rates and capabilities are
368385 * processed
386
+ * @connected_to_gate: true if mesh STA has a path to a mesh gate
387
+ * @connected_to_as: true if mesh STA has a path to a authentication server
369388 * @fail_avg: moving percentage of failed MSDUs
389
+ * @tx_rate_avg: moving average of tx bitrate
370390 */
371391 struct mesh_sta {
372392 struct timer_list plink_timer;
....@@ -383,6 +403,8 @@
383403 u8 plink_retries;
384404
385405 bool processed_beacon;
406
+ bool connected_to_gate;
407
+ bool connected_to_as;
386408
387409 enum nl80211_plink_state plink_state;
388410 u32 plink_timeout;
....@@ -394,6 +416,8 @@
394416
395417 /* moving percentage of failed MSDUs */
396418 struct ewma_mesh_fail_avg fail_avg;
419
+ /* moving average of tx bitrate */
420
+ struct ewma_mesh_tx_rate_avg tx_rate_avg;
397421 };
398422
399423 DECLARE_EWMA(signal, 10, 8)
....@@ -483,10 +507,14 @@
483507 * the station when it leaves powersave or polls for frames
484508 * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
485509 * @txq_buffered_tids: bitmap of TIDs that mac80211 has txq data buffered on
510
+ * @assoc_at: clock boottime (in ns) of last association
486511 * @last_connected: time (in seconds) when a station got connected
487512 * @last_seq_ctrl: last received seq/frag number from this STA (per TID
488513 * plus one for non-QoS frames)
489514 * @tid_seq: per-TID sequence numbers for sending to this STA
515
+ * @airtime: per-AC struct airtime_info describing airtime statistics for this
516
+ * station
517
+ * @airtime_weight: station weight for airtime fairness calculation purposes
490518 * @ampdu_mlme: A-MPDU state machine state
491519 * @mesh: mesh STA information
492520 * @debugfs_dir: debug filesystem directory dentry
....@@ -508,10 +536,28 @@
508536 * @tdls_chandef: a TDLS peer can have a wider chandef that is compatible to
509537 * the BSS one.
510538 * @tx_stats: TX statistics
539
+ * @tx_stats.packets: # of packets transmitted
540
+ * @tx_stats.bytes: # of bytes in all packets transmitted
541
+ * @tx_stats.last_rate: last TX rate
542
+ * @tx_stats.msdu: # of transmitted MSDUs per TID
511543 * @rx_stats: RX statistics
544
+ * @rx_stats_avg: averaged RX statistics
545
+ * @rx_stats_avg.signal: averaged signal
546
+ * @rx_stats_avg.chain_signal: averaged per-chain signal
512547 * @pcpu_rx_stats: per-CPU RX statistics, assigned only if the driver needs
513548 * this (by advertising the USES_RSS hw flag)
514549 * @status_stats: TX status statistics
550
+ * @status_stats.filtered: # of filtered frames
551
+ * @status_stats.retry_failed: # of frames that failed after retry
552
+ * @status_stats.retry_count: # of retries attempted
553
+ * @status_stats.lost_packets: # of lost packets
554
+ * @status_stats.last_pkt_time: timestamp of last ACKed packet
555
+ * @status_stats.msdu_retries: # of MSDU retries
556
+ * @status_stats.msdu_failed: # of failed MSDUs
557
+ * @status_stats.last_ack: last ack timestamp (jiffies)
558
+ * @status_stats.last_ack_signal: last ACK signal
559
+ * @status_stats.ack_signal_filled: last ACK signal validity
560
+ * @status_stats.avg_ack_signal: average ACK signal
515561 * @frags: fragment cache
516562 */
517563 struct sta_info {
....@@ -522,7 +568,9 @@
522568 u8 addr[ETH_ALEN];
523569 struct ieee80211_local *local;
524570 struct ieee80211_sub_if_data *sdata;
525
- struct ieee80211_key __rcu *gtk[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS];
571
+ struct ieee80211_key __rcu *gtk[NUM_DEFAULT_KEYS +
572
+ NUM_DEFAULT_MGMT_KEYS +
573
+ NUM_DEFAULT_BEACON_KEYS];
526574 struct ieee80211_key __rcu *ptk[NUM_DEFAULT_KEYS];
527575 u8 ptk_idx;
528576 struct rate_control_ref *rate_ctrl;
....@@ -559,6 +607,7 @@
559607 unsigned long driver_buffered_tids;
560608 unsigned long txq_buffered_tids;
561609
610
+ u64 assoc_at;
562611 long last_connected;
563612
564613 /* Updated from RX path only, no locking requirements */
....@@ -576,7 +625,7 @@
576625 unsigned long filtered;
577626 unsigned long retry_failed, retry_count;
578627 unsigned int lost_packets;
579
- unsigned long last_tdls_pkt_time;
628
+ unsigned long last_pkt_time;
580629 u64 msdu_retries[IEEE80211_NUM_TIDS + 1];
581630 u64 msdu_failed[IEEE80211_NUM_TIDS + 1];
582631 unsigned long last_ack;
....@@ -590,9 +639,13 @@
590639 u64 packets[IEEE80211_NUM_ACS];
591640 u64 bytes[IEEE80211_NUM_ACS];
592641 struct ieee80211_tx_rate last_rate;
642
+ struct rate_info last_rate_info;
593643 u64 msdu[IEEE80211_NUM_TIDS + 1];
594644 } tx_stats;
595645 u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1];
646
+
647
+ struct airtime_info airtime[IEEE80211_NUM_ACS];
648
+ u16 airtime_weight;
596649
597650 /*
598651 * Aggregation information, locked with lock.
....@@ -719,6 +772,10 @@
719772 struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
720773 const u8 *addr);
721774
775
+/* user must hold sta_mtx or be in RCU critical section */
776
+struct sta_info *sta_info_get_by_addrs(struct ieee80211_local *local,
777
+ const u8 *sta_addr, const u8 *vif_addr);
778
+
722779 #define for_each_sta_info(local, _addr, _sta, _tmp) \
723780 rhl_for_each_entry_rcu(_sta, _tmp, \
724781 sta_info_hash_lookup(local, _addr), hash_node)
....@@ -760,7 +817,7 @@
760817 void sta_info_stop(struct ieee80211_local *local);
761818
762819 /**
763
- * sta_info_flush - flush matching STA entries from the STA table
820
+ * __sta_info_flush - flush matching STA entries from the STA table
764821 *
765822 * Returns the number of removed STA entries.
766823 *
....@@ -769,6 +826,13 @@
769826 */
770827 int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans);
771828
829
+/**
830
+ * sta_info_flush - flush matching STA entries from the STA table
831
+ *
832
+ * Returns the number of removed STA entries.
833
+ *
834
+ * @sdata: sdata to remove all stations from
835
+ */
772836 static inline int sta_info_flush(struct ieee80211_sub_if_data *sdata)
773837 {
774838 return __sta_info_flush(sdata, false);
....@@ -798,6 +862,7 @@
798862 STA_STATS_RATE_TYPE_HT,
799863 STA_STATS_RATE_TYPE_VHT,
800864 STA_STATS_RATE_TYPE_HE,
865
+ STA_STATS_RATE_TYPE_S1G,
801866 };
802867
803868 #define STA_STATS_FIELD_HT_MCS GENMASK( 7, 0)