#if 0
-#define DPRINTF(format,args...) fprintf(stderr,format,##args)
+#define DPRINTF(format, args...) fprintf(stderr, format, ##args)
#else
-#define DPRINTF(format,args...)
+#define DPRINTF(format, args...)
#endif
static void explain(void)
opt.def_DP = MAX_DPs;
while (argc > 0) {
- DPRINTF(stderr,"init_gred: invoked with %s\n",*argv);
+ DPRINTF(stderr, "init_gred: invoked with %s\n", *argv);
if (strcmp(*argv, "vqs") == 0 ||
strcmp(*argv, "DPs") == 0) {
NEXT_ARG();
fprintf(stderr, "Illegal \"vqs\"\n");
return -1;
} else if (opt.DPs > MAX_DPs) {
- fprintf(stderr, "GRED: only %u VQs are "
- "currently supported\n", MAX_DPs);
+ fprintf(stderr, "GRED: only %u VQs are currently supported\n",
+ MAX_DPs);
return -1;
}
} else if (strcmp(*argv, "default") == 0) {
if (opt.DPs == 0) {
- fprintf(stderr, "\"default\" must be defined "
- "after \"vqs\"\n");
+ fprintf(stderr, "\"default\" must be defined after \"vqs\"\n");
return -1;
}
NEXT_ARG();
fprintf(stderr, "Illegal \"default\"\n");
return -1;
} else if (opt.def_DP >= opt.DPs) {
- fprintf(stderr, "\"default\" must be less than "
- "\"vqs\"\n");
+ fprintf(stderr, "\"default\" must be less than \"vqs\"\n");
return -1;
}
} else if (strcmp(*argv, "grio") == 0) {
}
if (!opt.DPs || opt.def_DP == MAX_DPs) {
- fprintf(stderr, "Illegal gred setup parameters \n");
+ fprintf(stderr, "Illegal gred setup parameters\n");
return -1;
}
- DPRINTF("TC_GRED: sending DPs=%u def_DP=%u\n",opt.DPs,opt.def_DP);
- n->nlmsg_flags|=NLM_F_CREATE;
+ DPRINTF("TC_GRED: sending DPs=%u def_DP=%u\n", opt.DPs, opt.def_DP);
+ n->nlmsg_flags |= NLM_F_CREATE;
tail = NLMSG_TAIL(n);
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
addattr_l(n, 1024, TCA_GRED_DPS, &opt, sizeof(struct tc_gred_sopt));
*/
static int gred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
{
- int ok=0;
+ int ok = 0;
struct tc_gred_qopt opt = { 0 };
- unsigned burst = 0;
- unsigned avpkt = 0;
+ unsigned int burst = 0;
+ unsigned int avpkt = 0;
double probability = 0.02;
- unsigned rate = 0;
+ unsigned int rate = 0;
int parm;
__u8 sbuf[256];
struct rtattr *tail;
fprintf(stderr, "Illegal \"vq\"\n");
return -1;
} else if (opt.DP >= MAX_DPs) {
- fprintf(stderr, "GRED: only %u VQs are "
- "currently supported\n", MAX_DPs);
+ fprintf(stderr, "GRED: only %u VQs are currently supported\n",
+ MAX_DPs);
return -1;
} /* need a better error check */
ok++;
ok++;
} else if (strcmp(*argv, "prio") == 0) {
NEXT_ARG();
- opt.prio=strtol(*argv, (char **)NULL, 10);
+ opt.prio = strtol(*argv, (char **)NULL, 10);
/* some error check here */
ok++;
} else if (strcmp(*argv, "bandwidth") == 0) {
}
if (opt.DP == MAX_DPs || !opt.limit || !opt.qth_min || !opt.qth_max ||
!avpkt) {
- fprintf(stderr, "Required parameter (vq, limit, min, max, "
- "avpkt) is missing\n");
+ fprintf(stderr, "Required parameter (vq, limit, min, max, avpkt) is missing\n");
return -1;
}
if (!burst) {
return -1;
}
if (parm >= 10)
- fprintf(stderr, "GRED: WARNING. Burst %u seems to be too "
- "large.\n", burst);
+ fprintf(stderr, "GRED: WARNING. Burst %u seems to be too large.\n",
+ burst);
opt.Wlog = parm;
if ((parm = tc_red_eval_P(opt.qth_min, opt.qth_max, probability)) < 0) {
fprintf(stderr, "GRED: failed to calculate probability.\n");
opt.Plog = parm;
if ((parm = tc_red_eval_idle_damping(opt.Wlog, avpkt, rate, sbuf)) < 0)
{
- fprintf(stderr, "GRED: failed to calculate idle damping "
- "table.\n");
+ fprintf(stderr, "GRED: failed to calculate idle damping table.\n");
return -1;
}
opt.Scell_log = parm;
struct tc_gred_qopt *qopt;
__u32 *max_p = NULL;
__u32 *limit = NULL;
- unsigned i;
+ unsigned int i;
+
SPRINT_BUF(b1);
SPRINT_BUF(b2);
SPRINT_BUF(b3);
qopt = RTA_DATA(tb[TCA_GRED_PARMS]);
if (RTA_PAYLOAD(tb[TCA_GRED_DPS]) < sizeof(*sopt) ||
RTA_PAYLOAD(tb[TCA_GRED_PARMS]) < sizeof(*qopt)*MAX_DPs) {
- fprintf(f,"\n GRED received message smaller than expected\n");
+ fprintf(f, "\n GRED received message smaller than expected\n");
return -1;
}
fprintf(f, "limit %s ",
sprint_size(*limit, b1));
- for (i=0;i<MAX_DPs;i++, qopt++) {
+ for (i = 0; i < MAX_DPs; i++, qopt++) {
if (qopt->DP >= MAX_DPs) continue;
fprintf(f, "\n vq %u prio %hhu limit %s min %s max %s ",
qopt->DP,