netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ioc3: fix incorrect use of htons/ntohs
@ 2014-11-30 10:40 Lino Sanfilippo
  2014-12-01  4:09 ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: Lino Sanfilippo @ 2014-11-30 10:40 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, netdev, linux-kernel, Lino Sanfilippo

The protocol type in the ip header struct is a single byte variable. So there
is no need to swap bytes depending on host endianness.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
---

Please note that I could not test this, since I dont have access to the
concerning hardware.

 drivers/net/ethernet/sgi/ioc3-eth.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c
index 7a254da..0bb303d 100644
--- a/drivers/net/ethernet/sgi/ioc3-eth.c
+++ b/drivers/net/ethernet/sgi/ioc3-eth.c
@@ -540,8 +540,7 @@ static void ioc3_tcpudp_checksum(struct sk_buff *skb, uint32_t hwsum, int len)
 
 	/* Same as tx - compute csum of pseudo header  */
 	csum = hwsum +
-	       (ih->tot_len - (ih->ihl << 2)) +
-	       htons((uint16_t)ih->protocol) +
+	       (ih->tot_len - (ih->ihl << 2)) + ih->protocol +
 	       (ih->saddr >> 16) + (ih->saddr & 0xffff) +
 	       (ih->daddr >> 16) + (ih->daddr & 0xffff);
 
@@ -1417,7 +1416,7 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	 */
 	if (skb->ip_summed == CHECKSUM_PARTIAL) {
 		const struct iphdr *ih = ip_hdr(skb);
-		const int proto = ntohs(ih->protocol);
+		const int proto = ih->protocol;
 		unsigned int csoff;
 		uint32_t csum, ehsum;
 		uint16_t *eh;
-- 
1.9.1

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

end of thread, other threads:[~2014-12-15 21:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-30 10:40 [PATCH] ioc3: fix incorrect use of htons/ntohs Lino Sanfilippo
2014-12-01  4:09 ` Ben Hutchings
2014-12-02  1:31   ` Lino Sanfilippo
2014-12-15 18:14   ` Ralf Baechle
2014-12-15 21:09     ` Ben Hutchings

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).