diff options
author | Jouni Malinen <jouni.malinen@atheros.com> | 2009-03-03 06:11:53 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-03-05 14:39:43 -0500 |
commit | d216aaa674feb14a4aeb56bc3708f69d81c39d45 (patch) | |
tree | 34d5c3b158f93fa60444d8fd10b98b08d5480544 /drivers | |
parent | aebe2b5624b9a3c00b78b1b285c43de73c81f7c5 (diff) |
ath9k: Clean up setkey operations
There is no need to use ath_keyset() wrapper for
ath9k_hw_set_keycache_entry() calls. In addition, improve the comments
describing the key setting operations.
Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index d5b0035e9b9e..b7a3523e6ed8 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -638,17 +638,6 @@ static u32 ath_get_extchanmode(struct ath_softc *sc, | |||
638 | return chanmode; | 638 | return chanmode; |
639 | } | 639 | } |
640 | 640 | ||
641 | static int ath_keyset(struct ath_softc *sc, u16 keyix, | ||
642 | struct ath9k_keyval *hk, const u8 mac[ETH_ALEN]) | ||
643 | { | ||
644 | bool status; | ||
645 | |||
646 | status = ath9k_hw_set_keycache_entry(sc->sc_ah, | ||
647 | keyix, hk, mac); | ||
648 | |||
649 | return status != false; | ||
650 | } | ||
651 | |||
652 | static int ath_setkey_tkip(struct ath_softc *sc, u16 keyix, const u8 *key, | 641 | static int ath_setkey_tkip(struct ath_softc *sc, u16 keyix, const u8 *key, |
653 | struct ath9k_keyval *hk, const u8 *addr, | 642 | struct ath9k_keyval *hk, const u8 *addr, |
654 | bool authenticator) | 643 | bool authenticator) |
@@ -660,7 +649,11 @@ static int ath_setkey_tkip(struct ath_softc *sc, u16 keyix, const u8 *key, | |||
660 | key_rxmic = key + NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY; | 649 | key_rxmic = key + NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY; |
661 | 650 | ||
662 | if (addr == NULL) { | 651 | if (addr == NULL) { |
663 | /* Group key installation */ | 652 | /* |
653 | * Group key installation - only two key cache entries are used | ||
654 | * regardless of splitmic capability since group key is only | ||
655 | * used either for TX or RX. | ||
656 | */ | ||
664 | if (authenticator) { | 657 | if (authenticator) { |
665 | memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic)); | 658 | memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic)); |
666 | memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_mic)); | 659 | memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_mic)); |
@@ -668,24 +661,21 @@ static int ath_setkey_tkip(struct ath_softc *sc, u16 keyix, const u8 *key, | |||
668 | memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); | 661 | memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); |
669 | memcpy(hk->kv_txmic, key_rxmic, sizeof(hk->kv_mic)); | 662 | memcpy(hk->kv_txmic, key_rxmic, sizeof(hk->kv_mic)); |
670 | } | 663 | } |
671 | return ath_keyset(sc, keyix, hk, addr); | 664 | return ath9k_hw_set_keycache_entry(sc->sc_ah, keyix, hk, addr); |
672 | } | 665 | } |
673 | if (!sc->splitmic) { | 666 | if (!sc->splitmic) { |
674 | /* | 667 | /* TX and RX keys share the same key cache entry. */ |
675 | * data key goes at first index, | ||
676 | * the hal handles the MIC keys at index+64. | ||
677 | */ | ||
678 | memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); | 668 | memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); |
679 | memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_txmic)); | 669 | memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_txmic)); |
680 | return ath_keyset(sc, keyix, hk, addr); | 670 | return ath9k_hw_set_keycache_entry(sc->sc_ah, keyix, hk, addr); |
681 | } | 671 | } |
682 | /* | 672 | |
683 | * TX key goes at first index, RX key at +32. | 673 | /* Separate key cache entries for TX and RX */ |
684 | * The hal handles the MIC keys at index+64. | 674 | |
685 | */ | 675 | /* TX key goes at first index, RX key at +32. */ |
686 | memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic)); | 676 | memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic)); |
687 | if (!ath_keyset(sc, keyix, hk, NULL)) { | 677 | if (!ath9k_hw_set_keycache_entry(sc->sc_ah, keyix, hk, NULL)) { |
688 | /* Txmic entry failed. No need to proceed further */ | 678 | /* TX MIC entry failed. No need to proceed further */ |
689 | DPRINTF(sc, ATH_DBG_KEYCACHE, | 679 | DPRINTF(sc, ATH_DBG_KEYCACHE, |
690 | "Setting TX MIC Key Failed\n"); | 680 | "Setting TX MIC Key Failed\n"); |
691 | return 0; | 681 | return 0; |
@@ -693,7 +683,7 @@ static int ath_setkey_tkip(struct ath_softc *sc, u16 keyix, const u8 *key, | |||
693 | 683 | ||
694 | memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); | 684 | memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); |
695 | /* XXX delete tx key on failure? */ | 685 | /* XXX delete tx key on failure? */ |
696 | return ath_keyset(sc, keyix + 32, hk, addr); | 686 | return ath9k_hw_set_keycache_entry(sc->sc_ah, keyix + 32, hk, addr); |
697 | } | 687 | } |
698 | 688 | ||
699 | static int ath_reserve_key_cache_slot_tkip(struct ath_softc *sc) | 689 | static int ath_reserve_key_cache_slot_tkip(struct ath_softc *sc) |
@@ -840,7 +830,7 @@ static int ath_key_config(struct ath_softc *sc, | |||
840 | ret = ath_setkey_tkip(sc, idx, key->key, &hk, mac, | 830 | ret = ath_setkey_tkip(sc, idx, key->key, &hk, mac, |
841 | vif->type == NL80211_IFTYPE_AP); | 831 | vif->type == NL80211_IFTYPE_AP); |
842 | else | 832 | else |
843 | ret = ath_keyset(sc, idx, &hk, mac); | 833 | ret = ath9k_hw_set_keycache_entry(sc->sc_ah, idx, &hk, mac); |
844 | 834 | ||
845 | if (!ret) | 835 | if (!ret) |
846 | return -EIO; | 836 | return -EIO; |