1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation
5 #include <rte_ethdev_pci.h>
7 #include "base/ice_sched.h"
8 #include "ice_ethdev.h"
11 #define ICE_MAX_QP_NUM "max_queue_pair_num"
12 #define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100
15 int ice_logtype_driver;
17 static int ice_dev_configure(struct rte_eth_dev *dev);
18 static int ice_dev_start(struct rte_eth_dev *dev);
19 static void ice_dev_stop(struct rte_eth_dev *dev);
20 static void ice_dev_close(struct rte_eth_dev *dev);
21 static int ice_dev_reset(struct rte_eth_dev *dev);
23 static const struct rte_pci_id pci_id_ice_map[] = {
24 { RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_BACKPLANE) },
25 { RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_QSFP) },
26 { RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP) },
27 { .vendor_id = 0, /* sentinel */ },
30 static const struct eth_dev_ops ice_eth_dev_ops = {
31 .dev_configure = ice_dev_configure,
32 .dev_start = ice_dev_start,
33 .dev_stop = ice_dev_stop,
34 .dev_close = ice_dev_close,
35 .dev_reset = ice_dev_reset,
36 .rx_queue_start = ice_rx_queue_start,
37 .rx_queue_stop = ice_rx_queue_stop,
38 .tx_queue_start = ice_tx_queue_start,
39 .tx_queue_stop = ice_tx_queue_stop,
40 .rx_queue_setup = ice_rx_queue_setup,
41 .rx_queue_release = ice_rx_queue_release,
42 .tx_queue_setup = ice_tx_queue_setup,
43 .tx_queue_release = ice_tx_queue_release,
47 ice_init_controlq_parameter(struct ice_hw *hw)
49 /* fields for adminq */
50 hw->adminq.num_rq_entries = ICE_ADMINQ_LEN;
51 hw->adminq.num_sq_entries = ICE_ADMINQ_LEN;
52 hw->adminq.rq_buf_size = ICE_ADMINQ_BUF_SZ;
53 hw->adminq.sq_buf_size = ICE_ADMINQ_BUF_SZ;
55 /* fields for mailboxq, DPDK used as PF host */
56 hw->mailboxq.num_rq_entries = ICE_MAILBOXQ_LEN;
57 hw->mailboxq.num_sq_entries = ICE_MAILBOXQ_LEN;
58 hw->mailboxq.rq_buf_size = ICE_MAILBOXQ_BUF_SZ;
59 hw->mailboxq.sq_buf_size = ICE_MAILBOXQ_BUF_SZ;
63 ice_check_qp_num(const char *key, const char *qp_value,
64 __rte_unused void *opaque)
69 while (isblank(*qp_value))
72 num = strtoul(qp_value, &end, 10);
74 if (!num || (*end == '-') || errno) {
75 PMD_DRV_LOG(WARNING, "invalid value:\"%s\" for key:\"%s\", "
85 ice_config_max_queue_pair_num(struct rte_devargs *devargs)
87 struct rte_kvargs *kvlist;
88 const char *queue_num_key = ICE_MAX_QP_NUM;
94 kvlist = rte_kvargs_parse(devargs->args, NULL);
98 if (!rte_kvargs_count(kvlist, queue_num_key)) {
99 rte_kvargs_free(kvlist);
103 if (rte_kvargs_process(kvlist, queue_num_key,
104 ice_check_qp_num, NULL) < 0) {
105 rte_kvargs_free(kvlist);
108 ret = rte_kvargs_process(kvlist, queue_num_key,
109 ice_check_qp_num, NULL);
110 rte_kvargs_free(kvlist);
116 ice_res_pool_init(struct ice_res_pool_info *pool, uint32_t base,
119 struct pool_entry *entry;
124 entry = rte_zmalloc(NULL, sizeof(*entry), 0);
127 "Failed to allocate memory for resource pool");
131 /* queue heap initialize */
132 pool->num_free = num;
135 LIST_INIT(&pool->alloc_list);
136 LIST_INIT(&pool->free_list);
138 /* Initialize element */
142 LIST_INSERT_HEAD(&pool->free_list, entry, next);
147 ice_res_pool_alloc(struct ice_res_pool_info *pool,
150 struct pool_entry *entry, *valid_entry;
153 PMD_INIT_LOG(ERR, "Invalid parameter");
157 if (pool->num_free < num) {
158 PMD_INIT_LOG(ERR, "No resource. ask:%u, available:%u",
159 num, pool->num_free);
164 /* Lookup in free list and find most fit one */
165 LIST_FOREACH(entry, &pool->free_list, next) {
166 if (entry->len >= num) {
168 if (entry->len == num) {
173 valid_entry->len > entry->len)
178 /* Not find one to satisfy the request, return */
180 PMD_INIT_LOG(ERR, "No valid entry found");
184 * The entry have equal queue number as requested,
185 * remove it from alloc_list.
187 if (valid_entry->len == num) {
188 LIST_REMOVE(valid_entry, next);
191 * The entry have more numbers than requested,
192 * create a new entry for alloc_list and minus its
193 * queue base and number in free_list.
195 entry = rte_zmalloc(NULL, sizeof(*entry), 0);
198 "Failed to allocate memory for "
202 entry->base = valid_entry->base;
204 valid_entry->base += num;
205 valid_entry->len -= num;
209 /* Insert it into alloc list, not sorted */
210 LIST_INSERT_HEAD(&pool->alloc_list, valid_entry, next);
212 pool->num_free -= valid_entry->len;
213 pool->num_alloc += valid_entry->len;
215 return valid_entry->base + pool->base;
219 ice_res_pool_destroy(struct ice_res_pool_info *pool)
221 struct pool_entry *entry, *next_entry;
226 for (entry = LIST_FIRST(&pool->alloc_list);
227 entry && (next_entry = LIST_NEXT(entry, next), 1);
228 entry = next_entry) {
229 LIST_REMOVE(entry, next);
233 for (entry = LIST_FIRST(&pool->free_list);
234 entry && (next_entry = LIST_NEXT(entry, next), 1);
235 entry = next_entry) {
236 LIST_REMOVE(entry, next);
243 LIST_INIT(&pool->alloc_list);
244 LIST_INIT(&pool->free_list);
248 ice_vsi_config_default_rss(struct ice_aqc_vsi_props *info)
250 /* Set VSI LUT selection */
251 info->q_opt_rss = ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI &
252 ICE_AQ_VSI_Q_OPT_RSS_LUT_M;
253 /* Set Hash scheme */
254 info->q_opt_rss |= ICE_AQ_VSI_Q_OPT_RSS_TPLZ &
255 ICE_AQ_VSI_Q_OPT_RSS_HASH_M;
257 info->q_opt_tc = ICE_AQ_VSI_Q_OPT_TC_OVR_M;
260 static enum ice_status
261 ice_vsi_config_tc_queue_mapping(struct ice_vsi *vsi,
262 struct ice_aqc_vsi_props *info,
263 uint8_t enabled_tcmap)
265 uint16_t bsf, qp_idx;
267 /* default tc 0 now. Multi-TC supporting need to be done later.
268 * Configure TC and queue mapping parameters, for enabled TC,
269 * allocate qpnum_per_tc queues to this traffic.
271 if (enabled_tcmap != 0x01) {
272 PMD_INIT_LOG(ERR, "only TC0 is supported");
276 vsi->nb_qps = RTE_MIN(vsi->nb_qps, ICE_MAX_Q_PER_TC);
277 bsf = rte_bsf32(vsi->nb_qps);
278 /* Adjust the queue number to actual queues that can be applied */
279 vsi->nb_qps = 0x1 << bsf;
282 /* Set tc and queue mapping with VSI */
283 info->tc_mapping[0] = rte_cpu_to_le_16((qp_idx <<
284 ICE_AQ_VSI_TC_Q_OFFSET_S) |
285 (bsf << ICE_AQ_VSI_TC_Q_NUM_S));
287 /* Associate queue number with VSI */
288 info->mapping_flags |= rte_cpu_to_le_16(ICE_AQ_VSI_Q_MAP_CONTIG);
289 info->q_mapping[0] = rte_cpu_to_le_16(vsi->base_queue);
290 info->q_mapping[1] = rte_cpu_to_le_16(vsi->nb_qps);
291 info->valid_sections |=
292 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_RXQ_MAP_VALID);
293 /* Set the info.ingress_table and info.egress_table
294 * for UP translate table. Now just set it to 1:1 map by default
295 * -- 0b 111 110 101 100 011 010 001 000 == 0xFAC688
297 #define ICE_TC_QUEUE_TABLE_DFLT 0x00FAC688
298 info->ingress_table = rte_cpu_to_le_32(ICE_TC_QUEUE_TABLE_DFLT);
299 info->egress_table = rte_cpu_to_le_32(ICE_TC_QUEUE_TABLE_DFLT);
300 info->outer_up_table = rte_cpu_to_le_32(ICE_TC_QUEUE_TABLE_DFLT);
305 ice_init_mac_address(struct rte_eth_dev *dev)
307 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
309 if (!is_unicast_ether_addr
310 ((struct ether_addr *)hw->port_info[0].mac.lan_addr)) {
311 PMD_INIT_LOG(ERR, "Invalid MAC address");
315 ether_addr_copy((struct ether_addr *)hw->port_info[0].mac.lan_addr,
316 (struct ether_addr *)hw->port_info[0].mac.perm_addr);
318 dev->data->mac_addrs = rte_zmalloc(NULL, sizeof(struct ether_addr), 0);
319 if (!dev->data->mac_addrs) {
321 "Failed to allocate memory to store mac address");
324 /* store it to dev data */
325 ether_addr_copy((struct ether_addr *)hw->port_info[0].mac.perm_addr,
326 &dev->data->mac_addrs[0]);
330 /* Initialize SW parameters of PF */
332 ice_pf_sw_init(struct rte_eth_dev *dev)
334 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
335 struct ice_hw *hw = ICE_PF_TO_HW(pf);
337 if (ice_config_max_queue_pair_num(dev->device->devargs) > 0)
339 ice_config_max_queue_pair_num(dev->device->devargs);
342 (uint16_t)RTE_MIN(hw->func_caps.common_cap.num_txq,
343 hw->func_caps.common_cap.num_rxq);
345 pf->lan_nb_qps = pf->lan_nb_qp_max;
350 static struct ice_vsi *
351 ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
353 struct ice_hw *hw = ICE_PF_TO_HW(pf);
354 struct ice_vsi *vsi = NULL;
355 struct ice_vsi_ctx vsi_ctx;
357 uint16_t max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };
358 uint8_t tc_bitmap = 0x1;
360 /* hw->num_lports = 1 in NIC mode */
361 vsi = rte_zmalloc(NULL, sizeof(struct ice_vsi), 0);
365 vsi->idx = pf->next_vsi_idx;
368 vsi->adapter = ICE_PF_TO_ADAPTER(pf);
369 vsi->max_macaddrs = ICE_NUM_MACADDR_MAX;
370 vsi->vlan_anti_spoof_on = 0;
371 vsi->vlan_filter_on = 1;
372 TAILQ_INIT(&vsi->mac_list);
373 TAILQ_INIT(&vsi->vlan_list);
375 memset(&vsi_ctx, 0, sizeof(vsi_ctx));
376 /* base_queue in used in queue mapping of VSI add/update command.
377 * Suppose vsi->base_queue is 0 now, don't consider SRIOV, VMDQ
378 * cases in the first stage. Only Main VSI.
383 vsi->nb_qps = pf->lan_nb_qps;
384 ice_vsi_config_default_rss(&vsi_ctx.info);
385 vsi_ctx.alloc_from_pool = true;
386 vsi_ctx.flags = ICE_AQ_VSI_TYPE_PF;
387 /* switch_id is queried by get_switch_config aq, which is done
390 vsi_ctx.info.sw_id = hw->port_info->sw_id;
391 vsi_ctx.info.sw_flags2 = ICE_AQ_VSI_SW_FLAG_LAN_ENA;
392 /* Allow all untagged or tagged packets */
393 vsi_ctx.info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_ALL;
394 vsi_ctx.info.vlan_flags |= ICE_AQ_VSI_VLAN_EMOD_NOTHING;
395 vsi_ctx.info.q_opt_rss = ICE_AQ_VSI_Q_OPT_RSS_LUT_PF |
396 ICE_AQ_VSI_Q_OPT_RSS_TPLZ;
397 /* Enable VLAN/UP trip */
398 ret = ice_vsi_config_tc_queue_mapping(vsi,
403 "tc queue mapping with vsi failed, "
411 /* for other types of VSI */
412 PMD_INIT_LOG(ERR, "other types of VSI not supported");
416 /* VF has MSIX interrupt in VF range, don't allocate here */
417 if (type == ICE_VSI_PF) {
418 ret = ice_res_pool_alloc(&pf->msix_pool,
420 RTE_MAX_RXTX_INTR_VEC_ID));
422 PMD_INIT_LOG(ERR, "VSI MAIN %d get heap failed %d",
425 vsi->msix_intr = ret;
426 vsi->nb_msix = RTE_MIN(vsi->nb_qps, RTE_MAX_RXTX_INTR_VEC_ID);
431 ret = ice_add_vsi(hw, vsi->idx, &vsi_ctx, NULL);
432 if (ret != ICE_SUCCESS) {
433 PMD_INIT_LOG(ERR, "add vsi failed, err = %d", ret);
436 /* store vsi information is SW structure */
437 vsi->vsi_id = vsi_ctx.vsi_num;
438 vsi->info = vsi_ctx.info;
439 pf->vsis_allocated = vsi_ctx.vsis_allocd;
440 pf->vsis_unallocated = vsi_ctx.vsis_unallocated;
442 /* At the beginning, only TC0. */
443 /* What we need here is the maximam number of the TX queues.
444 * Currently vsi->nb_qps means it.
445 * Correct it if any change.
447 max_txqs[0] = vsi->nb_qps;
448 ret = ice_cfg_vsi_lan(hw->port_info, vsi->idx,
449 tc_bitmap, max_txqs);
450 if (ret != ICE_SUCCESS)
451 PMD_INIT_LOG(ERR, "Failed to config vsi sched");
461 ice_pf_setup(struct ice_pf *pf)
465 /* Clear all stats counters */
466 pf->offset_loaded = FALSE;
467 memset(&pf->stats, 0, sizeof(struct ice_hw_port_stats));
468 memset(&pf->stats_offset, 0, sizeof(struct ice_hw_port_stats));
469 memset(&pf->internal_stats, 0, sizeof(struct ice_eth_stats));
470 memset(&pf->internal_stats_offset, 0, sizeof(struct ice_eth_stats));
472 vsi = ice_setup_vsi(pf, ICE_VSI_PF);
474 PMD_INIT_LOG(ERR, "Failed to add vsi for PF");
484 ice_dev_init(struct rte_eth_dev *dev)
486 struct rte_pci_device *pci_dev;
487 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
488 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
491 dev->dev_ops = &ice_eth_dev_ops;
493 pci_dev = RTE_DEV_TO_PCI(dev->device);
495 pf->adapter = ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
496 pf->adapter->eth_dev = dev;
497 pf->dev_data = dev->data;
498 hw->back = pf->adapter;
499 hw->hw_addr = (uint8_t *)pci_dev->mem_resource[0].addr;
500 hw->vendor_id = pci_dev->id.vendor_id;
501 hw->device_id = pci_dev->id.device_id;
502 hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
503 hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
504 hw->bus.device = pci_dev->addr.devid;
505 hw->bus.func = pci_dev->addr.function;
507 ice_init_controlq_parameter(hw);
509 ret = ice_init_hw(hw);
511 PMD_INIT_LOG(ERR, "Failed to initialize HW");
515 PMD_INIT_LOG(INFO, "FW %d.%d.%05d API %d.%d",
516 hw->fw_maj_ver, hw->fw_min_ver, hw->fw_build,
517 hw->api_maj_ver, hw->api_min_ver);
520 ret = ice_init_mac_address(dev);
522 PMD_INIT_LOG(ERR, "Failed to initialize mac address");
526 ret = ice_res_pool_init(&pf->msix_pool, 1,
527 hw->func_caps.common_cap.num_msix_vectors - 1);
529 PMD_INIT_LOG(ERR, "Failed to init MSIX pool");
530 goto err_msix_pool_init;
533 ret = ice_pf_setup(pf);
535 PMD_INIT_LOG(ERR, "Failed to setup PF");
542 ice_res_pool_destroy(&pf->msix_pool);
544 rte_free(dev->data->mac_addrs);
546 ice_sched_cleanup_all(hw);
547 rte_free(hw->port_info);
548 ice_shutdown_all_ctrlq(hw);
554 ice_release_vsi(struct ice_vsi *vsi)
557 struct ice_vsi_ctx vsi_ctx;
563 hw = ICE_VSI_TO_HW(vsi);
565 memset(&vsi_ctx, 0, sizeof(vsi_ctx));
567 vsi_ctx.vsi_num = vsi->vsi_id;
568 vsi_ctx.info = vsi->info;
569 ret = ice_free_vsi(hw, vsi->idx, &vsi_ctx, false, NULL);
570 if (ret != ICE_SUCCESS) {
571 PMD_INIT_LOG(ERR, "Failed to free vsi by aq, %u", vsi->vsi_id);
581 ice_dev_stop(struct rte_eth_dev *dev)
583 struct rte_eth_dev_data *data = dev->data;
584 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
587 /* avoid stopping again */
588 if (pf->adapter_stopped)
591 /* stop and clear all Rx queues */
592 for (i = 0; i < data->nb_rx_queues; i++)
593 ice_rx_queue_stop(dev, i);
595 /* stop and clear all Tx queues */
596 for (i = 0; i < data->nb_tx_queues; i++)
597 ice_tx_queue_stop(dev, i);
599 /* Clear all queues and release mbufs */
600 ice_clear_queues(dev);
602 pf->adapter_stopped = true;
606 ice_dev_close(struct rte_eth_dev *dev)
608 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
609 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
613 /* release all queue resource */
614 ice_free_queues(dev);
616 ice_res_pool_destroy(&pf->msix_pool);
617 ice_release_vsi(pf->main_vsi);
619 ice_shutdown_all_ctrlq(hw);
623 ice_dev_uninit(struct rte_eth_dev *dev)
625 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
626 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
631 dev->rx_pkt_burst = NULL;
632 dev->tx_pkt_burst = NULL;
634 rte_free(dev->data->mac_addrs);
635 dev->data->mac_addrs = NULL;
637 ice_release_vsi(pf->main_vsi);
638 ice_sched_cleanup_all(hw);
639 rte_free(hw->port_info);
640 ice_shutdown_all_ctrlq(hw);
646 ice_dev_configure(__rte_unused struct rte_eth_dev *dev)
648 struct ice_adapter *ad =
649 ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
651 /* Initialize to TRUE. If any of Rx queues doesn't meet the
652 * bulk allocation or vector Rx preconditions we will reset it.
654 ad->rx_bulk_alloc_allowed = true;
655 ad->tx_simple_allowed = true;
660 static int ice_init_rss(struct ice_pf *pf)
662 struct ice_hw *hw = ICE_PF_TO_HW(pf);
663 struct ice_vsi *vsi = pf->main_vsi;
664 struct rte_eth_dev *dev = pf->adapter->eth_dev;
665 struct rte_eth_rss_conf *rss_conf;
666 struct ice_aqc_get_set_rss_keys key;
670 rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf;
671 nb_q = dev->data->nb_rx_queues;
672 vsi->rss_key_size = ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE;
673 vsi->rss_lut_size = hw->func_caps.common_cap.rss_table_size;
676 vsi->rss_key = rte_zmalloc(NULL,
677 vsi->rss_key_size, 0);
679 vsi->rss_lut = rte_zmalloc(NULL,
680 vsi->rss_lut_size, 0);
682 /* configure RSS key */
683 if (!rss_conf->rss_key) {
684 /* Calculate the default hash key */
685 for (i = 0; i <= vsi->rss_key_size; i++)
686 vsi->rss_key[i] = (uint8_t)rte_rand();
688 rte_memcpy(vsi->rss_key, rss_conf->rss_key,
689 RTE_MIN(rss_conf->rss_key_len,
692 rte_memcpy(key.standard_rss_key, vsi->rss_key, vsi->rss_key_size);
693 ret = ice_aq_set_rss_key(hw, vsi->idx, &key);
697 /* init RSS LUT table */
698 for (i = 0; i < vsi->rss_lut_size; i++)
699 vsi->rss_lut[i] = i % nb_q;
701 ret = ice_aq_set_rss_lut(hw, vsi->idx,
702 ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF,
703 vsi->rss_lut, vsi->rss_lut_size);
711 ice_dev_start(struct rte_eth_dev *dev)
713 struct rte_eth_dev_data *data = dev->data;
714 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
715 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
720 /* program Tx queues' context in hardware */
721 for (nb_txq = 0; nb_txq < data->nb_tx_queues; nb_txq++) {
722 ret = ice_tx_queue_start(dev, nb_txq);
724 PMD_DRV_LOG(ERR, "fail to start Tx queue %u", nb_txq);
729 /* program Rx queues' context in hardware*/
730 for (nb_rxq = 0; nb_rxq < data->nb_rx_queues; nb_rxq++) {
731 ret = ice_rx_queue_start(dev, nb_rxq);
733 PMD_DRV_LOG(ERR, "fail to start Rx queue %u", nb_rxq);
738 ret = ice_init_rss(pf);
740 PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
744 ret = ice_aq_set_event_mask(hw, hw->port_info->lport,
745 ((u16)(ICE_AQ_LINK_EVENT_LINK_FAULT |
746 ICE_AQ_LINK_EVENT_PHY_TEMP_ALARM |
747 ICE_AQ_LINK_EVENT_EXCESSIVE_ERRORS |
748 ICE_AQ_LINK_EVENT_SIGNAL_DETECT |
749 ICE_AQ_LINK_EVENT_AN_COMPLETED |
750 ICE_AQ_LINK_EVENT_PORT_TX_SUSPENDED)),
752 if (ret != ICE_SUCCESS)
753 PMD_DRV_LOG(WARNING, "Fail to set phy mask");
755 pf->adapter_stopped = false;
759 /* stop the started queues if failed to start all queues */
761 for (i = 0; i < nb_rxq; i++)
762 ice_rx_queue_stop(dev, i);
764 for (i = 0; i < nb_txq; i++)
765 ice_tx_queue_stop(dev, i);
771 ice_dev_reset(struct rte_eth_dev *dev)
775 if (dev->data->sriov.active)
778 ret = ice_dev_uninit(dev);
780 PMD_INIT_LOG(ERR, "failed to uninit device, status = %d", ret);
784 ret = ice_dev_init(dev);
786 PMD_INIT_LOG(ERR, "failed to init device, status = %d", ret);
794 ice_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
795 struct rte_pci_device *pci_dev)
797 return rte_eth_dev_pci_generic_probe(pci_dev,
798 sizeof(struct ice_adapter),
803 ice_pci_remove(struct rte_pci_device *pci_dev)
805 return rte_eth_dev_pci_generic_remove(pci_dev, ice_dev_uninit);
808 static struct rte_pci_driver rte_ice_pmd = {
809 .id_table = pci_id_ice_map,
810 .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
811 RTE_PCI_DRV_IOVA_AS_VA,
812 .probe = ice_pci_probe,
813 .remove = ice_pci_remove,
817 * Driver initialization routine.
818 * Invoked once at EAL init time.
819 * Register itself as the [Poll Mode] Driver of PCI devices.
821 RTE_PMD_REGISTER_PCI(net_ice, rte_ice_pmd);
822 RTE_PMD_REGISTER_PCI_TABLE(net_ice, pci_id_ice_map);
823 RTE_PMD_REGISTER_KMOD_DEP(net_ice, "* igb_uio | uio_pci_generic | vfio-pci");
824 RTE_PMD_REGISTER_PARAM_STRING(net_ice,
825 ICE_MAX_QP_NUM "=<int>");
827 RTE_INIT(ice_init_log)
829 ice_logtype_init = rte_log_register("pmd.net.ice.init");
830 if (ice_logtype_init >= 0)
831 rte_log_set_level(ice_logtype_init, RTE_LOG_NOTICE);
832 ice_logtype_driver = rte_log_register("pmd.net.ice.driver");
833 if (ice_logtype_driver >= 0)
834 rte_log_set_level(ice_logtype_driver, RTE_LOG_NOTICE);