diff --git a/home/nipa/nipa_out/869718/ynl/old-code/ethtool-user.c b/home/nipa/nipa_out/869718/ynl/new-code/ethtool-user.c index 4821a0061627..1f143fd5fac9 100644 --- a/home/nipa/nipa_out/869718/ynl/old-code/ethtool-user.c +++ b/home/nipa/nipa_out/869718/ynl/new-code/ethtool-user.c @@ -59,6 +59,8 @@ static const char * const ethtool_op_strmap[] = { [ETHTOOL_MSG_MM_GET] = "mm-get", [43] = "mm-ntf", [44] = "module-fw-flash-ntf", + [ETHTOOL_MSG_TSCONFIG_GET] = "tsconfig-get", + [46] = "tsconfig-ntf", }; const char *ethtool_op_str(int op) @@ -173,6 +175,16 @@ const struct ynl_policy_nest ethtool_ts_stat_nest = { .table = ethtool_ts_stat_policy, }; +const struct ynl_policy_attr ethtool_ts_hwtstamp_provider_policy[ETHTOOL_A_TS_HWTSTAMP_PROVIDER_MAX + 1] = { + [ETHTOOL_A_TS_HWTSTAMP_PROVIDER_INDEX] = { .name = "index", .type = YNL_PT_U32, }, + [ETHTOOL_A_TS_HWTSTAMP_PROVIDER_QUALIFIER] = { .name = "qualifier", .type = YNL_PT_U32, }, +}; + +const struct ynl_policy_nest ethtool_ts_hwtstamp_provider_nest = { + .max_attr = ETHTOOL_A_TS_HWTSTAMP_PROVIDER_MAX, + .table = ethtool_ts_hwtstamp_provider_policy, +}; + const struct ynl_policy_attr ethtool_cable_test_tdr_cfg_policy[ETHTOOL_A_CABLE_TEST_TDR_CFG_MAX + 1] = { [ETHTOOL_A_CABLE_TEST_TDR_CFG_FIRST] = { .name = "first", .type = YNL_PT_U32, }, [ETHTOOL_A_CABLE_TEST_TDR_CFG_LAST] = { .name = "last", .type = YNL_PT_U32, }, @@ -589,6 +601,7 @@ const struct ynl_policy_attr ethtool_tsinfo_policy[ETHTOOL_A_TSINFO_MAX + 1] = { [ETHTOOL_A_TSINFO_RX_FILTERS] = { .name = "rx-filters", .type = YNL_PT_NEST, .nest = ðtool_bitset_nest, }, [ETHTOOL_A_TSINFO_PHC_INDEX] = { .name = "phc-index", .type = YNL_PT_U32, }, [ETHTOOL_A_TSINFO_STATS] = { .name = "stats", .type = YNL_PT_NEST, .nest = ðtool_ts_stat_nest, }, + [ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER] = { .name = "hwtstamp-provider", .type = YNL_PT_NEST, .nest = ðtool_ts_hwtstamp_provider_nest, }, }; const struct ynl_policy_nest ethtool_tsinfo_nest = { @@ -783,6 +796,19 @@ const struct ynl_policy_nest ethtool_module_fw_flash_nest = { .table = ethtool_module_fw_flash_policy, }; +const struct ynl_policy_attr ethtool_tsconfig_policy[ETHTOOL_A_TSCONFIG_MAX + 1] = { + [ETHTOOL_A_TSCONFIG_HEADER] = { .name = "header", .type = YNL_PT_NEST, .nest = ðtool_header_nest, }, + [ETHTOOL_A_TSCONFIG_HWTSTAMP_PROVIDER] = { .name = "hwtstamp-provider", .type = YNL_PT_NEST, .nest = ðtool_ts_hwtstamp_provider_nest, }, + [ETHTOOL_A_TSCONFIG_TX_TYPES] = { .name = "tx-types", .type = YNL_PT_NEST, .nest = ðtool_bitset_nest, }, + [ETHTOOL_A_TSCONFIG_RX_FILTERS] = { .name = "rx-filters", .type = YNL_PT_NEST, .nest = ðtool_bitset_nest, }, + [ETHTOOL_A_TSCONFIG_HWTSTAMP_FLAGS] = { .name = "hwtstamp-flags", .type = YNL_PT_U32, }, +}; + +const struct ynl_policy_nest ethtool_tsconfig_nest = { + .max_attr = ETHTOOL_A_TSCONFIG_MAX, + .table = ethtool_tsconfig_policy, +}; + /* Common nested types */ void ethtool_header_free(struct ethtool_header *obj) { @@ -920,6 +946,52 @@ int ethtool_ts_stat_parse(struct ynl_parse_arg *yarg, return 0; } +void +ethtool_ts_hwtstamp_provider_free(struct ethtool_ts_hwtstamp_provider *obj) +{ +} + +int ethtool_ts_hwtstamp_provider_put(struct nlmsghdr *nlh, + unsigned int attr_type, + struct ethtool_ts_hwtstamp_provider *obj) +{ + struct nlattr *nest; + + nest = ynl_attr_nest_start(nlh, attr_type); + if (obj->_present.index) + ynl_attr_put_u32(nlh, ETHTOOL_A_TS_HWTSTAMP_PROVIDER_INDEX, obj->index); + if (obj->_present.qualifier) + ynl_attr_put_u32(nlh, ETHTOOL_A_TS_HWTSTAMP_PROVIDER_QUALIFIER, obj->qualifier); + ynl_attr_nest_end(nlh, nest); + + return 0; +} + +int ethtool_ts_hwtstamp_provider_parse(struct ynl_parse_arg *yarg, + const struct nlattr *nested) +{ + struct ethtool_ts_hwtstamp_provider *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_TS_HWTSTAMP_PROVIDER_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_TS_HWTSTAMP_PROVIDER_QUALIFIER) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.qualifier = 1; + dst->qualifier = ynl_attr_get_u32(attr); + } + } + + return 0; +} + void ethtool_cable_test_tdr_cfg_free(struct ethtool_cable_test_tdr_cfg *obj) { } @@ -4707,6 +4779,7 @@ int ethtool_eee_set(struct ynl_sock *ys, struct ethtool_eee_set_req *req) void ethtool_tsinfo_get_req_free(struct ethtool_tsinfo_get_req *req) { ethtool_header_free(&req->header); + ethtool_ts_hwtstamp_provider_free(&req->hwtstamp_provider); free(req); } @@ -4717,6 +4790,7 @@ void ethtool_tsinfo_get_rsp_free(struct ethtool_tsinfo_get_rsp *rsp) ethtool_bitset_free(&rsp->tx_types); ethtool_bitset_free(&rsp->rx_filters); ethtool_ts_stat_free(&rsp->stats); + ethtool_ts_hwtstamp_provider_free(&rsp->hwtstamp_provider); free(rsp); } @@ -4783,6 +4857,15 @@ int ethtool_tsinfo_get_rsp_parse(const struct nlmsghdr *nlh, parg.data = &dst->stats; if (ethtool_ts_stat_parse(&parg, attr)) return YNL_PARSE_CB_ERROR; + } else if (type == ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.hwtstamp_provider = 1; + + parg.rsp_policy = ðtool_ts_hwtstamp_provider_nest; + parg.data = &dst->hwtstamp_provider; + if (ethtool_ts_hwtstamp_provider_parse(&parg, attr)) + return YNL_PARSE_CB_ERROR; } } @@ -4803,6 +4886,8 @@ ethtool_tsinfo_get(struct ynl_sock *ys, struct ethtool_tsinfo_get_req *req) if (req->_present.header) ethtool_header_put(nlh, ETHTOOL_A_TSINFO_HEADER, &req->header); + if (req->_present.hwtstamp_provider) + ethtool_ts_hwtstamp_provider_put(nlh, ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER, &req->hwtstamp_provider); rsp = calloc(1, sizeof(*rsp)); yrs.yarg.data = rsp; @@ -4824,6 +4909,7 @@ ethtool_tsinfo_get(struct ynl_sock *ys, struct ethtool_tsinfo_get_req *req) void ethtool_tsinfo_get_req_dump_free(struct ethtool_tsinfo_get_req_dump *req) { ethtool_header_free(&req->header); + ethtool_ts_hwtstamp_provider_free(&req->hwtstamp_provider); free(req); } @@ -4840,6 +4926,7 @@ void ethtool_tsinfo_get_list_free(struct ethtool_tsinfo_get_list *rsp) ethtool_bitset_free(&rsp->obj.tx_types); ethtool_bitset_free(&rsp->obj.rx_filters); ethtool_ts_stat_free(&rsp->obj.stats); + ethtool_ts_hwtstamp_provider_free(&rsp->obj.hwtstamp_provider); free(rsp); } } @@ -4864,6 +4951,8 @@ ethtool_tsinfo_get_dump(struct ynl_sock *ys, if (req->_present.header) ethtool_header_put(nlh, ETHTOOL_A_TSINFO_HEADER, &req->header); + if (req->_present.hwtstamp_provider) + ethtool_ts_hwtstamp_provider_put(nlh, ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER, &req->hwtstamp_provider); err = ynl_exec_dump(ys, nlh, &yds); if (err < 0) @@ -6793,6 +6882,219 @@ int ethtool_module_fw_flash_act(struct ynl_sock *ys, return 0; } +/* ============== ETHTOOL_MSG_TSCONFIG_GET ============== */ +/* ETHTOOL_MSG_TSCONFIG_GET - do */ +void ethtool_tsconfig_get_req_free(struct ethtool_tsconfig_get_req *req) +{ + ethtool_header_free(&req->header); + free(req); +} + +void ethtool_tsconfig_get_rsp_free(struct ethtool_tsconfig_get_rsp *rsp) +{ + ethtool_header_free(&rsp->header); + ethtool_ts_hwtstamp_provider_free(&rsp->hwtstamp_provider); + ethtool_bitset_free(&rsp->tx_types); + ethtool_bitset_free(&rsp->rx_filters); + free(rsp); +} + +int ethtool_tsconfig_get_rsp_parse(const struct nlmsghdr *nlh, + struct ynl_parse_arg *yarg) +{ + struct ethtool_tsconfig_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_TSCONFIG_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_TSCONFIG_HWTSTAMP_PROVIDER) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.hwtstamp_provider = 1; + + parg.rsp_policy = ðtool_ts_hwtstamp_provider_nest; + parg.data = &dst->hwtstamp_provider; + if (ethtool_ts_hwtstamp_provider_parse(&parg, attr)) + return YNL_PARSE_CB_ERROR; + } else if (type == ETHTOOL_A_TSCONFIG_TX_TYPES) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.tx_types = 1; + + parg.rsp_policy = ðtool_bitset_nest; + parg.data = &dst->tx_types; + if (ethtool_bitset_parse(&parg, attr)) + return YNL_PARSE_CB_ERROR; + } else if (type == ETHTOOL_A_TSCONFIG_RX_FILTERS) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.rx_filters = 1; + + parg.rsp_policy = ðtool_bitset_nest; + parg.data = &dst->rx_filters; + if (ethtool_bitset_parse(&parg, attr)) + return YNL_PARSE_CB_ERROR; + } else if (type == ETHTOOL_A_TSCONFIG_HWTSTAMP_FLAGS) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.hwtstamp_flags = 1; + dst->hwtstamp_flags = ynl_attr_get_u32(attr); + } + } + + return YNL_PARSE_CB_OK; +} + +struct ethtool_tsconfig_get_rsp * +ethtool_tsconfig_get(struct ynl_sock *ys, struct ethtool_tsconfig_get_req *req) +{ + struct ynl_req_state yrs = { .yarg = { .ys = ys, }, }; + struct ethtool_tsconfig_get_rsp *rsp; + struct nlmsghdr *nlh; + int err; + + nlh = ynl_gemsg_start_req(ys, ys->family_id, ETHTOOL_MSG_TSCONFIG_GET, 1); + ys->req_policy = ðtool_tsconfig_nest; + yrs.yarg.rsp_policy = ðtool_tsconfig_nest; + + if (req->_present.header) + ethtool_header_put(nlh, ETHTOOL_A_TSCONFIG_HEADER, &req->header); + + rsp = calloc(1, sizeof(*rsp)); + yrs.yarg.data = rsp; + yrs.cb = ethtool_tsconfig_get_rsp_parse; + yrs.rsp_cmd = ETHTOOL_MSG_TSCONFIG_GET; + + err = ynl_exec(ys, nlh, &yrs); + if (err < 0) + goto err_free; + + return rsp; + +err_free: + ethtool_tsconfig_get_rsp_free(rsp); + return NULL; +} + +/* ETHTOOL_MSG_TSCONFIG_GET - dump */ +void +ethtool_tsconfig_get_req_dump_free(struct ethtool_tsconfig_get_req_dump *req) +{ + ethtool_header_free(&req->header); + free(req); +} + +void ethtool_tsconfig_get_list_free(struct ethtool_tsconfig_get_list *rsp) +{ + struct ethtool_tsconfig_get_list *next = rsp; + + while ((void *)next != YNL_LIST_END) { + rsp = next; + next = rsp->next; + + ethtool_header_free(&rsp->obj.header); + ethtool_ts_hwtstamp_provider_free(&rsp->obj.hwtstamp_provider); + ethtool_bitset_free(&rsp->obj.tx_types); + ethtool_bitset_free(&rsp->obj.rx_filters); + free(rsp); + } +} + +struct ethtool_tsconfig_get_list * +ethtool_tsconfig_get_dump(struct ynl_sock *ys, + struct ethtool_tsconfig_get_req_dump *req) +{ + struct ynl_dump_state yds = {}; + struct nlmsghdr *nlh; + int err; + + yds.yarg.ys = ys; + yds.yarg.rsp_policy = ðtool_tsconfig_nest; + yds.yarg.data = NULL; + yds.alloc_sz = sizeof(struct ethtool_tsconfig_get_list); + yds.cb = ethtool_tsconfig_get_rsp_parse; + yds.rsp_cmd = ETHTOOL_MSG_TSCONFIG_GET; + + nlh = ynl_gemsg_start_dump(ys, ys->family_id, ETHTOOL_MSG_TSCONFIG_GET, 1); + ys->req_policy = ðtool_tsconfig_nest; + + if (req->_present.header) + ethtool_header_put(nlh, ETHTOOL_A_TSCONFIG_HEADER, &req->header); + + err = ynl_exec_dump(ys, nlh, &yds); + if (err < 0) + goto free_list; + + return yds.first; + +free_list: + ethtool_tsconfig_get_list_free(yds.first); + return NULL; +} + +/* ETHTOOL_MSG_TSCONFIG_GET - notify */ +void ethtool_tsconfig_get_ntf_free(struct ethtool_tsconfig_get_ntf *rsp) +{ + ethtool_header_free(&rsp->obj.header); + ethtool_ts_hwtstamp_provider_free(&rsp->obj.hwtstamp_provider); + ethtool_bitset_free(&rsp->obj.tx_types); + ethtool_bitset_free(&rsp->obj.rx_filters); + free(rsp); +} + +/* ============== ETHTOOL_MSG_TSCONFIG_SET ============== */ +/* ETHTOOL_MSG_TSCONFIG_SET - do */ +void ethtool_tsconfig_set_req_free(struct ethtool_tsconfig_set_req *req) +{ + ethtool_header_free(&req->header); + ethtool_ts_hwtstamp_provider_free(&req->hwtstamp_provider); + ethtool_bitset_free(&req->tx_types); + ethtool_bitset_free(&req->rx_filters); + free(req); +} + +int ethtool_tsconfig_set(struct ynl_sock *ys, + struct ethtool_tsconfig_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_TSCONFIG_SET, 1); + ys->req_policy = ðtool_tsconfig_nest; + + if (req->_present.header) + ethtool_header_put(nlh, ETHTOOL_A_TSCONFIG_HEADER, &req->header); + if (req->_present.hwtstamp_provider) + ethtool_ts_hwtstamp_provider_put(nlh, ETHTOOL_A_TSCONFIG_HWTSTAMP_PROVIDER, &req->hwtstamp_provider); + if (req->_present.tx_types) + ethtool_bitset_put(nlh, ETHTOOL_A_TSCONFIG_TX_TYPES, &req->tx_types); + if (req->_present.rx_filters) + ethtool_bitset_put(nlh, ETHTOOL_A_TSCONFIG_RX_FILTERS, &req->rx_filters); + if (req->_present.hwtstamp_flags) + ynl_attr_put_u32(nlh, ETHTOOL_A_TSCONFIG_HWTSTAMP_FLAGS, req->hwtstamp_flags); + + 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) @@ -7054,6 +7356,12 @@ static const struct ynl_ntf_info ethtool_ntf_info[] = { .policy = ðtool_module_fw_flash_nest, .free = (void *)ethtool_module_fw_flash_ntf_free, }, + [ETHTOOL_MSG_TSCONFIG_NTF] = { + .alloc_sz = sizeof(struct ethtool_tsconfig_get_ntf), + .cb = ethtool_tsconfig_get_rsp_parse, + .policy = ðtool_tsconfig_nest, + .free = (void *)ethtool_tsconfig_get_ntf_free, + }, }; const struct ynl_family ynl_ethtool_family = { diff --git a/home/nipa/nipa_out/869718/ynl/old-code/ethtool-user.h b/home/nipa/nipa_out/869718/ynl/new-code/ethtool-user.h index 06dc95e10464..c885a3aff9b3 100644 --- a/home/nipa/nipa_out/869718/ynl/old-code/ethtool-user.h +++ b/home/nipa/nipa_out/869718/ynl/new-code/ethtool-user.h @@ -60,6 +60,16 @@ struct ethtool_ts_stat { __u64 tx_err; }; +struct ethtool_ts_hwtstamp_provider { + struct { + __u32 index:1; + __u32 qualifier:1; + } _present; + + __u32 index; + __u32 qualifier; +}; + struct ethtool_cable_test_tdr_cfg { struct { __u32 first:1; @@ -3648,9 +3658,11 @@ int ethtool_eee_set(struct ynl_sock *ys, struct ethtool_eee_set_req *req); struct ethtool_tsinfo_get_req { struct { __u32 header:1; + __u32 hwtstamp_provider:1; } _present; struct ethtool_header header; + struct ethtool_ts_hwtstamp_provider hwtstamp_provider; }; static inline struct ethtool_tsinfo_get_req *ethtool_tsinfo_get_req_alloc(void) @@ -3686,6 +3698,22 @@ 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_hwtstamp_provider_index(struct ethtool_tsinfo_get_req *req, + __u32 index) +{ + req->_present.hwtstamp_provider = 1; + req->hwtstamp_provider._present.index = 1; + req->hwtstamp_provider.index = index; +} +static inline void +ethtool_tsinfo_get_req_set_hwtstamp_provider_qualifier(struct ethtool_tsinfo_get_req *req, + __u32 qualifier) +{ + req->_present.hwtstamp_provider = 1; + req->hwtstamp_provider._present.qualifier = 1; + req->hwtstamp_provider.qualifier = qualifier; +} struct ethtool_tsinfo_get_rsp { struct { @@ -3695,6 +3723,7 @@ struct ethtool_tsinfo_get_rsp { __u32 rx_filters:1; __u32 phc_index:1; __u32 stats:1; + __u32 hwtstamp_provider:1; } _present; struct ethtool_header header; @@ -3703,6 +3732,7 @@ struct ethtool_tsinfo_get_rsp { struct ethtool_bitset rx_filters; __u32 phc_index; struct ethtool_ts_stat stats; + struct ethtool_ts_hwtstamp_provider hwtstamp_provider; }; void ethtool_tsinfo_get_rsp_free(struct ethtool_tsinfo_get_rsp *rsp); @@ -3717,9 +3747,11 @@ ethtool_tsinfo_get(struct ynl_sock *ys, struct ethtool_tsinfo_get_req *req); struct ethtool_tsinfo_get_req_dump { struct { __u32 header:1; + __u32 hwtstamp_provider:1; } _present; struct ethtool_header header; + struct ethtool_ts_hwtstamp_provider hwtstamp_provider; }; static inline struct ethtool_tsinfo_get_req_dump * @@ -3756,6 +3788,22 @@ 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_hwtstamp_provider_index(struct ethtool_tsinfo_get_req_dump *req, + __u32 index) +{ + req->_present.hwtstamp_provider = 1; + req->hwtstamp_provider._present.index = 1; + req->hwtstamp_provider.index = index; +} +static inline void +ethtool_tsinfo_get_req_dump_set_hwtstamp_provider_qualifier(struct ethtool_tsinfo_get_req_dump *req, + __u32 qualifier) +{ + req->_present.hwtstamp_provider = 1; + req->hwtstamp_provider._present.qualifier = 1; + req->hwtstamp_provider.qualifier = qualifier; +} struct ethtool_tsinfo_get_list { struct ethtool_tsinfo_get_list *next; @@ -5749,6 +5797,274 @@ 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_TSCONFIG_GET ============== */ +/* ETHTOOL_MSG_TSCONFIG_GET - do */ +struct ethtool_tsconfig_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_tsconfig_get_req * +ethtool_tsconfig_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_tsconfig_get_req)); +} +void ethtool_tsconfig_get_req_free(struct ethtool_tsconfig_get_req *req); + +static inline void +ethtool_tsconfig_get_req_set_header_dev_index(struct ethtool_tsconfig_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_tsconfig_get_req_set_header_dev_name(struct ethtool_tsconfig_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_tsconfig_get_req_set_header_flags(struct ethtool_tsconfig_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_tsconfig_get_rsp { + struct { + __u32 header:1; + __u32 hwtstamp_provider:1; + __u32 tx_types:1; + __u32 rx_filters:1; + __u32 hwtstamp_flags:1; + } _present; + + struct ethtool_header header; + struct ethtool_ts_hwtstamp_provider hwtstamp_provider; + struct ethtool_bitset tx_types; + struct ethtool_bitset rx_filters; + __u32 hwtstamp_flags; +}; + +void ethtool_tsconfig_get_rsp_free(struct ethtool_tsconfig_get_rsp *rsp); + +/* + * Get hwtstamp config. + */ +struct ethtool_tsconfig_get_rsp * +ethtool_tsconfig_get(struct ynl_sock *ys, struct ethtool_tsconfig_get_req *req); + +/* ETHTOOL_MSG_TSCONFIG_GET - dump */ +struct ethtool_tsconfig_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_tsconfig_get_req_dump * +ethtool_tsconfig_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_tsconfig_get_req_dump)); +} +void +ethtool_tsconfig_get_req_dump_free(struct ethtool_tsconfig_get_req_dump *req); + +static inline void +ethtool_tsconfig_get_req_dump_set_header_dev_index(struct ethtool_tsconfig_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_tsconfig_get_req_dump_set_header_dev_name(struct ethtool_tsconfig_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_tsconfig_get_req_dump_set_header_flags(struct ethtool_tsconfig_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_tsconfig_get_list { + struct ethtool_tsconfig_get_list *next; + struct ethtool_tsconfig_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_tsconfig_get_list_free(struct ethtool_tsconfig_get_list *rsp); + +struct ethtool_tsconfig_get_list * +ethtool_tsconfig_get_dump(struct ynl_sock *ys, + struct ethtool_tsconfig_get_req_dump *req); + +/* ETHTOOL_MSG_TSCONFIG_GET - notify */ +struct ethtool_tsconfig_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_tsconfig_get_ntf *ntf); + struct ethtool_tsconfig_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_tsconfig_get_ntf_free(struct ethtool_tsconfig_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_TSCONFIG_SET ============== */ +/* ETHTOOL_MSG_TSCONFIG_SET - do */ +struct ethtool_tsconfig_set_req { + struct { + __u32 header:1; + __u32 hwtstamp_provider:1; + __u32 tx_types:1; + __u32 rx_filters:1; + __u32 hwtstamp_flags:1; + } _present; + + struct ethtool_header header; + struct ethtool_ts_hwtstamp_provider hwtstamp_provider; + struct ethtool_bitset tx_types; + struct ethtool_bitset rx_filters; + __u32 hwtstamp_flags; +}; + +static inline struct ethtool_tsconfig_set_req * +ethtool_tsconfig_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_tsconfig_set_req)); +} +void ethtool_tsconfig_set_req_free(struct ethtool_tsconfig_set_req *req); + +static inline void +ethtool_tsconfig_set_req_set_header_dev_index(struct ethtool_tsconfig_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_tsconfig_set_req_set_header_dev_name(struct ethtool_tsconfig_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_tsconfig_set_req_set_header_flags(struct ethtool_tsconfig_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_tsconfig_set_req_set_hwtstamp_provider_index(struct ethtool_tsconfig_set_req *req, + __u32 index) +{ + req->_present.hwtstamp_provider = 1; + req->hwtstamp_provider._present.index = 1; + req->hwtstamp_provider.index = index; +} +static inline void +ethtool_tsconfig_set_req_set_hwtstamp_provider_qualifier(struct ethtool_tsconfig_set_req *req, + __u32 qualifier) +{ + req->_present.hwtstamp_provider = 1; + req->hwtstamp_provider._present.qualifier = 1; + req->hwtstamp_provider.qualifier = qualifier; +} +static inline void +ethtool_tsconfig_set_req_set_tx_types_nomask(struct ethtool_tsconfig_set_req *req) +{ + req->_present.tx_types = 1; + req->tx_types._present.nomask = 1; +} +static inline void +ethtool_tsconfig_set_req_set_tx_types_size(struct ethtool_tsconfig_set_req *req, + __u32 size) +{ + req->_present.tx_types = 1; + req->tx_types._present.size = 1; + req->tx_types.size = size; +} +static inline void +__ethtool_tsconfig_set_req_set_tx_types_bits_bit(struct ethtool_tsconfig_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + req->_present.tx_types = 1; + req->tx_types._present.bits = 1; + free(req->tx_types.bits.bit); + req->tx_types.bits.bit = bit; + req->tx_types.bits.n_bit = n_bit; +} +static inline void +ethtool_tsconfig_set_req_set_rx_filters_nomask(struct ethtool_tsconfig_set_req *req) +{ + req->_present.rx_filters = 1; + req->rx_filters._present.nomask = 1; +} +static inline void +ethtool_tsconfig_set_req_set_rx_filters_size(struct ethtool_tsconfig_set_req *req, + __u32 size) +{ + req->_present.rx_filters = 1; + req->rx_filters._present.size = 1; + req->rx_filters.size = size; +} +static inline void +__ethtool_tsconfig_set_req_set_rx_filters_bits_bit(struct ethtool_tsconfig_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + req->_present.rx_filters = 1; + req->rx_filters._present.bits = 1; + free(req->rx_filters.bits.bit); + req->rx_filters.bits.bit = bit; + req->rx_filters.bits.n_bit = n_bit; +} +static inline void +ethtool_tsconfig_set_req_set_hwtstamp_flags(struct ethtool_tsconfig_set_req *req, + __u32 hwtstamp_flags) +{ + req->_present.hwtstamp_flags = 1; + req->hwtstamp_flags = hwtstamp_flags; +} + +/* + * Set hwtstamp config. + */ +int ethtool_tsconfig_set(struct ynl_sock *ys, + struct ethtool_tsconfig_set_req *req); + /* ETHTOOL_MSG_CABLE_TEST_NTF - event */ struct ethtool_cable_test_ntf_rsp { struct {