Commit 3e92ff52 authored by Jesper Dangaard Brouer's avatar Jesper Dangaard Brouer Committed by Stephen Hemminger

linklayer interface between kernel and tc/userspace

This iproute2 tc patch is connected to the kernel
 - commit 8a8e3d84b17 (net_sched: restore "linklayer atm" handling)

The rate table calculated by tc, have gotten replaced in the kernel
and is no-longer used for lookups.

This happened in kernel release v3.8 caused by kernel
 - commit 56b765b79 ("htb: improved accuracy at high rates").
This change unfortunately caused breakage of tc overhead and
linklayer parameters.

 Kernel overhead handling got fixed in kernel v3.10 by
 - commit 01cb71d2d47 (net_sched: restore "overhead xxx" handling)

 Kernel linklayer handling got fixed in kernel v3.11 by
 - commit 8a8e3d84b17 (net_sched: restore "linklayer atm" handling)

The linklayer fix introduced a struct change, that allow the linklayer
attribute to be transferred between tc and kernel. This patch make use
of this linklayer attribute.

The linklayer setting is transfer to the kernel.  And linklayer
setting received from the kernel is printed with a prefixed
"linklayer" when listing current configuration.  The default
TC_LINKLAYER_ETHERNET is only printed in detailed output mode.
Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
parent 3c61c01a
...@@ -322,9 +322,11 @@ int ...@@ -322,9 +322,11 @@ int
print_police(struct action_util *a, FILE *f, struct rtattr *arg) print_police(struct action_util *a, FILE *f, struct rtattr *arg)
{ {
SPRINT_BUF(b1); SPRINT_BUF(b1);
SPRINT_BUF(b2);
struct tc_police *p; struct tc_police *p;
struct rtattr *tb[TCA_POLICE_MAX+1]; struct rtattr *tb[TCA_POLICE_MAX+1];
unsigned buffer; unsigned buffer;
unsigned int linklayer;
if (arg == NULL) if (arg == NULL)
return 0; return 0;
...@@ -360,6 +362,9 @@ print_police(struct action_util *a, FILE *f, struct rtattr *arg) ...@@ -360,6 +362,9 @@ print_police(struct action_util *a, FILE *f, struct rtattr *arg)
} else } else
fprintf(f, " "); fprintf(f, " ");
fprintf(f, "overhead %ub ", p->rate.overhead); fprintf(f, "overhead %ub ", p->rate.overhead);
linklayer = (p->rate.linklayer & TC_LINKLAYER_MASK);
if (linklayer > TC_LINKLAYER_ETHERNET || show_details)
fprintf(f, "linklayer %s ", sprint_linklayer(linklayer, b2));
fprintf(f, "\nref %d bind %d\n",p->refcnt, p->bindcnt); fprintf(f, "\nref %d bind %d\n",p->refcnt, p->bindcnt);
return 0; return 0;
......
...@@ -442,7 +442,9 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ...@@ -442,7 +442,9 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
struct tc_cbq_wrropt *wrr = NULL; struct tc_cbq_wrropt *wrr = NULL;
struct tc_cbq_fopt *fopt = NULL; struct tc_cbq_fopt *fopt = NULL;
struct tc_cbq_ovl *ovl = NULL; struct tc_cbq_ovl *ovl = NULL;
unsigned int linklayer;
SPRINT_BUF(b1); SPRINT_BUF(b1);
SPRINT_BUF(b2);
if (opt == NULL) if (opt == NULL)
return 0; return 0;
...@@ -486,6 +488,9 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ...@@ -486,6 +488,9 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
char buf[64]; char buf[64];
print_rate(buf, sizeof(buf), r->rate); print_rate(buf, sizeof(buf), r->rate);
fprintf(f, "rate %s ", buf); fprintf(f, "rate %s ", buf);
linklayer = (r->linklayer & TC_LINKLAYER_MASK);
if (linklayer > TC_LINKLAYER_ETHERNET || show_details)
fprintf(f, "linklayer %s ", sprint_linklayer(linklayer, b2));
if (show_details) { if (show_details) {
fprintf(f, "cell %ub ", 1<<r->cell_log); fprintf(f, "cell %ub ", 1<<r->cell_log);
if (r->mpu) if (r->mpu)
......
...@@ -244,9 +244,11 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ...@@ -244,9 +244,11 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
struct tc_htb_opt *hopt; struct tc_htb_opt *hopt;
struct tc_htb_glob *gopt; struct tc_htb_glob *gopt;
double buffer,cbuffer; double buffer,cbuffer;
unsigned int linklayer;
SPRINT_BUF(b1); SPRINT_BUF(b1);
SPRINT_BUF(b2); SPRINT_BUF(b2);
SPRINT_BUF(b3); SPRINT_BUF(b3);
SPRINT_BUF(b4);
if (opt == NULL) if (opt == NULL)
return 0; return 0;
...@@ -268,6 +270,9 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ...@@ -268,6 +270,9 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
buffer = tc_calc_xmitsize(hopt->rate.rate, hopt->buffer); buffer = tc_calc_xmitsize(hopt->rate.rate, hopt->buffer);
fprintf(f, "ceil %s ", sprint_rate(hopt->ceil.rate, b1)); fprintf(f, "ceil %s ", sprint_rate(hopt->ceil.rate, b1));
cbuffer = tc_calc_xmitsize(hopt->ceil.rate, hopt->cbuffer); cbuffer = tc_calc_xmitsize(hopt->ceil.rate, hopt->cbuffer);
linklayer = (hopt->rate.linklayer & TC_LINKLAYER_MASK);
if (linklayer > TC_LINKLAYER_ETHERNET || show_details)
fprintf(f, "linklayer %s ", sprint_linklayer(linklayer, b4));
if (show_details) { if (show_details) {
fprintf(f, "burst %s/%u mpu %s overhead %s ", fprintf(f, "burst %s/%u mpu %s overhead %s ",
sprint_size(buffer, b1), sprint_size(buffer, b1),
......
...@@ -239,10 +239,12 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ...@@ -239,10 +239,12 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
{ {
struct rtattr *tb[TCA_TBF_PTAB+1]; struct rtattr *tb[TCA_TBF_PTAB+1];
struct tc_tbf_qopt *qopt; struct tc_tbf_qopt *qopt;
unsigned int linklayer;
double buffer, mtu; double buffer, mtu;
double latency; double latency;
SPRINT_BUF(b1); SPRINT_BUF(b1);
SPRINT_BUF(b2); SPRINT_BUF(b2);
SPRINT_BUF(b3);
if (opt == NULL) if (opt == NULL)
return 0; return 0;
...@@ -294,6 +296,9 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ...@@ -294,6 +296,9 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
if (qopt->rate.overhead) { if (qopt->rate.overhead) {
fprintf(f, "overhead %d", qopt->rate.overhead); fprintf(f, "overhead %d", qopt->rate.overhead);
} }
linklayer = (qopt->rate.linklayer & TC_LINKLAYER_MASK);
if (linklayer > TC_LINKLAYER_ETHERNET || show_details)
fprintf(f, "linklayer %s ", sprint_linklayer(linklayer, b3));
return 0; return 0;
} }
......
...@@ -102,6 +102,21 @@ static unsigned tc_adjust_size(unsigned sz, unsigned mpu, enum link_layer linkla ...@@ -102,6 +102,21 @@ static unsigned tc_adjust_size(unsigned sz, unsigned mpu, enum link_layer linkla
} }
} }
/* Notice, the rate table calculated here, have gotten replaced in the
* kernel and is no-longer used for lookups.
*
* This happened in kernel release v3.8 caused by kernel
* - commit 56b765b79 ("htb: improved accuracy at high rates").
* This change unfortunately caused breakage of tc overhead and
* linklayer parameters.
*
* Kernel overhead handling got fixed in kernel v3.10 by
* - commit 01cb71d2d47 (net_sched: restore "overhead xxx" handling)
*
* Kernel linklayer handling got fixed in kernel v3.11 by
* - commit 8a8e3d84b17 (net_sched: restore "linklayer atm" handling)
*/
/* /*
rtab[pkt_len>>cell_log] = pkt_xmit_time rtab[pkt_len>>cell_log] = pkt_xmit_time
*/ */
...@@ -131,6 +146,7 @@ int tc_calc_rtable(struct tc_ratespec *r, __u32 *rtab, ...@@ -131,6 +146,7 @@ int tc_calc_rtable(struct tc_ratespec *r, __u32 *rtab,
r->cell_align=-1; // Due to the sz calc r->cell_align=-1; // Due to the sz calc
r->cell_log=cell_log; r->cell_log=cell_log;
r->linklayer = (linklayer & TC_LINKLAYER_MASK);
return cell_log; return cell_log;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment