efd88d8de8b3e8cddf19eb87d0849725a3bc8d81
[dpdk.git] / drivers / net / octeontx_ep / otx_ep_ethdev.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4
5 #include <ethdev_pci.h>
6
7 #include "otx2_common.h"
8 #include "otx_ep_common.h"
9 #include "otx_ep_vf.h"
10
11 static int
12 otx_ep_eth_dev_uninit(struct rte_eth_dev *eth_dev)
13 {
14         RTE_SET_USED(eth_dev);
15
16         return -ENODEV;
17 }
18
19 static int
20 otx_ep_eth_dev_init(struct rte_eth_dev *eth_dev)
21 {
22         RTE_SET_USED(eth_dev);
23
24         return -ENODEV;
25 }
26
27 static int
28 otx_ep_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
29                       struct rte_pci_device *pci_dev)
30 {
31         return rte_eth_dev_pci_generic_probe(pci_dev,
32                                              sizeof(struct otx_ep_device),
33                                              otx_ep_eth_dev_init);
34 }
35
36 static int
37 otx_ep_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
38 {
39         return rte_eth_dev_pci_generic_remove(pci_dev,
40                                               otx_ep_eth_dev_uninit);
41 }
42
43 /* Set of PCI devices this driver supports */
44 static const struct rte_pci_id pci_id_otx_ep_map[] = {
45         { RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVID_OCTEONTX_EP_VF) },
46         { RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVID_OCTEONTX2_EP_NET_VF) },
47         { RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVID_CN98XX_EP_NET_VF) },
48         { .vendor_id = 0, /* sentinel */ }
49 };
50
51 static struct rte_pci_driver rte_otx_ep_pmd = {
52         .id_table       = pci_id_otx_ep_map,
53         .drv_flags      = RTE_PCI_DRV_NEED_MAPPING,
54         .probe          = otx_ep_eth_dev_pci_probe,
55         .remove         = otx_ep_eth_dev_pci_remove,
56 };
57
58 RTE_PMD_REGISTER_PCI(net_otx_ep, rte_otx_ep_pmd);
59 RTE_PMD_REGISTER_PCI_TABLE(net_otx_ep, pci_id_otx_ep_map);
60 RTE_PMD_REGISTER_KMOD_DEP(net_otx_ep, "* igb_uio | vfio-pci");