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>
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>
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>
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>
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>
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>
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>
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>
datapath: Fix compat checks for ipv6_skip_exthdr()

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
tests: Make sure test for actset_output tests initial condition.

ONF-JIRA: EXT-233
Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
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>