diff options
author | Magnus Damm <damm@opensource.se> | 2009-12-16 00:16:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-16 02:18:27 -0500 |
commit | 503914cf4a4b5dbe3f844e0a92f412ae99fde70e (patch) | |
tree | 1f6435d786ac4bf8330027834aa6c99d6a7ac609 /drivers/net | |
parent | ca553980432898da5d4125573a9e2aee6ed5d355 (diff) |
net: sh_eth alignment fix for sh7724 using NET_IP_ALIGN V2
Fix sh_eth for sh7724 by adding NET_IP_ALIGN support V2.
Without this patch the receive data is misaligned.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/sh_eth.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index c88bc1013047..ca6285016dfd 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c | |||
@@ -84,6 +84,8 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { | |||
84 | .mpr = 1, | 84 | .mpr = 1, |
85 | .tpauser = 1, | 85 | .tpauser = 1, |
86 | .hw_swap = 1, | 86 | .hw_swap = 1, |
87 | .rpadir = 1, | ||
88 | .rpadir_value = 0x00020000, /* NET_IP_ALIGN assumed to be 2 */ | ||
87 | }; | 89 | }; |
88 | 90 | ||
89 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) | 91 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) |
@@ -175,7 +177,6 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { | |||
175 | .tpauser = 1, | 177 | .tpauser = 1, |
176 | .bculr = 1, | 178 | .bculr = 1, |
177 | .hw_swap = 1, | 179 | .hw_swap = 1, |
178 | .rpadir = 1, | ||
179 | .no_trimd = 1, | 180 | .no_trimd = 1, |
180 | .no_ade = 1, | 181 | .no_ade = 1, |
181 | }; | 182 | }; |
@@ -501,6 +502,8 @@ static int sh_eth_ring_init(struct net_device *ndev) | |||
501 | */ | 502 | */ |
502 | mdp->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ : | 503 | mdp->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ : |
503 | (((ndev->mtu + 26 + 7) & ~7) + 2 + 16)); | 504 | (((ndev->mtu + 26 + 7) & ~7) + 2 + 16)); |
505 | if (mdp->cd->rpadir) | ||
506 | mdp->rx_buf_sz += NET_IP_ALIGN; | ||
504 | 507 | ||
505 | /* Allocate RX and TX skb rings */ | 508 | /* Allocate RX and TX skb rings */ |
506 | mdp->rx_skbuff = kmalloc(sizeof(*mdp->rx_skbuff) * RX_RING_SIZE, | 509 | mdp->rx_skbuff = kmalloc(sizeof(*mdp->rx_skbuff) * RX_RING_SIZE, |
@@ -715,6 +718,8 @@ static int sh_eth_rx(struct net_device *ndev) | |||
715 | pkt_len + 2); | 718 | pkt_len + 2); |
716 | skb = mdp->rx_skbuff[entry]; | 719 | skb = mdp->rx_skbuff[entry]; |
717 | mdp->rx_skbuff[entry] = NULL; | 720 | mdp->rx_skbuff[entry] = NULL; |
721 | if (mdp->cd->rpadir) | ||
722 | skb_reserve(skb, NET_IP_ALIGN); | ||
718 | skb_put(skb, pkt_len); | 723 | skb_put(skb, pkt_len); |
719 | skb->protocol = eth_type_trans(skb, ndev); | 724 | skb->protocol = eth_type_trans(skb, ndev); |
720 | netif_rx(skb); | 725 | netif_rx(skb); |