[v1 02/12] net/enetc: Add RX and TX queue APIs for ENETC4 PMD

Stephen Hemminger stephen at networkplumber.org
Wed Oct 15 23:42:18 CEST 2025


On Thu,  9 Oct 2025 16:46:23 +0530
vanshika.shukla at nxp.com wrote:

> +int
> +enetc4_tx_queue_setup(struct rte_eth_dev *dev,
> +		     uint16_t queue_idx,
> +		     uint16_t nb_desc,
> +		     unsigned int socket_id __rte_unused,
> +		     const struct rte_eth_txconf *tx_conf)
> +{
> +	int err = 0;
> +	struct enetc_bdr *tx_ring;
> +	struct rte_eth_dev_data *data = dev->data;
> +	struct enetc_eth_adapter *priv =
> +			ENETC_DEV_PRIVATE(data->dev_private);
> +
> +	PMD_INIT_FUNC_TRACE();
> +	if (nb_desc > MAX_BD_COUNT)
> +		return -1;
> +
> +	tx_ring = rte_zmalloc(NULL, sizeof(struct enetc_bdr), 0);
> +	if (tx_ring == NULL) {
> +		ENETC_PMD_ERR("Failed to allocate TX ring memory");
> +		err = -ENOMEM;
> +		return -1;
> +	}
> +
> +	tx_ring->index = queue_idx;
> +	err = enetc4_alloc_txbdr(tx_ring, nb_desc);
> +	if (err)
> +		goto fail;
> +
> +	tx_ring->ndev = dev;
> +	enetc4_setup_txbdr(&priv->hw.hw, tx_ring);
> +	data->tx_queues[queue_idx] = tx_ring;
> +	if (!tx_conf->tx_deferred_start) {
> +		/* enable ring */
> +		enetc4_txbdr_wr(&priv->hw.hw, tx_ring->index,
> +			       ENETC_TBMR, ENETC_TBMR_EN);
> +		dev->data->tx_queue_state[tx_ring->index] =
> +			       RTE_ETH_QUEUE_STATE_STARTED;
> +	} else {
> +		dev->data->tx_queue_state[tx_ring->index] =
> +			       RTE_ETH_QUEUE_STATE_STOPPED;
> +	}
> +

Max line length is now 100 so could be on one line here.


More information about the dev mailing list