cascardo/ovs.git
9 years agoAdd build of ovsext.sln using MSBuild
Alin Serdean [Thu, 28 Aug 2014 13:49:24 +0000 (13:49 +0000)]
Add build of ovsext.sln using MSBuild

This commit adds to the automake build system the full build required
by the forwarding extension solution.

It will help a lot in the future CI to check the full build of the project.

To configure the forwarding extension to be built one could use the following:
./configure CC=./build-aux/cccl LD="`which link`" LIBS="-lws2_32" \
    --prefix="C:/openvswitch/usr" --localstatedir="C:/openvswitch/var" \
    --sysconfdir="C:/openvswitch/etc" --with-pthread="C:/pthread" \
    --with-vstudioddk="Win8.1 Release"

Documentation will be updated in another patch.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
9 years agoovsdb: Fix error leak for negative timeout and invalid until case
Thomas Graf [Thu, 28 Aug 2014 12:40:50 +0000 (14:40 +0200)]
ovsdb: Fix error leak for negative timeout and invalid until case

Although the check for negative timeout is present, the error string
is overwritten if an invalid "until" is found right after. This leaks
an error string and results in not reporting the negative timeout back
to the user even though it is encountered first.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agolib/flow.h Revert bitfield back to uint64_t.
Jarno Rajahalme [Wed, 27 Aug 2014 15:21:45 +0000 (08:21 -0700)]
lib/flow.h Revert bitfield back to uint64_t.

Using different types for the two bitfields did not work on MSVC, so
reverting back to "64-bit bool" :-)

Reported-by: Saurabh Shah <ssaurabh@vmware.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agodatapath-windows: Update netlink family IDs
Nithin Raju [Wed, 27 Aug 2014 03:37:18 +0000 (20:37 -0700)]
datapath-windows: Update netlink family IDs

I didn't realize earlier while defining OvsDpInterfaceExt.h that
there are special values defined in netlink-protocol.h for nlmsg_type.
For Eg. NLMSG_ERROR is defined to be 2. In this patch, we update the
values of the family IDs to not clash with the special defines.
I'm using NLMSG_MIN_TYPE as a reference.

All this points to doing family ID lookup from the kernel rather than
returning values from netlink-socket.c. We should move to that model
after we get through the first round of netlink commands.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonetlink-socket: fix typo to get_sock_pid_from_kernel()
Nithin Raju [Wed, 27 Aug 2014 03:20:51 +0000 (20:20 -0700)]
netlink-socket: fix typo to get_sock_pid_from_kernel()

A typo crept in while respinning get_sock_pid_from_kernel() in the previous
patch. Fixing it now. Also, get_sock_pid_from_kernel() doesn't need an OUT
argument. Fixing that too.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonetlink-socket: add support for nl_lookup_genl_mcgroup()
Nithin Raju [Wed, 27 Aug 2014 03:17:03 +0000 (20:17 -0700)]
netlink-socket: add support for nl_lookup_genl_mcgroup()

While we work out whether nl_sock_join_mcgroup() will be the mechanism
to support VPORT events, it is easy to add support for
nl_lookup_genl_mcgroup() and make progress on the other commands.

In this patch, we implement support for nl_lookup_genl_mcgroup() only
for the VPORT family though, which is all what dpif-linux.c needs.

Validation:
- A ported dpif-linux.c with epoll code commented out went so far as
to call dp_enumerate! DP Dump commands can be implemented next.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: define mcgroup IDs for VPORT and other families
Nithin Raju [Wed, 27 Aug 2014 03:17:02 +0000 (20:17 -0700)]
datapath-windows: define mcgroup IDs for VPORT and other families

dpif-linux.c makes a nl_lookup_genl_mcgroup(OVS_VPORT_FAMILY) that is not
implemented yet on Windows yet. Multicast group is used currently to
subscribe to events related to VPORTs. Whether the exact same mechanism
would be used is unclear yet.

In the interim, we can implement code to support nl_lookup_genl_mcgroup().
and make progress with the other simpler commands.

In this patch, we define a ID for the VPORT MC group and use it. The IDs for
other families were also defined, but without usage, were seen as unclear.
Hence we define only the VPORT group.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoAUTHORS: Add Madhu Challa.
Ben Pfaff [Wed, 27 Aug 2014 15:05:22 +0000 (08:05 -0700)]
AUTHORS: Add Madhu Challa.

Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agovtep-ctl: Free error string before return from cmd_remove().
Madhu Challa [Wed, 27 Aug 2014 01:16:12 +0000 (18:16 -0700)]
vtep-ctl: Free error string before return from cmd_remove().

Error string should be freed in all cases.

Found by Coverity.

Signed-off-by: Madhu Challa <challa@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoFix memory leaks in error paths.
yinpeijun [Wed, 27 Aug 2014 01:52:54 +0000 (09:52 +0800)]
Fix memory leaks in error paths.

Found by Fortify.

Signed-off-by: yinpeijun <yinpeijun@huawei.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agotests: Fix race conditions.
Joe Stringer [Thu, 31 Jul 2014 22:55:59 +0000 (10:55 +1200)]
tests: Fix race conditions.

These tests had the potential to fail due to statistics not updating
before the test script retrieves them. Fix them by waiting until the
next revalidation cycle.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Fix recirc bug where skb is double freed.
Andy Zhou [Mon, 25 Aug 2014 22:18:19 +0000 (15:18 -0700)]
datapath: Fix recirc bug where skb is double freed.

If recirc action is the last action of a action list, the SKB triggers
the recirc will be freed twice. This patch fixes this bug.

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
9 years agolib/flow.h: Improve struct miniflow comment and definition.
Jarno Rajahalme [Tue, 26 Aug 2014 22:11:39 +0000 (15:11 -0700)]
lib/flow.h: Improve struct miniflow comment and definition.

Miniflows can nowadays be dynamically allocated to different inline
sizes, as done by lib/classifier.c, but this had not been documented
at the struct miniflow definition.

Also, MINI_N_INLINE had a different value for 32-bit and 64-bit builds
due to a historical reason.  Now we use 8 for both.

Finally, use change the storage type of 'values_inline' to uint8_t, as
uint64_t looks kind of wide for a boolean, even though we intend the
bit be carved out from the uint64_t where 'map' resides.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoRevert "miniflow: Remove unused values_inline branch from miniflow_move()"
Jarno Rajahalme [Tue, 26 Aug 2014 22:48:48 +0000 (15:48 -0700)]
Revert "miniflow: Remove unused values_inline branch from miniflow_move()"

This reverts commit 29d2aa3aa74ab97df0f00af5bddaa12485c1d39a.

Turns out the code was correct but the dynamic nature of miniflow
inline storage was poorly documented.  A following patch fixes the
documentation.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoAUTHORS: Add Ed Swierk.
Ben Pfaff [Tue, 26 Aug 2014 18:44:28 +0000 (11:44 -0700)]
AUTHORS: Add Ed Swierk.

Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodebian: Fix cross build.
Ed Swierk [Sun, 24 Aug 2014 17:37:29 +0000 (10:37 -0700)]
debian: Fix cross build.

Cross-building openvswitch with debuild -aARCH (or equivalent) fails
because the target architecture is not getting passed to configure.
Thus binaries like ovs-appctl get built using the build host
architecture.

Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-netdev: Fix leaked port, port->rxq, port->type in error path
Thomas Graf [Tue, 26 Aug 2014 16:36:08 +0000 (18:36 +0200)]
dpif-netdev: Fix leaked port, port->rxq, port->type in error path

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
[blp@nicira.com added free of port->type]
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoodp-util: Only add recirc_id mask to Netlink message if mask is provided
Thomas Graf [Tue, 26 Aug 2014 16:34:52 +0000 (18:34 +0200)]
odp-util: Only add recirc_id mask to Netlink message if mask is provided

Current unconditional call may result in NULL being passed to
nl_msg_put_u32().

Cc: Andy Zhou <azhou@nicira.com>
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agobuild: Use errtrace to simplify travis-ci failure detection
Thomas Graf [Tue, 26 Aug 2014 10:24:04 +0000 (12:24 +0200)]
build: Use errtrace to simplify travis-ci failure detection

Causes the build script to fail if any command inside the
script returns nonzero.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agotest-controller: Rename to ovs-testcontroller, again install.
Ben Pfaff [Fri, 15 Aug 2014 17:32:50 +0000 (10:32 -0700)]
test-controller: Rename to ovs-testcontroller, again install.

mininet uses the Open vSwitch controller by default, for testing.

CC: 757761@bugs.debian.org
Reported-at: https://bugs.debian.org/757761
Requested-by: Tomasz Buchert <tomasz.buchert@inria.fr>
Requested-by: Dariusz Dwornikowski <dariusz.dwornikowski@cs.put.poznan.pl>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agovswitch.xml: Fix a typo.
Alex Wang [Tue, 26 Aug 2014 05:42:04 +0000 (22:42 -0700)]
vswitch.xml: Fix a typo.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agojson: Fix leaked nodes in json_hash_object()
Thomas Graf [Tue, 26 Aug 2014 10:23:03 +0000 (12:23 +0200)]
json: Fix leaked nodes in json_hash_object()

nodes is allocated through shash_sort() but never freed.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agominiflow: Remove unused values_inline branch from miniflow_move()
Thomas Graf [Tue, 26 Aug 2014 10:01:34 +0000 (12:01 +0200)]
miniflow: Remove unused values_inline branch from miniflow_move()

The branch is unused as size < sizeof dst->inline_values must
always be true for inlined values. Hitting the branch would lead
to corruption as inline_values is accessed out of bounds.

Remove branch and add assertion.

Cc: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodebian: Really fix packaging given new dot-files.
Ben Pfaff [Tue, 26 Aug 2014 15:56:09 +0000 (08:56 -0700)]
debian: Really fix packaging given new dot-files.

commit a5c1096abb1 (debian: Fix debian packaging build failures due to
dot-files in tree.) contained an error that I've made before and should
have noticed.  This commit should really fix the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoodp-util: Initialize tun_key and tun_key_mask
Thomas Graf [Tue, 26 Aug 2014 00:49:55 +0000 (02:49 +0200)]
odp-util: Initialize tun_key and tun_key_mask

tun_key_to_attr() accesses tp_src and tp_dst which are currently
uinitialized.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodebian: Ignore openvswitch-vtep directory generated during packaging.
Ben Pfaff [Thu, 14 Aug 2014 18:14:46 +0000 (11:14 -0700)]
debian: Ignore openvswitch-vtep directory generated during packaging.

Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodebian: Fix debian packaging build failures due to dot-files in tree.
Ben Pfaff [Tue, 26 Aug 2014 15:18:57 +0000 (08:18 -0700)]
debian: Fix debian packaging build failures due to dot-files in tree.

openvswitch/* no longer matches all the files since commit 826bc7b61345a5d
(build: Add travis continuous integration support) added files with names
beginning with ".".

VMware-BZ: #1298353
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agodatapath: Remove flow member from struct ovs_skb_cb
Lorand Jakab [Thu, 21 Aug 2014 17:25:47 +0000 (20:25 +0300)]
datapath: Remove flow member from struct ovs_skb_cb

struct ovs_skb_cb is full on kernels < 3.11 due to compatibility code.
This patch removes the 'flow' member in order to make room for data
needed by layer 3 flow/port support that will be added in an upcoming
patch.  The 'flow' memeber was chosen for removal because it's only used
in ovs_execute_actions().

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoofproto-dpif-xlate: Drop 'may_learn' parameter from xlate_push_stats().
Ben Pfaff [Fri, 22 Aug 2014 22:32:19 +0000 (15:32 -0700)]
ofproto-dpif-xlate: Drop 'may_learn' parameter from xlate_push_stats().

Both existing callers calculated 'may_learn' as 'stats->n_packets > 0', so
it was redundant.  Because xlate_push_stats() is now entirely a no-op if
'stats->n_packets' is 0, we can now delete the tests entirely from the
cases that previously only ran if 'may_learn'.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agoofproto-dpif-xlate: Skip pushing stats if there are no packets to push.
Ben Pfaff [Fri, 22 Aug 2014 22:18:33 +0000 (15:18 -0700)]
ofproto-dpif-xlate: Skip pushing stats if there are no packets to push.

xlate_push_stats() mostly does nothing if 'stats->n_packets' is 0.  This
commit allows it to skip more complicated internal logic in that case.

The one case I see in which xlate_push_stats() does do something if
'stats->n_packets' is 0 is in the case of a cached fin_timeout translation.
That translation changes the idle and hard timeouts of a flow if tcp_flags
has FIN or RST set, even if n_packets is 0.  But I don't think that can
happen anyway; how would FIN or RST be set without receiving a packet?

More broadly, the xlate_push_stats handles two functions - pushing stats
and implementing side-effects from actions. If there are no packets, the
stats shouldn't need updating. If there were no packets, then no packets
could have hit actions for things such as mac learning/openflow learning,
so xlate_push_stats() should be a no-op.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agoofproto-dpif-xlate: Only learn MAC addresses upon handling packets.
Ben Pfaff [Fri, 22 Aug 2014 22:09:58 +0000 (15:09 -0700)]
ofproto-dpif-xlate: Only learn MAC addresses upon handling packets.

MAC learning, like flow entry learning via the "learn" action, should only
happen if a packet was actually received.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agobuild: Add travis continuous integration support
Thomas Graf [Mon, 25 Aug 2014 12:51:00 +0000 (14:51 +0200)]
build: Add travis continuous integration support

This enables the use of travis-ci via github. Linking any ovs
github repo to travis-ci [0] will automatically lead to a build
and testsuite run being triggered for each new commit or pull
requests against the repo.

The introduction of any warnings will cause the build to fail as
both gcc and clang are invoked with -Werror.

The build matrix currently includes:
  * --disable-ssl
  * --with-linux=linux-3.14.7
  * --with-dpdk=1.7.0

Each of these builds is performed with gcc+sparse and clang. The
testsuite is only run for the --with-linux build to keep the total
build time on an acceptable level.

Build failures are reported to the author and commiter by email,
through the travis-ci web UI, and in the github pull request.

A full build report example can be found here [1]

[0] http://travis-ci.org/
[1] https://travis-ci.org/tgraf/ovs/builds/33485228

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto-dpif-xlate: Rename xlate_receive() as xlate_lookup().
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:36 +0000 (09:01 -0700)]
ofproto-dpif-xlate: Rename xlate_receive() as xlate_lookup().

Seems better as we no longer modify the flow.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto-dpif-xlate: Do not take references in xlate_receive().
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:36 +0000 (09:01 -0700)]
ofproto-dpif-xlate: Do not take references in xlate_receive().

xlate configuration (via xcfg) is already holding the references, so
the callers of xlate_receive() can safely use the returned pointers
upto the point when they quiesce.  If the objects are needed for
longer term, the callers can take additional references themselves.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto-dpif-upcall: Remove struct upcall netflow member.
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:36 +0000 (09:01 -0700)]
ofproto-dpif-upcall: Remove struct upcall netflow member.

The netflow member was not used for anything, so it can be removed.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto/xlate: Add xlate_lookup_ofproto().
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:36 +0000 (09:01 -0700)]
ofproto/xlate: Add xlate_lookup_ofproto().

"xlate_receive" did not tell much about what it is used for.  We have
two users of it that only want the ofproto and the OF port number, use the
new xlate_lookup_ofproto() for those.

Fix the comments of xlate_receive() as we no longer change the flow.

Also, the helper ofproto_dpif_contains_flow() seemed ill-named, so this
path removes it and uses xlate_lookup_ofproto() directly.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Use OVS_DEFAULT_PORT_NO instead of 0 in a few places
Nithin Raju [Fri, 15 Aug 2014 04:02:15 +0000 (21:02 -0700)]
datapath-windows: Use OVS_DEFAULT_PORT_NO instead of 0 in a few places

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
9 years agodatapath-windows: remove reference to OvsNetlink.h
Ankur Sharma [Fri, 22 Aug 2014 17:00:29 +0000 (10:00 -0700)]
datapath-windows: remove reference to OvsNetlink.h

In this patch we remove reference to OvsNetlink.h.
Since we do not refer to lib/netlink-protocol.h anymore,
hence removed the WIN_DP based check as well.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/18
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Using windows kernel netlink parsing APIs.
Ankur Sharma [Fri, 22 Aug 2014 17:00:13 +0000 (10:00 -0700)]
datapath-windows: Using windows kernel netlink parsing APIs.

In this patch we incorporate the usage of netlink message
and the parsing APIs that were added in previous commit.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/18
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: add netlink message parsing APIs
Ankur Sharma [Fri, 22 Aug 2014 16:59:59 +0000 (09:59 -0700)]
datapath-windows: add netlink message parsing APIs

In this change we introduce Netlink.c, Netlink.h and NetlinkProto.h
in datapath-windows. These files will provide netlink message
data structures and parsing APIs.

Changes are on similar lines to userspace netlink code.

We have mapped the userspace APIs and data structures to
kernel coding convention.
for example:
nlmsghdr ==> NL_MSG_HDR
nl_attr_get ==> NlAttrGet

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/18
Acked-by: Nithin Raju <nithin@vmware.com>
Acked-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonetlink-socket.c: add support for do_lookup_genl_family on Windows
Nithin Raju [Fri, 22 Aug 2014 08:16:44 +0000 (01:16 -0700)]
netlink-socket.c: add support for do_lookup_genl_family on Windows

In this patch, we add support for querying the genl family id for any
family supported by the OVS kernel datapath. On platforms that support
netlink natively, the operating system assigns a family ID, and the
OS netlink infrastructure supports querying the family ID by name.

In case of Windows, since OVS datpath provides the netlink support,
it is not necessary to make a call into the kernel. Returning a
family ID that is consistent between the userspace and kernel
is sufficient. Once there is code to support netlink message parsing
as well as constructing netlink messages, we can make a call into
the kernel, but that in itself may not buy anything more than this
approach.

This patch is a precursor to make progress of the other commands.
The next hurdle is to support nl_lookup_genl_mcgroup().

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: define a version number in DP extensions
Nithin Raju [Fri, 22 Aug 2014 08:16:43 +0000 (01:16 -0700)]
datapath-windows: define a version number in DP extensions

We need a version number for the datapath interface extensions that
we can leverage at some point.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-ofctl: Document that "move" uses a standard action in OF1.5+.
Ben Pfaff [Thu, 21 Aug 2014 05:22:58 +0000 (22:22 -0700)]
ovs-ofctl: Document that "move" uses a standard action in OF1.5+.

Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jean Tourrilhes <jt@hpl.hp.com>
9 years agotests: Add test that 1.5 copy-field can copy into the standardized xregs.
Jean Tourrilhes [Thu, 21 Aug 2014 00:40:41 +0000 (17:40 -0700)]
tests: Add test that 1.5 copy-field can copy into the standardized xregs.

Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovsdb: Allow comparison on optional scalar types
Terry Wilson [Tue, 19 Aug 2014 23:28:55 +0000 (17:28 -0600)]
ovsdb: Allow comparison on optional scalar types

This allows things like initiating a wait request on an interface
ofport being set.

When the optional field is empty and operation is != or excludes
then the result is true; otherwise it is false. If the field is
set then the field is compared normally for its type.

Signed-off-by: Terry Wilson <twilson@redhat.com>
[blp@nicira.com updated ovsdb-server(1) and NEWS.]
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonetlink-socket.c: implement get pid support on Windows
Nithin Raju [Tue, 19 Aug 2014 20:51:54 +0000 (13:51 -0700)]
netlink-socket.c: implement get pid support on Windows

To verify if the netlink support in the kernel works, I updated
the netlink-socket.c code to get the PID for a given device
descriptor.

In the existing code, userspace sets the PID, which will not be
unique across different processes. So, it is better for the
kernel to generate the PID and give it back to userspace.

dpif-linux.c was ported to Windows (similar to Alin's change in
the cloudbase repo) and was able to exercise the code changes
in netlink-socket.c to read the PID. dpif-linux.c changes are
not being checked in.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/18
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: add infrastructure for supporting netlink
Nithin Raju [Tue, 19 Aug 2014 20:51:53 +0000 (13:51 -0700)]
datapath-windows: add infrastructure for supporting netlink

In this change, we define netlink families and commands supported
by the Windows datapath. Only the control family and one command
is supported today to get the PID.

We also implement the 3 ioctls: read, write and transact. This is
bare minimum and can be used to implement the equivalent of a
recv, send, and send-recv in userspace netlink. This interface
is subject to change as iron out the details of the user-kernel
interface for operations around packet receive, events, dump, etc.

We also turn on OVS_USE_NL_INTERFACE to 1 in the ovsext project.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/18
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Add Datapath.[ch] and OVS_USE_NL_INTERFACE CPP
Nithin Raju [Tue, 19 Aug 2014 20:51:52 +0000 (13:51 -0700)]
datapath-windows: Add Datapath.[ch] and OVS_USE_NL_INTERFACE CPP

In this change we create peer to OvsIoctl.[ch] that would interface
with userspace using the netlink interface. The new files are called
Datapath.[ch]. We are not deleting OvsIoctl.[ch] yet. Datapath.[ch]
provides bare minimum functionality to register a pseudo device for
communication with userspace.

We also define a CPP called OVS_USE_NL_INTERFACE in the ovsext project.
This defines if the old interface (pre-netlink based) or the new
interface (netlink- based) should be enabled in the kernel. By default,
the value is 0 since the Datapath.[ch] are minimal. In the next change,
we'll turn it to 1.

Since Datapath.[ch] containes code copied from OvsIoctl.[ch], acking
the original author as well.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Co-authored-by: Guolin Yang <gyang@vmware.com>
Acked-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoAdd extentions to the standard datapath interface
Nithin Raju [Tue, 19 Aug 2014 20:51:51 +0000 (13:51 -0700)]
Add extentions to the standard datapath interface

The datapath interface defined in odp-netlink.h needs some extensions
that are platform dependent. Some examples are the name of the communication
device on Windows and a set of commands that are specific to Windows.

In this change we define a datapath-windows/include/OvsDpInterfaceExt.h
to include any platform specific interface extensions.

OvsDpInterfaceExt.h is in turn included in odp-netlink.h ONLY for _WIN32.
This approach was chosen to avoid including OvsDpInterfaceExt.h directly
although the latter approach is as good as the former.

Also, we define three ioctls in OvsDpInterfaceExt.h:
read:     provides an output buffer (mimics a recv)
write:    provides an input buffer (mimics a send)
transact: provides an input and optionally an output buffer.
          (mimics a send followed by recv)

Signed-off-by: Nithin Raju <nithin@vmware.com>
Co-Authored-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agobfd: Clarify bfd:enable.
Alex Wang [Wed, 20 Aug 2014 02:06:04 +0000 (02:06 +0000)]
bfd: Clarify bfd:enable.

This commit clarifies the documentation for 'bfd:enable'
when it is not specified.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agofat-rwlock: fat_rwlock_tryrdlock() should never block
Daniele Di Proietto [Mon, 18 Aug 2014 19:57:42 +0000 (12:57 -0700)]
fat-rwlock: fat_rwlock_tryrdlock() should never block

fat_rwlock_tryrdlock() used to call fat_rwlock_get_slot__() which could block
in the "slow path" case. This commit adds fat_rwlock_try_get_slot__() which
does not block, even in the "slow path" case.

This fixes a minor issue in dpif-netdev: when the datapath has no registered
upcall handler (e.g. if it is created with dpctl commands), dp_netdev_input()
hangs if it does not find a packet's flow in the classifier.  This is
because dpif-netdev uses its upcall_rwlock as a way to enable and disable
upcalls and thus holds the upcall_rwlock write lock as long as upcalls are
disabled.  Both holding the write lock and creating a slot require the
fat_rwlock's mutex, causing the hang.

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoacinclude.m4: Do not set vswitchd_ovs_vswitchd_LDFLAGS
Daniele Di Proietto [Tue, 19 Aug 2014 01:23:55 +0000 (01:23 +0000)]
acinclude.m4: Do not set vswitchd_ovs_vswitchd_LDFLAGS

Commit d731058395cb used vswitchd_ovs_vswitchd_LDFLAGS to link with DPDK. This
made automake ignore AM_LDFLAGS while linking the daemon.

This commit explicitly adds AM_LDFLAGS to vswitchd_ovs_vswitchd_LDFLAGS and
moves it to vswitchd/automake.mk

Reported-by: Gurucharan Shetty <gshetty@nicira.com>
Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agonetinet/in.h: Add definition for IPPROTO_GRE.
Gurucharan Shetty [Mon, 18 Aug 2014 14:41:34 +0000 (07:41 -0700)]
netinet/in.h: Add definition for IPPROTO_GRE.

Commit b7ea2d480338(Extend OVS IPFIX exporter to export tunnel headers)
added a usage for IPROTO_GRE. But that does not look available in any
Visual Studio headers. So add it.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-vtep: Clarifications on the README.
Mark Maglana [Fri, 15 Aug 2014 03:03:10 +0000 (03:03 +0000)]
ovs-vtep: Clarifications on the README.

The README was not clear on whether the steps are for attaching physical
or virtual machines to the emulated VTEP. This adds more detail to the
README so that readers will know what to do if they want to attach physical
machines or otherwise.

Signed-off-by: Mark Maglana <mmaglana@gmail.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agoExtend OVS IPFIX exporter to export tunnel headers
Wenyu Zhang [Mon, 18 Aug 2014 03:19:36 +0000 (20:19 -0700)]
Extend OVS IPFIX exporter to export tunnel headers

Extend IPFIX exporter to export tunnel headers when both input and output
of the port.
Add three other_config options in IPFIX table: enable-input-sampling,
enable-output-sampling and enable-tunnel-sampling, to control whether
sampling tunnel info, on which direction (input or output).
Insert sampling action before output action and the output tunnel port
is sent to datapath in the sampling action.
Make datapath collect output tunnel info and send it back to userpace
in upcall message with a new additional optional attribute.
Add a tunnel ports map to make the tunnel port lookup faster in sampling
upcalls in IPFIX exporter. Make the IPFIX exporter generate IPFIX template
sets with enterprise elements for the tunnel info, save the tunnel info
in IPFIX cache entries, and send IPFIX DATA with tunnel info.
Add flowDirection element in IPFIX templates.

Signed-off-by: Wenyu Zhang <wenyuz@vmware.com>
Acked-by: Romain Lenglet <rlenglet@vmware.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agolib/dpif-netdev: Clean-up pmd thread signaling.
Jarno Rajahalme [Fri, 15 Aug 2014 22:09:38 +0000 (15:09 -0700)]
lib/dpif-netdev: Clean-up pmd thread signaling.

It could be possible that the thread misses a signal when it reads the
change_seq again after reload.  Also, the counter has no dependent
data, so the memory model for the atomic read can be relaxed.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoofproto-dpif-upcall: Fix use of cleared stack memory.
Alex Wang [Fri, 15 Aug 2014 07:59:36 +0000 (00:59 -0700)]
ofproto-dpif-upcall: Fix use of cleared stack memory.

Commit cc377352d (ofproto: Reorganize in preparation for direct
dpdk upcalls.) introduced the bug that uses variable defined on
the stack inside while loop for reading dpif upcalls and keeps
reference to attributes of the variable within the same function
after the stack is cleared.  This bug can cause ovs abort.

This commit fixes the above issue by defining an array of the
variable on the function stack.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agoFAQ: Mention kernel support for MPLS in Open vSwitch 2.4.
Ben Pfaff [Thu, 14 Aug 2014 18:02:38 +0000 (11:02 -0700)]
FAQ: Mention kernel support for MPLS in Open vSwitch 2.4.

The recent mailing list thread about MPLS reminded me that the FAQ needs an
update.

CC: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>
9 years agodatapath-windows: Use local time for Inf2Cat
Alin Serdean [Wed, 13 Aug 2014 15:14:32 +0000 (15:14 +0000)]
datapath-windows: Use local time for Inf2Cat

Issue: cannot build properly when local date differs from UTC date, see:
    https://connect.microsoft.com/VisualStudio/feedback/details/787203/driver-package-building-problem

Since Stampinf stamps the driver inf file with the local date set the Inf2Cat
to use local date as well.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-actions: Include OFPACT_REG_MOVE in action set
Thomas Graf [Thu, 14 Aug 2014 23:01:50 +0000 (01:01 +0200)]
ofp-actions: Include OFPACT_REG_MOVE in action set

Treating OFPACT_REG_MOVE as a "set" action preserves the order of loads
and moves and allows a load to overwrite a previous move to the same
register.

This makes the following work:

add-group br0 group_id=1234,type=all, \
              bucket=output:10,move:NXM_NX_REG1[]->NXM_OF_IP_SRC[], \
  bucket=output:11
add-flow br0 ip actions=load:0xffffffff->NXM_NX_REG1[],group:1234

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Move key_attr_size() to flow_netlink.h.
Joe Stringer [Fri, 15 Aug 2014 05:07:28 +0000 (17:07 +1200)]
datapath: Move key_attr_size() to flow_netlink.h.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoofproto-dpif-upcall: Properly initialize 'recv_buf'.
Ethan Jackson [Thu, 14 Aug 2014 22:48:00 +0000 (15:48 -0700)]
ofproto-dpif-upcall: Properly initialize 'recv_buf'.

Due to a typo, the latest upcall refactoring caused dpif_recv() to be
called on an un-initialized chunk of memory.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Reported-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agobfd: Clarify the BFD diagnostic.
Alex Wang [Fri, 15 Aug 2014 02:02:06 +0000 (02:02 +0000)]
bfd: Clarify the BFD diagnostic.

This commit adds more explanation for the bfd diagnostic and
bfd remote diagnostic in vswitch and vtep documentation.

Requested-by:Bruce Davie <bdavie@vmware.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
9 years agodpif-netdev: Streamline miss handling.
Ethan Jackson [Sat, 26 Jul 2014 22:39:58 +0000 (15:39 -0700)]
dpif-netdev: Streamline miss handling.

This patch avoids the relatively inefficient miss handling processes
dictated by the dpif process, by calling into ofproto-dpif directly
through a callback.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto: Reorganize in preparation for direct dpdk upcalls.
Ethan Jackson [Thu, 7 Aug 2014 01:49:44 +0000 (18:49 -0700)]
ofproto: Reorganize in preparation for direct dpdk upcalls.

This patch reorganizes ofproto-dpif in preparation for future patches
which allow direct upcall processing from dpif-netdev.  The main goals
are to share as much code as possible between the dpif-linux and
dpif-netdev upcall paths.  Additionally, to avoid confusing the
dpif-netdev fast path, the packet processing path should treat packets
and struct flow's as const.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoflow: Parse MPLS should return the actual number of labels.
Ethan Jackson [Fri, 1 Aug 2014 21:47:44 +0000 (14:47 -0700)]
flow: Parse MPLS should return the actual number of labels.

This problem is uncovered by a future patch.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoFix capitalization of "Open vSwitch".
Justin Pettit [Thu, 14 Aug 2014 20:13:16 +0000 (13:13 -0700)]
Fix capitalization of "Open vSwitch".

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoFix capitalization of OpenFlow.
Justin Pettit [Thu, 14 Aug 2014 20:12:12 +0000 (13:12 -0700)]
Fix capitalization of OpenFlow.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoSet release dates for 2.3.0.
Justin Pettit [Thu, 14 Aug 2014 18:03:39 +0000 (11:03 -0700)]
Set release dates for 2.3.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Simplify flow mask cache delete.
Pravin B Shelar [Wed, 13 Aug 2014 07:02:18 +0000 (00:02 -0700)]
datapath: Simplify flow mask cache delete.

Currently on mask delete OVS moves last mask to the deleted
place to keep flow cache consistent and compact for per cpu
cache. But that generate duplicate entries in mask cache array
which results in multiple flow lookups in case we miss flow
cache.
Following patch simply sets NULL for deleted entry.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agometa-flow: Correct comments on MFF_XREG*.
Ben Pfaff [Thu, 14 Aug 2014 18:47:45 +0000 (11:47 -0700)]
meta-flow: Correct comments on MFF_XREG*.

These are 64-bit, not 32-bit, registers.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoovs-lib: Add process name checking when start ovs service
Chunhe Li [Wed, 6 Aug 2014 06:26:20 +0000 (14:26 +0800)]
ovs-lib: Add process name checking when start ovs service

Avoids "false positive" for the service already running due to pid reuse.

Signed-off-by: Chunhe Li <lichunhe@huawei.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported-by: Wuyunfei <wuyunfei@huawei.com>
9 years agobfd: Add configuration for setting and matching mac address.
Alex Wang [Fri, 8 Aug 2014 23:41:27 +0000 (16:41 -0700)]
bfd: Add configuration for setting and matching mac address.

This commit adds options for configuring the MAC addresses
in BFD state machine.  Therein, the "bfd_local_src_mac" and
"bfd_local_dst_mac" configure the MAC address for transmitted
BFD packets.  The "bfd_remote_dst_mac" configure the matching
of MAC address on received BFD packets.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agobfd: Flip the default value of bfd ip source and destination.
Alex Wang [Fri, 8 Aug 2014 22:50:14 +0000 (15:50 -0700)]
bfd: Flip the default value of bfd ip source and destination.

This commit flips the default value of bfd ip source and destination,
so that they match the default value of ip destination and source
of vtep schema.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agodpif: Support flow_get in dpif_operate().
Joe Stringer [Tue, 12 Aug 2014 21:55:54 +0000 (09:55 +1200)]
dpif: Support flow_get in dpif_operate().

This cleans up the dpif interface to make it more consistent with the
other dpif operations, and allows flows to be fetched in batches.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-numa: Correct printf format specifiers.
Ben Pfaff [Wed, 13 Aug 2014 21:19:21 +0000 (14:19 -0700)]
ovs-numa: Correct printf format specifiers.

list_size() yields a size_t, not uint64_t, and these types are different on
32-bit targets.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agodatapath-windows: check source port during tunnel Tx
Nithin Raju [Wed, 13 Aug 2014 05:59:29 +0000 (22:59 -0700)]
datapath-windows: check source port during tunnel Tx

In the Windows datapath, Tx tunneling functionality is implemented by checking
if the outport in the action is a tunnel port. If so, the packet is
encapsulated and sent out on the PIF bridge for as second flow lookup.
Basically, we don't use the hypervisor's IP stack to send out a packet, and
short circuit the path ourselves. On the PIF bridge, the source port of the
encapsulated packet is the VTEP port ie. the internal port.

If a Tunneling port is added to the PIF bridge (a possible misconfiguration),
where the VTEP(internal) port and the external port (physical NIC) also reside,
a flooding action can cause a loop, by re-injecting the packet on the same PIF
bridge which again floods to the tunnel port.

In this change, we break the loop by encapsulating packets only if they are
sent out by a VIF or if they originate from userspace ie. userspace generated.
We make use of the input port attribute in the packet execute ioctl.

This change is based off of the legacy datapath interface published in
OvsPub.h. This interface has a input port field in the packet execute ioctl.
I looked in dpif-linux.c that uses the netlink based datapath interface and
even in that case, we do add the the source port in:
    dpif_linux_encode_execute() -> odp_key_from_pkt_metadata().
So, this fix is applicable when we adopt the netlink based datapath interface
as well.

The Rx side of OvsDetectTunnelPkt() has only documentation updates. The fix is
on the Tx side.

Validation (using dpif-windows.c):
- Was able to perform VTEP <-> VTEP ping with the configuration posted in the
issue.
- Was able to perform VIF <-> VIF ping when the setup was configured correctly.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Reported-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/20
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-numa: Add ovs-numa.{c,h} for extracting and storing cpu
Alex Wang [Mon, 16 Jun 2014 17:48:01 +0000 (10:48 -0700)]
ovs-numa: Add ovs-numa.{c,h} for extracting and storing cpu
socket and cpu core info.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoPrepare include headers
Alin Serdean [Wed, 13 Aug 2014 15:16:07 +0000 (15:16 +0000)]
Prepare include headers

Preparing the include headers needed to compile dpif-linux.c with MSVC.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoNo newline at end of file
Alin Serdean [Wed, 13 Aug 2014 15:15:21 +0000 (15:15 +0000)]
No newline at end of file

Adding newline at end of the following files: packet.h, uio.h.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Fix memory leak in ovs_vport_alloc() error path
Christoph Jaeger [Wed, 13 Aug 2014 03:25:07 +0000 (20:25 -0700)]
datapath: Fix memory leak in ovs_vport_alloc() error path

ovs_vport_alloc() bails out without freeing the memory 'vport' points
to.

Picked up by Coverity - CID 1230503.

Fixes: beb1c69a3 ("datapath: Allow each vport to have an array of
'port_id's.")
Signed-off-by: Christoph Jaeger <cj@linux.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agonetdev-dpdk: Keep calling rte_eth_tx_burst() until it returns 0
Daniele Di Proietto [Tue, 12 Aug 2014 17:43:36 +0000 (10:43 -0700)]
netdev-dpdk: Keep calling rte_eth_tx_burst() until it returns 0

rte_eth_tx_burst() _should_ transmit every packet that it is passed unless the
queue is full. Nontheless some implementation of rte_eth_tx_burst (e.g.
ixgbe_xmit_pkts_vec()) does not transmit more than a fixed number (32) of
packets at a time.

With this commit we assume that there's an error only if rte_eth_tx_burst
returns 0.

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.0
Daniele Di Proietto [Tue, 12 Aug 2014 17:43:35 +0000 (10:43 -0700)]
netdev-dpdk: Move to DPDK 1.7.0

With this commit we move our DPDK support to 1.7.0.
DPDK binaries (starting with dpdk 1.7.0) should be linked with --whole-archive
to include pmd drivers

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodpif-netdev: Reintroduce ref_cnt for dp_netdev_flow
Daniele Di Proietto [Tue, 12 Aug 2014 00:25:50 +0000 (17:25 -0700)]
dpif-netdev: Reintroduce ref_cnt for dp_netdev_flow

struct dp_netdev_flow used to have a reference counter.
It has been replaced by RCU. Unfortunately RCU is not
enough if we plan to hold a reference to the dp_netdev_flow
for a long time. So this commit reintroduces reference
counting for struct dp_netdev_flow

Subsequent commits make use of it.

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoofp-errors: Use EXT-444 extension error codes for properties in OF1.3.
Ben Pfaff [Mon, 11 Aug 2014 21:31:29 +0000 (14:31 -0700)]
ofp-errors: Use EXT-444 extension error codes for properties in OF1.3.

These error codes are proposed in the ONF extensibility working group as an
OpenFlow 1.3 extension.

Error codes are also proposed for the other three "bad property" error
codes, but those already have standardized OpenFlow 1.3 error codes and the
proposal says that implementations should use the standard ones.

ONF-JIRA: EXT-444.
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoMakefiles: Add ofp-actions.inc1 and ofp-actions.inc2 to gitignore.
Ben Pfaff [Tue, 12 Aug 2014 20:32:01 +0000 (13:32 -0700)]
Makefiles: Add ofp-actions.inc1 and ofp-actions.inc2 to gitignore.

Requested-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agolearning-switch: Make test-controller work with OpenFlow 1.3+.
Ben Pfaff [Wed, 16 Jul 2014 20:28:40 +0000 (13:28 -0700)]
learning-switch: Make test-controller work with OpenFlow 1.3+.

The controller setup in my personal test environment has been broken for a
while.  I figured that it wasn't anything important, though, because no one
else had reported similar problems.  Anyway, it turns out that enabling
OpenFlow 1.3 by default broke test-controller because OpenFlow 1.3 doesn't
send table misses to the controller by default.  This commit fixes the
problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agolib/netlink-protocol.h: Do not include headers for windows kernel build.
Ankur Sharma [Tue, 12 Aug 2014 18:36:27 +0000 (11:36 -0700)]
lib/netlink-protocol.h: Do not include headers for windows kernel build.

Added saurabh's fix to not to include some header files
in lib/netlink-protocol.h not needed by windows driver.

This is a temporary fix to make sure that windows driver can compile.

We are working in parallel on adding netlink support in windows driver
(https://github.com/openvswitch/ovs-issues/issues/18). With netlink support
changes we will get rid of the dependency on lib/netlink-protocol.h.

Testing:
1. Verified make distcheck on linux.
2. Verified that windows driver can compile now.
3. Verified that ping works over vxlan tunnel.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Co-authored-by: Saurabh Shah <ssaurabh@vmware.com>
Tested-by: Ankur Sharma <ankursharma@vmware.com>
Reported-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/21
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoMakefiles: Clean lib/ofp-actions.inc1 and lib/ofp-actions.inc2.
Ben Pfaff [Tue, 12 Aug 2014 18:43:43 +0000 (11:43 -0700)]
Makefiles: Clean lib/ofp-actions.inc1 and lib/ofp-actions.inc2.

Fixes a failure with make distcheck.

Reported-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-actions: Make struct ofpact constant size across implementations.
Ben Pfaff [Tue, 12 Aug 2014 18:42:56 +0000 (11:42 -0700)]
ofp-actions: Make struct ofpact constant size across implementations.

Before commit c2d936a44fa6 (ofp-actions: Centralize all OpenFlow action
code for maintainability.), struct ofpact was 4 bytes with GCC and Clang,
and 12 bytes with other compilers.  That commit changed struct ofpact so
that it remained 4 bytes with GCC and Clang but shrank to 8 bytes on other
compilers.  An unexpected side effect of that change was that the size
of the pad[] array in struct ofpact_nest shrank to 0 bytes, because that
array padded to a multiple of 8 bytes.  MSVC does not support 0-element
arrays, so this caused a build failure.

This commit fixes the problem by changing struct ofpact so that it is 4
bytes with every compiler.

Reported-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alin Serdean <aserdean@cloudbasesolutions.com>
9 years agodatapath: Update flow key before recirc
Andy Zhou [Mon, 11 Aug 2014 21:02:45 +0000 (14:02 -0700)]
datapath: Update flow key before recirc

When flow key becomes invalid due to push or pop actions, current
implementation leaves it as invalid, only rebuild the flow key used
for recirculation.

This works, but is less efficient in case of multiple recirc
actions. Each recirc action will have to re-extract
its own flow keys.

This patch update the original flow key as soon as the first recirc
action is encountered, avoiding expensive flow extract call for any
future recirc actions as long as the flow key remains valid.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodpif-provider: Get rid of redundant operations.
Ben Pfaff [Tue, 15 Jul 2014 23:09:40 +0000 (16:09 -0700)]
dpif-provider: Get rid of redundant operations.

The dpif provider 'operate' call duplicates all of the features available
from the 'flow_put', 'flow_del', and 'execute' calls, yielding redundant
code in providers that support both mechanisms.  This change drops the
latter calls in favor of making every dpif provider support 'operate'.
The result is code that is overall less duplicative.

It might make sense to do the same with flow_get but so far 'operate'
doesn't support flow_get.

Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoPackaging: Add useful files for debian and rhel.
Pravin B Shelar [Mon, 11 Aug 2014 21:35:19 +0000 (14:35 -0700)]
Packaging: Add useful files for debian and rhel.

CC: Ben Pfaff <blp@nicira.com>
Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodpdk: Update documentation.
Pravin B Shelar [Thu, 7 Aug 2014 19:40:34 +0000 (12:40 -0700)]
dpdk: Update documentation.

Add usage info for ovs-vswitchd dpdk option. Update
INSTALL.DPDK file and man page.

Reported-by: Hari Sasank Bhamidipalli <hbhamidi@cisco.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
9 years agoodp-netlink.h: Autogenerate a version of odp-netlink for windows kernel.
Ankur Sharma [Mon, 11 Aug 2014 18:43:22 +0000 (11:43 -0700)]
odp-netlink.h: Autogenerate a version of odp-netlink for windows kernel.

Autogenerated odp-netlink.h will not compile with windows kernel, as
it refers to some userspace files like openvswitch/types.h and
packets.h which hyperv extension does not access. Due to this the
windows datapath compilation is broken on tip of tree. This patch
intends to fix that.

In this patch we add a new sed script "extract-odp-netlink-windows-dp-h"
to create OvsDpInterface.h. It works on similar lines as
extract-odp-netlink-h, but avoids including the header files
which are not available for driver.

After this fix, a userspace build will be needed before windows
kernel datapath can be built.

Tested that hyperv extension could be built after building
the userspace. Verified vxlan tunnel based ping across
hypervisors. Verified that odp-netlink-windows-dp.h is not
built for linux platform. Ran 'make distcheck' to verify that
nothing is broken on linux.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Co-authored-by: Saurabh Shah <ssaurabh@vmware.com>
Tested-by: Ankur Sharma <ankursharma@vmware.com>
Reported-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Reported-by: Nithin Raju <nithin@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/21
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-actions: Use specific error code for oxm_hasmask=1 in Set-Field.
Ben Pfaff [Mon, 11 Aug 2014 21:13:53 +0000 (14:13 -0700)]
ofp-actions: Use specific error code for oxm_hasmask=1 in Set-Field.

Based on the OpenFlow 1.5 draft.

ONF-JIRA: EXT-425
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoofp-actions: Avoid logging 64 times as many actions as actually provided.
Ben Pfaff [Mon, 11 Aug 2014 21:13:27 +0000 (14:13 -0700)]
ofp-actions: Avoid logging 64 times as many actions as actually provided.

The following commit adds a test.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoofp-actions: Add support for OpenFlow 1.5 (draft) Copy-Field action.
Ben Pfaff [Thu, 7 Aug 2014 23:18:51 +0000 (16:18 -0700)]
ofp-actions: Add support for OpenFlow 1.5 (draft) Copy-Field action.

ONF-JIRA: EXT-320
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoovs-ofctl: Generalize action and instruction test commands.
Ben Pfaff [Thu, 7 Aug 2014 23:03:42 +0000 (16:03 -0700)]
ovs-ofctl: Generalize action and instruction test commands.

Until now, there were four of these commands: parse-ofp10-actions,
parse-ofp10-instructions, parse-ofp11-actions, parse-ofp11-instructions.
This is painful to add support for new OpenFlow versions and has a ton of
cut-and-paste code.  This commit generalizes the code to improve on both
of those points.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoofp-actions: Centralize all OpenFlow action code for maintainability.
Ben Pfaff [Mon, 11 Aug 2014 19:50:36 +0000 (12:50 -0700)]
ofp-actions: Centralize all OpenFlow action code for maintainability.

Until now, knowledge about OpenFlow has been somewhat scattered around the
tree.  Some of it is in ofp-actions, some of it is in ofp-util, some in
separate files for individual actions, and most of the wire format
declarations are in include/openflow.  This commit centralizes all of that
in ofp-actions.

Encoding and decoding OpenFlow actions was previously broken up by OpenFlow
version.  This was OK with only OpenFlow 1.0 and 1.1, but each additional
version added a new wrapper around the existing ones, which started to
become hard to understand.  This commit merges all of the processing for
the different versions, to the extent that they are similar, making the
version differences clearer.

Previously, ofp-actions contained OpenFlow encoding and decoding, plus
ofpact formatting, but OpenFlow parsing was separated into ofp-parse, which
seems an odd division.  This commit moves the parsing code into ofp-actions
with the rest of the code.

Before this commit, the four main bits of code associated with a particular
ofpact--OpenFlow encoding and decoding, ofpact formatting and parsing--were
all found far away from each other.  This often made it hard to see what
was going on for a particular ofpact, since you had to search around to
many different pieces of code.  This commit reorganizes so that all of the
code for a given ofpact is in a single place.

As a code refactoring, this commit has little visible behavioral change.
The update to ofproto-dpif.at illustrates one minor bug fix as a side
effect: a flow that was added with the action "dec_ttl" (a standard
OpenFlow action) was previously formatted as "dec_ttl(0)" (using a Nicira
extension to specifically direct packets bounced to the controller because
of too-low TTL), but after this commit it is correctly formatted as
"dec_ttl".

The other visible effect is to drop support for the Nicira extension
dec_ttl action in OpenFlow 1.1 and later in favor of the equivalent
standard action.  It seems unlikely that anyone was really using the
Nicira extension in OF1.1 or later.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>