sliver-openvswitch.git
10 years agoMerge branch 'mainstream'
Giuseppe Lettieri [Tue, 21 Jan 2014 15:37:36 +0000 (16:37 +0100)]
Merge branch 'mainstream'

Conflicts:
Makefile.am
lib/dpif-netdev.c

10 years agopoll-loop: Port to Windows.
Linda Sun [Fri, 10 Jan 2014 00:26:12 +0000 (16:26 -0800)]
poll-loop: Port to Windows.

Use WaitForMultipleObjects for polling on windows.  This works on all kinds
of objects, e.g. sockets, files, especially ioctl calls to the kernel.
poll_fd_wait_event() is used if events need to be passed to pollfds.  latch
is signaled with event, to be waited/polled by WaitForMultipleObjects() as
well.  Changed array of fds to hmap to check for duplicate fds.

Signed-off-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix kernel panic on ovs_flow_free
Andy Zhou [Fri, 10 Jan 2014 23:57:04 +0000 (15:57 -0800)]
datapath: Fix kernel panic on ovs_flow_free

Both mega flow mask's reference counter and per flow table mask list
should only be accessed when holding ovs_mutex() lock. However
this is not true with ovs_flow_table_flush(). The patch fixes this bug.

Reported-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
10 years agonetdev-linux: Fix build break on RHEL 6.1.
Ben Pfaff [Fri, 17 Jan 2014 01:21:55 +0000 (17:21 -0800)]
netdev-linux: Fix build break on RHEL 6.1.

Commit 73c85181d (netdev-linux: Read packet auxdata to obtain vlan_tid)
added #include <linux/if_packet.h> to this file, to get the definition
of PACKET_AUXDATA and some other definitions, but on RHEL 6.1 this
provoked compiler errors:

In file included from /usr/include/linux/rtnetlink.h:5,
    from lib/netdev-linux.c:34:
/usr/include/linux/netlink.h:34: error: expected specifier-qualifier-list
    before 'sa_family_t'

Since the old #includes worked everywhere, and this file already defined
its own versions of most of the new macros that it needed, this commit just
reverts the old #includes and adds the one macro definition it didn't
already have.

(RHEL 6.1 isn't necessarily the only platform where this is a problem, but
it's the first one for which we noticed the problem.)

This switches the definition of sockaddr_ll used from the Linux one, which
uses __be16 for sll_protocol, to the glibc one, which uses plain "unsigned
short int".  This makes sparse complain (rightly), so this commit also
adds a sparse-specific header that uses ovs_be16 to prevent the warning.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agovswitchd: Inherit parents mac address for fake bridges
Helmut Schaa [Fri, 6 Dec 2013 15:18:42 +0000 (16:18 +0100)]
vswitchd: Inherit parents mac address for fake bridges

When adding a physical port to the main bridge the mac address
of the bridge is updated. We can do the same for fake bridges by
copying the mac address of the parent bridge.

There exists only one fake bridge per vlan, hence it is safe
to copy the mac address of the parent bridge.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-linux: Read packet auxdata to obtain vlan_tid
Simon Horman [Wed, 15 Jan 2014 08:17:02 +0000 (17:17 +0900)]
netdev-linux: Read packet auxdata to obtain vlan_tid

If VLAN acceleration is used when the kernel receives a packet
then the outer-most VLAN tag will not be present in the packet
when it is received by netdev-linux. Rather, it will be present
in auxdata.

This patch uses recvmsg() instead of recv() to read auxdata for
each packet and if the vlan_tid is set then it is added to the packet.

Adding the vlan_tid makes use of headroom available
in the buffer parameter of rx_recv.

Signed-off-by: Simon Horman <horms@verge.net.au>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib: Add tpid parameter to eth_push_vlan()
Simon Horman [Wed, 15 Jan 2014 08:17:01 +0000 (17:17 +0900)]
lib: Add tpid parameter to eth_push_vlan()

This is in preparation for pushing vlan tags
using the TPID provided by the kernel via auxdata.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev_class: Pass a struct ofpbuf * to rx_recv()
Simon Horman [Wed, 15 Jan 2014 08:17:00 +0000 (17:17 +0900)]
netdev_class: Pass a struct ofpbuf * to rx_recv()

Update the netdev_class so that struct ofpbuf * is passed to rx_recv()
to provide both the data and size of the data to read a packet into.

On success, update struct ofpbuf size inside netdev_class rx_recv
implementation and return 0. This moves logic from the caller.
On error a positive error code is returned, whereas previously
a negative error code was returned. This is a more common convention.

This patch should not have any behavioural changes.

This patch is in preparation for the netdev-linux variant of rx_recv()
making use of headroom in the struct ofpbuf * parameter to push a VLAN tag
obtained from auxdata.

Signed-off-by: Simon Horman <horms@verge.net.au>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Fix path for distcleaning ovs-controller.8
Joe Stringer [Fri, 10 Jan 2014 21:45:47 +0000 (13:45 -0800)]
tests: Fix path for distcleaning ovs-controller.8

Fixes the following error on distcheck:-

ERROR: files left in build directory after distclean:
./tests/test-controller.8
make[1]: *** [distcleancheck] Error 1

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-monitor: Change global rwlock into mutex.
Ben Pfaff [Wed, 15 Jan 2014 20:37:04 +0000 (12:37 -0800)]
ofproto-dpif-monitor: Change global rwlock into mutex.

Nothing ever took monitor_rwlock's read lock, so it might as well be a
mutex.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Add more lock annotations.
Ben Pfaff [Wed, 15 Jan 2014 18:22:20 +0000 (10:22 -0800)]
ofproto-dpif: Add more lock annotations.

This annotation would have caught the bug fixed by commit 491a67a0005347130
(ofproto-dpif-xlate: Avoid recursive acquisition of xlate_rwlock.).

Signed-off-by: Ben Pfaff <blp@nicira.com>
CC: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agodatapath: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed
Thomas Graf [Tue, 14 Jan 2014 09:27:02 +0000 (01:27 -0800)]
datapath: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed

While the zerocopy method is correctly omitted if user space
does not support unaligned Netlink messages. The attribute is
still not padded correctly as skb_zerocopy() will not ensure
padding and the attribute size is no longer pre calculated
though nla_reserve() which ensured padding previously.

This patch applies appropriate padding if a linear data copy
was performed in skb_zerocopy().

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto-dpif-xlate: Avoid recursive acquisition of xlate_rwlock.
YAMAMOTO Takashi [Wed, 15 Jan 2014 18:06:40 +0000 (10:06 -0800)]
ofproto-dpif-xlate: Avoid recursive acquisition of xlate_rwlock.

Currently xlate_rwlock is recursively acquired.
(xlate_send_packet -> ofproto_dpif_execute_actions -> xlate_actions)
Due to writer-preference in rwlock implementations, this causes
deadlock if another thread tries to acquire the lock exclusively
behind us.

This change avoids the problem by making xlate_send_packet drop
the lock before calling ofproto_dpif_execute_actions.  This is the
simplest fix but opens a race window against port reconfigurations.
Given the way xlate_send_packet is currently used, the race does not
seem a big problem.  An alternative would be passing down the
"xlate_rwlock is held" info to ofproto_dpif_execute_actions.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobridge: Update a comment
YAMAMOTO Takashi [Wed, 15 Jan 2014 03:41:23 +0000 (12:41 +0900)]
bridge: Update a comment

This looks like a leftover of commit 2a73b1d73d.
("bridge: Reconfigure in single pass.")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Fix a whitespace error.
YAMAMOTO Takashi [Wed, 15 Jan 2014 03:41:22 +0000 (12:41 +0900)]
ofproto-dpif-xlate: Fix a whitespace error.

No functional changes.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agofat-rwlock: Don't forget to destroy a mutex
YAMAMOTO Takashi [Wed, 15 Jan 2014 03:41:21 +0000 (12:41 +0900)]
fat-rwlock: Don't forget to destroy a mutex

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoclassifier: Use fat_rwlock instead of ovs_rwlock.
Ben Pfaff [Mon, 13 Jan 2014 19:21:12 +0000 (11:21 -0800)]
classifier: Use fat_rwlock instead of ovs_rwlock.

Jarno Rajahalme reported up to 40% performance gain on netperf TCP_CRR with
an earlier version of this patch in combination with a kernel NUMA patch,
together with a reduction in variance:
    http://openvswitch.org/pipermail/dev/2014-January/035867.html

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agofat-rwlock: New big but fast synchronization primitive.
Ben Pfaff [Mon, 13 Jan 2014 19:17:55 +0000 (11:17 -0800)]
fat-rwlock: New big but fast synchronization primitive.

This implements a reader-writer lock that uses a lot of memory (128 to 192
bytes per thread that takes the lock) but avoids cache line bouncing when
taking the read side.  Thus, a fat_rwlock is a good choice for rwlocks
taken frequently by readers.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoovs-thread: Add new support for thread-specific data.
Ben Pfaff [Tue, 14 Jan 2014 22:35:48 +0000 (14:35 -0800)]
ovs-thread: Add new support for thread-specific data.

A couple of times I've wanted to create a dynamic data structure that has
thread-specific data, but I've not been able to do that because
PTHREAD_KEYS_MAX is so low (POSIX says at least 128, glibc is only a little
bigger at 1024).  This commit introduces a new form of thread-specific data
that supports a large number of items.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoutil: Set program_name for windows correctly.
Gurucharan Shetty [Mon, 6 Jan 2014 16:47:57 +0000 (08:47 -0800)]
util: Set program_name for windows correctly.

Windows path uses backward slashes. Also, the executable name
has a .exe extension in it. While creating log files, we use
the program name to create log file names. It feels a little odd
to have log file names like ovsdb-server.exe.log etc. Using
_splitpath_s() is a way to have same log file names on both
windows and linux platforms.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agorhel: Enable DHCP support for internal ports.
Flavio Leitner [Tue, 14 Jan 2014 02:22:07 +0000 (00:22 -0200)]
rhel: Enable DHCP support for internal ports.

The current initscripts ifup-ovs brings up internal ports as
an ordinary ethernet device, so BOOTPROTO=dhcp|none does not
consider any OVS/bridge detail.

Since DHCP requires a port in the bridge to reach the server,
bring up the required port before in the same way it does for
OVS bridge.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoofproto-dpif: Un-wildcard nw_frag only for protocols that have fragments.
Ben Pfaff [Fri, 10 Jan 2014 23:17:43 +0000 (15:17 -0800)]
ofproto-dpif: Un-wildcard nw_frag only for protocols that have fragments.

The revalidator code in ofproto-dpif-upcall.c, in revalidate_ukey(),
deletes any datapath flow for which the kernel reports wildcarded bits
that userspace requires to be matched.  Until now, a couple of pieces of
code in ofproto-dpif always marked nw_frag (which tracks whether a packet
is an IPv4 or IPV6 fragment) as exact-match.  For non-IP protocols, this
wasn't meaningful, so adding such a flow to the datapath and then receiving
it back caused nw_frag to become wildcarded, so revalidate_ukey() always
deleted them.

This fixes the problem by only un-wildcarding nw_frag for protocols where
it is defined (IPv4 and IPv6).

Noticed while observing CFM traffic (which isn't IP based) over a tunnel.

Reported-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotunnel: Un-wildcard only flags that really exist in tnl_xlate_init().
Ben Pfaff [Fri, 10 Jan 2014 23:14:27 +0000 (15:14 -0800)]
tunnel: Un-wildcard only flags that really exist in tnl_xlate_init().

The revalidator code in ofproto-dpif-upcall.c, in revalidate_ukey(),
deletes any datapath flow for which the kernel reports wildcarded bits
that userspace requires to be matched.  Until now, tnl_xlate_init() marked
every bit in the tunnel flags as required to be matched.  Since most of
those bits don't actually have defined flags, adding such a flow to the
datapath and then receiving it back caused those bits to become wildcarded,
which meant that revalidate_ukey() always deleted them.

This fixes the problem by only un-wildcarding defined flags.

Reported-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-upcall: Avoid unnecessarily installing datapath flows.
Ben Pfaff [Mon, 13 Jan 2014 23:33:27 +0000 (15:33 -0800)]
ofproto-dpif-upcall: Avoid unnecessarily installing datapath flows.

handle_upcalls() always installed a flow for every packet, as long as
the datapath didn't already have too many flows, but there are cases where
we don't want to do this:

    - If we get multiple packets in a single microflow all in one batch
      (perhaps due to GSO breaking up a large TCP packet for sending to
      userspace, or for another reason), then we only need to install the
      datapath flow once.

    - For a slow-pathed flow received via a slow-path action in the kernel,
      we know that the kernel flow is already there (because otherwise it
      would have been received as "no match" instead of an action), so
      there is no benefit to reinstalling it.

Noticed because a CFM slow-pathed flow was getting reinstalled every time
a CFM packet was received.

Reported-by: Guolin Yang <gyang@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetlink: Update comment for nl_dump_start().
Joe Stringer [Mon, 13 Jan 2014 21:50:22 +0000 (13:50 -0800)]
netlink: Update comment for nl_dump_start().

The function comment still referred to a 'msg' variable, which has been
renamed.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
[blp@nicira.com did further proofreading]
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agosFlow: clear the padding
Francesco Fusco [Thu, 19 Dec 2013 17:16:24 +0000 (18:16 +0100)]
sFlow: clear the padding

putString pads the string to the 4-byte boundary without
clearing the "padded" memory. This patch simply set the
padding to zero.

Signed-off-by: Francesco Fusco <ffusco@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovsdbmonitor: Remove.
Ben Pfaff [Fri, 10 Jan 2014 23:25:40 +0000 (15:25 -0800)]
ovsdbmonitor: Remove.

ovsdbmonitor was poorly maintained and not widely used.

Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Add more thread safety annotations.
Ben Pfaff [Fri, 10 Jan 2014 19:36:35 +0000 (11:36 -0800)]
ofproto: Add more thread safety annotations.

These would have found the problem fixed in commit c7be3f559349 (connmgr:
Fix attempt to take mutex recursively when exiting fail-open.).

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoUpdate build requirements.
Ben Pfaff [Tue, 31 Dec 2013 22:23:34 +0000 (14:23 -0800)]
Update build requirements.

Libtool is now required as of commit 38b7a52b61 (openvswitch: Use libtool
and allow building shared libs).

It seems that a build requirement for Python slipped in a while back, for
generating ovs-vswitchd.conf.db.5, and no one complained, so we might as
well make it official.  (That will let us simplify some bits of the build,
too, since they won't have to be conditional on Python anymore, so I'm all
in favor of this change.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoconfigure: Make autoconf fail if libtool is not installed.
Ben Pfaff [Tue, 31 Dec 2013 22:20:01 +0000 (14:20 -0800)]
configure: Make autoconf fail if libtool is not installed.

Otherwise users get an error later like:
    ./configure: line 5093: syntax error near unexpected token
    `disable-shared' ./configure: line 5093: `LT_INIT(disable-shared)'
It's probably friendlier to make configuration fail earlier.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agofedora package: fix systemd ordering and deps.
Flavio Leitner [Thu, 9 Jan 2014 03:04:33 +0000 (01:04 -0200)]
fedora package: fix systemd ordering and deps.

There is a chicken and egg issue where common OVS
configuration uses a controller which is only accessible
via the network. So starting OVS before network.target
would break those configurations.

However, the network doesn't come up after boot because
OVS isn't started until after the network scripts tries
to configure the ovs.

This is partially fixed by commits:
   commit: 602453000e28ec1076c0482ce13c284765a84409
   rhel: Automatically start openvswitch service before bringing an ovs interfa

   commit: 3214851c31538e8690e31f95702f8927a8c0838b
   rhel: Add OVSREQUIRES to automatically bring up OpenFlow interface dependencies

But still there is the dependency issue between network.target
and openvswitch which this patch fixes it.  It provides two systemd
service units. One to run at any time (openvswitch-nonetwork.service)
which runs 'ovs-ctl start' and the other one (openvswith.service) to
run after network.target which works as a frontend to the admin.

The openvswitch-nonetwork.service is used internally by the
'ifup-ovs/ifdown-ovs' scripts when adding or removing ports to
the bridge or when the openvswitch.service is enabled by the admin.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agobfd: Fix cpath_down set failure.
Alex Wang [Thu, 9 Jan 2014 02:51:43 +0000 (18:51 -0800)]
bfd: Fix cpath_down set failure.

Commit ccc09689 (bfd: Implement Bidirectional Forwarding Detection.)
set the bfd local diagnostic to "Concatenated Path Down" in response
to the set of cpath_down only when the current local diagnostic is
"None".  However, since the bfd local diagnostic is not reset when
the bfd state is restored from last erroneous state, the set of
cpath_down will not update the local diagnostic in that case.

This commit fixes the bug by always checking for local diagnostic
change when cpath_down is set or reset.

Bug #22625
Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-netdev: Use separate threads for forwarding.
Ben Pfaff [Sat, 28 Dec 2013 01:00:30 +0000 (17:00 -0800)]
dpif-netdev: Use separate threads for forwarding.

For now, we use exactly two threads.  Presumably at some point we will want
to make this configurable.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Make thread-safety much more granular.
Ben Pfaff [Wed, 8 Jan 2014 23:58:11 +0000 (15:58 -0800)]
dpif-netdev: Make thread-safety much more granular.

This will allow for parallelism in multithreaded forwarding in an upcoming
commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Introduce new mutex to protect queues.
Ben Pfaff [Fri, 27 Dec 2013 17:42:51 +0000 (09:42 -0800)]
dpif-netdev: Introduce new mutex to protect queues.

This is a first step in making thread safety more granular in dpif-netdev,
to allow for multithreaded forwarding.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Break actions out into new struct dp_netdev_actions.
Ben Pfaff [Wed, 8 Jan 2014 22:37:13 +0000 (14:37 -0800)]
dpif-netdev: Break actions out into new struct dp_netdev_actions.

This is analogous to the split between rule and rule_actions in
ofproto.  As there, it will allow retaining a reference to a rule's
actions, while processing them, without having to retain a reference
to the rule itself.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Take advantage of ovs_refcount for dp_netdev.
Ben Pfaff [Sat, 28 Dec 2013 03:41:10 +0000 (19:41 -0800)]
dpif-netdev: Take advantage of ovs_refcount for dp_netdev.

By making "destroyed" own a reference, we can treat dp_netdev's ref_cnt
like any other in Open vSwitch.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-atomic: Introduce a new 'struct ovs_refcount'.
Ben Pfaff [Sat, 28 Dec 2013 03:39:24 +0000 (19:39 -0800)]
ovs-atomic: Introduce a new 'struct ovs_refcount'.

This is a thin wrapper around an atomic_uint.  It is useful anyhow because
each ovs_refcount_ref() or ovs_refcount_unref() call saves a few lines of
code.

This commit also changes all the potential direct users over to use the new
data structure.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-atomic: Add atomic_destroy() and use everywhere it is needed.
Ben Pfaff [Wed, 8 Jan 2014 18:42:12 +0000 (10:42 -0800)]
ovs-atomic: Add atomic_destroy() and use everywhere it is needed.

C11 is able to require that atomics don't need to be destroyed, but some
of the OVS implementations do.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-atomic: New functions atomic_flag_init(), atomic_flag_destroy().
Ben Pfaff [Thu, 9 Jan 2014 01:13:28 +0000 (17:13 -0800)]
ovs-atomic: New functions atomic_flag_init(), atomic_flag_destroy().

Standard C11 doesn't need these functions because it is able to require
implementations not to need them.  But we can't construct a portable
implementation that does not need them in every case, so this commit adds
them.

These functions are only needed for atomic_flag objects that are
dynamically allocated (because statically allocated objects can use
ATOMIC_FLAG_INIT).  So far there aren't any of those, but an upcoming
commit will introduce one.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-netdev: Remove max_mtu tracking.
Ben Pfaff [Mon, 23 Dec 2013 23:46:22 +0000 (15:46 -0800)]
dpif-netdev: Remove max_mtu tracking.

Normally all the ports have the same mtu anyhow, so there is little
advantage in keeping track of the maximum mtu on a per-bridge basis.  In
upcoming commits, tracking mtu will require more locking and present
even less advantage (because the packet buffer will become per-thread, so
that reallocating once per thread becomes essentially a null cost).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-netdev: Use hmap instead of list+array for tracking ports.
Ben Pfaff [Wed, 25 Dec 2013 00:08:57 +0000 (16:08 -0800)]
dpif-netdev: Use hmap instead of list+array for tracking ports.

The goal is to make it easy to divide the ports into groups for handling
by threads.  It seems easy enough to do that by hash value, and a little
harder otherwise.

This commit has the side effect of raising the maximum number of ports from
256 to UINT32_MAX-1.  That is why some tests need to be updated:
previously, internally generated port names like "ovs_vxlan_4341" were
ignored because 4341 is bigger than the previous limit of 256.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-netdev: Use new "ovsthread_counter" to track dp statistics.
Ben Pfaff [Mon, 23 Dec 2013 22:04:13 +0000 (14:04 -0800)]
dpif-netdev: Use new "ovsthread_counter" to track dp statistics.

ovsthread_counter is an abstract interface that could be implemented
different ways.  The initial implementation is simple but less than
optimally efficient.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif: Remove unused 'get_max_ports' from provider interface.
Ben Pfaff [Mon, 23 Dec 2013 22:34:01 +0000 (14:34 -0800)]
dpif: Remove unused 'get_max_ports' from provider interface.

Nothing ever called this function.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agonetdev-dummy: Make netdev_rx_wait() wakeups work cross-thread for dummies.
Ben Pfaff [Thu, 26 Dec 2013 06:27:25 +0000 (22:27 -0800)]
netdev-dummy: Make netdev_rx_wait() wakeups work cross-thread for dummies.

Until now, netdev_dummy_rx_wait() has only checked whether the receive
queue for the dummy device is currently empty.  This has worked OK because
in practice packets were queued to dummy devices only from the same thread
that attempted to receive them.  An upcoming commit will use different
threads for these purposes, so this commit switches to a notification
method that works cross-thread.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agonetdev-dummy: Remove unused member 'listening' from struct netdev_dummy.
Ben Pfaff [Thu, 26 Dec 2013 01:15:20 +0000 (17:15 -0800)]
netdev-dummy: Remove unused member 'listening' from struct netdev_dummy.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif-upcall: Slightly simplify udpif_upcall_handler().
Ben Pfaff [Sat, 28 Dec 2013 00:29:24 +0000 (16:29 -0800)]
ofproto-dpif-upcall: Slightly simplify udpif_upcall_handler().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto/trace: Show megaflow fields in each resubmit.
Alex Wang [Thu, 9 Jan 2014 00:52:15 +0000 (16:52 -0800)]
ofproto/trace: Show megaflow fields in each resubmit.

This commit makes the ofproto/trace show the megaflow fields
for each resubmit.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto/trace: Change output field name.
Alex Wang [Thu, 9 Jan 2014 00:52:14 +0000 (16:52 -0800)]
ofproto/trace: Change output field name.

This commit changes the output field name from "Relevant fields"
to "Megaflow".

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto/trace: Remove the unused variables.
Alex Wang [Thu, 9 Jan 2014 00:52:13 +0000 (16:52 -0800)]
ofproto/trace: Remove the unused variables.

This commit removes the unused variables in ofproto_trace() function.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto/trace: Use final flow to compute "Relevant fields".
Alex Wang [Thu, 9 Jan 2014 00:52:12 +0000 (16:52 -0800)]
ofproto/trace: Use final flow to compute "Relevant fields".

Commit bcd2633a (ofproto-dpif: Store relevant fields for wildcarding
in facet.) introduced the bug that uses original input flow as final
flow to compute the "Relevant fields" in ofproto/trace ouput.  This
commit fixes this bug.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoutilities: Wrong command syntax in ovs-vsctl manpage.
Daniele Venturino [Thu, 9 Jan 2014 00:03:07 +0000 (16:03 -0800)]
utilities: Wrong command syntax in ovs-vsctl manpage.

The command shown in the man page to disable the STP protocol on a bridge
is:

        ovs-vsctl clear Bridge br0 stp_enable

Calling that, the following warning message is returned:

        ovs-vsctl: "clear" operation cannot be applied to column stp_enable
        of table Bridge, which is not allowed to be empty

It seems correct to use the command:

        ovs-vsctl set Bridge br0 stp_enable=false

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Use kmem_cache_free() instead of kfree()
Wei Yongjun [Wed, 8 Jan 2014 14:07:52 +0000 (06:07 -0800)]
datapath: Use kmem_cache_free() instead of kfree()

memory allocated by kmem_cache_alloc() should be freed using
kmem_cache_free(), not kfree().

Fixes: e298e5057006 ('openvswitch: Per cpu flow stats.')
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoFix !HAVE_NETLINK build
YAMAMOTO Takashi [Wed, 8 Jan 2014 06:07:30 +0000 (15:07 +0900)]
Fix !HAVE_NETLINK build

Fix a regression introduced by commit 4b97b70d
("ofproto-dpif: Enable NXAST_SAMPLE only if the datapath supports it.")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Fix a vlan-splinter megaflow bug
Andy Zhou [Tue, 7 Jan 2014 08:17:25 +0000 (00:17 -0800)]
ofproto-dpif: Fix a vlan-splinter megaflow bug

When vlan-splinter is enabled, ovs receives non-vlan flows from the
kernel vlan ports, vlan tag is then added to the incoming flow before
xlating, so that they look like those received from a trunk port.

In case megaflow is enabled, xlating may set vlan masks during rule
processing as usual. If those vlan masks were serialized and downloaded
to the kernel (this bug), those mega flows will be rejected due to
unexpected vlan mask encapsulation, since the original kernel flows do
not have vlan tags. This bug does not break connectivity, but impacts
performance since all traffic received on vlan splinter ports will now
be handled by vswitchd, as no datapath flows can be successfully
installed.

This fix is to make sure no vlan mask encapsulation is generated for
the datapath flow if its in_port was re-written by vlan-splinter
receiving logic.

Bug #22567

Signed-off-by: Andy Zhou <azhou@nicira.com>
10 years agonetdev: Update rx_recv documentation for NULL case
Simon Horman [Tue, 7 Jan 2014 05:33:37 +0000 (14:33 +0900)]
netdev: Update rx_recv documentation for NULL case

Replace truncated description of when rx_recv() may be NULL
with text used for other fields of netdev_class.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Correct check for MPLS LSE
Simon Horman [Tue, 7 Jan 2014 04:48:08 +0000 (13:48 +0900)]
ofproto-dpif-xlate: Correct check for MPLS LSE

zero is a valid MPLS LSE so it is not valid check against
that value for MPLS LSE presence. Instead, check against
the flow's dl_type which should be an MPLS type if an LSE is present.

This problem appears to have been introduced by
b2dd70be133bf86c ("Native Set-Field action.").

Cc: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Check for backported sctp_compute_cksum().
Jesse Gross [Fri, 3 Jan 2014 23:44:28 +0000 (15:44 -0800)]
datapath: Check for backported sctp_compute_cksum().

This is backported by RHEL7.

Reported-by: Ashok Byahatti <ashok.byahatti@embrane.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agoFAQ: Add entry on GRE module conflicts.
Jesse Gross [Fri, 3 Jan 2014 17:31:38 +0000 (09:31 -0800)]
FAQ: Add entry on GRE module conflicts.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agoodp-util: Simplify logic in odp_flow_key_to_flow__().
Ben Pfaff [Tue, 31 Dec 2013 18:36:19 +0000 (10:36 -0800)]
odp-util: Simplify logic in odp_flow_key_to_flow__().

Simplify (a && b) || (!a && c) to just a ? b : c.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoodp-util: Avoid null dereference in parse_8021q_onward().
Ben Pfaff [Tue, 31 Dec 2013 19:32:16 +0000 (11:32 -0800)]
odp-util: Avoid null dereference in parse_8021q_onward().

For parsing a mask, this code in parse_8021q_onward() always read out
the OVS_KEY_ATTR_VLAN attribute without first checking whether it existed.
The correct behavior, implemented by this commit, appears to be treating
the VLAN as wildcarded and to continue parsing the flow.

Bug #22312.
Reported-by: Krishna Miriyala <miriyalak@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agodpif: Use explicit packet metadata.
Jarno Rajahalme [Mon, 30 Dec 2013 23:58:58 +0000 (15:58 -0800)]
dpif: Use explicit packet metadata.

This helps reduce confusion about when a flow is a flow and when it is
just metadata.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoodp-execute: Consolidate callbacks.
Jarno Rajahalme [Mon, 30 Dec 2013 23:58:58 +0000 (15:58 -0800)]
odp-execute: Consolidate callbacks.

Use one callback instead of many, helps in adding new functionality
later on.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Make some tests more robust.
Jarno Rajahalme [Mon, 30 Dec 2013 23:42:36 +0000 (15:42 -0800)]
tests: Make some tests more robust.

These tests break if OVS internal hash function is changed.  Some of
this is due to dependency on the order in which elements are iterated
from hash maps, or the algorithm used is just dependent on the
specific hash values produced for specific inputs (groups).  These
changes make these test cases more robust, so that they will not break
so easily due to OVS internal hash function implementation changes.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Make bfd decay test robust.
Alex Wang [Mon, 30 Dec 2013 23:15:52 +0000 (15:15 -0800)]
bfd: Make bfd decay test robust.

With ovs multithreading implementation, the bfd decay test
becomes fragile due to its high dependency on timing sequence.
This commit removes these dependencies and makes the test robust.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Enable NXAST_SAMPLE only if the datapath supports it.
Ben Pfaff [Mon, 30 Dec 2013 22:49:25 +0000 (14:49 -0800)]
ofproto-dpif: Enable NXAST_SAMPLE only if the datapath supports it.

This prevents using an older datapath from breaking forwarding.

CC: Romain Lenglet <rlenglet@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobridge: Fix reversed string parsing in bridge_configure_flow_miss_model().
Alex Wang [Mon, 30 Dec 2013 22:21:40 +0000 (14:21 -0800)]
bridge: Fix reversed string parsing in bridge_configure_flow_miss_model().

This commit fixes a command matching error introduced by commit
7155fa52f (ofproto-dpif: Add 'force-miss-model' configuration).

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoconnmgr: Log when a packet-in is dropped due to queue overflow.
Ben Pfaff [Thu, 5 Dec 2013 17:21:14 +0000 (09:21 -0800)]
connmgr: Log when a packet-in is dropped due to queue overflow.

Reported-by: Anton Matsiuk <anton.matsiuk@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-linux: Simplify get_stats_via_netlink().
Ben Pfaff [Wed, 4 Dec 2013 23:46:55 +0000 (15:46 -0800)]
netdev-linux: Simplify get_stats_via_netlink().

There's no need to obtain the ifindex, because RTM_GETLINK is happy to take
the interface name.  There's no need to do a full nl_policy_parse(),
because we only need a single attribute.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-linux: Drop support for pre-2.6.19 kernels.
Ben Pfaff [Wed, 4 Dec 2013 23:43:31 +0000 (15:43 -0800)]
netdev-linux: Drop support for pre-2.6.19 kernels.

The OVS kernel module requires 2.6.32 or later, so there's no reason for
userspace to support older kernels.  This commit removes the special
fallback code for retrieving Linux netdev stats in pre-2.6.19 kernels,
which should no longer be useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-monitor: Remove monitor_init().
Alex Wang [Fri, 20 Dec 2013 23:12:58 +0000 (15:12 -0800)]
ofproto-dpif-monitor: Remove monitor_init().

Commit 881d47a9fa9 (monitor: Replace monitor_seq with periodic
wakeup.) removes the global "struct seq" in ofproto-dpif-monitor
module.  This change makes the monitor_init() no longer needed.

This commit removes the monitor_init() from ofproto-dpif-monitor.c.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Remove \r from source tree.
Ben Pfaff [Mon, 30 Dec 2013 19:35:41 +0000 (11:35 -0800)]
tests: Remove \r from source tree.

An ovsdb-server test had a literal carriage return in a check that
validates a directory name.  It isn't really necessary (who puts a carriage
return in a directory name?) and it does cause problems for passing around
patches via email, so just delete it.

CC: Arun Sharma <arun.sharma@calsoftinc.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoMakefile.am: Always use C locale for "sort" and "comm".
Ben Pfaff [Tue, 24 Dec 2013 16:37:32 +0000 (08:37 -0800)]
Makefile.am: Always use C locale for "sort" and "comm".

Otherwise, if the user changes locales between running the "dist-hook-git"
and "distfiles" targets (e.g. in different invocations of "make"), then
the "dist-hook-git" target might falsely report that the distribution is
missing files.

Reported-by: John Darrington <john@darrington.wattle.id.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoAdd common definitions for Windows builds.
Alin Serdean [Thu, 19 Dec 2013 18:23:12 +0000 (18:23 +0000)]
Add common definitions for Windows builds.

Signed-off-by: Alin Serdean <aserdean at cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Notify connectivity_seq on rmt_state changes.
Joe Stringer [Wed, 25 Dec 2013 00:50:53 +0000 (16:50 -0800)]
bfd: Notify connectivity_seq on rmt_state changes.

The bfd module did not previously change the global connectivity_seq
when the remote state changed, which means that such state changes may
not be propagated to the database. This is particularly bad if this is
the last state transition to happen in an otherwise stable environment.
This patch checks for transitions in remote state, and ensures that the
main thread will update the database when these happen.

Bug #22136.

Co-authored-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Verbosity option for dpif/dump-flows command.
Gurucharan Shetty [Tue, 24 Dec 2013 01:43:48 +0000 (17:43 -0800)]
ofproto-dpif: Verbosity option for dpif/dump-flows command.

The display of port names instead of port number for in_port
is considered useful. Enabling the verbosity option also lets
you see all the wildcarded fields and can be helpful.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-parse: Check port number only after parsing it in parse_output().
Daisuke Kotani [Mon, 23 Dec 2013 09:19:48 +0000 (18:19 +0900)]
ofp-parse: Check port number only after parsing it in parse_output().

This patch allows to set max_len to UINT16_MAX in parse_output
if output port is OFPP_CONTROLLER.

Signed-off-by: Daisuke Kotani <kotani@net.ist.i.kyoto-u.ac.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agostdio: New module, initially to provide working [v]snprintf() on Windows.
Ben Pfaff [Tue, 24 Dec 2013 17:18:42 +0000 (09:18 -0800)]
stdio: New module, initially to provide working [v]snprintf() on Windows.

This should transparently define snprintf() and vsnprintf() wrappers for
use on Windows.

CC: Saurabh Shah <ssaurabh@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Make check_table_id generic
Simon Horman [Mon, 23 Dec 2013 12:54:59 +0000 (21:54 +0900)]
ofproto: Make check_table_id generic

Update check_table_id() so that rather than returning a flow_mod specific
error it simply returns true of false. And update callers accordingly.

This is in preparation for using check_table_id() in conjunction
with table_mod.

Also update check_table_id to use OFPTT_ALL.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoINSTALL.NetBSD: Some installation/setup notes for NetBSD
YAMAMOTO Takashi [Tue, 24 Dec 2013 01:39:58 +0000 (10:39 +0900)]
INSTALL.NetBSD: Some installation/setup notes for NetBSD

Mainly for ovs developers who kindly want to test on NetBSD
but not familiar with it.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Avoid leaving a broken def
YAMAMOTO Takashi [Tue, 24 Dec 2013 01:04:08 +0000 (10:04 +0900)]
ofproto: Avoid leaving a broken def

On errors, don't leave a broken ipfix-entries.def, which might cause
mysterious errors later.
(Probably the most common cause is the lack of python xml libraries.)

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoPrepare for post-2.1.0 (2.1.90).
Justin Pettit [Tue, 24 Dec 2013 00:17:50 +0000 (16:17 -0800)]
Prepare for post-2.1.0 (2.1.90).

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoPrepare for 2.1.0.
Justin Pettit [Tue, 24 Dec 2013 00:15:46 +0000 (16:15 -0800)]
Prepare for 2.1.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: compat: Configure check GRE DEMUX.
Pravin B Shelar [Mon, 23 Dec 2013 03:43:58 +0000 (19:43 -0800)]
datapath: compat: Configure check GRE DEMUX.

RHEL6-openstack kernel has backported gre DEMUX module,
Therefore add configure check to detect it.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Bug #21936

10 years agodatapath: compat: Add configure check for lockdep_rtnl_is_held()
Pravin B Shelar [Fri, 20 Dec 2013 23:34:40 +0000 (15:34 -0800)]
datapath: compat: Add configure check for lockdep_rtnl_is_held()

RHEL6-openstack kernel has backported lockdep_rtnl_is_held().

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: compat: Fix skb_has_frag_list definition.
Pravin B Shelar [Fri, 20 Dec 2013 22:30:28 +0000 (14:30 -0800)]
datapath: compat: Fix skb_has_frag_list definition.

RHEL6-openstack kernel has already replaced skb_has_frags
with skb_has_frag_list().

Fix compilation error on RHEL6-openstack.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agobitmap: add bitmap_count1 function
Ben Pfaff [Mon, 23 Dec 2013 20:56:14 +0000 (12:56 -0800)]
bitmap: add bitmap_count1 function

Signed-off-by: Alexander Wu <alexander.wu@huawei.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-dev.py: Pass leak-check=full to valgrind.
Ethan Jackson [Thu, 12 Dec 2013 03:04:10 +0000 (19:04 -0800)]
ovs-dev.py: Pass leak-check=full to valgrind.

This valgrind leak checker isn't really useful without this.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agocompiler.h: Update documentation
Joe Stringer [Fri, 20 Dec 2013 20:52:52 +0000 (12:52 -0800)]
compiler.h: Update documentation

OVS_LOCKS_EXCLUDED doesn't exist. This should be OVS_EXCLUDED.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoNEWS: Mention new ovs-ofctl ofp-parse-pcap command.
Ben Pfaff [Mon, 23 Dec 2013 18:41:14 +0000 (10:41 -0800)]
NEWS: Mention new ovs-ofctl ofp-parse-pcap command.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-ofctl: New command "ofp-parse-pcap" to dump OpenFlow from PCAP files.
Ben Pfaff [Fri, 22 Nov 2013 21:17:23 +0000 (13:17 -0800)]
ovs-ofctl: New command "ofp-parse-pcap" to dump OpenFlow from PCAP files.

Based on the number of people who ask about Wireshark support for OpenFlow,
this is likely to be widely useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agopcap-file: Add timestamp support for reading and writing pcap files.
Ben Pfaff [Fri, 22 Nov 2013 19:42:06 +0000 (11:42 -0800)]
pcap-file: Add timestamp support for reading and writing pcap files.

Only the write support is initially useful, but an upcoming commit will add
a user for the read support.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofpbuf: New function ofpbuf_shift().
Ben Pfaff [Fri, 22 Nov 2013 19:42:42 +0000 (11:42 -0800)]
ofpbuf: New function ofpbuf_shift().

An upcoming commit will add the first user.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: bug.h missing from distfiles
Chris Luke [Sun, 22 Dec 2013 22:43:33 +0000 (14:43 -0800)]
datapath: bug.h missing from distfiles

commit 7c359202 introduced datapath/linux/compat/include/bug.h
but did not include it in datapath/linux/Modules.mk, which results
in the following build error:

> The distribution is missing the following files:
> datapath/linux/compat/include/linux/bug.h

Signed-off-by: Chris Luke <chris_luke@cable.comcast.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Fix sparse warning on BUILD_BUG_ON_INVALID()
Andy Zhou [Sat, 21 Dec 2013 00:18:58 +0000 (16:18 -0800)]
datapath: Fix sparse warning on BUILD_BUG_ON_INVALID()

Sparse gives the following warnings when compile against Linux kernel
3.5:

 CHECK   /root/projs/ovs/openvswitch/datapath/linux/skbuff-openvswitch.c
 include/linux/mm.h:405:9: error: undefined identifier
 'BUILD_BUG_ON_INVALID'
 include/linux/mm.h:405:9: error: not a function <noident>

The same issue may also exist in kernel 3.6.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
10 years agobfd: Send FINAL immediately after receiving POLL.
Alex Wang [Fri, 20 Dec 2013 22:53:52 +0000 (14:53 -0800)]
bfd: Send FINAL immediately after receiving POLL.

Commit 307464a11 (ofproto-dpif-monitor: Use heap to order the mport
wakeup time.) makes bfd only send packet at specified periodic instant.
This fails to meet the RFC5880 requirement, which requires bfd send
FINAL immediately after receiving POLL.

This commit fixes the above issue by scheduling bfd to send FINAL
within 100 ms after receiving POLL.

Signed-off-by: Alex Wang <alexw@nicira.com>
10 years agodatapath: Check for backported netdev_features_t.
Jesse Gross [Tue, 17 Dec 2013 18:22:40 +0000 (10:22 -0800)]
datapath: Check for backported netdev_features_t.

This is apparently used by CentOS 6.5.

Reported-by: Phil Daws <uxbod@splatnix.net>
Reported-by: Edouard Bourguignon <madko@linuxed.net>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agolinux: Report supported user features to the kernel
Thomas Graf [Thu, 19 Dec 2013 15:20:42 +0000 (16:20 +0100)]
linux: Report supported user features to the kernel

Following commit (''netlink: Do not enforce alignment of last Netlink
attribute''), signal the ability to receive unaligned Netlink messages
to the datapath to enable utilization of zerocopy optimizations.

Opening a datapath is now done by issueing a OVS_DP_CMD_SET in order
to overwrite previously set user features.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoovs-check-dead-ifs: Flush buffer before calling execvp.
Gurucharan Shetty [Fri, 20 Dec 2013 17:30:21 +0000 (09:30 -0800)]
ovs-check-dead-ifs: Flush buffer before calling execvp.

According to Python documentation here for execvp:
http://docs.python.org/2/library/os.html
"The current process is replaced immediately. Open file objects
and descriptors are not flushed, so if there may be data buffered
on these open files, you should flush them using sys.stdout.flush()
or os.fsync() before calling an exec* function.

Without the flush, we will miss the print statements before that
if we redirect the o/p to a file.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-print: Print durations with at least three decimals.
Ben Pfaff [Fri, 20 Dec 2013 16:39:27 +0000 (08:39 -0800)]
ofp-print: Print durations with at least three decimals.

Occasionally I run a command like this:
    watch -n.1 ovs-ofctl dump-flows br0
to see how flows change over time.  Until now, it has been more difficult
than necessary to spot real changes, because flows "jump around" as the
number of decimals printed for duration changes from moment to moment.
That is, you might see
    cookie=0x0, duration=4.566s, table=0, n_packets=0, ...
one moment, and then
    cookie=0x0, duration=4.8s, table=0, n_packets=0, ...
the next moment.  Shortening 4.8 to 4.800 shifts everything following it
two places to the left, creating a visual jump.

This commit avoids that problem by always printing at least three decimals
if we print any.  There can still be an occasional jump if a duration is
exactly on a second boundary, but that only happens 1/1000 of the time.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>