[dpdk-dev] [PATCH v7 1/2] net/vhost: add a new defined stats struct
Yuanhan Liu
yuanhan.liu at linux.intel.com
Thu Sep 29 03:55:12 CEST 2016
On Wed, Sep 28, 2016 at 09:26:47PM +0800, Zhiyong Yang wrote:
> The patch moves all stats counters to a new defined struct vhost_stats
> as follows, in order to manage all stats counters in a unified way and
> simplify the subsequent function implementation(vhost_dev_xstats_reset).
>
> Signed-off-by: Zhiyong Yang <zhiyong.yang at intel.com>
> ---
>
> Changes in v4:
> A queue can be only used as TX or RX, So, we can use pkts instead of
> rx_pkts and tx_pkts, the same to rx_bytes and tx_bytes.
> before modification:
> struct vhost_stats {
> uint64_t rx_pkts;
> uint64_t tx_pkts;
> uint64_t missed_pkts;
> uint64_t rx_bytes;
> uint64_t tx_bytes;
> };
> New struct vhost_stats definition as follows:
> struct vhost_stats {
> uint64_t pkts;
> uint64_t bytes;
> uint64_t missed_pkts;
> };
>
> drivers/net/vhost/rte_eth_vhost.c | 36 +++++++++++++++++++++---------------
> 1 file changed, 21 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index 7539cd4..d99d4ee 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -72,6 +72,12 @@ static struct ether_addr base_eth_addr = {
> }
> };
>
> +struct vhost_stats {
> + uint64_t pkts;
> + uint64_t bytes;
> + uint64_t missed_pkts;
> +};
> +
> struct vhost_queue {
> int vid;
> rte_atomic32_t allow_queuing;
> @@ -145,11 +151,11 @@ eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
> nb_rx = rte_vhost_dequeue_burst(r->vid,
> r->virtqueue_id, r->mb_pool, bufs, nb_bufs);
>
> - r->rx_pkts += nb_rx;
> + r->stats.pkts += nb_rx;
My robot caught a build error:
/yeti/vm/ubuntu-initrd-16.04-x86_64-build/dpdk/drivers/net/vhost/rte_eth_vhost.c:154:5:
error: no member named 'stats' in 'struct vhost_queue'
r->stats.pkts += nb_rx;
~ ^
--yliu
More information about the dev
mailing list