cascardo/ovs.git
9 years agoopenflow.h: Add header for OpenFlow v1.5.
Jean Tourrilhes [Thu, 30 Oct 2014 23:17:16 +0000 (16:17 -0700)]
openflow.h: Add header for OpenFlow v1.5.

Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-testcontroller: Fix priority of non table-miss flow entries.
Jean Tourrilhes [Fri, 31 Oct 2014 20:46:43 +0000 (13:46 -0700)]
ovs-testcontroller: Fix priority of non table-miss flow entries.

Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
9 years agodatapath: Convert dp rcu read operation to locked operations
Pravin B Shelar [Wed, 29 Oct 2014 09:45:48 +0000 (02:45 -0700)]
datapath: Convert dp rcu read operation to locked operations

dp read operations depends on ovs_dp_cmd_fill_info(). This API
needs to looup vport to find dp name, but vport lookup can
fail. Therefore to keep vport reference alive we need to
take ovs lock.

Found by code inspection.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agotests: Make sure test for actset_output tests initial condition.
Jean Tourrilhes [Wed, 22 Oct 2014 19:41:50 +0000 (12:41 -0700)]
tests: Make sure test for actset_output tests initial condition.

ONF-JIRA: EXT-233
Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
9 years agoofproto-dpif: Make ofproto/trace a bit more like real packet translation.
Ben Pfaff [Tue, 4 Nov 2014 19:17:11 +0000 (11:17 -0800)]
ofproto-dpif: Make ofproto/trace a bit more like real packet translation.

Until now, ofproto/trace has looked up the flow itself.  xlate_actions()
can do the flow lookup internally and, since that is what happens when a
packet arrives, having it do its own packet lookup makes a lot of sense.

I noticed this in connection with the actset_output field, which
xlate_actions() should set to OFPP_UNSET at the beginning of translation
before looking up the flow.  ofproto/trace didn't do that, so it looked
up a rule with actset_output=0 instead.  By having xlate_actions() do the
lookup, the behavior can be consistent and correct.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoofproto-dpif-xlate: Add drop_frags_rule to struct xbridge.
Ben Pfaff [Tue, 4 Nov 2014 19:09:49 +0000 (11:09 -0800)]
ofproto-dpif-xlate: Add drop_frags_rule to struct xbridge.

It will be used in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agonetflow: Fix interpretation of flow_seq.
Motonori Shindo [Tue, 4 Nov 2014 16:12:18 +0000 (01:12 +0900)]
netflow: Fix interpretation of flow_seq.

'flow_seq" field in NetFlow v5 header should represent a number of NetFlow
flow records exported while it is representing the number of NetFlow
packets exported in the current code. This patch fixes this problem.

Signed-off-by: Motonori Shindo <motonori@shin.do>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-router: Fix sparse warning
Pravin B Shelar [Tue, 4 Nov 2014 17:24:24 +0000 (09:24 -0800)]
ovs-router: Fix sparse warning

Fixes following warning:
../lib/ovs-router.c:162:11: warning: incorrect type in assignment
(different base types)
../lib/ovs-router.c:162:11:    expected restricted ovs_be32
[usertype] <noident>
../lib/ovs-router.c:162:11:    got restricted ovs_be16

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agonetdev-dpdk: Fix DPDK rings broken by multi queue
David Verbeiren [Tue, 14 Oct 2014 17:01:49 +0000 (19:01 +0200)]
netdev-dpdk: Fix DPDK rings broken by multi queue

DPDK rings don't need one queue per PMD thread and don't support multiple
queues (set_multiq function is undefined). To fix operation with DPDK rings,
this patch ignores EOPNOTSUPP error on netdev_set_multiq() and provides, for
DPDK rings, a netdev send() function that ignores the provided queue id
(= PMD thread core id).

Suggested-by: Maryam Tahhan <maryam.tahhan@intel.com>
Signed-off-by: David Verbeiren <david.verbeiren@intel.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoofp-print: Use ds_chomp() in ofp10_match_to_string()
Simon Horman [Tue, 4 Nov 2014 06:14:04 +0000 (15:14 +0900)]
ofp-print: Use ds_chomp() in ofp10_match_to_string()

Slightly simplify ofp10_match_to_string() by using ds_chomp()
rather than open-coding its logic.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agomatch: Use ds_chomp() in match_format()
Simon Horman [Tue, 4 Nov 2014 06:13:45 +0000 (15:13 +0900)]
match: Use ds_chomp() in match_format()

Slightly simplify match_format() by using ds_chomp()
rather than open-coding its logic.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoflow: Support OF1.5+ (draft) actset_output field.
Ben Pfaff [Mon, 3 Nov 2014 22:24:01 +0000 (14:24 -0800)]
flow: Support OF1.5+ (draft) actset_output field.

This field allows a flow table to match on the output port currently in the
action set.

ONF-JIRA: EXT-233
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agonx-match: Add support for multiple OXM field assignments for one field.
Ben Pfaff [Fri, 10 Oct 2014 05:57:47 +0000 (22:57 -0700)]
nx-match: Add support for multiple OXM field assignments for one field.

actset_output, to be added in an upcoming commit, has one OXM assignment
in OpenFlow 1.3 and another one in OpenFlow 1.5.  This commit allows both
of them to be supported in appropriate OpenFlow versions.

This feature is difficult to test on its own, so the same commit that adds
actset_output support also tests this feature.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agodatapath: Fix compat checks for ipv6_skip_exthdr()
Pravin B Shelar [Mon, 3 Nov 2014 16:55:12 +0000 (08:55 -0800)]
datapath: Fix compat checks for ipv6_skip_exthdr()

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoofproto-dpif-xlate: Do not clear ports with frags in xlate_actions().
Jarno Rajahalme [Mon, 3 Nov 2014 22:40:22 +0000 (14:40 -0800)]
ofproto-dpif-xlate: Do not clear ports with frags in xlate_actions().

Transport ports are already cleared for lookup if need be, and they
should be available for action processing, so do not clear them in
xlate_actions().

A drop flow takes care of dropping the packet, so no special case is
needed in xlate_actions().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agotests/ofproto-dpif - fragment handling: Add detail.
Jarno Rajahalme [Mon, 3 Nov 2014 22:40:22 +0000 (14:40 -0800)]
tests/ofproto-dpif - fragment handling: Add detail.

Add transport port modifications to the existing frags handling test
case.

This demonstrates incorrect behavior by not moving the destination
port number to source port in normal mode for first fragment, as the
transport port numbers have been zeroed and the move has no effect,
and by allowing moves to/from transport ports on later fragments
(which do not have a transport header).

Next patches fix these problems.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoroute-table: extract gw information.
Pravin B Shelar [Thu, 16 Oct 2014 18:38:16 +0000 (11:38 -0700)]
route-table: extract gw information.

Routing table will be used by ovs userspace tunneling, it need to
know gw address, following commit extract gw information from
netlink message so that ovs can populate it in ovs route table.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agoroute-table: Use classifier to store routing table.
Pravin B Shelar [Thu, 16 Oct 2014 18:38:12 +0000 (11:38 -0700)]
route-table: Use classifier to store routing table.

Rather than using hmap for storing routing entries we can directly use
classifier which has support for priority and wildcard entries.
This makes route lookup lockless. This help when we use route lookup
for native tunneling.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoroute-table: get rid of name-table
Pravin B Shelar [Thu, 16 Oct 2014 18:38:06 +0000 (11:38 -0700)]
route-table: get rid of name-table

name table maintains device ifindex to name mapping.  On any name
table changes it invalidate name table and routing table. So
rather than building two tables this patch moves dev name to routing
entry and build routing table on any name table changes.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agoxenserver: Turn on SSE and SSE2 for the build, for atomic 64-bit ops.
Ben Pfaff [Fri, 3 Oct 2014 22:49:23 +0000 (15:49 -0700)]
xenserver: Turn on SSE and SSE2 for the build, for atomic 64-bit ops.

The ovs-atomic-i586 implementation of atomic operations can implement
64-bit atomics more efficiently when SSE is supported.  XenServer runs only
on 64-bit capable processors, in 32-bit mode, so we know on XenServer that
SSE and SSE2 are supported because they are architectural for amd64.  Thus,
this commit enables SSE and SSE2 when building for XenServer to get the
improved atomics support.

I tested that this successfully adds -msse -msse2 to the compiler flags
inside a XenServer DDK, but I didn't actually run it on a real XenServer
install.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agopackets: Use WORDS_BIGENDIAN for struct geneve_opt.
Jesse Gross [Fri, 31 Oct 2014 23:47:45 +0000 (16:47 -0700)]
packets: Use WORDS_BIGENDIAN for struct geneve_opt.

The macro LITTLE_ENDIAN is a constant, not a test for endianness,
so it doesn't actually tell us anything about the machine.
WORDS_BIGENDIAN is both correct and defined by configure so it is
more portable.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agotest-classifier: Ensure priority is not INT_MIN.
Jarno Rajahalme [Fri, 31 Oct 2014 21:14:56 +0000 (14:14 -0700)]
test-classifier: Ensure priority is not INT_MIN.

Classifier reserves the priority value INT_MIN for its own use.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoclassifier: Use rculist.
Jarno Rajahalme [Fri, 31 Oct 2014 23:22:23 +0000 (16:22 -0700)]
classifier: Use rculist.

The list of identical, but lower priority rules is not currently used
in classifier lookup.  A later patch introducing conjunctive matches
needs to access the list during lookups, so we must make the list RCU.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoodp-util: Fix segfault in MPLS attribute parsing.
Joe Stringer [Fri, 31 Oct 2014 21:05:46 +0000 (14:05 -0700)]
odp-util: Fix segfault in MPLS attribute parsing.

Just because the ethertype is MPLS, this doesn't mean that the datapath
understands and provides OVS_KEY_ATTR_MPLS attributes for the flow.
Previously we would check the size of the OVS_KEY_ATTR_MPLS attribute
before checking whether the attribute is present. This would cause a
segfault in nl_attr_get_size(), usually triggered from a handler thread.

This patch brings the MPLS parsing code more in line with the rest of
the parse_l2_5_onward() function, by only processing MPLS if the
attribute is present.

Reported-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-ofctl: Improve error message for meter=0.
Joe Stringer [Fri, 31 Oct 2014 06:02:29 +0000 (19:02 +1300)]
ovs-ofctl: Improve error message for meter=0.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-print-ofctl: Free group buckets.
Simon Horman [Fri, 31 Oct 2014 08:14:47 +0000 (17:14 +0900)]
ofp-print-ofctl: Free group buckets.

Found by inspection using make check-valgrind.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-ofctl: Free group buckets.
Simon Horman [Fri, 31 Oct 2014 08:14:46 +0000 (17:14 +0900)]
ovs-ofctl: Free group buckets.

To some extent this is cosmetic because ovs-ovfctl will immediately
exit. However, it does seem to be in keeping with freeing 'gms' in
ofctl_group_mod_file().

Found by inspection using make check-valgrind.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoAUTHORS: Add Scott Lowe <scott.lowe@scottlowe.org>.
Ben Pfaff [Fri, 31 Oct 2014 16:49:02 +0000 (09:49 -0700)]
AUTHORS: Add Scott Lowe <scott.lowe@scottlowe.org>.

Contributors to the webpage deserve authorship credit too.

CC: Scott Lowe <scott.lowe@scottlowe.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Increase the maximum size of port name.
Nithin Raju [Wed, 29 Oct 2014 22:18:19 +0000 (15:18 -0700)]
datapath-windows: Increase the maximum size of port name.

In userspace, port name sizes are restricted to IFNAMSIZ which is
defined to IF_NAME_SIZE in:
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\netioapi.h

In the kernel, since IFNAMSIZ was not available, we previously defined a
value of 16 for the kernel. This is restrictive for Openstack
integration where we use UUID as the name.

In this patch, we make the kernel code also use the same value as the
userspace.

Also updated is the OVS.psm1 powershell script which now allows friendly
names to be upto 48 bytes.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Fix locking code in OvsGetNetdevCmdHandler().
Nithin Raju [Wed, 29 Oct 2014 22:18:18 +0000 (15:18 -0700)]
datapath-windows: Fix locking code in OvsGetNetdevCmdHandler().

We were acquiring locks twice, and forgotten to release a lock in an
error case.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Nuke USE_NEW_VPORT_ADD_WORKFLOW.
Nithin Raju [Wed, 29 Oct 2014 22:18:17 +0000 (15:18 -0700)]
datapath-windows: Nuke USE_NEW_VPORT_ADD_WORKFLOW.

We were using USE_NEW_VPORT_ADD_WORKFLOW while transitioning from old
workflow for adding ports. We don't need it anymore.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Don't leak NBLs with multiple NBs.
Nithin Raju [Thu, 30 Oct 2014 20:17:43 +0000 (13:17 -0700)]
datapath-windows: Don't leak NBLs with multiple NBs.

Currently, if we receive an NBL with multiple NBs from NDIS, we just
ASSERT() and not do anything. The right thing to do obviously is to
process the NBL. This is a work in progress.

In the meantime, we should complete the NBL and not just leak it.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.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 agoclassifier: Change type used for priorities from 'unsigned int' to 'int'.
Ben Pfaff [Thu, 30 Oct 2014 18:40:07 +0000 (11:40 -0700)]
classifier: Change type used for priorities from 'unsigned int' to 'int'.

OpenFlow has priorities in the 16-bit unsigned range, from 0 to 65535.
In the classifier, it is sometimes useful to be able to have values below
and above this range.  With the 'unsigned int' type used for priorities
until now, there were no values below the range, so some code worked
around it by converting priorities to 64-bit signed integers.  This didn't
seem so great to me given that a plain 'int' also had the needed range.
This commit therefore changes the type used for priorities to int.

The interesting parts of this change are in pvector.h and classifier.c,
where one can see the elimination of the use of int64_t.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agonetdev-linux: Avoid depending on kernel definition of rtnl_link_stats64.
Ben Pfaff [Thu, 30 Oct 2014 17:38:06 +0000 (10:38 -0700)]
netdev-linux: Avoid depending on kernel definition of rtnl_link_stats64.

We have to define our own with some kernel headers, so we might as well do
it everywhere, especially since there seems to be a problem with detecting
the presence of the definition with at least some kernels.

Reported-by: Wang Sheng-Hui <shhuiw@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agoutilities: Add bash command-line completion script.
Alex Wang [Mon, 20 Oct 2014 04:36:58 +0000 (21:36 -0700)]
utilities: Add bash command-line completion script.

This patch adds bash command-line completion script for ovs-appctl,
ovs-dpctl, ovs-ofctl and ovsdb-tool command.  Right now, the script
can do the following:

- display available completion or complete on unfinished user input
  (long option, subcommand, and argument).

- once the subcommand (e.g. ofproto/trace) has been given, the
  script will print the subcommand format.

- the script can convert between keywords like 'bridge/port/interface/dp'
  and the available record in ovsdb.

The limitations are:

- only support small set of important keywords
  (dp, datapath, bridge, switch, port, interface, iface).

- does not support parsing of nested options
  (e.g. ovsdb-tool create [db [schema]]).

- does not support expansion on repeatitive argument
  (e.g. ovs-dpctl show [dp...]).

- only support matching on long options, and only in the format
  (--option [arg], i.e. should not use --option=[arg]).

To use the script, either copy it inside /etc/bash_completion.d/
or manually run it via . ovs-command-compgen.bash.

Also, a unit testsuite is provided as ovs-command-compgen-test.bash.
It is suggested that this test script be run only inside
tutorial/sandbox directory.

For more info please refer to utilities/ovs-command-compgen.INSTALL.md.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agotests: Check the existance of WHY-OVS.md instead of WHY-OVS.
Wang Sheng-Hui [Thu, 30 Oct 2014 04:55:33 +0000 (12:55 +0800)]
tests: Check the existance of WHY-OVS.md instead of WHY-OVS.

WHY-OVS has been renamed to WHY-OVS.md. Update the filenames in run-oftest
and run-ryu scripts

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs_assert, tests: Support NDEBUG.
Jarno Rajahalme [Wed, 29 Oct 2014 18:34:40 +0000 (11:34 -0700)]
ovs_assert, tests: Support NDEBUG.

./configure accepts --enable-ndebug option.  Make ovs_assert() honor
it, and make sure all test programs disable it.

The order of include files in test programs is also made uniform:

1. #include <config.h>
2. #undef NDEBUG
3. Include file of the test subject (to make sure it itself has
   sufficient include directives).
4. System includes in alphapetical order.
5. OVS includes in aplhapetical order.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolist: Inline all functions.
Jarno Rajahalme [Wed, 29 Oct 2014 17:15:42 +0000 (10:15 -0700)]
list: Inline all functions.

All of the list functions are really small, so inlining them should be
beneficial.

Requested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodoc: Add more cross references between docs
Thomas Graf [Thu, 30 Oct 2014 12:04:14 +0000 (13:04 +0100)]
doc: Add more cross references between docs

Suggested-by: Lori Jakab <lojakab@cisco.com>
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Reviewed-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodebian: Fix broken build during package creation.
Gurucharan Shetty [Wed, 29 Oct 2014 20:53:10 +0000 (13:53 -0700)]
debian: Fix broken build during package creation.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agovswitch.xml: Improve IPFIX documentation.
Ben Pfaff [Wed, 29 Oct 2014 21:59:48 +0000 (14:59 -0700)]
vswitch.xml: Improve IPFIX documentation.

A coworker came by yesterday with a question about IPFIX in Open vSwitch.
I did not know the answer, so I read the documentation.  The documentation
was harder to understand than necessary.  This change should make it easier
to understand by providing an overview of the two forms of configuration
and grouping together the columns that apply only to one form of
configuration.

Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agovswitch.xml: Fix spelling errors in documentation.
Ben Pfaff [Wed, 15 Oct 2014 20:05:55 +0000 (13:05 -0700)]
vswitch.xml: Fix spelling errors in documentation.

Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-vsctl: Allow referring to rows whose names are UUIDs by those names.
Ben Pfaff [Wed, 29 Oct 2014 21:11:07 +0000 (14:11 -0700)]
ovs-vsctl: Allow referring to rows whose names are UUIDs by those names.

Every row in the database has a UUID, generated by the database server.
Rows in most tables also have a user-assigned name (e.g. a bridge or port
or interface name).  The ovs-vsctl database commands (e.g. "set", "get",
"list", ...) accept both UUIDs and names, but until now if a command's
argument had the form of a UUID, then it had to be the database-assigned
UUID for a row; that is, ovs-vsctl did not check whether it was the name
of a row.  This commit changes that: a UUID argument to a database command
is now first checked against database UUIDs then, if it is not a database
UUID, it is checked as the name of a row.

This is prompted by Windows integration with OpenStack, which uses UUIDs
as port names.

CC: Nithin Raju <nithin@vmware.com>
Requested-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonetdev-linux: Add support for 64-bit network device stats.
Ben Pfaff [Wed, 29 Oct 2014 15:55:30 +0000 (08:55 -0700)]
netdev-linux: Add support for 64-bit network device stats.

Reported-by: Andrey Korolyov <andrey@xdel.ru>
Tested-by: Andrey Korolyov <andrey@xdel.ru>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodocker: Update documentation to reflect risks of retiring ovs-docker.
Gurucharan Shetty [Wed, 29 Oct 2014 12:54:45 +0000 (05:54 -0700)]
docker: Update documentation to reflect risks of retiring ovs-docker.

Requested-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
9 years agotests/test-classifier: Properly use ovsrcu_postpone.
Jarno Rajahalme [Wed, 29 Oct 2014 16:59:57 +0000 (09:59 -0700)]
tests/test-classifier: Properly use ovsrcu_postpone.

Following patches add stricter checks of RCU memory management of
rules removed from a classifier.  This patch properly postpones
freeing of 'struct cls_rule's that have been removed from a
classifier.

Also remove all the rules from classifier before destructing it in
test_rule_replacement().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/rculist: New RCU-iterator, single-writer doubly-linked list.
Jarno Rajahalme [Wed, 29 Oct 2014 16:59:57 +0000 (09:59 -0700)]
lib/rculist: New RCU-iterator, single-writer doubly-linked list.

rculist allows concurrent lockless list iteration, while a writer may
be modifying the list.  Multiple writers can be supported by using a
mutex in addition to rculist.

First user will be added in a following patch.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agocommand-line: Add function to print command usage.
Alex Wang [Thu, 16 Oct 2014 20:27:32 +0000 (13:27 -0700)]
command-line: Add function to print command usage.

This commit adds a new variable in 'struct command' for
recording the command usage.  Also, a new function is
added to print the usage given the array of defined
commands.

Later patch will use the output in bash command-line
completion script.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodpctl: Implement 'list-commands' function.
Alex Wang [Thu, 16 Oct 2014 20:26:07 +0000 (13:26 -0700)]
dpctl: Implement 'list-commands' function.

This commit implements the 'list-commands' command for ovs-dpctl
and ovs-appctl dpctl/* commands.  The function will print the
usage string for each subcommand.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-appctl: Rename 'help' to 'list-commands'.
Alex Wang [Fri, 17 Oct 2014 18:11:36 +0000 (11:11 -0700)]
ovs-appctl: Rename 'help' to 'list-commands'.

Having 'ovs-appctl help' and 'ovs-appctl --help' print different
output is confusing.  This commit renames the 'help' to 'list-commands'.
Also, future patches will add the 'list-commands' to other ovs-*
commands, and the output will be used by bash command-line completion
script.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agocommand-line: Add function to print all options.
Alex Wang [Fri, 12 Sep 2014 00:24:35 +0000 (17:24 -0700)]
command-line: Add function to print all options.

This commit adds a function that prints (both long and short)
options of a ovs-* command.  To use this function, option
'--option' is added to ovs-appctl/dpctl/ofctl and ovsdb-tool
commands.  A future patch will use the option output to
conduct bash command-line completion.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agonetdev-windows: Fix bugs in flag update and MAC address copy functions.
Nithin Raju [Tue, 28 Oct 2014 17:01:22 +0000 (10:01 -0700)]
netdev-windows: Fix bugs in flag update and MAC address copy functions.

The .update_flags function in netdev-windows was dummy. But we need to
return the existing flags for link status to be shown as up in the
confdb.

There was a bug in copying the MAC address.

We fix these two issues in this patch.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Co-Authored-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ankur Sharma <ankursharma@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: Allow encapsulation if source is bridge-internal port.
Nithin Raju [Fri, 24 Oct 2014 18:41:17 +0000 (11:41 -0700)]
datapath-windows: Allow encapsulation if source is bridge-internal port.

It has been observed that when userspace generates and executes that
packet, the source port of such a packet is set to the bridge-internal
port. Currently, we allow encapsulation only if the source port is a VIF
port or no port. We relax the check in this patch.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@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 agodoc: Convert docs to Markdown language
Thomas Graf [Tue, 28 Oct 2014 10:19:52 +0000 (11:19 +0100)]
doc: Convert docs to Markdown language

Converts the majority of docs over to use the Markdown language for
pretty printing on GitHub. It's a rough first convertion without
exploiting the full potential of Markdown at this point. Section
titles and indentation are fixed as needed. Minimal docs interlinking
is added.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: OvsFindVportByPortIdAndNicIndex() and external port.
Nithin Raju [Fri, 24 Oct 2014 00:33:14 +0000 (17:33 -0700)]
datapath-windows: OvsFindVportByPortIdAndNicIndex() and external port.

We use OvsFindVportByPortIdAndNicIndex() to lookup the vport for a
packte received from the Hyper-V switch. If a packet was indeed received
from the virtual external NIC, we should flag it.

Validation:
1. Install and Uninstall the OVS EXT Driver (without enabling the OVS
   extension on the Hyper-V switch).
2. Install and Uninstall the OVS EXT Driver (with enabling the OVS
   extension on the Hyper-V switch). Hyper-V switch had a few ports.
3. Install and Uninstall the OVS EXT Driver (with enabling the OVS
   extension on the Hyper-V switch). Added a few ports before
   uninstalling.
4. Install the OVS EXT driver, and test the following functionality:
   a) ping between 2 VMs on the same host
   b) ping between 2 VMs on 2 Hyper-Vs - one physical and another
      virtual backed by VLAN (patch port between br-pif and br-int).
   c) ping between 2 VMs on 2 Hyper-Vs - one physical and another
      virtual backed by VXLAN.
   d) Successful uninstallation after these tests.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Update vport add code.
Nithin Raju [Fri, 24 Oct 2014 00:33:13 +0000 (17:33 -0700)]
datapath-windows: Update vport add code.

In this patch, we make the following updates to the vport add code:

1. Clarify the roles of the different hash tables, so it is easier to
   read/write code in the future.
2. Update OvsNewVportCmdHandler() to support adding bridge-internal
   ports.
3. Fixes in OvsNewVportCmdHandler() to support adding external port.
   Earlier, we'd hit ASSERTs.
4. I could not figure out way to add a port of type
   OVS_PORT_TYPE_INTERNAL with name "internal" to the confdb using
   ovs-vsctl.exe. And, this is needed in order to add the Hyper-V
   internal port from userspace. To workaround this problem, we treat a
   port of type OVS_PORT_TYPE_NETDEV with name "internal" as a request
   to add the Hyper-V internal port. This is a workaround. The end
   result is that there's a discrepancy between the port type in the
   datpaath v/s confdb, but this has not created any trouble in testing
   so far. If this ends up becoming an issue, we can mark the Hyper-V
   internal port to be of type OVS_PORT_TYPE_NETDEV. No harm.
5. Because of changes indicated in #1, we also update the vport dump
   code to look at the correct hash table for ports added from
   userspace.
6. Add a OvsGetTunnelVport() for convenience.
7. Update ASSERTs() while cleaning up the switch.
8. Nuke OvsGetExternalVport() and OvsGetExternalMtu().

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Refactor core in Vport.c.
Nithin Raju [Fri, 24 Oct 2014 00:33:12 +0000 (17:33 -0700)]
datapath-windows: Refactor core in Vport.c.

We do a bunch of changes that did not make sense to split up into
smaller patches:

1. Add descriptive comments to the important functions to clarify
   purpose.
2. s/OvsInitVportCommon/InitHvVportCommon - this function is common code
   for every port that shows up on the Hyper-V switch.
3. Introduce a InitOvsVportCommon() that is common code for evrey port
   that gets added from userspace. This is especially useful for ports
   that are not present on the Hyper-V switch. ie. tunnel ports and
   bridge-internal ports.
4. Fix OvsClearAllSwitchVports() to remove ports from both the lists:
   the ones added from Hyper-V as well as the ones added from OVS
   userspace.
5. Update OvsInitVxlanTunnel() to not call into InitHvVportCommon
   (formerly OvsInitVportCommon()) since it is not a port on the Hyper-v
   switch. In a later patch in the series, we'll call
   InitOvsVportCommon() for a VXLAN port.
6. 'numNonHvVports' increments and decrements ONLY for ports that are
   added from OVS userspace but not present on the Hyper-V switch.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: OvsInitTunnelVport() and OvsInitBridgeInternalVport().
Nithin Raju [Fri, 24 Oct 2014 00:33:11 +0000 (17:33 -0700)]
datapath-windows: OvsInitTunnelVport() and OvsInitBridgeInternalVport().

In this patch, we add the init functions for a Tunnel vport and a
Bridge-internal vport.

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: Introduce bridge-internal ports.
Nithin Raju [Fri, 24 Oct 2014 00:33:10 +0000 (17:33 -0700)]
datapath-windows: Introduce bridge-internal ports.

In this patch, we provide explanation and the reasoning for
bridge-internal ports. The code to add such a port in come in later
patch in the series.

We also fix some formatting issues in PacketIO.c.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Clarify externalVport.
Nithin Raju [Fri, 24 Oct 2014 00:33:09 +0000 (17:33 -0700)]
datapath-windows: Clarify externalVport.

In this patch, we add some explanation about the usage of
'externalVport' in the switch context. Also, we rename 'externalVport'
to 'virtualExternalVport' in alignment with the explanation. Also, we
rename 'numVports' to 'numHvVports' since ports are added from 2 ends
now.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Re-init the list entry in OvsDeleteVportCmdHandler().
Nithin Raju [Fri, 24 Oct 2014 00:33:08 +0000 (17:33 -0700)]
datapath-windows: Re-init the list entry in OvsDeleteVportCmdHandler().

Without this patch, the kernel crashes when it tries to cleanup a port
at unload time when a port has been previously deleted from userspace.
Crash is in OvsRemoveAndDeleteVport() when we call into
RemoveEntryList().

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: Fix BSOD caused by DV due to memory leaks.
Sorin Vinturis [Mon, 27 Oct 2014 19:26:49 +0000 (19:26 +0000)]
datapath-windows: Fix BSOD caused by DV due to memory leaks.

If the OVS extension is enabled, Driver Verifier will issue a BSOD
due to memory leaks. This issue reproduces each time and the problem
is in the filter attach routine when the switch context is initialized.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/50
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows:Remove user mode instance from pid hash on process termination
Eitan Eliahu [Sat, 25 Oct 2014 00:46:39 +0000 (17:46 -0700)]
datapath-windows:Remove user mode instance from pid hash on process termination

The instance should be removed from pid-hash when vswitchd.exe terminates so
the driver won't access it during packet miss (causing BSOD)

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-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 agoINSTALL.Windows: minor updates to the SSL section
Nithin Raju [Tue, 28 Oct 2014 00:31:29 +0000 (17:31 -0700)]
INSTALL.Windows: minor updates to the SSL section

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agolib/ovs-rcu: Support static initialization.
Jarno Rajahalme [Mon, 27 Oct 2014 17:57:28 +0000 (10:57 -0700)]
lib/ovs-rcu: Support static initialization.

Currently, OVSRCU_TYPE_INITIALIZER always initializes the RCU pointer
as NULL.  There is no reason why the RCU pointer could not be
initialized with a non-NULL value, however, as statically allocated
memory is even more stable than required for RCU.

This patch changes the initializer to OVSRCU_INITIALIZER(VALUE), which
can take any pointer value as a parameter.

This allows rculist, which is introduced in a following patch, to
provide an initializer similar to the one in the normal list.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/ofproto: Add comments about races in ofproto_flush().
Jarno Rajahalme [Mon, 27 Oct 2014 17:57:28 +0000 (10:57 -0700)]
lib/ofproto: Add comments about races in ofproto_flush().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/ofproto: Remove obsolete FIXME comment.
Jarno Rajahalme [Mon, 27 Oct 2014 17:57:27 +0000 (10:57 -0700)]
lib/ofproto: Remove obsolete FIXME comment.

We already implement OFPFUTIL_FF_RESET_COUNTS.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoclassifier: Correct comment in classifier_lookup().
Ben Pfaff [Fri, 24 Oct 2014 23:17:08 +0000 (16:17 -0700)]
classifier: Correct comment in classifier_lookup().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agonetlink-socket: Fix a couple of compilation warnings.
Nithin Raju [Fri, 24 Oct 2014 15:14:52 +0000 (08:14 -0700)]
netlink-socket: Fix a couple of compilation warnings.

Reported-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
[blp@nicira.com replaced conventional cast by CONST_CAST]
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agolib/classifier: Add lib/classifier-private.h.
Jarno Rajahalme [Fri, 24 Oct 2014 20:22:24 +0000 (13:22 -0700)]
lib/classifier: Add lib/classifier-private.h.

tests/test-classifier.c used to include lib/classifier.c to gain
access to the internal data structures and some utility functions.
This was confusing, so this patch splits the relevant groups of
classifier internal definations to a new file
(lib/classifier-private.h), which is included by both lib/classifier.c
and tests/test-classifier.c.  Other use of the new file is
discouraged.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib: Clean up vlog use.
Jarno Rajahalme [Fri, 24 Oct 2014 20:22:24 +0000 (13:22 -0700)]
lib: Clean up vlog use.

Vlog functions assume a vlog module has been defined for the current
translation unit.  Including lib/vlog.h from a header file makes the
vlog API visible even when no vlog module may not have been defined.
This patch removes the two cases in the tree where vlog.h was included
from a header file.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Avoid BSOD when no event queue found.
Alin Serdean [Thu, 23 Oct 2014 23:38:21 +0000 (23:38 +0000)]
datapath-windows: Avoid BSOD when no event queue found.

kd> ??instance
struct _OVS_OPEN_INSTANCE * 0xffffe000`037f2880
   +0x000 cookie           : 1
   +0x008 fileObject       : 0xffffe000`02c59f20 _FILE_OBJECT
   +0x010 eventQueue       : (null)
   +0x018 packetQueue      : 0xffffe000`02d50100 _OVS_USER_PACKET_QUEUE
   +0x020 pid              : 2
   +0x024 inUse            : 0n1
   +0x028 dumpState        : <unnamed-tag>
   +0x038 pidLink          : _LIST_ENTRY [ 0xffffe000`03ad83f0 - 0xffffe000`03ad83f0 ]
kd> k
Child-SP          RetAddr           Call Site
ffffd000`2876eb18 fffff801`f364b7c6 nt!DbgBreakPointWithStatus
ffffd000`2876eb20 fffff801`f364b0d7 nt!KiBugCheckDebugBreak+0x12
ffffd000`2876eb80 fffff801`f35c21a4 nt!KeBugCheck2+0x8ab
ffffd000`2876f290 fffff801`f35cdbe9 nt!KeBugCheckEx+0x104
ffffd000`2876f2d0 fffff801`f35cc43a nt!KiBugCheckDispatch+0x69
ffffd000`2876f410 fffff800`02626666 nt!KiPageFault+0x23a
ffffd000`2876f5a0 fffff800`026318d7 OVSExt!OvsWaitEventIoctl+0x116 [c:\work\ovs\datapath-windows\ovsext\event.c @ 472]
ffffd000`2876f610 fffff800`026339b4 OVSExt!OvsPendEventCmdHandler+0x57 [c:\work\ovs\datapath-windows\ovsext\datapath.c @ 1056]
ffffd000`2876f660 fffff800`0264d9c5 OVSExt!InvokeNetlinkCmdHandler+0xf4 [c:\work\ovs\datapath-windows\ovsext\datapath.c @ 938]
ffffd000`2876f6b0 fffff800`006f1c18 OVSExt!OvsDeviceControl+0x855 [c:\work\ovs\datapath-windows\ovsext\datapath.c @ 853]
ffffd000`2876f840 fffff801`f383c395 NDIS!ndisDummyIrpHandler+0x88
ffffd000`2876f870 fffff801`f383cd2a nt!IopXxxControlFile+0x845
ffffd000`2876fa20 fffff801`f35cd8b3 nt!NtDeviceIoControlFile+0x56
ffffd000`2876fa90 00000000`775c2772 nt!KiSystemServiceCopyEnd+0x13
00000000`010feef8 00000000`775c2371 wow64cpu!CpupSyscallStub+0x2
00000000`010fef00 00000000`7765323a wow64cpu!DeviceIoctlFileFault+0x31
00000000`010fefb0 00000000`7765317e wow64!RunCpuSimulation+0xa
00000000`010ff000 00007ff8`f1076bd0 wow64!Wow64LdrpInitialize+0x172
00000000`010ff540 00007ff8`f1076aa6 ntdll!_LdrpInitialize+0xd8
00000000`010ff5b0 00000000`00000000 ntdll!LdrInitializeThunk+0xe
kd> ??poll
struct _OVS_EVENT_POLL * 0xffffd000`2876f640
   +0x000 cookie           : 0x3a9ae28
   +0x004 dpNo             : 0
SYMBOL_STACK_INDEX:  6

SYMBOL_NAME:  OVSExt!OvsWaitEventIoctl+116

FOLLOWUP_NAME:  MachineOwner

MODULE_NAME: OVSExt

IMAGE_NAME:  OVSExt.sys

DEBUG_FLR_IMAGE_TIMESTAMP:  54498bc5

BUCKET_ID_FUNC_OFFSET:  116

FAILURE_BUCKET_ID:  AV_OVSExt!OvsWaitEventIoctl

BUCKET_ID:  AV_OVSExt!OvsWaitEventIoctl

ANALYSIS_SOURCE:  KM

FAILURE_ID_HASH_STRING:  km:av_ovsext!ovswaiteventioctl

FAILURE_ID_HASH:  {07550bfb-c3b5-0412-b95d-f89a5c4671a9}

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@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 agoofproto: Only allow indirect groups with one bucket
Simon Horman [Fri, 24 Oct 2014 05:59:20 +0000 (14:59 +0900)]
ofproto: Only allow indirect groups with one bucket

OpenFlow 1.1 - 1.4 specify that indirect groups should
opperate on the "one defined bucket in the group". OpenFlow
1.2 - 1.4 also state "This group only supports a single bucket."

This patch enforces the single bucket limitation for indirect groups
when decoding group mod messages. A test is also added to exercise
this change.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: check for 'gOvsSwitchContext' in ValidateNetlinkCmd()
Nithin Raju [Wed, 15 Oct 2014 18:30:51 +0000 (11:30 -0700)]
datapath-windows: check for 'gOvsSwitchContext' in ValidateNetlinkCmd()

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 agodatapath-windows: Refactor CreateQueue function to handle vport pid.
Ankur Sharma [Thu, 23 Oct 2014 21:24:28 +0000 (14:24 -0700)]
datapath-windows: Refactor CreateQueue function to handle vport pid.

Refactored CreateQueue function so that packets are enqueued to correct corresponding queue.

Signed-off-by: Ankur Sharma <ankursharma@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 agodatapath-windows: Add code for OvsGetQueue.
Ankur Sharma [Thu, 23 Oct 2014 21:24:27 +0000 (14:24 -0700)]
datapath-windows: Add code for OvsGetQueue.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: pid-instance hash table APIs.
Ankur Sharma [Thu, 23 Oct 2014 21:24:26 +0000 (14:24 -0700)]
datapath-windows: pid-instance hash table APIs.

In this patch we have added APIs for insert, delete and search APIs.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-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: Use upstream ipv6_find_hdr().
Pravin B Shelar [Mon, 20 Oct 2014 23:13:04 +0000 (16:13 -0700)]
datapath: Use upstream ipv6_find_hdr().

ipv6_find_hdr() already fixed in newer upstram kernel by Ansis, we
can start using this API safely.
This patch also backports fix (ipv6: ipv6_find_hdr restore prev
functionality) to compat ipv6_find_hdr().

CC: Ansis Atteka <aatteka@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
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>