From 471b2f7fed9a065f1484472590ab606d1f419107 Mon Sep 17 00:00:00 2001 From: damien Date: Thu, 15 Jul 2010 20:37:38 +0000 Subject: [PATCH] According to Linux ath9k, the AR9280 1.0 was never sold. Since this is the only chip revision that requires split TKIP MIC keys, remove code that deal with that. --- sys/dev/ic/ar9280.c | 5 +--- sys/dev/ic/athn.c | 63 ++++++++++---------------------------------- sys/dev/ic/athnvar.h | 6 ++--- 3 files changed, 17 insertions(+), 57 deletions(-) diff --git a/sys/dev/ic/ar9280.c b/sys/dev/ic/ar9280.c index 643ef02fe49..128dd65653a 100644 --- a/sys/dev/ic/ar9280.c +++ b/sys/dev/ic/ar9280.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9280.c,v 1.9 2010/07/15 19:29:00 damien Exp $ */ +/* $OpenBSD: ar9280.c,v 1.10 2010/07/15 20:37:38 damien Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini @@ -96,9 +96,6 @@ const struct ar_spur_chan * int ar9280_attach(struct athn_softc *sc) { - /* AR9280 1.0 needs separate entries for Tx/Rx TKIP MIC. */ - if (AR_SREV_9280_10(sc)) - sc->flags |= ATHN_FLAG_SPLIT_TKIP_MIC; sc->eep_base = AR5416_EEP_START_LOC; sc->eep_size = sizeof(struct ar5416_eeprom); sc->def_nf = AR9280_PHY_CCA_MAX_GOOD_VALUE; diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c index e24727b6dc6..9f8f0c6f911 100644 --- a/sys/dev/ic/athn.c +++ b/sys/dev/ic/athn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: athn.c,v 1.54 2010/07/15 19:07:43 damien Exp $ */ +/* $OpenBSD: athn.c,v 1.55 2010/07/15 20:37:38 damien Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini @@ -219,13 +219,9 @@ athn_attach(struct athn_softc *sc) /* * In HostAP mode, the number of STAs that we can handle is * limited by the number of entries in the HW key cache. - * TKIP keys consume 2 or 4 entries in the cache. + * TKIP keys consume 2 entries in the cache. */ - if (sc->flags & ATHN_FLAG_SPLIT_TKIP_MIC) - ic->ic_max_nnodes = sc->kc_entries / 4; - else - ic->ic_max_nnodes = sc->kc_entries / 2; - ic->ic_max_nnodes -= IEEE80211_WEP_NKID; + ic->ic_max_nnodes = (sc->kc_entries / 2) - IEEE80211_WEP_NKID; if (ic->ic_max_nnodes > IEEE80211_CACHE_SIZE) ic->ic_max_nnodes = IEEE80211_CACHE_SIZE; @@ -963,44 +959,16 @@ athn_set_key(struct ieee80211com *ic, struct ieee80211_node *ni, rxmic = &key[16]; txmic = &key[24]; } - if (sc->flags & ATHN_FLAG_SPLIT_TKIP_MIC) { - /* Tx MIC is at entry + 64. */ - micentry = entry + 64; - AR_WRITE(sc, AR_KEYTABLE_KEY0(micentry), - LE_READ_4(&txmic[0])); - AR_WRITE(sc, AR_KEYTABLE_KEY1(micentry), 0); - - AR_WRITE(sc, AR_KEYTABLE_KEY2(micentry), - LE_READ_4(&txmic[4])); - AR_WRITE(sc, AR_KEYTABLE_KEY3(micentry), 0); - - /* Rx MIC key is at entry + 64 + 32. */ - micentry = entry + 64 + 32; - AR_WRITE(sc, AR_KEYTABLE_KEY0(micentry), - LE_READ_4(&rxmic[0])); - AR_WRITE(sc, AR_KEYTABLE_KEY1(micentry), 0); - - AR_WRITE(sc, AR_KEYTABLE_KEY2(micentry), - LE_READ_4(&rxmic[4])); - AR_WRITE(sc, AR_KEYTABLE_KEY3(micentry), 0); - } else { - /* Tx+Rx MIC key is at entry + 64. */ - micentry = entry + 64; - AR_WRITE(sc, AR_KEYTABLE_KEY0(micentry), - LE_READ_4(&rxmic[0])); - AR_WRITE(sc, AR_KEYTABLE_KEY1(micentry), - LE_READ_2(&txmic[2])); - - AR_WRITE(sc, AR_KEYTABLE_KEY2(micentry), - LE_READ_4(&rxmic[4])); - AR_WRITE(sc, AR_KEYTABLE_KEY3(micentry), - LE_READ_2(&txmic[0])); - - AR_WRITE(sc, AR_KEYTABLE_KEY4(micentry), - LE_READ_4(&txmic[4])); - AR_WRITE(sc, AR_KEYTABLE_TYPE(micentry), - AR_KEYTABLE_TYPE_CLR); - } + /* Tx+Rx MIC key is at entry + 64. */ + micentry = entry + 64; + AR_WRITE(sc, AR_KEYTABLE_KEY0(micentry), LE_READ_4(&rxmic[0])); + AR_WRITE(sc, AR_KEYTABLE_KEY1(micentry), LE_READ_2(&txmic[2])); + + AR_WRITE(sc, AR_KEYTABLE_KEY2(micentry), LE_READ_4(&rxmic[4])); + AR_WRITE(sc, AR_KEYTABLE_KEY3(micentry), LE_READ_2(&txmic[0])); + + AR_WRITE(sc, AR_KEYTABLE_KEY4(micentry), LE_READ_4(&txmic[4])); + AR_WRITE(sc, AR_KEYTABLE_TYPE(micentry), AR_KEYTABLE_TYPE_CLR); } AR_WRITE(sc, AR_KEYTABLE_KEY0(entry), LE_READ_4(&key[ 0])); AR_WRITE(sc, AR_KEYTABLE_KEY1(entry), LE_READ_2(&key[ 4])); @@ -1042,8 +1010,6 @@ athn_delete_key(struct ieee80211com *ic, struct ieee80211_node *ni, entry = (uintptr_t)k->k_priv; athn_reset_key(sc, entry); athn_reset_key(sc, entry + 64); - if (sc->flags & ATHN_FLAG_SPLIT_TKIP_MIC) - athn_reset_key(sc, entry + 64 + 32); break; default: /* Fallback to software crypto for other ciphers. */ @@ -2153,8 +2119,7 @@ athn_hw_reset(struct athn_softc *sc, struct ieee80211_channel *c, athn_init_qos(sc); - if (!(sc->flags & ATHN_FLAG_SPLIT_TKIP_MIC)) - AR_SETBITS(sc, AR_PCU_MISC, AR_PCU_MIC_NEW_LOC_ENA); + AR_SETBITS(sc, AR_PCU_MISC, AR_PCU_MIC_NEW_LOC_ENA); if (AR_SREV_9287_13_OR_LATER(sc) && !AR_SREV_9380_10_OR_LATER(sc)) ar9287_1_3_setup_async_fifo(sc); diff --git a/sys/dev/ic/athnvar.h b/sys/dev/ic/athnvar.h index 7bdd621e8a7..a49c0c3eb24 100644 --- a/sys/dev/ic/athnvar.h +++ b/sys/dev/ic/athnvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: athnvar.h,v 1.18 2010/06/22 19:44:22 damien Exp $ */ +/* $OpenBSD: athnvar.h,v 1.19 2010/07/15 20:37:38 damien Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini @@ -425,7 +425,7 @@ struct athn_softc { u_int flags; #define ATHN_FLAG_PCIE (1 << 0) #define ATHN_FLAG_OLPC (1 << 1) -#define ATHN_FLAG_SPLIT_MMIC (1 << 2) +#define ATHN_FLAG_PAPRD (1 << 2) #define ATHN_FLAG_FAST_PLL_CLOCK (1 << 3) #define ATHN_FLAG_RFSILENT (1 << 4) #define ATHN_FLAG_RFSILENT_REVERSED (1 << 5) @@ -436,8 +436,6 @@ struct athn_softc { #define ATHN_FLAG_11A (1 << 8) #define ATHN_FLAG_11G (1 << 9) #define ATHN_FLAG_11N (1 << 10) -#define ATHN_FLAG_SPLIT_TKIP_MIC (1 << 11) -#define ATHN_FLAG_PAPRD (1 << 12) uint8_t ngpiopins; int led_pin; -- 2.20.1