diff --git a/home/nipa/nipa_out/980238/ynl/old-code/ethtool-user.c b/home/nipa/nipa_out/980238/ynl/new-code/ethtool-user.c index 261e86516ac0..f06ccd8a73ba 100644 --- a/home/nipa/nipa_out/980238/ynl/old-code/ethtool-user.c +++ b/home/nipa/nipa_out/980238/ynl/new-code/ethtool-user.c @@ -201,6 +201,26 @@ const char *ethtool_pse_event_str(enum ethtool_pse_event value) return ethtool_pse_event_strmap[value]; } +static const char * const ethtool_rxfh_fields_strmap[] = { + [1] = "l2da", + [2] = "vlan", + [3] = "l3-proto", + [4] = "ip-src", + [5] = "ip-dst", + [6] = "l4-b-0-1", + [7] = "l4-b-2-3", + [8] = "gtp-teid", + [31] = "discard", +}; + +const char *ethtool_rxfh_fields_str(int value) +{ + value = ffs(value) - 1; + if (value < 0 || value >= (int)YNL_ARRAY_SIZE(ethtool_rxfh_fields_strmap)) + return NULL; + return ethtool_rxfh_fields_strmap[value]; +} + /* Policies */ const struct ynl_policy_attr ethtool_header_policy[ETHTOOL_A_HEADER_MAX + 1] = { [ETHTOOL_A_HEADER_UNSPEC] = { .name = "unspec", .type = YNL_PT_REJECT, }, @@ -288,6 +308,41 @@ const struct ynl_policy_nest ethtool_c33_pse_pw_limit_nest = { .table = ethtool_c33_pse_pw_limit_policy, }; +const struct ynl_policy_attr ethtool_flow_policy[ETHTOOL_A_FLOW_MAX + 1] = { + [ETHTOOL_A_FLOW_ETHER] = { .name = "ether", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_IP4] = { .name = "ip4", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_IP6] = { .name = "ip6", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_TCP4] = { .name = "tcp4", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_TCP6] = { .name = "tcp6", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_UDP4] = { .name = "udp4", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_UDP6] = { .name = "udp6", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_SCTP4] = { .name = "sctp4", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_SCTP6] = { .name = "sctp6", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_AH4] = { .name = "ah4", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_AH6] = { .name = "ah6", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_ESP4] = { .name = "esp4", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_ESP6] = { .name = "esp6", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_AH_ESP4] = { .name = "ah-esp4", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_AH_ESP6] = { .name = "ah-esp6", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_GTPU4] = { .name = "gtpu4", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_GTPU6] = { .name = "gtpu6", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_GTPC4] = { .name = "gtpc4", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_GTPC6] = { .name = "gtpc6", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_GTPC_TEID4] = { .name = "gtpc-teid4", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_GTPC_TEID6] = { .name = "gtpc-teid6", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_GTPU_EH4] = { .name = "gtpu-eh4", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_GTPU_EH6] = { .name = "gtpu-eh6", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_GTPU_UL4] = { .name = "gtpu-ul4", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_GTPU_UL6] = { .name = "gtpu-ul6", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_GTPU_DL4] = { .name = "gtpu-dl4", .type = YNL_PT_UINT, }, + [ETHTOOL_A_FLOW_GTPU_DL6] = { .name = "gtpu-dl6", .type = YNL_PT_UINT, }, +}; + +const struct ynl_policy_nest ethtool_flow_nest = { + .max_attr = ETHTOOL_A_FLOW_MAX, + .table = ethtool_flow_policy, +}; + const struct ynl_policy_attr ethtool_mm_stat_policy[ETHTOOL_A_MM_STAT_MAX + 1] = { [ETHTOOL_A_MM_STAT_UNSPEC] = { .name = "unspec", .type = YNL_PT_REJECT, }, [ETHTOOL_A_MM_STAT_PAD] = { .name = "pad", .type = YNL_PT_IGNORE, }, @@ -860,6 +915,7 @@ const struct ynl_policy_attr ethtool_rss_policy[ETHTOOL_A_RSS_MAX + 1] = { [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, }, + [ETHTOOL_A_RSS_FLOW_HASH] = { .name = "flow-hash", .type = YNL_PT_NEST, .nest = ðtool_flow_nest, }, }; const struct ynl_policy_nest ethtool_rss_nest = { @@ -1269,6 +1325,159 @@ int ethtool_c33_pse_pw_limit_parse(struct ynl_parse_arg *yarg, return 0; } +void ethtool_flow_free(struct ethtool_flow *obj) +{ +} + +int ethtool_flow_parse(struct ynl_parse_arg *yarg, const struct nlattr *nested) +{ + struct ethtool_flow *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_FLOW_ETHER) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.ether = 1; + dst->ether = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_IP4) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.ip4 = 1; + dst->ip4 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_IP6) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.ip6 = 1; + dst->ip6 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_TCP4) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.tcp4 = 1; + dst->tcp4 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_TCP6) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.tcp6 = 1; + dst->tcp6 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_UDP4) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.udp4 = 1; + dst->udp4 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_UDP6) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.udp6 = 1; + dst->udp6 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_SCTP4) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.sctp4 = 1; + dst->sctp4 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_SCTP6) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.sctp6 = 1; + dst->sctp6 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_AH4) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.ah4 = 1; + dst->ah4 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_AH6) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.ah6 = 1; + dst->ah6 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_ESP4) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.esp4 = 1; + dst->esp4 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_ESP6) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.esp6 = 1; + dst->esp6 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_AH_ESP4) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.ah_esp4 = 1; + dst->ah_esp4 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_AH_ESP6) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.ah_esp6 = 1; + dst->ah_esp6 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_GTPU4) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.gtpu4 = 1; + dst->gtpu4 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_GTPU6) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.gtpu6 = 1; + dst->gtpu6 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_GTPC4) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.gtpc4 = 1; + dst->gtpc4 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_GTPC6) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.gtpc6 = 1; + dst->gtpc6 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_GTPC_TEID4) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.gtpc_teid4 = 1; + dst->gtpc_teid4 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_GTPC_TEID6) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.gtpc_teid6 = 1; + dst->gtpc_teid6 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_GTPU_EH4) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.gtpu_eh4 = 1; + dst->gtpu_eh4 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_GTPU_EH6) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.gtpu_eh6 = 1; + dst->gtpu_eh6 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_GTPU_UL4) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.gtpu_ul4 = 1; + dst->gtpu_ul4 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_GTPU_UL6) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.gtpu_ul6 = 1; + dst->gtpu_ul6 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_GTPU_DL4) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.gtpu_dl4 = 1; + dst->gtpu_dl4 = ynl_attr_get_uint(attr); + } else if (type == ETHTOOL_A_FLOW_GTPU_DL6) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.gtpu_dl6 = 1; + dst->gtpu_dl6 = ynl_attr_get_uint(attr); + } + } + + return 0; +} + void ethtool_mm_stat_free(struct ethtool_mm_stat *obj) { } @@ -6406,6 +6615,7 @@ void ethtool_rss_get_rsp_free(struct ethtool_rss_get_rsp *rsp) ethtool_header_free(&rsp->header); free(rsp->indir); free(rsp->hkey); + ethtool_flow_free(&rsp->flow_hash); free(rsp); } @@ -6467,6 +6677,15 @@ int ethtool_rss_get_rsp_parse(const struct nlmsghdr *nlh, return YNL_PARSE_CB_ERROR; dst->_present.input_xfrm = 1; dst->input_xfrm = ynl_attr_get_u32(attr); + } else if (type == ETHTOOL_A_RSS_FLOW_HASH) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.flow_hash = 1; + + parg.rsp_policy = ðtool_flow_nest; + parg.data = &dst->flow_hash; + if (ethtool_flow_parse(&parg, attr)) + return YNL_PARSE_CB_ERROR; } } @@ -6525,6 +6744,7 @@ void ethtool_rss_get_list_free(struct ethtool_rss_get_list *rsp) ethtool_header_free(&rsp->obj.header); free(rsp->obj.indir); free(rsp->obj.hkey); + ethtool_flow_free(&rsp->obj.flow_hash); free(rsp); } } @@ -6569,6 +6789,7 @@ void ethtool_rss_get_ntf_free(struct ethtool_rss_get_ntf *rsp) ethtool_header_free(&rsp->obj.header); free(rsp->obj.indir); free(rsp->obj.hkey); + ethtool_flow_free(&rsp->obj.flow_hash); free(rsp); } diff --git a/home/nipa/nipa_out/980238/ynl/old-code/ethtool-user.h b/home/nipa/nipa_out/980238/ynl/new-code/ethtool-user.h index a4e28438f8b8..67943809f9d8 100644 --- a/home/nipa/nipa_out/980238/ynl/old-code/ethtool-user.h +++ b/home/nipa/nipa_out/980238/ynl/new-code/ethtool-user.h @@ -30,6 +30,7 @@ const char *ethtool_phy_upstream_type_str(enum phy_upstream value); const char *ethtool_tcp_data_split_str(enum ethtool_tcp_data_split value); const char *ethtool_hwtstamp_source_str(enum hwtstamp_source value); const char *ethtool_pse_event_str(enum ethtool_pse_event value); +const char *ethtool_rxfh_fields_str(int value); /* Common nested types */ struct ethtool_header { @@ -118,6 +119,66 @@ struct ethtool_c33_pse_pw_limit { __u32 max; }; +struct ethtool_flow { + struct { + __u32 ether:1; + __u32 ip4:1; + __u32 ip6:1; + __u32 tcp4:1; + __u32 tcp6:1; + __u32 udp4:1; + __u32 udp6:1; + __u32 sctp4:1; + __u32 sctp6:1; + __u32 ah4:1; + __u32 ah6:1; + __u32 esp4:1; + __u32 esp6:1; + __u32 ah_esp4:1; + __u32 ah_esp6:1; + __u32 gtpu4:1; + __u32 gtpu6:1; + __u32 gtpc4:1; + __u32 gtpc6:1; + __u32 gtpc_teid4:1; + __u32 gtpc_teid6:1; + __u32 gtpu_eh4:1; + __u32 gtpu_eh6:1; + __u32 gtpu_ul4:1; + __u32 gtpu_ul6:1; + __u32 gtpu_dl4:1; + __u32 gtpu_dl6:1; + } _present; + + __u64 ether; + __u64 ip4; + __u64 ip6; + __u64 tcp4; + __u64 tcp6; + __u64 udp4; + __u64 udp6; + __u64 sctp4; + __u64 sctp6; + __u64 ah4; + __u64 ah6; + __u64 esp4; + __u64 esp6; + __u64 ah_esp4; + __u64 ah_esp6; + __u64 gtpu4; + __u64 gtpu6; + __u64 gtpc4; + __u64 gtpc6; + __u64 gtpc_teid4; + __u64 gtpc_teid6; + __u64 gtpu_eh4; + __u64 gtpu_eh6; + __u64 gtpu_ul4; + __u64 gtpu_ul6; + __u64 gtpu_dl4; + __u64 gtpu_dl6; +}; + struct ethtool_mm_stat { struct { __u32 reassembly_errors:1; @@ -5883,6 +5944,7 @@ struct ethtool_rss_get_rsp { __u32 context:1; __u32 hfunc:1; __u32 input_xfrm:1; + __u32 flow_hash:1; } _present; struct { __u32 hkey; @@ -5897,6 +5959,7 @@ struct ethtool_rss_get_rsp { __u32 *indir; void *hkey; __u32 input_xfrm; + struct ethtool_flow flow_hash; }; void ethtool_rss_get_rsp_free(struct ethtool_rss_get_rsp *rsp);