From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id B2058530C for ; Fri, 25 Mar 2016 08:56:20 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP; 25 Mar 2016 00:56:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,389,1455004800"; d="scan'208";a="675414004" Received: from yliu-dev.sh.intel.com ([10.239.66.49]) by FMSMGA003.fm.intel.com with ESMTP; 25 Mar 2016 00:56:19 -0700 From: Yuanhan Liu To: dev@dpdk.org Cc: huawei.xie@intel.com, Thomas Monjalon , Ksiadz MarcinX , Yuanhan Liu Date: Fri, 25 Mar 2016 15:58:51 +0800 Message-Id: <1458892732-3885-4-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1458892732-3885-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1458885694-31111-1-git-send-email-yuanhan.liu@linux.intel.com> <1458892732-3885-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-dev] [PATCH v2 3/4] examples/vhost: fix offload settings X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Mar 2016 07:56:21 -0000 Comments for PKT_TX_TCP_SEG at rte_mbuf says that we should only set PKT_TX_IP_CKSUM and reset ip hdr checksum for IPv4: - if it's IPv4, set the PKT_TX_IP_CKSUM flag and write the IP checksum to 0 in the packet Fixes: 9fd72e3cbd29 ("examples/vhost: add virtio offload") Signed-off-by: Yuanhan Liu --- examples/vhost/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index ceabbce..86e5c24 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -1163,10 +1163,13 @@ static void virtio_tx_offload(struct rte_mbuf *m) l3_hdr = (char *)eth_hdr + m->l2_len; - ipv4_hdr = (struct ipv4_hdr *)l3_hdr; + if (m->ol_flags & PKT_TX_IPV4) { + ipv4_hdr = l3_hdr; + ipv4_hdr->hdr_checksum = 0; + m->ol_flags |= PKT_TX_IP_CKSUM; + } + tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + m->l3_len); - m->ol_flags |= PKT_TX_IP_CKSUM; - ipv4_hdr->hdr_checksum = 0; tcp_hdr->cksum = get_psd_sum(l3_hdr, m->ol_flags); } -- 1.9.0