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);
22 static void ice_dev_info_get(struct rte_eth_dev *dev,
23 struct rte_eth_dev_info *dev_info);
24 static int ice_link_update(struct rte_eth_dev *dev,
25 int wait_to_complete);
26 static int ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
27 static int ice_vlan_offload_set(struct rte_eth_dev *dev, int mask);
28 static int ice_vlan_tpid_set(struct rte_eth_dev *dev,
29 enum rte_vlan_type vlan_type,
31 static int ice_vlan_filter_set(struct rte_eth_dev *dev,
34 static int ice_macaddr_set(struct rte_eth_dev *dev,
35 struct ether_addr *mac_addr);
36 static int ice_macaddr_add(struct rte_eth_dev *dev,
37 struct ether_addr *mac_addr,
38 __rte_unused uint32_t index,
40 static void ice_macaddr_remove(struct rte_eth_dev *dev, uint32_t index);
41 static int ice_vlan_pvid_set(struct rte_eth_dev *dev,
42 uint16_t pvid, int on);
44 static const struct rte_pci_id pci_id_ice_map[] = {
45 { RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_BACKPLANE) },
46 { RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_QSFP) },
47 { RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP) },
48 { .vendor_id = 0, /* sentinel */ },
51 static const struct eth_dev_ops ice_eth_dev_ops = {
52 .dev_configure = ice_dev_configure,
53 .dev_start = ice_dev_start,
54 .dev_stop = ice_dev_stop,
55 .dev_close = ice_dev_close,
56 .dev_reset = ice_dev_reset,
57 .rx_queue_start = ice_rx_queue_start,
58 .rx_queue_stop = ice_rx_queue_stop,
59 .tx_queue_start = ice_tx_queue_start,
60 .tx_queue_stop = ice_tx_queue_stop,
61 .rx_queue_setup = ice_rx_queue_setup,
62 .rx_queue_release = ice_rx_queue_release,
63 .tx_queue_setup = ice_tx_queue_setup,
64 .tx_queue_release = ice_tx_queue_release,
65 .dev_infos_get = ice_dev_info_get,
66 .dev_supported_ptypes_get = ice_dev_supported_ptypes_get,
67 .link_update = ice_link_update,
68 .mtu_set = ice_mtu_set,
69 .mac_addr_set = ice_macaddr_set,
70 .mac_addr_add = ice_macaddr_add,
71 .mac_addr_remove = ice_macaddr_remove,
72 .vlan_filter_set = ice_vlan_filter_set,
73 .vlan_offload_set = ice_vlan_offload_set,
74 .vlan_tpid_set = ice_vlan_tpid_set,
75 .vlan_pvid_set = ice_vlan_pvid_set,
76 .rxq_info_get = ice_rxq_info_get,
77 .txq_info_get = ice_txq_info_get,
78 .rx_queue_count = ice_rx_queue_count,
82 ice_init_controlq_parameter(struct ice_hw *hw)
84 /* fields for adminq */
85 hw->adminq.num_rq_entries = ICE_ADMINQ_LEN;
86 hw->adminq.num_sq_entries = ICE_ADMINQ_LEN;
87 hw->adminq.rq_buf_size = ICE_ADMINQ_BUF_SZ;
88 hw->adminq.sq_buf_size = ICE_ADMINQ_BUF_SZ;
90 /* fields for mailboxq, DPDK used as PF host */
91 hw->mailboxq.num_rq_entries = ICE_MAILBOXQ_LEN;
92 hw->mailboxq.num_sq_entries = ICE_MAILBOXQ_LEN;
93 hw->mailboxq.rq_buf_size = ICE_MAILBOXQ_BUF_SZ;
94 hw->mailboxq.sq_buf_size = ICE_MAILBOXQ_BUF_SZ;
98 ice_check_qp_num(const char *key, const char *qp_value,
99 __rte_unused void *opaque)
104 while (isblank(*qp_value))
107 num = strtoul(qp_value, &end, 10);
109 if (!num || (*end == '-') || errno) {
110 PMD_DRV_LOG(WARNING, "invalid value:\"%s\" for key:\"%s\", "
120 ice_config_max_queue_pair_num(struct rte_devargs *devargs)
122 struct rte_kvargs *kvlist;
123 const char *queue_num_key = ICE_MAX_QP_NUM;
129 kvlist = rte_kvargs_parse(devargs->args, NULL);
133 if (!rte_kvargs_count(kvlist, queue_num_key)) {
134 rte_kvargs_free(kvlist);
138 if (rte_kvargs_process(kvlist, queue_num_key,
139 ice_check_qp_num, NULL) < 0) {
140 rte_kvargs_free(kvlist);
143 ret = rte_kvargs_process(kvlist, queue_num_key,
144 ice_check_qp_num, NULL);
145 rte_kvargs_free(kvlist);
151 ice_res_pool_init(struct ice_res_pool_info *pool, uint32_t base,
154 struct pool_entry *entry;
159 entry = rte_zmalloc(NULL, sizeof(*entry), 0);
162 "Failed to allocate memory for resource pool");
166 /* queue heap initialize */
167 pool->num_free = num;
170 LIST_INIT(&pool->alloc_list);
171 LIST_INIT(&pool->free_list);
173 /* Initialize element */
177 LIST_INSERT_HEAD(&pool->free_list, entry, next);
182 ice_res_pool_alloc(struct ice_res_pool_info *pool,
185 struct pool_entry *entry, *valid_entry;
188 PMD_INIT_LOG(ERR, "Invalid parameter");
192 if (pool->num_free < num) {
193 PMD_INIT_LOG(ERR, "No resource. ask:%u, available:%u",
194 num, pool->num_free);
199 /* Lookup in free list and find most fit one */
200 LIST_FOREACH(entry, &pool->free_list, next) {
201 if (entry->len >= num) {
203 if (entry->len == num) {
208 valid_entry->len > entry->len)
213 /* Not find one to satisfy the request, return */
215 PMD_INIT_LOG(ERR, "No valid entry found");
219 * The entry have equal queue number as requested,
220 * remove it from alloc_list.
222 if (valid_entry->len == num) {
223 LIST_REMOVE(valid_entry, next);
226 * The entry have more numbers than requested,
227 * create a new entry for alloc_list and minus its
228 * queue base and number in free_list.
230 entry = rte_zmalloc(NULL, sizeof(*entry), 0);
233 "Failed to allocate memory for "
237 entry->base = valid_entry->base;
239 valid_entry->base += num;
240 valid_entry->len -= num;
244 /* Insert it into alloc list, not sorted */
245 LIST_INSERT_HEAD(&pool->alloc_list, valid_entry, next);
247 pool->num_free -= valid_entry->len;
248 pool->num_alloc += valid_entry->len;
250 return valid_entry->base + pool->base;
254 ice_res_pool_destroy(struct ice_res_pool_info *pool)
256 struct pool_entry *entry, *next_entry;
261 for (entry = LIST_FIRST(&pool->alloc_list);
262 entry && (next_entry = LIST_NEXT(entry, next), 1);
263 entry = next_entry) {
264 LIST_REMOVE(entry, next);
268 for (entry = LIST_FIRST(&pool->free_list);
269 entry && (next_entry = LIST_NEXT(entry, next), 1);
270 entry = next_entry) {
271 LIST_REMOVE(entry, next);
278 LIST_INIT(&pool->alloc_list);
279 LIST_INIT(&pool->free_list);
283 ice_vsi_config_default_rss(struct ice_aqc_vsi_props *info)
285 /* Set VSI LUT selection */
286 info->q_opt_rss = ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI &
287 ICE_AQ_VSI_Q_OPT_RSS_LUT_M;
288 /* Set Hash scheme */
289 info->q_opt_rss |= ICE_AQ_VSI_Q_OPT_RSS_TPLZ &
290 ICE_AQ_VSI_Q_OPT_RSS_HASH_M;
292 info->q_opt_tc = ICE_AQ_VSI_Q_OPT_TC_OVR_M;
295 static enum ice_status
296 ice_vsi_config_tc_queue_mapping(struct ice_vsi *vsi,
297 struct ice_aqc_vsi_props *info,
298 uint8_t enabled_tcmap)
300 uint16_t bsf, qp_idx;
302 /* default tc 0 now. Multi-TC supporting need to be done later.
303 * Configure TC and queue mapping parameters, for enabled TC,
304 * allocate qpnum_per_tc queues to this traffic.
306 if (enabled_tcmap != 0x01) {
307 PMD_INIT_LOG(ERR, "only TC0 is supported");
311 vsi->nb_qps = RTE_MIN(vsi->nb_qps, ICE_MAX_Q_PER_TC);
312 bsf = rte_bsf32(vsi->nb_qps);
313 /* Adjust the queue number to actual queues that can be applied */
314 vsi->nb_qps = 0x1 << bsf;
317 /* Set tc and queue mapping with VSI */
318 info->tc_mapping[0] = rte_cpu_to_le_16((qp_idx <<
319 ICE_AQ_VSI_TC_Q_OFFSET_S) |
320 (bsf << ICE_AQ_VSI_TC_Q_NUM_S));
322 /* Associate queue number with VSI */
323 info->mapping_flags |= rte_cpu_to_le_16(ICE_AQ_VSI_Q_MAP_CONTIG);
324 info->q_mapping[0] = rte_cpu_to_le_16(vsi->base_queue);
325 info->q_mapping[1] = rte_cpu_to_le_16(vsi->nb_qps);
326 info->valid_sections |=
327 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_RXQ_MAP_VALID);
328 /* Set the info.ingress_table and info.egress_table
329 * for UP translate table. Now just set it to 1:1 map by default
330 * -- 0b 111 110 101 100 011 010 001 000 == 0xFAC688
332 #define ICE_TC_QUEUE_TABLE_DFLT 0x00FAC688
333 info->ingress_table = rte_cpu_to_le_32(ICE_TC_QUEUE_TABLE_DFLT);
334 info->egress_table = rte_cpu_to_le_32(ICE_TC_QUEUE_TABLE_DFLT);
335 info->outer_up_table = rte_cpu_to_le_32(ICE_TC_QUEUE_TABLE_DFLT);
340 ice_init_mac_address(struct rte_eth_dev *dev)
342 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
344 if (!is_unicast_ether_addr
345 ((struct ether_addr *)hw->port_info[0].mac.lan_addr)) {
346 PMD_INIT_LOG(ERR, "Invalid MAC address");
350 ether_addr_copy((struct ether_addr *)hw->port_info[0].mac.lan_addr,
351 (struct ether_addr *)hw->port_info[0].mac.perm_addr);
353 dev->data->mac_addrs = rte_zmalloc(NULL, sizeof(struct ether_addr), 0);
354 if (!dev->data->mac_addrs) {
356 "Failed to allocate memory to store mac address");
359 /* store it to dev data */
360 ether_addr_copy((struct ether_addr *)hw->port_info[0].mac.perm_addr,
361 &dev->data->mac_addrs[0]);
365 /* Find out specific MAC filter */
366 static struct ice_mac_filter *
367 ice_find_mac_filter(struct ice_vsi *vsi, struct ether_addr *macaddr)
369 struct ice_mac_filter *f;
371 TAILQ_FOREACH(f, &vsi->mac_list, next) {
372 if (is_same_ether_addr(macaddr, &f->mac_info.mac_addr))
380 ice_add_mac_filter(struct ice_vsi *vsi, struct ether_addr *mac_addr)
382 struct ice_fltr_list_entry *m_list_itr = NULL;
383 struct ice_mac_filter *f;
384 struct LIST_HEAD_TYPE list_head;
385 struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
388 /* If it's added and configured, return */
389 f = ice_find_mac_filter(vsi, mac_addr);
391 PMD_DRV_LOG(INFO, "This MAC filter already exists.");
395 INIT_LIST_HEAD(&list_head);
397 m_list_itr = (struct ice_fltr_list_entry *)
398 ice_malloc(hw, sizeof(*m_list_itr));
403 ice_memcpy(m_list_itr->fltr_info.l_data.mac.mac_addr,
404 mac_addr, ETH_ALEN, ICE_NONDMA_TO_NONDMA);
405 m_list_itr->fltr_info.src_id = ICE_SRC_ID_VSI;
406 m_list_itr->fltr_info.fltr_act = ICE_FWD_TO_VSI;
407 m_list_itr->fltr_info.lkup_type = ICE_SW_LKUP_MAC;
408 m_list_itr->fltr_info.flag = ICE_FLTR_TX;
409 m_list_itr->fltr_info.vsi_handle = vsi->idx;
411 LIST_ADD(&m_list_itr->list_entry, &list_head);
414 ret = ice_add_mac(hw, &list_head);
415 if (ret != ICE_SUCCESS) {
416 PMD_DRV_LOG(ERR, "Failed to add MAC filter");
420 /* Add the mac addr into mac list */
421 f = rte_zmalloc(NULL, sizeof(*f), 0);
423 PMD_DRV_LOG(ERR, "failed to allocate memory");
427 rte_memcpy(&f->mac_info.mac_addr, mac_addr, ETH_ADDR_LEN);
428 TAILQ_INSERT_TAIL(&vsi->mac_list, f, next);
434 rte_free(m_list_itr);
439 ice_remove_mac_filter(struct ice_vsi *vsi, struct ether_addr *mac_addr)
441 struct ice_fltr_list_entry *m_list_itr = NULL;
442 struct ice_mac_filter *f;
443 struct LIST_HEAD_TYPE list_head;
444 struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
447 /* Can't find it, return an error */
448 f = ice_find_mac_filter(vsi, mac_addr);
452 INIT_LIST_HEAD(&list_head);
454 m_list_itr = (struct ice_fltr_list_entry *)
455 ice_malloc(hw, sizeof(*m_list_itr));
460 ice_memcpy(m_list_itr->fltr_info.l_data.mac.mac_addr,
461 mac_addr, ETH_ALEN, ICE_NONDMA_TO_NONDMA);
462 m_list_itr->fltr_info.src_id = ICE_SRC_ID_VSI;
463 m_list_itr->fltr_info.fltr_act = ICE_FWD_TO_VSI;
464 m_list_itr->fltr_info.lkup_type = ICE_SW_LKUP_MAC;
465 m_list_itr->fltr_info.flag = ICE_FLTR_TX;
466 m_list_itr->fltr_info.vsi_handle = vsi->idx;
468 LIST_ADD(&m_list_itr->list_entry, &list_head);
470 /* remove the mac filter */
471 ret = ice_remove_mac(hw, &list_head);
472 if (ret != ICE_SUCCESS) {
473 PMD_DRV_LOG(ERR, "Failed to remove MAC filter");
478 /* Remove the mac addr from mac list */
479 TAILQ_REMOVE(&vsi->mac_list, f, next);
485 rte_free(m_list_itr);
489 /* Find out specific VLAN filter */
490 static struct ice_vlan_filter *
491 ice_find_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)
493 struct ice_vlan_filter *f;
495 TAILQ_FOREACH(f, &vsi->vlan_list, next) {
496 if (vlan_id == f->vlan_info.vlan_id)
504 ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)
506 struct ice_fltr_list_entry *v_list_itr = NULL;
507 struct ice_vlan_filter *f;
508 struct LIST_HEAD_TYPE list_head;
509 struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
512 if (!vsi || vlan_id > ETHER_MAX_VLAN_ID)
515 /* If it's added and configured, return. */
516 f = ice_find_vlan_filter(vsi, vlan_id);
518 PMD_DRV_LOG(INFO, "This VLAN filter already exists.");
522 if (!vsi->vlan_anti_spoof_on && !vsi->vlan_filter_on)
525 INIT_LIST_HEAD(&list_head);
527 v_list_itr = (struct ice_fltr_list_entry *)
528 ice_malloc(hw, sizeof(*v_list_itr));
533 v_list_itr->fltr_info.l_data.vlan.vlan_id = vlan_id;
534 v_list_itr->fltr_info.src_id = ICE_SRC_ID_VSI;
535 v_list_itr->fltr_info.fltr_act = ICE_FWD_TO_VSI;
536 v_list_itr->fltr_info.lkup_type = ICE_SW_LKUP_VLAN;
537 v_list_itr->fltr_info.flag = ICE_FLTR_TX;
538 v_list_itr->fltr_info.vsi_handle = vsi->idx;
540 LIST_ADD(&v_list_itr->list_entry, &list_head);
543 ret = ice_add_vlan(hw, &list_head);
544 if (ret != ICE_SUCCESS) {
545 PMD_DRV_LOG(ERR, "Failed to add VLAN filter");
550 /* Add vlan into vlan list */
551 f = rte_zmalloc(NULL, sizeof(*f), 0);
553 PMD_DRV_LOG(ERR, "failed to allocate memory");
557 f->vlan_info.vlan_id = vlan_id;
558 TAILQ_INSERT_TAIL(&vsi->vlan_list, f, next);
564 rte_free(v_list_itr);
569 ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)
571 struct ice_fltr_list_entry *v_list_itr = NULL;
572 struct ice_vlan_filter *f;
573 struct LIST_HEAD_TYPE list_head;
574 struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
578 * Vlan 0 is the generic filter for untagged packets
579 * and can't be removed.
581 if (!vsi || vlan_id == 0 || vlan_id > ETHER_MAX_VLAN_ID)
584 /* Can't find it, return an error */
585 f = ice_find_vlan_filter(vsi, vlan_id);
589 INIT_LIST_HEAD(&list_head);
591 v_list_itr = (struct ice_fltr_list_entry *)
592 ice_malloc(hw, sizeof(*v_list_itr));
598 v_list_itr->fltr_info.l_data.vlan.vlan_id = vlan_id;
599 v_list_itr->fltr_info.src_id = ICE_SRC_ID_VSI;
600 v_list_itr->fltr_info.fltr_act = ICE_FWD_TO_VSI;
601 v_list_itr->fltr_info.lkup_type = ICE_SW_LKUP_VLAN;
602 v_list_itr->fltr_info.flag = ICE_FLTR_TX;
603 v_list_itr->fltr_info.vsi_handle = vsi->idx;
605 LIST_ADD(&v_list_itr->list_entry, &list_head);
607 /* remove the vlan filter */
608 ret = ice_remove_vlan(hw, &list_head);
609 if (ret != ICE_SUCCESS) {
610 PMD_DRV_LOG(ERR, "Failed to remove VLAN filter");
615 /* Remove the vlan id from vlan list */
616 TAILQ_REMOVE(&vsi->vlan_list, f, next);
622 rte_free(v_list_itr);
627 ice_remove_all_mac_vlan_filters(struct ice_vsi *vsi)
629 struct ice_mac_filter *m_f;
630 struct ice_vlan_filter *v_f;
633 if (!vsi || !vsi->mac_num)
636 TAILQ_FOREACH(m_f, &vsi->mac_list, next) {
637 ret = ice_remove_mac_filter(vsi, &m_f->mac_info.mac_addr);
638 if (ret != ICE_SUCCESS) {
644 if (vsi->vlan_num == 0)
647 TAILQ_FOREACH(v_f, &vsi->vlan_list, next) {
648 ret = ice_remove_vlan_filter(vsi, v_f->vlan_info.vlan_id);
649 if (ret != ICE_SUCCESS) {
660 ice_vsi_config_qinq_insertion(struct ice_vsi *vsi, bool on)
662 struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
663 struct ice_vsi_ctx ctxt;
667 /* Check if it has been already on or off */
668 if (vsi->info.valid_sections &
669 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID)) {
671 if ((vsi->info.outer_tag_flags &
672 ICE_AQ_VSI_OUTER_TAG_ACCEPT_HOST) ==
673 ICE_AQ_VSI_OUTER_TAG_ACCEPT_HOST)
674 return 0; /* already on */
676 if (!(vsi->info.outer_tag_flags &
677 ICE_AQ_VSI_OUTER_TAG_ACCEPT_HOST))
678 return 0; /* already off */
683 qinq_flags = ICE_AQ_VSI_OUTER_TAG_ACCEPT_HOST;
686 /* clear global insertion and use per packet insertion */
687 vsi->info.outer_tag_flags &= ~(ICE_AQ_VSI_OUTER_TAG_INSERT);
688 vsi->info.outer_tag_flags &= ~(ICE_AQ_VSI_OUTER_TAG_ACCEPT_HOST);
689 vsi->info.outer_tag_flags |= qinq_flags;
690 /* use default vlan type 0x8100 */
691 vsi->info.outer_tag_flags &= ~(ICE_AQ_VSI_OUTER_TAG_TYPE_M);
692 vsi->info.outer_tag_flags |= ICE_DFLT_OUTER_TAG_TYPE <<
693 ICE_AQ_VSI_OUTER_TAG_TYPE_S;
694 (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
695 ctxt.info.valid_sections =
696 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);
697 ctxt.vsi_num = vsi->vsi_id;
698 ret = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);
701 "Update VSI failed to %s qinq stripping",
702 on ? "enable" : "disable");
706 vsi->info.valid_sections |=
707 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);
713 ice_vsi_config_qinq_stripping(struct ice_vsi *vsi, bool on)
715 struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
716 struct ice_vsi_ctx ctxt;
720 /* Check if it has been already on or off */
721 if (vsi->info.valid_sections &
722 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID)) {
724 if ((vsi->info.outer_tag_flags &
725 ICE_AQ_VSI_OUTER_TAG_MODE_M) ==
726 ICE_AQ_VSI_OUTER_TAG_COPY)
727 return 0; /* already on */
729 if ((vsi->info.outer_tag_flags &
730 ICE_AQ_VSI_OUTER_TAG_MODE_M) ==
731 ICE_AQ_VSI_OUTER_TAG_NOTHING)
732 return 0; /* already off */
737 qinq_flags = ICE_AQ_VSI_OUTER_TAG_COPY;
739 qinq_flags = ICE_AQ_VSI_OUTER_TAG_NOTHING;
740 vsi->info.outer_tag_flags &= ~(ICE_AQ_VSI_OUTER_TAG_MODE_M);
741 vsi->info.outer_tag_flags |= qinq_flags;
742 /* use default vlan type 0x8100 */
743 vsi->info.outer_tag_flags &= ~(ICE_AQ_VSI_OUTER_TAG_TYPE_M);
744 vsi->info.outer_tag_flags |= ICE_DFLT_OUTER_TAG_TYPE <<
745 ICE_AQ_VSI_OUTER_TAG_TYPE_S;
746 (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
747 ctxt.info.valid_sections =
748 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);
749 ctxt.vsi_num = vsi->vsi_id;
750 ret = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);
753 "Update VSI failed to %s qinq stripping",
754 on ? "enable" : "disable");
758 vsi->info.valid_sections |=
759 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);
765 ice_vsi_config_double_vlan(struct ice_vsi *vsi, int on)
769 ret = ice_vsi_config_qinq_stripping(vsi, on);
771 PMD_DRV_LOG(ERR, "Fail to set qinq stripping - %d", ret);
773 ret = ice_vsi_config_qinq_insertion(vsi, on);
775 PMD_DRV_LOG(ERR, "Fail to set qinq insertion - %d", ret);
782 ice_pf_enable_irq0(struct ice_hw *hw)
784 /* reset the registers */
785 ICE_WRITE_REG(hw, PFINT_OICR_ENA, 0);
786 ICE_READ_REG(hw, PFINT_OICR);
789 ICE_WRITE_REG(hw, PFINT_OICR_ENA,
790 (uint32_t)(PFINT_OICR_ENA_INT_ENA_M &
791 (~PFINT_OICR_LINK_STAT_CHANGE_M)));
793 ICE_WRITE_REG(hw, PFINT_OICR_CTL,
794 (0 & PFINT_OICR_CTL_MSIX_INDX_M) |
795 ((0 << PFINT_OICR_CTL_ITR_INDX_S) &
796 PFINT_OICR_CTL_ITR_INDX_M) |
797 PFINT_OICR_CTL_CAUSE_ENA_M);
799 ICE_WRITE_REG(hw, PFINT_FW_CTL,
800 (0 & PFINT_FW_CTL_MSIX_INDX_M) |
801 ((0 << PFINT_FW_CTL_ITR_INDX_S) &
802 PFINT_FW_CTL_ITR_INDX_M) |
803 PFINT_FW_CTL_CAUSE_ENA_M);
805 ICE_WRITE_REG(hw, PFINT_OICR_ENA, PFINT_OICR_ENA_INT_ENA_M);
808 ICE_WRITE_REG(hw, GLINT_DYN_CTL(0),
809 GLINT_DYN_CTL_INTENA_M |
810 GLINT_DYN_CTL_CLEARPBA_M |
811 GLINT_DYN_CTL_ITR_INDX_M);
818 ice_pf_disable_irq0(struct ice_hw *hw)
820 /* Disable all interrupt types */
821 ICE_WRITE_REG(hw, GLINT_DYN_CTL(0), GLINT_DYN_CTL_WB_ON_ITR_M);
827 ice_handle_aq_msg(struct rte_eth_dev *dev)
829 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
830 struct ice_ctl_q_info *cq = &hw->adminq;
831 struct ice_rq_event_info event;
832 uint16_t pending, opcode;
835 event.buf_len = ICE_AQ_MAX_BUF_LEN;
836 event.msg_buf = rte_zmalloc(NULL, event.buf_len, 0);
837 if (!event.msg_buf) {
838 PMD_DRV_LOG(ERR, "Failed to allocate mem");
844 ret = ice_clean_rq_elem(hw, cq, &event, &pending);
846 if (ret != ICE_SUCCESS) {
848 "Failed to read msg from AdminQ, "
850 hw->adminq.sq_last_status);
853 opcode = rte_le_to_cpu_16(event.desc.opcode);
856 case ice_aqc_opc_get_link_status:
857 ret = ice_link_update(dev, 0);
859 _rte_eth_dev_callback_process
860 (dev, RTE_ETH_EVENT_INTR_LSC, NULL);
863 PMD_DRV_LOG(DEBUG, "Request %u is not supported yet",
868 rte_free(event.msg_buf);
873 * Interrupt handler triggered by NIC for handling
874 * specific interrupt.
877 * Pointer to interrupt handle.
879 * The address of parameter (struct rte_eth_dev *) regsitered before.
885 ice_interrupt_handler(void *param)
887 struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
888 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
898 /* Disable interrupt */
899 ice_pf_disable_irq0(hw);
901 /* read out interrupt causes */
902 oicr = ICE_READ_REG(hw, PFINT_OICR);
904 int_fw_ctl = ICE_READ_REG(hw, PFINT_FW_CTL);
907 /* No interrupt event indicated */
908 if (!(oicr & PFINT_OICR_INTEVENT_M)) {
909 PMD_DRV_LOG(INFO, "No interrupt event");
914 if (int_fw_ctl & PFINT_FW_CTL_INTEVENT_M) {
915 PMD_DRV_LOG(INFO, "FW_CTL: link state change event");
916 ice_handle_aq_msg(dev);
919 if (oicr & PFINT_OICR_LINK_STAT_CHANGE_M) {
920 PMD_DRV_LOG(INFO, "OICR: link state change event");
921 ice_link_update(dev, 0);
925 if (oicr & PFINT_OICR_MAL_DETECT_M) {
926 PMD_DRV_LOG(WARNING, "OICR: MDD event");
927 reg = ICE_READ_REG(hw, GL_MDET_TX_PQM);
928 if (reg & GL_MDET_TX_PQM_VALID_M) {
929 pf_num = (reg & GL_MDET_TX_PQM_PF_NUM_M) >>
930 GL_MDET_TX_PQM_PF_NUM_S;
931 event = (reg & GL_MDET_TX_PQM_MAL_TYPE_M) >>
932 GL_MDET_TX_PQM_MAL_TYPE_S;
933 queue = (reg & GL_MDET_TX_PQM_QNUM_M) >>
934 GL_MDET_TX_PQM_QNUM_S;
936 PMD_DRV_LOG(WARNING, "Malicious Driver Detection event "
937 "%d by PQM on TX queue %d PF# %d",
938 event, queue, pf_num);
941 reg = ICE_READ_REG(hw, GL_MDET_TX_TCLAN);
942 if (reg & GL_MDET_TX_TCLAN_VALID_M) {
943 pf_num = (reg & GL_MDET_TX_TCLAN_PF_NUM_M) >>
944 GL_MDET_TX_TCLAN_PF_NUM_S;
945 event = (reg & GL_MDET_TX_TCLAN_MAL_TYPE_M) >>
946 GL_MDET_TX_TCLAN_MAL_TYPE_S;
947 queue = (reg & GL_MDET_TX_TCLAN_QNUM_M) >>
948 GL_MDET_TX_TCLAN_QNUM_S;
950 PMD_DRV_LOG(WARNING, "Malicious Driver Detection event "
951 "%d by TCLAN on TX queue %d PF# %d",
952 event, queue, pf_num);
956 /* Enable interrupt */
957 ice_pf_enable_irq0(hw);
958 rte_intr_enable(dev->intr_handle);
961 /* Initialize SW parameters of PF */
963 ice_pf_sw_init(struct rte_eth_dev *dev)
965 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
966 struct ice_hw *hw = ICE_PF_TO_HW(pf);
968 if (ice_config_max_queue_pair_num(dev->device->devargs) > 0)
970 ice_config_max_queue_pair_num(dev->device->devargs);
973 (uint16_t)RTE_MIN(hw->func_caps.common_cap.num_txq,
974 hw->func_caps.common_cap.num_rxq);
976 pf->lan_nb_qps = pf->lan_nb_qp_max;
981 static struct ice_vsi *
982 ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
984 struct ice_hw *hw = ICE_PF_TO_HW(pf);
985 struct ice_vsi *vsi = NULL;
986 struct ice_vsi_ctx vsi_ctx;
988 struct ether_addr broadcast = {
989 .addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} };
990 struct ether_addr mac_addr;
991 uint16_t max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };
992 uint8_t tc_bitmap = 0x1;
994 /* hw->num_lports = 1 in NIC mode */
995 vsi = rte_zmalloc(NULL, sizeof(struct ice_vsi), 0);
999 vsi->idx = pf->next_vsi_idx;
1002 vsi->adapter = ICE_PF_TO_ADAPTER(pf);
1003 vsi->max_macaddrs = ICE_NUM_MACADDR_MAX;
1004 vsi->vlan_anti_spoof_on = 0;
1005 vsi->vlan_filter_on = 1;
1006 TAILQ_INIT(&vsi->mac_list);
1007 TAILQ_INIT(&vsi->vlan_list);
1009 memset(&vsi_ctx, 0, sizeof(vsi_ctx));
1010 /* base_queue in used in queue mapping of VSI add/update command.
1011 * Suppose vsi->base_queue is 0 now, don't consider SRIOV, VMDQ
1012 * cases in the first stage. Only Main VSI.
1014 vsi->base_queue = 0;
1017 vsi->nb_qps = pf->lan_nb_qps;
1018 ice_vsi_config_default_rss(&vsi_ctx.info);
1019 vsi_ctx.alloc_from_pool = true;
1020 vsi_ctx.flags = ICE_AQ_VSI_TYPE_PF;
1021 /* switch_id is queried by get_switch_config aq, which is done
1024 vsi_ctx.info.sw_id = hw->port_info->sw_id;
1025 vsi_ctx.info.sw_flags2 = ICE_AQ_VSI_SW_FLAG_LAN_ENA;
1026 /* Allow all untagged or tagged packets */
1027 vsi_ctx.info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_ALL;
1028 vsi_ctx.info.vlan_flags |= ICE_AQ_VSI_VLAN_EMOD_NOTHING;
1029 vsi_ctx.info.q_opt_rss = ICE_AQ_VSI_Q_OPT_RSS_LUT_PF |
1030 ICE_AQ_VSI_Q_OPT_RSS_TPLZ;
1031 /* Enable VLAN/UP trip */
1032 ret = ice_vsi_config_tc_queue_mapping(vsi,
1037 "tc queue mapping with vsi failed, "
1045 /* for other types of VSI */
1046 PMD_INIT_LOG(ERR, "other types of VSI not supported");
1050 /* VF has MSIX interrupt in VF range, don't allocate here */
1051 if (type == ICE_VSI_PF) {
1052 ret = ice_res_pool_alloc(&pf->msix_pool,
1053 RTE_MIN(vsi->nb_qps,
1054 RTE_MAX_RXTX_INTR_VEC_ID));
1056 PMD_INIT_LOG(ERR, "VSI MAIN %d get heap failed %d",
1059 vsi->msix_intr = ret;
1060 vsi->nb_msix = RTE_MIN(vsi->nb_qps, RTE_MAX_RXTX_INTR_VEC_ID);
1065 ret = ice_add_vsi(hw, vsi->idx, &vsi_ctx, NULL);
1066 if (ret != ICE_SUCCESS) {
1067 PMD_INIT_LOG(ERR, "add vsi failed, err = %d", ret);
1070 /* store vsi information is SW structure */
1071 vsi->vsi_id = vsi_ctx.vsi_num;
1072 vsi->info = vsi_ctx.info;
1073 pf->vsis_allocated = vsi_ctx.vsis_allocd;
1074 pf->vsis_unallocated = vsi_ctx.vsis_unallocated;
1076 /* MAC configuration */
1077 rte_memcpy(pf->dev_addr.addr_bytes,
1078 hw->port_info->mac.perm_addr,
1081 rte_memcpy(&mac_addr, &pf->dev_addr, ETHER_ADDR_LEN);
1082 ret = ice_add_mac_filter(vsi, &mac_addr);
1083 if (ret != ICE_SUCCESS)
1084 PMD_INIT_LOG(ERR, "Failed to add dflt MAC filter");
1086 rte_memcpy(&mac_addr, &broadcast, ETHER_ADDR_LEN);
1087 ret = ice_add_mac_filter(vsi, &mac_addr);
1088 if (ret != ICE_SUCCESS)
1089 PMD_INIT_LOG(ERR, "Failed to add MAC filter");
1091 /* At the beginning, only TC0. */
1092 /* What we need here is the maximam number of the TX queues.
1093 * Currently vsi->nb_qps means it.
1094 * Correct it if any change.
1096 max_txqs[0] = vsi->nb_qps;
1097 ret = ice_cfg_vsi_lan(hw->port_info, vsi->idx,
1098 tc_bitmap, max_txqs);
1099 if (ret != ICE_SUCCESS)
1100 PMD_INIT_LOG(ERR, "Failed to config vsi sched");
1110 ice_pf_setup(struct ice_pf *pf)
1112 struct ice_vsi *vsi;
1114 /* Clear all stats counters */
1115 pf->offset_loaded = FALSE;
1116 memset(&pf->stats, 0, sizeof(struct ice_hw_port_stats));
1117 memset(&pf->stats_offset, 0, sizeof(struct ice_hw_port_stats));
1118 memset(&pf->internal_stats, 0, sizeof(struct ice_eth_stats));
1119 memset(&pf->internal_stats_offset, 0, sizeof(struct ice_eth_stats));
1121 vsi = ice_setup_vsi(pf, ICE_VSI_PF);
1123 PMD_INIT_LOG(ERR, "Failed to add vsi for PF");
1133 ice_dev_init(struct rte_eth_dev *dev)
1135 struct rte_pci_device *pci_dev;
1136 struct rte_intr_handle *intr_handle;
1137 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1138 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
1139 struct ice_vsi *vsi;
1142 dev->dev_ops = &ice_eth_dev_ops;
1143 dev->rx_pkt_burst = ice_recv_pkts;
1144 dev->tx_pkt_burst = ice_xmit_pkts;
1145 dev->tx_pkt_prepare = ice_prep_pkts;
1147 ice_set_default_ptype_table(dev);
1148 pci_dev = RTE_DEV_TO_PCI(dev->device);
1149 intr_handle = &pci_dev->intr_handle;
1151 pf->adapter = ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
1152 pf->adapter->eth_dev = dev;
1153 pf->dev_data = dev->data;
1154 hw->back = pf->adapter;
1155 hw->hw_addr = (uint8_t *)pci_dev->mem_resource[0].addr;
1156 hw->vendor_id = pci_dev->id.vendor_id;
1157 hw->device_id = pci_dev->id.device_id;
1158 hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
1159 hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
1160 hw->bus.device = pci_dev->addr.devid;
1161 hw->bus.func = pci_dev->addr.function;
1163 ice_init_controlq_parameter(hw);
1165 ret = ice_init_hw(hw);
1167 PMD_INIT_LOG(ERR, "Failed to initialize HW");
1171 PMD_INIT_LOG(INFO, "FW %d.%d.%05d API %d.%d",
1172 hw->fw_maj_ver, hw->fw_min_ver, hw->fw_build,
1173 hw->api_maj_ver, hw->api_min_ver);
1175 ice_pf_sw_init(dev);
1176 ret = ice_init_mac_address(dev);
1178 PMD_INIT_LOG(ERR, "Failed to initialize mac address");
1182 ret = ice_res_pool_init(&pf->msix_pool, 1,
1183 hw->func_caps.common_cap.num_msix_vectors - 1);
1185 PMD_INIT_LOG(ERR, "Failed to init MSIX pool");
1186 goto err_msix_pool_init;
1189 ret = ice_pf_setup(pf);
1191 PMD_INIT_LOG(ERR, "Failed to setup PF");
1197 /* Disable double vlan by default */
1198 ice_vsi_config_double_vlan(vsi, FALSE);
1200 /* register callback func to eal lib */
1201 rte_intr_callback_register(intr_handle,
1202 ice_interrupt_handler, dev);
1204 ice_pf_enable_irq0(hw);
1206 /* enable uio intr after callback register */
1207 rte_intr_enable(intr_handle);
1212 ice_res_pool_destroy(&pf->msix_pool);
1214 rte_free(dev->data->mac_addrs);
1216 ice_sched_cleanup_all(hw);
1217 rte_free(hw->port_info);
1218 ice_shutdown_all_ctrlq(hw);
1224 ice_release_vsi(struct ice_vsi *vsi)
1227 struct ice_vsi_ctx vsi_ctx;
1228 enum ice_status ret;
1233 hw = ICE_VSI_TO_HW(vsi);
1235 ice_remove_all_mac_vlan_filters(vsi);
1237 memset(&vsi_ctx, 0, sizeof(vsi_ctx));
1239 vsi_ctx.vsi_num = vsi->vsi_id;
1240 vsi_ctx.info = vsi->info;
1241 ret = ice_free_vsi(hw, vsi->idx, &vsi_ctx, false, NULL);
1242 if (ret != ICE_SUCCESS) {
1243 PMD_INIT_LOG(ERR, "Failed to free vsi by aq, %u", vsi->vsi_id);
1253 ice_dev_stop(struct rte_eth_dev *dev)
1255 struct rte_eth_dev_data *data = dev->data;
1256 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
1257 struct rte_pci_device *pci_dev = ICE_DEV_TO_PCI(dev);
1258 struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
1261 /* avoid stopping again */
1262 if (pf->adapter_stopped)
1265 /* stop and clear all Rx queues */
1266 for (i = 0; i < data->nb_rx_queues; i++)
1267 ice_rx_queue_stop(dev, i);
1269 /* stop and clear all Tx queues */
1270 for (i = 0; i < data->nb_tx_queues; i++)
1271 ice_tx_queue_stop(dev, i);
1273 /* Clear all queues and release mbufs */
1274 ice_clear_queues(dev);
1276 /* Clean datapath event and queue/vec mapping */
1277 rte_intr_efd_disable(intr_handle);
1278 if (intr_handle->intr_vec) {
1279 rte_free(intr_handle->intr_vec);
1280 intr_handle->intr_vec = NULL;
1283 pf->adapter_stopped = true;
1287 ice_dev_close(struct rte_eth_dev *dev)
1289 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
1290 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1294 /* release all queue resource */
1295 ice_free_queues(dev);
1297 ice_res_pool_destroy(&pf->msix_pool);
1298 ice_release_vsi(pf->main_vsi);
1300 ice_shutdown_all_ctrlq(hw);
1304 ice_dev_uninit(struct rte_eth_dev *dev)
1306 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1307 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
1308 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
1309 struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
1313 dev->dev_ops = NULL;
1314 dev->rx_pkt_burst = NULL;
1315 dev->tx_pkt_burst = NULL;
1317 rte_free(dev->data->mac_addrs);
1318 dev->data->mac_addrs = NULL;
1320 /* disable uio intr before callback unregister */
1321 rte_intr_disable(intr_handle);
1323 /* register callback func to eal lib */
1324 rte_intr_callback_unregister(intr_handle,
1325 ice_interrupt_handler, dev);
1327 ice_release_vsi(pf->main_vsi);
1328 ice_sched_cleanup_all(hw);
1329 rte_free(hw->port_info);
1330 ice_shutdown_all_ctrlq(hw);
1336 ice_dev_configure(__rte_unused struct rte_eth_dev *dev)
1338 struct ice_adapter *ad =
1339 ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
1341 /* Initialize to TRUE. If any of Rx queues doesn't meet the
1342 * bulk allocation or vector Rx preconditions we will reset it.
1344 ad->rx_bulk_alloc_allowed = true;
1345 ad->tx_simple_allowed = true;
1350 static int ice_init_rss(struct ice_pf *pf)
1352 struct ice_hw *hw = ICE_PF_TO_HW(pf);
1353 struct ice_vsi *vsi = pf->main_vsi;
1354 struct rte_eth_dev *dev = pf->adapter->eth_dev;
1355 struct rte_eth_rss_conf *rss_conf;
1356 struct ice_aqc_get_set_rss_keys key;
1360 rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf;
1361 nb_q = dev->data->nb_rx_queues;
1362 vsi->rss_key_size = ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE;
1363 vsi->rss_lut_size = hw->func_caps.common_cap.rss_table_size;
1366 vsi->rss_key = rte_zmalloc(NULL,
1367 vsi->rss_key_size, 0);
1369 vsi->rss_lut = rte_zmalloc(NULL,
1370 vsi->rss_lut_size, 0);
1372 /* configure RSS key */
1373 if (!rss_conf->rss_key) {
1374 /* Calculate the default hash key */
1375 for (i = 0; i <= vsi->rss_key_size; i++)
1376 vsi->rss_key[i] = (uint8_t)rte_rand();
1378 rte_memcpy(vsi->rss_key, rss_conf->rss_key,
1379 RTE_MIN(rss_conf->rss_key_len,
1380 vsi->rss_key_size));
1382 rte_memcpy(key.standard_rss_key, vsi->rss_key, vsi->rss_key_size);
1383 ret = ice_aq_set_rss_key(hw, vsi->idx, &key);
1387 /* init RSS LUT table */
1388 for (i = 0; i < vsi->rss_lut_size; i++)
1389 vsi->rss_lut[i] = i % nb_q;
1391 ret = ice_aq_set_rss_lut(hw, vsi->idx,
1392 ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF,
1393 vsi->rss_lut, vsi->rss_lut_size);
1401 ice_dev_start(struct rte_eth_dev *dev)
1403 struct rte_eth_dev_data *data = dev->data;
1404 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1405 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
1406 uint16_t nb_rxq = 0;
1410 /* program Tx queues' context in hardware */
1411 for (nb_txq = 0; nb_txq < data->nb_tx_queues; nb_txq++) {
1412 ret = ice_tx_queue_start(dev, nb_txq);
1414 PMD_DRV_LOG(ERR, "fail to start Tx queue %u", nb_txq);
1419 /* program Rx queues' context in hardware*/
1420 for (nb_rxq = 0; nb_rxq < data->nb_rx_queues; nb_rxq++) {
1421 ret = ice_rx_queue_start(dev, nb_rxq);
1423 PMD_DRV_LOG(ERR, "fail to start Rx queue %u", nb_rxq);
1428 ret = ice_init_rss(pf);
1430 PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
1434 ice_set_rx_function(dev);
1436 ret = ice_aq_set_event_mask(hw, hw->port_info->lport,
1437 ((u16)(ICE_AQ_LINK_EVENT_LINK_FAULT |
1438 ICE_AQ_LINK_EVENT_PHY_TEMP_ALARM |
1439 ICE_AQ_LINK_EVENT_EXCESSIVE_ERRORS |
1440 ICE_AQ_LINK_EVENT_SIGNAL_DETECT |
1441 ICE_AQ_LINK_EVENT_AN_COMPLETED |
1442 ICE_AQ_LINK_EVENT_PORT_TX_SUSPENDED)),
1444 if (ret != ICE_SUCCESS)
1445 PMD_DRV_LOG(WARNING, "Fail to set phy mask");
1447 /* Call get_link_info aq commond to enable/disable LSE */
1448 ice_link_update(dev, 0);
1450 pf->adapter_stopped = false;
1454 /* stop the started queues if failed to start all queues */
1456 for (i = 0; i < nb_rxq; i++)
1457 ice_rx_queue_stop(dev, i);
1459 for (i = 0; i < nb_txq; i++)
1460 ice_tx_queue_stop(dev, i);
1466 ice_dev_reset(struct rte_eth_dev *dev)
1470 if (dev->data->sriov.active)
1473 ret = ice_dev_uninit(dev);
1475 PMD_INIT_LOG(ERR, "failed to uninit device, status = %d", ret);
1479 ret = ice_dev_init(dev);
1481 PMD_INIT_LOG(ERR, "failed to init device, status = %d", ret);
1489 ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
1491 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
1492 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1493 struct ice_vsi *vsi = pf->main_vsi;
1494 struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev->device);
1496 dev_info->min_rx_bufsize = ICE_BUF_SIZE_MIN;
1497 dev_info->max_rx_pktlen = ICE_FRAME_SIZE_MAX;
1498 dev_info->max_rx_queues = vsi->nb_qps;
1499 dev_info->max_tx_queues = vsi->nb_qps;
1500 dev_info->max_mac_addrs = vsi->max_macaddrs;
1501 dev_info->max_vfs = pci_dev->max_vfs;
1503 dev_info->rx_offload_capa =
1504 DEV_RX_OFFLOAD_VLAN_STRIP |
1505 DEV_RX_OFFLOAD_IPV4_CKSUM |
1506 DEV_RX_OFFLOAD_UDP_CKSUM |
1507 DEV_RX_OFFLOAD_TCP_CKSUM |
1508 DEV_RX_OFFLOAD_QINQ_STRIP |
1509 DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
1510 DEV_RX_OFFLOAD_VLAN_EXTEND |
1511 DEV_RX_OFFLOAD_JUMBO_FRAME |
1512 DEV_RX_OFFLOAD_KEEP_CRC |
1513 DEV_RX_OFFLOAD_VLAN_FILTER;
1514 dev_info->tx_offload_capa =
1515 DEV_TX_OFFLOAD_VLAN_INSERT |
1516 DEV_TX_OFFLOAD_QINQ_INSERT |
1517 DEV_TX_OFFLOAD_IPV4_CKSUM |
1518 DEV_TX_OFFLOAD_UDP_CKSUM |
1519 DEV_TX_OFFLOAD_TCP_CKSUM |
1520 DEV_TX_OFFLOAD_SCTP_CKSUM |
1521 DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
1522 DEV_TX_OFFLOAD_TCP_TSO |
1523 DEV_TX_OFFLOAD_MULTI_SEGS;
1524 dev_info->rx_queue_offload_capa = 0;
1525 dev_info->tx_queue_offload_capa = 0;
1527 dev_info->reta_size = hw->func_caps.common_cap.rss_table_size;
1528 dev_info->hash_key_size = (VSIQF_HKEY_MAX_INDEX + 1) * sizeof(uint32_t);
1530 dev_info->default_rxconf = (struct rte_eth_rxconf) {
1532 .pthresh = ICE_DEFAULT_RX_PTHRESH,
1533 .hthresh = ICE_DEFAULT_RX_HTHRESH,
1534 .wthresh = ICE_DEFAULT_RX_WTHRESH,
1536 .rx_free_thresh = ICE_DEFAULT_RX_FREE_THRESH,
1541 dev_info->default_txconf = (struct rte_eth_txconf) {
1543 .pthresh = ICE_DEFAULT_TX_PTHRESH,
1544 .hthresh = ICE_DEFAULT_TX_HTHRESH,
1545 .wthresh = ICE_DEFAULT_TX_WTHRESH,
1547 .tx_free_thresh = ICE_DEFAULT_TX_FREE_THRESH,
1548 .tx_rs_thresh = ICE_DEFAULT_TX_RSBIT_THRESH,
1552 dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
1553 .nb_max = ICE_MAX_RING_DESC,
1554 .nb_min = ICE_MIN_RING_DESC,
1555 .nb_align = ICE_ALIGN_RING_DESC,
1558 dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
1559 .nb_max = ICE_MAX_RING_DESC,
1560 .nb_min = ICE_MIN_RING_DESC,
1561 .nb_align = ICE_ALIGN_RING_DESC,
1564 dev_info->speed_capa = ETH_LINK_SPEED_10M |
1565 ETH_LINK_SPEED_100M |
1567 ETH_LINK_SPEED_2_5G |
1569 ETH_LINK_SPEED_10G |
1570 ETH_LINK_SPEED_20G |
1571 ETH_LINK_SPEED_25G |
1574 dev_info->nb_rx_queues = dev->data->nb_rx_queues;
1575 dev_info->nb_tx_queues = dev->data->nb_tx_queues;
1577 dev_info->default_rxportconf.burst_size = ICE_RX_MAX_BURST;
1578 dev_info->default_txportconf.burst_size = ICE_TX_MAX_BURST;
1579 dev_info->default_rxportconf.nb_queues = 1;
1580 dev_info->default_txportconf.nb_queues = 1;
1581 dev_info->default_rxportconf.ring_size = ICE_BUF_SIZE_MIN;
1582 dev_info->default_txportconf.ring_size = ICE_BUF_SIZE_MIN;
1586 ice_atomic_read_link_status(struct rte_eth_dev *dev,
1587 struct rte_eth_link *link)
1589 struct rte_eth_link *dst = link;
1590 struct rte_eth_link *src = &dev->data->dev_link;
1592 if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
1593 *(uint64_t *)src) == 0)
1600 ice_atomic_write_link_status(struct rte_eth_dev *dev,
1601 struct rte_eth_link *link)
1603 struct rte_eth_link *dst = &dev->data->dev_link;
1604 struct rte_eth_link *src = link;
1606 if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
1607 *(uint64_t *)src) == 0)
1614 ice_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete)
1616 #define CHECK_INTERVAL 100 /* 100ms */
1617 #define MAX_REPEAT_TIME 10 /* 1s (10 * 100ms) in total */
1618 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1619 struct ice_link_status link_status;
1620 struct rte_eth_link link, old;
1622 unsigned int rep_cnt = MAX_REPEAT_TIME;
1623 bool enable_lse = dev->data->dev_conf.intr_conf.lsc ? true : false;
1625 memset(&link, 0, sizeof(link));
1626 memset(&old, 0, sizeof(old));
1627 memset(&link_status, 0, sizeof(link_status));
1628 ice_atomic_read_link_status(dev, &old);
1631 /* Get link status information from hardware */
1632 status = ice_aq_get_link_info(hw->port_info, enable_lse,
1633 &link_status, NULL);
1634 if (status != ICE_SUCCESS) {
1635 link.link_speed = ETH_SPEED_NUM_100M;
1636 link.link_duplex = ETH_LINK_FULL_DUPLEX;
1637 PMD_DRV_LOG(ERR, "Failed to get link info");
1641 link.link_status = link_status.link_info & ICE_AQ_LINK_UP;
1642 if (!wait_to_complete || link.link_status)
1645 rte_delay_ms(CHECK_INTERVAL);
1646 } while (--rep_cnt);
1648 if (!link.link_status)
1651 /* Full-duplex operation at all supported speeds */
1652 link.link_duplex = ETH_LINK_FULL_DUPLEX;
1654 /* Parse the link status */
1655 switch (link_status.link_speed) {
1656 case ICE_AQ_LINK_SPEED_10MB:
1657 link.link_speed = ETH_SPEED_NUM_10M;
1659 case ICE_AQ_LINK_SPEED_100MB:
1660 link.link_speed = ETH_SPEED_NUM_100M;
1662 case ICE_AQ_LINK_SPEED_1000MB:
1663 link.link_speed = ETH_SPEED_NUM_1G;
1665 case ICE_AQ_LINK_SPEED_2500MB:
1666 link.link_speed = ETH_SPEED_NUM_2_5G;
1668 case ICE_AQ_LINK_SPEED_5GB:
1669 link.link_speed = ETH_SPEED_NUM_5G;
1671 case ICE_AQ_LINK_SPEED_10GB:
1672 link.link_speed = ETH_SPEED_NUM_10G;
1674 case ICE_AQ_LINK_SPEED_20GB:
1675 link.link_speed = ETH_SPEED_NUM_20G;
1677 case ICE_AQ_LINK_SPEED_25GB:
1678 link.link_speed = ETH_SPEED_NUM_25G;
1680 case ICE_AQ_LINK_SPEED_40GB:
1681 link.link_speed = ETH_SPEED_NUM_40G;
1683 case ICE_AQ_LINK_SPEED_UNKNOWN:
1685 PMD_DRV_LOG(ERR, "Unknown link speed");
1686 link.link_speed = ETH_SPEED_NUM_NONE;
1690 link.link_autoneg = !(dev->data->dev_conf.link_speeds &
1691 ETH_LINK_SPEED_FIXED);
1694 ice_atomic_write_link_status(dev, &link);
1695 if (link.link_status == old.link_status)
1702 ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
1704 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
1705 struct rte_eth_dev_data *dev_data = pf->dev_data;
1706 uint32_t frame_size = mtu + ETHER_HDR_LEN
1707 + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE;
1709 /* check if mtu is within the allowed range */
1710 if (mtu < ETHER_MIN_MTU || frame_size > ICE_FRAME_SIZE_MAX)
1713 /* mtu setting is forbidden if port is start */
1714 if (dev_data->dev_started) {
1716 "port %d must be stopped before configuration",
1721 if (frame_size > ETHER_MAX_LEN)
1722 dev_data->dev_conf.rxmode.offloads |=
1723 DEV_RX_OFFLOAD_JUMBO_FRAME;
1725 dev_data->dev_conf.rxmode.offloads &=
1726 ~DEV_RX_OFFLOAD_JUMBO_FRAME;
1728 dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
1733 static int ice_macaddr_set(struct rte_eth_dev *dev,
1734 struct ether_addr *mac_addr)
1736 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1737 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
1738 struct ice_vsi *vsi = pf->main_vsi;
1739 struct ice_mac_filter *f;
1743 if (!is_valid_assigned_ether_addr(mac_addr)) {
1744 PMD_DRV_LOG(ERR, "Tried to set invalid MAC address.");
1748 TAILQ_FOREACH(f, &vsi->mac_list, next) {
1749 if (is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr))
1754 PMD_DRV_LOG(ERR, "Failed to find filter for default mac");
1758 ret = ice_remove_mac_filter(vsi, &f->mac_info.mac_addr);
1759 if (ret != ICE_SUCCESS) {
1760 PMD_DRV_LOG(ERR, "Failed to delete mac filter");
1763 ret = ice_add_mac_filter(vsi, mac_addr);
1764 if (ret != ICE_SUCCESS) {
1765 PMD_DRV_LOG(ERR, "Failed to add mac filter");
1768 memcpy(&pf->dev_addr, mac_addr, ETH_ADDR_LEN);
1770 flags = ICE_AQC_MAN_MAC_UPDATE_LAA_WOL;
1771 ret = ice_aq_manage_mac_write(hw, mac_addr->addr_bytes, flags, NULL);
1772 if (ret != ICE_SUCCESS)
1773 PMD_DRV_LOG(ERR, "Failed to set manage mac");
1778 /* Add a MAC address, and update filters */
1780 ice_macaddr_add(struct rte_eth_dev *dev,
1781 struct ether_addr *mac_addr,
1782 __rte_unused uint32_t index,
1783 __rte_unused uint32_t pool)
1785 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
1786 struct ice_vsi *vsi = pf->main_vsi;
1789 ret = ice_add_mac_filter(vsi, mac_addr);
1790 if (ret != ICE_SUCCESS) {
1791 PMD_DRV_LOG(ERR, "Failed to add MAC filter");
1798 /* Remove a MAC address, and update filters */
1800 ice_macaddr_remove(struct rte_eth_dev *dev, uint32_t index)
1802 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
1803 struct ice_vsi *vsi = pf->main_vsi;
1804 struct rte_eth_dev_data *data = dev->data;
1805 struct ether_addr *macaddr;
1808 macaddr = &data->mac_addrs[index];
1809 ret = ice_remove_mac_filter(vsi, macaddr);
1811 PMD_DRV_LOG(ERR, "Failed to remove MAC filter");
1817 ice_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
1819 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
1820 struct ice_vsi *vsi = pf->main_vsi;
1823 PMD_INIT_FUNC_TRACE();
1826 ret = ice_add_vlan_filter(vsi, vlan_id);
1828 PMD_DRV_LOG(ERR, "Failed to add vlan filter");
1832 ret = ice_remove_vlan_filter(vsi, vlan_id);
1834 PMD_DRV_LOG(ERR, "Failed to remove vlan filter");
1842 /* Configure vlan filter on or off */
1844 ice_vsi_config_vlan_filter(struct ice_vsi *vsi, bool on)
1846 struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
1847 struct ice_vsi_ctx ctxt;
1848 uint8_t sec_flags, sw_flags2;
1851 sec_flags = ICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA <<
1852 ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S;
1853 sw_flags2 = ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;
1856 vsi->info.sec_flags |= sec_flags;
1857 vsi->info.sw_flags2 |= sw_flags2;
1859 vsi->info.sec_flags &= ~sec_flags;
1860 vsi->info.sw_flags2 &= ~sw_flags2;
1862 vsi->info.sw_id = hw->port_info->sw_id;
1863 (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
1864 ctxt.info.valid_sections =
1865 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_SW_VALID |
1866 ICE_AQ_VSI_PROP_SECURITY_VALID);
1867 ctxt.vsi_num = vsi->vsi_id;
1869 ret = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);
1871 PMD_DRV_LOG(INFO, "Update VSI failed to %s vlan rx pruning",
1872 on ? "enable" : "disable");
1875 vsi->info.valid_sections |=
1876 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_SW_VALID |
1877 ICE_AQ_VSI_PROP_SECURITY_VALID);
1884 ice_vsi_config_vlan_stripping(struct ice_vsi *vsi, bool on)
1886 struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
1887 struct ice_vsi_ctx ctxt;
1891 /* Check if it has been already on or off */
1892 if (vsi->info.valid_sections &
1893 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID)) {
1895 if ((vsi->info.vlan_flags &
1896 ICE_AQ_VSI_VLAN_EMOD_M) ==
1897 ICE_AQ_VSI_VLAN_EMOD_STR_BOTH)
1898 return 0; /* already on */
1900 if ((vsi->info.vlan_flags &
1901 ICE_AQ_VSI_VLAN_EMOD_M) ==
1902 ICE_AQ_VSI_VLAN_EMOD_NOTHING)
1903 return 0; /* already off */
1908 vlan_flags = ICE_AQ_VSI_VLAN_EMOD_STR_BOTH;
1910 vlan_flags = ICE_AQ_VSI_VLAN_EMOD_NOTHING;
1911 vsi->info.vlan_flags &= ~(ICE_AQ_VSI_VLAN_EMOD_M);
1912 vsi->info.vlan_flags |= vlan_flags;
1913 (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
1914 ctxt.info.valid_sections =
1915 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID);
1916 ctxt.vsi_num = vsi->vsi_id;
1917 ret = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);
1919 PMD_DRV_LOG(INFO, "Update VSI failed to %s vlan stripping",
1920 on ? "enable" : "disable");
1924 vsi->info.valid_sections |=
1925 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID);
1931 ice_vlan_offload_set(struct rte_eth_dev *dev, int mask)
1933 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
1934 struct ice_vsi *vsi = pf->main_vsi;
1935 struct rte_eth_rxmode *rxmode;
1937 rxmode = &dev->data->dev_conf.rxmode;
1938 if (mask & ETH_VLAN_FILTER_MASK) {
1939 if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
1940 ice_vsi_config_vlan_filter(vsi, TRUE);
1942 ice_vsi_config_vlan_filter(vsi, FALSE);
1945 if (mask & ETH_VLAN_STRIP_MASK) {
1946 if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
1947 ice_vsi_config_vlan_stripping(vsi, TRUE);
1949 ice_vsi_config_vlan_stripping(vsi, FALSE);
1952 if (mask & ETH_VLAN_EXTEND_MASK) {
1953 if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)
1954 ice_vsi_config_double_vlan(vsi, TRUE);
1956 ice_vsi_config_double_vlan(vsi, FALSE);
1963 ice_vlan_tpid_set(struct rte_eth_dev *dev,
1964 enum rte_vlan_type vlan_type,
1967 struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1968 uint64_t reg_r = 0, reg_w = 0;
1969 uint16_t reg_id = 0;
1971 int qinq = dev->data->dev_conf.rxmode.offloads &
1972 DEV_RX_OFFLOAD_VLAN_EXTEND;
1974 switch (vlan_type) {
1975 case ETH_VLAN_TYPE_OUTER:
1981 case ETH_VLAN_TYPE_INNER:
1986 "Unsupported vlan type in single vlan.");
1991 PMD_DRV_LOG(ERR, "Unsupported vlan type %d", vlan_type);
1994 reg_r = ICE_READ_REG(hw, GL_SWT_L2TAGCTRL(reg_id));
1995 PMD_DRV_LOG(DEBUG, "Debug read from ICE GL_SWT_L2TAGCTRL[%d]: "
1996 "0x%08"PRIx64"", reg_id, reg_r);
1998 reg_w = reg_r & (~(GL_SWT_L2TAGCTRL_ETHERTYPE_M));
1999 reg_w |= ((uint64_t)tpid << GL_SWT_L2TAGCTRL_ETHERTYPE_S);
2000 if (reg_r == reg_w) {
2001 PMD_DRV_LOG(DEBUG, "No need to write");
2005 ICE_WRITE_REG(hw, GL_SWT_L2TAGCTRL(reg_id), reg_w);
2006 PMD_DRV_LOG(DEBUG, "Debug write 0x%08"PRIx64" to "
2007 "ICE GL_SWT_L2TAGCTRL[%d]", reg_w, reg_id);
2013 ice_vsi_vlan_pvid_set(struct ice_vsi *vsi, struct ice_vsi_vlan_pvid_info *info)
2016 struct ice_vsi_ctx ctxt;
2017 uint8_t vlan_flags = 0;
2020 if (!vsi || !info) {
2021 PMD_DRV_LOG(ERR, "invalid parameters");
2026 vsi->info.pvid = info->config.pvid;
2028 * If insert pvid is enabled, only tagged pkts are
2029 * allowed to be sent out.
2031 vlan_flags = ICE_AQ_VSI_PVLAN_INSERT_PVID |
2032 ICE_AQ_VSI_VLAN_MODE_UNTAGGED;
2035 if (info->config.reject.tagged == 0)
2036 vlan_flags |= ICE_AQ_VSI_VLAN_MODE_TAGGED;
2038 if (info->config.reject.untagged == 0)
2039 vlan_flags |= ICE_AQ_VSI_VLAN_MODE_UNTAGGED;
2041 vsi->info.vlan_flags &= ~(ICE_AQ_VSI_PVLAN_INSERT_PVID |
2042 ICE_AQ_VSI_VLAN_MODE_M);
2043 vsi->info.vlan_flags |= vlan_flags;
2044 memset(&ctxt, 0, sizeof(ctxt));
2045 rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
2046 ctxt.info.valid_sections =
2047 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID);
2048 ctxt.vsi_num = vsi->vsi_id;
2050 hw = ICE_VSI_TO_HW(vsi);
2051 ret = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);
2052 if (ret != ICE_SUCCESS) {
2054 "update VSI for VLAN insert failed, err %d",
2059 vsi->info.valid_sections |=
2060 rte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID);
2066 ice_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t pvid, int on)
2068 struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
2069 struct ice_vsi *vsi = pf->main_vsi;
2070 struct rte_eth_dev_data *data = pf->dev_data;
2071 struct ice_vsi_vlan_pvid_info info;
2074 memset(&info, 0, sizeof(info));
2077 info.config.pvid = pvid;
2079 info.config.reject.tagged =
2080 data->dev_conf.txmode.hw_vlan_reject_tagged;
2081 info.config.reject.untagged =
2082 data->dev_conf.txmode.hw_vlan_reject_untagged;
2085 ret = ice_vsi_vlan_pvid_set(vsi, &info);
2087 PMD_DRV_LOG(ERR, "Failed to set pvid.");
2095 ice_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
2096 struct rte_pci_device *pci_dev)
2098 return rte_eth_dev_pci_generic_probe(pci_dev,
2099 sizeof(struct ice_adapter),
2104 ice_pci_remove(struct rte_pci_device *pci_dev)
2106 return rte_eth_dev_pci_generic_remove(pci_dev, ice_dev_uninit);
2109 static struct rte_pci_driver rte_ice_pmd = {
2110 .id_table = pci_id_ice_map,
2111 .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
2112 RTE_PCI_DRV_IOVA_AS_VA,
2113 .probe = ice_pci_probe,
2114 .remove = ice_pci_remove,
2118 * Driver initialization routine.
2119 * Invoked once at EAL init time.
2120 * Register itself as the [Poll Mode] Driver of PCI devices.
2122 RTE_PMD_REGISTER_PCI(net_ice, rte_ice_pmd);
2123 RTE_PMD_REGISTER_PCI_TABLE(net_ice, pci_id_ice_map);
2124 RTE_PMD_REGISTER_KMOD_DEP(net_ice, "* igb_uio | uio_pci_generic | vfio-pci");
2125 RTE_PMD_REGISTER_PARAM_STRING(net_ice,
2126 ICE_MAX_QP_NUM "=<int>");
2128 RTE_INIT(ice_init_log)
2130 ice_logtype_init = rte_log_register("pmd.net.ice.init");
2131 if (ice_logtype_init >= 0)
2132 rte_log_set_level(ice_logtype_init, RTE_LOG_NOTICE);
2133 ice_logtype_driver = rte_log_register("pmd.net.ice.driver");
2134 if (ice_logtype_driver >= 0)
2135 rte_log_set_level(ice_logtype_driver, RTE_LOG_NOTICE);