X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnx2x%2Fbnx2x_ethdev.c;h=a3c6c01b404fe851179dfb0eeedda9e98ec2bb16;hb=09419f235e099ecb265a590778fe64a685a2a241;hp=69df02e4d22d1fec0d26d38b36e474d777e57604;hpb=99d47f445eb0d83e642d121119d3293b5a7f9e9d;p=dpdk.git diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 69df02e4d2..a3c6c01b40 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -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; } @@ -286,7 +266,7 @@ bnx2xvf_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_comple if (sc->old_bulletin.valid_bitmap & (1 << CHANNEL_DOWN)) { PMD_DRV_LOG(ERR, "PF indicated channel is down." "VF device is no longer operational"); - dev->data->dev_link.link_status = 0; + dev->data->dev_link.link_status = ETH_LINK_DOWN; } return old_link_status == dev->data->dev_link.link_status ? -1 : 0; @@ -368,7 +348,7 @@ bnx2x_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) sc->mac_ops.mac_addr_remove(dev, index); } -static struct eth_dev_ops bnx2x_eth_dev_ops = { +static const struct eth_dev_ops bnx2x_eth_dev_ops = { .dev_configure = bnx2x_dev_configure, .dev_start = bnx2x_dev_start, .dev_stop = bnx2x_dev_stop, @@ -391,7 +371,7 @@ static struct eth_dev_ops bnx2x_eth_dev_ops = { /* * dev_ops for virtual function */ -static struct eth_dev_ops bnx2xvf_eth_dev_ops = { +static const struct eth_dev_ops bnx2xvf_eth_dev_ops = { .dev_configure = bnx2x_dev_configure, .dev_start = bnx2x_dev_start, .dev_stop = bnx2x_dev_stop, @@ -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