tc/q_htb.c: remove printing of a deprecated overhead value previously encoded as a part of mpu field
Subsystems (2)
PATCH 1/2 tc/q_htb.c: remove printing of a deprecated overhead value previously encoded as a part of mpu field
Remove printing according to the previously used encoding of mpu and overhead values within the tc_ratespec's mpu field. This encoding is no longer being used as a separate 'overhead' field in the ratespec structure has been introduced.
--- tc/q_htb.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
tc/q_htb.c +4 -7
@@ -273,7 +273,6 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)__u64 rate64, ceil64;SPRINT_BUF (b1);SPRINT_BUF (b2); -SPRINT_BUF (b3);SPRINT_BUF (b4);if (opt ==NULL )
@@ -313,16 +312,14 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)if (linklayer >TC_LINKLAYER_ETHERNET || show_details)fprintf (f,"linklayer %s " ,sprint_linklayer (linklayer, b4));if (show_details) { -fprintf (f,"burst %s/%u mpu %s overhead %s " , +fprintf (f,"burst %s/%u mpu %s " ,sprint_size (buffer, b1),1 <<hopt->rate.cell_log, -sprint_size (hopt->rate.mpu&0xFF , b2), -sprint_size ((hopt->rate.mpu>>8 )&0xFF , b3)); -fprintf (f,"cburst %s/%u mpu %s overhead %s " , +sprint_size (hopt->rate.mpu, b2)); +fprintf (f,"cburst %s/%u mpu %s " ,sprint_size (cbuffer, b1),1 <<hopt->ceil.cell_log, -sprint_size (hopt->ceil.mpu&0xFF , b2), -sprint_size ((hopt->ceil.mpu>>8 )&0xFF , b3)); +sprint_size (hopt->ceil.mpu, b2));fprintf (f,"level %d " , (int )hopt->level); }else {fprintf (f,"burst %s " ,sprint_size (buffer, b1));
Signature · 1 line
2.5.0
Quoted 32 lines · On Sat, 19 Dec 2015 18:25:52 +0300 Dmitrii Shcherbakov <[email protected]>…
Remove printing according to the previously used encoding of mpu and overhead values within the tc_ratespec's mpu field. This encoding is no longer being used as a separate 'overhead' field in the ratespec structure has been introduced.
Signed-off-by Dmitrii Shcherbakov <[email protected]>Acked-by Phil Sutter <[email protected]>--- tc/q_htb.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)tc/q_htb.c +1
-5@@ -273,7 +273,6 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)__u64 rate64, ceil64;SPRINT_BUF (b1);SPRINT_BUF (b2); -SPRINT_BUF (b3);SPRINT_BUF (b4);if (opt ==NULL )@@ -313,16 +312,14 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)if (linklayer >TC_LINKLAYER_ETHERNET || show_details)fprintf (f,"linklayer %s " ,sprint_linklayer (linklayer, b4));if (show_details) { -fprintf (f,"burst %s/%u mpu %s overhead %s " , + fprintf(f, "burst %s/%u mpu %s ", sprint_size(buffer, b1), 1<<hopt->rate.cell_log, -sprint_size (hopt->rate.mpu&0xFF , b2), -sprint_size ((hopt->rate.mpu>>8 )&0xFF , b3)); - fprintf(f, "cburst %s/%u mpu %s overhead %s ",
tc/q_htb.c static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) · line 325
Quoted 10 lines
tc/q_htb.c +3
-2+ sprint_size(hopt->rate.mpu, b2)); +fprintf (f,"cburst %s/%u mpu %s " ,sprint_size (cbuffer, b1),1 <<hopt->ceil.cell_log, -sprint_size (hopt->ceil.mpu&0xFF , b2), - sprint_size((hopt->ceil.mpu>>8)&0xFF, b3)); +sprint_size (hopt->ceil.mpu, b2));fprintf (f,"level %d " , (int )hopt->level); }else {fprintf (f,"burst %s " ,sprint_size (buffer, b1));
Not sure if this a good thing to do. There are people who screenscrape the output of iproute2 commands, and this might break that.
Quoted 5 lines · On Sat, 19 Dec 2015 18:25:52 +0300 Dmitrii Shcherbakov <[email protected]>…
Remove printing according to the previously used encoding of mpu and overhead values within the tc_ratespec's mpu field. This encoding is no longer being used as a separate 'overhead' field in the ratespec structure has been introduced.
Signed-off-by Dmitrii Shcherbakov <[email protected]>Acked-by Phil Sutter <[email protected]>
Both applied.
I had to fix up the commit logs.
Many tools don't like long subject/summary lines, and it is standard practice to wrap text in commit body at 80 characters.
Thanks!
I also noticed that there seems to be no kernel code to set the MPU values.
# latest commit at the time of writing administrator@UX32LN:~/src/linux$ git rev-parse HEAD 64291f7db5bd8150a74ad2036f1037e6a0428df2
Some cscope output below:
0 include/uapi/linux/pkt_sched.h 84 struct tc_ratespec {
A ratespec structure that holds an mpu value:
struct tc_ratespec {
unsigned char cell_log;
__u8 linklayer; /* lower 4 bits */
unsigned short overhead;
short cell_align;
unsigned short mpu;
__u32 rate;
};0 include/net/sch_generic.h psched_l2t_ns 766 static inline u64
psched_l2t_ns(const struct psched_ratecfg *r,
An L2T (Length to Time) conversion function which returns an amount of time in nanoseconds needed to send a packet of a specific size. Here the length is first modified by a manually configured overhead value - could be a good place to round the length up to mpu if it is smaller than mpu:
static inline u64 psched_l2t_ns(const struct psched_ratecfg *r,
unsigned int len)
{
len += r->overhead;
if (unlikely(r->linklayer == TC_LINKLAYER_ATM))
return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift;
return ((u64)len * r->mult) >> r->shift; }
Seems like psched_l2t_ns is used in both htb and tbf and affects the amount of tokens that are going to be consumed by a packet of a certain size:
C symbol: psched_l2t_ns
File Function Line
0 include/net/sch_generic.h psched_l2t_ns 766 static inline u64
psched_l2t_ns(const struct psched_ratecfg *r,
1 net/sched/act_police.c tcf_act_police_locate 221 police
->tcfp_mtu_ptoks = (s64) psched_l2t_ns(&police->peak,
2 net/sched/act_police.c tcf_act_police 289 ptoks -= (s64)
psched_l2t_ns(&police->peak,
3 net/sched/act_police.c tcf_act_police 295 toks -= (s64)psched_l2t_ns(&police->rate, qdisc_pkt_len(skb));
4 net/sched/sch_htb.c htb_accnt_tokens 613 toks -= (s64)psched_l2t_ns(&cl->rate, bytes);
5 net/sched/sch_htb.c htb_accnt_ctokens 626 toks -= (s64)psched_l2t_ns(&cl->ceil, bytes);
6 net/sched/sch_tbf.c tbf_dequeue 249 ptoks -= (s64)psched_l2t_ns(&q->peak, len);
7 net/sched/sch_tbf.c tbf_dequeue 254 toks -= (s64)psched_l2t_ns(&q->rate, len);
8 net/sched/sch_tbf.c tbf_change 351 buffer = psched_l
2t_ns(&rate, max_size);
9 net/sched/sch_tbf.c tbf_change 370 mtu =psched_l2t_ns(&peak, pburst);
Also found a patch (https://patchwork.ozlabs.org/patch/501666/) that was intended to fix setting of mpu values which never got pushed.
Printing definitely deserved a fix but there is some more work to it at the kernel side.
Quoted 18 lines · Stephen Hemminger
Quoted 8 lines · On Sat, 19 Dec 2015 18:25:52 +0300 Dmitrii Shcherbakov <[email protected]>…
Remove printing according to the previously used encoding of mpu and overhead values within the tc_ratespec's mpu field. This encoding is no longer being used as a separate 'overhead' field in the ratespec structure has been introduced.
Signed-off-by Dmitrii Shcherbakov <[email protected]>Acked-by Phil Sutter <[email protected]>Both applied.
I had to fix up the commit logs.
Many tools don't like long subject/summary lines, and it is standard practice
to wrap text in commit body at 80 characters.