1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Aquantia Corporation
5 #include <rte_ethdev_pci.h>
7 #include "atl_ethdev.h"
8 #include "atl_common.h"
10 static int eth_atl_dev_init(struct rte_eth_dev *eth_dev);
11 static int eth_atl_dev_uninit(struct rte_eth_dev *eth_dev);
13 static int atl_dev_configure(struct rte_eth_dev *dev);
14 static int atl_dev_start(struct rte_eth_dev *dev);
15 static void atl_dev_stop(struct rte_eth_dev *dev);
16 static void atl_dev_close(struct rte_eth_dev *dev);
17 static int atl_dev_reset(struct rte_eth_dev *dev);
19 static int eth_atl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
20 struct rte_pci_device *pci_dev);
21 static int eth_atl_pci_remove(struct rte_pci_device *pci_dev);
23 static void atl_dev_info_get(struct rte_eth_dev *dev,
24 struct rte_eth_dev_info *dev_info);
27 * The set of PCI devices this driver supports
29 static const struct rte_pci_id pci_id_atl_map[] = {
30 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_0001) },
31 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D100) },
32 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D107) },
33 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D108) },
34 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D109) },
36 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC100) },
37 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC107) },
38 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC108) },
39 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC109) },
40 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC111) },
41 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC112) },
43 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC100S) },
44 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC107S) },
45 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC108S) },
46 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC109S) },
47 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC111S) },
48 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC112S) },
50 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC111E) },
51 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC112E) },
52 { .vendor_id = 0, /* sentinel */ },
55 static struct rte_pci_driver rte_atl_pmd = {
56 .id_table = pci_id_atl_map,
57 .drv_flags = RTE_PCI_DRV_NEED_MAPPING |
58 RTE_PCI_DRV_IOVA_AS_VA,
59 .probe = eth_atl_pci_probe,
60 .remove = eth_atl_pci_remove,
63 static const struct eth_dev_ops atl_eth_dev_ops = {
64 .dev_configure = atl_dev_configure,
65 .dev_start = atl_dev_start,
66 .dev_stop = atl_dev_stop,
67 .dev_close = atl_dev_close,
68 .dev_reset = atl_dev_reset,
69 .dev_infos_get = atl_dev_info_get,
73 eth_atl_dev_init(struct rte_eth_dev *eth_dev)
75 eth_dev->dev_ops = &atl_eth_dev_ops;
77 /* Allocate memory for storing MAC addresses */
78 eth_dev->data->mac_addrs = rte_zmalloc("atlantic", ETHER_ADDR_LEN, 0);
79 if (eth_dev->data->mac_addrs == NULL)
86 eth_atl_dev_uninit(struct rte_eth_dev *eth_dev)
88 rte_free(eth_dev->data->mac_addrs);
94 eth_atl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
95 struct rte_pci_device *pci_dev)
97 return rte_eth_dev_pci_generic_probe(pci_dev,
98 sizeof(struct atl_adapter), eth_atl_dev_init);
102 eth_atl_pci_remove(struct rte_pci_device *pci_dev)
104 return rte_eth_dev_pci_generic_remove(pci_dev, eth_atl_dev_uninit);
108 atl_dev_configure(struct rte_eth_dev *dev __rte_unused)
114 * Configure device link speed and setup link.
115 * It returns 0 on success.
118 atl_dev_start(struct rte_eth_dev *dev __rte_unused)
124 * Stop device: disable rx and tx functions to allow for reconfiguring.
127 atl_dev_stop(struct rte_eth_dev *dev __rte_unused)
132 * Reset and stop device.
135 atl_dev_close(struct rte_eth_dev *dev __rte_unused)
140 atl_dev_reset(struct rte_eth_dev *dev)
144 ret = eth_atl_dev_uninit(dev);
148 ret = eth_atl_dev_init(dev);
154 atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
156 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
158 dev_info->max_rx_queues = 0;
159 dev_info->max_rx_queues = 0;
161 dev_info->max_vfs = pci_dev->max_vfs;
163 dev_info->max_hash_mac_addrs = 0;
164 dev_info->max_vmdq_pools = 0;
165 dev_info->vmdq_queue_num = 0;
168 RTE_PMD_REGISTER_PCI(net_atlantic, rte_atl_pmd);
169 RTE_PMD_REGISTER_PCI_TABLE(net_atlantic, pci_id_atl_map);
170 RTE_PMD_REGISTER_KMOD_DEP(net_atlantic, "* igb_uio | uio_pci_generic");