DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xie, Huawei" <huawei.xie@intel.com>
To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] virtio: split virtio rx/tx queue
Date: Mon, 30 May 2016 08:17:02 +0000	[thread overview]
Message-ID: <C37D651A908B024F974696C65296B57B4C7BDFEA@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <20160530030316.GD5641@yliu-dev.sh.intel.com>

On 5/30/2016 11:00 AM, Yuanhan Liu wrote:
> On Mon, May 30, 2016 at 02:40:00AM +0000, Xie, Huawei wrote:
>> On 5/27/2016 5:06 PM, Yuanhan Liu wrote:
>>> On Tue, May 24, 2016 at 09:38:32PM +0800, Huawei Xie wrote:
>>>>  	vq->vq_ring_mem = mz->phys_addr;
>>>>  	vq->vq_ring_virt_mem = mz->addr;
>>>> -	PMD_INIT_LOG(DEBUG, "vq->vq_ring_mem:      0x%"PRIx64, (uint64_t)mz->phys_addr);
>>>> -	PMD_INIT_LOG(DEBUG, "vq->vq_ring_virt_mem: 0x%"PRIx64, (uint64_t)(uintptr_t)mz->addr);
>>>> -	vq->virtio_net_hdr_mz  = NULL;
>>>> -	vq->virtio_net_hdr_mem = 0;
>>>> +	PMD_INIT_LOG(DEBUG, "vq->vq_ring_mem:      0x%"PRIx64,
>>>> +		     (uint64_t)mz->phys_addr);
>>>> +	PMD_INIT_LOG(DEBUG, "vq->vq_ring_virt_mem: 0x%"PRIx64,
>>>> +		     (uint64_t)(uintptr_t)mz->addr);
>>>> +
>>>> +	hdr_mz = rte_memzone_reserve_aligned(vq_hdr_name, sz_hdr_mz, socket_id,
>>>> +					     0, RTE_CACHE_LINE_SIZE);
>>> We don't need allocate hdr_mz for Rx queue, and in such case, sz_hdr_mz
>>> is 0. I'm wondering what hdr_mz would be then, NULL?
>>>
>>> Anyway, you should skip the hdr_mz allocation for Rx queue, and I also
>>> would suggest you to move the vq_hdr_name setup here.
>> will check sz_hdr_mz before the zone allocation.
>>
>>
>>>> +	if (hdr_mz == NULL) {
>>>> +		if (rte_errno == EEXIST)
>>>> +			hdr_mz = rte_memzone_lookup(vq_hdr_name);
>>>> +		if (hdr_mz == NULL) {
>>>> +			ret = -ENOMEM;
>>>> +			goto fail_q_alloc;
>>>> +		}
>>>> +	}
>>>>  
>>> ...
>>>>  
>>>>  	PMD_INIT_FUNC_TRACE();
>>>>  	ret = virtio_dev_queue_setup(dev, VTNET_CQ, VTNET_SQ_CQ_QUEUE_IDX,
>>>> -			vtpci_queue_idx, 0, socket_id, &vq);
>>>> +			vtpci_queue_idx, 0, socket_id, (void **)&cvq);
>>> Unnecessary cast. Note that there are few others like that in this
>>> patch.
>> This cast is needed.
> Oh, right, indeed. Sorry.
>
>>>> -		PMD_RX_LOG(DEBUG, "dequeue:%d", num);
>>>> -		PMD_RX_LOG(DEBUG, "packet len:%d", len[0]);
>>>> +		PMD_RX_LOG(DEBUG, "dequeue:%d\n", num);
>>>> +		PMD_RX_LOG(DEBUG, "packet len:%d\n", len[0]);
>>> We should not append "\n" for PMD_RX_LOG; this macro alreadys does it.
>> Weird. Will remove it. Thanks.
>>
>>> Another note is that you might want to run checkpatch; I saw quite many
>>> warnings.
>> Had checked. The warnings are all due to 80 char limitation of
>> virtio_rxq_stats_strings. Just 4 or 5 chars cross 80 line limit. I
>> prefer to keep the fields aligned.
> Agreed. However, I was talking about others warnings.

ok, i see you are using checkpatch of newer Linux kernel.


>
> 	--yliu
>
> ---
> CHECK:BRACES: braces {} should be used on all arms of this statement
> #198: FILE: drivers/net/virtio/virtio_ethdev.c:343:

would fix this.

> +       if (queue_type == VTNET_RQ)
> [...]
> +       else if (queue_type == VTNET_TQ) {
> [...]
> +       } else if (queue_type == VTNET_CQ) {
> [...]
>
> CHECK:CAMELCASE: Avoid CamelCase: <PRIx64>
> #280: FILE: drivers/net/virtio/virtio_ethdev.c:404:
> +       PMD_INIT_LOG(DEBUG, "vq->vq_ring_mem:      0x%"PRIx64,
>
> CHECK:CONCATENATED_STRING: Concatenated strings should use spaces
> between elements
> #280: FILE: drivers/net/virtio/virtio_ethdev.c:404:
> +       PMD_INIT_LOG(DEBUG, "vq->vq_ring_mem:      0x%"PRIx64,
>
> CHECK:CONCATENATED_STRING: Concatenated strings should use spaces
> between elements
> #282: FILE: drivers/net/virtio/virtio_ethdev.c:406:
> +       PMD_INIT_LOG(DEBUG, "vq->vq_ring_virt_mem: 0x%"PRIx64,
>
> WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
> #482: FILE: drivers/net/virtio/virtio_ethdev.c:753:
> +       unsigned nstats = dev->data->nb_tx_queues * VIRTIO_NB_TXQ_XSTATS
> +
>
> WARNING:LONG_LINE: line over 80 characters
> #551: FILE: drivers/net/virtio/virtio_ethdev.c:819:
> +               memset(txvq->stats.size_bins, 0,
> sizeof(txvq->stats.size_bins[0]) * 8);
>
> WARNING:LONG_LINE: line over 80 characters
> #571: FILE: drivers/net/virtio/virtio_ethdev.c:832:
> +               memset(rxvq->stats.size_bins, 0,
> sizeof(rxvq->stats.size_bins[0]) * 8);

would fix this.

>
> CHECK:MULTIPLE_ASSIGNMENTS: multiple assignments should be avoided
> #1529: FILE: drivers/net/virtio/virtio_rxtx_simple.c:362:
> +       nb_commit = nb_pkts = RTE_MIN((vq->vq_free_cnt >> 1), nb_pkts);
>
> CHECK:SPACING: No space is necessary after a cast
> #1530: FILE: drivers/net/virtio/virtio_rxtx_simple.c:363:
> +       desc_idx = (uint16_t) (vq->vq_avail_idx & desc_idx_max);

All other warnings are due to the newer checkpatch script, and not
introduced by this patch, so wouldn't fix in this patch.
But i think some are better programming practice, like 'Concatenated
strings should use spaces between elements', so would post a patch to
fix them in virtio driver (if possible, all other drivers).



  reply	other threads:[~2016-05-30  8:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04  0:50 Huawei Xie
2016-05-05  0:03 ` Yuanhan Liu
2016-05-05  1:54   ` Xie, Huawei
2016-05-05  3:07     ` Yuanhan Liu
2016-05-05  3:29       ` Xie, Huawei
2016-05-05  3:50         ` Yuanhan Liu
2016-05-05  5:29           ` Xie, Huawei
2016-05-09  5:14             ` Yuanhan Liu
2016-05-09  5:44               ` Xie, Huawei
2016-05-09 16:02                 ` Yuanhan Liu
2016-05-24 13:38 ` Huawei Xie
2016-05-25 10:07   ` Thomas Monjalon
2016-05-25 15:01     ` Xie, Huawei
2016-05-27  9:07   ` Yuanhan Liu
2016-05-30  2:40     ` Xie, Huawei
2016-05-30  3:03       ` Yuanhan Liu
2016-05-30  8:17         ` Xie, Huawei [this message]
2016-05-30  9:06 ` [dpdk-dev] [PATCH v3] " Huawei Xie
2016-06-01  7:15   ` Yuanhan Liu
2016-06-02  6:38     ` Xie, Huawei
2016-06-02  6:43       ` Yuanhan Liu
2016-06-01 16:12   ` Huawei Xie
2016-06-02  8:09     ` Xie, Huawei
2016-06-03  2:53     ` 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=C37D651A908B024F974696C65296B57B4C7BDFEA@SHSMSX101.ccr.corp.intel.com \
    --to=huawei.xie@intel.com \
    --cc=dev@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).