mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-04 21:03:26 +00:00
tc: move RED flag printing to helper
Number of qdiscs use the same set of flags to control shared RED implementation. Add a helper for printing those flags. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
parent
b640e85d2d
commit
33021752cd
@ -188,8 +188,7 @@ static int choke_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
||||
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);
|
||||
|
14
tc/q_red.c
14
tc/q_red.c
@ -189,18 +189,8 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
||||
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)
|
||||
|
@ -235,8 +235,7 @@ static int sfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
||||
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,
|
||||
|
20
tc/tc_red.c
20
tc/tc_red.c
@ -20,7 +20,9 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "tc_core.h"
|
||||
#include "tc_util.h"
|
||||
#include "tc_red.h"
|
||||
|
||||
/*
|
||||
@ -97,3 +99,21 @@ int tc_red_eval_idle_damping(int Wlog, unsigned int avpkt, unsigned int bps, __u
|
||||
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);
|
||||
}
|
||||
|
@ -6,5 +6,6 @@ int tc_red_eval_P(unsigned qmin, unsigned qmax, double prob);
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user