Re: [PATCH v7 5/5] app/testpmd: add traffic management forwarding mode
From: Singh, Jasvinder <hidden>
Date: 2017-10-10 10:07:46
<snip>
quoted
+static int +softport_tm_subport_node_add(portid_t port_id, struct tm_hierarchy*h,quoted
+ struct rte_tm_error *error) +{ + uint32_t subport_parent_node_id, subport_node_id; + struct rte_tm_node_params snp; + struct rte_tm_shaper_params ssp; + uint32_t priority, weight, level_id, shaper_profile_id; + uint32_t i; + + memset(&ssp, 0, sizeof(struct rte_tm_shaper_params)); + memset(&snp, 0, sizeof(struct rte_tm_node_params)); + + shaper_profile_id = h->n_shapers; + + /* Add Shaper Profile to TM Hierarchy */ + for (i = 0; i < SUBPORT_NODES_PER_PORT; i++) { + ssp.peak.rate = h->subport_node_shaper_rate; + ssp.peak.size = TOKEN_BUCKET_SIZE; + ssp.pkt_length_adjust =RTE_TM_ETH_FRAMING_OVERHEAD_FCS;quoted
+ + if (rte_tm_shaper_profile_add(port_id, shaper_profile_id, + &ssp, error)) { + printf("%s ERROR(%d)-%s!(shaper_id %u)\n ", + __func__, error->type, error->message, + shaper_profile_id); + return -1; + } + + /* Node Parameters */ + h->subport_node_id[i] = SUBPORT_NODES_START_ID + i; + subport_parent_node_id = h->root_node_id; + weight = 1; + priority = 0; + level_id = TM_NODE_LEVEL_SUBPORT; + snp.shaper_profile_id = shaper_profile_id; + snp.nonleaf.n_sp_priorities = 1; + snp.stats_mask = STATS_MASK_DEFAULT; + + /* Add Node to TM Hiearchy */ + if (rte_tm_node_add(port_id, + h->subport_node_id[i], + subport_parent_node_id, + priority, weight, + level_id, + &snp, + error)) { + printf("%s ERROR(%d)-%s!(node %u,parent %u,level%u)\n",quoted
+ __func__, + error->type, + error->message, + h->subport_node_id[i], + subport_parent_node_id, + level_id); + return -1; + } + shaper_profile_id++; + subport_node_id++;This is causing following build error: .../dpdk/app/test-pmd/tm.c:462:3: error: variable 'subport_node_id' is uninitialized when used here [-Werror,-Wuninitialized] subport_node_id++; ^~~~~~~~~~~~~~~ .../dpdk/app/test-pmd/tm.c:409:50: note: initialize the variable 'subport_node_id' to silence this warning uint32_t subport_parent_node_id, subport_node_id; ^ = 0
Fixed in the next version. Thanks.