X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fiavf%2Fiavf_tm.c;h=8d92062c7f70372e9f2c73d4417efc182ab96bfe;hb=7483341ae5533c5d5fa080a5d229e6f2daf03ea5;hp=03349619d10580d8f44055605c2afa9e70988e97;hpb=44d0a720a53863a1c9323fcded3223e4ee11ee6a;p=dpdk.git diff --git a/drivers/net/iavf/iavf_tm.c b/drivers/net/iavf/iavf_tm.c index 03349619d1..8d92062c7f 100644 --- a/drivers/net/iavf/iavf_tm.c +++ b/drivers/net/iavf/iavf_tm.c @@ -321,7 +321,7 @@ iavf_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id, } /* check level */ if (level_id != RTE_TM_NODE_LEVEL_ID_ANY && - level_id != parent_node_type + 1) { + level_id != (uint32_t)parent_node_type + 1) { error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS; error->message = "Wrong level"; return -EINVAL; @@ -469,9 +469,9 @@ iavf_tm_capabilities_get(struct rte_eth_dev *dev, cap->shaper_private_n_max = cap->n_nodes_max; cap->shaper_private_dual_rate_n_max = 0; cap->shaper_private_rate_min = 0; - /* GBps */ + /* Bytes per second */ cap->shaper_private_rate_max = - vf->link_speed * 1000 / IAVF_BITS_PER_BYTE; + (uint64_t)vf->link_speed * 1000000 / IAVF_BITS_PER_BYTE; cap->shaper_private_packet_mode_supported = 0; cap->shaper_private_byte_mode_supported = 1; cap->shaper_shared_n_max = 0; @@ -544,9 +544,9 @@ iavf_level_capabilities_get(struct rte_eth_dev *dev, cap->nonleaf.shaper_private_supported = true; cap->nonleaf.shaper_private_dual_rate_supported = false; cap->nonleaf.shaper_private_rate_min = 0; - /* GBps */ + /* Bytes per second */ cap->nonleaf.shaper_private_rate_max = - vf->link_speed * 1000 / IAVF_BITS_PER_BYTE; + (uint64_t)vf->link_speed * 1000000 / IAVF_BITS_PER_BYTE; cap->nonleaf.shaper_private_packet_mode_supported = 0; cap->nonleaf.shaper_private_byte_mode_supported = 1; cap->nonleaf.shaper_shared_n_max = 0; @@ -573,9 +573,9 @@ iavf_level_capabilities_get(struct rte_eth_dev *dev, cap->leaf.shaper_private_supported = false; cap->leaf.shaper_private_dual_rate_supported = false; cap->leaf.shaper_private_rate_min = 0; - /* GBps */ + /* Bytes per second */ cap->leaf.shaper_private_rate_max = - vf->link_speed * 1000 / IAVF_BITS_PER_BYTE; + (uint64_t)vf->link_speed * 1000000 / IAVF_BITS_PER_BYTE; cap->leaf.shaper_private_packet_mode_supported = 0; cap->leaf.shaper_private_byte_mode_supported = 1; cap->leaf.shaper_shared_n_max = 0; @@ -632,8 +632,11 @@ iavf_node_capabilities_get(struct rte_eth_dev *dev, cap->shaper_private_supported = true; cap->shaper_private_dual_rate_supported = false; - cap->shaper_private_rate_min = tc_cap.shaper.committed; - cap->shaper_private_rate_max = tc_cap.shaper.peak; + /* Bytes per second */ + cap->shaper_private_rate_min = + (uint64_t)tc_cap.shaper.committed * 1000 / IAVF_BITS_PER_BYTE; + cap->shaper_private_rate_max = + (uint64_t)tc_cap.shaper.peak * 1000 / IAVF_BITS_PER_BYTE; cap->shaper_shared_n_max = 0; cap->nonleaf.sched_n_children_max = vf->num_queue_pairs; cap->nonleaf.sched_sp_n_priorities_max = 1; @@ -655,6 +658,7 @@ static int iavf_hierarchy_commit(struct rte_eth_dev *dev, struct virtchnl_queue_tc_mapping *q_tc_mapping; struct iavf_tm_node_list *queue_list = &vf->tm_conf.queue_list; struct iavf_tm_node *tm_node; + struct iavf_qtc_map *qtc_map; uint16_t size; int index = 0, node_committed = 0; int i, ret_val = IAVF_SUCCESS; @@ -690,6 +694,7 @@ static int iavf_hierarchy_commit(struct rte_eth_dev *dev, q_tc_mapping->vsi_id = vf->vsi.vsi_id; q_tc_mapping->num_tc = vf->qos_cap->num_elem; q_tc_mapping->num_queue_pairs = vf->num_queue_pairs; + TAILQ_FOREACH(tm_node, queue_list, node) { if (tm_node->tc >= q_tc_mapping->num_tc) { PMD_DRV_LOG(ERR, "TC%d is not enabled", tm_node->tc); @@ -707,15 +712,26 @@ static int iavf_hierarchy_commit(struct rte_eth_dev *dev, goto fail_clear; } + /* store the queue TC mapping info */ + qtc_map = rte_zmalloc("qtc_map", + sizeof(struct iavf_qtc_map) * q_tc_mapping->num_tc, 0); + if (!qtc_map) + return IAVF_ERR_NO_MEMORY; + for (i = 0; i < q_tc_mapping->num_tc; i++) { q_tc_mapping->tc[i].req.start_queue_id = index; index += q_tc_mapping->tc[i].req.queue_count; + qtc_map[i].tc = i; + qtc_map[i].start_queue_id = + q_tc_mapping->tc[i].req.start_queue_id; + qtc_map[i].queue_count = q_tc_mapping->tc[i].req.queue_count; } ret_val = iavf_set_q_tc_map(dev, q_tc_mapping, size); if (ret_val) goto fail_clear; + vf->qtc_map = qtc_map; vf->tm_conf.committed = true; return ret_val;