From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 86EE02BA1; Wed, 7 Jun 2017 21:25:43 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 972BEC0587D4; Wed, 7 Jun 2017 19:25:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 972BEC0587D4 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=maxime.coquelin@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 972BEC0587D4 Received: from [10.36.112.25] (ovpn-112-25.ams2.redhat.com [10.36.112.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80D2C8EBE3; Wed, 7 Jun 2017 19:25:40 +0000 (UTC) To: Jianfeng Tan , dev@dpdk.org Cc: stable@dpdk.org, Yuanhan Liu , Jiayu Hu References: <1496817697-49130-1-git-send-email-jianfeng.tan@intel.com> <1496817697-49130-2-git-send-email-jianfeng.tan@intel.com> From: Maxime Coquelin Message-ID: Date: Wed, 7 Jun 2017 21:25:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <1496817697-49130-2-git-send-email-jianfeng.tan@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 07 Jun 2017 19:25:42 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH 1/2] vhost: fix TCP csum not set X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jun 2017 19:25:43 -0000 On 06/07/2017 08:41 AM, Jianfeng Tan wrote: > 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 Reviewed-by: Maxime Coquelin Thanks, Maxime > --- > 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)); >