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 int atl_logtype_driver;
30 * The set of PCI devices this driver supports
32 static const struct rte_pci_id pci_id_atl_map[] = {
33 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_0001) },
34 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D100) },
35 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D107) },
36 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D108) },
37 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D109) },
39 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC100) },
40 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC107) },
41 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC108) },
42 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC109) },
43 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC111) },
44 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC112) },
46 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC100S) },
47 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC107S) },
48 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC108S) },
49 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC109S) },
50 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC111S) },
51 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC112S) },
53 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC111E) },
54 { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC112E) },
55 { .vendor_id = 0, /* sentinel */ },
58 static struct rte_pci_driver rte_atl_pmd = {
59 .id_table = pci_id_atl_map,
60 .drv_flags = RTE_PCI_DRV_NEED_MAPPING |
61 RTE_PCI_DRV_IOVA_AS_VA,
62 .probe = eth_atl_pci_probe,
63 .remove = eth_atl_pci_remove,
66 static const struct eth_dev_ops atl_eth_dev_ops = {
67 .dev_configure = atl_dev_configure,
68 .dev_start = atl_dev_start,
69 .dev_stop = atl_dev_stop,
70 .dev_close = atl_dev_close,
71 .dev_reset = atl_dev_reset,
72 .dev_infos_get = atl_dev_info_get,
76 eth_atl_dev_init(struct rte_eth_dev *eth_dev)
78 eth_dev->dev_ops = &atl_eth_dev_ops;
80 /* Allocate memory for storing MAC addresses */
81 eth_dev->data->mac_addrs = rte_zmalloc("atlantic", ETHER_ADDR_LEN, 0);
82 if (eth_dev->data->mac_addrs == NULL)
89 eth_atl_dev_uninit(struct rte_eth_dev *eth_dev)
91 rte_free(eth_dev->data->mac_addrs);
97 eth_atl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
98 struct rte_pci_device *pci_dev)
100 return rte_eth_dev_pci_generic_probe(pci_dev,
101 sizeof(struct atl_adapter), eth_atl_dev_init);
105 eth_atl_pci_remove(struct rte_pci_device *pci_dev)
107 return rte_eth_dev_pci_generic_remove(pci_dev, eth_atl_dev_uninit);
111 atl_dev_configure(struct rte_eth_dev *dev __rte_unused)
117 * Configure device link speed and setup link.
118 * It returns 0 on success.
121 atl_dev_start(struct rte_eth_dev *dev __rte_unused)
127 * Stop device: disable rx and tx functions to allow for reconfiguring.
130 atl_dev_stop(struct rte_eth_dev *dev __rte_unused)
135 * Reset and stop device.
138 atl_dev_close(struct rte_eth_dev *dev __rte_unused)
143 atl_dev_reset(struct rte_eth_dev *dev)
147 ret = eth_atl_dev_uninit(dev);
151 ret = eth_atl_dev_init(dev);
157 atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
159 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
161 dev_info->max_rx_queues = 0;
162 dev_info->max_rx_queues = 0;
164 dev_info->max_vfs = pci_dev->max_vfs;
166 dev_info->max_hash_mac_addrs = 0;
167 dev_info->max_vmdq_pools = 0;
168 dev_info->vmdq_queue_num = 0;
171 RTE_PMD_REGISTER_PCI(net_atlantic, rte_atl_pmd);
172 RTE_PMD_REGISTER_PCI_TABLE(net_atlantic, pci_id_atl_map);
173 RTE_PMD_REGISTER_KMOD_DEP(net_atlantic, "* igb_uio | uio_pci_generic");
175 RTE_INIT(atl_init_log)
177 atl_logtype_init = rte_log_register("pmd.net.atlantic.init");
178 if (atl_logtype_init >= 0)
179 rte_log_set_level(atl_logtype_init, RTE_LOG_NOTICE);
180 atl_logtype_driver = rte_log_register("pmd.net.atlantic.driver");
181 if (atl_logtype_driver >= 0)
182 rte_log_set_level(atl_logtype_driver, RTE_LOG_NOTICE);