[ovs-git] [openvswitch/ovs] fa2fdb: classifier: Pre-compute stage masks.

GitHub noreply at github.com
Wed Aug 26 23:01:11 UTC 2015


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: fa2fdbf8d0c1da808230ad904e94199eafddd926
      https://github.com/openvswitch/ovs/commit/fa2fdbf8d0c1da808230ad904e94199eafddd926
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2015-08-26 (Wed, 26 Aug 2015)

  Changed paths:
    M lib/classifier-private.h
    M lib/classifier.c
    M lib/flow.c
    M lib/flow.h

  Log Message:
  -----------
  classifier: Pre-compute stage masks.

This makes stage mask computation happen only when a subtable is
inserted and allows simplification of the main lookup function.

Classifier benchmark shows that this speeds up the classification
(with wildcards) about 5%.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: 5fcff47b0b56b91e2a7096b2f015426a43d73ed9
      https://github.com/openvswitch/ovs/commit/5fcff47b0b56b91e2a7096b2f015426a43d73ed9
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2015-08-26 (Wed, 26 Aug 2015)

  Changed paths:
    M lib/classifier-private.h
    M lib/classifier.c
    M lib/dpif-netdev.c
    M lib/flow.c
    M lib/flow.h
    M lib/match.c
    M tests/test-classifier.c

  Log Message:
  -----------
  flow: Add struct flowmap.

Struct miniflow is now sometimes used just as a map.  Define a new
struct flowmap for that purpose.  The flowmap is defined as an array of
maps, and it is automatically sized according to the size of struct
flow, so it will be easier to maintain in the future.

It would have been tempting to use the existing struct bitmap for this
purpose. The main reason this is not feasible at the moment is that
some flowmap algorithms are simpler when it can be assumed that no
struct flow member requires more bits than can fit to a single map
unit. The tunnel member already requires more than 32 bits, so the map
unit needs to be 64 bits wide.

Performance critical algorithms enumerate the flowmap array units
explicitly, as it is easier for the compiler to optimize, compared to
the normal iterator.  Without this optimization a classifier lookup
without wildcard masks would be about 25% slower.

With this more general (and maintainable) algorithm the classifier
lookups are about 5% slower, when the struct flow actually becomes big
enough to require a second map.  This negates the performance gained
in the "Pre-compute stage masks" patch earlier in the series.

Requested-by: Ben Pfaff <blp at nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: a14502a7c529befab29fbe2f16230f3878837f13
      https://github.com/openvswitch/ovs/commit/a14502a7c529befab29fbe2f16230f3878837f13
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2015-08-26 (Wed, 26 Aug 2015)

  Changed paths:
    M lib/automake.mk
    M lib/classifier-private.h
    M lib/classifier.c
    R lib/tag.c
    R lib/tag.h

  Log Message:
  -----------
  classifier: Retire partitions.

Classifier partitions allowed skipping subtables when if was known
from the flow's metadata field that the subtable cannot possibly
match.  This functionality was later implemented in a more general
fashion by staged lookup, where the first stage also covers the
metadata field, among the rest of the non-packet fields in the struct
flow.  While in theory skipping a subtable on the basis of the
metadata field alone could produce more effective wildcards, on the
basis of our testsuite coverage it does not seem to be the case, as
removing the partitioning feature did not result in any test failures.

Removing the partitioning feature makes classifier lookups roughly 20%
faster when a wildcard mask is not needed, and roughly 10% faster when
a wildcard mask is needed, as tested with the test-classifier
benchmark with one lookup thread.

Found by profiling with 'perf'.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: 597819523ca5b5641653c410c2f13f364352677f
      https://github.com/openvswitch/ovs/commit/597819523ca5b5641653c410c2f13f364352677f
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2015-08-26 (Wed, 26 Aug 2015)

  Changed paths:
    M lib/flow.h
    M lib/packets.h
    M ofproto/ofproto-dpif-rid.c
    M ofproto/ofproto-dpif-rid.h

  Log Message:
  -----------
  ofproto-dpif-rid: Make lookups cheaper.

This patch removes a large-ish copy from the recirculation context
lookup, which is performed for each recirculated upcall and
revalidation of a recirculating flow.

Tunnel metadata has grown large since the addition of Geneve options,
and copying that metadata for performing a lookup is not necessary.
Change recirc_metadata to use a pointer to struct flow_tnl, and only
copy the tunnel metadata when needed, and only copy as little of it as
possible.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: f7484f37feba71636100af8405999ca8f750797e
      https://github.com/openvswitch/ovs/commit/f7484f37feba71636100af8405999ca8f750797e
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2015-08-26 (Wed, 26 Aug 2015)

  Changed paths:
    M lib/meta-flow.c

  Log Message:
  -----------
  meta-flow: Avoid unnecessary large memset.
    
mf_mask_field_and_prereqs() used to memset a static variable again and
again.  Now that mf_value is larger (due to tun_metadata field), this
is more expensive.  Avoid this by using static initialization.
    
mf_mask_field_and_prereqs() is used only for set field and reg move,
which never deal with the tun_metadata field as a whole.
    
Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: 5e2e998a5ed76e7aab2cd5cdc277b59c160dd199
      https://github.com/openvswitch/ovs/commit/5e2e998a5ed76e7aab2cd5cdc277b59c160dd199
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2015-08-26 (Wed, 26 Aug 2015)

  Changed paths:
    M lib/flow.h
    M lib/meta-flow.c
    M lib/meta-flow.h
    M lib/nx-match.c
    M ofproto/ofproto-dpif-xlate.c

  Log Message:
  -----------
  meta-flow: Minor refactoring.

Change mf_mask_field_and_prereqs() to take a struct flow_wildcards
pointer instead of a struct flow pointer so that we can use
WC_MASK_FIELD() and WC_MASK_FIELD_MASK() macros to wildcard fields.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


Compare: https://github.com/openvswitch/ovs/compare/dcd21433577b...5e2e998a5ed7


More information about the git mailing list