sliver-openvswitch.git
12 years agoovs-openflowd: Rename test-openflowd and move to "tests" directory.
Ben Pfaff [Tue, 7 Jun 2011 16:40:53 +0000 (09:40 -0700)]
ovs-openflowd: Rename test-openflowd and move to "tests" directory.

Too many users thought that they needed to run ovs-openflowd at the same
time as ovs-vswitchd.  I hope that this change discourages them.

12 years agoovs-save: Fix address label processing.
Alexey I. Froloff [Tue, 7 Jun 2011 13:33:10 +0000 (17:33 +0400)]
ovs-save: Fix address label processing.

If there is a string in ip addr show output, that "coincide with the
name of the device or ... prefixed with the device name followed by
colon", consider this is an address label string.

Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agolearning-switch: Also wildcard VLAN priority bits.
Ben Pfaff [Wed, 1 Jun 2011 20:50:24 +0000 (13:50 -0700)]
learning-switch: Also wildcard VLAN priority bits.

There's no need to learn based on the priority bits so we might as well
wildcard them too.

Reported-by: Justin Pettit <jpettit@nicira.com>
12 years agoovsdb: Better document possible commit-time error results.
Ben Pfaff [Mon, 6 Jun 2011 18:27:44 +0000 (11:27 -0700)]
ovsdb: Better document possible commit-time error results.

CC: Jeremy Stribling <strib@nicira.com>
12 years agodpif-linux: Avoid duplicate code in dpif_linux_vport_send().
Ethan Jackson [Sat, 4 Jun 2011 00:15:12 +0000 (17:15 -0700)]
dpif-linux: Avoid duplicate code in dpif_linux_vport_send().

dpif_linux_vport_send() had duplicated most of the code in
dpif_linux_execute() in order to execute output actions in the
kernel.  This forces developers to remember to change both
functions whenever the kernel interface changes.  In particular,
commit 80e5eed9 "datapath: Get packet metadata from userspace in
odp_packet_cmd_execute()." broke netdev_linux_vport_send().  This
commit reorganizes the code and fixes the regression.

Bug #5818.

12 years agostream-ssl: Disable SSL session caching.
Ben Pfaff [Mon, 6 Jun 2011 16:43:48 +0000 (09:43 -0700)]
stream-ssl: Disable SSL session caching.

SSL session caching causes mysterious connection failure problems.

Bug #4448.
Bug #4501.

12 years agovswitchd: Add unique indexes for some columns.
Ben Pfaff [Mon, 6 Jun 2011 16:21:45 +0000 (09:21 -0700)]
vswitchd: Add unique indexes for some columns.

This is mainly intended to make life easier for database clients that don't
already have code to avoid creating records with duplicate names in various
OVS database tables.  With this commit, the database server itself rejects
attempts to add Port or Interface records with duplicate names or
Controller or Manager records with duplicate targets.

12 years agopython ovsdb: Fix one style inconsistency.
Ben Pfaff [Mon, 6 Jun 2011 16:09:47 +0000 (09:09 -0700)]
python ovsdb: Fix one style inconsistency.

Reported-by: Justin Pettit <jpettit@nicira.com>
12 years agoovsdb: Implement table uniqueness constraints ("indexes").
Ben Pfaff [Mon, 6 Jun 2011 16:09:10 +0000 (09:09 -0700)]
ovsdb: Implement table uniqueness constraints ("indexes").

12 years agoovsdb: Add functions for formatting column sets and data in columns sets.
Ben Pfaff [Mon, 6 Jun 2011 16:02:01 +0000 (09:02 -0700)]
ovsdb: Add functions for formatting column sets and data in columns sets.

These will be used for formatting error messages in an upcoming commit.

12 years agoutil: New function for forming English lists.
Ben Pfaff [Thu, 2 Jun 2011 17:47:18 +0000 (10:47 -0700)]
util: New function for forming English lists.

This follows the rules I learned in school.  Some locales may prefer to
omit the comma before "and" in a list of three or more items.

12 years agoovsdb: Move ovsdb_table_put_row() into test program.
Ben Pfaff [Wed, 1 Jun 2011 23:17:00 +0000 (16:17 -0700)]
ovsdb: Move ovsdb_table_put_row() into test program.

This function is not useful inside ovsdb itself but only in the
"test-ovsdb" test program.  To avoid the temptation to use it incorrectly
inside ovsdb, this commit moves it into the test program.

12 years agoovsdb: Make ovsdb_column_set_from_json() take table schema instead of table.
Ben Pfaff [Wed, 1 Jun 2011 23:14:46 +0000 (16:14 -0700)]
ovsdb: Make ovsdb_column_set_from_json() take table schema instead of table.

This function took a struct ovsdb_table but only used the 'schema' member.
An upcoming patch needs to parse a column set when only the schema is
available, so to prepare for that this patch changes
ovsdb_column_set_from_json() to only take the schema that it really needs.

12 years agotunneling: Warn if CAPWAP is not available on this kernel.
Jesse Gross [Thu, 2 Jun 2011 22:50:47 +0000 (15:50 -0700)]
tunneling: Warn if CAPWAP is not available on this kernel.

For most of our kernel module we support back to 2.6.18 but we only
work with 2.6.26 or newer for CAPWAP.  On later kernels support for
CAPWAP silently disappears.  In these situations, emit a warning so
that people aren't suprised when their tunnels fail.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Optimize datapath actions.
Ethan Jackson [Fri, 27 May 2011 17:48:58 +0000 (10:48 -0700)]
ofproto: Optimize datapath actions.

The translation from ofproto to datapath actions has historically
been fairly naive.  Since redundant ODP actions result in more code
execution in the fast path, this patch changes xlate_actions() to
emit fewer ODP actions for a given flow.

This change is not simply a theoretical optimization.  It actually
reduces the number of ODP actions for real flow tables which
Nicira's controllers use in practice.  Furthermore, removing
unnecessary modification actions after the last output action has
the added benefit of saving a whole skb_clone() in the fast path.

12 years agoofproto: Enqueue improperly resets priority.
Ethan Jackson [Tue, 31 May 2011 23:44:09 +0000 (16:44 -0700)]
ofproto: Enqueue improperly resets priority.

Before this patch, enqueue would reset the priority of a flow to
its original value instead of the value it had immediately before
the enqueue action.

Thus, these openflow actions:
set_queue:2,enqueue:1:1,output:1

Would get translated into these incorrect datapath actions:
set_priority(0x10003),set_priority(0x10002),1,pop_priority,1

Instead of these correct datapath actions:
set_priority(0x10003),set_priority(0x10002),1,set_priority(0x10003),1

A future patch will remove the redundant "set_priority(0x10003)".

Found by inspection.

12 years agodatapath: Get packet metadata from userspace in odp_packet_cmd_execute().
Ben Pfaff [Wed, 1 Jun 2011 20:39:51 +0000 (13:39 -0700)]
datapath: Get packet metadata from userspace in odp_packet_cmd_execute().

Until now, the tun_id and in_port have been lost when a packet is sent from
the kernel to userspace and then back to the kernel.  I didn't think that
this was a problem, but recent behavior made me look closer and see that
it makes a difference if sFlow is turned on or if an
ODP_ATTR_ACTION_CONTROLLER action is present.  We could possibly kluge
around those, but for future-proofing it seems better to pass the packet
metadata from userspace to the kernel.  That is what this commit does.

This commit introduces a user-kernel protocol break.  We could avoid that,
if it is desirable, by making ODP_PACKET_ATTR_KEY optional for
ODP_PACKET_CMD_EXECUTE commands.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agolearning-switch: Don't limit message queued by --with-flows.
Ben Pfaff [Wed, 1 Jun 2011 17:53:53 +0000 (10:53 -0700)]
learning-switch: Don't limit message queued by --with-flows.

queue_tx() intentionally limits the number of outstanding OpenFlow messages
queued to the switch.  This was unintentionally being applied to the
messages queued to the switch at startup by ovs-ofctl's --with-flows
command.  This patch should fix the problem, by calling rconn_send()
directly instead of through queue_tx().

Ahmed reported that with this patch there was still a problem when 30,000
flows were specified in the file.

Reported-by: Ahmed Bilal <numan252@gmail.com>
12 years agoovs-controller: Allow --wildcards to specify a wildcard set.
Ben Pfaff [Wed, 1 Jun 2011 16:09:20 +0000 (09:09 -0700)]
ovs-controller: Allow --wildcards to specify a wildcard set.

Based on a patch by Jean Tourrilhes <jt@hpl.hp.com>.  According to Jean,
besides increasing flexibility, this reduces  normalization warnings.

Tested-by: Jean Tourrilhes <jt@hpl.hp.com>
12 years agoofp-util: Factor wildcard translation out of ofputil_cls_rule_from_match().
Ben Pfaff [Tue, 31 May 2011 23:15:45 +0000 (16:15 -0700)]
ofp-util: Factor wildcard translation out of ofputil_cls_rule_from_match().

This seems like a small cleanup, plus the new function for translating
wildcards will be independently useful in an upcoming commit.

12 years agoofp-util: Simplify logic for computing vlan_tci and vlan_tci_mask.
Ben Pfaff [Tue, 31 May 2011 23:15:44 +0000 (16:15 -0700)]
ofp-util: Simplify logic for computing vlan_tci and vlan_tci_mask.

I believe that this is completely equivalent to, but simpler than, the code
that was here before.

12 years agonetdev: Remove monitors and notifiers.
Ethan Jackson [Thu, 26 May 2011 21:48:50 +0000 (14:48 -0700)]
netdev: Remove monitors and notifiers.

Neither of these constructs are used anymore.

12 years agobond: Discontinue use of netdev_monitor.
Ethan Jackson [Thu, 26 May 2011 21:45:11 +0000 (14:45 -0700)]
bond: Discontinue use of netdev_monitor.

12 years agoofproto: Discontinue use of netdev_monitor.
Ethan Jackson [Thu, 26 May 2011 21:40:05 +0000 (14:40 -0700)]
ofproto: Discontinue use of netdev_monitor.

12 years agonetdev: New Function netdev_change_seq().
Ethan Jackson [Thu, 26 May 2011 21:28:11 +0000 (14:28 -0700)]
netdev: New Function netdev_change_seq().

This new function will provide a much simpler replacement for
netdev_monitor in the future.

12 years agoovsdb: Check ovsdb_mutation_set_execute() return value in transactions.
Ben Pfaff [Tue, 31 May 2011 19:50:57 +0000 (12:50 -0700)]
ovsdb: Check ovsdb_mutation_set_execute() return value in transactions.

Errors from this function were being ignored, which meant that transactions
could use "mutate" to bypass number-of-elements constraints on sets and
maps.  This fixes the problem and adds a test to prevent the problem from
recurring.

Bug #5781.

12 years agoovsdb: Add test for number-of-elements constraints.
Ben Pfaff [Tue, 31 May 2011 19:48:49 +0000 (12:48 -0700)]
ovsdb: Add test for number-of-elements constraints.

This test already passes, but I did not see any existing test that checked
for this problem.

12 years agoovsdb: Fix spelling of "constraint violation" in error tag.
Ben Pfaff [Tue, 31 May 2011 18:30:16 +0000 (11:30 -0700)]
ovsdb: Fix spelling of "constraint violation" in error tag.

12 years agodatapath: Don't call genlmsg_reply() under rcu_read_lock().
Jesse Gross [Fri, 27 May 2011 22:57:28 +0000 (15:57 -0700)]
datapath: Don't call genlmsg_reply() under rcu_read_lock().

genlmsg_reply() indirectly makes a call to kmalloc but takes no
GFP flags, instead using GFP_ATOMIC if in a softirq and GFP_KERNEL
otherwise.  However, here we hold rcu_read_lock(), which requires
GFP_ATOMIC but is not a softirq.  Since we've already built the
reply message, it is safe to release rcu_read_lock(), so do that
before calling genlmsg_reply().

Signed-off-by: Jesse Gross <jesse@nicira.com>
CC: Hao Zheng <hzheng@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ofctl: Report attempts to add (remove, etc.) non-normalized flows.
Ben Pfaff [Tue, 10 May 2011 15:59:21 +0000 (08:59 -0700)]
ovs-ofctl: Report attempts to add (remove, etc.) non-normalized flows.

Commit 0b3f27253 (ovs-ofctl: Warn about flows not in normal form) made
ovs-ofctl warn about non-normalized flows, that is, flows some of whose
specified fields will be ignored by the switch.  This was convenient for
users, who are understandably confused by flow normalization.  However,
later commit 8050b31d6 (ofp-parse: Refactor flow parsing) accidentally
deleted the warning.  This commit restores it and adds a test to ensure
that it doesn't get deleted again later.

Reported-by: Reid Price <reid@nicira.com>
Bug #5029.

12 years agoofp-util: Export (again) a generalized function for normalizing rules.
Ben Pfaff [Mon, 9 May 2011 23:25:48 +0000 (16:25 -0700)]
ofp-util: Export (again) a generalized function for normalizing rules.

Feature #5029 requests that "ovs-ofctl add-flow" report an attempt to add
a flow that is not properly normalized, that is, a flow to which the switch
will add extra wildcards, ignoring some fields specified by the user.  This
requires that ofp-util make flow normalization directly available (again).

Until now, flow normalization has only been applied to OpenFlow 1.0 flows,
but the concept applies equally to NXM, so this commit generalizes the
implementation to NXM also.

12 years agonx-match: Check prerequisites for ICMPv6 before outputting subfields.
Ben Pfaff [Mon, 9 May 2011 23:21:00 +0000 (16:21 -0700)]
nx-match: Check prerequisites for ICMPv6 before outputting subfields.

nicira-ext.h documents that NXM_NX_ND_TARGET requires ND_NEIGHBOR_SOLICIT
or ND_NEIGHBOR_ADVERT, that NXM_NX_ND_SLL requires ND_NEIGHBOR_SOLICIT,
and that NXM_NX_ND_TLL requires ND_NEIGHBOR_ADVERT, but nx_put_match()
would add them to the match regardless of whether these prerequisites were
satisfied.  On the other side, nx_pull_match() did check the prerequisites,
so this was a case where OVS could output flows that it would refused to
parse.  This fixes the problem.

Found by inspection.

12 years agoofp-util: Also force nw_tos to be wildcarded for ARP flows.
Ben Pfaff [Mon, 9 May 2011 23:03:26 +0000 (16:03 -0700)]
ofp-util: Also force nw_tos to be wildcarded for ARP flows.

OVS doesn't fill nw_tos with anything meaningful for ARP flows so we should
also force nw_tos to be wildcarded for ARP.

12 years agopoll-loop: Fix typo in comment.
Ben Pfaff [Fri, 27 May 2011 16:13:50 +0000 (09:13 -0700)]
poll-loop: Fix typo in comment.

Reported-by: Ethan Jackson <ethan@nicira.com>
12 years agoCFM: Revert default MA and MD name.
Ethan Jackson [Thu, 26 May 2011 01:23:31 +0000 (18:23 -0700)]
CFM: Revert default MA and MD name.

Commit 84c5d450 "cfm: No longer allow configuration of ma_name and
md_name." changed the default MA and MD name for no reason.  This
could add needless complexity to situations where OVS instances
built before and after this commit need to speak CFM to each other.
This commit reverts to the old values.

12 years agoovs-vsctl: Clarify meaning of --may-exist options.
Ben Pfaff [Thu, 26 May 2011 17:14:30 +0000 (10:14 -0700)]
ovs-vsctl: Clarify meaning of --may-exist options.

CC: Jeremy Stribling <strib@nicira.com>
12 years agoovsdb-doc: Omit E-R diagram from ASCII version of manpage.
Ben Pfaff [Thu, 26 May 2011 16:06:10 +0000 (09:06 -0700)]
ovsdb-doc: Omit E-R diagram from ASCII version of manpage.

The E-R diagram is illegible when rendered in ASCII, so exclude it from
that version only.  The E-R diagram is still included in other versions of
the manpage (e.g. for PostScript output).

12 years agotest-csum: Avoid "cast increases required alignment of target type" warning.
Ben Pfaff [Tue, 24 May 2011 18:04:22 +0000 (11:04 -0700)]
test-csum: Avoid "cast increases required alignment of target type" warning.

Casting a character pointer to uint16_t * or uint32_t * provokes this
warning on sparc.  There is no actual problem, because all of the accesses
to data occurs through calls to the get_unaligned_*() functions, so this
commit suppresses the warning by using "void *" as an intermediate type.

12 years agobridge: Avoid "cast increases required alignment of target type" warning.
Ben Pfaff [Tue, 24 May 2011 18:02:31 +0000 (11:02 -0700)]
bridge: Avoid "cast increases required alignment of target type" warning.

This pointer arithmetic caused a warning on sparc.  One alternative would
be to add a cast through "void *", but it seems at least as reasonable to
just use a few macros to do direct assignments.

12 years agoin-band: Avoid "cast increases required alignment of target type" warning.
Ben Pfaff [Thu, 26 May 2011 16:03:03 +0000 (09:03 -0700)]
in-band: Avoid "cast increases required alignment of target type" warning.

Casting a struct ofp_action_output object's address to type union
ofp_action * provokes a warning on sparc.  It's easier to just declare
the object as having type union ofp_action, even though I don't think that
there is a real problem here.

12 years agosha1: Avoid unused variable warnings on big-endian systems.
Ben Pfaff [Tue, 24 May 2011 17:56:11 +0000 (10:56 -0700)]
sha1: Avoid unused variable warnings on big-endian systems.

12 years agonetlink: Avoid "cast increases required alignment of target type" on RISC.
Ben Pfaff [Tue, 24 May 2011 17:55:26 +0000 (10:55 -0700)]
netlink: Avoid "cast increases required alignment of target type" on RISC.

This warning doesn't indicate a genuine problem, since 'nla' must be
aligned properly and NLA_ALIGN ensures that the offset is aligned properly
too.  Casting via void * suppresses the warning.

12 years agobridge: Interface may be configured with incorrect QoS.
Ethan Jackson [Wed, 25 May 2011 20:23:49 +0000 (13:23 -0700)]
bridge: Interface may be configured with incorrect QoS.

Bug #5739.

12 years agocfm: Log sequence number of incoming CCMs.
Ethan Jackson [Mon, 23 May 2011 23:21:42 +0000 (16:21 -0700)]
cfm: Log sequence number of incoming CCMs.

12 years agocfm: Include cfm->name in log messages.
Ethan Jackson [Mon, 23 May 2011 23:10:25 +0000 (16:10 -0700)]
cfm: Include cfm->name in log messages.

12 years agocfm: Require 'name' field for 'cfm' objects.
Ethan Jackson [Mon, 23 May 2011 23:05:41 +0000 (16:05 -0700)]
cfm:  Require 'name' field for 'cfm' objects.

This commit also fixes a memory leak upon cfm_destroy() and
converts the 'all_cfms' list to a hash map.

12 years agoofproto: Fix possible core dump during flow revalidation.
Ethan Jackson [Tue, 24 May 2011 22:12:13 +0000 (15:12 -0700)]
ofproto: Fix possible core dump during flow revalidation.

This patch also prevents OVS from forwarding any LACP packets
whether or not LACP is enabled.  This is consistent with the
pre-next behavior.

Bug #5738.

12 years agoovs-vsctl: Add "show" command for printing an overview of configuration.
Ben Pfaff [Tue, 24 May 2011 20:03:58 +0000 (13:03 -0700)]
ovs-vsctl: Add "show" command for printing an overview of configuration.

12 years agoovsdb: Annotate E-R diagram with number of allowed values.
Ben Pfaff [Tue, 24 May 2011 19:32:01 +0000 (12:32 -0700)]
ovsdb: Annotate E-R diagram with number of allowed values.

This makes the diagram even more informative.

12 years agopoll-loop: Automatically log reason for wakeup when CPU usage spikes.
Ben Pfaff [Tue, 24 May 2011 19:23:42 +0000 (12:23 -0700)]
poll-loop: Automatically log reason for wakeup when CPU usage spikes.

For a long time, the poll-loop module has had the ability to log the reason
for wakeups, which is valuable for debugging excessive use of CPU time.
But I have to ask users to turn up the log level for the module, which
wastes their time and mine.  This commit improves the situation by
automatically logging the reason for a wakeup whenever a process's
estimated CPU usage rises above 50%.  (ovs-vswitchd often uses less than
1% CPU; more than 5% CPU is uncommon.)

12 years agoofproto-dpif: Fix statistics busted by bad merge.
Ben Pfaff [Wed, 18 May 2011 21:28:24 +0000 (14:28 -0700)]
ofproto-dpif: Fix statistics busted by bad merge.

This reimplements the statistics fixes originally implemented by the
following commits, which became broken by bad merges during the previous
"next" branch development cycle:

827ab71c97f "ofproto: Datapath statistics accounted twice."
6f1435fc8f7 "ofproto: Resubmit statistics improperly account during..."

12 years agotests: Fix the two Python XFAIL tests.
Ben Pfaff [Fri, 13 May 2011 21:20:10 +0000 (14:20 -0700)]
tests: Fix the two Python XFAIL tests.

OVS has two Python tests that have always failed, for reasons not
understood, since they were added to the tree.  This commit fixes them.

One problem was that Python was assuming that stdout was encoded in ASCII.
Apparently the only way to "fix" this at runtime is to set PYTHONIOENCODING
to utf_8 in the environment, so this change does that.

Second, it appears that Python really doesn't like to print invalid UTF-8,
so this avoids doing that in python/ovs/json.py, instead just printing
the hexadecimal values of the invalid bytes.  For consistency, it makes
the same change to the C version.

Third, the C version of test-ovsdb doesn't check UTF-8 for consistency, it
just sends it blindly to the OVSDB server, but Python does check it and so
it bails out earlier.  This commit changes the Python version of the
"no invalid UTF-8 sequences in strings" to allow for the slight difference
in output that occurs for that reason.

Finally, test-ovsdb.py needs to convert error messages to Unicode
explicitly before printing them in the "parse-atoms" function.  I don't
really understand why, but now it works.

12 years agoflow: Convert tunnel IDs to host byte order for formatting.
Ben Pfaff [Fri, 13 May 2011 17:38:35 +0000 (10:38 -0700)]
flow: Convert tunnel IDs to host byte order for formatting.

Reported-by: Pankaj Thakkar <thakkar@nicira.com>
12 years agostream-ssl: Log unexpected errors from 'stat'.
Ben Pfaff [Thu, 5 May 2011 18:25:51 +0000 (11:25 -0700)]
stream-ssl: Log unexpected errors from 'stat'.

A user report possibly implicates problems reading the mtime of the CA
cert file.  Until now, nothing has logged these errors.  This commit adds
such logging.

NICS-9.

12 years agostream-ssl: Force CA cert file to be read when it appears during bootstrap.
Ben Pfaff [Thu, 5 May 2011 17:59:50 +0000 (10:59 -0700)]
stream-ssl: Force CA cert file to be read when it appears during bootstrap.

A user report shows the message "reading CA cert
/etc/openvswitch/vswitchd.cacert created by another process" appearing
hundreds of times over a long period of time in the log.  The only way I
can see that this would happen is if update_ssl_config() returned false,
indicating that the CA cert does not need to be re-read because it has not
changed.  This commit should prevent that from happening.

We don't want to simply skip calling update_ssl_config() in this case,
because then the next call to stream_ssl_set_ca_cert_file() would usually
re-read the CA certificate, which is a waste of time.

Also, we might as well rate-limit the message.

NICS-9.

12 years agoofproto: Properly initialize table_id when creating rules.
Ben Pfaff [Thu, 19 May 2011 23:18:57 +0000 (16:18 -0700)]
ofproto: Properly initialize table_id when creating rules.

Nothing was initializing table_id, and there was no "hook" to choose an
appropriate table.  This fixes both problems.

Found by inspection.

12 years agodebian: Package ovsdbmonitor.
Ben Pfaff [Mon, 23 May 2011 20:31:17 +0000 (13:31 -0700)]
debian: Package ovsdbmonitor.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovsdbmonitor: Add brief manpage.
Ben Pfaff [Tue, 3 May 2011 16:53:41 +0000 (09:53 -0700)]
ovsdbmonitor: Add brief manpage.

12 years agoovsdbmonitor: Update to work with recent ovs-dpctl output.
Ben Pfaff [Mon, 2 May 2011 23:27:58 +0000 (16:27 -0700)]
ovsdbmonitor: Update to work with recent ovs-dpctl output.

The format of "ovs-dpctl dump-flows" has completely changed since
ovsdbmonitor was written.  It seems like no one has tried out ovsdbmonitor
since the rewrite, because it didn't work at all.  This commit fixes the
parser.

12 years agoovsdbmonitor: Use ovs.json module instead of JsonReader and JsonWriter.
Ben Pfaff [Mon, 2 May 2011 23:17:11 +0000 (16:17 -0700)]
ovsdbmonitor: Use ovs.json module instead of JsonReader and JsonWriter.

I can't figure out where JsonReader and JsonWriter come from.  I know that
they must exist, because I (and others) have used ovsdbmonitor before, but
I can't find them now.

Switch to using ovs.json, which is part of Open vSwitch so we know that
it exists.  At the same time, we have to start translating the Unicode
strings that ovs.json outputs into standard Python strings; otherwise
the "twisted conch" ssh implementation craps out because it tries to
concatenate this Unicode string with a standard string that contains
non-ASCII characters.

12 years agodocs: Suppress "warning: macro `DD' not defined" warnings from man.
Ben Pfaff [Tue, 3 May 2011 00:15:21 +0000 (17:15 -0700)]
docs: Suppress "warning: macro `DD' not defined" warnings from man.

deamon.man allows the file that is including it to include extra text in
the description of --detach by defining a macro named DD.  Only some of the
manpages that included it did this (only those manpages that needed extra
text there).  But it's better to be quiet in "man --warnings", so this
defines DD to an empty value in the other manpages that include daemon.man.

Reported by lintian.

12 years agodebian: Don't begin openvswitch-pki description with article.
Ben Pfaff [Tue, 3 May 2011 17:01:33 +0000 (10:01 -0700)]
debian: Don't begin openvswitch-pki description with article.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported by lintian.

12 years agodebian: Make openvswitch-switch depend on Python.
Ben Pfaff [Tue, 3 May 2011 16:59:42 +0000 (09:59 -0700)]
debian: Make openvswitch-switch depend on Python.

ovs-pcap,.ovs-tcpundump, and ovs-vlan-test are all written in Python, so
openvswitch-switch needs to depend on Python.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported by lintian.

12 years agoflow: flow_hash_symmetric_l4() don't hash UDP ports.
Ethan Jackson [Mon, 23 May 2011 18:39:17 +0000 (11:39 -0700)]
flow: flow_hash_symmetric_l4() don't hash UDP ports.

There is no reason to believe that the source and destination ports
will be symmetric in a bidirectional UDP stream.  This patch no
longer uses them for symmetric hashing.

12 years agobond: Always use L4 hash for stable bonds.
Ethan Jackson [Mon, 23 May 2011 18:37:15 +0000 (11:37 -0700)]
bond: Always use L4 hash for stable bonds.

Stable bonds are used in such specialized cases that it doesn't
make sense to require LACP negotiations to use L4 hashing.

12 years agoAvoid sparse error or warning for sizeof(_Bool).
Ben Pfaff [Thu, 12 May 2011 20:46:16 +0000 (13:46 -0700)]
Avoid sparse error or warning for sizeof(_Bool).

The sparse checker does not like taking sizeof(_Bool).  Older versions of
sparse output a hard error ("error: cannot size expression").  Newer
versions output a warning ("warning: expression using sizeof bool").  This
commit avoids the problem by not using sizeof(_Bool) anywhere.

The only place where OVS uses sizeof(_Bool) anyway is in code generated by
the OVSDB IDL.  It generates it for populating "optional bool" columns in
the database, that is, columns that are allowed to contain 0 or 1 instances
of a bool.  For these columns, it generates code that looks roughly like
this:
    row->column = xmalloc(sizeof *row->column);
    *row->column = value;
This commit changes these columns from type "bool *" to type "const bool *"
and changes the generated code to:
    static const bool true_value = true;
    static const bool false_value = false;

    row->column = value ? &true_value : &false_value;
which avoids the problem and saves a malloc() call at the same time.

The idltest code had a column with a slightly different type ("0, 1, or
2 bools") that didn't fit the revised pattern and is a fairly stupid type
anyhow, so I just changed it to "0 or 1 bools".

12 years agoofp-util: Include cookie when encoding OFPT_FLOW_REMOVED messages.
Ben Pfaff [Fri, 20 May 2011 23:42:40 +0000 (16:42 -0700)]
ofp-util: Include cookie when encoding OFPT_FLOW_REMOVED messages.

Reported-by: kk yap <yapkke@stanford.edu>
Tested-by: kk yap <yapkke@stanford.edu>
12 years agobond: Use CFM for slave status.
Ethan Jackson [Tue, 17 May 2011 00:19:48 +0000 (17:19 -0700)]
bond: Use CFM for slave status.

With this patch, if CFM is configured on a slave, and in a faulted
state, it will be disabled by the bond module.

12 years agocfm: Implement 802.1ag RDI flag.
Ethan Jackson [Tue, 17 May 2011 23:07:58 +0000 (16:07 -0700)]
cfm: Implement 802.1ag RDI flag.

According to the 802.1ag specification, a maintenance point should
set the Remote Defect Indicator (RDI) bit on CCMs when it has
failed to receive a CCM from any of it's configured remote
maintenance points within the required fault interval.  This allows
unidirectional faults to be flagged by both ends of a CFM monitored
tunnel.

12 years agocfm: Remove packet definition from CFM header file.
Ethan Jackson [Sat, 14 May 2011 01:11:43 +0000 (18:11 -0700)]
cfm: Remove packet definition from CFM header file.

This patch makes a stylistic improvement by removing CFM protocol
information from cfm.h.  In the process it changes
cfm_compose_ccm() to populate an ofpbuf instead of a struct ccm.

12 years agocfm: Cleanup CFM module interface.
Ethan Jackson [Fri, 13 May 2011 22:37:23 +0000 (15:37 -0700)]
cfm: Cleanup CFM module interface.

This patch makes the CFM module interface a bit more like the LACP
module interface.  In my opinion it's much cleaner.

12 years agocfm: Remove Maintenance_Point and Monitor tables.
Ethan Jackson [Thu, 12 May 2011 22:28:43 +0000 (15:28 -0700)]
cfm: Remove Maintenance_Point and Monitor tables.

In an effort to make CFM easier to understand and configure, this
patch removes the Maintenance_Point and Monitor tables from the
database.  As a consequence, users will only be able to configure
one remote maintenance point.  Furthermore, before this patch each
remote maintenance point maintained its own separate fault flag in
the database.  This flag is no longer reported, users will need to
infer the fault status from the global CFM fault flag.

12 years agocfm: No longer allow configuration of ma_name and md_name.
Ethan Jackson [Thu, 12 May 2011 23:08:52 +0000 (16:08 -0700)]
cfm: No longer allow configuration of ma_name and md_name.

These settings added complexity to the database and CFM module
interface with negligible benefit.  This patch removes them in such
a way that they can easily be re-added in the (unlikely) event that
we need them in the future.

12 years agocfm: Migrate cfm/show unixctl command to CFM module.
Ethan Jackson [Fri, 13 May 2011 23:53:24 +0000 (16:53 -0700)]
cfm: Migrate cfm/show unixctl command to CFM module.

This patch moves the cfm/show unixctl show command from the bridge
to the CFM module.  This is more in line with how LACP does it, and
will make future patches easier to implement.

12 years agobond: Remove useless slave->up flag.
Ethan Jackson [Thu, 19 May 2011 23:48:58 +0000 (16:48 -0700)]
bond: Remove useless slave->up flag.

Theres no longer any reason not to simply call netdev_get_carrier().

12 years agonetdev: Take responsibility for polling MII registers.
Ethan Jackson [Mon, 16 May 2011 21:40:03 +0000 (14:40 -0700)]
netdev: Take responsibility for polling MII registers.

This patch moves miimon logic from the bond module to netdev-linux.
This greatly simplifies the bonding code while adding minimal
complexity to netdev-linux.  The bonding code is so high level, it
really has no business worrying about how precisely slave status is
determined.

12 years agoxenserver: Pull slave MTU from bond record.
Ethan Jackson [Thu, 19 May 2011 22:52:54 +0000 (15:52 -0700)]
xenserver: Pull slave MTU from bond record.

The MTU of the fake bond interface and the slaves participating in
a bond should all agree.  The correct long term solution to this
problem is to remove the fake bond interface altogether.  Until
that's possible, we simply set the MTU of the slaves.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agodatapath: Check that netdev vport is fully initialized.
Jesse Gross [Thu, 19 May 2011 20:17:39 +0000 (13:17 -0700)]
datapath: Check that netdev vport is fully initialized.

Starting in 2.6.37 we have our own flag for identifying net_devices
as being attached to OVS.  However, it's possible to receive packets
before this flag has been applied, resulting in a NULL vport when
processing the packet.  This checks to make sure that the vport is
valid instead of crashing.

Bug #5675

Reported-by: Brad Hall <brad@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Fix compiler warning.
Ethan Jackson [Thu, 19 May 2011 01:07:57 +0000 (18:07 -0700)]
ofproto: Fix compiler warning.

ofproto/ofproto.c:1681:9: error: format '%d' expects argument of
type 'int', but argument 3 has type 'size_t'

12 years agotimer: Remove timer_expired_at() function.
Ethan Jackson [Thu, 19 May 2011 00:55:25 +0000 (17:55 -0700)]
timer: Remove timer_expired_at() function.

This function has no users, and is a bit of a kludge anyway.

12 years agoovs-bugtool: Add support for user-provided output filename.
Shih-Hao Li [Thu, 19 May 2011 18:03:21 +0000 (11:03 -0700)]
ovs-bugtool: Add support for user-provided output filename.

This change adds a new command-line parameter "--outfile" in ovs-bugtool.
So users can specify their own final output filename.

12 years agoofproto-dpif: Fix bond accounting.
Ben Pfaff [Wed, 18 May 2011 23:40:21 +0000 (16:40 -0700)]
ofproto-dpif: Fix bond accounting.

Calls to bond_account() and bond_choose_output_slave() had different ideas
for the vlan of a flow that did not have a tagged VLAN.  The call to
bond_choose_output_slave() passed OFP_VLAN_NONE in this case, the call to
bond_account() passed 0.  This meant that packets not on a VLAN weren't
accounted properly, which typically caused bond/show to show "0 kB load"
on active hashes.  Obviously that broke rebalancing too.

I've verified that this fixes accounting.  I haven't directly verified that
it fixes rebalancing, so it's possible that there is another issue too.

Reported-by: Michael Mao <mmao@nicira.com>
12 years agobond: Remove write-only variable.
Ben Pfaff [Wed, 18 May 2011 23:23:15 +0000 (16:23 -0700)]
bond: Remove write-only variable.

12 years agoofproto-dpif: Fix argument in send_packet() call.
Ben Pfaff [Wed, 18 May 2011 23:46:31 +0000 (16:46 -0700)]
ofproto-dpif: Fix argument in send_packet() call.

The second argument to send_packet() is an ODP port, not an OFP port, so
we need to use ODPP_LOCAL instead of OFPP_LOCAL.

13 years agoMerge 'next' into 'master'.
Ben Pfaff [Wed, 18 May 2011 21:01:13 +0000 (14:01 -0700)]
Merge 'next' into 'master'.

I know already that this breaks the statsfixes that were implemented by the
following commits:

827ab71c97f "ofproto: Datapath statistics accounted twice."
6f1435fc8f7 "ofproto: Resubmit statistics improperly account during..."

These were already broken in a previous merge.  I will work on a fix.

13 years agoofproto: Datapath statistics accounted twice.
Ethan Jackson [Wed, 18 May 2011 18:52:08 +0000 (11:52 -0700)]
ofproto: Datapath statistics accounted twice.

Due to an error introduced in  Commit 6f1435f "ofproto: Resubmit
statistics improperly account during failover." Flow statistics
could be double accounted when removed from the datapath.

Reported-by: KK Yap <yapkke@stanford.edu>
13 years agodatapath: Hash and compare only the part of sw_flow_key actually used.
Andrew Evans [Wed, 18 May 2011 18:30:07 +0000 (11:30 -0700)]
datapath: Hash and compare only the part of sw_flow_key actually used.

Currently the whole flow key struct is hashed on every packet received from the
network or userspace. The whole struct is also compared byte-for-byte when
doing flow table lookups. This consumes a fair percentage of CPU time, and most
of the time part of the structure is unused (e.g. the IPv6 fields when handling
IPv4 traffic; the IPv4 fields when handling Ethernet frames).

This commit reorders the fields in the flow key struct to put the least
commonly used elements at the end and changes the hash and comparison functions
to look only at the part that contains data.

Signed-off-by: Andrew Evans <aevans@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agoAdd tar.gz output option in ovs-bugtool
Shih-Hao Li [Wed, 18 May 2011 18:22:41 +0000 (11:22 -0700)]
Add tar.gz output option in ovs-bugtool

13 years agobridge: Fill in ofport column of Interface records.
Ben Pfaff [Wed, 18 May 2011 16:16:00 +0000 (09:16 -0700)]
bridge: Fill in ofport column of Interface records.

This was lost in the transition to the "next" branch.

13 years agoofproto-dpif: Revalidate flows in some previously missed cases.
Ben Pfaff [Tue, 17 May 2011 22:49:26 +0000 (15:49 -0700)]
ofproto-dpif: Revalidate flows in some previously missed cases.

Reported-by: Justin Pettit <jpettit@nicira.com>
Bug #5655.

13 years agoofproto-dpif: Avoid unnecessary ODP-to-OFP port conversion.
Ben Pfaff [Tue, 17 May 2011 22:46:32 +0000 (15:46 -0700)]
ofproto-dpif: Avoid unnecessary ODP-to-OFP port conversion.

13 years agobond: Bonds never sleep if carrier changes.
Ethan Jackson [Tue, 17 May 2011 20:47:23 +0000 (13:47 -0700)]
bond: Bonds never sleep if carrier changes.

The bonding code neglected to call netdev_monitor_poll() on its
monitor during bond_run().  Thus carrier changes would be
permanently queued in the monitor, preventing it from ever allowing
poll_loop to sleep.

13 years agoofproto-dpif: Fix null pointer dereference in is_admissible().
Ben Pfaff [Tue, 17 May 2011 20:41:32 +0000 (13:41 -0700)]
ofproto-dpif: Fix null pointer dereference in is_admissible().

If in_port is NULL then we must not dereference it.

13 years agoxenserver: remove unneeded macro definitions
Sajjad Lateef [Tue, 17 May 2011 02:16:51 +0000 (19:16 -0700)]
xenserver: remove unneeded macro definitions

The macro binsuffix is no longer needed. It has been replaced with
kernel_flavor that is passed on the command line.

The macro kernel_version is passed on the command line. Redefining
the macro inside the spec file leads to build failures.

Signed-off-by: Sajjad Lateef <slateef@nicira.com>
13 years agoxenserver: remove unneeded macro definitions
Sajjad Lateef [Tue, 17 May 2011 02:15:59 +0000 (19:15 -0700)]
xenserver: remove unneeded macro definitions

The macro binsuffix is no longer needed. It has been replaced with
kernel_flavor that is passed on the command line.

The macro kernel_version is passed on the command line. Redefining
the macro inside the spec file leads to build failures.

Signed-off-by: Sajjad Lateef <slateef@nicira.com>
13 years agoxenserver: modify module spec file
Sajjad Lateef [Tue, 17 May 2011 00:29:04 +0000 (17:29 -0700)]
xenserver: modify module spec file

Based on feedback from Citrix about building for multiple kernels,
the spec file has been modified to take three arguments on the
command line: kernel_name, kernel_version and kernel_flavor.

The kernel_flavor is either xen or kdump. The kernel_name is the
Name value embedded in the kernel rpm and the kernel_version
is Version-Release values embedded in the kernel rpm. The
xen_version is calculated.

The INSTALL document has been updated to reflect these changes.

Signed-off-by: Sajjad Lateef <slateef@nicira.com>
(cherry picked from commit b11e4aa7e92854612a4d139b8a620d036a5d41a2)

13 years agoxenserver: modify module spec file
Sajjad Lateef [Tue, 17 May 2011 00:24:20 +0000 (17:24 -0700)]
xenserver: modify module spec file

Based on feedback from Citrix about building for multiple kernels,
the spec file has been modified to take three arguments on the
command line: kernel_name, kernel_version and kernel_flavor.

The kernel_flavor is either xen or kdump. The kernel_name is the
Name value embedded in the kernel rpm and the kernel_version
is Version-Release values embedded in the kernel rpm. The
xen_version is calculated.

The INSTALL document has been updated to reflect these changes.

Signed-off-by: Sajjad Lateef <slateef@nicira.com>
(cherry picked from commit b11e4aa7e92854612a4d139b8a620d036a5d41a2)

13 years agoconfigure: Run sparse automatically if C=1 specified on "make" command.
Ben Pfaff [Fri, 6 May 2011 20:00:49 +0000 (13:00 -0700)]
configure: Run sparse automatically if C=1 specified on "make" command.

The C=1 convention matches the kernel's convention, so running "make C=1"
will now get sparse results for both userspace and kernel compiles.

13 years agoMake the source tree sparse clean.
Ben Pfaff [Fri, 6 May 2011 19:59:51 +0000 (12:59 -0700)]
Make the source tree sparse clean.

With this commit, the tree compiles clean with sparse commit 87f4a7fda3d
"Teach 'already_tokenized()' to use the stream name hash table" with patch
"evaluate: Allow sizeof(_Bool) to succeed" available at
http://permalink.gmane.org/gmane.comp.parsers.sparse/2461 applied, as long
as the "include/sparse" directory is included for use by sparse (only),
e.g.:
     make CC="CHECK='sparse -I../include/sparse' cgcc"

13 years agotest-sha1: Suppress sparse warning.
Ben Pfaff [Fri, 6 May 2011 19:39:27 +0000 (12:39 -0700)]
test-sha1: Suppress sparse warning.

Otherwise sparse warns: warning: memset with byte count of 1000000