rt2x00: Pad beacon to multiple of 32 bits.
authorWolfgang Kufner <wolfgang.kufner@gmail.com>
Mon, 13 Dec 2010 11:39:12 +0000 (12:39 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 13 Dec 2010 20:23:36 +0000 (15:23 -0500)
Pad beacon to a multiple of 32 bits in preparation for the change
from memcpy_toio() to __iowrite32_copy() in register_multiwrite().

Signed-off-by: Wolfgang Kufner <wolfgang.kufner@gmail.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index b7de1a504480902ed4a36b4a6f74181d1cac1ec0..54917a28139813713904cc03e9f77c67f40e7588 100644 (file)
@@ -772,6 +772,7 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc)
        struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
        struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
        unsigned int beacon_base;
+       unsigned int padding_len;
        u32 reg;
 
        /*
@@ -806,11 +807,13 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc)
        rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
 
        /*
-        * Write entire beacon with TXWI to register.
+        * Write entire beacon with TXWI and padding to register.
         */
+       padding_len = roundup(entry->skb->len, 4) - entry->skb->len;
+       skb_pad(entry->skb, padding_len);
        beacon_base = HW_BEACON_OFFSET(entry->entry_idx);
-       rt2800_register_multiwrite(rt2x00dev, beacon_base,
-                                  entry->skb->data, entry->skb->len);
+       rt2800_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data,
+                                  entry->skb->len + padding_len);
 
        /*
         * Enable beaconing again.
index 9405b100a75a5ebcf3cbdc5546f713fc067d6d86..8de44dd401e0f80927dca2e992fed8952fd79caf 100644 (file)
@@ -1961,6 +1961,7 @@ static void rt61pci_write_beacon(struct queue_entry *entry,
        struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
        struct queue_entry_priv_pci *entry_priv = entry->priv_data;
        unsigned int beacon_base;
+       unsigned int padding_len;
        u32 reg;
 
        /*
@@ -1982,13 +1983,16 @@ static void rt61pci_write_beacon(struct queue_entry *entry,
        rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
 
        /*
-        * Write entire beacon with descriptor to register.
+        * Write entire beacon with descriptor and padding to register.
         */
+       padding_len = roundup(entry->skb->len, 4) - entry->skb->len;
+       skb_pad(entry->skb, padding_len);
        beacon_base = HW_BEACON_OFFSET(entry->entry_idx);
        rt2x00pci_register_multiwrite(rt2x00dev, beacon_base,
                                      entry_priv->desc, TXINFO_SIZE);
        rt2x00pci_register_multiwrite(rt2x00dev, beacon_base + TXINFO_SIZE,
-                                     entry->skb->data, entry->skb->len);
+                                     entry->skb->data,
+                                     entry->skb->len + padding_len);
 
        /*
         * Enable beaconing again.
index 0b3959bdd3eb560d24df9b5e67032e1df6651b65..0b4e8590cbb77e067902f9d176043db0a713c4c9 100644 (file)
@@ -1546,6 +1546,7 @@ static void rt73usb_write_beacon(struct queue_entry *entry,
 {
        struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
        unsigned int beacon_base;
+       unsigned int padding_len;
        u32 reg;
 
        /*
@@ -1573,11 +1574,13 @@ static void rt73usb_write_beacon(struct queue_entry *entry,
        rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
 
        /*
-        * Write entire beacon with descriptor to register.
+        * Write entire beacon with descriptor and padding to register.
         */
+       padding_len = roundup(entry->skb->len, 4) - entry->skb->len;
+       skb_pad(entry->skb, padding_len);
        beacon_base = HW_BEACON_OFFSET(entry->entry_idx);
-       rt2x00usb_register_multiwrite(rt2x00dev, beacon_base,
-                                     entry->skb->data, entry->skb->len);
+       rt2x00usb_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data,
+                                     entry->skb->len + padding_len);
 
        /*
         * Enable beaconing again.