DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Tiwei Bie <tiwei.bie@intel.com>
Cc: dev@dpdk.org, jfreimann@redhat.com, zhihong.wang@intel.com,
	bruce.richardson@intel.com, konstantin.ananyev@intel.com,
	david.marchand@redhat.com
Subject: Re: [dpdk-dev] [PATCH v2 3/5] vhost: do not inline unlikely fragmented buffers code
Date: Fri, 24 May 2019 15:50:21 +0200	[thread overview]
Message-ID: <a7003808-d7fa-bf6b-cc35-4862eadb940d@redhat.com> (raw)
In-Reply-To: <20190520055132.GA19612@___>



On 5/20/19 7:51 AM, Tiwei Bie wrote:
> On Fri, May 17, 2019 at 05:06:11PM +0200, Maxime Coquelin wrote:
> [...]
>>   
>> +static void
>> +copy_vnet_hdr_from_desc(struct virtio_net_hdr *hdr,
>> +		struct buf_vector *buf_vec)
>> +{
>> +	uint64_t len;
>> +	uint64_t remain = sizeof(struct virtio_net_hdr);
>> +	uint64_t src;
>> +	uint64_t dst = (uint64_t)(uintptr_t)&hdr;
> 
> typo: s/&hdr/hdr/

Nice catch! It wasn't spotted at build time due to the cast.

>> +
>> +	/*
>> +	 * No luck, the virtio-net header doesn't fit
>> +	 * in a contiguous virtual area.
>> +	 */
>> +	while (remain) {
>> +		len = RTE_MIN(remain, buf_vec->buf_len);
>> +		src = buf_vec->buf_addr;
>> +		rte_memcpy((void *)(uintptr_t)dst,
>> +				(void *)(uintptr_t)src, len);
>> +
>> +		remain -= len;
>> +		dst += len;
>> +		buf_vec++;
>> +	}
>> +}
>> +
>>   static __rte_always_inline int
>>   copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq,
>>   		  struct buf_vector *buf_vec, uint16_t nr_vec,
>> @@ -1094,28 +1126,7 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq,
>>   
>>   	if (virtio_net_with_host_offload(dev)) {
>>   		if (unlikely(buf_len < sizeof(struct virtio_net_hdr))) {
>> -			uint64_t len;
>> -			uint64_t remain = sizeof(struct virtio_net_hdr);
>> -			uint64_t src;
>> -			uint64_t dst = (uint64_t)(uintptr_t)&tmp_hdr;
>> -			uint16_t hdr_vec_idx = 0;
>> -
>> -			/*
>> -			 * No luck, the virtio-net header doesn't fit
>> -			 * in a contiguous virtual area.
>> -			 */
> 
> It's better to not move above comments.

Right, I will revert it back here.

> 
> For the rest,
> Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>


Thanks,
Maxime

> 
>> -			while (remain) {
>> -				len = RTE_MIN(remain,
>> -					buf_vec[hdr_vec_idx].buf_len);
>> -				src = buf_vec[hdr_vec_idx].buf_addr;
>> -				rte_memcpy((void *)(uintptr_t)dst,
>> -						   (void *)(uintptr_t)src, len);
>> -
>> -				remain -= len;
>> -				dst += len;
>> -				hdr_vec_idx++;
>> -			}
>> -
>> +			copy_vnet_hdr_from_desc(&tmp_hdr, buf_vec);
>>   			hdr = &tmp_hdr;
>>   		} else {
>>   			hdr = (struct virtio_net_hdr *)((uintptr_t)buf_addr);
>> -- 
>> 2.21.0
>>

  reply	other threads:[~2019-05-24 13:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17 15:06 [dpdk-dev] [PATCH v2 0/5] vhost: I-cache pressure optimizations Maxime Coquelin
2019-05-17 15:06 ` [dpdk-dev] [PATCH v2 1/5] vhost: un-inline dirty pages logging functions Maxime Coquelin
2019-05-20  5:18   ` Tiwei Bie
2019-05-17 15:06 ` [dpdk-dev] [PATCH v2 2/5] vhost: do not inline packed and split functions Maxime Coquelin
2019-05-20  5:30   ` Tiwei Bie
2019-05-17 15:06 ` [dpdk-dev] [PATCH v2 3/5] vhost: do not inline unlikely fragmented buffers code Maxime Coquelin
2019-05-20  5:51   ` Tiwei Bie
2019-05-24 13:50     ` Maxime Coquelin [this message]
2019-05-17 15:06 ` [dpdk-dev] [PATCH v2 4/5] vhost: simplify descriptor's buffer prefetching Maxime Coquelin
2019-05-29  8:05   ` Tiwei Bie
2019-05-17 15:06 ` [dpdk-dev] [PATCH v2 5/5] eal/x86: force inlining of all memcpy and mov helpers Maxime Coquelin
2019-05-20  8:30   ` David Marchand

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=a7003808-d7fa-bf6b-cc35-4862eadb940d@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jfreimann@redhat.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=tiwei.bie@intel.com \
    --cc=zhihong.wang@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).