DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Jijiang Liu <jijiang.liu@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v4 8/8] virtio/lib:add guest offload handle
Date: Wed, 11 Nov 2015 16:23:18 +0800	[thread overview]
Message-ID: <20151111082318.GY2326@yliu-dev.sh.intel.com> (raw)
In-Reply-To: <1447224046-1169-9-git-send-email-jijiang.liu@intel.com>

Regarding to your patch title, there are two minor pits:

- the prefix should be "vhost" but not "virtio/lib".

- you should add an extra space after ":"

On Wed, Nov 11, 2015 at 02:40:46PM +0800, Jijiang Liu wrote:
> Enqueue guest offload(CSUM and TSO) handle.

(ALL) Your patch lacks some explanation. And I don't think it's about
guest offload handling, it's about setting the right offload fields for
RX side, such as VIRTIO_NET_HDR_F_NEEDS_CSUM.

And you need spend few words to state why that is required. Something
like following might help others to review:

    For packet going through from one VM to another VM without passing
    the NIC, and the VM claiming that it supports checksum offload,
    no one will actually calculate the checksum, hence, the packet
    will be dropped at TCP layer, due to checksum validation is failed.

    However, for VM2VM case, there is no need to do checksum, for we
    think the data should be reliable enough, and setting VIRTIO_NET_HDR_F_NEEDS_CSUM
    at RX side will let the TCP layer to bypass the checksum validation,
    so that the RX side could receive the packet in the end.

    At RX side, the offload information is inherited from mbuf, which is
    in turn inherited from TX side. If we can still get those info at RX
    side, it means the packet is from another VM at same host.  So, it's
    safe to set the VIRTIO_NET_HDR_F_NEEDS_CSUM, to skip checksum validation.


> Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
> ---
>  lib/librte_vhost/vhost_rxtx.c |   45 +++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 43 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
> index 9e70990..468fed8 100644
> --- a/lib/librte_vhost/vhost_rxtx.c
> +++ b/lib/librte_vhost/vhost_rxtx.c
> @@ -54,6 +54,42 @@ is_valid_virt_queue_idx(uint32_t idx, int is_tx, uint32_t qp_nb)
>  	return (is_tx ^ (idx & 1)) == 0 && idx < qp_nb * VIRTIO_QNUM;
>  }
>  
> +static void
> +virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr)
> +{

As virtio_hdr is set per mbuf, you'd better reset net_hdr first before
setting it. Otherwise, if this mbuf has no offload related stuff, you
may still get a net_hdr with offload related fields set, due to last
mbuf has that.

I know the chance is rare, but it's for code logic.


	--yliu

  reply	other threads:[~2015-11-11  8:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11  6:40 [dpdk-dev] [PATCH v4 0/8] add virtio offload support in us-vhost Jijiang Liu
2015-11-11  6:40 ` [dpdk-dev] [PATCH v4 1/8] driver/virtio:add virtual address for virtio net header Jijiang Liu
2015-11-11  6:40 ` [dpdk-dev] [PATCH v4 2/8] driver/virtio:record virtual address of " Jijiang Liu
2015-11-11  6:40 ` [dpdk-dev] [PATCH v4 3/8] virtio/lib:add vhost TX checksum support capabilities Jijiang Liu
2015-11-11  8:26   ` Yuanhan Liu
2015-11-11 17:31     ` Stephen Hemminger
2015-11-12  1:41       ` Yuanhan Liu
2015-11-11  6:40 ` [dpdk-dev] [PATCH v4 4/8] virtio/lib:dequeue vhost TX offload Jijiang Liu
2015-11-11  6:40 ` [dpdk-dev] [PATCH v4 5/8] sample/vhost:remove ip_hdr structure defination Jijiang Liu
2015-11-11  8:34   ` Yuanhan Liu
2015-11-11 10:05     ` Thomas Monjalon
2015-11-11  6:40 ` [dpdk-dev] [PATCH v4 6/8] examples/vhost:support TX offload in vhost sample Jijiang Liu
2015-11-11  6:40 ` [dpdk-dev] [PATCH v4 7/8] virtio/lib:add virtio guest offload capabilities Jijiang Liu
2015-11-11  8:31   ` Yuanhan Liu
2015-11-11  8:38     ` Liu, Jijiang
2015-11-11  8:44       ` Yuanhan Liu
2015-11-11  8:53         ` Liu, Jijiang
2015-11-11  8:57           ` Xu, Qian Q
2015-11-11 11:10             ` Liu, Jijiang
2015-11-11 10:08           ` Thomas Monjalon
2015-11-11 12:53           ` Yuanhan Liu
2015-11-11  6:40 ` [dpdk-dev] [PATCH v4 8/8] virtio/lib:add guest offload handle Jijiang Liu
2015-11-11  8:23   ` Yuanhan Liu [this message]
2015-11-11 10:19     ` Thomas Monjalon

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=20151111082318.GY2326@yliu-dev.sh.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=dev@dpdk.org \
    --cc=jijiang.liu@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).