diff options
author | net[shemminger]!shemminger <net[shemminger]!shemminger> | 2004-08-23 20:20:41 +0000 |
---|---|---|
committer | net[shemminger]!shemminger <net[shemminger]!shemminger> | 2004-08-23 20:20:41 +0000 |
commit | d81b135b6f659900c0a51ca1a733c165e49aaaec (patch) | |
tree | 9d7e5a33026b9e16423e9073843c7a658c7baa46 /tc | |
parent | ae02026a766b7a6f6be923b4cb74f0305f375e7a (diff) |
Import patch jamal-p1
(Logical change 1.70)
Diffstat (limited to 'tc')
-rw-r--r-- | tc/f_u32.c | 30 | ||||
-rw-r--r-- | tc/m_action.c | 4 | ||||
-rw-r--r-- | tc/tc_class.c | 4 | ||||
-rw-r--r-- | tc/tc_filter.c | 4 | ||||
-rw-r--r-- | tc/tc_qdisc.c | 5 |
5 files changed, 14 insertions, 33 deletions
@@ -123,8 +123,6 @@ static int pack_key(struct tc_u32_sel *sel, __u32 key, __u32 mask, int off, int 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 @@ static int parse_hashkey(int *argc_p, char ***argv_p, struct tc_u32_sel *sel) 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 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char ** } 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 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char ** return -1; } continue; + } else if (matches(*argv, "police") == 0) { NEXT_ARG(); if (parse_police(&argc, &argv, TCA_U32_POLICE, n)) { @@ -920,6 +911,7 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __ { 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 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __ 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 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __ (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 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __ } } - 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 aa3a3aa0..eb7d0186 100644 --- a/tc/m_action.c +++ b/tc/m_action.c @@ -262,21 +262,17 @@ tc_print_one_action(FILE * f, struct rtattr *arg) 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 0c91f42f..154c2d10 100644 --- a/tc/tc_class.c +++ b/tc/tc_class.c @@ -241,18 +241,14 @@ int print_class(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) 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 2cace200..8f2a0b86 100644 --- a/tc/tc_filter.c +++ b/tc/tc_filter.c @@ -254,18 +254,14 @@ int print_filter(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) 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 c7f22e17..1a244a87 100644 --- a/tc/tc_qdisc.c +++ b/tc/tc_qdisc.c @@ -173,7 +173,6 @@ void print_tcstats(FILE *fp, struct tc_stats *st) 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 @@ int print_qdisc(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) 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"); |