.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright 2002-2005, Devicescape Software, Inc. |
---|
3 | 4 | * Copyright 2013-2014 Intel Mobile Communications GmbH |
---|
4 | 5 | * Copyright(c) 2015-2017 Intel Deutschland GmbH |
---|
5 | 6 | * 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. |
---|
10 | 7 | */ |
---|
11 | 8 | |
---|
12 | 9 | #ifndef STA_INFO_H |
---|
.. | .. |
---|
72 | 69 | * @WLAN_STA_MPSP_RECIPIENT: local STA is recipient of a MPSP. |
---|
73 | 70 | * @WLAN_STA_PS_DELIVER: station woke up, but we're still blocking TX |
---|
74 | 71 | * 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. |
---|
75 | 74 | * |
---|
76 | 75 | * @NUM_WLAN_STA_FLAGS: number of defined flags |
---|
77 | 76 | */ |
---|
.. | .. |
---|
120 | 119 | #define HT_AGG_STATE_WANT_STOP 5 |
---|
121 | 120 | #define HT_AGG_STATE_START_CB 6 |
---|
122 | 121 | #define HT_AGG_STATE_STOP_CB 7 |
---|
| 122 | +#define HT_AGG_STATE_SENT_ADDBA 8 |
---|
123 | 123 | |
---|
124 | 124 | DECLARE_EWMA(avg_signal, 10, 8) |
---|
125 | 125 | enum ieee80211_agg_stop_reason { |
---|
.. | .. |
---|
128 | 128 | AGG_STOP_PEER_REQUEST, |
---|
129 | 129 | AGG_STOP_DESTROY_STA, |
---|
130 | 130 | }; |
---|
| 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); |
---|
131 | 148 | |
---|
132 | 149 | struct sta_info; |
---|
133 | 150 | |
---|
.. | .. |
---|
173 | 190 | u8 stop_initiator; |
---|
174 | 191 | bool tx_stop; |
---|
175 | 192 | u16 buf_size; |
---|
| 193 | + u16 ssn; |
---|
176 | 194 | |
---|
177 | 195 | u16 failed_bar_ssn; |
---|
178 | 196 | bool bar_pending; |
---|
.. | .. |
---|
319 | 337 | * @expected_ds_bits: from/to DS bits expected |
---|
320 | 338 | * @icv_len: length of the MIC if present |
---|
321 | 339 | * @key: bool indicating encryption is expected (key is set) |
---|
322 | | - * @sta_notify: notify the MLME code (once) |
---|
323 | 340 | * @internal_forward: forward froms internally on AP/VLAN type interfaces |
---|
324 | 341 | * @uses_rss: copy of USES_RSS hw flag |
---|
325 | 342 | * @da_offs: offset of the DA in the header (for header conversion) |
---|
.. | .. |
---|
335 | 352 | __le16 expected_ds_bits; |
---|
336 | 353 | u8 icv_len; |
---|
337 | 354 | u8 key:1, |
---|
338 | | - sta_notify:1, |
---|
339 | 355 | internal_forward:1, |
---|
340 | 356 | uses_rss:1; |
---|
341 | 357 | u8 da_offs, sa_offs; |
---|
.. | .. |
---|
345 | 361 | |
---|
346 | 362 | /* we use only values in the range 0-100, so pick a large precision */ |
---|
347 | 363 | DECLARE_EWMA(mesh_fail_avg, 20, 8) |
---|
| 364 | +DECLARE_EWMA(mesh_tx_rate_avg, 8, 16) |
---|
348 | 365 | |
---|
349 | 366 | /** |
---|
350 | 367 | * struct mesh_sta - mesh STA information |
---|
.. | .. |
---|
366 | 383 | * @nonpeer_pm: STA power save mode towards non-peer neighbors |
---|
367 | 384 | * @processed_beacon: set to true after peer rates and capabilities are |
---|
368 | 385 | * 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 |
---|
369 | 388 | * @fail_avg: moving percentage of failed MSDUs |
---|
| 389 | + * @tx_rate_avg: moving average of tx bitrate |
---|
370 | 390 | */ |
---|
371 | 391 | struct mesh_sta { |
---|
372 | 392 | struct timer_list plink_timer; |
---|
.. | .. |
---|
383 | 403 | u8 plink_retries; |
---|
384 | 404 | |
---|
385 | 405 | bool processed_beacon; |
---|
| 406 | + bool connected_to_gate; |
---|
| 407 | + bool connected_to_as; |
---|
386 | 408 | |
---|
387 | 409 | enum nl80211_plink_state plink_state; |
---|
388 | 410 | u32 plink_timeout; |
---|
.. | .. |
---|
394 | 416 | |
---|
395 | 417 | /* moving percentage of failed MSDUs */ |
---|
396 | 418 | struct ewma_mesh_fail_avg fail_avg; |
---|
| 419 | + /* moving average of tx bitrate */ |
---|
| 420 | + struct ewma_mesh_tx_rate_avg tx_rate_avg; |
---|
397 | 421 | }; |
---|
398 | 422 | |
---|
399 | 423 | DECLARE_EWMA(signal, 10, 8) |
---|
.. | .. |
---|
483 | 507 | * the station when it leaves powersave or polls for frames |
---|
484 | 508 | * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on |
---|
485 | 509 | * @txq_buffered_tids: bitmap of TIDs that mac80211 has txq data buffered on |
---|
| 510 | + * @assoc_at: clock boottime (in ns) of last association |
---|
486 | 511 | * @last_connected: time (in seconds) when a station got connected |
---|
487 | 512 | * @last_seq_ctrl: last received seq/frag number from this STA (per TID |
---|
488 | 513 | * plus one for non-QoS frames) |
---|
489 | 514 | * @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 |
---|
490 | 518 | * @ampdu_mlme: A-MPDU state machine state |
---|
491 | 519 | * @mesh: mesh STA information |
---|
492 | 520 | * @debugfs_dir: debug filesystem directory dentry |
---|
.. | .. |
---|
508 | 536 | * @tdls_chandef: a TDLS peer can have a wider chandef that is compatible to |
---|
509 | 537 | * the BSS one. |
---|
510 | 538 | * @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 |
---|
511 | 543 | * @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 |
---|
512 | 547 | * @pcpu_rx_stats: per-CPU RX statistics, assigned only if the driver needs |
---|
513 | 548 | * this (by advertising the USES_RSS hw flag) |
---|
514 | 549 | * @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 |
---|
515 | 561 | * @frags: fragment cache |
---|
516 | 562 | */ |
---|
517 | 563 | struct sta_info { |
---|
.. | .. |
---|
522 | 568 | u8 addr[ETH_ALEN]; |
---|
523 | 569 | struct ieee80211_local *local; |
---|
524 | 570 | 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]; |
---|
526 | 574 | struct ieee80211_key __rcu *ptk[NUM_DEFAULT_KEYS]; |
---|
527 | 575 | u8 ptk_idx; |
---|
528 | 576 | struct rate_control_ref *rate_ctrl; |
---|
.. | .. |
---|
559 | 607 | unsigned long driver_buffered_tids; |
---|
560 | 608 | unsigned long txq_buffered_tids; |
---|
561 | 609 | |
---|
| 610 | + u64 assoc_at; |
---|
562 | 611 | long last_connected; |
---|
563 | 612 | |
---|
564 | 613 | /* Updated from RX path only, no locking requirements */ |
---|
.. | .. |
---|
576 | 625 | unsigned long filtered; |
---|
577 | 626 | unsigned long retry_failed, retry_count; |
---|
578 | 627 | unsigned int lost_packets; |
---|
579 | | - unsigned long last_tdls_pkt_time; |
---|
| 628 | + unsigned long last_pkt_time; |
---|
580 | 629 | u64 msdu_retries[IEEE80211_NUM_TIDS + 1]; |
---|
581 | 630 | u64 msdu_failed[IEEE80211_NUM_TIDS + 1]; |
---|
582 | 631 | unsigned long last_ack; |
---|
.. | .. |
---|
590 | 639 | u64 packets[IEEE80211_NUM_ACS]; |
---|
591 | 640 | u64 bytes[IEEE80211_NUM_ACS]; |
---|
592 | 641 | struct ieee80211_tx_rate last_rate; |
---|
| 642 | + struct rate_info last_rate_info; |
---|
593 | 643 | u64 msdu[IEEE80211_NUM_TIDS + 1]; |
---|
594 | 644 | } tx_stats; |
---|
595 | 645 | u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; |
---|
| 646 | + |
---|
| 647 | + struct airtime_info airtime[IEEE80211_NUM_ACS]; |
---|
| 648 | + u16 airtime_weight; |
---|
596 | 649 | |
---|
597 | 650 | /* |
---|
598 | 651 | * Aggregation information, locked with lock. |
---|
.. | .. |
---|
719 | 772 | struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata, |
---|
720 | 773 | const u8 *addr); |
---|
721 | 774 | |
---|
| 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 | + |
---|
722 | 779 | #define for_each_sta_info(local, _addr, _sta, _tmp) \ |
---|
723 | 780 | rhl_for_each_entry_rcu(_sta, _tmp, \ |
---|
724 | 781 | sta_info_hash_lookup(local, _addr), hash_node) |
---|
.. | .. |
---|
760 | 817 | void sta_info_stop(struct ieee80211_local *local); |
---|
761 | 818 | |
---|
762 | 819 | /** |
---|
763 | | - * sta_info_flush - flush matching STA entries from the STA table |
---|
| 820 | + * __sta_info_flush - flush matching STA entries from the STA table |
---|
764 | 821 | * |
---|
765 | 822 | * Returns the number of removed STA entries. |
---|
766 | 823 | * |
---|
.. | .. |
---|
769 | 826 | */ |
---|
770 | 827 | int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans); |
---|
771 | 828 | |
---|
| 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 | + */ |
---|
772 | 836 | static inline int sta_info_flush(struct ieee80211_sub_if_data *sdata) |
---|
773 | 837 | { |
---|
774 | 838 | return __sta_info_flush(sdata, false); |
---|
.. | .. |
---|
798 | 862 | STA_STATS_RATE_TYPE_HT, |
---|
799 | 863 | STA_STATS_RATE_TYPE_VHT, |
---|
800 | 864 | STA_STATS_RATE_TYPE_HE, |
---|
| 865 | + STA_STATS_RATE_TYPE_S1G, |
---|
801 | 866 | }; |
---|
802 | 867 | |
---|
803 | 868 | #define STA_STATS_FIELD_HT_MCS GENMASK( 7, 0) |
---|