cascardo/ovs.git
9 years agonetlink-socket: Work around upstream kernel Netlink bug.
Ben Pfaff [Mon, 30 Jun 2014 21:57:42 +0000 (14:57 -0700)]
netlink-socket: Work around upstream kernel Netlink bug.

The upstream kernel net/netlink/af_netlink.c netlink_recvmsg() contains the
following code to refill the Netlink socket buffer with more dump skbs
while a dump is in progress:

if (nlk->cb && atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) {
ret = netlink_dump(sk);
if (ret) {
sk->sk_err = ret;
sk->sk_error_report(sk);
}
}

The netlink_dump() function that this calls returns a negative number on
error, the convention used throughout the kernel, and thus sk->sk_err
receives a negative value on error.

However, sk->sk_err is supposed to contain either 0 or a positive errno
value, as one can see from a quick "grep" through net for 'sk_err =', e.g.:

    ipv4/tcp.c:2067: sk->sk_err = ECONNRESET;
    ipv4/tcp.c:2069: sk->sk_err = ECONNRESET;
    ipv4/tcp_input.c:4106: sk->sk_err = ECONNREFUSED;
    ipv4/tcp_input.c:4109: sk->sk_err = EPIPE;
    ipv4/tcp_input.c:4114: sk->sk_err = ECONNRESET;
    netlink/af_netlink.c:741: sk->sk_err = ENOBUFS;
    netlink/af_netlink.c:1796: sk->sk_err = ENOBUFS;
    packet/af_packet.c:2476: sk->sk_err = ENETDOWN;
    unix/af_unix.c:341: other->sk_err = ECONNRESET;
    unix/af_unix.c:407: skpair->sk_err = ECONNRESET;

The result is that the next attempt to receive from the socket will return
the error to userspace with the wrong sign.

(The root of the error in this case is that multiple threads are attempting
to read a single flow dump from a shared fd.  That should work, but the
kernel has an internal race that can result in one or more of those threads
hitting the EINVAL case at the start of netlink_dump().  The EINVAL is
harmless in this case and userspace should be able to ignore it, but
reporting the EINVAL as if it were a 22-byte message received in userspace
throws a real wrench in the works.)

This bug makes me think that there are probably not many programs doing
multithreaded Netlink dumps.  Maybe it is good that we are considering
other approaches.

VMware-BZ: #1255704
Reported-by: Mihir Gangar <gangarm@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agoINSTALL: Mention conflict with NET_IPGRE setting before Linux 3.11.
Ben Pfaff [Wed, 2 Jul 2014 18:52:41 +0000 (11:52 -0700)]
INSTALL: Mention conflict with NET_IPGRE setting before Linux 3.11.

I found when reconfiguring my kernel that if I turned on NET_IPGRE, GRE
tunnels no longer worked.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
9 years agoINSTALL.DPDK: fix a typo in remote line
Flavio Leitner [Wed, 2 Jul 2014 18:47:41 +0000 (15:47 -0300)]
INSTALL.DPDK: fix a typo in remote line

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
9 years agoINSTALL.Fedora, INSTALL.RHEL: Make instructions more explicit.
Ben Pfaff [Wed, 2 Jul 2014 19:50:08 +0000 (12:50 -0700)]
INSTALL.Fedora, INSTALL.RHEL: Make instructions more explicit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
9 years agorevalidator: Improve optimization to skip revalidation.
Joe Stringer [Wed, 2 Jul 2014 07:41:33 +0000 (07:41 +0000)]
revalidator: Improve optimization to skip revalidation.

The should_revalidate() optimisation introduced with commit 698ffe3623
(revalidator: Only revalidate high-throughput flows.) was a little
aggressive, occasionally deleting flows even when OVS is quite capable
of performing full revalidation.

This commit modifies the logic to:
* Firstly, check if we are likely to handle full revalidation, and
  attempt that instead.
* Secondly, fall back to the existing flow throughput estimations to
  determine whether to revalidate the flow or just delete it.

VMware-BZ: #1271926

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agodatapath: Allow pop and push MPLS actions after pop VLAN
Simon Horman [Mon, 30 Jun 2014 04:20:14 +0000 (13:20 +0900)]
datapath: Allow pop and push MPLS actions after pop VLAN

This patch loosens the restrictions surrounding push and pop MPLS actions
such that they will be allowed after a pop VLAN action if the inner
ethernet type is acceptable for pop and push MPLS actions. This implies
that there is only one VLAN tag present.

Some analysis of logic of this change is as follows:

    The purpose of tracking vlan_tci is to allow prohibition of push
    and pop MPLS actions in the presence of a VLAN. In this scenario
    the VLAN_TAG_PRESENT bit of vlan_tci is set and eth_type is that of
    the packet with the outermost VLAN tag removed.

    A pop VLAN action may clear vlan_tci as it removes the outermost
    VLAN tag and the push and pop MPLS logic may rely on eth_type for
    their prohibition logic.

    This will not allow push and pop MPLS on packets with multiple VLAN
    tags, regardless of if they are all remove using POP VLAN, as there
    is no mechanism to expose the inner ethernet type beyond that of
    the outermost VLAN tag.

Suggested-by: Jesse Gross <jgross@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agodatapath: Use exact lookup for flow_get and flow_del.
Alex Wang [Mon, 30 Jun 2014 21:51:02 +0000 (14:51 -0700)]
datapath: Use exact lookup for flow_get and flow_del.

Due to the race condition in userspace, there is chance that two
overlapping megaflows could be installed in datapath.  And this
causes userspace unable to delete the less inclusive megaflow flow
even after it timeout, since the flow_del logic will stop at the
first match of masked flow.

This commit fixes the bug by making the kernel flow_del and flow_get
logic check all masks in that case.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath: Change u64_stats_* to use _irq instead of _bh().
Jesse Gross [Mon, 30 Jun 2014 20:43:25 +0000 (13:43 -0700)]
datapath: Change u64_stats_* to use _irq instead of _bh().

The upstream u64_stats API has been changed to remove the _bh()
versions and switch all consumers to use IRQ safe variants instead.
This was done to be safe for netpoll generated packets, which can
occur in hard IRQ context. From a safety perspective, this doesn't
directly affect OVS since it doesn't support netpoll. However, this
change has been backported to older kernels so OVS needs to use the
new API to compile.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotest-vconn: Change the expected error for Windows.
Gurucharan Shetty [Wed, 25 Jun 2014 02:52:54 +0000 (02:52 +0000)]
test-vconn: Change the expected error for Windows.

On Windows ECONNRESET is WSAECONNRESET.

Also, "unix" connections are done through TCP sockets.
For the 'refuse-connection' test, the error message for Windows
is WSAECONNRESET instead of EPIPE.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agorhel, xenserver: Run unit tests while creating rpms.
Gurucharan Shetty [Mon, 23 Jun 2014 21:05:00 +0000 (14:05 -0700)]
rhel, xenserver: Run unit tests while creating rpms.

For RHEL, Fedora and Xenserver, run unit tests while
building rpms.  This may catch some cross-platform bugs.

The commit also allows the users to optionally skip unit tests.
(On debian, the default is to run unit tests. For consistency,
do the same for rpms.)

VMware-BZ: 1267127

CC: Flavio Leitner <fbl@redhat.com>
CC: Ben Pfaff <blp@nicira.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Tested-by: Flavio Leitner <fbl@redhat.com>
9 years agodpif-netdev: Batch megaflow lookup.
Ethan Jackson [Tue, 24 Jun 2014 01:28:43 +0000 (18:28 -0700)]
dpif-netdev: Batch megaflow lookup.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoclassifier: Add a batched miniflow lookup function.
Ethan Jackson [Tue, 24 Jun 2014 01:40:47 +0000 (18:40 -0700)]
classifier: Add a batched miniflow lookup function.

Used in a future patch.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agodpif-netdev: Take the classifier rdlock once per batch.
Ethan Jackson [Thu, 5 Jun 2014 18:23:06 +0000 (11:23 -0700)]
dpif-netdev: Take the classifier rdlock once per batch.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agodpif-netdev: Rename batch_pkt_execute.
Ethan Jackson [Tue, 24 Jun 2014 01:22:03 +0000 (18:22 -0700)]
dpif-netdev: Rename batch_pkt_execute.

The new name "packet_batch" is a bit more straight forward.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agodatapath: Fix error handling for Geneve options in ipv4_tun_to_nlattr().
Ben Pfaff [Mon, 30 Jun 2014 20:48:30 +0000 (13:48 -0700)]
datapath: Fix error handling for Geneve options in ipv4_tun_to_nlattr().

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
9 years agonetdev-dpdk: Add OVS_UNLIKELY annotations in dpdk_do_tx_copy().
Ryan Wilson [Fri, 27 Jun 2014 01:16:41 +0000 (18:16 -0700)]
netdev-dpdk: Add OVS_UNLIKELY annotations in dpdk_do_tx_copy().

Since dropped packets due to large packet size or lack of memory
are unlikely, it is best to add OVS_UNLIKELY annotations to these
conditions.

Signed-off-by: Ryan Wilson <wryan@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoovs-benchmark: Compile for windows.
Gurucharan Shetty [Wed, 2 Apr 2014 15:31:50 +0000 (08:31 -0700)]
ovs-benchmark: Compile for windows.

This just makes ovs-benchmark compile on windows.
This lets us go ahead with just a 'make' instead of
picking and choosing executables that are tested to work on
windows as arguments for make.

This commit does not make ovs-benchmark a supported utility
on windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agotests: Port test-sflow and test-netflow to Windows.
Gurucharan Shetty [Fri, 23 May 2014 20:40:07 +0000 (13:40 -0700)]
tests: Port test-sflow and test-netflow to Windows.

After the change, both of them compile. test-netflow related
unit tests pass.

test-sflow related tests do not pass because
of LOOPBACK_INTERFACE constraints for 'agent'.
(It should be revisited later.)

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agonetdev-dpdk: Fix memory leak in dpdk_do_tx_copy().
Ryan Wilson [Fri, 27 Jun 2014 01:16:39 +0000 (18:16 -0700)]
netdev-dpdk: Fix memory leak in dpdk_do_tx_copy().

This patch fixes a bug where rte_pktmbuf_alloc() would fail and
packets which succeeded to allocate memory with rte_pktmbuf_alloc()
would not be sent and leak memory.

Also, as a byproduct of using a local variable to record dropped
packets, this reduces the locking of the netdev's mutex when
multiple packets are dropped in dpdk_do_tx_copy().

Signed-off-by: Ryan Wilson <wryan@nicira.com>
Acked-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agonetdev-dpdk: Set current timestamp when flushing TX queue.
Ryan Wilson [Fri, 27 Jun 2014 00:41:46 +0000 (17:41 -0700)]
netdev-dpdk: Set current timestamp when flushing TX queue.

The current timestamp should be set every time the queue is flushed.
Thus, if DRAIN_TSC timer cycles have passed since the last timestamp,
the send queue should be flushed again.

Signed-off-by: Ryan Wilson <wryan@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agonetdev-dpdk: Refactor dpdk_queue_flush().
Ryan Wilson [Fri, 27 Jun 2014 00:41:45 +0000 (17:41 -0700)]
netdev-dpdk: Refactor dpdk_queue_flush().

This patch refactors dpdk_queue_flush() to reuse code in
dpdk_queue_pkts().

Signed-off-by: Ryan Wilson <wryan@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoINSTALL.RHEL: Fix a typo.
Gurucharan Shetty [Mon, 30 Jun 2014 15:01:51 +0000 (08:01 -0700)]
INSTALL.RHEL: Fix a typo.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agopoll-loop: Create Windows event handles for sockets automatically.
Gurucharan Shetty [Fri, 27 Jun 2014 20:30:49 +0000 (13:30 -0700)]
poll-loop: Create Windows event handles for sockets automatically.

We currently have a poll_fd_wait_event(fd, wevent, events) function that
is used at places common to Windows and Linux where we have to wait on
sockets.  On Linux, 'wevent' is always set as zero. On Windows, for sockets,
when we send both 'fd' and 'wevent', we associate them with each other for
'events' and then wait on 'wevent'. Also on Windows, when we only send 'wevent'
to this function, we would simply wait for all events for that 'wevent'.

There is a disadvantage with this approach.
* Windows clients need to create a 'wevent' and then pass it along. This
means that at a lot of places where we create sockets, we also are forced
to create a 'wevent'.

With this commit, we pass the responsibility of creating a 'wevent' to
poll_fd_wait() in case of sockets. That way, a client using poll_fd_wait()
is only concerned about sockets and not about 'wevents'. There is a potential
disadvantage with this change in that we create events more often and that
may have a performance penalty. If that turns out to be the case, we will
eventually need to create a pool of wevents that can be re-used.

In Windows, there are cases where we want to wait on a event (not
associated with any sockets) and then control it using functions
like SetEvent() etc. For that purpose, introduce a new function
poll_wevent_wait(). For this function, the client needs to create a event
and then pass it along as an argument.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-By: Ben Pfaff <blp@nicira.com>
9 years agorpm: improved RPM sources dir explanation
Flavio Leitner [Mon, 30 Jun 2014 00:21:05 +0000 (21:21 -0300)]
rpm: improved RPM sources dir explanation

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoudpif: Add command to wait for revalidation.
Joe Stringer [Wed, 25 Jun 2014 14:02:45 +0000 (14:02 +0000)]
udpif: Add command to wait for revalidation.

This allows us to remove some of the sleeps from the testsuite.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Initialize OVS_CB in ovs_vport_receive()
Pravin B Shelar [Thu, 26 Jun 2014 22:15:00 +0000 (15:15 -0700)]
datapath: Initialize OVS_CB in ovs_vport_receive()

On packet recv OVS CB is initialized in multiple function.
Following patch moves all these initialization to
ovs_vport_receive().
This patch also save a check in execute actions.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
9 years agodpdk: High speed PMD physical NIC queue size
Polehn, Mike A [Thu, 19 Jun 2014 22:58:26 +0000 (22:58 +0000)]
dpdk: High speed PMD physical NIC queue size

Large TX and RX queues are needed for high speed 10 GbE physical NICS.
Observed a 250% zero loss improvement over small NIC queue test for
port to port flow test.

Signed-off-by: Mike A. Polehn <mike.a.polehn@intel.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoFAQ: Add an entry for multicast snooping with VLAN
Flavio Leitner [Thu, 26 Jun 2014 12:00:37 +0000 (09:00 -0300)]
FAQ: Add an entry for multicast snooping with VLAN

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
9 years agobuild: Allow building with autoconf 2.63
Thomas Graf [Fri, 27 Jun 2014 07:31:57 +0000 (09:31 +0200)]
build: Allow building with autoconf 2.63

Reduces the dependency on autoconf from 2.64 to 2.63 to ease building
on older platforms. There is only a few macros missing and they can
be provided easily.

A handful of tests needed modification. The difference in quoting
behaviour between 2.63 and later require the m4_define() to be
manually unfolded.

The Debian control file is left untouched on purpose. The decision
whether to adjust the dependency is left to the respective maintainers.

Tested with autoconf 2.63 and 2.69.

Cc: Scott Mann <smann@noironetworks.com>
Cc: Don Kehn <dkehn@noironetworks.com>
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agotest-ovsdb: Workaround unicode bug in Python 2.4.x.
Gurucharan Shetty [Fri, 20 Jun 2014 20:13:51 +0000 (13:13 -0700)]
test-ovsdb: Workaround unicode bug in Python 2.4.x.

Run the following command on Xenserver:
PYTHONPATH=`pwd`/python/compat::`pwd`/python python ./tests/test-ovsdb.py \
parse-atoms '{"type": "string", "minLength": 2}'    \
'[""]'     '["a"]'     '["ab"]'     '["abc"]'     '["\ud834\udd1e"]'

And we get the following error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\U0001d11e'
in position 23: ordinal not in range(128).

It looks like we are hitting the following bug:
http://bugs.python.org/issue2517

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-By: Ben Pfaff <blp@nicira.com>
9 years agovlan-splinters.at: Skip the test for Windows.
Gurucharan Shetty [Tue, 17 Jun 2014 20:24:37 +0000 (13:24 -0700)]
vlan-splinters.at: Skip the test for Windows.

vlan splinters is to workaround buggy network drivers of Linux.
Skip the test for Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-ofctl: Ability to read a hex string from file.
Gurucharan Shetty [Wed, 18 Jun 2014 18:12:36 +0000 (11:12 -0700)]
ovs-ofctl: Ability to read a hex string from file.

The unit test, "OFPST_TABLE reply - OF1.2" in ofp-print.at
sends a very large hex string as an argument to 'ovs-ofctl ofp-print'.
The length of the hex string exceeds the maximum command line length
in Windows. With this commit, we can pass the same hex string by
placing it inside a file.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-vsctl.at: Workaround lack of 'kill -l' on Windows.
Gurucharan Shetty [Tue, 17 Jun 2014 19:35:32 +0000 (12:35 -0700)]
ovs-vsctl.at: Workaround lack of 'kill -l' on Windows.

Also, fflush(stderr) when we raise a signal. The test
this commit is changing would fail otherwise.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoutil: Set two digit exponents for scientific notation.
Gurucharan Shetty [Tue, 17 Jun 2014 18:16:06 +0000 (11:16 -0700)]
util: Set two digit exponents for scientific notation.

By default, three digit exponents are printed on Windows.
Many unit tests in Open vSwitch expect two digit exponents.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovsdb-tool: Workaround inability to replace existing file on Windows.
Gurucharan Shetty [Mon, 16 Jun 2014 22:49:06 +0000 (15:49 -0700)]
ovsdb-tool: Workaround inability to replace existing file on Windows.

rename() on an existing destination file fails on Windows. This commit
worksaround that problem.

There are two tests that test it. But both of them use the ovsdb-server's
--run option for the test and it does not exist in Windows. So change
the test to workaround the lack of that feature.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovsdb-server.at: Handle different error message for already opened database.
Gurucharan Shetty [Mon, 2 Jun 2014 17:49:18 +0000 (10:49 -0700)]
ovsdb-server.at: Handle different error message for already opened database.

Commit ebed9f78(ovsdb-server: Improve message for "add-db" of
database already open.) improved the error message seen when
opening an already opened database on Linux. For Windows,
we still need to look for the lockfile error message.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agointerface-reconfigure.at: Skip POSIX specfic tests for Windows.
Gurucharan Shetty [Mon, 16 Jun 2014 20:01:36 +0000 (13:01 -0700)]
interface-reconfigure.at: Skip POSIX specfic tests for Windows.

interface-reconfigure.at mostly tests functionality for Xenserver
and the tests use some POSIX only features. Skip them for Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto-dpif.at: Skip sflow tests in Windows.
Gurucharan Shetty [Mon, 16 Jun 2014 18:18:33 +0000 (11:18 -0700)]
ofproto-dpif.at: Skip sflow tests in Windows.

sflow feature needs to be investigated for Windows. Right now
test-sflow related tests do not pass because of LOOPBACK_INTERFACE
constraints for 'agent'. Add a TODO item and skip the tests.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agofile_name.at: Skip a symlink related test for Windows.
Gurucharan Shetty [Mon, 16 Jun 2014 18:08:14 +0000 (11:08 -0700)]
file_name.at: Skip a symlink related test for Windows.

There is no one-one mapping of symlinks between Linux and
Windows. This test currently fails on Windows and we do not
really need this functionality on Windows. So skip it.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-ofctl.at: Prevent msys from getting confused with ipv6 address.
Gurucharan Shetty [Mon, 9 Jun 2014 17:04:58 +0000 (10:04 -0700)]
ovs-ofctl.at: Prevent msys from getting confused with ipv6 address.

msys has a set of rules which triggers an automatic conversion of
arguments into something else to suit Windows requirements. Sometimes
this also causes unwanted conversions. Details of the rules is here:
http://www.mingw.org/wiki/Posix_path_conversion

msys converts ::1/::1 into ;1\;1. To prevent this, use fullform
ipv6 address of the form 0:0:0:0:0:0:0:1 instead.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agorconn: Don't warn when peer abruptly closes connection.
Gurucharan Shetty [Mon, 9 Jun 2014 15:47:12 +0000 (08:47 -0700)]
rconn: Don't warn when peer abruptly closes connection.

On Windows, when a peer terminates without calling a close
on socket fd, the server ends up printing "connection dropped"
warning messages. We probably don't want those warning messages
when the error is WSAECONNRESET.

(In OVS unit tests on Windows, anytime a client like ovs-ofctl
calls a ovs_fatal without clean close(fd) on the socket, the
server like ovs-vswitchd prints warnings that cause unit tests
to fail.)

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-vsctl.at: Adjust test output for Windows.
Gurucharan Shetty [Mon, 2 Jun 2014 21:23:44 +0000 (14:23 -0700)]
ovs-vsctl.at: Adjust test output for Windows.

"xargs echo" introduces "^M" character inbetween the
records on Windows. Workaround it.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovsdb-server.at: Adjust PKIDIR for ssl test.
Gurucharan Shetty [Mon, 2 Jun 2014 20:04:35 +0000 (13:04 -0700)]
ovsdb-server.at: Adjust PKIDIR for ssl test.

For this particular test, we pass the PKIDIR through a
ovsdb-tool transact and msys does not convert the path style.
(On Windows, we have to pass the directory in the form C:/foo/bar.pem.)

So get the Windows style path through 'pwd -W'(which is called through
the function pwd ())

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovsdb-server.at: Use different test for socket files.
Gurucharan Shetty [Mon, 2 Jun 2014 17:46:23 +0000 (10:46 -0700)]
ovsdb-server.at: Use different test for socket files.

On Windows, we really do not have any "socket" files created.
We instead create a regular file with a TCP port number written
inside it.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovsdb-server.at: Skip a few tests with '--monitor' option.
Gurucharan Shetty [Mon, 16 Jun 2014 17:09:14 +0000 (10:09 -0700)]
ovsdb-server.at: Skip a few tests with '--monitor' option.

We do not support that option in Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agostream-tcp: Cleanup files created for Windows "unix" sockets.
Gurucharan Shetty [Mon, 2 Jun 2014 17:20:34 +0000 (10:20 -0700)]
stream-tcp: Cleanup files created for Windows "unix" sockets.

On Windows, we create "unix sockets" by creating TCP sockets
and hiding the TCP port number in files. When we close the
pstream session, we need to delete the file.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodpif: Explain a bug, why it isn't important, and why it's hard to fix.
Ben Pfaff [Wed, 25 Jun 2014 18:02:10 +0000 (11:02 -0700)]
dpif: Explain a bug, why it isn't important, and why it's hard to fix.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
9 years agodpif: When executing an operation with help, log the sub-executes.
Ben Pfaff [Wed, 25 Jun 2014 17:44:25 +0000 (10:44 -0700)]
dpif: When executing an operation with help, log the sub-executes.

This should make it easier to identify problems that result from bugs in
the execution helper.

Suggested-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
9 years agodpif: Consistently help datapath to execute oversized actions.
Ben Pfaff [Wed, 25 Jun 2014 17:08:04 +0000 (10:08 -0700)]
dpif: Consistently help datapath to execute oversized actions.

Only dpif_execute() was checking for oversized actions but dpif_operate()
should do so also.  This fixes the problem.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
9 years agodatapath: Remove redundant tcp_flags code.
Joe Stringer [Thu, 26 Jun 2014 11:24:24 +0000 (11:24 +0000)]
datapath: Remove redundant tcp_flags code.

These two cases used to be treated differently for IPv4/IPv6, but they
are now identical.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agolib: Fix FreeBSD build.
Joe Stringer [Wed, 25 Jun 2014 07:41:41 +0000 (07:41 +0000)]
lib: Fix FreeBSD build.

Various recent commits have introduced build failures on FreeBSD. This
patch fixes them.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/classifier: Clarify find_match_wc().
Jarno Rajahalme [Fri, 13 Jun 2014 17:38:05 +0000 (10:38 -0700)]
lib/classifier: Clarify find_match_wc().

Reduce the number of goto statements by returning via a new helper
fill_range_wc() when no match is found.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/classifier: Add miniflow_and_mask_matches_flow_wc.
Jarno Rajahalme [Fri, 13 Jun 2014 17:38:05 +0000 (10:38 -0700)]
lib/classifier: Add miniflow_and_mask_matches_flow_wc.

miniflow_and_mask_matches_flow_wc() fills in the masks in flow
wildcards, so a separate step to that effect is no longer needed.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/classifier: Optimize megaflows for single rule case.
Jarno Rajahalme [Fri, 13 Jun 2014 17:38:05 +0000 (10:38 -0700)]
lib/classifier: Optimize megaflows for single rule case.

When, during a classifier lookup, we narrow down to a single potential
rule, it is enough to match on ("unwildcard") one bit that differs
between the packet and the rule.

This is a special case of the more general algorithm, where it is
sufficient to match on enough bits that separates the packet from all
higher priority rules than the matched rule.  For a miss that would be
all the rules.  Implementing this is expensive for a more than a few
rules.  This patch starts by doing this for a single rule when we
already have it, also reducing the lookup cost by finishing the lookup
earlier than before.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/pvector: Non-intrusive RCU priority vector.
Jarno Rajahalme [Thu, 26 Jun 2014 14:41:25 +0000 (07:41 -0700)]
lib/pvector: Non-intrusive RCU priority vector.

Factor out the priority vector code from the classifier.

Making the classifier use RCU instead of locking requires parallel
access to the priority vector, pointing to subtables in descending
priority order.  When a new subtable is added, a new copy of the
priority vector is allocated, while the current readers can keep on
using the old copy they started with.  Adding and removing subtables
is usually less frequent than adding and removing rules, so this
should not have a visible performance implication.  As an optimization
for the userspace datapath use, where all the subtables have the same
priority, new subtables can be added to the end of the vector without
reallocation and without disturbing readers.

cls_subtables_reset() is now removed, as it served its purpose in bug
hunting.  Checks on the new pvector are now incorporated into
tests/test-classifier.c.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoFAQ: add an entry for MAC learning + VLAN
YAMAMOTO Takashi [Wed, 25 Jun 2014 02:06:18 +0000 (11:06 +0900)]
FAQ: add an entry for MAC learning + VLAN

Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
9 years agodpif-netdev: delete lost packets in dp_execute_cb()
Daniele Di Proietto [Wed, 25 Jun 2014 18:39:34 +0000 (11:39 -0700)]
dpif-netdev: delete lost packets in dp_execute_cb()

This commit fixes memory leaks in dp_execute_cb() in two cases:
    - when the output port cannot be found
    - when the recirculation depth is exceeded

Reported-by: Pravin Shelar <pshelar@nicira.com>
Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath: fix sparse warning in function tbl_mask_array_delete_mask()
Andy Zhou [Tue, 24 Jun 2014 06:00:55 +0000 (23:00 -0700)]
datapath: fix sparse warning in function tbl_mask_array_delete_mask()

Sparse gives "incompatible types in comparison expression (different
address spaces)" warning messages. Fix this by add rcu_dereference()
wrappers.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoofproto-dpif: Add MPLS tests
Simon Horman [Mon, 23 Jun 2014 23:46:33 +0000 (08:46 +0900)]
ofproto-dpif: Add MPLS tests

Co-authored-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-actions: Allow pop_mpls on MPLS packets
Simon Horman [Mon, 23 Jun 2014 23:46:32 +0000 (08:46 +0900)]
ofp-actions: Allow pop_mpls on MPLS packets

With recirculation in place this should be safe.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto-dpif: MPLS recirculation
Simon Horman [Mon, 23 Jun 2014 23:46:31 +0000 (08:46 +0900)]
ofproto-dpif: MPLS recirculation

In some cases an pop MPLS action changes a packet to be a non-mpls packet.
In this case subsequent any L3+ actions require access to portions
of the packet which were not decoded as they were opaque when the
packet was MPLS. Allow such actions to be translated by
first recirculating the packet.

Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoCodingStyle: Functions in .c files should usually not be marked "inline".
Ben Pfaff [Wed, 25 Jun 2014 20:58:41 +0000 (13:58 -0700)]
CodingStyle: Functions in .c files should usually not be marked "inline".

I thought this was in here already, but I guess not.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agodpif-netdev: Fix memory leak in dpif_netdev_flow_put()
Ryan Wilson [Wed, 25 Jun 2014 20:05:17 +0000 (13:05 -0700)]
dpif-netdev: Fix memory leak in dpif_netdev_flow_put()

miniflow_destroy() needs to be called after using miniflow_init().
Otherwise, if the miniflow mallocs data, then a memory leak may
occur.

Found by inspection.

Signed-off-by: Ryan Wilson <wryan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-netdev: Implement batched flow dumping.
Ryan Wilson [Mon, 23 Jun 2014 19:36:11 +0000 (12:36 -0700)]
dpif-netdev: Implement batched flow dumping.

Previously, flows were retrieved one by one when dumping flows for
datapaths of type 'netdev'. This increased contention for the dump's
mutex, negatively affecting revalidator performance.

This patch retrieves batches of flows when dumping flows for datapaths
of type 'netdev'.

Signed-off-by: Ryan Wilson <wryan@nicira.com>
[blp@nicira.com relaxed max_flows restriction]
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-ofctl: Document form of packet parameters to "packet-out".
Ben Pfaff [Wed, 25 Jun 2014 19:27:25 +0000 (12:27 -0700)]
ovs-ofctl: Document form of packet parameters to "packet-out".

The syntax is inconvenient but at least it's documented now.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agojson: Fix parsing of strings that end with a backslash.
Ben Pfaff [Wed, 25 Jun 2014 18:39:25 +0000 (11:39 -0700)]
json: Fix parsing of strings that end with a backslash.

json_string_unescape() flagged a backslash at the end of a string as an
error, but of course "\\" is a valid string.  This fixes the problem.

VMware-BZ: #1275208
Reported-by: Michael Hu <mhu@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agodpif-linux: Minor style fixes.
Ben Pfaff [Wed, 25 Jun 2014 18:34:44 +0000 (11:34 -0700)]
dpif-linux: Minor style fixes.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
9 years agodpif-netdev: Delete packet if not able to do upcall
Daniele Di Proietto [Tue, 24 Jun 2014 23:08:34 +0000 (16:08 -0700)]
dpif-netdev: Delete packet if not able to do upcall

In dp_netdev_input() we nevered fully covered the case where handler queues are
not there.
With this change we increment the stat counter and free the packet.

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agonetdev-dpdk: Disable NIC offloading and multiseg mbufs
Daniele Di Proietto [Tue, 24 Jun 2014 23:05:02 +0000 (16:05 -0700)]
netdev-dpdk: Disable NIC offloading and multiseg mbufs

We do not use any offloading (now) or multiple segments per packet, so
we might as well disable those features while configuring the NIC.

This could give performance improvements. For ixgbe, for example, this change
allows the driver to use a simpler tx routine, resulting in throuput
improvements (~7.5%)

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agonetdev-dpdk: Fix coding style in TX/RX conf structs
Daniele Di Proietto [Tue, 24 Jun 2014 23:05:01 +0000 (16:05 -0700)]
netdev-dpdk: Fix coding style in TX/RX conf structs

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agonetdev-dpdk: Count and delete every dropped packet
Daniele Di Proietto [Tue, 24 Jun 2014 23:04:20 +0000 (16:04 -0700)]
netdev-dpdk: Count and delete every dropped packet

Commit f4fd623c4c25 introduced a bug in netdev_dpdk_send(): if multiple
consecutive packets exceed MTU, only the first one is deleted and
counted.

This should fix the bug

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agolib: Rename ofp to buf.
Pravin B Shelar [Tue, 24 Jun 2014 20:00:52 +0000 (13:00 -0700)]
lib: Rename ofp to buf.

dpif-packet contains ofpbuf which points to packet data.  Here buf
is better name rather than ofp.
Following patch renames all remaining instances of ofp variable.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Daniele Di Proietto <ddiproietto@vmware.com>
9 years agodatapath: Rehash 16-bit skbuff hashes into 32 bits.
Jesse Gross [Wed, 25 Jun 2014 01:28:08 +0000 (18:28 -0700)]
datapath: Rehash 16-bit skbuff hashes into 32 bits.

Currently, if the network stack provides skb->rxhash then we use it,
otherwise we compute our own. However, on at least some versions of
RHEL/CentOS, the stack provides a hash that is 16 bits rather than
32 bits. In cases where we use the uppermost bits of the hash this
is particularly bad because we detect that a hash is present and we
use it rather than computing our own but the result is always zero.

This is particularly noticible with tunnel ports that use the hash
to generate a source port, such as VXLAN. On these kernels the tunnel
source port is always the minimum value. To solve this problem while
still taking advantage of the precomputed hash, this rehashes the
hash so that the entropy is spread throughout 32 bits.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agotests: Remove extraneous parenthesis from test name.
Joe Stringer [Mon, 23 Jun 2014 05:33:56 +0000 (05:33 +0000)]
tests: Remove extraneous parenthesis from test name.

This could cause configuration failure on earlier versions of autoconf.

Reported-by: Lin Shaopeng <slin0209@gmail.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodpif: When executing actions needs help, use "set" action to set tunnel.
Ben Pfaff [Tue, 24 Jun 2014 23:39:33 +0000 (16:39 -0700)]
dpif: When executing actions needs help, use "set" action to set tunnel.

Open vSwitch userspace is able to implement some actions that the kernel
doesn't support, such as modifying ARP fields.  When it does this for a
tunneled packet, it needs to supply the tunnel information with a "set"
action, because the Linux kernel datapath throws away tunnel information
supplied in the OVS_PACKET_CMD_EXECUTE metadata argument.

VMware-BZ: #1270110
Reported-by: Srinivas Neginhal <sneginha@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
9 years agodatapath: Add basic MPLS support to kernel
Simon Horman [Tue, 24 Jun 2014 11:56:57 +0000 (20:56 +0900)]
datapath: Add basic MPLS support to kernel

Allow datapath to recognize and extract MPLS labels into flow keys
and execute actions which push, pop, and set labels on packets.

Based heavily on work by Leo Alterman, Ravi K, Isaku Yamahata and Joe Stringer.

Cc: Ravi K <rkerur@gmail.com>
Cc: Leo Alterman <lalterman@nicira.com>
Cc: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agonetdev-vport: Fix use-after-free error in netdev_vport_route_changed().
Ben Pfaff [Tue, 24 Jun 2014 20:47:33 +0000 (13:47 -0700)]
netdev-vport: Fix use-after-free error in netdev_vport_route_changed().

We can't unlock the netdev's mutex after close the netdev, because closing
the netdev might destroy the mutex.

VMware-BZ: #1275187
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agotest-classifier: add ovs_assert to prevent warning
Daniele Di Proietto [Mon, 23 Jun 2014 17:13:41 +0000 (10:13 -0700)]
test-classifier: add ovs_assert to prevent warning

GCC 4.9.0 triggers a warning (array-bounds) while compiling test-classifier.c
This commit introduces an assertion that suppresses the warning.

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-parse: Correctly parse actions= in group bucket
Thomas Graf [Tue, 24 Jun 2014 18:29:30 +0000 (20:29 +0200)]
ofp-parse: Correctly parse actions= in group bucket

Make the parser compatible with how we print group buckets and allow
actions= to be specified, e.g.:

 group_id=1,type=all,bucket=actions=output:2,bucket=actions=output:3

Also, better document the supported syntax in the manual page and
cover both syntax formats in the unit test.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonetdev-dpdk: Coding style improvements.
Ben Pfaff [Tue, 24 Jun 2014 15:54:56 +0000 (08:54 -0700)]
netdev-dpdk: Coding style improvements.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
9 years agoutilities: skip loading kernel module if kernel has no module support
Pim van den Berg [Sat, 21 Jun 2014 09:59:52 +0000 (11:59 +0200)]
utilities: skip loading kernel module if kernel has no module support

Signed-off-by: Pim van den Berg <pim@nethuis.nl>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agobridge: Enable multicast support on the bridge
Flavio Leitner [Thu, 19 Jun 2014 01:14:35 +0000 (22:14 -0300)]
bridge: Enable multicast support on the bridge

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-xlate: Snoop multicast packets and send them properly
Flavio Leitner [Thu, 19 Jun 2014 01:14:34 +0000 (22:14 -0300)]
dpif-xlate: Snoop multicast packets and send them properly

If the packet is multicast and the snooping feature is enabled,
update the multicast snooping database accordingly and send it
to the right ports.

If the packet is not multicast or the snooping feature is disabled,
let the MAC learning handle the packet as before.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto-dpif: Add mcast snooping db show and flush cmds
Flavio Leitner [Thu, 19 Jun 2014 01:14:33 +0000 (22:14 -0300)]
ofproto-dpif: Add mcast snooping db show and flush cmds

This patch adds the command 'ovs-appctl mdb/show bridge'
to show learned groups on a bridge from the multicast
snooping database.

It also adds the command 'ovs-appctl mdb/flush [bridge]'
to flush learned groups on a bridge or on all bridges.

Acked-by: Thomas Graf <tgraf@redhat.com>
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto: Add functions to configure multicast snooping
Flavio Leitner [Thu, 19 Jun 2014 01:14:32 +0000 (22:14 -0300)]
ofproto: Add functions to configure multicast snooping

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto-dpif: Introduce multicast snooping handler
Flavio Leitner [Thu, 19 Jun 2014 01:14:31 +0000 (22:14 -0300)]
ofproto-dpif: Introduce multicast snooping handler

It follows mac learning, but since the multicast snooping feature
can be disabled, the locking is handled in the library.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoflow: extend it to carry IGMP protocol information
Flavio Leitner [Thu, 19 Jun 2014 01:14:30 +0000 (22:14 -0300)]
flow: extend it to carry IGMP protocol information

Add IGMP info to struct flow, flow compose and flow extract.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agolib: Add IGMP snooping library bits
Flavio Leitner [Thu, 19 Jun 2014 01:14:29 +0000 (22:14 -0300)]
lib: Add IGMP snooping library bits

This patch adds generic IGMP snooping library code
that is used in follow-up patches.

Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodebian: Re-run failed unit tests once.
Gurucharan Shetty [Fri, 20 Jun 2014 20:38:55 +0000 (13:38 -0700)]
debian: Re-run failed unit tests once.

There are always a few unit tests that have some race conditions
that cause them to occasionally fail. It is probably a good idea
to re-run the failed tests once while building deb packages.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Co-authored-by: Keith Amidon <kamidon@nicira.com>
Signed-off-by: Keith Amidon <kamidon@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agosocket_util.py: Make set_dscp() python 2.4.3 compatible.
Gurucharan Shetty [Thu, 19 Jun 2014 17:38:20 +0000 (10:38 -0700)]
socket_util.py: Make set_dscp() python 2.4.3 compatible.

There is no 'errno' field in socket.error. Instead use the
get_exception_errno() function to get the error number.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoatlocal: Disable Python related tests on Windows.
Gurucharan Shetty [Thu, 12 Jun 2014 19:27:11 +0000 (12:27 -0700)]
atlocal: Disable Python related tests on Windows.

Most of the Python code in Open vSwitch repo does not work
on Windows. Till that porting is done, simply skip all
Python tests.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolockfile: Modify tests for Windows.
Gurucharan Shetty [Thu, 29 May 2014 21:47:30 +0000 (14:47 -0700)]
lockfile: Modify tests for Windows.

As of now, when a process tries to reacquire a lockfile, we
return EEXIST on Windows and print a different error message.
This means that the unit tests need to look for different error
messages too. Linux uses EDEADLK for the same. EDEADLK feels like
a good error description for Windows too and this also lets us
not change the tests too much. So use it.

Some of the tests in test-lockfile.c uses fork to test a
child's ability to acquire lock. We do not fork in Windows.
We also do not support symlinks on Windows.  So, comment out
those tests.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoutil: Don't compile couple of unused function for Windows.
Gurucharan Shetty [Thu, 29 May 2014 17:19:19 +0000 (10:19 -0700)]
util: Don't compile couple of unused function for Windows.

basename() and dir_name() are not used for Windows and won't work well if
used. So put a '#ifndef _WIN32' around them to prevent future calls.

test-file_name.c tests the above 2 functions. It makes sense to merge
this single function file with test-util.c and then not compile it for
Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodaemon-windows: unlink pidfile before stopping the service.
Gurucharan Shetty [Wed, 28 May 2014 22:07:31 +0000 (15:07 -0700)]
daemon-windows: unlink pidfile before stopping the service.

When a OVS daemon is configured to run as a Windows service,
when the service is stopped by calling service_stop(), the
windows services manager does not give enough time to do
everything in the atexit handler. So call the exit handler
directly from service_stop().

Also add a test case for Windows services which checks for
the termination of the service by looking at pidfile cleaned
by the exit handler.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agotest-util: Changes for 'assert' test on Windows.
Gurucharan Shetty [Tue, 27 May 2014 14:55:31 +0000 (07:55 -0700)]
test-util: Changes for 'assert' test on Windows.

There is no 'kill -l' type functionality available on Windows.
So instead of looking for the string 'ABRT', check for the exit
code in both platforms. On msys (unit test environment), it is 9
and on Linux, it is 134 (SIGABRT + 128).

On Windows, stderr is fully buffered if connected to a pipe.
Make it _IONBF so that an abort does not miss log contents.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoutil: Make WSAStartup available outside stream.c.
Gurucharan Shetty [Fri, 23 May 2014 17:07:49 +0000 (10:07 -0700)]
util: Make WSAStartup available outside stream.c.

WSAStartup() needs to be called before using winsock2 related
functions. We need this for almost all the utilities. So call
it through OVS_CONSTRUCTOR.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-ofctl.8: Move mod-table out of group tables section
Thomas Graf [Fri, 20 Jun 2014 11:17:36 +0000 (13:17 +0200)]
ovs-ofctl.8: Move mod-table out of group tables section

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-ofctl.8: Document group:group_id action
Thomas Graf [Fri, 20 Jun 2014 11:17:35 +0000 (13:17 +0200)]
ovs-ofctl.8: Document group:group_id action

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-netdev: Remove unused global variable 'key'.
Ben Pfaff [Tue, 24 Jun 2014 00:08:24 +0000 (17:08 -0700)]
dpif-netdev: Remove unused global variable 'key'.

Found by sparse.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agoofproto: Break out monitor deletion code
Simon Horman [Mon, 16 Jun 2014 02:29:29 +0000 (11:29 +0900)]
ofproto: Break out monitor deletion code

Break out monitor deletion code into a new function
flow_monitor_delete which is paramatised over the id of
the monitor to delete.

This is in preparation for supporting OpenFlow1.4 flow monitor requests
with delete and modify commands.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>