fprintf(f, "limit %up min %up max %up ",
qopt->limit, qopt->qth_min, qopt->qth_max);
- if (qopt->flags & TC_RED_ECN)
- fprintf(f, "ecn ");
+ tc_red_print_flags(qopt->flags);
if (show_details) {
fprintf(f, "ewma %u ", qopt->Wlog);
print_uint(PRINT_JSON, "max", NULL, qopt->qth_max);
print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
- if (qopt->flags & TC_RED_ECN)
- print_bool(PRINT_ANY, "ecn", "ecn ", true);
- else
- print_bool(PRINT_ANY, "ecn", NULL, false);
- if (qopt->flags & TC_RED_HARDDROP)
- print_bool(PRINT_ANY, "harddrop", "harddrop ", true);
- else
- print_bool(PRINT_ANY, "harddrop", NULL, false);
- if (qopt->flags & TC_RED_ADAPTATIVE)
- print_bool(PRINT_ANY, "adaptive", "adaptive ", true);
- else
- print_bool(PRINT_ANY, "adaptive", NULL, false);
+ tc_red_print_flags(qopt->flags);
+
if (show_details) {
print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt->Wlog);
if (max_P)
sprint_size(qopt_ext->qth_min, b2),
sprint_size(qopt_ext->qth_max, b3),
qopt_ext->max_P / pow(2, 32));
- if (qopt_ext->flags & TC_RED_ECN)
- fprintf(f, "ecn ");
+ tc_red_print_flags(qopt_ext->flags);
if (show_stats) {
fprintf(f, "\n prob_mark %u prob_mark_head %u prob_drop %u",
qopt_ext->stats.prob_mark,
#include <arpa/inet.h>
#include <string.h>
+#include "utils.h"
#include "tc_core.h"
+#include "tc_util.h"
#include "tc_red.h"
/*
sbuf[255] = 31;
return clog;
}
+
+void tc_red_print_flags(__u32 flags)
+{
+ if (flags & TC_RED_ECN)
+ print_bool(PRINT_ANY, "ecn", "ecn ", true);
+ else
+ print_bool(PRINT_ANY, "ecn", NULL, false);
+
+ if (flags & TC_RED_HARDDROP)
+ print_bool(PRINT_ANY, "harddrop", "harddrop ", true);
+ else
+ print_bool(PRINT_ANY, "harddrop", NULL, false);
+
+ if (flags & TC_RED_ADAPTATIVE)
+ print_bool(PRINT_ANY, "adaptive", "adaptive ", true);
+ else
+ print_bool(PRINT_ANY, "adaptive", NULL, false);
+}
int tc_red_eval_ewma(unsigned qmin, unsigned burst, unsigned avpkt);
int tc_red_eval_idle_damping(int wlog, unsigned avpkt, unsigned bandwidth,
__u8 *sbuf);
+void tc_red_print_flags(__u32 flags);
#endif