![Page 2: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/2.jpg)
Agenda
• 9:30– P4motivation,languageoverview• OpenFlow vsP4• SDNtoday
• ~10:30– P4demos,exampleapplications• Ipv4forwardingswitch• Calculator(run1+1onyourrouter!)• Multi-hoprouteinspection(in-networktelemetry)• Trackingper-flowTCPretransmissions
• Discussions:dataplaneprogrammability@ESnet
04/10/2017 P4deepdive@ESnet- RichardCziva 2
![Page 3: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/3.jpg)
TheroadtoP4P4deepdive
04/10/2017 P4deepdive@ESnet- RichardCziva 3
![Page 4: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/4.jpg)
Software-DefinedNetworking
• Programmablecontrolovernetworks• Physicallyseparatedcontrolplanetheforwardingplane• MostpopularrealizationofSDN’sdata-planeabstractionisOpenFlow• OpenFlow wasborn10yearsago
• Andalothaschanged
04/10/2017 P4deepdive@ESnet- RichardCziva 4
![Page 5: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/5.jpg)
Software-DefinedNetworking
• OpenFlow becamethedefactostandardfornetworkprogramming• OriginallyitwastargetingLANandDCnetworks• LatelytheykeptextendingOpenFlow tosupportnewprotocols(mostlyencapsulation,networkvirtualization)• VxLAN (2010)• STT(StatelessTransportTunnel)(2012)• NSH(2014)• …
04/10/2017 P4deepdive@ESnet- RichardCziva 5
![Page 6: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/6.jpg)
OpenFlow matchfields
04/10/2017 P4deepdive@ESnet- RichardCziva 6
• Matchfieldskeepgrowingandgrowing:hardforvendorstokeepup
Networkoperatorscanhavespecificrequirements!Canweletthemimplementit?
![Page 7: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/7.jpg)
Apartialsolution:BPFmatching
• InsteadoffixedOpenFlow matchfields,whydon’tweuseaBerkeleyPacketFilters (BPF)?• (TheoriginalBPFpaperwaswrittenby StevenMcCanne and VanJacobson in1992whileat LawrenceBerkeleyLaboratory[9][10])
• BPFcanbeusedtodescribeapacketmatchingasandirectedacyclicgraph
04/10/2017 P4deepdive@ESnet- RichardCziva 7
![Page 8: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/8.jpg)
Apartialsolution:BPFmatching
• ABPFprogramwassmallenoughtobeplacestoanOpenFlow packet(OXMfield)• BPFcanbeexecutedonanyplatform(platform-independence)• BPFreliesonsimpleinstructions(load,compare)->easytoimplementonhardware
04/10/2017 P4deepdive@ESnet- RichardCziva 8
![Page 9: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/9.jpg)
Networkdata-planetoday
• TheASICdefineshowcanwehandlepackets• ASICsareallclosed,wecan’textendthemifrequired• Networksaredesignedusingabottom-updesign
04/10/2017 P4deepdive@ESnet- RichardCziva 9
FixedfunctionASIC
SwitchOS
API
driver
![Page 10: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/10.jpg)
Networkingtomorrow
• Wewanttotellthedevicehowtobehave(toptobottomapproach)• Programmablenetworkdevices:• PISA(FlexibleMatch+Action ASICs):IntelFlexpipe,BarefootTofino• NPU:Netronome• CPU:DPDK,eBPF,OpenvSwitch• FPGA:XilinxNetFPGA
• P4definesalanguagetoprogramsomeofthesedevices
04/10/2017 P4deepdive@ESnet- RichardCziva 10
Programmableswitch
SwitchOS
API
driver
![Page 11: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/11.jpg)
Benefitsoftopàbottom approach
• Tonetworkproviders• Eliminating”blackboxes”and“magicbehavior”• Developerscanprogram,testanddebugnetworkdevicesallthewaydown• Customrouting/switchingprotocolscanbekept“in-house”
• Tovendors• Extremelyfastiterationandfeaturerelease• Newbusinessmodelsforsellingsoftwareandhardwareseparate• Vendorscanfixdata-planebugsafterdeviceshavebeendeployed• Softwaredevelopmentpracticesusedineveryphase
04/10/2017 P4deepdive@ESnet- RichardCziva 11
![Page 12: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/12.jpg)
Agenerallanguage:P4
• P4:alanguagedesignedtoallowtoptobottomprogrammability• P4wasproposedatSIGCOMM2013:
Bosshart,Pat,DanDaly,GlenGibb,MartinIzzard,NickMcKeown,JenniferRexford,ColeSchlesingeretal."P4:Programmingprotocol-independentpacketprocessors." ACMSIGCOMMComputerCommunicationReview 44,no.3(2014):87-95.
• P4consortium:over80vendors,manyUniversities,individuals…
04/10/2017 P4deepdive@ESnet- RichardCziva 12
![Page 13: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/13.jpg)
P4vsOpenFlow
04/10/2017 P4deepdive@ESnet- RichardCziva 13
![Page 14: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/14.jpg)
P4inveryhigh-levelP4deepdive
04/10/2017 P4deepdive@ESnet- RichardCziva 14
![Page 15: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/15.jpg)
P4threegoals
1. Protocolindependence• Nonativesupportforanyprotocol• Theprogrammerdescribestheprotocols
2. Targetindependence• P4programsaredesignedtobe implementation-independent• CanbecompiledtoCPUs,NPUs,FPGAs,ASICs,networkprocessors,etc
3. In-fieldre-configurability• Duetotargetandprotocolindependenceandtheabstractlanguage,P4targets(e.g.,ASICs)canchangetheirbehaviorovertheirlifetime
04/10/2017 P4deepdive@ESnet- RichardCziva 15
![Page 16: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/16.jpg)
P4vstraditionalswitches
• InaP4definedswitchthedataplaneisnotfixed,butdefinedbyaP4program• InaP4definedswitchtheAPIbetweenthedataplaneandthecontrolplaneisdefinedbyaP4program
04/10/2017 P4deepdive@ESnet- RichardCziva 16
From:https://p4lang.github.io/p4-spec/docs/P4-16-v1.0.0-spec.html
![Page 17: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/17.jpg)
P4pipeline
• Parser:Parsesrawpacketsfromwireintometadata• Match+Actiontables:operateonmetadata• Deparser:Serializesmetadataintoapacket• Metadatabus:availableintheentirepipeline
04/10/2017 P4deepdive@ESnet- RichardCziva 17
Table1 Table2 Tablen
Deparser
Parser
Metadatabus
packet packet
![Page 18: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/18.jpg)
AnexamplepipelinefromCorsa
04/10/2017 P4deepdive@ESnet- RichardCziva 18
CouldbeexpressedwithP4!
![Page 19: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/19.jpg)
Languageoverview(P4_16)P4deepdive
04/10/2017 P4deepdive@ESnet- RichardCziva 19
![Page 20: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/20.jpg)
Languageversions
• Therearemultipleversionsofthelanguage• Unfortunatelytheversionsarebackwards-incompatible• Andsomethingsonlyworkinformerversionsjustnow
• Iamintroducingthelatest:P4_16• Smallercorelanguagethanpreviousversions(only40keywords)• Thisissupposedtobeastablelanguagedefinition
04/10/2017 P4deepdive@ESnet- RichardCziva 20
From:https://p4lang.github.io/p4-spec/docs/P4-16-v1.0.0-spec.html
![Page 21: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/21.jpg)
Coreabstractions
• Headertypes:definehowyourprotocolheaderslooklike• Parsers:tellthemhowtoparseheaders• Tables:containstateassociatinguser-definedkeyswithactions• Actions:describinghowapacketshouldbemanipulated• Match-Actionunits:createlookupkey,performtablelookup,executeaction• Controlflow:specifiestheorderofapplyingmatch-actionunits• Externobjects:registers,counters,meters,etc• Metadata:datastructuresassociatedwitheachpacket
04/10/2017 P4deepdive@ESnet- RichardCziva 21
![Page 22: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/22.jpg)
Headerdefinitions
• Allowsyou,thedevelopertodescribepacketformatsandnameheaderfields• Fixedvsvariablelengthfieldsarebothpermitted
04/10/2017 P4deepdive@ESnet- RichardCziva 22
header Ethernet_h {bit<48>dstAddr;bit<48>srcAddr;bit<16>etherType;
}
header IPv4_h{bit<4>version;bit<4>ihl;bit<8>diffserv;bit<16>totalLen;bit<16>identification;bit<3>flags;bit<13>fragOffset;bit<8>ttl;bit<8>protocol;bit<16>hdrChecksum;bit<32>srcAddr;bit<32>dstAddr;varbit<320>options;
}
![Page 23: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/23.jpg)
Parser
• Afinitestatemachinewithonestartstateandtwofinalstates
04/10/2017 P4deepdive@ESnet- RichardCziva 23
Start
Ethernet?
TCP UDP
Accept
Reject
IfEthernet
IfTCP
else
else
IfUDP
parserMyParser(){statestart{transitionparse_ethernet;}stateparse_ethernet {
packet.extract(hdr.ethernet);transitionselect(hdr.ethernet.etherType){
TYPE_IPV4:parse_ipv4;default:accept;
}}…}
![Page 24: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/24.jpg)
Tables
• Tablescontainstate(pushedbythecontrolplane)toforwardpackets• Tablesdescribeamatch-actionunit• Packetmatchingcanbedoneeither:• Exactmatching• LongestPrefixMatch(LPM)• Ternarymatching(masking)
• Allpossibleactionshavetobedefinedinadvance
04/10/2017 P4deepdive@ESnet- RichardCziva 24
tableipv4_lpm{reads {
ipv4.dstAddr:lpm;}actions {
forward()}
}
![Page 25: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/25.jpg)
Match-Actionunits
04/10/2017 P4deepdive@ESnet- RichardCziva 25
From:https://p4lang.github.io/p4-spec/docs/P4-16-v1.0.0-spec.html
![Page 26: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/26.jpg)
Actions
• Actionsconsistofcodeandtakeactiondata• Actiondatacomesfromthecontrolplane(e.g.,IPaddresses/portnumbers)
• Specific,loop-freeprimitivescanbeexecutedinanaction• Numberofinstructionsmustbepredictable,sonoloopsorconditionalstatementsallowedhere
04/10/2017 P4deepdive@ESnet- RichardCziva 26
action ipv4_forward(macAddr_t dstAddr,egressSpec_t port){standard_metadata.egress_spec =port;hdr.ethernet.srcAddr =hdr.ethernet.dstAddr;hdr.ethernet.dstAddr =dstAddr;hdr.ipv4.ttl=hdr.ipv4.ttl- 1;
}
![Page 27: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/27.jpg)
Externs
• ExternsarearchitecturespecificconstructswithwelldefinedAPIs• Examples:• Checksumcalculation• Registers• Counters• Meters
04/10/2017 P4deepdive@ESnet- RichardCziva 27
extern Checksum16{Checksum16();//constructorvoid clear();//prepareunitforcomputationvoid update<T>(in Tdata);//adddatatochecksumvoid remove<T>(in Tdata);//removedatafromexistingchecksumbit<16>get();//getthechecksumforthedataaddedsincelastclear
}
extern register<T>{register(bit<32>size);void read(outTresult,inbit<32>index);void write(inbit<32>index,inTvalue);
}
![Page 28: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/28.jpg)
Metadata
1. User-definedmetadata(emptystruct atfirstforeachpacket)• Youcanputhereanythingyouwant• Accessibleeverywhereinthepipeline• Usefule.g.,forstoringthepackethash
2. Intrinsicmetadata- thisisprovidedbythearchitecture• Ingressport,egressportisdefinedhere• Timestampwhenpacketwasqueued,queuedepth• Multicasthash/multicastqueue• Packetpriority,packetcolor• Egressportspecification(e.g.,outputqueue)
04/10/2017 P4deepdive@ESnet- RichardCziva 28
![Page 29: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/29.jpg)
Controlflow
• Stitchingeverythingtogether• Imperativeprogramexpressingthehigh-levellogicandthesequenceformatch-actionunitinvocations
04/10/2017 P4deepdive@ESnet- RichardCziva 29
control ingress(){[tabledefinitionshere][actiondefinitionshere]apply { if (hdr.ipv4.isValid()){ipv4_lpm.apply();
} }
}
V1Switch(ParserImpl(),verifyChecksum(),ingress(),egress(),computeChecksum(),DeparserImpl())main;
![Page 30: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/30.jpg)
P4compiler,toolsP4deepdive
04/10/2017 P4deepdive@ESnet- RichardCziva 30
![Page 31: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/31.jpg)
P4compiler
• TheP4compiler(p4c)produces:1. Dataplaneruntime2. APIformanagingthestateinthedataplane
04/10/2017 P4deepdive@ESnet- RichardCziva 31
![Page 32: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/32.jpg)
P4softwareswitch
• p4lang/p4c-bm:generatesJSONconfigurationforbmv2• p4lang/bmv2:softwareswitchthatunderstandstheJSONconfig• bmv2:behaviormodelversion2
04/10/2017 P4deepdive@ESnet- RichardCziva 32
myprogram.p4 myprogram.json
bmv2-ssload
Compilewithp4c-bm
Dataplane
API
Runtimecommands
![Page 33: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/33.jpg)
RuntimeAPIforsoftwareswitch
• Allowsyoutomanipulatetables,readregisters,counters…
• APIiseasilyusablewiththeprovidedsimple_switch_CLI program
04/10/2017 P4deepdive@ESnet- RichardCziva 33
- table_set_default <tablename><actionname><actionparameters>- table_add <tablename><actionname><matchfields>=><actionparameters>[priority]- table_delete <tablename><entryhandle>
p4@p4d2:~$simple_switch_CLI --thrift-port9090ObtainingJSONfromswitch...DoneControlutilityforruntimeP4tablemanipulationRuntimeCmd:counter_read counter0thisisthedirectcounterfortableipv4_lpmcounter[0]=BmCounterValue(packets=4,bytes=88)
![Page 34: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/34.jpg)
Switchlogs+debugger
• Simpleswitchlogsareusefulenough:
• Thereisalsoagdb likedebugger:• Breakpoint,watchingaheaderfield,printsthevalueofaheaderfield,etc
04/10/2017 P4deepdive@ESnet- RichardCziva 34
p4@p4d2:~$tail-f/home/p4/p4_tutorial/P4D2_2017/exercises/mri/build/logs/s1.log[20:58:45.689][bmv2][D][thread1572][94.0][cxt 0]Pipeline'ingress':start[20:58:45.689][bmv2][D][thread1572][94.0][cxt 0]Pipeline'ingress':end[20:58:45.689][bmv2][D][thread1572][94.0][cxt 0]Egressportis0….[22:28:07.263][bmv2][T][thread1572][166.0][cxt 0]Applyingtable'ipv4_lpm’[22:28:07.263][bmv2][D][thread1572][166.0][cxt 0]Lookingupkey:
*ipv4.dstAddr:0a00020a[22:28:07.263][bmv2][D][thread1572][166.0][cxt 0]Table'ipv4_lpm':hitwithhandle1
![Page 35: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/35.jpg)
P4examplesP4deepdive
04/10/2017 P4deepdive@ESnet- RichardCziva 35
![Page 36: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/36.jpg)
Calculator
• Whosaidanetworkdevicecannotbeusedasacalculator?• Idea:• wesendpacketsdescribinganoperation(e.g.,1+1)• thedeviceperformstheoperationandwritestheresulttothepacket• thedevicesendsthepacketbacktothesenderthatparsestheresult(2)
04/10/2017 P4deepdive@ESnet- RichardCziva 36
H1 P4switch1+1?
2
![Page 37: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/37.jpg)
Asimpleswitch
• BasicIPv4forwardingswitch• Stepbystep:
1. Packetisparsed(Ethernet,IPv4only)2. PacketismatchedusingLPMonIPv4
destinationaddresses3. Egressportisset4. Packet’sEthernetsourceanddestination
isset5. TTL=TTL-16. Checksumrecalculation
• Additional:counters
04/10/2017 P4deepdive@ESnet- RichardCziva 37
h1
h2
h3
s1
s2
s3
![Page 38: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/38.jpg)
Multi-HopRouteInspection(MRI)
• Let’sfindoutwherehasourbeeninthenetwork• WewilluseTCP’soptionsfieldforthedata(parsingastackofheaders)• Everyswitchwillwriteit’sownID(swid)tothepacket• PacketfromH1-->H2willcollectswids[1,2]
04/10/2017 P4deepdive@ESnet- RichardCziva 38
h1
h2
h3
s1
s2
s3
![Page 39: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/39.jpg)
TCPretransmissiontracker
• Goal:IdentifyallflowsthatareexperiencingTCPretransmission1. TrackifwehaveseenthesameTCP
packetbefore(SYNnumber)1. BasedonRTO(min1s),exponentialbackoff
2. TrackSACKflags• BetterwithburstsofpacketsinoneRTO
• ”Controller”:readsthecountersfromthedata-plane
04/10/2017 P4deepdive@ESnet- RichardCziva 39
Client Server
Seq =1
Seq =1Ack =1
RTO
Client Server
Seq =2
Seq =1Ack =1
RTOSeq =3
Ack =1,Sack=3Seq =2
![Page 40: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/40.jpg)
PISA/PSA
• PSA=PortableSwitchArchitecture– WGinP4consortium• PISA =ProtocolIndependentSwitchArchitecture– referencechipdesign• ReferencearchitectureforaP4programmableswitch• Configurableparser,tables,etc.• BarefootTofinoisafullyprogrammablePISA• “World’sfastestandmostprogrammableswitchseriesupto6.5Tbps”
• Actualdevice:Edgecore Wedge100BF-65X:2RU65x100GE,6.5Tbit/s
04/10/2017 P4deepdive@ESnet- RichardCziva 40
![Page 41: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/41.jpg)
Takeaway
• P4advocatesatop-downapproachfornetworkprogramming• Insteadofleavingthedevicestellushowtheyprocesspackets=>wewouldliketotellthemhowtodoit
• P4isjustonestandard,manymoretocome,however:
04/10/2017 P4deepdive@ESnet- RichardCziva 41
Inthenextfewyearsdata-planeprogrammabilitywillbecomecommonplaceandP4playsanimportantroleinit
![Page 42: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/42.jpg)
References
• Figuresandsomedemoshavebeenselected:• P4tutorialslidesatSIGCOMM:https://github.com/p4lang/tutorials/blob/master/SIGCOMM_2016/p4-tutorial-slides.pdf• P4languagedocs:https://p4lang.github.io/p4-spec/docs/P4-16-v1.0.0-spec.html• ExamplesfromGithub:https://github.com/p4lang/tutorials
• P4paper
04/10/2017 P4deepdive@ESnet- RichardCziva 42
![Page 43: P4 deep dive - Netlab€¦ · P4 three goals 1. Protocol independence • No native support for any protocol • The programmer describes the protocols 2. Target independence •](https://reader033.vdocuments.us/reader033/viewer/2022050210/5f5d1372bd51eb41f7327833/html5/thumbnails/43.jpg)
Thankyou
Thankyouforyourattention!
04/10/2017 P4deepdive@ESnet- RichardCziva 43