diff --git a/home/nipa/nipa_out/917308/ynl/old-code/ethtool-user.c b/home/nipa/nipa_out/917308/ynl/new-code/ethtool-user.c index 7b3666b7bd8f..939d828baa41 100644 --- a/home/nipa/nipa_out/917308/ynl/old-code/ethtool-user.c +++ b/home/nipa/nipa_out/917308/ynl/new-code/ethtool-user.c @@ -62,6 +62,8 @@ 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", }; const char *ethtool_op_str(int op) @@ -205,6 +207,17 @@ 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_UNSPEC] = { .name = "unspec", .type = YNL_PT_REJECT, }, + [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_UNSPEC] = { .name = "unspec", .type = YNL_PT_REJECT, }, [ETHTOOL_A_CABLE_TEST_TDR_CFG_FIRST] = { .name = "first", .type = YNL_PT_U32, }, @@ -658,6 +671,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 = { @@ -884,6 +898,20 @@ 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_UNSPEC] = { .name = "unspec", .type = YNL_PT_REJECT, }, + [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) { @@ -1028,6 +1056,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) { } @@ -4851,6 +4925,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); } @@ -4861,6 +4936,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); } @@ -4927,6 +5003,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; } } @@ -4947,6 +5032,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; @@ -4968,6 +5055,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); } @@ -4984,6 +5072,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); } } @@ -5008,6 +5097,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) @@ -7143,6 +7234,289 @@ 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_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) diff --git a/home/nipa/nipa_out/917308/ynl/old-code/ethtool-user.h b/home/nipa/nipa_out/917308/ynl/new-code/ethtool-user.h index f4f53276cc3a..faba7498b32b 100644 --- a/home/nipa/nipa_out/917308/ynl/old-code/ethtool-user.h +++ b/home/nipa/nipa_out/917308/ynl/new-code/ethtool-user.h @@ -66,6 +66,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; @@ -4178,9 +4188,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) @@ -4224,6 +4236,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 { @@ -4233,6 +4261,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; @@ -4241,6 +4270,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); @@ -4255,9 +4285,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 * @@ -4302,6 +4334,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; @@ -6711,6 +6759,345 @@ 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_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 {