[ovs-dev] [PATCH v4 06/10] lib/ofp-actions: Set field OF 1.0/1.1 compatibility.

Ben Pfaff blp at nicira.com
Fri Nov 1 23:04:35 UTC 2013


On Thu, Oct 24, 2013 at 01:19:30PM -0700, Jarno Rajahalme wrote:
> Output set field actions as standard OF1.0/1.1 set actions or to
> reg_load instructions, when a compatible set action(s) do not exist.
> 
> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>

Thanks.

I broke set_field_to_openflow() into a couple of helpers, so that
set_field_to_openflow() is now just:

static void
set_field_to_openflow(const struct ofpact_set_field *sf,
                      struct ofpbuf *openflow)
{
    struct ofp_header *oh = (struct ofp_header *)openflow->l2;

    if (oh->version >= OFP12_VERSION) {
        set_field_to_openflow12(sf, openflow);
    } else if (oh->version == OFP11_VERSION) {
        set_field_to_openflow11(sf, openflow);
    } else if (oh->version == OFP10_VERSION) {
        set_field_to_openflow10(sf, openflow);
    } else {
        NOT_REACHED();
    }
}

I felt that this made the code more readable.

Applied, with that change.



More information about the dev mailing list