aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-01-11 14:53:07 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-01-16 12:53:32 -0500
commitd101f6496d51cbeb285f531dff059ce0ef28ffe3 (patch)
treee3aea45a519a7606cf4b717ddfe815cd6644248a /drivers
parenta38db5b6219d88e2b48f07472c436b19b864f93c (diff)
rt2x00: Fix ieee80211 payload alignment
As Johannes Berg indicated, the NET_IP_ALIGN doesn't need to be used for ieee80211 frames. This means we can simplify the alignment calculation to just use the result of the header size modulus 4 as frame alignment. Furthermore we shouldn't use NET_IP_ALIGN in rt2x00usb because it could be 0 on some architectures and we absolutely need to have 2 bytes reserved for possible aligning. Signed-off-by: Ivo van Doorn<IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c11
2 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 6d5d9aba0b73..04663eb31950 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -149,7 +149,7 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
149 * The data behind the ieee80211 header must be 149 * The data behind the ieee80211 header must be
150 * aligned on a 4 byte boundary. 150 * aligned on a 4 byte boundary.
151 */ 151 */
152 align = NET_IP_ALIGN + (2 * (header_size % 4 == 0)); 152 align = header_size % 4;
153 153
154 /* 154 /*
155 * Allocate the sk_buffer, initialize it and copy 155 * Allocate the sk_buffer, initialize it and copy
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index ab4797ed94c9..568d73847dca 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -245,13 +245,20 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
245 * Allocate a new sk buffer to replace the current one. 245 * Allocate a new sk buffer to replace the current one.
246 * If allocation fails, we should drop the current frame 246 * If allocation fails, we should drop the current frame
247 * so we can recycle the existing sk buffer for the new frame. 247 * so we can recycle the existing sk buffer for the new frame.
248 * As alignment we use 2 and not NET_IP_ALIGN because we need
249 * to be sure we have 2 bytes room in the head. (NET_IP_ALIGN
250 * can be 0 on some hardware). We use these 2 bytes for frame
251 * alignment later, we assume that the chance that
252 * header_size % 4 == 2 is bigger then header_size % 2 == 0
253 * and thus optimize alignment by reserving the 2 bytes in
254 * advance.
248 */ 255 */
249 frame_size = entry->ring->data_size + entry->ring->desc_size; 256 frame_size = entry->ring->data_size + entry->ring->desc_size;
250 skb = dev_alloc_skb(frame_size + NET_IP_ALIGN); 257 skb = dev_alloc_skb(frame_size + 2);
251 if (!skb) 258 if (!skb)
252 goto skip_entry; 259 goto skip_entry;
253 260
254 skb_reserve(skb, NET_IP_ALIGN); 261 skb_reserve(skb, 2);
255 skb_put(skb, frame_size); 262 skb_put(skb, frame_size);
256 263
257 /* 264 /*