uint32_t n_subport_pipe_queues, i;
uint32_t size0, size1, bmp_mem_size;
int status;
+ int ret;
/* Check user parameters */
if (port == NULL) {
if (subport_id >= port->n_subports_per_port) {
RTE_LOG(ERR, SCHED,
"%s: Incorrect value for subport id\n", __func__);
-
- rte_sched_free_memory(port, n_subports);
- return -EINVAL;
+ ret = -EINVAL;
+ goto out;
}
if (subport_profile_id >= port->n_max_subport_profiles) {
RTE_LOG(ERR, SCHED, "%s: "
"Number of subport profile exceeds the max limit\n",
__func__);
- rte_sched_free_memory(port, n_subports);
- return -EINVAL;
+ ret = -EINVAL;
+ goto out;
}
/** Memory is allocated only on first invocation of the api for a
RTE_LOG(NOTICE, SCHED,
"%s: Port scheduler params check failed (%d)\n",
__func__, status);
-
- rte_sched_free_memory(port, n_subports);
- return -EINVAL;
+ ret = -EINVAL;
+ goto out;
}
/* Determine the amount of memory to allocate */
if (s == NULL) {
RTE_LOG(ERR, SCHED,
"%s: Memory allocation fails\n", __func__);
-
- rte_sched_free_memory(port, n_subports);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto out;
}
n_subports++;
params->red_params[i][j].min_th,
params->red_params[i][j].max_th,
params->red_params[i][j].maxp_inv) != 0) {
- rte_sched_free_memory(port, n_subports);
-
RTE_LOG(NOTICE, SCHED,
"%s: RED configuration init fails\n",
__func__);
- return -EINVAL;
+ ret = -EINVAL;
+ goto out;
}
}
}
if (s->bmp == NULL) {
RTE_LOG(ERR, SCHED,
"%s: Subport bitmap init error\n", __func__);
-
- rte_sched_free_memory(port, n_subports);
- return -EINVAL;
+ ret = -EINVAL;
+ goto out;
}
for (i = 0; i < RTE_SCHED_PORT_N_GRINDERS; i++)
rte_sched_port_log_subport_profile(port, subport_profile_id);
return 0;
+
+out:
+ rte_sched_free_memory(port, n_subports);
+
+ return ret;
}
int
struct rte_sched_pipe_profile *params;
uint32_t n_subports = subport_id + 1;
uint32_t deactivate, profile, i;
+ int ret;
/* Check user parameters */
profile = (uint32_t) pipe_profile;
if (subport_id >= port->n_subports_per_port) {
RTE_LOG(ERR, SCHED,
"%s: Incorrect value for parameter subport id\n", __func__);
-
- rte_sched_free_memory(port, n_subports);
- return -EINVAL;
+ ret = -EINVAL;
+ goto out;
}
s = port->subports[subport_id];
if (pipe_id >= s->n_pipes_per_subport_enabled) {
RTE_LOG(ERR, SCHED,
"%s: Incorrect value for parameter pipe id\n", __func__);
-
- rte_sched_free_memory(port, n_subports);
- return -EINVAL;
+ ret = -EINVAL;
+ goto out;
}
if (!deactivate && profile >= s->n_pipe_profiles) {
RTE_LOG(ERR, SCHED,
"%s: Incorrect value for parameter pipe profile\n", __func__);
-
- rte_sched_free_memory(port, n_subports);
- return -EINVAL;
+ ret = -EINVAL;
+ goto out;
}
sp = port->subport_profiles + s->profile;
}
return 0;
+
+out:
+ rte_sched_free_memory(port, n_subports);
+
+ return ret;
}
int