diff --git a/home/nipa/nipa_out/955743/ynl/old-code/ethtool-user.c b/home/nipa/nipa_out/955743/ynl/new-code/ethtool-user.c index 72ccc16eae19..3f24d06b3488 100644 --- a/home/nipa/nipa_out/955743/ynl/old-code/ethtool-user.c +++ b/home/nipa/nipa_out/955743/ynl/new-code/ethtool-user.c @@ -64,6 +64,7 @@ static const char * const ethtool_op_strmap[] = { [46] = "phy-ntf", [47] = "tsconfig-get", [48] = "tsconfig-set", + [49] = "pse-ntf", }; const char *ethtool_op_str(int op) @@ -169,6 +170,24 @@ const char *ethtool_tcp_data_split_str(enum ethtool_tcp_data_split value) return ethtool_tcp_data_split_strmap[value]; } +static const char * const ethtool_pse_events_strmap[] = { + [0] = "pse-event-over-current", + [1] = "pse-event-over-temp", + [2] = "c33-pse-event-detection", + [3] = "c33-pse-event-classification", + [4] = "c33-pse-event-disconnection", + [5] = "pse-event-over-budget", + [6] = "pse-event-sw-pw-control-error", +}; + +const char *ethtool_pse_events_str(enum ethtool_pse_events value) +{ + value = ffs(value) - 1; + if (value < 0 || value >= (int)YNL_ARRAY_SIZE(ethtool_pse_events_strmap)) + return NULL; + return ethtool_pse_events_strmap[value]; +} + /* Policies */ const struct ynl_policy_attr ethtool_header_policy[ETHTOOL_A_HEADER_MAX + 1] = { [ETHTOOL_A_HEADER_UNSPEC] = { .name = "unspec", .type = YNL_PT_REJECT, }, @@ -807,6 +826,9 @@ const struct ynl_policy_attr ethtool_pse_policy[ETHTOOL_A_PSE_MAX + 1] = { [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, }, + [ETHTOOL_A_PSE_PW_D_ID] = { .name = "pse-pw-d-id", .type = YNL_PT_U32, }, + [ETHTOOL_A_PSE_PRIO_MAX] = { .name = "pse-prio-max", .type = YNL_PT_U32, }, + [ETHTOOL_A_PSE_PRIO] = { .name = "pse-prio", .type = YNL_PT_U32, }, }; const struct ynl_policy_nest ethtool_pse_nest = { @@ -915,6 +937,16 @@ const struct ynl_policy_nest ethtool_tsconfig_nest = { .table = ethtool_tsconfig_policy, }; +const struct ynl_policy_attr ethtool_pse_ntf_policy[ETHTOOL_A_PSE_NTF_MAX + 1] = { + [ETHTOOL_A_PSE_NTF_HEADER] = { .name = "header", .type = YNL_PT_NEST, .nest = ðtool_header_nest, }, + [ETHTOOL_A_PSE_NTF_EVENTS] = { .name = "events", .type = YNL_PT_UINT, }, +}; + +const struct ynl_policy_nest ethtool_pse_ntf_nest = { + .max_attr = ETHTOOL_A_PSE_NTF_MAX, + .table = ethtool_pse_ntf_policy, +}; + /* Common nested types */ void ethtool_header_free(struct ethtool_header *obj) { @@ -6112,6 +6144,21 @@ int ethtool_pse_get_rsp_parse(const struct nlmsghdr *nlh, 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++; + } else if (type == ETHTOOL_A_PSE_PW_D_ID) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.pse_pw_d_id = 1; + dst->pse_pw_d_id = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_PSE_PRIO_MAX) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.pse_prio_max = 1; + dst->pse_prio_max = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_PSE_PRIO) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.pse_prio = 1; + dst->pse_prio = ynl_attr_get_u32(attr); } } @@ -6245,6 +6292,8 @@ int ethtool_pse_set(struct ynl_sock *ys, struct ethtool_pse_set_req *req) 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); + if (req->_present.pse_prio) + ynl_attr_put_u32(nlh, ETHTOOL_A_PSE_PRIO, req->pse_prio); err = ynl_exec(ys, nlh, &yrs); if (err < 0) @@ -7708,6 +7757,46 @@ void ethtool_module_fw_flash_ntf_free(struct ethtool_module_fw_flash_ntf *rsp) free(rsp); } +/* ETHTOOL_MSG_PSE_NTF - event */ +int ethtool_pse_ntf_rsp_parse(const struct nlmsghdr *nlh, + struct ynl_parse_arg *yarg) +{ + struct ethtool_pse_ntf_rsp *dst; + const struct nlattr *attr; + struct ynl_parse_arg parg; + + dst = yarg->data; + parg.ys = yarg->ys; + + ynl_attr_for_each(attr, nlh, yarg->ys->family->hdr_len) { + unsigned int type = ynl_attr_type(attr); + + if (type == ETHTOOL_A_PSE_NTF_HEADER) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.header = 1; + + parg.rsp_policy = ðtool_header_nest; + parg.data = &dst->header; + if (ethtool_header_parse(&parg, attr)) + return YNL_PARSE_CB_ERROR; + } else if (type == ETHTOOL_A_PSE_NTF_EVENTS) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.events = 1; + dst->events = ynl_attr_get_uint(attr); + } + } + + return YNL_PARSE_CB_OK; +} + +void ethtool_pse_ntf_free(struct ethtool_pse_ntf *rsp) +{ + ethtool_header_free(&rsp->obj.header); + free(rsp); +} + static const struct ynl_ntf_info ethtool_ntf_info[] = { [ETHTOOL_MSG_LINKINFO_NTF] = { .alloc_sz = sizeof(struct ethtool_linkinfo_get_ntf), @@ -7823,6 +7912,12 @@ static const struct ynl_ntf_info ethtool_ntf_info[] = { .policy = ðtool_phy_nest, .free = (void *)ethtool_phy_get_ntf_free, }, + [ETHTOOL_MSG_PSE_NTF] = { + .alloc_sz = sizeof(struct ethtool_pse_ntf), + .cb = ethtool_pse_ntf_rsp_parse, + .policy = ðtool_pse_ntf_nest, + .free = (void *)ethtool_pse_ntf_free, + }, }; const struct ynl_family ynl_ethtool_family = { diff --git a/home/nipa/nipa_out/955743/ynl/old-code/ethtool-user.h b/home/nipa/nipa_out/955743/ynl/new-code/ethtool-user.h index dae56d1efe3a..561f06ec1cf1 100644 --- a/home/nipa/nipa_out/955743/ynl/old-code/ethtool-user.h +++ b/home/nipa/nipa_out/955743/ynl/new-code/ethtool-user.h @@ -28,6 +28,7 @@ const char * ethtool_c33_pse_ext_state_str(enum ethtool_c33_pse_ext_state value); const char *ethtool_phy_upstream_type_str(int value); const char *ethtool_tcp_data_split_str(enum ethtool_tcp_data_split value); +const char *ethtool_pse_events_str(enum ethtool_pse_events value); /* Common nested types */ struct ethtool_header { @@ -5589,6 +5590,9 @@ struct ethtool_pse_get_rsp { __u32 c33_pse_ext_state:1; __u32 c33_pse_ext_substate:1; __u32 c33_pse_avail_pw_limit:1; + __u32 pse_pw_d_id:1; + __u32 pse_prio_max:1; + __u32 pse_prio:1; } _present; struct ethtool_header header; @@ -5605,6 +5609,9 @@ struct ethtool_pse_get_rsp { __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; + __u32 pse_pw_d_id; + __u32 pse_prio_max; + __u32 pse_prio; }; void ethtool_pse_get_rsp_free(struct ethtool_pse_get_rsp *rsp); @@ -5685,12 +5692,14 @@ struct ethtool_pse_set_req { __u32 podl_pse_admin_control:1; __u32 c33_pse_admin_control:1; __u32 c33_pse_avail_pw_limit:1; + __u32 pse_prio:1; } _present; struct ethtool_header header; __u32 podl_pse_admin_control; __u32 c33_pse_admin_control; __u32 c33_pse_avail_pw_limit; + __u32 pse_prio; }; static inline struct ethtool_pse_set_req *ethtool_pse_set_req_alloc(void) @@ -5755,6 +5764,13 @@ ethtool_pse_set_req_set_c33_pse_avail_pw_limit(struct ethtool_pse_set_req *req, req->_present.c33_pse_avail_pw_limit = 1; req->c33_pse_avail_pw_limit = c33_pse_avail_pw_limit; } +static inline void +ethtool_pse_set_req_set_pse_prio(struct ethtool_pse_set_req *req, + __u32 pse_prio) +{ + req->_present.pse_prio = 1; + req->pse_prio = pse_prio; +} /* * Set Power Sourcing Equipment params. @@ -7318,4 +7334,25 @@ struct ethtool_module_fw_flash_ntf { void ethtool_module_fw_flash_ntf_free(struct ethtool_module_fw_flash_ntf *rsp); +/* ETHTOOL_MSG_PSE_NTF - event */ +struct ethtool_pse_ntf_rsp { + struct { + __u32 header:1; + __u32 events:1; + } _present; + + struct ethtool_header header; + __u64 events; +}; + +struct ethtool_pse_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_pse_ntf *ntf); + struct ethtool_pse_ntf_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_pse_ntf_free(struct ethtool_pse_ntf *rsp); + #endif /* _LINUX_ETHTOOL_GEN_H */