public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH] net: sh_eth alignment fix for sh7724 using NET_IP_ALIGN
@ 2009-12-14 10:34 Magnus Damm
  2009-12-15  5:57 ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Magnus Damm @ 2009-12-14 10:34 UTC (permalink / raw)
  To: netdev; +Cc: Magnus Damm, lethal, davem, linux-sh

From: Magnus Damm <damm@opensource•se>

Fix sh_eth for sh7724 by adding NET_IP_ALIGN support.
Without this patch the receive data is misaligned.

Signed-off-by: Magnus Damm <damm@opensource•se>
---

 Tested on Ecovec24. Perhaps for the sh-2.6 tree?

 drivers/net/sh_eth.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- 0001/drivers/net/sh_eth.c
+++ work/drivers/net/sh_eth.c	2009-12-14 15:27:25.000000000 +0900
@@ -84,6 +84,10 @@ static struct sh_eth_cpu_data sh_eth_my_
 	.mpr		= 1,
 	.tpauser	= 1,
 	.hw_swap	= 1,
+#if NET_IP_ALIGN == 2
+	.rpadir		= 1,
+	.rpadir_value	= 0x00020000,
+#endif
 };
 
 #elif defined(CONFIG_CPU_SUBTYPE_SH7763)
@@ -501,6 +505,8 @@ static int sh_eth_ring_init(struct net_d
 	 */
 	mdp->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ :
 			  (((ndev->mtu + 26 + 7) & ~7) + 2 + 16));
+	if (mdp->cd->rpadir)
+		mdp->rx_buf_sz += NET_IP_ALIGN;
 
 	/* Allocate RX and TX skb rings */
 	mdp->rx_skbuff = kmalloc(sizeof(*mdp->rx_skbuff) * RX_RING_SIZE,
@@ -715,6 +721,8 @@ static int sh_eth_rx(struct net_device *
 					pkt_len + 2);
 			skb = mdp->rx_skbuff[entry];
 			mdp->rx_skbuff[entry] = NULL;
+			if (mdp->cd->rpadir)
+				skb_reserve(skb, NET_IP_ALIGN);
 			skb_put(skb, pkt_len);
 			skb->protocol = eth_type_trans(skb, ndev);
 			netif_rx(skb);

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

end of thread, other threads:[~2009-12-15  7:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-14 10:34 [PATCH] net: sh_eth alignment fix for sh7724 using NET_IP_ALIGN Magnus Damm
2009-12-15  5:57 ` David Miller
2009-12-15  7:13   ` Magnus Damm
2009-12-15  7:15     ` David Miller
2009-12-15  7:22       ` Magnus Damm
2009-12-15  7:28         ` Magnus Damm
2009-12-15  7:34         ` David Miller
2009-12-15  7:36           ` Magnus Damm

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