-
- return 0;
-}
-
-void
-tm_free(struct pmd_internals *p)
-{
- tm_hierarchy_uninit(p);
-}
-
-int
-tm_start(struct pmd_internals *p)
-{
- struct softnic_tmgr_port *tmgr_port;
- struct tm_params *t = &p->soft.tm.params;
- struct rte_sched_port *sched;
- uint32_t n_subports, subport_id;
- int status;
-
- /* Is hierarchy frozen? */
- if (p->soft.tm.hierarchy_frozen == 0)
- return -1;
-
- /* Port */
- sched = rte_sched_port_config(&t->port_params);
- if (sched == NULL)
- return -1;
-
- /* Subport */
- n_subports = t->port_params.n_subports_per_port;
- for (subport_id = 0; subport_id < n_subports; subport_id++) {
- uint32_t n_pipes_per_subport =
- t->port_params.n_pipes_per_subport;
- uint32_t pipe_id;
-
- status = rte_sched_subport_config(sched,
- subport_id,
- &t->subport_params[subport_id]);
- if (status) {
- rte_sched_port_free(sched);
- return -1;
- }
-
- /* Pipe */
- n_pipes_per_subport = t->port_params.n_pipes_per_subport;
- for (pipe_id = 0; pipe_id < n_pipes_per_subport; pipe_id++) {
- int pos = subport_id * TM_MAX_PIPES_PER_SUBPORT +
- pipe_id;
- int profile_id = t->pipe_to_profile[pos];
-
- if (profile_id < 0)
- continue;
-
- status = rte_sched_pipe_config(sched,
- subport_id,
- pipe_id,
- profile_id);
- if (status) {
- rte_sched_port_free(sched);
- return -1;
- }
- }
- }
-
- tmgr_port = softnic_tmgr_port_create(p, "TMGR", sched);
- if (tmgr_port == NULL) {
- rte_sched_port_free(sched);
- return -1;
- }
-
- /* Commit */
- p->soft.tm.sched = sched;
-
- return 0;
-}
-
-void
-tm_stop(struct pmd_internals *p)
-{
- if (p->soft.tm.sched) {
- rte_sched_port_free(p->soft.tm.sched);
- p->soft.tm.sched = NULL;
- }
- /* Unfreeze hierarchy */
- p->soft.tm.hierarchy_frozen = 0;