Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] libertas: make if_sdio align packets
@ 2007-10-22 17:05 Pierre Ossman
  2007-10-22 17:11 ` Dan Williams
  2007-10-23  1:15 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Pierre Ossman @ 2007-10-22 17:05 UTC (permalink / raw)
  To: linux-wireless, Dan Williams

[-- Attachment #1: Type: text/plain, Size: 1020 bytes --]

Incoming packets have to be aligned or the IP stack becomes upset.
Make sure to shift them two bytes to achieve this.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
---

diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index 5b13705..56dd568 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -175,12 +175,20 @@ static int if_sdio_handle_data(struct if_sdio_card *card,
 		goto out;
 	}
 
-	skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE);
+	skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + NET_IP_ALIGN);
 	if (!skb) {
 		ret = -ENOMEM;
 		goto out;
 	}
 
+	/*
+	 * The IP stack is littered with silly assumptions on alignment,
+	 * so we need to do a bit of layering violation here and make
+	 * assumptions about the size of the headers between us and the
+	 * IP stack.
+	 */
+	skb_reserve(skb, NET_IP_ALIGN);
+
 	data = skb_put(skb, size);
 
 	memcpy(data, buffer, size);

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-10-23  7:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-22 17:05 [PATCH] libertas: make if_sdio align packets Pierre Ossman
2007-10-22 17:11 ` Dan Williams
2007-10-23  1:15 ` David Miller
2007-10-23  5:29   ` Pierre Ossman
2007-10-23  6:57   ` Holger Schurig
2007-10-23  7:17     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox