diff options
author | Imre Kaloz <kaloz@openwrt.org> | 2008-12-10 11:21:08 +0000 |
---|---|---|
committer | Imre Kaloz <kaloz@openwrt.org> | 2008-12-10 11:21:08 +0000 |
commit | d9475220de9458914775d0abaa4003e4bb8ae7f0 (patch) | |
tree | e5927cae3829e32ce67f9e45e187554ba9ccdd70 /package/mac80211/patches/300-rt2x00_hw_encryption.patch | |
parent | e1c2416ca88e46a06e5914ade98c3ddd1524acc0 (diff) | |
download | upstream-d9475220de9458914775d0abaa4003e4bb8ae7f0.tar.gz upstream-d9475220de9458914775d0abaa4003e4bb8ae7f0.tar.bz2 upstream-d9475220de9458914775d0abaa4003e4bb8ae7f0.zip |
upgrade compat wireless to 2008-12-09, remove the experimental rt2800 patch until it's fixed
SVN-Revision: 13579
Diffstat (limited to 'package/mac80211/patches/300-rt2x00_hw_encryption.patch')
-rw-r--r-- | package/mac80211/patches/300-rt2x00_hw_encryption.patch | 248 |
1 files changed, 0 insertions, 248 deletions
diff --git a/package/mac80211/patches/300-rt2x00_hw_encryption.patch b/package/mac80211/patches/300-rt2x00_hw_encryption.patch deleted file mode 100644 index 51cb3264ac..0000000000 --- a/package/mac80211/patches/300-rt2x00_hw_encryption.patch +++ /dev/null @@ -1,248 +0,0 @@ -From: Ivo van Doorn <IvDoorn@gmail.com> -Date: Thu, 20 Nov 2008 22:29:36 +0000 (+0100) -Subject: rt2x00: Implement HW encryption (rt2500usb) -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fivd%2Frt2x00.git;a=commitdiff_plain;h=52fe465ab5eb6aeead5ac8d91dd70e363d0560b7 - -rt2x00: Implement HW encryption (rt2500usb) - -rt2500usb supports hardware encryption. -rt2500usb supports up to 4 shared and pairwise keys. - -Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> ---- - -diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c -index 10cb46a..620ac65 100644 ---- a/drivers/net/wireless/rt2x00/rt2500usb.c -+++ b/drivers/net/wireless/rt2x00/rt2500usb.c -@@ -36,6 +36,13 @@ - #include "rt2500usb.h" - - /* -+ * Allow hardware encryption to be disabled. -+ */ -+static int modparam_nohwcrypt = 0; -+module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); -+MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); -+ -+/* - * Register access. - * All access to the CSR registers will go through the methods - * rt2500usb_register_read and rt2500usb_register_write. -@@ -323,6 +330,85 @@ static void rt2500usb_init_led(struct rt2x00_dev *rt2x00dev, - /* - * Configuration handlers. - */ -+ -+/* -+ * rt2500usb does not differentiate between shared and pairwise -+ * keys, so we should use the same function for both key types. -+ */ -+static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev, -+ struct rt2x00lib_crypto *crypto, -+ struct ieee80211_key_conf *key) -+{ -+ int timeout; -+ u32 mask; -+ u16 reg; -+ -+ /* Support up to 4 keys */ -+ if (key->hw_key_idx >= 4) -+ return -ENOSPC; -+ -+ if (crypto->cmd == SET_KEY) { -+ /* -+ * Pairwise key will always be entry 0, but this -+ * could collide with a shared key on the same -+ * position... -+ */ -+ mask = TXRX_CSR0_KEY_ID.bit_mask; -+ -+ rt2500usb_register_read(rt2x00dev, TXRX_CSR0, ®); -+ -+ if ((reg & mask) && (reg & mask) == mask) -+ return -ENOSPC; -+ -+ reg = rt2x00_get_field16(reg, TXRX_CSR0_KEY_ID); -+ -+ key->hw_key_idx += reg ? ffz(reg) : 0; -+ -+ /* -+ * The encryption key doesn't fit within the CSR cache, -+ * this means we should allocate it seperately and use -+ * rt2x00usb_vendor_request() to send the key to the hardware. -+ */ -+ reg = KEY_ENTRY(key->hw_key_idx); -+ timeout = REGISTER_TIMEOUT32(sizeof(crypto->key)); -+ rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE, -+ USB_VENDOR_REQUEST_OUT, reg, -+ crypto->key, -+ sizeof(crypto->key), -+ timeout); -+ -+ /* -+ * The driver does not support the IV/EIV generation -+ * in hardware. However it doesn't support the IV/EIV -+ * inside the ieee80211 frame either, but requires it -+ * to be provided seperately for the descriptor. -+ * rt2x00lib will cut the IV/EIV data out of all frames -+ * given to us by mac80211, but we must tell mac80211 -+ * to generate the IV/EIV data. -+ */ -+ key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; -+ key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; -+ } -+ -+ /* -+ * TXRX_CSR0_KEY_ID contains only single-bit fields to indicate -+ * a particular key is valid. -+ */ -+ rt2500usb_register_read(rt2x00dev, TXRX_CSR0, ®); -+ rt2x00_set_field16(®, TXRX_CSR0_ALGORITHM, crypto->cipher); -+ rt2x00_set_field16(®, TXRX_CSR0_IV_OFFSET, IEEE80211_HEADER); -+ -+ mask = rt2x00_get_field16(reg, TXRX_CSR0_KEY_ID); -+ if (crypto->cmd == SET_KEY) -+ mask |= 1 << key->hw_key_idx; -+ else if (crypto->cmd == DISABLE_KEY) -+ mask &= ~(1 << key->hw_key_idx); -+ rt2x00_set_field16(®, TXRX_CSR0_KEY_ID, mask); -+ rt2500usb_register_write(rt2x00dev, TXRX_CSR0, reg); -+ -+ return 0; -+} -+ - static void rt2500usb_config_filter(struct rt2x00_dev *rt2x00dev, - const unsigned int filter_flags) - { -@@ -844,7 +930,7 @@ static int rt2500usb_init_registers(struct rt2x00_dev *rt2x00dev) - - rt2500usb_register_read(rt2x00dev, TXRX_CSR0, ®); - rt2x00_set_field16(®, TXRX_CSR0_IV_OFFSET, IEEE80211_HEADER); -- rt2x00_set_field16(®, TXRX_CSR0_KEY_ID, 0xff); -+ rt2x00_set_field16(®, TXRX_CSR0_KEY_ID, 0); - rt2500usb_register_write(rt2x00dev, TXRX_CSR0, reg); - - rt2500usb_register_read(rt2x00dev, MAC_CSR18, ®); -@@ -1066,7 +1152,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, - * Start writing the descriptor words. - */ - rt2x00_desc_read(txd, 1, &word); -- rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, IEEE80211_HEADER); -+ rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, txdesc->iv_offset); - rt2x00_set_field32(&word, TXD_W1_AIFS, txdesc->aifs); - rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min); - rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max); -@@ -1079,6 +1165,11 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, - rt2x00_set_field32(&word, TXD_W2_PLCP_LENGTH_HIGH, txdesc->length_high); - rt2x00_desc_write(txd, 2, word); - -+ if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags)) { -+ _rt2x00_desc_write(txd, 3, skbdesc->iv); -+ _rt2x00_desc_write(txd, 4, skbdesc->eiv); -+ } -+ - rt2x00_desc_read(txd, 0, &word); - rt2x00_set_field32(&word, TXD_W0_RETRY_LIMIT, txdesc->retry_limit); - rt2x00_set_field32(&word, TXD_W0_MORE_FRAG, -@@ -1093,7 +1184,8 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, - test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); - rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, skb->len); -- rt2x00_set_field32(&word, TXD_W0_CIPHER, CIPHER_NONE); -+ rt2x00_set_field32(&word, TXD_W0_CIPHER, txdesc->cipher); -+ rt2x00_set_field32(&word, TXD_W0_KEY_ID, txdesc->key_idx); - rt2x00_desc_write(txd, 0, word); - } - -@@ -1204,6 +1296,7 @@ static void rt2500usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, - static void rt2500usb_fill_rxdone(struct queue_entry *entry, - struct rxdone_entry_desc *rxdesc) - { -+ struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct queue_entry_priv_usb *entry_priv = entry->priv_data; - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - __le32 *rxd = -@@ -1231,6 +1324,31 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry, - if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR)) - rxdesc->flags |= RX_FLAG_FAILED_PLCP_CRC; - -+ if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { -+ rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER); -+ if (rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR)) -+ rxdesc->cipher_status = RX_CRYPTO_FAIL_KEY; -+ } -+ -+ if (rxdesc->cipher != CIPHER_NONE) { -+ _rt2x00_desc_read(rxd, 2, &rxdesc->iv); -+ _rt2x00_desc_read(rxd, 3, &rxdesc->eiv); -+ /* ICV is located at the end of frame */ -+ -+ /* -+ * Hardware has stripped IV/EIV data from 802.11 frame during -+ * decryption. It has provided the data seperately but rt2x00lib -+ * should decide if it should be reinserted. -+ */ -+ rxdesc->flags |= RX_FLAG_IV_STRIPPED; -+ if (rxdesc->cipher != CIPHER_TKIP) -+ rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; -+ if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) -+ rxdesc->flags |= RX_FLAG_DECRYPTED; -+ else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) -+ rxdesc->flags |= RX_FLAG_MMIC_ERROR; -+ } -+ - /* - * Obtain the status about this packet. - * When frame was received with an OFDM bitrate, -@@ -1238,8 +1356,8 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry, - * a CCK bitrate the signal is the rate in 100kbit/s. - */ - rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL); -- rxdesc->rssi = rt2x00_get_field32(word1, RXD_W1_RSSI) - -- entry->queue->rt2x00dev->rssi_offset; -+ rxdesc->rssi = -+ rt2x00_get_field32(word1, RXD_W1_RSSI) - rt2x00dev->rssi_offset; - rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); - - if (rt2x00_get_field32(word0, RXD_W0_OFDM)) -@@ -1729,6 +1847,8 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev) - __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); - __set_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags); - __set_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags); -+ if (!modparam_nohwcrypt) -+ __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags); - __set_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags); - - /* -@@ -1748,6 +1868,7 @@ static const struct ieee80211_ops rt2500usb_mac80211_ops = { - .config = rt2x00mac_config, - .config_interface = rt2x00mac_config_interface, - .configure_filter = rt2x00mac_configure_filter, -+ .set_key = rt2x00mac_set_key, - .get_stats = rt2x00mac_get_stats, - .bss_info_changed = rt2x00mac_bss_info_changed, - .conf_tx = rt2x00mac_conf_tx, -@@ -1769,6 +1890,8 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { - .get_tx_data_len = rt2500usb_get_tx_data_len, - .kick_tx_queue = rt2500usb_kick_tx_queue, - .fill_rxdone = rt2500usb_fill_rxdone, -+ .config_shared_key = rt2500usb_config_key, -+ .config_pairwise_key = rt2500usb_config_key, - .config_filter = rt2500usb_config_filter, - .config_intf = rt2500usb_config_intf, - .config_erp = rt2500usb_config_erp, -diff --git a/drivers/net/wireless/rt2x00/rt2500usb.h b/drivers/net/wireless/rt2x00/rt2500usb.h -index dbb5d68..4347dfd 100644 ---- a/drivers/net/wireless/rt2x00/rt2500usb.h -+++ b/drivers/net/wireless/rt2x00/rt2500usb.h -@@ -447,6 +447,9 @@ - #define SEC_CSR30 0x04bc - #define SEC_CSR31 0x04be - -+#define KEY_ENTRY(__idx) \ -+ ( SEC_CSR0 + ((__idx) * 16) ) -+ - /* - * PHY control registers. - */ |