fbf3f7a054263f9d6574b9fc3f0265c06882e32d
[dpdk.git] / drivers / net / ionic / ionic_ethdev.c
1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
3  */
4
5 #include <rte_pci.h>
6 #include <rte_bus_pci.h>
7 #include <rte_ethdev.h>
8 #include <rte_ethdev_driver.h>
9 #include <rte_malloc.h>
10 #include <rte_ethdev_pci.h>
11
12 #include "ionic_logs.h"
13 #include "ionic.h"
14 #include "ionic_dev.h"
15 #include "ionic_mac_api.h"
16 #include "ionic_lif.h"
17 #include "ionic_ethdev.h"
18
19 static int  eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params);
20 static int  eth_ionic_dev_uninit(struct rte_eth_dev *eth_dev);
21 static int  ionic_dev_info_get(struct rte_eth_dev *eth_dev,
22         struct rte_eth_dev_info *dev_info);
23 static int  ionic_dev_configure(struct rte_eth_dev *dev);
24 static int  ionic_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
25 static int  ionic_dev_start(struct rte_eth_dev *dev);
26 static void ionic_dev_stop(struct rte_eth_dev *dev);
27 static void ionic_dev_close(struct rte_eth_dev *dev);
28 static int  ionic_dev_set_link_up(struct rte_eth_dev *dev);
29 static int  ionic_dev_set_link_down(struct rte_eth_dev *dev);
30 static int  ionic_dev_link_update(struct rte_eth_dev *eth_dev,
31         int wait_to_complete);
32
33 int ionic_logtype;
34
35 static const struct rte_pci_id pci_id_ionic_map[] = {
36         { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_PF) },
37         { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_VF) },
38         { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_MGMT) },
39         { .vendor_id = 0, /* sentinel */ },
40 };
41
42 static const struct eth_dev_ops ionic_eth_dev_ops = {
43         .dev_infos_get          = ionic_dev_info_get,
44         .dev_configure          = ionic_dev_configure,
45         .mtu_set                = ionic_dev_mtu_set,
46         .dev_start              = ionic_dev_start,
47         .dev_stop               = ionic_dev_stop,
48         .dev_close              = ionic_dev_close,
49         .link_update            = ionic_dev_link_update,
50         .dev_set_link_up        = ionic_dev_set_link_up,
51         .dev_set_link_down      = ionic_dev_set_link_down,
52         .mac_addr_add           = ionic_dev_add_mac,
53         .mac_addr_remove        = ionic_dev_remove_mac,
54         .mac_addr_set           = ionic_dev_set_mac,
55         .vlan_filter_set        = ionic_dev_vlan_filter_set,
56         .promiscuous_enable     = ionic_dev_promiscuous_enable,
57         .promiscuous_disable    = ionic_dev_promiscuous_disable,
58         .allmulticast_enable    = ionic_dev_allmulticast_enable,
59         .allmulticast_disable   = ionic_dev_allmulticast_disable,
60 };
61
62 /*
63  * Set device link up, enable tx.
64  */
65 static int
66 ionic_dev_set_link_up(struct rte_eth_dev *eth_dev)
67 {
68         struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
69         struct ionic_adapter *adapter = lif->adapter;
70         struct ionic_dev *idev = &adapter->idev;
71         int err;
72
73         IONIC_PRINT_CALL();
74
75         ionic_dev_cmd_port_state(idev, IONIC_PORT_ADMIN_STATE_UP);
76
77         err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
78         if (err) {
79                 IONIC_PRINT(WARNING, "Failed to bring port UP");
80                 return err;
81         }
82
83         return 0;
84 }
85
86 /*
87  * Set device link down, disable tx.
88  */
89 static int
90 ionic_dev_set_link_down(struct rte_eth_dev *eth_dev)
91 {
92         struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
93         struct ionic_adapter *adapter = lif->adapter;
94         struct ionic_dev *idev = &adapter->idev;
95         int err;
96
97         IONIC_PRINT_CALL();
98
99         ionic_dev_cmd_port_state(idev, IONIC_PORT_ADMIN_STATE_DOWN);
100
101         err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
102         if (err) {
103                 IONIC_PRINT(WARNING, "Failed to bring port DOWN");
104                 return err;
105         }
106
107         return 0;
108 }
109
110 static int
111 ionic_dev_link_update(struct rte_eth_dev *eth_dev,
112                 int wait_to_complete __rte_unused)
113 {
114         struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
115         struct ionic_adapter *adapter = lif->adapter;
116         struct rte_eth_link link;
117
118         IONIC_PRINT_CALL();
119
120         /* Initialize */
121         memset(&link, 0, sizeof(link));
122         link.link_autoneg = ETH_LINK_AUTONEG;
123
124         if (!adapter->link_up) {
125                 /* Interface is down */
126                 link.link_status = ETH_LINK_DOWN;
127                 link.link_duplex = ETH_LINK_HALF_DUPLEX;
128                 link.link_speed = ETH_SPEED_NUM_NONE;
129         } else {
130                 /* Interface is up */
131                 link.link_status = ETH_LINK_UP;
132                 link.link_duplex = ETH_LINK_FULL_DUPLEX;
133                 switch (adapter->link_speed) {
134                 case  10000:
135                         link.link_speed = ETH_SPEED_NUM_10G;
136                         break;
137                 case  25000:
138                         link.link_speed = ETH_SPEED_NUM_25G;
139                         break;
140                 case  40000:
141                         link.link_speed = ETH_SPEED_NUM_40G;
142                         break;
143                 case  50000:
144                         link.link_speed = ETH_SPEED_NUM_50G;
145                         break;
146                 case 100000:
147                         link.link_speed = ETH_SPEED_NUM_100G;
148                         break;
149                 default:
150                         link.link_speed = ETH_SPEED_NUM_NONE;
151                         break;
152                 }
153         }
154
155         return rte_eth_linkstatus_set(eth_dev, &link);
156 }
157
158 /**
159  * Interrupt handler triggered by NIC for handling
160  * specific interrupt.
161  *
162  * @param param
163  *  The address of parameter registered before.
164  *
165  * @return
166  *  void
167  */
168 static void
169 ionic_dev_interrupt_handler(void *param)
170 {
171         struct ionic_adapter *adapter = (struct ionic_adapter *)param;
172         uint32_t i;
173
174         IONIC_PRINT(DEBUG, "->");
175
176         for (i = 0; i < adapter->nlifs; i++) {
177                 if (adapter->lifs[i])
178                         ionic_notifyq_handler(adapter->lifs[i], -1);
179         }
180 }
181
182 static int
183 ionic_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
184 {
185         struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
186         uint32_t max_frame_size;
187         int err;
188
189         IONIC_PRINT_CALL();
190
191         /*
192          * Note: mtu check against IONIC_MIN_MTU, IONIC_MAX_MTU
193          * is done by the the API.
194          */
195
196         /*
197          * Max frame size is MTU + Ethernet header + VLAN + QinQ
198          * (plus ETHER_CRC_LEN if the adapter is able to keep CRC)
199          */
200         max_frame_size = mtu + RTE_ETHER_HDR_LEN + 4 + 4;
201
202         if (eth_dev->data->dev_conf.rxmode.max_rx_pkt_len < max_frame_size)
203                 return -EINVAL;
204
205         err = ionic_lif_change_mtu(lif, mtu);
206         if (err)
207                 return err;
208
209         return 0;
210 }
211
212 static int
213 ionic_dev_info_get(struct rte_eth_dev *eth_dev,
214                 struct rte_eth_dev_info *dev_info)
215 {
216         struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
217         struct ionic_adapter *adapter = lif->adapter;
218         struct ionic_identity *ident = &adapter->ident;
219
220         IONIC_PRINT_CALL();
221
222         dev_info->max_rx_queues = (uint16_t)
223                 ident->lif.eth.config.queue_count[IONIC_QTYPE_RXQ];
224         dev_info->max_tx_queues = (uint16_t)
225                 ident->lif.eth.config.queue_count[IONIC_QTYPE_TXQ];
226         /* Also add ETHER_CRC_LEN if the adapter is able to keep CRC */
227         dev_info->min_rx_bufsize = IONIC_MIN_MTU + RTE_ETHER_HDR_LEN;
228         dev_info->max_rx_pktlen = IONIC_MAX_MTU + RTE_ETHER_HDR_LEN;
229         dev_info->max_mac_addrs = adapter->max_mac_addrs;
230         dev_info->min_mtu = IONIC_MIN_MTU;
231         dev_info->max_mtu = IONIC_MAX_MTU;
232
233         dev_info->speed_capa =
234                 ETH_LINK_SPEED_10G |
235                 ETH_LINK_SPEED_25G |
236                 ETH_LINK_SPEED_40G |
237                 ETH_LINK_SPEED_50G |
238                 ETH_LINK_SPEED_100G;
239
240         return 0;
241 }
242
243 static int
244 ionic_dev_configure(struct rte_eth_dev *eth_dev)
245 {
246         struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
247         int err;
248
249         IONIC_PRINT_CALL();
250
251         err = ionic_lif_configure(lif);
252         if (err) {
253                 IONIC_PRINT(ERR, "Cannot configure LIF: %d", err);
254                 return err;
255         }
256
257         return 0;
258 }
259
260 static inline uint32_t
261 ionic_parse_link_speeds(uint16_t link_speeds)
262 {
263         if (link_speeds & ETH_LINK_SPEED_100G)
264                 return 100000;
265         else if (link_speeds & ETH_LINK_SPEED_50G)
266                 return 50000;
267         else if (link_speeds & ETH_LINK_SPEED_40G)
268                 return 40000;
269         else if (link_speeds & ETH_LINK_SPEED_25G)
270                 return 25000;
271         else if (link_speeds & ETH_LINK_SPEED_10G)
272                 return 10000;
273         else
274                 return 0;
275 }
276
277 /*
278  * Configure device link speed and setup link.
279  * It returns 0 on success.
280  */
281 static int
282 ionic_dev_start(struct rte_eth_dev *eth_dev)
283 {
284         struct rte_eth_conf *dev_conf = &eth_dev->data->dev_conf;
285         struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
286         struct ionic_adapter *adapter = lif->adapter;
287         struct ionic_dev *idev = &adapter->idev;
288         uint32_t allowed_speeds;
289         int err;
290
291         IONIC_PRINT_CALL();
292
293         allowed_speeds =
294                 ETH_LINK_SPEED_FIXED |
295                 ETH_LINK_SPEED_10G |
296                 ETH_LINK_SPEED_25G |
297                 ETH_LINK_SPEED_40G |
298                 ETH_LINK_SPEED_50G |
299                 ETH_LINK_SPEED_100G;
300
301         if (dev_conf->link_speeds & ~allowed_speeds) {
302                 IONIC_PRINT(ERR, "Invalid link setting");
303                 return -EINVAL;
304         }
305
306         err = ionic_lif_start(lif);
307         if (err) {
308                 IONIC_PRINT(ERR, "Cannot start LIF: %d", err);
309                 return err;
310         }
311
312         if (eth_dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED) {
313                 uint32_t speed = ionic_parse_link_speeds(dev_conf->link_speeds);
314
315                 if (speed)
316                         ionic_dev_cmd_port_speed(idev, speed);
317         }
318
319         ionic_dev_link_update(eth_dev, 0);
320
321         return 0;
322 }
323
324 /*
325  * Stop device: disable rx and tx functions to allow for reconfiguring.
326  */
327 static void
328 ionic_dev_stop(struct rte_eth_dev *eth_dev)
329 {
330         struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
331         int err;
332
333         IONIC_PRINT_CALL();
334
335         err = ionic_lif_stop(lif);
336         if (err)
337                 IONIC_PRINT(ERR, "Cannot stop LIF: %d", err);
338 }
339
340 /*
341  * Reset and stop device.
342  */
343 static void
344 ionic_dev_close(struct rte_eth_dev *eth_dev)
345 {
346         struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
347         int err;
348
349         IONIC_PRINT_CALL();
350
351         err = ionic_lif_stop(lif);
352         if (err) {
353                 IONIC_PRINT(ERR, "Cannot stop LIF: %d", err);
354                 return;
355         }
356
357         err = eth_ionic_dev_uninit(eth_dev);
358         if (err) {
359                 IONIC_PRINT(ERR, "Cannot destroy LIF: %d", err);
360                 return;
361         }
362 }
363
364 static int
365 eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
366 {
367         struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
368         struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
369         struct ionic_adapter *adapter = (struct ionic_adapter *)init_params;
370         int err;
371
372         IONIC_PRINT_CALL();
373
374         eth_dev->dev_ops = &ionic_eth_dev_ops;
375
376         /* Multi-process not supported, primary does initialization anyway */
377         if (rte_eal_process_type() != RTE_PROC_PRIMARY)
378                 return 0;
379
380         rte_eth_copy_pci_info(eth_dev, pci_dev);
381
382         lif->index = adapter->nlifs;
383         lif->eth_dev = eth_dev;
384         lif->adapter = adapter;
385         adapter->lifs[adapter->nlifs] = lif;
386
387         IONIC_PRINT(DEBUG, "Up to %u MAC addresses supported",
388                 adapter->max_mac_addrs);
389
390         /* Allocate memory for storing MAC addresses */
391         eth_dev->data->mac_addrs = rte_zmalloc("ionic",
392                 RTE_ETHER_ADDR_LEN * adapter->max_mac_addrs, 0);
393
394         if (eth_dev->data->mac_addrs == NULL) {
395                 IONIC_PRINT(ERR, "Failed to allocate %u bytes needed to "
396                         "store MAC addresses",
397                         RTE_ETHER_ADDR_LEN * adapter->max_mac_addrs);
398                 err = -ENOMEM;
399                 goto err;
400         }
401
402         err = ionic_lif_alloc(lif);
403         if (err) {
404                 IONIC_PRINT(ERR, "Cannot allocate LIFs: %d, aborting",
405                         err);
406                 goto err;
407         }
408
409         err = ionic_lif_init(lif);
410         if (err) {
411                 IONIC_PRINT(ERR, "Cannot init LIFs: %d, aborting", err);
412                 goto err_free_lif;
413         }
414
415         /* Copy the MAC address */
416         rte_ether_addr_copy((struct rte_ether_addr *)lif->mac_addr,
417                 &eth_dev->data->mac_addrs[0]);
418
419         IONIC_PRINT(DEBUG, "Port %u initialized", eth_dev->data->port_id);
420
421         return 0;
422
423 err_free_lif:
424         ionic_lif_free(lif);
425 err:
426         return err;
427 }
428
429 static int
430 eth_ionic_dev_uninit(struct rte_eth_dev *eth_dev)
431 {
432         struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
433         struct ionic_adapter *adapter = lif->adapter;
434
435         IONIC_PRINT_CALL();
436
437         if (rte_eal_process_type() != RTE_PROC_PRIMARY)
438                 return 0;
439
440         adapter->lifs[lif->index] = NULL;
441
442         ionic_lif_deinit(lif);
443         ionic_lif_free(lif);
444
445         eth_dev->dev_ops = NULL;
446
447         return 0;
448 }
449
450 static int
451 ionic_configure_intr(struct ionic_adapter *adapter)
452 {
453         struct rte_pci_device *pci_dev = adapter->pci_dev;
454         struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
455         int err;
456
457         IONIC_PRINT(DEBUG, "Configuring %u intrs", adapter->nintrs);
458
459         if (rte_intr_efd_enable(intr_handle, adapter->nintrs)) {
460                 IONIC_PRINT(ERR, "Fail to create eventfd");
461                 return -1;
462         }
463
464         if (rte_intr_dp_is_en(intr_handle))
465                 IONIC_PRINT(DEBUG,
466                         "Packet I/O interrupt on datapath is enabled");
467
468         if (!intr_handle->intr_vec) {
469                 intr_handle->intr_vec = rte_zmalloc("intr_vec",
470                         adapter->nintrs * sizeof(int), 0);
471
472                 if (!intr_handle->intr_vec) {
473                         IONIC_PRINT(ERR, "Failed to allocate %u vectors",
474                                 adapter->nintrs);
475                         return -ENOMEM;
476                 }
477         }
478
479         err = rte_intr_callback_register(intr_handle,
480                 ionic_dev_interrupt_handler,
481                 adapter);
482
483         if (err) {
484                 IONIC_PRINT(ERR,
485                         "Failure registering interrupts handler (%d)",
486                         err);
487                 return err;
488         }
489
490         /* enable intr mapping */
491         err = rte_intr_enable(intr_handle);
492
493         if (err) {
494                 IONIC_PRINT(ERR, "Failure enabling interrupts (%d)", err);
495                 return err;
496         }
497
498         return 0;
499 }
500
501 static void
502 ionic_unconfigure_intr(struct ionic_adapter *adapter)
503 {
504         struct rte_pci_device *pci_dev = adapter->pci_dev;
505         struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
506
507         rte_intr_disable(intr_handle);
508
509         rte_intr_callback_unregister(intr_handle,
510                 ionic_dev_interrupt_handler,
511                 adapter);
512 }
513
514 static int
515 eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
516                 struct rte_pci_device *pci_dev)
517 {
518         char name[RTE_ETH_NAME_MAX_LEN];
519         struct rte_mem_resource *resource;
520         struct ionic_adapter *adapter;
521         struct ionic_hw *hw;
522         unsigned long i;
523         int err;
524
525         /* Check structs (trigger error at compilation time) */
526         ionic_struct_size_checks();
527
528         /* Multi-process not supported */
529         if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
530                 err = -EPERM;
531                 goto err;
532         }
533
534         IONIC_PRINT(DEBUG, "Initializing device %s",
535                 pci_dev->device.name);
536
537         adapter = rte_zmalloc("ionic", sizeof(*adapter), 0);
538         if (!adapter) {
539                 IONIC_PRINT(ERR, "OOM");
540                 err = -ENOMEM;
541                 goto err;
542         }
543
544         adapter->pci_dev = pci_dev;
545         hw = &adapter->hw;
546
547         hw->device_id = pci_dev->id.device_id;
548         hw->vendor_id = pci_dev->id.vendor_id;
549
550         err = ionic_init_mac(hw);
551         if (err != 0) {
552                 IONIC_PRINT(ERR, "Mac init failed: %d", err);
553                 err = -EIO;
554                 goto err_free_adapter;
555         }
556
557         adapter->is_mgmt_nic = (pci_dev->id.device_id == IONIC_DEV_ID_ETH_MGMT);
558
559         adapter->num_bars = 0;
560         for (i = 0; i < PCI_MAX_RESOURCE && i < IONIC_BARS_MAX; i++) {
561                 resource = &pci_dev->mem_resource[i];
562                 if (resource->phys_addr == 0 || resource->len == 0)
563                         continue;
564                 adapter->bars[adapter->num_bars].vaddr = resource->addr;
565                 adapter->bars[adapter->num_bars].bus_addr = resource->phys_addr;
566                 adapter->bars[adapter->num_bars].len = resource->len;
567                 adapter->num_bars++;
568         }
569
570         /* Discover ionic dev resources */
571
572         err = ionic_setup(adapter);
573         if (err) {
574                 IONIC_PRINT(ERR, "Cannot setup device: %d, aborting", err);
575                 goto err_free_adapter;
576         }
577
578         err = ionic_identify(adapter);
579         if (err) {
580                 IONIC_PRINT(ERR, "Cannot identify device: %d, aborting",
581                         err);
582                 goto err_free_adapter;
583         }
584
585         err = ionic_init(adapter);
586         if (err) {
587                 IONIC_PRINT(ERR, "Cannot init device: %d, aborting", err);
588                 goto err_free_adapter;
589         }
590
591         /* Configure the ports */
592         err = ionic_port_identify(adapter);
593         if (err) {
594                 IONIC_PRINT(ERR, "Cannot identify port: %d, aborting",
595                         err);
596                 goto err_free_adapter;
597         }
598
599         err = ionic_port_init(adapter);
600         if (err) {
601                 IONIC_PRINT(ERR, "Cannot init port: %d, aborting", err);
602                 goto err_free_adapter;
603         }
604
605         /* Configure LIFs */
606         err = ionic_lif_identify(adapter);
607         if (err) {
608                 IONIC_PRINT(ERR, "Cannot identify lif: %d, aborting", err);
609                 goto err_free_adapter;
610         }
611
612         /* Allocate and init LIFs */
613         err = ionic_lifs_size(adapter);
614         if (err) {
615                 IONIC_PRINT(ERR, "Cannot size LIFs: %d, aborting", err);
616                 goto err_free_adapter;
617         }
618
619         adapter->max_mac_addrs = adapter->ident.lif.eth.max_ucast_filters;
620
621         adapter->nlifs = 0;
622         for (i = 0; i < adapter->ident.dev.nlifs; i++) {
623                 snprintf(name, sizeof(name), "net_%s_lif_%lu",
624                         pci_dev->device.name, i);
625
626                 err = rte_eth_dev_create(&pci_dev->device, name,
627                         sizeof(struct ionic_lif),
628                         NULL, NULL,
629                         eth_ionic_dev_init, adapter);
630                 if (err) {
631                         IONIC_PRINT(ERR, "Cannot create eth device for "
632                                 "ionic lif %s", name);
633                         break;
634                 }
635
636                 adapter->nlifs++;
637         }
638
639         err = ionic_configure_intr(adapter);
640
641         if (err) {
642                 IONIC_PRINT(ERR, "Failed to configure interrupts");
643                 goto err_free_adapter;
644         }
645
646         return 0;
647
648 err_free_adapter:
649         rte_free(adapter);
650 err:
651         return err;
652 }
653
654 static int
655 eth_ionic_pci_remove(struct rte_pci_device *pci_dev __rte_unused)
656 {
657         char name[RTE_ETH_NAME_MAX_LEN];
658         struct ionic_adapter *adapter = NULL;
659         struct rte_eth_dev *eth_dev;
660         struct ionic_lif *lif;
661         uint32_t i;
662
663         /* Adapter lookup is using (the first) eth_dev name */
664         snprintf(name, sizeof(name), "net_%s_lif_0",
665                 pci_dev->device.name);
666
667         eth_dev = rte_eth_dev_allocated(name);
668         if (eth_dev) {
669                 lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
670                 adapter = lif->adapter;
671         }
672
673         if (adapter) {
674                 ionic_unconfigure_intr(adapter);
675
676                 for (i = 0; i < adapter->nlifs; i++) {
677                         lif = adapter->lifs[i];
678                         rte_eth_dev_destroy(lif->eth_dev, eth_ionic_dev_uninit);
679                 }
680
681                 rte_free(adapter);
682         }
683
684         return 0;
685 }
686
687 static struct rte_pci_driver rte_ionic_pmd = {
688         .id_table = pci_id_ionic_map,
689         .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
690         .probe = eth_ionic_pci_probe,
691         .remove = eth_ionic_pci_remove,
692 };
693
694 RTE_PMD_REGISTER_PCI(net_ionic, rte_ionic_pmd);
695 RTE_PMD_REGISTER_PCI_TABLE(net_ionic, pci_id_ionic_map);
696 RTE_PMD_REGISTER_KMOD_DEP(net_ionic, "* igb_uio | uio_pci_generic | vfio-pci");
697
698 RTE_INIT(ionic_init_log)
699 {
700         ionic_logtype = rte_log_register("pmd.net.ionic");
701         if (ionic_logtype >= 0)
702                 rte_log_set_level(ionic_logtype, RTE_LOG_NOTICE);
703 }