* [dpdk-dev] [PATCH 0/6] fix TM (Traffic Management) issues on i40e and ixgbe @ 2017-10-13 2:58 Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 1/6] net/i40e: fix TM node parameter checking Wenzhuo Lu ` (7 more replies) 0 siblings, 8 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-13 2:58 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu By design, all the queues are leaf nodes and others are non-leaf nodes, and the shaper profile can be null. Currently the i40e and ixgbe implementation doesn't follow this design. This patch set fixes this issue. Wenzhuo Lu (6): net/i40e: fix TM node parameter checking net/i40e: fix TM level capability getting net/ixgbe: fix TM node parameter checking net/ixgbe: fix TM level capability getting net/i40e: fix not supporting NULL TM profile net/ixgbe: fix not supporting NULL TM profile drivers/net/i40e/i40e_tm.c | 100 +++++++++++++++++++++++++++---------------- drivers/net/ixgbe/ixgbe_tm.c | 91 +++++++++++++++++++++++---------------- 2 files changed, 116 insertions(+), 75 deletions(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH 1/6] net/i40e: fix TM node parameter checking 2017-10-13 2:58 [dpdk-dev] [PATCH 0/6] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu @ 2017-10-13 2:58 ` Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 2/6] net/i40e: fix TM level capability getting Wenzhuo Lu ` (6 subsequent siblings) 7 siblings, 0 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-13 2:58 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu Only queue nodes should be taken as leaf nodes, all the other nodes are non-leaf nodes. Correct it when checking the parameters of the TM nodes. Fixes: 03a249b62bbd ("net/i40e: support adding TM node") Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/i40e/i40e_tm.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c index d90313a..fe99215 100644 --- a/drivers/net/i40e/i40e_tm.c +++ b/drivers/net/i40e/i40e_tm.c @@ -374,11 +374,13 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, } static int -i40e_node_param_check(uint32_t node_id, uint32_t parent_node_id, +i40e_node_param_check(struct rte_eth_dev *dev, uint32_t node_id, uint32_t priority, uint32_t weight, struct rte_tm_node_params *params, struct rte_tm_error *error) { + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); + if (node_id == RTE_TM_NODE_ID_NULL) { error->type = RTE_TM_ERROR_TYPE_NODE_ID; error->message = "invalid node id"; @@ -409,8 +411,8 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, return -EINVAL; } - /* for root node */ - if (parent_node_id == RTE_TM_NODE_ID_NULL) { + /* for non-leaf node */ + if (node_id >= hw->func_caps.num_tx_qp) { if (params->nonleaf.wfq_weight_mode) { error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE; @@ -433,7 +435,7 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, return 0; } - /* for TC or queue node */ + /* for leaf node */ if (params->leaf.cman) { error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN; error->message = "Congestion management not supported"; @@ -494,7 +496,7 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, return -EINVAL; } - ret = i40e_node_param_check(node_id, parent_node_id, priority, weight, + ret = i40e_node_param_check(dev, node_id, priority, weight, params, error); if (ret) return ret; -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH 2/6] net/i40e: fix TM level capability getting 2017-10-13 2:58 [dpdk-dev] [PATCH 0/6] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 1/6] net/i40e: fix TM node parameter checking Wenzhuo Lu @ 2017-10-13 2:58 ` Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 3/6] net/ixgbe: fix TM node parameter checking Wenzhuo Lu ` (5 subsequent siblings) 7 siblings, 0 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-13 2:58 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu 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") Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/i40e/i40e_tm.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c index fe99215..d46a972 100644 --- a/drivers/net/i40e/i40e_tm.c +++ b/drivers/net/i40e/i40e_tm.c @@ -755,15 +755,34 @@ static int i40e_hierarchy_commit(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 @@ static int i40e_hierarchy_commit(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; -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH 3/6] net/ixgbe: fix TM node parameter checking 2017-10-13 2:58 [dpdk-dev] [PATCH 0/6] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 1/6] net/i40e: fix TM node parameter checking Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 2/6] net/i40e: fix TM level capability getting Wenzhuo Lu @ 2017-10-13 2:58 ` Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 4/6] net/ixgbe: fix TM level capability getting Wenzhuo Lu ` (4 subsequent siblings) 7 siblings, 0 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-13 2:58 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu Only queue nodes should be taken as leaf nodes, all the other nodes are non-leaf nodes. Correct it when checking the parameters of the TM nodes. Fixes: e0ff4d304ccf ("net/ixgbe: support adding TM node") Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_tm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c index cdcf45c..e7d8d39 100644 --- a/drivers/net/ixgbe/ixgbe_tm.c +++ b/drivers/net/ixgbe/ixgbe_tm.c @@ -482,7 +482,7 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, } static int -ixgbe_node_param_check(uint32_t node_id, uint32_t parent_node_id, +ixgbe_node_param_check(struct rte_eth_dev *dev, uint32_t node_id, uint32_t priority, uint32_t weight, struct rte_tm_node_params *params, struct rte_tm_error *error) @@ -517,8 +517,8 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, return -EINVAL; } - /* for root node */ - if (parent_node_id == RTE_TM_NODE_ID_NULL) { + /* for non-leaf node */ + if (node_id >= dev->data->nb_tx_queues) { /* check the unsupported parameters */ if (params->nonleaf.wfq_weight_mode) { error->type = @@ -542,7 +542,7 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, return 0; } - /* for TC or queue node */ + /* for leaf node */ /* check the unsupported parameters */ if (params->leaf.cman) { error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN; @@ -606,7 +606,7 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, return -EINVAL; } - ret = ixgbe_node_param_check(node_id, parent_node_id, priority, weight, + ret = ixgbe_node_param_check(dev, node_id, priority, weight, params, error); if (ret) return ret; -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH 4/6] net/ixgbe: fix TM level capability getting 2017-10-13 2:58 [dpdk-dev] [PATCH 0/6] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu ` (2 preceding siblings ...) 2017-10-13 2:58 ` [dpdk-dev] [PATCH 3/6] net/ixgbe: fix TM node parameter checking Wenzhuo Lu @ 2017-10-13 2:58 ` Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 5/6] net/i40e: fix not supporting NULL TM profile Wenzhuo Lu ` (3 subsequent siblings) 7 siblings, 0 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-13 2:58 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu 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: 596988e193f7 ("net/ixgbe: support getting TM level capability") Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_tm.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c index e7d8d39..5c9b24c 100644 --- a/drivers/net/ixgbe/ixgbe_tm.c +++ b/drivers/net/ixgbe/ixgbe_tm.c @@ -876,15 +876,34 @@ static int ixgbe_hierarchy_commit(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 == IXGBE_TM_NODE_TYPE_TC) { + /* TC */ + cap->n_nodes_max = IXGBE_DCB_MAX_TRAFFIC_CLASS; + cap->n_nodes_nonleaf_max = IXGBE_DCB_MAX_TRAFFIC_CLASS; + cap->n_nodes_leaf_max = 0; + } else { + /* queue */ + cap->n_nodes_max = hw->mac.max_tx_queues; + cap->n_nodes_nonleaf_max = 0; + cap->n_nodes_leaf_max = hw->mac.max_tx_queues; + } + + cap->non_leaf_nodes_identical = true; + cap->leaf_nodes_identical = true; + + if (level_id != IXGBE_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; /* 10Gbps -> 1.25GBps */ cap->nonleaf.shaper_private_rate_max = 1250000000ull; cap->nonleaf.shaper_shared_n_max = 0; - cap->nonleaf.sched_n_children_max = IXGBE_DCB_MAX_TRAFFIC_CLASS; + if (level_id == IXGBE_TM_NODE_TYPE_PORT) + cap->nonleaf.sched_n_children_max = + IXGBE_DCB_MAX_TRAFFIC_CLASS; + else + cap->nonleaf.sched_n_children_max = + hw->mac.max_tx_queues; 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; @@ -894,21 +913,7 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, return 0; } - /* TC or queue node */ - if (level_id == IXGBE_TM_NODE_TYPE_TC) { - /* TC */ - cap->n_nodes_max = IXGBE_DCB_MAX_TRAFFIC_CLASS; - cap->n_nodes_nonleaf_max = IXGBE_DCB_MAX_TRAFFIC_CLASS; - cap->n_nodes_leaf_max = 0; - cap->non_leaf_nodes_identical = true; - } else { - /* queue */ - cap->n_nodes_max = hw->mac.max_tx_queues; - cap->n_nodes_nonleaf_max = 0; - cap->n_nodes_leaf_max = hw->mac.max_tx_queues; - 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; -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH 5/6] net/i40e: fix not supporting NULL TM profile 2017-10-13 2:58 [dpdk-dev] [PATCH 0/6] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu ` (3 preceding siblings ...) 2017-10-13 2:58 ` [dpdk-dev] [PATCH 4/6] net/ixgbe: fix TM level capability getting Wenzhuo Lu @ 2017-10-13 2:58 ` Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 6/6] net/ixgbe: " Wenzhuo Lu ` (2 subsequent siblings) 7 siblings, 0 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-13 2:58 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu It's by design that APP can add a TM node without shaper profile. But i40e doesn't support it currently. Fixes: 03a249b62bbd ("net/i40e: support adding TM node") Fixes: cac29c3c00a4 ("net/i40e: support committing TM hierarchy") Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/i40e/i40e_tm.c | 47 +++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c index d46a972..f4d1cb8 100644 --- a/drivers/net/i40e/i40e_tm.c +++ b/drivers/net/i40e/i40e_tm.c @@ -480,7 +480,7 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); enum i40e_tm_node_type node_type = I40E_TM_NODE_TYPE_MAX; enum i40e_tm_node_type parent_node_type = I40E_TM_NODE_TYPE_MAX; - struct i40e_tm_shaper_profile *shaper_profile; + struct i40e_tm_shaper_profile *shaper_profile = NULL; struct i40e_tm_node *tm_node; struct i40e_tm_node *parent_node; uint16_t tc_nb = 0; @@ -509,12 +509,15 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, } /* check the shaper profile id */ - shaper_profile = i40e_shaper_profile_search(dev, - params->shaper_profile_id); - if (!shaper_profile) { - error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID; - error->message = "shaper profile not exist"; - return -EINVAL; + if (params->shaper_profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE) { + shaper_profile = i40e_shaper_profile_search( + dev, params->shaper_profile_id); + if (!shaper_profile) { + error->type = + RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID; + error->message = "shaper profile not exist"; + return -EINVAL; + } } /* root node if not have a parent */ @@ -551,7 +554,8 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, pf->tm_conf.root = tm_node; /* increase the reference counter of the shaper profile */ - shaper_profile->reference_count++; + if (shaper_profile) + shaper_profile->reference_count++; return 0; } @@ -633,7 +637,8 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, tm_node->parent->reference_count++; /* increase the reference counter of the shaper profile */ - shaper_profile->reference_count++; + if (shaper_profile) + shaper_profile->reference_count++; return 0; } @@ -680,14 +685,16 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, /* root node */ if (node_type == I40E_TM_NODE_TYPE_PORT) { - tm_node->shaper_profile->reference_count--; + if (tm_node->shaper_profile) + tm_node->shaper_profile->reference_count--; rte_free(tm_node); pf->tm_conf.root = NULL; return 0; } /* TC or queue node */ - tm_node->shaper_profile->reference_count--; + if (tm_node->shaper_profile) + tm_node->shaper_profile->reference_count--; tm_node->parent->reference_count--; if (node_type == I40E_TM_NODE_TYPE_TC) { TAILQ_REMOVE(&pf->tm_conf.tc_list, tm_node, node); @@ -895,11 +902,15 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, * If the port has a max bandwidth, the TCs should have none. */ /* port */ - bw = pf->tm_conf.root->shaper_profile->profile.peak.rate; + if (pf->tm_conf.root->shaper_profile) + bw = pf->tm_conf.root->shaper_profile->profile.peak.rate; + else + bw = 0; if (bw) { /* check if any TC has a max bandwidth */ TAILQ_FOREACH(tm_node, tc_list, node) { - if (tm_node->shaper_profile->profile.peak.rate) { + if (tm_node->shaper_profile && + tm_node->shaper_profile->profile.peak.rate) { error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE; error->message = "no port and TC max bandwidth" " in parallel"; @@ -943,7 +954,10 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, } tc_map &= ~BIT_ULL(i); - bw = tm_node->shaper_profile->profile.peak.rate; + if (tm_node->shaper_profile) + bw = tm_node->shaper_profile->profile.peak.rate; + else + bw = 0; if (!bw) continue; @@ -954,7 +968,10 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, } TAILQ_FOREACH(tm_node, queue_list, node) { - bw = tm_node->shaper_profile->profile.peak.rate; + if (tm_node->shaper_profile) + bw = tm_node->shaper_profile->profile.peak.rate; + else + bw = 0; if (bw) { error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS; error->message = "not support queue QoS"; -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH 6/6] net/ixgbe: fix not supporting NULL TM profile 2017-10-13 2:58 [dpdk-dev] [PATCH 0/6] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu ` (4 preceding siblings ...) 2017-10-13 2:58 ` [dpdk-dev] [PATCH 5/6] net/i40e: fix not supporting NULL TM profile Wenzhuo Lu @ 2017-10-13 2:58 ` Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu 2017-10-20 14:17 ` [dpdk-dev] [PATCH 0/6] " Dumitrescu, Cristian 7 siblings, 0 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-13 2:58 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu It's by design that APP can add a TM node without shaper profile. But ixgbe doesn't support it currently. Fixes: e0ff4d304ccf ("net/ixgbe: support adding TM node") Fixes: 5713ade69776 ("net/ixgbe: support committing TM hierarchy") Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_tm.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c index 5c9b24c..2b27ac1 100644 --- a/drivers/net/ixgbe/ixgbe_tm.c +++ b/drivers/net/ixgbe/ixgbe_tm.c @@ -588,7 +588,7 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private); enum ixgbe_tm_node_type node_type = IXGBE_TM_NODE_TYPE_MAX; enum ixgbe_tm_node_type parent_node_type = IXGBE_TM_NODE_TYPE_MAX; - struct ixgbe_tm_shaper_profile *shaper_profile; + struct ixgbe_tm_shaper_profile *shaper_profile = NULL; struct ixgbe_tm_node *tm_node; struct ixgbe_tm_node *parent_node; uint8_t nb_tcs; @@ -619,12 +619,15 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, } /* check the shaper profile id */ - shaper_profile = ixgbe_shaper_profile_search(dev, - params->shaper_profile_id); - if (!shaper_profile) { - error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID; - error->message = "shaper profile not exist"; - return -EINVAL; + if (params->shaper_profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE) { + shaper_profile = ixgbe_shaper_profile_search( + dev, params->shaper_profile_id); + if (!shaper_profile) { + error->type = + RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID; + error->message = "shaper profile not exist"; + return -EINVAL; + } } /* root node if not have a parent */ @@ -662,7 +665,8 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, tm_conf->root = tm_node; /* increase the reference counter of the shaper profile */ - shaper_profile->reference_count++; + if (shaper_profile) + shaper_profile->reference_count++; return 0; } @@ -753,7 +757,8 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, tm_node->parent->reference_count++; /* increase the reference counter of the shaper profile */ - shaper_profile->reference_count++; + if (shaper_profile) + shaper_profile->reference_count++; return 0; } @@ -801,14 +806,16 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, /* root node */ if (node_type == IXGBE_TM_NODE_TYPE_PORT) { - tm_node->shaper_profile->reference_count--; + if (tm_node->shaper_profile) + tm_node->shaper_profile->reference_count--; rte_free(tm_node); tm_conf->root = NULL; return 0; } /* TC or queue node */ - tm_node->shaper_profile->reference_count--; + if (tm_node->shaper_profile) + tm_node->shaper_profile->reference_count--; tm_node->parent->reference_count--; if (node_type == IXGBE_TM_NODE_TYPE_TC) { TAILQ_REMOVE(&tm_conf->tc_list, tm_node, node); @@ -1003,7 +1010,8 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, goto done; /* not support port max bandwidth yet */ - if (tm_conf->root->shaper_profile->profile.peak.rate) { + if (tm_conf->root->shaper_profile && + tm_conf->root->shaper_profile->profile.peak.rate) { error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE; error->message = "no port max bandwidth"; goto fail_clear; @@ -1011,7 +1019,8 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, /* HW not support TC max bandwidth */ TAILQ_FOREACH(tm_node, &tm_conf->tc_list, node) { - if (tm_node->shaper_profile->profile.peak.rate) { + if (tm_node->shaper_profile && + tm_node->shaper_profile->profile.peak.rate) { error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE; error->message = "no TC max bandwidth"; goto fail_clear; @@ -1020,7 +1029,10 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, /* queue max bandwidth */ TAILQ_FOREACH(tm_node, &tm_conf->queue_list, node) { - bw = tm_node->shaper_profile->profile.peak.rate; + if (tm_node->shaper_profile) + bw = tm_node->shaper_profile->profile.peak.rate; + else + bw = 0; if (bw) { /* interpret Bps to Mbps */ bw = bw * 8 / 1000 / 1000; -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe 2017-10-13 2:58 [dpdk-dev] [PATCH 0/6] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu ` (5 preceding siblings ...) 2017-10-13 2:58 ` [dpdk-dev] [PATCH 6/6] net/ixgbe: " Wenzhuo Lu @ 2017-10-17 5:50 ` Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 1/7] net/i40e: fix TM node parameter checking Wenzhuo Lu ` (7 more replies) 2017-10-20 14:17 ` [dpdk-dev] [PATCH 0/6] " Dumitrescu, Cristian 7 siblings, 8 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-17 5:50 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu By design, all the queues are leaf nodes and others are non-leaf nodes, and the shaper profile can be null. Currently the i40e and ixgbe implementation doesn't follow this design. This patch set fixes this issue. v2: - fixed the wrong parent node on i40e. Wenzhuo Lu (7): net/i40e: fix TM node parameter checking net/i40e: fix TM level capability getting net/ixgbe: fix TM node parameter checking net/ixgbe: fix TM level capability getting net/i40e: fix not supporting NULL TM profile net/ixgbe: fix not supporting NULL TM profile net/i40e: fix wrong parent when adding TM node drivers/net/i40e/i40e_tm.c | 102 ++++++++++++++++++++++++++----------------- drivers/net/ixgbe/ixgbe_tm.c | 91 ++++++++++++++++++++++---------------- 2 files changed, 117 insertions(+), 76 deletions(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH v2 1/7] net/i40e: fix TM node parameter checking 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu @ 2017-10-17 5:50 ` Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 2/7] net/i40e: fix TM level capability getting Wenzhuo Lu ` (6 subsequent siblings) 7 siblings, 0 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-17 5:50 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu Only queue nodes should be taken as leaf nodes, all the other nodes are non-leaf nodes. Correct it when checking the parameters of the TM nodes. Fixes: 03a249b62bbd ("net/i40e: support adding TM node") Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/i40e/i40e_tm.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c index d90313a..fe99215 100644 --- a/drivers/net/i40e/i40e_tm.c +++ b/drivers/net/i40e/i40e_tm.c @@ -374,11 +374,13 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, } static int -i40e_node_param_check(uint32_t node_id, uint32_t parent_node_id, +i40e_node_param_check(struct rte_eth_dev *dev, uint32_t node_id, uint32_t priority, uint32_t weight, struct rte_tm_node_params *params, struct rte_tm_error *error) { + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); + if (node_id == RTE_TM_NODE_ID_NULL) { error->type = RTE_TM_ERROR_TYPE_NODE_ID; error->message = "invalid node id"; @@ -409,8 +411,8 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, return -EINVAL; } - /* for root node */ - if (parent_node_id == RTE_TM_NODE_ID_NULL) { + /* for non-leaf node */ + if (node_id >= hw->func_caps.num_tx_qp) { if (params->nonleaf.wfq_weight_mode) { error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE; @@ -433,7 +435,7 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, return 0; } - /* for TC or queue node */ + /* for leaf node */ if (params->leaf.cman) { error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN; error->message = "Congestion management not supported"; @@ -494,7 +496,7 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, return -EINVAL; } - ret = i40e_node_param_check(node_id, parent_node_id, priority, weight, + ret = i40e_node_param_check(dev, node_id, priority, weight, params, error); if (ret) return ret; -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH v2 2/7] net/i40e: fix TM level capability getting 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 1/7] net/i40e: fix TM node parameter checking Wenzhuo Lu @ 2017-10-17 5:50 ` Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 3/7] net/ixgbe: fix TM node parameter checking Wenzhuo Lu ` (5 subsequent siblings) 7 siblings, 0 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-17 5:50 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu 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") Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/i40e/i40e_tm.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c index fe99215..d46a972 100644 --- a/drivers/net/i40e/i40e_tm.c +++ b/drivers/net/i40e/i40e_tm.c @@ -755,15 +755,34 @@ static int i40e_hierarchy_commit(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 @@ static int i40e_hierarchy_commit(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; -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH v2 3/7] net/ixgbe: fix TM node parameter checking 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 1/7] net/i40e: fix TM node parameter checking Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 2/7] net/i40e: fix TM level capability getting Wenzhuo Lu @ 2017-10-17 5:50 ` Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 4/7] net/ixgbe: fix TM level capability getting Wenzhuo Lu ` (4 subsequent siblings) 7 siblings, 0 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-17 5:50 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu Only queue nodes should be taken as leaf nodes, all the other nodes are non-leaf nodes. Correct it when checking the parameters of the TM nodes. Fixes: e0ff4d304ccf ("net/ixgbe: support adding TM node") Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_tm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c index cdcf45c..e7d8d39 100644 --- a/drivers/net/ixgbe/ixgbe_tm.c +++ b/drivers/net/ixgbe/ixgbe_tm.c @@ -482,7 +482,7 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, } static int -ixgbe_node_param_check(uint32_t node_id, uint32_t parent_node_id, +ixgbe_node_param_check(struct rte_eth_dev *dev, uint32_t node_id, uint32_t priority, uint32_t weight, struct rte_tm_node_params *params, struct rte_tm_error *error) @@ -517,8 +517,8 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, return -EINVAL; } - /* for root node */ - if (parent_node_id == RTE_TM_NODE_ID_NULL) { + /* for non-leaf node */ + if (node_id >= dev->data->nb_tx_queues) { /* check the unsupported parameters */ if (params->nonleaf.wfq_weight_mode) { error->type = @@ -542,7 +542,7 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, return 0; } - /* for TC or queue node */ + /* for leaf node */ /* check the unsupported parameters */ if (params->leaf.cman) { error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN; @@ -606,7 +606,7 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, return -EINVAL; } - ret = ixgbe_node_param_check(node_id, parent_node_id, priority, weight, + ret = ixgbe_node_param_check(dev, node_id, priority, weight, params, error); if (ret) return ret; -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH v2 4/7] net/ixgbe: fix TM level capability getting 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu ` (2 preceding siblings ...) 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 3/7] net/ixgbe: fix TM node parameter checking Wenzhuo Lu @ 2017-10-17 5:50 ` Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 5/7] net/i40e: fix not supporting NULL TM profile Wenzhuo Lu ` (3 subsequent siblings) 7 siblings, 0 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-17 5:50 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu 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: 596988e193f7 ("net/ixgbe: support getting TM level capability") Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_tm.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c index e7d8d39..5c9b24c 100644 --- a/drivers/net/ixgbe/ixgbe_tm.c +++ b/drivers/net/ixgbe/ixgbe_tm.c @@ -876,15 +876,34 @@ static int ixgbe_hierarchy_commit(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 == IXGBE_TM_NODE_TYPE_TC) { + /* TC */ + cap->n_nodes_max = IXGBE_DCB_MAX_TRAFFIC_CLASS; + cap->n_nodes_nonleaf_max = IXGBE_DCB_MAX_TRAFFIC_CLASS; + cap->n_nodes_leaf_max = 0; + } else { + /* queue */ + cap->n_nodes_max = hw->mac.max_tx_queues; + cap->n_nodes_nonleaf_max = 0; + cap->n_nodes_leaf_max = hw->mac.max_tx_queues; + } + + cap->non_leaf_nodes_identical = true; + cap->leaf_nodes_identical = true; + + if (level_id != IXGBE_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; /* 10Gbps -> 1.25GBps */ cap->nonleaf.shaper_private_rate_max = 1250000000ull; cap->nonleaf.shaper_shared_n_max = 0; - cap->nonleaf.sched_n_children_max = IXGBE_DCB_MAX_TRAFFIC_CLASS; + if (level_id == IXGBE_TM_NODE_TYPE_PORT) + cap->nonleaf.sched_n_children_max = + IXGBE_DCB_MAX_TRAFFIC_CLASS; + else + cap->nonleaf.sched_n_children_max = + hw->mac.max_tx_queues; 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; @@ -894,21 +913,7 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, return 0; } - /* TC or queue node */ - if (level_id == IXGBE_TM_NODE_TYPE_TC) { - /* TC */ - cap->n_nodes_max = IXGBE_DCB_MAX_TRAFFIC_CLASS; - cap->n_nodes_nonleaf_max = IXGBE_DCB_MAX_TRAFFIC_CLASS; - cap->n_nodes_leaf_max = 0; - cap->non_leaf_nodes_identical = true; - } else { - /* queue */ - cap->n_nodes_max = hw->mac.max_tx_queues; - cap->n_nodes_nonleaf_max = 0; - cap->n_nodes_leaf_max = hw->mac.max_tx_queues; - 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; -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH v2 5/7] net/i40e: fix not supporting NULL TM profile 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu ` (3 preceding siblings ...) 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 4/7] net/ixgbe: fix TM level capability getting Wenzhuo Lu @ 2017-10-17 5:50 ` Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 6/7] net/ixgbe: " Wenzhuo Lu ` (2 subsequent siblings) 7 siblings, 0 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-17 5:50 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu It's by design that APP can add a TM node without shaper profile. But i40e doesn't support it currently. Fixes: 03a249b62bbd ("net/i40e: support adding TM node") Fixes: cac29c3c00a4 ("net/i40e: support committing TM hierarchy") Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/i40e/i40e_tm.c | 47 +++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c index d46a972..f4d1cb8 100644 --- a/drivers/net/i40e/i40e_tm.c +++ b/drivers/net/i40e/i40e_tm.c @@ -480,7 +480,7 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); enum i40e_tm_node_type node_type = I40E_TM_NODE_TYPE_MAX; enum i40e_tm_node_type parent_node_type = I40E_TM_NODE_TYPE_MAX; - struct i40e_tm_shaper_profile *shaper_profile; + struct i40e_tm_shaper_profile *shaper_profile = NULL; struct i40e_tm_node *tm_node; struct i40e_tm_node *parent_node; uint16_t tc_nb = 0; @@ -509,12 +509,15 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, } /* check the shaper profile id */ - shaper_profile = i40e_shaper_profile_search(dev, - params->shaper_profile_id); - if (!shaper_profile) { - error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID; - error->message = "shaper profile not exist"; - return -EINVAL; + if (params->shaper_profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE) { + shaper_profile = i40e_shaper_profile_search( + dev, params->shaper_profile_id); + if (!shaper_profile) { + error->type = + RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID; + error->message = "shaper profile not exist"; + return -EINVAL; + } } /* root node if not have a parent */ @@ -551,7 +554,8 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, pf->tm_conf.root = tm_node; /* increase the reference counter of the shaper profile */ - shaper_profile->reference_count++; + if (shaper_profile) + shaper_profile->reference_count++; return 0; } @@ -633,7 +637,8 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, tm_node->parent->reference_count++; /* increase the reference counter of the shaper profile */ - shaper_profile->reference_count++; + if (shaper_profile) + shaper_profile->reference_count++; return 0; } @@ -680,14 +685,16 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, /* root node */ if (node_type == I40E_TM_NODE_TYPE_PORT) { - tm_node->shaper_profile->reference_count--; + if (tm_node->shaper_profile) + tm_node->shaper_profile->reference_count--; rte_free(tm_node); pf->tm_conf.root = NULL; return 0; } /* TC or queue node */ - tm_node->shaper_profile->reference_count--; + if (tm_node->shaper_profile) + tm_node->shaper_profile->reference_count--; tm_node->parent->reference_count--; if (node_type == I40E_TM_NODE_TYPE_TC) { TAILQ_REMOVE(&pf->tm_conf.tc_list, tm_node, node); @@ -895,11 +902,15 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, * If the port has a max bandwidth, the TCs should have none. */ /* port */ - bw = pf->tm_conf.root->shaper_profile->profile.peak.rate; + if (pf->tm_conf.root->shaper_profile) + bw = pf->tm_conf.root->shaper_profile->profile.peak.rate; + else + bw = 0; if (bw) { /* check if any TC has a max bandwidth */ TAILQ_FOREACH(tm_node, tc_list, node) { - if (tm_node->shaper_profile->profile.peak.rate) { + if (tm_node->shaper_profile && + tm_node->shaper_profile->profile.peak.rate) { error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE; error->message = "no port and TC max bandwidth" " in parallel"; @@ -943,7 +954,10 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, } tc_map &= ~BIT_ULL(i); - bw = tm_node->shaper_profile->profile.peak.rate; + if (tm_node->shaper_profile) + bw = tm_node->shaper_profile->profile.peak.rate; + else + bw = 0; if (!bw) continue; @@ -954,7 +968,10 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, } TAILQ_FOREACH(tm_node, queue_list, node) { - bw = tm_node->shaper_profile->profile.peak.rate; + if (tm_node->shaper_profile) + bw = tm_node->shaper_profile->profile.peak.rate; + else + bw = 0; if (bw) { error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS; error->message = "not support queue QoS"; -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH v2 6/7] net/ixgbe: fix not supporting NULL TM profile 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu ` (4 preceding siblings ...) 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 5/7] net/i40e: fix not supporting NULL TM profile Wenzhuo Lu @ 2017-10-17 5:50 ` Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 7/7] net/i40e: fix wrong parent when adding TM node Wenzhuo Lu 2017-10-20 14:18 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Dumitrescu, Cristian 7 siblings, 0 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-17 5:50 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu It's by design that APP can add a TM node without shaper profile. But ixgbe doesn't support it currently. Fixes: e0ff4d304ccf ("net/ixgbe: support adding TM node") Fixes: 5713ade69776 ("net/ixgbe: support committing TM hierarchy") Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_tm.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c index 5c9b24c..2b27ac1 100644 --- a/drivers/net/ixgbe/ixgbe_tm.c +++ b/drivers/net/ixgbe/ixgbe_tm.c @@ -588,7 +588,7 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private); enum ixgbe_tm_node_type node_type = IXGBE_TM_NODE_TYPE_MAX; enum ixgbe_tm_node_type parent_node_type = IXGBE_TM_NODE_TYPE_MAX; - struct ixgbe_tm_shaper_profile *shaper_profile; + struct ixgbe_tm_shaper_profile *shaper_profile = NULL; struct ixgbe_tm_node *tm_node; struct ixgbe_tm_node *parent_node; uint8_t nb_tcs; @@ -619,12 +619,15 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, } /* check the shaper profile id */ - shaper_profile = ixgbe_shaper_profile_search(dev, - params->shaper_profile_id); - if (!shaper_profile) { - error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID; - error->message = "shaper profile not exist"; - return -EINVAL; + if (params->shaper_profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE) { + shaper_profile = ixgbe_shaper_profile_search( + dev, params->shaper_profile_id); + if (!shaper_profile) { + error->type = + RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID; + error->message = "shaper profile not exist"; + return -EINVAL; + } } /* root node if not have a parent */ @@ -662,7 +665,8 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, tm_conf->root = tm_node; /* increase the reference counter of the shaper profile */ - shaper_profile->reference_count++; + if (shaper_profile) + shaper_profile->reference_count++; return 0; } @@ -753,7 +757,8 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, tm_node->parent->reference_count++; /* increase the reference counter of the shaper profile */ - shaper_profile->reference_count++; + if (shaper_profile) + shaper_profile->reference_count++; return 0; } @@ -801,14 +806,16 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, /* root node */ if (node_type == IXGBE_TM_NODE_TYPE_PORT) { - tm_node->shaper_profile->reference_count--; + if (tm_node->shaper_profile) + tm_node->shaper_profile->reference_count--; rte_free(tm_node); tm_conf->root = NULL; return 0; } /* TC or queue node */ - tm_node->shaper_profile->reference_count--; + if (tm_node->shaper_profile) + tm_node->shaper_profile->reference_count--; tm_node->parent->reference_count--; if (node_type == IXGBE_TM_NODE_TYPE_TC) { TAILQ_REMOVE(&tm_conf->tc_list, tm_node, node); @@ -1003,7 +1010,8 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, goto done; /* not support port max bandwidth yet */ - if (tm_conf->root->shaper_profile->profile.peak.rate) { + if (tm_conf->root->shaper_profile && + tm_conf->root->shaper_profile->profile.peak.rate) { error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE; error->message = "no port max bandwidth"; goto fail_clear; @@ -1011,7 +1019,8 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, /* HW not support TC max bandwidth */ TAILQ_FOREACH(tm_node, &tm_conf->tc_list, node) { - if (tm_node->shaper_profile->profile.peak.rate) { + if (tm_node->shaper_profile && + tm_node->shaper_profile->profile.peak.rate) { error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE; error->message = "no TC max bandwidth"; goto fail_clear; @@ -1020,7 +1029,10 @@ static int ixgbe_hierarchy_commit(struct rte_eth_dev *dev, /* queue max bandwidth */ TAILQ_FOREACH(tm_node, &tm_conf->queue_list, node) { - bw = tm_node->shaper_profile->profile.peak.rate; + if (tm_node->shaper_profile) + bw = tm_node->shaper_profile->profile.peak.rate; + else + bw = 0; if (bw) { /* interpret Bps to Mbps */ bw = bw * 8 / 1000 / 1000; -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH v2 7/7] net/i40e: fix wrong parent when adding TM node 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu ` (5 preceding siblings ...) 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 6/7] net/ixgbe: " Wenzhuo Lu @ 2017-10-17 5:50 ` Wenzhuo Lu 2017-10-20 14:18 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Dumitrescu, Cristian 7 siblings, 0 replies; 18+ messages in thread From: Wenzhuo Lu @ 2017-10-17 5:50 UTC (permalink / raw) To: dev; +Cc: Wenzhuo Lu Queue's parent is TC not port. It's wrong to always set the parent to root. Fixes: e0ff4d304ccf ("net/ixgbe: support adding TM node") Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/i40e/i40e_tm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c index f4d1cb8..49afd51 100644 --- a/drivers/net/i40e/i40e_tm.c +++ b/drivers/net/i40e/i40e_tm.c @@ -621,7 +621,7 @@ static int i40e_hierarchy_commit(struct rte_eth_dev *dev, tm_node->priority = priority; tm_node->weight = weight; tm_node->reference_count = 0; - tm_node->parent = pf->tm_conf.root; + tm_node->parent = parent_node; tm_node->shaper_profile = shaper_profile; (void)rte_memcpy(&tm_node->params, params, sizeof(struct rte_tm_node_params)); -- 1.9.3 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu ` (6 preceding siblings ...) 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 7/7] net/i40e: fix wrong parent when adding TM node Wenzhuo Lu @ 2017-10-20 14:18 ` Dumitrescu, Cristian 2017-10-23 17:02 ` Ferruh Yigit 7 siblings, 1 reply; 18+ messages in thread From: Dumitrescu, Cristian @ 2017-10-20 14:18 UTC (permalink / raw) To: Lu, Wenzhuo, dev; +Cc: Lu, Wenzhuo, Yigit, Ferruh > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > Sent: Tuesday, October 17, 2017 6:51 AM > To: dev@dpdk.org > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com> > Subject: [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on > i40e and ixgbe > > By design, all the queues are leaf nodes and others are non-leaf > nodes, and the shaper profile can be null. > Currently the i40e and ixgbe implementation doesn't follow this design. > This patch set fixes this issue. > > v2: > - fixed the wrong parent node on i40e. > > > Wenzhuo Lu (7): > net/i40e: fix TM node parameter checking > net/i40e: fix TM level capability getting > net/ixgbe: fix TM node parameter checking > net/ixgbe: fix TM level capability getting > net/i40e: fix not supporting NULL TM profile > net/ixgbe: fix not supporting NULL TM profile > net/i40e: fix wrong parent when adding TM node > > drivers/net/i40e/i40e_tm.c | 102 ++++++++++++++++++++++++++---------- > ------- > drivers/net/ixgbe/ixgbe_tm.c | 91 ++++++++++++++++++++++--------------- > - > 2 files changed, 117 insertions(+), 76 deletions(-) > > -- > 1.9.3 Series-acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com> ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe 2017-10-20 14:18 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Dumitrescu, Cristian @ 2017-10-23 17:02 ` Ferruh Yigit 0 siblings, 0 replies; 18+ messages in thread From: Ferruh Yigit @ 2017-10-23 17:02 UTC (permalink / raw) To: Dumitrescu, Cristian, Lu, Wenzhuo, dev On 10/20/2017 7:18 AM, Dumitrescu, Cristian wrote: > > >> -----Original Message----- >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu >> Sent: Tuesday, October 17, 2017 6:51 AM >> To: dev@dpdk.org >> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com> >> Subject: [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on >> i40e and ixgbe >> >> By design, all the queues are leaf nodes and others are non-leaf >> nodes, and the shaper profile can be null. >> Currently the i40e and ixgbe implementation doesn't follow this design. >> This patch set fixes this issue. >> >> v2: >> - fixed the wrong parent node on i40e. >> >> >> Wenzhuo Lu (7): >> net/i40e: fix TM node parameter checking >> net/i40e: fix TM level capability getting >> net/ixgbe: fix TM node parameter checking >> net/ixgbe: fix TM level capability getting >> net/i40e: fix not supporting NULL TM profile >> net/ixgbe: fix not supporting NULL TM profile >> net/i40e: fix wrong parent when adding TM node > Series-acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com> Series applied to dpdk-next-net/master, thanks. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH 0/6] fix TM (Traffic Management) issues on i40e and ixgbe 2017-10-13 2:58 [dpdk-dev] [PATCH 0/6] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu ` (6 preceding siblings ...) 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu @ 2017-10-20 14:17 ` Dumitrescu, Cristian 7 siblings, 0 replies; 18+ messages in thread From: Dumitrescu, Cristian @ 2017-10-20 14:17 UTC (permalink / raw) To: dev; +Cc: Lu, Wenzhuo, thomas, Yigit, Ferruh > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > Sent: Friday, October 13, 2017 3:58 AM > To: dev@dpdk.org > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com> > Subject: [dpdk-dev] [PATCH 0/6] fix TM (Traffic Management) issues on i40e > and ixgbe > > By design, all the queues are leaf nodes and others are > non-leaf nodes, and the shaper profile can be null. > Currently the i40e and ixgbe implementation doesn't > follow this design. > This patch set fixes this issue. > > Wenzhuo Lu (6): > net/i40e: fix TM node parameter checking > net/i40e: fix TM level capability getting > net/ixgbe: fix TM node parameter checking > net/ixgbe: fix TM level capability getting > net/i40e: fix not supporting NULL TM profile > net/ixgbe: fix not supporting NULL TM profile > > drivers/net/i40e/i40e_tm.c | 100 +++++++++++++++++++++++++++-------- > -------- > drivers/net/ixgbe/ixgbe_tm.c | 91 +++++++++++++++++++++++------------- > --- > 2 files changed, 116 insertions(+), 75 deletions(-) > > -- > 1.9.3 Series-acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com> ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2017-10-23 17:02 UTC | newest] Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-10-13 2:58 [dpdk-dev] [PATCH 0/6] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 1/6] net/i40e: fix TM node parameter checking Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 2/6] net/i40e: fix TM level capability getting Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 3/6] net/ixgbe: fix TM node parameter checking Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 4/6] net/ixgbe: fix TM level capability getting Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 5/6] net/i40e: fix not supporting NULL TM profile Wenzhuo Lu 2017-10-13 2:58 ` [dpdk-dev] [PATCH 6/6] net/ixgbe: " Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 1/7] net/i40e: fix TM node parameter checking Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 2/7] net/i40e: fix TM level capability getting Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 3/7] net/ixgbe: fix TM node parameter checking Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 4/7] net/ixgbe: fix TM level capability getting Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 5/7] net/i40e: fix not supporting NULL TM profile Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 6/7] net/ixgbe: " Wenzhuo Lu 2017-10-17 5:50 ` [dpdk-dev] [PATCH v2 7/7] net/i40e: fix wrong parent when adding TM node Wenzhuo Lu 2017-10-20 14:18 ` [dpdk-dev] [PATCH v2 0/7] fix TM (Traffic Management) issues on i40e and ixgbe Dumitrescu, Cristian 2017-10-23 17:02 ` Ferruh Yigit 2017-10-20 14:17 ` [dpdk-dev] [PATCH 0/6] " Dumitrescu, Cristian
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).