net/ice: add DDP runtime configuration dump
[dpdk.git] / drivers / net / ice / ice_tm.c
index d70d077..34a0bfc 100644 (file)
@@ -147,15 +147,15 @@ ice_node_param_check(struct ice_pf *pf, uint32_t node_id,
                return -EINVAL;
        }
 
-       if (priority) {
+       if (priority >= 8) {
                error->type = RTE_TM_ERROR_TYPE_NODE_PRIORITY;
-               error->message = "priority should be 0";
+               error->message = "priority should be less than 8";
                return -EINVAL;
        }
 
-       if (weight != 1) {
+       if (weight > 200 || weight < 1) {
                error->type = RTE_TM_ERROR_TYPE_NODE_WEIGHT;
-               error->message = "weight must be 1";
+               error->message = "weight must be between 1 and 200";
                return -EINVAL;
        }
 
@@ -531,6 +531,15 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
                        rte_calloc(NULL, 256, (sizeof(struct ice_tm_node *)), 0);
        tm_node->parent->children[tm_node->parent->reference_count] = tm_node;
 
+       if (tm_node->priority != 0 && level_id != ICE_TM_NODE_TYPE_QUEUE &&
+           level_id != ICE_TM_NODE_TYPE_QGROUP)
+               PMD_DRV_LOG(WARNING, "priority != 0 not supported in level %d",
+                           level_id);
+
+       if (tm_node->weight != 1 && level_id != ICE_TM_NODE_TYPE_QUEUE)
+               PMD_DRV_LOG(WARNING, "weight != 1 not supported in level %d",
+                           level_id);
+
        rte_memcpy(&tm_node->params, params,
                         sizeof(struct rte_tm_node_params));
        if (parent_node_type == ICE_TM_NODE_TYPE_PORT) {
@@ -684,6 +693,7 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
        struct ice_vsi *vsi;
        int ret_val = ICE_SUCCESS;
        uint64_t peak = 0;
+       uint8_t priority;
        uint32_t i;
        uint32_t idx_vsi_child;
        uint32_t idx_qg;
@@ -763,6 +773,15 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
                                goto fail_clear;
                        }
                }
+               priority = 7 - tm_node->priority;
+               ret_val = ice_sched_cfg_sibl_node_prio_lock(hw->port_info, qgroup_sched_node,
+                                                           priority);
+               if (ret_val) {
+                       error->type = RTE_TM_ERROR_TYPE_NODE_PRIORITY;
+                       PMD_DRV_LOG(ERR, "configure queue group %u priority failed",
+                                   tm_node->priority);
+                       goto fail_clear;
+               }
                idx_qg++;
                if (idx_qg >= nb_qg) {
                        idx_qg = 0;
@@ -779,6 +798,7 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
                qid = tm_node->id;
                txq = dev->data->tx_queues[qid];
                vsi = txq->vsi;
+               q_teid = txq->q_teid;
                if (tm_node->shaper_profile) {
                        /* Transfer from Byte per seconds to Kbps */
                        peak = tm_node->shaper_profile->profile.peak.rate;
@@ -794,6 +814,23 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
                                goto fail_clear;
                        }
                }
+               priority = 7 - tm_node->priority;
+               ret_val = ice_cfg_vsi_q_priority(hw->port_info, 1,
+                                                &q_teid, &priority);
+               if (ret_val) {
+                       error->type = RTE_TM_ERROR_TYPE_NODE_PRIORITY;
+                       PMD_DRV_LOG(ERR, "configure queue %u priority failed", tm_node->priority);
+                       goto fail_clear;
+               }
+
+               ret_val = ice_cfg_q_bw_alloc(hw->port_info, vsi->idx,
+                                            tm_node->tc, tm_node->id,
+                                            ICE_MAX_BW, (u32)tm_node->weight);
+               if (ret_val) {
+                       error->type = RTE_TM_ERROR_TYPE_NODE_WEIGHT;
+                       PMD_DRV_LOG(ERR, "configure queue %u weight failed", tm_node->weight);
+                       goto fail_clear;
+               }
        }
 
        return ret_val;