diff --git a/home/nipa/nipa_out/847473/ynl/old-code/ovs_flow-user.c b/home/nipa/nipa_out/847473/ynl/new-code/ovs_flow-user.c index e92cb3dd7126..d4f362d39513 100644 --- a/home/nipa/nipa_out/847473/ynl/old-code/ovs_flow-user.c +++ b/home/nipa/nipa_out/847473/ynl/new-code/ovs_flow-user.c @@ -240,6 +240,8 @@ struct ynl_policy_nest ovs_flow_key_attrs_nest = { struct ynl_policy_attr ovs_flow_sample_attrs_policy[OVS_SAMPLE_ATTR_MAX + 1] = { [OVS_SAMPLE_ATTR_PROBABILITY] = { .name = "probability", .type = YNL_PT_U32, }, [OVS_SAMPLE_ATTR_ACTIONS] = { .name = "actions", .type = YNL_PT_NEST, .nest = &ovs_flow_action_attrs_nest, }, + [OVS_SAMPLE_ATTR_PSAMPLE_GROUP] = { .name = "psample_group", .type = YNL_PT_U32, }, + [OVS_SAMPLE_ATTR_PSAMPLE_COOKIE] = { .name = "psample_cookie", .type = YNL_PT_BINARY,}, }; struct ynl_policy_nest ovs_flow_sample_attrs_nest = { @@ -1428,6 +1430,7 @@ void ovs_flow_sample_attrs_free(struct ovs_flow_sample_attrs *obj) { if (obj->actions) ovs_flow_action_attrs_free(obj->actions); + free(obj->psample_cookie); } int ovs_flow_sample_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, @@ -1440,6 +1443,10 @@ int ovs_flow_sample_attrs_put(struct nlmsghdr *nlh, unsigned int attr_type, ynl_attr_put_u32(nlh, OVS_SAMPLE_ATTR_PROBABILITY, obj->probability); if (obj->_present.actions) ovs_flow_action_attrs_put(nlh, OVS_SAMPLE_ATTR_ACTIONS, obj->actions); + if (obj->_present.psample_group) + ynl_attr_put_u32(nlh, OVS_SAMPLE_ATTR_PSAMPLE_GROUP, obj->psample_group); + if (obj->_present.psample_cookie_len) + ynl_attr_put(nlh, OVS_SAMPLE_ATTR_PSAMPLE_COOKIE, obj->psample_cookie, obj->_present.psample_cookie_len); ynl_attr_nest_end(nlh, nest); return 0; @@ -1471,6 +1478,21 @@ int ovs_flow_sample_attrs_parse(struct ynl_parse_arg *yarg, parg.data = &dst->actions; if (ovs_flow_action_attrs_parse(&parg, attr)) return YNL_PARSE_CB_ERROR; + } else if (type == OVS_SAMPLE_ATTR_PSAMPLE_GROUP) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.psample_group = 1; + dst->psample_group = ynl_attr_get_u32(attr); + } else if (type == OVS_SAMPLE_ATTR_PSAMPLE_COOKIE) { + unsigned int len; + + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + + len = ynl_attr_data_len(attr); + dst->_present.psample_cookie_len = len; + dst->psample_cookie = malloc(len); + memcpy(dst->psample_cookie, ynl_attr_data(attr), len); } } diff --git a/home/nipa/nipa_out/847473/ynl/old-code/ovs_flow-user.h b/home/nipa/nipa_out/847473/ynl/new-code/ovs_flow-user.h index 6898d630b7d2..0769a02fc421 100644 --- a/home/nipa/nipa_out/847473/ynl/old-code/ovs_flow-user.h +++ b/home/nipa/nipa_out/847473/ynl/new-code/ovs_flow-user.h @@ -227,10 +227,14 @@ struct ovs_flow_sample_attrs { struct { __u32 probability:1; __u32 actions:1; + __u32 psample_group:1; + __u32 psample_cookie_len; } _present; __u32 probability; struct ovs_flow_action_attrs *actions; + __u32 psample_group; + void *psample_cookie; }; struct ovs_flow_action_attrs { @@ -2310,6 +2314,27 @@ ovs_flow_new_req_set_actions_sample_probability(struct ovs_flow_new_req *req, req->actions.sample.probability = probability; } static inline void +ovs_flow_new_req_set_actions_sample_psample_group(struct ovs_flow_new_req *req, + __u32 psample_group) +{ + req->_present.actions = 1; + req->actions._present.sample = 1; + req->actions.sample._present.psample_group = 1; + req->actions.sample.psample_group = psample_group; +} +static inline void +ovs_flow_new_req_set_actions_sample_psample_cookie(struct ovs_flow_new_req *req, + const void *psample_cookie, + size_t len) +{ + req->_present.actions = 1; + req->actions._present.sample = 1; + free(req->actions.sample.psample_cookie); + req->actions.sample._present.psample_cookie_len = len; + req->actions.sample.psample_cookie = malloc(req->actions.sample._present.psample_cookie_len); + memcpy(req->actions.sample.psample_cookie, psample_cookie, req->actions.sample._present.psample_cookie_len); +} +static inline void ovs_flow_new_req_set_actions_recirc(struct ovs_flow_new_req *req, __u32 recirc) { req->_present.actions = 1;