i40e/base: fix proxy for X722
[dpdk.git] / drivers / net / bnx2x / bnx2x_ethdev.c
index 0117049..fe8cfd0 100644 (file)
@@ -87,7 +87,6 @@ bnx2x_dev_configure(struct rte_eth_dev *dev)
 {
        struct bnx2x_softc *sc = dev->data->dev_private;
        int mp_ncpus = sysconf(_SC_NPROCESSORS_CONF);
-       int ret;
 
        PMD_INIT_FUNC_TRACE();
 
@@ -121,25 +120,6 @@ bnx2x_dev_configure(struct rte_eth_dev *dev)
                return -ENXIO;
        }
 
-       if (IS_VF(sc)) {
-               if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_mbx_msg),
-                                 &sc->vf2pf_mbox_mapping, "vf2pf_mbox",
-                                 RTE_CACHE_LINE_SIZE) != 0)
-                       return -ENOMEM;
-
-               sc->vf2pf_mbox = (struct bnx2x_vf_mbx_msg *)sc->vf2pf_mbox_mapping.vaddr;
-               if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_bulletin),
-                                 &sc->pf2vf_bulletin_mapping, "vf2pf_bull",
-                                 RTE_CACHE_LINE_SIZE) != 0)
-                       return -ENOMEM;
-
-               sc->pf2vf_bulletin = (struct bnx2x_vf_bulletin *)sc->pf2vf_bulletin_mapping.vaddr;
-
-               ret = bnx2x_vf_get_resources(sc, sc->num_queues, sc->num_queues);
-               if (ret)
-                       return ret;
-       }
-
        return 0;
 }
 
@@ -442,7 +422,7 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf)
        sc->bar[BAR0].base_addr = (void *)pci_dev->mem_resource[0].addr;
        if (is_vf)
                sc->bar[BAR1].base_addr = (void *)
-                       ((uint64_t)pci_dev->mem_resource[0].addr + PXP_VF_ADDR_DB_START);
+                       ((uintptr_t)pci_dev->mem_resource[0].addr + PXP_VF_ADDR_DB_START);
        else
                sc->bar[BAR1].base_addr = pci_dev->mem_resource[2].addr;
 
@@ -466,6 +446,7 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf)
        ret = bnx2x_attach(sc);
        if (ret) {
                PMD_DRV_LOG(ERR, "bnx2x_attach failed (%d)", ret);
+               return ret;
        }
 
        eth_dev->data->mac_addrs = (struct ether_addr *)sc->link_params.mac_addr;
@@ -479,7 +460,30 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf)
        PMD_DRV_LOG(INFO, "portID=%d vendorID=0x%x deviceID=0x%x",
                        eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id);
 
-       return ret;
+       if (IS_VF(sc)) {
+               if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_mbx_msg),
+                                   &sc->vf2pf_mbox_mapping, "vf2pf_mbox",
+                                   RTE_CACHE_LINE_SIZE) != 0)
+                       return -ENOMEM;
+
+               sc->vf2pf_mbox = (struct bnx2x_vf_mbx_msg *)
+                                        sc->vf2pf_mbox_mapping.vaddr;
+
+               if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_bulletin),
+                                   &sc->pf2vf_bulletin_mapping, "vf2pf_bull",
+                                   RTE_CACHE_LINE_SIZE) != 0)
+                       return -ENOMEM;
+
+               sc->pf2vf_bulletin = (struct bnx2x_vf_bulletin *)
+                                            sc->pf2vf_bulletin_mapping.vaddr;
+
+               ret = bnx2x_vf_get_resources(sc, sc->max_tx_queues,
+                                            sc->max_rx_queues);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
 }
 
 static int