]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/net/wireless/rt2x00/rt2x00crypto.c
rt2x00: Update copyright year to 2009
[mv-sheeva.git] / drivers / net / wireless / rt2x00 / rt2x00crypto.c
index 37ad0d2fb64c46c0210d17ee5f8fb4462187ad60..0b41845d9543a1653d3893e22d7f4c56d1719c35 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -49,9 +49,14 @@ enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key)
 void rt2x00crypto_create_tx_descriptor(struct queue_entry *entry,
                                       struct txentry_desc *txdesc)
 {
+       struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
        struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
        struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
 
+       if (!test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags) ||
+           !hw_key || entry->skb->do_not_encrypt)
+               return;
+
        __set_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags);
 
        txdesc->cipher = rt2x00crypto_key_to_cipher(hw_key);
@@ -69,11 +74,17 @@ void rt2x00crypto_create_tx_descriptor(struct queue_entry *entry,
                __set_bit(ENTRY_TXD_ENCRYPT_MMIC, &txdesc->flags);
 }
 
-unsigned int rt2x00crypto_tx_overhead(struct ieee80211_tx_info *tx_info)
+unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev,
+                                     struct sk_buff *skb)
 {
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
        struct ieee80211_key_conf *key = tx_info->control.hw_key;
        unsigned int overhead = 0;
 
+       if (!test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags) ||
+           !key || skb->do_not_encrypt)
+               return overhead;
+
        /*
         * Extend frame length to include IV/EIV/ICV/MMIC,
         * note that these lengths should only be added when
@@ -184,8 +195,8 @@ void rt2x00crypto_rx_insert_iv(struct sk_buff *skb, unsigned int align,
         * Make room for new data, note that we increase both
         * headsize and tailsize when required. The tailsize is
         * only needed when ICV data needs to be inserted and
-        * the padding is smaller then the ICV data.
-        * When alignment requirements is greater then the
+        * the padding is smaller than the ICV data.
+        * When alignment requirements is greater than the
         * ICV data we must trim the skb to the correct size
         * because we need to remove the extra bytes.
         */