aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/sta_info.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-06-10 04:21:39 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-14 15:39:27 -0400
commita622ab72b4dcfdf53e24b16e9530cb876979a00c (patch)
tree170d2ccf3a594f3675b5fa58378319031054e806 /net/mac80211/sta_info.h
parenta87f736d942c86255e3088c606f0e3eab6bbf784 (diff)
mac80211: use RCU for TX aggregation
Currently we allocate some memory for each TX aggregation session and additionally keep a state bitmap indicating the state it is in. By using RCU to protect the pointer, moving the state into the structure and some locking trickery we can avoid locking when the TX agg session is fully operational. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/sta_info.h')
-rw-r--r--net/mac80211/sta_info.h33
1 files changed, 19 insertions, 14 deletions
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 16864a6045b4..05278e6288c9 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -61,33 +61,40 @@ enum ieee80211_sta_info_flags {
61 61
62#define STA_TID_NUM 16 62#define STA_TID_NUM 16
63#define ADDBA_RESP_INTERVAL HZ 63#define ADDBA_RESP_INTERVAL HZ
64#define HT_AGG_MAX_RETRIES (0x3) 64#define HT_AGG_MAX_RETRIES 0x3
65 65
66#define HT_AGG_STATE_INITIATOR_SHIFT (4) 66#define HT_AGG_STATE_DRV_READY 0
67 67#define HT_AGG_STATE_RESPONSE_RECEIVED 1
68#define HT_ADDBA_REQUESTED_MSK BIT(0) 68#define HT_AGG_STATE_OPERATIONAL 2
69#define HT_ADDBA_DRV_READY_MSK BIT(1) 69#define HT_AGG_STATE_STOPPING 3
70#define HT_ADDBA_RECEIVED_MSK BIT(2)
71#define HT_AGG_STATE_REQ_STOP_BA_MSK BIT(3)
72#define HT_AGG_STATE_INITIATOR_MSK BIT(HT_AGG_STATE_INITIATOR_SHIFT)
73#define HT_AGG_STATE_IDLE (0x0)
74#define HT_AGG_STATE_OPERATIONAL (HT_ADDBA_REQUESTED_MSK | \
75 HT_ADDBA_DRV_READY_MSK | \
76 HT_ADDBA_RECEIVED_MSK)
77 70
78/** 71/**
79 * struct tid_ampdu_tx - TID aggregation information (Tx). 72 * struct tid_ampdu_tx - TID aggregation information (Tx).
80 * 73 *
74 * @rcu_head: rcu head for freeing structure
81 * @addba_resp_timer: timer for peer's response to addba request 75 * @addba_resp_timer: timer for peer's response to addba request
82 * @pending: pending frames queue -- use sta's spinlock to protect 76 * @pending: pending frames queue -- use sta's spinlock to protect
83 * @ssn: Starting Sequence Number expected to be aggregated. 77 * @ssn: Starting Sequence Number expected to be aggregated.
84 * @dialog_token: dialog token for aggregation session 78 * @dialog_token: dialog token for aggregation session
79 * @state: session state (see above)
80 * @stop_initiator: initiator of a session stop
81 *
82 * This structure is protected by RCU and the per-station
83 * spinlock. Assignments to the array holding it must hold
84 * the spinlock, only the TX path can access it under RCU
85 * lock-free if, and only if, the state has the flag
86 * %HT_AGG_STATE_OPERATIONAL set. Otherwise, the TX path
87 * must also acquire the spinlock and re-check the state,
88 * see comments in the tx code touching it.
85 */ 89 */
86struct tid_ampdu_tx { 90struct tid_ampdu_tx {
91 struct rcu_head rcu_head;
87 struct timer_list addba_resp_timer; 92 struct timer_list addba_resp_timer;
88 struct sk_buff_head pending; 93 struct sk_buff_head pending;
94 unsigned long state;
89 u16 ssn; 95 u16 ssn;
90 u8 dialog_token; 96 u8 dialog_token;
97 u8 stop_initiator;
91}; 98};
92 99
93/** 100/**
@@ -129,7 +136,6 @@ struct tid_ampdu_rx {
129 * struct sta_ampdu_mlme - STA aggregation information. 136 * struct sta_ampdu_mlme - STA aggregation information.
130 * 137 *
131 * @tid_rx: aggregation info for Rx per TID -- RCU protected 138 * @tid_rx: aggregation info for Rx per TID -- RCU protected
132 * @tid_state_tx: TID's state in Tx session state machine.
133 * @tid_tx: aggregation info for Tx per TID 139 * @tid_tx: aggregation info for Tx per TID
134 * @addba_req_num: number of times addBA request has been sent. 140 * @addba_req_num: number of times addBA request has been sent.
135 * @dialog_token_allocator: dialog token enumerator for each new session; 141 * @dialog_token_allocator: dialog token enumerator for each new session;
@@ -138,7 +144,6 @@ struct sta_ampdu_mlme {
138 /* rx */ 144 /* rx */
139 struct tid_ampdu_rx *tid_rx[STA_TID_NUM]; 145 struct tid_ampdu_rx *tid_rx[STA_TID_NUM];
140 /* tx */ 146 /* tx */
141 u8 tid_state_tx[STA_TID_NUM];
142 struct tid_ampdu_tx *tid_tx[STA_TID_NUM]; 147 struct tid_ampdu_tx *tid_tx[STA_TID_NUM];
143 u8 addba_req_num[STA_TID_NUM]; 148 u8 addba_req_num[STA_TID_NUM];
144 u8 dialog_token_allocator; 149 u8 dialog_token_allocator;