[dpdk-dev] [PATCH v1 29/42] net/txgbe: add queue stats mapping and enable RX DMA unit

Ferruh Yigit ferruh.yigit at intel.com
Wed Sep 9 19:54:26 CEST 2020


On 9/1/2020 12:51 PM, Jiawen Wu wrote:
> Add queue stats mapping set, complete receive and transmit unit with DMA and sec path.
> 
> Signed-off-by: Jiawen Wu <jiawenwu at trustnetic.com>

<...>

> +static int
> +txgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
> +				  uint16_t queue_id,
> +				  uint8_t stat_idx,
> +				  uint8_t is_rx)
> +{
> +	struct txgbe_hw *hw = TXGBE_DEV_HW(eth_dev);
> +	struct txgbe_stat_mappings *stat_mappings =
> +		TXGBE_DEV_STAT_MAPPINGS(eth_dev);
> +	uint32_t qsmr_mask = 0;
> +	uint32_t clearing_mask = QMAP_FIELD_RESERVED_BITS_MASK;
> +	uint32_t q_map;
> +	uint8_t n, offset;
> +
> +	if (hw->mac.type != txgbe_mac_raptor)
> +		return -ENOSYS;
> +
> +	PMD_INIT_LOG(DEBUG, "Setting port %d, %s queue_id %d to stat index %d",
> +		     (int)(eth_dev->data->port_id), is_rx ? "RX" : "TX",
> +		     queue_id, stat_idx);
> +
> +	n = (uint8_t)(queue_id / NB_QMAP_FIELDS_PER_QSM_REG);
> +	if (n >= TXGBE_NB_STAT_MAPPING) {
> +		PMD_INIT_LOG(ERR, "Nb of stat mapping registers exceeded");
> +		return -EIO;
> +	}
> +	offset = (uint8_t)(queue_id % NB_QMAP_FIELDS_PER_QSM_REG);
> +
> +	/* Now clear any previous stat_idx set */
> +	clearing_mask <<= (QSM_REG_NB_BITS_PER_QMAP_FIELD * offset);
> +	if (!is_rx)
> +		stat_mappings->tqsm[n] &= ~clearing_mask;
> +	else
> +		stat_mappings->rqsm[n] &= ~clearing_mask;
> +
> +	q_map = (uint32_t)stat_idx;
> +	q_map &= QMAP_FIELD_RESERVED_BITS_MASK;

A check for "'stat_idx' > QMAP_FIELD_RESERVED_BITS_MASK" can be good, although
it is masked out, it will give different stat than user requested.



More information about the dev mailing list