cascardo/ovs.git
9 years agodatapath: Fix comment style.
Pravin B Shelar [Mon, 20 Oct 2014 22:19:10 +0000 (15:19 -0700)]
datapath: Fix comment style.

Use netdev comment style.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agodatapath: Replace __force type cast with rcu_dereference_raw().
Pravin B Shelar [Mon, 20 Oct 2014 22:05:56 +0000 (15:05 -0700)]
datapath: Replace __force type cast with rcu_dereference_raw().

rcu_dereference_raw() api is cleaner way of accessing RCU pointer
when no locking is required.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agoofproto: Report support for group stats.
Ben Pfaff [Mon, 20 Oct 2014 22:05:27 +0000 (15:05 -0700)]
ofproto: Report support for group stats.

This feature bit was overlooked when we added support for group stats.

Reported-by: Anup Khadka <khadka.py@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agoofp-actions: Properly check for action that exceeds buffer length.
Ben Pfaff [Thu, 23 Oct 2014 21:34:04 +0000 (14:34 -0700)]
ofp-actions: Properly check for action that exceeds buffer length.

Commit c2d936a44fa (ofp-actions: Centralize all OpenFlow action code for
maintainability.) rewrote OpenFlow action parsing but failed to check that
actions don't overflow their buffers.  This commit fixes the problem and
adds negative tests so that this bug doesn't recur.

Reported-by: Tomer Pearl <Tomer.Pearl@Contextream.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agodpif-netlink: Add support for packet receive on Windows.
Nithin Raju [Thu, 23 Oct 2014 15:27:34 +0000 (08:27 -0700)]
dpif-netlink: Add support for packet receive on Windows.

In this patch, we add support in dpif-netlink.c to receive packets on
Windows. Windows does not natively support epoll(). Even though there
are mechanisms/interfaces that provide functionality similar to epoll(),
we take a simple approach of using a pool of sockets.

Here are some details of the implementaion to aid review:
1. There's pool of sockets per upcall handler.
2. The pool of sockets is initialized while setting up the handler in
dpif_netlink_refresh_channels() primarily.
3. When sockets are to be allocated for a vport, we walk through the
pool of sockets for all handlers and pick one of the sockets in each of
the pool. Within a handler's pool, sockets are picked in a round-robin
fashion.
4. We currently support only 1 handler, since there are some kernel
changes needed for support more than 1 handler per vport.
5. The pool size is also set to 1 currently.

The restructions imposed by #4 and #5 can be removed in the future
without much code churn.

Validation:
1. With a hacked up kernel which figures out the netlink socket that is
designated to receive packets, we are cable to perform pings between 2
VMs on the same Hyper-V host.
2. Compiled the code in Linux as well.
3. Tested with pool size == 2 as well, though in this patch we set the
pool size = 1.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonetlink-socket: Add packet subscribe functionality on Windows.
Nithin Raju [Thu, 23 Oct 2014 15:27:33 +0000 (08:27 -0700)]
netlink-socket: Add packet subscribe functionality on Windows.

In this patch, we add support in userspace for packet subscribe API
similar to the join/leave MC group API that is used for port events.
The kernel code has already been commited.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agostream-tcp: Call setsockopt TCP_NODELAY after TCP is connected.
Gurucharan Shetty [Wed, 22 Oct 2014 22:35:18 +0000 (15:35 -0700)]
stream-tcp: Call setsockopt TCP_NODELAY after TCP is connected.

On Windows platform, TCP_NODELAY can only be set when TCP is established.
(This is an observed behavior and not written in any MSDN documentation.)
The current code does not create any problems while running unit tests
(because connections get established immediately) but is reportedly
observed while connecting to a different machine.

commit 8b76839(Move setsockopt TCP_NODELAY to when TCP is connected.)
made changes to call setsockopt with TCP_NODELAY after TCP is connected
only in lib/stream-ssl.c. We need the same change for stream-tcp too and
this commit does that.

Currently, a failure of setting TCP_NODELAY results in reporting
the error and then closing the socket. This commit changes that
behavior such that an error is reported if setting TCP_NODELAY
fails, but the connection itself is not torn down.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Fixes during integration testing.
Ankur Sharma [Wed, 22 Oct 2014 00:24:40 +0000 (17:24 -0700)]
datapath-windows: Fixes during integration testing.

Signed-off-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 agodatapath-windows: Calling OvsAddPidInstance and OvsDelPidInstance
Ankur Sharma [Wed, 22 Oct 2014 00:24:37 +0000 (17:24 -0700)]
datapath-windows: Calling OvsAddPidInstance and OvsDelPidInstance

Signed-off-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 agodatapath-windows: pid-instance hash table data structure.
Ankur Sharma [Wed, 22 Oct 2014 00:24:35 +0000 (17:24 -0700)]
datapath-windows: pid-instance hash table data structure.

This patch introduces data structure for holding instances hashed by pid.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
cked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agostream-tcp, stream-ssl: Remove unneeded getsockname() calls.
Ben Pfaff [Wed, 22 Oct 2014 23:05:35 +0000 (16:05 -0700)]
stream-tcp, stream-ssl: Remove unneeded getsockname() calls.

Commit a8d819675f3 (Remove stream, vconn, and rconn functions to get
local/remote IPs/ports.) removed the code that used the local socket
address but neglected to remove the code to fetch that address.  This
commit removes the latter code also.

Reported-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
9 years agotunnel: Add to nw_tos bits instead of replacing them in tnl_port_send().
Ben Pfaff [Wed, 22 Oct 2014 21:57:39 +0000 (14:57 -0700)]
tunnel: Add to nw_tos bits instead of replacing them in tnl_port_send().

We normally only add 1-bits to wc->masks for datapath flow matching
purposes, never removing them.  In this case, the bits that get set to
zero will be set back to 1 later on in the function, so this does not fix
any actual bug, but the principle of only setting to 1, not to 0, seems
sound to me.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agonetlink-socket: Use poll_immediate_wake() on Windows.
Nithin Raju [Tue, 21 Oct 2014 23:10:38 +0000 (16:10 -0700)]
netlink-socket: Use poll_immediate_wake() on Windows.

We have not yet tested the wakup via pending IRP functionality on
Windows yet. Hence we use poll_immediate_wake().

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
9 years agodatapath-windows: Return success when duplicate flow is added.
Nithin Raju [Tue, 21 Oct 2014 23:10:36 +0000 (16:10 -0700)]
datapath-windows: Return success when duplicate flow is added.

If we are trying to insert a flow while there's already a key with the
same flow, return success instead of failure. It can be argued that we
should probably return a transactional error EEXIST, but we'll handle
this in a subsequent commit. I've added a comment to address this later.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
9 years agoUse magic ETH_ADDR_LEN instead of 6 for Ethernet address length.
Wang Sheng-Hui [Wed, 22 Oct 2014 06:58:43 +0000 (14:58 +0800)]
Use magic ETH_ADDR_LEN instead of 6 for Ethernet address length.

ETH_ADDR_LEN is defined in lib/packets.h, valued 6.
Use this macro instead of magic number 6 to represent the length
of eth mac address.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: net: make skb_gso_segment error handling more robust
Pravin B Shelar [Tue, 21 Oct 2014 21:10:41 +0000 (14:10 -0700)]
datapath: net: make skb_gso_segment error handling more robust

skb_gso_segment has three possible return values:
1. a pointer to the first segmented skb
2. an errno value (IS_ERR())
3. NULL.  This can happen when GSO is used for header verification.

However, several callers currently test IS_ERR instead of IS_ERR_OR_NULL
and would oops when NULL is returned.

Note that these call sites should never actually see such a NULL return
value; all callers mask out the GSO bits in the feature argument.

However, there have been issues with some protocol handlers erronously not
respecting the specified feature mask in some cases.

It is preferable to get 'have to turn off hw offloading, else slow' reports
rather than 'kernel crashes'.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agonetlink-socket: Fix nl_sock_recv__() on Windows.
Nithin Raju [Sat, 18 Oct 2014 18:39:38 +0000 (11:39 -0700)]
netlink-socket: Fix nl_sock_recv__() on Windows.

In nl_sock_recv__() on Windows, we realloc a new ofpbuf to copy received
data if the caller specified buffer is small. While we do so, we need
reset some of the other stack variables to point to the new ofpbuf.

Other fixes are around using 'error' rather than 'errno'.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Fixes in packet created for userspace
Nithin Raju [Sat, 18 Oct 2014 18:39:37 +0000 (11:39 -0700)]
datapath-windows: Fixes in packet created for userspace

A couple of miscellaneous fixes in code that creates a packet for
userspace as well as when we copy the packet to memory specified by
userspace.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Fix key parsing in Flow.c.
Nithin Raju [Sat, 18 Oct 2014 18:39:36 +0000 (11:39 -0700)]
datapath-windows: Fix key parsing in Flow.c.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: event read should not fail when no events
Nithin Raju [Sat, 18 Oct 2014 18:39:35 +0000 (11:39 -0700)]
datapath-windows: event read should not fail when no events

The semantics are read operation are generally to return 0 bytes and
STATUS_SUCCESS when there are no events.

Also, added a fix to assign the PID to the synthetic OVS_MESSAGE formed
for the command validation.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif: Fix crash in format_odp_actions() due to NULL actions.
Madhu Challa [Sat, 18 Oct 2014 20:18:01 +0000 (13:18 -0700)]
dpif: Fix crash in format_odp_actions() due to NULL actions.

When flow_get fails (in this case flow does not exist) simply log
the key part of the get and erase the rest of the flow because it
is invalid.

Verified the fix by doing ovs-ofctl del-flows when traffic is running.

2014-10-18T20:12:13.785Z|00011|dpif(revalidator20)|WARN|system@ovs-system: failed to flow_get (No such file or directory) dp_hash(0),recirc_id(0),skb_priority(0),in_port(2),skb_mark(0),eth(src=00:13:72:0b:52:fa,dst=00:14:72:0b:52:fa),eth_type(0x0800),ipv4(src=10.0.0.164,dst=11.0.0.164,proto=6,tos=0,ttl=4,frag=no),tcp(src=1651,dst=6095),tcp_flags(ack), packets:0, bytes:0, used:never

Signed-off-by: Madhu Challa <challa@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Implement missed packet kernel-to-user mode notification.
Eitan Eliahu [Tue, 21 Oct 2014 01:23:00 +0000 (18:23 -0700)]
datapath-windows: Implement missed packet kernel-to-user mode notification.

An I/O request is queued in Kernel to be completed upon a packet mismatch.
This mechanism is similar to the port state notification.
Access to instance data should be under a lock (TBD)

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
9 years agostream-fd: Merge stream-fd-windows and stream-fd-unix.
Gurucharan Shetty [Fri, 17 Oct 2014 17:02:45 +0000 (10:02 -0700)]
stream-fd: Merge stream-fd-windows and stream-fd-unix.

There was not much difference between the two files after moving
all of the Windows socket HANDLE polling functionality to poll-loop.c.
So merge them together.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoMakefile.am: Properly indent INSTALL.DPDK
Thomas Graf [Mon, 20 Oct 2014 17:23:19 +0000 (19:23 +0200)]
Makefile.am: Properly indent INSTALL.DPDK

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoINSTALL.DPDK: improve documentation
Daniele Di Proietto [Fri, 17 Oct 2014 23:29:57 +0000 (16:29 -0700)]
INSTALL.DPDK: improve documentation

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agonetdev-dpdk: Move to DPDK 1.7.1
maryam.tahhan [Mon, 13 Oct 2014 14:17:09 +0000 (15:17 +0100)]
netdev-dpdk: Move to DPDK 1.7.1

This patch updates the documentation to reflect that DPDK 1.7.1
is supported. Travis scripts have also been updated to reflect
this. DPDK phy and ring ports were validated against DPDK 1.7.1.

Reviewed-by: Mark D. Gray <mark.d.gray@intel.com>
Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Acked-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agolib/dpif-netdev: Fix EMC lookup.
Jarno Rajahalme [Sat, 18 Oct 2014 00:03:13 +0000 (17:03 -0700)]
lib/dpif-netdev: Fix EMC lookup.

Patch 0de8783a9 (lib/dpif-netdev: Integrate megaflow classifier.)
broke exact match cache lookup, but it went undetected since there are
no separate stats for EMC.

This patch fixes the problem by changing the struct netdev_flow_key
'len' member to cover only the 'mf' member, not the whole
netdev_flow_key, and ignoring the 'len' field in
netdev_flow_key_equal.  Comparison is still accurate, as the miniflow
'map' field encodes the length in the number of 1-bits, and the map is
included in the comparison.

Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Di Proietto <ddiproietto@vmware.com>
9 years agodatapath: fix a use after free
Li RongQing [Fri, 17 Oct 2014 13:37:51 +0000 (06:37 -0700)]
datapath: fix a use after free

pskb_may_pull() called by arphdr_ok can change skb->data, so put the arp
setting after arphdr_ok to avoid the use the freed memory

Fixes: 0714812134d7d ("openvswitch: Eliminate memset() from flow_extract.")
Cc: Jesse Gross <jesse@nicira.com>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath: use vport instead of p
Fabian Frederick [Fri, 17 Oct 2014 13:25:20 +0000 (06:25 -0700)]
datapath: use vport instead of p

All functions used struct vport *vport except
ovs_vport_find_upcall_portid.

This fixes 1 kerneldoc warning

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agodatapath-windows: netdev-windows fixes for vswitchd bringup.
Ankur Sharma [Fri, 17 Oct 2014 18:12:32 +0000 (11:12 -0700)]
datapath-windows: netdev-windows fixes for vswitchd bringup.

Added the handlers for update_flags and set_etheraddr.
These handlers were needed for vswitchd bringup on windows
platform.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Packet subscribe handler
Eitan Eliahu [Fri, 17 Oct 2014 06:45:42 +0000 (23:45 -0700)]
datapath-windows: Packet subscribe handler

This change includes the following:
[1] Handler for subscribe/unsubscribe to a packet queue associated with a
    socket pid.
[2] Allocation of per socket packet queue on a packet subscription.
[3] Removal of static allocated queues.
[4] Freeing the packet queue (on user mode process termination).

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoxenserver: Add ovs-docker to the spec file.
Gurucharan Shetty [Fri, 17 Oct 2014 00:49:01 +0000 (17:49 -0700)]
xenserver: Add ovs-docker to the spec file.

Fixes a rpmbuild failure.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/dpif-netdev: Integrate megaflow classifier.
Jarno Rajahalme [Fri, 17 Oct 2014 16:37:11 +0000 (09:37 -0700)]
lib/dpif-netdev: Integrate megaflow classifier.

Megaflow inserts and removals are simplified:

- No need for classifier internal mutex, as dpif-netdev already has a
  'flow_mutex'.
- Number of memory allocations/frees can be halved.
- Lookup code path can rely on netdev_flow_key always having inline data.

This will also be easier to simplify further when moving to per-thread
megaflow classifiers in the future.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agoAUTHORS: Add Dongdong and Chunhe Li.
Ben Pfaff [Fri, 17 Oct 2014 15:39:51 +0000 (08:39 -0700)]
AUTHORS: Add Dongdong and Chunhe Li.

Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agorhel: Change service providers to 'openvswitch'.
Dongdong [Wed, 15 Oct 2014 02:00:29 +0000 (10:00 +0800)]
rhel: Change service providers to 'openvswitch'.

In Red Hat, the service name is "openvswitch", providers also should
be change to "openvswitch"

Signed-off-by: Dongdong <dongdong1@huawei.com>
Acked-by: Chunhe Li <lichunhe@huawei.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Add packet miss read Netlink command.
Eitan Eliahu [Fri, 17 Oct 2014 00:53:27 +0000 (17:53 -0700)]
datapath-windows: Add packet miss read Netlink command.

The change include the Packet Read handler.
The current implementation reads once packet at a time. This should be updated
once user mode code is in place.

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Co-authored-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto-dpif-xlate: Support BFD, CFM, carrier, and LACP for port liveness.
Ben Pfaff [Thu, 16 Oct 2014 22:00:03 +0000 (15:00 -0700)]
ofproto-dpif-xlate: Support BFD, CFM, carrier, and LACP for port liveness.

This is simpler and shorter than handling each of these by itself.

CC: Niels van Adrichem <N.L.M.vanAdrichem@tudelft.nl>
Suggested-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agodocker: Integrate docker containers with Open vSwitch.
Gurucharan Shetty [Tue, 14 Oct 2014 07:51:52 +0000 (00:51 -0700)]
docker: Integrate docker containers with Open vSwitch.

Open vSwitch does not have native integration with Docker.
INSTALL.Docker explains how Open vSwitch can be integrated
with docker non-natively.

ovs-docker is a helper script to add network interfaces to
docker containers and to attach them as ports to OVS bridge.
This script can be further enhanced as we understand different
use cases.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Fix compilation error in release build.
Eitan Eliahu [Fri, 17 Oct 2014 01:03:37 +0000 (18:03 -0700)]
datapath-windows: Fix compilation error in release build.

portNameLen to be used only in debug build.

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto-dpif-xlate: Use bfd forwarding status in fast-failover groups.
Niels van Adrichem [Wed, 15 Oct 2014 13:54:52 +0000 (13:54 +0000)]
ofproto-dpif-xlate: Use bfd forwarding status in fast-failover groups.

Integration of each interface' status as confirmed by BFD into the
FastFailover Group table. When BFD is configured and function
bfd_forwarding() reports false, odp_port_is_alive also reports false in
order to have a watched interface report false and omit to another
backup.

Test-suite has been succesfully run, as well as testing with ICMP echo
requests and replies that traffic was succesfully rerouted over the
backup path. More extensive load-consumption tests with a function that
only checked whether (bfd->state == STATE_UP) have been succesfully
performed, but was later changed to use the larger function
bfd_forwarding() as it captures all possible exceptions and is properly
mutually excluded.

Signed-off-by: Niels van Adrichem <n.l.m.vanadrichem@tudelft.nl>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Fixes in OvsSetVportCmdHandler()
Nithin Raju [Thu, 16 Oct 2014 00:27:14 +0000 (17:27 -0700)]
datapath-windows: Fixes in OvsSetVportCmdHandler()

In this patch, we make a few simple fixes based on reviewing the code.
The code as such is not tested. We'll be hitting the code path soon
and might make more fixes at that time.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Add netlink command vport set
Nithin Raju [Thu, 16 Oct 2014 00:27:13 +0000 (17:27 -0700)]
datapath-windows: Add netlink command vport set

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Action not supported error handling
Ankur Sharma [Wed, 15 Oct 2014 22:54:54 +0000 (15:54 -0700)]
datapath-windows: Action not supported error handling

Added changes to support error handling for non supported actions.
Added changes in packet execute for sending transactional errors.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: OVS_PACKET_CMD_EXECUTE handler.
Ankur Sharma [Wed, 15 Oct 2014 22:54:53 +0000 (15:54 -0700)]
datapath-windows: OVS_PACKET_CMD_EXECUTE handler.

In this patch we have implemented the handler for OVS_PACKET_CMD_EXECUTE command.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-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: changes to existing PACKET_CMD handler.
Ankur Sharma [Wed, 15 Oct 2014 22:54:52 +0000 (15:54 -0700)]
datapath-windows: changes to existing PACKET_CMD handler.

In this patch we have made following changes:

OvsPacketExecute =>
Changed the data structure to have packet and
actions as pointer (instead of zero length array). It is done because
we will not do memcpy of packet now, pointer will just point
to corresponding offset in input buffer.

OvsExecuteDpIoctl =>
We only need input buffer now. Hence Changed the function signature.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-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: OVS_PACKET_CMD_EXECUTE command handler.
Ankur Sharma [Wed, 15 Oct 2014 22:54:51 +0000 (15:54 -0700)]
datapath-windows: OVS_PACKET_CMD_EXECUTE command handler.

In this patch we cover the basic registeration of OVS_PACKET_CMD_EXECUTE
command handler.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-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: Making Flow parsing policies global.
Ankur Sharma [Wed, 15 Oct 2014 22:54:50 +0000 (15:54 -0700)]
datapath-windows: Making Flow parsing policies global.

In this patch we have made the Flow parsing policies global.
Pakcet execute handling requires these policies.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-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: Transactional error fix for flow dump.
Ankur Sharma [Tue, 14 Oct 2014 23:02:20 +0000 (16:02 -0700)]
datapath-windows: Transactional error fix for flow dump.

My changes for trasacation error handling for not needed for dump commands.
Fixed the same.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-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: Upcall NL packet format: Call NL missed packet function
Eitan Eliahu [Wed, 15 Oct 2014 09:15:43 +0000 (02:15 -0700)]
datapath-windows: Upcall NL packet format: Call NL missed packet function

Remove hard coded queue is, pass the key rather the tunnel key,
Remove the none NL implementation

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Upcall NL packet format: Queue elem for packe in NL format.
Eitan Eliahu [Wed, 15 Oct 2014 09:14:03 +0000 (02:14 -0700)]
datapath-windows: Upcall NL packet format: Queue elem for packe in NL format.

[1] Allocate a queue element and space to hold the packet, key, tunnel key
and user data in NL format.
[2] Format the NL header
[3] Store packet, key, tunnel key and user data in NL format
[4] Calculates and insert checksum if offloaded.

signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Upcall NL packet format: Parametrized Key to NL conversion.
Eitan Eliahu [Wed, 15 Oct 2014 09:13:10 +0000 (02:13 -0700)]
datapath-windows: Upcall NL packet format: Parametrized Key to NL conversion.

Extend the key and tunnel key conversion to nested NL format functions use the
NL attribute as a parameter so we can use them for missed packet formatting.

Add functions for calculating the space needed for storing the key and the
tunnel key in NL format

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Upcall NL packet format: Add NL utilities
Eitan Eliahu [Wed, 15 Oct 2014 09:11:40 +0000 (02:11 -0700)]
datapath-windows: Upcall NL packet format: Add NL utilities

Add NlAttrSize and NlAttrTotalSize

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoRevert "lib/classifier: Minimize critical section."
Jarno Rajahalme [Wed, 15 Oct 2014 17:56:32 +0000 (10:56 -0700)]
Revert "lib/classifier: Minimize critical section."

This reverts commit d2064437e2bf91859a0a50fba30dcabba668a811, which
fails clang thread satefy analysis.

A more complete patch will be introduced later.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agolib/classifier: Minimize critical section.
Jarno Rajahalme [Tue, 14 Oct 2014 20:31:48 +0000 (13:31 -0700)]
lib/classifier: Minimize critical section.

classifier_find_rule_exactly() only needs the mutex to protect the
list traversal.  Subtables are already RCU protected.

Locking here can be eliminated completely when RCU list is available.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Fix CtrlLock acquire issue in OvsReadEventCmdHandler
Ankur Sharma [Tue, 14 Oct 2014 17:16:00 +0000 (10:16 -0700)]
datapath-windows: Fix CtrlLock acquire issue in OvsReadEventCmdHandler

OvsReadEventCmdHandler was calling OvsRemoveEventEntry after acquiring
CtrlLock. OvsRemoveEventEntry in turn also tries to acquire the same lock.

Added a new lock in Event.c for the eventQueue.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonicira-ext.h: Update comments
YAMAMOTO Takashi [Tue, 14 Oct 2014 03:29:45 +0000 (12:29 +0900)]
nicira-ext.h: Update comments

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-vtep: Add support for bfd tunnels.
Gurucharan Shetty [Wed, 30 Jul 2014 16:11:43 +0000 (09:11 -0700)]
ovs-vtep: Add support for bfd tunnels.

The VTEP emulator creates one OVS bridge for every logical switch and then
programs flow in it based on learned local macs and controller programmed
remote macs.

Multiple logical switches can have multiple OVS tunnels to the
same remote machine (with different tunnel ids). But VTEP schema expects
a single BFD session between two physical locators. Therefore
create a separate bridge ('bfd_bridge') and create a single OVS tunnel
between two physical locators (using reference counter).

The creation of BFD tunnels by the VTEP emulator is mostly for reporting
purposes. That is, it can be used by the controller to figure out that
a remote port is down. The emulator itself does not base any of its
forwarding decisions based on the state of a bfd tunnel.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ariel Tubaltsev <atubaltsev@vmware.com>
9 years agodatapath-windows: Fix assertion in Netlink.c
Ankur Sharma [Sat, 11 Oct 2014 22:07:41 +0000 (15:07 -0700)]
datapath-windows: Fix assertion in Netlink.c

NlBufAt should be called with valid boundary limits (within head and tail).
Incorrect argument to NlBufAt was leading to assert hit, fixed the same.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Remove invalid assertion.
Ankur Sharma [Sat, 11 Oct 2014 22:07:40 +0000 (15:07 -0700)]
datapath-windows: Remove invalid assertion.

Assert(rc) would always hit for a valid case, hence
replaced it with error code based check.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Remove setting of replyLen to zero.
Ankur Sharma [Sat, 11 Oct 2014 22:07:39 +0000 (15:07 -0700)]
datapath-windows: Remove setting of replyLen to zero.

This was one of the review comment which i forgot to address in
FLOW_DUMP checkin. We do not need to explicitly set replyLen to zero
 as caller would have already set it.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Reply for Flow Flush.
Ankur Sharma [Sat, 11 Oct 2014 22:07:38 +0000 (15:07 -0700)]
datapath-windows: Reply for Flow Flush.

Added changes to send a reply for FLOW_FUSH case. This is needed
as with nithin's transaction reply changes we'll need reply for each
command.

This patch also contains minor fixes for sending replies in
success case as well.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Validate ETHERTYPE and ETHERNET attribute.
Ankur Sharma [Sat, 11 Oct 2014 22:07:37 +0000 (15:07 -0700)]
datapath-windows: Validate ETHERTYPE and ETHERNET attribute.

During vswitchd boot up kernel is receiving FLOW_ADD commands
without ETHERTYPE attribute. Added additional check for the same
in this patch. During the same phase kernel is also receiving
packet_execute with no ETHERNET attribute.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Transactional error support in Flow commands.
Ankur Sharma [Sat, 11 Oct 2014 22:07:36 +0000 (15:07 -0700)]
datapath-windows: Transactional error support in Flow commands.

In this patch we added the code to handle transactional errors
in flow commands.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: loop iterator fixes in Vport.c
Nithin Raju [Mon, 13 Oct 2014 03:56:19 +0000 (20:56 -0700)]
datapath-windows: loop iterator fixes in Vport.c

Validation:
- With these fixes, we no longer see the freeze during module
uninstallation or when we try to add a new port.
- We are able to add a port called "internal of type internal using:
ovs-dpctl.exe add-if ovs-system internal,type=internal

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: delete ports from portIdHashArray during cleanup
Nithin Raju [Mon, 13 Oct 2014 03:56:18 +0000 (20:56 -0700)]
datapath-windows: delete ports from portIdHashArray during cleanup

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: pass NDIS_RWL_AT_DISPATCH_LEVEL instead of BOOLEAN
Nithin Raju [Mon, 13 Oct 2014 03:56:17 +0000 (20:56 -0700)]
datapath-windows: pass NDIS_RWL_AT_DISPATCH_LEVEL instead of BOOLEAN

In 'OvsAcquireDatapathRead()' and 'OvsAcquireDatapathWrite()', we seem
to be passing a BOLEAN instead of NDIS_RWL_AT_DISPATCH_LEVEL.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: remove vport from lists upon deletion
Nithin Raju [Mon, 13 Oct 2014 03:56:16 +0000 (20:56 -0700)]
datapath-windows: remove vport from lists upon deletion

In this patch, we fix a bug in the vport delete code. When a vport is
deleted using a netlink command, we need to remove it from the
'ovsNamHashArray' and the 'portNoHashArray' as well. Addition of a vport
adds the port to the lists.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Add netlink command vport delete
Nithin Raju [Mon, 13 Oct 2014 03:56:15 +0000 (20:56 -0700)]
datapath-windows: Add netlink command vport delete

Deletion of a vport is now handled both by the netlink command vport
delete and the hyper-v switch port delete handler. If a netlink
command vport delete is requested on a vport that has no hyper-v
switch port counterpart (i.e., it is a tunnel port, or or the hyper-v
switch virtual nic is disconnected), the vport is deleted and removed.

If the hyper-v switch port delete is requested (i.e. the VNic is
disconnecting) and the ovs (datapath) part is deleted (i.e. was
deleted by netlink command vport delete, or was never created by
an netlink command vport new), then the hyper-v switch port delete
function handler deletes and removes the vport.

If the hyper-v switch port delete is requested while its datapath
counterpart is still alive, or, when the netlink command vport delete
is requested while the hyper-v switch port is still alive, the port
is only marked that it's part is deleted - the field hvDeleted was
added to OVS_VPORT_ENTRY to specify if the hyper-v switch port side
was deleted; if the ovs (datapath) port number is invalid, then it
means that the ovs (datapath) side of the port is deleted (or, not
created).

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Add netlink command: vport new
Nithin Raju [Mon, 13 Oct 2014 03:56:14 +0000 (20:56 -0700)]
datapath-windows: Add netlink command: vport new

Does the following:
a. before creating the vport, makes sure there is no existing vport
with the same ovs (datapath) port name. If this is not so, it means
that the specified port already exists: it returns NL_ERROR_EXIST.
b. looks up the vport:
  o) if the vport type is "internal", then the internal vport of the
  hyper-v switch is yielded.
  o) if the vport type is "netdev" and the vport ovs (datapath) name
  is "external", then the external vport is yielded. The switch can
  have only one "external" vport. The method of looking up the
  "external" port can be changed later, if a better method is found.
  o) if the vport type is "netdev" but the name is not "external",
  then a VM VNic is assumed, so the vport is looked up by hyper-v
  switch port friendly name.
  o) if none of the above, a tunneling vport type is expected, which
  in our case, at the moment, can only be the one vxlan vport. Only
  one vxlan vport is allowed, and it's saved in
  switchContext->vxlanVport. The tunneling vport is the only kind
  which is created in the netlink command vport new, because it does
  not have a hyper-v switch port counterpart.
c. if the vport could not be found (non-tunneling vports), then the
NL_ERROR_INVAL is returned to the userspace.
d. if the vport was found, but it has a valid ovs (datapath) port
number, it means that this port was already created by a netlink
command vport new. Therefore, NL_ERROR_EXIST is returned to the
userspace.
e. if the netlink command vport new specified an ovs (datapath) port
number, then it means that the userspace is trying to re-create a
vport: that specified port number will be used. Otherwise, a new
ovs (datapath) port number is computed and assigned to the vport.
f. the ovsName field of the vport is set to the name given by the
OVS_VPORT_ATTR_NAME netlink attribute. The ovsNameLen is no longer
stored in the OVS_VPORT_ENTRY struct, because ovsName is
null-terminated.
g. the "portOptions" are set to the vport, if the attribute
OVS_VPORT_ATTR_OPTIONS was given. Otherwise, it is set to NULL.
portOptions is a PNL_ATTR, which is yet to be implemented. The
only option available for now would be vxlan udp destination port,
but we have a constant value there, so this option is not yet needed.
h. the upcall pid is set to the vport.
i. if the vport type is vxlan, then the vport pointer is also saved
to switchContext->vxlanVport.
j. Now that the ovs (datapath) port number and the ovs name were set,
the vport can be added to the hash array of vports, hashed on ovs name
and to the hash array of vports hashed by ovs (datapath) port number.
k. the reply is yielded to the userspace.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonetlink-socket: Always pass the output buffer in a transaction.
Nithin Raju [Tue, 7 Oct 2014 22:08:53 +0000 (15:08 -0700)]
netlink-socket: Always pass the output buffer in a transaction.

We need to pass down the output buffer so that the kernel can return
transaction status - error or otherwise.

Also, we were processing the output buffer only when when
'txn->reply != NULL' ie when the caller specified an ofpbuf for the
reply. In this patch, the code has been updated to process the reply
unconditionally, but making sure to copy the reply to the 'txn->reply'
only when it is not NULL. The reason for the unconditional processing is
we can pass up transactional errors in 'txn->error'. Otherwise, it
results in an endless loop of calling nl_transact().

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
9 years agodatapath: compat: Fix compilation 3.11
Pravin B Shelar [Fri, 10 Oct 2014 15:21:18 +0000 (08:21 -0700)]
datapath: compat: Fix compilation 3.11

Kernel 3.11 is only kernel where GRE APIs are available but
not vxlan. Add check for vxlan xmit to detect this case.

Reported-by: Dave Benson <dbenson@verdantnetworks.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agoofproto-dpif-upcall: Fix out-of-scope use of stack memory.
Alex Wang [Fri, 10 Oct 2014 21:41:10 +0000 (14:41 -0700)]
ofproto-dpif-upcall: Fix out-of-scope use of stack memory.

Commit cc377352d (ofproto: Reorganize in preparation for direct
dpdk upcalls.) introduced the bug that keeps reference to 'struct
flow' defined on the stack inside while loop when running out of
the scope.  This causes strange bug like wrong mask extraction
when the part of memory is corrupted, and could lead to even
more serious bug/crash.

This commit fixes the above issue by defining an array of the
'struct flow's on the function stack.

Found by running ovs on RHEL7.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovsdb: bond_active_salve column's value should be durable when database restarts
Andy Zhou [Fri, 10 Oct 2014 21:20:36 +0000 (14:20 -0700)]
ovsdb: bond_active_salve column's value should be durable when database restarts

According to RFC 7047, 'ephemeral' annotation does not guarantee
the values to be durable. This fix Removes this annotation.

VMware-BZ:  1332235

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agolib/classifier: Make classifier_remove() more robust.
Jarno Rajahalme [Fri, 10 Oct 2014 22:38:57 +0000 (15:38 -0700)]
lib/classifier: Make classifier_remove() more robust.

classifier already provides lockless lookups, and protected
modifications.  When user wants to remove a flow, we currently require
the flow to exist in the classifier.  To be thread safe, this requires
the caller to introduce their own mutex, lock it before a lookup, and
then issue classifier_remove() while the lock is still held.

This patch relaxes the "existence requirement" of the rule in
classifier_remove(), allowing it to be called on a rule that may have
already been removed from the classifier.  This allows users to do a
classifier_lookup() and classifier_remove() without additional
syncronization.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoconfigure: Also check for Python 2.x installed as python2.7.
Dmitry Krivenok [Fri, 10 Oct 2014 04:56:22 +0000 (08:56 +0400)]
configure: Also check for Python 2.x installed as python2.7.

On ArchLinux "python" points to 3.x version and the right
2.x python binary is "python2.7".

Signed-off-by: Dmitry V. Krivenok <krivenok.dmitry@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Add port friendly name to OVS_VPORT_ENTRY
Alin Serdean [Thu, 9 Oct 2014 17:46:58 +0000 (17:46 +0000)]
datapath-windows: Add port friendly name to OVS_VPORT_ENTRY

The port friendly name will be set by WMI / powershell script.
It will be used from within the netlink command vport new to
identify the hyper-v switch port it represents.

This patch also adds a function to lookup a vport by the
port friendly name.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Make VPORT ovs number values smaller than MAXUINT16
Alin Serdean [Thu, 9 Oct 2014 17:46:57 +0000 (17:46 +0000)]
datapath-windows: Make VPORT ovs number values smaller than MAXUINT16

For this, the old method of finding vports based on the
ovs port numbers is removed. Now, the lookup of a vport
by ovs port number is done the same way as the lookup by
hyper-v switch port id.

This is done so that the kernel is able to interact with
the userspace correctly when using vport channels.
The problem manifested in lib/dpif-netlink.c, at the function
vport_add_channels.

This patch removes the field vportArray from OVS_SWITCH_CONTEXT.
In its place, portNoHashArray is set. In the OVS_VPORT_ENTRY
struct, we also add portNoLink. This new method will do lookup
and insertions of vports by ovs (datapath) port numbers the same
way it is done for hyper-v switch port ids.

This patch implicitly removes the indexes, which were previously
used in insertions and lookups on ovs port numbers. The removal
of the index also means that the vxlan vport can no longer be
looked up the same way as it was done before: now we hold a pointer
to it, vxlanVport in OVS_SWITCH_CONTEXT. For the moment, we can
have only one vxlan vport. When more will be allowed, this field
will turn into a list of vxlan ports.

The invalid port number value (held in OVS_DPPORT_NUMBER_INVALID)
is now changed from 0 to MAXUINT16, the same as it is on linux.

The function OvsComputeVportNo has also been removed, since the
computation of a vport port number can no longer be done like this.
When vport add will be added, a new, updated OvsComputeVportNo
function will be added.

Also, in OvsInitVportCommon, we no longer need to (and no longer can)
initialize vport->ovsName, nor vport->ovsNameLen, because they will
be initialized by the netlink command vport add. Since the netlink
command vport add will generate numbers for the datapath (ovs) port
numbers and set the port names, we cannot insert the vport into the
hash array of port numbers here, nor into the hash array of port names.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Rename switch context's portHashArray and vport's portLink
Alin Serdean [Thu, 9 Oct 2014 17:46:57 +0000 (17:46 +0000)]
datapath-windows: Rename switch context's portHashArray and vport's portLink

The field portLink of the OVS_VPORT_ENTRY is the link within the
OVS_SWITCH_CONTEXT's hash array of vports portHashArray, hashed by the
portId field of the OVS_VPORT_ENTRY.

Later on, we will need to modify the OVS_VPORT_ENTRY so that its port
numbers are set to maximum MAXUINT16. This will require that the field
vportArray of OVS_SWITCH_CONTEXT be removed and replaced with a hash
array, portNoHashArray. Also, a new field, portNoLink, will need to be
added to OVS_VPORT_ENTRY. In order to differentiate between portHashArray
and portNoHashArray, portHashArray is renamed to portIdHashArray. Also,
in order to differentiate between portLink and portNoLink, portLink
is renamed to portIdLink.

In a future patch the vport functionality will be changed to constraint
the port numbers to MAXUINT16.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Rename switch context's nameHashArray and vport's nameLink login...
Alin Serdean [Thu, 9 Oct 2014 17:46:56 +0000 (17:46 +0000)]
datapath-windows: Rename switch context's nameHashArray and vport's nameLink login register

The field nameLink of the OVS_VPORT_ENTRY is the link within the
OVS_SWITCH_CONTEXT's hash array of vports nameHashArray, hashed by the
ovsName field of the OVS_VPORT_ENTRY.

Later on, the friendly name of the hyper-v switch port will need to be
set from userspace using WMI. This will require that the hyper-v switch
port friendly name be set to the exact string value as the ovs
(datapath) port name set from netlink command vport add.

The vport will need to differentiate between the ovs (datapath) port
name and hyper-v switch port friendly name, because they may differ in
erroneous scenarios, or state differences between the hyper-v switch
port and the ovs (datapath) port. This may happen if the vport was
created by the netlink command vport add, but the VM disconnected (i.e.
the hyper-v switch port was later deleted).

Storing another field in vport, "portFriendlyName" would normally
make the current switchContext->nameHashArray and vport->nameLink
confusing since the "name"-s may be understood to mean the hyper-v
switch port friendly name, or the hyper-v switch port name, when it
actually refers to the ovs (datapath) port name.

Hence, the variable nameHashArray is renamed to ovsPortNameHashArray,
while the nameLink is renamed to ovsPortNameLink. This change will make
a clearer connection between these and the vport field "ovsName" to
which they revolve around.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Rename OvsGetVportNo into OvsComputeVportNo and make public
Alin Serdean [Thu, 9 Oct 2014 17:46:56 +0000 (17:46 +0000)]
datapath-windows: Rename OvsGetVportNo into OvsComputeVportNo and make public

OvsGetVportNo computes a new port number. Therefore, OvsComputeVportNo
is a more clear name for what the function does. Reading OvsGetVportNo
may give the false impression that it returns the port number of an
existing vport.

Also, since the responsibility of assigning dp port numbers no longer
falls on the hyper-v switch port handlers side, but on the netlink vport
commands side (vport add), we will need to use this compute port number
function from outside Vport.c. Therefore, this function declaration is
moved from Vport.c to Vport.h, and becomes public.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Define OVS_DPPORT_NUMBER_INVALID
Alin Serdean [Thu, 9 Oct 2014 17:46:55 +0000 (17:46 +0000)]
datapath-windows: Define OVS_DPPORT_NUMBER_INVALID

The fields externalVport and internalVport of the OVS_SWITCH_CONTEXT
struct are currently defined as PVOID. However, all over the code they
are used as POVS_VPORT_ENTRY. In order to improve clarity and reduce the
need for useless casts to POVS_VPORT_ENTRY, this patch changes the type
from PVOID to POVS_VPORT_ENTRY.

This patch does not cleanup the code that already uses casts to
POVS_VPORT_ENTRY. This cleanup can be done later on as well.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Update OVS_SWITCH_CONTEXT: external and internal port
Alin Serdean [Thu, 9 Oct 2014 17:46:55 +0000 (17:46 +0000)]
datapath-windows: Update OVS_SWITCH_CONTEXT: external and internal port

The fields externalVport and internalVport of the OVS_SWITCH_CONTEXT
struct are currently defined as PVOID. However, all over the code they
are used as POVS_VPORT_ENTRY. In order to improve clarity and reduce the
need for useless casts to POVS_VPORT_ENTRY, this patch changes the type
from PVOID to POVS_VPORT_ENTRY.

This patch does not cleanup the code that already uses casts to
POVS_VPORT_ENTRY. This cleanup can be done later on as well.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: We don't need to keep validation ports in ovs
Alin Serdean [Thu, 9 Oct 2014 17:46:55 +0000 (17:46 +0000)]
datapath-windows: We don't need to keep validation ports in ovs

Validation ports are used internally by the hyper-v switch to validate
and verify settings for the real hyper-v switch ports that will be
connected to the VNic. The validation ports are of no use to us - we
must skip handling them, and return STATUS_SUCCESS as the OID result.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Rename hyper-v switch port and nic handlers
Alin Serdean [Thu, 9 Oct 2014 17:46:54 +0000 (17:46 +0000)]
datapath-windows: Rename hyper-v switch port and nic handlers

Functions such as OvsCreatePort are vague in regard to who creates it or
when. It wasn't a problem thus far, since the vports were created,
updated and destroyed from one place only (hyper-v switch part). But
now, with the netlink implementation of the vport commands, a part of
the vport is constructed by the netlink vport add, and the other part
is constructed by the hyper-v switch nic and port handlers.

This patch renames the hyper-v switch nic and port handlers, so that
they are now prefixed by "Hv" instead of "Ovs", in order to clarify
which of the functions are nic or port handlers. This will make more
clear the usages from netlink vport commands side and from hyper-v
switch side. It will also make more obvious which nic and port
functions are helper functions.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Remove the old IOCTL vport functions.
Alin Serdean [Thu, 9 Oct 2014 17:46:54 +0000 (17:46 +0000)]
datapath-windows: Remove the old IOCTL vport functions.

The old IOCTL vport functions (using the non-netlink device) are no
longer needed. They should be removed.

Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoAUTHORS: Update my author entry.
Kyle Mestery [Wed, 8 Oct 2014 21:46:52 +0000 (21:46 +0000)]
AUTHORS: Update my author entry.

Update the email address for myself in the AUTHORS file.

Signed-off-by: Kyle Mestery <mestery@mestery.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonetdev-dpif: Add metadata to dpif-packet.
Pravin B Shelar [Sat, 4 Oct 2014 03:23:58 +0000 (20:23 -0700)]
netdev-dpif: Add metadata to dpif-packet.

Today dpif-netdev has single metadat for given batch, since one
batch belongs to one port, but soon packets fro single tunnel ports
can belong to different ports, so we need to have per packet metadata.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoovs-bugtool: Add fdb output for all bridges
Andy Zhou [Thu, 9 Oct 2014 00:15:42 +0000 (17:15 -0700)]
ovs-bugtool: Add fdb output for all bridges

Fdb entries can provide useful information. Collect them in bugtool.

Signed-off-by: Andy Zhou <azhou@nicira.com>
9 years agoovs-vswitchd: Fix high cpu utilization when acquire idl lock fails.
Alex Wang [Thu, 9 Oct 2014 08:23:37 +0000 (08:23 +0000)]
ovs-vswitchd: Fix high cpu utilization when acquire idl lock fails.

When ovs-vswitchd fails to acquire the ovsdb idl lock (either due to
contention or due to invalid database path), ovs-vswitchd will spin
on the global connectivity sequence number and consume 100% cpu.
This is in that the local copy is different to the global sequence
number and never updated when ovsdb idl is not locked.

To fix this issue, this commit makes ovs-vswitchd not checking the
global connectivity sequence number in that situation.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agorhel7: Fix rpm install failure.
Alex Wang [Thu, 9 Oct 2014 07:02:07 +0000 (00:02 -0700)]
rhel7: Fix rpm install failure.

When trying to install the kernel module rpm built for RHEL7,
the install failed with following conflicts:

  # rpm -i kmod-openvswitch-2.3.1-1.el7.x86_64.rpm
    file /lib/modules/3.10.0-123.8.1.el7.x86_64/modules.devname
    from install of kmod-openvswitch-2.3.1-1.el7.x86_64 conflicts
    with file from package kernel-3.10.0-123.8.1.el7.x86_64

    file /lib/modules/3.10.0-123.8.1.el7.x86_64/modules.softdep
    from install of kmod-openvswitch-2.3.1-1.el7.x86_64 conflicts
    with file from package kernel-3.10.0-123.8.1.el7.x86_64

Similar issue has already been reported and solved here:

    https://bugzilla.redhat.com/show_bug.cgi?id=1003267

This commit applies the solution in the link to ovs.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath-windows: Update OvsGetExtInfoIoctl() to the new vport add workflow
Nithin Raju [Tue, 7 Oct 2014 01:05:39 +0000 (18:05 -0700)]
datapath-windows: Update OvsGetExtInfoIoctl() to the new vport add workflow

I applied the patches for the new vport add workflow that is out for
review, and found that some of the existing code in OvsGetExtInfoIoctl()
needs to be updated. In this patch, we add a CPP called
USE_NEW_VPORT_ADD_WORKFLOW and add the fixes under
USE_NEW_VPORT_ADD_WORKFLOW == 1. The current value is set to 0, since
the vport add code is not checked in yet.

Sending out this patch to unblock the vport add code when it gets checked
in. There are other fixes also required, but they are being addressed as
part of the review comments for vport-add.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
9 years agodatapath-windows: Add support for OVS_DP_CMD_NEW Netlink command.
Nithin Raju [Wed, 8 Oct 2014 21:21:50 +0000 (14:21 -0700)]
datapath-windows: Add support for OVS_DP_CMD_NEW Netlink command.

In this change, we add support for the 'OVS_DP_CMD_NEW' netlink command
in the kernel. We don't really support creation of a new datapath. If
the name of the userspace is the same as the single datapath we support,
we return EEXIST.

This code is required to bootstrap ovs-vswitchd which makes the
following sequence of calls:
open_dpif_backer() -> dpif_create_and_open() -> dpif_create()

We also rename HandleDpTransaction() to HandleDpTransactionCommon().

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
9 years agounaligned: Make get_unaligned_be64() compatible on GCC and non-GCC.
Ben Pfaff [Thu, 9 Oct 2014 05:13:31 +0000 (22:13 -0700)]
unaligned: Make get_unaligned_be64() compatible on GCC and non-GCC.

Until now, with GCC, get_unaligned_be64() had an interface that accepted
a "ovs_be64 *", and with other compilers its accepted any
pointer-to-64-bit type, but not void *.  This commit fixes the problem,
making the interface the same in both cases.

This fixes a build error on MSVC:

    lib/nx-match.c(320) : error C2100: illegal indirection
    lib/nx-match.c(320) : error C2034: 'build_assert_failed' : type of bit
        field too small for number of bits
    lib/nx-match.c(320) : error C2296: '%' : illegal, left operand has
        type 'void *'
    lib/nx-match.c(320) : error C2198: 'ntohll' : too few arguments for call

It might appear that this patch changes get_unaligned_u64() but in fact
it onloy moves it earlier in the file (since it is now called from the
non-GCC fork of the #if).

Reported-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agocccl: Ignore -fno-strict-aliasing.
Alin Serdean [Thu, 9 Oct 2014 03:35:10 +0000 (03:35 +0000)]
cccl: Ignore -fno-strict-aliasing.

Add a case for the gcc flag fno-strict-aliasing into cccl
Under MSVC  Strict aliasing is off by default.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-actions: Support experimenter OXMs in Nicira extensions.
Ben Pfaff [Fri, 12 Sep 2014 05:09:03 +0000 (22:09 -0700)]
ofp-actions: Support experimenter OXMs in Nicira extensions.

Some of the Nicira extension actions include fixed-size 32-bit members that
designate NXM fields.  These actions can't accommodate 64-bit experimenter
OXMs, so we need to figure out some kind of solution.  This commit does
that, in different ways for different actions.

For some actions, I did not think it was worthwhile to worry about
experimenter OXM, so I just disabled use of them.  This is what I did for
bundle, learn, and multipath actions.

Other actions could be gracefully reinterpreted to support experimenter
OXM.  This is true of reg_move, which use NXM headers only at the end of
the action and such that using an experimenter OXM would make the action
longer (which unambigously signals to older OVS that the action is an
error, which is desired behavior since older OVS cannot interpret this
action).  The stack push and pop actions are also in this category.

reg_load was the most frustrating case.  In OpenFlow 1.5 we had already
eliminated this action in favor of OF1.5+ set_field.  In other OpenFlow
versions, though, reg_load is more powerful than set_field because it
can modify partial fields.  This commit therefore adds a new variant of
reg_load, called reg_load2, which is simply OF1.5+ set_field with a Nicira
extension header on it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agotests: Add test of double set-field in output action list.
Jean Tourrilhes [Wed, 24 Sep 2014 23:47:13 +0000 (16:47 -0700)]
tests: Add test of double set-field in output action list.

ONF-JIRA: EXT-314
Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-actions: Correct test for OFPVID_PRESENT bit in set_field action.
Ben Pfaff [Wed, 8 Oct 2014 23:19:57 +0000 (16:19 -0700)]
ofp-actions: Correct test for OFPVID_PRESENT bit in set_field action.

Reported-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonx-match: Add support for experimenter OXM.
Ben Pfaff [Wed, 8 Oct 2014 22:41:00 +0000 (15:41 -0700)]
nx-match: Add support for experimenter OXM.

OpenFlow 1.2+ defines a means for vendors to define vendor-specific OXM
fields, called "experimenter OXM".  These OXM fields are expressed with a
64-bit OXM header instead of the 32-bit header used for standard OXM (and
NXM).  Until now, OVS has not implemented experimenter OXM, and indeed we
have had little need to do so because of a pair of special 32-bit OXM classes
grandfathered to OVS as part of the OpenFlow 1.2 standardization process.

However, I want to prototype a feature for OpenFlow 1.5 that uses an
experimenter OXM as part of the prototype, so to do this OVS needs to
support experimenter OXM.  This commit adds that support.

Most of this commit is a fairly straightforward change: it extends the type
used for OXM/NXM from 32 to 64 bits and adds code to encode and decode the
longer headers when necessary.  Some other changes are necessary because
experimenter OXMs have a funny idea of the division between "header" and
"body": the extra 32 bits for experimenter OXMs are counted as part of the body
rather than the header according to the OpenFlow standard (even though this
does not entirely make sense), so arithmetic in various places has to be
adjusted, which is the reason for the new functions nxm_experimenter_len(),
nxm_payload_len(), and nxm_header_len().

Another change that calls for explanation is the new function mf_nxm_header()
that has been split from mf_oxm_header().  This function is used in actions
where the space for an NXM or OXM header is fixed so that there is no room
for a 64-bit experimenter type.  An upcoming commit will add new variations
of these actions that can support experimenter OXM.

Testing experimenter OXM is tricky because I do not know of any in
widespread use.  Two ONF proposals use experimenter OXMs: EXT-256 and
EXT-233.  EXT-256 is not suitable to implement for testing because its use
of experimenter OXM is wrong and will be changed.  EXT-233 is not suitable
to implement for testing because it requires adding a new field to struct
flow and I am not yet convinced that that field and the feature that it
supports is worth having in Open vSwitch.  Thus, this commit assigns an
experimenter OXM code point to an existing OVS field that is currently
restricted from use by controllers, "dp_hash", and uses that for testing.
Because controllers cannot use it, this leaves future versions of OVS free
to drop the support for the experimenter OXM for this field without causing
backward compatibility problems.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoutil: Make hexits_value() support 64-bit integers too.
Ben Pfaff [Tue, 30 Sep 2014 19:45:50 +0000 (12:45 -0700)]
util: Make hexits_value() support 64-bit integers too.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
9 years agonx-match: Speak of 'class' instead of 'vendor' for OXM/NXM.
Ben Pfaff [Wed, 10 Sep 2014 18:15:20 +0000 (11:15 -0700)]
nx-match: Speak of 'class' instead of 'vendor' for OXM/NXM.

OXM renamed the 'vendor' field from NXM to the 'class', and uses the term
"experimenter", which OVS usually renders as "vendor" for historical
reasons, as part of the extended 64-bit OXMs.  To reduce confusion, this
commit adopts the OXM terminology for class.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>