patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Jianfeng Tan <jianfeng.tan@intel.com>, dev@dpdk.org
Cc: stable@dpdk.org, Yuanhan Liu <yuanhan.liu@linux.intel.com>,
	Jiayu Hu <jiayu.hu@intel.com>
Subject: Re: [dpdk-stable] [PATCH 2/2] vhost: fix IP csum not calculated
Date: Wed, 7 Jun 2017 21:28:13 +0200	[thread overview]
Message-ID: <766d75a8-450a-0be5-d961-85b75b32a46e@redhat.com> (raw)
In-Reply-To: <1496817697-49130-3-git-send-email-jianfeng.tan@intel.com>



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 <yuanhan.liu@linux.intel.com>
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Cc: Jiayu Hu <jiayu.hu@intel.com>
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
> ---
>   lib/librte_vhost/virtio_net.c | 9 +++++++++
>   1 file changed, 9 insertions(+)


Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

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;
> 

      reply	other threads:[~2017-06-07 19:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1496817697-49130-1-git-send-email-jianfeng.tan@intel.com>
2017-06-07  6:41 ` [dpdk-stable] [PATCH 1/2] vhost: fix TCP csum not set Jianfeng Tan
2017-06-07 19:25   ` Maxime Coquelin
2017-07-01 23:27     ` [dpdk-stable] [dpdk-dev] " Yuanhan Liu
2017-06-07  6:41 ` [dpdk-stable] [PATCH 2/2] vhost: fix IP csum not calculated Jianfeng Tan
2017-06-07 19:28   ` Maxime Coquelin [this message]

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=766d75a8-450a-0be5-d961-85b75b32a46e@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jianfeng.tan@intel.com \
    --cc=jiayu.hu@intel.com \
    --cc=stable@dpdk.org \
    --cc=yuanhan.liu@linux.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).