This patch mostly is related to tunnel API where RHEL 7
kernel API are not in-sync with newer linux kernel API. So
extra checks are required to check for parameters of API.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jiri Benc <jbenc@redhat.com>
Test the switch over to inactive ovs-vswitchd process when user
kill the currently active ovs-vswitchd.
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
User mode sends down three distinct Read ioctl commands for Events, Packet
Reads and Dumps. In case the Packet Read socket can not be distinguished a
Set function will be provided.
Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Firstly, with this change, the 'more_actions' parameter is removed and
is integrated into 'steal'. Then, every function that receives a batch
of packets with 'steal' set to true is responsible for freeing the
packets. Finally, odp_execute_actions() and odp_execute_actions__()
can be be merged.
This also fixes a memory leak in odp_execute_sample(), when the
subactions are not executed
Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
If odp_execute_actions() has been called with 'steal' set to true and
OVS_ACTION_ATTR_RECIRC as last action, it should allow dp_execute_cb()
to steal the packet.
Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
'timewarp_seq' should be initialized only once, while init_clock() is
called multiple times (once for each clock instance).
Found by valgrind
Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
dp_netdev_free() must free 'dp->upcall_rwlock', but when upcalls are
disabled (if the datapath is being freed upcalls should be disabled)
'dp->upcall_rwlock' is taken and freeing it causes an assertion to
fail.
This commit takes makes sure that the upcalls are disabled and
releases 'dp->upcall_rwlock' before freeing it. A simple testcase is
added to detect the failure.
Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Use the new OVS_FLOW_ATTR_PROBE flag when probing for datapath feature
support. Suppress also dpif error logging when requested, as probe
failures are already logged at ofproto-dpif.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
This new flag is useful for suppressing error logging while probing
for datapath features using flow commands. For backwards
compatibility reasons the commands are executed normally, but error
logging is suppressed.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
ovs-vsctl commands like 'ovs-vsctl list Interface p1' use the
'monitor' RPC method, which causes ovsdb sending updates to
the command session when changes are committed to the monitored
table. Since ovs-vsctl commands are short-lived, there is chance
that ovs-vsctl terminates the connection to ovsdb right before
ovsdb sends the update. This race will cause the following
warning entries in ovsdb-server log:
|jsonrpc|WARN|unix: receive error: Connection reset by peer
|reconnect|WARN|unix: connection dropped (Connection reset by peer)
|jsonrpc|WARN|unix: send error: Broken pipe
|reconnect|WARN|unix: connection dropped (Broken pipe)
The bfd:flap_count test is particularly prone to this race,
since the test aligns the statistics updates (every 5 seconds)
with the invocation of ovs-vsctl commands.
In the short term, this commit fixes the intermittent failure
by disabling the ovs-vswitchd statistics updates using a huge
update interval.
In the long run, we will research on making ovsdb not send
further updates to sessions like ovs-vsctl.
Signed-off-by: Alex Wang <alexw@nicira.com>
As of now, when someone passes a punix:foo/bar as a connection type
in Windows, we create a TCP server using 127.0.0.1 and save the kernel
assigned port number in the file foo/bar. The connection name
as obtained through pstream_get_name() would be ptcp:127.0.0.1:$PORT.
This was okay if pstream_get_name() was only used for logging
purposes. But netdev-dummy uses it to close active connections when the
passed name and created name are different. This causes transient
connection teardowns while using patch ports in Windows unit tests
causing occasional packet loss.
This commit sets the connection name to be punix:foo/bar instead
of ptcp:127.0.0.1:$PORT for pwindows.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Aligned 64-bit memory accesses in i586 are atomic. By using an SSE
register we can make such memory accesses in one instruction without
bus-locking. Need to compile with -msse (or higher) to enable this
feature.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
OVS_VPORT_TYPE_GENEVE is currently hard coded to 6. This is not
necessary since slot 5 has not been taken yet. Drop the hard
coded value to before upstreaming GENEVE support to Linux kernel.
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Currently, the cmap_destroy() directly frees the cmap memory.
Some callers of cmap_destroy() (e.g. destroy_subtable()) still
allows other threads (e.g. pmd threads) accessing the cmap at
the same time (e.g. via classifier_lookup_miniflow_batch()),
which could cause segfault.
To fix the above issue, this commit use ovsrcu to postpone
the free of cmap memory.
Reported-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
When the bridge datapath_type is changed, ofproto is destroyed and immediately
recreated. This involves closing and reopening the mgmt socket. If the
destruction of the 'connmgr' is postponed, a race condition might happen, where
we first recreate the socket and then try to destroy it.
Reported-by: Daniel Badea <daniel.badea@windriver.com>
Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
The C standard allows compilers to do type-based alias analysis, which
means that the compiler is allowed to assume that pointers to objects of
different types are pointers to different objects. For example, a compiler
may assume that "uint16_t *a" and "uint32_t *b" point to different and
nonoverlapping locations because the pointed-to types are different. This
can lead to surprising "optimizations" with compilers that by default do
this kind of analysis, which includes GCC and Clang.
The one escape clause that the C standard gives us is that character types
must be assumed to alias any other object. We've always tried to use this
escape clause to avoid problems with type-based alias analysis in the past.
I think that we should continue to try to do this in the future. It's hard
to tell what compiler we might want to use in the future, and one never
knows what kind of control that compiler allows over alias analysis.
However, recently I helped another developer debug a nasty and confusing
issue, which turned out to be the result of a surprising compiler
optimization due to alias analysis. I've seen enough of these that I don't
think it's worthwhile to risk more problems than we have to. Thus, this
commit turns off type-based alias analysis in GCC and Clang.
Linus Torvalds thinks that type-base alias analysis is not sane, at least
as GCC implements it: https://lkml.org/lkml/2003/2/26/158
The GCC manual says that -Wstrict-aliasing is only effective without
-fno-strict-aliasing, otherwise I'd keep -Wstrict-aliasing also.
Indications are that MSVC doesn't do type-based alias analysis by default.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
NetBSD implementation of wc command outputs extra whitespaces
like the following. Tweak the test to success on such environments.
% echo hoge|wc -l|hexdump -C
00000000 20 20 20 20 20 20 20 31 0a | 1.|
00000009
%
The failing test was introduced by
commit 6bef3c7ca8
("bridge: Fix high cpu utilization.")
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Joe Stringer <joestringer@nicira.com>
When there are more than one ovs-vswitchd processes started,
only one process is enabled. The disabled processes should
just sleep. However, a bug in ovs makes the disabled processes
keep waking up on global connectivity sequence number which is
never sync'ed. Consequently, those processes use 100% cpu.
This commit fixes the bug by always sync up the connectivity
sequence number for disabled processes.
Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
This commit updates the DPDK related documentation to reflect
the pmd thread multi-threading work.
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Daniele Di Proietto <ddiproietto@vmware.com>
With DPDK compiled in, when the --dpdk option was given other than as the
first command-line argument, ovs-vswitchd silently ignored it. Without
DPDK compiled in, when the --dpdk option was given anywhere, ovs-vswitchd
silently ignored it. However, in each case any options following --dpdk
were not ignored, and since --dpdk is normally followed by additional
DPDK-specific options, this caused even more confusing trouble.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Daniele Di Proietto <ddiproietto@vmware.com>
Tested-by: Daniele Di Proietto <ddiproietto@vmware.com>
In my test with openstack setup, ovs-ofctl executes failed when there are
many flow rules to be added by multiple threads.
The error like this:
ovs-ofctl: /var/run/openvswitch/br1.mgmt: failed to open socket (Protocol
error)
In the function listen(fd, 10) in punix_open(), the number 10 should be
modified to more bigger, such as 64 maybe a proper value.
Signed-off-by: Lilijun <jerry.lilijun@huawei.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This just makes it a bit easier for someone coming in fresh to do some
searches and figure out what the description means.
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
We previously counted flows that have been installed during the current
dump as duplicates, rather than recognising them as new flows. This
patch separates the counters out for these two cases.
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
dp_hash and recirc_id are specific to OVS, but that doesn't mean that we
shouldn't encode them into flow matches when OXM is used in OpenFlow 1.2
and later.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Following this change, only meta-flow.c uses any explicit NXM_* or OXM_*
constants. An upcoming commit will actually remove the definitions of
these constants, hiding them behind a functional interface, for better
abstraction.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
A log message has warned that this was going to happen for some time, and
newer OpenFlow versions require this behavior.
The test updates fix this behavior in our testsuite.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
The Open vSwitch "make" output was still pretty verbose even when
configured with --enable-silent-rules. This cleans it up.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
We never released 2.2.0, so references to it are confusing.
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
Commit 9c537baf61 (bridge: Refactor the stats and status update.)
inadvertently changed the way that the status transaction is destroyed,
which could cause the main thread to constantly wake up.
The bug occurs when ovsdb_idl_txn_commit() returns TXN_INCOMPLETE and
there are no further changes to connectivity or 'status_txn_try_again'.
- ovsdb_idl_run() receives the transaction reply and updates the
transaction status to TXN_SUCCESS.
- status_update_wait() detects that the transaction is in progress, and
the status is TXN_SUCCESS so wakes up the main thread immediately.
- run_status_update() is meant to destroy the transaction now that it is
finished, however the logic is never run because there were no changes.
- Repeat the wakeup every time the main loop runs.
This patch fixes the behaviour by ensuring that ovsdb_idl_txn_commit()
gets a chance to run whenever there is an ongoing status transaction.
Bug was found by unloading and reloading the kernel module, then
immediately restarting ovs-vswitchd.
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
Currently, whenever there's a missed packet, the ovs driver allocates
memory and copies the packet even if there's no packet queue setup from
userspace. Then if there's no queue created, the packet is released and
dropped.
The solution was to check for the existence of the userspace queue before
trying to allocate and add a new missed packet to the queue. If there is
no userspace queue created, the original packet is dropped without creating
a new missed packet.
Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Nithin Raju <nithin@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/32
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>