ofp-actions: Remove unneeded redeclaration of vlog_rate_limit rl.

Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
dpif_netdev_execute: Extract flow key from the packet.

Extract the flow key from the packet instead of the execute->key.
This reflects how the kernel datapath behaves.

Also use ofpbuf_clone_with_headroom() instead of open coding the same.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
dpif-netdev: Maintain the original key during execution.

Userspace action needs the original flow key.  This also
matches the kernel datapath behavior.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
meta-flow: Fix typo in error message.

Signed-off-by: Ben Pfaff <blp@nicira.com>
bitmap: New macro BITMAP_N_LONGS for use in constant expressions.

An upcoming commit will declare a bitmap on the stack, rather than heap
allocating it, which means that it is not possible to use a function call
in the declaration.

Signed-off-by: Ben Pfaff <blp@nicira.com>
util: New function ovs_scan().

This new function is essentially an implementation of sscanf() with
slightly different behavior (see the comment) that is more convenient for
Open vSwitch internal use.  Also, this implementation ought to work out of
the box on Windows, which has a defective sscanf() that lacks the 'hh'
modifier required to scan into a char variable.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Switch from sscanf() to ovs_scan() throughout the tree.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-actions: Consider L4 actions after mpls_push as inconsistent

After an mpls_push action the resulting packet is MPLS and
the MPLS payload is opaque. Thus nothing can be assumed
about the packets network protocol and it is inconsistent
to apply L4 actions.

With regards to actions that affect the packet at other layers
of the protocol stack:

* L3: The consistency of L3 actions should already be handled correctly
  by virtue of the dl_type of the flow being temporarily altered
  during consistency checking by both push_mpls and pop_mpls actions.

* MPLS: The consistency checking of MPLS actions appear to already be
  handled correctly.

* VLAN: At this time Open vSwitch on mpls_push an MPLS LSE is always
  added after any VLAN tags that follow the ethernet header.
  That is the tag ordering defined prior to OpenFlow1.3. As such
  VLAN actions should sill be equally valid before and after mpls_push
  and mpls_pop actions.

* L2 actions are equally valid before and after mpls_push and mpls_pop actions.

Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
util: Fix bad constant in ovs_scan() implementation on 64-bit.

scan_chars() compares an "unsigned int" against SIZE_MAX, which will
always be false on 64-bit architectures.  The correct constant is
UINT_MAX.

Reported-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
dpif-linux: Fix minor typo OVS_DP_ATTR_UPCALL_PID

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/util: Make raw_ctz() implementation non-static.

Signed-off By: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/util: Add ctz64() and popcount64().

Add raw_ctz64(), ctz64(), and popcount64() using builtins when
available.

Signed-off By: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
miniflow: Use 64-bit map.

Signed-off By: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
configure.ac: Make autoconf in Mingw happy.

Autoconf version 2.68 in Mingw environment does not
like the new lines in AC_CONFIG_FILES macro.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
configure.ac: Identify when compiling on windows.

Presence of windows.h will set the WIN32 variable.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
configure: Windows can have spaces in directories.

Running ./configure and testing for python through PATH
gives out a bunch of errors because of the extra arguments.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Makefile.am: Make PYTHONPATH work on Mingw.

The ":" used as a seperator does not work when
the make is run. ";" is the correct separator.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
util: Make raw_ctz() accept 64-bit integers.

Having a single function that can do raw_ctz() on any integer type is
easier for callers to get right, and there is no real downside in the
implementation.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
util: Make popcount() handle 64-bit integers, not separate popcount64().

Having a single function that can do popcount() on any integer type is
easier for callers to get right.  The implementation is probably slower
if the caller actually provides a 32-bit (or shorter) integer, but the
only existing callers always provide a full 64-bit integer so this seems
unimportant for now.

This also restores use, in practice, of the optimized implementation of
population count.  (As the comment on popcount32() says, this version is
2x faster than __builtin_popcount().)

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

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>