openvswitch
14 years agoofproto: Don't bother returning value from facet_make_actions().
Ben Pfaff [Fri, 29 Oct 2010 22:25:55 +0000 (15:25 -0700)]
ofproto: Don't bother returning value from facet_make_actions().

None of the remaining callers use the return value.

14 years agoofproto: Fix accounting in facet_revalidate().
Ben Pfaff [Fri, 29 Oct 2010 23:33:08 +0000 (16:33 -0700)]
ofproto: Fix accounting in facet_revalidate().

When a facet moves from one rule to another, facet_revalidate() would
credit the packet and byte counters for the facet to the new rule (which
hasn't actually had any packets sent with the new actions at this point),
instead of to the old rule (which did potentially get some packets sent
with its old actions).  This commit fixes the problem.

14 years agoofproto: Break subrules out of "struct rule" into new "struct facet".
Ben Pfaff [Fri, 12 Nov 2010 22:45:57 +0000 (14:45 -0800)]
ofproto: Break subrules out of "struct rule" into new "struct facet".

Until now, there have been three types of struct rule:

   - An OpenFlow rule with wildcards, that may have exact-match "subrules".

   - An OpenFlow rule without wildcards.

   - A subrule that has no wildcards.

This is at best confusing.  At worst, it leads to bugs.

This commit changes the situation to:

   - "struct rule" represents an OpenFlow rule, with or without wildcards.

   - "struct facet" is what was called a subrule before.

This commit is intended to be more or less the minimal patch necessary to
implement this change.  Followup commits will further improve the code.

14 years agonetdev-linux: HFSC in linux
Ethan Jackson [Tue, 9 Nov 2010 18:41:47 +0000 (10:41 -0800)]
netdev-linux: HFSC in linux

This commit implements the Hierarchical Fair Service Curve queuing
discipline in linux. HFSC performs better at high bandwidth and
implements min-rate proportional sharing of excess bandwidth.  Only
a simplified configuration interface is exposed to the user.  This
can be expand to allow more tweaking in the future.

14 years agoofproto: Avoid clearing NetFlow stats twice upon rule creation.
Ben Pfaff [Fri, 29 Oct 2010 22:22:15 +0000 (15:22 -0700)]
ofproto: Avoid clearing NetFlow stats twice upon rule creation.

This seems cleaner to me: it seems risky to "clear" something that has not
been initialized yet.  It's also a super-minor optimization, I suppose.

14 years agoofproto: Make xlate_actions() initialize '*tags' itself.
Ben Pfaff [Fri, 29 Oct 2010 22:10:49 +0000 (15:10 -0700)]
ofproto: Make xlate_actions() initialize '*tags' itself.

This seems cleaner than expecting the caller to do it.

14 years agoofproto: Disable timeouts for flows added by ofproto_add_flow().
Ben Pfaff [Fri, 29 Oct 2010 18:38:39 +0000 (11:38 -0700)]
ofproto: Disable timeouts for flows added by ofproto_add_flow().

None of the existing callers of ofproto_add_flow() want an idle timeout,
but ofproto_add_flow() was giving them a 5-second timeout anyway.  I don't
know how this worked properly--in-band will patiently add the flow back
every few seconds anyway, but the bridge doesn't do that.

Also add an explanatory comment to ofproto_add_flow().

14 years agoofproto: Fix used time of revalidated subrules.
Ben Pfaff [Thu, 11 Nov 2010 19:04:10 +0000 (11:04 -0800)]
ofproto: Fix used time of revalidated subrules.

Despite the comment, the 'used' member of a rule is always set to at least
the value of 'created', except in one case in revalidation.  That case
appears to be just a mistake, so this commit changes it and corrects the
comment.

14 years agoofp-parse: Refactor flow parsing.
Ben Pfaff [Mon, 8 Nov 2010 18:37:52 +0000 (10:37 -0800)]
ofp-parse: Refactor flow parsing.

14 years agoofp-parse: Generalize parse_ofp_add_flow_str() as parse_ofp_flow_mod_str().
Ben Pfaff [Thu, 11 Nov 2010 19:01:09 +0000 (11:01 -0800)]
ofp-parse: Generalize parse_ofp_add_flow_str() as parse_ofp_flow_mod_str().

This generalization allows us to delete several lines of code from
ovs-ofctl.c.

14 years agonx-match: Add tests that wildcard bits are zeroed by flow parser.
Ben Pfaff [Thu, 11 Nov 2010 18:51:07 +0000 (10:51 -0800)]
nx-match: Add tests that wildcard bits are zeroed by flow parser.

Suggested-by: Justin Pettit <jpettit@nicira.com>
14 years agoAdd support for matching Ethernet multicast frames.
Ben Pfaff [Thu, 11 Nov 2010 18:46:23 +0000 (10:46 -0800)]
Add support for matching Ethernet multicast frames.

14 years agoofproto: Implement support for registers in extended flow match.
Ben Pfaff [Thu, 11 Nov 2010 18:41:33 +0000 (10:41 -0800)]
ofproto: Implement support for registers in extended flow match.

14 years agotest-classifier: Test CLASSIFIER_FOR_EACH_EXACT_RULE.
Ben Pfaff [Thu, 11 Nov 2010 18:26:04 +0000 (10:26 -0800)]
test-classifier: Test CLASSIFIER_FOR_EACH_EXACT_RULE.

This would have found the bug fixed by the previous commit.

14 years agoclassifier: Pass correct member to CONTAINER_OF in cls_table_next_rule().
Ben Pfaff [Thu, 11 Nov 2010 18:25:34 +0000 (10:25 -0800)]
classifier: Pass correct member to CONTAINER_OF in cls_table_next_rule().

Fixes a segmentation fault in uses of CLASSIFIER_FOR_EACH_EXACT_RULE.

Reported-by: Derek Cormier <derek.cormier@lab.ntt.co.jp>
14 years agoofproto: Fix use of uninitialized variable.
Ben Pfaff [Wed, 10 Nov 2010 23:12:18 +0000 (15:12 -0800)]
ofproto: Fix use of uninitialized variable.

My compiler didn't report this but Ethan's did.

Reported-by: Ethan Jackson <ethan@nicira.com>
14 years agosocket-util: Work around Unix domain socket path name limits on Linux.
Ben Pfaff [Tue, 9 Nov 2010 23:58:36 +0000 (15:58 -0800)]
socket-util: Work around Unix domain socket path name limits on Linux.

Many Open vSwitch tests fail on Debian's automatic build machines because
the builds occur in deeply nested directories with long names.  OVS tries
to bind and connect to Unix domain sockets using absolute path names, which
in combination with long directory names means that the socket's name
exceeds the limit for Unix domain socket names (108 bytes on Linux).

This commit works around the problem on Linux by indirecting through
/proc/self/fd/<dirfd>/<basename> when names exceed the maximum that can be
used directly.

Reported-by: Hector Oron <hector.oron@gmail.com>
Reported-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Reported-by: Roger Leigh <rleigh@codelibre.net>
Debian bug #602891.
Debian bug #602911.

14 years agosocket-util: Define LINUX macro at top of file.
Ben Pfaff [Tue, 9 Nov 2010 23:36:48 +0000 (15:36 -0800)]
socket-util: Define LINUX macro at top of file.

This will be used further in the following commit.

14 years agoutil: New function base_name().
Ben Pfaff [Tue, 9 Nov 2010 22:38:28 +0000 (14:38 -0800)]
util: New function base_name().

14 years agoCodingStyle: Clarify C dialect section and add rationale.
Ben Pfaff [Wed, 10 Nov 2010 17:39:27 +0000 (09:39 -0800)]
CodingStyle: Clarify C dialect section and add rationale.

Requested-by: Ethan Jackson <ethan@nicira.com>
14 years agodebian: Remove corekeeper package.
Ben Pfaff [Tue, 9 Nov 2010 18:28:13 +0000 (10:28 -0800)]
debian: Remove corekeeper package.

The corekeeper package has little or nothing to do with Open vSwitch
itself, so remove it.

14 years agolib: Distribute nx-match.def, fixing "make dist".
Ben Pfaff [Wed, 10 Nov 2010 17:54:09 +0000 (09:54 -0800)]
lib: Distribute nx-match.def, fixing "make dist".

14 years agoofproto: Factor out code from do_xlate_actions() into new function.
Ben Pfaff [Wed, 10 Nov 2010 01:13:26 +0000 (17:13 -0800)]
ofproto: Factor out code from do_xlate_actions() into new function.

This helper will be useful elsewhere in upcoming commits.

14 years agoofp-util: Make validate_actions() take a struct flow *.
Ben Pfaff [Tue, 26 Oct 2010 16:41:24 +0000 (09:41 -0700)]
ofp-util: Make validate_actions() take a struct flow *.

The upcoming support for actions on registers will require the flow to
validate actions, so this commit adds the parameter in advance.  It is
not yet used.

14 years agoofproto: Refactor handle_packet_out().
Ben Pfaff [Thu, 28 Oct 2010 04:20:50 +0000 (21:20 -0700)]
ofproto: Refactor handle_packet_out().

An upcoming commit will require the flow to be passed in as part of
OpenFlow action validation, but handle_packet_out() has until now been
structured to make this difficult.  This commit refactors it to better
suit this purpose.

14 years agoofproto: Implement Nicira Extended Match flexible flow match (NXM).
Ben Pfaff [Wed, 10 Nov 2010 01:00:59 +0000 (17:00 -0800)]
ofproto: Implement Nicira Extended Match flexible flow match (NXM).

14 years agoofproto: Fix type of 'out_port' parameter to query_aggregate_stats().
Ben Pfaff [Wed, 10 Nov 2010 01:03:18 +0000 (17:03 -0800)]
ofproto: Fix type of 'out_port' parameter to query_aggregate_stats().

Reported-by: Justin Pettit <jpettit@nicira.com>
14 years agoofproto: Rename *_stats_reply() functions for clarity.
Ben Pfaff [Wed, 10 Nov 2010 01:01:27 +0000 (17:01 -0800)]
ofproto: Rename *_stats_reply() functions for clarity.

Suggested-by: Justin Pettit <jpettit@nicira.com>
14 years agodatapath: Fix build on 2.6.18.
Ben Pfaff [Wed, 10 Nov 2010 00:22:24 +0000 (16:22 -0800)]
datapath: Fix build on 2.6.18.

Build-tested (only) on 2.6.18 from XenServer 5.5.0, 2.6.26, 2.6.29, 2.6.34,
and 2.6.36.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoFix distribution by adding include/linux/if_link.h to "make dist".
Ben Pfaff [Tue, 9 Nov 2010 22:40:11 +0000 (14:40 -0800)]
Fix distribution by adding include/linux/if_link.h to "make dist".

Why can't I ever get this right the first time?

14 years agodatapath: Use "struct rtnl_link_stats64" instead of "struct odp_vport_stats".
Ben Pfaff [Tue, 9 Nov 2010 21:48:57 +0000 (13:48 -0800)]
datapath: Use "struct rtnl_link_stats64" instead of "struct odp_vport_stats".

Linux 2.6.35 added struct rtnl_link_stats64, which as a set of 64-bit
network device counters is what the OVS datapath needs.  We might as well
use it instead of our own.

This commit moves the if_link.h compat header from datapath/ into the
top-level include/ directory so that it is visible both to kernel and
userspace code.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
14 years agodatapath: Clean up netdev_get_stats() very slightly.
Ben Pfaff [Thu, 4 Nov 2010 21:00:54 +0000 (14:00 -0700)]
datapath: Clean up netdev_get_stats() very slightly.

dev_get_stats() is documented to return its output argument, so there's no
need to maintain a separate pointer variable.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
14 years agodatapath: Add clean compat layer for dev_get_stats().
Ben Pfaff [Tue, 9 Nov 2010 20:39:17 +0000 (12:39 -0800)]
datapath: Add clean compat layer for dev_get_stats().

Build tested (only) only on i386 for 2.6.26, 2.6.29, 2.6.33, 2.6.34,
and 2.6.36, and on x86-64 for 2.6.31 and 2.6.36.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
14 years agodatapath: Use struct assignment in place of memcpy() for copying stats.
Ben Pfaff [Thu, 4 Nov 2010 20:49:19 +0000 (13:49 -0700)]
datapath: Use struct assignment in place of memcpy() for copying stats.

We might as well take advantage of type safety when we can get it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
14 years agoovsdb: Fix "make dist" by distributing dot2pic.
Ben Pfaff [Tue, 9 Nov 2010 18:33:17 +0000 (10:33 -0800)]
ovsdb: Fix "make dist" by distributing dot2pic.

14 years agoflow: Better abstract flow_wildcards and use it more widely.
Ben Pfaff [Mon, 8 Nov 2010 18:37:35 +0000 (10:37 -0800)]
flow: Better abstract flow_wildcards and use it more widely.

14 years agonicira-ext: Shuffle comments around.
Ben Pfaff [Tue, 19 Oct 2010 23:01:49 +0000 (16:01 -0700)]
nicira-ext: Shuffle comments around.

It seemed to me that the descriptions of what actions do should be just
above the action structures, where the reader can see the arguments,
instead of just above the enumeration name, so I rearranged the code
this way.

A few actions didn't have their own structures, so to do this I had to give
them some.

14 years agoclassifier: Add more cls_rule_set_*() functions.
Ben Pfaff [Mon, 8 Nov 2010 18:31:29 +0000 (10:31 -0800)]
classifier: Add more cls_rule_set_*() functions.

These will be handy later but are not used yet.

14 years agoclassifier: Move in-band set_<field>() functions publicly available.
Ben Pfaff [Tue, 26 Oct 2010 23:41:44 +0000 (16:41 -0700)]
classifier: Move in-band set_<field>() functions publicly available.

These will be useful elsewhere later.

14 years agoofproto: Change ofproto_add_flow(), ofproto_delete_flow() to take cls_rule.
Ben Pfaff [Wed, 20 Oct 2010 23:46:48 +0000 (16:46 -0700)]
ofproto: Change ofproto_add_flow(), ofproto_delete_flow() to take cls_rule.

This is a small cleanup that will make later changes to wildcards easier.

14 years agoofproto: Refactor handle_flow_mod().
Ben Pfaff [Mon, 8 Nov 2010 18:43:19 +0000 (10:43 -0800)]
ofproto: Refactor handle_flow_mod().

This breaks this OpenFlow handler into two parts, one responsible
for parsing and constructing OpenFlow messages and one that works
with the flow table.  The latter will be reused in a later commit
that implements the Nicira Extended Match flexible flow match
extension.

14 years agoRename cls_rule_zero_wildcards() to cls_rule_zero_wildcarded_fields().
Ben Pfaff [Mon, 8 Nov 2010 18:36:26 +0000 (10:36 -0800)]
Rename cls_rule_zero_wildcards() to cls_rule_zero_wildcarded_fields().

Justin said that he found the shorter name confusing.

14 years agoofproto: Refactor handle_aggregate_stats_request().
Ben Pfaff [Fri, 5 Nov 2010 19:49:06 +0000 (12:49 -0700)]
ofproto: Refactor handle_aggregate_stats_request().

This breaks this OpenFlow handler into two parts, one responsible
for parsing and constructing OpenFlow messages and one that works
with the flow table.  The latter will be reused in a later commit
that implements the Nicira Extended Match flexible flow match
extension.

14 years agoofproto: Generalize reject_slave_controller().
Ben Pfaff [Tue, 19 Oct 2010 21:01:04 +0000 (14:01 -0700)]
ofproto: Generalize reject_slave_controller().

14 years agoofproto: Factor flow duration calculation into new calc_flow_duration().
Ben Pfaff [Fri, 5 Nov 2010 19:45:48 +0000 (12:45 -0700)]
ofproto: Factor flow duration calculation into new calc_flow_duration().

14 years agoofproto: Get rid of redundant ofproto parameters in presence of ofconn.
Ben Pfaff [Fri, 5 Nov 2010 19:41:55 +0000 (12:41 -0700)]
ofproto: Get rid of redundant ofproto parameters in presence of ofconn.

An ofconn has a member that points to its ofproto, so there's never a need
to pass both an ofconn and its ofproto as parameters to a function.

Suggested-by: Justin Pettit <jpettit@nicira.com>
14 years agoofproto: Make flow format specific to an OpenFlow connection.
Ben Pfaff [Fri, 5 Nov 2010 18:59:05 +0000 (11:59 -0700)]
ofproto: Make flow format specific to an OpenFlow connection.

Until now the flow format has been a global property of an ofproto.
This is no longer appropriate, because the Nicira Extended Match
flow format that upcoming commits will add is not compatible with
OpenFlow 1.0-only controllers.  This commit changes the flow format
to a property of an individual OpenFlow connection.

14 years agoofproto: Generalize tun_id_from_cookie into flow_format.
Ben Pfaff [Fri, 5 Nov 2010 18:10:35 +0000 (11:10 -0700)]
ofproto: Generalize tun_id_from_cookie into flow_format.

Upcoming commits will add more flow formats, so this needs to be
an enumerated type instead of a bool.

14 years agoAdd "Manager" and "manager_options" to allow options for OVSDB connections.
Ben Pfaff [Fri, 5 Nov 2010 17:22:18 +0000 (10:22 -0700)]
Add "Manager" and "manager_options" to allow options for OVSDB connections.

I'm retaining the "managers" column in the Open_vSwitch table for now, but
I hope that applications transition to using "manager_options" eventually
so that we could drop it.

CC: Andrew Lambeth <wal@nicira.com>
CC: Jeremy Stribling <strib@nicira.com>
14 years agoin-band: Make in_band_create() always initialize its output argument.
Ben Pfaff [Tue, 2 Nov 2010 23:20:36 +0000 (16:20 -0700)]
in-band: Make in_band_create() always initialize its output argument.

This isn't a bug fix but it seems like a good thing to do.

14 years agoreconnect: Use macros instead of literals for default timeouts.
Ben Pfaff [Tue, 2 Nov 2010 23:20:08 +0000 (16:20 -0700)]
reconnect: Use macros instead of literals for default timeouts.

14 years agodocs: Implement our own dot->pic translator.
Ben Pfaff [Wed, 3 Nov 2010 17:01:38 +0000 (10:01 -0700)]
docs: Implement our own dot->pic translator.

Recent versions of Graphviz no longer support output to PIC format, so this
commit adds our own internal translator from dot's "plain" output format
to PIC format.  The "plain" format works best with slightly different
"dot" input (advised by the Graphviz manual description of the "plain"
format) so this commit also adjusts ovsdb-dot's output.

14 years agoconfigure: Fix Graphviz test and input generation.
Ben Pfaff [Wed, 3 Nov 2010 16:57:16 +0000 (09:57 -0700)]
configure: Fix Graphviz test and input generation.

This check for Graphviz never actually worked properly because Autoconf
swallows up the [] around [gG], so Graphviz was always detected as missing.
This commit fixes the problem by doubling up to [[gG]].

Because Graphviz was never used, I never noticed that ovsdb-dot had not
been revised to use the latest Python interface to OVSDB, so this commit
fixes up those problems too.

14 years agoofproto: Improve comment in send_flow_removed().
Ben Pfaff [Fri, 5 Nov 2010 16:27:27 +0000 (09:27 -0700)]
ofproto: Improve comment in send_flow_removed().

14 years agoofproto: Simplify send_flow_removed().
Ben Pfaff [Mon, 18 Oct 2010 23:15:50 +0000 (16:15 -0700)]
ofproto: Simplify send_flow_removed().

I have no evidence that the optimization in this function is valuable.
An upcoming commit will introduce a new form of flow expiration message
that is sent to controllers that ask for it, while the standard OpenFlow
1.0 message is sent to other controllers.  Since retaining this
optimization with that logic would complicate the function, this commit
drops it.

14 years agoofp-util: New functions make_nxmsg(), make_nxmsg_xid().
Ben Pfaff [Mon, 18 Oct 2010 23:25:52 +0000 (16:25 -0700)]
ofp-util: New functions make_nxmsg(), make_nxmsg_xid().

These functions slightly simplify constructing Nicira vendor extension
messages.

14 years agoofp-util: Add macros for composing error codes.
Ben Pfaff [Tue, 19 Oct 2010 21:12:26 +0000 (14:12 -0700)]
ofp-util: Add macros for composing error codes.

These are useful in static initializers and case labels, where function
calls are not allowed.

14 years agoSync Nicira error number assignments with "wdp" branch.
Ben Pfaff [Fri, 20 Aug 2010 17:33:02 +0000 (10:33 -0700)]
Sync Nicira error number assignments with "wdp" branch.

This adds the error numbers that the "wdp" branch added, without adding
any uses of them (because they are not needed on "master" yet).

14 years agoofp-util: Use our usual variable naming convention in make_ofp_error_msg().
Ben Pfaff [Thu, 4 Nov 2010 17:33:28 +0000 (10:33 -0700)]
ofp-util: Use our usual variable naming convention in make_ofp_error_msg().

14 years agoofp-util: Actually map vendor codes to IDs correctly.
Ben Pfaff [Thu, 4 Nov 2010 17:33:08 +0000 (10:33 -0700)]
ofp-util: Actually map vendor codes to IDs correctly.

Reported-by: Justin Pettit <jpettit@nicira.com>
14 years agoofp-util.h: Use NX_VENDOR_ID instead of literal numeric constant.
Ben Pfaff [Thu, 4 Nov 2010 17:32:46 +0000 (10:32 -0700)]
ofp-util.h: Use NX_VENDOR_ID instead of literal numeric constant.

14 years agoFix typos in comments.
Ben Pfaff [Thu, 4 Nov 2010 17:32:13 +0000 (10:32 -0700)]
Fix typos in comments.

14 years agoofp-util: Add infrastructure for vendor extensions to OpenFlow error codes.
Ben Pfaff [Fri, 20 Aug 2010 17:29:03 +0000 (10:29 -0700)]
ofp-util: Add infrastructure for vendor extensions to OpenFlow error codes.

Cross-ported from "wdp" branch.

14 years agoofp-util: Add more functions for supporting OpenFlow error codes.
Ben Pfaff [Tue, 19 Oct 2010 16:55:40 +0000 (09:55 -0700)]
ofp-util: Add more functions for supporting OpenFlow error codes.

Cross-ported from "wdp" branch.

14 years agoAUTHORS: Add Romain Lenglet.
Jesse Gross [Fri, 5 Nov 2010 05:01:16 +0000 (22:01 -0700)]
AUTHORS: Add Romain Lenglet.

14 years agoofp-print: always print the flow nw_tos if not wildcarded
Romain Lenglet [Fri, 5 Nov 2010 01:47:50 +0000 (10:47 +0900)]
ofp-print: always print the flow nw_tos if not wildcarded

Print the nw_tos field for all flows if it is not wildcarded, instead
of only if the dl_type is IP and the nw_proto is not ICMP, TCP, or
UDP.

14 years agodatapath: Directly use free_netdev for internal devices.
Jesse Gross [Thu, 4 Nov 2010 23:20:32 +0000 (16:20 -0700)]
datapath: Directly use free_netdev for internal devices.

Currently internal devices register a destructor function which
simply calls free_netdev.  Instead we can simply set the destructor
to free_netdev.  In addition to being cleaner, it is also a bug fix
because the module could be unloaded before the destructor is called,
making a call into our code illegal.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
14 years agoovs-vsctl: Create bridge interface as type "internal".
Ben Pfaff [Thu, 4 Nov 2010 17:53:57 +0000 (10:53 -0700)]
ovs-vsctl: Create bridge interface as type "internal".

The bridge device is always an internal interface, so it seems best to
actually mark it as one.  Jesse would like to eventually make the "type"
column mandatory for Interface records, so here's a step in the right
direction.

14 years agonetdev: Assert that the type of a new network device is correct.
Ben Pfaff [Thu, 4 Nov 2010 00:00:57 +0000 (17:00 -0700)]
netdev: Assert that the type of a new network device is correct.

This would have found a bug that I accidentally inserted while working on
netdev-linux.

14 years agoPORTING: Update to describe netdev-vport.c
Justin Pettit [Thu, 4 Nov 2010 08:59:57 +0000 (01:59 -0700)]
PORTING: Update to describe netdev-vport.c

The "lib/netdev-gre.c" and "lib/netdev-patch.c" files have been
consolidated into "lib/netdev-vport.c".  This change reflect that.

14 years agoCodingStyle: Mention that "free" functions should accept a null pointer.
Ben Pfaff [Thu, 4 Nov 2010 00:07:33 +0000 (17:07 -0700)]
CodingStyle: Mention that "free" functions should accept a null pointer.

I've always written OVS code this way, so this just codifies it so that
others know.

14 years agoovsdb-client: Add JSON output format.
Ben Pfaff [Thu, 4 Nov 2010 00:12:59 +0000 (17:12 -0700)]
ovsdb-client: Add JSON output format.

Requested-by: DK Moon <dkmoon@nicira.com>
CC: DK Moon <dkmoon@nicira.com>
14 years agoovsdb-client: Refactor table code to save original json during formatting.
Ben Pfaff [Tue, 2 Nov 2010 21:50:48 +0000 (14:50 -0700)]
ovsdb-client: Refactor table code to save original json during formatting.

This refactoring should not change user-visible behavior, but saving the
JSON used to format tables will make it possible to print the raw JSON in
the following commit.

14 years agoconfigure: Simplify use of OVS_GREP_IFELSE.
Ben Pfaff [Wed, 8 Sep 2010 23:46:43 +0000 (16:46 -0700)]
configure: Simplify use of OVS_GREP_IFELSE.

Most users of OVS_GREP_IFELSE simply defined HAVE_<regex>, so make this
the default.

14 years agoofproto: Don't show separate wildcard and exact-match tables via OpenFlow.
Ben Pfaff [Wed, 3 Nov 2010 18:07:16 +0000 (11:07 -0700)]
ofproto: Don't show separate wildcard and exact-match tables via OpenFlow.

Formerly the classifier used in Open vSwitch was very sensitive to the
number of exact-match versus wildcarded rules, so it made sense to show
them as separate tables over OpenFlow.  The current classifier doesn't
have the same performance sensitivity, so we might as well just show one
table.

14 years agoclassifier: Rewrite.
Ben Pfaff [Wed, 3 Nov 2010 18:00:58 +0000 (11:00 -0700)]
classifier: Rewrite.

The old classifier was not adaptive: it required knowing the structure of
the flows that were likely to be in use to get good performance.  It is
likely that it degenerated to linear search in any real-world case.

This new classifier is adaptive and should perform better in the real
world.

14 years agoautoconf: Compat checks no longer support multiple files.
Jesse Gross [Wed, 3 Nov 2010 17:14:06 +0000 (10:14 -0700)]
autoconf: Compat checks no longer support multiple files.

We now test that a file exists before grepping but that doesn't
work if there are multiple possible files.  For the one case that
needs this (kmemdup) break the test into two: check the first file
and if the pattern isn't found check the second file.

14 years agodatapath: Work around debugging for csum_and_copy_to_user().
Jesse Gross [Tue, 2 Nov 2010 22:43:32 +0000 (15:43 -0700)]
datapath: Work around debugging for csum_and_copy_to_user().

Certain versions of XenServer add debugging to csum_and_copy_to_user()
in such a way that it changes the function signature.  This adds a
check and a workaround to allow us to build on these versions.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
14 years agoautoconf: Tolerate missing file when grepping.
Jesse Gross [Tue, 2 Nov 2010 23:00:16 +0000 (16:00 -0700)]
autoconf: Tolerate missing file when grepping.

Currently we die when grepping for compatibility strings if the
file does not exist.  Since this can be a valid situation when
files are added in later versions, we shouldn't kill the build.
Instead, note that the file doesn't exist but otherwise treat it
as if the string was not found.

14 years agoovsdb: Fix formatting of ovs.db.Error on Python 2.6.
Ben Pfaff [Tue, 2 Nov 2010 20:13:12 +0000 (13:13 -0700)]
ovsdb: Fix formatting of ovs.db.Error on Python 2.6.

All of the negative Python OVSDB tests were failing on Python 2.6 because
"%s\n" % e yielded the empty string on that version of Python.  In turn,
that was because ovs.db.error.Error.__unicode__ was being called instead of
ovs.db.error.Error.__str__.  I'm puzzled why that was happening, but this
commit fixes it and also seems like a small code cleanup.

Peter Balland helped me gain some insight on this problem.

CC: Peter Balland <peter@nicira.com>
CC: Reid Price <reid@nicira.com>
14 years agodatapath: The definition of struct tbl is needed by rcu_dereference()
Simon Horman [Tue, 2 Nov 2010 12:35:14 +0000 (21:35 +0900)]
datapath: The definition of struct tbl is needed by rcu_dereference()

Due to the use of typeof(*p) by __rcu_dereference_check(),
which was introduced by the Linux changeset
ca5ecddfa8fcbd948c95530e7e817cee9fb43a3d
(rcu: define __rcu address space modifier for sparse) the definition
of the type of a the parameter to rcu_dereference() is needed.

In terms of the datapath, this means that the definition of
struct tbl needs to be available wherever rcu_dereference(dp->table)
is called.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
14 years agodatapath: IFF_OVS_DATAPATH will exist in in 2.6.37
Simon Horman [Tue, 2 Nov 2010 12:35:13 +0000 (21:35 +0900)]
datapath: IFF_OVS_DATAPATH will exist in in 2.6.37

Signed-off-by: Simon Horman <horms@verge.net.au>
[Jesse: drop comment that no longer applies]
Signed-off-by: Jesse Gross <jesse@nicira.com>
14 years agoFix "make dist" by adding include/openvswitch/types.h to the distribution.
Ben Pfaff [Fri, 29 Oct 2010 17:33:03 +0000 (10:33 -0700)]
Fix "make dist" by adding include/openvswitch/types.h to the distribution.

14 years agoclassifier: Change classifier_rule_overlaps() to take a cls_rule *.
Ben Pfaff [Tue, 19 Oct 2010 20:04:52 +0000 (13:04 -0700)]
classifier: Change classifier_rule_overlaps() to take a cls_rule *.

There's no benefit to spelling out all of the components of a cls_rule
separately.  Just use cls_rule itself.

14 years agoclassifier: Change classifier_find_rule_exactly() to take a cls_rule *.
Ben Pfaff [Thu, 14 Oct 2010 20:25:36 +0000 (13:25 -0700)]
classifier: Change classifier_find_rule_exactly() to take a cls_rule *.

There's no benefit to spelling out all of the components of a cls_rule
separately.  Just use cls_rule itself.

14 years agoclassifier: Merge classifier_lookup_wild(), classifier_lookup_exact().
Ben Pfaff [Thu, 14 Oct 2010 17:13:51 +0000 (10:13 -0700)]
classifier: Merge classifier_lookup_wild(), classifier_lookup_exact().

Merge these functions into classifier_lookup() and update its interface.

The new version of the classifier soon to be implemented naturally merges
these functions, so this commit updates the interface early.

14 years agoclassifier: Remove classifier_insert_exact().
Ben Pfaff [Thu, 14 Oct 2010 17:30:07 +0000 (10:30 -0700)]
classifier: Remove classifier_insert_exact().

This function doesn't provide any extra useful functionality.  It is
amenable to a slightly optimized implementation in the current classifier,
but not in the one that will soon replace it, so get rid of it.

14 years agoclassifier: Remove unused functions cls_rule_moved(), cls_rule_replace().
Ben Pfaff [Thu, 14 Oct 2010 00:14:57 +0000 (17:14 -0700)]
classifier: Remove unused functions cls_rule_moved(), cls_rule_replace().

In preparation for rewriting the classifier, remove some functions that
nothing uses and have no tests.

14 years agoodp-util: Print in_port in decimal in format_odp_flow_key().
Ben Pfaff [Fri, 29 Oct 2010 16:50:56 +0000 (09:50 -0700)]
odp-util: Print in_port in decimal in format_odp_flow_key().

Suggested-by: Justin Pettit <jpettit@nicira.com>
14 years agoodp-util: Print tunnel id as part of ODP flow key in format_odp_flow_key().
Ben Pfaff [Fri, 29 Oct 2010 16:49:46 +0000 (09:49 -0700)]
odp-util: Print tunnel id as part of ODP flow key in format_odp_flow_key().

14 years agoflow: Add more functions for working with flow_wildcards.
Ben Pfaff [Thu, 28 Oct 2010 03:15:56 +0000 (20:15 -0700)]
flow: Add more functions for working with flow_wildcards.

These have limited use now but will become more important later.

14 years agoflow: Use vlan_tci_to_pcp() helper.
Ben Pfaff [Tue, 26 Oct 2010 20:09:28 +0000 (13:09 -0700)]
flow: Use vlan_tci_to_pcp() helper.

This is just a small cleanup that should not change any behavior.

14 years agoflow: Un-inline flow_wildcards functions.
Ben Pfaff [Wed, 20 Oct 2010 23:33:10 +0000 (16:33 -0700)]
flow: Un-inline flow_wildcards functions.

These functions really seem too big to inline.

14 years agoofproto: Use ovs_be<N> types in appropriate places.
Ben Pfaff [Thu, 28 Oct 2010 04:17:27 +0000 (21:17 -0700)]
ofproto: Use ovs_be<N> types in appropriate places.

There are many more places in OVS where using these types would be an
improvement, but the ofproto code is extra confusing because it uses
a mix of byte orders.

14 years agoflow: Use ovs_be<N> types in appropriate places.
Ben Pfaff [Tue, 26 Oct 2010 22:24:26 +0000 (15:24 -0700)]
flow: Use ovs_be<N> types in appropriate places.

There are many more places in OVS where using these types would be an
improvement, but the flow code is particularly confusing because it uses
a mix of byte orders.

14 years agoMake the ovs_be<N> types generally available.
Ben Pfaff [Thu, 21 Oct 2010 18:31:43 +0000 (11:31 -0700)]
Make the ovs_be<N> types generally available.

Using these types for data in network byte order makes code clearer, and
allows the "sparse" checker to give warnings for misuse.

14 years agovlog: Make client supply semicolon for VLOG_DEFINE_THIS_MODULE.
Ben Pfaff [Tue, 19 Oct 2010 21:47:01 +0000 (14:47 -0700)]
vlog: Make client supply semicolon for VLOG_DEFINE_THIS_MODULE.

It's kind of odd for VLOG_DEFINE_THIS_MODULE to supply its own semicolon,
so this commit switches to the more common form.

14 years agoxtoxll: Rename "byte-order" since it now include more than xtoxll.
Ben Pfaff [Fri, 29 Oct 2010 00:13:18 +0000 (17:13 -0700)]
xtoxll: Rename "byte-order" since it now include more than xtoxll.

Suggested-by: Justin Pettit <jpettit@nicira.com>
14 years agoxtoxll: Add byte conversions macros for use in constant expressions.
Ben Pfaff [Tue, 11 May 2010 23:44:03 +0000 (16:44 -0700)]
xtoxll: Add byte conversions macros for use in constant expressions.

14 years agohmap: New macro HMAP_NODE_NULL_INITIALIZER.
Ben Pfaff [Tue, 26 Oct 2010 00:11:06 +0000 (17:11 -0700)]
hmap: New macro HMAP_NODE_NULL_INITIALIZER.