1 Subject: mac80211: minor code cleanups
3 Nothing very interesting, some checkpatch inspired stuff,
6 Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
8 net/mac80211/debugfs_sta.c | 6 +++---
9 net/mac80211/main.c | 2 +-
10 net/mac80211/mesh.c | 2 +-
11 net/mac80211/rc80211_pid.h | 2 +-
12 net/mac80211/rx.c | 24 +++++++++++++-----------
13 net/mac80211/sta_info.c | 4 ++--
14 net/mac80211/wep.c | 26 +++++++++++++-------------
15 net/mac80211/wep.h | 2 +-
16 net/mac80211/wpa.c | 29 ++++++++++-------------------
17 9 files changed, 45 insertions(+), 52 deletions(-)
19 --- everything.orig/net/mac80211/wep.c 2008-10-07 20:05:49.000000000 +0200
20 +++ everything/net/mac80211/wep.c 2008-10-07 20:06:41.000000000 +0200
21 @@ -49,17 +49,19 @@ void ieee80211_wep_free(struct ieee80211
22 crypto_free_blkcipher(local->wep_rx_tfm);
25 -static inline int ieee80211_wep_weak_iv(u32 iv, int keylen)
26 +static inline bool ieee80211_wep_weak_iv(u32 iv, int keylen)
28 - /* Fluhrer, Mantin, and Shamir have reported weaknesses in the
30 + * Fluhrer, Mantin, and Shamir have reported weaknesses in the
31 * key scheduling algorithm of RC4. At least IVs (KeyByte + 3,
32 - * 0xff, N) can be used to speedup attacks, so avoid using them. */
33 + * 0xff, N) can be used to speedup attacks, so avoid using them.
35 if ((iv & 0xff00) == 0xff00) {
36 u8 B = (iv >> 16) & 0xff;
37 if (B >= 3 && B < 3 + keylen)
46 @@ -268,7 +270,7 @@ int ieee80211_wep_decrypt(struct ieee802
50 -u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key)
51 +bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key)
53 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
55 @@ -276,16 +278,13 @@ u8 * ieee80211_wep_is_weak_iv(struct sk_
58 if (!ieee80211_has_protected(hdr->frame_control))
62 hdrlen = ieee80211_hdrlen(hdr->frame_control);
63 ivpos = skb->data + hdrlen;
64 iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2];
66 - if (ieee80211_wep_weak_iv(iv, key->conf.keylen))
70 + return ieee80211_wep_weak_iv(iv, key->conf.keylen);
74 @@ -329,6 +328,8 @@ static int wep_encrypt_skb(struct ieee80
76 ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx)
80 ieee80211_tx_set_protected(tx);
82 if (wep_encrypt_skb(tx, tx->skb) < 0) {
83 @@ -337,9 +338,8 @@ ieee80211_crypto_wep_encrypt(struct ieee
88 for (i = 0; i < tx->num_extra_frag; i++) {
89 - if (wep_encrypt_skb(tx, tx->extra_frag[i]) < 0) {
90 + if (wep_encrypt_skb(tx, tx->extra_frag[i])) {
91 I802_DEBUG_INC(tx->local->
92 tx_handlers_drop_wep);
94 --- everything.orig/net/mac80211/wep.h 2008-10-07 20:05:28.000000000 +0200
95 +++ everything/net/mac80211/wep.h 2008-10-07 20:06:41.000000000 +0200
96 @@ -26,7 +26,7 @@ int ieee80211_wep_encrypt(struct ieee802
97 struct ieee80211_key *key);
98 int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb,
99 struct ieee80211_key *key);
100 -u8 *ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key);
101 +bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key);
104 ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx);
105 --- everything.orig/net/mac80211/wpa.c 2008-10-07 20:05:49.000000000 +0200
106 +++ everything/net/mac80211/wpa.c 2008-10-07 20:06:41.000000000 +0200
107 @@ -49,8 +49,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
108 !(tx->flags & IEEE80211_TX_FRAGMENTED) &&
109 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) &&
111 - /* hwaccel - with no need for preallocated room for Michael MIC
113 + /* hwaccel - with no need for preallocated room for MMIC */
117 @@ -67,8 +66,6 @@ ieee80211_tx_h_michael_mic_add(struct ie
121 - /* At this point we know we're using ALG_TKIP. To get the MIC key
122 - * we now will rely on the offset from the ieee80211_key_conf::key */
123 key_offset = authenticator ?
124 NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY :
125 NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY;
126 @@ -92,9 +89,7 @@ ieee80211_rx_h_michael_mic_verify(struct
127 int authenticator = 1, wpa_test = 0;
128 DECLARE_MAC_BUF(mac);
131 - * No way to verify the MIC if the hardware stripped it
133 + /* No way to verify the MIC if the hardware stripped it */
134 if (rx->status->flag & RX_FLAG_MMIC_STRIPPED)
137 @@ -116,8 +111,6 @@ ieee80211_rx_h_michael_mic_verify(struct
141 - /* At this point we know we're using ALG_TKIP. To get the MIC key
142 - * we now will rely on the offset from the ieee80211_key_conf::key */
143 key_offset = authenticator ?
144 NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY :
145 NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY;
146 @@ -202,6 +195,7 @@ ieee80211_tx_result
147 ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx)
149 struct sk_buff *skb = tx->skb;
152 ieee80211_tx_set_protected(tx);
154 @@ -209,9 +203,8 @@ ieee80211_crypto_tkip_encrypt(struct iee
157 if (tx->extra_frag) {
159 for (i = 0; i < tx->num_extra_frag; i++) {
160 - if (tkip_encrypt_skb(tx, tx->extra_frag[i]) < 0)
161 + if (tkip_encrypt_skb(tx, tx->extra_frag[i]))
165 @@ -350,7 +343,7 @@ static inline void ccmp_pn2hdr(u8 *hdr,
169 -static inline int ccmp_hdr2pn(u8 *pn, u8 *hdr)
170 +static inline void ccmp_hdr2pn(u8 *pn, u8 *hdr)
174 @@ -358,7 +351,6 @@ static inline int ccmp_hdr2pn(u8 *pn, u8
178 - return (hdr[3] >> 6) & 0x03;
182 @@ -373,7 +365,7 @@ static int ccmp_encrypt_skb(struct ieee8
184 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
185 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
186 - /* hwaccel - with no need for preallocated room for CCMP "
187 + /* hwaccel - with no need for preallocated room for CCMP
188 * header or MIC fields */
189 info->control.hw_key = &tx->key->conf;
191 @@ -426,6 +418,7 @@ ieee80211_tx_result
192 ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
194 struct sk_buff *skb = tx->skb;
197 ieee80211_tx_set_protected(tx);
199 @@ -433,9 +426,8 @@ ieee80211_crypto_ccmp_encrypt(struct iee
202 if (tx->extra_frag) {
204 for (i = 0; i < tx->num_extra_frag; i++) {
205 - if (ccmp_encrypt_skb(tx, tx->extra_frag[i]) < 0)
206 + if (ccmp_encrypt_skb(tx, tx->extra_frag[i]))
210 @@ -468,7 +460,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
211 (rx->status->flag & RX_FLAG_IV_STRIPPED))
214 - (void) ccmp_hdr2pn(pn, skb->data + hdrlen);
215 + ccmp_hdr2pn(pn, skb->data + hdrlen);
217 if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) {
218 key->u.ccmp.replays++;
219 @@ -483,9 +475,8 @@ ieee80211_crypto_ccmp_decrypt(struct iee
220 key->u.ccmp.tfm, key->u.ccmp.rx_crypto_buf,
221 skb->data + hdrlen + CCMP_HDR_LEN, data_len,
222 skb->data + skb->len - CCMP_MIC_LEN,
223 - skb->data + hdrlen + CCMP_HDR_LEN)) {
224 + skb->data + hdrlen + CCMP_HDR_LEN))
225 return RX_DROP_UNUSABLE;
229 memcpy(key->u.ccmp.rx_pn[rx->queue], pn, CCMP_PN_LEN);
230 --- everything.orig/net/mac80211/debugfs_sta.c 2008-10-07 20:06:40.000000000 +0200
231 +++ everything/net/mac80211/debugfs_sta.c 2008-10-07 20:06:41.000000000 +0200
232 @@ -137,7 +137,7 @@ static ssize_t sta_agg_status_read(struc
233 p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:");
234 for (i = 0; i < STA_TID_NUM; i++)
235 p += scnprintf(p, sizeof(buf)+buf-p, "%5d",
236 - sta->ampdu_mlme.tid_state_rx[i]?
237 + sta->ampdu_mlme.tid_state_rx[i] ?
238 sta->ampdu_mlme.tid_rx[i]->dialog_token : 0);
240 p += scnprintf(p, sizeof(buf)+buf-p, "\n TX :");
241 @@ -148,13 +148,13 @@ static ssize_t sta_agg_status_read(struc
242 p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:");
243 for (i = 0; i < STA_TID_NUM; i++)
244 p += scnprintf(p, sizeof(buf)+buf-p, "%5d",
245 - sta->ampdu_mlme.tid_state_tx[i]?
246 + sta->ampdu_mlme.tid_state_tx[i] ?
247 sta->ampdu_mlme.tid_tx[i]->dialog_token : 0);
249 p += scnprintf(p, sizeof(buf)+buf-p, "\n SSN :");
250 for (i = 0; i < STA_TID_NUM; i++)
251 p += scnprintf(p, sizeof(buf)+buf-p, "%5d",
252 - sta->ampdu_mlme.tid_state_tx[i]?
253 + sta->ampdu_mlme.tid_state_tx[i] ?
254 sta->ampdu_mlme.tid_tx[i]->ssn : 0);
256 p += scnprintf(p, sizeof(buf)+buf-p, "\n");
257 --- everything.orig/net/mac80211/main.c 2008-10-07 20:05:49.000000000 +0200
258 +++ everything/net/mac80211/main.c 2008-10-07 20:06:41.000000000 +0200
259 @@ -1013,7 +1013,7 @@ static int __init ieee80211_init(void)
261 BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb));
262 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, driver_data) +
263 - IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb));
264 + IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb));
266 ret = rc80211_minstrel_init();
268 --- everything.orig/net/mac80211/mesh.c 2008-10-07 20:05:28.000000000 +0200
269 +++ everything/net/mac80211/mesh.c 2008-10-07 20:06:41.000000000 +0200
270 @@ -473,7 +473,7 @@ static void ieee80211_mesh_rx_bcn_presp(
272 struct ieee80211_rx_status *rx_status)
274 - struct ieee80211_local *local= sdata->local;
275 + struct ieee80211_local *local = sdata->local;
276 struct ieee802_11_elems elems;
277 struct ieee80211_channel *channel;
279 --- everything.orig/net/mac80211/rc80211_pid.h 2008-10-07 20:05:28.000000000 +0200
280 +++ everything/net/mac80211/rc80211_pid.h 2008-10-07 20:06:41.000000000 +0200
283 /* Arithmetic right shift for positive and negative values for ISO C. */
284 #define RC_PID_DO_ARITH_RIGHT_SHIFT(x, y) \
285 - (x) < 0 ? -((-(x)) >> (y)) : (x) >> (y)
286 + ((x) < 0 ? -((-(x)) >> (y)) : (x) >> (y))
288 enum rc_pid_event_type {
289 RC_PID_EVENT_TYPE_TX_STATUS,
290 --- everything.orig/net/mac80211/rx.c 2008-10-07 20:06:38.000000000 +0200
291 +++ everything/net/mac80211/rx.c 2008-10-07 20:06:41.000000000 +0200
296 -u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
297 - struct tid_ampdu_rx *tid_agg_rx,
298 - struct sk_buff *skb, u16 mpdu_seq_num,
300 +static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
301 + struct tid_ampdu_rx *tid_agg_rx,
302 + struct sk_buff *skb,
306 * monitor mode reception
308 @@ -2000,17 +2001,17 @@ static void __ieee80211_rx_handle_packet
310 static inline int seq_less(u16 sq1, u16 sq2)
312 - return (((sq1 - sq2) & SEQ_MASK) > (SEQ_MODULO >> 1));
313 + return ((sq1 - sq2) & SEQ_MASK) > (SEQ_MODULO >> 1);
316 static inline u16 seq_inc(u16 sq)
318 - return ((sq + 1) & SEQ_MASK);
319 + return (sq + 1) & SEQ_MASK;
322 static inline u16 seq_sub(u16 sq1, u16 sq2)
324 - return ((sq1 - sq2) & SEQ_MASK);
325 + return (sq1 - sq2) & SEQ_MASK;
329 @@ -2018,10 +2019,11 @@ static inline u16 seq_sub(u16 sq1, u16 s
330 * As it function blongs to Rx path it must be called with
331 * the proper rcu_read_lock protection for its flow.
333 -u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
334 - struct tid_ampdu_rx *tid_agg_rx,
335 - struct sk_buff *skb, u16 mpdu_seq_num,
337 +static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
338 + struct tid_ampdu_rx *tid_agg_rx,
339 + struct sk_buff *skb,
343 struct ieee80211_local *local = hw_to_local(hw);
344 struct ieee80211_rx_status status;
345 --- everything.orig/net/mac80211/sta_info.c 2008-10-07 20:06:39.000000000 +0200
346 +++ everything/net/mac80211/sta_info.c 2008-10-07 20:06:41.000000000 +0200
347 @@ -294,7 +294,7 @@ int sta_info_insert(struct sta_info *sta
350 if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->dev->dev_addr) == 0 ||
351 - is_multicast_ether_addr(sta->sta.addr))) {
352 + is_multicast_ether_addr(sta->sta.addr))) {
356 @@ -830,7 +830,7 @@ void ieee80211_sta_expire(struct ieee802
359 struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
363 struct sta_info *sta = sta_info_get(hw_to_local(hw), addr);