diff --git a/home/nipa/nipa_out/904694/ynl/old-code/ethtool-user.c b/home/nipa/nipa_out/904694/ynl/new-code/ethtool-user.c index 92fe355323b2..4d1b6924d204 100644 --- a/home/nipa/nipa_out/904694/ynl/old-code/ethtool-user.c +++ b/home/nipa/nipa_out/904694/ynl/new-code/ethtool-user.c @@ -61,6 +61,9 @@ static const char * const ethtool_op_strmap[] = { [44] = "module-fw-flash-ntf", [ETHTOOL_MSG_PHY_GET] = "phy-get", [46] = "phy-ntf", + [47] = "tsconfig-get", + [48] = "tsconfig-set", + [49] = "tsconfig-ntf", }; const char *ethtool_op_str(int op) @@ -188,6 +191,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, }, @@ -608,6 +621,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 = { @@ -819,6 +833,19 @@ const struct ynl_policy_nest ethtool_phy_nest = { .table = ethtool_phy_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) { @@ -963,6 +990,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) { } @@ -4786,6 +4859,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); } @@ -4796,6 +4870,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); } @@ -4862,6 +4937,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; } } @@ -4882,6 +4966,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; @@ -4903,6 +4989,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); } @@ -4919,6 +5006,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); } } @@ -4943,6 +5031,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) @@ -7078,6 +7168,299 @@ void ethtool_phy_get_ntf_free(struct ethtool_phy_get_ntf *rsp) free(rsp); } +/* ============== 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 = 47; + + 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 = 47; + + 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); +} + +void ethtool_tsconfig_set_rsp_free(struct ethtool_tsconfig_set_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_set_rsp_parse(const struct nlmsghdr *nlh, + struct ynl_parse_arg *yarg) +{ + struct ethtool_tsconfig_set_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_set_rsp * +ethtool_tsconfig_set(struct ynl_sock *ys, struct ethtool_tsconfig_set_req *req) +{ + struct ynl_req_state yrs = { .yarg = { .ys = ys, }, }; + struct ethtool_tsconfig_set_rsp *rsp; + 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; + yrs.yarg.rsp_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); + + rsp = calloc(1, sizeof(*rsp)); + yrs.yarg.data = rsp; + yrs.cb = ethtool_tsconfig_set_rsp_parse; + yrs.rsp_cmd = 48; + + err = ynl_exec(ys, nlh, &yrs); + if (err < 0) + goto err_free; + + return rsp; + +err_free: + ethtool_tsconfig_set_rsp_free(rsp); + return NULL; +} + /* ETHTOOL_MSG_CABLE_TEST_NTF - event */ int ethtool_cable_test_ntf_rsp_parse(const struct nlmsghdr *nlh, struct ynl_parse_arg *yarg) @@ -7345,6 +7728,12 @@ static const struct ynl_ntf_info ethtool_ntf_info[] = { .policy = ðtool_phy_nest, .free = (void *)ethtool_phy_get_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/904694/ynl/old-code/ethtool-user.h b/home/nipa/nipa_out/904694/ynl/new-code/ethtool-user.h index bde5d7750368..2fe5f4aa929f 100644 --- a/home/nipa/nipa_out/904694/ynl/old-code/ethtool-user.h +++ b/home/nipa/nipa_out/904694/ynl/new-code/ethtool-user.h @@ -63,6 +63,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; @@ -4175,9 +4185,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) @@ -4221,6 +4233,22 @@ ethtool_tsinfo_get_req_set_header_phy_index(struct ethtool_tsinfo_get_req *req, req->header._present.phy_index = 1; req->header.phy_index = phy_index; } +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 { @@ -4230,6 +4258,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; @@ -4238,6 +4267,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); @@ -4252,9 +4282,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 * @@ -4299,6 +4331,22 @@ ethtool_tsinfo_get_req_dump_set_header_phy_index(struct ethtool_tsinfo_get_req_d req->header._present.phy_index = 1; req->header.phy_index = phy_index; } +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; @@ -6708,6 +6756,356 @@ struct ethtool_phy_get_ntf { void ethtool_phy_get_ntf_free(struct ethtool_phy_get_ntf *rsp); +/* ============== 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; +} +static inline void +ethtool_tsconfig_get_req_set_header_phy_index(struct ethtool_tsconfig_get_req *req, + __u32 phy_index) +{ + req->_present.header = 1; + req->header._present.phy_index = 1; + req->header.phy_index = phy_index; +} + +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; +} +static inline void +ethtool_tsconfig_get_req_dump_set_header_phy_index(struct ethtool_tsconfig_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_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_header_phy_index(struct ethtool_tsconfig_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_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_tx_types_value(struct ethtool_tsconfig_set_req *req, + const void *value, size_t len) +{ + req->_present.tx_types = 1; + free(req->tx_types.value); + req->tx_types._present.value_len = len; + req->tx_types.value = malloc(req->tx_types._present.value_len); + memcpy(req->tx_types.value, value, req->tx_types._present.value_len); +} +static inline void +ethtool_tsconfig_set_req_set_tx_types_mask(struct ethtool_tsconfig_set_req *req, + const void *mask, size_t len) +{ + req->_present.tx_types = 1; + free(req->tx_types.mask); + req->tx_types._present.mask_len = len; + req->tx_types.mask = malloc(req->tx_types._present.mask_len); + memcpy(req->tx_types.mask, mask, req->tx_types._present.mask_len); +} +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_rx_filters_value(struct ethtool_tsconfig_set_req *req, + const void *value, size_t len) +{ + req->_present.rx_filters = 1; + free(req->rx_filters.value); + req->rx_filters._present.value_len = len; + req->rx_filters.value = malloc(req->rx_filters._present.value_len); + memcpy(req->rx_filters.value, value, req->rx_filters._present.value_len); +} +static inline void +ethtool_tsconfig_set_req_set_rx_filters_mask(struct ethtool_tsconfig_set_req *req, + const void *mask, size_t len) +{ + req->_present.rx_filters = 1; + free(req->rx_filters.mask); + req->rx_filters._present.mask_len = len; + req->rx_filters.mask = malloc(req->rx_filters._present.mask_len); + memcpy(req->rx_filters.mask, mask, req->rx_filters._present.mask_len); +} +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; +} + +struct ethtool_tsconfig_set_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_set_rsp_free(struct ethtool_tsconfig_set_rsp *rsp); + +/* + * Set hwtstamp config. + */ +struct ethtool_tsconfig_set_rsp * +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 {