From: Magnus Damm <magnus.damm@gmail.com>
To: netdev@vger.kernel.org
Cc: Magnus Damm <magnus.damm@gmail.com>,
lethal@linux-sh.org, davem@davemloft.net,
linux-sh@vger.kernel.org
Subject: [PATCH] net: sh_eth alignment fix for sh7724 using NET_IP_ALIGN V2
Date: Tue, 15 Dec 2009 11:03:44 +0000 [thread overview]
Message-ID: <20091215110344.13016.27379.sendpatchset@rxone.opensource.se> (raw)
In-Reply-To: <20091214103443.13082.84079.sendpatchset@rxone.opensource.se>
From: Magnus Damm <damm@opensource.se>
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>
---
Thanks to Dave Miller for feedback!
Tested on sh7724 / Ecovec24.
Changes since V1:
- dropped #ifdef around sh7724 .rpadir and .rpadir_value
- removed sh7763 .rpadir
drivers/net/sh_eth.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- 0001/drivers/net/sh_eth.c
+++ work/drivers/net/sh_eth.c 2009-12-15 19:58:55.000000000 +0900
@@ -84,6 +84,8 @@ static struct sh_eth_cpu_data sh_eth_my_
.mpr = 1,
.tpauser = 1,
.hw_swap = 1,
+ .rpadir = 1,
+ .rpadir_value = 0x00020000, /* NET_IP_ALIGN assumed to be 2 */
};
#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
@@ -175,7 +177,6 @@ static struct sh_eth_cpu_data sh_eth_my_
.tpauser = 1,
.bculr = 1,
.hw_swap = 1,
- .rpadir = 1,
.no_trimd = 1,
.no_ade = 1,
};
@@ -501,6 +502,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 +718,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);
WARNING: multiple messages have this Message-ID (diff)
From: Magnus Damm <magnus.damm@gmail.com>
To: netdev@vger.kernel.org
Cc: Magnus Damm <magnus.damm@gmail.com>,
lethal@linux-sh.org, davem@davemloft.net,
linux-sh@vger.kernel.org
Subject: [PATCH] net: sh_eth alignment fix for sh7724 using NET_IP_ALIGN V2
Date: Tue, 15 Dec 2009 20:03:44 +0900 [thread overview]
Message-ID: <20091215110344.13016.27379.sendpatchset@rxone.opensource.se> (raw)
From: Magnus Damm <damm@opensource.se>
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>
---
Thanks to Dave Miller for feedback!
Tested on sh7724 / Ecovec24.
Changes since V1:
- dropped #ifdef around sh7724 .rpadir and .rpadir_value
- removed sh7763 .rpadir
drivers/net/sh_eth.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- 0001/drivers/net/sh_eth.c
+++ work/drivers/net/sh_eth.c 2009-12-15 19:58:55.000000000 +0900
@@ -84,6 +84,8 @@ static struct sh_eth_cpu_data sh_eth_my_
.mpr = 1,
.tpauser = 1,
.hw_swap = 1,
+ .rpadir = 1,
+ .rpadir_value = 0x00020000, /* NET_IP_ALIGN assumed to be 2 */
};
#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
@@ -175,7 +177,6 @@ static struct sh_eth_cpu_data sh_eth_my_
.tpauser = 1,
.bculr = 1,
.hw_swap = 1,
- .rpadir = 1,
.no_trimd = 1,
.no_ade = 1,
};
@@ -501,6 +502,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 +718,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);
next prev parent reply other threads:[~2009-12-15 11:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-14 10:34 [PATCH] net: sh_eth alignment fix for sh7724 using NET_IP_ALIGN Magnus Damm
2009-12-14 10:34 ` Magnus Damm
2009-12-15 5:57 ` David Miller
2009-12-15 5:57 ` David Miller
2009-12-15 7:13 ` Magnus Damm
2009-12-15 7:13 ` Magnus Damm
2009-12-15 7:15 ` David Miller
2009-12-15 7:15 ` David Miller
2009-12-15 7:22 ` Magnus Damm
2009-12-15 7:22 ` Magnus Damm
2009-12-15 7:28 ` Magnus Damm
2009-12-15 7:28 ` Magnus Damm
2009-12-15 7:34 ` David Miller
2009-12-15 7:34 ` David Miller
2009-12-15 7:36 ` Magnus Damm
2009-12-15 7:36 ` Magnus Damm
2009-12-15 11:03 ` Magnus Damm [this message]
2009-12-15 11:03 ` [PATCH] net: sh_eth alignment fix for sh7724 using NET_IP_ALIGN V2 Magnus Damm
2009-12-16 5:17 ` [PATCH] net: sh_eth alignment fix for sh7724 using David Miller
2009-12-16 5:17 ` [PATCH] net: sh_eth alignment fix for sh7724 using NET_IP_ALIGN V2 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091215110344.13016.27379.sendpatchset@rxone.opensource.se \
--to=magnus.damm@gmail.com \
--cc=davem@davemloft.net \
--cc=lethal@linux-sh.org \
--cc=linux-sh@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.