diff --git a/home/nipa/nipa_out/863597/ynl/old-code/ovs_flow-user.c b/home/nipa/nipa_out/863597/ynl/new-code/ovs_flow-user.c index aa61dfa5ff15..4396c812ae47 100644 --- a/home/nipa/nipa_out/863597/ynl/old-code/ovs_flow-user.c +++ b/home/nipa/nipa_out/863597/ynl/new-code/ovs_flow-user.c @@ -109,6 +109,16 @@ const struct ynl_policy_nest ovs_flow_userspace_attrs_nest = { .table = ovs_flow_userspace_attrs_policy, }; +const struct ynl_policy_attr ovs_flow_emit_sample_attrs_policy[OVS_EMIT_SAMPLE_ATTR_MAX + 1] = { + [OVS_EMIT_SAMPLE_ATTR_GROUP] = { .name = "group", .type = YNL_PT_U32, }, + [OVS_EMIT_SAMPLE_ATTR_COOKIE] = { .name = "cookie", .type = YNL_PT_BINARY,}, +}; + +const struct ynl_policy_nest ovs_flow_emit_sample_attrs_nest = { + .max_attr = OVS_EMIT_SAMPLE_ATTR_MAX, + .table = ovs_flow_emit_sample_attrs_policy, +}; + const struct ynl_policy_attr ovs_flow_vxlan_ext_attrs_policy[OVS_VXLAN_EXT_MAX + 1] = { [OVS_VXLAN_EXT_GBP] = { .name = "gbp", .type = YNL_PT_U32, }, }; @@ -177,26 +187,6 @@ const struct ynl_policy_nest ovs_flow_ct_attrs_nest = { .table = ovs_flow_ct_attrs_policy, }; -const struct ynl_policy_attr ovs_flow_check_pkt_len_attrs_policy[OVS_CHECK_PKT_LEN_ATTR_MAX + 1] = { - [OVS_CHECK_PKT_LEN_ATTR_PKT_LEN] = { .name = "pkt-len", .type = YNL_PT_U16, }, - [OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER] = { .name = "actions-if-greater", .type = YNL_PT_NEST, .nest = &ovs_flow_action_attrs_nest, }, - [OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL] = { .name = "actions-if-less-equal", .type = YNL_PT_NEST, .nest = &ovs_flow_action_attrs_nest, }, -}; - -const struct ynl_policy_nest ovs_flow_check_pkt_len_attrs_nest = { - .max_attr = OVS_CHECK_PKT_LEN_ATTR_MAX, - .table = ovs_flow_check_pkt_len_attrs_policy, -}; - -const struct ynl_policy_attr ovs_flow_dec_ttl_attrs_policy[OVS_DEC_TTL_ATTR_MAX + 1] = { - [OVS_DEC_TTL_ATTR_ACTION] = { .name = "action", .type = YNL_PT_NEST, .nest = &ovs_flow_action_attrs_nest, }, -}; - -const struct ynl_policy_nest ovs_flow_dec_ttl_attrs_nest = { - .max_attr = OVS_DEC_TTL_ATTR_MAX, - .table = ovs_flow_dec_ttl_attrs_policy, -}; - const struct ynl_policy_attr ovs_flow_key_attrs_policy[OVS_KEY_ATTR_MAX + 1] = { [OVS_KEY_ATTR_ENCAP] = { .name = "encap", .type = YNL_PT_NEST, .nest = &ovs_flow_key_attrs_nest, }, [OVS_KEY_ATTR_PRIORITY] = { .name = "priority", .type = YNL_PT_U32, }, @@ -247,6 +237,26 @@ const struct ynl_policy_nest ovs_flow_sample_attrs_nest = { .table = ovs_flow_sample_attrs_policy, }; +const struct ynl_policy_attr ovs_flow_check_pkt_len_attrs_policy[OVS_CHECK_PKT_LEN_ATTR_MAX + 1] = { + [OVS_CHECK_PKT_LEN_ATTR_PKT_LEN] = { .name = "pkt-len", .type = YNL_PT_U16, }, + [OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER] = { .name = "actions-if-greater", .type = YNL_PT_NEST, .nest = &ovs_flow_action_attrs_nest, }, + [OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL] = { .name = "actions-if-less-equal", .type = YNL_PT_NEST, .nest = &ovs_flow_action_attrs_nest, }, +}; + +const struct ynl_policy_nest ovs_flow_check_pkt_len_attrs_nest = { + .max_attr = OVS_CHECK_PKT_LEN_ATTR_MAX, + .table = ovs_flow_check_pkt_len_attrs_policy, +}; + +const struct ynl_policy_attr ovs_flow_dec_ttl_attrs_policy[OVS_DEC_TTL_ATTR_MAX + 1] = { + [OVS_DEC_TTL_ATTR_ACTION] = { .name = "action", .type = YNL_PT_NEST, .nest = &ovs_flow_action_attrs_nest, }, +}; + +const struct ynl_policy_nest ovs_flow_dec_ttl_attrs_nest = { + .max_attr = OVS_DEC_TTL_ATTR_MAX, + .table = ovs_flow_dec_ttl_attrs_policy, +}; + const struct ynl_policy_attr ovs_flow_action_attrs_policy[OVS_ACTION_ATTR_MAX + 1] = { [OVS_ACTION_ATTR_OUTPUT] = { .name = "output", .type = YNL_PT_U32, }, [OVS_ACTION_ATTR_USERSPACE] = { .name = "userspace", .type = YNL_PT_NEST, .nest = &ovs_flow_userspace_attrs_nest, }, @@ -271,6 +281,7 @@ const struct ynl_policy_attr ovs_flow_action_attrs_policy[OVS_ACTION_ATTR_MAX + [OVS_ACTION_ATTR_CHECK_PKT_LEN] = { .name = "check-pkt-len", .type = YNL_PT_NEST, .nest = &ovs_flow_check_pkt_len_attrs_nest, }, [OVS_ACTION_ATTR_ADD_MPLS] = { .name = "add-mpls", .type = YNL_PT_BINARY,}, [OVS_ACTION_ATTR_DEC_TTL] = { .name = "dec-ttl", .type = YNL_PT_NEST, .nest = &ovs_flow_dec_ttl_attrs_nest, }, + [OVS_ACTION_ATTR_EMIT_SAMPLE] = { .name = "emit-sample", .type = YNL_PT_NEST, .nest = &ovs_flow_emit_sample_attrs_nest, }, }; const struct ynl_policy_nest ovs_flow_action_attrs_nest = { @@ -309,6 +320,12 @@ int ovs_flow_userspace_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, struct ovs_flow_userspace_attrs *obj); int ovs_flow_userspace_attrs_parse(struct ynl_parse_arg *yarg, const struct nlattr *nested); +void ovs_flow_emit_sample_attrs_free(struct ovs_flow_emit_sample_attrs *obj); +int ovs_flow_emit_sample_attrs_put(struct nlmsghdr *nlh, + unsigned int attr_type, + struct ovs_flow_emit_sample_attrs *obj); +int ovs_flow_emit_sample_attrs_parse(struct ynl_parse_arg *yarg, + const struct nlattr *nested); void ovs_flow_vxlan_ext_attrs_free(struct ovs_flow_vxlan_ext_attrs *obj); int ovs_flow_vxlan_ext_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, struct ovs_flow_vxlan_ext_attrs *obj); @@ -329,6 +346,16 @@ int ovs_flow_ct_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, struct ovs_flow_ct_attrs *obj); int ovs_flow_ct_attrs_parse(struct ynl_parse_arg *yarg, const struct nlattr *nested); +void ovs_flow_key_attrs_free(struct ovs_flow_key_attrs *obj); +int ovs_flow_key_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, + struct ovs_flow_key_attrs *obj); +int ovs_flow_key_attrs_parse(struct ynl_parse_arg *yarg, + const struct nlattr *nested); +void ovs_flow_sample_attrs_free(struct ovs_flow_sample_attrs *obj); +int ovs_flow_sample_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, + struct ovs_flow_sample_attrs *obj); +int ovs_flow_sample_attrs_parse(struct ynl_parse_arg *yarg, + const struct nlattr *nested); void ovs_flow_check_pkt_len_attrs_free(struct ovs_flow_check_pkt_len_attrs *obj); int ovs_flow_check_pkt_len_attrs_put(struct nlmsghdr *nlh, @@ -341,16 +368,6 @@ int ovs_flow_dec_ttl_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, struct ovs_flow_dec_ttl_attrs *obj); int ovs_flow_dec_ttl_attrs_parse(struct ynl_parse_arg *yarg, const struct nlattr *nested); -void ovs_flow_key_attrs_free(struct ovs_flow_key_attrs *obj); -int ovs_flow_key_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, - struct ovs_flow_key_attrs *obj); -int ovs_flow_key_attrs_parse(struct ynl_parse_arg *yarg, - const struct nlattr *nested); -void ovs_flow_sample_attrs_free(struct ovs_flow_sample_attrs *obj); -int ovs_flow_sample_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, - struct ovs_flow_sample_attrs *obj); -int ovs_flow_sample_attrs_parse(struct ynl_parse_arg *yarg, - const struct nlattr *nested); void ovs_flow_action_attrs_free(struct ovs_flow_action_attrs *obj); int ovs_flow_action_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, struct ovs_flow_action_attrs *obj); @@ -490,6 +507,57 @@ int ovs_flow_userspace_attrs_parse(struct ynl_parse_arg *yarg, return 0; } +void ovs_flow_emit_sample_attrs_free(struct ovs_flow_emit_sample_attrs *obj) +{ + free(obj->cookie); +} + +int ovs_flow_emit_sample_attrs_put(struct nlmsghdr *nlh, + unsigned int attr_type, + struct ovs_flow_emit_sample_attrs *obj) +{ + struct nlattr *nest; + + nest = ynl_attr_nest_start(nlh, attr_type); + if (obj->_present.group) + ynl_attr_put_u32(nlh, OVS_EMIT_SAMPLE_ATTR_GROUP, obj->group); + if (obj->_present.cookie_len) + ynl_attr_put(nlh, OVS_EMIT_SAMPLE_ATTR_COOKIE, obj->cookie, obj->_present.cookie_len); + ynl_attr_nest_end(nlh, nest); + + return 0; +} + +int ovs_flow_emit_sample_attrs_parse(struct ynl_parse_arg *yarg, + const struct nlattr *nested) +{ + struct ovs_flow_emit_sample_attrs *dst = yarg->data; + const struct nlattr *attr; + + ynl_attr_for_each_nested(attr, nested) { + unsigned int type = ynl_attr_type(attr); + + if (type == OVS_EMIT_SAMPLE_ATTR_GROUP) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.group = 1; + dst->group = ynl_attr_get_u32(attr); + } else if (type == OVS_EMIT_SAMPLE_ATTR_COOKIE) { + unsigned int len; + + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + + len = ynl_attr_data_len(attr); + dst->_present.cookie_len = len; + dst->cookie = malloc(len); + memcpy(dst->cookie, ynl_attr_data(attr), len); + } + } + + return 0; +} + void ovs_flow_vxlan_ext_attrs_free(struct ovs_flow_vxlan_ext_attrs *obj) { } @@ -935,120 +1003,6 @@ int ovs_flow_ct_attrs_parse(struct ynl_parse_arg *yarg, return 0; } -void -ovs_flow_check_pkt_len_attrs_free(struct ovs_flow_check_pkt_len_attrs *obj) -{ - if (obj->actions_if_greater) - ovs_flow_action_attrs_free(obj->actions_if_greater); - if (obj->actions_if_less_equal) - ovs_flow_action_attrs_free(obj->actions_if_less_equal); -} - -int ovs_flow_check_pkt_len_attrs_put(struct nlmsghdr *nlh, - unsigned int attr_type, - struct ovs_flow_check_pkt_len_attrs *obj) -{ - struct nlattr *nest; - - nest = ynl_attr_nest_start(nlh, attr_type); - if (obj->_present.pkt_len) - ynl_attr_put_u16(nlh, OVS_CHECK_PKT_LEN_ATTR_PKT_LEN, obj->pkt_len); - if (obj->_present.actions_if_greater) - ovs_flow_action_attrs_put(nlh, OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER, obj->actions_if_greater); - if (obj->_present.actions_if_less_equal) - ovs_flow_action_attrs_put(nlh, OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL, obj->actions_if_less_equal); - ynl_attr_nest_end(nlh, nest); - - return 0; -} - -int ovs_flow_check_pkt_len_attrs_parse(struct ynl_parse_arg *yarg, - const struct nlattr *nested) -{ - struct ovs_flow_check_pkt_len_attrs *dst = yarg->data; - const struct nlattr *attr; - struct ynl_parse_arg parg; - - parg.ys = yarg->ys; - - ynl_attr_for_each_nested(attr, nested) { - unsigned int type = ynl_attr_type(attr); - - if (type == OVS_CHECK_PKT_LEN_ATTR_PKT_LEN) { - if (ynl_attr_validate(yarg, attr)) - return YNL_PARSE_CB_ERROR; - dst->_present.pkt_len = 1; - dst->pkt_len = ynl_attr_get_u16(attr); - } else if (type == OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER) { - if (ynl_attr_validate(yarg, attr)) - return YNL_PARSE_CB_ERROR; - dst->_present.actions_if_greater = 1; - - parg.rsp_policy = &ovs_flow_action_attrs_nest; - parg.data = &dst->actions_if_greater; - if (ovs_flow_action_attrs_parse(&parg, attr)) - return YNL_PARSE_CB_ERROR; - } else if (type == OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL) { - if (ynl_attr_validate(yarg, attr)) - return YNL_PARSE_CB_ERROR; - dst->_present.actions_if_less_equal = 1; - - parg.rsp_policy = &ovs_flow_action_attrs_nest; - parg.data = &dst->actions_if_less_equal; - if (ovs_flow_action_attrs_parse(&parg, attr)) - return YNL_PARSE_CB_ERROR; - } - } - - return 0; -} - -void ovs_flow_dec_ttl_attrs_free(struct ovs_flow_dec_ttl_attrs *obj) -{ - if (obj->action) - ovs_flow_action_attrs_free(obj->action); -} - -int ovs_flow_dec_ttl_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, - struct ovs_flow_dec_ttl_attrs *obj) -{ - struct nlattr *nest; - - nest = ynl_attr_nest_start(nlh, attr_type); - if (obj->_present.action) - ovs_flow_action_attrs_put(nlh, OVS_DEC_TTL_ATTR_ACTION, obj->action); - ynl_attr_nest_end(nlh, nest); - - return 0; -} - -int ovs_flow_dec_ttl_attrs_parse(struct ynl_parse_arg *yarg, - const struct nlattr *nested) -{ - struct ovs_flow_dec_ttl_attrs *dst = yarg->data; - const struct nlattr *attr; - struct ynl_parse_arg parg; - - parg.ys = yarg->ys; - - ynl_attr_for_each_nested(attr, nested) { - unsigned int type = ynl_attr_type(attr); - - if (type == OVS_DEC_TTL_ATTR_ACTION) { - if (ynl_attr_validate(yarg, attr)) - return YNL_PARSE_CB_ERROR; - dst->_present.action = 1; - - parg.rsp_policy = &ovs_flow_action_attrs_nest; - parg.data = &dst->action; - if (ovs_flow_action_attrs_parse(&parg, attr)) - return YNL_PARSE_CB_ERROR; - } - } - - return 0; -} - void ovs_flow_key_attrs_free(struct ovs_flow_key_attrs *obj) { if (obj->encap) @@ -1477,6 +1431,120 @@ int ovs_flow_sample_attrs_parse(struct ynl_parse_arg *yarg, return 0; } +void +ovs_flow_check_pkt_len_attrs_free(struct ovs_flow_check_pkt_len_attrs *obj) +{ + if (obj->actions_if_greater) + ovs_flow_action_attrs_free(obj->actions_if_greater); + if (obj->actions_if_less_equal) + ovs_flow_action_attrs_free(obj->actions_if_less_equal); +} + +int ovs_flow_check_pkt_len_attrs_put(struct nlmsghdr *nlh, + unsigned int attr_type, + struct ovs_flow_check_pkt_len_attrs *obj) +{ + struct nlattr *nest; + + nest = ynl_attr_nest_start(nlh, attr_type); + if (obj->_present.pkt_len) + ynl_attr_put_u16(nlh, OVS_CHECK_PKT_LEN_ATTR_PKT_LEN, obj->pkt_len); + if (obj->_present.actions_if_greater) + ovs_flow_action_attrs_put(nlh, OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER, obj->actions_if_greater); + if (obj->_present.actions_if_less_equal) + ovs_flow_action_attrs_put(nlh, OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL, obj->actions_if_less_equal); + ynl_attr_nest_end(nlh, nest); + + return 0; +} + +int ovs_flow_check_pkt_len_attrs_parse(struct ynl_parse_arg *yarg, + const struct nlattr *nested) +{ + struct ovs_flow_check_pkt_len_attrs *dst = yarg->data; + const struct nlattr *attr; + struct ynl_parse_arg parg; + + parg.ys = yarg->ys; + + ynl_attr_for_each_nested(attr, nested) { + unsigned int type = ynl_attr_type(attr); + + if (type == OVS_CHECK_PKT_LEN_ATTR_PKT_LEN) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.pkt_len = 1; + dst->pkt_len = ynl_attr_get_u16(attr); + } else if (type == OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.actions_if_greater = 1; + + parg.rsp_policy = &ovs_flow_action_attrs_nest; + parg.data = &dst->actions_if_greater; + if (ovs_flow_action_attrs_parse(&parg, attr)) + return YNL_PARSE_CB_ERROR; + } else if (type == OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.actions_if_less_equal = 1; + + parg.rsp_policy = &ovs_flow_action_attrs_nest; + parg.data = &dst->actions_if_less_equal; + if (ovs_flow_action_attrs_parse(&parg, attr)) + return YNL_PARSE_CB_ERROR; + } + } + + return 0; +} + +void ovs_flow_dec_ttl_attrs_free(struct ovs_flow_dec_ttl_attrs *obj) +{ + if (obj->action) + ovs_flow_action_attrs_free(obj->action); +} + +int ovs_flow_dec_ttl_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, + struct ovs_flow_dec_ttl_attrs *obj) +{ + struct nlattr *nest; + + nest = ynl_attr_nest_start(nlh, attr_type); + if (obj->_present.action) + ovs_flow_action_attrs_put(nlh, OVS_DEC_TTL_ATTR_ACTION, obj->action); + ynl_attr_nest_end(nlh, nest); + + return 0; +} + +int ovs_flow_dec_ttl_attrs_parse(struct ynl_parse_arg *yarg, + const struct nlattr *nested) +{ + struct ovs_flow_dec_ttl_attrs *dst = yarg->data; + const struct nlattr *attr; + struct ynl_parse_arg parg; + + parg.ys = yarg->ys; + + ynl_attr_for_each_nested(attr, nested) { + unsigned int type = ynl_attr_type(attr); + + if (type == OVS_DEC_TTL_ATTR_ACTION) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.action = 1; + + parg.rsp_policy = &ovs_flow_action_attrs_nest; + parg.data = &dst->action; + if (ovs_flow_action_attrs_parse(&parg, attr)) + return YNL_PARSE_CB_ERROR; + } + } + + return 0; +} + void ovs_flow_action_attrs_free(struct ovs_flow_action_attrs *obj) { ovs_flow_userspace_attrs_free(&obj->userspace); @@ -1496,6 +1564,7 @@ void ovs_flow_action_attrs_free(struct ovs_flow_action_attrs *obj) ovs_flow_check_pkt_len_attrs_free(&obj->check_pkt_len); free(obj->add_mpls); ovs_flow_dec_ttl_attrs_free(&obj->dec_ttl); + ovs_flow_emit_sample_attrs_free(&obj->emit_sample); } int ovs_flow_action_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, @@ -1550,6 +1619,8 @@ int ovs_flow_action_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, ynl_attr_put(nlh, OVS_ACTION_ATTR_ADD_MPLS, obj->add_mpls, obj->_present.add_mpls_len); if (obj->_present.dec_ttl) ovs_flow_dec_ttl_attrs_put(nlh, OVS_ACTION_ATTR_DEC_TTL, &obj->dec_ttl); + if (obj->_present.emit_sample) + ovs_flow_emit_sample_attrs_put(nlh, OVS_ACTION_ATTR_EMIT_SAMPLE, &obj->emit_sample); ynl_attr_nest_end(nlh, nest); return 0; @@ -1739,6 +1810,15 @@ int ovs_flow_action_attrs_parse(struct ynl_parse_arg *yarg, parg.data = &dst->dec_ttl; if (ovs_flow_dec_ttl_attrs_parse(&parg, attr)) return YNL_PARSE_CB_ERROR; + } else if (type == OVS_ACTION_ATTR_EMIT_SAMPLE) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.emit_sample = 1; + + parg.rsp_policy = &ovs_flow_emit_sample_attrs_nest; + parg.data = &dst->emit_sample; + if (ovs_flow_emit_sample_attrs_parse(&parg, attr)) + return YNL_PARSE_CB_ERROR; } } diff --git a/home/nipa/nipa_out/863597/ynl/old-code/ovs_flow-user.h b/home/nipa/nipa_out/863597/ynl/new-code/ovs_flow-user.h index 6898d630b7d2..73b31541ae44 100644 --- a/home/nipa/nipa_out/863597/ynl/old-code/ovs_flow-user.h +++ b/home/nipa/nipa_out/863597/ynl/new-code/ovs_flow-user.h @@ -48,6 +48,16 @@ struct ovs_flow_userspace_attrs { __u32 egress_tun_port; }; +struct ovs_flow_emit_sample_attrs { + struct { + __u32 group:1; + __u32 cookie_len; + } _present; + + __u32 group; + void *cookie; +}; + struct ovs_flow_vxlan_ext_attrs { struct { __u32 gbp:1; @@ -133,26 +143,6 @@ struct ovs_flow_ct_attrs { char *timeout; }; -struct ovs_flow_check_pkt_len_attrs { - struct { - __u32 pkt_len:1; - __u32 actions_if_greater:1; - __u32 actions_if_less_equal:1; - } _present; - - __u16 pkt_len; - struct ovs_flow_action_attrs *actions_if_greater; - struct ovs_flow_action_attrs *actions_if_less_equal; -}; - -struct ovs_flow_dec_ttl_attrs { - struct { - __u32 action:1; - } _present; - - struct ovs_flow_action_attrs *action; -}; - struct ovs_flow_key_attrs { struct { __u32 encap:1; @@ -233,6 +223,26 @@ struct ovs_flow_sample_attrs { struct ovs_flow_action_attrs *actions; }; +struct ovs_flow_check_pkt_len_attrs { + struct { + __u32 pkt_len:1; + __u32 actions_if_greater:1; + __u32 actions_if_less_equal:1; + } _present; + + __u16 pkt_len; + struct ovs_flow_action_attrs *actions_if_greater; + struct ovs_flow_action_attrs *actions_if_less_equal; +}; + +struct ovs_flow_dec_ttl_attrs { + struct { + __u32 action:1; + } _present; + + struct ovs_flow_action_attrs *action; +}; + struct ovs_flow_action_attrs { struct { __u32 output:1; @@ -258,6 +268,7 @@ struct ovs_flow_action_attrs { __u32 check_pkt_len:1; __u32 add_mpls_len; __u32 dec_ttl:1; + __u32 emit_sample:1; } _present; __u32 output; @@ -279,6 +290,7 @@ struct ovs_flow_action_attrs { struct ovs_flow_check_pkt_len_attrs check_pkt_len; void *add_mpls; struct ovs_flow_dec_ttl_attrs dec_ttl; + struct ovs_flow_emit_sample_attrs emit_sample; }; /* ============== OVS_FLOW_CMD_GET ============== */ @@ -2599,6 +2611,26 @@ ovs_flow_new_req_set_actions_add_mpls(struct ovs_flow_new_req *req, req->actions.add_mpls = malloc(req->actions._present.add_mpls_len); memcpy(req->actions.add_mpls, add_mpls, req->actions._present.add_mpls_len); } +static inline void +ovs_flow_new_req_set_actions_emit_sample_group(struct ovs_flow_new_req *req, + __u32 group) +{ + req->_present.actions = 1; + req->actions._present.emit_sample = 1; + req->actions.emit_sample._present.group = 1; + req->actions.emit_sample.group = group; +} +static inline void +ovs_flow_new_req_set_actions_emit_sample_cookie(struct ovs_flow_new_req *req, + const void *cookie, size_t len) +{ + req->_present.actions = 1; + req->actions._present.emit_sample = 1; + free(req->actions.emit_sample.cookie); + req->actions.emit_sample._present.cookie_len = len; + req->actions.emit_sample.cookie = malloc(req->actions.emit_sample._present.cookie_len); + memcpy(req->actions.emit_sample.cookie, cookie, req->actions.emit_sample._present.cookie_len); +} /* * Create OVS flow configuration in a data path