@@ -407,6 +407,7 @@ cmd_tmgr_subport_profile(char **tokens,
size_t out_size)
{
struct rte_sched_subport_params p;
+ struct rte_sched_subport_profile_params pp;
int status, i;
if (n_tokens != 35) {
@@ -414,23 +415,23 @@ cmd_tmgr_subport_profile(char **tokens,
return;
}
- if (parser_read_uint64(&p.tb_rate, tokens[3]) != 0) {
+ if (parser_read_uint64(&pp.tb_rate, tokens[3]) != 0) {
snprintf(out, out_size, MSG_ARG_INVALID, "tb_rate");
return;
}
- if (parser_read_uint64(&p.tb_size, tokens[4]) != 0) {
+ if (parser_read_uint64(&pp.tb_size, tokens[4]) != 0) {
snprintf(out, out_size, MSG_ARG_INVALID, "tb_size");
return;
}
for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)
- if (parser_read_uint64(&p.tc_rate[i], tokens[5 + i]) != 0) {
+ if (parser_read_uint64(&pp.tc_rate[i], tokens[5 + i]) != 0) {
snprintf(out, out_size, MSG_ARG_INVALID, "tc_rate");
return;
}
- if (parser_read_uint64(&p.tc_period, tokens[18]) != 0) {
+ if (parser_read_uint64(&pp.tc_period, tokens[18]) != 0) {
snprintf(out, out_size, MSG_ARG_INVALID, "tc_period");
return;
}
@@ -440,7 +441,8 @@ cmd_tmgr_subport_profile(char **tokens,
return;
}
- if (parser_read_uint32(&p.n_pipes_per_subport_enabled, tokens[20]) != 0) {
+ if (parser_read_uint32(&p.n_pipes_per_subport_enabled,
+ tokens[20]) != 0) {
snprintf(out, out_size, MSG_ARG_INVALID, "n_pipes_per_subport");
return;
}
@@ -456,7 +458,7 @@ cmd_tmgr_subport_profile(char **tokens,
return;
}
- status = tmgr_subport_profile_add(&p);
+ status = tmgr_subport_profile_add(&p, &pp);
if (status != 0) {
snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
return;
@@ -11,6 +11,9 @@
static struct rte_sched_subport_params
subport_profile[TMGR_SUBPORT_PROFILE_MAX];
+static struct rte_sched_subport_profile_params
+ profile_params[TMGR_SUBPORT_PROFILE_MAX];
+
static uint32_t n_subport_profiles;
static struct rte_sched_pipe_params
@@ -44,10 +47,11 @@ tmgr_port_find(const char *name)
}
int
-tmgr_subport_profile_add(struct rte_sched_subport_params *p)
+tmgr_subport_profile_add(struct rte_sched_subport_params *p,
+ struct rte_sched_subport_profile_params *pp)
{
/* Check input params */
- if (p == NULL ||
+ if (p == NULL || pp == NULL ||
p->n_pipes_per_subport_enabled == 0)
return -1;
@@ -56,6 +60,10 @@ tmgr_subport_profile_add(struct rte_sched_subport_params *p)
p,
sizeof(*p));
+ memcpy(&profile_params[n_subport_profiles],
+ pp,
+ sizeof(*pp));
+
n_subport_profiles++;
return 0;
@@ -103,6 +111,9 @@ tmgr_port_create(const char *name, struct tmgr_port_params *params)
p.mtu = params->mtu;
p.frame_overhead = params->frame_overhead;
p.n_subports_per_port = params->n_subports_per_port;
+ p.n_subport_profiles = n_subport_profiles;
+ p.subport_profiles = profile_params;
+ p.n_max_subport_profiles = TMGR_SUBPORT_PROFILE_MAX;
p.n_pipes_per_subport = TMGR_PIPE_SUBPORT_MAX;
s = rte_sched_port_config(&p);
@@ -126,6 +137,13 @@ tmgr_port_create(const char *name, struct tmgr_port_params *params)
return NULL;
}
+ status = rte_sched_subport_profile_config(s, i, 0);
+
+ if (status) {
+ rte_sched_port_free(s);
+ return NULL;
+ }
+
for (j = 0; j < subport_profile[0].n_pipes_per_subport_enabled; j++) {
status = rte_sched_pipe_config(
s,
@@ -182,6 +200,10 @@ tmgr_subport_config(const char *port_name,
subport_id,
&subport_profile[subport_profile_id]);
+ if (!status)
+ status = rte_sched_subport_profile_config(port->s, subport_id,
+ subport_profile_id);
+
return status;
}
@@ -48,7 +48,8 @@ struct tmgr_port_params {
};
int
-tmgr_subport_profile_add(struct rte_sched_subport_params *p);
+tmgr_subport_profile_add(struct rte_sched_subport_params *p,
+ struct rte_sched_subport_profile_params *pp);
int
tmgr_pipe_profile_add(struct rte_sched_pipe_params *p);