Import patch jamal-p1
(Logical change 1.70)
diff --git a/tc/f_u32.c b/tc/f_u32.c
index 923a68b..d35dafa 100644
--- a/tc/f_u32.c
+++ b/tc/f_u32.c
@@ -123,8 +123,6 @@
return -1;
sel->keys[i].val |= key;
sel->keys[i].mask |= mask;
- sel->keys[i].off = 0;
- sel->keys[i].offmask = 0;
return 0;
}
}
@@ -710,19 +708,10 @@
while (argc > 0) {
if (matches(*argv, "mask") == 0) {
__u32 mask;
- int i = 0;
NEXT_ARG();
if (get_u32(&mask, *argv, 16))
return -1;
sel->hmask = htonl(mask);
- mask = sel->hmask;
- while (!(mask & 1)) {
- i++;
- mask>>=1;
- }
-#ifdef fix_u32_bug
- sel->fshift = i;
-#endif
} else if (matches(*argv, "at") == 0) {
int num;
NEXT_ARG();
@@ -875,6 +864,7 @@
}
strncpy(ind, *argv, sizeof (ind) - 1);
addattr_l(n, MAX_MSG, TCA_U32_INDEV, ind, strlen(ind) + 1);
+
} else if (matches(*argv, "action") == 0) {
NEXT_ARG();
if (parse_action(&argc, &argv, TCA_U32_ACT, n)) {
@@ -882,6 +872,7 @@
return -1;
}
continue;
+
} else if (matches(*argv, "police") == 0) {
NEXT_ARG();
if (parse_police(&argc, &argv, TCA_U32_POLICE, n)) {
@@ -920,6 +911,7 @@
{
struct rtattr *tb[TCA_U32_MAX+1];
struct tc_u32_sel *sel = NULL;
+ struct tc_u32_pcnt *pf = NULL;
if (opt == NULL)
return 0;
@@ -964,10 +956,19 @@
fprintf(f, "link %s ", sprint_u32_handle(*(__u32*)RTA_DATA(tb[TCA_U32_LINK]), b1));
}
+ if (tb[TCA_U32_PCNT]) {
+ if (RTA_PAYLOAD(tb[TCA_U32_PCNT]) < sizeof(*pf)) {
+ fprintf(f, "Broken perf counters \n");
+ return -1;
+ }
+ pf = RTA_DATA(tb[TCA_U32_PCNT]);
+ }
if (sel) {
int i;
struct tc_u32_key *key = sel->keys;
+ if (show_stats && NULL != pf)
+ fprintf(f, " (rule hit %llu success %llu)",pf->rcnt,pf->rhit);
if (sel->nkeys) {
for (i=0; i<sel->nkeys; i++, key++) {
fprintf(f, "\n match %08x/%08x at %s%d",
@@ -975,6 +976,8 @@
(unsigned int)ntohl(key->mask),
key->offmask ? "nexthdr+" : "",
key->off);
+ if (show_stats && NULL != pf)
+ fprintf(f, " (success %lld ) ",pf->kcnts[i]);
}
}
@@ -994,11 +997,6 @@
}
}
- if (show_stats && tb[TCA_U32_PCNT]){
- struct tc_u32_pcnt *p = RTA_DATA(tb[TCA_U32_PCNT]);
- fprintf(f, " (rule hit %llu success %llu)",
- p->rcnt, p->rhit);
- }
if (tb[TCA_U32_POLICE]) {
fprintf(f, "\n");
tc_print_police(f, tb[TCA_U32_POLICE]);
diff --git a/tc/m_action.c b/tc/m_action.c
index aa3a3aa..eb7d018 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -262,21 +262,17 @@
if (show_stats) {
if (tb[TCA_STATS]) {
-#ifndef STOOPID_8BYTE
if (RTA_PAYLOAD(tb[TCA_STATS]) <
sizeof (struct tc_stats))
fprintf(f, "statistics truncated");
else {
-#endif
struct tc_stats st;
memcpy(&st, RTA_DATA(tb[TCA_STATS]),
sizeof (st));
fprintf(f, "\t");
print_tcstats(f, &st);
fprintf(f, "\n");
-#ifndef STOOPID_8BYTE
}
-#endif
}
}
diff --git a/tc/tc_class.c b/tc/tc_class.c
index 0c91f42..154c2d1 100644
--- a/tc/tc_class.c
+++ b/tc/tc_class.c
@@ -241,18 +241,14 @@
fprintf(fp, "\n");
if (show_stats) {
if (tb[TCA_STATS]) {
-#ifndef STOOPID_8BYTE
if (RTA_PAYLOAD(tb[TCA_STATS]) < sizeof(struct tc_stats))
fprintf(fp, "statistics truncated");
else {
-#endif
struct tc_stats st;
memcpy(&st, RTA_DATA(tb[TCA_STATS]), sizeof(st));
print_class_tcstats(fp, &st);
fprintf(fp, "\n");
-#ifndef STOOPID_8BYTE
}
-#endif
}
if (q && tb[TCA_XSTATS]) {
q->print_xstats(q, fp, tb[TCA_XSTATS]);
diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index 2cace20..8f2a0b8 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -254,18 +254,14 @@
if (show_stats) {
if (tb[TCA_STATS]) {
-#ifndef STOOPID_8BYTE
if (RTA_PAYLOAD(tb[TCA_STATS]) < sizeof(struct tc_stats))
fprintf(fp, "statistics truncated");
else {
-#endif
struct tc_stats st;
memcpy(&st, RTA_DATA(tb[TCA_STATS]), sizeof(st));
print_tcstats(fp, &st);
fprintf(fp, "\n");
-#ifndef STOOPID_8BYTE
}
-#endif
}
}
fflush(fp);
diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c
index c7f22e1..1a244a8 100644
--- a/tc/tc_qdisc.c
+++ b/tc/tc_qdisc.c
@@ -173,7 +173,6 @@
fprintf(fp, " Sent %llu bytes %u pkts (dropped %u, overlimits %u ) ",
(unsigned long long)st->bytes, st->packets, st->drops, st->overlimits);
-
if (st->bps || st->pps || st->qlen || st->backlog) {
fprintf(fp, "\n ");
if (st->bps || st->pps) {
@@ -256,19 +255,15 @@
fprintf(fp, "\n");
if (show_stats) {
if (tb[TCA_STATS]) {
-#ifndef STOOPID_8BYTE
if (RTA_PAYLOAD(tb[TCA_STATS]) < sizeof(struct tc_stats))
fprintf(fp, "statistics truncated");
else {
-#endif
struct tc_stats st;
memcpy(&st, RTA_DATA(tb[TCA_STATS]), sizeof(st));
print_tcstats(fp, &st);
fprintf(fp, "\n");
}
-#ifndef STOOPID_8BYTE
}
-#endif
if (q && tb[TCA_XSTATS]) {
q->print_xstats(q, fp, tb[TCA_XSTATS]);
fprintf(fp, "\n");