diff --git a/home/nipa/nipa_out/878027/ynl/old-code/ethtool-user.c b/home/nipa/nipa_out/878027/ynl/new-code/ethtool-user.c index 5941f2285e65..43d67a46a877 100644 --- a/home/nipa/nipa_out/878027/ynl/old-code/ethtool-user.c +++ b/home/nipa/nipa_out/878027/ynl/new-code/ethtool-user.c @@ -725,6 +725,7 @@ const struct ynl_policy_attr ethtool_rss_policy[ETHTOOL_A_RSS_MAX + 1] = { [ETHTOOL_A_RSS_INDIR] = { .name = "indir", .type = YNL_PT_BINARY,}, [ETHTOOL_A_RSS_HKEY] = { .name = "hkey", .type = YNL_PT_BINARY,}, [ETHTOOL_A_RSS_INPUT_XFRM] = { .name = "input_xfrm", .type = YNL_PT_U32, }, + [ETHTOOL_A_RSS_START_CONTEXT] = { .name = "start-context", .type = YNL_PT_U32, }, }; const struct ynl_policy_nest ethtool_rss_nest = { @@ -6103,6 +6104,61 @@ ethtool_rss_get(struct ynl_sock *ys, struct ethtool_rss_get_req *req) return NULL; } +/* ETHTOOL_MSG_RSS_GET - dump */ +void ethtool_rss_get_req_dump_free(struct ethtool_rss_get_req_dump *req) +{ + ethtool_header_free(&req->header); + free(req); +} + +void ethtool_rss_get_list_free(struct ethtool_rss_get_list *rsp) +{ + struct ethtool_rss_get_list *next = rsp; + + while ((void *)next != YNL_LIST_END) { + rsp = next; + next = rsp->next; + + ethtool_header_free(&rsp->obj.header); + free(rsp->obj.indir); + free(rsp->obj.hkey); + free(rsp); + } +} + +struct ethtool_rss_get_list * +ethtool_rss_get_dump(struct ynl_sock *ys, struct ethtool_rss_get_req_dump *req) +{ + struct ynl_dump_state yds = {}; + struct nlmsghdr *nlh; + int err; + + yds.yarg.ys = ys; + yds.yarg.rsp_policy = ðtool_rss_nest; + yds.yarg.data = NULL; + yds.alloc_sz = sizeof(struct ethtool_rss_get_list); + yds.cb = ethtool_rss_get_rsp_parse; + yds.rsp_cmd = ETHTOOL_MSG_RSS_GET; + + nlh = ynl_gemsg_start_dump(ys, ys->family_id, ETHTOOL_MSG_RSS_GET, 1); + ys->req_policy = ðtool_rss_nest; + + if (req->_present.header) + ethtool_header_put(nlh, ETHTOOL_A_RSS_HEADER, &req->header); + if (req->_present.start_context) + ynl_attr_put_u32(nlh, ETHTOOL_A_RSS_START_CONTEXT, req->start_context); + + err = ynl_exec_dump(ys, nlh, &yds); + if (err < 0) + goto free_list; + + return yds.first; + +free_list: + ethtool_rss_get_list_free(yds.first); + return NULL; +} + /* ============== ETHTOOL_MSG_PLCA_GET_CFG ============== */ /* ETHTOOL_MSG_PLCA_GET_CFG - do */ void ethtool_plca_get_cfg_req_free(struct ethtool_plca_get_cfg_req *req) diff --git a/home/nipa/nipa_out/878027/ynl/old-code/ethtool-user.h b/home/nipa/nipa_out/878027/ynl/new-code/ethtool-user.h index 1a3b15c36cb4..280f515dfe03 100644 --- a/home/nipa/nipa_out/878027/ynl/old-code/ethtool-user.h +++ b/home/nipa/nipa_out/878027/ynl/new-code/ethtool-user.h @@ -4991,6 +4991,69 @@ void ethtool_rss_get_rsp_free(struct ethtool_rss_get_rsp *rsp); struct ethtool_rss_get_rsp * ethtool_rss_get(struct ynl_sock *ys, struct ethtool_rss_get_req *req); +/* ETHTOOL_MSG_RSS_GET - dump */ +struct ethtool_rss_get_req_dump { + struct { + __u32 header:1; + __u32 start_context:1; + } _present; + + struct ethtool_header header; + __u32 start_context; +}; + +static inline struct ethtool_rss_get_req_dump * +ethtool_rss_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_rss_get_req_dump)); +} +void ethtool_rss_get_req_dump_free(struct ethtool_rss_get_req_dump *req); + +static inline void +ethtool_rss_get_req_dump_set_header_dev_index(struct ethtool_rss_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_rss_get_req_dump_set_header_dev_name(struct ethtool_rss_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_rss_get_req_dump_set_header_flags(struct ethtool_rss_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_rss_get_req_dump_set_start_context(struct ethtool_rss_get_req_dump *req, + __u32 start_context) +{ + req->_present.start_context = 1; + req->start_context = start_context; +} + +struct ethtool_rss_get_list { + struct ethtool_rss_get_list *next; + struct ethtool_rss_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_rss_get_list_free(struct ethtool_rss_get_list *rsp); + +struct ethtool_rss_get_list * +ethtool_rss_get_dump(struct ynl_sock *ys, struct ethtool_rss_get_req_dump *req); + /* ============== ETHTOOL_MSG_PLCA_GET_CFG ============== */ /* ETHTOOL_MSG_PLCA_GET_CFG - do */ struct ethtool_plca_get_cfg_req {