cascardo/ovs.git
9 years agoopenflow: Use *_array_len names in struct ofp15_bucket and ofp15_group_mod
Simon Horman [Fri, 21 Nov 2014 01:16:23 +0000 (10:16 +0900)]
openflow: Use *_array_len names in struct ofp15_bucket and ofp15_group_mod

The spec has been clarified to use _list_len in palce of _list_len
terminology to make it clearer that the data is not an ordered list
(it is a set). The code present in Open vSwitch already avoided
the _list_len terminology. This change brings the code into
line with the updated spec.

ONF-JIRA: EXT-350
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoopenflow: Value 4 of enum ofp15_group_mod_command is reserved.
Simon Horman [Fri, 21 Nov 2014 01:15:32 +0000 (10:15 +0900)]
openflow: Value 4 of enum ofp15_group_mod_command is reserved.

The spec has been clarified to note that element 4 of
enum ofp_group_mod_command is reserved. This patch reflects
that change.

ONF-JIRA: EXT-350
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agometa-flow: Add support for ONF OpenFlow 1.3 extension ONFOXM_ET_TCP_FLAGS.
Ben Pfaff [Mon, 24 Nov 2014 23:06:34 +0000 (15:06 -0800)]
meta-flow: Add support for ONF OpenFlow 1.3 extension ONFOXM_ET_TCP_FLAGS.

Actually the draft extension says "TCP_FLAG", without an "S", but I think
that's just a typo.

ONF-JIRA: EXT-109
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agodatapath-windows: Move vport code from Datapath.c to Vport.c.
Nithin Raju [Fri, 21 Nov 2014 00:51:37 +0000 (16:51 -0800)]
datapath-windows: Move vport code from Datapath.c to Vport.c.

Plain code motion. No additional cleanup or refactoring peformed.

I'll be doing some code refactoring in subsequent patches.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif: Fix initialization order.
Pravin B Shelar [Mon, 24 Nov 2014 23:07:23 +0000 (15:07 -0800)]
dpif: Fix initialization order.

OVS router depends on tnl_conf_seq and all tunnel related
components should be initialized before registering dpif
implementations.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agodatapath-windows: Support for hybrid forwarding
Sorin Vinturis [Mon, 24 Nov 2014 22:32:06 +0000 (22:32 +0000)]
datapath-windows: Support for hybrid forwarding

In a hybrid forwarding environment, there are two types of packets that
enter and leave the Hyper-V extensible switch: NVGRE packets and non-NVGRE
packets. Hybrid forwarding involves filtering the incoming traffic based
on packet type.

Thus, we must split the incoming traffic into NVGRE and non-NVGRE packets.
All non-NVGRE traffic is forwarded by the OVS extension and processed as
usual, and the NVGRE traffic is passed to NDIS to be handled by the HNV
module.

Necessary VS project changes regarding the compiler settings will be made
in a different patch.

More details about hybrid forwarding and the necessary NDIS 6.40 support
is provided in issue #52.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Nithin Raju <nithin@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/52
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoOPENFLOW-1.1+.md: Add OpenFlow 1.5 features.
Jean Tourrilhes [Mon, 24 Nov 2014 23:35:53 +0000 (15:35 -0800)]
OPENFLOW-1.1+.md: Add OpenFlow 1.5 features.

Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoOPENFLOW-1.1+.md: Update and correct OpenFlow 1.4 features.
Jean Tourrilhes [Sat, 22 Nov 2014 02:05:10 +0000 (18:05 -0800)]
OPENFLOW-1.1+.md: Update and correct OpenFlow 1.4 features.

Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Removed duplicate checking of previous dump state
Sorin Vinturis [Tue, 18 Nov 2014 14:20:39 +0000 (14:20 +0000)]
datapath-windows: Removed duplicate checking of previous dump state

Removed the check for previous dump state before calling FreeUserDumpState
as the check is also performed in the latter function.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: BSOD for a transactional NL cmd without dump state.
Sorin Vinturis [Tue, 18 Nov 2014 14:20:39 +0000 (14:20 +0000)]
datapath-windows: BSOD for a transactional NL cmd without dump state.

The BSOD is triggered by the incorect extraction of the OVS message
from the received input buffer from userspace, in _FlowNlGetCmdHandler
function.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/54
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-ofctl: Document that mod-group requires the type field
Simon Horman [Tue, 18 Nov 2014 02:31:51 +0000 (11:31 +0900)]
ovs-ofctl: Document that mod-group requires the type field

Document that mod-group rather than del-group requires the type field.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-errors: Use official extension code for OFPBAC_BAD_SET_MASK.
Ben Pfaff [Mon, 24 Nov 2014 18:27:01 +0000 (10:27 -0800)]
ofp-errors: Use official extension code for OFPBAC_BAD_SET_MASK.

ONF-JIRA: EXT-425
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agometa-flow: OXM_OF_PKT_REG<n> now available as (draft) OF1.3 extension.
Ben Pfaff [Mon, 24 Nov 2014 18:41:54 +0000 (10:41 -0800)]
meta-flow: OXM_OF_PKT_REG<n> now available as (draft) OF1.3 extension.

ONF-JIRA: EXT-244
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoofp-util.c: Enable packet-in messages for OpenFlow 1.4 and 1.5.
Jean Tourrilhes [Thu, 13 Nov 2014 19:35:21 +0000 (11:35 -0800)]
ofp-util.c: Enable packet-in messages for OpenFlow 1.4 and 1.5.

Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
[blp@nicira.com added simple test]
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agotests: Add command to purge revalidators of flows.
Joe Stringer [Thu, 13 Nov 2014 18:42:47 +0000 (10:42 -0800)]
tests: Add command to purge revalidators of flows.

This patch adds a new 'ovs-appctl revalidator/purge' command which
flushes all flows from all datapaths, and updates the revalidator
udpif_key cache at the same time.

Update the ofproto-dpif fragment tests which may fail when ukeys are
created from handler threads.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agodpif-netdev: Remove redundant hash action handling.
Pravin B Shelar [Thu, 13 Nov 2014 23:03:39 +0000 (15:03 -0800)]
dpif-netdev: Remove redundant hash action handling.

odp_execute_actions() already handles hash execution part.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agodpctl: Fix crash.
Pravin B Shelar [Thu, 20 Nov 2014 06:12:21 +0000 (22:12 -0800)]
dpctl: Fix crash.

ovs-dpctl crashed due to uninitialized router classifier. To
fix this issue move ovs router initialization to route table
module.

Reported-by: Madhu Challa <challa@noironetworks.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agotunnel-push-pop.at: Make test more deterministic.
Jarno Rajahalme [Fri, 21 Nov 2014 23:42:42 +0000 (15:42 -0800)]
tunnel-push-pop.at: Make test more deterministic.

Using the '-march=native' broke this test in a i7 laptop, most likely
due to a different hash implementation, which resulted in different
datapath port number assignment accross different compilations.

Break up the ports setup so that the datapath port number assignment
is more deterministic.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agonetlink-socket: Set socket pid number in NL message on Windows.
Eitan Eliahu [Sat, 22 Nov 2014 01:34:56 +0000 (17:34 -0800)]
netlink-socket: Set socket pid number in NL message on Windows.

The pid must be set in the NL header as the driver checks it against the pid in
the instance paired with the socket.

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: do not complete an IRP when pending status returned
Eitan Eliahu [Sat, 22 Nov 2014 00:58:54 +0000 (16:58 -0800)]
datapath-windows: do not complete an IRP when pending status returned

The driver completes a pending IRP, the IRP is being marked free by the
I/O manager which causes a system crash when the IRP is completed at
the second time.
The driver should not complete a pending IRP in the context of the
Device I/O control thread.

*** Fatal System Error: 0x00000044
                       (0xFFFFFA800CF897D0,0x0000000000000F7A,0x0000000000000000,0x0000000000000000)

Break instruction exception - code 80000003 (first chance)

BugCheck 44, {fffffa800cf897d0, f7a, 0, 0}

Probably caused by : OVSExt.sys ( OVSExt!OvsCompleteIrpRequest+3a )

Followup: MachineOwner
---------

nt!DbgBreakPointWithStatus:
fffff800`5a100930 cc              int     3
11: kd> !analyze -v
*******************************************************************************
*                                                                             *
*                        Bugcheck Analysis                                    *
*                                                                             *
*******************************************************************************

MULTIPLE_IRP_COMPLETE_REQUESTS (44)
A driver has requested that an IRP be completed (IoCompleteRequest()), but
the packet has already been completed.  This is a tough bug to find because
the easiest case, a driver actually attempted to complete its own packet
twice, is generally not what happened.  Rather, two separate drivers each
believe that they own the packet, and each attempts to complete it.  The
first actually works, and the second fails.  Tracking down which drivers
in the system actually did this is difficult, generally because the trails
of the first driver have been covered by the second.  However, the driver
stack for the current request can be found by examining the DeviceObject
fields in each of the stack locations.
Arguments:
Arg1: fffffa800cf897d0, Address of the IRP
Arg2: 0000000000000f7a
Arg3: 0000000000000000
Arg4: 0000000000000000

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoxen.spec: Fix xenserver build failure.
Alex Wang [Fri, 21 Nov 2014 18:55:03 +0000 (10:55 -0800)]
xen.spec: Fix xenserver build failure.

This commit conducts similar operations as commit 2fd84d5e5
(rhel: Include pkgconfig and update header install in
Fedora/RHEL spec.) to xenserver spec file to prevent the
following rpmbuild failure.

  RPM build errors:
       Installed (but unpackaged) file(s) found:
           /usr/include/openflow/nicira-ext.h
           /usr/include/openflow/openflow-1.0.h
           /usr/include/openflow/openflow-1.1.h
           /usr/include/openflow/openflow-1.2.h
           /usr/include/openflow/openflow-1.3.h
           /usr/include/openflow/openflow-1.4.h
           /usr/include/openflow/openflow-1.5.h
           /usr/include/openflow/openflow-common.h
           /usr/include/openflow/openflow.h
           /usr/include/openvswitch/types.h
           /usr/lib/pkgconfig/libofproto.pc
           /usr/lib/pkgconfig/libopenvswitch.pc
           /usr/lib/pkgconfig/libovsdb.pc
           /usr/lib/pkgconfig/libsflow.pc

VMware-BZ: #1362092

Reported-by: Edwin Chiu <echiu@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agocmap: Shrink cmap when load factor is below 20%.
Alex Wang [Thu, 20 Nov 2014 18:41:52 +0000 (10:41 -0800)]
cmap: Shrink cmap when load factor is below 20%.

This commit adds check in cmap_remove() and shrinks the cmap by half
if the load factor is below 20%.  This is to reduce the memory
utilization of cmap and to avoid the allocated cmap memory occupying
the top of heap memory, preventing the trim of heap.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-netdev: Garbage collect the exact match cache periodically.
Alex Wang [Fri, 14 Nov 2014 23:54:56 +0000 (15:54 -0800)]
dpif-netdev: Garbage collect the exact match cache periodically.

On current master, the exact match cache entry can keep reference to
'struct dp_netdev_flow' even after the flow is removed from the flow
table.  This means the free of allocated memory of the flow is delayed
until the exact match cache entry is cleared or replaced.

If the allocated memory is ahead of chunks of freed memory on heap,
the delay will prevent the reclaim of those freed chunks, causing
falsely high memory utilization.

To fix the issue, this commit makes the owning thread conduct periodic
garbage collection on the exact match cache and clear dead entries.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
---
PATCH -> V2:
- Adopt Jarno's suggestion and conduct slow sweep to avoid introducing
  jitter.

9 years agoovs-vsctl: Update RSTP documentation.
Daniele Venturino [Thu, 20 Nov 2014 17:49:10 +0000 (18:49 +0100)]
ovs-vsctl: Update RSTP documentation.

Mention that the AUTO detection of admin point to point MAC parameter
is not implemented.

Signed-off-by: Martino Fornasa <mf@fornasa.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoNEWS: Information about Ixia ANVL testing.
Daniele Venturino [Thu, 20 Nov 2014 17:49:09 +0000 (18:49 +0100)]
NEWS: Information about Ixia ANVL testing.

Update the NEWS section with some information about testing.

Signed-off-by: Martino Fornasa <mf@fornasa.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agodatapath-windows: rename 'hvDeleted' to 'isPresentOnHv'
Nithin Raju [Thu, 20 Nov 2014 03:41:22 +0000 (19:41 -0800)]
datapath-windows: rename 'hvDeleted' to 'isPresentOnHv'

'hvDeleted' was originally added to track vports that got deleted from
the Hyper-V switch, but which still exists in OVS. Since then, it has
taken a new meaning: eg. it is set to TRUE for VXLAN ports which don't
exist on the Hyper-V switch at all.

Hence renaming it to something more appropriate.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatpaath-windows: consolidate check for output buffer
Nithin Raju [Thu, 20 Nov 2014 17:06:34 +0000 (09:06 -0800)]
datpaath-windows: consolidate check for output buffer

Earlier, output buffer was optional in a transaction command. Thus each
command handler, had to check if the output buffer had indeed been
specified by userspace or not.

Now that output buffer is mandatory in transaction command, let's
consolidate the check in one place, and also convert the previous check
to ASSERTs.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath-windows: cleanup DpInternal.h
Nithin Raju [Thu, 20 Nov 2014 17:06:33 +0000 (09:06 -0800)]
datapath-windows: cleanup DpInternal.h

Getting rid of unused definitions in DpInternal.h.

This is only the first round. There's scope for more cleanup.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatpath-windows: include/OvsPub.h => ovsext/DpInternal.h
Nithin Raju [Wed, 19 Nov 2014 17:14:33 +0000 (09:14 -0800)]
datpath-windows: include/OvsPub.h => ovsext/DpInternal.h

OvsPub.h is not longer the interface file that published the interface
of the kernel datapath to userspace. Nevertheless it is still being used
internal to the kernel datapath.

We rename the file for this reason.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath-windows: nuke non-netlink based interface
Nithin Raju [Wed, 19 Nov 2014 17:14:32 +0000 (09:14 -0800)]
datapath-windows: nuke non-netlink based interface

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath-windows: Avoid BSOD when switch context is NULL
Sorin Vinturis [Wed, 19 Nov 2014 07:16:32 +0000 (07:16 +0000)]
datapath-windows: Avoid BSOD when switch context is NULL

I came around a BSOD that happened when trying to access pidHashLock
from the gOvsSwitchContext, which was NULL. The stop happened in
OvsAcquirePidHashLock function.

To reproduce this BSOD, make sure the extension is enabled and running,
disable it and, after that, execute 'ovs-dpctl.exe show'. The BSOD is
triggered afterwards.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/53
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath-windows: Fixes in HvCreatePort() to re-add a port
Nithin Raju [Wed, 19 Nov 2014 01:42:48 +0000 (17:42 -0800)]
datapath-windows: Fixes in HvCreatePort() to re-add a port

In this patch, we update HvCreatePort() to be able to re-add a Hyper-V
port. Specifically, we handle the case where the port had also been
added by OVS userspace, so that when the port was previously deleted
from Hyper-V, we did not deallocate the port.

The key to a vport is its name. We lookup the list of vports both in the
'portIdHashArray' as well as 'portNoHashArray' to make sure that we
don't have a port with the same name.

Validation:
- deleted an re-added a port with and without the corresponding OVS port
existing
- deleted, changed the name of a port, and re-added it back with and
without the corresponding OVS port existing.
- uninstall was succcessful. No asserts hit.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath-windows: Change return type of OvsInitVxlanTunnel()
Nithin Raju [Wed, 19 Nov 2014 01:42:47 +0000 (17:42 -0800)]
datapath-windows: Change return type of OvsInitVxlanTunnel()

OvsInitVxlanTunnel() need not return a NL_ERROR. In this patch, we
change it to NTSTATUS, and also update the mapping function that maps a
NTSTATUS to NL_ERROR.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath-windows: Changes to InitOvsVportCommon()
Nithin Raju [Wed, 19 Nov 2014 01:42:46 +0000 (17:42 -0800)]
datapath-windows: Changes to InitOvsVportCommon()

If a Hyper-V port (for which there exists an OVS port), gets deleted and
re-added, we'll call into InitOvsVportCommon() for the port to insert
the port into the 'portIdHashArray' as well as do a few other
initialization in the switch ocntext.

We should not be incrementing 'numHvPorts' at this point since this
vport has been counted before when it was first allocated. To account
for this, we add a new parameter to InitOvsVportCommon(). The arguments
passed by some of the callers are not 100% correct, and will be fixed in
future commit in the series.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath-windows: Changes to OvsRemoveAndDeleteVport()
Nithin Raju [Wed, 19 Nov 2014 01:42:45 +0000 (17:42 -0800)]
datapath-windows: Changes to OvsRemoveAndDeleteVport()

In this patch, we add changes to OvsRemoveAndDeleteVport() to allow the
caller to specify if a vport is being deleted because it got deleted on
Hyper-V or if it got deleted from OVS userspace.

The reason we need to make the distinction is to be able to delete the
vport from the relevant hash tables.

If a port has been deleted from all the hash tables ie. has been deleted
from Hyper-V as well as OVS userspace, it gets deallocated.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath-windows: clarify 'portIdHashArray' in the swithc context
Nithin Raju [Wed, 19 Nov 2014 01:42:44 +0000 (17:42 -0800)]
datapath-windows: clarify 'portIdHashArray' in the swithc context

In this patch, we update the documentation for 'portIdHashArray' to
indicate that a vport would exist in this hash table if and only if it
also exists on the Hyper-V switch.

This functionality to implement this semantic will follow in subsequent
patches.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath-windows: add WCHAR version of OvsFindVportByHvName()
Nithin Raju [Wed, 19 Nov 2014 01:42:43 +0000 (17:42 -0800)]
datapath-windows: add WCHAR version of OvsFindVportByHvName()

In this patch, we rename the existing OvsFindVportByHvName() to
OvsFindVportByHvNameA() to indicate that the input string is an ASCII
string. We also define a OvsFindVportByHvNameW() that takes as input a
WCHAR string.

This will be used later in HvCreatPort() to check for ports with
duplicate names.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath-windows: fixes in OvsGetExtInfoIoctl()
Nithin Raju [Wed, 19 Nov 2014 01:42:42 +0000 (17:42 -0800)]
datapath-windows: fixes in OvsGetExtInfoIoctl()

A few fixes around locking.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agoFix build break in ofproto/tunnel.c for windows platform.
Saurabh Shah [Wed, 19 Nov 2014 11:28:41 +0000 (03:28 -0800)]
Fix build break in ofproto/tunnel.c for windows platform.

The breakage was introduced by commit: a36de779
("openvswitch: Userspace tunneling.").

Reported-by: Edwin Chiu <echiu@nicira.com>
Signed-off-by: Saurabh Shah <ssaurabh@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath: compat: Fix build on RHEL 6.6
Pravin B Shelar [Wed, 12 Nov 2014 02:56:34 +0000 (18:56 -0800)]
datapath: compat: Fix build on RHEL 6.6

RHEL 6.6 kernel percpu APIs are broken, so following patch is using OVS
backported version.

Reported-by: Wang Sheng-Hui <shhuiw@gmail.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoofproto-dpif: fix bundle_move() call in rstp_run().
Daniele Venturino [Wed, 19 Nov 2014 21:16:17 +0000 (22:16 +0100)]
ofproto-dpif: fix bundle_move() call in rstp_run().

bundle_move() expects two struct ofbundle pointers as arguments, but
void pointers hide the error.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp: refactor RSTP setters.
Daniele Venturino [Thu, 6 Nov 2014 15:31:15 +0000 (16:31 +0100)]
rstp: refactor RSTP setters.

With this patch setters invoke procedures only if values have changed.
Also rstp_set_bridge_address__() keeps the existing priority in the
bridge_identifier.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp-state-machines: fix proposal reception behaviour.
Jarno Rajahalme [Fri, 14 Nov 2014 21:58:25 +0000 (13:58 -0800)]
rstp-state-machines: fix proposal reception behaviour.

Other ports should stop forwarding and learning when a port receives a
superior BPDU carrying a Proposal flag.
Without this patch this does not happen and other ports keep executing
the learning and forwarding processes.
This patch contains some fixes reported in the 802.1q-2008 standard.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp: Fix global transitions.
Jarno Rajahalme [Wed, 19 Nov 2014 17:27:56 +0000 (09:27 -0800)]
rstp: Fix global transitions.

Global transitions are highest priority transitions.  When the
condition associated with a global transition is met, it supersedes
all other exit conditions including UCT.

Extracted from 802.1D-2004 standard (17.16):

A transition that is global in nature (i.e., a transition that occurs
from any of the possible states if the condition attached to the arrow
is met) is denoted by an open arrow, i.e., no specific state is
identified as the origin of the transition.  When the condition
associated with a global transition is met, it supersedes all other
exit conditions including UCT.  The special global condition BEGIN
supersedes all other global conditions, and once asserted remains
asserted until all state blocks have executed to the point that
variable assignments and other consequences of their execution remain
unchanged.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp: shift learned MAC addresses to new Root port.
Jarno Rajahalme [Wed, 19 Nov 2014 17:24:52 +0000 (09:24 -0800)]
rstp: shift learned MAC addresses to new Root port.

All MAC addresses previously learned on a Root Port can be moved to an
Alternate Port that becomes the new Root Port; i.e., Dynamic Filtering
Entries for those addresses may be modified to show the new Root Port as
their source, reducing the need to flood frames when recovering from
some component failures.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoclassifier: Defer pvector publication.
Jarno Rajahalme [Thu, 13 Nov 2014 19:54:31 +0000 (11:54 -0800)]
classifier: Defer pvector publication.

This patch adds a new functions classifier_defer() and
classifier_publish(), which control when the classifier modifications
are made available to lookups.  By default, all modifications are made
available to lookups immediately.  Modifications made after a
classifier_defer() call MAY be 'deferred' for later 'publication'.  A
call to classifier_publish() will both publish any deferred
modifications, and cause subsequent changes to to be published
immediately.

Currently any deferring is limited to the visibility of the subtable
vector changes.  pvector now processes modifications mostly in a
working copy, which needs to be explicitly published with
pvector_publish().  pvector_publish() sorts the working copy and
removes gaps before publishing it.

This change helps avoiding O(n**2) memory behavior in corner cases,
where large number of rules with different masks are inserted or
deleted.

VMware-BZ: #1322017
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoclassifier: Make insert and replace take a const rule, too.
Jarno Rajahalme [Thu, 13 Nov 2014 19:54:31 +0000 (11:54 -0800)]
classifier: Make insert and replace take a const rule, too.

classifier_remove() was recently changed to take a const struct
cls_rule *.  Make the corresponding change to classifier_replace() and
classifier_insert().  This simplifies existing calling sites in
ofproto.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoclassifier: Remove internal mutex.
Jarno Rajahalme [Fri, 14 Nov 2014 23:58:09 +0000 (15:58 -0800)]
classifier: Remove internal mutex.

Almost all classifier users already exclude concurrent modifications,
or are single-threaded, hence the classifier internal mutex can be
removed.  Due to this change, ovs-router.c and tnl-ports.c need new
mutexes, which are added.

As noted by Ben in review, ovs_router_flush() should also free the
entries it removes from the classifier.  It now calls
ovsrcu_postpone() to that effect.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoclassifier: Lockless and robust classifier iteration.
Jarno Rajahalme [Thu, 13 Nov 2014 19:54:31 +0000 (11:54 -0800)]
classifier: Lockless and robust classifier iteration.

Previously, accurate iteration required writers to be excluded during
iteration.  This patch adds an rculist to struct cls_subtable, and a
corresponding list node to struct cls_rule, which makes iteration more
straightforward, and allows the iterators to remain ignorant of the
internals of the cls_match.  This new list allows iteration of rules
in the classifier by traversing the RCU-friendly subtables vector, and
the rculist of rules in each subtable.

Classifier modifications may be performed concurrently, but whether or
not the concurrent iterator sees those changes depends on the timing
of change.  More specifically, an concurrent iterator:

- May or may not see a rule that is being inserted or removed.
- Will see either the new or the old version of a rule that is replaced.
- Will see all the other rules (that are not being modified).

Finally, The subtable's rculist also allows to make
classifier_rule_overlaps() lockless, which this patch also does.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoclassifier: Do not insert duplicate rules in indices.
Jarno Rajahalme [Fri, 14 Nov 2014 22:47:03 +0000 (14:47 -0800)]
classifier: Do not insert duplicate rules in indices.

There is no point in adding duplicate information into prefix tries.

Also, since the lower-priority duplicate rules are not visible to
lookups, they do not need to be in staged lookup indices directly
either (the head rule is).

Finally, now that cmap operations return the number of elements in the
cmap, subtable's 'n_rules' member is not needed any more.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Remove all duplicate checks for NULL.
Sorin Vinturis [Fri, 14 Nov 2014 11:35:21 +0000 (11:35 +0000)]
datapath-windows: Remove all duplicate checks for NULL.

Right now the gOvsSwitchContext pointer is checked against NULL
in a lot of places of the OVS extension code. This check should
be done only once to avoid wasteful checks. Thus I have added the
check in the dispatch routine, before doing any processing, and
removed all other checks from the rest of the code.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agorstp-state-machines: fix rcv_info().
Daniele Venturino [Fri, 14 Nov 2014 22:07:51 +0000 (14:07 -0800)]
rstp-state-machines: fix rcv_info().

A Config BPDU always conveys a Designated Port Role.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp: Refactor rstp_port_set_administrative_bridge_port__().
Jarno Rajahalme [Fri, 14 Nov 2014 22:07:51 +0000 (14:07 -0800)]
rstp: Refactor rstp_port_set_administrative_bridge_port__().

Invoke move_rstp__() in rstp_port_set_administrative_bridge_port__()
if port is not initializing.  This is necessary in a test that checks
that a Port becoming alternate/backup/disabled stops learning and
forwarding.  The move_rstp__() call is necessary to immediatly disable
learning and forwarding on that port.  Without this, the test fails.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp: Refactor rstp_check_and_reset_fdb_flush().
Jarno Rajahalme [Fri, 14 Nov 2014 22:07:50 +0000 (14:07 -0800)]
rstp: Refactor rstp_check_and_reset_fdb_flush().

With this commit, RSTP is able to flush from the MAC learning table
entries pertaining to a single port.  Before this commit the whole
table was flushed every time a port requested flushing actions.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agostp,rstp: disable learning and forwarding in STP/RSTP disabled state.
Daniele Venturino [Fri, 14 Nov 2014 22:07:50 +0000 (14:07 -0800)]
stp,rstp: disable learning and forwarding in STP/RSTP disabled state.

There is a difference between a port with STP/RSTP protocol enabled and a
disabled role and a port which has a disabled role because STP/RSTP is
not active.  This commit ensure to make such distinction.

Standard 802.1D claims that the Topology Change state machine (17.31)
treats a Port as no longer active when it becomes an Alternate, Backup,
or Disabled Port and stops learning from received frames.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp: Invoke updt_roles_tree__() in max_age and forward_delay setters.
Jarno Rajahalme [Fri, 14 Nov 2014 22:07:50 +0000 (14:07 -0800)]
rstp: Invoke updt_roles_tree__() in max_age and forward_delay setters.

This patch was necessary in a test on the acceptable range values of
max_age and forward_delay.  Since rstp_set_bridge_max_age__() and
rstp_set_bridge_forward_delay__() set the rstp->bridge_max_age and
rstp->bridge_forward_delay variables, it was necessary to call
updt_roles_tree__() to immediately update p->designated_times, used in
tx_rstp() (in lib/rstp-state-machines.c).  After this change the
validation software received the expected maxAge and forwardDelay
values.  Otherwise, such test failed.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp-state-machines: fix TCN reception.
Daniele Venturino [Fri, 14 Nov 2014 22:07:50 +0000 (14:07 -0800)]
rstp-state-machines: fix TCN reception.

Set rcdv_tcn and return OTHER_INFO when a
TOPOLOGY_CHANGE_NOTIFICATION_BPDU is received, as required by
802.1Q-2008.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp-state-machines: Rename ALTERNATE_AGREED state as ALTERNATE_AGREED_EXEC.
Daniele Venturino [Fri, 14 Nov 2014 22:07:50 +0000 (14:07 -0800)]
rstp-state-machines: Rename ALTERNATE_AGREED state as ALTERNATE_AGREED_EXEC.

All other similar port_role_transition_sm states are named according
to this pattern.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp-state-machines: Fix updt_roles_tree().
Daniele Venturino [Fri, 14 Nov 2014 22:07:50 +0000 (14:07 -0800)]
rstp-state-machines: Fix updt_roles_tree().

If the DesignatedBridgeID Bridge Address component is equal to that
component of the Bridge's own bridge priority vector skip to the next
port.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp-state-machines: Fix Topology Change State Machine transition.
Daniele Venturino [Fri, 14 Nov 2014 22:07:50 +0000 (14:07 -0800)]
rstp-state-machines: Fix Topology Change State Machine transition.

Accordingly to the 802.1D-2004 standard, the transition from the
TOPOLOGY_CHANGE_SM_NOTIFIED_TCN_EXEC state should go to the
TOPOLOGY_CHANGE_SM_NOTIFIED_TC_EXEC state and not to the
TOPOLOGY_CHANGE_SM_ACTIVE.

See section 17.31 of 802.1D-2004 standard.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp-state-machines: Fix compare_rstp_priority_vector().
Daniele Venturino [Fri, 14 Nov 2014 22:07:50 +0000 (14:07 -0800)]
rstp-state-machines: Fix compare_rstp_priority_vector().

The bridge_port_id is never conveyed in Configuration Messages, but is
used as a tie-breaker within a Bridge.  This patch extends the
comparison to this fifth field in a rstp_priority_vector.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp-state-machines: Fix reception of BPDUs conveying an unknown port role.
Jarno Rajahalme [Fri, 14 Nov 2014 22:07:50 +0000 (14:07 -0800)]
rstp-state-machines: Fix reception of BPDUs conveying an unknown port role.

If the Unknown value of the Port Role parameter is received, the state
machines should treat the RST BPDU as if it were a Configuration BPDU.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp: Add 'rstp-admin-p2p-mac' and 'rstp-admin-port-state' setters.
Jarno Rajahalme [Fri, 14 Nov 2014 22:07:50 +0000 (14:07 -0800)]
rstp: Add 'rstp-admin-p2p-mac' and 'rstp-admin-port-state' setters.

'rstp-admin-port-state' is the Administrative Bridge Port state
variable defined in the 802.1D-2004 standard.  It can be set to
include or exclude a port from the active topology by management
(section 7.4).

operPointToPointMAC and 'rstp-admin-p2p-mac' are a pair of parameters
that permit inspection of, and control over, the administrative and
operational state of the point-to-point status of the MAC entity by
the MAC Relay Entity.  adminPointToPointMAC can be set by management
and its value is reflected on operPointToPointMAC.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agorstp: Show some useful rstp port fields.
Jarno Rajahalme [Fri, 14 Nov 2014 22:07:50 +0000 (14:07 -0800)]
rstp: Show some useful rstp port fields.

designated_bridge_id, designated_port_id and designated_path_cost are
now displayed in rstp_status when using 'ovs-vsctl list port'.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agotests: Skip tunnel-push-pop test on Windows and BSD.
Pravin B Shelar [Thu, 13 Nov 2014 22:52:51 +0000 (14:52 -0800)]
tests: Skip tunnel-push-pop test on Windows and BSD.

Also updates ovs-router README documentation.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
9 years agorstp: Show some useful rstp port fields.
Jarno Rajahalme [Thu, 13 Nov 2014 22:55:25 +0000 (14:55 -0800)]
rstp: Show some useful rstp port fields.

designated_bridge_id, designated_port_id and designated_path_cost are
now displayed in rstp_status when using 'ovs-vsctl list port'.

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoovs-ofctl: Support bucket commands
Simon Horman [Thu, 13 Nov 2014 02:53:29 +0000 (11:53 +0900)]
ovs-ofctl: Support bucket commands

(Draft) OpenFlow 1.5 flow mod commands include commands to manipulate the
buckets of existing groups. This patch add support to ovs-ofctl for these
commands. It also adds documentation and tests for them.

ONF-JIRA: EXT-350
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto: Handle (draft) OpenFlow 1.5 insert and remove group commands.
Simon Horman [Thu, 13 Nov 2014 02:53:28 +0000 (11:53 +0900)]
ofproto: Handle (draft) OpenFlow 1.5 insert and remove group commands.

Handle (draft) OpenFlow 1.5 insert and remove group commands
of group mod messages.

ONF-JIRA: EXT-350
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoopenflow: Add OpenFlow 1.4 packet-in reasons.
Shu Shen [Thu, 13 Nov 2014 00:29:59 +0000 (16:29 -0800)]
openflow: Add OpenFlow 1.4 packet-in reasons.

Signed-off-by: Shu Shen <shu.shen@radisys.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agorhel: Include pkgconfig and update header install in Fedora/RHEL spec.
Thomas Graf [Thu, 13 Nov 2014 11:28:45 +0000 (12:28 +0100)]
rhel: Include pkgconfig and update header install in Fedora/RHEL spec.

As headers are installed by 'make install' now, the explicit install
instructions can be be removed from the spec file.

The spec file has been including <config.h> plus all headers in lib/ so
far which is dangerous:

 * config.h is a description of the capabilities of the build machine
   where the package was built. Although it may hint on what is
   included in the library, the defines do not necessarily hold true on
   another build machine.

 * Some headers in lib/ do not contain proper prefixes and pollute the
   global header name space. Do not include them anymore. Properly
   cleaned up headers will be exposed in openvswitch/ and openflow/

For the RHEL spec, both pkgconfig and headers are omitted as no -devel
package exists yet.

Cc: Flavio Leitner <fbl@redhat.com>
Suggested-by: Flavio Leitner <fbl@redhat.com>
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 agolib: Add support for pkgconfig for libsflow.
Thomas Graf [Thu, 13 Nov 2014 11:28:44 +0000 (12:28 +0100)]
lib: Add support for pkgconfig for libsflow.

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 agolib: Add support for pkgconfig for libovsdb.
Thomas Graf [Thu, 13 Nov 2014 11:28:43 +0000 (12:28 +0100)]
lib: Add support for pkgconfig for libovsdb.

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 agolib: Add support for pkgconfig for libofproto.
Thomas Graf [Thu, 13 Nov 2014 11:28:42 +0000 (12:28 +0100)]
lib: Add support for pkgconfig for libofproto.

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 agolib: Add support for pkgconfig for libopenvswitch.
Rob Adams [Thu, 13 Nov 2014 11:28:41 +0000 (12:28 +0100)]
lib: Add support for pkgconfig for libopenvswitch.

Add rule to generate pkgconfig .pc file from configure.
Install pkg-config file to $(libdir)/pkgconfig

Signed-off-by: Rob Adams <readams@readams.net>
Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoinclude: Install openflow/ and openvswitch/ headers.
Thomas Graf [Thu, 13 Nov 2014 11:28:40 +0000 (12:28 +0100)]
include: Install openflow/ and openvswitch/ headers.

Suggested-by: Ben Pfaff <blp@nicira.com>
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 agodpif-netdev: Allow direct destroy of 'struct dp_netdev_port'.
Alex Wang [Fri, 7 Nov 2014 21:27:05 +0000 (13:27 -0800)]
dpif-netdev: Allow direct destroy of 'struct dp_netdev_port'.

Before this commit, when 'struct dp_netdev_port' is deleted from
'dpif-netdev' datapath, if there is pmd thread, the pmd thread
will release the last reference to the port and ovs-rcu postpone
the destroy.  However, the delayed close of object like 'struct
netdev' could cause failure in immediate re-add or reconfigure of
the same device.

To fix the above issue, this commit uses condition variable and
makes the main thread wait for pmd thread to release the reference
when deleting port.  Then, the main thread can directly destroy the
port.

Reported-by: Cian Ferriter <cian.ferriter@intel.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoofproto-dpif-xlate: Allow direct destroy of previous config.
Alex Wang [Fri, 7 Nov 2014 21:02:05 +0000 (13:02 -0800)]
ofproto-dpif-xlate: Allow direct destroy of previous config.

Before this commit, the ofproto-dpif-xlate module uses ovs-rcu to
postpone the destroy of previous configuration.  However, the delayed
close of object like 'struct netdev' could cause failure in immediate
re-add or reconfigure of the same device.

To fix the above issue, this commit makes the ofproto-dpif-xlate
module call ovsrcu_synchronize(), which waits for all threads
to finish the use of reference to previous config.  Then, the
module can just directly destroy the previous config.

Reported-by: Cian Ferriter <cian.ferriter@intel.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-netdev: Move 'struct dp_netdev_port' initialization before use.
Alex Wang [Sat, 8 Nov 2014 01:11:07 +0000 (17:11 -0800)]
dpif-netdev: Move 'struct dp_netdev_port' initialization before use.

There is a portion of the 'struct dp_netdev_port' initialization
that is placed after the reload of pmd threads.  This means in
theory, there could be a race where pmd threads access half-
initialized struct.  Although such race has not been seen, it
makes sense to fully initialize the struct before use.

Found by code inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoclassifier: Integrate insert_rule() into classifier_replace().
Jarno Rajahalme [Wed, 12 Nov 2014 23:22:35 +0000 (15:22 -0800)]
classifier: Integrate insert_rule() into classifier_replace().

insert_rule() only had one caller and this makes the code easier to
understand.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agotests: Fix ovs-ofctl rule with importance test case.
Jarno Rajahalme [Wed, 12 Nov 2014 23:22:35 +0000 (15:22 -0800)]
tests: Fix ovs-ofctl rule with importance test case.

Sort the flow dump results to always have them in consistent order.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoopenvswitch: Userspace tunneling.
Pravin B Shelar [Tue, 11 Nov 2014 19:53:47 +0000 (11:53 -0800)]
openvswitch: Userspace tunneling.

Following patch adds support for userspace tunneling. Tunneling
needs three more component first is routing table which is configured by
caching kernel routes and second is ARP cache which build automatically
by snooping arp. And third is tunnel protocol table which list all
listening protocols which is populated by vswitchd as tunnel ports
are added. GRE and VXLAN protocol support is added in this patch.

Tunneling works as follows:
On packet receive vswitchd check if this packet is targeted to tunnel
port. If it is then vswitchd inserts tunnel pop action which pops
header and sends packet to tunnel port.
On packet xmit rather than generating Set tunnel action it generate
tunnel push action which has tunnel header data. datapath can use
tunnel-push action data to generate header for each packet and
forward this packet to output port. Since tunnel-push action
contains most of packet header vswitchd needs to lookup routing
table and arp table to build this action.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoFix misspellings of "OpenFlow".
Ben Pfaff [Wed, 12 Nov 2014 00:42:24 +0000 (16:42 -0800)]
Fix misspellings of "OpenFlow".

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
9 years agoutil: Introduce ovs_scan_len()
Pravin B Shelar [Mon, 10 Nov 2014 20:46:11 +0000 (12:46 -0800)]
util: Introduce ovs_scan_len()

This is similar to ovs_scan but takes int pointer as extra
parameter, this pointer point to starting index of the string.
On successful scan this API stores number of characters
scanned.  This API is useful for parsing complex odp actions
e.g. tun_push action.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agotunnel: Convert rwlock to fat-rwlock.
Pravin B Shelar [Mon, 10 Nov 2014 20:45:57 +0000 (12:45 -0800)]
tunnel: Convert rwlock to fat-rwlock.

Tunnel lookup is done in slow path but DPDK tunneling
slow path is called in PMD context. Therefore it is
better to convert rwlock to fat rwlock.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib: Avoid using C++ keywords as variable names in header files.
Amit Bose [Wed, 12 Nov 2014 14:06:08 +0000 (15:06 +0100)]
lib: Avoid using C++ keywords as variable names in header files.

Otherwise C++ programs can't #include the headers.

Signed-off-by: Amit Bose <bose@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoinclude: Use #include <.*> in public headers.
Thomas Graf [Wed, 12 Nov 2014 14:06:02 +0000 (15:06 +0100)]
include: Use #include <.*> in public headers.

Required to make the headers installable.

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 agolib: Document --enable-shared configure switch
Thomas Graf [Wed, 12 Nov 2014 14:06:00 +0000 (15:06 +0100)]
lib: Document --enable-shared configure switch

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 agolib: Correctly pass collected AM_LDFLAGS to linker
Thomas Graf [Wed, 12 Nov 2014 14:05:59 +0000 (15:05 +0100)]
lib: Correctly pass collected AM_LDFLAGS to linker

AM_LDFLAGS is not automatically passed to individual library LDFLAGS
and must be passed in explicitly.

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 agoofp-parse: Parse bucket commands of group mod.
Simon Horman [Wed, 12 Nov 2014 06:24:12 +0000 (15:24 +0900)]
ofp-parse: Parse bucket commands of group mod.

(Draft) OpenFlow 1.5 adds bucket commands to group mod.
This patch allows parsing of them as a step towards supporting them.

ONF-JIRA: EXT-350
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-util: Provide bucket list helper functions
Simon Horman [Wed, 12 Nov 2014 06:24:10 +0000 (15:24 +0900)]
ofp-util: Provide bucket list helper functions

This is in preparation for supporting the bucket commands of
(draft) Open Flow 1.5 group mod messages.

Also document ofputil_bucket_check_duplicate_id() for good measure.

ONF-JIRA: EXT-350
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-util: Enhance error logging during encoding group mod messages.
Simon Horman [Wed, 12 Nov 2014 06:24:09 +0000 (15:24 +0900)]
ofp-util: Enhance error logging during encoding group mod messages.

In preparation for supporting (draft) OpenFlow 1.5
group mod commands enhance the error logging of them.

ONF-JIRA: EXT-350
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-util: Do not allow buckets for OFPGC15_REMOVE_BUCKET.
Simon Horman [Wed, 12 Nov 2014 06:24:08 +0000 (15:24 +0900)]
ofp-util: Do not allow buckets for OFPGC15_REMOVE_BUCKET.

ONF-JIRA: EXT-350
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agotests: Skip a sflow test for Windows.
Gurucharan Shetty [Wed, 12 Nov 2014 15:23:00 +0000 (07:23 -0800)]
tests: Skip a sflow test for Windows.

AT_XFAIL_IF cannot be used here because it lets the tests
run first and then say that the failure is expected. In this
particular test, the utilities simply hang blocking all
other tests. So use AT_SKIP_IF instead.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Nithin Raju <nithin@vmware.com>
9 years agoINSTALL.Windows: Add a TODO for QOS.
Gurucharan Shetty [Wed, 12 Nov 2014 14:56:10 +0000 (06:56 -0800)]
INSTALL.Windows: Add a TODO for QOS.

Also, remove the entry that talks about the need for atomic support
on Windows as that has already been added.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Nithin Raju <nithin@vmware.com>
9 years agoofproto: Test that group commands fail for OpenFlow 1.0
Simon Horman [Wed, 12 Nov 2014 06:45:17 +0000 (15:45 +0900)]
ofproto: Test that group commands fail for OpenFlow 1.0

Groups are not supported by OpenFlow 1.0

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Update port property.
Eitan Eliahu [Wed, 12 Nov 2014 09:31:27 +0000 (01:31 -0800)]
datapath-windows: Update port property.

Update Hyper-V port properties on NDIS property port set callback.
Driver update the port friendly name in its internal table.
Since the NIC Create callback won't be called after we need to maintain the
NIC and THE OVS states of the Vport.

Setting a new friendly name was tested in the following states:
[1] The port is disconnected
[2] The port is connected but not OVS user mode counter port
[3] The port is connected and an OCS port associated with it

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Add functionality to return OVSPortName given a VM
Alin Serdean [Tue, 11 Nov 2014 18:45:32 +0000 (18:45 +0000)]
datapath-windows: Add functionality to return OVSPortName given a VM

This commit adds functionality to return the ElementName of all the VNIC of a
given virtual machine name.

The function returns all the allocated ports including the ones which the OVS
port name was not set.

The default OVS port name that is set is the following:
"ElementName             : Dynamic Ethernet Switch Port".

Example of usage:
Import-Module OVS.psm1
Get-VMNetworkAdapterWithOvsPort test_ubuntu_1
$a = Get-VMNetworkAdapterWithOvsPort test_2_1
$a | findstr ElementName

Requested-by: Nithin Raju <nithin@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/51
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agotravis: Add building of shared library to CI matrix.
Thomas Graf [Wed, 12 Nov 2014 09:22:02 +0000 (10:22 +0100)]
travis: Add building of shared library to CI matrix.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoBuild: Add support for shared libraries and versioning.
Scott Mann [Sat, 8 Nov 2014 03:02:09 +0000 (19:02 -0800)]
Build: Add support for shared libraries and versioning.

These changes allow for the building of shared libraries by providing
the --enable-shared option to configure. In particular, lib/libopenvwitch.so,
lib/libsflow.so, ofproto/libofproto.so, and ovsdb/libovsdb.so will be built.
Original behavior of building static remains the same.

Additionally, versioning is introduced to each of the libraries objects
paving the way for APIs to be built around them. A detailed comment
outlining the rules for changing a version number is provided in
configure.ac. Note that at this time, the version number is set to
1.0.0, no API is specified yet, and there are no requirements to
maintain any sort of compatibility in any of the libraries.

Signed-off-by: Scott Mann <smann@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoutil: Add be32_prefix_mask().
Jarno Rajahalme [Tue, 11 Nov 2014 23:50:51 +0000 (15:50 -0800)]
util: Add be32_prefix_mask().

Shifting a 32-bit entity by 32 bits is undefined behavior.  As we have 3
cases where we may hit this, it is a time to introduce a helper for
this.

VMware-BZ: #1355026
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>