DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: yuanhan.liu@linux.intel.com, dev@dpdk.org
Cc: mst@redhat.com, jianfeng.tan@intel.com, olivier.matz@6wind.com,
	stephen@networkplumber.org
Subject: Re: [dpdk-dev] [PATCH] vhost: Only access header if offloading is supported in dequeue path
Date: Thu, 6 Oct 2016 19:06:11 +0200	[thread overview]
Message-ID: <302508c8-ce7d-aa55-ca03-62d3ddcb6420@redhat.com> (raw)
In-Reply-To: <1475773241-5714-1-git-send-email-maxime.coquelin@redhat.com>



On 10/06/2016 07:00 PM, Maxime Coquelin wrote:
> If offloading features are not negotiated, parsing the virtio header
> is not needed.
>
> Micro-benchmark with testpmd shows that the gain is +4% with indirect
> descriptors, +1% when using direct descriptors.
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/librte_vhost/virtio_net.c | 47 ++++++++++++++++++++++++++++++++-----------
>  1 file changed, 35 insertions(+), 12 deletions(-)
>
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index a59c39b..5d51693 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -548,6 +548,18 @@ rte_vhost_enqueue_burst(int vid, uint16_t queue_id,
>  		return virtio_dev_rx(dev, queue_id, pkts, count);
>  }
>
> +static inline bool
> +virtio_net_with_host_offload(struct virtio_net *dev)
> +{
> +	if (dev->features &
> +			(VIRTIO_NET_F_CSUM | VIRTIO_NET_F_HOST_ECN |
> +			 VIRTIO_NET_F_HOST_TSO4 | VIRTIO_NET_F_HOST_TSO6 |
> +			 VIRTIO_NET_F_HOST_UFO))
> +		return true;
> +
> +	return false;
> +}
> +
>  static void
>  parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr)
>  {
> @@ -600,6 +612,9 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m)
>  	void *l4_hdr = NULL;
>  	struct tcp_hdr *tcp_hdr = NULL;
>
> +	if (hdr->flags == 0 || hdr->gso_type == VIRTIO_NET_HDR_GSO_NONE)
> +		return;
> +

Oops, just noticed I forgot to amend a fix I did.
Of course, the above test should be:
if (hdr->flags == 0 && hdr->gso_type == VIRTIO_NET_HDR_GSO_NONE)

It will be fixed in the v2.

Regards,
Maxime

  reply	other threads:[~2016-10-06 17:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 17:00 Maxime Coquelin
2016-10-06 17:06 ` Maxime Coquelin [this message]
2016-10-11  7:45 ` [dpdk-dev] [PATCH v2] " Maxime Coquelin
2016-10-11  9:01   ` Yuanhan Liu
2016-10-14  7:24     ` Maxime Coquelin
2016-10-14  8:07 ` [dpdk-dev] [PATCH v3] " Maxime Coquelin
2016-10-18 14:30   ` Yuanhan Liu

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=302508c8-ce7d-aa55-ca03-62d3ddcb6420@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jianfeng.tan@intel.com \
    --cc=mst@redhat.com \
    --cc=olivier.matz@6wind.com \
    --cc=stephen@networkplumber.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).