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>
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>
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>
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>
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>
vswitch.xml: Fix spelling errors in documentation.

Signed-off-by: Ben Pfaff <blp@nicira.com>
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>
debian: Fix broken build during package creation.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>