[ovs-dev] [PATCH v2] ofp-actions: Implement writing to metadata field

Ben Pfaff blp at nicira.com
Fri Jul 13 00:02:52 UTC 2012

On Thu, Jul 12, 2012 at 10:55:21AM +1200, Joe Stringer wrote:
> In OpenFlow 1.1, we add support for OFPIT_WRITE_METADATA. This allows us to
> write to the metadata field. Internally it is represented using ofpact_metadata.
> We introduce NXAST_WRITE_METADATA to handle writing to the metadata field in
> OpenFlow 1.0+. This structure reflects OFPIT_WRITE_METADATA.
> When writing out the structure to OpenFlow 1.1, it uses the OFPIT_WRITE_METADATA
> instruction only, and not the new NXAST action (which would be redundant).
> Signed-off-by: Joe Stringer <joe at wand.net.nz>
> ---
> v2: Dropped unused function

The semantics look a bit off to me.

First, ofpacts_pull_openflow11_instructions() ignores
in contrast, that anything in OFPIT_APPLY_ACTIONS should be processed
first, and then OFPIT_WRITE_METADATA.  Both, in other words, not one
or the other.

Suppose you fix that; it should not be hard (just remove an "else"
keyword, I think).  Then, second, the semantics implemented here will
surprise users, because if ofpacts are translated to OF1.0 then each
OFPIT_WRITE_METADATA will be executed one at a time at the point where
it appears in the actions, but if they are translated to OF1.1 then only
a single OFPIT_WRITE_METADATA will be processed, after all other
actions.  I'd rather avoid that.  One idea: report an error if
"write_metadata" is specified more than once or if it is not specified
as the last action.



More information about the dev mailing list