[ovs-dev] [PATCH v2] ofproto: add support of OFPR_ACTION_SET as packet-in reason for OF1.4+

Ben Pfaff blp at nicira.com
Sat Feb 7 07:24:22 UTC 2015


On Tue, Feb 03, 2015 at 10:24:18PM -0800, Shu Shen wrote:
> This patch adds support for OFPR_ACTION_SET as the packet-in reason when
> a Packet-In message is triggered by an output action within an
> action-set. By default reason code OFPR_ACTION_SET is enabled for async
> messages when Openflow 1.4+ is used. A test case is included.
> 
> Signed-off-by: Shu Shen <shu.shen at radisys.com>
> ---
> 
> Changes in V2:
>  - A new flag in_action_set is added to xlate_ctx to indicate the output action
>    is part of action_set. This corrects earlier detection method.
>  - Test cases for OFPR_GROUP and OFPR_ACTION_SET packet-in reasons are combined
>    and coverage for OFPR_ACTION is also added.

Thanks a lot.

I decided that I found this style:
        {
            enum ofp_packet_in_reason reason = OFPR_ACTION;
            if (ctx->in_group){
                    reason = OFPR_GROUP;
            }else if (ctx->in_action_set){
                    reason = OFPR_ACTION_SET;
            }
            execute_controller_action(ctx, max_len, reason, 0);
        }
slightly ugly, so I changed it to:
        execute_controller_action(ctx, max_len,
                                  (ctx->in_group ? OFPR_GROUP
                                   : ctx->in_action_set ? OFPR_ACTION_SET
                                   : OFPR_ACTION),
                                  0);
which I find slightly less ugly.

And I applied the result to master.

Thanks again (especially for the test)!



More information about the dev mailing list