From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 26DAD2B91; Wed, 7 Jun 2017 08:40:47 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jun 2017 23:40:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,310,1493708400"; d="scan'208";a="1138774824" Received: from dpdk06.sh.intel.com ([10.239.129.195]) by orsmga001.jf.intel.com with ESMTP; 06 Jun 2017 23:40:43 -0700 From: Jianfeng Tan To: dev@dpdk.org Cc: Jianfeng Tan , stable@dpdk.org, Yuanhan Liu , Maxime Coquelin , Jiayu Hu Date: Wed, 7 Jun 2017 06:41:36 +0000 Message-Id: <1496817697-49130-2-git-send-email-jianfeng.tan@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496817697-49130-1-git-send-email-jianfeng.tan@intel.com> References: <1496817697-49130-1-git-send-email-jianfeng.tan@intel.com> Subject: [dpdk-stable] [PATCH 1/2] vhost: fix TCP csum not set X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jun 2017 06:40:49 -0000 As PKT_TX_TCP_SEG flag in mbuf->ol_flags implies PKT_TX_TCP_CKSUM, applications, e.g., testpmd, don't set PKT_TX_TCP_CKSUM when TSO is set. This leads to that packets get dropped in VM tcp stack layer because of bad TCP csum. To fix this, we make sure TCP NEEDS_CSUM info is set into virtio net header when PKT_TX_TCP_SEG is set, so that VM tcp stack will not check the TCP csum. Fixes: 859b480d5afd ("vhost: add guest offload setting") Cc: stable@dpdk.org Cc: Yuanhan Liu Cc: Maxime Coquelin Cc: Jiayu Hu Signed-off-by: Jianfeng Tan --- lib/librte_vhost/virtio_net.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 48219e0..0a7e023 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -114,11 +114,16 @@ update_shadow_used_ring(struct vhost_virtqueue *vq, static void virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) { - if (m_buf->ol_flags & PKT_TX_L4_MASK) { + uint64_t csum_l4 = m_buf->ol_flags & PKT_TX_L4_MASK; + + if (m_buf->ol_flags & PKT_TX_TCP_SEG) + csum_l4 |= PKT_TX_TCP_CKSUM; + + if (csum_l4) { net_hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; net_hdr->csum_start = m_buf->l2_len + m_buf->l3_len; - switch (m_buf->ol_flags & PKT_TX_L4_MASK) { + switch (csum_l4) { case PKT_TX_TCP_CKSUM: net_hdr->csum_offset = (offsetof(struct tcp_hdr, cksum)); -- 2.7.4