xref: /dpdk/drivers/net/enic/enic_ethdev.c (revision d5b0924ba6baae2cb6ac7c880db0977d4befedc6)
172f3de30SBruce Richardson /*
272f3de30SBruce Richardson  * Copyright 2008-2014 Cisco Systems, Inc.  All rights reserved.
372f3de30SBruce Richardson  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
472f3de30SBruce Richardson  *
572f3de30SBruce Richardson  * Copyright (c) 2014, Cisco Systems, Inc.
672f3de30SBruce Richardson  * All rights reserved.
772f3de30SBruce Richardson  *
872f3de30SBruce Richardson  * Redistribution and use in source and binary forms, with or without
972f3de30SBruce Richardson  * modification, are permitted provided that the following conditions
1072f3de30SBruce Richardson  * are met:
1172f3de30SBruce Richardson  *
1272f3de30SBruce Richardson  * 1. Redistributions of source code must retain the above copyright
1372f3de30SBruce Richardson  * notice, this list of conditions and the following disclaimer.
1472f3de30SBruce Richardson  *
1572f3de30SBruce Richardson  * 2. Redistributions in binary form must reproduce the above copyright
1672f3de30SBruce Richardson  * notice, this list of conditions and the following disclaimer in
1772f3de30SBruce Richardson  * the documentation and/or other materials provided with the
1872f3de30SBruce Richardson  * distribution.
1972f3de30SBruce Richardson  *
2072f3de30SBruce Richardson  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2172f3de30SBruce Richardson  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2272f3de30SBruce Richardson  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2372f3de30SBruce Richardson  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2472f3de30SBruce Richardson  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2572f3de30SBruce Richardson  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2672f3de30SBruce Richardson  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2772f3de30SBruce Richardson  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2872f3de30SBruce Richardson  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2972f3de30SBruce Richardson  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
3072f3de30SBruce Richardson  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3172f3de30SBruce Richardson  * POSSIBILITY OF SUCH DAMAGE.
3272f3de30SBruce Richardson  *
3372f3de30SBruce Richardson  */
3472f3de30SBruce Richardson 
3572f3de30SBruce Richardson #include <stdio.h>
3672f3de30SBruce Richardson #include <stdint.h>
3772f3de30SBruce Richardson 
3872f3de30SBruce Richardson #include <rte_dev.h>
3972f3de30SBruce Richardson #include <rte_pci.h>
4072f3de30SBruce Richardson #include <rte_ethdev.h>
41fdf91e0fSJan Blunck #include <rte_ethdev_pci.h>
4272f3de30SBruce Richardson #include <rte_string_fns.h>
4372f3de30SBruce Richardson 
4472f3de30SBruce Richardson #include "vnic_intr.h"
4572f3de30SBruce Richardson #include "vnic_cq.h"
4672f3de30SBruce Richardson #include "vnic_wq.h"
4772f3de30SBruce Richardson #include "vnic_rq.h"
4872f3de30SBruce Richardson #include "vnic_enet.h"
4972f3de30SBruce Richardson #include "enic.h"
5072f3de30SBruce Richardson 
5172f3de30SBruce Richardson #ifdef RTE_LIBRTE_ENIC_DEBUG
5272f3de30SBruce Richardson #define ENICPMD_FUNC_TRACE() \
5372f3de30SBruce Richardson 	RTE_LOG(DEBUG, PMD, "ENICPMD trace: %s\n", __func__)
5472f3de30SBruce Richardson #else
5572f3de30SBruce Richardson #define ENICPMD_FUNC_TRACE() (void)0
5672f3de30SBruce Richardson #endif
5772f3de30SBruce Richardson 
5872f3de30SBruce Richardson /*
5972f3de30SBruce Richardson  * The set of PCI devices this driver supports
6072f3de30SBruce Richardson  */
610b6fe7bdSDavid Marchand #define CISCO_PCI_VENDOR_ID 0x1137
6272f3de30SBruce Richardson static const struct rte_pci_id pci_id_enic_map[] = {
630b6fe7bdSDavid Marchand 	{ RTE_PCI_DEVICE(CISCO_PCI_VENDOR_ID, PCI_DEVICE_ID_CISCO_VIC_ENET) },
640b6fe7bdSDavid Marchand 	{ RTE_PCI_DEVICE(CISCO_PCI_VENDOR_ID, PCI_DEVICE_ID_CISCO_VIC_ENET_VF) },
650b6fe7bdSDavid Marchand 	{.vendor_id = 0, /* sentinel */},
6672f3de30SBruce Richardson };
6772f3de30SBruce Richardson 
6872f3de30SBruce Richardson static int
6972f3de30SBruce Richardson enicpmd_fdir_ctrl_func(struct rte_eth_dev *eth_dev,
7072f3de30SBruce Richardson 			enum rte_filter_op filter_op, void *arg)
7172f3de30SBruce Richardson {
7272f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
7372f3de30SBruce Richardson 	int ret = 0;
7472f3de30SBruce Richardson 
7572f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
7672f3de30SBruce Richardson 	if (filter_op == RTE_ETH_FILTER_NOP)
7772f3de30SBruce Richardson 		return 0;
7872f3de30SBruce Richardson 
7972f3de30SBruce Richardson 	if (arg == NULL && filter_op != RTE_ETH_FILTER_FLUSH)
8072f3de30SBruce Richardson 		return -EINVAL;
8172f3de30SBruce Richardson 
8272f3de30SBruce Richardson 	switch (filter_op) {
8372f3de30SBruce Richardson 	case RTE_ETH_FILTER_ADD:
8472f3de30SBruce Richardson 	case RTE_ETH_FILTER_UPDATE:
8572f3de30SBruce Richardson 		ret = enic_fdir_add_fltr(enic,
8672f3de30SBruce Richardson 			(struct rte_eth_fdir_filter *)arg);
8772f3de30SBruce Richardson 		break;
8872f3de30SBruce Richardson 
8972f3de30SBruce Richardson 	case RTE_ETH_FILTER_DELETE:
9072f3de30SBruce Richardson 		ret = enic_fdir_del_fltr(enic,
9172f3de30SBruce Richardson 			(struct rte_eth_fdir_filter *)arg);
9272f3de30SBruce Richardson 		break;
9372f3de30SBruce Richardson 
9472f3de30SBruce Richardson 	case RTE_ETH_FILTER_STATS:
9572f3de30SBruce Richardson 		enic_fdir_stats_get(enic, (struct rte_eth_fdir_stats *)arg);
9672f3de30SBruce Richardson 		break;
9772f3de30SBruce Richardson 
9872f3de30SBruce Richardson 	case RTE_ETH_FILTER_FLUSH:
9972f3de30SBruce Richardson 		dev_warning(enic, "unsupported operation %u", filter_op);
10072f3de30SBruce Richardson 		ret = -ENOTSUP;
10172f3de30SBruce Richardson 		break;
102dfbd6a9cSJohn Daley 	case RTE_ETH_FILTER_INFO:
103dfbd6a9cSJohn Daley 		enic_fdir_info_get(enic, (struct rte_eth_fdir_info *)arg);
104dfbd6a9cSJohn Daley 		break;
10572f3de30SBruce Richardson 	default:
10672f3de30SBruce Richardson 		dev_err(enic, "unknown operation %u", filter_op);
10772f3de30SBruce Richardson 		ret = -EINVAL;
10872f3de30SBruce Richardson 		break;
10972f3de30SBruce Richardson 	}
11072f3de30SBruce Richardson 	return ret;
11172f3de30SBruce Richardson }
11272f3de30SBruce Richardson 
11372f3de30SBruce Richardson static int
11472f3de30SBruce Richardson enicpmd_dev_filter_ctrl(struct rte_eth_dev *dev,
11572f3de30SBruce Richardson 		     enum rte_filter_type filter_type,
11672f3de30SBruce Richardson 		     enum rte_filter_op filter_op,
11772f3de30SBruce Richardson 		     void *arg)
11872f3de30SBruce Richardson {
1190f766680SJohn Daley 	int ret = 0;
12072f3de30SBruce Richardson 
1210f766680SJohn Daley 	ENICPMD_FUNC_TRACE();
1220f766680SJohn Daley 
1230f766680SJohn Daley 	switch (filter_type) {
1240f766680SJohn Daley 	case RTE_ETH_FILTER_GENERIC:
1250f766680SJohn Daley 		if (filter_op != RTE_ETH_FILTER_GET)
1260f766680SJohn Daley 			return -EINVAL;
1270f766680SJohn Daley 		*(const void **)arg = &enic_flow_ops;
1280f766680SJohn Daley 		break;
1290f766680SJohn Daley 	case RTE_ETH_FILTER_FDIR:
13072f3de30SBruce Richardson 		ret = enicpmd_fdir_ctrl_func(dev, filter_op, arg);
1310f766680SJohn Daley 		break;
1320f766680SJohn Daley 	default:
13372f3de30SBruce Richardson 		dev_warning(enic, "Filter type (%d) not supported",
13472f3de30SBruce Richardson 			filter_type);
1350f766680SJohn Daley 		ret = -EINVAL;
1360f766680SJohn Daley 		break;
1370f766680SJohn Daley 	}
13872f3de30SBruce Richardson 
13972f3de30SBruce Richardson 	return ret;
14072f3de30SBruce Richardson }
14172f3de30SBruce Richardson 
14272f3de30SBruce Richardson static void enicpmd_dev_tx_queue_release(void *txq)
14372f3de30SBruce Richardson {
14472f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
1450e804034SJohn Daley 
1460e804034SJohn Daley 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
1470e804034SJohn Daley 		return;
1480e804034SJohn Daley 
14972f3de30SBruce Richardson 	enic_free_wq(txq);
15072f3de30SBruce Richardson }
15172f3de30SBruce Richardson 
15272f3de30SBruce Richardson static int enicpmd_dev_setup_intr(struct enic *enic)
15372f3de30SBruce Richardson {
15472f3de30SBruce Richardson 	int ret;
15572f3de30SBruce Richardson 	unsigned int index;
15672f3de30SBruce Richardson 
15772f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
15872f3de30SBruce Richardson 
15972f3de30SBruce Richardson 	/* Are we done with the init of all the queues? */
16072f3de30SBruce Richardson 	for (index = 0; index < enic->cq_count; index++) {
16172f3de30SBruce Richardson 		if (!enic->cq[index].ctrl)
16272f3de30SBruce Richardson 			break;
16372f3de30SBruce Richardson 	}
16472f3de30SBruce Richardson 	if (enic->cq_count != index)
16572f3de30SBruce Richardson 		return 0;
166954828b8SJohn Daley 	for (index = 0; index < enic->wq_count; index++) {
167954828b8SJohn Daley 		if (!enic->wq[index].ctrl)
168954828b8SJohn Daley 			break;
169954828b8SJohn Daley 	}
170954828b8SJohn Daley 	if (enic->wq_count != index)
171954828b8SJohn Daley 		return 0;
172954828b8SJohn Daley 	/* check start of packet (SOP) RQs only in case scatter is disabled. */
173954828b8SJohn Daley 	for (index = 0; index < enic->rq_count; index++) {
174aa07bf8fSJohn Daley 		if (!enic->rq[enic_rte_rq_idx_to_sop_idx(index)].ctrl)
175954828b8SJohn Daley 			break;
176954828b8SJohn Daley 	}
177954828b8SJohn Daley 	if (enic->rq_count != index)
178954828b8SJohn Daley 		return 0;
17972f3de30SBruce Richardson 
18072f3de30SBruce Richardson 	ret = enic_alloc_intr_resources(enic);
18172f3de30SBruce Richardson 	if (ret) {
18272f3de30SBruce Richardson 		dev_err(enic, "alloc intr failed\n");
18372f3de30SBruce Richardson 		return ret;
18472f3de30SBruce Richardson 	}
18572f3de30SBruce Richardson 	enic_init_vnic_resources(enic);
18672f3de30SBruce Richardson 
18772f3de30SBruce Richardson 	ret = enic_setup_finish(enic);
18872f3de30SBruce Richardson 	if (ret)
18972f3de30SBruce Richardson 		dev_err(enic, "setup could not be finished\n");
19072f3de30SBruce Richardson 
19172f3de30SBruce Richardson 	return ret;
19272f3de30SBruce Richardson }
19372f3de30SBruce Richardson 
19472f3de30SBruce Richardson static int enicpmd_dev_tx_queue_setup(struct rte_eth_dev *eth_dev,
19572f3de30SBruce Richardson 	uint16_t queue_idx,
19672f3de30SBruce Richardson 	uint16_t nb_desc,
19772f3de30SBruce Richardson 	unsigned int socket_id,
19872f3de30SBruce Richardson 	__rte_unused const struct rte_eth_txconf *tx_conf)
19972f3de30SBruce Richardson {
20072f3de30SBruce Richardson 	int ret;
20172f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
20272f3de30SBruce Richardson 
2030e804034SJohn Daley 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
2040e804034SJohn Daley 		return -E_RTE_SECONDARY;
2050e804034SJohn Daley 
20672f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
207ddf2da3eSNelson Escobar 	if (queue_idx >= ENIC_WQ_MAX) {
208ddf2da3eSNelson Escobar 		dev_err(enic,
209ddf2da3eSNelson Escobar 			"Max number of TX queues exceeded.  Max is %d\n",
210ddf2da3eSNelson Escobar 			ENIC_WQ_MAX);
211ddf2da3eSNelson Escobar 		return -EINVAL;
212ddf2da3eSNelson Escobar 	}
213ddf2da3eSNelson Escobar 
21472f3de30SBruce Richardson 	eth_dev->data->tx_queues[queue_idx] = (void *)&enic->wq[queue_idx];
21572f3de30SBruce Richardson 
21672f3de30SBruce Richardson 	ret = enic_alloc_wq(enic, queue_idx, socket_id, nb_desc);
21772f3de30SBruce Richardson 	if (ret) {
21872f3de30SBruce Richardson 		dev_err(enic, "error in allocating wq\n");
21972f3de30SBruce Richardson 		return ret;
22072f3de30SBruce Richardson 	}
22172f3de30SBruce Richardson 
22272f3de30SBruce Richardson 	return enicpmd_dev_setup_intr(enic);
22372f3de30SBruce Richardson }
22472f3de30SBruce Richardson 
22572f3de30SBruce Richardson static int enicpmd_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
22672f3de30SBruce Richardson 	uint16_t queue_idx)
22772f3de30SBruce Richardson {
22872f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
22972f3de30SBruce Richardson 
23072f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
23172f3de30SBruce Richardson 
23272f3de30SBruce Richardson 	enic_start_wq(enic, queue_idx);
23372f3de30SBruce Richardson 
23472f3de30SBruce Richardson 	return 0;
23572f3de30SBruce Richardson }
23672f3de30SBruce Richardson 
23772f3de30SBruce Richardson static int enicpmd_dev_tx_queue_stop(struct rte_eth_dev *eth_dev,
23872f3de30SBruce Richardson 	uint16_t queue_idx)
23972f3de30SBruce Richardson {
24072f3de30SBruce Richardson 	int ret;
24172f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
24272f3de30SBruce Richardson 
24372f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
24472f3de30SBruce Richardson 
24572f3de30SBruce Richardson 	ret = enic_stop_wq(enic, queue_idx);
24672f3de30SBruce Richardson 	if (ret)
24772f3de30SBruce Richardson 		dev_err(enic, "error in stopping wq %d\n", queue_idx);
24872f3de30SBruce Richardson 
24972f3de30SBruce Richardson 	return ret;
25072f3de30SBruce Richardson }
25172f3de30SBruce Richardson 
25272f3de30SBruce Richardson static int enicpmd_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
25372f3de30SBruce Richardson 	uint16_t queue_idx)
25472f3de30SBruce Richardson {
25572f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
25672f3de30SBruce Richardson 
25772f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
25872f3de30SBruce Richardson 
25972f3de30SBruce Richardson 	enic_start_rq(enic, queue_idx);
26072f3de30SBruce Richardson 
26172f3de30SBruce Richardson 	return 0;
26272f3de30SBruce Richardson }
26372f3de30SBruce Richardson 
26472f3de30SBruce Richardson static int enicpmd_dev_rx_queue_stop(struct rte_eth_dev *eth_dev,
26572f3de30SBruce Richardson 	uint16_t queue_idx)
26672f3de30SBruce Richardson {
26772f3de30SBruce Richardson 	int ret;
26872f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
26972f3de30SBruce Richardson 
27072f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
27172f3de30SBruce Richardson 
27272f3de30SBruce Richardson 	ret = enic_stop_rq(enic, queue_idx);
27372f3de30SBruce Richardson 	if (ret)
27472f3de30SBruce Richardson 		dev_err(enic, "error in stopping rq %d\n", queue_idx);
27572f3de30SBruce Richardson 
27672f3de30SBruce Richardson 	return ret;
27772f3de30SBruce Richardson }
27872f3de30SBruce Richardson 
27972f3de30SBruce Richardson static void enicpmd_dev_rx_queue_release(void *rxq)
28072f3de30SBruce Richardson {
28172f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
2820e804034SJohn Daley 
2830e804034SJohn Daley 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
2840e804034SJohn Daley 		return;
2850e804034SJohn Daley 
28672f3de30SBruce Richardson 	enic_free_rq(rxq);
28772f3de30SBruce Richardson }
28872f3de30SBruce Richardson 
289a787f7e6SNelson Escobar static uint32_t enicpmd_dev_rx_queue_count(struct rte_eth_dev *dev,
290a787f7e6SNelson Escobar 					   uint16_t rx_queue_id)
291a787f7e6SNelson Escobar {
292a787f7e6SNelson Escobar 	struct enic *enic = pmd_priv(dev);
293a787f7e6SNelson Escobar 	uint32_t queue_count = 0;
294a787f7e6SNelson Escobar 	struct vnic_cq *cq;
295a787f7e6SNelson Escobar 	uint32_t cq_tail;
296a787f7e6SNelson Escobar 	uint16_t cq_idx;
297a787f7e6SNelson Escobar 	int rq_num;
298a787f7e6SNelson Escobar 
299aa07bf8fSJohn Daley 	rq_num = enic_rte_rq_idx_to_sop_idx(rx_queue_id);
300a787f7e6SNelson Escobar 	cq = &enic->cq[enic_cq_rq(enic, rq_num)];
301a787f7e6SNelson Escobar 	cq_idx = cq->to_clean;
302a787f7e6SNelson Escobar 
303a787f7e6SNelson Escobar 	cq_tail = ioread32(&cq->ctrl->cq_tail);
304a787f7e6SNelson Escobar 
305a787f7e6SNelson Escobar 	if (cq_tail < cq_idx)
306a787f7e6SNelson Escobar 		cq_tail += cq->ring.desc_count;
307a787f7e6SNelson Escobar 
308a787f7e6SNelson Escobar 	queue_count = cq_tail - cq_idx;
309a787f7e6SNelson Escobar 
310a787f7e6SNelson Escobar 	return queue_count;
311a787f7e6SNelson Escobar }
312a787f7e6SNelson Escobar 
31372f3de30SBruce Richardson static int enicpmd_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
31472f3de30SBruce Richardson 	uint16_t queue_idx,
31572f3de30SBruce Richardson 	uint16_t nb_desc,
31672f3de30SBruce Richardson 	unsigned int socket_id,
317947d860cSJohn Daley 	const struct rte_eth_rxconf *rx_conf,
31872f3de30SBruce Richardson 	struct rte_mempool *mp)
31972f3de30SBruce Richardson {
32072f3de30SBruce Richardson 	int ret;
32172f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
32272f3de30SBruce Richardson 
32372f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
3240e804034SJohn Daley 
3250e804034SJohn Daley 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
3260e804034SJohn Daley 		return -E_RTE_SECONDARY;
3270e804034SJohn Daley 
328856d7ba7SNelson Escobar 	/* With Rx scatter support, two RQs are now used on VIC per RQ used
329856d7ba7SNelson Escobar 	 * by the application.
330856d7ba7SNelson Escobar 	 */
331856d7ba7SNelson Escobar 	if (queue_idx * 2 >= ENIC_RQ_MAX) {
332ddf2da3eSNelson Escobar 		dev_err(enic,
333856d7ba7SNelson Escobar 			"Max number of RX queues exceeded.  Max is %d. This PMD uses 2 RQs on VIC per RQ used by DPDK.\n",
334ddf2da3eSNelson Escobar 			ENIC_RQ_MAX);
335ddf2da3eSNelson Escobar 		return -EINVAL;
336ddf2da3eSNelson Escobar 	}
337ddf2da3eSNelson Escobar 
338856d7ba7SNelson Escobar 	eth_dev->data->rx_queues[queue_idx] =
339aa07bf8fSJohn Daley 		(void *)&enic->rq[enic_rte_rq_idx_to_sop_idx(queue_idx)];
34072f3de30SBruce Richardson 
341ce16fd70SJohn Daley 	ret = enic_alloc_rq(enic, queue_idx, socket_id, mp, nb_desc,
342ce16fd70SJohn Daley 			    rx_conf->rx_free_thresh);
34372f3de30SBruce Richardson 	if (ret) {
34472f3de30SBruce Richardson 		dev_err(enic, "error in allocating rq\n");
34572f3de30SBruce Richardson 		return ret;
34672f3de30SBruce Richardson 	}
34772f3de30SBruce Richardson 
34872f3de30SBruce Richardson 	return enicpmd_dev_setup_intr(enic);
34972f3de30SBruce Richardson }
35072f3de30SBruce Richardson 
35172f3de30SBruce Richardson static int enicpmd_vlan_filter_set(struct rte_eth_dev *eth_dev,
35272f3de30SBruce Richardson 	uint16_t vlan_id, int on)
35372f3de30SBruce Richardson {
35472f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
3554d4a76a6SJulien Meunier 	int err;
35672f3de30SBruce Richardson 
35772f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
35872f3de30SBruce Richardson 	if (on)
3594d4a76a6SJulien Meunier 		err = enic_add_vlan(enic, vlan_id);
36072f3de30SBruce Richardson 	else
3614d4a76a6SJulien Meunier 		err = enic_del_vlan(enic, vlan_id);
3624d4a76a6SJulien Meunier 	return err;
36372f3de30SBruce Richardson }
36472f3de30SBruce Richardson 
36572f3de30SBruce Richardson static void enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask)
36672f3de30SBruce Richardson {
36772f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
36872f3de30SBruce Richardson 
36972f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
37072f3de30SBruce Richardson 
37172f3de30SBruce Richardson 	if (mask & ETH_VLAN_STRIP_MASK) {
37272f3de30SBruce Richardson 		if (eth_dev->data->dev_conf.rxmode.hw_vlan_strip)
37372f3de30SBruce Richardson 			enic->ig_vlan_strip_en = 1;
37472f3de30SBruce Richardson 		else
37572f3de30SBruce Richardson 			enic->ig_vlan_strip_en = 0;
37672f3de30SBruce Richardson 	}
37772f3de30SBruce Richardson 	enic_set_rss_nic_cfg(enic);
37872f3de30SBruce Richardson 
37972f3de30SBruce Richardson 
38072f3de30SBruce Richardson 	if (mask & ETH_VLAN_FILTER_MASK) {
38172f3de30SBruce Richardson 		dev_warning(enic,
38272f3de30SBruce Richardson 			"Configuration of VLAN filter is not supported\n");
38372f3de30SBruce Richardson 	}
38472f3de30SBruce Richardson 
38572f3de30SBruce Richardson 	if (mask & ETH_VLAN_EXTEND_MASK) {
38672f3de30SBruce Richardson 		dev_warning(enic,
38772f3de30SBruce Richardson 			"Configuration of extended VLAN is not supported\n");
38872f3de30SBruce Richardson 	}
38972f3de30SBruce Richardson }
39072f3de30SBruce Richardson 
39172f3de30SBruce Richardson static int enicpmd_dev_configure(struct rte_eth_dev *eth_dev)
39272f3de30SBruce Richardson {
39372f3de30SBruce Richardson 	int ret;
39472f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
39572f3de30SBruce Richardson 
3960e804034SJohn Daley 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
3970e804034SJohn Daley 		return -E_RTE_SECONDARY;
3980e804034SJohn Daley 
39972f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
40072f3de30SBruce Richardson 	ret = enic_set_vnic_res(enic);
40172f3de30SBruce Richardson 	if (ret) {
40272f3de30SBruce Richardson 		dev_err(enic, "Set vNIC resource num  failed, aborting\n");
40372f3de30SBruce Richardson 		return ret;
40472f3de30SBruce Richardson 	}
40572f3de30SBruce Richardson 
40672f3de30SBruce Richardson 	if (eth_dev->data->dev_conf.rxmode.split_hdr_size &&
40772f3de30SBruce Richardson 		eth_dev->data->dev_conf.rxmode.header_split) {
40872f3de30SBruce Richardson 		/* Enable header-data-split */
40972f3de30SBruce Richardson 		enic_set_hdr_split_size(enic,
41072f3de30SBruce Richardson 			eth_dev->data->dev_conf.rxmode.split_hdr_size);
41172f3de30SBruce Richardson 	}
41272f3de30SBruce Richardson 
413892741d2SJohn Daley 	enicpmd_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK);
41472f3de30SBruce Richardson 	enic->hw_ip_checksum = eth_dev->data->dev_conf.rxmode.hw_ip_checksum;
41572f3de30SBruce Richardson 	return 0;
41672f3de30SBruce Richardson }
41772f3de30SBruce Richardson 
41872f3de30SBruce Richardson /* Start the device.
41972f3de30SBruce Richardson  * It returns 0 on success.
42072f3de30SBruce Richardson  */
42172f3de30SBruce Richardson static int enicpmd_dev_start(struct rte_eth_dev *eth_dev)
42272f3de30SBruce Richardson {
42372f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
42472f3de30SBruce Richardson 
4250e804034SJohn Daley 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
4260e804034SJohn Daley 		return -E_RTE_SECONDARY;
4270e804034SJohn Daley 
42872f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
42972f3de30SBruce Richardson 	return enic_enable(enic);
43072f3de30SBruce Richardson }
43172f3de30SBruce Richardson 
43272f3de30SBruce Richardson /*
43372f3de30SBruce Richardson  * Stop device: disable rx and tx functions to allow for reconfiguring.
43472f3de30SBruce Richardson  */
43572f3de30SBruce Richardson static void enicpmd_dev_stop(struct rte_eth_dev *eth_dev)
43672f3de30SBruce Richardson {
43772f3de30SBruce Richardson 	struct rte_eth_link link;
43872f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
43972f3de30SBruce Richardson 
4400e804034SJohn Daley 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
4410e804034SJohn Daley 		return;
4420e804034SJohn Daley 
44372f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
44472f3de30SBruce Richardson 	enic_disable(enic);
44572f3de30SBruce Richardson 	memset(&link, 0, sizeof(link));
44672f3de30SBruce Richardson 	rte_atomic64_cmpset((uint64_t *)&eth_dev->data->dev_link,
44772f3de30SBruce Richardson 		*(uint64_t *)&eth_dev->data->dev_link,
44872f3de30SBruce Richardson 		*(uint64_t *)&link);
44972f3de30SBruce Richardson }
45072f3de30SBruce Richardson 
45172f3de30SBruce Richardson /*
45272f3de30SBruce Richardson  * Stop device.
45372f3de30SBruce Richardson  */
45472f3de30SBruce Richardson static void enicpmd_dev_close(struct rte_eth_dev *eth_dev)
45572f3de30SBruce Richardson {
45672f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
45772f3de30SBruce Richardson 
45872f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
45972f3de30SBruce Richardson 	enic_remove(enic);
46072f3de30SBruce Richardson }
46172f3de30SBruce Richardson 
46272f3de30SBruce Richardson static int enicpmd_dev_link_update(struct rte_eth_dev *eth_dev,
46372f3de30SBruce Richardson 	__rte_unused int wait_to_complete)
46472f3de30SBruce Richardson {
46572f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
46672f3de30SBruce Richardson 
46772f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
468cf8d9826SNelson Escobar 	return enic_link_update(enic);
46972f3de30SBruce Richardson }
47072f3de30SBruce Richardson 
471*d5b0924bSMatan Azrad static int enicpmd_dev_stats_get(struct rte_eth_dev *eth_dev,
47272f3de30SBruce Richardson 	struct rte_eth_stats *stats)
47372f3de30SBruce Richardson {
47472f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
47572f3de30SBruce Richardson 
47672f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
477*d5b0924bSMatan Azrad 	return enic_dev_stats_get(enic, stats);
47872f3de30SBruce Richardson }
47972f3de30SBruce Richardson 
48072f3de30SBruce Richardson static void enicpmd_dev_stats_reset(struct rte_eth_dev *eth_dev)
48172f3de30SBruce Richardson {
48272f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
48372f3de30SBruce Richardson 
48472f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
48572f3de30SBruce Richardson 	enic_dev_stats_clear(enic);
48672f3de30SBruce Richardson }
48772f3de30SBruce Richardson 
48872f3de30SBruce Richardson static void enicpmd_dev_info_get(struct rte_eth_dev *eth_dev,
48972f3de30SBruce Richardson 	struct rte_eth_dev_info *device_info)
49072f3de30SBruce Richardson {
49172f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
49272f3de30SBruce Richardson 
49372f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
494c0802544SFerruh Yigit 	device_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
495ce93d3c3SNelson Escobar 	/* Scattered Rx uses two receive queues per rx queue exposed to dpdk */
496ce93d3c3SNelson Escobar 	device_info->max_rx_queues = enic->conf_rq_count / 2;
497ce93d3c3SNelson Escobar 	device_info->max_tx_queues = enic->conf_wq_count;
49872f3de30SBruce Richardson 	device_info->min_rx_bufsize = ENIC_MIN_MTU;
499f201fd05SJohn Daley 	device_info->max_rx_pktlen = enic->max_mtu + ETHER_HDR_LEN + 4;
500bbab3d97SJohn Daley 	device_info->max_mac_addrs = ENIC_MAX_MAC_ADDR;
50172f3de30SBruce Richardson 	device_info->rx_offload_capa =
50272f3de30SBruce Richardson 		DEV_RX_OFFLOAD_VLAN_STRIP |
50372f3de30SBruce Richardson 		DEV_RX_OFFLOAD_IPV4_CKSUM |
50472f3de30SBruce Richardson 		DEV_RX_OFFLOAD_UDP_CKSUM  |
50572f3de30SBruce Richardson 		DEV_RX_OFFLOAD_TCP_CKSUM;
50672f3de30SBruce Richardson 	device_info->tx_offload_capa =
50772f3de30SBruce Richardson 		DEV_TX_OFFLOAD_VLAN_INSERT |
50872f3de30SBruce Richardson 		DEV_TX_OFFLOAD_IPV4_CKSUM  |
50972f3de30SBruce Richardson 		DEV_TX_OFFLOAD_UDP_CKSUM   |
510026afc76SJohn Daley 		DEV_TX_OFFLOAD_TCP_CKSUM   |
511026afc76SJohn Daley 		DEV_TX_OFFLOAD_TCP_TSO;
512947d860cSJohn Daley 	device_info->default_rxconf = (struct rte_eth_rxconf) {
513947d860cSJohn Daley 		.rx_free_thresh = ENIC_DEFAULT_RX_FREE_THRESH
514947d860cSJohn Daley 	};
51572f3de30SBruce Richardson }
51672f3de30SBruce Richardson 
51778a38edfSJianfeng Tan static const uint32_t *enicpmd_dev_supported_ptypes_get(struct rte_eth_dev *dev)
51878a38edfSJianfeng Tan {
51978a38edfSJianfeng Tan 	static const uint32_t ptypes[] = {
520c6f45550SJohn Daley 		RTE_PTYPE_L2_ETHER,
521c6f45550SJohn Daley 		RTE_PTYPE_L2_ETHER_VLAN,
522097e1f1eSNelson Escobar 		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN,
523097e1f1eSNelson Escobar 		RTE_PTYPE_L3_IPV6_EXT_UNKNOWN,
524097e1f1eSNelson Escobar 		RTE_PTYPE_L4_TCP,
525097e1f1eSNelson Escobar 		RTE_PTYPE_L4_UDP,
526097e1f1eSNelson Escobar 		RTE_PTYPE_L4_FRAG,
527097e1f1eSNelson Escobar 		RTE_PTYPE_L4_NONFRAG,
52878a38edfSJianfeng Tan 		RTE_PTYPE_UNKNOWN
52978a38edfSJianfeng Tan 	};
53078a38edfSJianfeng Tan 
53178a38edfSJianfeng Tan 	if (dev->rx_pkt_burst == enic_recv_pkts)
53278a38edfSJianfeng Tan 		return ptypes;
53378a38edfSJianfeng Tan 	return NULL;
53478a38edfSJianfeng Tan }
53578a38edfSJianfeng Tan 
53672f3de30SBruce Richardson static void enicpmd_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
53772f3de30SBruce Richardson {
53872f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
53972f3de30SBruce Richardson 
5400e804034SJohn Daley 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
5410e804034SJohn Daley 		return;
5420e804034SJohn Daley 
54372f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
5440e804034SJohn Daley 
54572f3de30SBruce Richardson 	enic->promisc = 1;
54672f3de30SBruce Richardson 	enic_add_packet_filter(enic);
54772f3de30SBruce Richardson }
54872f3de30SBruce Richardson 
54972f3de30SBruce Richardson static void enicpmd_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
55072f3de30SBruce Richardson {
55172f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
55272f3de30SBruce Richardson 
5530e804034SJohn Daley 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
5540e804034SJohn Daley 		return;
5550e804034SJohn Daley 
55672f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
55772f3de30SBruce Richardson 	enic->promisc = 0;
55872f3de30SBruce Richardson 	enic_add_packet_filter(enic);
55972f3de30SBruce Richardson }
56072f3de30SBruce Richardson 
56172f3de30SBruce Richardson static void enicpmd_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
56272f3de30SBruce Richardson {
56372f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
56472f3de30SBruce Richardson 
5650e804034SJohn Daley 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
5660e804034SJohn Daley 		return;
5670e804034SJohn Daley 
56872f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
56972f3de30SBruce Richardson 	enic->allmulti = 1;
57072f3de30SBruce Richardson 	enic_add_packet_filter(enic);
57172f3de30SBruce Richardson }
57272f3de30SBruce Richardson 
57372f3de30SBruce Richardson static void enicpmd_dev_allmulticast_disable(struct rte_eth_dev *eth_dev)
57472f3de30SBruce Richardson {
57572f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
57672f3de30SBruce Richardson 
5770e804034SJohn Daley 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
5780e804034SJohn Daley 		return;
5790e804034SJohn Daley 
58072f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
58172f3de30SBruce Richardson 	enic->allmulti = 0;
58272f3de30SBruce Richardson 	enic_add_packet_filter(enic);
58372f3de30SBruce Richardson }
58472f3de30SBruce Richardson 
5856d01e580SWei Dai static int enicpmd_add_mac_addr(struct rte_eth_dev *eth_dev,
58672f3de30SBruce Richardson 	struct ether_addr *mac_addr,
58772f3de30SBruce Richardson 	__rte_unused uint32_t index, __rte_unused uint32_t pool)
58872f3de30SBruce Richardson {
58972f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
59072f3de30SBruce Richardson 
5910e804034SJohn Daley 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
5920e804034SJohn Daley 		return -E_RTE_SECONDARY;
5930e804034SJohn Daley 
59472f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
5956d01e580SWei Dai 	return enic_set_mac_address(enic, mac_addr->addr_bytes);
59672f3de30SBruce Richardson }
59772f3de30SBruce Richardson 
598bbab3d97SJohn Daley static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, uint32_t index)
59972f3de30SBruce Richardson {
60072f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
60172f3de30SBruce Richardson 
6020e804034SJohn Daley 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
6030e804034SJohn Daley 		return;
6040e804034SJohn Daley 
60572f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
606bbab3d97SJohn Daley 	enic_del_mac_address(enic, index);
60772f3de30SBruce Richardson }
60872f3de30SBruce Richardson 
609396a6d71SJohn Daley static int enicpmd_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
610396a6d71SJohn Daley {
611396a6d71SJohn Daley 	struct enic *enic = pmd_priv(eth_dev);
612396a6d71SJohn Daley 
613396a6d71SJohn Daley 	ENICPMD_FUNC_TRACE();
614396a6d71SJohn Daley 	return enic_set_mtu(enic, mtu);
615396a6d71SJohn Daley }
616396a6d71SJohn Daley 
61772f3de30SBruce Richardson static const struct eth_dev_ops enicpmd_eth_dev_ops = {
61872f3de30SBruce Richardson 	.dev_configure        = enicpmd_dev_configure,
61972f3de30SBruce Richardson 	.dev_start            = enicpmd_dev_start,
62072f3de30SBruce Richardson 	.dev_stop             = enicpmd_dev_stop,
62172f3de30SBruce Richardson 	.dev_set_link_up      = NULL,
62272f3de30SBruce Richardson 	.dev_set_link_down    = NULL,
62372f3de30SBruce Richardson 	.dev_close            = enicpmd_dev_close,
62472f3de30SBruce Richardson 	.promiscuous_enable   = enicpmd_dev_promiscuous_enable,
62572f3de30SBruce Richardson 	.promiscuous_disable  = enicpmd_dev_promiscuous_disable,
62672f3de30SBruce Richardson 	.allmulticast_enable  = enicpmd_dev_allmulticast_enable,
62772f3de30SBruce Richardson 	.allmulticast_disable = enicpmd_dev_allmulticast_disable,
62872f3de30SBruce Richardson 	.link_update          = enicpmd_dev_link_update,
62972f3de30SBruce Richardson 	.stats_get            = enicpmd_dev_stats_get,
63072f3de30SBruce Richardson 	.stats_reset          = enicpmd_dev_stats_reset,
63172f3de30SBruce Richardson 	.queue_stats_mapping_set = NULL,
63272f3de30SBruce Richardson 	.dev_infos_get        = enicpmd_dev_info_get,
63378a38edfSJianfeng Tan 	.dev_supported_ptypes_get = enicpmd_dev_supported_ptypes_get,
634396a6d71SJohn Daley 	.mtu_set              = enicpmd_mtu_set,
63572f3de30SBruce Richardson 	.vlan_filter_set      = enicpmd_vlan_filter_set,
63672f3de30SBruce Richardson 	.vlan_tpid_set        = NULL,
63772f3de30SBruce Richardson 	.vlan_offload_set     = enicpmd_vlan_offload_set,
63872f3de30SBruce Richardson 	.vlan_strip_queue_set = NULL,
63972f3de30SBruce Richardson 	.rx_queue_start       = enicpmd_dev_rx_queue_start,
64072f3de30SBruce Richardson 	.rx_queue_stop        = enicpmd_dev_rx_queue_stop,
64172f3de30SBruce Richardson 	.tx_queue_start       = enicpmd_dev_tx_queue_start,
64272f3de30SBruce Richardson 	.tx_queue_stop        = enicpmd_dev_tx_queue_stop,
64372f3de30SBruce Richardson 	.rx_queue_setup       = enicpmd_dev_rx_queue_setup,
64472f3de30SBruce Richardson 	.rx_queue_release     = enicpmd_dev_rx_queue_release,
645a787f7e6SNelson Escobar 	.rx_queue_count       = enicpmd_dev_rx_queue_count,
64672f3de30SBruce Richardson 	.rx_descriptor_done   = NULL,
64772f3de30SBruce Richardson 	.tx_queue_setup       = enicpmd_dev_tx_queue_setup,
64872f3de30SBruce Richardson 	.tx_queue_release     = enicpmd_dev_tx_queue_release,
64972f3de30SBruce Richardson 	.dev_led_on           = NULL,
65072f3de30SBruce Richardson 	.dev_led_off          = NULL,
65172f3de30SBruce Richardson 	.flow_ctrl_get        = NULL,
65272f3de30SBruce Richardson 	.flow_ctrl_set        = NULL,
65372f3de30SBruce Richardson 	.priority_flow_ctrl_set = NULL,
65472f3de30SBruce Richardson 	.mac_addr_add         = enicpmd_add_mac_addr,
65572f3de30SBruce Richardson 	.mac_addr_remove      = enicpmd_remove_mac_addr,
65672f3de30SBruce Richardson 	.filter_ctrl          = enicpmd_dev_filter_ctrl,
65772f3de30SBruce Richardson };
65872f3de30SBruce Richardson 
65972f3de30SBruce Richardson struct enic *enicpmd_list_head = NULL;
66072f3de30SBruce Richardson /* Initialize the driver
66172f3de30SBruce Richardson  * It returns 0 on success.
66272f3de30SBruce Richardson  */
66372f3de30SBruce Richardson static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev)
66472f3de30SBruce Richardson {
66572f3de30SBruce Richardson 	struct rte_pci_device *pdev;
66672f3de30SBruce Richardson 	struct rte_pci_addr *addr;
66772f3de30SBruce Richardson 	struct enic *enic = pmd_priv(eth_dev);
66872f3de30SBruce Richardson 
66972f3de30SBruce Richardson 	ENICPMD_FUNC_TRACE();
67072f3de30SBruce Richardson 
67172f3de30SBruce Richardson 	enic->port_id = eth_dev->data->port_id;
67272f3de30SBruce Richardson 	enic->rte_dev = eth_dev;
67372f3de30SBruce Richardson 	eth_dev->dev_ops = &enicpmd_eth_dev_ops;
674947d860cSJohn Daley 	eth_dev->rx_pkt_burst = &enic_recv_pkts;
675d309bdc2SJohn Daley 	eth_dev->tx_pkt_burst = &enic_xmit_pkts;
67672f3de30SBruce Richardson 
677c0802544SFerruh Yigit 	pdev = RTE_ETH_DEV_TO_PCI(eth_dev);
678eeefe73fSBernard Iremonger 	rte_eth_copy_pci_info(eth_dev, pdev);
67972f3de30SBruce Richardson 	enic->pdev = pdev;
68072f3de30SBruce Richardson 	addr = &pdev->addr;
68172f3de30SBruce Richardson 
68272f3de30SBruce Richardson 	snprintf(enic->bdf_name, ENICPMD_BDF_LENGTH, "%04x:%02x:%02x.%x",
68372f3de30SBruce Richardson 		addr->domain, addr->bus, addr->devid, addr->function);
68472f3de30SBruce Richardson 
68572f3de30SBruce Richardson 	return enic_probe(enic);
68672f3de30SBruce Richardson }
68772f3de30SBruce Richardson 
688fdf91e0fSJan Blunck static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
689fdf91e0fSJan Blunck 	struct rte_pci_device *pci_dev)
690fdf91e0fSJan Blunck {
691fdf91e0fSJan Blunck 	return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct enic),
692fdf91e0fSJan Blunck 		eth_enicpmd_dev_init);
693fdf91e0fSJan Blunck }
694fdf91e0fSJan Blunck 
695fdf91e0fSJan Blunck static int eth_enic_pci_remove(struct rte_pci_device *pci_dev)
696fdf91e0fSJan Blunck {
697fdf91e0fSJan Blunck 	return rte_eth_dev_pci_generic_remove(pci_dev, NULL);
698fdf91e0fSJan Blunck }
699fdf91e0fSJan Blunck 
700fdf91e0fSJan Blunck static struct rte_pci_driver rte_enic_pmd = {
70172f3de30SBruce Richardson 	.id_table = pci_id_enic_map,
70253fa8cc0SNelson Escobar 	.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
703fdf91e0fSJan Blunck 	.probe = eth_enic_pci_probe,
704fdf91e0fSJan Blunck 	.remove = eth_enic_pci_remove,
70572f3de30SBruce Richardson };
70672f3de30SBruce Richardson 
707fdf91e0fSJan Blunck RTE_PMD_REGISTER_PCI(net_enic, rte_enic_pmd);
70801f19227SShreyansh Jain RTE_PMD_REGISTER_PCI_TABLE(net_enic, pci_id_enic_map);
70906e81dc9SDavid Marchand RTE_PMD_REGISTER_KMOD_DEP(net_enic, "* igb_uio | uio_pci_generic | vfio-pci");
710