nx-match: Use nx_put_header() internally for encoding flow matches.

This will make it easier to support 64-bit OXM experimenter fields.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
tests: Add test for masked set_field action.

ONF-JIRA: EXT-314
Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
nx-match: Speak of 'class' instead of 'vendor' for OXM/NXM.

OXM renamed the 'vendor' field from NXM to the 'class', and uses the term
"experimenter", which OVS usually renders as "vendor" for historical
reasons, as part of the extended 64-bit OXMs.  To reduce confusion, this
commit adopts the OXM terminology for class.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
util: Make hexits_value() support 64-bit integers too.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
nx-match: Add support for experimenter OXM.

OpenFlow 1.2+ defines a means for vendors to define vendor-specific OXM
fields, called "experimenter OXM".  These OXM fields are expressed with a
64-bit OXM header instead of the 32-bit header used for standard OXM (and
NXM).  Until now, OVS has not implemented experimenter OXM, and indeed we
have had little need to do so because of a pair of special 32-bit OXM classes
grandfathered to OVS as part of the OpenFlow 1.2 standardization process.

However, I want to prototype a feature for OpenFlow 1.5 that uses an
experimenter OXM as part of the prototype, so to do this OVS needs to
support experimenter OXM.  This commit adds that support.

Most of this commit is a fairly straightforward change: it extends the type
used for OXM/NXM from 32 to 64 bits and adds code to encode and decode the
longer headers when necessary.  Some other changes are necessary because
experimenter OXMs have a funny idea of the division between "header" and
"body": the extra 32 bits for experimenter OXMs are counted as part of the body
rather than the header according to the OpenFlow standard (even though this
does not entirely make sense), so arithmetic in various places has to be
adjusted, which is the reason for the new functions nxm_experimenter_len(),
nxm_payload_len(), and nxm_header_len().

Another change that calls for explanation is the new function mf_nxm_header()
that has been split from mf_oxm_header().  This function is used in actions
where the space for an NXM or OXM header is fixed so that there is no room
for a 64-bit experimenter type.  An upcoming commit will add new variations
of these actions that can support experimenter OXM.

Testing experimenter OXM is tricky because I do not know of any in
widespread use.  Two ONF proposals use experimenter OXMs: EXT-256 and
EXT-233.  EXT-256 is not suitable to implement for testing because its use
of experimenter OXM is wrong and will be changed.  EXT-233 is not suitable
to implement for testing because it requires adding a new field to struct
flow and I am not yet convinced that that field and the feature that it
supports is worth having in Open vSwitch.  Thus, this commit assigns an
experimenter OXM code point to an existing OVS field that is currently
restricted from use by controllers, "dp_hash", and uses that for testing.
Because controllers cannot use it, this leaves future versions of OVS free
to drop the support for the experimenter OXM for this field without causing
backward compatibility problems.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
ofp-actions: Support experimenter OXMs in Nicira extensions.

Some of the Nicira extension actions include fixed-size 32-bit members that
designate NXM fields.  These actions can't accommodate 64-bit experimenter
OXMs, so we need to figure out some kind of solution.  This commit does
that, in different ways for different actions.

For some actions, I did not think it was worthwhile to worry about
experimenter OXM, so I just disabled use of them.  This is what I did for
bundle, learn, and multipath actions.

Other actions could be gracefully reinterpreted to support experimenter
OXM.  This is true of reg_move, which use NXM headers only at the end of
the action and such that using an experimenter OXM would make the action
longer (which unambigously signals to older OVS that the action is an
error, which is desired behavior since older OVS cannot interpret this
action).  The stack push and pop actions are also in this category.

reg_load was the most frustrating case.  In OpenFlow 1.5 we had already
eliminated this action in favor of OF1.5+ set_field.  In other OpenFlow
versions, though, reg_load is more powerful than set_field because it
can modify partial fields.  This commit therefore adds a new variant of
reg_load, called reg_load2, which is simply OF1.5+ set_field with a Nicira
extension header on it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
[RFC] 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.

As-is, this patch has a number of deficiencies.  I will fix them; I am
posting for now because I feel like I have sat on this patch series for
long enough.

Known problems:

    * When the action set contains a group action and an output action,
      actset_output should become OFPP_UNSET.

    * Missing documentation.

    * OF1.3 and OF1.4 should use ONFOXM_ET_ACTSET_OUTPUT; OF1.5+ should use
      OXM_OF_ACTSET_OUTPUT.  The current patch uses the former for all
      versions.

The following patch adds a test.

ONF-JIRA: EXT-233
Signed-off-by: Ben Pfaff <blp@nicira.com>
tests: Test that copy_field works with experimenter OXM

ONF-JIRA: EXT-380
Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>