diff --git a/home/nipa/nipa_out/866464/ynl/old-code/ethtool-user.c b/home/nipa/nipa_out/866464/ynl/new-code/ethtool-user.c index 4b959e304f5d..b3931a6ddea8 100644 --- a/home/nipa/nipa_out/866464/ynl/old-code/ethtool-user.c +++ b/home/nipa/nipa_out/866464/ynl/new-code/ethtool-user.c @@ -104,6 +104,25 @@ const char *ethtool_header_flags_str(enum ethtool_header_flags value) return ethtool_header_flags_strmap[value]; } +static const char * const ethtool_c33_pse_ext_state_strmap[] = { + [0] = "none", + [1] = "error-condition", + [2] = "mr-mps-valid", + [3] = "mr-pse-enable", + [4] = "option-detect-ted", + [5] = "option-vport-lim", + [6] = "ovld-detected", + [7] = "power-not-available", + [8] = "short-detected", +}; + +const char *ethtool_c33_pse_ext_state_str(int value) +{ + if (value < 0 || value >= (int)YNL_ARRAY_SIZE(ethtool_c33_pse_ext_state_strmap)) + return NULL; + return ethtool_c33_pse_ext_state_strmap[value]; +} + /* Policies */ const struct ynl_policy_attr ethtool_header_policy[ETHTOOL_A_HEADER_MAX + 1] = { [ETHTOOL_A_HEADER_DEV_INDEX] = { .name = "dev-index", .type = YNL_PT_U32, }, @@ -162,6 +181,16 @@ const struct ynl_policy_nest ethtool_fec_stat_nest = { .table = ethtool_fec_stat_policy, }; +const struct ynl_policy_attr ethtool_c33_pse_pw_limit_policy[ETHTOOL_A_C33_PSE_PW_LIMIT_MAX + 1] = { + [ETHTOOL_A_C33_PSE_PW_LIMIT_MIN] = { .name = "min", .type = YNL_PT_U32, }, + [ETHTOOL_A_C33_PSE_PW_LIMIT_MAX] = { .name = "max", .type = YNL_PT_U32, }, +}; + +const struct ynl_policy_nest ethtool_c33_pse_pw_limit_nest = { + .max_attr = ETHTOOL_A_C33_PSE_PW_LIMIT_MAX, + .table = ethtool_c33_pse_pw_limit_policy, +}; + const struct ynl_policy_attr ethtool_mm_stat_policy[ETHTOOL_A_MM_STAT_MAX + 1] = { [ETHTOOL_A_MM_STAT_PAD] = { .name = "pad", .type = YNL_PT_IGNORE, }, [ETHTOOL_A_MM_STAT_REASSEMBLY_ERRORS] = { .name = "reassembly-errors", .type = YNL_PT_U64, }, @@ -660,6 +689,12 @@ const struct ynl_policy_attr ethtool_pse_policy[ETHTOOL_A_PSE_MAX + 1] = { [ETHTOOL_A_C33_PSE_ADMIN_STATE] = { .name = "c33-pse-admin-state", .type = YNL_PT_U32, }, [ETHTOOL_A_C33_PSE_ADMIN_CONTROL] = { .name = "c33-pse-admin-control", .type = YNL_PT_U32, }, [ETHTOOL_A_C33_PSE_PW_D_STATUS] = { .name = "c33-pse-pw-d-status", .type = YNL_PT_U32, }, + [ETHTOOL_A_C33_PSE_PW_CLASS] = { .name = "c33-pse-pw-class", .type = YNL_PT_U32, }, + [ETHTOOL_A_C33_PSE_ACTUAL_PW] = { .name = "c33-pse-actual-pw", .type = YNL_PT_U32, }, + [ETHTOOL_A_C33_PSE_EXT_STATE] = { .name = "c33-pse-ext-state", .type = YNL_PT_U32, }, + [ETHTOOL_A_C33_PSE_EXT_SUBSTATE] = { .name = "c33-pse-ext-substate", .type = YNL_PT_U32, }, + [ETHTOOL_A_C33_PSE_AVAIL_PW_LIMIT] = { .name = "c33-pse-avail-pw-limit", .type = YNL_PT_U32, }, + [ETHTOOL_A_C33_PSE_PW_LIMIT_RANGES] = { .name = "c33-pse-pw-limit-ranges", .type = YNL_PT_NEST, .nest = ðtool_c33_pse_pw_limit_nest, }, }; const struct ynl_policy_nest ethtool_pse_nest = { @@ -927,6 +962,35 @@ int ethtool_fec_stat_parse(struct ynl_parse_arg *yarg, return 0; } +void ethtool_c33_pse_pw_limit_free(struct ethtool_c33_pse_pw_limit *obj) +{ +} + +int ethtool_c33_pse_pw_limit_parse(struct ynl_parse_arg *yarg, + const struct nlattr *nested) +{ + struct ethtool_c33_pse_pw_limit *dst = yarg->data; + const struct nlattr *attr; + + ynl_attr_for_each_nested(attr, nested) { + unsigned int type = ynl_attr_type(attr); + + if (type == ETHTOOL_A_C33_PSE_PW_LIMIT_MIN) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.min = 1; + dst->min = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_C33_PSE_PW_LIMIT_MAX) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.max = 1; + dst->max = ynl_attr_get_u32(attr); + } + } + + return 0; +} + void ethtool_mm_stat_free(struct ethtool_mm_stat *obj) { } @@ -5662,20 +5726,30 @@ void ethtool_pse_get_req_free(struct ethtool_pse_get_req *req) void ethtool_pse_get_rsp_free(struct ethtool_pse_get_rsp *rsp) { + unsigned int i; + ethtool_header_free(&rsp->header); + for (i = 0; i < rsp->n_c33_pse_pw_limit_ranges; i++) + ethtool_c33_pse_pw_limit_free(&rsp->c33_pse_pw_limit_ranges[i]); + free(rsp->c33_pse_pw_limit_ranges); free(rsp); } int ethtool_pse_get_rsp_parse(const struct nlmsghdr *nlh, struct ynl_parse_arg *yarg) { + unsigned int n_c33_pse_pw_limit_ranges = 0; struct ethtool_pse_get_rsp *dst; const struct nlattr *attr; struct ynl_parse_arg parg; + int i; dst = yarg->data; parg.ys = yarg->ys; + if (dst->c33_pse_pw_limit_ranges) + return ynl_error_parse(yarg, "attribute already present (pse.c33-pse-pw-limit-ranges)"); + ynl_attr_for_each(attr, nlh, yarg->ys->family->hdr_len) { unsigned int type = ynl_attr_type(attr); @@ -5718,6 +5792,48 @@ int ethtool_pse_get_rsp_parse(const struct nlmsghdr *nlh, return YNL_PARSE_CB_ERROR; dst->_present.c33_pse_pw_d_status = 1; dst->c33_pse_pw_d_status = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_C33_PSE_PW_CLASS) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.c33_pse_pw_class = 1; + dst->c33_pse_pw_class = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_C33_PSE_ACTUAL_PW) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.c33_pse_actual_pw = 1; + dst->c33_pse_actual_pw = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_C33_PSE_EXT_STATE) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.c33_pse_ext_state = 1; + dst->c33_pse_ext_state = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_C33_PSE_EXT_SUBSTATE) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.c33_pse_ext_substate = 1; + dst->c33_pse_ext_substate = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_C33_PSE_AVAIL_PW_LIMIT) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.c33_pse_avail_pw_limit = 1; + dst->c33_pse_avail_pw_limit = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_C33_PSE_PW_LIMIT_RANGES) { + n_c33_pse_pw_limit_ranges++; + } + } + + if (n_c33_pse_pw_limit_ranges) { + dst->c33_pse_pw_limit_ranges = calloc(n_c33_pse_pw_limit_ranges, sizeof(*dst->c33_pse_pw_limit_ranges)); + dst->n_c33_pse_pw_limit_ranges = n_c33_pse_pw_limit_ranges; + i = 0; + parg.rsp_policy = ðtool_c33_pse_pw_limit_nest; + ynl_attr_for_each(attr, nlh, yarg->ys->family->hdr_len) { + if (ynl_attr_type(attr) == ETHTOOL_A_C33_PSE_PW_LIMIT_RANGES) { + parg.data = &dst->c33_pse_pw_limit_ranges[i]; + if (ethtool_c33_pse_pw_limit_parse(&parg, attr)) + return YNL_PARSE_CB_ERROR; + i++; + } } } @@ -5767,10 +5883,15 @@ void ethtool_pse_get_list_free(struct ethtool_pse_get_list *rsp) struct ethtool_pse_get_list *next = rsp; while ((void *)next != YNL_LIST_END) { + unsigned int i; + rsp = next; next = rsp->next; ethtool_header_free(&rsp->obj.header); + for (i = 0; i < rsp->obj.n_c33_pse_pw_limit_ranges; i++) + ethtool_c33_pse_pw_limit_free(&rsp->obj.c33_pse_pw_limit_ranges[i]); + free(rsp->obj.c33_pse_pw_limit_ranges); free(rsp); } } @@ -5829,6 +5950,8 @@ int ethtool_pse_set(struct ynl_sock *ys, struct ethtool_pse_set_req *req) ynl_attr_put_u32(nlh, ETHTOOL_A_PODL_PSE_ADMIN_CONTROL, req->podl_pse_admin_control); if (req->_present.c33_pse_admin_control) ynl_attr_put_u32(nlh, ETHTOOL_A_C33_PSE_ADMIN_CONTROL, req->c33_pse_admin_control); + if (req->_present.c33_pse_avail_pw_limit) + ynl_attr_put_u32(nlh, ETHTOOL_A_C33_PSE_AVAIL_PW_LIMIT, req->c33_pse_avail_pw_limit); err = ynl_exec(ys, nlh, &yrs); if (err < 0) diff --git a/home/nipa/nipa_out/866464/ynl/old-code/ethtool-user.h b/home/nipa/nipa_out/866464/ynl/new-code/ethtool-user.h index eff40f3a0e2d..363943e6a438 100644 --- a/home/nipa/nipa_out/866464/ynl/old-code/ethtool-user.h +++ b/home/nipa/nipa_out/866464/ynl/new-code/ethtool-user.h @@ -21,6 +21,7 @@ const char *ethtool_op_str(int op); const char *ethtool_udp_tunnel_type_str(int value); const char *ethtool_stringset_str(enum ethtool_stringset value); const char *ethtool_header_flags_str(enum ethtool_header_flags value); +const char *ethtool_c33_pse_ext_state_str(int value); /* Common nested types */ struct ethtool_header { @@ -83,6 +84,16 @@ struct ethtool_fec_stat { void *corr_bits; }; +struct ethtool_c33_pse_pw_limit { + struct { + __u32 min:1; + __u32 max:1; + } _present; + + __u32 min; + __u32 max; +}; + struct ethtool_mm_stat { struct { __u32 reassembly_errors:1; @@ -4739,6 +4750,11 @@ struct ethtool_pse_get_rsp { __u32 c33_pse_admin_state:1; __u32 c33_pse_admin_control:1; __u32 c33_pse_pw_d_status:1; + __u32 c33_pse_pw_class:1; + __u32 c33_pse_actual_pw:1; + __u32 c33_pse_ext_state:1; + __u32 c33_pse_ext_substate:1; + __u32 c33_pse_avail_pw_limit:1; } _present; struct ethtool_header header; @@ -4748,6 +4764,13 @@ struct ethtool_pse_get_rsp { __u32 c33_pse_admin_state; __u32 c33_pse_admin_control; __u32 c33_pse_pw_d_status; + __u32 c33_pse_pw_class; + __u32 c33_pse_actual_pw; + int c33_pse_ext_state; + __u32 c33_pse_ext_substate; + __u32 c33_pse_avail_pw_limit; + unsigned int n_c33_pse_pw_limit_ranges; + struct ethtool_c33_pse_pw_limit *c33_pse_pw_limit_ranges; }; void ethtool_pse_get_rsp_free(struct ethtool_pse_get_rsp *rsp); @@ -4819,11 +4842,13 @@ struct ethtool_pse_set_req { __u32 header:1; __u32 podl_pse_admin_control:1; __u32 c33_pse_admin_control:1; + __u32 c33_pse_avail_pw_limit:1; } _present; struct ethtool_header header; __u32 podl_pse_admin_control; __u32 c33_pse_admin_control; + __u32 c33_pse_avail_pw_limit; }; static inline struct ethtool_pse_set_req *ethtool_pse_set_req_alloc(void) @@ -4873,6 +4898,13 @@ ethtool_pse_set_req_set_c33_pse_admin_control(struct ethtool_pse_set_req *req, req->_present.c33_pse_admin_control = 1; req->c33_pse_admin_control = c33_pse_admin_control; } +static inline void +ethtool_pse_set_req_set_c33_pse_avail_pw_limit(struct ethtool_pse_set_req *req, + __u32 c33_pse_avail_pw_limit) +{ + req->_present.c33_pse_avail_pw_limit = 1; + req->c33_pse_avail_pw_limit = c33_pse_avail_pw_limit; +} /* * Set Power Sourcing Equipment params.