diff --git a/home/nipa/nipa_out/889498/ynl/old-code/ethtool-user.c b/home/nipa/nipa_out/889498/ynl/new-code/ethtool-user.c index 9007305c8cbd..6365cc3ad06d 100644 --- a/home/nipa/nipa_out/889498/ynl/old-code/ethtool-user.c +++ b/home/nipa/nipa_out/889498/ynl/new-code/ethtool-user.c @@ -809,6 +809,8 @@ const struct ynl_policy_attr ethtool_phy_policy[ETHTOOL_A_PHY_MAX + 1] = { [ETHTOOL_A_PHY_UPSTREAM_INDEX] = { .name = "upstream-index", .type = YNL_PT_U32, }, [ETHTOOL_A_PHY_UPSTREAM_SFP_NAME] = { .name = "upstream-sfp-name", .type = YNL_PT_NUL_STR, }, [ETHTOOL_A_PHY_DOWNSTREAM_SFP_NAME] = { .name = "downstream-sfp-name", .type = YNL_PT_NUL_STR, }, + [ETHTOOL_A_PHY_ISOLATE] = { .name = "isolate", .type = YNL_PT_U8, }, + [ETHTOOL_A_PHY_LOOPBACK] = { .name = "loopback", .type = YNL_PT_U8, }, }; const struct ynl_policy_nest ethtool_phy_nest = { @@ -6946,6 +6948,16 @@ int ethtool_phy_get_rsp_parse(const struct nlmsghdr *nlh, dst->downstream_sfp_name = malloc(len + 1); memcpy(dst->downstream_sfp_name, ynl_attr_get_str(attr), len); dst->downstream_sfp_name[len] = 0; + } else if (type == ETHTOOL_A_PHY_ISOLATE) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.isolate = 1; + dst->isolate = ynl_attr_get_u8(attr); + } else if (type == ETHTOOL_A_PHY_LOOPBACK) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.loopback = 1; + dst->loopback = ynl_attr_get_u8(attr); } } @@ -7038,6 +7050,37 @@ ethtool_phy_get_dump(struct ynl_sock *ys, struct ethtool_phy_get_req_dump *req) return NULL; } +/* ============== ETHTOOL_MSG_PHY_SET ============== */ +/* ETHTOOL_MSG_PHY_SET - do */ +void ethtool_phy_set_req_free(struct ethtool_phy_set_req *req) +{ + ethtool_header_free(&req->header); + free(req); +} + +int ethtool_phy_set(struct ynl_sock *ys, struct ethtool_phy_set_req *req) +{ + struct ynl_req_state yrs = { .yarg = { .ys = ys, }, }; + struct nlmsghdr *nlh; + int err; + + nlh = ynl_gemsg_start_req(ys, ys->family_id, ETHTOOL_MSG_PHY_SET, 1); + ys->req_policy = ðtool_phy_nest; + + if (req->_present.header) + ethtool_header_put(nlh, ETHTOOL_A_PHY_HEADER, &req->header); + if (req->_present.isolate) + ynl_attr_put_u8(nlh, ETHTOOL_A_PHY_ISOLATE, req->isolate); + if (req->_present.loopback) + ynl_attr_put_u8(nlh, ETHTOOL_A_PHY_LOOPBACK, req->loopback); + + err = ynl_exec(ys, nlh, &yrs); + if (err < 0) + return -1; + + return 0; +} + /* ETHTOOL_MSG_CABLE_TEST_NTF - event */ int ethtool_cable_test_ntf_rsp_parse(const struct nlmsghdr *nlh, struct ynl_parse_arg *yarg) diff --git a/home/nipa/nipa_out/889498/ynl/old-code/ethtool-user.h b/home/nipa/nipa_out/889498/ynl/new-code/ethtool-user.h index 8cdc5a3bbf24..0fcf9da4e9f6 100644 --- a/home/nipa/nipa_out/889498/ynl/old-code/ethtool-user.h +++ b/home/nipa/nipa_out/889498/ynl/new-code/ethtool-user.h @@ -6371,6 +6371,8 @@ struct ethtool_phy_get_rsp { __u32 upstream_index:1; __u32 upstream_sfp_name_len; __u32 downstream_sfp_name_len; + __u32 isolate:1; + __u32 loopback:1; } _present; struct ethtool_header header; @@ -6381,6 +6383,8 @@ struct ethtool_phy_get_rsp { __u32 upstream_index; char *upstream_sfp_name; char *downstream_sfp_name; + __u8 isolate; + __u8 loopback; }; void ethtool_phy_get_rsp_free(struct ethtool_phy_get_rsp *rsp); @@ -6453,6 +6457,80 @@ void ethtool_phy_get_list_free(struct ethtool_phy_get_list *rsp); struct ethtool_phy_get_list * ethtool_phy_get_dump(struct ynl_sock *ys, struct ethtool_phy_get_req_dump *req); +/* ============== ETHTOOL_MSG_PHY_SET ============== */ +/* ETHTOOL_MSG_PHY_SET - do */ +struct ethtool_phy_set_req { + struct { + __u32 header:1; + __u32 isolate:1; + __u32 loopback:1; + } _present; + + struct ethtool_header header; + __u8 isolate; + __u8 loopback; +}; + +static inline struct ethtool_phy_set_req *ethtool_phy_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_phy_set_req)); +} +void ethtool_phy_set_req_free(struct ethtool_phy_set_req *req); + +static inline void +ethtool_phy_set_req_set_header_dev_index(struct ethtool_phy_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_phy_set_req_set_header_dev_name(struct ethtool_phy_set_req *req, + const char *dev_name) +{ + req->_present.header = 1; + free(req->header.dev_name); + req->header._present.dev_name_len = strlen(dev_name); + req->header.dev_name = malloc(req->header._present.dev_name_len + 1); + memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len); + req->header.dev_name[req->header._present.dev_name_len] = 0; +} +static inline void +ethtool_phy_set_req_set_header_flags(struct ethtool_phy_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_phy_set_req_set_header_phy_index(struct ethtool_phy_set_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} +static inline void +ethtool_phy_set_req_set_isolate(struct ethtool_phy_set_req *req, __u8 isolate) +{ + req->_present.isolate = 1; + req->isolate = isolate; +} +static inline void +ethtool_phy_set_req_set_loopback(struct ethtool_phy_set_req *req, + __u8 loopback) +{ + req->_present.loopback = 1; + req->loopback = loopback; +} + +/* + * Set configuration attributes for attached PHY devices + */ +int ethtool_phy_set(struct ynl_sock *ys, struct ethtool_phy_set_req *req); + /* ETHTOOL_MSG_CABLE_TEST_NTF - event */ struct ethtool_cable_test_ntf_rsp { struct {