diff --git a/home/nipa/nipa_out/1012111/ynl/old-code/devlink-user.c b/home/nipa/nipa_out/1012111/ynl/new-code/devlink-user.c index 3186d5a404bb..12f3ffa88bd8 100644 --- a/home/nipa/nipa_out/1012111/ynl/old-code/devlink-user.c +++ b/home/nipa/nipa_out/1012111/ynl/new-code/devlink-user.c @@ -195,6 +195,18 @@ devlink_eswitch_encap_mode_str(enum devlink_eswitch_encap_mode value) return devlink_eswitch_encap_mode_strmap[value]; } +static const char * const devlink_eswitch_state_strmap[] = { + [0] = "none", + [1] = "basic", +}; + +const char *devlink_eswitch_state_str(enum devlink_eswitch_state value) +{ + if (value < 0 || value >= (int)YNL_ARRAY_SIZE(devlink_eswitch_state_strmap)) + return NULL; + return devlink_eswitch_state_strmap[value]; +} + static const char * const devlink_dpipe_header_id_strmap[] = { [0] = "ethernet", [1] = "ipv4", @@ -911,6 +923,7 @@ const struct ynl_policy_attr devlink_policy[DEVLINK_ATTR_MAX + 1] = { [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_HEALTH_REPORTER_BURST_PERIOD] = { .name = "health-reporter-burst-period", .type = YNL_PT_U64, }, + [DEVLINK_ATTR_ESWITCH_STATE] = { .name = "eswitch-state", .type = YNL_PT_U8, }, }; const struct ynl_policy_nest devlink_nest = { @@ -3797,6 +3810,11 @@ int devlink_eswitch_get_rsp_parse(const struct nlmsghdr *nlh, return YNL_PARSE_CB_ERROR; dst->_present.eswitch_encap_mode = 1; dst->eswitch_encap_mode = ynl_attr_get_u8(attr); + } else if (type == DEVLINK_ATTR_ESWITCH_STATE) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.eswitch_state = 1; + dst->eswitch_state = ynl_attr_get_u8(attr); } } @@ -3867,6 +3885,8 @@ int devlink_eswitch_set(struct ynl_sock *ys, ynl_attr_put_u8(nlh, DEVLINK_ATTR_ESWITCH_INLINE_MODE, req->eswitch_inline_mode); if (req->_present.eswitch_encap_mode) ynl_attr_put_u8(nlh, DEVLINK_ATTR_ESWITCH_ENCAP_MODE, req->eswitch_encap_mode); + if (req->_present.eswitch_state) + ynl_attr_put_u8(nlh, DEVLINK_ATTR_ESWITCH_STATE, req->eswitch_state); err = ynl_exec(ys, nlh, &yrs); if (err < 0) diff --git a/home/nipa/nipa_out/1012111/ynl/old-code/devlink-user.h b/home/nipa/nipa_out/1012111/ynl/new-code/devlink-user.h index 8206ab5b1804..c518509c0b27 100644 --- a/home/nipa/nipa_out/1012111/ynl/old-code/devlink-user.h +++ b/home/nipa/nipa_out/1012111/ynl/new-code/devlink-user.h @@ -32,6 +32,7 @@ const char * devlink_eswitch_inline_mode_str(enum devlink_eswitch_inline_mode value); const char * devlink_eswitch_encap_mode_str(enum devlink_eswitch_encap_mode value); +const char *devlink_eswitch_state_str(enum devlink_eswitch_state value); const char *devlink_dpipe_header_id_str(enum devlink_dpipe_header_id value); const char *devlink_dpipe_match_type_str(enum devlink_dpipe_match_type value); const char * @@ -2102,6 +2103,7 @@ struct devlink_eswitch_get_rsp { __u32 eswitch_mode:1; __u32 eswitch_inline_mode:1; __u32 eswitch_encap_mode:1; + __u32 eswitch_state:1; } _present; struct { __u32 bus_name; @@ -2113,6 +2115,7 @@ struct devlink_eswitch_get_rsp { enum devlink_eswitch_mode eswitch_mode; enum devlink_eswitch_inline_mode eswitch_inline_mode; enum devlink_eswitch_encap_mode eswitch_encap_mode; + enum devlink_eswitch_state eswitch_state; }; void devlink_eswitch_get_rsp_free(struct devlink_eswitch_get_rsp *rsp); @@ -2130,6 +2133,7 @@ struct devlink_eswitch_set_req { __u32 eswitch_mode:1; __u32 eswitch_inline_mode:1; __u32 eswitch_encap_mode:1; + __u32 eswitch_state:1; } _present; struct { __u32 bus_name; @@ -2141,6 +2145,7 @@ struct devlink_eswitch_set_req { enum devlink_eswitch_mode eswitch_mode; enum devlink_eswitch_inline_mode eswitch_inline_mode; enum devlink_eswitch_encap_mode eswitch_encap_mode; + enum devlink_eswitch_state eswitch_state; }; static inline struct devlink_eswitch_set_req * @@ -2191,6 +2196,13 @@ devlink_eswitch_set_req_set_eswitch_encap_mode(struct devlink_eswitch_set_req *r req->_present.eswitch_encap_mode = 1; req->eswitch_encap_mode = eswitch_encap_mode; } +static inline void +devlink_eswitch_set_req_set_eswitch_state(struct devlink_eswitch_set_req *req, + enum devlink_eswitch_state eswitch_state) +{ + req->_present.eswitch_state = 1; + req->eswitch_state = eswitch_state; +} /* * Set eswitch attributes.