sliver-openvswitch.git
13 years agoconfigure: Check for pkg-config "openssl" library instead of "libssl".
Ben Pfaff [Wed, 24 Nov 2010 20:25:10 +0000 (12:25 -0800)]
configure: Check for pkg-config "openssl" library instead of "libssl".

Checking for libssl only does not necessarily link against libcrypto, so
the build can gratuitously fail.

Reported-by: Dave Walker <DaveWalker@ubuntu.com>
Ubuntu bug #680439.

13 years agoofp-util: Fix interpretation of NXFW_TUN_ID bit for NXFF_OPENFLOW10.
Ben Pfaff [Tue, 23 Nov 2010 21:09:53 +0000 (13:09 -0800)]
ofp-util: Fix interpretation of NXFW_TUN_ID bit for NXFF_OPENFLOW10.

In NXFF_OPENFLOW10, the tun_id field is always supposed to be wildcarded.
That is what OVS used to do, but commit d8ae4d67 "flow: Fully separate
flow_wildcards from OpenFlow wildcard bits" broke it.

13 years agoofproto: Send OFPT_PORT_STATUS messages to primary slave controllers.
Ben Pfaff [Wed, 24 Nov 2010 20:50:52 +0000 (12:50 -0800)]
ofproto: Send OFPT_PORT_STATUS messages to primary slave controllers.

Requested-by: Jeremy Stribling <strib@nicira.com>
CC: Jeremy Stribling <strib@nicira.com>
13 years agodpif-netdev: Do not log error for EOPNOTSUPP return from netdev_recv().
Ben Pfaff [Fri, 12 Nov 2010 20:12:03 +0000 (12:12 -0800)]
dpif-netdev: Do not log error for EOPNOTSUPP return from netdev_recv().

If a network device does not implement receiving packets, there is no point
in logging it as an error.

13 years agodpif-netdev: Simplify code by using shash for names and dropping indexes.
Ben Pfaff [Wed, 24 Nov 2010 20:35:22 +0000 (12:35 -0800)]
dpif-netdev: Simplify code by using shash for names and dropping indexes.

13 years agonx-match: Implement support for arbitrary VLAN TCI masks.
Ben Pfaff [Tue, 23 Nov 2010 18:06:28 +0000 (10:06 -0800)]
nx-match: Implement support for arbitrary VLAN TCI masks.

Since the Nicira Extended Match was specified nicira-ext.h has claimed that
arbitrary masks are allowed, but in fact only certain masks were actually
implemented.  This commit implements general masking for the 802.1Q VLAN
TCI field.

13 years agodebian: Change architectures from "any" to "linux-any".
Ben Pfaff [Mon, 22 Nov 2010 17:27:31 +0000 (09:27 -0800)]
debian: Change architectures from "any" to "linux-any".

This should prevent Debian builds from failing on non-GNU/Linux
architectures (or possibly succeeding but producing a binary that is not
useful).

13 years agoofp-util: Make make_flow_mod() take cls_rule instead of struct flow.
Ben Pfaff [Wed, 10 Nov 2010 22:51:49 +0000 (14:51 -0800)]
ofp-util: Make make_flow_mod() take cls_rule instead of struct flow.

This reduces code duplication, by eliminating a function that translates
from "struct flow" to "struct ofp_match" in favor of the existing function
ofputil_cls_rule_to_match().  It also allows the caller to specify the
desired priority (as part of the cls_rule).

13 years agoflow: Fully separate flow_wildcards from OpenFlow wildcard bits.
Ben Pfaff [Wed, 10 Nov 2010 22:39:54 +0000 (14:39 -0800)]
flow: Fully separate flow_wildcards from OpenFlow wildcard bits.

Originally, wildcards were just the OpenFlow OFPFW_* bits.  Then, when
OpenFlow added CIDR masks for IP addresses, struct flow_wildcards was born
with additional members for those masks, derived from the wildcard bits.
Then, when OVS added support for tunnels, we added another bit
NXFW_TUN_ID that coexisted with the OFPFW_*.  Later we added even more bits
that do not appear in the OpenFlow 1.0 match structure at all.  This had
become really confusing, and the difficulties were especially visible in
the long list of invariants in comments on struct flow_wildcards.

This commit cleanly separates the OpenFlow 1.0 wildcard bits from the
bits used inside Open vSwitch, by defining a new set of bits that are
used only internally to Open vSwitch and converting to and from those
wildcard bits at the point where data comes off or goes onto the wire.
It also moves those functions into ofp-util.[ch] since they are only for
dealing with OpenFlow wire protocol now.

13 years agoflow: Remove flow_to/from_match() in favor of cls_rule_to/from_match().
Ben Pfaff [Mon, 22 Nov 2010 18:10:14 +0000 (10:10 -0800)]
flow: Remove flow_to/from_match() in favor of cls_rule_to/from_match().

The flow_from_match() and flow_to_match() functions have to deal with most
of the state in a cls_rule anyhow, and this will increase in upcoming
commits, to the point that we might as well just use a cls_rule anyhow.
This commit therefore deletes flow_from_match() and flow_to_match(),
integrating their code into cls_rule_from_match() and the new function
cls_rule_to_match(), respectively.  It also changes each of the functions'
callers to use the new cls_rule_*() function.

13 years agoflow: Move functions for dealing with wildcard bit counts to ofp-util.
Ben Pfaff [Mon, 22 Nov 2010 18:09:18 +0000 (10:09 -0800)]
flow: Move functions for dealing with wildcard bit counts to ofp-util.

These functions are really OpenFlow-specific, and they will not be used
directly by the flow code soon, so move them to ofp-util.

13 years agoflow: New function flow_wildcards_is_exact().
Ben Pfaff [Tue, 9 Nov 2010 00:45:00 +0000 (16:45 -0800)]
flow: New function flow_wildcards_is_exact().

13 years agoofp-print: Avoid converting flow to ofp_match just to format it.
Ben Pfaff [Tue, 9 Nov 2010 00:36:44 +0000 (16:36 -0800)]
ofp-print: Avoid converting flow to ofp_match just to format it.

These days we have a function to format a struct flow directly, so we might
as well use it.

13 years agoclassifier: New function cls_rule_equal().
Ben Pfaff [Tue, 9 Nov 2010 00:35:34 +0000 (16:35 -0800)]
classifier: New function cls_rule_equal().

13 years agoclassifier: Fix segfault iterating with rules that differ only in priority.
Ben Pfaff [Sat, 20 Nov 2010 00:41:02 +0000 (16:41 -0800)]
classifier: Fix segfault iterating with rules that differ only in priority.

When CLS_CURSOR_FOR_EACH(_SAFE) iterated through a classifier, the
cls_cursor_next() function did not properly handle the case where there was
more than a single rule on a list.  This commit fixes the problem.

The addition to the testsuite would have found the problem earlier.

Reported-by: Teemu Koponen <koponen@nicira.com>
CC: Teemu Koponen <koponen@nicira.com>
13 years agonetdev-vport: Fix segfault on bad vport configuration.
Ben Pfaff [Fri, 19 Nov 2010 21:07:56 +0000 (13:07 -0800)]
netdev-vport: Fix segfault on bad vport configuration.

When a vport parse error occurs, the vport_class's parse_config function
doesn't necessarily store a valid pointer into the vport_info's 'config'
member, so netdev_vport_create() needs to supply a null pointer here to
avoiding passing a wild pointer to free().

13 years agoovs-vsctl: Fix br-set-external-id.
Ben Pfaff [Thu, 18 Nov 2010 22:36:53 +0000 (14:36 -0800)]
ovs-vsctl: Fix br-set-external-id.

The wrong prerequisite function was being called for set-br-external-id, so
it didn't set up to monitor the right columns, so an assertion failed.
This fixes the problem.

Also, change the test for external IDs so that it will find the regression.
(Running all of the ovs-vsctl commands together caused the column to be
monitored due to another command's intervention.)

Reported-by: Mikael Doverhag <mdoverhag@nicira.com>
Bug #4095.

13 years agodpif: Make dpif_class 'open' function take class instead of type name.
Ben Pfaff [Thu, 18 Nov 2010 18:06:41 +0000 (10:06 -0800)]
dpif: Make dpif_class 'open' function take class instead of type name.

This makes it easier for dpif_provider implementations to share code but
distinguish the class actually in use, because comparing a pointer is
easier than comparing a string.

13 years agodpif: Use caller-provided dpif_class in dp_register_provider().
Ben Pfaff [Thu, 18 Nov 2010 18:07:48 +0000 (10:07 -0800)]
dpif: Use caller-provided dpif_class in dp_register_provider().

I don't see a reason here to copy the dpif_class instead of using the
pointer provided by the caller.  Using the caller's pointer allows the
caller to compare a dpif's 'class' member against the address of its
class structure, which seems like a reasonable thing to do.

13 years agolib: Remove redundant dhparams.h from EXTRA_DIST.
Ben Pfaff [Fri, 12 Nov 2010 23:49:16 +0000 (15:49 -0800)]
lib: Remove redundant dhparams.h from EXTRA_DIST.

This is redundant since it's also in lib_libopenvswitch_a_SOURCES.

Also, remove duplicate blank line.

13 years agonetdev-vport: Remove OVS_UNUSED from argument that is actually used.
Ben Pfaff [Thu, 11 Nov 2010 23:48:41 +0000 (15:48 -0800)]
netdev-vport: Remove OVS_UNUSED from argument that is actually used.

13 years agoofp-util: Consistently treat OpenFlow xids as network byte order.
Ben Pfaff [Tue, 16 Nov 2010 19:00:25 +0000 (11:00 -0800)]
ofp-util: Consistently treat OpenFlow xids as network byte order.

The 'xid' in an ofp_header is not interpreted by the receiver but only by
the sender, so it need not be in any particular byte order.  OVS used to
try to take advantage of this to avoid host/network byte order conversions
for this field.  Older code in OVS, therefore, treats xid as being in host
byte order.  However, as time went on, I forgot that I had introduced this
trick, and so newer code treats xid as being in network byte order.

This commit fixes up the situation by consistently treating xid as being
in network byte order.  I think that this will be less surprising and
easier to remember in the future.

This doesn't fix any actual bugs except that some log messages would have
printed xids in the wrong byte order.

13 years agoofp-util: Use a counter for transaction IDs instead of a random number.
Ben Pfaff [Mon, 15 Nov 2010 19:04:40 +0000 (11:04 -0800)]
ofp-util: Use a counter for transaction IDs instead of a random number.

I don't know of any reason why the transaction id should be random.  Using
consecutive ids means that there is no chance that two messages sent around
the same time will have the same transaction ID, which is probabilitically
possible with random IDs.

13 years agonetdev-vport: Fix poll_add() implementation.
Ben Pfaff [Mon, 15 Nov 2010 20:48:31 +0000 (12:48 -0800)]
netdev-vport: Fix poll_add() implementation.

The existing implementation never worked because it used different strings
for notifier shash addition and lookup: for adding to the shash, it used
the vport name; for lookup, it used "<type>:<name>".  This fixes the
problem, by using "<type>:<name>" in both cases.

13 years agoovs-ofctl: Fix return value of str_to_port_no().
Ben Pfaff [Tue, 16 Nov 2010 18:25:22 +0000 (10:25 -0800)]
ovs-ofctl: Fix return value of str_to_port_no().

The index into the array of ports returned in the OFPT_FEATURES_REPLY
message is not necessarily the same as the port number, so this fixes a
real bug.

13 years agoMake the "exit" unixctl command reliable in ovsdb-server, ovs-vswitchd.
Ben Pfaff [Tue, 16 Nov 2010 23:14:58 +0000 (15:14 -0800)]
Make the "exit" unixctl command reliable in ovsdb-server, ovs-vswitchd.

If "ovs-appctl exit" happens to hit ovsdb-server or ovs-vswitchd at a
moment when nothing else is happening to wake the daemon up, it can take a
long time for them to exit.

This seems to account for occasional "make check" failures on Nicira's
internal builds.  It probably fixes some Debian automatic build failures
as well.

13 years agodebian: Ignore python-openvswitch directory.
Ben Pfaff [Tue, 16 Nov 2010 23:13:10 +0000 (15:13 -0800)]
debian: Ignore python-openvswitch directory.

This directory is created as part of the Debian build.

13 years agodebian: Fix parallel builds.
Ben Pfaff [Tue, 16 Nov 2010 22:09:41 +0000 (14:09 -0800)]
debian: Fix parallel builds.

Some of the Debian automatic builds are failing apparently because the
build-arch and build-indep targets are being called in parallel and they
are both attempting to rebuild tests/testsuite at the same time, which
doesn't work.  We could make the OVS makefiles handle this particular case,
but in general it's not a good idea to independently invoke a single
makefile multiples times in parallel, so this commit avoids that problem.

This also dumps the DEB_BUILD_OPTIONS variable to the log, because there
doesn't appear to be any way to infer it from the automatic builders'
log files.

13 years agodebian: On "make check" failure dump the testsuite log.
Ben Pfaff [Tue, 16 Nov 2010 22:06:31 +0000 (14:06 -0800)]
debian: On "make check" failure dump the testsuite log.

The Debian automatic build machines don't save any files from the build,
but they do preserve the build log, so dumping it to stdout is the only
reasonable way to get test failure information.

13 years agocsum: Avoid misaligned data access.
Ben Pfaff [Tue, 16 Nov 2010 20:52:10 +0000 (12:52 -0800)]
csum: Avoid misaligned data access.

This should fix a checksum test failure observed on Alpha in Debian's
buildds.

13 years agotest-csum: Make test_case requirements clear.
Ben Pfaff [Tue, 16 Nov 2010 20:51:08 +0000 (12:51 -0800)]
test-csum: Make test_case requirements clear.

This test code only works properly with test cases whose data is a multiple
of 4, so make that clear in the code and the data.

13 years agoovs-vsctl: Make waiting for ovs-vswitchd to reload work again.
Ben Pfaff [Tue, 16 Nov 2010 20:23:12 +0000 (12:23 -0800)]
ovs-vsctl: Make waiting for ovs-vswitchd to reload work again.

Bug introduced in commit e5e12280e "ovs-vsctl: Replicate only tables and
columns that are actually needed."

Reported-by: Paul Ingram <paul@nicira.com>
13 years agoovs-vsctl: Replicate only tables and columns that are actually needed.
Ben Pfaff [Tue, 16 Nov 2010 17:15:40 +0000 (09:15 -0800)]
ovs-vsctl: Replicate only tables and columns that are actually needed.

Until now, ovs-vsctl has always fetched a complete replica of the Open
vSwitch database at startup time.  This is a little expensive, but that is
not normally a problem because the database is small.   However, it can
cause problems when Open vSwitch is partially upgraded: if ovs-vsctl is
upgraded before the database, and new columns or tables were added to the
database schema in the newer version of Open vSwitch, then ovs-vsctl will
report an error and fail to work, because it cannot monitor the new
columns.  The same problem occurs if the database is upgraded before
ovs-vsctl and columns or tables were removed in the new version of Open
vSwitch.

This commit fixes the problem in the most common case, by making ovs-vsctl
only replicate the columns and tables in the database that it will actually
use during a given execution.  This will still fail if the database has
changed in major ways, but only if the changes would actually cause
problems for what ovs-vsctl is trying to do anyhow.

Bug #3388.

13 years agoovsdb-idl: Make selecting tables and columns to replicate more flexible.
Ben Pfaff [Tue, 16 Nov 2010 17:14:52 +0000 (09:14 -0800)]
ovsdb-idl: Make selecting tables and columns to replicate more flexible.

Until now, by default the IDL replicated all tables and all columns in the
database, and a few functions made it possible to avoid replicating
selected columns.  This commit adds a mode in which nothing is replicated
by default and the client code is responsible for specifying each column
and table that it is interested in.  The following commit adds a user for
this mode.

13 years agoovsdb: Support replicating a table without including any columns.
Ben Pfaff [Mon, 30 Aug 2010 21:12:27 +0000 (14:12 -0700)]
ovsdb: Support replicating a table without including any columns.

The OVSDB wire protocol has a "monitor" feature that supports table
replication on a column-by-column basis.  This wire protocol in theory
supports replicating a table without replicating any columns in it.  In
such a case, the client only tracks the UUIDs of the rows in the table.
However, the ovsdb-server implementation did not support this possibility
properly.  This commit fixes the bug.

13 years agoclassifier: Remove classifier_for_each(), classifier_for_each_match().
Ben Pfaff [Thu, 28 Oct 2010 23:19:45 +0000 (16:19 -0700)]
classifier: Remove classifier_for_each(), classifier_for_each_match().

These functions no longer have any users.

13 years agoofproto: Fix typo in comment.
Ben Pfaff [Mon, 15 Nov 2010 23:10:01 +0000 (15:10 -0800)]
ofproto: Fix typo in comment.

Reported-by: Ethan Jackson <ethan@nicira.com>
13 years agoclassifier: Add functions and macros for iteration, and use them in ofproto.
Ben Pfaff [Thu, 28 Oct 2010 23:18:20 +0000 (16:18 -0700)]
classifier: Add functions and macros for iteration, and use them in ofproto.

This is much more convenient in practice than being forced to use a
callback function.

13 years agoofproto: Always set VLAN_CFI bit to 0 in ODPAT_SET_DL_TCI action.
Ben Pfaff [Mon, 15 Nov 2010 22:53:23 +0000 (14:53 -0800)]
ofproto: Always set VLAN_CFI bit to 0 in ODPAT_SET_DL_TCI action.

The kernel requires VLAN_CFI to be 0, not 1.

Reported-by: Teemu Koponen <koponen@nicira.com>
Tested-by: Teemu Koponen <koponen@nicira.com>
13 years agodebian: Add procps to Build-Depends.
Ben Pfaff [Mon, 15 Nov 2010 18:21:33 +0000 (10:21 -0800)]
debian: Add procps to Build-Depends.

"make check" runs "ps" so the procps package is necessary.  With this
change, I was able on Friday to make the Open vSwitch Debian packages build
successfully under the "sbuild" suite used by the Debian autobuilders, so
I hope that this fixes at least some of the Debian buildd problems.

CC: Simon Horman <horms@verge.net.au>
Debian bug #602891.

13 years agoutil: Add function hexits_value() for parsing multiple hex digits.
Ben Pfaff [Mon, 15 Nov 2010 18:18:10 +0000 (10:18 -0800)]
util: Add function hexits_value() for parsing multiple hex digits.

Suggested-by: Justin Pettit <jpettit@nicira.com>
13 years agonicira-ext: New Nicira vendor action NXAST_NOTE.
Ben Pfaff [Sat, 13 Nov 2010 00:23:26 +0000 (16:23 -0800)]
nicira-ext: New Nicira vendor action NXAST_NOTE.

Our controller group at Nicira has requested a way to annotate flows with
extra information beyond the flow cookie.  The new NXAST_NOTE action
provides such a way.

This new action is somewhat controversial.  Some have suggested that it
should be added another way (either as part of the Nicira Extended Match
or as a new component of the flow_mod and related messages).  Others think
that it has no place in the OpenFlow protocol at all and that an equivalent
should be implemented using the already available features of OVSDB.  So
it is possible that this extension will be deleted and the feature will
be reimplemented some other way (or not at all).

CC: Teemu Koponen <koponen@nicira.com>
CC: Jeremy Stribling <strib@nicira.com>
13 years agoofp-util: Add OFP_ACTION_ALIGN macro to header.
Ben Pfaff [Thu, 11 Nov 2010 00:22:18 +0000 (16:22 -0800)]
ofp-util: Add OFP_ACTION_ALIGN macro to header.

It seems that this should really be in openflow.h but so far it isn't.

13 years agovswitch: Add other-config:in-band-queue to set queue for in-band control.
Ben Pfaff [Tue, 2 Nov 2010 17:45:33 +0000 (10:45 -0700)]
vswitch: Add other-config:in-band-queue to set queue for in-band control.

Until now, in-band control traffic has always gone to the default queue,
typically queue 0.  It makes sense to be able to assing control traffic to
its own queue, so this commit enables that.

Bug #3653.

13 years agorandom: Add entropy test.
Ben Pfaff [Mon, 15 Nov 2010 17:34:18 +0000 (09:34 -0800)]
random: Add entropy test.

This test would have made the bug fixed in the previous commit obvious.  It
would have printed the following:

average=0007c220

bit      0     1
  0  5012  4988
  1  5019  4981
  2  5154  4846
  3  4909  5091
  4  5011  4989
  5  5021  4979
  6  4911  5089
  7  4910  5090
  8  5011  4989
  9  5020  4980
 10  5154  4846
 11  5021  4979
 12  5155  4845
 13  5019  4981
 14  5153  4847
 15  5153  4847
 16  5153  4847
 17  5153  4847
 18  5153  4847
 19  5152  4848
 20 10000     0
 21 10000     0
 22 10000     0
 23 10000     0
 24 10000     0
 25 10000     0
 26 10000     0
 27 10000     0
 28 10000     0
 29 10000     0
 30 10000     0
 31 10000     0
(expected values are 5000)

nibble   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
     0 696 646 564 693 542 545 612 611 687 663 645 560 674 566 592 704
     1 625 589 597 571 638 623 604 663 670 652 650 557 541 683 686 651
     2 628 644 659 672 648 569 585 616 623 647 681 600 586 675 601 566
     3 683 665 717 549 633 613 701 592 663 531 545 800 623 608 590 487
     4 622 657 777 557 720 608 613 598 657 678 551 654 615 596 598 499
     5 10000   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
     6 10000   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
     7 10000   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
(expected values are 625)

13 years agorandom: Fix random number generator.
Ben Pfaff [Sat, 13 Nov 2010 01:02:17 +0000 (17:02 -0800)]
random: Fix random number generator.

As written, this "32-bit" random number generator nevers returns a value
bigger than 0xfffe0.  This fixes the problem.

13 years agohmap: New macro HMAP_FOR_EACH_CONTINUE.
Ben Pfaff [Thu, 28 Oct 2010 23:17:29 +0000 (16:17 -0700)]
hmap: New macro HMAP_FOR_EACH_CONTINUE.

13 years agoclassifier: Delete dead code specialized for the exact table.
Ben Pfaff [Thu, 11 Nov 2010 23:08:35 +0000 (15:08 -0800)]
classifier: Delete dead code specialized for the exact table.

These functions and macros are no longer used.

13 years agoclassifier: Drop CLS_INC_* enumerations and related 'include' parameters.
Ben Pfaff [Thu, 28 Oct 2010 20:26:31 +0000 (13:26 -0700)]
classifier: Drop CLS_INC_* enumerations and related 'include' parameters.

This type and these parameters were useful when ofproto had the need to
separately traverse exact-match rules looking for subrules, but it no
longer does that because subrules (now called "facets") are not kept in
the classifier any longer.  All the callers are now passing CLS_INC_ALL
anyhow, so we might as well delete this feature and simplify the code.

13 years agotest-classifier: Use get_unaligned_u32() from unaligned.h.
Ben Pfaff [Thu, 28 Oct 2010 20:20:23 +0000 (13:20 -0700)]
test-classifier: Use get_unaligned_u32() from unaligned.h.

There's no point in defining our own code to do this here.

13 years agoofproto: Simplify rule_insert().
Ben Pfaff [Fri, 12 Nov 2010 22:49:46 +0000 (14:49 -0800)]
ofproto: Simplify rule_insert().

There's no reason for the 'packet' and 'in_port' arguments; the caller can
call rule_execute() just as easily as rule_insert() can.

Suggested-by: Ethan Jackson <ethan@nicira.com>
13 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.

13 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.

13 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.

13 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.

13 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.

13 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.

13 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().

13 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.

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

13 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.

13 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>
13 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.

13 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.

13 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.

13 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>
13 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>
13 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.

13 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.

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

13 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>
13 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.

13 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".

13 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.

13 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.

13 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.

13 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).

13 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>
13 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>
13 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>
13 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?

13 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>
13 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>
13 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>
13 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>
13 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.

13 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.

13 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.

13 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.

13 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.

13 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.

13 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.

13 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.

13 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.

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

13 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().

13 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>
13 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.

13 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.

13 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>