cascardo/ovs.git
9 years agodatapath: Simplify vport_send() error handling.
Pravin B Shelar [Mon, 22 Dec 2014 12:53:02 +0000 (04:53 -0800)]
datapath: Simplify vport_send() error handling.

Today vport-send has complex error handling because it involves
freeing skb and updating stats depending on return value from
vport send implementation.
This can be simplified by delegating responsibility of freeing
skb to the vport implementation for all cases. So that
vport-send needs just update stats.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
9 years agodatapath: compat: introduce ovs_iptunnel_handle_offloads()
Pravin B Shelar [Sat, 20 Dec 2014 00:24:57 +0000 (16:24 -0800)]
datapath: compat: introduce ovs_iptunnel_handle_offloads()

handle offload code is replicated for different tunneling protocols
define compat function to simplify the code.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
9 years agotest: Fix intermittent failure.
Alex Wang [Tue, 23 Dec 2014 08:50:10 +0000 (00:50 -0800)]
test: Fix intermittent failure.

This commit fixes the intermittent failure of test (ofproto-dpif,
balance-tcp bonding, different recirc flow), by waiting for all
bond interfaces to be enabled.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agorecirculation: RCU postpone the free of dpif_backer_recirc_node.
Alex Wang [Tue, 23 Dec 2014 18:20:50 +0000 (10:20 -0800)]
recirculation: RCU postpone the free of dpif_backer_recirc_node.

This commit RCU postpones the free of 'struct dpif_backer_recirc_node',
after it is removed from the cmap.  This is in that other threads may
be accessing the struct at the same time.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agorecirculation: Map recirc_id to ofproto_dpif.
Alex Wang [Wed, 17 Dec 2014 02:47:27 +0000 (18:47 -0800)]
recirculation: Map recirc_id to ofproto_dpif.

After commit 0c7812e5e (recirculation: Do not drop packet when
there is no match from internal table.), if flow keys are modified
before the recirculation action (e.g. set vlan ID), the miss
handling of recirc'ed packets may not reach the intended
'ofproto_dpif' which has rules looking up the 'recirc_id's,
causing drops.

This commit adds an unittest that captures this bug.  Moreover,
to solve this bug, this commit checks mapping between 'recirc_id'
and the corresponding 'ofproto_dpif', and makes sure that the
miss handling of recirc'ed packets are done with the correct
'ofproto_dpif'.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agobundles: Clean up bundle commit.
Jarno Rajahalme [Mon, 22 Dec 2014 19:31:18 +0000 (11:31 -0800)]
bundles: Clean up bundle commit.

This fixes ofp_bundle_commit() in two ways:

- Always remove the bundle regardless of the error condition.
- A commit of an empty bundle must be successful.

The actual commit is still not supported.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto: Reject slave controllers for bundle messages.
Jarno Rajahalme [Mon, 22 Dec 2014 19:31:18 +0000 (11:31 -0800)]
ofproto: Reject slave controllers for bundle messages.

Slave controllers are rejected for flow and port mod messages, so they
should also be rejected for bundles (that require support at least for
flow and port mod messages).

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agobundles: Reject unbundlable messages.
Jarno Rajahalme [Mon, 22 Dec 2014 19:31:18 +0000 (11:31 -0800)]
bundles: Reject unbundlable messages.

Reject bundle add messages containing messages that should not be
bundled.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agobundles: Reject bundle add with bad flags.
Jarno Rajahalme [Mon, 22 Dec 2014 19:31:18 +0000 (11:31 -0800)]
bundles: Reject bundle add with bad flags.

OpenFlow 1.4 states that the switch must reject a bundle add message
whose flags are different from the ones in the bundle.  Do it.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoOF1.4 bundles: Verify xids.
Jarno Rajahalme [Mon, 22 Dec 2014 19:31:18 +0000 (11:31 -0800)]
OF1.4 bundles: Verify xids.

A switch may optionally verify that the 'xid' of an added message is
the same as the 'xid' of the bundle add message itself.  Do it.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agorconn: Make OF 1.4 bundle messages 'admitted'.
Jarno Rajahalme [Mon, 22 Dec 2014 19:31:18 +0000 (11:31 -0800)]
rconn: Make OF 1.4 bundle messages 'admitted'.

Use of OF 1.4 bundle messages by a controller should indicate that the
controller has decided to use the switch, hence make is_admitted_msg()
return 'true' for them.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoconnmgr: Dealloc 'bundles' in ofconn_destroy().
Jarno Rajahalme [Mon, 22 Dec 2014 19:31:17 +0000 (11:31 -0800)]
connmgr: Dealloc 'bundles' in ofconn_destroy().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath:compat: Fix build failure on old kernels.
Pravin B Shelar [Fri, 19 Dec 2014 13:15:16 +0000 (05:15 -0800)]
datapath:compat: Fix build failure on old kernels.

Reported by Travis.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodpctl: Add 'get-flow' command.
Joe Stringer [Fri, 5 Dec 2014 22:45:51 +0000 (14:45 -0800)]
dpctl: Add 'get-flow' command.

This allows users to fetch a flow by giving a particular UFID.

Usage: 'ovs-dpctl get-flow ufid:<ufid>'
Usage: 'ovs-appctl dpctl/get-flow ufid:<ufid>'

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agodpif: Shift ufid support checking up to dpif_backer.
Joe Stringer [Wed, 17 Dec 2014 01:44:40 +0000 (17:44 -0800)]
dpif: Shift ufid support checking up to dpif_backer.

Previously, the dpif layer was responsible for determining datapath
support for UFIDs, which resulted in all ovs-dpctl utilities
inserting/deleting flows from the datapath each time they are run.
Shift this responsibility up to the dpif_backer.

There are two users of this functionality: Revalidators check for UFID
support to request a terser dump using UFIDs, and dpif-netlink uses this
to request flow_del operations to only return the UFID/stats. The latter
case was previously hidden from revalidators, but this change makes them
aware of it, and reuses the same "udpif->enable_ufid" flag for reducing
overhead of both flow dump and flow delete.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agoodp-util: Fix UFID string parsing.
Joe Stringer [Wed, 17 Dec 2014 02:40:50 +0000 (18:40 -0800)]
odp-util: Fix UFID string parsing.

Commit 534a19b (dpctl: Add support for using UFID to add/del flows.)
introduced string parsing functions for UFIDs, but provided a broken
implementation where the upper 64 bits would be ignored, then the lower
64 bits would be read into both the lower and upper UFID positions. Fix
the implementation to read the upper bits properly.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agoodp-util: Format UFID hi/lo in correct order.
Joe Stringer [Mon, 15 Dec 2014 23:00:42 +0000 (15:00 -0800)]
odp-util: Format UFID hi/lo in correct order.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agoofproto-dpif: Fix build failure.
Pravin B Shelar [Fri, 19 Dec 2014 12:02:04 +0000 (04:02 -0800)]
ofproto-dpif: Fix build failure.

Remove xlate_actions_mpls_overflow coverage counter.

Reported-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath: Fix MPLS action validation.
Pravin B Shelar [Fri, 19 Dec 2014 09:55:45 +0000 (01:55 -0800)]
datapath: Fix MPLS action validation.

Linux stack do not allow GSO for packet with multiple
encapsulations.  Therefore there was check in MPLS action
validation to detect such case, But it is better to add
such check at run time to detect such cases.
Removing this check also fixes bug in action copy to no skip
multiple set actions.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Reported-by: Srinivas Neginhal <sneginha@vmware.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Bug #1367702

9 years agoofproto-dpif: Fix MPLS multiple Push pop action.
Pravin B Shelar [Tue, 25 Nov 2014 15:39:20 +0000 (07:39 -0800)]
ofproto-dpif: Fix MPLS multiple Push pop action.

vSwitchd does not generate correct MPLS actions for multiple
MPLS push or pop action.
Datapath can handle multiple push action for in single action list.
But for after first MPLS pop it needs to recirculate packet to
refill packet key. Following patch fixes it accordingly.

Reported-by: Stefano Salsano <stefano.salsano@uniroma2.it>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Tested-by: Pier Luigi Ventre <pl.ventre@gmail.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoroute-table-bsd: Update vlog.h inclusion
YAMAMOTO Takashi [Tue, 16 Dec 2014 01:03:57 +0000 (10:03 +0900)]
route-table-bsd: Update vlog.h inclusion

This fixes a build failure introduced by the recent vlog change
commit e6211adce42c28453e0004c7a3e342a3d52bb97d.
("lib: Move vlog.h to <openvswitch/vlog.h>")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agoovs-docker : Handle pre-existing fake bridges.
Paul-Emmanuel Raoul [Thu, 18 Dec 2014 00:32:35 +0000 (01:32 +0100)]
ovs-docker : Handle pre-existing fake bridges.

Signed-off-by: Paul-Emmanuel Raoul <skyper@skyplabs.net>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agorevalidator: Don't delete non-existent flow.
Joe Stringer [Wed, 10 Dec 2014 19:20:10 +0000 (11:20 -0800)]
revalidator: Don't delete non-existent flow.

If ukey_acquire() returns ENOENT, then it is unable to locate the ukey
corresponding to the flow and the flow has disappeared since it was
dumped. Don't bother deleting the flow in this case, as it will fail.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agodaemon-windows: Add a missing header.
Gurucharan Shetty [Tue, 16 Dec 2014 16:59:05 +0000 (08:59 -0800)]
daemon-windows: Add a missing header.

Without it, the build on Windows fails.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
9 years agodpctl: Add support for using UFID to add/del flows.
Joe Stringer [Wed, 12 Nov 2014 17:49:22 +0000 (09:49 -0800)]
dpctl: Add support for using UFID to add/del flows.

Parse "ufid:<foo>" at the beginning of a flow specification and use it
for flow manipulation if present.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-docker: Add the ability to set VLANs.
Gurucharan Shetty [Fri, 12 Dec 2014 09:27:37 +0000 (01:27 -0800)]
ovs-docker: Add the ability to set VLANs.

For containers containing multiple ports and spawned by
orchestrators without openflow flows configured, it can be quite
useful to distinguish their traffic with vlans. This can be useful
when containers are spawned inside VMs instead of hypervisors.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agoovs-docker: Ability to set the default gateway.
Gurucharan Shetty [Fri, 12 Dec 2014 08:32:50 +0000 (00:32 -0800)]
ovs-docker: Ability to set the default gateway.

ovs-docker currently lets one add the ability to set the
IP address on an OVS interface. Ability to set the default
gateway too can be an useful addition. (orchestrators
who plan to use OVS interfaces can do this from a single
utility instead of multiple utilities)

Requested-by: Marvin Pascual <marvin@pascual.com.ph>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agoovs-docker: Enhance documentation to handle pre-programmed interfaces.
Gurucharan Shetty [Fri, 12 Dec 2014 16:15:46 +0000 (08:15 -0800)]
ovs-docker: Enhance documentation to handle pre-programmed interfaces.

Currently, Controllers and CMSes that integrate with Open vSwitch
after following the IntegrationGuide.md, expect to start VMs after
the underlying network infrastructure is ready. I have been asked
a few times on how to handle the same with containers. This commit
provides documentation on one way to achieve it.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agolib: Add test for library usage
Thomas Graf [Mon, 15 Dec 2014 13:10:38 +0000 (14:10 +0100)]
lib: Add test for library usage

This test covers inclusion of public header files and basic usage
of the API such as vlog.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib: Move vconn.h to <openvswitch/vconn.h>
Thomas Graf [Mon, 15 Dec 2014 13:10:38 +0000 (14:10 +0100)]
lib: Move vconn.h to <openvswitch/vconn.h>

Also moves definitions for struct vconn and pvconn to the public
header. The provider interface is kept private.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib: Move vlog.h to <openvswitch/vlog.h>
Thomas Graf [Mon, 15 Dec 2014 13:10:38 +0000 (14:10 +0100)]
lib: Move vlog.h to <openvswitch/vlog.h>

A new function vlog_insert_module() is introduced to avoid using
list_insert() from the vlog.h header.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib: Expose struct ovs_list definition in <openvswitch/list.h>
Thomas Graf [Mon, 15 Dec 2014 13:10:38 +0000 (14:10 +0100)]
lib: Expose struct ovs_list definition in <openvswitch/list.h>

Expose the struct ovs_list definition in <openvswitch/list.h>. Keep the
list access API private for now.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolist: Rename struct list to struct ovs_list
Thomas Graf [Mon, 15 Dec 2014 13:10:38 +0000 (14:10 +0100)]
list: Rename struct list to struct ovs_list

struct list is a common name and can't be used in public headers.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib: Expose SAT_MUT as OVS_SAT_MUL in <openvswitch/util.h>
Thomas Graf [Mon, 15 Dec 2014 13:10:38 +0000 (14:10 +0100)]
lib: Expose SAT_MUT as OVS_SAT_MUL in <openvswitch/util.h>

Insted of exposing the full sat-math.h API, only the macros
used in headers is exposed through <openvswitch/util.h>

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib: Move token-bucket.h to <openvswitch/token-bucket.h>
Thomas Graf [Mon, 15 Dec 2014 13:10:38 +0000 (14:10 +0100)]
lib: Move token-bucket.h to <openvswitch/token-bucket.h>

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib: Expose ovs_mutex and ovsthread_once in <openvswitch/thread.h>
Thomas Graf [Mon, 15 Dec 2014 13:10:38 +0000 (14:10 +0100)]
lib: Expose ovs_mutex and ovsthread_once in <openvswitch/thread.h>

This picks the ovs_mutex and ovsthread_once API from lib/ovs-thread.h
and exposes it in <openvswitch/thread.h>.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib: Expose SOURCE_LOCATOR as OVS_SOURCE_LOACATOR
Thomas Graf [Mon, 15 Dec 2014 13:10:38 +0000 (14:10 +0100)]
lib: Expose SOURCE_LOCATOR as OVS_SOURCE_LOACATOR

Required to expose headers which depend on SOURCE_LOCATOR

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib: Move compiler.h to <openvswitch/compiler.h>
Thomas Graf [Mon, 15 Dec 2014 13:10:38 +0000 (14:10 +0100)]
lib: Move compiler.h to <openvswitch/compiler.h>

The following macros are renamed to avoid conflicts with other headers:
 * WARN_UNUSED_RESULT to OVS_WARN_UNUSED_RESULT
 * PRINTF_FORMAT to OVS_PRINTF_FORMAT
 * NO_RETURN to OVS_NO_RETURN

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-command-completion: Fix unwanted whitespace.
Alex Wang [Sun, 14 Dec 2014 05:40:25 +0000 (21:40 -0800)]
ovs-command-completion: Fix unwanted whitespace.

This commit fixes unwanted whitespace in the ovs
bash completion script output.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agorecirculation: Do not drop packet when there is no match from
Alex Wang [Sat, 13 Dec 2014 04:51:58 +0000 (20:51 -0800)]
recirculation: Do not drop packet when there is no match from
internal table.

In current recirculation implementation, the flow misses (with
'recirc_id' set) are always looked up on the receiving bridge's
internal flow table.  However, the bond port may actually reside
on another bridge which gets connected to the receiving bridge
via patch port.  Since the recirculation rules are pushed to the
other bridge's internal table, the flow lookup on the receiving
bridge will match nothing but the drop rule, causing unexpected
packet drops.

This commit fixes the above bug via keeping lookup the misses
(with 'recirc_id' set) in default table (table 0) and processing
it until reaching the bridge that owns the bond port.  Then,
the misses can hit the post recirculation flows as expected.

VMware-BZ: 1362178

Reported-by: Ansis Atteka <aatteka@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agoovs-router: Add "ovs/route/lookup" command
YAMAMOTO Takashi [Mon, 17 Nov 2014 06:05:54 +0000 (15:05 +0900)]
ovs-router: Add "ovs/route/lookup" command

This command is useful at least for testing.

Example output:
    % ovs-appctl ovs/route/lookup '10.0.0.1'
    gateway 172.17.0.254
    dev wm0
    %

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodebian: Use ifquery for finding the interfaces in init script.
Jan Vansteenkiste [Mon, 8 Dec 2014 13:52:07 +0000 (14:52 +0100)]
debian: Use ifquery for finding the interfaces in init script.

When using interfaces.d/<foobar>, interfaces are not picked up.
Let ifquery figure out the format of the interfaces files for us.

Signed-off-by: Jan Vansteenkiste <jan@vstone.eu>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto: add support of OFPR_GROUP as packet-in reason for OF1.4+
Shu Shen [Wed, 26 Nov 2014 00:32:15 +0000 (16:32 -0800)]
ofproto: add support of OFPR_GROUP as packet-in reason for OF1.4+

When the Packet-In message is triggered by a group action, OFPR_GROUP is
passed internally as the reason. The wire_reason() function converts the
reason to OFPR_ACTION if the wire protocol is earlier than OF1.4.

The wire_reason() function also converts other unsupported reasons
(i.e., OFPR_ACTION_SET and OFPR_PACKET_OUT) to OFPR_ACTION if it detects
a wire protocol earlier than OF1.4.

By default reason code OFPR_GROUP for Packet-In will be enabled for
async messages as in ofconn_flush(). Upon a connection being established
with a controller, the protocol version is checked and OFPR_GROUP will
be disabled in async config if the protocol is lower than OF1.4. Any
controller running OF1.4+ is still be able to enable OFPR_GROUP at its
will without being affected by this check.

The patch also includes tests cases for both OF1.3 and OF1.4 to ensure
proper reason code is given for packet-in message triggered by group
action.

Signed-off-by: Shu Shen <shu.shen@radisys.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agovtep: Add codeblocks for example commands in README.ovs-vtep.md.
Robert Åkerblom-Andersson [Fri, 5 Dec 2014 23:10:03 +0000 (00:10 +0100)]
vtep: Add codeblocks for example commands in README.ovs-vtep.md.

Signed-off-by: Robert Åkerblom-Andersson <Robert.nr1@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: return bool from NlFillOvs[Msg/Hdr]
Nithin Raju [Mon, 8 Dec 2014 17:43:13 +0000 (09:43 -0800)]
datapath-windows: return bool from NlFillOvs[Msg/Hdr]

Per review comment, in this patch, we update the return values of
NlFillOvsMsg() and NlFillOvsHdr() from NTSTATUS to BOOLEAN to make them
consistent with the Nl* functions.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: refactor BuildReplyMsgFromMsgIn & BuildErrorMsg
Nithin Raju [Mon, 8 Dec 2014 17:43:12 +0000 (09:43 -0800)]
datapath-windows: refactor BuildReplyMsgFromMsgIn & BuildErrorMsg

In this patch, we consolidate code in Netlink.c.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif: Use DPIF_FP_MODIFY for feature probes.
Joe Stringer [Wed, 29 Oct 2014 18:27:09 +0000 (11:27 -0700)]
dpif: Use DPIF_FP_MODIFY for feature probes.

If ovs-vswitchd is killed at the right time, then a probe flow may be
left in the datapath. This commit adds the DPIF_FP_MODIFY flag to
feature probes so that re-creating the same probe flow will not cause an
error.

These flow_put flags were previously changed in commit a7d1bbdcfe49e8
("ofproto-dpif: Use DPIF_FP_CREATE but not DPIF_FP_MODIFY."), despite
the commit message addressing a different case.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodpif: Refactor datapath feature detection.
Joe Stringer [Wed, 29 Oct 2014 21:00:14 +0000 (14:00 -0700)]
dpif: Refactor datapath feature detection.

Various functions in ofproto-dpif and dpif-netlink detect support for
features in very similar ways. Refactor their common code to a single
function.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodpif: Don't initialize output UFID in dpif_flow_get().
Joe Stringer [Wed, 3 Dec 2014 20:57:02 +0000 (12:57 -0800)]
dpif: Don't initialize output UFID in dpif_flow_get().

The UFID parameter to dpif_flow_get() is optional, but the current
implementation dereferences it to initialize part of the output flow.
This field is filled in by the dpif implementation, so don't initialize
it here.

This does not fix any existing bug because every caller currently passes
in a UFID. The next patch will introduce the first call to
dpif_flow_get() that doesn't provide a UFID, which would break without
this change.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoroute-table-bsd: Add some DBG logs
YAMAMOTO Takashi [Wed, 3 Dec 2014 09:17:57 +0000 (18:17 +0900)]
route-table-bsd: Add some DBG logs

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoroute-table-bsd: Provide gateway info
YAMAMOTO Takashi [Mon, 17 Nov 2014 05:29:39 +0000 (14:29 +0900)]
route-table-bsd: Provide gateway info

For userspace tunneling.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-router: non-Linux support
YAMAMOTO Takashi [Mon, 17 Nov 2014 05:40:22 +0000 (14:40 +0900)]
ovs-router: non-Linux support

Refactor ovs-router so that it can work with non-Linux platforms
at least in some extent, using the existing route-table code as
a fallback.  Known restriction: for such platforms, "ovs/router/show"
command does not show "Cached" kernel routes.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoroute-table-bsd: Stop caching pid
YAMAMOTO Takashi [Wed, 3 Dec 2014 09:19:35 +0000 (18:19 +0900)]
route-table-bsd: Stop caching pid

The cache here doesn't work anymore as the recent
commit b772066ffd066d59d9ebce092f6665150723d2ad
("route-table: Remove Unregister.")
made this function called before daemonizing,
thus with a different pid.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Account for already defined NETIF_F_GSO_ENCAP_ALL
Thomas Graf [Wed, 3 Dec 2014 12:02:34 +0000 (13:02 +0100)]
datapath: Account for already defined NETIF_F_GSO_ENCAP_ALL

Relates-to: f6eec614 ("openvswitch: Enable tunnel GSO for OVS bridge.")
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath: Mark compatible with kernels up to 3.18.x
Thomas Graf [Wed, 3 Dec 2014 12:02:32 +0000 (13:02 +0100)]
datapath: Mark compatible with kernels up to 3.18.x

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath: Check if nla_is_last() is available in <net/netlink.h>
Thomas Graf [Wed, 3 Dec 2014 12:02:31 +0000 (13:02 +0100)]
datapath: Check if nla_is_last() is available in <net/netlink.h>

nla_is_last() is not available in 3.18, it's only in net-next.
Convert to grep based to check to account for distribution backports.

Fixes: 684b5f ("datapath: Rename last_action() as nla_is_last() and move to netlink.h")
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoovs-tcpundump: Fix typo in version message.
Eohyung Lee [Tue, 9 Dec 2014 16:35:21 +0000 (01:35 +0900)]
ovs-tcpundump: Fix typo in version message.

Signed-off-by: Eohyung Lee <liquidnuker@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoinclude/openvswitch/util: Add extern "C" { ... }.
Ben Pfaff [Tue, 9 Dec 2014 03:19:23 +0000 (19:19 -0800)]
include/openvswitch/util: Add extern "C" { ... }.

Requested-by: Alan Shieh <ashieh@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agorevalidator: Fix access of uninitialized memory.
Joe Stringer [Tue, 9 Dec 2014 01:14:39 +0000 (17:14 -0800)]
revalidator: Fix access of uninitialized memory.

Commit 64bb477 "dpif: Minimize memory copy for revalidation." introduced
a bug where the corner case of ukey creation (in revalidator threads)
could result in access to uninitialized memory when deleting flows from
the datapath. This could result in OVS aborting or deadlock. Fix it.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agotests/classifier: Make test work in big-endian systems.
Jarno Rajahalme [Mon, 8 Dec 2014 18:10:07 +0000 (10:10 -0800)]
tests/classifier: Make test work in big-endian systems.

Change a test so that the result will be the same in both
little-endian and big-endian systems by editing the test case so that
only one bit differs.

Reported-by: Mijo Safradin <mijo@linux.vnet.ibm.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-actions: Support "copy_field" ONF extension to OpenFlow 1.3.
Ben Pfaff [Mon, 24 Nov 2014 22:29:06 +0000 (14:29 -0800)]
ofp-actions: Support "copy_field" ONF extension to OpenFlow 1.3.

ONF-JIRA: EXT-320
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agoofp-actions: Add support for ONF extension actions.
Ben Pfaff [Mon, 24 Nov 2014 19:10:16 +0000 (11:10 -0800)]
ofp-actions: Add support for ONF extension actions.

Preparation for supporting ONFACT_ET_COPY_FIELD.

ONF-JIRA: EXT-320
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agoofp-actions: Update "copy_field" to latest OF1.5 draft.
Ben Pfaff [Mon, 24 Nov 2014 20:25:56 +0000 (12:25 -0800)]
ofp-actions: Update "copy_field" to latest OF1.5 draft.

Since my original prototype, the oxm_id_len field was removed and
replaced by 2 bytes of padding.

ONF-JIRA: EXT-320
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agotunnel: Recreate tunnel port only when the netdev status change.
Alex Wang [Fri, 5 Dec 2014 22:02:53 +0000 (14:02 -0800)]
tunnel: Recreate tunnel port only when the netdev status change.

On current master, the 'struct tnl_port' in tunnel module will be
recreated whenever the global connectivity sequence number changes
(e.g. when adding unrelated flow).  This is unnecessary and could
cause drop of tunnel packet if a lookup happens between the removal
and recreate.

This commit fixes the above issue by only checking the netdev's own
sequence number.

Found by code inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agoovs-bugtool: Log more detail for dumped flows.
Joe Stringer [Fri, 31 Oct 2014 22:18:21 +0000 (15:18 -0700)]
ovs-bugtool: Log more detail for dumped flows.

The standard mode for printing flows doesn't always provide the full
range of information that is available, particularly with the UFID
changes. Turn on more detail.

Suggested-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agotravis: Only run testsuite for gcc builds
Thomas Graf [Fri, 28 Nov 2014 12:50:02 +0000 (13:50 +0100)]
travis: Only run testsuite for gcc builds

This reduces the total travis build time significantly.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agotravis: Extended kernel build matrix
Thomas Graf [Fri, 28 Nov 2014 12:48:49 +0000 (13:48 +0100)]
travis: Extended kernel build matrix

When doing test builds, build against the following kernels:
  - KERNEL=3.17.4
  - KERNEL=3.16.7
  - KERNEL=3.14.25
  - KERNEL=3.12.33
  - KERNEL=3.10.61
  - KERNEL=3.4.104
  - KERNEL=2.6.32.64

When doing pure kernel test builds, skip compilation of user space bits.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoFAQ.md: Correct claims about MPLS.
Ben Pfaff [Fri, 5 Dec 2014 18:09:56 +0000 (10:09 -0800)]
FAQ.md: Correct claims about MPLS.

An examination of the source code and the tests shows that the FAQ claimed
more for version 2.3 than was really in there.

Reported-by: null pointer <null.pointer.boom@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoFAQ: Fix formatting for command block.
Robert Åkerblom-Andersson [Fri, 5 Dec 2014 04:12:44 +0000 (05:12 +0100)]
FAQ: Fix formatting for command block.

Signed-off-by: Robert Åkerblom-Andersson <Robert.nr1@gmail.com>
9 years agodoc: Fix up markdown syntax in tutorial/Tutorial.md
Thomas Graf [Wed, 3 Dec 2014 08:48:57 +0000 (09:48 +0100)]
doc: Fix up markdown syntax in tutorial/Tutorial.md

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: nuke unused code in Flow.c
Nithin Raju [Wed, 3 Dec 2014 15:56:01 +0000 (07:56 -0800)]
datapath-windows: nuke unused code in Flow.c

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Move Build*Msg() to Netlink.c
Nithin Raju [Wed, 3 Dec 2014 15:56:00 +0000 (07:56 -0800)]
datapath-windows: Move Build*Msg() to Netlink.c

Moving the functions that build netlink messages to Netlink.c from
Vport.c

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Add PID Number attribute for port notification / Fix logic
Eitan Eliahu [Wed, 3 Dec 2014 04:33:17 +0000 (20:33 -0800)]
datapath-windows: Add PID Number attribute for port notification / Fix logic

[1] User mode OVS expects to have the PID number in the port state
    notification command
[2] Fix logic error-for-Windows-user-mode

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-actions: Only set defined bits when encoding "load" actions.
Ben Pfaff [Thu, 4 Dec 2014 22:31:56 +0000 (14:31 -0800)]
ofp-actions: Only set defined bits when encoding "load" actions.

Commit 7eb4b1f1d70345f ("ofp-actions: Support OF1.5 (draft) masked
Set-Field, merge with reg_load.") introduced a bug in that a set_field
action that set an entire field would be translated incorrectly to
reg_load, if the field being set only occupied a portion of the bytes that
it contains.  For example, an MPLS label is 20 bits but has a 4-byte field,
which meant that a set_field would get translated into a reg_load that
wrote all 32 bits; in turn, the receiver of that reg_load would reject it
because it was attempting to set invalid bits (the top 12 bits).

This commit fixes the problem by omitting invalid bits when encoding a
reg_load action.

Reported-by: Pravin Shelar <pshelar@nicira.com>
Tested-by: Pravin Shelar <pshelar@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
9 years agoutil: Fix include for htonl().
Joe Stringer [Fri, 5 Dec 2014 00:05:33 +0000 (16:05 -0800)]
util: Fix include for htonl().

Commit 526a7c85d11dc "util: Add be32_prefix_mask()." added an include for
byte-order.h into util.h, which could cause link failures if users of
libopenvswitch defined their own version of htonll(). Change the
include, as only htonl() is needed and arpa/inet.h provides this.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agocccl: Respect silent flags.
Joe Stringer [Thu, 4 Dec 2014 00:34:08 +0000 (16:34 -0800)]
cccl: Respect silent flags.

Automake sets $V to tell the compiler whether to print verbose messages
as it compiles or not. Add support for this variable in cccl, allowing
more quiet build output on windows if the build is configured with
--silent or the developer runs make V=0.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
9 years agotests: Fix race in async config test.
Joe Stringer [Wed, 3 Dec 2014 18:57:37 +0000 (10:57 -0800)]
tests: Fix race in async config test.

Occasionally, the testsuite would send the OFPT_SET_ASYNC before
ovs-vswitchd got a chance to send its OFPT_ROLE_REPLY message, causing a
reordering of the testsuite output and a false positive. Give the test
script something extra to do so this is less likely to happen.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
9 years agotests: Make ofproto-dpif tests more resilient.
Joe Stringer [Wed, 3 Dec 2014 18:38:18 +0000 (10:38 -0800)]
tests: Make ofproto-dpif tests more resilient.

We have previously used a combination of time/warp and revalidator/wait
to try to synchronize the datapath flow statistics and status up to the
ofproto layer, so that tests may confirm their expected behaviours using
OpenFlow or other protocols operating at that layer of vswitchd (eg LACP).

This patch switches these tests over to using revalidator/purge, which
tells the ofproto-dpif to flush the datapath, causing these statistics
to be updated. In local testing this appears to improve the success rate
of these tests considerably.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
9 years agodpif: Minimize memory copy for revalidation.
Joe Stringer [Sun, 5 Oct 2014 22:14:08 +0000 (11:14 +1300)]
dpif: Minimize memory copy for revalidation.

One of the limiting factors on the number of flows that can be supported
in the datapath is the overhead of assembling flow dump messages in the
datapath. This patch modifies the dpif to allow revalidators to skip
dumping the key, mask and actions from the datapath, by making use of
the unique flow identifiers introduced in earlier patches.

For each flow dump, the dpif user specifies whether to skip these
attributes, allowing the common case to only dump a pair of 128-bit ID
and flow stats. With datapath support, this increases the number of
flows that a revalidator can handle per second by 50% or more. Support
in dpif-netdev and dpif-netlink is added in this patch; kernel support
is left for future patches.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodpif: Index flows using unique identifiers.
Joe Stringer [Wed, 24 Sep 2014 04:26:35 +0000 (16:26 +1200)]
dpif: Index flows using unique identifiers.

This patch modifies the dpif interface to allow flows to be manipulated
using a 128-bit identifier. This allows revalidator threads to perform
datapath operations faster, as they do not need to serialise the entire
flow key for operations like flow_get and flow_delete. In conjunction
with a future patch to simplify the dump interface, this provides a
significant performance benefit for revalidation.

When handlers assemble flow_put operations, they specify a unique
identifier (UFID) for each flow as it is passed down to the datapath to
be stored with the flow. The UFID is currently provided to handlers
by the dpif during upcall processing.

When revalidators assemble flow_get or flow_del operations, they may
specify the UFID for the flow along with the key. The dpif will decide
whether to send only the UFID to the datapath, or both the UFID and flow
key. The former is preferred for newer datapaths that support UFID,
while the latter is used for backwards compatibility.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Add UFID interface to openvswitch.h.
Joe Stringer [Sat, 22 Nov 2014 00:49:40 +0000 (16:49 -0800)]
datapath: Add UFID interface to openvswitch.h.

An upcoming set of patches will implement support for indexing flows by
Unique Flow IDentifiers (UFID) rather than the traditional unmasked key.
This patch implements the interface changes required. The implementation
will follow.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoclassifier: Silence sparse warning (sparse bug)
Thomas Graf [Fri, 28 Nov 2014 12:45:16 +0000 (13:45 +0100)]
classifier: Silence sparse warning (sparse bug)

This silences the following sparse warning which appears to be a bug
in sparse:

lib/classifier-private.h:210:45: warning: call with no type!
lib/classifier-private.h:179:45: warning: call with no type!

Can be reverted when sparse has been fixed.

Cc: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Reviewed-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif: Don't clear argument in dp_enumerate_types().
Ben Pfaff [Tue, 2 Dec 2014 18:50:38 +0000 (10:50 -0800)]
dpif: Don't clear argument in dp_enumerate_types().

All but one of the callers of dp_enumerate_types() hands it an sset that is
known to be empty.  The one exception is the implementation of the
ofproto-provider 'enumerate_types' function in ofproto-dpif.  That function
isn't supposed to clear the existing contents of the sset passed in.
Therefore, this commit changes dp_enumerate_types() to not clear the sset
before it adds new members.

The ofproto-provider comment wasn't clear about the desired behavior so
this commit also clarifies that.

Reported-by: Zoltán Balogh <zoltan.balogh@ericsson.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoNEWS: Multicast snooping was introduced after, not before, version 2.3.
Ben Pfaff [Thu, 20 Nov 2014 16:37:08 +0000 (08:37 -0800)]
NEWS: Multicast snooping was introduced after, not before, version 2.3.

Reported-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
9 years agodist-docs: New utility to generate a documentation bundle for the website.
Ben Pfaff [Tue, 2 Dec 2014 19:04:16 +0000 (11:04 -0800)]
dist-docs: New utility to generate a documentation bundle for the website.

This utility isn't going to be as portable as most of the Open vSwitch
utilities, unfortunately.  I'm happy to take improvements to make it
able to work with, e.g., the "man" program from BSD.  (I haven't tested
with that program, but I suspect that it is somewhat different from the
GNU version.)

The output of this program can already be viewed at:
http://openvswitch.org/support/dist-docs/

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agodocs: Add titles to documentation files that lacked them.
Ben Pfaff [Thu, 27 Nov 2014 18:22:40 +0000 (10:22 -0800)]
docs: Add titles to documentation files that lacked them.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agoovs-testcontroller: Fix manpage .so command.
Ben Pfaff [Thu, 27 Nov 2014 18:22:13 +0000 (10:22 -0800)]
ovs-testcontroller: Fix manpage .so command.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agoroute-table: Remove Unregister.
Pravin B Shelar [Wed, 26 Nov 2014 19:27:05 +0000 (11:27 -0800)]
route-table: Remove Unregister.

Since dpif registering for routing table at initialization
there is no need to unregister it. Following patch removes
support for turning routing table notifications on and off.
Due to this change OVS always listens for these
notifications.

Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
9 years agodatapath: Use ccflags-y instead of deprecated EXTRA_CFLAGS
Thomas Graf [Wed, 26 Nov 2014 14:52:31 +0000 (15:52 +0100)]
datapath: Use ccflags-y instead of deprecated EXTRA_CFLAGS

This allows users to pass in additional compiler flags through the
environment variable EXTRA_CFLAGS, e.g.

   make EXTRA_CFLAGS=-Wno-error=foo V=1

Reported-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodpif-netdev: Fix a race.
Alex Wang [Tue, 25 Nov 2014 23:51:12 +0000 (15:51 -0800)]
dpif-netdev: Fix a race.

On current master, the 'struct dp_netdev_port' is destroyed
immediately when the ref count reaches 0.  However, non-pmd
threads calling the dpif_netdev_execute() for sending packets
could hold pointer to 'port' that is not ref-counted.  Thusly
those threads could possibly access freed memory when the port
is deleted.

To fix this bug, this commit makes non-pmd threads acquiring
the 'port_mutex' before doing the actual execution in
dpif_netdev_execute().

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agovtep: Use unicast MAC as an example for a unicast destination in README.
Ben Pfaff [Mon, 1 Dec 2014 17:43:50 +0000 (09:43 -0800)]
vtep: Use unicast MAC as an example for a unicast destination in README.

Until now, the example for a unicast MAC has been a multicast MAC.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agolib: Use MAP_FOR_EACH_INDEX to improve readability.
Jarno Rajahalme [Wed, 26 Nov 2014 23:30:33 +0000 (15:30 -0800)]
lib: Use MAP_FOR_EACH_INDEX to improve readability.

Use MAP_FOR_EACH_INDEX to improve readability when there is no
apparent cost for it.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoflow.c: Improve minimask_equal() and minimask_has_extra().
Jarno Rajahalme [Wed, 26 Nov 2014 23:17:26 +0000 (15:17 -0800)]
flow.c: Improve minimask_equal() and minimask_has_extra().

minimask_equal() and minimask_has_extra() can take benefit from the
fact that minimasks have no zero data.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoflow: Define miniflow_get__() to simplify code.
Jarno Rajahalme [Wed, 26 Nov 2014 23:17:26 +0000 (15:17 -0800)]
flow: Define miniflow_get__() to simplify code.

miniflow_get__() can be used when it is known that the miniflow stores
a value at the given index.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoflow.h: Simplify MAP_FOR_EACH_INDEX()
Jarno Rajahalme [Fri, 21 Nov 2014 19:23:25 +0000 (11:23 -0800)]
flow.h: Simplify MAP_FOR_EACH_INDEX()

Avoid comparing against specific values.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/route-table-*: Fix non-Linux builds
YAMAMOTO Takashi [Tue, 25 Nov 2014 07:56:06 +0000 (16:56 +0900)]
lib/route-table-*: Fix non-Linux builds

Fix build failures introduced by
commit 1bc50ef389d40be9ee215e66b49cf66fcbdb9eeb
("dpctl: Fix crash.")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-netlink: Fix windows build.
Joe Stringer [Wed, 26 Nov 2014 00:35:42 +0000 (16:35 -0800)]
dpif-netlink: Fix windows build.

Commit 7af12bd "dpif: Generate flow_hash for revalidators in dpif."
broke compilation on windows. Fix it.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoAdd Netronome vendor Id: NMX_VENDOR_ID = 0x00001540.
Simon Horman [Wed, 19 Nov 2014 00:44:55 +0000 (09:44 +0900)]
Add Netronome vendor Id: NMX_VENDOR_ID = 0x00001540.

This is based on the Netronome IEEE OUI, 00154D.
And it has been registered with the ONF:

https://rs.opennetworking.org/wiki/display/PUBLIC/ONF+Registry

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto: Fix checking of packet_in_mask in async config.
Shu Shen [Sat, 22 Nov 2014 00:27:25 +0000 (16:27 -0800)]
ofproto: Fix checking of packet_in_mask in async config.

The check shall use wire protool reasons, which could be different from
the internal packet-in reason.

Signed-off-by: Shu Shen <shu.shen@radisys.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agolib: Add API to set program name and version
Thomas Graf [Mon, 24 Nov 2014 11:49:01 +0000 (12:49 +0100)]
lib: Add API to set program name and version

Required to have reasonable logging messages.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>