This patch series reduces the memory usage of classifier rules while speeding up classification. It reduces the cost of adding more fields to the classifier.
The first two commits are bug fixes for existing code: ofproto: Avoid sensitivity to hash order in flow monitor pause/resume test. flow: Correctly consider nw_frag_mask in some flow_wildcards_*() functions. The next few commits are trivial cleanups. flow: Remove superfluous casts. ofproto-dpif: Remove superfluous cast. test-sha1: Remove unneeded casts. util: New macro CONST_CAST. ofp-util: Fix typo in comment. ofp-util: Remove extra blank line. These two commits factor some ofproto-dpif logic into generic code: ofproto: Move 'max_ports' from ofproto-dpif.c to ofproto.c. ofproto: Move ofpacts_check() calls from ofproto-dpif to ofproto. The following commits make struct flow_wildcards have exactly the same form as struct flow, to make it easier to process generically: flow: Fully separate FWW_* from OFPFW10_*. flow: Use bit-mask for DSCP and ECN bits, instead of FWW_* flags. flow: Use bit-mask for TTL match, instead of FWW_* flag. flow: Use bit-mask for IP protocol match, instead of FWW_* flag. flow: Use bit-mask for Ethernet type match, instead of FWW_* flag. flow: Use bit-mask for in_port match, instead of FWW_* flag. flow: Ensure that padding is always zeroed. flow: Take advantage of zero-padding in struct flow and flow_wildcards. flow: Replace flow_wildcards members by a single "struct flow". flow: Remove flow_wildcards_is_exact(). flow: Simplify many functions for working with flows and wildcards. And finally we get to the point: util: New function zero_rightmost_1bit(). util: New function popcount(). classifier: Fix typo in comment. classifier: Break cls_rule 'flow' and 'wc' members into new "struct match". classifier: Prepare for "struct cls_rule" needing to be destroyed. classifier: Optimize iteration with a catch-all target rule. Introduce sparse flows and masks, to reduce memory usage and improve speed. lib/automake.mk | 2 + lib/bitmap.h | 4 +- lib/classifier.c | 905 +++++--------------------------------------- lib/classifier.h | 106 +----- lib/dpif-linux.c | 12 +- lib/dynamic-string.c | 2 +- lib/flow.c | 757 ++++++++++++++++++++++++------------- lib/flow.h | 179 ++++++---- lib/hmap.h | 2 +- lib/json.c | 6 +- lib/learn.c | 32 +- lib/learning-switch.c | 3 +- lib/list.c | 6 +- lib/match.c | 826 ++++++++++++++++++++++++++++++++++++++++ lib/match.h | 138 +++++++ lib/meta-flow.c | 458 ++++++++++++----------- lib/meta-flow.h | 15 +- lib/netdev-linux.c | 4 +- lib/netdev.c | 2 +- lib/netlink-socket.c | 2 +- lib/nx-match.c | 147 ++++---- lib/nx-match.h | 10 +- lib/ofp-parse.c | 33 +- lib/ofp-print.c | 24 +- lib/ofp-util.c | 599 ++++++++++++++--------------- lib/ofp-util.h | 39 +- lib/ofpbuf.c | 4 +- lib/ovsdb-data.c | 5 +- lib/ovsdb-idl.c | 6 +- lib/shash.c | 6 +- lib/sset.h | 5 +- lib/stp.c | 4 +- lib/stream-ssl.c | 4 +- lib/util.c | 34 ++ lib/util.h | 20 + lib/vlog.c | 2 +- ofproto/connmgr.c | 14 +- ofproto/connmgr.h | 3 +- ofproto/fail-open.c | 13 +- ofproto/in-band.c | 134 ++++---- ofproto/ofproto-dpif.c | 116 +++---- ofproto/ofproto-provider.h | 63 ++-- ofproto/ofproto.c | 173 ++++++--- ovsdb/ovsdb-server.c | 8 +- ovsdb/ovsdb-tool.c | 2 +- ovsdb/row.c | 6 +- ovsdb/transaction.c | 12 +- tests/ofp-print.at | 8 +- tests/ofproto.at | 27 ++- tests/test-bundle.c | 1 + tests/test-classifier.c | 198 ++++++---- tests/test-flows.c | 8 +- tests/test-multipath.c | 1 + tests/test-sha1.c | 6 +- tests/test-stp.c | 4 +- utilities/ovs-ofctl.c | 138 ++++---- 56 files changed, 2987 insertions(+), 2351 deletions(-) create mode 100644 lib/match.c create mode 100644 lib/match.h -- 1.7.2.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev