diff --git a/home/nipa/nipa_out/868818/ynl/old-code/ethtool-user.c b/home/nipa/nipa_out/868818/ynl/new-code/ethtool-user.c index 8f8ba955fa91..0ca3976f09df 100644 --- a/home/nipa/nipa_out/868818/ynl/old-code/ethtool-user.c +++ b/home/nipa/nipa_out/868818/ynl/new-code/ethtool-user.c @@ -59,6 +59,7 @@ static const char * const ethtool_op_strmap[] = { [ETHTOOL_MSG_MM_GET] = "mm-get", [43] = "mm-ntf", [44] = "module-fw-flash-ntf", + [ETHTOOL_MSG_PHY_GET] = "phy-get", }; const char *ethtool_op_str(int op) @@ -120,11 +121,24 @@ ethtool_module_fw_flash_status_str(enum ethtool_module_fw_flash_status value) return ethtool_module_fw_flash_status_strmap[value]; } +static const char * const ethtool_phy_upstream_type_strmap[] = { + [0] = "mac", + [1] = "phy", +}; + +const char *ethtool_phy_upstream_type_str(int value) +{ + if (value < 0 || value >= (int)YNL_ARRAY_SIZE(ethtool_phy_upstream_type_strmap)) + return NULL; + return ethtool_phy_upstream_type_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, }, [ETHTOOL_A_HEADER_DEV_NAME] = { .name = "dev-name", .type = YNL_PT_NUL_STR, }, [ETHTOOL_A_HEADER_FLAGS] = { .name = "flags", .type = YNL_PT_U32, }, + [ETHTOOL_A_HEADER_PHY_INDEX] = { .name = "phy-index", .type = YNL_PT_U32, }, }; const struct ynl_policy_nest ethtool_header_nest = { @@ -748,6 +762,22 @@ const struct ynl_policy_nest ethtool_module_fw_flash_nest = { .table = ethtool_module_fw_flash_policy, }; +const struct ynl_policy_attr ethtool_phy_policy[ETHTOOL_A_PHY_MAX + 1] = { + [ETHTOOL_A_PHY_HEADER] = { .name = "header", .type = YNL_PT_NEST, .nest = ðtool_header_nest, }, + [ETHTOOL_A_PHY_INDEX] = { .name = "index", .type = YNL_PT_U32, }, + [ETHTOOL_A_PHY_DRVNAME] = { .name = "drvname", .type = YNL_PT_NUL_STR, }, + [ETHTOOL_A_PHY_NAME] = { .name = "name", .type = YNL_PT_NUL_STR, }, + [ETHTOOL_A_PHY_UPSTREAM_TYPE] = { .name = "upstream-type", .type = YNL_PT_U32, }, + [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, }, +}; + +const struct ynl_policy_nest ethtool_phy_nest = { + .max_attr = ETHTOOL_A_PHY_MAX, + .table = ethtool_phy_policy, +}; + /* Common nested types */ void ethtool_header_free(struct ethtool_header *obj) { @@ -766,6 +796,8 @@ int ethtool_header_put(struct nlmsghdr *nlh, unsigned int attr_type, ynl_attr_put_str(nlh, ETHTOOL_A_HEADER_DEV_NAME, obj->dev_name); if (obj->_present.flags) ynl_attr_put_u32(nlh, ETHTOOL_A_HEADER_FLAGS, obj->flags); + if (obj->_present.phy_index) + ynl_attr_put_u32(nlh, ETHTOOL_A_HEADER_PHY_INDEX, obj->phy_index); ynl_attr_nest_end(nlh, nest); return 0; @@ -801,6 +833,11 @@ int ethtool_header_parse(struct ynl_parse_arg *yarg, return YNL_PARSE_CB_ERROR; dst->_present.flags = 1; dst->flags = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_HEADER_PHY_INDEX) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.phy_index = 1; + dst->phy_index = ynl_attr_get_u32(attr); } } @@ -6670,6 +6707,197 @@ int ethtool_module_fw_flash_act(struct ynl_sock *ys, return 0; } +/* ============== ETHTOOL_MSG_PHY_GET ============== */ +/* ETHTOOL_MSG_PHY_GET - do */ +void ethtool_phy_get_req_free(struct ethtool_phy_get_req *req) +{ + ethtool_header_free(&req->header); + free(req); +} + +void ethtool_phy_get_rsp_free(struct ethtool_phy_get_rsp *rsp) +{ + ethtool_header_free(&rsp->header); + free(rsp->drvname); + free(rsp->name); + free(rsp->upstream_sfp_name); + free(rsp->downstream_sfp_name); + free(rsp); +} + +int ethtool_phy_get_rsp_parse(const struct nlmsghdr *nlh, + struct ynl_parse_arg *yarg) +{ + struct ethtool_phy_get_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_PHY_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_PHY_INDEX) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.index = 1; + dst->index = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_PHY_DRVNAME) { + unsigned int len; + + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + + len = strnlen(ynl_attr_get_str(attr), ynl_attr_data_len(attr)); + dst->_present.drvname_len = len; + dst->drvname = malloc(len + 1); + memcpy(dst->drvname, ynl_attr_get_str(attr), len); + dst->drvname[len] = 0; + } else if (type == ETHTOOL_A_PHY_NAME) { + unsigned int len; + + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + + len = strnlen(ynl_attr_get_str(attr), ynl_attr_data_len(attr)); + dst->_present.name_len = len; + dst->name = malloc(len + 1); + memcpy(dst->name, ynl_attr_get_str(attr), len); + dst->name[len] = 0; + } else if (type == ETHTOOL_A_PHY_UPSTREAM_TYPE) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.upstream_type = 1; + dst->upstream_type = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_PHY_UPSTREAM_INDEX) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.upstream_index = 1; + dst->upstream_index = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_PHY_UPSTREAM_SFP_NAME) { + unsigned int len; + + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + + len = strnlen(ynl_attr_get_str(attr), ynl_attr_data_len(attr)); + dst->_present.upstream_sfp_name_len = len; + dst->upstream_sfp_name = malloc(len + 1); + memcpy(dst->upstream_sfp_name, ynl_attr_get_str(attr), len); + dst->upstream_sfp_name[len] = 0; + } else if (type == ETHTOOL_A_PHY_DOWNSTREAM_SFP_NAME) { + unsigned int len; + + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + + len = strnlen(ynl_attr_get_str(attr), ynl_attr_data_len(attr)); + dst->_present.downstream_sfp_name_len = len; + dst->downstream_sfp_name = malloc(len + 1); + memcpy(dst->downstream_sfp_name, ynl_attr_get_str(attr), len); + dst->downstream_sfp_name[len] = 0; + } + } + + return YNL_PARSE_CB_OK; +} + +struct ethtool_phy_get_rsp * +ethtool_phy_get(struct ynl_sock *ys, struct ethtool_phy_get_req *req) +{ + struct ynl_req_state yrs = { .yarg = { .ys = ys, }, }; + struct ethtool_phy_get_rsp *rsp; + struct nlmsghdr *nlh; + int err; + + nlh = ynl_gemsg_start_req(ys, ys->family_id, ETHTOOL_MSG_PHY_GET, 1); + ys->req_policy = ðtool_phy_nest; + yrs.yarg.rsp_policy = ðtool_phy_nest; + + if (req->_present.header) + ethtool_header_put(nlh, ETHTOOL_A_PHY_HEADER, &req->header); + + rsp = calloc(1, sizeof(*rsp)); + yrs.yarg.data = rsp; + yrs.cb = ethtool_phy_get_rsp_parse; + yrs.rsp_cmd = ETHTOOL_MSG_PHY_GET; + + err = ynl_exec(ys, nlh, &yrs); + if (err < 0) + goto err_free; + + return rsp; + +err_free: + ethtool_phy_get_rsp_free(rsp); + return NULL; +} + +/* ETHTOOL_MSG_PHY_GET - dump */ +void ethtool_phy_get_req_dump_free(struct ethtool_phy_get_req_dump *req) +{ + ethtool_header_free(&req->header); + free(req); +} + +void ethtool_phy_get_list_free(struct ethtool_phy_get_list *rsp) +{ + struct ethtool_phy_get_list *next = rsp; + + while ((void *)next != YNL_LIST_END) { + rsp = next; + next = rsp->next; + + ethtool_header_free(&rsp->obj.header); + free(rsp->obj.drvname); + free(rsp->obj.name); + free(rsp->obj.upstream_sfp_name); + free(rsp->obj.downstream_sfp_name); + free(rsp); + } +} + +struct ethtool_phy_get_list * +ethtool_phy_get_dump(struct ynl_sock *ys, struct ethtool_phy_get_req_dump *req) +{ + struct ynl_dump_state yds = {}; + struct nlmsghdr *nlh; + int err; + + yds.yarg.ys = ys; + yds.yarg.rsp_policy = ðtool_phy_nest; + yds.yarg.data = NULL; + yds.alloc_sz = sizeof(struct ethtool_phy_get_list); + yds.cb = ethtool_phy_get_rsp_parse; + yds.rsp_cmd = ETHTOOL_MSG_PHY_GET; + + nlh = ynl_gemsg_start_dump(ys, ys->family_id, ETHTOOL_MSG_PHY_GET, 1); + ys->req_policy = ðtool_phy_nest; + + if (req->_present.header) + ethtool_header_put(nlh, ETHTOOL_A_PHY_HEADER, &req->header); + + err = ynl_exec_dump(ys, nlh, &yds); + if (err < 0) + goto free_list; + + return yds.first; + +free_list: + ethtool_phy_get_list_free(yds.first); + return NULL; +} + /* 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/868818/ynl/old-code/ethtool-user.h b/home/nipa/nipa_out/868818/ynl/new-code/ethtool-user.h index 59a1d6ae1723..cd34dc661c5f 100644 --- a/home/nipa/nipa_out/868818/ynl/old-code/ethtool-user.h +++ b/home/nipa/nipa_out/868818/ynl/new-code/ethtool-user.h @@ -23,6 +23,7 @@ const char *ethtool_stringset_str(enum ethtool_stringset value); const char *ethtool_header_flags_str(enum ethtool_header_flags value); const char * ethtool_module_fw_flash_status_str(enum ethtool_module_fw_flash_status value); +const char *ethtool_phy_upstream_type_str(int value); /* Common nested types */ struct ethtool_header { @@ -30,11 +31,13 @@ struct ethtool_header { __u32 dev_index:1; __u32 dev_name_len; __u32 flags:1; + __u32 phy_index:1; } _present; __u32 dev_index; char *dev_name; __u32 flags; + __u32 phy_index; }; struct ethtool_pause_stat { @@ -286,6 +289,14 @@ ethtool_strset_get_req_set_header_flags(struct ethtool_strset_get_req *req, req->header.flags = flags; } static inline void +ethtool_strset_get_req_set_header_phy_index(struct ethtool_strset_get_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_strset_get_req_set_stringsets_stringset(struct ethtool_strset_get_req *req, struct ethtool_stringset_ *stringset, unsigned int n_stringset) @@ -366,6 +377,14 @@ ethtool_strset_get_req_dump_set_header_flags(struct ethtool_strset_get_req_dump req->header.flags = flags; } static inline void +ethtool_strset_get_req_dump_set_header_phy_index(struct ethtool_strset_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} +static inline void __ethtool_strset_get_req_dump_set_stringsets_stringset(struct ethtool_strset_get_req_dump *req, struct ethtool_stringset_ *stringset, unsigned int n_stringset) @@ -436,6 +455,14 @@ ethtool_linkinfo_get_req_set_header_flags(struct ethtool_linkinfo_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_linkinfo_get_req_set_header_phy_index(struct ethtool_linkinfo_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_linkinfo_get_rsp { struct { @@ -507,6 +534,14 @@ ethtool_linkinfo_get_req_dump_set_header_flags(struct ethtool_linkinfo_get_req_d req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_linkinfo_get_req_dump_set_header_phy_index(struct ethtool_linkinfo_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_linkinfo_get_list { struct ethtool_linkinfo_get_list *next; @@ -585,6 +620,14 @@ ethtool_linkinfo_set_req_set_header_flags(struct ethtool_linkinfo_set_req *req, req->header.flags = flags; } static inline void +ethtool_linkinfo_set_req_set_header_phy_index(struct ethtool_linkinfo_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_linkinfo_set_req_set_port(struct ethtool_linkinfo_set_req *req, __u8 port) { @@ -670,6 +713,14 @@ ethtool_linkmodes_get_req_set_header_flags(struct ethtool_linkmodes_get_req *req req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_linkmodes_get_req_set_header_phy_index(struct ethtool_linkmodes_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_linkmodes_get_rsp { struct { @@ -750,6 +801,14 @@ ethtool_linkmodes_get_req_dump_set_header_flags(struct ethtool_linkmodes_get_req req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_linkmodes_get_req_dump_set_header_phy_index(struct ethtool_linkmodes_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_linkmodes_get_list { struct ethtool_linkmodes_get_list *next; @@ -836,6 +895,14 @@ ethtool_linkmodes_set_req_set_header_flags(struct ethtool_linkmodes_set_req *req req->header.flags = flags; } static inline void +ethtool_linkmodes_set_req_set_header_phy_index(struct ethtool_linkmodes_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_linkmodes_set_req_set_autoneg(struct ethtool_linkmodes_set_req *req, __u8 autoneg) { @@ -985,6 +1052,14 @@ ethtool_linkstate_get_req_set_header_flags(struct ethtool_linkstate_get_req *req req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_linkstate_get_req_set_header_phy_index(struct ethtool_linkstate_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_linkstate_get_rsp { struct { @@ -1059,6 +1134,14 @@ ethtool_linkstate_get_req_dump_set_header_flags(struct ethtool_linkstate_get_req req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_linkstate_get_req_dump_set_header_phy_index(struct ethtool_linkstate_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_linkstate_get_list { struct ethtool_linkstate_get_list *next; @@ -1114,6 +1197,14 @@ ethtool_debug_get_req_set_header_flags(struct ethtool_debug_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_debug_get_req_set_header_phy_index(struct ethtool_debug_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_debug_get_rsp { struct { @@ -1176,6 +1267,14 @@ ethtool_debug_get_req_dump_set_header_flags(struct ethtool_debug_get_req_dump *r req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_debug_get_req_dump_set_header_phy_index(struct ethtool_debug_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_debug_get_list { struct ethtool_debug_get_list *next; @@ -1245,6 +1344,14 @@ ethtool_debug_set_req_set_header_flags(struct ethtool_debug_set_req *req, req->header.flags = flags; } static inline void +ethtool_debug_set_req_set_header_phy_index(struct ethtool_debug_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_debug_set_req_set_msgmask_nomask(struct ethtool_debug_set_req *req) { req->_present.msgmask = 1; @@ -1318,6 +1425,14 @@ ethtool_wol_get_req_set_header_flags(struct ethtool_wol_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_wol_get_req_set_header_phy_index(struct ethtool_wol_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_wol_get_rsp { struct { @@ -1382,6 +1497,14 @@ ethtool_wol_get_req_dump_set_header_flags(struct ethtool_wol_get_req_dump *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_wol_get_req_dump_set_header_phy_index(struct ethtool_wol_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_wol_get_list { struct ethtool_wol_get_list *next; @@ -1452,6 +1575,14 @@ ethtool_wol_set_req_set_header_flags(struct ethtool_wol_set_req *req, req->header.flags = flags; } static inline void +ethtool_wol_set_req_set_header_phy_index(struct ethtool_wol_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_wol_set_req_set_modes_nomask(struct ethtool_wol_set_req *req) { req->_present.modes = 1; @@ -1534,6 +1665,14 @@ ethtool_features_get_req_set_header_flags(struct ethtool_features_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_features_get_req_set_header_phy_index(struct ethtool_features_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_features_get_rsp { struct { @@ -1603,6 +1742,14 @@ ethtool_features_get_req_dump_set_header_flags(struct ethtool_features_get_req_d req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_features_get_req_dump_set_header_phy_index(struct ethtool_features_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_features_get_list { struct ethtool_features_get_list *next; @@ -1679,6 +1826,14 @@ ethtool_features_set_req_set_header_flags(struct ethtool_features_set_req *req, req->header.flags = flags; } static inline void +ethtool_features_set_req_set_header_phy_index(struct ethtool_features_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_features_set_req_set_hw_nomask(struct ethtool_features_set_req *req) { req->_present.hw = 1; @@ -1847,6 +2002,14 @@ ethtool_privflags_get_req_set_header_flags(struct ethtool_privflags_get_req *req req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_privflags_get_req_set_header_phy_index(struct ethtool_privflags_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_privflags_get_rsp { struct { @@ -1911,6 +2074,14 @@ ethtool_privflags_get_req_dump_set_header_flags(struct ethtool_privflags_get_req req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_privflags_get_req_dump_set_header_phy_index(struct ethtool_privflags_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_privflags_get_list { struct ethtool_privflags_get_list *next; @@ -1981,6 +2152,14 @@ ethtool_privflags_set_req_set_header_flags(struct ethtool_privflags_set_req *req req->header.flags = flags; } static inline void +ethtool_privflags_set_req_set_header_phy_index(struct ethtool_privflags_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_privflags_set_req_set_flags_nomask(struct ethtool_privflags_set_req *req) { req->_present.flags = 1; @@ -2055,6 +2234,14 @@ ethtool_rings_get_req_set_header_flags(struct ethtool_rings_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_rings_get_req_set_header_phy_index(struct ethtool_rings_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_rings_get_rsp { struct { @@ -2145,6 +2332,14 @@ ethtool_rings_get_req_dump_set_header_flags(struct ethtool_rings_get_req_dump *r req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_rings_get_req_dump_set_header_phy_index(struct ethtool_rings_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_rings_get_list { struct ethtool_rings_get_list *next; @@ -2242,6 +2437,14 @@ ethtool_rings_set_req_set_header_flags(struct ethtool_rings_set_req *req, req->header.flags = flags; } static inline void +ethtool_rings_set_req_set_header_phy_index(struct ethtool_rings_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_rings_set_req_set_rx_max(struct ethtool_rings_set_req *req, __u32 rx_max) { @@ -2394,6 +2597,14 @@ ethtool_channels_get_req_set_header_flags(struct ethtool_channels_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_channels_get_req_set_header_phy_index(struct ethtool_channels_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_channels_get_rsp { struct { @@ -2471,6 +2682,14 @@ ethtool_channels_get_req_dump_set_header_flags(struct ethtool_channels_get_req_d req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_channels_get_req_dump_set_header_phy_index(struct ethtool_channels_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_channels_get_list { struct ethtool_channels_get_list *next; @@ -2555,6 +2774,14 @@ ethtool_channels_set_req_set_header_flags(struct ethtool_channels_set_req *req, req->header.flags = flags; } static inline void +ethtool_channels_set_req_set_header_phy_index(struct ethtool_channels_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_channels_set_req_set_rx_max(struct ethtool_channels_set_req *req, __u32 rx_max) { @@ -2661,6 +2888,14 @@ ethtool_coalesce_get_req_set_header_flags(struct ethtool_coalesce_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_coalesce_get_req_set_header_phy_index(struct ethtool_coalesce_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_coalesce_get_rsp { struct { @@ -2780,6 +3015,14 @@ ethtool_coalesce_get_req_dump_set_header_flags(struct ethtool_coalesce_get_req_d req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_coalesce_get_req_dump_set_header_phy_index(struct ethtool_coalesce_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_coalesce_get_list { struct ethtool_coalesce_get_list *next; @@ -2906,6 +3149,14 @@ ethtool_coalesce_set_req_set_header_flags(struct ethtool_coalesce_set_req *req, req->header.flags = flags; } static inline void +ethtool_coalesce_set_req_set_header_phy_index(struct ethtool_coalesce_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_coalesce_set_req_set_rx_usecs(struct ethtool_coalesce_set_req *req, __u32 rx_usecs) { @@ -3164,6 +3415,14 @@ ethtool_pause_get_req_set_header_flags(struct ethtool_pause_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_pause_get_req_set_header_phy_index(struct ethtool_pause_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_pause_get_rsp { struct { @@ -3234,6 +3493,14 @@ ethtool_pause_get_req_dump_set_header_flags(struct ethtool_pause_get_req_dump *r req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_pause_get_req_dump_set_header_phy_index(struct ethtool_pause_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_pause_get_list { struct ethtool_pause_get_list *next; @@ -3311,6 +3578,14 @@ ethtool_pause_set_req_set_header_flags(struct ethtool_pause_set_req *req, req->header.flags = flags; } static inline void +ethtool_pause_set_req_set_header_phy_index(struct ethtool_pause_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_pause_set_req_set_autoneg(struct ethtool_pause_set_req *req, __u8 autoneg) { @@ -3401,6 +3676,14 @@ ethtool_eee_get_req_set_header_flags(struct ethtool_eee_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_eee_get_req_set_header_phy_index(struct ethtool_eee_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_eee_get_rsp { struct { @@ -3473,6 +3756,14 @@ ethtool_eee_get_req_dump_set_header_flags(struct ethtool_eee_get_req_dump *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_eee_get_req_dump_set_header_phy_index(struct ethtool_eee_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_eee_get_list { struct ethtool_eee_get_list *next; @@ -3551,6 +3842,14 @@ ethtool_eee_set_req_set_header_flags(struct ethtool_eee_set_req *req, req->header.flags = flags; } static inline void +ethtool_eee_set_req_set_header_phy_index(struct ethtool_eee_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_eee_set_req_set_modes_ours_nomask(struct ethtool_eee_set_req *req) { req->_present.modes_ours = 1; @@ -3675,6 +3974,14 @@ ethtool_tsinfo_get_req_set_header_flags(struct ethtool_tsinfo_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_tsinfo_get_req_set_header_phy_index(struct ethtool_tsinfo_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_tsinfo_get_rsp { struct { @@ -3745,6 +4052,14 @@ ethtool_tsinfo_get_req_dump_set_header_flags(struct ethtool_tsinfo_get_req_dump req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_tsinfo_get_req_dump_set_header_phy_index(struct ethtool_tsinfo_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_tsinfo_get_list { struct ethtool_tsinfo_get_list *next; @@ -3801,6 +4116,14 @@ ethtool_cable_test_act_req_set_header_flags(struct ethtool_cable_test_act_req *r req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_cable_test_act_req_set_header_phy_index(struct ethtool_cable_test_act_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} /* * Cable test. @@ -3853,6 +4176,14 @@ ethtool_cable_test_tdr_act_req_set_header_flags(struct ethtool_cable_test_tdr_ac req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_cable_test_tdr_act_req_set_header_phy_index(struct ethtool_cable_test_tdr_act_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} /* * Cable test TDR. @@ -3904,6 +4235,14 @@ ethtool_tunnel_info_get_req_set_header_flags(struct ethtool_tunnel_info_get_req req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_tunnel_info_get_req_set_header_phy_index(struct ethtool_tunnel_info_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_tunnel_info_get_rsp { struct { @@ -3968,6 +4307,14 @@ ethtool_tunnel_info_get_req_dump_set_header_flags(struct ethtool_tunnel_info_get req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_tunnel_info_get_req_dump_set_header_phy_index(struct ethtool_tunnel_info_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_tunnel_info_get_list { struct ethtool_tunnel_info_get_list *next; @@ -4024,6 +4371,14 @@ ethtool_fec_get_req_set_header_flags(struct ethtool_fec_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_fec_get_req_set_header_phy_index(struct ethtool_fec_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_fec_get_rsp { struct { @@ -4092,6 +4447,14 @@ ethtool_fec_get_req_dump_set_header_flags(struct ethtool_fec_get_req_dump *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_fec_get_req_dump_set_header_phy_index(struct ethtool_fec_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_fec_get_list { struct ethtool_fec_get_list *next; @@ -4166,6 +4529,14 @@ ethtool_fec_set_req_set_header_flags(struct ethtool_fec_set_req *req, req->header.flags = flags; } static inline void +ethtool_fec_set_req_set_header_phy_index(struct ethtool_fec_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_fec_set_req_set_modes_nomask(struct ethtool_fec_set_req *req) { req->_present.modes = 1; @@ -4282,6 +4653,14 @@ ethtool_module_eeprom_get_req_set_header_flags(struct ethtool_module_eeprom_get_ req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_module_eeprom_get_req_set_header_phy_index(struct ethtool_module_eeprom_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_module_eeprom_get_rsp { struct { @@ -4357,6 +4736,14 @@ ethtool_module_eeprom_get_req_dump_set_header_flags(struct ethtool_module_eeprom req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_module_eeprom_get_req_dump_set_header_phy_index(struct ethtool_module_eeprom_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_module_eeprom_get_list { struct ethtool_module_eeprom_get_list *next; @@ -4414,6 +4801,14 @@ ethtool_phc_vclocks_get_req_set_header_flags(struct ethtool_phc_vclocks_get_req req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_phc_vclocks_get_req_set_header_phy_index(struct ethtool_phc_vclocks_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_phc_vclocks_get_rsp { struct { @@ -4478,6 +4873,14 @@ ethtool_phc_vclocks_get_req_dump_set_header_flags(struct ethtool_phc_vclocks_get req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_phc_vclocks_get_req_dump_set_header_phy_index(struct ethtool_phc_vclocks_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_phc_vclocks_get_list { struct ethtool_phc_vclocks_get_list *next; @@ -4534,6 +4937,14 @@ ethtool_module_get_req_set_header_flags(struct ethtool_module_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_module_get_req_set_header_phy_index(struct ethtool_module_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_module_get_rsp { struct { @@ -4598,6 +5009,14 @@ ethtool_module_get_req_dump_set_header_flags(struct ethtool_module_get_req_dump req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_module_get_req_dump_set_header_phy_index(struct ethtool_module_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_module_get_list { struct ethtool_module_get_list *next; @@ -4669,6 +5088,14 @@ ethtool_module_set_req_set_header_flags(struct ethtool_module_set_req *req, req->header.flags = flags; } static inline void +ethtool_module_set_req_set_header_phy_index(struct ethtool_module_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_module_set_req_set_power_mode_policy(struct ethtool_module_set_req *req, __u8 power_mode_policy) { @@ -4731,6 +5158,14 @@ ethtool_pse_get_req_set_header_flags(struct ethtool_pse_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_pse_get_req_set_header_phy_index(struct ethtool_pse_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_pse_get_rsp { struct { @@ -4803,6 +5238,14 @@ ethtool_pse_get_req_dump_set_header_flags(struct ethtool_pse_get_req_dump *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_pse_get_req_dump_set_header_phy_index(struct ethtool_pse_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_pse_get_list { struct ethtool_pse_get_list *next; @@ -4862,6 +5305,14 @@ ethtool_pse_set_req_set_header_flags(struct ethtool_pse_set_req *req, req->header.flags = flags; } static inline void +ethtool_pse_set_req_set_header_phy_index(struct ethtool_pse_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_pse_set_req_set_podl_pse_admin_control(struct ethtool_pse_set_req *req, __u32 podl_pse_admin_control) { @@ -4924,6 +5375,14 @@ ethtool_rss_get_req_set_header_flags(struct ethtool_rss_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_rss_get_req_set_header_phy_index(struct ethtool_rss_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_rss_get_rsp { struct { @@ -4994,6 +5453,14 @@ ethtool_rss_get_req_dump_set_header_flags(struct ethtool_rss_get_req_dump *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_rss_get_req_dump_set_header_phy_index(struct ethtool_rss_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_rss_get_list { struct ethtool_rss_get_list *next; @@ -5049,6 +5516,14 @@ ethtool_plca_get_cfg_req_set_header_flags(struct ethtool_plca_get_cfg_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_plca_get_cfg_req_set_header_phy_index(struct ethtool_plca_get_cfg_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_plca_get_cfg_rsp { struct { @@ -5126,6 +5601,14 @@ ethtool_plca_get_cfg_req_dump_set_header_flags(struct ethtool_plca_get_cfg_req_d req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_plca_get_cfg_req_dump_set_header_phy_index(struct ethtool_plca_get_cfg_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_plca_get_cfg_list { struct ethtool_plca_get_cfg_list *next; @@ -5210,6 +5693,14 @@ ethtool_plca_set_cfg_req_set_header_flags(struct ethtool_plca_set_cfg_req *req, req->header.flags = flags; } static inline void +ethtool_plca_set_cfg_req_set_header_phy_index(struct ethtool_plca_set_cfg_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_plca_set_cfg_req_set_version(struct ethtool_plca_set_cfg_req *req, __u16 version) { @@ -5316,6 +5807,14 @@ ethtool_plca_get_status_req_set_header_flags(struct ethtool_plca_get_status_req req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_plca_get_status_req_set_header_phy_index(struct ethtool_plca_get_status_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_plca_get_status_rsp { struct { @@ -5394,6 +5893,14 @@ ethtool_plca_get_status_req_dump_set_header_flags(struct ethtool_plca_get_status req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_plca_get_status_req_dump_set_header_phy_index(struct ethtool_plca_get_status_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_plca_get_status_list { struct ethtool_plca_get_status_list *next; @@ -5450,6 +5957,14 @@ ethtool_mm_get_req_set_header_flags(struct ethtool_mm_get_req *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_mm_get_req_set_header_phy_index(struct ethtool_mm_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_mm_get_rsp { struct { @@ -5528,6 +6043,14 @@ ethtool_mm_get_req_dump_set_header_flags(struct ethtool_mm_get_req_dump *req, req->header._present.flags = 1; req->header.flags = flags; } +static inline void +ethtool_mm_get_req_dump_set_header_phy_index(struct ethtool_mm_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} struct ethtool_mm_get_list { struct ethtool_mm_get_list *next; @@ -5604,6 +6127,14 @@ ethtool_mm_set_req_set_header_flags(struct ethtool_mm_set_req *req, req->header.flags = flags; } static inline void +ethtool_mm_set_req_set_header_phy_index(struct ethtool_mm_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_mm_set_req_set_verify_enabled(struct ethtool_mm_set_req *req, __u8 verify_enabled) { @@ -5694,6 +6225,14 @@ ethtool_module_fw_flash_act_req_set_header_flags(struct ethtool_module_fw_flash_ req->header.flags = flags; } static inline void +ethtool_module_fw_flash_act_req_set_header_phy_index(struct ethtool_module_fw_flash_act_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_module_fw_flash_act_req_set_file_name(struct ethtool_module_fw_flash_act_req *req, const char *file_name) { @@ -5717,6 +6256,150 @@ ethtool_module_fw_flash_act_req_set_password(struct ethtool_module_fw_flash_act_ int ethtool_module_fw_flash_act(struct ynl_sock *ys, struct ethtool_module_fw_flash_act_req *req); +/* ============== ETHTOOL_MSG_PHY_GET ============== */ +/* ETHTOOL_MSG_PHY_GET - do */ +struct ethtool_phy_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_phy_get_req *ethtool_phy_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_phy_get_req)); +} +void ethtool_phy_get_req_free(struct ethtool_phy_get_req *req); + +static inline void +ethtool_phy_get_req_set_header_dev_index(struct ethtool_phy_get_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_get_req_set_header_dev_name(struct ethtool_phy_get_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_get_req_set_header_flags(struct ethtool_phy_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_phy_get_req_set_header_phy_index(struct ethtool_phy_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} + +struct ethtool_phy_get_rsp { + struct { + __u32 header:1; + __u32 index:1; + __u32 drvname_len; + __u32 name_len; + __u32 upstream_type:1; + __u32 upstream_index:1; + __u32 upstream_sfp_name_len; + __u32 downstream_sfp_name_len; + } _present; + + struct ethtool_header header; + __u32 index; + char *drvname; + char *name; + int upstream_type; + __u32 upstream_index; + char *upstream_sfp_name; + char *downstream_sfp_name; +}; + +void ethtool_phy_get_rsp_free(struct ethtool_phy_get_rsp *rsp); + +/* + * Get PHY devices attached to an interface + */ +struct ethtool_phy_get_rsp * +ethtool_phy_get(struct ynl_sock *ys, struct ethtool_phy_get_req *req); + +/* ETHTOOL_MSG_PHY_GET - dump */ +struct ethtool_phy_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_phy_get_req_dump * +ethtool_phy_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_phy_get_req_dump)); +} +void ethtool_phy_get_req_dump_free(struct ethtool_phy_get_req_dump *req); + +static inline void +ethtool_phy_get_req_dump_set_header_dev_index(struct ethtool_phy_get_req_dump *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_get_req_dump_set_header_dev_name(struct ethtool_phy_get_req_dump *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_get_req_dump_set_header_flags(struct ethtool_phy_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_phy_get_req_dump_set_header_phy_index(struct ethtool_phy_get_req_dump *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} + +struct ethtool_phy_get_list { + struct ethtool_phy_get_list *next; + struct ethtool_phy_get_rsp obj __attribute__((aligned(8))); +}; + +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_CABLE_TEST_NTF - event */ struct ethtool_cable_test_ntf_rsp { struct {