STAB(8) Linux STAB(8) NAME tc−stab−Genericsizetablemanipulations SYNOPSIS tcqdiscadd...stab [mtuBYTES][tsizeSLOTS] [mpuBYTES][overheadBYTES] [linklayer{adsl|atm|ethernet}]... OPTIONS ForthedescriptionofBYTES−pleaserefertotheUNITSsectionoftc(8). mtu maximumpacketsizewecreatesizetablefor,assumed2048ifnotspecifiedexplicitly tsize requiredtablesize,assumed512ifnotspecifiedexplicitly mpu minimumpacketsizeusedincomputations overhead per−packetsizeoverhead(canbenegative)usedincomputations linklayer requiredlinklayerspecification. DESCRIPTION Sizetablesallowmanipulationofpacketsizes,asseenbythewholeschedulerframework(of course,theactualpacketsizeremainsthesame).Adjustedpacketsizeiscalculatedonlyonce− whenaqdiscenqueuesthepacket.Initialrootenqueueinitializesittotherealpacket’ssize. Eachqdisccanuseadifferentsizetable,buttheadjustedsizeisstoredinanareasharedbywhole qdischierarchyattachedtotheinterface.Theeffectisthatifyouhavesuchasetup,thelastqdisc withastabinachain"wins".Forexample,considerHFSCwithsimplepfifoattachedtooneof itsleafclasses.Ifthatpfifoqdischasstabdefined,itwilloverridelengthscalculatedduring HFSC’senqueue;andinturn,wheneverHFSCtriestodequeueapacket,itwilluseapotentially invalidsizeinitscalculations.Normalsetupswillusuallyincludestabdefinedonlyonrootqdisc, butfurtheroverridinggivesextraflexibilityforlessusualsetups. Theinitialsizetableiscalculatedbytctoolusingmtuandtsizeparameters.Thealgorithmsets eachslot’ssizetothesmallestpowerof2value,sothewholemtuiscoveredbythesizetable. Neithertsize,normtuhavetobepowerof2value,sothesizetablewillusuallysupportmore thanisrequiredbymtu. Forexample,withmtu=1500andtsize=128,atablewith128slotswillbecreated,whereslot 0willcorrespondtosizes0−16,slot1to17−32,...,slot127to2033−2048.Sizesassignedto eachslotdependonlinklayerparameter. Stabcalculationisalsosafeforanunusualcase,whenasizeassignedtoaslotwouldbelarger than2ˆ 16−1(youwilllosetheaccuracythough). Duringthekernelpartofpacketsizeadjustment,overheadwillbeaddedtooriginalsize,and thenslotwillbecalculated.Ifthesizewouldcauseoverflow,morethan1slotwillbeusedtoget thefinalsize.Thisofcoursewillaffectaccuracy,butit’sonlyaguardagainstunusualsituations. Currentlytherearetwomethodsofcreatingvaluesstoredinthesizetable−ethernetandatm iproute2 31October2011 1 STAB(8) Linux STAB(8) (adsl): ethernet Thisisbasically1−1mapping,sofollowingourexamplefromabove(disregardingmpufora moment)slot0wouldhave8,slot1wouldhave16andsoon,uptoslot127with2048.Note, thatmpu>0mustbespecified,andslotsthatwouldgetlessthanspecifiedbympuwillget mpuinstead.Ifyoudon’tspecifympu,thesizetablewillnotbecreatedatall(itwouldn’t makeanydifference),althoughanyoverheadvaluewillberespectedduringcalculations. atm,adsl ATMlinklayerconsistsof53bytecells,whereeachofthemprovides48bytesforpayload. Alsoallthecellsmustbefullyutilized,thusthelastoneispaddedif/asnecessary. Whenthesizetableiscalculated,adjustedsizethatfitsproperlyintolowestamountofcells isassignedtoaslot.Forexample,a100bytelongpacketrequiresthree48−bytepayloads,so thefinalsizewouldrequire3ATMcells−159bytes. ForATMsizetables,16bytessizedslotsareperfectlyenough.Thedefaultvaluesofmtuand tsizecreate4bytessizedslots. TYPICALOVERHEADS Thefollowingvaluesaretypicalfordifferentadslscenarios(basedon[1]and[2]): LLCbased: PPPoA−14(PPP−2,ATM−12) PPPoE−40+(PPPoE−8,ATM−18,ethernet14,possiblyFCS−4+padding) Bridged−32(ATM−18,ethernet14,possiblyFCS−4+padding) IPoA−16(ATM−16) VCMuxbased: PPPoA−10(PPP−2,ATM−8) PPPoE−32+(PPPoE−8,ATM−10,ethernet14,possiblyFCS−4+padding) Bridged−24+(ATM−10,ethernet14,possiblyFCS−4+padding) IPoA−8(ATM−8) Thereareafewimportantthingsregardingtheaboveoverheads: • IPoAinLLCcaserequiresSNAP,insteadofLLC−NLPID(seerfc2684)−thisisthereason whyitactuallytakesmorespacethanPPPoA. • Inrarecases,FCSmightbepreservedonprotocolsthatincludeEthernetframes(Bridged andPPPoE).Insuchsituation,anyEthernetspecificpaddingguaranteeing64byteslong framesizehastobeincludedaswell(seeRFC2684).Intheotherwords,italsoguarantees thatanypacketyousendwilltakeminimum2atmcells.Youshouldsetmpuaccordinglyfor that. • Whenthesizetableisconsulted,andyou’reshapingtrafficforthesakeofanother modem/router,anEthernetheader(withoutpadding)willalreadybeaddedtoinitial packet’slength.Youshouldcompensateforthatbysubtracting14fromtheaboveoverheads inthiscase.Ifyou’reshapingdirectlyontherouter(forexample,withspeedtouchusb modem)usingpppdaemon,you’reusingrawipinterfacewithoutunderlyinglayer2,sonothingwillbeadded. Formorethoroughexplanations,pleasesee[1]and[2]. ETHERNETCARDSCONSIDERATIONS It’softenforgottenthatmodernnetworkcards(evencheaponesondesktopmotherboards) and/ortheirdriversoftensupportdifferentoffloadingmechanisms.Inthecontextoftrafficshaping,’tso’and’gso’mightcauseundesirableeffects,duetomassiveTCPsegmentsbeingconsidered iproute2 31October2011 2 STAB(8) Linux STAB(8) duringtrafficshaping(includingstabcalculations).Forslowuplinkinterfaces,it’sgoodtouse ethtooltoturnoffoffloadingfeatures. SEEALSO tc(8),tc−hfsc(7),tc−hfsc(8), [1]http://ace−host.stuart.id.au/russell/files/tc/tc−atm/ [2]http://www.faqs.org/rfcs/rfc2684.html Pleasedirectbugreportsandpatchesto:<net...@vger.kernel.org> AUTHOR ManpagecreatedbyMichalSoltys(sol...@ziu.info) iproute2 31October2011 3