149
149
* A dpif provider is usually easier to implement, but most
150
150
appropriate for software switching. It "explodes" wildcard
151
rules into exact-match entries. This allows fast hash lookups
152
in software, but makes inefficient use of TCAMs in hardware
153
that support wildcarding.
151
rules into exact-match entries (with an optional wildcard mask).
152
This allows fast hash lookups in software, but makes
153
inefficient use of TCAMs in hardware that support wildcarding.
155
155
The following sections describe how to implement each kind of port.
176
176
Open vSwitch has a built-in ofproto provider named "ofproto-dpif",
177
177
which is built on top of a library for manipulating datapaths, called
178
"dpif". A "datapath" is a simple flow table, one that supports only
179
exact-match flows, that is, flows without wildcards. When a packet
180
arrives on a network device, the datapath looks for it in this
181
exact-match table. If there is a match, then it performs the
182
associated actions. If there is no match, the datapath passes the
183
packet up to ofproto-dpif, which maintains an OpenFlow flow table
184
(that supports wildcards). If the packet matches in this flow table,
185
then ofproto-dpif executes its actions and inserts a new exact-match
186
entry into the dpif flow table. (Otherwise, ofproto-dpif passes the
178
"dpif". A "datapath" is a simple flow table, one that is only required
179
to support exact-match flows, that is, flows without wildcards. When a
180
packet arrives on a network device, the datapath looks for it in this
181
table. If there is a match, then it performs the associated actions.
182
If there is no match, the datapath passes the packet up to ofproto-dpif,
183
which maintains the full OpenFlow flow table. If the packet matches in
184
this flow table, then ofproto-dpif executes its actions and inserts a
185
new entry into the dpif flow table. (Otherwise, ofproto-dpif passes the
187
186
packet up to ofproto to send the packet to the OpenFlow controller, if
188
187
one is configured.)
189
When calculating the dpif flow, ofproto-dpif generates an exact-match
190
flow that describes the missed packet. It makes an effort to figure out
191
what fields can be wildcarded based on the switch's configuration and
192
OpenFlow flow table. The dpif is free to ignore the suggested wildcards
193
and only support the exact-match entry. However, if the dpif supports
194
wildcarding, then it can use the masks to match multiple flows with
195
fewer entries and potentially significantly reduce the number of flow
196
misses handled by ofproto-dpif.
190
198
The "dpif" library in turn delegates much of its functionality to a
191
199
"dpif provider". The following diagram shows how dpif providers fit
192
200
into the Open vSwitch architecture: