openvswitch
13 years agoofproto-dpif: Flush flows before dpif_recv_set_mask().
Jesse Gross [Fri, 16 Sep 2011 16:50:35 +0000 (09:50 -0700)]
ofproto-dpif: Flush flows before dpif_recv_set_mask().

Now that upcalls from the kernel use unicast sockets, we need to
tell the kernel where to send them explicitly.  This means that
when the switch is restarted it's necessary to take control of any
existing objects, which is done when the dpif listen mask becomes
non-zero.  Since we're going to blow away the flows anyways, we
might as well do it before going through the trouble of updating
all of them.

13 years agodatapath: Use unicast Netlink sockets for upcalls.
Jesse Gross [Wed, 14 Sep 2011 20:05:09 +0000 (13:05 -0700)]
datapath: Use unicast Netlink sockets for upcalls.

Currently we publish several multicast groups for upcalls and let
userspace sockets subscribe to them.  The benefit of this is mostly
that userspace is the one doing the subscription - the actual
multicast capability is not currently used and probably wouldn't be
even if we moved to a multiprocess model.  Despite the convenience,
multicast sockets have a number of disadvantages, primarily that
we only have a limited number of them so there could be collisions.
In addition, unicast sockets give additional flexibility to userspace
by allowing every object to potentially have a different socket
chosen by userspace for upcalls.  Finally, any future optimizations
for upcalls to reduce copying will likely not be compatible with
multicast anyways so disallowing it potentially simplifies things.

We also never unregistered the multicast groups registered for upcalls
and leaked them on module unload.  As a side effect, this solves that
problem.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agonetlink: Expose method to get Netlink pid of a socket.
Jesse Gross [Fri, 16 Sep 2011 16:37:16 +0000 (09:37 -0700)]
netlink: Expose method to get Netlink pid of a socket.

In the future, the kernel will use unicast messages instead of
multicast to send upcalls.  As a result, we need to be able to
tell it where to direct the traffic.  This adds a function to expose
the Netlink pid of a socket so it can be included in messages to the
kernel.

13 years agotests: test-jsonrpc.py whitespace cleanup.
Ethan Jackson [Fri, 23 Sep 2011 22:24:10 +0000 (15:24 -0700)]
tests: test-jsonrpc.py whitespace cleanup.

Pleases pep8.

13 years agotests: test-jsonrpc references nonexistent variable.
Ethan Jackson [Sat, 17 Sep 2011 05:37:26 +0000 (22:37 -0700)]
tests: test-jsonrpc references nonexistent variable.

13 years agotag: Fix typo in comment.
Ben Pfaff [Wed, 21 Sep 2011 17:09:00 +0000 (10:09 -0700)]
tag: Fix typo in comment.

13 years agopython: Implement write support in Python IDL for OVSDB.
Ben Pfaff [Wed, 21 Sep 2011 17:43:03 +0000 (10:43 -0700)]
python: Implement write support in Python IDL for OVSDB.

Until now, the Python bindings for OVSDB have not supported writing to the
database.  Instead, writes had to be done with "ovs-vsctl" subprocesses.
This commit adds write support and brings the Python bindings in line with
the C bindings.

This commit deletes the Python-specific IDL tests in favor of using the
same tests as the C version of the IDL, which now pass with both
implementations.

This commit updates the two users of the Python IDL to use the new write
support.  I tested this updates only by writing unit tests for them,
which appear in upcoming commits.

13 years agoovs.db.types: Add table reference to ovs.db.types.BaseType.
Ben Pfaff [Tue, 20 Sep 2011 18:24:44 +0000 (11:24 -0700)]
ovs.db.types: Add table reference to ovs.db.types.BaseType.

Until now ovs.db.types.BaseType has kept track of the name of the
referenced table but not a reference to it.  This commit renames the
ref_table attribute to ref_table_name and adds a new ref_table attribute
whose value is a reference to the named table.

This will be useful in an upcoming commit where table references are
actually followed.

13 years agopython: Accept multiple forms of strings and lists when parsing JSON.
Ben Pfaff [Fri, 16 Sep 2011 00:17:36 +0000 (17:17 -0700)]
python: Accept multiple forms of strings and lists when parsing JSON.

The JSON parser in OVS always yields unicode strings and lists, never
non-unicode strings or tuples, but it's easy to create them when building
JSON elsewhere, so accept both forms.

13 years agopython: Change 'clone' function names to 'copy'.
Ben Pfaff [Thu, 15 Sep 2011 22:31:12 +0000 (15:31 -0700)]
python: Change 'clone' function names to 'copy'.

It seems that 'copy' is the proper name for this kind of function in
Python, based on the existence of dict.copy().

13 years agoovs.ovsuuid: Get rid of ovs.ovsuuid.UUID class.
Ben Pfaff [Wed, 21 Sep 2011 17:59:36 +0000 (10:59 -0700)]
ovs.ovsuuid: Get rid of ovs.ovsuuid.UUID class.

This class only caused unnecessary confusion.  This commit changes all of
its methods into top-level functions.

13 years agotests: Fix typos in C versions of test-ovsdb error messages.
Ben Pfaff [Thu, 15 Sep 2011 20:02:29 +0000 (13:02 -0700)]
tests: Fix typos in C versions of test-ovsdb error messages.

13 years agoovs.jsonrpc: Include result in Message.__str__() output.
Ben Pfaff [Thu, 15 Sep 2011 20:01:39 +0000 (13:01 -0700)]
ovs.jsonrpc: Include result in Message.__str__() output.

This was overlooked in the initial implementation.  Including the result
member makes logging output more useful.

13 years agoovs.db.data: Make Datum.check_constraints() work.
Ben Pfaff [Thu, 15 Sep 2011 19:59:31 +0000 (12:59 -0700)]
ovs.db.data: Make Datum.check_constraints() work.

This code never got tested and so didn't work.

This does not fix an actual bug because Datum.check_constraints() does not
have any existing users.

13 years agoovs.db.data: Fix Atom.new()'s handling of Boolean values.
Ben Pfaff [Thu, 15 Sep 2011 19:57:48 +0000 (12:57 -0700)]
ovs.db.data: Fix Atom.new()'s handling of Boolean values.

Boolean values have Boolean type, not real type.

This does not fix an actual bug because Atom.new() does not have existing
users.

13 years agoovsdb-idl: Code style improvements.
Ben Pfaff [Thu, 15 Sep 2011 19:53:12 +0000 (12:53 -0700)]
ovsdb-idl: Code style improvements.

I noticed these opportunities for improvement while working on the Python
IDL.

13 years agotests: Actually run all the Python IDL tests under Python.
Ben Pfaff [Thu, 15 Sep 2011 20:09:25 +0000 (13:09 -0700)]
tests: Actually run all the Python IDL tests under Python.

The lack of _PY in the macro invocations caused these tests to actually
test the C IDL.

Fortunately they would have passed anyway, modulo some minor differences
in output formatting that this commit fixes up.

13 years agoovs.json: Remove commented-out debug code.
Ben Pfaff [Tue, 13 Sep 2011 21:27:23 +0000 (14:27 -0700)]
ovs.json: Remove commented-out debug code.

This must have slipped into an old commit by accident.

13 years agoovs.json: Actually implement the "pretty" option for serialization.
Ben Pfaff [Tue, 20 Sep 2011 18:07:46 +0000 (11:07 -0700)]
ovs.json: Actually implement the "pretty" option for serialization.

13 years agopython: Avoid shadowing standard or global names.
Ben Pfaff [Thu, 25 Aug 2011 00:12:53 +0000 (17:12 -0700)]
python: Avoid shadowing standard or global names.

Found by pychecker.

13 years agopython: Avoid "unused parameter" warnings from pychecker.
Ben Pfaff [Tue, 20 Sep 2011 18:05:13 +0000 (11:05 -0700)]
python: Avoid "unused parameter" warnings from pychecker.

pychecker ignores parameters named "_" or prefixed with "unused_".

13 years agoovs.db.types: Always initialize ref_type attribute.
Ben Pfaff [Thu, 25 Aug 2011 00:10:45 +0000 (17:10 -0700)]
ovs.db.types: Always initialize ref_type attribute.

The ref_type attribute was initialized on some paths but not others.

Found by pychecker.

13 years agoovs-monitor-ipsec: Fix typo in comment.
Ben Pfaff [Thu, 22 Sep 2011 23:08:46 +0000 (16:08 -0700)]
ovs-monitor-ipsec: Fix typo in comment.

13 years agoInclude sys/socket.h for SOCK_STREAM
Simon Horman [Fri, 23 Sep 2011 11:11:20 +0000 (20:11 +0900)]
Include sys/socket.h for SOCK_STREAM

This appears to be required when building using the Android NDK r6b
(Android API level 13).

13 years agoInclude sys/wait.h for WIFEXITED
Simon Horman [Fri, 23 Sep 2011 11:11:19 +0000 (20:11 +0900)]
Include sys/wait.h for WIFEXITED

This appears to be required when building using the Android NDK r6b
(Android API level 13).

13 years agoovsdb-tool: Correct markup for 'db' argument in show-log description.
Justin Pettit [Fri, 23 Sep 2011 01:14:02 +0000 (18:14 -0700)]
ovsdb-tool: Correct markup for 'db' argument in show-log description.

13 years agoofp-print: Avoid double space before "actions" for catch-all flows.
Ben Pfaff [Thu, 22 Sep 2011 21:35:05 +0000 (14:35 -0700)]
ofp-print: Avoid double space before "actions" for catch-all flows.

Bug #7434.
Reported-by: Michael Mao <mmao@nicira.com>
13 years agonetdev-linux: Fix broken build on RHEL 6.
Ben Pfaff [Thu, 22 Sep 2011 18:54:22 +0000 (11:54 -0700)]
netdev-linux: Fix broken build on RHEL 6.

Commit 00fa9d37c2b "Do not include net/ethernet.h and linux/if_tunnel.h"
introduced a compile error on RHEL 6:

lib/netdev-linux.c: In function 'netdev_linux_listen':
lib/netdev-linux.c:734: error: 'ETH_P_ALL' undeclared (first use in this
function)

This fixes the problem.

I verified that the Android NDK r6b mentioned in the previous commit
contains a file named android-ndk-r6b/platforms/android-3/arch-x86/use/
linux/if_ether.h that defines ETH_P_ALL.  I didn't try building on that
platform.

13 years agonetlink-socket: Async notifications are incompatible with other operations.
Ben Pfaff [Thu, 22 Sep 2011 18:36:39 +0000 (11:36 -0700)]
netlink-socket: Async notifications are incompatible with other operations.

A Netlink socket that receives asynchronous notifications (e.g. from a
multicast group) cannot be used for transactions or dumps, because those
operations would discard asynchronous messages that arrive while waiting
for replies.

This commit documents this issue in a comment on nl_sock_join_mcgroup().
It also removes an internal attempt to avoid mixing multicast reception
with other operations.  The attempt was incomplete, because it only
handled dumps even though ordinary transactions are also problematic.  It
seems better to remove it than to fix it because, first, all of the
existing users in OVS already separate multicast reception from other
operations and, second, an upcoming commit will start using unicast
Netlink for asynchronous notifications, which has the same issues but
doesn't use nl_sock_join_mcgroup().

13 years agoovs-xapi-sync: Make pychecker-able.
Ben Pfaff [Wed, 21 Sep 2011 21:56:55 +0000 (14:56 -0700)]
ovs-xapi-sync: Make pychecker-able.

pychecker imports the code that it checks, which means that code at top
level runs, so "ovs-xapi-sync" failed to import unless the user had write
access to /var/log/openvswitch.

13 years agoovs-bugtool: Fix --unlimited option.
Daniel Roman [Wed, 21 Sep 2011 21:44:15 +0000 (14:44 -0700)]
ovs-bugtool: Fix --unlimited option.

Bug #5443.

13 years agoRemove netdev_find_dev_by_in4
Simon Horman [Thu, 22 Sep 2011 12:24:14 +0000 (21:24 +0900)]
Remove netdev_find_dev_by_in4

netdev_find_dev_by_in4() appears to no longer be used and thus
can be removed. This also allows netdev_enumerate(), the
enumerate member of struct netdev_class and netdev_linux_enumerate()
to be removed.

I noticed this as netdev_linux_enumerate() makes use of if_nameindex()
and if_freenameindex() which are not available when compiling using
the Android NDK r6b (Android API level 13).

13 years agoDo not include net/ethernet.h and linux/if_tunnel.h
Simon Horman [Thu, 22 Sep 2011 12:24:13 +0000 (21:24 +0900)]
Do not include net/ethernet.h and linux/if_tunnel.h

net/ethernet.h and linux/if_tunnel.h do not appear to be needed
on lib/netdev-linux.c.

I noticed this while trying to build on the Android NDK r6b (Android API
level 13) as these headers are not present there.

13 years agoAdd fallback definition of SIG_ATOMIC_MAX
Simon Horman [Thu, 22 Sep 2011 12:24:12 +0000 (21:24 +0900)]
Add fallback definition of SIG_ATOMIC_MAX

Android appears to lack SIG_ATOMIC_MAX which is only
used in fatal-signal.c.

Observed when compiling using the Android NDK r6b (Android API level 13).

Patch based on a suggestion by Ben Pfaff

13 years agoInclude <sys/time.h> in socket-util.h
Simon Horman [Thu, 22 Sep 2011 12:24:11 +0000 (21:24 +0900)]
Include <sys/time.h> in socket-util.h

sys/time.h appears to be required for a definition of timespec on Android.

Observed when compiling using the Android NDK r6b (Android API level 13).

13 years agoInclude <sys/socket.h> in socket-util.h
Simon Horman [Thu, 22 Sep 2011 12:24:10 +0000 (21:24 +0900)]
Include <sys/socket.h> in socket-util.h

This appears to be necessary to get a definition of socket_t
when compiling using the Android NDK r6b (Android API level 13).

13 years agonetlink-socket: Fix typo in comment.
Ben Pfaff [Thu, 22 Sep 2011 03:49:32 +0000 (20:49 -0700)]
netlink-socket: Fix typo in comment.

13 years agodatapath: IFF_BRIDGE_PORT is backported by Centos 5.6.
Jesse Gross [Wed, 21 Sep 2011 19:41:52 +0000 (12:41 -0700)]
datapath: IFF_BRIDGE_PORT is backported by Centos 5.6.

Some versions of Centos 5.6 backport the flag IFF_BRIDGE_PORT
without the associated rx_handler changes, so this changes to
use a version check since we really don't care about the actual
symbol.

Reported-by: Srinivasan Ramasubramanian <vrsrini@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
13 years agodatapath: Cleanup actions.c:do_output().
Jesse Gross [Tue, 20 Sep 2011 23:44:46 +0000 (16:44 -0700)]
datapath: Cleanup actions.c:do_output().

The code for outputting a packet can be simplified a little and
also modernized.  There is no functional change.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodatapath: Send to userspace errors shouldn't halt processing.
Jesse Gross [Tue, 20 Sep 2011 23:29:38 +0000 (16:29 -0700)]
datapath: Send to userspace errors shouldn't halt processing.

If we encounter an error when sending a packet to userspace due to
an explicit action we stop processing further actions.  This makes
sense for things like push vlan, where to continue means outputting
an incorrect packet.  However, sending to userspace is more akin
to outputting to a port, which does not halt further processing.
For consistency, ignore errors in this case as well.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodatapath: Correctly validate vport attributes on old kernels.
Jesse Gross [Tue, 20 Sep 2011 17:31:29 +0000 (10:31 -0700)]
datapath: Correctly validate vport attributes on old kernels.

The vport policy for OVS_VPORT_ATTR_PORT_NO and OVS_VPORT_ATTR_TYPE
are present only in the section for newer kernels.  This means that
on older kernels the length of these attributes are never checked
anywhere but we go ahead and read from them anyways.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodatapath: Remove check for shared skbs.
Jesse Gross [Tue, 20 Sep 2011 21:08:57 +0000 (14:08 -0700)]
datapath: Remove check for shared skbs.

We never allow shared skbs to be present inside of the OVS datapath
but the presence of a check in the core makes this less clear.  Since
the check is very old and no longer relevant, drop it.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agoovs-vsctl: Fix typo in documentation.
Ben Pfaff [Mon, 19 Sep 2011 20:29:05 +0000 (13:29 -0700)]
ovs-vsctl: Fix typo in documentation.

I don't know what was really supposed to go here.

Documentation #7371.
Reported-by: Reid Price <reid@nicira.com>
13 years agodebian: Correct path to ovs-controller in init script.
Ben Pfaff [Tue, 20 Sep 2011 16:38:33 +0000 (09:38 -0700)]
debian: Correct path to ovs-controller in init script.

Reported-by: George Shuklin <amarao@desunote.ru>
Bug-report: http://bugs.debian.org/642206

13 years agodatapath: Fully initialize datapath before local port.
Jesse Gross [Thu, 15 Sep 2011 23:41:36 +0000 (16:41 -0700)]
datapath: Fully initialize datapath before local port.

It's possible to start receiving packets on a datapath as soon as
the internal device is created.  It's therefore important that the
datapath be fully initialized before this, which it currently isn't.
In particular, the fact that dp->stats_percpu is not yet set is
potentially fatal.  In addition, if allocation of the Netlink response
failed it would leak the percpu memory.  This fixes both problems.

Found by code inspection, in practice the datapath is probably always
done initializing before someone can send a packet on it.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodatapath: Correctly set error code in queue_userspace_packets().
Jesse Gross [Mon, 19 Sep 2011 23:23:25 +0000 (16:23 -0700)]
datapath: Correctly set error code in queue_userspace_packets().

In a few places in queue_userspace_packets() when we encounter an
error, we don't actually set the 'err' variable.  Although we
free the packets we don't correctly account for these packets as
being lost.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodatapath-protocol: vport_stats types are unsigned.
Jesse Gross [Mon, 19 Sep 2011 23:11:27 +0000 (16:11 -0700)]
datapath-protocol: vport_stats types are unsigned.

The 'u' in uint64_t apparently got clipped off of the tx_dropped
member of struct vport_stats in between review and push, incorrectly
making this a signed type.

CC: Pravin Shelar <pshelar@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin Shelar <pshelar@nicira.com>
13 years agosflow: Use ODP-port number to lookup ifindex.
Pravin Shelar [Mon, 19 Sep 2011 21:55:31 +0000 (14:55 -0700)]
sflow: Use ODP-port number to lookup ifindex.

   dpif_sflow_odp_port_to_ifindex() expects odp_port number as sFlow
maintains ODP-port to ifindex mapping.

13 years agoovs-ofctl: Clarify in_port in manpage.
Ben Pfaff [Mon, 19 Sep 2011 20:22:16 +0000 (13:22 -0700)]
ovs-ofctl: Clarify in_port in manpage.

Suggestion #7370.
Suggested-by: Reid Price <reid@nicira.com>
13 years agonicira-ext: Clarify comment.
Ben Pfaff [Mon, 19 Sep 2011 20:04:34 +0000 (13:04 -0700)]
nicira-ext: Clarify comment.

I noticed a couple of typos and inaccuracies here while reviewing Jean's
changes to it for OXM at https://www.opennetworking.org/bugs/browse/EXT-1

13 years agodaemon.py: Silence return warning.
Ethan Jackson [Fri, 16 Sep 2011 23:46:18 +0000 (16:46 -0700)]
daemon.py: Silence return warning.

Pychecker complains about __read_pidfile() having too may returns.
I personally think the function is fine, but it's easy enough to
reduce them.

python/ovs/daemon.py:395: Function (__read_pidfile) has too many
returns (12)

13 years agodaemon.py: Don't shadow built-in 'file' variable.
Ethan Jackson [Fri, 16 Sep 2011 23:38:39 +0000 (16:38 -0700)]
daemon.py: Don't shadow built-in 'file' variable.

Pychecker considers it bad style.

13 years agodaemon.py: Whitespace cleanup.
Ethan Jackson [Fri, 16 Sep 2011 23:03:31 +0000 (16:03 -0700)]
daemon.py: Whitespace cleanup.

The python style guide requires two newlines between top level
definitions.  This patch also removes some trailing whitespace.

13 years agotests: Cleanup test-daemon.py style.
Ethan Jackson [Fri, 16 Sep 2011 22:48:33 +0000 (15:48 -0700)]
tests: Cleanup test-daemon.py style.

By convention, unused arguments should be named "_" and top level
definitions should be separated by two spaces.

13 years agocfm: Update cfm_remote_mpids documentation.
Ethan Jackson [Fri, 16 Sep 2011 18:31:55 +0000 (11:31 -0700)]
cfm: Update cfm_remote_mpids documentation.

13 years agodpif-linux: Handle nl_lookup_genl_mcgroup() failures.
Ethan Jackson [Tue, 13 Sep 2011 01:57:50 +0000 (18:57 -0700)]
dpif-linux: Handle nl_lookup_genl_mcgroup() failures.

The nl_lookup_genl_mcgroup() function can fail on older kernels
which do not support the required netlink interface.  Before this
patch, dpif-linux would refuse to create a datapath when this
happened.  With this patch, it attempts to use a workaround.  If
the workaround fails it simply disables the affected features
without completely disabling the dpif.

13 years agodpif-linux: Open dpif despite notifier failures.
Ethan Jackson [Wed, 14 Sep 2011 18:26:21 +0000 (11:26 -0700)]
dpif-linux: Open dpif despite notifier failures.

Before this patch, if dpif-linux failed to register a notifier it
would give up opening the datapath entirely.  This seems draconian
as a dpif can still perform the majority of its intended
functionality without vport notifications.

13 years agodatapath: Hardcode vport multicast group ID on older kernels.
Ethan Jackson [Mon, 12 Sep 2011 21:09:34 +0000 (14:09 -0700)]
datapath: Hardcode vport multicast group ID on older kernels.

Older kernels do not advertise the multicast groups of families
when requested by userspace.  As a workaround, this patch hardcodes
the multicast group ID of the ovs_vport family on these kernels.
Userspace will be able to fall back to this hardcoded value if the
standard mechanism is unavailable.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agonotifiers: Create and destroy nln_notifiers.
Ethan Jackson [Thu, 15 Sep 2011 18:21:23 +0000 (11:21 -0700)]
notifiers: Create and destroy nln_notifiers.

This patch changes the interface of netlink-notifier and
rtnetlink-link.  Now nln_notifiers are allocated and destroyed by
the module instead of passed in by callers.  This allows the
definition of nln_notifier to be hidden, and generally cleans up
the code.

13 years agonotifiers: Rename run and wait functions.
Ethan Jackson [Thu, 15 Sep 2011 18:23:08 +0000 (11:23 -0700)]
notifiers: Rename run and wait functions.

It makes more sense to call nln_notifier_run() and
nln_notifier_wait() simply nln_run() and nln_wait() since they
don't operate on notifiers but the entire nln object.  This patch
changes the nln and the rtnetlink-link modules to the new
convention.

13 years agoofproto-dpif: Fix behavior when a subset of VLANs is trunked.
Ben Pfaff [Wed, 24 Aug 2011 22:27:14 +0000 (15:27 -0700)]
ofproto-dpif: Fix behavior when a subset of VLANs is trunked.

Reported-by: Philippe Jung <phil.jung@free.fr>
13 years agodatapath: Always use generic stats for devices (vports)
Pravin Shelar [Fri, 16 Sep 2011 02:36:17 +0000 (19:36 -0700)]
datapath:  Always use generic stats for devices (vports)

    Currently ovs is using device stats for Linux devices and count them
itself in other situations. This leads to overlap with hardware stats,
inconsistencies, etc. It's much better to just always count the packets
flowing through the switch and let userspace do any merging that it wants.

Following patch removes vport->get_stats() interface. vport-stat is changed
to use new `struct ovs_vport_stat` rather than rtnl_link_stats64.
Definitions of rtnl_link_stats64 is removed from OVS.  dipf_port->stat is also
removed as aggregate stats are only available at netdev layer.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agoSet MTU in userspace rather than kernel.
Justin Pettit [Tue, 13 Sep 2011 05:13:30 +0000 (22:13 -0700)]
Set MTU in userspace rather than kernel.

Currently the kernel automatically sets the MTU of any internal
interfaces to the minimum of all attached interfaces because the Linux
bridge does this.  Userspace can do this with more knowledge and
flexibility.

Feature #7323

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agoAUTHORS: Add Tyler Coumbes <coumbes@gmail.com>.
Ben Pfaff [Thu, 15 Sep 2011 22:58:59 +0000 (15:58 -0700)]
AUTHORS: Add Tyler Coumbes <coumbes@gmail.com>.

13 years agoovs-brcompatd: Delete ports when netdevs on fake bridges disappear.
Ben Pfaff [Thu, 15 Sep 2011 22:55:45 +0000 (15:55 -0700)]
ovs-brcompatd: Delete ports when netdevs on fake bridges disappear.

Until now, when a network device disappeared, netdev_changed_cb() passed
the name of the bridge that contained the network device to ovs-vsctl as
part of the "del-port" command.  However, when the network device was
actually a "fake bridge", it would pass the name of the real bridge, which
ovs-vsctl rejected as wrong (expecting the name of the fake bridge) and
not remove the port.

This fixes the problem by dropping the bridge name, which is simpler than
trying to get the name of the fake bridge in this case.

Reported-by: Tyler Coumbes <coumbes@gmail.com>
Tested-by: Tyler Coumbes <coumbes@gmail.com>
13 years agocfm: Delete spurious blank line.
Ben Pfaff [Thu, 15 Sep 2011 22:40:39 +0000 (15:40 -0700)]
cfm: Delete spurious blank line.

13 years agoovs-vsctl: Improve usage message.
Ben Pfaff [Thu, 15 Sep 2011 20:30:18 +0000 (13:30 -0700)]
ovs-vsctl: Improve usage message.

Bug #7332.
Reported-by: Gordon Good <ggood@nicira.com>
13 years agoofproto-dpif: Revalidate on cfm and lacp addition.
Ethan Jackson [Thu, 15 Sep 2011 22:27:22 +0000 (15:27 -0700)]
ofproto-dpif: Revalidate on cfm and lacp addition.

The introduction of cfm or lacp objects to ofproto, requires the
removal of all flows which originate from the newly "special"
in_port.

13 years agobugtool: Remove "ovs-bugtool" upon "make clean", to fix "make distcheck".
Ben Pfaff [Thu, 25 Aug 2011 17:20:28 +0000 (10:20 -0700)]
bugtool: Remove "ovs-bugtool" upon "make clean", to fix "make distcheck".

13 years agobugtool: Uninstall plugins on "make uninstall".
Ben Pfaff [Thu, 25 Aug 2011 17:20:01 +0000 (10:20 -0700)]
bugtool: Uninstall plugins on "make uninstall".

This works toward making "make distcheck" succeed.

13 years agoMark "uninstall-local" targets phony.
Ben Pfaff [Thu, 25 Aug 2011 17:19:23 +0000 (10:19 -0700)]
Mark "uninstall-local" targets phony.

13 years agorhel: Fix "make distcheck" failure due to regenerating spec files.
Ben Pfaff [Thu, 25 Aug 2011 17:18:47 +0000 (10:18 -0700)]
rhel: Fix "make distcheck" failure due to regenerating spec files.

We want to regenerate the RPM spec files whenever the version number
changes, hence the dependency on config.status.  But that means that we
try to modify the spec files even when the version number doesn't change,
which cause "make distcheck" to fail because it write-protects the source
directory.  So this commit instead just "touch"es the spec files when
they don't really change, which still works OK with a write-protected
source directory.

13 years agoofproto: Remove dummy 'in_port' variable.
Ben Pfaff [Thu, 8 Sep 2011 18:21:45 +0000 (11:21 -0700)]
ofproto: Remove dummy 'in_port' variable.

Seems like a very small cleanup.

13 years agoofp-util: Remove obsolete build assertion.
Ben Pfaff [Wed, 7 Sep 2011 17:12:13 +0000 (10:12 -0700)]
ofp-util: Remove obsolete build assertion.

Commit d1e9b9bf3 "nicira-ext: Renumber NXT_FLOW_MOD_TABLE_ID" eliminated
the need for the NXT_SET_FLOW_FORMAT and NXT_FLOW_MOD_TABLE_ID commands to
have different sizes, so asserting that they are different isn't useful
anymore (although it is still correct and always will be).

13 years agoodp-util: Drop pointless "if" statement.
Ben Pfaff [Tue, 6 Sep 2011 23:48:39 +0000 (16:48 -0700)]
odp-util: Drop pointless "if" statement.

13 years agonetdev: Allow get_mtu and set_mtu provider functions to be null.
Ben Pfaff [Thu, 15 Sep 2011 17:41:15 +0000 (10:41 -0700)]
netdev: Allow get_mtu and set_mtu provider functions to be null.

Most netdev provider functions are allowed to be null if the implementation
does not support this feature.  This commit adds this feature for get_mtu
and set_mtu, and changes netdev-vport to take advantage of it.

Also, changes netdev_get_mtu() to report an MTU of 0 on error, instead of
leaving the MTU indeterminate.

13 years agodatapath: Fix tunnel lookup
Pravin Shelar [Thu, 15 Sep 2011 00:39:43 +0000 (17:39 -0700)]
datapath: Fix tunnel lookup

        Attached patch fixes tunnel lookup to do correct port comparison.
This bug is introduced by commit 3544358aa5960b148bc31435a0062e9392530ec2

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agodatapath: Set vport in skb when executed from userspace.
Jesse Gross [Mon, 1 Aug 2011 07:35:20 +0000 (00:35 -0700)]
datapath: Set vport in skb when executed from userspace.

Currently, the OVS_CB(skb)->vport member is never initialized for
packets coming from userspace.  This means that they can never be
sampled by sFlow and generally violates our principle that userspace
packets should be made to look the same as others.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin Shelar <pshelar@nicira.com>
13 years agoman: pic failed to run during manpage-check
Ethan Jackson [Tue, 13 Sep 2011 20:30:30 +0000 (13:30 -0700)]
man: pic failed to run during manpage-check

This patch fixes the following warnings on my system:

vswitchd/ovs-vswitchd.conf.db.5:62: warning: macro `PS' not defined
vswitchd/ovs-vswitchd.conf.db.5:138: warning: macro `PE' not defined

13 years agolib: TYPE_IS_SIGNED macro generates compiler warnings.
Ethan Jackson [Tue, 13 Sep 2011 20:27:38 +0000 (13:27 -0700)]
lib: TYPE_IS_SIGNED macro generates compiler warnings.

The TYPE_IS_SIGNED macro does a less than zero comparision with an
unsigned type which can cause compiler warnings like the following:

lib/tag.c:100:9: error: comparison of unsigned expression < 0 is
always false [-Werror=type-limits]

13 years agosocket-util: inet_parse_passive() had incorrect argument type.
Ethan Jackson [Tue, 13 Sep 2011 20:28:49 +0000 (13:28 -0700)]
socket-util:  inet_parse_passive() had incorrect argument type.

This patch fixes the following compiler warning:

lib/socket-util.c:621:5: error: comparison is always false due to
limited range of data type [-Werror=type-limits]

13 years agolib: Suppress comparison warnings in ovsdb libraries.
Ethan Jackson [Tue, 13 Sep 2011 20:15:48 +0000 (13:15 -0700)]
lib: Suppress comparison warnings in ovsdb libraries.

This patch fixes compiler warnings like the following:

./lib/ovsdb-types.h:171:5: error: comparison of unsigned expression
>= 0 is always true [-Werror=type-limits]

13 years agoofproto-dpif: Optimize flow revalidation for MAC learning.
Ben Pfaff [Mon, 12 Sep 2011 23:48:07 +0000 (16:48 -0700)]
ofproto-dpif: Optimize flow revalidation for MAC learning.

Without this commit, every NXAST_LEARN action that adds a flow causes every
facet to be revalidated.  With this commit, as long as the "Usage Advice"
in the large comment on struct nx_action_learn in nicira-ext.h is followed,
this no longer happens.

13 years agoofproto-dpif: Introduce an enum for the number of tables.
Ben Pfaff [Mon, 12 Sep 2011 23:40:03 +0000 (16:40 -0700)]
ofproto-dpif: Introduce an enum for the number of tables.

It seems reasonable that someone might want to reduce this number, so
make it an enum to simplify that.

If someone does reduce the number then rule_dpif_lookup() needs to validate
the table_id, so add code to do that too.

13 years agoflow: New function flow_wildcards_is_catchall().
Ben Pfaff [Mon, 12 Sep 2011 23:38:52 +0000 (16:38 -0700)]
flow: New function flow_wildcards_is_catchall().

This will be used in an upcoming commit.

13 years agoclassifier: Move zero_wildcards() to flow.c as public flow_zero_wildcards().
Ben Pfaff [Fri, 19 Aug 2011 16:39:16 +0000 (09:39 -0700)]
classifier: Move zero_wildcards() to flow.c as public flow_zero_wildcards().

This function will soon be used elsewhere.  As it doesn't inherently have
anything to with the classifier, move it to flow.c.

13 years agoImplement new "learn" action.
Ben Pfaff [Mon, 12 Sep 2011 23:19:57 +0000 (16:19 -0700)]
Implement new "learn" action.

There are a few loose ends here.  First, learning actions cause too much
flow revalidation.  Upcoming commits will fix that problem.  The following
additional issues have not yet been addressed:

    * Resource limits: nothing yet limits the maximum number of flows that
      can be learned.  It is possible to exhaust all system memory.

    * Age reporting: there is no way to find out how soon a learned table
      entry is due to be evicted.

To try this action out, here's a recipe for a very simple-minded MAC
learning switch.  It uses a 10-second MAC expiration time to make it easier
to see what's going on:

ovs-vsctl del-controller br0
ovs-ofctl del-flows br0
ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, hard_timeout=10, \
NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
output:NXM_OF_IN_PORT[]), resubmit(,1)"
ovs-ofctl add-flow br0 "table=1 priority=0 actions=flood"

You can then dump the MAC learning table with:

ovs-ofctl dump-flows br0 table=1

13 years agoofproto: Reinterpret meaning of OpenFlow hard timeouts with OFPFC_MODIFY.
Ben Pfaff [Fri, 19 Aug 2011 17:33:09 +0000 (10:33 -0700)]
ofproto: Reinterpret meaning of OpenFlow hard timeouts with OFPFC_MODIFY.

I finally found a good use for hard timeouts in OpenFlow, but they require
a slight reinterpretation of the meaning of hard timeouts.  Until now, a
hard timeout meant that a flow would be removed the specified number of
seconds after a flow was created.  Intervening modifications with
OFPFC_MODIFY(_STRICT) had no effect on the hard timeout; the flow would
still be deleted the specified number of seconds after its original
creation.

This commit changes the effect of OFPFC_MODIFY(_STRICT).  Now, modifying
a flow resets its hard timeout counter.  A flow will time out the specified
number of seconds after creation or after the last time it is modified,
whichever comes later.

13 years agotest-openflowd: Allow specifying port type on --ports option.
Ben Pfaff [Thu, 18 Aug 2011 18:20:12 +0000 (11:20 -0700)]
test-openflowd: Allow specifying port type on --ports option.

This allows a command like "test-openflowd --enable-dummy dummy@br0
--ports=dummy@eth0,dummy@eth1,dummy@eth2" to create a dummy datapath with
a number of dummy ports.  This is more useful for testing than a dummy
datapath with just an internal port, since output to "flood" and "normal"
has less pathological results.

13 years agodpif-netdev: Also allow "dummy" netdevs in a dpif-netdev.
Ben Pfaff [Thu, 18 Aug 2011 18:17:29 +0000 (11:17 -0700)]
dpif-netdev: Also allow "dummy" netdevs in a dpif-netdev.

I've always intended this to work, but either I never tested it or the
support rotted.

This will soon be used in some tests that I will add.

13 years agoofproto-dpif: Add -generate option to ofproto/trace command.
Ben Pfaff [Thu, 8 Sep 2011 21:32:13 +0000 (14:32 -0700)]
ofproto-dpif: Add -generate option to ofproto/trace command.

13 years agometa-flow: New library for working with fields by id.
Ben Pfaff [Mon, 12 Sep 2011 19:11:50 +0000 (12:11 -0700)]
meta-flow: New library for working with fields by id.

OVS already has a fairly good set of functions for working with fields that
are known at compile time, but support for working with fields that are
known only at runtime is fairly limited (and fairly unneeded).  However,
with NXM identifiers becoming more and more widely used throughout Nicira
extensions, it's becoming corresponding more and more common to need to
refer to fields at runtime.  This new library represents a first attempt
at a systematic approach for doing so.

13 years agoofproto: Mark some parameters 'const'.
Ben Pfaff [Wed, 17 Aug 2011 22:48:50 +0000 (15:48 -0700)]
ofproto: Mark some parameters 'const'.

13 years agoofproto: Add 'ofproto' parameter to most flow_mod functions.
Ben Pfaff [Wed, 10 Aug 2011 23:16:16 +0000 (16:16 -0700)]
ofproto: Add 'ofproto' parameter to most flow_mod functions.

13 years agoofproto: Avoid using list_size() to compute length of 'pending' list.
Ben Pfaff [Wed, 10 Aug 2011 21:48:33 +0000 (14:48 -0700)]
ofproto: Avoid using list_size() to compute length of 'pending' list.

Currently this only gets checked for incoming OpenFlow OFPT_FLOW_MOD
messages, so it's hard to imagine it being any kind of bottleneck, but the
NXAST_LEARN action that is soon to be added will be able to create flows
more quickly than we normally expect from a controller.  (On the other
hand, ofproto-dpif, outside of a special testing mode, always completes
operations immediately, so 'pending' will always have length 0.  But this
change still feels right to me for some reason.)

13 years agoofp-util: New function for parsing key-value pairs.
Ben Pfaff [Wed, 17 Aug 2011 20:39:02 +0000 (13:39 -0700)]
ofp-util: New function for parsing key-value pairs.

This will soon have a new user, but it's a worthwhile cleanup on its own.

13 years agoofp-util: Add type-safe functions for serializing actions.
Ben Pfaff [Tue, 16 Aug 2011 23:30:57 +0000 (16:30 -0700)]
ofp-util: Add type-safe functions for serializing actions.

13 years agoofp-parse: Refactor action parsing to improve compiler warnings.
Ben Pfaff [Tue, 16 Aug 2011 23:08:24 +0000 (16:08 -0700)]
ofp-parse: Refactor action parsing to improve compiler warnings.

When a new action is added, compiler warnings show most of the places that
need new code to handle that action.  The action parsing code in
ofp-parse.c was the one remaining missing case.  This commit fixes that.

13 years agoofp-util: Further abstract definitions of action properties.
Ben Pfaff [Wed, 17 Aug 2011 18:01:17 +0000 (11:01 -0700)]
ofp-util: Further abstract definitions of action properties.

This commit primarily moves the OFPAT_ACTION and NXAST_ACTION invocations
into a new file ofp-util.def.  This allows multiple places in the source to
use them.

This commit also adds a new function ofputil_action_code_from_name().
The following commit will add the first user.

13 years agoofp-util: New functions for parsing and formatting OpenFlow port numbers.
Ben Pfaff [Tue, 16 Aug 2011 22:26:18 +0000 (15:26 -0700)]
ofp-util: New functions for parsing and formatting OpenFlow port numbers.

These functions were previously used only in ofp-parse.c and ofp-print.c,
but they are more generally useful and future commits will add more users.