1f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc/*
2f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc * Copyright 2002-2005, Devicescape Software, Inc.
3d98ad83ee86e523cc00cbf425f456fbd14b4fdc4Johannes Berg * Copyright 2013-2014  Intel Mobile Communications GmbH
4f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc *
5f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc * This program is free software; you can redistribute it and/or modify
6f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc * it under the terms of the GNU General Public License version 2 as
7f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc * published by the Free Software Foundation.
8f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc */
9f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
10f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc#ifndef STA_INFO_H
11f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc#define STA_INFO_H
12f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
13f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc#include <linux/list.h>
14f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc#include <linux/types.h>
15f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc#include <linux/if_ether.h>
16af81858172cc0f3da81946aab919c26e4b364efcJohannes Berg#include <linux/workqueue.h>
17541a45a142df281c974d74eac2066138fc107b23Bruno Randolf#include <linux/average.h>
18888d04dfbe7e09f930fdaafb257cce2c54c9c3f3Felix Fietkau#include <linux/etherdevice.h>
192c8dccc77420fb7433da5674818959d3499d35beJohannes Berg#include "key.h"
20f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
21238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg/**
22238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg * enum ieee80211_sta_info_flags - Stations flags
23238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg *
24c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg * These flags are used with &struct sta_info's @flags member, but
25c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg * only indirectly with set_sta_flag() and friends.
26238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg *
27238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg * @WLAN_STA_AUTH: Station is authenticated.
28238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg * @WLAN_STA_ASSOC: Station is associated.
29af81858172cc0f3da81946aab919c26e4b364efcJohannes Berg * @WLAN_STA_PS_STA: Station is in power-save mode
30238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg * @WLAN_STA_AUTHORIZED: Station is authorized to send/receive traffic.
31238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg *	This bit is always checked so needs to be enabled for all stations
32238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg *	when virtual port control is not in use.
33238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
34238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg *	frames.
35238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg * @WLAN_STA_WDS: Station is one of our WDS peers.
36d46e144b65bf053b25d134ec9f52a38e63e04bb4Johannes Berg * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
37e039fa4a4195ac4ee895e6f3d1334beed63256feJohannes Berg *	IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
38d46e144b65bf053b25d134ec9f52a38e63e04bb4Johannes Berg *	frame to this station is transmitted.
395394af4d86ae51b369ff243c3f75b6f9a74e164bJouni Malinen * @WLAN_STA_MFP: Management frame protection is used with this STA.
40618f356b95e37ca0c30b3b513898fda54abd52a6Johannes Berg * @WLAN_STA_BLOCK_BA: Used to deny ADDBA requests (both TX and RX)
41098a607091426e79178b9a6c318d993fea131791Johannes Berg *	during suspend/resume and station removal.
42af81858172cc0f3da81946aab919c26e4b364efcJohannes Berg * @WLAN_STA_PS_DRIVER: driver requires keeping this station in
43af81858172cc0f3da81946aab919c26e4b364efcJohannes Berg *	power-save mode logically to flush frames that might still
44af81858172cc0f3da81946aab919c26e4b364efcJohannes Berg *	be in the queues
45af81858172cc0f3da81946aab919c26e4b364efcJohannes Berg * @WLAN_STA_PSPOLL: Station sent PS-poll while driver was keeping
46af81858172cc0f3da81946aab919c26e4b364efcJohannes Berg *	station in power-save mode, reply when the driver unblocks.
47941c93cd039852b7ab02c74f4698c99d82bd6cfeArik Nemtsov * @WLAN_STA_TDLS_PEER: Station is a TDLS peer.
48941c93cd039852b7ab02c74f4698c99d82bd6cfeArik Nemtsov * @WLAN_STA_TDLS_PEER_AUTH: This TDLS peer is authorized to send direct
49941c93cd039852b7ab02c74f4698c99d82bd6cfeArik Nemtsov *	packets. This means the link is enabled.
50626911cc60d873b38f7ca4c5c537fcb918c658d7Arik Nemtsov * @WLAN_STA_TDLS_INITIATOR: We are the initiator of the TDLS link with this
51626911cc60d873b38f7ca4c5c537fcb918c658d7Arik Nemtsov *	station.
5247086fc51aa2220f58049704a8b73e4fcdf372b9Johannes Berg * @WLAN_STA_UAPSD: Station requested unscheduled SP while driver was
5347086fc51aa2220f58049704a8b73e4fcdf372b9Johannes Berg *	keeping station in power-save mode, reply when the driver
5447086fc51aa2220f58049704a8b73e4fcdf372b9Johannes Berg *	unblocks the station.
5547086fc51aa2220f58049704a8b73e4fcdf372b9Johannes Berg * @WLAN_STA_SP: Station is in a service period, so don't try to
56deeaee197b0fa694ba6c8f02cdb57b3be7115b4fJohannes Berg *	reply to other uAPSD trigger frames or PS-Poll.
57e7f4a940bb5eecd07cf0039e7d9201badc332ae0Johannes Berg * @WLAN_STA_4ADDR_EVENT: 4-addr event was already sent for this frame.
5883d5cc012441531ab0bf6f99881958e964e9cf11Johannes Berg * @WLAN_STA_INSERTED: This station is inserted into the hash table.
59e1936e9407138b483e6d1332dd944afec8131f30Johannes Berg * @WLAN_STA_RATE_CONTROL: rate control was initialized for this station.
60dbf498fbafa2c23139d5a990e94ed78bafbbea19Javier Cardona * @WLAN_STA_TOFFSET_KNOWN: toffset calculated for this station is valid.
613f52b7e328c526fa7a592af9bf5772c591ed38a4Marco Porsch * @WLAN_STA_MPSP_OWNER: local STA is owner of a mesh Peer Service Period.
623f52b7e328c526fa7a592af9bf5772c591ed38a4Marco Porsch * @WLAN_STA_MPSP_RECIPIENT: local STA is recipient of a MPSP.
635ac2e35030113ed881ce9ad413d80f13ffe5b5a0Johannes Berg * @WLAN_STA_PS_DELIVER: station woke up, but we're still blocking TX
645ac2e35030113ed881ce9ad413d80f13ffe5b5a0Johannes Berg *	until pending frames are delivered
65238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg */
66238814fd9a9624e3076c47ef0c003101927c7818Johannes Bergenum ieee80211_sta_info_flags {
67c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_AUTH,
68c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_ASSOC,
69c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_PS_STA,
70c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_AUTHORIZED,
71c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_SHORT_PREAMBLE,
72c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_WDS,
73c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_CLEAR_PS_FILT,
74c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_MFP,
75c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_BLOCK_BA,
76c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_PS_DRIVER,
77c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_PSPOLL,
78c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_TDLS_PEER,
79c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_TDLS_PEER_AUTH,
80626911cc60d873b38f7ca4c5c537fcb918c658d7Arik Nemtsov	WLAN_STA_TDLS_INITIATOR,
81c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_UAPSD,
82c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	WLAN_STA_SP,
83e7f4a940bb5eecd07cf0039e7d9201badc332ae0Johannes Berg	WLAN_STA_4ADDR_EVENT,
8483d5cc012441531ab0bf6f99881958e964e9cf11Johannes Berg	WLAN_STA_INSERTED,
85e1936e9407138b483e6d1332dd944afec8131f30Johannes Berg	WLAN_STA_RATE_CONTROL,
86dbf498fbafa2c23139d5a990e94ed78bafbbea19Javier Cardona	WLAN_STA_TOFFSET_KNOWN,
873f52b7e328c526fa7a592af9bf5772c591ed38a4Marco Porsch	WLAN_STA_MPSP_OWNER,
883f52b7e328c526fa7a592af9bf5772c591ed38a4Marco Porsch	WLAN_STA_MPSP_RECIPIENT,
895ac2e35030113ed881ce9ad413d80f13ffe5b5a0Johannes Berg	WLAN_STA_PS_DELIVER,
90238814fd9a9624e3076c47ef0c003101927c7818Johannes Berg};
91d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg
925aae2880618471cfa679ca22531b88990bee9bf8Ron Rindjunsky#define ADDBA_RESP_INTERVAL HZ
9384381b4ed58498e1e3d49a4a306fec9894b8e00cNikolay Martynov#define HT_AGG_MAX_RETRIES		15
9484381b4ed58498e1e3d49a4a306fec9894b8e00cNikolay Martynov#define HT_AGG_BURST_RETRIES		3
9584381b4ed58498e1e3d49a4a306fec9894b8e00cNikolay Martynov#define HT_AGG_RETRIES_PERIOD		(15 * HZ)
965aae2880618471cfa679ca22531b88990bee9bf8Ron Rindjunsky
97a622ab72b4dcfdf53e24b16e9530cb876979a00cJohannes Berg#define HT_AGG_STATE_DRV_READY		0
98a622ab72b4dcfdf53e24b16e9530cb876979a00cJohannes Berg#define HT_AGG_STATE_RESPONSE_RECEIVED	1
99a622ab72b4dcfdf53e24b16e9530cb876979a00cJohannes Berg#define HT_AGG_STATE_OPERATIONAL	2
100a622ab72b4dcfdf53e24b16e9530cb876979a00cJohannes Berg#define HT_AGG_STATE_STOPPING		3
1010ab337032a0dfcd5f2527d3306d3deeba5f95b59Johannes Berg#define HT_AGG_STATE_WANT_START		4
1020ab337032a0dfcd5f2527d3306d3deeba5f95b59Johannes Berg#define HT_AGG_STATE_WANT_STOP		5
10380656c20315558a9bc5c5b7f7c6949fa72277afdRon Rindjunsky
104c82c4a80bbb9c8ffa1d783070a8caa37f2db45b6Johannes Bergenum ieee80211_agg_stop_reason {
105c82c4a80bbb9c8ffa1d783070a8caa37f2db45b6Johannes Berg	AGG_STOP_DECLINED,
106c82c4a80bbb9c8ffa1d783070a8caa37f2db45b6Johannes Berg	AGG_STOP_LOCAL_REQUEST,
107c82c4a80bbb9c8ffa1d783070a8caa37f2db45b6Johannes Berg	AGG_STOP_PEER_REQUEST,
108c82c4a80bbb9c8ffa1d783070a8caa37f2db45b6Johannes Berg	AGG_STOP_DESTROY_STA,
109c82c4a80bbb9c8ffa1d783070a8caa37f2db45b6Johannes Berg};
110c82c4a80bbb9c8ffa1d783070a8caa37f2db45b6Johannes Berg
11180656c20315558a9bc5c5b7f7c6949fa72277afdRon Rindjunsky/**
11280656c20315558a9bc5c5b7f7c6949fa72277afdRon Rindjunsky * struct tid_ampdu_tx - TID aggregation information (Tx).
11380656c20315558a9bc5c5b7f7c6949fa72277afdRon Rindjunsky *
114a622ab72b4dcfdf53e24b16e9530cb876979a00cJohannes Berg * @rcu_head: rcu head for freeing structure
115285fa6958c1d56469ec8a0e879ae7487a4e62840Nikolay Martynov * @session_timer: check if we keep Tx-ing on the TID (by timeout value)
11680656c20315558a9bc5c5b7f7c6949fa72277afdRon Rindjunsky * @addba_resp_timer: timer for peer's response to addba request
117cd8ffc800ce18e558335c4946b2217864fc16045Johannes Berg * @pending: pending frames queue -- use sta's spinlock to protect
118cee24a3e580f1062c8bb8b1692b95014d882bc7dRon Rindjunsky * @dialog_token: dialog token for aggregation session
119bd2ce6e43f65127bc723e7fcc044758cf8113260Sujith Manoharan * @timeout: session timeout value to be filled in ADDBA requests
120a622ab72b4dcfdf53e24b16e9530cb876979a00cJohannes Berg * @state: session state (see above)
12112d3952fc4a1cd96234bc7023bf7eefeb0bb6355Felix Fietkau * @last_tx: jiffies of last tx activity
122a622ab72b4dcfdf53e24b16e9530cb876979a00cJohannes Berg * @stop_initiator: initiator of a session stop
12353f73c09d64f1fa7d7e6e8b6bb7468d42eddc92dJohannes Berg * @tx_stop: TX DelBA frame when stopping
1240b01f030d38e00650e2db42da083d8647aad40a5Johannes Berg * @buf_size: reorder buffer size at receiver
125f0425beda4d404a6e751439b562100b902ba9c98Felix Fietkau * @failed_bar_ssn: ssn of the last failed BAR tx attempt
126f0425beda4d404a6e751439b562100b902ba9c98Felix Fietkau * @bar_pending: BAR needs to be re-sent
127a622ab72b4dcfdf53e24b16e9530cb876979a00cJohannes Berg *
128dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg * This structure's lifetime is managed by RCU, assignments to
129dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg * the array holding it must hold the aggregation mutex.
130dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg *
131dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg * The TX path can access it under RCU lock-free if, and
132dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg * only if, the state has the flag %HT_AGG_STATE_OPERATIONAL
133dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg * set. Otherwise, the TX path must also acquire the spinlock
134dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg * and re-check the state, see comments in the tx code
135dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg * touching it.
13680656c20315558a9bc5c5b7f7c6949fa72277afdRon Rindjunsky */
13780656c20315558a9bc5c5b7f7c6949fa72277afdRon Rindjunskystruct tid_ampdu_tx {
138a622ab72b4dcfdf53e24b16e9530cb876979a00cJohannes Berg	struct rcu_head rcu_head;
139285fa6958c1d56469ec8a0e879ae7487a4e62840Nikolay Martynov	struct timer_list session_timer;
14080656c20315558a9bc5c5b7f7c6949fa72277afdRon Rindjunsky	struct timer_list addba_resp_timer;
141cd8ffc800ce18e558335c4946b2217864fc16045Johannes Berg	struct sk_buff_head pending;
142a622ab72b4dcfdf53e24b16e9530cb876979a00cJohannes Berg	unsigned long state;
14312d3952fc4a1cd96234bc7023bf7eefeb0bb6355Felix Fietkau	unsigned long last_tx;
144bd2ce6e43f65127bc723e7fcc044758cf8113260Sujith Manoharan	u16 timeout;
145cee24a3e580f1062c8bb8b1692b95014d882bc7dRon Rindjunsky	u8 dialog_token;
146a622ab72b4dcfdf53e24b16e9530cb876979a00cJohannes Berg	u8 stop_initiator;
14753f73c09d64f1fa7d7e6e8b6bb7468d42eddc92dJohannes Berg	bool tx_stop;
1480b01f030d38e00650e2db42da083d8647aad40a5Johannes Berg	u8 buf_size;
149f0425beda4d404a6e751439b562100b902ba9c98Felix Fietkau
150f0425beda4d404a6e751439b562100b902ba9c98Felix Fietkau	u16 failed_bar_ssn;
151f0425beda4d404a6e751439b562100b902ba9c98Felix Fietkau	bool bar_pending;
15280656c20315558a9bc5c5b7f7c6949fa72277afdRon Rindjunsky};
1535aae2880618471cfa679ca22531b88990bee9bf8Ron Rindjunsky
1545aae2880618471cfa679ca22531b88990bee9bf8Ron Rindjunsky/**
1555aae2880618471cfa679ca22531b88990bee9bf8Ron Rindjunsky * struct tid_ampdu_rx - TID aggregation information (Rx).
1565aae2880618471cfa679ca22531b88990bee9bf8Ron Rindjunsky *
15783eb935ec74a91468776cd86415abcb6ee23cca8Michal Kazior * @reorder_buf: buffer to reorder incoming aggregated MPDUs. An MPDU may be an
15883eb935ec74a91468776cd86415abcb6ee23cca8Michal Kazior *	A-MSDU with individually reported subframes.
1594d050f1daed3babf6fcc337f862a245d31af4452Jouni Malinen * @reorder_time: jiffies when skb was added
1605aae2880618471cfa679ca22531b88990bee9bf8Ron Rindjunsky * @session_timer: check if peer keeps Tx-ing on the TID (by timeout value)
1612bff8ebf32a7c5ec9e5f5eeffef94a8cb622f5f0Christian Lamparter * @reorder_timer: releases expired frames from the reorder buffer.
16212d3952fc4a1cd96234bc7023bf7eefeb0bb6355Felix Fietkau * @last_rx: jiffies of last rx activity
163056cdd599d004e36de64c925b8a13f6676451360Johannes Berg * @head_seq_num: head sequence number in reordering buffer.
164056cdd599d004e36de64c925b8a13f6676451360Johannes Berg * @stored_mpdu_num: number of MPDUs in reordering buffer
165cee24a3e580f1062c8bb8b1692b95014d882bc7dRon Rindjunsky * @ssn: Starting Sequence Number expected to be aggregated.
166cee24a3e580f1062c8bb8b1692b95014d882bc7dRon Rindjunsky * @buf_size: buffer size for incoming A-MPDUs
16720ad19d0ac7389b04b566ebf3e0e497974f63ffaJohannes Berg * @timeout: reset timer value (in TUs).
168cee24a3e580f1062c8bb8b1692b95014d882bc7dRon Rindjunsky * @dialog_token: dialog token for aggregation session
169a87f736d942c86255e3088c606f0e3eab6bbf784Johannes Berg * @rcu_head: RCU head used for freeing this struct
1702bff8ebf32a7c5ec9e5f5eeffef94a8cb622f5f0Christian Lamparter * @reorder_lock: serializes access to reorder buffer, see below.
1714549cf2b1803d29cfd019f7bfeaa784f8f9c558fMichal Kazior * @auto_seq: used for offloaded BA sessions to automatically pick head_seq_and
1724549cf2b1803d29cfd019f7bfeaa784f8f9c558fMichal Kazior *	and ssn.
173a87f736d942c86255e3088c606f0e3eab6bbf784Johannes Berg *
174dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg * This structure's lifetime is managed by RCU, assignments to
175dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg * the array holding it must hold the aggregation mutex.
1762bff8ebf32a7c5ec9e5f5eeffef94a8cb622f5f0Christian Lamparter *
177dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg * The @reorder_lock is used to protect the members of this
178dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg * struct, except for @timeout, @buf_size and @dialog_token,
179dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg * which are constant across the lifetime of the struct (the
180dd318575ff0aae91ac4cbcc5b60c184e59267212Johannes Berg * dialog token being used only for debugging).
1815aae2880618471cfa679ca22531b88990bee9bf8Ron Rindjunsky */
1825aae2880618471cfa679ca22531b88990bee9bf8Ron Rindjunskystruct tid_ampdu_rx {
183a87f736d942c86255e3088c606f0e3eab6bbf784Johannes Berg	struct rcu_head rcu_head;
1842bff8ebf32a7c5ec9e5f5eeffef94a8cb622f5f0Christian Lamparter	spinlock_t reorder_lock;
18583eb935ec74a91468776cd86415abcb6ee23cca8Michal Kazior	struct sk_buff_head *reorder_buf;
1864d050f1daed3babf6fcc337f862a245d31af4452Jouni Malinen	unsigned long *reorder_time;
1875aae2880618471cfa679ca22531b88990bee9bf8Ron Rindjunsky	struct timer_list session_timer;
1882bff8ebf32a7c5ec9e5f5eeffef94a8cb622f5f0Christian Lamparter	struct timer_list reorder_timer;
18912d3952fc4a1cd96234bc7023bf7eefeb0bb6355Felix Fietkau	unsigned long last_rx;
190056cdd599d004e36de64c925b8a13f6676451360Johannes Berg	u16 head_seq_num;
191056cdd599d004e36de64c925b8a13f6676451360Johannes Berg	u16 stored_mpdu_num;
192cee24a3e580f1062c8bb8b1692b95014d882bc7dRon Rindjunsky	u16 ssn;
193cee24a3e580f1062c8bb8b1692b95014d882bc7dRon Rindjunsky	u16 buf_size;
194cee24a3e580f1062c8bb8b1692b95014d882bc7dRon Rindjunsky	u16 timeout;
195cee24a3e580f1062c8bb8b1692b95014d882bc7dRon Rindjunsky	u8 dialog_token;
1964549cf2b1803d29cfd019f7bfeaa784f8f9c558fMichal Kazior	bool auto_seq;
1975aae2880618471cfa679ca22531b88990bee9bf8Ron Rindjunsky};
1985aae2880618471cfa679ca22531b88990bee9bf8Ron Rindjunsky
199b4e08ea141e6d663dec31b31d6289baeaaa2a3a2Luis Carlos Cobo/**
200fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Berg * struct sta_ampdu_mlme - STA aggregation information.
201fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Berg *
202a87f736d942c86255e3088c606f0e3eab6bbf784Johannes Berg * @tid_rx: aggregation info for Rx per TID -- RCU protected
203fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Berg * @tid_tx: aggregation info for Tx per TID
204ec034b208dc8aa5dc73ec46c3f27e34c5efbf113Johannes Berg * @tid_start_tx: sessions where start was requested
205fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Berg * @addba_req_num: number of times addBA request has been sent.
20684381b4ed58498e1e3d49a4a306fec9894b8e00cNikolay Martynov * @last_addba_req_time: timestamp of the last addBA request.
207fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Berg * @dialog_token_allocator: dialog token enumerator for each new session;
2080ab337032a0dfcd5f2527d3306d3deeba5f95b59Johannes Berg * @work: work struct for starting/stopping aggregation
2097c3b1dd8f483bf4bcb9776cd9cd3b37dd327d7eaJohannes Berg * @tid_rx_timer_expired: bitmap indicating on which TIDs the
2107c3b1dd8f483bf4bcb9776cd9cd3b37dd327d7eaJohannes Berg *	RX timer expired until the work for it runs
211f41ccd71d800c6fac18d2b4ae1830a222c6713daShahar Levi * @tid_rx_stop_requested:  bitmap indicating which BA sessions per TID the
212f41ccd71d800c6fac18d2b4ae1830a222c6713daShahar Levi *	driver requested to close until the work for it runs
213a93e364430de7f7a5f4eedd604ad1ab3d825dde5Johannes Berg * @mtx: mutex to protect all TX data (except non-NULL assignments
214a93e364430de7f7a5f4eedd604ad1ab3d825dde5Johannes Berg *	to tid_tx[idx], which are protected by the sta spinlock)
215e562078a19226660299eeaf40a50752672214f11Ben Greear *	tid_start_tx is also protected by sta->lock.
216fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Berg */
217fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Bergstruct sta_ampdu_mlme {
218a93e364430de7f7a5f4eedd604ad1ab3d825dde5Johannes Berg	struct mutex mtx;
219fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Berg	/* rx */
2205a306f5887d5fd840beb8ea872897fa89e8fcdefJohannes Berg	struct tid_ampdu_rx __rcu *tid_rx[IEEE80211_NUM_TIDS];
2215a306f5887d5fd840beb8ea872897fa89e8fcdefJohannes Berg	unsigned long tid_rx_timer_expired[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
2225a306f5887d5fd840beb8ea872897fa89e8fcdefJohannes Berg	unsigned long tid_rx_stop_requested[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
223fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Berg	/* tx */
2240ab337032a0dfcd5f2527d3306d3deeba5f95b59Johannes Berg	struct work_struct work;
2255a306f5887d5fd840beb8ea872897fa89e8fcdefJohannes Berg	struct tid_ampdu_tx __rcu *tid_tx[IEEE80211_NUM_TIDS];
2265a306f5887d5fd840beb8ea872897fa89e8fcdefJohannes Berg	struct tid_ampdu_tx *tid_start_tx[IEEE80211_NUM_TIDS];
2275a306f5887d5fd840beb8ea872897fa89e8fcdefJohannes Berg	unsigned long last_addba_req_time[IEEE80211_NUM_TIDS];
2285a306f5887d5fd840beb8ea872897fa89e8fcdefJohannes Berg	u8 addba_req_num[IEEE80211_NUM_TIDS];
229fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Berg	u8 dialog_token_allocator;
230fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Berg};
231fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Berg
232ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb/*
233ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb * struct ieee80211_tx_latency_stat - Tx latency statistics
234ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb *
235ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb * Measures TX latency and jitter for a station per TID.
236ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb *
237ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb * @max: worst case latency
238ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb * @sum: sum of all latencies
239ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb * @counter: amount of Tx frames sent from interface
240ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb * @bins: each bin counts how many frames transmitted within a certain
241ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb * latency range. when disabled it is NULL.
242ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb * @bin_count: amount of bins.
243ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb */
244ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottliebstruct ieee80211_tx_latency_stat {
245ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb	u32 max;
246ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb	u32 sum;
247ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb	u32 counter;
248ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb	u32 *bins;
249ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb	u32 bin_count;
250ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb};
251fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Berg
252fcea60070fe8fa48df579f155ec7bc20a868f7dcJohannes Berg/**
253693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg * struct sta_info - STA information
254693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg *
255693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg * This structure collects information about a station that
256693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg * mac80211 is communicating with.
257693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg *
258693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg * @list: global linked list entry
259d778207b06ac1becd012eb689dafdf85feebb179Johannes Berg * @free_list: list entry for keeping track of stations to free
260693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg * @hnext: hash table linked list pointer
261693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg * @local: pointer to the global information
262e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @sdata: virtual interface this station belongs to
2632475b1cc0d5283a33144b79f3eba6d401d873962Max Stepanov * @ptk: peer keys negotiated with this station, if any
2642475b1cc0d5283a33144b79f3eba6d401d873962Max Stepanov * @ptk_idx: last installed peer key index
265e31b82136d1adc7a599b6e99d3321e5831841f5aJohannes Berg * @gtk: group keys negotiated with this station, if any
2662475b1cc0d5283a33144b79f3eba6d401d873962Max Stepanov * @gtk_idx: last installed group key index
267e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @rate_ctrl: rate control algorithm reference
268e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @rate_ctrl_priv: rate control private per-STA pointer
269e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @last_tx_rate: rate used for last transmit, to report to userspace as
270e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg *	"the" transmit rate
2713af6334c9e4fbf41ef0ebd3b4d5762f26b675c40Felix Fietkau * @last_rx_rate_idx: rx status rate index of the last data packet
2723af6334c9e4fbf41ef0ebd3b4d5762f26b675c40Felix Fietkau * @last_rx_rate_flag: rx status flag of the last data packet
2731b8d242adbea881658071efc31d2c0dcf8a44fb7Emmanuel Grumbach * @last_rx_rate_vht_flag: rx status vht flag of the last data packet
2745614618ec498320e3b686fea246e50b833865c34Johannes Berg * @last_rx_rate_vht_nss: rx status nss of last data packet
2756ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @lock: used for locking all fields that require locking, see comments
2766ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap *	in the header file.
2775ac2e35030113ed881ce9ad413d80f13ffe5b5a0Johannes Berg * @drv_deliver_wk: used for delivering frames after driver PS unblocking
278e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @listen_interval: listen interval of this station, when we're acting as AP
279c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg * @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly
2801d147bfa64293b2723c4fec50922168658e613baEmmanuel Grumbach * @ps_lock: used for powersave (when mac80211 is the AP) related locking
281948d887dec1042a7d78ae311908113e26502062fJohannes Berg * @ps_tx_buf: buffers (per AC) of frames to transmit to this station
282948d887dec1042a7d78ae311908113e26502062fJohannes Berg *	when it leaves power saving state or polls
283948d887dec1042a7d78ae311908113e26502062fJohannes Berg * @tx_filtered: buffers (per AC) of frames we already tried to
284948d887dec1042a7d78ae311908113e26502062fJohannes Berg *	transmit but were filtered by hardware due to STA having
285948d887dec1042a7d78ae311908113e26502062fJohannes Berg *	entered power saving state, these are also delivered to
286948d887dec1042a7d78ae311908113e26502062fJohannes Berg *	the station when it leaves powersave or polls for frames
287948d887dec1042a7d78ae311908113e26502062fJohannes Berg * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
288693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg * @rx_packets: Number of MSDUs received from this STA
289693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg * @rx_bytes: Number of bytes received from this STA
290e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @last_rx: time (in jiffies) when last frame was received from this STA
291ebe27c91af8b7f4810ae906fbd3eeb2d87850026Mohammed Shafi Shajakhan * @last_connected: time (in seconds) when a station got connected
2926ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @num_duplicates: number of duplicate frames received from this STA
2936ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @rx_fragments: number of received MPDUs
2946ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @rx_dropped: number of dropped MPDUs from this STA
2956ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @last_signal: signal of last received frame from this STA
296541a45a142df281c974d74eac2066138fc107b23Bruno Randolf * @avg_signal: moving average of signal of received frames from this STA
297db94357dbd79359496cd5189640cc36bb3c35733Saravana * @last_ack_signal: signal of last received Ack frame from this STA
2986ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @last_seq_ctrl: last received seq/frag number from this STA (per RX queue)
299e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @tx_filtered_count: number of frames the hardware filtered for this STA
300e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @tx_retry_failed: number of frames that failed retry
301e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @tx_retry_count: total number of retries for frames to this STA
3026ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @fail_avg: moving percentage of failed MSDUs
3036ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @tx_packets: number of RX/TX MSDUs
304e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @tx_bytes: number of bytes transmitted to this STA
3056ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @tx_fragments: number of transmitted MPDUs
306e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @tid_seq: per-TID sequence numbers for sending to this STA
307e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @ampdu_mlme: A-MPDU state machine state
3086ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @timer_to_tid: identity mapping to ID timers
309ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb * @tx_lat: Tx latency statistics
3106ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @llid: Local link ID
3116ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @plid: Peer link ID
3126ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @reason: Cancel reason on PLINK_HOLDING state
3136ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @plink_retries: Retries in establishment
314e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @plink_state: peer link state
315e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @plink_timeout: timeout of peer link
316e25cf4a6945e0f859186231be7164ba565412e0aJohannes Berg * @plink_timer: peer link watch timer
317dbf498fbafa2c23139d5a990e94ed78bafbbea19Javier Cardona * @t_offset: timing offset relative to this host
3181dd45581e6dc98467c539ea67ae5c847646f0efdAshok Nagarajan * @t_offset_setpoint: reference timing offset of this sta to be used when
3191dd45581e6dc98467c539ea67ae5c847646f0efdAshok Nagarajan * 	calculating clockdrift
3203f52b7e328c526fa7a592af9bf5772c591ed38a4Marco Porsch * @local_pm: local link-specific power save mode
3213f52b7e328c526fa7a592af9bf5772c591ed38a4Marco Porsch * @peer_pm: peer-specific power save mode towards local STA
3223f52b7e328c526fa7a592af9bf5772c591ed38a4Marco Porsch * @nonpeer_pm: STA power save mode towards non-peer neighbors
3236ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap * @debugfs: debug filesystem info
324af81858172cc0f3da81946aab919c26e4b364efcJohannes Berg * @dead: set to true when sta is unlinked
32534e895075e21be3e21e71d6317440d1ee7969ad0Johannes Berg * @uploaded: set to true when sta is uploaded to the driver
32699ba2a14283be96a682e04455061c08a46bbf4ecJohannes Berg * @lost_packets: number of consecutive lost packets
3272a33bee2753bf28411de8822e3e3c7501966eb1bGuy Eilam * @sta: station information we share with the driver
328d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg * @sta_state: duplicates information about station state (for debug)
329a85e1d55974646a442d95911e3f7d7a891ea9ac5Paul Stewart * @beacon_loss_count: number of times beacon loss has triggered
330077f897a8be9c617e69035af4d17a472d4af272bJohannes Berg * @rcu_head: RCU head used for freeing this station struct
3310af83d3df5863224336a18c24a14fda542b712f5Johannes Berg * @cur_max_bandwidth: maximum bandwidth to use for TX to the station,
3320af83d3df5863224336a18c24a14fda542b712f5Johannes Berg *	taken from HT/VHT capabilities or VHT operating mode notification
333780b40df12cf0161d8ccc5381940e04584793933Johannes Berg * @chains: chains ever used for RX from this station
334780b40df12cf0161d8ccc5381940e04584793933Johannes Berg * @chain_signal_last: last signal (per chain)
335780b40df12cf0161d8ccc5381940e04584793933Johannes Berg * @chain_signal_avg: signal average (per chain)
336687da132234feb70748df04a007bc1820f392254Emmanuel Grumbach * @known_smps_mode: the smps_mode the client thinks we are in. Relevant for
337687da132234feb70748df04a007bc1820f392254Emmanuel Grumbach *	AP only.
3382475b1cc0d5283a33144b79f3eba6d401d873962Max Stepanov * @cipher_scheme: optional cipher scheme for this station
3398975ae88e137ea02a71b7a86af2f8eb790c2f1e7Liad Kaufman * @last_tdls_pkt_time: holds the time in jiffies of last TDLS pkt ACKed
340693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg */
341f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Bencstruct sta_info {
342693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	/* General information, mostly static */
343d778207b06ac1becd012eb689dafdf85feebb179Johannes Berg	struct list_head list, free_list;
344b22cfcfcae5b2c1e9b43543b6a23e5ef517de8f8Eliad Peller	struct rcu_head rcu_head;
34540b275b69ee660274b77fb612b0db31fd282fc3fJohannes Berg	struct sta_info __rcu *hnext;
346f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc	struct ieee80211_local *local;
347d0709a65181beb787ef3f58cfe45536a2bb254c8Johannes Berg	struct ieee80211_sub_if_data *sdata;
34840b275b69ee660274b77fb612b0db31fd282fc3fJohannes Berg	struct ieee80211_key __rcu *gtk[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS];
3492475b1cc0d5283a33144b79f3eba6d401d873962Max Stepanov	struct ieee80211_key __rcu *ptk[NUM_DEFAULT_KEYS];
3502475b1cc0d5283a33144b79f3eba6d401d873962Max Stepanov	u8 gtk_idx;
3512475b1cc0d5283a33144b79f3eba6d401d873962Max Stepanov	u8 ptk_idx;
352f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc	struct rate_control_ref *rate_ctrl;
353f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc	void *rate_ctrl_priv;
35407346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg	spinlock_t lock;
35517741cdc264e4d768167766a252210e201c1519aJohannes Berg
3565ac2e35030113ed881ce9ad413d80f13ffe5b5a0Johannes Berg	struct work_struct drv_deliver_wk;
357af81858172cc0f3da81946aab919c26e4b364efcJohannes Berg
358693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	u16 listen_interval;
359f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
360af81858172cc0f3da81946aab919c26e4b364efcJohannes Berg	bool dead;
361af81858172cc0f3da81946aab919c26e4b364efcJohannes Berg
36234e895075e21be3e21e71d6317440d1ee7969ad0Johannes Berg	bool uploaded;
363693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg
364d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg	enum ieee80211_sta_state sta_state;
365d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg
366c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	/* use the accessors defined below */
367c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	unsigned long _flags;
368693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg
3691d147bfa64293b2723c4fec50922168658e613baEmmanuel Grumbach	/* STA powersave lock and frame queues */
3701d147bfa64293b2723c4fec50922168658e613baEmmanuel Grumbach	spinlock_t ps_lock;
371948d887dec1042a7d78ae311908113e26502062fJohannes Berg	struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS];
372948d887dec1042a7d78ae311908113e26502062fJohannes Berg	struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS];
373948d887dec1042a7d78ae311908113e26502062fJohannes Berg	unsigned long driver_buffered_tids;
374693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg
375693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	/* Updated from RX path only, no locking requirements */
376560d268220d3416a2d473bcc906ea2ccbf51e4ecJohannes Berg	unsigned long rx_packets;
377560d268220d3416a2d473bcc906ea2ccbf51e4ecJohannes Berg	u64 rx_bytes;
378693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	unsigned long last_rx;
379ebe27c91af8b7f4810ae906fbd3eeb2d87850026Mohammed Shafi Shajakhan	long last_connected;
3806ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap	unsigned long num_duplicates;
3816ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap	unsigned long rx_fragments;
3826ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap	unsigned long rx_dropped;
3836ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap	int last_signal;
384541a45a142df281c974d74eac2066138fc107b23Bruno Randolf	struct ewma avg_signal;
385db94357dbd79359496cd5189640cc36bb3c35733Saravana	int last_ack_signal;
386ef0621e805f9ef76eaf31ce6205028fe467e9ca9Felix Fietkau
387ef0621e805f9ef76eaf31ce6205028fe467e9ca9Felix Fietkau	u8 chains;
388ef0621e805f9ef76eaf31ce6205028fe467e9ca9Felix Fietkau	s8 chain_signal_last[IEEE80211_MAX_CHAINS];
389ef0621e805f9ef76eaf31ce6205028fe467e9ca9Felix Fietkau	struct ewma chain_signal_avg[IEEE80211_MAX_CHAINS];
390ef0621e805f9ef76eaf31ce6205028fe467e9ca9Felix Fietkau
3919e26297a56453315ae6829aec609b5a6309af7b4Johannes Berg	/* Plus 1 for non-QoS frames */
3925a306f5887d5fd840beb8ea872897fa89e8fcdefJohannes Berg	__le16 last_seq_ctrl[IEEE80211_NUM_TIDS + 1];
393693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg
394693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	/* Updated from TX status path only, no locking requirements */
395693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	unsigned long tx_filtered_count;
396693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	unsigned long tx_retry_failed, tx_retry_count;
397693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	/* moving percentage of failed MSDUs */
398693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	unsigned int fail_avg;
399693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg
400693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	/* Updated from TX path only, no locking requirements */
401560d268220d3416a2d473bcc906ea2ccbf51e4ecJohannes Berg	u32 tx_fragments;
402560d268220d3416a2d473bcc906ea2ccbf51e4ecJohannes Berg	u64 tx_packets[IEEE80211_NUM_ACS];
403560d268220d3416a2d473bcc906ea2ccbf51e4ecJohannes Berg	u64 tx_bytes[IEEE80211_NUM_ACS];
404e6a9854b05c1a6af1308fe2b8c68f35abf28a3eeJohannes Berg	struct ieee80211_tx_rate last_tx_rate;
4053af6334c9e4fbf41ef0ebd3b4d5762f26b675c40Felix Fietkau	int last_rx_rate_idx;
4065614618ec498320e3b686fea246e50b833865c34Johannes Berg	u32 last_rx_rate_flag;
4071b8d242adbea881658071efc31d2c0dcf8a44fb7Emmanuel Grumbach	u32 last_rx_rate_vht_flag;
4085614618ec498320e3b686fea246e50b833865c34Johannes Berg	u8 last_rx_rate_vht_nss;
409f591fa5dbbbeaebd95c9c019b3a536a327fb79deJohannes Berg	u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1];
410f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
411d0709a65181beb787ef3f58cfe45536a2bb254c8Johannes Berg	/*
41207346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg	 * Aggregation information, locked with lock.
413d0709a65181beb787ef3f58cfe45536a2bb254c8Johannes Berg	 */
4145aae2880618471cfa679ca22531b88990bee9bf8Ron Rindjunsky	struct sta_ampdu_mlme ampdu_mlme;
4155a306f5887d5fd840beb8ea872897fa89e8fcdefJohannes Berg	u8 timer_to_tid[IEEE80211_NUM_TIDS];
416693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg
417ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb	struct ieee80211_tx_latency_stat *tx_lat;
418ad38bfc916da6aee9160bfa5335aed8d6c190e39Matti Gottlieb
419ee3858551ae6d044578f598f8001db5f1a9fd52eLuis Carlos Cobo#ifdef CONFIG_MAC80211_MESH
420693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	/*
421693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	 * Mesh peer link attributes
422693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	 * TODO: move to a sub-structure that is referenced with pointer?
423693b1bbcc47b3fd436068f294147357f90cd1296Johannes Berg	 */
4246f101ef04b77bcad71049e07007d34d14cab7b2fChun-Yeow Yeoh	u16 llid;
4256f101ef04b77bcad71049e07007d34d14cab7b2fChun-Yeow Yeoh	u16 plid;
4266f101ef04b77bcad71049e07007d34d14cab7b2fChun-Yeow Yeoh	u16 reason;
4276ef307bc561911c8cdda98ef3896b5982b602a43Randy Dunlap	u8 plink_retries;
42857cf8043a64b56a10b9f194572548a3dfb62e596Javier Cardona	enum nl80211_plink_state plink_state;
429ee3858551ae6d044578f598f8001db5f1a9fd52eLuis Carlos Cobo	u32 plink_timeout;
430ee3858551ae6d044578f598f8001db5f1a9fd52eLuis Carlos Cobo	struct timer_list plink_timer;
431dbf498fbafa2c23139d5a990e94ed78bafbbea19Javier Cardona	s64 t_offset;
432dbf498fbafa2c23139d5a990e94ed78bafbbea19Javier Cardona	s64 t_offset_setpoint;
4333f52b7e328c526fa7a592af9bf5772c591ed38a4Marco Porsch	/* mesh power save */
4343f52b7e328c526fa7a592af9bf5772c591ed38a4Marco Porsch	enum nl80211_mesh_power_mode local_pm;
4353f52b7e328c526fa7a592af9bf5772c591ed38a4Marco Porsch	enum nl80211_mesh_power_mode peer_pm;
4363f52b7e328c526fa7a592af9bf5772c591ed38a4Marco Porsch	enum nl80211_mesh_power_mode nonpeer_pm;
437ee3858551ae6d044578f598f8001db5f1a9fd52eLuis Carlos Cobo#endif
43810816d40f2e9500057cb46d7608a362a1d10bb9bRon Rindjunsky
439e9f207f0ff90bf60b825800d7450e6f2ff2eab88Jiri Benc#ifdef CONFIG_MAC80211_DEBUGFS
440e9f207f0ff90bf60b825800d7450e6f2ff2eab88Jiri Benc	struct sta_info_debugfsdentries {
441e9f207f0ff90bf60b825800d7450e6f2ff2eab88Jiri Benc		struct dentry *dir;
44263044e9f54b6bac50d2380bf4d14f63e9e7de72bJohannes Berg		bool add_has_run;
443e9f207f0ff90bf60b825800d7450e6f2ff2eab88Jiri Benc	} debugfs;
444e9f207f0ff90bf60b825800d7450e6f2ff2eab88Jiri Benc#endif
44517741cdc264e4d768167766a252210e201c1519aJohannes Berg
4460af83d3df5863224336a18c24a14fda542b712f5Johannes Berg	enum ieee80211_sta_rx_bandwidth cur_max_bandwidth;
4470af83d3df5863224336a18c24a14fda542b712f5Johannes Berg
44899ba2a14283be96a682e04455061c08a46bbf4ecJohannes Berg	unsigned int lost_packets;
449a85e1d55974646a442d95911e3f7d7a891ea9ac5Paul Stewart	unsigned int beacon_loss_count;
45099ba2a14283be96a682e04455061c08a46bbf4ecJohannes Berg
451687da132234feb70748df04a007bc1820f392254Emmanuel Grumbach	enum ieee80211_smps_mode known_smps_mode;
4522475b1cc0d5283a33144b79f3eba6d401d873962Max Stepanov	const struct ieee80211_cipher_scheme *cipher_scheme;
453687da132234feb70748df04a007bc1820f392254Emmanuel Grumbach
4549d58f25b12f70f52581a5a1fdb1e59d322c4c729Liad Kaufman	/* TDLS timeout data */
4559d58f25b12f70f52581a5a1fdb1e59d322c4c729Liad Kaufman	unsigned long last_tdls_pkt_time;
4569d58f25b12f70f52581a5a1fdb1e59d322c4c729Liad Kaufman
45717741cdc264e4d768167766a252210e201c1519aJohannes Berg	/* keep last! */
45817741cdc264e4d768167766a252210e201c1519aJohannes Berg	struct ieee80211_sta sta;
459f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc};
460f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
46157cf8043a64b56a10b9f194572548a3dfb62e596Javier Cardonastatic inline enum nl80211_plink_state sta_plink_state(struct sta_info *sta)
462d6d1a5a7096172a1592115331a420630adf47f8cJohannes Berg{
463d6d1a5a7096172a1592115331a420630adf47f8cJohannes Berg#ifdef CONFIG_MAC80211_MESH
464d6d1a5a7096172a1592115331a420630adf47f8cJohannes Berg	return sta->plink_state;
465d6d1a5a7096172a1592115331a420630adf47f8cJohannes Berg#endif
46657cf8043a64b56a10b9f194572548a3dfb62e596Javier Cardona	return NL80211_PLINK_LISTEN;
467d6d1a5a7096172a1592115331a420630adf47f8cJohannes Berg}
468d6d1a5a7096172a1592115331a420630adf47f8cJohannes Berg
469c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Bergstatic inline void set_sta_flag(struct sta_info *sta,
470c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg				enum ieee80211_sta_info_flags flag)
47107346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg{
472d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg	WARN_ON(flag == WLAN_STA_AUTH ||
473d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg		flag == WLAN_STA_ASSOC ||
474d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg		flag == WLAN_STA_AUTHORIZED);
475c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	set_bit(flag, &sta->_flags);
47607346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg}
47707346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg
478c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Bergstatic inline void clear_sta_flag(struct sta_info *sta,
479c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg				  enum ieee80211_sta_info_flags flag)
48007346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg{
481d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg	WARN_ON(flag == WLAN_STA_AUTH ||
482d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg		flag == WLAN_STA_ASSOC ||
483d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg		flag == WLAN_STA_AUTHORIZED);
484c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	clear_bit(flag, &sta->_flags);
48507346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg}
48607346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg
487c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Bergstatic inline int test_sta_flag(struct sta_info *sta,
488c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg				enum ieee80211_sta_info_flags flag)
48907346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg{
490c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	return test_bit(flag, &sta->_flags);
49107346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg}
49207346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg
493c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Bergstatic inline int test_and_clear_sta_flag(struct sta_info *sta,
494c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg					  enum ieee80211_sta_info_flags flag)
49507346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg{
496d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg	WARN_ON(flag == WLAN_STA_AUTH ||
497d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg		flag == WLAN_STA_ASSOC ||
498d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg		flag == WLAN_STA_AUTHORIZED);
499c2c98fdeb5c897499644eb247285c8e3dacc6450Johannes Berg	return test_and_clear_bit(flag, &sta->_flags);
50007346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg}
50107346f81e87d6e4cca7ae9adfa711d0c61c87b56Johannes Berg
502e7f4a940bb5eecd07cf0039e7d9201badc332ae0Johannes Bergstatic inline int test_and_set_sta_flag(struct sta_info *sta,
503e7f4a940bb5eecd07cf0039e7d9201badc332ae0Johannes Berg					enum ieee80211_sta_info_flags flag)
504e7f4a940bb5eecd07cf0039e7d9201badc332ae0Johannes Berg{
505d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg	WARN_ON(flag == WLAN_STA_AUTH ||
506d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg		flag == WLAN_STA_ASSOC ||
507d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg		flag == WLAN_STA_AUTHORIZED);
508e7f4a940bb5eecd07cf0039e7d9201badc332ae0Johannes Berg	return test_and_set_bit(flag, &sta->_flags);
509e7f4a940bb5eecd07cf0039e7d9201badc332ae0Johannes Berg}
510e7f4a940bb5eecd07cf0039e7d9201badc332ae0Johannes Berg
51183d5cc012441531ab0bf6f99881958e964e9cf11Johannes Bergint sta_info_move_state(struct sta_info *sta,
51283d5cc012441531ab0bf6f99881958e964e9cf11Johannes Berg			enum ieee80211_sta_state new_state);
513d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg
51483d5cc012441531ab0bf6f99881958e964e9cf11Johannes Bergstatic inline void sta_info_pre_move_state(struct sta_info *sta,
51583d5cc012441531ab0bf6f99881958e964e9cf11Johannes Berg					   enum ieee80211_sta_state new_state)
516d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg{
51783d5cc012441531ab0bf6f99881958e964e9cf11Johannes Berg	int ret;
51883d5cc012441531ab0bf6f99881958e964e9cf11Johannes Berg
51983d5cc012441531ab0bf6f99881958e964e9cf11Johannes Berg	WARN_ON_ONCE(test_sta_flag(sta, WLAN_STA_INSERTED));
52083d5cc012441531ab0bf6f99881958e964e9cf11Johannes Berg
52183d5cc012441531ab0bf6f99881958e964e9cf11Johannes Berg	ret = sta_info_move_state(sta, new_state);
522d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg	WARN_ON_ONCE(ret);
523d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg}
524d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg
525d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg
526ec034b208dc8aa5dc73ec46c3f27e34c5efbf113Johannes Bergvoid ieee80211_assign_tid_tx(struct sta_info *sta, int tid,
527ec034b208dc8aa5dc73ec46c3f27e34c5efbf113Johannes Berg			     struct tid_ampdu_tx *tid_tx);
528f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
52940b275b69ee660274b77fb612b0db31fd282fc3fJohannes Bergstatic inline struct tid_ampdu_tx *
53040b275b69ee660274b77fb612b0db31fd282fc3fJohannes Bergrcu_dereference_protected_tid_tx(struct sta_info *sta, int tid)
53140b275b69ee660274b77fb612b0db31fd282fc3fJohannes Berg{
53240b275b69ee660274b77fb612b0db31fd282fc3fJohannes Berg	return rcu_dereference_protected(sta->ampdu_mlme.tid_tx[tid],
53340b275b69ee660274b77fb612b0db31fd282fc3fJohannes Berg					 lockdep_is_held(&sta->lock) ||
53440b275b69ee660274b77fb612b0db31fd282fc3fJohannes Berg					 lockdep_is_held(&sta->ampdu_mlme.mtx));
53540b275b69ee660274b77fb612b0db31fd282fc3fJohannes Berg}
536f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
537f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc#define STA_HASH_SIZE 256
538f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc#define STA_HASH(sta) (sta[5])
539f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
540f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
541948d887dec1042a7d78ae311908113e26502062fJohannes Berg/* Maximum number of frames to buffer per power saving station per AC */
542948d887dec1042a7d78ae311908113e26502062fJohannes Berg#define STA_MAX_TX_BUFFER	64
543f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
544f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc/* Minimum buffered frame expiry time. If STA uses listen interval that is
545f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc * smaller than this value, the minimum value here is used instead. */
546f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc#define STA_TX_BUFFER_EXPIRE (10 * HZ)
547f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
548f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc/* How often station data is cleaned up (e.g., expiration of buffered frames)
549f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc */
550f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc#define STA_INFO_CLEANUP_INTERVAL (10 * HZ)
551f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
552d0709a65181beb787ef3f58cfe45536a2bb254c8Johannes Berg/*
553abe60632f311d515b082b450504ee24006023951Johannes Berg * Get a STA info, must be under RCU read lock.
554d0709a65181beb787ef3f58cfe45536a2bb254c8Johannes Berg */
555abe60632f311d515b082b450504ee24006023951Johannes Bergstruct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
556abe60632f311d515b082b450504ee24006023951Johannes Berg			      const u8 *addr);
557abe60632f311d515b082b450504ee24006023951Johannes Berg
5580e5ded5a87c097760abd68521b86f1025dedc7d7Felix Fietkaustruct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
5590e5ded5a87c097760abd68521b86f1025dedc7d7Felix Fietkau				  const u8 *addr);
5600e5ded5a87c097760abd68521b86f1025dedc7d7Felix Fietkau
561abe60632f311d515b082b450504ee24006023951Johannes Bergstatic inline
562abe60632f311d515b082b450504ee24006023951Johannes Bergvoid for_each_sta_info_type_check(struct ieee80211_local *local,
563abe60632f311d515b082b450504ee24006023951Johannes Berg				  const u8 *addr,
564abe60632f311d515b082b450504ee24006023951Johannes Berg				  struct sta_info *sta,
565abe60632f311d515b082b450504ee24006023951Johannes Berg				  struct sta_info *nxt)
566abe60632f311d515b082b450504ee24006023951Johannes Berg{
567abe60632f311d515b082b450504ee24006023951Johannes Berg}
568abe60632f311d515b082b450504ee24006023951Johannes Berg
5697852e36186d2a1983c215836d7e3d7b8927c930dJohannes Berg#define for_each_sta_info(local, _addr, _sta, nxt)			\
5702a33bee2753bf28411de8822e3e3c7501966eb1bGuy Eilam	for (	/* initialise loop */					\
5712a33bee2753bf28411de8822e3e3c7501966eb1bGuy Eilam		_sta = rcu_dereference(local->sta_hash[STA_HASH(_addr)]),\
5722a33bee2753bf28411de8822e3e3c7501966eb1bGuy Eilam		nxt = _sta ? rcu_dereference(_sta->hnext) : NULL;	\
5732a33bee2753bf28411de8822e3e3c7501966eb1bGuy Eilam		/* typecheck */						\
5742a33bee2753bf28411de8822e3e3c7501966eb1bGuy Eilam		for_each_sta_info_type_check(local, (_addr), _sta, nxt),\
5752a33bee2753bf28411de8822e3e3c7501966eb1bGuy Eilam		/* continue condition */				\
5762a33bee2753bf28411de8822e3e3c7501966eb1bGuy Eilam		_sta;							\
5772a33bee2753bf28411de8822e3e3c7501966eb1bGuy Eilam		/* advance loop */					\
5782a33bee2753bf28411de8822e3e3c7501966eb1bGuy Eilam		_sta = nxt,						\
5792a33bee2753bf28411de8822e3e3c7501966eb1bGuy Eilam		nxt = _sta ? rcu_dereference(_sta->hnext) : NULL	\
5802a33bee2753bf28411de8822e3e3c7501966eb1bGuy Eilam	     )								\
581abe60632f311d515b082b450504ee24006023951Johannes Berg	/* compare address and run code only if it matches */		\
5823bc7945e2642bcea92b0fd6a718565f45061439fJoe Perches	if (ether_addr_equal(_sta->sta.addr, (_addr)))
583abe60632f311d515b082b450504ee24006023951Johannes Berg
584d0709a65181beb787ef3f58cfe45536a2bb254c8Johannes Berg/*
585d0709a65181beb787ef3f58cfe45536a2bb254c8Johannes Berg * Get STA info by index, BROKEN!
586d0709a65181beb787ef3f58cfe45536a2bb254c8Johannes Berg */
5873b53fde8ac40c4321389def14d7f4a9e14092fd3Johannes Bergstruct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
5883b53fde8ac40c4321389def14d7f4a9e14092fd3Johannes Berg				     int idx);
589d0709a65181beb787ef3f58cfe45536a2bb254c8Johannes Berg/*
59073651ee6396c499ccb59ebc84c9274db01ed026dJohannes Berg * Create a new STA info, caller owns returned structure
59173651ee6396c499ccb59ebc84c9274db01ed026dJohannes Berg * until sta_info_insert().
592d0709a65181beb787ef3f58cfe45536a2bb254c8Johannes Berg */
59373651ee6396c499ccb59ebc84c9274db01ed026dJohannes Bergstruct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
59456544160d44c3043c0a7faffa506f616c1bb45f0Johannes Berg				const u8 *addr, gfp_t gfp);
595d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg
596d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Bergvoid sta_info_free(struct ieee80211_local *local, struct sta_info *sta);
597d9a7ddb05e5419ca5e4b54f57074dc33c7ea991cJohannes Berg
59873651ee6396c499ccb59ebc84c9274db01ed026dJohannes Berg/*
59973651ee6396c499ccb59ebc84c9274db01ed026dJohannes Berg * Insert STA info into hash table/list, returns zero or a
60073651ee6396c499ccb59ebc84c9274db01ed026dJohannes Berg * -EEXIST if (if the same MAC address is already present).
60173651ee6396c499ccb59ebc84c9274db01ed026dJohannes Berg *
60234e895075e21be3e21e71d6317440d1ee7969ad0Johannes Berg * Calling the non-rcu version makes the caller relinquish,
60334e895075e21be3e21e71d6317440d1ee7969ad0Johannes Berg * the _rcu version calls read_lock_rcu() and must be called
60434e895075e21be3e21e71d6317440d1ee7969ad0Johannes Berg * without it held.
60573651ee6396c499ccb59ebc84c9274db01ed026dJohannes Berg */
60673651ee6396c499ccb59ebc84c9274db01ed026dJohannes Bergint sta_info_insert(struct sta_info *sta);
60734e895075e21be3e21e71d6317440d1ee7969ad0Johannes Bergint sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU);
60834e895075e21be3e21e71d6317440d1ee7969ad0Johannes Berg
60983d5cc012441531ab0bf6f99881958e964e9cf11Johannes Bergint __must_check __sta_info_destroy(struct sta_info *sta);
61034e895075e21be3e21e71d6317440d1ee7969ad0Johannes Bergint sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata,
61134e895075e21be3e21e71d6317440d1ee7969ad0Johannes Berg			  const u8 *addr);
61234e895075e21be3e21e71d6317440d1ee7969ad0Johannes Bergint sta_info_destroy_addr_bss(struct ieee80211_sub_if_data *sdata,
61334e895075e21be3e21e71d6317440d1ee7969ad0Johannes Berg			      const u8 *addr);
614f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc
615c868cb35d013896ab6a80a554fb88baef06cedcdJohannes Bergvoid sta_info_recalc_tim(struct sta_info *sta);
616004c872e78d433f84f0a5cd4db7a6c780c0946e1Johannes Berg
617d0709a65181beb787ef3f58cfe45536a2bb254c8Johannes Bergvoid sta_info_init(struct ieee80211_local *local);
618d0709a65181beb787ef3f58cfe45536a2bb254c8Johannes Bergvoid sta_info_stop(struct ieee80211_local *local);
619051007d9e281cd8ea603a4cc4c96b0170b26c7e9Johannes Berg
620051007d9e281cd8ea603a4cc4c96b0170b26c7e9Johannes Berg/**
621051007d9e281cd8ea603a4cc4c96b0170b26c7e9Johannes Berg * sta_info_flush - flush matching STA entries from the STA table
622051007d9e281cd8ea603a4cc4c96b0170b26c7e9Johannes Berg *
623051007d9e281cd8ea603a4cc4c96b0170b26c7e9Johannes Berg * Returns the number of removed STA entries.
624051007d9e281cd8ea603a4cc4c96b0170b26c7e9Johannes Berg *
625051007d9e281cd8ea603a4cc4c96b0170b26c7e9Johannes Berg * @sdata: sdata to remove all stations from
626e716251d776ce92eb5169522f565ada3deed2a2aJohannes Berg * @vlans: if the given interface is an AP interface, also flush VLANs
627051007d9e281cd8ea603a4cc4c96b0170b26c7e9Johannes Berg */
628e716251d776ce92eb5169522f565ada3deed2a2aJohannes Bergint __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans);
629e716251d776ce92eb5169522f565ada3deed2a2aJohannes Berg
630e716251d776ce92eb5169522f565ada3deed2a2aJohannes Bergstatic inline int sta_info_flush(struct ieee80211_sub_if_data *sdata)
631e716251d776ce92eb5169522f565ada3deed2a2aJohannes Berg{
632e716251d776ce92eb5169522f565ada3deed2a2aJohannes Berg	return __sta_info_flush(sdata, false);
633e716251d776ce92eb5169522f565ada3deed2a2aJohannes Berg}
634051007d9e281cd8ea603a4cc4c96b0170b26c7e9Johannes Berg
6356b62bf326393deede630731a933713de9d574128Thomas Pedersenvoid sta_set_rate_info_tx(struct sta_info *sta,
6366b62bf326393deede630731a933713de9d574128Thomas Pedersen			  const struct ieee80211_tx_rate *rate,
6376b62bf326393deede630731a933713de9d574128Thomas Pedersen			  struct rate_info *rinfo);
638003e676af5044c2168dafbb49c7b8d61dd68cc60Saravanavoid sta_set_rate_info_rx(struct sta_info *sta,
639003e676af5044c2168dafbb49c7b8d61dd68cc60Saravana			  struct rate_info *rinfo);
640b7ffbd7ef6751f6cde73082346e365738daf00d2Johannes Bergvoid sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo);
641b7ffbd7ef6751f6cde73082346e365738daf00d2Johannes Berg
64224723d1bc9da79a53d0495b9cf9ee18747121b03Johannes Bergvoid ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
64324723d1bc9da79a53d0495b9cf9ee18747121b03Johannes Berg			  unsigned long exp_time);
644687da132234feb70748df04a007bc1820f392254Emmanuel Grumbachu8 sta_info_tx_streams(struct sta_info *sta);
645d0709a65181beb787ef3f58cfe45536a2bb254c8Johannes Berg
646af81858172cc0f3da81946aab919c26e4b364efcJohannes Bergvoid ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta);
647af81858172cc0f3da81946aab919c26e4b364efcJohannes Bergvoid ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta);
64847086fc51aa2220f58049704a8b73e4fcdf372b9Johannes Bergvoid ieee80211_sta_ps_deliver_uapsd(struct sta_info *sta);
649af81858172cc0f3da81946aab919c26e4b364efcJohannes Berg
650f0706e828e96d0fa4e80c0d25aa98523f6d589a0Jiri Benc#endif /* STA_INFO_H */
651