1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Chelsio Communications.
6 #include <rte_ethdev_driver.h>
7 #include <rte_ethdev_pci.h>
10 #include "cxgbe_pfvf.h"
13 * Macros needed to support the PCI Device ID Table ...
15 #define CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN \
16 static const struct rte_pci_id cxgb4vf_pci_tbl[] = {
17 #define CH_PCI_DEVICE_ID_FUNCTION 0x8
19 #define PCI_VENDOR_ID_CHELSIO 0x1425
21 #define CH_PCI_ID_TABLE_ENTRY(devid) \
22 { RTE_PCI_DEVICE(PCI_VENDOR_ID_CHELSIO, (devid)) }
24 #define CH_PCI_DEVICE_ID_TABLE_DEFINE_END \
29 *... and the PCI ID Table itself ...
31 #include "t4_pci_id_tbl.h"
33 static const struct eth_dev_ops cxgbevf_eth_dev_ops = {
34 .dev_start = cxgbe_dev_start,
35 .dev_stop = cxgbe_dev_stop,
36 .dev_close = cxgbe_dev_close,
37 .promiscuous_enable = cxgbe_dev_promiscuous_enable,
38 .promiscuous_disable = cxgbe_dev_promiscuous_disable,
39 .allmulticast_enable = cxgbe_dev_allmulticast_enable,
40 .allmulticast_disable = cxgbe_dev_allmulticast_disable,
41 .dev_configure = cxgbe_dev_configure,
42 .dev_infos_get = cxgbe_dev_info_get,
43 .dev_supported_ptypes_get = cxgbe_dev_supported_ptypes_get,
44 .link_update = cxgbe_dev_link_update,
45 .mtu_set = cxgbe_dev_mtu_set,
46 .tx_queue_setup = cxgbe_dev_tx_queue_setup,
47 .tx_queue_start = cxgbe_dev_tx_queue_start,
48 .tx_queue_stop = cxgbe_dev_tx_queue_stop,
49 .tx_queue_release = cxgbe_dev_tx_queue_release,
50 .rx_queue_setup = cxgbe_dev_rx_queue_setup,
51 .rx_queue_start = cxgbe_dev_rx_queue_start,
52 .rx_queue_stop = cxgbe_dev_rx_queue_stop,
53 .rx_queue_release = cxgbe_dev_rx_queue_release,
58 * It returns 0 on success.
60 static int eth_cxgbevf_dev_init(struct rte_eth_dev *eth_dev)
64 eth_dev->dev_ops = &cxgbevf_eth_dev_ops;
70 static int eth_cxgbevf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
71 struct rte_pci_device *pci_dev)
73 return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct port_info),
74 eth_cxgbevf_dev_init);
77 static int eth_cxgbevf_pci_remove(struct rte_pci_device *pci_dev)
79 return rte_eth_dev_pci_generic_remove(pci_dev, NULL);
82 static struct rte_pci_driver rte_cxgbevf_pmd = {
83 .id_table = cxgb4vf_pci_tbl,
84 .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
85 .probe = eth_cxgbevf_pci_probe,
86 .remove = eth_cxgbevf_pci_remove,
89 RTE_PMD_REGISTER_PCI(net_cxgbevf, rte_cxgbevf_pmd);
90 RTE_PMD_REGISTER_PCI_TABLE(net_cxgbevf, cxgb4vf_pci_tbl);
91 RTE_PMD_REGISTER_KMOD_DEP(net_cxgbevf, "* igb_uio | vfio-pci");