summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAndrew Gallatin <gallatin@FreeBSD.org>2010-11-29 13:36:37 +0000
committerAndrew Gallatin <gallatin@FreeBSD.org>2010-11-29 13:36:37 +0000
commitcc4824933ce12f5f4ec1791cb34096db8545e8ad (patch)
tree47a96f7416e86779d4f143e8f2571d13ac67a189 /sys
parent6e6d2f6f6308642acacfad7115dfd6055e5a0e5f (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/mxge/if_mxge.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/dev/mxge/if_mxge.c b/sys/dev/mxge/if_mxge.c
index 7f86b4d82e15e..1d4c7516ef4a7 100644
--- a/sys/dev/mxge/if_mxge.c
+++ b/sys/dev/mxge/if_mxge.c
@@ -1828,9 +1828,20 @@ mxge_encap_tso(struct mxge_slice_state *ss, struct mbuf *m,
tcp = (struct tcphdr *)((char *)ip + (ip->ip_hl << 2));
cum_len = -(ip_off + ((ip->ip_hl + tcp->th_off) << 2));
+ cksum_offset = ip_off + (ip->ip_hl << 2);
/* TSO implies checksum offload on this hardware */
- cksum_offset = ip_off + (ip->ip_hl << 2);
+ if (__predict_false((m->m_pkthdr.csum_flags & (CSUM_TCP)) == 0)) {
+ /*
+ * If packet has full TCP csum, replace it with pseudo hdr
+ * sum that the NIC expects, otherwise the NIC will emit
+ * packets with bad TCP checksums.
+ */
+ m->m_pkthdr.csum_flags = CSUM_TCP;
+ m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum);
+ tcp->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr,
+ htons(IPPROTO_TCP + (m->m_pkthdr.len - cksum_offset)));
+ }
flags = MXGEFW_FLAGS_TSO_HDR | MXGEFW_FLAGS_FIRST;