net/i40e: fix TM level capability getting
authorWenzhuo Lu <wenzhuo.lu@intel.com>
Tue, 17 Oct 2017 05:50:35 +0000 (13:50 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 26 Oct 2017 00:33:00 +0000 (02:33 +0200)
Only queue nodes should be taken as leaf nodes, all
the other nodes are non-leaf nodes.
Correct it when getting the TM level capability.

Fixes: 0fb1ef1e7930 ("net/i40e: support getting TM level capability")
Cc: stable@dpdk.org
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
drivers/net/i40e/i40e_tm.c

index cfda4ab..bfcf1eb 100644 (file)
@@ -755,15 +755,34 @@ i40e_level_capabilities_get(struct rte_eth_dev *dev,
                cap->n_nodes_max = 1;
                cap->n_nodes_nonleaf_max = 1;
                cap->n_nodes_leaf_max = 0;
-               cap->non_leaf_nodes_identical = true;
-               cap->leaf_nodes_identical = true;
+       } else if (level_id == I40E_TM_NODE_TYPE_TC) {
+               /* TC */
+               cap->n_nodes_max = I40E_MAX_TRAFFIC_CLASS;
+               cap->n_nodes_nonleaf_max = I40E_MAX_TRAFFIC_CLASS;
+               cap->n_nodes_leaf_max = 0;
+       } else {
+               /* queue */
+               cap->n_nodes_max = hw->func_caps.num_tx_qp;
+               cap->n_nodes_nonleaf_max = 0;
+               cap->n_nodes_leaf_max = hw->func_caps.num_tx_qp;
+       }
+
+       cap->non_leaf_nodes_identical = true;
+       cap->leaf_nodes_identical = true;
+
+       if (level_id != I40E_TM_NODE_TYPE_QUEUE) {
                cap->nonleaf.shaper_private_supported = true;
                cap->nonleaf.shaper_private_dual_rate_supported = false;
                cap->nonleaf.shaper_private_rate_min = 0;
                /* 40Gbps -> 5GBps */
                cap->nonleaf.shaper_private_rate_max = 5000000000ull;
                cap->nonleaf.shaper_shared_n_max = 0;
-               cap->nonleaf.sched_n_children_max = I40E_MAX_TRAFFIC_CLASS;
+               if (level_id == I40E_TM_NODE_TYPE_PORT)
+                       cap->nonleaf.sched_n_children_max =
+                               I40E_MAX_TRAFFIC_CLASS;
+               else
+                       cap->nonleaf.sched_n_children_max =
+                               hw->func_caps.num_tx_qp;
                cap->nonleaf.sched_sp_n_priorities_max = 1;
                cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
                cap->nonleaf.sched_wfq_n_groups_max = 0;
@@ -773,21 +792,7 @@ i40e_level_capabilities_get(struct rte_eth_dev *dev,
                return 0;
        }
 
-       /* TC or queue node */
-       if (level_id == I40E_TM_NODE_TYPE_TC) {
-               /* TC */
-               cap->n_nodes_max = I40E_MAX_TRAFFIC_CLASS;
-               cap->n_nodes_nonleaf_max = I40E_MAX_TRAFFIC_CLASS;
-               cap->n_nodes_leaf_max = 0;
-               cap->non_leaf_nodes_identical = true;
-       } else {
-               /* queue */
-               cap->n_nodes_max = hw->func_caps.num_tx_qp;
-               cap->n_nodes_nonleaf_max = 0;
-               cap->n_nodes_leaf_max = hw->func_caps.num_tx_qp;
-               cap->non_leaf_nodes_identical = true;
-       }
-       cap->leaf_nodes_identical = true;
+       /* queue node */
        cap->leaf.shaper_private_supported = true;
        cap->leaf.shaper_private_dual_rate_supported = false;
        cap->leaf.shaper_private_rate_min = 0;