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;
- if (tm_port_rate > UINT32_MAX)
- tm_port_rate = UINT32_MAX;
-
/* Set tm hierarchy shapers rate */
h->root_node_shaper_rate = tm_port_rate;
h->subport_node_shaper_rate =
= 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
error->message,
shaper_profile_id);
+ free(tnp.shared_shaper_id);
return -1;
}
tnp.shaper_profile_id = shaper_profile_id;
error->message,
h->tc_node_id[pos][k]);
+ free(tnp.shared_shaper_id);
return -1;
}
shaper_profile_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);