// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)/* Do not edit directly, auto-generated from: *//* Documentation/netlink/specs/devlink.yaml *//* YNL-GEN user source */ #include <stdlib.h>#include <string.h>#include "devlink-user.h"#include "ynl.h"#include <linux/devlink.h> #include <libmnl/libmnl.h>#include <linux/genetlink.h> /* Enums */static const char * const devlink_op_strmap[] = { [3] = "get", // skip "port-get", duplicate reply value [DEVLINK_CMD_PORT_NEW] = "port-new", [13] = "sb-get", [17] = "sb-pool-get", [21] = "sb-port-pool-get", [25] = "sb-tc-pool-bind-get", [DEVLINK_CMD_ESWITCH_GET] = "eswitch-get", [DEVLINK_CMD_DPIPE_TABLE_GET] = "dpipe-table-get", [DEVLINK_CMD_DPIPE_ENTRIES_GET] = "dpipe-entries-get", [DEVLINK_CMD_DPIPE_HEADERS_GET] = "dpipe-headers-get", [DEVLINK_CMD_RESOURCE_DUMP] = "resource-dump", [DEVLINK_CMD_RELOAD] = "reload", [DEVLINK_CMD_PARAM_GET] = "param-get", [DEVLINK_CMD_REGION_GET] = "region-get", [DEVLINK_CMD_REGION_NEW] = "region-new", [DEVLINK_CMD_REGION_READ] = "region-read", [DEVLINK_CMD_PORT_PARAM_GET] = "port-param-get", [DEVLINK_CMD_INFO_GET] = "info-get", [DEVLINK_CMD_HEALTH_REPORTER_GET] = "health-reporter-get", [DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET] = "health-reporter-dump-get", [63] = "trap-get", [67] = "trap-group-get", [71] = "trap-policer-get", [76] = "rate-get", [80] = "linecard-get", [DEVLINK_CMD_SELFTESTS_GET] = "selftests-get",}; const char *devlink_op_str(int op){ if (op < 0 || op >= (int)MNL_ARRAY_SIZE(devlink_op_strmap)) return NULL; return devlink_op_strmap[op];} static const char * const devlink_sb_pool_type_strmap[] = { [0] = "ingress", [1] = "egress",}; const char *devlink_sb_pool_type_str(enum devlink_sb_pool_type value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_sb_pool_type_strmap)) return NULL; return devlink_sb_pool_type_strmap[value];} static const char * const devlink_port_type_strmap[] = { [0] = "notset", [1] = "auto", [2] = "eth", [3] = "ib",}; const char *devlink_port_type_str(enum devlink_port_type value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_port_type_strmap)) return NULL; return devlink_port_type_strmap[value];} static const char * const devlink_port_flavour_strmap[] = { [0] = "physical", [1] = "cpu", [2] = "dsa", [3] = "pci_pf", [4] = "pci_vf", [5] = "virtual", [6] = "unused", [7] = "pci_sf",}; const char *devlink_port_flavour_str(enum devlink_port_flavour value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_port_flavour_strmap)) return NULL; return devlink_port_flavour_strmap[value];} static const char * const devlink_port_fn_state_strmap[] = { [0] = "inactive", [1] = "active",}; const char *devlink_port_fn_state_str(enum devlink_port_fn_state value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_port_fn_state_strmap)) return NULL; return devlink_port_fn_state_strmap[value];} static const char * const devlink_port_fn_opstate_strmap[] = { [0] = "detached", [1] = "attached",}; const char *devlink_port_fn_opstate_str(enum devlink_port_fn_opstate value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_port_fn_opstate_strmap)) return NULL; return devlink_port_fn_opstate_strmap[value];} static const char * const devlink_port_fn_attr_cap_strmap[] = { [0] = "roce-bit", [1] = "migratable-bit", [2] = "ipsec-crypto-bit", [3] = "ipsec-packet-bit",}; const char *devlink_port_fn_attr_cap_str(enum devlink_port_fn_attr_cap value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_port_fn_attr_cap_strmap)) return NULL; return devlink_port_fn_attr_cap_strmap[value];} static const char * const devlink_sb_threshold_type_strmap[] = { [0] = "static", [1] = "dynamic",}; const char *devlink_sb_threshold_type_str(enum devlink_sb_threshold_type value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_sb_threshold_type_strmap)) return NULL; return devlink_sb_threshold_type_strmap[value];} static const char * const devlink_eswitch_mode_strmap[] = { [0] = "legacy", [1] = "switchdev",}; const char *devlink_eswitch_mode_str(enum devlink_eswitch_mode value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_eswitch_mode_strmap)) return NULL; return devlink_eswitch_mode_strmap[value];} static const char * const devlink_eswitch_inline_mode_strmap[] = { [0] = "none", [1] = "link", [2] = "network", [3] = "transport",}; const char *devlink_eswitch_inline_mode_str(enum devlink_eswitch_inline_mode value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_eswitch_inline_mode_strmap)) return NULL; return devlink_eswitch_inline_mode_strmap[value];} static const char * const devlink_eswitch_encap_mode_strmap[] = { [0] = "none", [1] = "basic",}; const char *devlink_eswitch_encap_mode_str(enum devlink_eswitch_encap_mode value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_eswitch_encap_mode_strmap)) return NULL; return devlink_eswitch_encap_mode_strmap[value];} static const char * const devlink_dpipe_match_type_strmap[] = { [0] = "field-exact",}; const char *devlink_dpipe_match_type_str(enum devlink_dpipe_match_type value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_dpipe_match_type_strmap)) return NULL; return devlink_dpipe_match_type_strmap[value];} static const char * const devlink_dpipe_action_type_strmap[] = { [0] = "field-modify",}; const char *devlink_dpipe_action_type_str(enum devlink_dpipe_action_type value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_dpipe_action_type_strmap)) return NULL; return devlink_dpipe_action_type_strmap[value];} static const char * const devlink_dpipe_field_mapping_type_strmap[] = { [0] = "none", [1] = "ifindex",}; const char *devlink_dpipe_field_mapping_type_str(enum devlink_dpipe_field_mapping_type value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_dpipe_field_mapping_type_strmap)) return NULL; return devlink_dpipe_field_mapping_type_strmap[value];} static const char * const devlink_resource_unit_strmap[] = { [0] = "entry",}; const char *devlink_resource_unit_str(enum devlink_resource_unit value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_resource_unit_strmap)) return NULL; return devlink_resource_unit_strmap[value];} static const char * const devlink_reload_action_strmap[] = { [1] = "driver-reinit", [2] = "fw-activate",}; const char *devlink_reload_action_str(enum devlink_reload_action value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_reload_action_strmap)) return NULL; return devlink_reload_action_strmap[value];} static const char * const devlink_param_cmode_strmap[] = { [0] = "runtime", [1] = "driverinit", [2] = "permanent",}; const char *devlink_param_cmode_str(enum devlink_param_cmode value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_param_cmode_strmap)) return NULL; return devlink_param_cmode_strmap[value];} static const char * const devlink_flash_overwrite_strmap[] = { [0] = "settings-bit", [1] = "identifiers-bit",}; const char *devlink_flash_overwrite_str(enum devlink_flash_overwrite value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_flash_overwrite_strmap)) return NULL; return devlink_flash_overwrite_strmap[value];} static const char * const devlink_trap_action_strmap[] = { [0] = "drop", [1] = "trap", [2] = "mirror",}; const char *devlink_trap_action_str(enum devlink_trap_action value){ if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_trap_action_strmap)) return NULL; return devlink_trap_action_strmap[value];} /* Policies */struct ynl_policy_attr devlink_dl_dpipe_match_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_MATCH_TYPE] = { .name = "dpipe-match-type", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_HEADER_ID] = { .name = "dpipe-header-id", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_HEADER_GLOBAL] = { .name = "dpipe-header-global", .type = YNL_PT_U8, }, [DEVLINK_ATTR_DPIPE_HEADER_INDEX] = { .name = "dpipe-header-index", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_FIELD_ID] = { .name = "dpipe-field-id", .type = YNL_PT_U32, },}; struct ynl_policy_nest devlink_dl_dpipe_match_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_match_policy,}; struct ynl_policy_attr devlink_dl_dpipe_match_value_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_MATCH] = { .name = "dpipe-match", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_match_nest, }, [DEVLINK_ATTR_DPIPE_VALUE] = { .name = "dpipe-value", .type = YNL_PT_BINARY,}, [DEVLINK_ATTR_DPIPE_VALUE_MASK] = { .name = "dpipe-value-mask", .type = YNL_PT_BINARY,}, [DEVLINK_ATTR_DPIPE_VALUE_MAPPING] = { .name = "dpipe-value-mapping", .type = YNL_PT_U32, },}; struct ynl_policy_nest devlink_dl_dpipe_match_value_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_match_value_policy,}; struct ynl_policy_attr devlink_dl_dpipe_action_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_ACTION_TYPE] = { .name = "dpipe-action-type", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_HEADER_ID] = { .name = "dpipe-header-id", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_HEADER_GLOBAL] = { .name = "dpipe-header-global", .type = YNL_PT_U8, }, [DEVLINK_ATTR_DPIPE_HEADER_INDEX] = { .name = "dpipe-header-index", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_FIELD_ID] = { .name = "dpipe-field-id", .type = YNL_PT_U32, },}; struct ynl_policy_nest devlink_dl_dpipe_action_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_action_policy,}; struct ynl_policy_attr devlink_dl_dpipe_action_value_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_ACTION] = { .name = "dpipe-action", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_action_nest, }, [DEVLINK_ATTR_DPIPE_VALUE] = { .name = "dpipe-value", .type = YNL_PT_BINARY,}, [DEVLINK_ATTR_DPIPE_VALUE_MASK] = { .name = "dpipe-value-mask", .type = YNL_PT_BINARY,}, [DEVLINK_ATTR_DPIPE_VALUE_MAPPING] = { .name = "dpipe-value-mapping", .type = YNL_PT_U32, },}; struct ynl_policy_nest devlink_dl_dpipe_action_value_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_action_value_policy,}; struct ynl_policy_attr devlink_dl_dpipe_field_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_FIELD_NAME] = { .name = "dpipe-field-name", .type = YNL_PT_NUL_STR, }, [DEVLINK_ATTR_DPIPE_FIELD_ID] = { .name = "dpipe-field-id", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH] = { .name = "dpipe-field-bitwidth", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE] = { .name = "dpipe-field-mapping-type", .type = YNL_PT_U32, },}; struct ynl_policy_nest devlink_dl_dpipe_field_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_field_policy,}; struct ynl_policy_attr devlink_dl_resource_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_RESOURCE_NAME] = { .name = "resource-name", .type = YNL_PT_NUL_STR, }, [DEVLINK_ATTR_RESOURCE_ID] = { .name = "resource-id", .type = YNL_PT_U64, }, [DEVLINK_ATTR_RESOURCE_SIZE] = { .name = "resource-size", .type = YNL_PT_U64, }, [DEVLINK_ATTR_RESOURCE_SIZE_NEW] = { .name = "resource-size-new", .type = YNL_PT_U64, }, [DEVLINK_ATTR_RESOURCE_SIZE_VALID] = { .name = "resource-size-valid", .type = YNL_PT_U8, }, [DEVLINK_ATTR_RESOURCE_SIZE_MIN] = { .name = "resource-size-min", .type = YNL_PT_U64, }, [DEVLINK_ATTR_RESOURCE_SIZE_MAX] = { .name = "resource-size-max", .type = YNL_PT_U64, }, [DEVLINK_ATTR_RESOURCE_SIZE_GRAN] = { .name = "resource-size-gran", .type = YNL_PT_U64, }, [DEVLINK_ATTR_RESOURCE_UNIT] = { .name = "resource-unit", .type = YNL_PT_U8, }, [DEVLINK_ATTR_RESOURCE_OCC] = { .name = "resource-occ", .type = YNL_PT_U64, },}; struct ynl_policy_nest devlink_dl_resource_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_resource_policy,}; struct ynl_policy_attr devlink_dl_info_version_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_INFO_VERSION_NAME] = { .name = "info-version-name", .type = YNL_PT_NUL_STR, }, [DEVLINK_ATTR_INFO_VERSION_VALUE] = { .name = "info-version-value", .type = YNL_PT_NUL_STR, },}; struct ynl_policy_nest devlink_dl_info_version_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_info_version_policy,}; struct ynl_policy_attr devlink_dl_fmsg_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_FMSG_OBJ_NEST_START] = { .name = "fmsg-obj-nest-start", .type = YNL_PT_FLAG, }, [DEVLINK_ATTR_FMSG_PAIR_NEST_START] = { .name = "fmsg-pair-nest-start", .type = YNL_PT_FLAG, }, [DEVLINK_ATTR_FMSG_ARR_NEST_START] = { .name = "fmsg-arr-nest-start", .type = YNL_PT_FLAG, }, [DEVLINK_ATTR_FMSG_NEST_END] = { .name = "fmsg-nest-end", .type = YNL_PT_FLAG, }, [DEVLINK_ATTR_FMSG_OBJ_NAME] = { .name = "fmsg-obj-name", .type = YNL_PT_NUL_STR, },}; struct ynl_policy_nest devlink_dl_fmsg_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_fmsg_policy,}; struct ynl_policy_attr devlink_dl_port_function_policy[DEVLINK_PORT_FUNCTION_ATTR_MAX + 1] = { [DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR] = { .name = "hw-addr", .type = YNL_PT_BINARY,}, [DEVLINK_PORT_FN_ATTR_STATE] = { .name = "state", .type = YNL_PT_U8, }, [DEVLINK_PORT_FN_ATTR_OPSTATE] = { .name = "opstate", .type = YNL_PT_U8, }, [DEVLINK_PORT_FN_ATTR_CAPS] = { .name = "caps", .type = YNL_PT_BITFIELD32, },}; struct ynl_policy_nest devlink_dl_port_function_nest = { .max_attr = DEVLINK_PORT_FUNCTION_ATTR_MAX, .table = devlink_dl_port_function_policy,}; struct ynl_policy_attr devlink_dl_reload_stats_entry_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_RELOAD_STATS_LIMIT] = { .name = "reload-stats-limit", .type = YNL_PT_U8, }, [DEVLINK_ATTR_RELOAD_STATS_VALUE] = { .name = "reload-stats-value", .type = YNL_PT_U32, },}; struct ynl_policy_nest devlink_dl_reload_stats_entry_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_reload_stats_entry_policy,}; struct ynl_policy_attr devlink_dl_reload_act_stats_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_RELOAD_STATS_ENTRY] = { .name = "reload-stats-entry", .type = YNL_PT_NEST, .nest = &devlink_dl_reload_stats_entry_nest, },}; struct ynl_policy_nest devlink_dl_reload_act_stats_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_reload_act_stats_policy,}; struct ynl_policy_attr devlink_dl_selftest_id_policy[DEVLINK_ATTR_SELFTEST_ID_MAX + 1] = { [DEVLINK_ATTR_SELFTEST_ID_FLASH] = { .name = "flash", .type = YNL_PT_FLAG, },}; struct ynl_policy_nest devlink_dl_selftest_id_nest = { .max_attr = DEVLINK_ATTR_SELFTEST_ID_MAX, .table = devlink_dl_selftest_id_policy,}; 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, },}; struct ynl_policy_nest devlink_dl_dpipe_table_matches_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_table_matches_policy,}; struct ynl_policy_attr devlink_dl_dpipe_table_actions_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_ACTION] = { .name = "dpipe-action", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_action_nest, },}; struct ynl_policy_nest devlink_dl_dpipe_table_actions_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_table_actions_policy,}; struct ynl_policy_attr devlink_dl_dpipe_entry_match_values_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_MATCH_VALUE] = { .name = "dpipe-match-value", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_match_value_nest, },}; struct ynl_policy_nest devlink_dl_dpipe_entry_match_values_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_entry_match_values_policy,}; struct ynl_policy_attr devlink_dl_dpipe_entry_action_values_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_ACTION_VALUE] = { .name = "dpipe-action-value", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_action_value_nest, },}; struct ynl_policy_nest devlink_dl_dpipe_entry_action_values_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_entry_action_values_policy,}; struct ynl_policy_attr devlink_dl_dpipe_header_fields_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_FIELD] = { .name = "dpipe-field", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_field_nest, },}; struct ynl_policy_nest devlink_dl_dpipe_header_fields_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_header_fields_policy,}; struct ynl_policy_attr devlink_dl_resource_list_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_RESOURCE] = { .name = "resource", .type = YNL_PT_NEST, .nest = &devlink_dl_resource_nest, },}; struct ynl_policy_nest devlink_dl_resource_list_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_resource_list_policy,}; struct ynl_policy_attr devlink_dl_reload_act_info_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_RELOAD_ACTION] = { .name = "reload-action", .type = YNL_PT_U8, }, [DEVLINK_ATTR_RELOAD_ACTION_STATS] = { .name = "reload-action-stats", .type = YNL_PT_NEST, .nest = &devlink_dl_reload_act_stats_nest, },}; struct ynl_policy_nest devlink_dl_reload_act_info_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_reload_act_info_policy,}; struct ynl_policy_attr devlink_dl_dpipe_table_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_TABLE_NAME] = { .name = "dpipe-table-name", .type = YNL_PT_NUL_STR, }, [DEVLINK_ATTR_DPIPE_TABLE_SIZE] = { .name = "dpipe-table-size", .type = YNL_PT_U64, }, [DEVLINK_ATTR_DPIPE_TABLE_MATCHES] = { .name = "dpipe-table-matches", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_table_matches_nest, }, [DEVLINK_ATTR_DPIPE_TABLE_ACTIONS] = { .name = "dpipe-table-actions", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_table_actions_nest, }, [DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED] = { .name = "dpipe-table-counters-enabled", .type = YNL_PT_U8, }, [DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID] = { .name = "dpipe-table-resource-id", .type = YNL_PT_U64, }, [DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS] = { .name = "dpipe-table-resource-units", .type = YNL_PT_U64, },}; Lines 1–500 of 6864. Load more
// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) /* Do not edit directly, auto-generated from: */ /* Documentation/netlink/specs/devlink.yaml */ /* YNL-GEN user source */ #include <stdlib.h> #include <string.h> #include "devlink-user.h" #include "ynl.h" #include <linux/devlink.h> #include <libmnl/libmnl.h> #include <linux/genetlink.h> /* Enums */ static const char * const devlink_op_strmap[] = { [3] = "get", // skip "port-get", duplicate reply value [DEVLINK_CMD_PORT_NEW] = "port-new", [13] = "sb-get", [17] = "sb-pool-get", [21] = "sb-port-pool-get", [25] = "sb-tc-pool-bind-get", [DEVLINK_CMD_ESWITCH_GET] = "eswitch-get", [DEVLINK_CMD_DPIPE_TABLE_GET] = "dpipe-table-get", [DEVLINK_CMD_DPIPE_ENTRIES_GET] = "dpipe-entries-get", [DEVLINK_CMD_DPIPE_HEADERS_GET] = "dpipe-headers-get", [DEVLINK_CMD_RESOURCE_DUMP] = "resource-dump", [DEVLINK_CMD_RELOAD] = "reload", [DEVLINK_CMD_PARAM_GET] = "param-get", [DEVLINK_CMD_REGION_GET] = "region-get", [DEVLINK_CMD_REGION_NEW] = "region-new", [DEVLINK_CMD_REGION_READ] = "region-read", [DEVLINK_CMD_PORT_PARAM_GET] = "port-param-get", [DEVLINK_CMD_INFO_GET] = "info-get", [DEVLINK_CMD_HEALTH_REPORTER_GET] = "health-reporter-get", [DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET] = "health-reporter-dump-get", [63] = "trap-get", [67] = "trap-group-get", [71] = "trap-policer-get", [76] = "rate-get", [80] = "linecard-get", [DEVLINK_CMD_SELFTESTS_GET] = "selftests-get", }; const char *devlink_op_str(int op) { if (op < 0 || op >= (int)MNL_ARRAY_SIZE(devlink_op_strmap)) return NULL; return devlink_op_strmap[op]; } static const char * const devlink_sb_pool_type_strmap[] = { [0] = "ingress", [1] = "egress", }; const char *devlink_sb_pool_type_str(enum devlink_sb_pool_type value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_sb_pool_type_strmap)) return NULL; return devlink_sb_pool_type_strmap[value]; } static const char * const devlink_port_type_strmap[] = { [0] = "notset", [1] = "auto", [2] = "eth", [3] = "ib", }; const char *devlink_port_type_str(enum devlink_port_type value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_port_type_strmap)) return NULL; return devlink_port_type_strmap[value]; } static const char * const devlink_port_flavour_strmap[] = { [0] = "physical", [1] = "cpu", [2] = "dsa", [3] = "pci_pf", [4] = "pci_vf", [5] = "virtual", [6] = "unused", [7] = "pci_sf", }; const char *devlink_port_flavour_str(enum devlink_port_flavour value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_port_flavour_strmap)) return NULL; return devlink_port_flavour_strmap[value]; } static const char * const devlink_port_fn_state_strmap[] = { [0] = "inactive", [1] = "active", }; const char *devlink_port_fn_state_str(enum devlink_port_fn_state value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_port_fn_state_strmap)) return NULL; return devlink_port_fn_state_strmap[value]; } static const char * const devlink_port_fn_opstate_strmap[] = { [0] = "detached", [1] = "attached", }; const char *devlink_port_fn_opstate_str(enum devlink_port_fn_opstate value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_port_fn_opstate_strmap)) return NULL; return devlink_port_fn_opstate_strmap[value]; } static const char * const devlink_port_fn_attr_cap_strmap[] = { [0] = "roce-bit", [1] = "migratable-bit", [2] = "ipsec-crypto-bit", [3] = "ipsec-packet-bit", }; const char *devlink_port_fn_attr_cap_str(enum devlink_port_fn_attr_cap value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_port_fn_attr_cap_strmap)) return NULL; return devlink_port_fn_attr_cap_strmap[value]; } static const char * const devlink_sb_threshold_type_strmap[] = { [0] = "static", [1] = "dynamic", }; const char *devlink_sb_threshold_type_str(enum devlink_sb_threshold_type value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_sb_threshold_type_strmap)) return NULL; return devlink_sb_threshold_type_strmap[value]; } static const char * const devlink_eswitch_mode_strmap[] = { [0] = "legacy", [1] = "switchdev", }; const char *devlink_eswitch_mode_str(enum devlink_eswitch_mode value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_eswitch_mode_strmap)) return NULL; return devlink_eswitch_mode_strmap[value]; } static const char * const devlink_eswitch_inline_mode_strmap[] = { [0] = "none", [1] = "link", [2] = "network", [3] = "transport", }; const char * devlink_eswitch_inline_mode_str(enum devlink_eswitch_inline_mode value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_eswitch_inline_mode_strmap)) return NULL; return devlink_eswitch_inline_mode_strmap[value]; } static const char * const devlink_eswitch_encap_mode_strmap[] = { [0] = "none", [1] = "basic", }; const char * devlink_eswitch_encap_mode_str(enum devlink_eswitch_encap_mode value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_eswitch_encap_mode_strmap)) return NULL; return devlink_eswitch_encap_mode_strmap[value]; } static const char * const devlink_dpipe_match_type_strmap[] = { [0] = "field-exact", }; const char *devlink_dpipe_match_type_str(enum devlink_dpipe_match_type value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_dpipe_match_type_strmap)) return NULL; return devlink_dpipe_match_type_strmap[value]; } static const char * const devlink_dpipe_action_type_strmap[] = { [0] = "field-modify", }; const char *devlink_dpipe_action_type_str(enum devlink_dpipe_action_type value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_dpipe_action_type_strmap)) return NULL; return devlink_dpipe_action_type_strmap[value]; } static const char * const devlink_dpipe_field_mapping_type_strmap[] = { [0] = "none", [1] = "ifindex", }; const char * devlink_dpipe_field_mapping_type_str(enum devlink_dpipe_field_mapping_type value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_dpipe_field_mapping_type_strmap)) return NULL; return devlink_dpipe_field_mapping_type_strmap[value]; } static const char * const devlink_resource_unit_strmap[] = { [0] = "entry", }; const char *devlink_resource_unit_str(enum devlink_resource_unit value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_resource_unit_strmap)) return NULL; return devlink_resource_unit_strmap[value]; } static const char * const devlink_reload_action_strmap[] = { [1] = "driver-reinit", [2] = "fw-activate", }; const char *devlink_reload_action_str(enum devlink_reload_action value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_reload_action_strmap)) return NULL; return devlink_reload_action_strmap[value]; } static const char * const devlink_param_cmode_strmap[] = { [0] = "runtime", [1] = "driverinit", [2] = "permanent", }; const char *devlink_param_cmode_str(enum devlink_param_cmode value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_param_cmode_strmap)) return NULL; return devlink_param_cmode_strmap[value]; } static const char * const devlink_flash_overwrite_strmap[] = { [0] = "settings-bit", [1] = "identifiers-bit", }; const char *devlink_flash_overwrite_str(enum devlink_flash_overwrite value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_flash_overwrite_strmap)) return NULL; return devlink_flash_overwrite_strmap[value]; } static const char * const devlink_trap_action_strmap[] = { [0] = "drop", [1] = "trap", [2] = "mirror", }; const char *devlink_trap_action_str(enum devlink_trap_action value) { if (value < 0 || value >= (int)MNL_ARRAY_SIZE(devlink_trap_action_strmap)) return NULL; return devlink_trap_action_strmap[value]; } /* Policies */ struct ynl_policy_attr devlink_dl_dpipe_match_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_MATCH_TYPE] = { .name = "dpipe-match-type", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_HEADER_ID] = { .name = "dpipe-header-id", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_HEADER_GLOBAL] = { .name = "dpipe-header-global", .type = YNL_PT_U8, }, [DEVLINK_ATTR_DPIPE_HEADER_INDEX] = { .name = "dpipe-header-index", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_FIELD_ID] = { .name = "dpipe-field-id", .type = YNL_PT_U32, }, }; struct ynl_policy_nest devlink_dl_dpipe_match_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_match_policy, }; struct ynl_policy_attr devlink_dl_dpipe_match_value_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_MATCH] = { .name = "dpipe-match", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_match_nest, }, [DEVLINK_ATTR_DPIPE_VALUE] = { .name = "dpipe-value", .type = YNL_PT_BINARY,}, [DEVLINK_ATTR_DPIPE_VALUE_MASK] = { .name = "dpipe-value-mask", .type = YNL_PT_BINARY,}, [DEVLINK_ATTR_DPIPE_VALUE_MAPPING] = { .name = "dpipe-value-mapping", .type = YNL_PT_U32, }, }; struct ynl_policy_nest devlink_dl_dpipe_match_value_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_match_value_policy, }; struct ynl_policy_attr devlink_dl_dpipe_action_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_ACTION_TYPE] = { .name = "dpipe-action-type", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_HEADER_ID] = { .name = "dpipe-header-id", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_HEADER_GLOBAL] = { .name = "dpipe-header-global", .type = YNL_PT_U8, }, [DEVLINK_ATTR_DPIPE_HEADER_INDEX] = { .name = "dpipe-header-index", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_FIELD_ID] = { .name = "dpipe-field-id", .type = YNL_PT_U32, }, }; struct ynl_policy_nest devlink_dl_dpipe_action_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_action_policy, }; struct ynl_policy_attr devlink_dl_dpipe_action_value_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_ACTION] = { .name = "dpipe-action", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_action_nest, }, [DEVLINK_ATTR_DPIPE_VALUE] = { .name = "dpipe-value", .type = YNL_PT_BINARY,}, [DEVLINK_ATTR_DPIPE_VALUE_MASK] = { .name = "dpipe-value-mask", .type = YNL_PT_BINARY,}, [DEVLINK_ATTR_DPIPE_VALUE_MAPPING] = { .name = "dpipe-value-mapping", .type = YNL_PT_U32, }, }; struct ynl_policy_nest devlink_dl_dpipe_action_value_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_action_value_policy, }; struct ynl_policy_attr devlink_dl_dpipe_field_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_FIELD_NAME] = { .name = "dpipe-field-name", .type = YNL_PT_NUL_STR, }, [DEVLINK_ATTR_DPIPE_FIELD_ID] = { .name = "dpipe-field-id", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH] = { .name = "dpipe-field-bitwidth", .type = YNL_PT_U32, }, [DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE] = { .name = "dpipe-field-mapping-type", .type = YNL_PT_U32, }, }; struct ynl_policy_nest devlink_dl_dpipe_field_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_field_policy, }; struct ynl_policy_attr devlink_dl_resource_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_RESOURCE_NAME] = { .name = "resource-name", .type = YNL_PT_NUL_STR, }, [DEVLINK_ATTR_RESOURCE_ID] = { .name = "resource-id", .type = YNL_PT_U64, }, [DEVLINK_ATTR_RESOURCE_SIZE] = { .name = "resource-size", .type = YNL_PT_U64, }, [DEVLINK_ATTR_RESOURCE_SIZE_NEW] = { .name = "resource-size-new", .type = YNL_PT_U64, }, [DEVLINK_ATTR_RESOURCE_SIZE_VALID] = { .name = "resource-size-valid", .type = YNL_PT_U8, }, [DEVLINK_ATTR_RESOURCE_SIZE_MIN] = { .name = "resource-size-min", .type = YNL_PT_U64, }, [DEVLINK_ATTR_RESOURCE_SIZE_MAX] = { .name = "resource-size-max", .type = YNL_PT_U64, }, [DEVLINK_ATTR_RESOURCE_SIZE_GRAN] = { .name = "resource-size-gran", .type = YNL_PT_U64, }, [DEVLINK_ATTR_RESOURCE_UNIT] = { .name = "resource-unit", .type = YNL_PT_U8, }, [DEVLINK_ATTR_RESOURCE_OCC] = { .name = "resource-occ", .type = YNL_PT_U64, }, }; struct ynl_policy_nest devlink_dl_resource_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_resource_policy, }; struct ynl_policy_attr devlink_dl_info_version_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_INFO_VERSION_NAME] = { .name = "info-version-name", .type = YNL_PT_NUL_STR, }, [DEVLINK_ATTR_INFO_VERSION_VALUE] = { .name = "info-version-value", .type = YNL_PT_NUL_STR, }, }; struct ynl_policy_nest devlink_dl_info_version_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_info_version_policy, }; struct ynl_policy_attr devlink_dl_fmsg_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_FMSG_OBJ_NEST_START] = { .name = "fmsg-obj-nest-start", .type = YNL_PT_FLAG, }, [DEVLINK_ATTR_FMSG_PAIR_NEST_START] = { .name = "fmsg-pair-nest-start", .type = YNL_PT_FLAG, }, [DEVLINK_ATTR_FMSG_ARR_NEST_START] = { .name = "fmsg-arr-nest-start", .type = YNL_PT_FLAG, }, [DEVLINK_ATTR_FMSG_NEST_END] = { .name = "fmsg-nest-end", .type = YNL_PT_FLAG, }, [DEVLINK_ATTR_FMSG_OBJ_NAME] = { .name = "fmsg-obj-name", .type = YNL_PT_NUL_STR, }, }; struct ynl_policy_nest devlink_dl_fmsg_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_fmsg_policy, }; struct ynl_policy_attr devlink_dl_port_function_policy[DEVLINK_PORT_FUNCTION_ATTR_MAX + 1] = { [DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR] = { .name = "hw-addr", .type = YNL_PT_BINARY,}, [DEVLINK_PORT_FN_ATTR_STATE] = { .name = "state", .type = YNL_PT_U8, }, [DEVLINK_PORT_FN_ATTR_OPSTATE] = { .name = "opstate", .type = YNL_PT_U8, }, [DEVLINK_PORT_FN_ATTR_CAPS] = { .name = "caps", .type = YNL_PT_BITFIELD32, }, }; struct ynl_policy_nest devlink_dl_port_function_nest = { .max_attr = DEVLINK_PORT_FUNCTION_ATTR_MAX, .table = devlink_dl_port_function_policy, }; struct ynl_policy_attr devlink_dl_reload_stats_entry_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_RELOAD_STATS_LIMIT] = { .name = "reload-stats-limit", .type = YNL_PT_U8, }, [DEVLINK_ATTR_RELOAD_STATS_VALUE] = { .name = "reload-stats-value", .type = YNL_PT_U32, }, }; struct ynl_policy_nest devlink_dl_reload_stats_entry_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_reload_stats_entry_policy, }; struct ynl_policy_attr devlink_dl_reload_act_stats_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_RELOAD_STATS_ENTRY] = { .name = "reload-stats-entry", .type = YNL_PT_NEST, .nest = &devlink_dl_reload_stats_entry_nest, }, }; struct ynl_policy_nest devlink_dl_reload_act_stats_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_reload_act_stats_policy, }; struct ynl_policy_attr devlink_dl_selftest_id_policy[DEVLINK_ATTR_SELFTEST_ID_MAX + 1] = { [DEVLINK_ATTR_SELFTEST_ID_FLASH] = { .name = "flash", .type = YNL_PT_FLAG, }, }; struct ynl_policy_nest devlink_dl_selftest_id_nest = { .max_attr = DEVLINK_ATTR_SELFTEST_ID_MAX, .table = devlink_dl_selftest_id_policy, }; 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, }, }; struct ynl_policy_nest devlink_dl_dpipe_table_matches_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_table_matches_policy, }; struct ynl_policy_attr devlink_dl_dpipe_table_actions_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_ACTION] = { .name = "dpipe-action", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_action_nest, }, }; struct ynl_policy_nest devlink_dl_dpipe_table_actions_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_table_actions_policy, }; struct ynl_policy_attr devlink_dl_dpipe_entry_match_values_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_MATCH_VALUE] = { .name = "dpipe-match-value", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_match_value_nest, }, }; struct ynl_policy_nest devlink_dl_dpipe_entry_match_values_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_entry_match_values_policy, }; struct ynl_policy_attr devlink_dl_dpipe_entry_action_values_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_ACTION_VALUE] = { .name = "dpipe-action-value", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_action_value_nest, }, }; struct ynl_policy_nest devlink_dl_dpipe_entry_action_values_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_entry_action_values_policy, }; struct ynl_policy_attr devlink_dl_dpipe_header_fields_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_FIELD] = { .name = "dpipe-field", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_field_nest, }, }; struct ynl_policy_nest devlink_dl_dpipe_header_fields_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_dpipe_header_fields_policy, }; struct ynl_policy_attr devlink_dl_resource_list_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_RESOURCE] = { .name = "resource", .type = YNL_PT_NEST, .nest = &devlink_dl_resource_nest, }, }; struct ynl_policy_nest devlink_dl_resource_list_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_resource_list_policy, }; struct ynl_policy_attr devlink_dl_reload_act_info_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_RELOAD_ACTION] = { .name = "reload-action", .type = YNL_PT_U8, }, [DEVLINK_ATTR_RELOAD_ACTION_STATS] = { .name = "reload-action-stats", .type = YNL_PT_NEST, .nest = &devlink_dl_reload_act_stats_nest, }, }; struct ynl_policy_nest devlink_dl_reload_act_info_nest = { .max_attr = DEVLINK_ATTR_MAX, .table = devlink_dl_reload_act_info_policy, }; struct ynl_policy_attr devlink_dl_dpipe_table_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_DPIPE_TABLE_NAME] = { .name = "dpipe-table-name", .type = YNL_PT_NUL_STR, }, [DEVLINK_ATTR_DPIPE_TABLE_SIZE] = { .name = "dpipe-table-size", .type = YNL_PT_U64, }, [DEVLINK_ATTR_DPIPE_TABLE_MATCHES] = { .name = "dpipe-table-matches", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_table_matches_nest, }, [DEVLINK_ATTR_DPIPE_TABLE_ACTIONS] = { .name = "dpipe-table-actions", .type = YNL_PT_NEST, .nest = &devlink_dl_dpipe_table_actions_nest, }, [DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED] = { .name = "dpipe-table-counters-enabled", .type = YNL_PT_U8, }, [DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID] = { .name = "dpipe-table-resource-id", .type = YNL_PT_U64, }, [DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS] = { .name = "dpipe-table-resource-units", .type = YNL_PT_U64, }, };