openvswitch.ko minus Open vSwitch Joe Stringer, VMware - - PowerPoint PPT Presentation

openvswitch ko minus open vswitch
SMART_READER_LITE
LIVE PREVIEW

openvswitch.ko minus Open vSwitch Joe Stringer, VMware - - PowerPoint PPT Presentation

openvswitch.ko minus Open vSwitch Joe Stringer, VMware http://garfieldminusgarfield.net/post/26843739 2 Software-Defined Networking 3 Flows Classify a set of packets that have some common criteria Not all flows are created equal


slide-1
SLIDE 1
  • penvswitch.ko minus

Open vSwitch

Joe Stringer, VMware

slide-2
SLIDE 2

2

http://garfieldminusgarfield.net/post/26843739

slide-3
SLIDE 3

Software-Defined Networking

3

slide-4
SLIDE 4

Flows

  • Classify a set of packets that have some common criteria
  • Not all flows are created equal
  • Granularity => Power

○ => Performance?

  • If possible, one lookup

4

slide-5
SLIDE 5

How we described flow-based policy in Linux

  • Generic Netlink Families
  • Shared flow table resource (datapath)

○ Need a bounding box for which set of flows apply

  • Associate rx/tx ports
  • Define the flow

○ Packet fields, metadata that can be matched on

  • Describe how to handle packets when flow table empty

5

slide-6
SLIDE 6

datapath0

Datapath family

6

Flow Table

datapathN

Flow Table

datapath0 datapathN

# ovs-dpctl add-dp datapath0

slide-7
SLIDE 7

Virtual port (vport) family

7

datapath0

Flow Table

vport netdev vport internal tunnel device

# ovs-dpctl add-if datapath0 <netdev>

slide-8
SLIDE 8

Flow mask

Flow family

8

datapath

Flow Table

p1 p0 pN

  • utput(p1)

in_port(p0), eth(), eth_type(0x0806), arp() Flow identifier match+actions Masks Flow

}

# ovs-dpctl add-flow datapath0 “in_port(0),eth(),eth_type(0x0806),arp()”, 1

slide-9
SLIDE 9

Flow family: lookup hit

9

Flow Table

in_port(p0), eth(src=01:23:45:67:89:f0, dst=ff:ff:ff:ff:ff:ff), eth_type(0x0806), arp(sip=192.168.0.1, tip=192.168.0.2,op=1,...), Key 1 2 Matching flow -> actions

slide-10
SLIDE 10

Masked tuple matching (megaflow)

10

eth(src=x,dst=y),ip(dst=1.2.3.1) eth(src=x,dst=y),ip(dst=1.2.3.2) eth(src=x,dst=y),ip(dst=1.2.3.3) eth(src=x,dst=y),ip(dst=1.2.3.4) eth(src=x/ff:ff:ff:ff:ff:ff,dst=y/ff:ff:ff:ff:ff:ff), ip(dst=1.2.3.0/255.255.255.248) eth(src=x,dst=y),ip(dst=1.2.3.5) eth(src=x,dst=y),ip(dst=1.2.3.7) eth(src=x,dst=y),ip(dst=1.2.3.6) eth(src=x,dst=y),ip(dst=1.2.3.0)

}

slide-11
SLIDE 11

Flow family: lookup hit (megaflow)

11

Flow Table

in_port(p0), eth(src=01:23:45:67:89:f0, dst=ff:ff:ff:ff:ff:ff), eth_type(0x0806), arp(sip=192.168.0.1, tip=192.168.0.2,op=1,...), Mask list Unmasked key Masked key 1 2 3 Matching flow -> actions

slide-12
SLIDE 12

Flow family: Lookup miss

12

Flow Table

netlink socket in_port(1), eth(), eth_type(0x1234) Key packet Upcall metadata 1 2 3

*

* netlink socket may be set to ‘0’, indicating default drop

slide-13
SLIDE 13

Packet family: userspace upcall

13

SDN control

User Kernel packet Upcall metadata packet Downcall metadata actions flow key Flow mask actions ufid

slide-14
SLIDE 14

Packet family: Execute

14

packet Downcall metadata actions modified packet User Kernel

slide-15
SLIDE 15

OVS Netlink API Summary

  • Datapath family

○ Shared flow table ○ Access to stack ○ Place to hang ports

  • Virtual port (vport) family

○ Access for rx/tx with the datapath

  • Flow family

○ Describe forwarding behavior

  • Packet family

○ Handle packet+metadata to/from userspace

15

slide-16
SLIDE 16

Notable Improvements

  • Megaflows
  • Traffic Isolation
  • NetFilter integration
  • Recirculation

16

slide-17
SLIDE 17

Megaflows

17

From “The Design and Implementation of OVS”, Ben Pfaff et al., NSDI ’15

Optimizations Ktps (TCP_CRR) Flows Masks CPU % (user / kernel) Megaflows disabled 37 1,051,884 1 45 / 40 No optimizations 56 905,758 3 37 / 40 With priority sorting 57 785,124 4 39 / 45 With prefix tracking 95 13 10 0 / 15 With staged lookup 115 14 13 0 / 15 All optimizations 117 15 14 0 / 20

slide-18
SLIDE 18

Notable improvements: Upcall hashing

18

Virtual port netlink socket netlink socket netlink socket

slide-19
SLIDE 19

Notable improvements: conntrack

19

Flow Table

actions ... ct() NetFilter 2 1

slide-20
SLIDE 20

Notable improvements: recirculate

20

Flow Table

actions recirc(0x1) ct() NetFilter 3 1 2

slide-21
SLIDE 21
  • penvswitch.ko

Kernel API users

  • CLI tools
  • Open vSwitch (ovs-vswitchd)
  • MidoNet
  • Weave Net
  • Indigo Virtual Switch

21

slide-22
SLIDE 22

CLI tools - datapath / vport

# modprobe openvswitch # ovs-dpctl add-dp myDP # ip li add dev dummy0 type dummy # ovs-dpctl add-if myDP dummy0 # ip li add dev dummy1 type dummy # ovs-dpctl add-if myDP dummy1 # ovs-dpctl show system@myDP: lookups: hit:0 missed:177 lost:177 flows: 0 masks: hit:0 total:0 hit/pkt:0.00 port 0: myDP (internal) port 1: dummy0 port 2: dummy1

22

slide-23
SLIDE 23

CLI tools - flow

# ovs-dpctl add-flow "in_port(1),eth(),eth_type(0x806),arp()" 2 # ovs-dpctl add-flow "in_port(2),eth(),eth_type(0x806),arp()" 1 # ovs-dpctl add-flow "in_port(1),eth(),eth_type(0x800),ipv4(proto=1),icmp()" 2 # ovs-dpctl add-flow "in_port(2),eth(),eth_type(0x800),ipv4(proto=1),icmp()" 1 # ovs-dpctl dump-flows in_port(2),eth_type(0x0806), packets:0, bytes:0, used:never, actions:1 in_port(1),eth_type(0x0806), packets:0, bytes:0, used:never, actions:2 in_port(2),eth_type(0x0800),ipv4(proto=1), packets:0, bytes:0, used:never, actions:1 in_port(1),eth_type(0x0800),ipv4(proto=1), packets:0, bytes:0, used:never, actions:2

23

slide-24
SLIDE 24

Open vSwitch Daemon

24

http://openvswitch.org/assets/featured-image.jpg

slide-25
SLIDE 25

MidoNet

https://www.midonet.org/i/graphic.png

25

slide-26
SLIDE 26

Weave Net

https://www.weave.works/wp-content/uploads/d989f137a913d15c6ab2afe14149d8acfd180db3.png

26

slide-27
SLIDE 27

Indigo Virtual Switch

http://www.bigswitch.com/sites/default/files/_/switch_light_archictecture.png

27

slide-28
SLIDE 28

Common threads: integration

  • Lightweight Tunneling
  • Netfilter
  • XFRM
  • QoS
  • Hardware offloads

28

slide-29
SLIDE 29

Common threads: complexity

  • Desired configuration is orders of magnitude more complex than kernel API

○ Dozens of tables ○ Thousands of priorities

  • Compile hundreds of lookups into a single* lookup

○ Lower per-packet costs for complex pipelines

29

* or small integer when subsystem input is required

slide-30
SLIDE 30

Summary

  • SDN has driven openvswitch.ko development

○ logically centralized packet forwarding behaviour

  • OVS Netlink API provides generally useful primitives
  • Variety of users

○ OVS, MidoNet, WeaveNet, IVS

  • Allows userspace to integrate with other kernel functionality
  • Minimize kernel code complexity

30

slide-31
SLIDE 31

31

http://garfieldminusgarfield.net/post/37998316

slide-32
SLIDE 32

fin

joe@ovn.org