aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2010-02-22 01:38:40 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-03-09 15:03:04 -0500
commit04e36fc5f1ff4e349ea21de8d15e4e1844d04197 (patch)
tree8778ddf51094e3339392ea68233ce02c526ad418 /drivers/net
parent5c9417f1656b0f415f4be5a7cd7195ecadd7dd1a (diff)
wl1271: Clean up TX security sequence number handling
Instead of managing the TX security sequence number as two variables, use one 64 bit variable. This greatly simplifies the handling of the number. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271.h6
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.c3
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c11
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_tx.c10
4 files changed, 12 insertions, 18 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 41de47caa201..0deb4fdf916b 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -110,6 +110,9 @@ enum {
110#define WL1271_FW_NAME "wl1271-fw.bin" 110#define WL1271_FW_NAME "wl1271-fw.bin"
111#define WL1271_NVS_NAME "wl1271-nvs.bin" 111#define WL1271_NVS_NAME "wl1271-nvs.bin"
112 112
113#define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff))
114#define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff))
115
113/* NVS data structure */ 116/* NVS data structure */
114#define WL1271_NVS_SECTION_SIZE 468 117#define WL1271_NVS_SECTION_SIZE 468
115 118
@@ -419,8 +422,7 @@ struct wl1271 {
419 422
420 /* Security sequence number counters */ 423 /* Security sequence number counters */
421 u8 tx_security_last_seq; 424 u8 tx_security_last_seq;
422 u16 tx_security_seq_16; 425 s64 tx_security_seq;
423 u32 tx_security_seq_32;
424 426
425 /* FW Rx counter */ 427 /* FW Rx counter */
426 u32 rx_counter; 428 u32 rx_counter;
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index e029bf03809d..d59b3830a6a5 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -318,8 +318,7 @@ int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type)
318 318
319 /* reset TX security counters */ 319 /* reset TX security counters */
320 wl->tx_security_last_seq = 0; 320 wl->tx_security_last_seq = 0;
321 wl->tx_security_seq_16 = 0; 321 wl->tx_security_seq = 0;
322 wl->tx_security_seq_32 = 0;
323 322
324 ret = wl1271_cmd_send(wl, CMD_START_JOIN, join, sizeof(*join), 0); 323 ret = wl1271_cmd_send(wl, CMD_START_JOIN, join, sizeof(*join), 0);
325 if (ret < 0) { 324 if (ret < 0) {
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 4c4d22acaeea..f10ba847689d 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1020,8 +1020,7 @@ static void wl1271_op_stop(struct ieee80211_hw *hw)
1020 wl->tx_results_count = 0; 1020 wl->tx_results_count = 0;
1021 wl->tx_packets_count = 0; 1021 wl->tx_packets_count = 0;
1022 wl->tx_security_last_seq = 0; 1022 wl->tx_security_last_seq = 0;
1023 wl->tx_security_seq_16 = 0; 1023 wl->tx_security_seq = 0;
1024 wl->tx_security_seq_32 = 0;
1025 wl->time_offset = 0; 1024 wl->time_offset = 0;
1026 wl->session_counter = 0; 1025 wl->session_counter = 0;
1027 wl->rate_set = CONF_TX_RATE_MASK_BASIC; 1026 wl->rate_set = CONF_TX_RATE_MASK_BASIC;
@@ -1428,15 +1427,15 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1428 key_type = KEY_TKIP; 1427 key_type = KEY_TKIP;
1429 1428
1430 key_conf->hw_key_idx = key_conf->keyidx; 1429 key_conf->hw_key_idx = key_conf->keyidx;
1431 tx_seq_32 = wl->tx_security_seq_32; 1430 tx_seq_32 = WL1271_TX_SECURITY_HI32(wl->tx_security_seq);
1432 tx_seq_16 = wl->tx_security_seq_16; 1431 tx_seq_16 = WL1271_TX_SECURITY_LO16(wl->tx_security_seq);
1433 break; 1432 break;
1434 case ALG_CCMP: 1433 case ALG_CCMP:
1435 key_type = KEY_AES; 1434 key_type = KEY_AES;
1436 1435
1437 key_conf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 1436 key_conf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
1438 tx_seq_32 = wl->tx_security_seq_32; 1437 tx_seq_32 = WL1271_TX_SECURITY_HI32(wl->tx_security_seq);
1439 tx_seq_16 = wl->tx_security_seq_16; 1438 tx_seq_16 = WL1271_TX_SECURITY_LO16(wl->tx_security_seq);
1440 break; 1439 break;
1441 default: 1440 default:
1442 wl1271_error("Unknown key algo 0x%x", key_conf->alg); 1441 wl1271_error("Unknown key algo 0x%x", key_conf->alg);
diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.c b/drivers/net/wireless/wl12xx/wl1271_tx.c
index d3ed63e92cf4..1b11e2caabd6 100644
--- a/drivers/net/wireless/wl12xx/wl1271_tx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_tx.c
@@ -303,7 +303,6 @@ static void wl1271_tx_complete_packet(struct wl1271 *wl,
303{ 303{
304 struct ieee80211_tx_info *info; 304 struct ieee80211_tx_info *info;
305 struct sk_buff *skb; 305 struct sk_buff *skb;
306 u16 seq;
307 int id = result->id; 306 int id = result->id;
308 307
309 /* check for id legality */ 308 /* check for id legality */
@@ -331,15 +330,10 @@ static void wl1271_tx_complete_packet(struct wl1271 *wl,
331 wl->stats.retry_count += result->ack_failures; 330 wl->stats.retry_count += result->ack_failures;
332 331
333 /* update security sequence number */ 332 /* update security sequence number */
334 seq = wl->tx_security_seq_16 + 333 wl->tx_security_seq += (result->lsb_security_sequence_number -
335 (result->lsb_security_sequence_number - 334 wl->tx_security_last_seq);
336 wl->tx_security_last_seq);
337 wl->tx_security_last_seq = result->lsb_security_sequence_number; 335 wl->tx_security_last_seq = result->lsb_security_sequence_number;
338 336
339 if (seq < wl->tx_security_seq_16)
340 wl->tx_security_seq_32++;
341 wl->tx_security_seq_16 = seq;
342
343 /* remove private header from packet */ 337 /* remove private header from packet */
344 skb_pull(skb, sizeof(struct wl1271_tx_hw_descr)); 338 skb_pull(skb, sizeof(struct wl1271_tx_hw_descr));
345 339