drivers/net: add generic ethdev macro to get PCI device
[dpdk.git] / drivers / net / bnxt / bnxt_ethdev.c
index 7805221..9e87c65 100644 (file)
@@ -338,7 +338,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
        struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
        uint16_t max_vnics, i, j, vpool, vrxq;
 
-       dev_info->pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
+       dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
        /* MAC Specifics */
        dev_info->max_mac_addrs = MAX_NUM_MAC_ADDR;
@@ -618,9 +618,9 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev,
        }
 }
 
-static void bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev,
-                                struct ether_addr *mac_addr,
-                                uint32_t index, uint32_t pool)
+static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev,
+                               struct ether_addr *mac_addr,
+                               uint32_t index, uint32_t pool)
 {
        struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
        struct bnxt_vnic_info *vnic = STAILQ_FIRST(&bp->ff_pool[pool]);
@@ -628,30 +628,30 @@ static void bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev,
 
        if (BNXT_VF(bp)) {
                RTE_LOG(ERR, PMD, "Cannot add MAC address to a VF interface\n");
-               return;
+               return -ENOTSUP;
        }
 
        if (!vnic) {
                RTE_LOG(ERR, PMD, "VNIC not found for pool %d!\n", pool);
-               return;
+               return -EINVAL;
        }
        /* Attach requested MAC address to the new l2_filter */
        STAILQ_FOREACH(filter, &vnic->filter, next) {
                if (filter->mac_index == index) {
                        RTE_LOG(ERR, PMD,
                                "MAC addr already existed for pool %d\n", pool);
-                       return;
+                       return -EINVAL;
                }
        }
        filter = bnxt_alloc_filter(bp);
        if (!filter) {
                RTE_LOG(ERR, PMD, "L2 filter alloc failed\n");
-               return;
+               return -ENODEV;
        }
        STAILQ_INSERT_TAIL(&vnic->filter, filter, next);
        filter->mac_index = index;
        memcpy(filter->l2_addr, mac_addr, ETHER_ADDR_LEN);
-       bnxt_hwrm_set_filter(bp, vnic, filter);
+       return bnxt_hwrm_set_filter(bp, vnic, filter);
 }
 
 int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
@@ -918,7 +918,7 @@ static int bnxt_rss_hash_conf_get_op(struct rte_eth_dev *eth_dev,
 }
 
 static int bnxt_flow_ctrl_get_op(struct rte_eth_dev *dev,
-                              struct rte_eth_fc_conf *fc_conf __rte_unused)
+                              struct rte_eth_fc_conf *fc_conf)
 {
        struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
        struct rte_eth_link link_info;
@@ -1049,7 +1049,7 @@ static bool bnxt_vf_pciid(uint16_t id)
 static int bnxt_init_board(struct rte_eth_dev *eth_dev)
 {
        struct bnxt *bp = eth_dev->data->dev_private;
-       struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
+       struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
        int rc;
 
        /* enable device (incl. PCI PM wakeup), and bus-mastering */
@@ -1085,7 +1085,7 @@ static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev);
 static int
 bnxt_dev_init(struct rte_eth_dev *eth_dev)
 {
-       struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
+       struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
        static int version_printed;
        struct bnxt *bp;
        int rc;
@@ -1225,4 +1225,4 @@ static struct rte_pci_driver bnxt_rte_pmd = {
 
 RTE_PMD_REGISTER_PCI(net_bnxt, bnxt_rte_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_bnxt, bnxt_pci_id_map);
-RTE_PMD_REGISTER_KMOD_DEP(net_bnxt, "* igb_uio | uio_pci_generic | vfio");
+RTE_PMD_REGISTER_KMOD_DEP(net_bnxt, "* igb_uio | uio_pci_generic | vfio-pci");