sliver-openvswitch.git
10 years agonew makefile target for error reporting
Giuseppe Lettieri [Sun, 18 Aug 2013 10:20:11 +0000 (12:20 +0200)]
new makefile target for error reporting

10 years agolog errors from host command
Giuseppe Lettieri [Sun, 18 Aug 2013 10:18:49 +0000 (12:18 +0200)]
log errors from host command

10 years agotake only the first address returned by host
Giuseppe Lettieri [Sun, 18 Aug 2013 09:00:58 +0000 (11:00 +0200)]
take only the first address returned by host

10 years agoMerge branch 'mainstream'
Giuseppe Lettieri [Sat, 17 Aug 2013 13:08:21 +0000 (15:08 +0200)]
Merge branch 'mainstream'

10 years agofix warning
Giuseppe Lettieri [Thu, 15 Aug 2013 21:17:30 +0000 (23:17 +0200)]
fix warning

10 years agothread safety for netdev_pltap and netdev_tunnel
Giuseppe Lettieri [Thu, 15 Aug 2013 21:08:40 +0000 (23:08 +0200)]
thread safety for netdev_pltap and netdev_tunnel

10 years agoMerge branch 'mainstream'
Giuseppe Lettieri [Thu, 15 Aug 2013 18:43:14 +0000 (20:43 +0200)]
Merge branch 'mainstream'

Conflicts:
lib/netdev.c

10 years agonetdev_pltap,netdev_tunnel: moved to new API
Giuseppe Lettieri [Thu, 15 Aug 2013 18:28:31 +0000 (20:28 +0200)]
netdev_pltap,netdev_tunnel: moved to new API

10 years agoMerge commit '9dc63482bbeae23dd57b0f885a3fd26b44656844'
Giuseppe Lettieri [Thu, 15 Aug 2013 17:35:59 +0000 (19:35 +0200)]
Merge commit '9dc63482bbeae23dd57b0f885a3fd26b44656844'

10 years agonetdev-pltap: Make access to AF_INET socket thread-safe.
Giuseppe Lettieri [Thu, 15 Aug 2013 17:34:06 +0000 (19:34 +0200)]
netdev-pltap: Make access to AF_INET socket thread-safe.

10 years agoadded targets to test links
Giuseppe Lettieri [Thu, 15 Aug 2013 16:16:11 +0000 (18:16 +0200)]
added targets to test links

simple ping-based tests for the links created
by the Makefile

10 years agoMerge commit '259e0b1ad1bfea762a76f0098deb8f8d8db1dfa3'
Giuseppe Lettieri [Thu, 15 Aug 2013 14:11:21 +0000 (16:11 +0200)]
Merge commit '259e0b1ad1bfea762a76f0098deb8f8d8db1dfa3'

10 years agodatapath: compat: remove __net_init and __net_exit annotations.
Pravin B Shelar [Thu, 15 Aug 2013 03:53:32 +0000 (20:53 -0700)]
datapath: compat: remove __net_init and __net_exit annotations.

net_namespace-device can get registered after module init, e.g. vxlan
registers name-space-device on port add.  On kernel without namespace
support __net_init is defined as __init which cause panic on vxlan port
add. Following patch fixes it.

BUG: unable to handle kernel paging request at ffffffffa02b6293
IP: [<ffffffffa02b6293>] 0xffffffffa02b6293
PGD 1a87067 PUD 1a8b063 PMD 8371de067 PTE 0
Oops: 0010 [#1] SMP
Process ovs-vswitchd (pid: 10330, threadinfo ffff8808367fe000, task
      f880839e16aa0)
Stack:
Call Trace:
 [<ffffffff8144b254>] ? register_pernet_gen_device+0x74/0xd0
 [<ffffffffa027e220>] ? vxlan_rcv+0x0/0x60 [openvswitch]
 [<ffffffffa0280a7b>] vxlan_handler_add+0x3cb/0x480 [openvswitch]
 [<ffffffffa027e1f4>] vxlan_tnl_create+0xc4/0xf0 [openvswitch]
 [<ffffffffa027b6f3>] ovs_vport_add+0x53/0xb0 [openvswitch]
 [<ffffffffa0273bc6>] new_vport+0x16/0x60 [openvswitch]
 [<ffffffffa0276399>] ovs_vport_cmd_new+0x109/0x210 [openvswitch]
 [<ffffffff81478f80>] genl_rcv_msg+0x1d0/0x210
 [<ffffffff81477e29>] netlink_rcv_skb+0xa9/0xd0
 [<ffffffff81478d95>] genl_rcv+0x25/0x40
 [<ffffffff81477a63>] netlink_unicast+0x283/0x2d0
 [<ffffffff814783de>] netlink_sendmsg+0x1fe/0x2e0
 [<ffffffff8143c8d3>] sock_sendmsg+0x123/0x150
 [<ffffffff8143e0b6>] __sys_sendmsg+0x406/0x420
 [<ffffffff8143e2d9>] sys_sendmsg+0x49/0x90
 [<ffffffff8100b072>] system_call_fastpath+0x16/0x1b
Code:  Bad RIP value.
RIP  [<ffffffffa02b6293>] 0xffffffffa02b6293

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

10 years agonetdev-linux: Fix self-deadlocks in traffic control code.
Ben Pfaff [Fri, 16 Aug 2013 21:25:16 +0000 (14:25 -0700)]
netdev-linux: Fix self-deadlocks in traffic control code.

htb_parse_qdisc_details__(), which is called with the netdev mutex, called
netdev_get_mtu(), which tried to reacquire the mutex and thus deadlocked.
This commit fixes the problem and similar problems in
htb_parse_class_details__() and hfsc_parse_qdisc_details__().

Bug #19180.
Reported-by: Dhaval Badiani <dbadiani@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agonetdev-dummy: Add Clang lock annotations.
Ben Pfaff [Fri, 16 Aug 2013 21:04:08 +0000 (14:04 -0700)]
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>
10 years agonetdev-dummy: Fix synchronization error in netdev_dummy_get_config().
Ben Pfaff [Mon, 12 Aug 2013 19:51:47 +0000 (12:51 -0700)]
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>
10 years agoofproto-dpif-upcall: ofproto_dpif_send_packet_in() needs object on heap.
YAMAMOTO Takashi [Fri, 16 Aug 2013 05:17:23 +0000 (14:17 +0900)]
ofproto-dpif-upcall: ofproto_dpif_send_packet_in() needs object on heap.

fix a bug introduced by commit e1ec7dd46 (ofproto-dpif: Implement
multi-threaded miss handling.), in which execute_flow_miss() passes a
stack-allocated object to ofproto_dpif_send_packet_in() whereas that
function requires a heap-allocated object.  Also fixes two related bugs:
the 'packet' previously used in the packet-in was invalid and its data
was not copied with xmemdup().

Previously, when there were multiple packets in a single flow miss,
execute_flow_miss() would only send the first one to the controller.  This
was intentional (the goal is to find out whether the controller is
operational, and sending a single packet is sufficient for that) but
possibly confusing to the reader.  This commit switches to sending all of
the packets (the common case is a single packet anyhow).

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoseq: Initialize 'ovsthread_id' member of waiters in seq_wait__().
Ben Pfaff [Fri, 16 Aug 2013 18:20:57 +0000 (11:20 -0700)]
seq: Initialize 'ovsthread_id' member of waiters in seq_wait__().

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoofproto-dpif-xlate: Unreference handles on xbridge removal.
Ethan Jackson [Fri, 16 Aug 2013 01:37:41 +0000 (18:37 -0700)]
ofproto-dpif-xlate: Unreference handles on xbridge removal.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
[blp@nicira.com added one more hmap_destroy()]
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Include prerequisite header for FreeBSD
Ed Maste [Fri, 16 Aug 2013 12:24:30 +0000 (08:24 -0400)]
bfd: Include prerequisite header for FreeBSD

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Fix bad pointer dereference when deleting a bridge.
Ben Pfaff [Fri, 16 Aug 2013 00:54:04 +0000 (17:54 -0700)]
ofproto-dpif: Fix bad pointer dereference when deleting a bridge.

The 'pins' list contains packet-ins, not flow-mods.

Introduced by commit ada3a58d1f8 (ofproto-dpif: Make packet_ins thread
safe.).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Avoid extra O(N) work in common case on flow addition.
Ben Pfaff [Fri, 16 Aug 2013 00:38:40 +0000 (17:38 -0700)]
ofproto: Avoid extra O(N) work in common case on flow addition.

The OpenFlow OFPFF_CHECK_OVERLAP flag requires us to check whether the flow
being inserted overlaps with any existing flows.  That isn't efficiently
implemented and typically requires us to compare the new flow against most
or all of the existing flows.  We don't have to do that work if
OFPFF_CHECK_OVERLAP is not requested, but commit 0b4f207828c (classifier:
Make use of the classifier thread safe.) inadvertently made us do it
anyway.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Make number of packet handler threads runtime configurable.
Alex Wang [Thu, 15 Aug 2013 07:23:54 +0000 (00:23 -0700)]
ofproto: Make number of packet handler threads runtime configurable.

This commit adds a new column "n-handler-threads" to the Open_vSwitch
table. This is used to set the number of upcall handler threads created by
the ofproto-dpif-upcall module.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: move per-backer wait calls from wait to type_wait
YAMAMOTO Takashi [Thu, 15 Aug 2013 11:25:44 +0000 (20:25 +0900)]
ofproto-dpif: move per-backer wait calls from wait to type_wait

move per-backer wait calls (dpif_wait/udpif_wait) from ofproto_wait
to ofproto_type_wait.

This eliminates excessive poll slot consumption when there is more
than one bridge.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix RHEL compat for netdev_rx_handler_register
Chris Wright [Wed, 14 Aug 2013 01:02:48 +0000 (18:02 -0700)]
datapath: Fix RHEL compat for netdev_rx_handler_register

Andrei Andone reported an oops on CentOS 6.4 when adding a device to an
ovs instance.  The problem is easy to reproduce and generates the
following stack trace:

kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
BUG: unable to handle kernel paging request at ffff88033afa49c0
IP: [<ffff88033afa49c0>] 0xffff88033afa49c0
...
Call Trace:
 <IRQ>
 [<ffffffff814487ba>] ? __netif_receive_skb+0x60a/0x750
 [<ffffffff81055f96>] ? enqueue_task+0x66/0x80
 [<ffffffff8144aa38>] netif_receive_skb+0x58/0x60
 [<ffffffff8144ab40>] napi_skb_finish+0x50/0x70
 [<ffffffff8144d0e9>] napi_gro_receive+0x39/0x50
 [<ffffffffa025f46c>] igb_poll+0x7ec/0xc70 [igb]
 [<ffffffff810e6881>] ? cpu_quiet_msk+0xc1/0x130
...

As you can see, we jumped to data rather than code.  This is caused by
a mistake in the compat code for netdev_rx_handler_register which sets
the handler to rx_handler_data rather than rx_handler.  This was
introduced by commit "3e35fe3 datapath: rhel: Move RHEL OVS hook
registration to netdev_rx_handler_register() backport".

Reported-by: Andrei Andone <andrei.andone@softvision.ro>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Cc: Thomas Graf <tgraf@redhat.com>
Cc: Pravin Shelar <pshelar@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
Reviewed-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
10 years agodatapath: Move generic tunnel functions to lisp module.
Pravin B Shelar [Tue, 13 Aug 2013 07:19:53 +0000 (00:19 -0700)]
datapath: Move generic tunnel functions to lisp module.

Generic tunnel rcv and send function are only used by lisp tunneling
module, so It make sense to move them to lisp module.

CC: Lori Jakab <lojakab@cisco.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Lorand Jakab <lojakab@cisco.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Move find_route() to compat.h
Pravin B Shelar [Mon, 29 Jul 2013 22:47:34 +0000 (15:47 -0700)]
datapath: Move find_route() to compat.h

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: move tunnel-init function to flow.h
Pravin B Shelar [Mon, 29 Jul 2013 22:47:27 +0000 (15:47 -0700)]
datapath: move tunnel-init function to flow.h

This makes ovs-module more in-sync with upstream ovs-module.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: tunnel: Fix gre64 tunnel when key not specified.
Pravin B Shelar [Thu, 15 Aug 2013 00:31:57 +0000 (17:31 -0700)]
datapath: tunnel: Fix gre64 tunnel when key not specified.

User is allowed to create tunnel without any keys.  In this
case userspace set tunnel action does not set tun-key flag
which was confusing gre64 vport header calculations.  Following
patch fixes it by always assuming TUNNEL_KEY parameter as we
do it with tun-seq.

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

10 years agodatapath: tunnel: Do not use inner ip-header-id for tunnel ip-header-id.
Pravin B Shelar [Wed, 14 Aug 2013 18:46:15 +0000 (11:46 -0700)]
datapath: tunnel: Do not use inner ip-header-id for tunnel ip-header-id.

Using inner-id for tunnel id is not safe in some rare cases.
E.g. packets coming from multiple sources entering same tunnel
can have same id. Therefore on tunnel packet receive we
could have packets from two different stream but with same
source and dst IP with same ip-id which could confuse ip packet
reassembly.

CC: Jarno Rajahalme <jrajahalme@nicira.com>
CC: Ansis Atteka <aatteka@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agonetdev-bsd: implement netdev_arp_lookup for NetBSD
YAMAMOTO Takashi [Tue, 13 Aug 2013 20:57:41 +0000 (05:57 +0900)]
netdev-bsd: implement netdev_arp_lookup for NetBSD

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Increase configuration efficiency.
Alex Wang [Tue, 13 Aug 2013 23:51:08 +0000 (16:51 -0700)]
bfd: Increase configuration efficiency.

Currently, when there are multiple bfd configuration changes,
the bfd_poll() will only update one change at a time with the
other side. This commit moves the call to bfd_poll() at the
end of configuration processing function, so that bfd_poll()
will update all configuration changes together.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Fix check_tnl_key error.
Alex Wang [Wed, 14 Aug 2013 20:12:33 +0000 (13:12 -0700)]
bfd: Fix check_tnl_key error.

This commit fixes the bug introduced by commit 26131299fa5 (bfd: Make the
BFD module thread safe.). The bug caused the opposite of the intended
behaviour.

Unit test is added for the 'check_tnl_key' feature.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Destroy bundle after moving its last port out.
Ben Pfaff [Wed, 14 Aug 2013 00:44:14 +0000 (17:44 -0700)]
ofproto-dpif: Destroy bundle after moving its last port out.

When the ofp_port argument to bundle_add_port() refers to an ofport_dpif
that already belongs to some other bundle, bundle_add_port() removed
the port from the other bundle, correctly, with bundle_del_port().
If the other bundle now contained no ports, however, this violated the
invariant that a bundle always contains at least one port.

Normally, this would get fixed up when the other bundle was processed
later during reconfiguration.  I haven't quite zeroed in on the exact
case where this is not true, but segfaults have happened here in
production, in particular when port adds and deletes happen simultaneously
and the new port reuses the OpenFlow port number of one of the deleted
ports.  It seems that the duplicate port number allows some port to rip
away the new port from its bundle without destroying that bundle.  I
suspect, therefore, that there is still a more subtle bug here, but I
hope that this will fix the segfault.

Bug #18967.
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agogitignore: Add ovsdbmonitor.
Gurucharan Shetty [Wed, 14 Aug 2013 09:11:04 +0000 (09:11 +0000)]
gitignore: Add ovsdbmonitor.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoflow: Enable matching on new field 'pkt_mark'.
Jesse Gross [Tue, 6 Aug 2013 19:57:16 +0000 (12:57 -0700)]
flow: Enable matching on new field 'pkt_mark'.

The Linux kernel datapath enables matching and setting the skb mark
but this functionality is currently used only internally by
ovs-vswitchd. This exposes it through NXM to enable external
controllers to interact with other kernel subsystems. Although this
is simply exporting the skb mark, the intention is that this is a
platform independent mechanism to access some system metadata and
therefore may have different implementations on various systems.

Bug #17855

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agotunnel: Clear IPSEC_MARK on input rather than output.
Jesse Gross [Tue, 6 Aug 2013 19:57:15 +0000 (12:57 -0700)]
tunnel: Clear IPSEC_MARK on input rather than output.

Currently we remove the IPSEC_MARK flag from all packets that are
egressing on non-tunnel ports. However, this behavior is confusing
if we allow OpenFlow controllers to match and set the pkt_mark field
because the tunnel behavior applies even on non-tunnel ports.

This instead clears the mark on tunnel input which should have the
same effect for tunnel ports. However, on non-tunnel traffic (or
even for traffic entering on a tunnel port but leaving on a non-
tunnel port) it allows the mark to pass through without change.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agotunnel: Consolidate action code for tunnel port receive.
Jesse Gross [Tue, 6 Aug 2013 19:57:14 +0000 (12:57 -0700)]
tunnel: Consolidate action code for tunnel port receive.

There are a couple of operations that are related to receiving a
packet on a tunnel port but that affect the actions and therefore
need to be performed on the output path. This adds a new hook to
do this and consolidates the existing code there.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoflow: Rename skb_mark to pkt_mark.
Jesse Gross [Tue, 6 Aug 2013 19:57:13 +0000 (12:57 -0700)]
flow: Rename skb_mark to pkt_mark.

The skb_mark field is currently only available with the Linux datapath
and is only used internally. However, it is desirable to expose this
through OpenFlow and when it is exposed ideally it would not be system-
specific. In preparation for this, skb_mark is rename to pkt_mark in
internal data structures for consistency.

This does not rename the Linux interfaces because doing so would break
the API. It would not necessarily be desirable to do anyways since in
Linux-specific code it is clearer to use the actual name rather than a
generic one. This can lead to confusion in some places, however, because
we do not always strictly separate generic and platform dependent code
(one example is actions). This seems inevitable though at this point if
the lower and upper layers have different names (as they must given the
above requirements).

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agodebian: Fix build with old versions of dpkg-buildflags.
Ben Pfaff [Tue, 13 Aug 2013 19:54:35 +0000 (12:54 -0700)]
debian: Fix build with old versions of dpkg-buildflags.

dpkg-buildflags has not always supported --export=configure, but commit
6c2d4c8780 (debian: Apply hardening options to build.) used it
unconditionally, causing the build to fail on old Debian distributions.
This fixes the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Fix threading race in "ofproto-dpif megaflow - learning" test.
Ben Pfaff [Tue, 13 Aug 2013 19:37:50 +0000 (12:37 -0700)]
tests: Fix threading race in "ofproto-dpif megaflow - learning" test.

Threaded ofproto-dpif uses a queue to pass packets from the forwarding
threads to the main thread for (mega)flow setup and for learning.  When
learning occurs, causing revalidations, this races against flow setup, so
that sometimes a datapath (mega)flow does get set up for a packet that
causes learning and sometimes it doesn't.  This caused this test to
sometimes fail because one megaflow or the other that was expected to be
set up was not.

This commit fixes the problem by sending a second packet in each flow.
These additional packets don't cause any additional changes to the flow
table but they do cause flows to be set up, fixing the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Fix problems in "learning action - self-modifying flow" test.
Ben Pfaff [Tue, 13 Aug 2013 18:22:26 +0000 (11:22 -0700)]
tests: Fix problems in "learning action - self-modifying flow" test.

This test had two problems.  First, it had a bizarre dependency on stats
that were not up-to-date: the "ovs-ofctl dump-flows" assumed that only
the first one of ten packets sent through the switch had been accounted
to OpenFlow flow statistics.  Adding a 1-second time warp fixed this
problem by ensuring that all ten packets were accounted.  (That's why this
patch updates the expected output of "ovs-ofctl dump-flows".)

Second, multithreading has made packet processing less predictable in
general.  This commit adds 10-ms time warps after sending each packet,
which seems to make the test reliable for me.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Delete trailing whitespace in 'bfd/show' output.
Alex Wang [Tue, 13 Aug 2013 17:02:41 +0000 (10:02 -0700)]
bfd: Delete trailing whitespace in 'bfd/show' output.

This commit chops off the trailing whitespace in the 'flag' field
of 'bfd/show' output.  This is for the string matching in bfd
unit test.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: Use mutex instead of its address in thread-safety annotation.
Ben Pfaff [Mon, 12 Aug 2013 22:52:42 +0000 (15:52 -0700)]
ovs-thread: Use mutex instead of its address in thread-safety annotation.

CodingStyle says that this is preferred.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agosparse: Remove support for thread-safety annotations.
Ben Pfaff [Mon, 12 Aug 2013 22:49:25 +0000 (15:49 -0700)]
sparse: Remove support for thread-safety annotations.

The Clang support for thread-safety annotations is much more effective
than "sparse" support.  I found that I was unable to make the annotations
warning-free under sparse.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif-upcall: Fix sparse warning.
Ben Pfaff [Mon, 12 Aug 2013 22:43:36 +0000 (15:43 -0700)]
ofproto-dpif-upcall: Fix sparse warning.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoovs-ofctl: Avoid groff warning due to too-long line.
Ben Pfaff [Mon, 12 Aug 2013 22:11:35 +0000 (15:11 -0700)]
ovs-ofctl: Avoid groff warning due to too-long line.

Avoids these warnings from groff:

<standard input>:1037: warning [p 14, 6.0i]: cannot adjust line
<standard input>:1037: warning [p 14, 6.2i]: can't break line

Found by lintian.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodebian: Apply hardening options to build.
Ben Pfaff [Mon, 12 Aug 2013 22:10:39 +0000 (15:10 -0700)]
debian: Apply hardening options to build.

Debian now encourages building every program with various GCC hardening
options.  This commit implements that recommendation for Open vSwitch.

See https://wiki.debian.org/Hardening for details.

Found by lintian.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Include classifier wildcards in trace output.
Jesse Gross [Mon, 5 Aug 2013 23:00:03 +0000 (16:00 -0700)]
ofproto: Include classifier wildcards in trace output.

When tracing a flow, it shows the "relevant fields" that were used
to determine the results. However, this currently only includes fields
that are used for computing the actions but not the flow lookup. This
can be confusing so this patch includes the wildcards from the classifer
lookup as well.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: make oftable_remove_rule__ release evict lock
YAMAMOTO Takashi [Mon, 12 Aug 2013 23:00:05 +0000 (08:00 +0900)]
ofproto: make oftable_remove_rule__ release evict lock

according to the OVS_RELEASES annotation, oftable_remove_rule__ is
expected to release rule->evict lock.  make it actually do so.

this fixes pthread_rwlock_destroy failures observed on NetBSD,
where destroying a held lock, which is specwise undefined behaviour,
actually fails.  i guess it doesn't fail on linux but it's better
not to rely on an undefined behavior.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Do not set dev->master for XEN.
Pravin B Shelar [Mon, 12 Aug 2013 17:12:27 +0000 (10:12 -0700)]
datapath: Do not set dev->master for XEN.

XEN dom0 networking assumes dev->master is bond device
and it tries to access bond private structure from dev->master
ptr on receive path. This causes panic.
Following patch removes compat code that is setting master
device.

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

10 years agonetdev-bsd: ioctl "cmd" is unsigned long, not int
YAMAMOTO Takashi [Mon, 12 Aug 2013 22:20:22 +0000 (07:20 +0900)]
netdev-bsd: ioctl "cmd" is unsigned long, not int

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-upcall: don't forget to initialize mutexes
YAMAMOTO Takashi [Mon, 12 Aug 2013 22:20:21 +0000 (07:20 +0900)]
ofproto-dpif-upcall: don't forget to initialize mutexes

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoband: Fix error in bond_choose_output_slave() function.
Alex Wang [Mon, 12 Aug 2013 21:14:52 +0000 (14:14 -0700)]
band: Fix error in bond_choose_output_slave() function.

This commit fixes the error introduced by commit 4a1b8f30e59 (bond:
Stop using tags.). The error is caused by mistakenly returning 'slave'
where 'slave->aux' should be returned.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoseq: Add some comments.
Ben Pfaff [Mon, 12 Aug 2013 20:45:01 +0000 (13:45 -0700)]
seq: Add some comments.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-dummy: Include all dummy classes in iterations.
Ben Pfaff [Mon, 12 Aug 2013 19:49:23 +0000 (12:49 -0700)]
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>
10 years agobond.c: Fix a typo.
Alex Wang [Mon, 12 Aug 2013 19:01:46 +0000 (12:01 -0700)]
bond.c: Fix a typo.

This commit fixes a typo in "lib/bond.c" which causes the high CPU
utilization after adding bond.  The bug was introduced in commit
4a1b8f30e59 (bond: Stop using tags.).

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Use parallel_ops genl.
Pravin B Shelar [Thu, 1 Aug 2013 22:36:06 +0000 (15:36 -0700)]
datapath: Use parallel_ops genl.

OVS locking was recently changed to have private OVS lock which
simplified overall locking.  Therefore there is no need to have
another global genl lock to protect OVS data structures.  Following
patch uses of parallel_ops genl family for OVS.  This also allows
more granual OVS locking using ovs_mutex for protecting OVS data
structures, which gives more concurrencey.  E.g multiple genl
operations OVS_PACKET_CMD_EXECUTE can run in parallel, etc.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Support for Linux kernel 3.10
Pravin B Shelar [Fri, 2 Aug 2013 18:38:51 +0000 (11:38 -0700)]
datapath: Support for Linux kernel 3.10

Changes are mostly related API changes in vlan, GRE
restructuring.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto-dpif: Implement multi-threaded miss handling.
Ethan Jackson [Tue, 25 Jun 2013 21:45:43 +0000 (14:45 -0700)]
ofproto-dpif: Implement multi-threaded miss handling.

This patch factors flow miss handling into its own module,
ofproto-dpif-upcall which can utilize multiple threads to process
misses.  For some important benchmarks, this change improves Open
vSwitch flow setup performance by roughly 50x (that's 50 times not
50%) in my testing.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Lock rules to prevent eviction.
Ethan Jackson [Wed, 17 Jul 2013 23:14:02 +0000 (16:14 -0700)]
ofproto-dpif: Lock rules to prevent eviction.

This patch uses a read-write lock to prevent rules from being evicted
while they're used by child threads.  It also changes the prototypes
of the various rule lookup functions so that the thread safety
analysis can be used to ensure that the locking is handled properly.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev: Clean up on "construct" error in netdev_open().
Ben Pfaff [Sun, 11 Aug 2013 03:46:21 +0000 (20:46 -0700)]
netdev: Clean up on "construct" error in netdev_open().

Reported-by: ZhengLingyun <konghuarukhr@163.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Avoid races on queue and port changes using seq objects.
Ben Pfaff [Wed, 7 Aug 2013 20:29:54 +0000 (13:29 -0700)]
dpif-netdev: Avoid races on queue and port changes using seq objects.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoseq: New module for race-free, pollable, thread-safe sequence number.
Ben Pfaff [Tue, 6 Aug 2013 16:39:10 +0000 (09:39 -0700)]
seq: New module for race-free, pollable, thread-safe sequence number.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agonetdev-linux: Avoid deadlock in netdev_linux_update_flags() for taps.
Ben Pfaff [Sun, 11 Aug 2013 03:42:50 +0000 (20:42 -0700)]
netdev-linux: Avoid deadlock in netdev_linux_update_flags() for taps.

netdev_linux_set_etheraddr() would attempt to recursively acquire
netdev->mutex via netdev_linux_update_flags() for tap devices.

Reported-by: ZhengLingyun <konghuarukhr@163.com>
Tested-by: ZhengLingyun <konghuarukhr@163.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-linux: Fix netdev leak in corner case.
Ben Pfaff [Sat, 10 Aug 2013 16:02:24 +0000 (09:02 -0700)]
netdev-linux: Fix netdev leak in corner case.

Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev: Make netdev access thread-safe.
Ben Pfaff [Sat, 10 Aug 2013 04:34:02 +0000 (21:34 -0700)]
netdev: Make netdev access thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agonetdev-linux: Use dedicated netlink notification socket.
Ben Pfaff [Sat, 10 Aug 2013 04:29:03 +0000 (21:29 -0700)]
netdev-linux: Use dedicated netlink notification socket.

The rtnetlink_link asynchronous netlink notifications seem somewhat
troublesome in a threaded environment.  It seems more straightforward
to have netdev-linux fend for itself.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-vport: Make netdev_vport_patch_peer() return a malloc()'d string.
Ben Pfaff [Wed, 31 Jul 2013 21:09:30 +0000 (14:09 -0700)]
netdev-vport: Make netdev_vport_patch_peer() return a malloc()'d string.

When threading comes into the picture there arises the possibility of a
race between netdev_vport_patch_peer()'s caller using the returned string
and another caller changing the peer.  It is safer to return a copy.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev: Adopt four-step alloc/construct/destruct/dealloc lifecycle.
Ben Pfaff [Sat, 10 Aug 2013 04:21:38 +0000 (21:21 -0700)]
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>
10 years agonetdev-bsd: Make use of AF_LINK socket thread-safe in NetBSD.
Ben Pfaff [Thu, 8 Aug 2013 06:48:59 +0000 (23:48 -0700)]
netdev-bsd: Make use of AF_LINK socket thread-safe in NetBSD.

Signed-off-by: Ben Pfaff <blp@nicira.com>
CC: Ed Maste <emaste@freebsd.org>
CC: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
10 years agonetdev-linux, netdev-bsd: Make access to AF_INET socket thread-safe.
Ben Pfaff [Sat, 10 Aug 2013 04:14:23 +0000 (21:14 -0700)]
netdev-linux, netdev-bsd: Make access to AF_INET socket thread-safe.

The only uses of 'af_inet_sock', in both drivers, were ioctls, so it seemed
like a good abstraction to write a function that just does such an ioctl,
and to factor out shared code into socket-util.

Signed-off-by: Ben Pfaff <blp@nicira.com>
CC: Ed Maste <emaste@freebsd.org>
10 years agonetdev-dummy: Use netdev_get_devices() instead of a local shash.
Ben Pfaff [Thu, 25 Jul 2013 23:11:52 +0000 (16:11 -0700)]
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>
10 years agodatapath: Fix typo in flow validation logic.
Jesse Gross [Fri, 9 Aug 2013 22:27:27 +0000 (15:27 -0700)]
datapath: Fix typo in flow validation logic.

A bit shift operation is using the value '11' instead of '1' as the
starting value. This only makes validation weaker than it should be
so unless userspace is trying to install an invalid flow there will
be no effect.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
10 years agoovs-bugtool: Add config files to the debug bundle.
Gurucharan Shetty [Mon, 22 Jul 2013 19:17:08 +0000 (12:17 -0700)]
ovs-bugtool: Add config files to the debug bundle.

The previously defined config files were never included in
the debug bundle. This will include them.

Also increase the max size for CAP_NETWORK_CONFIG to 5 MB.
A pre-compressed size of 5 MB does not amount to much after
compression for config files.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-bugtool: Collect database through CAP_NETWORK_STATUS.
Gurucharan Shetty [Tue, 23 Jul 2013 21:53:11 +0000 (14:53 -0700)]
ovs-bugtool: Collect database through CAP_NETWORK_STATUS.

Currently the openvswitch database is being collected with
CAP_NETWORK_CONFIG which has a max size of 50 KB. This is
quite low as the database can easily be larger than 50 KB.

Move database collection to CAP_NETWORK_STATUS which does
not have a max size. If database size exceeds 10 MB, create
a compacted version of it and then collect it.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoCodingStyle: Add guide about using thread safety types and annotations.
Alex Wang [Thu, 8 Aug 2013 22:14:21 +0000 (15:14 -0700)]
CodingStyle: Add guide about using thread safety types and annotations.

This commit adds guide about using thread safety types and annotations
to CodingStyle file.

Signed-off-by: Alex Wang <alexw@nicira.com>
[blp@nicira.com edited the advice slightly]
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoclang: Pass objects, not their addresses, to thread-safety macros.
Alex Wang [Thu, 8 Aug 2013 22:14:20 +0000 (15:14 -0700)]
clang: Pass objects, not their addresses, to thread-safety macros.

This commit changes the code such that arguments to thread-safety
macros are not ampersanded.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoclang: Use OVS_REQUIRES() instead of OVS_REQ_WRLOCK() for plain mutex.
Alex Wang [Thu, 8 Aug 2013 22:14:19 +0000 (15:14 -0700)]
clang: Use OVS_REQUIRES() instead of OVS_REQ_WRLOCK() for plain mutex.

This commit changes the code to use OVS_REQUIRES() instead of
OVS_REQ_WRLOCK(), for plain mutex.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Avoid MAC learning write lock on fast path.
Ben Pfaff [Wed, 7 Aug 2013 03:35:29 +0000 (20:35 -0700)]
ofproto-dpif-xlate: Avoid MAC learning write lock on fast path.

Most of the trips through update_learning_table() do not actually change
the MAC learning table, but because some do the code there took the
MAC learning table's write lock.  This commit changes the common case to
take only the read lock, falling back to the write lock if a change was
actually necessary.

Ethan reported that this gave a 3.3x performance improvement in one test
case due to reduced lock contention.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoclassifier: Make use of the classifier thread safe.
Ethan Jackson [Thu, 11 Jul 2013 21:19:11 +0000 (14:19 -0700)]
classifier: Make use of the classifier thread safe.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agocompiler: Add OVS_ACQ_BEFORE, OVS_ACQ_AFTER macros.
Ben Pfaff [Fri, 9 Aug 2013 18:18:34 +0000 (11:18 -0700)]
compiler: Add OVS_ACQ_BEFORE, OVS_ACQ_AFTER macros.

An upcoming patch will add the first uses.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Add 'ovs_' prefix to extern symbols.
Jesse Gross [Thu, 8 Aug 2013 02:47:59 +0000 (19:47 -0700)]
datapath: Add 'ovs_' prefix to extern symbols.

The external symbols in the OVS kernel module are prefixed with
'ovs_' with the exception of ipv4_tun_to/from_nlattr(). This adds
the prefix and makes the out of tree version consistent with
upstream.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoofproto-dpif-xlate: Require a lock for reconfiguration.
Ethan Jackson [Sun, 21 Jul 2013 18:31:32 +0000 (11:31 -0700)]
ofproto-dpif-xlate: Require a lock for reconfiguration.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: Remove superfluous semicolons in macro definitions.
Ben Pfaff [Thu, 8 Aug 2013 22:53:28 +0000 (15:53 -0700)]
ovs-thread: Remove superfluous semicolons in macro definitions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Hide rule_dpif_miss_rule().
Ethan Jackson [Fri, 26 Jul 2013 00:20:53 +0000 (17:20 -0700)]
ofproto-dpif: Hide rule_dpif_miss_rule().

It's simpler to hide it than to make it thread safe and ensure it
stays that way in the long term.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Lock the expirable list.
Ethan Jackson [Thu, 8 Aug 2013 00:41:17 +0000 (17:41 -0700)]
ofproto-dpif: Lock the expirable list.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Lock hard_timeout and idle_timeout of struct rule.
Ethan Jackson [Wed, 7 Aug 2013 20:06:49 +0000 (13:06 -0700)]
ofproto: Lock hard_timeout and idle_timeout of struct rule.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: New function xpthread_join().
Ethan Jackson [Tue, 6 Aug 2013 23:47:43 +0000 (16:47 -0700)]
ovs-thread: New function xpthread_join().

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Fix rare segfault on switch exit.
Ethan Jackson [Thu, 8 Aug 2013 18:08:03 +0000 (11:08 -0700)]
ofproto-dpif-xlate: Fix rare segfault on switch exit.

Not all 'xport's have 'xbundle's, so this dereference is unsafe.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: New function ovsthread_id_self().
Ben Pfaff [Tue, 6 Aug 2013 21:57:19 +0000 (14:57 -0700)]
ovs-thread: New function ovsthread_id_self().

I foresee a need for possibly large numbers of instances of "struct
seq" (which is introduced in an upcoming patch).  Each struct seq
needs some per-thread data.  POSIX has pthread_key_t for this, but
the number of keys can be fairly limited, to as few as 128.  It is
reasonable to work around this by using a hash table indexed on the
current thread.  That only works if one can get a thread identifier
that is hashable (pthread_t is not).  This patch introduces a
hashable thread identifier.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: Add support for globally visible per-thread data.
Ben Pfaff [Tue, 6 Aug 2013 21:40:25 +0000 (14:40 -0700)]
ovs-thread: Add support for globally visible per-thread data.

DEFINE_PER_THREAD_DATA always declared its data item as "static", meaning
that it was only directly visible within a single translation unit.
This commit adds additional forms of per-thread data that allow the data
to be accessible from multiple translation units.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: New function xpthread_setspecific().
Ben Pfaff [Tue, 6 Aug 2013 21:30:01 +0000 (14:30 -0700)]
ovs-thread: New function xpthread_setspecific().

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Make packet_ins thread safe.
Ethan Jackson [Sat, 3 Aug 2013 17:04:57 +0000 (10:04 -0700)]
ofproto-dpif: Make packet_ins thread safe.

This patch makes packet_ins thread safe by handing responsibility for
them to ofproto-dpif.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoMerge branch 'master' of git://openvswitch.org/openvswitch
Giuseppe Lettieri [Thu, 8 Aug 2013 14:42:27 +0000 (16:42 +0200)]
Merge branch 'master' of git://openvswitch.org/openvswitch

10 years agonetdev: Make netdev_from_name() take a reference to its returned netdev.
Ben Pfaff [Fri, 26 Jul 2013 00:05:46 +0000 (17:05 -0700)]
netdev: Make netdev_from_name() take a reference to its returned netdev.

This API change is necessary for thread safety, to be added in an upcoming
commit.  Otherwise, the client would not be able to safely use the returned
netdev because it could already have been destroyed.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agonetdev: Make netdev_get_devices() take a reference to each netdev.
Ben Pfaff [Thu, 25 Jul 2013 23:27:39 +0000 (16:27 -0700)]
netdev: Make netdev_get_devices() take a reference to each netdev.

This API change is necessary for thread safety, to be added in an upcoming
commit.  Otherwise, the client would not be able to actually use any of
the returned netdevs because they could already have been destroyed.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agonetdev-provider: Remove unused function netdev_assert_class().
Ben Pfaff [Sat, 27 Jul 2013 00:16:08 +0000 (17:16 -0700)]
netdev-provider: Remove unused function netdev_assert_class().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agonetdev-bsd: Use xmemdup0() to simplify netdev_bsd_get_next_hop().
Ben Pfaff [Thu, 25 Jul 2013 22:38:29 +0000 (15:38 -0700)]
netdev-bsd: Use xmemdup0() to simplify netdev_bsd_get_next_hop().

Signed-off-by: Ben Pfaff <blp@nicira.com>
CC: Ed Maste <emaste@freebsd.org>
CC: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
10 years agonetdev-linux: Move variable declaration inward in netdev_linux_cache_cb().
Ben Pfaff [Fri, 26 Jul 2013 19:42:02 +0000 (12:42 -0700)]
netdev-linux: Move variable declaration inward in netdev_linux_cache_cb().

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