DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xia, Chenbo" <chenbo.xia@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
	"dev@dpdk.org" <dev@dpdk.org>, "Liu, Yong" <yong.liu@intel.com>
Subject: Re: [dpdk-dev] [PATCH 2/2] vhost: use fixed Virtio-net header len packed ring
Date: Fri, 9 Oct 2020 06:36:10 +0000	[thread overview]
Message-ID: <MN2PR11MB40632BC2E68711A2CD9B85E59C080@MN2PR11MB4063.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20201001101155.206237-3-maxime.coquelin@redhat.com>

Hi Maxime,

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Thursday, October 1, 2020 6:12 PM
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>; Liu, Yong
> <yong.liu@intel.com>
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Subject: [PATCH 2/2] vhost: use fixed Virtio-net header len packed ring
> 
> This small optimization uses static the Virtio-net header len

Better use 'the static Virtio-net header length' here when you apply the
patch 😊. With this fix:

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>

> in packed datapath, since Virtio-net header cannot be the
> legacy one in case of packed ring.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/librte_vhost/virtio_net.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 0a0bea1a5a..5865fa5f65 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -1147,7 +1147,7 @@ vhost_enqueue_single_packed(struct virtio_net *dev,
>  	uint16_t buf_id = 0;
>  	uint32_t len = 0;
>  	uint16_t desc_count;
> -	uint32_t size = pkt->pkt_len + dev->vhost_hlen;
> +	uint32_t size = pkt->pkt_len + sizeof(struct
> virtio_net_hdr_mrg_rxbuf);
>  	uint16_t num_buffers = 0;
>  	uint32_t buffer_len[vq->size];
>  	uint16_t buffer_buf_id[vq->size];
> @@ -1262,7 +1262,7 @@ virtio_dev_rx_batch_packed(struct virtio_net *dev,
>  	uint16_t avail_idx = vq->last_avail_idx;
>  	uint64_t desc_addrs[PACKED_BATCH_SIZE];
>  	struct virtio_net_hdr_mrg_rxbuf *hdrs[PACKED_BATCH_SIZE];
> -	uint32_t buf_offset = dev->vhost_hlen;
> +	uint32_t buf_offset = sizeof(struct virtio_net_hdr_mrg_rxbuf);
>  	uint64_t lens[PACKED_BATCH_SIZE];
>  	uint16_t ids[PACKED_BATCH_SIZE];
>  	uint16_t i;
> @@ -1308,7 +1308,8 @@ virtio_dev_rx_batch_packed(struct virtio_net *dev,
>  		rte_prefetch0((void *)(uintptr_t)desc_addrs[i]);
>  		hdrs[i] = (struct virtio_net_hdr_mrg_rxbuf *)
>  					(uintptr_t)desc_addrs[i];
> -		lens[i] = pkts[i]->pkt_len + dev->vhost_hlen;
> +		lens[i] = pkts[i]->pkt_len +
> +			sizeof(struct virtio_net_hdr_mrg_rxbuf);
>  	}
> 
>  	vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)
> @@ -2277,7 +2278,7 @@ vhost_reserve_avail_batch_packed(struct virtio_net
> *dev,
>  	struct virtio_net_hdr *hdr;
>  	uint64_t lens[PACKED_BATCH_SIZE];
>  	uint64_t buf_lens[PACKED_BATCH_SIZE];
> -	uint32_t buf_offset = dev->vhost_hlen;
> +	uint32_t buf_offset = sizeof(struct virtio_net_hdr_mrg_rxbuf);
>  	uint16_t flags, i;
> 
>  	if (unlikely(avail_idx & PACKED_BATCH_MASK))
> @@ -2354,7 +2355,7 @@ virtio_dev_tx_batch_packed(struct virtio_net *dev,
>  			   struct rte_mbuf **pkts)
>  {
>  	uint16_t avail_idx = vq->last_avail_idx;
> -	uint32_t buf_offset = dev->vhost_hlen;
> +	uint32_t buf_offset = sizeof(struct virtio_net_hdr_mrg_rxbuf);
>  	uintptr_t desc_addrs[PACKED_BATCH_SIZE];
>  	uint16_t ids[PACKED_BATCH_SIZE];
>  	uint16_t i;
> --
> 2.26.2


  reply	other threads:[~2020-10-09  6:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 10:11 [dpdk-dev] [PATCH 0/2] Fix packed ring header len Maxime Coquelin
2020-10-01 10:11 ` [dpdk-dev] [PATCH 1/2] vhost: fix Virtio-net header len with packed ring Maxime Coquelin
2020-10-09  6:33   ` Xia, Chenbo
2020-10-01 10:11 ` [dpdk-dev] [PATCH 2/2] vhost: use fixed Virtio-net header len " Maxime Coquelin
2020-10-09  6:36   ` Xia, Chenbo [this message]
2020-10-09  7:23     ` Maxime Coquelin
2020-10-09  7:23 ` [dpdk-dev] [PATCH 0/2] Fix packed ring header len Maxime Coquelin

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=MN2PR11MB40632BC2E68711A2CD9B85E59C080@MN2PR11MB4063.namprd11.prod.outlook.com \
    --to=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=yong.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).