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: Thu, 5 May 2016 01:54:25 +0000	[thread overview]
Message-ID: <C37D651A908B024F974696C65296B57B4C74C637@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <20160505000327.GT5641@yliu-dev.sh.intel.com>

On 5/5/2016 7:59 AM, Yuanhan Liu wrote:
> On Wed, May 04, 2016 at 08:50:27AM +0800, Huawei Xie wrote:
>> -int virtio_dev_queue_setup(struct rte_eth_dev *dev,
>> -			int queue_type,
>> -			uint16_t queue_idx,
>> +static int
>> +virtio_dev_cq_queue_setup(struct rte_eth_dev *dev,
> While it's good to split Rx/Tx specific stuff, but why are you trying to
> remove a common queue_setup function that does common setups, such as vring
> memory allocation.
>
> This results to much duplicated code: following diff summary also shows
> it clearly:

The motivation to do this is we need separate RX/TX queue setup.
The switch/case in the common queue setup looks bad.

I am aware of the common operations, and i had planned to extract them,
maybe i could do this in this patchset.


>
>     7 files changed, 655 insertions(+), 422 deletions(-)
>
> which makes it harder for maintaining.
>
>> -}
>> +	rxvq = (struct virtnet_rx *)RTE_PTR_ADD(vq,
>> +			sizeof(*vq) + vq_size * sizeof(struct vq_desc_extra));
>> +	rxvq->vq = vq;
>> +	vq->sw_ring = sw_ring;
> sw_ring is needed for rx queue only, why not moving it to rx queue struct?

Actually this is not about sw_ring.
I had planned to use sw_ring for both RX/TX and remove the vq_desc_extra.
Two issues
1. RX uses both sw_ring and vq_desc_extra
2. ndescs in vq_desc_extra isn't really needed, we could simply
calculate this when we walk through the desc chain, and in most cases,
it is 1 or 2.

As it is not related to this rework, will do this in a separate patch.

>
>>  static void
>> -virtio_update_packet_stats(struct virtqueue *vq, struct rte_mbuf *mbuf)
>> +virtio_update_rxq_stats(struct virtnet_rx *rxvq, struct rte_mbuf *mbuf)
>>  {
>>  	uint32_t s = mbuf->pkt_len;
>>  	struct ether_addr *ea;
>>  
>>  	if (s == 64) {
>> -		vq->size_bins[1]++;
>> +		rxvq->stats.size_bins[1]++;
>>  	} else if (s > 64 && s < 1024) {
>>  		uint32_t bin;
>>  
>>  		/* count zeros, and offset into correct bin */
>>  		bin = (sizeof(s) * 8) - __builtin_clz(s) - 5;
>> -		vq->size_bins[bin]++;
>> +		rxvq->stats.size_bins[bin]++;
>>  	} else {
>>  		if (s < 64)
>> -			vq->size_bins[0]++;
>> +			rxvq->stats.size_bins[0]++;
>>  		else if (s < 1519)
>> -			vq->size_bins[6]++;
>> +			rxvq->stats.size_bins[6]++;
>>  		else if (s >= 1519)
>> -			vq->size_bins[7]++;
>> +			rxvq->stats.size_bins[7]++;
>>  	}
>>  
>>  	ea = rte_pktmbuf_mtod(mbuf, struct ether_addr *);
>>  	if (is_multicast_ether_addr(ea)) {
>>  		if (is_broadcast_ether_addr(ea))
>> -			vq->broadcast++;
>> +			rxvq->stats.broadcast++;
>>  		else
>> -			vq->multicast++;
>> +			rxvq->stats.multicast++;
>> +	}
>> +}
>> +
>> +static void
>> +virtio_update_txq_stats(struct virtnet_tx *txvq, struct rte_mbuf *mbuf)
> Why not taking "struct virtnet_stats *stats" as the arg, so that we
> don't have to implment two exactly same functions.

ok to me.

>
>> diff --git a/drivers/net/virtio/virtio_rxtx.h b/drivers/net/virtio/virtio_rxtx.h
>> index a76c3e5..ced55a3 100644
>> --- a/drivers/net/virtio/virtio_rxtx.h
>> +++ b/drivers/net/virtio/virtio_rxtx.h
>> @@ -34,7 +34,59 @@
>>  #define RTE_PMD_VIRTIO_RX_MAX_BURST 64
>>  
>>  #ifdef RTE_MACHINE_CPUFLAG_SSSE3
>> -int virtio_rxq_vec_setup(struct virtqueue *rxq);
>> +
>> +struct virtnet_stats {
> Another remind again: you should put following codes before the
> "#ifdef".
>
> 	--yliu
>


  reply	other threads:[~2016-05-05  1:54 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 [this message]
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
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=C37D651A908B024F974696C65296B57B4C74C637@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).