if (error->cause)
snprintf(buf, sizeof(buf), "cause: %p, ", error->cause);
- printf("%s: %s%s (error %d)\n", errstr, error->cause ? buf : "",
+ fprintf(stderr, "%s: %s%s (error %d)\n",
+ errstr, error->cause ? buf : "",
error->message ? error->message : "(no stated reason)",
error->type);
}
/* Check: num of shared shaper */
if (n_shared_shapers >= MAX_NUM_SHARED_SHAPERS) {
- printf(" Number of shared shapers exceed the max (error)\n");
+ fprintf(stderr,
+ " Number of shared shapers exceed the max (error)\n");
return -1;
}
memset(&error, 0, sizeof(struct rte_tm_error));
/* Port status */
if (!port_is_started(port_id)) {
- printf(" Port %u not started (error)\n", port_id);
+ fprintf(stderr, " Port %u not started (error)\n", port_id);
return;
}
/* Command type: add */
if ((strcmp(res->cmd_type, "add") == 0) &&
(port_is_started(port_id))) {
- printf(" Port %u not stopped (error)\n", port_id);
+ fprintf(stderr, " Port %u not stopped (error)\n", port_id);
return;
}
/* Command type: set (update) */
if ((strcmp(res->cmd_type, "set") == 0) &&
(!port_is_started(port_id))) {
- printf(" Port %u not started (error)\n", port_id);
+ fprintf(stderr, " Port %u not started (error)\n", port_id);
return;
}
memset(&error, 0, sizeof(struct rte_tm_error));
/* Port status */
if (!port_is_started(port_id)) {
- printf(" Port %u not started (error)\n", port_id);
+ fprintf(stderr, " Port %u not started (error)\n", port_id);
return;
}
shared_shaper_id = (uint32_t *)malloc(MAX_NUM_SHARED_SHAPERS *
sizeof(uint32_t));
if (shared_shaper_id == NULL) {
- printf(" Memory not allocated for shared shapers (error)\n");
+ fprintf(stderr,
+ " Memory not allocated for shared shapers (error)\n");
return;
}
/* Parse multi shared shaper id string */
ret = parse_multi_ss_id_str(s_str, &n_shared_shapers, shared_shaper_id);
if (ret) {
- printf(" Shared shapers params string parse error\n");
+ fprintf(stderr, " Shared shapers params string parse error\n");
free(shared_shaper_id);
return;
}
shared_shaper_id = (uint32_t *)malloc(MAX_NUM_SHARED_SHAPERS *
sizeof(uint32_t));
if (shared_shaper_id == NULL) {
- printf(" Memory not allocated for shared shapers (error)\n");
+ fprintf(stderr,
+ " Memory not allocated for shared shapers (error)\n");
return;
}
/* Parse multi shared shaper id string */
ret = parse_multi_ss_id_str(s_str, &n_shared_shapers, shared_shaper_id);
if (ret) {
- printf(" Shared shapers params string parse error\n");
+ fprintf(stderr, " Shared shapers params string parse error\n");
free(shared_shaper_id);
return;
}
shared_shaper_id = (uint32_t *)malloc(MAX_NUM_SHARED_SHAPERS *
sizeof(uint32_t));
if (shared_shaper_id == NULL) {
- printf(" Memory not allocated for shared shapers (error)\n");
+ fprintf(stderr,
+ " Memory not allocated for shared shapers (error)\n");
return;
}
/* Parse multi shared shaper id string */
ret = parse_multi_ss_id_str(s_str, &n_shared_shapers, shared_shaper_id);
if (ret) {
- printf(" Shared shapers params string parse error\n");
+ fprintf(stderr, " Shared shapers params string parse error\n");
free(shared_shaper_id);
return;
}
memset(&error, 0, sizeof(struct rte_tm_error));
/* Port status */
if (port_is_started(port_id)) {
- printf(" Port %u not stopped (error)\n", port_id);
+ fprintf(stderr, " Port %u not stopped (error)\n", port_id);
return;
}
memset(&error, 0, sizeof(struct rte_tm_error));
/* Port status */
if (!port_is_started(port_id)) {
- printf(" Port %u not started (error)\n", port_id);
+ fprintf(stderr, " Port %u not started (error)\n", port_id);
return;
}