diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2008-12-20 04:58:33 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:58:39 -0500 |
commit | 7b40982e235d6ff9343d38703eb48a0143afcc26 (patch) | |
tree | 996ffa0777166be363b55b9568fcd38f7a3c1e4e /drivers/net/wireless/rt2x00/rt2x00mac.c | |
parent | 91581b627287d8cc3ee382ee038e04c4beca8176 (diff) |
rt2x00: Move code into seperate functions
Some functions have grown rapidly in size over the last time,
some of those functions (like the rt2x00queue_create_tx_descriptor)
will further increase in size soon, so it is best to start cutting
it into logical pieces.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00mac.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00mac.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index e6fba830d1d3..bf7755a21645 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -79,8 +79,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev, | |||
79 | * RTS/CTS frame should use the length of the frame plus any | 79 | * RTS/CTS frame should use the length of the frame plus any |
80 | * encryption overhead that will be added by the hardware. | 80 | * encryption overhead that will be added by the hardware. |
81 | */ | 81 | */ |
82 | if (!frag_skb->do_not_encrypt) | 82 | data_length += rt2x00crypto_tx_overhead(rt2x00dev, skb); |
83 | data_length += rt2x00crypto_tx_overhead(tx_info); | ||
84 | 83 | ||
85 | if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) | 84 | if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) |
86 | ieee80211_ctstoself_get(rt2x00dev->hw, tx_info->control.vif, | 85 | ieee80211_ctstoself_get(rt2x00dev->hw, tx_info->control.vif, |
@@ -484,6 +483,24 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw, | |||
484 | EXPORT_SYMBOL_GPL(rt2x00mac_configure_filter); | 483 | EXPORT_SYMBOL_GPL(rt2x00mac_configure_filter); |
485 | 484 | ||
486 | #ifdef CONFIG_RT2X00_LIB_CRYPTO | 485 | #ifdef CONFIG_RT2X00_LIB_CRYPTO |
486 | static void memcpy_tkip(struct rt2x00lib_crypto *crypto, u8 *key, u8 key_len) | ||
487 | { | ||
488 | if (key_len > NL80211_TKIP_DATA_OFFSET_ENCR_KEY) | ||
489 | memcpy(&crypto->key, | ||
490 | &key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY], | ||
491 | sizeof(crypto->key)); | ||
492 | |||
493 | if (key_len > NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY) | ||
494 | memcpy(&crypto->tx_mic, | ||
495 | &key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY], | ||
496 | sizeof(crypto->tx_mic)); | ||
497 | |||
498 | if (key_len > NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY) | ||
499 | memcpy(&crypto->rx_mic, | ||
500 | &key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY], | ||
501 | sizeof(crypto->rx_mic)); | ||
502 | } | ||
503 | |||
487 | int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 504 | int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
488 | const u8 *local_address, const u8 *address, | 505 | const u8 *local_address, const u8 *address, |
489 | struct ieee80211_key_conf *key) | 506 | struct ieee80211_key_conf *key) |
@@ -521,22 +538,9 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
521 | crypto.cmd = cmd; | 538 | crypto.cmd = cmd; |
522 | crypto.address = address; | 539 | crypto.address = address; |
523 | 540 | ||
524 | if (crypto.cipher == CIPHER_TKIP) { | 541 | if (crypto.cipher == CIPHER_TKIP) |
525 | if (key->keylen > NL80211_TKIP_DATA_OFFSET_ENCR_KEY) | 542 | memcpy_tkip(&crypto, &key->key[0], key->keylen); |
526 | memcpy(&crypto.key, | 543 | else |
527 | &key->key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY], | ||
528 | sizeof(crypto.key)); | ||
529 | |||
530 | if (key->keylen > NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY) | ||
531 | memcpy(&crypto.tx_mic, | ||
532 | &key->key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY], | ||
533 | sizeof(crypto.tx_mic)); | ||
534 | |||
535 | if (key->keylen > NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY) | ||
536 | memcpy(&crypto.rx_mic, | ||
537 | &key->key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY], | ||
538 | sizeof(crypto.rx_mic)); | ||
539 | } else | ||
540 | memcpy(&crypto.key, &key->key[0], key->keylen); | 544 | memcpy(&crypto.key, &key->key[0], key->keylen); |
541 | 545 | ||
542 | /* | 546 | /* |