2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-26 20:08:08 +00:00

69 Commits

Author SHA1 Message Date
Daniele Di Proietto
910885540a dpif-netdev: use dpif_packet structure for packets
This commit introduces a new data structure used for receiving packets from
netdevs and passing them to dpifs.
The purpose of this change is to allow storing some private data for each
packet. The subsequent commits make use of it.

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
2014-06-23 14:41:12 -07:00
Andy Zhou
7d7fffe8a4 netdev-dummy: add appctl netdev-dummy/conn-state command
Using without any parameter, this command list the connection
state of all netdev-dummy devices that are configured to make
active connections.

Optionally, the name of the netdev-dummy device can be supplied
as a parameter.

The states will be displayed as:

"connected": The socket has been connected to the listener.
"disconnected": The socket is not connected.
"unknown":  It is not an active dummy device.

CC: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
2014-06-10 15:28:12 -07:00
Alex Wang
3e912ffcbb netdev: Add 'change_seq' back to netdev.
This commit can be seen as a partial revert of commit
da4a619179d (netdev: Globally track port status changes)
by adding the 'change_seq' to 'struct netdev'.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-04-10 12:55:28 -07:00
Pravin Shelar
1f317cb5c2 ofpbuf: Introduce access api for base, data and size.
These functions will be used by later patches.  Following patch
does not change functionality.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
2014-03-30 06:18:43 -07:00
Pravin
f77917408a netdev: Rename netdev_rx to netdev_rxq
Preparation for multi queue netdev IO.  There are no functional changes
in this patch.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
2014-03-21 11:48:28 -07:00
Pravin
40d26f04b2 netdev: Send ofpbuf directly to netdev.
DPDK netdev need to access ofpbuf while sending buffer. Following
patch changes netdev_send accordingly.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
2014-03-21 11:48:28 -07:00
Pravin
df1e5a3bc7 netdev: Extend rx_recv to pass multiple packets.
DPDK can receive multiple packets but current netdev API does
not allow that.  Following patch allows dpif-netdev receive batch
of packet in a rx_recv() call for any netdev port.  This will be
used by dpdk-netdev.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
2014-03-21 11:48:28 -07:00
Andy Zhou
fc24d64d27 netdev-dummy: Reduce reconnect back off timeout
netdev-dummy will mostly be used for testing and debugging over fairly
reliable connection. Reduce reconnect back off timeout in case the first
connect attempt failed.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
2014-02-12 10:21:06 -08:00
Andy Zhou
c0c4982fd6 netdev-dummy: Fix reconnecting.
The netdev-dummy unit test ran into the reconnect condition on Jarno's
machine. With his test environment, we found and fixed the bugs in
handling reconnect.

Co-authored-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
2014-02-12 10:21:06 -08:00
Andy Zhou
13af13b3e4 netdev-dummy: disable periodic probing
netdev-dummy is mostly useed over reliable link for testing. Periodic
probing over those links seem overkill.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-02-07 16:49:33 -08:00
Andy Zhou
631486bd29 netdev-dummy: Add support for active stream
The dummy ports thus far only support passive connections. It can
listen for multiple incoming connection requests but not make active
connections. This patch adds support of active stream, so that a
dummy port can be configured with either passive or active connections.

The net result is that dummy ports can now connect to each other,
without being patch ports. This feature will be useful in adding test
cases of future commits.

Signed-off-by: Andy Zhou <azhou@nicira.com>
2014-01-23 16:08:53 -08:00
Luigi Rizzo
50aa0364d0 lib/pcap-file: add 'ovs_' prefix to pcap functions
This is done to avoid collisions and confusions with libpcap symbols,
like pcap_read()

Signed-off-by: Luigi Rizzo <rizzo@iet.unipi.it>
Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-01-23 08:41:05 -08:00
Simon Horman
bfd3367b9e 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>
2014-01-16 14:37:43 -08:00
Ben Pfaff
98045eda19 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>
2014-01-08 17:10:31 -08:00
Ben Pfaff
a4bc946ca1 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>
2014-01-08 17:10:31 -08:00
Joe Stringer
da4a619179 netdev: Globally track port status changes
Previously, we tracked status changes for ofports on a per-device basis.
Each time in the main thread's loop, we would inspect every ofport
to determine whether the status had changed for corresponding devices.

This patch replaces the per-netdev change_seq with a global 'struct seq'
which tracks status change for all ports. In the average case where
ports are not constantly going up or down, this allows us to check the
sequence once per main loop and not poll any ports. In the worst case,
execution is expected to be similar to how it is currently.

In a test environment of 5000 internal ports and 50 tunnel ports with
bfd, this reduces average CPU usage of the main thread from about 40% to
about 35%.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-12-12 15:03:19 -08:00
Joe Stringer
89eb6a4313 netdev: Make naming more consistent
netdev-dummy and netdev-vport use the function name netdev_poll_notify()
for the same purpose as netdev-linux/bsd's netdev_*_changed(). This patch
changes the former two to be more consistent with the linux/bsd naming
scheme.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-11-11 08:00:12 -08:00
Simon Horman
b5799021ba netdev-dummy: Count rx packets regardless of source
This alters the way rx packets are accounted for by
counting them when they are processed by netdev_dummy_rx_recv(),
which seems to be a common path used by all received packets.

Previously accounting was done earlier, in netdev_dummy_receive(),
however this does not appear to count packets that are received via
a socket.

This resolves packet counting errors reported by the following
OFtest tests:

	port_stats.MultiFlowStats
	port_stats.SingleFlowStats
	pktact.WildcardPriorityWithDelete
	pktact.WildcardPriority

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-10-16 09:08:30 -07:00
Ben Pfaff
55d87b06e3 netdev-dummy: Add pcap feature.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-10-09 17:02:57 -07:00
YAMAMOTO Takashi
42d6229154 netdev-dummy: Stop overriding patch vport type with dummy.
There's little point to override patch ports, which is implmeneted
purely in our userland process these days, with a dummy implementation.

This allows testing patch ports in "make sandbox" environment.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-28 12:36:47 -07:00
Ben Pfaff
89454bf477 netdev: Fix deadlock when netdev_dump_queues() callback calls into netdev.
We have a call chain like this:

    iface_configure_qos() calls
        netdev_dump_queues(), which calls
            netdev_linux_dump_queues(), which calls back through 'cb' to
                qos_unixctl_show_cb(), which calls
                    netdev_delete_queue(), which calls
                        netdev_linux_delete_queue().

Both netdev_dump_queues() and netdev_linux_delete_queue() take the same
mutex in the same netdev, which deadlocks.

This commit fixes the problem by getting rid of the callback.

netdev_linux_dump_queue_stats() would benefit from the same treatment but
it's less urgent because I don't see any callbacks from that function that
call back into a netdev function.

Bug #19319.
Reported-by: Scott Hendricks <shendricks@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-27 21:50:40 -07:00
Ben Pfaff
834d6cafe4 Use "error-checking" mutexes in place of other kinds wherever possible.
We've seen a number of deadlocks in the tree since thread safety was
introduced.  So far, all of these are self-deadlocks, that is, a single
thread acquiring a lock and then attempting to re-acquire the same lock
recursively.  When this has happened, the process simply hung, and it was
somewhat difficult to find the cause.

POSIX "error-checking" mutexes check for this specific problem (and
others).  This commit switches from other types of mutexes to
error-checking mutexes everywhere that we can, that is, everywhere that
we're not using recursive mutexes.  This ought to help find problems more
quickly in the future.

There might be performance advantages to other kinds of mutexes in some
cases.  However, the existing mutex type choices were just guesses, so I'd
rather go for easy detection of errors until we know that other mutex
types actually perform better in specific cases.  Also, I did a quick
microbenchmark of glibc mutex types on my host and found that the
error checking mutexes weren't any slower than the other types, at least
when the mutex is uncontended.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-08-20 13:40:02 -07:00
Ben Pfaff
36e2140da3 netdev-dummy: Add Clang lock annotations.
This commit adds some superfluous locks and unlocks, but they should not
hurt performance and do make Clang happy.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
2013-08-16 14:04:47 -07:00
Ben Pfaff
5a9bf5148e netdev-dummy: Fix synchronization error in netdev_dummy_get_config().
Found by Clang.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
2013-08-16 14:04:44 -07:00
Ben Pfaff
5e1de67fa1 netdev-dummy: Include all dummy classes in iterations.
Commit 86f1d0326bd0 (netdev-dummy: Use netdev_get_devices() instead of a
local shash.) caused netdev-dummy functions that iterate over all dummy
devices to iterate only over the ones that have class 'dummy_class'.  This
seemed to obviously include all the ones that we want, but in fact
when ovs-vswitch is invoked with --enable-dummy=override, there are more
dummy classes than just dummy_class, which this new form of iteration
skipped over, with various negative consequences that showed up in some
testing.

This commit switches netdev-dummy back to internally tracking its own
dummy devices.  It fixes the tests for me.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-12 13:48:44 -07:00
Ben Pfaff
863838160e netdev: Make netdev access thread-safe.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
2013-08-09 21:34:02 -07:00
Ben Pfaff
9dc63482bb netdev: Adopt four-step alloc/construct/destruct/dealloc lifecycle.
This is the same lifecycle used in the ofproto provider interface.
Compared to the previous netdev provider interface, it has the
advantage that the netdev top layer can control when any given
netdev becomes visible to the outside world.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-09 21:21:38 -07:00
Ben Pfaff
86f1d0326b netdev-dummy: Use netdev_get_devices() instead of a local shash.
When an upcoming commit introduces thread safety into the netdev API, this
allows netdev-dummy to avoid adding more internal locking by taking
advantage of netdev_get_devices() refcounting.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-09 21:08:31 -07:00
Ben Pfaff
7d6ce2d189 netdev-dummy: Fix memory leak on error path in netdev_rx_dummy_recv().
This code failed to free the packet if it was too big for the caller.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-02 12:24:18 -07:00
Ethan Jackson
97be153858 clang: Add annotations for thread safety check.
This commit adds annotations for thread safety check. And the
check can be conducted by using -Wthread-safety flag in clang.

Co-authored-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-07-30 21:30:45 -07:00
Ben Pfaff
01cdb3a111 netdev-dummy: Make counter thread-safe.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
2013-07-23 11:38:08 -07:00
Ben Pfaff
10a89ef04d Replace all uses of strerror() by ovs_strerror(), for thread safety.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-28 16:09:38 -07:00
Andy Zhou
e6cc0babc2 ovs-dpctl: Add mega flow support
Added support to allow mega flow specified and displayed. ovs-dpctl tool
is mainly used as debugging tool.

This patch also implements the low level user space routines to send
and receive mega flow netlink messages. Those netlink suppor
routines are required for forthcoming user space mega flow patches.

Added a unit test to test parsing and display of mega flows.

Ethan contributed the ovs-dpctl mega flow output function.

Co-authored-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-20 10:33:51 -07:00
Ben Pfaff
eab5611a38 netdev-dummy: Add "pstream" option for connecting a dummy to a process.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-28 15:39:56 -07:00
Ben Pfaff
323cc92408 netdev-dummy: Drop "nobody listened" reply from netdev-dummy/receive.
Ethan pointed out that this wasn't very useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-28 15:39:55 -07:00
Ben Pfaff
2273ea5ab9 netdev-dummy: Factor some netdev_dummy_receive() code out into new function.
An upcoming patch will add another user.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-28 15:39:55 -07:00
Ben Pfaff
e34cfdd9d4 netdev-dummy: Limit receive queue length to 100 packets.
It doesn't seem like a good idea to allow the queue length to grow without
bound, even for a test-only device.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-28 15:39:55 -07:00
Ben Pfaff
7c54c27f20 netdev-dummy: Remove FreeBSD dependency.
There's no particular reason that netdev_dummy_register() has to care about
the particular OS, except that the tests like to use the special Linux-only
tunnel vport types.  But that can be done better, I think, by just always
registering them from netdev_dummy_register() and making that function
idempotent, so that calling it twice under Linux has no additional effect.
This commit implements that solution.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
2013-05-18 08:27:20 -07:00
Ben Pfaff
b5d57fc879 netdev: Get rid of netdev_dev.
The distinction between struct netdev_dev and struct netdev has always
been confusing.  Now that previous commits have eliminated all interesting
state from struct netdev, this commit deletes it and renames struct
netdev_dev to take its place.  Now the situation makes much more sense and
I won't have to continue making embarrassed explanations in the future.

Good riddance.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-10 14:46:15 -07:00
Ben Pfaff
180c6d0b44 Rename superclass members to 'up'.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-05-10 14:42:30 -07:00
Ben Pfaff
796223f5bc netdev: Add new "struct netdev_rx" for capturing packets from a netdev.
Separating packet capture from "struct netdev" means that there is no
remaining per-"struct netdev" state, which will allow us to get rid of
"struct netdev_dev" (by renaming it "struct netdev").

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-05-10 14:39:36 -07:00
Ben Pfaff
4b60911067 netdev: Factor restoring flags into new "struct netdev_saved_flags".
This gets rid of the only per-instance data in "struct netdev", which
will make it possible to merge "struct netdev_dev" into "struct netdev" in
a later commit.

Ed Maste wrote the netdev-bsd changes in this commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Co-authored-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ed Maste <emaste@freebsd.org>
Tested-by: Ed Maste <emaste@freebsd.org>
2013-05-10 11:24:07 -07:00
Neil Mckee
8073dd318b tests: Add sFlow test.
This patch adds an sFlow test to the test suite.

I have only tested this on a Fedora 17 OS.

Signed-off-by: Neil Mckee <neil.mckee@inmon.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-01 13:08:31 -07:00
Ben Pfaff
02d5bfe3be netdev-dummy: Correctly maintain port statistics.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-02-11 13:26:24 -08:00
Ethan Jackson
c060c4cf83 netdev-vport: Build on all platforms.
This patch removes the final bit of linux specific code which
prevents building netdev-vport everywhere.  With this, other
platforms automatically get access to patch ports, and (if their
datapath supports it), flow based tunneling.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-01-28 19:09:58 -08:00
Ben Pfaff
cb22974d77 Replace most uses of assert by ovs_assert.
This is a straight search-and-replace, except that I also removed #include
<assert.h> from each file where there were no assert calls left.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-01-16 16:03:37 -08:00
Ethan Jackson
f431bf7d78 netdev: Parse and make available tunnel configuration.
Future patches will need to know the details of a netdev's tunnel
configuration from outside the netdev library.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-01-15 16:21:09 -08:00
Ethan Jackson
275707c33f netdev: Rename get_drv_info() to get_status().
get_status() is a much more intuitive name since "status" is what
the database column is called.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-01-03 16:55:43 -08:00
Ethan Jackson
95d4ec339d netdev-dummy: New appctl command netdev-dummy/set-admin-state.
There's currently no way to set the admin state on dummy netdevs.
This patch provides a mechanism to do so which will be used in
future unit tests.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-08-10 13:53:24 -07:00
Raju Subramanian
e0edde6fee Global replace of Nicira Networks.
Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc.

Feature #10593
Signed-off-by: Raju Subramanian <rsubramanian@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-02 17:08:02 -07:00