Upgrade to Pro — share decks privately, control downloads, hide ads and more …

#31 “P4: Programming Protocol-Independent Packe...

#31 “P4: Programming Protocol-Independent Packet Processors”

cafenero_777

June 19, 2023
Tweet

More Decks by cafenero_777

Other Decks in Technology

Transcript

  1. Agenda •ର৅࿦จ •֓ཁͱಡ΋͏ͱͨ͠ཧ༝ 1. INTRODUCTION 2. ABSTRACT FORWARDING MODEL 3.

    A PROGRAMMING LANGUAGE 4. P4 LANGUAGE BY EXAMPLE 5. COMPILING A P4 PROGRAM 6. CONCLUSION 2
  2. ର৅࿦จ •P4: Programming Protocol-Independent Packet Processors • Pat Bosshart†, Dan

    Daly*, Glen Gibb†, Martin Izzard†, Nick McKeown‡, Jennifer Rexford**, Cole Schlesinger**, Dan Talayco†, Amin Vahdat¶, George Varghese§, David Walker** • †Barefoot Networks, *Intel, ‡Stanford University, **Princeton University, ¶Google, §Microsoft Research • ACM SIGCOM ’14 • https://dl.acm.org/doi/abs/10.1145/2656877.2656890 3
  3. ֓ཁͱಡ΋͏ͱͨ͠ཧ༝ •֓ཁ • SDN/OpenFlow 2.0ͱͯ͠ͷఏҊ • Recon fi gurability, Protocolඇґଘ,

    Targetඇґଘͳઃܭ •ಡ΋͏ͱͨ͠ཧ༝ • P4ͷݪయ • P4͕ಈ͘HW͕ͪΒ΄Βग़͖ͯͨ • ΞϦόόࣄྫͰڵຯ͕༙͍ͨ 4 https://p4.org/
  4. P4ରԠNICʁʂ NVIDIA DOCA (Data-Center-Infrastructure-on-a-Chip Architecture) Intel IPU (Infrastructure Processing Unit)

    https://youtu.be/qtxsw8Y0C8Y?t=538 https://xtech.nikkei.com/atcl/nxt/news/18/08892/ 2020/10/06 2021/08/19 6
  5. 1. INTRODUCTION •SDN: Software-De fi ned Networking • Data-planeͱControl-planeͷ෼཭ͯ͠(OpenFlowͷΑ͏ͳ)ڞ௨I/FΛར༻ •

    ࢓༷֦ுʹ௥ैͰ͖Δॊೈੑͷ͋Δmatch/actionϝΧχζϜ͕΄͍͠ •ΠϚυΩͷNW ASIC • Tbpsग़ͤΔ͕ϓϩάϥϛϯά͸༰қͰ͸ͳ͍ • ϓϩτίϧඇґଘͷߴϨϕϧݴޠ͕ཉ͘͠ͳΔɻྫɿӈਤ •P4ઃܭͷΰʔϧ • Recon fi gurabilityɿύέοτͷύʔεͱॲཧΛ࠶ઃఆ͍ͤͨ͞ • ϓϩτίϧඇґଘɿϔομநग़ͱɺͦΕʹ߹Θͤͨmatch/actionॲཧ • λʔήοτඇґଘɿߴڃݴޠͰॻ͍ͯɺͲͷεΠονͰ΋ಈ͔ͤΔΑ͏ʹ͍ͨ͠ 7
  6. 2. ABSTRACT FORWARDING MODEL •ϑΥϫʔσΟϯάϞσϧ • ϓϩάϥϚϒϧͳύʔαʔ • ฒྻͳmatch/action •

    ϓϦϛςΟϒͳaction •૝ఆ༻్: SW/RT/LB, ASIC/NPU/FPGA/SW con fi gure:
 parser/match/actionͷॲཧͷܾఆ
 ʢϓϩάϥϜͦͷ΋ͷʣ population:
 entry/table/policyͷ௥Ճɾ࡟আʢઃఆʣ ύέοτ୯ҐͰͷॲཧ͸Ͱ͖ͳ͍ 8
  7. 3. A PROGRAMMING LANGUAGE •P4ݴޠͷઃܭͷಛ௃ • ༷ʑͳݴޠɾ΍Γํ͕͋Δ • طଘྫɿClick (C++ͰϞδϡʔϧ࣮૷)

    • CPUલఏͷͨΊɺHWͳmatch/action͕ఆٛ͠ʹ͍͘ • ฒྻ࣮૷͕Ͱ͖ͳ͍ • Table Dependency Graphs (TDGs)ʹ஫໨͢Δ • ֤ϔομॲཧʹґଘؔ܎͕͋ΓɺฒྻԽͰ͖ͳ͍Մೳੑ༗Γ • ʢී௨ͷϓϩάϥϚ͸ʣΞϧΰϦζϜΛஞ໋࣍ྩͰॻ͍ͯ͠·͍͕ͪ • ໋ྩܕݴޠͰॻ͍ͯɺίϯύΠϥ͕TDGʹม׵͠ґଘղੳΛͯ͠ɺλʔήοτʹϚοϐϯά͢Δ 9
  8. 4. P4 LANGUAGE BY EXAMPLE (1/7) ४උฤ •૝ఆ՝୊ɿedge/coreߏ੒ɺL2 table͕ංେԽͨ͠ͷͰcoreͷෛՙΛͲ͏ʹ͔͍ͨ͠ •

    mTagϓϩτίϧΛ࡞ͬͯΈΔ • ֊૚తϧʔςΟϯά(PortLand)΍ϥϕϧసૹ(MPLS)ͬΆ͍΋ͷ • 32bit (4byte)ϔομͰૹ৴ݩϧʔτ΍ѼઌࣝผࢠΛදݱ͠ɺcoreͰ͸MACΞυϨεͷ୅ΘΓʹmTagΛ࢖͏ ToR2 L2seg A L2seg B L2seg B L2seg C L2seg͕ංେԽʂ Core ToR1 ToR3 L2seg C L2seg A ToR2 L2seg A L2seg B L2seg B L2seg C Core ToR1 ToR3 L2seg C L2seg A mTag: “1->3”Λ෇༩ mTagͷΈΛݟͯɺ3ʹసૹ pureͳL2ߏ੒ mTagΛ༻͍ͨL2ෛՙܰݮߏ੒ ྫ୊Πϝʔδ 10
  9. 4. P4 LANGUAGE BY EXAMPLE (2/7) P4ίϯηϓτ •P4ίϯηϓτ • Header:

    Ұ࿈ͷϑΟʔϧυͷॱংɾαΠζ • Parser: ༗ޮͳϔομͷಛఆ • Table: match͢ΔϑΟʔϧυͱactionΛࢦఆ • Action: (tableʹґଘͤ͞)ϓϩτίϧґଘ͠ͳ͍ • Control Programs: match/actionͷॱংΛܾΊΔ 11 ஫ɿຊ෺ͷP4ݴޠͱ͸ҧ͏఺ʹ஫ҙ
  10. 4. P4 LANGUAGE BY EXAMPLE (3/7) Header •Header: Ұ࿈ͷϑΟʔϧυͷॱংɾαΠζ •coreͷ2૚ͷҐஔ(1/2)ͱ޲͖(up/down)ΛϔομͰఆٛ

    ethernetͱvlanϔομͷఆٛ 12 ToR2 ToR1 ToR3 up1 down1 down2 up2 https://ja.wikipedia.org/wiki/IEEE_802.1Q Core tier1 Core tier2 Core tire1 Core tier2
  11. 4. P4 LANGUAGE BY EXAMPLE (4/7) Parser •Parser: ༗ޮͳϔομͷಛఆ •

    ϔομΛ૸ࠪͯ͠ϑΟʔϧυΛநग़͠ɺ
 ϑΟʔϧυ஋ʹԠͯ͡ҧ͏ParserͰॲཧ • ϔομ͔Βϔομ΁ભҠʢstate machineʣ • start͔Β໌ࣔతͳstop΍unhandled case·Ͱܧଓ 13
  12. 4. P4 LANGUAGE BY EXAMPLE (5/7) Table • Table: match͢ΔϑΟʔϧυͱactionΛࢦఆ

    (ྫ: mTag) • readsଐੑ: match৚݅Λఆٛ • L2 dstͱvlan͸exact match • actions: ࣮ࡍʹύέοτ΁ͷద༻ॲཧ • add_mTag • max_sizeଐੑ: ςʔϒϧΤϯτϦ਺ 14
  13. 4. P4 LANGUAGE BY EXAMPLE (6/7) Action •primitiveͳΞΫγϣϯͷίϨΫγϣϯͰෳࡶͳΞΫγϣϯΛ࣮ݱ •ฒྻ࣮ߦ͕લఏ •primitiveྫ

    • add_header(): ಛఆϔομͷ༗ޮԽ • remove_header(): ϔομͷ࡟আ (pop) • set_ fi eld(): ಛఆϑΟʔϧυΛηοτ • copy_ fi eld(): ͋ΔϑΟʔϧυ஋ΛผͷϑΟʔϧυʹίϐʔ • increment() : ϑΟʔϧυ஋ͷ૿Ճorݮগ • checksum(): csumܭࢉʢIPv4 checksumͳͲʣ 15
  14. 4. P4 LANGUAGE BY EXAMPLE (7/7) The Control Program •edgeͰͷड৴࣌ͷ੍ޚͷྲྀΕɿӈਤ

    • source_check: core઀ଓϙʔτ͔Β͔ • local_switching: ࣗ਎ͷL2഑Լʹ͍Δ͔ • mTag_table: ͍ͳ͚Ε͹mTagΛ෇͚Δ • egress_check: C-planeʹѼઌෆ໌Λ௨஌ͳͲ 16
  15. 5. COMPILING A P4 PROGRAM (1/2) ཁ݅ͱ֓ཁ •ίϯύΠϥཁ݅ • Parsersͷੜ੒

    • fi xed parser: parserهड़͕Ұக͢Δ͔Λ֬ೝ͢Δ͚ͩ • programable parser: parserهड़Λparsing state machineʹม׵ • Control Programsͷੜ੒ 1. ϑϩϯτΤϯυ • ςʔϒϧґଘؔ܎ʢϓϩτίϧɾϨΠϠʔґଘؔ܎ʣͷղੳͱґଘղܾɺฒྻॲཧԽ 2. όοΫΤϯυ • targetݻ༗ͷಛఆϦιʔεʢSW, NPU΍M/A pipelineͳͲʣʹϚοϐϯά͠con fi gurationੜ੒ 17
  16. 5. COMPILING A P4 PROGRAM (2/2) ྫɿmTagΛ֤targetʹίϯύΠϧ͢Δ •Software SW: •

    parser/tableΛ׬શʹ࠶ݱͰ͖Δɻάϥϑϊʔυ͔Β௚઀tableʹmappingͰ͖Δɻ • table size΍matchछผ΋ࣗ༝ʹ࢖͑Δ •HW w/ RAM/TCAM: • edgeͰ͸RAMͰਖ਼֬ͳhash match, coreͰ͸TCAMΛ༻͍ͯసૹ •HW w/ parallel table: σʔλͷґଘੑ͔Βฒྻor௚ྻͰ഑ஔ • mTagΛ෇͚Δॴ·Ͱ͸ฒྻॲཧͰ͖Δ •HW w/ action at the end of pipeline • தؒεςʔδͰϝμσʔλΛੜ੒ͯ͠ɺ࠷ޙʹ࢖͏ɻmTag͕௥Ճ͞Ε͔ͨɺͳͲɻ •HW w/ a few tables: • ଟ਺ͷtableΛগ਺ͷ෺ཧtableʢϝϞϦʣʹϚοϐϯάɻlocal switchingͱmTagͷ2ͭΛ1ͭͷςʔϒϧʹ߹੒͢Δ 18
  17. 6. CONCLUSION •աڈͷSDN: C-planeΛ࢖͍ɺAPI (OpenFlow)Λ࢖࣮ͬͯݱ • fi xed functionͳεΠον͕ର৅ •Next

    SDN: ΑΓॊೈͳύέοτॲཧͷ࣮ݱ΁ • parser/match/actionΛࣗ༝ʹϓϩάϥϜͰ͖ΔͨΊʹԿ͕ඞཁ͔ • state machine, tableґଘɺP4ݴޠ/ίϯύΠϥɺλʔήοτHW • NWͷՄೳੑΛ޿͍͛ͨ 19