[PATCH v3 02/16] net/nbl: add simple probe/remove and log module

Stephen Hemminger stephen at networkplumber.org
Wed Aug 20 21:51:28 CEST 2025


On Thu, 26 Jun 2025 18:40:08 -0700
"dimon.zhao" <dimon.zhao at nebula-matrix.com> wrote:

> +
> +static int nbl_eth_dev_init(struct rte_eth_dev *eth_dev)
> +{
> +	const struct nbl_adapter *adapter = ETH_DEV_TO_NBL_DEV_PF_PRIV(eth_dev);
> +	int ret;
> +
> +	PMD_INIT_FUNC_TRACE();
> +	ret = nbl_core_init(adapter, eth_dev);
> +	if (ret) {
> +		NBL_LOG(INFO, "core init failed ret %d", ret);
> +		goto eth_init_failed;
> +	}
> +
> +	ret = nbl_core_start(adapter);
> +	if (ret) {
> +		NBL_LOG(INFO, "core start failed ret %d", ret);
> +		nbl_core_remove(adapter);
> +		goto eth_init_failed;
> +	}
> +
> +	eth_dev->dev_ops = &nbl_eth_dev_ops;
> +	return 0;
> +
> +eth_init_failed:
> +	return ret;
> +}
> +
> +/**
> + * @brief: nbl device pci probe
> + * @param[in]: {rte_pci_driver} *pci_drv
> + * @param[in]: {rte_pci_device} *pci_dev
> + * @return: {0-success,negative-fail}
> + */
> +static int nbl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
> +			 struct rte_pci_device *pci_dev)
> +{
> +	return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct nbl_adapter),
> +					     nbl_eth_dev_init);
> +}
> +

Since device doesn't support secondary process, it would make sense to
detect that in probe handling and return error in secondary.


More information about the dev mailing list