netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dale Farnsworth <dale@farnsworth.org>
To: jgarzik@pobox.com
Cc: netdev@vger.kernel.org, hvr@gnu.org, akpm@linux-foundation.org,
	Manish Lachwani <mlachwani@mvista.com>,
	Tzachi Perelstein <tzachi@marvell.com>,
	Byron Bradley <byron.bbradley@gmail.com>
Subject: [PATCH] mv643xx_eth: fix byte order when checksum offload is enabled
Date: Sat, 19 Jan 2008 13:23:01 -0700	[thread overview]
Message-ID: <20080119202301.GA26826@farnsworth.org> (raw)
In-Reply-To: <1200770858-11456-1-git-send-email-byron.bbradley@gmail.com>

From: Byron Bradley <byron.bbradley@gmail.com>

The Marvell Orion system on chips have an integrated mv643xx MAC.
On these little endian ARM devices mv643xx will oops when checksum
offload is enabled. Swapping the byte order of the protocol and
checksum solves this problem.

Signed-off-by: Byron Bradley <byron.bbradley@gmail.com>
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Cc: Manish Lachwani <mlachwani@mvista.com>
Cc: Tzachi Perelstein <tzachi@marvell.com>

---

Byron Bradley wrote:
> This patch has only been tested on two Marvell Orion based boards so it
> should be considered only very lightly tested. It applies against
> 2.6.24-rc8-mm1.

Dale Farnsworth:
Looks good to me and I successfully booted it on a big-endian prpmc2800 board.

Jeff, please pick this up.  My mv643xx queue is otherwise empty.

Thanks,
-Dale

 drivers/net/mv643xx_eth.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 651c269..5d16a5d 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1689,7 +1689,7 @@ static void eth_tx_submit_descs_for_skb(struct mv643xx_private *mp,
 	desc->buf_ptr = dma_map_single(NULL, skb->data, length, DMA_TO_DEVICE);
 
 	if (skb->ip_summed == CHECKSUM_PARTIAL) {
-		BUG_ON(skb->protocol != ETH_P_IP);
+		BUG_ON(skb->protocol != htons(ETH_P_IP));
 
 		cmd_sts |= ETH_GEN_TCP_UDP_CHECKSUM |
 			   ETH_GEN_IP_V_4_CHECKSUM  |
@@ -1698,10 +1698,10 @@ static void eth_tx_submit_descs_for_skb(struct mv643xx_private *mp,
 		switch (ip_hdr(skb)->protocol) {
 		case IPPROTO_UDP:
 			cmd_sts |= ETH_UDP_FRAME;
-			desc->l4i_chk = udp_hdr(skb)->check;
+			desc->l4i_chk = htons(udp_hdr(skb)->check);
 			break;
 		case IPPROTO_TCP:
-			desc->l4i_chk = tcp_hdr(skb)->check;
+			desc->l4i_chk = htons(tcp_hdr(skb)->check);
 			break;
 		default:
 			BUG();
-- 
1.5.4.rc2.38.gd6da3



  parent reply	other threads:[~2008-01-19 20:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-19 19:27 [PATCH] mv643xx: fix byte order when checksum offload is enabled Byron Bradley
2008-01-19 20:09 ` Al Viro
2008-01-20 15:05   ` [PATCH] mv643xx_eth: " Byron Bradley
2008-01-19 20:23 ` Dale Farnsworth [this message]
2008-01-19 20:45   ` Dale Farnsworth

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=20080119202301.GA26826@farnsworth.org \
    --to=dale@farnsworth.org \
    --cc=akpm@linux-foundation.org \
    --cc=byron.bbradley@gmail.com \
    --cc=hvr@gnu.org \
    --cc=jgarzik@pobox.com \
    --cc=mlachwani@mvista.com \
    --cc=netdev@vger.kernel.org \
    --cc=tzachi@marvell.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).