[PATCH v1 16/25] net/spnic: add device configure/version/info

Stephen Hemminger stephen at networkplumber.org
Mon Dec 20 01:23:56 CET 2021


On Sat, 18 Dec 2021 10:51:43 +0800
Yanling Song <songyl at ramaxel.com> wrote:

> +static int spnic_dev_configure(struct rte_eth_dev *dev)
> +{
> +	struct spnic_nic_dev *nic_dev = SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
> +
> +	nic_dev->num_sqs =  dev->data->nb_tx_queues;
> +	nic_dev->num_rqs = dev->data->nb_rx_queues;
> +
> +	if (nic_dev->num_sqs > nic_dev->max_sqs ||
> +	    nic_dev->num_rqs > nic_dev->max_rqs) {
> +		PMD_DRV_LOG(ERR, "num_sqs: %d or num_rqs: %d larger than max_sqs: %d or max_rqs: %d",
> +			    nic_dev->num_sqs, nic_dev->num_rqs,
> +			    nic_dev->max_sqs, nic_dev->max_rqs);
> +		return -EINVAL;
> +	}
> +

This should already be covered by checks in ethedev:dev_configure.

> +	/* The range of mtu is 384~9600 */
> +	if (SPNIC_MTU_TO_PKTLEN(dev->data->dev_conf.rxmode.mtu) <
> +	    SPNIC_MIN_FRAME_SIZE ||
> +	    SPNIC_MTU_TO_PKTLEN(dev->data->dev_conf.rxmode.mtu) >
> +	    SPNIC_MAX_JUMBO_FRAME_SIZE) {
> +		PMD_DRV_LOG(ERR, "Max rx pkt len out of range, mtu: %d, expect between %d and %d",
> +			    dev->data->dev_conf.rxmode.mtu,
> +			    SPNIC_MIN_FRAME_SIZE, SPNIC_MAX_JUMBO_FRAME_SIZE);
> +		return -EINVAL;
> +	}

Already covered by eth_dev_validate_mtu called from ethdev dev_configure.



More information about the dev mailing list