[dpdk-dev] [PATCH v4 2/4] raw/ntb: add xstats support

Wu, Jingjing jingjing.wu at intel.com
Mon Sep 23 05:30:27 CEST 2019


>  static int
> -ntb_xstats_reset(struct rte_rawdev *dev __rte_unused,
> -		 const uint32_t ids[] __rte_unused,
> -		 uint32_t nb_ids __rte_unused)
> +ntb_xstats_reset(struct rte_rawdev *dev,
> +		 const uint32_t ids[],
> +		 uint32_t nb_ids)
>  {
> -	return 0;
> -}
> +	struct ntb_hw *hw = dev->dev_private;
> +	uint32_t i, xstats_num;
> 
> +	xstats_num = NTB_XSTATS_NUM * (hw->queue_pairs + 1);
> +	for (i = 0; i < nb_ids && ids[i] < xstats_num; i++)
> +		hw->ntb_xstats[ids[i]] = 0;
> +
As there is no lock for the xstats, the enqueue and dequeuer thread are updating the value. It will cause competition.
Suggest to save the ntx_xstats, and update the value when enqueue and dequeuer are updating.

Thanks
Jingjing


More information about the dev mailing list