rt2x00: Add RXDONE_CRYPTO_IV/ICV flags
authorIvo van Doorn <ivdoorn@gmail.com>
Tue, 2 Dec 2008 21:50:33 +0000 (22:50 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 5 Dec 2008 14:35:56 +0000 (09:35 -0500)
Drivers should notify rt2x00lib when they provide
the IV/ICV data. This adds some flexibility to drivers
which can't provide all information.
* rt2500usb provides ICV inside the frame
* rt2800pci doesn't provide IV/ICV
* rt2800usb doesn't provide IV/ICV

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00queue.h
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 90bf0b96caa36045d95717d9074c792d8a783b55..30028e2422fcfde7706b285042b7a4b9b12863c9 100644 (file)
@@ -1330,6 +1330,8 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry,
        if (rxdesc->cipher != CIPHER_NONE) {
                _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]);
                _rt2x00_desc_read(rxd, 3, &rxdesc->iv[1]);
+               rxdesc->dev_flags |= RXDONE_CRYPTO_IV;
+
                /* ICV is located at the end of frame */
 
                /*
index 7fc1d766062b44b252aefe2922c2e7d34bb07d88..6d92542fcf0da8c509846726e230b0a40d839d84 100644 (file)
@@ -636,7 +636,8 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev,
         * provided seperately (through hardware descriptor)
         * in which case we should reinsert the data into the frame.
         */
-       if ((rxdesc.flags & RX_FLAG_IV_STRIPPED)) {
+       if ((rxdesc.dev_flags & RXDONE_CRYPTO_IV) &&
+           (rxdesc.flags & RX_FLAG_IV_STRIPPED)) {
                rt2x00crypto_rx_insert_iv(entry->skb, align,
                                          header_length, &rxdesc);
        } else if (align) {
index 7889f914b0ef48805e85288ca593ba25def60218..28293715340849363aa98eeb480f18f593fae7ec 100644 (file)
@@ -146,11 +146,15 @@ static inline struct skb_frame_desc* get_skb_frame_desc(struct sk_buff *skb)
  * @RXDONE_SIGNAL_PLCP: Signal field contains the plcp value.
  * @RXDONE_SIGNAL_BITRATE: Signal field contains the bitrate value.
  * @RXDONE_MY_BSS: Does this frame originate from device's BSS.
+ * @RXDONE_CRYPTO_IV: Driver provided IV/EIV data.
+ * @RXDONE_CRYPTO_ICV: Driver provided ICV data.
  */
 enum rxdone_entry_desc_flags {
        RXDONE_SIGNAL_PLCP = 1 << 0,
        RXDONE_SIGNAL_BITRATE = 1 << 1,
        RXDONE_MY_BSS = 1 << 2,
+       RXDONE_CRYPTO_IV = 1 << 3,
+       RXDONE_CRYPTO_ICV = 1 << 4,
 };
 
 /**
index c1ebb658b6c44b02a19ae4fead3d5ae277959d16..987e89009f74ed36debc32498783d57812b68916 100644 (file)
@@ -1951,7 +1951,10 @@ static void rt61pci_fill_rxdone(struct queue_entry *entry,
        if (rxdesc->cipher != CIPHER_NONE) {
                _rt2x00_desc_read(entry_priv->desc, 2, &rxdesc->iv[0]);
                _rt2x00_desc_read(entry_priv->desc, 3, &rxdesc->iv[1]);
+               rxdesc->dev_flags |= RXDONE_CRYPTO_IV;
+
                _rt2x00_desc_read(entry_priv->desc, 4, &rxdesc->icv);
+               rxdesc->dev_flags |= RXDONE_CRYPTO_ICV;
 
                /*
                 * Hardware has stripped IV/EIV data from 802.11 frame during
index 3c8b235bbdfbb9ee68f4d2b746519b172808e74f..d638a8a593705384f58a2cbf6a6e95fd4dd7d0db 100644 (file)
@@ -1620,7 +1620,10 @@ static void rt73usb_fill_rxdone(struct queue_entry *entry,
        if (rxdesc->cipher != CIPHER_NONE) {
                _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]);
                _rt2x00_desc_read(rxd, 3, &rxdesc->iv[1]);
+               rxdesc->dev_flags |= RXDONE_CRYPTO_IV;
+
                _rt2x00_desc_read(rxd, 4, &rxdesc->icv);
+               rxdesc->dev_flags |= RXDONE_CRYPTO_ICV;
 
                /*
                 * Hardware has stripped IV/EIV data from 802.11 frame during