Skip to contentSkip to conversation

ixgbe: Correctly obtain protocol information on transmit

PATCH Applied Auke Kok 3 participants 3 messages Feb 12, 2008 – Feb 15, 2008

Subsystems (2)
lore
Share & tools
lore

Auke Kok

author
#0 lore raw

PATCH 1/1 ixgbe: Correctly obtain protocol information on transmit

In reply to "RE: [Fwd: [PATCH 2.6.25] ixgbe/igb: correctly obtain protocol information on transmit]" from Andy Gospodarek:

The driver was incorrectly looking at socket headers for protocol information, needed for checksumming offload. Fix this by not looking at the socket but frame headers instead.

This disregards extension headers but it's unclear that linux generates those anyway.

Tested by Andy Gospodarek.

---

 drivers/net/ixgbe/ixgbe_main.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +21 -3
index 540b647..23d0a4a 100644
@@ -2277,11 +2277,29 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter,
 				    IXGBE_ADVTXD_DTYP_CTXT);
 
 		if (skb->ip_summed == CHECKSUM_PARTIAL) {
-			if (skb->protocol == htons(ETH_P_IP))
+			switch (skb->protocol) {
+			case __constant_htons(ETH_P_IP):
 				type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4;
+				if (ip_hdr(skb)->protocol == IPPROTO_TCP)
+					type_tucmd_mlhl |=
+						IXGBE_ADVTXD_TUCMD_L4T_TCP;
+				break;
+
+			case __constant_htons(ETH_P_IPV6):
+				/* XXX what about other V6 headers?? */
+				if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
+					type_tucmd_mlhl |=
+						IXGBE_ADVTXD_TUCMD_L4T_TCP;
+				break;
 
-			if (skb->sk->sk_protocol == IPPROTO_TCP)
-				type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP;
+			default:
+				if (unlikely(net_ratelimit())) {
+					DPRINTK(PROBE, WARNING,
+					 "partial checksum but proto=%x!\n",
+					 skb->protocol);
+				}
+				break;
+			}
 		}
 
 		context_desc->type_tucmd_mlhl = cpu_to_le32(type_tucmd_mlhl);
#1 lore raw
Quoted 7 lines · Auke Kok

In reply to "RE: [Fwd: [PATCH 2.6.25] ixgbe/igb: correctly obtain protocol information on transmit]" from Andy Gospodarek:

The driver was incorrectly looking at socket headers for protocol information, needed for checksumming offload. Fix this by not looking at the socket but frame headers instead.

Quoted 6 lines

This disregards extension headers but it's unclear that linux generates those anyway.

Tested by Andy Gospodarek.

This works well for me too.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Applied
#2 lore raw
In reply to Auke Kok
Quoted 7 lines · Auke Kok

In reply to "RE: [Fwd: [PATCH 2.6.25] ixgbe/igb: correctly obtain protocol information on transmit]" from Andy Gospodarek:

The driver was incorrectly looking at socket headers for protocol information, needed for checksumming offload. Fix this by not looking at the socket but frame headers instead.

Quoted 6 lines

This disregards extension headers but it's unclear that linux generates those anyway.

Tested by Andy Gospodarek.

applied

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/