PRIO(8) Linux PRIO(8) NAME PRIO−Priorityqdisc SYNOPSIS tcqdisc...devdev(parentclassid|root)[handlemajor:]prio[bandsbands][priomapband,band,band...][estimatorintervaltimeconstant] DESCRIPTION ThePRIOqdiscisasimpleclassfulqueueingdisciplinethatcontainsanarbitrarynumberof classesofdifferingpriority.Theclassesaredequeuedinnumericaldescendingorderofpriority. PRIOisaschedulerandneverdelayspackets-itisawork-conservingqdisc,thoughtheqdiscs containedintheclassesmaynotbe. Veryusefulforloweringlatencywhenthereisnoneedforslowingdowntraffic. ALGORITHM Oncreationwith’tcqdiscadd’,afixednumberofbandsiscreated.Eachbandisaclass,although isnotpossibletoaddclasseswith’tcqdiscadd’,thenumberofbandstobecreatedmustinstead bespecifiedonthecommandlineattachingPRIOtoitsroot. Whendequeueing,band0istriedfirstandonlyifitdidnotdeliverapacketdoesPRIOtryband 1,andsoonwards.Maximumreliabilitypacketsshouldthereforegotoband0,minimumdelayto band1andtheresttoband2. AsthePRIOqdiscitselfwillhaveminornumber0,band0isactuallymajor:1,band1ismajor:2, etc.Formajor,substitutethemajornumberassignedtotheqdiscon’tcqdiscadd’withthehandleparameter. CLASSIFICATION ThreemethodsareavailabletoPRIOtodetermineinwhichbandapacketwillbeenqueued. Fromuserspace AprocesswithsufficientprivilegescanencodethedestinationclassdirectlywithSOPRI-ORITY,seetc(7). withatcfilter Atcfilterattachedtotherootqdisccanpointtrafficdirectlytoaclass withthepriomap Basedonthepacketpriority,whichinturnisderivedfromtheTypeofServiceassigned tothepacket. Onlythepriomapisspecifictothisqdisc. QDISCPARAMETERS bandsNumberofbands.Ifchangedfromthedefaultof3,priomapmustbeupdatedaswell. priomap Thepriomapmapsthepriorityofapackettoaclass.Theprioritycaneitherbeset directlyfromuserspace,orbederivedfromtheTypeofServiceofthepacket. Determineshowpacketpriorities,asassignedbythekernel,maptobands.Mapping occursbasedontheTOSoctetofthepacket,whichlookslikethis: 01234567 +---+---+---+---+---+---+---+---+ |||| |PRECEDENCE|TOS|MBZ| iproute2 16December2001 1 PRIO(8) Linux PRIO(8) |||| +---+---+---+---+---+---+---+---+ ThefourTOSbits(the’TOSfield’)aredefinedas: BinaryDecimcalMeaning ----------------------------------------- 10008Minimizedelay(md) 01004Maximizethroughput(mt) 00102Maximizereliability(mr) 00011Minimizemonetarycost(mmc) 00000NormalService Asthereis1bittotherightofthesefourbits,theactualvalueoftheTOSfieldisdouble thevalueoftheTOSbits.Tcpdump-v-vshowsyouthevalueoftheentireTOSfield, notjustthefourbits.Itisthevalueyouseeinthefirstcolumnofthistable: TOSBitsMeansLinuxPriorityBand ------------------------------------------------------------ 0x00NormalService0BestEffort1 0x21MinimizeMonetaryCost1Filler2 0x42MaximizeReliability0BestEffort1 0x63mmc+mr0BestEffort1 0x84MaximizeThroughput2Bulk2 0xa5mmc+mt2Bulk2 0xc6mr+mt2Bulk2 0xe7mmc+mr+mt2Bulk2 0x108MinimizeDelay6Interactive0 0x129mmc+md6Interactive0 0x1410mr+md6Interactive0 0x1611mmc+mr+md6Interactive0 0x1812mt+md4Int.Bulk1 0x1a13mmc+mt+md4Int.Bulk1 0x1c14mr+mt+md4Int.Bulk1 0x1e15mmc+mr+mt+md4Int.Bulk1 ThesecondcolumncontainsthevalueoftherelevantfourTOSbits,followedbytheir translatedmeaning.Forexample,15standsforapacketwantingMinimalMontetary Cost,MaximumReliability,MaximumThroughputANDMinimumDelay. ThefourthcolumnliststhewaytheLinuxkernelinterpretstheTOSbits,byshowingto whichPrioritytheyaremapped. Thelastcolumnshowstheresultofthedefaultpriomap.Onthecommandline,the defaultpriomaplookslikethis: 1,2,2,2,1,2,0,0,1,1,1,1,1,1,1,1 Thismeansthatpriority4,forexample,getsmappedtobandnumber1.Thepriomap alsoallowsyoutolisthigherpriorities(>7)whichdonotcorrespondtoTOSmappings, butwhicharesetbyothermeans. ThistablefromRFC1349(readitformoredetails)explainshowapplicationsmightvery wellsettheirTOSbits: iproute2 16December2001 2 PRIO(8) Linux PRIO(8) TELNET1000(minimizedelay) FTP Control1000(minimizedelay) Data0100(maximizethroughput) TFTP1000(minimizedelay) SMTP Commandphase1000(minimizedelay) DATAphase0100(maximizethroughput) DomainNameService UDPQuery1000(minimizedelay) TCPQuery0000 ZoneTransfer0100(maximizethroughput) NNTP0001(minimizemonetarycost) ICMP Errors0000 Requests0000(mostly) Responses<sameasrequest>(mostly) CLASSES PRIOclassescannotbeconfiguredfurther-theyareautomaticallycreatedwhenthePRIOqdisc isattached.Eachclasshowevercancontainyetafurtherqdisc. BUGS Largeamountsoftrafficinthelowerbandscancausestarvationofhigherbands.Canbepreventedbyattachingashaper(forexample,tc-tbf(8)tothesebandstomakesuretheycannot dominatethelink. AUTHORS AlexeyN.Kuznetsov,<kuznet@ms2.inr.ac.ru>,JHadiSalim<hadi@cyberus.ca>.Thismanpage maintainedbyberthubert<ahu@ds9a.nl> iproute2 16December2001 3