[PATCH net-2.6 6/7] jme: Tuning rxsum function

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: David Miller <davem@...>
Cc: netdev <netdev@...>, Ethan Hsiao <ethanhsiao@...>
Date: Tuesday, June 30, 2009 - 5:14 pm

1. Use more efficient way to determine flag status.
2. Hardware dose not mark fragment bit against IPv6 packets,
   print TCP/UDP checksum warning message for IPv4 packets only.

Signed-off-by: Guo-Fu Tseng <cooldavid@cooldavid.org>
---
 drivers/net/jme.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index 29cd5f4..e7068c7 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -880,27 +880,27 @@ jme_rxsum_ok(struct jme_adapter *jme, u16 flags)
 	if (!(flags & (RXWBFLAG_TCPON | RXWBFLAG_UDPON | RXWBFLAG_IPV4)))
 		return false;
 
-	if (unlikely(!(flags & RXWBFLAG_MF) &&
-	(flags & RXWBFLAG_TCPON) && !(flags & RXWBFLAG_TCPCS))) {
-		msg_rx_err(jme, "TCP Checksum error.\n");
-		goto out_sumerr;
+	if (unlikely((flags & (RXWBFLAG_MF | RXWBFLAG_TCPON | RXWBFLAG_TCPCS))
+			== RXWBFLAG_TCPON)) {
+		if (flags & RXWBFLAG_IPV4)
+			msg_rx_err(jme, "TCP Checksum error\n");
+		return false;
 	}
 
-	if (unlikely(!(flags & RXWBFLAG_MF) &&
-	(flags & RXWBFLAG_UDPON) && !(flags & RXWBFLAG_UDPCS))) {
-		msg_rx_err(jme, "UDP Checksum error.\n");
-		goto out_sumerr;
+	if (unlikely((flags & (RXWBFLAG_MF | RXWBFLAG_UDPON | RXWBFLAG_UDPCS))
+			== RXWBFLAG_UDPON)) {
+		if (flags & RXWBFLAG_IPV4)
+			msg_rx_err(jme, "UDP Checksum error.\n");
+		return false;
 	}
 
-	if (unlikely((flags & RXWBFLAG_IPV4) && !(flags & RXWBFLAG_IPCS))) {
+	if (unlikely((flags & (RXWBFLAG_IPV4 | RXWBFLAG_IPCS))
+			== RXWBFLAG_IPV4)) {
 		msg_rx_err(jme, "IPv4 Checksum error.\n");
-		goto out_sumerr;
+		return false;
 	}
 
 	return true;
-
-out_sumerr:
-	return false;
 }
 
 static void
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH net-2.6 6/7] jme: Tuning rxsum function, Guo-Fu Tseng, (Tue Jun 30, 5:14 pm)
[GIT]: Networking, David Miller, (Wed Jul 1, 12:39 am)
Re: [GIT]: Networking, Ingo Molnar, (Thu Jul 2, 3:57 am)
Re: [GIT]: Networking, Eric Dumazet, (Thu Jul 2, 6:51 am)
Re: [GIT]: Networking, Eric Dumazet, (Thu Jul 2, 10:04 am)
Re: [GIT]: Networking, Ayaz Abdulla, (Thu Jul 2, 12:13 pm)
Re: [GIT]: Networking, Eric Dumazet, (Thu Jul 2, 6:32 pm)
Re: [GIT]: Networking, Ayaz Abdulla, (Thu Jul 2, 1:29 pm)
Re: [GIT]: Networking, David Miller, (Thu Jul 2, 9:32 pm)
Re: [GIT]: Networking, Eric Dumazet, (Thu Jul 2, 8:07 pm)
RE: [GIT]: Networking, Ayaz Abdulla, (Thu Jul 2, 9:11 pm)
Re: [GIT]: Networking, David Miller, (Thu Jul 2, 9:30 pm)
Re: [GIT]: Networking, Ingo Molnar, (Thu Jul 2, 4:05 pm)
Re: [GIT]: Networking, Ingo Molnar, (Fri Jul 3, 5:46 pm)
Re: [GIT]: Networking, David Miller, (Sun Jul 5, 10:04 pm)
Re: [GIT]: Networking, Herbert Xu, (Sun Jul 5, 12:09 am)