From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v7 5/5] app/testpmd: add traffic management forwarding mode Date: Mon, 9 Oct 2017 21:17:40 +0100 Message-ID: References: <20171006170003.77311-2-jasvinder.singh@intel.com> <20171009125846.106218-1-jasvinder.singh@intel.com> <20171009125846.106218-6-jasvinder.singh@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: cristian.dumitrescu@intel.com, thomas@monjalon.net, wenzhuo.lu@intel.com To: Jasvinder Singh , dev@dpdk.org Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 7B52F1B1FF for ; Mon, 9 Oct 2017 22:17:42 +0200 (CEST) In-Reply-To: <20171009125846.106218-6-jasvinder.singh@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 10/9/2017 1:58 PM, Jasvinder Singh wrote: > This commit extends the testpmd application with new forwarding engine > that demonstrates the use of ethdev traffic management APIs and softnic > PMD for QoS traffic management. > > In this mode, 5-level hierarchical tree of the QoS scheduler is built > with the help of ethdev TM APIs such as shaper profile add/delete, > shared shaper add/update, node add/delete, hierarchy commit, etc. > The hierarchical tree has following nodes; root node(x1, level 0), > subport node(x1, level 1), pipe node(x4096, level 2), > tc node(x16348, level 3), queue node(x65536, level 4). > > During runtime, each received packet is first classified by mapping the > packet fields information to 5-tuples (HQoS subport, pipe, traffic class, > queue within traffic class, and color) and storing it in the packet mbuf > sched field. After classification, each packet is sent to softnic port > which prioritizes the transmission of the received packets, and > accordingly sends them on to the output interface. > > To enable traffic management mode, following testpmd command is used; > > $ ./testpmd -c c -n 4 --vdev > 'net_softnic0,hard_name=0000:06:00.1,soft_tm=on' -- -i > --forward-mode=tm > > Signed-off-by: Jasvinder Singh > Acked-by: Cristian Dumitrescu > Acked-by: Thomas Monjalon <...> > +static int > +softport_tm_subport_node_add(portid_t port_id, struct tm_hierarchy *h, > + 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; > + > + 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", > + __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