xref: /dpdk/drivers/net/nfp/nfp_ethdev.c (revision 448e01f1b5848b20cb0300d339100dd82f4459e9)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2014-2021 Netronome Systems, Inc.
3  * All rights reserved.
4  *
5  * Small portions derived from code Copyright(c) 2010-2015 Intel Corporation.
6  */
7 
8 /*
9  * vim:shiftwidth=8:noexpandtab
10  *
11  * @file dpdk/pmd/nfp_ethdev.c
12  *
13  * Netronome vNIC DPDK Poll-Mode Driver: Main entry point
14  */
15 
16 #include <rte_common.h>
17 #include <ethdev_driver.h>
18 #include <ethdev_pci.h>
19 #include <rte_dev.h>
20 #include <rte_ether.h>
21 #include <rte_malloc.h>
22 #include <rte_memzone.h>
23 #include <rte_mempool.h>
24 #include <rte_service_component.h>
25 #include <rte_alarm.h>
26 #include "eal_firmware.h"
27 
28 #include "nfpcore/nfp_cpp.h"
29 #include "nfpcore/nfp_nffw.h"
30 #include "nfpcore/nfp_hwinfo.h"
31 #include "nfpcore/nfp_mip.h"
32 #include "nfpcore/nfp_rtsym.h"
33 #include "nfpcore/nfp_nsp.h"
34 
35 #include "nfp_common.h"
36 #include "nfp_rxtx.h"
37 #include "nfp_logs.h"
38 #include "nfp_ctrl.h"
39 #include "nfp_cpp_bridge.h"
40 
41 static int
42 nfp_net_pf_read_mac(struct nfp_pf_dev *pf_dev, int port)
43 {
44 	struct nfp_eth_table *nfp_eth_table;
45 	struct nfp_net_hw *hw = NULL;
46 
47 	/* Grab a pointer to the correct physical port */
48 	hw = pf_dev->ports[port];
49 
50 	nfp_eth_table = nfp_eth_read_ports(pf_dev->cpp);
51 
52 	nfp_eth_copy_mac((uint8_t *)&hw->mac_addr,
53 			 (uint8_t *)&nfp_eth_table->ports[port].mac_addr);
54 
55 	free(nfp_eth_table);
56 	return 0;
57 }
58 
59 static int
60 nfp_net_start(struct rte_eth_dev *dev)
61 {
62 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
63 	struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
64 	uint32_t new_ctrl, update = 0;
65 	struct nfp_net_hw *hw;
66 	struct nfp_pf_dev *pf_dev;
67 	struct rte_eth_conf *dev_conf;
68 	struct rte_eth_rxmode *rxmode;
69 	uint32_t intr_vector;
70 	int ret;
71 
72 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
73 	pf_dev = NFP_NET_DEV_PRIVATE_TO_PF(dev->data->dev_private);
74 
75 	PMD_INIT_LOG(DEBUG, "Start");
76 
77 	/* Disabling queues just in case... */
78 	nfp_net_disable_queues(dev);
79 
80 	/* Enabling the required queues in the device */
81 	nfp_net_enable_queues(dev);
82 
83 	/* check and configure queue intr-vector mapping */
84 	if (dev->data->dev_conf.intr_conf.rxq != 0) {
85 		if (pf_dev->multiport) {
86 			PMD_INIT_LOG(ERR, "PMD rx interrupt is not supported "
87 					  "with NFP multiport PF");
88 				return -EINVAL;
89 		}
90 		if (rte_intr_type_get(intr_handle) ==
91 						RTE_INTR_HANDLE_UIO) {
92 			/*
93 			 * Better not to share LSC with RX interrupts.
94 			 * Unregistering LSC interrupt handler
95 			 */
96 			rte_intr_callback_unregister(pci_dev->intr_handle,
97 				nfp_net_dev_interrupt_handler, (void *)dev);
98 
99 			if (dev->data->nb_rx_queues > 1) {
100 				PMD_INIT_LOG(ERR, "PMD rx interrupt only "
101 					     "supports 1 queue with UIO");
102 				return -EIO;
103 			}
104 		}
105 		intr_vector = dev->data->nb_rx_queues;
106 		if (rte_intr_efd_enable(intr_handle, intr_vector))
107 			return -1;
108 
109 		nfp_configure_rx_interrupt(dev, intr_handle);
110 		update = NFP_NET_CFG_UPDATE_MSIX;
111 	}
112 
113 	rte_intr_enable(intr_handle);
114 
115 	new_ctrl = nfp_check_offloads(dev);
116 
117 	/* Writing configuration parameters in the device */
118 	nfp_net_params_setup(hw);
119 
120 	dev_conf = &dev->data->dev_conf;
121 	rxmode = &dev_conf->rxmode;
122 
123 	if (rxmode->mq_mode & RTE_ETH_MQ_RX_RSS) {
124 		nfp_net_rss_config_default(dev);
125 		update |= NFP_NET_CFG_UPDATE_RSS;
126 		if (hw->cap & NFP_NET_CFG_CTRL_RSS2)
127 			new_ctrl |= NFP_NET_CFG_CTRL_RSS2;
128 		else
129 			new_ctrl |= NFP_NET_CFG_CTRL_RSS;
130 	}
131 
132 	/* Enable device */
133 	new_ctrl |= NFP_NET_CFG_CTRL_ENABLE;
134 
135 	update |= NFP_NET_CFG_UPDATE_GEN | NFP_NET_CFG_UPDATE_RING;
136 
137 	if (hw->cap & NFP_NET_CFG_CTRL_RINGCFG)
138 		new_ctrl |= NFP_NET_CFG_CTRL_RINGCFG;
139 
140 	nn_cfg_writel(hw, NFP_NET_CFG_CTRL, new_ctrl);
141 	if (nfp_net_reconfig(hw, new_ctrl, update) < 0)
142 		return -EIO;
143 
144 	/*
145 	 * Allocating rte mbufs for configured rx queues.
146 	 * This requires queues being enabled before
147 	 */
148 	if (nfp_net_rx_freelist_setup(dev) < 0) {
149 		ret = -ENOMEM;
150 		goto error;
151 	}
152 
153 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
154 		/* Configure the physical port up */
155 		nfp_eth_set_configured(hw->cpp, hw->nfp_idx, 1);
156 	else
157 		nfp_eth_set_configured(dev->process_private,
158 				       hw->nfp_idx, 1);
159 
160 	hw->ctrl = new_ctrl;
161 
162 	return 0;
163 
164 error:
165 	/*
166 	 * An error returned by this function should mean the app
167 	 * exiting and then the system releasing all the memory
168 	 * allocated even memory coming from hugepages.
169 	 *
170 	 * The device could be enabled at this point with some queues
171 	 * ready for getting packets. This is true if the call to
172 	 * nfp_net_rx_freelist_setup() succeeds for some queues but
173 	 * fails for subsequent queues.
174 	 *
175 	 * This should make the app exiting but better if we tell the
176 	 * device first.
177 	 */
178 	nfp_net_disable_queues(dev);
179 
180 	return ret;
181 }
182 
183 /* Stop device: disable rx and tx functions to allow for reconfiguring. */
184 static int
185 nfp_net_stop(struct rte_eth_dev *dev)
186 {
187 	struct nfp_net_hw *hw;
188 
189 	PMD_INIT_LOG(DEBUG, "Stop");
190 
191 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
192 
193 	nfp_net_disable_queues(dev);
194 
195 	/* Clear queues */
196 	nfp_net_stop_tx_queue(dev);
197 
198 	nfp_net_stop_rx_queue(dev);
199 
200 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
201 		/* Configure the physical port down */
202 		nfp_eth_set_configured(hw->cpp, hw->nfp_idx, 0);
203 	else
204 		nfp_eth_set_configured(dev->process_private,
205 				       hw->nfp_idx, 0);
206 
207 	return 0;
208 }
209 
210 /* Set the link up. */
211 static int
212 nfp_net_set_link_up(struct rte_eth_dev *dev)
213 {
214 	struct nfp_net_hw *hw;
215 
216 	PMD_DRV_LOG(DEBUG, "Set link up");
217 
218 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
219 
220 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
221 		/* Configure the physical port down */
222 		return nfp_eth_set_configured(hw->cpp, hw->nfp_idx, 1);
223 	else
224 		return nfp_eth_set_configured(dev->process_private,
225 					      hw->nfp_idx, 1);
226 }
227 
228 /* Set the link down. */
229 static int
230 nfp_net_set_link_down(struct rte_eth_dev *dev)
231 {
232 	struct nfp_net_hw *hw;
233 
234 	PMD_DRV_LOG(DEBUG, "Set link down");
235 
236 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
237 
238 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
239 		/* Configure the physical port down */
240 		return nfp_eth_set_configured(hw->cpp, hw->nfp_idx, 0);
241 	else
242 		return nfp_eth_set_configured(dev->process_private,
243 					      hw->nfp_idx, 0);
244 }
245 
246 /* Reset and stop device. The device can not be restarted. */
247 static int
248 nfp_net_close(struct rte_eth_dev *dev)
249 {
250 	struct nfp_net_hw *hw;
251 	struct rte_pci_device *pci_dev;
252 	struct nfp_pf_dev *pf_dev;
253 	int i;
254 
255 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
256 		return 0;
257 
258 	PMD_INIT_LOG(DEBUG, "Close");
259 
260 	pf_dev = NFP_NET_DEV_PRIVATE_TO_PF(dev->data->dev_private);
261 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
262 	pci_dev = RTE_ETH_DEV_TO_PCI(dev);
263 
264 	/*
265 	 * We assume that the DPDK application is stopping all the
266 	 * threads/queues before calling the device close function.
267 	 */
268 
269 	nfp_net_disable_queues(dev);
270 
271 	/* Clear queues */
272 	nfp_net_close_tx_queue(dev);
273 
274 	nfp_net_close_rx_queue(dev);
275 
276 	/* Cancel possible impending LSC work here before releasing the port*/
277 	rte_eal_alarm_cancel(nfp_net_dev_interrupt_delayed_handler,
278 			     (void *)dev);
279 
280 	/* Only free PF resources after all physical ports have been closed */
281 	/* Mark this port as unused and free device priv resources*/
282 	nn_cfg_writeb(hw, NFP_NET_CFG_LSC, 0xff);
283 	pf_dev->ports[hw->idx] = NULL;
284 	rte_eth_dev_release_port(dev);
285 
286 	for (i = 0; i < pf_dev->total_phyports; i++) {
287 		/* Check to see if ports are still in use */
288 		if (pf_dev->ports[i])
289 			return 0;
290 	}
291 
292 	/* Now it is safe to free all PF resources */
293 	PMD_INIT_LOG(INFO, "Freeing PF resources");
294 	nfp_cpp_area_free(pf_dev->ctrl_area);
295 	nfp_cpp_area_free(pf_dev->hwqueues_area);
296 	free(pf_dev->hwinfo);
297 	free(pf_dev->sym_tbl);
298 	nfp_cpp_free(pf_dev->cpp);
299 	rte_free(pf_dev);
300 
301 	rte_intr_disable(pci_dev->intr_handle);
302 
303 	/* unregister callback func from eal lib */
304 	rte_intr_callback_unregister(pci_dev->intr_handle,
305 			nfp_net_dev_interrupt_handler, (void *)dev);
306 
307 	/*
308 	 * The ixgbe PMD disables the pcie master on the
309 	 * device. The i40e does not...
310 	 */
311 
312 	return 0;
313 }
314 
315 /* Initialise and register driver with DPDK Application */
316 static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = {
317 	.dev_configure		= nfp_net_configure,
318 	.dev_start		= nfp_net_start,
319 	.dev_stop		= nfp_net_stop,
320 	.dev_set_link_up	= nfp_net_set_link_up,
321 	.dev_set_link_down	= nfp_net_set_link_down,
322 	.dev_close		= nfp_net_close,
323 	.promiscuous_enable	= nfp_net_promisc_enable,
324 	.promiscuous_disable	= nfp_net_promisc_disable,
325 	.link_update		= nfp_net_link_update,
326 	.stats_get		= nfp_net_stats_get,
327 	.stats_reset		= nfp_net_stats_reset,
328 	.dev_infos_get		= nfp_net_infos_get,
329 	.dev_supported_ptypes_get = nfp_net_supported_ptypes_get,
330 	.mtu_set		= nfp_net_dev_mtu_set,
331 	.mac_addr_set		= nfp_net_set_mac_addr,
332 	.vlan_offload_set	= nfp_net_vlan_offload_set,
333 	.reta_update		= nfp_net_reta_update,
334 	.reta_query		= nfp_net_reta_query,
335 	.rss_hash_update	= nfp_net_rss_hash_update,
336 	.rss_hash_conf_get	= nfp_net_rss_hash_conf_get,
337 	.rx_queue_setup		= nfp_net_rx_queue_setup,
338 	.rx_queue_release	= nfp_net_rx_queue_release,
339 	.tx_queue_setup		= nfp_net_nfd3_tx_queue_setup,
340 	.tx_queue_release	= nfp_net_tx_queue_release,
341 	.rx_queue_intr_enable   = nfp_rx_queue_intr_enable,
342 	.rx_queue_intr_disable  = nfp_rx_queue_intr_disable,
343 };
344 
345 static const struct eth_dev_ops nfp_net_nfdk_eth_dev_ops = {
346 	.dev_configure		= nfp_net_configure,
347 	.dev_start		= nfp_net_start,
348 	.dev_stop		= nfp_net_stop,
349 	.dev_set_link_up	= nfp_net_set_link_up,
350 	.dev_set_link_down	= nfp_net_set_link_down,
351 	.dev_close		= nfp_net_close,
352 	.promiscuous_enable	= nfp_net_promisc_enable,
353 	.promiscuous_disable	= nfp_net_promisc_disable,
354 	.link_update		= nfp_net_link_update,
355 	.stats_get		= nfp_net_stats_get,
356 	.stats_reset		= nfp_net_stats_reset,
357 	.dev_infos_get		= nfp_net_infos_get,
358 	.dev_supported_ptypes_get = nfp_net_supported_ptypes_get,
359 	.mtu_set		= nfp_net_dev_mtu_set,
360 	.mac_addr_set		= nfp_net_set_mac_addr,
361 	.vlan_offload_set	= nfp_net_vlan_offload_set,
362 	.reta_update		= nfp_net_reta_update,
363 	.reta_query		= nfp_net_reta_query,
364 	.rss_hash_update	= nfp_net_rss_hash_update,
365 	.rss_hash_conf_get	= nfp_net_rss_hash_conf_get,
366 	.rx_queue_setup		= nfp_net_rx_queue_setup,
367 	.rx_queue_release	= nfp_net_rx_queue_release,
368 	.tx_queue_setup		= nfp_net_nfdk_tx_queue_setup,
369 	.tx_queue_release	= nfp_net_tx_queue_release,
370 	.rx_queue_intr_enable   = nfp_rx_queue_intr_enable,
371 	.rx_queue_intr_disable  = nfp_rx_queue_intr_disable,
372 };
373 
374 static inline int
375 nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)
376 {
377 	switch (NFD_CFG_CLASS_VER_of(hw->ver)) {
378 	case NFP_NET_CFG_VERSION_DP_NFD3:
379 		eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops;
380 		break;
381 	case NFP_NET_CFG_VERSION_DP_NFDK:
382 		if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 5) {
383 			PMD_DRV_LOG(ERR, "NFDK must use ABI 5 or newer, found: %d",
384 				NFD_CFG_MAJOR_VERSION_of(hw->ver));
385 			return -EINVAL;
386 		}
387 		eth_dev->dev_ops = &nfp_net_nfdk_eth_dev_ops;
388 		break;
389 	default:
390 		PMD_DRV_LOG(ERR, "The version of firmware is not correct.");
391 		return -EINVAL;
392 	}
393 
394 	eth_dev->rx_queue_count = nfp_net_rx_queue_count;
395 	eth_dev->rx_pkt_burst = &nfp_net_recv_pkts;
396 	eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;
397 
398 	return 0;
399 }
400 
401 static int
402 nfp_net_init(struct rte_eth_dev *eth_dev)
403 {
404 	struct rte_pci_device *pci_dev;
405 	struct nfp_pf_dev *pf_dev;
406 	struct nfp_net_hw *hw;
407 	struct rte_ether_addr *tmp_ether_addr;
408 	uint64_t rx_bar_off = 0;
409 	uint64_t tx_bar_off = 0;
410 	uint32_t start_q;
411 	int stride = 4;
412 	int port = 0;
413 	int err;
414 
415 	PMD_INIT_FUNC_TRACE();
416 
417 	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
418 
419 	/* Use backpointer here to the PF of this eth_dev */
420 	pf_dev = NFP_NET_DEV_PRIVATE_TO_PF(eth_dev->data->dev_private);
421 
422 	/* NFP can not handle DMA addresses requiring more than 40 bits */
423 	if (rte_mem_check_dma_mask(40)) {
424 		RTE_LOG(ERR, PMD,
425 			"device %s can not be used: restricted dma mask to 40 bits!\n",
426 			pci_dev->device.name);
427 		return -ENODEV;
428 	}
429 
430 	port = ((struct nfp_net_hw *)eth_dev->data->dev_private)->idx;
431 	if (port < 0 || port > 7) {
432 		PMD_DRV_LOG(ERR, "Port value is wrong");
433 		return -ENODEV;
434 	}
435 
436 	/*
437 	 * Use PF array of physical ports to get pointer to
438 	 * this specific port
439 	 */
440 	hw = pf_dev->ports[port];
441 
442 	PMD_INIT_LOG(DEBUG, "Working with physical port number: %d, "
443 			"NFP internal port number: %d", port, hw->nfp_idx);
444 
445 	/* For secondary processes, the primary has done all the work */
446 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
447 		return 0;
448 
449 	rte_eth_copy_pci_info(eth_dev, pci_dev);
450 
451 	hw->device_id = pci_dev->id.device_id;
452 	hw->vendor_id = pci_dev->id.vendor_id;
453 	hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
454 	hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
455 
456 	PMD_INIT_LOG(DEBUG, "nfp_net: device (%u:%u) %u:%u:%u:%u",
457 		     pci_dev->id.vendor_id, pci_dev->id.device_id,
458 		     pci_dev->addr.domain, pci_dev->addr.bus,
459 		     pci_dev->addr.devid, pci_dev->addr.function);
460 
461 	hw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0].addr;
462 	if (hw->ctrl_bar == NULL) {
463 		PMD_DRV_LOG(ERR,
464 			"hw->ctrl_bar is NULL. BAR0 not configured");
465 		return -ENODEV;
466 	}
467 
468 	if (port == 0) {
469 		hw->ctrl_bar = pf_dev->ctrl_bar;
470 	} else {
471 		if (pf_dev->ctrl_bar == NULL)
472 			return -ENODEV;
473 		/* Use port offset in pf ctrl_bar for this ports control bar */
474 		hw->ctrl_bar = pf_dev->ctrl_bar + (port * NFP_PF_CSR_SLICE_SIZE);
475 	}
476 
477 	PMD_INIT_LOG(DEBUG, "ctrl bar: %p", hw->ctrl_bar);
478 
479 	hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);
480 
481 	if (nfp_net_ethdev_ops_mount(hw, eth_dev))
482 		return -EINVAL;
483 
484 	hw->max_rx_queues = nn_cfg_readl(hw, NFP_NET_CFG_MAX_RXRINGS);
485 	hw->max_tx_queues = nn_cfg_readl(hw, NFP_NET_CFG_MAX_TXRINGS);
486 
487 	/* Work out where in the BAR the queues start. */
488 	switch (pci_dev->id.device_id) {
489 	case PCI_DEVICE_ID_NFP3800_PF_NIC:
490 	case PCI_DEVICE_ID_NFP4000_PF_NIC:
491 	case PCI_DEVICE_ID_NFP6000_PF_NIC:
492 		start_q = nn_cfg_readl(hw, NFP_NET_CFG_START_TXQ);
493 		tx_bar_off = nfp_pci_queue(pci_dev, start_q);
494 		start_q = nn_cfg_readl(hw, NFP_NET_CFG_START_RXQ);
495 		rx_bar_off = nfp_pci_queue(pci_dev, start_q);
496 		break;
497 	default:
498 		PMD_DRV_LOG(ERR, "nfp_net: no device ID matching");
499 		err = -ENODEV;
500 		goto dev_err_ctrl_map;
501 	}
502 
503 	PMD_INIT_LOG(DEBUG, "tx_bar_off: 0x%" PRIx64 "", tx_bar_off);
504 	PMD_INIT_LOG(DEBUG, "rx_bar_off: 0x%" PRIx64 "", rx_bar_off);
505 
506 	hw->tx_bar = pf_dev->hw_queues + tx_bar_off;
507 	hw->rx_bar = pf_dev->hw_queues + rx_bar_off;
508 	eth_dev->data->dev_private = hw;
509 
510 	PMD_INIT_LOG(DEBUG, "ctrl_bar: %p, tx_bar: %p, rx_bar: %p",
511 		     hw->ctrl_bar, hw->tx_bar, hw->rx_bar);
512 
513 	nfp_net_cfg_queue_setup(hw);
514 
515 	/* Get some of the read-only fields from the config BAR */
516 	hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP);
517 	hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU);
518 	hw->mtu = RTE_ETHER_MTU;
519 	hw->flbufsz = RTE_ETHER_MTU;
520 
521 	/* VLAN insertion is incompatible with LSOv2 */
522 	if (hw->cap & NFP_NET_CFG_CTRL_LSO2)
523 		hw->cap &= ~NFP_NET_CFG_CTRL_TXVLAN;
524 
525 	if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 2)
526 		hw->rx_offset = NFP_NET_RX_OFFSET;
527 	else
528 		hw->rx_offset = nn_cfg_readl(hw, NFP_NET_CFG_RX_OFFSET_ADDR);
529 
530 	PMD_INIT_LOG(INFO, "VER: %u.%u, Maximum supported MTU: %d",
531 			   NFD_CFG_MAJOR_VERSION_of(hw->ver),
532 			   NFD_CFG_MINOR_VERSION_of(hw->ver), hw->max_mtu);
533 
534 	PMD_INIT_LOG(INFO, "CAP: %#x, %s%s%s%s%s%s%s%s%s%s%s%s%s%s", hw->cap,
535 		     hw->cap & NFP_NET_CFG_CTRL_PROMISC ? "PROMISC " : "",
536 		     hw->cap & NFP_NET_CFG_CTRL_L2BC    ? "L2BCFILT " : "",
537 		     hw->cap & NFP_NET_CFG_CTRL_L2MC    ? "L2MCFILT " : "",
538 		     hw->cap & NFP_NET_CFG_CTRL_RXCSUM  ? "RXCSUM "  : "",
539 		     hw->cap & NFP_NET_CFG_CTRL_TXCSUM  ? "TXCSUM "  : "",
540 		     hw->cap & NFP_NET_CFG_CTRL_RXVLAN  ? "RXVLAN "  : "",
541 		     hw->cap & NFP_NET_CFG_CTRL_TXVLAN  ? "TXVLAN "  : "",
542 		     hw->cap & NFP_NET_CFG_CTRL_SCATTER ? "SCATTER " : "",
543 		     hw->cap & NFP_NET_CFG_CTRL_GATHER  ? "GATHER "  : "",
544 		     hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR ? "LIVE_ADDR "  : "",
545 		     hw->cap & NFP_NET_CFG_CTRL_LSO     ? "TSO "     : "",
546 		     hw->cap & NFP_NET_CFG_CTRL_LSO2     ? "TSOv2 "     : "",
547 		     hw->cap & NFP_NET_CFG_CTRL_RSS     ? "RSS "     : "",
548 		     hw->cap & NFP_NET_CFG_CTRL_RSS2     ? "RSSv2 "     : "");
549 
550 	hw->ctrl = 0;
551 
552 	hw->stride_rx = stride;
553 	hw->stride_tx = stride;
554 
555 	PMD_INIT_LOG(INFO, "max_rx_queues: %u, max_tx_queues: %u",
556 		     hw->max_rx_queues, hw->max_tx_queues);
557 
558 	/* Initializing spinlock for reconfigs */
559 	rte_spinlock_init(&hw->reconfig_lock);
560 
561 	/* Allocating memory for mac addr */
562 	eth_dev->data->mac_addrs = rte_zmalloc("mac_addr",
563 					       RTE_ETHER_ADDR_LEN, 0);
564 	if (eth_dev->data->mac_addrs == NULL) {
565 		PMD_INIT_LOG(ERR, "Failed to space for MAC address");
566 		err = -ENOMEM;
567 		goto dev_err_queues_map;
568 	}
569 
570 	nfp_net_pf_read_mac(pf_dev, port);
571 	nfp_net_write_mac(hw, (uint8_t *)&hw->mac_addr);
572 
573 	tmp_ether_addr = (struct rte_ether_addr *)&hw->mac_addr;
574 	if (!rte_is_valid_assigned_ether_addr(tmp_ether_addr)) {
575 		PMD_INIT_LOG(INFO, "Using random mac address for port %d", port);
576 		/* Using random mac addresses for VFs */
577 		rte_eth_random_addr(&hw->mac_addr[0]);
578 		nfp_net_write_mac(hw, (uint8_t *)&hw->mac_addr);
579 	}
580 
581 	/* Copying mac address to DPDK eth_dev struct */
582 	rte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr,
583 			&eth_dev->data->mac_addrs[0]);
584 
585 	if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR))
586 		eth_dev->data->dev_flags |= RTE_ETH_DEV_NOLIVE_MAC_ADDR;
587 
588 	eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
589 
590 	PMD_INIT_LOG(INFO, "port %d VendorID=0x%x DeviceID=0x%x "
591 		     "mac=" RTE_ETHER_ADDR_PRT_FMT,
592 		     eth_dev->data->port_id, pci_dev->id.vendor_id,
593 		     pci_dev->id.device_id,
594 		     hw->mac_addr[0], hw->mac_addr[1], hw->mac_addr[2],
595 		     hw->mac_addr[3], hw->mac_addr[4], hw->mac_addr[5]);
596 
597 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
598 		/* Registering LSC interrupt handler */
599 		rte_intr_callback_register(pci_dev->intr_handle,
600 				nfp_net_dev_interrupt_handler, (void *)eth_dev);
601 		/* Telling the firmware about the LSC interrupt entry */
602 		nn_cfg_writeb(hw, NFP_NET_CFG_LSC, NFP_NET_IRQ_LSC_IDX);
603 		/* Recording current stats counters values */
604 		nfp_net_stats_reset(eth_dev);
605 	}
606 
607 	return 0;
608 
609 dev_err_queues_map:
610 		nfp_cpp_area_free(hw->hwqueues_area);
611 dev_err_ctrl_map:
612 		nfp_cpp_area_free(hw->ctrl_area);
613 
614 	return err;
615 }
616 
617 #define DEFAULT_FW_PATH       "/lib/firmware/netronome"
618 
619 static int
620 nfp_fw_upload(struct rte_pci_device *dev, struct nfp_nsp *nsp, char *card)
621 {
622 	struct nfp_cpp *cpp = nsp->cpp;
623 	void *fw_buf;
624 	char fw_name[125];
625 	char serial[40];
626 	size_t fsize;
627 
628 	/* Looking for firmware file in order of priority */
629 
630 	/* First try to find a firmware image specific for this device */
631 	snprintf(serial, sizeof(serial),
632 			"serial-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x",
633 		cpp->serial[0], cpp->serial[1], cpp->serial[2], cpp->serial[3],
634 		cpp->serial[4], cpp->serial[5], cpp->interface >> 8,
635 		cpp->interface & 0xff);
636 
637 	snprintf(fw_name, sizeof(fw_name), "%s/%s.nffw", DEFAULT_FW_PATH,
638 			serial);
639 
640 	PMD_DRV_LOG(DEBUG, "Trying with fw file: %s", fw_name);
641 	if (rte_firmware_read(fw_name, &fw_buf, &fsize) == 0)
642 		goto load_fw;
643 	/* Then try the PCI name */
644 	snprintf(fw_name, sizeof(fw_name), "%s/pci-%s.nffw", DEFAULT_FW_PATH,
645 			dev->device.name);
646 
647 	PMD_DRV_LOG(DEBUG, "Trying with fw file: %s", fw_name);
648 	if (rte_firmware_read(fw_name, &fw_buf, &fsize) == 0)
649 		goto load_fw;
650 
651 	/* Finally try the card type and media */
652 	snprintf(fw_name, sizeof(fw_name), "%s/%s", DEFAULT_FW_PATH, card);
653 	PMD_DRV_LOG(DEBUG, "Trying with fw file: %s", fw_name);
654 	if (rte_firmware_read(fw_name, &fw_buf, &fsize) < 0) {
655 		PMD_DRV_LOG(INFO, "Firmware file %s not found.", fw_name);
656 		return -ENOENT;
657 	}
658 
659 load_fw:
660 	PMD_DRV_LOG(INFO, "Firmware file found at %s with size: %zu",
661 		fw_name, fsize);
662 	PMD_DRV_LOG(INFO, "Uploading the firmware ...");
663 	nfp_nsp_load_fw(nsp, fw_buf, fsize);
664 	PMD_DRV_LOG(INFO, "Done");
665 
666 	free(fw_buf);
667 
668 	return 0;
669 }
670 
671 static int
672 nfp_fw_setup(struct rte_pci_device *dev,
673 		struct nfp_cpp *cpp,
674 		struct nfp_eth_table *nfp_eth_table,
675 		struct nfp_hwinfo *hwinfo)
676 {
677 	struct nfp_nsp *nsp;
678 	const char *nfp_fw_model;
679 	char card_desc[100];
680 	int err = 0;
681 
682 	nfp_fw_model = nfp_hwinfo_lookup(hwinfo, "assembly.partno");
683 
684 	if (nfp_fw_model) {
685 		PMD_DRV_LOG(INFO, "firmware model found: %s", nfp_fw_model);
686 	} else {
687 		PMD_DRV_LOG(ERR, "firmware model NOT found");
688 		return -EIO;
689 	}
690 
691 	if (nfp_eth_table->count == 0 || nfp_eth_table->count > 8) {
692 		PMD_DRV_LOG(ERR, "NFP ethernet table reports wrong ports: %u",
693 			nfp_eth_table->count);
694 		return -EIO;
695 	}
696 
697 	PMD_DRV_LOG(INFO, "NFP ethernet port table reports %u ports",
698 			nfp_eth_table->count);
699 
700 	PMD_DRV_LOG(INFO, "Port speed: %u", nfp_eth_table->ports[0].speed);
701 
702 	snprintf(card_desc, sizeof(card_desc), "nic_%s_%dx%d.nffw",
703 			nfp_fw_model, nfp_eth_table->count,
704 			nfp_eth_table->ports[0].speed / 1000);
705 
706 	nsp = nfp_nsp_open(cpp);
707 	if (nsp == NULL) {
708 		PMD_DRV_LOG(ERR, "NFP error when obtaining NSP handle");
709 		return -EIO;
710 	}
711 
712 	nfp_nsp_device_soft_reset(nsp);
713 	err = nfp_fw_upload(dev, nsp, card_desc);
714 
715 	nfp_nsp_close(nsp);
716 	return err;
717 }
718 
719 static int
720 nfp_init_phyports(struct nfp_pf_dev *pf_dev)
721 {
722 	int i;
723 	int ret = 0;
724 	struct nfp_net_hw *hw;
725 	struct rte_eth_dev *eth_dev;
726 	struct nfp_eth_table *nfp_eth_table;
727 
728 	nfp_eth_table = nfp_eth_read_ports(pf_dev->cpp);
729 	if (nfp_eth_table == NULL) {
730 		PMD_INIT_LOG(ERR, "Error reading NFP ethernet table");
731 		return -EIO;
732 	}
733 
734 	/* Loop through all physical ports on PF */
735 	for (i = 0; i < pf_dev->total_phyports; i++) {
736 		const unsigned int numa_node = rte_socket_id();
737 		char port_name[RTE_ETH_NAME_MAX_LEN];
738 
739 		snprintf(port_name, sizeof(port_name), "%s_port%d",
740 			 pf_dev->pci_dev->device.name, i);
741 
742 		/* Allocate a eth_dev for this phyport */
743 		eth_dev = rte_eth_dev_allocate(port_name);
744 		if (eth_dev == NULL) {
745 			ret = -ENODEV;
746 			goto port_cleanup;
747 		}
748 
749 		/* Allocate memory for this phyport */
750 		eth_dev->data->dev_private =
751 			rte_zmalloc_socket(port_name, sizeof(struct nfp_net_hw),
752 				RTE_CACHE_LINE_SIZE, numa_node);
753 		if (eth_dev->data->dev_private == NULL) {
754 			ret = -ENOMEM;
755 			rte_eth_dev_release_port(eth_dev);
756 			goto port_cleanup;
757 		}
758 
759 		hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
760 
761 		/* Add this device to the PF's array of physical ports */
762 		pf_dev->ports[i] = hw;
763 
764 		hw->pf_dev = pf_dev;
765 		hw->cpp = pf_dev->cpp;
766 		hw->eth_dev = eth_dev;
767 		hw->idx = i;
768 		hw->nfp_idx = nfp_eth_table->ports[i].index;
769 		hw->is_phyport = true;
770 
771 		eth_dev->device = &pf_dev->pci_dev->device;
772 
773 		/* ctrl/tx/rx BAR mappings and remaining init happens in
774 		 * nfp_net_init
775 		 */
776 		ret = nfp_net_init(eth_dev);
777 		if (ret) {
778 			ret = -ENODEV;
779 			goto port_cleanup;
780 		}
781 
782 		rte_eth_dev_probing_finish(eth_dev);
783 
784 	} /* End loop, all ports on this PF */
785 	ret = 0;
786 	goto eth_table_cleanup;
787 
788 port_cleanup:
789 	for (i = 0; i < pf_dev->total_phyports; i++) {
790 		if (pf_dev->ports[i] && pf_dev->ports[i]->eth_dev) {
791 			struct rte_eth_dev *tmp_dev;
792 			tmp_dev = pf_dev->ports[i]->eth_dev;
793 			rte_eth_dev_release_port(tmp_dev);
794 			pf_dev->ports[i] = NULL;
795 		}
796 	}
797 eth_table_cleanup:
798 	free(nfp_eth_table);
799 
800 	return ret;
801 }
802 
803 static int
804 nfp_pf_init(struct rte_pci_device *pci_dev)
805 {
806 	int err;
807 	int ret = 0;
808 	uint64_t addr;
809 	int total_ports;
810 	struct nfp_cpp *cpp;
811 	struct nfp_pf_dev *pf_dev;
812 	struct nfp_hwinfo *hwinfo;
813 	char name[RTE_ETH_NAME_MAX_LEN];
814 	struct nfp_rtsym_table *sym_tbl;
815 	struct nfp_eth_table *nfp_eth_table;
816 
817 	if (pci_dev == NULL)
818 		return -ENODEV;
819 
820 	/*
821 	 * When device bound to UIO, the device could be used, by mistake,
822 	 * by two DPDK apps, and the UIO driver does not avoid it. This
823 	 * could lead to a serious problem when configuring the NFP CPP
824 	 * interface. Here we avoid this telling to the CPP init code to
825 	 * use a lock file if UIO is being used.
826 	 */
827 	if (pci_dev->kdrv == RTE_PCI_KDRV_VFIO)
828 		cpp = nfp_cpp_from_device_name(pci_dev, 0);
829 	else
830 		cpp = nfp_cpp_from_device_name(pci_dev, 1);
831 
832 	if (cpp == NULL) {
833 		PMD_INIT_LOG(ERR, "A CPP handle can not be obtained");
834 		ret = -EIO;
835 		goto error;
836 	}
837 
838 	hwinfo = nfp_hwinfo_read(cpp);
839 	if (hwinfo == NULL) {
840 		PMD_INIT_LOG(ERR, "Error reading hwinfo table");
841 		ret = -EIO;
842 		goto error;
843 	}
844 
845 	nfp_eth_table = nfp_eth_read_ports(cpp);
846 	if (nfp_eth_table == NULL) {
847 		PMD_INIT_LOG(ERR, "Error reading NFP ethernet table");
848 		ret = -EIO;
849 		goto hwinfo_cleanup;
850 	}
851 
852 	if (nfp_fw_setup(pci_dev, cpp, nfp_eth_table, hwinfo)) {
853 		PMD_INIT_LOG(ERR, "Error when uploading firmware");
854 		ret = -EIO;
855 		goto eth_table_cleanup;
856 	}
857 
858 	/* Now the symbol table should be there */
859 	sym_tbl = nfp_rtsym_table_read(cpp);
860 	if (sym_tbl == NULL) {
861 		PMD_INIT_LOG(ERR, "Something is wrong with the firmware"
862 				" symbol table");
863 		ret = -EIO;
864 		goto eth_table_cleanup;
865 	}
866 
867 	total_ports = nfp_rtsym_read_le(sym_tbl, "nfd_cfg_pf0_num_ports", &err);
868 	if (total_ports != (int)nfp_eth_table->count) {
869 		PMD_DRV_LOG(ERR, "Inconsistent number of ports");
870 		ret = -EIO;
871 		goto sym_tbl_cleanup;
872 	}
873 
874 	PMD_INIT_LOG(INFO, "Total physical ports: %d", total_ports);
875 
876 	if (total_ports <= 0 || total_ports > 8) {
877 		PMD_INIT_LOG(ERR, "nfd_cfg_pf0_num_ports symbol with wrong value");
878 		ret = -ENODEV;
879 		goto sym_tbl_cleanup;
880 	}
881 	/* Allocate memory for the PF "device" */
882 	snprintf(name, sizeof(name), "nfp_pf%d", 0);
883 	pf_dev = rte_zmalloc(name, sizeof(*pf_dev), 0);
884 	if (pf_dev == NULL) {
885 		ret = -ENOMEM;
886 		goto sym_tbl_cleanup;
887 	}
888 
889 	/* Populate the newly created PF device */
890 	pf_dev->cpp = cpp;
891 	pf_dev->hwinfo = hwinfo;
892 	pf_dev->sym_tbl = sym_tbl;
893 	pf_dev->total_phyports = total_ports;
894 
895 	if (total_ports > 1)
896 		pf_dev->multiport = true;
897 
898 	pf_dev->pci_dev = pci_dev;
899 
900 	/* Map the symbol table */
901 	pf_dev->ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, "_pf0_net_bar0",
902 			pf_dev->total_phyports * 32768, &pf_dev->ctrl_area);
903 	if (pf_dev->ctrl_bar == NULL) {
904 		PMD_INIT_LOG(ERR, "nfp_rtsym_map fails for _pf0_net_ctrl_bar");
905 		ret = -EIO;
906 		goto pf_cleanup;
907 	}
908 
909 	PMD_INIT_LOG(DEBUG, "ctrl bar: %p", pf_dev->ctrl_bar);
910 
911 	/* configure access to tx/rx vNIC BARs */
912 	switch (pci_dev->id.device_id) {
913 	case PCI_DEVICE_ID_NFP3800_PF_NIC:
914 		addr = NFP_PCIE_QUEUE(NFP_PCIE_QCP_NFP3800_OFFSET,
915 					0, NFP_PCIE_QUEUE_NFP3800_MASK);
916 		break;
917 	case PCI_DEVICE_ID_NFP4000_PF_NIC:
918 	case PCI_DEVICE_ID_NFP6000_PF_NIC:
919 		addr = NFP_PCIE_QUEUE(NFP_PCIE_QCP_NFP6000_OFFSET,
920 					0, NFP_PCIE_QUEUE_NFP6000_MASK);
921 		break;
922 	default:
923 		PMD_INIT_LOG(ERR, "nfp_net: no device ID matching");
924 		err = -ENODEV;
925 		goto ctrl_area_cleanup;
926 	}
927 
928 	pf_dev->hw_queues = nfp_cpp_map_area(pf_dev->cpp, 0, 0,
929 			addr, NFP_QCP_QUEUE_AREA_SZ,
930 			&pf_dev->hwqueues_area);
931 	if (pf_dev->hw_queues == NULL) {
932 		PMD_INIT_LOG(ERR, "nfp_rtsym_map fails for net.qc");
933 		ret = -EIO;
934 		goto ctrl_area_cleanup;
935 	}
936 
937 	PMD_INIT_LOG(DEBUG, "tx/rx bar address: 0x%p", pf_dev->hw_queues);
938 
939 	/*
940 	 * Initialize and prep physical ports now
941 	 * This will loop through all physical ports
942 	 */
943 	ret = nfp_init_phyports(pf_dev);
944 	if (ret) {
945 		PMD_INIT_LOG(ERR, "Could not create physical ports");
946 		goto hwqueues_cleanup;
947 	}
948 
949 	/* register the CPP bridge service here for primary use */
950 	nfp_register_cpp_service(pf_dev->cpp);
951 
952 	return 0;
953 
954 hwqueues_cleanup:
955 	nfp_cpp_area_free(pf_dev->hwqueues_area);
956 ctrl_area_cleanup:
957 	nfp_cpp_area_free(pf_dev->ctrl_area);
958 pf_cleanup:
959 	rte_free(pf_dev);
960 sym_tbl_cleanup:
961 	free(sym_tbl);
962 eth_table_cleanup:
963 	free(nfp_eth_table);
964 hwinfo_cleanup:
965 	free(hwinfo);
966 error:
967 	return ret;
968 }
969 
970 /*
971  * When attaching to the NFP4000/6000 PF on a secondary process there
972  * is no need to initialise the PF again. Only minimal work is required
973  * here
974  */
975 static int
976 nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
977 {
978 	int i;
979 	int err;
980 	int total_ports;
981 	struct nfp_cpp *cpp;
982 	struct nfp_net_hw *hw;
983 	struct nfp_rtsym_table *sym_tbl;
984 
985 	if (pci_dev == NULL)
986 		return -ENODEV;
987 
988 	/*
989 	 * When device bound to UIO, the device could be used, by mistake,
990 	 * by two DPDK apps, and the UIO driver does not avoid it. This
991 	 * could lead to a serious problem when configuring the NFP CPP
992 	 * interface. Here we avoid this telling to the CPP init code to
993 	 * use a lock file if UIO is being used.
994 	 */
995 	if (pci_dev->kdrv == RTE_PCI_KDRV_VFIO)
996 		cpp = nfp_cpp_from_device_name(pci_dev, 0);
997 	else
998 		cpp = nfp_cpp_from_device_name(pci_dev, 1);
999 
1000 	if (cpp == NULL) {
1001 		PMD_INIT_LOG(ERR, "A CPP handle can not be obtained");
1002 		return -EIO;
1003 	}
1004 
1005 	/*
1006 	 * We don't have access to the PF created in the primary process
1007 	 * here so we have to read the number of ports from firmware
1008 	 */
1009 	sym_tbl = nfp_rtsym_table_read(cpp);
1010 	if (sym_tbl == NULL) {
1011 		PMD_INIT_LOG(ERR, "Something is wrong with the firmware"
1012 				" symbol table");
1013 		return -EIO;
1014 	}
1015 
1016 	total_ports = nfp_rtsym_read_le(sym_tbl, "nfd_cfg_pf0_num_ports", &err);
1017 
1018 	for (i = 0; i < total_ports; i++) {
1019 		struct rte_eth_dev *eth_dev;
1020 		char port_name[RTE_ETH_NAME_MAX_LEN];
1021 
1022 		snprintf(port_name, sizeof(port_name), "%s_port%d",
1023 			 pci_dev->device.name, i);
1024 
1025 		PMD_DRV_LOG(DEBUG, "Secondary attaching to port %s", port_name);
1026 		eth_dev = rte_eth_dev_attach_secondary(port_name);
1027 		if (eth_dev == NULL) {
1028 			RTE_LOG(ERR, EAL,
1029 				"secondary process attach failed, ethdev doesn't exist");
1030 			return -ENODEV;
1031 		}
1032 
1033 		hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
1034 
1035 		if (nfp_net_ethdev_ops_mount(hw, eth_dev))
1036 			return -EINVAL;
1037 
1038 		eth_dev->process_private = cpp;
1039 
1040 		rte_eth_dev_probing_finish(eth_dev);
1041 	}
1042 
1043 	/* Register the CPP bridge service for the secondary too */
1044 	nfp_register_cpp_service(cpp);
1045 
1046 	return 0;
1047 }
1048 
1049 static int
1050 nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
1051 		struct rte_pci_device *dev)
1052 {
1053 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
1054 		return nfp_pf_init(dev);
1055 	else
1056 		return nfp_pf_secondary_init(dev);
1057 }
1058 
1059 static const struct rte_pci_id pci_id_nfp_pf_net_map[] = {
1060 	{
1061 		RTE_PCI_DEVICE(PCI_VENDOR_ID_NETRONOME,
1062 			       PCI_DEVICE_ID_NFP3800_PF_NIC)
1063 	},
1064 	{
1065 		RTE_PCI_DEVICE(PCI_VENDOR_ID_NETRONOME,
1066 			       PCI_DEVICE_ID_NFP4000_PF_NIC)
1067 	},
1068 	{
1069 		RTE_PCI_DEVICE(PCI_VENDOR_ID_NETRONOME,
1070 			       PCI_DEVICE_ID_NFP6000_PF_NIC)
1071 	},
1072 	{
1073 		.vendor_id = 0,
1074 	},
1075 };
1076 
1077 static int
1078 nfp_pci_uninit(struct rte_eth_dev *eth_dev)
1079 {
1080 	struct rte_pci_device *pci_dev;
1081 	uint16_t port_id;
1082 
1083 	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
1084 
1085 	/* Free up all physical ports under PF */
1086 	RTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device)
1087 		rte_eth_dev_close(port_id);
1088 	/*
1089 	 * Ports can be closed and freed but hotplugging is not
1090 	 * currently supported
1091 	 */
1092 	return -ENOTSUP;
1093 }
1094 
1095 static int
1096 eth_nfp_pci_remove(struct rte_pci_device *pci_dev)
1097 {
1098 	return rte_eth_dev_pci_generic_remove(pci_dev, nfp_pci_uninit);
1099 }
1100 
1101 static struct rte_pci_driver rte_nfp_net_pf_pmd = {
1102 	.id_table = pci_id_nfp_pf_net_map,
1103 	.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
1104 	.probe = nfp_pf_pci_probe,
1105 	.remove = eth_nfp_pci_remove,
1106 };
1107 
1108 RTE_PMD_REGISTER_PCI(net_nfp_pf, rte_nfp_net_pf_pmd);
1109 RTE_PMD_REGISTER_PCI_TABLE(net_nfp_pf, pci_id_nfp_pf_net_map);
1110 RTE_PMD_REGISTER_KMOD_DEP(net_nfp_pf, "* igb_uio | uio_pci_generic | vfio");
1111 /*
1112  * Local variables:
1113  * c-file-style: "Linux"
1114  * indent-tabs-mode: t
1115  * End:
1116  */
1117