Skip to content

Commit

Permalink
Classifier: Track address prefixes.
Browse files Browse the repository at this point in the history
Add a prefix tree (trie) structure for tracking the used address
space, enabling skipping classifier tables containing longer masks
than necessary for an address field value in a packet header being
classified.  This enables less unwildcarding for datapath flows in
parts of the address space without host routes.

Trie lookup is interwoven to the staged lookup, so that a trie is
searched only when the configured trie field becomes relevant
for the lookup.  The trie lookup results are retained so that each
trie is checked at most once for each classifier lookup.

This implementation tracks the number of rules at each address prefix
for the whole classifier.  More aggressive table skipping would be
possible by maintaining lists of tables that have prefixes at the
lengths encountered on tree traversal, or by maintaining separate
tries for subsets of rules separated by metadata fields.

Prefix tracking is configured via OVSDB.  A new column "prefixes" is
added to the database table "Flow_Table".  "prefixes" is a set of
string values listing the field names for which prefix lookup should
be used.

As of now, the fields for which prefix lookup can be enabled are:
- tun_id, tun_src, tun_dst
- nw_src, nw_dst (or aliases ip_src and ip_dst)
- ipv6_src, ipv6_dst

There is a maximum number of fields that can be enabled for any one
flow table.  Currently this limit is 3.

Examples:

ovs-vsctl set Bridge br0 flow_tables:0=@n1 -- \
 --id=@n1 create Flow_Table name=table0
ovs-vsctl set Bridge br0 flow_tables:1=@n1 -- \
 --id=@n1 create Flow_Table name=table1

ovs-vsctl set Flow_Table table0 prefixes=ip_dst,ip_src
ovs-vsctl set Flow_Table table1 prefixes=[]

Signed-off-by: Jarno Rajahalme <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
Jarno Rajahalme committed Dec 11, 2013
1 parent 8c30190 commit 13751fd
Show file tree
Hide file tree
Showing 15 changed files with 1,073 additions and 49 deletions.
24 changes: 24 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
Post-v2.0.0
---------------------

- Address prefix tracking support for flow tables. New columns
"prefixes" in OVS-DB table "Flow_Table" controls which packet
header fields are used for address prefix tracking. Prefix
tracking allows the classifier to skip rules with longer than
necessary prefixes, resulting in better wildcarding for datapath
flows. Default configuration is to not use any fields for prefix
tracking. However, if any flow tables contain both exact matches
and masked matches for IP address fields, OVS performance may be
increased by using this feature.
* As of now, the fields for which prefix lookup can be enabled
are: 'tun_id', 'tun_src', 'tun_dst', 'nw_src', 'nw_dst' (or
aliases 'ip_src' and 'ip_dst'), 'ipv6_src', and 'ipv6_dst'.
(Using this feature for 'tun_id' would only make sense if the
tunnel IDs have prefix structure similar to IP addresses.)
* There is a maximum number of fields that can be enabled for any
one flow table. Currently this limit is 3.
* Examples:
$ ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- \
--id=@N1 create Flow_Table name=table0
$ ovs-vsctl set Bridge br0 flow_tables:1=@N1 -- \
--id=@N1 create Flow_Table name=table1
$ ovs-vsctl set Flow_Table table0 prefixes=ip_dst,ip_src
$ ovs-vsctl set Flow_Table table1 prefixes=[]
- TCP flags matching: OVS now supports matching of TCP flags. This
has an adverse performance impact when using OVS userspace 1.10
or older (no megaflows support) together with the new OVS kernel
Expand Down
Loading

0 comments on commit 13751fd

Please sign in to comment.