[PATCH v5 04/32] net/sssnic: initialize hardware base

Stephen Hemminger stephen at networkplumber.org
Mon Sep 18 04:28:55 CEST 2023


On Mon, 4 Sep 2023 12:56:30 +0800
<wanry at 3snic.com> wrote:

>  static int
>  sssnic_ethdev_init(struct rte_eth_dev *ethdev)
>  {
> -	RTE_SET_USED(ethdev);
> +	int ret;
> +	struct sssnic_hw *hw;
> +	struct sssnic_netdev *netdev;
> +	struct rte_pci_device *pci_dev;
> +
>  	PMD_INIT_FUNC_TRACE();
>  
> -	return -EINVAL;
> +	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> +		return 0;
> +
> +	netdev = SSSNIC_ETHDEV_PRIVATE(ethdev);
> +	pci_dev = RTE_ETH_DEV_TO_PCI(ethdev);
> +	hw = rte_zmalloc("sssnic_hw", sizeof(struct sssnic_hw), 0);

For performance you might want to use rte_zmalloc_socket() to make sure
the hw structure is on the same NUMA node as PCI device.



More information about the dev mailing list