Commit 503914cf authored by Magnus Damm's avatar Magnus Damm Committed by David S. Miller

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: default avatarMagnus Damm <damm@opensource.se>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ca553980
...@@ -84,6 +84,8 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { ...@@ -84,6 +84,8 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
.mpr = 1, .mpr = 1,
.tpauser = 1, .tpauser = 1,
.hw_swap = 1, .hw_swap = 1,
.rpadir = 1,
.rpadir_value = 0x00020000, /* NET_IP_ALIGN assumed to be 2 */
}; };
#elif defined(CONFIG_CPU_SUBTYPE_SH7763) #elif defined(CONFIG_CPU_SUBTYPE_SH7763)
...@@ -175,7 +177,6 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { ...@@ -175,7 +177,6 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
.tpauser = 1, .tpauser = 1,
.bculr = 1, .bculr = 1,
.hw_swap = 1, .hw_swap = 1,
.rpadir = 1,
.no_trimd = 1, .no_trimd = 1,
.no_ade = 1, .no_ade = 1,
}; };
...@@ -501,6 +502,8 @@ static int sh_eth_ring_init(struct net_device *ndev) ...@@ -501,6 +502,8 @@ static int sh_eth_ring_init(struct net_device *ndev)
*/ */
mdp->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ : mdp->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ :
(((ndev->mtu + 26 + 7) & ~7) + 2 + 16)); (((ndev->mtu + 26 + 7) & ~7) + 2 + 16));
if (mdp->cd->rpadir)
mdp->rx_buf_sz += NET_IP_ALIGN;
/* Allocate RX and TX skb rings */ /* Allocate RX and TX skb rings */
mdp->rx_skbuff = kmalloc(sizeof(*mdp->rx_skbuff) * RX_RING_SIZE, 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,6 +718,8 @@ static int sh_eth_rx(struct net_device *ndev)
pkt_len + 2); pkt_len + 2);
skb = mdp->rx_skbuff[entry]; skb = mdp->rx_skbuff[entry];
mdp->rx_skbuff[entry] = NULL; mdp->rx_skbuff[entry] = NULL;
if (mdp->cd->rpadir)
skb_reserve(skb, NET_IP_ALIGN);
skb_put(skb, pkt_len); skb_put(skb, pkt_len);
skb->protocol = eth_type_trans(skb, ndev); skb->protocol = eth_type_trans(skb, ndev);
netif_rx(skb); netif_rx(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment