From: Jianfeng Tan <jianfeng.tan@intel.com>
To: dev@dpdk.org
Cc: konstantin.ananyev@intel.com, jingjing.wu@intel.com,
mark.b.kavanagh@intel.com, Jianfeng Tan <jianfeng.tan@intel.com>
Subject: [dpdk-dev] [PATCH 2/2] examples/tep_term: fix inner L4 checksum failure
Date: Thu, 4 Aug 2016 07:58:49 +0000 [thread overview]
Message-ID: <1470297529-100773-3-git-send-email-jianfeng.tan@intel.com> (raw)
In-Reply-To: <1470297529-100773-1-git-send-email-jianfeng.tan@intel.com>
When sending packets from virtual machine which in need of TSO
by hardware NIC, the inner L4 checksum is not correct on the
other side of the cable.
It's because get_psd_sum() depends on PKT_TX_TCP_SEG to calculate
pseudo-header checksum, but currently this bit is set after the
function get_psd_sum() is called. The fix is straightforward.
Move the bit setting before get_psd_sum() is called.
Fixes: a50245ede72a ("examples/tep_term: initialize VXLAN sample")
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
examples/tep_termination/vxlan.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c
index 4bad33d..155415c 100644
--- a/examples/tep_termination/vxlan.c
+++ b/examples/tep_termination/vxlan.c
@@ -141,14 +141,17 @@ process_inner_cksums(struct ether_hdr *eth_hdr, union tunnel_offload_info *info)
ethertype, ol_flags);
} else if (l4_proto == IPPROTO_TCP) {
tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len);
- ol_flags |= PKT_TX_TCP_CKSUM;
- tcp_hdr->cksum = get_psd_sum(l3_hdr, ethertype,
- ol_flags);
+ /* Put PKT_TX_TCP_SEG bit setting before get_psd_sum(), because
+ * it depends on PKT_TX_TCP_SEG to calculate pseudo-header
+ * checksum.
+ */
if (tso_segsz != 0) {
ol_flags |= PKT_TX_TCP_SEG;
info->tso_segsz = tso_segsz;
info->l4_len = sizeof(struct tcp_hdr);
}
+ ol_flags |= PKT_TX_TCP_CKSUM;
+ tcp_hdr->cksum = get_psd_sum(l3_hdr, ethertype, ol_flags);
} else if (l4_proto == IPPROTO_SCTP) {
sctp_hdr = (struct sctp_hdr *)((char *)l3_hdr + info->l3_len);
--
2.7.4
next prev parent reply other threads:[~2016-08-04 7:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-04 7:58 [dpdk-dev] [PATCH 0/2] Two offloading issues of tep_term Jianfeng Tan
2016-08-04 7:58 ` [dpdk-dev] [PATCH 1/2] examples/tep_term: fix offload on VXLAN failure Jianfeng Tan
2016-09-11 12:09 ` Yuanhan Liu
2016-09-12 8:42 ` Tan, Jianfeng
2016-09-12 9:36 ` Thomas Monjalon
2016-09-13 0:50 ` Tan, Jianfeng
2016-09-13 2:40 ` Yuanhan Liu
2016-08-04 7:58 ` Jianfeng Tan [this message]
2016-10-13 9:39 ` [dpdk-dev] [PATCH 0/2] Two offloading issues of tep_term Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1470297529-100773-3-git-send-email-jianfeng.tan@intel.com \
--to=jianfeng.tan@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=konstantin.ananyev@intel.com \
--cc=mark.b.kavanagh@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).