[PATCH v6 3/8] net/gve: add support for device initialization

Ferruh Yigit ferruh.yigit at amd.com
Thu Oct 20 16:42:19 CEST 2022


On 10/20/2022 11:36 AM, Junfeng Guo wrote:

> 
> Support device init and add following devops skeleton:
>   - dev_configure
>   - dev_start
>   - dev_stop
>   - dev_close
> 
> Note that build system (including doc) is also added in this patch.
> 
> Signed-off-by: Haiyue Wang <haiyue.wang at intel.com>
> Signed-off-by: Xiaoyun Li <xiaoyun.li at intel.com>
> Signed-off-by: Junfeng Guo <junfeng.guo at intel.com>

<...>

> index 1c3daf141d..715013fa35 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -140,6 +140,11 @@ New Features
> 
>     * Made compatible with libbpf v0.8.0 (when used with libxdp).
> 
> +* **Added GVE net PMD**
> +
> +  * Added the new ``gve`` net driver for Google Virtual Ethernet devices.
> +  * See the :doc:`../nics/gve` NIC guide for more details on this new driver.
> +

Can you please move it one more down, just above 'Intel', to sort it 
alphabetically based on Vendor name, in this case 'G' I guess.
We are almost there :)

<...>

> +static int
> +gve_dev_init(struct rte_eth_dev *eth_dev)
> +{
> +       struct gve_priv *priv = eth_dev->data->dev_private;
> +       int max_tx_queues, max_rx_queues;
> +       struct rte_pci_device *pci_dev;
> +       struct gve_registers *reg_bar;
> +       rte_be32_t *db_bar;
> +       int err;
> +
> +       eth_dev->dev_ops = &gve_eth_dev_ops;
> +
> +       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> +               return 0;
> +
> +       pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
> +
> +       reg_bar = pci_dev->mem_resource[GVE_REG_BAR].addr;
> +       if (!reg_bar) {
> +               PMD_DRV_LOG(ERR, "Failed to map pci bar!");
> +               return -ENOMEM;
> +       }
> +
> +       db_bar = pci_dev->mem_resource[GVE_DB_BAR].addr;
> +       if (!db_bar) {
> +               PMD_DRV_LOG(ERR, "Failed to map doorbell bar!");
> +               return -ENOMEM;
> +       }
> +
> +       gve_write_version(&reg_bar->driver_version);
> +       /* Get max queues to alloc etherdev */
> +       max_tx_queues = ioread32be(&reg_bar->max_tx_queues);
> +       max_rx_queues = ioread32be(&reg_bar->max_rx_queues);
> +
> +       priv->reg_bar0 = reg_bar;
> +       priv->db_bar2 = db_bar;
> +       priv->pci_dev = pci_dev;
> +       priv->state_flags = 0x0;
> +
> +       priv->max_nb_txq = max_tx_queues;
> +       priv->max_nb_rxq = max_rx_queues;
> +
> +       err = gve_init_priv(priv, false);
> +       if (err)
> +               return err;
> +
> +       eth_dev->data->mac_addrs = rte_zmalloc("gve_mac", sizeof(struct rte_ether_addr), 0);
> +       if (!eth_dev->data->mac_addrs) {
> +               PMD_DRV_LOG(ERR, "Failed to allocate memory to store mac address");
> +               return -ENOMEM;
> +       }
> +       rte_ether_addr_copy(&priv->dev_addr, eth_dev->data->mac_addrs);
> +

What is the value in 'priv->dev_addr'?
Even allocating memory for 'eth_dev->data->mac_addrs' removed or not, as 
we discussed, independent from it, need to set a valid value to 
'priv->dev_addr'.

<...>

> diff --git a/drivers/net/gve/version.map b/drivers/net/gve/version.map
> new file mode 100644
> index 0000000000..c2e0723b4c
> --- /dev/null
> +++ b/drivers/net/gve/version.map
> @@ -0,0 +1,3 @@
> +DPDK_22 {

DPDK_23

In case it is not clear, since this comment skipped in previous a few 
versions, the ABI version should be 'DPDK_23', so the content of this 
file should be;

DPDK_23 {
         local: *;
};



More information about the dev mailing list