[ovs-discuss] Stack implication of OVS group action

Ben Pfaff blp at ovn.org
Wed Nov 20 19:54:20 UTC 2019

On Tue, Nov 19, 2019 at 01:05:23PM -0800, Han Zhou wrote:
> In the ovs-actions man page it is mentioned that:
>        Sometimes  saving  and  restoring  the packet and metadata can be
> undesirable. In these situations, workarounds are possible. For example,
> consider a pipeline design in which a select group bucket is to communicate
> to a later stage of processing a value based on  which  bucket  was
>  selected. An obvious design would be for the bucket to communicate the
> value via set_field on a register. This does not work because registers are
> part of the metadata that group saves and restores. A design that would
>  work  would  be   for  the  bucket to recursively invoke the rest of the
> pipeline with resubmit rather than to attempt to return it. Another
> possibility is for the bucket to use push to put the value on the stack for
> the caller to pop off, since group preserves  only  packet data and
> metadata, not the stack.
> However, with my testing it seems even push to stack doesn't work, i.e.
> after the group action, pop cannot get the value pushed by a group bucket.
> Checking the code, I saw below comments saying differently from the man
> page:
>      * Note that group buckets are action sets, hence they cannot modify the
>      * main action set.  Also any stack actions are ignored when executing
> an
>      * action set, so group buckets cannot change the stack either.
> Could someone help clarify on this? Is the man page out of date? If so,
> does it mean the only way that group action can modify registers is to
> resubmit, which also indicates that the group action should always be the
> last action of a rule?

I think that this documentation is all correctly individually but
confusing when considered together.

An action set can't usefully contain stack push or pop actions; if it
somehow does, then these actions are ignored.  This is what the
section on Action Sets in the ovs-actions manpage says, and it is what
the code appears to do.

A group bucket is an action set, so any stack push or pop actions in a
bucket will have no effect.

A group bucket *can* contain a resubmit action.  The actions that get
executed recursively by the resubmit can contain stack push and pop
actions, which *can* modify the stack.

I sent out a patch that clarifies the documentation and comments:

More information about the discuss mailing list