1540914bcSEd Czeck /* SPDX-License-Identifier: BSD-3-Clause
2540914bcSEd Czeck * Copyright (c) 2015-2018 Atomic Rules LLC
31131cbf0SEd Czeck */
41131cbf0SEd Czeck
51131cbf0SEd Czeck #include <unistd.h>
61131cbf0SEd Czeck #include <sys/stat.h>
71131cbf0SEd Czeck #include <dlfcn.h>
81131cbf0SEd Czeck
9c752998bSGaetan Rivet #include <rte_bus_pci.h>
10df96fd0dSBruce Richardson #include <ethdev_pci.h>
111131cbf0SEd Czeck #include <rte_kvargs.h>
121131cbf0SEd Czeck
131131cbf0SEd Czeck #include "ark_global.h"
141131cbf0SEd Czeck #include "ark_logs.h"
15727b3fe2SEd Czeck #include "ark_ethdev_tx.h"
16727b3fe2SEd Czeck #include "ark_ethdev_rx.h"
17727b3fe2SEd Czeck #include "ark_mpu.h"
18727b3fe2SEd Czeck #include "ark_ddm.h"
19727b3fe2SEd Czeck #include "ark_udm.h"
20727b3fe2SEd Czeck #include "ark_rqp.h"
21727b3fe2SEd Czeck #include "ark_pktdir.h"
22727b3fe2SEd Czeck #include "ark_pktgen.h"
23727b3fe2SEd Czeck #include "ark_pktchkr.h"
241131cbf0SEd Czeck
251131cbf0SEd Czeck /* Internal prototypes */
261131cbf0SEd Czeck static int eth_ark_check_args(struct ark_adapter *ark, const char *params);
271131cbf0SEd Czeck static int eth_ark_dev_init(struct rte_eth_dev *dev);
28727b3fe2SEd Czeck static int ark_config_device(struct rte_eth_dev *dev);
291131cbf0SEd Czeck static int eth_ark_dev_uninit(struct rte_eth_dev *eth_dev);
301131cbf0SEd Czeck static int eth_ark_dev_configure(struct rte_eth_dev *dev);
31727b3fe2SEd Czeck static int eth_ark_dev_start(struct rte_eth_dev *dev);
3262024eb8SIvan Ilchenko static int eth_ark_dev_stop(struct rte_eth_dev *dev);
33b142387bSThomas Monjalon static int eth_ark_dev_close(struct rte_eth_dev *dev);
34bdad90d1SIvan Ilchenko static int eth_ark_dev_info_get(struct rte_eth_dev *dev,
351131cbf0SEd Czeck struct rte_eth_dev_info *dev_info);
36727b3fe2SEd Czeck static int eth_ark_dev_link_update(struct rte_eth_dev *dev,
37727b3fe2SEd Czeck int wait_to_complete);
38727b3fe2SEd Czeck static int eth_ark_dev_set_link_up(struct rte_eth_dev *dev);
39727b3fe2SEd Czeck static int eth_ark_dev_set_link_down(struct rte_eth_dev *dev);
40d5b0924bSMatan Azrad static int eth_ark_dev_stats_get(struct rte_eth_dev *dev,
41727b3fe2SEd Czeck struct rte_eth_stats *stats);
429970a9adSIgor Romanov static int eth_ark_dev_stats_reset(struct rte_eth_dev *dev);
43caccf8b3SOlivier Matz static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,
446d13ea8eSOlivier Matz struct rte_ether_addr *mac_addr);
456d01e580SWei Dai static int eth_ark_macaddr_add(struct rte_eth_dev *dev,
466d13ea8eSOlivier Matz struct rte_ether_addr *mac_addr,
47727b3fe2SEd Czeck uint32_t index,
48727b3fe2SEd Czeck uint32_t pool);
49727b3fe2SEd Czeck static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
50727b3fe2SEd Czeck uint32_t index);
519ae74488SJohn Miller static int eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size);
521131cbf0SEd Czeck
531131cbf0SEd Czeck /*
541131cbf0SEd Czeck * The packet generator is a functional block used to generate packet
551131cbf0SEd Czeck * patterns for testing. It is not intended for nominal use.
561131cbf0SEd Czeck */
571131cbf0SEd Czeck #define ARK_PKTGEN_ARG "Pkt_gen"
581131cbf0SEd Czeck
591131cbf0SEd Czeck /*
601131cbf0SEd Czeck * The packet checker is a functional block used to verify packet
611131cbf0SEd Czeck * patterns for testing. It is not intended for nominal use.
621131cbf0SEd Czeck */
631131cbf0SEd Czeck #define ARK_PKTCHKR_ARG "Pkt_chkr"
641131cbf0SEd Czeck
651131cbf0SEd Czeck /*
661131cbf0SEd Czeck * The packet director is used to select the internal ingress and
671131cbf0SEd Czeck * egress packets paths during testing. It is not intended for
681131cbf0SEd Czeck * nominal use.
691131cbf0SEd Czeck */
701131cbf0SEd Czeck #define ARK_PKTDIR_ARG "Pkt_dir"
711131cbf0SEd Czeck
721131cbf0SEd Czeck /* Devinfo configurations */
731131cbf0SEd Czeck #define ARK_RX_MAX_QUEUE (4096 * 4)
741131cbf0SEd Czeck #define ARK_RX_MIN_QUEUE (512)
751131cbf0SEd Czeck #define ARK_RX_MAX_PKT_LEN ((16 * 1024) - 128)
761131cbf0SEd Czeck #define ARK_RX_MIN_BUFSIZE (1024)
771131cbf0SEd Czeck
781131cbf0SEd Czeck #define ARK_TX_MAX_QUEUE (4096 * 4)
791131cbf0SEd Czeck #define ARK_TX_MIN_QUEUE (256)
801131cbf0SEd Czeck
811131cbf0SEd Czeck static const char * const valid_arguments[] = {
821131cbf0SEd Czeck ARK_PKTGEN_ARG,
831131cbf0SEd Czeck ARK_PKTCHKR_ARG,
841131cbf0SEd Czeck ARK_PKTDIR_ARG,
851131cbf0SEd Czeck NULL
861131cbf0SEd Czeck };
871131cbf0SEd Czeck
88c5314a53SJohn Miller #define AR_VENDOR_ID 0x1d6c
891131cbf0SEd Czeck static const struct rte_pci_id pci_id_ark_map[] = {
90c5314a53SJohn Miller {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100d)},
91c5314a53SJohn Miller {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100e)},
92c5314a53SJohn Miller {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100f)},
93c5314a53SJohn Miller {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1010)},
94c5314a53SJohn Miller {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1017)},
95c5314a53SJohn Miller {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1018)},
96c5314a53SJohn Miller {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1019)},
9751ec6c74SJohn Miller {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101e)},
9851ec6c74SJohn Miller {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101f)},
991131cbf0SEd Czeck {.vendor_id = 0, /* sentinel */ },
1001131cbf0SEd Czeck };
1011131cbf0SEd Czeck
102c5314a53SJohn Miller /*
103c5314a53SJohn Miller * This structure is used to statically define the capabilities
104c5314a53SJohn Miller * of supported devices.
105c5314a53SJohn Miller * Capabilities:
106c5314a53SJohn Miller * rqpacing -
107c5314a53SJohn Miller * Some HW variants require that PCIe read-requests be correctly throttled.
108c5314a53SJohn Miller * This is called "rqpacing" and has to do with credit and flow control
109c5314a53SJohn Miller * on certain Arkville implementations.
110c5314a53SJohn Miller */
111c5314a53SJohn Miller struct ark_caps {
112c5314a53SJohn Miller bool rqpacing;
113c5314a53SJohn Miller };
114c5314a53SJohn Miller struct ark_dev_caps {
115c5314a53SJohn Miller uint32_t device_id;
116c5314a53SJohn Miller struct ark_caps caps;
117c5314a53SJohn Miller };
118c5314a53SJohn Miller #define SET_DEV_CAPS(id, rqp) \
119c5314a53SJohn Miller {id, {.rqpacing = rqp} }
120c5314a53SJohn Miller
121c5314a53SJohn Miller static const struct ark_dev_caps
122c5314a53SJohn Miller ark_device_caps[] = {
123c5314a53SJohn Miller SET_DEV_CAPS(0x100d, true),
124c5314a53SJohn Miller SET_DEV_CAPS(0x100e, true),
125c5314a53SJohn Miller SET_DEV_CAPS(0x100f, true),
126c5314a53SJohn Miller SET_DEV_CAPS(0x1010, false),
127c5314a53SJohn Miller SET_DEV_CAPS(0x1017, true),
128c5314a53SJohn Miller SET_DEV_CAPS(0x1018, true),
129c5314a53SJohn Miller SET_DEV_CAPS(0x1019, true),
13051ec6c74SJohn Miller SET_DEV_CAPS(0x101e, false),
13151ec6c74SJohn Miller SET_DEV_CAPS(0x101f, false),
132c5314a53SJohn Miller {.device_id = 0,}
133c5314a53SJohn Miller };
134c5314a53SJohn Miller
1351131cbf0SEd Czeck static int
eth_ark_pci_probe(struct rte_pci_driver * pci_drv __rte_unused,struct rte_pci_device * pci_dev)1361131cbf0SEd Czeck eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
1371131cbf0SEd Czeck struct rte_pci_device *pci_dev)
1381131cbf0SEd Czeck {
1391131cbf0SEd Czeck struct rte_eth_dev *eth_dev;
1401131cbf0SEd Czeck int ret;
1411131cbf0SEd Czeck
1421131cbf0SEd Czeck eth_dev = rte_eth_dev_pci_allocate(pci_dev, sizeof(struct ark_adapter));
1431131cbf0SEd Czeck
1441131cbf0SEd Czeck if (eth_dev == NULL)
1451131cbf0SEd Czeck return -ENOMEM;
1461131cbf0SEd Czeck
1471131cbf0SEd Czeck ret = eth_ark_dev_init(eth_dev);
1481131cbf0SEd Czeck if (ret)
1492c65898bSThomas Monjalon rte_eth_dev_release_port(eth_dev);
1501131cbf0SEd Czeck
1511131cbf0SEd Czeck return ret;
1521131cbf0SEd Czeck }
1531131cbf0SEd Czeck
1541131cbf0SEd Czeck static int
eth_ark_pci_remove(struct rte_pci_device * pci_dev)1551131cbf0SEd Czeck eth_ark_pci_remove(struct rte_pci_device *pci_dev)
1561131cbf0SEd Czeck {
1571131cbf0SEd Czeck return rte_eth_dev_pci_generic_remove(pci_dev, eth_ark_dev_uninit);
1581131cbf0SEd Czeck }
1591131cbf0SEd Czeck
1601131cbf0SEd Czeck static struct rte_pci_driver rte_ark_pmd = {
1611131cbf0SEd Czeck .id_table = pci_id_ark_map,
1621131cbf0SEd Czeck .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
1631131cbf0SEd Czeck .probe = eth_ark_pci_probe,
1641131cbf0SEd Czeck .remove = eth_ark_pci_remove,
1651131cbf0SEd Czeck };
1661131cbf0SEd Czeck
1671131cbf0SEd Czeck static const struct eth_dev_ops ark_eth_dev_ops = {
1681131cbf0SEd Czeck .dev_configure = eth_ark_dev_configure,
169727b3fe2SEd Czeck .dev_start = eth_ark_dev_start,
170727b3fe2SEd Czeck .dev_stop = eth_ark_dev_stop,
171727b3fe2SEd Czeck .dev_close = eth_ark_dev_close,
172727b3fe2SEd Czeck
1731131cbf0SEd Czeck .dev_infos_get = eth_ark_dev_info_get,
174727b3fe2SEd Czeck
175727b3fe2SEd Czeck .rx_queue_setup = eth_ark_dev_rx_queue_setup,
176727b3fe2SEd Czeck .tx_queue_setup = eth_ark_tx_queue_setup,
177727b3fe2SEd Czeck
178727b3fe2SEd Czeck .link_update = eth_ark_dev_link_update,
179727b3fe2SEd Czeck .dev_set_link_up = eth_ark_dev_set_link_up,
180727b3fe2SEd Czeck .dev_set_link_down = eth_ark_dev_set_link_down,
181727b3fe2SEd Czeck
182727b3fe2SEd Czeck .rx_queue_start = eth_ark_rx_start_queue,
183727b3fe2SEd Czeck .rx_queue_stop = eth_ark_rx_stop_queue,
184727b3fe2SEd Czeck
185727b3fe2SEd Czeck .tx_queue_start = eth_ark_tx_queue_start,
186727b3fe2SEd Czeck .tx_queue_stop = eth_ark_tx_queue_stop,
187727b3fe2SEd Czeck
188727b3fe2SEd Czeck .stats_get = eth_ark_dev_stats_get,
189727b3fe2SEd Czeck .stats_reset = eth_ark_dev_stats_reset,
190727b3fe2SEd Czeck
191727b3fe2SEd Czeck .mac_addr_add = eth_ark_macaddr_add,
192727b3fe2SEd Czeck .mac_addr_remove = eth_ark_macaddr_remove,
193727b3fe2SEd Czeck .mac_addr_set = eth_ark_set_default_mac_addr,
1949ae74488SJohn Miller
1959ae74488SJohn Miller .mtu_set = eth_ark_set_mtu,
1961131cbf0SEd Czeck };
1971131cbf0SEd Czeck
1981131cbf0SEd Czeck static int
check_for_ext(struct ark_adapter * ark)199727b3fe2SEd Czeck check_for_ext(struct ark_adapter *ark)
200727b3fe2SEd Czeck {
201727b3fe2SEd Czeck int found = 0;
202727b3fe2SEd Czeck
203727b3fe2SEd Czeck /* Get the env */
204727b3fe2SEd Czeck const char *dllpath = getenv("ARK_EXT_PATH");
205727b3fe2SEd Czeck
206727b3fe2SEd Czeck if (dllpath == NULL) {
2071502d443SEd Czeck ARK_PMD_LOG(DEBUG, "EXT NO dll path specified\n");
208727b3fe2SEd Czeck return 0;
209727b3fe2SEd Czeck }
2101502d443SEd Czeck ARK_PMD_LOG(NOTICE, "EXT found dll path at %s\n", dllpath);
211727b3fe2SEd Czeck
212727b3fe2SEd Czeck /* Open and load the .so */
213727b3fe2SEd Czeck ark->d_handle = dlopen(dllpath, RTLD_LOCAL | RTLD_LAZY);
214727b3fe2SEd Czeck if (ark->d_handle == NULL) {
2151502d443SEd Czeck ARK_PMD_LOG(ERR, "Could not load user extension %s\n",
216727b3fe2SEd Czeck dllpath);
217727b3fe2SEd Czeck return -1;
218727b3fe2SEd Czeck }
2191502d443SEd Czeck ARK_PMD_LOG(DEBUG, "SUCCESS: loaded user extension %s\n",
220727b3fe2SEd Czeck dllpath);
221727b3fe2SEd Czeck
222727b3fe2SEd Czeck /* Get the entry points */
223727b3fe2SEd Czeck ark->user_ext.dev_init =
224727b3fe2SEd Czeck (void *(*)(struct rte_eth_dev *, void *, int))
225f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_dev_init");
2261502d443SEd Czeck ARK_PMD_LOG(DEBUG, "device ext init pointer = %p\n",
227727b3fe2SEd Czeck ark->user_ext.dev_init);
228727b3fe2SEd Czeck ark->user_ext.dev_get_port_count =
229727b3fe2SEd Czeck (int (*)(struct rte_eth_dev *, void *))
230f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_dev_get_port_count");
231727b3fe2SEd Czeck ark->user_ext.dev_uninit =
232727b3fe2SEd Czeck (void (*)(struct rte_eth_dev *, void *))
233f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_dev_uninit");
234727b3fe2SEd Czeck ark->user_ext.dev_configure =
235727b3fe2SEd Czeck (int (*)(struct rte_eth_dev *, void *))
236f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_dev_configure");
237727b3fe2SEd Czeck ark->user_ext.dev_start =
238727b3fe2SEd Czeck (int (*)(struct rte_eth_dev *, void *))
239f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_dev_start");
240727b3fe2SEd Czeck ark->user_ext.dev_stop =
241727b3fe2SEd Czeck (void (*)(struct rte_eth_dev *, void *))
242f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_dev_stop");
243727b3fe2SEd Czeck ark->user_ext.dev_close =
244727b3fe2SEd Czeck (void (*)(struct rte_eth_dev *, void *))
245f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_dev_close");
246727b3fe2SEd Czeck ark->user_ext.link_update =
247727b3fe2SEd Czeck (int (*)(struct rte_eth_dev *, int, void *))
248f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_link_update");
249727b3fe2SEd Czeck ark->user_ext.dev_set_link_up =
250727b3fe2SEd Czeck (int (*)(struct rte_eth_dev *, void *))
251f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_dev_set_link_up");
252727b3fe2SEd Czeck ark->user_ext.dev_set_link_down =
253727b3fe2SEd Czeck (int (*)(struct rte_eth_dev *, void *))
254f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_dev_set_link_down");
255727b3fe2SEd Czeck ark->user_ext.stats_get =
256d5b0924bSMatan Azrad (int (*)(struct rte_eth_dev *, struct rte_eth_stats *,
257727b3fe2SEd Czeck void *))
258f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_stats_get");
259727b3fe2SEd Czeck ark->user_ext.stats_reset =
260727b3fe2SEd Czeck (void (*)(struct rte_eth_dev *, void *))
261f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_stats_reset");
262727b3fe2SEd Czeck ark->user_ext.mac_addr_add =
2636d13ea8eSOlivier Matz (void (*)(struct rte_eth_dev *, struct rte_ether_addr *,
2646d13ea8eSOlivier Matz uint32_t, uint32_t, void *))
265f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_mac_addr_add");
266727b3fe2SEd Czeck ark->user_ext.mac_addr_remove =
267727b3fe2SEd Czeck (void (*)(struct rte_eth_dev *, uint32_t, void *))
268f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_mac_addr_remove");
269727b3fe2SEd Czeck ark->user_ext.mac_addr_set =
2706d13ea8eSOlivier Matz (void (*)(struct rte_eth_dev *, struct rte_ether_addr *,
271727b3fe2SEd Czeck void *))
272f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_mac_addr_set");
2739ae74488SJohn Miller ark->user_ext.set_mtu =
2749ae74488SJohn Miller (int (*)(struct rte_eth_dev *, uint16_t,
2759ae74488SJohn Miller void *))
276f2764c36SEd Czeck dlsym(ark->d_handle, "rte_pmd_ark_set_mtu");
2776c7f491eSEd Czeck ark->user_ext.rx_user_meta_hook =
2786c7f491eSEd Czeck (rx_user_meta_hook_fn)dlsym(ark->d_handle,
2796c7f491eSEd Czeck "rte_pmd_ark_rx_user_meta_hook");
2806c7f491eSEd Czeck ark->user_ext.tx_user_meta_hook =
2816c7f491eSEd Czeck (tx_user_meta_hook_fn)dlsym(ark->d_handle,
2826c7f491eSEd Czeck "rte_pmd_ark_tx_user_meta_hook");
283727b3fe2SEd Czeck
284727b3fe2SEd Czeck return found;
285727b3fe2SEd Czeck }
286727b3fe2SEd Czeck
287727b3fe2SEd Czeck static int
eth_ark_dev_init(struct rte_eth_dev * dev)2881131cbf0SEd Czeck eth_ark_dev_init(struct rte_eth_dev *dev)
2891131cbf0SEd Czeck {
2900bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
2911131cbf0SEd Czeck struct rte_pci_device *pci_dev;
292727b3fe2SEd Czeck int ret;
293727b3fe2SEd Czeck int port_count = 1;
294727b3fe2SEd Czeck int p;
295c5314a53SJohn Miller bool rqpacing = false;
2961131cbf0SEd Czeck
2971131cbf0SEd Czeck ark->eth_dev = dev;
2981131cbf0SEd Czeck
2991502d443SEd Czeck ARK_PMD_LOG(DEBUG, "\n");
3001131cbf0SEd Czeck
301727b3fe2SEd Czeck /* Check to see if there is an extension that we need to load */
302727b3fe2SEd Czeck ret = check_for_ext(ark);
303727b3fe2SEd Czeck if (ret)
304727b3fe2SEd Czeck return ret;
3051abc7209SEd Czeck
306c0802544SFerruh Yigit pci_dev = RTE_ETH_DEV_TO_PCI(dev);
3071131cbf0SEd Czeck rte_eth_copy_pci_info(dev, pci_dev);
308f30e69b4SFerruh Yigit dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
3091131cbf0SEd Czeck
310c5314a53SJohn Miller p = 0;
311c5314a53SJohn Miller while (ark_device_caps[p].device_id != 0) {
312c5314a53SJohn Miller if (pci_dev->id.device_id == ark_device_caps[p].device_id) {
313c5314a53SJohn Miller rqpacing = ark_device_caps[p].caps.rqpacing;
314c5314a53SJohn Miller break;
315c5314a53SJohn Miller }
316c5314a53SJohn Miller p++;
317c5314a53SJohn Miller }
318c5314a53SJohn Miller
319727b3fe2SEd Czeck /* Use dummy function until setup */
320a41f593fSFerruh Yigit dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
321a41f593fSFerruh Yigit dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
322727b3fe2SEd Czeck
3231131cbf0SEd Czeck ark->bar0 = (uint8_t *)pci_dev->mem_resource[0].addr;
3241131cbf0SEd Czeck ark->a_bar = (uint8_t *)pci_dev->mem_resource[2].addr;
3251131cbf0SEd Czeck
326727b3fe2SEd Czeck ark->sysctrl.v = (void *)&ark->bar0[ARK_SYSCTRL_BASE];
327727b3fe2SEd Czeck ark->mpurx.v = (void *)&ark->bar0[ARK_MPU_RX_BASE];
328727b3fe2SEd Czeck ark->udm.v = (void *)&ark->bar0[ARK_UDM_BASE];
329727b3fe2SEd Czeck ark->mputx.v = (void *)&ark->bar0[ARK_MPU_TX_BASE];
330727b3fe2SEd Czeck ark->ddm.v = (void *)&ark->bar0[ARK_DDM_BASE];
331727b3fe2SEd Czeck ark->cmac.v = (void *)&ark->bar0[ARK_CMAC_BASE];
332727b3fe2SEd Czeck ark->external.v = (void *)&ark->bar0[ARK_EXTERNAL_BASE];
333727b3fe2SEd Czeck ark->pktdir.v = (void *)&ark->bar0[ARK_PKTDIR_BASE];
334727b3fe2SEd Czeck ark->pktgen.v = (void *)&ark->bar0[ARK_PKTGEN_BASE];
335727b3fe2SEd Czeck ark->pktchkr.v = (void *)&ark->bar0[ARK_PKTCHKR_BASE];
336727b3fe2SEd Czeck
337c5314a53SJohn Miller if (rqpacing) {
338727b3fe2SEd Czeck ark->rqpacing =
339727b3fe2SEd Czeck (struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
340c5314a53SJohn Miller } else {
341c5314a53SJohn Miller ark->rqpacing = NULL;
342c5314a53SJohn Miller }
343727b3fe2SEd Czeck ark->started = 0;
3443b4f34f6SEd Czeck ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
345727b3fe2SEd Czeck
3461502d443SEd Czeck ARK_PMD_LOG(INFO, "Sys Ctrl Const = 0x%x HW Commit_ID: %08x\n",
347727b3fe2SEd Czeck ark->sysctrl.t32[4],
348727b3fe2SEd Czeck rte_be_to_cpu_32(ark->sysctrl.t32[0x20 / 4]));
3491502d443SEd Czeck ARK_PMD_LOG(NOTICE, "Arkville HW Commit_ID: %08x\n",
350727b3fe2SEd Czeck rte_be_to_cpu_32(ark->sysctrl.t32[0x20 / 4]));
351727b3fe2SEd Czeck
352727b3fe2SEd Czeck /* If HW sanity test fails, return an error */
353727b3fe2SEd Czeck if (ark->sysctrl.t32[4] != 0xcafef00d) {
3541502d443SEd Czeck ARK_PMD_LOG(ERR,
355727b3fe2SEd Czeck "HW Sanity test has failed, expected constant"
356727b3fe2SEd Czeck " 0x%x, read 0x%x (%s)\n",
357727b3fe2SEd Czeck 0xcafef00d,
358727b3fe2SEd Czeck ark->sysctrl.t32[4], __func__);
359727b3fe2SEd Czeck return -1;
360727b3fe2SEd Czeck }
3619ff8fe95SEd Czeck if (ark->sysctrl.t32[3] != 0) {
362c5314a53SJohn Miller if (ark->rqpacing) {
3639ff8fe95SEd Czeck if (ark_rqp_lasped(ark->rqpacing)) {
3641502d443SEd Czeck ARK_PMD_LOG(ERR, "Arkville Evaluation System - "
3659ff8fe95SEd Czeck "Timer has Expired\n");
3669ff8fe95SEd Czeck return -1;
3679ff8fe95SEd Czeck }
3681502d443SEd Czeck ARK_PMD_LOG(WARNING, "Arkville Evaluation System - "
3699ff8fe95SEd Czeck "Timer is Running\n");
3709ff8fe95SEd Czeck }
371c5314a53SJohn Miller }
372727b3fe2SEd Czeck
3731502d443SEd Czeck ARK_PMD_LOG(DEBUG,
374727b3fe2SEd Czeck "HW Sanity test has PASSED, expected constant"
375727b3fe2SEd Czeck " 0x%x, read 0x%x (%s)\n",
376727b3fe2SEd Czeck 0xcafef00d, ark->sysctrl.t32[4], __func__);
377727b3fe2SEd Czeck
378727b3fe2SEd Czeck /* We are a single function multi-port device. */
379727b3fe2SEd Czeck ret = ark_config_device(dev);
380589876bfSEd Czeck if (ret)
381589876bfSEd Czeck return -1;
382589876bfSEd Czeck
3831131cbf0SEd Czeck dev->dev_ops = &ark_eth_dev_ops;
384cbfc6111SFerruh Yigit dev->rx_queue_count = eth_ark_dev_rx_queue_count;
3851131cbf0SEd Czeck
38635b2d13fSOlivier Matz dev->data->mac_addrs = rte_zmalloc("ark", RTE_ETHER_ADDR_LEN, 0);
387727b3fe2SEd Czeck if (!dev->data->mac_addrs) {
3881502d443SEd Czeck ARK_PMD_LOG(ERR,
389727b3fe2SEd Czeck "Failed to allocated memory for storing mac address"
390727b3fe2SEd Czeck );
391727b3fe2SEd Czeck }
392727b3fe2SEd Czeck
393727b3fe2SEd Czeck if (ark->user_ext.dev_init) {
394428046b4SJohn Miller ark->user_data[dev->data->port_id] =
395428046b4SJohn Miller ark->user_ext.dev_init(dev, ark->a_bar, 0);
396428046b4SJohn Miller if (!ark->user_data[dev->data->port_id]) {
3971502d443SEd Czeck ARK_PMD_LOG(WARNING,
398727b3fe2SEd Czeck "Failed to initialize PMD extension!"
399727b3fe2SEd Czeck " continuing without it\n");
400727b3fe2SEd Czeck memset(&ark->user_ext, 0, sizeof(struct ark_user_ext));
401727b3fe2SEd Czeck dlclose(ark->d_handle);
402727b3fe2SEd Czeck }
403727b3fe2SEd Czeck }
404727b3fe2SEd Czeck
4051131cbf0SEd Czeck if (pci_dev->device.devargs)
4061131cbf0SEd Czeck ret = eth_ark_check_args(ark, pci_dev->device.devargs->args);
4071131cbf0SEd Czeck else
4081502d443SEd Czeck ARK_PMD_LOG(INFO, "No Device args found\n");
4091131cbf0SEd Czeck
410727b3fe2SEd Czeck if (ret)
411727b3fe2SEd Czeck goto error;
412727b3fe2SEd Czeck /*
413727b3fe2SEd Czeck * We will create additional devices based on the number of requested
414727b3fe2SEd Czeck * ports
415727b3fe2SEd Czeck */
416727b3fe2SEd Czeck if (ark->user_ext.dev_get_port_count)
417727b3fe2SEd Czeck port_count =
418428046b4SJohn Miller ark->user_ext.dev_get_port_count(dev,
419428046b4SJohn Miller ark->user_data[dev->data->port_id]);
420727b3fe2SEd Czeck ark->num_ports = port_count;
421727b3fe2SEd Czeck
422727b3fe2SEd Czeck for (p = 0; p < port_count; p++) {
423727b3fe2SEd Czeck struct rte_eth_dev *eth_dev;
424727b3fe2SEd Czeck char name[RTE_ETH_NAME_MAX_LEN];
425727b3fe2SEd Czeck
426727b3fe2SEd Czeck snprintf(name, sizeof(name), "arketh%d",
427727b3fe2SEd Czeck dev->data->port_id + p);
428727b3fe2SEd Czeck
429727b3fe2SEd Czeck if (p == 0) {
430727b3fe2SEd Czeck /* First port is already allocated by DPDK */
431727b3fe2SEd Czeck eth_dev = ark->eth_dev;
4325bfe551dSEd Czeck rte_eth_dev_probing_finish(eth_dev);
433727b3fe2SEd Czeck continue;
434727b3fe2SEd Czeck }
435727b3fe2SEd Czeck
436727b3fe2SEd Czeck /* reserve an ethdev entry */
437727b3fe2SEd Czeck eth_dev = rte_eth_dev_allocate(name);
438727b3fe2SEd Czeck if (!eth_dev) {
4391502d443SEd Czeck ARK_PMD_LOG(ERR,
440727b3fe2SEd Czeck "Could not allocate eth_dev for port %d\n",
441727b3fe2SEd Czeck p);
442727b3fe2SEd Czeck goto error;
443727b3fe2SEd Czeck }
444727b3fe2SEd Czeck
445727b3fe2SEd Czeck eth_dev->device = &pci_dev->device;
446727b3fe2SEd Czeck eth_dev->data->dev_private = ark;
447727b3fe2SEd Czeck eth_dev->dev_ops = ark->eth_dev->dev_ops;
448727b3fe2SEd Czeck eth_dev->tx_pkt_burst = ark->eth_dev->tx_pkt_burst;
449727b3fe2SEd Czeck eth_dev->rx_pkt_burst = ark->eth_dev->rx_pkt_burst;
450727b3fe2SEd Czeck
451727b3fe2SEd Czeck rte_eth_copy_pci_info(eth_dev, pci_dev);
452f30e69b4SFerruh Yigit eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
453727b3fe2SEd Czeck
45435b2d13fSOlivier Matz eth_dev->data->mac_addrs = rte_zmalloc(name,
45535b2d13fSOlivier Matz RTE_ETHER_ADDR_LEN, 0);
456727b3fe2SEd Czeck if (!eth_dev->data->mac_addrs) {
4571502d443SEd Czeck ARK_PMD_LOG(ERR,
458727b3fe2SEd Czeck "Memory allocation for MAC failed!"
459727b3fe2SEd Czeck " Exiting.\n");
460727b3fe2SEd Czeck goto error;
461727b3fe2SEd Czeck }
462727b3fe2SEd Czeck
463428046b4SJohn Miller if (ark->user_ext.dev_init) {
464428046b4SJohn Miller ark->user_data[eth_dev->data->port_id] =
465727b3fe2SEd Czeck ark->user_ext.dev_init(dev, ark->a_bar, p);
466727b3fe2SEd Czeck }
467fbe90cddSThomas Monjalon
468fbe90cddSThomas Monjalon rte_eth_dev_probing_finish(eth_dev);
469428046b4SJohn Miller }
470727b3fe2SEd Czeck
4711131cbf0SEd Czeck return ret;
472727b3fe2SEd Czeck
473727b3fe2SEd Czeck error:
474727b3fe2SEd Czeck rte_free(dev->data->mac_addrs);
475e7f2fa88SDavid Marchand dev->data->mac_addrs = NULL;
476727b3fe2SEd Czeck return -1;
477727b3fe2SEd Czeck }
478727b3fe2SEd Czeck
479727b3fe2SEd Czeck /*
480727b3fe2SEd Czeck *Initial device configuration when device is opened
481727b3fe2SEd Czeck * setup the DDM, and UDM
482727b3fe2SEd Czeck * Called once per PCIE device
483727b3fe2SEd Czeck */
484727b3fe2SEd Czeck static int
ark_config_device(struct rte_eth_dev * dev)485727b3fe2SEd Czeck ark_config_device(struct rte_eth_dev *dev)
486727b3fe2SEd Czeck {
4870bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
488727b3fe2SEd Czeck uint16_t num_q, i;
489727b3fe2SEd Czeck struct ark_mpu_t *mpu;
490727b3fe2SEd Czeck
491727b3fe2SEd Czeck /*
492727b3fe2SEd Czeck * Make sure that the packet director, generator and checker are in a
493727b3fe2SEd Czeck * known state
494727b3fe2SEd Czeck */
495727b3fe2SEd Czeck ark->start_pg = 0;
496*c7ff3d78SJohn Miller ark->pg_running = 0;
497727b3fe2SEd Czeck ark->pg = ark_pktgen_init(ark->pktgen.v, 0, 1);
49853a9ba13SYong Wang if (ark->pg == NULL)
49953a9ba13SYong Wang return -1;
500727b3fe2SEd Czeck ark_pktgen_reset(ark->pg);
501727b3fe2SEd Czeck ark->pc = ark_pktchkr_init(ark->pktchkr.v, 0, 1);
50253a9ba13SYong Wang if (ark->pc == NULL)
50353a9ba13SYong Wang return -1;
504727b3fe2SEd Czeck ark_pktchkr_stop(ark->pc);
505727b3fe2SEd Czeck ark->pd = ark_pktdir_init(ark->pktdir.v);
50653a9ba13SYong Wang if (ark->pd == NULL)
50753a9ba13SYong Wang return -1;
508727b3fe2SEd Czeck
509727b3fe2SEd Czeck /* Verify HW */
510727b3fe2SEd Czeck if (ark_udm_verify(ark->udm.v))
511727b3fe2SEd Czeck return -1;
512727b3fe2SEd Czeck if (ark_ddm_verify(ark->ddm.v))
513727b3fe2SEd Czeck return -1;
514727b3fe2SEd Czeck
515727b3fe2SEd Czeck /* UDM */
516727b3fe2SEd Czeck if (ark_udm_reset(ark->udm.v)) {
5171502d443SEd Czeck ARK_PMD_LOG(ERR, "Unable to stop and reset UDM\n");
518727b3fe2SEd Czeck return -1;
519727b3fe2SEd Czeck }
520727b3fe2SEd Czeck /* Keep in reset until the MPU are cleared */
521727b3fe2SEd Czeck
522727b3fe2SEd Czeck /* MPU reset */
523727b3fe2SEd Czeck mpu = ark->mpurx.v;
524727b3fe2SEd Czeck num_q = ark_api_num_queues(mpu);
525727b3fe2SEd Czeck ark->rx_queues = num_q;
526727b3fe2SEd Czeck for (i = 0; i < num_q; i++) {
527727b3fe2SEd Czeck ark_mpu_reset(mpu);
528727b3fe2SEd Czeck mpu = RTE_PTR_ADD(mpu, ARK_MPU_QOFFSET);
529727b3fe2SEd Czeck }
530727b3fe2SEd Czeck
531727b3fe2SEd Czeck /* TX -- DDM */
532727b3fe2SEd Czeck if (ark_ddm_stop(ark->ddm.v, 1))
5331502d443SEd Czeck ARK_PMD_LOG(ERR, "Unable to stop DDM\n");
534727b3fe2SEd Czeck
535727b3fe2SEd Czeck mpu = ark->mputx.v;
536727b3fe2SEd Czeck num_q = ark_api_num_queues(mpu);
537727b3fe2SEd Czeck ark->tx_queues = num_q;
538727b3fe2SEd Czeck for (i = 0; i < num_q; i++) {
539727b3fe2SEd Czeck ark_mpu_reset(mpu);
540727b3fe2SEd Czeck mpu = RTE_PTR_ADD(mpu, ARK_MPU_QOFFSET);
541727b3fe2SEd Czeck }
542727b3fe2SEd Czeck
543727b3fe2SEd Czeck ark_ddm_reset(ark->ddm.v);
544727b3fe2SEd Czeck ark_ddm_stats_reset(ark->ddm.v);
545727b3fe2SEd Czeck
546727b3fe2SEd Czeck ark_ddm_stop(ark->ddm.v, 0);
547c5314a53SJohn Miller if (ark->rqpacing)
548727b3fe2SEd Czeck ark_rqp_stats_reset(ark->rqpacing);
549727b3fe2SEd Czeck
550727b3fe2SEd Czeck return 0;
5511131cbf0SEd Czeck }
5521131cbf0SEd Czeck
5531131cbf0SEd Czeck static int
eth_ark_dev_uninit(struct rte_eth_dev * dev)5541131cbf0SEd Czeck eth_ark_dev_uninit(struct rte_eth_dev *dev)
5551131cbf0SEd Czeck {
5560bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
557727b3fe2SEd Czeck
5581131cbf0SEd Czeck if (rte_eal_process_type() != RTE_PROC_PRIMARY)
5591131cbf0SEd Czeck return 0;
5601131cbf0SEd Czeck
561727b3fe2SEd Czeck if (ark->user_ext.dev_uninit)
562428046b4SJohn Miller ark->user_ext.dev_uninit(dev,
563428046b4SJohn Miller ark->user_data[dev->data->port_id]);
564727b3fe2SEd Czeck
565727b3fe2SEd Czeck ark_pktgen_uninit(ark->pg);
566727b3fe2SEd Czeck ark_pktchkr_uninit(ark->pc);
567727b3fe2SEd Czeck
5681131cbf0SEd Czeck return 0;
5691131cbf0SEd Czeck }
5701131cbf0SEd Czeck
5711131cbf0SEd Czeck static int
eth_ark_dev_configure(struct rte_eth_dev * dev)572727b3fe2SEd Czeck eth_ark_dev_configure(struct rte_eth_dev *dev)
5731131cbf0SEd Czeck {
5740bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
575727b3fe2SEd Czeck
576727b3fe2SEd Czeck eth_ark_dev_set_link_up(dev);
577727b3fe2SEd Czeck if (ark->user_ext.dev_configure)
578428046b4SJohn Miller return ark->user_ext.dev_configure(dev,
579428046b4SJohn Miller ark->user_data[dev->data->port_id]);
5801131cbf0SEd Czeck return 0;
5811131cbf0SEd Czeck }
5821131cbf0SEd Czeck
583727b3fe2SEd Czeck static int
eth_ark_dev_start(struct rte_eth_dev * dev)584727b3fe2SEd Czeck eth_ark_dev_start(struct rte_eth_dev *dev)
585727b3fe2SEd Czeck {
5860bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
587727b3fe2SEd Czeck int i;
588727b3fe2SEd Czeck
589727b3fe2SEd Czeck /* RX Side */
590727b3fe2SEd Czeck /* start UDM */
591727b3fe2SEd Czeck ark_udm_start(ark->udm.v);
592727b3fe2SEd Czeck
593727b3fe2SEd Czeck for (i = 0; i < dev->data->nb_rx_queues; i++)
594727b3fe2SEd Czeck eth_ark_rx_start_queue(dev, i);
595727b3fe2SEd Czeck
596727b3fe2SEd Czeck /* TX Side */
597727b3fe2SEd Czeck for (i = 0; i < dev->data->nb_tx_queues; i++)
598727b3fe2SEd Czeck eth_ark_tx_queue_start(dev, i);
599727b3fe2SEd Czeck
600727b3fe2SEd Czeck /* start DDM */
601727b3fe2SEd Czeck ark_ddm_start(ark->ddm.v);
602727b3fe2SEd Czeck
603727b3fe2SEd Czeck ark->started = 1;
604727b3fe2SEd Czeck /* set xmit and receive function */
605727b3fe2SEd Czeck dev->rx_pkt_burst = ð_ark_recv_pkts;
606727b3fe2SEd Czeck dev->tx_pkt_burst = ð_ark_xmit_pkts;
607727b3fe2SEd Czeck
608727b3fe2SEd Czeck if (ark->start_pg)
609727b3fe2SEd Czeck ark_pktchkr_run(ark->pc);
610727b3fe2SEd Czeck
611*c7ff3d78SJohn Miller if (ark->start_pg && !ark->pg_running) {
612727b3fe2SEd Czeck pthread_t thread;
613727b3fe2SEd Czeck
614727b3fe2SEd Czeck /* Delay packet generatpr start allow the hardware to be ready
615727b3fe2SEd Czeck * This is only used for sanity checking with internal generator
616727b3fe2SEd Czeck */
617*c7ff3d78SJohn Miller char tname[32];
618*c7ff3d78SJohn Miller snprintf(tname, sizeof(tname), "ark-delay-pg-%d",
619*c7ff3d78SJohn Miller dev->data->port_id);
620*c7ff3d78SJohn Miller
621*c7ff3d78SJohn Miller if (rte_ctrl_thread_create(&thread, tname, NULL,
6224b42104cSEd Czeck ark_pktgen_delay_start, ark->pg)) {
6231502d443SEd Czeck ARK_PMD_LOG(ERR, "Could not create pktgen "
624d1434c04SJohn Miller "starter thread\n");
625d1434c04SJohn Miller return -1;
626d1434c04SJohn Miller }
627*c7ff3d78SJohn Miller ark->pg_running = 1;
628727b3fe2SEd Czeck }
629727b3fe2SEd Czeck
630727b3fe2SEd Czeck if (ark->user_ext.dev_start)
631428046b4SJohn Miller ark->user_ext.dev_start(dev,
632428046b4SJohn Miller ark->user_data[dev->data->port_id]);
633727b3fe2SEd Czeck
634727b3fe2SEd Czeck return 0;
635727b3fe2SEd Czeck }
636727b3fe2SEd Czeck
63762024eb8SIvan Ilchenko static int
eth_ark_dev_stop(struct rte_eth_dev * dev)638727b3fe2SEd Czeck eth_ark_dev_stop(struct rte_eth_dev *dev)
639727b3fe2SEd Czeck {
640727b3fe2SEd Czeck uint16_t i;
641727b3fe2SEd Czeck int status;
6420bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
643727b3fe2SEd Czeck struct ark_mpu_t *mpu;
644727b3fe2SEd Czeck
645727b3fe2SEd Czeck if (ark->started == 0)
64662024eb8SIvan Ilchenko return 0;
647727b3fe2SEd Czeck ark->started = 0;
648b8f5d2aeSThomas Monjalon dev->data->dev_started = 0;
649727b3fe2SEd Czeck
650727b3fe2SEd Czeck /* Stop the extension first */
651727b3fe2SEd Czeck if (ark->user_ext.dev_stop)
652428046b4SJohn Miller ark->user_ext.dev_stop(dev,
653428046b4SJohn Miller ark->user_data[dev->data->port_id]);
654727b3fe2SEd Czeck
655727b3fe2SEd Czeck /* Stop the packet generator */
656*c7ff3d78SJohn Miller if (ark->start_pg && ark->pg_running) {
657727b3fe2SEd Czeck ark_pktgen_pause(ark->pg);
658*c7ff3d78SJohn Miller ark->pg_running = 0;
659*c7ff3d78SJohn Miller }
660727b3fe2SEd Czeck
661a41f593fSFerruh Yigit dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
662a41f593fSFerruh Yigit dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
663727b3fe2SEd Czeck
664727b3fe2SEd Czeck /* STOP TX Side */
665727b3fe2SEd Czeck for (i = 0; i < dev->data->nb_tx_queues; i++) {
666727b3fe2SEd Czeck status = eth_ark_tx_queue_stop(dev, i);
667727b3fe2SEd Czeck if (status != 0) {
668f8244c63SZhiyong Yang uint16_t port = dev->data->port_id;
6691502d443SEd Czeck ARK_PMD_LOG(ERR,
670727b3fe2SEd Czeck "tx_queue stop anomaly"
671727b3fe2SEd Czeck " port %u, queue %u\n",
672727b3fe2SEd Czeck port, i);
673727b3fe2SEd Czeck }
674727b3fe2SEd Czeck }
675727b3fe2SEd Czeck
676727b3fe2SEd Czeck /* Stop DDM */
677727b3fe2SEd Czeck /* Wait up to 0.1 second. each stop is up to 1000 * 10 useconds */
678727b3fe2SEd Czeck for (i = 0; i < 10; i++) {
679727b3fe2SEd Czeck status = ark_ddm_stop(ark->ddm.v, 1);
680727b3fe2SEd Czeck if (status == 0)
681727b3fe2SEd Czeck break;
682727b3fe2SEd Czeck }
683727b3fe2SEd Czeck if (status || i != 0) {
6841502d443SEd Czeck ARK_PMD_LOG(ERR, "DDM stop anomaly. status:"
685727b3fe2SEd Czeck " %d iter: %u. (%s)\n",
686727b3fe2SEd Czeck status,
687727b3fe2SEd Czeck i,
688727b3fe2SEd Czeck __func__);
689727b3fe2SEd Czeck ark_ddm_dump(ark->ddm.v, "Stop anomaly");
690727b3fe2SEd Czeck
691727b3fe2SEd Czeck mpu = ark->mputx.v;
692727b3fe2SEd Czeck for (i = 0; i < ark->tx_queues; i++) {
693727b3fe2SEd Czeck ark_mpu_dump(mpu, "DDM failure dump", i);
694727b3fe2SEd Czeck mpu = RTE_PTR_ADD(mpu, ARK_MPU_QOFFSET);
695727b3fe2SEd Czeck }
696727b3fe2SEd Czeck }
697727b3fe2SEd Czeck
698727b3fe2SEd Czeck /* STOP RX Side */
699727b3fe2SEd Czeck /* Stop UDM multiple tries attempted */
700727b3fe2SEd Czeck for (i = 0; i < 10; i++) {
701727b3fe2SEd Czeck status = ark_udm_stop(ark->udm.v, 1);
702727b3fe2SEd Czeck if (status == 0)
703727b3fe2SEd Czeck break;
704727b3fe2SEd Czeck }
705727b3fe2SEd Czeck if (status || i != 0) {
7061502d443SEd Czeck ARK_PMD_LOG(ERR, "UDM stop anomaly. status %d iter: %u. (%s)\n",
707727b3fe2SEd Czeck status, i, __func__);
708727b3fe2SEd Czeck ark_udm_dump(ark->udm.v, "Stop anomaly");
709727b3fe2SEd Czeck
710727b3fe2SEd Czeck mpu = ark->mpurx.v;
711727b3fe2SEd Czeck for (i = 0; i < ark->rx_queues; i++) {
712727b3fe2SEd Czeck ark_mpu_dump(mpu, "UDM Stop anomaly", i);
713727b3fe2SEd Czeck mpu = RTE_PTR_ADD(mpu, ARK_MPU_QOFFSET);
714727b3fe2SEd Czeck }
715727b3fe2SEd Czeck }
716727b3fe2SEd Czeck
717727b3fe2SEd Czeck ark_udm_dump_stats(ark->udm.v, "Post stop");
718727b3fe2SEd Czeck ark_udm_dump_perf(ark->udm.v, "Post stop");
719727b3fe2SEd Czeck
72022862a02SJohn Miller for (i = 0; i < dev->data->nb_rx_queues; i++)
721727b3fe2SEd Czeck eth_ark_rx_dump_queue(dev, i, __func__);
722727b3fe2SEd Czeck
723727b3fe2SEd Czeck /* Stop the packet checker if it is running */
724727b3fe2SEd Czeck if (ark->start_pg) {
725727b3fe2SEd Czeck ark_pktchkr_dump_stats(ark->pc);
726727b3fe2SEd Czeck ark_pktchkr_stop(ark->pc);
727727b3fe2SEd Czeck }
72862024eb8SIvan Ilchenko
72962024eb8SIvan Ilchenko return 0;
730727b3fe2SEd Czeck }
731727b3fe2SEd Czeck
732b142387bSThomas Monjalon static int
eth_ark_dev_close(struct rte_eth_dev * dev)733727b3fe2SEd Czeck eth_ark_dev_close(struct rte_eth_dev *dev)
734727b3fe2SEd Czeck {
7350bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
736727b3fe2SEd Czeck uint16_t i;
737727b3fe2SEd Czeck
73830410493SThomas Monjalon if (rte_eal_process_type() != RTE_PROC_PRIMARY)
73930410493SThomas Monjalon return 0;
74030410493SThomas Monjalon
741727b3fe2SEd Czeck if (ark->user_ext.dev_close)
742428046b4SJohn Miller ark->user_ext.dev_close(dev,
743428046b4SJohn Miller ark->user_data[dev->data->port_id]);
744727b3fe2SEd Czeck
745727b3fe2SEd Czeck eth_ark_dev_stop(dev);
746727b3fe2SEd Czeck eth_ark_udm_force_close(dev);
747727b3fe2SEd Czeck
748727b3fe2SEd Czeck /*
749727b3fe2SEd Czeck * TODO This should only be called once for the device during shutdown
750727b3fe2SEd Czeck */
751c5314a53SJohn Miller if (ark->rqpacing)
752727b3fe2SEd Czeck ark_rqp_dump(ark->rqpacing);
753727b3fe2SEd Czeck
754727b3fe2SEd Czeck for (i = 0; i < dev->data->nb_tx_queues; i++) {
755727b3fe2SEd Czeck eth_ark_tx_queue_release(dev->data->tx_queues[i]);
756727b3fe2SEd Czeck dev->data->tx_queues[i] = 0;
757727b3fe2SEd Czeck }
758727b3fe2SEd Czeck
759727b3fe2SEd Czeck for (i = 0; i < dev->data->nb_rx_queues; i++) {
760727b3fe2SEd Czeck eth_ark_dev_rx_queue_release(dev->data->rx_queues[i]);
761727b3fe2SEd Czeck dev->data->rx_queues[i] = 0;
762727b3fe2SEd Czeck }
763c5ddc9b9SEd Czeck
764b142387bSThomas Monjalon return 0;
765727b3fe2SEd Czeck }
766727b3fe2SEd Czeck
767bdad90d1SIvan Ilchenko static int
eth_ark_dev_info_get(struct rte_eth_dev * dev,struct rte_eth_dev_info * dev_info)7681131cbf0SEd Czeck eth_ark_dev_info_get(struct rte_eth_dev *dev,
7691131cbf0SEd Czeck struct rte_eth_dev_info *dev_info)
7701131cbf0SEd Czeck {
7710bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
772727b3fe2SEd Czeck struct ark_mpu_t *tx_mpu = RTE_PTR_ADD(ark->bar0, ARK_MPU_TX_BASE);
773727b3fe2SEd Czeck struct ark_mpu_t *rx_mpu = RTE_PTR_ADD(ark->bar0, ARK_MPU_RX_BASE);
774727b3fe2SEd Czeck uint16_t ports = ark->num_ports;
775727b3fe2SEd Czeck
7761131cbf0SEd Czeck dev_info->max_rx_pktlen = ARK_RX_MAX_PKT_LEN;
7771131cbf0SEd Czeck dev_info->min_rx_bufsize = ARK_RX_MIN_BUFSIZE;
7781131cbf0SEd Czeck
779727b3fe2SEd Czeck dev_info->max_rx_queues = ark_api_num_queues_per_port(rx_mpu, ports);
780727b3fe2SEd Czeck dev_info->max_tx_queues = ark_api_num_queues_per_port(tx_mpu, ports);
781727b3fe2SEd Czeck
7821131cbf0SEd Czeck dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
7831131cbf0SEd Czeck .nb_max = ARK_RX_MAX_QUEUE,
7841131cbf0SEd Czeck .nb_min = ARK_RX_MIN_QUEUE,
7851131cbf0SEd Czeck .nb_align = ARK_RX_MIN_QUEUE}; /* power of 2 */
7861131cbf0SEd Czeck
7871131cbf0SEd Czeck dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
7881131cbf0SEd Czeck .nb_max = ARK_TX_MAX_QUEUE,
7891131cbf0SEd Czeck .nb_min = ARK_TX_MIN_QUEUE,
7901131cbf0SEd Czeck .nb_align = ARK_TX_MIN_QUEUE}; /* power of 2 */
7911131cbf0SEd Czeck
7921131cbf0SEd Czeck /* ARK PMD supports all line rates, how do we indicate that here ?? */
793295968d1SFerruh Yigit dev_info->speed_capa = (RTE_ETH_LINK_SPEED_1G |
794295968d1SFerruh Yigit RTE_ETH_LINK_SPEED_10G |
795295968d1SFerruh Yigit RTE_ETH_LINK_SPEED_25G |
796295968d1SFerruh Yigit RTE_ETH_LINK_SPEED_40G |
797295968d1SFerruh Yigit RTE_ETH_LINK_SPEED_50G |
798295968d1SFerruh Yigit RTE_ETH_LINK_SPEED_100G);
799bdad90d1SIvan Ilchenko
800295968d1SFerruh Yigit dev_info->rx_offload_capa = RTE_ETH_RX_OFFLOAD_TIMESTAMP;
801a926951aSThomas Monjalon
802bdad90d1SIvan Ilchenko return 0;
8031131cbf0SEd Czeck }
8041131cbf0SEd Czeck
805727b3fe2SEd Czeck static int
eth_ark_dev_link_update(struct rte_eth_dev * dev,int wait_to_complete)806727b3fe2SEd Czeck eth_ark_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
807727b3fe2SEd Czeck {
8081502d443SEd Czeck ARK_PMD_LOG(DEBUG, "link status = %d\n",
809727b3fe2SEd Czeck dev->data->dev_link.link_status);
8100bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
811727b3fe2SEd Czeck
812727b3fe2SEd Czeck if (ark->user_ext.link_update) {
813727b3fe2SEd Czeck return ark->user_ext.link_update
814727b3fe2SEd Czeck (dev, wait_to_complete,
815428046b4SJohn Miller ark->user_data[dev->data->port_id]);
816727b3fe2SEd Czeck }
817727b3fe2SEd Czeck return 0;
818727b3fe2SEd Czeck }
819727b3fe2SEd Czeck
820727b3fe2SEd Czeck static int
eth_ark_dev_set_link_up(struct rte_eth_dev * dev)821727b3fe2SEd Czeck eth_ark_dev_set_link_up(struct rte_eth_dev *dev)
822727b3fe2SEd Czeck {
823727b3fe2SEd Czeck dev->data->dev_link.link_status = 1;
8240bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
825727b3fe2SEd Czeck
826727b3fe2SEd Czeck if (ark->user_ext.dev_set_link_up)
827428046b4SJohn Miller return ark->user_ext.dev_set_link_up(dev,
828428046b4SJohn Miller ark->user_data[dev->data->port_id]);
829727b3fe2SEd Czeck return 0;
830727b3fe2SEd Czeck }
831727b3fe2SEd Czeck
832727b3fe2SEd Czeck static int
eth_ark_dev_set_link_down(struct rte_eth_dev * dev)833727b3fe2SEd Czeck eth_ark_dev_set_link_down(struct rte_eth_dev *dev)
834727b3fe2SEd Czeck {
835727b3fe2SEd Czeck dev->data->dev_link.link_status = 0;
8360bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
837727b3fe2SEd Czeck
838727b3fe2SEd Czeck if (ark->user_ext.dev_set_link_down)
839428046b4SJohn Miller return ark->user_ext.dev_set_link_down(dev,
840428046b4SJohn Miller ark->user_data[dev->data->port_id]);
841727b3fe2SEd Czeck return 0;
842727b3fe2SEd Czeck }
843727b3fe2SEd Czeck
844d5b0924bSMatan Azrad static int
eth_ark_dev_stats_get(struct rte_eth_dev * dev,struct rte_eth_stats * stats)845727b3fe2SEd Czeck eth_ark_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
846727b3fe2SEd Czeck {
847727b3fe2SEd Czeck uint16_t i;
8480bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
849727b3fe2SEd Czeck
850727b3fe2SEd Czeck stats->ipackets = 0;
851727b3fe2SEd Czeck stats->ibytes = 0;
852727b3fe2SEd Czeck stats->opackets = 0;
853727b3fe2SEd Czeck stats->obytes = 0;
854727b3fe2SEd Czeck stats->imissed = 0;
855727b3fe2SEd Czeck stats->oerrors = 0;
856727b3fe2SEd Czeck
857727b3fe2SEd Czeck for (i = 0; i < dev->data->nb_tx_queues; i++)
858727b3fe2SEd Czeck eth_tx_queue_stats_get(dev->data->tx_queues[i], stats);
859727b3fe2SEd Czeck for (i = 0; i < dev->data->nb_rx_queues; i++)
860727b3fe2SEd Czeck eth_rx_queue_stats_get(dev->data->rx_queues[i], stats);
861727b3fe2SEd Czeck if (ark->user_ext.stats_get)
862d5b0924bSMatan Azrad return ark->user_ext.stats_get(dev, stats,
863428046b4SJohn Miller ark->user_data[dev->data->port_id]);
864d5b0924bSMatan Azrad return 0;
865727b3fe2SEd Czeck }
866727b3fe2SEd Czeck
8679970a9adSIgor Romanov static int
eth_ark_dev_stats_reset(struct rte_eth_dev * dev)868727b3fe2SEd Czeck eth_ark_dev_stats_reset(struct rte_eth_dev *dev)
869727b3fe2SEd Czeck {
870727b3fe2SEd Czeck uint16_t i;
8710bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
872727b3fe2SEd Czeck
873727b3fe2SEd Czeck for (i = 0; i < dev->data->nb_tx_queues; i++)
874f588d3a5SJohn Miller eth_tx_queue_stats_reset(dev->data->tx_queues[i]);
875727b3fe2SEd Czeck for (i = 0; i < dev->data->nb_rx_queues; i++)
876727b3fe2SEd Czeck eth_rx_queue_stats_reset(dev->data->rx_queues[i]);
877727b3fe2SEd Czeck if (ark->user_ext.stats_reset)
878428046b4SJohn Miller ark->user_ext.stats_reset(dev,
879428046b4SJohn Miller ark->user_data[dev->data->port_id]);
8809970a9adSIgor Romanov
8819970a9adSIgor Romanov return 0;
882727b3fe2SEd Czeck }
883727b3fe2SEd Czeck
8846d01e580SWei Dai static int
eth_ark_macaddr_add(struct rte_eth_dev * dev,struct rte_ether_addr * mac_addr,uint32_t index,uint32_t pool)885727b3fe2SEd Czeck eth_ark_macaddr_add(struct rte_eth_dev *dev,
8866d13ea8eSOlivier Matz struct rte_ether_addr *mac_addr,
887727b3fe2SEd Czeck uint32_t index,
888727b3fe2SEd Czeck uint32_t pool)
889727b3fe2SEd Czeck {
8900bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
891727b3fe2SEd Czeck
8926d01e580SWei Dai if (ark->user_ext.mac_addr_add) {
893727b3fe2SEd Czeck ark->user_ext.mac_addr_add(dev,
894727b3fe2SEd Czeck mac_addr,
895727b3fe2SEd Czeck index,
896727b3fe2SEd Czeck pool,
897428046b4SJohn Miller ark->user_data[dev->data->port_id]);
8986d01e580SWei Dai return 0;
8996d01e580SWei Dai }
9006d01e580SWei Dai return -ENOTSUP;
901727b3fe2SEd Czeck }
902727b3fe2SEd Czeck
903727b3fe2SEd Czeck static void
eth_ark_macaddr_remove(struct rte_eth_dev * dev,uint32_t index)904727b3fe2SEd Czeck eth_ark_macaddr_remove(struct rte_eth_dev *dev, uint32_t index)
905727b3fe2SEd Czeck {
9060bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
907727b3fe2SEd Czeck
908727b3fe2SEd Czeck if (ark->user_ext.mac_addr_remove)
909428046b4SJohn Miller ark->user_ext.mac_addr_remove(dev, index,
910428046b4SJohn Miller ark->user_data[dev->data->port_id]);
911727b3fe2SEd Czeck }
912727b3fe2SEd Czeck
913caccf8b3SOlivier Matz static int
eth_ark_set_default_mac_addr(struct rte_eth_dev * dev,struct rte_ether_addr * mac_addr)914727b3fe2SEd Czeck eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,
9156d13ea8eSOlivier Matz struct rte_ether_addr *mac_addr)
916727b3fe2SEd Czeck {
9170bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
918727b3fe2SEd Czeck
919caccf8b3SOlivier Matz if (ark->user_ext.mac_addr_set) {
920428046b4SJohn Miller ark->user_ext.mac_addr_set(dev, mac_addr,
921428046b4SJohn Miller ark->user_data[dev->data->port_id]);
922caccf8b3SOlivier Matz return 0;
923caccf8b3SOlivier Matz }
924caccf8b3SOlivier Matz return -ENOTSUP;
925727b3fe2SEd Czeck }
926727b3fe2SEd Czeck
9279ae74488SJohn Miller static int
eth_ark_set_mtu(struct rte_eth_dev * dev,uint16_t size)9289ae74488SJohn Miller eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size)
9299ae74488SJohn Miller {
9300bf8b0f1SStephen Hemminger struct ark_adapter *ark = dev->data->dev_private;
9319ae74488SJohn Miller
9329ae74488SJohn Miller if (ark->user_ext.set_mtu)
9339ae74488SJohn Miller return ark->user_ext.set_mtu(dev, size,
9349ae74488SJohn Miller ark->user_data[dev->data->port_id]);
9359ae74488SJohn Miller
9369ae74488SJohn Miller return -ENOTSUP;
9379ae74488SJohn Miller }
9389ae74488SJohn Miller
9391131cbf0SEd Czeck static inline int
process_pktdir_arg(const char * key,const char * value,void * extra_args)9401131cbf0SEd Czeck process_pktdir_arg(const char *key, const char *value,
9411131cbf0SEd Czeck void *extra_args)
9421131cbf0SEd Czeck {
9431502d443SEd Czeck ARK_PMD_LOG(DEBUG, "key = %s, value = %s\n",
9441131cbf0SEd Czeck key, value);
9451131cbf0SEd Czeck struct ark_adapter *ark =
9461131cbf0SEd Czeck (struct ark_adapter *)extra_args;
9471131cbf0SEd Czeck
9481131cbf0SEd Czeck ark->pkt_dir_v = strtol(value, NULL, 16);
9491502d443SEd Czeck ARK_PMD_LOG(DEBUG, "pkt_dir_v = 0x%x\n", ark->pkt_dir_v);
9501131cbf0SEd Czeck return 0;
9511131cbf0SEd Czeck }
9521131cbf0SEd Czeck
9531131cbf0SEd Czeck static inline int
process_file_args(const char * key,const char * value,void * extra_args)9541131cbf0SEd Czeck process_file_args(const char *key, const char *value, void *extra_args)
9551131cbf0SEd Czeck {
9561502d443SEd Czeck ARK_PMD_LOG(DEBUG, "key = %s, value = %s\n",
9571131cbf0SEd Czeck key, value);
9581131cbf0SEd Czeck char *args = (char *)extra_args;
9591131cbf0SEd Czeck
9601131cbf0SEd Czeck /* Open the configuration file */
9611131cbf0SEd Czeck FILE *file = fopen(value, "r");
9621131cbf0SEd Czeck char line[ARK_MAX_ARG_LEN];
9631131cbf0SEd Czeck int size = 0;
9641131cbf0SEd Czeck int first = 1;
9651131cbf0SEd Czeck
9662f3b88fbSJohn Miller if (file == NULL) {
9671502d443SEd Czeck ARK_PMD_LOG(ERR, "Unable to open "
9682f3b88fbSJohn Miller "config file %s\n", value);
9692f3b88fbSJohn Miller return -1;
9702f3b88fbSJohn Miller }
9712f3b88fbSJohn Miller
9721131cbf0SEd Czeck while (fgets(line, sizeof(line), file)) {
9731131cbf0SEd Czeck size += strlen(line);
9741131cbf0SEd Czeck if (size >= ARK_MAX_ARG_LEN) {
9751502d443SEd Czeck ARK_PMD_LOG(ERR, "Unable to parse file %s args, "
9761131cbf0SEd Czeck "parameter list is too long\n", value);
9771131cbf0SEd Czeck fclose(file);
9781131cbf0SEd Czeck return -1;
9791131cbf0SEd Czeck }
9801131cbf0SEd Czeck if (first) {
9811131cbf0SEd Czeck strncpy(args, line, ARK_MAX_ARG_LEN);
9821131cbf0SEd Czeck first = 0;
9831131cbf0SEd Czeck } else {
9841131cbf0SEd Czeck strncat(args, line, ARK_MAX_ARG_LEN);
9851131cbf0SEd Czeck }
9861131cbf0SEd Czeck }
9871502d443SEd Czeck ARK_PMD_LOG(DEBUG, "file = %s\n", args);
9881131cbf0SEd Czeck fclose(file);
9891131cbf0SEd Czeck return 0;
9901131cbf0SEd Czeck }
9911131cbf0SEd Czeck
9921131cbf0SEd Czeck static int
eth_ark_check_args(struct ark_adapter * ark,const char * params)9931131cbf0SEd Czeck eth_ark_check_args(struct ark_adapter *ark, const char *params)
9941131cbf0SEd Czeck {
9951131cbf0SEd Czeck struct rte_kvargs *kvlist;
9961131cbf0SEd Czeck unsigned int k_idx;
9971131cbf0SEd Czeck struct rte_kvargs_pair *pair = NULL;
9980f31eb0cSFerruh Yigit int ret = -1;
9991131cbf0SEd Czeck
10001131cbf0SEd Czeck kvlist = rte_kvargs_parse(params, valid_arguments);
10011131cbf0SEd Czeck if (kvlist == NULL)
10021131cbf0SEd Czeck return 0;
10031131cbf0SEd Czeck
10041131cbf0SEd Czeck ark->pkt_gen_args[0] = 0;
10051131cbf0SEd Czeck ark->pkt_chkr_args[0] = 0;
10061131cbf0SEd Czeck
10071131cbf0SEd Czeck for (k_idx = 0; k_idx < kvlist->count; k_idx++) {
10081131cbf0SEd Czeck pair = &kvlist->pairs[k_idx];
10091502d443SEd Czeck ARK_PMD_LOG(DEBUG, "**** Arg passed to PMD = %s:%s\n",
10101131cbf0SEd Czeck pair->key,
10111131cbf0SEd Czeck pair->value);
10121131cbf0SEd Czeck }
10131131cbf0SEd Czeck
10141131cbf0SEd Czeck if (rte_kvargs_process(kvlist,
10151131cbf0SEd Czeck ARK_PKTDIR_ARG,
10161131cbf0SEd Czeck &process_pktdir_arg,
10171131cbf0SEd Czeck ark) != 0) {
10181502d443SEd Czeck ARK_PMD_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTDIR_ARG);
10190f31eb0cSFerruh Yigit goto free_kvlist;
10201131cbf0SEd Czeck }
10211131cbf0SEd Czeck
10221131cbf0SEd Czeck if (rte_kvargs_process(kvlist,
10231131cbf0SEd Czeck ARK_PKTGEN_ARG,
10241131cbf0SEd Czeck &process_file_args,
10251131cbf0SEd Czeck ark->pkt_gen_args) != 0) {
10261502d443SEd Czeck ARK_PMD_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTGEN_ARG);
10270f31eb0cSFerruh Yigit goto free_kvlist;
10281131cbf0SEd Czeck }
10291131cbf0SEd Czeck
10301131cbf0SEd Czeck if (rte_kvargs_process(kvlist,
10311131cbf0SEd Czeck ARK_PKTCHKR_ARG,
10321131cbf0SEd Czeck &process_file_args,
10331131cbf0SEd Czeck ark->pkt_chkr_args) != 0) {
10341502d443SEd Czeck ARK_PMD_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTCHKR_ARG);
10350f31eb0cSFerruh Yigit goto free_kvlist;
10361131cbf0SEd Czeck }
10371131cbf0SEd Czeck
10381502d443SEd Czeck ARK_PMD_LOG(INFO, "packet director set to 0x%x\n", ark->pkt_dir_v);
1039727b3fe2SEd Czeck /* Setup the packet director */
1040727b3fe2SEd Czeck ark_pktdir_setup(ark->pd, ark->pkt_dir_v);
1041727b3fe2SEd Czeck
1042727b3fe2SEd Czeck /* Setup the packet generator */
1043727b3fe2SEd Czeck if (ark->pkt_gen_args[0]) {
10441502d443SEd Czeck ARK_PMD_LOG(DEBUG, "Setting up the packet generator\n");
1045727b3fe2SEd Czeck ark_pktgen_parse(ark->pkt_gen_args);
1046727b3fe2SEd Czeck ark_pktgen_reset(ark->pg);
1047727b3fe2SEd Czeck ark_pktgen_setup(ark->pg);
1048727b3fe2SEd Czeck ark->start_pg = 1;
1049727b3fe2SEd Czeck }
1050727b3fe2SEd Czeck
1051727b3fe2SEd Czeck /* Setup the packet checker */
1052727b3fe2SEd Czeck if (ark->pkt_chkr_args[0]) {
1053727b3fe2SEd Czeck ark_pktchkr_parse(ark->pkt_chkr_args);
1054727b3fe2SEd Czeck ark_pktchkr_setup(ark->pc);
1055727b3fe2SEd Czeck }
10561131cbf0SEd Czeck
10570f31eb0cSFerruh Yigit ret = 0;
10580f31eb0cSFerruh Yigit
10590f31eb0cSFerruh Yigit free_kvlist:
10600f31eb0cSFerruh Yigit rte_kvargs_free(kvlist);
10610f31eb0cSFerruh Yigit
10620f31eb0cSFerruh Yigit return ret;
10631131cbf0SEd Czeck }
10641131cbf0SEd Czeck
10651131cbf0SEd Czeck RTE_PMD_REGISTER_PCI(net_ark, rte_ark_pmd);
10661131cbf0SEd Czeck RTE_PMD_REGISTER_KMOD_DEP(net_ark, "* igb_uio | uio_pci_generic ");
10671131cbf0SEd Czeck RTE_PMD_REGISTER_PCI_TABLE(net_ark, pci_id_ark_map);
10681131cbf0SEd Czeck RTE_PMD_REGISTER_PARAM_STRING(net_ark,
10691131cbf0SEd Czeck ARK_PKTGEN_ARG "=<filename> "
10701131cbf0SEd Czeck ARK_PKTCHKR_ARG "=<filename> "
10711131cbf0SEd Czeck ARK_PKTDIR_ARG "=<bitmap>");
1072eeded204SDavid Marchand RTE_LOG_REGISTER_DEFAULT(ark_logtype, NOTICE);
1073