X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-pmd%2Fsoftnicfwd.c;h=e9d437364467415c0172db9c76c4089770e3eca7;hb=64edb05e29c82260a0bd1000a20023d20c123e41;hp=7ff622806f6667eb208194dae14cb93be83eb2e9;hpb=1b3fd9738824e19d80edfc96f734b4e089b83707;p=dpdk.git diff --git a/app/test-pmd/softnicfwd.c b/app/test-pmd/softnicfwd.c index 7ff622806f..e9d4373644 100644 --- a/app/test-pmd/softnicfwd.c +++ b/app/test-pmd/softnicfwd.c @@ -163,16 +163,22 @@ softnic_begin(void *arg __rte_unused) return 0; } -static void +static int set_tm_hiearchy_nodes_shaper_rate(portid_t port_id, struct tm_hierarchy *h) { struct rte_eth_link link_params; uint64_t tm_port_rate; + int ret; memset(&link_params, 0, sizeof(link_params)); - rte_eth_link_get(port_id, &link_params); + ret = rte_eth_link_get(port_id, &link_params); + if (ret < 0) { + printf("Error during getting device (port %u) link info: %s\n", + port_id, rte_strerror(-ret)); + return ret; + } tm_port_rate = (uint64_t)ETH_SPEED_NUM_10G * BYTES_IN_MBPS; /* Set tm hierarchy shapers rate */ @@ -183,6 +189,8 @@ set_tm_hiearchy_nodes_shaper_rate(portid_t port_id, = h->subport_node_shaper_rate / PIPE_NODES_PER_SUBPORT; h->tc_node_shaper_rate = h->pipe_node_shaper_rate; h->tc_node_shared_shaper_rate = h->subport_node_shaper_rate; + + return 0; } static int @@ -458,6 +466,7 @@ softport_tm_tc_node_add(portid_t port_id, error->message, shaper_profile_id); + free(tnp.shared_shaper_id); return -1; } tnp.shaper_profile_id = shaper_profile_id; @@ -473,6 +482,7 @@ softport_tm_tc_node_add(portid_t port_id, error->message, h->tc_node_id[pos][k]); + free(tnp.shared_shaper_id); return -1; } shaper_profile_id++; @@ -552,7 +562,9 @@ softport_tm_hierarchy_specify(portid_t port_id, memset(&h, 0, sizeof(struct tm_hierarchy)); /* TM hierarchy shapers rate */ - set_tm_hiearchy_nodes_shaper_rate(port_id, &h); + status = set_tm_hiearchy_nodes_shaper_rate(port_id, &h); + if (status) + return status; /* Add root node (level 0) */ status = softport_tm_root_node_add(port_id, &h, error);