diff options
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00pci.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.c | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index 6d5d9aba0b7..04663eb3195 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 ab4797ed94c..568d73847dc 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 | /* |