Search Linux Wireless

Re: [PATCH 10/10] rt2x00: Rework alignment check.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Gertjan van Wingerde <gwingerde@xxxxxxxxxxxx>

Rework the alignment check in rt2x00dev.c to be independent of any potential
alignment measures that may be taken before. Just check whether the payload is
aligned based on the pointer addresses.

Note: This is preparatory for the dynamically mapped skb buffers for the PCI
drivers, as these need 4-byte alignment instead of the currently enforced offset
by 2 bytes.

Signed-off-by: Gertjan van Wingerde <gwingerde@xxxxxxxxxxxx>
Signed-off-by: Ivo van Doorn <IvDoorn@xxxxxxxxx>
---
 drivers/net/wireless/rt2x00/rt2x00dev.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index ce1f7bb..9ea6773 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -565,13 +565,9 @@ void rt2x00lib_rxdone(struct queue_entry *entry,
 
 	/*
 	 * The data behind the ieee80211 header must be
-	 * aligned on a 4 byte boundary. We already reserved
-	 * 2 bytes for header_size % 4 == 2 optimization.
-	 * To determine the number of bytes which the data
-	 * should be moved to the left, we must add these
-	 * 2 bytes to the header_size.
+	 * aligned on a 4 byte boundary.
 	 */
-	align = (header_size + 2) % 4;
+	align = ((unsigned long)(entry->skb->data + header_size)) & 3;
 
 	if (align) {
 		skb_push(entry->skb, align);
-- 
1.5.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux