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 3A65C2BA1; Wed, 7 Jun 2017 21:28:19 +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 738CC7EBA9; Wed, 7 Jun 2017 19:28:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 738CC7EBA9 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=maxime.coquelin@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 738CC7EBA9 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 44F8E8EBE0; Wed, 7 Jun 2017 19:28:15 +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-3-git-send-email-jianfeng.tan@intel.com> From: Maxime Coquelin Message-ID: <766d75a8-450a-0be5-d961-85b75b32a46e@redhat.com> Date: Wed, 7 Jun 2017 21:28:13 +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-3-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.27]); Wed, 07 Jun 2017 19:28:18 +0000 (UTC) Subject: Re: [dpdk-stable] [PATCH 2/2] vhost: fix IP csum not calculated 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 19:28:19 -0000 On 06/07/2017 08:41 AM, Jianfeng Tan wrote: > There is no way to bypass IP checksum verification in Linux > kernel, no matter skb->ip_summed is assigned as CHECKSUM_UNNECESSARY > or CHECKSUM_PARTIAL. > > So any packets with bad IP checksum will be dropped at VM IP layer. > > To correct, we check this flag PKT_TX_IP_CKSUM to calculate IP 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, 9 insertions(+) Reviewed-by: Maxime Coquelin Thanks, Maxime > > diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c > index 0a7e023..cf7c5ac 100644 > --- a/lib/librte_vhost/virtio_net.c > +++ b/lib/librte_vhost/virtio_net.c > @@ -143,6 +143,15 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) > ASSIGN_UNLESS_EQUAL(net_hdr->flags, 0); > } > > + /* IP cksum verification cannot be bypassed, then calculate here */ > + if (m_buf->ol_flags & PKT_TX_IP_CKSUM) { > + struct ipv4_hdr *ipv4_hdr; > + > + ipv4_hdr = rte_pktmbuf_mtod_offset(m_buf, struct ipv4_hdr *, > + m_buf->l2_len); > + ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); > + } > + > if (m_buf->ol_flags & PKT_TX_TCP_SEG) { > if (m_buf->ol_flags & PKT_TX_IPV4) > net_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4; >