diff --git a/home/nipa/nipa_out/858616/ynl/old-code/ethtool-user.c b/home/nipa/nipa_out/858616/ynl/new-code/ethtool-user.c index ba3e482b7e41..b5ff7fa965f5 100644 --- a/home/nipa/nipa_out/858616/ynl/old-code/ethtool-user.c +++ b/home/nipa/nipa_out/858616/ynl/new-code/ethtool-user.c @@ -58,6 +58,7 @@ static const char * const ethtool_op_strmap[] = { [41] = "plca-ntf", [ETHTOOL_MSG_MM_GET] = "mm-get", [43] = "mm-ntf", + [44] = "tsinfo-ntf", }; const char *ethtool_op_str(int op) @@ -138,6 +139,16 @@ struct ynl_policy_nest ethtool_ts_stat_nest = { .table = ethtool_ts_stat_policy, }; +struct ynl_policy_attr ethtool_tsinfo_hwtstamp_provider_policy[ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER_MAX + 1] = { + [ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER_INDEX] = { .name = "index", .type = YNL_PT_U32, }, + [ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER_QUALIFIER] = { .name = "qualifier", .type = YNL_PT_U32, }, +}; + +struct ynl_policy_nest ethtool_tsinfo_hwtstamp_provider_nest = { + .max_attr = ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER_MAX, + .table = ethtool_tsinfo_hwtstamp_provider_policy, +}; + 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, }, @@ -522,6 +533,9 @@ 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_GHWTSTAMP] = { .name = "ghwtstamp", .type = YNL_PT_U8, }, + [ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER] = { .name = "hwtstamp-provider", .type = YNL_PT_NEST, .nest = ðtool_tsinfo_hwtstamp_provider_nest, }, + [ETHTOOL_A_TSINFO_HWTSTAMP_FLAGS] = { .name = "hwtstamp-flags", .type = YNL_PT_U32, }, }; struct ynl_policy_nest ethtool_tsinfo_nest = { @@ -832,6 +846,52 @@ int ethtool_ts_stat_parse(struct ynl_parse_arg *yarg, return 0; } +void +ethtool_tsinfo_hwtstamp_provider_free(struct ethtool_tsinfo_hwtstamp_provider *obj) +{ +} + +int ethtool_tsinfo_hwtstamp_provider_put(struct nlmsghdr *nlh, + unsigned int attr_type, + struct ethtool_tsinfo_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_TSINFO_HWTSTAMP_PROVIDER_INDEX, obj->index); + if (obj->_present.qualifier) + ynl_attr_put_u32(nlh, ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER_QUALIFIER, obj->qualifier); + ynl_attr_nest_end(nlh, nest); + + return 0; +} + +int ethtool_tsinfo_hwtstamp_provider_parse(struct ynl_parse_arg *yarg, + const struct nlattr *nested) +{ + struct ethtool_tsinfo_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_TSINFO_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_TSINFO_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) { } @@ -4447,6 +4507,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_tsinfo_hwtstamp_provider_free(&req->hwtstamp_provider); free(req); } @@ -4457,6 +4518,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_tsinfo_hwtstamp_provider_free(&rsp->hwtstamp_provider); free(rsp); } @@ -4523,6 +4585,20 @@ 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_tsinfo_hwtstamp_provider_nest; + parg.data = &dst->hwtstamp_provider; + if (ethtool_tsinfo_hwtstamp_provider_parse(&parg, attr)) + return YNL_PARSE_CB_ERROR; + } else if (type == ETHTOOL_A_TSINFO_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); } } @@ -4543,6 +4619,10 @@ 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.ghwtstamp) + ynl_attr_put_u8(nlh, ETHTOOL_A_TSINFO_GHWTSTAMP, req->ghwtstamp); + if (req->_present.hwtstamp_provider) + ethtool_tsinfo_hwtstamp_provider_put(nlh, ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER, &req->hwtstamp_provider); rsp = calloc(1, sizeof(*rsp)); yrs.yarg.data = rsp; @@ -4564,6 +4644,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_tsinfo_hwtstamp_provider_free(&req->hwtstamp_provider); free(req); } @@ -4580,6 +4661,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_tsinfo_hwtstamp_provider_free(&rsp->obj.hwtstamp_provider); free(rsp); } } @@ -4604,6 +4686,10 @@ 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.ghwtstamp) + ynl_attr_put_u8(nlh, ETHTOOL_A_TSINFO_GHWTSTAMP, req->ghwtstamp); + if (req->_present.hwtstamp_provider) + ethtool_tsinfo_hwtstamp_provider_put(nlh, ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER, &req->hwtstamp_provider); err = ynl_exec_dump(ys, nlh, &yds); if (err < 0) @@ -4616,6 +4702,18 @@ ethtool_tsinfo_get_dump(struct ynl_sock *ys, return NULL; } +/* ETHTOOL_MSG_TSINFO_GET - notify */ +void ethtool_tsinfo_get_ntf_free(struct ethtool_tsinfo_get_ntf *rsp) +{ + ethtool_header_free(&rsp->obj.header); + ethtool_bitset_free(&rsp->obj.timestamping); + ethtool_bitset_free(&rsp->obj.tx_types); + ethtool_bitset_free(&rsp->obj.rx_filters); + ethtool_ts_stat_free(&rsp->obj.stats); + ethtool_tsinfo_hwtstamp_provider_free(&rsp->obj.hwtstamp_provider); + free(rsp); +} + /* ============== ETHTOOL_MSG_CABLE_TEST_ACT ============== */ /* ETHTOOL_MSG_CABLE_TEST_ACT - do */ void ethtool_cable_test_act_req_free(struct ethtool_cable_test_act_req *req) @@ -6448,6 +6546,44 @@ int ethtool_mm_set(struct ynl_sock *ys, struct ethtool_mm_set_req *req) return 0; } +/* ============== ETHTOOL_MSG_TSINFO_SET ============== */ +/* ETHTOOL_MSG_TSINFO_SET - do */ +void ethtool_tsinfo_set_req_free(struct ethtool_tsinfo_set_req *req) +{ + ethtool_header_free(&req->header); + ethtool_bitset_free(&req->tx_types); + ethtool_bitset_free(&req->rx_filters); + ethtool_tsinfo_hwtstamp_provider_free(&req->hwtstamp_provider); + free(req); +} + +int ethtool_tsinfo_set(struct ynl_sock *ys, struct ethtool_tsinfo_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_TSINFO_SET, 1); + ys->req_policy = ðtool_tsinfo_nest; + + if (req->_present.header) + ethtool_header_put(nlh, ETHTOOL_A_TSINFO_HEADER, &req->header); + if (req->_present.tx_types) + ethtool_bitset_put(nlh, ETHTOOL_A_TSINFO_TX_TYPES, &req->tx_types); + if (req->_present.rx_filters) + ethtool_bitset_put(nlh, ETHTOOL_A_TSINFO_RX_FILTERS, &req->rx_filters); + if (req->_present.hwtstamp_provider) + ethtool_tsinfo_hwtstamp_provider_put(nlh, ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER, &req->hwtstamp_provider); + if (req->_present.hwtstamp_flags) + ynl_attr_put_u32(nlh, ETHTOOL_A_TSINFO_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) @@ -6641,6 +6777,12 @@ static const struct ynl_ntf_info ethtool_ntf_info[] = { .policy = ðtool_mm_nest, .free = (void *)ethtool_mm_get_ntf_free, }, + [ETHTOOL_MSG_TSINFO_NTF] = { + .alloc_sz = sizeof(struct ethtool_tsinfo_get_ntf), + .cb = ethtool_tsinfo_get_rsp_parse, + .policy = ðtool_tsinfo_nest, + .free = (void *)ethtool_tsinfo_get_ntf_free, + }, }; const struct ynl_family ynl_ethtool_family = { diff --git a/home/nipa/nipa_out/858616/ynl/old-code/ethtool-user.h b/home/nipa/nipa_out/858616/ynl/new-code/ethtool-user.h index 20088a1862bf..1e162c44cfc2 100644 --- a/home/nipa/nipa_out/858616/ynl/old-code/ethtool-user.h +++ b/home/nipa/nipa_out/858616/ynl/new-code/ethtool-user.h @@ -57,6 +57,16 @@ struct ethtool_ts_stat { __u64 tx_err; }; +struct ethtool_tsinfo_hwtstamp_provider { + struct { + __u32 index:1; + __u32 qualifier:1; + } _present; + + __u32 index; + __u32 qualifier; +}; + struct ethtool_cable_test_tdr_cfg { struct { __u32 first:1; @@ -3590,9 +3600,13 @@ int ethtool_eee_set(struct ynl_sock *ys, struct ethtool_eee_set_req *req); struct ethtool_tsinfo_get_req { struct { __u32 header:1; + __u32 ghwtstamp:1; + __u32 hwtstamp_provider:1; } _present; struct ethtool_header header; + __u8 ghwtstamp; + struct ethtool_tsinfo_hwtstamp_provider hwtstamp_provider; }; static inline struct ethtool_tsinfo_get_req *ethtool_tsinfo_get_req_alloc(void) @@ -3628,6 +3642,29 @@ 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_ghwtstamp(struct ethtool_tsinfo_get_req *req, + __u8 ghwtstamp) +{ + req->_present.ghwtstamp = 1; + req->ghwtstamp = ghwtstamp; +} +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 { @@ -3637,6 +3674,8 @@ struct ethtool_tsinfo_get_rsp { __u32 rx_filters:1; __u32 phc_index:1; __u32 stats:1; + __u32 hwtstamp_provider:1; + __u32 hwtstamp_flags:1; } _present; struct ethtool_header header; @@ -3645,12 +3684,14 @@ struct ethtool_tsinfo_get_rsp { struct ethtool_bitset rx_filters; __u32 phc_index; struct ethtool_ts_stat stats; + struct ethtool_tsinfo_hwtstamp_provider hwtstamp_provider; + __u32 hwtstamp_flags; }; void ethtool_tsinfo_get_rsp_free(struct ethtool_tsinfo_get_rsp *rsp); /* - * Get tsinfo params. + * Get tsinfo params or hwtstamp config. */ struct ethtool_tsinfo_get_rsp * ethtool_tsinfo_get(struct ynl_sock *ys, struct ethtool_tsinfo_get_req *req); @@ -3659,9 +3700,13 @@ ethtool_tsinfo_get(struct ynl_sock *ys, struct ethtool_tsinfo_get_req *req); struct ethtool_tsinfo_get_req_dump { struct { __u32 header:1; + __u32 ghwtstamp:1; + __u32 hwtstamp_provider:1; } _present; struct ethtool_header header; + __u8 ghwtstamp; + struct ethtool_tsinfo_hwtstamp_provider hwtstamp_provider; }; static inline struct ethtool_tsinfo_get_req_dump * @@ -3698,6 +3743,29 @@ 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_ghwtstamp(struct ethtool_tsinfo_get_req_dump *req, + __u8 ghwtstamp) +{ + req->_present.ghwtstamp = 1; + req->ghwtstamp = ghwtstamp; +} +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; @@ -3710,6 +3778,17 @@ struct ethtool_tsinfo_get_list * ethtool_tsinfo_get_dump(struct ynl_sock *ys, struct ethtool_tsinfo_get_req_dump *req); +/* ETHTOOL_MSG_TSINFO_GET - notify */ +struct ethtool_tsinfo_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_tsinfo_get_ntf *ntf); + struct ethtool_tsinfo_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_tsinfo_get_ntf_free(struct ethtool_tsinfo_get_ntf *rsp); + /* ============== ETHTOOL_MSG_CABLE_TEST_ACT ============== */ /* ETHTOOL_MSG_CABLE_TEST_ACT - do */ struct ethtool_cable_test_act_req { @@ -5633,6 +5712,136 @@ ethtool_mm_set_req_set_tx_min_frag_size(struct ethtool_mm_set_req *req, */ int ethtool_mm_set(struct ynl_sock *ys, struct ethtool_mm_set_req *req); +/* ============== ETHTOOL_MSG_TSINFO_SET ============== */ +/* ETHTOOL_MSG_TSINFO_SET - do */ +struct ethtool_tsinfo_set_req { + struct { + __u32 header:1; + __u32 tx_types:1; + __u32 rx_filters:1; + __u32 hwtstamp_provider:1; + __u32 hwtstamp_flags:1; + } _present; + + struct ethtool_header header; + struct ethtool_bitset tx_types; + struct ethtool_bitset rx_filters; + struct ethtool_tsinfo_hwtstamp_provider hwtstamp_provider; + __u32 hwtstamp_flags; +}; + +static inline struct ethtool_tsinfo_set_req *ethtool_tsinfo_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_tsinfo_set_req)); +} +void ethtool_tsinfo_set_req_free(struct ethtool_tsinfo_set_req *req); + +static inline void +ethtool_tsinfo_set_req_set_header_dev_index(struct ethtool_tsinfo_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_tsinfo_set_req_set_header_dev_name(struct ethtool_tsinfo_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_tsinfo_set_req_set_header_flags(struct ethtool_tsinfo_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_tsinfo_set_req_set_tx_types_nomask(struct ethtool_tsinfo_set_req *req) +{ + req->_present.tx_types = 1; + req->tx_types._present.nomask = 1; +} +static inline void +ethtool_tsinfo_set_req_set_tx_types_size(struct ethtool_tsinfo_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_tsinfo_set_req_set_tx_types_bits_bit(struct ethtool_tsinfo_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_tsinfo_set_req_set_rx_filters_nomask(struct ethtool_tsinfo_set_req *req) +{ + req->_present.rx_filters = 1; + req->rx_filters._present.nomask = 1; +} +static inline void +ethtool_tsinfo_set_req_set_rx_filters_size(struct ethtool_tsinfo_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_tsinfo_set_req_set_rx_filters_bits_bit(struct ethtool_tsinfo_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_tsinfo_set_req_set_hwtstamp_provider_index(struct ethtool_tsinfo_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_tsinfo_set_req_set_hwtstamp_provider_qualifier(struct ethtool_tsinfo_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_tsinfo_set_req_set_hwtstamp_flags(struct ethtool_tsinfo_set_req *req, + __u32 hwtstamp_flags) +{ + req->_present.hwtstamp_flags = 1; + req->hwtstamp_flags = hwtstamp_flags; +} + +/* + * Set hwtstamp. + */ +int ethtool_tsinfo_set(struct ynl_sock *ys, struct ethtool_tsinfo_set_req *req); + /* ETHTOOL_MSG_CABLE_TEST_NTF - event */ struct ethtool_cable_test_ntf_rsp { struct {