NET: Accurate packet scheduling for ATM/ADSL (userspace)
Subsystems (2)
PATCH 2/2 NET: Accurate packet scheduling for ATM/ADSL (userspace)
The Linux traffic's control engine inaccurately calculates transmission times for packets sent over ADSL links. For some packet sizes the error rises to over 50%. This occurs because ADSL uses ATM as its link layer transport, and ATM transmits packets in fixed sized 53 byte cells.
This changes the userspace tool iproute2/tc by adding an option to calculate traffic transmission times (rate table) over all ATM links, including ADSL, with perfect accuracy.
A longer presentation of the patch, its rational, what it does and how to use it can be found here:
http://www.stuart.id.au/russell/files/tc/tc-atm/
A earlier version of the patch, and a _detailed_ empirical investigation of its effects can be found here:
http://www.adsl-optimizer.dk/
---
include/linux/pkt_sched.h +3 -2
@@ -77,8 +77,9 @@ struct tc_ratespec {unsigned char cell_log;unsigned char __reserved; -unsigned short feature; -short addend; +unsigned short feature;/* Always 0 in pre-atm patch kernels */ +char cell_align;/* Always 0 in pre-atm patch kernels */ +unsigned char __unused;unsigned short mpu;__u32 rate; };
tc/m_police.c +20 -15
@@ -35,7 +35,7 @@ struct action_util police_action_util =static void explain (void ) {fprintf (stderr,"Usage: ... police rate BPS burst BYTES[/BYTES] [ mtu BYTES[/BYTES] ]\n" ); -fprintf (stderr," [ peakrate BPS ] [ avrate BPS ]\n" ); +fprintf (stderr," [ peakrate BPS ] [ avrate BPS ] [ overhead OVERHEAD ] [ atm ]\n" );fprintf (stderr," [ ACTIONTERM ]\n" );fprintf (stderr,"Old Syntax ACTIONTERM := action <EXCEEDACT>[/NOTEXCEEDACT] \n" );fprintf (stderr,"New Syntax ACTIONTERM := conform-exceed <EXCEEDACT>[/NOTEXCEEDACT] \n" );
@@ -134,7 +134,10 @@ int act_parse_police(struct action_util__u32 ptab[256 ];__u32 avrate =0 ;int presult =0 ; -unsigned buffer=0 , mtu=0 , mpu=0 ; +unsigned buffer=0 , mtu=0 ; +__u8 mpu=0 ; +__s8 overhead=0 ; +int atm=0 ;int Rcell_log=-1 , Pcell_log =-1 ;struct rtattr *tail;
@@ -184,7 +187,7 @@ int act_parse_police(struct action_utilfprintf (stderr,"Double \"mpu\" spec\n" );return -1 ; } -if (get_size (&mpu, *argv)) { +if (get_u8 (&mpu, *argv,10 )) {explain1 ("mpu" );return -1 ; }
@@ -198,6 +201,18 @@ int act_parse_police(struct action_utilexplain1 ("rate" );return -1 ; } + }else if (strcmp (*argv,"overhead" ) ==0 ) { +NEXT_ARG (); +if (p.rate.rate) { +fprintf (stderr,"Double \"overhead\" spec\n" ); +return -1 ; + } +if (get_s8 (&overhead, *argv,10 )) { +explain1 ("overhead" ); +return -1 ; + } + }else if (strcmp (*argv,"atm" ) ==0 ) { + atm =1 ; }else if (strcmp (*argv,"avrate" ) ==0 ) {NEXT_ARG ();if (avrate) {
@@ -264,22 +279,12 @@ int act_parse_police(struct action_util }if (p.rate.rate) { -if ((Rcell_log =tc_calc_rtable (p.rate.rate, rtab, Rcell_log, mtu, mpu)) <0 ) { -fprintf (stderr,"TBF: failed to calculate rate table.\n" ); -return -1 ; - } +tc_calc_ratespec (&p.rate, rtab, p.rate.rate, Rcell_log, mtu, mpu, atm, overhead); p.burst =tc_calc_xmittime (p.rate.rate, buffer); - p.rate.cell_log = Rcell_log; - p.rate.mpu = mpu; } p.mtu = mtu;if (p.peakrate.rate) { -if ((Pcell_log =tc_calc_rtable (p.peakrate.rate, ptab, Pcell_log, mtu, mpu)) <0 ) { -fprintf (stderr,"POLICE: failed to calculate peak rate table.\n" ); -return -1 ; - } - p.peakrate.cell_log = Pcell_log; - p.peakrate.mpu = mpu; +tc_calc_ratespec (&p.peakrate, ptab, p.peakrate.rate, Pcell_log, mtu, mpu, atm, overhead); } tail =NLMSG_TAIL (n);
tc/q_cbq.c +34 -18
109 lines not on this page · raw message
tc/q_htb.c +18 -22
@@ -34,14 +34,14 @@ static void explain(void)" default minor id of class to which unclassified packets are sent {0}\n" " r2q DRR quantums are computed as rate in Bps/r2q {10}\n" " debug string of 16 numbers each 0-3 {0}\n\n" -"... class add ... htb rate R1 [burst B1] [mpu B] [overhead O]\n" +"... class add ... htb rate R1 [burst B1] [mpu B] [overhead O] [atm]\n" " [prio P] [slot S] [pslot PS]\n" " [ceil R2] [cburst B2] [mtu MTU] [quantum Q]\n" " rate rate allocated to this class (class can still borrow)\n" " burst max bytes burst which can be accumulated during idle period {computed}\n" " mpu minimum packet size used in rate computations\n" " overhead per-packet size overhead used in rate computations\n" - +" atm include atm cell tax in rate computations\n" " ceil definite upper class rate (no borrows) {rate}\n" " cburst burst but for ceil {computed}\n" " mtu max packet size we create rate map for {1600}\n"
@@ -107,8 +107,10 @@ static int htb_parse_class_opt(struct qd__u32 rtab[256 ],ctab[256 ];unsigned buffer=0 ,cbuffer=0 ;int cell_log=-1 ,ccell_log =-1 ; -unsigned mtu, mpu; -unsigned char mpu8 =0 , overhead =0 ; +unsigned mtu; +__u8 mpu8=0 ; +__s8 overhead=0 ; +int atm=0 ;struct rtattr *tail;memset (&opt,0 ,sizeof (opt)); mtu =1600 ;/* eth packet len */
@@ -132,9 +134,11 @@ static int htb_parse_class_opt(struct qd } }else if (matches (*argv,"overhead" ) ==0 ) {NEXT_ARG (); -if (get_u8 (&overhead, *argv,10 )) { +if (get_s8 (&overhead, *argv,10 )) {explain1 ("overhead" );return -1 ; } + }else if (matches (*argv,"atm" ) ==0 ) { + atm =1 ; }else if (matches (*argv,"quantum" ) ==0 ) {NEXT_ARG ();if (get_u32 (&opt.quantum, *argv,10 )) {
@@ -206,23 +210,11 @@ static int htb_parse_class_opt(struct qdif (!buffer) buffer = opt.rate.rate /get_hz () + mtu;if (!cbuffer) cbuffer = opt.ceil.rate /get_hz () + mtu; -/* encode overhead and mpu, 8 bits each, into lower 16 bits */ - mpu = (unsigned )mpu8 | (unsigned )overhead <<8 ; - opt.ceil.mpu = mpu; opt.rate.mpu = mpu; - -if ((cell_log =tc_calc_rtable (opt.rate.rate, rtab, cell_log, mtu, mpu)) <0 ) { -fprintf (stderr,"htb: failed to calculate rate table.\n" ); -return -1 ; - } +/* encode overhead and mpu, 8 bits each, into lower 16 bits */ +tc_calc_ratespec (&opt.rate, rtab, opt.rate.rate, cell_log, mtu, mpu8, atm, overhead); +tc_calc_ratespec (&opt.ceil, ctab, opt.ceil.rate, cell_log, mtu, mpu8, atm, overhead); opt.buffer =tc_calc_xmittime (opt.rate.rate, buffer); - opt.rate.cell_log = cell_log; - -if ((ccell_log =tc_calc_rtable (opt.ceil.rate, ctab, cell_log, mtu, mpu)) <0 ) { -fprintf (stderr,"htb: failed to calculate ceil rate table.\n" ); -return -1 ; - } opt.cbuffer =tc_calc_xmittime (opt.ceil.rate, cbuffer); - opt.ceil.cell_log = ccell_log; tail =NLMSG_TAIL (n);addattr_l (n,1024 ,TCA_OPTIONS ,NULL ,0 );
@@ -267,12 +259,16 @@ static int htb_print_opt(struct qdisc_utsprint_size (buffer, b1),1 <<hopt->rate.cell_log,sprint_size (hopt->rate.mpu&0xFF , b2), - sprint_size((hopt->rate.mpu>>8)&0xFF, b3)); + sprint_size((__s8)(hopt->rate.mpu>>8), b3)); +if (hopt->rate.feature &0x0001 ) +fprintf (f,"atm " );fprintf (f,"cburst %s/%u mpu %s overhead %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 ((__s8)(hopt->ceil.mpu>>8 ), b3)); +if (hopt->ceil.feature &0x0001 ) +fprintf (f,"atm " );fprintf (f,"level %d " , (int )hopt->level); }else {fprintf (f,"burst %s " ,sprint_size (buffer, b1));
tc/q_tbf.c +34 -19
98 lines not on this page · raw message
tc/tc_core.c +104 -10
143 lines not on this page · raw message
tc/tc_core.h +3 -1
@@ -7,7 +7,9 @@long tc_core_usec2tick (long usec);long tc_core_tick2usec (long tick);unsigned tc_calc_xmittime (unsigned rate,unsigned size); -int tc_calc_rtable (unsigned bps,__u32 *rtab,int cell_log,unsigned mtu,unsigned mpu); +void tc_calc_ratespec (struct tc_ratespec * spec,__u32 * rtab,unsigned bps, +int cell_log,unsigned mtu,unsigned char mpu,int atm_cell_tax, +char overhead);int tc_setup_estimator (unsigned A ,unsigned time_const,struct tc_estimator *est);
Ar Mer, 2006-06-14 am 11:40 +0200, ysgrifennodd Jesper Dangaard Brouer:
Quoted 2 lines
option to calculate traffic transmission times (rate table) over all ATM links, including ADSL, with perfect accuracy.
<Pedant>
Only if the lowest level is encoded in a time linear manner. If you are using NRZ, NRZI etc at the bottom level then you may still be out...
</Pedant>
The other problem I see with this code is it is very tightly tied to ATM cell sizes, not to solving the generic question of packetisation. I'm not sure if that matters but for modern processors I'm also sceptical that the clever computation is actually any faster than just doing the maths, especially if something cache intensive is also running.
Alan
Quoted 6 lines · Alan Cox
Ar Mer, 2006-06-14 am 11:40 +0200, ysgrifennodd Jesper Dangaard Brouer:
Quoted 2 lines
option to calculate traffic transmission times (rate table) over all ATM links, including ADSL, with perfect accuracy.
The other problem I see with this code is it is very tightly tied to ATM cell sizes, not to solving the generic question of packetisation.
Well, we did consider to do so, but we though that it would be harder to get it into the kernel.
Actually thats the reason for the defines:
#define ATM_CELL_SIZE 53 #define ATM_CELL_PAYLOAD 48
Changing these should should make it possible to adapt to any other SAR (Segment And Reasembly) link layer.
Quoted 4 lines
I'm
not sure if that matters but for modern processors I'm also sceptical that the clever computation is actually any faster than just doing the maths, especially if something cache intensive is also running.
I guess you are refering to the rate table lookup system, that is based upon array lookups. I do think that the rate table array lookup system has been outdated, as memory access is the bottleneck on modern CPUs. But its design by Alexey for a long time ago where the hardware restrictions were different. It also avoids floting point operations in the kernel.
Thanks for your comments.
Signature · 6 lines
Med venlig hilsen / Best regards Jesper Brouer ComX Networks A/S Linux Network developer Cand. Scient Datalog / MSc. Author of http://adsl-optimizer.dk
Quoted 2 lines · Alan Cox
The other problem I see with this code is it is very tightly tied to ATM cell sizes, not to solving the generic question of packetisation.
Others have made this point also. I can't speak for Jesper, but I did consider making it generic. The issue was that doing so would add more code, but I don't personally know of any real world situation that would use the generic solution. I didn't fancy the thought of arguing on these lists for code that no one would actually use.
If someone could put up their hand and say "Hey, I need this," then expanding the patch to accommodate them would be a pleasure. I like generic code too.
Russell
Quoted 11 lines · Russell Stuart
Quoted 2 lines · Alan Cox
The other problem I see with this code is it is very tightly tied to ATM cell sizes, not to solving the generic question of packetisation.
Others have made this point also. I can't speak for Jesper, but I did consider making it generic. The issue was that doing so would add more code, but I don't personally know of any real world situation that would use the generic solution. I didn't fancy the thought of arguing on these lists for code that no one would actually use.
Quoted 4 lines
If someone could put up their hand and say "Hey, I need this," then expanding the patch to accommodate them would be a pleasure. I like generic code too.
It is probably doable by just looking at netdevice->type and figuring the link layer technology. Totally in user space and building the compensated for tables there before telling the kernel (advantage is no kernel changes and therefore it would work with older kernels as well).
cheers,
jamal
Quoted 7 lines · jamal
Quoted 6 lines · Russell Stuart
Quoted 2 lines · Alan Cox
The other problem I see with this code is it is very tightly tied to ATM cell sizes, not to solving the generic question of packetisation.
Others have made this point also. I can't speak for Jesper, but I did consider making it generic.
I also have considered to make it generic, but choose to make my patch as non-intrusive as possible to the kernel (and try to handle as much in userspace as possible).
Actually I do think that the kernel patch part is very generic. The patch simply allow us to align the rate table/array.
With the kernel patch in place, we can work on the userspace TC program to support more and more types of exotic link layer modeling.
Quoted 5 lines
Quoted 5 lines
The issue was that
doing so would add more code, but I don't personally know of any real world situation that would use the generic solution. I didn't fancy the thought of arguing on these lists for code that no one would actually use.
;-)
Quoted 9 lines
Quoted 4 lines
If someone could put up their hand and say "Hey, I need this," then expanding the patch to accommodate them would be a pleasure. I like generic code too.
It is probably doable by just looking at
netdevice->typeand figuring the link layer technology. Totally in user space and building the compensated for tables there before telling the kernel (advantage is no kernel changes and therefore it would work with older kernels as well).
I think you have got the setup all wrong.
The linux middlebox/router has two ethernet interfaces, one of the ethernet interfaces is connected to the ADSL modem. Thus, the linux ethernet card cannot determine that it is connected to an ADSL line.
The patch is the solution to the classical problem people have when tryng to configure traffic control on an ADSL link?
Q: The packet scheduling does not work all the time?
A: Try to decrease to bandwidth.
The issue here is, that ATM does not have fixed overhead (due to alignment and padding). This means that a fixed reduction of the bandwidth is not the solution. We could reduce the bandwidth to the worst-case overhead, which is 62%, I do not think that is a good solution...
With the patch, you can now simply configure HTB to use the rate that was specified by the ISP.
Please read chapter 6 ("Achieving Queue Control") page 55-65, where I demonstrate that the naive approach of reducing bandwidth does not work, when the packet distribution change on the link.
http://www.adsl-optimizer.dk/thesis/
Cheers,
Jesper Brouer
--
-------------------------------------------------------------------
MSc. Master of Computer Science
Dept. of Computer Science, University of Copenhagen Author of http://www.adsl-optimizer.dk
-------------------------------------------------------------------
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
took off lartc off the list because it doesnt allow me to post and i refuse to subscribe.
Quoted 7 lines · Jesper Dangaard Brouer
Quoted 4 lines · jamal
It is probably doable by just looking at
netdevice->typeand figuring the link layer technology. Totally in user space and building the compensated for tables there before telling the kernel (advantage is no kernel changes and therefore it would work with older kernels as well).
Quoted 6 lines
I think you have got the setup all wrong.
The linux middlebox/router has two ethernet interfaces, one of the ethernet interfaces is connected to the ADSL modem. Thus, the linux ethernet card cannot determine that it is connected to an ADSL line.
Actually you may be making my point for me.
Heres the standard setup as i understand it(at least in north america, I know Europeans love their ATM with a little gravy on top):
|Linux| --ethernet-- |Modem| --DSL-- |DSLAM| --ATM-- |BRAS|
What this means is that Linux computes based on ethernet headers. Somewhere downstream ATM (refer to above) comes in and that causes mismatch in what Linux expects to be the bandwidth and what your service provider who doesnt account for the ATM overhead when they sell you "1.5Mbps".
Reminds me of hard disk vendors who define 1K to be 1000 to show how large their drives are.
Yes, Linux cant tell if your service provider is lying to you.
Quoted 4 lines
The patch is the solution to the classical problem people have when tryng to configure traffic control on an ADSL link?
Quoted 9 lines
Q: The packet scheduling does not work all the time?
A: Try to decrease to bandwidth.The issue here is, that ATM does not have fixed overhead (due to alignment and padding). This means that a fixed reduction of the bandwidth is not the solution. We could reduce the bandwidth to the worst-case overhead, which is 62%, I do not think that is a good solution...
I dont see it as wrong to be honest with you. Your mileage may vary.
Quoted 3 lines
With the patch, you can now simply configure HTB to use the rate that was specified by the ISP.
Dont have time to read your doc and dont get me wrong, there is a "quark" practical problem: As practical as the hard disk manufacturer who claims that they have 11G drive when it is 10G. It needs to be resolved - but not in an intrusive way in my opinion.
cheers,
jamal
Quoted 4 lines · jamal
Heres the standard setup as i understand
it(at least in north america, I know Europeans love their ATM with a little gravy on top):
Quoted 8 lines
|Linux| --ethernet-- |Modem| --DSL-- |DSLAM| --ATM-- |BRAS|
What this means is that Linux computes based on ethernet headers. Somewhere downstream ATM (refer to above) comes in and that causes mismatch in what Linux expects to be the bandwidth and what your service provider who doesnt account for the ATM overhead when they sell you "1.5Mbps".
Actually in the PPPoE case Linux doesn't know about ethernet headers either, since shaping is usually done on the PPP device. But that doesn't really matter since the ethernet link is not the bottleneck - although it does add some delay for packetization.
Quoted 1 line
Yes, Linux cant tell if your service provider is lying to you.
I wouldn't call it lying as long as they don't say "1.5mbps IP layer throughput". Ethernet doesn't provide 100mbit IP layer throughput either, and with minimum sized IP packets its actually well below that.
Quoted 7 lines
Quoted 7 lines
The patch is the solution to the classical problem people have when tryng to configure traffic control on an ADSL link?
Q: The packet scheduling does not work all the time?
A: Try to decrease to bandwidth.
Quoted 7 lines
Quoted 5 lines
The issue here is, that ATM does not have fixed overhead (due to alignment and padding). This means that a fixed reduction of the bandwidth is not the solution. We could reduce the bandwidth to the worst-case overhead, which is 62%, I do not think that is a good solution...
I dont see it as wrong to be honest with you. Your mileage may vary.
Its wasteful, and it can be avoided.
Quoted 4 lines
Dont have time to read your doc and dont get me wrong, there is a "quark" practical problem: As practical as the hard disk manufacturer who claims that they have 11G drive when it is 10G. It needs to be resolved - but not in an intrusive way in my opinion.
Not sure what a "quark" problem is .. but I think you're focusing too much on the aspect of "somebody is lying, not our fault". This is a real problem for any medium that adds link-layer headers. ATM is not even very special, the only thing special about it is that it has multiple "steps". But maybe I'm misunderstanding you, it has happened before :)
A non intrusive way is prefered of course, but I can't really see one if you want more than just a special-case solution that only covers qdiscs using rate-tables and even ignores inner qdiscs. HFSC and SFQ for example both need to calculate the wire length at runtime.
Handling all qdiscs would mean adding a pointer to a mapping table to struct net_device and using something like "skb_wire_len(skb, dev)" instead of skb->len in the queueing layer. That of course doesn't mean that we can't still provide pre-adjusted ratetables for qdiscs that use them.
Quoted 1 line · Patrick McHardy
jamal wrote:
[..]
Quoted 4 lines
Actually in the PPPoE case Linux doesn't know about ethernet headers either, since shaping is usually done on the PPP device. But that doesn't really matter since the ethernet link is not the bottleneck - although it does add some delay for packetization.
good point. But one could argue that is within linux (local) as opposed to something downstream at the ISP i.e. i have knowledge of it and i could do clever things. The other is: I have to know that the ISP is using pigeons as the link layer downstream and compensate for it.
The issue is really is whether Linux should be interested in the throughput it is told about or the goodput (also known as effective throughput) the service provider offers. Two different issues by definition.
Quoted 4 lines
Quoted 1 line
Yes, Linux cant tell if your service provider is lying to you.
I wouldn't call it lying as long as they don't say "1.5mbps IP layer throughput".
It is a scam for sure.
By definition of what throughput is - you are telling the truth; just not the whole truth. Most users think in terms of goodput and not throughput.
i.e you are not telling the whole truth by not saying "it is 1.5Mbps ATM throughput". Tpyically not an issue until somebody finds that by leaving out "ATM" you meant throughput and not goodput.
Quoted 4 lines
Ethernet doesn't provide 100mbit IP layer
throughput either, and with minimum sized IP packets its actually well below that.
OTOH, nobody has ethernet MTUs of 64 bytes.
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
The issue here is, that ATM does not have fixed overhead (due to alignment and padding). This means that a fixed reduction of the bandwidth is not the solution. We could reduce the bandwidth to the worst-case overhead, which is 62%, I do not think that is a good solution...
I dont see it as wrong to be honest with you. Your mileage may vary.
Its wasteful, and it can be avoided.
If it can be avoided by being generic and without being intrusive, then by all means.
Quoted 7 lines
Quoted 4 lines
Dont have time to read your doc and dont get me wrong, there is a "quark" practical problem: As practical as the hard disk manufacturer who claims that they have 11G drive when it is 10G. It needs to be resolved - but not in an intrusive way in my opinion.
Not sure what a "quark" problem is .. but I think you're focusing too much on the aspect of "somebody is lying, not our fault".
No no - that is not my intent; sorry if it comes out that way. I am saying there is a practical "problem". The problem being someone is equating throughput to effective throughput (also know as goodput).
To be academic and pedantic: The schedulers should be focusing on throughput and not goodput.
Look at it from another angle related to the nature of the link layer used:
If i buy a 1.5 Mbps 802.11JHS (such a link layer technology doesnt exist, but assume for the sake of arguement it does) from a wireless service provider, ethernet headers etc - but in this case the link is so bad (because of the link layer technology) i have to retransmit so much that 0.5 Mbps is wasted on retransmits, the question becomes:
1)Do i fix the scheduler to compensate for this link layer retransmit? or
2)Do i find some other creative way to tell the scheduler that without making any changes to it that my ftp (despite the retransmits) should only chew 100Kbps.?
I am saying that #2 is the choice to go with hence my assertion earlier, it should be fine to tell the scheduler all it has is 1Mbps and nobody gets hurt. #1 if i could do it with minimal intrusion and still get to use it when i have 802.11g.
Not sure i made sense.
Quoted 5 lines
This is a real problem for any medium that adds link-layer headers. ATM is not even very special, the only thing special about it is that it has multiple "steps". But maybe I'm misunderstanding you, it has happened before :)
I am not sure if i am making more sense now ;->
Quoted 6 lines
A non intrusive way is prefered of course, but I can't really see one if you want more than just a special-case solution that only covers qdiscs using rate-tables and even ignores inner qdiscs. HFSC and SFQ for example both need to calculate the wire length at runtime.
Agreed. That would be equivalent to #1 above.
Quoted 3 lines
Handling all qdiscs would mean adding a pointer to a mapping table to struct
net_deviceand using something like "skb_wire_len(skb, dev)" instead ofskb->lenin the queueing layer.
That does seem sensible and simpler. I would suspect then that you will do this one time with something like
ip dev add compensate_header 100 bytes
Quoted 4 lines
That of course doesn't
mean that we can't still provide pre-adjusted ratetables for qdiscs that use them.
But what would the point be then if you can compensate as you did above?
Anyways, I have to go and meet The Man and i feel like i have hijacked netdev this morning. So ttl.
cheers,
jamal
Quoted 13 lines · jamal
Quoted 4 lines · Patrick McHardy
Actually in the PPPoE case Linux doesn't know about ethernet headers either, since shaping is usually done on the PPP device. But that doesn't really matter since the ethernet link is not the bottleneck - although it does add some delay for packetization.
good point. But one could argue that is within linux (local) as opposed to something downstream at the ISP i.e. i have knowledge of it and i could do clever things. The other is: I have to know that the ISP is using pigeons as the link layer downstream and compensate for it.
Quoted 4 lines
The issue is really is whether Linux should be interested in the throughput it is told about or the goodput (also known as effective throughput) the service provider offers. Two different issues by definition.
In the case of PPPoE non-work-conserving qdiscs are already used to manage a link that is non-local with knowledge of the its bandwidth, contrary to a local link that would be best managed in work-conserving mode. And I think for better accuracy it is necessary to manage effective throughput, especially if you're interested in guaranteed delays.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Yes, Linux cant tell if your service provider is lying to you.
I wouldn't call it lying as long as they don't say "1.5mbps IP layer throughput".
Quoted 7 lines
It is a scam for sure.
By definition of what throughput is - you are telling the truth; just not the whole truth. Most users think in terms of goodput and not throughput.
i.e you are not telling the whole truth by not saying "it is 1.5Mbps ATM throughput". Tpyically not an issue until somebody finds that by leaving out "ATM" you meant throughput and not goodput.
I think that point can be used to argue in favour of that Linux should be able to manage effective throughput :)
Quoted 6 lines
Quoted 3 lines
Ethernet doesn't provide 100mbit IP layer
throughput either, and with minimum sized IP packets its actually well below that.OTOH, nobody has ethernet MTUs of 64 bytes.
Sure, but I might now want my HFSC class with guaranteed delay of 140us to be distrurbed by someone sending small packets, that need more time on the wire than HFSC thinks.
Quoted 15 lines
To be academic and pedantic: The schedulers should be focusing on throughput and not goodput.
Look at it from another angle related to the nature of the link layer used:
If i buy a 1.5 Mbps 802.11JHS (such a link layer technology doesnt exist, but assume for the sake of arguement it does) from a wireless service provider, ethernet headers etc - but in this case the link is so bad (because of the link layer technology) i have to retransmit so much that 0.5 Mbps is wasted on retransmits, the question becomes:
1)Do i fix the scheduler to compensate for this link layer retransmit? or
2)Do i find some other creative way to tell the scheduler that without making any changes to it that my ftp (despite the retransmits) should only chew 100Kbps.?
Quoted 6 lines
I am saying that #2 is the choice to go with hence my assertion earlier, it should be fine to tell the scheduler all it has is 1Mbps and nobody gets hurt. #1 if i could do it with minimal intrusion and still get to use it when i have 802.11g.
Not sure i made sense.
HFSC is actually capable of handling this quite well. If you use it in work-conserving mode (and the card doesn't do (much) internal queueing) it will get clocked by successful transmissions. Using link-sharing classes you can define proportions for use of available bandwidth, possibly with upper limits. No hacks required :)
Anyway, this again goes more in the direction of handling link speed changes.
Quoted 10 lines
Quoted 6 lines
A non intrusive way is prefered of course, but I can't really see one if you want more than just a special-case solution that only covers qdiscs using rate-tables and even ignores inner qdiscs. HFSC and SFQ for example both need to calculate the wire length at runtime.
Agreed. That would be equivalent to #1 above.
Quoted 8 lines
Quoted 3 lines
Handling all qdiscs would mean adding a pointer to a mapping table to struct
net_deviceand using something like "skb_wire_len(skb, dev)" instead ofskb->lenin the queueing layer.That does seem sensible and simpler. I would suspect then that you will do this one time with something like
ip dev addcompensate_header100 bytes
Something like that, but its a bit more complicated. For ATM we need some mapping:
[0-48] -> 53
[49-96] -> 106
...
for Ethernet we need:
[0-60] -> 64
[60-n] -> n + 4
We could do something like this (feel free to imagine nicer names):
ATM:
table = {
.step = 53,
.map = {
[0..48] = 53,
[49..96] = 106,
...
}
};Requiring a table of size 32 for typical MTUs.
Ethernet:
table = {
.step = 60,
.map = {
[0..60] = 60,
[...] = 0,
},
.fixed_overhead = 4,
};static inline unsigned intskb_wire_len(struct sk_buff *skb, struct net_device *dev)
{
unsigned int idx, len;
if (dev->lengthtable == NULL)
return skb->len;
idx = skb->len / dev->lengthtable->step;
len = dev->lengthtable->map[idx];
return dev->lengthtable->fixed_overhead + len ? len : skb->len;
}Unforunately I can't think of a way to handle the ATM case without a division .. or iteration.
Quoted 7 lines
Quoted 4 lines
That of course doesn't
mean that we can't still provide pre-adjusted ratetables for qdiscs that use them.But what would the point be then if you can compensate as you did above?
It doesn't need runtime divisions :)
Quoted 10 lines · Patrick McHardy
Quoted 4 lines · jamal
The issue is really is whether Linux should be interested in the throughput it is told about or the goodput (also known as effective throughput) the service provider offers. Two different issues by definition.
In the case of PPPoE non-work-conserving qdiscs are already used to manage a link that is non-local with knowledge of the its bandwidth,
I think that is a different issue though- you are managing a point-to-point link then you will be working under the assumption of throughput not goodput.
If you had knowledge of the goodput you should use that for a working assumption; i think in practise that approach is valuable. My arguement is against trying to make complex changes to compensate the scheduler for such changes. Therefore i am not feeling sorry for the poor guy who has to go and tell their PPP device "bandwith is only 1Mbps" when their ISP is claiming it is 2Mbps i.e
The ADSL case i have seen thus far is you trying manage something because a BRAS 3-4 hops down the path uses ATM. To use my earlier example the arguement is no different than saying 3-4 hops downlink there is a wireless link which is 20% lossy. Armed with knowledge like that you can tell something to the scheduler to resolve thing. The daemon in user space for example could be sending bandwidth measuring probes and telling the kernel of the new goodput.
Quoted 5 lines
contrary to a local link that would be best managed in work-conserving mode. And I think for better accuracy it is necessary to manage effective throughput, especially if you're interested in guaranteed delays.
Indeed - but "fixing" the scheduler to achieve such management is not the first choice (would be fine if it is generic and non-intrusive)
Quoted 15 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Yes, Linux cant tell if your service provider is lying to you.
I wouldn't call it lying as long as they don't say "1.5mbps IP layer throughput".
Quoted 7 lines
It is a scam for sure.
By definition of what throughput is - you are telling the truth; just not the whole truth. Most users think in terms of goodput and not throughput.
i.e you are not telling the whole truth by not saying "it is 1.5Mbps ATM throughput". Tpyically not an issue until somebody finds that by leaving out "ATM" you meant throughput and not goodput.
Quoted 3 lines
I think that point can be used to argue in favour of that Linux should be able to manage effective throughput :)
I think you have convinced me this is valuable I even suggest probes above to discover goodput;-). I hope i have convinced you how rude it would be to make extensive changes to compensate for goodput;->
Quoted 5 lines
Quoted 5 lines
I am saying that #2 is the choice to go with hence my assertion earlier, it should be fine to tell the scheduler all it has is 1Mbps and nobody gets hurt. #1 if i could do it with minimal intrusion and still get to use it when i have 802.11g.
Quoted 8 lines
Quoted 1 line
Not sure i made sense.
HFSC is actually capable of handling this quite well. If you use it in work-conserving mode (and the card doesn't do (much) internal queueing) it will get clocked by successful transmissions. Using link-sharing classes you can define proportions for use of available bandwidth, possibly with upper limits. No hacks required :)
HFSC sounds very interesting - I should go and study it a little more. My understanding is though that it is a bit of a CPU pig, true?
Quoted 3 lines
Anyway, this again goes more in the direction of handling link speed changes.
The more we discuss this, the more i think they are the same thing ;->
Quoted 8 lines
Quoted 1 line
ip dev add
compensate_header100 bytesSomething like that, but its a bit more complicated. For ATM we need some mapping:
[0-48] -> 53
[49-96] -> 106
...
Quoted 4 lines
for Ethernet we need:
[0-60] -> 64
[60-n] -> n + 4
an upper bound check against MTU would be reasonable.
Quoted 2 lines
We could do something like this (feel free to imagine nicer names):
The name should reflect that the table exists to "compensate for goodput".
Quoted 35 lines
ATM:
table = { .step = 53, .map = { [0..48] = 53, [49..96] = 106, ... } };Requiring a table of size 32 for typical MTUs.
Ethernet:
table = { .step = 60, .map = { [0..60] = 60, [...] = 0, }, .fixed_overhead = 4, };static inline unsigned int
skb_wire_len(struct sk_buff *skb, struct net_device *dev){ unsigned int idx, len; if (dev->lengthtable == NULL) return skb->len; idx = skb->len / dev->lengthtable->step; len = dev->lengthtable->map[idx]; return dev->lengthtable->fixed_overhead + len ? len : skb->len; }
Quoted 3 lines
Unforunately I can't think of a way to handle the ATM case without a division .. or iteration.
I am not thinking straight right now but it does not sound like a big change to me i.e within reason. Note, it may be valuable to think of this as related to the speed changing daemon as i stated earlier. Only in this case it is "static" discovery of link layer goodput/throughput vs some other way to dynamically discover things.
cheers,
jamal
Quoted 11 lines · jamal
Quoted 7 lines · Patrick McHardy
[..]
contrary to a local link that would be best managed in work-conserving mode. And I think for better accuracy it is necessary to manage effective throughput, especially if you're interested in guaranteed delays.
Quoted 2 lines
Indeed - but "fixing" the scheduler to achieve such management is not the first choice (would be fine if it is generic and non-intrusive)
I have a patch that introduces "sizetables" similar to ratetables and performs the mapping once and stores the calculated size in the cb. The schedulers take the size from the cb. Its not very large and only has minimum overhead. I got distracted during testing by inaccuracies in the 100mbit range with small packets caused by the clock source resolution, so I've added a ktime() clocksource and am currently busy auditing for integer overflows caused by the increased clock rate. I'll clean up the patch once I'm done with that and post it.
Quoted 9 lines
Quoted 5 lines
[..]
I think that point can be used to argue in favour of that Linux should be able to manage effective throughput :)
I think you have convinced me this is valuable I even suggest probes above to discover goodput;-). I hope i have convinced you how rude it would be to make extensive changes to compensate for goodput;->
Sure :) So far I haven't been able to measure any improvement by accounting for link layer overhead, but probably because my test scenario was chosen badly (very small overhead, large speed) and the differences were lost in the noise.
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
I am saying that #2 is the choice to go with hence my assertion earlier, it should be fine to tell the scheduler all it has is 1Mbps and nobody gets hurt. #1 if i could do it with minimal intrusion and still get to use it when i have 802.11g.
Quoted 8 lines
Quoted 1 line
Not sure i made sense.
HFSC is actually capable of handling this quite well. If you use it in work-conserving mode (and the card doesn't do (much) internal queueing) it will get clocked by successful transmissions. Using link-sharing classes you can define proportions for use of available bandwidth, possibly with upper limits. No hacks required :)
Quoted 2 lines
HFSC sounds very interesting - I should go and study it a little more. My understanding is though that it is a bit of a CPU pig, true?
It does more calculations at runtime than token-bucket based schedulers, but it does perform comparable to HTB with a large number of classes, in which case the constant overhead is probably not visible anymore because much more time is spent searching, walking lists and trees and so on. I didn't do any comparisons of constant costs.
Quoted 6 lines
Quoted 3 lines
Anyway, this again goes more in the direction of handling link speed changes.
The more we discuss this, the more i think they are the same thing ;->
Not really. Link speed changes can be expressed by constant factors that apply to bandwidth and delay (bandwidth *= f, delay /= f). Link layer overhead usually can't be expressed this way.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
ip dev add
compensate_header100 bytes[...]
Unforunately I can't think of a way to handle the ATM case without a division .. or iteration.
I am not thinking straight right now but it does not sound like a big change to me i.e within reason.
I also got rid of the division ..
Quoted 4 lines
Note, it may be valuable to think of
this as related to the speed changing daemon as i stated earlier. Only in this case it is "static" discovery of link layer goodput/throughput vs some other way to dynamically discover things.
I still think these are two quite different things. Link speed changes also can't be handled very well by scaling packet sizes since TBF-based qdiscs have configured maxima for the packet sizes they can handle.