ofp-actions: Only set defined bits when encoding "load" actions.

Commit 7eb4b1f1d70345f ("ofp-actions: Support OF1.5 (draft) masked
Set-Field, merge with reg_load.") introduced a bug in that a set_field
action that set an entire field would be translated incorrectly to
reg_load, if the field being set only occupied a portion of the bytes that
it contains.  For example, an MPLS label is 20 bits but has a 4-byte field,
which meant that a set_field would get translated into a reg_load that
wrote all 32 bits; in turn, the receiver of that reg_load would reject it
because it was attempting to set invalid bits (the top 12 bits).

This commit fixes the problem by omitting invalid bits when encoding a
reg_load action.

Reported-by: Pravin Shelar <pshelar@nicira.com>
Tested-by: Pravin Shelar <pshelar@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
datapath-windows: Add PID Number attribute for port notification / Fix logic

[1] User mode OVS expects to have the PID number in the port state
    notification command
[2] Fix logic error-for-Windows-user-mode

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-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>
datapath-windows: Move Build*Msg() to Netlink.c

Moving the functions that build netlink messages to Netlink.c from
Vport.c

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: nuke unused code in Flow.c

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
doc: Fix up markdown syntax in tutorial/Tutorial.md

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
FAQ: Fix formatting for command block.

Signed-off-by: Robert Åkerblom-Andersson <Robert.nr1@gmail.com>
FAQ.md: Correct claims about MPLS.

An examination of the source code and the tests shows that the FAQ claimed
more for version 2.3 than was really in there.

Reported-by: null pointer <null.pointer.boom@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
travis: Extended kernel build matrix

When doing test builds, build against the following kernels:
  - KERNEL=3.17.4
  - KERNEL=3.16.7
  - KERNEL=3.14.25
  - KERNEL=3.12.33
  - KERNEL=3.10.61
  - KERNEL=3.4.104
  - KERNEL=2.6.32.64

When doing pure kernel test builds, skip compilation of user space bits.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
travis: Only run testsuite for gcc builds

This reduces the total travis build time significantly.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-bugtool: Log more detail for dumped flows.

The standard mode for printing flows doesn't always provide the full
range of information that is available, particularly with the UFID
changes. Turn on more detail.

Suggested-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
tunnel: Recreate tunnel port only when the netdev status change.

On current master, the 'struct tnl_port' in tunnel module will be
recreated whenever the global connectivity sequence number changes
(e.g. when adding unrelated flow).  This is unnecessary and could
cause drop of tunnel packet if a lookup happens between the removal
and recreate.

This commit fixes the above issue by only checking the netdev's own
sequence number.

Found by code inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
ofp-actions: Update "copy_field" to latest OF1.5 draft.

Since my original prototype, the oxm_id_len field was removed and
replaced by 2 bytes of padding.

ONF-JIRA: EXT-320
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
ofp-actions: Add support for ONF extension actions.

Preparation for supporting ONFACT_ET_COPY_FIELD.

ONF-JIRA: EXT-320
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
ofp-actions: Support "copy_field" ONF extension to OpenFlow 1.3.

ONF-JIRA: EXT-320
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
Change Travis CI notification email to ljakab@ac.upc.edu
userspace: add support for pop_eth and push_eth actions

These actions will allow L2->L3 and L3->L2 switching, and are supposed
to be added to flows installed in the datapath transparently by
ovs-vswitchd.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
userspace: add layer 3 flow and switching support

This commit relaxes the assumption that all packets have an Ethernet
header, and adds support for layer 3 flows.  For each packet received on
the Linux kernel datapath the l2 and l3 members of struct ofpbuf are
intialized appropriately, and some functions now expect this (notably
flow_extract()), in order to differentiate between layer 2 and layer 3
packets.  struct flow has now a new 'base_layer' member, because we
cannot assume that a flow has no Ethernet header when eth_src and
eth_dst are 0.  For layer 3 packets, the protocol type is still stored
in the eth_type member.

Switching L2->L3 and L3->L2 are both implemented by adding the pop_eth
and push_eth actions respectively when a transition is detected.  The
push_eth action puts 0s on both source and destination MACs.  These
addresses can be modified with mod_dl_dst and mod_dl_src actions.

Added new prerequisite MFP_ETHERNET for fields MFF_VLAN_TCI,
MFF_DL_VLAN, MFF_VLAN_VID and MFF_DL_VLAN_PCP.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
datapath: add layer 3 flow/port support

Implementation of the pop_eth and push_eth actions in the kernel, and
layer 3 flow support.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
userspace: add layer 3 support to packet metadata

This is needed for sending a packet back to the datapath after a miss upcall
was processed.  The presence of a layer 2 packet is signaled by adding
OVS_KEY_ATTR_ETHERNET to the packet metadata sent with the ovs_packet netlink
message.  Layer 3 packets need to be accompanied by OVS_KEY_ATTR_ETHERTYPE to
indicate network protocol.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
datapath: add layer 3 support to ovs_packet_cmd_execute()

Packet metadata for layer 3 packets is expected to contain
OVS_KEY_ATTR_ETHERTYPE to indicate the network protocol.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>