net/bnxt: add dpool allocator for EM allocation
[dpdk.git] / drivers / net / ice / ice_dcf.c
index 712f438..349d23e 100644 (file)
@@ -17,8 +17,8 @@
 #include <rte_atomic.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
-#include <rte_ethdev_driver.h>
-#include <rte_ethdev_pci.h>
+#include <ethdev_driver.h>
+#include <ethdev_pci.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_dev.h>
@@ -234,7 +234,9 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)
 
        caps = VIRTCHNL_VF_OFFLOAD_WB_ON_ITR | VIRTCHNL_VF_OFFLOAD_RX_POLLING |
               VIRTCHNL_VF_CAP_ADV_LINK_SPEED | VIRTCHNL_VF_CAP_DCF |
-              VF_BASE_MODE_OFFLOADS | VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC;
+              VIRTCHNL_VF_OFFLOAD_VLAN_V2 |
+              VF_BASE_MODE_OFFLOADS | VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC |
+              VIRTCHNL_VF_OFFLOAD_QOS;
 
        err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_GET_VF_RESOURCES,
                                          (uint8_t *)&caps, sizeof(caps));
@@ -318,6 +320,7 @@ ice_dcf_get_vf_vsi_map(struct ice_dcf_hw *hw)
                }
 
                hw->num_vfs = vsi_map->num_vfs;
+               hw->pf_vsi_id = vsi_map->pf_vsi;
        }
 
        if (!memcmp(hw->vf_vsi_map, vsi_map->vf_vsi, len)) {
@@ -503,9 +506,7 @@ ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,
        }
 
        do {
-               if ((!desc_cmd.pending && !buff_cmd.pending) ||
-                   (!desc_cmd.pending && desc_cmd.v_ret != IAVF_SUCCESS) ||
-                   (!buff_cmd.pending && buff_cmd.v_ret != IAVF_SUCCESS))
+               if (!desc_cmd.pending && !buff_cmd.pending)
                        break;
 
                rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME);
@@ -668,6 +669,9 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
                }
        }
 
+       if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS)
+               ice_dcf_tm_conf_init(eth_dev);
+
        hw->eth_dev = eth_dev;
        rte_intr_callback_register(&pci_dev->intr_handle,
                                   ice_dcf_dev_interrupt_handler, hw);
@@ -703,6 +707,9 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
        ice_dcf_mode_disable(hw);
        iavf_shutdown_adminq(&hw->avf);
 
+       if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS)
+               ice_dcf_tm_conf_uninit(eth_dev);
+
        rte_free(hw->arq_buf);
        rte_free(hw->vf_vsi_map);
        rte_free(hw->vf_res);
@@ -827,6 +834,7 @@ ice_dcf_init_rss(struct ice_dcf_hw *hw)
        return 0;
 }
 
+#define IAVF_RXDID_LEGACY_0 0
 #define IAVF_RXDID_LEGACY_1 1
 #define IAVF_RXDID_COMMS_GENERIC 16
 
@@ -872,6 +880,7 @@ ice_dcf_configure_queues(struct ice_dcf_hw *hw)
                vc_qp->rxq.dma_ring_addr = rxq[i]->rx_ring_dma;
                vc_qp->rxq.databuffer_size = rxq[i]->rx_buf_len;
 
+#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC
                if (hw->vf_res->vf_cap_flags &
                    VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC &&
                    hw->supported_rxdid &
@@ -883,6 +892,20 @@ ice_dcf_configure_queues(struct ice_dcf_hw *hw)
                        PMD_DRV_LOG(ERR, "RXDID 16 is not supported");
                        return -EINVAL;
                }
+#else
+               if (hw->vf_res->vf_cap_flags &
+                       VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC &&
+                       hw->supported_rxdid &
+                       BIT(IAVF_RXDID_LEGACY_0)) {
+                       vc_qp->rxq.rxdid = IAVF_RXDID_LEGACY_0;
+                       PMD_DRV_LOG(NOTICE, "request RXDID == %d in "
+                                       "Queue[%d]", vc_qp->rxq.rxdid, i);
+               } else {
+                       PMD_DRV_LOG(ERR, "RXDID == 0 is not supported");
+                       return -EINVAL;
+               }
+#endif
+               ice_select_rxd_to_pkt_fields_handler(rxq[i], vc_qp->rxq.rxdid);
        }
 
        memset(&args, 0, sizeof(args));