Skip to contentSkip to conversation

be2net: Fix Endian

PATCH Applied [email protected] 3 participants 3 messages Jul 5, 2012 – Jul 9, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 be2net: Fix Endian

From: Li RongQing <[email protected]>

ETH_P_IP is host Endian, skb->protocol is big Endian, when compare them, we should change ETH_P_IP from host endian to big endian, htons, not ntohs.

---
 drivers/net/ethernet/emulex/benet/be.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/emulex/benet/be.h +1 -1
index 7a71fb6..0490a04 100644
@@ -575,7 +575,7 @@ static inline u8 is_udp_pkt(struct sk_buff *skb)
 
 static inline bool is_ipv4_pkt(struct sk_buff *skb)
 {
-	return skb->protocol == ntohs(ETH_P_IP) && ip_hdr(skb)->version == 4;
+	return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4;
 }
 
 static inline void be_vf_eth_addr_generate(struct be_adapter *adapter, u8 *mac)
Signature · 1 line
1.7.1
Acked-by on v1 1/2
#1 lore raw
Quoted 9 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Thursday, July 05, 2012 7:36 AM
To: [email protected]
Cc: Kotur, Somnath
Subject: [PATCH 1/2] be2net: Fix Endian

Quoted 8 lines

From: Li RongQing <[email protected]>

ETH_P_IP is host Endian, skb->protocol is big Endian, when compare them, we should change ETH_P_IP from host endian to big endian, htons, not ntohs.

Oops! Unintended...Thanks!

maintainer Applied
#2 lore raw
In reply to [email protected]

From: [email protected]
Date: Thu, 5 Jul 2012 10:05:42 +0800

Quoted 8 lines

From: Li RongQing <[email protected]>

ETH_P_IP is host Endian, skb->protocol is big Endian, when compare them, we should change ETH_P_IP from host endian to big endian, htons, not ntohs.

Applied to net-next since this actually doesn't cause any real problems winc htons() and ntohs() are implemented identically and perform the same operation.

Thanks.