u32 hw_if_index = (u32) ~ 0;
u32 nb_rx_desc = (u32) ~ 0;
u32 nb_tx_desc = (u32) ~ 0;
- clib_error_t *rv;
+ clib_error_t *error = NULL;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
else if (unformat (line_input, "rx %d", &nb_rx_desc))
;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
- unformat_free (line_input);
-
if (hw_if_index == (u32) ~ 0)
- return clib_error_return (0, "please specify valid interface name");
+ {
+ error = clib_error_return (0, "please specify valid interface name");
+ goto done;
+ }
hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
xd = vec_elt_at_index (dm->devices, hw->dev_instance);
if ((xd->flags & DPDK_DEVICE_FLAG_PMD) == 0)
- return clib_error_return (0, "number of descriptors can be set only for "
- "physical devices");
+ {
+ error =
+ clib_error_return (0,
+ "number of descriptors can be set only for "
+ "physical devices");
+ goto done;
+ }
if ((nb_rx_desc == (u32) ~ 0 || nb_rx_desc == xd->nb_rx_desc) &&
(nb_tx_desc == (u32) ~ 0 || nb_tx_desc == xd->nb_tx_desc))
- return clib_error_return (0, "nothing changed");
+ {
+ error = clib_error_return (0, "nothing changed");
+ goto done;
+ }
if (nb_rx_desc != (u32) ~ 0)
xd->nb_rx_desc = nb_rx_desc;
if (nb_tx_desc != (u32) ~ 0)
xd->nb_tx_desc = nb_tx_desc;
- rv = dpdk_port_setup (dm, xd);
+ error = dpdk_port_setup (dm, xd);
+
+done:
+ unformat_free (line_input);
- return rv;
+ return error;
}
/* *INDENT-OFF* */
u32 queue = (u32) 0;
u32 cpu = (u32) ~ 0;
int i;
+ clib_error_t *error = NULL;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
else if (unformat (line_input, "thread %d", &cpu))
;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
- unformat_free (line_input);
-
if (hw_if_index == (u32) ~ 0)
- return clib_error_return (0, "please specify valid interface name");
+ {
+ error = clib_error_return (0, "please specify valid interface name");
+ goto done;
+ }
if (cpu < dm->input_cpu_first_index ||
cpu >= (dm->input_cpu_first_index + dm->input_cpu_count))
- return clib_error_return (0, "please specify valid thread id");
+ {
+ error = clib_error_return (0, "please specify valid thread id");
+ goto done;
+ }
hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
xd = vec_elt_at_index (dm->devices, hw->dev_instance);
queue == dq->queue_id)
{
if (cpu == i) /* nothing to do */
- return 0;
+ goto done;
vec_del1(dm->devices_by_cpu[i], dq - dm->devices_by_cpu[i]);
vec_add2(dm->devices_by_cpu[cpu], dq, 1);
vlib_node_set_state (vlib_mains[cpu], dpdk_input_node.index,
VLIB_NODE_STATE_POLLING);
- return 0;
+ goto done;
}
}
/* *INDENT-ON* */
}
- return clib_error_return (0, "not found");
+ error = clib_error_return (0, "not found");
+
+done:
+ unformat_free (line_input);
+
+ return error;
}
/* *INDENT-OFF* */
u32 hw_if_index = (u32) ~ 0;
u32 cpu = (u32) ~ 0;
int i;
+ clib_error_t *error = NULL;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
else if (unformat (line_input, "thread %d", &cpu))
;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
- unformat_free (line_input);
-
if (hw_if_index == (u32) ~ 0)
return clib_error_return (0, "please specify valid interface name");
if (cpu < dm->hqos_cpu_first_index ||
cpu >= (dm->hqos_cpu_first_index + dm->hqos_cpu_count))
- return clib_error_return (0, "please specify valid thread id");
+ {
+ error = clib_error_return (0, "please specify valid thread id");
+ goto done;
+ }
hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
xd = vec_elt_at_index (dm->devices, hw->dev_instance);
if (hw_if_index == dm->devices[dq->device].vlib_hw_if_index)
{
if (cpu == i) /* nothing to do */
- return 0;
+ goto done;
vec_del1 (dm->devices_by_hqos_cpu[i],
dq - dm->devices_by_hqos_cpu[i]);
vec_sort_with_function (dm->devices_by_hqos_cpu[cpu],
dpdk_device_queue_sort);
- return 0;
+ goto done;
}
}
}
- return clib_error_return (0, "not found");
+ error = clib_error_return (0, "not found");
+
+done:
+ unformat_free (line_input);
+
+ return error;
}
/* *INDENT-OFF* */
u32 pipe_id = (u32) ~ 0;
u32 profile_id = (u32) ~ 0;
int rv;
+ clib_error_t *error = NULL;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
else if (unformat (line_input, "profile %d", &profile_id))
;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
- unformat_free (line_input);
-
if (hw_if_index == (u32) ~ 0)
- return clib_error_return (0, "please specify valid interface name");
+ {
+ error = clib_error_return (0, "please specify valid interface name");
+ goto done;
+ }
hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
xd = vec_elt_at_index (dm->devices, hw->dev_instance);
rte_sched_pipe_config (xd->hqos_ht->hqos, subport_id, pipe_id,
profile_id);
if (rv)
- return clib_error_return (0, "pipe configuration failed");
+ {
+ error = clib_error_return (0, "pipe configuration failed");
+ goto done;
+ }
- return 0;
+done:
+ unformat_free (line_input);
+
+ return error;
}
/* *INDENT-OFF* */
.tc_period = 10,
};
int rv;
+ clib_error_t *error = NULL;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
else if (unformat (line_input, "period %d", &p.tc_period))
;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
- unformat_free (line_input);
-
if (hw_if_index == (u32) ~ 0)
- return clib_error_return (0, "please specify valid interface name");
+ {
+ error = clib_error_return (0, "please specify valid interface name");
+ goto done;
+ }
hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
xd = vec_elt_at_index (dm->devices, hw->dev_instance);
rv = rte_sched_subport_config (xd->hqos_ht->hqos, subport_id, &p);
if (rv)
- return clib_error_return (0, "subport configuration failed");
+ {
+ error = clib_error_return (0, "subport configuration failed");
+ goto done;
+ }
- return 0;
+done:
+ unformat_free (line_input);
+
+ return error;
}
/* *INDENT-OFF* */
u32 queue = (u32) ~ 0;
u32 entry = (u32) ~ 0;
u32 val, i;
+ clib_error_t *error = NULL;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
else if (unformat (line_input, "queue %d", &queue))
;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
- unformat_free (line_input);
-
if (hw_if_index == (u32) ~ 0)
- return clib_error_return (0, "please specify valid interface name");
+ {
+ error = clib_error_return (0, "please specify valid interface name");
+ goto done;
+ }
if (entry >= 64)
- return clib_error_return (0, "invalid entry");
+ {
+ error = clib_error_return (0, "invalid entry");
+ goto done;
+ }
if (tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE)
- return clib_error_return (0, "invalid traffic class");
+ {
+ error = clib_error_return (0, "invalid traffic class");
+ goto done;
+ }
if (queue >= RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS)
- return clib_error_return (0, "invalid traffic class");
+ {
+ error = clib_error_return (0, "invalid traffic class");
+ goto done;
+ }
hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
xd = vec_elt_at_index (dm->devices, hw->dev_instance);
uword *p = hash_get_mem (tm->thread_registrations_by_name, "workers");
/* Should never happen, shut up Coverity warning */
if (p == 0)
- return clib_error_return (0, "no worker registrations?");
+ {
+ error = clib_error_return (0, "no worker registrations?");
+ goto done;
+ }
vlib_thread_registration_t *tr = (vlib_thread_registration_t *) p[0];
int worker_thread_first = tr->first_index;
for (i = 0; i < worker_thread_count; i++)
xd->hqos_wt[worker_thread_first + i].hqos_tc_table[entry] = val;
- return 0;
+done:
+ unformat_free (line_input);
+
+ return error;
}
/* *INDENT-OFF* */
unformat_input_t _line_input, *line_input = &_line_input;
vlib_thread_main_t *tm = vlib_get_thread_main ();
dpdk_main_t *dm = &dpdk_main;
+ clib_error_t *error = NULL;
/* Device specific data */
struct rte_eth_dev_info dev_info;
else if (unformat (line_input, "mask %llx", &mask))
;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
- unformat_free (line_input);
-
/* Get interface */
if (hw_if_index == (u32) ~ 0)
- return clib_error_return (0, "please specify valid interface name");
+ {
+ error = clib_error_return (0, "please specify valid interface name");
+ goto done;
+ }
hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
xd = vec_elt_at_index (dm->devices, hw->dev_instance);
if (devconf->hqos_enabled == 0)
{
vlib_cli_output (vm, "HQoS disabled for this interface");
- return 0;
+ goto done;
}
n_subports_per_port = devconf->hqos.port.n_subports_per_port;
/* Validate packet field configuration: id, offset and mask */
if (id >= 3)
- return clib_error_return (0, "invalid packet field id");
+ {
+ error = clib_error_return (0, "invalid packet field id");
+ goto done;
+ }
switch (id)
{
case 0:
if (dpdk_hqos_validate_mask (mask, n_subports_per_port) != 0)
- return clib_error_return (0, "invalid subport ID mask "
- "(n_subports_per_port = %u)",
- n_subports_per_port);
+ {
+ error = clib_error_return (0, "invalid subport ID mask "
+ "(n_subports_per_port = %u)",
+ n_subports_per_port);
+ goto done;
+ }
break;
case 1:
if (dpdk_hqos_validate_mask (mask, n_pipes_per_subport) != 0)
- return clib_error_return (0, "invalid pipe ID mask "
- "(n_pipes_per_subport = %u)",
- n_pipes_per_subport);
+ {
+ error = clib_error_return (0, "invalid pipe ID mask "
+ "(n_pipes_per_subport = %u)",
+ n_pipes_per_subport);
+ goto done;
+ }
break;
case 2:
default:
if (dpdk_hqos_validate_mask (mask, tctbl_size) != 0)
- return clib_error_return (0, "invalid TC table index mask "
- "(TC table size = %u)", tctbl_size);
+ {
+ error = clib_error_return (0, "invalid TC table index mask "
+ "(TC table size = %u)", tctbl_size);
+ goto done;
+ }
}
/* Propagate packet field configuration to all workers */
__builtin_ctzll (mask);
}
- return 0;
+done:
+ unformat_free (line_input);
+
+ return error;
}
/* *INDENT-OFF* */
dpdk_device_config_t *devconf = 0;
vlib_thread_registration_t *tr;
uword *p = 0;
+ clib_error_t *error = NULL;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
&hw_if_index))
;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
- unformat_free (line_input);
-
if (hw_if_index == (u32) ~ 0)
- return clib_error_return (0, "please specify interface name!!");
+ {
+ error = clib_error_return (0, "please specify interface name!!");
+ goto done;
+ }
hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
xd = vec_elt_at_index (dm->devices, hw->dev_instance);
if (devconf->hqos_enabled == 0)
{
vlib_cli_output (vm, "HQoS disabled for this interface");
- return 0;
+ goto done;
}
/* Detect the set of worker threads */
/* Should never happen, shut up Coverity warning */
if (p == 0)
- return clib_error_return (0, "no worker registrations?");
+ {
+ error = clib_error_return (0, "no worker registrations?");
+ goto done;
+ }
tr = (vlib_thread_registration_t *) p[0];
}
#endif
- return 0;
+done:
+ unformat_free (line_input);
+
+ return error;
}
/* *INDENT-OFF* */
u32 qindex;
struct rte_sched_queue_stats stats;
u16 qlen;
+ clib_error_t *error = NULL;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
- unformat_free (line_input);
-
if (hw_if_index == (u32) ~ 0)
- return clib_error_return (0, "please specify interface name!!");
+ {
+ error = clib_error_return (0, "please specify interface name!!");
+ goto done;
+ }
hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
xd = vec_elt_at_index (dm->devices, hw->dev_instance);
if (devconf->hqos_enabled == 0)
{
vlib_cli_output (vm, "HQoS disabled for this interface");
- return 0;
+ goto done;
}
/*
if (rte_sched_queue_read_stats (xd->hqos_ht->hqos, qindex, &stats, &qlen) !=
0)
- return clib_error_return (0, "failed to read stats");
+ {
+ error = clib_error_return (0, "failed to read stats");
+ goto done;
+ }
vlib_cli_output (vm, "%=24s%=16s", "Stats Parameter", "Value");
vlib_cli_output (vm, "%=24s%=16d", "Packets", stats.n_pkts);
vlib_cli_output (vm, "%=24s%=16d", "Bytes dropped", stats.n_bytes_dropped);
- return 0;
+done:
+ unformat_free (line_input);
+
+ return error;
}
/* *INDENT-OFF* */