diff --git a/home/nipa/nipa_out/914715/ynl/old-code/devlink-user.c b/home/nipa/nipa_out/914715/ynl/new-code/devlink-user.c index 47c8c4cdca1b..e0ced437b683 100644 --- a/home/nipa/nipa_out/914715/ynl/old-code/devlink-user.c +++ b/home/nipa/nipa_out/914715/ynl/new-code/devlink-user.c @@ -538,6 +538,16 @@ const struct ynl_policy_nest devlink_dl_selftest_id_nest = { .table = devlink_dl_selftest_id_policy, }; +const struct ynl_policy_attr devlink_dl_rate_tc_bws_policy[DEVLINK_ATTR_MAX + 1] = { + [DEVLINK_ATTR_RATE_TC_INDEX] = { .name = "rate-tc-index", .type = YNL_PT_U8, }, + [DEVLINK_ATTR_RATE_TC_BW] = { .name = "rate-tc-bw", .type = YNL_PT_U32, }, +}; + +const struct ynl_policy_nest devlink_dl_rate_tc_bws_nest = { + .max_attr = DEVLINK_ATTR_MAX, + .table = devlink_dl_rate_tc_bws_policy, +}; + const struct ynl_policy_attr devlink_dl_dpipe_table_matches_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_MATCH] = { .name = "dpipe-match", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_match_nest, }, }; @@ -880,6 +890,9 @@ const struct ynl_policy_attr devlink_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_RATE_TX_PRIORITY] = { .name = "rate-tx-priority", .type = YNL_PT_U32, }, [DEVLINK_ATTR_RATE_TX_WEIGHT] = { .name = "rate-tx-weight", .type = YNL_PT_U32, }, [DEVLINK_ATTR_REGION_DIRECT] = { .name = "region-direct", .type = YNL_PT_FLAG, }, + [DEVLINK_ATTR_RATE_TC_BWS] = { .name = "rate-tc-bws", .type = YNL_PT_NEST, .nest = &devlink_dl_rate_tc_bws_nest, }, + [DEVLINK_ATTR_RATE_TC_INDEX] = { .name = "rate-tc-index", .type = YNL_PT_U8, }, + [DEVLINK_ATTR_RATE_TC_BW] = { .name = "rate-tc-bw", .type = YNL_PT_U32, }, }; const struct ynl_policy_nest devlink_nest = { @@ -1495,6 +1508,25 @@ int devlink_dl_selftest_id_put(struct nlmsghdr *nlh, unsigned int attr_type, return 0; } +void devlink_dl_rate_tc_bws_free(struct devlink_dl_rate_tc_bws *obj) +{ +} + +int devlink_dl_rate_tc_bws_put(struct nlmsghdr *nlh, unsigned int attr_type, + struct devlink_dl_rate_tc_bws *obj) +{ + struct nlattr *nest; + + nest = ynl_attr_nest_start(nlh, attr_type); + if (obj->_present.rate_tc_index) + ynl_attr_put_u8(nlh, DEVLINK_ATTR_RATE_TC_INDEX, obj->rate_tc_index); + if (obj->_present.rate_tc_bw) + ynl_attr_put_u32(nlh, DEVLINK_ATTR_RATE_TC_BW, obj->rate_tc_bw); + ynl_attr_nest_end(nlh, nest); + + return 0; +} + void devlink_dl_dpipe_table_matches_free(struct devlink_dl_dpipe_table_matches *obj) { @@ -6743,10 +6775,15 @@ devlink_rate_get_dump(struct ynl_sock *ys, /* DEVLINK_CMD_RATE_SET - do */ void devlink_rate_set_req_free(struct devlink_rate_set_req *req) { + unsigned int i; + free(req->bus_name); free(req->dev_name); free(req->rate_node_name); free(req->rate_parent_node_name); + for (i = 0; i < req->n_rate_tc_bws; i++) + devlink_dl_rate_tc_bws_free(&req->rate_tc_bws[i]); + free(req->rate_tc_bws); free(req); } @@ -6775,6 +6812,8 @@ int devlink_rate_set(struct ynl_sock *ys, struct devlink_rate_set_req *req) ynl_attr_put_u32(nlh, DEVLINK_ATTR_RATE_TX_WEIGHT, req->rate_tx_weight); if (req->_present.rate_parent_node_name_len) ynl_attr_put_str(nlh, DEVLINK_ATTR_RATE_PARENT_NODE_NAME, req->rate_parent_node_name); + for (unsigned int i = 0; i < req->n_rate_tc_bws; i++) + devlink_dl_rate_tc_bws_put(nlh, DEVLINK_ATTR_RATE_TC_BWS, &req->rate_tc_bws[i]); err = ynl_exec(ys, nlh, &yrs); if (err < 0) @@ -6787,10 +6826,15 @@ int devlink_rate_set(struct ynl_sock *ys, struct devlink_rate_set_req *req) /* DEVLINK_CMD_RATE_NEW - do */ void devlink_rate_new_req_free(struct devlink_rate_new_req *req) { + unsigned int i; + free(req->bus_name); free(req->dev_name); free(req->rate_node_name); free(req->rate_parent_node_name); + for (i = 0; i < req->n_rate_tc_bws; i++) + devlink_dl_rate_tc_bws_free(&req->rate_tc_bws[i]); + free(req->rate_tc_bws); free(req); } @@ -6819,6 +6863,8 @@ int devlink_rate_new(struct ynl_sock *ys, struct devlink_rate_new_req *req) ynl_attr_put_u32(nlh, DEVLINK_ATTR_RATE_TX_WEIGHT, req->rate_tx_weight); if (req->_present.rate_parent_node_name_len) ynl_attr_put_str(nlh, DEVLINK_ATTR_RATE_PARENT_NODE_NAME, req->rate_parent_node_name); + for (unsigned int i = 0; i < req->n_rate_tc_bws; i++) + devlink_dl_rate_tc_bws_put(nlh, DEVLINK_ATTR_RATE_TC_BWS, &req->rate_tc_bws[i]); err = ynl_exec(ys, nlh, &yrs); if (err < 0) diff --git a/home/nipa/nipa_out/914715/ynl/old-code/devlink-user.h b/home/nipa/nipa_out/914715/ynl/new-code/devlink-user.h index e08ff699a3c0..440f6bcb800b 100644 --- a/home/nipa/nipa_out/914715/ynl/old-code/devlink-user.h +++ b/home/nipa/nipa_out/914715/ynl/new-code/devlink-user.h @@ -283,6 +283,16 @@ struct devlink_dl_selftest_id { } _present; }; +struct devlink_dl_rate_tc_bws { + struct { + __u32 rate_tc_index:1; + __u32 rate_tc_bw:1; + } _present; + + __u8 rate_tc_index; + __u32 rate_tc_bw; +}; + struct devlink_dl_dpipe_table_matches { unsigned int n_dpipe_match; struct devlink_dl_dpipe_match *dpipe_match; @@ -4799,6 +4809,8 @@ struct devlink_rate_set_req { __u32 rate_tx_priority; __u32 rate_tx_weight; char *rate_parent_node_name; + unsigned int n_rate_tc_bws; + struct devlink_dl_rate_tc_bws *rate_tc_bws; }; static inline struct devlink_rate_set_req *devlink_rate_set_req_alloc(void) @@ -4875,6 +4887,15 @@ devlink_rate_set_req_set_rate_parent_node_name(struct devlink_rate_set_req *req, memcpy(req->rate_parent_node_name, rate_parent_node_name, req->_present.rate_parent_node_name_len); req->rate_parent_node_name[req->_present.rate_parent_node_name_len] = 0; } +static inline void +__devlink_rate_set_req_set_rate_tc_bws(struct devlink_rate_set_req *req, + struct devlink_dl_rate_tc_bws *rate_tc_bws, + unsigned int n_rate_tc_bws) +{ + free(req->rate_tc_bws); + req->rate_tc_bws = rate_tc_bws; + req->n_rate_tc_bws = n_rate_tc_bws; +} /* * Set rate instances. @@ -4903,6 +4924,8 @@ struct devlink_rate_new_req { __u32 rate_tx_priority; __u32 rate_tx_weight; char *rate_parent_node_name; + unsigned int n_rate_tc_bws; + struct devlink_dl_rate_tc_bws *rate_tc_bws; }; static inline struct devlink_rate_new_req *devlink_rate_new_req_alloc(void) @@ -4979,6 +5002,15 @@ devlink_rate_new_req_set_rate_parent_node_name(struct devlink_rate_new_req *req, memcpy(req->rate_parent_node_name, rate_parent_node_name, req->_present.rate_parent_node_name_len); req->rate_parent_node_name[req->_present.rate_parent_node_name_len] = 0; } +static inline void +__devlink_rate_new_req_set_rate_tc_bws(struct devlink_rate_new_req *req, + struct devlink_dl_rate_tc_bws *rate_tc_bws, + unsigned int n_rate_tc_bws) +{ + free(req->rate_tc_bws); + req->rate_tc_bws = rate_tc_bws; + req->n_rate_tc_bws = n_rate_tc_bws; +} /* * Create rate instances.