DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Huawei Xie <huawei.xie@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] virtio: split virtio rx/tx queue
Date: Wed, 4 May 2016 17:03:27 -0700	[thread overview]
Message-ID: <20160505000327.GT5641@yliu-dev.sh.intel.com> (raw)
In-Reply-To: <1462323027-91942-1-git-send-email-huawei.xie@intel.com>

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:

    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?

>  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.


> 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-04 23:59 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 [this message]
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
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=20160505000327.GT5641@yliu-dev.sh.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@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).